added 5 changesets to branch 'refs/remotes/xyzzy-github/x86_64' old head: f3780ae8b2dcd5ae3b30bb9c4ffc36cbac58f3fe new head: dcd705cdedbf171ff19380417756ec42f7f6789f ---------------------------------------------------------------------------- 3ab9de3: CID 714425: Operands don't affect result. Result of a call to strtoul was stored in a uint32, then checked against ULONG_MAX for error. If long is 64 bits, the error check will never be true. d339b83: CID 712424: Unintended sign extension. Fix taken from glibc, glibc bug #3747. f16cf07: CID 714526: Operands don't affect result. Incorrect check of in_addr_t (uint32_t) against (unsigned long)-1 would never be true. 423d8df: CID 714424: Operands don't affect result. Storing size_t result of std::string::find_first_of in a uint32 then checking against std::string::npos would never be true. dcd705c: CID 715610: Operands don't affect result. Comparing a uint32 against ~0UL would always be false on 64-bit. [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- 5 files changed, 6 insertions(+), 6 deletions(-) src/add-ons/translators/raw/RAW.cpp | 2 +- src/kits/network/libnetapi/NetAddress.cpp | 2 +- src/kits/storage/mime/database_support.cpp | 2 +- src/servers/registrar/TRoster.cpp | 2 +- src/system/libroot/posix/glibc/stdlib/jrand48_r.c | 4 ++-- ############################################################################ Commit: 3ab9de3b68e5845cc4225f943e4fb93a7a8d98b3 Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sat Aug 18 12:39:37 2012 UTC CID 714425: Operands don't affect result. Result of a call to strtoul was stored in a uint32, then checked against ULONG_MAX for error. If long is 64 bits, the error check will never be true. ---------------------------------------------------------------------------- diff --git a/src/servers/registrar/TRoster.cpp b/src/servers/registrar/TRoster.cpp index 5b34d55..b3276b0 100644 --- a/src/servers/registrar/TRoster.cpp +++ b/src/servers/registrar/TRoster.cpp @@ -1934,7 +1934,7 @@ TRoster::_LoadRosterSettings(const char* path) char app[B_PATH_NAME_LENGTH]; char rank[B_PATH_NAME_LENGTH]; entry_ref ref; - uint32 index = 0; + ulong index = 0; // Convert the given path to an entry ref streamError = stream.GetString(path); ############################################################################ Commit: d339b8398c3871f8c923979a4f5ae1c534d61a07 Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sat Aug 18 12:52:10 2012 UTC Ticket: https://dev.haiku-os.org/ticket/3747 CID 712424: Unintended sign extension. Fix taken from glibc, glibc bug #3747. ---------------------------------------------------------------------------- diff --git a/src/system/libroot/posix/glibc/stdlib/jrand48_r.c b/src/system/libroot/posix/glibc/stdlib/jrand48_r.c index 2383ae1..39e8d09 100644 --- a/src/system/libroot/posix/glibc/stdlib/jrand48_r.c +++ b/src/system/libroot/posix/glibc/stdlib/jrand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998, 2001, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@xxxxxxxxxxxxxx>, August 1995. @@ -30,7 +30,7 @@ __jrand48_r (xsubi, buffer, result) return -1; /* Store the result. */ - *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl; + *result = (int32_t) ((xsubi[2] << 16) | xsubi[1]); return 0; } ############################################################################ Commit: f16cf073d5b83dfcfe7f47b31943eab3db4284f1 Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sat Aug 18 12:58:21 2012 UTC CID 714526: Operands don't affect result. Incorrect check of in_addr_t (uint32_t) against (unsigned long)-1 would never be true. ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/NetAddress.cpp b/src/kits/network/libnetapi/NetAddress.cpp index 6c4fdd3..734363c 100644 --- a/src/kits/network/libnetapi/NetAddress.cpp +++ b/src/kits/network/libnetapi/NetAddress.cpp @@ -346,7 +346,7 @@ BNetAddress::SetTo(const char* hostname, unsigned short port) // See if the string is an ASCII-fied IP address. addr = inet_addr(hostname); - if (addr == INADDR_ANY || addr == (unsigned long)-1) { + if (addr == INADDR_ANY || addr == (in_addr_t)-1) { // See if we can resolve the hostname to an IP address. struct hostent* host = gethostbyname(hostname); if (host != NULL) ############################################################################ Commit: 423d8dfed30eaaf5ae2563c1b9cbf7237805fe03 Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sat Aug 18 13:02:58 2012 UTC CID 714424: Operands don't affect result. Storing size_t result of std::string::find_first_of in a uint32 then checking against std::string::npos would never be true. ---------------------------------------------------------------------------- diff --git a/src/kits/storage/mime/database_support.cpp b/src/kits/storage/mime/database_support.cpp index 24add0c..750a5c0 100644 --- a/src/kits/storage/mime/database_support.cpp +++ b/src/kits/storage/mime/database_support.cpp @@ -191,7 +191,7 @@ open_or_create_type(const char *type, BNode *result, bool *didCreate) // Figure out what type of node we need to create // + Supertype == directory // + Non-supertype == file - uint32 pos = typeLower.find_first_of('/'); + size_t pos = typeLower.find_first_of('/'); if (pos == std::string::npos) { // Supertype == directory BDirectory parent(get_database_directory().c_str()); ############################################################################ Commit: dcd705cdedbf171ff19380417756ec42f7f6789f Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sat Aug 18 13:06:11 2012 UTC CID 715610: Operands don't affect result. Comparing a uint32 against ~0UL would always be false on 64-bit. ---------------------------------------------------------------------------- diff --git a/src/add-ons/translators/raw/RAW.cpp b/src/add-ons/translators/raw/RAW.cpp index 1757ade..7d5304d 100644 --- a/src/add-ons/translators/raw/RAW.cpp +++ b/src/add-ons/translators/raw/RAW.cpp @@ -3504,7 +3504,7 @@ DCRaw::Identify() if (fMeta.maximum == 0) fMeta.maximum = (1 << _Raw().bits_per_sample) - 1; - if (fFilters == ~0UL) + if (fFilters == ~(uint32)0) fFilters = 0x94949494; if (fFilters && fColors == 3) { for (int32 i = 0; i < 32; i += 4) {