[gtkada] Problems with attributes in XML files

Thomas Brupbacher Thomas.Brupbacher at cerberus.ch
Fri Feb 2 10:15:32 CET 2001


Hello all

There is a problem in glib-xml.adb: Translate does not handle zero length
strings properly. The attached diff against the 1.2.10 version of
glib-xml.adb should fix that. 


Cheers
Thomas
-- 
Dr.Thomas Brupbacher                 Thomas.Brupbacher at cerberus.ch
Siemens Building Technologies, Cerberus Division    +41/1/922 6657
CH-8708 Männedorf                               Fax +41/1/922 6969
-------------- next part --------------
113c113
< 
---
>       
222,229c222,225
<       J := Str'First;
< 
<       loop
<          if In_String or else S (Index) /= '&' then
<             Str (J) := S (Index);
<          else
<             Index := Index + 1;
<             Start := Index;
---
>       if S'Length = 0 then
>          return Str (1 .. 0);
>       else
>          J := Str'First;
231c227,230
<             while S (Index) /= ';' loop
---
>          loop
>             if In_String or else S (Index) /= '&' then
>                Str (J) := S (Index);
>             else
233,234c232
<                pragma Assert (Index <= S'Last);
<             end loop;
---
>                Start := Index;
236,243c234,247
<             if S (Start .. Index - 1) = "quot" then
<                Str (J) := '"';
<             elsif S (Start .. Index - 1) = "gt" then
<                Str (J) := '>';
<             elsif S (Start .. Index - 1) = "lt" then
<                Str (J) := '<';
<             elsif S (Start .. Index - 1) = "amp" then
<                Str (J) := '&';
---
>                while S (Index) /= ';' loop
>                   Index := Index + 1;
>                   pragma Assert (Index <= S'Last);
>                end loop;
> 
>                if S (Start .. Index - 1) = "quot" then
>                   Str (J) := '"';
>                elsif S (Start .. Index - 1) = "gt" then
>                   Str (J) := '>';
>                elsif S (Start .. Index - 1) = "lt" then
>                   Str (J) := '<';
>                elsif S (Start .. Index - 1) = "amp" then
>                   Str (J) := '&';
>                end if;
245d248
<          end if;
247c250
<          exit when Index = S'Last;
---
>             exit when Index = S'Last;
249,255c252,254
<          if S (Index) = '"' then
<             In_String := not In_String;
<          end if;
< 
<          Index := Index + 1;
<          J     := J + 1;
<       end loop;
---
>             if S (Index) = '"' then
>                In_String := not In_String;
>             end if;
257c256,260
<       return Str (1 .. J);
---
>             Index := Index + 1;
>             J     := J + 1;
>          end loop;
>          return Str (1 .. J);
>       end if;


More information about the gtkada mailing list