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

Side by Side Diff: runtime/bin/utils_linux.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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 22 matching lines...) Expand all
33 const int kBufferSize = 1024; 33 const int kBufferSize = 1024;
34 char error_buf[kBufferSize]; 34 char error_buf[kBufferSize];
35 SetMessage(strerror_r(code, error_buf, kBufferSize)); 35 SetMessage(strerror_r(code, error_buf, kBufferSize));
36 } else if (sub_system == kGetAddressInfo) { 36 } else if (sub_system == kGetAddressInfo) {
37 SetMessage(gai_strerror(code)); 37 SetMessage(gai_strerror(code));
38 } else { 38 } else {
39 UNREACHABLE(); 39 UNREACHABLE();
40 } 40 }
41 } 41 }
42 42
43 const char* StringUtils::ConsoleStringToUtf8(const char* str) { 43 const char* StringUtils::ConsoleStringToUtf8(
44 const char* str, intptr_t len, intptr_t* result_len) {
45 if (result_len != NULL) {
46 *result_len = len;
47 }
44 return str; 48 return str;
45 } 49 }
46 50
47 const char* StringUtils::Utf8ToConsoleString(const char* utf8) { 51 const char* StringUtils::Utf8ToConsoleString(
52 const char* utf8, intptr_t len, intptr_t* result_len) {
53 if (result_len != NULL) {
54 *result_len = len;
55 }
48 return utf8; 56 return utf8;
49 } 57 }
50 58
51 char* StringUtils::ConsoleStringToUtf8(char* str) { 59 char* StringUtils::ConsoleStringToUtf8(
60 char* str, intptr_t len, intptr_t* result_len) {
61 if (result_len != NULL) {
62 *result_len = len;
63 }
52 return str; 64 return str;
53 } 65 }
54 66
55 char* StringUtils::Utf8ToConsoleString(char* utf8) { 67 char* StringUtils::Utf8ToConsoleString(
68 char* utf8, intptr_t len, intptr_t* result_len) {
69 if (result_len != NULL) {
70 *result_len = len;
71 }
56 return utf8; 72 return utf8;
57 } 73 }
58 74
59 wchar_t* StringUtils::Utf8ToWide(char* utf8) { 75 wchar_t* StringUtils::Utf8ToWide(
76 char* utf8, intptr_t len, intptr_t* result_len) {
60 UNIMPLEMENTED(); 77 UNIMPLEMENTED();
61 return NULL; 78 return NULL;
62 } 79 }
63 80
64 const wchar_t* StringUtils::Utf8ToWide(const char* utf8) { 81 const wchar_t* StringUtils::Utf8ToWide(
82 const char* utf8, intptr_t len, intptr_t* result_len) {
65 UNIMPLEMENTED(); 83 UNIMPLEMENTED();
66 return NULL; 84 return NULL;
67 } 85 }
68 86
69 char* StringUtils::WideToUtf8(wchar_t* str) { 87 char* StringUtils::WideToUtf8(
88 wchar_t* str, intptr_t len, intptr_t* result_len) {
70 UNIMPLEMENTED(); 89 UNIMPLEMENTED();
71 return NULL; 90 return NULL;
72 } 91 }
73 92
74 const char* StringUtils::WideToUtf8(const wchar_t* str) { 93 const char* StringUtils::WideToUtf8(
94 const wchar_t* str, intptr_t len, intptr_t* result_len) {
75 UNIMPLEMENTED(); 95 UNIMPLEMENTED();
76 return NULL; 96 return NULL;
77 } 97 }
78 98
79 wchar_t** ShellUtils::GetUnicodeArgv(int* argc) { 99 wchar_t** ShellUtils::GetUnicodeArgv(int* argc) {
80 return NULL; 100 return NULL;
81 } 101 }
82 102
83 void ShellUtils::FreeUnicodeArgv(wchar_t** argv) { 103 void ShellUtils::FreeUnicodeArgv(wchar_t** argv) {
84 } 104 }
(...skipping 29 matching lines...) Expand all
114 ASSERT(errno == EINTR); 134 ASSERT(errno == EINTR);
115 // Copy remainder into requested and repeat. 135 // Copy remainder into requested and repeat.
116 req = rem; 136 req = rem;
117 } 137 }
118 } 138 }
119 139
120 } // namespace bin 140 } // namespace bin
121 } // namespace dart 141 } // namespace dart
122 142
123 #endif // defined(TARGET_OS_LINUX) 143 #endif // defined(TARGET_OS_LINUX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698