Skip to content

Conversation

@bearlin
Copy link
Contributor

@bearlin bearlin commented Mar 7, 2016

  1. Add some protections in _xdb_read_data
  2. In xdb_open, add O_BINARY flag for cygwin/windows

libscws/xdb.c Outdated

/* try to open & check the file */
#ifdef WIN32
if ((x->fd = open(fpath, mode == 'w' ? O_RDWR|O_BINARY : O_RDONLY|O_BINARY)) < 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O_BINARY: the 'binary' mode flag on Windows, this flag only exist in Windows platform.
Ref : https://msdn.microsoft.com/en-us/library/tw4k6df8.aspx

@hightman
Copy link
Owner

hightman commented Mar 8, 2016

I think we can use following code:

#ifndef O_BINARY
#define O_BINARY 0
#endif

@bearlin
Copy link
Contributor Author

bearlin commented Mar 8, 2016

Ok, I will add this and remove the "#ifdef WIN32" around open()


#ifndef O_BINARY
#define O_BINARY 0
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify the O_BINARY macro for all platforms at the beginning of xdb.c

@bearlin
Copy link
Contributor Author

bearlin commented Jun 15, 2022

@hightman Please review and hope we can merge this PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants