diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2009-12-18 22:21:11 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2009-12-18 22:21:11 +0000 |
commit | ddd2eca3f0fdf8026910c52a4d2904d2caed5b2d (patch) | |
tree | 843bf660ec2d236607a30db0cdd8e21acd5e8fb5 /file_io/win32 | |
parent | 35627a0494030c78113e88b532ce2ac9fbd5a54c (diff) | |
download | apr-ddd2eca3f0fdf8026910c52a4d2904d2caed5b2d.tar.gz |
Cleanups for various gcc warnings, conditional assignment and type errors
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@892387 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/win32')
-rw-r--r-- | file_io/win32/dir.c | 24 | ||||
-rw-r--r-- | file_io/win32/filedup.c | 1 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 12 | ||||
-rw-r--r-- | file_io/win32/filesys.c | 12 | ||||
-rw-r--r-- | file_io/win32/open.c | 34 | ||||
-rw-r--r-- | file_io/win32/readwrite.c | 4 | ||||
-rw-r--r-- | file_io/win32/seek.c | 4 |
7 files changed, 48 insertions, 43 deletions
diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c index 9e16bc197..574e7270c 100644 --- a/file_io/win32/dir.c +++ b/file_io/win32/dir.c @@ -76,8 +76,8 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, ELSE_WIN_OS_IS_ANSI { /* Note that we won't open a directory that is greater than MAX_PATH, - * including the trailing /* wildcard suffix. If a * won't fit, then - * neither will any other file name within the directory. + * counting the additional '/' '*' wildcard suffix. If a * won't fit + * then neither will any other file name within the directory. * The length not including the trailing '*' is stored as rootlen, to * skip over all paths which are too long. */ @@ -128,9 +128,9 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, if (thedir->dirhand == INVALID_HANDLE_VALUE) { apr_status_t rv; - if (rv = utf8_to_unicode_path(wdirname, sizeof(wdirname) - / sizeof(apr_wchar_t), - thedir->dirname)) { + if ((rv = utf8_to_unicode_path(wdirname, sizeof(wdirname) + / sizeof(apr_wchar_t), + thedir->dirname))) { return rv; } eos = wcschr(wdirname, '\0'); @@ -162,8 +162,8 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, return apr_get_os_error(); } } - if (rv = unicode_to_utf8_path(thedir->name, APR_FILE_MAX * 3 + 1, - thedir->w.entry->cFileName)) + if ((rv = unicode_to_utf8_path(thedir->name, APR_FILE_MAX * 3 + 1, + thedir->w.entry->cFileName))) return rv; fname = thedir->name; } @@ -280,8 +280,9 @@ APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + if ((rv = utf8_to_unicode_path(wpath, + sizeof(wpath) / sizeof(apr_wchar_t), + path))) { return rv; } if (!CreateDirectoryW(wpath, NULL)) { @@ -357,8 +358,9 @@ APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool) { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + if ((rv = utf8_to_unicode_path(wpath, + sizeof(wpath) / sizeof(apr_wchar_t), + path))) { return rv; } if (!RemoveDirectoryW(wpath)) { diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c index 2c9a34291..99f2a0a0e 100644 --- a/file_io/win32/filedup.c +++ b/file_io/win32/filedup.c @@ -72,7 +72,6 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, #ifdef _WIN32_WCE return APR_ENOTIMPL; #else - DWORD stdhandle = 0; HANDLE hproc = GetCurrentProcess(); HANDLE newhand = NULL; apr_int32_t newflags; diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index f409fc247..f2119d075 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -439,7 +439,7 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t want * don't need to take chances while the handle is already open. */ DWORD FileType; - if (FileType = GetFileType(thefile->filehand)) { + if ((FileType = GetFileType(thefile->filehand))) { if (FileType == FILE_TYPE_CHAR) { finfo->filetype = APR_CHR; } @@ -532,8 +532,8 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, wanted &= ~finfo->valid; } - if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) - / sizeof(apr_wchar_t), fname)) + if ((rv = utf8_to_unicode_path(wfname, sizeof(wfname) + / sizeof(apr_wchar_t), fname))) return rv; if (!(wanted & APR_FINFO_NAME)) { if (!GetFileAttributesExW(wfname, GetFileExInfoStandard, @@ -718,9 +718,9 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - if (rv = utf8_to_unicode_path(wfname, - sizeof(wfname) / sizeof(wfname[0]), - fname)) + if ((rv = utf8_to_unicode_path(wfname, + sizeof(wfname) / sizeof(wfname[0]), + fname))) return rv; flags = GetFileAttributesW(wfname); } diff --git a/file_io/win32/filesys.c b/file_io/win32/filesys.c index ad31e3387..e81213955 100644 --- a/file_io/win32/filesys.c +++ b/file_io/win32/filesys.c @@ -70,8 +70,8 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p) if (apr_os_level >= APR_WIN_NT) { apr_wchar_t wpath[APR_PATH_MAX]; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) + if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) + / sizeof(apr_wchar_t), path))) return rv; rv = GetDriveTypeW(wpath); } @@ -143,8 +143,8 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) /* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" * as if that is useful for anything. */ - if (rv = utf8_to_unicode_path(wroot, sizeof(wroot) - / sizeof(apr_wchar_t), root)) + if ((rv = utf8_to_unicode_path(wroot, sizeof(wroot) + / sizeof(apr_wchar_t), root))) return rv; if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored)) return apr_get_os_error(); @@ -211,8 +211,8 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), rootpath)) + if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) + / sizeof(apr_wchar_t), rootpath))) return rv; if (!SetCurrentDirectoryW(wpath)) return apr_get_os_error(); diff --git a/file_io/win32/open.c b/file_io/win32/open.c index 5af4dd4a5..33909ecf1 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -86,7 +86,7 @@ apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, } } - if (rv = apr_conv_utf8_to_ucs2(srcstr, &srcremains, t, &retlen)) { + if ((rv = apr_conv_utf8_to_ucs2(srcstr, &srcremains, t, &retlen))) { return (rv == APR_INCOMPLETE) ? APR_EINVAL : rv; } if (srcremains) { @@ -127,7 +127,7 @@ apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, } } - if (rv = apr_conv_ucs2_to_utf8(srcstr, &srcremains, t, &retlen)) { + if ((rv = apr_conv_ucs2_to_utf8(srcstr, &srcremains, t, &retlen))) { return rv; } if (srcremains) { @@ -169,7 +169,7 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) wfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t)); wcscpy(wfile, wpre); d = n; - if (rv = apr_conv_utf8_to_ucs2(file, &n, wfile + r, &d)) { + if ((rv = apr_conv_utf8_to_ucs2(file, &n, wfile + r, &d))) { return NULL; } for (ch = wfile + r; *ch; ++ch) { @@ -415,8 +415,8 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, attributes |= FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED; } - if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) - / sizeof(apr_wchar_t), fname)) + if ((rv = utf8_to_unicode_path(wfname, sizeof(wfname) + / sizeof(apr_wchar_t), fname))) return rv; handle = CreateFileW(wfname, oflags, sharemode, NULL, createflags, attributes, 0); @@ -511,8 +511,8 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) + / sizeof(apr_wchar_t), path))) { return rv; } if (DeleteFileW(wpath)) @@ -536,12 +536,14 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, #if APR_HAS_UNICODE_FS apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX]; apr_status_t rv; - if (rv = utf8_to_unicode_path(wfrompath, sizeof(wfrompath) - / sizeof(apr_wchar_t), frompath)) { + if ((rv = utf8_to_unicode_path(wfrompath, + sizeof(wfrompath) / sizeof(apr_wchar_t), + frompath))) { return rv; } - if (rv = utf8_to_unicode_path(wtopath, sizeof(wtopath) - / sizeof(apr_wchar_t), topath)) { + if ((rv = utf8_to_unicode_path(wtopath, + sizeof(wtopath) / sizeof(apr_wchar_t), + topath))) { return rv; } #ifndef _WIN32_WCE @@ -593,11 +595,13 @@ APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, apr_wchar_t wfrom_path[APR_PATH_MAX]; apr_wchar_t wto_path[APR_PATH_MAX]; - if (rv = utf8_to_unicode_path(wfrom_path, sizeof(wfrom_path) - / sizeof(apr_wchar_t), from_path)) + if ((rv = utf8_to_unicode_path(wfrom_path, + sizeof(wfrom_path) / sizeof(apr_wchar_t), + from_path))) return rv; - if (rv = utf8_to_unicode_path(wto_path, sizeof(wto_path) - / sizeof(apr_wchar_t), to_path)) + if ((rv = utf8_to_unicode_path(wto_path, + sizeof(wto_path) / sizeof(apr_wchar_t), + to_path))) return rv; if (!CreateHardLinkW(wto_path, wfrom_path, NULL)) diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c index b61c7d0a3..4d405c435 100644 --- a/file_io/win32/readwrite.c +++ b/file_io/win32/readwrite.c @@ -265,8 +265,8 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a if (thefile->direction == 0) { // Position file pointer for writing at the offset we are logically reading from apr_off_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; - apr_uint32_t offlo = (apr_uint32_t)offset; - apr_int32_t offhi = (apr_int32_t)(offset >> 32); + DWORD offlo = (DWORD)offset; + LONG offhi = (LONG)(offset >> 32); if (offset != thefile->filePtr) SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); thefile->bufpos = thefile->dataRead = 0; diff --git a/file_io/win32/seek.c b/file_io/win32/seek.c index 53e53dd7d..7a1124cf4 100644 --- a/file_io/win32/seek.c +++ b/file_io/win32/seek.c @@ -44,7 +44,7 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) rv = APR_SUCCESS; } else { DWORD offlo = (DWORD)pos; - DWORD offhi = (DWORD)(pos >> 32); + LONG offhi = (LONG)(pos >> 32); rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); if (rc == (DWORD)-1) @@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *thefile, apr_off_t offset) { apr_status_t rv; DWORD offlo = (DWORD)offset; - DWORD offhi = (DWORD)(offset >> 32); + LONG offhi = (LONG)(offset >> 32); DWORD rc; rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); |