From 695581c6a5f330af79fe756fe82239bd368016db Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 14 Nov 2024 12:10:47 -0700 Subject: [PATCH] include gaurds --- addon/compress.h | 6 +----- addon/compression_worker.h | 4 ++++ addon/decompress.h | 5 +---- addon/napi_utils.h | 7 ++++++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/addon/compress.h b/addon/compress.h index a5548a1..c33cc67 100644 --- a/addon/compress.h +++ b/addon/compress.h @@ -1,12 +1,8 @@ - -#include - #include +#include "compression_worker.h" // CompressionResult #include "zstd.h" -using namespace Napi; - CompressionResult compress(const std::vector data, size_t compression_level) { size_t output_buffer_size = ZSTD_compressBound(data.size()); std::vector output(output_buffer_size); diff --git a/addon/compression_worker.h b/addon/compression_worker.h index 60d7949..f79367c 100644 --- a/addon/compression_worker.h +++ b/addon/compression_worker.h @@ -1,3 +1,5 @@ +#ifndef COMPRESSION_WORKER_H +#define COMPRESSION_WORKER_H #include #include @@ -93,3 +95,5 @@ class CompressionWorker : public Napi::AsyncWorker { std::function worker; CompressionResult result; }; + +#endif diff --git a/addon/decompress.h b/addon/decompress.h index c61718c..3972c2a 100644 --- a/addon/decompress.h +++ b/addon/decompress.h @@ -1,11 +1,8 @@ -#include - #include +#include "compression_worker.h" // CompressionResult #include "zstd.h" -using namespace Napi; - CompressionResult decompress(const std::vector& compressed) { std::vector decompressed; diff --git a/addon/napi_utils.h b/addon/napi_utils.h index dce502d..6344f89 100644 --- a/addon/napi_utils.h +++ b/addon/napi_utils.h @@ -1,3 +1,6 @@ +#ifndef NAPI_UTILS_H +#define NAPI_UTILS_H + #include using namespace Napi; @@ -18,7 +21,7 @@ std::vector getBytesFromUint8Array(const Uint8Array& source) { } /** - * @brief Given an Napi;:Value, this function returns the value as a Uint8Array, if the + * @brief Given an Napi::Value, this function returns the value as a Uint8Array, if the * Value is a Uint8Array. Otherwise, this function throws. * * @param v - An Napi::Value @@ -33,3 +36,5 @@ Uint8Array Uint8ArrayFromValue(Value v, std::string argument_name) { return v.As(); } + +#endif