diff options
Diffstat (limited to 'docs/examples/http2-download.c')
-rw-r--r-- | docs/examples/http2-download.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c index 45fc9ff58..8515663f1 100644 --- a/docs/examples/http2-download.c +++ b/docs/examples/http2-download.c @@ -74,30 +74,32 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, fprintf(stderr, "%d %s, %ld bytes (0x%lx)\n", num, text, (long)size, (long)size); - for(i = 0; i<size; i+= width) { + for(i = 0; i<size; i += width) { fprintf(stderr, "%4.4lx: ", (long)i); if(!nohex) { /* hex not disabled, show it */ for(c = 0; c < width; c++) - if(i+c < size) - fprintf(stderr, "%02x ", ptr[i+c]); + if(i + c < size) + fprintf(stderr, "%02x ", ptr[i + c]); else fputs(" ", stderr); } - for(c = 0; (c < width) && (i+c < size); c++) { + for(c = 0; (c < width) && (i + c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { - i+=(c+2-width); + if(nohex && (i + c + 1 < size) && ptr[i + c] == 0x0D && + ptr[i + c + 1] == 0x0A) { + i += (c + 2 - width); break; } fprintf(stderr, "%c", - (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { - i+=(c+3-width); + if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && + ptr[i + c + 2] == 0x0A) { + i += (c + 3 - width); break; } } @@ -269,7 +271,7 @@ int main(int argc, char **argv) else { /* Note that on some platforms 'timeout' may be modified by select(). If you need access to the original value save a copy beforehand. */ - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); } switch(rc) { |