Changeset 365 for trunk/src/helpers


Ignore:
Timestamp:
May 26, 2008, 4:33:24 AM (17 years ago)
Author:
pr
Message:

Fix nlsUpper() for DBCS.
Make file handles code DBCS safe. Bug 1070.

Location:
trunk/src/helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/nls.c

    r349 r365  
    2222
    2323/*
    24  *      Copyright (C) 1997-2007 Ulrich M”ller.
     24 *      Copyright (C) 1997-2008 Ulrich M”ller.
    2525 *      This file is part of the "XWorkplace helpers" source package.
    2626 *      This is free software; you can redistribute it and/or modify
     
    729729    for (uss = 0;
    730730         uss < usLen;
    731          ++uss)
     731         uss++)
    732732    {
    733733        if (uss)
    734             if (0 == ((usLen - uss) % 3))
     734            if (((usLen - uss) % 3) == 0)
    735735            {
    736736                pszTarget[ust] = cThousands;
     
    11681168 *@@added V0.9.16 (2001-10-25) [umoeller]
    11691169 *@@changed V0.9.20 (2002-07-25) [umoeller]: speedup, changed prototype
     1170 *@@changed XWP V1.0.8 (2008-05-25) [pr]: rewritten for correct DBCS operation @@fixes 1070
    11701171 */
    11711172
    11721173ULONG nlsUpper(PSZ psz)            // in/out: string
    11731174{
     1175    BOOL        bDBCSType = TYPE_SBCS;
    11741176    ULONG   ul = 0;
    1175     PSZ     p;
     1177    PSZ     p = psz;
    11761178
    11771179    if (!G_fUpperMapInited)
    11781180        InitUpperMap();
    11791181
    1180     if (p = psz)
    1181     {
    1182         while (*p++ = G_szUpperMap[*p])
    1183             ++ul;
     1182    for (; p && *p; p++, ul++)
     1183    {
     1184        switch(bDBCSType)
     1185        {
     1186            case TYPE_SBCS:
     1187            case TYPE_DBCS_2ND:
     1188                bDBCSType = G_afLeadByte[*p];
     1189            break;
     1190
     1191            case TYPE_DBCS_1ST :
     1192                bDBCSType = TYPE_DBCS_2ND;
     1193            break;
     1194        }
     1195
     1196        if (bDBCSType == TYPE_SBCS)
     1197            *p = G_szUpperMap[*p];
    11841198    }
    11851199
     
    11871201}
    11881202
    1189 
  • trunk/src/helpers/wphandle.c

    r302 r365  
    2424
    2525/*
    26  *      This file Copyright (C) 1997-2005 Ulrich M”ller,
     26 *      This file Copyright (C) 1997-2008 Ulrich M”ller,
    2727 *      This file is part of the "XWorkplace helpers" source package.
    2828 *      This is free software; you can redistribute it and/or modify
     
    279279 *
    280280 *@@added V0.9.16 (2001-10-02) [umoeller]
    281  *@@changted V0.9.17 (2002-02-05) [umoeller]: added fQuitOnErrors
     281 *@@changed V0.9.17 (2002-02-05) [umoeller]: added fQuitOnErrors
     282 *@@changed XWP V1.0.8 (2008-05-25) [pr]: made DBCS safe @@fixes 1070
    282283 */
    283284
     
    317318
    318319                // upper the node name for string comparisons
    319                 strupr(pDriv->szName);
     320                nlsUpper(pDriv->szName);  // V1.0.8 (2008-05-25)
    320321
    321322                // create a drive tree node
     
    347348
    348349                // upper the node name for string comparisons
    349                 strupr(pNode->szName);
     350                nlsUpper(pNode->szName);  // V1.0.8 (2008-05-25)
    350351
    351352                // create a node tree node
     
    643644 *
    644645 *@@changed V0.9.16 (2001-10-19) [umoeller]: rewritten
     646 *@@changed V1.0.8 (2008-05-25) [pr]: made DBCS safe @@fixes 1070
    645647 */
    646648
     
    681683                    pEnd = NULL;
    682684
    683             strupr(pszFilename);
     685            nlsUpper(pszFilename);  // V1.0.8 (2008-05-25)
    684686
    685687            // 1) OK, find the drive.
Note: See TracChangeset for help on using the changeset viewer.