21#if !defined (_STLP_WCE)
31#define _TEXTBUF_SIZE 0x1000
35#if !defined (INVALID_SET_FILE_POINTER)
36# define INVALID_SET_FILE_POINTER 0xffffffff
40# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
45#if !defined(__MSL__) && !defined(_STLP_WCE)
51 ret = ios_base::in;
break;
53 ret = ios_base::out;
break;
55 ret = ios_base::in | ios_base::out;
break;
62 ret |= ios_base::binary;
96#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
97 (defined (__MINGW32__) && defined (__MSVCRT__))
102# define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
103# define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + \
104 ((i) & (IOINFO_ARRAY_ELTS - 1)) )
121# if defined (__MINGW32__)
150 if (writeOk && readOk)
160#elif defined (__DMC__)
162# define FHND_APPEND 0x04
163# define FHND_DEVICE 0x08
164# define FHND_TEXT 0x10
166extern "C" unsigned char __fhnd_info[
_NFILE];
171 if (__fhnd_info[
fd] & FHND_APPEND)
174 if (__fhnd_info[
fd] & FHND_TEXT == 0)
179 const int osflags = fp->_flag;
201 _M_should_close(
false),
225 DWORD dwDesiredAccess, dwCreationDisposition;
226 bool doTruncate =
false;
228 switch (openmode & (~ios_base::ate & ~ios_base::binary)) {
230 case ios_base::out | ios_base::trunc:
237 case ios_base::out | ios_base::app:
246 case ios_base::in | ios_base::out:
250 case ios_base::in | ios_base::out | ios_base::trunc:
261#if defined(_STLP_USE_WIDE_INTERFACE)
266 dwDesiredAccess, dwShareMode, 0,
267 dwCreationDisposition, permission, 0);
277 (((openmode & ios_base::ate) != 0) &&
302#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
303 (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
308 if (init_mode != ios_base::__default_mode)
336#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
337 (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
343 if (init_mode != ios_base::__default_mode)
385#define _STLP_CTRLZ 26
397 DWORD numberOfBytesRead;
400 if (numberOfBytesRead == 0)
405 char *to =
buf + readen;
407 char *
last =
from + numberOfBytesRead - 1;
418 DWORD NumberOfBytesPeeked;
420 if (NumberOfBytesPeeked != 0) {
457 readen += numberOfBytesRead;
479 size_t bytes_to_write = (
size_t)
n;
480 DWORD NumberOfBytesWritten;
482 for (; bytes_to_write != 0;) {
485 &NumberOfBytesWritten, 0);
486 if (NumberOfBytesWritten == 0)
488 bytes_to_write -= NumberOfBytesWritten;
489 written += NumberOfBytesWritten;
494 char * nextblock =
buf, * ptrtextbuf = textbuf;
496 char * endblock =
buf +
n;
500 while ( (nextblocksize > 0) &&
501 (nextlf = (
char *)
memchr(nextblock,
_STLP_LF, nextblocksize)) != 0) {
502 ptrdiff_t linelength = nextlf - nextblock;
503 memcpy(ptrtextbuf, nextblock, linelength);
504 ptrtextbuf += linelength;
505 nextblock += (linelength + 1);
513 if (nextblocksize > 0) {
514 memcpy(ptrtextbuf, nextblock, nextblocksize);
515 ptrtextbuf += nextblocksize;
516 nextblock += nextblocksize;
519 char * writetextbuf = textbuf;
520 for (
size_t NumberOfBytesToWrite = (
size_t)(ptrtextbuf - textbuf);
521 NumberOfBytesToWrite;) {
522 DWORD NumberOfBytesWritten;
525 &NumberOfBytesWritten, 0);
526 if (!NumberOfBytesWritten)
528 writetextbuf += NumberOfBytesWritten;
529 NumberOfBytesToWrite -= NumberOfBytesWritten;
532 written = (nextblock -
buf);
537 else if (written > 0 && written <
n) {
602#
if !defined (__DMC__)
623 if (_M_view_id !=
NULL)
#define _STLP_MARK_PARAMETER_AS_UNUSED(X)
bool _M_write(char *__buf, ptrdiff_t __n)
void _M_unmap(void *__mmap_base, streamoff __len)
ios_base::openmode _M_openmode
void * _M_mmap(streamoff __offset, streamoff __len)
unsigned char _M_regular_file
static size_t _M_page_size
static void _S_initialize()
unsigned char _M_should_close
streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir)
bool _M_open(const char *, ios_base::openmode, long __protection)
ptrdiff_t _M_read(char *__buf, ptrdiff_t __n)
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
DWORD WINAPI GetFileType(HANDLE hFile)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_MOVE_TO_STD_NAMESPACE
#define __STATIC_CAST(__x, __y)
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
#define _STLP_MOVE_TO_PRIV_NAMESPACE
const _STLP_fd INVALID_STLP_FD
static streamoff __file_size(_STLP_fd fd)
static _STLP_MOVE_TO_PRIV_NAMESPACE bool __is_regular_file(_STLP_fd fd)
const _STLP_fd INVALID_STLP_FD
static streamoff __file_size(_STLP_fd fd)
static _STLP_BEGIN_NAMESPACE ios_base::openmode flag_to_openmode(int mode)
static _STLP_MOVE_TO_PRIV_NAMESPACE bool __is_regular_file(_STLP_fd fd)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define memcpy(s1, s2, n)
static ioinfo ** __pioinfo
#define FILE_ATTRIBUTE_DIRECTORY
_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle)
DWORD WINAPI GetLastError(void)
#define CreateFileMapping
#define INVALID_FILE_SIZE