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
soup_socket_read_until (SoupSocket *sock, gpointer buffer, gsize len, gconstpointer boundary, gsize boundary_len, gsize *nread, gboolean *got_boundary, GCancellable *cancellable, GError **error) { SoupSocketPrivate *priv; SoupSocketIOStatus status; gssize my_nread; GError *my_err = NULL; g_return_val_if_fail (SOUP_IS_SOCKET (sock), SOUP_SOCKET_ERROR); g_return_val_if_fail (nread != NULL, SOUP_SOCKET_ERROR); g_return_val_if_fail (len >= boundary_len, SOUP_SOCKET_ERROR); priv = SOUP_SOCKET_GET_PRIVATE (sock); g_mutex_lock (&priv->iolock); *got_boundary = FALSE; if (!priv->istream) status = SOUP_SOCKET_EOF; else { my_nread = soup_filter_input_stream_read_until ( SOUP_FILTER_INPUT_STREAM (priv->istream), buffer, len, boundary, boundary_len, !priv->non_blocking, TRUE, got_boundary, cancellable, &my_err); status = translate_read_status (sock, cancellable, my_nread, nread, my_err, error); } g_mutex_unlock (&priv->iolock); return status; }
false
false
false
false
false
0
m68k_op_movem_16_re_al(void) { uint i = 0; uint register_list = OPER_I_16(); uint ea = EA_AL_16(); uint count = 0; for(; i < 16; i++) if(register_list & (1 << i)) { m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_DA[i])); ea += 2; count++; } USE_CYCLES(count<<CYC_MOVEM_W); }
false
false
false
false
false
0
map_create_hash(hash_fn_t hash_func, eq_fn_t key_eq_func) { map_t *m; WALLOC(m); m->magic = MAP_MAGIC; m->type = MAP_HASH; m->u.ht = htable_create_any(hash_func, NULL, key_eq_func); return m; }
false
false
false
false
false
0
Get_Next_HR_Print(void) { /* * The initial implementation system * has no printers attached, and I've * no real idea how to detect them, * so don't bother. */ if (HRP_index < HRP_nbrnames) /* No printer */ return (HRDEV_PRINTER << HRDEV_TYPE_SHIFT) + HRP_index++; else return -1; }
false
false
false
false
false
0
st_widget_paint_background (StWidget *widget) { StThemeNode *theme_node; ClutterActorBox allocation; guint8 opacity; theme_node = st_widget_get_theme_node (widget); clutter_actor_get_allocation_box (CLUTTER_ACTOR (widget), &allocation); opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (widget)); if (widget->priv->transition_animation) st_theme_node_transition_paint (widget->priv->transition_animation, &allocation, opacity); else st_theme_node_paint (theme_node, current_paint_state (widget), &allocation, opacity); }
false
false
false
false
false
0
test_describe_describe__can_describe_against_a_bare_repo(void) { git_repository *repo; git_describe_options opts = GIT_DESCRIBE_OPTIONS_INIT; git_describe_format_options fmt_opts = GIT_DESCRIBE_FORMAT_OPTIONS_INIT; cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); assert_describe("hard_tag", "HEAD", repo, &opts, &fmt_opts); opts.show_commit_oid_as_fallback = 1; assert_describe("be3563a*", "HEAD^", repo, &opts, &fmt_opts); git_repository_free(repo); }
false
false
false
false
false
0
sata_pmp_eh_recover_pmp(struct ata_port *ap, ata_prereset_fn_t prereset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) { struct ata_link *link = &ap->link; struct ata_eh_context *ehc = &link->eh_context; struct ata_device *dev = link->device; int tries = ATA_EH_PMP_TRIES; int detach = 0, rc = 0; int reval_failed = 0; DPRINTK("ENTER\n"); if (dev->flags & ATA_DFLAG_DETACH) { detach = 1; goto fail; } retry: ehc->classes[0] = ATA_DEV_UNKNOWN; if (ehc->i.action & ATA_EH_RESET) { struct ata_link *tlink; /* reset */ rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, postreset); if (rc) { ata_link_err(link, "failed to reset PMP, giving up\n"); goto fail; } /* PMP is reset, SErrors cannot be trusted, scan all */ ata_for_each_link(tlink, ap, EDGE) { struct ata_eh_context *ehc = &tlink->eh_context; ehc->i.probe_mask |= ATA_ALL_DEVICES; ehc->i.action |= ATA_EH_RESET; } } /* If revalidation is requested, revalidate and reconfigure; * otherwise, do quick revalidation. */ if (ehc->i.action & ATA_EH_REVALIDATE) rc = sata_pmp_revalidate(dev, ehc->classes[0]); else rc = sata_pmp_revalidate_quick(dev); if (rc) { tries--; if (rc == -ENODEV) { ehc->i.probe_mask |= ATA_ALL_DEVICES; detach = 1; /* give it just two more chances */ tries = min(tries, 2); } if (tries) { /* consecutive revalidation failures? speed down */ if (reval_failed) sata_down_spd_limit(link, 0); else reval_failed = 1; ehc->i.action |= ATA_EH_RESET; goto retry; } else { ata_dev_err(dev, "failed to recover PMP after %d tries, giving up\n", ATA_EH_PMP_TRIES); goto fail; } } /* okay, PMP resurrected */ ehc->i.flags = 0; DPRINTK("EXIT, rc=0\n"); return 0; fail: sata_pmp_detach(dev); if (detach) ata_eh_detach_dev(dev); else ata_dev_disable(dev); DPRINTK("EXIT, rc=%d\n", rc); return rc; }
false
false
false
false
false
0
gda_capi_blob_op_finalize (GObject * object) { GdaCapiBlobOp *bop = (GdaCapiBlobOp *) object; g_return_if_fail (GDA_IS_CAPI_BLOB_OP (bop)); /* free specific information */ TO_IMPLEMENT; g_free (bop->priv); bop->priv = NULL; parent_class->finalize (object); }
false
false
false
false
false
0
operator=(const Locale &other) { if (this == &other) { return *this; } if (&other == NULL) { this->setToBogus(); return *this; } /* Free our current storage */ if(fullName != fullNameBuffer) { uprv_free(fullName); fullName = fullNameBuffer; } /* Allocate the full name if necessary */ if(other.fullName != other.fullNameBuffer) { fullName = (char *)uprv_malloc(sizeof(char)*(uprv_strlen(other.fullName)+1)); if (fullName == NULL) { return *this; } } /* Copy the full name */ uprv_strcpy(fullName, other.fullName); /* baseName is the cached result of getBaseName. if 'other' has a baseName and it fits in baseNameBuffer, then copy it. otherwise set it to NULL, and let the user lazy-create it (in getBaseName) if they want it. */ if(baseName && baseName != baseNameBuffer) { uprv_free(baseName); } baseName = NULL; if(other.baseName == other.baseNameBuffer) { uprv_strcpy(baseNameBuffer, other.baseNameBuffer); baseName = baseNameBuffer; } /* Copy the language and country fields */ uprv_strcpy(language, other.language); uprv_strcpy(script, other.script); uprv_strcpy(country, other.country); /* The variantBegin is an offset, just copy it */ variantBegin = other.variantBegin; fIsBogus = other.fIsBogus; return *this; }
false
false
false
false
false
0
gen_cooked_ax25(unsigned char **frame, int *len, struct ax_calls *calls) { int minsize = AXLEN+3+1+AXLEN+3+1+(calls->ax_n_digis*(AXLEN+3+1))+2; int i,l; if (*len < minsize) return -1; strncpy(*frame,ax25_ntoa_pretty(&calls->ax_from_call),AXLEN+3); l = strlen(*frame); *frame += l; *(*frame)++ = '>'; *len -= (l+1); strncpy(*frame,ax25_ntoa_pretty(&calls->ax_to_call),AXLEN+3); l = strlen(*frame); *frame += l; *len -= l; for (i = 0; i < calls->ax_n_digis; i++) { *(*frame)++ = ','; (*len)--; strncpy(*frame,ax25_ntoa_pretty(&calls->ax_digi_call[i]),AXLEN+3); l = strlen(*frame); *frame += l; *len -= l; /* only the last repeated digi gets * */ if (calls->ax_n_digis && calls->ax_next_digi-1 == i) { *(*frame)++ = '*'; (*len)--; } } *(*frame)++ = ':'; (*len)--; return 0; }
false
false
false
false
false
0
ReadMaterial( Collada::Material& pMaterial) { while( mReader->read()) { if( mReader->getNodeType() == irr::io::EXN_ELEMENT) { if (IsElement("material")) { SkipElement(); } else if( IsElement( "instance_effect")) { // referred effect by URL int attrUrl = GetAttribute( "url"); const char* url = mReader->getAttributeValue( attrUrl); if( url[0] != '#') ThrowException( "Unknown reference format"); pMaterial.mEffect = url+1; SkipElement(); } else { // ignore the rest SkipElement(); } } else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) { if( strcmp( mReader->getNodeName(), "material") != 0) ThrowException( "Expected end of <material> element."); break; } } }
false
false
false
false
false
0
parse_month (const gchar *month) { gint i; for (i = 0; i < 12; i++) { if (!strncmp (month, months[i], 3)) { return i; } } return -1; }
false
false
false
false
false
0
_ZmodF_mul_fft_reduce_modB(unsigned long* out, ZmodF_t* in, unsigned long len) { for (unsigned long i = 0; i < len; i++) out[i] = in[i][0]; }
false
false
false
false
false
0
tidy_after_forward_propagate_addr (gimple stmt) { /* We may have turned a trapping insn into a non-trapping insn. */ if (maybe_clean_or_replace_eh_stmt (stmt, stmt) && gimple_purge_dead_eh_edges (gimple_bb (stmt))) cfg_changed = true; if (TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR) recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt)); }
false
false
false
false
false
0
addService(const Regex& url, Service& service) { log_debug("add service for regex"); WriteLock serviceLock(_serviceMutex); _services.push_back(ServicesType::value_type(url, &service)); }
false
false
false
false
false
0
permmap_class_free(void *elem) { if (elem != NULL) { apol_permmap_class_t *c = (apol_permmap_class_t *) elem; apol_vector_destroy(&c->perms); free(c); } }
false
false
false
false
false
0
Read (Document *doc, GsfInput *in, G_GNUC_UNUSED char const *mime_type, G_GNUC_UNUSED GOIOContext *io) { CMLReadState state; bool success = false; state.doc = doc; state.app = doc->GetApplication (); state.context = io; state.cur.push (doc); state.type = ContentTypeMisc; doc->SetScale (100.); if (NULL != in) { GsfXMLInDoc *xml = gsf_xml_in_doc_new (cml_dtd, NULL); success = gsf_xml_in_doc_parse (xml, in, &state); if (!success) go_io_warning (state.context, _("'%s' is corrupt!"), gsf_input_name (in)); gsf_xml_in_doc_free (xml); } return success? state.type: ContentTypeUnknown; }
false
false
false
false
false
0
attr_value_lowest(struct berval **values, value_compare_fn_type compare_fn) { /* We iterate through the values, storing our last best guess as to the lowest */ struct berval *lowest_so_far = values[0]; struct berval *this_one = NULL; for (this_one = *values; this_one; this_one = *values++) { if (compare_fn(lowest_so_far,this_one) > 0) { lowest_so_far = this_one; } } return lowest_so_far; }
false
false
false
false
false
0
CorrectViewport(int i, int MAX_PLAYERS){ if (vpb_dir[i]!=1 && vpb_dir[i]!=-1) vpb_dir[i]=1; int starta=rViewportConfiguration::s_viewportConfigurations[rViewportConfiguration::next_conf_num]->num_viewports-1; int startb=rViewportConfiguration::s_viewportConfigurations[ conf_num]->num_viewports-1; if (starta>startb) startb=starta; s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS-vpb_dir[i]; s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS; int oldValue = s_newViewportBelongsToPlayer[i]; bool again; bool expectChange = false; do{ // rotate player assignemnt s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS+vpb_dir[i]; s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS; // check for conflicts again=false; for(int j=starta;j>=0;j--) if (i!=j && s_newViewportBelongsToPlayer[i] ==s_newViewportBelongsToPlayer[j]) { again=true; expectChange=true; } } while(again); if ( oldValue == s_newViewportBelongsToPlayer[i] && expectChange ) { // no change? swap players. s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS+vpb_dir[i]; s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS; for(int j=starta;j>=0;j--) if (i!=j && s_newViewportBelongsToPlayer[i] ==s_newViewportBelongsToPlayer[j]) { s_newViewportBelongsToPlayer[j] = oldValue; } } }
false
false
false
false
false
0
addRangeTableEntryForJoin(ParseState *pstate, List *colnames, JoinType jointype, List *aliasvars, Alias *alias, bool inFromCl) { RangeTblEntry *rte = makeNode(RangeTblEntry); Alias *eref; int numaliases; /* * Fail if join has too many columns --- we must be able to reference * any of the columns with an AttrNumber. */ if (list_length(aliasvars) > MaxAttrNumber) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("joins can have at most %d columns", MaxAttrNumber))); rte->rtekind = RTE_JOIN; rte->relid = InvalidOid; rte->subquery = NULL; rte->jointype = jointype; rte->joinaliasvars = aliasvars; rte->alias = alias; eref = alias ? (Alias *) copyObject(alias) : makeAlias("unnamed_join", NIL); numaliases = list_length(eref->colnames); /* fill in any unspecified alias columns */ if (numaliases < list_length(colnames)) eref->colnames = list_concat(eref->colnames, list_copy_tail(colnames, numaliases)); rte->eref = eref; /*---------- * Flags: * - this RTE should be expanded to include descendant tables, * - this RTE is in the FROM clause, * - this RTE should be checked for appropriate access rights. * * Joins are never checked for access rights. *---------- */ rte->inh = false; /* never true for joins */ rte->inFromCl = inFromCl; rte->requiredPerms = 0; rte->checkAsUser = InvalidOid; /* * Add completed RTE to pstate's range table list, but not to join list * nor namespace --- caller must do that if appropriate. */ if (pstate != NULL) pstate->p_rtable = lappend(pstate->p_rtable, rte); return rte; }
false
false
false
false
false
0
radioBoxDisarm(void) { AplusRadioBox *rbox=(AplusRadioBox *)owner(); if (rbox!=0) rbox->disarm(); }
false
false
false
false
false
0
pkix_pl_OID_Equals( PKIX_PL_Object *first, PKIX_PL_Object *second, PKIX_Boolean *pResult, void *plContext) { PKIX_Int32 cmpResult; PKIX_ENTER(OID, "pkix_pl_OID_Equals"); PKIX_NULLCHECK_THREE(first, second, pResult); PKIX_CHECK(pkix_pl_OID_Comparator (first, second, &cmpResult, plContext), PKIX_OIDCOMPARATORFAILED); *pResult = (cmpResult == 0); cleanup: PKIX_RETURN(OID); }
false
false
false
false
false
0
prev_char_clipped(int pos) const { if (pos<=0) return 0; IS_UTF8_ALIGNED2(this, (pos)) char c; do { pos--; if (pos==0) return 0; c = byte_at(pos); } while ( (c&0xc0) == 0x80); IS_UTF8_ALIGNED2(this, (pos)) return pos; }
false
false
false
false
false
0
pform_make_udp_input_ports(list<perm_string>*names) { svector<PWire*>*out = new svector<PWire*>(names->size()); unsigned idx = 0; for (list<perm_string>::iterator cur = names->begin() ; cur != names->end() ; cur ++ ) { perm_string txt = *cur; PWire*pp = new PWire(txt, NetNet::IMPLICIT, NetNet::PINPUT, IVL_VT_LOGIC); (*out)[idx] = pp; idx += 1; } delete names; return out; }
false
false
false
false
false
0
cookies() const { CookieJar *that = const_cast<CookieJar*>(this); if (!m_loaded) that->load(); return allCookies(); }
false
false
false
false
false
0
img_ir_nec_scancode(int len, u64 raw, u64 enabled_protocols, struct img_ir_scancode_req *request) { unsigned int addr, addr_inv, data, data_inv; /* a repeat code has no data */ if (!len) return IMG_IR_REPEATCODE; if (len != 32) return -EINVAL; /* raw encoding: ddDDaaAA */ addr = (raw >> 0) & 0xff; addr_inv = (raw >> 8) & 0xff; data = (raw >> 16) & 0xff; data_inv = (raw >> 24) & 0xff; if ((data_inv ^ data) != 0xff) { /* 32-bit NEC (used by Apple and TiVo remotes) */ /* scan encoding: as transmitted, MSBit = first received bit */ request->scancode = bitrev8(addr) << 24 | bitrev8(addr_inv) << 16 | bitrev8(data) << 8 | bitrev8(data_inv); } else if ((addr_inv ^ addr) != 0xff) { /* Extended NEC */ /* scan encoding: AAaaDD */ request->scancode = addr << 16 | addr_inv << 8 | data; } else { /* Normal NEC */ /* scan encoding: AADD */ request->scancode = addr << 8 | data; } request->protocol = RC_TYPE_NEC; return IMG_IR_SCANCODE; }
false
false
false
false
false
0
clear_local_APIC(void) { int maxlvt; u32 v; /* APIC hasn't been mapped yet */ if (!x2apic_mode && !apic_phys) return; maxlvt = lapic_get_maxlvt(); /* * Masking an LVT entry can trigger a local APIC error * if the vector is zero. Mask LVTERR first to prevent this. */ if (maxlvt >= 3) { v = ERROR_APIC_VECTOR; /* any non-zero vector will do */ apic_write(APIC_LVTERR, v | APIC_LVT_MASKED); } /* * Careful: we have to set masks only first to deassert * any level-triggered sources. */ v = apic_read(APIC_LVTT); apic_write(APIC_LVTT, v | APIC_LVT_MASKED); v = apic_read(APIC_LVT0); apic_write(APIC_LVT0, v | APIC_LVT_MASKED); v = apic_read(APIC_LVT1); apic_write(APIC_LVT1, v | APIC_LVT_MASKED); if (maxlvt >= 4) { v = apic_read(APIC_LVTPC); apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); } /* lets not touch this if we didn't frob it */ #ifdef CONFIG_X86_THERMAL_VECTOR if (maxlvt >= 5) { v = apic_read(APIC_LVTTHMR); apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED); } #endif #ifdef CONFIG_X86_MCE_INTEL if (maxlvt >= 6) { v = apic_read(APIC_LVTCMCI); if (!(v & APIC_LVT_MASKED)) apic_write(APIC_LVTCMCI, v | APIC_LVT_MASKED); } #endif /* * Clean APIC state for other OSs: */ apic_write(APIC_LVTT, APIC_LVT_MASKED); apic_write(APIC_LVT0, APIC_LVT_MASKED); apic_write(APIC_LVT1, APIC_LVT_MASKED); if (maxlvt >= 3) apic_write(APIC_LVTERR, APIC_LVT_MASKED); if (maxlvt >= 4) apic_write(APIC_LVTPC, APIC_LVT_MASKED); /* Integrated APIC (!82489DX) ? */ if (lapic_is_integrated()) { if (maxlvt > 3) /* Clear ESR due to Pentium errata 3AP and 11AP */ apic_write(APIC_ESR, 0); apic_read(APIC_ESR); } }
false
false
false
false
false
0
gl847_update_hardware_sensors (Genesys_Scanner * s) { /* do what is needed to get a new set of events, but try to not lose any of them. */ SANE_Status status = SANE_STATUS_GOOD; uint8_t val; uint8_t scan, file, email, copy; switch(s->dev->model->gpo_type) { case GPO_CANONLIDE700: scan=0x04; file=0x02; email=0x01; copy=0x08; break; default: scan=0x01; file=0x02; email=0x04; copy=0x08; } RIE (sanei_genesys_read_register (s->dev, REG6D, &val)); if (s->val[OPT_SCAN_SW].b == s->last_val[OPT_SCAN_SW].b) s->val[OPT_SCAN_SW].b = (val & scan) == 0; if (s->val[OPT_FILE_SW].b == s->last_val[OPT_FILE_SW].b) s->val[OPT_FILE_SW].b = (val & file) == 0; if (s->val[OPT_EMAIL_SW].b == s->last_val[OPT_EMAIL_SW].b) s->val[OPT_EMAIL_SW].b = (val & email) == 0; if (s->val[OPT_COPY_SW].b == s->last_val[OPT_COPY_SW].b) s->val[OPT_COPY_SW].b = (val & copy) == 0; return status; }
false
false
false
false
false
0
ast_set_qos(int sockfd, int tos, int cos, const char *desc) { int res = 0; int set_tos; int set_tclass; struct ast_sockaddr addr; /* If the sock address is IPv6, the TCLASS field must be set. */ set_tclass = !ast_getsockname(sockfd, &addr) && ast_sockaddr_is_ipv6(&addr) ? 1 : 0; /* If the the sock address is IPv4 or (IPv6 set to any address [::]) set TOS bits */ set_tos = (!set_tclass || (set_tclass && ast_sockaddr_is_any(&addr))) ? 1 : 0; if (set_tos) { if ((res = setsockopt(sockfd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)))) { ast_log(LOG_WARNING, "Unable to set %s DSCP TOS value to %d (may be you have no " "root privileges): %s\n", desc, tos, strerror(errno)); } else if (tos) { ast_verb(2, "Using %s TOS bits %d\n", desc, tos); } } #if defined(IPV6_TCLASS) && defined(IPPROTO_IPV6) if (set_tclass) { if (!ast_getsockname(sockfd, &addr) && ast_sockaddr_is_ipv6(&addr)) { if ((res = setsockopt(sockfd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)))) { ast_log(LOG_WARNING, "Unable to set %s DSCP TCLASS field to %d (may be you have no " "root privileges): %s\n", desc, tos, strerror(errno)); } else if (tos) { ast_verb(2, "Using %s TOS bits %d in TCLASS field.\n", desc, tos); } } } #endif #ifdef linux if (setsockopt(sockfd, SOL_SOCKET, SO_PRIORITY, &cos, sizeof(cos))) { ast_log(LOG_WARNING, "Unable to set %s CoS to %d: %s\n", desc, cos, strerror(errno)); } else if (cos) { ast_verb(2, "Using %s CoS mark %d\n", desc, cos); } #endif return res; }
false
false
false
false
false
0
singleEscape(unsigned short c) { switch(c) { case 'b': return 0x08; case 't': return 0x09; case 'n': return 0x0A; case 'v': return 0x0B; case 'f': return 0x0C; case 'r': return 0x0D; case '"': return 0x22; case '\'': return 0x27; case '\\': return 0x5C; default: return c; } }
false
false
false
false
false
0
gaussfunc(int m, int n, double *p, double *dy, double **dvec, void *vars) { int i; struct vars_struct *v = (struct vars_struct *) vars; double *x, *y, *ey; double xc, sig2; x = v->x; y = v->y; ey = v->ey; sig2 = p[3]*p[3]; for (i=0; i<m; i++) { xc = x[i]-p[2]; dy[i] = (y[i] - p[1]*exp(-0.5*xc*xc/sig2) - p[0])/ey[i]; } return 0; }
false
false
false
false
false
0
do_pselect(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timespec __user *tsp, const sigset_t __user *sigmask, size_t sigsetsize) { sigset_t ksigmask, sigsaved; struct timespec ts, end_time, *to = NULL; int ret; if (tsp) { if (copy_from_user(&ts, tsp, sizeof(ts))) return -EFAULT; to = &end_time; if (poll_select_set_timeout(to, ts.tv_sec, ts.tv_nsec)) return -EINVAL; } if (sigmask) { /* XXX: Don't preclude handling different sized sigset_t's. */ if (sigsetsize != sizeof(sigset_t)) return -EINVAL; if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask))) return -EFAULT; sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP)); sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); } ret = core_sys_select(n, inp, outp, exp, to); ret = poll_select_copy_remaining(&end_time, tsp, 0, ret); if (ret == -ERESTARTNOHAND) { /* * Don't restore the signal mask yet. Let do_signal() deliver * the signal on the way back to userspace, before the signal * mask is restored. */ if (sigmask) { memcpy(&current->saved_sigmask, &sigsaved, sizeof(sigsaved)); set_restore_sigmask(); } } else if (sigmask) sigprocmask(SIG_SETMASK, &sigsaved, NULL); return ret; }
false
false
false
false
false
0
process_loop(Node node, RfmBlock block) { Rfm_loop_info_table loop_info_t; RfmLoopInfo loop_info; loop_info = (RfmLoopInfo)memset(&loop_info_t, 0x00, sizeof(Rfm_loop_info_table)); if (has_control_variable_loop(node, loop_info)) { block = process_do_loop(node, block, loop_info); } else if (node->THIRD_CHILD->SECOND_CHILD->SUB_CODE == 0x00) { block = process_bct_loop(node, block); } else { block = process_rb_loop(node, block); } return(block); }
false
false
false
false
false
0
ipmi_poweroff_atca(ipmi_user_t user) { struct ipmi_system_interface_addr smi_addr; struct kernel_ipmi_msg send_msg; int rv; unsigned char data[4]; /* * Configure IPMI address for local access */ smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; smi_addr.channel = IPMI_BMC_CHANNEL; smi_addr.lun = 0; printk(KERN_INFO PFX "Powering down via ATCA power command\n"); /* * Power down */ send_msg.netfn = IPMI_NETFN_ATCA; send_msg.cmd = IPMI_ATCA_SET_POWER_CMD; data[0] = IPMI_PICMG_ID; data[1] = 0; /* FRU id */ data[2] = 0; /* Power Level */ data[3] = 0; /* Don't change saved presets */ send_msg.data = data; send_msg.data_len = sizeof(data); rv = ipmi_request_in_rc_mode(user, (struct ipmi_addr *) &smi_addr, &send_msg); /* * At this point, the system may be shutting down, and most * serial drivers (if used) will have interrupts turned off * it may be better to ignore IPMI_UNKNOWN_ERR_COMPLETION_CODE * return code */ if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { printk(KERN_ERR PFX "Unable to send ATCA powerdown message," " IPMI error 0x%x\n", rv); goto out; } if (atca_oem_poweroff_hook) atca_oem_poweroff_hook(user); out: return; }
true
true
false
false
false
1
fillBallsOutside(int placed) { int i = m_columns*m_rows; while ((m_ballsOutside->count()+placed)<m_ballToPlace) { if (!(m_ballsOutside->containsVisible(i))) { KBBGraphicsItemOnBox* b = new KBBGraphicsItemOnBox(KBBScalableGraphicWidget::playerBall, m_parent, m_themeManager, i, m_columns, m_rows); m_ballsOutside->insert(b); b->setPos(x() + ((i - m_columns*m_rows) / m_height)*KBBScalableGraphicWidget::RATIO, y() + ((i - m_columns*m_rows) % m_height)*KBBScalableGraphicWidget::RATIO); } i++; } }
false
false
false
false
false
0
vp56_init(AVCodecContext *avctx, int flip, int has_alpha) { VP56Context *s = avctx->priv_data; int i; s->avctx = avctx; avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P; if (avctx->idct_algo == FF_IDCT_AUTO) avctx->idct_algo = FF_IDCT_VP3; dsputil_init(&s->dsp, avctx); ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); for (i=0; i<4; i++) s->framep[i] = &s->frames[i]; s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN]; s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2]; s->edge_emu_buffer_alloc = NULL; s->above_blocks = NULL; s->macroblocks = NULL; s->quantizer = -1; s->deblock_filtering = 1; s->filter = NULL; s->has_alpha = has_alpha; if (flip) { s->flip = -1; s->frbi = 2; s->srbi = 0; } else { s->flip = 1; s->frbi = 0; s->srbi = 2; } }
false
false
false
false
false
0
opcode_mod(void) { TRACE_LOG("Opcode: MOD.\n"); if (op[1] == 0) i18n_translate_and_exit( libfizmo_module_name, i18n_libfizmo_CANNOT_DIVIDE_BY_ZERO, -1); read_z_result_variable(); TRACE_LOG("MODing %d and %d to %d.\n", (int16_t)op[0], (int16_t)op[1], (uint16_t)((int16_t)op[0] % (int16_t)op[1])); set_variable(z_res_var, (uint16_t)((int16_t)op[0] % (int16_t)op[1]), false); }
false
false
false
false
false
0
pci_vpd_init ( struct pci_vpd *vpd, struct pci_device *pci ) { /* Initialise structure */ vpd->pci = pci; pci_vpd_invalidate_cache ( vpd ); /* Locate VPD capability */ vpd->cap = pci_find_capability ( pci, PCI_CAP_ID_VPD ); if ( ! vpd->cap ) { DBGC ( vpd, PCI_FMT " does not support VPD\n", PCI_ARGS ( pci ) ); return -ENOTTY; } DBGC ( vpd, PCI_FMT " VPD is at offset %02x\n", PCI_ARGS ( pci ), vpd->cap ); return 0; }
false
false
false
false
false
0
namesGetBucket(plotstring searchname) { long i; long sum = 0; for (i = 0; (i < MAXNCH) && (searchname[i] != '\0'); i++) { sum += searchname[i]; } return (sum % NUM_BUCKETS); }
false
false
false
false
false
0
_change_angle(BLURAY *bd) { if (bd->seamless_angle_change) { bd->st0.clip = nav_set_angle(bd->title, bd->st0.clip, bd->request_angle); bd->seamless_angle_change = 0; bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1); /* force re-opening .m2ts file in _seek_internal() */ _close_m2ts(&bd->st0); } }
false
false
false
false
false
0
activecpu_adjust_icount(int delta) { VERIFY_ACTIVECPU_VOID(activecpu_adjust_icount); *cpu[activecpu].intf.icount += delta; }
false
false
false
false
false
0
ReturnProcessString(const PROC * proc) { COLUMN ** columnPtr; COLUMN * column; BOOL overflow; int len; int padding; int tmp; int col; int goalCol; const char * value; char * bufCp; static char buf[MAX_WIDTH + 1]; bufCp = buf; col = 0; goalCol = 0; columnPtr = showList; column = *columnPtr++; while (CanShowColumn(column, goalCol)) { /* * Generate the column's value. */ value = column->showFunc(proc); len = strlen(value); /* * Calculate the required padding to make the returned * value fill up the width of the column. */ padding = column->width - len; if (padding < 0) padding = 0; /* * Assume the column's value hasn't overflowed the * allowed width until we know otherwise. */ overflow = FALSE; /* * If this is not the last column on the line then * truncate its value if necessary to the width of the * column minus one (to allow for the vertical bar). */ if (*columnPtr && (len > column->width)) { len = column->width - 1; overflow = TRUE; padding = 0; } /* * If the column won't fit within the remaining width * of the line then truncate its value to the remaining * width minus one (to allow for the vertical bar). */ if (goalCol + len > outputWidth) { len = outputWidth - goalCol - 1; overflow = TRUE; padding = 0; } if (len < 0) len = 0; /* * If there is any padding to be applied before the * column's value is printed then apply it. */ if (padding > 0) { if (column->justify == RIGHT) { goalCol += padding; padding = 0; } if (column->justify == CENTER) { tmp = padding / 2; padding -= tmp; goalCol += tmp; } } /* * Now actually space over to the goal column where the * value is printed. */ while (col < goalCol) { col++; *bufCp++ = ' '; } /* * Copy as much of the value as we allow. */ memcpy(bufCp, value, len); bufCp += len; goalCol += len; col += len; /* * If the value overflowed then append a vertical bar. */ if (overflow) { *bufCp++ = '|'; goalCol++; col++; } /* * If there is any remaining padding then add it to * the goal column for the next iteration to use. */ if (padding > 0) goalCol += padding; /* * Add in the separation value to the goal column. */ goalCol += separation; column = *columnPtr++; } *bufCp = '\0'; return buf; }
false
false
false
false
false
0
pref_end_search(GtkWidget *widget,gpointer *data){ LOG(LOG_DEBUG, "IN : pref_end_search()"); max_search = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_max_search)); bword_search_automatic = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_word_search)); update_tree_view(); LOG(LOG_DEBUG, "OUT : pref_end_search()"); return(TRUE); }
false
false
false
false
false
0
realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); #else unsigned long key = realpath_cache_key(path, path_len); #endif unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; /* if the pointers match then only subtract the length of the path */ if(r->path == r->realpath) { CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; } else { CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; } free(r); } else if (key == (*bucket)->key && path_len == (*bucket)->path_len && memcmp(path, (*bucket)->path, path_len) == 0) { return *bucket; } else { bucket = &(*bucket)->next; } } return NULL; }
false
false
false
false
false
0
check () { uint64_t val; ssize_t sz = read (fd, &val, sizeof (uint64_t)); if (sz == -1 && (errno == EAGAIN || errno == EINTR)) return 0; errno_assert (sz != -1); return val; }
false
false
false
false
false
0
child_kill_helper(mainloop_child_t *child) { if (kill(child->pid, SIGKILL) < 0) { crm_perror(LOG_ERR, "kill(%d, KILL) failed", child->pid); return -errno; } return 0; }
false
false
false
false
false
0
rxring_mem_alloc(struct sxgbe_priv_data *priv) { int queue_num; SXGBE_FOR_EACH_QUEUE(SXGBE_RX_QUEUES, queue_num) { priv->rxq[queue_num] = devm_kmalloc(priv->device, sizeof(struct sxgbe_rx_queue), GFP_KERNEL); if (!priv->rxq[queue_num]) return -ENOMEM; } return 0; }
false
false
false
false
false
0
request_units_wait(struct unit_list *punits) { unit_list_iterate(punits, punit) { punit->client.focus_status = FOCUS_WAIT; } unit_list_iterate_end; if (punits == get_units_in_focus()) { unit_focus_advance(); } }
false
false
false
false
false
0
load_catval_array_size(struct Map_info *map, int vec, dbCatValArray * cvarr_size) { int i, nrec, ctype; struct field_info *Fi; dbDriver *driver; G_debug(2, "Loading dynamic symbol sizes ..."); db_CatValArray_init(cvarr_size); Fi = Vect_get_field(map, vector.layer[vec].field); if (Fi == NULL) { G_fatal_error(_("Unable to get layer info for vector map")); } driver = db_start_driver_open_database(Fi->driver, Fi->database); if (driver == NULL) G_fatal_error(_("Unable to open database <%s> by driver <%s>"), Fi->database, Fi->driver); /* Note do not check if the column exists in the table because it may be expression */ /* TODO: only select values we need instead of all in column */ nrec = db_select_CatValArray(driver, Fi->table, Fi->key, vector.layer[vec].sizecol, NULL, cvarr_size); G_debug(3, "nrec = %d", nrec); ctype = cvarr_size->ctype; if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) G_fatal_error(_("Size column type must be numeric")); if (nrec < 0) G_fatal_error(_("Unable to select data from table")); G_debug(2, "\nSize column: %d records selected from table", nrec); db_close_database_shutdown_driver(driver); for (i = 0; i < cvarr_size->n_values; i++) { if (ctype == DB_C_TYPE_INT) { G_debug(4, "cat = %d val = %d", cvarr_size->value[i].cat, cvarr_size->value[i].val.i); } else if (ctype == DB_C_TYPE_DOUBLE) { G_debug(4, "cat = %d val = %f", cvarr_size->value[i].cat, cvarr_size->value[i].val.d); } } return nrec; }
false
false
false
false
false
0
gdbm_nextkey (dbf, key) gdbm_file_info *dbf; datum key; { datum return_val; /* The return value. */ int elem_loc; /* The location in the bucket. */ char *find_data; /* Data pointer returned by _gdbm_findkey. */ int hash_val; /* Returned by _gdbm_findkey. */ /* Initialize the gdbm_errno variable. */ gdbm_errno = GDBM_NO_ERROR; /* Set the default return value for no next entry. */ return_val.dptr = NULL; /* Do we have a valid key? */ if (key.dptr == NULL) return return_val; /* Find the key. */ elem_loc = _gdbm_findkey (dbf, key, &find_data, &hash_val); if (elem_loc == -1) return return_val; /* Find the next key. */ get_next_key (dbf, elem_loc, &return_val); return return_val; }
false
false
false
false
false
0
movetofailed(const char *name) { char s[SIZE_s + 1]; xsnprintf(s, SIZE_s, "%s/failed.postings/%s", spooldir, name); ln_log(LNLOG_SERR, LNLOG_CARTICLE, "moving file %s to failed.postings", name); if (rename(name, s)) { ln_log(LNLOG_SERR, LNLOG_CARTICLE, "unable to move failed posting to %s: %m", s); return -1; } else { return 0; } }
false
false
false
false
false
0
x86_pmu_del(struct perf_event *event, int flags) { struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); int i; /* * event is descheduled */ event->hw.flags &= ~PERF_X86_EVENT_COMMITTED; /* * If we're called during a txn, we don't need to do anything. * The events never got scheduled and ->cancel_txn will truncate * the event_list. * * XXX assumes any ->del() called during a TXN will only be on * an event added during that same TXN. */ if (cpuc->txn_flags & PERF_PMU_TXN_ADD) return; /* * Not a TXN, therefore cleanup properly. */ x86_pmu_stop(event, PERF_EF_UPDATE); for (i = 0; i < cpuc->n_events; i++) { if (event == cpuc->event_list[i]) break; } if (WARN_ON_ONCE(i == cpuc->n_events)) /* called ->del() without ->add() ? */ return; /* If we have a newly added event; make sure to decrease n_added. */ if (i >= cpuc->n_events - cpuc->n_added) --cpuc->n_added; if (x86_pmu.put_event_constraints) x86_pmu.put_event_constraints(cpuc, event); /* Delete the array entry. */ while (++i < cpuc->n_events) { cpuc->event_list[i-1] = cpuc->event_list[i]; cpuc->event_constraint[i-1] = cpuc->event_constraint[i]; } --cpuc->n_events; perf_event_update_userpage(event); }
false
false
false
false
false
0
il3945_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb) { struct il_rx_pkt *pkt = rxb_addr(rxb); u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int idx = SEQ_TO_IDX(sequence); struct il_tx_queue *txq = &il->txq[txq_id]; struct ieee80211_tx_info *info; struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); int rate_idx; int fail; if (idx >= txq->q.n_bd || il_queue_used(&txq->q, idx) == 0) { IL_ERR("Read idx for DMA queue txq_id (%d) idx %d " "is out of range [0-%d] %d %d\n", txq_id, idx, txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); return; } /* * Firmware will not transmit frame on passive channel, if it not yet * received some valid frame on that channel. When this error happen * we have to wait until firmware will unblock itself i.e. when we * note received beacon or other frame. We unblock queues in * il3945_pass_packet_to_mac80211 or in il_mac_bss_info_changed. */ if (unlikely((status & TX_STATUS_MSK) == TX_STATUS_FAIL_PASSIVE_NO_RX) && il->iw_mode == NL80211_IFTYPE_STATION) { il_stop_queues_by_reason(il, IL_STOP_REASON_PASSIVE); D_INFO("Stopped queues - RX waiting on passive channel\n"); } txq->time_stamp = jiffies; info = IEEE80211_SKB_CB(txq->skbs[txq->q.read_ptr]); ieee80211_tx_info_clear_status(info); /* Fill the MRR chain with some info about on-chip retransmissions */ rate_idx = il3945_hwrate_to_plcp_idx(tx_resp->rate); if (info->band == IEEE80211_BAND_5GHZ) rate_idx -= IL_FIRST_OFDM_RATE; fail = tx_resp->failure_frame; info->status.rates[0].idx = rate_idx; info->status.rates[0].count = fail + 1; /* add final attempt */ /* tx_status->rts_retry_count = tx_resp->failure_rts; */ info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? IEEE80211_TX_STAT_ACK : 0; D_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", txq_id, il3945_get_tx_fail_reason(status), status, tx_resp->rate, tx_resp->failure_frame); D_TX_REPLY("Tx queue reclaim %d\n", idx); il3945_tx_queue_reclaim(il, txq_id, idx); if (status & TX_ABORT_REQUIRED_MSK) IL_ERR("TODO: Implement Tx ABORT REQUIRED!!!\n"); }
false
false
false
false
false
0
gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink) { XWindowAttributes attr; gboolean reconfigure; g_return_if_fail (GST_IS_XIMAGESINK (ximagesink)); /* Update the window geometry */ g_mutex_lock (&ximagesink->x_lock); if (G_UNLIKELY (ximagesink->xwindow == NULL)) { g_mutex_unlock (&ximagesink->x_lock); return; } XGetWindowAttributes (ximagesink->xcontext->disp, ximagesink->xwindow->win, &attr); /* Check if we would suggest a different width/height now */ reconfigure = (ximagesink->xwindow->width != attr.width) || (ximagesink->xwindow->height != attr.height); ximagesink->xwindow->width = attr.width; ximagesink->xwindow->height = attr.height; g_mutex_unlock (&ximagesink->x_lock); if (reconfigure) gst_pad_push_event (GST_BASE_SINK (ximagesink)->sinkpad, gst_event_new_reconfigure ()); }
false
false
false
false
false
0
flmRegisterHttpCallback( FLM_MODULE_HANDLE hModule, const char * pszUrlString) { RCODE rc = FERR_OK; char * pszTemp; FLMUINT uiRegFlags; if (gv_FlmSysData.HttpConfigParms.bRegistered) { rc = RC_SET( FERR_HTTP_REGISTER_FAILURE); goto Exit; } // Need to save the Url string for later use... if( RC_BAD( rc = f_alloc( f_strlen( pszUrlString) + 1, &pszTemp))) { goto Exit; } f_strcpy( pszTemp, pszUrlString); // Set the flags that tell the server what kind of authentication // we want: // HR_STK_BOTH = Allow both http and https // HR_AUTH_USERSA = Allow any user in the NDS tree or the SAdmin user // HR_REALM_NDS = Use the NDS realm for authentication uiRegFlags = HR_STK_BOTH | HR_AUTH_USERSA | HR_REALM_NDS; if (gv_FlmSysData.HttpConfigParms.fnReg) { if( gv_FlmSysData.HttpConfigParms.fnReg( hModule, pszUrlString, (FLMUINT32)uiRegFlags, flmHttpCallback, NULL, NULL) != 0) { rc = RC_SET( FERR_HTTP_REGISTER_FAILURE); goto Exit; } } else { flmAssert( 0); rc = RC_SET( FERR_NO_HTTP_STACK); goto Exit; } // Save the URL string in gv_FlmSysData gv_FlmSysData.HttpConfigParms.pszURLString = pszTemp; gv_FlmSysData.HttpConfigParms.uiURLStringLen = f_strlen( pszTemp); pszTemp = NULL; gv_FlmSysData.HttpConfigParms.bRegistered = TRUE; Exit: if (RC_BAD( rc)) { if (pszTemp) { f_free( &pszTemp); pszTemp = NULL; } } return( rc); }
false
false
false
false
true
1
StripTrailingSpaces() { cbStyledTextCtrl* control = m_pOwner->GetControl(); // The following code was adapted from the SciTE sourcecode int maxLines = control->GetLineCount(); for (int line = 0; line < maxLines; line++) { int lineStart = control->PositionFromLine(line); int lineEnd = control->GetLineEndPosition(line); int i = lineEnd-1; wxChar ch = (wxChar)(control->GetCharAt(i)); if (control->GetLexer() == wxSCI_LEX_DIFF) lineStart++; while ((i >= lineStart) && ((ch == _T(' ')) || (ch == _T('\t')))) { i--; ch = (wxChar)(control->GetCharAt(i)); } if (i < (lineEnd-1)) { control->SetTargetStart(i+1); control->SetTargetEnd(lineEnd); control->ReplaceTarget(_T("")); } } }
false
false
false
false
false
0
altera_gpio_irq_edge_handler(struct irq_desc *desc) { struct altera_gpio_chip *altera_gc; struct irq_chip *chip; struct of_mm_gpio_chip *mm_gc; struct irq_domain *irqdomain; unsigned long status; int i; altera_gc = to_altera(irq_desc_get_handler_data(desc)); chip = irq_desc_get_chip(desc); mm_gc = &altera_gc->mmchip; irqdomain = altera_gc->mmchip.gc.irqdomain; chained_irq_enter(chip, desc); while ((status = (readl(mm_gc->regs + ALTERA_GPIO_EDGE_CAP) & readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK)))) { writel(status, mm_gc->regs + ALTERA_GPIO_EDGE_CAP); for_each_set_bit(i, &status, mm_gc->gc.ngpio) { generic_handle_irq(irq_find_mapping(irqdomain, i)); } } chained_irq_exit(chip, desc); }
false
false
false
false
false
0
Equals(Handle<Value> that) const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Value::Equals()") || EmptyCheck("v8::Value::Equals()", this) || EmptyCheck("v8::Value::Equals()", that)) { return false; } LOG_API(isolate, "Equals"); ENTER_V8(isolate); i::Handle<i::Object> obj = Utils::OpenHandle(this); i::Handle<i::Object> other = Utils::OpenHandle(*that); // If both obj and other are JSObjects, we'd better compare by identity // immediately when going into JS builtin. The reason is Invoke // would overwrite global object receiver with global proxy. if (obj->IsJSObject() && other->IsJSObject()) { return *obj == *other; } i::Object** args[1] = { other.location() }; EXCEPTION_PREAMBLE(isolate); i::Handle<i::Object> result = CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, false); return *result == i::Smi::FromInt(i::EQUAL); }
false
false
false
false
false
0
need_compute( const SPPack& req_params) { auto req_signature = _using_F().dirty_signature( _using_sig_no); if ( have_data() and req_signature == _signature_when_mirrored and same_as(req_params) ) return false; auto old_mirror = mirror_fname(); make_same( req_params); _signature_when_mirrored = req_signature; auto new_mirror = mirror_fname(); bool got_it = (mirror_back( new_mirror) == 0); return not got_it; }
false
false
false
false
false
0
addto_action_char_list(List char_list, char *names) { int i=0, start=0; char *name = NULL, *tmp_char = NULL; ListIterator itr = NULL; char quote_c = '\0'; int quote = 0; uint32_t id=0; int count = 0; if (!char_list) { error("No list was given to fill in"); return 0; } itr = list_iterator_create(char_list); if (names) { if (names[i] == '\"' || names[i] == '\'') { quote_c = names[i]; quote = 1; i++; } start = i; while(names[i]) { if (quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') names[i] = '`'; else if (names[i] == ',') { if ((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); id = str_2_slurmdbd_msg_type(name); if (id == NO_VAL) { error("You gave a bad action " "'%s'.", name); xfree(name); break; } xfree(name); name = xstrdup_printf("%u", id); while((tmp_char = list_next(itr))) { if (!strcasecmp(tmp_char, name)) break; } list_iterator_reset(itr); if (!tmp_char) { list_append(char_list, name); count++; } else xfree(name); } i++; start = i; if (!names[i]) { error("There is a problem with " "your request. It appears you " "have spaces inside your list."); break; } } i++; } if ((i-start) > 0) { name = xmalloc((i-start)+1); memcpy(name, names+start, (i-start)); id = str_2_slurmdbd_msg_type(name); if (id == NO_VAL) { error("You gave a bad action '%s'.", name); xfree(name); goto end_it; } xfree(name); name = xstrdup_printf("%u", id); while((tmp_char = list_next(itr))) { if (!strcasecmp(tmp_char, name)) break; } if (!tmp_char) { list_append(char_list, name); count++; } else xfree(name); } } end_it: list_iterator_destroy(itr); return count; }
false
true
false
false
false
1
check_tube_open (TpDBusTubeChannel *self) { if (self->priv->result == NULL) return; if (self->priv->address == NULL) return; if (self->priv->state != TP_TUBE_CHANNEL_STATE_OPEN) return; DEBUG ("Tube %s opened: %s", tp_proxy_get_object_path (self), self->priv->address); g_dbus_connection_new_for_address (self->priv->address, G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, NULL, NULL, dbus_connection_new_cb, self); }
false
false
false
false
false
0
send_endorser(struct fujitsu *s) { SANE_Status ret = SANE_STATUS_GOOD; unsigned char cmd[SEND_len]; size_t cmdLen = SEND_len; size_t strLen = strlen(s->u_endorser_string); unsigned char out[S_e_data_max_len]; /*we probably send less below*/ size_t outLen = S_e_data_min_len + strLen; /*fi-5900 might want 1 more byte?*/ DBG (10, "send_endorser: start\n"); if (!s->has_endorser_f && !s->has_endorser_b){ DBG (10, "send_endorser: unsupported\n"); return ret; } /*build the payload*/ memset(out,0,outLen); /*fi-5900 front side uses 0x80, assume all others*/ if(s->u_endorser_side == ED_front){ set_S_endorser_data_id(out,0x80); } else{ set_S_endorser_data_id(out,0); } set_S_endorser_stamp(out,0); set_S_endorser_elec(out,0); if(s->u_endorser_step < 0){ set_S_endorser_decr(out,S_e_decr_dec); } else{ set_S_endorser_decr(out,S_e_decr_inc); } if(s->u_endorser_bits == 24){ set_S_endorser_lap24(out,S_e_lap_24bit); } else{ set_S_endorser_lap24(out,S_e_lap_16bit); } set_S_endorser_ctstep(out,abs(s->u_endorser_step)); set_S_endorser_ulx(out,0); set_S_endorser_uly(out,s->u_endorser_y); switch (s->u_endorser_font) { case FONT_H: set_S_endorser_font(out,S_e_font_horiz); set_S_endorser_bold(out,0); break; case FONT_HB: set_S_endorser_font(out,S_e_font_horiz); set_S_endorser_bold(out,1); break; case FONT_HN: set_S_endorser_font(out,S_e_font_horiz_narrow); set_S_endorser_bold(out,0); break; case FONT_V: set_S_endorser_font(out,S_e_font_vert); set_S_endorser_bold(out,0); break; case FONT_VB: set_S_endorser_font(out,S_e_font_vert); set_S_endorser_bold(out,1); break; } set_S_endorser_size(out,0); set_S_endorser_revs(out,0); if(s->u_endorser_dir == DIR_BTT){ set_S_endorser_dirs(out,S_e_dir_bottom_top); } else{ set_S_endorser_dirs(out,S_e_dir_top_bottom); } set_S_endorser_string_length(out, strLen); set_S_endorser_string(out, s->u_endorser_string, strLen); /*build the command*/ memset(cmd,0,cmdLen); set_SCSI_opcode(cmd, SEND_code); set_S_xfer_datatype (cmd, S_datatype_endorser_data); set_S_xfer_length (cmd, outLen); ret = do_cmd ( s, 1, 0, cmd, cmdLen, out, outLen, NULL, NULL ); DBG (10, "send_endorser: finish %d\n", ret); return ret; }
true
true
false
false
false
1
clutter_gst_video_sink_start (GstBaseSink * base_sink) { ClutterGstVideoSink *sink = CLUTTER_GST_VIDEO_SINK (base_sink); ClutterGstVideoSinkPrivate *priv = sink->priv; priv->source = clutter_gst_source_new (sink); GST_DEBUG_OBJECT (base_sink, "Attaching our GSource to the main context"); g_source_attach ((GSource *) priv->source, priv->clutter_main_context); priv->flow_ret = GST_FLOW_OK; return TRUE; }
false
false
false
false
false
0
seahorse_util_chooser_show_archive_files (GtkDialog *dialog) { GtkFileFilter* filter; int i; static const char *archive_mime_type[] = { "application/x-ar", "application/x-arj", "application/x-bzip", "application/x-bzip-compressed-tar", "application/x-cd-image", "application/x-compress", "application/x-compressed-tar", "application/x-gzip", "application/x-java-archive", "application/x-jar", "application/x-lha", "application/x-lzop", "application/x-rar", "application/x-rar-compressed", "application/x-tar", "application/x-zoo", "application/zip", "application/x-7zip" }; filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Archive files")); for (i = 0; i < G_N_ELEMENTS (archive_mime_type); i++) gtk_file_filter_add_mime_type (filter, archive_mime_type[i]); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All files")); gtk_file_filter_add_pattern (filter, "*"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); }
false
false
false
false
false
0
update() { histogram h; // create histogramm for (const unsigned int* i=in; i != in + (width*height);++i) h(*i); // calc th int th1 = 1; int th2 = 255; unsigned num = 0; unsigned int num1div3 = 4*size/10; // number of pixels in the lower level unsigned int num2div3 = 8*size/10; // number of pixels in the lower two levels for (int i = 0; i < 256; i++) { // wee bit faster than a double loop num += h.hist[i]; if (num < num1div3) th1 = i; if (num < num2div3) th2 = i; } // create the 3 level image uint32_t* outpixel= out; const uint32_t* pixel=in; while(pixel != in+size) // size = defined in frei0r.hpp { if ( grey(*pixel) < th1 ) *outpixel=0xFF000000; else if ( grey(*pixel) < th2) *outpixel=0xFF808080; else *outpixel=0xFFFFFFFF; ++outpixel; ++pixel; } } }
false
false
false
false
false
0
AH_ImExporterQ43_ReadInt(const char *p, int len) { int res=0; int i; for (i=0; i<len; i++) { char c; c=*(p++); if (!isdigit(c)) return res; res*=10; res+=c-'0'; } return res; }
false
false
false
false
false
0
led_pwm_create_of(struct device *dev, struct led_pwm_priv *priv) { struct device_node *child; struct led_pwm led; int ret = 0; memset(&led, 0, sizeof(led)); for_each_child_of_node(dev->of_node, child) { led.name = of_get_property(child, "label", NULL) ? : child->name; led.default_trigger = of_get_property(child, "linux,default-trigger", NULL); led.active_low = of_property_read_bool(child, "active-low"); of_property_read_u32(child, "max-brightness", &led.max_brightness); ret = led_pwm_add(dev, priv, &led, child); if (ret) { of_node_put(child); break; } } return ret; }
false
false
false
false
false
0
one_in(int chance) { if (chance <= 1 || rng(0, chance - 1) == 0) return true; return false; }
false
false
false
false
false
0
efx_ef10_vport_del_vf_mac(struct efx_nic *efx, unsigned int port_id, u8 *mac) { MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN); MCDI_DECLARE_BUF_ERR(outbuf); size_t outlen; int rc; MCDI_SET_DWORD(inbuf, VPORT_DEL_MAC_ADDRESS_IN_VPORT_ID, port_id); ether_addr_copy(MCDI_PTR(inbuf, VPORT_DEL_MAC_ADDRESS_IN_MACADDR), mac); rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); return rc; }
false
false
false
false
false
0
generatePtZ(double& jac, const double * r) const { double kappaMin = ptCut() != ZERO ? sqr(ptCut()/ptMax()) : sqr(0.1*GeV/GeV); double kappa; using namespace RandomHelpers; if ( ptCut() > ZERO ) { pair<double,double> kw = generate(inverse(0.,kappaMin,1.),r[0]); kappa = kw.first; jac *= kw.second; } else { pair<double,double> kw = generate((piecewise(), flat(1e-4,kappaMin), match(inverse(0.,kappaMin,1.))),r[0]); kappa = kw.first; jac *= kw.second; } Energy pt = sqrt(kappa)*ptMax(); pair<double,double> zLims = zBounds(pt); pair<double,double> zw = generate(inverse(0.,zLims.first,zLims.second)+ inverse(1.,zLims.first,zLims.second),r[1]); double z = zw.first; jac *= zw.second; jac *= sqr(ptMax()/lastScale()); return make_pair(pt,z); }
false
false
false
false
false
0
load(FILE *fp) { char tmpname[256]; char linebuf[1024]; ssize_t ret; PSParser *p2 = new PSParser_2(this); int tmp_fd; strncpy(tmpname, "/tmp/PSEditorXXXXXX", sizeof(tmpname)); tmp_fd = mkstemp(tmpname); if (tmp_fd < 0) { fprintf(stderr, "Could not create temporary file (errno %d).\n", errno); return -1; } unlink(tmpname); clear(); while (fgets(linebuf, sizeof(linebuf), fp) != NULL) { if (!p2->parse(linebuf)) { ret = write(tmp_fd, linebuf, strlen(linebuf)); if (ret != (int) strlen(linebuf)) { fprintf(stderr, "Error while writing to temporary file\n"); } } } lseek(tmp_fd, 0L, SEEK_SET); delete(p2); return tmp_fd; }
false
false
false
false
false
0
valid_yank_reg(regname, writing) int regname; int writing; /* if TRUE check for writable registers */ { if ( (regname > 0 && ASCII_ISALNUM(regname)) || (!writing && vim_strchr((char_u *) #ifdef FEAT_EVAL "/.%#:=" #else "/.%#:" #endif , regname) != NULL) || regname == '"' || regname == '-' || regname == '_' #ifdef FEAT_CLIPBOARD || regname == '*' || regname == '+' #endif #ifdef FEAT_DND || (!writing && regname == '~') #endif ) return TRUE; return FALSE; }
false
false
false
false
false
0
fix_cmp(VALUE x, VALUE y) { if (x == y) return INT2FIX(0); if (FIXNUM_P(y)) { if (FIX2LONG(x) > FIX2LONG(y)) return INT2FIX(1); return INT2FIX(-1); } switch (TYPE(y)) { case T_BIGNUM: return rb_big_cmp(rb_int2big(FIX2LONG(x)), y); case T_FLOAT: return rb_dbl_cmp((double)FIX2LONG(x), RFLOAT_VALUE(y)); default: return rb_num_coerce_cmp(x, y, rb_intern("<=>")); } }
false
false
false
false
false
0
prepare_async_result (DeepCountState *state) { ShellMimeSniffer *self = state->self; GArray *results; GPtrArray *sniffed_mime; SniffedResult result; sniffed_mime = g_ptr_array_new (); results = g_array_new (TRUE, TRUE, sizeof (SniffedResult)); if (state->total_items == 0) goto out; result.type = "x-content/video"; result.ratio = (gdouble) state->video_count / (gdouble) state->total_items; g_array_append_val (results, result); result.type = "x-content/audio"; result.ratio = (gdouble) state->audio_count / (gdouble) state->total_items; g_array_append_val (results, result); result.type = "x-content/pictures"; result.ratio = (gdouble) state->image_count / (gdouble) state->total_items; g_array_append_val (results, result); result.type = "x-content/documents"; result.ratio = (gdouble) state->document_count / (gdouble) state->total_items; g_array_append_val (results, result); g_array_sort (results, results_cmp_func); result = g_array_index (results, SniffedResult, 0); g_ptr_array_add (sniffed_mime, g_strdup (result.type)); /* if other types score high in ratio, add them, up to three */ result = g_array_index (results, SniffedResult, 1); if (result.ratio < HIGH_SCORE_RATIO) goto out; g_ptr_array_add (sniffed_mime, g_strdup (result.type)); result = g_array_index (results, SniffedResult, 2); if (result.ratio < HIGH_SCORE_RATIO) goto out; g_ptr_array_add (sniffed_mime, g_strdup (result.type)); out: g_ptr_array_add (sniffed_mime, NULL); self->priv->sniffed_mime = (gchar **) g_ptr_array_free (sniffed_mime, FALSE); g_array_free (results, TRUE); g_simple_async_result_complete_in_idle (self->priv->async_result); }
false
false
false
false
false
0
HostToMask (char *username, char *hostname) { char *realhost, /* user@host (without nick!) */ *temp, *final, /* final product */ *user, /* stores the username */ *host, /* stores the hostname */ /* * first segment of hostname (ie: if host == "a.b.c", * topsegment == "c" (top-level domain) */ *topsegment = NULL; char userhost[UHOSTLEN + 2]; int ii; /* looping */ int cnt; if (!username || !hostname) return (NULL); ircsprintf(userhost, "%s@%s", username, hostname); final = MyMalloc(MAXUSERLEN + 1); final[0] = '\0'; /* strip off a nick nick!user@host (if there is one) */ realhost = (host = strchr(userhost, '!')) ? host + 1 : userhost; user = realhost; if ((host = strchr(realhost, '@'))) { final[0] = '*'; ii = 1; /* * only use the last 8 characters of the username if there * are more */ if ((host - realhost) > 10) user = host - 8; /* now store the username into 'final' */ while (*user != '@') final[ii++] = *user++; final[ii++] = '@'; /* host == "@host.name", so point past the @ */ host++; } else { /* there's no @ in the hostname, just make it *@*.host.com */ strlcpy(final, "*@", MAXUSERLEN + 1); ii = 2; host = userhost; } /* * ii now points to the offset in 'final' of where the * converted hostname should go */ realhost = strchr(host, '.'); if (realhost) topsegment = strchr(realhost + 1, '.'); if (!realhost || !topsegment) { /* * if realhost is NULL, then the hostname must be a top-level * domain; and if topsegment is NULL, the hostname must be * 2 parts (ie: blah.org), so don't strip off "blah" */ strlcpy(final + ii, host, MAXUSERLEN + 1 - ii); } else { /* * topsegment now contains the top-level domain - if it's * numerical, it MUST be an ip address, since there are * no numerical TLD's =P */ /* advance to the end of topsegment */ for (temp = topsegment; *temp; temp++); --temp; /* point to the last letter (number) of the TLD */ if ((*temp >= '0') && (*temp <= '9')) { /* Numerical IP Address */ while (*temp != '.') --temp; /* * copy the ip address (except the last .XXX) into the * right spot in 'final' */ strlcpy(final + ii, host, MAXUSERLEN + 1 - ii); /* stick a .* on the end :-) */ ii += (temp - host); strlcpy(final + ii, ".*", MAXUSERLEN + 1 - ii); } else { /* its a regular hostname with >= 3 segments */ if (SmartMasking) { /* * Pick up with temp from were we left off above. * Temp now points to the very last charater of userhost. * Go backwards, counting all the periods we encounter. * If we find 3 periods, make the hostmask: * *.seg1.seg2.seg3 * Since some users may have extremely long hostnames * because of some weird isp. Also, if they have * a second TLD, such as xx.xx.isp.com.au, this * routine will make their mask: *.isp.com.au, which * is much better than *.xx.isp.com.au */ cnt = 0; while ((*temp != '@') && (temp--)) { if (*temp == '.') if (++cnt >= 3) break; } if (cnt >= 3) { /* * We have a hostname with more than 3 segments. * Set topsegment to temp, so the final mask * will be *user@*.seg1.seg2.seg3 */ topsegment = temp; } } /* if (SmartMasking) */ /* * topsegment doesn't necessarily point to the TLD. * It simply points one segment further than realhost. * Check if there is another period in topsegment, * and if so use it. Otherwise use realhost */ ircsprintf(final + ii, "*%s", strchr(topsegment + 1, '.') ? topsegment : realhost); } } return (final); }
true
true
false
false
true
1
pack_bang(t_pack *x) { int i, reentered = 0, size = x->x_n * sizeof (t_atom); t_gpointer *gp; t_atom *outvec; for (i = x->x_nptr, gp = x->x_gpointer; i--; gp++) if (!gpointer_check(gp, 1)) { pd_error(x, "pack: stale pointer"); return; } /* reentrancy protection. The first time through use the pre-allocated x_outvec; if we're reentered we have to allocate new memory. */ if (!x->x_outvec) { /* LATER figure out how to deal with reentrancy and pointers... */ if (x->x_nptr) post("pack_bang: warning: reentry with pointers unprotected"); outvec = t_getbytes(size); reentered = 1; } else { outvec = x->x_outvec; x->x_outvec = 0; } memcpy(outvec, x->x_vec, size); outlet_list(x->x_obj.ob_outlet, &s_list, x->x_n, outvec); if (reentered) t_freebytes(outvec, size); else x->x_outvec = outvec; }
false
true
false
false
false
1
git_repository_head_tree(git_tree **tree, git_repository *repo) { git_oid head_oid; git_object *obj = NULL; if (git_reference_name_to_oid(&head_oid, repo, GIT_HEAD_FILE) < 0) { /* cannot resolve HEAD - probably brand new repo */ giterr_clear(); *tree = NULL; return 0; } if (git_object_lookup(&obj, repo, &head_oid, GIT_OBJ_ANY) < 0 || git_object__resolve_to_type(&obj, GIT_OBJ_TREE) < 0) return -1; *tree = (git_tree *)obj; return 0; }
false
false
false
false
false
0
ShiftInt(const char cop, const Token* left, const Token* right) { if (cop == '&' || cop == '|' || cop == '^') return MathLib::calculate(left->str(), right->str(), cop); const MathLib::bigint leftInt = MathLib::toLongNumber(left->str()); const MathLib::bigint rightInt = MathLib::toLongNumber(right->str()); const bool rightIntIsPositive = rightInt >= 0; if (cop == '<') { const bool leftOperationIsNotLeftShift = left->previous()->str() != "<<"; const bool operandIsLeftShift = right->previous()->str() == "<<"; // Ensure that its not a shift operator as used for streams if (leftOperationIsNotLeftShift && operandIsLeftShift && rightIntIsPositive) { const bool leftIntIsPositive = leftInt >= 0; if (!leftIntIsPositive) { // In case the left integer is negative, e.g. -1000 << 16. Do not simplify. return left->str() + " << " + right->str(); } return MathLib::toString(leftInt << rightInt); } } else if (rightIntIsPositive) { return MathLib::toString(leftInt >> rightInt); } return ""; }
false
false
false
false
false
0
on_profile_changed (GMAudioProfile *profile, const GMAudioSettingMask *mask, GMAudioProfileEdit *dialog) { if (mask->name) gm_audio_profile_edit_update_name (dialog, profile); if (mask->description) gm_audio_profile_edit_update_description (dialog, profile); if (mask->pipeline) gm_audio_profile_edit_update_pipeline (dialog, profile); if (mask->extension) gm_audio_profile_edit_update_extension (dialog, profile); if (mask->active) gm_audio_profile_edit_update_active (dialog, profile); }
false
false
false
false
false
0
sge_c_gdi_copy(sge_gdi_ctx_class_t *ctx, gdi_object_t *ao, sge_gdi_packet_class_t *packet, sge_gdi_task_class_t *task, int sub_command, monitoring_t *monitor) { lListElem *ep = NULL; object_description *object_base = object_type_get_object_description(); DENTER(TOP_LAYER, "sge_c_gdi_copy"); if (!packet->host || !packet->user || !packet->commproc) { CRITICAL((SGE_EVENT, MSG_SGETEXT_NULLPTRPASSED_S, SGE_FUNC)); answer_list_add(&(task->answer_list), SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR); DEXIT; return; } if (sge_chck_mod_perm_user(&(task->answer_list), task->target, packet->user, monitor)) { DEXIT; return; } if (sge_chck_mod_perm_host(&(task->answer_list), task->target, packet->host, packet->commproc, 0, NULL, monitor, object_base)) { DEXIT; return; } for_each (ep, task->data_list) { switch (task->target) { case SGE_JB_LIST: /* gdi_copy_job uses the global lock internal */ sge_gdi_copy_job(ctx, ep, &(task->answer_list), (sub_command & SGE_GDI_RETURN_NEW_VERSION) ? &(task->answer_list) : NULL, packet->user, packet->host, packet->uid, packet->gid, packet->group, packet, task, monitor); break; default: SGE_ADD_MSG_ID( sprintf(SGE_EVENT, MSG_SGETEXT_OPNOIMPFORTARGET)); answer_list_add(&(task->answer_list), SGE_EVENT, STATUS_ENOIMP, ANSWER_QUALITY_ERROR); break; } } DEXIT; return; }
false
false
false
false
false
0
saveMargins() { // open the stream ofstream outStream("margins.txt"); // for each example for (int i = 0; i < _margins.size(); ++i) { //outStream << _weights[i+1]-_weights[i] << " "; for (int j = 0; j < _margins[i].size(); ++j ) { outStream << _margins[i][j] << " "; } outStream << endl; } outStream.close(); }
false
false
false
false
false
0
click_hook_get_all_packages_for_user (ClickHook* self, const gchar* user_name, ClickUser* user_db, GError** error) { GeeArrayList* result = NULL; GeeArrayList* ret = NULL; GeeArrayList* _tmp0_ = NULL; GList* _tmp1_ = NULL; ClickUser* _tmp2_ = NULL; GList* _tmp3_ = NULL; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (user_name != NULL, NULL); g_return_val_if_fail (user_db != NULL, NULL); _tmp0_ = gee_array_list_new (CLICK_TYPE_UNPACKED_PACKAGE, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL); ret = _tmp0_; _tmp2_ = user_db; _tmp3_ = click_user_get_package_names (_tmp2_, &_inner_error_); _tmp1_ = _tmp3_; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_object_unref0 (ret); return NULL; } { GList* package_collection = NULL; GList* package_it = NULL; package_collection = _tmp1_; for (package_it = package_collection; package_it != NULL; package_it = package_it->next) { gchar* _tmp4_ = NULL; gchar* package = NULL; _tmp4_ = g_strdup ((const gchar*) package_it->data); package = _tmp4_; { gchar* _tmp5_ = NULL; ClickUser* _tmp6_ = NULL; const gchar* _tmp7_ = NULL; gchar* _tmp8_ = NULL; GeeArrayList* _tmp9_ = NULL; const gchar* _tmp10_ = NULL; gchar* _tmp11_ = NULL; const gchar* _tmp12_ = NULL; ClickUnpackedPackage* _tmp13_ = NULL; ClickUnpackedPackage* _tmp14_ = NULL; _tmp6_ = user_db; _tmp7_ = package; _tmp8_ = click_user_get_version (_tmp6_, _tmp7_, &_inner_error_); _tmp5_ = _tmp8_; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _g_free0 (package); __g_list_free__g_free0_0 (package_collection); _g_object_unref0 (ret); return NULL; } _tmp9_ = ret; _tmp10_ = package; _tmp11_ = _tmp5_; _tmp12_ = user_name; _tmp13_ = click_unpacked_package_new (_tmp10_, _tmp11_, _tmp12_); _tmp14_ = _tmp13_; gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp14_); _g_object_unref0 (_tmp14_); _g_free0 (_tmp11_); _g_free0 (package); } } __g_list_free__g_free0_0 (package_collection); } result = ret; return result; }
false
false
false
false
false
0
virtual_server_free(virtual_server_t *server) { if (!server) return; if (server->components) rbtree_free(server->components); server->components = NULL; free(server); }
false
false
false
false
false
0
ttp_open_port(ttp_session_t *session) { struct sockaddr *address; int status; u_int16_t port; u_char ipv6_yn = session->parameter->ipv6_yn; /* create the address structure */ session->transfer.udp_length = ipv6_yn ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); address = (struct sockaddr *) malloc(session->transfer.udp_length); if (address == NULL) error("Could not allocate space for UDP socket address"); /* prepare the UDP address structure, minus the UDP port number */ getpeername(session->client_fd, address, &(session->transfer.udp_length)); /* read in the port number from the client */ status = full_read(session->client_fd, &port, 2); if (status < 0) return warn("Could not read UDP port number"); if (ipv6_yn) ((struct sockaddr_in6 *) address)->sin6_port = port; else ((struct sockaddr_in *) address)->sin_port = port; /* print out the port number */ if (session->parameter->verbose_yn) printf("Sending to client port %d\n", ntohs(port)); /* open a new datagram socket */ session->transfer.udp_fd = create_udp_socket(session->parameter); if (session->transfer.udp_fd < 0) return warn("Could not create UDP socket"); /* we succeeded */ session->transfer.udp_address = address; return 0; }
false
false
false
true
true
1
ssl_init_defaults(Ssl_conf *c) { Ssl_conf *conf; if (c == NULL) conf = ALLOC(Ssl_conf); else conf = c; conf->ssl = NULL; conf->verbose_flag = 0; conf->verify_type = SSL_VERIFY_NONE; conf->verify_depth = 0; conf->verify_allow_self_signed = 0; conf->verify_error = X509_V_OK; conf->use_default_verify_paths = 0; conf->ca_cert_file = CA_CERT_FILE; conf->ca_cert_dir = CA_CERT_DIR; conf->cert_chain_file = NULL; conf->key_file = NULL; conf->key_file_type = SSL_FILETYPE_PEM; conf->cipher_list = DEFAULT_CIPHER_LIST; conf->rand_seed_file = DEFAULT_RAND_SEED_FILE; conf->peer_match_vec = NULL; conf->buffer_output = 0; return(conf); }
false
false
false
false
false
0
ccp_test(int unit, u_char *opt_ptr, int opt_len, int for_transmit) { struct ppp_option_data data; memset (&data, '\0', sizeof (data)); data.ptr = opt_ptr; data.length = opt_len; data.transmit = for_transmit; if (ioctl(ppp_dev_fd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) return 1; return (errno == ENOBUFS)? 0: -1; }
false
false
false
false
false
0
g2_gd_Save(int pid, void *pdp) { if (PDP->gd_type == g2_gd_png) gdImagePng(PDP->im,PDP->f); else if (PDP->gd_type == g2_gd_jpeg) gdImageJpeg(PDP->im,PDP->f,-1); #ifdef DO_GIF else if (PDP->gd_type == g2_gd_gif) gdImageGif(PDP->im,PDP->f); #endif fflush(PDP->f); rewind(PDP->f); return 0; }
false
false
false
false
false
0
ReplyLogPriority(int code) const { // Greeting messages if(code==220 || code==230) return 3; if(code==250 && mode==CHANGE_DIR) return 3; if(code==451 && mode==CLOSED) return 4; /* Most 5XXs go to level 4, as it's the job's responsibility to * print fatal errors. Some 5XXs are treated as 4XX's; send those * to level 0. (Maybe they should go to 1; we're going to retry them, * after all. */ if(is5XX(code)) return Transient5XX(code)? 0:4; if(is4XX(code)) return 0; // 221 is the reply to QUIT, but we don't expect it. if(code==221 && !conn->quit_sent) return 0; return 4; }
false
false
false
false
false
0
spellKey() { KGlobal::config()->reparseConfiguration(); KConfigGroup cg( KGlobal::config(), "K3Spell" ); QString key; key += QString::number( cg.readEntry( "K3Spell_NoRootAffix", QVariant(0 )).toInt()); key += '/'; key += QString::number( cg.readEntry( "K3Spell_RunTogether", QVariant(0 )).toInt()); key += '/'; key += cg.readEntry( "K3Spell_Dictionary", "" ); key += '/'; key += QString::number( cg.readEntry( "K3Spell_DictFromList", QVariant(false )).toInt()); key += '/'; key += QString::number( cg.readEntry( "K3Spell_Encoding", QVariant(KS_E_ASCII )).toInt()); key += '/'; key += QString::number( cg.readEntry( "K3Spell_Client", QVariant(KS_CLIENT_ISPELL )).toInt()); return key; }
false
false
false
false
false
0
iwl_alive_start(struct iwl_priv *priv) { int ret = 0; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); /* After the ALIVE response, we can send host commands to the uCode */ set_bit(STATUS_ALIVE, &priv->status); if (iwl_is_rfkill(priv)) return -ERFKILL; if (priv->event_log.ucode_trace) { /* start collecting data now */ mod_timer(&priv->ucode_trace, jiffies); } /* download priority table before any calibration request */ if (priv->lib->bt_params && priv->lib->bt_params->advanced_bt_coexist) { /* Configure Bluetooth device coexistence support */ if (priv->lib->bt_params->bt_sco_disable) priv->bt_enable_pspoll = false; else priv->bt_enable_pspoll = true; priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; iwlagn_send_advance_bt_config(priv); priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS; priv->cur_rssi_ctx = NULL; iwl_send_prio_tbl(priv); /* FIXME: w/a to force change uCode BT state machine */ ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN, BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); if (ret) return ret; ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE, BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); if (ret) return ret; } else if (priv->lib->bt_params) { /* * default is 2-wire BT coexexistence support */ iwl_send_bt_config(priv); } /* * Perform runtime calibrations, including DC calibration. */ iwlagn_send_calib_cfg_rt(priv, IWL_CALIB_CFG_DC_IDX); ieee80211_wake_queues(priv->hw); /* Configure Tx antenna selection based on H/W config */ iwlagn_send_tx_ant_config(priv, priv->nvm_data->valid_tx_ant); if (iwl_is_associated_ctx(ctx) && !priv->wowlan) { struct iwl_rxon_cmd *active_rxon = (struct iwl_rxon_cmd *)&ctx->active; /* apply any changes in staging */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { struct iwl_rxon_context *tmp; /* Initialize our rx_config data */ for_each_context(priv, tmp) iwl_connection_init_rx_config(priv, tmp); iwlagn_set_rxon_chain(priv, ctx); } if (!priv->wowlan) { /* WoWLAN ucode will not reply in the same way, skip it */ iwl_reset_run_time_calib(priv); } set_bit(STATUS_READY, &priv->status); /* Configure the adapter for unassociated operation */ ret = iwlagn_commit_rxon(priv, ctx); if (ret) return ret; /* At this point, the NIC is initialized and operational */ iwl_rf_kill_ct_config(priv); IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); return iwl_power_update_mode(priv, true); }
false
false
false
false
false
0
esl_hmm_Emit(ESL_RANDOMNESS *r, const ESL_HMM *hmm, ESL_DSQ **opt_dsq, int **opt_path, int *opt_L) { int k, L, allocL; int *path = NULL; ESL_DSQ *dsq = NULL; void *tmp = NULL; int status; ESL_ALLOC(dsq, sizeof(ESL_DSQ) * 256); ESL_ALLOC(path, sizeof(int) * 256); allocL = 256; dsq[0] = eslDSQ_SENTINEL; path[0] = -1; k = esl_rnd_FChoose(r, hmm->pi, hmm->M+1); L = 0; while (k != hmm->M) /* M is the implicit end state */ { L++; if (L >= allocL-1) { /* Reallocate path and seq if needed */ ESL_RALLOC(dsq, tmp, sizeof(ESL_DSQ) * (allocL*2)); ESL_RALLOC(path, tmp, sizeof(int) * (allocL*2)); allocL *= 2; } path[L] = k; dsq[L] = esl_rnd_FChoose(r, hmm->e[k], hmm->abc->K); k = esl_rnd_FChoose(r, hmm->t[k], hmm->M+1); } path[L+1] = hmm->M; /* sentinel for "end state" */ dsq[L+1] = eslDSQ_SENTINEL; if (opt_dsq != NULL) *opt_dsq = dsq; else free(dsq); if (opt_path != NULL) *opt_path = path; else free(path); if (opt_L != NULL) *opt_L = L; return eslOK; ERROR: if (path != NULL) free(path); if (dsq != NULL) free(dsq); return status; }
false
true
false
false
false
1
caml_sha1_final(value ctx) { CAMLparam1(ctx); CAMLlocal1(res); res = alloc_string(20); SHA1_finish(Context_val(ctx), &Byte_u(res, 0)); CAMLreturn(res); }
false
false
false
false
false
0
leaf_interpret(string_list_ty *result, const string_list_ty *args, const expr_position_ty *pp, const opcode_context_ty *ocp) { trace(("leaf_files\n")); assert(result); assert(args); assert(args->nstrings); if (args->nstrings != 1) { sub_context_ty *scp; scp = sub_context_new(); sub_var_set_string(scp, "Name", args->string[0]); error_with_position(pp, scp, i18n("$name: requires no arguments")); sub_context_delete(scp); return -1; } /* * Only meaningful *inside* a recipe body. */ if (!ocp->gp) { sub_context_ty *scp; scp = sub_context_new(); sub_var_set_string(scp, "Name", args->string[0]); error_with_position ( pp, scp, i18n("$name: only meaningful inside recipe body") ); sub_context_delete(scp); return -1; } /* * ask for the info */ graph_leaf_files(ocp->gp, result); return 0; }
false
false
false
false
false
0
s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev) { int ret; unsigned int val, state; struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); int rdev_id = rdev_get_id(rdev); /* Below LDO should be always on or does not support suspend mode. */ switch (s2mps11->dev_type) { case S2MPS13X: case S2MPS14X: switch (rdev_id) { case S2MPS14_LDO3: return 0; default: state = S2MPS14_ENABLE_SUSPEND; break; } break; case S2MPU02: switch (rdev_id) { case S2MPU02_LDO13: case S2MPU02_LDO14: case S2MPU02_LDO15: case S2MPU02_LDO17: case S2MPU02_BUCK7: state = S2MPU02_DISABLE_SUSPEND; break; default: state = S2MPU02_ENABLE_SUSPEND; break; } break; default: return -EINVAL; } ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val); if (ret < 0) return ret; set_bit(rdev_get_id(rdev), s2mps11->suspend_state); /* * Don't enable suspend mode if regulator is already disabled because * this would effectively for a short time turn on the regulator after * resuming. * However we still want to toggle the suspend_state bit for regulator * in case if it got enabled before suspending the system. */ if (!(val & rdev->desc->enable_mask)) return 0; return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask, state); }
false
false
false
false
false
0
bnx2x_sfp_module_detection(struct bnx2x_phy *phy, struct link_params *params) { struct bnx2x *bp = params->bp; u16 edc_mode; int rc = 0; u32 val = REG_RD(bp, params->shmem_base + offsetof(struct shmem_region, dev_info. port_feature_config[params->port].config)); /* Enabled transmitter by default */ bnx2x_sfp_set_transmitter(params, phy, 1); DP(NETIF_MSG_LINK, "SFP+ module plugged in/out detected on port %d\n", params->port); /* Power up module */ bnx2x_power_sfp_module(params, phy, 1); if (bnx2x_get_edc_mode(phy, params, &edc_mode) != 0) { DP(NETIF_MSG_LINK, "Failed to get valid module type\n"); return -EINVAL; } else if (bnx2x_verify_sfp_module(phy, params) != 0) { /* Check SFP+ module compatibility */ DP(NETIF_MSG_LINK, "Module verification failed!!\n"); rc = -EINVAL; /* Turn on fault module-detected led */ bnx2x_set_sfp_module_fault_led(params, MISC_REGISTERS_GPIO_HIGH); /* Check if need to power down the SFP+ module */ if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN) { DP(NETIF_MSG_LINK, "Shutdown SFP+ module!!\n"); bnx2x_power_sfp_module(params, phy, 0); return rc; } } else { /* Turn off fault module-detected led */ bnx2x_set_sfp_module_fault_led(params, MISC_REGISTERS_GPIO_LOW); } /* Check and set limiting mode / LRM mode on 8726. On 8727 it * is done automatically */ bnx2x_set_limiting_mode(params, phy, edc_mode); /* Disable transmit for this module if the module is not approved, and * laser needs to be disabled. */ if ((rc) && ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER)) bnx2x_sfp_set_transmitter(params, phy, 0); return rc; }
false
false
false
false
false
0
GetCursorData(double xyzv[4]) { if ( this->State != vtkImagePlaneWidget::Cursoring || \ this->CurrentImageValue == VTK_DOUBLE_MAX ) { return 0; } xyzv[0] = this->CurrentCursorPosition[0]; xyzv[1] = this->CurrentCursorPosition[1]; xyzv[2] = this->CurrentCursorPosition[2]; xyzv[3] = this->CurrentImageValue; return 1; }
false
false
false
false
false
0
_test_unicode_properties_nil (hb_unicode_funcs_t *uf) { unsigned int i, j; for (i = 0; i < G_N_ELEMENTS (properties); i++) { const property_t *p = &properties[i]; const test_pair_t *tests; g_test_message ("Testing property %s", p->name); tests = p->tests; for (j = 0; j < p->num_tests; j++) { g_test_message ("Test %s #%d: U+%04X", p->name, j, tests[j].unicode); g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode)); } tests = p->tests_more; for (j = 0; j < p->num_tests_more; j++) { g_test_message ("Test %s more #%d: U+%04X", p->name, j, tests[j].unicode); g_assert_cmphex (p->getter (uf, tests[j].unicode), ==, default_value (p->default_value, tests[j].unicode)); } } }
false
false
false
false
false
0
SearchDebugFile(DebugFileList &list) { DIR *path; struct dirent *entry; path = opendir("."); while( (entry = readdir(path)) ) { int offset; if (strlen(entry->d_name) < strlen(DEBUG_FILE_EXT)) continue; offset = strlen(entry->d_name) - strlen(DEBUG_FILE_EXT); if (!strcmp(entry->d_name + offset, DEBUG_FILE_EXT)) { ifstream file(entry->d_name); CodInfo info; // Parse header section info.ParseHeaderSection(file); // Add element to list list.AddElement(info.GetUniqueId(), info.GetAppName(), entry->d_name); } } closedir(path); }
false
false
false
false
false
0
s2io_rldram_test(struct s2io_nic *sp, uint64_t *data) { struct XENA_dev_config __iomem *bar0 = sp->bar0; u64 val64; int cnt, iteration = 0, test_fail = 0; val64 = readq(&bar0->adapter_control); val64 &= ~ADAPTER_ECC_EN; writeq(val64, &bar0->adapter_control); val64 = readq(&bar0->mc_rldram_test_ctrl); val64 |= MC_RLDRAM_TEST_MODE; SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); val64 = readq(&bar0->mc_rldram_mrs); val64 |= MC_RLDRAM_QUEUE_SIZE_ENABLE; SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_mrs, UF); val64 |= MC_RLDRAM_MRS_ENABLE; SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_mrs, UF); while (iteration < 2) { val64 = 0x55555555aaaa0000ULL; if (iteration == 1) val64 ^= 0xFFFFFFFFFFFF0000ULL; writeq(val64, &bar0->mc_rldram_test_d0); val64 = 0xaaaa5a5555550000ULL; if (iteration == 1) val64 ^= 0xFFFFFFFFFFFF0000ULL; writeq(val64, &bar0->mc_rldram_test_d1); val64 = 0x55aaaaaaaa5a0000ULL; if (iteration == 1) val64 ^= 0xFFFFFFFFFFFF0000ULL; writeq(val64, &bar0->mc_rldram_test_d2); val64 = (u64) (0x0000003ffffe0100ULL); writeq(val64, &bar0->mc_rldram_test_add); val64 = MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_WRITE | MC_RLDRAM_TEST_GO; SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); for (cnt = 0; cnt < 5; cnt++) { val64 = readq(&bar0->mc_rldram_test_ctrl); if (val64 & MC_RLDRAM_TEST_DONE) break; msleep(200); } if (cnt == 5) break; val64 = MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_GO; SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); for (cnt = 0; cnt < 5; cnt++) { val64 = readq(&bar0->mc_rldram_test_ctrl); if (val64 & MC_RLDRAM_TEST_DONE) break; msleep(500); } if (cnt == 5) break; val64 = readq(&bar0->mc_rldram_test_ctrl); if (!(val64 & MC_RLDRAM_TEST_PASS)) test_fail = 1; iteration++; } *data = test_fail; /* Bring the adapter out of test mode */ SPECIAL_REG_WRITE(0, &bar0->mc_rldram_test_ctrl, LF); return test_fail; }
false
false
false
false
false
0
get_loop_level (const struct loop *loop) { const struct loop *ploop; unsigned mx = 0, l; for (ploop = loop->inner; ploop; ploop = ploop->next) { l = get_loop_level (ploop); if (l >= mx) mx = l + 1; } return mx; }
false
false
false
false
false
0