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

C++ HasError函数代码示例

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

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



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

示例1: BeforeFinishInternal

void
Decoder::CompleteDecode()
{
  // Implementation-specific finalization
  BeforeFinishInternal();
  if (!HasError()) {
    FinishInternal();
  } else {
    FinishWithErrorInternal();
  }

  // If the implementation left us mid-frame, finish that up.
  if (mInFrame && !HasError()) {
    PostFrameStop();
  }

  // If PostDecodeDone() has not been called, and this decoder wasn't aborted
  // early because of low-memory conditions or losing a race with another
  // decoder, we need to send teardown notifications (and report an error to the
  // console later).
  if (!IsMetadataDecode() && !mDecodeDone && !WasAborted()) {
    mShouldReportError = true;

    // If we only have a data error, we're usable if we have at least one
    // complete frame.
    if (!HasDecoderError() && GetCompleteFrameCount() > 0) {
      // We're usable, so do exactly what we should have when the decoder
      // completed.

      // Not writing to the entire frame may have left us transparent.
      PostHasTransparency();

      if (mInFrame) {
        PostFrameStop();
      }
      PostDecodeDone();
    } else {
      // We're not usable. Record some final progress indicating the error.
      if (!IsMetadataDecode()) {
        mProgress |= FLAG_DECODE_COMPLETE;
      }
      mProgress |= FLAG_HAS_ERROR;
    }
  }

  if (mDecodeDone && !IsMetadataDecode()) {
    MOZ_ASSERT(HasError() || mCurrentFrame, "Should have an error or a frame");

    // If this image wasn't animated and isn't a transient image, mark its frame
    // as optimizable. We don't support optimizing animated images and
    // optimizing transient images isn't worth it.
    if (!HasAnimation() &&
        !(mDecoderFlags & DecoderFlags::IMAGE_IS_TRANSIENT) &&
        mCurrentFrame) {
      mCurrentFrame->SetOptimizable();
    }
  }
}
开发者ID:TheGuy82,项目名称:gecko-dev,代码行数:58,代码来源:Decoder.cpp


示例2: FinishInternal

void
Decoder::FinishSharedDecoder()
{
  if (!HasError()) {
    FinishInternal();
  }
}
开发者ID:ThinkerYzu,项目名称:mozilla-central,代码行数:7,代码来源:Decoder.cpp


示例3: AddSrUserError

bool CSrFile::Read (void* pBuffer, const int Size) {
  size_t Result;
  size_t uSize = (size_t) Size;

	/* Check valid input and state */
  if (!IsOpen()) return AddSrUserError(SRERR_USER_NOTOPEN);
  if (Size == 0) return (true);
  if (pBuffer == NULL) {
    return AddSrUserError(SRERR_USER_NULL, "File input buffer cannot be NULL!");
  }
  if (Size < 0) return AddSrUserError(SRERR_USER_BADINPUT, "File input buffer size must be positive!");

	/* Check for overflows */
  if ((int)uSize != Size) return AddSrUserError(SRERR_USER_OVERFLOW, "Requested file input was too large!");

	/* Attempt to input buffer */
  Result = fread(pBuffer, 1, uSize, m_pFile);

  if (Result != uSize) {

    if (HasError())
      return AddSrSystemError("Failed to read data from file! Only %u of %d bytes input.", Result, Size);
    else 
      return AddSrUserError(SRERR_USER_EOF);
   }

  return (true);
 }
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:28,代码来源:srfile.cpp


示例4: MOZ_ASSERT

void
FileSystemTaskBase::Start()
{
  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");

  if (HasError()) {
    HandlerCallback();
    return;
  }

  if (FileSystemUtils::IsParentProcess()) {
    // Run in parent process.
    // Start worker thread.
    nsCOMPtr<nsIEventTarget> target
      = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
    NS_ASSERTION(target, "Must have stream transport service.");
    target->Dispatch(this, NS_DISPATCH_NORMAL);
    return;
  }

  // Run in child process.
  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
  if (!filesystem) {
    return;
  }

  // Retain a reference so the task object isn't deleted without IPDL's
  // knowledge. The reference will be released by
  // mozilla::dom::ContentChild::DeallocPFileSystemRequestChild.
  NS_ADDREF_THIS();
  ContentChild::GetSingleton()->SendPFileSystemRequestConstructor(this,
    GetRequestParams(filesystem->ToString()));
}
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:33,代码来源:FileSystemTaskBase.cpp


