From ff35d9bec945208ce480277d0f0b4602995838ca Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 15 May 2018 16:44:39 +1000 Subject: [PATCH] fix for www hashes on rpi --- src/www_files.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/www_files.c b/src/www_files.c index 59fd0b4..3fbee22 100644 --- a/src/www_files.c +++ b/src/www_files.c @@ -7,6 +7,7 @@ #include "bbs.h" #include "../deps/hashids/hashids.h" + extern struct bbs_config conf; extern struct user_record *gUser; extern char * aha(char *input); @@ -192,7 +193,7 @@ void www_add_hash_to_db(char *hash, time_t expiry) { } char *www_decode_hash(char *hash) { - long long unsigned numbers[4]; + unsigned long long numbers[4]; int dir, sub, fid, uid; hashids_t *hashids = hashids_init(conf.bbs_name); char buffer[PATH_MAX]; @@ -218,7 +219,7 @@ char *www_decode_hash(char *hash) { fid = (int)numbers[3]; if (dir >= conf.file_directory_count || sub >= conf.file_directories[dir]->file_sub_count) { - return NULL; + return NULL; } // get filename from database @@ -255,13 +256,13 @@ char *www_create_link(int dir, int sub, int fid) { hashids_t *hashids = hashids_init(conf.bbs_name); - sizereq = hashids_estimate_encoded_size_v(hashids, 4, gUser->id, dir, sub, fid); + sizereq = hashids_estimate_encoded_size_v(hashids, 4, (unsigned long long)gUser->id, (unsigned long long)dir, (unsigned long long)sub, (unsigned long long)fid); hashid = (char *)malloc(sizereq + 1); memset(hashid, 0, sizereq + 1); - if (hashids_encode_v(hashids, hashid, 4, gUser->id, dir, sub, fid) == 0) { + if (hashids_encode_v(hashids, hashid, 4, (unsigned long long)gUser->id, (unsigned long long)dir, (unsigned long long)sub, (unsigned long long)fid) == 0) { hashids_free(hashids); free(hashid); return NULL;