LCOV - code coverage report
Current view: top level - common/stream - compressed.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 14 100.0 %
Date: 2021-10-13 02:24:04 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : #include "monetdb_config.h"
      10             : #include "stream.h"
      11             : #include "stream_internal.h"
      12             : 
      13             : 
      14             : stream *
      15       25284 : compressed_stream(stream *inner, int level)
      16             : {
      17       25284 :         if (inner == NULL)
      18             :                 return NULL;
      19             : 
      20       25284 :         char *filename = mnstr_name(inner);
      21       25284 :         if (filename == NULL)
      22             :                 return inner;
      23             : 
      24       25284 :         const char *ext = strrchr(filename, '.');
      25       25284 :         if (ext == NULL)
      26             :                 return inner;
      27       25266 :         if (strcmp(ext, ".gz") == 0)
      28           5 :                 return gz_stream(inner, level);
      29       25261 :         if (strcmp(ext, ".bz2") == 0)
      30         141 :                 return bz2_stream(inner, level);
      31       25120 :         if (strcmp(ext, ".xz") == 0)
      32           2 :                 return xz_stream(inner, level);
      33       25118 :         if (strcmp(ext, ".lz4") == 0)
      34           4 :                 return lz4_stream(inner, level);
      35             : 
      36             :         return inner;
      37             : }
      38             : 
      39             : 

Generated by: LCOV version 1.14