static FILE * dpx_open_pk_font_at (const char *ident, unsigned dpi) { FILE *fp; char *fqpn; kpse_glyph_file_type kpse_file_info; fqpn = kpse_find_glyph(ident, dpi, kpse_pk_format, &kpse_file_info); if (!fqpn) return NULL; fp = MFOPEN(fqpn, FOPEN_RBIN_MODE); RELEASE(fqpn); return fp; }
////////////////////////////////////////////////////////////////////////////////// // 建立连接的线程 DWORD WINAPI CClient::_ConnectionThread(LPVOID lpParam) { THREADPARAMS_CONNECTION* pParams = (THREADPARAMS_CONNECTION*) lpParam; CClient* pClient = (CClient*)pParams->pClient; TRACE("_AccpetThread启动,系统监听中...\n"); pClient->EstablishConnections(); TRACE(_T("_ConnectionThread线程结束.\n")); RELEASE(pParams); return 0; }
EXTERN_C BOOL PALAPI CryptDestroyKey( HCRYPTKEY hKey) { if (hKey == NULL) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } RELEASE(hKey); return TRUE; }
// Destructor j1App::~j1App() { // release modules p2List_item<j1Module*>* item = modules.end; while(item != NULL) { RELEASE(item->data); item = item->prev; } modules.clear(); config_file.reset(); }
double Trick::MSSharedMem::read_wait(struct timespec *in_start) { struct timespec ts_Current, ts_Difference; RELEASE(); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts_Current); if ((ts_Current.tv_nsec - in_start->tv_nsec) < 0) { ts_Difference.tv_sec = ts_Current.tv_sec - in_start->tv_sec - 1; ts_Difference.tv_nsec = 1000000000 + ts_Current.tv_nsec - in_start->tv_nsec; } else { ts_Difference.tv_sec = ts_Current.tv_sec - in_start->tv_sec; ts_Difference.tv_nsec = ts_Current.tv_nsec - in_start->tv_nsec; } // return the total elapsed time we've waited since in_start return ((double)ts_Difference.tv_nsec / 1000000000.0) + ts_Difference.tv_sec; }
HRESULT AdjustAudioFrequency(void) { HRESULT hr=NOERROR; IDBOXIICapture *pSource=NULL; IBaseFilter *pAudioResampler=NULL; IAudioResampler *pIAudioResampler=NULL; __int64 val=0; if (gpIGraphBuilder==NULL) return(E_POINTER); if (gpVCap==NULL) return(E_POINTER); hr=gpVCap->QueryInterface(IID_IDBOXIICapture, (void **)&pSource); if (SUCCEEDED(hr)) hr=pSource->getParameter(CMD_GETAUDIOFREQ, &val, NULL); if ( SUCCEEDED(hr) && (val>0) ) { hr = gpIGraphBuilder->FindFilterByName (L"AudioResampler", &pAudioResampler); if (SUCCEEDED(hr)) hr=pAudioResampler->QueryInterface(IID_AudioResampler, (void **)&pIAudioResampler); if (SUCCEEDED(hr)) hr=pIAudioResampler->setParameter(CMD_SOURCE_FREQUENCY, (int)val); } RELEASE(pIAudioResampler); RELEASE(pAudioResampler); RELEASE(pSource); return(hr); }
static void release_a_cmap (int id) { struct cid_sysinfo_s *sysinfo; if (id >= 2 && id < num_cmaps) { if (cmaps[id].CMapName) RELEASE(cmaps[id].CMapName); if (cmaps[id].UseCMap) RELEASE(cmaps[id].UseCMap); if ((sysinfo = cmaps[id].sysinfo) != NULL) { if (sysinfo->registry) RELEASE(sysinfo->registry); if (sysinfo->ordering) RELEASE(sysinfo->ordering); RELEASE(sysinfo); } if (cmaps[id].offsets) RELEASE(cmaps[id].offsets); if (cmaps[id].map) RELEASE(cmaps[id].map); if (cmaps[id].csranges) RELEASE(cmaps[id].csranges); } }
void CqShaderVM::SO_init_illuminance2() { VARFUNC; POPV( A ); POPV( B ); RESULT(type_float, class_varying); if(m_pEnv->IsRunning()) { m_pEnv->InvalidateIlluminanceCache(); m_pEnv->ValidateIlluminanceCache( A, B, this ); pResult->SetFloat( m_pEnv->SO_init_illuminance() ); } Push( pResult ); RELEASE( A ); }
LIB_EXPORT rc_t CC aspera_options(AscpOptions *opt) { KConfig *cfg = NULL; rc_t rc = 0; if (opt == NULL) { return RC(rcNS, rcFile, rcVisiting, rcParam, rcNull); } memset(opt, 0, sizeof *opt); rc = KConfigMake(&cfg, NULL); if (rc == 0) { rc = _KConfigGetAscpRate(cfg, &opt->target_rate); opt->disabled = _KConfigAscpDisabled(cfg, false); } RELEASE(KConfig, cfg); return rc; }
EXTERN_C BOOL PALAPI CryptDestroyHash( HCRYPTHASH hHash) { if (hHash == NULL) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } RELEASE(hHash); return TRUE; }
/** * grant a stack to an address * * TODO: * - Keep various heap pointers around instead of incrementign it every time. */ void * stkmgr_grant_stack(spdid_t d_spdid) { struct cos_stk_item *stk_item; struct spd_stk_info *info; vaddr_t ret; int meas = 0; TAKE(); info = get_spd_stk_info(d_spdid); DOUT("<stkmgr>: stkmgr_grant_stack for, spdid: %d, thdid %d\n", d_spdid, cos_get_thd_id()); // Make sure we have access to the info page if (!SPD_IS_MANAGED(info)) get_cos_info_page(d_spdid); assert(SPD_IS_MANAGED(info)); /* * Is there a stack in the local freelist? If not, is there * one is the global freelist and we are under quota on * stacks? Otherwise block! */ while (NULL == (stk_item = spd_freelist_remove(d_spdid))) { if (info->num_allocated < info->num_desired && NULL != (stk_item = freelist_remove())) { stkmgr_stk_add_to_spd(stk_item, info); break; } if (!meas) { meas = 1; stkmgr_update_stats_block(info, cos_get_thd_id()); } DOUT("Stack list is null, we need to revoke a stack: spdid: %d thdid: %d\n", d_spdid, cos_get_thd_id()); stkmgr_wait_for_stack(info); } if (meas) stkmgr_update_stats_wakeup(info, cos_get_thd_id()); ret = stk_item->d_addr + PAGE_SIZE; RELEASE(); //DOUT("Returning Stack address: %X\n",(unsigned int)ret); return (void *)ret; }
/* * FIXME: 1) reference counting so that components can maintain the * buffer if they please, 2) asynchronous (shmmem) notification of cb * deallocation. */ int cbuf_c_delete(spdid_t spdid, int cbid) { struct spd_tmem_info *sti; int ret = 0; /* return value not used */ TAKE(); sti = get_spd_info(spdid); assert(sti); return_tmem(sti); RELEASE(); return ret; }
void Paint_vdecor(void) { int i; bool last, more_y; if (num_vdecor > 0) { for (i = 0; i < num_vdecor; i++) { last = (i + 1 == num_vdecor); more_y = (vdecor_ptr[i].yi != vdecor_ptr[i + 1].yi); Gui_paint_decor(vdecor_ptr[i].x, vdecor_ptr[i].y, vdecor_ptr[i].xi, vdecor_ptr[i].yi, vdecor_ptr[i].type, last, more_y); } RELEASE(vdecor_ptr, num_vdecor, max_vdecor); } }
//////////////////////////////////////////////////////////////// // 移除某个特定的Context void CIOCPModel::_RemoveContext( PER_SOCKET_CONTEXT *pSocketContext ) { EnterCriticalSection(&m_csContextList); for( int i=0;i<m_arrayClientContext.size();i++ ) { if( pSocketContext==m_arrayClientContext.at(i) ) { RELEASE( pSocketContext ); m_arrayClientContext.at(i); break; } } LeaveCriticalSection(&m_csContextList); }
type *type_attributed(type *ty, attribute *attr) { type *attributed; if(!attr) return ty; attributed = type_uptree_find_or_new( ty, type_attr, eq_attr, init_attr, attr); RELEASE(attr); return attributed; }
update_status MParticle::PreUpdate() { // Remove all colliders scheduled for deletion for (list<Particle*>::iterator it = particles.begin(); it != particles.end();) { if ((*it)->dead == true) { RELEASE(*it); it = particles.erase(it); } else ++it; } return UPDATE_CONTINUE; }
pugi::xml_node j1App::LoadConfig() { pugi::xml_node ret; char* buffer; int size = App->fs->LoadFile("config.xml", &buffer); pugi::xml_parse_result result = config_file.load_buffer(buffer, size); RELEASE(buffer); if (result) ret = config_file.child("config"); else LOG("Could not load config.xml, pugi error: %s", result.description()); return ret; }
DsProcess::~DsProcess(){ RELEASE(pBasicAudio); RELEASE(pMediaPosition); RELEASE(pMediaControl); RELEASE(pVideoWindow); //解放の順番の関係でここに記述 RELEASE(pSampleGrabber); RELEASE(pSampleGrabberFilter); RELEASE(pGraphBuilder); // COM終了 CoUninitialize(); }
void stkmgr_spd_meas_reset(void) { struct spd_stk_info *ssi; int i; TAKE(); for (i = 0 ; i < MAX_NUM_SPDS ; i++) { ssi = get_spd_stk_info(i); if (!ssi) BUG(); if (!SPD_IS_MANAGED(ssi)) continue; stkmgr_reset_stats(ssi); } RELEASE(); }
EXTERN_C BOOL PALAPI CryptReleaseContext( HCRYPTPROV hProv, DWORD dwFlags) { if (hProv == NULL) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } RELEASE(hProv); return TRUE; }
// --------------------------------------------- pugi::xml_node j1App::LoadConfig(pugi::xml_document& config_file) const { pugi::xml_node ret; char* buf; int size = App->fs->Load("config.xml", &buf); pugi::xml_parse_result result = config_file.load_buffer(buf, size); RELEASE(buf); if(result == NULL) LOG("Could not load map xml file config.xml. pugi error: %s", result.description()); else ret = config_file.child("config"); return ret; }
static void release_charpath (t1_chardesc *cd) { t1_cpath *curr, *next; ASSERT(cd); curr = cd->charpath; while (curr != NULL) { next = curr->next; RELEASE(curr); curr = next; } cd->charpath = cd->lastpath = NULL; }
/************************************************************************************************** CHECK_XFER If the "xfer" column exists in the soa table, it should contain a list of wildcards separated by commas. In order for this zone transfer to continue, one of the wildcards must match the client's IP address. **************************************************************************************************/ static void check_xfer(TASK *t, MYDNS_SOA *soa) { SQL_RES *res = NULL; SQL_ROW row = NULL; char ip[256]; char *query = NULL; size_t querylen = 0; int ok = 0; memset(&ip, 0, sizeof(ip)); if (!mydns_soa_use_xfer) return; strncpy(ip, clientaddr(t), sizeof(ip)-1); querylen = sql_build_query(&query, "SELECT xfer FROM %s WHERE id=%u%s%s%s;", mydns_soa_table_name, soa->id, (mydns_rr_use_active)? " AND active='" : "", (mydns_rr_use_active)? mydns_rr_active_types[0] : "", (mydns_rr_use_active)? "'" : ""); res = sql_query(sql, query, querylen); RELEASE(query); if (!res) { ErrSQL(sql, "%s: %s", desctask(t), _("error loading zone transfer access rules")); } if ((row = sql_getrow(res, NULL))) { char *wild = NULL, *r = NULL; for (r = row[0]; !ok && (wild = strsep(&r, ",")); ) { if (strchr(wild, '/')) { if (t->family == AF_INET) ok = in_cidr(wild, t->addr4.sin_addr); } else if (wildcard_match(wild, ip)) ok = 1; } } sql_free(res); if (!ok) { dnserror(t, DNS_RCODE_REFUSED, ERR_NO_AXFR); axfr_reply(t); axfr_error(t, _("access denied")); } }
BOOL CMovie::CreateSurface() { HRESULT hr; DDSURFACEDESC2 ddsd; if(NULL==lpdd){ DirectDrawCreateEx( NULL, (void **)&lpdd, IID_IDirectDraw7, NULL); hr = lpdd->SetCooperativeLevel( sysInf.hWnd, DDSCL_NORMAL ); } if(NULL==lpPrimary){ INIT_DIRECTDRAW_STRUCT(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; hr = lpdd->CreateSurface(&ddsd, &lpPrimary, NULL ); lpdd->CreateClipper(0,&lpClipper,NULL); lpClipper->SetHWnd(0,sysInf.hWnd); lpPrimary->SetClipper(lpClipper); } colorMatch = DDColorMatch(lpPrimary,RGB(0, 0, 8)); if(lpSrcSurface){ if(forccNum<3)lpSrcSurface->UpdateOverlay(NULL, lpPrimary, NULL, DDOVER_HIDE, NULL); RELEASE(lpSrcSurface); } INIT_DIRECTDRAW_STRUCT(ddsd); ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; ddsd.dwFlags= DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT; ddsd.dwWidth=srcWidth; ddsd.dwHeight=srcHeight; ddsd.dwBackBufferCount=0; for(forccNum=0;forccNum<7;forccNum++){ if(forccNum==3){ ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; } ddsd.ddpfPixelFormat = g_ddpfOverlayFormats[forccNum]; if(forccNum>=3){ DDSURFACEDESC2 desc; desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_PIXELFORMAT; hr = lpPrimary->GetSurfaceDesc(&desc); if(memcmp(&desc.ddpfPixelFormat, &ddsd.ddpfPixelFormat, sizeof(DDPIXELFORMAT))!=0)continue; } hr = lpdd->CreateSurface(&ddsd, &lpSrcSurface, NULL); if(hr==DD_OK)break; } if(forccNum==7)return FALSE; return TRUE; } // CMovie::CreateSurface
static void pdf_clean_resource (pdf_res *res) { if (res) { if (res->reference || res->object) WARN("Trying to release un-flushed object."); if (res->reference) pdf_release_obj(res->reference); if (res->object) pdf_release_obj(res->object); if (res->ident) RELEASE(res->ident); res->ident = NULL; res->category = -1; res->flags = 0; } }
static rc_t ReportBuild(const ReportFuncs *f, uint32_t indent, const VDBManager* mgr) { rc_t rc = 0; KNamelist* list = NULL; reportOpen(indent, "Build", 1, "static", 's', "false"); if (mgr) { rc_t rc2 = VDBManagerListExternalSchemaModules(mgr, &list); if (rc2 != 0) { reportError (indent + 1, rc2, "VDBManagerListExternalSchemaModules"); if (rc == 0 && rc2 != 0) { rc = rc2; } } else { uint32_t count = 0; rc2 = KNamelistCount(list, &count); if (rc2 != 0) { reportErrorStr(indent + 1, rc2, "KNamelistCount", "origin", "VDBManagerListExternalSchemaModules"); if (rc == 0 && rc2 != 0) { rc = rc2; } } else { uint32_t i = 0; for (i = 0; i < count && rc2 == 0; ++i) { const char* name = NULL; rc2 = KNamelistGet(list, i, &name); if (rc2 != 0) { reportErrorStr( indent + 1, rc2, "KNamelistGet", "origin", "VDBManagerListExternalSchemaModules"); if (rc == 0 && rc2 != 0) { rc = rc2; } } else { report(indent + 1, "Module", 1, "name", 's', name); } } } } RELEASE(KNamelist, list); reportClose(indent, "Build"); } return rc; }
int pdf_dev_pop_gstate (void) { m_stack *gss = &gs_stack; pdf_gstate *gs; if (m_stack_depth(gss) <= 1) { /* Initial state at bottom */ WARN("Too many grestores."); return -1; } gs = m_stack_pop(gss); clear_a_gstate(gs); RELEASE(gs); return 0; }
//開放する BOOL CMusic::UnInit() { //インターフェイスを開放する RELEASE(m_lpMediaControl); RELEASE(m_lpMediaEvent); RELEASE(m_lpMediaSeeking); RELEASE(m_lpVideoWindow); RELEASE(m_lpBasicVideo); RELEASE(m_lpBasicAudio); //フィルタグラフマネージャを開放する RELEASE(m_lpGraph); return TRUE; }
static void JPEG_info_clear (struct JPEG_info *j_info) { if (j_info->num_appn > 0 && j_info->appn != NULL) { int i; for (i = 0; i < j_info->num_appn; i++) JPEG_release_APPn_data(j_info->appn[i].marker, j_info->appn[i].app_sig, j_info->appn[i].app_data); RELEASE(j_info->appn); } j_info->appn = NULL; j_info->num_appn = 0; j_info->max_appn = 0; j_info->flags = 0; }
static void Paint_objects_radar(void) { int i, x, y, xw, yw, color; for (i = 0; i < num_radar; i++) { int rs = radar_ptr[i].size; unsigned s = (rs <= 0 ? 1 : radar_ptr[i].size); color = WHITE; if (radar_ptr[i].type == RadarFriend) { if (maxColors > 4) color = 4; else if (!colorSwitch) color = RED; } XSetForeground(dpy, radarGC, colors[color].pixel); x = radar_ptr[i].x - s / 2 - slidingradar_x; y = RadarHeight - radar_ptr[i].y - 1 - s / 2 - slidingradar_y; if (x <= 0) x += 256; if (y <= 0) y += RadarHeight; (*radarDrawRectanglePtr)(dpy, radarPixmap, radarGC, x, y, s, s); if (BIT(Setup->mode, WRAP_PLAY)) { xw = (x < 0) ? -256 : (x + s >= 256) ? 256 : 0; yw = (y < 0) ? -RadarHeight : (y + s >= RadarHeight) ? RadarHeight : 0; if (xw != 0) (*radarDrawRectanglePtr)(dpy, radarPixmap, radarGC, x - xw, y, s, s); if (yw != 0) { (*radarDrawRectanglePtr)(dpy, radarPixmap, radarGC, x, y - yw, s, s); if (xw != 0) (*radarDrawRectanglePtr)(dpy, radarPixmap, radarGC, x - xw, y - yw, s, s); } } /*XSetForeground(dpy, radarGC, colors[WHITE].pixel);*/ } if (num_radar) RELEASE(radar_ptr, num_radar, max_radar); }