From 0d71c438ab646dc75dd6a94bbd04bf2eb0f09e9e Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Sun, 15 Oct 2006 09:33:54 +0000 Subject: [PATCH] add missing unsigned long overload for Windows git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@716 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/SafeFormat.h | 11 +++++++++-- test/SafeFormat/main.cpp | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/loki/SafeFormat.h b/include/loki/SafeFormat.h index 5ec7860..3263dbf 100755 --- a/include/loki/SafeFormat.h +++ b/include/loki/SafeFormat.h @@ -33,6 +33,7 @@ // long is 32 bit on 64-bit Windows! +// intptr_t used to get 64 bit on Win64 #if defined(_WIN32) || defined(_WIN64) #define LOKI_SAFEFORMAT_SIGNED_LONG intptr_t @@ -106,10 +107,13 @@ namespace Loki LOKI_PRINTF_STATE_FORWARD(signed short) LOKI_PRINTF_STATE_FORWARD(unsigned short) LOKI_PRINTF_STATE_FORWARD(signed int) -#if !(defined(_WIN32) || defined(_WIN64)) + LOKI_PRINTF_STATE_FORWARD(signed long) +#if (defined(_WIN32) || defined(_WIN64)) + LOKI_PRINTF_STATE_FORWARD(unsigned long) +#else + // on Windows already defined by uintptr_t LOKI_PRINTF_STATE_FORWARD(unsigned int) #endif - LOKI_PRINTF_STATE_FORWARD(signed long) // Print (or gobble in case of the "*" specifier) an int PrintfState& operator()(LOKI_SAFEFORMAT_UNSIGNED_LONG i) { @@ -586,6 +590,9 @@ namespace Loki #endif //SAFEFORMAT_H_ // $Log$ +// Revision 1.29 2006/10/15 09:33:54 syntheticpp +// add missing unsigned long overload for Windows +// // Revision 1.28 2006/07/06 18:25:28 syntheticpp // add writing to ostream, by Tom Browder // diff --git a/test/SafeFormat/main.cpp b/test/SafeFormat/main.cpp index c8a75ec..9cda12f 100755 --- a/test/SafeFormat/main.cpp +++ b/test/SafeFormat/main.cpp @@ -239,3 +239,21 @@ int main(int argc, char** argv) } } } + +void test_dword() +{ + typedef signed int Int; + typedef unsigned int UInt; + typedef signed long Long; + typedef unsigned long ULong; + Int i(0); + UInt ui(0); + Long l(0); + ULong ul(0); + Printf("%d")(i); + Printf("%d")(ui); + Printf("%d")(l); + Printf("%d")(ul); +} + +