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

Unified Diff: runtime/bin/directory_win.cc

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style issues Created 8 years, 9 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/directory_posix.cc ('k') | runtime/bin/file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index 1faea98d59d3b30fa97245e3f4c70d1e4da55bae..4091a1550cd0b09274ef7c59d4a66269489f43fa 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -338,69 +338,53 @@ bool Directory::Create(const char* dir_name) {
}
-int Directory::CreateTemp(const char* const_template,
- char** path,
- char* os_error_message,
- int os_error_message_len) {
+char* Directory::CreateTemp(const char* const_template) {
// Returns a new, unused directory name, modifying the contents of
// dir_template. Creates this directory, with a default security
// descriptor inherited from its parent directory.
// The return value must be freed by the caller.
- *path = static_cast<char*>(malloc(MAX_PATH));
+ char* path = static_cast<char*>(malloc(MAX_PATH));
int path_length;
if (0 == strncmp(const_template, "", 1)) {
- path_length = GetTempPath(MAX_PATH, *path);
+ path_length = GetTempPath(MAX_PATH, path);
if (path_length == 0) {
- free(*path);
- *path = NULL;
- int error_code =
- SetOsErrorMessage(os_error_message, os_error_message_len);
- return error_code;
+ free(path);
+ return NULL;
}
} else {
- snprintf(*path, MAX_PATH, "%s", const_template);
- path_length = strlen(*path);
+ snprintf(path, MAX_PATH, "%s", const_template);
+ path_length = strlen(path);
}
// Length of tempdir-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is 44.
if (path_length > MAX_PATH - 44) {
- free(*path);
- *path = NULL;
- return -1;
+ free(path);
+ return NULL;
}
- if ((*path)[path_length - 1] == '\\') {
+ if ((path)[path_length - 1] == '\\') {
// No base name for the directory - use "tempdir".
- snprintf(*path + path_length, MAX_PATH - path_length, "tempdir");
- path_length = strlen(*path);
+ snprintf(path + path_length, MAX_PATH - path_length, "tempdir");
+ path_length = strlen(path);
}
UUID uuid;
RPC_STATUS status = UuidCreateSequential(&uuid);
if (status != RPC_S_OK && status != RPC_S_UUID_LOCAL_ONLY) {
- free(*path);
- *path = NULL;
- int error_code =
- SetOsErrorMessage(os_error_message, os_error_message_len);
- return error_code;
+ free(path);
+ return NULL;
}
RPC_CSTR uuid_string;
status = UuidToString(&uuid, &uuid_string);
if (status != RPC_S_OK) {
- free(*path);
- *path = NULL;
- int error_code =
- SetOsErrorMessage(os_error_message, os_error_message_len);
- return error_code;
+ free(path);
+ return NULL;
}
- snprintf(*path + path_length, MAX_PATH - path_length, "-%s", uuid_string);
- if (!CreateDirectory(*path, NULL)) {
- free(*path);
- *path = NULL;
- int error_code =
- SetOsErrorMessage(os_error_message, os_error_message_len);
- return error_code;
+ snprintf(path + path_length, MAX_PATH - path_length, "-%s", uuid_string);
+ if (!CreateDirectory(path, NULL)) {
+ free(path);
+ return NULL;
}
- return 0;
+ return path;
}
« no previous file with comments | « runtime/bin/directory_posix.cc ('k') | runtime/bin/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698