| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 #include "bin/filter.h" | 6 #include "bin/filter.h" |
| 7 #include "bin/io_buffer.h" | 7 #include "bin/io_buffer.h" |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (Dart_IsError(result)) { | 75 if (Dart_IsError(result)) { |
| 76 delete filter; | 76 delete filter; |
| 77 Dart_PropagateError(result); | 77 Dart_PropagateError(result); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) { | 81 void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) { |
| 82 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); | 82 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); |
| 83 Filter* filter = GetFilter(filter_obj); | 83 Filter* filter = GetFilter(filter_obj); |
| 84 Dart_Handle data_obj = Dart_GetNativeArgument(args, 1); | 84 Dart_Handle data_obj = Dart_GetNativeArgument(args, 1); |
| 85 intptr_t start = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); | 85 intptr_t start = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2)); |
| 86 intptr_t end = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); | 86 intptr_t end = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 3)); |
| 87 intptr_t chunk_length = end - start; | 87 intptr_t chunk_length = end - start; |
| 88 intptr_t length; | 88 intptr_t length; |
| 89 Dart_TypedData_Type type; | 89 Dart_TypedData_Type type; |
| 90 uint8_t* buffer = NULL; | 90 uint8_t* buffer = NULL; |
| 91 Dart_Handle result = Dart_TypedDataAcquireData( | 91 Dart_Handle result = Dart_TypedDataAcquireData( |
| 92 data_obj, &type, reinterpret_cast<void**>(&buffer), &length); | 92 data_obj, &type, reinterpret_cast<void**>(&buffer), &length); |
| 93 if (!Dart_IsError(result)) { | 93 if (!Dart_IsError(result)) { |
| 94 uint8_t* zlib_buffer = new uint8_t[chunk_length]; | 94 uint8_t* zlib_buffer = new uint8_t[chunk_length]; |
| 95 if (zlib_buffer == NULL) { | 95 if (zlib_buffer == NULL) { |
| 96 Dart_TypedDataReleaseData(data_obj); | 96 Dart_TypedDataReleaseData(data_obj); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 case Z_STREAM_ERROR: | 304 case Z_STREAM_ERROR: |
| 305 // An error occoured. | 305 // An error occoured. |
| 306 delete[] current_buffer_; | 306 delete[] current_buffer_; |
| 307 current_buffer_ = NULL; | 307 current_buffer_ = NULL; |
| 308 return -1; | 308 return -1; |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace bin | 312 } // namespace bin |
| 313 } // namespace dart | 313 } // namespace dart |
| OLD | NEW |