From 4963f5d35a77d134abf4230581d1687cbff7ee07 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 14 Mar 2010 17:24:08 +0000 Subject: [PATCH] - Meh. Linux does not have itoa. SVN r2211 (trunk) --- dumb/CMakeLists.txt | 7 +++++++ dumb/src/it/readpsm.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index 85cbaeb551..c2cbe8d1b2 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required( VERSION 2.4 ) +include( CheckFunctionExists ) + # DUMB is much slower in a Debug build than a Release build, so we force a Release # build here, since we're not maintaining DUMB, only using it. # Comment out the below line to allow Debug builds. @@ -13,6 +15,11 @@ if( CMAKE_COMPILER_IS_GNUC ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" ) endif( CMAKE_COMPILER_IS_GNUC ) +CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) +if( NOT ITOA_EXISTS ) + add_definitions( -DNEED_ITOA=1 ) +endif( NOT ITOA_EXISTS ) + include_directories( include ) add_library( dumb diff --git a/dumb/src/it/readpsm.c b/dumb/src/it/readpsm.c index 68d7ab7dc0..d6fc099c5e 100644 --- a/dumb/src/it/readpsm.c +++ b/dumb/src/it/readpsm.c @@ -1271,7 +1271,11 @@ DUH *DUMBEXPORT dumb_read_psm_quick(DUMBFILE *f, int subsong) if ( ver ) { tag[2][0] = "FORMATVERSION"; +#if NEED_ITOA + sprintf(version, "%d", ver); +#else itoa(ver, version, 10); +#endif tag[2][1] = (const char *) &version; ++n_tags; }