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

Side by Side Diff: src/extensions/i18n/number-format.cc

Issue 18854002: Fix an implicit cast from int64 to double in the i18n extension (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 number_format->parse(string_number, result, status); 141 number_format->parse(string_number, result, status);
142 if (U_FAILURE(status)) { 142 if (U_FAILURE(status)) {
143 return; 143 return;
144 } 144 }
145 145
146 switch (result.getType()) { 146 switch (result.getType()) {
147 case icu::Formattable::kDouble: 147 case icu::Formattable::kDouble:
148 args.GetReturnValue().Set(result.getDouble()); 148 args.GetReturnValue().Set(result.getDouble());
149 return; 149 return;
150 case icu::Formattable::kLong: 150 case icu::Formattable::kLong:
151 args.GetReturnValue().Set(v8::Number::New(result.getLong())); 151 args.GetReturnValue().Set(result.getLong());
152 return; 152 return;
153 case icu::Formattable::kInt64: 153 case icu::Formattable::kInt64:
154 args.GetReturnValue().Set(v8::Number::New(result.getInt64())); 154 args.GetReturnValue().Set(static_cast<double>(result.getInt64()));
155 return; 155 return;
156 default: 156 default:
157 return; 157 return;
158 } 158 }
159 } 159 }
160 160
161 void NumberFormat::JSCreateNumberFormat( 161 void NumberFormat::JSCreateNumberFormat(
162 const v8::FunctionCallbackInfo<v8::Value>& args) { 162 const v8::FunctionCallbackInfo<v8::Value>& args) {
163 if (args.Length() != 3 || 163 if (args.Length() != 3 ||
164 !args[0]->IsString() || 164 !args[0]->IsString() ||
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 409 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
410 if (U_SUCCESS(status)) { 410 if (U_SUCCESS(status)) {
411 resolved->Set(v8::String::New("locale"), v8::String::New(result)); 411 resolved->Set(v8::String::New("locale"), v8::String::New(result));
412 } else { 412 } else {
413 // This would never happen, since we got the locale from ICU. 413 // This would never happen, since we got the locale from ICU.
414 resolved->Set(v8::String::New("locale"), v8::String::New("und")); 414 resolved->Set(v8::String::New("locale"), v8::String::New("und"));
415 } 415 }
416 } 416 }
417 417
418 } // namespace v8_i18n 418 } // namespace v8_i18n
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698