diff options
author | marha <marha@users.sourceforge.net> | 2011-04-13 08:10:11 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-04-13 08:10:11 +0000 |
commit | c1e91b66cbcf91645f65b9d63f115dcb5a441406 (patch) | |
tree | 67be8fec5fa39c8febbd86416aeb9ef09053d1d4 /openssl/crypto/comp | |
parent | d92d86b5e751381366dcde13cf983e041e300ee2 (diff) | |
parent | 7bcdd32ccff794b9a83a88ff9bc2d0b7b088bd06 (diff) | |
download | vcxsrv-c1e91b66cbcf91645f65b9d63f115dcb5a441406.tar.gz vcxsrv-c1e91b66cbcf91645f65b9d63f115dcb5a441406.tar.bz2 vcxsrv-c1e91b66cbcf91645f65b9d63f115dcb5a441406.zip |
svn merge ^/branches/released .
Diffstat (limited to 'openssl/crypto/comp')
-rw-r--r-- | openssl/crypto/comp/c_rle.c | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/openssl/crypto/comp/c_rle.c b/openssl/crypto/comp/c_rle.c index efd366fa2..3f0ae4c56 100644 --- a/openssl/crypto/comp/c_rle.c +++ b/openssl/crypto/comp/c_rle.c @@ -1,62 +1,61 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <openssl/objects.h> -#include <openssl/comp.h> - -static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); -static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); - -static COMP_METHOD rle_method={ - NID_rle_compression, - LN_rle_compression, - NULL, - NULL, - rle_compress_block, - rle_expand_block, - NULL, - NULL, - }; - -COMP_METHOD *COMP_rle(void) - { - return(&rle_method); - } - -static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - /* int i; */ - - if (olen < (ilen+1)) - { - /* ZZZZZZZZZZZZZZZZZZZZZZ */ - return(-1); - } - - *(out++)=0; - memcpy(out,in,ilen); - return(ilen+1); - } - -static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - int i; - - if (olen < (ilen-1)) - { - /* ZZZZZZZZZZZZZZZZZZZZZZ */ - return(-1); - } - - i= *(in++); - if (i == 0) - { - memcpy(out,in,ilen-1); - } - return(ilen-1); - } - +#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/objects.h>
+#include <openssl/comp.h>
+
+static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
+ unsigned int olen, unsigned char *in, unsigned int ilen);
+static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
+ unsigned int olen, unsigned char *in, unsigned int ilen);
+
+static COMP_METHOD rle_method={
+ NID_rle_compression,
+ LN_rle_compression,
+ NULL,
+ NULL,
+ rle_compress_block,
+ rle_expand_block,
+ NULL,
+ NULL,
+ };
+
+COMP_METHOD *COMP_rle(void)
+ {
+ return(&rle_method);
+ }
+
+static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
+ unsigned int olen, unsigned char *in, unsigned int ilen)
+ {
+ /* int i; */
+
+ if (olen < (ilen+1))
+ {
+ /* ZZZZZZZZZZZZZZZZZZZZZZ */
+ return(-1);
+ }
+
+ *(out++)=0;
+ memcpy(out,in,ilen);
+ return(ilen+1);
+ }
+
+static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
+ unsigned int olen, unsigned char *in, unsigned int ilen)
+ {
+ int i;
+
+ if (ilen == 0 || olen < (ilen-1))
+ {
+ /* ZZZZZZZZZZZZZZZZZZZZZZ */
+ return(-1);
+ }
+
+ i= *(in++);
+ if (i == 0)
+ {
+ memcpy(out,in,ilen-1);
+ }
+ return(ilen-1);
+ }
|