File xclass-0.9.2-gcc6.patch of Package xclass
bts: #1041255
Author: i@marguerite
Summary: fix narrowing conversion from int to char inside {}
Author: Adam Majer <amajer@suse.de>
Summary: use signed calculations when calling abs(x)
Use signed variables when doing a "distance" calculation.
Callng abs(x) on unsinged is pointless, since all values
are always >0. But since the code actually assumes signed
arithmetic, but uses unsigned - fix the code.
Index: xclass-0.9.2/lib/libxclass/OXFrame.cc
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/OXFrame.cc
+++ xclass-0.9.2/lib/libxclass/OXFrame.cc
@@ -345,8 +345,8 @@ int OXFrame::HandleEvent(XEvent *event)
case ButtonPress:
if ((event->xbutton.time - _lastclick < 350) &&
(event->xbutton.button == _lastbutton) &&
- (abs(event->xbutton.x_root - _dbx) < 3) &&
- (abs(event->xbutton.y_root - _dby) < 3) &&
+ abs(event->xbutton.x_root - (signed)_dbx) < 3 &&
+ abs(event->xbutton.y_root - (signed)_dby) < 3 &&
(event->xbutton.window == _dbw))
++_clickcount;
else
Index: xclass-0.9.2/lib/libxclass/icons/VResizer.xbm
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/icons/VResizer.xbm
+++ xclass-0.9.2/lib/libxclass/icons/VResizer.xbm
@@ -1,6 +1,6 @@
#define VResizer_width 32
#define VResizer_height 32
-static char VResizer_bits[] = {
+static unsigned char VResizer_bits[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x7f,0xfd,0xff,0xff,0x7f,0xfd,0xff,0xff,0x7f,0xfd,0xff,0xff,
Index: xclass-0.9.2/lib/libxclass/icons/VmaskResizer.xbm
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/icons/VmaskResizer.xbm
+++ xclass-0.9.2/lib/libxclass/icons/VmaskResizer.xbm
@@ -1,6 +1,6 @@
#define VmaskResizer_width 32
#define VmaskResizer_height 32
-static char VmaskResizer_bits[] = {
+static unsigned char VmaskResizer_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,0x00,
Index: xclass-0.9.2/lib/libxclass/OXResizer.cc
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/OXResizer.cc
+++ xclass-0.9.2/lib/libxclass/OXResizer.cc
@@ -56,9 +56,9 @@ OXHorizontalResizer::OXHorizontalResizer
int hspotx = 16, hspoty = 16;
- curPix = XCreateBitmapFromData(GetDisplay(), GetId(), HResizer_bits,
+ curPix = XCreateBitmapFromData(GetDisplay(), GetId(), (const char*)HResizer_bits,
HResizer_width, HResizer_height);
- maskPix = XCreateBitmapFromData(GetDisplay(), GetId(), HmaskResizer_bits,
+ maskPix = XCreateBitmapFromData(GetDisplay(), GetId(), (const char*)HmaskResizer_bits,
HmaskResizer_width, HmaskResizer_height);
XColor black, white;
@@ -306,9 +306,9 @@ OXVerticalResizer::OXVerticalResizer(con
int hspotx = 16, hspoty = 16;
- curPix = XCreateBitmapFromData(GetDisplay(), GetId(), VResizer_bits,
+ curPix = XCreateBitmapFromData(GetDisplay(), GetId(), (const char*)VResizer_bits,
VResizer_width, VResizer_height);
- maskPix = XCreateBitmapFromData(GetDisplay(), GetId(), VmaskResizer_bits,
+ maskPix = XCreateBitmapFromData(GetDisplay(), GetId(), (const char*)VmaskResizer_bits,
VmaskResizer_width, VmaskResizer_height);
XColor black, white;
Index: xclass-0.9.2/lib/libxclass/icons/HResizer.xbm
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/icons/HResizer.xbm
+++ xclass-0.9.2/lib/libxclass/icons/HResizer.xbm
@@ -1,6 +1,6 @@
#define HResizer_width 32
#define HResizer_height 32
-static char HResizer_bits[] = {
+static unsigned char HResizer_bits[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xbf,
0xfe,0xff,0xff,0xdf,0xfd,0xff,0xff,0xef,0xfb,0xff,0xff,0xf7,0xf7,0xff,0xff,
Index: xclass-0.9.2/lib/libxclass/icons/HmaskResizer.xbm
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/icons/HmaskResizer.xbm
+++ xclass-0.9.2/lib/libxclass/icons/HmaskResizer.xbm
@@ -1,6 +1,6 @@
#define HmaskResizer_width 32
#define HmaskResizer_height 32
-static char HmaskResizer_bits[] = {
+static unsigned char HmaskResizer_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,
0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,
Index: xclass-0.9.2/lib/libxclass/OGifImage.cc
===================================================================
--- xclass-0.9.2.orig/lib/libxclass/OGifImage.cc
+++ xclass-0.9.2/lib/libxclass/OGifImage.cc
@@ -973,9 +973,9 @@ void OGifImage::AllocClosestColor(int Co
for (j = 0; j < XNumOfColors; j++) {
// Find the closest color in 3D RGB space using L1 norm.
- if ((D = abs(Red - XOldColorTable[j].red) +
- abs(Green - XOldColorTable[j].green) +
- abs(Blue - XOldColorTable[j].blue)) < Distance) {
+ if ((D = abs((long)Red - XOldColorTable[j].red) +
+ abs((long)Green - XOldColorTable[j].green) +
+ abs((long)Blue - XOldColorTable[j].blue)) < Distance) {
Distance = D;
Index = j;
}