Issue 18776 - attempts to assign non-enum val to enum cause compilation failure
Summary: attempts to assign non-enum val to enum cause compilation failure
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 RC3
Hardware: PC NetBSD
: P2 Trivial (vote)
Target Milestone: OOo 1.1 Beta2
Assignee: Martin Hollmichel
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-28 14:28 UTC by Unknown
Modified: 2004-02-07 07:04 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Unknown 2003-08-28 14:28:26 UTC
At the tail of the function 
static UChar32 
_LMBCSGetNextUCharWorker(UConverterToUnicodeArgs*   args, UErrorCode*   err,                         
UBool returnUTF32) 
located in icu's misc/build/icu/source/common/ucnv_lmb.c an attempt is made to assign *err = 
ULMBCS_MULTI which is effectively U_ERROR_LIMIT + 1 which is beyond the range of the 
UErrorCode enumeration. 
 
I would have provided a patch but am unsure of the desired solution.  I would suggest not 
using enumerated values if there is intent to perform math on those values.
Comment 1 Martin Hollmichel 2003-10-23 17:06:38 UTC
confirmed
Comment 2 ooo 2003-11-03 15:16:09 UTC
Hi Tyler,

I simply consider this bad programming style and it looks like someone
was too lazy to declare a proper UErrorCode enum value for this (and
not putting a #define value in parentheses is bad style anyways).
Again, please file an ICU bug at
http://www.jtcsv.com/cgi-bin/icu-bugs
Please mention this OOo issue number there, and provide a reference to
the ICU bug here. Thanks.

As a workaround I suggest to simply cast the result to an UErrorCode
again (*err = (UErrorCode)(ULMBCS_MULTI)).
Comment 3 Martin Hollmichel 2003-11-21 07:29:25 UTC
due to eike's comment I set this issue to fixed, please feel free to
reopen, if this does not work for you.
Comment 4 Martin Hollmichel 2004-02-05 12:49:32 UTC
mark as verified.
Comment 5 Martin Hollmichel 2004-02-05 12:51:08 UTC
close issue, feel free to reopen if there is a problem left.
Comment 6 Martin Hollmichel 2004-02-07 07:04:02 UTC
close issue.