Debian Codegraph @

lib/util/gv_ftell.h

raw
1 /// @file
2 /// @brief Abstraction over `ftell`
3
4 #pragma once
5
6 #include <assert.h>
7 #include <stddef.h>
8 #include <stdio.h>
9
10 /// `ftell`, accounting for platform limitations
11 static inline size_t gv_ftell(FILE *stream) {
12 assert(stream != NULL);
13
14 #ifdef _WIN32
15 // on Windows, `long` is 32 bits so `ftell` cannot report >2GB file sizes
16 return (size_t)_ftelli64(stream);
17 #endif
18
19 return (size_t)ftell(stream);
20 }