diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
commit | a2a2e32c02643a0cec111511220227703fda1cd5 (patch) | |
tree | 69cc2b631234c2a8e026b9cd4d72676c61c594df /mysys/my_winfile.c | |
parent | Releasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff) | |
download | mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip |
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysys/my_winfile.c')
-rw-r--r-- | mysys/my_winfile.c | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/mysys/my_winfile.c b/mysys/my_winfile.c index 35bc6b35..7a1e3e60 100644 --- a/mysys/my_winfile.c +++ b/mysys/my_winfile.c @@ -89,17 +89,15 @@ static void invalidate_fd(File fd) /* Get Windows handle for a file descriptor */ HANDLE my_get_osfhandle(File fd) { - DBUG_ENTER("my_get_osfhandle"); DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit); - DBUG_RETURN(my_file_info[fd].fhandle); + return (my_file_info[fd].fhandle); } static int my_get_open_flags(File fd) { - DBUG_ENTER("my_get_open_flags"); DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit); - DBUG_RETURN(my_file_info[fd].oflag); + return (my_file_info[fd].oflag); } /* @@ -347,10 +345,8 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset) OVERLAPPED ov= {0}; LARGE_INTEGER li; - DBUG_ENTER("my_win_pread"); - if(!Count) - DBUG_RETURN(0); + return(0); #ifdef _WIN64 if(Count > UINT_MAX) Count= UINT_MAX; @@ -369,11 +365,11 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset) through e.g. a command pipe in windows : see MSDN on ReadFile. */ if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE) - DBUG_RETURN(0); /*return 0 at EOF*/ + return(0); /*return 0 at EOF*/ my_osmaperr(lastError); - DBUG_RETURN((size_t)-1); + return((size_t)-1); } - DBUG_RETURN(nBytesRead); + return(nBytesRead); } @@ -382,9 +378,8 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count) DWORD nBytesRead; HANDLE hFile; - DBUG_ENTER("my_win_read"); if(!Count) - DBUG_RETURN(0); + return(0); #ifdef _WIN64 if(Count > UINT_MAX) Count= UINT_MAX; @@ -400,11 +395,11 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count) through e.g. a command pipe in windows : see MSDN on ReadFile. */ if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE) - DBUG_RETURN(0); /*return 0 at EOF*/ + return(0); /*return 0 at EOF*/ my_osmaperr(lastError); - DBUG_RETURN((size_t)-1); + return((size_t)-1); } - DBUG_RETURN(nBytesRead); + return(nBytesRead); } @@ -416,12 +411,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count, OVERLAPPED ov= {0}; LARGE_INTEGER li; - DBUG_ENTER("my_win_pwrite"); - DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %llu, offset: %llu", - Filedes, Buffer, (ulonglong)Count, (ulonglong)offset)); - if(!Count) - DBUG_RETURN(0); + return(0); #ifdef _WIN64 if(Count > UINT_MAX) @@ -436,10 +427,10 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count, if(!WriteFile(hFile, Buffer, (DWORD)Count, &nBytesWritten, &ov)) { my_osmaperr(GetLastError()); - DBUG_RETURN((size_t)-1); + return((size_t)-1); } else - DBUG_RETURN(nBytesWritten); + return(nBytesWritten); } @@ -448,11 +439,9 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence) LARGE_INTEGER offset; LARGE_INTEGER newpos; - DBUG_ENTER("my_win_lseek"); - /* Check compatibility of Windows and Posix seek constants */ - compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR - && FILE_END == SEEK_END); + compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR && + FILE_END == SEEK_END); offset.QuadPart= pos; if(!SetFilePointerEx(my_get_osfhandle(fd), offset, &newpos, whence)) @@ -460,7 +449,7 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence) my_osmaperr(GetLastError()); newpos.QuadPart= -1; } - DBUG_RETURN(newpos.QuadPart); + return(newpos.QuadPart); } @@ -474,12 +463,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count) OVERLAPPED *pov= NULL; HANDLE hFile; - DBUG_ENTER("my_win_write"); - DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %llu", fd, Buffer, - (ulonglong)Count)); - if(!Count) - DBUG_RETURN(0); + return(0); #ifdef _WIN64 if(Count > UINT_MAX) @@ -502,9 +487,9 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count) if(!WriteFile(hFile, Buffer, (DWORD)Count, &nWritten, pov)) { my_osmaperr(GetLastError()); - DBUG_RETURN((size_t)-1); + return((size_t)-1); } - DBUG_RETURN(nWritten); + return(nWritten); } @@ -512,7 +497,6 @@ int my_win_chsize(File fd, my_off_t newlength) { HANDLE hFile; LARGE_INTEGER length; - DBUG_ENTER("my_win_chsize"); hFile= (HANDLE) my_get_osfhandle(fd); length.QuadPart= newlength; @@ -520,11 +504,11 @@ int my_win_chsize(File fd, my_off_t newlength) goto err; if (!SetEndOfFile(hFile)) goto err; - DBUG_RETURN(0); + return(0); err: my_osmaperr(GetLastError()); my_errno= errno; - DBUG_RETURN(-1); + return(-1); } @@ -555,7 +539,6 @@ File my_win_handle2File(HANDLE hFile) { int retval= -1; uint i; - DBUG_ENTER("my_win_handle2File"); for(i= MY_FILE_MIN; i < my_file_limit; i++) @@ -623,7 +606,6 @@ FILE * my_win_fdopen(File fd, const char *type) FILE *file; int crt_fd; int flags= 0; - DBUG_ENTER("my_win_fdopen"); if(strchr(type,'a') != NULL) @@ -641,8 +623,8 @@ FILE * my_win_fdopen(File fd, const char *type) int my_win_fclose(FILE *file) { File fd; - DBUG_ENTER("my_win_fclose"); + fd= my_fileno(file); if(fd < 0) DBUG_RETURN(-1); @@ -665,7 +647,6 @@ int my_win_fstat(File fd, struct _stati64 *buf) int crt_fd; int retval; HANDLE hFile, hDup; - DBUG_ENTER("my_win_fstat"); hFile= my_get_osfhandle(fd); |