Changeset 860


Ignore:
Timestamp:
Nov 10, 2007, 11:58:43 PM (18 years ago)
Author:
Gregg Young
Message:

Use the thousand separator from NLS Country info for file sizes. Repalce dir.ico & pmap.bmp with new versions from David

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/commafmt.c

    r859 r860  
    1313  25 May 05 SHL Add CommaFmtULL, CommaFmtUL
    1414  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     15  05 Nov 07 GKY Use commafmtULL to display file sizes for large file support
     16  10 Nov 07 GKY Get thousands separator from country info for file sizes.
    1517
    1618***********************************************************************/
    1719
    1820/*
    19    **  COMMAFMT.C
    20    **  Public domain by Bob Stout
    21    **
    22    **  Notes:  1. Use static buffer to eliminate error checks on buffer overflow
    23    **             and reduce code size.
    24    **          2. By making the numeric argument a long and prototyping it before
    25    **             use, passed numeric arguments will be implicitly cast to longs
    26    **             thereby avoiding int overflow.
    27    **          3. Use the thousands grouping and thousands separator from the
    28    **             ANSI locale to make this more robust.
     21 * COMMAFMT.C
     22 * Adapted from public domain code by Bob Stout
     23 *
     24 *         2. By making the numeric argument a long and prototyping it before
     25 *            use, passed numeric arguments will be implicitly cast to longs
     26 *            thereby avoiding int overflow.
     27 *         3. Use the thousands grouping and thousands separator from the
     28 *            ANSI locale to make this more robust.
    2929 */
    3030
     31#define INCL_WIN
    3132#define INCL_LONGLONG
    3233#include <os2.h>
     
    3536#include <stdio.h>
    3637#include <string.h>
     38#include "fm3dll.h"
    3739
    3840size_t commafmt(char *pszBuf,   // Output buffer
     
    5759
    5860  for (; cChars <= cBufSize; ++cChars, ++cDigits) {
    59     *pch-- = (CHAR) (lNumber % 10 + '0');
     61    *pch-- = (CHAR)(lNumber % 10 + '0');
    6062    lNumber /= 10;
    6163    if (!lNumber)
    6264      break;
    6365    if (cDigits % 3 == 0) {
    64       *pch-- = ',';
     66      *pch-- = *ThousandsSeparator;
    6567      ++cChars;
    6668    }
     
    8587}
    8688
    87 //=== CommaFmtULL: format long long number with commas and SI unit suffix ===
     89/**
     90 * Format long long number with commas and SI unit suffix
     91 * @param pszBuf Points to output buffer
     92 * @param cBufSize Buffer size including space for terminating nul
     93 * @param ullNumber Number to convert
     94 * @param chPreferred Preferred suffix, blank, K, M
     95 * @return size of formatting string excluding terminating nul
     96 */
    8897
    8998size_t CommaFmtULL(char *pszBuf,        // Output buffer
     
    109118  }
    110119
    111   c = commafmt(pszBuf, cBufSize, (LONG) ullNumber);
     120  c = commafmt(pszBuf, cBufSize, (LONG)ullNumber);
    112121
    113122  if (chSuffix != ' ') {
  • trunk/dll/fm3dll.h

    r856 r860  
    6363  01 Sep 07 GKY Add xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundary
    6464  04 Nov 07 GKY Add pszFmtFileSize to CNRITEM to display large file sizes
     65  10 Nov 07 GKY Add ThousandSeparator variable for file sizes NLS tseparator.
    6566
    6667***********************************************************************/
     
    13721373  hwndLED, hwndLEDHdr, hwndAutoMLE, hwndCmdlist;
    13731374DATADEF HBITMAP hbmLEDon, hbmLEDoff;
    1374 DATADEF CHAR ArcTempRoot[9];
     1375DATADEF CHAR ArcTempRoot[9], ThousandsSeparator[2];
    13751376DATADEF HPOINTER hptrArrow, hptrBusy, hptrLast, hptrDir, hptrFile, hptrRemote,
    13761377  hptrFloppy, hptrDrive, hptrRemovable, hptrCDROM,hptrVirtual,hptrRamdisk,
  • trunk/dll/init.c

    r856 r860  
    3636  25 Aug 07 SHL Work around DosSetPathInfo kernel defect
    3737  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
     38  10 Nov 07 GKY Get thousands separator from country info for file sizes.
    3839
    3940***********************************************************************/
     
    5354#define INCL_DOSERRORS
    5455#define INCL_LONGLONG
     56#define INCL_DOSNLS
    5557#include <os2.h>
    5658#include <os2me.h>
     
    941943  CollectorsortFlags = sortFlags = SORT_DIRSFIRST;
    942944
     945  //Get default Country info
     946  {
     947  COUNTRYCODE Country    = {0};
     948  ULONG ulInfoLen  = 0;
     949  COUNTRYINFO CtryInfo   = {0};
     950
     951  DosQueryCtryInfo(sizeof(CtryInfo), &Country,
     952                   &CtryInfo, &ulInfoLen);
     953  *ThousandsSeparator = CtryInfo.szThousandsSeparator[0];
     954  }
     955
    943956  // load preferences from profile (INI) file
    944957  size = sizeof(BOOL);
  • trunk/dll/misc.c

    r859 r860  
    3434  14 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
    3535  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
     36  05 Nov 07 GKY Use commafmtULL to display file sizes for large file support
    3637
    3738***********************************************************************/
Note: See TracChangeset for help on using the changeset viewer.