Skip to content

Commit

Permalink
Merge pull request #258 from alyssais/freebsd
Browse files Browse the repository at this point in the history
Fix building for FreeBSD
  • Loading branch information
tmaurer3 authored Oct 11, 2024
2 parents 4177b33 + 215c195 commit b98e72c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/LercLib/fpl_EsriHuffman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Original coding 2021 Yuriy Yakimenko

USING_NAMESPACE_LERC

void _assert(bool v);
void lerc_assert(bool v);

bool decodePackBits (const unsigned char *ptr, const size_t size, size_t expected, unsigned char **output)
{
Expand Down Expand Up @@ -332,7 +332,7 @@ int fpl_EsriHuffman::EncodeHuffman (const char *input, size_t input_len, unsigne
ptr[0] = HUFFMAN_RLE; // RLE flag
ptr[1] = input[0];

_assert(input_len <= 0xffffffff);
lerc_assert(input_len <= 0xffffffff);

uint32_t len = (uint32_t)input_len;

Expand Down Expand Up @@ -498,7 +498,7 @@ bool fpl_EsriHuffman::DecodeHuffman(const unsigned char* inBytes, const size_t i
{
unsigned char *unpacked = NULL;

_assert (true == decodePackBits (ppByte + 1, inCount - 1, nBytesRemainingInOut, &unpacked));
lerc_assert (true == decodePackBits (ppByte + 1, inCount - 1, nBytesRemainingInOut, &unpacked));

*output = unpacked;

Expand Down
14 changes: 7 additions & 7 deletions src/LercLib/fpl_Lerc2Ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Original coding 2021 Yuriy Yakimenko

USING_NAMESPACE_LERC

void _assert(bool v)
void lerc_assert(bool v)
{
if (v == false)
throw "Assertion failed";
Expand Down Expand Up @@ -65,7 +65,7 @@ static void generateListOfTestBlocks(const int width, const int height, std::vec
{
size_t size = (size_t)width * height;

_assert(size > 0);
lerc_assert(size > 0);

const int block_target_size = 8 * 1024;

Expand Down Expand Up @@ -614,11 +614,11 @@ bool restoreCrossBytes(std::vector<std::pair<int, char*> >& output_buffers, cons
//FILE* output,
const UnitType unit_type, uint8_t** output_block)
{
_assert(predictor == PREDICTOR_NONE || predictor == PREDICTOR_ROWS_COLS);
lerc_assert(predictor == PREDICTOR_NONE || predictor == PREDICTOR_ROWS_COLS);

size_t unit_size = output_buffers.size();

_assert(unit_size == UnitTypes::size(unit_type));
lerc_assert(unit_size == UnitTypes::size(unit_type));

const int delta = Predictor::getIntDelta(predictor);

Expand Down Expand Up @@ -670,11 +670,11 @@ bool restoreByteOrder(std::vector<std::pair<int, char*> >& output_buffers,
const size_t cols, const size_t rows, const PredictorType predictor, //FILE* output,
const UnitType unit_type, uint8_t** output_block)
{
_assert(predictor == PREDICTOR_NONE || predictor == PREDICTOR_DELTA1);
lerc_assert(predictor == PREDICTOR_NONE || predictor == PREDICTOR_DELTA1);

size_t unit_size = output_buffers.size();

_assert(unit_size == UnitTypes::size(unit_type));
lerc_assert(unit_size == UnitTypes::size(unit_type));

const int delta = Predictor::getIntDelta(predictor);

Expand Down Expand Up @@ -807,7 +807,7 @@ bool LosslessFPCompression::DecodeHuffmanFltSlice (const unsigned char** ppByte,

size_t extracted_size = fpl_Compression::extract_buffer((const char *)compressed, compressed_size, expected_size, &uncompressed);

_assert(expected_size == extracted_size);
lerc_assert(expected_size == extracted_size);

free(compressed);
compressed = NULL;
Expand Down

0 comments on commit b98e72c

Please sign in to comment.