~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to lib/content_encoding.c

Tags: 7.20.0-1
* Package is orphaned.
* New upstream release.
* Switch to dpkg-source 3.0 (quilt) format (closes: #538547).
* Fixed build error with binutils-gold (closes: #554296). 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: content_encoding.c,v 1.34 2009-08-29 03:42:13 gknauf Exp $
 
21
 * $Id: content_encoding.c,v 1.36 2010-02-09 09:35:48 bagder Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
40
40
   (doing so will reduce code size slightly). */
41
41
#define OLD_ZLIB_SUPPORT 1
42
42
 
43
 
#define DSIZ 0x10000             /* buffer size for decompressed data */
 
43
#define DSIZ CURL_MAX_WRITE_SIZE /* buffer size for decompressed data */
44
44
 
45
45
#define GZIP_MAGIC_0 0x1f
46
46
#define GZIP_MAGIC_1 0x8b
280
280
    z->avail_in = 0;
281
281
 
282
282
    if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
283
 
        /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
284
 
        if(inflateInit2(z, MAX_WBITS+32) != Z_OK) {
285
 
          return process_zlib_error(conn, z);
286
 
        }
287
 
        k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
288
 
 
289
 
    } else {
290
 
        /* we must parse the gzip header ourselves */
291
 
        if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
292
 
          return process_zlib_error(conn, z);
293
 
        }
294
 
        k->zlib_init = ZLIB_INIT;   /* Initial call state */
 
283
      /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
 
284
      if(inflateInit2(z, MAX_WBITS+32) != Z_OK) {
 
285
        return process_zlib_error(conn, z);
 
286
      }
 
287
      k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
 
288
    }
 
289
    else {
 
290
      /* we must parse the gzip header ourselves */
 
291
      if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
 
292
        return process_zlib_error(conn, z);
 
293
      }
 
294
      k->zlib_init = ZLIB_INIT;   /* Initial call state */
295
295
    }
296
296
  }
297
297
 
298
298
  if(k->zlib_init == ZLIB_INIT_GZIP) {
299
 
     /* Let zlib handle the gzip decompression entirely */
300
 
     z->next_in = (Bytef *)k->str;
301
 
     z->avail_in = (uInt)nread;
302
 
     /* Now uncompress the data */
303
 
     return inflate_stream(conn, k);
 
299
    /* Let zlib handle the gzip decompression entirely */
 
300
    z->next_in = (Bytef *)k->str;
 
301
    z->avail_in = (uInt)nread;
 
302
    /* Now uncompress the data */
 
303
    return inflate_stream(conn, k);
304
304
  }
305
305
 
306
306
#ifndef OLD_ZLIB_SUPPORT