mirror of
https://github.com/WCBROW01/zblock.git
synced 2025-12-11 20:18:07 -05:00
Byte order called. You were about to make a huge mistake.
This commit is contained in:
@ -8,6 +8,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <endian.h>
|
||||||
|
|
||||||
#include <concord/discord.h>
|
#include <concord/discord.h>
|
||||||
#include <concord/log.h>
|
#include <concord/log.h>
|
||||||
@ -57,7 +58,7 @@ zblock_feed_info_err zblock_feed_info_exists(PGconn *conn, const char *url, u64s
|
|||||||
return ZBLOCK_FEED_INFO_DBERROR;
|
return ZBLOCK_FEED_INFO_DBERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*exists = *(int *) PQgetvalue(res, 0, 0);
|
*exists = be32toh(*(uint32_t *) PQgetvalue(res, 0, 0));
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
return ZBLOCK_FEED_INFO_OK;
|
return ZBLOCK_FEED_INFO_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
2
main.c
2
main.c
@ -82,7 +82,7 @@ static void timer_retrieve_feeds(struct discord *client, struct discord_timer *t
|
|||||||
for (int i = 0; i < nfeeds; ++i) {
|
for (int i = 0; i < nfeeds; ++i) {
|
||||||
feed_list[i].info.url = PQgetvalue(database_res, i, 0);
|
feed_list[i].info.url = PQgetvalue(database_res, i, 0);
|
||||||
feed_list[i].info.last_pubDate = PQgetvalue(database_res, i, 1);
|
feed_list[i].info.last_pubDate = PQgetvalue(database_res, i, 1);
|
||||||
feed_list[i].info.channel_id = *(u64snowflake *) PQgetvalue(database_res, i, 2);
|
feed_list[i].info.channel_id = be64toh(*(uint64_t *) PQgetvalue(database_res, i, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all those feeds
|
// get all those feeds
|
||||||
|
|||||||
Reference in New Issue
Block a user