void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo movementInfo) { uint32 key = player->GetGUIDLow(); if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING)) return; // if we are a ghost we can walk on water if (!player->IsAlive()) return; if (player->HasAuraType(SPELL_AURA_FEATHER_FALL) || player->HasAuraType(SPELL_AURA_SAFE_FALL) || player->HasAuraType(SPELL_AURA_WATER_WALK)) return; Report(player, WALKWATER_HACK); }
// Write text to the registry void RegistryWrite(HKEY root, read path, read name, read value) { // Open the key registryitem registry; if (!registry.Open(root, path)) return; // Set or make and set the text value int result = RegSetValueEx( registry.key, // Handle to an open key name, // Name of the value to set or make and set 0, REG_SZ, // Variable type is a null-terminated string (const byte *)value, // Address of the value data to load (length(value) + 1) * sizeof(WCHAR)); // Size of the value data in bytes, add 1 to write the null terminator if (result != ERROR_SUCCESS) Report(L"error regsetvalueex"); }
// TAccountXmpp::IRuntimeObject::PGetRuntimeInterface() // // Enable the TAccountXmpp object to respond to the interface of other objects it is related to, such as TCertificate and TCertificateServerName POBJECT TAccountXmpp::PGetRuntimeInterface(const RTI_ENUM rti, IRuntimeObject * piParent) const { Report(piParent == NULL); switch (rti) { case RTI(TCertificate): return Certificate_PGet_YZ(); case RTI(TCertificateServerName): return Certificate_PGetServerName(); case RTI(TContact): // TODO: Without this line, there is a stack overvlow return NULL; default: return TAccountCore::PGetRuntimeInterface(rti, m_pProfileParent); } }
/// report libmng error information void ReportLibmngError (iObjectRegistry *object_reg, mng_handle hMNG, const char* msg) { mng_int8 severity; mng_chunkid chunkname; mng_uint32 chunkseq; mng_int32 extra1; mng_int32 extra2; mng_pchar errortext; mng_getlasterror (hMNG, &severity, &chunkname, &chunkseq, &extra1, &extra2, &errortext); Report (object_reg, CS_REPORTER_SEVERITY_WARNING, "%s: %s (severity %" PRId8 ", chunkname %.8" PRIx32 ", chunkseq %" PRIu32 ", %.8" PRIx32 ", %.8" PRIx32 ")", msg, errortext, severity, chunkname, chunkseq, extra1, extra2); }
void CMessageLog::Show() { #ifdef CONFIG_MESSAGE_LOG_WIN32 if (m_hwndMessageLog == NULL) CreateLogWindow(); ::ShowWindow(m_hwndMessageLog, SW_SHOW); if (!g_fMessageLogsPaused) ::SendMessage(m_hwndRichEdit, WM_VSCROLL, SB_BOTTOM, d_zNA); // When the Message Log becomes visible, scroll at the bottom so the user may see the most recent messages. #else Report(m_pwChatDebugger != NULL && "The widget should have been created!"); if (m_pwChatDebugger == NULL) CreateLogWindow(); m_pwChatDebugger->show(); #endif }
void COXEventLog::ReportError(LPCTSTR pszStringToReport) { LPCTSTR string_array[1]; if (pszStringToReport == (LPCTSTR)NULL) { string_array[0] = _T("COXEventLog::ReportError(NULL)"); } else { string_array[0] = pszStringToReport; } TRACE0("COXEventLog::ReportError()\n"); Report(eventError, 0, 0, 1, string_array); }
const char* GenmeshAnimationPDLFactory::ParseBuffer (iSyntaxService* synsrv, ColorBuffer& buffer, iDocumentNode* node) { csRef<iDocumentNodeIterator> it = node->GetNodes (); while (it->HasNext ()) { csRef<iDocumentNode> child = it->Next (); if (child->GetType () != CS_NODE_ELEMENT) continue; const char* value = child->GetValue (); csStringID id = xmltokens.Request (value); switch (id) { case XMLTOKEN_STATICCOLORS: { buffer.staticColors = synsrv->ParseRenderBuffer (child); if (!buffer.staticColors) return "Could not parse <staticcolors>"; } break; case XMLTOKEN_LIGHT: { ColorBuffer::MappedLight light; const char* err = ParseLight (light, synsrv, child); if (err) { Report (synsrv, CS_REPORTER_SEVERITY_WARNING, child, "Could not parse light: %s", err); } else buffer.lights.Push (light); } break; default: parseError.Format ("Unknown token %s", CS::Quote::Single (value)); return parseError; } } if (!buffer.staticColors) return "No <staticcolors> given"; const char* err = ValidateBufferSizes (buffer); if (err) return err; return 0; }
static void check_fast(void) { Carrier *carrier = NULL; int checksum; int i; int tmp; int *wptr; int failures = 0; int iterations = 0; carrier = AllocFast(FastmemSize, &(MyTask->MemPool)); Signal(&ThreadsReady); if (carrier == NULL) { Report("warning, failed to allocate on-chip memory."); Wait(&ResultsLock); Results.OnchipMemory = 0; Results.OnchipFailures = 0; Signal(&ResultsLock); Signal(&ResultsReady); return; } /* Fill the on-chip memory with random data. */ wptr = (int *) carrier->Addr; for (i = 0, checksum = 0; i < (FastmemSize / sizeof(int)); i++) { wptr[i] = hw_rand(); checksum += wptr[i]; } for (iterations = 0; ; iterations++) { for (i = 0; (i < MemoryInterval) && !Finished; i++) Delay(OneSec); if (Finished) break; for (i = 0, tmp = 0; i < (FastmemSize / sizeof(int)); i++) tmp += wptr[i]; if (tmp != checksum) { failures++; checksum = tmp; } } Wait(&ResultsLock); Results.OnchipMemory = FastmemSize; Results.OnchipFailures = failures; Results.OnchipIterations = iterations; Signal(&ResultsLock); Signal(&ResultsReady); }
csPtr<iShader> csXMLShaderCompiler::CompileShader ( iLoaderContext* ldr_context, iDocumentNode *templ, int forcepriority) { if (!templ) return 0; if (!ValidateTemplate (templ)) return 0; /* We might only be loaded as a dependency of the engine, so query it here instead of Initialize() */ if (!engine.IsValid()) { engine = csQueryRegistry<iEngine> (objectreg); sharedEvaluator->SetEngine (engine); } csTicks startTime = 0, endTime = 0; // Create a shader. The actual loading happens later. csRef<csXMLShader> shader; if (do_verbose) startTime = csGetTicks(); shader.AttachNew (new csXMLShader (this, ldr_context, templ, forcepriority)); if (!shader->Load (templ)) return 0; if (do_verbose) endTime = csGetTicks(); shader->SetName (templ->GetAttributeValue ("name")); shader->SetDescription (templ->GetAttributeValue ("description")); if (do_verbose) { csString str; shader->DumpStats (str); Report(CS_REPORTER_SEVERITY_NOTIFY, "Shader %s: %s, %u ms", shader->GetName (), str.GetData (), endTime - startTime); } csRef<iDocumentNodeIterator> tagIt = templ->GetNodes ("key"); while (tagIt->HasNext ()) { // @@@ FIXME: also keeps "editoronly" keys csRef<iKeyValuePair> keyvalue = synldr->ParseKey (tagIt->Next ()); if (keyvalue) shader->QueryObject ()->ObjAdd (keyvalue->QueryObject ()); } csRef<iShader> ishader (shader); return csPtr<iShader> (ishader); }
void CEodStepLoadIvBands::OnIvData(EODIV::CIvIvBandsResultPtr pResult) { if(_IsCancel() || IsStopping()) throw EODCO::CEodStopException(); Trace(EODCO::enTrLogDebug,__FUNCTION__,_T("Start")); EODMS::CMsUndCollPtr spUndColl = m_Request.Und(); ATLASSERT(spUndColl); EODMS::CMsUndPtr spUnd(GetCollectionItem<EODMS::CMsUndPtr>(spUndColl, pResult->m_strUndSymbol)); ATLASSERT(spUnd); if(spUnd) { if(!EODCO::IsBadValue(pResult->m_dIVBandHigh) && !EODCO::IsBadValue(pResult->m_dIVBandLow)) { CString sExecQuery; sExecQuery.Format(_T("exec usp_EodVolaBands_Save %d,%d,%f,%f,%f;"),spUnd->m_nID,pResult->m_nExpPeriod, (100. + static_cast<double>(pResult->m_nStrikeMoneyness)) / 100. , pResult->m_dIVBandLow, pResult->m_dIVBandHigh); m_nUndInQuery++; m_sQueryBuffer += sExecQuery; if(m_nUndInQuery >= 200L) _SaveBuffer(); } size_t nAllUnd = spUndColl->size(); size_t nProgress = 100 * m_Request.UndSend() / nAllUnd; if(m_nProgress != nProgress) { m_nProgress = nProgress; Report(StepMask(),enRpMtProgress, _T("%d"), m_nProgress); CEodServer::s_pEodServer->StepsMgr()->IncProgress(); } } Trace(EODCO::enTrLogDebug,__FUNCTION__,_T("Completed")); }
int ValidateCommand :: Execute( ALib::CommandLine & cmd ) { GetSkipOptions( cmd ); GetOutputMode( cmd ); ReadValidationFile( cmd ); IOManager io( cmd ); CSVRow row; // we optionally return an error code to the shell if validation failed int errtotal = 0; bool errcode = cmd.HasFlag( FLAG_ERRCODE ); while( io.ReadCSV( row ) ) { if ( Skip( io, row ) ) { continue; } int errcount = 0; for ( unsigned int i = 0; i < mRules.size(); i++ ) { ValidationRule::Results res = mRules[i]->Apply( row ); if ( res.size() && mOutMode == Reports ) { Report( io, res, errcount ); errcount++; errtotal += errcount; continue; } if ( res.size() ) { errcount++; if ( mOutMode == Fails ) { io.WriteRow( row ); break; } } } if ( mOutMode == Passes && errcount == 0 ) { io.WriteRow( row ); } errtotal += errcount; } // exit code of 2 indicates program detected invalid data return errtotal && errcode ? 2 : 0; }
void DataMemberChecker::checkASTDecl(const clang::FieldDecl* D, clang::ento::AnalysisManager& Mgr, clang::ento::BugReporter& BR) const { const char *reportDescription = "[sas.CodingConventions.FCCSW.DataMember] Data member variable names must begin with 'm_' followed by a lowerCamelCase name."; std::regex correctRegex("^m_[a-z][a-zA-Z0-9]+"); auto nameString = D->getNameAsString(); auto parent = D->getParent(); if (parent->isStruct()) { return; // Does not apply to public members of structs } if (!std::regex_match(nameString, correctRegex)) { Report(D, reportDescription, BR); } }
void GATT_Init() { U8 i,j=0; Report(("GATT init")); InitializeListHead(&(GATTC(regList))); for(i=0; i< MAX_GATT_CON_NO; i++) { GATTC(conn)[i].state = GATT_CONN_STATE_IDLE; GATTC(conn)[i].link = 0; InitializeListHead(&GATTC(conn)[i].gattRequestOpList); InitializeListHead(&GATTC(conn)[i].gattNotificationOpList); InitializeListHead(&GATTC(conn)[i].gattIndicationOpList); GATTC(conn)[i].disconnectTimerValue = MAX_GATT_DISCONNECT_TIMEOUT_VALUE; EVM_ResetTimer(&GATTC(conn)[i].disconnectTimer); } BT_ATT_GattRegisterHandler(BT_Gatt_Att_Callback); }
Wiimote::Wiimote(const unsigned int _index) : index(_index) #ifdef __APPLE__ , inputlen(0) #elif defined(__linux__) && HAVE_BLUEZ , out_sock(-1), in_sock(-1) #elif defined(_WIN32) , dev_handle(0), stack(MSBT_STACK_UNKNOWN) #endif , leds(0), m_last_data_report(Report((u8 *)NULL, 0)) , m_channel(0), m_connected(false) { #if defined(__linux__) && HAVE_BLUEZ bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}}; #endif DisableDataReporting(); }
bool csWrappedDocumentNode::ProcessUndef (NodeProcessingState* state, iDocumentNode* node, const TempString<>& args) { TempString<> param; const char* p = args; GetNextArg (p, param); if (p) { while (*p && isspace (*p)) p++; } if (param.IsEmpty() || (*p != 0)) { Report (syntaxErrorSeverity, node, "One parameter expected for %s", CS::Quote::Single ("Undef")); return false; } globalState->defines.Delete (param); return true; }
static _i32 _ReadBootInfo(sBootInfo_t *psBootInfo) { _i32 lFileHandle; _u32 ulToken; _i32 status = -1; if( 0 == sl_FsOpen((_u8 *)IMG_BOOT_INFO, FS_MODE_OPEN_READ, &ulToken, &lFileHandle) ) { if( 0 < sl_FsRead(lFileHandle, 0, (_u8 *)psBootInfo, sizeof(sBootInfo_t)) ) { status = 0; Report("ReadBootInfo: ucActiveImg=%d, ulImgStatus=0x%x\n\r", psBootInfo->ucActiveImg, psBootInfo->ulImgStatus); } sl_FsClose(lFileHandle, 0, 0, 0); } return status; }
U32 Mesh::Manager::ReportList( const char * name) // = NULL { U32 count = 0; U32 len = 0, hit = FALSE; if ( name) { len = strlen( name); } else { hit = TRUE; } U32 mem = 0; remem = recount = rgeo = ranim = rmrm = 0; NBinTree<MeshRoot>::Iterator li(&rootTree); while (MeshRoot * root = li++) { if (!root->isChunk && (!name || !strnicmp( root->fileName.str, name, len))) { mem += Report( *root); hit = TRUE; count++; } } if (hit) { CON_DIAG( ("%4ld %-31s: %9ld g%6ld a%6ld m%6ld", count, "mesh types", mem, rgeo, ranim, rmrm )); LOG_DIAG( ("%4ld %-31s: %9ld g%6ld a%6ld m%6ld", count, "mesh types", mem, rgeo, ranim, rmrm )); CON_DIAG( ("%4ld %-31s: %9ld", recount, "mesh instances", remem ) ); LOG_DIAG( ("%4ld %-31s: %9ld", recount, "mesh instances", remem ) ); } else { CON_DIAG( ("Can't find mesh type: %s", name) ); } return mem + remem; }
void BleServiceDbUpdateRecord(ble_service_db *servicedb) { S32 fd; S32 pos_current; S32 pos_end; U32 mode = BTMTK_FS_READ_WRITE; U8 *db_buff; if (!btmtk_fs_is_dir_exist((const U8*)BLE_SERVICE_DATABASE_FILE)) { mode |= BTMTK_FS_CREATE; } fd = btmtk_fs_open((const U8*)BLE_SERVICE_DATABASE_FILE, mode); if (fd < 0) { return; } pos_end = btmtk_fs_seek(fd, 0, BTMTK_FS_SEEK_END); pos_current = btmtk_fs_seek(fd, 0, BTMTK_FS_SEEK_BEGIN); db_buff = (U8 *)get_ctrl_buffer(sizeof(ble_service_db) - sizeof(ListEntry)); while (pos_current < pos_end) { btmtk_fs_read(fd, db_buff, sizeof(ble_service_db) - sizeof(ListEntry)); if (OS_MemCmp(db_buff, 6, servicedb->bdAddr.addr, 6)) { btmtk_fs_seek(fd, pos_current, BTMTK_FS_SEEK_BEGIN); break; } pos_current += (sizeof(ble_service_db) - sizeof(ListEntry)); } free_ctrl_buffer(db_buff); Report(("[BleDB] Update record in file, seek offset: %d", pos_current)); // kal_trace(BT_TRACE_BLE_PROFILES, BLEDB_UPDATERECORD_OFFSET, pos_current); btmtk_fs_write(fd, ((U8 *)servicedb) + sizeof(ListEntry), sizeof(ble_service_db) - sizeof(ListEntry)); btmtk_fs_close(fd); }
// IContactAlias::IRuntimeObject::PGetRuntimeInterface() POBJECT IContactAlias::PGetRuntimeInterface(const RTI_ENUM rti, IRuntimeObject * piParent) const { Report(piParent == NULL); /* switch (rti) { case RTI(TContact): return m_pContact; case RTI(TProfile): return m_pContact->m_pAccount->m_pProfileParent; case RTI(TAccountXmpp): return m_pContact->m_pAccount; default: return ITreeItem::PGetRuntimeInterface(rti); } // switch */ return ITreeItem::PGetRuntimeInterface(rti, m_pContact); }
void PtrCastWinChecker::checkPreStmt(const clang::CStyleCastExpr* CE, clang::ento::CheckerContext& C) const { if (clang::CK_PointerToIntegral != CE->getCastKind()) return; auto subExpr = CE->getSubExpr(); auto& Ctx = C.getASTContext(); clang::QualType fromQType = Ctx.getCanonicalType(subExpr->getType()); clang::QualType toQType = Ctx.getCanonicalType(CE->getType()); if (fromQType->isPointerType() || fromQType->isArrayType()) { auto toType = toQType.getTypePtr(); // Case one: the toType is a builtin and not a long long if (toType->isSpecificBuiltinType(clang::BuiltinType::Long) || toType->isSpecificBuiltinType(clang::BuiltinType::ULong)){ std::string r = "[sas.CodingConventions.ROOT.PtrCastWinChecker] Casting pointers to integer types which are not (unsigned) long long (in this case a "; r+=toQType.getAsString (); r+=") is wrong on Windows 64 bits. "; Report(CE, r.c_str(), C); } } }
csRef<iImage> BaseMapGen::LoadImage (const csString& filename, int format) { csPrintf ("Trying to load '%s'... \t", filename.GetData()); fflush (stdout); csRef<iImage> image; csRef<iImageIO> imageio = csQueryRegistry<iImageIO> (object_reg); csRef<iVFS> VFS = csQueryRegistry<iVFS> (object_reg); csRef<iDataBuffer> buf = VFS->ReadFile (filename.GetData(), false); if (!buf) { Report ("Failed to load image file '%s'!", filename.GetData()); return GenerateErrorTexture (32, 32); } image = imageio->Load (buf, format); image.IsValid() ? csPrintf ("success.\n") : csPrintf ("failed.\n"); return image; }
//---------------------------------------------------------- NS_IMETHODIMP nsXPCOMDetector::DoIt(const char* aBuf, uint32_t aLen, bool* oDontFeedMe) { NS_ASSERTION(mObserver != nullptr, "have not init yet"); if ((nullptr == aBuf) || (nullptr == oDontFeedMe)) return NS_ERROR_ILLEGAL_VALUE; this->Reset(); nsresult rv = this->HandleData(aBuf, aLen); if (NS_FAILED(rv)) return rv; if (mDone) { if (mDetectedCharset) Report(mDetectedCharset); *oDontFeedMe = true; } *oDontFeedMe = false; return NS_OK; }
void AnticheatMgr::SpeedHackDetection(Player* player,MovementInfo movementInfo) { uint32 key = player->GetGUIDLow(); // We also must check the map because the movementFlag can be modified by the client. // If we just check the flag, they could always add that flag and always skip the speed hacking detection. // 369 == DEEPRUN TRAM if (m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FALLING) || player->GetMapId() == 369) return; uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos); uint8 moveType = 0; // we need to know HOW is the player moving // TO-DO: Should we check the incoming movement flags? if (player->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING)) moveType = MOVE_SWIM; else if (player->IsFlying()) moveType = MOVE_FLIGHT; else if (player->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) moveType = MOVE_WALK; else moveType = MOVE_RUN; // how many yards the player can do in one sec. uint32 speedRate = (uint32)(player->GetSpeed(UnitMoveType(moveType)) + movementInfo.jump.xyspeed); // how long the player took to move to here. uint32 timeDiff = getMSTimeDiff(m_Players[key].GetLastMovementInfo().time,movementInfo.time); if (!timeDiff) timeDiff = 1; // this is the distance doable by the player in 1 sec, using the time done to move to this point. uint32 clientSpeedRate = distance2D * 1000 / timeDiff; // we did the (uint32) cast to accept a margin of tolerance if (clientSpeedRate > speedRate) { Report(player, SPEED_HACK); } }
_i32 sl_extlib_FlcOpenFile(_u8 *file_name, _i32 file_size, _u32 *ulToken, _i32 *lFileHandle, _i32 open_flags) { char uclocalFilename[100]; if(open_flags == _FS_MODE_OPEN_READ) { return sl_FsOpen((_u8 *)file_name, _FS_MODE_OPEN_READ, ulToken, lFileHandle); } else { /* MCU image name should be changed */ if(strstr((char *)file_name, "/sys/mcuimgA") != NULL) { switch(_McuImageGetNewIndex()) { case IMG_ACT_USER1: strcpy(uclocalFilename,IMG_USER_1); break; case IMG_ACT_USER2: strcpy(uclocalFilename,IMG_USER_2); break; } /* make sure that the file is not opened as fail-safe since it might fill the entire SFLASH and it is not required for the MCU image */ open_flags &= ~_FS_FILE_OPEN_FLAG_COMMIT; Report("sl_extlib_FlcOpenFile: MCU image" "name converted to %s \r\n", uclocalFilename); } else { strcpy(uclocalFilename,(char *)file_name); } return sl_FsOpen((_u8 *)uclocalFilename, FS_MODE_OPEN_CREATE(file_size, open_flags), ulToken, lFileHandle); } }
// CreateSection // Given a section name, this function first checks to see if the given section // allready exists in the list or not, if not, it creates the new section and // assigns it the comment given in szComment. The function returns true if // sucessfully created, or false otherwise. bool CDataFile::CreateSection(t_Str szSection, t_Str szComment) { t_Section* pSection = GetSection(szSection); if ( pSection ) { Report(E_INFO, "[CDataFile::CreateSection] Section <%s> allready exists. Aborting.", szSection.c_str()); return false; } t_Section section; section.szName = szSection; section.szComment = szComment; m_Sections.push_back(section); m_bDirty = true; return true; }
/************************************************************* * 函数名: ReportError(……) * 功能: 报告异常 * 参数: EInfo-异常信息 * fileId-文件ID *************************************************************/ void TranscendLog::ReportError( char *EInfo,unsigned int fileId ) { ptr_fileList = ptr_fileList_head; while( ptr_fileList->uId != fileId && ptr_fileList->next != NULL ) { ptr_fileList = ptr_fileList->next; } if( ptr_fileList->uId != fileId ) { MessageBox( 0, "OpenFile,Error!", 0, 0 ); return ; } ptr_fileList->iEcount++; char *Error; Error = new char[256]; strcpy( Error, "ERROR:" ); strcat( Error, EInfo ); Report( Error, fileId ); delete []Error; }
_i32 _McuImageGetNewIndex(void) { _i32 newImageIndex; /* Assume sBootInfo is alrteady filled in init time (by sl_extlib_FlcCommit) */ switch(sBootInfo.ucActiveImg) { case IMG_ACT_USER1: newImageIndex = IMG_ACT_USER2; break; case IMG_ACT_USER2: default: newImageIndex = IMG_ACT_USER1; break; } Report("_McuImageGetNewIndex: active image is %d, return new image %ld \n\r", sBootInfo.ucActiveImg, newImageIndex); return newImageIndex; }
void csSndSysRendererOpenAL::Update() { // Listener is created on open, but EventHandler is setup at init, // so, in some cases we can get here without the listener having been // created yet. if (!m_Listener) return; // Get exclusive access to the OpenAL context. ScopedRendererLock lock (*this); // Make sure the context, not really necessary as we requested a async // context, but documentation recommends it, in case async contexts are not // supported. //alcProcessContext (m_Context); // Update the listeners state. bool ExternalUpdates = m_Listener->Update(); // Update the sources size_t iMax = m_Sources.GetSize(); for (size_t i=0;i<iMax;i++) { m_Sources[i]->PerformUpdate( ExternalUpdates ); if (m_Sources[i]->GetStream()->GetPauseState() == CS_SNDSYS_STREAM_PAUSED && m_Sources[i]->GetStream()->GetAutoUnregisterRequested() == true) // sound has finished and is not looping { RemoveStream(m_Sources[i]->GetStream()); RemoveSource(m_Sources[i]); i--; // changing the vector in mid-loop means we back up here iMax--; // array is also one shorter now } } // Check for any errors ALCenum err = alcGetError (m_Device); if (err != ALC_NO_ERROR) { Report (CS_REPORTER_SEVERITY_ERROR, "An OpenAL error occured: %s", alcGetString (m_Device, err)); CS_ASSERT (err == ALC_NO_ERROR); } }
iShader* csStencilShadowType::GetShadow () { if (!shadowLoaded) { shadowLoaded = true; csRef<iPluginManager> plugin_mgr ( csQueryRegistry<iPluginManager> (object_reg)); // Load the shadow vertex program csRef<iShaderManager> shmgr = csQueryRegistryOrLoad<iShaderManager> ( object_reg, "crystalspace.graphics3d.shadermanager"); if (!shmgr) return 0; csRef<iShaderCompiler> shcom (shmgr->GetCompiler ("XMLShader")); csRef<iVFS> vfs = csQueryRegistry<iVFS> (object_reg); csRef<iDataBuffer> buf = vfs->ReadFile ("/shader/shadow.xml"); //csRef<iDataBuffer> buf = vfs->ReadFile ("/shader/shadowdebug.xml"); csRef<iDocumentSystem> docsys ( csQueryRegistry<iDocumentSystem> (object_reg)); if (docsys == 0) { docsys.AttachNew (new csTinyDocumentSystem ()); } csRef<iDocument> shaderDoc = docsys->CreateDocument (); shaderDoc->Parse (buf, true); // @@@ TODO: Try to get a right ldr_context here??? shadow = shcom->CompileShader (0, shaderDoc->GetRoot ()->GetNode ("shader")); if (!shadow) { Report (CS_REPORTER_SEVERITY_ERROR, "Unable to load shadow shader"); return 0; } } return shadow; }
void TestFixture::testFileTiming() { wxExFile file(wxExFileName(TEST_FILE)); CPPUNIT_ASSERT(file.IsOpened()); CPPUNIT_ASSERT(file.Length() > 0); wxStopWatch sw; const int max = 10000; for (int i = 0; i < max; i++) { CPPUNIT_ASSERT(file.Read().length() > 0); } const long exfile_read = sw.Time(); wxFile wxfile(TEST_FILE); CPPUNIT_ASSERT(wxfile.IsOpened()); const size_t l = wxfile.Length(); CPPUNIT_ASSERT(l > 0); sw.Start(); for (int j = 0; j < max; j++) { char* charbuffer = new char[l]; wxfile.Read(charbuffer, l); CPPUNIT_ASSERT(sizeof(charbuffer) > 0); delete charbuffer; } const long file_read = sw.Time(); Report(wxString::Format( "wxExFile::Read %d items in %ld ms wxFile::Read %d items in %ld ms", max, exfile_read, max, file_read).ToStdString()); }