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

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

Issue 187793004: Fill out the rest of the StringPiece functions for 16-bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/websockets/websocket_basic_handshake_stream.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) 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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const DataPackEntry* target = reinterpret_cast<const DataPackEntry*>( 183 const DataPackEntry* target = reinterpret_cast<const DataPackEntry*>(
184 bsearch(&resource_id, mmap_->data() + kHeaderLength, resource_count_, 184 bsearch(&resource_id, mmap_->data() + kHeaderLength, resource_count_,
185 sizeof(DataPackEntry), DataPackEntry::CompareById)); 185 sizeof(DataPackEntry), DataPackEntry::CompareById));
186 if (!target) { 186 if (!target) {
187 return false; 187 return false;
188 } 188 }
189 189
190 const DataPackEntry* next_entry = target + 1; 190 const DataPackEntry* next_entry = target + 1;
191 size_t length = next_entry->file_offset - target->file_offset; 191 size_t length = next_entry->file_offset - target->file_offset;
192 192
193 data->set(mmap_->data() + target->file_offset, length); 193 data->set(reinterpret_cast<const char*>(mmap_->data() + target->file_offset),
194 length);
194 return true; 195 return true;
195 } 196 }
196 197
197 base::RefCountedStaticMemory* DataPack::GetStaticMemory( 198 base::RefCountedStaticMemory* DataPack::GetStaticMemory(
198 uint16 resource_id) const { 199 uint16 resource_id) const {
199 base::StringPiece piece; 200 base::StringPiece piece;
200 if (!GetStringPiece(resource_id, &piece)) 201 if (!GetStringPiece(resource_id, &piece))
201 return NULL; 202 return NULL;
202 203
203 return new base::RefCountedStaticMemory(piece.data(), piece.length()); 204 return new base::RefCountedStaticMemory(piece.data(), piece.length());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return false; 297 return false;
297 } 298 }
298 } 299 }
299 300
300 base::CloseFile(file); 301 base::CloseFile(file);
301 302
302 return true; 303 return true;
303 } 304 }
304 305
305 } // namespace ui 306 } // namespace ui
OLDNEW
« no previous file with comments | « net/websockets/websocket_basic_handshake_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698