You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mt...@apache.org on 2021/12/02 23:53:57 UTC

svn commit: r1895516 - in /apr/apr/trunk/file_io/win32: dir.c filepath.c filestat.c filesys.c open.c

Author: mturk
Date: Thu Dec  2 23:53:57 2021
New Revision: 1895516

URL: http://svn.apache.org/viewvc?rev=1895516&view=rev
Log:
TAB police ... get rid of missmatch of TAB and spaces through the code

Modified:
    apr/apr/trunk/file_io/win32/dir.c
    apr/apr/trunk/file_io/win32/filepath.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

Modified: apr/apr/trunk/file_io/win32/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/dir.c?rev=1895516&r1=1895515&r2=1895516&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/dir.c (original)
+++ apr/apr/trunk/file_io/win32/dir.c Thu Dec  2 23:53:57 2021
@@ -58,7 +58,7 @@ APR_DECLARE(apr_status_t) apr_dir_open(a
     (*new)->dirname = apr_palloc(pool, len + 3);
     memcpy((*new)->dirname, dirname, len);
     if (len && (*new)->dirname[len - 1] != '/') {
-    	(*new)->dirname[len++] = '/';
+        (*new)->dirname[len++] = '/';
     }
     (*new)->dirname[len++] = '\0';
     (*new)->dirname[len] = '\0';

Modified: apr/apr/trunk/file_io/win32/filepath.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filepath.c?rev=1895516&r1=1895515&r2=1895516&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filepath.c (original)
+++ apr/apr/trunk/file_io/win32/filepath.c Thu Dec  2 23:53:57 2021
@@ -977,6 +977,6 @@ APR_DECLARE(apr_status_t) apr_filepath_m
 
 APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p)
 {
-	*style = APR_FILEPATH_ENCODING_UTF8;
-	return APR_SUCCESS;
+    *style = APR_FILEPATH_ENCODING_UTF8;
+    return APR_SUCCESS;
 }

Modified: apr/apr/trunk/file_io/win32/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filestat.c?rev=1895516&r1=1895515&r2=1895516&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filestat.c (original)
+++ apr/apr/trunk/file_io/win32/filestat.c Thu Dec  2 23:53:57 2021
@@ -229,26 +229,26 @@ static int reparse_point_is_link(WIN32_F
     }
     else
     {
-		apr_wchar_t wfname[APR_PATH_MAX];
-		HANDLE hFind;
-		WIN32_FIND_DATAW fd;
+        apr_wchar_t wfname[APR_PATH_MAX];
+        HANDLE hFind;
+        WIN32_FIND_DATAW fd;
 
         if (test_safe_name(fname) != APR_SUCCESS) {
             return 0;
         }
 
-		if (utf8_to_unicode_path(wfname, APR_PATH_MAX, fname) != APR_SUCCESS) {
-			return 0;
-		}
-
-		hFind = FindFirstFileW(wfname, &fd);
-		if (hFind == INVALID_HANDLE_VALUE) {
-			return 0;
-		}
+        if (utf8_to_unicode_path(wfname, APR_PATH_MAX, fname) != APR_SUCCESS) {
+            return 0;
+        }
+
+        hFind = FindFirstFileW(wfname, &fd);
+        if (hFind == INVALID_HANDLE_VALUE) {
+            return 0;
+        }
 
-		FindClose(hFind);
+        FindClose(hFind);
 
-		tag = fd.dwReserved0;
+        tag = fd.dwReserved0;
     }
 
     // Test "Name surrogate bit" to detect any kind of symbolic link
@@ -567,59 +567,59 @@ APR_DECLARE(apr_status_t) apr_stat(apr_f
         return APR_ENAMETOOLONG;
     }
 
