Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 58371 | Differences between
and this patch

Collapse All | Expand All

(-)xscavenger-1.4.4.orig/src/Imakefile (-6 / +25 lines)
Lines 1-20 Link Here
1
# set this to the path where data files should be stored.  LIBDIR
1
# set this to the path where data files should be stored.  LIBDIR
2
# is automatically defined by imake, usually to /usr/X11R6/lib/X11, so
2
# is automatically defined by imake, usually to /usr/X11R6/lib/X11, so
3
# this should be a good default.
3
# this should be a good default.
4
LIBNAME = $(LIBDIR)/scavenger
4
5
LIBNAME = /usr/share/games/xscavenger
5
6
6
SRCS = anim.c edit.c scav.c x.c sound.c
7
SRCS = anim.c edit.c scav.c x.c sound.c
7
OBJS = $(SRCS:.c=.o)
8
OBJS = $(SRCS:.c=.o)
8
9
10
# the "subst" hack below is because imake uses the C preprocessor, which
11
# will interpret an unquoted "/*" as a comment beginning.
12
#LIB_DATA = $(subst S,/,..SdataS*)
9
LIB_DATA = \
13
LIB_DATA = \
10
	../data/badguy.lbm   ../data/brownblue.lbm ../data/death.raw \
14
	../data/badguy.lbm	\
11
	../data/dig.raw      ../data/fall.raw      ../data/levels.scl \
15
	../data/brownblue.lbm	\
12
        ../data/microman.lbm ../data/pop.raw       ../data/redbrick.lbm \
16
	../data/death.raw	\
13
	../data/reddevil.lbm ../data/regularguy.lbm ../data/spiralthing.lbm \
17
	../data/dig.raw		\
18
	../data/fall.raw	\
19
	../data/flashspiral.lbm	\
20
	../data/gems.lbm	\
21
	../data/jungle.lbm	\
22
	../data/levels.scl	\
23
	../data/microman.lbm	\
24
	../data/pop.raw		\
25
	../data/redbrick.lbm	\
26
	../data/reddevil.lbm	\
27
	../data/regularguy.lbm	\
28
	../data/spiralthing.lbm	\
14
	../data/victory.raw
29
	../data/victory.raw
15
30
31
16
LOCAL_LIBRARIES = $(XLIB)
32
LOCAL_LIBRARIES = $(XLIB)
17
EXTRA_DEFINES = -DLIBNAME=\"$(LIBNAME)\"
33
EXTRA_DEFINES = -DLIBNAME=\"$(LIBNAME)\"
18
34
19
ComplexProgramTarget(scavenger)
35
AllTarget(xscavenger)
36
NormalProgramTarget(xscavenger,$(OBJS),,,$(XLIB))
37
InstallProgram(xscavenger,/usr/games/bin)
38
20
InstallMultipleFlags($(LIB_DATA),$(LIBNAME),-m 644)
39
InstallMultipleFlags($(LIB_DATA),$(LIBNAME),-m 644)
(-)xscavenger-1.4.4.orig/src/names.h (-2 / +2 lines)
Lines 5-15 Link Here
5
5
6
/* next should already be defined with makefile */
6
/* next should already be defined with makefile */
7
#ifndef LIBNAME
7
#ifndef LIBNAME
8
#define LIBNAME "/usr/X11R6/lib/scavenger"
8
#define LIBNAME "/usr/share/games/scavenger"
9
#endif
9
#endif
10
10
11
#ifndef ICONPATH
11
#ifndef ICONPATH
12
#define ICONPATH "/usr/X11R6/include/X11/pixmaps/xscavenger-icon.xpm"
12
#define ICONPATH "/usr/share/games/pixmaps/xscavenger-icon.xpm"
13
#endif
13
#endif
14
14
15
#define LOCALDIRNAME ".scavenger"
15
#define LOCALDIRNAME ".scavenger"
(-)xscavenger-1.4.4.orig/src/scav.c (-25 / +31 lines)
Lines 239-254 Link Here
239
239
240
240
241
241
242
242
/* 14 Dec 2002: re-wrote to be more portable - don't assume two's-complement
243
 * representation for integers, and fix bug when sizeof(long) > 4.
244
 */
