X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/5faa80c629ffd05cf80dd29e8a1834057805829c..afcbfd1a09e22ff4839ba5db42047c96f355506c:/projects/sgconf/main.cpp diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index b107ee95..3eaffb9f 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -332,13 +332,6 @@ return stg_timegm(&brokenTime); void ParseAnyString(const char * c, string * msg, const char * enc) { iconv_t cd; -char * ob = new char[strlen(c) + 1]; -char * ib = new char[strlen(c) + 1]; - -strcpy(ib, c); - -char * outbuf = ob; -char * inbuf = ib; setlocale(LC_ALL, ""); @@ -349,11 +342,6 @@ const char * charsetT = enc; size_t nconv = 1; -size_t insize = strlen(ib); -size_t outsize = strlen(ib); - -insize = strlen(c); - cd = iconv_open(charsetT, charsetF); if (cd == (iconv_t) -1) { @@ -369,6 +357,17 @@ if (cd == (iconv_t) -1) exit(ICONV_ERR_CODE); } +char * ob = new char[strlen(c) + 1]; +char * ib = new char[strlen(c) + 1]; + +strcpy(ib, c); + +char * outbuf = ob; +char * inbuf = ib; + +size_t insize = strlen(c); +size_t outsize = strlen(ib); + #if defined(CONST_ICONV) nconv = iconv (cd, (const char**)&inbuf, &insize, &outbuf, &outsize); #else