fix type mismatch for Blob*s, fix grandom

This commit is contained in:
Iris Lightshard 2021-07-30 23:46:42 -06:00
parent e501297b23
commit e9839b1663
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 5 additions and 6 deletions

4
cart.c
View file

@ -8,7 +8,7 @@ Cart* create_cart(char* name) {
char path[64] = {0}; char path[64] = {0};
char file[64] = {0}; char file[64] = {0};
Cart* cart; Cart* cart;
char* cart_data; Blob* cart_data;
scat(path, "carts/"); scat(path, "carts/");
scat(path, name); scat(path, name);
@ -54,7 +54,7 @@ int get_chunk(UserInfo* table, char* uname, char* chunk) {
char type[8] = {0}; char type[8] = {0};
char chunk_id[64] = {0}; char chunk_id[64] = {0};
char* c = chunk; char* c = chunk;
char* data; Blob* data;
if (u == nil || u->cart == nil) if (u == nil || u->cart == nil)
return 0; return 0;

7
xrxs.c
View file

@ -457,12 +457,10 @@ void read_random(Req* r) {
respond(r, nil); respond(r, nil);
} }
/* Gotta fix this by making it simpler! */
void read_grandom(Req* r) { void read_grandom(Req* r) {
char buf[8] = {0}; char buf[8] = {0};
int i; int i;
int reset = 0; int reset = 1;
int random; int random;
UserInfo* u = find_user(users_table, r->fid->uid); UserInfo* u = find_user(users_table, r->fid->uid);
UserInfo** usrs = malloc(64 * sizeof(UserInfo*)); UserInfo** usrs = malloc(64 * sizeof(UserInfo*));
@ -482,9 +480,10 @@ void read_grandom(Req* r) {
uu = usrs; uu = usrs;
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
if ((*uu) != nil && (*uu)->random >= 0) { if ((*uu) != nil && (*uu)->random >= 0) {
reset = 1; reset = 0;
break; break;
} }
uu++;
} }
if (reset) { if (reset) {
srand(rand()); srand(rand());