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
Xnam(int modifier, char *label, char *mnemo, char *oper) { if (!oper) error("need an operand"); settitle(oper); return 0; }
false
false
false
false
false
0
ungrabKeyboard(){ if(xid){ FXTRACE((150,"%s::ungrabKeyboard %p\n",getClassName(),this)); getApp()->keyboardGrabWindow=NULL; #ifndef WIN32 XUngrabKeyboard(DISPLAY(getApp()),getApp()->event.time); #else #endif } }
false
false
false
false
false
0
make_void (NODE_T * p, MOID_T * q) { switch (ATTRIBUTE (p)) { case ASSIGNATION: case IDENTITY_RELATION: case GENERATOR: case CAST: case DENOTATION: { make_coercion (p, VOIDING, MODE (VOID)); return; } } /* MORFs are an involved case */ switch (ATTRIBUTE (p)) { case SELECTION: case SLICE: case ROUTINE_TEXT: case FORMULA: case CALL: case IDENTIFIER: { /* A nonproc moid value is eliminated directly */ if (is_nonproc (q)) { make_coercion (p, VOIDING, MODE (VOID)); return; } else { /* Descend the chain of e.g. REF PROC .. until a nonproc moid remains */ MOID_T *z = q; while (!is_nonproc (z)) { if (IS (z, REF_SYMBOL)) { make_coercion (p, DEREFERENCING, SUB (z)); } if (IS (z, PROC_SYMBOL) && NODE_PACK (p) == NO_PACK) { make_coercion (p, DEPROCEDURING, SUB (z)); } z = SUB (z); } if (z != MODE (VOID)) { make_coercion (p, VOIDING, MODE (VOID)); } return; } } } /* All other is voided straight away */ make_coercion (p, VOIDING, MODE (VOID)); }
false
false
false
false
false
0
gf117_grctx_generate_attrib(struct gf100_grctx *info) { struct gf100_gr *gr = info->gr; const struct gf100_grctx_func *grctx = gr->func->grctx; const u32 alpha = grctx->alpha_nr; const u32 beta = grctx->attrib_nr; const u32 size = 0x20 * (grctx->attrib_nr_max + grctx->alpha_nr_max); const u32 access = NV_MEM_ACCESS_RW; const int s = 12; const int b = mmio_vram(info, size * gr->tpc_total, (1 << s), access); const int timeslice_mode = 1; const int max_batches = 0xffff; u32 bo = 0; u32 ao = bo + grctx->attrib_nr_max * gr->tpc_total; int gpc, ppc; mmio_refn(info, 0x418810, 0x80000000, s, b); mmio_refn(info, 0x419848, 0x10000000, s, b); mmio_wr32(info, 0x405830, (beta << 16) | alpha); mmio_wr32(info, 0x4064c4, ((alpha / 4) << 16) | max_batches); for (gpc = 0; gpc < gr->gpc_nr; gpc++) { for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++) { const u32 a = alpha * gr->ppc_tpc_nr[gpc][ppc]; const u32 b = beta * gr->ppc_tpc_nr[gpc][ppc]; const u32 t = timeslice_mode; const u32 o = PPC_UNIT(gpc, ppc, 0); if (!(gr->ppc_mask[gpc] & (1 << ppc))) continue; mmio_skip(info, o + 0xc0, (t << 28) | (b << 16) | ++bo); mmio_wr32(info, o + 0xc0, (t << 28) | (b << 16) | --bo); bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc]; mmio_wr32(info, o + 0xe4, (a << 16) | ao); ao += grctx->alpha_nr_max * gr->ppc_tpc_nr[gpc][ppc]; } } }
false
false
false
false
false
0
process_transform2(unsigned char **cp, size_t *len) { char *msg; struct isakmp_transform2 *trans_hdr = (struct isakmp_transform2 *) *cp; unsigned trans_type; unsigned trans_id; char *trans_type_str; char *trans_id_str; size_t size; trans_type = trans_hdr->isat2_transtype; trans_id = ntohs(trans_hdr->isat2_transid); trans_type_str = make_message("%s", id_to_name(trans_type, trans_type_map)); switch (trans_type) { case 1: /* Encryption Algorithm */ trans_id_str = make_message("%s", id_to_name(trans_id, encr_map)); break; case 2: /* Pseudo-random Function */ trans_id_str = make_message("%s", id_to_name(trans_id, prf_map)); break; case 3: /* Integrity Algorithm */ trans_id_str = make_message("%s", id_to_name(trans_id, integ_map)); break; case 4: /* Diffie-Hellman Group */ trans_id_str = make_message("%s", id_to_name(trans_id, dh_map)); break; default: trans_id_str = make_message("%u", trans_id); break; } size=ntohs(trans_hdr->isat2_length); if (size > sizeof(struct isakmp_transform2)) { /* Attributes present */ unsigned char *attr_ptr = (*cp) + sizeof(struct isakmp_transform2); struct isakmp_attribute *attr_hdr = (struct isakmp_attribute *) attr_ptr; unsigned attr_class=0; unsigned attr_value=0; if (ntohs(attr_hdr->isaat_af_type) & 0x8000) { /* Basic attribute */ attr_class = ntohs (attr_hdr->isaat_af_type) & 0x7fff; attr_value = ntohs (attr_hdr->isaat_lv); } else { /* Variable attribute */ warn_msg("WARNING: Ignoring IKEv2 variable length transform attribute"); } msg = make_message("%s=%s,%s=%u", trans_type_str, trans_id_str, id_to_name(attr_class, attr_map), attr_value); } else { /* No attributes */ msg = make_message("%s=%s", trans_type_str, trans_id_str); } free(trans_type_str); free(trans_id_str); if (size >= *len) { *len=0; } else { *len -= size; (*cp) += size; } return msg; }
false
false
false
false
false
0
oceanic_veo250_device_open (dc_device_t **out, dc_context_t *context, const char *name) { if (out == NULL) return DC_STATUS_INVALIDARGS; // Allocate memory. oceanic_veo250_device_t *device = (oceanic_veo250_device_t *) malloc (sizeof (oceanic_veo250_device_t)); if (device == NULL) { ERROR (context, "Failed to allocate memory."); return DC_STATUS_NOMEMORY; } // Initialize the base class. oceanic_common_device_init (&device->base, context, &oceanic_veo250_device_vtable); // Override the base class values. device->base.layout = &oceanic_veo250_layout; device->base.multipage = MULTIPAGE; // Set the default values. device->port = NULL; device->last = 0; // Open the device. int rc = serial_open (&device->port, context, name); if (rc == -1) { ERROR (context, "Failed to open the serial port."); free (device); return DC_STATUS_IO; } // Set the serial communication protocol (9600 8N1). rc = serial_configure (device->port, 9600, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE); if (rc == -1) { ERROR (context, "Failed to set the terminal attributes."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Set the timeout for receiving data (3000 ms). if (serial_set_timeout (device->port, 3000) == -1) { ERROR (context, "Failed to set the timeout."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Set the DTR and RTS lines. if (serial_set_dtr (device->port, 1) == -1 || serial_set_rts (device->port, 1) == -1) { ERROR (context, "Failed to set the DTR/RTS line."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Give the interface 100 ms to settle and draw power up. serial_sleep (device->port, 100); // Make sure everything is in a sane state. serial_flush (device->port, SERIAL_QUEUE_BOTH); // Initialize the data cable (PPS mode). dc_status_t status = oceanic_veo250_init (device); if (status != DC_STATUS_SUCCESS) { serial_close (device->port); free (device); return status; } // Delay the sending of the version command. serial_sleep (device->port, 100); // Switch the device from surface mode into download mode. Before sending // this command, the device needs to be in PC mode (manually activated by // the user), or already in download mode. status = oceanic_veo250_device_version ((dc_device_t *) device, device->base.version, sizeof (device->base.version)); if (status != DC_STATUS_SUCCESS) { serial_close (device->port); free (device); return status; } *out = (dc_device_t*) device; return DC_STATUS_SUCCESS; }
false
false
false
false
false
0
patch_anim_datas(void) { static int datas_patched = 0; int i; if(datas_patched) return; for(i = 0; i <= GIOCATORE_DISPERAZIONE_OVEST; i++) Animation[i].FrameLen *= 2; for(i = 0; i <= ARBITRO_CARTELLINO; i++) ArbAnim[i].FrameLen *= 2; for(i = 0; i <= GL_FUORI_0; i++) GLAnim[i].FrameLen *= 2; for(i = 0; i <= PORTIERE_PRERIGORE; i++) PortAnim[i].FrameLen *= 2; datas_patched = 1; }
false
false
false
false
false
0
sosemanuk_extract(sosemanuk_state *state, uint8_t *stream) { uint32_t f[4]; uint32_t s[4]; int i; for(i = 0; i < 4; ++i) { f[i] = automaton_step(state); s[i] = lfsr_step(state); } uint32_t *stream32 = (uint32_t*)stream; sbox_apply(2, f, stream32); for(i = 0; i < 4; ++i) { register uint32_t tmp = stream32[i] ^ s[i]; unpack_littleendian(tmp, &stream[i*4]); } }
false
false
false
false
false
0
alignment_traceback(struct matrix *m, int istart, int jstart, const char *a, const char *b ) { struct alignment * aln = malloc(sizeof(*aln)); memset(aln,0,sizeof(*aln)); int max_traceback_length = m->width + m->height + 4; aln->traceback = malloc(max_traceback_length*sizeof(*aln->traceback)); int i = istart; int j = jstart; int dir = 0; int length = 0; while ( (i>0) && (j>0) ) { dir = matrix(m,i,j).traceback; aln->traceback[length++] = dir; if(dir==TRACEBACK_DIAG) { if(a[i-1]!=b[j-1]) { aln->mismatch_count++; } i--; j--; } else if(dir==TRACEBACK_LEFT) { i--; aln->gap_count++; } else if(dir==TRACEBACK_UP) { j--; aln->gap_count++; } else if(dir==TRACEBACK_END) { length--; break; } else { fprintf(stderr,"traceback corrupted at i=%d j=%d\n",i,j); exit(1); } } aln->traceback[length] = 0; // Reverse the traceback and resize the allocation as needed. char *n = malloc((length+1)*sizeof(char)); int k; for(k=0;k<length;k++) { n[k] = aln->traceback[length-k-1]; } n[length] = 0; free(aln->traceback); aln->traceback = n; // NOTE: These parameters are what are needed for OVL records. Other values are // calculated on runtime in the overlap output code aln->start1 = i; aln->start2 = j; aln->end1 = istart-1; aln->end2 = jstart-1; aln->length1 = m->width; aln->length2 = m->height; aln->score = matrix(m,istart,jstart).score; aln->quality = (double)(aln->gap_count + aln->mismatch_count) / MIN(aln->end1-aln->start1,aln->end2-aln->start2); return aln; }
false
false
false
false
false
0
decodeIORInterceptor(omniInterceptors::decodeIOR_T::info_T& iinfo) { const IIOP::ProfileBody& iiop = iinfo.iiop; omniIOR& ior = iinfo.ior; const IOP::MultipleComponentProfile& components = iiop.components; CORBA::ULong index; try { for (index=0; index < components.length(); ++index) { if (components[index].tag == omniConnectionData::TAG_RESTRICTED_CONNECTION) { omniORB::logs(25, "Found a restricted connection IOR component."); const IOP::TaggedComponent& c = components[index]; cdrEncapsulationStream stream(c.component_data.get_buffer(), c.component_data.length(), 1); RestrictedInfo* rinfo = new RestrictedInfo(); rinfo->data <<= stream; if (rinfo->data.version != 1 && omniORB::trace(5)) { omniORB::logger log; log << "Warning: received restricted connection IOR component " << "with unknown version " << (int)rinfo->data.version << ".\n"; } // Add the information to the omniIOR's extra info list. omniIOR::IORExtraInfoList& infolist = ior.getIORInfo()->extraInfo(); CORBA::ULong i = infolist.length(); infolist.length(i+1); infolist[i] = (omniIOR::IORExtraInfo*)rinfo; return 1; } } } catch (CORBA::SystemException&) { omniORB::logs(10, "Invalid restricted connection IOR component " "encountered."); } return 1; }
false
false
false
false
false
0
tulip_init_ring(struct net_device *dev) { struct tulip_private *tp = netdev_priv(dev); int i; tp->susp_rx = 0; tp->ttimer = 0; tp->nir = 0; for (i = 0; i < RX_RING_SIZE; i++) { tp->rx_ring[i].status = 0x00000000; tp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ); tp->rx_ring[i].buffer2 = cpu_to_le32(tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * (i + 1)); tp->rx_buffers[i].skb = NULL; tp->rx_buffers[i].mapping = 0; } /* Mark the last entry as wrapping the ring. */ tp->rx_ring[i-1].length = cpu_to_le32(PKT_BUF_SZ | DESC_RING_WRAP); tp->rx_ring[i-1].buffer2 = cpu_to_le32(tp->rx_ring_dma); for (i = 0; i < RX_RING_SIZE; i++) { dma_addr_t mapping; /* Note the receive buffer must be longword aligned. netdev_alloc_skb() provides 16 byte alignment. But do *not* use skb_reserve() to align the IP header! */ struct sk_buff *skb = netdev_alloc_skb(dev, PKT_BUF_SZ); tp->rx_buffers[i].skb = skb; if (skb == NULL) break; mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); tp->rx_buffers[i].mapping = mapping; tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); } tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); /* The Tx buffer descriptor is filled in as needed, but we do need to clear the ownership bit. */ for (i = 0; i < TX_RING_SIZE; i++) { tp->tx_buffers[i].skb = NULL; tp->tx_buffers[i].mapping = 0; tp->tx_ring[i].status = 0x00000000; tp->tx_ring[i].buffer2 = cpu_to_le32(tp->tx_ring_dma + sizeof(struct tulip_tx_desc) * (i + 1)); } tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma); }
false
false
false
false
false
0
RunDragonLore(ARegion *r, Unit *u) { int level = u->GetSkill(S_DRAGON_LORE); int num = u->items.GetNum(I_DRAGON); if (num >= level) { u->Error("Mage may not summon more dragons."); return 0; } int chance = level * level * 4; if (getrandom(100) < chance) { u->items.SetNum(I_DRAGON,num + 1); u->Event("Summons a dragon."); num = 1; } else { u->Event("Attempts to summon a dragon, but fails."); num = 0; } if (num == 0) return 0; return 1; }
false
false
false
false
false
0
TopLineOfMain() const { if (wMargin.GetID()) return 0; else return topLine; }
false
false
false
false
false
0
expandIEChain(LLVMContext& Context, Instruction *I, Instruction *J, unsigned o, Value *&LOp, unsigned numElemL, Type *ArgTypeL, Type *ArgTypeH, bool IBeforeJ, unsigned IdxOff) { bool ExpandedIEChain = false; if (InsertElementInst *LIE = dyn_cast<InsertElementInst>(LOp)) { // If we have a pure insertelement chain, then this can be rewritten // into a chain that directly builds the larger type. if (isPureIEChain(LIE)) { SmallVector<Value *, 8> VectElemts(numElemL, UndefValue::get(ArgTypeL->getScalarType())); InsertElementInst *LIENext = LIE; do { unsigned Idx = cast<ConstantInt>(LIENext->getOperand(2))->getSExtValue(); VectElemts[Idx] = LIENext->getOperand(1); } while ((LIENext = dyn_cast<InsertElementInst>(LIENext->getOperand(0)))); LIENext = nullptr; Value *LIEPrev = UndefValue::get(ArgTypeH); for (unsigned i = 0; i < numElemL; ++i) { if (isa<UndefValue>(VectElemts[i])) continue; LIENext = InsertElementInst::Create(LIEPrev, VectElemts[i], ConstantInt::get(Type::getInt32Ty(Context), i + IdxOff), getReplacementName(IBeforeJ ? I : J, true, o, i+1)); LIENext->insertBefore(IBeforeJ ? J : I); LIEPrev = LIENext; } LOp = LIENext ? (Value*) LIENext : UndefValue::get(ArgTypeH); ExpandedIEChain = true; } } return ExpandedIEChain; }
false
false
false
false
false
0
gst_udp_set_loop (int sockfd, guint16 ss_family, gboolean loop) { int ret = -1; int l = (loop == FALSE) ? 0 : 1; switch (ss_family) { case AF_INET: { ret = setsockopt (sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &l, sizeof (l)); if (ret < 0) return ret; break; } case AF_INET6: { ret = setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &l, sizeof (l)); if (ret < 0) return ret; break; } default: #ifdef G_OS_WIN32 WSASetLastError (WSAEAFNOSUPPORT); #else errno = EAFNOSUPPORT; #endif } return ret; }
false
false
false
false
false
0
list(int nlflag) { union node *n1, *n2, *n3; int tok; checkkwd = CHKNL | CHKKWD | CHKALIAS; if (nlflag == 2 && peektoken()) return NULL; n1 = NULL; for (;;) { n2 = andor(); tok = readtoken(); if (tok == TBACKGND) { if (n2->type == NPIPE) { n2->npipe.pipe_backgnd = 1; } else { if (n2->type != NREDIR) { n3 = stzalloc(sizeof(struct nredir)); n3->nredir.n = n2; /*n3->nredir.redirect = NULL; - stzalloc did it */ n2 = n3; } n2->type = NBACKGND; } } if (n1 == NULL) { n1 = n2; } else { n3 = stzalloc(sizeof(struct nbinary)); n3->type = NSEMI; n3->nbinary.ch1 = n1; n3->nbinary.ch2 = n2; n1 = n3; } switch (tok) { case TBACKGND: case TSEMI: tok = readtoken(); /* fall through */ case TNL: if (tok == TNL) { parseheredoc(); if (nlflag == 1) return n1; } else { tokpushback = 1; } checkkwd = CHKNL | CHKKWD | CHKALIAS; if (peektoken()) return n1; break; case TEOF: if (heredoclist) parseheredoc(); else pungetc(); /* push back EOF on input */ return n1; default: if (nlflag == 1) raise_error_unexpected_syntax(-1); tokpushback = 1; return n1; } } }
false
false
false
false
false
0
bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, wwn_t fabric_name) { struct bfad_s *bfad = (struct bfad_s *)fabric->fcs->bfad; char pwwn_ptr[BFA_STRING_32]; char fwwn_ptr[BFA_STRING_32]; bfa_trc(fabric->fcs, fabric_name); if (fabric->fabric_name == 0) { /* * With BRCD switches, we don't get Fabric Name in FLOGI. * Don't generate a fabric name change event in this case. */ fabric->fabric_name = fabric_name; } else { fabric->fabric_name = fabric_name; wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport)); wwn2str(fwwn_ptr, bfa_fcs_lport_get_fabric_name(&fabric->bport)); BFA_LOG(KERN_WARNING, bfad, bfa_log_level, "Base port WWN = %s Fabric WWN = %s\n", pwwn_ptr, fwwn_ptr); bfa_fcs_fabric_aen_post(&fabric->bport, BFA_PORT_AEN_FABRIC_NAME_CHANGE); } }
false
false
false
false
false
0
pm_settingsChanged() { QString prev = currentItem(); buildComboBox(); int x = d->cb_proxy->findData(prev); if(x == -1) { d->cb_proxy->setCurrentItem(0); } else { d->cb_proxy->setCurrentItem(x); } }
false
false
false
false
false
0
blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { struct scatterlist *sg = NULL; int nsegs = 0; if (rq->bio) nsegs = __blk_bios_map_sg(q, rq->bio, sglist, &sg); if (unlikely(rq->cmd_flags & REQ_COPY_USER) && (blk_rq_bytes(rq) & q->dma_pad_mask)) { unsigned int pad_len = (q->dma_pad_mask & ~blk_rq_bytes(rq)) + 1; sg->length += pad_len; rq->extra_len += pad_len; } if (q->dma_drain_size && q->dma_drain_needed(rq)) { if (rq->cmd_flags & REQ_WRITE) memset(q->dma_drain_buffer, 0, q->dma_drain_size); sg_unmark_end(sg); sg = sg_next(sg); sg_set_page(sg, virt_to_page(q->dma_drain_buffer), q->dma_drain_size, ((unsigned long)q->dma_drain_buffer) & (PAGE_SIZE - 1)); nsegs++; rq->extra_len += q->dma_drain_size; } if (sg) sg_mark_end(sg); /* * Something must have been wrong if the figured number of * segment is bigger than number of req's physical segments */ WARN_ON(nsegs > rq->nr_phys_segments); return nsegs; }
false
false
false
true
false
1
print_cat_sens(FILE * fp, const qpol_cat_t * cat_datum, const apol_policy_t * policydb, const int expand) { int retval = -1; const char *cat_name, *lvl_name; apol_level_query_t *query = NULL; apol_vector_t *v = NULL; const qpol_level_t *lvl_datum = NULL; qpol_policy_t *q = apol_policy_get_qpol(policydb); size_t i, n_sens = 0; if (!fp || !cat_datum || !policydb) goto cleanup; /* get category name for apol query */ if (qpol_cat_get_name(q, cat_datum, &cat_name)) goto cleanup; query = apol_level_query_create(); if (!query) { ERR(policydb, "%s", strerror(ENOMEM)); goto cleanup; } if (apol_level_query_set_cat(policydb, query, cat_name)) goto cleanup; if (apol_level_get_by_query(policydb, query, &v)) goto cleanup; fprintf(fp, " %s\n", cat_name); if (expand) { fprintf(fp, " Sensitivities:\n"); apol_vector_sort(v, &qpol_level_datum_compare, (void *)policydb); n_sens = apol_vector_get_size(v); for (i = 0; i < n_sens; i++) { lvl_datum = (qpol_level_t *) apol_vector_get_element(v, i); if (!lvl_datum) goto cleanup; if (qpol_level_get_name(q, lvl_datum, &lvl_name)) goto cleanup; fprintf(fp, " %s\n", lvl_name); } } retval = 0; cleanup: apol_level_query_destroy(&query); apol_vector_destroy(&v); return retval; }
false
false
false
false
false
0
addValueParamProps(const std::string &type, Property::TypeEnum valueType, int dim) { static const Property::PropSpec invariantProps[] = { { kOfxParamPropIsAnimating, Property::eInt, 1, false, "0" }, { kOfxParamPropIsAutoKeying,Property::eInt, 1, false, "0" }, { kOfxParamPropPersistant, Property::eInt, 1, false, "1" }, { kOfxParamPropEvaluateOnChange, Property::eInt, 1, false, "1" }, # ifdef kOfxParamPropPluginMayWrite { kOfxParamPropPluginMayWrite, Property::eInt, 1, false, "0" }, // removed in OFX 1.4 # endif { kOfxParamPropCanUndo, Property::eInt, 1, false, "1" }, { kOfxParamPropCacheInvalidation, Property::eString, 1, false, kOfxParamInvalidateValueChange }, Property::propSpecEnd }; /// http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#ParametersAnimation /// The following may animate, depending on the host. /// Properties exist on the host to check this. If the host does support animation on them, then they do _not_ animate by default. /// They are... /// - kOfxParamTypeCustom /// - kOfxParamTypeString /// - kOfxParamTypeBoolean /// - kOfxParamTypeChoice /// If host doesn't support animation on them, then setting kOfxParamPropIsAnimating to 0 or 1 doesn't matter /// so just set the kOfxParamPropIsAnimating property to 0 for all those "extra animating" params. bool animates = type != kOfxParamTypeCustom && type != kOfxParamTypeString && type != kOfxParamTypeBoolean && type != kOfxParamTypeChoice; Property::PropSpec variantProps[] = { { kOfxParamPropAnimates, Property::eInt, 1, false, animates ? "1" : "0" }, { kOfxParamPropDefault, valueType, dim, false, valueType == Property::eString ? "" : "0" }, Property::propSpecEnd }; _properties.addProperties(invariantProps); _properties.addProperties(variantProps); }
false
false
false
false
false
0
nodeIsBeforeNode(NodeImpl *n1, NodeImpl *n2) const { if (!n1 || !n2) return true; if (n1 == n2) return true; bool result = false; int n1Depth = 0; int n2Depth = 0; // First we find the depths of the two nodes in the tree (n1Depth, n2Depth) NodeImpl *n = n1; while (n->parentNode()) { n = n->parentNode(); n1Depth++; } n = n2; while (n->parentNode()) { n = n->parentNode(); n2Depth++; } // Climb up the tree with the deeper node, until both nodes have equal depth while (n2Depth > n1Depth) { n2 = n2->parentNode(); n2Depth--; } while (n1Depth > n2Depth) { n1 = n1->parentNode(); n1Depth--; } // Climb the tree with both n1 and n2 until they have the same parent while (n1->parentNode() != n2->parentNode()) { n1 = n1->parentNode(); n2 = n2->parentNode(); } // Iterate through the parent's children until n1 or n2 is found n = n1->parentNode() ? n1->parentNode()->firstChild() : n1->firstChild(); while (n) { if (n == n1) { result = true; break; } else if (n == n2) { result = false; break; } n = n->nextSibling(); } return result; }
false
false
false
false
false
0
TryFindModuleAndPackageDir( const vector<CommandLineFlagInfo> all_flags, string *module, string *package_dir) { module->clear(); package_dir->clear(); vector<string> suffixes; // TODO(daven): There's some inherant ambiguity here - multiple directories // could share the same trailing folder and file structure (and even worse, // same file names), causing us to be unsure as to which of the two is the // actual package for this binary. In this case, we'll arbitrarily choose. PushNameWithSuffix(&suffixes, "."); PushNameWithSuffix(&suffixes, "-main."); PushNameWithSuffix(&suffixes, "_main."); // These four are new but probably merited? PushNameWithSuffix(&suffixes, "-test."); PushNameWithSuffix(&suffixes, "_test."); PushNameWithSuffix(&suffixes, "-unittest."); PushNameWithSuffix(&suffixes, "_unittest."); for (vector<CommandLineFlagInfo>::const_iterator it = all_flags.begin(); it != all_flags.end(); ++it) { for (vector<string>::const_iterator suffix = suffixes.begin(); suffix != suffixes.end(); ++suffix) { // TODO(daven): Make sure the match is near the end of the string if (it->filename.find(*suffix) != string::npos) { *module = it->filename; string::size_type sep = it->filename.rfind(PATH_SEPARATOR); *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep); return; } } } }
false
false
false
false
false
0
rsvg_css_parse_angle (const char *str) { double degrees; char *end_ptr; degrees = g_ascii_strtod (str, &end_ptr); /* todo: error condition - figure out how to best represent it */ if ((degrees == -HUGE_VAL || degrees == HUGE_VAL) && (ERANGE == errno)) return 0.0; if (end_ptr) { if (!strcmp (end_ptr, "rad")) return degrees * 180. / G_PI; else if (!strcmp (end_ptr, "grad")) return degrees * 360. / 400.; } return degrees; }
false
false
false
false
false
0
EvaluatePDF(double x, const ParametersType & p) const { if ( p.GetSize() != 1 ) { itkGenericExceptionMacro( "Invalid number of parameters to describe distribution. Expected 1 parameter, but got " << p.size() << " parameters."); } return TDistribution::PDF( x, static_cast< SizeValueType >( p[0] ) ); }
false
false
false
false
false
0
init_constructions(game *g) { for (int i = 0; i < g->constructions.size(); i++) { for (int j = 0; j < g->constructions[i]->stages.size(); j++) { g->constructions[i]->stages[j].time = 1; // Everything takes 1 minute } } }
false
false
false
false
false
0
operator()() { size_t scoresNum; { #ifdef WITH_THREADS boost::mutex::scoped_lock lock(m_mutex); #endif scoresNum = m_scoresNum; m_scoresNum++; } while(scoresNum < m_encodedScores.size()) { std::string scores = m_encodedScores[scoresNum]; std::string compressedScores = m_creator.CompressEncodedScores(scores); std::string dummy; PackedItem packedItem(scoresNum, dummy, compressedScores, 0); #ifdef WITH_THREADS boost::mutex::scoped_lock lock(m_mutex); #endif m_creator.AddCompressedScores(packedItem); m_creator.FlushCompressedQueue(); scoresNum = m_scoresNum; m_scoresNum++; } }
false
false
false
false
false
0
gnutls_session_ticket_key_generate (gnutls_datum_t * key) { int ret; key->size = sizeof (struct gnutls_session_ticket_key_st); key->data = gnutls_malloc (key->size); if (!key->data) { gnutls_assert (); return GNUTLS_E_MEMORY_ERROR; } ret = _gnutls_rnd (GNUTLS_RND_RANDOM, key->data, key->size); if (ret < 0) { gnutls_assert (); _gnutls_free_datum (key); return ret; } return 0; }
false
false
false
false
false
0
xps_read_zip_entry(xps_document *doc, xps_entry *ent, unsigned char *outbuf) { z_stream stream; unsigned char *inbuf; int sig; int version, general, method; int namelength, extralength; int code; fz_context *ctx = doc->ctx; fz_seek(doc->file, ent->offset, 0); sig = getlong(doc->file); if (sig != ZIP_LOCAL_FILE_SIG) { fz_throw(doc->ctx, "wrong zip local file signature (0x%x)", sig); } version = getshort(doc->file); general = getshort(doc->file); method = getshort(doc->file); (void) getshort(doc->file); /* file time */ (void) getshort(doc->file); /* file date */ (void) getlong(doc->file); /* crc-32 */ (void) getlong(doc->file); /* csize */ (void) getlong(doc->file); /* usize */ namelength = getshort(doc->file); extralength = getshort(doc->file); fz_seek(doc->file, namelength + extralength, 1); if (method == 0) { fz_read(doc->file, outbuf, ent->usize); } else if (method == 8) { inbuf = fz_malloc(ctx, ent->csize); fz_read(doc->file, inbuf, ent->csize); memset(&stream, 0, sizeof(z_stream)); stream.zalloc = (alloc_func) xps_zip_alloc_items; stream.zfree = (free_func) xps_zip_free; stream.opaque = doc; stream.next_in = inbuf; stream.avail_in = ent->csize; stream.next_out = outbuf; stream.avail_out = ent->usize; code = inflateInit2(&stream, -15); if (code != Z_OK) { fz_free(ctx, inbuf); fz_throw(ctx, "zlib inflateInit2 error: %s", stream.msg); } code = inflate(&stream, Z_FINISH); if (code != Z_STREAM_END) { inflateEnd(&stream); fz_free(ctx, inbuf); fz_throw(ctx, "zlib inflate error: %s", stream.msg); } code = inflateEnd(&stream); if (code != Z_OK) { fz_free(ctx, inbuf); fz_throw(ctx, "zlib inflateEnd error: %s", stream.msg); } fz_free(ctx, inbuf); } else { fz_throw(ctx, "unknown compression method (%d)", method); } }
false
false
false
false
false
0
read_density() { gchar buffer[BSIZE]; FILE* file = FOpen(adfFileName, "rb"); if(!file) { sprintf(buffer,_("Sorry, i can not open \"%s\" file"),adfFileName); grid = free_grid(grid); Message(buffer,_("Error"),TRUE); return; } sprintf(buffer,"Density"); /* printf("str = %s\n",buffer);*/ get_grid_from_adf_file(file,buffer); if(grid) { limits = grid->limits; create_iso_orbitals(); set_status_label_info(_("Grid"),_("Ok")); } else { set_status_label_info(_("Grid"),_("Nothing")); CancelCalcul = FALSE; } fclose(file); }
false
false
false
false
false
0
forgetFrame(XAP_Frame * pFrame) { UT_return_val_if_fail(pFrame,false); // If this frame is the currently focussed frame write in NULL // until another frame appears if(pFrame == m_lastFocussedFrame ) { m_lastFocussedFrame = static_cast<XAP_Frame *>(NULL); } if (pFrame->getViewNumber() > 0) { // locate vector of this frame's clones CloneMap::const_iterator iter = m_hashClones.find(pFrame->getViewKey()); UT_ASSERT(iter != m_hashClones.end()); if (iter != m_hashClones.end()) { UT_GenericVector<XAP_Frame*> * pvClones = iter->second; UT_return_val_if_fail(pvClones,false); // remove this frame from the vector UT_sint32 i = pvClones->findItem(pFrame); UT_ASSERT(i >= 0); if (i >= 0) { pvClones->deleteNthItem(i); } // see how many clones are left UT_uint32 count = pvClones->getItemCount(); UT_ASSERT(count > 0); XAP_Frame * f = NULL; if (count == 1) { // remaining clone is now a singleton f = pvClones->getNthItem(count-1); UT_return_val_if_fail(f,false); f->setViewNumber(0); f->updateTitle(); // remove this entry from hashtable m_hashClones.erase(f->getViewKey()); delete pvClones; } else { // notify remaining clones of their new view numbers for (UT_uint32 j=0; j<count; j++) { f = static_cast<XAP_Frame *>(pvClones->getNthItem(j)); UT_continue_if_fail(f); f->setViewNumber(j+1); f->updateTitle(); } } } } // remove this frame from our window list UT_sint32 ndx = m_vecFrames.findItem(pFrame); UT_ASSERT_HARMLESS(ndx >= 0); if (ndx >= 0) { m_vecFrames.deleteNthItem(ndx); notifyFrameCountChange(); } notifyModelessDlgsCloseFrame(pFrame); // TODO do something here... return true; }
false
false
false
false
false
0
gst_base_transform_set_qos_enabled (GstBaseTransform * trans, gboolean enabled) { g_return_if_fail (GST_IS_BASE_TRANSFORM (trans)); GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, trans, "enabled: %d", enabled); GST_OBJECT_LOCK (trans); trans->priv->qos_enabled = enabled; GST_OBJECT_UNLOCK (trans); }
false
false
false
false
false
0
aarch64_final_eh_return_addr (void) { HOST_WIDE_INT original_frame_size, frame_size, offset, fp_offset; aarch64_layout_frame (); original_frame_size = get_frame_size () + cfun->machine->saved_varargs_size; frame_size = (original_frame_size + cfun->machine->frame.saved_regs_size + crtl->outgoing_args_size); offset = frame_size = AARCH64_ROUND_UP (frame_size, STACK_BOUNDARY / BITS_PER_UNIT); fp_offset = offset - original_frame_size - cfun->machine->frame.saved_regs_size; if (cfun->machine->frame.reg_offset[LR_REGNUM] < 0) return gen_rtx_REG (DImode, LR_REGNUM); /* DSE and CSELIB do not detect an alias between sp+k1 and fp+k2. This can result in a store to save LR introduced by builtin_eh_return () being incorrectly deleted because the alias is not detected. So in the calculation of the address to copy the exception unwinding return address to, we note 2 cases. If FP is needed and the fp_offset is 0, it means that SP = FP and hence we return a SP-relative location since all the addresses are SP-relative in this case. This prevents the store from being optimized away. If the fp_offset is not 0, then the addresses will be FP-relative and therefore we return a FP-relative location. */ if (frame_pointer_needed) { if (fp_offset) return gen_frame_mem (DImode, plus_constant (Pmode, hard_frame_pointer_rtx, UNITS_PER_WORD)); else return gen_frame_mem (DImode, plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD)); } /* If FP is not needed, we calculate the location of LR, which would be at the top of the saved registers block. */ return gen_frame_mem (DImode, plus_constant (Pmode, stack_pointer_rtx, fp_offset + cfun->machine->frame.saved_regs_size - 2 * UNITS_PER_WORD)); }
false
false
false
false
false
0
compute_tzname_max (size_t chars) { const char *p; p = zone_names; do { const char *start = p; while (*p != '\0') ++p; if ((size_t) (p - start) > __tzname_cur_max) __tzname_cur_max = p - start; } while (++p < &zone_names[chars]); }
false
false
false
false
false
0
combineChannels(fipImage& red, fipImage& green, fipImage& blue) { if(!_dib) { int width = red.getWidth(); int height = red.getHeight(); _dib = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); } if(_dib) { BOOL bResult = TRUE; bResult &= FreeImage_SetChannel(_dib, red._dib, FICC_RED); bResult &= FreeImage_SetChannel(_dib, green._dib, FICC_GREEN); bResult &= FreeImage_SetChannel(_dib, blue._dib, FICC_BLUE); _bHasChanged = TRUE; return bResult; } return FALSE; }
false
false
false
false
false
0
gen_bypass (rtx def) { decl_t decl; char **out_patterns; int out_length; char **in_patterns; int in_length; int i, j; out_patterns = get_str_vect (XSTR (def, 1), &out_length, ',', FALSE); if (out_patterns == NULL) fatal ("invalid string `%s' in define_bypass", XSTR (def, 1)); in_patterns = get_str_vect (XSTR (def, 2), &in_length, ',', FALSE); if (in_patterns == NULL) fatal ("invalid string `%s' in define_bypass", XSTR (def, 2)); for (i = 0; i < out_length; i++) for (j = 0; j < in_length; j++) { decl = XCREATENODE (struct decl); decl->mode = dm_bypass; decl->pos = 0; DECL_BYPASS (decl)->latency = XINT (def, 0); DECL_BYPASS (decl)->out_pattern = out_patterns[i]; DECL_BYPASS (decl)->in_pattern = in_patterns[j]; DECL_BYPASS (decl)->bypass_guard_name = XSTR (def, 3); decls.safe_push (decl); } }
false
false
false
false
false
0
binder_buffer_lookup(struct binder_proc *proc, uintptr_t user_ptr) { struct rb_node *n = proc->allocated_buffers.rb_node; struct binder_buffer *buffer; struct binder_buffer *kern_ptr; kern_ptr = (struct binder_buffer *)(user_ptr - proc->user_buffer_offset - offsetof(struct binder_buffer, data)); while (n) { buffer = rb_entry(n, struct binder_buffer, rb_node); BUG_ON(buffer->free); if (kern_ptr < buffer) n = n->rb_left; else if (kern_ptr > buffer) n = n->rb_right; else return buffer; } return NULL; }
false
false
false
false
false
0
readLimited() { if (!m_iBytesLeft) return 0; m_receiveBuf.resize(4096); int bytesToReceive; if (m_iBytesLeft > KIO::filesize_t(m_receiveBuf.size())) bytesToReceive = m_receiveBuf.size(); else bytesToReceive = m_iBytesLeft; const int bytesReceived = readBuffered(m_receiveBuf.data(), bytesToReceive, false); if (bytesReceived <= 0) return -1; // Error: connection lost m_iBytesLeft -= bytesReceived; return bytesReceived; }
false
false
false
false
false
0
InsertChild(Iterator loc, MetaData::Pointer entry) { if (!entry) { btkErrorMacro("Impossible to insert an empty entry"); return false; } if (this->FindChild(entry->GetLabel()) != this->End()) { btkErrorMacro("Label '" + entry->GetLabel() + "' already exists in the entries' list"); return false; } entry->SetParent(this); this->m_Tree.insert(loc, entry); this->Modified(); return true; }
false
false
false
false
false
0
add_anchor_to_module (GcrCertificate *certificate, const gchar *purpose) { GckBuilder builder = GCK_BUILDER_INIT; gconstpointer data; gsize n_data; data = gcr_certificate_get_der_data (certificate, &n_data); g_assert (data); /* And add a pinned certificate for the signed certificate */ gck_builder_add_data (&builder, CKA_X_CERTIFICATE_VALUE, data, n_data); gck_builder_add_ulong (&builder, CKA_CLASS, CKO_X_TRUST_ASSERTION); gck_builder_add_ulong (&builder, CKA_X_ASSERTION_TYPE, CKT_X_ANCHORED_CERTIFICATE); gck_builder_add_string (&builder, CKA_X_PURPOSE, purpose); gck_mock_module_add_object (gck_builder_end (&builder)); }
false
false
false
false
false
0
rewriteDependentName() { std::string NewStr = ""; if (NeedTypenameKeyword) NewStr += "typename "; NewStr += TheTyName; TheRewriter.ReplaceText(SourceRange(TheLocBegin, TheNameLocEnd), NewStr); }
false
false
false
false
false
0
snd_ctl_sync_vmaster(struct snd_kcontrol *kcontrol, bool hook_only) { struct link_master *master; bool first_init = false; if (!kcontrol) return; master = snd_kcontrol_chip(kcontrol); if (!hook_only) { int err = master_init(master); if (err < 0) return; first_init = err; err = sync_slaves(master, master->val, master->val); if (err < 0) return; } if (master->hook && !first_init) master->hook(master->hook_private_data, master->val); }
false
false
false
false
false
0
niyanpai_scrollx_w(int vram, int offset, int data) { niyanpai_scrollx_tmp[vram][offset] = data; if (offset) { niyanpai_scrollx[vram] = -((((niyanpai_scrollx_tmp[vram][0] + (niyanpai_scrollx_tmp[vram][1] << 8)) & 0x1ff) + 0x4e) << 1); } }
false
false
false
false
false
0
analysis_tool_descriptive_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_output_t *dao, gpointer specs, analysis_tool_engine_t selector, gpointer result) { analysis_tools_data_descriptive_t *info = specs; switch (selector) { case TOOL_ENGINE_UPDATE_DESCRIPTOR: return (dao_command_descriptor (dao, _("Descriptive Statistics (%s)"), result) == NULL); case TOOL_ENGINE_UPDATE_DAO: prepare_input_range (&info->base.input, info->base.group_by); dao_adjust (dao, 1 + g_slist_length (info->base.input), (info->summary_statistics ? 16 : 0) + (info->confidence_level ? 4 : 0) + (info->kth_largest ? 4 : 0) + (info->kth_smallest ? 4 : 0 ) - 1); return FALSE; case TOOL_ENGINE_CLEAN_UP: return analysis_tool_generic_clean (specs); case TOOL_ENGINE_LAST_VALIDITY_CHECK: return FALSE; case TOOL_ENGINE_PREPARE_OUTPUT_RANGE: dao_prepare_output (NULL, dao, _("Descriptive Statistics")); return FALSE; case TOOL_ENGINE_FORMAT_OUTPUT_RANGE: return dao_format_output (dao, _("Descriptive Statistics")); case TOOL_ENGINE_PERFORM_CALC: default: return analysis_tool_descriptive_engine_run (dao, specs); } return TRUE; /* We shouldn't get here */ }
false
false
false
false
false
0
sq_free(ESL_SQ *sq) { int x; /* index for optional extra residue markups */ if (sq->name != NULL) free(sq->name); if (sq->acc != NULL) free(sq->acc); if (sq->desc != NULL) free(sq->desc); if (sq->source != NULL) free(sq->source); if (sq->seq != NULL) free(sq->seq); if (sq->dsq != NULL) free(sq->dsq); if (sq->ss != NULL) free(sq->ss); if (sq->nxr > 0) { for (x = 0; x < sq->nxr; x++) { if (sq->xr[x] != NULL) free(sq->xr[x]); if (sq->xr_tag[x] != NULL) free(sq->xr_tag[x]); } if (sq->xr != NULL) free(sq->xr); if (sq->xr_tag != NULL) free(sq->xr_tag); } }
false
false
false
false
false
0
mlx5_init_mr_table(struct mlx5_core_dev *dev) { struct mlx5_mr_table *table = &dev->priv.mr_table; memset(table, 0, sizeof(*table)); rwlock_init(&table->lock); INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); }
false
false
false
false
false
0
logger_destroy(struct logger *log) { if (!log) return 0; if (log->log_file) { free(log->log_file); log->log_file = NULL; } if (log->fd) { fclose(log->fd); log->fd = NULL; } free(log); log = NULL; return 0; }
false
false
false
false
false
0
gnc_commodity_set_quote_tz(gnc_commodity *cm, const char *tz) { CommodityPrivate* priv; if (!cm) return; ENTER ("(cm=%p, tz=%s)", cm, tz ? tz : "(null)"); priv = GET_PRIVATE(cm); if (tz == priv->quote_tz) { LEAVE("Already correct TZ"); return; } gnc_commodity_begin_edit(cm); CACHE_REMOVE (priv->quote_tz); priv->quote_tz = CACHE_INSERT (tz); mark_commodity_dirty(cm); gnc_commodity_commit_edit(cm); LEAVE(" "); }
false
false
false
false
false
0
show_name_attributes (name, nodefs) char *name; int nodefs; { SHELL_VAR *var; var = find_variable_internal (name, 1); if (var && invisible_p (var) == 0) { show_var_attributes (var, READONLY_OR_EXPORT, nodefs); return (0); } else return (1); }
false
false
false
false
false
0
memAllocBuf(size_t net_size, size_t * gross_size) { mem_type type = memFindBufSizeType(net_size, gross_size); if (type != MEM_NONE) return memAllocate(type); else { memMeterInc(HugeBufCountMeter); memMeterAdd(HugeBufVolumeMeter, *gross_size); return xcalloc(1, net_size); } }
false
false
false
false
false
0
blendNoise1d( double x, unsigned int y, unsigned int z, unsigned int t ) { double floorX = floor( x ); unsigned int floorIntX = (unsigned int)floorX; if( floorX == x ) { unsigned int precomputedMix = mixFour( floorIntX, y, z, t ); return noise1dInt32( precomputedMix ); } else { unsigned int ceilIntX = floorIntX + 1; // cosine interpolation // from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm double ft = ( x - floorX ) * M_PI; double f = ( 1 - cos( ft ) ) * .5; // need to pre-store intermediate values because noise4dInt32 is a // macro // thus, we end up calling the noise1dInt32 function instead unsigned int precomputedMix = mixFour( floorIntX, y, z, t ); double valueAtFloor = noise1dInt32( precomputedMix ); precomputedMix = mixFour( ceilIntX, y, z, t ); double valueAtCeiling = noise1dInt32( precomputedMix ); return linearInterpolation( f, valueAtFloor, valueAtCeiling ); } }
false
false
false
false
false
0
read_mac_pt(int fd, struct slice all, struct slice *sp, int ns) { struct mac_driver_desc *md; struct mac_partition *part; unsigned secsize; char *data; int blk, blocks_in_map; int n = 0; md = (struct mac_driver_desc *) getblock(fd, 0); if (md == NULL) return -1; if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC) return -1; secsize = be16_to_cpu(md->block_size); data = getblock(fd, secsize/512); if (!data) return -1; part = (struct mac_partition *) (data + secsize%512); if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) return -1; blocks_in_map = be32_to_cpu(part->map_count); for (blk = 1; blk <= blocks_in_map && blk <= ns; ++blk, ++n) { int pos = blk * secsize; data = getblock(fd, pos/512); if (!data) return -1; part = (struct mac_partition *) (data + pos%512); if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) break; sp[n].start = be32_to_cpu(part->start_block) * (secsize/512); sp[n].size = be32_to_cpu(part->block_count) * (secsize/512); } return n; }
false
false
false
false
false
0
firstButtonText() const { QString text; // The first URL navigator button should get the name of the // place instead of the directory name if ((m_placesSelector != 0) && !m_showFullPath) { const KUrl placeUrl = m_placesSelector->selectedPlaceUrl(); text = m_placesSelector->selectedPlaceText(); } if (text.isEmpty()) { const KUrl currentUrl = q->locationUrl(); if (currentUrl.isLocalFile()) { #ifdef Q_OS_WIN text = currentUrl.path().length() > 1 ? currentUrl.path().left(2) : QDir::rootPath(); #else text = m_showFullPath ? QLatin1String("/") : i18n("Custom Path"); #endif } else { text = currentUrl.protocol() + QLatin1Char(':'); if (!currentUrl.host().isEmpty()) { text += QLatin1Char(' ') + currentUrl.host(); } } } return text; }
false
false
false
false
false
0
AcpiDbDisplayArguments ( void) { ACPI_WALK_STATE *WalkState; WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); if (!WalkState) { AcpiOsPrintf ("There is no method currently executing\n"); return; } AcpiDmDisplayArguments (WalkState); }
false
false
false
false
false
0
parseTemplateArgument() { //printf("parseTemplateArgument()\n"); Objects *tiargs = new Objects(); Type *ta; switch (token.value) { case TOKidentifier: ta = new TypeIdentifier(token.loc, token.ident); goto LabelX; case TOKvector: ta = parseVector(); goto LabelX; case BASIC_TYPES_X(ta): tiargs->push(ta); nextToken(); break; case TOKint32v: case TOKuns32v: case TOKint64v: case TOKuns64v: case TOKfloat32v: case TOKfloat64v: case TOKfloat80v: case TOKimaginary32v: case TOKimaginary64v: case TOKimaginary80v: case TOKnull: case TOKtrue: case TOKfalse: case TOKcharv: case TOKwcharv: case TOKdcharv: case TOKstring: case TOKfile: case TOKline: case TOKmodulestring: case TOKfuncstring: case TOKprettyfunc: case TOKthis: { // Template argument is an expression Expression *ea = parsePrimaryExp(); tiargs->push(ea); break; } default: error("template argument expected following !"); break; } if (token.value == TOKnot) { TOK tok = peekNext(); if (tok != TOKis && tok != TOKin) error("multiple ! arguments are not allowed"); } return tiargs; }
false
false
false
false
false
0
qos_event_setenvstatus_cmd(cmd_parms *cmd, void *dcfg, const char *rc, const char *var) { apr_table_t *setenvstatus_t; if(cmd->path) { qos_dir_config *dconf = (qos_dir_config*)dcfg; setenvstatus_t = dconf->setenvstatus_t; } else { qos_srv_config *sconf = (qos_srv_config*)ap_get_module_config(cmd->server->module_config, &qos_module); setenvstatus_t = sconf->setenvstatus_t; } if(strcasecmp(rc, QS_CLOSE) == 0) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if(err != NULL) { return apr_psprintf(cmd->pool, "%s: "QS_CLOSE" may only be defined globally", cmd->directive->directive); } if(strcasecmp(var, QS_BLOCK) != 0) { return apr_psprintf(cmd->pool, "%s: "QS_CLOSE" may only be defined for the event "QS_BLOCK, cmd->directive->directive); } } else if(strcasecmp(rc, QS_EMPTY_CON) == 0) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if(err != NULL) { return apr_psprintf(cmd->pool, "%s: "QS_EMPTY_CON" may only be defined globally", cmd->directive->directive); } if(strcasecmp(var, QS_BLOCK) != 0) { return apr_psprintf(cmd->pool, "%s: "QS_EMPTY_CON" may only be defined for the event "QS_BLOCK, cmd->directive->directive); } } else { int code = atoi(rc); if(code <= 0) { return apr_psprintf(cmd->pool, "%s: invalid HTTP status code", cmd->directive->directive); } } apr_table_set(setenvstatus_t, rc, var); return NULL; }
false
false
false
false
false
0
test_checkout_conflict__path_filters(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; char *paths[] = { "conflicting-1.txt", "conflicting-3.txt" }; git_strarray patharray = {0}; struct checkout_index_entry checkout_index_entries[] = { { 0100644, CONFLICTING_ANCESTOR_OID, 1, "conflicting-1.txt" }, { 0100644, CONFLICTING_OURS_OID, 2, "conflicting-1.txt" }, { 0100644, CONFLICTING_THEIRS_OID, 3, "conflicting-1.txt" }, { 0100644, CONFLICTING_ANCESTOR_OID, 1, "conflicting-2.txt" }, { 0100644, CONFLICTING_OURS_OID, 2, "conflicting-2.txt" }, { 0100644, CONFLICTING_THEIRS_OID, 3, "conflicting-2.txt" }, { 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "conflicting-3.txt" }, { 0100644, AUTOMERGEABLE_OURS_OID, 2, "conflicting-3.txt" }, { 0100644, AUTOMERGEABLE_THEIRS_OID, 3, "conflicting-3.txt" }, { 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "conflicting-4.txt" }, { 0100644, AUTOMERGEABLE_OURS_OID, 2, "conflicting-4.txt" }, { 0100644, AUTOMERGEABLE_THEIRS_OID, 3, "conflicting-4.txt" }, }; patharray.count = 2; patharray.strings = paths; opts.paths = patharray; create_index(checkout_index_entries, 12); git_index_write(g_index); cl_git_pass(git_checkout_index(g_repo, g_index, &opts)); ensure_workdir_contents("conflicting-1.txt", CONFLICTING_DIFF3_FILE); cl_assert(!git_path_exists("merge-resolve/conflicting-2.txt")); ensure_workdir_contents("conflicting-3.txt", AUTOMERGEABLE_MERGED_FILE); cl_assert(!git_path_exists("merge-resolve/conflicting-4.txt")); }
false
false
false
false
false
0
init_output(void) { const char *str; int i; tp = tbufputs; init_tty(); /* Window size: clear defaults, then try: * environment, ioctl TIOCGWINSZ, termcap, defaults. */ lines = ((str = getvar("LINES"))) ? atoi(str) : 0; columns = ((str = getvar("COLUMNS"))) ? atoi(str) : 0; if (lines <= 0 || columns <= 0) get_window_size(); init_line_numbers(); top_margin = 1; bottom_margin = lines; prompt = fgprompt(); old_ix = -1; init_term(); for (i = 0; i < max_status_height; i++) { init_list(statusfield_list[i]); Stringninit(status_line[i], columns); check_charattrs(status_line[i], columns, 0, __FILE__, __LINE__); } redraw(); output_disabled = 0; }
false
false
false
false
true
1
prepare_http_connect(int sd, struct auth_s *credentials, const char *thost) { rr_data_t data1, data2; int rc = 0; hlist_t tl; if (!sd || !thost || !strlen(thost)) return 0; data1 = new_rr_data(); data2 = new_rr_data(); data1->req = 1; data1->method = strdup("CONNECT"); data1->url = strdup(thost); data1->http = strdup("HTTP/1.1"); data1->headers = hlist_mod(data1->headers, "Proxy-Connection", "keep-alive", 1); /* * Header replacement */ tl = header_list; while (tl) { data1->headers = hlist_mod(data1->headers, tl->key, tl->value, 1); tl = tl->next; } if (debug) printf("Starting authentication...\n"); if (proxy_authenticate(&sd, data1, data2, credentials)) { /* * Let's try final auth step, possibly changing data2->code */ if (data2->code == 407) { if (debug) { printf("Sending real request:\n"); hlist_dump(data1->headers); } if (!headers_send(sd, data1)) { printf("Sending request failed!\n"); goto bailout; } if (debug) printf("\nReading real response:\n"); reset_rr_data(data2); if (!headers_recv(sd, data2)) { if (debug) printf("Reading response failed!\n"); goto bailout; } if (debug) hlist_dump(data2->headers); } if (data2->code == 200) { if (debug) printf("Ok CONNECT response. Tunneling...\n"); rc = 1; } else if (data2->code == 407) { syslog(LOG_ERR, "Authentication for tunnel %s failed!\n", thost); } else { syslog(LOG_ERR, "Request for CONNECT to %s denied!\n", thost); } } else syslog(LOG_ERR, "Tunnel requests failed!\n"); bailout: free_rr_data(data1); free_rr_data(data2); return rc; }
false
false
false
false
false
0
InvertMatrix(double **A, double **AI, int size) { int *index, iScratch[10]; double *column, dScratch[10]; // Check on allocation of working vectors // if ( size <= 10 ) { index = iScratch; column = dScratch; } else { index = new int[size]; column = new double[size]; } int retVal = vtkMath::InvertMatrix(A, AI, size, index, column); if ( size > 10 ) { delete [] index; delete [] column; } return retVal; }
false
false
false
false
false
0
operator< (const DictInfoNode & r, const DictInfoNode & l) { const DictInfo & rhs = r.c_struct; const DictInfo & lhs = l.c_struct; int res = strcmp(rhs.code, lhs.code); if (res < 0) return true; if (res > 0) return false; res = strcmp(rhs.variety,lhs.variety); if (res < 0) return true; if (res > 0) return false; if (rhs.size < lhs.size) return true; if (rhs.size > lhs.size) return false; res = strcmp(rhs.module->name,lhs.module->name); if (res < 0) return true; return false; }
false
false
false
false
false
0
thumb_loader_set_callbacks(ThumbLoader *tl, ThumbLoaderFunc func_done, ThumbLoaderFunc func_error, ThumbLoaderFunc func_progress, gpointer data) { if (!tl) return; if (tl->standard_loader) { thumb_loader_std_set_callbacks((ThumbLoaderStd *)tl, (ThumbLoaderStdFunc) func_done, (ThumbLoaderStdFunc) func_error, (ThumbLoaderStdFunc) func_progress, data); return; } tl->func_done = func_done; tl->func_error = func_error; tl->func_progress = func_progress; tl->data = data; }
false
false
false
false
false
0
fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val) { u8 buf[2] = {reg, val}; struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2 }; if (i2c_transfer(priv->i2c, &msg, 1) != 1) { dev_err(&priv->i2c->dev, "%s: I2C write reg failed, reg: %02x, val: %02x\n", KBUILD_MODNAME, reg, val); return -EREMOTEIO; } return 0; }
false
false
false
false
false
0
_handle_keyvalue_match(s_p_values_t *v, const char *value, const char *line, char **leftover) { /* debug3("key = %s, value = %s, line = \"%s\"", */ /* v->key, value, line); */ switch (v->type) { case S_P_IGNORE: /* do nothing */ break; case S_P_STRING: _handle_string(v, value, line, leftover); break; case S_P_LONG: _handle_long(v, value, line, leftover); break; case S_P_UINT16: _handle_uint16(v, value, line, leftover); break; case S_P_UINT32: _handle_uint32(v, value, line, leftover); break; case S_P_POINTER: _handle_pointer(v, value, line, leftover); break; case S_P_ARRAY: _handle_array(v, value, line, leftover); break; case S_P_BOOLEAN: _handle_boolean(v, value, line, leftover); break; } }
false
false
false
false
false
0
goo_canvas_item_get_transform_for_child (GooCanvasItem *item, GooCanvasItem *child, cairo_matrix_t *transform) { GooCanvasItemIface *iface = GOO_CANVAS_ITEM_GET_IFACE (item); if (child && iface->get_transform_for_child) return iface->get_transform_for_child (item, child, transform); /* We fallback to the standard get_transform method. */ if (iface->get_transform) return iface->get_transform (item, transform); return FALSE; }
false
false
false
false
false
0
ib_link_state_changed ( struct ib_device *ibdev ) { DBGC ( ibdev, "IBDEV %p link state is %s\n", ibdev, ib_link_state_text ( ibdev ) ); /* Notify drivers of link state change */ ib_notify ( ibdev ); }
false
false
false
false
false
0
direction() const { if(!obj || !obj->isText() ) return QChar::DirON; RenderText *renderTxt = static_cast<RenderText *>( obj ); if ( pos >= renderTxt->stringLength() ) return QChar::DirON; return renderTxt->text()[pos].direction(); }
false
false
false
false
false
0
cloneAttrs(Value & src, Value & dst) { mkAttrs(dst); foreach (Bindings::iterator, i, *src.attrs) { Attr & a = (*dst.attrs)[i->first]; mkCopy(a.value, i->second.value); a.pos = i->second.pos; } }
false
false
false
false
false
0
DISWritePDU(DISTransceiver * xcvr, dis_pdu * pdu) { char buffer[2048], *p; #ifdef HAVE_RECVMSG struct msghdr msg; struct iovec vec; #endif XDR xdr; int i, result, len; /* * Fill-out any length fields internal to the PDU (other than the length * field in the header. */ DISAddPDUSizes(pdu); /* * Now normalize the packet. */ xdrumem_create(&xdr, (char *) &buffer, sizeof(buffer), XDR_ENCODE); xdr_dis_pdu(&xdr, pdu); len = xdr_getpos(&xdr); /* * Now for a hack. We need to insert the correct packet length into * the PDU header. The header is somewhat stable from one protocol release * to the next, so I've just hard-coded it here. */ p = buffer + 8; *((u_short *) p) = htons(len); #ifdef HAVE_RECVMSG msg.msg_namelen = sizeof(struct sockaddr); msg.msg_iov = &vec; msg.msg_iovlen = 1; #ifdef HAVE_MSG_ACCRIGHTS msg.msg_accrights = (caddr_t) NULL; msg.msg_accrightslen = 0; #endif #ifdef HAVE_MSG_CONTROL msg.msg_control = (caddr_t) NULL; msg.msg_controllen = 0; #endif msg.msg_flags = 0; vec.iov_base = (caddr_t) & buffer; vec.iov_len = len; if (DISDisableWrite == 0) for (i = 0; i < xcvr->num_dest; ++i) { msg.msg_name = (caddr_t) & xcvr->dest[i].addr; if ((result = sendmsg(xcvr->s, &msg, 0)) == -1) { perror("on sendmsg"); } }; #else if (DISDisableWrite == 0) for (i = 0; i < xcvr->num_dest; ++i) { if ((result = sendto(xcvr->s, buffer, xdr_getpos(&xdr), 0, (struct sockaddr *) &xcvr->dest[i].addr, sizeof(struct sockaddr))) == -1) { #ifdef WIN32 result = WSAGetLastError(); #else perror("on sendto"); #endif } }; #endif return 0; }
true
true
false
false
false
1
getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, MachineMemOperand *MMO) { EVT VT = Val.getValueType(); SDVTList VTs = getVTList(MVT::Other); SDValue Undef = getUNDEF(Ptr.getValueType()); SDValue Ops[] = { Chain, Val, Ptr, Undef }; FoldingSetNodeID ID; AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(VT.getRawBits()); ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile(), MMO->isNonTemporal())); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { cast<StoreSDNode>(E)->refineAlignment(MMO); return SDValue(E, 0); } SDNode *N = new (NodeAllocator) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, VT, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); }
false
false
false
false
false
0
drbd_md_set_sector_offsets(struct drbd_device *device, struct drbd_backing_dev *bdev) { sector_t md_size_sect = 0; unsigned int al_size_sect = bdev->md.al_size_4k * 8; bdev->md.md_offset = drbd_md_ss(bdev); switch (bdev->md.meta_dev_idx) { default: /* v07 style fixed size indexed meta data */ bdev->md.md_size_sect = MD_128MB_SECT; bdev->md.al_offset = MD_4kB_SECT; bdev->md.bm_offset = MD_4kB_SECT + al_size_sect; break; case DRBD_MD_INDEX_FLEX_EXT: /* just occupy the full device; unit: sectors */ bdev->md.md_size_sect = drbd_get_capacity(bdev->md_bdev); bdev->md.al_offset = MD_4kB_SECT; bdev->md.bm_offset = MD_4kB_SECT + al_size_sect; break; case DRBD_MD_INDEX_INTERNAL: case DRBD_MD_INDEX_FLEX_INT: /* al size is still fixed */ bdev->md.al_offset = -al_size_sect; /* we need (slightly less than) ~ this much bitmap sectors: */ md_size_sect = drbd_get_capacity(bdev->backing_bdev); md_size_sect = ALIGN(md_size_sect, BM_SECT_PER_EXT); md_size_sect = BM_SECT_TO_EXT(md_size_sect); md_size_sect = ALIGN(md_size_sect, 8); /* plus the "drbd meta data super block", * and the activity log; */ md_size_sect += MD_4kB_SECT + al_size_sect; bdev->md.md_size_sect = md_size_sect; /* bitmap offset is adjusted by 'super' block size */ bdev->md.bm_offset = -md_size_sect + MD_4kB_SECT; break; } }
false
true
false
false
false
1
flagTaggedStates() { if (U_FAILURE(*fStatus)) { return; } UVector tagNodes(*fStatus); RBBINode *tagNode; int32_t i; int32_t n; if (U_FAILURE(*fStatus)) { return; } fTree->findNodes(&tagNodes, RBBINode::tag, *fStatus); if (U_FAILURE(*fStatus)) { return; } for (i=0; i<tagNodes.size(); i++) { // For each tag node t (all of 'em) tagNode = (RBBINode *)tagNodes.elementAt(i); for (n=0; n<fDStates->size(); n++) { // For each state s (row in the state table) RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); if (sd->fPositions->indexOf(tagNode) >= 0) { // if s include the tag node t sortedAdd(&sd->fTagVals, tagNode->fVal); } } } }
false
false
false
false
false
0
make_word_flags (w, string) WORD_DESC *w; const char *string; { register int i; size_t slen; DECLARE_MBSTATE; i = 0; slen = strlen (string); while (i < slen) { switch (string[i]) { case '$': w->flags |= W_HASDOLLAR; break; case '\\': break; /* continue the loop */ case '\'': case '`': case '"': w->flags |= W_QUOTED; break; } ADVANCE_CHAR (string, slen, i); } return (w); }
false
false
false
false
false
0
update_samplers(struct st_context *st) { const struct gl_context *ctx = st->ctx; update_shader_samplers(st, PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_FRAGMENT], &st->state.num_samplers[PIPE_SHADER_FRAGMENT]); update_shader_samplers(st, PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_VERTEX], &st->state.num_samplers[PIPE_SHADER_VERTEX]); if (ctx->GeometryProgram._Current) { update_shader_samplers(st, PIPE_SHADER_GEOMETRY, &ctx->GeometryProgram._Current->Base, ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_GEOMETRY], &st->state.num_samplers[PIPE_SHADER_GEOMETRY]); } }
false
false
false
false
false
0
readlinkat (fd, path, buf, len) int fd; const char *path; char *buf; size_t len; { int result; #ifdef __NR_readlinkat # ifndef __ASSUME_ATFCTS if (__have_atfcts >= 0) # endif { result = INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len); # ifndef __ASSUME_ATFCTS if (result == -1 && errno == ENOSYS) __have_atfcts = -1; else # endif return result; } #endif #ifndef __ASSUME_ATFCTS char *pathbuf = NULL; if (fd != AT_FDCWD && path[0] != '/') { size_t pathlen = strlen (path); if (__builtin_expect (pathlen == 0, 0)) { __set_errno (ENOENT); return -1; } static const char procfd[] = "/proc/self/fd/%d/%s"; /* Buffer for the path name we are going to use. It consists of - the string /proc/self/fd/ - the file descriptor number - the file name provided. The final NUL is included in the sizeof. A bit of overhead due to the format elements compensates for possible negative numbers. */ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + pathlen; pathbuf = __alloca (buflen); __snprintf (pathbuf, buflen, procfd, fd, path); path = pathbuf; } INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len); if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) { __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf); result = -1; } return result; #endif }
false
false
false
false
false
0
elm_datetime_field_limit_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, int min, int max) { Datetime_Field *field; ELM_DATETIME_CHECK(obj); ELM_DATETIME_DATA_GET(obj, sd); if (fieldtype >= ELM_DATETIME_AMPM) return; if (min > max) return; field = sd->field_list + fieldtype; if (((min >= mapping[fieldtype].def_min) && (min <= mapping[fieldtype].def_max)) || (field->type == ELM_DATETIME_YEAR)) field->min = min; if (((max >= mapping[fieldtype].def_min) && (max <= mapping[fieldtype].def_max)) || (field->type == ELM_DATETIME_YEAR)) field->max = max; _apply_field_limits(obj); }
false
false
false
false
false
0
change_child_ptr(ldns_rbnode_t* child, ldns_rbnode_t* old, ldns_rbnode_t* new) { if(child == LDNS_RBTREE_NULL) return; if(child->parent == old) child->parent = new; }
false
false
false
false
false
0
create(void const * const buf,const unsigned int size, const EncodeType encodetype, const GUTF8String &encoding) { return encoding.length() ?create(buf,size,encodetype) :create(buf,size,encoding); }
false
false
false
false
false
0
on_query_data_loaded (SoupSession *session, SoupMessage *query, gpointer user_data) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data); GError *error = NULL; char *contents; GeocodePlace *ret; GHashTable *attributes; if (query->status_code != SOUP_STATUS_OK) { g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, query->reason_phrase ? query->reason_phrase : "Query failed"); g_simple_async_result_take_error (simple, error); g_simple_async_result_complete_in_idle (simple); g_object_unref (simple); return; } contents = g_strndup (query->response_body->data, query->response_body->length); attributes = resolve_json (contents, &error); if (attributes == NULL) { g_simple_async_result_take_error (simple, error); g_simple_async_result_complete_in_idle (simple); g_object_unref (simple); g_free (contents); return; } /* Now that we can parse the result, save it to cache */ _geocode_glib_cache_save (query, contents); g_free (contents); ret = _geocode_create_place_from_attributes (attributes); g_hash_table_destroy (attributes); g_simple_async_result_set_op_res_gpointer (simple, ret, NULL); g_simple_async_result_complete_in_idle (simple); g_object_unref (simple); }
false
false
false
false
false
0
proc_mutex_mech(apr_proc_mutex_t *pmutex) { const char *mechname = apr_proc_mutex_name(pmutex); if (!strcmp(mechname, "sysvsem")) { return APR_LOCK_SYSVSEM; } else if (!strcmp(mechname, "flock")) { return APR_LOCK_FLOCK; } return APR_LOCK_DEFAULT; }
false
false
false
false
false
0
log_wep(struct wstate *ws, struct ieee80211_frame* wh, int len) { int rd; struct pcap_pkthdr pkh; struct timeval tv; unsigned char *body = (unsigned char*) (wh+1); memset(&pkh, 0, sizeof(pkh)); pkh.caplen = pkh.len = len; if (gettimeofday(&tv, NULL) == -1) err(1, "gettimeofday()"); pkh.tv_sec = tv.tv_sec; pkh.tv_usec = tv.tv_usec; if (write(ws->ws_fd, &pkh, sizeof(pkh)) != sizeof(pkh)) err(1, "write()"); rd = write(ws->ws_fd, wh, len); if (rd == -1) { perror("write()"); exit(1); } if (rd != len) { time_print("short write %d out of %d\n", rd, len); exit(1); } #if 0 if (fsync(ws->ws_fd) == -1) { perror("fsync()"); exit(1); } #endif memcpy(ws->ws_iv, body, 3); ws->ws_packets++; }
false
false
false
false
false
0
decide_eye(int pos) { int color; struct eyevalue value; int attack_point; int defense_point; int eyepos; SGFTree tree; reset_engine(); silent_examine_position(EXAMINE_DRAGONS_WITHOUT_OWL); color = black_eye[pos].color; if (!IS_STONE(color)) { gprintf("The eye at %1m is not of a single color.\n", pos); return; } if (printboard) showboard(0); /* Enable sgf output. */ if (*outfilename) sgffile_begindump(&tree); count_variations = 1; if (black_eye[pos].color == BLACK) { eyepos = black_eye[pos].origin; compute_eyes(eyepos, &value, &attack_point, &defense_point, black_eye, half_eye, 0); gprintf("Black eyespace at %1m: %s\n", eyepos, eyevalue_to_string(&value)); if (eye_move_urgency(&value) > 0) { gprintf(" vital points: %1m (attack) %1m (defense)\n", attack_point, defense_point); } } if (white_eye[pos].color == WHITE) { eyepos = white_eye[pos].origin; compute_eyes(eyepos, &value, &attack_point, &defense_point, white_eye, half_eye, 0); gprintf("White eyespace at %1m: %s\n", eyepos, eyevalue_to_string(&value)); if (eye_move_urgency(&value) > 0) { gprintf(" vital points: %1m (attack) %1m (defense)\n", attack_point, defense_point); } } /* Finish sgf output. */ sgffile_enddump(outfilename); count_variations = 0; }
false
false
false
false
false
0
statusbars_remove_unvisible(MAIN_WINDOW_REC *window) { GSList *tmp, *next; for (tmp = window->statusbars; tmp != NULL; tmp = next) { STATUSBAR_REC *bar = tmp->data; next = tmp->next; if (!STATUSBAR_IS_VISIBLE(bar->config, window)) statusbar_destroy(bar); } }
false
false
false
false
false
0
hp100_get_stats(struct net_device *dev) { unsigned long flags; int ioaddr = dev->base_addr; struct hp100_private *lp = netdev_priv(dev); #ifdef HP100_DEBUG_B hp100_outw(0x4215, TRACE); #endif spin_lock_irqsave(&lp->lock, flags); hp100_ints_off(); /* Useful ? Jean II */ hp100_update_stats(dev); hp100_ints_on(); spin_unlock_irqrestore(&lp->lock, flags); return &(dev->stats); }
false
false
false
false
false
0
context_lex_detect_nonnegative_parameters( struct isl_context *context, struct isl_tab *tab) { struct isl_context_lex *clex = (struct isl_context_lex *)context; struct isl_tab_undo *snap; if (!tab) return NULL; snap = isl_tab_snap(clex->tab); if (isl_tab_push_basis(clex->tab) < 0) goto error; tab = tab_detect_nonnegative_parameters(tab, clex->tab); if (isl_tab_rollback(clex->tab, snap) < 0) goto error; return tab; error: isl_tab_free(tab); return NULL; }
false
false
false
false
false
0
cmd_mode(char *arg) { lcase(arg); if (!strcmp(arg, "reader")) { prot_printf(nntp_out, "%u", (nntp_capa & MODE_READ) ? 200 : 201); if (config_serverinfo || nntp_authstate) { prot_printf(nntp_out, " %s", config_servername); } if (nntp_authstate || (config_serverinfo == IMAP_ENUM_SERVERINFO_ON)) { prot_printf(nntp_out, " Cyrus NNTP%s %s", config_mupdate_server ? " Murder" : "", cyrus_version()); } prot_printf(nntp_out, " server ready, posting %s\r\n", (nntp_capa & MODE_READ) ? "allowed" : "prohibited"); } else if (!strcmp(arg, "stream")) { if (nntp_capa & MODE_FEED) { prot_printf(nntp_out, "203 Streaming allowed\r\n"); } else { prot_printf(nntp_out, "502 Streaming prohibited\r\n"); } } else { prot_printf(nntp_out, "501 Unrecognized MODE\r\n"); } prot_flush(nntp_out); }
false
false
false
false
false
0
texture_lo_ptr(const Al3DTag *tag) { const gchar *p = strstr(tag->key, "LoPtr"); if (!p || p == tag->key) return NULL; return gwy_strreplace(tag->key, "LoPtr", "", 1); }
false
false
false
false
false
0
initInstrument(int instr_type, int sample_rate) { struct instr *in = (struct instr *) malloc(sizeof(struct instr)); Stk::setSampleRate(sample_rate); switch(instr_type) { case CLARINET: in->instrObjPtr = new Clarinet(10.0); break; case SAXOFONY: in->instrObjPtr = new Saxofony(10.0); break; case BOWED: in->instrObjPtr = new Bowed(10.0); break; case BANDEDWG: in->instrObjPtr = new BandedWG(); break; case MANDOLIN: in->instrObjPtr = new Mandolin(10.0); break; case SITAR: in->instrObjPtr = new Sitar(10.0); break; case MODALBAR: in->instrObjPtr = new ModalBar(); break; case FLUTE: in->instrObjPtr = new Flute(10.0); break; default: return NULL; } return in; }
false
false
false
false
false
0
pwm_fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { struct pwm_fan_ctx *ctx = cdev->devdata; int ret; if (!ctx || (state > ctx->pwm_fan_max_state)) return -EINVAL; if (state == ctx->pwm_fan_state) return 0; ret = __set_pwm(ctx, ctx->pwm_fan_cooling_levels[state]); if (ret) { dev_err(&cdev->device, "Cannot set pwm!\n"); return ret; } ctx->pwm_fan_state = state; return ret; }
false
false
false
false
false
0
pattern_accum_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect, const gs_imager_state *pis, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath) { gx_device_pattern_accum *const padev = (gx_device_pattern_accum *) dev; if (padev->bits) (*dev_proc(padev->target, fill_rectangle_hl_color)) (padev->target, rect, pis, pdcolor, pcpath); if (padev->mask) { int x, y, w, h; x = fixed2int(rect->p.x); y = fixed2int(rect->p.y); w = fixed2int(rect->q.x) - x; h = fixed2int(rect->q.y) - y; return (*dev_proc(padev->mask, fill_rectangle)) ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1); } else return 0; }
false
false
false
false
false
0
searchForFace(const vector<CPolyhedron::TPolyhedronFace> &fs,uint32_t v1,uint32_t v2,uint32_t v3) { for (vector<CPolyhedron::TPolyhedronFace>::const_iterator it=fs.begin();it!=fs.end();++it) { const vector<uint32_t> &f=it->vertices; size_t hmf=0; for (vector<uint32_t>::const_iterator it2=f.begin();it2!=f.end();++it2) { if (*it2==v1) hmf|=1; else if (*it2==v2) hmf|=2; else if (*it2==v3) hmf|=4; } if (hmf==7) return true; } return false; }
false
false
false
false
false
0
cd_device_dbus_emit_property_changed (CdDevice *device, const gchar *property_name, GVariant *property_value) { GVariantBuilder builder; GVariantBuilder invalidated_builder; /* not yet connected */ if (device->priv->connection == NULL) return; /* build the dict */ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY); g_variant_builder_add (&builder, "{sv}", property_name, property_value); if (device->priv->require_modified_signal) { g_variant_builder_add (&builder, "{sv}", CD_DEVICE_PROPERTY_MODIFIED, g_variant_new_uint64 (device->priv->modified)); device->priv->require_modified_signal = FALSE; } g_dbus_connection_emit_signal (device->priv->connection, NULL, device->priv->object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", g_variant_new ("(sa{sv}as)", COLORD_DBUS_INTERFACE_DEVICE, &builder, &invalidated_builder), NULL); }
false
false
false
false
false
0
skip_top_folders (char * name) { static const char * home; static int len; if (! home) { home = g_get_home_dir (); len = strlen (home); if (len > 0 && home[len - 1] == G_DIR_SEPARATOR) len --; } #ifdef _WIN32 if (! g_ascii_strncasecmp (name, home, len) && name[len] == '\\') #else if (! strncmp (name, home, len) && name[len] == '/') #endif return name + len + 1; #ifdef _WIN32 if (g_ascii_isalpha (name[0]) && name[1] == ':' && name[2] == '\\') return name + 3; #else if (name[0] == '/') return name + 1; #endif return name; }
false
false
false
false
false
0
RunProgram(int mode, char *Command) { char Cmd[1024]; strlcpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return (system(Cmd) == 0); }
false
false
false
false
false
0
declare_global(lexid *name, decl *value) { ste *p = find(name); // ste **pp = NULL; #ifdef DEBUG_SYMTAB printf("Declaring %s globally in scope %d, depth %d\n", name->getname(), scopes[globalscope], globalscope); #endif if ( p != NULL && p->getscope() == globalscope ) { Error.Error ("%s already defined in global scope.",name->getname() ); return (p); } /* p is NULL here; no problem with reallocating it. */ p = new ste(name, scopes[ globalscope ], value); /* not-quite-so-straightforward insertions. */ // then insert it into the list. p->next = scopestack[ globalscope ]; ste *oldtop = scopestack[ globalscope ]; scopestack[ globalscope ] = p; // splice in the new ste into the list. Ooh, this is going to be a pain. int i = globalscope + 1; ste *q = NULL; while ( scopestack[i] == oldtop ) { scopestack[i] = p; i++; } if (i <= scopedepth ) { q = scopestack[i]; while ( q->next->scope == q->scope) { q = q->next; } q->next = p; } return (p); }
false
false
false
false
false
0
pcm512x_suspend(struct device *dev) { struct pcm512x_priv *pcm512x = dev_get_drvdata(dev); int ret; ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, PCM512x_RQPD, PCM512x_RQPD); if (ret != 0) { dev_err(dev, "Failed to request power down: %d\n", ret); return ret; } ret = regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), pcm512x->supplies); if (ret != 0) { dev_err(dev, "Failed to disable supplies: %d\n", ret); return ret; } if (!IS_ERR(pcm512x->sclk)) clk_disable_unprepare(pcm512x->sclk); return 0; }
false
false
false
false
false
0
rbthash_table_init (int buckets, rbt_hasher_t hfunc, rbt_data_destroyer_t dfunc, unsigned long expected_entries, struct mem_pool *entrypool) { rbthash_table_t *newtab = NULL; int ret = -1; if (!hfunc) { gf_log (GF_RBTHASH, GF_LOG_ERROR, "Hash function not given"); return NULL; } if (!entrypool && !expected_entries) { gf_log (GF_RBTHASH, GF_LOG_ERROR, "Both mem-pool and expected entries not provided"); return NULL; } if (entrypool && expected_entries) { gf_log (GF_RBTHASH, GF_LOG_ERROR, "Both mem-pool and expected entries are provided"); return NULL; } newtab = GF_CALLOC (1, sizeof (*newtab), gf_common_mt_rbthash_table_t); if (!newtab) return NULL; newtab->buckets = GF_CALLOC (buckets, sizeof (struct rbthash_bucket), gf_common_mt_rbthash_bucket); if (!newtab->buckets) { goto free_newtab; } if (expected_entries) { newtab->entrypool = mem_pool_new (rbthash_entry_t, expected_entries); if (!newtab->entrypool) { gf_log (GF_RBTHASH, GF_LOG_ERROR, "Failed to allocate mem-pool"); goto free_buckets; } newtab->pool_alloced = _gf_true; } else { newtab->entrypool = entrypool; } LOCK_INIT (&newtab->tablelock); INIT_LIST_HEAD (&newtab->list); newtab->numbuckets = buckets; ret = __rbthash_init_buckets (newtab, buckets); if (ret == -1) { gf_log (GF_RBTHASH, GF_LOG_ERROR, "Failed to init buckets"); if (newtab->pool_alloced) mem_pool_destroy (newtab->entrypool); } else { gf_log (GF_RBTHASH, GF_LOG_TRACE, "Inited hash table: buckets:" " %d", buckets); } newtab->hashfunc = hfunc; newtab->dfunc = dfunc; free_buckets: if (ret == -1) GF_FREE (newtab->buckets); free_newtab: if (ret == -1) { GF_FREE (newtab); newtab = NULL; } return newtab; }
false
false
false
false
false
0
createSceneNodeImpl(const String& name) { return OGRE_NEW PCZSceneNode(this, name); }
false
false
false
false
false
0
ip_to_uint(const char* ip) { unsigned int IP[4]; /* 4 octets for IP address */ if ((sscanf(ip, "%u.%u.%u.%u", &IP[0], &IP[1], &IP[2], &IP[3]) == 4) && VALID_IP(IP)) return BUILD_IP(IP); else return 0; }
false
false
false
false
false
0
unquotestrdup(char *s) { char *t, *ret; int quoting; ret = s = strdup(s); /* return unquoted copy */ if(ret == nil) return ret; quoting = 0; t = s; /* s is output string, t is input string */ while(*t!='\0' && (quoting || (*t!=' ' && *t!='\t'))){ if(*t != '\''){ *s++ = *t++; continue; } /* *t is a quote */ if(!quoting){ quoting = 1; t++; continue; } /* quoting and we're on a quote */ if(t[1] != '\''){ /* end of quoted section; absorb closing quote */ t++; quoting = 0; continue; } /* doubled quote; fold one quote into two */ t++; *s++ = *t++; } if(t != s) memmove(s, t, strlen(t)+1); return ret; }
false
false
false
false
false
0