Backed out changeset 74312d99d538 (bug 1254061) for bustage. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 21 Mar 2016 19:15:49 +0100
changeset 289637 52c1e3e2fcfb5285f563b8912cc7c74cebcaac1e
parent 289636 551375db18bf7dc0585e3f5466f3c1c12a05f9b1
child 289638 9766c66da7717e0ca88962f1b6621a455bb57635
push id73932
push userarchaeopteryx@coole-files.de
push dateMon, 21 Mar 2016 18:16:15 +0000
treeherdermozilla-inbound@52c1e3e2fcfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1254061
milestone48.0a1
backs out74312d99d538b934c2d47e32f3e272bc78d3208a
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 74312d99d538 (bug 1254061) for bustage. r=backout on a CLOSED TREE
netwerk/protocol/http/nsHttp.cpp
--- a/netwerk/protocol/http/nsHttp.cpp
+++ b/netwerk/protocol/http/nsHttp.cpp
@@ -289,35 +289,29 @@ nsHttp::FindToken(const char *input, con
     }
 
     return nullptr;
 }
 
 bool
 nsHttp::ParseInt64(const char *input, const char **next, int64_t *r)
 {
-    MOZ_ASSERT(input);
-    MOZ_ASSERT(r);
-
-    char *end = nullptr;
-    errno = 0; // Clear errno to make sure its value is set by strtoll
-    int64_t value = strtoll(input, &end, /* base */ 10);
-
-    // Fail if: - the parsed number overflows.
-    //          - the end points to the start of the input string.
-    //          - we parsed a negative value. Consumers don't expect that.
-    if (errno != 0 || end == input || value < 0) {
-        LOG(("nsHttp::ParseInt64 value=%ld errno=%d", value, errno));
+    const char *start = input;
+    *r = 0;
+    while (*input >= '0' && *input <= '9') {
+        int64_t next = 10 * (*r) + (*input - '0');
+        if (next < *r) // overflow?
+            return false;
+        *r = next;
+        ++input;
+    }
+    if (input == start) // nothing parsed?
         return false;
-    }
-
-    if (next) {
-        *next = end;
-    }
-    *r = value;
+    if (next)
+        *next = input;
     return true;
 }
 
 bool
 nsHttp::IsPermanentRedirect(uint32_t httpStatus)
 {
   return httpStatus == 301 || httpStatus == 308;
 }