5 * |mailnews/base/src/nsMsgDBView.cpp(...) : warning C4018: '...' : signed/unsigned mismatch|, and 3 in nsMsgThreadedDBView.cpp

RESOLVED FIXED

Status

MailNews Core
Database
RESOLVED FIXED
9 years ago
10 months ago

People

(Reporter: sgautherie, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko/20090417 SeaMonkey/2.0b1pre] (experimental/_m-c_, home, optim default) (W2Ksp4)
(http://hg.mozilla.org/mozilla-central/rev/9e06217fc471
 +http://hg.mozilla.org/comm-central/rev/...)

{
mailnews/base/src/nsMsgDBView.cpp(4667) : warning C4018: '<' : signed/unsigned mismatch
mailnews/base/src/nsMsgDBView.cpp(5187) : warning C4018: '<' : signed/unsigned mismatch
mailnews/base/src/nsMsgDBView.cpp(6453) : warning C4018: '<' : signed/unsigned mismatch
mailnews/base/src/nsMsgDBView.cpp(6967) : warning C4018: '>=' : signed/unsigned mismatch
mailnews/base/src/nsMsgDBView.cpp(6985) : warning C4018: '<' : signed/unsigned mismatch
}

Issue seems to be
that nsMsgViewIndex type is unsigned long,
but
{
PRInt32  GetSize(void) {return(m_keys.Length());}
}
instead of a PRUint32 (from nsTArray).

Simply fixing GetSize() return type triggers opposite warnings elsewhere...

How (= which way) do you want this fixed?
(Reporter)

Comment 1

9 years ago
Also:
{
mailnews/base/src/nsMsgThreadedDBView.cpp(107) : warning C4018: '<' : signed/unsigned mismatch
mailnews/base/src/nsMsgThreadedDBView.cpp(716) : warning C4018: '<' : signed/unsigned mismatch
mailnews/base/src/nsMsgThreadedDBView.cpp(781) : warning C4018: '<' : signed/unsigned mismatch
}

The former I'll fix,
the latters are the same issue.
Summary: 5 * |mailnews/base/src/nsMsgDBView.cpp(...) : warning C4018: '...' : signed/unsigned mismatch| → 5 * |mailnews/base/src/nsMsgDBView.cpp(...) : warning C4018: '...' : signed/unsigned mismatch|, and 3 in nsMsgThreadedDBView.cpp
(Reporter)

Comment 2

9 years ago
Created attachment 373476 [details] [diff] [review]
(Av1) <nsMsgThreadedDBView.cpp> 1 s/PRInt32/PRUint32/
[Checkin: Comment 4]
Attachment #373476 - Flags: superreview?(bienvenu)
Attachment #373476 - Flags: review?(bienvenu)
(Reporter)

Updated

9 years ago
Blocks: 488983

Comment 3

9 years ago
Comment on attachment 373476 [details] [diff] [review]
(Av1) <nsMsgThreadedDBView.cpp> 1 s/PRInt32/PRUint32/
[Checkin: Comment 4]

thx for the patch.
Attachment #373476 - Flags: superreview?(bienvenu)
Attachment #373476 - Flags: superreview+
Attachment #373476 - Flags: review?(bienvenu)
Attachment #373476 - Flags: review+
(Reporter)

Updated

9 years ago
Attachment #373476 - Attachment description: (Av1) <nsMsgThreadedDBView.cpp> 1 s/PRInt32/PRUint32/ → (Av1) <nsMsgThreadedDBView.cpp> 1 s/PRInt32/PRUint32/ [Checkin: Comment 4]
(Reporter)

Comment 4

9 years ago
Comment on attachment 373476 [details] [diff] [review]
(Av1) <nsMsgThreadedDBView.cpp> 1 s/PRInt32/PRUint32/
[Checkin: Comment 4]


http://hg.mozilla.org/comm-central/rev/f7644274b7ac
(Reporter)

Updated

9 years ago
Flags: wanted-thunderbird3?
(Reporter)

Comment 5

9 years ago
(In reply to comment #0)

> How (= which way) do you want this fixed?

David?
(Reporter)

Updated

8 years ago
Blocks: 499995
No longer blocks: 488983
Flags: wanted-thunderbird3?

Comment 6

7 years ago
I'd cast GetSize() to (PRUint32) or (nsMsgViewIndex)

Comment 7

6 years ago
How hard is it to finish this? What needs to be done? Just changing the return type?

Comment 8

6 years ago
per https://bugzilla.mozilla.org/show_bug.cgi?id=488982#c6 cast the return value of GetSize() calls...

Comment 9

6 years ago
Do you mean casting the returned value in all the callers? Not redefine the return type of the function?

Comment 10

6 years ago
(In reply to :aceman from comment #9)
> Do you mean casting the returned value in all the callers?
yes, but only the callers where a warning is generated.

Comment 11

6 years ago
Ok, thanks. Then it is something I can't currently do.

Comment 12

5 years ago
Serge, do you still see any of these warnings? My gcc does not emit any of this type for this file.

Comment 13

3 years ago
I still get the following C4018 warnings in mailnews/base/src:

> mailnews\base\search\src\nsMsgSearchSession.cpp:124 [C4018] '<=' : signed/unsigned mismatch
> mailnews\base\src\nsMsgDBView.cpp:5508 [C4018] '<' : signed/unsigned mismatch

There are more C4018 warnings in mailnews but I'm not sure if they belong here or in another bug.

Comment 14

10 months ago
Hello,

I would like to help on this issue.

Comment 15

10 months ago
Thanks for volunteering
Assignee: nobody → jeanluc.bonnafoux

Comment 16

10 months ago
Are warnings still reported? I thought all warnings were fixed when warnings-as-errors was enabled.

Comment 17

10 months ago
Hello,

I have recompiled code yesterday and i can confirm that there are no warnings at compilation time (Compiler: Visual Studio 2015 update 3 compiler) for both files that are in the subject of this issue.

Could somebody double check please ?

Thanks,

Comment 18

10 months ago
Hello,

I can confirm that with the latest code in comm-central, i can not reproduce the warnings.

Thanks,

Updated

10 months ago
Status: NEW → ASSIGNED

Updated

10 months ago
Flags: needinfo?(acelists)

Comment 19

10 months ago
(In reply to Stefan Sitter from comment #16)
> Are warnings still reported? I thought all warnings were fixed when
> warnings-as-errors was enabled.

Yes, most warnings should be cleaned up already.
Flags: needinfo?(acelists)

Comment 20

10 months ago
The reported line numbers are already outdated. Let's close this until somebody sees the warnings again. Amd one case was already fixed with a patch in this bug.
Assignee: jeanluc.bonnafoux → nobody
Status: ASSIGNED → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.