-	if ((wanted & (APR_FINFO_IDENT | APR_FINFO_NLINK)) 
-		   || (~wanted & APR_FINFO_LINK)) {
-		/* FindFirstFile and GetFileAttributesEx can't figure the inode,
-		 * device or number of links, so we need to resolve with an open 
-		 * file handle.  If the user has asked for these fields, fall over 
-		 * to the get file info by handle method.  If we fail, or the user
-		 * also asks for the file name, continue by our usual means.
-		 *
-		 * We also must use this method for a 'true' stat, that resolves
-		 * a symlink (NTFS Junction) target.  This is because all fileinfo
-		 * on a Junction always returns the junction, opening the target
-		 * is the only way to resolve the target's attributes.
-		 */
-		if ((ident_rv = resolve_ident(finfo, fname, wanted, pool)) 
-				== APR_SUCCESS)
-			return ident_rv;
-		else if (ident_rv == APR_INCOMPLETE)
-			wanted &= ~finfo->valid;
-	}
-
-	if ((rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
-										/ sizeof(apr_wchar_t), fname)))
-		return rv;
-	if (!(wanted & (APR_FINFO_NAME | APR_FINFO_LINK))) {
-		if (!GetFileAttributesExW(wfname, GetFileExInfoStandard, 
-								  &FileInfo.i))
-			return apr_get_os_error();
-	}
-	else {
-		/* Guard against bogus wildcards and retrieve by name
-		 * since we want the true name, and set aside a long
-		 * enough string to handle the longest file name.
-		 */
-		HANDLE hFind;
-		if ((rv = test_safe_name(fname)) != APR_SUCCESS) {
-			return rv;
-		}
-		hFind = FindFirstFileW(wfname, &FileInfo.w);
-		if (hFind == INVALID_HANDLE_VALUE)
-			return apr_get_os_error();
-		FindClose(hFind);
-		finddata = 1;
-
-		if (wanted & APR_FINFO_NAME)
-		{
-			char tmpname[APR_FILE_MAX * 3 + 1];
-			if (unicode_to_utf8_path(tmpname, sizeof(tmpname),
-									 FileInfo.w.cFileName)) {
-				return APR_ENAMETOOLONG;
-			}
-			filename = apr_pstrdup(pool, tmpname);
-		}
-	}
+    if ((wanted & (APR_FINFO_IDENT | APR_FINFO_NLINK)) 
+           || (~wanted & APR_FINFO_LINK)) {
+        /* FindFirstFile and GetFileAttributesEx can't figure the inode,
+         * device or number of links, so we need to resolve with an open 
+         * file handle.  If the user has asked for these fields, fall over 
+         * to the get file info by handle method.  If we fail, or the user
+         * also asks for the file name, continue by our usual means.
+         *
+         * We also must use this method for a 'true' stat, that resolves
+         * a symlink (NTFS Junction) target.  This is because all fileinfo
+         * on a Junction always returns the junction, opening the target
+         * is the only way to resolve the target's attributes.
+         */
+        if ((ident_rv = resolve_ident(finfo, fname, wanted, pool)) 
+                == APR_SUCCESS)
+            return ident_rv;
+        else if (ident_rv == APR_INCOMPLETE)
+            wanted &= ~finfo->valid;
+    }
+
+    if ((rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
+                                        / sizeof(apr_wchar_t), fname)))
+        return rv;
+    if (!(wanted & (APR_FINFO_NAME | APR_FINFO_LINK))) {
+        if (!GetFileAttributesExW(wfname, GetFileExInfoStandard, 
+                                  &FileInfo.i))
+            return apr_get_os_error();
+    }
+    else {
+        /* Guard against bogus wildcards and retrieve by name
+         * since we want the true name, and set aside a long
+         * enough string to handle the longest file name.
+         */
+        HANDLE hFind;
+        if ((rv = test_safe_name(fname)) != APR_SUCCESS) {
+            return rv;
+        }
+        hFind = FindFirstFileW(wfname, &FileInfo.w);
+        if (hFind == INVALID_HANDLE_VALUE)
+            return apr_get_os_error();
+        FindClose(hFind);
+        finddata = 1;
+
+        if (wanted & APR_FINFO_NAME)
+        {
+            char tmpname[APR_FILE_MAX * 3 + 1];
+            if (unicode_to_utf8_path(tmpname, sizeof(tmpname),
+                                     FileInfo.w.cFileName)) {
+                return APR_ENAMETOOLONG;
+            }
+            filename = apr_pstrdup(pool, tmpname);
+        }
+    }
 
     if (ident_rv != APR_INCOMPLETE) {
         if (fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) &FileInfo, 

Modified: apr/apr/trunk/file_io/win32/filesys.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filesys.c?rev=1895516&r1=1895515&r2=1895516&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filesys.c (original)
+++ apr/apr/trunk/file_io/win32/filesys.c Thu Dec  2 23:53:57 2021
@@ -66,12 +66,12 @@ const char apr_c_is_fnchar[256] =
 apr_status_t filepath_root_test(char *path, apr_pool_t *p)
 {
     apr_status_t rv;
-	apr_wchar_t wpath[APR_PATH_MAX];
+    apr_wchar_t wpath[APR_PATH_MAX];
 
-	if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
-										/ sizeof(apr_wchar_t), path)))
-		return rv;
-	rv = GetDriveTypeW(wpath);
+    if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
+                                        / sizeof(apr_wchar_t), path)))
+        return rv;
+    rv = GetDriveTypeW(wpath);
 
     if (rv == DRIVE_UNKNOWN || rv == DRIVE_NO_ROOT_DIR)
         return APR_EBADPATH;
