os0file.c:

  Fix Visual C++ compilation errors reported by Miguel
parent d3827c1b
...@@ -213,17 +213,20 @@ os_file_get_last_error( ...@@ -213,17 +213,20 @@ os_file_get_last_error(
if (report_all_errors if (report_all_errors
|| (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) { || (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n", err);
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
err);
if (err == ERROR_PATH_NOT_FOUND) { if (err == ERROR_PATH_NOT_FOUND) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means the system cannot find the path specified.\n" "InnoDB: The error means the system cannot find the path specified.\n");
"InnoDB: In installation you must create directories yourself, InnoDB\n"
"InnoDB: does not create them.\n"); if (srv_is_being_started) {
fprintf(stderr,
"InnoDB: If you are installing InnoDB, remember that you must create\n"
"InnoDB: directories yourself, InnoDB does not create them.\n");
}
} else if (err == ERROR_ACCESS_DENIED) { } else if (err == ERROR_ACCESS_DENIED) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means mysqld does not have the access rights to\n" "InnoDB: The error means mysqld does not have the access rights to\n"
...@@ -252,18 +255,20 @@ os_file_get_last_error( ...@@ -252,18 +255,20 @@ os_file_get_last_error(
if (report_all_errors if (report_all_errors
|| (err != ENOSPC && err != EEXIST)) { || (err != ENOSPC && err != EEXIST)) {
ut_print_timestamp(stderr);
ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n", err);
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
err);
if (err == ENOENT) { if (err == ENOENT) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means the system cannot find the path specified.\n" "InnoDB: The error means the system cannot find the path specified.\n");
"InnoDB: In installation you must create directories yourself, InnoDB\n"
"InnoDB: does not create them.\n"); if (srv_is_being_started) {
fprintf(stderr,
"InnoDB: If you are installing InnoDB, remember that you must create\n"
"InnoDB: directories yourself, InnoDB does not create them.\n");
}
} else if (err == EACCES) { } else if (err == EACCES) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The error means mysqld does not have the access rights to\n" "InnoDB: The error means mysqld does not have the access rights to\n"
...@@ -404,7 +409,7 @@ os_file_opendir( ...@@ -404,7 +409,7 @@ os_file_opendir(
ut_a(strlen(dirname) < OS_FILE_MAX_PATH); ut_a(strlen(dirname) < OS_FILE_MAX_PATH);
strcpy(path, dirname); strcpy(path, dirname);
strcpy(path + strlen(path), "\*"); strcpy(path + strlen(path), "\\");
/* Note that in Windows opening the 'directory stream' also retrieves /* Note that in Windows opening the 'directory stream' also retrieves
the first entry in the directory. Since it is '.', that is no problem, the first entry in the directory. Since it is '.', that is no problem,
...@@ -493,18 +498,18 @@ next_file: ...@@ -493,18 +498,18 @@ next_file:
ret = FindNextFile(dir, lpFindFileData); ret = FindNextFile(dir, lpFindFileData);
if (ret) { if (ret) {
ut_a(strlen(lpFindFileData->cFilename) < OS_FILE_MAX_PATH); ut_a(strlen(lpFindFileData->cFileName) < OS_FILE_MAX_PATH);
if (strcmp(lpFindFileData->cFilename, ".") == 0 if (strcmp(lpFindFileData->cFileName, ".") == 0
|| strcmp(lpFindFileData->cFilename, "..") == 0) { || strcmp(lpFindFileData->cFileName, "..") == 0) {
goto next_file; goto next_file;
} }
strcpy(info->name, lpFindFileData->cFilename); strcpy(info->name, lpFindFileData->cFileName);
info->size = (ib_longlong)(buf->nFileSizeLow) info->size = (ib_longlong)(lpFindFileData->nFileSizeLow)
+ (((ib_longlong)(buf->nFileSizeHigh)) << 32); + (((ib_longlong)(lpFindFileData->nFileSizeHigh)) << 32);
if (lpFindFileData->dwFileAttributes if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_REPARSE_POINT) { & FILE_ATTRIBUTE_REPARSE_POINT) {
...@@ -827,14 +832,13 @@ os_file_create( ...@@ -827,14 +832,13 @@ os_file_create(
DWORD create_flag; DWORD create_flag;
DWORD attributes; DWORD attributes;
ibool retry; ibool retry;
try_again: try_again:
ut_a(name); ut_a(name);
if (create_mode == OS_FILE_OPEN_RAW) { if (create_mode == OS_FILE_OPEN_RAW) {
create_flag = OPEN_EXISTING; create_flag = OPEN_EXISTING;
share_mode = FILE_SHARE_WRITE; share_mode = FILE_SHARE_WRITE;
if (create_mode == OS_FILE_OPEN) { } else if (create_mode == OS_FILE_OPEN) {
create_flag = OPEN_EXISTING; create_flag = OPEN_EXISTING;
} else if (create_mode == OS_FILE_CREATE) { } else if (create_mode == OS_FILE_CREATE) {
create_flag = CREATE_NEW; create_flag = CREATE_NEW;
...@@ -927,15 +931,12 @@ try_again: ...@@ -927,15 +931,12 @@ try_again:
if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) { if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) {
mode_str = "OPEN"; mode_str = "OPEN";
create_flag = O_RDWR; create_flag = O_RDWR;
} else if (create_mode == OS_FILE_CREATE) { } else if (create_mode == OS_FILE_CREATE) {
mode_str = "CREATE"; mode_str = "CREATE";
create_flag = O_RDWR | O_CREAT | O_EXCL; create_flag = O_RDWR | O_CREAT | O_EXCL;
} else if (create_mode == OS_FILE_OVERWRITE) { } else if (create_mode == OS_FILE_OVERWRITE) {
mode_str = "OVERWRITE"; mode_str = "OVERWRITE";
create_flag = O_RDWR | O_CREAT | O_TRUNC; create_flag = O_RDWR | O_CREAT | O_TRUNC;
} else { } else {
create_flag = 0; create_flag = 0;
...@@ -1015,7 +1016,6 @@ os_file_delete( ...@@ -1015,7 +1016,6 @@ os_file_delete(
char* name) /* in: file path as a null-terminated string */ char* name) /* in: file path as a null-terminated string */
{ {
#ifdef __WIN__ #ifdef __WIN__
os_file_t dummy = NULL;
BOOL ret; BOOL ret;
ret = DeleteFile((LPCTSTR)name); ret = DeleteFile((LPCTSTR)name);
...@@ -1024,17 +1024,16 @@ os_file_delete( ...@@ -1024,17 +1024,16 @@ os_file_delete(
return(TRUE); return(TRUE);
} }
os_file_handle_error(dummy, name, "delete"); os_file_handle_error(NULL, name, "delete");
return(FALSE); return(FALSE);
#else #else
os_file_t dummy = 0;
int ret; int ret;
ret = unlink((const char*)name); ret = unlink((const char*)name);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(dummy, name, "delete"); os_file_handle_error(0, name, "delete");
return(FALSE); return(FALSE);
} }
...@@ -1056,7 +1055,6 @@ os_file_rename( ...@@ -1056,7 +1055,6 @@ os_file_rename(
char* newpath) /* in: new file path */ char* newpath) /* in: new file path */
{ {
#ifdef __WIN__ #ifdef __WIN__
os_file_t dummy = NULL;
BOOL ret; BOOL ret;
ret = MoveFile((LPCTSTR)oldpath, (LPCTSTR)newpath); ret = MoveFile((LPCTSTR)oldpath, (LPCTSTR)newpath);
...@@ -1065,17 +1063,16 @@ os_file_rename( ...@@ -1065,17 +1063,16 @@ os_file_rename(
return(TRUE); return(TRUE);
} }
os_file_handle_error(dummy, oldpath, "delete"); os_file_handle_error(NULL, oldpath, "delete");
return(FALSE); return(FALSE);
#else #else
os_file_t dummy = 0;
int ret; int ret;
ret = rename((const char*)oldpath, (const char*)newpath); ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(dummy, oldpath, "rename"); os_file_handle_error(0, oldpath, "rename");
return(FALSE); return(FALSE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment