diff --git a/binding-mri/journal-binding.cpp b/binding-mri/journal-binding.cpp index 25bb4fe..a577a14 100644 --- a/binding-mri/journal-binding.cpp +++ b/binding-mri/journal-binding.cpp @@ -48,13 +48,19 @@ int server_thread(void *data) } CloseHandle(pipe); #else - if (FILE *file = fopen(PIPE_PATH, "r")) { + if (FILE *file = fopen(PIPE_PATH, "r")) + { fclose(file); out_pipe = open(PIPE_PATH, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); 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() << "Failure writing to journal's pipe!"; + } + } SDL_UnlockMutex(mutex); } return 0; diff --git a/mkxp.pro b/mkxp.pro index 4d81a50..b1223db 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -48,7 +48,7 @@ unix { } !macx: { QMAKE_CXXFLAGS += -g - PKGCONFIG += giomm-2.4 gtk+-3.0 gdk-3.0 libxfconf-0 + PKGCONFIG += gtk+-3.0 gdk-3.0 libxfconf-0 INCLUDEPATH += /usr/include/AL /usr/local/include/AL LIBS += -lX11 } diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 63bbf76..f11b034 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -166,7 +166,6 @@ void EventThread::process(RGSSThreadData &rtData) char buffer[128]; char pendingTitle[128]; - bool havePendingTitle = false; bool resetting = false; @@ -330,8 +329,6 @@ void EventThread::process(RGSSThreadData &rtData) /* Prevent fullscreen flicker */ strncpy(pendingTitle, rtData.config.windowTitle.c_str(), sizeof(pendingTitle)); - havePendingTitle = true; - break; } @@ -510,8 +507,6 @@ void EventThread::process(RGSSThreadData &rtData) if (fullscreen) { strncpy(pendingTitle, buffer, sizeof(pendingTitle)); - havePendingTitle = true; - break; } diff --git a/src/i18n.cpp b/src/i18n.cpp index f293c87..c7a1dcf 100644 --- a/src/i18n.cpp +++ b/src/i18n.cpp @@ -1,5 +1,5 @@ /* - Really hacked-together naiive implementation of gettext + Really hacked-together naiive implementation of gettext */ #include "i18n.h" #include "debugwriter.h" @@ -15,72 +15,72 @@ unsigned int nStr = 0; int family = LOCALE_FAMILY_LATIN; int getLocaleFamily() { - Debug() << "Get family:" << family; - return family; + Debug() << "Get family:" << family; + return family; } const char* findtext(unsigned int msgid, const char* fallback) { - Debug() << "Looking for msg" << msgid << fallback; - if (msgid >= nStr) { - return fallback; - } else { - Debug() << "found" << strdict[msgid]; - return strdict[msgid]; - } + Debug() << "Looking for msg" << msgid << fallback; + if (msgid >= nStr) { + return fallback; + } else { + Debug() << "found" << strdict[msgid]; + return strdict[msgid]; + } } void unloadLocale() { - for (unsigned int i = 0; i < nStr; i++) { - free(strdict[i]); - } - free(strdict); - strdict = 0; - nStr = 0; + for (unsigned int i = 0; i < nStr; i++) { + free(strdict[i]); + } + free(strdict); + strdict = 0; + nStr = 0; } 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; - } + if (!strcmp(locale, "ja") + || !strcmp(locale, "ko") + || !strcmp(locale, "zh_CN")) { + family = LOCALE_FAMILY_ASIAN; + } else { + family = LOCALE_FAMILY_LATIN; + } } void loadLocale(const char* locale) { - Debug() << "Load locale:" << locale; - char pathbuf[100]; - FILE* locfile; - char header[8]; - unsigned int i; - int strSize = 0; + Debug() << "Load locale:" << locale; + char pathbuf[100]; + FILE* locfile; + char header[8]; + unsigned int i; + int strSize = 0; - unloadLocale(); + unloadLocale(); - _setLocaleFamily(locale); + _setLocaleFamily(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; - } - strdict[i][strSize] = 0; - } - } - fclose(locfile); - } + 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; + } + strdict[i][strSize] = 0; + } + } + fclose(locfile); + } }