MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / lodepng_add_text

Function lodepng_add_text

samples/cgpu/cgpu-basic/mandelbrot/lodepng.c:2814–2836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2812}
2813
2814unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str)
2815{
2816 char** new_keys = (char**)(lodepng_realloc(info->text_keys, sizeof(char*) * (info->text_num + 1)));
2817 char** new_strings = (char**)(lodepng_realloc(info->text_strings, sizeof(char*) * (info->text_num + 1)));
2818 if(!new_keys || !new_strings)
2819 {
2820 lodepng_free(new_keys);
2821 lodepng_free(new_strings);
2822 return 83; /*alloc fail*/
2823 }
2824
2825 ++info->text_num;
2826 info->text_keys = new_keys;
2827 info->text_strings = new_strings;
2828
2829 string_init(&info->text_keys[info->text_num - 1]);
2830 string_set(&info->text_keys[info->text_num - 1], key);
2831
2832 string_init(&info->text_strings[info->text_num - 1]);
2833 string_set(&info->text_strings[info->text_num - 1], str);
2834
2835 return 0;
2836}
2837
2838/******************************************************************************/
2839

Callers 3

LodePNGText_copyFunction · 0.85
readChunk_tEXtFunction · 0.85
readChunk_zTXtFunction · 0.85

Calls 4

lodepng_reallocFunction · 0.85
lodepng_freeFunction · 0.85
string_initFunction · 0.85
string_setFunction · 0.85

Tested by

no test coverage detected