AmendHub

Download:

jcs

/

subtext

/

amendments

/

368

binkp: Pass uthread_yield to DNSResolveName, other minor fixes


jcs made amendment 368 about 1 year ago
--- binkp.c Tue Mar 7 21:23:09 2023 +++ binkp.c Wed Mar 8 10:10:54 2023 @@ -161,7 +161,7 @@ binkp_fetch(void) continue; } - snprintf(filename, sizeof(filename), "f%07ld.pkt", mail_ids[n]); + snprintf(filename, sizeof(filename), "f%07lu.pkt", mail_ids[n]); if (!binkp_send_buf_as_file(binkpc, filename, pkt_buf, pkt_buf_size)) { xfree(&pkt_buf); @@ -225,7 +225,7 @@ binkp_connect(char *hostname, unsigned short port) goto error; } - error = TCPResolveName(&hostname, &host_ip); + error = DNSResolveName(&hostname, &host_ip, uthread_yield); if (error) { logger_printf("[binkp] failed resolving binkp host %s: %d", hostname, error); @@ -359,7 +359,6 @@ bool binkp_read_frame(struct binkp_connection *conn) { char tmp[128]; - struct binkp_frame *frame; size_t len, off, frame_data_read; unsigned short rlen; short error; @@ -488,7 +487,7 @@ binkp_read_frame(struct binkp_connection *conn) } } - if (sscanf(conn->buf + 1, "%128s %ld %ld %ld", + if (sscanf(conn->buf + 1, "%128s %lu %lu %lu", &conn->cur_file.filename, &conn->cur_file.size, &conn->cur_file.mtime, &off) == 4) { logger_printf("[binkp] new file \"%s\" size %ld", @@ -567,7 +566,7 @@ binkp_read_frame(struct binkp_connection *conn) FSClose(conn->cur_file.frefnum); conn->cur_file.frefnum = 0; - len = snprintf(tmp, sizeof(tmp), "%s %ld %ld", + len = snprintf(tmp, sizeof(tmp), "%s %lu %lu", conn->cur_file.filename, conn->cur_file.size, conn->cur_file.mtime); if (!binkp_send_frame(conn, BINKP_COMMAND_M_GOT, tmp, len)) @@ -700,11 +699,10 @@ binkp_ingest(void) short dir_id, error; unsigned long started = Time, elapsed; size_t data_size; - long n, j; char *data; fpb->ioVRefNum = 0; - fpb->ioNamePtr = binkp_dir; + fpb->ioNamePtr = (StringPtr)&binkp_dir; error = PBGetCatInfo(&cipbr, false); if (error) { logger_printf("[binkp] PBGetCatInfo on binkp dir failed: %d", @@ -713,7 +711,7 @@ binkp_ingest(void) } dir_id = dpb->ioDrDirID; - fpb->ioNamePtr = file_name_c; + fpb->ioNamePtr = (StringPtr)&file_name_c; for (;;) { file_name_c[0] = 0; fpb->ioDirID = dir_id;