chd_error chd_file::open(struct zfile *file, bool writeable, chd_file *parent) { // make sure we don't already have a file open if (m_file != NULL) return CHDERR_ALREADY_OPEN; // open the file m_file = file; m_owns_file = false; m_parent = parent; return open_common(writeable); }
static int open_avdec(void * priv, const char * location) { bgav_options_t * opt; avdec_priv * avdec = priv; avdec->dec = bgav_create(); opt = bgav_get_options(avdec->dec); bgav_options_copy(opt, avdec->opt); if(!bgav_open(avdec->dec, location)) return 0; return open_common(avdec); }
static int open_io_avdec(void * priv, gavf_io_t * io) { bgav_options_t * opt; avdec_priv * avdec = priv; avdec->dec = bgav_create(); opt = bgav_get_options(avdec->dec); bgav_options_copy(opt, avdec->opt); if(!bgav_open_callbacks(avdec->dec, read_callback, gavf_io_can_seek(io) ? seek_callback : 0, io, gavf_io_filename(io), gavf_io_mimetype(io), gavf_io_total_bytes(io))) return 0; return open_common(avdec); }
/* Full direct path refers to both the [in]existence of a file, its stat and * content */ /* Full path refers to the full direct path and any dereferences of * symlinks from it */ /* All outputs to the full path also output (non-exclusively) to the * containing directory */ /* For read: Depends on the full path */ /* For write: Outputs the full path */ DEFINE_WRAPPER(int, open, (const char *path, int flags, ...)) { va_list args; va_start(args, flags); mode_t mode; bool res = open_common(path, flags, args, &mode); va_end(args); if(!res) return PERM_ERROR(-1, "open \"%s\"", path); /* open_common handles the reporting */ return SILENT_CALL_REAL(int, open, path, flags, mode); } /* Ditto open */ DEFINE_WRAPPER(int, open64, (const char *path, int flags, ...)) { va_list args; va_start(args, flags); mode_t mode; bool res = open_common(path, flags, args, &mode); va_end(args);