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 |
|---|---|---|---|---|---|---|
view_event (GtkWidget *widget,
GdkEventAny *event,
GitgCommitView *view)
{
GtkTextWindowType type;
GtkTextBuffer *buffer;
GtkTextIter iter;
gboolean is_hunk = FALSE;
type = gtk_text_view_get_window_type (GTK_TEXT_VIEW (widget), event->window);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
if (type == GTK_TEXT_WINDOW_LEFT)
{
return gutter_event (widget, event, view);
}
if (type == GTK_TEXT_WINDOW_TEXT && event->type == GDK_LEAVE_NOTIFY)
{
unset_highlight (view);
gdk_window_set_cursor (event->window, NULL);
return FALSE;
}
get_info_at_pointer (view, &iter, &is_hunk, NULL, NULL);
if (event->type == GDK_LEAVE_NOTIFY ||
event->type == GDK_MOTION_NOTIFY ||
event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE ||
event->type == GDK_ENTER_NOTIFY)
{
if (is_hunk)
{
set_highlight (view, &iter);
gdk_window_set_cursor (event->window, view->priv->hand);
}
else
{
unset_highlight (view);
gdk_window_set_cursor (event->window, NULL);
}
}
if (type == GTK_TEXT_WINDOW_TEXT &&event->type == GDK_BUTTON_RELEASE &&
((GdkEventButton *) event)->button == 1 && is_hunk &&
!gtk_text_buffer_get_has_selection (buffer))
{
if (handle_stage_unstage (view, &iter))
{
unset_highlight (view);
gdk_window_set_cursor (event->window, NULL);
}
}
return FALSE;
} | false | false | false | false | false | 0 |
SplineToMultiLine (float* cpx, float* cpy, int cpcount) {
register int cpi;
if (cpcount < 3) {
_x = cpx;
_y = cpy;
_count = cpcount;
} else {
mlcount = 0;
CalcSection(
cpx[0], cpy[0], cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1]
);
CalcSection(
cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1], cpx[2], cpy[2]
);
for (cpi = 1; cpi < cpcount - 2; ++cpi) {
CalcSection(
cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi],
cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 2], cpy[cpi + 2]
);
}
CalcSection(
cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi],
cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1]
);
CalcSection(
cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1],
cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1]
);
_x = mlx;
_y = mly;
_count = mlcount;
}
} | false | false | false | false | false | 0 |
rpoplpushcommand(redisClient *c) {
robj *sobj;
sobj = lookupKeyWrite(c->db,c->argv[1]);
if (sobj == NULL) {
addReply(c,shared.nullbulk);
} else {
if (sobj->type != REDIS_LIST) {
addReply(c,shared.wrongtypeerr);
} else {
list *srclist = sobj->ptr;
listNode *ln = listLast(srclist);
if (ln == NULL) {
addReply(c,shared.nullbulk);
} else {
robj *dobj = lookupKeyWrite(c->db,c->argv[2]);
robj *ele = listNodeValue(ln);
list *dstlist;
if (dobj == NULL) {
/* Create the list if the key does not exist */
dobj = createListObject();
dictAdd(c->db->dict,c->argv[2],dobj);
incrRefCount(c->argv[2]);
} else if (dobj->type != REDIS_LIST) {
addReply(c,shared.wrongtypeerr);
return;
}
/* Add the element to the target list */
dstlist = dobj->ptr;
listAddNodeHead(dstlist,ele);
incrRefCount(ele);
/* Send the element to the client as reply as well */
addReplyBulkLen(c,ele);
addReply(c,ele);
addReply(c,shared.crlf);
/* Finally remove the element from the source list */
listDelNode(srclist,ln);
server.dirty++;
}
}
}
} | false | false | false | false | false | 0 |
noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
#endif
{
ulong32 a,b,c,d,temp;
int r;
LTC_ARGCHK(skey != NULL);
LTC_ARGCHK(pt != NULL);
LTC_ARGCHK(ct != NULL);
LOAD32H(a,&pt[0]); LOAD32H(b,&pt[4]);
LOAD32H(c,&pt[8]); LOAD32H(d,&pt[12]);
#define ROUND(i) \
a ^= RC[i]; \
THETA(skey->noekeon.K, a,b,c,d); \
PI1(a,b,c,d); \
GAMMA(a,b,c,d); \
PI2(a,b,c,d);
for (r = 0; r < 16; ++r) {
ROUND(r);
}
#undef ROUND
a ^= RC[16];
THETA(skey->noekeon.K, a, b, c, d);
STORE32H(a,&ct[0]); STORE32H(b,&ct[4]);
STORE32H(c,&ct[8]); STORE32H(d,&ct[12]);
return CRYPT_OK;
} | false | false | false | false | false | 0 |
apply_prediction(AACContext * ac, SingleChannelElement * sce) {
int sfb, k;
if (!sce->ics.predictor_initialized) {
reset_all_predictors(sce->predictor_state);
sce->ics.predictor_initialized = 1;
}
if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
for (sfb = 0; sfb < ff_aac_pred_sfb_max[ac->m4ac.sampling_index]; sfb++) {
for (k = sce->ics.swb_offset[sfb]; k < sce->ics.swb_offset[sfb + 1]; k++) {
predict(ac, &sce->predictor_state[k], &sce->coeffs[k],
sce->ics.predictor_present && sce->ics.prediction_used[sfb]);
}
}
if (sce->ics.predictor_reset_group)
reset_predictor_group(sce->predictor_state, sce->ics.predictor_reset_group);
} else
reset_all_predictors(sce->predictor_state);
} | false | false | false | false | false | 0 |
CompressionWiggleIterator(WiggleIterator * i) {
if (i->overlaps)
return i;
else {
UnaryWiggleIteratorData * data = (UnaryWiggleIteratorData *) calloc(1, sizeof(UnaryWiggleIteratorData));
data->iter = i;
return newWiggleIterator(data, &CompressionWiggleIteratorPop, &UnaryWiggleIteratorSeek, i->default_value);
}
} | false | false | false | false | false | 0 |
mbfl_identify_filter_init(mbfl_identify_filter *filter, enum mbfl_no_encoding encoding)
{
const struct mbfl_identify_vtbl *vtbl;
/* encoding structure */
filter->encoding = mbfl_no2encoding(encoding);
if (filter->encoding == NULL) {
filter->encoding = &mbfl_encoding_pass;
}
filter->status = 0;
filter->flag = 0;
filter->score = 0;
/* setup the function table */
vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding);
if (vtbl == NULL) {
vtbl = &vtbl_identify_false;
}
filter->filter_ctor = vtbl->filter_ctor;
filter->filter_dtor = vtbl->filter_dtor;
filter->filter_function = vtbl->filter_function;
/* constructor */
(*filter->filter_ctor)(filter);
return 0;
} | false | false | false | false | false | 0 |
expert_search (void)
{
// Get relevant information
const gchar *search;
search = gtk_entry_get_text (GTK_ENTRY (get ("expert_search_entry")));
gboolean value_search = biff_->value_bool ("expert_search_values");
GtkTreeIter iter;
gboolean valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(expert_liststore), &iter);
// Test each option
while (valid) {
// Get text
gchar *name, *value;
gtk_tree_model_get (GTK_TREE_MODEL(expert_liststore), &iter,
COL_EXP_GROUPNAME, &name,
COL_EXP_VALUE, &value, -1);
// Look for string
if ((name) && (value)
&& (std::string(name).find(search) == std::string::npos)
&& (!value_search
|| (std::string(value).find(search) == std::string::npos)))
valid = gtk_list_store_remove (expert_liststore, &iter);
else
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(expert_liststore),
&iter);
}
// Clear widgets if there is no selection
GtkTreeSelection *select = gtk_tree_view_get_selection (expert_treeview);
if ((!select) || (!gtk_tree_selection_count_selected_rows (select)))
gtk_text_buffer_set_text (expert_textbuffer, "", -1);
} | false | false | false | false | false | 0 |
unload_all_nic_libraries()
{
nic_lib_handle_t *current, *next;
pthread_mutex_lock(&nic_lib_list_mutex);
current = nic_lib_list;
while (current != NULL) {
next = current->next;
free_nic_library_handle(current);
current = next;
}
pthread_mutex_unlock(&nic_lib_list_mutex);
nic_lib_list = NULL;
return 0;
} | false | false | false | false | false | 0 |
start_isoc_chain(struct usb_fifo *fifo, int num_packets_per_urb,
usb_complete_t complete, int packet_size)
{
struct hfcsusb *hw = fifo->hw;
int i, k, errcode;
if (debug)
printk(KERN_DEBUG "%s: %s: fifo %i\n",
hw->name, __func__, fifo->fifonum);
/* allocate Memory for Iso out Urbs */
for (i = 0; i < 2; i++) {
if (!(fifo->iso[i].urb)) {
fifo->iso[i].urb =
usb_alloc_urb(num_packets_per_urb, GFP_KERNEL);
if (!(fifo->iso[i].urb)) {
printk(KERN_DEBUG
"%s: %s: alloc urb for fifo %i failed",
hw->name, __func__, fifo->fifonum);
}
fifo->iso[i].owner_fifo = (struct usb_fifo *) fifo;
fifo->iso[i].indx = i;
/* Init the first iso */
if (ISO_BUFFER_SIZE >=
(fifo->usb_packet_maxlen *
num_packets_per_urb)) {
fill_isoc_urb(fifo->iso[i].urb,
fifo->hw->dev, fifo->pipe,
fifo->iso[i].buffer,
num_packets_per_urb,
fifo->usb_packet_maxlen,
fifo->intervall, complete,
&fifo->iso[i]);
memset(fifo->iso[i].buffer, 0,
sizeof(fifo->iso[i].buffer));
for (k = 0; k < num_packets_per_urb; k++) {
fifo->iso[i].urb->
iso_frame_desc[k].offset =
k * packet_size;
fifo->iso[i].urb->
iso_frame_desc[k].length =
packet_size;
}
} else {
printk(KERN_DEBUG
"%s: %s: ISO Buffer size to small!\n",
hw->name, __func__);
}
}
fifo->bit_line = BITLINE_INF;
errcode = usb_submit_urb(fifo->iso[i].urb, GFP_KERNEL);
fifo->active = (errcode >= 0) ? 1 : 0;
fifo->stop_gracefull = 0;
if (errcode < 0) {
printk(KERN_DEBUG "%s: %s: %s URB nr:%d\n",
hw->name, __func__,
symbolic(urb_errlist, errcode), i);
}
}
return fifo->active;
} | false | false | false | false | false | 0 |
dst_gpio_outb(struct dst_state *state, u32 mask, u32 enbb,
u32 outhigh, int delay)
{
union dst_gpio_packet enb;
union dst_gpio_packet bits;
int err;
enb.enb.mask = mask;
enb.enb.enable = enbb;
dprintk(verbose, DST_INFO, 1, "mask=[%04x], enbb=[%04x], outhigh=[%04x]", mask, enbb, outhigh);
if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) {
dprintk(verbose, DST_INFO, 1, "dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)", err, mask, enbb);
return -EREMOTEIO;
}
udelay(1000);
/* because complete disabling means no output, no need to do output packet */
if (enbb == 0)
return 0;
if (delay)
msleep(10);
bits.outp.mask = enbb;
bits.outp.highvals = outhigh;
if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) {
dprintk(verbose, DST_INFO, 1, "dst_gpio_outb error (err == %i, enbb == %02x, outhigh == %02x)", err, enbb, outhigh);
return -EREMOTEIO;
}
return 0;
} | false | false | false | false | false | 0 |
Mother(unsigned long *pSeed)
{
unsigned long number,
number1,
number2;
short n,
*p;
unsigned short sNumber;
/* Initialize motheri with 9 random values the first time */
if (mStart) {
sNumber= *pSeed&m16Mask; /* The low 16 bits */
number= *pSeed&m31Mask; /* Only want 31 bits */
p=mother1;
for (n=18;n--;) {
number=30903*sNumber+(number>>16); /* One line
multiply-with-cary */
*p++=sNumber=number&m16Mask;
if (n==9)
p=mother2;
}
/* make cary 15 bits */
mother1[0]&=m15Mask;
mother2[0]&=m15Mask;
mStart=0;
}
/* Move elements 1 to 8 to 2 to 9 */
memmove(mother1+2,mother1+1,8*sizeof(short));
memmove(mother2+2,mother2+1,8*sizeof(short));
/* Put the carry values in numberi */
number1=mother1[0];
number2=mother2[0];
/* Form the linear combinations */
number1+=1941*mother1[2]+1860*mother1[3]+1812*mother1[4]+1776*mother1[5]+
1492*mother1[6]+1215*mother1[7]+1066*mother1[8]+12013*mother1[9];
number2+=1111*mother2[2]+2222*mother2[3]+3333*mother2[4]+4444*mother2[5]+
5555*mother2[6]+6666*mother2[7]+7777*mother2[8]+9272*mother2[9];
/* Save the high bits of numberi as the new carry */
mother1[0]=number1/m16Long;
mother2[0]=number2/m16Long;
/* Put the low bits of numberi into motheri[1] */
mother1[1]=m16Mask&number1;
mother2[1]=m16Mask&number2;
/* Combine the two 16 bit random numbers into one 32 bit */
*pSeed=(((long)mother1[1])<<16)+(long)mother2[1];
/* Return a double value between 0 and 1 */
return ((double)*pSeed)/m32Double;
} | false | false | false | false | false | 0 |
build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) /* {{{ */
{
char char_pos_buf[32];
uint char_pos_len;
const char *filename;
char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text));
if (CG(active_op_array)->filename) {
filename = CG(active_op_array)->filename;
} else {
filename = "-";
}
/* NULL, name length, filename length, last accepting char position length */
result->value.str.len = 1+name_length+strlen(filename)+char_pos_len;
/* must be binary safe */
result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1);
result->value.str.val[0] = '\0';
sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf);
result->type = IS_STRING;
Z_SET_REFCOUNT_P(result, 1);
} | false | false | false | false | false | 0 |
inode_remove(struct inode *inode)
{
int dfc_needs_free = 0;
inode_remove_all_xattrs(inode);
if (inode->u.c.state != NULL)
gflog_fatal(GFARM_MSG_1000302, "inode_remove: still opened");
if (inode_is_file(inode)) {
struct file_copy *copy, *cn;
gfarm_error_t e;
for (copy = inode->u.c.s.f.copies; copy != NULL; copy = cn) {
if (!FILE_COPY_IS_BEING_REMOVED(copy)) {
e = remove_replica_entity(inode, inode->i_gen,
copy->host, FILE_COPY_IS_VALID(copy), NULL);
}
cn = copy->host_next;
free(copy);
}
inode->u.c.s.f.copies = NULL; /* ncopy == 0 */
inode_cksum_remove(inode);
quota_update_file_remove(inode);
dfc_needs_free = 1;
} else if (inode_is_dir(inode)) {
dir_free(inode->u.c.s.d.entries);
} else if (inode_is_symlink(inode)) {
free(inode->u.c.s.l.source_path);
} else {
gflog_fatal(GFARM_MSG_1000303,
"inode_unlink: unknown inode type");
/*NOTREACHED*/
}
inode_free(inode);
if (dfc_needs_free)
dead_file_copy_inode_status_changed(inode->i_number);
} | false | false | false | false | false | 0 |
handle_learn_logs(FILE *learnlog, FILE * stream)
{
struct glob_file *glob;
parse_acls();
expand_acls();
/* since we don't call analyze_acls(), we'll defer the errors till they load the policy */
for (glob = glob_files_head; glob; glob = glob->next)
add_globbed_object_acl(glob->subj, glob->filename, glob->mode, glob->type, glob->policy_file, glob->lineno);
perform_parse_and_reduce(learnlog);
display_learn_logs(stream);
return;
} | false | false | false | false | false | 0 |
assign(QueuedGeometry* qgeom)
{
// Do we have enough space?
// -2 first to avoid overflow (-1 to adjust count to index, -1 to ensure
// no overflow at 32 bits and use >= instead of >)
if ((mVertexData->vertexCount - 2 + qgeom->geometry->vertexData->vertexCount)
>= mMaxVertexIndex)
{
return false;
}
mQueuedGeometry.push_back(qgeom);
mVertexData->vertexCount += qgeom->geometry->vertexData->vertexCount;
mIndexData->indexCount += qgeom->geometry->indexData->indexCount;
return true;
} | false | false | false | false | false | 0 |
rms_env_reset(rms_env *r)
{
unsigned int i;
for (i=0; i<RMS_BUF_SIZE; i++) {
r->buffer[i] = 0.0f;
}
r->pos = 0;
r->sum = 0.0f;
} | false | false | false | false | false | 0 |
list_append_tv(l, tv)
list_T *l;
typval_T *tv;
{
listitem_T *li = listitem_alloc();
if (li == NULL)
return FAIL;
copy_tv(tv, &li->li_tv);
list_append(l, li);
return OK;
} | false | false | false | false | false | 0 |
lastaddr (void)
{
if (currprefs.z3fastmem2_size)
return z3fastmem2_start + currprefs.z3fastmem2_size;
if (currprefs.z3fastmem_size)
return z3fastmem_start + currprefs.z3fastmem_size;
if (currprefs.z3chipmem_size)
return z3chipmem_start + currprefs.z3chipmem_size;
if (currprefs.mbresmem_high_size)
return a3000hmem_start + currprefs.mbresmem_high_size;
if (currprefs.mbresmem_low_size)
return a3000lmem_start + currprefs.mbresmem_low_size;
if (currprefs.bogomem_size)
return bogomem_start + currprefs.bogomem_size;
if (currprefs.fastmem_size)
return fastmem_start + currprefs.fastmem_size;
return currprefs.chipmem_size;
} | false | false | false | false | false | 0 |
trainpolicy( InputData* pTrainingData, const string baseLearnerName, const int numIterations, const int arrayInd )
{
AdaBoostMHLearner* sHypothesis = new AdaBoostMHLearner();
sHypothesis->run(_args, pTrainingData, baseLearnerName, numIterations, _weakhyp );
delete sHypothesis;
//_actionNum = pTrainingData->getNumClasses();
_baseLearnerName = baseLearnerName;
const int numExamples = pTrainingData->getNumExamples();
vector<AlphaReal> results(_actionNum);
int numErrors = 0;
for(int i=0; i<numExamples; ++i )
{
fill(results.begin(),results.end(),0.0);
for(int t=0; t<_weakhyp.size(); ++t)
{
for( int l=0; l<_actionNum; ++l )
{
results[l] += _weakhyp[t]->getAlpha() * _weakhyp[t]->classify(pTrainingData,i,l);
}
}
AlphaReal maxMargin = -numeric_limits<AlphaReal>::max();
int forecastlabel = -1;
for(int l=0; l<_actionNum; ++l )
{
if (results[l]>maxMargin)
{
maxMargin=results[l];
forecastlabel=l;
}
}
vector<Label> labels = pTrainingData->getLabels(i);
if (pTrainingData->hasLabel(i,forecastlabel) )
{
if(labels[forecastlabel].y<0) numErrors++;
} else numErrors++;
}
AlphaReal error = (AlphaReal)numErrors/(AlphaReal) numExamples;
return error;
} | false | false | false | false | false | 0 |
gnome_desktop_thumbnail_factory_finalize (GObject *object)
{
GnomeDesktopThumbnailFactory *factory;
GnomeDesktopThumbnailFactoryPrivate *priv;
GConfClient *client;
factory = GNOME_DESKTOP_THUMBNAIL_FACTORY (object);
priv = factory->priv;
if (priv->reread_scheduled != 0) {
g_source_remove (priv->reread_scheduled);
priv->reread_scheduled = 0;
}
if (priv->thumbnailers_notify != 0) {
client = gconf_client_get_default ();
gconf_client_notify_remove (client, priv->thumbnailers_notify);
priv->thumbnailers_notify = 0;
g_object_unref (client);
}
if (priv->scripts_hash)
{
g_hash_table_destroy (priv->scripts_hash);
priv->scripts_hash = NULL;
}
if (priv->lock)
{
g_mutex_free (priv->lock);
priv->lock = NULL;
}
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
} | false | false | false | false | false | 0 |
resolve_generic_type(Oid declared_type,
Oid context_actual_type,
Oid context_declared_type)
{
if (declared_type == ANYARRAYOID)
{
if (context_declared_type == ANYARRAYOID)
{
/*
* Use actual type, but it must be an array; or if it's a domain
* over array, use the base array type.
*/
Oid context_base_type = getBaseType(context_actual_type);
Oid array_typelem = get_element_type(context_base_type);
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared \"anyarray\" is not an array but type %s",
format_type_be(context_base_type))));
return context_base_type;
}
else if (context_declared_type == ANYELEMENTOID ||
context_declared_type == ANYNONARRAYOID ||
context_declared_type == ANYENUMOID)
{
/* Use the array type corresponding to actual type */
Oid array_typeid = get_array_type(context_actual_type);
if (!OidIsValid(array_typeid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
format_type_be(context_actual_type))));
return array_typeid;
}
}
else if (declared_type == ANYELEMENTOID ||
declared_type == ANYNONARRAYOID ||
declared_type == ANYENUMOID)
{
if (context_declared_type == ANYARRAYOID)
{
/* Use the element type corresponding to actual type */
Oid context_base_type = getBaseType(context_actual_type);
Oid array_typelem = get_element_type(context_base_type);
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared \"anyarray\" is not an array but type %s",
format_type_be(context_base_type))));
return array_typelem;
}
else if (context_declared_type == ANYELEMENTOID ||
context_declared_type == ANYNONARRAYOID ||
context_declared_type == ANYENUMOID)
{
/* Use the actual type; it doesn't matter if array or not */
return context_actual_type;
}
}
else
{
/* declared_type isn't polymorphic, so return it as-is */
return declared_type;
}
/* If we get here, declared_type is polymorphic and context isn't */
/* NB: this is a calling-code logic error, not a user error */
elog(ERROR, "could not determine polymorphic type because context isn't polymorphic");
return InvalidOid; /* keep compiler quiet */
} | false | false | false | false | false | 0 |
real_slot_set_short_status (NautilusWindowSlot *slot,
const gchar *primary_status,
const gchar *detail_status)
{
gboolean disable_chrome;
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (slot->details->floating_bar));
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
FALSE);
g_object_get (nautilus_window_slot_get_window (slot),
"disable-chrome", &disable_chrome,
NULL);
if ((primary_status == NULL && detail_status == NULL) || disable_chrome) {
gtk_widget_hide (slot->details->floating_bar);
return;
}
nautilus_floating_bar_set_labels (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
primary_status, detail_status);
gtk_widget_show (slot->details->floating_bar);
} | false | false | false | false | false | 0 |
player_stop (void)
{
pthread_t thread = play_thread;
play_thread = 0;
if (thread)
pthread_cancel (thread);
gtk_video_in_spu_button (gtv, 0);
xine_stop (stream);
} | false | false | false | false | false | 0 |
visitValue(const string& str, const string& val) throw (Exception)
{
printf("%.*s/%.*s = %.*s\n", PFSTR(root), PFSTR(str), PFSTR(val));
return true;
}
} | false | false | false | false | false | 0 |
same_variable_part_p (rtx loc, tree expr, HOST_WIDE_INT offset)
{
tree expr2;
HOST_WIDE_INT offset2;
if (! DECL_P (expr))
return false;
if (REG_P (loc))
{
expr2 = REG_EXPR (loc);
offset2 = REG_OFFSET (loc);
}
else if (MEM_P (loc))
{
expr2 = MEM_EXPR (loc);
offset2 = INT_MEM_OFFSET (loc);
}
else
return false;
if (! expr2 || ! DECL_P (expr2))
return false;
expr = var_debug_decl (expr);
expr2 = var_debug_decl (expr2);
return (expr == expr2 && offset == offset2);
} | false | false | false | false | false | 0 |
runOnMachineFunction(MachineFunction &fn) {
mf = &fn;
mri = &mf->getRegInfo();
tii = mf->getTarget().getInstrInfo();
tri = mf->getTarget().getRegisterInfo();
sis = &getAnalysis<SlotIndexes>();
lis = &getAnalysis<LiveIntervals>();
mli = &getAnalysis<MachineLoopInfo>();
mdt = &getAnalysis<MachineDominatorTree>();
fqn = mf->getFunction()->getParent()->getModuleIdentifier() + "." +
mf->getFunction()->getName().str();
dbgs() << "Splitting " << mf->getFunction()->getName() << ".";
dumpOddTerminators();
// dbgs() << "----------------------------------------\n";
// lis->dump();
// dbgs() << "----------------------------------------\n";
// std::deque<MachineLoop*> loops;
// std::copy(mli->begin(), mli->end(), std::back_inserter(loops));
// dbgs() << "Loops:\n";
// while (!loops.empty()) {
// MachineLoop &loop = *loops.front();
// loops.pop_front();
// std::copy(loop.begin(), loop.end(), std::back_inserter(loops));
// dumpLoopInfo(loop);
// }
//lis->dump();
//exit(0);
// Setup initial intervals.
for (LiveIntervals::iterator liItr = lis->begin(), liEnd = lis->end();
liItr != liEnd; ++liItr) {
LiveInterval *li = liItr->second;
if (TargetRegisterInfo::isVirtualRegister(li->reg) &&
!lis->intervalIsInOneMBB(*li)) {
intervals.push_back(li);
}
}
processIntervals();
intervals.clear();
// dbgs() << "----------------------------------------\n";
// lis->dump();
// dbgs() << "----------------------------------------\n";
dumpOddTerminators();
//exit(1);
return false;
} | false | false | false | false | false | 0 |
iblock_set_configfs_dev_params(struct se_device *dev,
const char *page, ssize_t count)
{
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
char *orig, *ptr, *arg_p, *opts;
substring_t args[MAX_OPT_ARGS];
int ret = 0, token;
unsigned long tmp_readonly;
opts = kstrdup(page, GFP_KERNEL);
if (!opts)
return -ENOMEM;
orig = opts;
while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr)
continue;
token = match_token(ptr, tokens, args);
switch (token) {
case Opt_udev_path:
if (ib_dev->ibd_bd) {
pr_err("Unable to set udev_path= while"
" ib_dev->ibd_bd exists\n");
ret = -EEXIST;
goto out;
}
if (match_strlcpy(ib_dev->ibd_udev_path, &args[0],
SE_UDEV_PATH_LEN) == 0) {
ret = -EINVAL;
break;
}
pr_debug("IBLOCK: Referencing UDEV path: %s\n",
ib_dev->ibd_udev_path);
ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
break;
case Opt_readonly:
arg_p = match_strdup(&args[0]);
if (!arg_p) {
ret = -ENOMEM;
break;
}
ret = kstrtoul(arg_p, 0, &tmp_readonly);
kfree(arg_p);
if (ret < 0) {
pr_err("kstrtoul() failed for"
" readonly=\n");
goto out;
}
ib_dev->ibd_readonly = tmp_readonly;
pr_debug("IBLOCK: readonly: %d\n", ib_dev->ibd_readonly);
break;
case Opt_force:
break;
default:
break;
}
}
out:
kfree(orig);
return (!ret) ? count : ret;
} | false | false | false | false | false | 0 |
H5G_loc_find_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char *name,
const H5O_link_t UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
H5G_loc_fnd_t *udata = (H5G_loc_fnd_t *)_udata; /* User data passed in */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check if the name in this group resolved to a valid object */
if(obj_loc == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object '%s' doesn't exist", name)
/* Take ownership of the object's group location */
/* (Group traversal callbacks are responsible for either taking ownership
* of the group location for the object, or freeing it. - QAK)
*/
H5G__loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW);
*own_loc = H5G_OWN_OBJ_LOC;
done:
FUNC_LEAVE_NOAPI(ret_value)
} | false | false | false | false | false | 0 |
add_ligature(Code in1, Code in2, Code out)
{
if (Ligature *l = ligature_obj(in1, in2)) {
Char &ch = _encoding[l->out];
if (ch.flags & Char::BUILT) {
// move old ligatures to point to the true ligature
for (Ligature *ll = ch.ligatures.begin(); ll != ch.ligatures.end(); ll++)
add_ligature(out, ll->in2, ll->out);
repoint_ligature(in1, l, out);
}
} else
new_ligature(in1, in2, out);
} | false | false | false | false | false | 0 |
bios_10_4f05(struct regs *regs)
{
#if CIRRUS_DEBUG & CIRRUS_DEBUG_VESA_5
dprintf("Cirrus VESA Function 05 called.\n");
#endif
/* FIXME? fail when in a lfb mode */
if (BL > 0x01) {
/* There are only two memory windows */
AX = VBE_UNIMPLEMENTED;
return;
}
if (BH == 0x00) {
/* set memory window */
if (DH) {
/* window # >= 0x100 */
AX = VBE_UNIMPLEMENTED;
return;
}
if (! BL) { /* window 0 */
/* set GR9 Offset Register 0 */
#if CIRRUS_DEBUG & CIRRUS_DEBUG_VESA_5_DETAILS
dprintf(" setting memory window 0: GR9 <- 0x%0x\n", DL);
#endif
outb(0x09, 0x3ce);
} else { /* window 1 */
/* set GRA Offset Register 1 */
#if CIRRUS_DEBUG & CIRRUS_DEBUG_VESA_5_DETAILS
dprintf(" setting memory window 1: GRA <- 0x%0x\n", DL);
#endif
outb(0x0a, 0x3ce);
}
outb(DL, 0x3cf);
} else if (BH == 0x01) {
/* get memory window */
if (! BL) { /* window 0 */
/* get GR9 Offset Register 0 */
outb(0x09, 0x3ce);
} else { /* window 1 */
/* get GRA Offset Register 1 */
outb(0x0a, 0x3ce);
}
DL = inb(0x3cf);
#if CIRRUS_DEBUG & CIRRUS_DEBUG_VESA_5_DETAILS
if (! BL) {
dprintf(" getting memory window 0: GR9 -> 0x%0x\n", DL);
} else {
dprintf(" getting memory window 1: GRA -> 0x%0x\n", DL);
}
#endif
} else {
/* unknown command */
AX = VBE_UNIMPLEMENTED;
return;
}
AX = VBE_SUCCESS;
} | false | false | false | false | false | 0 |
lbs_mesh_ethtool_get_stats(struct net_device *dev,
struct ethtool_stats *stats, uint64_t *data)
{
struct lbs_private *priv = dev->ml_priv;
struct cmd_ds_mesh_access mesh_access;
int ret;
lbs_deb_enter(LBS_DEB_ETHTOOL);
/* Get Mesh Statistics */
ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
if (ret) {
memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
return;
}
priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
data[0] = priv->mstats.fwd_drop_rbt;
data[1] = priv->mstats.fwd_drop_ttl;
data[2] = priv->mstats.fwd_drop_noroute;
data[3] = priv->mstats.fwd_drop_nobuf;
data[4] = priv->mstats.fwd_unicast_cnt;
data[5] = priv->mstats.fwd_bcast_cnt;
data[6] = priv->mstats.drop_blind;
data[7] = priv->mstats.tx_failed_cnt;
lbs_deb_enter(LBS_DEB_ETHTOOL);
} | false | false | false | false | false | 0 |
save_history_cb(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer data)
{
FILE * fp;
char * str;
fp = (FILE *) data;
gtk_tree_model_get(model, iter, 0, &str, -1);
if (str) {
fprintf(fp, "%s\n", str);
g_free(str);
}
return FALSE;
} | false | false | false | false | false | 0 |
read_line(struct FTP *con)/*{{{*/
{
char *result;
int n;
char *p;
while (1) {
n = read(con->fd, con->bufptr, con->readbuf + sizeof(con->readbuf) - con->bufptr);
if (n < 0) {
perror("read");
exit(1);
}
if (n == 0) {
return NULL;
}
con->bufptr += n;
p = con->readbuf;
while (p < con->bufptr - 1) {
if (p[0]=='\r' && p[1] == '\n') {
/* match */
int len = p - con->readbuf;
int remain;
result = new_array(char, len+1);
memcpy(result, con->readbuf, len);
result[len] = 0;
if (verbose) {
printf("Got line [%s]\n", result);
}
remain = con->bufptr - (p+2);
if (remain > 0) {
memmove(con->readbuf, p+2, remain);
con->bufptr -= (len + 2);
} else {
con->bufptr = con->readbuf;
}
return result;
} else {
p++;
}
}
}
} | false | false | false | false | false | 0 |
gl_field_button_set_key (glFieldButton *this,
const gchar *key)
{
g_free (this->priv->key);
this->priv->key = g_strdup (key);
if ( this->priv->label_is_key )
{
gtk_label_set_text (GTK_LABEL (this->priv->label), key);
}
} | false | false | false | false | false | 0 |
selnl_notify(int msgtype, void *data)
{
int len;
sk_buff_data_t tmp;
struct sk_buff *skb;
struct nlmsghdr *nlh;
len = selnl_msglen(msgtype);
skb = nlmsg_new(len, GFP_USER);
if (!skb)
goto oom;
tmp = skb->tail;
nlh = nlmsg_put(skb, 0, 0, msgtype, len, 0);
if (!nlh)
goto out_kfree_skb;
selnl_add_payload(nlh, len, msgtype, data);
nlh->nlmsg_len = skb->tail - tmp;
NETLINK_CB(skb).dst_group = SELNLGRP_AVC;
netlink_broadcast(selnl, skb, 0, SELNLGRP_AVC, GFP_USER);
out:
return;
out_kfree_skb:
kfree_skb(skb);
oom:
printk(KERN_ERR "SELinux: OOM in %s\n", __func__);
goto out;
} | false | false | false | false | false | 0 |
card_open(struct sstate *ss, char *dev)
{
struct wif *wi = wi_open(dev);
if (!wi)
err(1, "wi_open()");
ss->ss_wi = wi;
} | false | false | false | false | false | 0 |
edgeAttrs(FILE * gxlFile, Agedge_t * e)
{
char *val;
val = agget(e, GXL_ID);
if (!EMPTY(val)) {
fprintf(gxlFile, " id=\"%s\"", xml_string(val));
}
val = agget(e, GXL_FROM);
if (!EMPTY(val)) {
fprintf(gxlFile, " fromorder=\"%s\"", xml_string(val));
}
val = agget(e, GXL_TO);
if (!EMPTY(val)) {
fprintf(gxlFile, " toorder=\"%s\"", xml_string(val));
}
} | false | false | false | false | false | 0 |
OpKillApp()
{
cid_killapp_it out ;
cid_killapp_ot in ;
status=system("clear") ;
printf("CID_OP_KILL_APP") ;
printf("\n---------------\n") ;
printf("Enter application id : ") ;
status=scanf("%s", out.appid) ;
/* obtain appid */
printf("\n\nTo CID :\n") ;
printf("\nappid : %s", out.appid) ;
/* send appid to CID */
if (!writen(cidsock, (char *)&out, sizeof(out)))
{
printf("\nOpKillApp::writen\n") ;
getchar() ; getchar() ;
return ;
}
/* read result from CID */
if (!readn(cidsock, (char *)&in, sizeof(in)))
{
printf("\nOpKillApp::readn\n") ;
getchar() ; getchar() ;
return ;
}
/* print result from CID */
printf("\n\nFrom CID :\n") ;
printf("\nstatus : %d", ntohs(in.status)) ;
printf("\nerror : %d", ntohs(in.error)) ;
printf("\ncount : %d\n", ntohs(in.count)) ;
getchar() ; getchar() ;
} | false | true | false | false | true | 1 |
depmod_load(struct depmod *depmod)
{
int err;
err = depmod_load_modules(depmod);
if (err < 0)
return err;
err = depmod_load_dependencies(depmod);
if (err < 0)
return err;
err = depmod_calculate_dependencies(depmod);
if (err < 0)
return err;
return 0;
} | false | false | false | false | false | 0 |
libifinet6_ifinet6_withprefixlength_to_ipv6addrstruct(char *addrstring, char *prefixlengthstring, char *resultstring, ipv6calc_ipv6addr *ipv6addrp) {
int retval = 1, result, tempint;
char tempstring[NI_MAXHOST];
uint8_t prefixlength = 0;
if ( (ipv6calc_debug & DEBUG_libifinet6) != 0 ) {
fprintf(stderr, "%s: Got input addressstring: '%s', prefixlengthstring: '%s'\n", DEBUG_function_name, addrstring, prefixlengthstring);
};
/* simple test on prefix length string*/
if ( strlen(prefixlengthstring) != 2 ) {
snprintf(resultstring,NI_MAXHOST - 1, "Given prefixlength hex string '%s' has not 2 chars!", prefixlengthstring);
retval = 1;
return (retval);
};
/* scan prefix length */
result = sscanf(prefixlengthstring, "%2x\n", &tempint);
if ( result != 1 ) {
snprintf(resultstring,NI_MAXHOST - 1, "error splitting string %s, got only %d items!", prefixlengthstring, result);
retval = 1;
return (retval);
};
if ( (tempint < 0) || (tempint > 128) ) {
snprintf(resultstring,NI_MAXHOST - 1, "decimal prefixlength '%d' out of range!", tempint);
retval = 1;
return (retval);
};
prefixlength = (uint8_t) tempint;
/* convert plain address */
result = libifinet6_ifinet6_to_ipv6addrstruct(addrstring, tempstring, ipv6addrp);
if ( result != 0 ) {
snprintf(resultstring,NI_MAXHOST - 1, "%s", tempstring);
retval = 1;
return (retval);
};
/* set prefix length */
ipv6addrp->prefixlength = (uint8_t) prefixlength;
ipv6addrp->flag_prefixuse = 1;
if ( (ipv6calc_debug & DEBUG_libifinet6) != 0 ) {
fprintf(stderr, "%s: Print: '%s'\n", DEBUG_function_name, resultstring);
};
retval = 0;
return (retval);
} | true | true | false | false | false | 1 |
drawable3d_check_focus_highlight(GF_Node *node, GF_TraverseState *tr_state, GF_BBox *orig_bounds)
{
Drawable *hlight;
GF_Node *prev_node;
u32 prev_mode;
GF_BBox *bounds;
GF_Matrix cur;
GF_Compositor *compositor = tr_state->visual->compositor;
if (compositor->focus_node!=node) return;
hlight = compositor->focus_highlight;
if (!hlight) return;
/*check if focus node has changed*/
prev_node = gf_node_get_private(hlight->node);
if (prev_node != node) {
gf_node_set_private(hlight->node, node);
drawable_reset_path(hlight);
gf_path_reset(hlight->path);
}
/*this is a grouping node, get its bounds*/
if (!orig_bounds) {
gf_mx_copy(cur, tr_state->model_matrix);
gf_mx_init(tr_state->model_matrix);
prev_mode = tr_state->traversing_mode;
tr_state->traversing_mode = TRAVERSE_GET_BOUNDS;
tr_state->bbox.is_set = 0;
// gf_sc_get_nodes_bounds(node, ((GF_ParentNode *)node)->children, tr_state, 1);
gf_node_traverse_children(node, tr_state);
tr_state->traversing_mode = prev_mode;
gf_mx_copy(tr_state->model_matrix, cur);
bounds = &tr_state->bbox;
} else {
bounds = orig_bounds;
}
visual_3d_draw_bbox(tr_state, bounds);
} | false | false | false | false | false | 0 |
pch_udc_free_dma_chain(struct pch_udc_dev *dev,
struct pch_udc_request *req)
{
struct pch_udc_data_dma_desc *td = req->td_data;
unsigned i = req->chain_len;
dma_addr_t addr2;
dma_addr_t addr = (dma_addr_t)td->next;
td->next = 0x00;
for (; i > 1; --i) {
/* do not free first desc., will be done by free for request */
td = phys_to_virt(addr);
addr2 = (dma_addr_t)td->next;
pci_pool_free(dev->data_requests, td, addr);
addr = addr2;
}
req->chain_len = 1;
} | false | false | false | false | false | 0 |
ok()
{
double weight;
QString tmp=weightLineEdit->text();
weight_sscanf(tmp, "%lf", &weight);
if(weight<100.0 || weight>100.0){
QMessageBox::warning(this, tr("FET information"),
tr("Invalid weight (percentage). It has to be 100"));
return;
}
QString teacher_name=teachersComboBox->currentText();
int t=gt.rules.searchTeacher(teacher_name);
if(t==-1){
QMessageBox::warning(this, tr("FET information"),
tr("Invalid teacher"));
return;
}
this->_ctr->weightPercentage=weight;
this->_ctr->teacherName=teacher_name;
this->_ctr->maxBuildingChangesPerDay=maxChangesSpinBox->value();
gt.rules.internalStructureComputed=false;
setRulesModifiedAndOtherThings(>.rules);
this->close();
} | false | false | false | false | false | 0 |
irtty_write_wakeup(struct tty_struct *tty)
{
struct sirtty_cb *priv = tty->disc_data;
IRDA_ASSERT(priv != NULL, return;);
IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;);
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
if (priv->dev)
sirdev_write_complete(priv->dev);
} | false | false | false | false | false | 0 |
rc_avpair_get (VALUE_PAIR *vp, int attrid, int vendorpec)
{
for (; vp != NULL && !(ATTRID(vp->attribute) == ATTRID(attrid) &&
VENDOR(vp->attribute) == vendorpec); vp = vp->next)
{
continue;
}
return vp;
} | false | false | false | false | false | 0 |
ReadLineAddNewHeader()
{
append_more_headers= &ReadLineAddNewHeader;
Buffer *bufptr;
if (opta.Length()) bufptr= &opta;
else if (optA.Length()) bufptr= &optA;
else if (opti.Length()) bufptr= &opti;
else if (optI.Length()) bufptr= &optI;
else if (optUbuf.Length()) bufptr= &optUbuf;
else
{
append_more_headers=&ReadLineAddNewHeaderDone;
return ("\n");
}
static Buffer buf1;
Buffer buf2;
buf1.reset();
const char *p= *bufptr;
int l= bufptr->Length();
while (l)
{
if ( !*p )
{
p++;
l--;
break;
}
buf1.push( *p );
p++;
l--;
}
buf1.push('\n');
buf1.push('\0');
while (l--)
buf2.push (*p++);
*bufptr=buf2;
return (buf1);
} | false | false | false | false | false | 0 |
Scheduler (int block)
{
/* One wants to be a bit careful about setting returnValue
* to one, since a one implies we did some useful work,
* and therefore probably won't be called to block next
* time (TN3270 mode only).
*/
int returnValue;
int netin, netout, netex, ttyin, ttyout;
/* Decide which rings should be processed */
netout = ring_full_count (&netoring) &&
(flushline || (my_want_state_is_wont (TELOPT_LINEMODE)
#ifdef KLUDGELINEMODE
&& (!kludgelinemode || my_want_state_is_do (TELOPT_SGA))
#endif
) || my_want_state_is_will (TELOPT_BINARY));
ttyout = ring_full_count (&ttyoring);
#if defined TN3270
ttyin = ring_empty_count (&ttyiring) && (shell_active == 0);
#else /* defined(TN3270) */
ttyin = ring_empty_count (&ttyiring);
#endif /* defined(TN3270) */
#if defined TN3270
netin = ring_empty_count (&netiring);
#else /* !defined(TN3270) */
netin = !ISend && ring_empty_count (&netiring);
#endif /* !defined(TN3270) */
netex = !SYNCHing;
/* If we have seen a signal recently, reset things */
#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
if (HaveInput)
{
HaveInput = 0;
signal (SIGIO, inputAvailable);
}
#endif /* TN3270 && (unix || __unix || __unix__) */
/* Call to system code to process rings */
returnValue = process_rings (netin, netout, netex, ttyin, ttyout, !block);
/* Now, look at the input rings, looking for work to do. */
if (ring_full_count (&ttyiring))
{
#if defined TN3270
if (In3270)
{
int c;
c = DataFromTerminal (ttyiring.consume,
ring_full_consecutive (&ttyiring));
if (c)
{
returnValue = 1;
ring_consumed (&ttyiring, c);
}
}
else
{
#endif /* defined(TN3270) */
returnValue |= telsnd ();
#if defined TN3270
}
#endif /* defined(TN3270) */
}
if (ring_full_count (&netiring))
{
#if !defined TN3270
returnValue |= telrcv ();
#else /* !defined(TN3270) */
returnValue = Push3270 ();
#endif /* !defined(TN3270) */
}
return returnValue;
} | false | false | false | false | false | 0 |
prunecmd(UAContext *ua, const char *cmd)
{
DIRRES *dir;
CLIENT *client;
POOL *pool;
POOL_DBR pr;
MEDIA_DBR mr;
utime_t retention;
int kw;
static const char *keywords[] = {
NT_("Files"),
NT_("Jobs"),
NT_("Volume"),
NT_("Stats"),
NULL};
if (!open_client_db(ua)) {
return false;
}
/* First search args */
kw = find_arg_keyword(ua, keywords);
if (kw < 0 || kw > 3) {
/* no args, so ask user */
kw = do_keyword_prompt(ua, _("Choose item to prune"), keywords);
}
switch (kw) {
case 0: /* prune files */
client = get_client_resource(ua);
if (find_arg_with_value(ua, "pool") >= 0) {
pool = get_pool_resource(ua);
} else {
pool = NULL;
}
/* Pool File Retention takes precedence over client File Retention */
if (pool && pool->FileRetention > 0) {
if (!confirm_retention(ua, &pool->FileRetention, "File")) {
return false;
}
} else if (!client || !confirm_retention(ua, &client->FileRetention, "File")) {
return false;
}
prune_files(ua, client, pool);
return true;
case 1: /* prune jobs */
client = get_client_resource(ua);
if (find_arg_with_value(ua, "pool") >= 0) {
pool = get_pool_resource(ua);
} else {
pool = NULL;
}
/* Pool Job Retention takes precedence over client Job Retention */
if (pool && pool->JobRetention > 0) {
if (!confirm_retention(ua, &pool->JobRetention, "Job")) {
return false;
}
} else if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) {
return false;
}
/* ****FIXME**** allow user to select JobType */
prune_jobs(ua, client, pool, JT_BACKUP);
return 1;
case 2: /* prune volume */
if (!select_pool_and_media_dbr(ua, &pr, &mr)) {
return false;
}
if (mr.Enabled == 2) {
ua->error_msg(_("Cannot prune Volume \"%s\" because it is archived.\n"),
mr.VolumeName);
return false;
}
if (!confirm_retention(ua, &mr.VolRetention, "Volume")) {
return false;
}
prune_volume(ua, &mr);
return true;
case 3: /* prune stats */
dir = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
if (!dir->stats_retention) {
return false;
}
retention = dir->stats_retention;
if (!confirm_retention(ua, &retention, "Statistics")) {
return false;
}
prune_stats(ua, retention);
return true;
default:
break;
}
return true;
} | false | false | false | false | false | 0 |
refresh_authorization_thread (GSimpleAsyncResult *result, GDataAuthorizer *authorizer, GCancellable *cancellable)
{
GError *error = NULL;
/* Refresh the authorisation and return */
gdata_authorizer_refresh_authorization (authorizer, cancellable, &error);
if (error != NULL) {
g_simple_async_result_set_from_error (result, error);
g_error_free (error);
}
} | false | false | false | false | false | 0 |
scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage,
unsigned char *buffer, int len, int timeout, int retries,
struct scsi_mode_data *data, struct scsi_sense_hdr *sshdr)
{
unsigned char cmd[10];
unsigned char *real_buffer;
int ret;
memset(cmd, 0, sizeof(cmd));
cmd[1] = (pf ? 0x10 : 0) | (sp ? 0x01 : 0);
if (sdev->use_10_for_ms) {
if (len > 65535)
return -EINVAL;
real_buffer = kmalloc(8 + len, GFP_KERNEL);
if (!real_buffer)
return -ENOMEM;
memcpy(real_buffer + 8, buffer, len);
len += 8;
real_buffer[0] = 0;
real_buffer[1] = 0;
real_buffer[2] = data->medium_type;
real_buffer[3] = data->device_specific;
real_buffer[4] = data->longlba ? 0x01 : 0;
real_buffer[5] = 0;
real_buffer[6] = data->block_descriptor_length >> 8;
real_buffer[7] = data->block_descriptor_length;
cmd[0] = MODE_SELECT_10;
cmd[7] = len >> 8;
cmd[8] = len;
} else {
if (len > 255 || data->block_descriptor_length > 255 ||
data->longlba)
return -EINVAL;
real_buffer = kmalloc(4 + len, GFP_KERNEL);
if (!real_buffer)
return -ENOMEM;
memcpy(real_buffer + 4, buffer, len);
len += 4;
real_buffer[0] = 0;
real_buffer[1] = data->medium_type;
real_buffer[2] = data->device_specific;
real_buffer[3] = data->block_descriptor_length;
cmd[0] = MODE_SELECT;
cmd[4] = len;
}
ret = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, real_buffer, len,
sshdr, timeout, retries, NULL);
kfree(real_buffer);
return ret;
} | false | false | false | false | false | 0 |
bendian_short(const uint16_t s)
{
uint16_t r = 1;
if (!*(uint8_t *)&r)
return s;
r = (s & 0x00FF) << 8 | (s & 0xFF00) >> 8;
return r;
} | false | false | false | false | false | 0 |
winsync_plugin_call_pre_ad_add_user_cb(const Repl_Agmt *ra, Slapi_Entry *ad_entry,
Slapi_Entry *ds_entry)
{
WINSYNC_PLUGIN_CALL_PLUGINS_COOKIE_BEGIN(WINSYNC_PLUGIN_PRE_AD_ADD_USER_CB,winsync_pre_ad_add_cb,thefunc)
(*thefunc)(cookie, ad_entry, ds_entry);
WINSYNC_PLUGIN_CALL_PLUGINS_END;
return;
} | false | false | false | false | false | 0 |
bin2hex(const unsigned char *p, size_t len)
{
unsigned int i;
ssize_t slen;
char *s;
slen = len * 2 + 1;
if (slen % 4)
slen += 4 - (slen % 4);
s = calloc(slen, 1);
if (unlikely(!s))
quit(1, "Failed to calloc in bin2hex");
for (i = 0; i < len; i++)
sprintf(s + (i * 2), "%02x", (unsigned int) p[i]);
return s;
} | false | false | false | false | true | 1 |
clutter_animation_has_property (ClutterAnimation *animation,
const gchar *property_name)
{
ClutterAnimationPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE);
g_return_val_if_fail (property_name != NULL, FALSE);
priv = animation->priv;
return g_hash_table_lookup (priv->properties, property_name) != NULL;
} | false | false | false | false | false | 0 |
pushDown()
{
if ((!mpGame) || (mPauseFlag))
{
return;
}
if (mNetMode)
{
mActionList.push_back(PlayerAction_Push_Down);
}
else
{
while(mpGame->setCurrentPiece(0, 1, 0)) ;
mpGame->forceUpdateGame();
}
} | false | false | false | false | false | 0 |
Curl_add_custom_headers(struct connectdata *conn,
Curl_send_buffer *req_buffer)
{
char *ptr;
struct curl_slist *headers=conn->data->set.headers;
while(headers) {
ptr = strchr(headers->data, ':');
if(ptr) {
/* we require a colon for this to be a true header */
ptr++; /* pass the colon */
while(*ptr && ISSPACE(*ptr))
ptr++;
if(*ptr) {
/* only send this if the contents was non-blank */
if(conn->allocptr.host &&
/* a Host: header was sent already, don't pass on any custom Host:
header as that will produce *two* in the same request! */
checkprefix("Host:", headers->data))
;
else if(conn->data->set.httpreq == HTTPREQ_POST_FORM &&
/* this header (extended by formdata.c) is sent later */
checkprefix("Content-Type:", headers->data))
;
else if(conn->bits.authneg &&
/* while doing auth neg, don't allow the custom length since
we will force length zero then */
checkprefix("Content-Length", headers->data))
;
else if(conn->allocptr.te &&
/* when asking for Transfer-Encoding, don't pass on a custom
Connection: */
checkprefix("Connection", headers->data))
;
else {
CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n",
headers->data);
if(result)
return result;
}
}
}
else {
ptr = strchr(headers->data, ';');
if(ptr) {
ptr++; /* pass the semicolon */
while(*ptr && ISSPACE(*ptr))
ptr++;
if(*ptr) {
/* this may be used for something else in the future */
}
else {
if(*(--ptr) == ';') {
CURLcode result;
/* send no-value custom header if terminated by semicolon */
*ptr = ':';
result = Curl_add_bufferf(req_buffer, "%s\r\n",
headers->data);
if(result)
return result;
}
}
}
}
headers = headers->next;
}
return CURLE_OK;
} | false | false | false | false | false | 0 |
gkd_secret_session_set_item_secret (GkdSecretSession *self, GckObject *item,
GkdSecretSecret *secret, DBusError *derr)
{
GckBuilder builder = GCK_BUILDER_INIT;
GckMechanism mech;
GckObject *object;
GckSession *session;
GError *error = NULL;
GckAttributes *attrs;
g_return_val_if_fail (GKD_SECRET_IS_SESSION (self), FALSE);
g_return_val_if_fail (GCK_IS_OBJECT (item), FALSE);
g_return_val_if_fail (secret, FALSE);
g_assert (GCK_IS_OBJECT (self->key));
/*
* By getting these attributes, and then using them in the unwrap,
* the unwrap won't generate a new object, but merely set the secret.
*/
attrs = gck_object_get (item, NULL, &error, CKA_ID, CKA_G_COLLECTION, GCK_INVALID);
if (attrs == NULL) {
g_message ("couldn't get item attributes: %s", egg_error_message (error));
dbus_set_error_const (derr, DBUS_ERROR_FAILED, "Couldn't set item secret");
g_clear_error (&error);
return FALSE;
}
gck_builder_add_all (&builder, attrs);
gck_attributes_unref (attrs);
gck_builder_add_ulong (&builder, CKA_CLASS, CKO_SECRET_KEY);
session = gkd_secret_service_get_pkcs11_session (self->service, self->caller);
g_return_val_if_fail (session, FALSE);
mech.type = self->mech_type;
mech.parameter = secret->parameter;
mech.n_parameter = secret->n_parameter;
object = gck_session_unwrap_key_full (session, self->key, &mech, secret->value,
secret->n_value, gck_builder_end (&builder), NULL, &error);
if (object == NULL) {
if (g_error_matches (error, GCK_ERROR, CKR_USER_NOT_LOGGED_IN)) {
dbus_set_error_const (derr, SECRET_ERROR_IS_LOCKED,
"Cannot set secret of a locked item");
} else if (g_error_matches (error, GCK_ERROR, CKR_WRAPPED_KEY_INVALID) ||
g_error_matches (error, GCK_ERROR, CKR_WRAPPED_KEY_LEN_RANGE) ||
g_error_matches (error, GCK_ERROR, CKR_MECHANISM_PARAM_INVALID)) {
dbus_set_error_const (derr, DBUS_ERROR_INVALID_ARGS,
"The secret was transferred or encrypted in an invalid way.");
} else {
g_message ("couldn't unwrap item secret: %s", egg_error_message (error));
dbus_set_error_const (derr, DBUS_ERROR_FAILED, "Couldn't set item secret");
}
g_clear_error (&error);
return FALSE;
}
if (!gck_object_equal (object, item)) {
g_warning ("unwrapped secret went to new object, instead of item");
dbus_set_error_const (derr, DBUS_ERROR_FAILED, "Couldn't set item secret");
g_object_unref (object);
return FALSE;
}
g_object_unref (object);
return TRUE;
} | false | false | false | false | false | 0 |
reset_permutation(unsigned int* perm)
{
const unsigned int N = get_nof_vertices();
for(unsigned int i = 0; i < N; i++, perm++)
*perm = i;
} | false | false | false | false | false | 0 |
be_rx_cqs_create(struct be_adapter *adapter)
{
struct be_queue_info *eq, *cq;
struct be_rx_obj *rxo;
int rc, i;
/* We can create as many RSS rings as there are EQs. */
adapter->num_rss_qs = adapter->num_evt_qs;
/* We'll use RSS only if atleast 2 RSS rings are supported. */
if (adapter->num_rss_qs <= 1)
adapter->num_rss_qs = 0;
adapter->num_rx_qs = adapter->num_rss_qs + adapter->need_def_rxq;
/* When the interface is not capable of RSS rings (and there is no
* need to create a default RXQ) we'll still need one RXQ
*/
if (adapter->num_rx_qs == 0)
adapter->num_rx_qs = 1;
adapter->big_page_size = (1 << get_order(rx_frag_size)) * PAGE_SIZE;
for_all_rx_queues(adapter, rxo, i) {
rxo->adapter = adapter;
cq = &rxo->cq;
rc = be_queue_alloc(adapter, cq, RX_CQ_LEN,
sizeof(struct be_eth_rx_compl));
if (rc)
return rc;
u64_stats_init(&rxo->stats.sync);
eq = &adapter->eq_obj[i % adapter->num_evt_qs].q;
rc = be_cmd_cq_create(adapter, cq, eq, false, 3);
if (rc)
return rc;
}
dev_info(&adapter->pdev->dev,
"created %d RX queue(s)\n", adapter->num_rx_qs);
return 0;
} | false | false | false | false | false | 0 |
_wnck_get_string_property_latin1 (Screen *screen,
Window xwindow,
Atom atom)
{
Display *display;
Atom type;
int format;
gulong nitems;
gulong bytes_after;
gchar *str;
int err, result;
char *retval;
display = DisplayOfScreen (screen);
_wnck_error_trap_push (display);
str = NULL;
result = XGetWindowProperty (display,
xwindow, atom,
0, G_MAXLONG,
False, XA_STRING, &type, &format, &nitems,
&bytes_after, (guchar **)&str);
err = _wnck_error_trap_pop (display);
if (err != Success ||
result != Success)
return NULL;
if (type != XA_STRING)
{
XFree (str);
return NULL;
}
retval = g_strdup (str);
XFree (str);
return retval;
} | false | false | false | false | false | 0 |
change_directory_list(void)
{
trace(("change_directory_list()\n{\n"));
arglex();
change_identifier cid;
cid.command_line_parse_rest(change_directory_usage);
list_changes_in_state_mask
(
cid,
(
(1 << cstate_state_being_developed)
|
(1 << cstate_state_awaiting_review)
|
(1 << cstate_state_being_reviewed)
|
(1 << cstate_state_awaiting_integration)
|
(1 << cstate_state_being_integrated)
)
);
trace(("}\n"));
} | false | false | false | false | false | 0 |
get_user_var_real(const char *name,
double *value, int *null_value)
{
my_bool null_val;
user_var_entry *entry=
(user_var_entry*) my_hash_search(¤t_thd->user_vars,
(uchar*) name, strlen(name));
if (!entry)
return 1;
*value= entry->val_real(&null_val);
if (null_value)
*null_value= null_val;
return 0;
} | false | false | false | false | false | 0 |
ReadLink(const Arguments& args) {
HandleScope scope;
if (args.Length() < 1 || !args[0]->IsString()) {
return THROW_BAD_ARGS;
}
String::Utf8Value path(args[0]->ToString());
if (args[1]->IsFunction()) {
ASYNC_CALL(readlink, args[1], *path)
} else {
ssize_t bz = readlink(*path, getbuf, ARRAY_SIZE(getbuf) - 1);
if (bz == -1) return ThrowException(ErrnoException(errno, NULL, "", *path));
getbuf[ARRAY_SIZE(getbuf) - 1] = '\0';
return scope.Close(String::New(getbuf, bz));
}
} | false | false | false | false | false | 0 |
GetNumParts()
{
OGRGeometry *poGeom;
int numParts = 0;
poGeom = GetGeometryRef();
if (poGeom && wkbFlatten(poGeom->getGeometryType()) == wkbLineString)
{
/*-------------------------------------------------------------
* Simple polyline
*------------------------------------------------------------*/
numParts = 1;
}
else if (poGeom && wkbFlatten(poGeom->getGeometryType()) == wkbMultiLineString)
{
/*-------------------------------------------------------------
* Multiple polyline
*------------------------------------------------------------*/
OGRMultiLineString *poMultiLine = (OGRMultiLineString*)poGeom;
numParts = poMultiLine->getNumGeometries();
}
return numParts;
} | false | false | false | false | false | 0 |
_elm_calendar_smart_add(Evas_Object *obj)
{
time_t weekday = 259200; /* Just the first sunday since epoch */
time_t current_time;
int i, t;
EVAS_SMART_DATA_ALLOC(obj, Elm_Calendar_Smart_Data);
ELM_WIDGET_CLASS(_elm_calendar_parent_sc)->base.add(obj);
priv->first_interval = 0.85;
priv->year_min = 2;
priv->year_max = -1;
priv->today_it = -1;
priv->selected_it = -1;
priv->first_day_it = -1;
priv->format_func = _format_month_year;
priv->marks = NULL;
edje_object_signal_callback_add
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,increment,start", "*",
_button_inc_start, obj);
edje_object_signal_callback_add
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,decrement,start", "*",
_button_dec_start, obj);
edje_object_signal_callback_add
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,stop", "*",
_button_stop, obj);
edje_object_signal_callback_add
(ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,selected", "*",
_day_selected, obj);
for (i = 0; i < ELM_DAY_LAST; i++)
{
/* FIXME: I'm not aware of a known max, so if it fails,
* just make it larger. :| */
char buf[20];
/* I don't know of a better way of doing it */
if (strftime(buf, sizeof(buf), "%a", gmtime(&weekday)))
{
priv->weekdays[i] = eina_stringshare_add(buf);
}
else
{
/* If we failed getting day, get a default value */
priv->weekdays[i] = _days_abbrev[i];
WRN("Failed getting weekday name for '%s' from locale.",
_days_abbrev[i]);
}
weekday += 86400; /* Advance by a day */
}
current_time = time(NULL);
localtime_r(¤t_time, &priv->shown_time);
priv->current_time = priv->shown_time;
priv->selected_time = priv->shown_time;
t = _time_to_next_day(&priv->current_time);
priv->update_timer = ecore_timer_add(t, _update_cur_date, obj);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_layout_theme_set(obj, "calendar", "base", elm_object_style_get(obj));
evas_object_smart_changed(obj);
} | true | true | false | false | false | 1 |
simplify_control_stmt_condition (edge e,
gimple stmt,
gimple dummy_cond,
tree (*simplify) (gimple, gimple),
bool handle_dominating_asserts)
{
tree cond, cached_lhs;
enum gimple_code code = gimple_code (stmt);
/* For comparisons, we have to update both operands, then try
to simplify the comparison. */
if (code == GIMPLE_COND)
{
tree op0, op1;
enum tree_code cond_code;
op0 = gimple_cond_lhs (stmt);
op1 = gimple_cond_rhs (stmt);
cond_code = gimple_cond_code (stmt);
/* Get the current value of both operands. */
if (TREE_CODE (op0) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (op0);
if (tmp)
op0 = tmp;
}
if (TREE_CODE (op1) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (op1);
if (tmp)
op1 = tmp;
}
if (handle_dominating_asserts)
{
/* Now see if the operand was consumed by an ASSERT_EXPR
which dominates E->src. If so, we want to replace the
operand with the LHS of the ASSERT_EXPR. */
if (TREE_CODE (op0) == SSA_NAME)
op0 = lhs_of_dominating_assert (op0, e->src, stmt);
if (TREE_CODE (op1) == SSA_NAME)
op1 = lhs_of_dominating_assert (op1, e->src, stmt);
}
/* We may need to canonicalize the comparison. For
example, op0 might be a constant while op1 is an
SSA_NAME. Failure to canonicalize will cause us to
miss threading opportunities. */
if (tree_swap_operands_p (op0, op1, false))
{
tree tmp;
cond_code = swap_tree_comparison (cond_code);
tmp = op0;
op0 = op1;
op1 = tmp;
}
/* Stuff the operator and operands into our dummy conditional
expression. */
gimple_cond_set_code (dummy_cond, cond_code);
gimple_cond_set_lhs (dummy_cond, op0);
gimple_cond_set_rhs (dummy_cond, op1);
/* We absolutely do not care about any type conversions
we only care about a zero/nonzero value. */
fold_defer_overflow_warnings ();
cached_lhs = fold_binary (cond_code, boolean_type_node, op0, op1);
if (cached_lhs)
while (CONVERT_EXPR_P (cached_lhs))
cached_lhs = TREE_OPERAND (cached_lhs, 0);
fold_undefer_overflow_warnings ((cached_lhs
&& is_gimple_min_invariant (cached_lhs)),
stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
/* If we have not simplified the condition down to an invariant,
then use the pass specific callback to simplify the condition. */
if (!cached_lhs
|| !is_gimple_min_invariant (cached_lhs))
cached_lhs = (*simplify) (dummy_cond, stmt);
return cached_lhs;
}
if (code == GIMPLE_SWITCH)
cond = gimple_switch_index (stmt);
else if (code == GIMPLE_GOTO)
cond = gimple_goto_dest (stmt);
else
gcc_unreachable ();
/* We can have conditionals which just test the state of a variable
rather than use a relational operator. These are simpler to handle. */
if (TREE_CODE (cond) == SSA_NAME)
{
cached_lhs = cond;
/* Get the variable's current value from the equivalence chains.
It is possible to get loops in the SSA_NAME_VALUE chains
(consider threading the backedge of a loop where we have
a loop invariant SSA_NAME used in the condition. */
if (cached_lhs
&& TREE_CODE (cached_lhs) == SSA_NAME
&& SSA_NAME_VALUE (cached_lhs))
cached_lhs = SSA_NAME_VALUE (cached_lhs);
/* If we're dominated by a suitable ASSERT_EXPR, then
update CACHED_LHS appropriately. */
if (handle_dominating_asserts && TREE_CODE (cached_lhs) == SSA_NAME)
cached_lhs = lhs_of_dominating_assert (cached_lhs, e->src, stmt);
/* If we haven't simplified to an invariant yet, then use the
pass specific callback to try and simplify it further. */
if (cached_lhs && ! is_gimple_min_invariant (cached_lhs))
cached_lhs = (*simplify) (stmt, stmt);
}
else
cached_lhs = NULL;
return cached_lhs;
} | false | false | false | true | false | 1 |
find_logical(struct asr *asr)
{
int i, j;
struct asr_raidtable *rt = asr->rt;
/* This MUST be done backwards! */
for (i = rt->elmcnt - 1; i > -1; i--) {
if (rt->ent[i].raidmagic == asr->rb.drivemagic) {
for (j = i - 1; j > -1; j--) {
if (rt->ent[j].raidlevel == FWL)
return rt->ent + j;
}
}
}
return NULL;
} | false | false | false | false | false | 0 |
GB_Store(GB_TYPE type, GB_VALUE *src, void *dst)
{
if (src != NULL)
VALUE_write((VALUE *)src, dst, type);
else
VALUE_free(dst, type);
} | false | false | false | false | false | 0 |
decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
boost.set(0,0,0);
rotation = axisAngle();
} | false | false | false | false | false | 0 |
outc(wint_t c, int width) {
int i;
putwchar(c);
if (must_use_uc && (curmode&UNDERL)) {
for (i = 0; i < width; i++)
print_out(CURS_LEFT);
for (i = 0; i < width; i++)
print_out(UNDER_CHAR);
}
} | false | false | false | false | false | 0 |
tonemap_setDefaultInputTraits (
IP_XFORM_HANDLE hXform, /* in: handle for xform */
PIP_IMAGE_TRAITS pTraits) /* in: default image traits */
{
PTMAP_INST g;
HANDLE_TO_PTR (hXform, g);
/* insure that traits we care about are known */
INSURE (pTraits->iPixelsPerRow>0 && pTraits->iBitsPerPixel>1);
g->traits = *pTraits; /* a structure copy */
g->dwBytesPerRow = (g->traits.iPixelsPerRow*g->traits.iBitsPerPixel + 7) / 8;
return IP_DONE;
fatal_error:
return IP_FATAL_ERROR;
} | false | false | false | false | false | 0 |
scan_should_stop(void)
{
if (!kmemleak_enabled)
return 1;
/*
* This function may be called from either process or kthread context,
* hence the need to check for both stop conditions.
*/
if (current->mm)
return signal_pending(current);
else
return kthread_should_stop();
return 0;
} | false | false | false | false | false | 0 |
find_embedded_crc32(const char* filepath, unsigned* crc32_be)
{
const char* e = filepath + strlen(filepath) - 10;
/* search for the sum enclosed in brackets */
for(; e >= filepath && !IS_PATH_SEPARATOR(*e); e--) {
if((*e == '[' && e[9] == ']') || (*e == '(' && e[9] == ')')) {
const char *p = e + 8;
for(; p > e && IS_HEX(*p); p--);
if(p == e) {
rhash_hex_to_byte(e + 1, (char unsigned*)crc32_be, 8);
return 1;
}
e -= 9;
}
}
return 0;
} | false | false | false | false | false | 0 |
selectedRows() const
{
QModelIndexList selectedIndexes = ui->scriptView->selectionModel()->selectedIndexes();
if(selectedIndexes.count() == 0)
return QList<int>();
QList<int> selectedRows;
foreach(const QModelIndex &index, selectedIndexes)
{
if(index.column() == ScriptModel::ColumnLabel)
selectedRows << index.row();
}
return selectedRows;
} | false | false | false | false | false | 0 |
check_acm(netsnmp_agent_session *asp, u_char type)
{
int view;
int i, j, k;
netsnmp_request_info *request;
int ret = 0;
netsnmp_variable_list *vb, *vb2, *vbc;
int earliest = 0;
for (i = 0; i <= asp->treecache_num; i++) {
for (request = asp->treecache[i].requests_begin;
request; request = request->next) {
/*
* for each request, run it through in_a_view()
*/
earliest = 0;
for(j = request->repeat, vb = request->requestvb_start;
vb && j > -1;
j--, vb = vb->next_variable) {
if (vb->type != ASN_NULL &&
vb->type != ASN_PRIV_RETRY) { /* not yet processed */
view =
in_a_view(vb->name, &vb->name_length,
asp->pdu, vb->type);
/*
* if a ACM error occurs, mark it as type passed in
*/
if (view != VACM_SUCCESS) {
ret++;
if (request->repeat < request->orig_repeat) {
/* basically this means a GETBULK */
request->repeat++;
if (!earliest) {
request->requestvb = vb;
earliest = 1;
}
/* ugh. if a whole now exists, we need to
move the contents up the chain and fill
in at the end else we won't end up
lexographically sorted properly */
if (j > -1 && vb->next_variable &&
vb->next_variable->type != ASN_NULL &&
vb->next_variable->type != ASN_PRIV_RETRY) {
for(k = j, vbc = vb, vb2 = vb->next_variable;
k > -2 && vbc && vb2;
k--, vbc = vb2, vb2 = vb2->next_variable) {
/* clone next into the current */
snmp_clone_var(vb2, vbc);
vbc->next_variable = vb2;
}
}
}
snmp_set_var_typed_value(vb, type, NULL, 0);
}
}
}
}
}
return ret;
} | false | false | false | false | false | 0 |
test_parse_with_bad_binary_encoding (void)
{
GError *error = NULL;
GckUriData *uri_data;
uri_data = gck_uri_parse ("pkcs11:id=%%", GCK_URI_FOR_ANY, &error);
g_assert (!uri_data);
g_assert_error (error, GCK_URI_ERROR, GCK_URI_BAD_ENCODING);
g_error_free (error);
} | false | false | false | false | false | 0 |
load_ugly_table(FILE *fp)
{
char buf[4096];
struct nstat_ent *db = NULL;
struct nstat_ent *n;
while (fgets(buf, sizeof(buf), fp) != NULL) {
char idbuf[sizeof(buf)];
int off;
char *p;
p = strchr(buf, ':');
if (!p)
abort();
*p = 0;
idbuf[0] = 0;
strncat(idbuf, buf, sizeof(idbuf) - 1);
off = p - buf;
p += 2;
while (*p) {
char *next;
if ((next = strchr(p, ' ')) != NULL)
*next++ = 0;
else if ((next = strchr(p, '\n')) != NULL)
*next++ = 0;
if (off < sizeof(idbuf)) {
idbuf[off] = 0;
strncat(idbuf, p, sizeof(idbuf) - off - 1);
}
n = malloc(sizeof(*n));
if (!n)
abort();
n->id = strdup(idbuf);
n->rate = 0;
n->next = db;
db = n;
p = next;
}
n = db;
if (fgets(buf, sizeof(buf), fp) == NULL)
abort();
do {
p = strrchr(buf, ' ');
if (!p)
abort();
*p = 0;
if (sscanf(p+1, "%lu", &n->ival) != 1)
abort();
n->val = n->ival;
/* Trick to skip "dummy" trailing ICMP MIB in 2.4 */
if (strcmp(idbuf, "IcmpOutAddrMaskReps") == 0)
idbuf[5] = 0;
else
n = n->next;
} while (p > buf + off + 2);
}
while (db) {
n = db;
db = db->next;
if (useless_number(n->id)) {
free(n->id);
free(n);
} else {
n->next = kern_db;
kern_db = n;
}
}
} | true | true | false | false | false | 1 |
showlocs(void)
#else
static void showlocs()
#endif
{
char str[80];
int loc;
output("LOCATIONS:");
for (loc = LOCMIN; loc <= LOCMAX; loc++) {
sprintf(str, "$i%3ld: ", (long) loc);
output(str);
say(loc);
}
} | false | false | false | false | false | 0 |
QueryDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
{
sql_free_result(mdb);
if (!sql_query(mdb, cmd, QF_STORE_RESULT)) {
m_msg(file, line, &mdb->errmsg, _("query %s failed:\n%s\n"), cmd, sql_strerror(mdb));
j_msg(file, line, jcr, M_FATAL, 0, "%s", mdb->errmsg);
if (verbose) {
j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
}
return 0;
}
return 1;
} | false | false | false | false | false | 0 |
igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens,
u32 type_tucmd, u32 mss_l4len_idx)
{
struct e1000_adv_tx_context_desc *context_desc;
u16 i = tx_ring->next_to_use;
context_desc = IGB_TX_CTXTDESC(tx_ring, i);
i++;
tx_ring->next_to_use = (i < tx_ring->count) ? i : 0;
/* set bits to identify this as an advanced context descriptor */
type_tucmd |= E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT;
/* For 82575, context index must be unique per ring. */
if (test_bit(IGB_RING_FLAG_TX_CTX_IDX, &tx_ring->flags))
mss_l4len_idx |= tx_ring->reg_idx << 4;
context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens);
context_desc->seqnum_seed = 0;
context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd);
context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx);
} | false | false | false | false | false | 0 |
makeSchematicSvg(const QString & expectedFileName)
{
QStringList pieces = expectedFileName.split("_");
int pins = pieces.at(2).toInt();
double increment = GraphicsUtils::StandardSchematicSeparationMils / 1000;
double incrementPoints = increment * 72; // 72 dpi
QString header("<?xml version='1.0' encoding='utf-8'?>\n"
"<svg version='1.1' baseProfile='basic' id='svg2' xmlns:svg='http://www.w3.org/2000/svg'\n"
"xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='0.87in'\n"
"height='%1in' viewBox='0 0 62.641 [%2]' xml:space='preserve'>\n"
"<g id='schematic'>\n");
QString repeat("<line id='connector%1pin' fill='none' stroke='#000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' x1='0.998' y1='[9.723]' x2='17.845' y2='[9.723]'/>\n"
"<rect id='connector%1terminal' x='0' y='[8.725]' width='0.998' height='1.997'/>\n"
"<circle fill='none' stroke-width='2' stroke='#000000' cx='52.9215' cy='[9.723]' r='8.7195' />\n"
"<line id='line' fill='none' stroke='#000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' x1='43.202' y1='[9.723]' x2='16.452' y2='[9.723]'/>\n");
QString svg = TextUtils::incrementTemplateString(header.arg(increment * pins).arg(incrementPoints), 1, incrementPoints * (pins - 1), TextUtils::incMultiplyPinFunction, TextUtils::noCopyPinFunction, NULL);
svg += TextUtils::incrementTemplateString(repeat, pins, incrementPoints, TextUtils::standardMultiplyPinFunction, TextUtils::standardCopyPinFunction, NULL);
svg += "</g>\n</svg>";
return svg;
} | false | false | false | false | false | 0 |
trivial_hashR(unsigned char *buf, size_t len)
{
u_int32_t h = 0;
buf += len-1;
while(len--) {
h = h + *buf--;
h = ROT32R(h, 3);
}
return h;
} | false | false | false | false | false | 0 |
add_char(char c)
{
if (stk.last->cur - stk.last->buf == stk.last->size) resize_buffer(1);
*(stk.last->cur++) = c;
} | false | false | false | false | false | 0 |
help_exec ( int argc __unused, char **argv __unused ) {
struct command *command;
unsigned int hpos = 0;
printf ( "\nAvailable commands:\n\n" );
for_each_table_entry ( command, COMMANDS ) {
hpos += printf ( " %s", command->name );
if ( hpos > ( 16 * 4 ) ) {
printf ( "\n" );
hpos = 0;
} else {
while ( hpos % 16 ) {
printf ( " " );
hpos++;
}
}
}
printf ( "\n\nType \"<command> --help\" for further information\n\n" );
return 0;
} | false | false | false | false | false | 0 |
threads_dispatch_free(gpointer data) {
threads_dispatch_t * dispatch = data;
if (dispatch->destroy && dispatch->data) {
dispatch->destroy(dispatch->data);
}
g_slice_free(threads_dispatch_t, data);
} | false | false | false | false | false | 0 |
grid_random_alphanum(gint length)
{
gint i, decide;
GRand *r;
GString *text;
r = g_rand_new();
text = g_string_new(NULL);
/* NB: some systems require an alphabetical character first */
g_string_sprintfa(text, "%c", g_rand_int_range(r, 'a', 'z'));
i=1;
while (i<length)
{
decide = g_rand_int_range(r, 0, 99);
if (decide < 50)
g_string_sprintfa(text, "%c", g_rand_int_range(r, 'a', 'z'));
else
g_string_sprintfa(text, "%c", g_rand_int_range(r, '0', '9'));
i++;
}
g_rand_free(r);
return(g_string_free(text, FALSE));
} | false | false | false | false | false | 0 |
ProbeList(ALCchar **list, size_t *listsize, enum DevProbe type)
{
DO_INITCONFIG();
LockLists();
free(*list);
*list = NULL;
*listsize = 0;
if(type == ALL_DEVICE_PROBE && PlaybackBackend.Probe)
PlaybackBackend.Probe(type);
else if(type == CAPTURE_DEVICE_PROBE && CaptureBackend.Probe)
CaptureBackend.Probe(type);
UnlockLists();
} | false | false | false | false | false | 0 |
jack_session_commands_free (jack_session_command_t *cmds)
{
int i=0;
while(1) {
if (cmds[i].client_name)
free ((char *)cmds[i].client_name);
if (cmds[i].command)
free ((char *)cmds[i].command);
if (cmds[i].uuid)
free ((char *)cmds[i].uuid);
else
break;
i += 1;
}
free(cmds);
} | true | true | false | false | false | 1 |
setCompassCTRL6()
{
unsigned char ctrl6;
// convert FSR to uT
switch (m_settings->m_GD20HM303DCompassFsr) {
case LSM303D_COMPASS_FSR_2:
ctrl6 = 0;
m_compassScale = (RTFLOAT)0.008;
break;
case LSM303D_COMPASS_FSR_4:
ctrl6 = 0x20;
m_compassScale = (RTFLOAT)0.016;
break;
case LSM303D_COMPASS_FSR_8:
ctrl6 = 0x40;
m_compassScale = (RTFLOAT)0.032;
break;
case LSM303D_COMPASS_FSR_12:
ctrl6 = 0x60;
m_compassScale = (RTFLOAT)0.0479;
break;
default:
HAL_ERROR1("Illegal LSM303D compass FSR code %d\n", m_settings->m_GD20HM303DCompassFsr);
return false;
}
return m_settings->HALWrite(m_accelCompassSlaveAddr, LSM303D_CTRL6, ctrl6, "Failed to set LSM303D CTRL6");
} | false | false | false | false | false | 0 |
bs_ssc_close(struct scsi_lu *lu)
{
struct ssc_info *ssc;
ssc = dtype_priv(lu);
dprintf("##### Close #####\n");
close(lu->fd);
} | false | false | false | false | false | 0 |
Process2FirewallUDP(const uint8_t *packetData, uint32_t lenPacket, uint32_t ip)
{
// Verify packet is expected size
CHECK_PACKET_MIN_SIZE(3);
uint8_t errorCode = PeekUInt8(packetData);
uint16_t incomingPort = PeekUInt16(packetData + 1);
if ((incomingPort != CKademlia::GetPrefs()->GetExternalKadPort() && incomingPort != CKademlia::GetPrefs()->GetInternKadPort()) || incomingPort == 0) {
AddDebugLogLineN(logClientKadUDP, CFormat(wxT("Received UDP FirewallCheck on unexpected incoming port %u from %s")) % incomingPort % KadIPToString(ip));
CUDPFirewallTester::SetUDPFWCheckResult(false, true, ip, 0);
} else if (errorCode == 0) {
AddDebugLogLineN(logClientKadUDP, CFormat(wxT("Received UDP FirewallCheck packet from %s with incoming port %u")) % KadIPToString(ip) % incomingPort);
CUDPFirewallTester::SetUDPFWCheckResult(true, false, ip, incomingPort);
} else {
AddDebugLogLineN(logClientKadUDP, CFormat(wxT("Received UDP FirewallCheck packet from %s with incoming port %u with remote errorcode %u - ignoring result"))
% KadIPToString(ip) % incomingPort % errorCode);
CUDPFirewallTester::SetUDPFWCheckResult(false, true, ip, 0);
}
} | false | false | false | false | false | 0 |
mds_idle_func (PluginInstance *inst)
{
ggvisd *ggv = ggvisFromInst (inst);
ggobid *gg = inst->gg;
gboolean doit = ggv->running_p;
if (doit) {
mds_once (true, ggv, gg);
update_ggobi (ggv, gg);
}
return (doit);
} | false | false | false | false | false | 0 |
cec_get_device_power_status(cec_logical_address iLogicalAddress)
{
if (cec_parser)
return cec_parser->GetDevicePowerStatus(iLogicalAddress);
return CEC_POWER_STATUS_UNKNOWN;
} | false | false | false | false | false | 0 |
L6()
{register object *base=vs_base;
register object *sup=base+VM6; VC6
vs_check;
{object V13;
object V14;
object V15;
V13=(base[0]);
V14=(base[1]);
V15=(base[2]);
vs_top=sup;
goto TTL;
TTL:;
base[3]= list(4,((object)VV[30]),((object)VV[31]),list(4,((object)VV[30]),((object)VV[32]),list(2,((object)VV[33]),list(2,((object)VV[23]),(V13))),(V14)),(V15));
vs_top=(vs_base=base+3)+1;
return;
}
} | false | false | false | false | false | 0 |
cpio_append_fts_entry (FTSENT *entry)
{
if (entry->fts_info & FTS_NS || entry->fts_info & FTS_NSOK)
cpio_append (entry->fts_path);
else
cpio_append_stat (entry->fts_path, entry->fts_statp);
} | false | false | false | false | false | 0 |
mousePressEvent(QMouseEvent *event)
{
int index = segmentAt(event->pos());
if (segmentEnabled(index)) {
d->wasPressed = d->focusIndex = d->pressedIndex = segmentAt(event->pos());
d->postUpdate(d->pressedIndex);
}
} | false | false | false | false | false | 0 |
appendGraphicsPath (char *newPath)
{
int i;
void *ptr;
char *add;
for (i = 0; i < nGraphicsPathElems; i++)
{
if (streq (graphicsPath[i], newPath)) {
diagnostics(WARNING,"Repeated graphics path element {%s}",newPath);
return;
}
}
ptr = (void *) graphicsPath;
ptr = realloc (ptr, sizeof (char *) * (nGraphicsPathElems + 1));
graphicsPath = (char **) ptr;
/* path must end with a '/' */
if (*(newPath+strlen(newPath)-1) == '/')
add = strdup(newPath);
else
add = strdup_together(newPath,"/");
graphicsPath[nGraphicsPathElems++] = add;
diagnostics (WARNING, "Included %s in graphics search path", add);
} | false | false | false | false | false | 0 |
freeup()
/* Free all allocations in the 'found' list, the 'zfiles' list and
the 'patterns' list. */
{
struct flist far *f; /* steps through found list */
struct zlist far *z; /* pointer to next entry in zfiles list */
for (f = found; f != NULL; f = fexpel(f))
;
while (zfiles != NULL)
{
z = zfiles->nxt;
if (zfiles->zname && zfiles->zname != zfiles->name)
free((zvoid *)(zfiles->zname));
if (zfiles->name)
free((zvoid *)(zfiles->name));
if (zfiles->iname)
free((zvoid *)(zfiles->iname));
if (zfiles->cext && zfiles->cextra && zfiles->cextra != zfiles->extra)
free((zvoid *)(zfiles->cextra));
if (zfiles->ext && zfiles->extra)
free((zvoid *)(zfiles->extra));
if (zfiles->com && zfiles->comment)
free((zvoid *)(zfiles->comment));
if (zfiles->oname)
free((zvoid *)(zfiles->oname));
#ifdef UNICODE_SUPPORT
if (zfiles->uname)
free((zvoid *)(zfiles->uname));
if (zfiles->zuname)
free((zvoid *)(zfiles->zuname));
if (zfiles->ouname)
free((zvoid *)(zfiles->ouname));
# ifdef WIN32
if (zfiles->namew)
free((zvoid *)(zfiles->namew));
if (zfiles->inamew)
free((zvoid *)(zfiles->inamew));
if (zfiles->znamew)
free((zvoid *)(zfiles->znamew));
# endif
#endif
farfree((zvoid far *)zfiles);
zfiles = z;
zcount--;
}
if (patterns != NULL) {
while (pcount-- > 0) {
if (patterns[pcount].zname != NULL)
free((zvoid *)(patterns[pcount].zname));
}
free((zvoid *)patterns);
patterns = NULL;
}
/* close logfile */
if (logfile) {
fclose(logfile);
}
} | false | false | false | false | false | 0 |
affs_insert_hash(struct inode *dir, struct buffer_head *bh)
{
struct super_block *sb = dir->i_sb;
struct buffer_head *dir_bh;
u32 ino, hash_ino;
int offset;
ino = bh->b_blocknr;
offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]);
pr_debug("%s(dir=%lu, ino=%d)\n", __func__, dir->i_ino, ino);
dir_bh = affs_bread(sb, dir->i_ino);
if (!dir_bh)
return -EIO;
hash_ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[offset]);
while (hash_ino) {
affs_brelse(dir_bh);
dir_bh = affs_bread(sb, hash_ino);
if (!dir_bh)
return -EIO;
hash_ino = be32_to_cpu(AFFS_TAIL(sb, dir_bh)->hash_chain);
}
AFFS_TAIL(sb, bh)->parent = cpu_to_be32(dir->i_ino);
AFFS_TAIL(sb, bh)->hash_chain = 0;
affs_fix_checksum(sb, bh);
if (dir->i_ino == dir_bh->b_blocknr)
AFFS_HEAD(dir_bh)->table[offset] = cpu_to_be32(ino);
else
AFFS_TAIL(sb, dir_bh)->hash_chain = cpu_to_be32(ino);
affs_adjust_checksum(dir_bh, ino);
mark_buffer_dirty_inode(dir_bh, dir);
affs_brelse(dir_bh);
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
dir->i_version++;
mark_inode_dirty(dir);
return 0;
} | 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.