@@ -83,19 +83,19 @@ apr_status_t filepath_drive_get(char **r
                                 apr_int32_t flags, apr_pool_t *p)
 {
     char path[APR_PATH_MAX];
-	apr_wchar_t *ignored;
-	apr_wchar_t wdrive[8];
-	apr_wchar_t wpath[APR_PATH_MAX];
-	apr_status_t rv;
-	/* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" 
-	 * as if that is useful for anything.
-	 */
-	wcscpy(wdrive, L"D:.");
-	wdrive[0] = (apr_wchar_t)(unsigned char)drive;
-	if (!GetFullPathNameW(wdrive, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored))
-		return apr_get_os_error();
-	if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
-		return rv;
+    apr_wchar_t *ignored;
+    apr_wchar_t wdrive[8];
+    apr_wchar_t wpath[APR_PATH_MAX];
+    apr_status_t rv;
+    /* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" 
+     * as if that is useful for anything.
+     */
+    wcscpy(wdrive, L"D:.");
+    wdrive[0] = (apr_wchar_t)(unsigned char)drive;
+    if (!GetFullPathNameW(wdrive, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored))
+        return apr_get_os_error();
+    if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
+        return rv;
     if (!(flags & APR_FILEPATH_NATIVE)) {
         for (*rootpath = path; **rootpath; ++*rootpath) {
             if (**rootpath == '\\')
@@ -109,24 +109,24 @@ apr_status_t filepath_drive_get(char **r
 
 apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
 {
-	apr_wchar_t *ignored;
-	apr_wchar_t wpath[APR_PATH_MAX];
-	apr_status_t rv;
-	apr_wchar_t wroot[APR_PATH_MAX];
-	/* ???: 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)))
-		return rv;
-	if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored))
-		return apr_get_os_error();
-
-	/* Borrow wroot as a char buffer (twice as big as necessary) 
-	 */
-	if ((rv = unicode_to_utf8_path((char*)wroot, sizeof(wroot), wpath)))
-		return rv;
-	*rootpath = apr_pstrdup(p, (char*)wroot);
+    apr_wchar_t *ignored;
+    apr_wchar_t wpath[APR_PATH_MAX];
+    apr_status_t rv;
+    apr_wchar_t wroot[APR_PATH_MAX];
+    /* ???: 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)))
+        return rv;
+    if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored))
+        return apr_get_os_error();
+
+    /* Borrow wroot as a char buffer (twice as big as necessary) 
+     */
+    if ((rv = unicode_to_utf8_path((char*)wroot, sizeof(wroot), wpath)))
+        return rv;
+    *rootpath = apr_pstrdup(p, (char*)wroot);
     return APR_SUCCESS;
 }
 
@@ -135,13 +135,13 @@ APR_DECLARE(apr_status_t) apr_filepath_g
                                            apr_pool_t *p)
 {
     char path[APR_PATH_MAX];
-	apr_wchar_t wpath[APR_PATH_MAX];
-	apr_status_t rv;
+    apr_wchar_t wpath[APR_PATH_MAX];
+    apr_status_t rv;
 
-	if (!GetCurrentDirectoryW(sizeof(wpath) / sizeof(apr_wchar_t), wpath))
-		return apr_get_os_error();
-	if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
-		return rv;
+    if (!GetCurrentDirectoryW(sizeof(wpath) / sizeof(apr_wchar_t), wpath))
+        return apr_get_os_error();
+    if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
+        return rv;
     if (!(flags & APR_FILEPATH_NATIVE)) {
         for (*rootpath = path; **rootpath; ++*rootpath) {
             if (**rootpath == '\\')
@@ -156,13 +156,13 @@ APR_DECLARE(apr_status_t) apr_filepath_g
 APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath,
                                            apr_pool_t *p)
 {
-	apr_wchar_t wpath[APR_PATH_MAX];
-	apr_status_t rv;
+    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)))
-		return rv;
-	if (!SetCurrentDirectoryW(wpath))
-		return apr_get_os_error();
+    if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
+                                        / sizeof(apr_wchar_t), rootpath)))
+        return rv;
+    if (!SetCurrentDirectoryW(wpath))
+        return apr_get_os_error();
     return APR_SUCCESS;
 }

