xpcom/io/nsWildCard.cpp(212) : warning C4244: '=' : conversion from 'const PRUnichar' to 'char', possible loss of data

RESOLVED FIXED in mozilla5

Status

()

RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: m_kato, Assigned: m_kato)

Tracking

Trunk
mozilla5
x86
Windows Vista
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1291633325.1291641688.16997.gz&fulltext=1

e:/builds/moz2_slave/mozilla-central-win64-nightly/build/xpcom/io/nsWildCard.cpp(212) : warning C4244: '=' : conversion from 'const PRUnichar' to 'char', possible loss of data


http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsWildCard.cpp?mark=205-212#205

205 template<class T>
206 static int
207 _scan_and_copy(const T *expr, T stop1, T stop2, T *dest)
208 {
209     register int sx;     /* source index */
210     register char cc;
211 
212     for (sx = 0; (cc = expr[sx]) && cc != stop1 && cc != stop2; sx++) {

When the result of cast from PRUnichar to char is same as stop1 or stop2 even if these are different, mismatching may occur.

We should define cc as T, not char.
(Assignee)

Comment 1

8 years ago
Created attachment 496096 [details] [diff] [review]
fix
Assignee: nobody → m_kato
Status: NEW → ASSIGNED
(Assignee)

Updated

8 years ago
Attachment #496096 - Flags: review?(benjamin)

Updated

8 years ago
Attachment #496096 - Flags: review?(benjamin) → review+
(Assignee)

Updated

8 years ago
Attachment #496096 - Flags: approval2.0?

Updated

8 years ago
Attachment #496096 - Flags: approval2.0? → approval2.0+
Comment on attachment 496096 [details] [diff] [review]
fix

Sorry, it is too late for this to be landed in 2.0.
Attachment #496096 - Flags: approval2.0+ → approval2.0-
(Assignee)

Updated

8 years ago
Depends on: 610267

Comment 3

8 years ago
http://hg.mozilla.org/mozilla-central/rev/87c1707e4872
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.