"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zlib/zlib/test/infcover.c" between
muscle7.61.zip and muscle7.62.zip

About: MUSCLE (Multi User Server Client Linking Environment) is a messaging server and networking API. The included server program ("muscled") lets its clients message each other, and/or store information in its serverside hierarchical database.

infcover.c  (muscle7.61):infcover.c  (muscle7.62)
/* infcover.c -- test zlib's inflate routines with full code coverage /* infcover.c -- test zlib's inflate routines with full code coverage
* Copyright (C) 2011 Mark Adler * Copyright (C) 2011, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* to use, do: ./configure --cover && make cover */ /* to use, do: ./configure --cover && make cover */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "zlib.h" #include "zlib.h"
skipping to change at line 240 skipping to change at line 240
free(zone); free(zone);
strm->opaque = Z_NULL; strm->opaque = Z_NULL;
strm->zalloc = Z_NULL; strm->zalloc = Z_NULL;
strm->zfree = Z_NULL; strm->zfree = Z_NULL;
} }
/* -- inflate test routines -- */ /* -- inflate test routines -- */
/* Decode a hexadecimal string, set *len to length, in[] to the bytes. This /* Decode a hexadecimal string, set *len to length, in[] to the bytes. This
decodes liberally, in that hex digits can be adjacent, in which case two in decodes liberally, in that hex digits can be adjacent, in which case two in
a row writes a byte. Or they can delimited by any non-hex character, where a row writes a byte. Or they can be delimited by any non-hex character,
the delimiters are ignored except when a single hex digit is followed by a where the delimiters are ignored except when a single hex digit is followed
delimiter in which case that single digit writes a byte. The returned by a delimiter, where that single digit writes a byte. The returned data is
data is allocated and must eventually be freed. NULL is returned if out of allocated and must eventually be freed. NULL is returned if out of memory.
memory. If the length is not needed, then len can be NULL. */ If the length is not needed, then len can be NULL. */
local unsigned char *h2b(const char *hex, unsigned *len) local unsigned char *h2b(const char *hex, unsigned *len)
{ {
unsigned char *in; unsigned char *in, *re;
unsigned next, val; unsigned next, val;
in = malloc((strlen(hex) + 1) >> 1); in = malloc((strlen(hex) + 1) >> 1);
if (in == NULL) if (in == NULL)
return NULL; return NULL;
next = 0; next = 0;
val = 1; val = 1;
do { do {
if (*hex >= '0' && *hex <= '9') if (*hex >= '0' && *hex <= '9')
val = (val << 4) + *hex - '0'; val = (val << 4) + *hex - '0';
skipping to change at line 271 skipping to change at line 271
val = (val << 4) + *hex - 'a' + 10; val = (val << 4) + *hex - 'a' + 10;
else if (val != 1 && val < 32) /* one digit followed by delimiter */ else if (val != 1 && val < 32) /* one digit followed by delimiter */
val += 240; /* make it look like two digits */ val += 240; /* make it look like two digits */
if (val > 255) { /* have two digits */ if (val > 255) { /* have two digits */
in[next++] = val & 0xff; /* save the decoded byte */ in[next++] = val & 0xff; /* save the decoded byte */
val = 1; /* start over */ val = 1; /* start over */
} }
} while (*hex++); /* go through the loop with the terminating null */ } while (*hex++); /* go through the loop with the terminating null */
if (len != NULL) if (len != NULL)
*len = next; *len = next;
in = reallocf(in, next); re = realloc(in, next);
return in; return re == NULL ? in : re;
} }
/* generic inflate() run, where hex is the hexadecimal input data, what is the /* generic inflate() run, where hex is the hexadecimal input data, what is the
text to include in an error message, step is how much input data to feed text to include in an error message, step is how much input data to feed
inflate() on each call, or zero to feed it all, win is the window bits inflate() on each call, or zero to feed it all, win is the window bits
parameter to inflateInit2(), len is the size of the output buffer, and err parameter to inflateInit2(), len is the size of the output buffer, and err
is the error code expected from the first inflate() call (the second is the error code expected from the first inflate() call (the second
inflate() call is expected to return Z_STREAM_END). If win is 47, then inflate() call is expected to return Z_STREAM_END). If win is 47, then
header information is collected with inflateGetHeader(). If a zlib stream header information is collected with inflateGetHeader(). If a zlib stream
is looking for a dictionary, then an empty dictionary is provided. is looking for a dictionary, then an empty dictionary is provided.
 End of changes. 4 change blocks. 
9 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)