Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor change to handle a null buffer. #57

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
7deb63c
OPTIM: Added two new fields to the evidence pair data structure.
jwrosewell Apr 10, 2024
1352545
OPTIM: Removed check of the collection pointer. It will always be pre…
jwrosewell Apr 10, 2024
dc1acf7
FEAT/PERF: Added a flag to the configuration called propertyValueInde…
jwrosewell Apr 19, 2024
97233b1
BUG/OPTIM: List properties were not previously returned properly.
jwrosewell Apr 20, 2024
b1b12c0
BUG: Check that the available properties have not been exhausted when…
jwrosewell Apr 20, 2024
07dc0e7
PERF/MINOR: Avoid setting up the memory if there are no values to pro…
jwrosewell Apr 23, 2024
5578ab1
DOC: Align the comment to the macro.
jwrosewell Apr 23, 2024
431f1b7
PERF: Optimised headers and evidence for improved performance.
jwrosewell May 8, 2024
c4a9987
BUG: Added the pseudo header separator into the headers.
jwrosewell May 8, 2024
8a224e6
FEAT: Added a new config flag for the index relating profiles to values.
jwrosewell May 23, 2024
88262f6
EXP: Added an additional index to speed up profile value retrieval.
jwrosewell May 23, 2024
7a1f494
FEAT: Init JSON output features.
jwrosewell May 24, 2024
5eab505
REFACT: Removed the index for profiles to values as provides little p…
jwrosewell May 24, 2024
dc0db9f
FEAT: Added JSON to the Visual Studio project.
jwrosewell May 24, 2024
f30aab1
REFACT/DOC: Added documentation and refactored to avoid using fiftyon…
jwrosewell Jun 7, 2024
d4c6819
BUG: Type should be the same as the length value.
jwrosewell Jul 17, 2024
1aea193
CLEANUP: Removed methods that are not used and the underlying impleme…
jwrosewell Jul 17, 2024
35e8681
BUG: Added checks for case insensitive header name uniqueness.
jwrosewell Jul 18, 2024
9bd8b03
TEST/REFACT: Removed tests for pseudo headers that are now handlded d…
jwrosewell Jul 18, 2024
34e3f95
CLEANUP: Fixed documentation to refer to the correct field name.
jwrosewell Jul 20, 2024
3db8bd4
BUG: Fixed to correctly return the point to the next byte in the buffer.
jwrosewell Jul 20, 2024
72b3c62
BUG: Missed evidence as the index was incremented twice.
jwrosewell Jul 20, 2024
c1ca615
CLEANUP: Removed empty lines.
jwrosewell Jul 21, 2024
87d8ac2
FEAT: Added methods to string.h/c to handle adding characters to a bu…
jwrosewell Jul 21, 2024
12764fe
BUG: Checks the exception as well as the index returned from the search.
jwrosewell Jul 21, 2024
10fa4f7
REFACT: Simplified the initialization of the callback structure.
jwrosewell Jul 21, 2024
0f556fa
REFACT: Modified the json handling to use the string builder.
jwrosewell Jul 21, 2024
8cd2828
FEAT: Added string builder aliases to the fiftyone headers.
jwrosewell Jul 21, 2024
f058ca9
CLEANUP: formatting.
jwrosewell Jul 21, 2024
bdbaec5
REFACT: Modified evidence manipulation for pseudo headers to use the …
jwrosewell Jul 21, 2024
4d6e8fb
REFACT: Changed the name of the buffer to builder to align with the c…
jwrosewell Jul 22, 2024
4ea7575
OPTIM: Uses memcpy to add multiple characters to the builder. If the …
jwrosewell Jul 22, 2024
616712c
TEST: (pseudo)headers, string, evidence, profile, indices
justadreamer Aug 5, 2024
0e3fb4b
FEAT design convert GHEV and SUA to HTTP headers
justadreamer Jun 21, 2024
e314211
FEAT: implement transform routines
loskamo Jul 25, 2024
78264a6
ci: add unified nightly pipeline
pi-alexander-popel Aug 12, 2024
9293a12
FIX: vcxproj: add in missing files
justadreamer Aug 16, 2024
080d88b
FIX: remove exception from callback signature
justadreamer Aug 16, 2024
760bb78
FIX: throw cpp exceptions from Transform wrapper
justadreamer Aug 18, 2024
89e5494
FIX: warnings in tests
justadreamer Aug 18, 2024
5d39d23
TEST: construct ph from empty or missing evidence
justadreamer Aug 19, 2024
17841da
FIX: exception is the last parameter in the signature of transform fu…
justadreamer Aug 19, 2024
00467e8
FEAT: Transform.cpp test coverage
loskamo Aug 20, 2024
e3a0d19
FEAT: cmake: build tests iff BUILD_TESTING enabled
justadreamer Aug 24, 2024
8c23e1f
FIX: order of headers in Transform.cpp to throw C++ exceptions
justadreamer Aug 25, 2024
9bc7a22
FIX: /EHsc flag for MSVC to suppress warning
justadreamer Aug 25, 2024
f4df683
FEAT: json.c test coverage
justadreamer Aug 27, 2024
d407472
FEAT: interop/dotnet: codegen, swig wrappers, example
loskamo Aug 20, 2024
25c4f11
FIX: string.c: null buffer case
justadreamer Aug 30, 2024
967f756
BUG: Relied on the including file to already have a reference to memo…
jwrosewell Sep 3, 2024
6203f45
FEAT/BUG: Adds a reference to the definition of size_t and now includ…
jwrosewell Sep 3, 2024
8fefbe7
REFACT: Integrates transform.* into the commone fiftyone.h short nami…
jwrosewell Sep 3, 2024
5018621
BUG: Incorrectly truncated the external method names.
jwrosewell Sep 4, 2024
ac5ded4
BUG: If the characters being added are not null terminated then the a…
jwrosewell Sep 4, 2024
fd166c9
OPTIM: When iterating evidence the callback method might add new valu…
jwrosewell Sep 7, 2024
0d56384
FIX: reinstate Exceptions.hpp include for C++ throw macro resolution
justadreamer Sep 4, 2024
f743feb
BUG: transform.c exception was set to SUCCESS
justadreamer Sep 4, 2024
fd38ed1
REFACT: use StringBuilder in transform API
justadreamer Sep 4, 2024
96f3e12
Revert "REFACT: use StringBuilder in transform API"
justadreamer Sep 6, 2024
546c284
FEAT: Added a common constant for the cookie prefix that so far has n…
jwrosewell Sep 9, 2024
ce94e9e
DOC/REFACT: Added documentation to indices.h.
jwrosewell Sep 10, 2024
94c617c
REFACT: Updated to handle exceptions being disabled via the directive…
jwrosewell Sep 10, 2024
0ea62dd
DOC: Tidy up of line length and spelling.
jwrosewell Sep 10, 2024
26f31e3
REFACT: transform: StringBuilder + fiftyoneDegreesTransformIterateResult
justadreamer Sep 10, 2024
a3beb5c
REFACT: transform internal routines to camelCase
justadreamer Sep 10, 2024
f0fc0ff
FIX: transform: reindent, width 80 columns
justadreamer Sep 10, 2024
4b09a5c
move transform** to device-detection-cxx
justadreamer Sep 11, 2024
7f334e0
FIX: remove transform from VS projects
justadreamer Sep 11, 2024
37c3a8b
FIX: removed Transform routines interop
justadreamer Sep 11, 2024
e3be913
DOC: Improved the code comments associated with the iteration over th…
jwrosewell Sep 13, 2024
1db1c0d
REFACT: Improved parameter naming by making consistent with other fea…
jwrosewell Sep 13, 2024
a815adb
FIX: overrides: add skipPrefix to IS_HEADER_MATCH macro
justadreamer Oct 7, 2024
0833f95
FEAT: introduce invalid input value status code
justadreamer Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions .github/workflows/nightly-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
name: Nightly Pipeline (dummy)
on: workflow_dispatch
name: Nightly Pipeline

