functionSource
stringlengths
20
97.4k
CWE-119
bool
2 classes
CWE-120
bool
2 classes
CWE-469
bool
2 classes
CWE-476
bool
2 classes
CWE-other
bool
2 classes
combine
int64
0
1
window_slide_up(Win *win, int lines) { Cursor *cursor = &win->cursor; if (window_viewport_down(win, lines)) { if (cursor->line == win->topline) window_cursor_set(win, win->topline, cursor->col); else window_cursor_to(win, cursor->pos); } else { window_screenline_down(win); } return cursor->pos; }
false
false
false
false
false
0
OnRead() { uint8 _cmd; while (1) { if(!recv_soft((char *)&_cmd, 1)) return; size_t i; ///- Circle through known commands and call the correct command handler for (i = 0; i < AUTH_TOTAL_COMMANDS; ++i) { if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED))) { DEBUG_LOG("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)recv_len()); if (!(*this.*table[i].handler)()) { DEBUG_LOG("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)recv_len()); return; } break; } } ///- Report unknown commands in the debug log if (i == AUTH_TOTAL_COMMANDS) { DEBUG_LOG("[Auth] got unknown packet %u", (uint32)_cmd); return; } } }
false
false
false
false
false
0
gkm_object_destroy (GkmObject *self, GkmTransaction *transaction) { GkmSession *session; GkmManager *manager; GkmModule *module; g_return_if_fail (GKM_IS_OBJECT (self)); g_return_if_fail (GKM_IS_TRANSACTION (transaction)); g_return_if_fail (!gkm_transaction_get_failed (transaction)); g_return_if_fail (self->pv->module); g_object_ref (self); session = gkm_session_for_session_object (self); if (session != NULL) { gkm_session_destroy_session_object (session, transaction, self); } else { manager = gkm_object_get_manager (self); module = gkm_object_get_module (self); if (manager == gkm_module_get_manager (module)) gkm_module_remove_token_object (module, transaction, self); } /* Forcefully dispose of the object once the transaction completes */ gkm_transaction_add (transaction, NULL, complete_destroy, g_object_ref (self)); g_object_unref (self); }
false
false
false
false
false
0
brcmf_chip_sb_resetcore(struct brcmf_core_priv *core, u32 prereset, u32 reset, u32 postreset) { struct brcmf_chip_priv *ci; u32 regdata; u32 base; ci = core->chip; base = core->pub.base; /* * Must do the disable sequence first to work for * arbitrary current core state. */ brcmf_chip_sb_coredisable(core, 0, 0); /* * Now do the initialization sequence. * set reset while enabling the clock and * forcing them on throughout the core */ ci->ops->write32(ci->ctx, CORE_SB(base, sbtmstatelow), SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET); regdata = ci->ops->read32(ci->ctx, CORE_SB(base, sbtmstatelow)); udelay(1); /* clear any serror */ regdata = ci->ops->read32(ci->ctx, CORE_SB(base, sbtmstatehigh)); if (regdata & SSB_TMSHIGH_SERR) ci->ops->write32(ci->ctx, CORE_SB(base, sbtmstatehigh), 0); regdata = ci->ops->read32(ci->ctx, CORE_SB(base, sbimstate)); if (regdata & (SSB_IMSTATE_IBE | SSB_IMSTATE_TO)) { regdata &= ~(SSB_IMSTATE_IBE | SSB_IMSTATE_TO); ci->ops->write32(ci->ctx, CORE_SB(base, sbimstate), regdata); } /* clear reset and allow it to propagate throughout the core */ ci->ops->write32(ci->ctx, CORE_SB(base, sbtmstatelow), SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK); regdata = ci->ops->read32(ci->ctx, CORE_SB(base, sbtmstatelow)); udelay(1); /* leave clock enabled */ ci->ops->write32(ci->ctx, CORE_SB(base, sbtmstatelow), SSB_TMSLOW_CLOCK); regdata = ci->ops->read32(ci->ctx, CORE_SB(base, sbtmstatelow)); udelay(1); }
false
false
false
false
false
0
GetAPIURL() const { const char* pszAPIURL = CPLGetConfigOption("GFT_API_URL", NULL); if (pszAPIURL) return pszAPIURL; else if (bUseHTTPS) return "https://www.googleapis.com/fusiontables/v1/query"; else return "http://www.googleapis.com/fusiontables/v1/query"; }
false
false
false
false
false
0
send(const void* buf, size_t size) { long sSize; if (!fEncrypted) { sSize = pnSocket::send(buf, size); } else { unsigned char* cBuf = new unsigned char[size]; fSendLock.lock(); RC4(&fSend, size, (const unsigned char*)buf, cBuf); sSize = pnSocket::send(cBuf, size); fSendLock.unlock(); delete[] cBuf; } return sSize; }
false
false
false
false
false
0
bdx_sw_reset(struct bdx_priv *priv) { int i; ENTER; /* 1. load MAC (obsolete) */ /* 2. disable Rx (and Tx) */ WRITE_REG(priv, regGMAC_RXF_A, 0); mdelay(100); /* 3. disable port */ WRITE_REG(priv, regDIS_PORT, 1); /* 4. disable queue */ WRITE_REG(priv, regDIS_QU, 1); /* 5. wait until hw is disabled */ for (i = 0; i < 50; i++) { if (READ_REG(priv, regRST_PORT) & 1) break; mdelay(10); } if (i == 50) netdev_err(priv->ndev, "SW reset timeout. continuing anyway\n"); /* 6. disable intrs */ WRITE_REG(priv, regRDINTCM0, 0); WRITE_REG(priv, regTDINTCM0, 0); WRITE_REG(priv, regIMR, 0); READ_REG(priv, regISR); /* 7. reset queue */ WRITE_REG(priv, regRST_QU, 1); /* 8. reset port */ WRITE_REG(priv, regRST_PORT, 1); /* 9. zero all read and write pointers */ for (i = regTXD_WPTR_0; i <= regTXF_RPTR_3; i += 0x10) DBG("%x = %x\n", i, READ_REG(priv, i) & TXF_WPTR_WR_PTR); for (i = regTXD_WPTR_0; i <= regTXF_RPTR_3; i += 0x10) WRITE_REG(priv, i, 0); /* 10. unseet port disable */ WRITE_REG(priv, regDIS_PORT, 0); /* 11. unset queue disable */ WRITE_REG(priv, regDIS_QU, 0); /* 12. unset queue reset */ WRITE_REG(priv, regRST_QU, 0); /* 13. unset port reset */ WRITE_REG(priv, regRST_PORT, 0); /* 14. enable Rx */ /* skiped. will be done later */ /* 15. save MAC (obsolete) */ for (i = regTXD_WPTR_0; i <= regTXF_RPTR_3; i += 0x10) DBG("%x = %x\n", i, READ_REG(priv, i) & TXF_WPTR_WR_PTR); RET(0); }
false
false
false
false
false
0
nfs3_readdir_process (nfs3_call_state_t *cs) { int ret = -EFAULT; nfs_user_t nfu = {0, }; if (!cs) return ret; nfs_request_user_init (&nfu, cs->req); ret = nfs_readdirp (cs->nfsx, cs->vol, &nfu, cs->fd, cs->dircount, cs->cookie, nfs3svc_readdir_cbk, cs); return ret; }
false
false
false
false
false
0
add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRING(tmp, str, duplicate); return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); }
false
false
false
false
false
0
parse_tcp_mssvalue(const char *mssvalue) { unsigned int mssvaluenum; if (xtables_strtoui(mssvalue, NULL, &mssvaluenum, 0, UINT16_MAX)) return mssvaluenum; xtables_error(PARAMETER_PROBLEM, "Invalid mss `%s' specified", mssvalue); }
false
false
false
false
false
0
pyepoll_internal_close(pyEpoll_Object *self) { int save_errno = 0; if (self->epfd >= 0) { int epfd = self->epfd; self->epfd = -1; Py_BEGIN_ALLOW_THREADS if (close(epfd) < 0) save_errno = errno; Py_END_ALLOW_THREADS } return save_errno; }
false
false
false
false
false
0
_gnutls_x509_write_value (ASN1_TYPE c, const char *root, const gnutls_datum_t * data, int str) { int result; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; gnutls_datum_t val = { NULL, 0 }; if (str) { /* Convert it to OCTET STRING */ if ((result = asn1_create_element (_gnutls_get_pkix (), "PKIX1.pkcs-7-Data", &c2)) != ASN1_SUCCESS) { gnutls_assert (); result = _gnutls_asn2err (result); goto cleanup; } result = asn1_write_value (c2, "", data->data, data->size); if (result != ASN1_SUCCESS) { gnutls_assert (); result = _gnutls_asn2err (result); goto cleanup; } result = _gnutls_x509_der_encode (c2, "", &val, 0); if (result < 0) { gnutls_assert (); goto cleanup; } } else { val.data = data->data; val.size = data->size; } /* Write the data. */ result = asn1_write_value (c, root, val.data, val.size); if (result != ASN1_SUCCESS) { gnutls_assert (); result = _gnutls_asn2err (result); goto cleanup; } result = 0; cleanup: asn1_delete_structure (&c2); if (val.data != data->data) _gnutls_free_datum (&val); return result; }
false
false
false
false
false
0
crypto_aead_decrypt( unsigned char *m,unsigned long long *mlen, unsigned char *nsec, const unsigned char *c,unsigned long long clen, const unsigned char *ad,unsigned long long adlen, const unsigned char *npub, const unsigned char *k ) { hs1siv_ctx_t ctx; (void)nsec; if (mlen) *mlen = clen-CRYPTO_ABYTES; hs1siv_subkeygen(&ctx, (void *)k, CRYPTO_KEYBYTES); return hs1siv_decrypt(&ctx, (void *)c, clen-CRYPTO_ABYTES, (void *)ad, adlen, (void *)npub, (void *)(c+clen-CRYPTO_ABYTES), m); }
false
false
false
false
false
0
alloc_avg(avg_data_t *avgdata, int width, int depth) { int i,j; avgdata->avgwidth = width; avgdata->avgdepth = depth; avgdata->avgarray = malloc(width*sizeof(double)); for (i=0; i<width; i++) { avgdata->avgarray[i] = (double *) malloc(depth*sizeof(double)); for (j=0; j<depth; j++) avgdata->avgarray[i][j] = 0.0; } avgdata->avg = (double *) malloc(width*sizeof(double)); avgdata->cum = (double *) malloc(width*sizeof(double)); for (i=0; i<width; i++) { avgdata->avg[i] = 0.0; avgdata->cum[i] = 0.0; } avgdata->effdepth = 0; }
false
true
false
false
true
1
gotoInstance(const OFString &instanceUID) { InstanceStruct *instance = NULL; /* start with the first list item */ Iterator = SeriesList.begin(); const OFListIterator(SeriesStruct *) last = SeriesList.end(); /* search for given series UID */ while ((Iterator != last) && (instance == NULL)) { SeriesStruct *series = OFstatic_cast(SeriesStruct *, *Iterator); /* continue search on instance level */ if (series != NULL) instance = series->gotoInstance(instanceUID); /* if found exit loop, else goto next */ if (instance == NULL) Iterator++; } return instance; }
false
false
false
false
false
0
keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key) { ItemPointerData minItem; ItemPointerData curPageLossy; uint32 i; uint32 lossyEntry; bool haveLossyEntry; GinScanEntry entry; bool res; MemoryContext oldCtx; Assert(!key->isFinished); /* * Find the minimum of the active entry curItems. * * Note: a lossy-page entry is encoded by a ItemPointer with max value for * offset (0xffff), so that it will sort after any exact entries for the * same page. So we'll prefer to return exact pointers not lossy * pointers, which is good. */ ItemPointerSetMax(&minItem); for (i = 0; i < key->nentries; i++) { entry = key->scanEntry[i]; if (entry->isFinished == FALSE && ginCompareItemPointers(&entry->curItem, &minItem) < 0) minItem = entry->curItem; } if (ItemPointerIsMax(&minItem)) { /* all entries are finished */ key->isFinished = TRUE; return; } /* * We might have already tested this item; if so, no need to repeat work. * (Note: the ">" case can happen, if minItem is exact but we previously * had to set curItem to a lossy-page pointer.) */ if (ginCompareItemPointers(&key->curItem, &minItem) >= 0) return; /* * OK, advance key->curItem and perform consistentFn test. */ key->curItem = minItem; /* * Lossy-page entries pose a problem, since we don't know the correct * entryRes state to pass to the consistentFn, and we also don't know what * its combining logic will be (could be AND, OR, or even NOT). If the * logic is OR then the consistentFn might succeed for all items in the * lossy page even when none of the other entries match. * * If we have a single lossy-page entry then we check to see if the * consistentFn will succeed with only that entry TRUE. If so, we return * a lossy-page pointer to indicate that the whole heap page must be * checked. (On subsequent calls, we'll do nothing until minItem is past * the page altogether, thus ensuring that we never return both regular * and lossy pointers for the same page.) * * This idea could be generalized to more than one lossy-page entry, but * ideally lossy-page entries should be infrequent so it would seldom be * the case that we have more than one at once. So it doesn't seem worth * the extra complexity to optimize that case. If we do find more than * one, we just punt and return a lossy-page pointer always. * * Note that only lossy-page entries pointing to the current item's page * should trigger this processing; we might have future lossy pages in the * entry array, but they aren't relevant yet. */ ItemPointerSetLossyPage(&curPageLossy, GinItemPointerGetBlockNumber(&key->curItem)); lossyEntry = 0; haveLossyEntry = false; for (i = 0; i < key->nentries; i++) { entry = key->scanEntry[i]; if (entry->isFinished == FALSE && ginCompareItemPointers(&entry->curItem, &curPageLossy) == 0) { if (haveLossyEntry) { /* Multiple lossy entries, punt */ key->curItem = curPageLossy; key->curItemMatches = true; key->recheckCurItem = true; return; } lossyEntry = i; haveLossyEntry = true; } } /* prepare for calling consistentFn in temp context */ oldCtx = MemoryContextSwitchTo(tempCtx); if (haveLossyEntry) { /* Single lossy-page entry, so see if whole page matches */ memset(key->entryRes, FALSE, key->nentries); key->entryRes[lossyEntry] = TRUE; if (callConsistentFn(ginstate, key)) { /* Yes, so clean up ... */ MemoryContextSwitchTo(oldCtx); MemoryContextReset(tempCtx); /* and return lossy pointer for whole page */ key->curItem = curPageLossy; key->curItemMatches = true; key->recheckCurItem = true; return; } } /* * At this point we know that we don't need to return a lossy whole-page * pointer, but we might have matches for individual exact item pointers, * possibly in combination with a lossy pointer. Our strategy if there's * a lossy pointer is to try the consistentFn both ways and return a hit * if it accepts either one (forcing the hit to be marked lossy so it will * be rechecked). An exception is that we don't need to try it both ways * if the lossy pointer is in a "hidden" entry, because the consistentFn's * result can't depend on that. * * Prepare entryRes array to be passed to consistentFn. */ for (i = 0; i < key->nentries; i++) { entry = key->scanEntry[i]; if (entry->isFinished == FALSE && ginCompareItemPointers(&entry->curItem, &key->curItem) == 0) key->entryRes[i] = TRUE; else key->entryRes[i] = FALSE; } if (haveLossyEntry) key->entryRes[lossyEntry] = TRUE; res = callConsistentFn(ginstate, key); if (!res && haveLossyEntry && lossyEntry < key->nuserentries) { /* try the other way for the lossy item */ key->entryRes[lossyEntry] = FALSE; res = callConsistentFn(ginstate, key); } key->curItemMatches = res; /* If we matched a lossy entry, force recheckCurItem = true */ if (haveLossyEntry) key->recheckCurItem = true; /* clean up after consistentFn calls */ MemoryContextSwitchTo(oldCtx); MemoryContextReset(tempCtx); }
false
false
false
false
false
0
gfire_game_client_data_parse(const gchar *p_datastring) { if(!p_datastring) return NULL; static const gchar delimit_pairs[] = {0x02, 0x00}; static const gchar delimit_values[] = {0x01, 0x00}; GList *ret = NULL; gchar **pieces = g_strsplit(p_datastring, delimit_pairs, 0); if(!pieces) return NULL; int i; for(i = 0; i < g_strv_length(pieces); i++) { if(!pieces[i] || pieces[i][0] == 0) continue; gchar **pair = g_strsplit(pieces[i], delimit_values, 2); if(!pair) continue; else if(g_strv_length(pair) != 2) { g_strfreev(pair); continue; } game_client_data *gcd = gfire_game_client_data_create(pair[0], pair[1]); if(!gcd) { g_strfreev(pair); continue; } ret = g_list_append(ret, gcd); g_strfreev(pair); } g_strfreev(pieces); return ret; }
false
false
false
false
false
0
fillSurface( int playerView ) { checkViewPosition( offset ); if ( !lock ) { paintTerrain( *surface, actmap, playerView, field.viewPort, offset ); lastDisplayedMap = actmap; } else paintBackground(); dirty = Curs; }
false
false
false
false
false
0
clear_workspace(WORKSPACE *ws) { if (!ws) return; alberta_free(ws->work, ws->size); ws->work = nil; ws->size = 0; return; }
false
false
false
false
false
0
windows_conn_delete(Repl_Connection *conn) { PRBool destroy_it = PR_FALSE; LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_delete\n", 0, 0, 0 ); PR_ASSERT(NULL != conn); PR_Lock(conn->lock); if (conn->linger_active) { if (slapi_eq_cancel(conn->linger_event) == 1) { /* Event was found and cancelled. Destroy the connection object. */ PR_Unlock(conn->lock); destroy_it = PR_TRUE; } else { /* * The event wasn't found, but we think it's still active. * That means an event is in the process of being fired * off, so arrange for the event to destroy the object . */ conn->delete_after_linger = PR_TRUE; PR_Unlock(conn->lock); } } if (destroy_it) { windows_conn_delete_internal(conn); } LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_delete\n", 0, 0, 0 ); }
false
false
false
false
false
0
Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte *output, const NameValuePairs &parameters) const { bool invalid = false; // convert from bit length to byte length if (oaepBlockLen % 8 != 0) { invalid = (oaepBlock[0] != 0) || invalid; oaepBlock++; } oaepBlockLen /= 8; std::auto_ptr<HashTransformation> pHash(NewHash()); const size_t hLen = pHash->DigestSize(); const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen; invalid = (oaepBlockLen < 2*hLen+1) || invalid; SecByteBlock t(oaepBlock, oaepBlockLen); byte *const maskedSeed = t; byte *const maskedDB = t+seedLen; std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF()); pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen); pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen); ConstByteArrayParameter encodingParameters; parameters.GetValue(Name::EncodingParameters(), encodingParameters); // DB = pHash' || 00 ... || 01 || M byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01); invalid = (M == maskedDB+dbLen) || invalid; invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), 0)) != M) || invalid; invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid; if (invalid) return DecodingResult(); M++; memcpy(output, M, maskedDB+dbLen-M); return DecodingResult(maskedDB+dbLen-M); }
false
false
false
false
false
0
EmitCFIInstructions(MCStreamer &streamer, const std::vector<MCCFIInstruction> &Instrs, MCSymbol *BaseLabel) { for (unsigned i = 0, N = Instrs.size(); i < N; ++i) { const MCCFIInstruction &Instr = Instrs[i]; MCSymbol *Label = Instr.getLabel(); // Throw out move if the label is invalid. if (Label && !Label->isDefined()) continue; // Not emitted, in dead code. // Advance row if new location. if (BaseLabel && Label) { MCSymbol *ThisSym = Label; if (ThisSym != BaseLabel) { if (streamer.isVerboseAsm()) streamer.AddComment("DW_CFA_advance_loc4"); streamer.EmitDwarfAdvanceFrameAddr(BaseLabel, ThisSym); BaseLabel = ThisSym; } } EmitCFIInstruction(streamer, Instr); } }
false
false
false
false
false
0
init_hashtable(struct hashtable *h, unsigned int minsize, unsigned int (*hashf) (void*), int (*eqf) (void*,void*)) { unsigned int pindex, size = primes[0]; /* Enforce size as prime */ for (pindex=0; pindex < prime_table_length; pindex++) { if (primes[pindex] > minsize) { size = primes[pindex]; break; } } h->table = (struct entry **)malloc(sizeof(struct entry*) * size); if (NULL == h->table) { free(h); return NULL; } /*oom*/ memset(h->table, 0, size * sizeof(struct entry *)); h->tablelength = size; h->primeindex = pindex; h->entrycount = 0; h->hashfn = hashf; h->eqfn = eqf; h->loadlimit = (unsigned int) ceil(size * max_load_factor); return h; }
false
true
false
false
false
1
JimCheckWaitStatus(Jim_Interp *interp, pidtype pid, int waitStatus) { Jim_Obj *errorCode = Jim_NewListObj(interp, NULL, 0); int rc = JIM_ERR; if (WIFEXITED(waitStatus)) { if (WEXITSTATUS(waitStatus) == 0) { Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, "NONE", -1)); rc = JIM_OK; } else { Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, "CHILDSTATUS", -1)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, (long)pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, WEXITSTATUS(waitStatus))); } } else { const char *type; const char *action; if (WIFSIGNALED(waitStatus)) { type = "CHILDKILLED"; action = "killed"; } else { type = "CHILDSUSP"; action = "suspended"; } Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, type, -1)); #ifdef jim_ext_signal Jim_SetResultFormatted(interp, "child %s by signal %s", action, Jim_SignalId(WTERMSIG(waitStatus))); Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, Jim_SignalId(WTERMSIG(waitStatus)), -1)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, Jim_SignalName(WTERMSIG(waitStatus)), -1)); #else Jim_SetResultFormatted(interp, "child %s by signal %d", action, WTERMSIG(waitStatus)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, WTERMSIG(waitStatus))); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, (long)pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, WTERMSIG(waitStatus))); #endif } Jim_SetGlobalVariableStr(interp, "errorCode", errorCode); return rc; }
false
false
false
false
false
0
pmt_mapstreamtype(uint8_t type) { switch (type) { case 1: /* ISO/IEC 11172 Video */ case 2: /* ITU-T Rec. H.262 */ /* ISO/IEC 13818-2 Video */ /* ISO/IEC 11172-2 */ case 27: /* ITU-T Rec. H.264 */ /* ISO/IEC 14496-10 Video */ return PID_VIDEO; break; case 3: /* ISO/IEC 11172 Audio */ case 4: /* ISO/IEC 13818-3 Audio */ return PID_AUDIO; break; case 5: /* ISO/IEC 13818-1 Page 160 - Private Sections */ case 6: /* ITU-T Rec. H.222.0 ISO/IEC 13818-1 PES - Private Data */ /* Stephen Gardner sent dvbsnoop output showing AC3 Audio * in here encapsulated in the private data. As we dont * treat different pid types differently we don't care for * now */ return PID_PRIVATE; break; case 7: /* ISO/IEC 13522 MHEG */ case 8: /* ITU-T Rec. H.220.0 / ISO/IEC 13818-1 Annex A DSM CC */ case 9: /* ITU-T Rec. H.220.1 */ case 10: /* ISO/IEC 13818-6 Type A */ case 11: /* ISO/IEC 13818-6 Type B */ case 12: /* ISO/IEC 13818-6 Type C */ case 13: /* ISO/IEC 13818-6 Type D */ case 14: /* ISO/IEC 13818-1 auxiliary */ return PID_OTHER; break; default: if (type & 0x80) return PID_USER; } return PID_OTHER; }
false
false
false
false
false
0
cert_ReleaseNamedCRLCache(NamedCRLCache* ncc) { if (!ncc) { return SECFailure; } if (!ncc->lock) { PORT_Assert(0); return SECFailure; } PR_Unlock(namedCRLCache.lock); return SECSuccess; }
false
false
false
false
false
0
SEC_DeletePermCRL(CERTSignedCrl *crl) { PRStatus status; NSSToken *token; nssCryptokiObject *object; PK11SlotInfo *slot = crl->slot; if (slot == NULL) { PORT_Assert(slot); /* shouldn't happen */ PORT_SetError( SEC_ERROR_CRL_INVALID); return SECFailure; } token = PK11Slot_GetNSSToken(slot); object = nss_ZNEW(NULL, nssCryptokiObject); if (!object) { return SECFailure; } object->token = nssToken_AddRef(token); object->handle = crl->pkcs11ID; object->isTokenObject = PR_TRUE; status = nssToken_DeleteStoredObject(object); nssCryptokiObject_Destroy(object); return (status == PR_SUCCESS) ? SECSuccess : SECFailure; }
false
false
false
false
false
0
read_fits_size(plotimage_t* args, int* W, int* H) { anqfits_t* anq; const anqfits_image_t* img; anq = anqfits_open(args->fn); if (!anq) { ERROR("Failed to read input file: \"%s\"", args->fn); return -1; } img = anqfits_get_image_const(anq, args->fitsext); if (!img) { ERROR("Failed to read image extension %i from file \"%s\"\n", args->fitsext, args->fn); anqfits_close(anq); return -1; } if (W) *W = img->width; if (H) *H = img->height; if (args->fitsplane >= img->planes) { ERROR("Requested FITS image plane %i, but only %i available\n", args->fitsplane, (int)img->planes); anqfits_close(anq); return -1; } anqfits_close(anq); return 0; }
false
false
false
false
false
0
taitof2_update_sprites_active_area(void) { int off; update_spritebanks(); /* if the frame was skipped, we'll have to do the buffering now */ taitof2_handle_sprite_buffering(); /* safety check to avoid getting stuck in bank 2 for games using only one bank */ if (sprites_active_area == 0x8000 && spriteram_buffered[(0x8000+6)/2] == 0 && spriteram_buffered[(0x8000+10)/2] == 0) sprites_active_area = 0; for (off = 0;off < 0x4000;off += 16) { /* sprites_active_area may change during processing */ int offs = off + sprites_active_area; if (spriteram_buffered[(offs+6)/2] & 0x8000) { sprites_disabled = spriteram_buffered[(offs+10)/2] & 0x1000; if (f2_game == FOOTCHMP) sprites_active_area = 0x8000 * (spriteram_buffered[(offs+6)/2] & 0x0001); else sprites_active_area = 0x8000 * (spriteram_buffered[(offs+10)/2] & 0x0001); continue; } /* check for extra scroll offset */ if ((spriteram_buffered[(offs+4)/2] & 0xf000) == 0xa000) { sprites_master_scrollx = spriteram_buffered[(offs+4)/2] & 0xfff; if (sprites_master_scrollx >= 0x800) sprites_master_scrollx -= 0x1000; /* signed value */ sprites_master_scrolly = spriteram_buffered[(offs+6)/2] & 0xfff; if (sprites_master_scrolly >= 0x800) sprites_master_scrolly -= 0x1000; /* signed value */ } } }
false
false
false
false
false
0
set_up_query_comments (QueryCommentsData *data, gconstpointer service) { GDataPicasaWebComment *comment_; /* Set up some test albums and files. */ set_up_query_files ((QueryFilesData*) data, service); gdata_test_mock_server_start_trace (mock_server, "setup-query-comments"); /* Insert four test comments on the first test file. */ comment_ = gdata_picasaweb_comment_new (NULL); gdata_entry_set_content (GDATA_ENTRY (comment_), "Test comment 1."); data->comment1 = GDATA_PICASAWEB_COMMENT (gdata_commentable_insert_comment (GDATA_COMMENTABLE (data->parent.file1), GDATA_SERVICE (service), GDATA_COMMENT (comment_), NULL, NULL)); g_assert (GDATA_IS_PICASAWEB_COMMENT (data->comment1)); g_object_unref (comment_); comment_ = gdata_picasaweb_comment_new (NULL); gdata_entry_set_content (GDATA_ENTRY (comment_), "Test comment 2."); data->comment2 = GDATA_PICASAWEB_COMMENT (gdata_commentable_insert_comment (GDATA_COMMENTABLE (data->parent.file1), GDATA_SERVICE (service), GDATA_COMMENT (comment_), NULL, NULL)); g_assert (GDATA_IS_PICASAWEB_COMMENT (data->comment1)); g_object_unref (comment_); comment_ = gdata_picasaweb_comment_new (NULL); gdata_entry_set_content (GDATA_ENTRY (comment_), "Test comment 3."); data->comment3 = GDATA_PICASAWEB_COMMENT (gdata_commentable_insert_comment (GDATA_COMMENTABLE (data->parent.file1), GDATA_SERVICE (service), GDATA_COMMENT (comment_), NULL, NULL)); g_assert (GDATA_IS_PICASAWEB_COMMENT (data->comment1)); g_object_unref (comment_); gdata_mock_server_end_trace (mock_server); }
false
false
false
false
false
0
draw_sprites( struct mame_bitmap *bitmap, const struct rectangle *cliprect, int scrollx, int scrolly, int priority, unsigned char sprite_partition ) { const struct GfxElement *gfx = Machine->gfx[3]; const unsigned char *source, *finish; if( sprite_partition>0x64 ) sprite_partition = 0x64; if( priority ) { source = spriteram + sprite_partition; finish = spriteram + 0x64; } else { source = spriteram; finish = spriteram + sprite_partition; } while( source<finish ) { int attributes = source[3]; /* Y?F? CCCC */ int tile_number = source[1]; int sy = source[0] - scrolly; int sx = source[2] - scrollx + ((attributes&0x80)?256:0); int color = attributes&0xf; int flipy = (attributes&0x20); int flipx = 0; if( flipscreen ) { if( flipy ) { flipx = 1; flipy = 0; } else { flipx = flipy = 1; } sx = sprite_flip_adjust-sx; sy = 246-sy; } sx = (256-sx) & 0x1ff; sy = sy & 0xff; if (sx > 512-16) sx -= 512; if (sy > 256-16) sy -= 256; drawgfx( bitmap,gfx, tile_number, color, flipx, flipy, sx, sy, cliprect,TRANSPARENCY_PEN_TABLE,7); source+=4; } }
false
false
false
false
false
0
_MD_lseek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence) { PRInt32 where; PROffset64 rv; switch (whence) { case PR_SEEK_SET: where = SEEK_SET; break; case PR_SEEK_CUR: where = SEEK_CUR; break; case PR_SEEK_END: where = SEEK_END; break; default: PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); rv = minus_one; goto done; } rv = _md_iovector._lseek64(fd->secret->md.osfd, offset, where); if (LL_EQ(rv, minus_one)) { PRInt32 syserr = _MD_ERRNO(); _PR_MD_MAP_LSEEK_ERROR(syserr); } done: return rv; }
false
false
false
false
false
0
crypt_verify_password(const char *uinput, const char *pass) { const char *cstr = crypt_string(uinput, pass); if (!strcmp(cstr, pass)) return true; return false; }
false
false
false
false
false
0
URLResolve(mp, c, p) MemPool mp; URLParts *c, *p; { URLParts *r; /* * If the protocols are different then just return the original with * some empty fields filled in. */ if (c->scheme != NULL && p->scheme != NULL && strcasecmp(c->scheme, p->scheme) != 0) { r = URLDup(mp, c); if (r->hostname == NULL) r->hostname = MPStrDup(mp, "localhost"); r->filename = resolve_filename(mp, c->filename, p->filename); return(r); } r = URLCreate(mp); /* * If current has a protocol then use it, otherwise * use the parent's protocol. If the parent doesn't have a protocol for * some reason then use "file". */ if (c->scheme == NULL) { if (p->scheme != NULL) r->scheme = MPStrDup(mp, p->scheme); else r->scheme = MPStrDup(mp, "file"); } else r->scheme = MPStrDup(mp, c->scheme); /* * If current has a hostname then use it, otherwise * use the parent's hostname. If neither has a hostname then * fallback to "localhost". */ if (c->hostname == NULL) { if (p->hostname != NULL) { r->hostname = MPStrDup(mp, p->hostname); r->port = p->port; } else { r->hostname = MPStrDup(mp, "localhost"); /* fallback */ r->port = 0; } } else { r->hostname = MPStrDup(mp, c->hostname); r->port = c->port; } r->filename = resolve_filename(mp, c->filename, p->filename); /* * Copy misc. fields. */ r->username = MPStrDup(mp, c->username); r->password = MPStrDup(mp, c->password); r->fragment = MPStrDup(mp, c->fragment); return(r); }
false
false
false
false
false
0
match_stack_pop(match_stack_ty *msp) { const match_ty *field; trace(("match_stack_pop()\n{\n")); assert(msp->stack_depth); if (msp->stack_depth > 0) { --msp->stack_depth; field = msp->stack[msp->stack_depth]; } else field = 0; trace(("return %p;\n", field)); trace(("}\n")); return field; }
false
false
false
false
false
0
isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf, const __u8 *data, unsigned int len) { static const __u8 hdr[] = { 0x11, 0x22, 0x33, 0x44, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xfa, 0xce }; unsigned int maxlen, nbytes; __u8 *mem; int is_header = 0; if (buf == NULL) return 0; if ((len >= 14 && memcmp(&data[2], hdr, 12) == 0) || (len >= 15 && memcmp(&data[3], hdr, 12) == 0)) { uvc_trace(UVC_TRACE_FRAME, "iSight header found\n"); is_header = 1; } /* Synchronize to the input stream by waiting for a header packet. */ if (buf->state != UVC_BUF_STATE_ACTIVE) { if (!is_header) { uvc_trace(UVC_TRACE_FRAME, "Dropping packet (out of " "sync).\n"); return 0; } buf->state = UVC_BUF_STATE_ACTIVE; } /* Mark the buffer as done if we're at the beginning of a new frame. * * Empty buffers (bytesused == 0) don't trigger end of frame detection * as it doesn't make sense to return an empty buffer. */ if (is_header && buf->bytesused != 0) { buf->state = UVC_BUF_STATE_DONE; return -EAGAIN; } /* Copy the video data to the buffer. Skip header packets, as they * contain no data. */ if (!is_header) { maxlen = buf->length - buf->bytesused; mem = buf->mem + buf->bytesused; nbytes = min(len, maxlen); memcpy(mem, data, nbytes); buf->bytesused += nbytes; if (len > maxlen || buf->bytesused == buf->length) { uvc_trace(UVC_TRACE_FRAME, "Frame complete " "(overflow).\n"); buf->state = UVC_BUF_STATE_DONE; } } return 0; }
false
false
false
false
false
0
pedwarn_strange_white_space (ch) int ch; { switch (ch) { case '\f': pedwarn ("formfeed in preprocessing directive"); break; case '\r': pedwarn ("carriage return in preprocessing directive"); break; case '\v': pedwarn ("vertical tab in preprocessing directive"); break; default: abort (); } }
false
false
false
false
false
0
parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit) { int32_t count = 0; int32_t value = 0; int32_t p = pos; int8_t radix = 10; if (p < limit && rule.charAt(p) == 48 /*0*/) { if (p+1 < limit && (rule.charAt(p+1) == 0x78 /*x*/ || rule.charAt(p+1) == 0x58 /*X*/)) { p += 2; radix = 16; } else { p++; count = 1; radix = 8; } } while (p < limit) { int32_t d = u_digit(rule.charAt(p++), radix); if (d < 0) { --p; break; } ++count; int32_t v = (value * radix) + d; if (v <= value) { // If there are too many input digits, at some point // the value will go negative, e.g., if we have seen // "0x8000000" already and there is another '0', when // we parse the next 0 the value will go negative. return 0; } value = v; } if (count > 0) { pos = p; } return value; }
false
false
false
false
false
0
write_book_parts(FILE *out, QofBook *book) { xmlNodePtr domnode; domnode = guid_to_dom_tree(book_id_string, qof_book_get_guid(book)); xmlElemDump(out, NULL, domnode); xmlFreeNode (domnode); if (ferror(out) || fprintf(out, "\n") < 0) return FALSE; if (qof_book_get_slots(book)) { xmlNodePtr kvpnode = kvp_frame_to_dom_tree(book_slots_string, qof_book_get_slots(book)); if (kvpnode) { xmlElemDump(out, NULL, kvpnode); xmlFreeNode(kvpnode); if (ferror(out) || fprintf(out, "\n") < 0) return FALSE; } } return TRUE; }
false
false
false
false
false
0
usbhs_pipe_running(struct usbhs_pipe *pipe, int running) { if (running) usbhsp_flags_set(pipe, IS_RUNNING); else usbhsp_flags_clr(pipe, IS_RUNNING); }
false
false
false
false
false
0
excel_read_ROW (BiffQuery *q, ExcelReadSheet *esheet) { guint16 row, height; guint16 flags = 0; guint16 flags2 = 0; guint16 xf; gboolean is_std_height; XL_CHECK_CONDITION (q->length >= (q->opcode == BIFF_ROW_v2 ? 16 : 8)); row = GSF_LE_GET_GUINT16 (q->data); #if 0 /* Unnecessary info for now. * do we want to preallocate based on this info? */ guint16 const start_col = GSF_LE_GET_GUINT16 (q->data + 2); guint16 const end_col = GSF_LE_GET_GUINT16 (q->data + 4) - 1; #endif height = GSF_LE_GET_GUINT16 (q->data + 6); /* If the bit is on it indicates that the row is of 'standard' height. * However the remaining bits still include the size. */ is_std_height = (height & 0x8000) != 0; if (q->opcode == BIFF_ROW_v2) { flags = GSF_LE_GET_GUINT16 (q->data + 12); flags2 = GSF_LE_GET_GUINT16 (q->data + 14); } xf = flags2 & 0xfff; d (1, { g_printerr ("Row %d height 0x%x, flags=0x%x 0x%x;\n", row + 1, height, flags, flags2); if (is_std_height) g_printerr ("%s\n", "Is Std Height;\n"); if (flags2 & 0x1000) g_printerr ("%s\n", "Top thick;\n"); if (flags2 & 0x2000) g_printerr ("%s\n", "Bottom thick;\n"); }); /* TODO: Put mechanism in place to handle thick margins */ /* TODO: Columns actually set the size even when it is the default. * Which approach is better? */ if (!is_std_height) { double hu = get_row_height_units (height); sheet_row_set_size_pts (esheet->sheet, row, hu, (flags & 0x40) ? TRUE : FALSE); } if (flags & 0x20) colrow_set_visibility (esheet->sheet, FALSE, FALSE, row, row); if (flags & 0x80) { if (xf != 0) excel_set_xf_segment (esheet, 0, gnm_sheet_get_max_cols (esheet->sheet) - 1, row, row, xf); d (1, g_printerr ("row %d has flags 0x%x a default style %hd;\n", row + 1, flags, xf);); } if ((unsigned)(flags & 0x17) > 0) colrow_set_outline (sheet_row_fetch (esheet->sheet, row), (unsigned)(flags & 0x7), flags & 0x10); }
false
false
false
false
false
0
hashtable_put(hashtable_t **hashtable_ptr, void *key, void *value) { int mod; unsigned long hash; hashtable_t *hashtable; hashtable_entry_t *possible_hit; float table_usage; hashtable = *hashtable_ptr; mod = hashtable->capacity - 1; hash = hashtable->hash(key) & mod; possible_hit = hashtable->elements[hash]; while(possible_hit->key) { /* if this is the same key then this is the element we want */ if(hashtable->equal(possible_hit->key, key)) { /* the hashtable will increment after this loop so * decrement now to keep it the same length */ --hashtable->length; /* also delete this node's keys/values */ if(hashtable->flags & HT_COPY_KEY) free(possible_hit->key); if(hashtable->flags & HT_COPY_VALUE) free(possible_hit->value); break; } hash = (hash+1) & mod; possible_hit = hashtable->elements[hash]; } // printf("filling element %d with %s => %s\n", hash, key, value); if(hashtable->_internal_put) { /* this comes from the rebuild function */ possible_hit->key = key; possible_hit->value = value; } else { /* this is a real user put */ if(hashtable->flags & HT_COPY_KEY) { /* copy key */ int string_length = hashtable->key_size_func(key); possible_hit->key = malloc(string_length); hashtable->key_copy_func(possible_hit->key, key, string_length); } else { /* just copy the pointer */ possible_hit->key = key; } if(hashtable->flags & HT_COPY_VALUE) { /* copy value */ int string_length = hashtable->val_size_func(value); possible_hit->value = malloc(string_length); hashtable->val_copy_func(possible_hit->value, value, string_length); } else { /* just copy the pointer */ possible_hit->value = value; } } ++hashtable->length; /* if hashtable gets too large then rebuild as a larger * hashtable */ table_usage = (float)hashtable->length / hashtable->capacity; if(table_usage > MAX_TABLE_USAGE) { rebuild_hashtable(hashtable_ptr); } return true; }
false
false
false
false
false
0
rs_genalea (int *x0) { int m = 2147483647; int a = 16807 ; int b = 127773 ; int c = 2836 ; int x1, k; k = static_cast<int> ((*x0)/b) ; x1 = a*(*x0 - k*b) - k*c ; if(x1 < 0) x1 = x1 + m; *x0 = x1; return(static_cast<double>(x1)/static_cast<double>(m)); }
false
false
false
false
false
0
integerBitOrMatch( int *matchp, slap_mask_t flags, Syntax *syntax, MatchingRule *mr, struct berval *value, void *assertedValue ) { SLAP_LONG lValue, lAssertedValue; errno = 0; /* safe to assume integers are NUL terminated? */ lValue = SLAP_STRTOL(value->bv_val, NULL, 10); if( errno == ERANGE ) { return LDAP_CONSTRAINT_VIOLATION; } lAssertedValue = SLAP_STRTOL( ((struct berval *)assertedValue)->bv_val, NULL, 10); if( errno == ERANGE ) { return LDAP_CONSTRAINT_VIOLATION; } *matchp = ((lValue & lAssertedValue) != 0) ? 0 : -1; return LDAP_SUCCESS; }
false
false
false
false
false
0
get_str_prop (const char* prop) { char *str = (char*)xmlGetProp (_node, (xmlChar*)prop); string result (str); free (str); return result; }
false
false
false
false
false
0
freeAtt (XMLAtt *a) { if (!a) return; freeString (&a->name); freeString (&a->valu); (*myfree)(a); }
false
false
false
false
false
0
item(unsigned long index) const { if (index < (unsigned)m_queries.size()) { MediaQuery* query = m_queries[index]; return query->cssText(); } return DOMString(); }
false
false
false
false
false
0
gtk_led_init (GtkLed *led) { GtkMisc *misc; misc = GTK_MISC (led); GTK_WIDGET_SET_FLAGS (led, GTK_NO_WINDOW); led->is_on = FALSE; led->gc = NULL; }
false
false
false
false
false
0
on_tool_enable (GtkCellRendererToggle *cell_renderer, const gchar *path, gpointer user_data) { ATPToolDialog *this = (ATPToolDialog *)user_data; GtkTreeModel *model; GtkTreeIter iter; ATPUserTool *tool; model = gtk_tree_view_get_model (this->view); if (gtk_tree_model_get_iter_from_string (model, &iter, path)) { gtk_tree_model_get (model, &iter, ATP_TOOLS_DATA_COLUMN, &tool, -1); atp_user_tool_set_flag (tool, ATP_TOOL_ENABLE | ATP_TOGGLE); gtk_list_store_set (GTK_LIST_STORE(model), &iter, ATP_TOOLS_ENABLED_COLUMN, atp_user_tool_get_flag (tool, ATP_TOOL_ENABLE), -1); } }
false
false
false
false
false
0
cob_file_sort_using (cob_file *sort_file, cob_file *data_file) { int ret; cob_open (data_file, COB_OPEN_INPUT, 0, NULL); while (1) { cob_read (data_file, NULL, NULL, COB_READ_NEXT); if (data_file->file_status[0] != '0') { break; } cob_copy_check (sort_file, data_file); ret = cob_file_sort_submit (sort_file, sort_file->record->data); if (ret) { break; } } cob_close (data_file, COB_CLOSE_NORMAL, NULL); }
false
false
false
false
false
0
tds_convert_real(int srctype, const TDS_CHAR * src, int desttype, CONV_RESULT * cr) { TDS_REAL the_value; /* FIXME how many big should be this buffer ?? */ char tmp_str[128]; TDS_INT mymoney4; TDS_INT8 mymoney; memcpy(&the_value, src, 4); switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%.7g", the_value); return string_to_result(tmp_str, cr); break; case CASE_ALL_BINARY: return binary_to_result(src, sizeof(TDS_REAL), cr); break; case SYBINT1: if (!IS_TINYINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->ti = (TDS_TINYINT) the_value; return sizeof(TDS_TINYINT); break; case SYBINT2: if (!IS_SMALLINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) the_value; return sizeof(TDS_SMALLINT); break; case SYBINT4: if (!IS_INT(the_value)) return TDS_CONVERT_OVERFLOW; cr->i = (TDS_INT) the_value; return sizeof(TDS_INT); break; case SYBINT8: if (the_value > (TDS_REAL) TDS_INT8_MAX || the_value < (TDS_REAL) TDS_INT8_MIN) return TDS_CONVERT_OVERFLOW; cr->bi = (TDS_INT8) the_value; return sizeof(TDS_INT8); break; case SYBBIT: case SYBBITN: cr->ti = the_value ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = the_value; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = the_value; return sizeof(TDS_REAL); break; case SYBMONEY: if (the_value > (TDS_REAL) (TDS_INT8_MAX / 10000) || the_value < (TDS_REAL) (TDS_INT8_MIN / 10000)) return TDS_CONVERT_OVERFLOW; mymoney = (TDS_INT8) (the_value * 10000); cr->m.mny = mymoney; return sizeof(TDS_MONEY); break; case SYBMONEY4: if (the_value > (TDS_REAL) (TDS_INT_MAX / 10000) || the_value < (TDS_REAL) (TDS_INT_MIN / 10000)) return TDS_CONVERT_OVERFLOW; mymoney4 = (TDS_INT) (the_value * 10000); cr->m4.mny4 = mymoney4; return sizeof(TDS_MONEY4); break; case SYBNUMERIC: case SYBDECIMAL: sprintf(tmp_str, "%.*f", cr->n.scale, the_value); return stringz_to_numeric(tmp_str, cr); break; /* not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; }
true
true
false
false
false
1
FetchClientEntData(edict_t * ent) { ent->health = ent->client->pers.health; ent->max_health = ent->client->pers.max_health; if (ent->client->pers.powerArmorActive) ent->flags |= FL_POWER_ARMOR; if (coop->value) ent->client->resp.score = ent->client->pers.score; }
false
false
false
false
false
0
println(KBlocksPiece * piece, int x, int y, bool full) { if(full) { if (x != -1) { gotoXY(x, y++); } println(piece); if (x != -1) { gotoXY(x, y++); } println("STATE"); if (x != -1) { gotoXY(x, y++); } print("Rotation Id :");println(piece->getRotation()); if (x != -1) { gotoXY(x, y++); } print("pos: ("); print(piece->getPosX()); print(","); print(piece->getPosY()); println(")"); println("Cells: "); for(int i = 0; i < KBlocksPiece_CellCount; i++) { if (x != -1) { gotoXY(x, y++); } print("["); print(piece->getCellPosX(i)); print(","); print(piece->getCellPosY(i)); println("]"); } } }
false
false
false
false
false
0
yuv444_to_rgb(jxr_image_t image, int mx) { int px; for (px = 0 ; px < 256 ; px += 1) { int Y = image->strip[0].up3[mx].data[px]; int U = image->strip[1].up3[mx].data[px]; int V = image->strip[2].up3[mx].data[px]; int G = Y - _jxr_floor_div2(-U); int R = G - U - _jxr_ceil_div2(V); int B = V + R; image->strip[0].up3[mx].data[px] = R; image->strip[1].up3[mx].data[px] = G; image->strip[2].up3[mx].data[px] = B; } }
false
false
false
false
false
0
set_prga(struct wstate *ws, unsigned char* iv, unsigned char* cipher, unsigned char* clear, int len) { int i; int fd; if (ws->ws_pi.pi_len != 0) free(ws->ws_pi.pi_prga); ws->ws_pi.pi_prga = (unsigned char*) malloc(len); if (!ws->ws_pi.pi_prga) { perror("malloc()"); exit(1); } ws->ws_pi.pi_len = len; memcpy(ws->ws_pi.pi_iv, iv, 3); for (i = 0; i < len; i++) { ws->ws_pi.pi_prga[i] = ( cipher ? (clear[i] ^ cipher[i]) : clear[i]); } time_print("Got %d bytes of prga IV=(%.02x:%.02x:%.02x) PRGA=", ws->ws_pi.pi_len, ws->ws_pi.pi_iv[0], ws->ws_pi.pi_iv[1], ws->ws_pi.pi_iv[2]); hexdump(ws->ws_pi.pi_prga, ws->ws_pi.pi_len); if (!cipher) return; fd = open(PRGA_FILE, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd == -1) { perror("open()"); exit(1); } i = write(fd, ws->ws_pi.pi_iv, 3); if (i == -1) { perror("write()"); exit(1); } if (i != 3) { printf("Wrote %d out of %d\n", i, 3); exit(1); } i = write(fd, ws->ws_pi.pi_prga, ws->ws_pi.pi_len); if (i == -1) { perror("write()"); exit(1); } if (i != ws->ws_pi.pi_len) { printf("Wrote %d out of %d\n", i, ws->ws_pi.pi_len); exit(1); } close(fd); }
false
false
false
false
false
0
numaTransform(NUMA *nas, l_float32 shift, l_float32 scale) { l_int32 i, n; l_float32 val; NUMA *nad; PROCNAME("numaTransform"); if (!nas) return (NUMA *)ERROR_PTR("nas not defined", procName, NULL); n = numaGetCount(nas); if ((nad = numaCreate(n)) == NULL) return (NUMA *)ERROR_PTR("nad not made", procName, NULL); numaCopyParameters(nad, nas); for (i = 0; i < n; i++) { numaGetFValue(nas, i, &val); val = scale * val + shift; numaAddNumber(nad, val); } return nad; }
false
false
false
false
false
0
get_free_cmdtab_slot() { int slot; for ( slot = 0; slot < MAXJOBS; ++slot ) if ( !cmdtab[ slot ].pid ) return slot; printf( "no slots for child!\n" ); exit( EXITBAD ); }
false
false
false
false
false
0
if_usb_fw_timeo(unsigned long priv) { struct if_usb_card *cardp = (void *)priv; if (cardp->fwdnldover) { lbs_deb_usb("Download complete, no event. Assuming success\n"); } else { pr_err("Download timed out\n"); cardp->surprise_removed = 1; } wake_up(&cardp->fw_wq); }
false
false
false
false
false
0
DisplaySize( const FvwmWindow *tmp_win, const XEvent *eventp, int width, int height, Bool Init, Bool resetLast) { char str[100]; int dwidth,dheight,offset; size_borders b; static int last_width = 0; static int last_height = 0; FlocaleWinString fstr; if (Scr.gs.do_hide_resize_window) { return; } position_geometry_window(eventp); if (resetLast) { last_width = 0; last_height = 0; } if (last_width == width && last_height == height) { return; } last_width = width; last_height = height; get_window_borders(tmp_win, &b); dheight = height - b.total_size.height; dwidth = width - b.total_size.width; dwidth -= tmp_win->hints.base_width; dheight -= tmp_win->hints.base_height; dwidth /= tmp_win->hints.width_inc; dheight /= tmp_win->hints.height_inc; (void)sprintf(str, GEOMETRY_WINDOW_SIZE_STRING, dwidth, dheight); if (Init) { XClearWindow(dpy,Scr.SizeWindow); } else { /* just clear indside the relief lines to reduce flicker */ XClearArea( dpy, Scr.SizeWindow, GEOMETRY_WINDOW_BW, GEOMETRY_WINDOW_BW, Scr.SizeStringWidth, Scr.DefaultFont->height, False); } if (Pdepth >= 2) { RelieveRectangle( dpy, Scr.SizeWindow, 0, 0, Scr.SizeStringWidth + GEOMETRY_WINDOW_BW * 2 - 1, Scr.DefaultFont->height + GEOMETRY_WINDOW_BW*2 - 1, Scr.StdReliefGC, Scr.StdShadowGC, GEOMETRY_WINDOW_BW); } offset = (Scr.SizeStringWidth - FlocaleTextWidth(Scr.DefaultFont, str, strlen(str))) / 2; offset += GEOMETRY_WINDOW_BW; memset(&fstr, 0, sizeof(fstr)); if (Scr.DefaultColorset >= 0) { fstr.colorset = &Colorset[Scr.DefaultColorset]; fstr.flags.has_colorset = True; } fstr.str = str; fstr.win = Scr.SizeWindow; fstr.gc = Scr.StdGC; fstr.x = offset; fstr.y = Scr.DefaultFont->ascent + GEOMETRY_WINDOW_BW; FlocaleDrawString(dpy, Scr.DefaultFont, &fstr, 0); return; }
false
false
false
false
false
0
EM_error( int pos, const char * message, ... ) { va_list ap; IntList lines = linePos; int num = lineNum; anyErrors = TRUE; while( lines && lines->i >= pos ) { lines = lines->rest; num--; } fprintf( stderr, "[%s]:", *fileName ? mini(fileName) : "chuck" ); sprintf( g_lasterror, "[%s]:", *fileName ? mini(fileName) : "chuck" ); if(lines) { fprintf(stderr, "line(%d).char(%d):", num, pos-lines->i ); sprintf( g_buffer, "line(%d).char(%d):", num, pos-lines->i ); strcat( g_lasterror, g_buffer ); } fprintf(stderr, " " ); strcat( g_lasterror, " " ); va_start(ap, message); vfprintf(stderr, message, ap); vsprintf( g_buffer, message, ap ); va_end(ap); fprintf(stderr, "\n"); fflush( stderr ); strcat( g_lasterror, g_buffer ); }
false
false
false
false
false
0
lldpctl_release(lldpctl_conn_t *conn) { if (conn == NULL) return 0; free(conn->ctlname); if (conn->send == sync_send) { struct lldpctl_conn_sync_t *data = conn->user_data; if (data->fd != -1) close(data->fd); free(conn->user_data); } free(conn->input_buffer); free(conn->output_buffer); free(conn); return 0; }
false
false
false
false
false
0
gap_layer_create_layer_from_layermask(gint32 src_layer_id , gint32 image_id , const char *name_prefix, const char *name_suffix) { gboolean l_has_already_layermask; gint32 l_layermask_id; gint32 l_new_layer_id; gint32 l_new_layermask_id; /* make a copy of the layer (but without the layermask) */ l_new_layer_id = gap_layer_make_duplicate(src_layer_id, image_id , name_prefix, name_suffix); l_new_layermask_id = gimp_layer_get_mask(l_new_layer_id); if (l_new_layermask_id >= 0) { /* copy the layermask into the new layer */ gap_layer_copy_paste_drawable(image_id , l_new_layer_id /* dst_drawable_id */ , l_new_layermask_id /* src_drawable_id */ ); gimp_layer_remove_mask (l_new_layer_id, GIMP_MASK_DISCARD); } else { /* create white layer (in case no layermask was present) */ gap_layer_clear_to_color(l_new_layer_id ,1.0 /* red */ ,1.0 /* green */ ,1.0 /* blue */ ,1.0 /* alpha */ ); } return (l_new_layer_id); }
false
false
false
false
false
0
wakeup_count_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { unsigned int val; int error; error = pm_autosleep_lock(); if (error) return error; if (pm_autosleep_state() > PM_SUSPEND_ON) { error = -EBUSY; goto out; } error = -EINVAL; if (sscanf(buf, "%u", &val) == 1) { if (pm_save_wakeup_count(val)) error = n; else pm_print_active_wakeup_sources(); } out: pm_autosleep_unlock(); return error; }
false
false
false
false
false
0
elm_photo_size_set(Evas_Object *obj, int size) { ELM_PHOTO_CHECK(obj); ELM_PHOTO_DATA_GET(obj, sd); sd->size = (size > 0) ? size : 0; elm_image_prescale_set(sd->icon, sd->size); _sizing_eval(obj); }
false
false
false
false
false
0
pre_exchange() { if (!nevery) return; if (!force->kspace) return; if (!force->pair) return; if (next_reneighbor != update->ntimestep) return; next_reneighbor = update->ntimestep + nevery; double time = get_timing_info(); if (strcmp(force->kspace_style,"ewald") == 0) ewald_time = time; if (strcmp(force->kspace_style,"pppm") == 0) pppm_time = time; if (strcmp(force->kspace_style,"msm") == 0) msm_time = time; niter++; if (niter == 1) { // test Ewald store_old_kspace_settings(); strcpy(new_kspace_style,"ewald"); sprintf(new_pair_style,"%s/long",base_pair_style); update_pair_style(new_pair_style,pair_cut_coul); update_kspace_style(new_kspace_style,new_acc_str); } else if (niter == 2) { // test PPPM store_old_kspace_settings(); strcpy(new_kspace_style,"pppm"); sprintf(new_pair_style,"%s/long",base_pair_style); update_pair_style(new_pair_style,pair_cut_coul); update_kspace_style(new_kspace_style,new_acc_str); } else if (niter == 3) { // test MSM store_old_kspace_settings(); strcpy(new_kspace_style,"msm"); sprintf(new_pair_style,"%s/msm",base_pair_style); update_pair_style(new_pair_style,pair_cut_coul); update_kspace_style(new_kspace_style,new_acc_str); } else if (niter == 4) { store_old_kspace_settings(); cout << "ewald_time = " << ewald_time << endl; cout << "pppm_time = " << pppm_time << endl; cout << "msm_time = " << msm_time << endl; // switch to fastest one strcpy(new_kspace_style,"ewald"); sprintf(new_pair_style,"%s/long",base_pair_style); if (pppm_time < ewald_time && pppm_time < msm_time) strcpy(new_kspace_style,"pppm"); else if (msm_time < pppm_time && msm_time < ewald_time) { strcpy(new_kspace_style,"msm"); sprintf(new_pair_style,"%s/msm",base_pair_style); } update_pair_style(new_pair_style,pair_cut_coul); update_kspace_style(new_kspace_style,new_acc_str); } else { adjust_rcut(time); } last_spcpu = timer->elapsed(TIME_LOOP); }
false
false
false
false
false
0
defined_rv_to_string (CK_RV rv) { #define GKM_X(rv) case rv: return #rv; switch (rv) { /* These are not really errors, or not current */ GKM_X (CKR_OK) GKM_X (CKR_NO_EVENT) GKM_X (CKR_FUNCTION_NOT_PARALLEL) GKM_X (CKR_SESSION_PARALLEL_NOT_SUPPORTED) GKM_X (CKR_CANCEL) GKM_X (CKR_FUNCTION_CANCELED) GKM_X (CKR_HOST_MEMORY) GKM_X (CKR_SLOT_ID_INVALID) GKM_X (CKR_GENERAL_ERROR) GKM_X (CKR_FUNCTION_FAILED) GKM_X (CKR_ARGUMENTS_BAD) GKM_X (CKR_NEED_TO_CREATE_THREADS) GKM_X (CKR_CANT_LOCK) GKM_X (CKR_ATTRIBUTE_READ_ONLY) GKM_X (CKR_ATTRIBUTE_SENSITIVE) GKM_X (CKR_ATTRIBUTE_TYPE_INVALID) GKM_X (CKR_ATTRIBUTE_VALUE_INVALID) GKM_X (CKR_DATA_INVALID) GKM_X (CKR_DATA_LEN_RANGE) GKM_X (CKR_DEVICE_ERROR) GKM_X (CKR_DEVICE_MEMORY) GKM_X (CKR_DEVICE_REMOVED) GKM_X (CKR_ENCRYPTED_DATA_INVALID) GKM_X (CKR_ENCRYPTED_DATA_LEN_RANGE) GKM_X (CKR_FUNCTION_NOT_SUPPORTED) GKM_X (CKR_KEY_HANDLE_INVALID) GKM_X (CKR_KEY_SIZE_RANGE) GKM_X (CKR_KEY_TYPE_INCONSISTENT) GKM_X (CKR_KEY_NOT_NEEDED) GKM_X (CKR_KEY_CHANGED) GKM_X (CKR_KEY_NEEDED) GKM_X (CKR_KEY_INDIGESTIBLE) GKM_X (CKR_KEY_FUNCTION_NOT_PERMITTED) GKM_X (CKR_KEY_NOT_WRAPPABLE) GKM_X (CKR_KEY_UNEXTRACTABLE) GKM_X (CKR_MECHANISM_INVALID) GKM_X (CKR_MECHANISM_PARAM_INVALID) GKM_X (CKR_OBJECT_HANDLE_INVALID) GKM_X (CKR_OPERATION_ACTIVE) GKM_X (CKR_OPERATION_NOT_INITIALIZED) GKM_X (CKR_PIN_INCORRECT) GKM_X (CKR_PIN_INVALID) GKM_X (CKR_PIN_LEN_RANGE) GKM_X (CKR_PIN_EXPIRED) GKM_X (CKR_PIN_LOCKED) GKM_X (CKR_SESSION_CLOSED) GKM_X (CKR_SESSION_COUNT) GKM_X (CKR_SESSION_HANDLE_INVALID) GKM_X (CKR_SESSION_READ_ONLY) GKM_X (CKR_SESSION_EXISTS) GKM_X (CKR_SESSION_READ_ONLY_EXISTS) GKM_X (CKR_SESSION_READ_WRITE_SO_EXISTS) GKM_X (CKR_SIGNATURE_INVALID) GKM_X (CKR_SIGNATURE_LEN_RANGE) GKM_X (CKR_TEMPLATE_INCOMPLETE) GKM_X (CKR_TEMPLATE_INCONSISTENT) GKM_X (CKR_TOKEN_NOT_PRESENT) GKM_X (CKR_TOKEN_NOT_RECOGNIZED) GKM_X (CKR_TOKEN_WRITE_PROTECTED) GKM_X (CKR_UNWRAPPING_KEY_HANDLE_INVALID) GKM_X (CKR_UNWRAPPING_KEY_SIZE_RANGE) GKM_X (CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT) GKM_X (CKR_USER_ALREADY_LOGGED_IN) GKM_X (CKR_USER_NOT_LOGGED_IN) GKM_X (CKR_USER_PIN_NOT_INITIALIZED) GKM_X (CKR_USER_TYPE_INVALID) GKM_X (CKR_USER_ANOTHER_ALREADY_LOGGED_IN) GKM_X (CKR_USER_TOO_MANY_TYPES) GKM_X (CKR_WRAPPED_KEY_INVALID) GKM_X (CKR_WRAPPED_KEY_LEN_RANGE) GKM_X (CKR_WRAPPING_KEY_HANDLE_INVALID) GKM_X (CKR_WRAPPING_KEY_SIZE_RANGE) GKM_X (CKR_WRAPPING_KEY_TYPE_INCONSISTENT) GKM_X (CKR_RANDOM_SEED_NOT_SUPPORTED) GKM_X (CKR_RANDOM_NO_RNG) GKM_X (CKR_DOMAIN_PARAMS_INVALID) GKM_X (CKR_BUFFER_TOO_SMALL) GKM_X (CKR_SAVED_STATE_INVALID) GKM_X (CKR_INFORMATION_SENSITIVE) GKM_X (CKR_STATE_UNSAVEABLE) GKM_X (CKR_CRYPTOKI_NOT_INITIALIZED) GKM_X (CKR_CRYPTOKI_ALREADY_INITIALIZED) GKM_X (CKR_MUTEX_BAD) GKM_X (CKR_MUTEX_NOT_LOCKED) GKM_X (CKR_FUNCTION_REJECTED) default: return NULL; } #undef GKM_X }
false
false
false
false
false
0
single_click(int x1, int y1, int x2, int y2,int buttonId) { if( !has_mouse_event ) return 0; MouseClick* cptr; if( buttonId==0 || buttonId==2 ) // left button { cptr = click_buffer+LEFT_BUTTON; if( mouse_event_type == LEFT_BUTTON && cptr->count == 1 && cptr->x >= x1 && cptr->y >= y1 && cptr->x <= x2 && cptr->y <= y2 ) { return 1; } } if( buttonId==1 || buttonId==2 ) // right button { cptr = click_buffer+RIGHT_BUTTON; if( mouse_event_type == RIGHT_BUTTON && cptr->count == 1 && cptr->x >= x1 && cptr->y >= y1 && cptr->x <= x2 && cptr->y <= y2 ) { return 2; } } return 0; }
false
false
false
false
false
0
vcard_unescape(char *src) { char *ans = NULL, *p; int done = 0; if(src){ p = ans = (char *)fs_get(strlen(src) + 1); while(!done){ switch(*src){ case '\\': src++; if(*src == 'n' || *src == 'N'){ *p++ = '\n'; src++; } else if(*src) *p++ = *src++; break; case '\0': done++; break; default: *p++ = *src++; break; } } *p = '\0'; } return(ans); }
false
false
false
false
false
0
loadFromSvg(const QString& filename, const QSize& size) { QFileInfo fi(filename); if (!fi.exists()) { return QPixmap(); } else if (fi.lastModified().toTime_t() > timestamp()) { // Cache is obsolete, will be regenerated discard(); } QPixmap pix; QString key = QString("file:%1_%2_%3").arg(filename).arg(size.width()).arg(size.height()); if (!find(key, pix)) { // It wasn't in the cache, so load it... QSvgRenderer svg; if (!svg.load(filename)) { return pix; // null pixmap } else { QSize pixSize = size.isValid() ? size : svg.defaultSize(); pix = QPixmap(pixSize); pix.fill(Qt::transparent); QPainter p(&pix); svg.render(&p, QRectF(QPointF(), pixSize)); } // ... and put it there insert(key, pix); } return pix; }
false
false
false
false
false
0
get_thinkpad_model_data( struct thinkpad_id_data *tp) { const struct dmi_device *dev = NULL; char ec_fw_string[18]; char const *s; if (!tp) return -EINVAL; memset(tp, 0, sizeof(*tp)); if (dmi_name_in_vendors("IBM")) tp->vendor = PCI_VENDOR_ID_IBM; else if (dmi_name_in_vendors("LENOVO")) tp->vendor = PCI_VENDOR_ID_LENOVO; else return 0; s = dmi_get_system_info(DMI_BIOS_VERSION); tp->bios_version_str = kstrdup(s, GFP_KERNEL); if (s && !tp->bios_version_str) return -ENOMEM; /* Really ancient ThinkPad 240X will fail this, which is fine */ if (!(tpacpi_is_valid_fw_id(tp->bios_version_str, 'E') || tpacpi_is_valid_fw_id(tp->bios_version_str, 'C'))) return 0; tp->bios_model = tp->bios_version_str[0] | (tp->bios_version_str[1] << 8); tp->bios_release = (tp->bios_version_str[4] << 8) | tp->bios_version_str[5]; /* * ThinkPad T23 or newer, A31 or newer, R50e or newer, * X32 or newer, all Z series; Some models must have an * up-to-date BIOS or they will not be detected. * * See http://thinkwiki.org/wiki/List_of_DMI_IDs */ while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { if (sscanf(dev->name, "IBM ThinkPad Embedded Controller -[%17c", ec_fw_string) == 1) { ec_fw_string[sizeof(ec_fw_string) - 1] = 0; ec_fw_string[strcspn(ec_fw_string, " ]")] = 0; tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL); if (!tp->ec_version_str) return -ENOMEM; if (tpacpi_is_valid_fw_id(ec_fw_string, 'H')) { tp->ec_model = ec_fw_string[0] | (ec_fw_string[1] << 8); tp->ec_release = (ec_fw_string[4] << 8) | ec_fw_string[5]; } else { pr_notice("ThinkPad firmware release %s " "doesn't match the known patterns\n", ec_fw_string); pr_notice("please report this to %s\n", TPACPI_MAIL); } break; } } s = dmi_get_system_info(DMI_PRODUCT_VERSION); if (s && !(strncasecmp(s, "ThinkPad", 8) && strncasecmp(s, "Lenovo", 6))) { tp->model_str = kstrdup(s, GFP_KERNEL); if (!tp->model_str) return -ENOMEM; } else { s = dmi_get_system_info(DMI_BIOS_VENDOR); if (s && !(strncasecmp(s, "Lenovo", 6))) { tp->model_str = kstrdup(s, GFP_KERNEL); if (!tp->model_str) return -ENOMEM; } } s = dmi_get_system_info(DMI_PRODUCT_NAME); tp->nummodel_str = kstrdup(s, GFP_KERNEL); if (s && !tp->nummodel_str) return -ENOMEM; return 0; }
false
false
false
false
false
0
cb_alert_config(GkrellmAlert *ap, DiskMon *disk) { GtkTreeModel *model; GtkTreeIter iter, citer; DiskMon *disk_test; GdkPixbuf *pixbuf; gboolean valid; disk->alert_uses_read = GTK_TOGGLE_BUTTON(disk->alert_config_read_button)->active; disk->alert_uses_write = GTK_TOGGLE_BUTTON(disk->alert_config_write_button)->active; if (!gkrellm_config_window_shown()) return; model = gtk_tree_view_get_model(treeview); pixbuf = ap->activated ? gkrellm_alert_pixbuf() : NULL; valid = gtk_tree_model_get_iter_first(model, &iter); while (valid) { gtk_tree_model_get(model, &iter, DISK_COLUMN, &disk_test, -1); if (disk == disk_test) { gtk_tree_store_set(GTK_TREE_STORE(model), &iter, IMAGE_COLUMN, pixbuf, -1); return; } if (gtk_tree_model_iter_children(model, &citer, &iter)) do { gtk_tree_model_get(model, &citer, DISK_COLUMN, &disk_test, -1); if (disk == disk_test) { gtk_tree_store_set(GTK_TREE_STORE(model), &citer, IMAGE_COLUMN, pixbuf, -1); return; } } while (gtk_tree_model_iter_next(model, &citer)); valid = gtk_tree_model_iter_next(model, &iter); } }
false
false
false
false
false
0
ustring(long nl,long nh) { unsigned char *v; v=(unsigned char *)malloc((size_t) (sizeof(unsigned char)* (nh-nl+1))); if (!v) { fprintf(stderr,"Can't allocate %ld bytes\n",nh-nl+1); while(1) { } exit_with_msg_and_exit_code("Memory allocation failure in ustring()",MEMORY_ALLOCATION_ERROR_IN_USTRING); } return v-nl; }
false
false
false
false
false
0
usb_hcd_flush_endpoint(struct usb_device *udev, struct usb_host_endpoint *ep) { struct usb_hcd *hcd; struct urb *urb; if (!ep) return; might_sleep(); hcd = bus_to_hcd(udev->bus); /* No more submits can occur */ spin_lock_irq(&hcd_urb_list_lock); rescan: list_for_each_entry_reverse(urb, &ep->urb_list, urb_list) { int is_in; if (urb->unlinked) continue; usb_get_urb (urb); is_in = usb_urb_dir_in(urb); spin_unlock(&hcd_urb_list_lock); /* kick hcd */ unlink1(hcd, urb, -ESHUTDOWN); dev_dbg (hcd->self.controller, "shutdown urb %pK ep%d%s%s\n", urb, usb_endpoint_num(&ep->desc), is_in ? "in" : "out", ({ char *s; switch (usb_endpoint_type(&ep->desc)) { case USB_ENDPOINT_XFER_CONTROL: s = ""; break; case USB_ENDPOINT_XFER_BULK: s = "-bulk"; break; case USB_ENDPOINT_XFER_INT: s = "-intr"; break; default: s = "-iso"; break; }; s; })); usb_put_urb (urb); /* list contents may have changed */ spin_lock(&hcd_urb_list_lock); goto rescan; } spin_unlock_irq(&hcd_urb_list_lock); /* Wait until the endpoint queue is completely empty */ while (!list_empty (&ep->urb_list)) { spin_lock_irq(&hcd_urb_list_lock); /* The list may have changed while we acquired the spinlock */ urb = NULL; if (!list_empty (&ep->urb_list)) { urb = list_entry (ep->urb_list.prev, struct urb, urb_list); usb_get_urb (urb); } spin_unlock_irq(&hcd_urb_list_lock); if (urb) { usb_kill_urb (urb); usb_put_urb (urb); } } }
false
false
false
false
false
0
filter_rebuild(void) { GList *work; guint i; string_list_free(extension_list); extension_list = NULL; string_list_free(file_writable_list); file_writable_list = NULL; string_list_free(file_sidecar_list); file_sidecar_list = NULL; for (i = 0; i < FILE_FORMAT_CLASSES; i++) { string_list_free(file_class_extension_list[i]); file_class_extension_list[i] = NULL; } work = filter_list; while (work) { FilterEntry *fe; fe = work->data; work = work->next; if (fe->enabled) { GList *ext; ext = filter_to_list(fe->extensions); if (ext) extension_list = g_list_concat(extension_list, ext); if (fe->file_class < FILE_FORMAT_CLASSES) { ext = filter_to_list(fe->extensions); if (ext) file_class_extension_list[fe->file_class] = g_list_concat(file_class_extension_list[fe->file_class], ext); } else { log_printf("WARNING: invalid file class %d\n", fe->file_class); } if (fe->writable) { ext = filter_to_list(fe->extensions); if (ext) file_writable_list = g_list_concat(file_writable_list, ext); } if (fe->allow_sidecar) { ext = filter_to_list(fe->extensions); if (ext) file_sidecar_list = g_list_concat(file_sidecar_list, ext); } } } /* make sure registered_extension_from_path finds the longer match first */ extension_list = g_list_sort(extension_list, filter_sort_ext_len_cb); sidecar_ext_parse(options->sidecar.ext); /* this must be updated after changed file extensions */ }
false
false
false
false
false
0
etgc_get_cell_geometry (ETableGroup *etg, gint *row, gint *col, gint *x, gint *y, gint *width, gint *height) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); gint ypos; ypos = 0; if (etgc->children) { GList *list; for (list = etgc->children; list; list = list->next) { ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; ETableGroup *child = child_node->child; gint thisy; e_table_group_get_cell_geometry (child, row, col, x, &thisy, width, height); ypos += thisy; if ((*row == -1) || (*col == -1)) { ypos += TITLE_HEIGHT; *x += GROUP_INDENT; *y = ypos; return; } } } }
false
false
false
false
false
0
frsw_start(char *filename) { frsw_table_t *t; if (!(t = frsw_create_table("default"))) { fprintf(stderr,"FRSW: unable to create virtual fabric table.\n"); return(-1); } if (frsw_read_cfg_file(t,filename) == -1) { fprintf(stderr,"FRSW: unable to parse configuration file.\n"); return(-1); } frsw_release("default"); return(0); }
false
false
false
false
false
0
printer_add (GDBusProxy *proxy, const char *printer_name, const char *printer_uri, const char *ppd_file, const char *info, const char *location, GError **error) { GVariant *result; char *ret_error; *error = NULL; ret_error = NULL; result = g_dbus_proxy_call_sync (proxy, "PrinterAdd", g_variant_new ("(sssss)", printer_name, printer_uri, ppd_file, info, location), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); if (result == NULL) return FALSE; g_variant_get (result, "(s)", &ret_error); g_variant_unref (result); if (!ret_error || ret_error[0] == '\0') g_print ("Worked!\n"); else g_print ("Ouch: %s\n", ret_error); g_free (ret_error); return TRUE; }
false
false
false
false
false
0
config_hook_exec(const char *filename, const char *module, struct ast_config *cfg) { struct ao2_iterator it; struct cfg_hook *hook; if (!(cfg_hooks)) { return; } it = ao2_iterator_init(cfg_hooks, 0); while ((hook = ao2_iterator_next(&it))) { if (!strcasecmp(hook->filename, filename) && !strcasecmp(hook->module, module)) { struct ast_config *copy = ast_config_copy(cfg); hook->hook_cb(copy); } ao2_ref(hook, -1); } ao2_iterator_destroy(&it); }
false
false
false
false
false
0
vl_get_thread_specific_state (void) { #ifdef VL_DISABLE_THREADS return vl_get_state()->threadState ; #else VlState * state ; VlThreadState * threadState ; vl_lock_state() ; state = vl_get_state() ; #if defined(VL_THREADS_POSIX) threadState = (VlThreadState *) pthread_getspecific(state->threadKey) ; #elif defined(VL_THREADS_WIN) threadState = (VlThreadState *) TlsGetValue(state->tlsIndex) ; #endif if (! threadState) { threadState = vl_thread_specific_state_new () ; } #if defined(VL_THREADS_POSIX) pthread_setspecific(state->threadKey, threadState) ; #elif defined(VL_THREADS_WIN) TlsSetValue(state->tlsIndex, threadState) ; #endif vl_unlock_state() ; return threadState ; #endif }
false
false
false
false
false
0
unquote (const char *str) { gint slen; const char *end; if (str == NULL) return NULL; slen = strlen (str); if (slen < 2) return NULL; if (*str != '\'' && *str != '\"') return NULL; end = str + slen - 1; if (*str != *end) return NULL; return g_strndup (str + 1, slen - 2); }
false
false
false
false
false
0
stripe_pathinfo_aggregate (char *buffer, stripe_local_t *local, int32_t *total) { int32_t i = 0; int32_t ret = -1; int32_t len = 0; char *sbuf = NULL; stripe_xattr_sort_t *xattr = NULL; if (!buffer || !local || !local->xattr_list) goto out; sbuf = buffer; for (i = 0; i < local->nallocs; i++) { xattr = local->xattr_list + i; len = xattr->pathinfo_len; if (len && xattr && xattr->pathinfo) { memcpy (buffer, xattr->pathinfo, len); buffer += len; *buffer++ = ' '; } } *--buffer = '\0'; if (total) *total = buffer - sbuf; ret = 0; out: return ret; }
false
true
false
false
false
1
s_server(int ac, char **av) { char sendstr[MAXLINE + 1]; char **line; struct Server *tempserv; if (ac < 4) return; /* * make sure av[2] isn't in the server list - one reason it might * be is if services squit'd it and created a fake server * in the connect burst, but the hub would send the server line * to us anyway, before processing our SQUIT */ if ((tempserv = FindServer(av[2]))) #ifndef SPLIT_INFO return; #else /* Yeah, this is server that has already been in server list. Now, we * have 2 cases - either this is juped server or is not. If it is, * ignore whole split stuff -kre */ { if ((ac == 5) #ifdef ALLOW_JUPES && !IsJupe(tempserv->name) #endif /* ALLOW_JUPES */ ) { tempserv->uplink = FindServer(av[0] + 1); SendUmode(OPERUMODE_Y, "Server %s has connected to %s " "after %s split time", av[2], av[0] + 1, timeago(tempserv->split_ts, 0)); tempserv->split_ts = 0; tempserv->connect_ts = current_ts; #ifdef RECORD_RESTART_TS most_recent_sjoin = current_ts; #endif } return; } #endif /* SPLIT_INFO */ tempserv = AddServer(ac, av); #ifdef RECORD_RESTART_TS most_recent_sjoin = current_ts; #endif if (tempserv && (tempserv == Me.hub)) { /* * it's the SERVER line from the hub in the initial burst */ /* * get the network server name of hub in case it * doesn't match it's hostname */ MyFree(currenthub->realname); currenthub->realname = MyStrdup(av[1]); /* * add the services (our) server as well */ ircsprintf(sendstr, ":%s SERVER %s 1 :%s", av[1], Me.name, Me.info); SplitBuf(sendstr, &line); AddServer(5, line); MyFree(line); /* * Set our hub's uplink as services (we are the hub of our * uplink) */ tempserv->uplink = Me.sptr; /* initialize service nicks */ InitServs(NULL); #ifdef ALLOW_JUPES /* Introduce juped nicks/servers to the network */ InitJupes(); #endif /* ALLOW_JUPES */ } else { #ifdef ALLOW_JUPES /* a new server connected to network, check if its juped */ CheckJuped(av[2]); #endif /* ALLOW_JUPES */ #ifdef DEBUGMODE fprintf(stderr, "Introducing new server %s\n", av[2]); #endif /* DEBUGMODE */ } }
false
false
false
false
false
0
IoLexer_readExponent(IoLexer *self) { if (IoLexer_readCharAnyCase_(self, 'e')) { if (!IoLexer_readChar_(self, '-')) { IoLexer_readChar_(self, '+'); } if (!IoLexer_readDigits(self)) { return -1; } return 1; } return 0; }
false
false
false
false
false
0
tryadd(node *p, node **item, node **nufork) { /* temporarily adds one fork and one tip to the tree. if the location where they are added yields greater likelihood than other locations tested up to that time, then keeps that location as there */ long grcategs; grcategs = (categs > rcategs) ? categs : rcategs; promlk_add(p, *item, *nufork, true); like = prot_evaluate(p); if (lastsp) { if (like >= bestyet || bestyet == UNDEFINED) prot_copy_(&curtree, &bestree, nonodes, grcategs); } if (like > bestyet || bestyet == UNDEFINED) { bestyet = like; there = p; } promlk_re_move(item, nufork, true); }
false
false
false
false
false
0
WindowsCharsetName() const { char* cpname = wvLIDToCodePageConverter(getWinLanguageCode()); bool is_default; const char* ret = search_map(MSCodepagename_to_charset_name_map,cpname,&is_default); return is_default ? cpname : ret; }
false
false
false
false
false
0
Write(const void* data, size_t data_len, size_t* written, int* error) { if (error) *error = -1; return SR_ERROR; }
false
false
false
false
false
0
btr_def_live_range (btr_def def, HARD_REG_SET *btrs_live_in_range) { if (!def->live_range) { btr_user user; def->live_range = BITMAP_ALLOC (NULL); bitmap_set_bit (def->live_range, def->bb->index); COPY_HARD_REG_SET (*btrs_live_in_range, (flag_btr_bb_exclusive ? btrs_live : btrs_live_at_end)[def->bb->index]); for (user = def->uses; user != NULL; user = user->next) augment_live_range (def->live_range, btrs_live_in_range, def->bb, user->bb, (flag_btr_bb_exclusive || user->insn != BB_END (def->bb) || !JUMP_P (user->insn))); } else { /* def->live_range is accurate, but we need to recompute the set of target registers live over it, because migration of other PT instructions may have affected it. */ unsigned bb; unsigned def_bb = flag_btr_bb_exclusive ? -1 : def->bb->index; bitmap_iterator bi; CLEAR_HARD_REG_SET (*btrs_live_in_range); EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi) { IOR_HARD_REG_SET (*btrs_live_in_range, (def_bb == bb ? btrs_live_at_end : btrs_live) [bb]); } } if (!def->other_btr_uses_before_def && !def->other_btr_uses_after_use) CLEAR_HARD_REG_BIT (*btrs_live_in_range, def->btr); }
false
false
false
false
false
0
parse_params_obsolete_callback(CS& cmd) { return ONE_OF || Get(cmd, "l", &_length) || Get(cmd, "w", &_width) || EVAL_BM_ACTION_BASE::parse_params_obsolete_callback(cmd) ; }
false
false
false
false
false
0
moov_recov_parse_mdia (MoovRecovFile * moovrf, TrakRecovData * trakrd) { guint32 size; guint32 fourcc; /* make sure we are on a tkhd atom */ if (!read_atom_header (moovrf->file, &fourcc, &size)) return FALSE; if (fourcc != FOURCC_mdia) return FALSE; trakrd->mdia_file_offset = ftell (moovrf->file) - 8; trakrd->mdia_size = size; if (!moov_recov_parse_mdhd (moovrf, trakrd)) return FALSE; if (!skip_atom (moovrf, FOURCC_hdlr)) return FALSE; if (!moov_recov_parse_minf (moovrf, trakrd)) return FALSE; return TRUE; }
false
false
false
false
false
0
vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, float quality){ codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; quality+=.0000001; if(quality>=1.)quality=.9999; get_setup_template(vi,channels,rate,quality,0); if(!hi->setup)return OV_EIMPL; return vorbis_encode_setup_setting(vi,channels,rate); }
false
false
false
false
false
0
Perl_sv_bless(pTHX_ SV *const sv, HV *const stash) { dVAR; SV *tmpRef; PERL_ARGS_ASSERT_SV_BLESS; if (!SvROK(sv)) Perl_croak(aTHX_ "Can't bless non-reference value"); tmpRef = SvRV(sv); if (SvFLAGS(tmpRef) & (SVs_OBJECT|SVf_READONLY)) { if (SvREADONLY(tmpRef) && !SvIsCOW(tmpRef)) Perl_croak_no_modify(); if (SvOBJECT(tmpRef)) { SvREFCNT_dec(SvSTASH(tmpRef)); } } SvOBJECT_on(tmpRef); SvUPGRADE(tmpRef, SVt_PVMG); SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash))); if(SvSMAGICAL(tmpRef)) if(mg_find(tmpRef, PERL_MAGIC_ext) || mg_find(tmpRef, PERL_MAGIC_uvar)) mg_set(tmpRef); return sv; }
false
false
false
false
false
0
qla4_83xx_poll_list(struct scsi_qla_host *ha, struct qla4_83xx_reset_entry_hdr *p_hdr) { long delay; struct qla4_83xx_entry *p_entry; struct qla4_83xx_poll *p_poll; uint32_t i; uint32_t value; p_poll = (struct qla4_83xx_poll *) ((char *)p_hdr + sizeof(struct qla4_83xx_reset_entry_hdr)); /* Entries start after 8 byte qla4_83xx_poll, poll header contains * the test_mask, test_value. */ p_entry = (struct qla4_83xx_entry *)((char *)p_poll + sizeof(struct qla4_83xx_poll)); delay = (long)p_hdr->delay; if (!delay) { for (i = 0; i < p_hdr->count; i++, p_entry++) { qla4_83xx_poll_reg(ha, p_entry->arg1, delay, p_poll->test_mask, p_poll->test_value); } } else { for (i = 0; i < p_hdr->count; i++, p_entry++) { if (qla4_83xx_poll_reg(ha, p_entry->arg1, delay, p_poll->test_mask, p_poll->test_value)) { qla4_83xx_rd_reg_indirect(ha, p_entry->arg1, &value); qla4_83xx_rd_reg_indirect(ha, p_entry->arg2, &value); } } } }
false
false
false
false
false
0
xdmcp_write (XDMCPClient *client, const guint8 *buffer, gssize buffer_length) { gssize n_written; GError *error = NULL; n_written = g_socket_send (client->priv->socket, (const gchar *) buffer, buffer_length, NULL, &error); if (n_written < 0) g_warning ("Failed to send XDMCP request: %s", error->message); else if (n_written != buffer_length) g_warning ("Partial write for XDMCP request, wrote %zi, expected %zi", n_written, buffer_length); g_clear_error (&error); }
false
false
false
false
false
0
dbchange(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbchange(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NULL); if (dbproc->envchange_rcv & (1 << (TDS_ENV_DATABASE - 1))) { return dbproc->dbcurdb; } return NULL; }
false
false
false
false
false
0
seqWriteFastqIllumina(AjPSeqout outseq) { ajuint j; ajuint ilen; AjPStr seq = NULL; ajint qchar; ajDebug("seqWriteFastqIllumina Name '%S'\n", outseq->Name); seqDbName(&outseq->Name, outseq->Setoutdb); ajWritebinByte(outseq->File, '@'); ajWriteline(outseq->File, outseq->Name); if(ajStrGetLen(outseq->Sv)) ajWritelineSpace(outseq->File, outseq->Sv); else if(ajStrGetLen(outseq->Acc)) ajWritelineSpace(outseq->File, outseq->Acc); /* no need to bother with outseq->Gi because we have Sv anyway */ if(ajStrGetLen(outseq->Desc)) ajWritelineSpace(outseq->File, outseq->Desc); ajWritebinNewline(outseq->File); ilen = ajStrGetLen(outseq->Seq); ajWritelineNewline(outseq->File, outseq->Seq); ajWritebinByte(outseq->File, '+'); ajWritebinNewline(outseq->File); ilen = ajStrGetLen(outseq->Seq); if(outseq->Accuracy) { ajStrAssignClear(&seq); for(j=0;j<ilen;j++) { qchar = 64 + (int) (0.5 + outseq->Accuracy[j]); if(qchar > 126) qchar = 126; else if(qchar < 33) qchar = 33; ajStrAppendK(&seq, (char) qchar); } ajWritelineNewline(outseq->File, seq); } else { /* ** default to a score of 1 (0.75 error : 1 base in 4 is right) */ ajStrAssignClear(&seq); ajStrAppendCountK(&seq,'A', ilen); ajWritelineNewline(outseq->File, seq); } ajStrDel(&seq); return; }
false
false
false
false
false
0
computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, const Triple &TT) { std::string FullFS = FS; // Make sure 64-bit features are available when CPUname is generic if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le) { if (!FullFS.empty()) FullFS = "+64bit," + FullFS; else FullFS = "+64bit"; } if (OL >= CodeGenOpt::Default) { if (!FullFS.empty()) FullFS = "+crbits," + FullFS; else FullFS = "+crbits"; } if (OL != CodeGenOpt::None) { if (!FullFS.empty()) FullFS = "+invariant-function-descriptors," + FullFS; else FullFS = "+invariant-function-descriptors"; } return FullFS; }
false
false
false
false
false
0
rowCount(const QModelIndex& /* parent */) const { return(m_pCertificateDirectory->entryList().size()); }
false
false
false
false
false
0
mgr_get_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int *ridx) { int err; if (n > mgr->avail) return -ENOENT; err = get_resource(mgr->rscs, mgr->amount, n, ridx); if (!err) mgr->avail -= n; return err; }
false
false
false
false
false
0
_rtl92de_update_rxsignalstatistics(struct ieee80211_hw *hw, struct rtl_stats *pstats) { struct rtl_priv *rtlpriv = rtl_priv(hw); int weighting = 0; if (rtlpriv->stats.recv_signal_power == 0) rtlpriv->stats.recv_signal_power = pstats->recvsignalpower; if (pstats->recvsignalpower > rtlpriv->stats.recv_signal_power) weighting = 5; else if (pstats->recvsignalpower < rtlpriv->stats.recv_signal_power) weighting = (-5); rtlpriv->stats.recv_signal_power = (rtlpriv->stats.recv_signal_power * 5 + pstats->recvsignalpower + weighting) / 6; }
false
false
false
false
false
0
EnableCellUserIds() { if(this->CellProperties->NoUserIds()) { vtkIdType *ids = new vtkIdType[this->NumberOfCells]; //the cell properties will delete the ghost array when needed this->CellProperties->SetMaterialIdArray(ids); vtkIdTypeArray *userIds = vtkIdTypeArray::New(); userIds->SetName("UserIds"); userIds->SetVoidArray(ids,this->NumberOfCells,1); this->Grid->GetCellData()->SetGlobalIds(userIds); userIds->FastDelete(); } }
false
false
false
false
false
0