本文整理汇总了C++中HandleError函数的典型用法代码示例。如果您正苦于以下问题:C++ HandleError函数的具体用法?C++ HandleError怎么用?C++ HandleError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HandleError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetOptions
CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory, bool fWipe) {
penv = NULL;
readoptions.verify_checksums = true;
iteroptions.verify_checksums = true;
iteroptions.fill_cache = false;
syncoptions.sync = true;
options = GetOptions(nCacheSize);
options.create_if_missing = true;
if (fMemory) {
penv = leveldb::NewMemEnv(leveldb::Env::Default());
options.env = penv;
} else {
if (fWipe) {
LogPrintf("Wiping LevelDB in %s\n", path.string().c_str());
leveldb::DestroyDB(path.string(), options);
}
boost::filesystem::create_directory(path);
LogPrintf("Opening LevelDB in %s\n", path.string().c_str());
}
leveldb::Status status = leveldb::DB::Open(options, path.string(), &pdb);
HandleError(status);
LogPrintf("Opened LevelDB successfully\n");
}
开发者ID:Soldy,项目名称:lincoin,代码行数:23,代码来源:leveldbwrapper.cpp
示例2: MOZ_ASSERT
nsresult
SourceBuffer::ExpectLength(size_t aExpectedLength)
{
MOZ_ASSERT(aExpectedLength > 0, "Zero expected size?");
MutexAutoLock lock(mMutex);
if (MOZ_UNLIKELY(mStatus)) {
MOZ_ASSERT_UNREACHABLE("ExpectLength after SourceBuffer is complete");
return NS_OK;
}
if (MOZ_UNLIKELY(mChunks.Length() > 0)) {
MOZ_ASSERT_UNREACHABLE("Duplicate or post-Append call to ExpectLength");
return NS_OK;
}
if (MOZ_UNLIKELY(NS_FAILED(AppendChunk(CreateChunk(aExpectedLength))))) {
return HandleError(NS_ERROR_OUT_OF_MEMORY);
}
return NS_OK;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:23,代码来源:SourceBuffer.cpp
示例3: UE_LOG
void FOutputDeviceWindowsError::Serialize( const TCHAR* Msg, ELogVerbosity::Type Verbosity, const class FName& Category )
{
FPlatformMisc::DebugBreak();
if( !GIsCriticalError )
{
const int32 LastError = ::GetLastError();
// First appError.
GIsCriticalError = 1;
TCHAR ErrorBuffer[1024];
ErrorBuffer[0] = 0;
// Windows error.
UE_LOG( LogWindows, Error, TEXT( "Windows GetLastError: %s (%i)" ), FPlatformMisc::GetSystemErrorMessage( ErrorBuffer, 1024, LastError ), LastError );
}
else
{
UE_LOG(LogWindows, Error, TEXT("Error reentered: %s"), Msg );
}
if( GIsGuarded )
{
// Propagate error so structured exception handler can perform necessary work.
#if PLATFORM_EXCEPTIONS_DISABLED
FPlatformMisc::DebugBreak();
#endif
FPlatformMisc::RaiseException( 1 );
}
else
{
// We crashed outside the guarded code (e.g. appExit).
HandleError();
FPlatformMisc::RequestExit( true );
}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:36,代码来源:WindowsPlatformOutputDevices.cpp
示例4: sqlite3Codec
// Encrypt/Decrypt functionality, called by pager.c
void* sqlite3Codec(void *pCodec, void *data, Pgno nPageNum, int nMode)
{
if (pCodec == NULL) //Db not encrypted
return data;
switch(nMode)
{
case 0: // Undo a "case 7" journal file encryption
case 2: // Reload a page
case 3: // Load a page
if (HasReadKey(pCodec))
Decrypt(pCodec, nPageNum, (unsigned char*) data);
break;
case 6: // Encrypt a page for the main database file
if (HasWriteKey(pCodec))
data = Encrypt(pCodec, nPageNum, (unsigned char*) data, 1);
break;
case 7: // Encrypt a page for the journal file
/*
*Under normal circumstances, the readkey is the same as the writekey. However,
*when the database is being rekeyed, the readkey is not the same as the writekey.
*(The writekey is the "destination key" for the rekey operation and the readkey
*is the key the db is currently encrypted with)
*Therefore, for case 7, when the rollback is being written, always encrypt using
*the database's readkey, which is guaranteed to be the same key that was used to
*read and write the original data.
*/
if (HasReadKey(pCodec))
data = Encrypt(pCodec, nPageNum, (unsigned char*) data, 0);
break;
}
HandleError(pCodec);
return data;
}
开发者ID:BenjaminSchiborr,项目名称:safe,代码行数:37,代码来源:codecext.c
示例5: while
void TCPSocket::WriteThread()
{
this->mutex.lock();
while (!this->writeQueue.empty())
{
BytesRef data = this->writeQueue.front();
char* buffer = data->Pointer();
size_t remaining = data->Length();
// Release lock while sending data to avoid blocking write().
this->mutex.unlock();
while (true)
{
try
{
size_t sent = this->socket.sendBytes(buffer, remaining);
if (sent == remaining) break;
buffer += sent;
remaining -= sent;
}
catch (Poco::Exception& e)
{
HandleError(e);
return;
}
}
this->mutex.lock();
this->writeQueue.pop();
}
// Notify listeners we have fully drained the queue.
this->mutex.unlock();
FireEvent("drain");
}
开发者ID:Adimpression,项目名称:TideSDK,代码行数:36,代码来源:tcp_socket.cpp
示例6: find_libdir
void
find_libdir (void)
{
const char searchfile[] = "Colour.pal";
/* default_dir will be something like "C:\\LINCITY1.11" */
const char default_dir[] = "C:\\LINCITY" VERSION;
/* Check 1: environment variable */
_searchenv (searchfile, "LINCITY_HOME", LIBDIR);
if (*LIBDIR != '\0') {
int endofpath_offset = strlen (LIBDIR) - strlen (searchfile) - 1;
LIBDIR[endofpath_offset] = '\0';
return;
}
/* Check 2: default location */
if ((_access (default_dir, 0)) != -1) {
strcpy (LIBDIR, default_dir);
return;
}
/* Finally give up */
HandleError ("Error. Can't find LINCITY_HOME", FATAL);
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:24,代码来源:fileutil.c
示例7: HandleError
BOOL
CUdpCommClient::Push(CUdpPacketNode* pcPktNode)
{
if (pcPktNode->GetRawLen() >= m_ulMaxSndPktLen)
{
HandleError(OCFCLIENT_ERROR_USERDEF, OCFCLIENT_ERROR_USERDEF_CATEGORY_PKTMAXSIZE, 0, pcPktNode->GetRawLen(), pcPktNode->GetRawBuff());
return FALSE;
}
//
Lock();
m_cSndPktList.Add(pcPktNode);
if (TRUE == m_bConnectFlag && FALSE == m_bWouldBlock)
{
SetEvent(m_hWrEvent);
}
//
Unlock();
return TRUE;
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:24,代码来源:UdpCommClient.cpp
示例8: printMetadataResults
/**
* Prints out the name value records of the matching results.
*/
int printMetadataResults(hc_nvr_t *nvr, hc_session_t *session)
{
char **names = NULL;
char **values = NULL;
int count = 0;
hcerr_t hcError = hc_nvr_convert_to_string_arrays(nvr,
&names,
&values,
&count);
if (hcError != HCERR_OK)
{
HandleError(session, hcError);
hc_session_free(session);
return RETURN_STORAGETEK_ERROR;
} /* if error occurred */
/* Print metadata record. printMetadataRecord is example specific code (in example_metadata.h) */
/* and is not part of the @[email protected] API. */
printMetadataRecord(names, values, count);
return RETURN_SUCCESS;
} /* printMetadataResults */
开发者ID:elambert,项目名称:honeycomb,代码行数:27,代码来源:Query.c
示例9: HandleError
BOOL CUdpClient::ProcessNetworkEvent()
{
BOOL bContinue = TRUE;
WSANETWORKEVENTS events;
int rc = ::WSAEnumNetworkEvents(m_soClient, m_evSocket, &events);
if(rc == SOCKET_ERROR)
bContinue = HandleError();
if(bContinue && events.lNetworkEvents & FD_READ)
bContinue = HandleRead(events);
if(bContinue && events.lNetworkEvents & FD_WRITE)
bContinue = HandleWrite(events);
if(m_bAsyncConnect && bContinue && events.lNetworkEvents & FD_CONNECT)
bContinue = HandleConnect(events);
if(bContinue && events.lNetworkEvents & FD_CLOSE)
bContinue = HandleClosse(events);
return bContinue;
}
开发者ID:NothingInMyEye,项目名称:HP-Socket,代码行数:24,代码来源:UdpClient.cpp
示例10: cfi
bool CFI::CompileCFI(const string &str)
{
// strip the 'epubcfi(...)' wrapping
string cfi(str);
if ( str.find("epubcfi(") == 0 )
{
cfi = cfi.substr(8, (str.size()-1)-8);
}
else if ( str.size() == 0 )
{
HandleError(EPUBError::CFIParseFailed, "Empty CFI string");
return false;
}
else if ( str[0] != '/' )
{
HandleError(EPUBError::CFINonSlashStartCharacter);
}
StringList rangePieces = RangedCFIComponents(cfi);
if ( rangePieces.size() != 1 && rangePieces.size() != 3 )
{
HandleError(EPUBError::CFIRangeComponentCountInvalid, _Str("Expected 1 or 3 range components, got ", rangePieces.size()));
if ( rangePieces.size() == 0 )
return false;
}
if ( CompileComponentsToList(CFIComponentStrings(rangePieces[0]), &_components) == false )
return false;
if ( rangePieces.size() >= 3 )
{
if ( CompileComponentsToList(CFIComponentStrings(rangePieces[1]), &_rangeStart) == false )
return false;
if ( CompileComponentsToList(CFIComponentStrings(rangePieces[2]), &_rangeEnd) == false )
return false;
// now sanity-check the range delimiters:
// neither should be empty
if ( _rangeStart.empty() || _rangeEnd.empty() )
{
HandleError(EPUBError::CFIRangeInvalid, "One of the supplied range components was empty.");
return false;
}
// check the offsets at the end of each— they should be the same type
if ( (_rangeStart.back().flags & Component::OffsetsMask) != (_rangeEnd.back().flags & Component::OffsetsMask) )
{
HandleError(EPUBError::CFIRangeInvalid, "Offsets at the end of range components are of different types.");
return false;
}
// ensure that there are no side-bias values
if ( (_rangeStart.back().sideBias != SideBias::Unspecified) ||
(_rangeEnd.back().sideBias != SideBias::Unspecified) )
{
HandleError(EPUBError::CFIRangeContainsSideBias);
// can safely ignore this one
}
// where the delimiters' component ranges overlap, start must be <= end
auto maxsz = std::max(_rangeStart.size(), _rangeEnd.size());
bool inequalNodeIndexFound = false;
for ( decltype(maxsz) i = 0; i < maxsz; i++ )
{
if ( _rangeStart[i].nodeIndex > _rangeEnd[i].nodeIndex )
{
HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
}
else if ( !inequalNodeIndexFound && _rangeStart[i].nodeIndex < _rangeEnd[i].nodeIndex )
{
inequalNodeIndexFound = true;
}
}
// if the two ranges are equal aside from their offsets, the end offset must be > the start offset
if ( !inequalNodeIndexFound && _rangeStart.size() == _rangeEnd.size() )
{
Component &s = _rangeStart.back(), &e = _rangeEnd.back();
if ( s.HasCharacterOffset() && s.characterOffset > e.characterOffset )
{
HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
}
else
{
if ( s.HasTemporalOffset() && s.temporalOffset > e.temporalOffset )
HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
if ( s.HasSpatialOffset() && s.spatialOffset > e.spatialOffset )
HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
}
}
_options |= RangeTriplet;
}
return true;
}
开发者ID:datalogics-bhaugen,项目名称:SDKLauncher-Windows,代码行数:97,代码来源:cfi.cpp
示例11: fprintf
void
ClientUserLua::Diff( FileSys *f1, FileSys *f2, int doPage,
char *diffFlags, Error *e )
{
if ( P4LUADEBUG_CALLS )
fprintf( stderr, "[P4] Diff() - comparing files\n" );
//
// Duck binary files. Much the same as ClientUser::Diff, we just
// put the output into Ruby space rather than stdout.
//
if( !f1->IsTextual() || !f2->IsTextual() )
{
if ( f1->Compare( f2, e ) )
results.AddOutput( "(... files differ ...)" );
return;
}
// Time to diff the two text files. Need to ensure that the
// files are in binary mode, so we have to create new FileSys
// objects to do this.
FileSys *f1_bin = FileSys::Create( FST_BINARY );
FileSys *f2_bin = FileSys::Create( FST_BINARY );
FileSys *t = FileSys::CreateGlobalTemp( f1->GetType() );
f1_bin->Set( f1->Name() );
f2_bin->Set( f2->Name() );
{
//
// In its own block to make sure that the diff object is deleted
// before we delete the FileSys objects.
//
#ifndef OS_NEXT
::
#endif
Diff d;
d.SetInput( f1_bin, f2_bin, diffFlags, e );
if ( ! e->Test() ) d.SetOutput( t->Name(), e );
if ( ! e->Test() ) d.DiffWithFlags( diffFlags );
d.CloseOutput( e );
// OK, now we have the diff output, read it in and add it to
// the output.
if ( ! e->Test() ) t->Open( FOM_READ, e );
if ( ! e->Test() )
{
StrBuf b;
while( t->ReadLine( &b, e ) )
results.AddOutput( b.Text() );
}
}
delete t;
delete f1_bin;
delete f2_bin;
if ( e->Test() ) HandleError( e );
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:62,代码来源:clientuserlua.cpp
示例12: main
int main(int argc, char* argv[])
{
hc_session_t *session = NULL;
hc_oid returnedOid;
hc_long_t count = 0;
int finished = 0;
int32_t response_code = RETURN_SUCCESS;
hc_query_result_set_t *rset = NULL;
hc_nvr_t *nvr = NULL;
hc_long_t query_integrity_time;
int query_complete;
hcerr_t res = HCERR_OK;
int parametersUsed = USES_SERVERADDRESS | USES_QUERY | USES_SELECT_METADATA | USES_MAXRESULTS;
/* Initialize commandline structure */
cmdLine.storagetekServerAddress = NULL;
cmdLine.query = NULL;
cmdLine.help = 0;
cmdLine.debug_flags = 0;
cmdLine.storagetekPort = 0;
cmdLine.maxResults = DEFAULT_MAX_RESULTS;
/* Initialize metadata map. The metadata map structure is not part of the API but common */
/* code written for the convenience of these examples. See example_metadata.c. */
if (initMetadataMap(&cmdLine.cmdlineMetadata) == 0)
{
return exitApp(RETURN_MAPINITERROR);
} /* if initMetadataMap == 0 */
/* Get commandline (see example_commandline.c) */
if (parseCommandline( argc,
argv,
parametersUsed) == 0)
{
printUsage();
return RETURN_COMMANDLINE_ERROR;
} /* if parseCommandline failed */
else
{
if (cmdLine.help == 1)
{
printUsage();
return RETURN_SUCCESS;
} /* if help requested */
} /* else parseCommandline succeeded */
/* Initialize @[email protected] API */
res = hc_init(malloc,free,realloc);
if (res != HCERR_OK)
{
printf("An error occurred while initializing the API.\n");
return res;
} /* if error */
if (cmdLine.debug_flags) {
/* Internal debug flags */
hc_set_global_parameter(HCOPT_DEBUG_FLAGS, cmdLine.debug_flags);
}
res = hc_session_create_ez(cmdLine.storagetekServerAddress,
(cmdLine.storagetekPort > 0 ?
cmdLine.storagetekPort :
STORAGETEK_PORT),
&session);
if (res != HCERR_OK)
{
HandleError(session,res);
return RETURN_STORAGETEK_ERROR;
} /* if initialization failed */
/* Run queryplus if we have a select clause (-s option on the commandline), otherwise run query */
if (cmdLine.cmdlineMetadata.mapSize > 0)
{
res = hc_query_ez(session,
cmdLine.query,
cmdLine.cmdlineMetadata.namePointerArray,
cmdLine.cmdlineMetadata.mapSize,
100,
&rset);
} /* if outputing metadata */
else
{
res = hc_query_ez(session,
cmdLine.query,
NULL,
0,
100,
&rset);
}
if (res != HCERR_OK)
{
HandleError(session, res);
hc_session_free(session);
hc_cleanup();
//.........这里部分代码省略.........
开发者ID:elambert,项目名称:honeycomb,代码行数:101,代码来源:Query.c
示例13: PRINTMARK
PyObject *Connection_connect(Connection *self, PyObject *args)
{
/*
Args:
UMConnection conn, const char *_host, int _port, const char *_username, const char *_password, const char *_database, int _autoCommit, const char *_charset*/
char *host;
int port;
char *username;
char *password;
char *database;
int autoCommit;
char *pstrCharset = NULL;
PyObject *acObj = NULL;
if (!PyArg_ParseTuple (args, "sisss|Os", &host, &port, &username, &password, &database, &acObj, &pstrCharset))
{
return NULL;
}
if (acObj)
{
PRINTMARK();
autoCommit = (PyObject_IsTrue(acObj) == 1) ? 1 : 0;
}
if (pstrCharset)
{
if (strcmp (pstrCharset, "utf8") == 0)
{
self->charset = MCS_utf8_general_ci;
self->PFN_PyUnicode_Encode = PyUnicode_EncodeUTF8;
}
else
if (strcmp (pstrCharset, "latin1") == 0)
{
self->charset = MCS_latin1_general_ci;
self->PFN_PyUnicode_Encode = PyUnicode_EncodeLatin1;
}
else
if (strcmp (pstrCharset, "ascii") == 0)
{
self->charset = MCS_ascii_general_ci;
self->PFN_PyUnicode_Encode = PyUnicode_EncodeASCII;
}
else
if (strcmp (pstrCharset, "cp1250") == 0)
{
self->charset = MCS_cp1250_general_ci;
self->PFN_PyUnicode_Encode = PyUnicode_EncodeCP1250Helper;
}
else
{
return PyErr_Format (PyExc_ValueError, "Unsupported character set '%s' specified", pstrCharset);
}
}
else
{
self->charset = MCS_utf8_general_ci;
self->PFN_PyUnicode_Encode = PyUnicode_EncodeUTF8;
}
if (!UMConnection_Connect (self->conn, host, port, username, password, database, acObj ? &autoCommit : NULL, self->charset))
{
return HandleError(self, "connect");
}
Py_RETURN_NONE;
}
开发者ID:LeeXiaolan,项目名称:ultramysql,代码行数:69,代码来源:umysql.c
示例14: GenPrepare
/* This function generates a batch named prepare.bat (default).
* The batch contains 6 experiments
* Exp1: SPE - (Special) - runs IOCount SR then IOCount RW then IOCount SR
* The goal is here to determine the Pause value
* Exp2: SIO.SR - runs IOCount2 SR - goal: determine IOIgnoreSR and IOCountSR
* Exp3-5 : same for RR, SW, RW
* Exp6 : Random format of the device
*/
void GenPrepare(sParams* PB) {
FILE* fp2 = NULL; // file pointer
int32 size;
fp2 = fopen(PB->outName, "w");
if (fp2 == NULL) HandleError("GenBench", "Could not open output file", GetLastError(), ERR_ABORT);
strcpy(PB->comment, "SPE");
strcpy(PB->base, "SR");
PB->expID = 1;
PB->microBenchID = 0;
PB->pauseExp = 10000;
size = PB->IOSize * PB->IOCount;
for (PB->runID = 0; PB->runID < PB->nbRun; (PB->runID)++) {
PB->targetOffset = rg.IRandom(0,(int32)((PB->deviceSize/2 - size)/BLOCK))*BLOCK; // We choose a random location in the first half of the device
PB->targetSize = PB->deviceSize - PB->targetOffset;
GenExp(fp2, PB);
}
PB->IOCount = PB->IOCount2;
size = PB->IOSize * PB->IOCount;
strcpy(PB->comment, "SIO.SR");
PB->expID = 2;
for (PB->runID = 0; PB->runID < PB->nbRun; (PB->runID)++) {
PB->targetOffset = rg.IRandom(0,(int32)((PB->deviceSize/2 - size)/BLOCK))*BLOCK; // We choose a random location in the first half of the device
PB->targetSize = PB->deviceSize - PB->targetOffset;
GenExp(fp2, PB);
}
strcpy(PB->base, "RR");
strcpy(PB->comment, "SIO.RR");
PB->expID++;
for (PB->runID = 0; PB->runID < PB->nbRun; (PB->runID)++) {
PB->targetOffset = rg.IRandom(0,(int32)((PB->deviceSize/2 - size)/BLOCK))*BLOCK; // We choose a random location in the first half of the device
PB->targetSize = PB->deviceSize - PB->targetOffset;
GenExp(fp2, PB);
}
strcpy(PB->base, "SW");
strcpy(PB->comment, "SIO.SW");
PB->expID++;
for (PB->runID = 0; PB->runID < PB->nbRun; (PB->runID)++) {
PB->targetOffset = rg.IRandom(0,(int32)((PB->deviceSize/2 - size)/BLOCK))*BLOCK; // We choose a random location in the first half of the device
PB->targetSize = PB->deviceSize - PB->targetOffset;
GenExp(fp2, PB);
}
strcpy(PB->base, "RW");
strcpy(PB->comment, "SIO.RW");
PB->expID++;
for (PB->runID = 0; PB->runID < PB->nbRun; (PB->runID)++) {
PB->targetOffset = rg.IRandom(0,(int32)((PB->deviceSize/2 - size)/BLOCK))*BLOCK; // We choose a random location in the first half of the device
PB->targetSize = PB->deviceSize - PB->targetOffset;
GenExp(fp2, PB);
}
PB->expID++;
fprintf(fp2, "FlashIO RandomFormat Dev %d Bench %d Exp %d ", PB->deviceNum, PB->microBenchID, PB->expID);
if (PB->trimBeforeRun == TRUE)
fprintf(fp2, "TrimBeforeRun True\n");
else
fprintf(fp2, "\n");
if (PB->fake == TRUE)
fprintf(fp2, "Fake True\n Pause\n");
else
fprintf(fp2, "\n Pause\n");
fclose(fp2);
}
开发者ID:ClydeProjects,项目名称:FlashIO,代码行数:73,代码来源:genBench.cpp
示例15: DoPrepared
bool DoPrepared(HDBC lpDbc, TCHAR* szInput)
{
int arrIdx = 0;
RETCODE RetCode;
SQLSMALLINT sNumResults;
HSTMT lpStmt = NULL;
TCHAR* szIter = szInput;
int cnt = 0;
TRYODBCP(lpDbc,
SQL_HANDLE_DBC,
SQLAllocHandle(SQL_HANDLE_STMT, lpDbc, &lpStmt));
RetCode = SQLPrepare(lpStmt, (SQLCHAR*) szInput, SQL_NTS);
while (NULL != (szIter = strstr(szIter, "?"))) {
++cnt;
++szIter;
}
TCHAR szParams[MAX_PARAMS][SQL_QUERY_SIZE];
SQLLEN lenParams[MAX_PARAMS];
for (int sqlIdx = 1; sqlIdx <= cnt; ++sqlIdx) {
arrIdx = sqlIdx - 1;
_fgetts(szParams[arrIdx], SQL_QUERY_SIZE - 1, stdin);
lenParams[arrIdx] = strlen(szParams[arrIdx]);
szParams[arrIdx][lenParams[arrIdx]] = '\0';
lenParams[arrIdx] -= 1;
TRYODBCP(lpStmt, SQL_HANDLE_STMT,
SQLBindParameter(lpStmt, sqlIdx, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 255, 0, szParams[arrIdx],
SQL_QUERY_SIZE, &lenParams[arrIdx]));
}
RetCode = SQLExecute(lpStmt);
switch (RetCode)
{
case SQL_SUCCESS_WITH_INFO:
{
HandleError(lpStmt, SQL_HANDLE_STMT, RetCode);
// fall through
}
case SQL_SUCCESS:
{
// If this is a row-returning query, display
// results
TRYODBCP(lpStmt,
SQL_HANDLE_STMT,
SQLNumResultCols(lpStmt, &sNumResults));
if (sNumResults > 0)
{
DisplayResults(lpStmt, sNumResults);
} else
{
SQLLEN siRowCount;
TRYODBCP(lpStmt,
SQL_HANDLE_STMT,
SQLRowCount(lpStmt, &siRowCount));
if (siRowCount >= 0)
{
_tprintf(TEXT("%ld %s affected\n"),
static_cast<long>(siRowCount),
siRowCount == 1 ? TEXT("row") : TEXT("rows"));
}
}
break;
}
case SQL_ERROR:
{
HandleError(lpStmt, SQL_HANDLE_STMT, RetCode);
break;
}
default:
fprintf(stderr, "Unexpected return code %d!\n", RetCode);
}
SQLFreeStmt(lpStmt, SQL_DROP);
return true;
ExitP:
return false;
}
开发者ID:austinarmbruster,项目名称:o2jb,代码行数:85,代码来源:odbcsql.c
示例16: HandleError
/**
* Restarts a running task.
* If the task isn't started, it starts it.
* @return false if the task is running and we are unable to kill the previous instance
*/
bool Task::Restart()
{
return HandleError(taskRestart(m_taskID));
}
开发者ID:bescovedo,项目名称:becode,代码行数:9,代码来源:Task.cpp
示例17: HandleError
void CFI::Component::Parse(const string &str)
{
if ( str.empty() )
{
HandleError(EPUBError::CFIParseFailed, "Empty string supplied to CFI::Component");
return;
}
std::string utf8 = str.stl_str();
std::istringstream iss(utf8);
// read an integer
iss >> nodeIndex;
if ( nodeIndex == 0 && iss.fail() )
{
HandleError(EPUBError::CFIParseFailed, _Str("No node value at start of CFI::Component string '", str, "'"));
return;
}
while ( !iss.eof() )
{
char next = 0;
iss >> next;
switch ( next )
{
case '[':
{
size_t pos = static_cast<size_t>(iss.tellg());
iss.ignore(std::numeric_limits<std::streamsize>::max(), ']');
size_t end = ((size_t)iss.tellg()) - 1;
if ( iss.eof() )
{
HandleError(EPUBError::CFIParseFailed);
return;
}
if ( characterOffset != 0 )
{
// this is a text qualifier
flags |= TextQualifier;
std::string sub = utf8.substr(pos, end-pos);
// is there a side-bias?
auto biasPos = sub.find(";s=");
if ( biasPos == std::string::npos )
{
textQualifier = std::move(sub);
}
else
{
textQualifier = sub.substr(0, biasPos);
if ( sub.size() > biasPos + 3 )
{
switch ( sub[biasPos+3] )
{
case 'b':
sideBias = SideBias::Before;
break;
case 'a':
sideBias = SideBias::After;
break;
default:
sideBias = SideBias::Unspecified;
break;
}
}
}
}
else
{
// it's a position qualifier
qualifier = utf8.substr(pos, end-pos);
flags |= Qualifier;
}
break;
}
case '~':
{
// character offsets and spatial/temporal offsets are mutually exclusive
if ( HasCharacterOffset() )
break;
// read a numeral
iss >> temporalOffset;
flags |= TemporalOffset;
break;
}
case '@':
{
// character offsets and spatial/temporal offsets are mutually exclusive
if ( HasCharacterOffset() )
break;
// two floats, separated by a colon
float x, y;
//.........这里部分代码省略.........
开发者ID:datalogics-bhaugen,项目名称:SDKLauncher-Windows,代码行数:101,代码来源:cfi.cpp
示例18: throw
bool CLevelDBWrapper::WriteBatch(CLevelDBBatch& batch, bool fSync) throw(leveldb_error)
{
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
HandleError(status);
return true;
}
开发者ID:bitcoin-r,项目名称:bitcoin-rxx,代码行数:6,代码来源:leveldbwrapper.cpp
示例19: get_cert_time_left
void
get_cert_time_left(
char *realm,
CTimeSpan *ptimeLeft
)
{
HCERTSTORE hStoreHandle = NULL;
PCCERT_CONTEXT pCertContext = NULL;
PCCERT_CONTEXT prev_pCertContext = NULL;
DWORD dwCertEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
DWORD dwAddDisposition = CERT_STORE_ADD_REPLACE_EXISTING;
DWORD dwFindFlags = 0;
# define OID_KCA_AUTHREALM "1.3.6.1.4.1.250.42.1"
DWORD dwFindType = CERT_FIND_ANY;
CERT_INFO *pCertInfo = NULL;
PCERT_EXTENSION pCertExt = NULL;
CRYPT_OBJID_BLOB *p = NULL;
int i = 0;
char tmpRealm[250] = { 0 };
CTime startTime = 0;
CTime endTime = 0;
memset(ptimeLeft, 0, sizeof(*ptimeLeft));
if (!realm || !strlen(realm))
return;
//--------------------------------------------------------------------
// Open a store as the source of the certificates to be deleted and added
if(!(hStoreHandle = CertOpenSystemStore(
0,
MY_STORE)))
{
HandleError("get_cert_time_left: Strange. Unable to access your place in the Registry for certificates");
goto EXIT_RTN;
}
// Find first MY store cert issued by our Certificate Authority
while ((pCertContext = CertFindCertificateInStore(
hStoreHandle, // in
dwCertEncodingType, // in
dwFindFlags, // in
dwFindType, // in
NULL, // in
prev_pCertContext // in
)))
{
if (pCertInfo = pCertContext->pCertInfo)
for (i = pCertInfo->cExtension; i; i--)
{
pCertExt = &pCertInfo->rgExtension[i-1];
if (!strcmp(pCertExt->pszObjId, OID_KCA_AUTHREALM))
{
log_printf("get_cert_time_left: Found KCA_AUTHREALM Extension\n");
p = &pCertExt->Value;
memcpy(tmpRealm, &p->pbData[2], p->cbData-2);
tmpRealm[p->cbData-2] ='\0';
log_printf("get_cert_time_left: value is: '%s'\n", tmpRealm);
/* only match if realm of current TGT matches AuthRealm of this cert */
if (realm && !strcmp(realm, tmpRealm))
{
// It matches, determine remaining certificate's remaining minutes
startTime = CTime::GetCurrentTime();
endTime = pCertContext->pCertInfo->NotAfter;
*ptimeLeft = endTime - startTime;
goto EXIT_RTN;
}
}
}
prev_pCertContext = pCertContext;
}
EXIT_RTN:
if ((prev_pCertContext != pCertContext) && pCertContext)
{
CertFreeCertificateContext(pCertContext);
pCertContext = NULL;
}
if (pCertContext)
CertFreeCertificateContext(pCertContext);
if(hStoreHandle &&!CertCloseStore(
hStoreHandle,
#ifdef DEBUG
CERT_CLOSE_STORE_CHECK_FLAG
#else // !DEBUG
CERT_CLOSE_STORE_FORCE_FLAG
#endif // ! DEBUG
))
{
//.........这里部分代码省略.........
开发者ID:DUNE,项目名称:kx509,代码行数:101,代码来源:get_cert_time_left.cpp
示例20: PR_LOG
//.........这里部分代码省略.........
}
PRUint32 consumed;
ParseBuffer(buffer, length, noMoreBuffers, &consumed);
if (consumed > 0) {
nsScannerIterator oldExpatPosition = currentExpatPosition;
currentExpatPosition.advance(consumed);
// We consumed some data, we want to store the last line of data that
// was consumed in case we run into an error (to show the line in which
// the error occurred).
// The length of the last line that Expat has parsed.
XML_Size lastLineLength = XML_GetCurrentColumnNumber(mExpatParser);
if (lastLineLength <= consumed) {
// The length of the last line was less than what expat consumed, so
// there was at least one line break in the consumed data. Store the
// last line until the point where we stopped parsing.
nsScannerIterator startLastLine = currentExpatPosition;
startLastLine.advance(-((ptrdiff_t)lastLineLength));
CopyUnicodeTo(startLastLine, currentExpatPosition, mLastLine);
}
else {
// There was no line break in the consumed data, append the consumed
// data.
AppendUnicodeTo(oldExpatPosition, currentExpatPosition, mLastLine);
}
}
mExpatBuffered += length - consumed;
if (BlockedOrInterrupted()) {
PR_LOG(gExpatDriverLog, PR_LOG_DEBUG,
("Blocked or interrupted parser (probably for loading linked "
"stylesheets or scripts)."));
aScanner.SetPosition(currentExpatPosition, PR_TRUE);
aScanner.Mark();
return mInternalState;
}
if (noMoreBuffers && mExpatBuffered == 0) {
mMadeFinalCallToExpat = PR_TRUE;
}
if (NS_FAILED(mInternalState)) {
if (XML_GetErrorCode(mExpatParser) != XML_ERROR_NONE) {
NS_ASSERTION(mInternalState == NS_ERROR_HTMLPARSER_STOPPARSING,
"Unexpected error");
// Look for the next newline after the last one we consumed
nsScannerIterator lastLine = currentExpatPosition;
while (lastLine != end) {
length = PRUint32(lastLine.size_forward());
PRUint32 endOffset = 0;
const PRUnichar *buffer = lastLine.get();
while (endOffset < length && buffer[endOffset] != '\n' &&
buffer[endOffset] != '\r') {
++endOffset;
}
mLastLine.Append(Substring(buffer, buffer + endOffset));
if (endOffset < length) {
// We found a newline.
break;
}
lastLine.advance(length);
}
HandleError();
}
return mInternalState;
}
// Either we have more buffers, or we were blocked (and we'll flush in the
// next iteration), or we should have emptied Expat's buffer.
NS_ASSERTION(!noMoreBuffers || blocked ||
(mExpatBuffered == 0 && currentExpatPosition == end),
"Unreachable data left in Expat's buffer");
start.advance(length);
// It's possible for start to have passed end if we received more data
// (e.g. if we spun the event loop in an inline script). Reload end now
// to compensate.
aScanner.EndReading(end);
}
aScanner.SetPosition(currentExpatPosition, PR_TRUE);
aScanner.Mark();
PR_LOG(gExpatDriverLog, PR_LOG_DEBUG,
("Remaining in expat's buffer: %i, remaining in scanner: %i.",
mExpatBuffered, Distance(currentExpatPosition, end)));
return NS_SUCCEEDED(mInternalState) ? kEOF : NS_OK;
}
开发者ID:mbrubeck,项目名称:mozilla-central,代码行数:101,代码来源:nsExpatDriver.cpp
注:本文中的HandleError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论