Fix comparison broken by signedness
Warning generated on MacOS, reported in issue #350.
This commit is contained in:
		
							
								
								
									
										33
									
								
								thumbs.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								thumbs.c
									
									
									
									
									
								
							@@ -79,7 +79,7 @@ void tns_cache_write(Imlib_Image im, const char *filepath, bool force)
 | 
				
			|||||||
	char *cfile, *dirend;
 | 
						char *cfile, *dirend;
 | 
				
			||||||
	struct stat cstats, fstats;
 | 
						struct stat cstats, fstats;
 | 
				
			||||||
	struct utimbuf times;
 | 
						struct utimbuf times;
 | 
				
			||||||
	Imlib_Load_Error err = 0;
 | 
						Imlib_Load_Error err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (options->private_mode)
 | 
						if (options->private_mode)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
@@ -93,26 +93,27 @@ void tns_cache_write(Imlib_Image im, const char *filepath, bool force)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			if ((dirend = strrchr(cfile, '/')) != NULL) {
 | 
								if ((dirend = strrchr(cfile, '/')) != NULL) {
 | 
				
			||||||
				*dirend = '\0';
 | 
									*dirend = '\0';
 | 
				
			||||||
				if ((err = r_mkdir(cfile)) == -1)
 | 
									if (r_mkdir(cfile) == -1) {
 | 
				
			||||||
					error(0, errno, "%s", cfile);
 | 
										error(0, errno, "%s", cfile);
 | 
				
			||||||
 | 
										goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				*dirend = '/';
 | 
									*dirend = '/';
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (err == 0) {
 | 
								imlib_context_set_image(im);
 | 
				
			||||||
				imlib_context_set_image(im);
 | 
								if (imlib_image_has_alpha()) {
 | 
				
			||||||
				if (imlib_image_has_alpha()) {
 | 
									imlib_image_set_format("png");
 | 
				
			||||||
					imlib_image_set_format("png");
 | 
								} else {
 | 
				
			||||||
				} else {
 | 
									imlib_image_set_format("jpg");
 | 
				
			||||||
					imlib_image_set_format("jpg");
 | 
									imlib_image_attach_data_value("quality", NULL, 90, NULL);
 | 
				
			||||||
					imlib_image_attach_data_value("quality", NULL, 90, NULL);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				imlib_save_image_with_error_return(cfile, &err);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (err == 0) {
 | 
					 | 
				
			||||||
				times.actime = fstats.st_atime;
 | 
					 | 
				
			||||||
				times.modtime = fstats.st_mtime;
 | 
					 | 
				
			||||||
				utime(cfile, ×);
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								imlib_save_image_with_error_return(cfile, &err);
 | 
				
			||||||
 | 
								if (err)
 | 
				
			||||||
 | 
									goto end;
 | 
				
			||||||
 | 
								times.actime = fstats.st_atime;
 | 
				
			||||||
 | 
								times.modtime = fstats.st_mtime;
 | 
				
			||||||
 | 
								utime(cfile, ×);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					end:
 | 
				
			||||||
		free(cfile);
 | 
							free(cfile);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user