mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-20 22:09:55 +00:00
SILENCE ALL WARNINGS!
This commit is contained in:
parent
0a80ce24ef
commit
0c2b3f36a5
2 changed files with 41 additions and 24 deletions
|
|
@ -80,7 +80,12 @@ int niko_server_thread(void *data)
|
|||
SDL_LockMutex(mutex);
|
||||
active = true;
|
||||
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);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -89,6 +94,8 @@ int niko_server_thread(void *data)
|
|||
|
||||
RB_METHOD(nikoPrepare)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
// Prime native window info
|
||||
syswm::SDL_SysWMinfo syswindow;
|
||||
SDL_VERSION(&syswindow.version);
|
||||
|
|
@ -99,7 +106,9 @@ RB_METHOD(nikoPrepare)
|
|||
std::string journal;
|
||||
|
||||
// Get current path
|
||||
getcwd(path, sizeof(path));
|
||||
if (getcwd(path, sizeof(path)) == NULL) {
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#ifdef OS_OSX
|
||||
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;
|
||||
unsigned int nStr = 0;
|
||||
int family = LOCALE_FAMILY_LATIN;
|
||||
size_t readSize;
|
||||
|
||||
int getLocaleFamily() {
|
||||
Debug() << "Get family:" << family;
|
||||
|
|
@ -40,12 +41,19 @@ void unloadLocale() {
|
|||
|
||||
void _setLocaleFamily(const char* locale) {
|
||||
if (!strcmp(locale, "ja")
|
||||
|| !strcmp(locale, "ko")
|
||||
|| !strcmp(locale, "zh_CN")) {
|
||||
family = LOCALE_FAMILY_ASIAN;
|
||||
} else {
|
||||
family = LOCALE_FAMILY_LATIN;
|
||||
}
|
||||
|| !strcmp(locale, "ko")
|
||||
|| !strcmp(locale, "zh_CN")) {
|
||||
family = LOCALE_FAMILY_ASIAN;
|
||||
} else {
|
||||
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) {
|
||||
|
|
@ -63,24 +71,24 @@ void loadLocale(const char* locale) {
|
|||
sprintf(pathbuf, "Languages/internal/%s.loc", locale);
|
||||
locfile = fopen(pathbuf, "rb");
|
||||
if (locfile) {
|
||||
fread(header, 1, 8, locfile);
|
||||
if (!strcmp(header, LOC_HEADER)) {
|
||||
//read number of strs in this file
|
||||
fread(&nStr, 4, 1, locfile);
|
||||
strdict = (char**)malloc(sizeof(char*) * nStr);
|
||||
for (i = 0; i < nStr; i++) {
|
||||
//read the size of the next string
|
||||
fread(&strSize, 4, 1, locfile);
|
||||
strdict[i] = (char*)malloc(strSize+1);
|
||||
if (strSize > 0) {
|
||||
//read the contents of the next string
|
||||
fread(strdict[i], 1, strSize, locfile);
|
||||
strdict[i][strSize] = 0;
|
||||
Debug() << "localization #" << i << " : " << strdict[i] << "|" << strSize;
|
||||
}
|
||||
_read(header, 1, 8, locfile);
|
||||
if (!strcmp(header, LOC_HEADER)) {
|
||||
//read number of strs in this file
|
||||
_read(&nStr, 4, 1, locfile);
|
||||
strdict = (char**)malloc(sizeof(char*) * nStr);
|
||||
for (i = 0; i < nStr; i++) {
|
||||
//read the size of the next string
|
||||
_read(&strSize, 4, 1, locfile);
|
||||
strdict[i] = (char*)malloc(strSize+1);
|
||||
if (strSize > 0) {
|
||||
//read the contents of the next string
|
||||
_read(strdict[i], 1, strSize, locfile);
|
||||
strdict[i][strSize] = 0;
|
||||
Debug() << "localization #" << i << " : " << strdict[i] << "|" << strSize;
|
||||
}
|
||||
strdict[i][strSize] = 0;
|
||||
}
|
||||
fclose(locfile);
|
||||
}
|
||||
fclose(locfile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue