Ignore:
Timestamp:
May 30, 2011, 5:44:18 PM (14 years ago)
Author:
pr
Message:

Add nlsThousandsLong to fix signed/unsigned display error.

File:
1 edited

Legend:

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

    r386 r390  
    2222
    2323/*
    24  *      Copyright (C) 1997-2010 Ulrich M”ller.
     24 *      Copyright (C) 1997-2011 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
     
    762762
    763763/*
     764 *@@ nlsThousandsLong:
     765 *      signed version of above.
     766 *
     767 *@@added WarpIn V1.0.20 (2011-05-30) [pr]
     768 */
     769
     770PSZ nlsThousandsLong(PSZ pszTarget,       // out: decimal as string
     771                     LONG l,              // in: decimal to convert
     772                     CHAR cThousands)     // in: separator char (e.g. '.')
     773{
     774    CHAR    szTemp[30];
     775    USHORT  ust = 0,
     776            uss,
     777            usLen = sprintf(szTemp, "%ld", l);
     778
     779    for (uss = 0;
     780         uss < usLen;
     781         uss++)
     782    {
     783        if (uss)
     784            if (((usLen - uss) % 3) == 0)
     785            {
     786                pszTarget[ust] = cThousands;
     787                ust++;
     788            }
     789
     790        pszTarget[ust++] = szTemp[uss];
     791    }
     792
     793    pszTarget[ust] = '\0';
     794
     795    return pszTarget;
     796}
     797
     798/*
    764799 *@@ nlsThousandsDouble:
    765800 *      like nlsThousandsULong, but for a "double"
Note: See TracChangeset for help on using the changeset viewer.