@@ -27,19 +27,6 @@ freely, subject to the following restrictions:
2727The manual and changelog are in the header file "lodepng.h"
2828Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
2929*/
30- /*
31- This file has been altered from the original. The decodeGeneric function has
32- been split into the public lodepng_decode_chunks and static inflateIdat.
33- decodeGeneric has been reimplemented by calling these 2 functions. A new
34- public lodepng_finish_decode has been added. With the new public functions
35- a user can separate decode of all the chunks, so as to learn all the details
36- of the file, from decompression, and possible conversion, of the image data.
37- Search for msc to see the changes.
38-
39- Additional warning disables have been added. 4267 for MS VC++ and the
40- equivalent -Wshorten-64-to-32 for clang. "32-bit shift implicitly converted
41- to 64 bits" warnings have been fixed by changing 1u constants to 1ull.
42- */
4330
4431#include " lodepng.h"
4532
@@ -5298,8 +5285,8 @@ unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
52985285 return error;
52995286}
53005287
5301- /* extracted from the original decodeGeneric by msc*/
53025288/* read the PNG's chunks, updating the state and accumulating the iDAT chunks*/
5289+ /* extracted from previous version of decodeGeneric*/
53035290unsigned lodepng_decode_chunks (void ** idat_out, size_t * idatsize_out, unsigned * w, unsigned * h,
53045291 LodePNGState* state,
53055292 const unsigned char * in, size_t insize) {
@@ -5478,7 +5465,7 @@ unsigned lodepng_decode_chunks(void** idat_out, size_t* idatsize_out, unsigned*
54785465 return state->error ;
54795466}
54805467
5481- /* extracted from the original decodeGeneric by msc */
5468+ /* extracted from the previous version of decodeGeneric */
54825469static unsigned inflateIdat (unsigned char ** out,
54835470 unsigned char * directOut, size_t directOutSize,
54845471 unsigned w, unsigned h,
@@ -5544,7 +5531,6 @@ static unsigned inflateIdat(unsigned char** out,
55445531 return state->error ;
55455532}
55465533
5547- /* added by msc*/
55485534/* finishes decode by inflating the images captured from the idat chunks by lodepng_decode_chunks
55495535and converting them if info_raw differs from info_png.color. A buffer to receive the final
55505536image data is provided as a parameter.
@@ -5584,8 +5570,8 @@ unsigned lodepng_finish_decode(unsigned char* cbuffer, size_t cbufsize,
55845570 return state->error ;
55855571}
55865572
5587- /* reimplemented by msc.*/
55885573/* read a PNG, the result will be in the same color type as the PNG (hence "generic")*/
5574+ /* reimplemented by calling the functions extracted from previous version*/
55895575static void decodeGeneric (unsigned char ** out, unsigned * w, unsigned * h,
55905576 LodePNGState* state,
55915577 const unsigned char * in, size_t insize) {
@@ -7111,7 +7097,6 @@ const char* lodepng_error_text(unsigned code) {
71117097 case 120 : return " invalid cLLI chunk size" ;
71127098 case 121 : return " invalid chunk type name: may only contain [a-zA-Z]" ;
71137099 case 122 : return " invalid chunk type name: third character must be uppercase" ;
7114- // Added for 'msc' changes
71157100 case 123 : return " destination buffer too small" ;
71167101 }
71177102 return " unknown error code" ;
0 commit comments