本文整理汇总了C++中setErrorCode函数的典型用法代码示例。如果您正苦于以下问题:C++ setErrorCode函数的具体用法?C++ setErrorCode怎么用?C++ setErrorCode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setErrorCode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setErrorNoun
void SkAnimateMaker::setScriptError(const SkScriptEngine& engine) {
SkString errorString;
#ifdef SK_DEBUG
engine.getErrorString(&errorString);
#endif
setErrorNoun(errorString);
setErrorCode(SkDisplayXMLParserError::kErrorInScript);
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:8,代码来源:SkAnimateMaker.cpp
示例17: sizeof
bool
FileLogHandler::createNewFile()
{
bool rc = true;
int fileNo = 1;
char newName[PATH_MAX];
time_t newMtime, preMtime = 0;
do
{
if (fileNo >= m_maxNoFiles)
{
fileNo = 1;
BaseString::snprintf(newName, sizeof(newName),
"%s.%d", m_pLogFile->getName(), fileNo);
break;
}
BaseString::snprintf(newName, sizeof(newName),
"%s.%d", m_pLogFile->getName(), fileNo++);
newMtime = File_class::mtime(newName);
if (newMtime < preMtime)
{
break;
}
else
{
preMtime = newMtime;
}
} while (File_class::exists(newName));
m_pLogFile->close();
if (!File_class::rename(m_pLogFile->getName(), newName))
{
setErrorCode(errno);
rc = false;
}
// Open again
if (!m_pLogFile->open())
{
setErrorCode(errno);
rc = false;
}
return rc;
}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:46,代码来源:FileLogHandler.cpp
示例18: setErrorCode
int
NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){
NdbApiSignal* tSignal;
theStatus = Init;
theError.code = 0;
theErrorLine = 1;
m_currentTable = m_accessTable = tab;
theNdbCon = myConnection;
for (Uint32 i=0; i<NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; i++)
for (int j=0; j<3; j++)
theTupleKeyDefined[i][j] = 0;
theFirstATTRINFO = NULL;
theCurrentATTRINFO = NULL;
theLastKEYINFO = NULL;
theTupKeyLen = 0;
theNoOfTupKeyLeft = tab->getNoOfPrimaryKeys();
theTotalCurrAI_Len = 0;
theAI_LenInCurrAI = 0;
theStartIndicator = 0;
theCommitIndicator = 0;
theSimpleIndicator = 0;
theDirtyIndicator = 0;
theInterpretIndicator = 0;
theDistrKeyIndicator_ = 0;
theScanInfo = 0;
theTotalNrOfKeyWordInSignal = 8;
theMagicNumber = 0xABCDEF01;
theBlobList = NULL;
m_abortOption = -1;
m_noErrorPropagation = false;
m_no_disk_flag = 1;
tSignal = theNdb->getSignal();
if (tSignal == NULL)
{
setErrorCode(4000);
return -1;
}
theTCREQ = tSignal;
theTCREQ->setSignal(m_tcReqGSN);
theAI_LenInCurrAI = 20;
TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());
tcKeyReq->scanInfo = 0;
theKEYINFOptr = &tcKeyReq->keyInfo[0];
theATTRINFOptr = &tcKeyReq->attrInfo[0];
if (theReceiver.init(NdbReceiver::NDB_OPERATION, this))
{
// theReceiver sets the error code of its owner
return -1;
}
return 0;
}
开发者ID:A-eolus,项目名称:mysql,代码行数:58,代码来源:NdbOperation.cpp
示例19: setErrorCode
void LitResLoginDataParser::processTag(const std::string &tag) {
if (TAG_AUTHORIZATION_FAILED == tag) {
setErrorCode(NetworkErrors::ERROR_AUTHENTICATION_FAILED);
} else if (TAG_AUTHORIZATION_OK == tag) {
myFirstName = attributes()["first-name"];
myLastName = attributes()["first-name"];
mySid = attributes()["sid"];
}
}
开发者ID:ALEXGUOQ,项目名称:FBReader,代码行数:9,代码来源:LitResAuthenticationDataParser.cpp
示例20: QUrl
void WeatherDataSource::requestMoreDataFromNetwork(const QString region, const QString city,
const QString date, bool requestOlderItems)
{
// Only request data if there is currently no request being done.
if (mReply == 0) {
int dayOffset = 0;
QString encodedCity = QUrl(city).toEncoded();
QString encodedRegion = QUrl(region).toEncoded();
QUrl path = AppSettings::prepareServerUrl("resources/cities/" + encodedRegion + "/" + encodedCity, true);
// An empty date string mean request data with 0 days offset.
if (!date.isEmpty()) {
// Server requests is made with an offset as compared to today
QDate today = QDate::currentDate();
QDate compareDate = QDate::fromString(date, "yyyy-MM-dd");
dayOffset = compareDate.daysTo(today);
if (requestOlderItems) {
// Add one to day offset to begin at the next date after the "date" parameter.
dayOffset += 1;
} else {
// For newer items than date we need to know how many items are set to be requested each time.
uint chunkSize = AppSettings::loadSize();
dayOffset -= chunkSize;
if (dayOffset <= 0) {
// A negative offset means future data, which is not possible, we have to
// adjust the chunksize and set the dayOffset to 0 i.e. today.
chunkSize = chunkSize + dayOffset;
dayOffset = 0;
if (chunkSize == 0) {
// If the adjusted chunk size become 0, all data up to current date has been received and we are done.
emit noMoreWeather();
return;
}
// Request a new path with the custom chunksize.
path = AppSettings::prepareServerUrl("resources/cities/" + encodedRegion + "/" + encodedCity, true, chunkSize);
}
}
}
// Add the offset for the server request, corresponds to from which day in the pas the request is made.
path.addQueryItem("start", QString("%1").arg(dayOffset));
// Reset the error code.
setErrorCode(WeatherError::NoError);
qDebug() << "GET " << path.toString();
mReply = mAccessManager.get(QNetworkRequest(path));
// Connect to the reply finished signal to httpFinsihed() Slot function.
connect(mReply, SIGNAL(finished()), this, SLOT(onHttpFinished()));
mCursor.index = dayOffset;
}
}
开发者ID:BBKeeper,项目名称:Presentations,代码行数:57,代码来源:weatherdatasource.cpp
注:本文中的setErrorCode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论