示例5: Read

  bool FileScanner::Read(bool& boolean)
  {
    if (HasError()) {
      return false;
    }

#if defined(HAVE_MMAP) || defined(__WIN32__) || defined(WIN32)
    if (buffer!=NULL) {
      if (offset>=size) {
        log.Error() << "Cannot read bool beyond end of file'"  << filename << "'";
        hasError=true;
        return false;
      }

      boolean=buffer[offset]!=0;

      offset++;

      return true;
    }
#endif

    char value;

    hasError=fread(&value,1,1,file)!=1;

    if (hasError) {
      log.Error() << "Cannot read bool beyond end of file'"  << filename << "'";
      return false;
    }

    boolean=value!=0;

    return true;
  }
开发者ID:LamaUrbain,项目名称:libosmscout,代码行数:35,代码来源:FileScanner.cpp


示例6: GetStatistic

Result<ExitCode> SelfTest::Run(const Settings& settings) const
{	
	auto statisticResult = GetStatistic(settings);
	if (statisticResult.HasError())
	{
		return statisticResult.GetError();
	}

	auto statistic = statisticResult.GetResultValue();
	if (statistic.IsService())
	{	
		if (!statistic.HasAdministrativePrivileges())
		{
			return EXIT_CODE_NO_ADMIN;
		}

		if (!statistic.HasSeAssignPrimaryTokenPrivilege())
		{
			return EXIT_CODE_NO_ASSIGN_PRIMARY_TOKEN_PRIV;
		}

		if (!statistic.HasSeTcbPrivilegePrivilege())
		{
			return EXIT_CODE_NO_TCB_PRIV;
		}
	}
	
	return Is64OS() ? EXIT_CODE_READY_FOR_64 : EXIT_CODE_READY_FOR_32;
}
开发者ID:JetBrains,项目名称:runAs,代码行数:29,代码来源:SelfTest.cpp


示例7: SetPos

  bool FileScanner::SetPos(FileOffset pos)
  {
    if (HasError()) {
      return false;
    }

#if defined(HAVE_MMAP) || defined(__WIN32__) || defined(WIN32)
    if (buffer!=NULL) {
      if (pos>=size) {
        return false;
      }

      offset=pos;

      return true;
    }
#endif

    clearerr(file);

#if defined(HAVE_FSEEKO)
    hasError=fseeko(file,(off_t)pos,SEEK_SET)!=0;
#else
    hasError=fseek(file,pos,SEEK_SET)!=0;
#endif

    if (hasError) {
      log.Error() << "Cannot set file pos for file '" << filename << "':" << strerror(errno);
    }

    return !hasError;
  }
开发者ID:LamaUrbain,项目名称:libosmscout,代码行数:32,代码来源:FileScanner.cpp


示例8: while

/*===========================================================================
 *
 * Class CSrFile Method - bool ReadLine (Buffer);
 *
 * Inputs a line of text from a text file.
 *
 *=========================================================================*/
bool CSrFile::ReadLine (CSString& Buffer) {
  byte    Value;
  size_t  Result;
  //SSCHAR  TempBuffer[256];
  //SSCHAR* pResult;

	/* Set some initial string size */
  Buffer.SetSizeEmpty(64);
  //Buffer.Empty();

  while (!IsEOF()) {
 
     		/* Attempt to input buffer */
    Result = fread(&Value, 1, 1, m_pFile);

    if (Result != 1) {
      if (HasError()) return AddSrSystemError("Failed to read byte from file!");
      return (true);
    }

    if (Value == '\n') {
      ++m_LineCount;
      return (true);
     }
    else {
      Buffer += Value;
     }
   }

  return (true);
}
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:38,代码来源:srfile.cpp


