Address static analysis warning in DataLog.cpp: Value stored to 'pathCharactersAvailable' is never read
https://bugs.webkit.org/show_bug.cgi?id=202153
<rdar://problem/55671845>
Reviewed by David Kilzer.
Bug 168914 introduced some code that will initialize a variable to
zero, but then never use that variable afterwards. Address this by
removing the assignment.
* wtf/DataLog.cpp:
(WTF::setDataFile):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index aecd50c..25e477f 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,18 @@
+2020-04-02 Keith Rollin <krollin@apple.com>
+
+ Address static analysis warning in DataLog.cpp: Value stored to 'pathCharactersAvailable' is never read
+ https://bugs.webkit.org/show_bug.cgi?id=202153
+ <rdar://problem/55671845>
+
+ Reviewed by David Kilzer.
+
+ Bug 168914 introduced some code that will initialize a variable to
+ zero, but then never use that variable afterwards. Address this by
+ removing the assignment.
+
+ * wtf/DataLog.cpp:
+ (WTF::setDataFile):
+
2020-03-31 Michael Catanzaro <mcatanzaro@gnome.org>
Update check for aarch64
diff --git a/Source/WTF/wtf/DataLog.cpp b/Source/WTF/wtf/DataLog.cpp
index b955770..ca7fbc3 100644
--- a/Source/WTF/wtf/DataLog.cpp
+++ b/Source/WTF/wtf/DataLog.cpp
@@ -133,9 +133,7 @@
if (pathCharactersAvailable) {
int pidTextLength = snprintf(nextDest, pathCharactersAvailable, "%d", getCurrentProcessID());
- if (pidTextLength < 0 || static_cast<size_t>(pidTextLength) >= pathCharactersAvailable)
- pathCharactersAvailable = 0;
- else {
+ if (pidTextLength >= 0 && static_cast<size_t>(pidTextLength) < pathCharactersAvailable) {
pathCharactersAvailable -= static_cast<size_t>(pidTextLength);
nextDest += pidTextLength;
strncpy(nextDest, pidFormat + 4, pathCharactersAvailable);