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

Function lodepng_add_text

src/lodepng.cpp:2729–2751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2727}
2728
2729unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str)
2730{
2731 char** new_keys = (char**)(lodepng_realloc(info->text_keys, sizeof(char*) * (info->text_num + 1)));
2732 char** new_strings = (char**)(lodepng_realloc(info->text_strings, sizeof(char*) * (info->text_num + 1)));
2733 if(!new_keys || !new_strings)
2734 {
2735 lodepng_free(new_keys);
2736 lodepng_free(new_strings);
2737 return 83; /*alloc fail*/
2738 }
2739
2740 info->text_num++;
2741 info->text_keys = new_keys;
2742 info->text_strings = new_strings;
2743
2744 string_init(&info->text_keys[info->text_num - 1]);
2745 string_set(&info->text_keys[info->text_num - 1], key);
2746
2747 string_init(&info->text_strings[info->text_num - 1]);
2748 string_set(&info->text_strings[info->text_num - 1], str);
2749
2750 return 0;
2751}
2752
2753/******************************************************************************/
2754

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