Fixes read of SST table when empty strings are present.

Renamed variable "Continue" to "ContinueIndicator" to avoid conflict with Pascal's Continue.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2110 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Joshy
2011-11-02 22:33:19 +00:00
parent c2f6ef2e8e
commit 2c03552fdf

View File

@ -1752,7 +1752,7 @@ var
Items: DWORD; Items: DWORD;
StringLength: WORD; StringLength: WORD;
LString: String; LString: String;
Continue: WORD; ContinueIndicator: WORD;
begin begin
//Reads the shared string table, only compatible with BIFF8 //Reads the shared string table, only compatible with BIFF8
if not Assigned(FSharedStringTable) then begin if not Assigned(FSharedStringTable) then begin
@ -1775,16 +1775,22 @@ begin
if StringLength>0 then begin if StringLength>0 then begin
//Read a stream of zero length reads all the stream. //Read a stream of zero length reads all the stream.
LString:=LString+ReadString(AStream,StringLength); LString:=LString+ReadString(AStream,StringLength);
end else begin
//String of 0 chars in length, so just read it empty, reading only the mandatory flags
AStream.ReadByte; //And discard it.
Dec(PendingRecordSize);
//LString:=LString+'';
end; end;
if (PendingRecordSize=0) and (Items>1) then begin if (PendingRecordSize=0) and (Items>1) then begin
//A continue will happend, read the continue //A Continue will happend, read the
//tag and continue linking... //tag and continue linking...
Continue:=WordLEtoN(AStream.ReadWord); ContinueIndicator:=WordLEtoN(AStream.ReadWord);
if Continue<>INT_EXCEL_ID_CONTINUE then begin if ContinueIndicator<>INT_EXCEL_ID_CONTINUE then begin
Raise Exception.Create('Expected CONTINUE not found.'); Raise Exception.Create('Expected CONTINUE not found.');
end; end;
PendingRecordSize:=WordLEtoN(AStream.ReadWord); PendingRecordSize:=WordLEtoN(AStream.ReadWord);
Dec(StringLength,Length(UTF8Decode(LString))); //Dec the used chars Dec(StringLength,Length(UTF8Decode(LString))); //Dec the used chars
if StringLength=0 then break;
end else begin end else begin
break; break;
end; end;