当前位置: 首页>>代码示例>>C++>>正文


C++ OutputStream::reset方法代码示例

本文整理汇总了C++中OutputStream::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputStream::reset方法的具体用法?C++ OutputStream::reset怎么用?C++ OutputStream::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputStream的用法示例。


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

示例1:

HCHANNEL D3DCore_Impl::Stream_Play(HSTREAM stream, bool loop, int volume)
{
	if(m_pADevice && stream != 0)
	{
		OutputStream* OStream = (OutputStream*)stream;
		OStream->setRepeat( loop );
		OStream->setVolume( m_VolStream * (volume/100.0f) );
		OStream->reset();
		OStream->play();
//		StreamChannelList.insert(stream);
		return stream;
	}
	else return 0;
}
开发者ID:manituan,项目名称:Arkavoid,代码行数:14,代码来源:Audiere.cpp

示例2: request


//.........这里部分代码省略.........
    BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
    BufferIn.Next = NULL;
    BufferIn.lpcszHeader = headers.c_str();
    BufferIn.dwHeadersLength = headers.length(); 
    BufferIn.dwHeadersTotal = 0;
    BufferIn.lpvBuffer = NULL;
    BufferIn.dwBufferLength = 0;
    BufferIn.dwBufferTotal = 0; //contentLen;
    BufferIn.dwOffsetLow = 0;
    BufferIn.dwOffsetHigh = 0;

    do {
        retry = false;
        if (!HttpSendRequestEx(req, &BufferIn, NULL, HSR_INITIATE, 0)) {
            DWORD err = GetLastError();
            if (err == ERROR_INTERNET_SEC_CERT_REV_FAILED && retryFlagRevocation) {
                LOG.info("%s: error ERROR_INTERNET_SEC_CERT_REV_FAILED: retry once a time", __FUNCTION__);
                DWORD dwFlags, dwBuffLen = sizeof(dwFlags);
                InternetQueryOption (req, INTERNET_OPTION_SECURITY_FLAGS, (LPVOID)&dwFlags, &dwBuffLen);    
                dwFlags |= SECURITY_FLAG_IGNORE_REVOCATION;
                InternetSetOption (req, INTERNET_OPTION_SECURITY_FLAGS, &dwFlags, sizeof (dwFlags));    
                retryFlagRevocation = false;
                retry = true;
                continue;
            }
                
            const char* msg = createHttpErrorMessage(err);
            LOG.error("HttpSendRequestEx failed: code %d: %s", err, msg);
            delete [] msg;
            return StatusNetworkError;
        }

#ifdef USE_ZLIB
        if (compression_enabled) {        
            if (sendData((const char *)cBuf, cBufLen) != 0) {
                delete [] cBuf;
                delete [] chunkToSend;

                return StatusWritingError;
            }

            delete [] cBuf;
        }
#endif

        if (!sendDataAtOnce) {
            int64_t bufferSize = std::min(requestChunkSize, contentLen);
            chunkToSend = new char[bufferSize+1];   

            while ((readBytes = data.read((void *)chunkToSend, bufferSize))) {
                if (sendData(chunkToSend, readBytes) != 0) {
                    delete [] chunkToSend;
                    return StatusWritingError;
                }
                fireTransportEvent(readBytes, DATA_SENT);
            }
        }

        delete [] chunkToSend;
	
	    if (data.error()) {
		    LOG.error("[%s] Input stream read error: %d on %d bytes read", __FUNCTION__, data.getPosition(), data.getTotalSize());
		    return StatusStreamReadingError;
	    }

        if (!HttpEndRequest(req, NULL, 0, 0)) {
            DWORD err = GetLastError();
            const char* msg = createHttpErrorMessage(err);
            LOG.error("HttpEndRequest failed: code %d: %s", err, msg);
            delete [] msg;
            return StatusNetworkError;
        }

        readResponseHeaders();

        ret = checkResponseStatus(); 
        if (ret == ERROR_INTERNET_FORCE_RETRY) {
            retry = true;
        }

    } while (retry == true);

    if (isErrorStatus(ret)) {      
        return ret;
    }
   
    StringBuffer nullval(NULL);
    if ((getRequestHeaders().get(HTTP_HEADER_RANGE) != nullval) && ret == 200) {
        // it means the client asks a partial response but the server doesn't support it.
        // the right answer from server is HTTP 206
        LOG.info("%s: client asks a Range, but server responds 200 instead of 206 (Partial Content). Reset the outputstream and start from scratch.", __FUNCTION__);
        response.reset();
    }

    if (readResponse(response) != 0) {
        return StatusReadingError;
    }

    return ret;
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:101,代码来源:HttpConnection.cpp

示例3: wrap_reset

static int wrap_reset(lua_State* L) {
  lua_settop(L, 1);
  OutputStream* self = luaAudiere_checkOutputStream(L, 1);
  self->reset();
  return 0;
}
开发者ID:Bananattack,项目名称:audiere,代码行数:6,代码来源:wrapOutputStream.cpp


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