Closed Bug 229293 Opened 21 years ago Closed 21 years ago

lib/base/arena.c: unary minus operator applied to unsigned type

Categories

(NSS :: Libraries, defect, P3)

x86
Windows XP
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file)

When compiling lib/base/arena.c, MSVC issues the following
compiler warnings:

cl -FoWIN954.0_DBG.OBJ/arena.obj -c -Od -Z7 -MD -W3 -nologo -DXP_PC -DDEBUG
-D_DEBUG -UNDEBUG -DDEBUG_bishakhabanerjee -DWIN32 -D_WINDOWS -D_X86_ -DWIN95
-I../../../../dist/WIN954.0_DBG.OBJ/include  -I../../../../dist/public/nss
-I../../../../dist/private/nss -I../../../../dist/public/nspr 
C:/nsstip_tbox/builds/tinderbox/win2K/mozilla/security/nss/lib/base/arena.c
arena.c
C:/nsstip_tbox/builds/tinderbox/win2K/mozilla/security/nss/lib/base/arena.c(964)
: warning C4146: unary minus operator applied to unsigned type, result still
unsigned
C:/nsstip_tbox/builds/tinderbox/win2K/mozilla/security/nss/lib/base/arena.c(1041)
: warning C4146: unary minus operator applied to unsigned type, result still
unsigned
Attached patch Proposed patchSplinter Review
&a[-i] is equivalent to a-i.  The latter avoids
the unary minus operator.
Attachment #137896 - Flags: superreview?(jpierre)
Attachment #137896 - Flags: review?(rrelyea0264)
Attachment #137896 - Flags: superreview?(jpierre) → superreview+
Comment on attachment 137896 [details] [diff] [review]
Proposed patch

a-i is easier to read than &[-i] as well.
Attachment #137896 - Flags: review?(rrelyea0264) → review+
Fixed checked in on the trunk.

Checking in arena.c;
/cvsroot/mozilla/security/nss/lib/base/arena.c,v  <--  arena.c
new revision: 1.6; previous revision: 1.5
done
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.10
Setting priorities on unprioritized bugs resolved fixed for NSS 3.10.
Setting this to P3, since it was motivated only as warning reduction.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: