diff options
Diffstat (limited to 'src/lib/libcrypto/comp/c_rle.c')
| -rw-r--r-- | src/lib/libcrypto/comp/c_rle.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c index 47dfb67fbd..7a5db298c5 100644 --- a/src/lib/libcrypto/comp/c_rle.c +++ b/src/lib/libcrypto/comp/c_rle.c | |||
| @@ -5,11 +5,11 @@ | |||
| 5 | #include <openssl/comp.h> | 5 | #include <openssl/comp.h> |
| 6 | 6 | ||
| 7 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | 7 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, |
| 8 | unsigned int olen, unsigned char *in, unsigned int ilen); | 8 | unsigned int olen, unsigned char *in, unsigned int ilen); |
| 9 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | 9 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, |
| 10 | unsigned int olen, unsigned char *in, unsigned int ilen); | 10 | unsigned int olen, unsigned char *in, unsigned int ilen); |
| 11 | 11 | ||
| 12 | static COMP_METHOD rle_method={ | 12 | static COMP_METHOD rle_method = { |
| 13 | NID_rle_compression, | 13 | NID_rle_compression, |
| 14 | LN_rle_compression, | 14 | LN_rle_compression, |
| 15 | NULL, | 15 | NULL, |
| @@ -18,44 +18,44 @@ static COMP_METHOD rle_method={ | |||
| 18 | rle_expand_block, | 18 | rle_expand_block, |
| 19 | NULL, | 19 | NULL, |
| 20 | NULL, | 20 | NULL, |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | COMP_METHOD *COMP_rle(void) | 23 | COMP_METHOD * |
| 24 | { | 24 | COMP_rle(void) |
| 25 | return(&rle_method); | 25 | { |
| 26 | } | 26 | return (&rle_method); |
| 27 | 27 | } | |
| 28 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | 28 | |
| 29 | unsigned int olen, unsigned char *in, unsigned int ilen) | 29 | static int |
| 30 | { | 30 | rle_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, |
| 31 | unsigned char *in, unsigned int ilen) | ||
| 32 | { | ||
| 31 | /* int i; */ | 33 | /* int i; */ |
| 32 | 34 | ||
| 33 | if (ilen == 0 || olen < (ilen-1)) | 35 | if (ilen == 0 || olen < (ilen - 1)) { |
| 34 | { | ||
| 35 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ | 36 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ |
| 36 | return(-1); | 37 | return (-1); |
| 37 | } | ||
| 38 | |||
| 39 | *(out++)=0; | ||
| 40 | memcpy(out,in,ilen); | ||
| 41 | return(ilen+1); | ||
| 42 | } | 38 | } |
| 43 | 39 | ||
| 44 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | 40 | *(out++) = 0; |
| 45 | unsigned int olen, unsigned char *in, unsigned int ilen) | 41 | memcpy(out, in, ilen); |
| 46 | { | 42 | return (ilen + 1); |
| 43 | } | ||
| 44 | |||
| 45 | static int | ||
| 46 | rle_expand_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, | ||
| 47 | unsigned char *in, unsigned int ilen) | ||
| 48 | { | ||
| 47 | int i; | 49 | int i; |
| 48 | 50 | ||
| 49 | if (olen < (ilen-1)) | 51 | if (olen < (ilen - 1)) { |
| 50 | { | ||
| 51 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ | 52 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ |
| 52 | return(-1); | 53 | return (-1); |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | i= *(in++); | 56 | i= *(in++); |
| 56 | if (i == 0) | 57 | if (i == 0) { |
| 57 | { | 58 | memcpy(out, in, ilen - 1); |
| 58 | memcpy(out,in,ilen-1); | ||
| 59 | } | ||
| 60 | return(ilen-1); | ||
| 61 | } | 59 | } |
| 60 | return (ilen - 1); | ||
| 61 | } | ||
