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

Side by Side Diff: runtime/bin/filter.cc

Issue 139043003: - Address warnings about 64-bit to 32-bit conversions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) { 54 void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) {
55 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); 55 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
56 Dart_Handle gzip_obj = Dart_GetNativeArgument(args, 1); 56 Dart_Handle gzip_obj = Dart_GetNativeArgument(args, 1);
57 Dart_Handle level_obj = Dart_GetNativeArgument(args, 2); 57 Dart_Handle level_obj = Dart_GetNativeArgument(args, 2);
58 bool gzip; 58 bool gzip;
59 if (Dart_IsError(Dart_BooleanValue(gzip_obj, &gzip))) { 59 if (Dart_IsError(Dart_BooleanValue(gzip_obj, &gzip))) {
60 Dart_ThrowException(DartUtils::NewInternalError( 60 Dart_ThrowException(DartUtils::NewInternalError(
61 "Failed to get 'gzip' parameter")); 61 "Failed to get 'gzip' parameter"));
62 } 62 }
63 int64_t level; 63 int64_t level = 0;
64 if (Dart_IsError(Dart_IntegerToInt64(level_obj, &level))) { 64 if (Dart_IsError(Dart_IntegerToInt64(level_obj, &level)) ||
65 (level < kMinInt32) || (level > kMaxInt32)) {
siva 2014/01/16 00:15:59 Would be more readable if this code is written as:
Ivan Posva 2014/01/16 05:05:41 Done.
65 Dart_ThrowException(DartUtils::NewInternalError( 66 Dart_ThrowException(DartUtils::NewInternalError(
66 "Failed to get 'level' parameter")); 67 "Failed to get 'level' parameter"));
67 } 68 }
68 Filter* filter = new ZLibDeflateFilter(gzip, level); 69 Filter* filter = new ZLibDeflateFilter(gzip, static_cast<int32_t>(level));
69 if (filter == NULL || !filter->Init()) { 70 if (filter == NULL || !filter->Init()) {
70 delete filter; 71 delete filter;
71 Dart_ThrowException(DartUtils::NewInternalError( 72 Dart_ThrowException(DartUtils::NewInternalError(
72 "Failed to create ZLibDeflateFilter")); 73 "Failed to create ZLibDeflateFilter"));
73 } 74 }
74 Dart_Handle result = Filter::SetFilterPointerNativeField(filter_obj, filter); 75 Dart_Handle result = Filter::SetFilterPointerNativeField(filter_obj, filter);
75 if (Dart_IsError(result)) { 76 if (Dart_IsError(result)) {
76 delete filter; 77 delete filter;
77 Dart_PropagateError(result); 78 Dart_PropagateError(result);
78 } 79 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 case Z_STREAM_ERROR: 305 case Z_STREAM_ERROR:
305 // An error occoured. 306 // An error occoured.
306 delete[] current_buffer_; 307 delete[] current_buffer_;
307 current_buffer_ = NULL; 308 current_buffer_ = NULL;
308 return -1; 309 return -1;
309 } 310 }
310 } 311 }
311 312
312 } // namespace bin 313 } // namespace bin
313 } // namespace dart 314 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698