[Libreoffice-commits] .: 4 commits - tools/bootstrp tools/source

Tor Lillqvist tml at kemper.freedesktop.org
Tue Oct 4 00:28:26 PDT 2011


 tools/bootstrp/prj.cxx          |    2 +-
 tools/source/fsys/dirent.cxx    |    6 ++++++
 tools/source/generic/config.cxx |    6 +++---
 tools/source/stream/stream.cxx  |   16 +++++++++-------
 4 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit bee695a32d1bd6aad54372e3c6971b1067e35409
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Oct 4 10:25:32 2011 +0300

    WaE: potentially uninitialized local variable 'n' used

diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 4609e65..6cc226a 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1154,7 +1154,7 @@ sal_Size SvStream::SeekRel( sal_sSize nPos )
 
 SvStream& SvStream::operator>>(sal_uInt16& r)
 {
-    sal_uInt16 n;
+    sal_uInt16 n = 666;
     READNUMBER_WITHOUT_SWAP(sal_uInt16, n)
     if (good())
     {
@@ -1167,7 +1167,7 @@ SvStream& SvStream::operator>>(sal_uInt16& r)
 
 SvStream& SvStream::operator>>(sal_uInt32& r)
 {
-    sal_uInt32 n;
+    sal_uInt32 n = 42;
     READNUMBER_WITHOUT_SWAP(sal_uInt32, n)
     if (good())
     {
@@ -1181,7 +1181,7 @@ SvStream& SvStream::operator>>(sal_uInt32& r)
 
 SvStream& SvStream::operator>>(sal_uInt64& r)
 {
-    sal_uInt64 n;
+    sal_uInt64 n = 0xDEADCAFEBABE;
     READNUMBER_WITHOUT_SWAP(sal_uInt64, n)
     if (good())
     {
@@ -1200,7 +1200,7 @@ SvStream& SvStream::operator >>(long& r) //puke!, kill this
     if (good())
         r = n;
 #else
-    long n;
+    long n = 0; // Ran out of "fun" numbers
     READNUMBER_WITHOUT_SWAP(long, n)
     if (good())
     {
@@ -1214,7 +1214,7 @@ SvStream& SvStream::operator >>(long& r) //puke!, kill this
 
 SvStream& SvStream::operator>>(short& r)
 {
-    short n;
+    short n = 0;
     READNUMBER_WITHOUT_SWAP(short, n)
     if (good())
     {
@@ -1227,7 +1227,7 @@ SvStream& SvStream::operator>>(short& r)
 
 SvStream& SvStream::operator>>(int& r)
 {
-    int n;
+    int n = 0;
     READNUMBER_WITHOUT_SWAP(int, n)
     if (good())
     {
@@ -1287,7 +1287,7 @@ SvStream& SvStream::operator>>( unsigned char& r )
 
 SvStream& SvStream::operator>>(float& r)
 {
-    float n;
+    float n = 3.14159265358979323846f;
     READNUMBER_WITHOUT_SWAP(float, n)
     if (good())
     {
commit c963747ed858007967f83d0a1f67cdcc57b3d695
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Oct 4 10:16:29 2011 +0300

    WaE: unreferenced formal parameter

diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index ca3d004..4609e65 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1310,6 +1310,8 @@ SvStream& SvStream::operator>>(double& r)
         if (bSwap)
           SwapDouble(n);
         r = n;
+#else
+    (void) r;
 #endif
     }
     return *this;
commit 9a113a7d931f140b6a8e7f57937d51063244b1c8
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Oct 4 09:44:04 2011 +0300

    WaE: unreachable code, we always return in preceding code

diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index c27de5f..95fcd32 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -2084,7 +2084,13 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
         }
 #endif
 #endif
+
+// For the WNT case we always return already above, so avoid warning
+// C4702: unreachable code. Possibly also in non-WNT cases we always
+// return already above, but gcc apparently doesn't mind.
+#ifndef WNT
         return ERRCODE_NONE;
+#endif
 }
 
 #endif
commit b558502c96a779e9bd46b71903c7537da0d07f17
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Oct 4 09:39:32 2011 +0300

    WaE: conversion from 'sal_Int32' to 'sal_uInt16', possible loss of data

diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 391f4a6..0f15bb7 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -62,7 +62,7 @@ rtl::OString SimpleConfig::getNext()
         return rtl::OString();
 
     rtl::OString aString = comphelper::string::getToken(aStringBuffer, 0, '\t');
-    aStringBuffer.Erase(0, aString.getLength()+1);
+    aStringBuffer.Erase(0, (sal_uInt16)aString.getLength()+1);
 
     aStringBuffer.EraseLeadingChars( '\t' );
 
diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx
index d72ed8a..6b89751 100644
--- a/tools/source/generic/config.cxx
+++ b/tools/source/generic/config.cxx
@@ -453,9 +453,9 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
     ImplKeyData*    pKey;
     ImplGroupData*  pGroup;
     unsigned int    nBufLen;
-    sal_uInt16          nValueLen;
-    sal_uInt16          nKeyLen;
-    sal_uInt16          nLineEndLen;
+    sal_uInt32          nValueLen;
+    sal_uInt32          nKeyLen;
+    sal_uInt32          nLineEndLen;
 
     if ( pData->meLineEnd == LINEEND_CR )
     {


More information about the Libreoffice-commits mailing list