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


C++ setErrorCode函数代码示例

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


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

示例1: programRange

//! Program a range of flash from buffer
//!
//! Returns an error if the security location is to be programmed
//! to permanently lock the device
//!
void programRange(FlashData_t *flashData) {
   FlashController *controller = flashData->controller;
   uint32_t         address    = flashData->address;
   const uint32_t  *data       = flashData->data;
   uint32_t         numWords   = flashData->size/4;
   int              rc         = FLASH_ERR_OK;
   
   if ((flashData->flags&DO_PROGRAM_RANGE) == 0) {
      return;
   }
   if ((address & 0x03) != 0) {
      setErrorCode(FLASH_ERR_ILLEGAL_PARAMS);
   }
   // Program words
   while (numWords-- > 0) {
      if (address == (NV_FSEC_ADDRESS&~3)) {
         // Check for permanent secure value
         if ((*data & (FTFL_FSEC_MEEN_MASK)) == (FTFL_FSEC_MEEN_DISABLE)) {
            setErrorCode(FLASH_ERR_ILLEGAL_SECURITY);
         }
      }
      controller->fccob0_3 = (F_PGM4 << 24) | address;
      controller->fccob4_7 = *data;
      rc = executeCommand(controller);
      if (rc != FLASH_ERR_OK) {
         setErrorCode(rc);
      }
      address += 4;
      data++;
   }
   flashData->flags &= ~DO_PROGRAM_RANGE;
}
开发者ID:qiaozhou,项目名称:usbdm-flash-routines,代码行数:37,代码来源:main.c

示例2: entry

//! Main C entry point
//! 
//! Assumes ramBuffer is set up beforehand
//!
void entry(void) {
   FlashData_t *flashData;  // Handle on programming data
   
   // Disable COP
   *(gFlashProgramHeader.soptAddress+0x0A) = 0x00;
   
   // Handle on programming data
   flashData = gFlashProgramHeader.flashData;

   // Indicate not complete
   flashData->flags &= ~IS_COMPLETE;
   
   // No errors so far
   flashData->errorCode = FLASH_ERR_OK;
   
   if (flashData->controller == NULL) {
      setErrorCode(FLASH_ERR_ILLEGAL_PARAMS);
   }
   // Clear invalid/unused address bits
   // A23 is used for Flash block number
   flashData->address &= 0x008FFFFFUL;
   
   initFlash(flashData);
   eraseFlashBlock(flashData);
   programPartition(flashData) ;
   eraseRange(flashData);
   blankCheckRange(flashData);
   programRange(flashData);
   verifyRange(flashData);
   
   // Indicate completed
   setErrorCode(FLASH_ERR_OK);
}
开发者ID:qiaozhou,项目名称:usbdm-flash-routines,代码行数:37,代码来源:main.c

示例3: blankCheckRange

//! Check that a range of flash is blank (=0xFFFF)
//!
void blankCheckRange(FlashData_t *flashData) {
   static const uint32_t  elementSize = 4; // Size of element verified
   FlashController       *controller  = flashData->controller;
   uint32_t               address     = flashData->address;
   uint32_t               numElements = (flashData->size+elementSize-1)/elementSize;

   if ((flashData->flags&DO_BLANK_CHECK_RANGE) == 0) {
      return;
   }
   if ((address & (elementSize-1)) != 0) {
      setErrorCode(FLASH_ERR_ILLEGAL_PARAMS);
   }
   while (numElements>0) {
      int rc;
      uint16_t num = 0x8000;
      if (num>numElements) {
         num = (uint16_t)numElements;
      }
      controller->fccob0_3 = (F_RD1SEC << 24) | address;
      controller->fccob4_7 = (num <<16) | (F_USER_MARGIN<<8) | 0;
      rc = executeCommand(controller);
      if (rc != FLASH_ERR_OK) {
         if (rc == FLASH_ERR_PROG_MGSTAT0) {
            rc = FLASH_ERR_ERASE_FAILED;
         }
//         flashData->frequency = controller->fccob0_3; // debug
//         flashData->address   = controller->fccob4_7;
         setErrorCode(rc);         
      }
      numElements -= num;
      address     += elementSize*num;
   }
   flashData->flags &= ~DO_BLANK_CHECK_RANGE;
}
开发者ID:qiaozhou,项目名称:usbdm-flash-routines,代码行数:36,代码来源:main.c

