Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#15670 closed defect (fixed)

wxString::Format() does not accept "%Iu" for size_t (in x64 builds only)

Reported by: laro Owned by:
Priority: normal Milestone:
Component: wxMSW Version: 3.0.0
Keywords: format specifier, strvararg.h, wxString::Format(), %I, size_t, SIZEOF_LONG_LONG, Arg_Size_t Cc:
Blocked By: Blocking:
Patch: yes

Description

Observation:
C:\wxWidgets\include\wx/strvararg.h(451): assert "(argtype & (wxFormatStringSpecifier<T>::value)) == argtype" failed in wxArgNormalizer<unsigned int64>::wxArgNormalizer(): format specifier doesn't match argument type

Call stack:

  • wxArgNormalizerWchar<unsigned int64>::wxArgNormalizerWchar<unsigned _int64> wx\strvararg.h:469
  • wxString::Format<unsigned int64> wx\string.h:2323

Fix:
Defined SIZEOF_LONG_LONG as 8 in defs.h and included "wx/defs.h" in strvararg.h, so the enum wxFormatString::ArgumentType defines Arg_Size_t (in x64-builds) as Arg_LongLongInt and not as a type of its own.

Attachments (1)

defs.h+strvararg.h.patch download (833 bytes) - added by laro 10 months ago.

Download all attachments as: .zip

Change History (3)

Changed 10 months ago by laro

comment:1 Changed 10 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [75206]) Define SIZEOF_LONG_LONG for Windows.

This is important not only for consistency with the other platforms but also
because without SIZEOF_LONG_LONG being defined, "%lu" format specifier can't
be used with size_t values under Win64, as Arg_Size_t is not defined correctly
there if SIZEOF_LONG_LONG is unknown.

Closes #15670.

comment:2 Changed 10 months ago by VZ

(In [75212]) Define SIZEOF_LONG_LONG for Windows.

This is important not only for consistency with the other platforms but also
because without SIZEOF_LONG_LONG being defined, "%lu" format specifier can't
be used with size_t values under Win64, as Arg_Size_t is not defined correctly
there if SIZEOF_LONG_LONG is unknown.

Closes #15670.

Note: See TracTickets for help on using tickets.