Skip to content

Commit

Permalink
include gaurds
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Nov 14, 2024
1 parent 46509f4 commit 695581c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 1 addition & 5 deletions addon/compress.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@

#include <napi.h>

#include <vector>

#include "compression_worker.h" // CompressionResult
#include "zstd.h"

using namespace Napi;

CompressionResult compress(const std::vector<uint8_t> data, size_t compression_level) {
size_t output_buffer_size = ZSTD_compressBound(data.size());
std::vector<uint8_t> output(output_buffer_size);
Expand Down
4 changes: 4 additions & 0 deletions addon/compression_worker.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef COMPRESSION_WORKER_H
#define COMPRESSION_WORKER_H
#include <napi.h>

#include <optional>
Expand Down Expand Up @@ -93,3 +95,5 @@ class CompressionWorker : public Napi::AsyncWorker {
std::function<CompressionResult()> worker;
CompressionResult result;
};

#endif
5 changes: 1 addition & 4 deletions addon/decompress.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include <napi.h>

#include <vector>

#include "compression_worker.h" // CompressionResult
#include "zstd.h"

using namespace Napi;

CompressionResult decompress(const std::vector<uint8_t>& compressed) {
std::vector<uint8_t> decompressed;

Expand Down
7 changes: 6 additions & 1 deletion addon/napi_utils.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef NAPI_UTILS_H
#define NAPI_UTILS_H

#include <napi.h>

using namespace Napi;
Expand All @@ -18,7 +21,7 @@ std::vector<uint8_t> 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
Expand All @@ -33,3 +36,5 @@ Uint8Array Uint8ArrayFromValue(Value v, std::string argument_name) {

return v.As<Uint8Array>();
}

#endif

0 comments on commit 695581c

Please sign in to comment.