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

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

Issue 1194883002: Improve the encoding/decoding to/from system encoding on Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: A few more comments Created 5 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <netdb.h> // NOLINT 9 #include <netdb.h> // NOLINT
10 #include <sys/time.h> // NOLINT 10 #include <sys/time.h> // NOLINT
(...skipping 24 matching lines...) Expand all
35 char error_message[kBufferSize]; 35 char error_message[kBufferSize];
36 strerror_r(code, error_message, kBufferSize); 36 strerror_r(code, error_message, kBufferSize);
37 SetMessage(error_message); 37 SetMessage(error_message);
38 } else if (sub_system == kGetAddressInfo) { 38 } else if (sub_system == kGetAddressInfo) {
39 SetMessage(gai_strerror(code)); 39 SetMessage(gai_strerror(code));
40 } else { 40 } else {
41 UNREACHABLE(); 41 UNREACHABLE();
42 } 42 }
43 } 43 }
44 44
45 const char* StringUtils::ConsoleStringToUtf8(const char* str) { 45 const char* StringUtils::ConsoleStringToUtf8(
46 const char* str, intptr_t len, intptr_t* result_len) {
47 if (result_len != NULL) {
48 *result_len = len;
49 }
46 return str; 50 return str;
47 } 51 }
48 52
49 const char* StringUtils::Utf8ToConsoleString(const char* utf8) { 53 const char* StringUtils::Utf8ToConsoleString(
54 const char* utf8, intptr_t len, intptr_t* result_len) {
55 if (result_len != NULL) {
56 *result_len = len;
57 }
50 return utf8; 58 return utf8;
51 } 59 }
52 60
53 char* StringUtils::ConsoleStringToUtf8(char* str) { 61 char* StringUtils::ConsoleStringToUtf8(
62 char* str, intptr_t len, intptr_t* result_len) {
63 if (result_len != NULL) {
64 *result_len = len;
65 }
54 return str; 66 return str;
55 } 67 }
56 68
57 char* StringUtils::Utf8ToConsoleString(char* utf8) { 69 char* StringUtils::Utf8ToConsoleString(
70 char* utf8, intptr_t len, intptr_t* result_len) {
71 if (result_len != NULL) {
72 *result_len = len;
73 }
58 return utf8; 74 return utf8;
kustermann 2015/06/22 11:11:21 There is potential for issues here. Previously the
Søren Gjesse 2015/06/23 11:17:59 Changed this to be only implemented on Windows. Th
59 } 75 }
60 76
61 wchar_t* StringUtils::Utf8ToWide(char* utf8) { 77 wchar_t* StringUtils::Utf8ToWide(
78 char* utf8, intptr_t len, intptr_t* result_len) {
62 UNIMPLEMENTED(); 79 UNIMPLEMENTED();
63 return NULL; 80 return NULL;
64 } 81 }
65 82
66 const wchar_t* StringUtils::Utf8ToWide(const char* utf8) { 83 const wchar_t* StringUtils::Utf8ToWide(
84 const char* utf8, intptr_t len, intptr_t* result_len) {
67 UNIMPLEMENTED(); 85 UNIMPLEMENTED();
68 return NULL; 86 return NULL;
69 } 87 }
70 88
71 char* StringUtils::WideToUtf8(wchar_t* str) { 89 char* StringUtils::WideToUtf8(
90 wchar_t* str, intptr_t len, intptr_t* result_len) {
72 UNIMPLEMENTED(); 91 UNIMPLEMENTED();
73 return NULL; 92 return NULL;
74 } 93 }
75 94
76 const char* StringUtils::WideToUtf8(const wchar_t* str) { 95 const char* StringUtils::WideToUtf8(
96 const wchar_t* str, intptr_t len, intptr_t* result_len) {
77 UNIMPLEMENTED(); 97 UNIMPLEMENTED();
78 return NULL; 98 return NULL;
79 } 99 }
80 100
81 wchar_t** ShellUtils::GetUnicodeArgv(int* argc) { 101 wchar_t** ShellUtils::GetUnicodeArgv(int* argc) {
82 return NULL; 102 return NULL;
83 } 103 }
84 104
85 void ShellUtils::FreeUnicodeArgv(wchar_t** argv) { 105 void ShellUtils::FreeUnicodeArgv(wchar_t** argv) {
86 } 106 }
(...skipping 29 matching lines...) Expand all
116 ASSERT(errno == EINTR); 136 ASSERT(errno == EINTR);
117 // Copy remainder into requested and repeat. 137 // Copy remainder into requested and repeat.
118 req = rem; 138 req = rem;
119 } 139 }
120 } 140 }
121 141
122 } // namespace bin 142 } // namespace bin
123 } // namespace dart 143 } // namespace dart
124 144
125 #endif // defined(TARGET_OS_ANDROID) 145 #endif // defined(TARGET_OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698