243
long readlong()
245
long readlong()
244
{
246
{
245
long val1=0;
247
	long val1=0;
246
248
	int i,j;
247
	val1=myci()<<24L;
248
	val1|=myci()<<16L;
249
	val1|=myci()<<8;
250
	val1|=myci();
251
249
250
	for (i=0; i<4; i++) {
251
		j = myci();
252
		if (j==-1) return -1L;
253
		val1 = (val1<<8) + j;
254
	}
252
	return val1;
255
	return val1;
253
}
256
}
254
int rbs()
257
int rbs()
Lines 309-315 Link Here
309
	bmw=bmh=byteswide=0;
312
	bmw=bmh=byteswide=0;
310
	while( (type=readlong()) )
313
	while( (type=readlong()) )
311
	{
314
	{
312
		if(type==0xffffffffL) break;
315
		if(type==-1L) break;
313
		size=readlong();
316
		size=readlong();
314
		if(size&1) size++;
317
		if(size&1) size++;
315
		if(type==BMHD)
318
		if(type==BMHD)
Lines 402-417 Link Here
402
	input=open(resourcename,O_RDONLY);
405
	input=open(resourcename,O_RDONLY);
403
	if(input<0) return -1;
406
	if(input<0) return -1;
404
	got=read(input,buff,8);
407
	got=read(input,buff,8);
405
	if(got!=8) return -2;
408
	if(got!=8) {close(input);return -2;}
406
	if (strncmp(buff,"SCAV",4)) return -3;
409
	if (strncmp(buff,"SCAV",4)) {close(input);return -3;}
407
	max=(buff[4]<<24) | (buff[5]<<16) | (buff[6]<<8) | buff[7];
410
	max=(buff[4]<<24) | (buff[5]<<16) | (buff[6]<<8) | buff[7];
408
	if(num>=max) return 0;
411
	if(num>=max) {close(input);return 0;}
409
	lseek(input,(num+1)<<3,SEEK_SET);
412
	lseek(input,(num+1)<<3,SEEK_SET);
410
	got=read(input,buff,8);
413
	got=read(input,buff,8);
411
	offset=(buff[0]<<24) | (buff[1]<<16) | (buff[2]<<8) | buff[3];
414
	offset=(buff[0]<<24) | (buff[1]<<16) | (buff[2]<<8) | buff[3];
412
	length=(buff[4]<<24) | (buff[5]<<16) | (buff[6]<<8) | buff[7];
415
	length=(buff[4]<<24) | (buff[5]<<16) | (buff[6]<<8) | buff[7];
413
	if(len>length) len=length;
416
	if(len>length) len=length;
414
	if(!offset || !len) return 0;
417
	if(!offset || !len) {close(input);return 0;}
415
	lseek(input,offset,SEEK_SET);
418
	lseek(input,offset,SEEK_SET);
416
	got=read(input,put,len);
419
	got=read(input,put,len);
417
	close(input);
420
	close(input);
Lines 448-455 Link Here
448
	input=open(resourcename,O_RDONLY);
451
	input=open(resourcename,O_RDONLY);
449
	if(input==-1) return -4;
452
	if(input==-1) return -4;
450
	got=read(input,buff,8);
453
	got=read(input,buff,8);
451
	if(got!=8) return -2;
454
	if(got!=8) {close(input);return -2;}
452
	if(strncmp(buff,"SCAV",4)) return -3;
455
	if(strncmp(buff,"SCAV",4)) {close(input);return -3;}
453
	output=creat(bakname,00600);
456
	output=creat(bakname,00600);
454
	if(output==-1) {close(input);return -6;}
457
	if(output==-1) {close(input);return -6;}
455
458
Lines 473-484 Link Here
473
		for(i=0;i<max;i++)
476
		for(i=0;i<max;i++)
474
			if(headers[i+i])
477
			if(headers[i+i])
475
				headers[i+i]+=delta;
478
				headers[i+i]+=delta;
476
	if (write(output,"SCAV",4) != 4) return -200;
479
	if (write(output,"SCAV",4) != 4) {close(input);close(output);return -200;}
477
	if (!rlout(output,max))	return -200;
480
	if (!rlout(output,max))	{close(input);close(output);return -200;}
478
	headers[num+num]=0;
481
	headers[num+num]=0;
479
	headers[num+num+1]=len;
482
	headers[num+num+1]=len;
480
	for(i=0;i<max+max;i++)
483
	for(i=0;i<max+max;i++)
481
		if (!rlout(output,headers[i])) return -200;
484
	    if (!rlout(output,headers[i])) {close(input);close(output);return -200;}
482
485
483
	if(offset)
486
	if(offset)
484
	{
487
	{
Lines 487-494 Link Here
487
		while(count)
490
		while(count)
488
		{
491
		{
489
			got=count>1024 ? 1024 : count;
492
			got=count>1024 ? 1024 : count;
490
			if (read(input,copybuff,got) != got) return -200;
493
			if (read(input,copybuff,got) != got) {close(input);close(output);return -200;}
491
			if (write(output,copybuff,got) != got) return -200;
494
			if (write(output,copybuff,got) != got) {close(input);close(output);return -200;}
492
			count-=got;
495
			count-=got;
493
		}
496
		}
494
		lseek(input,length,SEEK_CUR);
497
		lseek(input,length,SEEK_CUR);
Lines 498-514 Link Here
498
	{
501
	{
499
		got=read(input, copybuff, 1024);
502
		got=read(input, copybuff, 1024);
500
		if (!got) break;
503
		if (!got) break;
501
		if (write (output, copybuff, got) != got) return -200;
504
		if (write (output, copybuff, got) != got) {close(input);close(output);return -200;}
502
		offset += got;
505
		offset += got;
503
	}
506
	}
504
	if(len)
507
	if(len)
505
	{
508
	{
506
		if (write (output, take, len) != len) return -200;
509
	    if (write (output, take, len) != len) {close(input);close(output);return -200;}
507
		lseek (output, (num+1) << 3, SEEK_SET);
510
		lseek (output, (num+1) << 3, SEEK_SET);
508
		if (!rlout (output, offset)) return -200;
511
		if (!rlout (output, offset)) {close(input);close(output);return -200;}
509
	}
512
	}
510
	close (input);
513
	close (input);
511
	if (fsync(output)) return -200;
514
	if (fsync(output)) {close(output);return -200;}
512
	if (close(output)) return -200;
515
	if (close(output)) return -200;
513
	err=rename(bakname,resourcename);
516
	err=rename(bakname,resourcename);
514
	if(err) return -1;
517
	if(err) return -1;
Lines 1382-1387 Link Here
1382
			break;
1385
			break;
1383
		}
1386
		}
1384
	}
1387
	}
