• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ KFileRelease函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中KFileRelease函数的典型用法代码示例。如果您正苦于以下问题:C++ KFileRelease函数的具体用法?C++ KFileRelease怎么用?C++ KFileRelease使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了KFileRelease函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: vds_diff

rc_t vds_diff( const char * f1, const char * f2 )
{
    KDirectory * dir;
    rc_t rc = KDirectoryNativeDir( &dir );
    if ( rc != 0 )
		KOutMsg( "KDirectoryNativeDir() failed\n" );
    else
    {
		const KFile * kf1;
		rc = KDirectoryOpenFileRead ( dir, &kf1, "%s", f1 );
		if ( rc != 0 )
			KOutMsg( "cannot open file '%s'\n", f1 );
		else
		{
			const KFile * kf2;
			rc = KDirectoryOpenFileRead ( dir, &kf2, "%s", f2 );
			if ( rc != 0 )
				KOutMsg( "cannot open file '%s'\n", f2 );
			else
			{
				rc = vds_diff_files( kf1, kf2 );
				KFileRelease( kf2 );
			}
			KFileRelease( kf1 );
		}
		KDirectoryRelease( dir );
	}
	clear_recorded_errors();
	
	return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:31,代码来源:vdb-dump-str.c


示例2: KLoaderFile_Open

static
rc_t KLoaderFile_Open(KLoaderFile* self)
{
    rc_t rc = 0;

    DBG(("%s opening %s\n", __func__, self->realname));
    if( (rc = KDirectoryOpenFileRead(self->dir, &self->kfile, "%s", self->realname)) == 0 ) {
        if( self->has_md5 ) {
            const KFile *md5File = NULL;
            DBG(("%s opening as md5 wrapped %s\n", __func__, self->realname));
            if( (rc = KFileMakeMD5Read(&md5File, self->file, self->md5_digest)) == 0) {
                self->file = md5File;
            }
        }
        if( rc == 0 ) {
            const KFile *z = NULL;
            switch(self->compress_type) {
                case compress_none:
                    break;
                case compress_gzip:
                    DBG(("%s opening as gzip wrapped %s\n", __func__, self->realname));
                    if( (rc = KFileMakeGzipForRead(&z, self->file)) == 0 ) {
                        KFileRelease(self->file);
                        self->file = z;
                    }
                    break;
                case compress_bzip2:
                    DBG(("%s opening as bzip2 wrapped %s\n", __func__, self->realname));
                    if( (rc = KFileMakeBzip2ForRead(&z, self->file)) == 0 ) {
                        KFileRelease(self->file);
                        self->file = z;
                    }
                    break;
                default:
                    rc = RC(rcApp, rcFile, rcOpening, rcType, rcUnexpected);
                    break;
            }
#if ! WINDOWS
            if( rc == 0 && self->ahead ) {
                const KFile *z = NULL;
                if( (rc = KQueueFileMakeRead(&z, self->pos, self->file,
                                             self->buffer_size * 10,  self->buffer_size, 0)) == 0 ) {
                    KFileRelease(self->file);
                    self->file = z;
                }
            }
#endif
        }
    }
    if( rc != 0 ) {
        PLOGERR(klogErr, (klogErr, rc, "opening $(file)", PLOG_S(file), self->filename));
        KFileRelease(self->file);
    }
    return rc;
}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:55,代码来源:loader-file.c


示例3: make_lookup_reader

rc_t make_lookup_reader( const KDirectory *dir, const struct index_reader * index,
                         struct lookup_reader ** reader, size_t buf_size, const char * fmt, ... )
{
    rc_t rc;
    const struct KFile * f = NULL;
    
    va_list args;
    va_start ( args, fmt );
    
    rc = KDirectoryVOpenFileRead( dir, &f, fmt, args );
    if ( rc != 0 )
    {
        char tmp[ 4096 ];
        size_t num_writ;
        rc_t rc1 = string_vprintf( tmp, sizeof tmp, &num_writ, fmt, args );
        if ( rc1 != 0 )
            ErrMsg( "make_lookup_reader.KDirectoryVOpenFileRead( '?' ) -> %R", rc );
        else
            ErrMsg( "make_lookup_reader.KDirectoryVOpenFileRead( '%s' ) -> %R", tmp, rc );
    }
    else
    {
        const struct KFile * temp_file = NULL;
        rc = KBufFileMakeRead( &temp_file, f, buf_size );
        KFileRelease( f );
        if ( rc != 0 )
        {
            ErrMsg( "make_lookup_reader.KBufFileMakeRead() -> %R", rc );
        }
        else
        {
            lookup_reader * r = calloc( 1, sizeof * r );
            if ( r == NULL )
            {
                KFileRelease( temp_file );
                rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
                ErrMsg( "make_lookup_reader.calloc( %d ) -> %R", ( sizeof * r ), rc );
            }
            else
            {
                r->f = temp_file;
                r->index = index;
                rc = make_SBuffer( &r->buf, 4096 );
                if ( rc == 0 )
                    *reader = r;
                else
                    release_lookup_reader( r );
            }
        }
    }
    va_end ( args );
    return rc;
}
开发者ID:Jingyu9,项目名称:sra-tools,代码行数:53,代码来源:lookup_reader.c


示例4: ArchiveAndEncrypt

rc_t ArchiveAndEncrypt(KDirectory* wd, const char* inpath, const char* outpath, const char* passwd)
{
    const KDirectory* d;
    rc_t rc = KDirectoryOpenDirRead (wd, &d, false, "%s", inpath);
    if (rc == 0)
    {
        const KFile* infile;
        rc_t rc2;
    
        rc = KDirectoryOpenTocFileRead (d, &infile, 4, NULL, NULL, NULL);
        if (rc == 0)
        {
            KFile* outfile;
                
            /* if the file exists, add write access */
            KDirectorySetAccess( wd, false, 0600, 0777, "%s", outpath );
            rc = KDirectoryCreateFile(wd, &outfile, false, 0600, kcmCreate|kcmInit, "%s", outpath);
            if ( rc == 0 )
            {
                KFile* enc_outfile;
                KKey key;
                rc = KKeyInitRead(&key, kkeyAES256, passwd, string_measure(passwd, NULL));
                if ( rc == 0 )
                    rc = KEncFileMakeWrite(&enc_outfile, outfile, &key);
                    
                if (rc == 0)
                    rc = copy_file(infile, enc_outfile);
        
                rc2 = KFileRelease(outfile);
                if (rc == 0)
                    rc = rc2;
                /* remove write access */
                rc2 = KDirectorySetAccess( wd, false, 0400, 0777, "%s", outpath );
                if (rc == 0)
                    rc = rc2;
                rc2 = KFileRelease(enc_outfile);
                if (rc == 0)
                    rc = rc2;
            }
            rc2 = KFileRelease(infile);
            if (rc == 0)
                rc = rc2;
        }
        rc2 = KDirectoryRelease(d);
        if (rc == 0)
            rc = rc2;
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:49,代码来源:keyring-srv.c


示例5: make_rna_splice_log

struct rna_splice_log * make_rna_splice_log( const char * filename, const char * toolname )
{
    struct rna_splice_log * res = NULL;
    KDirectory * dir;
    rc_t rc = KDirectoryNativeDir ( &dir );
    if ( rc == 0 )
    {
        KFile * f;
        rc = KDirectoryCreateFile ( dir, &f, false, 0664, kcmInit, "%s", filename );
        if ( rc == 0 )
        {
            res = calloc( 1, sizeof * res );
            if ( res != NULL )
            {
                res->log_file = f;
                if ( toolname != NULL )
                    res->tool_name = string_dup_measure ( toolname, NULL );
            }
            else
                KFileRelease ( f );
        }
        KDirectoryRelease ( dir );
    }
    return res;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:25,代码来源:rna_splice_log.c


示例6: KQueueFileWhackRead

/* Whack
 */
static
rc_t KQueueFileWhackRead ( KQueueFile *self )
{
    void *b;

    /* no more reading */
    QFMSG ( "%s: sealing queue\n", __func__ );
    KQueueSeal ( self -> q );

    /* flush the queue */
    QFMSG ( "%s: popping queue\n", __func__ );
    while ( KQueuePop ( self -> q, & b, NULL ) == 0 )
    {
        QFMSG ( "%s: dousing a buffer\n", __func__ );
        free ( b );
    }

    /* wait for thread to exit */
    QFMSG ( "%s: waiting for bg thread to exit\n", __func__ );
    KThreadWait ( self -> t, NULL );

    /* tear it down */
    QFMSG ( "%s: freeing object\n", __func__ );
    free ( self -> b );
    KThreadRelease ( self -> t );
    KQueueRelease ( self -> q );
    KFileRelease ( self -> f );
    free ( self );

    return 0;
}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:33,代码来源:queue-file.c


示例7: WriteNamelistToFileByName

LIB_EXPORT rc_t CC WriteNamelistToFileByName( const VNamelist * namelist, const char * filename,
        const char * delim )
{
    rc_t rc;
    if ( namelist == NULL || filename == NULL || delim == NULL )
        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
    else
    {
        KDirectory * dir;
        rc = KDirectoryNativeDir ( &dir );
        if ( rc == 0 )
        {
            KFile * f;
            rc = KDirectoryCreateFile ( dir, &f, true, 0664, kcmCreate, filename );
            if ( rc == 0 )
            {
                if ( rc == 0 )
                    rc = SaveToFile( f, namelist, delim );
                KFileRelease ( f );
            }
            KDirectoryRelease ( dir );
        }
    }
    return rc;
}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:25,代码来源:from_to_namelist.c


示例8: LoadFileByNameToNameList

LIB_EXPORT rc_t CC LoadFileByNameToNameList( VNamelist * namelist, const char * filename )
{
    rc_t rc;
    if ( namelist == NULL || filename == NULL )
        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
    else
    {
        KDirectory * dir;
        rc = KDirectoryNativeDir ( &dir );
        if ( rc == 0 )
        {
            KFile const * f;
            rc = KDirectoryOpenFileRead ( dir, &f, "%s", filename );
            if ( rc == 0 )
            {
                if ( rc == 0 )
                    rc = LoadFromFile( f, namelist );
                KFileRelease ( f );
            }
            KDirectoryRelease ( dir );
        }
    }
    return rc;

}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:25,代码来源:from_to_namelist.c


示例9: SpotIteratorDestroy

static rc_t SpotIteratorDestroy(struct SpotIterator* self)
{
    assert(self);
    KDirectoryRelease(__SpotIteratorDirectory);
    __SpotIteratorDirectory = NULL;
    return KFileRelease(self->m_file);
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:7,代码来源:rd-filter-redact.c


示例10: KMemBankWhack

/* Whack
 */
static
void KMemBankWhack ( KMemBank *self )
{
    freeColdStorage(self->coldStorage, 0);
    KFileRelease(self->pf);
    free(self);
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:9,代码来源:pmem.c


示例11: KColumnDataOpenRead

/* Open
 */
rc_t KColumnDataOpenRead ( KColumnData *self,
    const KDirectory *dir, uint64_t eof, size_t pgsize )
{
    rc_t rc = KDirectoryVOpenFileRead ( dir,
        & self -> f, "data", NULL );
#if DATA_READ_FILE_BUFFER
    if ( rc == 0 )
    {
        const KFile * orig = self -> f;
        rc = KBufFileMakeRead ( & self -> f, self -> f, DATA_READ_FILE_BUFFER );
	if ( rc == 0 )
        {
            KFileRelease ( orig );
        }
        else
        {
            self -> f = orig;
            rc = 0;
        }
    }
#endif
    if ( rc == 0 )
        rc = KColumnDataInit ( self, eof, pgsize );
    return rc;
}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:27,代码来源:coldata.c


示例12: KColumnIdx2Init

/* Init
 */
static
rc_t KColumnIdx2Init ( KColumnIdx2 *self, uint64_t idx2_eof )
{
    rc_t rc;

#if 0
    memset(&self->cstorage,0,sizeof(self->cstorage));
    self->cstorage.elem_bits = sizeof(KColumnIdx2BlockCache)*8;
    self->last = 0;
#endif
    rc = KFileSize ( self -> f, & self -> eof );
    if ( rc == 0 )
    {
        if ( self -> eof < idx2_eof )
            rc = RC ( rcDB, rcColumn, rcConstructing, rcIndex, rcCorrupt );
        else
        {
            self -> eof = idx2_eof;
            return 0;
        }
    }
    
    KFileRelease ( self -> f );

    self -> f = NULL;
    return rc;
}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:29,代码来源:colidx2.c


示例13: CCFileDestroy

/* ----------------------------------------------------------------------
 * Destroy
 *
 */
static
rc_t CC CCFileDestroy (CCFile *self)
{
    rc_t rc = KFileRelease (self->original);
    free (self);
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:11,代码来源:ccfile.c


示例14: KColumnDataWhack

/* Whack
 */
rc_t KColumnDataWhack ( KColumnData *self )
{
    rc_t rc = KFileRelease ( self -> f );
    if ( rc == 0 )
        self -> f = NULL;
    return rc;
}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:9,代码来源:coldata.c


示例15: whack_lane

static void whack_lane( lane * l )
{
/*    KFileRelease( l->mappings ); */
    KFileRelease( l->reads );
    StringWhack ( l->name );
    free( l );
}
开发者ID:DCGenomics,项目名称:sra-tools,代码行数:7,代码来源:cg-dump.c


示例16: _DocFile_close_v1

static
rc_t CC
_DocFile_close_v1 ( const struct XFSFileEditor * self )
{
    struct XFSDocFileEditor * Editor;
    rc_t RCt;

    Editor = NULL;
    RCt = 0;

    if ( self == NULL ) {
        return XFS_RC ( rcNull );
    }


    Editor = ( struct XFSDocFileEditor * ) self;

    if ( Editor -> file != NULL ) {
        RCt = KFileRelease ( Editor -> file );

        Editor -> file = NULL;
    }

    return RCt;
}   /* _DocFile_close_v1 () */
开发者ID:binlu1981,项目名称:ncbi-vdb,代码行数:25,代码来源:docnode.c


示例17: txt2kdb_release

void txt2kdb_release (void)
{
    KDirectoryRelease (G.dir);
    KFileRelease (G.txt);
    KDBManagerRelease (G.mgr);
    KColumnRelease (G.col);
}
开发者ID:DCGenomics,项目名称:sra-tools,代码行数:7,代码来源:txt2kdb.c


示例18: KColumnIdx2OpenRead

/* Open
 */
rc_t KColumnIdx2OpenRead ( KColumnIdx2 *self,
    const KDirectory *dir, uint64_t eof )
{
    rc_t rc = KDirectoryOpenFileRead ( dir,
        ( const KFile** ) & self -> f, "idx2" );
#if IDX2_READ_FILE_BUFFER
    if ( rc == 0 )
    {
        KFile * orig = self -> f;
        rc = KBufFileMakeRead ( ( const KFile** ) & self -> f, self -> f, eof + 1 );
	if ( rc == 0 )
        {
            KFileRelease ( orig );
        }
        else
        {
            self -> f = orig;
            rc = 0;
        }
    }
#endif
    if ( rc == 0 )
        rc = KColumnIdx2Init ( self, eof );
    return rc;
}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:27,代码来源:wcolidx2.c


示例19: SRAFastqFile_Open

rc_t SRAFastqFile_Open(const KFile** cself, const SRAListNode* sra, const FileOptions* opt)
{
    rc_t rc = 0;
    SRAFastqFile* self;
    CALLOC( self, 1, sizeof( *self ) );
    if( self == NULL )
    {
        rc = RC( rcExe, rcFile, rcConstructing, rcMemory, rcExhausted );
    }
    else
    {
        if ( ( rc = KFileInit( &self->dad, (const KFile_vt*)&SRAFastqFile_vtbl, "SRAFastqFile", "no-name", true, false ) ) == 0 )
        {
            if ( ( rc = SRAListNode_TableOpen( sra, &self->stbl ) ) == 0 )
            {
                if ( ( rc = SRATableGetKTableRead( self->stbl, &self->ktbl ) ) == 0 )
                {
                    if ( ( rc = KTableOpenIndexRead( self->ktbl, &self->kidx, opt->index ) ) == 0 )
                    {
                        if ( ( rc = KLockMake( &self->lock ) ) == 0 )
                        {
                            MALLOC( self->buf, opt->buffer_sz * ( opt->f.fastq.gzip ? 2 : 1 ) );
                            if ( self->buf == NULL )
                            {
                                rc = RC( rcExe, rcFile, rcOpening, rcMemory, rcExhausted );
                            }
                            else
                            {
                                self->file_sz = opt->file_sz;
                                self->buffer_sz = opt->buffer_sz;
                                if ( opt->f.fastq.gzip )
                                {
                                    self->gzipped = &self->buf[ opt->buffer_sz ];
                                }
                                self->from = ~0; /* reset position beyond file end */
                                rc = FastqReaderMake( &self->reader, self->stbl,
                                                      opt->f.fastq.accession, opt->f.fastq.colorSpace,
                                                      opt->f.fastq.origFormat, false, opt->f.fastq.printLabel,
                                                      opt->f.fastq.printReadId, !opt->f.fastq.clipQuality, false,
                                                      opt->f.fastq.minReadLen, opt->f.fastq.qualityOffset,
                                                      opt->f.fastq.colorSpaceKey,
                                                      opt->f.fastq.minSpotId, opt->f.fastq.maxSpotId );
                            }
                        }
                    }
                }
            }
            if ( rc == 0 )
            {
                *cself = &self->dad;
            }
            else
            {
                KFileRelease( &self->dad );
            }
        }
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:59,代码来源:sra-fastq.c


示例20: KSubFileDestroy

/* ----------------------------------------------------------------------
 * Destroy
 *
 */
static
rc_t CC KSubFileDestroy (KSubFile *self)
{
    assert (self != NULL);
    KFileRelease (self->original);
    free (self);
    return 0;
}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:12,代码来源:subfile.c



注:本文中的KFileRelease函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KGLOG_PROCESS_ERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ KE_MSG_ALLOC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap