chromium/third_party/lzma_sdk/C/7zFile.c

/* 7zFile.c -- File IO
2021-04-29 : Igor Pavlov : Public domain */

#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

/*
   ReadFile and WriteFile functions in Windows have BUG:
   If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
   from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
   (Insufficient system resources exist to complete the requested service).
   Probably in some version of Windows there are problems with other sizes:
   for 32 MB (maybe also for 16 MB).
   And message can be "Network connection was lost"
*/

#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)
{}


/* ---------- FileSeqInStream ---------- */

static SRes FileSeqInStream_Read(const ISeqInStream *pp, void *buf, size_t *size)
{}

void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
{}


/* ---------- FileInStream ---------- */

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)
{}


/* ---------- FileOutStream ---------- */

static size_t FileOutStream_Write(const ISeqOutStream *pp, const void *data, size_t size)
{}

void FileOutStream_CreateVTable(CFileOutStream *p)
{}