pajoye                                   Mon, 13 Sep 2010 09:08:42 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=303309

Log:
- WS

Changed paths:
    U   php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
    U   php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
    U   php/php-src/trunk/TSRM/tsrm_virtual_cwd.h

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c	2010-09-13 07:45:12 UTC (rev 303308)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c	2010-09-13 09:08:42 UTC (rev 303309)
@@ -88,14 +88,14 @@
 #include <tchar.h>
 #define tsrm_strtok_r(a,b,c) _tcstok((a),(b))
 #define TOKENIZER_STRING "/\\"
-
-static int php_check_dots(const char *element, int n)
+
+static int php_check_dots(const char *element, int n)
 {
 	while (n-- > 0) if (element[n] != '.') break;

 	return (n != -1);
 }
-
+
 #define IS_DIRECTORY_UP(element, len) \
 	(len >= 2 && !php_check_dots(element, len))

@@ -129,7 +129,7 @@

 /* define this to check semantics */
 #define IS_DIR_OK(s) (1)
-
+
 #ifndef IS_DIR_OK
 #define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
 #endif
@@ -142,7 +142,7 @@

 #define CWD_STATE_FREE(s)			\
 	free((s)->cwd);
-
+
 #ifdef TSRM_WIN32

 #ifdef CTL_CODE
@@ -436,7 +436,7 @@
 		}
 	}
 #else
-	result = getcwd(cwd, sizeof(cwd));
+	result = getcwd(cwd, sizeof(cwd));
 #endif
 	if (!result) {
 		cwd[0] = '\0';
@@ -487,7 +487,7 @@
 		*length = 1;
 		retval = (char *) malloc(2);
 		retval[0] = DEFAULT_SLASH;
-		retval[1] = '\0';
+		retval[1] = '\0';
 		return retval;
 	}

@@ -614,7 +614,7 @@
 {
 	long size = sizeof(realpath_cache_bucket) + path_len + 1;
 	int same = 1;
-
+
 	if (realpath_len != path_len ||
 		memcmp(path, realpath, path_len) != 0) {
 		size += realpath_len + 1;
@@ -690,17 +690,17 @@
 }
 /* }}} */

-CWD_API int realpath_cache_size(TSRMLS_D)
+CWD_API int realpath_cache_size(TSRMLS_D)
 {
 	return CWDG(realpath_cache_size);
 }

-CWD_API int realpath_cache_max_buckets(TSRMLS_D)
+CWD_API int realpath_cache_max_buckets(TSRMLS_D)
 {
 	return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
 }

-CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D)
+CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D)
 {
 	return CWDG(realpath_cache);
 }
@@ -759,7 +759,7 @@
 						path[4] = '.';
 						path[5] = DEFAULT_SLASH;
 						j = 5;
-					} else if (j > 0 &&
+					} else if (j > 0 &&
 							path[j+1] == '.' && path[j+2] == '.' &&
 							IS_SLASH(path[j+3])) {
 						j += 4;
@@ -777,7 +777,7 @@
 			}
 			return j;
 		}
-
+
 		path[len] = 0;

 		save = (use_realpath != CWD_EXPAND);
@@ -810,7 +810,7 @@
 			/* continue resolution anyway but don't save result in the cache */
 			save = 0;
 		}
-
+
 		if (save) {
 			FindClose(hFind);
 		}
