28b43144e5
when interacting with the system. What we get from and need to hand to the VM is utf8. What we get from and need to hand to the system is in the current code page. R=sgjesse@google.com BUG= Review URL: https://codereview.chromium.org//11275281 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14851 260f80e4-7a28-3924-810f-c04153c831b5
45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include <errno.h>
|
|
#include <netdb.h>
|
|
|
|
#include "bin/utils.h"
|
|
#include "platform/assert.h"
|
|
|
|
OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) {
|
|
set_sub_system(kSystem);
|
|
set_code(errno);
|
|
SetMessage(strerror(errno));
|
|
}
|
|
|
|
|
|
void OSError::SetCodeAndMessage(SubSystem sub_system, int code) {
|
|
set_sub_system(sub_system);
|
|
set_code(code);
|
|
if (sub_system == kSystem) {
|
|
SetMessage(strerror(code));
|
|
} else if (sub_system == kGetAddressInfo) {
|
|
SetMessage(gai_strerror(code));
|
|
} else {
|
|
UNREACHABLE();
|
|
}
|
|
}
|
|
|
|
const char* StringUtils::SystemStringToUtf8(const char* str) {
|
|
return str;
|
|
}
|
|
|
|
const char* StringUtils::Utf8ToSystemString(const char* utf8) {
|
|
return utf8;
|
|
}
|
|
|
|
char* StringUtils::SystemStringToUtf8(char* str) {
|
|
return str;
|
|
}
|
|
|
|
char* StringUtils::Utf8ToSystemString(char* utf8) {
|
|
return utf8;
|
|
}
|