[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdelibs/frameworks] khtml/src/misc: Fix warning about uninitialized variable
From:       Frank Osterfeld <osterfeld () kde ! org>
Date:       2013-10-18 19:38:18
Message-ID: E1VXFsI-0005Qp-O1 () scm ! kde ! org
[Download RAW message or body]

Git commit 6e40ffb59cf8809b4bb8a2d6fb3c2a4de6b108ef by Frank Osterfeld.
Committed on 18/10/2013 at 19:36.
Pushed by osterfeld into branch 'frameworks'.

Fix warning about uninitialized variable

The code seems correct though (all code paths assign
something to name; the switch covers all cases)

M  +3    -2    khtml/src/misc/idstring.cpp

http://commits.kde.org/kdelibs/6e40ffb59cf8809b4bb8a2d6fb3c2a4de6b108ef

diff --git a/khtml/src/misc/idstring.cpp b/khtml/src/misc/idstring.cpp
index 5dfb520..d33ccca 100644
--- a/khtml/src/misc/idstring.cpp
+++ b/khtml/src/misc/idstring.cpp
@@ -72,7 +72,7 @@ unsigned short IDTableBase::grabId(DOMStringImpl* origName, CaseNormalizeMode cn
     // Nope. Allocate new ID. If there is normalization going on, we may now have to 
     // update our case so the canonical mapping is of the expected case. We
     // may also have to deep-copy 
-    DOMStringImpl* name;
+    DOMStringImpl* name = 0;
     switch (cnm) {
     case IDS_CaseSensitive:
         if (origName->m_shallowCopy) {
@@ -91,7 +91,8 @@ unsigned short IDTableBase::grabId(DOMStringImpl* origName, CaseNormalizeMode cn
         name = origName->lower();
         break;
     }
-    
+
+    Q_ASSERT(name);
     name->ref();
 
     if (!m_idFreeList.isEmpty()) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic