User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:184.108.40.206) 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: 1. 2. 3.
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.
Comment on attachment 290076 [details] [diff] [review] Propsed patch Is this code actually correct? According to http://blogs.msdn.com/michkap/archive/2004/12/16/318271.aspx 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)
According to Michael S. Kaplan [MSFT] (the same person who wrote that blog entry) posting to microsoft.public.win32.programmer.international, 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.
This was fixed as part of bug 439593. I believe the cleanest way to write this would have been MAKELCID(LOWORD(aLocale), SORT_DEFAULT) (except that aLocale is a terrible name for an HKL).
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.