Changeset 365 for branches


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:
branches/branch-1-0/src/helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1-0/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
     
    178178                     ++n)
    179179                    G_afLeadByte[n] = TRUE;
     180
    180181                G_fDBCS = TRUE;
    181182            }
     
    586587                ust++;
    587588            }
    588         pszTarget[ust] = szTemp[uss];
    589         ust++;
     589        pszTarget[ust++] = szTemp[uss];
    590590    }
    591591    pszTarget[ust] = '\0';
     
    917917
    918918    for (ul = 0;
    919          ul < sizeof(G_szUpperMap);
     919         ul < 256;
    920920         ++ul)
    921921    {
     
    964964 *@@added V0.9.16 (2001-10-25) [umoeller]
    965965 *@@changed V0.9.20 (2002-07-25) [umoeller]: speedup, changed prototype
     966 *@@changed XWP V1.0.8 (2008-05-25) [pr]: rewritten for correct DBCS operation @@fixes 1070
    966967 */
    967968
    968969ULONG nlsUpper(PSZ psz)            // in/out: string
    969970{
     971    BOOL        bDBCSType = TYPE_SBCS;
    970972    ULONG   ul = 0;
     973    PSZ     p = psz;
    971974
    972975    if (!G_fUpperMapInited)
    973976        InitUpperMap();
    974977
    975     if (psz)
    976     {
    977         PSZ     p = psz;
    978 
    979         while (*p++ = G_szUpperMap[*p])
    980             ++ul;
     978    for (; p && *p; p++, ul++)
     979    {
     980        switch(bDBCSType)
     981        {
     982            case TYPE_SBCS:
     983            case TYPE_DBCS_2ND:
     984                bDBCSType = G_afLeadByte[*p];
     985            break;
     986
     987            case TYPE_DBCS_1ST :
     988                bDBCSType = TYPE_DBCS_2ND;
     989            break;
     990        }
     991
     992        if (bDBCSType == TYPE_SBCS)
     993            *p = G_szUpperMap[*p];
    981994    }
    982995
     
    984997}
    985998
    986 
  • branches/branch-1-0/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.