Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Side by Side Diff: openssl/crypto/comp/c_rle.c

Issue 2072073002: Delete bundled copy of OpenSSL and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/openssl@master
Patch Set: Delete bundled copy of OpenSSL and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « openssl/crypto/cmac/cmac.c ('k') | openssl/crypto/comp/c_zlib.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <openssl/objects.h>
5 #include <openssl/comp.h>
6
7 static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
8 unsigned int olen, unsigned char *in, unsigned int ilen);
9 static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
10 unsigned int olen, unsigned char *in, unsigned int ilen);
11
12 static COMP_METHOD rle_method={
13 NID_rle_compression,
14 LN_rle_compression,
15 NULL,
16 NULL,
17 rle_compress_block,
18 rle_expand_block,
19 NULL,
20 NULL,
21 };
22
23 COMP_METHOD *COMP_rle(void)
24 {
25 return(&rle_method);
26 }
27
28 static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
29 unsigned int olen, unsigned char *in, unsigned int ilen)
30 {
31 /* int i; */
32
33 if (ilen == 0 || olen < (ilen-1))
34 {
35 /* ZZZZZZZZZZZZZZZZZZZZZZ */
36 return(-1);
37 }
38
39 *(out++)=0;
40 memcpy(out,in,ilen);
41 return(ilen+1);
42 }
43
44 static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
45 unsigned int olen, unsigned char *in, unsigned int ilen)
46 {
47 int i;
48
49 if (olen < (ilen-1))
50 {
51 /* ZZZZZZZZZZZZZZZZZZZZZZ */
52 return(-1);
53 }
54
55 i= *(in++);
56 if (i == 0)
57 {
58 memcpy(out,in,ilen-1);
59 }
60 return(ilen-1);
61 }
OLDNEW
« no previous file with comments | « openssl/crypto/cmac/cmac.c ('k') | openssl/crypto/comp/c_zlib.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698