small pointer problem in db/mork/src/morkDeque.cpp?

VERIFIED FIXED

Status

Core Graveyard
Tracking
P3
minor
VERIFIED FIXED
18 years ago
a year ago

People

(Reporter: Colin Blake, Assigned: Bienvenu)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
This belongs to Mork, but there's no component for Mork (or DB) yet!

In db/mork/src/morkDeque.cpp, there is the following code:

void morkNext::ZapOldNext(morkEnv* ev, nsIMdbHeap* ioHeap)
{
  if ( &ioHeap )
  {
    if ( this )
      ioHeap->Free(ev->AsMdbEnv(), this);
  }
  else
    ev->NilPointerError();
}

The OpenVMS C++ compiler complains that the last statement (the call
to NilPointerError) is unreachable.

Since ioHeap is a pointer, I guess that &ioHeap is the address of the
pointer. And since this is always non-zero, even for a null pointer,
the if test doesn't make sense???

Anyway, thought you might want to look at this and maybe give it
some consideration.

Colin.
(Reporter)

Comment 1

18 years ago
Same goes for morkLink::ZapOldLink. That makes two occurences of this
"problem" in morkDequeue.cpp.

Updated

18 years ago
Assignee: chofmann → davidmc

Comment 2

18 years ago
-> davidmc

Comment 3

18 years ago
Okay, I'll fix it; originally the code would have passed nsIMdbHeap as
a reference, so that &ioHeap would yield actual the pointer.  All I can
say is I wrote the code in a hurry one day when making change lists for
incrementally writing tables.  Thanks for reporting this.

Updated

18 years ago
Target Milestone: M14

Updated

18 years ago
QA Contact: leger → davidmc
(Assignee)

Comment 4

18 years ago
these are mine now, I guess.
Assignee: davidmc → bienvenu
(Assignee)

Comment 5

18 years ago
accepting
Status: NEW → ASSIGNED
(Assignee)

Comment 6

18 years ago
m20
Target Milestone: M14 → M20
(Assignee)

Comment 7

18 years ago
fix checked in - if ioheap were null, I think we would have crashed, so this was 
useful to fix.
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
QA Contact: davidmc → stephend
1.6 bienvenu%netscape.com Jun 22 2000 fix build warning 14653
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.