mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Replace all localization SDL_free with VVV_free
This mirrors a926ce9851
upstream, which
replaces all other SDL_free calls.
This commit is contained in:
parent
7a52dc9586
commit
2b84384606
4 changed files with 18 additions and 14 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <utf8/unchecked.h>
|
||||
|
||||
#include "Alloc.h"
|
||||
#include "Game.h"
|
||||
#include "UtilityClass.h"
|
||||
#include "VFormat.h"
|
||||
|
@ -69,7 +70,7 @@ const char* gettext_case(const char* eng, char textcase)
|
|||
}
|
||||
|
||||
const char* tra = map_lookup_text(map_translation, eng_prefixed, eng);
|
||||
SDL_free(eng_prefixed);
|
||||
VVV_free(eng_prefixed);
|
||||
return tra;
|
||||
}
|
||||
|
||||
|
@ -93,7 +94,7 @@ const char* gettext_plural(const char* eng_plural, const char* eng_singular, int
|
|||
{
|
||||
const char* tra = map_lookup_text(map_translation_plural, key, NULL);
|
||||
|
||||
SDL_free(key);
|
||||
VVV_free(key);
|
||||
|
||||
if (tra != NULL)
|
||||
{
|
||||
|
@ -180,7 +181,7 @@ const TextboxFormat* gettext_cutscene(const std::string& script_id, const std::s
|
|||
found = hashmap_get(cutscene_map, (void*) key, alloc_len-1, &ptr_format);
|
||||
const TextboxFormat* format = (TextboxFormat*) ptr_format;
|
||||
|
||||
SDL_free(key);
|
||||
VVV_free(key);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#include "Alloc.h"
|
||||
#include "FileSystemUtils.h"
|
||||
#include "Graphics.h"
|
||||
#include "Script.h"
|
||||
|
@ -110,7 +111,7 @@ static void sync_lang_file(const std::string& langcode)
|
|||
eng_prefixed,
|
||||
map_lookup_text(map_translation, eng, "")
|
||||
);
|
||||
SDL_free(eng_prefixed);
|
||||
VVV_free(eng_prefixed);
|
||||
}
|
||||
|
||||
pElem->SetAttribute("translation", tra);
|
||||
|
@ -156,7 +157,7 @@ static void sync_lang_file(const std::string& langcode)
|
|||
|
||||
subElem->SetAttribute("translation", map_lookup_text(map_translation_plural, key, ""));
|
||||
|
||||
SDL_free(key);
|
||||
VVV_free(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +210,7 @@ static void sync_lang_file(const std::string& langcode)
|
|||
found = hashmap_get(cutscene_map, (void*) eng_prefixed, alloc_len-1, &ptr_format);
|
||||
const TextboxFormat* format = (TextboxFormat*) ptr_format;
|
||||
|
||||
SDL_free(eng_prefixed);
|
||||
VVV_free(eng_prefixed);
|
||||
|
||||
if (!found || format == NULL)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Localization.h"
|
||||
#include "LocalizationStorage.h"
|
||||
|
||||
#include "Alloc.h"
|
||||
#include "Constants.h"
|
||||
#include "CustomLevels.h"
|
||||
#include "FileSystemUtils.h"
|
||||
|
@ -195,7 +196,7 @@ void unloadtext_custom(void)
|
|||
|
||||
loc::lang_custom = "";
|
||||
|
||||
SDL_free(custom_level_path);
|
||||
VVV_free(custom_level_path);
|
||||
custom_level_path = NULL;
|
||||
}
|
||||
|
||||
|
@ -276,7 +277,7 @@ static bool parse_max(const char* max, unsigned short* max_w, unsigned short* ma
|
|||
}
|
||||
*max_w = (unsigned short) help.Int(max_mut, 0);
|
||||
|
||||
SDL_free(max_mut);
|
||||
VVV_free(max_mut);
|
||||
|
||||
return *max_w != 0 && *max_h != 0;
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ static void loadtext_strings(bool check_max)
|
|||
eng_prefixed,
|
||||
tra
|
||||
);
|
||||
SDL_free(eng_prefixed);
|
||||
VVV_free(eng_prefixed);
|
||||
}
|
||||
|
||||
/* Only tally an untranslated string if English isn't blank */
|
||||
|
@ -453,7 +454,7 @@ static void loadtext_strings(bool check_max)
|
|||
* (max_check_string ignores NULL strings.) */
|
||||
char* filled = vformat_alloc(tra, "_:int", 0);
|
||||
max_check_string(filled, pElem->Attribute("max"));
|
||||
SDL_free(filled);
|
||||
VVV_free(filled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +499,7 @@ static void loadtext_strings_plural(bool check_max)
|
|||
subElem->Attribute("translation")
|
||||
);
|
||||
|
||||
SDL_free(key);
|
||||
VVV_free(key);
|
||||
|
||||
tally_untranslated(subElem->Attribute("translation"), &n_untranslated[UNTRANSLATED_STRINGS_PLURAL]);
|
||||
if (check_max)
|
||||
|
@ -658,7 +659,7 @@ static void loadtext_cutscenes(bool custom_level)
|
|||
}
|
||||
const char* tb_eng = textbook_store(textbook, eng_prefixed);
|
||||
const char* tb_tra = textbook_store(textbook, tra);
|
||||
SDL_free(eng_prefixed);
|
||||
VVV_free(eng_prefixed);
|
||||
if (tb_eng == NULL || tb_tra == NULL)
|
||||
{
|
||||
continue;
|
||||
|
@ -1071,7 +1072,7 @@ char* add_disambiguator(char disambiguator, const char* original_string, size_t*
|
|||
/* Create a version of the string prefixed with the given byte.
|
||||
* This byte is used when the English string is just not enough to identify the correct translation.
|
||||
* It's needed to store plural forms, and when the same text appears multiple times in a cutscene.
|
||||
* Caller must SDL_free. */
|
||||
* Caller must VVV_free. */
|
||||
|
||||
size_t alloc_len = 1+SDL_strlen(original_string)+1;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "Alloc.h"
|
||||
#include "Vlogging.h"
|
||||
|
||||
void textbook_init(Textbook* textbook)
|
||||
|
@ -19,7 +20,7 @@ void textbook_clear(Textbook* textbook)
|
|||
|
||||
for (short p = 0; p < textbook->pages_used; p++)
|
||||
{
|
||||
SDL_free(textbook->page[p]);
|
||||
VVV_free(textbook->page[p]);
|
||||
}
|
||||
textbook->pages_used = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue