summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-25 08:36:35 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-25 08:36:35 +0000
commit4c5f3cc94c4d96847409ab8987debc48fcf9cf9d (patch)
treec5f7e4c5e99bea4cd3d357a3e9b170a8ca818e19 /Tools
parent2679d84f24f77c4a8fea266685dc9b225c006b2c (diff)
downloadedk2-platforms-4c5f3cc94c4d96847409ab8987debc48fcf9cf9d.tar.xz
Fix a bug in HobLib migration.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1837 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
index 4a4d71cd79..cdb833db83 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
@@ -261,12 +261,19 @@ public final class SourceFileReplacer implements Common.ForDoAll {
Matcher mtrhobstatus;
String templine = wholeline;
for (int i = 0; i < specialhoblibfunc.length; i++) {
- ptnhobstatus = Pattern.compile("(Status\\s*=\\s*)?" + specialhoblibfunc[i] + "(.*?\\)\\s*;)", Pattern.DOTALL);
- mtrhobstatus = ptnhobstatus.matcher(templine);
- if (mtrhobstatus.find()) {
- templine = mtrhobstatus.replaceAll(specialhoblibfunc[i] + mtrhobstatus.group(2) + "\n " +
- MigrationTool.MIGRATIONCOMMENT + "R9 Hob-building library functions will assert if build failure.\n Status = EFI_SUCCESS;");
- }
+ do {
+ ptnhobstatus = Pattern.compile("((?:\t| )*)(\\w(?:\\w|\\d)*)\\s*=\\s*" + specialhoblibfunc[i] + "(.*?;)", Pattern.DOTALL);
+ mtrhobstatus = ptnhobstatus.matcher(templine);
+ if (!mtrhobstatus.find()) {
+ break;
+ }
+ String captureIndent = mtrhobstatus.group(1);
+ String captureStatus = mtrhobstatus.group(2);
+ String replaceString = captureIndent + specialhoblibfunc[i] + mtrhobstatus.group(3) + "\n";
+ replaceString += captureIndent + MigrationTool.MIGRATIONCOMMENT + "R9 Hob-building library functions will assert if build failure.\n";
+ replaceString += captureIndent + captureStatus + " = EFI_SUCCESS;";
+ templine = mtrhobstatus.replaceFirst(replaceString);
+ } while (true);
}
return templine;
}