Function GetStream

Synopsis

#include <include/fileupdatecallback.hpp>

STDMETHOD() GetStream(UInt32 index, ISequentialInStream **inStream)

Description

No description yet.

Source

Lines 110-139 in src/fileupdatecallback.cpp. Line 48 in include/fileupdatecallback.hpp.

HRESULT FileUpdateCallback::GetStream( UInt32 index, ISequentialInStream** inStream ) {
    RINOK( Finilize() );

    if ( index < mOldArcItemsCount ) { //old item in the archive
        return S_OK;
    }

    const FSItem& new_item = mNewItems[ index - mOldArcItemsCount ];

    if ( mHandler.fileCallback() ) {
        mHandler.fileCallback()( new_item.name() );
    }

    if ( new_item.isDir() ) {
        return S_OK;
    }

    auto* inStreamSpec = new CInFileStream;
    CMyComPtr< ISequentialInStream > inStreamLoc( inStreamSpec );
    wstring path = new_item.path();

    if ( !inStreamSpec->Open( path.c_str() ) ) {
        DWORD last_error = ::GetLastError();
        mFailedFiles.emplace_back( path, HRESULT_FROM_WIN32( last_error ) );
        return S_FALSE;
    }

    *inStream = inStreamLoc.Detach();
    return S_OK;
}





Add Discussion as Guest

Log in