List Info

Thread: discrepancy between code and comments about CP_ACP




discrepancy between code and comments about CP_ACP
country flaguser name
China
2007-12-10 01:11:58

Hi Eric

 

     I am debugging the issue of not supporting Chinese symbol on windows mobile 5.0. In file /cvsroot/common/runtime/hlxosstr.cpp, I find a discrepancy between code and comments. It’s about the following code, revision 1.26:

//----------------------------------------------------------------------------
// Legacy utilities
//----------------------------------------------------------------------------
// XXX
// This should be reviewed.
// With current logic we're using ActiveCodePage on CE Windows and UTF8 on non-CE Windows.
#ifdef _WINCE
#  if !defined(CP_UTF8)
#     define CP_UTF8 CP_ACP
#  else //!CP_UTF8
#     if defined(_X86_) && (CP_UTF8==65001)
#       undef CP_UTF8
#       define CP_UTF8 CP_ACP
#     endif //_X86_ && (CP_UTF8==65001)
#  endif //!CP_UTF8
#endif //_WINCE

 

According to the comments, CP_ACP should replace CP_UTF8 on CE windows. However, in practice it is NOT the case. I am debugging on windows mobile 5.0, using branch atlas310. This part of code is the same with revision 1.26. I found because CP_UTF8 is a parameter of MultiByteToWideChar(), it’s certainly defined like CP_ACP as well. So the logic goes to “#     if defined(_X86_) && (CP_UTF8==65001)”. For pocket pc, _X86_ is not defined because it’s based on arm. So after going through the logic, CP_UTF8 is NOT replaced by CP_ACP. It’s different from the comments, because windows mobile is windows CE as well.
 
My question is:
1.      Why the limitation of “defined(_X86_)” is set here? Windows CE may be based on arm architecture as well as X86 architecture.
2. Can I change the line “#     if defined(_X86_) && (CP_UTF8==65001)” to “#     if (defined(_X86_) || (WINVER >= 0x500)) && (CP_UTF8==65001)”? After changing, the app can support Chinese symbol. If it’s OK, I will submit a CR.
 
    Thank you very much!

 

Best Regards

-------------------------------------------------------
Eric Li (
李军)
www.realnetworks.com
www.helixcommunity.org
-------------------------------------------------------

 

RE: discrepancy between code and comments about CP_ACP
country flaguser name
United States
2007-12-13 15:24:14
> 2. Can I change the line “#     if defined(_X86_)
&& 
> (CP_UTF8==65001)” to “#     if (defined(_X86_) ||
(WINVER >= 
> 0x500)) && (CP_UTF8==65001)”? After changing,
the app can 
> support Chinese symbol. If it’s OK, I will submit a
CR.

Go ahead and submit a CR to common-dev using the patch
submission process. Then several people (including those
more
knowledgeable in WM5.0 than myself) will get to take a look
at it.

Eric
=============================================
Eric Hyche (ehychereal.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: lijun [mailto:ljunreal.com] 
> Sent: Monday, December 10, 2007 2:12 AM
> To: ehychereal.com
> Cc: common-devhelixcommunity.org
> Subject: [Common-dev] discrepancy between code and
comments 
> about CP_ACP
> 
> Hi Eric
> 
>  
> 
>      I am debugging the issue of not supporting Chinese

> symbol on windows mobile 5.0. In file 
> /cvsroot/common/runtime/hlxosstr.cpp, I find a
discrepancy 
> between code and comments. It’s about the following
code, 
> revision 1.26:
> 
>
//----------------------------------------------------------
--
> ----------------
> // Legacy utilities
>
//----------------------------------------------------------
--
> ----------------
> // XXX
> // This should be reviewed.
> // With current logic we're using ActiveCodePage on CE

> Windows and UTF8 on non-CE Windows.
> #ifdef _WINCE
> #  if !defined(CP_UTF8)
> #     define CP_UTF8 CP_ACP
> #  else //!CP_UTF8
> #     if defined(_X86_) && (CP_UTF8==65001)
> #       undef CP_UTF8
> #       define CP_UTF8 CP_ACP
> #     endif //_X86_ && (CP_UTF8==65001)
> #  endif //!CP_UTF8
> #endif //_WINCE
> 
>  
> 
> According to the comments, CP_ACP should replace
CP_UTF8 on 
> CE windows. However, in practice it is NOT the case. I
am 
> debugging on windows mobile 5.0, using branch atlas310.
This 
> part of code is the same with revision 1.26. I found
because 
> CP_UTF8 is a parameter of MultiByteToWideChar(), it’s

> certainly defined like CP_ACP as well. So the logic
goes to 
> “#     if defined(_X86_) &&
(CP_UTF8==65001)”. For pocket pc, 
> _X86_ is not defined because it’s based on arm. So
after 
> going through the logic, CP_UTF8 is NOT replaced by
CP_ACP. 
> It’s different from the comments, because windows
mobile is 
> windows CE as well.
>  
> My question is:
> 1.      Why the limitation of “defined(_X86_)” is set
here? 
> Windows CE may be based on arm architecture as well as
X86 
> architecture.
> 2. Can I change the line “#     if defined(_X86_)
&& 
> (CP_UTF8==65001)” to “#     if (defined(_X86_) ||
(WINVER >= 
> 0x500)) && (CP_UTF8==65001)”? After changing,
the app can 
> support Chinese symbol. If it’s OK, I will submit a
CR.
>  
>     Thank you very much!
> 
>  
> 
> Best Regards
> 
>
-------------------------------------------------------
> Eric Li (李军)
> www.realnetworks.com
> www.helixcommunity.org
>
-------------------------------------------------------
> 
>  
> 
> 


_______________________________________________
Common-dev mailing list
Common-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/comm
on-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )