mcst-linux-kernel/patches-2024.06.26/libibtk-0.0.14/0001-std-max-std-min-385525...

208 lines
7.3 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 17fd23f399714056c53b8b0c6a71cefd630dcebe Mon Sep 17 00:00:00 2001
Date: Tue, 26 Apr 2016 16:14:13 +0300
Subject: замена конструкций ">?" и "<?" на std::max и std::min соответственно
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
баг дебиана 385525
---
src/ibox.cpp | 5 ++++-
src/ibutton.cpp | 5 ++++-
src/ilistbox.cpp | 13 ++++++++++---
src/isbutton.cpp | 5 ++++-
src/islider.cpp | 5 ++++-
src/istatbar.cpp | 5 ++++-
src/iwindow.cpp | 10 ++++++++--
7 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/src/ibox.cpp b/src/ibox.cpp
index 61f7f61..40a3a99 100644
--- a/src/ibox.cpp
+++ b/src/ibox.cpp
@@ -17,6 +17,7 @@
\**************************************************************************/
+#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <X11/Xlib.h>
@@ -184,7 +185,9 @@ void IBox::Rebuild() {
XFillRectangle(Win->GetDisplay(), Img[1], Win->GetGC(), 2, 3,xsize-4,ysize-4);
if(Wrk[disabled] != None) {
XCopyArea(Win->GetDisplay(), Wrk[disabled], Img[disabled], Win->GetGC(),
- xscroll, 0, Wlen<?(xsize-4), ysize-4, 2, 2);
+ xscroll, 0, std::min(Wlen, (xsize-4)), ysize-4, 2, 2);
+/* rasp:: HELCE debian bug 385525
+ xscroll, 0, Wlen<?(xsize-4), ysize-4, 2, 2); */
}
Redraw();
if(!hidden) Win->Redraw(xpos, ypos, xsize, ysize);
diff --git a/src/ibutton.cpp b/src/ibutton.cpp
index a3e2a93..88f04e1 100644
--- a/src/ibutton.cpp
+++ b/src/ibutton.cpp
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
\**************************************************************************/
+#include <algorithm>
#include <stdio.h>
#include <string.h>
@@ -120,7 +121,9 @@ void IButton::Rebuild() {
void IButton::Redraw() {
if(!hidden) {
- XCopyArea(Win->GetDisplay(), Img[state<?2], Win->GetWindowBuffer(), Win->GetGC(),
+ /* rasp:: HELCE debian bug 385525
+ XCopyArea(Win->GetDisplay(), Img[state<?2], Win->GetWindowBuffer(), Win->GetGC(), */
+ XCopyArea(Win->GetDisplay(), Img[std::min(state,2)], Win->GetWindowBuffer(), Win->GetGC(),
0, 0, xsize, ysize, xpos, ypos);
Win->Redraw(xpos, ypos, xsize, ysize);
}
diff --git a/src/ilistbox.cpp b/src/ilistbox.cpp
index e1bd949..09ab067 100644
--- a/src/ilistbox.cpp
+++ b/src/ilistbox.cpp
@@ -17,6 +17,8 @@
\**************************************************************************/
+#include <algorithm>
+
#include <stdio.h>
#include <string.h>
@@ -95,7 +97,9 @@ void IListBox::Init(char **txt, int n, IWindow *w, int xp, int yp, int xs, int y
XSetBackground(disp, gc, p);
XSetForeground(disp, gc, b);
XDrawImageString(disp, Wrk[ctr], gc, 0, as, txt[ctr], strlen(txt[ctr]));
- dy = dy>?ht;
+ /* rasp:: HELCE debian bug 385525
+ dy = dy>?ht; */
+ dy = std::max(dy, ht);
}
}
if(dy>0) lines = (ysize-6)/dy;
@@ -121,9 +125,12 @@ void IListBox::Rebuild() {
XSetForeground(disp, gc, Win->GetPaperColor());
XFillRectangle(disp, Img, gc, 2, 2, xsize-4, ysize-4);
XSetForeground(disp, gc, Win->GetSelectColor());
- for(ctr=0; ctr<(lines<?nent); ctr++) {
+ /* rasp:: HELCE debian bug 385525
+ for(ctr=0; ctr<(lines<?nent); ctr++) { */
+ for(ctr=0; ctr<std::min(lines, nent); ctr++) {
XCopyArea(disp, Wrk[ctr], Img, gc, 0, 0,
- wx[ctr], (wy[ctr])<?(xsize-6), 3, 3+(dy*ctr));
+ /* wx[ctr], (wy[ctr])<?(xsize-6), 3, 3+(dy*ctr)); */
+ wx[ctr], std::min((wy[ctr]), (xsize-6)), 3, 3+(dy*ctr));
for(ctr2=0; ctr2<selmax; ctr2++) {
if(sel[ctr2] == ctr) {
ctr2 = selmax;
diff --git a/src/isbutton.cpp b/src/isbutton.cpp
index d9fa8ef..5c51bec 100644
--- a/src/isbutton.cpp
+++ b/src/isbutton.cpp
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
\**************************************************************************/
+#include <algorithm>
#include <string.h>
@@ -35,7 +36,9 @@ void ISButton::Rebuild() {
void ISButton::Redraw() {
if(!hidden) {
- XCopyArea(Win->GetDisplay(), Img[state<?2], Win->GetWindowBuffer(), Win->GetGC(),
+ /* rasp:: HELCE debian bug 385525
+ XCopyArea(Win->GetDisplay(), Img[state<?2], Win->GetWindowBuffer(), Win->GetGC(), */
+ XCopyArea(Win->GetDisplay(), Img[std::min(state, 2)], Win->GetWindowBuffer(), Win->GetGC(),
0, 0, xsize, ysize, xpos, ypos);
Win->Redraw(xpos, ypos, xsize, ysize);
}
diff --git a/src/islider.cpp b/src/islider.cpp
index 965dc4d..9232d54 100644
--- a/src/islider.cpp
+++ b/src/islider.cpp
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
\**************************************************************************/
+#include <algorithm>
#include <stdio.h>
#include <string.h>
@@ -128,7 +129,9 @@ void ISlider::Rebuild() {
if(max > min && (((value-min)*(xsize-4))/(max-min)) > 0) {
- int xbar = (xsize-4) <? (((value-min)*(xsize-4))/(max-min));
+ /* rasp:: HELCE debian bug 385525
+ int xbar = (xsize-4) <? (((value-min)*(xsize-4))/(max-min)); */
+ int xbar = std::min((xsize-4), (((value-min)*(xsize-4))/(max-min)));
Wrk[0] = XCreatePixmap(disp, w, xbar, ysize-4, DefaultDepth(disp, 0));
Wrk[1] = XCreatePixmap(disp, w, xbar, ysize-4, DefaultDepth(disp, 0));
diff --git a/src/istatbar.cpp b/src/istatbar.cpp
index f79b425..a784ba9 100644
--- a/src/istatbar.cpp
+++ b/src/istatbar.cpp
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
\**************************************************************************/
+#include <algorithm>
#include <stdio.h>
#include <string.h>
@@ -93,7 +94,9 @@ void IStatBar::Redraw() {
(ysize+ysize-(as+des-2))>>1, txt, strlen(txt));
if(total > 0 && ((progress*(xsize-4))/total) > 0) {
- int xbar = (xsize-4) <? ((progress*(xsize-4))/total);
+ /* rasp:: HELCE debian bug 385525
+ int xbar = (xsize-4) <? ((progress*(xsize-4))/total); */
+ int xbar = std::min((xsize-4), ((progress*(xsize-4))/total));
Pixmap Wrk = XCreatePixmap(disp, w, xbar, ysize-4, DefaultDepth(disp, 0));
XSetForeground(disp, gc, Win->GetSelectColor());
XFillRectangle(disp, Wrk, gc, 0, 0, xbar, ysize-4);
diff --git a/src/iwindow.cpp b/src/iwindow.cpp
index 848204d..3061f3f 100644
--- a/src/iwindow.cpp
+++ b/src/iwindow.cpp
@@ -19,6 +19,8 @@
#include "iwindow.h"
+#include <algorithm>
+
#define DEFAULT_NAME "IBTK v0.0"
#include <X11/X.h>
@@ -555,12 +557,16 @@ void IWindow::Map() {
void IWindow::Redraw(int x, int y, int xs, int ys) {
// XClearArea(Disp, Win, x, y, xs<?(bufxs-x), ys<?(bufys-y), False);
- XCopyArea(Disp, WinBuf, Win, gc, x, y, xs<?(bufxs-x), ys<?(bufys-y), x, y);
+ /* rasp:: HELCE debian bug 385525
+ XCopyArea(Disp, WinBuf, Win, gc, x, y, xs<?(bufxs-x), ys<?(bufys-y), x, y); */
+ XCopyArea(Disp, WinBuf, Win, gc, x, y, std::min(xs,(bufxs-x)), std::min(ys,(bufys-y)), x, y);
}
void IWindow::Redraw() {
XClearWindow(Disp, Win);
- XCopyArea(Disp, WinBuf, Win, gc, 0, 0, xsize<?bufxs, ysize<?bufys, 0, 0);
+ /* rasp:: HELCE debian bug 385525
+ XCopyArea(Disp, WinBuf, Win, gc, 0, 0, xsize<?bufxs, ysize<?bufys, 0, 0); */
+ XCopyArea(Disp, WinBuf, Win, gc, 0, 0, std::min(xsize, bufxs), std::min(ysize, bufys), 0, 0);
}
void IWindow::Rebuild(int x, int y, int xs, int ys) {
--
2.16.4