From: "Patrice Freydiere" <frett27@free.fr>
Subject: Re: Tagged Types
Date: Sun, 12 Sep 2004 21:29:12 +0200
Date: 2004-09-12T19:27:20+02:00 [thread overview]
Message-ID: <pan.2004.09.12.19.29.12.644532@free.fr> (raw)
> --- Patrice Freydiere <frett27@free.fr> wrote:
> > Jeff, I pointed out the problem ..
> > i was converting a stream_element_array in a string,
> > using the
> > stream_element_array bounds ... the array was
> > starting at 0. So at runtime,
> > an index out of bounds was raised because strings
> > starting to 0 are not
> > allowed...
> >
> > i can't get a stream_element_array formal
> > description to check if zero base
> > array is valid ??
>
> I don't understand what you mean by this. Why can you
> not get the formal description for this. You are using
> GNAT? it is in a-stream.ads
>
> Yes it is legal to start at 0 (or even negative
> values).
>
> Can you post (either here or comp.lang.ada) just the
> snippet of code from the declare block that you are
> talking about or is it too proprietary.
>
>
Here is the involve code :
begin
Ais.Log.Log("Image retreived - " &
Image.Get_Name(Im.all));
if Im=null then
Ais.Log.Log("null address ");
end if;
declare
Ba : Ada.Streams.Stream_Element_Array
:= Ais.image.Create_Thumbnail(ic);
begin
declare
S : String( 1 .. Natural(Ba'Length) );
--&&&&&&&&&&&&& when i used a 0 based string, it hang with a (null): Bad
address
-- &&&&&&&&&&&&&& with a 1 based string, OK
-- &&&&&&&&&&&&&& with using Get_Content for retrieving the
Stream_Element_Array, it 's OK ?????
begin
for J in Ba'Range loop
S(Integer(J-Ba'first)+S'first) :=
Character'Val(Ada.Streams.Stream_Element'pos(Ba(J)));
null;
end loop;
As(I) :=
Client.Base64_Data(To_String(AIS.Image.Get_Name(Im.all)),
Aws.Translator.Base64_Encode(
S ));
end;
tell me if you wanna have more code,
or you can get the entier code from imgsvr.org cvs repository
Cheers,
Patrice
next reply other threads:[~2004-09-12 19:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-12 19:29 Patrice Freydiere [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-09-13 4:08 Tagged Types David C. Hoos
2002-05-30 15:30 tagged types Sami Evangelista
2002-05-30 19:11 ` Stephen Leake
2002-05-31 13:13 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox