SHA256
1
0
forked from pool/libXbgi
Jan Engelhardt 2014-01-23 13:48:24 +00:00 committed by Git OBS Bridge
parent e729fe626a
commit 04bfc1a15a
8 changed files with 242 additions and 33 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
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

View File

@ -18,7 +18,7 @@
Name: libXbgi
%define lname libXbgi1
Version: 363
Version: 364
Release: 0
Summary: BGI-compatible 2D graphics C library
License: MIT
@ -29,6 +29,8 @@ Url: http://libXbgi.sf.net/
Source: http://libxbgi.sf.net/xbgi-%version.tar.gz
Patch1: xbgi-automake.diff
Patch2: xbgi-getpixel.diff
Patch3: xbgi-sequence.diff
Patch4: xbgi-grapherrormsg.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
@ -71,8 +73,8 @@ This package contains the development headers for the library found
in %lname.
%prep
%setup -qn xbgi
%patch -P 1 -P 2 -p1
%setup -qn xbgi-%version
%patch -P 1 -P 2 -P 3 -P 4 -p1
%build
autoreconf -fiv

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:325aa8babbad064c19701f32bb59ef96b9ab9120182c1d1e0805c13e0268825e
size 65994

3
xbgi-364.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:295fa30ca55bf95e71f580836e7471d3f6d758d570cfc8349c09204424022d3a
size 67627

View File

@ -3,27 +3,31 @@ Date: 2013-04-30 16:20:06.862768841 +0200
build: use automake as build system
---
Makefile.am | 4 ++++
Using.txt | 2 +-
configure.ac | 9 +++++++++
m4/.gitignore | 2 ++
src/Makefile.am | 43 +++++++++++++++++++++++++++++++++++++++++++
5 files changed, 59 insertions(+), 1 deletion(-)
Less Makefile code, pkgconfig is used, libXbgi can be built as a
shared library.
Index: xbgi/Makefile.am
---
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/Makefile.am
+++ xbgi-364/Makefile.am
@@ -0,0 +1,4 @@
+# -*- Makefile -*-
+
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = src
Index: xbgi/Using.txt
Index: xbgi-364/Using.txt
===================================================================
--- xbgi.orig/Using.txt
+++ xbgi/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:
@ -33,34 +37,35 @@ Index: xbgi/Using.txt
Most old programs that use the original BGI library should compile
with no modification. For instance,
Index: xbgi/configure.ac
Index: xbgi-364/configure.ac
===================================================================
--- /dev/null
+++ xbgi/configure.ac
+++ xbgi-364/configure.ac
@@ -0,0 +1,9 @@
+AC_INIT([xbgi], [362])
+AC_INIT([xbgi], [364])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AC_PROG_CC
+AM_INIT_AUTOMAKE([foreign subdir-objects tar-pax])
+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])
+AC_CONFIG_FILES([Makefile src/Makefile src/test/Makefile])
+AC_OUTPUT
Index: xbgi/m4/.gitignore
Index: xbgi-364/m4/.gitignore
===================================================================
--- /dev/null
+++ xbgi/m4/.gitignore
+++ xbgi-364/m4/.gitignore
@@ -0,0 +1,2 @@
+/libtool.m4
+/lt*.m4
Index: xbgi/src/Makefile.am
Index: xbgi-364/src/Makefile.am
===================================================================
--- /dev/null
+++ xbgi/src/Makefile.am
@@ -0,0 +1,43 @@
+++ xbgi-364/src/Makefile.am
@@ -0,0 +1,44 @@
+# -*- Makefile -*-
+
+SUBDIRS = . test
+AM_CPPFLAGS = ${x11_CFLAGS}
+AM_CFLAGS = -Wall
+
@ -90,7 +95,7 @@ Index: xbgi/src/Makefile.am
+ 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
+ getevent.c converttorgb.c refresh.c
+libXbgi_la_LDFLAGS = -Wl,-z,defs -version-info 1:0:0
+libXbgi_la_LIBADD = -lm ${x11_LIBS}
+
@ -102,3 +107,19 @@ Index: xbgi/src/Makefile.am
+
+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

View File

@ -16,11 +16,11 @@ Any value would be ok, but consistently give 0 to quiesce gcc.
src/getpixel.c | 1 +
1 file changed, 1 insertion(+)
Index: xbgi/src/getpixel.c
Index: xbgi-364/src/getpixel.c
===================================================================
--- xbgi.orig/src/getpixel.c
+++ xbgi/src/getpixel.c
@@ -26,6 +26,7 @@ unsigned int getpixel(int x, int y)
--- 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);

131
xbgi-grapherrormsg.diff Normal file
View 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
View 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 */