apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r892387 - in /apr/apr/trunk: 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
Date Fri, 18 Dec 2009 22:21:12 GMT
Author: wrowe
Date: Fri Dec 18 22:21:11 2009
New Revision: 892387

URL: http://svn.apache.org/viewvc?rev=892387&view=rev
Log:
Cleanups for various gcc warnings, conditional assignment and type errors

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

Modified: apr/apr/trunk/file_io/win32/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/dir.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/dir.c (original)
+++ apr/apr/trunk/file_io/win32/dir.c Fri Dec 18 22:21:11 2009
@@ -76,8 +76,8 @@
     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 @@
         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 @@
                 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_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_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/trunk/file_io/win32/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filedup.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filedup.c (original)
+++ apr/apr/trunk/file_io/win32/filedup.c Fri Dec 18 22:21:11 2009
@@ -72,7 +72,6 @@
 #ifdef _WIN32_WCE
     return APR_ENOTIMPL;
 #else
-    DWORD stdhandle = 0;
     HANDLE hproc = GetCurrentProcess();
     HANDLE newhand = NULL;
     apr_int32_t newflags;

Modified: apr/apr/trunk/file_io/win32/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filestat.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filestat.c (original)
+++ apr/apr/trunk/file_io/win32/filestat.c Fri Dec 18 22:21:11 2009
@@ -439,7 +439,7 @@
          * 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 @@
                 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 @@
 #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/trunk/file_io/win32/filesys.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filesys.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filesys.c (original)
+++ apr/apr/trunk/file_io/win32/filesys.c Fri Dec 18 22:21:11 2009
@@ -70,8 +70,8 @@
     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 @@
         /* ???: 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_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/trunk/file_io/win32/open.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/open.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/open.c (original)
+++ apr/apr/trunk/file_io/win32/open.c Fri Dec 18 22:21:11 2009
@@ -86,7 +86,7 @@
         }
     }
 
-    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 @@
         }
     }
         
-    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 @@
         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 @@
             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_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 @@
 #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_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/trunk/file_io/win32/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/readwrite.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/readwrite.c (original)
+++ apr/apr/trunk/file_io/win32/readwrite.c Fri Dec 18 22:21:11 2009
@@ -265,8 +265,8 @@
         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;

Modified: apr/apr/trunk/file_io/win32/seek.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/seek.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/seek.c (original)
+++ apr/apr/trunk/file_io/win32/seek.c Fri Dec 18 22:21:11 2009
@@ -44,7 +44,7 @@
         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_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/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=892387&r1=892386&r2=892387&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Fri Dec 18 22:21:11 2009
@@ -533,7 +533,6 @@
  */
 
 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
@@ -2323,6 +2322,8 @@
     }
 }
 
+#if !defined(WIN32) && !defined(OS2)
+
 static void run_child_cleanups(cleanup_t **cref)
 {
     cleanup_t *c = *cref;
@@ -2344,20 +2345,28 @@
 
 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 */



Mime
View raw message