Problems building nsBidiKeyboard.cpp with MingW GCC




Widget: Win32
11 years ago
10 years ago


(Reporter: jfwfreo, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071030 SeaMonkey/1.1.6
Build Identifier: 

When building SeaMonkey trunk and getting to nsBidiKeyboard.cpp, I get the following errors:
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp: In member function 'nsresult nsBidiKeyboard::SetupBidiKeyboards()':
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp:150: warning: comparison between signed and unsigned integer expressions
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp:159: error: cast from 'HKL__*' to 'WORD' loses precision
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp:163: error: cast from 'HKL__*' to 'WORD' loses precision
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp: In member function 'PRBool nsBidiKeyboard::IsRTLLanguage(HKL__*)':
c:/mozilla/widget/src/windows/nsBidiKeyboard.cpp:213: error: cast from 'HKL__*' to 'WORD' loses precision

Is this a mozilla problem (in which case, what is the right fix) or a problem with MingW having the wrong definition for something somewhere (in which case what is the change that MingW has to make)?

Reproducible: Always

Steps to Reproduce:

Comment 1

11 years ago
Created attachment 290076 [details] [diff] [review]
Propsed patch

Per MSDN, LANGIDFROMLCID is specified to take a LCID. Typecasting the HKL to a LCID before we pass it to LANGIDFROMLCID makes the errors go away.

Should have no affect on the resulting code since the compiler will optimize the casts away.
Attachment #290076 - Flags: superreview?(roc)
Attachment #290076 - Flags: review?(vladimir)
Comment on attachment 290076 [details] [diff] [review]
Propsed patch

Is this code actually correct? According to
HKL and LCID are not actually interchangeable. So this code is actually incorrect and maybe just works most of the time due to luck. It would be great if you could give us a real fix! (And MingW++ for catching this)
Attachment #290076 - Flags: superreview?(roc)
Attachment #290076 - Flags: superreview-
Attachment #290076 - Flags: review?(vladimir)
Attachment #290076 - Flags: review-

Comment 3

11 years ago
According to Michael S. Kaplan [MSFT] (the same person who wrote that blog entry) posting to, it is acceptable to pass a HKL to LANGIDFROMLCID. Therefore, this patch should be correct (since it is ok to pass a HKL to LANGIDFROMLCID and since LANGIDFROMLCID is specified to take a LCID it is therefore acceptable to typecast the HKL to a LCID before you pass it to LANGIDFROMLCID.

Comment 4

10 years ago
This was fixed as part of bug 439593. I believe the cleanest way to write this would have been


(except that aLocale is a terrible name for an HKL).
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.