Commit ceff6019 authored by Sandrine Avakian's avatar Sandrine Avakian

Windows VFS fixes.

parent 9c8a905c
......@@ -81,6 +81,9 @@ struct bctbx_vfs_file_t {
* them useful*/
void* pUserData; /*Developpers can store private data under this pointer */
int fd; /* File descriptor */
#if _WIN32
HANDLE h;
#endif
off_t offset; /*File offset used by lseek*/
};
......
......@@ -24,6 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdarg.h>
#include <errno.h>
#if _WIN32
#include <io.h>
#endif
/**
* Opens the file with filename fName, associate it to the file handle pointed
......@@ -236,11 +240,17 @@ static int bcOpen(bctbx_vfs_t *pVfs, bctbx_vfs_file_t *pFile, const char *fName,
if (pFile == NULL || fName == NULL) {
return BCTBX_VFS_ERROR;
}
#if _WIN32
openFlags | = O_BINARY;
#endif
pFile->fd = open(fName, openFlags, S_IRUSR | S_IWUSR);
if (pFile->fd == -1) {
return -errno;
}
#if _WIN32
pFile->h = _get_osfhandle(pFile->fd);
#endif
pFile->pMethods = &bcio;
return BCTBX_VFS_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment