XM_MainRole::~XM_MainRole() { _DELETE(_eastLeaf); _DELETE(_westLeaf); _DELETE(_northLeaf); _DELETE(_southLeaf); }
char * sql_grant_role(mvc *m, str grantee, str auth /*, grantor?, admin? */ ) { oid rid; sql_schema *sys = find_sql_schema(m->session->tr, "sys"); sql_table *auths = find_sql_table(sys, "auths"); sql_table *roles = find_sql_table(sys, "user_role"); sql_column *auths_name = find_sql_column(auths, "name"); sql_column *auths_id = find_sql_column(auths, "id"); void *auth_id, *grantee_id; rid = table_funcs.column_find_row(m->session->tr, auths_name, grantee, NULL); if (rid == oid_nil) return sql_message("M1M05!GRANT: cannot grant ROLE '%s' to ROLE '%s'", grantee, auth ); grantee_id = table_funcs.column_find_value(m->session->tr, auths_id, rid); rid = table_funcs.column_find_row(m->session->tr, auths_name, auth, NULL); if (rid == oid_nil) { _DELETE(grantee_id); return sql_message("M1M05!GRANT: cannot grant ROLE '%s' to ROLE '%s'", grantee, auth ); } auth_id = table_funcs.column_find_value(m->session->tr, auths_id, rid); table_funcs.table_insert(m->session->tr, roles, grantee_id, auth_id); _DELETE(grantee_id); _DELETE(auth_id); return NULL; }
char * sql_revoke_role(mvc *m, str grantee, str auth) /* grantee no longer belongs the role (auth) */ { oid rid; sql_schema *sys = find_sql_schema(m->session->tr, "sys"); sql_table *auths = find_sql_table(sys, "auths"); sql_table *roles = find_sql_table(sys, "user_role"); sql_column *auths_name = find_sql_column(auths, "name"); sql_column *auths_id = find_sql_column(auths, "id"); sql_column *role_id = find_sql_column(roles, "role_id"); sql_column *login_id = find_sql_column(roles, "login_id"); void *auth_id, *grantee_id; rid = table_funcs.column_find_row(m->session->tr, auths_name, grantee, NULL); if (rid == oid_nil) return sql_message("42M32!REVOKE: no such role '%s' or grantee '%s'", auth, grantee); grantee_id = table_funcs.column_find_value(m->session->tr, auths_id, rid); rid = table_funcs.column_find_row(m->session->tr, auths_name, auth, NULL); if (rid == oid_nil) { _DELETE(grantee_id); return sql_message("42M32!REVOKE: no such role '%s' or grantee '%s'", auth, grantee); } auth_id = table_funcs.column_find_value(m->session->tr, auths_id, rid); rid = table_funcs.column_find_row(m->session->tr, login_id, grantee_id, role_id, auth_id, NULL); table_funcs.table_delete(m->session->tr, roles, rid); _DELETE(grantee_id); _DELETE(auth_id); return NULL; }
void XM_MainRole::ClearLeaf() { _DELETE(_eastLeaf); _DELETE(_westLeaf); _DELETE(_northLeaf); _DELETE(_southLeaf); }
DocumentFieldList::~DocumentFieldList(){ //Func - Destructor //Pre - true //Post - Instance has been destroyed _DELETE(next); _DELETE(field); }
virtual ~CParticleSystem() { sys::info << "ogl::CParticleSystem::~CParticleSystem()" << sys::endl; _DELETE(mRandomTexture); _DELETE(mDiffuseTexture); _DELETE(mUpdateProgram); _DELETE(mRenderProgram); glDeleteTransformFeedbacks(2, mTBOs); glDeleteBuffers(2, mVBOs); }
str monet5_user_get_def_schema(mvc *m, int user) { oid rid; sqlid schema_id; sql_schema *sys = NULL; sql_table *user_info = NULL; sql_column *users_name = NULL; sql_column *users_schema = NULL; sql_table *schemas = NULL; sql_column *schemas_name = NULL; sql_column *schemas_id = NULL; sql_table *auths = NULL; sql_column *auths_id = NULL; sql_column *auths_name = NULL; void *p = 0; str username = NULL; str schema = NULL; sys = find_sql_schema(m->session->tr, "sys"); auths = find_sql_table(sys, "auths"); auths_id = find_sql_column(auths, "id"); auths_name = find_sql_column(auths, "name"); rid = table_funcs.column_find_row(m->session->tr, auths_id, &user, NULL); if (!is_oid_nil(rid)) username = table_funcs.column_find_value(m->session->tr, auths_name, rid); user_info = find_sql_table(sys, "db_user_info"); users_name = find_sql_column(user_info, "name"); users_schema = find_sql_column(user_info, "default_schema"); rid = table_funcs.column_find_row(m->session->tr, users_name, username, NULL); if (!is_oid_nil(rid)) p = table_funcs.column_find_value(m->session->tr, users_schema, rid); _DELETE(username); assert(p); schema_id = *(sqlid *) p; _DELETE(p); schemas = find_sql_table(sys, "schemas"); schemas_name = find_sql_column(schemas, "name"); schemas_id = find_sql_column(schemas, "id"); rid = table_funcs.column_find_row(m->session->tr, schemas_id, &schema_id, NULL); if (!is_oid_nil(rid)) schema = table_funcs.column_find_value(m->session->tr, schemas_name, rid); if(!stack_set_string(m, "current_schema", schema)) return NULL; return schema; }
void onStop() { sys::info << "app::COGLDev45AmbientOcclusionApp::onStop()" << sys::endl; _DELETE(pScene); _DELETE(pRenderer); _DELETE(pCameraController); _DELETE(pBox); ogl::CProgramManager::freeInstance(); app::CEventManager::freeInstance(); ogl::CTransformHistory::freeInstance(); ogl::CShadowManager::freeInstance(); }
void init_programs() { ogl::CProgramManager* pManager = ogl::CProgramManager::getInstance(); ogl::CXmlProgramBuilder* pBuilder = new ogl::CXmlProgramBuilder; { /* shadow + shadowmap + pcf */ pBuilder->setFile("shadow/shadowmap.pcf.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::SHADOW + ogl::tags::SHADOWMAP + ogl::tags::PCF); } { /* geometry + deferred + single */ pBuilder->setFile("geometry/deferred.single.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::GEOMETRY + ogl::tags::DEFERRED + ogl::tags::SINGLE); } { /* geometry + deferred + single + parallax */ pBuilder->setFile("geometry/deferred.single.parallax.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::GEOMETRY + ogl::tags::DEFERRED + ogl::tags::SINGLE + ogl::tags::PARALLAX); } { /* geometry + deferred + debug */ pBuilder->setFile("geometry/deferred.debug.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::GEOMETRY + ogl::tags::DEFERRED + ogl::tags::DEBUG); } { /* lighting + deferred */ pBuilder->setFile("lighting/deferred.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::LIGHTING + ogl::tags::DEFERRED); } { /* lighting + deferred + debug */ pBuilder->setFile("lighting/deferred.debug.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::LIGHTING + ogl::tags::DEFERRED + ogl::tags::DEBUG); } { /* lighting + deferred + occlussion */ pBuilder->setFile("lighting/deferred.occlussion.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::LIGHTING + ogl::tags::DEFERRED + ogl::tags::OCCLUSSION); } { /* occlussion + deferred */ pBuilder->setFile("occlussion/deferred.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::OCCLUSSION + ogl::tags::DEFERRED); } { /* postprocess + blur */ pBuilder->setFile("postprocess/blur.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::POSTPROCESS + ogl::tags::BLUR); } { /* output + deferred + texture */ pBuilder->setFile("output/deferred.texture.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::OUTPUT + ogl::tags::DEFERRED + ogl::tags::TEXTURE); } { /* quad + test */ pBuilder->setFile("quad/test.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::QUAD + ogl::tags::TEST); } { /* debug + normals */ pBuilder->setFile("debug/normals.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::DEBUG + ogl::tags::NORMALS); } { /* debug + normals + deferred */ pBuilder->setFile("debug/depth.deferred.xml"); pManager->addProgram(pBuilder->build(), ogl::tags::DEBUG + ogl::tags::DEPTH + ogl::tags::DEFERRED); } _DELETE(pBuilder); }
void buildTextures(ogl::CShape* const& pShape, const pugi::xml_node& _textures) { ogl::CTgaTextureBuilder* pTgaTextureBuilder = new ogl::CTgaTextureBuilder; for(pugi::xml_node _texture = _textures.first_child(); _texture; _texture = _texture.next_sibling()) { pugi::xml_attribute _scope = _texture.attribute("scope"); pugi::xml_attribute _src = _texture.attribute("src"); if(!_scope || !_src) throw EXCEPTION << "<texture scope=\"?\" src=\"?\"> attributes are mandatory!"; pTgaTextureBuilder->setFile(_src.value()); if(strncmp(_scope.value(), "diffuse", 7) == 0) { pShape->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTgaTextureBuilder->build()); } else if(strncmp(_scope.value(), "normals", 7) == 0) { pShape->getMaterial()->setTexture(ogl::CTexture::EScope::NORMALS, pTgaTextureBuilder->build()); } else if(strncmp(_scope.value(), "height", 5) == 0) { pShape->getMaterial()->setTexture(ogl::CTexture::EScope::HEIGHT, pTgaTextureBuilder->build()); } else { throw EXCEPTION << "<texture scope=\"" << _scope.value() << "\" > Not supported!"; } } _DELETE(pTgaTextureBuilder); }
seqbulk *seqbulk_create(sql_sequence *seq, BUN cnt) { seqbulk *sb = MNEW(seqbulk); store_sequence *s; node *n = NULL; if (!sb) return NULL; store_lock(); sb->seq = seq; sb->cnt = cnt; sb->save = 0; for ( n = sql_seqs->h; n; n = n ->next ) { s = n->data; if (s->seqid == seq->base.id) break; } if (!n) { s = sql_create_sequence(seq); if (!s) { _DELETE(sb); store_unlock(); return NULL; } list_append(sql_seqs, s); } else { s = n->data; } sb->internal_seq = s; return sb; }
static int sql_grantable_(mvc *m, int grantorid, int obj_id, int privs, int sub) { oid rid; sql_schema *sys = find_sql_schema(m->session->tr, "sys"); sql_table *prvs = find_sql_table(sys, "privileges"); sql_column *priv_obj = find_sql_column(prvs, "obj_id"); sql_column *priv_auth = find_sql_column(prvs, "auth_id"); sql_column *priv_priv = find_sql_column(prvs, "privileges"); sql_column *priv_allowed = find_sql_column(prvs, "grantable"); int priv; (void) sub; for (priv = 1; priv < privs; priv <<= 1) { if (!(priv & privs)) continue; rid = table_funcs.column_find_row(m->session->tr, priv_obj, &obj_id, priv_auth, &grantorid, priv_priv, &priv, NULL); if (rid != oid_nil) { void *p = table_funcs.column_find_value(m->session->tr, priv_allowed, rid); int allowed = *(int *)p; _DELETE(p); /* switch of priv bit */ if (allowed) privs = (privs & ~priv); } } if (privs != 0) return 0; return 1; }
int mvc_set_role(mvc *m, char *role) { oid rid; sql_schema *sys = find_sql_schema(m->session->tr, "sys"); sql_table *auths = find_sql_table(sys, "auths"); sql_column *auths_name = find_sql_column(auths, "name"); int res = 0; if (m->debug&1) fprintf(stderr, "mvc_set_role %s\n", role); rid = table_funcs.column_find_row(m->session->tr, auths_name, role, NULL); if (rid != oid_nil) { sql_table *roles = find_sql_table(sys, "user_role"); sql_column *role_id = find_sql_column(roles, "role_id"); sql_column *login_id = find_sql_column(roles, "login_id"); sql_column *auths_id = find_sql_column(auths, "id"); void *p = table_funcs.column_find_value(m->session->tr, auths_id, rid); int id = *(int *)p; _DELETE(p); rid = table_funcs.column_find_row(m->session->tr, login_id, &m->user_id, role_id, &id, NULL); if (rid != oid_nil) { m->role_id = id; res = 1; } } return res; }
char * sql_create_user(mvc *sql, char *user, char *passwd, char enc, char *fullname, char *schema) { char *err; int schema_id = 0; if (backend_find_user(sql, user) >= 0) { return sql_message("42M31!CREATE USER: user '%s' already exists", user); } if ((schema_id = sql_find_schema(sql, schema)) < 0) { return sql_message("3F000!CREATE USER: no such schema '%s'", schema); } if ((err = backend_create_user(sql, user, passwd, enc, fullname, schema_id, sql->user_id)) != NULL) { /* strip off MAL exception decorations */ char *r; char *e = err; if ((e = strchr(e, ':')) == NULL) { e = err; } else if ((e = strchr(++e, ':')) == NULL) { e = err; } else { e++; } r = sql_message("M0M27!CREATE USER: %s", e); _DELETE(err); return r; } return NULL; }
static int monet5_drop_user(ptr _mvc, str user) { mvc *m = (mvc *) _mvc; oid rid; sql_schema *sys; sql_table *users; sql_column *users_name; str err; Client c = MCgetClient(m->clientid); err = AUTHremoveUser(c, user); if (err !=MAL_SUCCEED) { (void) sql_error(m, 02, "DROP USER: %s", getExceptionMessage(err)); _DELETE(err); return FALSE; } sys = find_sql_schema(m->session->tr, "sys"); users = find_sql_table(sys, "db_user_info"); users_name = find_sql_column(users, "name"); rid = table_funcs.column_find_row(m->session->tr, users_name, user, NULL); if (!is_oid_nil(rid)) table_funcs.table_delete(m->session->tr, users, rid); /* FIXME: We have to ignore this inconsistency here, because the * user was already removed from the system authorisation. Once * we have warnings, we could issue a warning about this * (seemingly) inconsistency between system and sql shadow * administration. */ return TRUE; }
void Framework::Close() { m_init = false; m_render->Shutdown(); _DELETE(m_render); _CLOSE(m_wnd); _CLOSE(m_input); }
void init_scene() { app::CXmlSceneBuilder* pSceneBuilder = new app::CXmlSceneBuilder; pSceneBuilder->setFile("default.xml"); // scene should be merged with its cached version(save file) pScene = pSceneBuilder->build(); _DELETE(pSceneBuilder); }
void stack_pop_frame(mvc *sql) { while(sql->vars[--sql->topvars].s) { sql_var *v = &sql->vars[sql->topvars]; _DELETE(v->name); VALclear(&v->value); v->value.vtype = 0; if (v->type.comp_type && v->view) table_destroy(v->type.comp_type); else if (v->s && v->view) rel_destroy(v->s); } if (sql->topvars && sql->vars[sql->topvars].name) _DELETE(sql->vars[sql->topvars].name); sql->frame--; }
void SegmentTermPositions::seek(Term* term){ //todo: hack!!! //supposed to call base class which calls seek(terminfo) of this class //but base class is not calling this class (calls it's own implementation) - grrr!!! //SegmentTermDocs::seek(term); (used to be just this line) TermInfo* ti = ((SegmentReader*)parent)->tis->get(*term); seek(ti); _DELETE(ti); };
static void node_destroy(list *l, node *n) { if (n->data && l->destroy) { l->destroy(n->data); n->data = NULL; } if (!l->sa) _DELETE(n); }
void stack_pop_until(mvc *sql, int top) { while(sql->topvars > top) { sql_var *v = &sql->vars[--sql->topvars]; _DELETE(v->name); VALclear(&v->value); v->value.vtype = 0; } }
void seqbulk_destroy(seqbulk *sb) { if (sb->save) { sql_sequence *seq = sb->seq; store_sequence *s = sb->internal_seq; sql_update_sequence_cache(seq, s->cached); } _DELETE(sb); store_unlock(); }
void stack_set_string(mvc *sql, const char *name, const char *val) { ValRecord *v = stack_get_var(sql, name); if (v != NULL) { if (v->val.sval) _DELETE(v->val.sval); v->val.sval = _STRDUP(val); } }
void Stage_1::Uninit() { for( _TaskIterator i( ListObj.Enemy ); i.HasNext(); ) { Character* chara = static_cast< Character* >( i.Next() ); chara->Uninit(); i.Remove(); } for( _TaskIterator i( ListObj.Player ); i.HasNext(); ) { Character* chara = static_cast< Character* >( i.Next() ); chara->Uninit(); i.Remove(); } _DELETE( DrawBase ); _DELETE( ListObj.Enemy ); _DELETE( ListObj.Player ); _DELETE( ListObj.Bullet ); }
// Takes the first request and responds as ACK. // Assuming all the errors are checked at the coordinator-server char * exec_rqst(char * request){ printf("Executing Request : %s\n", request); /* code to validate the request*/ const char s[2] = ":"; char *token; /* get the first token */ token = strtok(request, s); char allTokens[3][26]; int i = 0; while( token != NULL && i < 3) { printf("%s\n", token); strcpy(allTokens[i],token); token = strtok(NULL, s); i++; } if(strcmp(allTokens[0],"GET") == 0){ // callLog("Called method GET \n", log_filename); printf("Called method GET\n"); int key = atoi(allTokens[1]); char *getValue = _GET(key); // send(newsock, getValue, strlen(getValue), 0); FILE *fp = fopen(GET_FILE, "w"); fputs(getValue, fp); fclose(fp); } else if(strcmp(allTokens[0],"PUT") == 0){ // callLog("Called method PUT \n", log_filename); printf("Inside PUT %s %s\n", allTokens[1], allTokens[2]); bool putValue = _PUT(atoi(allTokens[1]), allTokens[2]); if(putValue){ // callLog("Successfully Updated\n", log_filename); return "COMMIT"; } else{ // callLog("Error in updating \n", log_filename); return "PUT_ERROR"; } } else if(strcmp(allTokens[0],"DELETE") == 0){ printf("Inside DELETE\n"); bool delValue = _DELETE(atoi(allTokens[1])); if(delValue){ return "COMMIT"; } else{ return "DELETE_ERROR"; } } return "UN_KNOWN_REQUEST"; }
void SegmentTermPositions::close() { //Func - Frees the resources //Pre - true //Post - The resources have been freed SegmentTermDocs::close(); //Check if proxStream still exists if(proxStream){ proxStream->close(); _DELETE( proxStream ); } }
void onStop() { sys::info << "app::COGLDev42PCFShadowMapApp::onStop()" << sys::endl; _DELETE(pDirectLight); _DELETE(pPointLight); _DELETE(pSpotLight); _DELETE(pCamera); _DELETE(pCameraController); _DELETE(pRenderer); _DELETE(pObjectP); _DELETE(pObjectB); _DELETE(pObject0); _DELETE(pObject1); ogl::CProgramManager::freeInstance(); app::CEventManager::freeInstance(); ogl::CTransformHistory::freeInstance(); }
void onStop() { sys::info << "app::COGLDev10TessellationApp::onStop()" << sys::endl; _DELETE(pProgramTessellation0); _DELETE(pProgramTessellation1); _DELETE(pObjectP); _DELETE(pObject0); _DELETE(pDirectLight); _DELETE(pCamera); _DELETE(pCameraController); _DELETE(pDrawRenderer); }
void mvc_destroy(mvc *m) { sql_trans *tr; if (mvc_debug) fprintf(stderr, "#mvc_destroy\n"); tr = m->session->tr; if (tr) { store_lock(); if (m->session->active) sql_trans_end(m->session); while (tr->parent) tr = sql_trans_destroy(tr); m->session->tr = NULL; store_unlock(); } sql_session_destroy(m->session); stack_pop_until(m, 0); _DELETE(m->vars); if (m->scanner.log) /* close and destroy stream */ close_stream(m->scanner.log); if (m->sa) sa_destroy(m->sa); m->sa = NULL; if (m->qc) qc_destroy(m->qc); m->qc = NULL; _DELETE(m->args); m->args = NULL; _DELETE(m); }
void Sequence::Uninitialize() { if( Obj ) { Obj->Uninit(); _DELETE( Obj ); } Input_device->Uninitalize(); RELEASE( pSprite ); RELEASE( pD3Ddevice ); RELEASE( pD3D ); ResetObjectBox(); Sound::ReleaseDirectSound(); CoUninitialize(); }