pajoye                                   Fri, 10 Sep 2010 14:02:19 +0000

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

Log:
- WS

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

Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c	2010-09-10 14:01:44 UTC (rev 303256)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c	2010-09-10 14:02:19 UTC (rev 303257)
@@ -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
@@ -249,7 +249,7 @@
 		/* Skip first 4 characters if they are "\??\" */
 		if(target[0] == '\\' && target[1] == '\\' && target[2] == '?' && target[3] ==  '\\') {
 			char tmp[MAXPATHLEN];
-
+
 			dwRet -= 4;
 			memcpy(tmp, target + 4, dwRet);
 			memcpy(target, tmp, dwRet);
@@ -428,7 +428,7 @@
 		}
 	}
 #else
-	result = getcwd(cwd, sizeof(cwd));
+	result = getcwd(cwd, sizeof(cwd));
 #endif
 	if (!result) {
 		cwd[0] = '\0';
@@ -479,7 +479,7 @@
 		*length = 1;
 		retval = (char *) malloc(2);
 		retval[0] = DEFAULT_SLASH;
-		retval[1] = '\0';
+		retval[1] = '\0';
 		return retval;
 	}

@@ -606,7 +606,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;
@@ -682,17 +682,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);
 }
@@ -751,7 +751,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;
@@ -769,7 +769,7 @@
 			}
 			return j;
 		}
-
+
 		path[len] = 0;

 		save = (use_realpath != CWD_EXPAND);
@@ -802,7 +802,7 @@
 			/* continue resolution anyway but don't save result in the cache */
 			save = 0;
 		}
-
+
 		if (save) {
 			FindClose(hFind);
 		}
@@ -810,7 +810,7 @@
 		tmp = tsrm_do_alloca(len+1, use_heap);
 		memcpy(tmp, path, len+1);

-		if(save &&
+		if(save &&
 		!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
 		(data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
 			/* File is a reparse point. Get the target */
@@ -847,7 +847,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
@@ -859,7 +859,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
@@ -873,7 +873,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
@@ -884,7 +884,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
@@ -899,14 +899,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
 					) {
@@ -914,7 +914,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;
 				}
@@ -1135,18 +1135,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
@@ -1158,7 +1158,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];
@@ -1169,7 +1169,7 @@
 		} else
 #endif
 		memcpy(resolved_path, path, path_length + 1);
-	}
+	}

 #ifdef TSRM_WIN32
 	if (memchr(resolved_path, '*', path_length) ||
@@ -1223,12 +1223,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++] = '.';
 	}
@@ -1281,7 +1281,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
@@ -1304,7 +1304,7 @@

 	if (length == 0) {
 		return 1; /* Can't cd to empty string */
-	}
+	}
 	while(--length >= 0 && !IS_SLASH(path[length])) {
 	}

@@ -1339,7 +1339,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;
 		}
@@ -1348,7 +1348,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 TSRMLS_CC)==0) {
@@ -1414,7 +1414,7 @@
 {
 	cwd_state new_state;
 	int ret;
-
+
 	CWD_STATE_COPY(&new_state, &CWDG(cwd));
 	if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
 		CWD_STATE_FREE(&new_state);
@@ -1426,9 +1426,9 @@
 #else
 	ret = access(new_state.cwd, mode);
 #endif
-
+
 	CWD_STATE_FREE(&new_state);
-
+
 	return ret;
 }
 /* }}} */
@@ -1449,12 +1449,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);
@@ -1574,7 +1574,7 @@
 		f = open(new_state.cwd, flags, mode);
 	} else {
 		f = open(new_state.cwd, flags);
-	}
+	}
 	CWD_STATE_FREE(&new_state);
 	return f;
 }
@@ -1833,7 +1833,7 @@
 		}
 		*ptr++ = '\'';
 	}
-
+
 	*ptr++ = ' ';
 	*ptr++ = ';';
 	*ptr++ = ' ';
@@ -1856,7 +1856,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;
 		}
@@ -1867,7 +1867,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 TSRMLS_CC)) {
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to