lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.07k stars 422 forks source link

Build error when there is no stdlib. #33

Open jasongaoks opened 8 years ago

jasongaoks commented 8 years ago

Build error when there is no stdlib. Better wap qsort(in line 798) with "lodepng_qsort", and wrap "free"(in line 5348) with "lodepng_free".

lvandeve commented 8 years ago

fixed for the free. Will look into doing similar for sort, or just implement one :)

lvandeve commented 8 years ago

What about memcpy, is that one available for you? Which platform are you using by the way? What is available?

jasongaoks commented 8 years ago

There's no compile error but a link error. It says"unresolved external ...". I implement memcpy in another c source. And it compiles. So it's better to implement memcpy in lodepng. BTW, I got some other errors when I update lodepng to version 20160418. mallloc(line733) and free(line754) can be replaced with lodepng_malloc and lodepng_free. And I got a warning in line 4710, says outsize may be uninitialized. I moved the '}' in line 4707 behind the next "if(!state->error)" to satisfy the compile. But I'm not sure if it's right. Thanks

lvandeve commented 8 years ago

Fixed the uninitialized warning by initializing it to 0.

If memcpy can be linked in like you described, then I guess I won't deal with adding extra #defines for that one in lodepng.c for now, if that's ok :)

jasongaoks commented 8 years ago

Yes, that's OK for me. Thanks, Lode:)

FarawayRay commented 6 years ago

it can load png convert to bmp?

lvandeve commented 6 years ago

Not on its own, but this example can: https://github.com/lvandeve/lodepng/blob/master/examples/example_png2bmp.cpp that's off topic in this issue though