commit c91e8f6d
Updated SDL_FontCache lib
Changed files
| M | source/code/Libs/SDL_FontCache.c before |
| M | source/code/Libs/SDL_FontCache.h before |
diff --git a/source/code/Libs/SDL_FontCache.c b/source/code/Libs/SDL_FontCache.c
index 16b0925..d0a5132 100644
--- a/source/code/Libs/SDL_FontCache.c
+++ b/source/code/Libs/SDL_FontCache.c
@@ -162,7 +162,7 @@ static unsigned int fc_buffer_size = 1024;
static Uint8 fc_has_render_target_support = 0;
-const char* FC_GetStringASCII(void)
+char* FC_GetStringASCII(void)
{
static char* buffer = NULL;
if(buffer == NULL)
@@ -182,10 +182,10 @@ const char* FC_GetStringASCII(void)
++c;
}
}
- return buffer;
+ return U8_strdup(buffer);
}
-const char* FC_GetStringLatin1(void)
+char* FC_GetStringLatin1(void)
{
static char* buffer = NULL;
if(buffer == NULL)
@@ -217,16 +217,16 @@ const char* FC_GetStringLatin1(void)
++c;
}
}
- return buffer;
+ return U8_strdup(buffer);
}
-const char* FC_GetStringASCII_Latin1(void)
+char* FC_GetStringASCII_Latin1(void)
{
static char* buffer = NULL;
if(buffer == NULL)
buffer = new_concat(FC_GetStringASCII(), FC_GetStringLatin1());
- return buffer;
+ return U8_strdup(buffer);
}
FC_Rect FC_MakeRect(float x, float y, float w, float h)
@@ -880,8 +880,8 @@ static void FC_Init(FC_Font* font)
font->glyph_cache = (FC_Image**)malloc(font->glyph_cache_size * sizeof(FC_Image*));
- if(font->loading_string == NULL)
- font->loading_string = U8_strdup(FC_GetStringASCII());
+ if (font->loading_string == NULL)
+ font->loading_string = FC_GetStringASCII();
if(fc_buffer == NULL)
fc_buffer = (char*)malloc(fc_buffer_size);
@@ -1645,6 +1645,11 @@ FC_StringList** FC_StringListPushBack(FC_StringList** node, char* value, Uint8 c
node = &(*node)->next;
}
+ if(node == NULL)
+ {
+ return node;
+ }
+
*node = (FC_StringList*)malloc(sizeof(FC_StringList));
(*node)->value = (copy? U8_strdup(value) : value);
@@ -2632,9 +2637,3 @@ void FC_SetDefaultColor(FC_Font* font, SDL_Color color)
font->default_color = color;
}
-
-
-
-
-
-
diff --git a/source/code/Libs/SDL_FontCache.h b/source/code/Libs/SDL_FontCache.h
index 8a200ad..2b7d08e 100644
--- a/source/code/Libs/SDL_FontCache.h
+++ b/source/code/Libs/SDL_FontCache.h
@@ -151,11 +151,11 @@ void FC_FreeFont(FC_Font* font);
// Built-in loading strings
-const char* FC_GetStringASCII(void);
+char* FC_GetStringASCII(void);
-const char* FC_GetStringLatin1(void);
+char* FC_GetStringLatin1(void);
-const char* FC_GetStringASCII_Latin1(void);
+char* FC_GetStringASCII_Latin1(void);
// UTF-8 to SDL_FontCache codepoint conversion