Opened 14 years ago

Closed 14 years ago

Last modified 5 years ago

#9122 closed patch

MSVC: conversions warnings in common code

Reported by: Templier Owned by: lordhoto
Priority: low Component: Port: Win32
Version: Keywords:
Cc: Game:

Description

I'm now compiling my engine (lastexpress) using MSVC with C4244 ('conversion' conversion from 'type1' to 'type2', possible loss of data) turned on and I've noticed a few warnings in headers included from common code. I'm opening this entry to track those cases.

Patch1: Cursor struct constructor using an int parameter to initialize a byte field: targetScale is defined as byte, but the constructor takes an int value. This changes the constructor to take a byte value for targetScale.

Patch2: Rect::clip taking int parameters while it's using int16 internally. This changes the clip method to take int16 values.

Ticket imported from: #2911414. Ticket imported from: patches/1227.

Attachments (2)

C4244_cursorman_cursor_struct_constructor.patch (679 bytes ) - added by Templier 14 years ago.
Patch1 - Cursor struct constructor
C4244_rect_clip_int_parameters.patch (343 bytes ) - added by Templier 14 years ago.
Patch2 - Rect::clip

Download all attachments as: .zip

Change History (7)

by Templier, 14 years ago

Patch1 - Cursor struct constructor

by Templier, 14 years ago

Patch2 - Rect::clip

comment:1 by Templier, 14 years ago

Priority: normallow

comment:2 by lordhoto, 14 years ago

I do not think these warnings are that bad btw., I still chose to commit your patch for the Common::Rect code, I did decide to make "_targetScale" in the CursorMan code an "int" though (instead of making the constructor parameter byte), since the OSystem method, where this is passed, takes an int too. (It is debatable whether byte would be enough for that value though... :-).

Btw. I can tell you that when I enable a similar warning for g++ and try to build ScummVM with it I get *tons* of warnings about similar things :-/.

comment:3 by lordhoto, 14 years ago

Owner: set to lordhoto
Status: newclosed

comment:4 by Templier, 14 years ago

Yes, there are tons of those warnings when turning it on globally on MSVC too. Those patches were mainly so that you can turn on the warning on a per-engine basis and not get warnings from the common header files.

Thanks for accepting it!

comment:5 by digitall, 5 years ago

Component: Port: Win32
Note: See TracTickets for help on using tickets.