Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

  1. /****************************Module*Header***********************************\
  2. * Module Name: UNIFUNC.C
  3. *
  4. * Module Descripton: Number to string conversion routines for Unicode
  5. *
  6. * Warnings:
  7. *
  8. * Created: 22-Aug-1995
  9. *
  10. * Author: JonPa
  11. \****************************************************************************/
  12. #include <windows.h>
  13. #include "scicalc.h"
  14. #define CCH_DWORD 15 // enough for 9 chars in 2^32 + sign, zterm + slop
  15. //
  16. // NOTE!
  17. //
  18. // Even though this function uses psz++ and psz--,
  19. // **IT IS STILL INTERNATIONAL SAFE!**
  20. //
  21. // That is because we put the chars in the string, and
  22. // we are only ever using chars that are single byte in ALL
  23. // code pages ('0'..'9').
  24. //
  25. TCHAR *UToDecT( UINT value, TCHAR *sz) {
  26. TCHAR szTmp[CCH_DWORD];
  27. LPTSTR psz = szTmp;
  28. LPTSTR pszOut;
  29. do {
  30. *psz++ = TEXT('0') + (value % 10);
  31. value = value / 10;
  32. } while( value != 0 );
  33. for( psz--, pszOut = sz; psz >= szTmp; psz-- )
  34. *pszOut++ = *psz;
  35. *pszOut = TEXT('\0');
  36. return sz;
  37. }