Page MenuHome

Fix: 64 bit file IO on windows.
ClosedPublic

Authored by Ray Molenkamp (LazyDodo) on Mar 17 2020, 2:46 PM.

Details

Summary

BLI_winstuff.h redefined fseek/ftell and friends to their 64 bit variants, which made it
impossible to include windows.h (or any of the other windows headers) after BLI_winstuff.h

This fixes all the instances of ftell/fseek/lseek after the inclusion of BLI_winstuff.h
by providing BLI_ variants of these functions that are always 64 bit.

There may be other uses of fseek/ftell but they did not include winstuff previously
and were using 32 bit file IO and hence suspect to breakage, and are still suspect (but
easier to find now, but fixing that is beyond the scope of this diff)

I left in the macro's I used to locate the code that needed updating, so it's a little
more clear why I changed some instances of fseek/tell but not others, this will naturally be
removed before commit.

This diff is required before D6811 can land

Diff Detail

Repository
rB Blender

Event Timeline

I have little knowledge on that area, but it seems about right. Just remember to remove the "Must remove before merge" code.

This revision is now accepted and ready to land.Mar 17 2020, 3:14 PM
Ray Molenkamp (LazyDodo) planned changes to this revision.Mar 17 2020, 3:48 PM

Seeing some warns about this on linux

  • Remove result must be used attributes for BLI_fseek/lseek
  • Remove macros used for finding calls that needed replacing
  • Fix #if WIN32 needed to be #ifdef

tested on win+linux

This revision is now accepted and ready to land.Mar 17 2020, 9:33 PM
This revision was automatically updated to reflect the committed changes.