same as set but does not delete */
| 3000 | |
| 3001 | /* same as set but does not delete */ |
| 3002 | static 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 | |
| 3016 | unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size) { |
| 3017 | if(info->iccp_name) lodepng_clear_icc(info); |
no test coverage detected