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

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_drag_data.cc

Issue 9702013: Avoid using Pickle::WriteSize(), which writes an architecture-dependent amount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « no previous file | chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.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 "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 5 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 BrowserActionDragData::kClipboardFormatString); 60 BrowserActionDragData::kClipboardFormatString);
61 } 61 }
62 return format; 62 return format;
63 } 63 }
64 #endif 64 #endif
65 65
66 void BrowserActionDragData::WriteToPickle( 66 void BrowserActionDragData::WriteToPickle(
67 Profile* profile, Pickle* pickle) const { 67 Profile* profile, Pickle* pickle) const {
68 pickle->WriteBytes(&profile, sizeof(profile)); 68 pickle->WriteBytes(&profile, sizeof(profile));
69 pickle->WriteString(id_); 69 pickle->WriteString(id_);
70 pickle->WriteSize(index_); 70 pickle->WriteUInt64(index_);
71 } 71 }
72 72
73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { 73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
74 PickleIterator data_iterator(*pickle); 74 PickleIterator data_iterator(*pickle);
75 75
76 const char* tmp; 76 const char* tmp;
77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_))) 77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_)))
78 return false; 78 return false;
79 memcpy(&profile_, tmp, sizeof(profile_)); 79 memcpy(&profile_, tmp, sizeof(profile_));
80 80
81 if (!pickle->ReadString(&data_iterator, &id_)) 81 if (!pickle->ReadString(&data_iterator, &id_))
82 return false; 82 return false;
83 83
84 if (!pickle->ReadSize(&data_iterator, &index_)) 84 uint64 index;
85 if (!pickle->ReadUInt64(&data_iterator, &index))
85 return false; 86 return false;
87 index_ = static_cast<size_t>(index);
86 88
87 return true; 89 return true;
88 } 90 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698