[BACK]Return to zlib.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/Attic/zlib.c between version 1.4 and 1.5

version 1.4, 2005/12/10 20:27:45 version 1.5, 2005/12/21 10:49:29
Line 54 
Line 54 
 {  {
         CVSZCTX *ctx;          CVSZCTX *ctx;
   
         if ((level < 0) || (level > 9)) {          if ((level < 0) || (level > 9))
                 cvs_log(LP_ERR, "invalid compression level %d "                  fatal("invalid compression level %d (must be between 0 and 9)",
                     "(must be between 0 and 9)", level);                      level);
                 return (NULL);  
         }  
   
         ctx = (CVSZCTX *)xmalloc(sizeof(*ctx));          ctx = (CVSZCTX *)xmalloc(sizeof(*ctx));
         if (ctx == NULL) {  
                 cvs_log(LP_ERRNO, "failed to allocate zlib context");  
                 return (NULL);  
         }  
         memset(ctx, 0, sizeof(*ctx));          memset(ctx, 0, sizeof(*ctx));
   
         ctx->z_level = level;          ctx->z_level = level;
Line 77 
Line 71 
         ctx->z_destrm.opaque = Z_NULL;          ctx->z_destrm.opaque = Z_NULL;
   
         if ((inflateInit(&(ctx->z_instrm)) != Z_OK) ||          if ((inflateInit(&(ctx->z_instrm)) != Z_OK) ||
             (deflateInit(&(ctx->z_destrm), level) != Z_OK)) {              (deflateInit(&(ctx->z_destrm), level) != Z_OK))
                 cvs_log(LP_ERR, "failed to initialize zlib streams");                  fatal("failed to initialize zlib streams");
                 xfree(ctx);  
                 return (NULL);  
         }  
   
         return (ctx);          return (ctx);
 }  }
Line 128 
Line 119 
   
                 ret = inflate(&(ctx->z_instrm), Z_FINISH);                  ret = inflate(&(ctx->z_instrm), Z_FINISH);
                 if ((ret == Z_MEM_ERROR) || (ret == Z_BUF_ERROR) ||                  if ((ret == Z_MEM_ERROR) || (ret == Z_BUF_ERROR) ||
                     (ret == Z_STREAM_ERROR) || (ret == Z_DATA_ERROR)) {                      (ret == Z_STREAM_ERROR) || (ret == Z_DATA_ERROR))
                         cvs_log(LP_ERR, "inflate error: %s", ctx->z_instrm.msg);                          fatal("inflate error: %s", ctx->z_instrm.msg);
                         return (-1);  
                 }  
   
                 cvs_buf_append(dst, buf, ctx->z_instrm.avail_out);                  cvs_buf_append(dst, buf, ctx->z_instrm.avail_out);
                 bytes += sizeof(buf) - ctx->z_instrm.avail_out;                  bytes += sizeof(buf) - ctx->z_instrm.avail_out;
Line 165 
Line 154 
                 ctx->z_destrm.next_out = buf;                  ctx->z_destrm.next_out = buf;
                 ctx->z_destrm.avail_out = sizeof(buf);                  ctx->z_destrm.avail_out = sizeof(buf);
                 ret = deflate(&(ctx->z_destrm), Z_FINISH);                  ret = deflate(&(ctx->z_destrm), Z_FINISH);
                 if ((ret == Z_STREAM_ERROR) || (ret == Z_BUF_ERROR)) {                  if ((ret == Z_STREAM_ERROR) || (ret == Z_BUF_ERROR))
                         cvs_log(LP_ERR, "deflate error: %s", ctx->z_destrm.msg);                          fatal("deflate error: %s", ctx->z_destrm.msg);
                         return (-1);  
                 }  
   
                 if (cvs_buf_append(dst, buf,                  if (cvs_buf_append(dst, buf,
                     sizeof(buf) - ctx->z_destrm.avail_out) < 0)                      sizeof(buf) - ctx->z_destrm.avail_out) < 0)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5