GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixString/src/phoenix_getFileSize.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 12 12 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include <iostream>
8 #include "phoenix_getFileSize.h"
9
10 ///Get the size of the given file in bytes
11 /** @param fs : file to be used
12 * @return size of the given file in bytes
13 */
14 1 size_t phoenix_getFileSize(FILE* fs){
15 //Then the number of compressed bytes
16 //Get and save the number of bytes of the compressed file
17 1 fseek(fs, 0, SEEK_END);
18 1 size_t fileSize(ftell(fs));
19 1 fseek(fs, 0, SEEK_SET);
20 1 return fileSize;
21 }
22
23 ///Get the size of the given file in bytes
24 /** @param fileName : file to be used
25 * @return size of the given file in bytes
26 */
27 2 size_t phoenix_getFileSize(const std::string & fileName){
28 2 FILE* compressedFs = fopen(fileName.c_str(), "r");
29
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if(compressedFs == NULL){
30 1 return 0lu;
31 }
32 1 size_t fileSize(phoenix_getFileSize(compressedFs));
33 1 fclose(compressedFs);
34 1 return fileSize;
35 }
36
37
38
39
40