From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,FAKE_REPLY_C, FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bb67e5f4739c02,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!feeder2-1.proxad.net!news15-e.free.fr!not-for-mail From: "Patrice Freydiere" Subject: Re: Tagged Types Date: Sun, 12 Sep 2004 21:29:12 +0200 User-Agent: Pan/0.13.0 (The whole remains beautiful) Message-Id: Newsgroups: comp.lang.ada MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Organization: Guest of ProXad - France NNTP-Posting-Date: 12 Sep 2004 19:27:20 MEST NNTP-Posting-Host: 82.228.206.35 X-Trace: 1095010040 news15-e.free.fr 32634 82.228.206.35:32779 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:3630 Date: 2004-09-12T19:27:20+02:00 List-Id: > --- Patrice Freydiere 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