1388
	close(file);
1385
}
1389
}
1386
1390
1387
void remslash(char *str)
1391
void remslash(char *str)
Lines 1416-1421 Link Here
1416
			return -3;
1420
			return -3;
1417
		}
1421
		}
1418
	} while(len);
1422
	} while(len);
1423
	close(input);
1424
	close(output);
1419
	return 0;
1425
	return 0;
1420
}
1426
}
1421
1427
Lines 1448-1454 Link Here
1448
			printf("Failed to create directory %s, exiting\n",temp);
1454
			printf("Failed to create directory %s, exiting\n",temp);
1449
			exit(1);
1455
			exit(1);
1450
		}
1456
		}
1451
	}
1457
	} else close(file);
1452
1458
1453
	sprintf(resourcename,"%s/%s/%s",localname,localdirname,LEVELSNAME);
1459
	sprintf(resourcename,"%s/%s/%s",localname,localdirname,LEVELSNAME);
1454
	file=open(resourcename,O_RDONLY);
1460
	file=open(resourcename,O_RDONLY);
Lines 1485-1491 Link Here
1485
			printf("Couldn't create %s\n",temp);
1491
			printf("Couldn't create %s\n",temp);
1486
			exit(1);
1492
			exit(1);
1487
		}
1493
		}
1488
	}
1494
	} else close(file);
1489
}
1495
}
1490
1496
1491
void makercname(char *str)
1497
void makercname(char *str)

Return to bug 58371