Win32 / CRT backend implementation of the osal_file module.
More...
#include "internal/osal_file_internal.h"#include "osal/file/osal_file_ops.h"#include "osal/mem/osal_mem_ops.h"#include "osal/mem/osal_mem.h"#include "policy/lexleo_cstd_lib.h"#include "policy/lexleo_cstd_errno.h"#include "policy/lexleo_cstd_io.h"#include "policy/lexleo_cstd_wchar.h"#include "policy/lexleo_cstring.h"#include "policy/lexleo_win32_base.h"#include "policy/lexleo_assert.h"
Go to the source code of this file.
Functions | |
| static osal_file_status_t | osal_file_map_errno (int errnum) |
Map a CRT errno value to an osal_file_status_t. | |
| static osal_file_status_t | osal_file_win32_error (DWORD err) |
Map a Win32 error code to an osal_file_status_t. | |
| static const wchar_t * | osal_file_mode_w (const char *mode) |
| Return the wide-character mode string matching a portable file mode. | |
| static osal_file_status_t | osal_utf8_to_utf16_dup (wchar_t **out_wstr, const char *utf8, const osal_mem_ops_t *mem_ops) |
| Duplicate a UTF-8 string as a UTF-16 wide-character string. | |
| static osal_file_status_t | osal_file_open (OSAL_FILE **out, const char *pathname, const char *mode, const osal_mem_ops_t *mem_ops) |
| Open a file resource through the Win32 / CRT backend. | |
| static size_t | osal_file_read (void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st) |
Read elements from an open OSAL_FILE. | |
| static size_t | osal_file_write (const void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st) |
Write elements to an open OSAL_FILE. | |
| static osal_file_status_t | osal_file_flush (OSAL_FILE *stream) |
Flush buffered output associated with an open OSAL_FILE. | |
| static osal_file_status_t | osal_file_close (OSAL_FILE *stream) |
Close an open OSAL_FILE and release its associated wrapper. | |
| const osal_file_ops_t * | osal_file_default_ops (void) |
| Return the default Win32 / CRT OSAL file operations table. | |
This translation unit provides the active low-level osal_file operations for Windows platforms.
It implements:
errno values,GetLastError() values,_wfopen(),fread() and fwrite(),fflush(),fclose(),osal_file_ops_t table for this backend. Definition in file osal_file_win32.c.
|
static |
This private callback implements the public osal_file_ops_t::close contract for the active Windows backend.
| stream | Open OSAL_FILE handle to close. |
OSAL_FILE_STATUS_OK on success, or an error status on failure. Definition at line 555 of file osal_file_win32.c.
| const osal_file_ops_t * osal_file_default_ops | ( | void | ) |
Return the default POSIX / C stdio OSAL file operations table.
Return the default OSAL file operations for the active platform.
osal_file_ops_t table for this backend. Definition at line 575 of file osal_file_win32.c.
|
static |
This private callback implements the public osal_file_ops_t::flush contract for the active Windows backend.
| stream | Open OSAL_FILE handle. |
OSAL_FILE_STATUS_OK on success, or an error status on failure. Definition at line 531 of file osal_file_win32.c.
|
static |
| errnum | CRT error value to translate. |
OSAL_FILE_STATUS_IO. Definition at line 52 of file osal_file_win32.c.
|
static |
| mode | Portable file access mode string. |
NULL if mode is not supported by the portable osal_file contract. Definition at line 248 of file osal_file_win32.c.
|
static |
This private callback implements the public osal_file_ops_t::open contract for the active Windows backend.
| [out] | out | Receives the acquired OSAL_FILE handle on success. |
| pathname | Pathname of the file resource to open, expressed as a project-level UTF-8 string. | |
| mode | Portable file access mode string. | |
| mem_ops | Memory operations table used to allocate the OSAL file wrapper and temporary pathname conversion buffers. |
OSAL_FILE_STATUS_OK on success, or an error status on failure. Definition at line 352 of file osal_file_win32.c.
|
static |
This private callback implements the public osal_file_ops_t::read contract for the active Windows backend.
| ptr | Destination buffer. | |
| size | Size in bytes of each element. | |
| nmemb | Number of elements to read. | |
| stream | Open OSAL_FILE handle. | |
| [out] | st | Receives the operation status. |
Definition at line 437 of file osal_file_win32.c.
|
static |
| err | Win32 error code to translate. |
OSAL_FILE_STATUS_IO. Definition at line 185 of file osal_file_win32.c.
|
static |
This private callback implements the public osal_file_ops_t::write contract for the active Windows backend.
| ptr | Source buffer. | |
| size | Size in bytes of each element. | |
| nmemb | Number of elements to write. | |
| stream | Open OSAL_FILE handle. | |
| [out] | st | Receives the operation status. |
Definition at line 490 of file osal_file_win32.c.
|
static |
| [out] | out_wstr | Receives the allocated UTF-16 duplicate on success. |
| utf8 | Source UTF-8 string. | |
| mem_ops | Memory operations table used to allocate the duplicate. |
OSAL_FILE_STATUS_OK on success, or an error status on failure.MultiByteToWideChar() with CP_UTF8 and MB_ERR_INVALID_CHARS. Definition at line 281 of file osal_file_win32.c.