MCPcopy Create free account
hub / github.com/DFHack/dfhack / lodepng_assign_icc

Function lodepng_assign_icc

depends/lodepng/lodepng.cpp:3002–3014  ·  view source on GitHub ↗

same as set but does not delete */

Source from the content-addressed store, hash-verified

3000
3001/* same as set but does not delete */
3002static unsigned lodepng_assign_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size) {
3003 if(profile_size == 0) return 100; /*invalid ICC profile size*/
3004
3005 info->iccp_name = alloc_string(name);
3006 info->iccp_profile = (unsigned char*)lodepng_malloc(profile_size);
3007
3008 if(!info->iccp_name || !info->iccp_profile) return 83; /*alloc fail*/
3009
3010 lodepng_memcpy(info->iccp_profile, profile, profile_size);
3011 info->iccp_profile_size = profile_size;
3012
3013 return 0; /*ok*/
3014}
3015
3016unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size) {
3017 if(info->iccp_name) lodepng_clear_icc(info);

Callers 2

lodepng_set_iccFunction · 0.85
lodepng_info_copyFunction · 0.85

Calls 3

alloc_stringFunction · 0.85
lodepng_mallocFunction · 0.85
lodepng_memcpyFunction · 0.85

Tested by

no test coverage detected