static gboolean gsf_output_csv_seek (GsfOutput *output, gsf_off_t offset, GSeekType whence) { GsfOutputCsv *csv = GSF_OUTPUT_CSV (output); return gsf_output_seek (csv->sink, offset, whence); }
static gboolean zip_header_write_sizes (GsfOutfileZip *zip) { guint8 hbuf[ZIP_HEADER_SIZE]; GsfZipDirent *dirent = zip->vdir->dirent; gsf_off_t pos = gsf_output_tell (zip->sink); if (!gsf_output_seek (zip->sink, dirent->offset + ZIP_HEADER_CRC, G_SEEK_SET)) return FALSE; GSF_LE_SET_GUINT32 (hbuf + ZIP_HEADER_CRC, dirent->crc32); GSF_LE_SET_GUINT32 (hbuf + ZIP_HEADER_COMP_SIZE, dirent->csize); GSF_LE_SET_GUINT32 (hbuf + ZIP_HEADER_UNCOMP_SIZE, dirent->usize); if (!gsf_output_write (zip->sink, 12, hbuf + ZIP_HEADER_CRC)) return FALSE; if (!gsf_output_seek (zip->sink, pos, G_SEEK_SET)) return FALSE; return TRUE; }
UT_Error IE_Exp_EPUB::compress() { GsfInfile* oebpsDir = gsf_infile_stdio_new( UT_go_filename_from_uri(m_oebpsDir.c_str()), NULL); if (oebpsDir == NULL) { UT_DEBUGMSG(("RUDYJ: Can`t open temporary OEBPS directory\n")); return UT_ERROR; } std::vector<std::string> listing = getFileList( UT_go_filename_from_uri(m_oebpsDir.c_str())); for (std::vector<std::string>::iterator i = listing.begin(); i != listing.end(); i++) { GsfOutput* item = gsf_outfile_new_child(GSF_OUTFILE(m_oebps), (*i).c_str(), FALSE); std::string fullPath = m_oebpsDir + G_DIR_SEPARATOR_S + *i; GsfInput* file = UT_go_file_open(fullPath.c_str(), NULL); if (file == NULL) { UT_DEBUGMSG(("RUDYJ: Can`t open file\n")); return UT_ERROR; } gsf_output_seek(item, 0, G_SEEK_SET); gsf_input_seek(file, 0, G_SEEK_SET); gsf_input_copy(file, item); gsf_output_close(item); // Time to delete temporary file UT_go_file_remove(fullPath.c_str(), NULL); } UT_go_file_remove((m_oebpsDir + G_DIR_SEPARATOR_S + "index.xhtml_files").c_str(), NULL); UT_go_file_remove(m_oebpsDir.c_str(), NULL); return UT_OK; }
static gboolean gsf_outfile_msole_seek (GsfOutput *output, gsf_off_t offset, GSeekType whence) { GsfOutfileMSOle *ole = (GsfOutfileMSOle *)output; switch (whence) { case G_SEEK_SET : break; case G_SEEK_CUR : offset += output->cur_offset; break; case G_SEEK_END : offset += output->cur_size; break; default : break; /*checked in GsfOutput wrapper */ } switch (ole->type) { case MSOLE_DIR: if (offset != 0) { g_warning ("Attempt to seek a directory"); return FALSE; } return TRUE; case MSOLE_SMALL_BLOCK: /* it is ok to seek past the big block threshold * we don't convert until they _write_ something */ return TRUE; case MSOLE_BIG_BLOCK: return gsf_output_seek (ole->sink, (gsf_off_t)(ole->content.big_block.start_offset + offset), G_SEEK_SET); default : return FALSE; } return FALSE; }
static gboolean gsf_outfile_open_pkg_seek (GsfOutput *output, gsf_off_t offset, GSeekType whence) { GsfOutfileOpenPkg *open_pkg = GSF_OUTFILE_OPEN_PKG (output); return gsf_output_seek (open_pkg->sink, offset, whence); }