Hi Laurens,
On Mon, Jul 21, 2008 at 4:30 PM, Laurens Voerman <[EMAIL PROTECTED]> wrote:
> I'am still confused about the code just below new, (in the current svn
> version) and almost sure it cannot work.
>
> buffer = new unsigned char [w*h*format];
> for(unsigned char* ptr=buffer;ptr<buffer+w*h*format;++ptr) *ptr = 0;
>
> if (!buffer)
> { //..cleanup and return NULL
>
> It's the last line that confused me, if new did not throw an exeption, than
> the use of a null pointer in the next line will. I think (!buffer) is bound
> to be false.
This code is wrong, I'd guess a case of too many cooks spoiling the
broth, i.e. one programmer wrote the if (!buffer) code then another
came along and add the memory initialization, but didn't spot/realize
the if (!buffer) blocks function.
I've moved the if(!buffer) block to before the memory initialization,
this is now checked in.
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org