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
Init() { static ClassDocumentation<O2AlphaS> documentation ("The O2AlphaS class implements the next-to-leading order alphaS in the same" " way as in FORTRAN HERWIG"); static Parameter<O2AlphaS,Energy> interfaceLambdaQCD ("LambdaQCD", "The value of Lambda QCD", &O2AlphaS::_lambdaQCD, MeV, 180.*MeV, 50.*MeV, 500.0*MeV, false, false, Interface::limited); static Switch<O2AlphaS,unsigned int> interfaceLambdaType ("LambdaType", "Which type of Lambda to use", &O2AlphaS::_copt, 0, false, false); static SwitchOption interfaceLambdaTypeMonteCarlo (interfaceLambdaType, "MonteCarlo", "Use a Monte Carlo scheme as in the FORTRAN program", 0); static SwitchOption interfaceLambdaTypeMSBar (interfaceLambdaType, "MSBar", "Use the MSBar scheme", 1); }
false
false
false
false
false
0
startLink( const Address &address ) { switch( address.type ) { case Address::resolvedNode: { unsigned long n; if( address.node->elementIndex( n ) == accessOK ) { GroveString id; address.node->getId( id ); unsigned long groveIndex = address.node->groveIndex(); linkStack.resize( linkStack.size() + 1 ); linkStack.back().crossRefInfo = new MifDoc::CrossRefInfo ( groveIndex, n, 0, MifDoc::CrossRefInfo::HypertextLink, id.data(), id.size() ); if( id.size() > 0 ) mifDoc.elements().setReferencedFlag ( MifDoc::ElementSet::LinkReference, groveIndex, StringC( id.data(), id.size() ) ); else mifDoc.elements().setReferencedFlag ( MifDoc::ElementSet::LinkReference, groveIndex, n ); } break; } case Address::idref: { const StringC &id = address.params[0]; size_t i; for( i = 0; i < id.size(); i++ ) if( id[i] == ' ') break; linkStack.resize( linkStack.size() + 1 ); linkStack.back().crossRefInfo = new MifDoc::CrossRefInfo ( address.node->groveIndex(), 0, 0, MifDoc::CrossRefInfo::HypertextLink, id.data(), i ); mifDoc.elements().setReferencedFlag ( MifDoc::ElementSet::LinkReference, address.node->groveIndex(), StringC( id.data(), i ) ); break; } case Address::none: default: linkStack.resize( linkStack.size() + 1 ); } }
false
false
false
false
false
0
fl_show_alert(const char *q1,const char *q2,const char *q3,int) { fl_alert("%s\n%s\n%s", q1?q1:"", q2?q2:"", q3?q3:""); }
false
false
false
false
false
0
bio_clone_fast(struct bio *bio, gfp_t gfp_mask, struct bio_set *bs) { struct bio *b; b = bio_alloc_bioset(gfp_mask, 0, bs); if (!b) return NULL; __bio_clone_fast(b, bio); if (bio_integrity(bio)) { int ret; ret = bio_integrity_clone(b, bio, gfp_mask); if (ret < 0) { bio_put(b); return NULL; } } return b; }
false
false
false
false
false
0
perf_sysenter_enable(struct trace_event_call *call) { int ret = 0; int num; num = ((struct syscall_metadata *)call->data)->syscall_nr; mutex_lock(&syscall_trace_lock); if (!sys_perf_refcount_enter) ret = register_trace_sys_enter(perf_syscall_enter, NULL); if (ret) { pr_info("event trace: Could not activate" "syscall entry trace point"); } else { set_bit(num, enabled_perf_enter_syscalls); sys_perf_refcount_enter++; } mutex_unlock(&syscall_trace_lock); return ret; }
false
false
false
false
false
0
gwy_graph_curve_model_get_x_range(GwyGraphCurveModel *gcmodel, gdouble *x_min, gdouble *x_max) { gdouble xmin, xmax; gboolean must_calculate = FALSE; gint i; g_return_val_if_fail(GWY_IS_GRAPH_CURVE_MODEL(gcmodel), FALSE); if (!gcmodel->n) return FALSE; if (x_min) { if (CTEST(gcmodel, XMIN)) *x_min = CVAL(gcmodel, XMIN); else must_calculate = TRUE; } if (x_max) { if (CTEST(gcmodel, XMAX)) *x_max = CVAL(gcmodel, XMAX); else must_calculate = TRUE; } if (!must_calculate) return TRUE; xmin = xmax = gcmodel->xdata[0]; for (i = 1; i < gcmodel->n; i++) { if (G_UNLIKELY(gcmodel->xdata[i] < xmin)) xmin = gcmodel->xdata[i]; if (G_LIKELY(gcmodel->xdata[i] > xmax)) xmax = gcmodel->xdata[i]; } CVAL(gcmodel, XMIN) = xmin; CVAL(gcmodel, XMAX) = xmax; gcmodel->cached |= CBIT(XMIN) | CBIT(XMAX); if (x_min) *x_min = xmin; if (x_max) *x_max = xmax; return TRUE; }
false
false
false
false
false
0
bo_open(struct radeon_bo_manager *bom, uint32_t handle, uint32_t size, uint32_t alignment, uint32_t domains, uint32_t flags) { struct radeon_bo_gem *bo; int r; bo = (struct radeon_bo_gem*)calloc(1, sizeof(struct radeon_bo_gem)); if (bo == NULL) { return NULL; } bo->base.bom = bom; bo->base.handle = 0; bo->base.size = size; bo->base.alignment = alignment; bo->base.domains = domains; bo->base.flags = flags; bo->base.ptr = NULL; atomic_set(&bo->reloc_in_cs, 0); bo->map_count = 0; if (handle) { struct drm_gem_open open_arg; memset(&open_arg, 0, sizeof(open_arg)); open_arg.name = handle; r = drmIoctl(bom->fd, DRM_IOCTL_GEM_OPEN, &open_arg); if (r != 0) { free(bo); return NULL; } bo->base.handle = open_arg.handle; bo->base.size = open_arg.size; bo->name = handle; } else { struct drm_radeon_gem_create args; args.size = size; args.alignment = alignment; args.initial_domain = bo->base.domains; args.flags = flags; args.handle = 0; r = drmCommandWriteRead(bom->fd, DRM_RADEON_GEM_CREATE, &args, sizeof(args)); bo->base.handle = args.handle; if (r) { fprintf(stderr, "Failed to allocate :\n"); fprintf(stderr, " size : %d bytes\n", size); fprintf(stderr, " alignment : %d bytes\n", alignment); fprintf(stderr, " domains : %d\n", bo->base.domains); free(bo); return NULL; } } radeon_bo_ref((struct radeon_bo*)bo); return (struct radeon_bo*)bo; }
false
false
false
false
false
0
check_acl_expr(char *expr, Parse_xml_error *err) { Acs_environment env; Acs_expr_result st; Expr_result result; acs_new_env(&env); acs_init_env(NULL, NULL, "", NULL, &env); env.do_eval = 0; st = acs_expr(expr, &env, &result); if (st == ACS_EXPR_SYNTAX_ERROR) { err->mesg = "Syntax error in predicate"; err->line = -1; err->pos = -1; return(-1); } if (st == ACS_EXPR_EVAL_ERROR) { err->mesg = "Evaluation error in predicate"; err->line = -1; err->pos = -1; return(-1); } if (st == ACS_EXPR_LEXICAL_ERROR) { err->mesg = "Lexical error in predicate"; err->line = -1; err->pos = -1; return(-1); } return(0); }
false
false
false
false
false
0
ipath_disarm_senderrbufs(struct ipath_devdata *dd) { u32 piobcnt; unsigned long sbuf[4]; /* * it's possible that sendbuffererror could have bits set; might * have already done this as a result of hardware error handling */ piobcnt = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k; /* read these before writing errorclear */ sbuf[0] = ipath_read_kreg64( dd, dd->ipath_kregs->kr_sendbuffererror); sbuf[1] = ipath_read_kreg64( dd, dd->ipath_kregs->kr_sendbuffererror + 1); if (piobcnt > 128) sbuf[2] = ipath_read_kreg64( dd, dd->ipath_kregs->kr_sendbuffererror + 2); if (piobcnt > 192) sbuf[3] = ipath_read_kreg64( dd, dd->ipath_kregs->kr_sendbuffererror + 3); else sbuf[3] = 0; if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) { int i; if (ipath_debug & (__IPATH_PKTDBG|__IPATH_DBG) && time_after(dd->ipath_lastcancel, jiffies)) { __IPATH_DBG_WHICH(__IPATH_PKTDBG|__IPATH_DBG, "SendbufErrs %lx %lx", sbuf[0], sbuf[1]); if (ipath_debug & __IPATH_PKTDBG && piobcnt > 128) printk(" %lx %lx ", sbuf[2], sbuf[3]); printk("\n"); } for (i = 0; i < piobcnt; i++) if (test_bit(i, sbuf)) ipath_disarm_piobufs(dd, i, 1); /* ignore armlaunch errs for a bit */ dd->ipath_lastcancel = jiffies+3; } }
false
false
false
false
false
0
Dispose() { i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); if (!ApiCheck(!isolate->IsInUse(), "v8::Isolate::Dispose()", "Disposing the isolate that is entered by a thread.")) { return; } isolate->TearDown(); }
false
false
false
false
false
0
find_ip_in_subnet(const struct ifaddrs *addrs, const struct sockaddr *net, unsigned int prefix_len) { switch (net->sa_family) { case AF_INET: return find_ipv4_in_subnet(addrs, (struct sockaddr_in*)net, prefix_len); case AF_INET6: return find_ipv6_in_subnet(addrs, (struct sockaddr_in6*)net, prefix_len); } return NULL; }
false
false
false
false
false
0
calcRestorePlacements(MachineBasicBlock* MBB, SmallVector<MachineBasicBlock*, 4> &blks, CSRegBlockMap &prevRestores) { bool placedRestores = false; // Intersect (CSRegs - AvailOut[S]) for S in Successors(MBB) CSRegSet availOutSucc; SmallVector<MachineBasicBlock*, 4> successors; for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) { MachineBasicBlock* SUCC = *SI; if (SUCC != MBB) successors.push_back(SUCC); } unsigned i = 0, e = successors.size(); if (i != e) { MachineBasicBlock* SUCC = successors[i]; availOutSucc = UsedCSRegs - AvailOut[SUCC]; for (++i; i != e; ++i) { SUCC = successors[i]; availOutSucc &= (UsedCSRegs - AvailOut[SUCC]); } } else { if (! CSRUsed[MBB].empty() || ! AvailOut[MBB].empty()) { // Handle uses in return blocks (which have no successors). // This is necessary because the DFA formulation assumes the // entry and (multiple) exit nodes cannot have CSR uses, which // is not the case in the real world. availOutSucc = UsedCSRegs; } } // Compute restores required at MBB: CSRRestore[MBB] |= (AvailOut[MBB] - AnticOut[MBB]) & availOutSucc; // Postprocess restore placements at MBB. // Remove the CSRs that are restored in the return blocks. // Lest this be confusing, note that: // CSRSave[EntryBlock] == CSRRestore[B] for all B in ReturnBlocks. if (MBB->succ_size() && ! CSRRestore[MBB].empty()) { if (! CSRSave[EntryBlock].empty()) CSRRestore[MBB] = CSRRestore[MBB] - CSRSave[EntryBlock]; } placedRestores = (CSRRestore[MBB] != prevRestores[MBB]); prevRestores[MBB] = CSRRestore[MBB]; // Remember this block for adding saves to predecessor // blocks for multi-entry region. if (placedRestores) blks.push_back(MBB); DEBUG(if (! CSRRestore[MBB].empty() && ShrinkWrapDebugging >= Iterations) dbgs() << "RESTORE[" << getBasicBlockName(MBB) << "] = " << stringifyCSRegSet(CSRRestore[MBB]) << "\n"); return placedRestores; }
false
false
false
false
false
0
parseAttribute(AttributeImpl* attr) { switch(attr->id()) { case ATTR_CHALLENGE: break; default: // skip HTMLSelectElementImpl parsing! HTMLGenericFormElementImpl::parseAttribute(attr); } }
false
false
false
false
false
0
actorMachineGun (edict_t *self) { vec3_t start, target; vec3_t forward, right; AngleVectors (self->s.angles, forward, right, NULL); G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_ACTOR_MACHINEGUN_1], forward, right, start); if (self->enemy) { if (self->enemy->health > 0) { VectorMA (self->enemy->s.origin, -0.2, self->enemy->velocity, target); target[2] += self->enemy->viewheight; } else { VectorCopy (self->enemy->absmin, target); target[2] += (self->enemy->size[2] / 2); } VectorSubtract (target, start, forward); VectorNormalize (forward); } else { AngleVectors (self->s.angles, forward, NULL, NULL); } monster_fire_bullet (self, start, forward, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_ACTOR_MACHINEGUN_1); }
false
false
false
false
false
0
buildIndexArray(void *objArray, int numObjs, Size objSize) { DumpableObject **ptrs; int i; ptrs = (DumpableObject **) malloc(numObjs * sizeof(DumpableObject *)); for (i = 0; i < numObjs; i++) ptrs[i] = (DumpableObject *) ((char *) objArray + i * objSize); /* We can use DOCatalogIdCompare to sort since its first key is OID */ if (numObjs > 1) qsort((void *) ptrs, numObjs, sizeof(DumpableObject *), DOCatalogIdCompare); return ptrs; }
false
false
false
false
false
0
dis_format(const struct msp430_instruction *insn) { int len = 0; const char *opname = dis_opcode_name(insn->op); const char *suffix = ""; if (!opname) opname = "???"; if (insn->dsize == MSP430_DSIZE_BYTE) suffix = ".B"; else if (insn->dsize == MSP430_DSIZE_AWORD) suffix = ".A"; else if (insn->dsize == MSP430_DSIZE_UNKNOWN) suffix = ".?"; /* Don't show the .A suffix for these instructions */ if (insn->op == MSP430_OP_MOVA || insn->op == MSP430_OP_CMPA || insn->op == MSP430_OP_SUBA || insn->op == MSP430_OP_ADDA || insn->op == MSP430_OP_BRA || insn->op == MSP430_OP_RETA) suffix = ""; len += printc("\x1b[36m%s%s\x1b[0m", opname, suffix); while (len < 8) len += printc(" "); /* Source operand */ if (insn->itype == MSP430_ITYPE_DOUBLE) { len += format_operand(insn->src_mode, insn->src_addr, insn->src_reg); printc(","); while (len < 15) len += printc(" "); printc(" "); } /* Destination operand */ if (insn->itype != MSP430_ITYPE_NOARG) len += format_operand(insn->dst_mode, insn->dst_addr, insn->dst_reg); /* Repetition count */ if (insn->rep_register) len += printc(" [repeat %s]", dis_reg_name(insn->rep_index)); else if (insn->rep_index) len += printc(" [repeat %d]", insn->rep_index + 1); return len; }
false
false
false
false
false
0
symdef(cbuf,SymbolProps) char *cbuf; HEADLIST *SymbolProps; { /* * BEGIN SYMBOL DEFINITION */ int i; int index; int type; if (TOLWR) strlwr(cbuf); CurrentLayer = CurrentDataType = CurrentAttribute = -1; /* search for symbol number */ index = struct_index(cbuf); strcpy(CurrentSymbol,cbuf); #ifdef MSDOS { char *c; SymDesc = open_symbol(c = alias(cbuf)); if (!strcmp(c,cbuf)) printf("Converting: %s\n",cbuf); else printf("Converting: %-30s(new name: %s)\n",cbuf,c);} #else SymDesc = open_symbol(cbuf); printf("Converting: %s\n",cbuf); #endif /* test for RootSymbol */ if (Root_flag) { if (strcmp(RootSymbol,cbuf) == 0) RootSymbolNumber = index; } /* add the symbol property list */ while (SymbolProps != NULL) { fprintf(SymDesc,"5 %d %s;\n",SymbolProps->hd_RecordType, SymbolProps->hd_Text); SymbolProps = SymbolProps->hd_Succ; } fprintf(SymDesc,"9 %s;\n",cbuf); fprintf(SymDesc,"DS %d 1 1;\n",index); fprintf(SymDesc,"( CREATION DATE "); for (i = 0; i < 6; ++i) fprintf(SymDesc,"%d ",struct_dates[i]); fprintf(SymDesc,": MOD DATE "); for (i = 0; i < 6; ++i) fprintf(SymDesc,"%d ",struct_dates[i+6]); fprintf(SymDesc,");\n"); /* * loop through records and exit on ENDSTR */ while ((type = get_record(cbuf)) != ENDSTR) { switch(type) { case BOUNDARY: s_bndry(cbuf); break; case PATH: s_path(cbuf); break; case SREF: s_sref(cbuf); break; case AREF: s_aref(cbuf); break; case TEXT: s_text(cbuf); break; case SNAPNODE: /* * snapnodes are not used */ while ((type = get_record(cbuf)) != 17) ; break; default: err_fatal_2("Illegal record type",type); } } }
false
false
false
false
true
1
show_toggle (CmdConfig *cmd_config, CameraWidget *toggle) { CDKITEMLIST *list = NULL; int value, selection; const char *label; char title[1024], *info[] = {N_("Yes"), N_("No")}; CHECK (gp_widget_get_value (toggle, &value)); CHECK (gp_widget_get_label (toggle, &label)); snprintf (title, sizeof (title), "<C></5>%s", label); list = newCDKItemlist (cmd_config->screen, CENTER, CENTER, title, "", info, 2, 1 - value, TRUE, FALSE); if (!list) return (GP_ERROR); selection = activateCDKItemlist (list, 0); if (list->exitType == vNORMAL) { selection = 1 - selection; gp_widget_set_value (toggle, &selection); set_config (cmd_config); } destroyCDKItemlist (list); return (GP_OK); }
false
false
false
false
false
0
fc_fcp_init(struct fc_lport *lport) { int rc; struct fc_fcp_internal *si; if (!lport->tt.fcp_cmd_send) lport->tt.fcp_cmd_send = fc_fcp_cmd_send; if (!lport->tt.fcp_cleanup) lport->tt.fcp_cleanup = fc_fcp_cleanup; if (!lport->tt.fcp_abort_io) lport->tt.fcp_abort_io = fc_fcp_abort_io; si = kzalloc(sizeof(struct fc_fcp_internal), GFP_KERNEL); if (!si) return -ENOMEM; lport->scsi_priv = si; si->max_can_queue = lport->host->can_queue; INIT_LIST_HEAD(&si->scsi_pkt_queue); spin_lock_init(&si->scsi_queue_lock); si->scsi_pkt_pool = mempool_create_slab_pool(2, scsi_pkt_cachep); if (!si->scsi_pkt_pool) { rc = -ENOMEM; goto free_internal; } return 0; free_internal: kfree(si); return rc; }
false
false
false
false
false
0
alc5623_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct alc5623_platform_data *pdata; struct alc5623_priv *alc5623; struct device_node *np; unsigned int vid1, vid2; int ret; u32 val32; alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), GFP_KERNEL); if (alc5623 == NULL) return -ENOMEM; alc5623->regmap = devm_regmap_init_i2c(client, &alc5623_regmap); if (IS_ERR(alc5623->regmap)) { ret = PTR_ERR(alc5623->regmap); dev_err(&client->dev, "Failed to initialise I/O: %d\n", ret); return ret; } ret = regmap_read(alc5623->regmap, ALC5623_VENDOR_ID1, &vid1); if (ret < 0) { dev_err(&client->dev, "failed to read vendor ID1: %d\n", ret); return ret; } ret = regmap_read(alc5623->regmap, ALC5623_VENDOR_ID2, &vid2); if (ret < 0) { dev_err(&client->dev, "failed to read vendor ID2: %d\n", ret); return ret; } vid2 >>= 8; if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) { dev_err(&client->dev, "unknown or wrong codec\n"); dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n", 0x10ec, id->driver_data, vid1, vid2); return -ENODEV; } dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2); pdata = client->dev.platform_data; if (pdata) { alc5623->add_ctrl = pdata->add_ctrl; alc5623->jack_det_ctrl = pdata->jack_det_ctrl; } else { if (client->dev.of_node) { np = client->dev.of_node; ret = of_property_read_u32(np, "add-ctrl", &val32); if (!ret) alc5623->add_ctrl = val32; ret = of_property_read_u32(np, "jack-det-ctrl", &val32); if (!ret) alc5623->jack_det_ctrl = val32; } } alc5623->id = vid2; switch (alc5623->id) { case 0x21: alc5623_dai.name = "alc5621-hifi"; break; case 0x22: alc5623_dai.name = "alc5622-hifi"; break; case 0x23: alc5623_dai.name = "alc5623-hifi"; break; default: return -EINVAL; } i2c_set_clientdata(client, alc5623); ret = snd_soc_register_codec(&client->dev, &soc_codec_device_alc5623, &alc5623_dai, 1); if (ret != 0) dev_err(&client->dev, "Failed to register codec: %d\n", ret); return ret; }
false
false
false
false
false
0
print(STD_NAMESPACE ostream &stream, const size_t maxLength) const { OFString printString; if ((maxLength > 3) && (Value.length() > maxLength)) stream << "\"" << DSRTypes::convertToPrintString(Value.substr(0, maxLength - 3), printString) << "...\""; else stream << "\"" << DSRTypes::convertToPrintString(Value, printString) << "\""; }
false
false
false
false
false
0
print_xml_tag(FILE * xml_file, const char* sbeg, const char* line_end, const char* tag_name, const char* first_attribute_name, ...) { va_list arg_list; const char *attribute_name, *attribute_value; fputs(sbeg, xml_file); fputc('<', xml_file); fputs(tag_name, xml_file); va_start(arg_list, first_attribute_name); attribute_name= first_attribute_name; while (attribute_name != NullS) { attribute_value= va_arg(arg_list, char *); DBUG_ASSERT(attribute_value != NullS); fputc(' ', xml_file); fputs(attribute_name, xml_file); fputc('\"', xml_file); print_quoted_xml(xml_file, attribute_value, strlen(attribute_value), 0); fputc('\"', xml_file); attribute_name= va_arg(arg_list, char *); } va_end(arg_list); fputc('>', xml_file); fputs(line_end, xml_file); check_io(xml_file); }
false
false
false
false
false
0
ensure_mkdir (const char *path, mode_t mode) { struct stat st; if (stat (path, &st)) return errno != ENOENT ? errno : (mkdir (path, mode) ? errno : 0); if (!S_ISDIR (st.st_mode)) return mkdir (path, mode) ? errno : 0; /* should be an error */ return 0; }
false
false
false
false
false
0
description_set_func (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { gchar *description; CcKeyboardItem *item; ShortcutType type; gtk_tree_model_get (model, iter, DETAIL_DESCRIPTION_COLUMN, &description, DETAIL_KEYENTRY_COLUMN, &item, DETAIL_TYPE_COLUMN, &type, -1); if (type == SHORTCUT_TYPE_XKB_OPTION) { g_object_set (cell, "text", description, NULL); } else { if (item != NULL) g_object_set (cell, "editable", FALSE, "text", item->description != NULL ? item->description : _("<Unknown Action>"), NULL); else g_object_set (cell, "editable", FALSE, NULL); } g_free (description); }
false
false
false
false
false
0
help_item_zoom(GtkTreePath *path) { GtkTreeModel *model; GtkTreeIter it, child, item; GtkTreeSelection *selection; model = gtk_tree_view_get_model(GTK_TREE_VIEW(help_view)); gtk_tree_model_get_iter(model, &item, path); for (child=item; gtk_tree_model_iter_parent(model, &it, &child); child=it) { GtkTreePath *it_path; it_path = gtk_tree_model_get_path(model, &it); gtk_tree_view_expand_row(GTK_TREE_VIEW(help_view), it_path, TRUE); gtk_tree_path_free(it_path); } selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(help_view)); gtk_tree_selection_select_iter(selection, &item); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(help_view), path, NULL, TRUE, 0.0, 0.0); }
false
false
false
false
false
0
gwy_app_add_main_accel_group(GtkWindow *window) { GtkWidget *main_window; GtkAccelGroup *accel_group; g_return_if_fail(GTK_IS_WINDOW(window)); main_window = gwy_app_main_window_get(); if (!main_window) return; g_return_if_fail(GTK_IS_WINDOW(main_window)); accel_group = GTK_ACCEL_GROUP(g_object_get_data(G_OBJECT(main_window), "accel_group")); if (accel_group) gtk_window_add_accel_group(window, accel_group); }
false
false
false
false
false
0
get_biased_reg (dont_begin_colors, bias, prefer_colors, free_colors, mode) HARD_REG_SET dont_begin_colors, bias, prefer_colors, free_colors; enum machine_mode mode; { int c = -1; HARD_REG_SET s; if (flag_ra_biased) { COPY_HARD_REG_SET (s, dont_begin_colors); IOR_COMPL_HARD_REG_SET (s, bias); IOR_COMPL_HARD_REG_SET (s, prefer_colors); c = get_free_reg (s, free_colors, mode); if (c >= 0) return c; COPY_HARD_REG_SET (s, dont_begin_colors); IOR_COMPL_HARD_REG_SET (s, bias); c = get_free_reg (s, free_colors, mode); if (c >= 0) return c; } COPY_HARD_REG_SET (s, dont_begin_colors); IOR_COMPL_HARD_REG_SET (s, prefer_colors); c = get_free_reg (s, free_colors, mode); if (c >= 0) return c; c = get_free_reg (dont_begin_colors, free_colors, mode); return c; }
false
false
false
false
false
0
type_engine_check_reserved( Chuck_Env * env, const string & xid, int pos ) { // key word? if( env->key_words[xid] ) { EM_error2( pos, "illegal use of keyword '%s'.", xid.c_str() ); return TRUE; } // key value? if( env->key_values[xid] ) { EM_error2( pos, "illegal re-declaration of reserved value '%s'.", xid.c_str() ); return TRUE; } // key type? if( env->key_types[xid] ) { EM_error2( pos, "illegal use of reserved type id '%s'.", xid.c_str() ); return TRUE; } return FALSE; }
false
false
false
false
false
0
calcMEcorr(int MEtype, int idMother, int idDaughterIn, double M2, double z, double Q2) { // Convert to Mandelstam variables. Sometimes may need to swap later. double sH = M2 / z; double tH = -Q2; double uH = Q2 - M2 * (1. - z) / z; int idMabs = abs(idMother); int idDabs = abs(idDaughterIn); // Corrections for f + fbar -> s-channel vector boson. if (MEtype == 1) { if (idMabs < 20 && idDabs < 20) { return (tH*tH + uH*uH + 2. * M2 * sH) / (sH*sH + M2*M2); } else if (idDabs < 20) { // g(gamma) f -> V f': -Q2 = (p_g - p_f')^2 in PS while // tHat = (p_f - p_f')^2 in ME so need to swap tHat <-> uHat. swap( tH, uH); return (sH*sH + uH*uH + 2. * M2 * tH) / (pow2(sH - M2) + M2*M2); } // Corrections for g + g -> Higgs boson. } else if (MEtype == 2) { if (idMabs < 20 && idDabs > 20) { return (sH*sH + uH*uH) / (sH*sH + pow2(sH - M2)); } else if (idDabs > 20) { return 0.5 * (pow4(sH) + pow4(tH) + pow4(uH) + pow4(M2)) / pow2(sH*sH - M2 * (sH - M2)); } // Corrections for f + fbar -> Higgs boson (f = b mainly). } else if (MEtype == 3) { if (idMabs < 20 && idDabs < 20) { // The PS and ME answers agree for f fbar -> H g/gamma. return 1.; } else if (idDabs < 20) { // Need to swap tHat <-> uHat, cf. vector-boson production above. swap( tH, uH); return (sH*sH + uH*uH + 2. * (M2 - uH) * (M2 - sH)) / (pow2(sH - M2) + M2*M2); } } return 1.; }
false
false
false
false
false
0
build_printer_driver_clist(void) { int i; int current_idx = 0; gtk_clist_clear(GTK_CLIST(printer_driver)); for (i = 0; i < stp_printer_model_count (); i ++) { const stp_printer_t *the_printer = stp_get_printer_by_index (i); if (strcmp(manufacturer, stp_printer_get_manufacturer(the_printer)) == 0) { gchar *tmp=g_strdup(gettext(stp_printer_get_long_name(the_printer))); /* * FIXME Somehow if the raw printer comes before any of the * "real" printers in the list of printers created in module.c, * this code barfs on any of those printers added later. For * example, try listing olympus_LTX_stpi_module_data after * raw_LTX_stpi_module_data. */ gtk_clist_insert (GTK_CLIST (printer_driver), current_idx, &tmp); gtk_clist_set_row_data (GTK_CLIST (printer_driver), current_idx, gint2p(i)); g_free(tmp); current_idx++; } } }
false
false
false
false
false
0
unpack_restart(int nlocal, int nth) { // ipage = NULL if being called from granular pair style init() if (ipage == NULL) allocate_pages(); // skip to Nth set of extra values double **extra = atom->extra; int m = 0; for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]); m++; // allocate new chunks from ipage,dpage for incoming values npartner[nlocal] = static_cast<int> (extra[nlocal][m++]); maxtouch = MAX(maxtouch,npartner[nlocal]); partner[nlocal] = ipage->get(npartner[nlocal]); shearpartner[nlocal] = dpage->get(npartner[nlocal]); for (int n = 0; n < npartner[nlocal]; n++) { partner[nlocal][n] = static_cast<int> (extra[nlocal][m++]); shearpartner[nlocal][n][0] = extra[nlocal][m++]; shearpartner[nlocal][n][1] = extra[nlocal][m++]; shearpartner[nlocal][n][2] = extra[nlocal][m++]; } }
false
false
false
true
false
1
one_of_both_attackable(int pos, int what) { UNUSED(pos); return (all_data[what].reason1 == DEFEND_STRING && all_data[what].reason2 == DEFEND_STRING && (worm[all_data[what].what1].attack_codes[0] != 0 || worm[all_data[what].what2].attack_codes[0] != 0)); }
false
false
false
false
false
0
printIndexPulldown( F_NameTable * pNameTable, FLMUINT uiSelectedIndex, FLMBOOL bIncludeNoIndex, FLMBOOL bIncludeChooseBestIndex, FLMBOOL bPrintSelect, const char * pszExtra) { FLMUINT uiNextPos; char szNameBuf[ 128]; FLMUINT uiId; FLMUINT uiType; fnPrintf( m_pHRequest, "<select name=\"index\" %s>\n", (char *)(pszExtra ? pszExtra : (char *)"")); if (bPrintSelect) { uiSelectedIndex = 0; printSelectOption( 0, 0, "Select An Index", FALSE); } if (bIncludeChooseBestIndex) { printSelectOption( uiSelectedIndex, FLM_SELECT_INDEX, "Let DB Optimize"); } if (bIncludeNoIndex) { printSelectOption( uiSelectedIndex, 0, "No Index"); } printSelectOption( uiSelectedIndex, FLM_DICT_INDEX, "Dictionary"); if( !pNameTable) { goto Exit; } uiNextPos = 0; while( pNameTable->getNextTagNameOrder( &uiNextPos, NULL, szNameBuf, sizeof( szNameBuf), &uiId, &uiType)) { if( uiType != FLM_INDEX_TAG) { continue; } printSelectOption( uiSelectedIndex, uiId, (char *)szNameBuf); } Exit: fnPrintf( m_pHRequest, "</select>\n"); }
false
false
false
false
false
0
time_of_day(void *instance, REQUEST *req, VALUE_PAIR *request, VALUE_PAIR *check, VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs) { int scan; int hhmmss, when; char *p; struct tm *tm, s_tm; instance = instance; request = request; /* shut the compiler up */ check_pairs = check_pairs; reply_pairs = reply_pairs; /* * Must be called with a request pointer. */ if (!req) return -1; if (strspn(check->vp_strvalue, "0123456789: ") != strlen(check->vp_strvalue)) { DEBUG("rlm_logintime: Bad Time-Of-Day value \"%s\"", check->vp_strvalue); return -1; } tm = localtime_r(&req->timestamp, &s_tm); hhmmss = (tm->tm_hour * 3600) + (tm->tm_min * 60) + tm->tm_sec; /* * Time of day is a 24-hour clock */ p = check->vp_strvalue; scan = atoi(p); p = strchr(p, ':'); if ((scan > 23) || !p) { DEBUG("rlm_logintime: Bad Time-Of-Day value \"%s\"", check->vp_strvalue); return -1; } when = scan * 3600; p++; scan = atoi(p); if (scan > 59) { DEBUG("rlm_logintime: Bad Time-Of-Day value \"%s\"", check->vp_strvalue); return -1; } when += scan * 60; p = strchr(p, ':'); if (p) { scan = atoi(p + 1); if (scan > 59) { DEBUG("rlm_logintime: Bad Time-Of-Day value \"%s\"", check->vp_strvalue); return -1; } when += scan; } fprintf(stderr, "returning %d - %d\n", hhmmss, when); return hhmmss - when; }
false
false
false
false
true
1
is_dos_partition(int t) { return (t == 1 || t == 4 || t == 6 || t == 0x0b || t == 0x0c || t == 0x0e || t == 0x11 || t == 0x12 || t == 0x14 || t == 0x16 || t == 0x1b || t == 0x1c || t == 0x1e || t == 0x24 || t == 0xc1 || t == 0xc4 || t == 0xc6); }
false
false
false
false
false
0
iwl_mvm_leds_init(struct iwl_mvm *mvm) { int mode = iwlwifi_mod_params.led_mode; int ret; switch (mode) { case IWL_LED_BLINK: IWL_ERR(mvm, "Blink led mode not supported, used default\n"); case IWL_LED_DEFAULT: case IWL_LED_RF_STATE: mode = IWL_LED_RF_STATE; break; case IWL_LED_DISABLE: IWL_INFO(mvm, "Led disabled\n"); return 0; default: return -EINVAL; } mvm->led.name = kasprintf(GFP_KERNEL, "%s-led", wiphy_name(mvm->hw->wiphy)); mvm->led.brightness_set = iwl_led_brightness_set; mvm->led.max_brightness = 1; if (mode == IWL_LED_RF_STATE) mvm->led.default_trigger = ieee80211_get_radio_led_name(mvm->hw); ret = led_classdev_register(mvm->trans->dev, &mvm->led); if (ret) { kfree(mvm->led.name); IWL_INFO(mvm, "Failed to enable led\n"); return ret; } return 0; }
false
false
false
false
false
0
HCPquery_encode_header(comp_model_t model_type, model_info * m_info, comp_coder_t coder_type, comp_info * c_info) { CONSTR(FUNC, "HCPquery_encode_header"); /* for HERROR */ int32 coder_len=2; /* # of bytes to encode coder information (2 minimum) */ int32 model_len=2; /* # of bytes to encode model information (2 minimum) */ int32 ret_value=SUCCEED; /* clear error stack and validate args */ HEclear(); if (m_info==NULL || c_info==NULL) HGOTO_ERROR(DFE_ARGS, FAIL); /* add any additional information needed for modeling type */ switch (model_type) { default: /* no additional information needed */ break; } /* end switch */ /* add any additional information needed for coding type */ switch (coder_type) { case COMP_CODE_NBIT: /* N-bit coding needs 16 bytes of info */ coder_len+=16; break; case COMP_CODE_SKPHUFF: /* Skipping Huffman coding needs 8 bytes of info */ coder_len+=8; break; case COMP_CODE_DEFLATE: /* Deflation coding stores deflation level */ coder_len+=2; break; case COMP_CODE_SZIP: /* Szip coding stores various szip parameters */ coder_len += 14; break; case COMP_CODE_IMCOMP: /* IMCOMP is no longer supported, can only be inquired */ HRETURN_ERROR(DFE_BADCODER, FAIL); break; default: /* no additional information needed */ break; } /* end switch */ ret_value=model_len+coder_len; done: if(ret_value == FAIL) { /* Error condition cleanup */ } /* end if */ /* Normal function cleanup */ return ret_value; }
false
false
false
false
false
0
mlx4_master_comm_channel(struct work_struct *work) { struct mlx4_mfunc_master_ctx *master = container_of(work, struct mlx4_mfunc_master_ctx, comm_work); struct mlx4_mfunc *mfunc = container_of(master, struct mlx4_mfunc, master); struct mlx4_priv *priv = container_of(mfunc, struct mlx4_priv, mfunc); struct mlx4_dev *dev = &priv->dev; __be32 *bit_vec; u32 comm_cmd; u32 vec; int i, j, slave; int toggle; int served = 0; int reported = 0; u32 slt; bit_vec = master->comm_arm_bit_vector; for (i = 0; i < COMM_CHANNEL_BIT_ARRAY_SIZE; i++) { vec = be32_to_cpu(bit_vec[i]); for (j = 0; j < 32; j++) { if (!(vec & (1 << j))) continue; ++reported; slave = (i * 32) + j; comm_cmd = swab32(readl( &mfunc->comm[slave].slave_write)); slt = swab32(readl(&mfunc->comm[slave].slave_read)) >> 31; toggle = comm_cmd >> 31; if (toggle != slt) { if (master->slave_state[slave].comm_toggle != slt) { pr_info("slave %d out of sync. read toggle %d, state toggle %d. Resynching.\n", slave, slt, master->slave_state[slave].comm_toggle); master->slave_state[slave].comm_toggle = slt; } mlx4_master_do_cmd(dev, slave, comm_cmd >> 16 & 0xff, comm_cmd & 0xffff, toggle); ++served; } } } if (reported && reported != served) mlx4_warn(dev, "Got command event with bitmask from %d slaves but %d were served\n", reported, served); if (mlx4_ARM_COMM_CHANNEL(dev)) mlx4_warn(dev, "Failed to arm comm channel events\n"); }
false
false
false
false
false
0
GetPropertyExpanded(const wxString& key) { const long len = SendMsg(SCI_GETPROPERTYEXPANDED, (sptr_t)(const char*)wx2sci(key), 0); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); char* buf = (char*)mbuf.GetWriteBuf(len+1); SendMsg(SCI_GETPROPERTYEXPANDED, (sptr_t)(const char*)wx2sci(key), (uptr_t)buf); mbuf.UngetWriteBuf(len); mbuf.AppendByte(0); return sci2wx(buf); }
false
false
false
false
false
0
push_intersection_point(double x1, double y1, double a1, double x2, double y2, double a2) { double c1, c2, s1, s2, d, b1, b2; _point *val; c1 = Cos(a1); s1 = Sin(a1); c2 = Cos(a2); s2 = Sin(a2); d = det2(c1, c2, s1, s2); if (ZERO(d)) runtime_error(_("parallel lines")); b1 = det2(x1, y1, c1, s1); b2 = det2(x2, y2, c2, s2); get_mem(val, _point); val->x = det2(c1, c2, b1, b2)/d; val->y = det2(s1, s2, b1, b2)/d; PSH(val); }
false
false
false
false
false
0
elm_8node_brick_isoline ( double K, double *F, double *C,double *X,double *Y,double *Z,line_t *Line ) { double f[4],c[4],x[4],y[4],z[4]; int i, j, k, n=0, above=0; for( i=0; i<8; i++ ) above += F[i]>K; if ( above == 0 || above == 8 ) return 0; for( i=0; i<6; i++ ) { for( j=0; j<4; j++ ) { k = ElmBrickFace[i][j]; f[j] = F[k]; c[j] = C[k]; x[j] = X[k]; y[j] = Y[k]; z[j] = Z[k]; } n += elm_4node_quad_isoline( K,f,c,x,y,z,&Line[n] ); } return n; }
false
false
false
false
false
0
shmem_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); int err; /* * If this is a request for a synthetic attribute in the system.* * namespace use the generic infrastructure to resolve a handler * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) return generic_setxattr(dentry, name, value, size, flags); err = shmem_xattr_validate(name); if (err) return err; return simple_xattr_set(&info->xattrs, name, value, size, flags); }
false
false
false
false
false
0
valval_fl(Value *val, const char *file, int line) { Value *result; struct timeval tv; if (val->type != TYPE_ID) return val; if (!(result = hgetnearestvarval(val))) { result = newSstr_fl(blankline, file, line); } else { switch (result->type & TYPES_BASIC) { case TYPE_ENUM: case TYPE_POS: case TYPE_INT: result = newint_fl(result->u.ival, file, line); break; case TYPE_DECIMAL: case TYPE_DTIME: case TYPE_ATIME: if (valtime(&tv, result)) result = newtime_fl(tv.tv_sec, tv.tv_usec, result->type, file, line); else result = NULL; break; case TYPE_FLOAT: result = newfloat_fl(valfloat(result), file, line); break; default: result = newSstr_fl(valstr(result), file, line); break; } } freeval(val); return result; }
false
false
false
false
true
1
totem_pl_parser_add_smil_with_data (TotemPlParser *parser, GFile *file, GFile *base_file, const char *contents, int size) { xml_node_t* doc; TotemPlParserResult retval; char *contents_dup; contents_dup = g_strndup (contents, size); doc = totem_pl_parser_parse_xml_relaxed (contents_dup, size); if (doc == NULL) { g_free (contents_dup); return TOTEM_PL_PARSER_RESULT_ERROR; } retval = totem_pl_parser_add_smil_with_doc (parser, file, base_file, doc); g_free (contents_dup); xml_parser_free_tree (doc); return retval; }
false
false
false
false
false
0
i40e_get_ethtool_fdir_all(struct i40e_pf *pf, struct ethtool_rxnfc *cmd, u32 *rule_locs) { struct i40e_fdir_filter *rule; struct hlist_node *node2; int cnt = 0; /* report total rule count */ cmd->data = i40e_get_fd_cnt_all(pf); hlist_for_each_entry_safe(rule, node2, &pf->fdir_filter_list, fdir_node) { if (cnt == cmd->rule_cnt) return -EMSGSIZE; rule_locs[cnt] = rule->fd_id; cnt++; } cmd->rule_cnt = cnt; return 0; }
false
false
false
false
false
0
print_separability(FILE * fd, struct Cluster *C) { int c1, c2; int first, last; double I_cluster_separation(); double q; I_cluster_sum2(C); fprintf(fd, _("\nclass separability matrix\n\n")); for (first = 0; first < C->nclasses; first = last) { last = first + 10; if (last > C->nclasses) last = C->nclasses; fprintf(fd, "\n "); for (c2 = first; c2 < last; c2++) fprintf(fd, " %3d", c2 + 1); fprintf(fd, "\n\n"); for (c1 = first; c1 < C->nclasses; c1++) { fprintf(fd, "%3d ", c1 + 1); for (c2 = first; c2 <= c1 && c2 < last; c2++) { q = I_cluster_separation(C, c1, c2); if (q == 0.0) fprintf(fd, " %5d", 0); else if (q > 0.0) fprintf(fd, " %5.1f", q); else fprintf(fd, " --- "); } fprintf(fd, "\n"); } fprintf(fd, "\n"); } return 0; }
false
false
false
false
false
0
doProcess() { // Wrapper to getObservation mrpt::obs::CObservationWirelessPowerPtr outObservation = mrpt::obs::CObservationWirelessPower::Create(); getObservation(*outObservation); appendObservation(mrpt::obs::CObservationWirelessPowerPtr(new mrpt::obs::CObservationWirelessPower(*outObservation))); }
false
false
false
false
false
0
getSHMMAX() { ulong shmmax = 0; #if linux FILE *fd = fopen("/proc/sys/kernel/shmmax", "r"); if (fd) { if( fscanf(fd, "%lu", &shmmax) != 1) shmmax = 0x2000000; fclose(fd); } else { /* * A problem here ... SHMMAX is defined in linux/shm.h, * but if we include that, all hell breaks loose with * redefined structures. */ shmmax = 0x2000000; } #endif if (shmmax == 0) { #if defined(SHMMAX) shmmax = SHMMAX; #else /* wishful thinking... 256 Meg */ shmmax = (1 << 28); #endif } return shmmax; }
false
false
false
false
true
1
dump(ostream&o, unsigned ind) const { o << setw(ind) << "" << "release "; dump_lval(o); o << "; /* " << get_fileline() << " */" << endl; }
false
false
false
false
false
0
sa_teardown_all(void) { int i; struct sa *sa, *next = 0; LOG_DBG((LOG_SA, 70, "sa_teardown_all:")); /* Get Phase 2 SAs. */ for (i = 0; i <= bucket_mask; i++) for (sa = LIST_FIRST(&sa_tab[i]); sa; sa = next) { next = LIST_NEXT(sa, link); if (sa->phase == 2) { /* * Teardown the phase 2 SAs by name, similar * to ui_teardown. */ LOG_DBG((LOG_SA, 70, "sa_teardown_all: tearing down SA %s", sa->name)); connection_teardown(sa->name); sa_delete(sa, 1); } } }
false
false
false
false
false
0
esas2r_calc_byte_cksum(void *addr, u32 len, u8 seed) { u8 *p = (u8 *)addr; u8 cksum = seed; while (len--) cksum = cksum + p[len]; return cksum; }
false
false
false
false
false
0
printDoc(const char* projname, const char* docdev, const char* faustversion) { gDocDevSuffix = docdev; /** File stuff : create doc directories and a tex file. */ //cerr << "Documentator : printDoc : gFaustDirectory = '" << gFaustDirectory << "'" << endl; //cerr << "Documentator : printDoc : gFaustSuperDirectory = '" << gFaustSuperDirectory << "'" << endl; //cerr << "Documentator : printDoc : gFaustSuperSuperDirectory = '" << gFaustSuperSuperDirectory << "'" << endl; //cerr << "Documentator : printDoc : gCurrentDir = '" << gCurrentDir << "'" << endl; makedir(projname); // create a top directory to store files string svgTopDir = subst("$0/svg", projname); makedir(svgTopDir.c_str()); // create a directory to store svg-* subdirectories. string cppdir = subst("$0/cpp", projname); makedir(cppdir.c_str()); // create a cpp directory. string pdfdir = subst("$0/pdf", projname); makedir(pdfdir.c_str()); // create a pdf directory. /* Copy all Faust source files into an 'src' sub-directory. */ vector<string> pathnames = gReader.listSrcFiles(); copyFaustSources(projname, pathnames); string texdir = subst("$0/tex", projname); mkchdir(texdir.c_str()); // create a directory and move into. /** Create THE mathdoc tex file. */ ofstream docout(subst("$0.$1", gDocName, docdev).c_str()); cholddir(); // return to current directory /** Init and load translation file. */ loadTranslationFile(gDocLang); /** Simulate a default doc if no <mdoc> tag detected. */ if (gDocVector.empty()) { declareAutoDoc(); } /** Printing stuff : in the '.tex' ouptut file, eventually including SVG files. */ printfaustdocstamp(faustversion, docout); ///< Faust version and compilation date (comment). istream* latexheader = openArchFile(gLatexheaderfilename); printlatexheader(*latexheader, faustversion, docout); ///< Static LaTeX header (packages and setup). printdoccontent(svgTopDir.c_str(), gDocVector, faustversion, docout); ///< Generate math contents (main stuff!). printlatexfooter(docout); ///< Static LaTeX footer. }
false
false
false
false
false
0
lekhonee_main_insertpara_cb (LekhoneeMain* self) { GtkTextIter _tmp0_ = {0}; GtkTextIter start; GtkTextIter _tmp1_ = {0}; GtkTextIter end; char* text; char* _result_; g_return_if_fail (self != NULL); start = (_tmp0_); end = (_tmp1_); gtk_text_buffer_get_selection_bounds ((GtkTextBuffer*) self->blog_txt, &start, &end); text = g_strdup (gtk_text_buffer_get_text ((GtkTextBuffer*) self->blog_txt, &start, &end, FALSE)); gtk_text_buffer_delete ((GtkTextBuffer*) self->blog_txt, &start, &end); _result_ = g_strdup ("<div><br></div>"); gtk_text_buffer_insert_at_cursor ((GtkTextBuffer*) self->blog_txt, _result_, (gint) strlen (_result_)); _g_free0 (text); _g_free0 (_result_); }
false
false
false
false
false
0
IsEmpty() const { for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) return false; return true; }
false
false
false
false
false
0
in_construct(orte_filem_raw_incoming_t *ptr) { ptr->app_idx = 0; ptr->pending = false; ptr->fd = -1; ptr->file = NULL; ptr->top = NULL; ptr->fullpath = NULL; ptr->link_pts = NULL; OBJ_CONSTRUCT(&ptr->outputs, opal_list_t); }
false
false
false
false
false
0
updateDownPB() { int const srows = selectedModel->rowCount(); if (srows == 0) { downPB->setEnabled(false); return; } QModelIndexList const selSels = selectedLV->selectionModel()->selectedIndexes(); int const sel_nr = selSels.empty() ? -1 : selSels.first().row(); downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1); }
false
false
false
false
false
0
ai_should_spend_war(int enemyMilitaryRating, int considerCeaseFire) { int importanceRating = 30 + pref_military_development/5; // 30 to 50 importanceRating += military_rank_rating() - enemyMilitaryRating*2; if( considerCeaseFire ) // only when we are very powerful, we will start a battle. So won't cease fire too soon after declaring war importanceRating += 20; // less eary to return 0, for cease fire return ai_should_spend(importanceRating); }
false
false
false
false
false
0
fd_generic_precheckpoint(void *p) { int retval; CRUT_DEBUG("Testing sanity before we checkpoint"); retval = update_fd_struct((struct fd_struct *)p); if (retval < 0) { CRUT_FAIL("update_fd_struct failed before checkpoint..."); } return retval; }
false
false
false
false
false
0
aisc_talking_get_index(int u,int o) { if (aisc_server_index==-1) { aisc_server_error = "AISC_SERVER_ERROR MISSING AN AISC_INDEX"; return -1; } if ((aisc_server_index<u) || (aisc_server_index>=o) ){ sprintf(error_buf,"AISC_SET_SERVER_ERROR: INDEX %i IS OUT OF RANGE [%i,%i]", aisc_server_index,u,o); aisc_server_error = error_buf; } AISC_DUMP(aisc_talking_get_index, int, aisc_server_index); return aisc_server_index; }
false
true
false
false
false
1
x_log_message (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message) { gchar *style; g_return_if_fail (log_dialog != NULL); if (log_level & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR)) { style = "critical"; } else if (log_level & G_LOG_LEVEL_WARNING) { style = "warning"; } else { style = "message"; } log_message (LOG(log_dialog), message, style); }
false
false
false
false
false
0
actionSupported( NET::Action action ) const { #if !defined(KDE_NO_WARNING_OUTPUT) if (!(d->info->passedProperties()[ NETWinInfo::PROTOCOLS2 ] & NET::WM2AllowedActions)) kWarning(176) << "Pass NET::WM2AllowedActions to KWindowInfo"; #endif if( KWindowSystem::allowedActionsSupported()) return d->info->allowedActions() & action; else return true; // no idea if it's supported or not -> pretend it is }
false
false
false
false
false
0
replace_variables(char **text, int lineno) { bool string = false; int counter = 1, ptr = 0; for (; (*text)[ptr] != '\0'; ptr++) { if ((*text)[ptr] == '\'') string = string ? false : true; if (string || (((*text)[ptr] != ':') && ((*text)[ptr] != '?'))) continue; if (((*text)[ptr] == ':') && ((*text)[ptr + 1] == ':')) ptr += 2; /* skip '::' */ else { int len; int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the * size we need */ char *buffer, *newcopy; if (!(buffer = (char *) ecpg_alloc(buffersize, lineno))) return false; snprintf(buffer, buffersize, "$%d", counter++); for (len = 1; (*text)[ptr + len] && isvarchar((*text)[ptr + len]); len++); if (!(newcopy = (char *) ecpg_alloc(strlen(*text) -len + strlen(buffer) + 1, lineno))) { ecpg_free(buffer); return false; } memcpy(newcopy, *text, ptr); strcpy(newcopy + ptr, buffer); strcat(newcopy, (*text) +ptr + len); ecpg_free(*text); ecpg_free(buffer); *text = newcopy; if ((*text)[ptr] == '\0') /* we reached the end */ ptr--; /* since we will (*text)[ptr]++ in the top * level for loop */ } } return true; }
false
false
false
false
false
0
send_host_captain_change_packet(short player_id, int captain_change) { ubyte data[MAX_PACKET_SIZE]; int packet_size = 0; // build the packet BUILD_HEADER(TRANSFER_HOST); ADD_SHORT(player_id); ADD_INT(captain_change); // send to all multi_io_send_to_all_reliable(data, packet_size); }
false
false
false
false
false
0
main(int argc, char **argv, char **envp) { if (argc > 1) { int i = 1; for (i; i<argc; i++) { int n = atoi(argv[i]); printf("%d: %d\n", n, EULERS[(n-1)]()); } } else { int i = 0; for (; EULERS[i] != NULL; i++) { printf("%d: %d\n", (i+1), EULERS[i]()); } } return 0; }
false
false
false
false
false
0
concat_onto(re_machine *dest, re_machine *rhs) { /* check for a null destination machine */ if (is_machine_null(dest)) { /* * the first machine is null - simply copy the second machine * onto the first unchanged */ *dest = *rhs; } else { re_machine new_machine; /* build the concatenated machine */ build_concat(&new_machine, dest, rhs); /* copy the concatenated machine onto the first machine */ *dest = new_machine; } }
false
false
false
false
false
0
e2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size) { unsigned char result; SANE_Status status; DBG(12, "%s: size = %lu\n", __func__, (u_long) buf_size); status = e2_txrx(s, buf, buf_size, &result, 1); if (status != SANE_STATUS_GOOD) { DBG(1, "%s: failed, %s\n", __func__, sane_strstatus(status)); return status; } if (result == ACK) return SANE_STATUS_GOOD; if (result == NAK) { DBG(3, "%s: NAK\n", __func__); return SANE_STATUS_INVAL; } DBG(1, "%s: result is neither ACK nor NAK but 0x%02x\n", __func__, result); return SANE_STATUS_GOOD; }
false
false
false
false
false
0
convert_444_422 (CogFrame * frame, void *_dest, int component, int i) { uint8_t *dest = _dest; uint8_t *src; int n_src; src = cog_virt_frame_get_line (frame->virt_frame1, component, i); n_src = frame->virt_frame1->components[component].width; if (component == 0) { orc_memcpy (dest, src, frame->width); } else { cogorc_downsample_horiz_cosite_1tap (dest + 1, (uint16_t *) (src + 2), frame->components[component].width - 1); { int j; int x; j = 0; x = 1 * src[CLAMP (j * 2 - 1, 0, n_src - 1)]; x += 2 * src[CLAMP (j * 2 + 0, 0, n_src - 1)]; x += 1 * src[CLAMP (j * 2 + 1, 0, n_src - 1)]; dest[j] = CLAMP ((x + 2) >> 2, 0, 255); } } }
false
false
false
false
false
0
fread_matrix( FILE *fin, float GPFAR * GPFAR * GPFAR * ret_matrix, int *nr, int *nc, float GPFAR * GPFAR * row_title, float GPFAR * GPFAR * column_title) { float GPFAR * GPFAR * m, GPFAR * rt, GPFAR * ct; int num_rows = START_ROWS; size_t num_cols; int current_row = 0; float GPFAR * GPFAR * temp_array; float fdummy; if (fread(&fdummy, sizeof(fdummy), 1, fin) != 1) return FALSE; num_cols = (size_t) fdummy; /* Choose a reasonable number of rows, allocate space for it and * continue until this space runs out, then extend the matrix as * necessary. */ ct = alloc_vector(0, num_cols - 1); fread(ct, sizeof(*ct), num_cols, fin); rt = alloc_vector(0, num_rows - 1); m = matrix(0, num_rows - 1, 0, num_cols - 1); while (fread(&rt[current_row], sizeof(rt[current_row]), 1, fin) == 1) { /* We've got another row */ if (fread(m[current_row], sizeof(*(m[current_row])), num_cols, fin) != num_cols) return (FALSE); /* Not a True matrix */ current_row++; if (current_row >= num_rows) { /* We've got to make a bigger rowsize */ temp_array = extend_matrix(m, 0, num_rows - 1, 0, num_cols - 1, num_rows + ADD_ROWS - 1, num_cols - 1); rt = extend_vector(rt, 0, num_rows + ADD_ROWS - 1); num_rows += ADD_ROWS; m = temp_array; } } /* finally we force the matrix to be the correct row size */ /* bug fixed. procedure called with incorrect 6th argument. * jvdwoude@hut.nl */ temp_array = retract_matrix(m, 0, num_rows - 1, 0, num_cols - 1, current_row - 1, num_cols - 1); /* Now save the things that change */ *ret_matrix = temp_array; *row_title = retract_vector(rt, 0, current_row - 1); *column_title = ct; *nr = current_row; /* Really the total number of rows */ *nc = num_cols; return (TRUE); }
false
false
false
false
true
1
be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, __be16 port) { struct be_adapter *adapter = netdev_priv(netdev); struct device *dev = &adapter->pdev->dev; int status; if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) return; if (adapter->vxlan_port == port && adapter->vxlan_port_count) { adapter->vxlan_port_aliases++; return; } if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) { dev_info(dev, "Only one UDP port supported for VxLAN offloads\n"); dev_info(dev, "Disabling VxLAN offloads\n"); adapter->vxlan_port_count++; goto err; } if (adapter->vxlan_port_count++ >= 1) return; status = be_cmd_manage_iface(adapter, adapter->if_handle, OP_CONVERT_NORMAL_TO_TUNNEL); if (status) { dev_warn(dev, "Failed to convert normal interface to tunnel\n"); goto err; } status = be_cmd_set_vxlan_port(adapter, port); if (status) { dev_warn(dev, "Failed to add VxLAN port\n"); goto err; } adapter->flags |= BE_FLAGS_VXLAN_OFFLOADS; adapter->vxlan_port = port; netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL; netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; netdev->features |= NETIF_F_GSO_UDP_TUNNEL; dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", be16_to_cpu(port)); return; err: be_disable_vxlan_offloads(adapter); }
false
false
false
false
false
0
init_specialist_lattice_nodes(struct tile_type_vector *lattice, const struct city *pcity) { struct cm_tile_type type; tile_type_init(&type); type.is_specialist = TRUE; /* for each specialist type, create a tile_type that has as production * the bonus for the specialist (if the city is allowed to use it) */ specialist_type_iterate(i) { if (city_can_use_specialist(pcity, i)) { type.spec = i; output_type_iterate(output) { type.production[output] = get_specialist_output(pcity, i, output); } output_type_iterate_end; tile_type_lattice_add(lattice, &type, 0); } } specialist_type_iterate_end; }
false
false
false
false
false
0
CategoryDelete(uint32 cat) { #ifdef AMULE_DAEMON if (cat > 0) { theApp->downloadqueue->ResetCatParts(cat); theApp->glob_prefs->RemoveCat(cat); if ( theApp->glob_prefs->GetCatCount() == 1 ) { thePrefs::SetAllcatFilter( acfAll ); } theApp->glob_prefs->SaveCats(); } #else if (theApp->amuledlg->m_transferwnd) { theApp->amuledlg->m_transferwnd->RemoveCategory(cat); } #endif }
false
false
false
false
false
0
gwy_rgba_remove_from_container(GwyContainer *container, const gchar *prefix) { GQuark keys[4]; g_return_val_if_fail(container && prefix, FALSE); gwy_rgba_compute_color_quarks(prefix, keys); return gwy_container_remove(container, keys[0]) + gwy_container_remove(container, keys[1]) + gwy_container_remove(container, keys[2]) + gwy_container_remove(container, keys[3]); }
false
false
false
false
false
0
ptr_compare_2(size_t *compare_length,uchar **a, uchar **b) { reg3 int length= *compare_length-2; reg1 uchar *first,*last; first= *a +2 ; last= *b +2; cmp(-2); cmp(-1); loop: cmp(0); cmp(1); cmp(2); cmp(3); if ((length-=4)) { first+=4; last+=4; goto loop; } return (0); }
false
false
false
false
false
0
verify_stable(int **array, int64_t size, int num_values) { int value; int64_t i = 0; int64_t j = 0; for (value = 0; value < num_values; value++) { while (1) { i = find_next(original, i, size, value); /* unlikely, but possible */ if (i == size) { break; } j = find_next(array, j, size, value); if (j == size) { return 0; } if (original[i] != array[j]) { return 0; } i++; j++; } } return 1; }
false
false
false
false
false
0
tds_next_placeholder(const char *start) { const char *p = start; if (!p) return NULL; for (;;) { switch (*p) { case '\0': return NULL; case '\'': case '\"': case '[': p = tds_skip_quoted(p); break; case '-': case '/': p = tds_skip_comment(p); break; case '?': return p; default: ++p; break; } } }
false
false
false
false
false
0
do_delete(Vfs_handle *h, char *key) { if (vfs_delete(h, key) == -1) { if (h->error_msg != NULL) log_msg((LOG_ERROR_LEVEL, "%s", ds_xprintf("vfs_delete with key=\"%s\" failed: %s", key, h->error_msg))); else log_msg((LOG_ERROR_LEVEL, ds_xprintf("vfs_delete with key=\"%s\" failed", key))); return(-1); } return(0); }
false
false
false
false
false
0
read_response(mailsmtp * session) { char * line; int code; mmap_string_assign(session->response_buffer, ""); do { line = read_line(session); if (line != NULL) { code = parse_response(session, line); mmap_string_append_c(session->response_buffer, '\n'); } else code = 0; } while ((code & SMTP_STATUS_CONTINUE) != 0); session->response = session->response_buffer->str; return code; }
false
false
false
false
false
0
main_window_get_main_toolbar (MainWindow* self) { GtkToolbar* result = NULL; GtkToolbar* main_toolbar = NULL; GtkUIManager* _tmp0_ = NULL; GtkWidget* _tmp1_ = NULL; GtkToolbar* _tmp2_ = NULL; GtkToolItem* open_button = NULL; MainWindowFile* _tmp3_ = NULL; GtkToolItem* _tmp4_ = NULL; GtkStyleContext* context = NULL; GtkStyleContext* _tmp5_ = NULL; GtkStyleContext* _tmp6_ = NULL; GtkToggleAction* action = NULL; GtkActionGroup* _tmp7_ = NULL; GtkAction* _tmp8_ = NULL; GtkToggleAction* _tmp9_ = NULL; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->_ui_manager; _tmp1_ = gtk_ui_manager_get_widget (_tmp0_, "/MainToolbar"); _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, GTK_TYPE_TOOLBAR) ? ((GtkToolbar*) _tmp1_) : NULL); main_toolbar = _tmp2_; _tmp3_ = self->priv->_main_window_file; _tmp4_ = main_window_file_get_toolbar_open_button (_tmp3_); open_button = _tmp4_; gtk_toolbar_insert (main_toolbar, open_button, 1); gtk_toolbar_set_style (main_toolbar, GTK_TOOLBAR_ICONS); _tmp5_ = gtk_widget_get_style_context ((GtkWidget*) main_toolbar); _tmp6_ = _g_object_ref0 (_tmp5_); context = _tmp6_; gtk_style_context_add_class (context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_widget_show_all ((GtkWidget*) main_toolbar); _tmp7_ = self->priv->_action_group; _tmp8_ = gtk_action_group_get_action (_tmp7_, "ViewMainToolbar"); _tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, GTK_TYPE_TOGGLE_ACTION) ? ((GtkToggleAction*) _tmp8_) : NULL); action = _tmp9_; gtk_toggle_action_set_active (action, TRUE); g_object_bind_property_with_closures ((GObject*) main_toolbar, "visible", (GObject*) action, "active", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL))); result = main_toolbar; _g_object_unref0 (action); _g_object_unref0 (context); _g_object_unref0 (open_button); return result; }
false
false
false
false
false
0
vnc_connection_framebuffer_update_request(VncConnection *conn, gboolean incremental, guint16 x, guint16 y, guint16 width, guint16 height) { VncConnectionPrivate *priv = conn->priv; VNC_DEBUG("Requesting framebuffer update at %d,%d size %dx%d, incremental %d", x, y, width, height, (int)incremental); priv->lastUpdateRequest.incremental = incremental; priv->lastUpdateRequest.x = x; priv->lastUpdateRequest.y = y; priv->lastUpdateRequest.width = width; priv->lastUpdateRequest.height = height; vnc_connection_buffered_write_u8(conn, VNC_CONNECTION_CLIENT_MESSAGE_FRAMEBUFFER_UPDATE_REQUEST); vnc_connection_buffered_write_u8(conn, incremental ? 1 : 0); vnc_connection_buffered_write_u16(conn, x); vnc_connection_buffered_write_u16(conn, y); vnc_connection_buffered_write_u16(conn, width); vnc_connection_buffered_write_u16(conn, height); vnc_connection_buffered_flush(conn); return !vnc_connection_has_error(conn); }
false
false
false
false
false
0
scrsendconfig(Scrn *s) { Client *c; for (c=clients; c; c = c->next) if(c->scr == s) sendconfig(c); }
false
false
false
false
false
0
slapi_filter_dup(Slapi_Filter *f) { Slapi_Filter *out = 0; struct slapi_filter *fl = 0; struct slapi_filter **outl = 0; struct slapi_filter *lastout = 0; if ( f == NULL ) { return NULL; } out = (struct slapi_filter*)slapi_ch_calloc(1, sizeof(struct slapi_filter)); if ( out == NULL ) { LDAPDebug(LDAP_DEBUG_ANY, "slapi_filter_dup: memory allocation error\n", 0, 0, 0 ); return NULL; } out->f_choice = f->f_choice; out->f_hash = f->f_hash; out->f_flags = f->f_flags; LDAPDebug( LDAP_DEBUG_FILTER, "slapi_filter_dup type 0x%lX\n", f->f_choice, 0, 0 ); switch ( f->f_choice ) { case LDAP_FILTER_EQUALITY: case LDAP_FILTER_GE: case LDAP_FILTER_LE: case LDAP_FILTER_APPROX: out->f_ava.ava_type = slapi_ch_strdup(f->f_ava.ava_type); slapi_ber_bvcpy(&out->f_ava.ava_value, &f->f_ava.ava_value); break; case LDAP_FILTER_SUBSTRINGS: out->f_sub_type = slapi_ch_strdup(f->f_sub_type); out->f_sub_initial = slapi_ch_strdup(f->f_sub_initial ); out->f_sub_any = charray_dup( f->f_sub_any ); out->f_sub_final = slapi_ch_strdup(f->f_sub_final ); break; case LDAP_FILTER_PRESENT: out->f_type = slapi_ch_strdup( f->f_type ); break; case LDAP_FILTER_AND: case LDAP_FILTER_OR: case LDAP_FILTER_NOT: outl = &out->f_list; for (fl = f->f_list; fl != NULL; fl = fl->f_next) { (*outl) = slapi_filter_dup( fl ); (*outl)->f_next = 0; if(lastout) lastout->f_next = *outl; lastout = *outl; outl = &((*outl)->f_next); } break; case LDAP_FILTER_EXTENDED: out->f_mr_oid = slapi_ch_strdup(f->f_mr_oid); out->f_mr_type = slapi_ch_strdup(f->f_mr_type); slapi_ber_bvcpy(&out->f_mr_value, &f->f_mr_value); out->f_mr_dnAttrs = f->f_mr_dnAttrs; if (f->f_mr.mrf_match) { int rc = plugin_mr_filter_create(&out->f_mr); LDAPDebug1Arg( LDAP_DEBUG_FILTER, "slapi_filter_dup plugin_mr_filter_create returned %d\n", rc ); } break; default: LDAPDebug(LDAP_DEBUG_FILTER, "slapi_filter_dup: unknown type 0x%lX\n", f->f_choice, 0, 0 ); break; } return out; }
false
false
false
true
false
1
scheduleJob(SimpleJob *job) { kDebug(7006) << job; setJobPriority(job, 1); }
false
false
false
false
false
0
decode_nlm4_holder(struct xdr_stream *xdr, struct nlm_res *result) { struct nlm_lock *lock = &result->lock; struct file_lock *fl = &lock->fl; u64 l_offset, l_len; u32 exclusive; int error; __be32 *p; s32 end; memset(lock, 0, sizeof(*lock)); locks_init_lock(fl); p = xdr_inline_decode(xdr, 4 + 4); if (unlikely(p == NULL)) goto out_overflow; exclusive = be32_to_cpup(p++); lock->svid = be32_to_cpup(p); fl->fl_pid = (pid_t)lock->svid; error = decode_netobj(xdr, &lock->oh); if (unlikely(error)) goto out; p = xdr_inline_decode(xdr, 8 + 8); if (unlikely(p == NULL)) goto out_overflow; fl->fl_flags = FL_POSIX; fl->fl_type = exclusive != 0 ? F_WRLCK : F_RDLCK; p = xdr_decode_hyper(p, &l_offset); xdr_decode_hyper(p, &l_len); end = l_offset + l_len - 1; fl->fl_start = (loff_t)l_offset; if (l_len == 0 || end < 0) fl->fl_end = OFFSET_MAX; else fl->fl_end = (loff_t)end; error = 0; out: return error; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; }
false
false
false
false
false
0
SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull) { SPI_result = 0; if (fnumber > tupdesc->natts || fnumber == 0 || fnumber <= FirstLowInvalidHeapAttributeNumber) { SPI_result = SPI_ERROR_NOATTRIBUTE; *isnull = true; return (Datum) NULL; } return heap_getattr(tuple, fnumber, tupdesc, isnull); }
false
false
false
false
false
0
log_info() const { int aspgcd = NMath::gcd(m_width, m_height); Log::handle().log_message("- Output : Resolution %ix%i, Aspect ratio %i:%i", m_width, m_height, m_width / aspgcd, m_height / aspgcd); Log::handle().log_message("- Antialiasing : Supersampling %ix%i, %i spp", m_aa, m_aa, m_aa * m_aa); Log::handle().log_message("- Recursion : %i", m_max_rdepth); Log::handle().log_message("- Sampling : DoF %i, Shading %i, Reflections %i", m_samples_dof, m_samples_light, m_samples_reflec); if (m_flag_gi) { Log::handle().log_message("- Photon maps : Total %i, Per pixel %i, Radius %f", m_photon_count, m_photon_max_samples, m_photon_max_sampling_radius); } }
false
false
false
false
false
0
utf8ntowcs ( SQLCHAR * ustr, SQLWCHAR * wstr, size_t ulen, size_t size, int * converted) { int i; int mask = 0; int len; SQLCHAR c; SQLWCHAR wc; size_t count = 0; size_t _converted = 0; if (!ustr) return 0; while ((_converted < ulen) && (count < size)) { c = (SQLCHAR) *ustr; UTF8_COMPUTE (c, mask, len); if ((len == -1) || (_converted + len > ulen)) { if (converted) *converted = (u_short) _converted; return count; } wc = c & mask; for (i = 1; i < len; i++) { if ((ustr[i] & 0xC0) != 0x80) { if (converted) *converted = (u_short) _converted; return count; } wc <<= 6; wc |= (ustr[i] & 0x3F); } *wstr = wc; ustr += len; wstr++; count++; _converted += len; } if (converted) *converted = (u_short) _converted; return count; }
false
false
false
false
false
0
too_big_for_gnutella(fileoffset_t size) { g_return_val_if_fail(size >= 0, TRUE); return size + (filesize_t)0 > (filesize_t)-1 + (fileoffset_t)0; }
false
false
false
false
false
0
pwm_export_child(struct device *parent, struct pwm_device *pwm) { struct pwm_export *export; int ret; if (test_and_set_bit(PWMF_EXPORTED, &pwm->flags)) return -EBUSY; export = kzalloc(sizeof(*export), GFP_KERNEL); if (!export) { clear_bit(PWMF_EXPORTED, &pwm->flags); return -ENOMEM; } export->pwm = pwm; export->child.release = pwm_export_release; export->child.parent = parent; export->child.devt = MKDEV(0, 0); export->child.groups = pwm_groups; dev_set_name(&export->child, "pwm%u", pwm->hwpwm); ret = device_register(&export->child); if (ret) { clear_bit(PWMF_EXPORTED, &pwm->flags); kfree(export); return ret; } return 0; }
false
false
false
false
false
0
midi_synth_load_patch(int dev, int format, const char __user *addr, int count, int pmgr_flag) { int orig_dev = synth_devs[dev]->midi_dev; struct sysex_info sysex; int i; unsigned long left, src_offs, eox_seen = 0; int first_byte = 1; int hdr_size = (unsigned long) &sysex.data[0] - (unsigned long) &sysex; leave_sysex(dev); if (!prefix_cmd(orig_dev, 0xf0)) return 0; /* Invalid patch format */ if (format != SYSEX_PATCH) return -EINVAL; /* Patch header too short */ if (count < hdr_size) return -EINVAL; count -= hdr_size; /* * Copy the header from user space */ if (copy_from_user(&sysex, addr, hdr_size)) return -EFAULT; /* Sysex record too short */ if ((unsigned)count < (unsigned)sysex.len) sysex.len = count; left = sysex.len; src_offs = 0; for (i = 0; i < left && !signal_pending(current); i++) { unsigned char data; if (get_user(data, (unsigned char __user *)(addr + hdr_size + i))) return -EFAULT; eox_seen = (i > 0 && data & 0x80); /* End of sysex */ if (eox_seen && data != 0xf7) data = 0xf7; if (i == 0) { if (data != 0xf0) { printk(KERN_WARNING "midi_synth: Sysex start missing\n"); return -EINVAL; } } while (!midi_devs[orig_dev]->outputc(orig_dev, (unsigned char) (data & 0xff)) && !signal_pending(current)) schedule(); if (!first_byte && data & 0x80) return 0; first_byte = 0; } if (!eox_seen) midi_outc(orig_dev, 0xf7); return 0; }
false
false
false
false
false
0
getPrintPreviewBitmap(void *bitmap, unsigned long size) { OFCondition status = EC_IllegalCall; if ((pHardcopyImage != NULL) && (bitmap != NULL) && (size > 0)) { if (pHardcopyImage->getOutputData(bitmap, size, 8 /*bits*/)) status = EC_Normal; } return status; }
false
false
false
false
false
0
migrate_parse_signature_xml_end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error) { ParseData *parse_data = user_data; if (g_strcmp0 (element_name, "filename") == 0) { if (parse_data->state == PARSE_STATE_IN_FILENAME) { parse_data->state = PARSE_STATE_IN_SIGNATURE; return; } } if (g_strcmp0 (element_name, "signature") == 0) { if (parse_data->state == PARSE_STATE_IN_SIGNATURE) { parse_data->state = PARSE_STATE_IN_SIGNATURES_VALUE; /* Clean up <signature> tag data. */ /* The key file will be NULL if we decided to skip it. * e.g. A file with the same UID may already exist. */ if (parse_data->key_file != NULL) { GError *local_error = NULL; if (!parse_data->skip) migrate_parse_commit_changes ( parse_data->type, parse_data->file, parse_data->key_file, NULL, &local_error); if (local_error != NULL) { g_printerr ( " FAILED: %s\n", local_error->message); g_error_free (local_error); } g_key_file_free (parse_data->key_file); parse_data->key_file = NULL; } if (parse_data->file != NULL) { g_object_unref (parse_data->file); parse_data->file = NULL; } parse_data->skip = FALSE; return; } } }
false
false
false
false
false
0
checkVarFuncNullUB() { if (!_settings->isEnabled("portability")) return; const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); const std::size_t functions = symbolDatabase->functionScopes.size(); for (std::size_t i = 0; i < functions; ++i) { const Scope * scope = symbolDatabase->functionScopes[i]; for (const Token* tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) { // Is NULL passed to a function? if (Token::Match(tok,"[(,] NULL [,)]")) { // Locate function name in this function call. const Token *ftok = tok; std::size_t argnr = 1; while (ftok && ftok->str() != "(") { if (ftok->str() == ")") ftok = ftok->link(); else if (ftok->str() == ",") ++argnr; ftok = ftok->previous(); } ftok = ftok ? ftok->previous() : NULL; if (ftok && ftok->isName()) { // If this is a variadic function then report error const Function *f = ftok->function(); if (f && f->argCount() <= argnr) { const Token *tok2 = f->argDef; tok2 = tok2 ? tok2->link() : NULL; // goto ')' if (Token::simpleMatch(tok2->tokAt(-3), ". . .")) varFuncNullUBError(tok); } } } } } }
false
false
false
true
false
1
dumpchan_exec(struct ast_channel *chan, const char *data) { struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16); char info[2048]; int level = 0; static char *line = "================================================================================"; if (!ast_strlen_zero(data)) level = atoi(data); serialize_showchan(chan, info, sizeof(info)); pbx_builtin_serialize_variables(chan, &vars); ast_verb(level, "\n" "Dumping Info For Channel: %s:\n" "%s\n" "Info:\n" "%s\n" "Variables:\n" "%s%s\n", ast_channel_name(chan), line, info, ast_str_buffer(vars), line); return 0; }
false
false
false
false
false
0
session_request_logout(gboolean silent) { if (sm_conn) { SmcRequestSaveYourself(sm_conn, SmSaveGlobal, TRUE, /* logout */ (silent ? SmInteractStyleNone : SmInteractStyleAny), TRUE, /* if false, with GSM, it shows the old logout prompt */ TRUE); /* global */ } else g_message(_("Not connected to a session manager")); }
false
false
false
false
false
0
AppendList(const ALCchar *name, ALCchar **List, size_t *ListSize) { size_t len = strlen(name); void *temp; if(len == 0) return; temp = realloc(*List, (*ListSize) + len + 2); if(!temp) { ERR("Realloc failed to add %s!\n", name); return; } *List = temp; memcpy((*List)+(*ListSize), name, len+1); *ListSize += len+1; (*List)[*ListSize] = 0; }
false
false
false
false
false
0
saa7164_api_set_encoder(struct saa7164_port *port) { struct saa7164_dev *dev = port->dev; struct tmComResEncVideoBitRate vb; struct tmComResEncAudioBitRate ab; int ret; dprintk(DBGLVL_ENC, "%s() unitid=0x%x\n", __func__, port->hwcfg.sourceid); if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_PS) port->encoder_profile = EU_PROFILE_PS_DVD; else port->encoder_profile = EU_PROFILE_TS_HQ; ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, EU_PROFILE_CONTROL, sizeof(u8), &port->encoder_profile); if (ret != SAA_OK) printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); /* Resolution */ ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, EU_PROFILE_CONTROL, sizeof(u8), &port->encoder_profile); if (ret != SAA_OK) printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); /* Establish video bitrates */ if (port->encoder_params.bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_CONSTANT; else vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK; vb.dwVideoBitRate = port->encoder_params.bitrate; vb.dwVideoBitRatePeak = port->encoder_params.bitrate_peak; ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, EU_VIDEO_BIT_RATE_CONTROL, sizeof(struct tmComResEncVideoBitRate), &vb); if (ret != SAA_OK) printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); /* Establish audio bitrates */ ab.ucAudioBitRateMode = 0; ab.dwAudioBitRate = 384000; ab.dwAudioBitRatePeak = ab.dwAudioBitRate; ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, EU_AUDIO_BIT_RATE_CONTROL, sizeof(struct tmComResEncAudioBitRate), &ab); if (ret != SAA_OK) printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); saa7164_api_set_aspect_ratio(port); saa7164_api_set_gop_size(port); return ret; }
false
false
false
false
false
0
set( size_t recordIndex, string field, string value) { MRPT_START ASSERT_(recordIndex<getRecordCount()); data[recordIndex][fieldIndex(field.c_str())]=value; MRPT_END }
false
false
false
false
false
0
mtip_detect_product(struct driver_data *dd) { u32 hwdata; unsigned int rev, slotgroups; /* * HBA base + 0xFC [15:0] - vendor-specific hardware interface * info register: * [15:8] hardware/software interface rev# * [ 3] asic-style interface * [ 2:0] number of slot groups, minus 1 (only valid for asic-style). */ hwdata = readl(dd->mmio + HOST_HSORG); dd->product_type = MTIP_PRODUCT_UNKNOWN; dd->slot_groups = 1; if (hwdata & 0x8) { dd->product_type = MTIP_PRODUCT_ASICFPGA; rev = (hwdata & HSORG_HWREV) >> 8; slotgroups = (hwdata & HSORG_SLOTGROUPS) + 1; dev_info(&dd->pdev->dev, "ASIC-FPGA design, HS rev 0x%x, " "%i slot groups [%i slots]\n", rev, slotgroups, slotgroups * 32); if (slotgroups > MTIP_MAX_SLOT_GROUPS) { dev_warn(&dd->pdev->dev, "Warning: driver only supports " "%i slot groups.\n", MTIP_MAX_SLOT_GROUPS); slotgroups = MTIP_MAX_SLOT_GROUPS; } dd->slot_groups = slotgroups; return; } dev_warn(&dd->pdev->dev, "Unrecognized product id\n"); }
false
false
false
false
false
0
gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track, gint16 relative_timestamp, int flags) { GstBuffer *hdr; hdr = gst_buffer_new_and_alloc (4); /* track num - FIXME: what if num >= 0x80 (unlikely)? */ GST_BUFFER_DATA (hdr)[0] = track->num | 0x80; /* time relative to clustertime */ GST_WRITE_UINT16_BE (GST_BUFFER_DATA (hdr) + 1, relative_timestamp); /* flags */ GST_BUFFER_DATA (hdr)[3] = flags; return hdr; }
false
false
false
false
false
0
zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos) { Bucket *p; p = pos ? (*pos) : ht->pInternalPointer; IS_CONSISTENT(ht); if (p) { *pData = p->pData; return SUCCESS; } else { return FAILURE; } }
false
false
false
false
false
0