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
zzn2_copy(zzn2 *x,zzn2 *w) { if (x==w) return; copy(x->a,w->a); copy(x->b,w->b); }
false
false
false
false
false
0
frame() const { QString value = explicitAttribute( "frame", "none" ); return interpretFrameType( value, 0, 0 ); }
false
false
false
false
false
0
mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size) { int result; LOCK_GC; sgen_process_fin_stage_entries (); result = finalizers_for_domain (domain, out_array, out_size, &minor_finalizable_hash); if (result < out_size) { result += finalizers_for_domain (domain, out_array + result, out_size - result, &major_finalizable_hash); } UNLOCK_GC; return result; }
false
false
false
false
false
0
gen_sibcall (rtx operand0, rtx operand1, rtx operand2) { rtx _val = 0; start_sequence (); { rtx operands[3]; operands[0] = operand0; operands[1] = operand1; operands[2] = operand2; #line 8732 "../../src/gcc/config/arm/arm.md" { if (operands[2] == NULL_RTX) operands[2] = const0_rtx; } operand0 = operands[0]; (void) operand0; operand1 = operands[1]; (void) operand1; operand2 = operands[2]; (void) operand2; } emit_call_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (3, gen_rtx_CALL (VOIDmode, operand0, operand1), ret_rtx, gen_rtx_USE (VOIDmode, operand2)))); _val = get_insns (); end_sequence (); return _val; }
false
false
false
false
false
0
EvaluatePosition (double *x, double *closestPoint, int &subId, double pcoords[3], double &minDist2, double *weights) { double pc[3], dist2; int ignoreId, i, returnStatus = 0, status; double tempWeights[4]; double closest[3]; //four linear quads are used for (minDist2 = VTK_DOUBLE_MAX, i = 0; i < 4; i++) { this->Quad->Points->SetPoint (0, this->Points->GetPoint (LinearQuads[i][0])); this->Quad->Points->SetPoint (1, this->Points->GetPoint (LinearQuads[i][1])); this->Quad->Points->SetPoint (2, this->Points->GetPoint (LinearQuads[i][2])); this->Quad->Points->SetPoint (3, this->Points->GetPoint (LinearQuads[i][3])); status = this->Quad->EvaluatePosition (x, closest, ignoreId, pc, dist2, tempWeights); if (status != -1 && dist2 < minDist2) { returnStatus = status; minDist2 = dist2; subId = i; pcoords[0] = pc[0]; pcoords[1] = pc[1]; } } // adjust parametric coordinates if (returnStatus != -1) { if (subId == 0) { pcoords[0] /= 2.0; pcoords[1] /= 2.0; } else if (subId == 1) { pcoords[0] = 0.5 + (pcoords[0] / 2.0); pcoords[1] /= 2.0; } else if (subId == 2) { pcoords[0] = 0.5 + (pcoords[0] / 2.0); pcoords[1] = 0.5 + (pcoords[1] / 2.0); } else { pcoords[0] /= 2.0; pcoords[1] = 0.5 + (pcoords[1] / 2.0); } pcoords[2] = 0.0; if(closestPoint!=0) { // Compute both closestPoint and weights this->EvaluateLocation(subId,pcoords,closestPoint,weights); } else { // Compute weigths only this->InterpolationFunctions(pcoords,weights); } } return returnStatus; }
false
false
false
false
false
0
displayTextsIf() { if (!m_initialized) return; if (m_hidden) return; if (!isVisible()) return; displayTexts(); }
false
false
false
false
false
0
next() { if(ind<fnum) { ind++; return curr(); } return 0; }
false
false
false
false
false
0
cell_center (FttCell * cell, gpointer * data) { FttVector * p = data[0], pos; if (p->x == G_MAXDOUBLE) { GfsDomain * domain = data[1]; ClosestGrid * grid = data[2]; GtsPoint * v; ftt_cell_pos (cell, &pos); pos.z = 0.; v = gts_point_new (gts_point_class (), pos.x, pos.y, pos.z); if (gfs_domain_locate (domain, pos, -1, NULL) && closest_grid_is_insertable (grid, v, 0., 0.) == INSERTED) *p = pos; gts_object_destroy (GTS_OBJECT (v)); } }
false
false
false
false
false
0
realtime_sqlite3_load(const char *database, const char *table, const char *configfile, struct ast_config *config, struct ast_flags flags, const char *suggested_include_file, const char *who_asked) { char *sql; struct cfg_entry_args args; if (ast_strlen_zero(table)) { ast_log(LOG_WARNING, "Must have a table to query!\n"); return NULL; } if (!(sql = sqlite3_mprintf(static_sql, table, configfile))) { ast_log(LOG_WARNING, "Couldn't allocate query\n"); return NULL; }; args.cfg = config; args.cat = NULL; args.cat_name = NULL; args.flags = flags; args.who_asked = who_asked; realtime_sqlite3_execute(database, sql, static_realtime_cb, &args, 0); sqlite3_free(sql); return config; }
false
false
false
false
false
0
aac_sa_ioremap(struct aac_dev * dev, u32 size) { if (!size) { iounmap(dev->regs.sa); return 0; } dev->base = dev->regs.sa = ioremap(dev->base_start, size); return (dev->base == NULL) ? -1 : 0; }
false
false
false
false
false
0
dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length) { int num; int i; num = DWC3_NUM_INT(dwc->hwparams.hwparams1); dwc->num_event_buffers = num; dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs) * num, GFP_KERNEL); if (!dwc->ev_buffs) return -ENOMEM; for (i = 0; i < num; i++) { struct dwc3_event_buffer *evt; evt = dwc3_alloc_one_event_buffer(dwc, length); if (IS_ERR(evt)) { dev_err(dwc->dev, "can't allocate event buffer\n"); return PTR_ERR(evt); } dwc->ev_buffs[i] = evt; } return 0; }
false
false
false
false
false
0
Resize () { const char* keyLabel = _info->GetKeyLabel(); Graphic* bg; boolean invert = false; Iterator i; _picture->First(i); if (_picture->Done(i)) { bg = new F_Rect(0, 0, xmax, ymax, stdgraphic); invert = _highlighted; } else { bg = new F_Rect(0, 0, xmax, ymax, _picture->GetGraphic(i)); Graphic* newpict = new Picture(_picture); _picture->Remove(_label); delete _picture; _picture = newpict; } bg->SetPattern(psclear); _picture->Append(bg); _picture->Append(_label); if (*keyLabel == '\0') { bg->Align(Center, _label, Center); } else { bg->Align(CenterLeft, _label, CenterLeft); _label->Translate(HPAD, 0); Graphic* klbl = new ULabel(keyLabel, bg); klbl->SetFont(psstdfont); _picture->Append(klbl); bg->Align(CenterRight, klbl, CenterRight); klbl->Translate(-HPAD, 0); } if (invert) { Invert(); } }
false
false
false
false
false
0
git_config_get_bool(int *out, const git_config *cfg, const char *name) { const char *value = NULL; int ret; if ((ret = get_string(&value, cfg, name)) < 0) return ret; return git_config_parse_bool(out, value); }
false
false
false
false
false
0
request_swap_ns(struct request *req, struct nameserver *ns) { if (ns && req->ns != ns) { EVUTIL_ASSERT(req->ns->requests_inflight > 0); req->ns->requests_inflight--; ns->requests_inflight++; req->ns = ns; } }
false
false
false
false
false
0
Lcopy_readtable() { # line 2276 "read.d" int narg; register object *DPPbase=vs_base; #define from DPPbase[0+0] #define to DPPbase[0+1] narg = vs_top - vs_base; if (narg < 0) too_few_arguments(); if (narg <= 0 + 0) { vs_push(current_readtable()); narg++; } if (narg <= 0 + 1) { vs_push(Cnil); narg++; } if (narg > 0 + 2) too_many_arguments(); # line 2277 "read.d" if (from == Cnil) { from = standard_readtable; if (to != Cnil) check_type_readtable(&to); to = copy_readtable(from, to); to->rt.rt_self['#'].rte_dtab['!'] = default_dispatch_macro; /* We must forget #! macro. */ { vs_base[0] = to; vs_top = vs_base + 1; return; } # line 2286 "read.d" } check_type_readtable(&from); if (to != Cnil) check_type_readtable(&to); { vs_base[0] = copy_readtable(from, to); vs_top = vs_base + 1; return; } # line 2291 "read.d" #undef from #undef to }
false
false
false
false
false
0
prev_hist(void) { return H.Pos == 0 ? NULL : H.Lines[--H.Pos]; }
false
false
false
false
false
0
separate_arrays(GArray *spectra, guint *ncurves, GwyDataLine ***curves, guint *ncoords, gdouble **coords, guint *nselected, guint32 **selected) { guint isize, i; *ncurves = spectra->len; *curves = g_new(GwyDataLine*, *ncurves); *ncoords = 2*spectra->len; *coords = g_new(gdouble, *ncoords); isize = 8*sizeof(guint32); *nselected = (spectra->len + isize-1)/isize; *selected = g_new0(guint32, *nselected); for (i = 0; i < *ncurves; i++) { GwySpectrum *spec = &g_array_index(spectra, GwySpectrum, i); (*curves)[i] = spec->ydata; (*coords)[2*i + 0] = spec->x; (*coords)[2*i + 1] = spec->y; if (spec->selected) (*selected)[i/isize] |= 1 << (i % isize); } }
false
false
false
false
false
0
counterScopeToString( uint32_t properties ) { switch( properties & OTF_COUNTER_SCOPE_BITS ) { CASE_RETURN( SCOPE, START ); CASE_RETURN( SCOPE, POINT ); CASE_RETURN( SCOPE, LAST ); CASE_RETURN( SCOPE, NEXT ); default: { static char unknown_buffer[ 64 ]; sprintf( unknown_buffer, "UNKNOWN <%u>", properties & OTF_COUNTER_SCOPE_BITS ); return unknown_buffer; } } }
false
false
false
false
false
0
xsh_pre_abs (const xsh_pre * pre) { cpl_image *result = NULL; int *result_data = NULL; float *data = NULL; int i, size; XSH_ASSURE_NOT_NULL( pre); /* Handle data unit + plist */ check ( data = cpl_image_get_data_float( pre->data)); check( result = cpl_image_new( pre->nx, pre->ny, CPL_TYPE_INT)); check( result_data = cpl_image_get_data_int( result)); size = pre->nx*pre->ny; for(i =0; i < size; i++){ if ( data[i] < 0){ result_data[i] = -1; data[i] = -data[i]; } else{ result_data[i] = 1; } } cleanup: return result; }
false
false
false
false
false
0
gva_action_previous_game_cb (GtkAction *action) { GtkTreeSelection *selection; GtkTreeModel *model; GtkTreePath *path; GtkTreeView *view; GtkTreeIter iter; gboolean valid; gint n_nodes; gint index; view = GTK_TREE_VIEW (GVA_WIDGET_MAIN_TREE_VIEW); selection = gtk_tree_view_get_selection (view); valid = gtk_tree_selection_get_selected (selection, &model, &iter); n_nodes = gtk_tree_model_iter_n_children (model, NULL); g_return_if_fail (valid); path = gtk_tree_model_get_path (model, &iter); index = gtk_tree_path_get_indices (path)[0]; index = (index + n_nodes - 1) % n_nodes; gtk_tree_path_free (path); path = gtk_tree_path_new_from_indices (index, -1); gtk_tree_view_set_cursor (view, path, NULL, FALSE); gtk_tree_path_free (path); }
false
false
false
false
false
0
floor125( double x ) { if ( x == 0.0 ) return 0.0; double sign = ( x > 0 ) ? 1.0 : -1.0; const double lx = ::log10( qFabs( x ) ); const double p10 = qwtFloorF( lx ); double fr = qPow( 10.0, lx - p10 ); if ( fr >= 10.0 ) fr = 10.0; else if ( fr >= 5.0 ) fr = 5.0; else if ( fr >= 2.0 ) fr = 2.0; else fr = 1.0; return sign * fr * qPow( 10.0, p10 ); }
false
false
false
false
false
0
gretl_xml_encode_to_buf (char *targ, const char *src, int n) { const char *s = src; int len = strlen(s) + 1; if (!g_utf8_validate(src, -1, NULL)) { fprintf(stderr, "gretl_xml_encode_to_buf: source not UTF-8\n"); return 1; } while (*s) { if (*s == '&') len += 4; else if (*s == '<') len += 3; else if (*s == '>') len += 3; else if (*s == '"') len += 5; s++; } *targ = '\0'; if (len > n) { fprintf(stderr, "gretl_xml_encode_to_buf: buffer too small\n"); return 1; } s = src; while (*s) { if (*s == '&') { strcpy(targ, "&amp;"); targ += 5; } else if (*s == '<') { strcpy(targ, "&lt;"); targ += 4; } else if (*s == '>') { strcpy(targ, "&gt;"); targ += 4; } else if (*s == '"') { strcpy(targ, "&quot;"); targ += 6; } else { *targ++ = *s; } s++; } *targ = '\0'; return 0; }
false
false
false
false
false
0
CheckpointerShmemInit(void) { Size size = CheckpointerShmemSize(); bool found; CheckpointerShmem = (CheckpointerShmemStruct *) ShmemInitStruct("Checkpointer Data", size, &found); if (!found) { /* * First time through, so initialize. Note that we zero the whole * requests array; this is so that CompactCheckpointerRequestQueue can * assume that any pad bytes in the request structs are zeroes. */ MemSet(CheckpointerShmem, 0, size); SpinLockInit(&CheckpointerShmem->ckpt_lck); CheckpointerShmem->max_requests = NBuffers; } }
false
false
false
false
false
0
dTimerResolution() { unsigned long cc1[2],cc2[2]; getClockCount (cc1); do { getClockCount (cc2); } while (cc1[0]==cc2[0] && cc1[1]==cc2[1]); do { getClockCount (cc1); } while (cc1[0]==cc2[0] && cc1[1]==cc2[1]); double t1 = loadClockCount (cc1); double t2 = loadClockCount (cc2); return (t1-t2) / dTimerTicksPerSecond(); }
false
false
false
false
false
0
connectToDataSource(const QString &source) { d->mDataSource = PluginLoader::getInstance()->engine(source); if (!d->mDataSource.data()) return 0; connect(d->mDataSource.data(), SIGNAL(ready()), this, SLOT(onReady())); return true; }
false
false
false
false
false
0
generateCodeMetaClasses(void) { ClassList* currentClassList; Class* currentClass; /* Generate init */ fprintf(asmFile, "_init:\n"); currentClassList = metaClasses; while (!currentClassList->isEmpty) { currentClass = currentClassList->head; fprintf(asmFile, "\t// Generate Metaclass object \"%s\"\n", currentClass->name->string); fprintf(asmFile, "\tnew\t%d\n", currentClass->numFields); fprintf(asmFile, "\t.addr\t%s_%lx\n", currentClass->name->string, djb2(currentClass->fileName)); fprintf(asmFile, "\tpopg\t%d\n", currentClass->globalIndex); currentClassList = currentClassList->tail; } fprintf(asmFile, "\tret\n"); }
false
false
false
false
false
0
camel_mime_message_init (CamelMimeMessage *mime_message) { gint ii; mime_message->recipients = g_hash_table_new ( camel_strcase_hash, camel_strcase_equal); for (ii = 0; recipient_names[ii] != NULL; ii++) { g_hash_table_insert ( mime_message->recipients, (gpointer) recipient_names[ii], camel_internet_address_new ()); } mime_message->subject = NULL; mime_message->reply_to = NULL; mime_message->from = NULL; mime_message->date = CAMEL_MESSAGE_DATE_CURRENT; mime_message->date_offset = 0; mime_message->date_received = CAMEL_MESSAGE_DATE_CURRENT; mime_message->date_received_offset = 0; mime_message->message_id = NULL; }
false
false
false
false
false
0
main() { const unsigned long int intmax = 1000000; unsigned long int *phi = new unsigned long int[intmax + 1]; for (unsigned long int i = 0; i < intmax + 1; ++i) { phi[i] = i; } for (unsigned long int i = 2; i < intmax + 1; ++i) { if (i == phi[i]) { --phi[i]; for (unsigned long int j = 2 * i; j < intmax + 1; j += i) { phi[j] /= i; phi[j] *= (i - 1); } } } unsigned long int bestn = 0, bestphi = 1; for (unsigned long int i = 1; i < intmax + 1; ++i) { if (i * bestphi > bestn * phi[i]) { bestn = i; bestphi = phi[i]; } } cout << "The value of n <= " << intmax << " for which n/phi(n)" << "\nis a maximum is: " << bestn << endl; delete[] phi; }
false
false
false
false
false
0
__lambda2_ (ConfigurationEditor* self, GdkEventKey* event) { gboolean result = FALSE; GdkEventKey _tmp0_; guint _tmp1_; g_return_val_if_fail (event != NULL, FALSE); _tmp0_ = *event; _tmp1_ = _tmp0_.keyval; if (_tmp1_ == ((guint) GDK_KEY_Escape)) { GtkBox* _tmp2_; _tmp2_ = self->priv->search_box; gtk_widget_hide ((GtkWidget*) _tmp2_); result = TRUE; return result; } result = FALSE; return result; }
false
false
false
false
false
0
md5_to_hex(char *out, char *md5) { int i; for (i=0; i<16; i++) { unsigned char c = md5[i]; *out++ = '0' + ((c&0xf0)>>4) + (c>=0xa0)*('a'-'9'-1); *out++ = '0' + (c&0x0f) + ((c&0x0f)>=0x0a)*('a'-'9'-1); } *out = '\0'; }
false
false
false
false
false
0
brcmf_p2p_ifp_removed(struct brcmf_if *ifp) { struct brcmf_cfg80211_info *cfg; struct brcmf_cfg80211_vif *vif; brcmf_dbg(INFO, "P2P: device interface removed\n"); vif = ifp->vif; cfg = wdev_to_cfg(&vif->wdev); cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; rtnl_lock(); cfg80211_unregister_wdev(&vif->wdev); rtnl_unlock(); brcmf_free_vif(vif); }
false
false
false
false
false
0
print_ht_capability(__u16 cap) { #define PRINT_HT_CAP(_cond, _str) \ do { \ if (_cond) \ printf("\t\t\t" _str "\n"); \ } while (0) printf("\t\tCapabilities: 0x%02x\n", cap); PRINT_HT_CAP((cap & BIT(0)), "RX LDPC"); PRINT_HT_CAP((cap & BIT(1)), "HT20/HT40"); PRINT_HT_CAP(!(cap & BIT(1)), "HT20"); PRINT_HT_CAP(((cap >> 2) & 0x3) == 0, "Static SM Power Save"); PRINT_HT_CAP(((cap >> 2) & 0x3) == 1, "Dynamic SM Power Save"); PRINT_HT_CAP(((cap >> 2) & 0x3) == 3, "SM Power Save disabled"); PRINT_HT_CAP((cap & BIT(4)), "RX Greenfield"); PRINT_HT_CAP((cap & BIT(5)), "RX HT20 SGI"); PRINT_HT_CAP((cap & BIT(6)), "RX HT40 SGI"); PRINT_HT_CAP((cap & BIT(7)), "TX STBC"); PRINT_HT_CAP(((cap >> 8) & 0x3) == 0, "No RX STBC"); PRINT_HT_CAP(((cap >> 8) & 0x3) == 1, "RX STBC 1-stream"); PRINT_HT_CAP(((cap >> 8) & 0x3) == 2, "RX STBC 2-streams"); PRINT_HT_CAP(((cap >> 8) & 0x3) == 3, "RX STBC 3-streams"); PRINT_HT_CAP((cap & BIT(10)), "HT Delayed Block Ack"); PRINT_HT_CAP(!(cap & BIT(11)), "Max AMSDU length: 3839 bytes"); PRINT_HT_CAP((cap & BIT(11)), "Max AMSDU length: 7935 bytes"); /* * For beacons and probe response this would mean the BSS * does or does not allow the usage of DSSS/CCK HT40. * Otherwise it means the STA does or does not use * DSSS/CCK HT40. */ PRINT_HT_CAP((cap & BIT(12)), "DSSS/CCK HT40"); PRINT_HT_CAP(!(cap & BIT(12)), "No DSSS/CCK HT40"); /* BIT(13) is reserved */ PRINT_HT_CAP((cap & BIT(14)), "40 MHz Intolerant"); PRINT_HT_CAP((cap & BIT(15)), "L-SIG TXOP protection"); #undef PRINT_HT_CAP }
false
false
false
false
false
0
createDocumentTreeNode(const E_RelationshipType relationshipType, const E_ValueType valueType) { DSRDocumentTreeNode *node = NULL; switch (valueType) { case VT_Text: node = new DSRTextTreeNode(relationshipType); break; case VT_Code: node = new DSRCodeTreeNode(relationshipType); break; case VT_Num: node = new DSRNumTreeNode(relationshipType); break; case VT_DateTime: node = new DSRDateTimeTreeNode(relationshipType); break; case VT_Date: node = new DSRDateTreeNode(relationshipType); break; case VT_Time: node = new DSRTimeTreeNode(relationshipType); break; case VT_UIDRef: node = new DSRUIDRefTreeNode(relationshipType); break; case VT_PName: node = new DSRPNameTreeNode(relationshipType); break; case VT_SCoord: node = new DSRSCoordTreeNode(relationshipType); break; case VT_SCoord3D: node = new DSRSCoord3DTreeNode(relationshipType); break; case VT_TCoord: node = new DSRTCoordTreeNode(relationshipType); break; case VT_Composite: node = new DSRCompositeTreeNode(relationshipType); break; case VT_Image: node = new DSRImageTreeNode(relationshipType); break; case VT_Waveform: node = new DSRWaveformTreeNode(relationshipType); break; case VT_Container: node = new DSRContainerTreeNode(relationshipType); break; case VT_byReference: node = new DSRByReferenceTreeNode(relationshipType); break; default: break; } return node; }
false
false
false
false
false
0
Argument_usage(Argument *arg, gchar *synopsis){ register ArgumentOption *ao; register gint i; Argument_show_version(arg); g_print("\n%s: %s\n", arg->name, arg->desc); if(synopsis){ g_print("%s\n", synopsis); } else { g_print("Synopsis:\n--------\n%s", arg->name); for(i = 0; i < arg->mandatory_set->len; i++){ ao = arg->mandatory_set->pdata[i]; g_print(" <%s>", ao->type); } g_print("\n\n"); } return; }
false
false
false
false
false
0
__iwl_up(struct iwl_priv *priv) { struct iwl_rxon_context *ctx; int ret; lockdep_assert_held(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); return -EIO; } for_each_context(priv, ctx) { ret = iwlagn_alloc_bcast_station(priv, ctx); if (ret) { iwl_dealloc_bcast_stations(priv); return ret; } } ret = iwl_trans_start_hw(priv->trans); if (ret) { IWL_ERR(priv, "Failed to start HW: %d\n", ret); goto error; } ret = iwl_run_init_ucode(priv); if (ret) { IWL_ERR(priv, "Failed to run INIT ucode: %d\n", ret); goto error; } ret = iwl_trans_start_hw(priv->trans); if (ret) { IWL_ERR(priv, "Failed to start HW: %d\n", ret); goto error; } ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR); if (ret) { IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); goto error; } ret = iwl_alive_start(priv); if (ret) goto error; return 0; error: set_bit(STATUS_EXIT_PENDING, &priv->status); iwl_down(priv); clear_bit(STATUS_EXIT_PENDING, &priv->status); IWL_ERR(priv, "Unable to initialize device.\n"); return ret; }
false
false
false
false
false
0
Perl_op_refcnt_lock(pTHX) { dVAR; PERL_UNUSED_CONTEXT; OP_REFCNT_LOCK; }
false
false
false
false
false
0
CreateDefaultRepresentation() { if ( !this->WidgetRep ) { this->WidgetRep = vtkParallelopipedRepresentation::New(); this->WidgetRep->SetRenderer(this->CurrentRenderer); } }
false
false
false
false
false
0
find_match(gfx_res_conf_t *conflist, int type, int nr, int loop, int cel) { while (conflist) { if (resource_matches_patternlists(conflist, type, nr, loop, cel)) { #ifdef DEBUG fprintf(stderr, "[DEBUG:gfx-res] Found match!\n"); #endif return conflist; } conflist = conflist->next; } return NULL; }
false
false
false
false
false
0
bnxt_update_vf_mac(struct bnxt *bp) { struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1); req.fid = cpu_to_le16(0xffff); mutex_lock(&bp->hwrm_cmd_lock); if (_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) goto update_vf_mac_exit; if (!is_valid_ether_addr(resp->perm_mac_address)) goto update_vf_mac_exit; if (!ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr)) memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN); /* overwrite netdev dev_adr with admin VF MAC */ memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN); update_vf_mac_exit: mutex_unlock(&bp->hwrm_cmd_lock); }
false
false
false
false
false
0
gauche__threadsmake_thread(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_) { ScmObj thunk_scm; ScmProcedure* thunk; ScmObj name_scm; ScmObj name; ScmObj SCM_SUBRARGS[3]; int SCM_i; SCM_ENTER_SUBR("make-thread"); if (SCM_ARGCNT >= 3 && !SCM_NULLP(SCM_ARGREF(SCM_ARGCNT-1))) Scm_Error("too many arguments: up to 2 is expected, %d given.", SCM_ARGCNT + Scm_Length(SCM_ARGREF(SCM_ARGCNT-1)) - 1); for (SCM_i=0; SCM_i<3; SCM_i++) { SCM_SUBRARGS[SCM_i] = SCM_ARGREF(SCM_i); } thunk_scm = SCM_SUBRARGS[0]; if (!SCM_PROCEDUREP(thunk_scm)) Scm_Error("procedure required, but got %S", thunk_scm); thunk = SCM_PROCEDURE(thunk_scm); if (SCM_ARGCNT > 1+1) { name_scm = SCM_SUBRARGS[1]; } else { name_scm = SCM_FALSE; } name = (name_scm); { { ScmObj SCM_RESULT; SCM_RESULT=(Scm_MakeThread(thunk,name)); SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT)); } } }
false
false
false
false
false
0
rdp_recv_logon_error_info(rdpRdp* rdp, STREAM* s) { uint32 errorNotificationType; uint32 errorNotificationData; stream_read_uint32(s, errorNotificationType); /* errorNotificationType (4 bytes) */ stream_read_uint32(s, errorNotificationData); /* errorNotificationData (4 bytes) */ }
false
false
false
false
false
0
gst_video_mark_draw_box (GstVideoMark * videomark, guint8 * data, gint width, gint height, gint row_stride, gint pixel_stride, guint8 color) { gint i, j; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { data[pixel_stride * j] = color; } data += row_stride; } }
false
false
false
false
false
0
PushTableEnv(GrpLineAndFile & lnf, std::string staTableName) { Symbol psymTable = SymbolTable()->FindSymbol(staTableName); if (!psymTable || !psymTable->FitsSymbolType(ksymtTable)) { g_errorList.AddError(1181, NULL, "Invalid table name: ", staTableName, lnf); return PushGeneralEnv(lnf); // just push a copy of current env } else { GrcEnv * penvPrev = &(m_venv[m_venv.size() - 1]); Symbol psymPrevTable = penvPrev->Table(); int nPrevPass = penvPrev->Pass(); std::pair<Symbol, int> hmpair; hmpair.first = psymPrevTable; hmpair.second = nPrevPass; m_hmpsymnCurrPass.insert(hmpair); //m_hmpsymnCurrPass.Insert(psymPrevTable, nPrevPass, true); GrcEnv * penvNew = PushEnvAux(); penvNew->SetTable(psymTable); int nPass = 0; std::map<Symbol, int>::iterator hmit = m_hmpsymnCurrPass.find(psymTable); if (hmit != m_hmpsymnCurrPass.end()) nPass = hmit->second; //m_hmpsymnCurrPass.Retrieve(psymTable, &nPass); penvNew->SetPass(nPass); return penvNew; } }
false
false
false
false
false
0
fixup_use_point(struct mtd_info *mtd) { struct map_info *map = mtd->priv; if (!mtd->_point && map_is_linear(map)) { mtd->_point = cfi_intelext_point; mtd->_unpoint = cfi_intelext_unpoint; } }
false
false
false
false
false
0
Detect(const Image &image, vector<Feature *> *features, DetectorData **data) { int num_corners = 0; ByteImage *byte_image = image.AsArray3Du(); if (byte_image) { // Algorithm : // a. Detect. // b. ComputeScores. // c. NonMaxSuppresion. // d. KeepNBestFeatures. int ret_num_corners = 0; xy* corners = fast9_detect(byte_image->Data(), byte_image->Width(), byte_image->Height(), byte_image->Width(), threshold_, &num_corners); int * scores = fast9_score(byte_image->Data(), byte_image->Width(), corners, num_corners, threshold_); xy* nonmax = nonmax_suppression(corners, scores, num_corners, &ret_num_corners); vector< std::pair<xy*,int> > ptScores(ret_num_corners); fast9_scoreMap(byte_image->Data(), byte_image->Width(), nonmax, ret_num_corners, threshold_, & ptScores); std::sort(ptScores.begin(), ptScores.end(), compareFASTPairScore); free(scores); free(corners); for (int i = 0; i < std::min(expectedFeatureNumber_,ret_num_corners); ++i) { PointFeature *f = new PointFeature(ptScores[i].first->x, ptScores[i].first->y); f->scale = 3.0; f->orientation = 0.0; features->push_back(f); } free( nonmax ); if (bRotationInvariant_) { fastRotationEstimation(*byte_image,*features); } } else { LOG(ERROR) << "Invalid input image type for FastDetectorLimited detector"; } // FAST doesn't have a corresponding descriptor, so there's no extra data // to export. if (data) { *data = NULL; } }
false
false
false
false
false
0
_regulator_suspend_finish(struct device *dev, void *data) { struct regulator_dev *rdev = dev_to_rdev(dev); int ret; mutex_lock(&rdev->mutex); if (rdev->use_count > 0 || rdev->constraints->always_on) { if (!_regulator_is_enabled(rdev)) { ret = _regulator_do_enable(rdev); if (ret) dev_err(dev, "Failed to resume regulator %d\n", ret); } } else { if (!have_full_constraints()) goto unlock; if (!_regulator_is_enabled(rdev)) goto unlock; ret = _regulator_do_disable(rdev); if (ret) dev_err(dev, "Failed to suspend regulator %d\n", ret); } unlock: mutex_unlock(&rdev->mutex); /* Keep processing regulators in spite of any errors */ return 0; }
false
false
false
false
false
0
fdilate_1_36(l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls) { l_int32 i; register l_int32 j, pwpls; register l_uint32 *sptr, *dptr; l_int32 wpls2, wpls3, wpls4; l_int32 wpls5, wpls6; wpls2 = 2 * wpls; wpls3 = 3 * wpls; wpls4 = 4 * wpls; wpls5 = 5 * wpls; wpls6 = 6 * wpls; pwpls = (l_uint32)(w + 31) / 32; /* proper wpl of src */ for (i = 0; i < h; i++) { sptr = datas + i * wpls; dptr = datad + i * wpld; for (j = 0; j < pwpls; j++, sptr++, dptr++) { *dptr = (*(sptr + wpls6)) | (*(sptr + wpls5)) | (*(sptr + wpls4)) | (*(sptr + wpls3)) | (*(sptr + wpls2)) | (*(sptr + wpls)) | (*sptr) | (*(sptr - wpls)) | (*(sptr - wpls2)) | (*(sptr - wpls3)) | (*(sptr - wpls4)) | (*(sptr - wpls5)) | (*(sptr - wpls6)); } } }
false
false
false
false
false
0
CreateQuantPixels(TreeNode tree, Pointer input, unsigned char *output, int knt, int float_pixels) { int i; unsigned char *s = (unsigned char *)input; unsigned char *d = output; int skipsize; struct color pbuf; skipsize = float_pixels ? 3*sizeof(float) : sizeof(struct color); for (i = 0; i < knt; i++, s += skipsize, d++) { int q; if (i == find_me) found(); if (float_pixels) { float fr = ((float *)s)[0]; float fg = ((float *)s)[1]; float fb = ((float *)s)[2]; pbuf.r = fr >= 1.0 ? 255 : fr <= 0.0 ? 0 : (unsigned char)(255 * fr); pbuf.g = fg >= 1.0 ? 255 : fg <= 0.0 ? 0 : (unsigned char)(255 * fg); pbuf.b = fb >= 1.0 ? 255 : fb <= 0.0 ? 0 : (unsigned char)(255 * fb); q = SearchTree(tree, (Color)&pbuf, 0); } else q = SearchTree(tree, (Color)s, 0); if (q < 0) return ERROR; *d = q; } return 1; }
false
false
false
false
false
0
doContext() { ContactViewItem *i = (ContactViewItem *)selectedItem(); if(!i) return; ensureItemVisible(i); if(i->type() == ContactViewItem::Group) setOpen(i, !i->isOpen()); else qlv_contextPopup(i, viewport()->mapToGlobal(QPoint(32, itemPos(i))), 0); }
false
false
false
false
false
0
H5A_close(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) HDassert(attr); HDassert(attr->shared); /* Close the object's symbol-table entry */ if(attr->obj_opened && (H5O_close(&(attr->oloc)) < 0)) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info") /* Reference count can be 0. It only happens when H5A_create fails. */ if(attr->shared->nrefs <= 1) { /* Free dynamicly allocated items */ if(H5A_free(attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") /* Destroy shared attribute struct */ attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); } /* end if */ else { /* There are other references to the shared part of the attribute. * Only decrement the reference count. */ --attr->shared->nrefs; } /* end else */ /* Free group hierarchy path */ if(H5G_name_free(&(attr->path)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") attr->shared = NULL; attr = H5FL_FREE(H5A_t, attr); done: FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
onCmdFilter(FXObject*,FXSelector sel,void*){ if (FXSELID(sel)==ID_FILTER_MODE && filterfield->getText().empty()) return 1; if (FXSELTYPE(sel)==SEL_CHANGED) { getApp()->addTimeout(this,ID_FILTER,TIME_MSEC(500)); return 1; } if (FXSELTYPE(sel)==SEL_COMMAND){ getApp()->removeTimeout(this,ID_FILTER); } if (source->setFilter(filterfield->getText().trim().simplify(),filtermask)) refresh(); return 1; }
false
false
false
false
false
0
order(const DenseMatrix &t, const std::vector<DenseMatrix> &basis, unsigned k) { bool eq = true; for (unsigned j = 0; j < t.ncols(); j++) { CSYMPY_ASSERT(is_a<Integer>(*t.get(0, j))); mpz_class t_ = rcp_static_cast<const Integer>(t.get(0, j))->as_mpz(); CSYMPY_ASSERT(is_a<Integer>(*basis[k].get(0, j))); mpz_class b_ = rcp_static_cast<const Integer>(basis[k].get(0, j))->as_mpz(); if (t_ < b_) { return false; } if (t_ > b_) { eq = false; } } return !eq; }
false
false
false
false
false
0
init_lower(zwinid *lower) { zwinid lower_win = &game_windows[0]; glui32 i; if(lower) *lower = lower_win; if(lower_win->win) { z_pause_timed_input(lower_win); glk_window_close(lower_win->win, NULL); } set_stylehints(lower_win->current.fore, lower_win->current.back); lower_win->dirty = TRUE; lower_win->wintype = wintype_TextBuffer; lower_win->method = winmethod_Below; lower_win->curr_offset = 0; lower_win->max_offset = 80 * 24; lower_win->buffer_size = lower_win->max_offset; if(!lower_win->text_buffer) lower_win->text_buffer = (unsigned char *) n_malloc(lower_win->buffer_size); if(!lower_win->color_buffer) lower_win->color_buffer = (colorstyle *) n_malloc(lower_win->buffer_size * sizeof(colorstyle)); for(i = 0; i < lower_win->buffer_size; i++) { lower_win->text_buffer[i] = ' '; lower_win->color_buffer[i] = lower_win->current; } lower_win->actual = lower_win->current; lower_win->win = glk_window_open(game_windows[1].win, winmethod_Below | winmethod_Proportional, 50, /* Percent doesn't matter */ wintype_TextBuffer, 0); if(lower_win->win == 0) { n_show_fatal(E_OUTPUT, "cannot open lower window", 0); return; } lower_win->str = glk_window_get_stream(lower_win->win); if(lower_win->transcript) glk_window_set_echo_stream(lower_win->win, lower_win->transcript); }
false
false
false
false
false
0
ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) { int ret = OMPI_SUCCESS; int delete_flag = 0; char name[256]; if(mca_io_ompio_coll_timing_info){ strcpy (name, "WRITE"); if (!ompi_io_ompio_empty_print_queue(WRITE_PRINT_QUEUE)){ ret = ompi_io_ompio_print_time_info(WRITE_PRINT_QUEUE, name, ompio_fh); if (OMPI_SUCCESS != ret){ printf("Error in print_time_info "); } } strcpy (name, "READ"); if (!ompi_io_ompio_empty_print_queue(READ_PRINT_QUEUE)){ ret = ompi_io_ompio_print_time_info(READ_PRINT_QUEUE, name, ompio_fh); if (OMPI_SUCCESS != ret){ printf("Error in print_time_info "); } } } if ( ompio_fh->f_amode & MPI_MODE_DELETE_ON_CLOSE ) { delete_flag = 1; } /*close the sharedfp file*/ if(ompio_fh->f_sharedfp != NULL){ ret = ompio_fh->f_sharedfp->sharedfp_file_close(ompio_fh); } ret = ompio_fh->f_fs->fs_file_close (ompio_fh); if ( delete_flag && 0 == ompio_fh->f_rank ) { mca_io_ompio_file_delete ( ompio_fh->f_filename, MPI_INFO_NULL ); } mca_fs_base_file_unselect (ompio_fh); mca_fbtl_base_file_unselect (ompio_fh); mca_fcoll_base_file_unselect (ompio_fh); /* mca_sharedfp_base_file_unselect (ompio_fh) ; EG?*/ if (NULL != ompio_fh->f_io_array) { free (ompio_fh->f_io_array); ompio_fh->f_io_array = NULL; } if (NULL != ompio_fh->f_procs_in_group) { free (ompio_fh->f_procs_in_group); ompio_fh->f_procs_in_group = NULL; } if (NULL != ompio_fh->f_decoded_iov) { free (ompio_fh->f_decoded_iov); ompio_fh->f_decoded_iov = NULL; } if (NULL != ompio_fh->f_convertor) { free (ompio_fh->f_convertor); ompio_fh->f_convertor = NULL; } if (NULL != ompio_fh->f_datarep) { free (ompio_fh->f_datarep); ompio_fh->f_datarep = NULL; } if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) { ompi_datatype_destroy (&ompio_fh->f_iov_type); } if (MPI_COMM_NULL != ompio_fh->f_comm) { ompi_comm_free (&ompio_fh->f_comm); } /* if (MPI_INFO_NULL != ompio_fh->f_info) { ompi_info_free (&ompio_fh->f_info); } */ return ret; }
true
true
false
false
false
1
__set_numval(struct expr_t *ndp, word32 av, word32 bv, int32 blen) { ndp->optyp = NUMBER; if (blen <= WBITS) { ndp->ru.xvi = __alloc_shareable_cval(av, bv, blen); } else __case_terr(__FILE__, __LINE__); ndp->szu.xclen = blen; if (bv == 0) ndp->ibase = BDEC; }
true
true
false
false
false
1
ftpPasvCallback(int fd, int status, void *data) { FtpStateData *ftpState = data; debug(9, 3) ("ftpPasvCallback\n"); if (status != COMM_OK) { debug(9, 2) ("ftpPasvCallback: failed to connect. Retrying without PASV.\n"); ftpState->fwd->flags.dont_retry = 0; /* this is a retryable error */ ftpState->fwd->flags.ftp_pasv_failed = 1; ftpFailed(ftpState, ERR_NONE); /* ftpFailed closes ctrl.fd and frees ftpState */ return; } ftpRestOrList(ftpState); }
false
false
false
false
false
0
cb_set_export_option (const char *key, const char *value, GError **err, gpointer user) { Workbook *wb = user; GnmStfExport *stfe = gnm_stf_get_stfe (G_OBJECT (wb)); const char *errtxt; if (strcmp (key, "sheet") == 0) { Sheet *sheet = workbook_sheet_by_name (wb, value); if (!sheet) { errtxt = _("There is no such sheet"); goto error; } gnm_stf_export_options_sheet_list_add (stfe, sheet); return FALSE; } if (strcmp (key, "eol") == 0) { const char *eol; if (g_ascii_strcasecmp ("unix", value) == 0) eol = "\n"; else if (g_ascii_strcasecmp ("mac", value) == 0) eol = "\r"; else if (g_ascii_strcasecmp ("windows", value) == 0) eol = "\r\n"; else { errtxt = _("eol must be one of unix, mac, and windows"); goto error; } g_object_set (G_OBJECT (stfe), "eol", eol, NULL); return FALSE; } if (strcmp (key, "charset") == 0 || strcmp (key, "locale") == 0 || strcmp (key, "quote") == 0 || strcmp (key, "separator") == 0 || strcmp (key, "format") == 0 || strcmp (key, "transliterate-mode") == 0 || strcmp (key, "quoting-mode") == 0 || strcmp (key, "quoting-on-whitespace") == 0) return go_object_set_property (G_OBJECT (stfe), key, key, value, err, (_("Invalid value for option %s: \"%s\""))); errtxt = _("Invalid option for stf exporter"); error: if (err) *err = g_error_new (go_error_invalid (), 0, "%s", errtxt); return TRUE; }
false
false
false
false
false
0
doesSelectionContainRevision() const { fl_BlockLayout* pBlock; fp_Run* pRun; UT_sint32 x, y, x2, y2; UT_uint32 h; bool b; UT_uint32 iPos1 = UT_MIN(m_iInsPoint, getSelectionAnchor()); UT_uint32 iPos2 = UT_MAX(m_iInsPoint, getSelectionAnchor()); _findPositionCoords(iPos1, false, x, y, x2, y2, h, b,&pBlock, &pRun); if (!pBlock) return false; if (!pRun) return false; while(pBlock) { if(!pRun) pRun = pBlock->getFirstRun(); while(pRun) { if(pRun->getBlockOffset() + pBlock->getPosition() >= iPos2) return false; if(pRun->containsRevisions()) return true; pRun = pRun->getNextRun(); } pBlock = pBlock->getNextBlockInDocument(); } return false; }
false
false
false
false
false
0
e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw) { u16 cmd_mmrbc; u16 pcix_cmd; u16 pcix_stat_hi_word; u16 stat_mmrbc; DEBUGFUNC("e1000_pcix_mmrbc_workaround_generic"); /* Workaround for PCI-X issue when BIOS sets MMRBC incorrectly */ if (hw->bus.type != e1000_bus_type_pcix) return; e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd); e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); cmd_mmrbc = (pcix_cmd & PCIX_COMMAND_MMRBC_MASK) >> PCIX_COMMAND_MMRBC_SHIFT; stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> PCIX_STATUS_HI_MMRBC_SHIFT; if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; if (cmd_mmrbc > stat_mmrbc) { pcix_cmd &= ~PCIX_COMMAND_MMRBC_MASK; pcix_cmd |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd); } }
false
false
false
false
false
0
CheckArgumentValue(std::string const& arg) { // Handle states specific to this command. if(this->ArgumentDoing == ArgumentDoingLabels) { this->Labels.insert(arg); return true; } // Look for other arguments. return this->Superclass::CheckArgumentValue(arg); }
false
false
false
false
false
0
embed_signature(DSPAM_CTX *CTX, AGENT_CTX *ATX) { struct nt_node *node_nt; struct nt_c c_nt; char toplevel_boundary[128] = { 0 }; ds_message_part_t block; int i = 0; if (CTX->training_mode == DST_NOTRAIN || ! ATX->signature[0]) return 0; node_nt = c_nt_first (CTX->message->components, &c_nt); if (node_nt == NULL || node_nt->ptr == NULL) return EFAILURE; block = node_nt->ptr; /* Signed messages are handled differently */ if (block->media_subtype == MST_SIGNED) return embed_signed(CTX, ATX); if (block->media_type == MT_MULTIPART && block->terminating_boundary != NULL) { strlcpy(toplevel_boundary, block->terminating_boundary, sizeof(toplevel_boundary)); } while (node_nt != NULL) { char *body_close = NULL, *dup = NULL; block = node_nt->ptr; /* Append signature to blocks when... */ if (block != NULL /* Either a text section, or this is a non-multipart message AND...*/ && (block->media_type == MT_TEXT || (block->boundary == NULL && i == 0 && block->media_type != MT_MULTIPART)) && (toplevel_boundary[0] == 0 || (block->body && block->body->used))) { if (block->content_disposition == PCD_ATTACHMENT) { node_nt = c_nt_next (CTX->message->components, &c_nt); i++; continue; } /* Some email clients reformat HTML parts, and require that we include * the signature before the HTML close tags (because they're stupid) */ if (body_close == NULL && block->body != NULL && block->body->data != NULL && block->media_subtype == MST_HTML) { body_close = strcasestr(block->body->data, "</body"); if (!body_close) body_close = strcasestr(block->body->data, "</html"); } /* Save and truncate everything after and including the close tag */ if (body_close) { dup = strdup (body_close); block->body->used -= (long) strlen (dup); body_close[0] = 0; } buffer_cat (block->body, "\n"); buffer_cat (block->body, SIGNATURE_BEGIN); buffer_cat (block->body, ATX->signature); buffer_cat (block->body, SIGNATURE_END); buffer_cat (block->body, "\n\n"); if (dup) { buffer_cat (block->body, dup); buffer_cat (block->body, "\n\n"); free (dup); } } node_nt = c_nt_next (CTX->message->components, &c_nt); i++; } return 0; }
false
false
false
false
false
0
pump_execute_status (call_frame_t *frame, xlator_t *this) { afr_private_t *priv = NULL; pump_private_t *pump_priv = NULL; uint64_t number_files = 0; char filename[PATH_MAX]; char *dict_str = NULL; int32_t op_ret = 0; int32_t op_errno = 0; dict_t *dict = NULL; int ret = -1; priv = this->private; pump_priv = priv->pump_private; LOCK (&pump_priv->resume_path_lock); { number_files = pump_priv->number_files_pumped; strncpy (filename, pump_priv->current_file, PATH_MAX); } UNLOCK (&pump_priv->resume_path_lock); dict_str = GF_CALLOC (1, PATH_MAX + 256, gf_afr_mt_char); if (!dict_str) { gf_log (this->name, GF_LOG_ERROR, "Out of memory"); op_ret = -1; op_errno = ENOMEM; goto out; } if (pump_priv->pump_finished) { snprintf (dict_str, PATH_MAX + 256, "Number of files migrated = %"PRIu64" Migration complete ", number_files); } else { snprintf (dict_str, PATH_MAX + 256, "Number of files migrated = %"PRIu64" Current file= %s ", number_files, filename); } dict = dict_new (); ret = dict_set_dynstr (dict, RB_PUMP_CMD_STATUS, dict_str); if (ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "dict_set_dynstr returned negative value"); } else { dict_str = NULL; } op_ret = 0; out: AFR_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict); if (dict) dict_unref (dict); if (dict_str) GF_FREE (dict_str); return 0; }
false
false
false
false
false
0
isSingleOrLead(const int32_t (*stateTable)[256], uint8_t state, UBool isDBCSOnly, uint8_t b) { const int32_t *row=stateTable[state]; int32_t entry=row[b]; if(MBCS_ENTRY_IS_TRANSITION(entry)) { /* lead byte */ return hasValidTrailBytes(stateTable, (uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry)); } else { uint8_t action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); if(action==MBCS_STATE_CHANGE_ONLY && isDBCSOnly) { return FALSE; /* SI/SO are illegal for DBCS-only conversion */ } else { return action!=MBCS_STATE_ILLEGAL; } } }
false
false
false
false
false
0
ddf_FreeMatrix(ddf_MatrixPtr M) { ddf_rowrange m1; ddf_colrange d1; if (M!=NULL) { if (M->rowsize<=0) m1=1; else m1=M->rowsize; if (M->colsize<=0) d1=1; else d1=M->colsize; if (M!=NULL) { ddf_FreeAmatrix(m1,d1,M->matrix); ddf_FreeArow(d1,M->rowvec); set_free(M->linset); free(M); } } }
false
false
false
false
false
0
track_pc (struct fdi *fdi, int max_sector) { int i, gap3; uae_u8 *p = fdi->track_src; switch (max_sector) { case 8: gap3 = 116; break; case 9: gap3 = 54; break; default: gap3 = 100; /* fixme */ break; } s11 (fdi); for (i = 0; i < max_sector; i++) { byte_mfm_add (fdi, 0x4e); byte_mfm_add (fdi, 0x4e); ibm_sector_header (fdi, 0, 0, fdi->current_track, 1); ibm_data (fdi, p + i * 512, 0, 512); bytes_mfm_add (fdi, 0x4e, gap3); } bytes_mfm_add (fdi, 0x4e, 600 - gap3); fdi->track_src += fdi->track_len * 256; }
false
false
false
false
false
0
unicode_buf_cmp(const struct unicode_buf *a, const struct unicode_buf *b) { size_t i; for (i=0; i<a->len && i<b->len; i++) { if (a->ptr[i] < b->ptr[i]) return -1; if (a->ptr[i] > b->ptr[i]) return 1; } return (a->len < b->len ? -1:a->len > b->len ? 1:0); }
false
false
false
false
false
0
diff_cursors(sp_pcontext *ctx, bool exclusive) { uint n= 0; sp_pcontext *pctx= this; sp_pcontext *last_ctx= NULL; while (pctx && pctx != ctx) { n+= pctx->m_cursors.elements; last_ctx= pctx; pctx= pctx->parent_context(); } if (pctx) return (exclusive && last_ctx ? n - last_ctx->m_cursors.elements : n); return 0; // Didn't find ctx }
false
false
false
false
false
0
param_get_debug_level(char *buffer, const struct kernel_param *kp) { int result = 0; int i; result = sprintf(buffer, "%-25s\tHex SET\n", "Description"); for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) { result += sprintf(buffer + result, "%-25s\t0x%08lX [%c]\n", acpi_debug_levels[i].name, acpi_debug_levels[i].value, (acpi_dbg_level & acpi_debug_levels[i].value) ? '*' : ' '); } result += sprintf(buffer + result, "--\ndebug_level = 0x%08X (* = enabled)\n", acpi_dbg_level); return result; }
false
false
false
false
false
0
GetFlag(const char* field) { int index = this->FindFlag(field); if ( index == -1 ) { return -1; } else { return this->CopyFieldFlags[index].IsCopied; } }
false
false
false
false
false
0
gst_gnome_vfs_sink_render (GstBaseSink * basesink, GstBuffer * buf) { GnomeVFSFileSize written, cur_pos; GstGnomeVFSSink *sink; GnomeVFSResult result; GstFlowReturn ret; sink = GST_GNOME_VFS_SINK (basesink); if (gnome_vfs_tell (sink->handle, &cur_pos) == GNOME_VFS_OK) { /* bring up to date with current position for proper reporting */ sink->current_pos = cur_pos; } result = gnome_vfs_write (sink->handle, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &written); switch (result) { case GNOME_VFS_OK:{ GST_DEBUG_OBJECT (sink, "wrote %" G_GINT64_FORMAT " bytes at %" G_GINT64_FORMAT, (gint64) written, (gint64) cur_pos); if (written < GST_BUFFER_SIZE (buf)) { /* FIXME: what to do here? (tpm) */ g_warning ("%s: %d bytes should be written, only %" G_GUINT64_FORMAT " bytes written", G_STRLOC, GST_BUFFER_SIZE (buf), written); } sink->current_pos += GST_BUFFER_SIZE (buf); ret = GST_FLOW_OK; break; } case GNOME_VFS_ERROR_NO_SPACE:{ /* TODO: emit signal/send msg on out-of-diskspace and * handle this gracefully (see open bug) (tpm) */ GST_ELEMENT_ERROR (sink, RESOURCE, NO_SPACE_LEFT, (NULL), ("bufsize=%u, written=%u", GST_BUFFER_SIZE (buf), (guint) written)); ret = GST_FLOW_ERROR; break; } default:{ gchar *filename = gnome_vfs_uri_to_string (sink->uri, GNOME_VFS_URI_HIDE_PASSWORD); GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (_("Error while writing to file \"%s\"."), filename), ("%s, bufsize=%u, written=%u", gnome_vfs_result_to_string (result), GST_BUFFER_SIZE (buf), (guint) written)); g_free (filename); ret = GST_FLOW_ERROR; break; } } return ret; }
false
false
false
false
false
0
GetTimeSeriesData( int itemID, const char *vName, const char *vType, vtkFloatArray *result ) { int retVal = 0; if ( this->OpenCurrentFile() ) { int numTimesteps = this->GetNumberOfTimeSteps(); result->SetNumberOfComponents( 1 ); result->SetNumberOfTuples( numTimesteps ); // result->Initialize(); result->SetName( vName ); float *memory = result->GetPointer( 0 ); if ((strcmp(vType, "CELL") == 0) || (strcmp(vType, "cell") == 0) ) { int varid = GetCellArrayID( vName ); // ex_get_elem_var_time assumes zero-based index for varid ex_get_elem_var_time( this->CurrentHandle, varid, itemID, 1, numTimesteps, memory ); retVal = 1; } else if ((strcmp(vType, "POINT") == 0) || (strcmp(vType, "point") == 0) ) { int varid = GetPointArrayID( vName ); // ex_get_nodal_var_time assumes one-based index for varid ex_get_nodal_var_time( this->CurrentHandle, varid + 1, itemID, 1, numTimesteps, memory ); retVal = 1; } else { } this->CloseCurrentFile(); } if ( retVal == 0 ) { // in case there was a problem, we initialize the return data, because // the result is expected to reflect the data we got result->Initialize(); result->SetName( vName ); } return retVal; }
false
false
false
false
false
0
navSetHoldHeading(float targetHeading) { // signbit() returns true if negative sign if (signbit(targetHeading)) // use targetHeading as relative to bearing to target { navData.holdHeading = compassNormalize(navData.holdCourse + targetHeading); } else // use targetHeading as absolute heading { navData.holdHeading = targetHeading; } }
false
false
false
false
false
0
na_append(char *plink_dir, char *name) { int l, sz; char *p; const int cur = na.cur - na.o; l = strlen(plink_dir) + strlen(name) + 2; sz = na.bytes + l; p = realloc(na.o, sz); if (!p) AuFin("realloc"); na.o = p; na.bytes = sz; na.cur = p + cur; na.cur += sprintf(na.cur, "%s/%s", plink_dir, name) + 1; na.nname++; return 0; }
false
true
false
false
false
1
load(int complain) { int x, y, z; FILE *f; if (!filename) return; f = fopen(filename, "r"); if (!f) { if (complain) perror(filename); return; } memset(grid, 0, sizeof(grid)); layer = 0; while (fscanf(f, "%d%*[^0-9-]", &x) > 0) { if (x == 127) break; if (x <= 0) { x = -x; fscanf(f, "%d%*[^0-9-]%d%*[^0-9-]", &y, &z); if (layer < z) layer = z; } grid[x][y][z] = 1; } invalidate(0, 0, table_width, table_height); }
false
false
false
false
true
1
print_offsets(void) { if (!verbose) return; #define print_offset(struct, member) fprintf(fp, \ "koffset(" #struct ", " #member ") = %d\n", koffset(struct, member)) print_offset(trace_array, buffer); print_offset(tracer, name); print_offset(ring_buffer, pages); print_offset(ring_buffer, flags); print_offset(ring_buffer, cpus); print_offset(ring_buffer, buffers); print_offset(ring_buffer_per_cpu, cpu); print_offset(ring_buffer_per_cpu, pages); print_offset(ring_buffer_per_cpu, head_page); print_offset(ring_buffer_per_cpu, tail_page); print_offset(ring_buffer_per_cpu, commit_page); print_offset(ring_buffer_per_cpu, reader_page); print_offset(ring_buffer_per_cpu, overrun); print_offset(ring_buffer_per_cpu, entries); print_offset(buffer_page, read); print_offset(buffer_page, list); print_offset(buffer_page, page); print_offset(list_head, next); print_offset(ftrace_event_call, list); print_offset(ftrace_event_field, link); print_offset(ftrace_event_field, name); print_offset(ftrace_event_field, type); print_offset(ftrace_event_field, offset); print_offset(ftrace_event_field, size); print_offset(ftrace_event_field, is_signed); #undef print_offset }
false
true
false
false
true
1
trialDiv(char *num, FILE *fp){ fseek(fp, 0, SEEK_SET) ; // Create the bignum object BIGNUM *bn_num = NULL ; BIGNUM *bn_word = NULL ; BN_CTX *bn_ctx = NULL ; BIGNUM *bn_rem = NULL ; bn_num = BN_new() ; bn_word = BN_new() ; bn_ctx = BN_CTX_new() ; bn_rem = BN_new() ; if (bn_num == NULL){ fprintf(stderr, "BIGNUM new failed\n") ; return -1; } if (bn_word == NULL){ fprintf(stderr, "BIGNUM new failed\n") ; return -1; } if (bn_ctx == NULL){ fprintf(stderr, "BIGNUM new failed\n") ; return -1; } if (bn_rem == NULL){ fprintf(stderr, "BIGNUM new failed\n") ; return -1; } BN_zero(bn_num) ; BN_zero(bn_word) ; BN_zero(bn_rem) ; BN_CTX_init(bn_ctx) ; if(BN_dec2bn(&bn_num, num) == 0){ fprintf(stderr, "Invalid number\n") ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return -1; } fseek(fp, 0, SEEK_SET) ; uint32_t maxval, word ; fread((uint32_t *)&maxval, 1, 4, fp) ; maxval = htonl(maxval) ; while(!feof(fp)){ int numbytes = fread((uint32_t *)&word, 1, 4, fp) ; if(numbytes == 0) break ; if(BN_bin2bn( (unsigned char *)&word, 4, bn_word) == NULL){ fprintf(stderr, "BIGNUM conversion of binary to bn\n") ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return -1; } if(!BN_cmp(bn_word, bn_num)){ printf("n passes trial division test\n") ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return 1; } // Find the mod if(BN_mod(bn_rem, bn_num, bn_word, bn_ctx )){ if ( BN_is_zero(bn_rem)){ printf("n is composite by trial division (mod %d = 0)\n", htonl(word)) ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return 0; } } } if ( maxval < (unsigned int)sqrt(atoll(num))){ printf("n passes trial division test (not enough primes)\n") ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return 2 ; } else{ printf("n passes trial division test\n") ; BN_free(bn_num) ; BN_free(bn_word) ; BN_free(bn_rem) ; return 1 ; } }
false
false
false
false
true
1
posix_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type, dict_t *xdata) { GF_LOG_OCCASIONALLY (gf_posix_lk_log, this->name, GF_LOG_CRITICAL, "\"features/locks\" translator is " "not loaded. You need to use it for proper " "functioning of your application."); STACK_UNWIND_STRICT (entrylk, frame, -1, ENOSYS, NULL); return 0; }
false
false
false
false
false
0
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) { YYUSE (yyvaluep); YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END }
false
false
false
false
false
0
queryClose() { kDebug(); if ((m_automaton->state() == GameAutomaton::INIT) || (m_automaton->state() == GameAutomaton::INTERLUDE)) { switch ( KMessageBox::warningYesNo( this, i18n("Do you want to quit the game?")) ) { case KMessageBox::Yes : break; default: return false; } } else { switch ( KMessageBox::warningYesNoCancel( this, i18n("Before you quit, do you want to save your game?")) ) { case KMessageBox::Yes : slotSaveGame(); break; case KMessageBox::No : break; default: // cancel return false; } } // hide(); disconnect(&m_timer,SIGNAL(timeout()),this,SLOT(evenementTimer())); disconnectMouse(); m_mouseLocalisation = 0; m_automaton->setGameStatus(KGame::End); /* if (m_theWorld != 0) { delete m_theWorld; m_theWorld = 0; } while (!m_automaton->playerList()->isEmpty()) { delete m_automaton->playerList()->takeFirst(); } delete m_automaton; m_automaton = 0;*/ return true; }
false
false
false
false
false
0
fm10k_reuse_rx_page(struct fm10k_ring *rx_ring, struct fm10k_rx_buffer *old_buff) { struct fm10k_rx_buffer *new_buff; u16 nta = rx_ring->next_to_alloc; new_buff = &rx_ring->rx_buffer[nta]; /* update, and store next to alloc */ nta++; rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; /* transfer page from old buffer to new buffer */ *new_buff = *old_buff; /* sync the buffer for use by the device */ dma_sync_single_range_for_device(rx_ring->dev, old_buff->dma, old_buff->page_offset, FM10K_RX_BUFSZ, DMA_FROM_DEVICE); }
false
false
false
false
false
0
s2250_s_ctrl(struct v4l2_ctrl *ctrl) { struct s2250 *state = container_of(ctrl->handler, struct s2250, hdl); struct i2c_client *client = v4l2_get_subdevdata(&state->sd); u16 oldvalue; switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: read_reg_fp(client, VPX322_ADDR_BRIGHTNESS0, &oldvalue); write_reg_fp(client, VPX322_ADDR_BRIGHTNESS0, ctrl->val | (oldvalue & ~0xff)); read_reg_fp(client, VPX322_ADDR_BRIGHTNESS1, &oldvalue); write_reg_fp(client, VPX322_ADDR_BRIGHTNESS1, ctrl->val | (oldvalue & ~0xff)); write_reg_fp(client, 0x140, 0x60); break; case V4L2_CID_CONTRAST: read_reg_fp(client, VPX322_ADDR_CONTRAST0, &oldvalue); write_reg_fp(client, VPX322_ADDR_CONTRAST0, ctrl->val | (oldvalue & ~0x3f)); read_reg_fp(client, VPX322_ADDR_CONTRAST1, &oldvalue); write_reg_fp(client, VPX322_ADDR_CONTRAST1, ctrl->val | (oldvalue & ~0x3f)); write_reg_fp(client, 0x140, 0x60); break; case V4L2_CID_SATURATION: write_reg_fp(client, VPX322_ADDR_SAT, ctrl->val); break; case V4L2_CID_HUE: write_reg_fp(client, VPX322_ADDR_HUE, ctrl->val); break; default: return -EINVAL; } return 0; }
false
false
false
false
false
0
main(int argc, char** argv) { struct termios oldtio, newtio; char buf; int fd; char script[SLEN]; fd = open(PORT, O_RDWR | O_NOCTTY); if (fd < 0) { perror(PORT); return 1; } tcgetattr(fd, &oldtio); bzero(&newtio, sizeof(newtio)); newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; newtio.c_iflag = IGNPAR; newtio.c_oflag = 0; newtio.c_lflag = 0; newtio.c_cc[VTIME] = 0; newtio.c_cc[VMIN] = 1; tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &newtio); while (1) { read(fd, &buf, 1); printf("Buffer: 0x%hhx :: ", buf); if ((buf & READ) != READ) { printf("State changed to %d\n", buf); snprintf(script, SLEN, SCRIPT_D, buf); system(script); } else { snprintf(script, SLEN, SCRIPT_S, "get"); char state = WEXITSTATUS(system(script)); write(fd, &state, 1); printf("State sent (%d)\n", state); } } usleep(0); tcsetattr(fd, TCSANOW, &oldtio); return 0; }
false
false
false
false
false
0
conf_end_block(struct TopConf *tc) { if(tc->tc_efunc) return tc->tc_efunc(tc); rb_free(conf_cur_block_name); return 0; }
false
false
false
false
false
0
jpc_dec_decodecblks(jpc_dec_t *dec, jpc_dec_tile_t *tile) { jpc_dec_tcomp_t *tcomp; int compcnt; jpc_dec_rlvl_t *rlvl; int rlvlcnt; jpc_dec_band_t *band; int bandcnt; jpc_dec_prc_t *prc; int prccnt; jpc_dec_cblk_t *cblk; int cblkcnt; for (compcnt = dec->numcomps, tcomp = tile->tcomps; compcnt > 0; --compcnt, ++tcomp) { for (rlvlcnt = tcomp->numrlvls, rlvl = tcomp->rlvls; rlvlcnt > 0; --rlvlcnt, ++rlvl) { if (!rlvl->bands) { continue; } for (bandcnt = rlvl->numbands, band = rlvl->bands; bandcnt > 0; --bandcnt, ++band) { if (!band->data) { continue; } for (prccnt = rlvl->numprcs, prc = band->prcs; prccnt > 0; --prccnt, ++prc) { if (!prc->cblks) { continue; } for (cblkcnt = prc->numcblks, cblk = prc->cblks; cblkcnt > 0; --cblkcnt, ++cblk) { if (jpc_dec_decodecblk(dec, tile, tcomp, band, cblk, 1, JPC_MAXLYRS)) { return -1; } } } } } } return 0; }
false
false
false
false
false
0
strip_dir(const char *vg_name, const char *dev_dir) { size_t len = strlen(dev_dir); if (!strncmp(vg_name, dev_dir, len)) vg_name += len; return vg_name; }
false
false
false
false
false
0
drv_CW_start(const char *section) { int i; char *model; char buffer[16]; model = cfg_get(section, "Model", NULL); if (model != NULL && *model != '\0') { for (i = 0; Models[i].type != 0xff; i++) { if (strcasecmp(Models[i].name, model) == 0) break; } if (Models[i].type == 0xff) { error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source()); return -1; } Model = i; info("%s: using model '%s'", Name, Models[Model].name); } else { error("%s: no '%s.Model' entry from %s", Name, section, cfg_source()); return -1; } /* open serial port */ if (drv_generic_serial_open(section, Name, 0) < 0) return -1; /* read firmware version: 0xfe '1' 0xfd */ drv_generic_serial_write("\3761\375", 3); usleep(100000); if (drv_generic_serial_read(buffer, 2) != 2) { info("unable to read firmware version!"); } else { info("Cwlinux Firmware V%d.%d", (int) buffer[0], (int) buffer[1]); } /* read model mumber: 0xfe 0x30 0xfd */ drv_generic_serial_write("\3760\375", 3); usleep(100000); if (drv_generic_serial_read(buffer, 2) != 2) { info("unable to read model number!"); } else { info("Cwlinux model CW%d%d", (int) buffer[0], (int) buffer[1]); } /* initialize global variables */ DROWS = Models[Model].rows; DCOLS = Models[Model].cols; XRES = Models[Model].xres; YRES = Models[Model].yres; GPOS = Models[Model].gpos; GPIS = Models[Model].gpis; CHARS = Models[Model].chars; Protocol = Models[Model].protocol; /* regularly process display input */ timer_add(drv_CW_timer, NULL, 250, 0); drv_CW_clear(); drv_CW_send("\376D\375", 3); /* auto line wrap off */ drv_CW_send("\376R\375", 3); /* auto scroll off */ drv_CW_send("\376K\375", 3); /* underline cursor off */ drv_CW_send("\376B\375", 3); /* backlight on */ /* set brightness */ if (cfg_number(section, "Brightness", 0, 0, 8, &i) > 0) { drv_CW_brightness(i); } return 0; }
true
true
false
false
true
1
reset() { if (filter_) filter_->reset(); }
false
false
false
false
false
0
gst_text_overlay_text_pad_link (GstPad * pad, GstPad * peer) { GstTextOverlay *overlay; overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad)); if (G_UNLIKELY (!overlay)) return GST_PAD_LINK_REFUSED; GST_DEBUG_OBJECT (overlay, "Text pad linked"); overlay->text_linked = TRUE; gst_object_unref (overlay); return GST_PAD_LINK_OK; }
false
false
false
false
false
0
find_inode(void *dev) { struct fpga_inode *temp_chip = fpga_first_inode; if (temp_chip == NULL) return temp_chip; /* Search for the last fpga CI chip or find it by dev */ while ((temp_chip != NULL) && (temp_chip->internal->dev != dev)) temp_chip = temp_chip->next_inode; return temp_chip; }
false
false
false
false
false
0
trash_backend_finalize (GObject *object) { GVfsBackendTrash *backend = G_VFS_BACKEND_TRASH (object); /* get rid of these first to stop a flood of event notifications * from being emitted while we're tearing down the TrashWatcher */ if (backend->file_monitor) g_object_unref (backend->file_monitor); backend->file_monitor = NULL; if (backend->dir_monitor) g_object_unref (backend->dir_monitor); backend->dir_monitor = NULL; trash_watcher_free (backend->watcher); trash_root_free (backend->root); }
false
false
false
false
false
0
ensure(printbuffer *p,int needed) { char *newbuffer;int newsize; if (!p || !p->buffer) return 0; needed+=p->offset; if (needed<=p->length) return p->buffer+p->offset; newsize=pow2gt(needed); newbuffer=(char*)cJSON_malloc(newsize); if (!newbuffer) {cJSON_free(p->buffer);p->length=0,p->buffer=0;return 0;} if (newbuffer) memcpy(newbuffer,p->buffer,p->length); cJSON_free(p->buffer); p->length=newsize; p->buffer=newbuffer; return newbuffer+p->offset; }
false
false
false
false
false
0
reloadRequestWithoutDisposition (QNetworkReply* reply) { QNetworkRequest req (reply->request()); req.setRawHeader("x-kdewebkit-ignore-disposition", "true"); QWebFrame* frame = qobject_cast<QWebFrame*> (req.originatingObject()); if (!frame) return; frame->load(req); }
false
false
false
false
false
0
show() { int mouse_x=0; int mouse_y=0; // Gets the coordinates of the mouse getMousePosition(&mouse_x, &mouse_y); // Check to make sure menu will be displayed on the screen. if (mouse_x + width > xres) { x = xres - width - 1; right_edge=true; } else { x = mouse_x; right_edge=false; } if (mouse_y + height > yres) { y = yres - height; bottom_edge=true; } else { y = mouse_y; bottom_edge=false; } // Move the menu to the position of the mouse pointer XMoveWindow(dpy, item_window, x, y); // Show the menu windows XMapRaised(dpy, item_window); is_visible=true; }
false
false
false
false
false
0
_SCI_MALLOC(size_t size, const char *file, int line, const char *funct) { void *res; #ifdef MALLOC_DEBUG INFO_MEMORY("_SCI_MALLOC()", size, file, line, funct); #endif ALLOC_MEM((res = malloc(size)), size, file, line, funct) #ifdef POISON_MEMORY { memset(res, 0xa5, size); } #endif return res; }
false
false
false
true
false
1
get6_address_index(const struct ares_in6_addr *addr, const struct apattern *sortlist, int nsort) { int i; for (i = 0; i < nsort; i++) { if (sortlist[i].family != AF_INET6) continue; if (!ares_bitncmp(addr, &sortlist[i].addrV6, sortlist[i].mask.bits)) break; } return i; }
false
false
false
false
false
0
fasl_read_buf(fasl_port* p, void* buf, int n){ if((p->memp+n) <= p->memq){ memcpy(buf, p->memp, n); p->memp += n; } else { fprintf(stderr, "fasl_read_buf: read beyond eof\n"); exit(-1); } }
false
false
false
false
false
0
filename(char *path) { static char file[MAXPATHLEN]; char *cp; if (path[strlen(path)-1] == '/') return ""; else { for (cp = path+strlen(path); cp > path && *(cp-1) != '/'; cp--) ; if (cp == path+1) cp--; strncpy(file, cp, sizeof(file)); file[sizeof(file)-1] = '\0'; return file; } }
false
false
false
false
false
0
execute (std::istream &in, Object *root, std::ostream *output, std::istream *input, bool setCurrentClass, bool add_return) { parserLock.acquire(true) ; Scope *oldscope = currentScope ; int oldsl = currentScopeLevel ; interrupted = false ; currentStack = root ; currentScope = root->block ; currentMajorScope = root->block ; currentScopeLevel = root->block->level ; if (setCurrentClass) { currentClass = dynamic_cast<Class*>(currentMajorScope) ; } int errors = numErrors ; string fn = "" ; Context ctx (in, fn, 0, currentContext) ; currentContext = &ctx ; Node *node = NULL ; try { node = parseStream (in) ; if (add_return) { node = new Node (this, RETURN, node) ; } } catch (Exception e) { currentContext = ctx.getPrevious() ; currentScope = oldscope ; currentScopeLevel = oldsl ; parserLock.release(true) ; throw ; } currentContext = ctx.getPrevious() ; Value v ; if (numErrors == errors && node != NULL) { codegen::CodeSequence *code = codegen->generate (node) ; parserLock.release(true) ; VirtualMachine newvm (this) ; if (output != NULL) { newvm.output = new StdOutStream (output) ; newvm.output.stream->setAutoFlush (true) ; } if (input != NULL) { newvm.input = new StdInStream (input) ; } try { newvm.execute (dynamic_cast<InterpretedBlock*>(root->block), code, root, &root->objslink, 0) ; v = newvm.retval ; parserLock.acquire(true); } catch (Exception e) { parserLock.acquire(true); delete code ; if (node != NULL) { deleteTree (node) ; } currentScope = oldscope ; currentScopeLevel = oldsl ; throw ; } delete code ; } if (node != NULL) { deleteTree (node) ; } currentScope = oldscope ; currentScopeLevel = oldsl ; parserLock.release(true) ; return v ; }
false
false
false
false
false
0
_vala_boxes_sidebar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { BoxesSidebar * self; self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SIDEBAR, BoxesSidebar); #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" switch (property_id) { #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" case BOXES_SIDEBAR_ACTOR: #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" g_value_set_object (value, boxes_ui_get_actor ((BoxesUI*) self)); #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" break; #line 947 "sidebar.c" default: #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); #line 12 "/extra-data/checkout/gnome/gnome-boxes/src/sidebar.vala" break; #line 953 "sidebar.c" } }
false
false
false
false
false
0
main2() { DiscreteUniform<int> rng(100); rng.seed((unsigned int)time(0)); for (int i=0; i < 100; ++i) cout << rng.random() << " "; cout << endl; return 0; }
false
false
false
false
false
0