本文整理汇总了C++中Failed函数的典型用法代码示例。如果您正苦于以下问题:C++ Failed函数的具体用法?C++ Failed怎么用?C++ Failed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Failed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disconnect
bool InstallWindow::Step2Finished()
{
ui->animationLabel->hide();
_movie.stop();
disconnect(&_proc2, SIGNAL(finished(int)), this, SLOT(Step2Finished()));
if (_proc2.exitCode() != 0)
return Failed(tr("Cannot parse JSON: ") +
QString::fromLocal8Bit(_proc2.readAllStandardError()));
QString result = QString::fromLocal8Bit(_proc2.readAllStandardOutput());
// Parse returned Json answer
if (!_game->ParseJson(result))
return Failed(tr("Error parsing appinfo.json!"));
// Check if ID matches
QRegExp rx(_game->ID());
if (!_game->JsonID().contains(rx))
return Failed(tr("Seems to be wrong game or naming error!<br />"
"Ipk ID: %1<br />"
"Expected ID mask: %2")
.arg(_game->JsonID())
.arg(_game->ID()));
PrintOK(_game->JsonTitle() + " " +
_game->JsonVersion() + tr(" by ") +
_game->JsonVendor());
return Step3PrepareDirs();
}
示例2: gfxCriticalError
bool
CompositorD3D11::UpdateConstantBuffers()
{
HRESULT hr;
D3D11_MAPPED_SUBRESOURCE resource;
resource.pData = nullptr;
hr = mContext->Map(mAttachments->mVSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
if (Failed(hr) || !resource.pData) {
gfxCriticalError() << "Failed to map VSConstantBuffer. Result: " << hr;
return false;
}
*(VertexShaderConstants*)resource.pData = mVSConstants;
mContext->Unmap(mAttachments->mVSConstantBuffer, 0);
resource.pData = nullptr;
hr = mContext->Map(mAttachments->mPSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
if (Failed(hr) || !resource.pData) {
gfxCriticalError() << "Failed to map PSConstantBuffer. Result: " << hr;
return false;
}
*(PixelShaderConstants*)resource.pData = mPSConstants;
mContext->Unmap(mAttachments->mPSConstantBuffer, 0);
ID3D11Buffer *buffer = mAttachments->mVSConstantBuffer;
mContext->VSSetConstantBuffers(0, 1, &buffer);
buffer = mAttachments->mPSConstantBuffer;
mContext->PSSetConstantBuffers(0, 1, &buffer);
return true;
}
示例3: Failed
void CTraverseBySourceExchange::SendPacket()
{
m_bFailed = m_dwState & NAT_E_NOPEER;
try
{
if(!m_bFailed && (m_dwState&NAT_S_SYNC)==0 && time(NULL)-m_SendReqTime > m_dwNextSyncInterval) // 5 seconds
{
// failed to connect
if(m_nSendReqCount > SYNC_ATTEMPT_TIMES)
{
m_dwState|=NAT_E_TIMEOUT;
Failed();
}
else
{
if(m_nSendReqCount==0)
_AddLogLine(false, _T("Begin to connect %s."), UserHashToString(m_UserHash));
SendConnectReq();
}
}
if(m_bFailed)
{
if(m_Sock)// && pClientSock->client)
{
//m_Sock->m_bUseNat = false;
}
if(m_dwState & NAT_E_NOPEER)
{
_AddLogLine(false, _T("Unconnected NatSock was deleted. server return E_NOPEER. %s."), UserHashToString(m_UserHash));
}
else
{
_AddLogLine(false, _T("Unconnected NatSock was deleted. time out. %s."), UserHashToString(m_UserHash));
}
}
if(m_dwState & NAT_S_SYNC && time(NULL)-m_SendPingTime > PING_ATTEMPT_INTERVAL)
{
if(m_nPassivePing> PING_ATTEMPT_TIMES)
{
_AddLogLine(false, _T("Passive Unconnected NatSock was deleted. timeout. %s."), UserHashToString(m_UserHash));
Failed();
}
else
{
SendPingPacket();
}
}
}
catch(...)
{
// the CAsyncSocketEx maybe is deleted
Failed();
}
}
示例4: FT_GetStatus
int CKMotionIO::NumberBytesAvailToRead(int *navail, bool ShowMessage)
{
FT_STATUS ftStatus;
DWORD EventDWord;
DWORD RxBytes;
DWORD TxBytes;
*navail = strlen(m_SaveChars); // take into account any already read in
Mutex->Lock();
ftStatus = FT_GetStatus(ftHandle,&RxBytes,&TxBytes,&EventDWord);
if (ftStatus != FT_OK)
{
if (ShowMessage)
Failed();
else
m_Connected=false;
Mutex->Unlock();
return 1;
}
else
{
*navail+=(int)RxBytes;
Mutex->Unlock();
return 0;
}
}
示例5: Update
/* ---------------------------------------------------------------------------------------------
* Send the payload to the associated server to keep the server alive in the master-list.
*/
void Update(mg_mgr * manager)
{
// Is there a connection already waiting response and are we allowed to update?
if (m_Conn || !m_Valid)
{
return; // Keep waiting for a reply and ignore this request
}
// Attempt to create a connection to the associated master-server
m_Conn = mg_connect(manager, m_Addr.Addr(), EventHandler);
// Make sure that the connection could be created
if (!m_Conn)
{
MtVerboseError("Unable to create connection for '%s'", m_Addr.Addr());
// This operation failed
Failed();
}
else
{
// Set associated connection user data to this instance
m_Conn->user_data = this;
// Attach the HTTP protocol component
mg_set_protocol_http_websocket(m_Conn);
// Send the payload data
mg_printf(m_Conn, "%s", m_Data);
// Verbose status
MtVerboseMessage("Connection created for '%s'", m_Addr.Addr());
}
}
示例6: MOZ_ASSERT
TemporaryRef<CompositingRenderTarget>
CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
SurfaceInitMode aInit)
{
MOZ_ASSERT(aRect.width != 0 && aRect.height != 0);
if (aRect.width * aRect.height == 0) {
return nullptr;
}
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
RefPtr<ID3D11Texture2D> texture;
HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
if (Failed(hr) || !texture) {
return nullptr;
}
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft());
rt->SetSize(IntSize(aRect.width, aRect.height));
if (aInit == INIT_MODE_CLEAR) {
FLOAT clear[] = { 0, 0, 0, 0 };
mContext->ClearRenderTargetView(rt->mRTView, clear);
}
return rt;
}
示例7: Close
void Site::OnConnect(int iErrorCode)
{
CIoKnockDlg *pDlg = theApp.GetDialog();
if (!iErrorCode)
{
Close();
m_bCloseNeeded = false;
pDlg->SetKnock(m_dwCurrentKnock+1, true, _T("Knocked"));
m_dwCurrentKnock++;
NextKnock();
return;
}
CString err;
switch(iErrorCode)
{
case WSAECONNREFUSED:
err.Format(_T("Error: Rejected"));
break;
case WSAENETUNREACH:
err.Format(_T("Error: Unreachable"));
break;
case WSAETIMEDOUT:
err.Format(_T("Error: Timeout"));
break;
default:
err.Format(_T("Error: #%d"), iErrorCode);
}
pDlg->SetKnock(m_dwCurrentKnock+1, false, err);
Failed(SITE_TIMEDOUT);
pDlg->KnockDone();
}
示例8: HandleError
void
CompositorD3D11::VerifyBufferSize()
{
DXGI_SWAP_CHAIN_DESC swapDesc;
HRESULT hr;
hr = mSwapChain->GetDesc(&swapDesc);
if (Failed(hr)) {
return;
}
if ((swapDesc.BufferDesc.Width == mSize.width &&
swapDesc.BufferDesc.Height == mSize.height) ||
mSize.width <= 0 || mSize.height <= 0) {
return;
}
mDefaultRT = nullptr;
if (IsRunningInWindowsMetro()) {
hr = mSwapChain->ResizeBuffers(2, mSize.width, mSize.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
HandleError(hr);
mDisableSequenceForNextFrame = true;
} else {
hr = mSwapChain->ResizeBuffers(1, mSize.width, mSize.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
HandleError(hr);
}
}
示例9: alarm
void XITServerTest::TearDown() {
alarm(0);
if (server.Pid() != -1) {
if (!server.Terminate(3000))
server.Kill(3000);
EXPECT_EQ(server.GetState(), xorg::testing::Process::FINISHED_SUCCESS) << "Unclean server shutdown";
failed = failed || (server.GetState() != xorg::testing::Process::FINISHED_SUCCESS);
std::ifstream logfile(server.GetLogFilePath().c_str());
std::string line;
std::string bug_warn("BUG");
if (logfile.is_open()) {
while(getline(logfile, line)) {
size_t found = line.find(bug_warn);
bool error = (found != std::string::npos);
EXPECT_FALSE(error) << "BUG warning found in log" << std::endl << line << std::endl;
failed = failed || error;
break;
}
}
}
if (!Failed()) {
config.RemoveConfig();
server.RemoveLogFile();
}
testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners();
listeners.Release(this);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__test__xorg-integration-tests,代码行数:30,代码来源:xit-server-test.cpp
示例10: LogFailure
void ezStatus::LogFailure(ezLogInterface* pLog)
{
if (Failed())
{
ezLogInterface* pInterface = pLog ? pLog : ezLog::GetThreadLocalLogSystem();
ezLog::Error(pInterface, "{0}", m_sMessage);
}
}
示例11: VerifyResult
void VerifyResult(nsresult rv)
{
if (NS_FAILED(rv))
{
Failed("rv failed");
printf("rv = %d\n", rv);
}
}
示例12: CheckTime
void CInstance::CheckTime(uint32 tick)
{
if (m_lastTimeCheck + 1000 <= tick && !Failed())
{
luautils::OnInstanceTimeUpdate(m_zone, this, GetElapsedTime(tick));
m_lastTimeCheck = tick;
}
}
示例13: __uuidof
void
CompositorD3D11::PaintToTarget()
{
nsRefPtr<ID3D11Texture2D> backBuf;
HRESULT hr;
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment());
if (Failed(hr)) {
return;
}
D3D11_TEXTURE2D_DESC bbDesc;
backBuf->GetDesc(&bbDesc);
CD3D11_TEXTURE2D_DESC softDesc(bbDesc.Format, bbDesc.Width, bbDesc.Height);
softDesc.MipLevels = 1;
softDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
softDesc.Usage = D3D11_USAGE_STAGING;
softDesc.BindFlags = 0;
nsRefPtr<ID3D11Texture2D> readTexture;
hr = mDevice->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
if (Failed(hr)) {
return;
}
mContext->CopyResource(readTexture, backBuf);
D3D11_MAPPED_SUBRESOURCE map;
hr = mContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &map);
if (Failed(hr)) {
return;
}
RefPtr<DataSourceSurface> sourceSurface =
Factory::CreateWrappingDataSourceSurface((uint8_t*)map.pData,
map.RowPitch,
IntSize(bbDesc.Width, bbDesc.Height),
SurfaceFormat::B8G8R8A8);
mTarget->CopySurface(sourceSurface,
IntRect(0, 0, bbDesc.Width, bbDesc.Height),
IntPoint(-mTargetBounds.x, -mTargetBounds.y));
mTarget->Flush();
mContext->Unmap(readTexture, 0);
}
示例14: assert
void ElevationLayeri3d::RequestTile(
const std::string& sQuadcode,
boost::function<void(const std::string&, ElevationTile*)> cbfReady,
boost::function<void(const std::string&)> cbfFailed)
{
if (Failed())
{
assert(false); // attempting to request tile from a failed image layer!!
return;
}
if (!Ready())
{
assert(false); // attempting to request a tile from a non ready image layer!
return;
}
// File-Format;
std::string sExtension = ".elv";
if (_oDatasetInfo.GetTileFormat() == "image/png")
{
}
// Check lod:
unsigned int nRequestedLod = sQuadcode.length();
unsigned int nLod = _oDatasetInfo.GetLevelOfDetail();
bool bInterpolate = false;
SElevationTileRequestI3D* pTileRequest = new SElevationTileRequestI3D;
pTileRequest->cbfFailed = cbfFailed;
pTileRequest->cbfReady = cbfReady;
pTileRequest->pLayer = this;
pTileRequest->sQuadcode = sQuadcode;
if (nRequestedLod>nLod)
{
delete pTileRequest;
// can't get!
}
else
{
pTileRequest->bInterpolate = false;
pTileRequest->nLod = 0;
std::string sFilename = FilenameUtils::DelimitPath(_servername + _layername);
sFilename += sQuadcode;
sFilename += sExtension;
sFilename = FilenameUtils::MakeHierarchicalFileName(sFilename, 2);
//ImageLoader::LoadFromUrl_ThreadedUnpack(eFormat, sFilename, ePixelformat, _OnImageReadyi3d, _OnImageFailedi3d, (void*) pTileRequest);
}
}
示例15: outsync
void
outsync ()
{
if (!alone_ && ++silence_period_ >= Protocol::FATAL_SILENCE_FRAME)
{
// cerr << "Silence period has been passed." << endl;
// cerr << "Decalring the node failed." << endl;
throw Failed ();
}
}