Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: third_party/libjingle/files/talk/base/urlencode.cc

Issue 338037: linux: fix gcc 4.3 issues (for arm) (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <stdlib.h>
2 #include <string.h>
1 #include "talk/base/urlencode.h" 3 #include "talk/base/urlencode.h"
ncarter (slow) 2009/10/27 20:13:51 Somehow this file got to be without a copyright no
ncarter (slow) 2009/10/27 20:17:49 Oh, actually, this is the way it is in the libjing
2 4
3 static int HexPairValue(const char * code) { 5 static int HexPairValue(const char * code) {
4 int value = 0; 6 int value = 0;
5 const char * pch = code; 7 const char * pch = code;
6 for (;;) { 8 for (;;) {
7 int digit = *pch++; 9 int digit = *pch++;
8 if (digit >= '0' && digit <= '9') { 10 if (digit >= '0' && digit <= '9') {
9 value += digit - '0'; 11 value += digit - '0';
10 } 12 }
11 else if (digit >= 'A' && digit <= 'F') { 13 else if (digit >= 'A' && digit <= 'F') {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 char stackalloc[64]; 113 char stackalloc[64];
112 char * buf = needed_length > sizeof(stackalloc)/sizeof(*stackalloc) ? 114 char * buf = needed_length > sizeof(stackalloc)/sizeof(*stackalloc) ?
113 (char *)malloc(needed_length) : stackalloc; 115 (char *)malloc(needed_length) : stackalloc;
114 UrlEncode(decoded.c_str(), buf, needed_length); 116 UrlEncode(decoded.c_str(), buf, needed_length);
115 std::string result(buf); 117 std::string result(buf);
116 if (buf != stackalloc) { 118 if (buf != stackalloc) {
117 free(buf); 119 free(buf);
118 } 120 }
119 return result; 121 return result;
120 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698