From b4243e23f2308e47f769ec82872275ab6be61857 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 29 Apr 2009 17:56:30 +0000 Subject: [PATCH] Fix all the compiler warnings when building with Visual C++ 2008. --- libdnet-stripped/include/dnet/os.h | 4 ++-- libdnet-stripped/libdnet-stripped.vcproj | 2 -- liblua/liblua.vcproj | 2 -- libpcre/libpcre.vcproj | 2 -- mswin32/nmap.vcproj | 2 +- output.cc | 5 +++-- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libdnet-stripped/include/dnet/os.h b/libdnet-stripped/include/dnet/os.h index 7fd2fad47..55a21b932 100644 --- a/libdnet-stripped/include/dnet/os.h +++ b/libdnet-stripped/include/dnet/os.h @@ -118,8 +118,8 @@ # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define __flexarr [] # elif defined(_WIN32) -/* MS VC++ */ -# define __flexarr [] +/* MS VC++ -- using [] works but gives a "nonstandard extension" warning */ +# define __flexarr [1] # else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] diff --git a/libdnet-stripped/libdnet-stripped.vcproj b/libdnet-stripped/libdnet-stripped.vcproj index fc43ea2f3..0198779d8 100755 --- a/libdnet-stripped/libdnet-stripped.vcproj +++ b/libdnet-stripped/libdnet-stripped.vcproj @@ -50,7 +50,6 @@ RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> diff --git a/libpcre/libpcre.vcproj b/libpcre/libpcre.vcproj index 9b6a391ba..225032387 100644 --- a/libpcre/libpcre.vcproj +++ b/libpcre/libpcre.vcproj @@ -47,7 +47,6 @@ RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="false" DebugInformationFormat="4" CompileAs="1" /> @@ -109,7 +108,6 @@ RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="false" DebugInformationFormat="3" CompileAs="1" /> diff --git a/mswin32/nmap.vcproj b/mswin32/nmap.vcproj index cf49f3b38..4548235cc 100644 --- a/mswin32/nmap.vcproj +++ b/mswin32/nmap.vcproj @@ -82,7 +82,7 @@ GenerateDebugInformation="true" ProgramDatabaseFile=".\Debug/nmap.pdb" SubSystem="1" - OptimizeForWindows98="1" + OptimizeForWindows98="0" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" diff --git a/output.cc b/output.cc index 8cac5e4dd..af1a92fd9 100644 --- a/output.cc +++ b/output.cc @@ -1322,15 +1322,16 @@ static void write_xml_initial_hostinfo(Target *currenths, /* Convert a number to a string, keeping the given number of significant digits. The result is returned in a static buffer. */ -static char *num_to_string_sigdigits(double d, unsigned int digits) { +static char *num_to_string_sigdigits(double d, int digits) { static char buf[32]; int shift; int n; + assert(digits >= 0); if (d == 0.0) { shift = -digits; } else { - shift = floor(log10(fabs(d))) - digits + 1; + shift = (int) floor(log10(fabs(d))) - digits + 1; d = floor(d / pow(10.0, shift) + 0.5); d = d * pow(10.0, shift); }