axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Hsiung (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2C-1367) sprintf format I32d not supported by Visual C++ 6.0
Date Fri, 08 May 2009 13:55:46 GMT
sprintf format I32d not supported by Visual C++ 6.0
---------------------------------------------------

                 Key: AXIS2C-1367
                 URL: https://issues.apache.org/jira/browse/AXIS2C-1367
             Project: Axis2-C
          Issue Type: Bug
          Components: code generation
    Affects Versions: 1.4.0, 1.4.1, 1.5.0, 1.6.0
         Environment: Microsoft Windows
Visual C++ 6.0
            Reporter: Eric Hsiung


The following are defined in axutil_utils_defines.h:

#if defined(WIN32)
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%I64d"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%I64u"
#define AXIS2_PRINTF_INT32_FORMAT_SPECIFIER "%I32d"
#define AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER "%I32u"
#else
#if __WORDSIZE == 64
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%ld"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%lu"
#else
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%lld"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%llu"
#endif
#define AXIS2_PRINTF_INT32_FORMAT_SPECIFIER "%d"
#define AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER "%u"
#endif

Microsoft Visual C++ 6.0 does not support I32 in the format string (though it does support
I64).
sprintf(szBuf, AXIS2_PRINTF_INT32_FORMAT_SPECIFIER, 123456) yields the string "I32d".
This of course leads to invalid SOAP messages and various errors.

The fix is to use _MSC_VER to conditionally compile different format strings for VC++6 versus
later versions of VC++ (which do support I32) like this:

#if defined(WIN32)
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%I64d"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%I64u"
#if _MSC_VER > 1200
#define AXIS2_PRINTF_INT32_FORMAT_SPECIFIER "%I32d"
#define AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER "%I32u"
#else
#define AXIS2_PRINTF_INT32_FORMAT_SPECIFIER "%d"
#define AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER "%u"
#endif
#else
#if __WORDSIZE == 64
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%ld"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%lu"
#else
#define AXIS2_PRINTF_INT64_FORMAT_SPECIFIER "%lld"
#define AXIS2_PRINTF_UINT64_FORMAT_SPECIFIER "%llu"
#endif
#define AXIS2_PRINTF_INT32_FORMAT_SPECIFIER "%d"
#define AXIS2_PRINTF_UINT32_FORMAT_SPECIFIER "%u"
#endif

AXIS2C-1295 seems to be referring to this problem as well.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message