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

Side by Side Diff: ios/web/navigation/nscoder_util.mm

Issue 1023013002: Minor cleanup in ios/web utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 5 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
« no previous file with comments | « ios/web/history_state_util_unittest.mm ('k') | ios/web/web_state/blocked_popup_info.mm » ('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 <string> 5 #include <string>
6 6
7 #include "ios/web/navigation/nscoder_util.h" 7 #include "ios/web/navigation/nscoder_util.h"
8 8
9 namespace web { 9 namespace web {
10 namespace nscoder_util { 10 namespace nscoder_util {
11 11
12 void EncodeString(NSCoder* coder, NSString* key, const std::string& string) { 12 void EncodeString(NSCoder* coder, NSString* key, const std::string& string) {
13 [coder encodeBytes:reinterpret_cast<const uint8_t*>(string.data()) 13 [coder encodeBytes:reinterpret_cast<const uint8_t*>(string.data())
14 length:string.size() 14 length:string.size()
15 forKey:key]; 15 forKey:key];
16 } 16 }
17 17
18 std::string DecodeString(NSCoder* decoder, NSString* key) { 18 std::string DecodeString(NSCoder* decoder, NSString* key) {
19 NSUInteger length; 19 NSUInteger length = 0;
20 const uint8_t* bytes = [decoder decodeBytesForKey:key returnedLength:&length]; 20 const uint8_t* bytes = [decoder decodeBytesForKey:key returnedLength:&length];
21 return std::string(reinterpret_cast<const char*>(bytes), length); 21 return std::string(reinterpret_cast<const char*>(bytes), length);
22 } 22 }
23 23
24 } // namespace nscoder_util 24 } // namespace nscoder_util
25 } // namespace web 25 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/history_state_util_unittest.mm ('k') | ios/web/web_state/blocked_popup_info.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698