Remove unused ah_translate code.

This was SVN commit r16881.
This commit is contained in:
leper 2015-07-27 01:08:15 +00:00
parent 2a655d1363
commit bd53e9d736
4 changed files with 8 additions and 36 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010 Wildfire Games
/* Copyright (c) 2015 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -124,6 +124,7 @@ void app_hooks_update(AppHooks* new_ah)
OVERRIDE_IF_NONZERO(translate_free)
OVERRIDE_IF_NONZERO(log)
OVERRIDE_IF_NONZERO(display_error)
#undef OVERRIDE_IF_NONZERO
}
bool app_hook_was_redefined(size_t offset_in_struct)

View File

@ -930,12 +930,6 @@ bool Init(const CmdLineArgs& args, int flags)
exit(0);
}
// override ah_translate with our i18n code.
AppHooks hooks = {0};
hooks.translate = psTranslate;
hooks.translate_free = psTranslateFree;
app_hooks_update(&hooks);
CNetHost::Initialize();
#if CONFIG2_AUDIO

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -24,31 +24,12 @@
#include "lib/sysdep/sysdep.h"
#include "lib/svn_revision.h"
static const wchar_t* translate_no_mem = L"(no mem)";
// overrides ah_translate. registered in GameSetup.cpp
const wchar_t* psTranslate(const wchar_t* text)
{
// TODO: implement this somehow
// i18n not available: at least try and return the text (unchanged)
const wchar_t* ret_dup = wcsdup(text);
return ret_dup? ret_dup : translate_no_mem;
}
void psTranslateFree(const wchar_t* text)
{
if(text != translate_no_mem)
free((void*)text);
}
// convert contents of file <in_filename> from char to wchar_t and
// append to <out> file.
static void AppendAsciiFile(FILE* out, const OsPath& pathname)
{
FILE* in = sys_OpenFile(pathname, "rb");
if(!in)
if (!in)
{
fwprintf(out, L"(unavailable)");
return;
@ -57,10 +38,10 @@ static void AppendAsciiFile(FILE* out, const OsPath& pathname)
const size_t buf_size = 1024;
char buf[buf_size+1]; // include space for trailing '\0'
while(!feof(in))
while (!feof(in))
{
size_t bytes_read = fread(buf, 1, buf_size, in);
if(!bytes_read)
if (!bytes_read)
break;
buf[bytes_read] = 0; // 0-terminate
fwprintf(out, L"%hs", buf);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -26,11 +26,7 @@ Standard declarations which are included in all projects.
#include "lib/os_path.h"
// overrides ah_translate. registered in GameSetup.cpp
extern const wchar_t* psTranslate(const wchar_t* text);
extern void psTranslateFree(const wchar_t* text);
extern void psBundleLogs(FILE* f);
extern void psBundleLogs(FILE* f); // set during InitVfs
extern void psSetLogDir(const OsPath& logDir); // set during InitVfs
extern const OsPath& psLogDir(); // used by AppHooks and engine code when reporting errors