From 76d93becf9a1fe296c210c81a7c2121e0a41bc61 Mon Sep 17 00:00:00 2001 From: skalogryz Date: Sat, 16 Jan 2016 06:16:32 +0000 Subject: [PATCH] iphonelazext: fix pbx file reading to process escaped quote characters. Registered PBXShellScriptBuildPhase for reading git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4425 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/iphonelazext/pbx/pbxcontainer.pas | 15 ++++++++++++--- components/iphonelazext/pbx/pbxfile.pas | 13 ++++++++++++- components/iphonelazext/pbx/xcodeproj.pas | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/components/iphonelazext/pbx/pbxcontainer.pas b/components/iphonelazext/pbx/pbxcontainer.pas index ba82a0120..771d8945e 100644 --- a/components/iphonelazext/pbx/pbxcontainer.pas +++ b/components/iphonelazext/pbx/pbxcontainer.pas @@ -374,7 +374,7 @@ begin tk:=p.FetchNextEntity; refs:=TList.Create; try - while tk<>etCloseObject do begin + while not (tk in [etError, etCloseObject]) do begin if tk=etOpenObject then begin id:=p.Name; cmt:=p.LastComment; @@ -388,8 +388,9 @@ begin obj._id:=id; PBXReadClass(p, obj, refs); objs.Add(id, obj); - end else + end else begin PBXParserSkipLevel(p); + end; end else PBXParserSkipLevel(p); @@ -422,6 +423,7 @@ var root : string; objs : TObjHashList; rt : TObject; + i : Integer; begin Result:=false; AFileInfo.archiveVersion:=''; @@ -440,7 +442,7 @@ begin tk:=p.FetchNextEntity; - while tk <> etEOF do begin + while not (tk in [etEOF,etError]) do begin if tk = etValue then begin if p.Name='archiveVersion' then AFileInfo.archiveVersion:=p.Value else if p.Name='objectVersion' then AFileInfo.objectVersion:=p.Value @@ -451,6 +453,13 @@ begin tk:=p.FetchNextEntity; end; + if tk=etError then begin + {for i:=0 to objs.Count-1 do + TObject(objs[i]).Free;} + Result:=false; + Exit; + end; + rt:=objs.Find(root); if Assigned(rt) and (rt is PBXObject) then diff --git a/components/iphonelazext/pbx/pbxfile.pas b/components/iphonelazext/pbx/pbxfile.pas index 0e47f4f14..39037ae83 100644 --- a/components/iphonelazext/pbx/pbxfile.pas +++ b/components/iphonelazext/pbx/pbxfile.pas @@ -557,6 +557,8 @@ begin end; function TPBXScanner.DoFetchToken: TPBXToken; +var + donestr: Boolean; begin if idx>length(buf) then begin Result:=tkEOF; @@ -590,7 +592,16 @@ begin '"': begin inc(idx); Result:=tkIdentifier; - FCurTokenString:=ScanTo(buf, idx, ['"']); + donestr:=false; + FCurTokenString:=''; + repeat + FCurTokenString:=FCurTokenString+ScanTo(buf, idx, ['"']); + donestr:=(buf[idx-1]<>'\'); + if not donestr then begin + FCurTokenString:=FCurTokenString+'"'; + inc(idx); + end; + until donestr; inc(idx); end; '=': begin diff --git a/components/iphonelazext/pbx/xcodeproj.pas b/components/iphonelazext/pbx/xcodeproj.pas index 46a972cbd..25d42f163 100644 --- a/components/iphonelazext/pbx/xcodeproj.pas +++ b/components/iphonelazext/pbx/xcodeproj.pas @@ -709,6 +709,7 @@ initialization PBXRegisterClass(PBXVariantGroup); PBXRegisterClass(XCBuildConfiguration); PBXRegisterClass(XCConfigurationList); + PBXRegisterClass(PBXShellScriptBuildPhase); end.