示例#1
0
// CImgCtx (IImgCtx) ----------------------------------------------------------
STDMETHODIMP CImgCtx::Load(LPCWSTR pszUrl, DWORD dwFlags)
{
    CDwnDoc*    pDwnDoc  = NULL;
    CDwnInfo*   pDwnInfo = NULL;
    DWORD       dwBindf  = 0;
    DWNLOADINFO dli      = { 0 };
    HRESULT     hr;

    pDwnDoc = new CDwnDoc;

    if(pDwnDoc == NULL)
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    }

    if((dwFlags&DWNF_COLORMODE) == 0)
    {
        dwFlags |= GetDefaultColorMode();
    }

    dli.pDwnDoc   = pDwnDoc;
    dli.pInetSess = TlsGetInternetSession();
    dli.pchUrl    = pszUrl;

    pDwnDoc->SetRefresh(IncrementLcl());

    // This is a bit of a hack to allow our performance measurements to
    // be able to disable WinInet write caching when using IImgCtx.  We
    // don't expect anyone to really do this in the real world, but it
    // doesn't do any harm if they do.
    if(dwFlags & 0x80000000)
    {
        dwBindf |= BINDF_NOWRITECACHE;
    }

    if(dwFlags & 0x40000000)
    {
        dwBindf |= BINDF_GETNEWESTVERSION;
    }

    pDwnDoc->SetBindf(dwBindf);
    pDwnDoc->SetDocBindf(dwBindf); // (should be irrelevant)
    pDwnDoc->SetDownf(dwFlags&~DWNF_STATE|DWNF_NOOPTIMIZE);

    hr = CDwnInfo::Create(DWNCTX_IMG, &dli, &pDwnInfo);
    if(hr)
    {
        goto Cleanup;
    }

    pDwnInfo->AddDwnCtx(this);

    SetLoad(TRUE, &dli, FALSE);

Cleanup:
    if(pDwnInfo)
    {
        pDwnInfo->Release();
    }
    if(pDwnDoc)
    {
        pDwnDoc->Release();
    }

    RRETURN(hr);
}
示例#2
0
void CivArchive::ResetForLoad()
{
	m_pbInsert = m_pbBaseMemory;
	SetLoad();
}
示例#3
0
Stav* ProblemStavLoad(char** pBuf) {
  Stav* s = malloc(sizeof(Stav)); assert(s);
  bufreadone(s->v, *pBuf);
  s->m = SetLoad(pBuf); assert(s->m);
  return s;
}