Yes, sorry about that it should be as you say, thank you. But that doesn't
change anything actually. - the same problem is still there, besides the
code works sometimes, so it is copied correctly for some of the pictures.

   Dennis

----- Original Message ----- 
From: "EzTools" <[EMAIL PROTECTED]>
To: "Dennis Volodomanov" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, November 28, 2003 7:36 PM
Subject: Re: [sqlite] Back to sqlite_decode_binary()


> Is it right to take the address of the buffer "out"?  Will it be the
address
> of the address of the buffer?
>
>     memcpy((BYTE*)&out, mybuf, photo_length);
>
> Should it be
>
>     memcpy((BYTE*)out, mybuf, photo_length);
>
> Or does the compiler do the same thing in both cases?  I'm not sure what
> VC++6 would do with the code as it is, but I would code it the revised
way.
>
> ----- Original Message ----- 
> From: "Dennis Volodomanov" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, November 27, 2003 11:21 AM
> Subject: [sqlite] Back to sqlite_decode_binary()
>
>
> Hello all,
>
> I've been narrowing down the problem with the sqlite_decode_binary and
I've
> got this simplest code:
>
> ----8<----
> unsigned char out[15000];
> memcpy((BYTE*)&out,mybuf,photo_length);
> out[photo_length]='\0';
> int size=sqlite_decode_binary(out,out);
> if(size<0)
> {
>   // now we don't even get here
> }
> ----8<----
>
> Before I had dynamic memory allocation and it overwrote past the boundary
> sometimes, but wasn't fatal. Now I've got a static array and it simply
(and
> silently) throws me out of the program back to Windows. It never gets to
the
> size<0 part or further, so I assume that the problem is still inside the
> sqlite_decode_binary code somewhere. The "mybuf" array is valid and is
read
> from the database along with the "photo_length", I do checks when the user
> adds (and sqlite_encode_binary() runs), and there're no errors there, so I
> assume the data is correct and it's size is also correct. The average data
> size is around 3-4K, never over 4.5K, so 15K is more than enough. Or am I
> missing something important?
>
> Any ideas?
>
> TIA
>
>    Dennis
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to