LCOV - code coverage report
Current view: top level - third_party/openssl/crypto/comp - comp_lib.c (source / functions) Hit Total Coverage
Test: tmp.zDYK9MVh93 Lines: 0 26 0.0 %
Date: 2015-10-10 Functions: 0 4 0.0 %

          Line data    Source code
       1             : #include <stdio.h>
       2             : #include <stdlib.h>
       3             : #include <string.h>
       4             : #include <openssl/objects.h>
       5             : #include <openssl/comp.h>
       6             : 
       7           0 : COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
       8             : {
       9             :     COMP_CTX *ret;
      10             : 
      11           0 :     if ((ret = (COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) {
      12             :         /* ZZZZZZZZZZZZZZZZ */
      13             :         return (NULL);
      14             :     }
      15             :     memset(ret, 0, sizeof(COMP_CTX));
      16           0 :     ret->meth = meth;
      17           0 :     if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
      18           0 :         OPENSSL_free(ret);
      19             :         ret = NULL;
      20             :     }
      21           0 :     return (ret);
      22             : }
      23             : 
      24           0 : void COMP_CTX_free(COMP_CTX *ctx)
      25             : {
      26           0 :     if (ctx == NULL)
      27           0 :         return;
      28             : 
      29           0 :     if (ctx->meth->finish != NULL)
      30           0 :         ctx->meth->finish(ctx);
      31             : 
      32           0 :     OPENSSL_free(ctx);
      33             : }
      34             : 
      35           0 : int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
      36             :                         unsigned char *in, int ilen)
      37             : {
      38             :     int ret;
      39           0 :     if (ctx->meth->compress == NULL) {
      40             :         /* ZZZZZZZZZZZZZZZZZ */
      41             :         return (-1);
      42             :     }
      43           0 :     ret = ctx->meth->compress(ctx, out, olen, in, ilen);
      44           0 :     if (ret > 0) {
      45           0 :         ctx->compress_in += ilen;
      46           0 :         ctx->compress_out += ret;
      47             :     }
      48           0 :     return (ret);
      49             : }
      50             : 
      51           0 : int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
      52             :                       unsigned char *in, int ilen)
      53             : {
      54             :     int ret;
      55             : 
      56           0 :     if (ctx->meth->expand == NULL) {
      57             :         /* ZZZZZZZZZZZZZZZZZ */
      58             :         return (-1);
      59             :     }
      60           0 :     ret = ctx->meth->expand(ctx, out, olen, in, ilen);
      61           0 :     if (ret > 0) {
      62           0 :         ctx->expand_in += ilen;
      63           0 :         ctx->expand_out += ret;
      64             :     }
      65           0 :     return (ret);
      66             : }

Generated by: LCOV version 1.10