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


C++ HasError函数代码示例

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


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


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