Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix to windows spawner

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/ChangeLog,v
retrieving revision 1.8
diff -u -r1.8 ChangeLog
--- ChangeLog	27 Jan 2003 20:57:14 -0000	1.8
+++ ChangeLog	25 Feb 2003 16:05:12 -0000
@@ -1,3 +1,15 @@
+2003-02-25 Alex Chapiro
+
+	Fix for this type of problem:
+		make CFLAGS="-D jek "
+	
+	* os/win32/x86/spawner.dll: Rebuild
+	* os/win32/x86/starter.exe: Rebuild
+	* src/library/starter/starter.cpp:
+	Fix problem with embedded quotation
+	* src/library/Win32ProcessEx.c:
+	Fix problem with embedded quotation.
+
 2003-01-27 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.9
diff -u -r1.9 Win32ProcessEx.c
--- library/Win32ProcessEx.c	27 Jan 2003 20:57:14 -0000	1.9
+++ library/Win32ProcessEx.c	25 Feb 2003 16:05:12 -0000
@@ -739,19 +739,32 @@
 	BOOL bSlash = FALSE;
 	int i = 0, j = 0;
 	int totCpyLength = cpyLength;
-	BOOL bQoutedTerm = FALSE;
+
+#define QUOTATION_DO   0
+#define QUOTATION_DONE 1
+#define QUOTATION_NONE 2
+
+	int nQuotationMode = 0;
+
 
 
 	if(availSpace <= cpyLength) // = to reserve space for final '\0'
 		return -1;
 
 	if(('\"' == *source) && ('\"' == *(source + cpyLength - 1)))
-		bQoutedTerm = TRUE; // Already quoted
+		{
+		nQuotationMode = QUOTATION_DONE;
+		}
 	else
 	if(strchr(source, ' ') == NULL)
-		bQoutedTerm = TRUE; // No reason to quotate term becase it doesn't have embedded spaces
+		{
+		// No reason to quotate term becase it doesn't have embedded spaces
+		nQuotationMode = QUOTATION_NONE;
+		}
 	else
 		{
+		// Needs to be quotated
+		nQuotationMode = QUOTATION_DO;
 		*target = '\"';
 		++j;
 		}
@@ -763,7 +776,8 @@
 			bSlash = TRUE;
 		else
 			{
-			if(source[i] == '\"' && (!bQoutedTerm || ((i != 0) && (i != (cpyLength - 1))) ) )
+			// Don't escape embracing quotation marks
+			if((source[i] == '\"') && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) ) )
 				{
 				if(!bSlash) // If still not escaped
 					{
@@ -781,7 +795,7 @@
 		target[j] = source[i];
 		}
 
-	if(!bQoutedTerm)
+	if(nQuotationMode == QUOTATION_DO)
 		{
 		if(j == availSpace)
 			return -1;
Index: library/starter/starter.cpp
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/library/starter/starter.cpp,v
retrieving revision 1.4
diff -u -r1.4 starter.cpp
--- library/starter/starter.cpp	23 Jan 2003 20:58:26 -0000	1.4
+++ library/starter/starter.cpp	25 Feb 2003 16:05:12 -0000
@@ -187,29 +187,41 @@
 	BOOL bSlash = FALSE;
 	int i = 0, j = 0;
 	int totCpyLength = cpyLength;
-	BOOL bQoutedTerm = FALSE;
+
+#define QUOTATION_DO   0
+#define QUOTATION_DONE 1
+#define QUOTATION_NONE 2
+
+	int nQuotationMode = 0;
 	if(availSpace <= cpyLength)  // = to reserve space for '\0'
 		return -1;
 
 	if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1)))
-		bQoutedTerm = TRUE; // Already quoted
+		{
+		// Already done
+		nQuotationMode = QUOTATION_DONE;
+		}
 	else
 	if(_tcschr(source, _T(' ')) == NULL)
-		bQoutedTerm = TRUE; // No reason to quotate term becase it doesn't have embedded spaces
+		{
+		// No reason to quotate term becase it doesn't have embedded spaces
+		nQuotationMode = QUOTATION_NONE;
+		}
 	else
 		{
+		// Needs to be quotated
+		nQuotationMode = QUOTATION_DO;
 		*target = _T('\"');
 		++j;
 		}
 
-
 	for(; i < cpyLength; ++i, ++j) 
 		{
 		if(source[i] == _T('\\'))
 			bSlash = TRUE;
 		else
-		// Escape double quote only if quotation mark is not start or end character
-		if((source[i] == _T('\"')) && (!bQoutedTerm || ((i != 0) && (i != (cpyLength - 1)))) ) 
+		// Don't escape embracing quotation marks
+		if((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) ) )
 			{
 			if(!bSlash)
 				{
@@ -228,7 +240,7 @@
 		target[j] = source[i];
 		}
 
-	if(!bQoutedTerm)
+	if(nQuotationMode == QUOTATION_DO)
 		{
 		if(j == availSpace)
 			return -1;
Index: os/win32/x86/spawner.dll
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll,v
retrieving revision 1.11
diff -u -r1.11 spawner.dll
Binary files /tmp/cvsSckbBW 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.6
diff -u -r1.6 starter.exe
Binary files /tmp/cvss43T6G and starter.exe differ



Back to the top