Skip to content

Commit

Permalink
Apply diff from AppImageCommunity#31
Browse files Browse the repository at this point in the history
  • Loading branch information
JustTNE committed Mar 25, 2021
1 parent 86cfd3a commit aa5d024
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/legacy_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ struct http_file
} handle;

char *buffer;
size_t buffer_len;
size_t buffer_pos;
off_t buffer_len;
off_t buffer_pos;
int still_running;
};

Expand Down Expand Up @@ -340,9 +340,9 @@ static int fill_buffer(HTTP_FILE *file, size_t want, CURLM* multi_handle)
*
* Removes `want` bytes from the front of the buffer.
*/
static int use_buffer(HTTP_FILE *file, int want)
static off_t use_buffer(HTTP_FILE *file, int want)
{
if((file->buffer_pos - want) <= 0){
if(file->buffer_pos <= want){
/* trash the buffer */
if(file->buffer){
free(file->buffer);
Expand All @@ -365,7 +365,7 @@ static int use_buffer(HTTP_FILE *file, int want)
*/
size_t http_fread(void *ptr, size_t size, size_t nmemb, HTTP_FILE *file, struct range_fetch *rf)
{
size_t want;
off_t want;
want = nmemb * size;
fill_buffer(file, want, rf->multi_handle);

Expand Down Expand Up @@ -509,7 +509,7 @@ static void buflwr(char *s) {
int range_fetch_read_http_headers(struct range_fetch *rf) {
char buf[512];
int status;
int seen_location = 0;
uint seen_location = 0;

{ /* read status line */
char *p;
Expand Down Expand Up @@ -571,7 +571,7 @@ int range_fetch_read_http_headers(struct range_fetch *rf) {
p += 2;
buflwr(buf);
{ /* Remove the trailing \r\n from the value */
int len = strcspn(p, "\r\n");
uint len = strcspn(p, "\r\n");
p[len] = 0;
}
/* buf is the header name (lower-cased), p the value */
Expand All @@ -580,7 +580,7 @@ int range_fetch_read_http_headers(struct range_fetch *rf) {
if (status == 206 && !strcmp(buf, "content-range")) {
/* Okay, we're getting a non-MIME block from the remote. Get the
* range and set our state appropriately */
int from, to;
off_t from, to;
sscanf(p, "bytes " OFF_T_PF "-" OFF_T_PF "/", &from, &to);
if (from <= to) {
rf->block_left = to + 1 - from;
Expand Down
4 changes: 2 additions & 2 deletions src/zsclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ namespace zsync2 {

// if interested in headers only, download 1 kiB chunks until end of zsync header is found
if (headersOnly && zSyncFileStoredLocallyAlready) {
static const auto chunkSize = 1024;
unsigned long currentChunk = 0;
static const off_t chunkSize = 1024;
off_t currentChunk = 0;

// download a chunk at a time
while (true) {
Expand Down

0 comments on commit aa5d024

Please sign in to comment.