static void AddFontResources( WResID * name, ResMemFlags flags, const char * filename ) /**************************************************************/ { FontInfo info; char * devicename; char * facename; WResFileID handle; RcStatus ret; int err_code; ReadStrErrInfo readstr_err; if( name->IsName ) { RcError( ERR_FONT_NAME ); return; } handle = RcIoOpenInput( filename, O_RDONLY | O_BINARY ); if( handle == NIL_HANDLE) goto FILE_OPEN_ERROR; ret = readFontInfo( handle, &info, &err_code ); if( ret != RS_OK) goto READ_HEADER_ERROR; ret = copyFont( &info, handle, name, flags, &err_code ); if( ret != RS_OK ) goto COPY_FONT_ERROR; devicename = readString( handle, info.dfDevice, &readstr_err ); if( devicename == NULL ) { ret = readstr_err.status; err_code = readstr_err.err_code; goto READ_HEADER_ERROR; } facename = readString( handle, info.dfFace, &readstr_err ); if( facename == NULL ) { ret = readstr_err.status; err_code = readstr_err.err_code; RCFREE( devicename ); goto READ_HEADER_ERROR; } AddFontToDir( &info, devicename, facename, name ); RCFREE( devicename ); RCFREE( facename ); RCCLOSE( handle ); return; FILE_OPEN_ERROR: RcError( ERR_CANT_OPEN_FILE, filename, strerror( errno ) ); ErrorHasOccured = true; RCFREE( name ); return; READ_HEADER_ERROR: ReportCopyError( ret, ERR_READING_FONT, filename, err_code ); ErrorHasOccured = true; RCFREE( name ); RCCLOSE( handle ); return; COPY_FONT_ERROR: ReportCopyError( ret, ERR_READING_FONT, filename, err_code ); ErrorHasOccured = true; RCCLOSE( handle ); return; }
static void AddFontResources( WResID * name, ResMemFlags flags, char * filename ) /**************************************************************/ { FontInfo info; char * devicename; char * facename; int handle; int error; int err_code; ReadStrErrInfo readstr_err; if (name->IsName) { RcError( ERR_FONT_NAME ); return; } handle = RcIoOpenInput( filename, O_RDONLY | O_BINARY ); if (handle == -1) goto FILE_OPEN_ERROR; error = readFontInfo( handle, &info, &err_code ); if( error != RS_OK) goto READ_HEADER_ERROR; error = copyFont( &info, handle, name, flags, &err_code ); if( error != RS_OK ) goto COPY_FONT_ERROR; devicename = readString( handle, info.dfDevice, &readstr_err ); if( devicename == NULL ) { error = readstr_err.status; err_code = readstr_err.err_code; goto READ_HEADER_ERROR; } facename = readString( handle, info.dfFace, &readstr_err ); if (facename == NULL) { error = readstr_err.status; err_code = readstr_err.err_code; RcMemFree( devicename ); goto READ_HEADER_ERROR; } AddFontToDir( &info, devicename, facename, name ); RcMemFree( devicename ); RcMemFree( facename ); RcClose( handle ); return; FILE_OPEN_ERROR: RcError( ERR_CANT_OPEN_FILE, filename, strerror( errno ) ); ErrorHasOccured = TRUE; RcMemFree( name ); return; READ_HEADER_ERROR: ReportCopyError( error, ERR_READING_FONT, filename, err_code ); ErrorHasOccured = TRUE; RcMemFree( name ); RcClose( handle ); return; COPY_FONT_ERROR: ReportCopyError( error, ERR_READING_FONT, filename, err_code ); ErrorHasOccured = TRUE; RcClose( handle ); return; }