Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Tom Callaway
acd820d20e fix memory leak, enable support for sub-second delay 2013-01-02 13:32:44 -05:00
Tom Callaway
c9b29c84cf fix libtiff BR to be conditional 2012-11-27 17:04:30 -05:00
Tom Callaway
b35db697f7 fix PNG support 2012-11-27 16:34:38 -05:00
5 changed files with 433 additions and 311 deletions

View file

@ -0,0 +1,12 @@
diff -up xloadimage.4.1/new.c.fix-mem-leak xloadimage.4.1/new.c
--- xloadimage.4.1/new.c.fix-mem-leak 2013-01-02 13:21:24.082069878 -0500
+++ xloadimage.4.1/new.c 2013-01-02 13:22:04.427104519 -0500
@@ -181,7 +181,7 @@ Image *newTrueImage(width, height)
image->depth= 24;
image->pixlen= 3;
image->data= (unsigned char *)lmalloc(ovmul(ovmul(width, height), 3));
- image->data= (unsigned char *)lmalloc(width * height * 3);
+ /* image->data= (unsigned char *)lmalloc(width * height * 3); */
return(image);
}

View file

@ -0,0 +1,39 @@
diff -up xloadimage.4.1/png.c.png15 xloadimage.4.1/png.c
--- xloadimage.4.1/png.c.png15 2012-11-27 16:24:36.512125771 -0500
+++ xloadimage.4.1/png.c 2012-11-27 16:28:15.216129052 -0500
@@ -75,7 +75,7 @@ static void output_error(png_structp png
{
debug(" #error ");
output_warn( png_ptr, str);
- longjmp(png_ptr->jmpbuf, 1); /* return control to outer routine */
+ longjmp(png_jmpbuf(png_ptr), 1); /* return control to outer routine */
}
@@ -164,7 +164,7 @@ static int pngHeader(png_structpp png_pp
png_destroy_read_struct(png_pp, info_pp, end_pp);
return 0;
}
- if (setjmp((*png_pp)->jmpbuf)) {
+ if (setjmp(png_jmpbuf(*png_pp))) {
/* On error */
png_destroy_read_struct(png_pp, info_pp, end_pp);
return 0;
@@ -220,7 +220,7 @@ int pngIdent(char *fullname, char *name)
zclose(zinput_file);
return 0;
}
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
/* On error */
freeImage(image);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
@@ -308,7 +308,7 @@ Image *pngLoad(char *fullname, char *nam
case PNG_COLOR_TYPE_GRAY_ALPHA:
case PNG_COLOR_TYPE_GRAY:
if (bit_depth < 8)
- png_set_gray_1_2_4_to_8(png_ptr); /* 1 pixlel 1 byte */
+ png_set_expand_gray_1_2_4_to_8(png_ptr); /* 1 pixlel 1 byte */
image = newRGBImage(width, height, 8);
image->rgb.used = 256;
for (i = 0; i < 256; i++) {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,51 @@
diff -up xloadimage.4.1/options.c.sub-second-delay xloadimage.4.1/options.c
--- xloadimage.4.1/options.c.sub-second-delay 2013-01-02 13:23:23.726173587 -0500
+++ xloadimage.4.1/options.c 2013-01-02 13:23:37.706185351 -0500
@@ -720,7 +720,7 @@ void processOptions(argc, argv, rglobal,
continue;
#else /* !NO_DELAY */
- newopt->info.delay= getInteger(DELAY, argv[a]);
+ newopt->info.delay= getFloat(DELAY, argv[a]);
break;
#endif /* !NO_DELAY */
diff -up xloadimage.4.1/options.h.sub-second-delay xloadimage.4.1/options.h
--- xloadimage.4.1/options.h.sub-second-delay 2013-01-02 13:25:44.297294626 -0500
+++ xloadimage.4.1/options.h 2013-01-02 13:26:25.338329430 -0500
@@ -49,7 +49,7 @@ typedef struct option {
unsigned int x, y, w, h; /* area of image to be used */
} clip;
unsigned int colors; /* max # of colors to use for this image */
- unsigned int delay; /* # of seconds delay before auto pic advance */
+ double delay; /* # of seconds delay before auto pic advance */
char *display; /* display name */
struct {
char *type; /* image type */
diff -up xloadimage.4.1/window.c.sub-second-delay xloadimage.4.1/window.c
--- xloadimage.4.1/window.c.sub-second-delay 2013-01-02 13:24:13.903216792 -0500
+++ xloadimage.4.1/window.c 2013-01-02 13:25:35.928287337 -0500
@@ -583,9 +583,9 @@ char imageInWindow(disp, scrn, image, gl
install= (getOption(global_options, INSTALL) != NULL);
private_cmap= (getOption(global_options, PRIVATE) != NULL);
if ((opt= getOption(image_options, DELAY)))
- delay= opt->info.delay;
+ delay= opt->info.delay*1000000;
else if ((opt= getOption(global_options, DELAY)))
- delay= opt->info.delay;
+ delay= opt->info.delay*1000000;
else
delay= 0;
if ((opt= getOption(image_options, VISUAL)))
@@ -872,7 +872,10 @@ char imageInWindow(disp, scrn, image, gl
#ifdef ENABLE_TIMEOUT
AlarmWentOff = 0;
signal(SIGALRM, delayAlarmHandler);
- alarm(delay);
+ if (delay > 999999)
+ alarm(delay/1000000);
+ else
+ ualarm(delay,0);
#endif /* ENABLE_TIMEOUT */
}

View file

@ -1,7 +1,7 @@
Name: xloadimage
Summary: Image viewer and processor
Version: 4.1
Release: 11%{?dist}
Release: 13%{?dist}
License: MIT
Group: User Interface/X
Source0: ftp://ftp.x.org/R5contrib/%{name}.%{version}.tar.gz
@ -30,8 +30,16 @@ Patch19: xloadimage-4.1-ignore-dummy-copyright-variables.patch
Patch20: xloadimage-4.1-bracketfix.patch
Patch21: xloadimage-4.1-png-pkg-config.patch
Patch22: xloadimage-4.1-libtiff4.patch
Patch23: xloadimage-4.1-png-1.5.patch
Patch24: xloadimage-4.1-fix-mem-leak.patch
Patch25: xloadimage-4.1-sub-second-delay.patch
URL: http://www.frostbytes.com/~jimf/xloadimage.html
BuildRequires: libX11-devel, libtiff-devel >= 4.0, libpng-devel, libjpeg-devel
%if 0%{?fedora} >= 18
BuildRequires: libtiff-devel >= 4.0
%else
BuildRequires: libtiff-devel
%endif
BuildRequires: libX11-devel, libpng-devel, libjpeg-devel
BuildRequires: libICE-devel
%description
@ -71,7 +79,13 @@ dithered automatically).
%patch19 -p1
%patch20 -p1
%patch21 -p1 -b .png-pkg-config
%if 0%{?fedora} >= 18
%patch22 -p1 -b .tiff4
%endif
%patch23 -p1 -b .png15
%patch24 -p1 -b .fix-mem-leak
%patch25 -p1 -b .sub-second-delay
chmod +x configure
%build
@ -110,11 +124,19 @@ cp -a %{buildroot}%{_mandir}/man1/xloadimage.1x %{buildroot}%{_mandir}/man1/xvie
%{_mandir}/man1/*
%changelog
* Wed Jan 2 2013 Tom Callaway <spot@fedoraproject.org> - 4.1-13
- fix memory leak caused by opening a lot of files at once then cycling through them with "N"
- enable support for sub-second-delay values
- thanks to Roger Heflin for both patches
* Tue Nov 27 2012 Tom Callaway <spot@fedoraproject.org> - 4.1-12
- fix png 1.5 support
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon May 7 2012 Tom Callaway <spot@fedoraproject.org> - 4.1-10
- build against libtiff 4
- build against libtiff 4 (on Fedora 18+)
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild