Closed Bug 617267 Opened 10 years ago Closed 10 years ago

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

Categories

(Core :: XPCOM, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: m_kato, Assigned: m_kato)

References

()

Details

Attachments

(1 file)

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.
Attached patch fixSplinter Review
Assignee: nobody → m_kato
Status: NEW → ASSIGNED
Attachment #496096 - Flags: review?(benjamin)
Attachment #496096 - Flags: review?(benjamin) → review+
Attachment #496096 - Flags: approval2.0?
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-
Depends on: post2.0
http://hg.mozilla.org/mozilla-central/rev/87c1707e4872
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.