Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Demos/Other    [ Add a report in this area ]  
Report #:  4307   Status: Reported
ResXplor fails to present stringtables with empty strings
Project:  Delphi Build #:  6.0.6.240
Version:    6.0 Submitted By:   Peter Laman
Report Type:  Basic functionality failure Date Reported:  5/5/2003 1:48:08 AM
Severity:    Infrequently encountered problem Last Updated: 1/8/2008 3:30:51 PM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
2.00 out of 5
Total Votes: None
Description
If a stringtable block contains an empty string, the rest of the block is not displayed.
Steps to Reproduce:
This is due to a bug in the TStringResource.AssignTo method in unit ExeImage. The main loop of this method is:

        while Cnt < StringsPerBlock do
        begin
          Len := Word(P^);
          if Len > 0 then
          begin
            Inc(P);
            ID := ((FDirEntry.Name - 1) shl 4) + Cnt;
            Add(Format('%d,  "%s"', [ID, WideCharToStr(P, Len)]));
            Inc(P, Len);
          end;
          Inc(Cnt);
        end;

So, if a string is empty, P will not be incremented and the rest of the loop will use the same empty string. The solution is to add an else part to increment P:

        while Cnt < StringsPerBlock do
        begin
          Len := Word(P^);
          if Len > 0 then
            begin
              Inc(P);
              ID := ((FDirEntry.Name - 1) shl 4) + Cnt;
              Add(Format('%d,  "%s"', [ID, WideCharToStr(P, Len)]));
              Inc(P, Len);
            end
          else
            Inc(P); //Advance to next string
          Inc(Cnt);
        end;
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01