1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 03:35:37 +02:00

FIx parsing.

This commit is contained in:
Alain Magloire 2003-09-11 16:40:19 +00:00
parent 09c4ef716b
commit 0f58242ba8

View file

@ -46,7 +46,7 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
} }
shared = new MIShared[aList.size()]; shared = new MIShared[aList.size()];
for (int i = 0; i < aList.size(); i++) { for (int i = 0; i < aList.size(); i++) {
shared[i] = (MIShared)aList.get(i); shared[i] = (MIShared) aList.get(i);
} }
} }
@ -73,36 +73,35 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
void parseUnixShared(String str, List aList) { void parseUnixShared(String str, List aList) {
if (str.length() > 0) { if (str.length() > 0) {
// Pass the header // Pass the header
if (Character.isDigit(str.charAt(0))) {
int index = -1; int index = -1;
long from = 0; long from = 0;
long to = 0; long to = 0;
boolean syms = false; boolean syms = false;
String name = ""; String name = "";
for (int i = 0; (index = str.lastIndexOf(' ')) != -1 || i <= 3; i++) { for (int i = 0;(index = str.lastIndexOf(' ')) != -1 || i <= 3; i++) {
if (index == -1) { if (index == -1) {
index = 0; index = 0;
} }
String sub = str.substring(index).trim(); String sub = str.substring(index).trim();
// move to previous column // move to previous column
str = str.substring(0, index).trim(); str = str.substring(0, index).trim();
switch(i) { switch (i) {
case 0: case 0 :
name = sub; name = sub;
break; break;
case 1: case 1 :
if (sub.equalsIgnoreCase("Yes")) { if (sub.equalsIgnoreCase("Yes")) {
syms = true; syms = true;
} }
break; break;
case 2: // second column is "To" case 2 : // second column is "To"
try { try {
to = Long.decode(sub).longValue(); to = Long.decode(sub).longValue();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
break; break;
case 3: // first column is "From" case 3 : // first column is "From"
try { try {
from = Long.decode(sub).longValue(); from = Long.decode(sub).longValue();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
@ -110,6 +109,7 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
break; break;
} }
} }
if (name.length() > 0) {
MIShared s = new MIShared(from, to, syms, name); MIShared s = new MIShared(from, to, syms, name);
aList.add(s); aList.add(s);
} }