#include "Precomp.h"
#include "7zFile.h"
#ifndef USE_WINDOWS_FILE
#include <errno.h>
#ifndef USE_FOPEN
#include <stdio.h>
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
typedef int ssize_t;
typedef int off_t;
#else
#include <unistd.h>
#endif
#endif
#else
#endif
#define kChunkSizeMax …
void File_Construct(CSzFile *p)
{ … }
#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
static WRes File_Open(CSzFile *p, const char *name, int writeMode)
{ … }
WRes InFile_Open(CSzFile *p, const char *name) { … }
WRes OutFile_Open(CSzFile *p, const char *name)
{ … }
#endif
#ifdef USE_WINDOWS_FILE
static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode)
{
p->handle = CreateFileW(name,
writeMode ? GENERIC_WRITE : GENERIC_READ,
FILE_SHARE_READ, NULL,
writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
}
WRes InFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 0); }
WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1); }
#endif
WRes File_Close(CSzFile *p)
{ … }
WRes File_Read(CSzFile *p, void *data, size_t *size)
{ … }
WRes File_Write(CSzFile *p, const void *data, size_t *size)
{ … }
WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
{ … }
WRes File_GetLength(CSzFile *p, UInt64 *length)
{ … }
static SRes FileSeqInStream_Read(const ISeqInStream *pp, void *buf, size_t *size)
{ … }
void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
{ … }
static SRes FileInStream_Read(const ISeekInStream *pp, void *buf, size_t *size)
{ … }
static SRes FileInStream_Seek(const ISeekInStream *pp, Int64 *pos, ESzSeek origin)
{ … }
void FileInStream_CreateVTable(CFileInStream *p)
{ … }
static size_t FileOutStream_Write(const ISeqOutStream *pp, const void *data, size_t size)
{ … }
void FileOutStream_CreateVTable(CFileOutStream *p)
{ … }