Skip to content

Commit

Permalink
File API only works under Win32 or CE.
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoparadox committed Aug 9, 2024
1 parent fe3e870 commit 8355db9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/mfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ typedef MERROR_RETVAL (*mfile_read_line_t)(
struct MFILE_CADDY* p_file, char* buf, off_t buf_sz, uint8_t flags );

union MFILE_HANDLE {
#ifdef MAUG_OS_WIN
#ifdef MAUG_API_WIN32
HANDLE handle;
#else
FILE* file;
#endif /* !MAUG_OS_WIN */
#endif /* !MAUG_API_WIN32 */
MAUG_MHANDLE mem;
};

Expand Down Expand Up @@ -97,7 +97,7 @@ typedef struct MFILE_CADDY mfile_t;
error_printf( "unknown file type: %d", (p_file)->type ); \
break;

#ifdef MAUG_OS_WIN
#ifdef MAUG_API_WIN32
# define mfile_has_bytes( p_file ) \
((MFILE_CADDY_TYPE_FILE == ((p_file)->type) ? \
(off_t)SetFilePointer( (p_file)->h.handle, 0, NULL, FILE_CURRENT ) : \
Expand Down Expand Up @@ -277,7 +277,7 @@ void mfile_close( mfile_t* p_file );

/* === */

#ifdef MAUG_OS_WIN
#ifdef MAUG_API_WIN32

MERROR_RETVAL mfile_file_read_int(
struct MFILE_CADDY* p_f, uint8_t* buf, size_t buf_sz, uint8_t flags
Expand Down Expand Up @@ -452,7 +452,7 @@ MERROR_RETVAL mfile_file_read_line(
return retval;
}

#endif /* !MAUG_OS_WIN */
#endif /* !MAUG_API_WIN32 */

/* === */

Expand Down Expand Up @@ -654,7 +654,7 @@ MERROR_RETVAL mfile_open_read( const char* filename, mfile_t* p_file ) {
close( in_file );
}

# elif defined( MAUG_OS_WIN )
# elif defined( MAUG_API_WIN32 )

/* TODO: Wide chars. */

Expand Down Expand Up @@ -756,7 +756,7 @@ void mfile_close( mfile_t* p_file ) {
break;

case MFILE_CADDY_TYPE_FILE:
#ifdef MAUG_OS_WIN
#ifdef MAUG_API_WIN32
CloseHandle( p_file->h.handle );
#else
fclose( p_file->h.file );
Expand Down

0 comments on commit 8355db9

Please sign in to comment.