示例4: confparse

ConfigErrorCode Config::parseStream(FILE *stream)
{
   confin = stream;
   confdebug = _debug ? 1 : 0;
   int status = confparse(this);
   if (status != 0)
      return setErrorCode(kConfigParseStreamErr);
   return setErrorCode(kConfigNoErr);
}
开发者ID:CreativeInquiry,项目名称:RTcmix,代码行数:9,代码来源:Config.cpp

示例5: findDictItem

ConfigErrorCode Config::getValue(const char *key, char *& value)
{
   DictItem *item = findDictItem(key);
   if (item == NULL)
      return setErrorCode(kConfigNoValueForKey);
   value = item->getStringValue();
   if (item->lastError() != kDictNoErr)
      return setErrorCode(kConfigValueWrongType);
   return setErrorCode(kConfigNoErr);
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:RTCmix,代码行数:10,代码来源:Config.cpp

示例6: setErrorCode

bool	HttpClient::doMultipartPost()
{
	//如果有Fields段 已经写入了body内  直接发送
	if (!sendBody())
	{
		setErrorCode(HTTPERROR_TRANSPORT);
		return false;
	}

	//发送文件
	const std::vector<HttpFile*>& post_files	=	_request->getFiles();
	const std::string&	boundary				=	_request->getBoundary();
	for (size_t i = 0; i < post_files.size(); i++)
	{
		const std::string name		=	post_files[i]->_name;
		IHttpPostFile* post_file	=	post_files[i]->_post_file;
		std::string file_header		=  "--" + boundary + "\r\n"
										"content-disposition: form-data; name=\"" + name + "\"; filename=\"" + 
										post_file->getFilename() + "\"\r\n" +
										"content-type: " + post_file->getContentType() + "\r\n" +
										"\r\n";

		bool send_file_header		 = _proxy_socket->writeAll(file_header.c_str(),file_header.size());
		if (!send_file_header)
		{
			setErrorCode(HTTPERROR_TRANSPORT);
			return false;
		}

		bool post_file_success = uploadFile(post_file);
		if (!post_file_success)
		{
			setErrorCode(HTTPERROR_TRANSPORT);
			return false;
		}


		std::string file_tailer = "\r\n";
		bool send_file_tailer	 = _proxy_socket->writeAll(file_tailer.c_str(),file_tailer.size());
		if (!send_file_tailer)
		{
			setErrorCode(HTTPERROR_TRANSPORT);
			return false;
		}
	}

	//发送boundary结束标记
	std::string post_tailer		= "--" + boundary + "--\r\n";
	bool send_post_tailer		= _proxy_socket->writeAll(post_tailer.c_str(),post_tailer.size());
	
	return send_post_tailer ? getResponse() : setErrorCode(HTTPERROR_TRANSPORT) , false;
	
}
开发者ID:DTTKillASmallScale,项目名称:httpclient,代码行数:53,代码来源:http_client.cpp

示例7: defined

ConfigErrorCode Config::parseStream(FILE *stream)
{
   confin = stream;
   confdebug = _debug ? 1 : 0;
#if defined(OF_ANDROID) || defined(OPENFRAMEWORKS)
	int status = 0;
#else
   int status = confparse(this);
#endif
   if (status != 0)
      return setErrorCode(kConfigParseStreamErr);
   return setErrorCode(kConfigNoErr);
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:RTCmix,代码行数:13,代码来源:Config.cpp

示例8: restoreActiveShader

/*
 *	SHM IN:
 *		fname    : *
 *		operation: DBG_GET_SHADER_CODE
 *	SHM out:
 *		fname    : *
 *		result   : DBG_ERROR_CODE
 */
void restoreActiveShader(void)
{
	int error;

	ORIG_GL(glUseProgram)(g.storedShader.programHandle);
	error = glError();
	if (error) {
		setErrorCode(error);
		return;
	}
	freeShaderProgram(&g.storedShader);
	setErrorCode(DBG_NO_ERROR);
}
开发者ID:Teybeo,项目名称:GLSL-Debugger,代码行数:21,代码来源:shader.c

示例9: attributes

void LitResPasswordRecoveryDataParser::processTag(const std::string &tag) {
	if (TAG_PASSWORD_RECOVERY_FAILED == tag) {
		const std::string &error = attributes()["error"];
		if ("1" == error) {
			setErrorCode(NetworkErrors::ERROR_NO_USER_EMAIL);
		} else if ("2" == error) {
			setErrorCode(NetworkErrors::ERROR_EMAIL_WAS_NOT_SPECIFIED);
		} else {
			setErrorCode(NetworkErrors::ERROR_INTERNAL);
		}		
	} else if (TAG_PASSWORD_RECOVERY_OK == tag) {
		// NOP
	}
}
开发者ID:ALEXGUOQ,项目名称:FBReader,代码行数:14,代码来源:LitResAuthenticationDataParser.cpp

示例10: Exception

CameraException::CameraException(const error_code aCode,
				const string& aFile,
				const string& aFunc,
				int aLine)
			: Exception("",aFile,aFunc,aLine){
	setErrorCode(aCode);
}
开发者ID:master0567,项目名称:MyLibrarys,代码行数:7,代码来源:CameraException.cpp

示例11: while

bool	HttpClient::downloadHeader(std::string& body_header)
{
	body_header.clear();
	char buff[kmax_buffer_size] = {0};
	std::string	header;
	bool complete = false;
	while(!complete)
	{
		int ret = _proxy_socket->read(buff,kmax_buffer_size);
		if (ret <= 0)
		{
			setErrorCode(HTTPERROR_TRANSPORT);
			break;
		}
		header.append(buff,ret);					//因为Header往往很短,基本一次可以收完
		size_t end_index = header.find("\r\n\r\n");	//所以也不需要计算偏移来提高搜索速度
		if (end_index != std::string::npos)
		{
			complete			= true;
			size_t length		= header.length() ;
			body_header			= header.substr(end_index + 4,length - end_index - 4);
			_response->setHeader(header.substr(0,end_index + 4));
		}
	}
	return complete;
}
开发者ID:DTTKillASmallScale,项目名称:httpclient,代码行数:26,代码来源:http_client.cpp

示例12: setErrorCode

DirException::DirException(const error_code aCode,
				const string& aPath,
				const string& aFile,
				const string& aFunc)
				:Exception("",aFile,aFunc){
	setErrorCode(aCode,aPath);
}
开发者ID:master0567,项目名称:Procon2013,代码行数:7,代码来源:DirException.cpp

示例13: eraseRange

//! Erase a range of flash
//!
void eraseRange(FlashData_t *flashData) {
   FlashController *controller = flashData->controller;
   uint32_t address     = flashData->address;
   uint32_t endAddress  = address + flashData->size - 1; // Inclusive
   uint32_t pageMask    = flashData->sectorSize-1U;
   int      rc;
   
   if ((flashData->flags&DO_ERASE_RANGE) == 0) {
      return;
   }
   // Check for empty range before block rounding
   if (flashData->size == 0) {
      return;
   }
   // Round start address to start of block (inclusive)
      address &= ~pageMask;
   // Round end address to end of block (inclusive)
      endAddress |= pageMask;
   
   // Erase each block/page
   while (address <= endAddress) {
      controller->fccob0_3 = (F_ERSSCR << 24) | address;
      rc = executeCommand(controller);
      if (rc != FLASH_ERR_OK) {
         if (rc == FLASH_ERR_PROG_MGSTAT0) {
            rc = FLASH_ERR_ERASE_FAILED;
         }
         setErrorCode(rc);         
      }
      // Advance to start of next block
      address += flashData->sectorSize;
   }
   flashData->flags &= ~DO_ERASE_RANGE;
}
开发者ID:qiaozhou,项目名称:usbdm-flash-routines,代码行数:36,代码来源:main.c

示例14: fopen

ConfigErrorCode Config::parseFile(const char *fileName)
{
   FILE *stream = fopen(fileName, "r");
   if (stream == NULL) {
      if (errno == ENOENT || errno == ENOTDIR)
         return setErrorCode(kConfigFileMissingErr);
      else if (errno == EACCES)
         return setErrorCode(kConfigFileNoAccessErr);
      return setErrorCode(kConfigOpenFileErr);
   }
   ConfigErrorCode status = parseStream(stream);
   if (status == kConfigParseStreamErr)
      status = setErrorCode(kConfigParseFileErr);
   fclose(stream);
   return status;
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:RTCmix,代码行数:16,代码来源:Config.cpp

示例15: transferredSourceStats_

TransferReport::TransferReport(
    std::vector<TransferStats>& transferredSourceStats,
    std::vector<TransferStats>& failedSourceStats,
    std::vector<TransferStats>& threadStats,
    std::vector<std::string>& failedDirectories, double totalTime,
    int64_t totalFileSize, int64_t numDiscoveredFiles)
    : transferredSourceStats_(std::move(transferredSourceStats)),
      failedSourceStats_(std::move(failedSourceStats)),
      threadStats_(std::move(threadStats)),
      failedDirectories_(std::move(failedDirectories)),
      totalTime_(totalTime),
      totalFileSize_(totalFileSize) {
  for (const auto& stats : threadStats_) {
    summary_ += stats;
  }
  ErrorCode summaryErrorCode = summary_.getErrorCode();
  bool atLeastOneOk = false;
  for (auto& stats : threadStats_) {
    if (stats.getErrorCode() == OK) {
      atLeastOneOk = true;
      break;
    }
  }
  LOG(INFO) << "Error code summary " << errorCodeToStr(summaryErrorCode);
  // none of the files or directories failed
  bool possiblyOk = true;
  if (!failedDirectories_.empty()) {
    possiblyOk = false;
    summaryErrorCode =
        getMoreInterestingError(summaryErrorCode, BYTE_SOURCE_READ_ERROR);
  }
  for (const auto& sourceStat : failedSourceStats_) {
    possiblyOk = false;
    summaryErrorCode =
        getMoreInterestingError(summaryErrorCode, sourceStat.getErrorCode());
  }
  if (possiblyOk && atLeastOneOk) {
    if (summaryErrorCode != OK) {
      LOG(WARNING) << "WDT successfully recovered from error "
                   << errorCodeToStr(summaryErrorCode);
    }
    summaryErrorCode = OK;
  }
  setErrorCode(summaryErrorCode);

  if (summary_.getEffectiveDataBytes() != totalFileSize_) {
    // sender did not send all the bytes
    LOG(INFO) << "Could not send all the bytes " << totalFileSize_ << " "
              << summary_.getEffectiveDataBytes();
    WDT_CHECK(summaryErrorCode != OK)
        << "BUG: All threads OK yet sized based error detected";
  }
  std::set<std::string> failedFilesSet;
  for (auto& stats : failedSourceStats_) {
    failedFilesSet.insert(stats.getId());
  }
  int64_t numTransferredFiles = numDiscoveredFiles - failedFilesSet.size();
  summary_.setNumFiles(numTransferredFiles);
}
开发者ID:ffmpegd,项目名称:wdt,代码行数:59,代码来源:Reporting.cpp


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