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(Solver&) { assert(solver_ && graph_ && "DefaultUnfoundedCheck::attachTo() not called!"); AtomVec::size_type startAtom = atoms_.size(); // set up new atoms atoms_.resize(graph_->numAtoms()); // set up new bodies for (uint32 i = (uint32)bodies_.size(); i != graph_->numBodies(); ++i) { bodies_.push_back(BodyData()); BodyNodeP n = graph_->getBody(i); if (!n.node->extended()) { initBody(n); } else { initExtBody(n); } // when a body becomes false, it can no longer be used as source solver_->addWatch(~n.node->lit, this, (n.id << 1)); } // check for initially unfounded atoms propagateSource(); for (AtomVec::size_type i = startAtom, end = atoms_.size(); i != end; ++i) { const DependencyGraph::AtomNode& a = graph_->getAtomNode(NodeId(i)); if (!atoms_[i].hasSource() && !solver_->force(~a.lit, 0)) { return false; } if (a.inChoice()) { addExtWatch(~a.lit, NodeId(i)); } } if (strategy_ == only_reason) { delete [] reasons_; reasons_ = new LitVec[solver_->numVars()]; } return true; }
false
false
false
false
false
0
radeon_setup_i2c_bus(struct radeon_i2c_chan *chan, const char *name) { int rc; snprintf(chan->adapter.name, sizeof(chan->adapter.name), "radeonfb %s", name); chan->adapter.owner = THIS_MODULE; chan->adapter.algo_data = &chan->algo; chan->adapter.dev.parent = &chan->rinfo->pdev->dev; chan->algo.setsda = radeon_gpio_setsda; chan->algo.setscl = radeon_gpio_setscl; chan->algo.getsda = radeon_gpio_getsda; chan->algo.getscl = radeon_gpio_getscl; chan->algo.udelay = 10; chan->algo.timeout = 20; chan->algo.data = chan; i2c_set_adapdata(&chan->adapter, chan); /* Raise SCL and SDA */ radeon_gpio_setsda(chan, 1); radeon_gpio_setscl(chan, 1); udelay(20); rc = i2c_bit_add_bus(&chan->adapter); if (rc == 0) dev_dbg(&chan->rinfo->pdev->dev, "I2C bus %s registered.\n", name); else dev_warn(&chan->rinfo->pdev->dev, "Failed to register I2C bus %s.\n", name); return rc; }
false
false
false
false
false
0
copy_uris_with_nautilus (const char *source, const char *src_name, const char *dest) { GError *error = NULL; GDBusProxyFlags flags; GDBusProxy *proxy; GFile *dest_file, *parent; char *dest_name, *dest_dir; g_return_if_fail (source != NULL); g_return_if_fail (dest != NULL); g_return_if_fail (src_name != NULL); /* Must be "" or something interesting, not NULL */ flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES; proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, flags, NULL, /* GDBusInterfaceInfo */ "org.gnome.Nautilus", "/org/gnome/Nautilus", "org.gnome.Nautilus.FileOperations", NULL, /* GCancellable */ &error); if (proxy == NULL) { g_warning ("Could not contact nautilus: %s", error->message); g_error_free (error); return; } dest_file = g_file_new_for_uri (dest); dest_name = g_file_get_basename (dest_file); parent = g_file_get_parent (dest_file); g_object_unref (dest_file); dest_dir = g_file_get_uri (parent); g_object_unref (parent); if (g_dbus_proxy_call_sync (proxy, "CopyFile", g_variant_new ("(&s&s&s&s)", source, src_name, dest_dir, dest_name), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error) == FALSE) { g_warning ("Could not get nautilus to copy file: %s", error->message); g_error_free (error); } g_free (dest_dir); g_free (dest_name); g_object_unref (proxy); }
false
false
false
false
false
0
evas_software_xlib_outbuf_idle_flush(Outbuf *buf) { if (buf->priv.onebuf) { RGBA_Image *im; Outbuf_Region *obr; im = buf->priv.onebuf; buf->priv.onebuf = NULL; obr = im->extended_info; if (obr->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0); if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0); free(obr); #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) { evas_cache2_image_close(&im->cache_entry); } else #endif evas_cache_image_drop(&im->cache_entry); } else { if (buf->priv.prev_pending_writes) XSync(buf->priv.x11.xlib.disp, False); while (buf->priv.prev_pending_writes) { RGBA_Image *im; Outbuf_Region *obr; im = buf->priv.prev_pending_writes->data; buf->priv.prev_pending_writes = eina_list_remove_list(buf->priv.prev_pending_writes, buf->priv.prev_pending_writes); obr = im->extended_info; #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) { evas_cache2_image_close(&im->cache_entry); } else #endif evas_cache_image_drop(&im->cache_entry); if (obr->xob) _unfind_xob(obr->xob, 0); if (obr->mxob) _unfind_xob(obr->mxob, 0); free(obr); } _clear_xob(0); } }
false
false
false
false
false
0
RepresentationFromCharacter(const char *charBytes, size_t len) { PLATFORM_ASSERT(len <= 4); if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])]) return 0; MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len)); if (it != mapReprs.end()) { return &(it->second); } return 0; }
false
false
false
false
false
0
ath10k_pci_remove(struct pci_dev *pdev) { struct ath10k *ar = pci_get_drvdata(pdev); struct ath10k_pci *ar_pci; ath10k_dbg(ar, ATH10K_DBG_PCI, "pci remove\n"); if (!ar) return; ar_pci = ath10k_pci_priv(ar); if (!ar_pci) return; ath10k_core_unregister(ar); ath10k_pci_free_irq(ar); ath10k_pci_kill_tasklet(ar); ath10k_pci_deinit_irq(ar); ath10k_pci_ce_deinit(ar); ath10k_pci_free_pipes(ar); ath10k_pci_sleep_sync(ar); ath10k_pci_release(ar); ath10k_core_destroy(ar); }
false
false
false
false
false
0
printLpStats(const PreproStats& lp) const { printKeyValue("Atoms", "%-6u", lp.atoms); if (lp.trStats) { printf(" (Original: %u Auxiliary: %u)", lp.atoms-lp.trStats->auxAtoms, lp.trStats->auxAtoms); } printf("\n"); printKeyValue("Rules", "%-6u", lp.rules[0]); printf(" (1: %u", lp.rules[BASICRULE] - (lp.trStats?lp.trStats->rules[0]:0)); if (lp.trStats) { printf("/%u", lp.rules[BASICRULE]); } for (int i = 2; i <= OPTIMIZERULE; ++i) { if (lp.rules[i] > 0) { printf(" %d: %u", i, lp.rules[i]); if (lp.trStats) { printf("/%u", lp.rules[i]-lp.trStats->rules[i]); } } } printf(")\n"); printKeyValue("Bodies", "%-6u\n", lp.bodies); if (lp.sumEqs() > 0) { printKeyValue("Equivalences", "%-6u", lp.sumEqs()); printf(" (Atom=Atom: %u Body=Body: %u Other: %u)\n" , lp.numEqs(Var_t::atom_var) , lp.numEqs(Var_t::body_var) , lp.numEqs(Var_t::atom_body_var)); } printKey("Tight"); if (lp.sccs == 0) { printf("Yes"); } else if (lp.sccs != PrgNode::noScc) { printf("%-6s (SCCs: %u Nodes: %u)", "No", lp.sccs, lp.ufsNodes); } else { printf("N/A"); } printf("\n"); }
false
false
false
false
false
0
mprCreateCond() { MprCond *cp; if ((cp = mprAllocObj(MprCond, manageCond)) == 0) { return 0; } cp->triggered = 0; cp->mutex = mprCreateLock(); #if BLD_WIN_LIKE cp->cv = CreateEvent(NULL, FALSE, FALSE, NULL); #elif VXWORKS cp->cv = semCCreate(SEM_Q_PRIORITY, SEM_EMPTY); #else pthread_cond_init(&cp->cv, NULL); #endif return cp; }
false
false
false
false
false
0
FillValues_(Index n_entries, const ScaledMatrix& matrix, Number* values) { // ToDo: // This method can be made much more efficient for ScaledMatrix with GenTMatrix // contained // Get the matrix values FillValues(n_entries, *GetRawPtr(matrix.GetUnscaledMatrix()), values); // Scale the values // To Do : This assumes 1-base values (like the TMatrices) Index* iRow = new Index[n_entries]; Index* jCol = new Index[n_entries]; FillRowCol(n_entries, *GetRawPtr(matrix.GetUnscaledMatrix()), iRow, jCol, 0, 0); if (IsValid(matrix.RowScaling())) { Index n_rows = matrix.NRows(); Number* row_scaling = new Number[n_rows]; FillValuesFromVector(n_rows, *matrix.RowScaling(), row_scaling); for (Index i=0; i<n_entries; i++) { values[i] *= row_scaling[iRow[i]-1]; } delete [] row_scaling; } if (IsValid(matrix.ColumnScaling())) { Index n_cols = matrix.NCols(); Number* col_scaling = new Number[n_cols]; FillValuesFromVector(n_cols, *matrix.ColumnScaling(), col_scaling); for (Index i=0; i<n_entries; i++) { values[i] *= col_scaling[jCol[i]-1]; } delete [] col_scaling; } delete [] iRow; delete [] jCol; }
false
false
false
false
false
0
IsLegal(void) { squareT stmKing = GetKingSquare(); squareT enemyKing = GetEnemyKingSquare(); if(square_Adjacent(stmKing, enemyKing)) { printf("Kings adjacent\n"); return false; } if(RankCount(WP, RANK_1) != 0) { return false; } if(RankCount(WP, RANK_8) != 0) { return false; } if(RankCount(BP, RANK_1) != 0) { return false; } if(RankCount(BP, RANK_8) != 0) { return false; } if(CalcAttacks(ToMove, enemyKing, NULL) > 0) { return false; } return true; }
false
false
false
false
false
0
_lt_list_sort_merge(lt_list_t *l1, lt_list_t *l2, lt_compare_func_t func) { int result; lt_list_t list, *l = &list, *lprev = NULL; while (l1 && l2) { result = func(lt_list_value(l1), lt_list_value(l2)); if (result <= 0) { l->next = l1; l1 = lt_list_next(l1); } else { l->next = l2; l2 = lt_list_next(l2); } l = lt_list_next(l); l->prev = lprev; lprev = l; } l->next = l1 ? l1 : l2; l->next->prev = l; return list.next; }
false
false
false
false
false
0
rwl_writeunlock(brwlock_t *rwl) { int stat, stat2; if (rwl->valid != RWLOCK_VALID) { return EINVAL; } if ((stat = pthread_mutex_lock(&rwl->mutex)) != 0) { return stat; } if (rwl->w_active <= 0) { pthread_mutex_unlock(&rwl->mutex); Jmsg0(NULL, M_ABORT, 0, _("rwl_writeunlock called too many times.\n")); } rwl->w_active--; if (!pthread_equal(pthread_self(), rwl->writer_id)) { pthread_mutex_unlock(&rwl->mutex); Jmsg0(NULL, M_ABORT, 0, _("rwl_writeunlock by non-owner.\n")); } if (rwl->w_active > 0) { stat = 0; /* writers still active */ } else { lmgr_do_unlock(rwl); /* No more writers, awaken someone */ if (rwl->r_wait > 0) { /* if readers waiting */ stat = pthread_cond_broadcast(&rwl->read); } else if (rwl->w_wait > 0) { stat = pthread_cond_broadcast(&rwl->write); } } stat2 = pthread_mutex_unlock(&rwl->mutex); return (stat == 0 ? stat2 : stat); }
false
false
false
false
false
0
mlx5_umr_cq_handler(struct ib_cq *cq, void *cq_context) { struct mlx5_ib_umr_context *context; struct ib_wc wc; int err; while (1) { err = ib_poll_cq(cq, 1, &wc); if (err < 0) { pr_warn("poll cq error %d\n", err); return; } if (err == 0) break; context = (struct mlx5_ib_umr_context *) (unsigned long) wc.wr_id; context->status = wc.status; complete(&context->done); } ib_req_notify_cq(cq, IB_CQ_NEXT_COMP); }
false
false
false
false
false
0
dump_quoted_path(const char *prefix, const char *path, const char *c_meta, const char *c_reset) { printf("%s%s", c_meta, prefix); if (quote_c_style(path, NULL, NULL, 0)) quote_c_style(path, NULL, stdout, 0); else printf("%s", path); printf("%s\n", c_reset); }
false
false
false
false
false
0
nilfs_btree_node_init(struct nilfs_btree_node *node, int flags, int level, int nchildren, int ncmax, const __u64 *keys, const __u64 *ptrs) { __le64 *dkeys; __le64 *dptrs; int i; nilfs_btree_node_set_flags(node, flags); nilfs_btree_node_set_level(node, level); nilfs_btree_node_set_nchildren(node, nchildren); dkeys = nilfs_btree_node_dkeys(node); dptrs = nilfs_btree_node_dptrs(node, ncmax); for (i = 0; i < nchildren; i++) { dkeys[i] = cpu_to_le64(keys[i]); dptrs[i] = cpu_to_le64(ptrs[i]); } }
false
false
false
false
false
0
test_center() { int i; struct js_event ev; if (ioctl(fd, JSIOCGAXES, &axes) < 0) { perror("jscal: error getting axes"); exit(1); } if (ioctl(fd, JSIOCGBUTTONS, &buttons) < 0) { perror("jscal: error getting buttons"); exit(1); } if (fcntl(fd, F_SETFL, O_NONBLOCK)) { perror("jscal: cannot set nonblocking mode"); exit(1); } while (read(fd, &ev, sizeof(struct js_event)) == sizeof(struct js_event)) { switch (ev.type & ~JS_EVENT_INIT) { case JS_EVENT_AXIS: js.axis[ev.number] = ev.value; break; case JS_EVENT_BUTTON: js.buttons = (js.buttons & ~(1 << ev.number)) | (ev.value << ev.number); } } for (i = 0; i < axes; i++) if (js.axis[i]) { fprintf(stderr, "jscal: axes not calibrated\n"); exit(2); } if (js.buttons) { fprintf(stderr, "jscal: buttons pressed\n"); exit(3); } }
false
true
false
false
true
1
xdl_num_out(char *out, long val) { char *ptr, *str = out; char buf[32]; ptr = buf + sizeof(buf) - 1; *ptr = '\0'; if (val < 0) { *--ptr = '-'; val = -val; } for (; val && ptr > buf; val /= 10) *--ptr = "0123456789"[val % 10]; if (*ptr) for (; *ptr; ptr++, str++) *str = *ptr; else *str++ = '0'; *str = '\0'; return str - out; }
false
false
false
false
false
0
main() { MockDb db; MockDb::_serializer_context_t printer; test::TabBar t; //test::TabFoo f; { using T = decltype(update(t)); static_assert(sqlpp::is_regular<T>::value, "type requirement"); } { using T = decltype(update(t).set(t.gamma = false).where(t.beta != "transparent")); static_assert(sqlpp::is_regular<T>::value, "type requirement"); } { using T = decltype(dynamic_update(db, t).dynamic_set(t.gamma = false).dynamic_where()); static_assert(sqlpp::is_regular<T>::value, "type requirement"); } serialize(update(t), printer).str(); serialize(update(t).set(t.gamma = false), printer).str(); serialize(update(t).set(t.gamma = false).where(t.beta != "transparent"), printer).str(); serialize(update(t).set(t.beta = "opaque").where(t.beta != t.beta), printer).str(); auto u = dynamic_update(db, t).dynamic_set(t.gamma = false).dynamic_where(); u.assignments.add(t.beta = "cannot update gamma a second time"); u.where.add(t.gamma != false); printer.reset(); std::cerr << serialize(u, printer).str() << std::endl; db(u); db(update(t).set(t.delta = sqlpp::verbatim<sqlpp::integer>("17+4")).where(true)); db(update(t).set(t.delta = sqlpp::null).where(true)); db(update(t).set(t.delta = sqlpp::default_value).where(true)); db(update(t).set(t.delta += t.alpha * 2, t.beta += " and cake").where(true)); return 0; }
false
false
false
false
false
0
globus_gridftp_server_finished_session_start( globus_gfs_operation_t op, globus_result_t result, void * session_arg, char * username, char * home_dir) { globus_gfs_finished_info_t finished_info; GlobusGFSName(globus_gridftp_server_finished_session_start); GlobusGFSDebugEnter(); globus_l_gfs_data_alive(op->session_handle); memset(&finished_info, '\0', sizeof(globus_gfs_finished_info_t)); finished_info.type = GLOBUS_GFS_OP_SESSION_START; finished_info.result = result; finished_info.info.session.session_arg = session_arg; finished_info.info.session.username = username; finished_info.info.session.home_dir = home_dir; globus_gridftp_server_operation_finished( op, result, &finished_info); if(result != GLOBUS_SUCCESS) { globus_l_gfs_free_session_handle(op->session_handle); } GlobusGFSDebugExit(); }
false
false
false
false
false
0
do_get(GConfEngine* conf, const gchar** args) { GError* err = NULL; if (args == NULL) { g_printerr (_("Must specify a key or keys to get\n")); return 1; } while (*args) { GConfValue* value; gchar* s; err = NULL; value = get_maybe_without_default (conf, *args, &err); if (value != NULL) { if (value->type != GCONF_VALUE_SCHEMA) { s = gconf_value_to_string(value); g_print ("%s\n", s); g_free(s); } else { GConfSchema* sc = gconf_value_get_schema(value); GConfValueType stype = gconf_schema_get_type(sc); GConfValueType slist_type = gconf_schema_get_list_type(sc); GConfValueType scar_type = gconf_schema_get_car_type(sc); GConfValueType scdr_type = gconf_schema_get_cdr_type(sc); const gchar* long_desc = gconf_schema_get_long_desc(sc); const gchar* short_desc = gconf_schema_get_short_desc(sc); const gchar* owner = gconf_schema_get_owner(sc); GConfValue* def_value = gconf_schema_get_default_value(sc); g_print (_("Type: %s\n"), gconf_value_type_to_string(stype)); g_print (_("List Type: %s\n"), gconf_value_type_to_string(slist_type)); g_print (_("Car Type: %s\n"), gconf_value_type_to_string(scar_type)); g_print (_("Cdr Type: %s\n"), gconf_value_type_to_string(scdr_type)); if (def_value) s = gconf_value_to_string (def_value); else s = NULL; g_print (_("Default Value: %s\n"), def_value ? s : _("Unset")); g_free (s); g_print (_("Owner: %s\n"), owner ? owner : _("Unset")); g_print (_("Short Desc: %s\n"), short_desc ? short_desc : _("Unset")); g_print (_("Long Desc: %s\n"), long_desc ? long_desc : _("Unset")); } gconf_value_free(value); } else { if (err == NULL) { g_printerr (_("No value set for `%s'\n"), *args); } else { g_printerr (_("Failed to get value for `%s': %s\n"), *args, err->message); g_error_free(err); err = NULL; } } ++args; } return 0; }
false
false
false
false
false
0
place_zombie_mom(game *g, mission *miss) { int city_id = g->cur_om.closest_city( g->om_location() ); point house = g->cur_om.random_house_in_city(city_id); miss->target = house; // Make it seen on our map for (int x = house.x - 6; x <= house.x + 6; x++) { for (int y = house.y - 6; y <= house.y + 6; y++) g->cur_om.seen(x, y) = true; } tinymap zomhouse(&(g->itypes), &(g->mapitems), &(g->traps)); zomhouse.load(g, house.x * 2, house.y * 2); zomhouse.add_spawn(mon_zombie, 1, SEEX, SEEY, false, -1, miss->uid, random_first_name(false)); zomhouse.save(&(g->cur_om), int(g->turn), house.x * 2, house.y * 2); }
false
false
false
false
false
0
if_convertible_gimple_assign_stmt_p (gimple stmt, VEC (data_reference_p, heap) *refs) { tree lhs = gimple_assign_lhs (stmt); basic_block bb; if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "-------------------------\n"); print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); } if (!is_gimple_reg_type (TREE_TYPE (lhs))) return false; /* Some of these constrains might be too conservative. */ if (stmt_ends_bb_p (stmt) || gimple_has_volatile_ops (stmt) || (TREE_CODE (lhs) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) || gimple_has_side_effects (stmt)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "stmt not suitable for ifcvt\n"); return false; } if (flag_tree_loop_if_convert_stores) { if (ifcvt_could_trap_p (stmt, refs)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "tree could trap...\n"); return false; } return true; } if (gimple_assign_rhs_could_trap_p (stmt)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "tree could trap...\n"); return false; } bb = gimple_bb (stmt); if (TREE_CODE (lhs) != SSA_NAME && bb != bb->loop_father->header && !bb_with_exit_edge_p (bb->loop_father, bb)) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "LHS is not var\n"); print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); } return false; } return true; }
false
false
false
false
false
0
input() { int c; *yy_c_buf_p = yy_hold_char; if(*yy_c_buf_p == (char)0) { if(yy_c_buf_p < &(*yy_current_buffer).yy_ch_buf[yy_n_chars]) *yy_c_buf_p = '\0'; else { int offset = yy_c_buf_p - yytext; ++yy_c_buf_p; switch(yy_get_next_buffer()) { case 2: yyrestart(yyin); case 1: { if(yywrap()) return (-1); if(!yy_did_buffer_switch_on_eof) yyrestart(yyin); return input(); } case 0: yy_c_buf_p = yytext + offset; break; } } } c = *(unsigned char *)yy_c_buf_p; *yy_c_buf_p = '\0'; yy_hold_char = *++yy_c_buf_p; return c; }
false
false
false
false
false
0
populate_hover_window(GncDenseCal *dcal, gint doc) { GtkWidget *w; GDate *date; static const int MAX_STRFTIME_BUF_LEN = 64; gchar strftimeBuf[MAX_STRFTIME_BUF_LEN]; if (doc >= 0) { GObject *o; GtkListStore *model; GList *l; w = GTK_WIDGET(g_object_get_data(G_OBJECT(dcal->transPopup), "dateLabel")); date = g_date_new_dmy(1, dcal->month, dcal->year); g_date_add_days(date, doc); /* Note: the ISO date format (%F or equivalently * %Y-%m-%d) is not a good idea here since many * locales will want to use a very different date * format. Please leave the specification of the date * format up to the locale and use %x here. */ g_date_strftime(strftimeBuf, MAX_STRFTIME_BUF_LEN - 1, "%x", date); gtk_label_set_text(GTK_LABEL(w), strftimeBuf); o = G_OBJECT(dcal->transPopup); model = GTK_LIST_STORE(g_object_get_data(o, "model")); gtk_list_store_clear(model); for (l = dcal->marks[doc]; l; l = l->next) { GtkTreeIter iter; gdc_mark_data *gdcmd; gdcmd = (gdc_mark_data*)l->data; gtk_list_store_insert(model, &iter, INT_MAX); gtk_list_store_set(model, &iter, 0, (gdcmd->name ? gdcmd->name : _("(unnamed)")), 1, gdcmd->info, -1); } g_date_free(date); } }
false
false
false
false
false
0
DetermineSequence( unsigned int m, unsigned int *pm, unsigned int *pa, unsigned int *pc ) { unsigned int fact[MAXFACT]; register unsigned int a=0, c; register unsigned int b; register int pot,best; register int count; register int flag; register int i; do { best = 0; count = DetermineFactors(m,fact); if( (m&3) == 0 ) fact[0] = 4; if( count ) { for( b=m-2; b>0; b-- ) { flag = True; for( i=0; i<count; i++ ) if( b%fact[i] ) { flag = False; break; } if( flag ) { pot = DeterminePotency(m,b+1); if( pot > best ) { best = pot; a = b+1; } } } } m++; } while( best < 3 ); m--; c = DetermineIncrement(m); *pm = m; *pa = a; *pc = c; return best; }
false
false
false
false
false
0
httpRemoveGroup(HttpAuth *auth, cchar *group) { if (auth->groups == 0 || !mprLookupKey(auth->groups, group)) { return MPR_ERR_CANT_ACCESS; } mprRemoveKey(auth->groups, group); return 0; }
false
false
false
false
false
0
powpan_initups(void) { int ret, i; upsdebugx(1, "Trying %s protocol...", powpan_binary.version); ser_set_speed(upsfd, device_path, B1200); /* This fails for many devices, so don't bother to complain */ ser_send_pace(upsfd, UPSDELAY, "\r\r"); for (i = 0; i < MAXTRIES; i++) { ser_flush_io(upsfd); /* * WRITE F\r * READ .PR2200 .x.<.1100 * 01234567890123456789 */ ret = ser_send_pace(upsfd, UPSDELAY, "F\r"); if (ret < 0) { upsdebug_with_errno(3, "send"); continue; } if (ret == 0) { upsdebug_with_errno(3, "send: timeout"); continue; } upsdebug_hex(3, "send", "F\r", 2); usleep(200000); ret = ser_get_line(upsfd, powpan_answer, sizeof(powpan_answer), ENDCHAR, IGNCHAR, SER_WAIT_SEC, SER_WAIT_USEC); if (ret < 0) { upsdebug_with_errno(3, "read"); upsdebug_hex(4, " \\_", powpan_answer, strlen((char *)powpan_answer)); continue; } if (ret == 0) { upsdebugx(3, "read: timeout"); upsdebug_hex(4, " \\_", powpan_answer, strlen((char *)powpan_answer)); continue; } upsdebug_hex(3, "read", powpan_answer, ret); if (ret < 20) { upsdebugx(2, "Expected 20 bytes but only got %d", ret); continue; } if (powpan_answer[0] != '.') { upsdebugx(2, "Expected start character '.' but got '%c'", (char)powpan_answer[0]); continue; } /* See if we need to use the 'old' protocol for the OP series */ if (!strncmp((char *)&powpan_answer[1], "OP", 2)) { type = OP; } /* This is for an older model series, that reports the model numerically */ if (!strncmp((char *)&powpan_answer[1], "rO", 2)) { type = OP; } if (getval("ondelay")) { fatalx(EXIT_FAILURE, "Setting 'ondelay' not supported by %s driver", powpan_binary.version); } if (getval("offdelay")) { fatalx(EXIT_FAILURE, "Setting 'offdelay' not supported by %s driver", powpan_binary.version); } return ret; } return -1; }
false
false
false
false
true
1
launch_file(arg) CONST char *arg; { if (!launcher()) return(view_file(arg)); return(FNC_EFFECT); }
false
false
false
false
false
0
get_previous_sibling() { if(!cobj()->prev) return 0; Node::create_wrapper(cobj()->prev); return static_cast<Node*>(cobj()->prev->_private); }
false
false
false
false
false
0
ath9k_hw_setrxabort(struct ath_hw *ah, bool set) { u32 reg; if (set) { REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); if (!ath9k_hw_wait(ah, AR_OBS_BUS_1, AR_OBS_BUS_1_RX_STATE, 0, AH_WAIT_TIMEOUT)) { REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); reg = REG_READ(ah, AR_OBS_BUS_1); ath_err(ath9k_hw_common(ah), "RX failed to go idle in 10 ms RXSM=0x%x\n", reg); return false; } } else { REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); } return true; }
false
false
false
false
false
0
enic_wq_devcmd2_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int desc_count, unsigned int desc_size) { int err; wq->index = 0; wq->vdev = vdev; wq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD2, 0); if (!wq->ctrl) return -EINVAL; vnic_wq_disable(wq); err = vnic_dev_alloc_desc_ring(vdev, &wq->ring, desc_count, desc_size); return err; }
false
false
false
false
false
0
deleteInlineBoxes(RenderArena* arena) { if (m_firstLineBox) { if (!arena) arena = renderArena(); InlineRunBox *curr=m_firstLineBox, *next=0; while (curr) { next = curr->nextLineBox(); if (!curr->isPlaceHolderBox()) curr->detach(arena, true /*noRemove*/); curr = next; } m_firstLineBox = 0; m_lastLineBox = 0; } }
false
false
false
false
false
0
flimage_ps_options( void ) { static SPEC *sp; if ( ! sp ) { extern float fli_dpi; /* I don't like this and will change it */ sp = fl_calloc( 1, sizeof *sp ); sp->orientation = FLPS_AUTO; sp->paper_w = 8.5; sp->paper_h = 11.0; sp->auto_fit = 1; sp->xdpi = sp->ydpi = fli_dpi; sp->printer_dpi = 300; sp->vm = sp->hm = 0.3; sp->xscale = sp->yscale = 1.0; sp->tmpdir = "/tmp"; sp->gamma = 1.0; sp->verbose = 0; sp->comment = 0; sp->pack = 0; sp->lastr = -1; sp->ps_color = 1; /* cache */ sp->cur_color = FLIMAGE_BADCOLOR; sp->cur_style = sp->cur_size = sp->cur_lw = -1; } return ( FLPS_CONTROL * ) sp; }
false
false
false
false
false
0
enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint32 reliableSequenceNumber, enet_uint8 channelID) { ENetOutgoingCommand * outgoingCommand; ENetListIterator currentCommand; ENetProtocolCommand commandNumber; for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); currentCommand != enet_list_end (& peer -> sentReliableCommands); currentCommand = enet_list_next (currentCommand)) { outgoingCommand = (ENetOutgoingCommand *) currentCommand; if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && outgoingCommand -> command.header.channelID == channelID) break; } if (currentCommand == enet_list_end (& peer -> sentReliableCommands)) return ENET_PROTOCOL_COMMAND_NONE; commandNumber = outgoingCommand -> command.header.command; enet_list_remove (& outgoingCommand -> outgoingCommandList); if (outgoingCommand -> packet != NULL) { peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; -- outgoingCommand -> packet -> referenceCount; if (outgoingCommand -> packet -> referenceCount == 0) enet_packet_destroy (outgoingCommand -> packet); } enet_free (outgoingCommand); if (enet_list_empty (& peer -> sentReliableCommands)) return commandNumber; outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands); peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; return commandNumber; }
false
false
false
false
false
0
checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath) { static char path[PATH_MAX + 1]; struct stat st; int len = state->base_dir_len; if (topath) return write_entry(ce, topath, state, 1); memcpy(path, state->base_dir, len); strcpy(path + len, ce->name); if (!lstat(path, &st)) { unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID); if (!changed) return 0; if (!state->force) { if (!state->quiet) fprintf(stderr, "git-checkout-index: %s already exists\n", path); return -1; } /* * We unlink the old file, to get the new one with the * right permissions (including umask, which is nasty * to emulate by hand - much easier to let the system * just do the right thing) */ if (S_ISDIR(st.st_mode)) { /* If it is a gitlink, leave it alone! */ if (S_ISGITLINK(ce->ce_mode)) return 0; if (!state->force) return error("%s is a directory", path); remove_subtree(path); } else if (unlink(path)) return error("unable to unlink old '%s' (%s)", path, strerror(errno)); } else if (state->not_new) return 0; create_directories(path, state); ce_mark_checkout(ce); return write_entry(ce, path, state, 0); }
false
false
false
false
false
0
createBlockDuplicatedStringLiteral(Loc loc, Type *type, unsigned value, size_t dim, int sz) { utf8_t *s = (utf8_t *)mem.calloc(dim + 1, sz); for (size_t elemi = 0; elemi < dim; ++elemi) { switch (sz) { case 1: s[elemi] = value; break; case 2: ((unsigned short *)s)[elemi] = value; break; case 4: ((unsigned *)s)[elemi] = value; break; default: assert(0); } } StringExp *se = new StringExp(loc, s, dim); se->type = type; se->sz = sz; se->committed = true; se->ownedByCtfe = true; return se; }
false
false
false
false
false
0
cdb_make_addbegin(struct cdb_make *c,unsigned int keylen,unsigned int datalen) { unsigned char buf[8]; if (keylen > 0xffffffff) { errno = ENOMEM; return -1; } if (datalen > 0xffffffff) { errno = ENOMEM; return -1; } uint32_pack(keylen,buf); uint32_pack(datalen,buf + 4); if (!obuf_write(&c->b,(char*)buf,8)) return -1; return 0; }
false
false
false
false
false
0
gee_force_abs_rel (GnmExprEntry *gee) { Rangesel *rs = &gee->rangesel; rs->is_valid = FALSE; if ((gee->flags & GNM_EE_FORCE_ABS_REF)) rs->ref.a.col_relative = rs->ref.b.col_relative = rs->ref.a.row_relative = rs->ref.b.row_relative = FALSE; else if ((gee->flags & GNM_EE_FORCE_REL_REF)) rs->ref.a.col_relative = rs->ref.b.col_relative = rs->ref.a.row_relative = rs->ref.b.row_relative = TRUE; }
false
false
false
false
false
0
go_data_cache_records_fetch_index (GODataCache *cache, unsigned i) { if (cache->records_allocated <= i) go_data_cache_records_set_size (cache, i+128); if (cache->records_len <= i) cache->records_len = i + 1; return go_data_cache_records_index (cache, i); }
false
false
false
false
false
0
H5T_commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id) { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ H5T_state_t old_state = H5T_STATE_TRANSIENT; /* The state of the datatype before H5T_commit. */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_commit_named, FAIL) /* Sanity checks */ HDassert(loc); HDassert(name && *name); HDassert(dt); HDassert(lcpl_id != H5P_DEFAULT); HDassert(tcpl_id != H5P_DEFAULT); HDassert(tapl_id != H5P_DEFAULT); HDassert(dxpl_id != H5P_DEFAULT); /* Record the type's state so that we can revert to it if linking fails */ old_state = dt->shared->state; /* Set up named datatype creation info */ tcrt_info.dt = dt; tcrt_info.tcpl_id = tcpl_id; /* Set up object creation information */ ocrt_info.obj_type = H5O_TYPE_NAMED_DATATYPE; ocrt_info.crt_info = &tcrt_info; ocrt_info.new_obj = NULL; /* Create the new named datatype and link it to its parent group */ if(H5L_link_object(loc, name, &ocrt_info, lcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create and link to named datatype") HDassert(ocrt_info.new_obj); done: /* If the datatype was committed but something failed after that, we need * to return it to the state it was in before it was committed. */ if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") if(H5FO_delete(dt->sh_loc.file, dxpl_id, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects") /* Close the datatype object */ if(H5O_close(&(dt->oloc)) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header") /* Remove the datatype's object header from the file */ if(H5O_delete(dt->sh_loc.file, dxpl_id, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header") /* Mark datatype as being back in memory */ if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); if ( this->Connector ) { os << indent << "Connector: " << this->Connector << "\n"; } else { os << indent << "Connector: (none)\n"; } os << indent << "Dimensionality: " << this->Dimensionality << "\n"; os << indent << "InputConnectValue: " << this->InputConnectValue << "\n"; os << indent << "OutputConnectedValue: " << this->OutputConnectedValue << "\n"; os << indent << "OutputUnconnectedValue: " << this->OutputUnconnectedValue << "\n"; }
false
false
false
false
false
0
_isZipfile(const std::string& filename) { if (FilePath::ext(filename).empty()) { return false; } FILE* f = fopen(FilePath::removeTrailingSlash(filename).c_str(), "r"); if (f == NULL) { return false; } uint8 header[4]; fread(header, 4, 1, f); const uint8 zipHeader[4] = {0x50, 0x4b, 0x03, 0x04}; for (int i = 0; i < 4; ++i) { if (header[i] != zipHeader[i]) { fclose(f); return false; } } fclose(f); return true; }
false
false
false
false
false
0
parse_node(xmlNodePtr node, simple_binary_t **sibxml) { int status = 0; /* Call for the parser function of the node type. */ switch (node->type) { case XML_ELEMENT_NODE: status = parse_element(node, sibxml); break; case XML_TEXT_NODE: status = parse_text(node, sibxml); break; case XML_CDATA_SECTION_NODE: status = parse_cdata(node, sibxml); break; case XML_COMMENT_NODE: case XML_PI_NODE: /* Comments and PIs are ignored. */ break; /* * XML has also many other node types, these are not needed with * SI. Therefore they are assumed to be an error. */ default: error(0, "SI compiler: Unknown XML node in the SI source."); return -1; break; } /* * If node is an element with content, it will need an end tag after it's * children. The status for it is returned by parse_element. */ switch (status) { case 0: if (node->children != NULL) if (parse_node(node->children, sibxml) == -1) return -1; break; case 1: if (node->children != NULL) if (parse_node(node->children, sibxml) == -1) return -1; parse_end(sibxml); break; case -1: /* Something went wrong in the parsing. */ return -1; default: warning(0,"SI compiler: undefined return value in a parse function."); return -1; break; } if (node->next != NULL) if (parse_node(node->next, sibxml) == -1) return -1; return 0; }
false
false
false
false
false
0
ov9740_probe(struct i2c_client *client, const struct i2c_device_id *did) { struct ov9740_priv *priv; struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); int ret; if (!ssdd) { dev_err(&client->dev, "Missing platform_data for driver\n"); return -EINVAL; } priv = devm_kzalloc(&client->dev, sizeof(struct ov9740_priv), GFP_KERNEL); if (!priv) { dev_err(&client->dev, "Failed to allocate private data!\n"); return -ENOMEM; } v4l2_i2c_subdev_init(&priv->subdev, client, &ov9740_subdev_ops); v4l2_ctrl_handler_init(&priv->hdl, 13); v4l2_ctrl_new_std(&priv->hdl, &ov9740_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(&priv->hdl, &ov9740_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); priv->subdev.ctrl_handler = &priv->hdl; if (priv->hdl.error) return priv->hdl.error; priv->clk = v4l2_clk_get(&client->dev, "mclk"); if (IS_ERR(priv->clk)) { ret = PTR_ERR(priv->clk); goto eclkget; } ret = ov9740_video_probe(client); if (ret < 0) { v4l2_clk_put(priv->clk); eclkget: v4l2_ctrl_handler_free(&priv->hdl); } return ret; }
false
false
false
false
false
0
PyFF_Font_set_design_size(PyFF_Font *self,PyObject *value, void *closure) { double temp; if ( value==NULL ) self->fv->sf->design_size = 0; else if ( PyFloat_Check(value)) { temp = PyFloat_AsDouble(value); if ( PyErr_Occurred()!=NULL ) return( -1 ); self->fv->sf->design_size = rint(10.0*temp); } else if ( PyInt_Check(value)) { int t = PyInt_AsLong(value); if ( PyErr_Occurred()!=NULL ) return( -1 ); self->fv->sf->design_size = 10*t; } return( 0 ); }
false
false
false
false
false
0
log_determinant() const { REPORT BandLUMatrix C(*this); return C.log_determinant(); }
false
false
false
false
false
0
dealloc_segment(F_SEGMENT *block) { int pagesize = getpagesize(); int retval = munmap((void*)(block->start - pagesize), pagesize + block->size + pagesize); if(retval) fatal_error("dealloc_segment failed",0); free(block); }
false
false
false
false
false
0
BoxFilter(const Array3Df &in, int box_width, Array3Df *out) { Array3Df tmp; BoxFilterHorizontal(in, box_width, &tmp); BoxFilterVertical(tmp, box_width, out); }
false
false
false
false
false
0
copy_async_lcb(GObject *source_object,GAsyncResult *res,gpointer user_data) { Tcopyfile *cf = user_data; gboolean done; GError *error=NULL; /* fill in the blanks */ done = g_file_copy_finish(cf->curfile,res,&error); if (!done) { if (error->code == G_IO_ERROR_EXISTS) { gint retval; gchar *tmpstr, *dispname; GFileInfo *info =g_file_query_info (cf->curfile,"standard::display-name", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,NULL,NULL); dispname = (gchar *)g_file_info_get_display_name (info); tmpstr = g_strdup_printf(_("%s cannot be copied, it already exists, overwrite?"),dispname); retval = yes_no_dialog (_("Overwrite file?"), tmpstr); g_free(tmpstr); g_free(dispname); if (retval != -8) { g_file_copy_async(cf->curfile,cf->curdest,G_FILE_COPY_OVERWRITE, G_PRIORITY_LOW,NULL, NULL,NULL, copy_async_lcb,cf); return; } }else { g_print("ERROR copying file::%s\n",error->message); g_error_free (error); } } g_object_unref(cf->curfile); g_object_unref(cf->curdest); if (!copy_uris_process_queue(cf)) { filebrowser_backend_refresh_folder (cf->fbback); g_object_unref(cf->destdir); g_slice_free(Tcopyfile,cf); } }
false
false
false
false
false
0
setState(int state) { if(state == d->oldstate) return; d->oldstate = state; if(d->cvi) { d->cv->resetAnim(); d->cvi->setProfileState(state); } }
false
false
false
false
false
0
vorbis_synthesis_read(vorbis_dsp_state *v, int bytes) { if (bytes && v->pcm_returned+bytes>v->centerW) return -131; v->pcm_returned+=bytes; return 0; }
false
false
false
false
false
0
afr_recover_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct gf_flock *lock) { afr_local_t *local = NULL; afr_private_t *priv = NULL; int32_t source_child = 0; struct gf_flock flock = {0,}; local = frame->local; priv = this->private; if (op_ret) { gf_log (this->name, GF_LOG_INFO, "lock recovery failed"); goto cleanup; } source_child = local->source_child; memcpy (&flock, lock, sizeof (*lock)); STACK_WIND_COOKIE (frame, afr_get_locks_fd_cbk, (void *) (long) source_child, priv->children[source_child], priv->children[source_child]->fops->lk, local->fd, F_GETLK_FD, &flock); return 0; cleanup: afr_lock_recovery_cleanup (frame, this); return 0; }
false
true
false
false
false
1
gotoNextLine(char *buffer){ while(*buffer != '\n'){ *buffer++; } while(*buffer == '\n' || *buffer == '\r') *buffer++; return buffer; }
false
false
false
false
false
0
Dialog_ChooseUser(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder) : Gtk::Dialog(cobject), m_combo_name(0) { builder->get_widget_derived("combo_user_name", m_combo_name); }
false
false
false
false
false
0
gdi_ui_create_palette(struct rdp_inst * inst, FRDP_PALETTE * palette) { DEBUG_GDI("gdi_ui_create_palette"); return (FRDP_HPALETTE) gdi_CreatePalette((HGDI_PALETTE) palette); }
false
false
false
false
false
0
assign(QueuedGeometry* qgeom) { // Do we have enough space? if (mRenderOp.vertexData->vertexCount + qgeom->geometry->vertexData->vertexCount > mMaxVertexIndex) { return false; } mQueuedGeometry.push_back(qgeom); mRenderOp.vertexData->vertexCount += qgeom->geometry->vertexData->vertexCount; mRenderOp.indexData->indexCount += qgeom->geometry->indexData->indexCount; return true; }
false
false
false
false
false
0
sptrans_delete(SPTRANS *sptrans) { if ( sptrans ) { if ( sptrans->trig ) { free(sptrans->trig); sptrans->trig = NULL; } if ( sptrans->poli ) { free(sptrans->poli); sptrans->poli = NULL; } if ( sptrans->pold ) { free(sptrans->pold); sptrans->pold = NULL; } if ( sptrans->pol2 ) { free(sptrans->pol2); sptrans->pol2 = NULL; } if ( sptrans->pol3 ) { free(sptrans->pol3); sptrans->pol3 = NULL; } if ( sptrans->coslat ) { free(sptrans->coslat); sptrans->coslat = NULL; } if ( sptrans->rcoslat ) { free(sptrans->rcoslat); sptrans->rcoslat = NULL; } free(sptrans); sptrans = NULL; } }
false
false
false
false
false
0
fwrite4 ( long l, OFILE *f ) { uchar *p = (void*) &l ; return fwrite ( bigendian ? p + sizeof(long ) - 4 : p, 4, 1, f->f ) ; }
false
false
false
false
false
0
matrox_validate_destination( MatroxDriverData *mdrv, MatroxDeviceData *mdev, CardState *state ) { volatile u8 *mmio = mdrv->mmio_base; CoreSurface *destination = state->destination; CoreSurfaceBuffer *depth_buffer = NULL;//destination->depth_buffer; int bytes_per_pixel = DFB_BYTES_PER_PIXEL( destination->config.format ); if (MGA_IS_VALID( m_destination )) return; mdev->dst_pitch = state->dst.pitch / bytes_per_pixel; mdev->depth_buffer = depth_buffer != NULL; if (destination->config.format == DSPF_YUY2 || destination->config.format == DSPF_UYVY) mdev->dst_pitch /= 2; if (mdev->blit_fields && !(destination->config.caps & DSCAPS_SEPARATED)) mdev->dst_pitch *= 2; D_ASSERT( mdev->dst_pitch % 32 == 0 ); matrox_calc_offsets( mdev, destination, &state->dst, mdev->old_matrox, mdev->dst_offset ); mga_waitfifo( mdrv, mdev, depth_buffer ? 4 : 3 ); mga_out32( mmio, mdev->dst_offset[0][0], mdev->old_matrox ? YDSTORG : DSTORG ); mga_out32( mmio, mdev->dst_pitch, PITCH ); #if 0 if (depth_buffer) mga_out32( mmio, depth_buffer->video.offset, ZORG ); #endif switch (destination->config.format) { case DSPF_A8: case DSPF_ALUT44: case DSPF_LUT8: case DSPF_RGB332: mga_out32( mmio, PW8, MACCESS ); break; case DSPF_RGB555: case DSPF_ARGB1555: mga_out32( mmio, PW16 | DIT555, MACCESS ); break; case DSPF_RGB444: case DSPF_ARGB4444: case DSPF_RGB16: mga_out32( mmio, PW16, MACCESS ); break; case DSPF_RGB24: mga_out32( mmio, PW24, MACCESS ); break; case DSPF_RGB32: case DSPF_ARGB: mga_out32( mmio, PW32, MACCESS ); break; case DSPF_I420: case DSPF_YV12: case DSPF_NV12: case DSPF_NV21: mga_out32( mmio, PW8 | BYPASS332 | NODITHER, MACCESS ); break; case DSPF_YUY2: case DSPF_UYVY: mga_out32( mmio, PW32 | NODITHER, MACCESS ); break; default: D_BUG( "unexpected pixelformat!" ); break; } MGA_VALIDATE( m_destination ); }
false
false
false
false
false
0
branch_open(struct view *view, enum open_flags flags) { const char *branch_log[] = { "git", "log", ENCODING_ARG, "--no-color", "--pretty=raw", "--simplify-by-decoration", "--all", NULL }; if (!begin_update(view, NULL, branch_log, flags)) { report("Failed to load branch data"); return TRUE; } branch_open_visitor(view, &branch_all); foreach_ref(branch_open_visitor, view); view->p_restore = TRUE; return TRUE; }
false
false
false
false
false
0
tdb1_wipe_all(struct tdb_context *tdb) { int i; tdb1_off_t offset = 0; ssize_t data_len; tdb1_off_t recovery_head; tdb1_len_t recovery_size = 0; if (tdb_lockall(tdb) != TDB_SUCCESS) { return -1; } /* see if the tdb has a recovery area, and remember its size if so. We don't want to lose this as otherwise each tdb1_wipe_all() in a transaction will increase the size of the tdb by the size of the recovery area */ if (tdb1_ofs_read(tdb, TDB1_RECOVERY_HEAD, &recovery_head) == -1) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_wipe_all: failed to read recovery head"); goto failed; } if (recovery_head != 0) { struct tdb1_record rec; if (tdb->tdb1.io->tdb1_read(tdb, recovery_head, &rec, sizeof(rec), TDB1_DOCONV()) == -1) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_wipe_all: failed to read recovery record"); return -1; } recovery_size = rec.rec_len + sizeof(rec); } /* wipe the hashes */ for (i=0;i<tdb->tdb1.header.hash_size;i++) { if (tdb1_ofs_write(tdb, TDB1_HASH_TOP(i), &offset) == -1) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_wipe_all: failed to write hash %d", i); goto failed; } } /* wipe the freelist */ if (tdb1_ofs_write(tdb, TDB1_FREELIST_TOP, &offset) == -1) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_wipe_all: failed to write freelist"); goto failed; } /* add all the rest of the file to the freelist, possibly leaving a gap for the recovery area */ if (recovery_size == 0) { /* the simple case - the whole file can be used as a freelist */ data_len = (tdb->file->map_size - TDB1_DATA_START(tdb->tdb1.header.hash_size)); if (tdb1_free_region(tdb, TDB1_DATA_START(tdb->tdb1.header.hash_size), data_len) != 0) { goto failed; } } else { /* we need to add two freelist entries - one on either side of the recovery area Note that we cannot shift the recovery area during this operation. Only the transaction.c code may move the recovery area or we risk subtle data corruption */ data_len = (recovery_head - TDB1_DATA_START(tdb->tdb1.header.hash_size)); if (tdb1_free_region(tdb, TDB1_DATA_START(tdb->tdb1.header.hash_size), data_len) != 0) { goto failed; } /* and the 2nd free list entry after the recovery area - if any */ data_len = tdb->file->map_size - (recovery_head+recovery_size); if (tdb1_free_region(tdb, recovery_head+recovery_size, data_len) != 0) { goto failed; } } tdb1_increment_seqnum_nonblock(tdb); tdb_unlockall(tdb); return 0; failed: tdb_unlockall(tdb); return -1; }
false
false
false
false
false
0
arcmsr_hbaB_polling_ccbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_ccb) { struct MessageUnit_B *reg = acb->pmuB; struct ARCMSR_CDB *arcmsr_cdb; struct CommandControlBlock *ccb; uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0; int index, rtn; bool error; polling_hbb_ccb_retry: poll_count++; /* clear doorbell interrupt */ writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell); while(1){ index = reg->doneq_index; flag_ccb = reg->done_qbuffer[index]; if (flag_ccb == 0) { if (poll_ccb_done){ rtn = SUCCESS; break; }else { msleep(25); if (poll_count > 100){ rtn = FAILED; break; } goto polling_hbb_ccb_retry; } } reg->done_qbuffer[index] = 0; index++; /*if last index number set it to 0 */ index %= ARCMSR_MAX_HBB_POSTQUEUE; reg->doneq_index = index; /* check if command done with no error*/ arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset + (flag_ccb << 5)); ccb = container_of(arcmsr_cdb, struct CommandControlBlock, arcmsr_cdb); poll_ccb_done |= (ccb == poll_ccb) ? 1 : 0; if ((ccb->acb != acb) || (ccb->startdone != ARCMSR_CCB_START)) { if ((ccb->startdone == ARCMSR_CCB_ABORTED) || (ccb == poll_ccb)) { printk(KERN_NOTICE "arcmsr%d: scsi id = %d lun = %d ccb = '0x%p'" " poll command abort successfully \n" ,acb->host->host_no ,ccb->pcmd->device->id ,(u32)ccb->pcmd->device->lun ,ccb); ccb->pcmd->result = DID_ABORT << 16; arcmsr_ccb_complete(ccb); continue; } printk(KERN_NOTICE "arcmsr%d: polling get an illegal ccb" " command done ccb = '0x%p'" "ccboutstandingcount = %d \n" , acb->host->host_no , ccb , atomic_read(&acb->ccboutstandingcount)); continue; } error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE0) ? true : false; arcmsr_report_ccb_state(acb, ccb, error); } return rtn; }
false
false
false
false
false
0
gst_rtspsrc_parse_rtpmap (const gchar * rtpmap, gint * payload, gchar ** name, gint * rate, gchar ** params) { gchar *p, *t; p = (gchar *) rtpmap; PARSE_INT (p, " ", *payload); if (*payload == -1) return FALSE; SKIP_SPACES (p); if (*p == '\0') return FALSE; PARSE_STRING (p, "/", *name); if (*name == NULL) { GST_DEBUG ("no rate, name %s", p); /* no rate, assume -1 then, this is not supposed to happen but RealMedia * streams seem to omit the rate. */ *name = p; *rate = -1; return TRUE; } t = p; p = strstr (p, "/"); if (p == NULL) { *rate = atoi (t); return TRUE; } *p = '\0'; p++; *rate = atoi (t); t = p; if (*p == '\0') return TRUE; *params = t; return TRUE; }
false
false
false
false
true
1
pdfmark_PAGELABEL(gx_device_pdf * pdev, gs_param_string * pairs, uint count, const gs_matrix * pctm, const gs_param_string * no_objname) { gs_param_string key; if (pdev->CompatibilityLevel >= 1.3) { if (pdfmark_find_key("/Label", pairs, count, &key)) { return pdfmark_add_pagelabel(pdev, &key); } } return 0; }
false
false
false
false
false
0
libsmdev_scsi_ioctrl( libcfile_file_t *device_file, void *request_data, size_t request_data_size, libcerror_error_t **error ) { uint8_t *ioctrl_request = 0; static char *function = "libsmdev_scsi_ioctrl"; size_t ioctrl_request_size = 0; ssize_t read_count = 0; ioctrl_request_size = sizeof( libsmdev_scsi_ioctrl_header_t ) + request_data_size; ioctrl_request = (uint8_t *) memory_allocate( ioctrl_request_size ); if( ioctrl_request == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create SCSI ioctrl request.", function ); goto on_error; } if( memory_set( ioctrl_request, 0, ioctrl_request_size ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear SCSI ioctrl request.", function ); goto on_error; } ( (libsmdev_scsi_ioctrl_header_t *) ioctrl_request )->request_size = request_data_size; if( memory_copy( &( ioctrl_request[ sizeof( libsmdev_scsi_ioctrl_header_t ) ] ), request_data, request_data_size ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set SCSI ioctrl request.", function ); goto on_error; } read_count = libcfile_file_io_control_read( device_file, SCSI_IOCTL_SEND_COMMAND, NULL, 0, ioctrl_request, ioctrl_request_size, error ); if( read_count == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_IOCTL_FAILED, "%s: unable to query device for: SCSI_IOCTL_SEND_COMMAND.", function ); goto on_error; } memory_free( ioctrl_request ); return( 1 ); on_error: if( ioctrl_request != NULL ) { memory_free( ioctrl_request ); } return( 1 ); }
false
false
false
false
false
0
clip_hw_small(double* val, int* mask, int min, int max, int DRS_SFF_HW_MIN) { /* this routine mask out negative half width values */ int i=0; for (i= min;i<max; i++) { if (val[i] < DRS_SFF_HW_MIN) mask[i]=0; } }
false
false
false
false
false
0
xfs_ilock_attr_map_shared( struct xfs_inode *ip) { uint lock_mode = XFS_ILOCK_SHARED; if (ip->i_d.di_aformat == XFS_DINODE_FMT_BTREE && (ip->i_afp->if_flags & XFS_IFEXTENTS) == 0) lock_mode = XFS_ILOCK_EXCL; xfs_ilock(ip, lock_mode); return lock_mode; }
false
false
false
false
false
0
execute_branch(struct Object *ast, struct Object *scope) { if (ast == NULL || ast->type != T_LIST) return NULL; struct Object* stack = clone_object(list_object); int length = mojo_list_length(ast->value.l_value); if (length == 0) return NULL; // first, execute all the sub-expressions int i = 0; for (i = 0; i < length; i++) { struct Object *obj = (struct Object*) list_nth(ast, i); if(obj == NULL) continue; if(obj->type == T_LIST) { list_append(stack, execute_branch(obj, scope)); } else { list_append(stack, obj); } } // now execute the expression itself length = mojo_list_length(ast->value.l_value); if (length == 0) { return nil_object; } else if (length == 1) { return list_nth(stack, 1); } else if (length > 1) { struct Object *destObject = list_nth(stack, 0); struct Object *methodName = list_nth(stack, 1); if(destObject->type == T_SYMBOL && strcmp(methodName->name, ":=") == 0) { // this is an assignment puts("assignment"); struct Object *value = list_nth(stack, 2); struct Object* var = clone_object(base_object); var->type = T_SYMBOL; var->name = strdup(destObject->name); var->value.v_value = clone_object(value); list_append(scope->symtab, var); } else { // this is a regular method call struct Object *method = (struct Object*) lookup_method(destObject, methodName->name); if(method == nil_object) { fail("error : method %s not found in object %s", methodName->name, destObject->name); } /* we use the fact that if list_nth doesn't find an * object because it doesn't exists at the index, it returns nil */ struct Object *param1 = list_nth(stack, 2), *param2 = list_nth(stack, 3), *param3 = list_nth(stack, 4), *param4 = list_nth(stack, 5); if (param1->type == T_SYMBOL) { struct Object *o = lookup_variable(scope, param1->name); if (o != nil_object) param1 = o; } destObject = method->value.c_method(destObject, param1, param2, param3, param4); } puts("freeing stuff"); display_object(stack, 0); printf(">>> stack len : %d addr : %x\n", mojo_list_length(stack->value.l_value), stack->value.l_value); free_object(stack); return destObject; } return nil_object; }
false
false
false
false
false
0
egg_sm_client_get (void) { if (!global_client) { if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED && !sm_client_disable) { #if defined (GDK_WINDOWING_WIN32) global_client = egg_sm_client_win32_new (); #elif defined (GDK_WINDOWING_QUARTZ) global_client = egg_sm_client_osx_new (); #else /* If both D-Bus and XSMP are compiled in, try XSMP first * (since it supports state saving) and fall back to D-Bus * if XSMP isn't available. */ # ifdef EGG_SM_CLIENT_BACKEND_XSMP global_client = egg_sm_client_xsmp_new (); # endif # ifdef EGG_SM_CLIENT_BACKEND_DBUS if (!global_client) global_client = egg_sm_client_dbus_new (); # endif #endif } /* Fallback: create a dummy client, so that callers don't have * to worry about a %NULL return value. */ if (!global_client) global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL); } return global_client; }
false
false
false
false
false
0
defineValue ( const std::string &magick_, const std::string &key_ ) const { std::string definition = magick_ + ":" + key_; const char *option = GetImageOption ( constImageInfo(), definition.c_str() ); if (option) return std::string( option ); return std::string( ); }
false
false
false
false
false
0
on_expose_event(GdkEventExpose* event) { RefPtr<Gdk::Window> win = get_window(); RefPtr<GC> gc = GC::create(win); gc->set_foreground(m_color); for (unsigned i = 0; i < m_strings.size(); ++i) { int y = i * (m_height / m_strings.size()); win->draw_layout(gc, 0, y, m_strings[i]); } return true; }
false
false
false
false
false
0
insert_clef(struct SYMBOL *s, int clef_type) { struct VOICE_S *p_voice; struct SYMBOL *new_s; /* don't insert the clef between two bars */ if (s->type == BAR && s->prev != 0 && s->prev->type == BAR /* && s->time == s->prev->time */ ) s = s->prev; /* create the symbol */ p_voice = &voice_tb[s->voice]; if ((p_voice->last_sym = s->prev) == 0) p_voice->sym = 0; p_voice->time = s->time; new_s = sym_add(p_voice, CLEF); new_s->next = s; s->prev = new_s; new_s->as.u.clef.type = clef_type; new_s->as.u.clef.line = clef_type == TREBLE ? 2 : 4; new_s->staff = s->staff; new_s->u = 1; /* small clef */ new_s->sflags &= ~S_SECOND; /* link in time */ while (!(s->sflags & S_SEQST)) s = s->ts_prev; if (s->type == STAVES) { s = s->ts_next; s->sflags |= S_SEQST; } else if (s->ts_prev == 0 || s->ts_prev->type != CLEF) { new_s->sflags |= S_SEQST; } if ((new_s->ts_prev = s->ts_prev) != 0) new_s->ts_prev->ts_next = new_s; else tsfirst = new_s; new_s->ts_next = s; s->ts_prev = new_s; }
false
false
false
false
false
0
copy_hetero_dir_to_block(Block *bpt) { Directive *src; Directive *prev; Directive *next; Statement *stm; src = search_stm_hetero_directive(bpt); while (src != NULL) { prev = src->prev; next = src->next; if (next != NULL) { next->prev = prev; } if (prev != NULL) { prev->next = next; } else { stm = src->owner.statement; stm->dir_pre_head = next; } src->next = bpt->dir_pre_head; src->prev = NULL; src->owners_type = DIR_OWNERIS_BLOCK; src->owner.block = bpt; bpt->dir_pre_head = src; src = search_stm_hetero_directive(bpt); } }
false
false
false
false
false
0
cp_read_tm_cut_list(cut_pool *cp, char *file) { FILE *f; int i, j, tmp1 = 0, tmp2 = 0; char str[20]; if (!(f = fopen(file, "r"))){ printf("\nError opening cut file\n\n"); return(0); } cp->size = 0; fscanf(f, "%s %i %i", str, &cp->cut_num, &cp->allocated_cut_num); cp->cuts = (cp_cut_data **) malloc(cp->allocated_cut_num*sizeof(cp_cut_data *)); for (i = 0; i < cp->cut_num; i++){ cp->cuts[i] = (cp_cut_data *) calloc(1, sizeof(cp_cut_data)); fscanf(f, "%i %i %i %c %i %lf %lf", &cp->cuts[i]->cut.name, &cp->cuts[i]->cut.size, &tmp1, &cp->cuts[i]->cut.sense, &tmp2, &cp->cuts[i]->cut.rhs, &cp->cuts[i]->cut.range); cp->cuts[i]->cut.type = (char)tmp1; cp->cuts[i]->cut.branch = (char)tmp2; cp->cuts[i]->cut.coef = (char *) malloc(cp->cuts[i]->cut.size*sizeof(char)); cp->size += cp->cuts[i]->cut.size + (int) sizeof(cp_cut_data); for (j = 0; j < cp->cuts[i]->cut.size; j++){ fscanf(f, "%i ", &tmp1); cp->cuts[i]->cut.coef[j] = (char)tmp1; } } fclose(f); return(1); }
false
true
false
false
true
1
CCtrace(av) char *av[]; { char *p; BOOL Flag; STRING word; CHANNEL *cp; /* Parse the flag. */ p = av[1]; switch (p[0]) { default: return "1 Bad trace flag"; case 'y': case 'Y': Flag = TRUE; word = "on"; break; case 'n': case 'N': Flag = FALSE; word = "off"; break; } /* Parse what's being traced. */ p = av[0]; switch (*p) { default: return "1 Bad trace item"; case 'i': case 'I': Tracing = Flag; syslog(L_NOTICE, "%s trace innd %s", LogName, word); break; case 'n': case 'N': NNRPTracing = Flag; syslog(L_NOTICE, "%s trace nnrpd %s", LogName, word); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if ((cp = CHANfromdescriptor(atoi(p))) == NULL) return CCnochannel; CHANtracing(cp, Flag); break; } return NULL; }
false
false
false
false
false
0
reset (int fd, struct stat const *st) { if (! pagesize) { pagesize = getpagesize (); if (pagesize == 0 || 2 * pagesize + 1 <= pagesize) abort (); bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1; buffer = xmalloc (bufalloc); } bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize); bufbeg[-1] = eolbyte; bufdesc = fd; if (S_ISREG (st->st_mode)) { if (fd != STDIN_FILENO) bufoffset = 0; else { bufoffset = lseek (fd, 0, SEEK_CUR); if (bufoffset < 0) { suppressible_error (_("lseek failed"), errno); return 0; } } } return 1; }
false
false
false
false
false
0
ali_program_modes(struct ata_port *ap, struct ata_device *adev, struct ata_timing *t, u8 ultra) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); int cas = 0x58 + 4 * ap->port_no; /* Command timing */ int cbt = 0x59 + 4 * ap->port_no; /* Command timing */ int drwt = 0x5A + 4 * ap->port_no + adev->devno; /* R/W timing */ int udmat = 0x56 + ap->port_no; /* UDMA timing */ int shift = 4 * adev->devno; u8 udma; if (t != NULL) { t->setup = clamp_val(t->setup, 1, 8) & 7; t->act8b = clamp_val(t->act8b, 1, 8) & 7; t->rec8b = clamp_val(t->rec8b, 1, 16) & 15; t->active = clamp_val(t->active, 1, 8) & 7; t->recover = clamp_val(t->recover, 1, 16) & 15; pci_write_config_byte(pdev, cas, t->setup); pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); pci_write_config_byte(pdev, drwt, (t->active << 4) | t->recover); } /* Set up the UDMA enable */ pci_read_config_byte(pdev, udmat, &udma); udma &= ~(0x0F << shift); udma |= ultra << shift; pci_write_config_byte(pdev, udmat, udma); }
false
false
false
false
false
0
ocon_state_size(const qpol_iterator_t * iter) { ocon_state_t *os = NULL; size_t count = 0; ocontext_t *ocon = NULL; if (iter == NULL || iter->state == NULL) { errno = EINVAL; return 0; } os = (ocon_state_t *) iter->state; for (ocon = os->head; ocon; ocon = ocon->next) count++; return count; }
false
false
false
false
false
0
xmpp_stream_performtls(XmppStream *stream) { g_return_if_fail(stream != NULL); hybrid_account_set_connection_string(stream->account->account, _("Start performing tls...")); if (!(stream->ssl = hybrid_ssl_connect_with_fd( stream->sk, (ssl_callback)tls_conn_cb, stream))) { hybrid_account_error_reason(stream->account->account, _("TLS hand-shake failed.")); return; } }
false
false
false
false
false
0
VisitJSFunctionAndFlushCode(Map* map, HeapObject* object) { JSFunction* jsfunction = reinterpret_cast<JSFunction*>(object); // The function must have a valid context and not be a builtin. bool flush_code_candidate = false; if (IsValidNotBuiltinContext(jsfunction->unchecked_context())) { flush_code_candidate = FlushCodeForFunction(jsfunction); } if (!flush_code_candidate) { MarkCompactCollector::MarkObject( jsfunction->unchecked_shared()->unchecked_code()); if (jsfunction->unchecked_code()->kind() == Code::OPTIMIZED_FUNCTION) { // For optimized functions we should retain both non-optimized version // of it's code and non-optimized version of all inlined functions. // This is required to support bailing out from inlined code. DeoptimizationInputData* data = reinterpret_cast<DeoptimizationInputData*>( jsfunction->unchecked_code()->unchecked_deoptimization_data()); FixedArray* literals = data->UncheckedLiteralArray(); for (int i = 0, count = data->InlinedFunctionCount()->value(); i < count; i++) { JSFunction* inlined = reinterpret_cast<JSFunction*>(literals->get(i)); MarkCompactCollector::MarkObject( inlined->unchecked_shared()->unchecked_code()); } } } VisitJSFunctionFields(map, reinterpret_cast<JSFunction*>(object), flush_code_candidate); }
false
false
false
false
false
0
parseShiftExp() { Expression *e; Expression *e2; Loc loc = token.loc; e = parseAddExp(); while (1) { switch (token.value) { case TOKshl: nextToken(); e2 = parseAddExp(); e = new ShlExp(loc,e,e2); continue; case TOKshr: nextToken(); e2 = parseAddExp(); e = new ShrExp(loc,e,e2); continue; case TOKushr: nextToken(); e2 = parseAddExp(); e = new UshrExp(loc,e,e2); continue; default: break; } break; } return e; }
false
false
false
false
false
0
alt_match_null_string_p (p, end, reg_info) unsigned char *p, *end; register_info_type *reg_info; { int mcnt; unsigned char *p1 = p; while (p1 < end) { /* Skip over opcodes that can match nothing, and break when we get to one that can't. */ switch ((re_opcode_t) *p1) { /* It's a loop. */ case on_failure_jump: p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; break; default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } } /* while p1 < end */ return true; }
false
false
false
false
false
0
_enable_per_message_authentication_commit (const char *section_name, const struct config_keyvalue *kv, void *arg) { bmc_config_state_data_t *state_data; struct channel_access ch; config_err_t ret; assert (section_name); assert (kv); assert (arg); state_data = (bmc_config_state_data_t *)arg; if ((ret = _get_channel_access (state_data, section_name, kv->key->key_name, &ch)) != CONFIG_ERR_SUCCESS) return (ret); ch.per_message_authentication = same (kv->value_input, "yes"); if ((ret = _set_channel_access (state_data, section_name, kv->key->key_name, &ch, NULL)) != CONFIG_ERR_SUCCESS) return (ret); return (CONFIG_ERR_SUCCESS); }
false
false
false
false
false
0
setup_idle_tx_channel (hrz_dev * dev, hrz_vcc * vcc) { unsigned short idle_channels; short tx_channel = -1; unsigned int spin_count; PRINTD (DBG_FLOW|DBG_TX, "setup_idle_tx_channel %p", dev); // better would be to fail immediately, the caller can then decide whether // to wait or drop (depending on whether this is UBR etc.) spin_count = 0; while (!(idle_channels = rd_regw (dev, TX_STATUS_OFF) & IDLE_CHANNELS_MASK)) { PRINTD (DBG_TX|DBG_WARN, "waiting for idle TX channel"); // delay a bit here if (++spin_count > 100) { PRINTD (DBG_TX|DBG_ERR, "spun out waiting for idle TX channel"); return -EBUSY; } } // got an idle channel { // tx_idle ensures we look for idle channels in RR order int chan = dev->tx_idle; int keep_going = 1; while (keep_going) { if (idle_channels & (1<<chan)) { tx_channel = chan; keep_going = 0; } ++chan; if (chan == TX_CHANS) chan = 0; } dev->tx_idle = chan; } // set up the channel we found { // Initialise the cell header in the transmit channel descriptor // a.k.a. prepare the channel and remember that we have done so. tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel]; u32 rd_ptr; u32 wr_ptr; u16 channel = vcc->channel; unsigned long flags; spin_lock_irqsave (&dev->mem_lock, flags); // Update the transmit channel record. dev->tx_channel_record[tx_channel] = channel; // xBR channel update_tx_channel_config (dev, tx_channel, RATE_TYPE_ACCESS, vcc->tx_xbr_bits); // Update the PCR counter preload value etc. update_tx_channel_config (dev, tx_channel, PCR_TIMER_ACCESS, vcc->tx_pcr_bits); #if 0 if (vcc->tx_xbr_bits == VBR_RATE_TYPE) { // SCR timer update_tx_channel_config (dev, tx_channel, SCR_TIMER_ACCESS, vcc->tx_scr_bits); // Bucket size... update_tx_channel_config (dev, tx_channel, BUCKET_CAPACITY_ACCESS, vcc->tx_bucket_bits); // ... and fullness update_tx_channel_config (dev, tx_channel, BUCKET_FULLNESS_ACCESS, vcc->tx_bucket_bits); } #endif // Initialise the read and write buffer pointers rd_ptr = rd_mem (dev, &tx_desc->rd_buf_type) & BUFFER_PTR_MASK; wr_ptr = rd_mem (dev, &tx_desc->wr_buf_type) & BUFFER_PTR_MASK; // idle TX channels should have identical pointers if (rd_ptr != wr_ptr) { PRINTD (DBG_TX|DBG_ERR, "TX buffer pointers are broken!"); // spin_unlock... return -E... // I wonder if gcc would get rid of one of the pointer aliases } PRINTD (DBG_TX, "TX buffer pointers are: rd %x, wr %x.", rd_ptr, wr_ptr); switch (vcc->aal) { case aal0: PRINTD (DBG_QOS|DBG_TX, "tx_channel: aal0"); rd_ptr |= CHANNEL_TYPE_RAW_CELLS; wr_ptr |= CHANNEL_TYPE_RAW_CELLS; break; case aal34: PRINTD (DBG_QOS|DBG_TX, "tx_channel: aal34"); rd_ptr |= CHANNEL_TYPE_AAL3_4; wr_ptr |= CHANNEL_TYPE_AAL3_4; break; case aal5: rd_ptr |= CHANNEL_TYPE_AAL5; wr_ptr |= CHANNEL_TYPE_AAL5; // Initialise the CRC wr_mem (dev, &tx_desc->partial_crc, INITIAL_CRC); break; } wr_mem (dev, &tx_desc->rd_buf_type, rd_ptr); wr_mem (dev, &tx_desc->wr_buf_type, wr_ptr); // Write the Cell Header // Payload Type, CLP and GFC would go here if non-zero wr_mem (dev, &tx_desc->cell_header, channel); spin_unlock_irqrestore (&dev->mem_lock, flags); } return tx_channel; }
false
false
false
false
false
0
mono_lookup_jit_icall_symbol (const char *name) { MonoJitICallInfo *info; const char *res = NULL; mono_icall_lock (); info = g_hash_table_lookup (jit_icall_hash_name, name); if (info) res = info->c_symbol; mono_icall_unlock (); return res; }
false
false
false
false
false
0
_displayAlternatives() throw(Exception, std::bad_alloc) { _checkThesaurus(); vector<string> words; for(const char* r = d_thesaurus.similar(); r[0]; r = d_thesaurus.similar()) { _checkThesaurus(); words.push_back(r); } _createMeaning("No Synonyms Known. Nearby words:", words); }
false
false
false
false
false
0
display_update_display (WINDOW *window) { register WINDOW *win; display_was_interrupted_p = 0; /* For every window in the list, check contents against the display. */ for (win = window; win; win = win->next) { /* Only re-display visible windows which need updating. */ if (((win->flags & W_WindowVisible) == 0) || ((win->flags & W_UpdateWindow) == 0) || (win->height == 0)) continue; display_update_one_window (win); if (display_was_interrupted_p) break; } /* Always update the echo area. */ display_update_one_window (the_echo_area); }
false
false
false
false
false
0
f_complete(argvars, rettv) typval_T *argvars; typval_T *rettv UNUSED; { int startcol; if ((State & INSERT) == 0) { EMSG(_("E785: complete() can only be used in Insert mode")); return; } /* Check for undo allowed here, because if something was already inserted * the line was already saved for undo and this check isn't done. */ if (!undo_allowed()) return; if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) { EMSG(_(e_invarg)); return; } startcol = get_tv_number_chk(&argvars[0], NULL); if (startcol <= 0) return; set_completion(startcol - 1, argvars[1].vval.v_list); }
false
false
false
false
false
0
gwy_data_line_clear(GwyDataLine *data_line) { g_return_if_fail(GWY_IS_DATA_LINE(data_line)); gwy_clear(data_line->data, data_line->res); }
false
false
false
false
false
0
zzjson_free(ZZJSON_CONFIG *config, ZZJSON *zzjson) { while (zzjson) { ZZJSON *next; switch(zzjson->type) { case ZZJSON_OBJECT: config->free(zzjson->value.object.label); zzjson_free(config, zzjson->value.object.val); break; case ZZJSON_ARRAY: zzjson_free(config, zzjson->value.array.val); break; case ZZJSON_STRING: config->free(zzjson->value.string.string); break; default: break; } next = zzjson->next; config->free(zzjson); zzjson = next; } }
false
false
false
false
false
0
visit_enter(ir_loop *ir) { ir_discard *discard = find_unconditional_discard(ir->body_instructions); if (discard) { ir->replace_with(discard); return visit_continue_with_parent; } return visit_continue; }
false
false
false
false
false
0
mutate_population( APG::ConstraintSolver::Population& population ) { if ( population.size() < 1 ) return; const double mutantPercentage = 0.35; // TODO: tune this parameter QList<Meta::TrackList*> parents( population.keys() ); int maxMutants = (int)( mutantPercentage * (double)(m_populationSize) ); for ( int i = parents.size(); i < maxMutants; i++ ) { int idx = KRandom::random() % parents.size(); Meta::TrackList* child = new Meta::TrackList( *(parents.at( idx )) ); int op = KRandom::random() % 5; int s = child->size(); switch (op) { case 0: child->removeAt( KRandom::random() % s ); case 1: child->insert( KRandom::random() % ( s + 1 ), random_track_from_domain() ); case 2: child->replace( KRandom::random() % s, random_track_from_domain() ); case 3: child->swap( KRandom::random() % s, KRandom::random() % s ); case 4: child = crossover( child, parents.at( KRandom::random() % parents.size() ) ); default: (void)0; // effectively a no-op. the default is here so that the compiler doesn't complain about missing default in switch } population.insert( child, m_constraintTreeRoot->satisfaction( *child ) ); } return; }
false
false
false
false
false
0
main (int argc, char *argv[]) { char FileName[PATH_MAX]; int Param; if (argc < 2) { usage (); return 1; } printf ("Binary hive maker: %s\n", argv[3]); RegInitializeRegistry (); convert_path (FileName, argv[1]); ImportRegistryFile (FileName); convert_path (FileName, argv[2]); if (!ExportBinaryHive (FileName, &BootConfigurationHive)) { return 1; } RegShutdownRegistry (); printf (" Done.\n"); return 0; }
true
true
false
false
false
1
S_sublex_start(pTHX) { dVAR; const I32 op_type = pl_yylval.ival; if (op_type == OP_NULL) { pl_yylval.opval = PL_lex_op; PL_lex_op = NULL; return THING; } if (op_type == OP_CONST || op_type == OP_READLINE) { SV *sv = tokeq(PL_lex_stuff); if (SvTYPE(sv) == SVt_PVIV) { /* Overloaded constants, nothing fancy: Convert to SVt_PV: */ STRLEN len; const char * const p = SvPV_const(sv, len); SV * const nsv = newSVpvn_flags(p, len, SvUTF8(sv)); SvREFCNT_dec(sv); sv = nsv; } pl_yylval.opval = (OP*)newSVOP(op_type, 0, sv); PL_lex_stuff = NULL; /* Allow <FH> // "foo" */ if (op_type == OP_READLINE) PL_expect = XTERMORDORDOR; return THING; } else if (op_type == OP_BACKTICK && PL_lex_op) { /* readpipe() vas overriden */ cSVOPx(cLISTOPx(cUNOPx(PL_lex_op)->op_first)->op_first->op_sibling)->op_sv = tokeq(PL_lex_stuff); pl_yylval.opval = PL_lex_op; PL_lex_op = NULL; PL_lex_stuff = NULL; return THING; } PL_sublex_info.super_state = PL_lex_state; PL_sublex_info.sub_inwhat = (U16)op_type; PL_sublex_info.sub_op = PL_lex_op; PL_lex_state = LEX_INTERPPUSH; PL_expect = XTERM; if (PL_lex_op) { pl_yylval.opval = PL_lex_op; PL_lex_op = NULL; return PMFUNC; } else return FUNC; }
false
false
false
false
false
0
sr030pc30_set_params(struct v4l2_subdev *sd) { struct sr030pc30_info *info = to_sr030pc30(sd); int ret; if (!info->curr_win) return -EINVAL; /* Configure the resolution through subsampling */ ret = cam_i2c_write(sd, VDO_CTL1_REG, info->curr_win->vid_ctl1); if (!ret && info->curr_fmt) ret = cam_i2c_write(sd, ISP_CTL_REG(0), info->curr_fmt->ispctl1_reg); if (!ret) ret = sr030pc30_set_flip(sd); return ret; }
false
false
false
false
false
0
menu_mode_receive (GtkWidget *widget, gpointer data) { if (((struct s_main_data *) data)->mode != MOD_RECEIVE) { parse_receive ((struct s_main_data *)data); if (((struct s_main_data *) data)->mode == MOD_SEND) gtk_widget_hide (((struct s_main_data *) data)->container_send); else gtk_widget_hide (((struct s_main_data *) data)->container_message); gtk_widget_show (((struct s_main_data *) data)->container_receive); gtk_widget_set_sensitive (GTK_WIDGET(((struct s_main_data *) data)->modeitem[((struct s_main_data *) data)->mode]), TRUE); ((struct s_main_data *) data)->mode = MOD_RECEIVE; gtk_widget_set_sensitive (GTK_WIDGET(((struct s_main_data *) data)->modeitem[((struct s_main_data *) data)->mode]), FALSE); } }
false
false
false
false
false
0
app_aboutToQuit() { while(man) { qApp->processEvents(QEventLoop::WaitForMoreEvents); } }
false
false
false
false
false
0
prepareDiscogsUrls( QXmlStreamReader &xml ) { while( !xml.atEnd() && !xml.hasError() ) { xml.readNext(); if( !xml.isStartElement() || xml.name() != "release" ) continue; const QString releaseId = xml.attributes().value( "id" ).toString(); while( !xml.atEnd() && !xml.hasError() ) { xml.readNext(); const QStringRef &n = xml.name(); if( xml.isEndElement() && n == "release" ) break; if( !xml.isStartElement() ) continue; CoverFetch::Metadata metadata; metadata[ "source" ] = "Discogs"; if( n == "title" ) metadata[ "title" ] = xml.readElementText(); else if( n == "country" ) metadata[ "country" ] = xml.readElementText(); else if( n == "released" ) metadata[ "released" ] = xml.readElementText(); else if( n == "notes" ) metadata[ "notes" ] = xml.readElementText(); else if( n == "images" ) { while( !xml.atEnd() && !xml.hasError() ) { xml.readNext(); if( xml.isEndElement() && xml.name() == "images" ) break; if( !xml.isStartElement() ) continue; if( xml.name() == "image" ) { const QXmlStreamAttributes &attr = xml.attributes(); const KUrl thburl( attr.value( "uri150" ).toString() ); const KUrl uri( attr.value( "uri" ).toString() ); const KUrl url = (m_size == CoverFetch::ThumbSize) ? thburl : uri; if( !url.isValid() ) continue; metadata[ "releaseid" ] = releaseId; metadata[ "releaseurl" ] = "http://discogs.com/release/" + releaseId; metadata[ "normalarturl" ] = uri.url(); metadata[ "thumbarturl" ] = thburl.url(); metadata[ "width" ] = attr.value( "width" ).toString(); metadata[ "height" ] = attr.value( "height" ).toString(); metadata[ "type" ] = attr.value( "type" ).toString(); m_urls.insert( url, metadata ); } else xml.skipCurrentElement(); } } else xml.skipCurrentElement(); } } }
false
false
false
false
false
0
PyCData_set(PyObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value, Py_ssize_t index, Py_ssize_t size, char *ptr) { CDataObject *mem = (CDataObject *)dst; PyObject *result; if (!CDataObject_Check(dst)) { PyErr_SetString(PyExc_TypeError, "not a ctype instance"); return -1; } result = _PyCData_set(mem, type, setfunc, value, size, ptr); if (result == NULL) return -1; /* KeepRef steals a refcount from it's last argument */ /* If KeepRef fails, we are stumped. The dst memory block has already been changed */ return KeepRef(mem, index, result); }
false
false
false
false
false
0
gui_object_move(struct gui_object *obj, int newx, int newy) { if (newx < 0) newx = 0; if (newy < 0) newy = 0; gtk_layout_move(GTK_LAYOUT(canvas), obj->labelw, newx + obj->widget->allocation.width - obj->labelw->allocation.width, newy - 30); gtk_layout_move(GTK_LAYOUT(canvas), obj->widget, newx, newy); if (obj->led) gtk_layout_move(GTK_LAYOUT(canvas), obj->led, newx - 20, newy); gui_minirun(); resize_canvas(); gui_update_links(obj); return 0; }
false
false
false
false
false
0