diff --git a/lodepng.cpp b/lodepng.cpp index ee8cf33d..f6fc0944 100644 --- a/lodepng.cpp +++ b/lodepng.cpp @@ -31,13 +31,13 @@ Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for #include "lodepng.h" #ifdef LODEPNG_COMPILE_DISK -#include /* LONG_MAX */ +#include /*LONG_MAX*/ #include /* file handling */ -#endif /* LODEPNG_COMPILE_DISK */ +#endif /*LODEPNG_COMPILE_DISK*/ #ifdef LODEPNG_COMPILE_ALLOCATORS #include /* allocations */ -#endif /* LODEPNG_COMPILE_ALLOCATORS */ +#endif /*LODEPNG_COMPILE_ALLOCATORS*/ #if defined(_MSC_VER) && (_MSC_VER >= 1310) /*Visual Studio: A few warning types are not desired here.*/ #pragma warning( disable : 4244 ) /*implicit conversions: not warned by gcc -Wall -Wextra and requires too much casts*/ @@ -339,41 +339,72 @@ static void lodepng_set32bitInt(unsigned char* buffer, unsigned value) { /* ////////////////////////////////////////////////////////////////////////// */ #ifdef LODEPNG_COMPILE_DISK - -/* returns negative value on error. This should be pure C compatible, so no fstat. */ -static long lodepng_filesize(const char* filename) { - FILE* file; +static long lodepng_filesize_impl(FILE* file) { long size; - file = fopen(filename, "rb"); if(!file) return -1; - - if(fseek(file, 0, SEEK_END) != 0) { - fclose(file); + + if(fseek(file, 0, SEEK_END) != 0) return -1; - } - + size = ftell(file); /* It may give LONG_MAX as directory size, this is invalid for us. */ if(size == LONG_MAX) size = -1; + return size; +} +/* returns negative value on error. This should be pure C compatible, so no fstat. */ +static long lodepng_filesize(const char* filename) { + FILE* file; + long size; + file = fopen(filename, "rb"); + size = lodepng_filesize_impl(file); + fclose(file); + return size; +} + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* returns negative value on error. This should be pure C compatible, so no fstat. */ +static long lodepng_filesize_w(const wchar_t* filename) { + FILE *file; + long size; + file = _wfopen(filename, L"rb"); + size = lodepng_filesize_impl(file); fclose(file); return size; } +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ /* load file into buffer that already has the correct allocated size. Returns error code.*/ -static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) { - FILE* file; +static unsigned lodepng_buffer_file_impl(unsigned char* out, size_t size, FILE *file) { size_t readsize; - file = fopen(filename, "rb"); if(!file) return 78; - readsize = fread(out, 1, size, file); - fclose(file); - if(readsize != size) return 78; return 0; } +/* load file into buffer that already has the correct allocated size. Returns error code.*/ +static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) { + FILE* file; + unsigned error; + file = fopen(filename, "rb"); + error = lodepng_buffer_file_impl(out, size, file); + fclose(file); + return error; +} + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* load file into buffer that already has the correct allocated size. Returns error code.*/ +static unsigned lodepng_buffer_file_w(unsigned char* out, size_t size, const wchar_t* filename) { + FILE *file; + unsigned error; + file = _wfopen(filename, L"rb"); + error = lodepng_buffer_file_impl(out, size, file); + fclose(file); + return error; +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ + unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) { long size = lodepng_filesize(filename); if(size < 0) return 78; @@ -384,6 +415,18 @@ unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* fil return lodepng_buffer_file(*out, (size_t)size, filename); } +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned lodepng_load_file_w(unsigned char** out, size_t* outsize, const wchar_t* filename) { + long size = lodepng_filesize_w(filename); + if(size < 0) return 78; + *outsize = (size_t)size; + + *out = (unsigned char*)lodepng_malloc((size_t)size); + if(!(*out) && size > 0) return 83; /*the above malloc failed*/ + + return lodepng_buffer_file_w(*out, (size_t)size, filename); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) { @@ -394,6 +437,16 @@ unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const fclose(file); return 0; } +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned lodepng_save_file_w(const unsigned char* buffer, size_t buffersize, const wchar_t* filename) { + FILE *file; + file = _wfopen(filename, L"wb"); + if (!file) return 79; + fwrite(buffer, 1, buffersize, file); + fclose(file); + return 0; +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ @@ -4990,6 +5043,28 @@ unsigned lodepng_decode32_file(unsigned char** out, unsigned* w, unsigned* h, co unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename) { return lodepng_decode_file(out, w, h, filename, LCT_RGB, 8); } + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned lodepng_decode_file_w(unsigned char** out, unsigned* w, unsigned* h, const wchar_t* filename, + LodePNGColorType colortype, unsigned bitdepth) { + unsigned char* buffer = 0; + size_t buffersize; + unsigned error; + /* safe output values in case error happens */ + *out = 0; + *w = *h = 0; + error = lodepng_load_file_w(&buffer, &buffersize, filename); + if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth); + lodepng_free(buffer); + return error; +} +unsigned lodepng_decode32_file_w(unsigned char** out, unsigned* w, unsigned* h, const wchar_t* filename) { + return lodepng_decode_file_w(out, w, h, filename, LCT_RGBA, 8); +} +unsigned lodepng_decode24_file_w(unsigned char** out, unsigned* w, unsigned* h, const wchar_t* filename) { + return lodepng_decode_file_w(out, w, h, filename, LCT_RGB, 8); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings) { @@ -5819,7 +5894,7 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize, /*the PNG specification does not allow to use grayscale color with RGB ICC profile, so disallow gray.*/ stats.allow_greyscale = 0; } -#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */ +#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ state->error = lodepng_compute_color_stats(&stats, image, w, h, &state->info_raw); if(state->error) goto cleanup; #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS @@ -5831,7 +5906,7 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize, state->error = lodepng_color_stats_add(&stats, r, g, b, 65535); if(state->error) goto cleanup; } -#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */ +#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ state->error = auto_choose_color(&info.color, &state->info_raw, &stats); if(state->error) goto cleanup; #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS @@ -5843,7 +5918,7 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize, goto cleanup; } } -#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */ +#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ } #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS if(info_png->iccp_defined) { @@ -6069,6 +6144,26 @@ unsigned lodepng_encode32_file(const char* filename, const unsigned char* image, unsigned lodepng_encode24_file(const char* filename, const unsigned char* image, unsigned w, unsigned h) { return lodepng_encode_file(filename, image, w, h, LCT_RGB, 8); } + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned lodepng_encode_file_w(const wchar_t* filename, const unsigned char* image, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { + unsigned char* buffer; + size_t buffersize; + unsigned error = lodepng_encode_memory(&buffer, &buffersize, image, w, h, colortype, bitdepth); + if(!error) error = lodepng_save_file_w(buffer, buffersize, filename); + lodepng_free(buffer); + return error; +} + +unsigned lodepng_encode32_file_w(const wchar_t* filename, const unsigned char* image, unsigned w, unsigned h) { + return lodepng_encode_file_w(filename, image, w, h, LCT_RGBA, 8); +} + +unsigned lodepng_encode24_file_w(const wchar_t* filename, const unsigned char* image, unsigned w, unsigned h) { + return lodepng_encode_file_w(filename, image, w, h, LCT_RGB, 8); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings) { @@ -6230,7 +6325,21 @@ unsigned load_file(std::vector& buffer, const std::string& filena unsigned save_file(const std::vector& buffer, const std::string& filename) { return lodepng_save_file(buffer.empty() ? 0 : &buffer[0], buffer.size(), filename.c_str()); } -#endif /* LODEPNG_COMPILE_DISK */ + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned load_file(std::vector& buffer, const std::wstring& filename) { + long size = lodepng_filesize_w(filename.c_str()); + if(size < 0) return 78; + buffer.resize((size_t) size); + return size == 0 ? 0 : lodepng_buffer_file_w(&buffer[0], (size_t) size, filename.c_str()); +} + +/*write given buffer to the file, overwriting the file, it doesn't append to it.*/ +unsigned save_file(const std::vector& buffer, const std::wstring& filename) { + return lodepng_save_file_w(buffer.empty() ? 0 : &buffer[0], buffer.size(), filename.c_str()); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ #ifdef LODEPNG_COMPILE_ZLIB #ifdef LODEPNG_COMPILE_DECODER @@ -6250,7 +6359,7 @@ unsigned decompress(std::vector& out, const std::vector& out, const unsigned char* in, size_t insize, @@ -6269,8 +6378,8 @@ unsigned compress(std::vector& out, const std::vector& out, unsigned& w, unsigned& h, } #ifdef LODEPNG_COMPILE_DISK -unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::string& filename, - LodePNGColorType colortype, unsigned bitdepth) { +template +unsigned decode_impl(std::vector& out, unsigned& w, unsigned& h, const filename_t& filename, + LodePNGColorType colortype, unsigned bitdepth) { std::vector buffer; /* safe output values in case error happens */ w = h = 0; @@ -6344,8 +6454,18 @@ unsigned decode(std::vector& out, unsigned& w, unsigned& h, const if(error) return error; return decode(out, w, h, buffer, colortype, bitdepth); } -#endif /* LODEPNG_COMPILE_DECODER */ -#endif /* LODEPNG_COMPILE_DISK */ +unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::string& filename, + LodePNGColorType colortype, unsigned bitdepth) { + return decode_impl(out, w, h, filename, colortype, bitdepth); +} +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::wstring& filename, + LodePNGColorType colortype, unsigned bitdepth) { + return decode_impl(out, w, h, filename, colortype, bitdepth); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ +#endif /*LODEPNG_COMPILE_DECODER*/ #ifdef LODEPNG_COMPILE_ENCODER unsigned encode(std::vector& out, const unsigned char* in, unsigned w, unsigned h, @@ -6388,23 +6508,49 @@ unsigned encode(std::vector& out, } #ifdef LODEPNG_COMPILE_DISK -unsigned encode(const std::string& filename, - const unsigned char* in, unsigned w, unsigned h, - LodePNGColorType colortype, unsigned bitdepth) { +template +unsigned encode_impl(const filename_t& filename, + const unsigned char* in, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { std::vector buffer; unsigned error = encode(buffer, in, w, h, colortype, bitdepth); if(!error) error = save_file(buffer, filename); return error; } +template +unsigned encode_impl(const filename_t &filename, + const std::vector &in, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { + if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; + return encode_impl(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); +} + +unsigned encode(const std::string& filename, + const unsigned char* in, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { + return encode_impl(filename, in, w, h, colortype, bitdepth); +} unsigned encode(const std::string& filename, const std::vector& in, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { - if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode_impl(filename, in, w, h, colortype, bitdepth); } -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_ENCODER */ -#endif /* LODEPNG_COMPILE_PNG */ +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +unsigned encode(const std::wstring& filename, + const unsigned char* in, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { + return encode_impl(filename, in, w, h, colortype, bitdepth); +} + +unsigned encode(const std::wstring& filename, + const std::vector& in, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth) { + return encode_impl(filename, in, w, h, colortype, bitdepth); +} +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ +#endif /*LODEPNG_COMPILE_ENCODER*/ +#endif /*LODEPNG_COMPILE_PNG*/ } /* namespace lodepng */ #endif /*LODEPNG_COMPILE_CPP*/ diff --git a/lodepng.h b/lodepng.h index a386459f..5c212f87 100644 --- a/lodepng.h +++ b/lodepng.h @@ -94,6 +94,16 @@ source files with custom allocators.*/ #include #endif /*LODEPNG_COMPILE_CPP*/ +#ifdef LODEPNG_COMPILE_DISK +#ifdef _WIN32 +#ifdef _MSC_VER +#ifndef LODEPNG_NO_WIDE_CHAR_OVERLOADS +#define LODEPNG_WIDE_CHAR_OVERLOADS +#endif /*LODEPNG_NO_WIDE_CHAR_OVERLOADS*/ +#endif /*_MSC_VER*/ +#endif /*_WIN32*/ +#endif /*LODEPNG_COMPILE_DISK*/ + #ifdef LODEPNG_COMPILE_PNG /*The PNG color types (also used for raw image).*/ typedef enum LodePNGColorType { @@ -154,6 +164,25 @@ unsigned lodepng_decode32_file(unsigned char** out, unsigned* w, unsigned* h, /*Same as lodepng_decode_file, but always decodes to 24-bit RGB raw image.*/ unsigned lodepng_decode24_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename); + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Load PNG from disk, from file with given name. +Same as the other decode functions, but instead takes a filename as input. +Filename is accepted as a wchar_t pointer. +*/ +unsigned lodepng_decode_file_w(unsigned char** out, unsigned* w, unsigned* h, + const wchar_t* filename, + LodePNGColorType colortype, unsigned bitdepth); + +/*Same as lodepng_decode_file, but always decodes to 32-bit RGBA raw image.*/ +unsigned lodepng_decode32_file_w(unsigned char** out, unsigned* w, unsigned* h, + const wchar_t* filename); + +/*Same as lodepng_decode_file, but always decodes to 24-bit RGB raw image.*/ +unsigned lodepng_decode24_file_w(unsigned char** out, unsigned* w, unsigned* h, + const wchar_t* filename); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ #endif /*LODEPNG_COMPILE_DECODER*/ @@ -204,6 +233,26 @@ unsigned lodepng_encode32_file(const char* filename, /*Same as lodepng_encode_file, but always encodes from 24-bit RGB raw image.*/ unsigned lodepng_encode24_file(const char* filename, const unsigned char* image, unsigned w, unsigned h); + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Converts raw pixel data into a PNG file on disk. +Same as the other encode functions, but instead takes a filename as output. +Filename is accepted as a wchar_t pointer. +NOTE: This overwrites existing files without warning! +*/ +unsigned lodepng_encode_file_w(const wchar_t* filename, + const unsigned char* image, unsigned w, unsigned h, + LodePNGColorType colortype, unsigned bitdepth); + +/*Same as lodepng_encode_file, but always encodes from 32-bit RGBA raw image.*/ +unsigned lodepng_encode32_file_w(const wchar_t* filename, + const unsigned char* image, unsigned w, unsigned h); + +/*Same as lodepng_encode_file, but always encodes from 24-bit RGB raw image.*/ +unsigned lodepng_encode24_file_w(const wchar_t* filename, + const unsigned char* image, unsigned w, unsigned h); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ #endif /*LODEPNG_COMPILE_ENCODER*/ @@ -227,8 +276,18 @@ Same as the other decode functions, but instead takes a filename as input. unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::string& filename, LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_DECODER */ +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Converts PNG file from disk to raw pixel data in memory. +Same as the other decode functions, but instead takes a filename as input. +Filename is accepted as a wchar_t pointer. +*/ +unsigned decode(std::vector& out, unsigned& w, unsigned& h, + const std::wstring& filename, + LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ +#endif /*LODEPNG_COMPILE_DECODER*/ #ifdef LODEPNG_COMPILE_ENCODER /*Same as lodepng_encode_memory, but encodes to an std::vector. colortype @@ -251,8 +310,22 @@ unsigned encode(const std::string& filename, unsigned encode(const std::string& filename, const std::vector& in, unsigned w, unsigned h, LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_ENCODER */ +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Converts 32-bit RGBA raw pixel data into a PNG file on disk. +Same as the other encode functions, but instead takes a filename as output. +Filename is accepted as a wchar_t pointer. +NOTE: This overwrites existing files without warning! +*/ +unsigned encode(const std::wstring& filename, + const unsigned char* in, unsigned w, unsigned h, + LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); +unsigned encode(const std::wstring& filename, + const std::vector& in, unsigned w, unsigned h, + LodePNGColorType colortype = LCT_RGBA, unsigned bitdepth = 8); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ +#endif /*LODEPNG_COMPILE_ENCODER*/ } /* namespace lodepng */ #endif /*LODEPNG_COMPILE_CPP*/ #endif /*LODEPNG_COMPILE_PNG*/ @@ -953,6 +1026,18 @@ return value: error code (0 means ok) */ unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename); +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Load a file from disk into buffer. The function allocates the out buffer, and +after usage you should free it. +out: output parameter, contains pointer to loaded buffer. +outsize: output parameter, size of the allocated out buffer +filename: the path to the file to load. It is accepted as a wchar_t pointer +return value: error code (0 means ok) +*/ +unsigned lodepng_load_file_w(unsigned char** out, size_t* outsize, const wchar_t* filename); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ + /* Save a file from buffer to disk. Warning, if it exists, this function overwrites the file without warning! @@ -962,6 +1047,18 @@ filename: the path to the file to save to return value: error code (0 means ok) */ unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename); + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Save a file from buffer to disk. Warning, if it exists, this function overwrites +the file without warning! +buffer: the buffer to write +buffersize: size of the buffer to write +filename: the path to the file to save to. It is accepted as a wchar_t pointer +return value: error code (0 means ok) +*/ +unsigned lodepng_save_file_w(const unsigned char* buffer, size_t buffersize, const wchar_t* filename); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ #endif /*LODEPNG_COMPILE_DISK*/ #ifdef LODEPNG_COMPILE_CPP @@ -1008,8 +1105,22 @@ Save the binary data in an std::vector to a file on disk. The file is overwritte without warning. */ unsigned save_file(const std::vector& buffer, const std::string& filename); -#endif /* LODEPNG_COMPILE_DISK */ -#endif /* LODEPNG_COMPILE_PNG */ + +#ifdef LODEPNG_WIDE_CHAR_OVERLOADS +/* +Load a file from disk into an std::vector. +return value: error code (0 means ok) +*/ +unsigned load_file(std::vector& buffer, const std::wstring& filename); + +/* +Save the binary data in an std::vector to a file on disk. The file is overwritten +without warning. +*/ +unsigned save_file(const std::vector& buffer, const std::wstring& filename); +#endif /*LODEPNG_WIDE_CHAR_OVERLOADS*/ +#endif /*LODEPNG_COMPILE_DISK*/ +#endif /*LODEPNG_COMPILE_PNG*/ #ifdef LODEPNG_COMPILE_ZLIB #ifdef LODEPNG_COMPILE_DECODER @@ -1020,7 +1131,7 @@ unsigned decompress(std::vector& out, const unsigned char* in, si /* Zlib-decompress an std::vector */ unsigned decompress(std::vector& out, const std::vector& in, const LodePNGDecompressSettings& settings = lodepng_default_decompress_settings); -#endif /* LODEPNG_COMPILE_DECODER */ +#endif /*LODEPNG_COMPILE_DECODER*/ #ifdef LODEPNG_COMPILE_ENCODER /* Zlib-compress an unsigned char buffer */ @@ -1030,8 +1141,8 @@ unsigned compress(std::vector& out, const unsigned char* in, size /* Zlib-compress an std::vector */ unsigned compress(std::vector& out, const std::vector& in, const LodePNGCompressSettings& settings = lodepng_default_compress_settings); -#endif /* LODEPNG_COMPILE_ENCODER */ -#endif /* LODEPNG_COMPILE_ZLIB */ +#endif /*LODEPNG_COMPILE_ENCODER*/ +#endif /*LODEPNG_COMPILE_ZLIB*/ } /* namespace lodepng */ #endif /*LODEPNG_COMPILE_CPP*/