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

Side by Side Diff: net/base/dns_util.cc

Issue 8354008: Fixing some warning due to different signess of char (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Better if in dns_util.cc Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/string_split.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/dns_util.h" 5 #include "net/base/dns_util.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 name[namelen++] = 0; // This is the root label (of length 0). 53 name[namelen++] = 0; // This is the root label (of length 0).
54 54
55 *out = std::string(name, namelen); 55 *out = std::string(name, namelen);
56 return true; 56 return true;
57 } 57 }
58 58
59 std::string DNSDomainToString(const std::string& domain) { 59 std::string DNSDomainToString(const std::string& domain) {
60 std::string ret; 60 std::string ret;
61 61
62 for (unsigned i = 0; i < domain.size() && domain[i]; i += domain[i] + 1) { 62 for (unsigned i = 0; i < domain.size() && domain[i]; i += domain[i] + 1) {
63 if (domain[i] < 0 || domain[i] > 63) 63 #if CHAR_MIN < 0
64 if (domain[i] < 0)
65 return "";
66 #endif
67 if (domain[i] > 63)
64 return ""; 68 return "";
65 69
66 if (i) 70 if (i)
67 ret += "."; 71 ret += ".";
68 72
69 if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size()) 73 if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size())
70 return ""; 74 return "";
71 75
72 ret += domain.substr(i + 1, domain[i]); 76 ret += domain.substr(i + 1, domain[i]);
73 } 77 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 break; 210 break;
207 } else { 211 } else {
208 return false; 212 return false;
209 } 213 }
210 } 214 }
211 215
212 return true; 216 return true;
213 } 217 }
214 218
215 } // namespace net 219 } // namespace net
OLDNEW
« no previous file with comments | « base/string_split.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698