//***************************************************************************** // //***************************************************************************** bool Translate_Read(u32 idx, const char * dir) { /// Always unload previous language file if available Translate_Unload(); if( idx > gLanguage.size() ) return false; const char * ext( ".lng" ); char line[1024]; IO::Filename path; char *string; FILE *stream; u32 count = 0; u32 hash = 0; u32 len = 0; // Build path where we'll load the translation file(s) strcpy(path, dir); strcat(path, gLanguage[ idx ].c_str()); strcat(path, ext); stream = fopen(path,"r"); if( stream == NULL ) { return false; } while( fgets(line, 1023, stream) ) { // Strip spaces from end of lines Tidy(line); // Handle comments if (line[0] == '/') continue; string = strchr(line,','); if( string != NULL ) { string++; len = strlen( string ); sscanf( line,"%08x", &hash ); if( count < ARRAYSIZE(text) ) { // Write translated string and hash to array text[count].hash = hash; Translate_Dump( string, hash == TRANSLATE_DUMP_VALUE ); text[count].translated = (char*)malloc_volatile(len+1); // Leave space for terminator strcpy( text[count].translated, Restore( string, len ) ); count++; } } } fclose(stream); return true; }
void cgl::CGLManager::Shutdown() { // destroy objects that are garbage Tidy(); // destroy the rest CleanUp(); }
MFX::PluginModule & MFX::PluginModule::operator = (const MFX::PluginModule & that) { if (this != &that) { Tidy(); mHmodule = mfx_dll_load(that.mPath); mCreatePluginPtr = that.mCreatePluginPtr; msdk_disp_char_cpy_s(mPath, sizeof(mPath) / sizeof(*mPath), that.mPath); } return *this; }
void CWsObjectIx::Remove(CWsObject* anObj) { const TWsObject* ptr=FirstObject(); const TWsObject* end=ptr+iObjectArray.Count(); WS_ASSERT_DEBUG(ptr->iObject==NULL, EWsPanicObjectIndexError); while(++ptr<end) { if (ptr->iObject==anObj) { Remove(ptr); Tidy(); return; } } }
MFX::PluginModule::~PluginModule(void) { Tidy(); }