diff options
author | pkasting <pkasting@chromium.org> | 2014-10-20 15:35:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 22:36:05 +0000 |
commit | 7b51db65f6419f7b17f75063b84fb1e84c2e7d01 (patch) | |
tree | eddc1fd9ae14bb98053b61868b57fdeaad7d5c81 | |
parent | 7739d132d3d59b3e0be4fa94ed1571e975235c2d (diff) | |
download | chromium_src-7b51db65f6419f7b17f75063b84fb1e84c2e7d01.zip chromium_src-7b51db65f6419f7b17f75063b84fb1e84c2e7d01.tar.gz chromium_src-7b51db65f6419f7b17f75063b84fb1e84c2e7d01.tar.bz2 |
Type conversion fixes, url/ edition.
This is mostly to fix MSVC warnings about possible value truncation.
BUG=81439
TEST=none
Review URL: https://codereview.chromium.org/662713004
Cr-Commit-Position: refs/heads/master@{#300358}
-rw-r--r-- | url/url_canon.h | 4 | ||||
-rw-r--r-- | url/url_canon_fileurl.cc | 2 | ||||
-rw-r--r-- | url/url_canon_pathurl.cc | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/url/url_canon.h b/url/url_canon.h index 624eeaf..3b9f906 100644 --- a/url/url_canon.h +++ b/url/url_canon.h @@ -41,13 +41,13 @@ class CanonOutputT { // Accessor for returning a character at a given position. The input offset // must be in the valid range. - inline char at(int offset) const { + inline T at(int offset) const { return buffer_[offset]; } // Sets the character at the given position. The given position MUST be less // than the length(). - inline void set(int offset, int ch) { + inline void set(int offset, T ch) { buffer_[offset] = ch; } diff --git a/url/url_canon_fileurl.cc b/url/url_canon_fileurl.cc index 1322be7..6191f8f 100644 --- a/url/url_canon_fileurl.cc +++ b/url/url_canon_fileurl.cc @@ -40,7 +40,7 @@ int FileDoDriveSpec(const CHAR* spec, int begin, int end, // Normalize Windows drive letters to uppercase if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z') - output->push_back(spec[after_slashes] - 'a' + 'A'); + output->push_back(static_cast<char>(spec[after_slashes] - 'a' + 'A')); else output->push_back(static_cast<char>(spec[after_slashes])); diff --git a/url/url_canon_pathurl.cc b/url/url_canon_pathurl.cc index e81a4af..0d23ccb 100644 --- a/url/url_canon_pathurl.cc +++ b/url/url_canon_pathurl.cc @@ -19,13 +19,13 @@ namespace { template<typename CHAR, typename UCHAR> bool DoCanonicalizePathComponent(const CHAR* source, const Component& component, - CHAR seperator, + char separator, CanonOutput* output, Component* new_component) { bool success = true; if (component.is_valid()) { - if (seperator) - output->push_back(seperator); + if (separator) + output->push_back(separator); // Copy the path using path URL's more lax escaping rules (think for // javascript:). We convert to UTF-8 and escape non-ASCII, but leave all // ASCII characters alone. This helps readability of JavaStript. @@ -64,7 +64,7 @@ bool DoCanonicalizePathURL(const URLComponentSource<CHAR>& source, // We allow path URLs to have the path, query and fragment components, but we // will canonicalize each of the via the weaker path URL rules. success &= DoCanonicalizePathComponent<CHAR, UCHAR>( - source.path, parsed.path, 0, output, &new_parsed->path); + source.path, parsed.path, '\0', output, &new_parsed->path); success &= DoCanonicalizePathComponent<CHAR, UCHAR>( source.query, parsed.query, '?', output, &new_parsed->query); success &= DoCanonicalizePathComponent<CHAR, UCHAR>( |