示例9: ReadNumber

  bool FileScanner::ReadNumber(int16_t& number)
  {
    if (HasError()) {
      return false;
    }

    number=0;

#if defined(HAVE_MMAP) || defined(__WIN32__) || defined(WIN32)
    if (buffer!=NULL) {
      if (offset>=size) {
        log.Error() << "Cannot read compressed int16_t beyond end of file'"  << filename << "'";
        hasError=true;
        return false;
      }

      unsigned int bytes=DecodeNumber(&buffer[offset],number);

      offset+=bytes;

      return true;
    }
#endif

    char buffer;

    if (fread(&buffer,1,1,file)!=1) {
      log.Error() << "Cannot read compressed int16_t beyond end of file'"  << filename << "'";
      hasError=true;
      return false;
    }

    typedef int16_t num_t;

    unsigned int shift=0;
    unsigned int nextShift=0;

    // negative form
    if ((buffer & 0x01)!=0) {
      char val=(buffer & 0x7e) >> 1;

      number=-1;
      nextShift=6;

      while ((buffer & 0x80)!=0) {

        if (fread(&buffer,1,1,file)!=1) {
          log.Error() << "Cannot read compressed int16_t beyond end of file'"  << filename << "'";
          hasError=true;
          return false;
        }

        number^=(val << shift);
        val=buffer & 0x7f;
        shift=nextShift;
        nextShift+=7;
      }

      number^=static_cast<num_t>(val) << shift;
    }
开发者ID:LamaUrbain,项目名称:libosmscout,代码行数:60,代码来源:FileScanner.cpp


示例10: HandleRecv

void NetworkConnection::HandleRecv(const boost::system::error_code & error, int32_t actual_bytes)
{
	if (error || HasError() || m_service->HasStopped())
	{
        if (m_socket.is_open())
        {
            if (error == boost::asio::error::eof) //we got disconnected on the client side
            {
                OnError(error);
                //Disconnect();
            }
            else
                StartError(error);
        }
	}
	else
	{
		m_recv_buffer.resize(actual_bytes);
		OnRecv(m_recv_buffer);
		m_pending_recvs.pop_front();
		if (!m_pending_recvs.empty())
		{
			StartRecv(m_pending_recvs.front());
		}
	}
}
开发者ID:primetime00,项目名称:chromecontroller,代码行数:26,代码来源:NetworkConnection.cpp


示例11: MOZ_ASSERT

void
GetFileOrDirectoryTask::HandlerCallback()
{
  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
  if (mFileSystem->IsShutdown()) {
    mPromise = nullptr;
    return;
  }

  if (HasError()) {
    nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
      mErrorValue);
    mPromise->MaybeRejectBrokenly(domError);
    mPromise = nullptr;
    return;
  }

  if (mIsDirectory) {
    nsRefPtr<Directory> dir = new Directory(mFileSystem, mTargetRealPath);
    mPromise->MaybeResolve(dir);
    mPromise = nullptr;
    return;
  }

  nsRefPtr<File> file = new File(mFileSystem->GetWindow(), mTargetFileImpl);
  mPromise->MaybeResolve(file);
  mPromise = nullptr;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:28,代码来源:GetFileOrDirectoryTask.cpp


示例12: MOZ_ASSERT

void
Decoder::FinishSharedDecoder()
{
  MOZ_ASSERT(NS_IsMainThread());

  if (!HasError()) {
    FinishInternal();
  }
}
开发者ID:afabbro,项目名称:gecko-dev,代码行数:9,代码来源:Decoder.cpp


示例13: MOZ_ASSERT

nsresult
Decoder::Decode(IResumable* aOnResume)
{
  MOZ_ASSERT(mInitialized, "Should be initialized here");
  MOZ_ASSERT(mIterator, "Should have a SourceBufferIterator");

  // If no IResumable was provided, default to |this|.
  IResumable* onResume = aOnResume ? aOnResume : this;

  // We keep decoding chunks until the decode completes or there are no more
  // chunks available.
  while (!GetDecodeDone() && !HasError()) {
    auto newState = mIterator->AdvanceOrScheduleResume(onResume);

    if (newState == SourceBufferIterator::WAITING) {
      // We can't continue because the rest of the data hasn't arrived from the
      // network yet. We don't have to do anything special; the
      // SourceBufferIterator will ensure that Decode() gets called again on a
      // DecodePool thread when more data is available.
      return NS_OK;
    }

    if (newState == SourceBufferIterator::COMPLETE) {
      mDataDone = true;

      nsresult finalStatus = mIterator->CompletionStatus();
      if (NS_FAILED(finalStatus)) {
        PostDataError();
      }

      CompleteDecode();
      return finalStatus;
    }

    MOZ_ASSERT(newState == SourceBufferIterator::READY);

    Write(mIterator->Data(), mIterator->Length());
  }

  CompleteDecode();
  return HasError() ? NS_ERROR_FAILURE : NS_OK;
}
开发者ID:TheGuy82,项目名称:gecko-dev,代码行数:42,代码来源:Decoder.cpp


示例14: HandleTimer

void Acceptor::HandleTimer( const boost::system::error_code & error )
{
	if( error || HasError() || m_hive->HasStopped() )
	{
		StartError( error );
	}
	else
	{
		OnTimer( boost::posix_time::microsec_clock::local_time() - m_last_time );
		StartTimer();
	}
}
开发者ID:nannanwuhui,项目名称:C-,代码行数:12,代码来源:network.cpp


示例15: GetEnvironmentWithSpecifiedByCaller

Result<Environment> ProcessAsUser::GetEnvironment(const Settings& settings, Handle& userToken, const InheritanceMode inheritanceMode, Trace& trace)
{
	auto callingProcessEnvironmentResult = Environment::CreateForCurrentProcess(trace);
	if(callingProcessEnvironmentResult.HasError())
	{
		return callingProcessEnvironmentResult;
	}

	if (inheritanceMode == INHERITANCE_MODE_ON)
	{
		return GetEnvironmentWithSpecifiedByCaller(
			settings, 
			callingProcessEnvironmentResult.GetResultValue(), 
			trace);
	}

	// Get target user's environment
	auto targetUserEnvironmentResult = Environment::CreateForUser(userToken, false, trace);
	if (targetUserEnvironmentResult.HasError())
	{
		return targetUserEnvironmentResult;
	}

	if (inheritanceMode == INHERITANCE_MODE_OFF)
	{
		return GetEnvironmentWithSpecifiedByCaller(
			settings, 
			targetUserEnvironmentResult.GetResultValue(), 
			trace);
	}
	
	return GetEnvironmentWithSpecifiedByCaller(
		settings, 
		Environment::Override(
			callingProcessEnvironmentResult.GetResultValue(), 
			targetUserEnvironmentResult.GetResultValue(), 
			trace),
		trace);
}
开发者ID:JetBrains,项目名称:runAs,代码行数:39,代码来源:ProcessAsUser.cpp


示例16: HandleSend

void Connection::HandleSend( const boost::system::error_code &  error, std::list< std::vector< uint8_t > >::iterator itr )
{
	if( error || HasError() || m_hive->HasStopped() )
	{
		StartError( error );
	}
	else
	{
		OnSend( *itr );
		m_pending_sends.erase( itr );
		StartSend();
	}
}
开发者ID:nannanwuhui,项目名称:C-,代码行数:13,代码来源:network.cpp


示例17: msg

void
Decoder::Finish()
{
  // Implementation-specific finalization
  if (!HasError())
    FinishInternal();

  // If the implementation left us mid-frame, finish that up.
  if (mInFrame && !HasDecoderError())
    PostFrameStop();

  // If PostDecodeDone() has not been called, we need to sent teardown
  // notifications.
  if (!IsSizeDecode() && !mDecodeDone) {

    // Log data errors to the error console
    nsCOMPtr<nsIConsoleService> consoleService =
      do_GetService(NS_CONSOLESERVICE_CONTRACTID);
    nsCOMPtr<nsIScriptError2> errorObject =
      do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);

    if (consoleService && errorObject && !HasDecoderError()) {
      nsAutoString msg(NS_LITERAL_STRING("Image corrupt or truncated: ") +
                       NS_ConvertASCIItoUTF16(mImage->GetURIString()));

      errorObject->InitWithWindowID
        (msg.get(),
         NS_ConvertUTF8toUTF16(mImage->GetURIString()).get(),
         nsnull,
         0, 0, nsIScriptError::errorFlag,
         "Image", mImage->InnerWindowID()
         );
  
      nsCOMPtr<nsIScriptError> error = do_QueryInterface(errorObject);
      consoleService->LogMessage(error);
    }

    // If we only have a data error, see if things are worth salvaging
    bool salvage = !HasDecoderError() && mImage->GetNumFrames();

    // If we're salvaging, say we finished decoding
    if (salvage)
      mImage->DecodingComplete();

    // Fire teardown notifications
    if (mObserver) {
      mObserver->OnStopContainer(nsnull, mImage);
      mObserver->OnStopDecode(nsnull, salvage ? NS_OK : NS_ERROR_FAILURE, nsnull);
    }
  }
}
开发者ID:mbrubeck,项目名称:mozilla-central,代码行数:51,代码来源:Decoder.cpp


