comparison src/os/windows/vm/os_windows.cpp @ 10202:0b55a78c6be5

Merge
author bharadwaj
date Fri, 26 Apr 2013 10:52:26 -0700
parents cc12becb22e7 e12c9b3740db
children f9be75d21404
comparison
equal deleted inserted replaced
10146:57ac6a688ae6 10202:0b55a78c6be5
1219 return retval; 1219 return retval;
1220 } 1220 }
1221 1221
1222 // Needs to be in os specific directory because windows requires another 1222 // Needs to be in os specific directory because windows requires another
1223 // header file <direct.h> 1223 // header file <direct.h>
1224 const char* os::get_current_directory(char *buf, int buflen) { 1224 const char* os::get_current_directory(char *buf, size_t buflen) {
1225 return _getcwd(buf, buflen); 1225 int n = static_cast<int>(buflen);
1226 if (buflen > INT_MAX) n = INT_MAX;
1227 return _getcwd(buf, n);
1226 } 1228 }
1227 1229
1228 //----------------------------------------------------------- 1230 //-----------------------------------------------------------
1229 // Helper functions for fatal error handler 1231 // Helper functions for fatal error handler
1230 #ifdef _WIN64 1232 #ifdef _WIN64
4096 } 4098 }
4097 os::native_path(strcpy(pathbuf, path)); 4099 os::native_path(strcpy(pathbuf, path));
4098 return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode); 4100 return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
4099 } 4101 }
4100 4102
4103 FILE* os::open(int fd, const char* mode) {
4104 return ::_fdopen(fd, mode);
4105 }
4106
4101 // Is a (classpath) directory empty? 4107 // Is a (classpath) directory empty?
4102 bool os::dir_is_empty(const char* path) { 4108 bool os::dir_is_empty(const char* path) {
4103 WIN32_FIND_DATA fd; 4109 WIN32_FIND_DATA fd;
4104 HANDLE f = FindFirstFile(path, &fd); 4110 HANDLE f = FindFirstFile(path, &fd);
4105 if (f == INVALID_HANDLE_VALUE) { 4111 if (f == INVALID_HANDLE_VALUE) {