diff --git a/src/database/update.c b/src/database/update.c index 94e44c46cc87153d88d6c178632d82bea28e93ba..6583f5963cbe75e8e174329b0fc7ce22888c1343 100644 --- a/src/database/update.c +++ b/src/database/update.c @@ -13,7 +13,7 @@ database_internal_get_timestamp(lkt_db *db, sqlite3_stmt *stmt, uint64_t *timest SQLITE_STEP_ROW(db, stmt, error); int64_t signed_timestamp = sqlite3_column_int64(stmt, 0); GOTO_IF(signed_timestamp < 0, "Got a negative time stamp from DB, this is an error", error); - *timestamp = (uint64_t)timestamp; + *timestamp = (uint64_t)signed_timestamp; ret = true; error: sqlite3_finalize(stmt); @@ -51,7 +51,7 @@ database_set_kara_repo_timestamp_id(lkt_db *db, int id, uint64_t timestamp) { static const char *SQL_TEMPLATE = "UPDATE kara SET repo_timestamp = %d WHERE id = %zu;"; char SQL[LKT_MAX_SQLITE_STATEMENT]; - safe_snprintf(SQL, LKT_MAX_SQLITE_STATEMENT, SQL_TEMPLATE, id, timestamp); + safe_snprintf(SQL, LKT_MAX_SQLITE_STATEMENT, SQL_TEMPLATE, timestamp, id); SQLITE_EXEC(db, SQL, error); return true; error: diff --git a/src/module/module_repo.c b/src/module/module_repo.c index c62f5ea4abb2197987d949d60dec18016e3e6e0a..3e7321a0a181163f144079651687805002c4c33d 100644 --- a/src/module/module_repo.c +++ b/src/module/module_repo.c @@ -535,8 +535,8 @@ ___handle_got_json_internal_callback(const char *key, const char *val, int comp, database_get_kara_repo_timestamp_path(kara->db, kara->filename, &filestamp); database_is_kara_mkv(kara->db, kara->filename, &magic_valid); - if (filestamp == 0 || kara->unix_timestamp != (long)(uint64_t)kara->unix_timestamp || - filestamp <= (uint64_t)kara->unix_timestamp || (!magic_valid)) + if (filestamp == 0 || filestamp != (uint64_t)kara->unix_timestamp || + filestamp < (uint64_t)kara->unix_timestamp || (!magic_valid)) goto do_it; /* Ignore kara */