static PGPError stdioFlush (PGPFile *file) { File *fp = (File *)file->priv; PGPError ret; if (! (fp->flags & FLAGS_WRITE)) return kPGPError_FileLocked; ret = (PGPError)fflush (fp->f); #if PGP_MACINTOSH if (!ret) { IOParam pb; pb.ioRefNum = fileno( fp->f ); ret = (PGPError)PBFlushFileSync( (ParamBlockRec *)&pb ); } #endif if (ret) { ret = kPGPError_FileOpFailed; setError (file, ret); fp->error = ret; } return ret; }
pascal OSErr FlushFile(short refNum) { ParamBlockRec pb; pb.ioParam.ioRefNum = refNum; return ( PBFlushFileSync(&pb) ); }
int __PHYSFS_platformFlush(void *opaque) { SInt16 ref = *((SInt16 *) opaque); ParamBlockRec pb; memset(&pb, '\0', sizeof (ParamBlockRec)); pb.ioParam.ioRefNum = ref; BAIL_IF_MACRO(oserr(PBFlushFileSync(&pb)) != noErr, NULL, 0); return(1); } /* __PHYSFS_platformFlush */
int fflush(FILE * file) { fpos_t position; /* mm 970708 */ ParamBlockRec pb; OSErr error; if (!file) return(__flush_all()); if (file->state.error || file->mode.file_kind == __closed_file) return(EOF); if (file->mode.io_mode == __read) /* mm 980430 */ return 0; /* mm 980430 */ if (file->state.io_state >= __rereading) file->state.io_state = __reading; if (file->state.io_state == __reading) file->buffer_len = 0; if (file->state.io_state != __writing) { file->state.io_state = __neutral; /* mm 970905 */ return(0); } #ifndef _No_Disk_File_OS_Support if (file->mode.file_kind != __disk_file || (position = ftello(file)) < 0) position = 0; #else position = 0; #endif if (__flush_buffer(file, NULL)) { set_error(file); return(EOF); } file->state.io_state = __neutral; file->position = position; file->buffer_len = 0; pb.ioParam.ioRefNum = file->handle; error = PBFlushFileSync(&pb); error = GetVRefNum(pb.ioParam.ioRefNum,&pb.volumeParam.ioVRefNum); pb.volumeParam.ioNamePtr = nil; error = PBFlushVolSync(&pb); return(0); }
int __cdecl _commit ( int fh ) { ParamBlockRec parm; OSErr osErr = 0; if ((unsigned)fh >= (unsigned)_nfile || !(_osfile[fh] & FOPEN)) { /* out of range -- return error */ errno = EBADF; _macerrno = 0; return -1; } if (!(_osfile[fh] & FDEV)) { memset(&parm, 0, sizeof(ParamBlockRec)); parm.ioParam.ioRefNum = _osfhnd[fh]; osErr = PBFlushFileSync(&parm); switch (osErr) { case noErr: memset(&parm, 0, sizeof(ParamBlockRec)); parm.ioParam.ioVRefNum = _osVRefNum[fh]; osErr = PBFlushVolSync(&parm); if (osErr) { _dosmaperr(osErr); return -1; } return 0; default: errno = EIO; return -1; } } return 0; }