diff options
-rw-r--r-- | sound_detector/Makefile.mingw32 | 2 | ||||
-rw-r--r-- | sound_detector/iconv.c | 6 | ||||
-rw-r--r-- | sound_detector/iconv.h | 2 | ||||
-rw-r--r-- | sound_detector/main.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/sound_detector/Makefile.mingw32 b/sound_detector/Makefile.mingw32 index 201c84e..3b6702f 100644 --- a/sound_detector/Makefile.mingw32 +++ b/sound_detector/Makefile.mingw32 @@ -1,6 +1,6 @@ all: i686-pc-mingw32-gcc -c wingetopt.c -o wingetopt.o - i686-pc-mingw32-gcc -c toutf8.c -o toutf8.o + i686-pc-mingw32-gcc -c iconv.c -o toutf8.o i686-pc-mingw32-g++ -c main.cpp -std=gnu++0x -DBOOST_ALL_NO_LIB -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_USE_LIB -DBOOST_THREAD_USE_LIB=1 -DUNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -D_UNICODE -D_WIN32 -D_WIN32_WINNT=0x0500 -D__USE_W32_SOCKETS -DCURL_STATICLIB -o main.o i686-pc-mingw32-g++ -o sound_detector.exe *.o -lwldap32 -liconv -lwldap32 -lws2_32 -lz -lgmp -lz -lboost_system-mt -lboost_date_time-mt -lboost_thread_win32-mt -lboost_chrono-mt -lboost_random-mt -lboost_filesystem-mt -lmswsock -lws2_32 -lgdi32 -lcrypt32 -lz -lportaudio -lwinmm -lm -ldsound -lole32 -lwinmm -lm -luuid -lsetupapi -lole32 -lwinmm -lm -lole32 -luuid -lwinmm -lm -lole32 -luuid -lvorbis -lvorbisenc -logg -liconv -Wl,-O1 -s upx --best sound_detector.exe diff --git a/sound_detector/iconv.c b/sound_detector/iconv.c index 1601bd1..6d488fc 100644 --- a/sound_detector/iconv.c +++ b/sound_detector/iconv.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <iconv.h> -char *to_utf8(const char *koi8r) +char *change_charset(const char *source) { iconv_t id = iconv_open("CP866", "WINDOWS-1251"); if((long)id == -1) @@ -30,12 +30,12 @@ char *to_utf8(const char *koi8r) printf("failed to create iconv descriptor with error: %s\n", strerror(errno)); return NULL; } - int len = strlen(koi8r), outlen = 0; + int len = strlen(source), outlen = 0; len++; outlen = len * 2; char *outbuf = (char*)malloc(len * 2), *op, *ip; op = outbuf; - ip = koi8r; + ip = source; int enc_len = iconv(id, &ip, &len, &op, &outlen); if(enc_len == -1) { diff --git a/sound_detector/iconv.h b/sound_detector/iconv.h index 49d42d7..689a788 100644 --- a/sound_detector/iconv.h +++ b/sound_detector/iconv.h @@ -1,3 +1,3 @@ #ifdef WIN32 -extern "C" char *to_utf8(const char *koi8r); +extern "C" char *change_charset(const char *koi8r); #endif diff --git a/sound_detector/main.cpp b/sound_detector/main.cpp index 295dc20..ca8b804 100644 --- a/sound_detector/main.cpp +++ b/sound_detector/main.cpp @@ -291,7 +291,7 @@ int main(int argc, char **argv) const PaDeviceInfo *info = Pa_GetDeviceInfo(i); //windows #ifdef WIN32 - char *name = to_utf8(info->name); + char *name = change_charset(info->name); printf("%d. %s, input channels %d, output channels %d, default sample rate %f, lowest input latency %f, highest input latency %f\n", i, name, info->maxInputChannels, info->maxOutputChannels, info->defaultSampleRate, info->defaultLowInputLatency, info->defaultHighInputLatency); free(name); |