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
efx_ef10_filter_table_probe(struct efx_nic *efx) { MCDI_DECLARE_BUF(inbuf, MC_CMD_GET_PARSER_DISP_INFO_IN_LEN); MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX); unsigned int pd_match_pri, pd_match_count; struct efx_ef10_filter_table *table; size_t outlen; int rc; table = kzalloc(sizeof(*table), GFP_KERNEL); if (!table) return -ENOMEM; /* Find out which RX filter types are supported, and their priorities */ MCDI_SET_DWORD(inbuf, GET_PARSER_DISP_INFO_IN_OP, MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_SUPPORTED_RX_MATCHES); rc = efx_mcdi_rpc(efx, MC_CMD_GET_PARSER_DISP_INFO, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; pd_match_count = MCDI_VAR_ARRAY_LEN( outlen, GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES); table->rx_match_count = 0; for (pd_match_pri = 0; pd_match_pri < pd_match_count; pd_match_pri++) { u32 mcdi_flags = MCDI_ARRAY_DWORD( outbuf, GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES, pd_match_pri); rc = efx_ef10_filter_match_flags_from_mcdi(mcdi_flags); if (rc < 0) { netif_dbg(efx, probe, efx->net_dev, "%s: fw flags %#x pri %u not supported in driver\n", __func__, mcdi_flags, pd_match_pri); } else { netif_dbg(efx, probe, efx->net_dev, "%s: fw flags %#x pri %u supported as driver flags %#x pri %u\n", __func__, mcdi_flags, pd_match_pri, rc, table->rx_match_count); table->rx_match_flags[table->rx_match_count++] = rc; } } table->entry = vzalloc(HUNT_FILTER_TBL_ROWS * sizeof(*table->entry)); if (!table->entry) { rc = -ENOMEM; goto fail; } table->ucdef_id = EFX_EF10_FILTER_ID_INVALID; table->bcast_id = EFX_EF10_FILTER_ID_INVALID; table->mcdef_id = EFX_EF10_FILTER_ID_INVALID; efx->filter_state = table; init_waitqueue_head(&table->waitq); return 0; fail: kfree(table); return rc; }
false
false
false
false
false
0
crossedPortal(const PortalBase* otherPortal) { // Only check if portal is open and is not an antiportal if (otherPortal->getEnabled()) { // we model both portals as line swept spheres (mPrevDerivedCP to mDerivedCP). // intersection test is then between the capsules. // BUGBUG! This routine needs to check for case where one or both objects // don't move - resulting in simple sphere tests // BUGBUG! If one (or both) portals are aabb's this is REALLY not accurate. const Capsule& otherPortalCapsule(otherPortal->getCapsule()); if (getCapsule().intersects(otherPortalCapsule)) { // the portal intersected the other portal at some time from last frame to this frame. // Now check if this portal "crossed" the other portal switch (otherPortal->getType()) { case PORTAL_TYPE_QUAD: // a crossing occurs if the "side" of the final position of this portal compared // to the final position of the other portal is negative AND the initial position // of this portal compared to the initial position of the other portal is non-negative // NOTE: This function assumes that this portal is the smaller portal potentially crossing // over the otherPortal which is larger. if (otherPortal->getDerivedPlane().getSide(mDerivedCP) == Plane::NEGATIVE_SIDE && otherPortal->getPrevDerivedPlane().getSide(mPrevDerivedCP) != Plane::NEGATIVE_SIDE) { // crossing occurred! return true; } break; case PORTAL_TYPE_AABB: { // for aabb's we check if the center point went from being inside to being outside // the aabb (or vice versa) for crossing. AxisAlignedBox aabb; aabb.setExtents(otherPortal->getDerivedCorner(0), otherPortal->getDerivedCorner(1)); //bool previousInside = aabb.contains(mPrevDerivedCP); bool currentInside = aabb.contains(mDerivedCP); if (otherPortal->getDerivedDirection() == Vector3::UNIT_Z) { // portal norm is "outward" pointing, look for going from outside to inside //if (previousInside == false && if (currentInside == true) { return true; } } else { // portal norm is "inward" pointing, look for going from inside to outside //if (previousInside == true && if (currentInside == false) { return true; } } } break; case PORTAL_TYPE_SPHERE: { // for spheres we check if the center point went from being inside to being outside // the sphere surface (or vice versa) for crossing. //Real previousDistance2 = mPrevDerivedCP.squaredDistance(otherPortal->getPrevDerivedCP()); Real currentDistance2 = mDerivedCP.squaredDistance(otherPortal->getDerivedCP()); Real mRadius2 = Math::Sqr(otherPortal->getRadius()); if (otherPortal->getDerivedDirection() == Vector3::UNIT_Z) { // portal norm is "outward" pointing, look for going from outside to inside //if (previousDistance2 >= mRadius2 && if (currentDistance2 < mRadius2) { return true; } } else { // portal norm is "inward" pointing, look for going from inside to outside //if (previousDistance2 < mRadius2 && if (currentDistance2 >= mRadius2) { return true; } } } break; } } } // there was no crossing of the portal by this portal. It might be touching // the other portal (but we don't care currently) or the other // portal might be an antiportal (crossing not possible) or the // other portal might be closed. return false; }
false
false
false
false
false
0
put_decl_string (const char *str, int len) { if (len < 0) len = strlen (str); if (decl_bufpos + len >= decl_buflen) { if (decl_buf == NULL) { decl_buflen = len + 100; decl_buf = XNEWVEC (char, decl_buflen); } else { decl_buflen *= 2; decl_buf = XRESIZEVAR (char, decl_buf, decl_buflen); } } strcpy (decl_buf + decl_bufpos, str); decl_bufpos += len; }
false
false
false
false
false
0
emitLineNumberAsDotLoc(const MachineInstr &MI) { if (!EmitLineNumbers) return; if (ignoreLoc(MI)) return; DebugLoc curLoc = MI.getDebugLoc(); if (!prevDebugLoc && !curLoc) return; if (prevDebugLoc == curLoc) return; prevDebugLoc = curLoc; if (!curLoc) return; auto *Scope = cast_or_null<DIScope>(curLoc.getScope()); if (!Scope) return; StringRef fileName(Scope->getFilename()); StringRef dirName(Scope->getDirectory()); SmallString<128> FullPathName = dirName; if (!dirName.empty() && !sys::path::is_absolute(fileName)) { sys::path::append(FullPathName, fileName); fileName = FullPathName; } if (filenameMap.find(fileName) == filenameMap.end()) return; // Emit the line from the source file. if (InterleaveSrc) this->emitSrcInText(fileName, curLoc.getLine()); std::stringstream temp; temp << "\t.loc " << filenameMap[fileName] << " " << curLoc.getLine() << " " << curLoc.getCol(); OutStreamer->EmitRawText(temp.str()); }
false
false
false
false
false
0
category_move(guint32 key1, guint32 key2) { GList *list; list = g_list_first(GLOBALS->ope_list); while (list != NULL) { Transaction *entry = list->data; if(entry->kcat == key1) { entry->kcat = key2; entry->flags |= OF_CHANGED; } list = g_list_next(list); } list = g_list_first(GLOBALS->arc_list); while (list != NULL) { Archive *entry = list->data; if(entry->kcat == key1) { entry->kcat = key2; } list = g_list_next(list); } list = g_hash_table_get_values(GLOBALS->h_rul); while (list != NULL) { Assign *entry = list->data; if(entry->kcat == key1) { entry->kcat = key2; } list = g_list_next(list); } g_list_free(list); }
false
false
false
false
false
0
qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); SourceObjPlugin *_t = static_cast<SourceObjPlugin *>(_o); switch (_id) { case 0: _t->aSignal((*reinterpret_cast< const std::string(*)>(_a[1]))); break; case 1: _t->emitSignal((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: _t->link((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< QObject*(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3]))); break; default: ; } } }
false
false
false
false
false
0
get_grouping( AllData& alldata ) { uint32_t r_processes= alldata.allProcesses.size(); uint32_t r_groups= alldata.params.max_groups; set< Process, ltProcess >::iterator pos= alldata.allProcesses.begin(); for ( uint32_t c= 0; c < Grouping::MAX_GROUPS && 0 < r_processes; c++ ) { uint32_t n= ( ( r_processes / r_groups ) * r_groups < r_processes ) ? ( r_processes / r_groups + 1 ) : ( r_processes / r_groups ); for ( uint32_t i= 0; i < n; i++ ) { alldata.grouping.insert( c+1, pos->process ); pos++; r_processes--; } r_groups--; } }
false
false
false
false
false
0
isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const { // If this is a landing pad, it isn't a fall through. If it has no preds, // then nothing falls through to it. if (MBB->isLandingPad() || MBB->pred_empty()) return false; // If there isn't exactly one predecessor, it can't be a fall through. MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), PI2 = PI; ++PI2; if (PI2 != MBB->pred_end()) return false; // The predecessor has to be immediately before this block. const MachineBasicBlock *Pred = *PI; if (!Pred->isLayoutSuccessor(MBB)) return false; // Check if the last terminator is an unconditional branch. MachineBasicBlock::const_iterator I = Pred->end(); while (I != Pred->begin() && !(--I)->getDesc().isTerminator()) ; // Noop return I == Pred->end() || !I->getDesc().isBarrier(); }
false
false
false
false
false
0
gf_defrag_start_crawl (void *data) { xlator_t *this = NULL; dht_conf_t *conf = NULL; gf_defrag_info_t *defrag = NULL; int ret = -1; loc_t loc = {0,}; struct iatt iatt = {0,}; struct iatt parent = {0,}; dict_t *fix_layout = NULL; dict_t *migrate_data = NULL; dict_t *status = NULL; this = data; if (!this) goto out; conf = this->private; if (!conf) goto out; defrag = conf->defrag; if (!defrag) goto out; dht_build_root_inode (this, &defrag->root_inode); if (!defrag->root_inode) goto out; dht_build_root_loc (defrag->root_inode, &loc); /* fix-layout on '/' first */ ret = syncop_lookup (this, &loc, NULL, &iatt, NULL, &parent); if (ret) { gf_log (this->name, GF_LOG_ERROR, "look up on / failed"); goto out; } fix_layout = dict_new (); if (!fix_layout) { ret = -1; goto out; } ret = dict_set_str (fix_layout, GF_XATTR_FIX_LAYOUT_KEY, "yes"); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to set dict str"); goto out; } ret = syncop_setxattr (this, &loc, fix_layout, 0); if (ret) { gf_log (this->name, GF_LOG_ERROR, "fix layout on %s failed", loc.path); goto out; } if (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX) { migrate_data = dict_new (); if (!migrate_data) { ret = -1; goto out; } if (defrag->cmd == GF_DEFRAG_CMD_START_FORCE) ret = dict_set_str (migrate_data, "distribute.migrate-data", "force"); else ret = dict_set_str (migrate_data, "distribute.migrate-data", "non-force"); if (ret) goto out; } ret = gf_defrag_fix_layout (this, defrag, &loc, fix_layout, migrate_data); if ((defrag->defrag_status != GF_DEFRAG_STATUS_STOPPED) && (defrag->defrag_status != GF_DEFRAG_STATUS_FAILED)) { defrag->defrag_status = GF_DEFRAG_STATUS_COMPLETE; } out: LOCK (&defrag->lock); { status = dict_new (); gf_defrag_status_get (defrag, status); glusterfs_rebalance_event_notify (status); if (status) dict_unref (status); defrag->is_exiting = 1; } UNLOCK (&defrag->lock); if (defrag) GF_FREE (defrag); return ret; }
false
false
false
false
false
0
search_gui_set_record_info(results_set_t *rs) { str_t *vinfo = str_new(40); GSList *iter; guint i; results_set_check(rs); /* If banned GUID, make it prominent: at the start of the information! */ if (rs->status & ST_BANNED_GUID) { str_cat(vinfo, "GUID"); } for (i = 0; i < G_N_ELEMENTS(open_flags); i++) { if (rs->status & open_flags[i].flag) { if (str_len(vinfo) > 0) str_cat(vinfo, ", "); str_cat(vinfo, _(open_flags[i].status)); } } if (!(rs->status & ST_PARSED_TRAILER)) { if (str_len(vinfo) > 0) str_cat(vinfo, ", "); str_cat(vinfo, _("<unparsed>")); } if (rs->status & ST_TLS) { str_cat(vinfo, str_len(vinfo) > 0 ? ", TLS" : "TLS"); } if (rs->status & ST_BH) { if (str_len(vinfo) > 0) { str_cat(vinfo, ", "); } str_cat(vinfo, _("browsable")); } for (iter = rs->records; iter != NULL; iter = g_slist_next(iter)) { record_t *rc = iter->data; record_check(rc); g_assert(rs == rc->results_set); g_assert(NULL == rc->info); rc->info = search_gui_get_info(rc, str_len(vinfo) > 0 ? str_2c(vinfo) : NULL); } str_destroy(vinfo); }
false
false
false
false
false
0
sourceRowsRemoved(const QModelIndex &parent, int start, int end) { Q_Q(KSelectionProxyModel); Q_UNUSED(end) Q_ASSERT(parent.isValid() ? parent.model() == q->sourceModel() : true); if (!m_selectionModel.data()->hasSelection()) return; if (!m_rowsRemoved) return; m_rowsRemoved = false; Q_ASSERT(m_proxyRemoveRows.first >= 0); Q_ASSERT(m_proxyRemoveRows.second >= 0); endRemoveRows(parent, m_proxyRemoveRows.first, m_proxyRemoveRows.second); if (m_startWithChildTrees && start == 0 && q->sourceModel()->hasChildren(parent)) // The private endRemoveRows call might remove the first child mapping for parent, so // we create it again in that case. createFirstChildMapping(parent, m_proxyRemoveRows.first); m_proxyRemoveRows = qMakePair(-1, -1); q->endRemoveRows(); }
false
false
false
false
false
0
gf_odf_write_ipmp_tool_list(GF_BitStream *bs, GF_IPMP_ToolList *ipmptl) { GF_Err e; u32 size; if (!ipmptl) return GF_BAD_PARAM; e = gf_odf_size_descriptor((GF_Descriptor *)ipmptl, &size); if (e) return e; e = gf_odf_write_base_descriptor(bs, ipmptl->tag, size); if (e) return e; e = gf_odf_write_descriptor_list(bs, ipmptl->ipmp_tools); return GF_OK; }
false
false
false
false
false
0
norx_absorb(norx_state_t state, const uint8_t * in, tag_t tag) { norx_word_t * S = state->S; size_t i; norx_inject_tag(state, tag); norx_permutation(state); #if defined(NORX_DEBUG) if (tag == HEADER_TAG) { printf("End of initialisation:\n"); norx_print_state(state); } #endif for (i = 0; i < WORDS(RATE); ++i) S[i] ^= LOAD(in + i * BYTES(NORX_W)); }
false
false
false
false
false
0
processListenSockets(fd_set *reads) { struct socklist *s; int ret = False; for (s = listensocks; s; s = s->next) if (FD_ISSET(s->fd, reads)) { processRequestSocket(s->fd); ret = True; } return ret; }
false
false
false
false
false
0
lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return(ret); }
false
false
false
false
false
0
expr3 (parser *p) { NODE *t; #if SDEBUG fprintf(stderr, "expr3: starting...\n"); #endif if (p->err || (t = expr4(p)) == NULL) { return NULL; } while (!p->err && (p->sym == B_GT || p->sym == B_LT || p->sym == B_DOTGT || p->sym == B_DOTLT || p->sym == B_GTE || p->sym == B_LTE || p->sym == B_DOTGTE || p->sym == B_DOTLTE)) { t = newb2(p->sym, t, NULL); if (t != NULL) { lex(p); t->v.b2.r = expr4(p); } } #if SDEBUG notify("expr3", t, p); #endif return t; }
false
false
false
false
false
0
debug_cdata (char *data, size_t len, int pos) { int i; PRINT_TEST; if (tester.cur && tester.cur->type == IKS_CDATA) printf (" Expecting cdata [%s]\n", tester.cur->cdata); else printf (" Not expecting cdata here\n"); printf (" Got cdata ["); for (i = 0; i < len; i++) putchar (data[i]); printf ("] at the pos %d.\n", pos); }
false
false
false
false
false
0
lua_dump (lua_State *L, lua_Writer writer, void *data) { int status; TValue *o; lua_lock(L); api_checknelems(L, 1); o = L->top - 1; if (isLfunction(o)) status = luaU_dump(L, getproto(o), writer, data, 0); else status = 1; lua_unlock(L); return status; }
false
false
false
false
false
0
readChildren(SoInput *in) // //////////////////////////////////////////////////////////////////////// { SoBase *base; SbBool ret = TRUE; // If reading binary, read number of children first if (in->isBinary()) { int numToRead, i; if (!in->read(numToRead)) ret = FALSE; else { for (i = 0; i < numToRead; i++) { if (SoBase::read(in, base, SoNode::getClassTypeId()) && base != NULL) addChild((SoNode *) base); // Running out of children is now an error, since the // number of children in the file must be exact else { ret = FALSE; break; } } // If we are reading a 1.0 file, read the GROUP_END_MARKER if (ret && in->getIVVersion() == 1.0f) { const int GROUP_END_MARKER = -1; int marker; // Read end marker if it is there. If not, some sort of // error occurred. if (! in->read(marker) || marker != GROUP_END_MARKER) ret = FALSE; } } } // ASCII: Read children until none left. Deal with children // causing errors by adding them as is. else { while (TRUE) { ret = SoBase::read(in, base, SoNode::getClassTypeId()) && ret; // Add child, even if error occurred, unless there is no // child to add. if (base != NULL) addChild((SoNode *) base); // Stop when we run out of valid children else break; } } return ret; }
false
false
false
false
false
0
bkm_scale (__strtol_t *x, int scale_factor) { __strtol_t product = *x * scale_factor; if (*x != product / scale_factor) return 1; *x = product; return 0; }
false
false
false
false
false
0
_rl_char_search (count, fdir, bdir) int count, fdir, bdir; { char mbchar[MB_LEN_MAX]; int mb_len; mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); if (mb_len <= 0) return -1; if (count < 0) return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); else return (_rl_char_search_internal (count, fdir, mbchar, mb_len)); }
false
false
false
false
false
0
has_graphic_extension(const char *s) { GraphConvertElement *thisFormat; diagnostics(4,"testing for graphics extension '%s'",s); for (thisFormat = GraphConvertTable; thisFormat->extension != NULL; thisFormat++) { if (has_extension(s,thisFormat->extension)) return strdup(thisFormat->extension); } return NULL; }
false
false
false
false
false
0
Show(bool show) { bool r = BaseDialog::Show(show); if (show && bookctrl_1->GetPageCount() <= 1) treectrl_1->Hide(); if (bookctrl_1->GetPageCount()) static_text_categ->SetLabel(bookctrl_1->GetPageText(0)); return r; }
false
false
false
false
false
0
createGOAAuthProvider(const InitStateString &username, const InitStateString &password) { // Because we share the connection, hopefully this won't be too expensive. GDBusCXX::DBusErrorCXX err; GDBusCXX::DBusConnectionPtr conn = dbus_get_bus_connection("SESSION", NULL, false, &err); if (!conn) { err.throwFailure("connecting to session bus"); } GOAManager manager(conn); boost::shared_ptr<GOAAccount> account = manager.lookupAccount(username); boost::shared_ptr<AuthProvider> provider(new GOAAuthProvider(account)); return provider; }
false
false
false
false
false
0
pipeInit(SplashPipe *pipe, int x, int y, SplashPattern *pattern, SplashColorPtr cSrc, SplashCoord aInput, GBool usesShape, GBool nonIsolatedGroup) { pipeSetXY(pipe, x, y); pipe->pattern = NULL; // source color if (pattern) { if (pattern->isStatic()) { pattern->getColor(x, y, pipe->cSrcVal); } else { pipe->pattern = pattern; } pipe->cSrc = pipe->cSrcVal; } else { pipe->cSrc = cSrc; } // source alpha pipe->aInput = aInput; if (!state->softMask) { if (usesShape) { pipe->aInput *= 255; } else { pipe->aSrc = (Guchar)splashRound(pipe->aInput * 255); } } pipe->usesShape = usesShape; // result alpha if (aInput == 1 && !state->softMask && !usesShape && !state->inNonIsolatedGroup) { pipe->noTransparency = gTrue; } else { pipe->noTransparency = gFalse; } // result color if (pipe->noTransparency) { // the !state->blendFunc case is handled separately in pipeRun pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode]; } else if (!state->blendFunc) { pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode]; } else { pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode]; } // non-isolated group correction if (nonIsolatedGroup) { pipe->nonIsolatedGroup = splashColorModeNComps[bitmap->mode]; } else { pipe->nonIsolatedGroup = 0; } }
false
false
false
false
false
0
decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b) { int diff,dc,k; int t = decode(j, hdc); if (t < 0) return e("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred + diff; j->img_comp[b].dc_pred = dc; data[0] = (short) dc; // decode AC components, see JPEG spec k = 1; do { int r,s; int rs = decode(j, hac); if (rs < 0) return e("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) break; // end block k += 16; } else { k += r; // decode into unzigzag'd location data[dezigzag[k++]] = (short) extend_receive(j,s); } } while (k < 64); return 1; }
false
false
false
false
false
0
bond_ab_arp_commit(struct bonding *bond) { unsigned long trans_start; struct list_head *iter; struct slave *slave; bond_for_each_slave(bond, slave, iter) { switch (slave->new_link) { case BOND_LINK_NOCHANGE: continue; case BOND_LINK_UP: trans_start = dev_trans_start(slave->dev); if (rtnl_dereference(bond->curr_active_slave) != slave || (!rtnl_dereference(bond->curr_active_slave) && bond_time_in_interval(bond, trans_start, 1))) { struct slave *current_arp_slave; current_arp_slave = rtnl_dereference(bond->current_arp_slave); bond_set_slave_link_state(slave, BOND_LINK_UP, BOND_SLAVE_NOTIFY_NOW); if (current_arp_slave) { bond_set_slave_inactive_flags( current_arp_slave, BOND_SLAVE_NOTIFY_NOW); RCU_INIT_POINTER(bond->current_arp_slave, NULL); } netdev_info(bond->dev, "link status definitely up for interface %s\n", slave->dev->name); if (!rtnl_dereference(bond->curr_active_slave) || slave == rtnl_dereference(bond->primary_slave)) goto do_failover; } continue; case BOND_LINK_DOWN: if (slave->link_failure_count < UINT_MAX) slave->link_failure_count++; bond_set_slave_link_state(slave, BOND_LINK_DOWN, BOND_SLAVE_NOTIFY_NOW); bond_set_slave_inactive_flags(slave, BOND_SLAVE_NOTIFY_NOW); netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", slave->dev->name); if (slave == rtnl_dereference(bond->curr_active_slave)) { RCU_INIT_POINTER(bond->current_arp_slave, NULL); goto do_failover; } continue; default: netdev_err(bond->dev, "impossible: new_link %d on slave %s\n", slave->new_link, slave->dev->name); continue; } do_failover: block_netpoll_tx(); bond_select_active_slave(bond); unblock_netpoll_tx(); } bond_set_carrier(bond); }
false
false
false
false
false
0
pick_curves(CutControls *controls) { GwyGraphModel *parent_gmodel, *graph_model; gint i; graph_model = controls->args->graph_model; parent_gmodel = gwy_graph_get_model(controls->args->parent_graph); gwy_graph_model_remove_all_curves(graph_model); if (!controls->args->is_all) { gwy_graph_model_add_curve(graph_model, gwy_graph_model_get_curve(parent_gmodel, controls->args->curve)); } else { for (i = 0; i < gwy_graph_model_get_n_curves(parent_gmodel); i++) gwy_graph_model_add_curve(graph_model, gwy_graph_model_get_curve(parent_gmodel, i)); } cut_limit_selection(controls, TRUE); }
false
false
false
false
false
0
printLong(acroEntry *entry,int plural) { if (FALSE == plural) { ConvertString(entry->acLong); } else { if (NULL != entry->acLongPlural) { ConvertString(entry->acLongPlural); } else { ConvertString(entry->acLong); ConvertString("s"); } } }
false
false
false
false
false
0
gnome_keyring_attribute_list_to_glist (GnomeKeyringAttributeList *attributes) { GList *list = NULL; GnomeKeyringAttribute *attr; guint i; if (attributes == NULL) return NULL; for (i = 0; i < attributes->len; ++i) { attr = &g_array_index (attributes, GnomeKeyringAttribute, i); list = g_list_append (list, gnome_keyring_attribute_copy (attr)); } return list; }
false
false
false
false
false
0
gnutls_x509_crt_set_proxy_dn (gnutls_x509_crt_t crt, gnutls_x509_crt_t eecrt, unsigned int raw_flag, const void *name, unsigned int sizeof_name) { int result; if (crt == NULL || eecrt == NULL) { return GNUTLS_E_INVALID_REQUEST; } result = asn1_copy_node (crt->cert, "tbsCertificate.subject", eecrt->cert, "tbsCertificate.subject"); if (result != ASN1_SUCCESS) { gnutls_assert (); return _gnutls_asn2err (result); } if (name && sizeof_name) { return _gnutls_x509_set_dn_oid (crt->cert, "tbsCertificate.subject", GNUTLS_OID_X520_COMMON_NAME, raw_flag, name, sizeof_name); } return 0; }
false
false
false
false
false
0
name_as_c_string (tree name, tree type, bool *free_p) { char *pretty_name; /* Assume that we will not allocate memory. */ *free_p = false; /* Constructors and destructors are special. */ if (IDENTIFIER_CTOR_OR_DTOR_P (name)) { pretty_name = CONST_CAST (char *, identifier_to_locale (IDENTIFIER_POINTER (constructor_name (type)))); /* For a destructor, add the '~'. */ if (name == complete_dtor_identifier || name == base_dtor_identifier || name == deleting_dtor_identifier) { pretty_name = concat ("~", pretty_name, NULL); /* Remember that we need to free the memory allocated. */ *free_p = true; } } else if (IDENTIFIER_TYPENAME_P (name)) { pretty_name = concat ("operator ", type_as_string_translate (TREE_TYPE (name), TFF_PLAIN_IDENTIFIER), NULL); /* Remember that we need to free the memory allocated. */ *free_p = true; } else pretty_name = CONST_CAST (char *, identifier_to_locale (IDENTIFIER_POINTER (name))); return pretty_name; }
false
false
false
false
false
0
ParseIdentifier(bool* ok) { i::Token::Value next = Next(); switch (next) { case i::Token::FUTURE_RESERVED_WORD: { i::Scanner::Location location = scanner_->location(); ReportMessageAt(location.beg_pos, location.end_pos, "reserved_word", NULL); *ok = false; } // FALLTHROUGH case i::Token::FUTURE_STRICT_RESERVED_WORD: case i::Token::IDENTIFIER: return GetIdentifierSymbol(); default: *ok = false; return Identifier::Default(); } }
false
false
false
false
false
0
setCoordinateDimension( int nNewDimension ) { for( int iGeom = 0; iGeom < nGeomCount; iGeom++ ) { papoGeoms[iGeom]->setCoordinateDimension( nNewDimension ); } OGRGeometry::setCoordinateDimension( nNewDimension ); }
false
false
false
false
false
0
FormatCapture(const char** capture) { string s; for (int i = 0; i < ncapture_; i+=2) { if (capture[i] == NULL) StringAppendF(&s, "(?,?)"); else if (capture[i+1] == NULL) StringAppendF(&s, "(%d,?)", (int)(capture[i] - btext_)); else StringAppendF(&s, "(%d,%d)", (int)(capture[i] - btext_), (int)(capture[i+1] - btext_)); } return s; }
false
false
false
false
false
0
generate_natd_hash(private_isakmp_natd_t *this, ike_sa_id_t *ike_sa_id, host_t *host) { hasher_t *hasher; chunk_t natd_chunk, natd_hash; u_int64_t spi_i, spi_r; u_int16_t port; hasher = this->keymat->get_hasher(this->keymat); if (!hasher) { DBG1(DBG_IKE, "no hasher available to build NAT-D payload"); return chunk_empty; } spi_i = ike_sa_id->get_initiator_spi(ike_sa_id); spi_r = ike_sa_id->get_responder_spi(ike_sa_id); port = htons(host->get_port(host)); /* natd_hash = HASH(CKY-I | CKY-R | IP | Port) */ natd_chunk = chunk_cata("cccc", chunk_from_thing(spi_i), chunk_from_thing(spi_r), host->get_address(host), chunk_from_thing(port)); if (!hasher->allocate_hash(hasher, natd_chunk, &natd_hash)) { DBG1(DBG_IKE, "creating NAT-D payload hash failed"); return chunk_empty; } DBG3(DBG_IKE, "natd_chunk %B", &natd_chunk); DBG3(DBG_IKE, "natd_hash %B", &natd_hash); return natd_hash; }
false
false
false
false
false
0
newsf(struct snd_sf_list *sflist, int type, char *name) { struct snd_soundfont *sf; /* check the shared fonts */ if (type & SNDRV_SFNT_PAT_SHARED) { for (sf = sflist->fonts; sf; sf = sf->next) { if (is_identical_font(sf, type, name)) { return sf; } } } /* not found -- create a new one */ sf = kzalloc(sizeof(*sf), GFP_KERNEL); if (sf == NULL) return NULL; sf->id = sflist->fonts_size; sflist->fonts_size++; /* prepend this record */ sf->next = sflist->fonts; sflist->fonts = sf; sf->type = type; sf->zones = NULL; sf->samples = NULL; if (name) memcpy(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN); return sf; }
false
false
false
false
false
0
mimeview_change_view_type(MimeView *mimeview, MimeViewType type) { TextView *textview = mimeview->textview; GtkWidget *focused = NULL; if (mainwindow_get_mainwindow()) focused = gtkut_get_focused_child( GTK_CONTAINER(mainwindow_get_mainwindow()->window)); if ((mimeview->type != MIMEVIEW_VIEWER) && (mimeview->type == type)) return; switch (type) { case MIMEVIEW_TEXT: gtk_notebook_set_current_page(GTK_NOTEBOOK(mimeview->mime_notebook), gtk_notebook_page_num(GTK_NOTEBOOK(mimeview->mime_notebook), GTK_WIDGET_PTR(textview))); break; case MIMEVIEW_VIEWER: gtk_notebook_set_current_page(GTK_NOTEBOOK(mimeview->mime_notebook), gtk_notebook_page_num(GTK_NOTEBOOK(mimeview->mime_notebook), GTK_WIDGET(mimeview->mimeviewer->get_widget(mimeview->mimeviewer)))); break; default: return; } if (focused) gtk_widget_grab_focus(focused); mimeview->type = type; }
false
false
false
false
false
0
lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain) { int flags = 0; if (TREE_CODE (scope) == NAMESPACE_DECL) { cxx_binding binding; cxx_binding_clear (&binding); flags |= LOOKUP_COMPLAIN; if (is_type_p) flags |= LOOKUP_PREFER_TYPES; if (qualified_lookup_using_namespace (name, scope, &binding, flags)) return select_decl (&binding, flags); } else if (is_aggr_type (scope, complain)) { tree t; t = lookup_member (scope, name, 0, is_type_p); if (t) return t; } return error_mark_node; }
false
false
false
false
false
0
is_polling_required(struct charger_manager *cm) { switch (cm->desc->polling_mode) { case CM_POLL_DISABLE: return false; case CM_POLL_ALWAYS: return true; case CM_POLL_EXTERNAL_POWER_ONLY: return is_ext_pwr_online(cm); case CM_POLL_CHARGING_ONLY: return is_charging(cm); default: dev_warn(cm->dev, "Incorrect polling_mode (%d)\n", cm->desc->polling_mode); } return false; }
false
false
false
false
false
0
split_line(char **ptr) { char *foo, *res; if (!ptr || !*ptr || !xstrcmp(*ptr, "")) return NULL; res = *ptr; if (!(foo = xstrchr(*ptr, '\n'))) *ptr += xstrlen(*ptr); else { size_t reslen; *ptr = foo + 1; *foo = 0; reslen = xstrlen(res); if (reslen > 1 && res[reslen - 1] == '\r') res[reslen - 1] = 0; } return res; }
false
false
false
false
false
0
createPopupMenu() { KMenu *popup=new KMenu(this ); KActionCollection *actions=new KActionCollection(popup); popup->setObjectName( "PixmapRegionSelectorPopup"); popup->addTitle(i18n("Image Operations")); QAction *action = actions->addAction("rotateclockwise"); action->setText(i18n("&Rotate Clockwise")); action->setIcon( KIcon( "object-rotate-right" ) ); connect( action, SIGNAL(triggered(bool)), this, SLOT(rotateClockwise()) ); popup->addAction(action); action = actions->addAction("rotatecounterclockwise"); action->setText(i18n("Rotate &Counterclockwise")); action->setIcon( KIcon( "object-rotate-left" ) ); connect( action, SIGNAL(triggered(bool)), this, SLOT(rotateCounterclockwise()) ); popup->addAction(action); /* I wonder if it would be appropriate to have here an "Open with..." option to edit the image (antlarr) */ return popup; }
false
false
false
false
false
0
parseValue(gchar *line, float *index, float rgb[3], GError **error) { gchar *name; PangoColor color; double index_; DBG_fprintf(stderr, "Tool Shade: parse step from '%s'\n", line); index_ = g_ascii_strtod(line, &name); if (errno != 0 || name == line) { *error = g_error_new(TOOL_CONFIG_FILE_ERROR, TOOL_CONFIG_FILE_ERROR_READ, _("1 floating point value should start a step '%s'.\n"), line); return FALSE; } *index = (float)index_; DBG_fprintf(stderr, " | index %g\n", *index); name += 1; g_strdelimit(name, "\"'", ' '); g_strstrip(name); if (!pango_color_parse(&color, name)) { *error = g_error_new(TOOL_CONFIG_FILE_ERROR, TOOL_CONFIG_FILE_ERROR_READ, _("cannot read a color from '%s' (name, #rgb, #rrggbb ... awaited).\n"), name); return FALSE; } rgb[0] = (float)color.red / (float)G_MAXUINT16; rgb[1] = (float)color.green / (float)G_MAXUINT16; rgb[2] = (float)color.blue / (float)G_MAXUINT16; DBG_fprintf(stderr, " | color %fx%fx%f\n", rgb[0], rgb[1], rgb[2]); return TRUE; }
false
false
false
false
false
0
cdset_lookup(HTK_HMM_INFO *hmminfo, char *cdstr) { CD_Set *cd; cd = aptree_search_data(cdstr, hmminfo->cdset_info.cdtree); if (cd != NULL && strmatch(cdstr, cd->name)) { return cd; } else { return NULL; } }
false
false
false
false
false
0
threeHalfHalfVectorCoupling(int imode,Energy m0,Energy m1,Energy, Complex&A1,Complex&A2,Complex&A3, Complex&B1,Complex&B2,Complex&B3) const { A3=0.;B3=0.; if(_parity) { A1=0.; B1=-_prefactor[imode]*(m0+m1); A2=0.; B2= _prefactor[imode]*(m0+m1); } else { A1=_prefactor[imode]*(m0-m1);B1=0.; A2=_prefactor[imode]*(m0+m1);B2=0.; } }
false
false
false
false
false
0
rbd_name_show(struct device *dev, struct device_attribute *attr, char *buf) { struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); if (rbd_dev->spec->image_name) return sprintf(buf, "%s\n", rbd_dev->spec->image_name); return sprintf(buf, "(unknown)\n"); }
false
true
false
false
false
1
panel_struts_find_strut (PanelToplevel *toplevel) { GSList *l; for (l = panel_struts_list; l; l = l->next) { PanelStrut *strut = l->data; if (strut->toplevel == toplevel) break; } return l ? l->data : NULL; }
false
false
false
false
false
0
modperl_flags_lookup_dir(const char *str) { switch (*str) { case 'G': if (strEQ(str, "GlobalRequest")) return MpDir_f_GLOBAL_REQUEST; case 'N': if (strEQ(str, "None")) return MpDir_f_NONE; case 'U': if (strEQ(str, "Unset")) return MpDir_f_UNSET; case 'M': if (strEQ(str, "MergeHandlers")) return MpDir_f_MERGE_HANDLERS; case 'P': if (strEQ(str, "ParseHeaders")) return MpDir_f_PARSE_HEADERS; case 'S': if (strEQ(str, "SetupEnv")) return MpDir_f_SETUP_ENV; } return -1; }
false
false
false
false
false
0
i2cdevWrite(I2C_Dev *dev, uint8_t devAddress, uint8_t memAddress, uint16_t len, uint8_t *data) { dev->pCPAL_TransferTx->wNumData = len; dev->pCPAL_TransferTx->pbBuffer = data; dev->pCPAL_TransferTx->wAddr1 = devAddress << 1; dev->pCPAL_TransferTx->wAddr2 = memAddress; if (memAddress != I2CDEV_NO_MEM_ADDR) { dev->wCPAL_Options &= !CPAL_OPT_NO_MEM_ADDR; } else { dev->wCPAL_Options |= CPAL_OPT_NO_MEM_ADDR; } return i2cdevWriteTransfer(dev); }
false
false
false
false
false
0
ossl_pkcs7_add_recipient(VALUE self, VALUE recip) { PKCS7 *pkcs7; PKCS7_RECIP_INFO *ri; ri = DupPKCS7RecipientPtr(recip); /* NEED TO DUP */ GetPKCS7(self, pkcs7); if (!PKCS7_add_recipient_info(pkcs7, ri)) { PKCS7_RECIP_INFO_free(ri); ossl_raise(ePKCS7Error, "Could not add recipient."); } return self; }
false
false
false
false
false
0
ScrollUp(int line) { if (useHardScroll && !con.soft) { TextScrollUp(line); scrollLine += line; } else TextMoveUp(con.ymin, con.ymax, line); }
false
false
false
false
false
0
seq_init_chip() { fprintf(stderr, "initialize chip\n"); AWE_INITIALIZE_CHIP(seqfd, awe_dev); if (!buffering) seqbuf_dump(); }
false
false
false
false
false
0
max98090_add_widgets(struct snd_soc_codec *codec) { struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); snd_soc_add_codec_controls(codec, max98090_snd_controls, ARRAY_SIZE(max98090_snd_controls)); if (max98090->devtype == MAX98091) { snd_soc_add_codec_controls(codec, max98091_snd_controls, ARRAY_SIZE(max98091_snd_controls)); } snd_soc_dapm_new_controls(dapm, max98090_dapm_widgets, ARRAY_SIZE(max98090_dapm_widgets)); snd_soc_dapm_add_routes(dapm, max98090_dapm_routes, ARRAY_SIZE(max98090_dapm_routes)); if (max98090->devtype == MAX98091) { snd_soc_dapm_new_controls(dapm, max98091_dapm_widgets, ARRAY_SIZE(max98091_dapm_widgets)); snd_soc_dapm_add_routes(dapm, max98091_dapm_routes, ARRAY_SIZE(max98091_dapm_routes)); } return 0; }
false
false
false
false
false
0
create_pixmap (const gchar * filename) { gchar *pathname = NULL; GtkWidget *pixmap; if (!filename || !filename[0]) return gtk_image_new (); pathname = find_pixmap_file (filename); if (!pathname) { g_warning (_("Couldn't find pixmap file: %s"), filename); return gtk_image_new (); } pixmap = gtk_image_new_from_file (pathname); g_free (pathname); return pixmap; }
false
false
false
false
false
0
nfs_fop_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *buf, struct iatt *preoldparent, struct iatt *postoldparent, struct iatt *prenewparent, struct iatt *postnewparent) { struct nfs_fop_local *nfl = NULL; fop_rename_cbk_t progcbk = NULL; nfl_to_prog_data (nfl, progcbk, frame); /* The preattr arg needs to be NULL instead of @buf because it is * possible that the new parent is not root whereas the source dir * could have been. That is handled in the next macro. */ nfs_fop_restore_root_ino (nfl, op_ret, NULL, NULL, preoldparent, postoldparent); nfs_fop_newloc_restore_root_ino (nfl, op_ret, buf, NULL, prenewparent, postnewparent); if (progcbk) progcbk (frame, cookie, this, op_ret, op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent); nfs_stack_destroy (nfl, frame); return 0; }
false
false
false
false
false
0
compute_high_time (GstMultiQueue * mq) { /* The high-id is either the highest id among the linked pads, or if all * pads are not-linked, it's the lowest not-linked pad */ GList *tmp; GstClockTime highest = GST_CLOCK_TIME_NONE; GstClockTime lowest = GST_CLOCK_TIME_NONE; for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { GstSingleQueue *sq = (GstSingleQueue *) tmp->data; GST_LOG_OBJECT (mq, "inspecting sq:%d , next_time:%" GST_TIME_FORMAT ", last_time:%" GST_TIME_FORMAT ", srcresult:%s", sq->id, GST_TIME_ARGS (sq->next_time), GST_TIME_ARGS (sq->last_time), gst_flow_get_name (sq->srcresult)); if (sq->srcresult == GST_FLOW_NOT_LINKED) { /* No need to consider queues which are not waiting */ if (sq->next_time == GST_CLOCK_TIME_NONE) { GST_LOG_OBJECT (mq, "sq:%d is not waiting - ignoring", sq->id); continue; } if (lowest == GST_CLOCK_TIME_NONE || sq->next_time < lowest) lowest = sq->next_time; } else if (sq->srcresult != GST_FLOW_EOS) { /* If we don't have a global highid, or the global highid is lower than * this single queue's last outputted id, store the queue's one, * unless the singlequeue is at EOS (srcresult = EOS) */ if (highest == GST_CLOCK_TIME_NONE || sq->last_time > highest) highest = sq->last_time; } } mq->high_time = highest; GST_LOG_OBJECT (mq, "High time is now : %" GST_TIME_FORMAT ", lowest non-linked %" GST_TIME_FORMAT, GST_TIME_ARGS (mq->high_time), GST_TIME_ARGS (lowest)); }
false
false
false
false
false
0
ipmi_fru_parse_next (ipmi_fru_parse_ctx_t ctx) { int rv = 0; if (!ctx || ctx->magic != IPMI_FRU_PARSE_CTX_MAGIC) { ERR_TRACE (ipmi_fru_parse_ctx_errormsg (ctx), ipmi_fru_parse_ctx_errnum (ctx)); return (-1); } if (ctx->chassis_info_area_starting_offset && !ctx->chassis_info_area_parsed) { ctx->chassis_info_area_parsed++; rv = 1; goto out; } if (ctx->board_info_area_starting_offset && !ctx->board_info_area_parsed) { ctx->board_info_area_parsed++; rv = 1; goto out; } if (ctx->product_info_area_starting_offset && !ctx->product_info_area_parsed) { ctx->product_info_area_parsed++; rv = 1; goto out; } if (ctx->multirecord_area_starting_offset && !ctx->multirecord_area_parsed) { unsigned int multirecord_header_length; unsigned int record_length; unsigned int end_of_list; /* Special case, user is iterator-ing and wants to skip the first multirecord_area */ if (!ctx->multirecord_area_offset_in_bytes) ctx->multirecord_area_offset_in_bytes = ctx->multirecord_area_starting_offset * 8; if (_parse_multirecord_header (ctx, &multirecord_header_length, NULL, NULL, &end_of_list, &record_length, NULL) < 0) return (-1); if (end_of_list) { /* achu: end_of_list means this is the last record, possibly * with FRU data, and there are no more *after* this record. * So we should return 1. */ ctx->multirecord_area_parsed++; } ctx->multirecord_area_offset_in_bytes += multirecord_header_length; /* if record_length is 0, that's ok still */ ctx->multirecord_area_offset_in_bytes += record_length; rv = 1; goto out; } out: ctx->errnum = IPMI_FRU_PARSE_ERR_SUCCESS; return (rv); }
false
false
false
false
false
0
RemoveTranslation(unsigned long VTKEvent) { vtkSmartPointer< vtkEvent > e = vtkSmartPointer< vtkEvent >::New(); e->SetEventId(VTKEvent); return this->RemoveTranslation( e ); }
false
false
false
false
false
0
put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr) { const HashTable* table = classInfo()->propHashTable; // get the right hashtable const HashEntry* entry = Lookup::findEntry(table, propertyName); if (entry) { if (entry->attr & Function) // function: put as override property { JSObject::put(exec, propertyName, value, attr); return; } else if ((entry->attr & ReadOnly) == 0) // let lookupPut print the warning if not { putValueProperty(exec, entry->value, value, attr); return; } } lookupPut<DOMCSSRule, DOMObject>(exec, propertyName, value, attr, &DOMCSSRuleTable, this); }
false
false
false
false
false
0
range_binop (code, type, arg0, upper0_p, arg1, upper1_p) enum tree_code code; tree type; tree arg0, arg1; int upper0_p, upper1_p; { tree tem; int result; int sgn0, sgn1; /* If neither arg represents infinity, do the normal operation. Else, if not a comparison, return infinity. Else handle the special comparison rules. Note that most of the cases below won't occur, but are handled for consistency. */ if (arg0 != 0 && arg1 != 0) { tem = fold (build (code, type != 0 ? type : TREE_TYPE (arg0), arg0, convert (TREE_TYPE (arg0), arg1))); STRIP_NOPS (tem); return TREE_CODE (tem) == INTEGER_CST ? tem : 0; } if (TREE_CODE_CLASS (code) != '<') return 0; /* Set SGN[01] to -1 if ARG[01] is a lower bound, 1 for upper, and 0 for neither. In real maths, we cannot assume open ended ranges are the same. But, this is computer arithmetic, where numbers are finite. We can therefore make the transformation of any unbounded range with the value Z, Z being greater than any representable number. This permits us to treat unbounded ranges as equal. */ sgn0 = arg0 != 0 ? 0 : (upper0_p ? 1 : -1); sgn1 = arg1 != 0 ? 0 : (upper1_p ? 1 : -1); switch (code) { case EQ_EXPR: result = sgn0 == sgn1; break; case NE_EXPR: result = sgn0 != sgn1; break; case LT_EXPR: result = sgn0 < sgn1; break; case LE_EXPR: result = sgn0 <= sgn1; break; case GT_EXPR: result = sgn0 > sgn1; break; case GE_EXPR: result = sgn0 >= sgn1; break; default: abort (); } return convert (type, result ? integer_one_node : integer_zero_node); }
false
false
false
false
false
0
compare_int_fields(xmlNode * left, xmlNode * right, const char *field) { const char *elem_l = crm_element_value(left, field); const char *elem_r = crm_element_value(right, field); int int_elem_l = crm_int_helper(elem_l, NULL); int int_elem_r = crm_int_helper(elem_r, NULL); if (int_elem_l < int_elem_r) { return -1; } else if (int_elem_l > int_elem_r) { return 1; } return 0; }
false
false
false
false
false
0
acpi_ec_complete_query(struct acpi_ec *ec) { if (test_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); ec_dbg_evt("Command(%s) unblocked", acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); } }
false
false
false
false
false
0
analyze_gambas_component(const char *path) { ARCH *arch; ARCH_FIND find; bool ret = TRUE; if (_verbose) fprintf(stderr, "Loading gambas component: %s\n", path); arch = ARCH_open(path); if (ARCH_find(arch, ".info", 0, &find)) { warning(".info file not found in component archive."); goto __RETURN; } fwrite(&arch->addr[find.pos], 1, find.len, out_info); if (ARCH_find(arch, ".list", 0, &find)) { warning(".list file not found in component archive."); goto __RETURN; } fwrite(&arch->addr[find.pos], 1, find.len, out_list); ret = FALSE; __RETURN: ARCH_close(arch); return ret; }
false
false
false
false
false
0
findSubTag(const QDomElement &e, const QString &name, bool *found) { if(found) *found = false; for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { QDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == name) { if(found) *found = true; return i; } } QDomElement tmp; return tmp; }
false
false
false
false
false
0
mono_gc_bzero_aligned (void *dest, size_t size) { volatile char *d = (char*)dest; size_t tail_bytes, word_bytes; g_assert (unaligned_bytes (dest) == 0); /* copy all words with memmove */ word_bytes = (size_t)align_down (size); switch (word_bytes) { case sizeof (void*) * 1: BZERO_WORDS (d, 1); break; case sizeof (void*) * 2: BZERO_WORDS (d, 2); break; case sizeof (void*) * 3: BZERO_WORDS (d, 3); break; case sizeof (void*) * 4: BZERO_WORDS (d, 4); break; default: BZERO_WORDS (d, bytes_to_words (word_bytes)); } tail_bytes = unaligned_bytes (size); if (tail_bytes) { d += word_bytes; do { *d++ = 0; } while (--tail_bytes); } }
false
false
false
false
false
0
gda_statement_normalize (GdaStatement *stmt, GdaConnection *cnc, GError **error) { g_return_val_if_fail (GDA_IS_STATEMENT (stmt), FALSE); g_return_val_if_fail (stmt->priv, FALSE); g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE); return gda_sql_statement_normalize (stmt->priv->internal_struct, cnc, error); }
false
false
false
false
false
0
initialize_table_ni(int aesni, int pclmul) { if (!aesni) return; branch_table[INIT_128] = aes_ni_init; branch_table[INIT_256] = aes_ni_init; branch_table[ENCRYPT_BLOCK_128] = aes_ni_encrypt_block128; branch_table[DECRYPT_BLOCK_128] = aes_ni_decrypt_block128; branch_table[ENCRYPT_BLOCK_256] = aes_ni_encrypt_block256; branch_table[DECRYPT_BLOCK_256] = aes_ni_decrypt_block256; /* ECB */ branch_table[ENCRYPT_ECB_128] = aes_ni_encrypt_ecb128; branch_table[DECRYPT_ECB_128] = aes_ni_decrypt_ecb128; branch_table[ENCRYPT_ECB_256] = aes_ni_encrypt_ecb256; branch_table[DECRYPT_ECB_256] = aes_ni_decrypt_ecb256; /* CBC */ branch_table[ENCRYPT_CBC_128] = aes_ni_encrypt_cbc128; branch_table[DECRYPT_CBC_128] = aes_ni_decrypt_cbc128; branch_table[ENCRYPT_CBC_256] = aes_ni_encrypt_cbc256; branch_table[DECRYPT_CBC_256] = aes_ni_decrypt_cbc256; /* CTR */ branch_table[ENCRYPT_CTR_128] = aes_ni_encrypt_ctr128; branch_table[ENCRYPT_CTR_256] = aes_ni_encrypt_ctr256; /* XTS */ branch_table[ENCRYPT_XTS_128] = aes_ni_encrypt_xts128; branch_table[ENCRYPT_XTS_256] = aes_ni_encrypt_xts256; /* GCM */ branch_table[ENCRYPT_GCM_128] = aes_ni_gcm_encrypt128; branch_table[ENCRYPT_GCM_256] = aes_ni_gcm_encrypt256; }
false
false
false
false
false
0
jsparser_buffer_get(jsparser_ctx *js, int pos) { int absolute_pos; assert(pos < 0); absolute_pos = jsparser_buffer_absolute_pos(js, pos); if (absolute_pos < 0) { return '\0'; } return js->buffer[absolute_pos]; }
false
false
false
false
false
0
do_gain_analysis(lame_internal_flags * gfc, unsigned char* buffer, int minimum) { SessionConfig_t const *const cfg = &gfc->cfg; RpgStateVar_t const *const rsv = &gfc->sv_rpg; RpgResult_t *const rov = &gfc->ov_rpg; #ifdef DECODE_ON_THE_FLY if (cfg->decode_on_the_fly) { /* decode the frame */ sample_t pcm_buf[2][1152]; int mp3_in = minimum; int samples_out = -1; /* re-synthesis to pcm. Repeat until we get a samples_out=0 */ while (samples_out != 0) { samples_out = hip_decode1_unclipped(gfc->hip, buffer, mp3_in, pcm_buf[0], pcm_buf[1]); /* samples_out = 0: need more data to decode * samples_out = -1: error. Lets assume 0 pcm output * samples_out = number of samples output */ /* set the lenght of the mp3 input buffer to zero, so that in the * next iteration of the loop we will be querying mpglib about * buffered data */ mp3_in = 0; if (samples_out == -1) { /* error decoding. Not fatal, but might screw up * the ReplayGain tag. What should we do? Ignore for now */ samples_out = 0; } if (samples_out > 0) { /* process the PCM data */ /* this should not be possible, and indicates we have * overflown the pcm_buf buffer */ assert(samples_out <= 1152); if (cfg->findPeakSample) { int i; /* FIXME: is this correct? maybe Max(fabs(pcm),PeakSample) */ for (i = 0; i < samples_out; i++) { if (pcm_buf[0][i] > rov->PeakSample) rov->PeakSample = pcm_buf[0][i]; else if (-pcm_buf[0][i] > rov->PeakSample) rov->PeakSample = -pcm_buf[0][i]; } if (cfg->channels_out > 1) for (i = 0; i < samples_out; i++) { if (pcm_buf[1][i] > rov->PeakSample) rov->PeakSample = pcm_buf[1][i]; else if (-pcm_buf[1][i] > rov->PeakSample) rov->PeakSample = -pcm_buf[1][i]; } } if (cfg->findReplayGain) if (AnalyzeSamples (rsv->rgdata, pcm_buf[0], pcm_buf[1], samples_out, cfg->channels_out) == GAIN_ANALYSIS_ERROR) return -6; } /* if (samples_out>0) */ } /* while (samples_out!=0) */ } /* if (gfc->decode_on_the_fly) */ #endif return minimum; }
false
false
false
false
false
0
e_cal_backend_http_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror) { ECalBackendHttp *cbhttp; ECalBackendHttpPrivate *priv; ESource *source; ESourceRegistry *registry; ESourceWebdav *webdav_extension; const gchar *extension_name; const gchar *cache_dir; gboolean opened = TRUE; gchar *tmp; GError *local_error = NULL; cbhttp = E_CAL_BACKEND_HTTP (backend); priv = cbhttp->priv; /* already opened, thus can skip all this initialization */ if (priv->opened) return; source = e_backend_get_source (E_BACKEND (backend)); cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (backend)); registry = e_cal_backend_get_registry (E_CAL_BACKEND (backend)); extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND; webdav_extension = e_source_get_extension (source, extension_name); g_object_set (cbhttp->priv->soup_session, SOUP_SESSION_SSL_STRICT, TRUE, NULL); e_source_webdav_unset_temporary_ssl_trust (webdav_extension); if (priv->source_changed_id == 0) { priv->source_changed_id = g_signal_connect ( source, "changed", G_CALLBACK (source_changed_cb), cbhttp); } /* always read uri again */ tmp = priv->uri; priv->uri = NULL; g_free (tmp); if (priv->store == NULL) { /* remove the old cache while migrating to ECalBackendStore */ e_cal_backend_cache_remove (cache_dir, "cache.xml"); priv->store = e_cal_backend_store_new ( cache_dir, E_TIMEZONE_CACHE (backend)); e_cal_backend_store_load (priv->store); if (!priv->store) { g_propagate_error ( perror, EDC_ERROR_EX (OtherError, _("Could not create cache file"))); return; } } e_cal_backend_set_writable (E_CAL_BACKEND (backend), FALSE); if (e_backend_get_online (E_BACKEND (backend))) { const gchar *uri; uri = cal_backend_http_ensure_uri (cbhttp); opened = cal_backend_http_load ( cbhttp, cancellable, uri, &local_error); if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) { g_clear_error (&local_error); opened = e_source_registry_authenticate_sync ( registry, source, E_SOURCE_AUTHENTICATOR (backend), cancellable, &local_error); } if (local_error != NULL) g_propagate_error (perror, g_error_copy (local_error)); } if (opened) { if (!priv->reload_timeout_id) priv->reload_timeout_id = e_source_refresh_add_timeout (source, NULL, http_cal_reload_cb, backend, NULL); } }
false
false
false
false
false
0
tp_debug_divert_messages (const gchar *filename) { int fd; if (filename == NULL) return; if (filename[0] == '+') { /* open in append mode */ fd = g_open (filename + 1, O_WRONLY | O_CREAT | O_APPEND, 0644); } else { /* open in trunc mode */ fd = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); } if (fd == -1) { WARNING ("Can't open logfile '%s': %s", filename, g_strerror (errno)); return; } if (dup2 (fd, 1) == -1) /* STDOUT_FILENO is less universal */ { WARNING ("Error duplicating stdout file descriptor: %s", g_strerror (errno)); return; } if (dup2 (fd, 2) == -1) /* STDERR_FILENO is less universal */ { WARNING ("Error duplicating stderr file descriptor: %s", g_strerror (errno)); } /* avoid leaking the fd */ if (close (fd) != 0) { WARNING ("Error closing temporary logfile fd: %s", g_strerror (errno)); } }
false
false
false
false
false
0
isContentEqual(const pf_Frag & f2) const { if(getType() != f2.getType()) return false; // check we have PT to fidle with ... if(!m_pPieceTable || !f2.m_pPieceTable) return false; return _isContentEqual(f2); }
false
false
false
false
false
0
clearScreen(void) { if(getPage() == NULL) { return; } fp_Container * pCon = NULL; if(getColumn() && (getHeight() != 0)) { if(getPage() == NULL) { return; } fl_DocSectionLayout * pDSL = getPage()->getOwningSection(); if(pDSL == NULL) { return; } UT_sint32 iLeftMargin = pDSL->getLeftMargin(); UT_sint32 iRightMargin = pDSL->getRightMargin(); UT_sint32 iWidth = getPage()->getWidth(); iWidth = iWidth - iLeftMargin - iRightMargin; UT_sint32 xoff,yoff; pCon = static_cast<fp_Container *>(getNthCon(0)); if(pCon == NULL) return; getScreenOffsets(pCon,xoff,yoff); UT_sint32 srcX = getX(); UT_sint32 srcY = getY(); getFillType().Fill(getGraphics(),srcX,srcY,xoff-m_iLabelWidth,yoff,iWidth,getHeight()); } UT_sint32 i = 0; for(i=0; i< countCons(); i++) { pCon = static_cast<fp_Container *>(getNthCon(i)); pCon->clearScreen(); } }
false
false
false
false
false
0
jent_unbiased_bit(struct rand_data *entropy_collector) { do { __u64 a = jent_measure_jitter(entropy_collector); __u64 b = jent_measure_jitter(entropy_collector); if (a == b) continue; if (1 == a) return 1; else return 0; } while (1); }
false
false
false
false
false
0
cost_material(Path *path, Cost input_startup_cost, Cost input_total_cost, double tuples, int width) { Cost startup_cost = input_startup_cost; Cost run_cost = input_total_cost - input_startup_cost; double nbytes = relation_byte_size(tuples, width); long work_mem_bytes = work_mem * 1024L; /* * Whether spilling or not, charge 2x cpu_operator_cost per tuple to * reflect bookkeeping overhead. (This rate must be more than what * cost_rescan charges for materialize, ie, cpu_operator_cost per tuple; * if it is exactly the same then there will be a cost tie between * nestloop with A outer, materialized B inner and nestloop with B outer, * materialized A inner. The extra cost ensures we'll prefer * materializing the smaller rel.) Note that this is normally a good deal * less than cpu_tuple_cost; which is OK because a Material plan node * doesn't do qual-checking or projection, so it's got less overhead than * most plan nodes. */ run_cost += 2 * cpu_operator_cost * tuples; /* * If we will spill to disk, charge at the rate of seq_page_cost per page. * This cost is assumed to be evenly spread through the plan run phase, * which isn't exactly accurate but our cost model doesn't allow for * nonuniform costs within the run phase. */ if (nbytes > work_mem_bytes) { double npages = ceil(nbytes / BLCKSZ); run_cost += seq_page_cost * npages; } path->startup_cost = startup_cost; path->total_cost = startup_cost + run_cost; }
false
false
false
false
false
0
gzip_load_kernel(CHAR16 *kname, kdesc_t *kd) { EFI_STATUS status; INT32 ret; fops_fd_t fd; status = fops_open(kname, &fd); if (EFI_ERROR(status)) return ELILO_LOAD_ERROR; ret = gunzip_kernel(fd, kd); fops_close(fd); return ret; /* could be success, error, or abort */ }
false
false
false
false
false
0
H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) { hbool_t all_zero = TRUE; /* True if address was all zeroes */ unsigned u; /* Local index variable */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(addr_len); HDassert(pp && *pp); HDassert(addr_p); /* Reset value in destination */ *addr_p = 0; /* Decode bytes from address */ for(u = 0; u < addr_len; u++) { uint8_t c; /* Local decoded byte */ /* Get decoded byte (and advance pointer) */ c = *(*pp)++; /* Check for non-undefined address byte value */ if(c != 0xff) all_zero = FALSE; if(u < sizeof(*addr_p)) { haddr_t tmp = c; /* Local copy of address, for casting */ /* Shift decoded byte to correct position */ tmp <<= (u * 8); /*use tmp to get casting right */ /* Merge into already decoded bytes */ *addr_p |= tmp; } /* end if */ else if(!all_zero) HDassert(0 == **pp); /*overflow */ } /* end for */ /* If 'all_zero' is still TRUE, the address was entirely composed of '0xff' * bytes, which is the encoded form of 'HADDR_UNDEF', so set the destination * to that value */ if(all_zero) *addr_p = HADDR_UNDEF; FUNC_LEAVE_NOAPI_VOID }
false
false
false
false
false
0
NumberOfBitsNeeded(int PowerOfTwo) { int i; if (PowerOfTwo < 2) { fprintf(stderr, "Error: FFT called with size %d\n", PowerOfTwo); exit(1); } for (i = 0;; i++) if (PowerOfTwo & (1 << i)) return i; }
false
false
false
false
false
0
acpi_copy_property_array_u64(const union acpi_object *items, u64 *val, size_t nval) { int i; for (i = 0; i < nval; i++) { if (items[i].type != ACPI_TYPE_INTEGER) return -EPROTO; val[i] = items[i].integer.value; } return 0; }
false
false
false
false
false
0
solo_eeprom_write(struct solo_dev *solo_dev, int loc, __be16 data) { int write_cmd = loc | (EE_WRITE_CMD << ADDR_LEN); unsigned int retval; int i; solo_eeprom_cmd(solo_dev, write_cmd); for (i = 15; i >= 0; i--) { unsigned int dataval = ((__force unsigned)data >> i) & 1; solo_eeprom_reg_write(solo_dev, EE_ENB); solo_eeprom_reg_write(solo_dev, EE_ENB | (dataval << 1) | EE_SHIFT_CLK); } solo_eeprom_reg_write(solo_dev, EE_ENB); solo_eeprom_reg_write(solo_dev, ~EE_CS); solo_eeprom_reg_write(solo_dev, EE_ENB); for (i = retval = 0; i < 10000 && !retval; i++) retval = solo_eeprom_reg_read(solo_dev); solo_eeprom_reg_write(solo_dev, ~EE_CS); return !retval; }
false
false
false
false
false
0
get_count() const { if(!m_refListStore) return 0; guint iCount = m_refListStore->children().size(); //Take account of the extra blank for new entries: if(get_allow_user_actions()) //If it has the extra row. { --iCount; } return iCount; }
false
false
false
false
false
0
clone_available(void) { struct work *work_clone = NULL, *work, *tmp; bool cloned = false; mutex_lock(stgd_lock); if (!staged_rollable) goto out_unlock; HASH_ITER(hh, staged_work, work, tmp) { if (can_roll(work) && should_roll(work)) { roll_work(work); work_clone = make_clone(work); roll_work(work); cloned = true; break; } } out_unlock: mutex_unlock(stgd_lock); if (cloned) { applog(LOG_DEBUG, "Pushing cloned available work to stage thread"); stage_work(work_clone); } return cloned; }
true
true
false
false
false
1
_dxf_ExPathAppend( Program *p, char fname[], int instance, gfunc *fnode ) { uint32 fname_key; ModPath *path = &fnode->mod_path; /* Note, we store paths in reverse order in mod_path, */ /* so append is really a prepend. */ if ( path->num_comp >= ARRAY_LEN( path->modules ) ) { DXSetError(ERROR_NOT_IMPLEMENTED, "gfunc execution path too deep"); printf( "gfunc execution path too deep: %d", path->num_comp ); _dxf_ExDie("gfunc execution path too deep"); return; } fname_key = _dxf_ExGraphInsertAndLookupName( p, fname ); memmove( &path->modules[1], &path->modules[0], sizeof(path->modules[0]) * path->num_comp ); path->modules [ 0 ] = fname_key; path->instances[ 0 ] = instance; path->num_comp++; #ifdef TESTING _dxf_ExPathPrint( p, fnode, "_dxf_ExPathAppend" ); #endif }
false
false
false
false
false
0
KickMenu() // activate player kick menu { uMenu menu( "$player_police_kick_text" ); int size = se_PlayerNetIDs.Len(); eMenuItemKick** items = tNEW( eMenuItemKick* )[ size ]; int i; for ( i = size-1; i>=0; --i ) { ePlayerNetID* player = se_PlayerNetIDs[ i ]; if ( player->IsHuman() ) { items[i] = tNEW( eMenuItemKick )( &menu, player ); } else { items[i] = 0; } } menu.Enter(); for ( i = size - 1; i>=0; --i ) { if( items[i] ) delete items[i]; } delete[] items; }
false
false
false
false
false
0
dialog_refresh_type(gint type) { GSList *list; struct dialog_pak *dialog; for (list=sysenv.dialog_list ; list ; list=g_slist_next(list)) { dialog = list->data; if (dialog->type == type) if (dialog->refresh) dialog->refresh(dialog); } }
false
false
false
false
false
0
ewmh_get_client_list(void) { Window *list; struct client *c; int win_n = 0; SLIST_FOREACH(c, &W->h.client, next) ++win_n; list = xcalloc(win_n, sizeof(Window)); win_n = 0; SLIST_FOREACH(c, &W->h.client, next) list[win_n++] = c->win; XChangeProperty(W->dpy, W->root, W->net_atom[net_client_list], XA_WINDOW, 32, PropModeReplace, (unsigned char *)list, win_n); XFree(list); }
false
false
false
false
false
0
mysql_get_auth_secrets(secrets_list_t *sl, u08bits *realm) { int ret = -1; MYSQL * myc = get_mydb_connection(); if(myc) { char statement[TURN_LONG_STRING_SIZE]; snprintf(statement,sizeof(statement)-1,"select value from turn_secret where realm='%s'",realm); int res = mysql_query(myc, statement); if(res) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Error retrieving MySQL DB information: %s\n",mysql_error(myc)); } else { MYSQL_RES *mres = mysql_store_result(myc); if(!mres) { TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Error retrieving MySQL DB information: %s\n",mysql_error(myc)); } else if(mysql_field_count(myc)==1) { for(;;) { MYSQL_ROW row = mysql_fetch_row(mres); if(!row) { break; } else { if(row[0]) { unsigned long *lengths = mysql_fetch_lengths(mres); if(lengths) { size_t sz = lengths[0]; char auth_secret[TURN_LONG_STRING_SIZE]; ns_bcopy(row[0],auth_secret,sz); auth_secret[sz]=0; add_to_secrets_list(sl,auth_secret); } } } } ret = 0; } if(mres) mysql_free_result(mres); } } return ret; }
false
false
false
false
false
0
intel_init_audio(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; if (IS_G4X(dev)) { dev_priv->display.audio_codec_enable = g4x_audio_codec_enable; dev_priv->display.audio_codec_disable = g4x_audio_codec_disable; } else if (IS_VALLEYVIEW(dev)) { dev_priv->display.audio_codec_enable = ilk_audio_codec_enable; dev_priv->display.audio_codec_disable = ilk_audio_codec_disable; } else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) { dev_priv->display.audio_codec_enable = hsw_audio_codec_enable; dev_priv->display.audio_codec_disable = hsw_audio_codec_disable; } else if (HAS_PCH_SPLIT(dev)) { dev_priv->display.audio_codec_enable = ilk_audio_codec_enable; dev_priv->display.audio_codec_disable = ilk_audio_codec_disable; } }
false
false
false
false
false
0
load_environment(Style* s, int priority) { const char* xenv = getenv("XENVIRONMENT"); if (xenv != nil) { s->load_file(String(xenv), priority); } else { load_path(s, ".Xdefaults-", Host::name(), priority); } }
false
false
false
false
false
0
luaV_closure (int nelems) { if (nelems > 0) { struct Stack *S = &L->stack; Closure *c = luaF_newclosure(nelems); c->consts[0] = *(S->top-1); memcpy(&c->consts[1], S->top-(nelems+1), nelems*sizeof(TObject)); S->top -= nelems; ttype(S->top-1) = LUA_T_CLOSURE; (S->top-1)->value.cl = c; } }
false
true
false
false
false
1
ibv_dontfork_range(void *base, size_t size) { if (mm_root) return ibv_madvise_range(base, size, MADV_DONTFORK); else { too_late = 1; return 0; } }
false
false
false
false
false
0
conntrack2_mt_parse(struct xt_option_call *cb) { #define cinfo2_transform(r, l) \ memcpy((r), (l), offsetof(typeof(*(l)), sizeof(*info)); struct xt_conntrack_mtinfo2 *info = cb->data; struct xt_conntrack_mtinfo3 up; memset(&up, 0, sizeof(up)); memcpy(&up, info, sizeof(*info)); up.origsrc_port_high = up.origsrc_port; up.origdst_port_high = up.origdst_port; up.replsrc_port_high = up.replsrc_port; up.repldst_port_high = up.repldst_port; cb->data = &up; conntrack_mt_parse(cb, 3); if (up.origsrc_port != up.origsrc_port_high || up.origdst_port != up.origdst_port_high || up.replsrc_port != up.replsrc_port_high || up.repldst_port != up.repldst_port_high) xtables_error(PARAMETER_PROBLEM, "conntrack rev 2 does not support port ranges"); memcpy(info, &up, sizeof(*info)); cb->data = info; #undef cinfo2_transform }
false
false
false
false
false
0
spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const { if(spanCondition!=USET_SPAN_NOT_CONTAINED) { spanCondition=USET_SPAN_CONTAINED; // Pin to 0/1 values. } uint8_t b; do { b=s[--length]; if((int8_t)b>=0) { // ASCII sub-span if(spanCondition) { do { if(!asciiBytes[b]) { return length+1; } else if(length==0) { return 0; } b=s[--length]; } while((int8_t)b>=0); } else { do { if(asciiBytes[b]) { return length+1; } else if(length==0) { return 0; } b=s[--length]; } while((int8_t)b>=0); } } int32_t prev=length; UChar32 c; if(b<0xc0) { // trail byte: collect a multi-byte character c=utf8_prevCharSafeBody(s, 0, &length, b, -1); if(c<0) { c=0xfffd; } } else { // lead byte in last-trail position c=0xfffd; } // c is a valid code point, not ASCII, not a surrogate if(c<=0x7ff) { if((USetSpanCondition)((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0) != spanCondition) { return prev+1; } } else if(c<=0xffff) { int lead=c>>12; uint32_t twoBits=(bmpBlockBits[(c>>6)&0x3f]>>lead)&0x10001; if(twoBits<=1) { // All 64 code points with the same bits 15..6 // are either in the set or not. if(twoBits!=(uint32_t)spanCondition) { return prev+1; } } else { // Look up the code point in its 4k block of code points. if(containsSlow(c, list4kStarts[lead], list4kStarts[lead+1]) != spanCondition) { return prev+1; } } } else { if(containsSlow(c, list4kStarts[0x10], list4kStarts[0x11]) != spanCondition) { return prev+1; } } } while(length>0); return 0; }
false
false
false
false
false
0
setDefaultValues() { for (vector<CmdLineOption*>::size_type i = 0; i < m_Options.size(); i++) { CmdLineOption* opt = m_Options[i]; if (opt != NULL && !opt->hasOption()) { opt->setDefaultValues(); } } }
false
false
false
false
false
0
real_exponent (const REAL_VALUE_TYPE *r) { switch (r->cl) { case rvc_zero: return 0; case rvc_inf: case rvc_nan: return (unsigned int)-1 >> 1; case rvc_normal: return REAL_EXP (r); default: gcc_unreachable (); } }
false
false
false
false
false
0
PyvtkvmtkPolyDataBranchUtilities_ExtractGroup(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "ExtractGroup"); vtkPolyData *temp0 = NULL; char *temp1 = NULL; vtkIdType temp2; bool temp3 = false; vtkPolyData *temp4 = NULL; PyObject *result = NULL; if (ap.CheckArgCount(5) && ap.GetVTKObject(temp0, "vtkPolyData") && ap.GetValue(temp1) && ap.GetValue(temp2) && ap.GetValue(temp3) && ap.GetVTKObject(temp4, "vtkPolyData")) { vtkvmtkPolyDataBranchUtilities::ExtractGroup(temp0, temp1, temp2, temp3, temp4); if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; }
false
false
false
false
false
0
AddInstallNamePatchRule(std::ostream& os, Indent const& indent, const char* config, std::string const& toDestDirPath) { if(this->ImportLibrary || !(this->Target->GetType() == cmTarget::SHARED_LIBRARY || this->Target->GetType() == cmTarget::MODULE_LIBRARY || this->Target->GetType() == cmTarget::EXECUTABLE)) { return; } // Fix the install_name settings in installed binaries. std::string installNameTool = this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); if(!installNameTool.size()) { return; } // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map<cmStdString, cmStdString> install_name_remap; if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) { std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked(); for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin(); j != sharedLibs.end(); ++j) { cmTarget* tgt = *j; // The install_name of an imported target does not change. if(tgt->IsImported()) { continue; } // If the build tree and install tree use different path // components of the install_name field then we need to create a // mapping to be applied after installation. std::string for_build = tgt->GetInstallNameDirForBuildTree(config); std::string for_install = tgt->GetInstallNameDirForInstallTree(config); if(for_build != for_install) { // The directory portions differ. Append the filename to // create the mapping. std::string fname = this->GetInstallFilename(tgt, config, NameSO); // Map from the build-tree install_name. for_build += fname; // Map to the install-tree install_name. for_install += fname; // Store the mapping entry. install_name_remap[for_build] = for_install; } } } // Edit the install_name of the target itself if necessary. std::string new_id; if(this->Target->GetType() == cmTarget::SHARED_LIBRARY) { std::string for_build = this->Target->GetInstallNameDirForBuildTree(config); std::string for_install = this->Target->GetInstallNameDirForInstallTree(config); if(this->Target->IsFrameworkOnApple() && for_install.empty()) { // Frameworks seem to have an id corresponding to their own full // path. // ... // for_install = fullDestPath_without_DESTDIR_or_name; } // If the install name will change on installation set the new id // on the installed file. if(for_build != for_install) { // Prepare to refer to the install-tree install_name. new_id = for_install; new_id += this->GetInstallFilename(this->Target, config, NameSO); } } // Write a rule to run install_name_tool to set the install-tree // install_name value and references. if(!new_id.empty() || !install_name_remap.empty()) { os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool; os << "\""; if(!new_id.empty()) { os << "\n" << indent << " -id \"" << new_id << "\""; } for(std::map<cmStdString, cmStdString>::const_iterator i = install_name_remap.begin(); i != install_name_remap.end(); ++i) { os << "\n" << indent << " -change \"" << i->first << "\" \"" << i->second << "\""; } os << "\n" << indent << " \"" << toDestDirPath << "\")\n"; } }
false
false
false
false
false
0
sync_tip (GeditTab *tab, GeditTabLabel *tab_label) { gchar *str; str = _gedit_tab_get_tooltip (tab); g_return_if_fail (str != NULL); gtk_widget_set_tooltip_markup (tab_label->priv->ebox, str); g_free (str); }
false
false
false
false
false
0
set_gtk_image_from_gtk_image (GtkImage *image, GtkImage *source) { switch (gtk_image_get_storage_type (source)) { case GTK_IMAGE_EMPTY: gtk_image_clear (image); break; case GTK_IMAGE_PIXBUF: { GdkPixbuf *pb; pb = gtk_image_get_pixbuf (source); gtk_image_set_from_pixbuf (image, pb); } break; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; case GTK_IMAGE_STOCK: { gchar *s_id; GtkIconSize s; gtk_image_get_stock (source, &s_id, &s); gtk_image_set_from_stock (image, s_id, s); } break; case GTK_IMAGE_ICON_SET: { GtkIconSet *is; GtkIconSize s; gtk_image_get_icon_set (source, &is, &s); gtk_image_set_from_icon_set (image, is, s); } break; G_GNUC_END_IGNORE_DEPRECATIONS; case GTK_IMAGE_ANIMATION: { GdkPixbufAnimation *a; a = gtk_image_get_animation (source); gtk_image_set_from_animation (image, a); } break; case GTK_IMAGE_ICON_NAME: { const gchar *n; GtkIconSize s; gtk_image_get_icon_name (source, &n, &s); gtk_image_set_from_icon_name (image, n, s); } break; default: gtk_image_set_from_icon_name (image, "text-x-generic", GTK_ICON_SIZE_MENU); } }
false
false
false
false
false
0
midgard_object_purge_attachments(MidgardObject *self, gboolean delete_blob, guint n_params, const GParameter *parameters) { g_assert(self != NULL); if(!MGD_OBJECT_GUID (self)) { g_warning("Object is not fetched from database. Empty guid"); } gboolean rv = FALSE; if(delete_blob) { rv = midgard_core_object_parameters_purge_with_blob( MGD_OBJECT_CNC (self), "midgard_attachment", MGD_OBJECT_GUID (self), n_params, parameters); } else { rv = midgard_core_object_parameters_purge( MGD_OBJECT_CNC (self), "midgard_attachment", MGD_OBJECT_GUID (self), n_params, parameters); } return rv; }
false
false
false
false
false
0