@@ -855,7 +855,7 @@
 				reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
 				printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
 				isabsolute = (pbuffer->SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0;
-				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
+				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
 					reparsetarget + pbuffer->MountPointReparseBuffer.PrintNameOffset  / sizeof(WCHAR),
 					printname_len + 1,
 					printname, MAX_PATH, NULL, NULL
@@ -867,7 +867,7 @@
 				printname[printname_len] = 0;

 				substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
-				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
+				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
 					reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
 					substitutename_len + 1,
 					substitutename, MAX_PATH, NULL, NULL
@@ -881,7 +881,7 @@
 				isabsolute = 1;
 				reparsetarget = pbuffer->MountPointReparseBuffer.ReparseTarget;
 				printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
-				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
+				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
 					reparsetarget + pbuffer->MountPointReparseBuffer.PrintNameOffset  / sizeof(WCHAR),
 					printname_len + 1,
 					printname, MAX_PATH, NULL, NULL
@@ -892,7 +892,7 @@
 				printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0;

 				substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
-				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
+				if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
 					reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
 					substitutename_len + 1,
 					substitutename, MAX_PATH, NULL, NULL
@@ -907,14 +907,14 @@
 			}

 			if(isabsolute && substitutename_len > 4) {
-				/* Do not resolve volumes (for now). A mounted point can
+				/* Do not resolve volumes (for now). A mounted point can
 				   target a volume without a drive, it is not certain that
-				   all IO functions we use in php and its deps support
+				   all IO functions we use in php and its deps support
 				   path with volume GUID instead of the DOS way, like:
 				   d:\test\mnt\foo
 				   \\?\Volume{62d1c3f8-83b9-11de-b108-806e6f6e6963}\foo
 				*/
-				if (strncmp(substitutename, "\\??\\Volume{",11) == 0
+				if (strncmp(substitutename, "\\??\\Volume{",11) == 0
 					|| strncmp(substitutename, "\\\\?\\Volume{",11) == 0
 					|| strncmp(substitutename, "\\??\\UNC\\", 8) == 0
 					) {
@@ -922,7 +922,7 @@
 					substitutename_off = 0;
 				} else
 					/* do not use the \??\ and \\?\ prefix*/
-					if (strncmp(substitutename, "\\??\\", 4) == 0
+					if (strncmp(substitutename, "\\??\\", 4) == 0
 						|| strncmp(substitutename, "\\\\?\\", 4) == 0) {
 					substitutename_off = 4;
 				}
@@ -1006,7 +1006,7 @@
 		memcpy(tmp, path, len+1);

 		if (save && S_ISLNK(st.st_mode)) {
-			if (++(*ll) > LINK_MAX || (j = readlink(tmp, path, MAXPATHLEN)) < 0) {
+			if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) {
 				/* too many links or broken symlinks */
 				tsrm_free_alloca(tmp, use_heap);
 				return -1;
@@ -1144,18 +1144,18 @@
 					state_cwd_length = 2;
 					while (IS_SLASH(state->cwd[state_cwd_length])) {
 						state_cwd_length++;
-					}
+					}
 					while (state->cwd[state_cwd_length] &&
 							!IS_SLASH(state->cwd[state_cwd_length])) {
 						state_cwd_length++;
-					}
+					}
 					while (IS_SLASH(state->cwd[state_cwd_length])) {
 						state_cwd_length++;
-					}
+					}
 					while (state->cwd[state_cwd_length] &&
 							!IS_SLASH(state->cwd[state_cwd_length])) {
 						state_cwd_length++;
-					}
+					}
 				}
 			}
 #endif
@@ -1167,7 +1167,7 @@
 			memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
 			path_length += state_cwd_length + 1;
 		}
-	} else {
+	} else {
 #ifdef TSRM_WIN32
 		if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) {
 			resolved_path[0] = path[0];
@@ -1178,7 +1178,7 @@
 		} else
 #endif
 		memcpy(resolved_path, path, path_length + 1);
-	}
+	}

 #ifdef TSRM_WIN32
 	if (memchr(resolved_path, '*', path_length) ||
@@ -1232,12 +1232,12 @@
 	add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]);
 	t = CWDG(realpath_cache_ttl) ? 0 : -1;
 	path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL TSRMLS_CC);
-
+
 	if (path_length < 0) {
 		errno = ENOENT;
 		return 1;
 	}
-
+
 	if (!start && !path_length) {
 		resolved_path[path_length++] = '.';
 	}
@@ -1290,7 +1290,7 @@
 		memcpy(state->cwd, resolved_path, state->cwd_length+1);
 		ret = 0;
 	}
-
+
 #if VIRTUAL_CWD_DEBUG
 	fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
 #endif
@@ -1348,7 +1348,7 @@
 	if (!*path) {
 		new_state.cwd = (char*)malloc(1);
 		new_state.cwd[0] = '\0';
-		new_state.cwd_length = 0;
+		new_state.cwd_length = 0;
 		if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
 			path = cwd;
 		}
@@ -1357,7 +1357,7 @@
 	} else {
 		new_state.cwd = (char*)malloc(1);
 		new_state.cwd[0] = '\0';
-		new_state.cwd_length = 0;
+		new_state.cwd_length = 0;
 	}

 	if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) {
@@ -1423,7 +1423,7 @@
 {
 	cwd_state new_state;
 	int ret;
-
+
 	CWD_STATE_COPY(&new_state, &CWDG(cwd));
 	if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH)) {
 		CWD_STATE_FREE(&new_state);
@@ -1435,9 +1435,9 @@
 #else
 	ret = access(new_state.cwd, mode);
 #endif
-
+
 	CWD_STATE_FREE(&new_state);
-
+
 	return ret;
 }
 /* }}} */
