mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
[255946] - fixing escaping for MI output, patch applied kind of
This commit is contained in:
parent
57756dcb6c
commit
593cd79862
1 changed files with 18 additions and 9 deletions
|
@ -237,11 +237,7 @@ public class MIParser {
|
|||
stream = new MILogStreamOutput();
|
||||
break;
|
||||
}
|
||||
// translateCString() assumes that the leading " is deleted
|
||||
if (buffer.length() > 0 && buffer.charAt(0) == '"') {
|
||||
buffer.deleteCharAt(0);
|
||||
}
|
||||
stream.setCString(translateCString(new FSB(buffer)));
|
||||
stream.setCString(removeSurroundingDoubleQuotes(buffer.toString()));
|
||||
oob = stream;
|
||||
} else {
|
||||
// Badly format MI line, just pass it to the user as target stream
|
||||
|
@ -252,9 +248,22 @@ public class MIParser {
|
|||
return oob;
|
||||
}
|
||||
|
||||
private String removeSurroundingDoubleQuotes(String str) {
|
||||
String s = str;
|
||||
// remove leading double quote
|
||||
if (s.startsWith("\"")) { //$NON-NLS-1$
|
||||
s = s.substring(1);
|
||||
}
|
||||
// remove trailing double quote
|
||||
if (s.endsWith("\"")) { //$NON-NLS-1$
|
||||
s = s.substring(0, s.length() - 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assuming that the usual leading comma was consumed.
|
||||
* Extract the MI Result comma seperated responses.
|
||||
* Extract the MI Result comma separated responses.
|
||||
*/
|
||||
private MIResult[] processMIResults(FSB buffer) {
|
||||
List aList = new ArrayList();
|
||||
|
@ -389,12 +398,12 @@ public class MIParser {
|
|||
}
|
||||
|
||||
/*
|
||||
* MI C-String rather MICOnst values are enclose in double quotes
|
||||
* MI C-String rather MIConst values are enclose in double quotes
|
||||
* and any double quotes or backslash in the string are escaped.
|
||||
* Assuming the starting double quote was removed.
|
||||
* This method will stop at the closing double quote remove the extra
|
||||
* backslach escaping and return the string __without__ the enclosing double quotes
|
||||
* The orignal StringBuffer will move forward.
|
||||
* backslash escaping and return the string __without__ the enclosing double quotes
|
||||
* The original StringBuffer will move forward.
|
||||
*/
|
||||
private String translateCString(FSB buffer) {
|
||||
boolean escape = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue