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: 2024-04-26 00:35:57 Functions: 1 1 100.0 %

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

Generated by: LCOV version 1.14