On Jan. 20, 2011, 3:54 a.m., Boroondas Gupte wrote: > > I agree though, that we should try to handle this similarly in both tests, > > if possible. So I tried setting the pointers in > > indra/llui/tests/llurlentry_stub.cpp to NULL, too, which works nicely. > > > > However, I then realized that the tested code might have nullpointer guards > > around dereferencing code, so that if we pass nullpointers we are actually > > testing another scenario than when passing pointers to actual data and that > > this might be the reason why no null-pointer exceptions occur during the > > tests. > > > > Of course, we could now examine the tested code to see whether this is the > > case. However, it would be a bad idea to adapt the test code based on that > > examination, as the tested code might be changed later without this > > question being re-evaluated and the test rewritten accordingly. > > > > Is there another pointer value besides NULL (thus not usually tested for) > > that still fails reliably when tried to dereference? > > > > ---- > > [*] Remember that tests are executed when building and are hopefully > > completely deterministic, so that any potential null-pointer-exception > > would have shown up.
Sure set them to (char const*)0x1; That is not false, and surely will crash if you try to access it (it's odd). I'd only do this once for a local test though. If it still runs fine, you can set them to NULL and add a comment that they're not used. - Aleric ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://codereview.secondlife.com/r/100/#review207 ----------------------------------------------------------- On Jan. 18, 2011, 7:29 a.m., Boroondas Gupte wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://codereview.secondlife.com/r/100/ > ----------------------------------------------------------- > > (Updated Jan. 18, 2011, 7:29 a.m.) > > > Review request for Viewer. > > > Summary > ------- > > For the reason for this change, see > https://jira.secondlife.com/browse/VWR-24487 and > https://jira.secondlife.com/browse/VWR-24522 > > What I did: > In indra/llmessage/message_prehash.(h|cpp), I turned everything into constant > pointers to constants by search/replace. Then I tried to compile and added > const qualifiers in dependent code as needed to stop the compiler complaining. > > Note that comments in indra/llmessage/message_prehash.(h|cpp) say these files > have been generated from the message template. If this generation wasn't a > one-off thing, the generating code must be changed, too, so it won't override > this change here when the generation happens the next time. > > > This addresses bug VWR-24487. > http://jira.secondlife.com/browse/VWR-24487 > > > Diffs > ----- > > doc/contributions.txt fc7e5dcf3059 > indra/llmessage/message_prehash.h fc7e5dcf3059 > indra/llmessage/message_prehash.cpp fc7e5dcf3059 > indra/llprimitive/llprimitive.h fc7e5dcf3059 > indra/llprimitive/llprimitive.cpp fc7e5dcf3059 > indra/llprimitive/llvolumemessage.h fc7e5dcf3059 > indra/llprimitive/llvolumemessage.cpp fc7e5dcf3059 > indra/llui/tests/llurlentry_stub.cpp fc7e5dcf3059 > indra/newview/tests/llremoteparcelrequest_test.cpp fc7e5dcf3059 > > Diff: http://codereview.secondlife.com/r/100/diff > > > Testing > ------- > > Compiled (standalone, 64bit Linux) with and without LL_TESTS. > Started the viewer, logged in, walked and flew around a bit. Everything seems > to work. > > > Thanks, > > Boroondas > >
_______________________________________________ Policies and (un)subscribe information available here: http://wiki.secondlife.com/wiki/OpenSource-Dev Please read the policies before posting to keep unmoderated posting privileges
