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

Side by Side Diff: content/browser/indexed_db/indexed_db_leveldb_coding.cc

Issue 1485023003: Misc truncation fixes for gn builds with VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes to four more components/content files Created 5 years 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/indexed_db/indexed_db_leveldb_coding.h" 5 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 std::string index_id_string; 1244 std::string index_id_string;
1245 1245
1246 EncodeIntSafely(database_id, kMaxDatabaseId, &database_id_string); 1246 EncodeIntSafely(database_id, kMaxDatabaseId, &database_id_string);
1247 EncodeIntSafely(object_store_id, kMaxObjectStoreId, &object_store_id_string); 1247 EncodeIntSafely(object_store_id, kMaxObjectStoreId, &object_store_id_string);
1248 EncodeIntSafely(index_id, kMaxIndexId, &index_id_string); 1248 EncodeIntSafely(index_id, kMaxIndexId, &index_id_string);
1249 1249
1250 DCHECK(database_id_string.size() <= kMaxDatabaseIdSizeBytes); 1250 DCHECK(database_id_string.size() <= kMaxDatabaseIdSizeBytes);
1251 DCHECK(object_store_id_string.size() <= kMaxObjectStoreIdSizeBytes); 1251 DCHECK(object_store_id_string.size() <= kMaxObjectStoreIdSizeBytes);
1252 DCHECK(index_id_string.size() <= kMaxIndexIdSizeBytes); 1252 DCHECK(index_id_string.size() <= kMaxIndexIdSizeBytes);
1253 1253
1254 unsigned char first_byte = 1254 unsigned char first_byte = static_cast<char>(
1255 (database_id_string.size() - 1) << (kMaxObjectStoreIdSizeBits + 1255 (database_id_string.size() - 1) << (kMaxObjectStoreIdSizeBits +
1256 kMaxIndexIdSizeBits) | 1256 kMaxIndexIdSizeBits) |
1257 (object_store_id_string.size() - 1) << kMaxIndexIdSizeBits | 1257 (object_store_id_string.size() - 1) << kMaxIndexIdSizeBits |
1258 (index_id_string.size() - 1); 1258 (index_id_string.size() - 1));
1259 static_assert(kMaxDatabaseIdSizeBits + kMaxObjectStoreIdSizeBits + 1259 static_assert(kMaxDatabaseIdSizeBits + kMaxObjectStoreIdSizeBits +
1260 kMaxIndexIdSizeBits == 1260 kMaxIndexIdSizeBits ==
1261 sizeof(first_byte) * 8, 1261 sizeof(first_byte) * 8,
1262 "cannot encode ids"); 1262 "cannot encode ids");
1263 std::string ret; 1263 std::string ret;
1264 ret.reserve(kDefaultInlineBufferSize); 1264 ret.reserve(kDefaultInlineBufferSize);
1265 ret.push_back(first_byte); 1265 ret.push_back(first_byte);
1266 ret.append(database_id_string); 1266 ret.append(database_id_string);
1267 ret.append(object_store_id_string); 1267 ret.append(object_store_id_string);
1268 ret.append(index_id_string); 1268 ret.append(index_id_string);
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { 2032 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const {
2033 scoped_ptr<IndexedDBKey> key; 2033 scoped_ptr<IndexedDBKey> key;
2034 StringPiece slice(encoded_primary_key_); 2034 StringPiece slice(encoded_primary_key_);
2035 if (!DecodeIDBKey(&slice, &key)) { 2035 if (!DecodeIDBKey(&slice, &key)) {
2036 // TODO(jsbell): Return error. 2036 // TODO(jsbell): Return error.
2037 } 2037 }
2038 return key.Pass(); 2038 return key.Pass();
2039 } 2039 }
2040 2040
2041 } // namespace content 2041 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.cc ('k') | content/browser/renderer_host/p2p/socket_host_tcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698