[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#308783: RdFToI.c



Thomas -

I just read your patch to RdFToI.c titled
October 2004, source code review by Thomas Biege <thomas@suse.de>
where you replaced calls to popen with the new routine xpmPipeThrough().
That is a big improvement, and debian needs to incorporate that
improvement in the upcoming sarge release.  (see
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=308783
)

I noticed you changed the semantics of compressed file detection.
The old code looked like
	if ((len > 2) && !strcmp(".Z", filename + (len - 2))) {
	    ...
	} else if ((len > 3) && !strcmp(".gz", filename + (len - 3))) {
	    ...
	}
so the filename passed in to OpenReadFile() is expected to have
the .Z or .gz already added to it.

The new code looks something like
	int fd = open(filename, O_RDONLY);
	const char* ext = NULL;
	if ( fd >= 0 ) {
		ext = strrchr(filename, '.');
	} else {
		char *compressfile = (char *) XpmMalloc(strlen(filename) + 4);
		strcpy(compressfile, filename);
		strcpy(compressfile + len, ext = ".Z")
		fd = open(compressfile, O_RDONLY);
		if ( fd < 0 ) {
			strcpy(compressfile + len, ext = ".gz");
			fd = open(compressfile, O_RDONLY);
			   ...
		}
	}
so the filename passed in to OpenReadFile() is _not_ expected to
have the .Z or .gz already added to it, the code will add the
suffix to the bare .xpm name.

Is this important?  Do you know what code depends on which kind
of behavior?  This change is not particularly relevant to the actual
bug fix, and my first impression is that it should not go in to
sarge.

      - Larry

Attachment: signature.asc
Description: Digital signature


Reply to: