/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afs/stds.h>
}
+#include <windows.h>
+#include <windowsx.h>
#include <WINNT/talocale.h>
#include <stdlib.h>
va_list arg;
//if (pszFormat != NULL)
va_start (arg, pszFormat);
- vFormatMultiString (ppszTarget, fAddHead, (LONG)pszTemplate, pszFormat, arg);
+ vFormatMultiString (ppszTarget, fAddHead, PtrToLong(pszTemplate), pszFormat, arg);
}
void cdecl FormatMultiString (LPTSTR *ppszTarget, BOOL fAddHead, int idsTemplate, LPCTSTR pszFormat, ...)
void cdecl vFormatMultiString (LPTSTR *ppszTarget, BOOL fAddHead, LPCTSTR pszTemplate, LPCTSTR pszFormat, va_list arg)
{
- vFormatMultiString (ppszTarget, fAddHead, (LONG)pszTemplate, pszFormat, arg);
+ vFormatMultiString (ppszTarget, fAddHead, PtrToLong(pszTemplate), pszFormat, arg);
}
void cdecl vFormatMultiString (LPTSTR *ppszTarget, BOOL fAddHead, int idsTemplate, LPCTSTR pszFormat, va_list arg)
va_list arg;
//if (pszFmt != NULL)
va_start (arg, pszFmt);
- return vFormatString ((LONG)psz, pszFmt, arg);
+ return vFormatString (PtrToLong(psz), pszFmt, arg);
}
LPTSTR cdecl FormatString (int ids, LPCTSTR pszFmt, ...)
LPTSTR cdecl vFormatString (LPCTSTR psz, LPCTSTR pszFmt, va_list arg)
{
- return vFormatString ((LONG)psz, pszFmt, arg);
+ return vFormatString (PtrToLong(psz), pszFmt, arg);
}
LPTSTR cdecl vFormatString (int ids, LPCTSTR pszFmt, va_list arg)
LPTSTR pszOut = NULL;
LPTSTR pchOut;
LPTSTR pszTemplate;
- LONG cch;
+ size_t cch;
int nArgs;
int argno;
TCHAR szFmt[ cchRESOURCE ];
if (HIWORD(pszSource) != 0) // It's a string
{
- pszTemplate = (LPTSTR)pszSource;
+ pszTemplate = (LPTSTR)LongToPtr(pszSource);
}
else // It's a message
{
- cch = GetStringLength ((int)pszSource);
+ cch = GetStringLength((INT)pszSource);
if ((pszTemplate = AllocateString (1+cch)) == NULL)
return NULL;
- GetString (pszTemplate, (int)pszSource, cch);
+ GetString (pszTemplate, (int)pszSource, (INT)cch);
}
//
if (apszArgs == NULL)
{
- if (pszSource != (LONG)pszTemplate)
+ if (pszSource != PtrToLong(pszTemplate))
FreeString (pszTemplate);
return NULL;
}
for (argno = 0; pszFmt && *pszFmt; argno++)
{
- LONG cchMin;
+ size_t cchMin;
vartype vt;
double arg_f;
if ((psz = (LPTSTR)lstrchr (&szFmt[1], TEXT('%'))) != NULL)
*psz = 0;
- for (int ii = 1; szFmt[ii] == TEXT('-') || szFmt[ii] == TEXT(','); ii++)
+ int ii;
+ for (ii = 1; szFmt[ii] == TEXT('-') || szFmt[ii] == TEXT(','); ii++)
;
cchMin = _ttol (&szFmt[ii]);
cch = cchMaxNUMBER;
break;
- case vtSTRINGA:
+ case vtSTRINGA:
{
LPSTR arg_pszA = va_arg (arg, LPSTR);
break;
}
- case vtSTRINGW:
+ case vtSTRINGW:
{
LPWSTR arg_pszW = va_arg (arg, LPWSTR);
{
if ((arg_psz = AllocateString (cch)) == NULL)
goto lblDONE;
- GetString (arg_psz, arg_ids, cch);
+ GetString (arg_psz, arg_ids, (INT)cch);
}
cch = lstrlen(arg_psz);
lstrcpy (szTimeSep, TEXT(":"));
TCHAR szElapsed[ cchRESOURCE ];
- wsprintf (szElapsed, TEXT("%02lu%s%02lu%s%02lu"),
+ wsprintf (szElapsed, TEXT("%02lu%s%02lu%s%02lu"),
pst->wHour + (pst->wDay * 24),
szTimeSep,
pst->wMinute,
}
else
{
- GetTimeFormat (LOCALE_USER_DEFAULT, 0, <, NULL, szTime, cchRESOURCE);
- GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, <, NULL, szDate, cchRESOURCE);
+ GetTimeFormat (LOCALE_USER_DEFAULT, 0, <, TEXT("HH:mm:ss"), szTime, cchRESOURCE);
+ GetDateFormat (LOCALE_USER_DEFAULT, 0, <, TEXT("yyyy-MM-dd"), szDate, cchRESOURCE);
if (fShowTime && fShowDate)
{
- lstrcat (szTime, TEXT(" "));
- lstrcat (szTime, szDate);
+ lstrcat (szDate, TEXT(" "));
+ lstrcat (szDate, szTime);
}
- else if (fShowDate && !fShowTime)
+ else if (!fShowDate && fShowTime)
{
- lstrcpy (szTime, szDate);
+ lstrcpy (szDate, szTime);
}
}
- wsprintf (pszTarget, FixFormatString (pszFormatUser), szTime);
+ wsprintf (pszTarget, FixFormatString (pszFormatUser), szDate);
return rc;
}
{
lstrcpy (szFormat, pszFormatUser);
- for (LPTSTR pch = &szFormat[1]; *pch; ++pch)
+ LPTSTR pch;
+ for (pch = &szFormat[1]; *pch; ++pch)
{
if (!isfmtgarbage(*pch))
{
// Cheesy bit: if all we have are 0's and "."'s, just
// make the number read "0".
//
-
- for (TCHAR *pch = szJustTheNumber; *pch; ++pch)
+ TCHAR * pch;
+ for (pch = szJustTheNumber; *pch; ++pch)
{
if (*pch != TEXT('0') && *pch != TEXT('.'))
break;
UINT cpTarget = CP_ACP;
BOOL fDefault = FALSE;
- size_t cchOut = WideCharToMultiByte (cpTarget, 0, pszOriginalW, cchSource-1, pszTargetA, cchMax * 2, TEXT(" "), &fDefault);
+ size_t cchOut = WideCharToMultiByte (cpTarget, 0, pszOriginalW, (INT)cchSource-1, pszTargetA, (INT)cchMax * 2, " ", &fDefault);
pszTargetA[ cchOut ] = 0;
}
LPTSTR pszTarget;
if ((pszTarget = AllocateString (1+lstrlenW(pszOriginalW))) != NULL) {
#ifdef UNICODE
- lstrcpyW ((LPWSTR)pszTargetW, (LPWSTR)pszOriginal);
+ lstrcpyW ((LPWSTR)pszTarget, (LPWSTR)pszOriginalW);
#else
CopyUnicodeToAnsi (pszTarget, pszOriginalW);
#endif
{
lstrcpy (szFormat, pszFormat);
- for (LPTSTR pch = &szFormat[1]; *pch; ++pch)
+ LPTSTR pch;
+ for (pch = &szFormat[1]; *pch; ++pch)
{
if (!isfmtgarbage(*pch))
{