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

Side by Side Diff: src/extensions/experimental/i18n-utils.cc

Issue 7129051: Adding support for number formating to the JS i18n API. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Final fixes. Created 9 years, 6 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 | « src/extensions/experimental/i18n-utils.h ('k') | src/extensions/experimental/number-format.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // by TryCatch above. 58 // by TryCatch above.
59 if (!value->IsUndefined() && !value->IsNull() && value->IsString()) { 59 if (!value->IsUndefined() && !value->IsNull() && value->IsString()) {
60 v8::String::Utf8Value utf8_value(value); 60 v8::String::Utf8Value utf8_value(value);
61 if (*utf8_value == NULL) return false; 61 if (*utf8_value == NULL) return false;
62 result->setTo(icu::UnicodeString::fromUTF8(*utf8_value)); 62 result->setTo(icu::UnicodeString::fromUTF8(*utf8_value));
63 return true; 63 return true;
64 } 64 }
65 return false; 65 return false;
66 } 66 }
67 67
68 // static
69 void I18NUtils::AsciiToUChar(const char* source,
70 int32_t source_length,
71 UChar* target,
72 int32_t target_length) {
73 int32_t length =
74 source_length < target_length ? source_length : target_length;
75
76 if (length <= 0) {
77 return;
78 }
79
80 for (int32_t i = 0; i < length - 1; ++i) {
81 target[i] = static_cast<UChar>(source[i]);
82 }
83
84 target[length - 1] = 0x0u;
85 }
86
68 } } // namespace v8::internal 87 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/extensions/experimental/i18n-utils.h ('k') | src/extensions/experimental/number-format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698