SILENCE ALL WARNINGS!
This commit is contained in:
parent
0a80ce24ef
commit
0c2b3f36a5
|
|
@ -80,7 +80,12 @@ int niko_server_thread(void *data)
|
||||||
SDL_LockMutex(mutex);
|
SDL_LockMutex(mutex);
|
||||||
active = true;
|
active = true;
|
||||||
if (message_len > 0)
|
if (message_len > 0)
|
||||||
write(out_pipe, (char*)message_buffer, message_len);
|
{
|
||||||
|
if (write(out_pipe, (char*)message_buffer, message_len) == -1)
|
||||||
|
{
|
||||||
|
Debug() << "Failed to write to pipe!";
|
||||||
|
}
|
||||||
|
}
|
||||||
SDL_UnlockMutex(mutex);
|
SDL_UnlockMutex(mutex);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -89,6 +94,8 @@ int niko_server_thread(void *data)
|
||||||
|
|
||||||
RB_METHOD(nikoPrepare)
|
RB_METHOD(nikoPrepare)
|
||||||
{
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
// Prime native window info
|
// Prime native window info
|
||||||
syswm::SDL_SysWMinfo syswindow;
|
syswm::SDL_SysWMinfo syswindow;
|
||||||
SDL_VERSION(&syswindow.version);
|
SDL_VERSION(&syswindow.version);
|
||||||
|
|
@ -99,7 +106,9 @@ RB_METHOD(nikoPrepare)
|
||||||
std::string journal;
|
std::string journal;
|
||||||
|
|
||||||
// Get current path
|
// Get current path
|
||||||
getcwd(path, sizeof(path));
|
if (getcwd(path, sizeof(path)) == NULL) {
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OS_OSX
|
#ifdef OS_OSX
|
||||||
journal = std::string(path) + std::string("/_______.app/Contents/MacOS/_______");
|
journal = std::string(path) + std::string("/_______.app/Contents/MacOS/_______");
|
||||||
|
|
|
||||||
52
src/i18n.cpp
52
src/i18n.cpp
|
|
@ -13,6 +13,7 @@ const char* LOC_HEADER = "ONELOC\x10";
|
||||||
char** strdict = 0;
|
char** strdict = 0;
|
||||||
unsigned int nStr = 0;
|
unsigned int nStr = 0;
|
||||||
int family = LOCALE_FAMILY_LATIN;
|
int family = LOCALE_FAMILY_LATIN;
|
||||||
|
size_t readSize;
|
||||||
|
|
||||||
int getLocaleFamily() {
|
int getLocaleFamily() {
|
||||||
Debug() << "Get family:" << family;
|
Debug() << "Get family:" << family;
|
||||||
|
|
@ -40,12 +41,19 @@ void unloadLocale() {
|
||||||
|
|
||||||
void _setLocaleFamily(const char* locale) {
|
void _setLocaleFamily(const char* locale) {
|
||||||
if (!strcmp(locale, "ja")
|
if (!strcmp(locale, "ja")
|
||||||
|| !strcmp(locale, "ko")
|
|| !strcmp(locale, "ko")
|
||||||
|| !strcmp(locale, "zh_CN")) {
|
|| !strcmp(locale, "zh_CN")) {
|
||||||
family = LOCALE_FAMILY_ASIAN;
|
family = LOCALE_FAMILY_ASIAN;
|
||||||
} else {
|
} else {
|
||||||
family = LOCALE_FAMILY_LATIN;
|
family = LOCALE_FAMILY_LATIN;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _read(void * ptr, size_t size, size_t count, FILE * stream) {
|
||||||
|
readSize = fread(ptr, size, count, stream);
|
||||||
|
if (readSize != count) {
|
||||||
|
Debug() << "Short read in i18n!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadLocale(const char* locale) {
|
void loadLocale(const char* locale) {
|
||||||
|
|
@ -63,24 +71,24 @@ void loadLocale(const char* locale) {
|
||||||
sprintf(pathbuf, "Languages/internal/%s.loc", locale);
|
sprintf(pathbuf, "Languages/internal/%s.loc", locale);
|
||||||
locfile = fopen(pathbuf, "rb");
|
locfile = fopen(pathbuf, "rb");
|
||||||
if (locfile) {
|
if (locfile) {
|
||||||
fread(header, 1, 8, locfile);
|
_read(header, 1, 8, locfile);
|
||||||
if (!strcmp(header, LOC_HEADER)) {
|
if (!strcmp(header, LOC_HEADER)) {
|
||||||
//read number of strs in this file
|
//read number of strs in this file
|
||||||
fread(&nStr, 4, 1, locfile);
|
_read(&nStr, 4, 1, locfile);
|
||||||
strdict = (char**)malloc(sizeof(char*) * nStr);
|
strdict = (char**)malloc(sizeof(char*) * nStr);
|
||||||
for (i = 0; i < nStr; i++) {
|
for (i = 0; i < nStr; i++) {
|
||||||
//read the size of the next string
|
//read the size of the next string
|
||||||
fread(&strSize, 4, 1, locfile);
|
_read(&strSize, 4, 1, locfile);
|
||||||
strdict[i] = (char*)malloc(strSize+1);
|
strdict[i] = (char*)malloc(strSize+1);
|
||||||
if (strSize > 0) {
|
if (strSize > 0) {
|
||||||
//read the contents of the next string
|
//read the contents of the next string
|
||||||
fread(strdict[i], 1, strSize, locfile);
|
_read(strdict[i], 1, strSize, locfile);
|
||||||
strdict[i][strSize] = 0;
|
|
||||||
Debug() << "localization #" << i << " : " << strdict[i] << "|" << strSize;
|
|
||||||
}
|
|
||||||
strdict[i][strSize] = 0;
|
strdict[i][strSize] = 0;
|
||||||
|
Debug() << "localization #" << i << " : " << strdict[i] << "|" << strSize;
|
||||||
}
|
}
|
||||||
|
strdict[i][strSize] = 0;
|
||||||
}
|
}
|
||||||
fclose(locfile);
|
}
|
||||||
|
fclose(locfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue