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

Side by Side Diff: base/android/jni_array.cc

Issue 1543293003: Switch to standard integer types in base/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « base/android/jni_array.h ('k') | base/android/jni_array_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 "base/android/jni_array.h" 5 #include "base/android/jni_array.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 std::vector<uint8_t>* out) { 162 std::vector<uint8_t>* out) {
163 DCHECK(out); 163 DCHECK(out);
164 if (!byte_array) 164 if (!byte_array)
165 return; 165 return;
166 size_t len = SafeGetArrayLength(env, byte_array); 166 size_t len = SafeGetArrayLength(env, byte_array);
167 if (!len) 167 if (!len)
168 return; 168 return;
169 size_t back = out->size(); 169 size_t back = out->size();
170 out->resize(back + len); 170 out->resize(back + len);
171 env->GetByteArrayRegion(byte_array, 0, len, 171 env->GetByteArrayRegion(byte_array, 0, len,
172 reinterpret_cast<int8*>(&(*out)[back])); 172 reinterpret_cast<int8_t*>(&(*out)[back]));
173 } 173 }
174 174
175 void JavaByteArrayToByteVector(JNIEnv* env, 175 void JavaByteArrayToByteVector(JNIEnv* env,
176 jbyteArray byte_array, 176 jbyteArray byte_array,
177 std::vector<uint8_t>* out) { 177 std::vector<uint8_t>* out) {
178 DCHECK(out); 178 DCHECK(out);
179 DCHECK(byte_array); 179 DCHECK(byte_array);
180 out->clear(); 180 out->clear();
181 AppendJavaByteArrayToByteVector(env, byte_array, out); 181 AppendJavaByteArrayToByteVector(env, byte_array, out);
182 } 182 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 out->resize(len); 253 out->resize(len);
254 for (size_t i = 0; i < len; ++i) { 254 for (size_t i = 0; i < len; ++i) {
255 ScopedJavaLocalRef<jintArray> int_array( 255 ScopedJavaLocalRef<jintArray> int_array(
256 env, static_cast<jintArray>(env->GetObjectArrayElement(array, i))); 256 env, static_cast<jintArray>(env->GetObjectArrayElement(array, i)));
257 JavaIntArrayToIntVector(env, int_array.obj(), &((*out)[i])); 257 JavaIntArrayToIntVector(env, int_array.obj(), &((*out)[i]));
258 } 258 }
259 } 259 }
260 260
261 } // namespace android 261 } // namespace android
262 } // namespace base 262 } // namespace base
OLDNEW
« no previous file with comments | « base/android/jni_array.h ('k') | base/android/jni_array_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698