diff options
author | vnugent <public@vaughnnugent.com> | 2024-04-02 13:33:52 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-04-02 13:33:52 -0400 |
commit | e07537a3dde8e16100ef1bcc2a54f9ade8ae856f (patch) | |
tree | 3dd2cdb2ef9e870e84d23ad0b6a0623893b8bba6 /lib/Net.Compression/vnlib_compress | |
parent | 21130c889bd8564b201aa16c8f645abdf85d374a (diff) |
Squashed commit of the following:
commit 4ca5791ed67b9834bdbd010206b30373e4705e9b
Author: vnugent <public@vaughnnugent.com>
Date: Tue Apr 2 13:32:12 2024 -0400
fix: Missed ! on null pointer check
commit 9b4036377c52200c6488c98180d69a0e63321f97
Author: vnugent <public@vaughnnugent.com>
Date: Tue Apr 2 13:22:29 2024 -0400
fix: Fix _In_ macro for compression public api
commit 53a7b4b5c5b67b4a4e06e1d9098cac4bcd6afd7c
Merge: 448a93b 21130c8
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 31 17:01:15 2024 -0400
Merge branch 'main' into develop
commit 448a93bb1d18d032087afe2476ffccb98634a54c
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 31 16:56:51 2024 -0400
ci: fix third-party dir cleanup
commit 9afed1427472da1ea13079f98dbe27339e55ee7d
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 31 16:43:15 2024 -0400
perf: Deprecate unsafememoryhandle span extensions
commit 3ff90da4f02af47ea6d233fdd4445337ebe36452
Author: vnugent <public@vaughnnugent.com>
Date: Sat Mar 30 21:36:18 2024 -0400
refactor: Updates, advanced tracing, http optimizations
commit 8d6b79b5ae309b36f265ba81529bcef8bfcd7414
Merge: 6c1667b 5585915
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 24 21:01:31 2024 -0400
Merge branch 'main' into develop
commit 6c1667be23597513537f8190e2f55d65eb9b7c7a
Author: vnugent <public@vaughnnugent.com>
Date: Fri Mar 22 12:01:53 2024 -0400
refactor: Overhauled native library loading and lazy init
commit ebf688f2f974295beabf7b5def7e6f6f150551d0
Author: vnugent <public@vaughnnugent.com>
Date: Wed Mar 20 22:16:17 2024 -0400
refactor: Update compression header files and macros + Ci build
commit 9c7b564911080ccd5cbbb9851a0757b05e1e9047
Author: vnugent <public@vaughnnugent.com>
Date: Tue Mar 19 21:54:49 2024 -0400
refactor: JWK overhaul & add length getter to FileUpload
commit 6d8c3444e09561e5957491b3cc1ae858e0abdd14
Author: vnugent <public@vaughnnugent.com>
Date: Mon Mar 18 16:13:20 2024 -0400
feat: Add FNV1a software checksum and basic correction tests
commit 00d182088cecefc08ca80b1faee9bed3f215f40b
Author: vnugent <public@vaughnnugent.com>
Date: Fri Mar 15 01:05:27 2024 -0400
chore: #6 Use utils filewatcher instead of built-in
commit d513c10d9895c6693519ef1d459c6a5a76929436
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 10 21:58:14 2024 -0400
source tree project location updated
Diffstat (limited to 'lib/Net.Compression/vnlib_compress')
-rw-r--r-- | lib/Net.Compression/vnlib_compress/Taskfile.yaml | 4 | ||||
-rw-r--r-- | lib/Net.Compression/vnlib_compress/compression.c | 43 | ||||
-rw-r--r-- | lib/Net.Compression/vnlib_compress/compression.h | 6 | ||||
-rw-r--r-- | lib/Net.Compression/vnlib_compress/util.h | 5 |
4 files changed, 17 insertions, 41 deletions
diff --git a/lib/Net.Compression/vnlib_compress/Taskfile.yaml b/lib/Net.Compression/vnlib_compress/Taskfile.yaml index 017c9d8..fff756d 100644 --- a/lib/Net.Compression/vnlib_compress/Taskfile.yaml +++ b/lib/Net.Compression/vnlib_compress/Taskfile.yaml @@ -78,8 +78,8 @@ tasks: - cmd: powershell -Command "cp ../LICENSE build/Release/license.txt" #create static-build archives - - cd build/Debug && tar -czf ../../bin/win-x64-debug.tgz {{.TAR_FILES}} - - cd build/Release && tar -czf ../../bin/win-x64-release.tgz {{.TAR_FILES}} + - cd build/Debug && tar -czf ../../bin/msvc-x64-debug-{{.PROJECT_NAME}}.tgz {{.TAR_FILES}} + - cd build/Release && tar -czf ../../bin/msvc-x64-release-{{.PROJECT_NAME}}.tgz {{.TAR_FILES}} #Remove the output dirs on clean clean: diff --git a/lib/Net.Compression/vnlib_compress/compression.c b/lib/Net.Compression/vnlib_compress/compression.c index bf3ffbe..0cba998 100644 --- a/lib/Net.Compression/vnlib_compress/compression.c +++ b/lib/Net.Compression/vnlib_compress/compression.c @@ -74,31 +74,19 @@ VNLIB_COMPRESS_EXPORT CompressorType VNLIB_COMPRESS_CC GetSupportedCompressors(v VNLIB_COMPRESS_EXPORT CompressorType VNLIB_COMPRESS_CC GetCompressorType(_In_ const void* compressor) { - if (!compressor) - { - return ERR_INVALID_PTR; - } - + CHECK_NULL_PTR(compressor) return ((CompressorState*)compressor)->type; } VNLIB_COMPRESS_EXPORT CompressionLevel VNLIB_COMPRESS_CC GetCompressorLevel(_In_ const void* compressor) { - if (!compressor) - { - return ERR_INVALID_PTR; - } - + CHECK_NULL_PTR(compressor) return ((CompressorState*)compressor)->level; } VNLIB_COMPRESS_EXPORT int64_t VNLIB_COMPRESS_CC GetCompressorBlockSize(_In_ const void* compressor) { - if (!compressor) - { - return ERR_INVALID_PTR; - } - + CHECK_NULL_PTR(compressor) return (int64_t)((CompressorState*)compressor)->blockSize; } @@ -194,15 +182,12 @@ VNLIB_COMPRESS_EXPORT void* VNLIB_COMPRESS_CC AllocateCompressor(CompressorType } } -VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC FreeCompressor(_In_ void* compressor) +VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC FreeCompressor(void* compressor) { CompressorState* comp; int errorCode; - if (!compressor) - { - return ERR_INVALID_PTR; - } + CHECK_NULL_PTR(compressor) comp = (CompressorState*)compressor; errorCode = TRUE; @@ -252,10 +237,7 @@ VNLIB_COMPRESS_EXPORT int64_t VNLIB_COMPRESS_CC GetCompressedSize(_In_ const voi CompressorState* comp; int64_t result; - if (!compressor) - { - return ERR_INVALID_PTR; - } + CHECK_NULL_PTR(compressor) if (inputLength > INT64_MAX) { @@ -313,15 +295,8 @@ VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC CompressBlock(_In_ const void* compr * Validate input arguments */ - if (!comp) - { - return ERR_INVALID_PTR; - } - - if (!operation) - { - return ERR_INVALID_PTR; - } + CHECK_NULL_PTR(comp) + CHECK_NULL_PTR(operation) /* * Validate buffers, if the buffer length is greate than 0 @@ -371,4 +346,4 @@ VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC CompressBlock(_In_ const void* compr } return result; -}
\ No newline at end of file +} diff --git a/lib/Net.Compression/vnlib_compress/compression.h b/lib/Net.Compression/vnlib_compress/compression.h index 0524a01..a6a6104 100644 --- a/lib/Net.Compression/vnlib_compress/compression.h +++ b/lib/Net.Compression/vnlib_compress/compression.h @@ -70,6 +70,10 @@ #endif // !VNLIB_EXPORTING #endif // !VNLIB_EXPORT +#ifndef _In_ + #define _In_ +#endif + /* * ERRORS AND CONSTANTS */ @@ -234,7 +238,7 @@ VNLIB_COMPRESS_EXPORT void* VNLIB_COMPRESS_CC AllocateCompressor(CompressorType * @param compressor A pointer to the desired compressor instance to free. * @return The underlying compressor's native return code. */ -VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC FreeCompressor(_In_ void* compressor); +VNLIB_COMPRESS_EXPORT int VNLIB_COMPRESS_CC FreeCompressor(void* compressor); /* * Computes the maximum compressed size of the specified input data. This is not supported diff --git a/lib/Net.Compression/vnlib_compress/util.h b/lib/Net.Compression/vnlib_compress/util.h index 34659d8..c29de4b 100644 --- a/lib/Net.Compression/vnlib_compress/util.h +++ b/lib/Net.Compression/vnlib_compress/util.h @@ -64,10 +64,6 @@ #define FALSE 0 #endif // !FALSE -#ifndef _In_ - #define _In_ -#endif - /* * Add debug runtime assertions */ @@ -77,6 +73,7 @@ #define assert(x) {} #endif +#define CHECK_NULL_PTR(ptr) if(!ptr) return ERR_INVALID_PTR; #ifdef NATIVE_HEAP_API /* Defined in the NativeHeapApi */ /* |