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

Unified Diff: runtime/bin/directory_openbsd.cc

Issue 1559053002: Refs #10260 OpenBSD support #25327 Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review issues Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/crypto_openbsd.cc ('k') | runtime/bin/eventhandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_openbsd.cc
diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_openbsd.cc
similarity index 98%
copy from runtime/bin/directory_macos.cc
copy to runtime/bin/directory_openbsd.cc
index 55994aa79abdd26998d52d5f3a4de0f706bd918a..2ef33a3a7622105883ecad57470e0aec5632fe6c 100644
--- a/runtime/bin/directory_macos.cc
+++ b/runtime/bin/directory_openbsd.cc
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#include "platform/globals.h"
-#if defined(TARGET_OS_MACOS)
+#if defined(TARGET_OS_OPENBSD)
#include "bin/directory.h"
@@ -28,20 +28,24 @@ PathBuffer::PathBuffer() : length_(0) {
data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT
}
+
bool PathBuffer::AddW(const wchar_t* name) {
UNREACHABLE();
return false;
}
+
char* PathBuffer::AsString() const {
return reinterpret_cast<char*>(data_);
}
+
wchar_t* PathBuffer::AsStringW() const {
UNREACHABLE();
return NULL;
}
+
bool PathBuffer::Add(const char* name) {
char* data = AsString();
int written = snprintf(data + length_,
@@ -51,7 +55,7 @@ bool PathBuffer::Add(const char* name) {
data[PATH_MAX] = '\0';
if (written <= PATH_MAX - length_ &&
written >= 0 &&
- static_cast<size_t>(written) == strlen(name)) {
+ static_cast<size_t>(written) == strnlen(name, PATH_MAX + 1)) {
length_ += written;
return true;
} else {
@@ -60,6 +64,7 @@ bool PathBuffer::Add(const char* name) {
}
}
+
void PathBuffer::Reset(int new_length) {
length_ = new_length;
AsString()[length_] = '\0';
@@ -431,4 +436,4 @@ bool Directory::Rename(const char* path, const char* new_path) {
} // namespace bin
} // namespace dart
-#endif // defined(TARGET_OS_MACOS)
+#endif // defined(TARGET_OS_OPENBSD)
« no previous file with comments | « runtime/bin/crypto_openbsd.cc ('k') | runtime/bin/eventhandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698