You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2011/03/21 15:58:47 UTC

svn commit: r1083815 - in /apr/apr/branches/1.4.x: file_io/win32/dir.c file_io/win32/filedup.c file_io/win32/filestat.c file_io/win32/filesys.c file_io/win32/open.c file_io/win32/readwrite.c file_io/win32/seek.c memory/unix/apr_pools.c

Author: trawick
Date: Mon Mar 21 14:58:46 2011
New Revision: 1083815

URL: http://svn.apache.org/viewvc?rev=1083815&view=rev
Log:
Merge r892387 from trunk:

Cleanups for various gcc warnings, conditional assignment and type errors
Submitted by: wrowe
Reviewed by: trawick

Modified:
    apr/apr/branches/1.4.x/file_io/win32/dir.c
    apr/apr/branches/1.4.x/file_io/win32/filedup.c
    apr/apr/branches/1.4.x/file_io/win32/filestat.c
    apr/apr/branches/1.4.x/file_io/win32/filesys.c
    apr/apr/branches/1.4.x/file_io/win32/open.c
    apr/apr/branches/1.4.x/file_io/win32/readwrite.c
    apr/apr/branches/1.4.x/file_io/win32/seek.c
    apr/apr/branches/1.4.x/memory/unix/apr_pools.c

Modified: apr/apr/branches/1.4.x/file_io/win32/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/dir.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/dir.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/dir.c Mon Mar 21 14:58:46 2011
@@ -76,8 +76,8 @@ APR_DECLARE(apr_status_t) apr_dir_open(a
     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(a
         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(a
                 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(c
     {
         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
     {
         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)) {

Modified: apr/apr/branches/1.4.x/file_io/win32/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/filedup.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/filedup.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/filedup.c Mon Mar 21 14:58:46 2011
@@ -71,7 +71,6 @@ APR_DECLARE(apr_status_t) apr_file_dup2(
 #ifdef _WIN32_WCE
     return APR_ENOTIMPL;
 #else
-    DWORD stdhandle = 0;
     HANDLE hproc = GetCurrentProcess();
     HANDLE newhand = NULL;
     apr_int32_t newflags;

Modified: apr/apr/branches/1.4.x/file_io/win32/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/filestat.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/filestat.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/filestat.c Mon Mar 21 14:58:46 2011
@@ -439,7 +439,7 @@ APR_DECLARE(apr_status_t) apr_file_info_
          * 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_f
                 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
 #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);
     }

Modified: apr/apr/branches/1.4.x/file_io/win32/filesys.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/filesys.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/filesys.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/filesys.c Mon Mar 21 14:58:46 2011
@@ -70,8 +70,8 @@ apr_status_t filepath_root_test(char *pa
     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 **r
         /* ???: 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_s
     {
         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();

Modified: apr/apr/branches/1.4.x/file_io/win32/open.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/open.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/open.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/open.c Mon Mar 21 14:58:46 2011
@@ -86,7 +86,7 @@ apr_status_t utf8_to_unicode_path(apr_wc
         }
     }
 
-    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* 
         }
     }
         
-    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 
         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(
             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);
@@ -510,8 +510,8 @@ APR_DECLARE(apr_status_t) apr_file_remov
     {
         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))
@@ -535,12 +535,14 @@ APR_DECLARE(apr_status_t) apr_file_renam
 #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
@@ -592,11 +594,13 @@ APR_DECLARE(apr_status_t) apr_file_link(
         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))

Modified: apr/apr/branches/1.4.x/file_io/win32/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/readwrite.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/readwrite.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/readwrite.c Mon Mar 21 14:58:46 2011
@@ -266,7 +266,7 @@ APR_DECLARE(apr_status_t) apr_file_write
             /* Position file pointer for writing at the offset we are logically reading from */
             apr_off_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
             DWORD offlo = (DWORD)offset;
-            DWORD offhi = (DWORD)(offset >> 32);
+            LONG  offhi = (LONG)(offset >> 32);
             if (offset != thefile->filePtr)
                 SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN);
             thefile->bufpos = thefile->dataRead = 0;

Modified: apr/apr/branches/1.4.x/file_io/win32/seek.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/seek.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/seek.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/seek.c Mon Mar 21 14:58:46 2011
@@ -44,7 +44,7 @@ static apr_status_t setptr(apr_file_t *t
         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_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);

Modified: apr/apr/branches/1.4.x/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/memory/unix/apr_pools.c?rev=1083815&r1=1083814&r2=1083815&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/memory/unix/apr_pools.c (original)
+++ apr/apr/branches/1.4.x/memory/unix/apr_pools.c Mon Mar 21 14:58:46 2011
@@ -553,7 +553,6 @@ static apr_file_t *file_stderr = NULL;
  */
 
 static void run_cleanups(cleanup_t **c);
-static void run_child_cleanups(cleanup_t **c);
 static void free_proc_chain(struct process_chain *procs);
 
 #if APR_POOL_DEBUG
@@ -2349,6 +2348,8 @@ static void run_cleanups(cleanup_t **cre
     }
 }
 
+#if !defined(WIN32) && !defined(OS2)
+
 static void run_child_cleanups(cleanup_t **cref)
 {
     cleanup_t *c = *cref;
@@ -2370,20 +2371,28 @@ static void cleanup_pool_for_exec(apr_po
 
 APR_DECLARE(void) apr_pool_cleanup_for_exec(void)
 {
-#if !defined(WIN32) && !defined(OS2)
+    cleanup_pool_for_exec(global_pool);
+}
+
+#else /* !defined(WIN32) && !defined(OS2) */
+
+APR_DECLARE(void) apr_pool_cleanup_for_exec(void)
+{
     /*
-     * Don't need to do anything on NT or OS/2, because I
-     * am actually going to spawn the new process - not
-     * exec it. All handles that are not inheritable, will
-     * be automajically closed. The only problem is with
-     * file handles that are open, but there isn't much
-     * I can do about that (except if the child decides
-     * to go out and close them
+     * Don't need to do anything on NT or OS/2, because 
+     * these platforms will spawn the new process - not
+     * fork for exec. All handles that are not inheritable,
+     * will be automajically closed. The only problem is
+     * with file handles that are open, but there isn't
+     * much that can be done about that (except if the
+     * child decides to go out and close them, or the
+     * developer quits opening them shared)
      */
-    cleanup_pool_for_exec(global_pool);
-#endif /* !defined(WIN32) && !defined(OS2) */
+    return;
 }
 
+#endif /* !defined(WIN32) && !defined(OS2) */
+
 APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data)
 {
     /* do nothing cleanup routine */