Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Spawner Windows fix form Alex.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- ChangeLog	17 Jan 2003 19:30:08 -0000	1.6
+++ ChangeLog	23 Jan 2003 20:57:50 -0000
@@ -1,3 +1,12 @@
+2003-01-23 Alex Chapiro
+
+	* os/win32/x86/spawner.dll: Rebuild
+	* os/win32/x86/starter.exe: Rebuild
+	* src/library/starter/starter.cpp:
+	Correct quotation escaped.
+	* src/library/Win32ProcessEx.c:
+	Correct quotation escaped.
+
 2003-01-17 Alex Chapiro
 
 	* os/win32/x86/spawner.dll: Rebuild
Index: library/Win32ProcessEx.c
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c,v
retrieving revision 1.7
diff -u -r1.7 Win32ProcessEx.c
--- library/Win32ProcessEx.c	17 Jan 2003 19:29:58 -0000	1.7
+++ library/Win32ProcessEx.c	23 Jan 2003 20:57:50 -0000
@@ -733,25 +733,16 @@
 // Return number of bytes in target or -1 in case of error
 int copyTo(char * target, const char * source, int cpyLength, int availSpace)
 {
-#ifdef DEBUG_MONITOR
-	char buffer[1000];
-#endif
 	BOOL bSlash = FALSE;
 	int i = 0, j = 0;
 	int totCpyLength = cpyLength;
 	BOOL bQoutedTerm = FALSE;
 
-#ifdef DEBUG_MONITOR
-	sprintf(buffer, "copyTo start: %s %d %d\n", source, cpyLength, availSpace);
-	OutputDebugString(buffer);
-#endif
 
 	if(availSpace <= cpyLength) // = to reserve space for final '\0'
 		return -1;
-	//strncpy(target, source, cpyLength);
-	//return cpyLength;
 
-	if(('\"' == *source) && ('\"' == *(source + cpyLength)))
+	if(('\"' == *source) && ('\"' == *(source + cpyLength - 1)))
 		bQoutedTerm = TRUE; // Already quoted
 	else
 	if(strchr(source, ' ') == NULL)
@@ -768,19 +759,19 @@
 		if(source[i] == '\\')
 			bSlash = TRUE;
 		else
-		if((source[i] == '\"') && (!bQoutedTerm || (i != 0) || i != (cpyLength)) ) 
 			{
-			if(!bSlash)
+			if(source[i] == '\"' && (!bQoutedTerm || ((i != 0) && (i != (cpyLength - 1))) ) )
 				{
-				if(j == availSpace)
-					return -1;
-				target[j] = '\\';
-				++j;
+				if(!bSlash) // If still not escaped
+					{
+					if(j == availSpace)
+						return -1;
+					target[j] = '\\';
+					++j;
+					}
 				}
 			bSlash = FALSE;
 			}
-		else
-			bSlash = FALSE;
 
 		if(j == availSpace)
 			return -1;
@@ -795,10 +786,6 @@
 		++j;
 		}
 
-#ifdef DEBUG_MONITOR
-	sprintf(buffer, "copyTo: %s %d %d\n", source, j, cpyLength);
-	OutputDebugString(buffer);
-#endif
 	return j;
 }
 
Index: library/starter/starter.cpp
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/library/starter/starter.cpp,v
retrieving revision 1.3
diff -u -r1.3 starter.cpp
--- library/starter/starter.cpp	17 Jan 2003 19:29:58 -0000	1.3
+++ library/starter/starter.cpp	23 Jan 2003 20:57:50 -0000
@@ -188,11 +188,10 @@
 	int i = 0, j = 0;
 	int totCpyLength = cpyLength;
 	BOOL bQoutedTerm = FALSE;
-
 	if(availSpace <= cpyLength)  // = to reserve space for '\0'
 		return -1;
 
-	if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength)))
+	if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1)))
 		bQoutedTerm = TRUE; // Already quoted
 	else
 	if(_tcschr(source, _T(' ')) == NULL)
@@ -209,7 +208,8 @@
 		if(source[i] == _T('\\'))
 			bSlash = TRUE;
 		else
-		if((source[i] == _T('\"')) && (!bQoutedTerm || (i != 0) || i != (cpyLength)) ) 
+		// Escape double quote only if quotation mark is not start or end character
+		if((source[i] == _T('\"')) && (!bQoutedTerm || ((i != 0) && (i != (cpyLength - 1)))) ) 
 			{
 			if(!bSlash)
 				{
@@ -235,7 +235,6 @@
 		target[j] = _T('\"');
 		++j;
 		}
-
 	return j;
 }
 
Index: os/win32/x86/spawner.dll
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll,v
retrieving revision 1.9
diff -u -r1.9 spawner.dll
Binary files /tmp/cvsWYfchp and spawner.dll differ
Index: os/win32/x86/starter.exe
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe,v
retrieving revision 1.5
diff -u -r1.5 starter.exe
Binary files /tmp/cvsOkPwTu and starter.exe differ



Back to the top