forked from pool/libXbgi
[info=8922fd9d72ff582c5092fd1a079299b5c8262991f46248b9e38a281f307eb88f]
OBS-URL: https://build.opensuse.org/package/show/graphics/libXbgi?expand=0&rev=11
This commit is contained in:
commit
dbfd22f220
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
4
_scmsync.obsinfo
Normal file
4
_scmsync.obsinfo
Normal file
@ -0,0 +1,4 @@
|
||||
mtime: 1725555752
|
||||
commit: 8922fd9d72ff582c5092fd1a079299b5c8262991f46248b9e38a281f307eb88f
|
||||
url: https://src.opensuse.org/jengelh/libXbgi
|
||||
revision: master
|
3
build.specials.obscpio
Normal file
3
build.specials.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d2b2613cdfc2d13d04c4de9045fea3d75e7f1a7e099ab6ce4060590da1dadb62
|
||||
size 256
|
33
libXbgi.changes
Normal file
33
libXbgi.changes
Normal file
@ -0,0 +1,33 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 5 17:01:55 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Rectify xbgi-automake.diff to feature current version
|
||||
- Add xbgi-gcc14.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 23 14:44:45 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Update to release 365
|
||||
* Bugs in xkbhit(), outtext(), and outtextxy() fixed.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 23 13:36:52 UTC 2014 - jengelh@inai.de
|
||||
|
||||
- Update to new upstream release 364
|
||||
* In this release, getpixel() was rewritten for higher speed and
|
||||
floodfill() asw fixed and made much faster.
|
||||
- Add xbgi-sequence.diff, xbgi-grapherrormsg.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 12 17:41:53 UTC 2013 - jengelh@inai.de
|
||||
|
||||
- Update to new upstream release 363
|
||||
* In addition to minor bugfixes, this release implements
|
||||
user-defined line patterns, setallpalette(), and more mouse
|
||||
functions.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 30 14:33:30 UTC 2013 - jengelh@inai.de
|
||||
|
||||
- Initial package (version 362) for build.opensuse.org.
|
||||
Add xbgi-automake.diff, xbgi-getpixel.diff.
|
102
libXbgi.spec
Normal file
102
libXbgi.spec
Normal file
@ -0,0 +1,102 @@
|
||||
#
|
||||
# spec file for package libXbgi
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: libXbgi
|
||||
%define lname libXbgi1
|
||||
Version: 365
|
||||
Release: 0
|
||||
Summary: BGI-compatible 2D graphics C library with X11 backend
|
||||
License: GPL-2.0-or-later AND MIT
|
||||
Group: Development/Libraries/C and C++
|
||||
URL: http://libXbgi.sf.net/
|
||||
|
||||
#Freecode-URL: http://freecode.com/projects/libxbgi/
|
||||
Source: https://downloads.sf.net/libxbgi/xbgi-%version.tar.gz
|
||||
Patch1: xbgi-automake.diff
|
||||
Patch2: xbgi-getpixel.diff
|
||||
Patch3: xbgi-sequence.diff
|
||||
Patch4: xbgi-grapherrormsg.diff
|
||||
Patch5: xbgi-gcc14.diff
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(x11)
|
||||
|
||||
%description
|
||||
libXbgi is a Borland Graphics Interface (BGI) emulation library for
|
||||
X11. This library strictly emulates most BGI functions, making it
|
||||
possible to compile X11 versions of programs written for
|
||||
Turbo/Borland C. RGB extensions and basic mouse support are also
|
||||
implemented.
|
||||
|
||||
%package -n %lname
|
||||
Summary: BGI-compatible 2D graphics C library
|
||||
License: MIT
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n %lname
|
||||
libXbgi is a Borland Graphics Interface (BGI) emulation library for
|
||||
X11. This library strictly emulates most BGI functions, making it
|
||||
possible to compile X11 versions of programs written for
|
||||
Turbo/Borland C. RGB extensions and basic mouse support are also
|
||||
implemented.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for the XBGI library
|
||||
License: MIT
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: %lname = %version
|
||||
Requires: libX11-devel
|
||||
Requires: xorg-x11-proto-devel
|
||||
|
||||
%description devel
|
||||
libXbgi is a Borland Graphics Interface (BGI) emulation library for
|
||||
X11. This library strictly emulates most BGI functions, making it
|
||||
possible to compile X11 versions of programs written for
|
||||
Turbo/Borland C. RGB extensions and basic mouse support are also
|
||||
implemented.
|
||||
|
||||
This package contains the development headers for the library found
|
||||
in %lname.
|
||||
|
||||
%prep
|
||||
%autosetup -n xbgi-%version -p1
|
||||
|
||||
%build
|
||||
autoreconf -fiv
|
||||
%configure --disable-static
|
||||
make %{?_smp_mflags} V=1
|
||||
|
||||
%install
|
||||
%make_install
|
||||
rm -f "%buildroot/%_libdir"/*.la
|
||||
|
||||
%post -n %lname -p /sbin/ldconfig
|
||||
%postun -n %lname -p /sbin/ldconfig
|
||||
|
||||
%files -n %lname
|
||||
%doc License.txt
|
||||
%_libdir/libXbgi.so.1*
|
||||
|
||||
%files devel
|
||||
%_includedir/graphics.h
|
||||
%_libdir/libXbgi.so
|
||||
%doc Functions.txt Using.txt README TODO.txt
|
||||
|
||||
%changelog
|
3
xbgi-365.tar.gz
Normal file
3
xbgi-365.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e070abe1408b5d994ee94fe32afbe6dc2623f45db6458e967917fa98e180949e
|
||||
size 110901
|
125
xbgi-automake.diff
Normal file
125
xbgi-automake.diff
Normal file
@ -0,0 +1,125 @@
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2013-04-30 16:20:06.862768841 +0200
|
||||
|
||||
build: use automake as build system
|
||||
|
||||
Less Makefile code, pkgconfig is used, libXbgi can be built as a
|
||||
shared library.
|
||||
|
||||
---
|
||||
Makefile.am | 4 ++++
|
||||
Using.txt | 2 +-
|
||||
configure.ac | 9 +++++++++
|
||||
m4/.gitignore | 2 ++
|
||||
src/Makefile.am | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/test/Makefile.am | 11 +++++++++++
|
||||
6 files changed, 71 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: xbgi-364/Makefile.am
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ xbgi-364/Makefile.am
|
||||
@@ -0,0 +1,4 @@
|
||||
+# -*- Makefile -*-
|
||||
+
|
||||
+ACLOCAL_AMFLAGS = -I m4
|
||||
+SUBDIRS = src
|
||||
Index: xbgi-364/Using.txt
|
||||
===================================================================
|
||||
--- xbgi-364.orig/Using.txt
|
||||
+++ xbgi-364/Using.txt
|
||||
@@ -11,7 +11,7 @@ Nearly all programs can be compiled with
|
||||
|
||||
To compile a program against libXbgi:
|
||||
|
||||
- gcc -o program program.c /usr/lib/libXbgi.a -lX11 -lm
|
||||
+ gcc -o program program.c -lXbgi
|
||||
|
||||
Most old programs that use the original BGI library should compile
|
||||
with no modification. For instance,
|
||||
Index: xbgi-364/configure.ac
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ xbgi-364/configure.ac
|
||||
@@ -0,0 +1,9 @@
|
||||
+AC_INIT([xbgi], [365])
|
||||
+AC_CONFIG_AUX_DIR([build-aux])
|
||||
+AC_CONFIG_MACRO_DIR([m4])
|
||||
+AC_PROG_CC
|
||||
+AM_INIT_AUTOMAKE([foreign subdir-objects tar-pax dist-xz no-dist-gzip])
|
||||
+LT_INIT
|
||||
+PKG_CHECK_MODULES([x11], [x11])
|
||||
+AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile])
|
||||
+AC_OUTPUT
|
||||
Index: xbgi-364/m4/.gitignore
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ xbgi-364/m4/.gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
+/libtool.m4
|
||||
+/lt*.m4
|
||||
Index: xbgi-364/src/Makefile.am
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ xbgi-364/src/Makefile.am
|
||||
@@ -0,0 +1,44 @@
|
||||
+# -*- Makefile -*-
|
||||
+
|
||||
+SUBDIRS = . test
|
||||
+AM_CPPFLAGS = ${x11_CFLAGS}
|
||||
+AM_CFLAGS = -Wall
|
||||
+
|
||||
+lib_LTLIBRARIES = libXbgi.la
|
||||
+
|
||||
+libXbgi_la_SOURCES = \
|
||||
+ _graphfreemem.c _graphgetmem.c arc.c bar.c bar3d.c circle.c\
|
||||
+ cleardevice.c clearviewport.c closegraph.c detectgraph.c drawpoly.c\
|
||||
+ ellipse.c fillellipse.c fillpoly.c floodfill.c\
|
||||
+ getarccoords.c getaspectratio.c getbkcolor.c getch.c getcolor.c\
|
||||
+ getdate.c getdefaultpalette.c getdrivername.c getfillpattern.c\
|
||||
+ getfillsettings.c getgraphmode.c getimage.c getlinesettings.c\
|
||||
+ getmaxcolor.c getmaxmode.c getmaxx.c getmaxy.c getmodename.c\
|
||||
+ getmoderange.c getpalette.c getpalettesize.c getpixel.c\
|
||||
+ gettextsettings.c getviewsettings.c getx.c gety.c graphdefaults.c\
|
||||
+ grapherrormsg.c graphresult.c imagesize.c initgraph.c\
|
||||
+ installuserdriver.c installuserfont.c ismouseclick.c \
|
||||
+ kbhit.c line.c linerel.c lineto.c \
|
||||
+ moverel.c moveto.c outtext.c outtextxy.c pieslice.c putimage.c\
|
||||
+ putpixel.c rectangle.c registerbgidriver.c registerbgifont.c\
|
||||
+ restorecrtmode.c rotated.c sector.c setactivepage.c setallpalette.c\
|
||||
+ setaspectratio.c setbkcolor.c setcolor.c setfillpattern.c\
|
||||
+ setfillstyle.c setgraphbufsize.c setgraphmode.c setlinestyle.c\
|
||||
+ setpalette.c setrgbpalette.c settextjustify.c settextstyle.c\
|
||||
+ setusercharsize.c setviewport.c setvisualpage.c setwritemode.c\
|
||||
+ textheight.c textwidth.c delay.c\
|
||||
+ COLOR.c getmaxheight.c getmaxwidth.c getmouseclick.c\
|
||||
+ initwindow.c mouseclick.c mousex.c mousey.c _putpixel.c\
|
||||
+ IS_BGI_COLOR.c IS_RGB_COLOR.c setrgbcolor.c setbkrgbcolor.c\
|
||||
+ getevent.c converttorgb.c refresh.c
|
||||
+libXbgi_la_LDFLAGS = -Wl,-z,defs -version-info 1:0:0
|
||||
+libXbgi_la_LIBADD = -lm ${x11_LIBS}
|
||||
+
|
||||
+EXTRA_DIST = xkbhit.c
|
||||
+
|
||||
+include_HEADERS = graphics.h
|
||||
+
|
||||
+noinst_PROGRAMS = demo
|
||||
+
|
||||
+demo_SOURCES = demo.c
|
||||
+demo_LDADD = libXbgi.la
|
||||
Index: xbgi-364/src/test/Makefile.am
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ xbgi-364/src/test/Makefile.am
|
||||
@@ -0,0 +1,11 @@
|
||||
+# -*- Makefile -*-
|
||||
+
|
||||
+AM_CPPFLAGS = ${x11_CFLAGS}
|
||||
+AM_CFLAGS = -Wall
|
||||
+
|
||||
+LDADD = -lm ${x11_LIBS} ../libXbgi.la
|
||||
+
|
||||
+noinst_PROGRAMS = bgidemo cellular fern floodfilltest hopalong mandelbrot \
|
||||
+ mousetest moveit simple turtledemo userpalette
|
||||
+turtledemo_SOURCES = turtle.c turtledemo.c
|
||||
+userpalette_SOURCES = turtle.c userpalette.c
|
48
xbgi-gcc14.diff
Normal file
48
xbgi-gcc14.diff
Normal file
@ -0,0 +1,48 @@
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2024-09-05 17:32:55.590866847 +0200
|
||||
|
||||
gcc-14 does not like not having a matching prototype.
|
||||
|
||||
---
|
||||
src/graphics.h | 1 +
|
||||
src/rotated.h | 2 +-
|
||||
src/setusercharsize.c | 1 +
|
||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: xbgi-365/src/graphics.h
|
||||
===================================================================
|
||||
--- xbgi-365.orig/src/graphics.h
|
||||
+++ xbgi-365/src/graphics.h
|
||||
@@ -300,6 +300,7 @@ typedef struct {
|
||||
void fillellipse PROTO((int, int, int, int));
|
||||
void fillpoly PROTO((int, int *));
|
||||
void floodfill PROTO((int, int, int));
|
||||
+ void _floodfill PROTO((int, int));
|
||||
void getarccoords PROTO((struct arccoordstype *));
|
||||
void getaspectratio PROTO((int *, int *));
|
||||
int getbkcolor PROTO((void));
|
||||
Index: xbgi-365/src/rotated.h
|
||||
===================================================================
|
||||
--- xbgi-365.orig/src/rotated.h
|
||||
+++ xbgi-365/src/rotated.h
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
extern "C" {
|
||||
float XRotVersion(char*, int);
|
||||
-void XRotSetMagnification(float);
|
||||
+void XRotSetMagnification(float, float);
|
||||
void XRotSetBoundingBoxPad(int);
|
||||
int XRotDrawString(Display*, XFontStruct*, float,
|
||||
Drawable, GC, int, int, char*);
|
||||
Index: xbgi-365/src/setusercharsize.c
|
||||
===================================================================
|
||||
--- xbgi-365.orig/src/setusercharsize.c
|
||||
+++ xbgi-365/src/setusercharsize.c
|
||||
@@ -8,6 +8,7 @@
|
||||
*
|
||||
*/
|
||||
#include "graphics.h"
|
||||
+#include "rotated.h"
|
||||
|
||||
void setusercharsize(int multx, int divx, int multy, int divy)
|
||||
{
|
30
xbgi-getpixel.diff
Normal file
30
xbgi-getpixel.diff
Normal file
@ -0,0 +1,30 @@
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2013-04-30 16:29:33.540380817 +0200
|
||||
|
||||
gcc:
|
||||
getpixel.c: In function 'getpixel':
|
||||
getpixel.c:29:1: warning: control reaches end of non-void function [-Wreturn-type]
|
||||
|
||||
rpmlint:
|
||||
I: Program returns random data in a function
|
||||
E: libXbgi no-return-in-nonvoid-function getpixel.c:29
|
||||
|
||||
If the color is not in the palette, the function will return trash.
|
||||
Any value would be ok, but consistently give 0 to quiesce gcc.
|
||||
|
||||
---
|
||||
src/getpixel.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: xbgi-364/src/getpixel.c
|
||||
===================================================================
|
||||
--- xbgi-364.orig/src/getpixel.c
|
||||
+++ xbgi-364/src/getpixel.c
|
||||
@@ -30,6 +30,7 @@ unsigned int getpixel(int x, int y)
|
||||
for (col = 0; col < MAXCOLORS + 1; col++)
|
||||
if (vga_palette[col].pixel_value == pixel)
|
||||
return (col);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
|
131
xbgi-grapherrormsg.diff
Normal file
131
xbgi-grapherrormsg.diff
Normal file
@ -0,0 +1,131 @@
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2014-01-23 14:44:35.390427664 +0100
|
||||
|
||||
xbgi: resolve invocation of undefined behavior in grapherrormsg.c
|
||||
|
||||
rpmlint said:
|
||||
I: Program is using uninitialized variables.
|
||||
Note the difference between "is used" and "may be used"
|
||||
W: libXbgi uninitialized-variable grapherrormsg.c:78
|
||||
|
||||
gcc:
|
||||
grapherrormsg.c: In function 'grapherrormsg':
|
||||
grapherrormsg.c:78:2: warning: 'errormsg' is used uninitialized in this function [-Wuninitialized]
|
||||
return (errormsg);
|
||||
^
|
||||
|
||||
Summary:
|
||||
The value of errormsg is undefined. In particular, it is not
|
||||
even guaranteed to have enough space to hold the strings copied
|
||||
into it with strcpy.
|
||||
Switch to constant string pointers.
|
||||
|
||||
---
|
||||
src/grapherrormsg.c | 42 +++++++++++++++++++++---------------------
|
||||
src/graphics.h | 2 +-
|
||||
2 files changed, 22 insertions(+), 22 deletions(-)
|
||||
|
||||
Index: xbgi-364/src/grapherrormsg.c
|
||||
===================================================================
|
||||
--- xbgi-364.orig/src/grapherrormsg.c
|
||||
+++ xbgi-364/src/grapherrormsg.c
|
||||
@@ -11,65 +11,65 @@
|
||||
#include <string.h>
|
||||
#include "graphics.h"
|
||||
|
||||
-char *grapherrormsg(int errorcode)
|
||||
+const char *grapherrormsg(int errorcode)
|
||||
{
|
||||
enum graphics_errors gr_error;
|
||||
- char *errormsg;
|
||||
+ const char *errormsg = "Unknown error";
|
||||
|
||||
gr_error = errorcode;
|
||||
switch (gr_error) {
|
||||
case grOk:
|
||||
- strcpy(errormsg, "No error");
|
||||
+ errormsg = "No error";
|
||||
break;
|
||||
case grNoInitGraph:
|
||||
- strcpy(errormsg,
|
||||
- "XBGI graphics not installed (use initgraph()).");
|
||||
+ errormsg =
|
||||
+ "XBGI graphics not installed (use initgraph()).";
|
||||
break;
|
||||
case grNotDetected:
|
||||
- strcpy(errormsg, "Graphics hardware not detected.");
|
||||
+ errormsg = "Graphics hardware not detected.";
|
||||
break;
|
||||
case grFileNotFound:
|
||||
- strcpy(errormsg, "Device driver file not found.");
|
||||
+ errormsg = "Device driver file not found.";
|
||||
break;
|
||||
case grInvalidDriver:
|
||||
- strcpy(errormsg, "Invalid device driver file.");
|
||||
+ errormsg = "Invalid device driver file.";
|
||||
break;
|
||||
case grNoLoadMem:
|
||||
- strcpy(errormsg, "Not enough memory to load driver.");
|
||||
+ errormsg = "Not enough memory to load driver.";
|
||||
break;
|
||||
case grNoScanMem:
|
||||
- strcpy(errormsg, "Out of memory in scan fill.");
|
||||
+ errormsg = "Out of memory in scan fill.";
|
||||
break;
|
||||
case grNoFloodMem:
|
||||
- strcpy(errormsg, "Out of memory in flood fill.");
|
||||
+ errormsg = "Out of memory in flood fill.";
|
||||
break;
|
||||
case grFontNotFound:
|
||||
- strcpy(errormsg, "Font file not found.");
|
||||
+ errormsg = "Font file not found.";
|
||||
break;
|
||||
case grNoFontMem:
|
||||
- strcpy(errormsg, "Not enough memory to load font.");
|
||||
+ errormsg = "Not enough memory to load font.";
|
||||
break;
|
||||
case grInvalidMode:
|
||||
- strcpy(errormsg, "Invalid graphics mode for"
|
||||
- "selected driver.");
|
||||
+ errormsg = "Invalid graphics mode for"
|
||||
+ "selected driver.";
|
||||
break;
|
||||
case grError:
|
||||
- strcpy(errormsg, "Graphics error.");
|
||||
+ errormsg = "Graphics error.";
|
||||
break;
|
||||
case grIOerror:
|
||||
- strcpy(errormsg, "Graphics I/O error.");
|
||||
+ errormsg = "Graphics I/O error.";
|
||||
break;
|
||||
case grInvalidFont:
|
||||
- strcpy(errormsg, "Invalid font file.");
|
||||
+ errormsg = "Invalid font file.";
|
||||
break;
|
||||
case grInvalidFontNum:
|
||||
- strcpy(errormsg, "Invalid font number.");
|
||||
+ errormsg = "Invalid font number.";
|
||||
break;
|
||||
case grInvalidDeviceNum:
|
||||
- strcpy(errormsg, "Invalid device number.");
|
||||
+ errormsg = "Invalid device number.";
|
||||
break;
|
||||
case grInvalidVersion:
|
||||
- strcpy(errormsg, "Invalid version of file.");
|
||||
+ errormsg = "Invalid version of file.";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
Index: xbgi-364/src/graphics.h
|
||||
===================================================================
|
||||
--- xbgi-364.orig/src/graphics.h
|
||||
+++ xbgi-364/src/graphics.h
|
||||
@@ -325,7 +325,7 @@ typedef struct {
|
||||
int getx PROTO((void));
|
||||
int gety PROTO((void));
|
||||
void graphdefaults PROTO((void));
|
||||
- char *grapherrormsg PROTO((int));
|
||||
+ const char *grapherrormsg PROTO((int));
|
||||
int graphresult PROTO((void));
|
||||
unsigned int imagesize PROTO((int, int, int, int));
|
||||
void initgraph PROTO((int *, int *, char *));
|
47
xbgi-sequence.diff
Normal file
47
xbgi-sequence.diff
Normal file
@ -0,0 +1,47 @@
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2014-01-23 14:42:25.612279578 +0100
|
||||
|
||||
bgidemo: resolve invocation of undefined behavior near i=++i
|
||||
|
||||
rpmlint says:
|
||||
I: Program causes undefined operation
|
||||
(likely same variable used twiceand post/pre incremented in the same expression).
|
||||
e.g. x = x++; Split it in two operations.
|
||||
W: libXbgi sequence-point bgidemo.c:534, 1116
|
||||
|
||||
gcc had to say:
|
||||
bgidemo.c: In function 'ColorDemo':
|
||||
bgidemo.c:534:13: warning: operation on 'color' may be undefined [-Wsequence-point]
|
||||
color = ++color % MaxColors; /* Advance to the next color */
|
||||
^
|
||||
bgidemo.c: In function 'UserLineStyleDemo':
|
||||
bgidemo.c:1116:7: warning: operation on 'i' may be undefined [-Wsequence-point]
|
||||
i = ++i % 16; /* Advance to next bit pattern */
|
||||
^
|
||||
|
||||
---
|
||||
src/test/bgidemo.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: xbgi-364/src/test/bgidemo.c
|
||||
===================================================================
|
||||
--- xbgi-364.orig/src/test/bgidemo.c
|
||||
+++ xbgi-364/src/test/bgidemo.c
|
||||
@@ -531,7 +531,7 @@ void ColorDemo(void)
|
||||
itoa( color, cnum, 10 ); /* Convert # to ASCII */
|
||||
outtextxy( x+(width/2), y+height+4, cnum ); /* Show color # */
|
||||
|
||||
- color = ++color % MaxColors; /* Advance to the next color */
|
||||
+ color = (color + 1) % MaxColors; /* Advance to the next color */
|
||||
x += (width / 2) * 3; /* move the column base */
|
||||
} /* End of Column loop */
|
||||
|
||||
@@ -1113,7 +1113,7 @@ void UserLineStyleDemo(void)
|
||||
line( x, y, x, h-y ); /* Draw the new line pattern */
|
||||
|
||||
x += 5; /* Move the X location of line */
|
||||
- i = ++i % 16; /* Advance to next bit pattern */
|
||||
+ i = (i + 1) % 16; /* Advance to next bit pattern */
|
||||
|
||||
if( style == 0xffff ){ /* Are all bits set? */
|
||||
flag = FALSE; /* begin removing bits */
|
Loading…
Reference in New Issue
Block a user