BOOL CObjects::Flush(BOOL bClearMemory, BOOL bClearCache) { SIndexesIterator sIter; OIndex oi; BOOL bResult; CBaseObject* pcBaseObject; if (mbDatabase) { bResult = TRUE; oi = StartMemoryIteration(&sIter); while (oi != INVALID_O_INDEX) { pcBaseObject = GetFromMemory(oi); bResult &= Save(pcBaseObject); oi = IterateMemory(&sIter); } if (bClearMemory) { bResult &= ClearMemory(); } bResult &= mcDatabase.Flush(bClearCache); return bResult; } else { bResult = ClearMemory(); return bResult; } }
void *FindProvisioningResource(void *data) { // If user stopped the process before thread get scheduled then check and return from this function; if (IsSetupStopped()) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return NULL; } OCStackResult ret = OC_STACK_ERROR; OIC_LOG_V(DEBUG, TAG, "szFindResourceQueryUri = %s", szFindResourceQueryUri); OCCallbackData ocCBData; ocCBData.cb = FindProvisioningResourceResponse; ocCBData.context = (void *) EASY_SETUP_DEFAULT_CONTEXT_VALUE; ocCBData.cd = NULL; ret = OCDoResource(NULL, OC_REST_DISCOVER, szFindResourceQueryUri, NULL, NULL, netProvInfo->connType, OC_LOW_QOS, &ocCBData, NULL, 0); if (ret != OC_STACK_OK) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); } return NULL; }
OCStackApplicationResult ProvisionEnrolleeResponse(void* /*ctx*/, OCDoHandle /*handle*/, OCClientResponse *clientResponse) { OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "Inside ProvisionEnrolleeResponse"); // If user stopped the process then return from this function; if (IsSetupStopped()) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_DELETE_TRANSACTION; } if (!ValidateEnrolleeResponse(clientResponse)) { ErrorCallback(DEVICE_NOT_PROVISIONED); return OC_STACK_DELETE_TRANSACTION; } char query[OIC_STRING_MAX_VALUE] = { '\0' }; char resUri[MAX_URI_LENGTH] = { '\0' }; OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "Resource URI = %s", clientResponse->resourceUri); OICStrcpy(resUri, sizeof(resUri), clientResponse->resourceUri); #ifdef REMOTE_ARDUINO_ENROLEE //Arduino Enrollee needs mediator application provide IP and port55555 which is specific // to Arduino WiFi enrollee // REMOTE_ARDUINO_ENROLEE has to be defined if Mediator is being tested with Arduino snprintf(query, sizeof(query), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr, IP_PORT, resUri); #else snprintf(query, sizeof(query), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr, clientResponse->addr->port, resUri); #endif if (TriggerNetworkConnection(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, clientResponse->addr, 0) != OC_STACK_OK) { OIC_LOG(INFO, ES_WIFI_PROV_TAG, "GetProvisioningStatusResponse received NULL clientResponse"); ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); } return OC_STACK_DELETE_TRANSACTION; }
//-------------------------------------------------------------------------- // PopupAutoMap() //-------------------------------------------------------------------------- void PopupAutoMap() { #define BASE_X 64 #define BASE_Y 44 ThreeDRefresh(); ThreeDRefresh(); SD_StopSound(); ClearMemory(); CacheDrawPic(BASE_X,BASE_Y,AUTOMAPPIC); ShowStats(BASE_X+101,BASE_Y+22,ss_quick,&gamestuff.level[gamestate.mapon].stats); while (Keyboard[sc_back_quote]) CalcTics(); #if GAME_VERSION != SHAREWARE_VERSION && IN_DEVELOPMENT // if (DebugOk && PP_step) // PicturePause(); #endif IN_StartAck (); while (!IN_CheckAck ()) CalcTics(); CleanDrawPlayBorder(); IN_ClearKeysDown(); }
int ListScoreCombinations(const int score) { AllocateMemory(score); int ret = score_combinations(score, 3); ClearMemory(score); return ret; }
/*********************************************************************************** set the parameter to default value ************************************************************************************/ RETURN_CODE fmhd_amhd_set_parameter_default() { RETURN_CODE ret = SUCCESS; if(work_mode == fmhd) { fmhd_freq = 8810; fmhd_freq_step_size = 200; fmhd_ber_mode = HD_P1; fmhd_split_mode_setting = 0; ClearMemory((u8*)fmhd_pset_table,sizeof(fmhd_pset_table)); pset_table_index =0; fmhd_seekonly = 0; } #ifdef OPTION__INCLUDE_MODE__AMHD if(work_mode == amhd) { amhd_freq = 1000; amhd_freq_step_size = 10; } #endif volume = 63; return ret; }
// // END ARTICLES // void EndText() { int artnum; const char *text; ClearMemory(); artnum = endextern+gamestate.episode; CA_CacheGrChunk(artnum); if (w0 == true){ text = (const char *)grsegsWL1[artnum]; } else if (w1 == true){ text = (const char *)grsegsWL6[artnum]; } else if (s0 == true){ text = (const char *)grsegsSDM[artnum]; } else { text = (const char *)grsegsSOD[artnum]; } ShowArticle(text); CA_UnCacheGrChunk(artnum); VW_FadeOut(); SETFONTCOLOR(0,15); IN_ClearKeysDown(); IN_GetMouseDelta(NULL, NULL); // Clear accumulated mouse movement FreeMusic(); }
void InitTags( TidyDocImpl* doc ) { Dict* xml; TidyTagImpl* tags = &doc->tags; ClearMemory( tags, sizeof(TidyTagImpl) ); /* create dummy entry for all xml tags */ xml = (Dict*) MemAlloc( sizeof(Dict) ); ClearMemory( xml, sizeof(Dict) ); xml->name = null; xml->versions = VERS_XML; xml->model = CM_BLOCK; xml->parser = null; xml->chkattrs = null; tags->xml_tags = xml; }
void tidyDocRelease( TidyDocImpl* doc ) { /* doc in/out opened and closed by parse/print routines */ if ( doc ) { assert( doc->docIn == NULL ); assert( doc->docOut == NULL ); TY_(ReleaseStreamOut)( doc->errout ); doc->errout = NULL; TY_(FreePrintBuf)( doc ); TY_(FreeLexer)( doc ); TY_(FreeNode)(doc, &doc->root); ClearMemory(&doc->root, sizeof(Node)); if (doc->givenDoctype) MemFree(doc->givenDoctype); TY_(FreeConfig)( doc ); TY_(FreeAttrTable)( doc ); TY_(FreeTags)( doc ); MemFree( doc ); } }
static void declare( TidyTagImpl* tags, ctmbstr name, uint versions, uint model, Parser *parser, CheckAttribs *chkattrs ) { if ( name ) { Dict* np = (Dict*) lookup( tags, name ); if ( np == null ) { np = (Dict*) MemAlloc( sizeof(Dict) ); ClearMemory( np, sizeof(Dict) ); np->name = tmbstrdup( name ); np->next = tags->declared_tag_list; tags->declared_tag_list = np; } /* Make sure we are not over-writing predefined tags */ if ( np->id == TidyTag_UNKNOWN ) { np->versions = versions; np->model |= model; np->parser = parser; np->chkattrs = chkattrs; } } }
// // END ARTICLES // void EndText (void) { int artnum; char *text; memptr layout; ClearMemory (); CA_UpLevel (); MM_SortMem (); #ifdef JAPAN ShowArticle(gamestate.episode + 1); VW_FadeOut(); SETFONTCOLOR(0,15); IN_ClearKeysDown(); if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement FreeMusic (); CA_DownLevel (); MM_SortMem (); #else #ifdef ARTSEXTERN artnum = endextern+gamestate.episode; CA_CacheGrChunk (artnum); text = (char *)grsegs[artnum]; MM_SetLock (&grsegs[artnum], True); #else endfilename[6] = '1'+gamestate.episode; CA_LoadFile (endfilename,&layout); text = (char *)layout; MM_SetLock (&layout, True); #endif ShowArticle (text); #ifdef ARTSEXTERN MM_FreePtr (&grsegs[artnum]); #else MM_FreePtr (&layout); #endif VW_FadeOut(); SETFONTCOLOR(0,15); IN_ClearKeysDown(); //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement //FreeMusic (); CA_DownLevel (); MM_SortMem (); #endif }
void Cauldron::init() { drawVelocity_ = false; velocityEffect_ = EffectCache::instance()->loadEffect("shaders/compiled/line.shader"); lineVBO_ = Geometry::line(); int size = 64; velocityTextureSize_ = CSize(size); // model_->setMaterialCallback("fluid_material", LiquidMaterialUpdate, this); textureSize_ = CSize(size); int textureSquare = textureSize_.square(); colorDataSize_ = textureSquare; // uint 1 for 1 colorData_ = new unsigned int [colorDataSize_]; ClearMemory(colorData_, colorDataSize_); densityTextureId_ = GraphicsInterface::createTexture(textureSize_, IGraphicsInterface::R8G8B8A8, 1, 1, colorData_, textureSize_.width * IGraphicsInterface::R8G8B8A8_SIZE, true); velocityTextureId_ = GraphicsInterface::createTexture(velocityTextureSize_, IGraphicsInterface::R8G8B8A8); velocityRenderTarget_ = GraphicsInterface::createRenderTarget(velocityTextureId_); solver_.setGridSize(size); solver_.setDiffuseRate(0.0f); }
RETURN_CODE readReply (uint16_t length, uint8_t *buffer) { ClearMemory (buffer, length); si468x_readReply(length, buffer); return SUCCESS; }
void PlayDemo (int demonumber) { int length; #ifdef DEMOSEXTERN // debug: load chunk #ifndef SPEARDEMO int dems[4]={T_DEMO0,T_DEMO1,T_DEMO2,T_DEMO3}; #else int dems[1]={T_DEMO0}; #endif CA_CacheGrChunk(dems[demonumber]); demoptr = grsegs[dems[demonumber]]; MM_SetLock (&grsegs[dems[demonumber]],true); #else demoname[4] = '0'+demonumber; CA_LoadFile (demoname,&demobuffer); MM_SetLock (&demobuffer,true); demoptr = (char far *)demobuffer; #endif NewGame (1,0); gamestate.mapon = *demoptr++; gamestate.difficulty = gd_hard; length = *((unsigned far *)demoptr)++; demoptr++; lastdemoptr = demoptr-4+length; VW_FadeOut (); SETFONTCOLOR(0,15); DrawPlayScreen (); VW_FadeIn (); startgame = false; demoplayback = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); #ifdef DEMOSEXTERN UNCACHEGRCHUNK(dems[demonumber]); #else MM_FreePtr (&demobuffer); #endif demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); }
OCStackApplicationResult GetProvisioningStatusResponse(void* /*ctx*/, OCDoHandle /*handle*/, OCClientResponse *clientResponse) { // If user stopped the process then return from this function; if (IsSetupStopped()) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_DELETE_TRANSACTION; } if (!ValidateEnrolleResponse(clientResponse)) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_DELETE_TRANSACTION; } OCRepPayload *input = (OCRepPayload * )(clientResponse->payload); char query[OIC_STRING_MAX_VALUE] = {'\0'}; char resURI[MAX_URI_LENGTH] = {'\0'}; OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", input->uri); strncpy(resURI, input->uri, sizeof(resURI) - 1); snprintf(query, sizeof(query), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr, IP_PORT, resURI); if (ProvisionEnrollee(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, clientResponse->addr, 0) != OC_STACK_OK) { OIC_LOG(INFO, ES_WIFI_PROV_TAG, "GetProvisioningStatusResponse received NULL clientResponse"); ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_DELETE_TRANSACTION; } return OC_STACK_KEEP_TRANSACTION; }
void TIDY_CALL tidyBufClear( TidyBuffer* buf ) { assert( buf != NULL ); if ( buf->bp ) { ClearMemory( buf->bp, buf->allocated ); buf->size = 0; } buf->next = 0; }
void FreeTags( TidyDocImpl* doc ) { TidyTagImpl* tags = &doc->tags; FreeDeclaredTags( doc, 0 ); MemFree( tags->xml_tags ); /* get rid of dangling tag references */ ClearMemory( tags, sizeof(TidyTagImpl) ); }
void tidyBufClear( TidyBuffer* buf ) { assert( buf != null ); if ( buf->bp ) { ClearMemory( buf->bp, buf->allocated ); buf->size = 0; } buf->next = 0; }
void FdoRdbmsLongTransactionReader::Close () // +--------------------------------------------------------------------------- // | The function closes the lock info reader. // +--------------------------------------------------------------------------- { ClearMemory(); } // Close ()
// This is a function called back when a device is discovered OCStackApplicationResult FindProvisioningResourceResponse(void* /*ctx*/, OCDoHandle /*handle*/, OCClientResponse *clientResponse) { OIC_LOG_V(INFO, ES_WIFI_PROV_TAG, "Entering FindProvisioningResourceResponse %s", clientResponse->devAddr.addr); // If user stopped the process then return from this function; if (IsSetupStopped()) { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_DELETE_TRANSACTION; } if (!ValidateFindResourceResponse(clientResponse)) { ErrorCallback(DEVICE_NOT_PROVISIONED); return OC_STACK_DELETE_TRANSACTION; } char szQueryUri[MAX_QUERY_LENGTH] = { 0 }; OCDiscoveryPayload *discoveryPayload = (OCDiscoveryPayload *) (clientResponse->payload); OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", discoveryPayload->resources->uri); #ifdef REMOTE_ARDUINO_ENROLEE //Arduino Enrollee needs mediator application provide IP and port55555 which is specific // to Arduino WiFi enrollee // REMOTE_ARDUINO_ENROLEE has to be defined if Mediator is being tested with Arduino snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr, IP_PORT, discoveryPayload->resources->uri); #else snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROV_STATUS_QUERY, clientResponse->devAddr.addr, clientResponse->devAddr.port, discoveryPayload->resources->uri); #endif OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "query before GetProvisioningStatus call = %s", szQueryUri); if (GetProvisioningStatus(OC_HIGH_QOS, szQueryUri, &clientResponse->devAddr) != OC_STACK_OK) { ErrorCallback(DEVICE_NOT_PROVISIONED); return OC_STACK_DELETE_TRANSACTION; } return OC_STACK_KEEP_TRANSACTION; }
void RecordDemo (void) { int level,esc; CenterWindow(26,3); PrintY+=6; CA_CacheGrChunk(STARTFONT); fontnumber=0; US_Print(" Demo which level(1-10):"); VW_UpdateScreen(); VW_FadeIn (); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (esc) return; level = atoi (str); level--; SETFONTCOLOR(0,15); VW_FadeOut (); #ifndef SPEAR NewGame (gd_hard,level/10); gamestate.mapon = level%10; #else NewGame (gd_hard,0); gamestate.mapon = level; #endif StartDemoRecord (level); DrawPlayScreen (); VW_FadeIn (); startgame = false; demorecord = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); FinishDemoRecord (); }
FdoRdbmsLongTransactionConflictInfo::~FdoRdbmsLongTransactionConflictInfo () // +--------------------------------------------------------------------------- // | The function represents the class destructor. // +--------------------------------------------------------------------------- { // Release the memory occupied by the class variables. ClearMemory (); } // ~FdoRdbmsLongTransactionConflictInfo ()
/*********************************************************************************** set the parameter to default value ************************************************************************************/ RETURN_CODE fm_am_set_parameter_default() { #ifdef OPTION__FM_SHOW_STATION_NAME_PST u8 i; #endif RETURN_CODE ret = SUCCESS; if(work_mode == fmonly) { fm_freq = 8810; fm_freq_step_size = 100; } #ifdef OPTION__INCLUDE_MODE__AM else if(work_mode == am) { am_freq = 1000; am_freq_step_size = 10; } // ClearMemory((u8*)am_pset_table,sizeof(am_pset_table)); #endif ClearMemory((u8*)fm_pset_table,sizeof(fm_pset_table)); #ifdef OPTION__INCLUDE_MODE__AM ClearMemory((u8*)am_pset_table,sizeof(am_pset_table)); #endif #ifdef OPTION__FM_SHOW_STATION_NAME_PST for(i=0;i<MAX_PRESET_NUM;i++) { ClearMemory(fm_pty_pset_table[i],12); } #endif pset_table_index =0; return ret; }
void TIDY_CALL initFileSource( TidyInputSource* inp, FILE* fp ) { FileSource* fin = NULL; inp->getByte = filesrc_getByte; inp->eof = filesrc_eof; inp->ungetByte = filesrc_ungetByte; fin = (FileSource*) MemAlloc( sizeof(FileSource) ); ClearMemory( fin, sizeof(FileSource) ); fin->fp = fp; inp->sourceData = fin; }
//============================================================================== /// Initialisation of variables. //============================================================================== void JDivideCpu::Reset(){ delete[] CellPart; CellPart=NULL; delete[] Parts; Parts=NULL; delete[] VSort; VSort=NULL; delete[] Out; Out=NULL; OutSize=0; ClearMemory(); Np=0; Nbound=0; Nfluid=0; Nfixed=0; Nmoving=0; Nfloat=0; NfluidOut=0; Npb=0; NOutLast=0; Ndivb=0; Ndivf=0; ConfigRhopOut(false,0,0); RhopOutCount=0; CellInfoOk=false; OutClear(); }
int main() { char commonfile[200] = "f:\commonfile.bin"; ClearMemory(commonfile); setServerStarted(commonfile); int Openflag; int Writeflag; int Readflag; int count = 0; getchar(); printf("Waiting for connection....\n"); while (1) { Sleep(1000); if (checkIsClientStarted(commonfile)) { if (count == 0) { printf("Connected to the Client\n"); count++; } if (checkIsClientWrote(commonfile)) { struct Message msg; struct SyncObject s; FILE *file,*serverfile; file = fopen(commonfile, "r+b"); fseek(file, 1024+32, SEEK_SET); fread(&msg, sizeof(struct Message), 1, file); s.isRead = 0; s.isWrite = 0; printf("Client: %s \n", msg.message); printf("Enter your message:"); gets(msg.message); serverfile = fopen(commonfile, "r+b"); fseek(serverfile, 32, SEEK_SET); fwrite(&msg, sizeof(struct SyncObject), 1, serverfile); fclose(serverfile); //getchar(); setServerWrote(commonfile); Sleep(100); fseek(file, 1024, SEEK_SET); fwrite(&s, sizeof(struct SyncObject), 1, file); fclose(file); } } } getchar(); return 0; }
//============================================================================== /// Allocates the memory necessary for each configuration. //============================================================================== void JDivideCpu::ConfigMemory(){ const char met[]="ConfigMemory"; ClearMemory(); try{ PartsInCell=new unsigned[NctTotMax]; BeginBound=new unsigned[NctTotMax+1]; BeginFluid=new unsigned[NctTotMax+1]; } catch(const std::bad_alloc){ RunException(met,"Could not allocate the requested memory."); } memset(BeginBound,0,sizeof(unsigned)*(NctTotMax+1)); memset(BeginFluid,0,sizeof(unsigned)*(NctTotMax+1)); }
OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo, OCProvisioningStatusCB provisioningStatusCallback, char *findResQuery) { if(findResQuery != NULL) { OICStrcpy(szFindResourceQueryUri, sizeof(szFindResourceQueryUri) - 1, findResQuery); } else { OIC_LOG(ERROR, ES_PROV_TAG, PCF("Find resource query is NULL")); goto Error; } pthread_t thread_handle; if (!ValidateEasySetupParams(netInfo, provisioningStatusCallback)) { goto Error; } if (!SetProgress(provisioningStatusCallback)) { // Device provisioning session is running already. OIC_LOG(INFO, ES_PROV_TAG, PCF("Device provisioning session is running already")); goto Error; } if (!ConfigEnrolleeObject(netInfo)) { goto Error; } if (pthread_create(&thread_handle, NULL, FindProvisioningResource, NULL)) { goto Error; } pthread_join(thread_handle, NULL); return OC_STACK_OK; Error: { ErrorCallback(DEVICE_NOT_PROVISIONED); ClearMemory(); return OC_STACK_ERROR; } }
FdoRdbmsCommitLongTransaction::~FdoRdbmsCommitLongTransaction () // +--------------------------------------------------------------------------- // | The function represents the class destructor. // +--------------------------------------------------------------------------- { // Release the memory occupied by the class variables. ClearMemory (); // Reset the connection references. fdo_rdbms_connection = NULL; } // ~FdoRdbmsCommitLongTransaction ()
//-------------------------------------------------------------------------- // ShowQuickInstructions() //-------------------------------------------------------------------------- void ShowQuickInstructions() { ShowQuickMsg=false; if ((demoplayback) || (gamestate.mapon) || (gamestate.flags & GS_QUICKRUN)) return; ThreeDRefresh(); ThreeDRefresh(); ClearMemory(); WindowX=0; WindowY=16; WindowW=320; WindowH=168; CacheMessage(QUICK_INFO1_TEXT); VW_WaitVBL(120); CacheMessage(QUICK_INFO2_TEXT); IN_Ack(); IN_ClearKeysDown(); CleanDrawPlayBorder(); }