on:
workflow_dispatch:
inputs:
dryrun:
type: boolean
default: false
schedule:
- cron: '5 0 * * *'

jobs:
dummy:
runs-on: ubuntu-latest
steps:
- run: echo "This is a dummy action to allow actions with the same filename to run from other branches"
PullRequests:
name: Nightly Pull Requests
uses: postindustria-tech/common-ci/.github/workflows/nightly-pull-requests.yml@nightly-pipeline
with:
common-ci-ref: nightly-pipeline
repo-name: ${{ github.event.repository.name }}
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}

Publish:
if: ${{ !cancelled() }}
needs: PullRequests
name: Nightly Publish
uses: postindustria-tech/common-ci/.github/workflows/nightly-publish.yml@nightly-pipeline
with:
common-ci-ref: nightly-pipeline
repo-name: ${{ github.event.repository.name }}
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/scheduler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Schedules nightly pipeline on non-main branches
name: Nightly Pipeline Scheduler

on:
schedule:
- cron: '5 0 * * *'

jobs:
schedule:
runs-on: ubuntu-latest
permissions:
actions: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Schedule version/4.5
run: gh workflow run nightly-pipeline.yml --repo '${{ github.repository }}' --ref version/4.5
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ googletest*/
*.CopyComplete
*.iobj
*.ipdb
**/Debug
**/Release
**/bin
**/CMakeFiles/
**/CMakeCache.txt
**/*.cmake
**/DartConfiguration.tcl
**/CMakeScripts/
**/*.ninja*
**/obj
**/*.dll
**/.vs
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ target_link_libraries(fiftyone-common-cxx fiftyone-common-c)
set_target_properties(fiftyone-common-c fiftyone-common-cxx PROPERTIES FOLDER "Common")
if (MSVC)
target_compile_options(fiftyone-common-c PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_compile_options(fiftyone-common-cxx PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_compile_options(fiftyone-common-cxx PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX" "/EHsc")
else ()
target_compile_options(fiftyone-common-c PRIVATE ${COMPILE_OPTION_DEBUG} "-Werror" "-Wno-atomic-alignment")
target_compile_options(fiftyone-common-cxx PRIVATE ${COMPILE_OPTION_DEBUG} "-Werror")
Expand All @@ -143,21 +143,21 @@ else ()
endif()
endif()

# Examples

add_executable(CachePerf ${CMAKE_CURRENT_LIST_DIR}/performance/CachePerf.c)
target_link_libraries(CachePerf fiftyone-common-c)
if (MSVC)
target_compile_options(CachePerf PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_link_options(CachePerf PRIVATE "/WX")
else ()
target_compile_options(CachePerf PRIVATE ${COMPILE_OPTION_DEBUG} "-Werror")
endif()
set_target_properties(CachePerf PROPERTIES FOLDER "Examples/Common")

# Tests
# BUILD_TESTING is true by default, but in some cases it is desirable to turn off

if(BUILD_TESTING)
# Examples
add_executable(CachePerf ${CMAKE_CURRENT_LIST_DIR}/performance/CachePerf.c)
target_link_libraries(CachePerf fiftyone-common-c)
if (MSVC)
target_compile_options(CachePerf PRIVATE "/D_CRT_SECURE_NO_WARNINGS" "/W4" "/WX")
target_link_options(CachePerf PRIVATE "/WX")
else ()
target_compile_options(CachePerf PRIVATE ${COMPILE_OPTION_DEBUG} "-Werror")
endif()
set_target_properties(CachePerf PROPERTIES FOLDER "Examples/Common")

# Download and unpack googletest at configure time
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
Expand Down
8 changes: 8 additions & 0 deletions ConfigBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ void ConfigBase::setTempDirectories(
mapTempDirectories();
}

void ConfigBase::setPropertyValueIndex(bool index) {
this->config->propertyValueIndex = index;
}

bool ConfigBase::getUseUpperPrefixHeaders() const {
return config->usesUpperPrefixedHeaders;
}
Expand All @@ -68,6 +72,10 @@ vector<string> ConfigBase::getTempDirectories() const {
return tempDirs;
}

bool ConfigBase::getPropertyValueIndex() const {
return config->propertyValueIndex;
}

uint16_t ConfigBase::getConcurrency() const {
return 0;
}
Expand Down
14 changes: 14 additions & 0 deletions ConfigBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ namespace FiftyoneDegrees {
*/
void setTempDirectories(vector<string> tempDirs);

/**
* Set whether or not an index to speed up the retrieval of values
* for profiles and properties is created.
* @param index should create an index
*/
void setPropertyValueIndex(bool index);

/**
* @}
* @name Getters
Expand Down Expand Up @@ -149,6 +156,13 @@ namespace FiftyoneDegrees {
*/
vector<string> getTempDirectories() const;

/**
* Gets a flag indicating if an index of values for properties and
* profile is created.
* @return true if an index should be created, or false if not.
*/
bool getPropertyValueIndex() const;

/**
* Get the expected number of concurrent accessors of the data set.
* @return concurrency
Expand Down
10 changes: 9 additions & 1 deletion Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ fiftyoneDegreesStatusCode StatusCodeException::getCode() const noexcept {
return statusCode;
}

#ifndef FIFTYONE_DEGREES_EXCEPTIONS_DISABLED
FatalException::FatalException(
fiftyoneDegreesException *exception) : StatusCodeException() {
fiftyoneDegreesException *exception) : StatusCodeException(exception->status) {
const char *exceptionMessage = ExceptionGetMessage(exception);
if (exceptionMessage != nullptr) {
message.append(exceptionMessage);
Free((void*)exceptionMessage);
}
}
#else
FatalException::FatalException(
fiftyoneDegreesException* exception) : StatusCodeException(NOT_SET) {
message.append(
"Exceptions disabled with FIFTYONE_DEGREES_EXCEPTIONS_DISABLED");
}
#endif

NotImplementedException::NotImplementedException()
: runtime_error("Function not yet implemented") {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ mkdir -p coverage; gcovr --html-detail -o coverage/coverage.html; open coverage/
To check the summary run:
```
gcovr -r . --print-summary
```
```
6 changes: 4 additions & 2 deletions VisualStudio/FiftyOne.Common.C/FiftyOne.Common.C.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<ClInclude Include="..\..\float.h" />
<ClInclude Include="..\..\headers.h" />
<ClInclude Include="..\..\ip.h" />
<ClInclude Include="..\..\json.h" />
<ClInclude Include="..\..\list.h" />
<ClInclude Include="..\..\indices.h" />
<ClInclude Include="..\..\memory.h" />
<ClInclude Include="..\..\overrides.h" />
<ClInclude Include="..\..\pair.h" />
Expand All @@ -28,7 +30,6 @@
<ClInclude Include="..\..\profile.h" />
<ClInclude Include="..\..\properties.h" />
<ClInclude Include="..\..\property.h" />
<ClInclude Include="..\..\pseudoheader.h" />
<ClInclude Include="..\..\resource.h" />
<ClInclude Include="..\..\results.h" />
<ClInclude Include="..\..\snprintf.h" />
Expand All @@ -53,15 +54,16 @@
<ClCompile Include="..\..\float.c" />
<ClCompile Include="..\..\headers.c" />
<ClCompile Include="..\..\ip.c" />
<ClCompile Include="..\..\json.c" />
<ClCompile Include="..\..\list.c" />
<ClCompile Include="..\..\indices.c" />
<ClCompile Include="..\..\memory.c" />
<ClCompile Include="..\..\overrides.c" />
<ClCompile Include="..\..\pool.c" />
<ClCompile Include="..\..\process.c" />
<ClCompile Include="..\..\profile.c" />
<ClCompile Include="..\..\properties.c" />
<ClCompile Include="..\..\property.c" />
<ClCompile Include="..\..\pseudoheader.c" />
<ClCompile Include="..\..\resource.c" />
<ClCompile Include="..\..\results.c" />
<ClCompile Include="..\..\status.c" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<ClInclude Include="..\..\yamlfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\indices.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\cache.c">
Expand Down Expand Up @@ -218,5 +221,8 @@
<ClCompile Include="..\..\yamlfile.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\indexes.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<ClCompile Include="..\..\tests\PoolTests.cpp" />
<ClCompile Include="..\..\tests\PropertiesTests.cpp" />
<ClCompile Include="..\..\tests\PropertyMetaDataTests.cpp" />
<ClCompile Include="..\..\tests\PseudoHeaderTests.cpp" />
<ClCompile Include="..\..\tests\RequiredPropertiesConfigTests.cpp" />
<ClCompile Include="..\..\tests\ResourceManagerTests.cpp" />
<ClCompile Include="..\..\tests\StatusTests.cpp" />
Expand All @@ -51,6 +50,7 @@
<ClCompile Include="..\..\tests\ThreadingTests.cpp" />
<ClCompile Include="..\..\tests\ValueTests.cpp" />
<ClCompile Include="..\..\tests\YamlFileTests.cpp" />
<ClCompile Include="..\..\tests\HeadersContainer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\Base.hpp" />
Expand All @@ -59,9 +59,11 @@
<ClInclude Include="..\..\tests\ExampleTests.hpp" />
<ClInclude Include="..\..\tests\FileHandle.hpp" />
<ClInclude Include="..\..\tests\pch.h" />
<ClInclude Include="..\..\tests\PseudoHeaderTests.hpp" />
<ClInclude Include="..\..\tests\StringCollection.hpp" />
<ClInclude Include="..\..\tests\TestStrings.hpp" />
<ClInclude Include="..\..\tests\FixedSizeCollection.hpp" />
<ClInclude Include="..\..\tests\VariableSizeCollection.hpp" />
<ClInclude Include="..\..\tests\HeadersContainer.hpp" />
</ItemGroup>
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets" Condition="Exists('..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets')" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
<ClCompile Include="..\..\tests\OverridesTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tests\PseudoHeaderTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\tests\TextFileTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -140,8 +137,5 @@
<ClInclude Include="..\..\tests\TestStrings.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\tests\PseudoHeaderTests.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions array.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
* @{
*/

#include <stdint.h>
#include "memory.h"

/**
* Simple array structure definition macro used for generic types.
* @param t type of item
Expand All @@ -51,7 +54,7 @@
typedef struct fiftyone_degrees_array_##t##_t { \
uint32_t count; /**< Number of used items */ \
uint32_t capacity; /**< Number of available items */ \
t *items; /**< Pointer to the first item */ \
t* items; /**< Pointer to the first item */ \
m /**< Add any members provided by the caller */ \
} t##Array;

Expand All @@ -64,7 +67,7 @@ typedef struct fiftyone_degrees_array_##t##_t { \
* Initialises the array.
*/
#define FIFTYONE_DEGREES_ARRAY_CREATE(t, i, c) \
i = (t##Array*)Malloc(FIFTYONE_DEGREES_ARRAY_SIZE(t,c)); \
i = (t##Array*)fiftyoneDegreesMalloc(FIFTYONE_DEGREES_ARRAY_SIZE(t,c)); \
if (i != NULL) { \
i->items = (t*)(i + 1); \
i->count = 0; \
Expand Down
1 change: 0 additions & 1 deletion cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* ********************************************************************* */

#include "cache.h"

#include "fiftyone.h"

/**
Expand Down
6 changes: 6 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@
#define EXTERNAL_VAR extern
#endif

// The characters at the start of a cookie or other storage key that indicate
// the item is related to 51Degrees.
#ifndef FIFTYONE_DEGREES_COMMON_COOKIE_PREFIX
#define FIFTYONE_DEGREES_COMMON_COOKIE_PREFIX "51D_"
#endif

#endif
Loading
Loading