OSDN Git Service

[UI][LOG] (Maybe) fix character corruption with log at non-UTF8 environment.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 9 Mar 2016 13:05:44 +0000 (22:05 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 9 Mar 2016 13:05:44 +0000 (22:05 +0900)
[Qt][Windows] Correct number of argument to main() at WinMain().
See: http://hanabi.2ch.net/test/read.cgi/i4004/1430836648/528 .

source/src/qt/common/qt_main.cpp
source/src/qt/osd_sound.cpp

index 51fa162..809eae4 100644 (file)
@@ -701,20 +701,11 @@ int main(int argc, char *argv[])
 #if defined(__i386__)
        archstr = "ia32";
 #endif
-       printf("Common Source Project : %s %s\n", my_procname.c_str(), "1.0");
-       printf("(C) Toshiya Takeda / SDL Version K.Ohta <whatisthis.sowhat@gmail.com>\n");
-       printf("Architecture: %s\n", archstr.c_str());
-       printf(" -? is print help(s).\n");
-   
        AGAR_DebugLog(AGAR_LOG_INFO, "Start Common Source Project '%s'", my_procname.c_str());
        AGAR_DebugLog(AGAR_LOG_INFO, "(C) Toshiya Takeda / Agar Version K.Ohta");
        AGAR_DebugLog(AGAR_LOG_INFO, "Architecture: %s", archstr.c_str());
        
-       AGAR_DebugLog(AGAR_LOG_DEBUG, "Start Common Source Project '%s'", my_procname.c_str());
-       AGAR_DebugLog(AGAR_LOG_DEBUG, "(C) Toshiya Takeda / Agar Version K.Ohta");
-       AGAR_DebugLog(AGAR_LOG_DEBUG, "Architecture: %s", archstr.c_str());
-       AGAR_DebugLog(AGAR_LOG_DEBUG, " -? is print help(s).");
+       //AGAR_DebugLog(AGAR_LOG_INFO, " -? is print help(s).");
        AGAR_DebugLog(AGAR_LOG_DEBUG, "Moduledir = %s home = %s", cpp_confdir.c_str(), cpp_homedir.c_str()); // Debug
 #if !defined(Q_OS_CYGWIN)      
        {
@@ -748,6 +739,6 @@ int main(int argc, char *argv[])
 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
 {
    char *arg[1] = {""};
-   main(0, arg);
+   main(1, arg);
 }
 #endif
index 6f20f66..53df058 100644 (file)
@@ -123,8 +123,10 @@ void OSD::initialize_sound(int rate, int samples)
        snd_spec_req.userdata = (void *)&snddata;
 #if defined(USE_SDL2)      
        for(i = 0; i < SDL_GetNumAudioDevices(0); i++) {
-               devname = SDL_GetAudioDeviceName(i, 0);
-               AGAR_DebugLog(AGAR_LOG_INFO, "Audio Device: %s", devname.c_str());
+               //devname = SDL_GetAudioDeviceName(i, 0);
+               //AGAR_DebugLog(AGAR_LOG_INFO, "Audio Device: %s", devname.c_str());
+               QString tmps = QString::fromLocal8Bit(SDL_GetAudioDeviceName(i, 0));
+               AGAR_DebugLog(AGAR_LOG_INFO, "Audio Device: %s", tmps.toLocal8Bit().constData());
        }
 #endif   
        SDL_OpenAudio(&snd_spec_req, &snd_spec_presented);
@@ -351,7 +353,7 @@ void OSD::start_record_sound()
                tmps = tmps + QString::fromUtf8("_");
                tmps = tmps + nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz"));
                tmps = tmps + QString::fromUtf8(".wav");
-               strncpy(sound_file_name, tmps.toUtf8().constData(), sizeof(sound_file_name));
+               strncpy(sound_file_name, tmps.toLocal8Bit().constData(), sizeof(sound_file_name));
                // create wave file
                rec_sound_fio = new FILEIO();
                if(rec_sound_fio->Fopen(bios_path(sound_file_name), FILEIO_WRITE_BINARY)) {