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-11-15 19:37:45 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       26082 : compressed_stream(stream *inner, int level)
      20             : {
      21       26082 :         if (inner == NULL)
      22             :                 return NULL;
      23             : 
      24       26082 :         const char *filename = mnstr_name(inner);
      25       26082 :         if (filename == NULL)
      26             :                 return inner;
      27             : 
      28       26082 :         const char *ext = strrchr(filename, '.');
      29       26082 :         if (ext == NULL)
      30             :                 return inner;
      31       26067 :         if (strcmp(ext, ".gz") == 0)
      32           2 :                 return gz_stream(inner, level);
      33       26065 :         if (strcmp(ext, ".bz2") == 0)
      34           1 :                 return bz2_stream(inner, level);
      35       26064 :         if (strcmp(ext, ".xz") == 0)
      36           1 :                 return xz_stream(inner, level);
      37       26063 :         if (strcmp(ext, ".lz4") == 0)
      38           4 :                 return lz4_stream(inner, level);
      39             : 
      40             :         return inner;
      41             : }

Generated by: LCOV version 1.14