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

Side by Side Diff: ui/base/resource/data_pack.cc

Issue 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 months 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
« no previous file with comments | « ui/base/l10n/l10n_util_win.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/base/resource/data_pack.h" 5 #include "ui/base/resource/data_pack.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 if (textEncodingType != UTF8 && textEncodingType != UTF16 && 257 if (textEncodingType != UTF8 && textEncodingType != UTF16 &&
258 textEncodingType != BINARY) { 258 textEncodingType != BINARY) {
259 LOG(ERROR) << "Invalid text encoding type, got " << textEncodingType 259 LOG(ERROR) << "Invalid text encoding type, got " << textEncodingType
260 << ", expected between " << BINARY << " and " << UTF16; 260 << ", expected between " << BINARY << " and " << UTF16;
261 base::CloseFile(file); 261 base::CloseFile(file);
262 return false; 262 return false;
263 } 263 }
264 264
265 uint8 write_buffer = textEncodingType; 265 uint8 write_buffer = static_cast<uint8>(textEncodingType);
266 if (fwrite(&write_buffer, sizeof(uint8), 1, file) != 1) { 266 if (fwrite(&write_buffer, sizeof(uint8), 1, file) != 1) {
267 LOG(ERROR) << "Failed to write file text resources encoding"; 267 LOG(ERROR) << "Failed to write file text resources encoding";
268 base::CloseFile(file); 268 base::CloseFile(file);
269 return false; 269 return false;
270 } 270 }
271 271
272 // Each entry is a uint16 + a uint32. We have an extra entry after the last 272 // Each entry is a uint16 + a uint32. We have an extra entry after the last
273 // item so we can compute the size of the list item. 273 // item so we can compute the size of the list item.
274 uint32 index_length = (entry_count + 1) * sizeof(DataPackEntry); 274 uint32 index_length = (entry_count + 1) * sizeof(DataPackEntry);
275 uint32 data_offset = kHeaderLength + index_length; 275 uint32 data_offset = kHeaderLength + index_length;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return false; 316 return false;
317 } 317 }
318 } 318 }
319 319
320 base::CloseFile(file); 320 base::CloseFile(file);
321 321
322 return true; 322 return true;
323 } 323 }
324 324
325 } // namespace ui 325 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/l10n/l10n_util_win.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698