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 |
|---|---|---|---|---|---|---|
lj_cf_package_require(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
int i;
lua_settop(L, 1); /* _LOADED table will be at index 2 */
lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
lua_getfield(L, 2, name);
if (lua_toboolean(L, -1)) { /* is it there? */
if (lua_touserdata(L, -1) == sentinel) /* check loops */
luaL_error(L, "loop or previous error loading module " LUA_QS, name);
return 1; /* package is already loaded */
}
/* else must load it; iterate over available loaders */
lua_getfield(L, LUA_ENVIRONINDEX, "loaders");
if (!lua_istable(L, -1))
luaL_error(L, LUA_QL("package.loaders") " must be a table");
lua_pushliteral(L, ""); /* error message accumulator */
for (i = 1; ; i++) {
lua_rawgeti(L, -2, i); /* get a loader */
if (lua_isnil(L, -1))
luaL_error(L, "module " LUA_QS " not found:%s",
name, lua_tostring(L, -2));
lua_pushstring(L, name);
lua_call(L, 1, 1); /* call it */
if (lua_isfunction(L, -1)) /* did it find module? */
break; /* module loaded successfully */
else if (lua_isstring(L, -1)) /* loader returned error message? */
lua_concat(L, 2); /* accumulate it */
else
lua_pop(L, 1);
}
lua_pushlightuserdata(L, sentinel);
lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */
lua_pushstring(L, name); /* pass name as argument to module */
lua_call(L, 1, 1); /* run loaded module */
if (!lua_isnil(L, -1)) /* non-nil return? */
lua_setfield(L, 2, name); /* _LOADED[name] = returned value */
lua_getfield(L, 2, name);
if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */
lua_pushboolean(L, 1); /* use true as result */
lua_pushvalue(L, -1); /* extra copy to be returned */
lua_setfield(L, 2, name); /* _LOADED[name] = true */
}
lj_lib_checkfpu(L);
return 1;
} | false | false | false | false | false | 0 |
add (boost::shared_ptr<Account> account)
{
account->trigger_saving.connect (boost::bind (&LM::Bank::save, this));
add_account (account);
} | false | false | false | false | false | 0 |
free_cachefile(struct cachefile *cacheptr)
{
rb_dlink_node *ptr;
rb_dlink_node *next_ptr;
if(cacheptr == NULL)
return;
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, cacheptr->contents.head)
{
if(ptr->data != emptyline)
rb_free(ptr->data);
}
rb_free(cacheptr);
} | false | false | false | false | false | 0 |
_e2_confdlg_category_selected_cb
(GtkTreeSelection *selection, E2_ConfigDialogRuntime *rt)
{
printd (DEBUG, "callback: category selected");
GtkTreeIter iter;
GtkTreeModel *model;
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
g_free (page_last_name);
gint page;
gtk_tree_model_get (model, &iter, 0, &page_last_name, 1, &page, -1);
gtk_notebook_set_current_page (rt->notebook, page);
gtk_widget_grab_focus (rt->treeview);
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
skinny_session(void *data)
{
int res;
struct skinny_req *req;
struct skinnysession *s = data;
ast_verb(3, "Starting Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
for (;;) {
res = get_input(s);
if (res < 0) {
ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
destroy_session(s);
return NULL;
}
if (res > 0)
{
if (!(req = skinny_req_parse(s))) {
ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
destroy_session(s);
return NULL;
}
res = handle_message(req, s);
if (res < 0) {
ast_verb(3, "Ending Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
destroy_session(s);
return NULL;
}
}
}
ast_debug(3, "Skinny Session returned: %s\n", strerror(errno));
if (s)
destroy_session(s);
return 0;
} | false | false | false | false | false | 0 |
ajSeqBamHeaderGetSortorder(const AjPSeqBamHeader header)
{
const char* ret = NULL;
BamPHeaderLine hline = NULL;
AjIList k = NULL;
BamPHeaderTag so = NULL;
if(!header || !header->dict)
return NULL;
k = ajListIterNewread(header->dict);
while(!ajListIterDone(k))
{
hline = ajListIterGet(k);
if(hline->type[0] != 'H' || hline->type[1] != 'D')
continue;
so = bamHeaderLineHasTag(hline,"SO");
if(so)
ret = so->value;
break;
}
ajListIterDel(&k);
return ret;
} | false | false | false | false | false | 0 |
cb_locaddr()
{
GtkWidget *dlg, *isloc, *locwid;
dlg = gtk_dialog_new_with_buttons("Set local address",
GTK_WINDOW(toplevel),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
NULL);
isloc = gtk_check_button_new_with_label("Local address set");
locwid = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), isloc, FALSE, FALSE, DEF_PAD);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), locwid, FALSE, FALSE, DEF_PAD);
if (hadlocaddr != NO_IPADDR) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(isloc), TRUE);
gtk_entry_set_text(GTK_ENTRY(locwid), phname(myhostid, hadlocaddr));
}
gtk_widget_show_all(dlg);
while (gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_OK)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(isloc))) {
const gchar *h = gtk_entry_get_text(GTK_ENTRY(locwid));
netid_t resip = 0;
enum IPatype iptype = validhostname(h, &resip);
if (iptype != NO_IPADDR) {
hadlocaddr = iptype;
myhostid = resip;
lochdisplay();
break;
}
}
gtk_widget_destroy(dlg);
} | false | false | false | false | false | 0 |
cio_byteout(opj_cio_t *cio, unsigned char v) {
if (cio->bp >= cio->end) {
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
return OPJ_FALSE;
}
*cio->bp++ = v;
return OPJ_TRUE;
} | false | false | false | false | false | 0 |
_handle_source_request (client_t *client, const char *uri)
{
INFO1("Source logging in at mountpoint \"%s\"", uri);
if (uri[0] != '/')
{
WARN0 ("source mountpoint not starting with /");
client_send_401 (client);
return;
}
switch (client_check_source_auth (client, uri))
{
case 0: /* authenticated from config file */
source_startup (client, uri, ICECAST_SOURCE_AUTH);
break;
case 1: /* auth pending */
break;
default: /* failed */
INFO1("Source (%s) attempted to login with invalid or missing password", uri);
client_send_401(client);
break;
}
} | false | false | false | false | false | 0 |
SaveVectors(int n, int m,
const double* q,
int base)
{
// Store the contents of q. Basically this is a fifo. When a write
// with base=0 is called, we start another fifo.
if (base == 0) {
for (unsigned i=0; i<temp_store.size(); ++i)
delete temp_store[i];
temp_store.clear();
}
double* temp = new double[n*m];
vcl_memcpy(temp,q,n*m*sizeof(double));
#ifdef DEBUG
vcl_cout << "Save vectors " << base << ' ' << temp << '\n';
#endif
temp_store.push_back(temp);
return 0;
} | false | false | false | false | false | 0 |
qf_age(eap)
exarg_T *eap;
{
qf_info_T *qi = &ql_info;
int count;
if (eap->cmdidx == CMD_lolder || eap->cmdidx == CMD_lnewer)
{
qi = GET_LOC_LIST(curwin);
if (qi == NULL)
{
EMSG(_(e_loclist));
return;
}
}
if (eap->addr_count != 0)
count = eap->line2;
else
count = 1;
while (count--)
{
if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder)
{
if (qi->qf_curlist == 0)
{
EMSG(_("E380: At bottom of quickfix stack"));
return;
}
--qi->qf_curlist;
}
else
{
if (qi->qf_curlist >= qi->qf_listcount - 1)
{
EMSG(_("E381: At top of quickfix stack"));
return;
}
++qi->qf_curlist;
}
}
qf_msg(qi);
} | false | false | false | false | false | 0 |
toKeyword(Scanner *s)
{
std::string t="";
if ( s->match ( "appbar_color_to" ) )
{
t = "{";
if ( s->match ( t ) )
{
rgbKeywords(s);
to.red = temp_color;
rgbKeywords(s);
to.green = temp_color;
rgbKeywords(s);
to.blue = temp_color;
t = "}";
if ( s->match ( t ) )
{
return true;
}
}
}
return false;
} | false | false | false | false | false | 0 |
cbf_read_line (cbf_file *file, const char **line)
{
int c;
char buffer[80];
/* Does the file exist? */
if (!file)
return CBF_ARGUMENT;
/* Empty the buffer */
file->buffer_used = 0;
file->column = 0;
/* Read the characters */
do
{
c = cbf_read_character (file);
if (c == EOF)
return CBF_FILEREAD;
if (file->column == file->columnlimit+1) {
sprintf(buffer, "input line %u over size limit",1+file->line);
cbf_flog(file, buffer, CBF_LOGWARNING|CBF_LOGCURRENTLOC);
}
cbf_failnez (cbf_save_character (file, c))
}
while (c != '\n');
/* Copy the pointer */
if (line)
*line = file->buffer;
/* Success */
return 0;
} | true | true | false | false | false | 1 |
allocateStrings(UErrorCode &status) {
if (U_FAILURE(status)) {
return FALSE;
}
strings = new UVector(uhash_deleteUnicodeString,
uhash_compareUnicodeString, 1, status);
if (strings == NULL) { // Check for memory allocation error.
status = U_MEMORY_ALLOCATION_ERROR;
return FALSE;
}
if (U_FAILURE(status)) {
delete strings;
strings = NULL;
return FALSE;
}
return TRUE;
} | false | false | false | false | false | 0 |
object_format(PyObject *self, PyObject *args)
{
PyObject *format_spec;
PyObject *self_as_str = NULL;
PyObject *result = NULL;
Py_ssize_t format_len;
if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
return NULL;
#ifdef Py_USING_UNICODE
if (PyUnicode_Check(format_spec)) {
format_len = PyUnicode_GET_SIZE(format_spec);
self_as_str = PyObject_Unicode(self);
} else if (PyString_Check(format_spec)) {
#else
if (PyString_Check(format_spec)) {
#endif
format_len = PyString_GET_SIZE(format_spec);
self_as_str = PyObject_Str(self);
} else {
PyErr_SetString(PyExc_TypeError,
"argument to __format__ must be unicode or str");
return NULL;
}
if (self_as_str != NULL) {
/* Issue 7994: If we're converting to a string, we
should reject format specifications */
if (format_len > 0) {
if (PyErr_WarnEx(PyExc_PendingDeprecationWarning,
"object.__format__ with a non-empty format "
"string is deprecated", 1) < 0) {
goto done;
}
/* Eventually this will become an error:
PyErr_Format(PyExc_TypeError,
"non-empty format string passed to object.__format__");
goto done;
*/
}
result = PyObject_Format(self_as_str, format_spec);
}
done:
Py_XDECREF(self_as_str);
return result;
} | false | false | false | false | false | 0 |
pkix_pl_LdapResponse_GetMessage(
PKIX_PL_LdapResponse *response,
LDAPMessage **pMessage,
void *plContext)
{
PKIX_ENTER(LDAPRESPONSE, "PKIX_PL_LdapResponse_GetMessage");
PKIX_NULLCHECK_TWO(response, pMessage);
*pMessage = &response->decoded;
PKIX_RETURN(LDAPRESPONSE);
} | false | false | false | false | false | 0 |
igbvf_intr_msix_rx(int irq, void *data)
{
struct net_device *netdev = data;
struct igbvf_adapter *adapter = netdev_priv(netdev);
adapter->int_counter0++;
/* Write the ITR value calculated at the end of the
* previous interrupt.
*/
if (adapter->rx_ring->set_itr) {
writel(adapter->rx_ring->itr_val,
adapter->hw.hw_addr + adapter->rx_ring->itr_register);
adapter->rx_ring->set_itr = 0;
}
if (napi_schedule_prep(&adapter->rx_ring->napi)) {
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
__napi_schedule(&adapter->rx_ring->napi);
}
return IRQ_HANDLED;
} | false | false | false | false | false | 0 |
Resize(int& new_w, int& new_h)
{
if (dga)
return -1;
Lock();
int r = doResize(new_w, new_h);
//printf("DORESIZE %d %d %d\n", new_w, new_h, r);
Unlock();
if (r == 0)
Refresh();
return r;
} | false | false | false | false | false | 0 |
max7359_write_reg(struct i2c_client *client, u8 reg, u8 val)
{
int ret = i2c_smbus_write_byte_data(client, reg, val);
if (ret < 0)
dev_err(&client->dev, "%s: reg 0x%x, val 0x%x, err %d\n",
__func__, reg, val, ret);
return ret;
} | false | false | false | false | false | 0 |
createRoot(const char* name, GLESubArgNames* argNames) {
GLERC<GLEString> strName(new GLEString(name));
GLESubRoot* root = (GLESubRoot*)m_SubRoots->getObjectByKey(strName);
if (root != NULL) {
root->updateArgNames(argNames);
return root;
} else {
GLESubRoot* newRoot = new GLESubRoot(strName.get(), argNames);
m_SubRoots->setObjectByKey(strName, newRoot);
return newRoot;
}
} | false | false | false | false | false | 0 |
shift_32(Register dst, int subcode) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst);
emit(0xD3);
emit_modrm(subcode, dst);
} | false | false | false | false | false | 0 |
CheckTietzeFlags (
Obj * ptTietze,
Int numrels,
Obj * flags,
Obj * * ptFlags )
{
/* get and check the Tietze flags list */
*flags = ptTietze[TZ_FLAGS];
if ( *flags==0 || ! IS_PLIST(*flags) || LEN_PLIST(*flags)!=numrels ) {
ErrorQuit( "invalid Tietze flags list", 0L, 0L );
return;
}
*ptFlags = ADDR_OBJ(*flags);
} | false | false | false | false | false | 0 |
__ecereMethod___ecereNameSpace__ecere__gfx__Bitmap_MakeDD(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Instance * displaySystem)
{
struct __ecereNameSpace__ecere__gfx__Bitmap * __ecerePointer___ecereNameSpace__ecere__gfx__Bitmap = (struct __ecereNameSpace__ecere__gfx__Bitmap *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gfx__Bitmap->offset) : 0);
unsigned int result = 0x0;
if(this && displaySystem && (!__ecerePointer___ecereNameSpace__ecere__gfx__Bitmap->driver || __ecerePointer___ecereNameSpace__ecere__gfx__Bitmap->driver == __ecereClass___ecereNameSpace__ecere__gfx__drivers__LFBDisplayDriver))
{
if(((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__Instance *, unsigned int))((struct __ecereNameSpace__ecere__gfx__DisplaySystem * )(((char * )displaySystem + __ecereClass___ecereNameSpace__ecere__gfx__DisplaySystem->offset)))->driver->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__gfx__DisplayDriver_MakeDDBitmap])(displaySystem, this, 0x0))
{
__ecerePointer___ecereNameSpace__ecere__gfx__Bitmap->displaySystem = displaySystem;
__ecerePointer___ecereNameSpace__ecere__gfx__Bitmap->driver = displaySystem ? ((struct __ecereNameSpace__ecere__gfx__DisplaySystem *)(((char *)displaySystem + __ecereClass___ecereNameSpace__ecere__gfx__DisplaySystem->offset)))->driver : ((struct __ecereNameSpace__ecere__com__Class *)__ecereClass___ecereNameSpace__ecere__gfx__drivers__LFBDisplayDriver);
result = 0x1;
}
}
return result;
} | false | false | false | false | false | 0 |
cgi_initialize_cookies(void)
{
const char *cookie; /* HTTP_COOKIE environment variable */
char name[128], /* Name string */
value[512], /* Value string */
*ptr; /* Pointer into name/value */
if ((cookie = getenv("HTTP_COOKIE")) == NULL)
return;
while (*cookie)
{
/*
* Skip leading whitespace...
*/
while (isspace(*cookie & 255))
cookie ++;
if (!*cookie)
break;
/*
* Copy the name...
*/
for (ptr = name; *cookie && *cookie != '=';)
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *cookie++;
else
break;
if (*cookie != '=')
break;
*ptr = '\0';
cookie ++;
/*
* Then the value...
*/
if (*cookie == '\"')
{
for (cookie ++, ptr = value; *cookie && *cookie != '\"';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *cookie++;
else
break;
if (*cookie == '\"')
cookie ++;
}
else
{
for (ptr = value; *cookie && *cookie != ';';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *cookie++;
else
break;
}
if (*cookie == ';')
cookie ++;
else if (*cookie)
break;
*ptr = '\0';
/*
* Then add the cookie to an array as long as the name doesn't start with
* "$"...
*/
if (name[0] != '$')
num_cookies = cupsAddOption(name, value, num_cookies, &cookies);
}
} | true | true | false | false | true | 1 |
sqlite_db_collation_needed(pTHX_ SV *dbh, SV *callback)
{
D_imp_dbh(dbh);
if (!DBIc_ACTIVE(imp_dbh)) {
sqlite_error(dbh, -2, "attempt to see if collation is needed on inactive database handle");
return;
}
croak_if_db_is_null();
/* remember the callback within the dbh */
sv_setsv(imp_dbh->collation_needed_callback, callback);
/* Register the func within sqlite3 */
(void) sqlite3_collation_needed( imp_dbh->db,
(void*) (SvOK(callback) ? dbh : NULL),
sqlite_db_collation_needed_dispatcher );
} | false | false | false | false | false | 0 |
LLVMInitializeNVPTXTargetMC() {
for (Target *T : {&TheNVPTXTarget32, &TheNVPTXTarget64}) {
// Register the MC asm info.
RegisterMCAsmInfo<NVPTXMCAsmInfo> X(*T);
// Register the MC codegen info.
TargetRegistry::RegisterMCCodeGenInfo(*T, createNVPTXMCCodeGenInfo);
// Register the MC instruction info.
TargetRegistry::RegisterMCInstrInfo(*T, createNVPTXMCInstrInfo);
// Register the MC register info.
TargetRegistry::RegisterMCRegInfo(*T, createNVPTXMCRegisterInfo);
// Register the MC subtarget info.
TargetRegistry::RegisterMCSubtargetInfo(*T, createNVPTXMCSubtargetInfo);
// Register the MCInstPrinter.
TargetRegistry::RegisterMCInstPrinter(*T, createNVPTXMCInstPrinter);
}
} | false | false | false | false | false | 0 |
rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
u8 *ppowerlevel, u8 channel)
{
u32 writeval[2], powerbase0[2], powerbase1[2];
u8 index;
_rtl92d_phy_get_power_base(hw, ppowerlevel, channel,
&powerbase0[0], &powerbase1[0]);
for (index = 0; index < 6; index++) {
_rtl92d_get_txpower_writeval_by_regulatory(hw,
channel, index, &powerbase0[0],
&powerbase1[0], &writeval[0]);
_rtl92d_write_ofdm_power_reg(hw, index, &writeval[0]);
}
} | false | false | false | false | false | 0 |
build_greater_vault(struct cave *c, int y0, int x0) {
int i;
int numerator = 2;
int denominator = 3;
/* Only try to build a GV as the first room. */
if (dun->cent_n > 0) return FALSE;
/* Level 90+ has a 2/3 chance, level 80-89 has 4/9, ... */
for(i = 90; i > c->depth; i -= 10) {
numerator *= 2;
denominator *= 3;
}
/* Attempt to pass the depth check and build a GV */
if (randint0(denominator) >= numerator) return FALSE;
return build_vault_type(c, y0, x0, 8, "Greater vault");
} | false | false | false | false | false | 0 |
mp_weight_handler(vector strvec)
{
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable);
char * buff;
if (!mpe)
return 1;
buff = set_value(strvec);
if (!buff)
return 1;
if (strlen(buff) == 10 &&
!strcmp(buff, "priorities"))
mpe->rr_weight = RR_WEIGHT_PRIO;
FREE(buff);
return 0;
} | false | false | false | false | false | 0 |
cq_initialize(cqueue_t *cq, const char *name, cq_time_t now, int period)
{
/*
* The cq_hash hash list is used to speed up insert/delete operations.
*/
cq->cq_magic = CQUEUE_MAGIC;
cq->cq_name = atom_str_get(name);
XMALLOC0_ARRAY(cq->cq_hash, HASH_SIZE);
cq->cq_items = 0;
cq->cq_ticks = 0;
cq->cq_time = now;
cq->cq_last_bucket = EV_HASH(now);
cq->cq_current = NULL;
cq->cq_period = period;
mutex_init(&cq->cq_lock);
mutex_init(&cq->cq_idle_lock);
cqueue_check(cq);
return cq;
} | false | false | false | false | false | 0 |
brasero_app_indicator_init (BraseroAppIndicator *obj)
{
GtkWidget *indicator_menu;
obj->priv = g_new0 (BraseroAppIndicatorPrivate, 1);
indicator_menu = brasero_app_indicator_build_menu (obj);
if (indicator_menu != NULL) {
obj->priv->indicator = app_indicator_new_with_path ("brasero",
"brasero-disc-00",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS,
BRASERO_DATADIR "/icons");
app_indicator_set_status (obj->priv->indicator,
APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_menu (obj->priv->indicator, GTK_MENU (indicator_menu));
}
} | false | false | false | false | false | 0 |
on_select_all(GtkAction* act, FmFolderView* fv)
{
GtkMenu *popup = g_object_get_qdata(G_OBJECT(fv), popup_quark);
GtkWidget *win = gtk_menu_get_attach_widget(popup);
GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(win));
/* check if we are inside the view; for desktop focus will be NULL */
if(FOCUS_IS_IN_FOLDER_VIEW(focus, GTK_WIDGET(fv)))
fm_folder_view_select_all(fv);
else if(GTK_IS_EDITABLE(focus)) /* fallback for editables */
gtk_editable_select_region((GtkEditable*)focus, 0, -1);
} | false | false | false | false | false | 0 |
rp2_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
struct rp2_card *card;
struct rp2_uart_port *ports;
void __iomem * const *bars;
int rc;
card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
pci_set_drvdata(pdev, card);
spin_lock_init(&card->card_lock);
init_completion(&card->fw_loaded);
rc = pcim_enable_device(pdev);
if (rc)
return rc;
rc = pcim_iomap_regions_request_all(pdev, 0x03, DRV_NAME);
if (rc)
return rc;
bars = pcim_iomap_table(pdev);
card->bar0 = bars[0];
card->bar1 = bars[1];
card->pdev = pdev;
rp2_decode_cap(id, &card->n_ports, &card->smpte);
dev_info(&pdev->dev, "found new card with %d ports\n", card->n_ports);
card->minor_start = rp2_alloc_ports(card->n_ports);
if (card->minor_start < 0) {
dev_err(&pdev->dev,
"too many ports (try increasing CONFIG_SERIAL_RP2_NR_UARTS)\n");
return -EINVAL;
}
rp2_init_card(card);
ports = devm_kzalloc(&pdev->dev, sizeof(*ports) * card->n_ports,
GFP_KERNEL);
if (!ports)
return -ENOMEM;
card->ports = ports;
rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt,
IRQF_SHARED, DRV_NAME, card);
if (rc)
return rc;
/*
* Only catastrophic errors (e.g. ENOMEM) are reported here.
* If the FW image is missing, we'll find out in rp2_fw_cb()
* and print an error message.
*/
rc = request_firmware_nowait(THIS_MODULE, 1, RP2_FW_NAME, &pdev->dev,
GFP_KERNEL, card, rp2_fw_cb);
if (rc)
return rc;
dev_dbg(&pdev->dev, "waiting for firmware blob...\n");
return 0;
} | false | false | false | false | false | 0 |
changing_fdlimit(va_list args)
{
int old_fdlimit = hard_fdlimit;
hard_fdlimit = va_arg(args, int);
if (ServerInfo.max_clients > MAXCLIENTS_MAX)
{
if (old_fdlimit != 0)
sendto_realops_flags(UMODE_ALL, L_ALL,
"HARD_FDLIMIT changed to %d, adjusting MAXCLIENTS to %d",
hard_fdlimit, MAXCLIENTS_MAX);
ServerInfo.max_clients = MAXCLIENTS_MAX;
}
return NULL;
} | false | false | false | false | false | 0 |
match_finalize (Match* obj) {
Match * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MATCH, Match);
_tile_unref0 (self->tile0);
_tile_unref0 (self->tile1);
} | false | false | false | false | false | 0 |
transform(double *in, double *out) {
int i;
PostScriptFunctionKey key(m, in, false);
PopplerCacheItem *item = cache->lookup(key);
if (item) {
PostScriptFunctionItem *it = static_cast<PostScriptFunctionItem *>(item);
for (int i = 0; i < n; ++i) {
out[i] = it->out[i];
}
return;
}
stack->clear();
for (i = 0; i < m; ++i) {
//~ may need to check for integers here
stack->pushReal(in[i]);
}
exec(stack, 0);
for (i = n - 1; i >= 0; --i) {
out[i] = stack->popNum();
if (out[i] < range[i][0]) {
out[i] = range[i][0];
} else if (out[i] > range[i][1]) {
out[i] = range[i][1];
}
}
PostScriptFunctionKey *newKey = new PostScriptFunctionKey(m, in, true);
PostScriptFunctionItem *newItem = new PostScriptFunctionItem(n, out);
cache->put(newKey, newItem);
// if (!stack->empty()) {
// error(-1, "Extra values on stack at end of PostScript function");
// }
} | false | false | false | false | false | 0 |
cert_get_hash(const ne_ssl_certificate* cert, guint32* out_hash) {
char* certPem = ne_ssl_cert_export(cert);
g_return_val_if_fail(certPem != NULL, 1);
gsize derLength = 0;
guchar* certDer = g_base64_decode(certPem, &derLength);
free(certPem);
g_return_val_if_fail(certDer != NULL, 1);
struct DerData data = {
.start = certDer,
.bufferEnd = (certDer + derLength)
};
struct DerData content;
// Walk through certificate content until we reach subject field.
// certificate
g_return_val_if_fail(der_read_content(&data, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// tbsCertificate
g_return_val_if_fail(der_read_content(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// version + serialNumber
g_return_val_if_fail(der_read_content(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_INTEGER == content.type, FALSE);
// signature
g_return_val_if_fail(der_read_next(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// issuer
g_return_val_if_fail(der_read_next(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// validity
g_return_val_if_fail(der_read_next(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// subject
g_return_val_if_fail(der_read_next(&content, &content), FALSE);
g_return_val_if_fail(ASNTYPE_SEQUENCE == content.type, FALSE);
// Calculate MD5 sum of subject.
unsigned char md5pword[16];
gsize md5len = 16;
GChecksum * state = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (state, content.start, content.nextStart - content.start);
g_checksum_get_digest (state, md5pword, & md5len);
g_checksum_free (state);
guint32 hash = 0;
gint i = 0;
// Hash is reverse of four first bytes of MD5 checksum of DER encoded
// subject ASN.1 field.
for (i = HASH_BYTES - 1; i >= 0; i--) {
hash <<= OCTET_BITS;
hash |= md5pword[i];
}
*out_hash = hash;
g_free(certDer);
return TRUE;
} | false | false | false | false | false | 0 |
WriteDataChunks(ArchiveHandle *AH)
{
TocEntry *te;
StartDataPtr startPtr;
EndDataPtr endPtr;
for (te = AH->toc->next; te != AH->toc; te = te->next)
{
if (te->dataDumper != NULL)
{
AH->currToc = te;
/* printf("Writing data for %d (%x)\n", te->id, te); */
if (strcmp(te->desc, "BLOBS") == 0)
{
startPtr = AH->StartBlobsPtr;
endPtr = AH->EndBlobsPtr;
}
else
{
startPtr = AH->StartDataPtr;
endPtr = AH->EndDataPtr;
}
if (startPtr != NULL)
(*startPtr) (AH, te);
/*
* printf("Dumper arg for %d is %x\n", te->id, te->dataDumperArg);
*/
/*
* The user-provided DataDumper routine needs to call
* AH->WriteData
*/
(*te->dataDumper) ((Archive *) AH, te->dataDumperArg);
if (endPtr != NULL)
(*endPtr) (AH, te);
AH->currToc = NULL;
}
}
} | false | false | false | false | false | 0 |
calc_arrow (PanelOrientation orientation,
int button_width,
int button_height,
int *x,
int *y,
gdouble *angle,
gdouble *size)
{
GtkArrowType retval = GTK_ARROW_UP;
double scale;
scale = (orientation & PANEL_HORIZONTAL_MASK ? button_height : button_width) / 48.0;
*size = 12 * scale;
*angle = 0;
switch (orientation) {
case PANEL_ORIENTATION_TOP:
*x = scale * 3;
*y = scale * (48 - 13);
*angle = G_PI;
retval = GTK_ARROW_DOWN;
break;
case PANEL_ORIENTATION_BOTTOM:
*x = scale * (48 - 13);
*y = scale * 1;
*angle = 0;
retval = GTK_ARROW_UP;
break;
case PANEL_ORIENTATION_LEFT:
*x = scale * (48 - 13);
*y = scale * 3;
*angle = G_PI / 2;
retval = GTK_ARROW_RIGHT;
break;
case PANEL_ORIENTATION_RIGHT:
*x = scale * 1;
*y = scale * 3;
*angle = 3 * (G_PI / 2);
retval = GTK_ARROW_LEFT;
break;
}
return retval;
} | false | false | false | false | false | 0 |
doartic()
{
if (isdigit(token[fieldx])) {
artic = (int) scanint();
if (token[fieldx])
fferror("Only digits were expected here");
} else fferror("No digits after /");
} | false | false | false | false | false | 0 |
check_nan_inf_mpq (void)
{
mpfr_t mpfr_value, mpfr_cmp;
mpq_t mpq_value;
int status;
mpfr_init2 (mpfr_value, MPFR_PREC_MIN);
mpq_init (mpq_value);
mpq_set_si (mpq_value, 0, 0);
mpz_set_si (mpq_denref (mpq_value), 0);
status = mpfr_set_q (mpfr_value, mpq_value, MPFR_RNDN);
if ((status != 0) || (!MPFR_IS_NAN (mpfr_value)))
{
mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN);
mpfr_set_nan (mpfr_cmp);
printf ("mpfr_set_q with a NAN mpq value returned a wrong value :\n"
" waiting for ");
mpfr_print_binary (mpfr_cmp);
printf (" got ");
mpfr_print_binary (mpfr_value);
printf ("\n trinary value is %d\n", status);
exit (1);
}
mpq_set_si (mpq_value, -1, 0);
mpz_set_si (mpq_denref (mpq_value), 0);
status = mpfr_set_q (mpfr_value, mpq_value, MPFR_RNDN);
if ((status != 0) || (!MPFR_IS_INF (mpfr_value)) ||
(MPFR_SIGN(mpfr_value) != mpq_sgn(mpq_value)))
{
mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN);
mpfr_set_inf (mpfr_cmp, -1);
printf ("mpfr_set_q with a -INF mpq value returned a wrong value :\n"
" waiting for ");
mpfr_print_binary (mpfr_cmp);
printf (" got ");
mpfr_print_binary (mpfr_value);
printf ("\n trinary value is %d\n", status);
exit (1);
}
mpq_clear (mpq_value);
mpfr_clear (mpfr_value);
} | false | false | false | false | false | 0 |
_scsih_fw_event_del_from_list(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work
*fw_event)
{
unsigned long flags;
spin_lock_irqsave(&ioc->fw_event_lock, flags);
if (!list_empty(&fw_event->list)) {
list_del_init(&fw_event->list);
fw_event_work_put(fw_event);
}
spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
} | false | false | false | false | false | 0 |
banwd(const char *word)
{
int row, cnt;
const char *cp;
int Pwidth = in_params.pi_width > 10? in_params.pi_width: 80;
for (row = 0; row < 16; row++) {
for (cp = word, cnt = 8; *cp && cnt < Pwidth; cp++, cnt += 8)
banch(*cp, row);
lcnt++;
(*pfunc)('\n');
}
} | false | false | false | false | false | 0 |
handler_msn_usr (u_char *raw, int length, ip_address source,
u_short source_port, ip_address destination, u_short destination_port)
{
int rc, nt;
log_debug (4, "Entry into handler_msn_usr");
rc= get_new_line_malloc (&next_line, raw, length);
if (rc<0)
return rc;
nt= get_tokens (next_line, &line_tokens, 0); /* Split in all tokens */
if (nt == 5)
{
if (strcmp ((char *) line_tokens[2], "TWN")==0)
{
if (strcmp ((char *) line_tokens[3],"I")==0)
{
log_event (line_tokens[4],"trying to log in");
struct msn_connection *conn = get_or_create_msn_connection (&source,source_port,&destination,destination_port,
create_yes);
set_owner (conn, line_tokens[4]);
conn->conn_type=type_notification_server;
set_as_server(conn,&destination,destination_port);
}
if (strcmp ((char *) line_tokens[3], "S")==0)
{
/* We only process this for notification purposes, but it's not really useful
since there's no information we need here */
struct msn_connection *conn = get_or_create_msn_connection (&source,source_port,&destination,destination_port,
create_no);
u_char *nick=NULL;
if (conn!=NULL)
{
nick=conn->owner;
conn->conn_type=type_notification_server;
}
log_event (nick, "Notification server authentificating user");
}
}
if (strcmp ((char *) line_tokens[2], "OK")==0)
{
// User successfully logged into a SB
struct msn_connection *conn = get_or_create_msn_connection (&source,source_port,&destination,destination_port,
create_yes);
set_owner (conn, line_tokens[3]);
conn->conn_type=type_notification_server;
set_as_server(conn,&source,source_port);
log_event (line_tokens[3], "entered switchboard at %d.%d.%d.%d:%d",
source.byte1,source.byte2,source.byte3,source.byte4,
source_port);
}
}
else if (nt == 4)
{
log_event (line_tokens[2],"attempting to enter switchboard at %d.%d.%d.%d:%d",
destination.byte1,destination.byte2,destination.byte3,destination.byte4,
destination_port);
}
else if (nt == 6 || nt == 7) /* No idea why sometimes it's 7 */
{
if (strcmp ((char *) line_tokens[2], "OK")==0)
{
log_event (line_tokens[3],"successfully authentificated");
struct msn_connection *conn = get_or_create_msn_connection (&source,source_port,&destination,destination_port,
create_yes);
set_owner (conn, line_tokens[3]);
conn->conn_type=type_notification_server;
set_as_server(conn,&source,source_port);
}
}
else
{
log_debug (0, "Unable to parse USR correcty");
log_debug (0, "Line read: %s", next_line);
dump_tokens (line_tokens);
return NOT_MSN;
}
return rc;
} | false | false | false | false | false | 0 |
calc_equal_probs(void)
{
FILEDESC *fiddlylist;
Num_files = Num_kids = 0;
fiddlylist = File_list;
while (fiddlylist != NULL)
{
Num_files++;
Num_kids += fiddlylist->num_children;
fiddlylist = fiddlylist->next;
}
} | false | false | false | false | false | 0 |
Add(TreeMap *tree, void *Data,void *ExtraArgs)
{
struct Node *p;
CompareInfo cInfo;
cInfo.ExtraArgs = ExtraArgs;
cInfo.ContainerLeft = tree;
p = iHeap.NewObject(tree->Heap);
if (p) {
memcpy(p->data ,Data,tree->ElementSize);
}
else {
iError.RaiseError("TreeMap.Add",CONTAINER_ERROR_NOMEMORY);
return CONTAINER_ERROR_NOMEMORY;
}
tree->aux = &cInfo;
insert(tree, p, ExtraArgs);
tree->aux = NULL;
return 1;
} | false | true | false | false | false | 1 |
print_80000001_ebx_amd(unsigned int value,
unsigned int val_1_eax)
{
if (__F(val_1_eax) == _XF(0) + _F(15)
&& __M(val_1_eax) < _XM(4) + _M(0)) {
static named_item names[]
= { { "raw" , 0, 31, NIL_IMAGES },
{ "BrandId" , 0, 16, NIL_IMAGES },
{ "BrandTableIndex" , 6, 12, NIL_IMAGES },
{ "NN" , 0, 6, NIL_IMAGES },
};
printf(" extended brand id (0x80000001/ebx):\n");
print_names(value, names, LENGTH(names, named_item),
/* max_len => */ 0);
} else if (__F(val_1_eax) == _XF(0) + _F(15)
&& __M(val_1_eax) >= _XM(4) + _M(0)) {
static named_item names[]
= { { "raw" , 0, 31, NIL_IMAGES },
{ "BrandId" , 0, 16, NIL_IMAGES },
{ "PwrLmt:high" , 6, 8, NIL_IMAGES },
{ "PwrLmt:low" , 14, 14, NIL_IMAGES },
{ "BrandTableIndex" , 9, 13, NIL_IMAGES },
{ "NN:high" , 15, 15, NIL_IMAGES },
{ "NN:low" , 0, 5, NIL_IMAGES },
};
printf(" extended brand id (0x80000001/ebx):\n");
print_names(value, names, LENGTH(names, named_item),
/* max_len => */ 0);
} else if (__F(val_1_eax) == _XF(1) + _F(15)
|| __F(val_1_eax) == _XF(2) + _F(15)) {
static named_item names[]
= { { "raw" , 0, 31, NIL_IMAGES },
{ "BrandId" , 0, 15, NIL_IMAGES },
{ "str1" , 11, 14, NIL_IMAGES },
{ "str2" , 0, 3, NIL_IMAGES },
{ "PartialModel" , 4, 10, NIL_IMAGES },
{ "PG" , 15, 15, NIL_IMAGES },
{ "PkgType" , 28, 31, NIL_IMAGES },
};
printf(" extended brand id (0x80000001/ebx):\n");
print_names(value, names, LENGTH(names, named_item),
/* max_len => */ 0);
} else {
static named_item names[]
= { { "raw" , 0, 31, NIL_IMAGES },
{ "BrandId" , 0, 15, NIL_IMAGES },
};
printf(" extended brand id (0x80000001/ebx):\n");
print_names(value, names, LENGTH(names, named_item),
/* max_len => */ 0);
}
} | false | false | false | false | false | 0 |
gnc_warning_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
{
GtkWidget *dialog = NULL;
gchar *buffer;
if (parent == NULL)
parent = GTK_WIDGET(gnc_ui_get_toplevel());
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CLOSE,
"%s",
buffer);
g_free(buffer);
if (parent == NULL)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
} | false | false | false | false | false | 0 |
printinter (apInter)
struct lInter_s *apInter;
{
struct eInter_s *pInter;
fflush (stderr);
fprintf (stdout, " o Interval set : (min = %ld, max = %ld, len = %ld)\n",
apInter->min,
apInter->max,
apInter->len);
fflush (stdout);
for (pInter = apInter->l; pInter != NULL; pInter = pInter->next) {
fprintf (stdout, " [%6ld,%6ld]\n", pInter->min, pInter->max);
fflush (stdout);
}
} | false | false | false | false | false | 0 |
FindSelectorAndURoR(Instruction *Inst, bool &URoRInvoke,
SmallPtrSet<IntrinsicInst*, 8> &SelCalls,
SmallPtrSet<PHINode*, 32> &SeenPHIs) {
bool Changed = false;
for (Value::use_iterator
I = Inst->use_begin(), E = Inst->use_end(); I != E; ++I) {
Instruction *II = dyn_cast<Instruction>(*I);
if (!II || II->getParent()->getParent() != F) continue;
if (IntrinsicInst *Sel = dyn_cast<IntrinsicInst>(II)) {
if (Sel->getIntrinsicID() == Intrinsic::eh_selector)
SelCalls.insert(Sel);
} else if (InvokeInst *Invoke = dyn_cast<InvokeInst>(II)) {
if (Invoke->getCalledFunction() == URoR)
URoRInvoke = true;
} else if (CastInst *CI = dyn_cast<CastInst>(II)) {
Changed |= FindSelectorAndURoR(CI, URoRInvoke, SelCalls, SeenPHIs);
} else if (PHINode *PN = dyn_cast<PHINode>(II)) {
if (SeenPHIs.insert(PN))
// Don't process a PHI node more than once.
Changed |= FindSelectorAndURoR(PN, URoRInvoke, SelCalls, SeenPHIs);
}
}
return Changed;
} | false | false | false | false | false | 0 |
ExpectedDataType(char *lvalname)
{ int i,j,k;
struct BodySyntax *bs;
struct SubTypeSyntax *ss;
for (i = 0; i < CF3_MODULES; i++)
{
if ((ss = CF_ALL_SUBTYPES[i]) == NULL)
{
continue;
}
for (j = 0; ss[j].subtype != NULL; j++)
{
if ((bs = ss[j].bs) == NULL)
{
continue;
}
for (k = 0; bs[k].range != NULL; k++)
{
if (strcmp(lvalname,bs[k].lval) == 0)
{
return bs[k].dtype;
}
}
}
}
return cf_notype;
} | false | false | false | false | false | 0 |
CreateVertex(const R3Point& position, R3MeshVertex *v)
{
// Create vertex
if (!v) {
v = new R3MeshVertex();
v->flags.Add(R3_MESH_VERTEX_ALLOCATED);
}
// Set position of new vertex
SetVertexPosition(v, position);
// Set ID of new vertex
v->id = vertices.NEntries();
// Insert vertex into array
vertices.Insert(v);
// Return vertex
return v;
} | false | false | false | false | false | 0 |
getChar() {
if (length >= 0 && count >= length)
return EOF;
++count;
return str->getChar();
} | false | false | false | false | false | 0 |
sec_PKCS12NewCertBag(PLArenaPool *arena, SECOidTag certType)
{
sec_PKCS12CertBag *certBag = NULL;
SECOidData *bagType = NULL;
SECStatus rv;
void *mark = NULL;
if(!arena) {
return NULL;
}
mark = PORT_ArenaMark(arena);
certBag = (sec_PKCS12CertBag *)PORT_ArenaZAlloc(arena,
sizeof(sec_PKCS12CertBag));
if(!certBag) {
PORT_ArenaRelease(arena, mark);
PORT_SetError(SEC_ERROR_NO_MEMORY);
return NULL;
}
bagType = SECOID_FindOIDByTag(certType);
if(!bagType) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
goto loser;
}
rv = SECITEM_CopyItem(arena, &certBag->bagID, &bagType->oid);
if(rv != SECSuccess) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
goto loser;
}
PORT_ArenaUnmark(arena, mark);
return certBag;
loser:
PORT_ArenaRelease(arena, mark);
return NULL;
} | false | false | false | false | false | 0 |
rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
int procnum, size_t payload, uint64_t xid,
struct iovec *recbuf)
{
struct rpc_msg request = {0, };
struct iobuf *request_iob = NULL;
char *record = NULL;
struct iovec recordhdr = {0, };
size_t pagesize = 0;
int ret = -1;
if ((!rpc) || (!recbuf)) {
goto out;
}
/* First, try to get a pointer into the buffer which the RPC
* layer can use.
*/
request_iob = iobuf_get (rpc->ctx->iobuf_pool);
if (!request_iob) {
goto out;
}
pagesize = iobuf_pagesize (request_iob);
record = iobuf_ptr (request_iob); /* Now we have it. */
/* Fill the rpc structure and XDR it into the buffer got above. */
ret = rpcsvc_fill_callback (prognum, progver, procnum, payload, xid,
&request);
if (ret == -1) {
gf_log ("rpcsvc", GF_LOG_WARNING, "cannot build a rpc-request "
"xid (%"PRIu64")", xid);
goto out;
}
recordhdr = rpcsvc_callback_build_header (record, pagesize, &request,
payload);
if (!recordhdr.iov_base) {
gf_log ("rpc-clnt", GF_LOG_ERROR, "Failed to build record "
" header");
iobuf_unref (request_iob);
request_iob = NULL;
recbuf->iov_base = NULL;
goto out;
}
recbuf->iov_base = recordhdr.iov_base;
recbuf->iov_len = recordhdr.iov_len;
out:
return request_iob;
} | false | false | false | false | false | 0 |
hasPnpInfoService(const std::vector<std::string> &uuids)
{
// The UUID that indicates the PnPInformation attribute is available.
static const char * PNPINFOMATION_ATTRIBUTE_UUID = "00001200-0000-1000-8000-00805f9b34fb";
// Note: GetProperties appears to return this list sorted which binary_search requires.
if(std::binary_search(uuids.begin(), uuids.end(), PNPINFOMATION_ATTRIBUTE_UUID)) {
return true;
}
return false;
} | false | false | false | false | false | 0 |
lx_stream_set_format(struct lx6464es *chip, struct snd_pcm_runtime *runtime,
u32 pipe, int is_capture)
{
int err;
u32 pipe_cmd = PIPE_INFO_TO_CMD(is_capture, pipe);
u32 channels = runtime->channels;
if (runtime->channels != channels)
dev_err(chip->card->dev, "channel count mismatch: %d vs %d",
runtime->channels, channels);
mutex_lock(&chip->msg_lock);
lx_message_init(&chip->rmh, CMD_0C_DEF_STREAM);
chip->rmh.cmd[0] |= pipe_cmd;
if (runtime->sample_bits == 16)
/* 16 bit format */
chip->rmh.cmd[0] |= (STREAM_FMT_16b << STREAM_FMT_OFFSET);
if (snd_pcm_format_little_endian(runtime->format))
/* little endian/intel format */
chip->rmh.cmd[0] |= (STREAM_FMT_intel << STREAM_FMT_OFFSET);
chip->rmh.cmd[0] |= channels-1;
err = lx_message_send_atomic(chip, &chip->rmh);
mutex_unlock(&chip->msg_lock);
return err;
} | false | false | false | false | false | 0 |
act1()
{
NLA = Eof;
/* L o o k F o r A n o t h e r F i l e */
{
FILE *new_input;
new_input = NextFile();
if ( new_input == NULL ) { NLA=Eof; return; }
fclose( input );
input = new_input;
zzrdstream( input );
zzskip(); /* Skip the Eof (@) char i.e continue */
}
} | false | false | false | false | false | 0 |
debug_attributes(const char *title, /* I - Title */
ipp_t *ipp, /* I - Request/response */
int type) /* I - 0 = object, 1 = request, 2 = response */
{
ipp_tag_t group_tag; /* Current group */
ipp_attribute_t *attr; /* Current attribute */
char buffer[2048]; /* String buffer for value */
int major, minor; /* Version */
if (Verbosity <= 1)
return;
fprintf(stderr, "%s:\n", title);
major = ippGetVersion(ipp, &minor);
fprintf(stderr, " version=%d.%d\n", major, minor);
if (type == 1)
fprintf(stderr, " operation-id=%s(%04x)\n",
ippOpString(ippGetOperation(ipp)), ippGetOperation(ipp));
else if (type == 2)
fprintf(stderr, " status-code=%s(%04x)\n",
ippErrorString(ippGetStatusCode(ipp)), ippGetStatusCode(ipp));
fprintf(stderr, " request-id=%d\n\n", ippGetRequestId(ipp));
for (attr = ippFirstAttribute(ipp), group_tag = IPP_TAG_ZERO;
attr;
attr = ippNextAttribute(ipp))
{
if (ippGetGroupTag(attr) != group_tag)
{
group_tag = ippGetGroupTag(attr);
fprintf(stderr, " %s\n", ippTagString(group_tag));
}
if (ippGetName(attr))
{
ippAttributeString(attr, buffer, sizeof(buffer));
fprintf(stderr, " %s (%s%s) %s\n", ippGetName(attr),
ippGetCount(attr) > 1 ? "1setOf " : "",
ippTagString(ippGetValueTag(attr)), buffer);
}
}
} | false | false | false | false | false | 0 |
UpdateFile ( bool doSafeUpdate )
{
bool updated = false;
if ( ! this->needsUpdate ) return;
LFA_FileRef fileRef ( this->parent->fileRef );
if ( fileRef == 0 ) return;
ASF_Support support;
ASF_Support::ObjectState objectState;
long numTags = support.OpenASF ( fileRef, objectState );
if ( numTags == 0 ) return;
XMP_StringLen packetLen = (XMP_StringLen)xmpPacket.size();
this->legacyManager.ExportLegacy ( this->xmpObj );
if ( this->legacyManager.hasLegacyChanged() ) {
this->legacyManager.SetDigest ( &this->xmpObj );
// serialize with updated digest
if ( objectState.xmpLen == 0 ) {
// XMP does not exist, use standard padding
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, kXMP_UseCompactFormat );
} else {
// re-use padding with static XMP size
try {
XMP_OptionBits compactExact = (kXMP_UseCompactFormat | kXMP_ExactPacketLength);
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, compactExact, XMP_StringLen(objectState.xmpLen) );
} catch ( ... ) {
// re-use padding with exact packet length failed (legacy-digest needed too much space): try again using standard padding
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, kXMP_UseCompactFormat );
}
}
}
XMP_StringPtr packetStr = xmpPacket.c_str();
packetLen = (XMP_StringLen)xmpPacket.size();
if ( packetLen == 0 ) return;
// value, when guessing for sufficient legacy padding (line-ending conversion etc.)
const int paddingTolerance = 50;
bool xmpGrows = ( objectState.xmpLen && (packetLen > objectState.xmpLen) && ( ! objectState.xmpIsLastObject) );
bool legacyGrows = ( this->legacyManager.hasLegacyChanged() &&
(this->legacyManager.getLegacyDiff() > (this->legacyManager.GetPadding() - paddingTolerance)) );
if ( doSafeUpdate || legacyGrows || xmpGrows ) {
// do a safe update in any case
updated = SafeWriteFile();
} else {
// possibly we can do an in-place update
if ( objectState.xmpLen < packetLen ) {
updated = SafeWriteFile();
} else {
// current XMP chunk size is sufficient -> write (in place update)
updated = ASF_Support::WriteBuffer(fileRef, objectState.xmpPos, packetLen, packetStr );
// legacy update
if ( updated && this->legacyManager.hasLegacyChanged() ) {
ASF_Support::ObjectIterator curPos = objectState.objects.begin();
ASF_Support::ObjectIterator endPos = objectState.objects.end();
for ( ; curPos != endPos; ++curPos ) {
ASF_Support::ObjectData object = *curPos;
// find header-object
if ( IsEqualGUID ( ASF_Header_Object, object.guid ) ) {
// update header object
updated = support.UpdateHeaderObject ( fileRef, object, legacyManager );
}
}
}
}
}
if ( ! updated ) return; // If there's an error writing the chunk, bail.
this->needsUpdate = false;
} | false | false | false | false | false | 0 |
cdv_intel_edp_panel_on(struct gma_encoder *intel_encoder)
{
struct drm_device *dev = intel_encoder->base.dev;
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
u32 pp, idle_on_mask = PP_ON | PP_SEQUENCE_NONE;
if (intel_dp->panel_on)
return true;
DRM_DEBUG_KMS("\n");
pp = REG_READ(PP_CONTROL);
pp &= ~PANEL_UNLOCK_MASK;
pp |= (PANEL_UNLOCK_REGS | POWER_TARGET_ON);
REG_WRITE(PP_CONTROL, pp);
REG_READ(PP_CONTROL);
if (wait_for(((REG_READ(PP_STATUS) & idle_on_mask) == idle_on_mask), 1000)) {
DRM_DEBUG_KMS("Error in Powering up eDP panel, status %x\n", REG_READ(PP_STATUS));
intel_dp->panel_on = false;
} else
intel_dp->panel_on = true;
msleep(intel_dp->panel_power_up_delay);
return false;
} | false | false | false | false | false | 0 |
add_handlers()
{
add_read_handler("count", read_handler, 0);
add_write_handler("reset_counts", write_handler, 0);
if (input_is_pull(0))
add_task_handlers(&_task);
} | false | false | false | false | false | 0 |
__glfs_cwd_set (struct glfs *fs, inode_t *inode)
{
if (inode->table->xl != fs->active_subvol) {
inode = __glfs_refresh_inode (fs, fs->active_subvol, inode);
if (!inode)
return -1;
} else {
inode_ref (inode);
}
if (fs->cwd)
inode_unref (fs->cwd);
fs->cwd = inode;
return 0;
} | false | false | false | false | false | 0 |
clutter_im_context_filter_keypress (ClutterIMContext *context,
ClutterKeyEvent *key)
{
ClutterIMContextClass *klass;
STEP();
g_return_val_if_fail (CLUTTER_IS_IM_CONTEXT (context), FALSE);
g_return_val_if_fail (key != NULL, FALSE);
klass = CLUTTER_IM_CONTEXT_GET_CLASS (context);
return klass->filter_keypress (context, key);
} | false | false | false | true | false | 1 |
gst_rtsp_message_take_header (GstRTSPMessage * msg, GstRTSPHeaderField field,
gchar * value)
{
RTSPKeyValue key_value;
g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
g_return_val_if_fail (value != NULL, GST_RTSP_EINVAL);
key_value.field = field;
key_value.value = value;
g_array_append_val (msg->hdr_fields, key_value);
return GST_RTSP_OK;
} | false | false | false | false | false | 0 |
ByteCount() const {
if (stream_count_ == 0) {
return bytes_retired_;
} else {
return bytes_retired_ + streams_[0]->ByteCount();
}
} | false | false | false | false | false | 0 |
verify_format(const char *format)
{
const char *cp, *sp;
for (cp = format; *cp && (sp = find_next(cp)); ) {
const char *ep = strchr(sp, ')');
if (!ep)
die("malformatted format string %s", sp);
/* sp points at "%(" and ep points at the closing ")" */
parse_atom(sp + 2, ep);
cp = ep + 1;
}
} | false | false | false | false | false | 0 |
cxd2820r_sleep_t2(struct dvb_frontend *fe)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret, i;
struct reg_val_mask tab[] = {
{ 0x000ff, 0x1f, 0xff },
{ 0x00085, 0x00, 0xff },
{ 0x00088, 0x01, 0xff },
{ 0x02069, 0x00, 0xff },
{ 0x00081, 0x00, 0xff },
{ 0x00080, 0x00, 0xff },
};
dev_dbg(&priv->i2c->dev, "%s\n", __func__);
for (i = 0; i < ARRAY_SIZE(tab); i++) {
ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, tab[i].val,
tab[i].mask);
if (ret)
goto error;
}
priv->delivery_system = SYS_UNDEFINED;
return ret;
error:
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
} | false | false | false | false | false | 0 |
endElementSSCbk(const char *pszName)
{
if (bStopParsing) return;
nWithoutEventCounter = 0;
nDepth--;
switch(stateStack[nStackDepth].eVal)
{
case STATE_DEFAULT: break;
case STATE_T:
{
if (stateStack[nStackDepth].nBeginDepth == nDepth)
{
apoSharedStrings.push_back(osCurrentString);
}
break;
}
default: break;
}
if (stateStack[nStackDepth].nBeginDepth == nDepth)
nStackDepth --;
} | false | false | false | false | false | 0 |
DecodeVSHLMaxInstruction(MCInst &Inst, unsigned Insn,
uint64_t Address, const void *Decoder) {
DecodeStatus S = MCDisassembler::Success;
unsigned Rd = fieldFromInstruction(Insn, 12, 4);
Rd |= fieldFromInstruction(Insn, 22, 1) << 4;
unsigned Rm = fieldFromInstruction(Insn, 0, 4);
Rm |= fieldFromInstruction(Insn, 5, 1) << 4;
unsigned size = fieldFromInstruction(Insn, 18, 2);
if (!Check(S, DecodeQPRRegisterClass(Inst, Rd, Address, Decoder)))
return MCDisassembler::Fail;
if (!Check(S, DecodeDPRRegisterClass(Inst, Rm, Address, Decoder)))
return MCDisassembler::Fail;
Inst.addOperand(MCOperand::createImm(8 << size));
return S;
} | false | false | false | false | false | 0 |
dirserv_have_any_microdesc(const smartlist_t *fps)
{
microdesc_cache_t *cache = get_microdesc_cache();
SMARTLIST_FOREACH(fps, const char *, fp,
if (microdesc_cache_lookup_by_digest256(cache, fp))
return 1);
return 0;
} | false | false | false | false | false | 0 |
linkcopy_internal (GFile *src,
GFile *dest,
GFileCopyFlags flags,
gboolean sync_data,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gboolean dest_exists;
int i;
gboolean enable_guestfs_fuse_workaround;
struct stat src_stat;
struct stat dest_stat;
GFile *dest_parent = NULL;
flags |= G_FILE_COPY_NOFOLLOW_SYMLINKS;
g_return_val_if_fail ((flags & (G_FILE_COPY_BACKUP | G_FILE_COPY_TARGET_DEFAULT_PERMS)) == 0, FALSE);
dest_parent = g_file_get_parent (dest);
if (lstat (gs_file_get_path_cached (src), &src_stat) == -1)
{
int errsv = errno;
g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno),
g_strerror (errsv));
goto out;
}
if (lstat (gs_file_get_path_cached (dest), &dest_stat) == -1)
dest_exists = FALSE;
else
dest_exists = TRUE;
if (((flags & G_FILE_COPY_OVERWRITE) == 0) && dest_exists)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
"File exists");
goto out;
}
/* Work around the behavior of link() where it's a no-op if src and
* dest are the same.
*/
if (dest_exists &&
src_stat.st_dev == dest_stat.st_dev &&
src_stat.st_ino == dest_stat.st_ino)
{
ret = TRUE;
goto out;
}
enable_guestfs_fuse_workaround = getenv ("LIBGSYSTEM_ENABLE_GUESTFS_FUSE_WORKAROUND") != NULL;
/* 128 attempts seems reasonable... */
for (i = 0; i < 128; i++)
{
gboolean tryagain = FALSE;
if (!linkcopy_internal_attempt (src, dest, dest_parent,
flags, sync_data,
enable_guestfs_fuse_workaround,
&tryagain,
cancellable, error))
goto out;
if (!tryagain)
break;
}
ret = TRUE;
out:
g_clear_object (&dest_parent);
return ret;
} | false | false | false | false | false | 0 |
can_replace_passign(RfmBlock block, RfmPblockInfo pblock_info)
{
pblock_info->head_block = block;
while (block) {
#if 0
if (block == pblock_info->tail_block) {
break;
}
#endif
if (!can_replace_passign_branch(block, pblock_info)) {
return(FALSE);
}
if (block == pblock_info->tail_block) {
break;
}
block = block->next;
}
if (!can_replace_passign_stm(pblock_info)) {
return(FALSE);
}
return(TRUE);
} | false | false | false | false | false | 0 |
dav_get_ns_table_uri(dav_db *db, int ns_id)
{
const char *p = db->ns_table.buf + sizeof(dav_propdb_metadata);
while (ns_id--)
p += strlen(p) + 1;
return p;
} | false | false | false | false | false | 0 |
render(render_guts_t* guts, int indentation) const {
return rope_t("@[") + this->_childNodes.front()->render(guts, indentation) + "]";
} | false | false | false | false | false | 0 |
PyException_SetContext(PyObject *self, PyObject *context) {
PyObject *old_context = ((PyBaseExceptionObject *)self)->context;
((PyBaseExceptionObject *)self)->context = context;
Py_XDECREF(old_context);
} | false | false | false | false | false | 0 |
readImage1( QImage &img, QDataStream &s, const PCXHEADER &header )
{
QByteArray buf( header.BytesPerLine, 0 );
img = QImage( header.width(), header.height(), QImage::Format_Mono );
img.setNumColors( 2 );
for ( int y=0; y<header.height(); ++y )
{
if ( s.atEnd() )
{
img = QImage();
return;
}
readLine( s, buf, header );
uchar *p = img.scanLine( y );
unsigned int bpl = qMin((quint16)((header.width()+7)/8), header.BytesPerLine);
for ( unsigned int x=0; x< bpl; ++x )
p[ x ] = buf[x];
}
// Set the color palette
img.setColor( 0, qRgb( 0, 0, 0 ) );
img.setColor( 1, qRgb( 255, 255, 255 ) );
} | false | false | false | false | false | 0 |
symbol_bd_cobol_purge_file (Symbolizable *self, gchar *filename)
{
gphpedit_debug (DEBUG_SYMBOLIZABLE);
SymbolBdCOBOLDetails *symbolbddet;
symbolbddet = SYMBOL_BD_COBOL_GET_PRIVATE(self);
if(!filename) return ;
g_return_if_fail(self);
symbolbddet->completion_prefix = filename;
if (!g_hash_table_remove (symbolbddet->db_file_table, filename)) return ;
g_hash_table_foreach (symbolbddet->functionlist, remove_custom_function_item, symbolbddet);
g_hash_table_foreach (symbolbddet->cobol_class_tree, remove_custom_class_item, symbolbddet);
g_hash_table_foreach (symbolbddet->cobol_variables_tree, remove_custom_var_item, symbolbddet);
} | false | false | false | false | false | 0 |
compare_name (GstElement * element, const gchar * name)
{
gint eq;
GST_OBJECT_LOCK (element);
eq = strcmp (GST_ELEMENT_NAME (element), name);
GST_OBJECT_UNLOCK (element);
if (eq != 0) {
gst_object_unref (element);
}
return eq;
} | false | false | false | false | false | 0 |
win_altframe(win, tp)
win_T *win;
tabpage_T *tp; /* tab page "win" is in, NULL for current */
{
frame_T *frp;
int b;
if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin)
/* Last window in this tab page, will go to next tab page. */
return alt_tabpage()->tp_curwin->w_frame;
frp = win->w_frame;
#ifdef FEAT_VERTSPLIT
if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)
b = p_spr;
else
#endif
b = p_sb;
if ((!b && frp->fr_next != NULL) || frp->fr_prev == NULL)
return frp->fr_next;
return frp->fr_prev;
} | false | false | false | false | false | 0 |
db_debug (lua_State *L) {
for (;;) {
char buffer[250];
fputs("lua_debug> ", stderr);
if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
strcmp(buffer, "cont\n") == 0)
return 0;
if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
lua_pcall(L, 0, 0, 0)) {
fputs(lua_tostring(L, -1), stderr);
fputs("\n", stderr);
}
lua_settop(L, 0); /* remove eventual returns */
}
} | false | false | false | false | false | 0 |
BIFS_AttachScene(GF_SceneDecoder *plug, GF_Scene *scene, Bool is_scene_decoder)
{
BIFSPriv *priv = (BIFSPriv *)plug->privateStack;
if (priv->codec) return GF_BAD_PARAM;
priv->pScene = scene;
priv->app = scene->root_od->term;
priv->codec = gf_bifs_decoder_new(scene->graph, 0);
gf_bifs_decoder_set_extraction_path(priv->codec, (char *) gf_modules_get_option((GF_BaseInterface *)plug, "General", "CacheDirectory"), scene->root_od->net_service->url);
/*ignore all size info on anim streams*/
if (!is_scene_decoder) gf_bifs_decoder_ignore_size_info(priv->codec);
return GF_OK;
} | false | false | false | false | false | 0 |
main(int argc, const char *argv[]) {
pthread_t thread_id[NTHREADS];
int j;
done = false;
for (j = 0; j < NTHREADS; j++) {
pthread_create(&thread_id[j], NULL, &thread, NULL);
}
for (j = 0; j < NTHREADS; j++) {
pthread_join(thread_id[j], NULL);
}
return 0;
} | false | false | false | false | false | 0 |
push(QUndoCommand * cmd)
{
#ifndef QT_NO_DEBUG
writeUndo(cmd, 0, NULL);
#endif
if (m_temporary == cmd) {
m_temporary->redo();
return;
}
QUndoStack::push(cmd);
} | false | false | false | false | false | 0 |
fileputs(const char *str, FILE *fp)
{
for ( ; *str; str++) {
register char c = *str == '\n' ? ' ' : *str;
putc(c, fp);
}
putc('\n', fp);
} | false | false | false | false | false | 0 |
SigErrorHandler(int /*sig*/, const std::string& msg)
{
AnytunError::throwErr() << msg;
return 0;
} | false | false | false | false | false | 0 |
snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format)
{
int width = snd_pcm_format_physical_width(format);
while (channels > 0) {
void *addr = dst_areas->addr;
unsigned int step = dst_areas->step;
const snd_pcm_channel_area_t *begin = dst_areas;
int channels1 = channels;
unsigned int chns = 0;
int err;
while (1) {
channels1--;
chns++;
dst_areas++;
if (channels1 == 0 ||
dst_areas->addr != addr ||
dst_areas->step != step ||
dst_areas->first != dst_areas[-1].first + width)
break;
}
if (chns > 1 && chns * width == step) {
/* Collapse the areas */
snd_pcm_channel_area_t d;
d.addr = begin->addr;
d.first = begin->first;
d.step = width;
err = snd_pcm_area_silence(&d, dst_offset * chns, frames * chns, format);
channels -= chns;
} else {
err = snd_pcm_area_silence(begin, dst_offset, frames, format);
dst_areas = begin + 1;
channels--;
}
if (err < 0)
return err;
}
return 0;
} | false | false | false | false | false | 0 |
add_gvalue_int64_to_slist( const GncSqlBackend* be, QofIdTypeConst obj_name,
const gpointer pObject, const GncSqlColumnTableEntry* table_row, GSList** pList )
{
gint64 i64_value = 0;
Int64AccessFunc getter;
GValue* value;
g_return_if_fail( be != NULL );
g_return_if_fail( obj_name != NULL );
g_return_if_fail( pObject != NULL );
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
value = g_new0( GValue, 1 );
g_assert( value != NULL );
if ( table_row->gobj_param_name != NULL )
{
g_object_get( pObject, table_row->gobj_param_name, &i64_value, NULL );
}
else
{
getter = (Int64AccessFunc)gnc_sql_get_getter( obj_name, table_row );
if ( getter != NULL )
{
i64_value = (*getter)( pObject );
}
}
(void)g_value_init( value, G_TYPE_INT64 );
g_value_set_int64( value, i64_value );
(*pList) = g_slist_append( (*pList), value );
} | false | false | false | false | false | 0 |
_elm_segment_control_smart_focus_next(const Evas_Object *obj,
Elm_Focus_Direction dir,
Evas_Object **next)
{
Eina_List *items = NULL;
Eina_List *l;
Elm_Segment_Item *it;
ELM_SEGMENT_CONTROL_CHECK(obj) EINA_FALSE;
ELM_SEGMENT_CONTROL_DATA_GET(obj, sd);
EINA_LIST_FOREACH(sd->items, l, it)
items = eina_list_append(items, it->base.access_obj);
return elm_widget_focus_list_next_get
(obj, items, eina_list_data_get, dir, next);
} | false | false | false | false | false | 0 |
initialize(ShowerParticle & particle,PPtr) {
// set the basis vectors
Lorentz5Momentum p,n;
if(particle.perturbative()!=0) {
// find the partner and its momentum
ShowerParticlePtr partner=particle.partner();
Lorentz5Momentum ppartner(partner->momentum());
// momentum of the emitting particle
p = particle.momentum();
Lorentz5Momentum pcm;
// if the partner is a final-state particle then the reference
// vector is along the partner in the rest frame of the pair
if(partner->isFinalState()) {
Boost boost=(p + ppartner).findBoostToCM();
pcm = ppartner;
pcm.boost(boost);
n = Lorentz5Momentum(ZERO,pcm.vect());
n.boost( -boost);
}
else if(!partner->isFinalState()) {
// if the partner is an initial-state particle then the reference
// vector is along the partner which should be massless
if(particle.perturbative()==1)
{n = Lorentz5Momentum(ZERO,ppartner.vect());}
// if the partner is an initial-state decaying particle then the reference
// vector is along the backwards direction in rest frame of decaying particle
else {
Boost boost=ppartner.findBoostToCM();
pcm = p;
pcm.boost(boost);
n = Lorentz5Momentum( ZERO, -pcm.vect());
n.boost( -boost);
}
}
}
else if(particle.initiatesTLS()) {
tShoKinPtr kin=dynamic_ptr_cast<ShowerParticlePtr>
(particle.parents()[0]->children()[0])->showerKinematics();
p = kin->getBasis()[0];
n = kin->getBasis()[1];
}
else {
tShoKinPtr kin=dynamic_ptr_cast<ShowerParticlePtr>(particle.parents()[0])
->showerKinematics();
p = kin->getBasis()[0];
n = kin->getBasis()[1];
}
// set the basis vectors
setBasis(p,n);
} | false | false | false | false | false | 0 |
Perl_dump_all_perl(pTHX_ bool justperl)
{
dVAR;
PerlIO_setlinebuf(Perl_debug_log);
if (PL_main_root)
op_dump(PL_main_root);
dump_packsubs_perl(PL_defstash, justperl);
} | false | false | false | false | false | 0 |
abituguru_remove(struct platform_device *pdev)
{
int i;
struct abituguru_data *data = platform_get_drvdata(pdev);
hwmon_device_unregister(data->hwmon_dev);
for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
device_remove_file(&pdev->dev,
&abituguru_sysfs_attr[i].dev_attr);
return 0;
} | false | false | false | false | false | 0 |
cmafec_get_short_descr_of_city(const struct city *pcity)
{
struct cm_parameter parameter;
if (!cma_is_city_under_agent(pcity, ¶meter)) {
return _("none");
} else {
return cmafec_get_short_descr(¶meter);
}
} | false | false | false | false | false | 0 |
ParsePositionArgumentSuffix(
float *ret_factor, char *suffix, float wfactor, float sfactor)
{
int n;
switch (*suffix)
{
case 'p':
case 'P':
*ret_factor = 1.0;
n = 1;
break;
case 'w':
case 'W':
*ret_factor = wfactor;
n = 1;
break;
default:
*ret_factor = sfactor;
n = 0;
break;
}
return n;
} | false | false | false | false | false | 0 |
_e_place_coverage_shelf_add(E_Zone *zone, int ar, int x, int y, int w, int h)
{
Eina_List *l;
E_Shelf *es;
int x2, y2, w2, h2;
EINA_LIST_FOREACH(e_shelf_list(), l, es)
{
if (es->zone != zone) continue;
x2 = es->x; y2 = es->y; w2 = es->w; h2 = es->h;
if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2))
{
int x0, x00, yy0, y00;
int iw, ih;
if (!es->cfg->overlap) return 0x7fffffff;
x0 = x;
if (x < x2) x0 = x2;
x00 = (x + w);
if ((x2 + w2) < (x + w)) x00 = (x2 + w2);
yy0 = y;
if (y < y2) yy0 = y2;
y00 = (y + h);
if ((y2 + h2) < (y + h)) y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - yy0;
ar += (iw * ih);
}
}
return ar;
} | false | false | false | false | false | 0 |
memstick_next_req(struct memstick_host *host, struct memstick_request **mrq)
{
int rc = -ENXIO;
if ((*mrq) && (*mrq)->error && host->retries) {
(*mrq)->error = rc;
host->retries--;
return 0;
}
if (host->card && host->card->next_request)
rc = host->card->next_request(host->card, mrq);
if (!rc)
host->retries = cmd_retries > 1 ? cmd_retries - 1 : 1;
else
*mrq = NULL;
return rc;
} | false | false | false | false | false | 0 |
diff_print_info_init(
diff_print_info *pi,
git_buf *out,
git_diff *diff,
git_diff_format_t format,
git_diff_line_cb cb,
void *payload)
{
pi->diff = diff;
pi->format = format;
pi->print_cb = cb;
pi->payload = payload;
pi->buf = out;
if (diff)
pi->flags = diff->opts.flags;
else
pi->flags = 0;
if (diff && diff->opts.id_abbrev != 0)
pi->oid_strlen = diff->opts.id_abbrev;
else if (!diff || !diff->repo)
pi->oid_strlen = GIT_ABBREV_DEFAULT;
else if (git_repository__cvar(
&pi->oid_strlen, diff->repo, GIT_CVAR_ABBREV) < 0)
return -1;
pi->oid_strlen += 1; /* for NUL byte */
if (pi->oid_strlen < 2)
pi->oid_strlen = 2;
else if (pi->oid_strlen > GIT_OID_HEXSZ + 1)
pi->oid_strlen = GIT_OID_HEXSZ + 1;
memset(&pi->line, 0, sizeof(pi->line));
pi->line.old_lineno = -1;
pi->line.new_lineno = -1;
pi->line.num_lines = 1;
return 0;
} | false | false | false | false | false | 0 |
sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer data)
{
struct sell_data *sd = (struct sell_data *) data;
struct city *pcity = city_model_get(model, iter);
if (NULL != pcity
&& !pcity->did_sell
&& city_has_building(pcity, sd->target)) {
sd->count++;
sd->gold += impr_sell_gold(sd->target);
city_sell_improvement(pcity, improvement_number(sd->target));
}
} | false | false | false | false | false | 0 |
slotServiceReady(Plasma::Service *service)
{
KConfigGroup op = service->operationDescription("GetPackage");
service->startOperationCall(op);
q->connect(service, SIGNAL(finished(Plasma::ServiceJob*)),
q, SLOT(slotPackageDownloaded(Plasma::ServiceJob*)));
} | false | false | false | false | false | 0 |
stex_set_dma_mask(struct pci_dev * pdev)
{
int ret;
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
&& !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
return 0;
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (!ret)
ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
return ret;
} | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.