Modified: apr/apr/trunk/file_io/win32/open.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/open.c?rev=1895516&r1=1895515&r2=1895516&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/open.c (original)
+++ apr/apr/trunk/file_io/win32/open.c Thu Dec  2 23:53:57 2021
@@ -137,36 +137,36 @@ apr_status_t unicode_to_utf8_path(char*
 
 void *res_name_from_filename(const char *file, int global, apr_pool_t *pool)
 {
-	apr_wchar_t *wpre, *wfile, *ch;
-	apr_size_t n = strlen(file) + 1;
-	apr_size_t r, d;
-
-	if (global)
-		wpre = L"Global\\";
-	else
-		wpre = L"Local\\";
-	r = wcslen(wpre);
-
-	if (n > 256 - r) {
-		file += n - 256 - r;
-		n = 256;
-		/* skip utf8 continuation bytes */
-		while ((*file & 0xC0) == 0x80) {
-			++file;
-			--n;
-		}
-	}
-	wfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t));
-	wcscpy(wfile, wpre);
-	d = n;
-	if (apr_conv_utf8_to_utf16(file, &n, wfile + r, &d)) {
-		return NULL;
-	}
-	for (ch = wfile + r; *ch; ++ch) {
-		if (*ch == ':' || *ch == '/' || *ch == '\\')
-			*ch = '_';
-	}
-	return wfile;
+    apr_wchar_t *wpre, *wfile, *ch;
+    apr_size_t n = strlen(file) + 1;
+    apr_size_t r, d;
+
+    if (global)
+        wpre = L"Global\\";
+    else
+        wpre = L"Local\\";
+    r = wcslen(wpre);
+
+    if (n > 256 - r) {
+        file += n - 256 - r;
+        n = 256;
+        /* skip utf8 continuation bytes */
+        while ((*file & 0xC0) == 0x80) {
+            ++file;
+            --n;
+        }
+    }
+    wfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t));
+    wcscpy(wfile, wpre);
+    d = n;
+    if (apr_conv_utf8_to_utf16(file, &n, wfile + r, &d)) {
+        return NULL;
+    }
+    for (ch = wfile + r; *ch; ++ch) {
+        if (*ch == ':' || *ch == '/' || *ch == '\\')
+            *ch = '_';
+    }
+    return wfile;
 }
 
 static apr_status_t make_sparse_file(apr_file_t *file)
