Skip to content

Commit f68f849

Browse files
committed
revert to i64
1 parent 5a5d314 commit f68f849

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

bin/elasticurl/main.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <aws/io/uri.h>
2525

2626
#include <inttypes.h>
27-
#include <stdint.h>
2827

2928
#ifdef _MSC_VER
3029
# pragma warning(disable : 4996) /* Disable warnings about fopen() being insecure */
@@ -67,7 +66,7 @@ struct elasticurl_ctx {
6766
bool exchange_completed;
6867
bool manual_write;
6968
bool manual_write_chunked;
70-
uint32_t manual_write_content_length;
69+
int64_t manual_write_content_length;
7170
struct aws_http_stream *stream;
7271
bool stream_ready;
7372
};
@@ -455,7 +454,7 @@ static struct aws_http_message *s_build_http_request(
455454
} else if (!app_ctx->manual_write_chunked) {
456455
char content_length[64];
457456
AWS_ZERO_ARRAY(content_length);
458-
snprintf(content_length, sizeof(content_length), "%" PRIu32, app_ctx->manual_write_content_length);
457+
snprintf(content_length, sizeof(content_length), "%" PRIi64, app_ctx->manual_write_content_length);
459458
struct aws_http_header cl_header = {
460459
.name = aws_byte_cursor_from_c_str("content-length"),
461460
.value = aws_byte_cursor_from_c_str(content_length),
@@ -624,7 +623,7 @@ static void s_manual_write_loop(struct elasticurl_ctx *app_ctx) {
624623
return;
625624
}
626625

627-
uint32_t bytes_sent = 0;
626+
int64_t bytes_sent = 0;
628627
char line_buf[4096];
629628

630629
fprintf(stderr, "Enter data (empty line to finish):\n");
@@ -668,8 +667,8 @@ static void s_manual_write_loop(struct elasticurl_ctx *app_ctx) {
668667
break;
669668
}
670669

671-
bytes_sent += (uint32_t)len;
672-
fprintf(stderr, "Sent %zu bytes (total: %" PRIu32 ")\n", len, bytes_sent);
670+
bytes_sent += (int64_t)len;
671+
fprintf(stderr, "Sent %zu bytes (total: %" PRIi64 ")\n", len, bytes_sent);
673672
}
674673

675674
/* Send final write */
@@ -685,7 +684,7 @@ static void s_manual_write_loop(struct elasticurl_ctx *app_ctx) {
685684
if (aws_http_stream_write_data(app_ctx->stream, &final_opts)) {
686685
fprintf(stderr, "final write_data failed: %s\n", aws_error_debug_str(aws_last_error()));
687686
} else {
688-
fprintf(stderr, "Stream complete. Sent %" PRIu32 " bytes.\n", bytes_sent);
687+
fprintf(stderr, "Stream complete. Sent %" PRIi64 " bytes.\n", bytes_sent);
689688
}
690689

691690
aws_input_stream_release(empty_stream);
@@ -726,9 +725,9 @@ int main(int argc, char **argv) {
726725
fprintf(stderr, "Content-Length (leave empty for chunked transfer encoding): ");
727726
char cl_buf[64];
728727
if (fgets(cl_buf, sizeof(cl_buf), stdin) && cl_buf[0] != '\n') {
729-
app_ctx.manual_write_content_length = (uint32_t)atoll(cl_buf);
728+
app_ctx.manual_write_content_length = (int64_t)atoll(cl_buf);
730729
app_ctx.manual_write_chunked = false;
731-
fprintf(stderr, "Using Content-Length: %" PRIu32 "\n", app_ctx.manual_write_content_length);
730+
fprintf(stderr, "Using Content-Length: %" PRIi64 "\n", app_ctx.manual_write_content_length);
732731
} else {
733732
app_ctx.manual_write_chunked = true;
734733
fprintf(stderr, "Using chunked transfer encoding.\n");

0 commit comments

Comments
 (0)