Issue 13084 - Remove 5400 warnings for MSVC
Summary: Remove 5400 warnings for MSVC
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: 644
Hardware: PC Windows 2000
: P3 Trivial (vote)
Target Milestone: OOo 1.1 Beta2
Assignee: quetschke
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-06 11:13 UTC by quetschke
Modified: 2003-04-10 13:05 UTC (History)
1 user (show)

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


Attachments
Patch for sal/inc/rtl/ustring.hxx (821 bytes, patch)
2003-04-06 11:14 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2003-04-06 11:13:48 UTC
Branch cws_srx644_ooo20030412

The following patch for sal/inc/rtl/ustring.hxx adds a "0!=" as a type of
cast in front of rtl_convertUStringToString(..) leading to:

return 0!=rtl_convertUStringToString

The expected return value is bool, but rtl_convertUStringToString is sal_Bool
(= unsigned char). Without the "cast" this leads to 5444 warnings of the
following kind:

e:\w1\cws_srx644_ooo20030412cyg\solver\644\wntmsci7.pro\inc\rtl/ustring.hxx(1093)
: warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false'
(performance warning)

A simple (bool) cast doesn't help against this warning, Microsoft recomends the
use of !=0.

Is this OK for other Systems or do we need a special macro for this. E.g.

#ifdef _MSC_VER
define BOOL_CAST 0!=
#else
define BOOL_CAST (bool)
#endif

in sal/inc/sal/config.h
Comment 1 quetschke 2003-04-06 11:14:49 UTC
Created attachment 5484 [details]
Patch for sal/inc/rtl/ustring.hxx
Comment 2 quetschke 2003-04-06 11:16:22 UTC
Oops, s/define/#define/g
Comment 3 Martin Hollmichel 2003-04-10 07:12:01 UTC
mh->sb: please review  !
Comment 4 Stephan Bergmann 2003-04-10 09:19:38 UTC
This has already been fixed, not by massaging ("uglyfying") the source
code, but rather by turning this specific MSVC warning off.  We had a
discussion about it (I think it was only inhouse), and agreed that
this warning is rather useless (it should be obvious that, in general,
changing from one representation---in this case sal_Bool resp.
char---to another---in this case bool---requires some sort of
conversion; no warning should be given  here---there isn't any warning
in other cases, either, like changing from long to short or from int
to float).
Fixed as part of internal bug #107762# (child workspace uno1,
integrated in SRX644M7S2), see sal/inc/sal/config.h 1.15.40.1.
Comment 5 Stephan Bergmann 2003-04-10 12:45:55 UTC
reassigned
Comment 6 quetschke 2003-04-10 13:05:08 UTC
Resolved.
Comment 7 quetschke 2003-04-10 13:05:28 UTC
c