summaryrefslogtreecommitdiff
path: root/src/fontcache.cpp
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-01-11 17:29:39 +0000
committerKUDr <KUDr@openttd.org>2007-01-11 17:29:39 +0000
commit28e969924b9033f5132fe2ba223e2bcadd39a7ec (patch)
treed644a3831ca0947198b191fa3e4e8973d3a9786e /src/fontcache.cpp
parent5675956443d4e58713a0abd8cedb4eaaaccf22d4 (diff)
downloadopenttd-28e969924b9033f5132fe2ba223e2bcadd39a7ec.tar.xz
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r--src/fontcache.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index e60fe8bc7..ce0a885d5 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -78,7 +78,7 @@ static FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
* normal char to match the data returned by RegEnumValue,
* otherwise just use parameter */
#if defined(UNICODE)
- MallocT(&font_namep, MAX_PATH);
+ font_namep = MallocT<char>(MAX_PATH);
MB_TO_WIDE_BUFFER(font_name, font_namep, MAX_PATH * sizeof(TCHAR));
#else
font_namep = (char*)font_name; // only cast because in unicode pointer is not const
@@ -346,12 +346,12 @@ static void SetGlyphPtr(FontSize size, WChar key, const GlyphEntry *glyph)
{
if (_glyph_ptr[size] == NULL) {
DEBUG(freetype, 3, "Allocating root glyph cache for size %u", size);
- CallocT(&_glyph_ptr[size], 256);
+ _glyph_ptr[size] = CallocT<GlyphEntry*>(256);
}
if (_glyph_ptr[size][GB(key, 8, 8)] == NULL) {
DEBUG(freetype, 3, "Allocating glyph cache for range 0x%02X00, size %u", GB(key, 8, 8), size);
- CallocT(&_glyph_ptr[size][GB(key, 8, 8)], 256);
+ _glyph_ptr[size][GB(key, 8, 8)] = CallocT<GlyphEntry>(256);
}
DEBUG(freetype, 4, "Set glyph for unicode character 0x%04X, size %u", key, size);
@@ -484,8 +484,8 @@ SpriteID GetUnicodeGlyph(FontSize size, uint32 key)
void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite)
{
- if (_unicode_glyph_map[size] == NULL) CallocT(&_unicode_glyph_map[size], 256);
- if (_unicode_glyph_map[size][GB(key, 8, 8)] == NULL) CallocT(&_unicode_glyph_map[size][GB(key, 8, 8)], 256);
+ if (_unicode_glyph_map[size] == NULL) _unicode_glyph_map[size] = CallocT<SpriteID*>(256);
+ if (_unicode_glyph_map[size][GB(key, 8, 8)] == NULL) _unicode_glyph_map[size][GB(key, 8, 8)] = CallocT<SpriteID>(256);
_unicode_glyph_map[size][GB(key, 8, 8)][GB(key, 0, 8)] = sprite;
}