Skip to content

crunch: use _FILE_OFFSET_BITS 64 with fopen/fseek/ftell outside of Linux #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crnlib/crn_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ const bool c_crnlib_little_endian_platform = false;

const bool c_crnlib_big_endian_platform = !c_crnlib_little_endian_platform;

#if defined(__GNUC__) && !defined(__APPLE__)
#if defined(__linux__)
#define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen64(f, m)
#define crn_fseek fseeko64
#define crn_ftell ftello64
#elif defined(__GNUC__)
// This should be defined before including any header.
#define _FILE_OFFSET_BITS 64
#define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen(f, m)
#define crn_fseek fseeko
#define crn_ftell ftello
#elif defined(_MSC_VER)
#define crn_fopen(pDstFile, f, m) fopen_s(pDstFile, f, m)
#define crn_fseek _fseeki64
Expand Down