Commit 607374d4 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Merge --dcraw-timeout and --magick-timeout into --conversion-timeout

parent 3b524947
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -574,7 +574,7 @@ gib_list *feh_read_filelist(char *filename)
	Imlib_Load_Error err = IMLIB_LOAD_ERROR_NONE;
	Imlib_Image tmp_im;
	struct stat st;
	signed short tmp_magick_timeout;
	signed short tmp_conversion_timeout;

	if (!filename)
		return(NULL);
@@ -582,8 +582,8 @@ gib_list *feh_read_filelist(char *filename)
	/*
	 * feh_load_image will fail horribly if filename is not seekable
	 */
	tmp_magick_timeout = opt.magick_timeout;
	opt.magick_timeout = -1;
	tmp_conversion_timeout = opt.conversion_timeout;
	opt.conversion_timeout = -1;
	if (!stat(filename, &st) && S_ISREG(st.st_mode)) {
		tmp_im = imlib_load_image_with_error_return(filename, &err);
		if (err == IMLIB_LOAD_ERROR_NONE) {
@@ -594,7 +594,7 @@ gib_list *feh_read_filelist(char *filename)
			return NULL;
		}
	}
	opt.magick_timeout = tmp_magick_timeout;
	opt.conversion_timeout = tmp_conversion_timeout;

	errno = 0;

+5 −5
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file)
		if ((tmpname = feh_http_load_image(file->filename)) == NULL)
			err = IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST;
	}
	else if (opt.dcraw_timeout >= 0 && feh_file_is_raw(file->filename)) {
	else if (opt.conversion_timeout >= 0 && feh_file_is_raw(file->filename)) {
		image_source = SRC_DCRAW;
		tmpname = feh_dcraw_load_image(file->filename);
		if (!tmpname)
@@ -239,7 +239,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file)
	else
		*im = imlib_load_image_with_error_return(file->filename, &err);

	if (opt.magick_timeout >= 0 && (
	if (opt.conversion_timeout >= 0 && (
			(err == IMLIB_LOAD_ERROR_UNKNOWN) ||
			(err == IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT))) {
		image_source = SRC_MAGICK;
@@ -377,7 +377,7 @@ static char *feh_dcraw_load_image(char *filename)
		dup(fd);
		close(fd);

		alarm(opt.dcraw_timeout);
		alarm(opt.conversion_timeout);
		execlp("dcraw", "dcraw", "-c", "-e", filename, NULL);
		_exit(1);
	}
@@ -481,10 +481,10 @@ static char *feh_magick_load_image(char *filename)
		_exit(1);
	}
	else {
		alarm(opt.magick_timeout);
		alarm(opt.conversion_timeout);
		waitpid(childpid, &status, 0);
		kill(childpid, SIGKILL);
		if (opt.magick_timeout > 0 && !alarm(0)) {
		if (opt.conversion_timeout > 0 && !alarm(0)) {
			unlink(sfn);
			free(sfn);
			sfn = NULL;
+5 −5
Original line number Diff line number Diff line
@@ -55,8 +55,7 @@ void init_parse_options(int argc, char **argv)
	opt.display = 1;
	opt.aspect = 1;
	opt.slideshow_delay = 0.0;
	opt.dcraw_timeout = -1;
	opt.magick_timeout = -1;
	opt.conversion_timeout = -1;
	opt.thumb_w = 60;
	opt.thumb_h = 60;
	opt.thumb_redraw = 10;
@@ -416,7 +415,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
		{"insecure"      , 0, 0, 240},
		{"no-recursive"  , 0, 0, 241},
		{"cache-size"    , 1, 0, 243},
		{"dcraw-timeout" , 1, 0, 245},
		{"conversion-timeout" , 1, 0, 245},
		{"version-sort"  , 0, 0, 246},
		{"offset"        , 1, 0, 247},
		{0, 0, 0, 0}
@@ -695,7 +694,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
			opt.index_info = estrdup(optarg);
			break;
		case 208:
			opt.magick_timeout = atoi(optarg);
			weprintf("--magick-timeout is deprecated, please use --conversion-timeout instead");
			opt.conversion_timeout = atoi(optarg);
			break;
		case 209:
			opt.actions[1] = estrdup(optarg);
@@ -786,7 +786,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
				opt.cache_size = 2048;
			break;
		case 245:
			opt.dcraw_timeout = atoi(optarg);
			opt.conversion_timeout = atoi(optarg);
			break;
		case 246:
			opt.version_sort = 1;
+1 −2
Original line number Diff line number Diff line
@@ -133,8 +133,7 @@ struct __fehoptions {

	double slideshow_delay;

	signed short dcraw_timeout;
	signed short magick_timeout;
	signed int conversion_timeout;

	Imlib_Font menu_fn;
};