Changeset 36013

Show
Ignore:
Timestamp:
11/28/09 00:01:25 (3 years ago)
Author:
saturday06
Message:

iconv

Location:
lang/objective-cplusplus/i3/trunk
Files:
2 added
12 modified

Legend:

Unmodified
Added
Removed
  • lang/objective-cplusplus/i3/trunk/po/POTFILES.in

    r35922 r36013  
    99src/gui-windows/Gui.h 
    1010src/gui-windows/InputWindowPlatform.h 
     11src/gui-windows/OutputWindowPlatform.h 
    1112src/Initial.h 
    1213src/InputWindow.h 
     
    5253src/mil/include/xbyak/xbyak_bin2hex.h 
    5354src/mil/include/xbyak/xbyak_mnemonic.h 
    54 src/mil/src/profile/Profile.h 
    5555src/mil/src/test/Test.h 
    5656src/os-unix/Os.h 
  • lang/objective-cplusplus/i3/trunk/src/Mediator.cpp

    r35976 r36013  
    2424    shellManager.start(); 
    2525    delegate.start(); 
     26#ifdef I3_TEST 
     27    inputWindow.start(); 
     28        Tester tester(*this); 
     29        tester.run(); 
     30#else 
    2631    inputWindow.run(); 
     32#endif 
     33 
    2734#else 
    2835    // no threaded gui 
     
    3542    debug << "before loop"; 
    3643 
     44#ifdef I3_TEST 
     45        Tester tester(*this); 
     46        tester.start(); 
     47#endif 
     48 
    3749    global_loop(); 
    3850#endif 
    39     delegate.destroy(); 
     51 
    4052    return 0; 
    4153} 
  • lang/objective-cplusplus/i3/trunk/src/Mediator.h

    r34497 r36013  
    1010#include "Delegate.h" 
    1111#include "ShellManager.h" 
    12  
    13 #ifdef TEST_HEADER 
    14 #include BOOST_PP_STRINGIZE(TEST_HEADER) 
    15 #endif 
    1612 
    1713namespace i3 { 
     
    3632} 
    3733 
    38 #ifdef TEST_HEADER 
    39 #undef CompletionWindow 
    40 #undef InputWindow 
    41 #undef OutputWindow 
    42 #undef ShellManager 
    43 #undef Delegate 
     34#ifdef I3_TEST 
     35#include <quicktest/quicktest.h> 
     36#include "Tester.h" 
    4437#endif 
    4538 
  • lang/objective-cplusplus/i3/trunk/src/mil/include/mil/ModuleCommon.h

    r35976 r36013  
    145145    MIL_CRTP_CLASS_MEMBERS; 
    146146 
     147        template <class Event> 
     148        void beforeExecute(Event& event) { 
     149        } 
     150 
     151        template <class Event> 
     152        void afterExecute(Event& event) { 
     153        } 
     154 
    147155    ModuleCommon() : tls(this->thread_id) { 
    148156        set_auto_join(&MIL_MODULE_GET_SUPER_CHILD(*this)); 
  • lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Synchronize.h

    r35685 r36013  
    203203 
    204204#define synchronized(mutex) \ 
    205     for(mil::SynchronizeHelper synchronize_helper_instance__##mutex (mutex); (synchronize_helper_instance__##mutex ).process();) 
    206  
     205    for (mil::SynchronizeHelper synchronize_helper_instance__##mutex (mutex); \ 
     206            (synchronize_helper_instance__##mutex ).process();) 
     207 
  • lang/objective-cplusplus/i3/trunk/src/mil/include/mil/gui-windows/WindowProcedureRedirector.h

    r34448 r36013  
    22#include "../Mil.h" 
    33#include "../MscCrt.h" 
     4#include "../Serial.h" 
     5 
    46#include <windows.h> 
    5 #include "../Serial.h" 
    67 
    78#ifndef _WIN32_WCE 
  • lang/objective-cplusplus/i3/trunk/src/os-windows/msvc/iconv.h

    r25302 r36013  
    1212#endif 
    1313 
    14   typedef void* iconv_t; 
    15   iconv_t iconv_open(const char *tocode, const char *fromcode); 
    16   int iconv_close(iconv_t cd); 
    17   size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 
     14typedef void* iconv_t; 
     15iconv_t iconv_open(const char *tocode, const char *fromcode); 
     16int iconv_close(iconv_t cd); 
     17size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 
    1818 
    1919#ifdef __cplusplus 
  • lang/objective-cplusplus/i3/trunk/src/os-windows/msvc/win_iconv.c

    r35623 r36013  
    6464#if defined(MAKE_DLL) 
    6565int 
    66 iconvctl (iconv_t cd, int request, void* argument) { 
     66iconvctl (iconv_t cd, int request, void* argument) 
     67{ 
    6768    /* not supported */ 
    6869    return 0; 
     
    408409    {500, "IBM500"}, /* IBM EBCDIC International */ 
    409410    {708, "ASMO-708"}, /* Arabic (ASMO 708) */ 
    410     /* 709   Arabic (ASMO-449+, BCON V4) */ 
    411     /* 710   Arabic - Transparent Arabic */ 
     411    /* 709              Arabic (ASMO-449+, BCON V4) */ 
     412    /* 710              Arabic - Transparent Arabic */ 
    412413    {720, "DOS-720"}, /* Arabic (Transparent ASMO); Arabic (DOS) */ 
    413414    {737, "ibm737"}, /* OEM Greek (formerly 437G); Greek (DOS) */ 
     
    507508    {20949, "x-cp20949"}, /* Korean Wansung */ 
    508509    {21025, "cp1025"}, /* IBM EBCDIC Cyrillic Serbian-Bulgarian */ 
    509     /* 21027   (deprecated) */ 
     510    /* 21027            (deprecated) */ 
    510511    {21866, "koi8-u"}, /* Ukrainian (KOI8-U); Cyrillic (KOI8-U) */ 
    511512    {28591, "iso-8859-1"}, /* ISO 8859-1 Latin 1; Western European (ISO) */ 
     
    540541    {50225, "iso2022-kr"}, /* ISO 2022 Korean */ 
    541542    {50227, "x-cp50227"}, /* ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022) */ 
    542     /* 50229   ISO 2022 Traditional Chinese */ 
    543     /* 50930   EBCDIC Japanese (Katakana) Extended */ 
    544     /* 50931   EBCDIC US-Canada and Japanese */ 
    545     /* 50933   EBCDIC Korean Extended and Korean */ 
    546     /* 50935   EBCDIC Simplified Chinese Extended and Simplified Chinese */ 
    547     /* 50936   EBCDIC Simplified Chinese */ 
    548     /* 50937   EBCDIC US-Canada and Traditional Chinese */ 
    549     /* 50939   EBCDIC Japanese (Latin) Extended and Japanese */ 
     543    /* 50229            ISO 2022 Traditional Chinese */ 
     544    /* 50930            EBCDIC Japanese (Katakana) Extended */ 
     545    /* 50931            EBCDIC US-Canada and Japanese */ 
     546    /* 50933            EBCDIC Korean Extended and Korean */ 
     547    /* 50935            EBCDIC Simplified Chinese Extended and Simplified Chinese */ 
     548    /* 50936            EBCDIC Simplified Chinese */ 
     549    /* 50937            EBCDIC US-Canada and Traditional Chinese */ 
     550    /* 50939            EBCDIC Japanese (Latin) Extended and Japanese */ 
    550551    {51932, "euc-jp"}, /* EUC Japanese */ 
    551552    {51936, "EUC-CN"}, /* EUC Simplified Chinese; Chinese Simplified (EUC) */ 
    552553    {51949, "euc-kr"}, /* EUC Korean */ 
    553     /* 51950   EUC Traditional Chinese */ 
     554    /* 51950            EUC Traditional Chinese */ 
    554555    {52936, "hz-gb-2312"}, /* HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ) */ 
    555556    {54936, "GB18030"}, /* Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030) */ 
     
    673674 
    674675static int 
    675 load_mlang() { 
     676load_mlang() 
     677{ 
    676678    HMODULE h; 
    677679    if (ConvertINetString != NULL) 
     
    690692 
    691693iconv_t 
    692 iconv_open(const char *tocode, const char *fromcode) { 
     694iconv_open(const char *tocode, const char *fromcode) 
     695{ 
    693696    rec_iconv_t *cd; 
    694697 
     
    715718 
    716719int 
    717 iconv_close(iconv_t _cd) { 
     720iconv_close(iconv_t _cd) 
     721{ 
    718722    rec_iconv_t *cd = (rec_iconv_t *)_cd; 
    719723    int r = cd->iconv_close(cd->cd); 
     
    729733 
    730734size_t 
    731 iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { 
     735iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) 
     736{ 
    732737    rec_iconv_t *cd = (rec_iconv_t *)_cd; 
    733738    size_t r = cd->iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft); 
     
    737742 
    738743static int 
    739 win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) { 
     744win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) 
     745{ 
    740746    if (!make_csconv(fromcode, &cd->from) || !make_csconv(tocode, &cd->to)) 
    741747        return FALSE; 
     
    748754 
    749755static int 
    750 win_iconv_close(iconv_t cd) { 
     756win_iconv_close(iconv_t cd) 
     757{ 
    751758    return 0; 
    752759} 
    753760 
    754761static size_t 
    755 win_iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { 
     762win_iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) 
     763{ 
    756764    rec_iconv_t *cd = (rec_iconv_t *)_cd; 
    757765    ushort wbuf[MB_CHAR_MAX]; /* enough room for one character */ 
     
    765773    int i; 
    766774 
    767     if (inbuf == NULL || *inbuf == NULL) { 
    768         if (outbuf != NULL && *outbuf != NULL && cd->to.flush != NULL) { 
     775    if (inbuf == NULL || *inbuf == NULL) 
     776    { 
     777        if (outbuf != NULL && *outbuf != NULL && cd->to.flush != NULL) 
     778        { 
    769779            tomode = cd->to.mode; 
    770780            outsize = cd->to.flush(&cd->to, (uchar *)*outbuf, *outbytesleft); 
    771             if (outsize == -1) { 
     781            if (outsize == -1) 
     782            { 
    772783                cd->to.mode = tomode; 
    773784                return (size_t)(-1); 
     
    781792    } 
    782793 
    783     while (*inbytesleft != 0) { 
     794    while (*inbytesleft != 0) 
     795    { 
    784796        frommode = cd->from.mode; 
    785797        tomode = cd->to.mode; 
     
    787799 
    788800        insize = cd->from.mbtowc(&cd->from, (const uchar *)*inbuf, *inbytesleft, wbuf, &wsize); 
    789         if (insize == -1) { 
     801        if (insize == -1) 
     802        { 
    790803            cd->from.mode = frommode; 
    791804            return (size_t)(-1); 
    792805        } 
    793806 
    794         if (wsize == 0) { 
     807        if (wsize == 0) 
     808        { 
    795809            *inbuf += insize; 
    796810            *inbytesleft -= insize; 
     
    798812        } 
    799813 
    800         if (cd->from.compat != NULL) { 
     814        if (cd->from.compat != NULL) 
     815        { 
    801816            wc = utf16_to_ucs4(wbuf); 
    802817            cp = cd->from.compat; 
    803             for (i = 0; cp[i].in != 0; ++i) { 
    804                 if ((cp[i].flag & COMPAT_IN) && cp[i].out == wc) { 
     818            for (i = 0; cp[i].in != 0; ++i) 
     819            { 
     820                if ((cp[i].flag & COMPAT_IN) && cp[i].out == wc) 
     821                { 
    805822                    ucs4_to_utf16(cp[i].in, wbuf, &wsize); 
    806823                    break; 
     
    809826        } 
    810827 
    811         if (cd->to.compat != NULL) { 
     828        if (cd->to.compat != NULL) 
     829        { 
    812830            wc = utf16_to_ucs4(wbuf); 
    813831            cp = cd->to.compat; 
    814             for (i = 0; cp[i].in != 0; ++i) { 
    815                 if ((cp[i].flag & COMPAT_OUT) && cp[i].in == wc) { 
     832            for (i = 0; cp[i].in != 0; ++i) 
     833            { 
     834                if ((cp[i].flag & COMPAT_OUT) && cp[i].in == wc) 
     835                { 
    816836                    ucs4_to_utf16(cp[i].out, wbuf, &wsize); 
    817837                    break; 
     
    821841 
    822842        outsize = cd->to.wctomb(&cd->to, wbuf, wsize, (uchar *)*outbuf, *outbytesleft); 
    823         if (outsize == -1) { 
     843        if (outsize == -1) 
     844        { 
    824845            cd->from.mode = frommode; 
    825846            cd->to.mode = tomode; 
     
    837858 
    838859static int 
    839 make_csconv(const char *_name, csconv_t *cv) { 
     860make_csconv(const char *_name, csconv_t *cv) 
     861{ 
    840862    CPINFOEX cpinfoex; 
    841863    int use_compat = TRUE; 
     
    849871 
    850872    /* check for option "enc_name//opt1//opt2" */ 
    851     while ((p = strrstr(name, "//")) != NULL) { 
     873    while ((p = strrstr(name, "//")) != NULL) 
     874    { 
    852875        if (_stricmp(p + 2, "nocompat") == 0) 
    853876            use_compat = FALSE; 
     
    865888    cv->compat = NULL; 
    866889    cv->codepage = name_to_codepage(name); 
    867     if (cv->codepage == 1200 || cv->codepage == 1201) { 
     890    if (cv->codepage == 1200 || cv->codepage == 1201) 
     891    { 
    868892        cv->mbtowc = utf16_mbtowc; 
    869893        cv->wctomb = utf16_wctomb; 
    870894        if (_stricmp(name, "UTF-16") == 0 || _stricmp(name, "UTF16") == 0) 
    871895            cv->flags |= FLAG_USE_BOM; 
    872     } else if (cv->codepage == 12000 || cv->codepage == 12001) { 
     896    } 
     897    else if (cv->codepage == 12000 || cv->codepage == 12001) 
     898    { 
    873899        cv->mbtowc = utf32_mbtowc; 
    874900        cv->wctomb = utf32_wctomb; 
    875901        if (_stricmp(name, "UTF-32") == 0 || _stricmp(name, "UTF32") == 0) 
    876902            cv->flags |= FLAG_USE_BOM; 
    877     } else if (cv->codepage == 65001) { 
     903    } 
     904    else if (cv->codepage == 65001) 
     905    { 
    878906        cv->mbtowc = kernel_mbtowc; 
    879907        cv->wctomb = kernel_wctomb; 
    880908        cv->mblen = utf8_mblen; 
    881     } else if ((cv->codepage == 50220 || cv->codepage == 50221 || cv->codepage == 50222) && load_mlang()) { 
     909    } 
     910    else if ((cv->codepage == 50220 || cv->codepage == 50221 || cv->codepage == 50222) && load_mlang()) 
     911    { 
    882912        cv->mbtowc = iso2022jp_mbtowc; 
    883913        cv->wctomb = iso2022jp_wctomb; 
    884914        cv->flush = iso2022jp_flush; 
    885     } else if (cv->codepage == 51932 && load_mlang()) { 
     915    } 
     916    else if (cv->codepage == 51932 && load_mlang()) 
     917    { 
    886918        cv->mbtowc = mlang_mbtowc; 
    887919        cv->wctomb = mlang_wctomb; 
    888920        cv->mblen = eucjp_mblen; 
    889     } else if (IsValidCodePage(cv->codepage) 
    890                && GetCPInfoEx(cv->codepage, 0, &cpinfoex) != 0) { 
     921    } 
     922    else if (IsValidCodePage(cv->codepage) 
     923             && GetCPInfoEx(cv->codepage, 0, &cpinfoex) != 0) 
     924    { 
    891925        cv->mbtowc = kernel_mbtowc; 
    892926        cv->wctomb = kernel_wctomb; 
     
    895929        else if (cpinfoex.MaxCharSize == 2) 
    896930            cv->mblen = dbcs_mblen; 
    897         else 
    898             cv->mblen = mbcs_mblen; 
    899     } else { 
     931        else 
     932            cv->mblen = mbcs_mblen; 
     933    } 
     934    else 
     935    { 
    900936        /* not supported */ 
    901937        free(name); 
     
    904940    } 
    905941 
    906     if (use_compat) { 
    907         switch (cv->codepage) { 
    908         case 932: 
    909             cv->compat = cp932_compat; 
    910             break; 
    911         case 20932: 
    912             cv->compat = cp20932_compat; 
    913             break; 
    914         case 51932: 
    915             cv->compat = cp51932_compat; 
    916             break; 
    917         case 50220: 
    918         case 50221: 
    919         case 50222: 
    920             cv->compat = cp5022x_compat; 
    921             break; 
     942    if (use_compat) 
     943    { 
     944        switch (cv->codepage) 
     945        { 
     946        case 932: cv->compat = cp932_compat; break; 
     947        case 20932: cv->compat = cp20932_compat; break; 
     948        case 51932: cv->compat = cp51932_compat; break; 
     949        case 50220: case 50221: case 50222: cv->compat = cp5022x_compat; break; 
    922950        } 
    923951    } 
     
    929957 
    930958static int 
    931 name_to_codepage(const char *name) { 
     959name_to_codepage(const char *name) 
     960{ 
    932961    int i; 
    933962 
    934963    if (*name == '\0' || 
    935             strcmp(name, "char") == 0) 
     964        strcmp(name, "char") == 0) 
    936965        return GetACP(); 
    937966    else if (strcmp(name, "wchar_t") == 0) 
     
    954983 */ 
    955984static uint 
    956 utf16_to_ucs4(const ushort *wbuf) { 
     985utf16_to_ucs4(const ushort *wbuf) 
     986{ 
    957987    uint wc = wbuf[0]; 
    958988    if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) 
     
    962992 
    963993static void 
    964 ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize) { 
    965     if (wc < 0x10000) { 
     994ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize) 
     995{ 
     996    if (wc < 0x10000) 
     997    { 
    966998        wbuf[0] = wc; 
    967999        *wbufsize = 1; 
    968     } else { 
     1000    } 
     1001    else 
     1002    { 
    9691003        wc -= 0x10000; 
    9701004        wbuf[0] = 0xD800 | ((wc >> 10) & 0x3FF); 
     
    9851019 */ 
    9861020static int 
    987 mbtowc_flags(int codepage) { 
     1021mbtowc_flags(int codepage) 
     1022{ 
    9881023    return (codepage == 50220 || codepage == 50221 || 
    989             codepage == 50222 || codepage == 50225 || 
    990             codepage == 50227 || codepage == 50229 || 
    991             codepage == 52936 || codepage == 54936 || 
    992             (codepage >= 57002 && codepage <= 57011) || 
    993             codepage == 65000 || codepage == 42) ? 0 : MB_ERR_INVALID_CHARS; 
     1024            codepage == 50222 || codepage == 50225 || 
     1025            codepage == 50227 || codepage == 50229 || 
     1026            codepage == 52936 || codepage == 54936 || 
     1027            (codepage >= 57002 && codepage <= 57011) || 
     1028            codepage == 65000 || codepage == 42) ? 0 : MB_ERR_INVALID_CHARS; 
    9941029} 
    9951030 
     
    10031038 */ 
    10041039static int 
    1005 must_use_null_useddefaultchar(int codepage) { 
     1040must_use_null_useddefaultchar(int codepage) 
     1041{ 
    10061042    return (codepage == 65000 || codepage == 65001 || 
    10071043            codepage == 50220 || codepage == 50221 || 
     
    10141050 
    10151051static char * 
    1016 strrstr(const char *str, const char *token) { 
     1052strrstr(const char *str, const char *token) 
     1053{ 
    10171054    int len = strlen(token); 
    10181055    const char *p = str + strlen(str); 
     
    10251062 
    10261063static char * 
    1027 xstrndup(const char *s, size_t n) { 
     1064xstrndup(const char *s, size_t n) 
     1065{ 
    10281066    char *p; 
    10291067 
     
    10371075 
    10381076static int 
    1039 seterror(int err) { 
     1077seterror(int err) 
     1078{ 
    10401079    errno = err; 
    10411080    return -1; 
     
    10441083#if defined(USE_LIBICONV_DLL) 
    10451084static int 
    1046 libiconv_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) { 
     1085libiconv_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode) 
     1086{ 
    10471087    HMODULE hlibiconv = NULL; 
    10481088    HMODULE hmsvcrt = NULL; 
     
    10611101        p = DEFAULT_LIBICONV_DLL; 
    10621102    /* parse comma separated value */ 
    1063     for ( ; *p != 0; p = (*e == ',') ? e + 1 : e) { 
     1103    for ( ; *p != 0; p = (*e == ',') ? e + 1 : e) 
     1104    { 
    10641105        e = strchr(p, ','); 
    10651106        if (p == e) 
     
    10721113        hlibiconv = LoadLibrary(dllname); 
    10731114        free(dllname); 
    1074         if (hlibiconv != NULL) { 
    1075             if (hlibiconv == hwiniconv) { 
     1115        if (hlibiconv != NULL) 
     1116        { 
     1117            if (hlibiconv == hwiniconv) 
     1118            { 
    10761119                FreeLibrary(hlibiconv); 
    10771120                hlibiconv = NULL; 
     
    11301173#define TO_NT_HEADERS(base) ((PIMAGE_NT_HEADERS)((LPBYTE)(base) + TO_DOS_HEADER(base)->e_lfanew)) 
    11311174static PVOID 
    1132 MyImageDirectoryEntryToData(LPVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size) { 
     1175MyImageDirectoryEntryToData(LPVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size) 
     1176{ 
    11331177    /* TODO: MappedAsImage? */ 
    11341178    PIMAGE_DATA_DIRECTORY p; 
    11351179    p = TO_NT_HEADERS(Base)->OptionalHeader.DataDirectory + DirectoryEntry; 
    11361180    if (p->VirtualAddress == 0) { 
    1137         *Size = 0; 
    1138         return NULL; 
     1181      *Size = 0; 
     1182      return NULL; 
    11391183    } 
    11401184    *Size = p->Size; 
     
    11431187 
    11441188static HMODULE 
    1145 find_imported_module_by_funcname(HMODULE hModule, const char *funcname) { 
     1189find_imported_module_by_funcname(HMODULE hModule, const char *funcname) 
     1190{ 
    11461191    DWORD Base; 
    11471192    ULONG Size; 
     
    11521197    Base = (DWORD)hModule; 
    11531198    Imp = MyImageDirectoryEntryToData( 
    1154               (LPVOID)Base, 
    1155               TRUE, 
    1156               IMAGE_DIRECTORY_ENTRY_IMPORT, 
    1157               &Size); 
     1199            (LPVOID)Base, 
     1200            TRUE, 
     1201            IMAGE_DIRECTORY_ENTRY_IMPORT, 
     1202            &Size); 
    11581203    if (Imp == NULL) 
    11591204        return NULL; 
    1160     for ( ; Imp->OriginalFirstThunk != 0; ++Imp) { 
     1205    for ( ; Imp->OriginalFirstThunk != 0; ++Imp) 
     1206    { 
    11611207        Name = (PIMAGE_THUNK_DATA)(Base + Imp->OriginalFirstThunk); 
    1162         for ( ; Name->u1.Ordinal != 0; ++Name) { 
    1163             if (!IMAGE_SNAP_BY_ORDINAL(Name->u1.Ordinal)) { 
     1208        for ( ; Name->u1.Ordinal != 0; ++Name) 
     1209        { 
     1210            if (!IMAGE_SNAP_BY_ORDINAL(Name->u1.Ordinal)) 
     1211            { 
    11641212                ImpName = (PIMAGE_IMPORT_BY_NAME) 
    1165                           (Base + (DWORD)Name->u1.AddressOfData); 
     1213                    (Base + (DWORD)Name->u1.AddressOfData); 
    11661214                if (strcmp((char *)ImpName->Name, funcname) == 0) 
    11671215                    return GetModuleHandle((char *)(Base + Imp->Name)); 
     
    11741222 
    11751223static int 
    1176 sbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) { 
     1224sbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) 
     1225{ 
    11771226    return 1; 
    11781227} 
    11791228 
    11801229static int 
    1181 dbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) { 
     1230dbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) 
     1231{ 
    11821232    int len = IsDBCSLeadByteEx(cv->codepage, buf[0]) ? 2 : 1; 
    11831233    if (bufsize < len) 
     
    11871237 
    11881238static int 
    1189 mbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) { 
     1239mbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize) 
     1240{ 
    11901241    int len = 0; 
    11911242 
    11921243    if (cv->codepage == 54936) { 
    1193         if (buf[0] <= 0x7F) len = 1; 
    1194         else if (buf[0] >= 0x81 && buf[0] <= 0xFE && 
    1195                  bufsize >= 2 && 
    1196                  ((buf[1] >= 0x40 && buf[1] <= 0x7E) || 
    1197                   (buf[1] >= 0x80 && buf[1] <= 0xFE))) len = 2; 
    1198         else if (buf[0] >= 0x81 && buf[0] <= 0xFE && 
    1199                  bufsize >= 4 && 
    1200                  buf[1] >= 0x30 && buf[1] <= 0x39) len = 4; 
    1201         else 
    1202             return seterror(EINVAL); 
    1203         return len; 
    1204     } else 
    1205         return seterror(EINVAL); 
    1206 } 
    1207  
    1208 static int 
    1209 utf8_mblen(csconv_t *cv, const uchar *buf, int bufsize) { 
     1244        if (buf[0] <= 0x7F) len = 1; 
     1245        else if (buf[0] >= 0x81 && buf[0] <= 0xFE && 
     1246                 bufsize >= 2 && 
     1247                 ((buf[1] >= 0x40 && buf[1] <= 0x7E) || 
     1248                  (buf[1] >= 0x80 && buf[1] <= 0xFE))) len = 2; 
     1249        else if (buf[0] >= 0x81 && buf[0] <= 0xFE && 
     1250                 bufsize >= 4 && 
     1251                 buf[1] >= 0x30 && buf[1] <= 0x39) len = 4; 
     1252        else 
     1253            return seterror(EINVAL); 
     1254        return len; 
     1255    } 
     1256    else 
     1257        return seterror(EINVAL); 
     1258} 
     1259 
     1260static int 
     1261utf8_mblen(csconv_t *cv, const uchar *buf, int bufsize) 
     1262{ 
    12101263    int len = 0; 
    12111264 
     
    12251278 
    12261279static int 
    1227 eucjp_mblen(csconv_t *cv, const uchar *buf, int bufsize) { 
     1280eucjp_mblen(csconv_t *cv, const uchar *buf, int bufsize) 
     1281{ 
    12281282    if (buf[0] < 0x80) /* ASCII */ 
    12291283        return 1; 
    1230     else if (buf[0] == 0x8E) { /* JIS X 0201 */ 
     1284    else if (buf[0] == 0x8E) /* JIS X 0201 */ 
     1285    { 
    12311286        if (bufsize < 2) 
    12321287            return seterror(EINVAL); 
     
    12341289            return seterror(EILSEQ); 
    12351290        return 2; 
    1236     } else if (buf[0] == 0x8F) { /* JIS X 0212 */ 
     1291    } 
     1292    else if (buf[0] == 0x8F) /* JIS X 0212 */ 
     1293    { 
    12371294        if (bufsize < 3) 
    12381295            return seterror(EINVAL); 
    12391296        else if (!(0xA1 <= buf[1] && buf[1] <= 0xFE) 
    1240                  || !(0xA1 <= buf[2] && buf[2] <= 0xFE)) 
     1297                || !(0xA1 <= buf[2] && buf[2] <= 0xFE)) 
    12411298            return seterror(EILSEQ); 
    12421299        return 3; 
    1243     } else { /* JIS X 0208 */ 
     1300    } 
     1301    else /* JIS X 0208 */ 
     1302    { 
    12441303        if (bufsize < 2) 
    12451304            return seterror(EINVAL); 
    12461305        else if (!(0xA1 <= buf[0] && buf[0] <= 0xFE) 
    1247                  || !(0xA1 <= buf[1] && buf[1] <= 0xFE)) 
     1306                || !(0xA1 <= buf[1] && buf[1] <= 0xFE)) 
    12481307            return seterror(EILSEQ); 
    12491308        return 2; 
     
    12521311 
    12531312static int 
    1254 kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) { 
     1313kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
     1314{ 
    12551315    int len; 
    12561316 
     
    12591319        return -1; 
    12601320    *wbufsize = MultiByteToWideChar(cv->codepage, mbtowc_flags (cv->codepage), 
    1261                                     (const char *)buf, len, (wchar_t *)wbuf, *wbufsize); 
     1321            (const char *)buf, len, (wchar_t *)wbuf, *wbufsize); 
    12621322    if (*wbufsize == 0) 
    12631323        return seterror(EILSEQ); 
     
    12661326 
    12671327static int 
    1268 kernel_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) { 
     1328kernel_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) 
     1329{ 
    12691330    BOOL usedDefaultChar = 0; 
    12701331    BOOL *p = NULL; 
     
    12741335    if (bufsize == 0) 
    12751336        return seterror(E2BIG); 
    1276     if (!must_use_null_useddefaultchar(cv->codepage)) { 
     1337    if (!must_use_null_useddefaultchar(cv->codepage)) 
     1338    { 
    12771339        p = &usedDefaultChar; 
    12781340#ifdef WC_NO_BEST_FIT_CHARS 
     
    12821344    } 
    12831345    len = WideCharToMultiByte(cv->codepage, flags, 
    1284                               (const wchar_t *)wbuf, wbufsize, (char *)buf, bufsize, NULL, p); 
    1285     if (len == 0) { 
     1346            (const wchar_t *)wbuf, wbufsize, (char *)buf, bufsize, NULL, p); 
     1347    if (len == 0) 
     1348    { 
    12861349        if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) 
    12871350            return seterror(E2BIG); 
    12881351        return seterror(EILSEQ); 
    1289     } else if (usedDefaultChar) 
     1352    } 
     1353    else if (usedDefaultChar) 
    12901354        return seterror(EILSEQ); 
    12911355    else if (cv->mblen(cv, buf, len) != len) /* validate result */ 
     
    13031367 */ 
    13041368static int 
    1305 mlang_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) { 
     1369mlang_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
     1370{ 
    13061371    int len; 
    13071372    int insize; 
     
    13131378    insize = len; 
    13141379    hr = ConvertINetMultiByteToUnicode(&cv->mode, cv->codepage, 
    1315                                        (const char *)buf, &insize, (wchar_t *)wbuf, wbufsize); 
     1380            (const char *)buf, &insize, (wchar_t *)wbuf, wbufsize); 
    13161381    if (hr != S_OK || insize != len) 
    13171382        return seterror(EILSEQ); 
     
    13201385 
    13211386static int 
    1322 mlang_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) { 
     1387mlang_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) 
     1388{ 
    13231389    char tmpbuf[MB_CHAR_MAX]; /* enough room for one character */ 
    13241390    int tmpsize = MB_CHAR_MAX; 
     
    13271393 
    13281394    hr = ConvertINetUnicodeToMultiByte(&cv->mode, cv->codepage, 
    1329                                        (const wchar_t *)wbuf, &wbufsize, tmpbuf, &tmpsize); 
     1395            (const wchar_t *)wbuf, &wbufsize, tmpbuf, &tmpsize); 
    13301396    if (hr != S_OK || insize != wbufsize) 
    13311397        return seterror(EILSEQ); 
     
    13391405 
    13401406static int 
    1341 utf16_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) { 
     1407utf16_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
     1408{ 
    13421409    int codepage = cv->codepage; 
    13431410 
     
    13531420        wbuf[0] = (buf[0] << 8) | buf[1]; 
    13541421 
    1355     if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) { 
     1422    if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) 
     1423    { 
    13561424        cv->mode |= UNICODE_MODE_BOM_DONE; 
    1357         if (wbuf[0] == 0xFFFE) { 
     1425        if (wbuf[0] == 0xFFFE) 
     1426        { 
    13581427            cv->mode |= UNICODE_MODE_SWAPPED; 
    13591428            *wbufsize = 0; 
    13601429            return 2; 
    1361         } else if (wbuf[0] == 0xFEFF) { 
     1430        } 
     1431        else if (wbuf[0] == 0xFEFF) 
     1432        { 
    13621433            *wbufsize = 0; 
    13631434            return 2; 
     
    13671438    if (0xDC00 <= wbuf[0] && wbuf[0] <= 0xDFFF) 
    13681439        return seterror(EILSEQ); 
    1369     if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) { 
     1440    if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) 
     1441    { 
    13701442        if (bufsize < 4) 
    13711443            return seterror(EINVAL); 
     
    13841456 
    13851457static int 
    1386 utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) { 
    1387     if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) { 
     1458utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) 
     1459{ 
     1460    if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) 
     1461    { 
    13881462        int r; 
    13891463 
     
    14041478    if (bufsize < 2) 
    14051479        return seterror(E2BIG); 
    1406     if (cv->codepage == 1200) { /* little endian */ 
     1480    if (cv->codepage == 1200) /* little endian */ 
     1481    { 
    14071482        buf[0] = (wbuf[0] & 0x00FF); 
    14081483        buf[1] = (wbuf[0] & 0xFF00) >> 8; 
    1409     } else if (cv->codepage == 1201) { /* big endian */ 
     1484    } 
     1485    else if (cv->codepage == 1201) /* big endian */ 
     1486    { 
    14101487        buf[0] = (wbuf[0] & 0xFF00) >> 8; 
    14111488        buf[1] = (wbuf[0] & 0x00FF); 
    14121489    } 
    1413     if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) { 
     1490    if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF) 
     1491    { 
    14141492        if (bufsize < 4) 
    14151493            return seterror(E2BIG); 
    1416         if (cv->codepage == 1200) { /* little endian */ 
     1494        if (cv->codepage == 1200) /* little endian */ 
     1495        { 
    14171496            buf[2] = (wbuf[1] & 0x00FF); 
    14181497            buf[3] = (wbuf[1] & 0xFF00) >> 8; 
    1419         } else if (cv->codepage == 1201) { /* big endian */ 
     1498        } 
     1499        else if (cv->codepage == 1201) /* big endian */ 
     1500        { 
    14201501            buf[2] = (wbuf[1] & 0xFF00) >> 8; 
    14211502            buf[3] = (wbuf[1] & 0x00FF); 
     
    14271508 
    14281509static int 
    1429 utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) { 
     1510utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
     1511{ 
    14301512    int codepage = cv->codepage; 
    1431     uint wc; 
     1513    uint wc = 0; 
    14321514 
    14331515    /* swap endian: 12000 <-> 12001 */ 
     
    14421524        wc = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; 
    14431525 
    1444     if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) { 
     1526    if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) 
     1527    { 
    14451528        cv->mode |= UNICODE_MODE_BOM_DONE; 
    1446         if (wc == 0xFFFE0000) { 
     1529        if (wc == 0xFFFE0000) 
     1530        { 
    14471531            cv->mode |= UNICODE_MODE_SWAPPED; 
    14481532            *wbufsize = 0; 
    14491533            return 4; 
    1450         } else if (wc == 0x0000FEFF) { 
     1534        } 
     1535        else if (wc == 0x0000FEFF) 
     1536        { 
    14511537            *wbufsize = 0; 
    14521538            return 4; 
     
    14611547 
    14621548static int 
    1463 utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) { 
     1549utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) 
     1550{ 
    14641551    uint wc; 
    14651552 
    1466     if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) { 
     1553    if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE)) 
     1554    { 
    14671555        int r; 
    14681556 
     
    14841572        return seterror(E2BIG); 
    14851573    wc = utf16_to_ucs4(wbuf); 
    1486     if (cv->codepage == 12000) { /* little endian */ 
     1574    if (cv->codepage == 12000) /* little endian */ 
     1575    { 
    14871576        buf[0] = wc & 0x000000FF; 
    14881577        buf[1] = (wc & 0x0000FF00) >> 8; 
    14891578        buf[2] = (wc & 0x00FF0000) >> 16; 
    14901579        buf[3] = (wc & 0xFF000000) >> 24; 
    1491     } else if (cv->codepage == 12001) { /* big endian */ 
     1580    } 
     1581    else if (cv->codepage == 12001) /* big endian */ 
     1582    { 
    14921583        buf[0] = (wc & 0xFF000000) >> 24; 
    14931584        buf[1] = (wc & 0x00FF0000) >> 16; 
     
    15491640 
    15501641static int 
    1551 iso2022jp_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) { 
     1642iso2022jp_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
     1643{ 
    15521644    iso2022_esc_t *iesc = iso2022jp_esc; 
    15531645    char tmp[MB_CHAR_MAX]; 
     
    15611653    int i; 
    15621654 
    1563     if (buf[0] == 0x1B) { 
    1564         for (i = 0; iesc[i].esc != NULL; ++i) { 
     1655    if (buf[0] == 0x1B) 
     1656    { 
     1657        for (i = 0; iesc[i].esc != NULL; ++i) 
     1658        { 
    15651659            esc_len = iesc[i].esc_len; 
    1566             if (bufsize < esc_len) { 
     1660            if (bufsize < esc_len) 
     1661            { 
    15671662                if (strncmp((char *)buf, iesc[i].esc, bufsize) == 0) 
    15681663                    return seterror(EINVAL); 
    1569             } else { 
    1570                 if (strncmp((char *)buf, iesc[i].esc, esc_len) == 0) { 
     1664            } 
     1665            else 
     1666            { 
     1667                if (strncmp((char *)buf, iesc[i].esc, esc_len) == 0) 
     1668                { 
    15711669                    cv->mode = ISO2022_MODE(iesc[i].cs, ISO2022_SI); 
    15721670                    *wbufsize = 0; 
     
    15771675        /* not supported escape sequence */ 
    15781676        return seterror(EILSEQ); 
    1579     } else if (buf[0] == iso2022_SO_seq[0]) { 
     1677    } 
     1678    else if (buf[0] == iso2022_SO_seq[0]) 
     1679    { 
    15801680        cv->mode = ISO2022_MODE(ISO2022_MODE_CS(cv->mode), ISO2022_SO); 
    15811681        *wbufsize = 0; 
    15821682        return 1; 
    1583     } else if (buf[0] == iso2022_SI_seq[0]) { 
     1683    } 
     1684    else if (buf[0] == iso2022_SI_seq[0]) 
     1685    { 
    15841686        cv->mode = ISO2022_MODE(ISO2022_MODE_CS(cv->mode), ISO2022_SI); 
    15851687        *wbufsize = 0; 
     
    15911693 
    15921694    /* reset the mode for informal sequence */ 
    1593     if (buf[0] < 0x20) { 
     1695    if (buf[0] < 0x20) 
     1696    { 
    15941697        cs = ISO2022JP_CS_ASCII; 
    15951698        shift = ISO2022_SI; 
     
    16041707    esc_len = iesc[cs].esc_len; 
    16051708    memcpy(tmp, iesc[cs].esc, esc_len); 
    1606     if (shift == ISO2022_SO) { 
     1709    if (shift == ISO2022_SO) 
     1710    { 
    16071711        memcpy(tmp + esc_len, iso2022_SO_seq, 1); 
    16081712        esc_len += 1; 
     
    16111715 
    16121716    if ((cv->codepage == 50220 || cv->codepage == 50221 
    1613             || cv->codepage == 50222) && shift == ISO2022_SO) { 
     1717                || cv->codepage == 50222) && shift == ISO2022_SO) 
     1718    { 
    16141719        /* XXX: shift-out cannot be used for mbtowc (both kernel and 
    16151720         * mlang) */ 
     
    16211726    insize = len + esc_len; 
    16221727    hr = ConvertINetMultiByteToUnicode(&dummy, cv->codepage, 
    1623                                        (const char *)tmp, &insize, (wchar_t *)wbuf, wbufsize); 
     1728            (const char *)tmp, &insize, (wchar_t *)wbuf, wbufsize); 
    16241729    if (hr != S_OK || insize != len + esc_len) 
    16251730        return seterror(EILSEQ); 
     
    16391744 
    16401745static int 
    1641 iso2022jp_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) { 
     1746iso2022jp_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize) 
     1747{ 
    16421748    iso2022_esc_t *iesc = iso2022jp_esc; 
    16431749    char tmp[MB_CHAR_MAX]; 
     
    16591765     */ 
    16601766    hr = ConvertINetUnicodeToMultiByte(&dummy, cv->codepage, 
    1661                                        (const wchar_t *)wbuf, &wbufsize, tmp, &tmpsize); 
     1767            (const wchar_t *)wbuf, &wbufsize, tmp, &tmpsize); 
    16621768    if (hr != S_OK || insize != wbufsize) 
    16631769        return seterror(EILSEQ); 
     
    16651771        return seterror(E2BIG); 
    16661772 
    1667     if (tmpsize == 1) { 
     1773    if (tmpsize == 1) 
     1774    { 
    16681775        cs = ISO2022JP_CS_ASCII; 
    16691776        esc_len = 0; 
    1670     } else { 
    1671         for (i = 1; iesc[i].esc != NULL; ++i) { 
     1777    } 
     1778    else 
     1779    { 
     1780        for (i = 1; iesc[i].esc != NULL; ++i) 
     1781        { 
    16721782            esc_len = iesc[i].esc_len; 
    1673             if (strncmp(tmp, iesc[i].esc, esc_len) == 0) { 
     1783            if (strncmp(tmp, iesc[i].esc, esc_len) == 0) 
     1784            { 
    16741785                cs = iesc[i].cs; 
    16751786                break; 
     
    16821793 
    16831794    shift = ISO2022_SI; 
    1684     if (tmp[esc_len] == iso2022_SO_seq[0]) { 
     1795    if (tmp[esc_len] == iso2022_SO_seq[0]) 
     1796    { 
    16851797        shift = ISO2022_SO; 
    16861798        esc_len += 1; 
     
    16961808        return seterror(EILSEQ); 
    16971809 
    1698     if (cv->mode == ISO2022_MODE(cs, shift)) { 
     1810    if (cv->mode == ISO2022_MODE(cs, shift)) 
     1811    { 
    16991812        /* remove escape sequence */ 
    17001813        if (esc_len != 0) 
    17011814            memmove(tmp, tmp + esc_len, len); 
    17021815        esc_len = 0; 
    1703     } else { 
    1704         if (cs == ISO2022JP_CS_ASCII) { 
     1816    } 
     1817    else 
     1818    { 
     1819        if (cs == ISO2022JP_CS_ASCII) 
     1820        { 
    17051821            esc_len = iesc[ISO2022JP_CS_ASCII].esc_len; 
    17061822            memmove(tmp + esc_len, tmp, len); 
    17071823            memcpy(tmp, iesc[ISO2022JP_CS_ASCII].esc, esc_len); 
    17081824        } 
    1709         if (ISO2022_MODE_SHIFT(cv->mode) == ISO2022_SO) { 
     1825        if (ISO2022_MODE_SHIFT(cv->mode) == ISO2022_SO) 
     1826        { 
    17101827            /* shift-in before changing to other mode */ 
    17111828            memmove(tmp + 1, tmp, len + esc_len); 
     
    17231840 
    17241841static int 
    1725 iso2022jp_flush(csconv_t *cv, uchar *buf, int bufsize) { 
     1842iso2022jp_flush(csconv_t *cv, uchar *buf, int bufsize) 
     1843{ 
    17261844    iso2022_esc_t *iesc = iso2022jp_esc; 
    17271845    int esc_len; 
    17281846 
    1729     if (cv->mode != ISO2022_MODE(ISO2022JP_CS_ASCII, ISO2022_SI)) { 
     1847    if (cv->mode != ISO2022_MODE(ISO2022JP_CS_ASCII, ISO2022_SI)) 
     1848    { 
    17301849        esc_len = 0; 
    17311850        if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI) 
     
    17371856 
    17381857        esc_len = 0; 
    1739         if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI) { 
     1858        if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI) 
     1859        { 
    17401860            memcpy(buf, iso2022_SI_seq, 1); 
    17411861            esc_len += 1; 
    17421862        } 
    1743         if (ISO2022_MODE_CS(cv->mode) != ISO2022JP_CS_ASCII) { 
     1863        if (ISO2022_MODE_CS(cv->mode) != ISO2022JP_CS_ASCII) 
     1864        { 
    17441865            memcpy(buf + esc_len, iesc[ISO2022JP_CS_ASCII].esc, 
    1745                    iesc[ISO2022JP_CS_ASCII].esc_len); 
     1866                    iesc[ISO2022JP_CS_ASCII].esc_len); 
    17461867            esc_len += iesc[ISO2022JP_CS_ASCII].esc_len; 
    17471868        } 
     
    17531874#if defined(MAKE_DLL) && defined(USE_LIBICONV_DLL) 
    17541875BOOL WINAPI 
    1755 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { 
    1756     switch ( fdwReason ) { 
     1876DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) 
     1877{ 
     1878    switch( fdwReason ) 
     1879    { 
    17571880    case DLL_PROCESS_ATTACH: 
    17581881        hwiniconv = (HMODULE)hinstDLL; 
     
    17721895#include <io.h> 
    17731896int 
    1774 main(int argc, char **argv) { 
     1897main(int argc, char **argv) 
     1898{ 
    17751899    char *fromcode = NULL; 
    17761900    char *tocode = NULL; 
     
    17901914    _setmode(_fileno(stdout), _O_BINARY); 
    17911915 
    1792     for (i = 1; i < argc; ++i) { 
    1793         if (strcmp(argv[i], "-l") == 0) { 
     1916    for (i = 1; i < argc; ++i) 
     1917    { 
     1918        if (strcmp(argv[i], "-l") == 0) 
     1919        { 
    17941920            for (i = 0; codepage_alias[i].name != NULL; ++i) 
    17951921                printf("%s\n", codepage_alias[i].name); 
     
    18011927        else if (strcmp(argv[i], "-t") == 0) 
    18021928            tocode = argv[++i]; 
    1803         else { 
     1929        else 
     1930        { 
    18041931            in = fopen(argv[i], "rb"); 
    1805             if (in == NULL) { 
     1932            if (in == NULL) 
     1933            { 
    18061934                fprintf(stderr, "cannot open %s\n", argv[i]); 
    18071935                return 1; 
     
    18111939    } 
    18121940 
    1813     if (fromcode == NULL || tocode == NULL) { 
     1941    if (fromcode == NULL || tocode == NULL) 
     1942    { 
    18141943        printf("usage: %s -f from-enc -t to-enc [file]\n", argv[0]); 
    18151944        return 0; 
     
    18171946 
    18181947    cd = iconv_open(tocode, fromcode); 
    1819     if (cd == (iconv_t)(-1)) { 
     1948    if (cd == (iconv_t)(-1)) 
     1949    { 
    18201950        perror("iconv_open error"); 
    18211951        return 1; 
     
    18231953 
    18241954    while ((inbytesleft = fread(inbuf + rest, 1, sizeof(inbuf) - rest, in)) != 0 
    1825             || rest != 0) { 
     1955            || rest != 0) 
     1956    { 
    18261957        inbytesleft += rest; 
    18271958        pin = inbuf; 
     
    18301961        r = iconv(cd, &pin, &inbytesleft, &pout, &outbytesleft); 
    18311962        fwrite(outbuf, 1, sizeof(outbuf) - outbytesleft, stdout); 
    1832         if (r == (size_t)(-1) && errno != E2BIG && (errno != EINVAL || feof(in))) { 
     1963        if (r == (size_t)(-1) && errno != E2BIG && (errno != EINVAL || feof(in))) 
     1964        { 
    18331965            perror("conversion error"); 
    18341966            return 1; 
     
    18411973    r = iconv(cd, NULL, NULL, &pout, &outbytesleft); 
    18421974    fwrite(outbuf, 1, sizeof(outbuf) - outbytesleft, stdout); 
    1843     if (r == (size_t)(-1)) { 
     1975    if (r == (size_t)(-1)) 
     1976    { 
    18441977        perror("conversion error"); 
    18451978        return 1; 
  • lang/objective-cplusplus/i3/trunk/windows/i3_test.vcproj

    r35922 r36013  
    5454                                Optimization="0" 
    5555                                AdditionalIncludeDirectories="..\src\;&quot;..\src\gui-windows&quot;;..\src\mil\include;&quot;..\src\os-windows&quot;;&quot;..\src\os-windows\msvc&quot;" 
     56                                PreprocessorDefinitions="I3_TEST" 
    5657                                MinimalRebuild="true" 
    5758                                BasicRuntimeChecks="3" 
     
    146147                                EnableFiberSafeOptimizations="true" 
    147148                                AdditionalIncludeDirectories="..\src\;&quot;..\src\gui-windows&quot;;..\src\mil\include;&quot;..\src\os-windows&quot;;&quot;..\src\os-windows\msvc&quot;" 
     149                                PreprocessorDefinitions="I3_TEST" 
    148150                                StringPooling="true" 
    149151                                RuntimeLibrary="2" 
     
    232234                                Optimization="0" 
    233235                                AdditionalIncludeDirectories="..\src\;&quot;..\src\gui-windows&quot;;..\src\mil\include;&quot;..\src\os-windows&quot;;&quot;..\src\os-windows\msvc&quot;" 
     236                                PreprocessorDefinitions="I3_TEST" 
    234237                                MinimalRebuild="true" 
    235238                                BasicRuntimeChecks="3" 
     
    603606                        </File> 
    604607                        <File 
     608                                RelativePath="..\src\mil\src\test\Main.cpp" 
     609                                > 
     610                                <FileConfiguration 
     611                                        Name="Debug|Win32" 
     612                                        > 
     613                                        <Tool 
     614                                                Name="VCCLCompilerTool" 
     615                                                UsePrecompiledHeader="0" 
     616                                        /> 
     617                                </FileConfiguration> 
     618                        </File> 
     619                        <File 
    605620                                RelativePath="..\src\Mediator.cpp" 
    606621                                > 
     
    667682                        </File> 
    668683                        <File 
    669                                 RelativePath="..\src\mil\src\test\TestMain.cpp" 
    670                                 > 
    671                                 <FileConfiguration 
    672                                         Name="Debug|Win32" 
    673                                         > 
    674                                         <Tool 
    675                                                 Name="VCCLCompilerTool" 
    676                                                 UsePrecompiledHeader="0" 
    677                                         /> 
    678                                 </FileConfiguration> 
     684                                RelativePath="..\src\Tester.cpp" 
     685                                > 
    679686                        </File> 
    680687                        <File 
     
    819826                        </File> 
    820827                        <File 
     828                                RelativePath="..\src\Tester.h" 
     829                                > 
     830                        </File> 
     831                        <File 
    821832                                RelativePath="..\src\os-windows\Utf8ToUtf16Stream.h" 
    822833                                > 
     
    827838                        </File> 
    828839                </Filter> 
     840                <File 
     841                        RelativePath="..\src\gui-windows\OutputWindowPlatform.cpp" 
     842                        > 
     843                </File> 
    829844        </Files> 
    830845        <Globals> 
  • lang/objective-cplusplus/i3/trunk/windows/mil_test.vcproj

    r35836 r36013  
    965965                        </File> 
    966966                        <File 
     967                                RelativePath="..\src\mil\include\mil\os-windows\Debug.h" 
     968                                > 
     969                        </File> 
     970                        <File 
    967971                                RelativePath="..\src\mil\include\mil\Debug.h" 
    968972                                > 
    969973                        </File> 
    970974                        <File 
    971                                 RelativePath="..\src\mil\include\mil\os-windows\Debug.h" 
    972                                 > 
    973                         </File> 
    974                         <File 
    975975                                RelativePath="..\src\mil\include\mil\gui-windows\DummyMessageHandler-inl.h" 
    976976                                > 
     
    985985                        </File> 
    986986                        <File 
     987                                RelativePath="..\src\mil\include\mil\GuiModule.h" 
     988                                > 
     989                        </File> 
     990                        <File 
    987991                                RelativePath="..\src\mil\include\mil\gui-windows\GuiModule.h" 
    988992                                > 
    989993                        </File> 
    990994                        <File 
    991                                 RelativePath="..\src\mil\include\mil\GuiModule.h" 
    992                                 > 
    993                         </File> 
    994                         <File 
    995995                                RelativePath="..\src\mil\include\mil\Memory.h" 
    996996                                > 
     
    10211021                        </File> 
    10221022                        <File 
     1023                                RelativePath="..\src\mil\include\mil\os-windows\PrecompiledHeaders.h" 
     1024                                > 
     1025                        </File> 
     1026                        <File 
     1027                                RelativePath="..\src\mil\include\mil\PrecompiledHeaders.h" 
     1028                                > 
     1029                        </File> 
     1030                        <File 
    10231031                                RelativePath="..\src\mil\include\mil\gui-windows\PrecompiledHeaders.h" 
    10241032                                > 
    10251033                        </File> 
    10261034                        <File 
    1027                                 RelativePath="..\src\mil\include\mil\os-windows\PrecompiledHeaders.h" 
    1028                                 > 
    1029                         </File> 
    1030                         <File 
    1031                                 RelativePath="..\src\mil\include\mil\PrecompiledHeaders.h" 
    1032                                 > 
    1033                         </File> 
    1034                         <File 
    10351035                                RelativePath="..\src\mil\include\quicktest\quicktest.h" 
    10361036                                > 
     
    10531053                        </File> 
    10541054                        <File 
    1055                                 RelativePath="..\src\mil\src\Test.h" 
     1055                                RelativePath="..\src\mil\include\mil\Thread.h" 
    10561056                                > 
    10571057                        </File> 
    10581058                        <File 
    10591059                                RelativePath="..\src\mil\include\mil\os-windows\Thread.h" 
    1060                                 > 
    1061                         </File> 
    1062                         <File 
    1063                                 RelativePath="..\src\mil\include\mil\Thread.h" 
    10641060                                > 
    10651061                        </File> 
  • lang/objective-cplusplus/i3/trunk/windows/mingw.sh

    r35951 r36013  
    22 
    33export CFLAGS="-O3 -DNDEBUG -U_DEBUG -march=i486 -Wno-missing-field-initializers -Wno-unused-value -Wno-unused-parameter" 
    4 export CXXFLAGS="$CFLAGS"  
     4export CXXFLAGS="$CFLAGS" 
    55export LDFLAGS="-s" 
     6 
     7sh scripts/potfiles.sh 
    68 
    79./configure \ 
  • lang/objective-cplusplus/i3/trunk/windows/release.sh

    r35922 r36013  
    2525# ./configure --prefix=/usr/local/$CROSS_HOST --host=$CROSS_HOST --disable-shared && make && make install 
    2626 
     27sh scripts/potfiles.sh 
     28 
    2729./configure \ 
    2830    --host=$CROSS_HOST \