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
paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { QStyleOptionViewItemV4 opt(option); initStyleOption(&opt,index); //Get the current cell color QColor backgroundColor = index.data(Qt::BackgroundRole).value<QColor>(); if (backgroundColor.isValid()) { //Paint the general background painter->fillRect(opt.rect, backgroundColor); //Paint the selection mark (circle) if (opt.state & QStyle::State_Selected) { //Use black or white, depending on the contrast QColor color = QColor(0, 0, 0, 220); if (KColorUtils::contrastRatio(color, backgroundColor) < 5) { color = QColor(255, 255, 255, 220); } //Draw the selection (radiobutton-like) circle painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::HighQualityAntialiasing, true); painter->setPen(QPen(color, 1.2, Qt::SolidLine)); painter->setBrush(QBrush()); painter->drawEllipse(opt.rect.adjusted(2,2,-2,-2)); painter->restore(); } } else { //Paint the "X" (missing) cross on empty background color backgroundColor = opt.palette.color(QPalette::Window); painter->fillRect(opt.rect, backgroundColor); painter->save(); QColor crossColor = qGray(backgroundColor.rgb()) > 192 ? backgroundColor.darker(106) : backgroundColor.lighter(106); painter->setPen(QPen(crossColor, 1.5)); painter->drawLine(opt.rect.topLeft(), opt.rect.bottomRight()); painter->drawLine(opt.rect.topRight(), opt.rect.bottomLeft()); painter->restore(); } }
false
false
false
false
false
0
getSkeleton() { UnicodeString result; for(int32_t i=0; i< UDATPG_FIELD_COUNT; ++i) { if (original[i].length()!=0) { result += original[i]; } } return result; }
false
false
false
false
false
0
map_name( const char *arg, char **result, int reserve, const char *in, const char *out ) { char *p; int i, l, ll, num, inl, outl; l = strlen( arg ); if (!in) { copy: *result = nfmalloc( reserve + l + 1 ); memcpy( *result + reserve, arg, l + 1 ); return 0; } inl = strlen( in ); if (out) { outl = strlen( out ); if (inl == outl && !memcmp( in, out, inl )) goto copy; } for (num = 0, i = 0; i < l; ) { for (ll = 0; ll < inl; ll++) if (arg[i + ll] != in[ll]) goto fout; num++; i += inl; continue; fout: if (out) { for (ll = 0; ll < outl; ll++) if (arg[i + ll] != out[ll]) goto fnexti; return -1; } fnexti: i++; } if (!num) goto copy; if (!out) return -2; *result = nfmalloc( reserve + l + num * (outl - inl) + 1 ); p = *result + reserve; for (i = 0; i < l; ) { for (ll = 0; ll < inl; ll++) if (arg[i + ll] != in[ll]) goto rnexti; memcpy( p, out, outl ); p += outl; i += inl; continue; rnexti: *p++ = arg[i++]; } *p = 0; return 0; }
false
true
false
false
false
1
ath5k_hw_txpower(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower) { struct ath5k_rate_pcal_info rate_info; u8 type; int ret; if (txpower > AR5K_TUNE_MAX_TXPOWER) { DBG("ath5k: invalid tx power %d\n", txpower); return -EINVAL; } if (txpower == 0) txpower = AR5K_TUNE_DEFAULT_TXPOWER; /* Reset TX power values */ memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower)); ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; ah->ah_txpower.txp_min_pwr = 0; ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER; /* Initialize TX power table */ switch (ah->ah_radio) { case AR5K_RF5111: type = AR5K_PWRTABLE_PWR_TO_PCDAC; break; case AR5K_RF5112: type = AR5K_PWRTABLE_LINEAR_PCDAC; break; case AR5K_RF2413: case AR5K_RF5413: case AR5K_RF2316: case AR5K_RF2317: case AR5K_RF2425: type = AR5K_PWRTABLE_PWR_TO_PDADC; break; default: return -EINVAL; } /* FIXME: Only on channel/mode change */ ret = ath5k_setup_channel_powertable(ah, channel, ee_mode, type); if (ret) return ret; /* Limit max power if we have a CTL available */ ath5k_get_max_ctl_power(ah, channel); /* FIXME: Tx power limit for this regdomain * XXX: Mac80211/CRDA will do that anyway ? */ /* FIXME: Antenna reduction stuff */ /* FIXME: Limit power on turbo modes */ /* FIXME: TPC scale reduction */ /* Get surounding channels for per-rate power table * calibration */ ath5k_get_rate_pcal_data(ah, channel, &rate_info); /* Setup rate power table */ ath5k_setup_rate_powertable(ah, txpower, &rate_info, ee_mode); /* Write rate power table on hw */ ath5k_hw_reg_write(ah, AR5K_TXPOWER_OFDM(3, 24) | AR5K_TXPOWER_OFDM(2, 16) | AR5K_TXPOWER_OFDM(1, 8) | AR5K_TXPOWER_OFDM(0, 0), AR5K_PHY_TXPOWER_RATE1); ath5k_hw_reg_write(ah, AR5K_TXPOWER_OFDM(7, 24) | AR5K_TXPOWER_OFDM(6, 16) | AR5K_TXPOWER_OFDM(5, 8) | AR5K_TXPOWER_OFDM(4, 0), AR5K_PHY_TXPOWER_RATE2); ath5k_hw_reg_write(ah, AR5K_TXPOWER_CCK(10, 24) | AR5K_TXPOWER_CCK(9, 16) | AR5K_TXPOWER_CCK(15, 8) | AR5K_TXPOWER_CCK(8, 0), AR5K_PHY_TXPOWER_RATE3); ath5k_hw_reg_write(ah, AR5K_TXPOWER_CCK(14, 24) | AR5K_TXPOWER_CCK(13, 16) | AR5K_TXPOWER_CCK(12, 8) | AR5K_TXPOWER_CCK(11, 0), AR5K_PHY_TXPOWER_RATE4); /* FIXME: TPC support */ if (ah->ah_txpower.txp_tpc) { ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE | AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); ath5k_hw_reg_write(ah, AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_ACK) | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CTS) | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), AR5K_TPC); } else { ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX | AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); } return 0; }
false
false
false
false
false
0
nullify_returns_r (tree* tp, int* walk_subtrees, void* data) { tree nrv = (tree) data; /* No need to walk into types. There wouldn't be any need to walk into non-statements, except that we have to consider STMT_EXPRs. */ if (TYPE_P (*tp)) *walk_subtrees = 0; else if (TREE_CODE (*tp) == RETURN_STMT) RETURN_STMT_EXPR (*tp) = NULL_TREE; else if (TREE_CODE (*tp) == CLEANUP_STMT && CLEANUP_DECL (*tp) == nrv) CLEANUP_EH_ONLY (*tp) = 1; /* Replace the DECL_STMT for the NRV with an initialization of the RESULT_DECL, if needed. */ else if (TREE_CODE (*tp) == DECL_STMT && DECL_STMT_DECL (*tp) == nrv) { tree init; if (DECL_INITIAL (nrv) && DECL_INITIAL (nrv) != error_mark_node) { init = build (INIT_EXPR, void_type_node, DECL_RESULT (current_function_decl), DECL_INITIAL (nrv)); DECL_INITIAL (nrv) = error_mark_node; } else init = NULL_TREE; init = build_stmt (EXPR_STMT, init); TREE_CHAIN (init) = TREE_CHAIN (*tp); STMT_LINENO (init) = STMT_LINENO (*tp); *tp = init; } /* Keep iterating. */ return NULL_TREE; }
false
false
false
false
false
0
iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf, size_t count, loff_t *ppos) { int ret; mutex_lock(&mvm->mutex); ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); mutex_unlock(&mvm->mutex); return ret ?: count; }
false
false
false
false
false
0
IsAvailable(SocketId socket) const { scoped_lock lock(m_mutex); SocketQueueMap::const_iterator qi = m_socketQueues.find(socket); if( qi == m_socketQueues.end() ) return false; return qi->second->m_queue.size() > 0; }
false
false
false
false
false
0
elm_glview_resize_policy_set(Evas_Object *obj, Elm_GLView_Resize_Policy policy) { ELM_GLVIEW_CHECK(obj) EINA_FALSE; ELM_GLVIEW_DATA_GET(obj, sd); if (policy == sd->scale_policy) return EINA_TRUE; switch (policy) { case ELM_GLVIEW_RESIZE_POLICY_RECREATE: case ELM_GLVIEW_RESIZE_POLICY_SCALE: sd->scale_policy = policy; _glview_update_surface(obj); elm_glview_changed_set(obj); return EINA_TRUE; default: ERR("Invalid Scale Policy.\n"); return EINA_FALSE; } }
false
false
false
false
false
0
ffgbyt(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG nbytes, /* I - number of bytes to read */ void *buffer, /* O - buffer to read into */ int *status) /* IO - error status */ /* get (read) the requested number of bytes from the file, starting at the current file position. Read large blocks of data directly from disk; read smaller segments via intermediate IO buffers to improve efficiency. */ { int ii; LONGLONG filepos; long recstart, recend, ntodo, bufpos, nspace, nread; char *cptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); cptr = (char *)buffer; if (nbytes >= MINDIRECT) { /* read large blocks of data directly from disk instead of via buffers */ filepos = (fptr->Fptr)->bytepos; /* save the read starting position */ /* note that in this case, ffmbyt has not been called, and so */ /* bufrecnum[(fptr->Fptr)->curbuf] does not point to the intended */ /* output buffer */ recstart = (long) (filepos / IOBUFLEN); /* starting record */ recend = (long) ((filepos + nbytes - 1) / IOBUFLEN); /* ending record */ for (ii = 0; ii < NIOBUF; ii++) /* flush any affected buffers to disk */ { if ((fptr->Fptr)->dirty[ii] && (fptr->Fptr)->bufrecnum[ii] >= recstart && (fptr->Fptr)->bufrecnum[ii] <= recend) { ffbfwt(fptr->Fptr, ii, status); /* flush modified buffer to disk */ } } /* move to the correct read position */ if ((fptr->Fptr)->io_pos != filepos) ffseek(fptr->Fptr, filepos); ffread(fptr->Fptr, (long) nbytes, cptr, status); /* read the data */ (fptr->Fptr)->io_pos = filepos + nbytes; /* update the file position */ } else { /* read small chucks of data using the IO buffers for efficiency */ if ((fptr->Fptr)->curbuf < 0) /* no current data buffer for this file */ { /* so reload the last one that was used */ ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status); } /* bufpos is the starting position in IO buffer */ bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)(fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf] * IOBUFLEN)); nspace = IOBUFLEN - bufpos; /* amount of space left in the buffer */ ntodo = (long) nbytes; while (ntodo) { nread = minvalue(ntodo, nspace); /* copy bytes from IO buffer to user's buffer */ memcpy(cptr, (fptr->Fptr)->iobuffer + ((fptr->Fptr)->curbuf * IOBUFLEN) + bufpos, nread); ntodo -= nread; /* decrement remaining number of bytes */ cptr += nread; (fptr->Fptr)->bytepos += nread; /* increment file position pointer */ if (ntodo) /* load next record into a buffer */ { ffldrc(fptr, (long) ((fptr->Fptr)->bytepos / IOBUFLEN), REPORT_EOF, status); bufpos = 0; nspace = IOBUFLEN; } } } return(*status); }
false
false
false
false
false
0
view_new (PopplerDocument *doc) { View *view; GtkWidget *window; GtkWidget *sw; GtkWidget *vbox, *hbox; guint n_pages; view = g_slice_new0 (View); view->doc = doc; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (destroy_window_callback), view); vbox = gtk_vbox_new (FALSE, 5); view->drawing_area = gtk_drawing_area_new (); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), view->drawing_area); gtk_widget_show (view->drawing_area); gtk_box_pack_end (GTK_BOX (vbox), sw, TRUE, TRUE, 0); gtk_widget_show (sw); hbox = gtk_hbox_new (FALSE, 5); n_pages = poppler_document_get_n_pages (doc); view->spin_button = gtk_spin_button_new_with_range (0, n_pages - 1, 1); g_signal_connect (view->spin_button, "value-changed", G_CALLBACK (page_changed_callback), view); gtk_box_pack_end (GTK_BOX (hbox), view->spin_button, FALSE, TRUE, 0); gtk_widget_show (view->spin_button); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); gtk_widget_show (window); if (!cairo_output) { SplashColor sc = { 255, 255, 255}; view->out = new GDKSplashOutputDev (gtk_widget_get_screen (window), redraw_callback, (void*) view, sc); view->out->startDoc(view->doc->doc->getXRef()); } g_signal_connect (view->drawing_area, "expose_event", G_CALLBACK (drawing_area_expose), view); return view; }
false
false
false
false
false
0
tpacpi_disable_brightness_delay(void) { if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0)) pr_notice("ACPI backlight control delay disabled\n"); }
false
false
false
false
false
0
dis_mat(char *s,double m[3][3]) { gprint("\n Matrix {%s} \n",s); for (int i = 0; i < 3; i++) { gprint(" %f %f %f \n",m[0][i],m[1][i],m[2][i]); } }
false
false
false
false
false
0
do_release_shlib (void *nodep, VISIT value, int level) { struct __gconv_loaded_object *obj = *(struct __gconv_loaded_object **) nodep; if (value != preorder && value != leaf) return; if (obj == release_handle) { /* This is the object we want to unload. Now decrement the reference counter. */ assert (obj->counter > 0); --obj->counter; } else if (obj->counter <= 0 && obj->counter >= -TRIES_BEFORE_UNLOAD && --obj->counter < -TRIES_BEFORE_UNLOAD && obj->handle != NULL) { /* Unload the shared object. */ __libc_dlclose (obj->handle); obj->handle = NULL; } }
false
false
false
false
false
0
gdip_is_scaled (GpGraphics *graphics) { cairo_matrix_t matrix; cairo_get_matrix (graphics->ct, &matrix); return ((matrix.xx != 1.0f) || (matrix.yy != 1.0f)); }
false
false
false
false
false
0
fetch_worker_and_sub_worker(status_endpoint_t *p, const char *operation, const char **worker, const char **sub_worker, jk_logger_t *l) { status_worker_t *w = p->worker; JK_TRACE_ENTER(l); status_get_string(p, JK_STATUS_ARG_WORKER, NULL, worker, l); status_get_string(p, JK_STATUS_ARG_SUB_WORKER, NULL, sub_worker, l); if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, "Status worker '%s' %s worker '%s' sub worker '%s'", w->name, operation, *worker ? *worker : "(null)", *sub_worker ? *sub_worker : "(null)"); if (!*worker || !(*worker)[0]) { jk_log(l, JK_LOG_WARNING, "Status worker '%s' NULL or EMPTY worker param", w->name); p->msg = "NULL or EMPTY worker param"; JK_TRACE_EXIT(l); return JK_FALSE; } if (*sub_worker && !(*sub_worker)[0]) { jk_log(l, JK_LOG_WARNING, "Status worker '%s' EMPTY sub worker param", w->name); p->msg = "EMPTY sub worker param"; JK_TRACE_EXIT(l); return JK_FALSE; } JK_TRACE_EXIT(l); return JK_TRUE; }
false
false
false
false
false
0
set(const std::string& name, const std::string& val) { data_iterator iter = data.find(name); if ((iter != data.end()) && (iter->second.t == Appcfg_string)) { iter->second.sval = val; return true; } return false; }
false
false
false
false
false
0
acpi_ns_check_reference(struct acpi_evaluate_info *info, union acpi_operand_object *return_object) { /* * Check the reference object for the correct reference type (opcode). * The only type of reference that can be converted to an union acpi_object is * a reference to a named object (reference class: NAME) */ if (return_object->reference.class == ACPI_REFCLASS_NAME) { return (AE_OK); } ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags, "Return type mismatch - unexpected reference object type [%s] %2.2X", acpi_ut_get_reference_name(return_object), return_object->reference.class)); return (AE_AML_OPERAND_TYPE); }
false
false
false
true
false
1
player_outfit(struct player *p) { const struct start_item *si; object_type object_type_body; /* Give the player starting equipment */ for (si = p_ptr->class->start_items; si; si = si->next) { /* Get local object */ struct object *i_ptr = &object_type_body; /* Prepare the item */ object_prep(i_ptr, si->kind, 0, MINIMISE); i_ptr->number = (byte)rand_range(si->min, si->max); i_ptr->origin = ORIGIN_BIRTH; object_flavor_aware(i_ptr); object_notice_everything(i_ptr); inven_carry(p, i_ptr); si->kind->everseen = TRUE; /* Deduct the cost of the item from starting cash */ p->au -= object_value(i_ptr, i_ptr->number, FALSE); } /* Sanity check */ if (p->au < 0) p->au = 0; /* Now try wielding everything */ wield_all(p); }
false
false
false
false
false
0
pci_slot_resetable(struct pci_slot *slot) { struct pci_dev *dev; list_for_each_entry(dev, &slot->bus->devices, bus_list) { if (!dev->slot || dev->slot != slot) continue; if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || (dev->subordinate && !pci_bus_resetable(dev->subordinate))) return false; } return true; }
false
false
false
false
false
0
checkBoards(QDomElement & board, QHash<QString, QString> & fzzFilePaths) { while (!board.isNull()) { QString boardname = board.attribute("name"); //DebugDialog::debug(QString("board %1").arg(boardname)); bool ok; int optional = board.attribute("maxOptionalCount", "").toInt(&ok); if (!ok) { writePanelizerOutput(QString("maxOptionalCount for board '%1' not an integer: '%2'").arg(boardname).arg(board.attribute("maxOptionalCount"))); return false; } int optionalPriority = board.attribute("optionalPriority", "").toInt(&ok); Q_UNUSED(optionalPriority); if (!ok) { writePanelizerOutput(QString("optionalPriority for board '%1' not an integer: '%2'").arg(boardname).arg(board.attribute("optionalPriority"))); return false; } int required = board.attribute("requiredCount", "").toInt(&ok); if (!ok) { writePanelizerOutput(QString("required for board '%1' not an integer: '%2'").arg(boardname).arg(board.attribute("maxOptionalCount"))); return false; } if (optional > 0 || required> 0) { QString path = fzzFilePaths.value(boardname, ""); if (path.isEmpty()) { writePanelizerOutput(QString("File for board '%1' not found in search paths").arg(boardname)); return false; } } else { writePanelizerOutput(QString("skipping board '%1'").arg(boardname)); } board = board.nextSiblingElement("board"); } return true; }
false
false
false
false
false
0
e_dbus_callback_new(E_DBus_Callback_Func cb_func, E_DBus_Unmarshal_Func unmarshal_func, E_DBus_Free_Func free_func, void *user_data) { E_DBus_Callback *cb; if (!cb_func) return NULL; cb = calloc(1, sizeof(E_DBus_Callback)); if (!cb) return NULL; cb->cb_func = cb_func; cb->unmarshal_func = unmarshal_func; cb->free_func = free_func; cb->user_data = user_data; return cb; }
false
false
false
false
false
0
setHotstartSolution(const double * solution, const int * priorities) { if (solution == NULL) { delete [] hotstartSolution_; hotstartSolution_ = NULL; delete [] hotstartPriorities_; hotstartPriorities_ = NULL; } else { int numberColumns = solver_->getNumCols(); hotstartSolution_ = CoinCopyOfArray(solution, numberColumns); hotstartPriorities_ = CoinCopyOfArray(priorities, numberColumns); for (int i = 0; i < numberColumns; i++) { if (hotstartSolution_[i] == -COIN_DBL_MAX) { hotstartSolution_[i] = 0.0; hotstartPriorities_[i] += 10000; } if (solver_->isInteger(i)) hotstartSolution_[i] = floor(hotstartSolution_[i] + 0.5); } } }
false
false
false
false
false
0
efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i, bool spoofchk) { struct efx_nic *efx = netdev_priv(net_dev); if (efx->type->sriov_set_vf_spoofchk) return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk); else return -EOPNOTSUPP; }
false
false
false
false
false
0
opal_malloc_init(void) { #if OPAL_ENABLE_DEBUG OBJ_CONSTRUCT(&malloc_stream, opal_output_stream_t); malloc_stream.lds_is_debugging = true; malloc_stream.lds_verbose_level = 5; malloc_stream.lds_prefix = "malloc debug: "; malloc_stream.lds_want_stderr = true; opal_malloc_output = opal_output_open(&malloc_stream); #endif /* OPAL_ENABLE_DEBUG */ }
false
false
false
false
false
0
account_list_set(void) { /* want to make sure we iterate *IN ORDER*, so therefore using * gtk_tree_model_XXXX_nth_child() */ gint row, n_rows; PrefsAccount *ac_prefs; GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(edit_account.list_view)); while (account_list) account_list = g_list_remove(account_list, account_list->data); n_rows = gtk_tree_model_iter_n_children(model, NULL); for (row = 0; row < n_rows; row++) { GtkTreeIter iter; if (!gtk_tree_model_iter_nth_child(model, &iter, NULL, row)) { g_warning("%s(%d) - no iter found???\n", __FILE__, __LINE__); continue; } ac_prefs = NULL; gtk_tree_model_get(model, &iter, ACCOUNT_DATA, &ac_prefs, -1); if (ac_prefs) account_list = g_list_append(account_list, ac_prefs); } }
false
false
false
false
false
0
fop_create_cbk_stub (call_frame_t *frame, fop_create_cbk_t fn, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *buf, struct iatt *preparent, struct iatt *postparent) { call_stub_t *stub = NULL; GF_VALIDATE_OR_GOTO ("call-stub", frame, out); stub = stub_new (frame, 0, GF_FOP_CREATE); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); stub->args.create_cbk.fn = fn; stub->args.create_cbk.op_ret = op_ret; stub->args.create_cbk.op_errno = op_errno; if (fd) stub->args.create_cbk.fd = fd_ref (fd); if (inode) stub->args.create_cbk.inode = inode_ref (inode); if (buf) stub->args.create_cbk.buf = *buf; if (preparent) stub->args.create_cbk.preparent = *preparent; if (postparent) stub->args.create_cbk.postparent = *postparent; out: return stub; }
false
false
false
false
false
0
wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { int pass_needed; /* * If we are not rendering class IN, this ordering is bogus. */ if (rds->rdclass != dns_rdataclass_in) return (ISC_FALSE); switch (rds->type) { case dns_rdatatype_a: case dns_rdatatype_aaaa: if (preferred_glue == rds->type) pass_needed = 4; else pass_needed = 3; break; case dns_rdatatype_rrsig: case dns_rdatatype_dnskey: pass_needed = 2; break; default: pass_needed = 1; } if (pass_needed >= pass) return (ISC_FALSE); return (ISC_TRUE); }
false
false
false
false
false
0
php_check_dots(const char *element, int n) /* {{{ */ { for(n--; n >= 0; --n) { if (element[n] != '.') { return 1; } } return 0; }
false
false
false
false
false
0
main(int argc, char **argv) { int firstarg; config.hostip = sdsnew("127.0.0.1"); config.hostport = 6379; config.hostsocket = NULL; config.repeat = 1; config.interval = 0; config.dbnum = 0; config.interactive = 0; config.shutdown = 0; config.monitor_mode = 0; config.pubsub_mode = 0; config.latency_mode = 0; config.cluster_mode = 0; config.slave_mode = 0; config.pipe_mode = 0; config.bigkeys = 0; config.stdinarg = 0; config.auth = NULL; config.eval = NULL; if (!isatty(fileno(stdout)) && (getenv("FAKETTY") == NULL)) config.output = OUTPUT_RAW; else config.output = OUTPUT_STANDARD; config.mb_delim = sdsnew("\n"); cliInitHelp(); firstarg = parseOptions(argc,argv); argc -= firstarg; argv += firstarg; /* Latency mode */ if (config.latency_mode) { cliConnect(0); latencyMode(); } /* Slave mode */ if (config.slave_mode) { cliConnect(0); slaveMode(); } /* Pipe mode */ if (config.pipe_mode) { cliConnect(0); pipeMode(); } /* Find big keys */ if (config.bigkeys) { cliConnect(0); findBigKeys(); } /* Start interactive mode when no command is provided */ if (argc == 0 && !config.eval) { /* Note that in repl mode we don't abort on connection error. * A new attempt will be performed for every command send. */ cliConnect(0); repl(); } /* Otherwise, we have some arguments to execute */ if (cliConnect(0) != REDIS_OK) exit(1); if (config.eval) { return evalMode(argc,argv); } else { return noninteractive(argc,convertToSds(argc,argv)); } }
false
false
false
false
true
1
delete_noop_moves (f) rtx f ATTRIBUTE_UNUSED; { rtx insn, next; basic_block bb; int nnoops = 0; FOR_EACH_BB (bb) { for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next) { next = NEXT_INSN (insn); if (INSN_P (insn) && noop_move_p (insn)) { rtx note; /* If we're about to remove the first insn of a libcall then move the libcall note to the next real insn and update the retval note. */ if ((note = find_reg_note (insn, REG_LIBCALL, NULL_RTX)) && XEXP (note, 0) != insn) { rtx new_libcall_insn = next_real_insn (insn); rtx retval_note = find_reg_note (XEXP (note, 0), REG_RETVAL, NULL_RTX); REG_NOTES (new_libcall_insn) = gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0), REG_NOTES (new_libcall_insn)); XEXP (retval_note, 0) = new_libcall_insn; } delete_insn_and_edges (insn); nnoops++; } } } if (nnoops && rtl_dump_file) fprintf (rtl_dump_file, "deleted %i noop moves", nnoops); return nnoops; }
false
false
false
false
false
0
ast_dtmf_detect_init (dtmf_detect_state_t *s, unsigned int sample_rate) { int i; s->lasthit = 0; s->current_hit = 0; for (i = 0; i < 4; i++) { goertzel_init(&s->row_out[i], dtmf_row[i], DTMF_GSIZE, sample_rate); goertzel_init(&s->col_out[i], dtmf_col[i], DTMF_GSIZE, sample_rate); s->energy = 0.0; } s->current_sample = 0; s->hits = 0; s->misses = 0; }
false
false
false
false
false
0
opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_event_mgr) { // the number of bytes written on the media. // must be signed becuse "-1" is used to indicate an error in return values. OPJ_INT32 l_current_write_nb_bytes = 0; p_stream->m_current_data = p_stream->m_stored_data; while (p_stream->m_bytes_in_buffer) { // we should do an actual write on the media l_current_write_nb_bytes = p_stream->m_write_fn(p_stream->m_current_data,p_stream->m_bytes_in_buffer,p_stream->m_user_data); if (l_current_write_nb_bytes == -1) { p_stream->m_status |= opj_stream_e_error; opj_event_msg(p_event_mgr, EVT_INFO, "Error on writting stream!\n"); return false; } p_stream->m_current_data += l_current_write_nb_bytes; p_stream->m_bytes_in_buffer -= l_current_write_nb_bytes; } p_stream->m_current_data = p_stream->m_stored_data; return true; }
false
false
false
false
false
0
pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_alloc_fn_t alloc_fn, pcpu_fc_free_fn_t free_fn, pcpu_fc_populate_pte_fn_t populate_pte_fn) { static struct vm_struct vm; struct pcpu_alloc_info *ai; char psize_str[16]; int unit_pages; size_t pages_size; struct page **pages; int unit, i, j, rc; snprintf(psize_str, sizeof(psize_str), "%luK", PAGE_SIZE >> 10); ai = pcpu_build_alloc_info(reserved_size, 0, PAGE_SIZE, NULL); if (IS_ERR(ai)) return PTR_ERR(ai); BUG_ON(ai->nr_groups != 1); BUG_ON(ai->groups[0].nr_units != num_possible_cpus()); unit_pages = ai->unit_size >> PAGE_SHIFT; /* unaligned allocations can't be freed, round up to page size */ pages_size = PFN_ALIGN(unit_pages * num_possible_cpus() * sizeof(pages[0])); pages = memblock_virt_alloc(pages_size, 0); /* allocate pages */ j = 0; for (unit = 0; unit < num_possible_cpus(); unit++) for (i = 0; i < unit_pages; i++) { unsigned int cpu = ai->groups[0].cpu_map[unit]; void *ptr; ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE); if (!ptr) { pr_warning("PERCPU: failed to allocate %s page " "for cpu%u\n", psize_str, cpu); goto enomem; } /* kmemleak tracks the percpu allocations separately */ kmemleak_free(ptr); pages[j++] = virt_to_page(ptr); } /* allocate vm area, map the pages and copy static data */ vm.flags = VM_ALLOC; vm.size = num_possible_cpus() * ai->unit_size; vm_area_register_early(&vm, PAGE_SIZE); for (unit = 0; unit < num_possible_cpus(); unit++) { unsigned long unit_addr = (unsigned long)vm.addr + unit * ai->unit_size; for (i = 0; i < unit_pages; i++) populate_pte_fn(unit_addr + (i << PAGE_SHIFT)); /* pte already populated, the following shouldn't fail */ rc = __pcpu_map_pages(unit_addr, &pages[unit * unit_pages], unit_pages); if (rc < 0) panic("failed to map percpu area, err=%d\n", rc); /* * FIXME: Archs with virtual cache should flush local * cache for the linear mapping here - something * equivalent to flush_cache_vmap() on the local cpu. * flush_cache_vmap() can't be used as most supporting * data structures are not set up yet. */ /* copy static data */ memcpy((void *)unit_addr, __per_cpu_load, ai->static_size); } /* we're ready, commit */ pr_info("PERCPU: %d %s pages/cpu @%p s%zu r%zu d%zu\n", unit_pages, psize_str, vm.addr, ai->static_size, ai->reserved_size, ai->dyn_size); rc = pcpu_setup_first_chunk(ai, vm.addr); goto out_free_ar; enomem: while (--j >= 0) free_fn(page_address(pages[j]), PAGE_SIZE); rc = -ENOMEM; out_free_ar: memblock_free_early(__pa(pages), pages_size); pcpu_free_alloc_info(ai); return rc; }
false
false
false
false
false
0
set_recv_corrupt(bool arg, int frequency, int not_until_arg) { if (arg) { __function.frequency= frequency; not_until= not_until_arg; __function._corrupt= arg; } else { __function.frequency= 0; not_until= 0; __function._corrupt= false; } }
false
false
false
false
false
0
bdi_alloc_node(gfp_t gfp_mask, int node_id) { struct backing_dev_info *bdi; bdi = kmalloc_node(sizeof(struct backing_dev_info), gfp_mask | __GFP_ZERO, node_id); if (!bdi) return NULL; if (bdi_init(bdi)) { kfree(bdi); return NULL; } return bdi; }
false
false
false
false
false
0
xmms_config_property_callback_set (xmms_config_property_t *prop, xmms_object_handler_t cb, gpointer userdata) { g_return_if_fail (prop); if (!cb) return; xmms_object_connect (XMMS_OBJECT (prop), XMMS_IPC_SIGNAL_CONFIGVALUE_CHANGED, (xmms_object_handler_t) cb, userdata); }
false
false
false
false
false
0
backtr(th,mi,nd) double th; INT *mi, nd; { if (nd>0) return(th); return(invlink(th,mi[MLINK])); }
false
false
false
false
false
0
imProcessCalcAutoGamma(const imImage* image) { float mean, min, max; imStats stats[4]; imCalcImageStatistics(image, stats); mean = stats[0].mean; min = stats[0].min; max = stats[0].max; for (int i = 1; i < image->depth; i++) { if (stats[i].min < min) min = stats[i].min; if (stats[i].max > max) max = stats[i].max; mean += stats[i].mean; } mean /= (float)image->depth; return (float)(log((double)((mean-min)/(max-min)))/log(0.5)); }
false
false
false
false
false
0
cli_cmd_volume_delete_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; char *volname = NULL; gf_answer_t answer = GF_ANSWER_NO; const char *question = NULL; int sent = 0; int parse_error = 0; cli_local_t *local = NULL; dict_t *dict = NULL; question = "Deleting volume will erase all information about the volume. " "Do you want to continue?"; proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DELETE_VOLUME]; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; dict = dict_new (); if (!dict) goto out; if (wordcount != 3) { cli_usage_out (word->pattern); parse_error = 1; goto out; } answer = cli_cmd_get_confirmation (state, question); if (GF_ANSWER_NO == answer) { ret = 0; goto out; } volname = (char *)words[2]; ret = dict_set_str (dict, "volname", volname); if (ret) { gf_log (THIS->name, GF_LOG_WARNING, "dict set failed"); goto out; } CLI_LOCAL_INIT (local, words, frame, dict); if (proc->fn) { ret = proc->fn (frame, THIS, dict); } out: if (ret) { cli_cmd_sent_status_get (&sent); if ((sent == 0) && (parse_error == 0)) cli_out ("Volume delete failed"); } CLI_STACK_DESTROY (frame); return ret; }
false
false
false
false
false
0
addcheater(uaecptr addr, int size) { if (totaltrainers >= MAX_CHEAT_VIEW) return 0; trainerdata[totaltrainers].addr = addr; trainerdata[totaltrainers].size = size; totaltrainers++; return 1; }
false
false
false
false
false
0
e_ews_connection_delete_folder (EEwsConnection *cnc, gint pri, const gchar *folder_id, gboolean is_distinguished_id, const gchar *delete_type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { ESoapMessage *msg; GSimpleAsyncResult *simple; EwsAsyncData *async_data; g_return_if_fail (cnc != NULL); msg = e_ews_message_new_with_header ( cnc->priv->uri, cnc->priv->impersonate_user, "DeleteFolder", "DeleteType", delete_type, cnc->priv->version, E_EWS_EXCHANGE_2007_SP1, FALSE); e_soap_message_start_element (msg, "FolderIds", "messages", NULL); e_soap_message_start_element ( msg, is_distinguished_id ? "DistinguishedFolderId" : "FolderId", NULL, NULL); e_soap_message_add_attribute (msg, "Id", folder_id, NULL, NULL); /* This element is required for delegate access */ if (is_distinguished_id && cnc->priv->email) { e_soap_message_start_element (msg, "Mailbox", NULL, NULL); e_ews_message_write_string_parameter( msg, "EmailAddress", NULL, cnc->priv->email); e_soap_message_end_element (msg); } e_soap_message_end_element (msg); /* </DistinguishedFolderId> || </FolderId> */ e_soap_message_end_element (msg); /* </FolderIds> */ e_ews_message_write_footer (msg); simple = g_simple_async_result_new ( G_OBJECT (cnc), callback, user_data, e_ews_connection_delete_folder); async_data = g_new0 (EwsAsyncData, 1); g_simple_async_result_set_op_res_gpointer ( simple, async_data, (GDestroyNotify) async_data_free); e_ews_connection_queue_request ( cnc, msg, delete_folder_response_cb, pri, cancellable, simple); g_object_unref (simple); }
false
false
false
false
false
0
unpack_exchange(double *buf) { int k; int nlocal = atom->nlocal; if (nlocal == nmax) grow(0); int m = 1; x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; tag[nlocal] = static_cast<int> (buf[m++]); type[nlocal] = static_cast<int> (buf[m++]); mask[nlocal] = static_cast<int> (buf[m++]); image[nlocal] = *((tagint *) &buf[m++]); molecule[nlocal] = static_cast<int> (buf[m++]); num_bond[nlocal] = static_cast<int> (buf[m++]); for (k = 0; k < num_bond[nlocal]; k++) { bond_type[nlocal][k] = static_cast<int> (buf[m++]); bond_atom[nlocal][k] = static_cast<int> (buf[m++]); } nspecial[nlocal][0] = static_cast<int> (buf[m++]); nspecial[nlocal][1] = static_cast<int> (buf[m++]); nspecial[nlocal][2] = static_cast<int> (buf[m++]); for (k = 0; k < nspecial[nlocal][2]; k++) special[nlocal][k] = static_cast<int> (buf[m++]); if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) m += modify->fix[atom->extra_grow[iextra]]-> unpack_exchange(nlocal,&buf[m]); atom->nlocal++; return m; }
false
false
false
false
false
0
get(ArrayRef<Constant*> V) { if (Constant *C = getImpl(V)) return C; VectorType *Ty = VectorType::get(V.front()->getType(), V.size()); return Ty->getContext().pImpl->VectorConstants.getOrCreate(Ty, V); }
false
false
false
false
false
0
DumpData_16(FILE *trace, char *name, u16 *data, u16 dataLength, u32 indent, Bool XMTDump) { u32 i; if (!name && !data) return; if (name) StartAttribute(trace, name, indent, XMTDump); if (!XMTDump) fprintf(trace, "\""); for (i=0; i<dataLength; i++) { if (XMTDump) { fprintf(trace, "\'%d\'", data[i]); if (i+1<dataLength) fprintf(trace, " "); } else { fprintf(trace, "%d", data[i]); if (i+1<dataLength) fprintf(trace, ", "); } } if (!XMTDump) fprintf(trace, "\""); if (name) EndAttribute(trace, indent, XMTDump); }
false
false
false
false
false
0
get() { unsigned int v = getReplaced()->get(); if(m_pfnIsBreak(v, break_mask, break_value)) invokeAction(); return v; }
false
false
false
false
false
0
write_wstring (ACE_CDR::ULong len, const ACE_CDR::WChar *x) { // Note: translator framework is not supported. // if (ACE_OutputCDR::wchar_maxbytes () == 0) { errno = EACCES; return (this->good_bit_ = false); } if (static_cast<ACE_CDR::Short> (this->major_version_) == 1 && static_cast<ACE_CDR::Short> (this->minor_version_) == 2) { if (x != 0) { //In GIOP 1.2 the length field contains the number of bytes //the wstring occupies rather than number of wchars //Taking sizeof might not be a good way! This is a temporary fix. ACE_CDR::Boolean good_ulong = this->write_ulong ( ACE_Utils::truncate_cast<ACE_CDR::ULong> ( ACE_OutputCDR::wchar_maxbytes () * len)); if (good_ulong) { return this->write_wchar_array (x, len); } } else { //In GIOP 1.2 zero length wstrings are legal return this->write_ulong (0); } } else if (x != 0) { if (this->write_ulong (len + 1)) return this->write_wchar_array (x, len + 1); } else if (this->write_ulong (1)) return this->write_wchar (0); return (this->good_bit_ = false); }
false
false
false
false
false
0
getComponentColour(colour c, int component) { if( component == 0 ) { return makeColour( c.r, 0, 0 ); } else if( component == 1 ) { return makeColour( 0, c.g, 0 ); } else if( component == 2 ) { return makeColour( 0, 0, c.b ); } return COLOUR_BLACK; }
false
false
false
false
false
0
output_data_internal(MLPDecodeContext *m, unsigned int substr, uint8_t *data, unsigned int *data_size, int is32) { SubStream *s = &m->substream[substr]; unsigned int i, ch = 0; int32_t *data_32 = (int32_t*) data; int16_t *data_16 = (int16_t*) data; if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2)) return -1; for (i = 0; i < s->blockpos; i++) { for (ch = 0; ch <= s->max_channel; ch++) { int32_t sample = m->sample_buffer[i][ch] << s->output_shift[ch]; s->lossless_check_data ^= (sample & 0xffffff) << ch; if (is32) *data_32++ = sample << 8; else *data_16++ = sample >> 8; } } *data_size = i * ch * (is32 ? 4 : 2); return 0; }
false
false
false
false
false
0
castlingRightsString(FenNotation notation) const { QString str; for (int side = Side::White; side <= Side::Black; side++) { for (int cside = KingSide; cside >= QueenSide; cside--) { int rs = m_castlingRights.rookSquare[side][cside]; if (rs == 0) continue; int offset = (cside == QueenSide) ? -1: 1; Piece piece; int i = rs + offset; bool ambiguous = false; // If the castling rook is not the outernmost rook, // the castling square is ambiguous while (!(piece = pieceAt(i)).isWall()) { if (piece == Piece(Side::Type(side), Rook)) { ambiguous = true; break; } i += offset; } QChar c; // If the castling square is ambiguous, then we can't // use 'K' or 'Q'. Instead we'll use the square's file. if (ambiguous || notation == ShredderFen) c = QChar('a' + chessSquare(rs).file()); else { if (cside == 0) c = 'q'; else c = 'k'; } if (side == upperCaseSide()) c = c.toUpper(); str += c; } } if (str.length() == 0) str = "-"; return str; }
false
false
false
false
false
0
insert_pool_local( CoreSurfacePool *pool ) { int i, n; for (i=0; i<pool_count-1; i++) { D_ASSERT( pool_order[i] >= 0 ); D_ASSERT( pool_order[i] < pool_count-1 ); D_MAGIC_ASSERT( pool_array[pool_order[i]], CoreSurfacePool ); if (pool_array[pool_order[i]]->desc.priority < pool->desc.priority) break; } for (n=pool_count-1; n>i; n--) { D_ASSERT( pool_order[n-1] >= 0 ); D_ASSERT( pool_order[n-1] < pool_count-1 ); D_MAGIC_ASSERT( pool_array[pool_order[n-1]], CoreSurfacePool ); pool_order[n] = pool_order[n-1]; } pool_order[n] = pool_count - 1; #if D_DEBUG_ENABLED for (i=0; i<pool_count; i++) { D_DEBUG_AT( Core_SurfacePool, " %c> [%d] %p - '%s' [%d] (%d), %p\n", (i == n) ? '=' : '-', i, pool_array[pool_order[i]], pool_array[pool_order[i]]->desc.name, pool_array[pool_order[i]]->pool_id, pool_array[pool_order[i]]->desc.priority, pool_funcs[pool_order[i]] ); D_ASSERT( pool_order[i] == pool_array[pool_order[i]]->pool_id ); } #endif }
false
false
false
false
false
0
put_free_entry(grant_ref_t ref) { unsigned long flags; spin_lock_irqsave(&gnttab_list_lock, flags); gnttab_entry(ref) = gnttab_free_head; gnttab_free_head = ref; gnttab_free_count++; check_free_callbacks(); spin_unlock_irqrestore(&gnttab_list_lock, flags); }
false
false
false
false
false
0
bkread(int fi, unsigned char *buff, int size) { int a, b; if (!size) { error = 0; return 0; } for (a = b = 0; (a < size) && ((b = joe_read(fi, buff + a, size - a)) > 0); a += b) ; if (b < 0) error = -2; else error = 0; return a; }
true
true
false
false
true
1
svnic_dev_open_done(struct vnic_dev *vdev, int *done) { u64 a0 = 0, a1 = 0; int wait = VNIC_DVCMD_TMO; int err; *done = 0; err = svnic_dev_cmd(vdev, CMD_OPEN_STATUS, &a0, &a1, wait); if (err) return err; *done = (a0 == 0); return 0; }
false
false
false
false
false
0
gst_camera_bin_video_reset_elements (gpointer u_data) { GstCameraBin2 *camerabin = GST_CAMERA_BIN2_CAST (u_data); GST_DEBUG_OBJECT (camerabin, "Resetting video elements state"); g_mutex_lock (camerabin->video_capture_mutex); /* reset element states to clear eos/flushing pads */ gst_element_set_state (camerabin->video_encodebin, GST_STATE_READY); gst_element_set_state (camerabin->videobin_capsfilter, GST_STATE_READY); if (camerabin->video_filter) { gst_element_set_state (camerabin->video_filter, GST_STATE_READY); gst_element_sync_state_with_parent (camerabin->video_filter); } gst_element_sync_state_with_parent (camerabin->videobin_capsfilter); gst_element_sync_state_with_parent (camerabin->video_encodebin); if (camerabin->audio_src) { gst_element_set_state (camerabin->audio_capsfilter, GST_STATE_READY); gst_element_set_state (camerabin->audio_volume, GST_STATE_READY); /* FIXME We need to set audiosrc to null to make it resync the ringbuffer * while bug https://bugzilla.gnome.org/show_bug.cgi?id=648359 isn't * fixed. * * Also, we don't reinit the audiosrc to keep audio devices from being open * and running until we really need them */ gst_element_set_state (camerabin->audio_src, GST_STATE_NULL); if (camerabin->audio_filter) { gst_element_set_state (camerabin->audio_filter, GST_STATE_READY); gst_element_sync_state_with_parent (camerabin->audio_filter); } gst_element_sync_state_with_parent (camerabin->audio_capsfilter); gst_element_sync_state_with_parent (camerabin->audio_volume); } GST_DEBUG_OBJECT (camerabin, "Setting video state to idle"); camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE; g_cond_signal (camerabin->video_state_cond); g_mutex_unlock (camerabin->video_capture_mutex); gst_object_unref (camerabin); return NULL; }
false
false
false
false
false
0
__memp_skip_curadj(dbc, pgno) DBC * dbc; db_pgno_t pgno; { BH *bhp; DB_MPOOL *dbmp; DB_MPOOLFILE *dbmfp; DB_MPOOL_HASH *hp; DB_TXN *txn; ENV *env; MPOOLFILE *mfp; REGINFO *infop; roff_t mf_offset; int ret, skip; u_int32_t bucket; env = dbc->env; dbmp = env->mp_handle; dbmfp = dbc->dbp->mpf; mfp = dbmfp->mfp; mf_offset = R_OFFSET(dbmp->reginfo, mfp); skip = 0; for (txn = dbc->txn; txn->parent != NULL; txn = txn->parent) ; /* * Determine the cache and hash bucket where this page lives and get * local pointers to them. Reset on each pass through this code, the * page number can change. */ MP_GET_BUCKET(env, mfp, pgno, &infop, hp, bucket, ret); if (ret != 0) { /* Panic: there is no way to return the error. */ (void)__env_panic(env, ret); return (0); } SH_TAILQ_FOREACH(bhp, &hp->hash_bucket, hq, __bh) { if (bhp->pgno != pgno || bhp->mf_offset != mf_offset) continue; if (!BH_OWNED_BY(env, bhp, txn)) skip = 1; break; } MUTEX_UNLOCK(env, hp->mtx_hash); return (skip); }
false
false
false
false
false
0
DoACommand() { static wxString command; wxString inputLine( GetACommand() ); // bool continuing = false; int len = inputLine.size(); if( inputLine[len-1] == ExGlobals::GetContinuationCharacter() ) { if( --len == 0 ) { ExGlobals::WarningMessage( wxT("continuation line is empty") ); command.clear(); return; } inputLine.erase( len, 1 ); // erase continuation character continuing = true; } command += inputLine; if( continuing )return; // go back and get the next part of the command line if( command.empty() || command==wxString(wxT(' ')) ) { if( ExGlobals::GetPausingScript() )ExGlobals::RestartScripts(); return; } ExGlobals::PreParse( command ); AddCommandString( command ); try { ExGlobals::ProcessCommand( command ); } catch ( std::runtime_error &e ) { wxMessageDialog *md = new wxMessageDialog( (wxWindow*)this, wxString(e.what(),wxConvUTF8), wxT("ERROR"), wxOK|wxICON_ERROR ); md->ShowModal(); command.clear(); return; } command.clear(); if( ExGlobals::GetExecuteCommand() ) { // the script run here must be the top level script // since it is run interactively // try { ExGlobals::RunScript(); } catch ( std::runtime_error const &e ) { ExGlobals::ShowScriptError( e.what() ); ExGlobals::StopAllScripts(); } } }
false
false
false
false
false
0
il3945_send_tx_power(struct il_priv *il) { int rate_idx, i; const struct il_channel_info *ch_info = NULL; struct il3945_txpowertable_cmd txpower = { .channel = il->active.channel, }; u16 chan; if (WARN_ONCE (test_bit(S_SCAN_HW, &il->status), "TX Power requested while scanning!\n")) return -EAGAIN; chan = le16_to_cpu(il->active.channel); txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1; ch_info = il_get_channel_info(il, il->band, chan); if (!ch_info) { IL_ERR("Failed to get channel info for channel %d [%d]\n", chan, il->band); return -EINVAL; } if (!il_is_channel_valid(ch_info)) { D_POWER("Not calling TX_PWR_TBL_CMD on " "non-Tx channel.\n"); return 0; } /* fill cmd with power settings for all rates for current channel */ /* Fill OFDM rate */ for (rate_idx = IL_FIRST_OFDM_RATE, i = 0; rate_idx <= IL39_LAST_OFDM_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; txpower.power[i].rate = il3945_rates[rate_idx].plcp; D_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, txpower.power[i].tpc.dsp_atten, txpower.power[i].rate); } /* Fill CCK rates */ for (rate_idx = IL_FIRST_CCK_RATE; rate_idx <= IL_LAST_CCK_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; txpower.power[i].rate = il3945_rates[rate_idx].plcp; D_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, txpower.power[i].tpc.dsp_atten, txpower.power[i].rate); } return il_send_cmd_pdu(il, C_TX_PWR_TBL, sizeof(struct il3945_txpowertable_cmd), &txpower); }
false
false
false
false
false
0
finishConstruction(Parameter* parameters, RaisesSpec* raises, ContextSpec* contexts) { parameters_ = parameters; raises_ = raises; contexts_ = contexts; if (oneway_) { if (returnType_ && returnType_->kind() != IdlType::tk_void) { IdlError(file(), line(), "Oneway operation '%s' does not return void", identifier()); } for (Parameter* p = parameters; p; p = (Parameter*)p->next()) { if (p->direction() == 1) { IdlError(p->file(), p->line(), "In oneway operation '%s': out parameter '%s' " "is not permitted", identifier(), p->identifier()); } else if (p->direction() == 2) { IdlError(p->file(), p->line(), "In oneway operation '%s': inout parameter '%s' " "is not permitted", identifier(), p->identifier()); } } if (raises_) { IdlError(file(), line(), "Oneway operation '%s' is not permitted to have " "a raises expression", identifier()); } } Scope::endScope(); }
false
false
false
false
false
0
EndSelectAction(vtkAbstractWidget *w) { vtkBoxWidget2 *self = reinterpret_cast<vtkBoxWidget2*>(w); if ( self->WidgetState == vtkBoxWidget2::Start ) { return; } // Return state to not active self->WidgetState = vtkBoxWidget2::Start; reinterpret_cast<vtkBoxRepresentation*>(self->WidgetRep)-> SetInteractionState(vtkBoxRepresentation::Outside); self->ReleaseFocus(); self->EventCallbackCommand->SetAbortFlag(1); self->EndInteraction(); self->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); self->Render(); }
false
false
false
false
false
0
search_provider_dispose (GObject *obj) { NautilusShellSearchProvider *self = NAUTILUS_SHELL_SEARCH_PROVIDER (obj); if (self->name_owner_id != 0) { g_bus_unown_name (self->name_owner_id); self->name_owner_id = 0; } if (self->skeleton != NULL) { g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (self->skeleton)); g_clear_object (&self->skeleton); } g_clear_object (&self->object_manager); g_hash_table_destroy (self->metas_cache); cancel_current_search (self); g_clear_object (&self->volumes); G_OBJECT_CLASS (nautilus_shell_search_provider_parent_class)->dispose (obj); }
false
false
false
false
false
0
receiveAgentLine(char *dest,int limit) { list<NetConnection *>::iterator ni; global.debug("Global","receiveAgentLine"); if (Agents.empty()) return 0; for(ni=Agents.begin();ni!=Agents.end();ni++) if ( (*ni)->isConnected()) if ((*ni)->readLine(dest,limit)==0) return 1; return 0; }
false
false
false
false
false
0
ao_tasks_selection_changed_cb(gpointer t) { AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->tree)); GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gint line; gchar *filename, *locale_filename; GeanyDocument *doc; gtk_tree_model_get(model, &iter, TLIST_COL_LINE, &line, TLIST_COL_FILENAME, &filename, -1); locale_filename = utils_get_locale_from_utf8(filename); doc = document_open_file(locale_filename, FALSE, NULL, NULL); if (doc != NULL) { sci_goto_line(doc->editor->sci, line - 1, TRUE); gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci)); } /* remember the selected line for this document to restore the selection after an update */ if (priv->scan_all_documents) { priv->selected_task_doc = doc; priv->selected_task_line = line; } else g_hash_table_insert(priv->selected_tasks, doc, GINT_TO_POINTER(line)); g_free(filename); g_free(locale_filename); } return FALSE; }
false
false
false
false
false
0
test(char *URL) { CURL *c = NULL; int res = 0; CURLM *m = NULL; fd_set rd, wr, exc; int running; start_test_timing(); global_init(CURL_GLOBAL_ALL); easy_init(c); /* The point here is that there must not be anything running on the given proxy port */ if (libtest_arg2) easy_setopt(c, CURLOPT_PROXY, libtest_arg2); easy_setopt(c, CURLOPT_URL, URL); easy_setopt(c, CURLOPT_VERBOSE, 1L); multi_init(m); multi_add_handle(m, c); for(;;) { struct timeval interval; int maxfd = -99; interval.tv_sec = 1; interval.tv_usec = 0; fprintf(stderr, "curl_multi_perform()\n"); multi_perform(m, &running); abort_on_test_timeout(); if(!running) { /* This is where this code is expected to reach */ int numleft; CURLMsg *msg = curl_multi_info_read(m, &numleft); fprintf(stderr, "Expected: not running\n"); if(msg && !numleft) res = TEST_ERR_SUCCESS; /* this is where we should be */ else res = TEST_ERR_FAILURE; /* not correct */ break; /* done */ } fprintf(stderr, "running == %d\n", running); FD_ZERO(&rd); FD_ZERO(&wr); FD_ZERO(&exc); fprintf(stderr, "curl_multi_fdset()\n"); multi_fdset(m, &rd, &wr, &exc, &maxfd); /* At this point, maxfd is guaranteed to be greater or equal than -1. */ select_test(maxfd+1, &rd, &wr, &exc, &interval); abort_on_test_timeout(); } test_cleanup: /* proper cleanup sequence - type PA */ curl_multi_remove_handle(m, c); curl_multi_cleanup(m); curl_easy_cleanup(c); curl_global_cleanup(); return res; }
false
false
false
false
false
0
DecodeGPRnopcRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder) { DecodeStatus S = MCDisassembler::Success; if (RegNo == 15) S = MCDisassembler::SoftFail; Check(S, DecodeGPRRegisterClass(Inst, RegNo, Address, Decoder)); return S; }
false
false
false
false
false
0
File2Mime (const char *fname) { HtConfiguration* config= HtConfiguration::config(); // default to "can't identify" char content_type [100] = "application/x-unknown\n"; String cmd = config->Find ("content_classifier"); if (cmd.get() && *cmd) { cmd << " \"" << fname << '\"'; // allow file names to have spaces FILE *fileptr; if ( (fileptr = popen (cmd.get(), "r")) != NULL ) { fgets (content_type, sizeof (content_type), fileptr); pclose (fileptr); } } // Remove trailing newline, charset or language information int delim = strcspn (content_type, ",; \n\t"); content_type [delim] = '\0'; if (debug > 1) cout << "Mime type: " << fname << ' ' << content_type << endl; return (String (content_type)); }
false
false
false
false
false
0
icon_theme_changed (GtkIconTheme *theme, CcShellModel *self) { GtkTreeIter iter; GtkTreeModel *model; gboolean cont; model = GTK_TREE_MODEL (self); cont = gtk_tree_model_get_iter_first (model, &iter); while (cont) { GdkPixbuf *pixbuf; GIcon *icon; gtk_tree_model_get (model, &iter, COL_GICON, &icon, -1); pixbuf = load_pixbuf_for_gicon (icon); g_object_unref (icon); gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_PIXBUF, pixbuf, -1); cont = gtk_tree_model_iter_next (model, &iter); } }
false
false
false
false
false
0
setupEngines() { // TODO: We'd like a list of engines that can be iterated over in compile // time to generate multi-engine code. typedef Core::EngineConfig<Cscope::Crossref> Config; // Prefix group with "Engine_" so that engines do not overrun application // groups by accident. settings_->beginGroup(QString("Engine_") + Config::name()); // Add each value under the engine group to the map of configuration // parameters. Core::KeyValuePairs params; QStringList keys = settings_->allKeys(); QString key; foreach (key, keys) params[key] = settings_->value(key); settings_->endGroup(); // Apply configuration to the engine. Config::setConfig(params); } }
false
false
false
false
false
0
uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { int pm = uda1380_read_reg_cache(codec, UDA1380_PM); int reg; struct uda1380_platform_data *pdata = codec->dev->platform_data; switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: /* ADC, DAC on */ uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm); break; case SND_SOC_BIAS_STANDBY: if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (gpio_is_valid(pdata->gpio_power)) { gpio_set_value(pdata->gpio_power, 1); mdelay(1); uda1380_reset(codec); } uda1380_sync_cache(codec); } uda1380_write(codec, UDA1380_PM, 0x0); break; case SND_SOC_BIAS_OFF: if (!gpio_is_valid(pdata->gpio_power)) break; gpio_set_value(pdata->gpio_power, 0); /* Mark mixer regs cache dirty to sync them with * codec regs on power on. */ for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++) set_bit(reg - 0x10, &uda1380_cache_dirty); } return 0; }
false
false
false
false
false
0
process_reads(int fd, short args, void *cbdata) { orte_dfs_request_t *read_dfs = (orte_dfs_request_t*)cbdata; orte_dfs_tracker_t *tptr, *trk; opal_list_item_t *item; opal_buffer_t *buffer; int64_t i64; int rc; /* look in our local records for this fd */ trk = NULL; for (item = opal_list_get_first(&active_files); item != opal_list_get_end(&active_files); item = opal_list_get_next(item)) { tptr = (orte_dfs_tracker_t*)item; if (tptr->local_fd == read_dfs->local_fd) { trk = tptr; break; } } if (NULL == trk) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); OBJ_RELEASE(read_dfs); return; } /* add this request to our pending list */ read_dfs->id = req_id++; opal_list_append(&requests, &read_dfs->super); /* setup a message for the daemon telling * them what file to read */ buffer = OBJ_NEW(opal_buffer_t); if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->cmd, 1, ORTE_DFS_CMD_T))) { ORTE_ERROR_LOG(rc); goto complete; } /* include the request id */ if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->id, 1, OPAL_UINT64))) { ORTE_ERROR_LOG(rc); goto complete; } if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { ORTE_ERROR_LOG(rc); goto complete; } i64 = (int64_t)read_dfs->read_length; if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { ORTE_ERROR_LOG(rc); goto complete; } opal_output_verbose(1, orte_dfs_base_framework.framework_output, "%s sending read file request to %s for fd %d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&trk->host_daemon), trk->local_fd); /* send it */ if (0 > (rc = orte_rml.send_buffer_nb(&trk->host_daemon, buffer, ORTE_RML_TAG_DFS_CMD, orte_rml_send_callback, NULL))) { ORTE_ERROR_LOG(rc); OBJ_RELEASE(buffer); } /* don't release the request */ return; complete: /* don't need to hang on to this request */ opal_list_remove_item(&requests, &read_dfs->super); OBJ_RELEASE(read_dfs); }
false
false
false
false
false
0
b43_nphy_set_rssi_2055_vcm(struct b43_wldev *dev, enum n_rssi_type rssi_type, u8 *buf) { int i; for (i = 0; i < 2; i++) { if (rssi_type == N_RSSI_NB) { if (i == 0) { b43_radio_maskset(dev, B2055_C1_B0NB_RSSIVCM, 0xFC, buf[0]); b43_radio_maskset(dev, B2055_C1_RX_BB_RSSICTL5, 0xFC, buf[1]); } else { b43_radio_maskset(dev, B2055_C2_B0NB_RSSIVCM, 0xFC, buf[2 * i]); b43_radio_maskset(dev, B2055_C2_RX_BB_RSSICTL5, 0xFC, buf[2 * i + 1]); } } else { if (i == 0) b43_radio_maskset(dev, B2055_C1_RX_BB_RSSICTL5, 0xF3, buf[0] << 2); else b43_radio_maskset(dev, B2055_C2_RX_BB_RSSICTL5, 0xF3, buf[2 * i + 1] << 2); } } }
false
false
false
false
false
0
getDescription() const { return std::string((IsArg ? "Argument #" : "Return value #")) + utostr(Idx) + " of function " + F->getNameStr(); }
false
false
false
false
false
0
set_bash_input () { /* Make sure the fd from which we are reading input is not in no-delay mode. */ #if defined (BUFFERED_INPUT) if (interactive == 0) sh_unset_nodelay_mode (default_buffered_input); else #endif /* !BUFFERED_INPUT */ sh_unset_nodelay_mode (fileno (stdin)); /* with_input_from_stdin really means `with_input_from_readline' */ if (interactive && no_line_editing == 0) with_input_from_stdin (); #if defined (BUFFERED_INPUT) else if (interactive == 0) with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]); #endif /* BUFFERED_INPUT */ else with_input_from_stream (default_input, dollar_vars[0]); }
false
false
false
false
false
0
compare(const Basic &o) const { CSYMPY_ASSERT(is_a<Pow>(o)) const Pow &s = static_cast<const Pow &>(o); int base_cmp = base_->__cmp__(*s.base_); if (base_cmp == 0) return exp_->__cmp__(*s.exp_); else return base_cmp; }
false
false
false
false
false
0
gog_child_button_popdown (GogChildButton *child_button) { if (child_button->menu != NULL) gtk_menu_popdown (GTK_MENU (child_button->menu)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child_button->toggle_button), FALSE); }
false
false
false
false
false
0
onQueryTip(FXObject* sender,FXSelector sel,void* ptr){ if(FXScrollArea::onQueryTip(sender,sel,ptr)) return 1; /* FIXME if((flags&FLAG_TIP) && (0<=cursor)){ FXString string=items[cursor]->getText().section('\t',0); sender->handle(this,FXSEL(SEL_COMMAND,ID_SETSTRINGVALUE),(void*)&string); return 1; } */ return 0; }
false
false
false
false
false
0
ReadGeometryFromMIFFile(MIDDATAFile *fp) { const char *pszLine; /* Go to the first line of the next feature */ while (((pszLine = fp->GetLine()) != NULL) && fp->IsValidFeature(pszLine) == FALSE) ; return 0; }
false
false
false
false
false
0
TestLoadingScalar( unsigned int internalFormat, unsigned int format, unsigned int type, int textureSize[3], int componentSize) { // componentSize=vtkAbstractArray::GetDataTypeSize(scalarType)*input->GetNumberOfScalarComponents() bool result; vtkgl::TexImage3D(vtkgl::PROXY_TEXTURE_3D,0, static_cast<GLint>(internalFormat), textureSize[0],textureSize[1],textureSize[2],0, format, type,0); GLint width; glGetTexLevelParameteriv(vtkgl::PROXY_TEXTURE_3D,0,GL_TEXTURE_WIDTH, &width); result=width!=0; if(result) { // so far, so good but some cards always succeed with a proxy texture // let's try to actually allocate.. vtkgl::TexImage3D(vtkgl::TEXTURE_3D,0,static_cast<GLint>(internalFormat), textureSize[0], textureSize[1],textureSize[2],0, format, type,0); GLenum errorCode=glGetError(); result=errorCode!=GL_OUT_OF_MEMORY; if(result) { if(errorCode!=GL_NO_ERROR) { cout<<"after try to load the texture"; cout<<" ERROR (x"<<hex<<errorCode<<") "<<dec; cout<<OpenGLErrorMessage(static_cast<unsigned int>(errorCode)); cout<<endl; } // so far, so good but some cards don't report allocation error result=textureSize[0]*textureSize[1]*textureSize[2]*componentSize <=static_cast<float>(this->MaxMemoryInBytes)*this->MaxMemoryFraction; } } return result; }
false
false
false
false
false
0
srv_set_io_thread_op_info( /*======================*/ ulint i, /*!< in: the 'segment' of the i/o thread */ const char* str) /*!< in: constant char string describing the state */ { ut_a(i < SRV_MAX_N_IO_THREADS); srv_io_thread_op_info[i] = str; }
false
false
false
false
false
0
help_bitfield(char **bit_names) { static char buffer[1024]; char *pos, sepa = ':'; unsigned int bit; strcpy(buffer, "bitfield"); pos = strchr(buffer, '\0'); for (bit = 0; bit < 32; ++bit) { if (bit_names[bit] == NULL) continue; snprintf(pos, sizeof(buffer) - (pos - buffer), "%c %s", sepa, bit_names[bit]); pos += strlen(pos); sepa = ','; } return buffer; }
false
false
false
false
false
0
checkbutton_toggled_cb (GtkWidget *widget, CcWacomMappingPanel *self) { gboolean active; active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); set_combobox_sensitive (self, active); if (!active) gtk_switch_set_active (GTK_SWITCH(self->priv->aspectswitch), FALSE); update_mapping (self); }
false
false
false
false
false
0
rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e) { char key[REND_SERVICE_ID_LEN_BASE32+2]; /* <version><query>\0 */ tor_assert(rend_cache); if (!rend_valid_service_id(query)) return -1; *e = NULL; if (version != 0) { tor_snprintf(key, sizeof(key), "2%s", query); *e = strmap_get_lc(rend_cache, key); } if (!*e && version != 2) { tor_snprintf(key, sizeof(key), "0%s", query); *e = strmap_get_lc(rend_cache, key); } if (!*e) return 0; tor_assert((*e)->parsed && (*e)->parsed->intro_nodes); /* XXX023 hack for now, to return "not found" if there are no intro * points remaining. See bug 997. */ if (! rend_client_any_intro_points_usable(*e)) return 0; return 1; }
false
false
false
false
false
0
getViewBoxCoord(const QString & svg, int coord) { QRegExp re("viewBox=['\\\"]([^'\\\"]+)['\\\"]"); int ix = re.indexIn(svg); if (ix < 0) return 0; QString vb = re.cap(1); QStringList coords = vb.split(" "); QString c = coords.at(coord); return c.toDouble(); }
false
false
false
false
false
0
rb_big2ulong_pack(x) VALUE x; { unsigned long num = big2ulong(x, "unsigned long"); if (!RBIGNUM(x)->sign) { return -num; } return num; }
false
false
false
false
false
0
free_dof(DOF *dof, MESH *mesh, int position, const int is_coarse_dof) { FUNCNAME("free_dof"); DOF_ADMIN *admin; int i, j, n, n0, ndof; MESH_MEM_INFO* mem_info; DEBUG_TEST_EXIT(mesh, "mesh=nil\n"); mem_info = (MESH_MEM_INFO*)mesh->mem_info; DEBUG_TEST_EXIT(mem_info,"mesh \"%s\": mesh->mem_info=nil\n", mesh->name); DEBUG_TEST_EXIT(position >= 0 && position < N_NODE_TYPES, "mesh \"%s\": unknown position %d\n",mesh->name, position); ndof = mesh->n_dof[position]; DEBUG_TEST_EXIT(!ndof || dof, "dof = nil, but ndof=%d\n", ndof); DEBUG_TEST_EXIT(ndof || !dof, "dof != nil, but ndof=0\n"); DEBUG_TEST_EXIT(mem_info->dofs[position], "mesh \"%s\": no memory management present for %d DOFs.", mesh->name, position); for (i = 0; i < mesh->n_dof_admin; i++) { admin = mesh->dof_admin[i]; DEBUG_TEST_EXIT(admin, "mesh \"%s\": no dof_admin[%d]\n", mesh->name, i); n = admin->n_dof[position]; n0 = admin->n0_dof[position]; DEBUG_TEST_EXIT(n+n0 <= ndof, "dof_admin \"%s\": n=%d, n0=%d too large: ndof=%d\n", admin, n, n0, ndof); if(!(admin->preserve_coarse_dofs && is_coarse_dof)) for (j = 0; j < n; j++) { free_dof_index(admin, dof[n0+j]); dof[n0+j] = -1; /* Mark this DOF as unused! */ } } if(!is_coarse_dof) { /* Also free the DOF pointer memory. */ freeMemory((void *)dof, mem_info->dofs[position]); } return; }
false
false
false
false
false
0
set_video_pass_theora(void * data, int pass, int total_passes, const char * stats_file) { char * buf; int ret; theora_t * theora = data; theora->pass = pass; if(theora->pass == 1) { theora->stats_file = fopen(stats_file, "wb"); /* Get initial header */ if(!theora->stats_file) { bg_log(BG_LOG_ERROR, LOG_DOMAIN, "couldn't open stats file %s", stats_file); return 0; } ret = th_encode_ctl(theora->ts, TH_ENCCTL_2PASS_OUT, &buf, sizeof(buf)); if(ret < 0) { bg_log(BG_LOG_ERROR, LOG_DOMAIN, "getting 2 pass header failed"); return 0; } fwrite(buf, 1, ret, theora->stats_file); } else { theora->stats_file = fopen(stats_file, "rb"); if(!theora->stats_file) { bg_log(BG_LOG_ERROR, LOG_DOMAIN, "couldn't open stats file %s", stats_file); return 0; } fseek(theora->stats_file, 0, SEEK_END); theora->stats_size = ftell(theora->stats_file); fseek(theora->stats_file, 0, SEEK_SET); theora->stats_buf = malloc(theora->stats_size); if(fread(theora->stats_buf, 1, theora->stats_size, theora->stats_file) < theora->stats_size) { bg_log(BG_LOG_ERROR, LOG_DOMAIN, "couldn't read stats data"); return 0; } fclose(theora->stats_file); theora->stats_file = 0; theora->stats_ptr = theora->stats_buf; } return 1; }
false
false
false
false
true
1
mono_class_get_field (MonoClass *class, guint32 field_token) { int idx = mono_metadata_token_index (field_token); g_assert (mono_metadata_token_code (field_token) == MONO_TOKEN_FIELD_DEF); return mono_class_get_field_idx (class, idx - 1); }
false
false
false
false
false
0
CreateTimer(int timerType) { int platformTimerId, timerId; if ( timerType == VTKI_TIMER_FIRST ) { unsigned long duration = this->TimerDuration; timerId = vtkTimerId; //just use current id, assume we don't have mutliple timers platformTimerId = this->InternalCreateTimer(timerId,RepeatingTimer,duration); if ( 0 == platformTimerId ) { return 0; } (*this->TimerMap)[timerId] = vtkTimerStruct(platformTimerId,RepeatingTimer,duration); return timerId; } else //VTKI_TIMER_UPDATE is just updating last created timer { return 1; //do nothing because repeating timer has been created } }
false
false
false
false
false
0
rv770_get_engine_memory_ss(struct radeon_device *rdev) { struct rv7xx_power_info *pi = rv770_get_pi(rdev); struct radeon_atom_ss ss; pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, ASIC_INTERNAL_ENGINE_SS, 0); pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, ASIC_INTERNAL_MEMORY_SS, 0); if (pi->sclk_ss || pi->mclk_ss) pi->dynamic_ss = true; else pi->dynamic_ss = false; }
false
false
false
false
false
0
uclist_add_signature(const unsigned long int id, const unsigned long int gid, const uint32_t flags, const uint32_t cpuid, const uint32_t pf_mask, const int32_t uc_rev, const void * const uc, const uint32_t uc_size, const int strict, struct intel_uclist_entry ** const uclist) { struct intel_uclist_entry **pnext, *n; int res = 0; if (unlikely(!cpuid || !uc || !uclist)) return EINVAL; pnext = uclist; n = NULL; /* search linked list for first insertion point */ while (likely(*pnext && (*pnext)->cpuid < cpuid)) pnext = &((*pnext)->next); /* look for duplicates */ while (likely(*pnext) && (*pnext)->cpuid == cpuid) { if ((*pnext)->pf_mask == pf_mask && (*pnext)->uc_rev == uc_rev) { res = EEXIST; n = *pnext; } pnext = &((*pnext)->next); } if (strict && res == EEXIST) { int dup = intel_ucode_compare(uc, n->uc); if (dup == -EINVAL || dup == -EBADF) return -dup; } n = malloc(sizeof(struct intel_uclist_entry)); if (unlikely(!n)) return ENOMEM; memset(n, 0, sizeof(struct intel_uclist_entry)); n->id = id; n->gid = gid; n->cpuid = cpuid; n->pf_mask = pf_mask; n->uc_rev = uc_rev; n->uc = uc; n->uc_size = uc_size; n->flags = flags; /* prepend */ n->next = *pnext; *pnext = n; return res; }
false
false
false
false
false
0
globus_l_gram_fifo_to_iovec( globus_fifo_t * fifo, struct iovec ** iov, int * num_iov) { globus_list_t *list; size_t len; char * str; int i; int rc = GLOBUS_SUCCESS; len = globus_fifo_size(fifo); list = globus_fifo_convert_to_list(fifo); *iov = malloc(len * sizeof(struct iovec)); if (*iov == NULL) { rc = GLOBUS_GRAM_PROTOCOL_ERROR_MALLOC_FAILED; goto malloc_iov_failed; } *num_iov = len; i = 0; for (; list != NULL; i++) { str = globus_list_remove(&list, list); (*iov)[i].iov_base = str; (*iov)[i].iov_len = strlen(str); } if (rc != GLOBUS_SUCCESS) { malloc_iov_failed: *iov = NULL; *num_iov = 0; } return rc; }
false
false
false
false
false
0
hexdump(std::ostream& os, const byte* buf, long len, long offset) { const std::string::size_type pos = 8 + 16 * 3 + 2; const std::string align(pos, ' '); long i = 0; while (i < len) { os << " " << std::setw(4) << std::setfill('0') << std::hex << i + offset << " "; std::ostringstream ss; do { byte c = buf[i]; os << std::setw(2) << std::setfill('0') << std::right << std::hex << (int)c << " "; ss << ((int)c >= 31 && (int)c < 127 ? char(buf[i]) : '.'); } while (++i < len && i%16 != 0); std::string::size_type width = 9 + ((i-1)%16 + 1) * 3; os << (width > pos ? "" : align.substr(width)) << ss.str() << "\n"; } os << std::dec << std::setfill(' '); }
false
false
false
false
false
0
dce4_dp_audio_set_dto(struct radeon_device *rdev, struct radeon_crtc *crtc, unsigned int clock) { u32 value; value = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; value |= DCCG_AUDIO_DTO1_USE_512FBR_DTO; WREG32(DCCG_AUDIO_DTO1_CNTL, value); /* Two dtos; generally use dto1 for DP */ value = 0; value |= DCCG_AUDIO_DTO_SEL; if (crtc) value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id); WREG32(DCCG_AUDIO_DTO_SOURCE, value); /* Express [24MHz / target pixel clock] as an exact rational * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator */ if (ASIC_IS_DCE41(rdev)) { unsigned int div = (RREG32(DCE41_DENTIST_DISPCLK_CNTL) & DENTIST_DPREFCLK_WDIVIDER_MASK) >> DENTIST_DPREFCLK_WDIVIDER_SHIFT; div = radeon_audio_decode_dfs_div(div); if (div) clock = 100 * clock / div; } WREG32(DCCG_AUDIO_DTO1_PHASE, 24000); WREG32(DCCG_AUDIO_DTO1_MODULE, clock); }
false
false
false
false
false
0
VSM_Diag(struct VSM_data *vd, VSM_diag_f *func, void *priv) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (func == NULL) vd->diag = (VSM_diag_f*)getpid; else vd->diag = func; vd->priv = priv; }
false
false
false
true
false
1
xml_sax_page_breaks_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob) { XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state; if (NULL != state->page_breaks) { print_info_set_breaks (state->sheet->print_info, state->page_breaks); state->page_breaks = NULL; } }
false
false
false
false
false
0
deviceMinStep(device_ *r, double *minStep) { double localMinStep = 0.0; ReturnErrIf(r == NULL); ReturnErrIf(minStep == NULL); ReturnErrIf(r->class == NULL); if(r->class->minStep != NULL) { ReturnErrIf(r->class->minStep(r, &localMinStep)); if((localMinStep > 0.0) && (localMinStep < *minStep)) { *minStep = localMinStep; } } return 0; }
false
false
false
false
false
0
__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, uint64_t, int)) { scsi_qla_host_t *vha = shost_priv(cmd->device->host); fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; int err; if (!fcport) { return FAILED; } err = fc_block_scsi_eh(cmd); if (err != 0) return err; ql_log(ql_log_info, vha, 0x8009, "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no, cmd->device->id, cmd->device->lun, cmd); err = 0; if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x800a, "Wait for hba online failed for cmd=%p.\n", cmd); goto eh_reset_failed; } err = 2; if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x800c, "do_reset failed for cmd=%p.\n", cmd); goto eh_reset_failed; } err = 3; if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, cmd->device->lun, type) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x800d, "wait for pending cmds failed for cmd=%p.\n", cmd); goto eh_reset_failed; } ql_log(ql_log_info, vha, 0x800e, "%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name, vha->host_no, cmd->device->id, cmd->device->lun, cmd); return SUCCESS; eh_reset_failed: ql_log(ql_log_info, vha, 0x800f, "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name, reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, cmd); return FAILED; }
false
false
false
false
false
0
os_testing_mode(void) { static int warned; assert(become_inited); if (become_testing <= 0) return 0; if (!warned) { sub_context_ty *scp; warned = 1; scp = sub_context_new(); verbose_intl(scp, i18n("warning: test mode")); sub_context_delete(scp); } return 1; }
false
false
false
false
false
0
setexp(const char *exp, struct rfc1035_spf_info *info) { struct rfc1035_reply *reply; char namebuf[RFC1035_MAXNAMESIZE+1]; char txtbuf[256]; int n; char *str; /* ** The argument to the explanation modifier is a domain-spec ** to be TXT queried. The result of the TXT query is a ** macro-string that is macro-expanded. If SPF processing ** results in a rejection, the expanded result SHOULD be ** shown to the sender in the SMTP reject message. This ** string allows the publishing domain to communicate further ** information via the SMTP receiver to legitimate senders in ** the form of a short message or URL. */ namebuf[0]=0; strncat(namebuf, exp, RFC1035_MAXNAMESIZE); if (rfc1035_resolve_cname(&info->res, namebuf, RFC1035_TYPE_TXT, RFC1035_CLASS_IN, &reply, 0) < 0 || reply == 0 || (n=rfc1035_replysearch_an(&info->res, reply, namebuf, RFC1035_TYPE_TXT, RFC1035_CLASS_IN, 0)) < 0) { set_err_msg(info->errmsg_buf, info->errmsg_buf_size, "A DNS lookup error occured while" " fetching the SPF explanation record."); } else { rfc1035_rr_gettxt(reply->allrrs[n], 0, txtbuf); str=expand(txtbuf, info); set_err_msg(info->errmsg_buf, info->errmsg_buf_size, str ? str:strerror(errno)); if (str) free(str); } rfc1035_replyfree(reply); }
true
true
false
false
false
1
get_encoding() const { xmlpp::string encoding; if(impl_->encoding) encoding = (const char*)impl_->encoding; return encoding; }
false
false
false
false
false
0
realtek_refill_rx ( struct realtek_nic *rtl ) { struct realtek_descriptor *rx; struct io_buffer *iobuf; unsigned int rx_idx; physaddr_t address; int is_last; /* Do nothing in legacy mode */ if ( rtl->legacy ) return; while ( ( rtl->rx.prod - rtl->rx.cons ) < RTL_NUM_RX_DESC ) { /* Allocate I/O buffer */ iobuf = alloc_iob ( RTL_RX_MAX_LEN ); if ( ! iobuf ) { /* Wait for next refill */ return; } /* Get next receive descriptor */ rx_idx = ( rtl->rx.prod++ % RTL_NUM_RX_DESC ); is_last = ( rx_idx == ( RTL_NUM_RX_DESC - 1 ) ); rx = &rtl->rx.desc[rx_idx]; /* Populate receive descriptor */ address = virt_to_bus ( iobuf->data ); rx->address = cpu_to_le64 ( address ); rx->length = cpu_to_le16 ( RTL_RX_MAX_LEN ); wmb(); rx->flags = ( cpu_to_le16 ( RTL_DESC_OWN ) | ( is_last ? cpu_to_le16 ( RTL_DESC_EOR ) : 0 ) ); wmb(); /* Record I/O buffer */ assert ( rtl->rx_iobuf[rx_idx] == NULL ); rtl->rx_iobuf[rx_idx] = iobuf; DBGC2 ( rtl, "REALTEK %p RX %d is [%llx,%llx)\n", rtl, rx_idx, ( ( unsigned long long ) address ), ( ( unsigned long long ) address + RTL_RX_MAX_LEN ) ); } }
false
false
false
false
false
0