Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
(#18) Specified safer types as source
Browse files Browse the repository at this point in the history
Source buffers should be const and point to const content.
  • Loading branch information
leandor committed Jul 1, 2017
1 parent 8be081b commit deef7db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/papi/lz4/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ namespace lz4 { namespace api {
*/
int compress_default(const span<const char> source, const span<char> dest);

int decompress_safe (const span<const char> source, span<char> dest);
int decompress_safe (const span<const char> source, const span<char> dest);
int sizeofState();
int compress_fast_extState(span<byte> state, const span<const char> source, span<char> dest, int acceleration);
int compress_destSize (span<char>& source, span<char> dest);
int decompress_fast (const span<const char> source, span<char> dest, int uncompressedSize);
int decompress_safe_partial (const span<const char> source, span<char> dest, int targetOutputSize);
int compress_fast_extState(span<byte> state, const span<const char> source, const span<char> dest, int acceleration);
int compress_destSize (span<const char>& source, const span<char> dest);
int decompress_fast (const span<const char> source, const span<char> dest, int uncompressedSize);
int decompress_safe_partial (const span<const char> source, const span<char> dest, int targetOutputSize);
};
};

Expand Down
10 changes: 5 additions & 5 deletions src/papi/lz4/api_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace lz4 { namespace api {
return _detail::LZ4_compress_default(source.data(), dest.data(), source.length(), dest.length());
};

inline int decompress_safe (const span<const char> source, span<char> dest)
inline int decompress_safe (const span<const char> source, const span<char> dest)
{
return _detail::LZ4_decompress_safe(source.data(), dest.data(), source.length(), dest.length());
};
Expand All @@ -28,12 +28,12 @@ namespace lz4 { namespace api {
return _detail::LZ4_sizeofState();
};

inline int compress_fast_extState(span<byte> state, const span<const char> source, span<char> dest, int acceleration)
inline int compress_fast_extState(span<byte> state, const span<const char> source, const span<char> dest, int acceleration)
{
return _detail::LZ4_compress_fast_extState(state.data(), source.data(), dest.data(), source.length(), dest.length(), acceleration);
};

inline int compress_destSize (span<char>& source, span<char> dest)
inline int compress_destSize (span<const char>& source, const span<char> dest)
{
auto sourceSize = source.length();
volatile int sourceUsed = sourceSize;
Expand All @@ -44,12 +44,12 @@ namespace lz4 { namespace api {
return _detail::LZ4_compress_destSize(source.data(), dest.data(), const_cast<int*>(&sourceUsed), dest.length());
};

inline int decompress_fast (const span<const char> source, span<char> dest, int uncompressedSize)
inline int decompress_fast (const span<const char> source, const span<char> dest, int uncompressedSize)
{
return _detail::LZ4_decompress_fast(source.data(), dest.data(), uncompressedSize);
};

inline int decompress_safe_partial (const span<const char> source, span<char> dest, int targetOutputSize)
inline int decompress_safe_partial (const span<const char> source, const span<char> dest, int targetOutputSize)
{
return _detail::LZ4_decompress_safe_partial (source.data(), dest.data(), source.length(), targetOutputSize, dest.length());
};
Expand Down

0 comments on commit deef7db

Please sign in to comment.