示例18: HandleConnect

void Connection::HandleConnect(const boost::system::error_code & error)
{
	if (error || HasError() || m_hive->HasStopped()) {
		StartError(error);
	} 
	else {
		if (m_socket.is_open()) {
			OnConnect(m_socket.remote_endpoint().address().to_string(), m_socket.remote_endpoint().port());
		}
		else {
			StartError(error);
		}
	}
}
开发者ID:miguelangelo78,项目名称:BoostAsio-Net-Wrapper,代码行数:14,代码来源:network_sockapi.cpp


示例19: MOZ_ASSERT

void
GetDirectoryListingTask::HandlerCallback()
{
  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
  if (mFileSystem->IsShutdown()) {
    mPromise = nullptr;
    return;
  }

  if (HasError()) {
    mPromise->MaybeReject(mErrorValue);
    mPromise = nullptr;
    return;
  }

  size_t count = mTargetBlobImpls.Length();

  Sequence<OwningFileOrDirectory> listing;

  if (!listing.SetLength(count, mozilla::fallible_t())) {
    mPromise->MaybeReject(NS_ERROR_FAILURE);
    mPromise = nullptr;
    return;
  }

  for (unsigned i = 0; i < count; i++) {
    if (mTargetBlobImpls[i]->IsDirectory()) {
      nsAutoString name;
      mTargetBlobImpls[i]->GetName(name);
      nsAutoString path(mTargetRealPath);
      path.AppendLiteral(FILESYSTEM_DOM_PATH_SEPARATOR);
      path.Append(name);
#ifdef DEBUG
      if (XRE_IsParentProcess()) {
        nsCOMPtr<nsIFile> file = mFileSystem->GetLocalFile(path);
        bool exist;
        file->Exists(&exist);
        MOZ_ASSERT(exist);
      }
#endif
      listing[i].SetAsDirectory() = new Directory(mFileSystem, path);
    } else {
      listing[i].SetAsFile() = File::Create(mFileSystem->GetWindow(), mTargetBlobImpls[i]);
    }
  }

  mPromise->MaybeResolve(listing);
  mPromise = nullptr;
}
开发者ID:70599,项目名称:Waterfox,代码行数:49,代码来源:GetDirectoryListingTask.cpp


示例20: Stop

Defragment::~Defragment ()
{
    if (!IsDoneYet ())
    {
        Stop ();
        while (!IsDoneYet()  &&  !HasError())
        {
            SetStatusString (L"Waiting for thread to stop ...");
            Sleep (150);
        }
    }

    Volume.Close ();
    return;
}
开发者ID:Strongc,项目名称:reactos,代码行数:15,代码来源:Defragment.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HasEscortState函数代码示例发布时间:2022-05-30
下一篇:
C++ HasCondition函数代码示例发布时间: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