@@ -1458,12 +1458,12 @@
 TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
 {
 	FILETIME mtime, atime;
-	HANDLE hFile;
+	HANDLE hFile;

 	hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
 				 OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);

-	/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
+	/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
 	   the CreateFile operation succeeds */
 	if (GetLastError() == ERROR_ALREADY_EXISTS) {
 		SetLastError(0);
@@ -1583,7 +1583,7 @@
 		f = open(new_state.cwd, flags, mode);
 	} else {
 		f = open(new_state.cwd, flags);
-	}
+	}
 	CWD_STATE_FREE(&new_state);
 	return f;
 }
@@ -1842,7 +1842,7 @@
 		}
 		*ptr++ = '\'';
 	}
-
+
 	*ptr++ = ' ';
 	*ptr++ = ';';
 	*ptr++ = ' ';
@@ -1865,7 +1865,7 @@
 	if (!*path) {
 		new_state.cwd = (char*)malloc(1);
 		new_state.cwd[0] = '\0';
-		new_state.cwd_length = 0;
+		new_state.cwd_length = 0;
 		if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
 			path = cwd;
 		}
@@ -1876,7 +1876,7 @@
 	} else {
 		new_state.cwd = (char*)malloc(1);
 		new_state.cwd[0] = '\0';
-		new_state.cwd_length = 0;
+		new_state.cwd_length = 0;
 	}

 	if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h	2010-09-13 07:45:12 UTC (rev 303308)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h	2010-09-13 09:08:42 UTC (rev 303309)
@@ -108,7 +108,7 @@
 #define COPY_WHEN_ABSOLUTE(path) 0
 #endif

-#ifndef IS_ABSOLUTE_PATH
+#ifndef IS_ABSOLUTE_PATH
 #define IS_ABSOLUTE_PATH(path, len) \
 	(IS_SLASH(path[0]))
 #endif
@@ -194,7 +194,7 @@
 CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
 #endif

-/* One of the following constants must be used as the last argument
+/* One of the following constants must be used as the last argument
    in virtual_file_ex() call. */

 #define CWD_EXPAND   0 /* expand "." and ".." but dont resolve symlinks      */
@@ -222,7 +222,7 @@
 	unsigned char                  is_wvalid;
 	unsigned char                  is_writable;
 #endif
-	struct _realpath_cache_bucket *next;
+	struct _realpath_cache_bucket *next;
 } realpath_cache_bucket;

 typedef struct _virtual_cwd_globals {
@@ -250,7 +250,7 @@

 /* The actual macros to be used in programs using TSRM
  * If the program defines VIRTUAL_DIR it will use the
- * virtual_* functions
+ * virtual_* functions
  */

 #ifdef VIRTUAL_DIR

Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.h
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.h	2010-09-13 07:45:12 UTC (rev 303308)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.h	2010-09-13 09:08:42 UTC (rev 303309)
@@ -108,7 +108,7 @@
 #define COPY_WHEN_ABSOLUTE(path) 0
 #endif

-#ifndef IS_ABSOLUTE_PATH
+#ifndef IS_ABSOLUTE_PATH
 #define IS_ABSOLUTE_PATH(path, len) \
 	(IS_SLASH(path[0]))
 #endif
@@ -194,7 +194,7 @@
 CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
 #endif

-/* One of the following constants must be used as the last argument
+/* One of the following constants must be used as the last argument
    in virtual_file_ex() call. */

 #define CWD_EXPAND   0 /* expand "." and ".." but dont resolve symlinks      */
@@ -222,7 +222,7 @@
 	unsigned char                  is_wvalid;
 	unsigned char                  is_writable;
 #endif
-	struct _realpath_cache_bucket *next;
+	struct _realpath_cache_bucket *next;
 } realpath_cache_bucket;

 typedef struct _virtual_cwd_globals {
@@ -250,7 +250,7 @@

 /* The actual macros to be used in programs using TSRM
  * If the program defines VIRTUAL_DIR it will use the
- * virtual_* functions
+ * virtual_* functions
  */

 #ifdef VIRTUAL_DIR
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to