Skip to content

Commit

Permalink
fix: use off_t instead of int for filesize (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
MPK1 authored Aug 1, 2023
1 parent 6445ba9 commit c51068a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions demo/demo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ typedef struct xqc_demo_svr_user_conn_s {

typedef struct xqc_demo_svr_resource_s {
FILE *fp;
int total_len; /* total len of file */
int total_offset; /* total sent offset of file */
off_t total_len; /* total len of file */
off_t total_offset; /* total sent offset of file */
char *buf; /* send buf */
int buf_size; /* send buf size */
int buf_len; /* send buf len */
Expand Down Expand Up @@ -539,7 +539,7 @@ xqc_demo_svr_handle_hq_request(xqc_demo_svr_user_stream_t *user_stream, xqc_hq_r
}
/* get total len */
fseek(user_stream->res.fp, 0, SEEK_END);
user_stream->res.total_len = ftell(user_stream->res.fp);
user_stream->res.total_len = ftello(user_stream->res.fp);
fseek(user_stream->res.fp, 0, SEEK_SET);

} else {
Expand Down Expand Up @@ -832,7 +832,7 @@ xqc_demo_svr_handle_h3_request(xqc_demo_svr_user_stream_t *user_stream,
}
/* get total len */
fseek(user_stream->res.fp, 0, SEEK_END);
user_stream->res.total_len = ftell(user_stream->res.fp);
user_stream->res.total_len = ftello(user_stream->res.fp);
fseek(user_stream->res.fp, 0, SEEK_SET);

} else {
Expand Down

0 comments on commit c51068a

Please sign in to comment.