Error message on empty string in Dialog.MapString.

Error message on empty string in Dialog.MapString.

Postby Zinn » Wed May 03, 2017 5:43 pm

An empty strings (e.g. "#Ctls:") produce an error messages ("key not found" ) in Dialog.MapString
by logMissingSimpleKeys = TRUE.

Im module Dialog should be the procedure SearchString(in, out)
Code: Select all
         i := 0; ch := in[1];
         WHILE (ch # 0X) (* & (ch # ".") *) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
         subsys[i] := 0X;
         IF ch # 0X THEN
            INC(i, 2); ch := in[i]; j := 0;
            WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END;
            in[j] := 0X
         ELSE
            RETURN
         END;

add IF ch # 0X THEN INC(i); ch := in[i+1] END; and change INC(i, 2) to INC(i)
Code: Select all
         i := 0; ch := in[1];
         WHILE (ch # 0X) (* & (ch # ".") *) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
         subsys[i] := 0X;
         IF ch # 0X THEN INC(i); ch := in[i+1] END;
         IF ch # 0X THEN
            INC(i); ch := in[i]; j := 0;
            WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END;
            in[j] := 0X
         ELSE
            RETURN
         END;

That solves the problem and do a RETURN on empty string.
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: Error message on empty string in Dialog.MapString.

Postby Josef Templ » Thu May 04, 2017 5:32 am

I agree. This should be turned into an issue.
It is currently not possible to insert an empty key into the Strings resource file, thus
an empty key should not be treated as missing. The alternative, supporting empty keys in
Strings resources, does also not look attractive and may cause more complications.

The surrounding code is a bit complicated. A slight improvement may be:

Code: Select all
         WHILE (ch # 0X) & (ch # ":") DO subsys[i] := ch; INC(i); ch := in[i + 1] END;
         subsys[i] := 0X;
         IF ch = ":" THEN INC(i); ch := in[i + 1] END;
         IF ch = 0X THEN (* no key *) RETURN END;
         INC(i); ch := in[i]; j := 0;
         WHILE (ch # 0X) DO in[j] := ch; INC(i); INC(j); ch := in[i] END; (* in := key *)
         in[j] := 0X;


Is there also a problem with empty subsystem names?

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: Error message on empty string in Dialog.MapString.

Postby Zinn » Fri May 05, 2017 5:55 am

Josef, your solution is much better.
Josef Templ wrote:Is there also a problem with empty subsystem names?

Wrong and missing subsytem names are no problem (e.g. "", " ", "#Ctls", "Ctls:") then out is equal in.
Except: Only if the subsystem name is equal "#:" produces 2 illegal execution (adr = 66312AD4H) traps in the application module.
- Helmut
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: Error message on empty string in Dialog.MapString.

Postby Robert » Mon Oct 09, 2017 8:33 am

Helmut
What is the status of this topic? Does an issue need to be raised, or can this topic be moved to 'Resolved' or 'Rejected'?
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Error message on empty string in Dialog.MapString.

Postby Josef Templ » Mon Oct 09, 2017 9:03 am

I think this has been solved by issue-#161.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am


Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron