Commit 5a2e42e0 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Correctly round human-readable file size

Closes #463
parent 18dd1c5e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ void feh_event_handle_stdin();
void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button);
fehkey *feh_str_to_kb(char * action);
void feh_action_run(feh_file * file, char *action, winwidget winwid);
char *format_size(int size);
char *format_size(double size);
char *feh_printf(char *str, feh_file * file, winwidget winwid);
void im_weprintf(winwidget w, char *fmt, ...);
void feh_draw_zoom(winwidget w);
+2 −2
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ void feh_action_run(feh_file * file, char *action, winwidget winwid)
	return;
}

char *format_size(int size)
char *format_size(double size)
{
	static char ret[5];
	char units[] = {' ', 'k', 'M', 'G', 'T'};
@@ -454,7 +454,7 @@ char *format_size(int size)
		size /= 1000;
		postfix++;
	}
	snprintf(ret, 5, "%3d%c", size, units[postfix]);
	snprintf(ret, 5, "%3.0f%c", size, units[postfix]);
	return ret;
}