@@ -270,7 +270,7 @@ APR_DECLARE(apr_status_t) apr_file_open(
     DWORD attributes = 0;
     DWORD sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE;
     apr_status_t rv;
-	apr_wchar_t wfname[APR_PATH_MAX];
+    apr_wchar_t wfname[APR_PATH_MAX];
 
 
     if (flag & APR_FOPEN_NONBLOCK) {
@@ -347,19 +347,19 @@ APR_DECLARE(apr_status_t) apr_file_open(
         attributes |= FILE_FLAG_OVERLAPPED;
     }
 
-	if (flag & APR_FOPEN_SENDFILE_ENABLED) {
-		/* This feature is required to enable sendfile operations
-		 * against the file on Win32. Also implies APR_FOPEN_XTHREAD.
-		 */
-		flag |= APR_FOPEN_XTHREAD;
-		attributes |= FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED;
-	}
-
-	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);
+    if (flag & APR_FOPEN_SENDFILE_ENABLED) {
+        /* This feature is required to enable sendfile operations
+         * against the file on Win32. Also implies APR_FOPEN_XTHREAD.
+         */
+        flag |= APR_FOPEN_XTHREAD;
+        attributes |= FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED;
+    }
+
+    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);
     if (handle == INVALID_HANDLE_VALUE) {
         return apr_get_os_error();
     }
@@ -433,15 +433,15 @@ APR_DECLARE(apr_status_t) apr_file_close
 
 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;
+    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))) {
-		return rv;
-	}
-	if (DeleteFileW(wpath))
-		return APR_SUCCESS;
+    if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
+                                        / sizeof(apr_wchar_t), path))) {
+        return rv;
+    }
+    if (DeleteFileW(wpath))
+        return APR_SUCCESS;
     return apr_get_os_error();
 }
 
@@ -449,22 +449,22 @@ APR_DECLARE(apr_status_t) apr_file_renam
                                           const char *topath,
                                           apr_pool_t *pool)
 {
-	apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX];
-	apr_status_t rv;
+    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))) {
-		return rv;
-	}
-	if ((rv = utf8_to_unicode_path(wtopath,
-								   sizeof(wtopath) / sizeof(apr_wchar_t),
-								   topath))) {
-		return rv;
-	}
-	if (MoveFileExW(wfrompath, wtopath, MOVEFILE_REPLACE_EXISTING |
-										MOVEFILE_COPY_ALLOWED))
-		return APR_SUCCESS;
+    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))) {
+        return rv;
+    }
+    if (MoveFileExW(wfrompath, wtopath, MOVEFILE_REPLACE_EXISTING |
+                                        MOVEFILE_COPY_ALLOWED))
+        return APR_SUCCESS;
     return apr_get_os_error();
 }
 
@@ -472,20 +472,20 @@ APR_DECLARE(apr_status_t) apr_file_link(
                                            const char *to_path)
 {
     apr_status_t rv = APR_SUCCESS;
-	apr_wchar_t wfrom_path[APR_PATH_MAX];
-	apr_wchar_t wto_path[APR_PATH_MAX];
+    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)))
-		return rv;
-	if ((rv = utf8_to_unicode_path(wto_path,
-								   sizeof(wto_path) / sizeof(apr_wchar_t),
-								   to_path)))
-		return rv;
+    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)))
+        return rv;
 
-	if (!CreateHardLinkW(wto_path, wfrom_path, NULL))
-			return apr_get_os_error();
+    if (!CreateHardLinkW(wto_path, wfrom_path, NULL))
+            return apr_get_os_error();
     return rv;
 }