diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2011-10-01 10:38:54 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2011-10-01 10:38:54 +0000 |
commit | d37e60bf0ba266368bea34b6b080d17d52d3d32c (patch) | |
tree | 2f90a9af87f1001d47190767a7b270a2bf9e985f /src/torrent.c | |
parent | 607b8ae3d15b2b60dfb33777d6d6c0fd817ed05e (diff) |
fix a warning caused by divide by zero on empty files
Diffstat (limited to 'src/torrent.c')
-rw-r--r-- | src/torrent.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/torrent.c b/src/torrent.c index 8717998..947d890 100644 --- a/src/torrent.c +++ b/src/torrent.c @@ -456,7 +456,14 @@ const gchar *tracker_stats_get_host(JsonObject *t) return json_object_get_string_member(t, FIELD_HOST); } -gchar *torrent_get_full_path(JsonObject * obj) { +gchar *torrent_get_full_path(JsonObject *obj) +{ + const gchar *location = json_object_get_string_member(obj, FIELD_DOWNLOAD_DIR); + const gchar *name = json_object_get_string_member(obj, FIELD_NAME); + return g_strdup_printf("%s/%s", location, name); +} + +gchar *torrent_get_full_dir(JsonObject * obj) { gchar *containing_path, *name, *delim; const gchar *location; JsonArray *files = torrent_get_files(obj); |