edink Thu Dec 22 21:32:56 2005 EDT
Modified files:
/TSRM tsrm_virtual_cwd.c
Log:
Back out a portion of the previous patch which broke win32 file functions
http://cvs.php.net/viewcvs.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.75&r2=1.76&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.75 TSRM/tsrm_virtual_cwd.c:1.76
--- TSRM/tsrm_virtual_cwd.c:1.75 Tue Dec 20 14:26:55 2005
+++ TSRM/tsrm_virtual_cwd.c Thu Dec 22 21:32:56 2005
@@ -480,7 +480,7 @@
{
int new_path_length;
- new_path_length = GetLongPathName(path, NULL, 0);
+ new_path_length = GetLongPathName(path, NULL, 0) + 1;
if (new_path_length == 0) {
return 1;
}
From
http://msdn.microsoft.com/library/en-us/fileio/fs/getlongpathname.asp:
"DWORD GetLongPathName(LPCTSTR lpszShortPath, LPTSTR lpszLongPath, DWORD cchBuffer);
If the lpszLongPath buffer is too small to contain the path, the return value is the size of the buffer that is required to hold the path, including the terminating null character, in TCHARs. Therefore, if the return value is greater than cchBuffer, call the function again using a buffer size that is at least the same size as the return value.
If the function fails for any other reason, the return value is 0 (zero). To get extended error information, call GetLastError."
So what was wrong in the previous patch? Now its wrong, because the new_path_length will *never* be 0, so it will never enter in that 'if'. And as it already include the \0, I can't see why that '+1' is required.
Nuno