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
edflib_fprint_ll_number_nonlocalized(FILE *file, long long q, int minimum, int sign) { int flag=0, z, i, j=0; long long base = 1000000000000000000LL; if(minimum < 0) { minimum = 0; } if(minimum > 18) { flag = 1; } if(q < 0LL) { fputc('-', file); j++; q = -q; } else { if(sign) { fputc('+', file); j++; } } for(i=19; i; i--) { if(minimum == i) { flag = 1; } z = q / base; q %= base; if(z || flag) { fputc('0' + z, file); j++; flag = 1; } base /= 10LL; } if(!flag) { fputc('0', file); j++; } return(j); }
false
false
false
false
false
0
_dbd_result_set_numfields(dbi_result_t *result, unsigned int numfields) { result->numfields = numfields; if (numfields > 0) { result->field_names = calloc(numfields, sizeof(char *)); result->field_types = calloc(numfields, sizeof(unsigned short)); result->field_attribs = calloc(numfields, sizeof(unsigned int *)); } }
false
false
false
false
true
1
playerTakeTurn(KSquaresPlayer* currentPlayer) { statusBar()->changeItem(currentPlayer->name(), 0); QTimer::singleShot(200, this, SLOT(aiChooseLine())); }
false
false
false
false
false
0
handle_UPROC(struct ptype_action_args *parg) { /* * /UPROC-packet, user-profile-request, if we want to and have an * answer, do it. */ parg->connec->flags.last_data_active = true; logg_packet_old(STDSF, "/UPROC"); if(likely(server.settings.profile.want_2_send && server.settings.profile.xml && server.settings.profile.xml_length && server.settings.profile.xml_length < server.settings.max_g2_packet_length - 10)) { g2_packet_t *uprod; g2_packet_t *xml; /* time to send a packet again? */ if(local_time_now < (parg->connec->u.handler.send_stamps.UPROC + (UPROC_TIMEOUT))) return false; uprod = g2_packet_calloc(); xml = g2_packet_calloc(); if(!(uprod && xml)) { g2_packet_free(uprod); g2_packet_free(xml); return false; } uprod->type = PT_UPROD; uprod->big_endian = HOST_IS_BIGENDIAN; list_add(&xml->list, &uprod->children); xml->type = PT_XML; xml->big_endian = HOST_IS_BIGENDIAN; xml->data_trunk.data = (void*)(intptr_t)server.settings.profile.xml; xml->data_trunk.capacity = server.settings.profile.xml_length; buffer_clear(xml->data_trunk); g2_packet_add2target(uprod, parg->target, parg->target_lock); parg->connec->u.handler.send_stamps.UPROC = local_time_now; return true; } return false; }
false
false
false
false
false
0
bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo) { struct bna_rxp *rxp; list_for_each_entry(rxp, &rx->rxp_q, qe) { rxp->cq.ccb->rx_coalescing_timeo = coalescing_timeo; bna_ib_coalescing_timeo_set(&rxp->cq.ib, coalescing_timeo); } }
false
false
false
false
false
0
anjuta_window_remove_value (AnjutaShell *shell, const char *name, GError **error) { AnjutaWindow *win; GValue *value; char *key; g_return_if_fail (ANJUTA_IS_WINDOW (shell)); g_return_if_fail (name != NULL); win = ANJUTA_WINDOW (shell); /* g_return_if_fail (win->values != NULL); if (win->widgets && g_hash_table_lookup_extended (win->widgets, name, (gpointer*)&key, (gpointer*)&w)) { GtkWidget *item; item = g_object_get_data (G_OBJECT (w), "dockitem"); gdl_dock_item_hide_item (GDL_DOCK_ITEM (item)); gdl_dock_object_unbind (GDL_DOCK_OBJECT (item)); g_free (key); } */ if (win->values && g_hash_table_lookup_extended (win->values, name, (gpointer)&key, (gpointer)&value)) { g_signal_emit_by_name (win, "value_removed", name); g_hash_table_remove (win->values, name); } }
false
false
false
false
false
0
process_smi_save_state_64(struct kvm_vcpu *vcpu, char *buf) { #ifdef CONFIG_X86_64 struct desc_ptr dt; struct kvm_segment seg; unsigned long val; int i; for (i = 0; i < 16; i++) put_smstate(u64, buf, 0x7ff8 - i * 8, kvm_register_read(vcpu, i)); put_smstate(u64, buf, 0x7f78, kvm_rip_read(vcpu)); put_smstate(u32, buf, 0x7f70, kvm_get_rflags(vcpu)); kvm_get_dr(vcpu, 6, &val); put_smstate(u64, buf, 0x7f68, val); kvm_get_dr(vcpu, 7, &val); put_smstate(u64, buf, 0x7f60, val); put_smstate(u64, buf, 0x7f58, kvm_read_cr0(vcpu)); put_smstate(u64, buf, 0x7f50, kvm_read_cr3(vcpu)); put_smstate(u64, buf, 0x7f48, kvm_read_cr4(vcpu)); put_smstate(u32, buf, 0x7f00, vcpu->arch.smbase); /* revision id */ put_smstate(u32, buf, 0x7efc, 0x00020064); put_smstate(u64, buf, 0x7ed0, vcpu->arch.efer); kvm_get_segment(vcpu, &seg, VCPU_SREG_TR); put_smstate(u16, buf, 0x7e90, seg.selector); put_smstate(u16, buf, 0x7e92, process_smi_get_segment_flags(&seg) >> 8); put_smstate(u32, buf, 0x7e94, seg.limit); put_smstate(u64, buf, 0x7e98, seg.base); kvm_x86_ops->get_idt(vcpu, &dt); put_smstate(u32, buf, 0x7e84, dt.size); put_smstate(u64, buf, 0x7e88, dt.address); kvm_get_segment(vcpu, &seg, VCPU_SREG_LDTR); put_smstate(u16, buf, 0x7e70, seg.selector); put_smstate(u16, buf, 0x7e72, process_smi_get_segment_flags(&seg) >> 8); put_smstate(u32, buf, 0x7e74, seg.limit); put_smstate(u64, buf, 0x7e78, seg.base); kvm_x86_ops->get_gdt(vcpu, &dt); put_smstate(u32, buf, 0x7e64, dt.size); put_smstate(u64, buf, 0x7e68, dt.address); for (i = 0; i < 6; i++) process_smi_save_seg_64(vcpu, buf, i); #else WARN_ON_ONCE(1); #endif }
false
false
false
false
false
0
ButtonEdit() { if ( gamemap->events.size() ) { MemoryStreamStorage buf; int marked = listbox->GetSelectedIndex(); if ( marked < 0 ) return false; GameMap::Events::iterator e = gamemap->events.begin(); for ( int t = 0; t < marked && e != gamemap->events.end(); t++ ) ++e; { MemoryStream stream ( &buf, tnstream::writing ); (*e)->write ( stream ); } if ( ! createevent( gamemap, *e ) ) { // cancel pressed, we are restoring the original event MemoryStream stream ( &buf, tnstream::reading ); (*e)->read ( stream ); } updateListbox(); return true; } else return false; }
false
false
false
false
false
0
GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) { struct hblk * h_trunc; /* Truncated to page boundary */ struct hblk * h_end; /* Page boundary following block end */ struct hblk * current; # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) return; # endif if (!GC_dirty_maintained) return; h_trunc = (struct hblk *)((word)h & ~(GC_page_size-1)); h_end = (struct hblk *)(((word)(h + nblocks) + GC_page_size-1) & ~(GC_page_size-1)); if (h_end == h_trunc + 1 && get_pht_entry_from_index(GC_dirty_pages, PHT_HASH(h_trunc))) { /* already marked dirty, and hence unprotected. */ return; } for (current = h_trunc; current < h_end; ++current) { size_t index = PHT_HASH(current); if (!is_ptrfree || current < h || current >= h + nblocks) { async_set_pht_entry_from_index(GC_dirty_pages, index); } } UNPROTECT(h_trunc, (ptr_t)h_end - (ptr_t)h_trunc); }
false
true
false
false
true
1
onKeyRelease(FXObject*,FXSelector sel,void* ptr){ FXEvent* event=(FXEvent*)ptr; if(!isEnabled()) return 0; FXTRACE((200,"%s::onKeyRelease %p keysym=0x%04x state=%04x\n",getClassName(),this,event->code,event->state)); if(pane && pane->shown() && pane->handle(pane,sel,ptr)) return 1; switch(event->code){ case KEY_Right: case KEY_Left: return 1; case KEY_KP_Enter: case KEY_Return: case KEY_space: case KEY_KP_Space: return 1; } return 0; }
false
false
false
false
false
0
e_cal_component_commit_sequence (ECalComponent *comp) { ECalComponentPrivate *priv; g_return_if_fail (comp != NULL); g_return_if_fail (E_IS_CAL_COMPONENT (comp)); priv = comp->priv; g_return_if_fail (priv->icalcomp != NULL); ensure_alarm_properties (comp); if (!priv->need_sequence_inc) return; if (priv->sequence) { gint seq; seq = icalproperty_get_sequence (priv->sequence); icalproperty_set_sequence (priv->sequence, seq + 1); } else { /* The component had no SEQUENCE property, so assume that the * default would have been zero. Since it needed incrementing * anyways, we use a value of 1 here. */ priv->sequence = icalproperty_new_sequence (1); icalcomponent_add_property (priv->icalcomp, priv->sequence); } priv->need_sequence_inc = FALSE; }
false
false
false
false
false
0
acpi_ac_remove_fs(struct acpi_ac *ac) { if (acpi_device_dir(ac->device)) { remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(ac->device)); remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir); acpi_device_dir(ac->device) = NULL; } return 0; }
false
false
false
false
false
0
sunionDiffGenericCommand(redisClient *c, robj **setskeys, int setsnum, robj *dstkey, int op) { dict **dv = zmalloc(sizeof(dict*)*setsnum); dictIterator *di; dictEntry *de; robj *dstset = NULL; int j, cardinality = 0; for (j = 0; j < setsnum; j++) { robj *setobj; setobj = dstkey ? lookupKeyWrite(c->db,setskeys[j]) : lookupKeyRead(c->db,setskeys[j]); if (!setobj) { dv[j] = NULL; continue; } if (setobj->type != REDIS_SET) { zfree(dv); addReply(c,shared.wrongtypeerr); return; } dv[j] = setobj->ptr; } /* We need a temp set object to store our union. If the dstkey * is not NULL (that is, we are inside an SUNIONSTORE operation) then * this set object will be the resulting object to set into the target key*/ dstset = createSetObject(); /* Iterate all the elements of all the sets, add every element a single * time to the result set */ for (j = 0; j < setsnum; j++) { if (op == REDIS_OP_DIFF && j == 0 && !dv[j]) break; /* result set is empty */ if (!dv[j]) continue; /* non existing keys are like empty sets */ di = dictGetIterator(dv[j]); while((de = dictNext(di)) != NULL) { robj *ele; /* dictAdd will not add the same element multiple times */ ele = dictGetEntryKey(de); if (op == REDIS_OP_UNION || j == 0) { if (dictAdd(dstset->ptr,ele,NULL) == DICT_OK) { incrRefCount(ele); cardinality++; } } else if (op == REDIS_OP_DIFF) { if (dictDelete(dstset->ptr,ele) == DICT_OK) { cardinality--; } } } dictReleaseIterator(di); if (op == REDIS_OP_DIFF && cardinality == 0) break; /* result set is empty */ } /* Output the content of the resulting set, if not in STORE mode */ if (!dstkey) { addReplySds(c,sdscatprintf(sdsempty(),"*%d\r\n",cardinality)); di = dictGetIterator(dstset->ptr); while((de = dictNext(di)) != NULL) { robj *ele; ele = dictGetEntryKey(de); addReplyBulkLen(c,ele); addReply(c,ele); addReply(c,shared.crlf); } dictReleaseIterator(di); } else { /* If we have a target key where to store the resulting set * create this key with the result set inside */ deleteKey(c->db,dstkey); dictAdd(c->db->dict,dstkey,dstset); incrRefCount(dstkey); } /* Cleanup */ if (!dstkey) { decrRefCount(dstset); } else { addReplySds(c,sdscatprintf(sdsempty(),":%d\r\n", dictSize((dict*)dstset->ptr))); server.dirty++; } zfree(dv); }
false
false
false
false
false
0
pipe_putc(char c) { if (G.pipeline.idx == G.pipeline.len) { G.pipeline.buf = xrealloc(G.pipeline.buf, G.pipeline.len + PIPE_GROW); G.pipeline.len += PIPE_GROW; } G.pipeline.buf[G.pipeline.idx++] = c; }
false
false
false
false
false
0
OnAttach() { if(!Manager::LoadResource(_T("autosave.zip"))) { NotifyMissingFile(_T("autosave.zip")); } timer1 = new wxTimer(this, 10000); timer2 = new wxTimer(this, 20000); Start(); }
false
false
false
false
false
0
ToCIF() { char *s; char CIFFile[81]; int Layer; int Layers[CDNUMLAYERS+1]; MenuSelect(MenuTOCIF); ShowPrompt("CIF file name? "); strcpy(CIFFile,Parameters.kpCellName); if ((s = strchr(CIFFile,'.')) != NULL) *s = '\0'; strcat(CIFFile,".cif"); s = FBEdit(CIFFile); if (s != NULL) { if (*s != '\0' && *s != '\n') strcpy(CIFFile,s); if (!access(CIFFile,0)) if (clobber_check(False)) return; for (Layer = 0; Layer <= NumLayerTable; Layer++) Layers[Layer] = True; if (!CDFrom(Parameters.kpCellName,CIFFile,RESOLUTION,RESOLUTION, Layers,NumLayerTable+1,'k')) { sprintf(TypeOut,"Translation of %s failed. MORE", Parameters.kpCellName); OutPrompt(TypeOut); (void)FBGetchar(ERASE); OutPrompt(CDStatusString); } else { sprintf(TypeOut,"Translation of %s succeeded.", Parameters.kpCellName); OutPrompt(TypeOut); } } MenuDeselect(MenuTOCIF); }
false
false
false
false
false
0
soup_cookie_jar_get_cookies (SoupCookieJar *jar, SoupURI *uri, gboolean for_http) { GSList *cookies; g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), NULL); g_return_val_if_fail (uri != NULL, NULL); cookies = get_cookies (jar, uri, for_http, FALSE); if (cookies) { char *result = soup_cookies_to_cookie_header (cookies); g_slist_free (cookies); if (!*result) { g_free (result); result = NULL; } return result; } else return NULL; }
false
false
false
false
false
0
getIconFileName( int numerical ) { switch ( numerical ) { case cwcruisemissile: return "weap-cruisemissile"; case cwbombn: return "weap-bomb"; case cwlargemissilen: return "weap-bigmissile"; case cwsmallmissilen: return "weap-smallmissile"; case cwtorpedon: return "weap-torpedo"; case cwmachinegunn: return "weap-machinegun"; case cwcannonn: return "weap-cannon"; case cwminen: return "weap-mine"; case cwservicen: return "weap-service"; case cwlasern: return "weap-laser"; default: return "weap-undefined"; }; }
false
false
false
false
false
0
v4l2_of_parse_csi_bus(const struct device_node *node, struct v4l2_of_endpoint *endpoint) { struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2; struct property *prop; bool have_clk_lane = false; unsigned int flags = 0; u32 v; prop = of_find_property(node, "data-lanes", NULL); if (prop) { const __be32 *lane = NULL; unsigned int i; for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) { lane = of_prop_next_u32(prop, lane, &v); if (!lane) break; bus->data_lanes[i] = v; } bus->num_data_lanes = i; } prop = of_find_property(node, "lane-polarities", NULL); if (prop) { const __be32 *polarity = NULL; unsigned int i; for (i = 0; i < ARRAY_SIZE(bus->lane_polarities); i++) { polarity = of_prop_next_u32(prop, polarity, &v); if (!polarity) break; bus->lane_polarities[i] = v; } if (i < 1 + bus->num_data_lanes /* clock + data */) { pr_warn("%s: too few lane-polarities entries (need %u, got %u)\n", node->full_name, 1 + bus->num_data_lanes, i); return -EINVAL; } } if (!of_property_read_u32(node, "clock-lanes", &v)) { bus->clock_lane = v; have_clk_lane = true; } if (of_get_property(node, "clock-noncontinuous", &v)) flags |= V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK; else if (have_clk_lane || bus->num_data_lanes > 0) flags |= V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; bus->flags = flags; endpoint->bus_type = V4L2_MBUS_CSI2; return 0; }
false
false
false
false
false
0
fopen1(char *name, char *flag) { FILE *fp; if (!(fp = fopen(name, flag))) { fprintf(stdout, "\n"); fprintf(stdout, " ******************************************************\n"); fprintf(stdout, " You chose a moving window or sampling units analysis \n"); fprintf(stdout, " but r.le.pixel can't find file \"%s\" \n", name); fprintf(stdout, " which defines the moving window or sampling units \n"); fprintf(stdout, " First use r.le.setup for to setup a moving window or \n"); fprintf(stdout, " sampling units to make this file \n"); fprintf(stdout, " ******************************************************\n"); exit(1); } return fp; }
false
false
false
false
false
0
crypto_check_alg(struct crypto_alg *alg) { crypto_check_module_sig(alg->cra_module); if (alg->cra_alignmask & (alg->cra_alignmask + 1)) return -EINVAL; if (alg->cra_blocksize > PAGE_SIZE / 8) return -EINVAL; if (alg->cra_priority < 0) return -EINVAL; atomic_set(&alg->cra_refcnt, 1); return crypto_set_driver_name(alg); }
false
false
false
false
false
0
callInclude( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &args ) { Q_UNUSED(self); if( args.size() == 1) { KJS::UString filename = args[0]->toString(exec); qDebug() << "include: " << toQString(filename); KJS::Completion c = Engine::runFile( exec->dynamicInterpreter(), filename ); if ( c.complType() == KJS::Normal ) return KJS::jsNull(); if (c.complType() == KJS::ReturnValue) { if (c.isValueCompletion()) return c.value(); return KJS::jsNull(); } if (c.complType() == KJS::Throw) { QString message = toQString(c.value()->toString(exec)); int line = c.value()->toObject(exec)->get(exec, "line")->toUInt32(exec); return throwError(exec, KJS::EvalError, toUString(i18n("Error encountered while processing include '%1' line %2: %3", toQString(filename), line, message))); } } else { return throwError(exec, KJS::URIError, toUString(i18n("include only takes 1 argument, not %1.", args.size()))); } return KJS::jsNull(); }
false
false
false
false
false
0
_cpufreq_event_cb_powersave(void *data __UNUSED__, int type, void *event) { E_Event_Powersave_Update *ev; Eina_List *l; Eina_Bool has_powersave = EINA_FALSE; Eina_Bool has_conservative = EINA_FALSE; if (type != E_EVENT_POWERSAVE_UPDATE) return ECORE_CALLBACK_PASS_ON; if (!cpufreq_config->auto_powersave) return ECORE_CALLBACK_PASS_ON; ev = event; if (!cpufreq_config->status->orig_governor) cpufreq_config->status->orig_governor = eina_stringshare_add(cpufreq_config->status->cur_governor); for (l = cpufreq_config->status->governors; l; l = l->next) { if (!strcmp(l->data, "conservative")) has_conservative = EINA_TRUE; else if (!strcmp(l->data, "powersave")) has_powersave = EINA_TRUE; else if (!strcmp(l->data, "interactive")) has_powersave = EINA_TRUE; } switch (ev->mode) { case E_POWERSAVE_MODE_NONE: case E_POWERSAVE_MODE_LOW: _cpufreq_set_governor(cpufreq_config->status->orig_governor); eina_stringshare_del(cpufreq_config->status->orig_governor); cpufreq_config->status->orig_governor = NULL; break; case E_POWERSAVE_MODE_MEDIUM: case E_POWERSAVE_MODE_HIGH: if ((cpufreq_config->powersave_governor) || (has_conservative)) { if (cpufreq_config->powersave_governor) _cpufreq_set_governor(cpufreq_config->powersave_governor); else _cpufreq_set_governor("conservative"); break; } case E_POWERSAVE_MODE_EXTREME: if (has_powersave) _cpufreq_set_governor("powersave"); break; } return ECORE_CALLBACK_PASS_ON; }
false
false
false
false
false
0
emit_body(struct basic_block *bb, struct buffer *buf) { struct insn *insn; bb->mach_offset = buffer_offset(buf); bb->is_emitted = true; for_each_insn(insn, &bb->insn_list) { emit_insn(buf, bb, insn); } if (opt_trace_machine_code) emit_nop(buf); }
false
false
false
false
false
0
sock_s_gethostbyaddr(int argc, VALUE *argv) { VALUE addr, family; struct hostent *h; char **pch; VALUE ary, names; int t = AF_INET; rb_scan_args(argc, argv, "11", &addr, &family); StringValue(addr); if (!NIL_P(family)) { t = rsock_family_arg(family); } #ifdef AF_INET6 else if (RSTRING_LEN(addr) == 16) { t = AF_INET6; } #endif h = gethostbyaddr(RSTRING_PTR(addr), RSTRING_LENINT(addr), t); if (h == NULL) { #ifdef HAVE_HSTRERROR extern int h_errno; rb_raise(rb_eSocket, "%s", (char*)hstrerror(h_errno)); #else rb_raise(rb_eSocket, "host not found"); #endif } ary = rb_ary_new(); rb_ary_push(ary, rb_str_new2(h->h_name)); names = rb_ary_new(); rb_ary_push(ary, names); if (h->h_aliases != NULL) { for (pch = h->h_aliases; *pch; pch++) { rb_ary_push(names, rb_str_new2(*pch)); } } rb_ary_push(ary, INT2NUM(h->h_addrtype)); #ifdef h_addr for (pch = h->h_addr_list; *pch; pch++) { rb_ary_push(ary, rb_str_new(*pch, h->h_length)); } #else rb_ary_push(ary, rb_str_new(h->h_addr, h->h_length)); #endif return ary; }
false
false
false
false
false
0
PrintInfo ( Stat stat ) { UInt i; /* loop variable */ /* print the keyword */ Pr("%2>Info",0L,0L); /* print the opening parenthesis */ Pr("%<( %>",0L,0L); /* print the expressions that evaluate to the actual arguments */ for ( i = 1; i <= NARG_SIZE_INFO( SIZE_STAT(stat) ); i++ ) { PrintExpr( ARGI_INFO(stat,i) ); if ( i != NARG_SIZE_INFO( SIZE_STAT(stat) ) ) { Pr("%<, %>",0L,0L); } } /* print the closing parenthesis */ Pr(" %2<);",0L,0L); }
false
false
false
false
false
0
GVA_get_next_frame(t_GVA_Handle *gvahand) { t_GVA_RetCode l_rc; if(gap_debug) { printf("GVA_get_next_frame: START handle:%d\n", (int)gvahand); } l_rc = p_gva_worker_get_next_frame(gvahand); if(gap_debug) { printf("GVA_get_next_frame: END rc:%d\n", (int)l_rc); } return(l_rc); }
false
false
false
false
false
0
internal_oscode_find_keyboard(unsigned oscode) { const struct KeyboardInfo *keyinfo; keyinfo = osd_get_key_list(); while (keyinfo->name) { if (keyinfo->code == oscode) return keyinfo; ++keyinfo; } return 0; }
false
false
false
false
false
0
equinox_draw_scrollbar_trough (cairo_t * cr, const EquinoxColors * colors, const WidgetParameters * widget, const ScrollBarParameters * scrollbar, int x, int y, int width, int height, int scrollbarstyle, int scrollbartrough) { EquinoxRGB bg; EquinoxRGB shadow, highlight; cairo_pattern_t *pattern; if (scrollbar->horizontal) { int tmp = height; rotate_mirror_translate (cr, M_PI / 2, x, y, FALSE, FALSE); height = width; width = tmp; } else cairo_translate (cr, x, y); if (scrollbartrough == 1) { bg = colors->base[GTK_STATE_NORMAL]; } else { bg = widget->parentbg; } if (scrollbarstyle == 4) { equinox_rectangle (cr, EQX_CAIRO_FILL, 0, 0, width, height, &bg, 1.0); } else { equinox_shade (&bg, &shadow, 0.92); equinox_shade (&bg, &highlight, 1.0); equinox_shade (&bg, &bg, 0.98); pattern = cairo_pattern_create_linear (0, 0, width, 0); equinox_pattern_add_color_rgb (pattern, 0.0, &shadow); equinox_pattern_add_color_rgb (pattern, 0.22, &bg); equinox_pattern_add_color_rgb (pattern, 0.55, &highlight); equinox_pattern_add_color_rgb (pattern, 0.82, &bg); equinox_pattern_add_color_rgb (pattern, 1.0, &shadow); equinox_rectangle_gradient (cr, EQX_CAIRO_FILL, 0, 0, width, height, pattern); } }
false
false
false
false
false
0
pf_capture_pkt_handler(netio_desc_t *nio,void *pkt,size_t len, void *opt) { struct netio_filter_capture *c = opt; struct pcap_pkthdr pkt_hdr; if (c != NULL) { gettimeofday(&pkt_hdr.ts,0); pkt_hdr.caplen = len; pkt_hdr.len = len; pcap_dump((u_char *)c->dumper,&pkt_hdr,pkt); pcap_dump_flush(c->dumper); } return(NETIO_FILTER_ACTION_PASS); }
false
false
false
false
false
0
ulong_arg(const char *option, const char *arg) { char *endptr; unsigned long rv = strtoul(arg, &endptr, 0); if (strchr(arg, '-') || endptr == arg || *endptr) die("%s: argument must be a non-negative integer", option); return rv; }
false
false
false
false
false
0
qrstat_report_start_unknown_ar(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp) { bool ret = true; FILE *out = (FILE*)handler->ctx; DENTER(TOP_LAYER, "qrstat_report_unknown_start"); if (!qrstat_env->header_printed) { fprintf(out, "Following advance reservations do not exist:\n"); } DRETURN(ret); }
false
false
false
false
false
0
rb_yield_splat(values) VALUE values; { int avalue = Qfalse; if (TYPE(values) == T_ARRAY) { if (RARRAY(values)->len == 0) { values = Qundef; } else { avalue = Qtrue; } } return rb_yield_0(values, 0, 0, 0, avalue); }
false
false
false
false
false
0
SyStrnicmp(const char *zLeft, const char *zRight, sxu32 SLen) { register unsigned char *p = (unsigned char *)zLeft; register unsigned char *q = (unsigned char *)zRight; if( SX_EMPTY_STR(p) || SX_EMPTY_STR(q) ){ return SX_EMPTY_STR(p)? SX_EMPTY_STR(q) ? 0 : -1 :1; } for(;;){ if( !SLen ){ return 0; }if( !*p || !*q || SyCharToLower(*p) != SyCharToLower(*q) ){ break; }p++;q++;--SLen; if( !SLen ){ return 0; }if( !*p || !*q || SyCharToLower(*p) != SyCharToLower(*q) ){ break; }p++;q++;--SLen; if( !SLen ){ return 0; }if( !*p || !*q || SyCharToLower(*p) != SyCharToLower(*q) ){ break; }p++;q++;--SLen; if( !SLen ){ return 0; }if( !*p || !*q || SyCharToLower(*p) != SyCharToLower(*q) ){ break; }p++;q++;--SLen; } return (sxi32)(SyCharToLower(p[0]) - SyCharToLower(q[0])); }
false
false
false
false
false
0
save_icon(void) { unsigned char *data; int iconX, iconY; char tbuf[64]; int ix; unsigned long nitems; { Atom actual_type; int actual_format; unsigned long leftover; if (XGetWindowProperty(display, XtWindow(toplevel), a_state, 0L, 2L, False, a_state, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) return; if (actual_type != a_state || actual_format != 32 || nitems < 1) return; } ix = cmd_srch("-iconic"); if (*(unsigned long *)data == IconicState) { if (!ix) cmd_append("-iconic"); } else { if (ix) cmd_delete(ix); } if (nitems < 2) return; { Window icon_window; XWindowAttributes wa; Window child; icon_window = *(Window *)(data + sizeof(unsigned long)); if (icon_window == None) return; if (!x_get_window_attributes(icon_window, &wa)) return; (void) XTranslateCoordinates(display, icon_window, wa.root, -wa.border_width, -wa.border_width, &iconX, &iconY, &child); if (!iconX && !iconY) return; } (void) sprintf(tbuf, "%d", iconX); ix = cmd_srch(OptIconX); if (ix) cmd_replace(ix + 1, tbuf); else { cmd_append(OptIconX); cmd_append(tbuf); } (void) sprintf(tbuf, "%d", iconY); ix = cmd_srch(OptIconY); if (ix) cmd_replace(ix + 1, tbuf); else { cmd_append(OptIconY); cmd_append(tbuf); } return; }
false
false
false
false
false
0
p_cdr(g, l) l1sp_ctx *g; l1sp *l; { switch(l1sp_tag(l)) { case L1SP_NIL: case L1SP_PAIR: return l1sp_cdr(l); default: l1sp_diebadarg(g, l); } }
false
false
false
false
false
0
add_ranges_and_copies (void) { basic_block bb; edge_iterator ei; edge e; ira_loop_tree_node_t node; bitmap live_through; live_through = ira_allocate_bitmap (); FOR_EACH_BB (bb) { /* It does not matter what loop_tree_node (of source or destination block) to use for searching allocnos by their regnos because of subsequent IR flattening. */ node = IRA_BB_NODE (bb)->parent; bitmap_copy (live_through, df_get_live_in (bb)); add_range_and_copies_from_move_list (at_bb_start[bb->index], node, live_through, REG_FREQ_FROM_BB (bb)); bitmap_copy (live_through, df_get_live_out (bb)); add_range_and_copies_from_move_list (at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb)); FOR_EACH_EDGE (e, ei, bb->succs) { bitmap_and (live_through, df_get_live_in (e->dest), df_get_live_out (bb)); add_range_and_copies_from_move_list ((move_t) e->aux, node, live_through, REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e))); } } ira_free_bitmap (live_through); }
false
false
false
false
false
0
composePoint(double lx,double ly,double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric<double,3,3> *out_jacobian_df_dpoint, mrpt::math::CMatrixFixedNumeric<double,3,6> *out_jacobian_df_dpose) const { const double angle = this->m_rotvec.norm(); const double K1 = sin(angle)/angle; const double K2 = (1-cos(angle))/(angle*angle); const double tx = this->m_coords[0]; const double ty = this->m_coords[1]; const double tz = this->m_coords[2]; const double w1 = this->m_rotvec[0]; const double w2 = this->m_rotvec[1]; const double w3 = this->m_rotvec[2]; const double w1_2 = w1*w1; const double w2_2 = w2*w2; const double w3_2 = w3*w3; gx = lx*(1-K2*(w2_2+w3_2)) + ly*(K2*w1*w2-K1*w3) + lz*(K1*w2+K2*w1*w3) + tx; gy = lx*(K1*w3+K2*w1*w2) + ly*(1-K2*(w1_2+w3_2)) + lz*(K2*w2*w3-K1*w1) + ty; gz = lx*(K2*w1*w3-K1*w2) + ly*(K1*w1+K2*w2*w3) + lz*(1-K2*(w1_2+w2_2)) + tz; if (out_jacobian_df_dpoint || out_jacobian_df_dpose) { MRPT_TODO("Jacobians") THROW_EXCEPTION("Jacobians not implemented yet") } }
false
false
false
false
false
0
recursive_build_path(struct mailimap_body * root_part, struct mailimap_body * part, clist ** result) { clistiter * cur; uint32_t count; int r; clist * imap_id_list; if (part == root_part) { imap_id_list = clist_new(); if (imap_id_list == NULL) { return MAILIMAP_ERROR_MEMORY; } * result = imap_id_list; return MAILIMAP_NO_ERROR; } switch (root_part->bd_type) { case MAILIMAP_BODY_MPART: count = 0; for(cur = clist_begin(root_part->bd_data.bd_body_mpart->bd_list) ; cur != NULL ; cur = clist_next(cur)) { struct mailimap_body * current_part; current_part = clist_content(cur); count ++; r = try_build_part(current_part, part, count, &imap_id_list); if (r == MAILIMAP_ERROR_INVAL) { continue; } if (r != MAILIMAP_NO_ERROR) { return r; } else { * result = imap_id_list; return MAILIMAP_NO_ERROR; } } return MAILIMAP_ERROR_INVAL; case MAILIMAP_BODY_1PART: if (root_part->bd_data.bd_body_1part->bd_type == MAILIMAP_BODY_TYPE_1PART_MSG) { struct mailimap_body * current_part; current_part = root_part->bd_data.bd_body_1part->bd_data.bd_type_msg->bd_body; r = try_build_part(current_part, part, 1, &imap_id_list); if (r != MAILIMAP_NO_ERROR) { return r; } else { * result = imap_id_list; return MAILIMAP_NO_ERROR; } } else { return MAILIMAP_ERROR_INVAL; } break; default: return MAILIMAP_ERROR_INVAL; } }
false
false
false
false
false
0
in_gate_area(struct mm_struct *mm, unsigned long addr) { struct vm_area_struct *vma = get_gate_vma(mm); if (!vma) return 0; return (addr >= vma->vm_start) && (addr < vma->vm_end); }
false
false
false
false
false
0
udf_truncate_tail_extent(struct inode *inode) { struct extent_position epos = {}; struct kernel_lb_addr eloc; uint32_t elen, nelen; uint64_t lbcount = 0; int8_t etype = -1, netype; int adsize; struct udf_inode_info *iinfo = UDF_I(inode); if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || inode->i_size == iinfo->i_lenExtents) return; /* Are we going to delete the file anyway? */ if (inode->i_nlink == 0) return; if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) adsize = sizeof(struct short_ad); else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) adsize = sizeof(struct long_ad); else BUG(); /* Find the last extent in the file */ while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { etype = netype; lbcount += elen; if (lbcount > inode->i_size) { if (lbcount - inode->i_size >= inode->i_sb->s_blocksize) udf_warn(inode->i_sb, "Too long extent after EOF in inode %u: i_size: %lld lbcount: %lld extent %u+%u\n", (unsigned)inode->i_ino, (long long)inode->i_size, (long long)lbcount, (unsigned)eloc.logicalBlockNum, (unsigned)elen); nelen = elen - (lbcount - inode->i_size); epos.offset -= adsize; extent_trunc(inode, &epos, &eloc, etype, elen, nelen); epos.offset += adsize; if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) udf_err(inode->i_sb, "Extent after EOF in inode %u\n", (unsigned)inode->i_ino); break; } } /* This inode entry is in-memory only and thus we don't have to mark * the inode dirty */ iinfo->i_lenExtents = inode->i_size; brelse(epos.bh); }
false
false
false
false
false
0
gst_asf_demux_process_advanced_mutual_exclusion (GstASFDemux * demux, guint8 * data, guint64 size) { ASFGuid guid; guint16 num, i; guint8 *mes; if (size < 16 + 2 + (2 * 2)) goto not_enough_data; gst_asf_demux_get_guid (&guid, &data, &size); num = gst_asf_demux_get_uint16 (&data, &size); if (num < 2) { GST_WARNING_OBJECT (demux, "nonsensical mutually exclusive streams count"); return GST_FLOW_OK; } if (size < (num * sizeof (guint16))) goto not_enough_data; /* read mutually exclusive stream numbers */ mes = g_new (guint8, num + 1); for (i = 0; i < num; ++i) { mes[i] = gst_asf_demux_get_uint16 (&data, &size) & 0x7f; GST_LOG_OBJECT (demux, "mutually exclusive: stream #%d", mes[i]); } /* add terminator so we can easily get the count or know when to stop */ mes[i] = (guint8) - 1; demux->mut_ex_streams = g_slist_append (demux->mut_ex_streams, mes); return GST_FLOW_OK; /* Errors */ not_enough_data: { GST_WARNING_OBJECT (demux, "short read parsing advanced mutual exclusion"); return GST_FLOW_OK; /* not absolutely fatal */ } }
false
false
false
false
false
0
drmGetBufInfo(int fd) { drm_buf_info_t info; drmBufInfoPtr retval; int i; info.count = 0; info.list = NULL; if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return NULL; if (info.count) { if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) return NULL; if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { drmFree(info.list); return NULL; } retval = drmMalloc(sizeof(*retval)); retval->count = info.count; retval->list = drmMalloc(info.count * sizeof(*retval->list)); for (i = 0; i < info.count; i++) { retval->list[i].count = info.list[i].count; retval->list[i].size = info.list[i].size; retval->list[i].low_mark = info.list[i].low_mark; retval->list[i].high_mark = info.list[i].high_mark; } drmFree(info.list); return retval; } return NULL; }
false
false
false
false
false
0
init_tcl(int argc, char **argv) { #ifdef USE_TCL_ENCODING const char *encoding; int i; char *langEnv; #endif /* USE_TCL_ENCODING */ #ifdef USE_TCL_PACKAGE int j; char pver[1024] = ""; #endif /* USE_TCL_PACKAGE */ /* This must be done *BEFORE* Tcl_SetSystemEncoding(), * or Tcl_SetSystemEncoding() will cause a segfault. */ #ifdef USE_TCL_FINDEXEC /* This is used for 'info nameofexecutable'. * The filename in argv[0] must exist in a directory listed in * the environment variable PATH for it to register anything. */ Tcl_FindExecutable(argv[0]); #endif /* USE_TCL_FINDEXEC */ /* Initialize the interpreter */ interp = Tcl_CreateInterp(); #ifdef DEBUG_MEM /* Initialize Tcl's memory debugging if we want it */ Tcl_InitMemory(interp); #endif /* Set Tcl variable tcl_interactive to 0 */ Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); /* Setup script library facility */ Tcl_Init(interp); /* Code based on Tcl's TclpSetInitialEncodings() */ #ifdef USE_TCL_ENCODING /* Determine the current encoding from the LC_* or LANG environment * variables. */ langEnv = getenv("LC_ALL"); if (langEnv == NULL || langEnv[0] == '\0') { langEnv = getenv("LC_CTYPE"); } if (langEnv == NULL || langEnv[0] == '\0') { langEnv = getenv("LANG"); } if (langEnv == NULL || langEnv[0] == '\0') { langEnv = NULL; } encoding = NULL; if (langEnv != NULL) { for (i = 0; localeTable[i].lang != NULL; i++) if (strcmp(localeTable[i].lang, langEnv) == 0) { encoding = localeTable[i].encoding; break; } /* There was no mapping in the locale table. If there is an * encoding subfield, we can try to guess from that. */ if (encoding == NULL) { char *p; for (p = langEnv; *p != '\0'; p++) { if (*p == '.') { p++; break; } } if (*p != '\0') { Tcl_DString ds; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, p, -1); encoding = Tcl_DStringValue(&ds); Tcl_UtfToLower(Tcl_DStringValue(&ds)); if (Tcl_SetSystemEncoding(NULL, encoding) == TCL_OK) { Tcl_DStringFree(&ds); goto resetPath; } Tcl_DStringFree(&ds); encoding = NULL; } } } if (encoding == NULL) { encoding = "iso8859-1"; } Tcl_SetSystemEncoding(NULL, encoding); resetPath: /* Initialize the C library's locale subsystem. */ setlocale(LC_CTYPE, ""); /* In case the initial locale is not "C", ensure that the numeric * processing is done in "C" locale regardless. */ setlocale(LC_NUMERIC, "C"); /* Keep the iso8859-1 encoding preloaded. The IO package uses it for * gets on a binary channel. */ Tcl_GetEncoding(NULL, "iso8859-1"); #endif /* USE_TCL_ENCODING */ #ifdef USE_TCL_PACKAGE /* Add eggdrop to Tcl's package list */ for (j = 0; j <= strlen(egg_version); j++) { if ((egg_version[j] == ' ') || (egg_version[j] == '+')) break; pver[strlen(pver)] = egg_version[j]; } Tcl_PkgProvide(interp, "eggdrop", pver); #endif /* USE_TCL_PACKAGE */ /* Initialize binds and traces */ init_bind(); init_traces(); /* Add new commands */ add_tcl_commands(tcluser_cmds); add_tcl_commands(tcldcc_cmds); add_tcl_commands(tclmisc_cmds); #ifdef USE_TCL_OBJ add_tcl_objcommands(tclmisc_objcmds); #endif add_tcl_commands(tcldns_cmds); }
false
false
false
false
false
0
inc_host_errors(const char *ip_string) { if (!ip_string) return; char ip_key[HOST_ENTRY_KEY_SIZE]; prepare_hostname_cache_key(ip_string, ip_key); mysql_mutex_lock(&hostname_cache->lock); Host_entry *entry= hostname_cache_search(ip_key); if (entry) entry->connect_errors++; mysql_mutex_unlock(&hostname_cache->lock); }
false
false
false
false
false
0
tdb1_do_delete(struct tdb_context *tdb, tdb1_off_t rec_ptr, struct tdb1_record *rec) { tdb1_off_t last_ptr, i; struct tdb1_record lastrec; if ((tdb->flags & TDB_RDONLY) || tdb->tdb1.traverse_read) return -1; if (((tdb->tdb1.traverse_write != 0) && (!TDB1_DEAD(rec))) || tdb1_write_lock_record(tdb, rec_ptr) == -1) { /* Someone traversing here: mark it as dead */ rec->magic = TDB1_DEAD_MAGIC; return tdb1_rec_write(tdb, rec_ptr, rec); } if (tdb1_write_unlock_record(tdb, rec_ptr) != 0) return -1; /* find previous record in hash chain */ if (tdb1_ofs_read(tdb, TDB1_HASH_TOP(rec->full_hash), &i) == -1) return -1; for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) if (tdb1_rec_read(tdb, i, &lastrec) == -1) return -1; /* unlink it: next ptr is at start of record. */ if (last_ptr == 0) last_ptr = TDB1_HASH_TOP(rec->full_hash); if (tdb1_ofs_write(tdb, last_ptr, &rec->next) == -1) return -1; /* recover the space */ if (tdb1_free(tdb, rec_ptr, rec) == -1) return -1; return 0; }
false
false
false
false
false
0
gth_backtrace_path_add_deletion(GthBacktracePath *bp) { Editoperation deletion_eop = DELETIONEOP; gt_assert(bp); gt_assert(bp->alphatype == DNA_ALPHA || bp->alphatype == PROTEIN_ALPHA); gt_array_add(bp->editoperations, deletion_eop); }
false
false
false
false
false
0
mxr_reg_reset(struct mxr_device *mdev) { unsigned long flags; u32 val; /* value stored to register */ spin_lock_irqsave(&mdev->reg_slock, flags); mxr_vsync_set_update(mdev, MXR_DISABLE); /* set output in RGB888 mode */ mxr_write(mdev, MXR_CFG, MXR_CFG_OUT_RGB888); /* 16 beat burst in DMA */ mxr_write_mask(mdev, MXR_STATUS, MXR_STATUS_16_BURST, MXR_STATUS_BURST_MASK); /* setting default layer priority: layer1 > video > layer0 * because typical usage scenario would be * layer0 - framebuffer * video - video overlay * layer1 - OSD */ val = MXR_LAYER_CFG_GRP0_VAL(1); val |= MXR_LAYER_CFG_VP_VAL(2); val |= MXR_LAYER_CFG_GRP1_VAL(3); mxr_write(mdev, MXR_LAYER_CFG, val); /* use dark gray background color */ mxr_write(mdev, MXR_BG_COLOR0, 0x808080); mxr_write(mdev, MXR_BG_COLOR1, 0x808080); mxr_write(mdev, MXR_BG_COLOR2, 0x808080); /* setting graphical layers */ val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */ val |= MXR_GRP_CFG_BLEND_PRE_MUL; /* premul mode */ val |= MXR_GRP_CFG_ALPHA_VAL(0xff); /* non-transparent alpha */ /* the same configuration for both layers */ mxr_write(mdev, MXR_GRAPHIC_CFG(0), val); mxr_write(mdev, MXR_GRAPHIC_CFG(1), val); /* configuration of Video Processor Registers */ __mxr_reg_vp_reset(mdev); mxr_reg_vp_default_filter(mdev); /* enable all interrupts */ mxr_write_mask(mdev, MXR_INT_EN, ~0, MXR_INT_EN_ALL); mxr_vsync_set_update(mdev, MXR_ENABLE); spin_unlock_irqrestore(&mdev->reg_slock, flags); }
false
false
false
false
false
0
decide_blitter (int hpos) { int hsync = hpos < 0; if (blit_startcycles > 0) do_startcycles (hpos); if (blt_delayed_irq > 0 && hsync) { blt_delayed_irq--; if (!blt_delayed_irq) send_interrupt (6, 2 * CYCLE_UNIT); } if (bltstate == BLT_done) return; #ifdef BLITTER_DEBUG if (blitter_delayed_debug) { blitter_delayed_debug = 0; blitter_dump (); } #endif if (!blitter_cycle_exact) return; if (hpos < 0) hpos = maxhpos; if (blitline) { blt_info.got_cycle = 1; decide_blitter_line (hsync, hpos); return; } while (last_blitter_hpos < hpos) { int c; c = channel_state (blit_cyclecounter); for (;;) { int v; v = canblit (last_blitter_hpos); // copper bltsize write needs one cycle (any cycle) delay if (blit_waitcyclecounter) { blit_waitcyclecounter = 0; break; } // idle cycles require free bus.. // (CPU can still use this cycle) if (c == 0 && v == 0) { blitter_nasty++; blit_misscyclecounter++; break; } if (blit_frozen) { blit_misscyclecounter++; break; } if (c == 0) { blt_info.got_cycle = 1; blit_cyclecounter++; if (blit_cyclecounter == 0) blit_final = 0; blit_totalcyclecounter++; /* check if blit with zero channels has ended */ if (blit_ch == 0 && blit_cyclecounter >= blit_maxcyclecounter) { blitter_done (last_blitter_hpos); return; } break; } blitter_nasty++; if (!dmaen (DMA_BLITTER) || v <= 0) { blit_misscyclecounter++; break; } blt_info.got_cycle = 1; if (c == 4) { blitter_doddma (last_blitter_hpos); blit_cyclecounter++; blit_totalcyclecounter++; } else { if (blitter_vcounter1 < blt_info.vblitsize) { blitter_dodma (c, last_blitter_hpos); } blit_cyclecounter++; blit_totalcyclecounter++; } if (blitter_vcounter1 >= blt_info.vblitsize && blitter_vcounter2 >= blt_info.vblitsize) { if (!ddat1use && !ddat2use) { blitter_done (last_blitter_hpos); return; } } break; } if (!blit_final && blitter_vcounter1 == blt_info.vblitsize && channel_pos (blit_cyclecounter - 1) == blit_diag[0] - 1) { blitter_interrupt (last_blitter_hpos, 0); blit_cyclecounter = 0; blit_final = 1; } last_blitter_hpos++; } if (hsync) last_blitter_hpos = 0; }
false
false
false
false
false
0
run_shell (const char* pz_cmd) { tSCC zNoServer[] = "Server not running, cannot run:\n%s\n\n"; t_bool retry = BOOL_TRUE; do_retry: /* IF the shell server process is not running yet, THEN try to start it. */ if (server_id == NULLPROCESS) { def_args[0] = find_shell (); server_id = proc2_fopen (&server_pair, def_args); if (server_id > 0) server_setup (); } /* IF it is still not running, THEN return the nil string. */ if (server_id <= 0) { fprintf (stderr, zNoServer, pz_cmd); return XCNEW (char); } /* Make sure the process will pay attention to us, send the supplied command, and then have it output a special marker that we can find. */ fprintf (server_pair.pf_write, "cd \"%s\"\n%s\n\necho\necho %s\n", p_cur_dir, pz_cmd, z_done); fflush (server_pair.pf_write); /* IF the server died and we received a SIGPIPE, THEN return an empty string. */ if (server_id == NULLPROCESS) { fprintf (stderr, zNoServer, pz_cmd); return XCNEW (char); } /* Now try to read back all the data. If we fail due to either a sigpipe or sigalrm (timeout), we will return the nil string. */ { char *pz = load_data (server_pair.pf_read); if (pz == (char *) NULL) { close_server (); if (retry) { retry = BOOL_FALSE; goto do_retry; } fprintf (stderr, "CLOSING SHELL SERVER - command failure:\n\t%s\n", pz_cmd); pz = XCNEW (char); } #ifdef DEBUG fprintf( stderr, "run_shell command success: %s\n", pz ); #endif return pz; } }
false
false
false
false
false
0
wi_mutable_url_set_password(wi_mutable_url_t *url, wi_string_t *password) { WI_RUNTIME_ASSERT_MUTABLE(url); wi_retain(password); wi_release(url->password); url->password = password; _wi_url_regenerate_string(url); }
false
false
false
false
false
0
setup_treeview (GtkWidget *treeview, GtkTreeModel *model, char *headers[], int render_index) { GtkTreeSelection *selection; int i; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); g_assert (selection != NULL); for (i = 0; headers[i] != NULL; i++) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; column = gtk_tree_view_column_new (); renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_end (column, renderer, FALSE); gtk_tree_view_column_set_title (column, headers[i]); gtk_tree_view_column_add_attribute (column, renderer, "text", i + render_index); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_insert_column (GTK_TREE_VIEW (treeview), column, -1); } gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), model); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); }
false
false
false
false
false
0
arr( EnvT* e, dimension& dim, SizeT pOffs=0) { int nParam=e->NParam()-pOffs; if( nParam <= 0) e->Throw( "Incorrect number of arguments."); const string BadDims="Array dimensions must be greater than 0."; if( nParam == 1 ) { BaseGDL* par = e->GetParDefined( pOffs); SizeT newDim; int ret = par->Scalar2Index( newDim); if (ret < 0) throw GDLException(BadDims); if( ret > 0) { // single argument if (newDim < 1) throw GDLException(BadDims); dim << newDim; return; } if( ret == 0) { // array argument DLongGDL* ind = static_cast<DLongGDL*>(par->Convert2(GDL_LONG, BaseGDL::COPY)); Guard<DLongGDL> ind_guard( ind); //e->Guard( ind); for(SizeT i =0; i < par->N_Elements(); ++i){ if ((*ind)[i] < 1) throw GDLException(BadDims); dim << (*ind)[i]; } return; } e->Throw( "arr: should never arrive here."); return; } // max number checked in interpreter SizeT endIx=nParam+pOffs; for( SizeT i=pOffs; i<endIx; i++) { BaseGDL* par=e->GetParDefined( i); SizeT newDim; int ret=par->Scalar2Index( newDim); if( ret < 1 || newDim == 0) throw GDLException(BadDims); dim << newDim; } }
false
false
false
false
false
0
ath6kl_htc_rx_fetch(struct htc_target *target, struct list_head *rx_pktq, struct list_head *comp_pktq) { int fetched_pkts; bool part_bundle = false; int status = 0; struct list_head tmp_rxq; struct htc_packet *packet, *tmp_pkt; /* now go fetch the list of HTC packets */ while (!list_empty(rx_pktq)) { fetched_pkts = 0; INIT_LIST_HEAD(&tmp_rxq); if (target->rx_bndl_enable && (get_queue_depth(rx_pktq) > 1)) { /* * There are enough packets to attempt a * bundle transfer and recv bundling is * allowed. */ status = ath6kl_htc_rx_bundle(target, rx_pktq, &tmp_rxq, &fetched_pkts, part_bundle); if (status) goto fail_rx; if (!list_empty(rx_pktq)) part_bundle = true; list_splice_tail_init(&tmp_rxq, comp_pktq); } if (!fetched_pkts) { packet = list_first_entry(rx_pktq, struct htc_packet, list); /* fully synchronous */ packet->completion = NULL; if (!list_is_singular(rx_pktq)) /* * look_aheads in all packet * except the last one in the * bundle must be ignored */ packet->info.rx.rx_flags |= HTC_RX_PKT_IGNORE_LOOKAHEAD; /* go fetch the packet */ status = ath6kl_htc_rx_packet(target, packet, packet->act_len); list_move_tail(&packet->list, &tmp_rxq); if (status) goto fail_rx; list_splice_tail_init(&tmp_rxq, comp_pktq); } } return 0; fail_rx: /* * Cleanup any packets we allocated but didn't use to * actually fetch any packets. */ list_for_each_entry_safe(packet, tmp_pkt, rx_pktq, list) { list_del(&packet->list); htc_reclaim_rxbuf(target, packet, &target->endpoint[packet->endpoint]); } list_for_each_entry_safe(packet, tmp_pkt, &tmp_rxq, list) { list_del(&packet->list); htc_reclaim_rxbuf(target, packet, &target->endpoint[packet->endpoint]); } return status; }
false
false
false
false
false
0
PyFF_Glyph_dealloc(PyFF_Glyph *self) { if ( self->sc!=NULL ) self->sc = NULL; Py_XDECREF(self->layers); Py_XDECREF(self->refs); Py_XDECREF(self->mk); ((PyObject *)self)->ob_type->tp_free((PyObject *) self); }
false
false
false
false
false
0
iot_io_begin(struct io_tracker *iot, sector_t len) { unsigned long flags; spin_lock_irqsave(&iot->lock, flags); iot->in_flight += len; spin_unlock_irqrestore(&iot->lock, flags); }
false
false
false
false
false
0
CollectNamespaceDecls ( NamespaceMap * nsMap, const XML_Node & node ) { size_t i, limit; if ( ! node.ns.empty() ) { size_t nameMid = 0; while ( node.name[nameMid] != ':' ) ++nameMid; std::string prefix = node.name.substr ( 0, nameMid ); (*nsMap)[prefix] = node.ns; } if ( node.kind == kElemNode ) { for ( i = 0, limit = node.attrs.size(); i < limit; ++i ) { CollectNamespaceDecls ( nsMap, *node.attrs[i] ); } for ( i = 0, limit = node.content.size(); i < limit; ++i ) { const XML_Node & content = *node.content[i]; if ( content.kind == kElemNode ) CollectNamespaceDecls ( nsMap, content ); } } }
false
false
false
false
false
0
sh_loop_finish (call_frame_t *loop_frame, xlator_t *this) { afr_local_t *loop_local = NULL; afr_self_heal_t *loop_sh = NULL; if (!loop_frame) goto out; loop_local = loop_frame->local; if (loop_local) { loop_sh = &loop_local->self_heal; } if (loop_sh && loop_sh->data_lock_held) { afr_sh_data_unlock (loop_frame, this, sh_destroy_frame); } else { sh_destroy_frame (loop_frame, this); } out: return 0; }
false
false
false
false
false
0
py_gnumeric_Style_method (PyObject *self, PyObject *args) { if (!PyArg_ParseTuple (args, (char *) ":GnmStyle")) { return NULL; } return py_new_Style_object (gnm_style_new_default ()); }
false
false
false
false
false
0
gregorio_free_styles (det_style ** first_style) { det_style *current_style; if (!first_style) { return; } current_style = (*first_style); while (current_style) { current_style = current_style->next_style; free ((*first_style)); (*first_style) = current_style; } }
false
false
false
false
false
0
mca_pml_bfo_send_request_put_frag( mca_pml_bfo_rdma_frag_t* frag ) { mca_mpool_base_registration_t* reg = NULL; mca_bml_base_btl_t* bml_btl = frag->rdma_bml; mca_btl_base_descriptor_t* des; size_t save_size = frag->rdma_length; int rc; /* setup descriptor */ mca_bml_base_prepare_src( bml_btl, reg, &frag->convertor, MCA_BTL_NO_ORDER, 0, &frag->rdma_length, MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_FLAGS_PUT, &des ); if( OPAL_UNLIKELY(NULL == des) ) { if(frag->retries < mca_pml_bfo.rdma_put_retries_limit) { size_t offset = (size_t)frag->rdma_hdr.hdr_rdma.hdr_rdma_offset; frag->rdma_length = save_size; opal_convertor_set_position(&frag->convertor, &offset); OPAL_THREAD_LOCK(&mca_pml_bfo.lock); opal_list_append(&mca_pml_bfo.rdma_pending, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); } else { mca_pml_bfo_send_request_t *sendreq = (mca_pml_bfo_send_request_t*)frag->rdma_req; /* tell receiver to unregister memory */ mca_pml_bfo_send_fin(sendreq->req_send.req_base.req_proc, bml_btl, frag->rdma_hdr.hdr_rdma.hdr_des, #if PML_BFO MCA_BTL_NO_ORDER, 1, (uint16_t)sendreq->req_send.req_base.req_sequence, sendreq->req_restartseq, sendreq->req_send.req_base.req_comm->c_contextid, sendreq->req_send.req_base.req_comm->c_my_rank); #else /* PML_BFO */ MCA_BTL_NO_ORDER, 1); #endif /* PML_BFO */ /* send fragment by copy in/out */ mca_pml_bfo_send_request_copy_in_out(sendreq, frag->rdma_hdr.hdr_rdma.hdr_rdma_offset, frag->rdma_length); /* if a pointer to a receive request is not set it means that * ACK was not yet received. Don't schedule sends before ACK */ if(NULL != sendreq->req_recv.pval) mca_pml_bfo_send_request_schedule(sendreq); } return OMPI_ERR_OUT_OF_RESOURCE; } des->des_dst = (mca_btl_base_segment_t *) frag->rdma_segs; des->des_dst_cnt = frag->rdma_hdr.hdr_rdma.hdr_seg_cnt; des->des_cbfunc = mca_pml_bfo_put_completion; des->des_cbdata = frag; PERUSE_TRACE_COMM_OMPI_EVENT( PERUSE_COMM_REQ_XFER_CONTINUE, &(((mca_pml_bfo_send_request_t*)frag->rdma_req)->req_send.req_base), save_size, PERUSE_SEND ); rc = mca_bml_base_put(bml_btl, des); if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { mca_bml_base_free(bml_btl, des); frag->rdma_length = save_size; if(OMPI_ERR_OUT_OF_RESOURCE == rc) { OPAL_THREAD_LOCK(&mca_pml_bfo.lock); opal_list_append(&mca_pml_bfo.rdma_pending, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); return OMPI_ERR_OUT_OF_RESOURCE; } else { /* TSW - FIX */ OMPI_ERROR_LOG(rc); ompi_rte_abort(-1, NULL); } } #if PML_BFO if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { ((mca_pml_bfo_send_request_t*)frag->rdma_req)->req_events++; } #endif /* PML_BFO */ return OMPI_SUCCESS; }
false
false
false
false
false
0
FindDatabase(char *name, char *hostName) { char *dbhome = NULL; char *fullpath = NULL; /* Does Name includes fullpath */ if (strcmp(basename(name), name)) { if (IsDatabaseFile(name)) fullpath = GB.NewZeroString(name); return fullpath; } /* Hostname contains home area */ fullpath = GB.NewZeroString(hostName); fullpath = GB.AddChar(fullpath, '/'); fullpath = GB.AddString(fullpath, name, 0); if (IsDatabaseFile(fullpath)) { return fullpath; } GB.FreeString(&fullpath); /* Check the GAMBAS_SQLITE_DBHOME setting */ dbhome = getenv("GAMBAS_SQLITE_DBHOME"); if (dbhome != NULL) { fullpath = GB.NewZeroString(dbhome); fullpath = GB.AddChar(fullpath, '/'); fullpath = GB.AddString(fullpath, name, 0); if (IsDatabaseFile(fullpath)) { return fullpath; } } fullpath = GB.NewZeroString(GB.TempDir()); fullpath = GB.AddString(fullpath, "/sqlite/", 0); fullpath = GB.AddString(fullpath, name, 0); if (IsDatabaseFile(fullpath)) { return fullpath; } GB.FreeString(&fullpath); return NULL; }
false
false
false
false
false
0
Strip ( char * szText ) { char * szIterator1 = szText; char * szIterator2 = szText; while ( *szIterator1 ) { if ( !isspace ( (unsigned char) *szIterator1 ) && *szIterator1 != '-' ) { *szIterator2 = *szIterator1; ++szIterator2; } ++szIterator1; } *szIterator2 = '\0'; while ( *szText ) { *szText = ToLowerCase ( *szText ); ++szText; } }
false
false
false
false
false
0
get_irqs_from_stat(struct stats_irq *irq) { FILE *fp; char buf[1024]; fp = fopen_for_read(PROCFS_STAT); if (!fp) return; while (fgets(buf, sizeof(buf), fp)) { //bb_error_msg("/proc/stat:'%s'", buf); if (strncmp(buf, "intr ", 5) == 0) { /* Read total number of IRQs since system boot */ sscanf(buf + 5, "%"FMT_DATA"u", &irq->irq_nr); } } fclose(fp); }
true
true
false
false
false
1
wq_sleep_timeout(const void *key, int delay, wq_callback_t cb, void *arg) { wq_event_t *we; we = wq_sleep(key, cb, arg); WALLOC(we->tm); we->tm->delay = delay; we->tm->timeout_ev = cq_main_insert(delay, wq_timed_out, we); return we; }
false
false
false
false
false
0
DrawPolygon(const std::vector<std::pair<double,double> > &points) { m_ofs << "<polygon points=\""; std::vector<std::pair<double,double> >::const_iterator i; for (i = points.begin(); i != points.end(); ++i) m_ofs << i->first << ' ' << i->second << ' '; m_ofs << "\" />\n"; }
false
false
false
false
false
0
binop1_max_bang(t_binop *x) { outlet_float(x->x_obj.ob_outlet, (x->x_f1 > x->x_f2 ? x->x_f1 : x->x_f2)); }
false
false
false
false
false
0
get_config_byoffset(struct ddf1 *ddf1, struct ddf1_phys_drive *pd, uint64_t offset) { int cfgs = NUM_CONFIG_ENTRIES(ddf1), i; uint32_t *cfg_drive_ids, j; uint64_t *cfg_drive_offsets; struct ddf1_config_record *cfg; for (i = 0; i < cfgs; i++) { cfg = CR(ddf1, i); if (cfg->signature == DDF1_VD_CONFIG_REC) { cfg_drive_ids = CR_IDS(ddf1, cfg); cfg_drive_offsets = CR_OFF(ddf1, cfg); for (j = 0; j < cfg->primary_element_count; j++) { if (cfg_drive_ids[j] == pd->reference && cfg_drive_offsets[j] == offset) return i; } } } return -ENOENT; }
false
false
false
false
false
0
mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method) { MonoMethod *result; mono_loader_lock (); *cil_method = mono_get_method_from_token (image, token, NULL, context, NULL); if (!*cil_method) { mono_loader_unlock (); return NULL; } result = get_method_constrained (image, *cil_method, constrained_class, context); mono_loader_unlock (); return result; }
false
false
false
false
false
0
getIterator(uint_t id) { //AVM_WRITE("ASF network reader", "GETITERATOR %d\n", id); if (id >= m_Streams.size()) return 0; m_Iterators.push_back(new NetworkIterator(this, m_Streams[id].hdr.stream & 0x7f)); AsfIterator* it = m_Iterators.back(); it->addRef(); return it; }
false
false
false
false
false
0
cdc_ncm_eth_hlen(struct usbnet *dev) { if (cdc_ncm_comm_intf_is_mbim(dev->intf->cur_altsetting)) return 0; return ETH_HLEN; }
false
false
false
false
false
0
knot_dname_unpack(uint8_t* dst, const knot_dname_t *src, size_t maxlen, const uint8_t *pkt) { if (dst == NULL || src == NULL) return KNOT_EINVAL; /* Seek first real label occurence. */ src = knot_wire_seek_label(src, pkt); /* Unpack rest of the labels. */ int len = 0; while (*src != '\0') { uint8_t lblen = *src + 1; if (len + lblen > maxlen) return KNOT_ESPACE; memcpy(dst + len, src, lblen); len += lblen; src = knot_wire_next_label(src, pkt); } /* Terminal label */ if (len + 1 > maxlen) return KNOT_EINVAL; *(dst + len) = '\0'; return len + 1; }
false
true
false
false
false
1
gen_iorsi3 (rtx operand0, rtx operand1, rtx operand2) { rtx _val = 0; start_sequence (); { rtx operands[3]; operands[0] = operand0; operands[1] = operand1; operands[2] = operand2; #line 2957 "../../src/gcc/config/arm/arm.md" if (GET_CODE (operands[2]) == CONST_INT) { if (TARGET_32BIT) { arm_split_constant (IOR, SImode, NULL_RTX, INTVAL (operands[2]), operands[0], operands[1], optimize && can_create_pseudo_p ()); DONE; } else /* TARGET_THUMB1 */ { rtx tmp = force_reg (SImode, operands[2]); if (rtx_equal_p (operands[0], operands[1])) operands[2] = tmp; else { operands[2] = operands[1]; operands[1] = tmp; } } } operand0 = operands[0]; (void) operand0; operand1 = operands[1]; (void) operand1; operand2 = operands[2]; (void) operand2; } emit_insn (gen_rtx_SET (VOIDmode, operand0, gen_rtx_IOR (SImode, operand1, operand2))); _val = get_insns (); end_sequence (); return _val; }
false
false
false
false
false
0
main (int argc, char **argv) { GMainLoop *loop; CkTtyIdleMonitor *monitor; char *device; g_type_init (); if (argc < 2) { device = ttyname (0); } else { device = g_strdup (argv[1]); } if (! is_console (device)) { g_warning ("Device is not a console"); exit (1); } g_message ("Testing the TTY idle monitor.\n1. Wait for idleness to be detected.\n2. Hit keys on the keyboard to see if activity is noticed."); monitor = ck_tty_idle_monitor_new (device); g_signal_connect (monitor, "idle-hint-changed", G_CALLBACK (idle_changed_cb), NULL); ck_tty_idle_monitor_set_threshold (monitor, 5); ck_tty_idle_monitor_start (monitor); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_object_unref (monitor); g_main_loop_unref (loop); return 0; }
false
false
false
false
false
0
mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp) { struct mtd_info *mtd = NULL; struct cfi_private *cfi; /* First probe the map to see if we have CFI stuff there. */ cfi = genprobe_ident_chips(map, cp); if (!cfi) return NULL; map->fldrv_priv = cfi; /* OK we liked it. Now find a driver for the command set it talks */ mtd = check_cmd_set(map, 1); /* First the primary cmdset */ if (!mtd) mtd = check_cmd_set(map, 0); /* Then the secondary */ if (mtd) { if (mtd->size > map->size) { printk(KERN_WARNING "Reducing visibility of %ldKiB chip to %ldKiB\n", (unsigned long)mtd->size >> 10, (unsigned long)map->size >> 10); mtd->size = map->size; } return mtd; } printk(KERN_WARNING"gen_probe: No supported Vendor Command Set found\n"); kfree(cfi->cfiq); kfree(cfi); map->fldrv_priv = NULL; return NULL; }
false
false
false
false
false
0
VBE_UseHealth(const struct director *vdi) { struct vdi_simple *vs; ASSERT_CLI(); if (strcmp(vdi->name, "simple")) return; CAST_OBJ_NOTNULL(vs, vdi->priv, VDI_SIMPLE_MAGIC); if (vs->vrt->probe == NULL) return; VBP_Start(vs->backend, vs->vrt->probe, vs->vrt->hosthdr); }
false
false
true
true
false
1
c_sfx_01_track(state_t *s) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0); int offset = cmd_params[1].val; if (!song) { sciprintf("Doesn't exist\n"); return 1; } midi_hexdump(song->data + offset, song->size, offset); return 0; }
false
false
false
false
false
0
convertToBoolean(List &words) { HtConfiguration* config= HtConfiguration::config(); List list; int i; int do_and = strcmp(config->Find("match_method"), "and") == 0; int in_phrase = 0; String quote = "\""; if (words.Count() == 0) return; list.Add(words[0]); // We might start off with a phrase match if (((WeightWord *) words[0])->word == quote) in_phrase = 1; for (i = 1; i < words.Count(); i++) { if (do_and && !in_phrase) list.Add(new WeightWord("&", -1.0)); else if (!in_phrase) list.Add(new WeightWord("|", -1.0)); if (((WeightWord *) words[i])->word == quote) in_phrase = !in_phrase; list.Add(words[i]); } words.Release(); for (i = 0; i < list.Count(); i++) { words.Add(list[i]); } list.Release(); }
false
false
false
false
false
0
SECITEM_DupArray(PLArenaPool *arena, const SECItemArray *from) { SECItemArray *result; unsigned int i; /* Require a "from" array. * Reject an inconsistent "from" array with NULL data and nonzero length. * However, allow a "from" array of zero length. */ if (!from || (!from->items && from->len)) return NULL; result = SECITEM_AllocArray(arena, NULL, from->len); if (!result) return NULL; for (i = 0; i < from->len; ++i) { SECStatus rv = SECITEM_CopyItem(arena, &result->items[i], &from->items[i]); if (rv != SECSuccess) { SECITEM_ZfreeArray(result, PR_TRUE); return NULL; } } return result; }
false
false
false
false
false
0
sas_eh_handle_resets(struct Scsi_Host *shost) { struct sas_ha_struct *ha = SHOST_TO_SAS_HA(shost); struct sas_internal *i = to_sas_internal(shost->transportt); /* handle directed resets to sas devices */ spin_lock_irq(&ha->lock); while (!list_empty(&ha->eh_dev_q)) { struct domain_device *dev; struct ssp_device *ssp; ssp = list_entry(ha->eh_dev_q.next, typeof(*ssp), eh_list_node); list_del_init(&ssp->eh_list_node); dev = container_of(ssp, typeof(*dev), ssp_dev); kref_get(&dev->kref); WARN_ONCE(dev_is_sata(dev), "ssp reset to ata device?\n"); spin_unlock_irq(&ha->lock); if (test_and_clear_bit(SAS_DEV_LU_RESET, &dev->state)) i->dft->lldd_lu_reset(dev, ssp->reset_lun.scsi_lun); if (test_and_clear_bit(SAS_DEV_RESET, &dev->state)) i->dft->lldd_I_T_nexus_reset(dev); sas_put_device(dev); spin_lock_irq(&ha->lock); clear_bit(SAS_DEV_EH_PENDING, &dev->state); ha->eh_active--; } spin_unlock_irq(&ha->lock); }
false
false
false
false
false
0
vEndOfParagraphPDF(diagram_type *pDiag, USHORT usFontSize, long lAfterIndentation) { fail(pDiag == NULL); fail(pDiag->pOutFile == NULL); fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE); fail(lAfterIndentation < 0); if (pDiag->lXleft > 0) { /* To the start of the line */ vMove2NextLinePDF(pDiag, usFontSize); } pDiag->lXleft = 0; pDiag->lYtop -= lMilliPoints2DrawUnits(lAfterIndentation); }
false
false
false
false
false
0
gsearch_history_entry_finalize (GObject *object) { GsearchHistoryEntryPrivate *priv; priv = GSEARCH_HISTORY_ENTRY (object)->priv; g_free (priv->history_id); if (priv->settings != NULL) { g_object_unref (G_OBJECT (priv->settings)); priv->settings = NULL; } G_OBJECT_CLASS (gsearch_history_entry_parent_class)->finalize (object); }
false
false
false
false
false
0
ath6kl_keepalive_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct ath6kl *ar = file->private_data; int ret; u8 val; ret = kstrtou8_from_user(user_buf, count, 0, &val); if (ret) return ret; ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val); if (ret) return ret; return count; }
false
false
false
false
false
0
setText(const ustring &tip) { fText = tip; if (fText != null) { YDimension const size(toolTipFont->multilineAlloc(fText)); setSize(size.w + 6, size.h + 7); //!!! merge with below code in locate int x = this->x(); int y = this->y(); if (x + width() >= desktop->width()) x = desktop->width() - width(); if (y + height() >= desktop->height()) y = desktop->height() - height(); if (y < 0) y = 0; if (x < 0) x = 0; setPosition(x, y); } repaint(); }
false
false
false
true
false
1
activity_bar_weak_notify_cb (EActivityBar *bar, GObject *where_the_object_was) { g_return_if_fail (E_IS_ACTIVITY_BAR (bar)); bar->priv->activity = NULL; e_activity_bar_set_activity (bar, NULL); }
false
false
false
false
false
0
_replica_update_entry (Replica *r, Slapi_Entry *e, char *errortext) { int rc; Slapi_Mod smod; Slapi_Value *val; PR_ASSERT (r); /* add attribute that stores state of csn generator */ rc = csngen_get_state ((CSNGen*)object_get_data (r->repl_csngen), &smod); if (rc != CSN_SUCCESS) { PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE, "failed to get csn generator's state; csn error - %d", rc); slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "_replica_update_entry: %s\n", errortext); return -1; } val = slapi_value_new_berval(slapi_mod_get_first_value(&smod)); rc = slapi_entry_add_value (e, slapi_mod_get_type (&smod), val); slapi_value_free(&val); slapi_mod_done (&smod); if (rc != 0) { PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE, "failed to update replica entry"); slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "_replica_update_entry: %s\n", errortext); return -1; } /* add attribute that stores replica name */ rc = slapi_entry_add_string (e, attr_replicaName, r->repl_name); if (rc != 0) { PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE, "failed to update replica entry"); slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "_replica_update_entry: %s\n", errortext); return -1; } else r->new_name = PR_FALSE; return 0; }
false
false
false
false
false
0
OnReadEvent(AsyncSocket* socket) { // If we're NATed, we need to process the connect reply. ASSERT(socket == socket_); if (type_ == SOCK_STREAM && !server_addr_.IsAny() && !connected_) { HandleConnectReply(); } else { SignalReadEvent(this); } }
false
false
false
false
false
0
ValidDSN (LPCSTR lpszDSN) { char *currp = (char *) lpszDSN; while (*currp) { if (strchr (INVALID_CHARS, *currp)) return FALSE; else currp++; } return TRUE; }
false
false
false
false
false
0
solo_timer_sync(struct solo_dev *solo_dev) { u32 sec, usec; struct timespec ts; long diff; if (solo_dev->type != SOLO_DEV_6110) return; if (++solo_dev->time_sync < 60) return; solo_dev->time_sync = 0; sec = solo_reg_read(solo_dev, SOLO_TIMER_SEC); usec = solo_reg_read(solo_dev, SOLO_TIMER_USEC); ktime_get_ts(&ts); diff = (long)ts.tv_sec - (long)sec; diff = (diff * 1000000) + ((long)(ts.tv_nsec / NSEC_PER_USEC) - (long)usec); if (diff > 1000 || diff < -1000) { solo_set_time(solo_dev); } else if (diff) { long usec_lsb = solo_dev->usec_lsb; usec_lsb -= diff / 4; if (usec_lsb < 0) usec_lsb = 0; else if (usec_lsb > 255) usec_lsb = 255; solo_dev->usec_lsb = usec_lsb; solo_reg_write(solo_dev, SOLO_TIMER_USEC_LSB, solo_dev->usec_lsb); } }
false
false
false
false
false
0
sparse_count_chunks(struct sparse_file *s) { struct backed_block *bb; unsigned int last_block = 0; unsigned int chunks = 0; for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { if (backed_block_block(bb) > last_block) { /* If there is a gap between chunks, add a skip chunk */ chunks++; } chunks++; last_block = backed_block_block(bb) + DIV_ROUND_UP(backed_block_len(bb), s->block_size); } if (last_block < DIV_ROUND_UP(s->len, s->block_size)) { chunks++; } return chunks; }
false
false
false
false
false
0
coeff(int narg, char **arg) { if (!allocated) allocate(); if (narg != 3 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients"); // insure I,J args are * * if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and NULL // map[i] = which element (0 for C) the Ith atom type is, -1 if NULL for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { map[i-2] = -1; } else if (strcmp(arg[i],"C") == 0) { map[i-2] = 0; } else error->all(FLERR,"Incorrect args for pair coefficients"); } // read potential file and initialize fitting splines read_file(arg[2]); spline_init(); // clear setflag since coeff() called once with I,J = * * int n = atom->ntypes; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) setflag[i][j] = 0; // set setflag i,j for type pairs where both are mapped to elements int count = 0; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) if (map[i] >= 0 && map[j] >= 0) { setflag[i][j] = 1; count++; } if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); }
false
false
false
false
false
0
kill_how_often_add(struct kill *msg, const ev_uint32_t value) { if (++msg->how_often_length >= msg->how_often_num_allocated) { int tobe_allocated = msg->how_often_num_allocated; ev_uint32_t* new_data = NULL; tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1; new_data = (ev_uint32_t*) realloc(msg->how_often_data, tobe_allocated * sizeof(ev_uint32_t)); if (new_data == NULL) goto error; msg->how_often_data = new_data; msg->how_often_num_allocated = tobe_allocated; } msg->how_often_data[msg->how_often_length - 1] = value; msg->how_often_set = 1; return &(msg->how_often_data[msg->how_often_length - 1]); error: --msg->how_often_length; return (NULL); }
false
false
false
false
false
0
close_tab(HybridChatWindow *chat) { HybridConversation *conv; gint page_index; g_return_if_fail(chat != NULL); conv = chat->parent; page_index = gtk_notebook_page_num(GTK_NOTEBOOK(conv->notebook), chat->vbox); gtk_notebook_remove_page(GTK_NOTEBOOK(conv->notebook), page_index); conv->chat_buddies = g_slist_remove(conv->chat_buddies, chat); if (g_slist_length(conv->chat_buddies) == 1) { /* * We don't want to show the tabs any more * when we have only one tab left. */ gtk_notebook_set_show_tabs(GTK_NOTEBOOK(conv->notebook), FALSE); } /* TODO inplement a chat_window_destroy(). */ if (chat->input_source) { g_source_remove(chat->input_source); } g_free(chat->title); g_free(chat); if (conv->chat_buddies == NULL) { /* * Now we need to destroy the conversation window. * NOTE: We don't have to free the resource here, * it will be done in the callback function * of the window-destroy event. */ gtk_widget_destroy(conv->window); } }
false
false
false
false
false
0
RemoveMapping(const char* attributeName) { vtkInternal::VectorType::iterator iter; for (iter=this->Internal->Mappings.begin(); iter != this->Internal->Mappings.end(); ++iter) { if (iter->AttributeName == attributeName) { this->Internal->Mappings.erase(iter); return true; } } return false; }
false
false
false
false
false
0
file_cache_handler(request_rec *r) { a_file *match; int errstatus; int rc = OK; /* XXX: not sure if this is right yet * see comment in http_core.c:default_handler */ if (ap_strcmp_match(r->handler, "*/*")) { return DECLINED; } /* we don't handle anything but GET */ if (r->method_number != M_GET) return DECLINED; /* did xlat phase find the file? */ match = ap_get_module_config(r->request_config, &file_cache_module); if (match == NULL) { return DECLINED; } /* note that we would handle GET on this resource */ r->allowed |= (AP_METHOD_BIT << M_GET); /* This handler has no use for a request body (yet), but we still * need to read and discard it if the client sent one. */ if ((errstatus = ap_discard_request_body(r)) != OK) return errstatus; ap_update_mtime(r, match->finfo.mtime); /* ap_set_last_modified() always converts the file mtime to a string * which is slow. Accelerate the common case. * ap_set_last_modified(r); */ { apr_time_t mod_time; char *datestr; mod_time = ap_rationalize_mtime(r, r->mtime); if (mod_time == match->finfo.mtime) datestr = match->mtimestr; else { datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN); apr_rfc822_date(datestr, mod_time); } apr_table_setn(r->headers_out, "Last-Modified", datestr); } /* ap_set_content_length() always converts the same number and never * returns an error. Accelerate it. */ r->clength = match->finfo.size; apr_table_setn(r->headers_out, "Content-Length", match->sizestr); ap_set_etag(r); if ((errstatus = ap_meets_conditions(r)) != OK) { return errstatus; } /* Call appropriate handler */ if (!r->header_only) { if (match->is_mmapped == TRUE) rc = mmap_handler(r, match); else rc = sendfile_handler(r, match); } return rc; }
false
false
false
false
false
0
action_current_volume (Unit *unit, dpacket packet) { if (filesys_isvolume(unit)) PUT_PCK_RES1 (packet, unit->volume >> 2); else PUT_PCK_RES1 (packet, 0); }
false
false
false
false
false
0
ib_uverbs_remove_one(struct ib_device *device, void *client_data) { struct ib_uverbs_device *uverbs_dev = client_data; int wait_clients = 1; if (!uverbs_dev) return; dev_set_drvdata(uverbs_dev->dev, NULL); device_destroy(uverbs_class, uverbs_dev->cdev.dev); cdev_del(&uverbs_dev->cdev); if (uverbs_dev->devnum < IB_UVERBS_MAX_DEVICES) clear_bit(uverbs_dev->devnum, dev_map); else clear_bit(uverbs_dev->devnum - IB_UVERBS_MAX_DEVICES, overflow_map); if (device->disassociate_ucontext) { /* We disassociate HW resources and immediately return. * Userspace will see a EIO errno for all future access. * Upon returning, ib_device may be freed internally and is not * valid any more. * uverbs_device is still available until all clients close * their files, then the uverbs device ref count will be zero * and its resources will be freed. * Note: At this point no more files can be opened since the * cdev was deleted, however active clients can still issue * commands and close their open files. */ rcu_assign_pointer(uverbs_dev->ib_dev, NULL); ib_uverbs_free_hw_resources(uverbs_dev, device); wait_clients = 0; } if (atomic_dec_and_test(&uverbs_dev->refcount)) ib_uverbs_comp_dev(uverbs_dev); if (wait_clients) wait_for_completion(&uverbs_dev->comp); kobject_put(&uverbs_dev->kobj); }
false
false
false
false
false
0
readSettings() { KConfigGroup group(KGlobal::config(), "Colors"); QString collectionName = group.readEntry("CurrentPalette"); if (collectionName.isEmpty()) { collectionName = i18nc("palette name", colorCollectionName[fortyColorIndex].m_displayName); } else { for (int i = 0; colorCollectionName[i].m_fileName; ++i) { if (collectionName == colorCollectionName[i].m_displayName) { collectionName = i18nc("palette name", colorCollectionName[i].m_displayName); break; } } } d->table->setColors(collectionName); }
false
false
false
false
false
0
printFloatingPointConstants(const Constant *C) { // If this is a constant expression, recursively check for constant fp values. if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) printFloatingPointConstants(CE->getOperand(i)); return; } // Otherwise, check for a FP constant that we need to print. const ConstantFP *FPC = dyn_cast<ConstantFP>(C); if (FPC == 0 || // Do not put in FPConstantMap if safe. isFPCSafeToPrint(FPC) || // Already printed this constant? FPConstantMap.count(FPC)) return; FPConstantMap[FPC] = FPCounter; // Number the FP constants if (FPC->getType() == Type::getDoubleTy(FPC->getContext())) { double Val = FPC->getValueAPF().convertToDouble(); uint64_t i = FPC->getValueAPF().bitcastToAPInt().getZExtValue(); Out << "static const ConstantDoubleTy FPConstant" << FPCounter++ << " = 0x" << utohexstr(i) << "ULL; /* " << Val << " */\n"; } else if (FPC->getType() == Type::getFloatTy(FPC->getContext())) { float Val = FPC->getValueAPF().convertToFloat(); uint32_t i = (uint32_t)FPC->getValueAPF().bitcastToAPInt(). getZExtValue(); Out << "static const ConstantFloatTy FPConstant" << FPCounter++ << " = 0x" << utohexstr(i) << "U; /* " << Val << " */\n"; } else if (FPC->getType() == Type::getX86_FP80Ty(FPC->getContext())) { // api needed to prevent premature destruction APInt api = FPC->getValueAPF().bitcastToAPInt(); const uint64_t *p = api.getRawData(); Out << "static const ConstantFP80Ty FPConstant" << FPCounter++ << " = { 0x" << utohexstr(p[0]) << "ULL, 0x" << utohexstr((uint16_t)p[1]) << ",{0,0,0}" << "}; /* Long double constant */\n"; } else if (FPC->getType() == Type::getPPC_FP128Ty(FPC->getContext()) || FPC->getType() == Type::getFP128Ty(FPC->getContext())) { APInt api = FPC->getValueAPF().bitcastToAPInt(); const uint64_t *p = api.getRawData(); Out << "static const ConstantFP128Ty FPConstant" << FPCounter++ << " = { 0x" << utohexstr(p[0]) << ", 0x" << utohexstr(p[1]) << "}; /* Long double constant */\n"; } else { llvm_unreachable("Unknown float type!"); } }
false
false
false
false
true
1
slotFilterClear() { DEBUG_BLOCK m_searchEdit->setText( QString() ); }
false
false
false
false
false
0