MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FS_FOpenFileByMode

Function FS_FOpenFileByMode

code/qcommon/files.cpp:3062–3103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3060*/
3061
3062int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
3063 int r;
3064 qboolean sync;
3065
3066 sync = qfalse;
3067
3068 switch( mode ) {
3069 case FS_READ:
3070 r = FS_FOpenFileRead( qpath, f, qtrue );
3071 break;
3072 case FS_WRITE:
3073 *f = FS_FOpenFileWrite( qpath );
3074 r = 0;
3075 if (*f == 0) {
3076 r = -1;
3077 }
3078 break;
3079 case FS_APPEND_SYNC:
3080 sync = qtrue;
3081 case FS_APPEND:
3082 *f = FS_FOpenFileAppend( qpath );
3083 r = 0;
3084 if (*f == 0) {
3085 r = -1;
3086 }
3087 break;
3088 default:
3089 Com_Error( ERR_FATAL, "FSH_FOpenFile: bad mode" );
3090 return -1;
3091 }
3092
3093 if (!f) {
3094 return r;
3095 }
3096
3097 if ( *f ) {
3098 fsh[*f].fileSize = r;
3099 }
3100 fsh[*f].handleSync = sync;
3101
3102 return r;
3103}
3104
3105int FS_FTell( fileHandle_t f ) {
3106 int pos;

Callers 1

CL_CgameSystemCallsFunction · 0.50

Calls 4

FS_FOpenFileReadFunction · 0.70
FS_FOpenFileWriteFunction · 0.70
FS_FOpenFileAppendFunction · 0.70
Com_ErrorFunction · 0.70

Tested by

no test coverage detected