[Ace-users] [ace-bugs] ACE_Log_Msg: '%C' assumes wchar_t arg in ACE_USES_WCHAR builds
Russell Mora
russell_mora at symantec.com
Fri Mar 7 19:38:13 CST 2008
ACE VERSION: 5.4.8
(Yes, I know this is ancient, but I check the SVN and the code has not
changed)
HOST MACHINE and OPERATING SYSTEM:
If on Windows based OS's, which version of WINSOCK do you
use?:
Windows
TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
COMPILER NAME AND VERSION (AND PATCHLEVEL):
VS2008
THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
specific file, simply state which one]:
Uses config-win32-msvc-8.h with ACE_USES_WCHAR defined
THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
use a link to a platform-specific file, simply state which one
(unless this isn't used in this case, e.g., with Microsoft Visual
C++)]:
CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
(used by MPC when you generate your own makefiles):
AREA/CLASS/EXAMPLE AFFECTED:
[What example failed? What module failed to compile?]
DOES THE PROBLEM AFFECT:
COMPILATION?
LINKING?
On Unix systems, did you run make realclean first?
EXECUTION?
Executation would be affected - this was noticed by code inspection
OTHER (please specify)?
[Please indicate whether ACE, your application, or both are affected.]
SYNOPSIS:
[Brief description of the problem]
ACE_Log_Msg '%C' output format option assumes arg is a wchar_t string
when ACE_USES_WCHAR is set.
DESCRIPTION:
[Detailed description of problem. Don't just say "<blah>
doesn't work, here's a fix," explain what your program does
to get to the <blah> state. ]
ACE_Log_Msg supports a '%C' output format option which (supposedly)
outputs a char string - it even uses the '%S' output format option on
windows when ACE_USES_WCHAR is set, which causes wprintf and friends to
output a char string
(http://msdn2.microsoft.com/en-us/library/hf4y5e3w(VS.71).aspx).
Whilst inspecting the code, however, I noticed that the arg is being
cast to a ACE_TCHAR, which will be wchar_t when ACE_USES_WCHAR is set,
rather than a char. This seems wrong to me....
REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible. ]
Code inspection.
SAMPLE FIX/WORKAROUND:
[If available ]
Change the
ACE_TCHAR *cstr = va_arg (argp, ACE_TCHAR *);
To a:
char *cstr = va_arg (argp, char *);
More information about the Ace-users
mailing list