Skip to content

Commit c043e3c

Browse files
committed
More typecast juggling while attempting to keep types most appropriate to the current scope.
1 parent 303f440 commit c043e3c

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

miniwindow.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ long CMiniWindow::Font (LPCTSTR FontId, // eg. "inventory"
618618

619619
CFont * pFont = new CFont;
620620

621-
int lfHeight = -MulDiv(Size ? Size : 10.0, dc.GetDeviceCaps(LOGPIXELSY), 72);
621+
int lfHeight = -MulDiv(Size ? (int) Size : 10, dc.GetDeviceCaps(LOGPIXELSY), 72);
622622

623623
if (pFont->CreateFont (lfHeight,
624624
0, // int nWidth,
@@ -1925,7 +1925,7 @@ long CMiniWindow::ImageOp(short Action,
19251925

19261926
} // end of CMiniWindow::ImageOp
19271927

1928-
long CMiniWindow::CreateImage(LPCTSTR ImageId, long Row1, long Row2, long Row3, long Row4, long Row5, long Row6, long Row7, long Row8)
1928+
long CMiniWindow::CreateImage(LPCTSTR ImageId, WORD Row1, WORD Row2, WORD Row3, WORD Row4, WORD Row5, WORD Row6, WORD Row7, WORD Row8)
19291929
{
19301930

19311931
ImageMapIterator it = m_Images.find (ImageId);
@@ -2679,12 +2679,12 @@ static void MakeTexture (const COLORREF Multiplier,
26792679
const long iHeight)
26802680
{
26812681

2682-
long rval = GetRValue (Multiplier),
2682+
ULONG rval = GetRValue (Multiplier),
26832683
gval = GetGValue (Multiplier),
26842684
bval = GetBValue (Multiplier);
26852685

2686-
long row, col;
2687-
long c;
2686+
ULONG row, col;
2687+
ULONG c;
26882688

26892689
int increment = BytesPerLine (iWidth, 24);
26902690

@@ -2695,9 +2695,9 @@ static void MakeTexture (const COLORREF Multiplier,
26952695
for (row = 0; row < iHeight; row++)
26962696
{
26972697
c = col ^ row;
2698-
p [0] = c * bval;
2699-
p [1] = c * gval;
2700-
p [2] = c * rval;
2698+
p [0] = (unsigned char) (c * bval);
2699+
p [1] = (unsigned char) (c * gval);
2700+
p [2] = (unsigned char) (c * rval);
27012701
p += increment;
27022702
} // end of each row
27032703
} // end of each column
@@ -2969,7 +2969,7 @@ static void Noise (unsigned char * inbuf, long iWidth, long iHeight, long iPerLi
29692969
for (i = 0; i < count; i++)
29702970
{
29712971
c = *pi;
2972-
c += (128 - genrand () * 256) * threshold;
2972+
c += (long) ((128 - genrand () * 256) * threshold);
29732973
*pi++ = CLAMP (c);
29742974
}
29752975

miniwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class CMiniWindow
228228
long EllipseWidth, long EllipseHeight);
229229

230230
long CreateImage(LPCTSTR ImageId,
231-
long Row1, long Row2, long Row3, long Row4, long Row5, long Row6, long Row7, long Row8);
231+
WORD Row1, WORD Row2, WORD Row3, WORD Row4, WORD Row5, WORD Row6, WORD Row7, WORD Row8);
232232

233233
long BlendImage(LPCTSTR ImageId,
234234
long Left, long Top, long Right, long Bottom,

scripting/methods.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13494,7 +13494,8 @@ long CMUSHclientDoc::WindowCreateImage(LPCTSTR Name, LPCTSTR ImageId,
1349413494
if (it == m_MiniWindows.end ())
1349513495
return eNoSuchWindow;
1349613496

13497-
return it->second->CreateImage (ImageId, Row1, Row2, Row3, Row4, Row5, Row6, Row7, Row8);
13497+
return it->second->CreateImage (ImageId, (WORD) Row1, (WORD) Row2, (WORD) Row3,
13498+
(WORD) Row4, (WORD) Row5, (WORD) Row6, (WORD) Row7, (WORD) Row8);
1349813499
} // end of CMUSHclientDoc::WindowCreateImage
1349913500

1350013501

0 commit comments

Comments
 (0)