OLD | NEW |
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 "android_webview/native/input_stream_impl.h" | 5 #include "android_webview/native/input_stream_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 // Disable "Warnings treated as errors" for input_stream_jni as it's a Java | 8 // Disable "Warnings treated as errors" for input_stream_jni as it's a Java |
9 // system class and we have to generate C++ hooks for all methods in the class | 9 // system class and we have to generate C++ hooks for all methods in the class |
10 // even if they're unused. | 10 // even if they're unused. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 DCHECK_GE(remaining_length, transfer_length); | 117 DCHECK_GE(remaining_length, transfer_length); |
118 env->GetByteArrayRegion(buffer, 0, transfer_length, | 118 env->GetByteArrayRegion(buffer, 0, transfer_length, |
119 reinterpret_cast<jbyte*>(dest_write_ptr)); | 119 reinterpret_cast<jbyte*>(dest_write_ptr)); |
120 if (ClearException(env)) | 120 if (ClearException(env)) |
121 return false; | 121 return false; |
122 | 122 |
123 remaining_length -= transfer_length; | 123 remaining_length -= transfer_length; |
124 dest_write_ptr += transfer_length; | 124 dest_write_ptr += transfer_length; |
125 } | 125 } |
126 // bytes_read can be strictly less than the req. length if EOF is encountered. | 126 // bytes_read can be strictly less than the req. length if EOF is encountered. |
127 DCHECK(remaining_length >= 0 && remaining_length <= length); | 127 DCHECK_GE(remaining_length, 0); |
| 128 DCHECK_LE(remaining_length, length); |
128 *bytes_read = length - remaining_length; | 129 *bytes_read = length - remaining_length; |
129 return true; | 130 return true; |
130 } | 131 } |
131 | 132 |
132 } // namespace android_webview | 133 } // namespace android_webview |
OLD | NEW |