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 |
|---|---|---|---|---|---|---|
ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info,
struct list_head *ep_dist_list,
enum htc_credit_dist_reason reason)
{
switch (reason) {
case HTC_CREDIT_DIST_SEND_COMPLETE:
ath6kl_credit_update(cred_info, ep_dist_list);
break;
case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
ath6kl_credit_redistribute(cred_info, ep_dist_list);
break;
default:
break;
}
WARN_ON(cred_info->cur_free_credits > cred_info->total_avail_credits);
WARN_ON(cred_info->cur_free_credits < 0);
} | false | false | false | false | false | 0 |
PyFFGlyph_docompare(PyFF_Glyph *self,PyObject *other,
double pt_err, double spline_err) {
SplineSet *ss2;
int ret;
SplinePoint *badpoint;
if ( PyType_IsSubtype(&PyFF_GlyphType,((PyObject *)other)->ob_type) ) {
SplineChar *sc = self->sc;
SplineChar *sc2 = ((PyFF_Glyph *) other)->sc;
int olayer = ((PyFF_Glyph *) other)->layer;
int ret;
SplinePoint *dummy;
ret = CompareLayer(NULL,
sc->layers[self->layer].splines,sc2->layers[olayer].splines,
sc->layers[self->layer].refs,sc2->layers[olayer].refs,
pt_err,spline_err,sc->name,false,&dummy);
return( ret );
} else if ( PyType_IsSubtype(&PyFF_ContourType,((PyObject *)other)->ob_type) ) {
ss2 = SSFromContour((PyFF_Contour *) other,NULL);
} else if ( PyType_IsSubtype(&PyFF_LayerType,((PyObject *)other)->ob_type) ) {
ss2 = SSFromLayer((PyFF_Layer *) other);
} else {
PyErr_Format(PyExc_TypeError, "Unexpected type");
return( -1 );
}
if ( self->sc->layers[self->layer].refs!=NULL )
return( SS_NoMatch | SS_RefMismatch );
ret = SSsCompare(self->sc->layers[self->layer].splines,ss2,pt_err,spline_err,&badpoint);
SplinePointListsFree(ss2);
return(ret);
} | false | false | false | false | false | 0 |
set_discard_limits(struct cache *cache, struct queue_limits *limits)
{
/*
* FIXME: these limits may be incompatible with the cache device
*/
limits->max_discard_sectors = min_t(sector_t, cache->discard_block_size * 1024,
cache->origin_sectors);
limits->discard_granularity = cache->discard_block_size << SECTOR_SHIFT;
} | false | false | false | false | false | 0 |
insert( const char *name, struct pfs_stat *buf, pfs_dir *dir )
{
char path[PFS_PATH_MAX];
struct pfs_stat *copy;
if (!dircache_table) dircache_table = hash_table_create(0, 0);
dir->append(name);
copy = (struct pfs_stat *)xxmalloc(sizeof(struct pfs_stat));
*copy = *buf;
sprintf(path, "%s/%s", dircache_path, string_basename(name));
hash_table_insert(dircache_table, path, copy);
} | false | false | false | false | false | 0 |
cache_enter_group(void)
{
int tmp;
tmp = res_cache_ahead_size();
if (tmp > MAX_CACHE)
tmp = MAX_CACHE;
else if (tmp < 0)
tmp = 0;
ahead_size = tmp;
tmp = res_cache_trail_size();
if (tmp > MAX_CACHE)
tmp = MAX_CACHE;
else if (tmp < 0)
tmp = 0;
trail_size = tmp;
cache_dir = res_cache_dir();
if (!cache_dir)
cache_dir = "/tmp";
cache_dir_len = strlen(cache_dir);
if (global.show_cache)
popup_cache_stats();
if (ahead_size > 0)
bg_nudge(cache_proc);
} | false | false | false | false | false | 0 |
gee_linked_list_real_drain (GeeQueue* base, GeeCollection* recipient, gint amount) {
GeeLinkedList * self;
gint result = 0;
GeeCollection* _tmp0_ = NULL;
gint _tmp1_ = 0;
gint _tmp2_ = 0;
self = (GeeLinkedList*) base;
g_return_val_if_fail (recipient != NULL, 0);
_tmp0_ = recipient;
_tmp1_ = amount;
_tmp2_ = gee_deque_drain_head ((GeeDeque*) self, _tmp0_, _tmp1_);
result = _tmp2_;
return result;
} | false | false | false | false | false | 0 |
panel_act_MKDIR(this, other)
panel_t *this, *other;
{
size_t len;
char *input = NULL, *tmp_input;
if (!il_read_line("New directory name: ", &input, NULL, mkdir_history))
return;
if (input[0] == '\0')
{
xfree(input);
return;
}
tmp_input = tilde_expand(input);
xfree(input);
input = tmp_input;
/* Add a '/' at the end, otherwise panel_mkdirs() will think the
last component is a regular file and will not create the
directory. */
len = strlen(input);
input = realloc(input, len + 1 + 1);
input[len] = '/';
input[len + 1] = '\0';
/* I don't remember why I've put S_IFDIR here. Is it really
necessary? */
if (panel_mkdirs(input, S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) == -1)
{
panel_2s_message("%s: Permission denied.", input,
(char *)NULL,
IL_FREEZED | IL_BEEP | IL_SAVE | IL_ERROR);
xfree(input);
return;
}
if (!panel_read_directory(this, this->path, ON))
panel_recover(this);
else
{
/* If `input' is something like `a/b/c' we will default on the
first entry. */
this->current_entry = panel_find_index(this, input);
this->first_on_screen = panel_get_centered_fos(this);
panel_update_entries(this);
panel_update_info(this);
panel_update_size(this);
}
if (strcmp(this->path, other->path) == 0)
{
char *old_entry = xstrdup(other->dir_entry[other->current_entry].name);
if (!panel_read_directory(other, other->path, ON))
panel_recover(other);
else
{
other->current_entry = panel_find_index(other, old_entry);
other->first_on_screen = panel_get_centered_fos(other);
panel_update_entries(other);
panel_update_info(other);
}
xfree(old_entry);
}
panel_update_size(other);
xfree(input);
} | false | false | false | false | false | 0 |
test_runner_global_destructor()
{
test_runner_case *tmp_case, *test_case = test_runner_global_instance.case_list_head;
while (test_case) {
tmp_case = test_case->next_case;
test_runner_case_destructor(test_case);
test_case = tmp_case;
}
fprintf(
test_runner_global_instance.outstream,
TEST_RUNNER_MSG_TEST_RESULT,
test_runner_global_instance.test_count,
test_runner_global_instance.test_assert,
test_runner_global_instance.test_fail
);
if (test_runner_global_instance.test_fail) {
fprintf(
test_runner_global_instance.outstream,
TEST_RUNNER_MSG_ALL_FAILED
);
} else {
fprintf(
test_runner_global_instance.outstream,
TEST_RUNNER_MSG_ALL_PASS
);
}
} | false | false | false | false | false | 0 |
atk_text_get_character_extents (AtkText *text,
gint offset,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coords)
{
AtkTextIface *iface;
gint local_x, local_y, local_width, local_height;
gint *real_x, *real_y, *real_width, *real_height;
g_return_if_fail (ATK_IS_TEXT (text));
if (x)
real_x = x;
else
real_x = &local_x;
if (y)
real_y = y;
else
real_y = &local_y;
if (width)
real_width = width;
else
real_width = &local_width;
if (height)
real_height = height;
else
real_height = &local_height;
*real_x = 0;
*real_y = 0;
*real_width = 0;
*real_height = 0;
if (offset < 0)
return;
iface = ATK_TEXT_GET_IFACE (text);
if (iface->get_character_extents)
(*(iface->get_character_extents)) (text, offset, real_x, real_y, real_width, real_height, coords);
if (*real_width <0)
{
*real_x = *real_x + *real_width;
*real_width *= -1;
}
} | false | false | false | false | false | 0 |
getAttribute(UColAttribute attr,
UErrorCode &status) const
{
if (U_FAILURE(status))
return UCOL_DEFAULT;
return ucol_getAttribute(ucollator, attr, &status);
} | false | false | false | false | false | 0 |
uhelpform(const char *sofar, const int hf)
{
unsigned ucnt, sfl = 0;
char **result, **rp;
if (sofar)
sfl = strlen(sofar);
/* There cannot be more form types than the number of users can there.... */
result = (char **) malloc((Nusers + 2) * sizeof(char *));
if (!result)
return result;
rp = result;
if (strncmp(Spuhdr.sph_form, sofar, sfl) == 0)
*rp++ = stracpy(Spuhdr.sph_form);
for (ucnt = 0; ucnt < Nusers; ucnt++) {
if (strncmp(ulist[ucnt].spu_form, sofar, sfl) == 0) {
char **prev;
for (prev = result; prev < rp; prev++)
if (strcmp(ulist[ucnt].spu_form, *prev) == 0)
goto gotit;
*rp++ = stracpy(ulist[ucnt].spu_form);
}
gotit:
;
}
*rp++ = (char *) 0;
return result;
} | false | true | false | false | false | 1 |
arraycontsel(PG_FUNCTION_ARGS)
{
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
Oid operator = PG_GETARG_OID(1);
List *args = (List *) PG_GETARG_POINTER(2);
int varRelid = PG_GETARG_INT32(3);
VariableStatData vardata;
Node *other;
bool varonleft;
Selectivity selec;
Oid element_typeid;
/*
* If expression is not (variable op something) or (something op
* variable), then punt and return a default estimate.
*/
if (!get_restriction_variable(root, args, varRelid,
&vardata, &other, &varonleft))
PG_RETURN_FLOAT8(DEFAULT_SEL(operator));
/*
* Can't do anything useful if the something is not a constant, either.
*/
if (!IsA(other, Const))
{
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8(DEFAULT_SEL(operator));
}
/*
* The "&&", "@>" and "<@" operators are strict, so we can cope with a
* NULL constant right away.
*/
if (((Const *) other)->constisnull)
{
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8(0.0);
}
/*
* If var is on the right, commute the operator, so that we can assume the
* var is on the left in what follows.
*/
if (!varonleft)
{
if (operator == OID_ARRAY_CONTAINS_OP)
operator = OID_ARRAY_CONTAINED_OP;
else if (operator == OID_ARRAY_CONTAINED_OP)
operator = OID_ARRAY_CONTAINS_OP;
}
/*
* OK, there's a Var and a Const we're dealing with here. We need the
* Const to be an array with same element type as column, else we can't do
* anything useful. (Such cases will likely fail at runtime, but here
* we'd rather just return a default estimate.)
*/
element_typeid = get_base_element_type(((Const *) other)->consttype);
if (element_typeid != InvalidOid &&
element_typeid == get_base_element_type(vardata.vartype))
{
selec = calc_arraycontsel(&vardata, ((Const *) other)->constvalue,
element_typeid, operator);
}
else
{
selec = DEFAULT_SEL(operator);
}
ReleaseVariableStats(vardata);
CLAMP_PROBABILITY(selec);
PG_RETURN_FLOAT8((float8) selec);
} | false | false | false | false | false | 0 |
get_next()
{
unsigned int new_address = value + cpu_pic->program_memory[value]->instruction_size();
if (new_address >= memory_size)
{
printf("%s PC=0x%x >= memory size 0x%x\n", __FUNCTION__, new_address, memory_size);
bp.halt();
}
return( new_address);
} | false | false | false | false | false | 0 |
ftpGetFile(FtpStateData * ftpState)
{
assert(*ftpState->filepath != '\0');
ftpState->flags.isdir = 0;
ftpSendMdtm(ftpState);
} | false | false | false | false | false | 0 |
popupdead_check_buttons()
{
int i;
UI_BUTTON *b;
for ( i = 0; i < Popupdead_num_choices; i++ ) {
b = &Popupdead_button_regions[i];
if ( b->pressed() ) {
return i;
}
b = &Popupdead_buttons[i];
if ( b->pressed() ) {
return i;
}
}
return -1;
} | false | false | false | false | false | 0 |
getAnnotationText(UT_uint32 iAnnotation, std::string & sText) const
{
fl_AnnotationLayout * pAL = getAnnotationLayout(iAnnotation);
if(!pAL)
return false;
pf_Frag_Strux* sdhStart = pAL->getStruxDocHandle();
PT_DocPosition posStart = getDocument()->getStruxPosition(sdhStart)+1; // Pos of Block o Text
UT_GrowBuf buffer;
fl_BlockLayout * block;
block = m_pLayout->findBlockAtPosition(posStart+1);
fp_Run * pRun = NULL;
while(block && (static_cast<fl_AnnotationLayout *>(block->myContainingLayout()) == pAL))
{
UT_GrowBuf tmp;
block->getBlockBuf(&tmp);
pRun = block->getFirstRun();
while(pRun)
{
if(pRun->getType() == FPRUN_TEXT)
{
buffer.append(tmp.getPointer(pRun->getBlockOffset()),pRun->getLength());
}
pRun = pRun->getNextRun();
}
tmp.truncate(0);
block = block->getNextBlockInDocument();
}
UT_UCS4String uText(reinterpret_cast<const UT_UCS4Char *>( buffer.getPointer(0)),
buffer.getLength());
sText = uText.utf8_str();
return true;
} | false | false | false | false | false | 0 |
packet_add(struct cvm_packet* p,
const char* str, unsigned len)
{
unsigned char* ptr;
if (p->length + len + 1 >= CVM_BUFSIZE-1)
return 0;
ptr = p->data + p->length;
memcpy(ptr, str, len);
ptr[len] = 0;
p->length += len + 1;
return 1;
} | false | false | false | false | false | 0 |
StartBootloader(void)
{
if (m_port->IsOpen() && m_commands->StartBootloader())
{
m_port->Close();
return true;
}
return false;
} | false | false | false | false | false | 0 |
chirp_volume_open(const char *volume, time_t stoptime)
{
struct chirp_volume *v;
char filename[CHIRP_PATH_MAX];
char *buffer;
char *name;
char *c;
int result;
debug(D_MULTI, "opening volume %s", volume);
/*
The volume name must have at least one
at-sign in order to indicate the volname.
*/
c = strchr(volume, '@');
if(!c) {
errno = ENOENT;
return 0;
}
v = xxmalloc(sizeof(*v));
strcpy(v->name, volume);
/*
The stuff preceding the first at-sign is
the name of the host containing the directory.
*/
strcpy(v->host, v->name);
c = strchr(v->host, '@');
/* The rest is the logical name of the volume. */
strcpy(v->root, c);
*c = 0;
/* Convert any remaning at-signs to slashes */
for(c = v->root; *c; c++) {
if(*c == '@')
*c = '/';
}
/* Fetch the filesystem key */
sprintf(filename, "%s/key", v->root);
result = chirp_reli_getfile_buffer(v->host, filename, &buffer, stoptime);
if(result < 0) {
debug(D_CHIRP, "couldn't open %s: %s", filename, strerror(errno));
free(v);
errno = ENOENT;
return 0;
}
strcpy(v->key, buffer);
string_chomp(v->key);
free(buffer);
/* Fetch the list of hosts */
sprintf(filename, "%s/hosts", v->root);
result = chirp_reli_getfile_buffer(v->host, filename, &buffer, stoptime);
if(result < 0) {
debug(D_CHIRP, "couldn't open %s: %s", filename, strerror(errno));
free(v);
errno = ENOENT;
return 0;
}
/* Get an upper bound on the servers by counting the whitespace */
int maxservers = 0;
for(c = buffer; *c; c++)
if(isspace((int) *c))
maxservers++;
/* Allocate space for an array of servers */
v->servers = malloc(sizeof(struct chirp_server *) * maxservers);
v->nservers = 0;
debug(D_MULTI, "estimating %d servers", maxservers);
/* Break into whitespace and initialize the servers. */
name = strtok(buffer, " \t\n");
while(name) {
debug(D_MULTI, "server: %s", name);
struct chirp_server *s = xxmalloc(sizeof(*s));
strcpy(s->name, name);
s->priority = 0;
s->prepared = 0;
v->servers[v->nservers++] = s;
name = strtok(0, " \t\n");
}
/* randomly initialize the priority of the servers */
int i;
int n = rand() % v->nservers;
for(i = 0; i < n; i++)
v->servers[i]->priority++;
free(buffer);
return v;
} | false | true | false | false | true | 1 |
parse_host(char *host, char *hname, struct accessdata_dn *acc)
{
int i;
errno = EINVAL;
if (!*host)
return -1;
errno = ENAMETOOLONG;
i = 0;
while(*host && *host != '/') {
*hname++ = *host++;
if (++i > DN_MAXNODEL)
return -1;
}
*hname = 0;
errno = 0;
if (!*host)
return 0;
host++;
i = 0;
errno = ENAMETOOLONG;
while(*host && *host != '/') {
acc->acc_user[i++] = *host++;
if (i > DN_MAXACCL)
return -1;
}
acc->acc_userl = i;
errno = EINVAL;
if (*host != '/')
return -1;
host++;
i = 0;
errno = ENAMETOOLONG;
while(*host && *host != '/') {
acc->acc_pass[i++] = *host++;
if (i > DN_MAXACCL)
return -1;
}
acc->acc_passl = i;
errno = EINVAL;
if (*host != '/')
return -1;
host++;
i = 0;
errno = ENAMETOOLONG;
while(*host) {
acc->acc_acc[i++] = *host++;
if (i > DN_MAXACCL)
return -1;
}
acc->acc_accl = i;
return 0;
} | false | false | false | false | false | 0 |
run_threads(struct thread_info* threads, int numthreads)
{
int i = 0;
int curr_num_threads = 0;
struct running_thread* running_threads = NULL;
struct timespec ts;
while (i < numthreads)
{
if (max_num_threads == 0) // just do them all sequentially in this thread here
{
run_function(&(threads[i]));
i++;
}
else if (max_num_threads < 0 || curr_num_threads < max_num_threads)
{
pthread_create(&threads[i].thread_id, NULL, run_function, &(threads[i]));
struct running_thread* new_runner = (struct running_thread*) MALLOC(sizeof(struct running_thread));
new_runner->thread_id = &threads[i].thread_id;
new_runner->next = NULL;
struct running_thread* list_end = running_threads;
if (list_end == NULL)
{
running_threads = new_runner;
}
else
{
while (list_end != NULL && list_end->next != NULL)
{
list_end = list_end->next;
}
list_end->next = new_runner;
}
curr_num_threads++;
i++;
}
// clean up running thread list in case anything is already finished
struct running_thread* last = NULL;
//fprintf(stderr, "Cleaning up running jobs...\n");
pthread_mutex_lock(&tpool_mutex);
if (max_num_threads > 0 && curr_num_threads >= max_num_threads)
{
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_nsec += 5000000; // half a second
if (ts.tv_nsec >= 1000000000)
{
int nsecs = ts.tv_nsec / 1000000000;
ts.tv_sec += nsecs;
ts.tv_nsec -= nsecs * 1000000000;
}
pthread_cond_timedwait(&tpool_cond, &tpool_mutex, &ts);
}
for (struct running_thread* current = running_threads; current != NULL; )
{
int errcode = pthread_tryjoin_np(*(current->thread_id), NULL);
if (errcode == 0)
{
// get it out of the list
if (last == NULL)
{
// first in the list
running_threads = current->next;
FREE(current);
current = running_threads;
}
else
{
// have to get it out of the list...
struct running_thread* tmp = current;
last->next = current->next;
current = current->next;
FREE(tmp);
}
curr_num_threads--;
}
else
{
last = current;
current = current->next;
}
}
pthread_mutex_unlock(&tpool_mutex);
}
// wait for all threads to finish
while (running_threads != NULL)
{
pthread_join(*(running_threads->thread_id), NULL);
struct running_thread* tmp = running_threads;
running_threads = running_threads->next;
FREE(tmp);
}
} | false | false | false | false | false | 0 |
getPacket()
{
AVM_WRITE("ASF network reader", 1, "getPacket() (Eof: %d, pkts: %" PRIsz ")\n", m_bEof, m_Packets.size());
PthreadMutex& mutex = m_pParent->m_Mutex;
PthreadCond& cond = m_pParent->m_Cond;
Locker locker(mutex);
for (int i = 0; !m_Packets.size(); i++)
{
if (m_bEof || i > 20)
return 0;
if (!m_pParent->m_bWaiting)
cond.Broadcast();
cond.Wait(mutex, 0.5);
//printf("WAIT %d\n", i);
}
//for (int i = 0; i < m_Packets.size(); i++)
// AVM_WRITE("ASF network reader", "GETPACKETLIST %d %p %d\n", i, m_Packets[i], m_Packets[i]->size());
AsfPacket* p = m_Packets.front();
m_Packets.pop_front();
//AVM_WRITE("ASF network reader", "packet %d p:%d\n", m_Packets.size(), p->send_time);
//AVM_WRITE("ASF network reader", 1, "Returning: length %d, send time %dms (%d)\n",
// p->packet_length, p->send_time, p->length);
return p;
} | false | false | false | false | false | 0 |
vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
int vector, int fd, bool msix)
{
struct pci_dev *pdev = vdev->pdev;
int irq = msix ? vdev->msix[vector].vector : pdev->irq + vector;
char *name = msix ? "vfio-msix" : "vfio-msi";
struct eventfd_ctx *trigger;
int ret;
if (vector >= vdev->num_ctx)
return -EINVAL;
if (vdev->ctx[vector].trigger) {
free_irq(irq, vdev->ctx[vector].trigger);
irq_bypass_unregister_producer(&vdev->ctx[vector].producer);
kfree(vdev->ctx[vector].name);
eventfd_ctx_put(vdev->ctx[vector].trigger);
vdev->ctx[vector].trigger = NULL;
}
if (fd < 0)
return 0;
vdev->ctx[vector].name = kasprintf(GFP_KERNEL, "%s[%d](%s)",
name, vector, pci_name(pdev));
if (!vdev->ctx[vector].name)
return -ENOMEM;
trigger = eventfd_ctx_fdget(fd);
if (IS_ERR(trigger)) {
kfree(vdev->ctx[vector].name);
return PTR_ERR(trigger);
}
/*
* The MSIx vector table resides in device memory which may be cleared
* via backdoor resets. We don't allow direct access to the vector
* table so even if a userspace driver attempts to save/restore around
* such a reset it would be unsuccessful. To avoid this, restore the
* cached value of the message prior to enabling.
*/
if (msix) {
struct msi_msg msg;
get_cached_msi_msg(irq, &msg);
pci_write_msi_msg(irq, &msg);
}
ret = request_irq(irq, vfio_msihandler, 0,
vdev->ctx[vector].name, trigger);
if (ret) {
kfree(vdev->ctx[vector].name);
eventfd_ctx_put(trigger);
return ret;
}
vdev->ctx[vector].producer.token = trigger;
vdev->ctx[vector].producer.irq = irq;
ret = irq_bypass_register_producer(&vdev->ctx[vector].producer);
if (unlikely(ret))
dev_info(&pdev->dev,
"irq bypass producer (token %p) registration fails: %d\n",
vdev->ctx[vector].producer.token, ret);
vdev->ctx[vector].trigger = trigger;
return 0;
} | false | false | false | false | false | 0 |
k5_free_error(struct errinfo *ep, const char *msg)
{
if (msg != oom_msg)
free((char *)msg);
} | false | false | false | false | false | 0 |
unregisterClient(Client* client)
{
int position;
//
// If the client is in the list, delete the client from the list
// and return the result; otherwise, return FALSE.
//
if ( (position = this->clientList.getPosition(client)) )
{
return this->clientList.deleteElement(position);
}
else
{
return FALSE;
}
} | false | false | false | false | false | 0 |
xbaeGetCellTotalWidth(mw)
XbaeMatrixWidget mw;
{
int i, columns;
/*
* Calculate width of non-fixed cell area.
*/
columns = TRAILING_HORIZ_ORIGIN(mw);
for (i = mw->matrix.fixed_columns, mw->matrix.non_fixed_total_width = 0;
i < columns;
i++)
mw->matrix.non_fixed_total_width += COLUMN_WIDTH(mw, i);
} | false | false | false | false | false | 0 |
ipa_tm_transform_calls (struct cgraph_node *node, struct tm_region *region,
basic_block bb, bitmap irr_blocks)
{
bool need_ssa_rename = false;
edge e;
edge_iterator ei;
VEC(basic_block, heap) *queue = NULL;
bitmap visited_blocks = BITMAP_ALLOC (NULL);
VEC_safe_push (basic_block, heap, queue, bb);
do
{
bb = VEC_pop (basic_block, queue);
need_ssa_rename |=
ipa_tm_transform_calls_1 (node, region, bb, irr_blocks);
if (irr_blocks && bitmap_bit_p (irr_blocks, bb->index))
continue;
if (region && bitmap_bit_p (region->exit_blocks, bb->index))
continue;
FOR_EACH_EDGE (e, ei, bb->succs)
if (!bitmap_bit_p (visited_blocks, e->dest->index))
{
bitmap_set_bit (visited_blocks, e->dest->index);
VEC_safe_push (basic_block, heap, queue, e->dest);
}
}
while (!VEC_empty (basic_block, queue));
VEC_free (basic_block, heap, queue);
BITMAP_FREE (visited_blocks);
return need_ssa_rename;
} | false | false | false | false | false | 0 |
write_data(struct drm_i915_private *dev_priv, u32 reg,
const u8 *data, u32 len)
{
u32 i, j;
for (i = 0; i < len; i += 4) {
u32 val = 0;
for (j = 0; j < min_t(u32, len - i, 4); j++)
val |= *data++ << 8 * j;
I915_WRITE(reg, val);
}
} | false | false | false | false | false | 0 |
xml_load(const char * filename)
{
struct XMLBUF xml;
XmlNode *ret = NULL;
// printf("xml_load(\"%s\");\n", filename);
xml.eof = 0;
xml.read_index = 0;
xml.fptr = fopen(filename, "rb");
if(!xml.fptr)
return NULL;
xml.buf = malloc(BUFFER+1);
if(!xml.buf)
goto xml_load_fail_malloc_buf;
xml.buf[BUFFER]=0;
xml.len = BUFFER;
xml_read_file(&xml);
ret = xml_parse(&xml);
free(xml.buf);
xml_load_fail_malloc_buf:
fclose(xml.fptr);
return ret;
} | false | false | false | false | true | 1 |
calculateTotalTimeSeconds() {
double totalTime = 0;
vector<TcxTrack*>::iterator it;
for ( it=trackList.begin() ; it < trackList.end(); ++it )
{
TcxTrack* track = *it;
totalTime += track->calculateTotalTime();
}
char totalTimeBuf[50];
snprintf(&totalTimeBuf[0], sizeof(totalTimeBuf), "%.2f", totalTime);
this->totalTimeSeconds=totalTimeBuf;
} | false | false | false | false | false | 0 |
dummy_reloc_loop(void)
{
int i;
for (i = 0; i < 0x800; i++) {
BEGIN_BATCH(8);
OUT_BATCH(XY_SRC_COPY_BLT_CMD |
XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
OUT_BATCH((3 << 24) | /* 32 bits */
(0xcc << 16) | /* copy ROP */
4*4096);
OUT_BATCH(2048 << 16 | 0);
OUT_BATCH((4096) << 16 | (2048));
OUT_RELOC_FENCED(blt_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
OUT_BATCH(0 << 16 | 0);
OUT_BATCH(4*4096);
OUT_RELOC_FENCED(blt_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
ADVANCE_BATCH();
intel_batchbuffer_flush(batch);
BEGIN_BATCH(4);
OUT_BATCH(MI_FLUSH_DW | 1);
OUT_BATCH(0); /* reserved */
OUT_RELOC(target_buffer, I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER, 0);
OUT_BATCH(MI_NOOP | (1<<22) | (0xf));
ADVANCE_BATCH();
intel_batchbuffer_flush(batch);
drm_intel_bo_map(target_buffer, 0);
// map to force completion
drm_intel_bo_unmap(target_buffer);
}
} | false | false | false | false | false | 0 |
list_first(ListNode * const head, ListNode **output) {
ListNode *target_node;
assert_true(head);
if (list_empty(head)) {
return 0;
}
target_node = head->next;
*output = target_node;
return 1;
} | false | false | false | false | false | 0 |
selectNew()
{
uchar numLords = DataTheme.lords.count();
if( numLords < GenericLord::MAX_LORDS-1 ) {
save();
_idLord = DataTheme.lords.count();
GenericLordModel * lord = new GenericLordModel();
DataTheme.lords.append( lord );
init();
}
} | false | false | false | false | false | 0 |
parse_encoding_decl (void)
{
ACEXML_Char* astring = 0;
if ((this->parse_token (ACE_TEXT("ncoding")) < 0)
|| this->skip_equal () != 0
|| this->parse_encname (astring) != 0)
{
this->fatal_error (ACE_TEXT ("Invalid EncodingDecl specification"));
}
const ACEXML_Char* encoding = this->current_->getInputSource()->getEncoding();
if (encoding != 0 && ACE_OS::strcasecmp (astring, encoding) != 0)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Detected Encoding is %s ")
ACE_TEXT (": Declared Encoding is %s\n"),
encoding, astring));
this->warning (ACE_TEXT ("Declared encoding differs from detected ")
ACE_TEXT ("encoding"));
}
} | false | false | false | false | false | 0 |
slk_label ( int labnum ) {
if ( slks == NULL )
return NULL;
return slks->fkeys[labnum].label;
} | false | false | false | false | false | 0 |
range_reverse(PyObject *seq)
{
rangeobject *range = (rangeobject*) seq;
longrangeiterobject *it;
PyObject *one, *sum, *diff, *product;
long lstart, lstop, lstep, new_start, new_stop;
unsigned long ulen;
assert(PyRange_Check(seq));
/* reversed(range(start, stop, step)) can be expressed as
range(start+(n-1)*step, start-step, -step), where n is the number of
integers in the range.
If each of start, stop, step, -step, start-step, and the length
of the iterator is representable as a C long, use the int
version. This excludes some cases where the reversed range is
representable as a range_iterator, but it's good enough for
common cases and it makes the checks simple. */
lstart = PyLong_AsLong(range->start);
if (lstart == -1 && PyErr_Occurred()) {
PyErr_Clear();
goto long_range;
}
lstop = PyLong_AsLong(range->stop);
if (lstop == -1 && PyErr_Occurred()) {
PyErr_Clear();
goto long_range;
}
lstep = PyLong_AsLong(range->step);
if (lstep == -1 && PyErr_Occurred()) {
PyErr_Clear();
goto long_range;
}
/* check for possible overflow of -lstep */
if (lstep == LONG_MIN)
goto long_range;
/* check for overflow of lstart - lstep:
for lstep > 0, need only check whether lstart - lstep < LONG_MIN.
for lstep < 0, need only check whether lstart - lstep > LONG_MAX
Rearrange these inequalities as:
lstart - LONG_MIN < lstep (lstep > 0)
LONG_MAX - lstart < -lstep (lstep < 0)
and compute both sides as unsigned longs, to avoid the
possibility of undefined behaviour due to signed overflow. */
if (lstep > 0) {
if ((unsigned long)lstart - LONG_MIN < (unsigned long)lstep)
goto long_range;
}
else {
if (LONG_MAX - (unsigned long)lstart < 0UL - lstep)
goto long_range;
}
ulen = get_len_of_range(lstart, lstop, lstep);
if (ulen > (unsigned long)LONG_MAX)
goto long_range;
new_stop = lstart - lstep;
new_start = (long)(new_stop + ulen * lstep);
return fast_range_iter(new_start, new_stop, -lstep);
long_range:
it = PyObject_New(longrangeiterobject, &PyLongRangeIter_Type);
if (it == NULL)
return NULL;
/* start + (len - 1) * step */
it->len = range->length;
Py_INCREF(it->len);
one = PyLong_FromLong(1);
if (!one)
goto create_failure;
diff = PyNumber_Subtract(it->len, one);
Py_DECREF(one);
if (!diff)
goto create_failure;
product = PyNumber_Multiply(diff, range->step);
Py_DECREF(diff);
if (!product)
goto create_failure;
sum = PyNumber_Add(range->start, product);
Py_DECREF(product);
it->start = sum;
if (!it->start)
goto create_failure;
it->step = PyNumber_Negative(range->step);
if (!it->step)
goto create_failure;
it->index = PyLong_FromLong(0);
if (!it->index)
goto create_failure;
return (PyObject *)it;
create_failure:
Py_DECREF(it);
return NULL;
} | false | false | false | false | false | 0 |
dh_locate(const struct guid *muid)
{
bool found = FALSE;
const void *key;
void *value;
if (NULL == by_muid_old)
return NULL; /* DH layer shutdown occurred already */
/*
* Look in the old table first. If we find something there, move it
* to the new table to keep te record "alive" since we still get hits
* for this query.
*/
found = htable_lookup_extended(by_muid_old, muid, &key, &value);
if (found) {
htable_remove(by_muid_old, key);
g_assert(!htable_contains(by_muid, key));
htable_insert(by_muid, key, value);
return value;
}
return htable_lookup(by_muid, muid);
} | false | false | false | false | false | 0 |
grep_error(int errcode, regex_t *matcher, GtError *err)
{
char sbuf[BUFSIZ], *buf;
size_t bufsize;
gt_error_check(err);
bufsize = regerror(errcode, matcher, NULL, 0);
buf = malloc(bufsize);
(void) regerror(errcode, matcher, buf ? buf : sbuf, buf ? bufsize : BUFSIZ);
gt_error_set(err, "grep(): %s", buf ? buf : sbuf);
free(buf);
} | true | true | false | false | false | 1 |
prefixwrite(void *ptr, size_t size, size_t nmemb, FILE *f,
char *prefix, size_t prefixlen)
{
static FILE *lastf;
static char lastc = '\n';
size_t rsz, wsz = 0;
char *p = ptr;
if (nmemb == 0)
return 0;
if (prefix == NULL) {
lastf = f;
lastc = ((char *)ptr)[size * nmemb - 1];
return fwrite(ptr, size, nmemb, f);
}
if (f != lastf || lastc == '\n') {
if (*p == '\n' || *p == '\0')
wsz += fwrite(prefix, sizeof *prefix, prefixlen, f);
else {
fputs(prefix, f);
wsz += strlen(prefix);
}
}
lastf = f;
for (rsz = size * nmemb; rsz; rsz--, p++, wsz++) {
putc(*p, f);
if (*p != '\n' || rsz == 1) {
continue;
}
if (p[1] == '\n' || p[1] == '\0')
wsz += fwrite(prefix, sizeof *prefix, prefixlen, f);
else {
fputs(prefix, f);
wsz += strlen(prefix);
}
}
lastc = p[-1];
return wsz;
} | false | false | false | false | true | 1 |
sig_gui_printtext_finished(WINDOW_REC *window)
{
TEXT_BUFFER_VIEW_REC *view;
LINE_REC *insert_after;
view = WINDOW_GUI(window)->view;
insert_after = WINDOW_GUI(window)->use_insert_after ?
WINDOW_GUI(window)->insert_after : view->buffer->cur_line;
view_add_eol(view, &insert_after);
remove_old_lines(view);
} | false | false | false | false | false | 0 |
relocate_entry_gtt(struct drm_i915_gem_object *obj,
struct drm_i915_gem_relocation_entry *reloc,
uint64_t target_offset)
{
struct drm_device *dev = obj->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
struct i915_ggtt *ggtt = &dev_priv->ggtt;
uint64_t delta = relocation_target(reloc, target_offset);
uint64_t offset;
void __iomem *reloc_page;
int ret;
ret = i915_gem_object_set_to_gtt_domain(obj, true);
if (ret)
return ret;
ret = i915_gem_object_put_fence(obj);
if (ret)
return ret;
/* Map the page containing the relocation we're going to perform. */
offset = i915_gem_obj_ggtt_offset(obj);
offset += reloc->offset;
reloc_page = io_mapping_map_atomic_wc(ggtt->mappable,
offset & PAGE_MASK);
iowrite32(lower_32_bits(delta), reloc_page + offset_in_page(offset));
if (INTEL_INFO(dev)->gen >= 8) {
offset += sizeof(uint32_t);
if (offset_in_page(offset) == 0) {
io_mapping_unmap_atomic(reloc_page);
reloc_page =
io_mapping_map_atomic_wc(ggtt->mappable,
offset);
}
iowrite32(upper_32_bits(delta),
reloc_page + offset_in_page(offset));
}
io_mapping_unmap_atomic(reloc_page);
return 0;
} | false | false | false | false | false | 0 |
gnome_scan_module_manager_unload_modules (GnomeScanModuleManager *manager)
{
GSList *node;
for (node = manager->modules; node ; node = node->next) {
g_type_module_unuse (G_TYPE_MODULE (node->data));
}
} | false | false | false | false | false | 0 |
mxser_cflags_changed(struct mxser_port *info, unsigned long arg,
struct async_icount *cprev)
{
struct async_icount cnow;
unsigned long flags;
int ret;
spin_lock_irqsave(&info->slock, flags);
cnow = info->icount; /* atomic copy */
spin_unlock_irqrestore(&info->slock, flags);
ret = ((arg & TIOCM_RNG) && (cnow.rng != cprev->rng)) ||
((arg & TIOCM_DSR) && (cnow.dsr != cprev->dsr)) ||
((arg & TIOCM_CD) && (cnow.dcd != cprev->dcd)) ||
((arg & TIOCM_CTS) && (cnow.cts != cprev->cts));
*cprev = cnow;
return ret;
} | false | false | false | false | false | 0 |
jpc_cod_gettsfb(int qmfbid, int numlvls)
{
jpc_tsfb_t *tsfb;
if (!(tsfb = malloc(sizeof(jpc_tsfb_t))))
return 0;
if (numlvls > 0) {
switch (qmfbid) {
case JPC_COX_INS:
tsfb->qmfb = &jpc_ns_qmfb2d;
break;
default:
case JPC_COX_RFT:
tsfb->qmfb = &jpc_ft_qmfb2d;
break;
}
} else {
tsfb->qmfb = 0;
}
tsfb->numlvls = numlvls;
return tsfb;
} | false | false | false | false | false | 0 |
ac_tm_set_time(ac_tm_p _atp, time_t _t)
{
if(!_atp)
return -1;
memset( _atp, 0, sizeof(ac_tm_t));
_atp->time = _t;
return ac_tm_fill(_atp, localtime(&_t));
} | false | false | false | false | false | 0 |
_even_rand( unsigned *seed, unsigned max )
{
unsigned r, ret;
/* make sure distribution is even */
do {
r = (unsigned) rand_r( seed );
ret = r % max;
} while ( r - ret > RAND_MAX - max );
return ret;
} | false | false | false | false | false | 0 |
gt_alphabet_decode_seq_to_fp(const GtAlphabet *alphabet, FILE *fpout,
const GtUchar *src, unsigned long len)
{
unsigned long i;
const GtUchar *characters;
gt_assert(fpout != NULL && (len == 0 || src != NULL));
if (alphabet == NULL)
{
characters = (const GtUchar *) "acgt";
} else
{
characters = alphabet->characters;
}
for (i = 0; i < len; i++)
{
gt_xfputc((int) characters[(int) src[i]],fpout);
}
} | false | false | false | false | false | 0 |
snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device)
{
struct snd_pcm *pcm;
int err;
err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 1, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cmipci_playback_spdif_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cmipci_capture_spdif_ops);
pcm->private_data = cm;
pcm->info_flags = 0;
strcpy(pcm->name, "C-Media PCI IEC958");
cm->pcm_spdif = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cm->pci), 64*1024, 128*1024);
err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
snd_pcm_alt_chmaps, cm->max_channels, 0,
NULL);
if (err < 0)
return err;
return 0;
} | false | true | false | false | false | 1 |
mouseMoveEvent(QMouseEvent *e)
{
if (d->bColorPicking) {
d->_setColor(grabColor(e->globalPos()));
return;
}
KDialog::mouseMoveEvent(e);
} | false | false | false | false | false | 0 |
gccifyAsm(std::string asmstr) {
for (std::string::size_type i = 0; i != asmstr.size(); ++i)
if (asmstr[i] == '\n')
asmstr.replace(i, 1, "\\n");
else if (asmstr[i] == '\t')
asmstr.replace(i, 1, "\\t");
else if (asmstr[i] == '$') {
if (asmstr[i + 1] == '{') {
std::string::size_type a = asmstr.find_first_of(':', i + 1);
std::string::size_type b = asmstr.find_first_of('}', i + 1);
std::string n = "%" +
asmstr.substr(a + 1, b - a - 1) +
asmstr.substr(i + 2, a - i - 2);
asmstr.replace(i, b - i + 1, n);
i += n.size() - 1;
} else
asmstr.replace(i, 1, "%");
}
else if (asmstr[i] == '%')//grr
{ asmstr.replace(i, 1, "%%"); ++i;}
return asmstr;
} | false | false | false | false | false | 0 |
ResetPositionFlag_ (MolComplexS *mol_complexSP, int mol_complexesN)
{
int mol_complexI;
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
(mol_complexSP + mol_complexI)->position_changedF = 0;
} | false | false | false | false | false | 0 |
main()
{
cout<<"Gfan version:\n"<<GFAN_RELEASEDIR<<endl<<endl;
cout<<"Forked from source tree on:\n"<<GFAN_FORKTIME<<endl<<endl;
cout<<"Linked libraries:"<<endl;
cout<<"GMP "<<gmp_version<<endl;
cout<<"Cddlib YES"<<endl;
cout<<"SoPlex "<<((LpSolver::find("SoPlexCddGmp"))?"YES":" NO")<<endl;
cout<<"Singular "<<((GroebnerEngine::find("singular"))?"YES":" NO")<<endl;
return 0;
}
} | false | false | false | false | false | 0 |
push(int, Packet *p)
{
if (!_active || (uint32_t)(random() & SAMPLING_MASK) < _sampling_prob)
output(0).push(p);
else {
checked_output_push(1, p);
_drops++;
}
} | false | false | false | false | false | 0 |
bSetParms( float fDefValue, float fMinValue, float fMaxValue,
float fMinIncSz, float fMaxIncSz )
{
bool bRtn;
if( ! bIsCreated( ) ) return( FALSE );
bRtn = m_oSpnValue.bSetParms( fDefValue, fMinValue, fMaxValue,
fMinIncSz, fMaxIncSz );
return( bRtn );
} | false | false | false | false | false | 0 |
shiftExpression() {
Node *right, *result ;
result = additiveExpression() ;
for (;;) {
if (match (LSHIFT)) {
right = additiveExpression() ;
result = new Node (this,LSHIFT, result, right) ;
} else if (match (RSHIFT)) {
right = additiveExpression() ;
result = new Node (this,RSHIFT, result, right) ;
} else if (match (ZRSHIFT)) {
right = additiveExpression() ;
result = new Node (this,ZRSHIFT, result, right) ;
} else {
return result ;
}
}
} | false | false | false | false | false | 0 |
autohelperowl_attackpat237(int trans, int move, int color, int action)
{
int a, b, C;
UNUSED(color);
UNUSED(action);
a = AFFINE_TRANSFORM(647, trans, move);
b = AFFINE_TRANSFORM(685, trans, move);
C = AFFINE_TRANSFORM(648, trans, move);
return !play_attack_defend_n(color, 1, 2, move, a, move)&& (somewhere(color, 0, 1, b) || !play_attack_defend_n(color, 1, 2, move, b, move))&& !ATTACK_MACRO(C);
} | false | false | false | false | false | 0 |
initRadio(const CEGUI::String& radio, int group, bool selected)
{
WindowManager& winMgr = WindowManager::getSingleton();
if (winMgr.isWindowPresent(radio))
{
RadioButton* button = static_cast<RadioButton*>(winMgr.getWindow(radio));
button->setGroupID(group);
button->setSelected(selected);
}
} | false | false | false | false | false | 0 |
parse_subject_public_key_info_for_cert (GBytes *data)
{
GBytes *info;
GNode *asn;
asn = egg_asn1x_create_and_decode (pkix_asn1_tab, "Certificate", data);
g_assert (asn != NULL);
info = egg_asn1x_get_element_raw (egg_asn1x_node (asn, "tbsCertificate", "subjectPublicKeyInfo", NULL));
g_assert (info != NULL);
egg_asn1x_destroy (asn);
return info;
} | false | false | false | false | false | 0 |
cb_end(GtkPrintOperation *operation, GtkPrintContext *context, gPrinter *printer)
{
#if DEBUG_ME
fprintf(stderr, "cb_end: %d\n", printer->_preview);
#endif
if (printer->_preview && printer->onEnd)
(*printer->onEnd)(printer);
} | false | false | false | false | false | 0 |
filter_gui_filter_set(filter_t *f, gboolean removable,
gboolean active, GList *ruleset)
{
static const gchar * const widgets[] = {
"checkbutton_filter_enabled",
"button_filter_reset",
"button_filter_add_rule_text",
"button_filter_add_rule_ip",
"button_filter_add_rule_size",
"button_filter_add_rule_jump",
"button_filter_add_rule_flag",
"button_filter_add_rule_state",
#ifdef USE_GTK1
"clist_filter_rules",
#endif /* USE_GTK1 */
"entry_filter_name",
};
#ifdef USE_GTK1
GtkCTree *ctree;
#endif /* USE_GTK1 */
#ifdef USE_GTK2
GtkTreeView *tv;
#endif /* USE_GTK2 */
if (gui_filter_dialog() == NULL)
return;
#ifdef USE_GTK1
ctree = GTK_CTREE(gui_filter_dialog_lookup("ctree_filter_filters"));
#endif /* USE_GTK1 */
#ifdef USE_GTK2
tv = GTK_TREE_VIEW(gui_filter_dialog_lookup("treeview_filter_filters"));
gtk_list_store_clear(GTK_LIST_STORE(gtk_tree_view_get_model(
GTK_TREE_VIEW(gui_filter_dialog_lookup("treeview_filter_rules")))));
#endif /* USE_GTK2 */
filter_gui_edit_rule(NULL);
work_filter = f;
if (f != NULL) {
gtk_mass_widget_set_sensitive(gui_filter_dialog(),
widgets, G_N_ELEMENTS(widgets), filter_is_modifiable(f));
gtk_widget_set_sensitive
(gui_filter_dialog_lookup("button_filter_remove"), removable);
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON
(gui_filter_dialog_lookup("checkbutton_filter_enabled")),
active);
gtk_entry_set_text(
GTK_ENTRY(gui_filter_dialog_lookup("entry_filter_name")),
lazy_utf8_to_ui_string(f->name));
filter_gui_filter_set_enabled(f, active);
if (GUI_PROPERTY(gui_debug) >= 5)
printf("showing ruleset for filter: %s\n", f->name);
filter_gui_set_ruleset(ruleset);
#ifdef USE_GTK1
{
GtkCTreeNode *node;
node = gtk_ctree_find_by_row_data(GTK_CTREE(ctree),
filter_gui_get_root(f), f);
if (node != NULL) {
gtk_ctree_select(ctree, node);
} else {
g_warning("work_filter is not available in filter tree");
gtk_clist_unselect_all(GTK_CLIST(ctree));
}
}
#endif /* USE_GTK1 */
#ifdef USE_GTK2
{
GtkTreeIter iter;
GtkTreeModel *model;
model = gtk_tree_view_get_model(tv);
if (tree_find_iter_by_data(model, 0, f, &iter)) {
GtkTreePath *path, *cursor_path;
gboolean update;
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_get_cursor(tv, &cursor_path, NULL);
update = !cursor_path ||
0 != gtk_tree_path_compare(path, cursor_path);
if (update) {
GtkTreePath *p;
p = gtk_tree_path_copy(path);
while (gtk_tree_path_up(p))
gtk_tree_view_expand_row(tv, p, FALSE);
gtk_tree_path_free(p);
gtk_tree_view_set_cursor(tv, path, NULL, FALSE);
}
if (cursor_path)
gtk_tree_path_free(cursor_path);
gtk_tree_path_free(path);
} else {
g_warning("work_filter is not available in filter tree");
gtk_tree_selection_unselect_all(
gtk_tree_view_get_selection(tv));
}
}
#endif /* USE_GTK2 */
} else {
gtk_entry_set_text(
GTK_ENTRY(gui_filter_dialog_lookup("entry_filter_name")), "");
filter_gui_set_ruleset(NULL);
filter_gui_filter_set_enabled(NULL, FALSE);
gtk_widget_set_sensitive
(gui_filter_dialog_lookup("button_filter_remove"), FALSE);
gtk_mass_widget_set_sensitive(gui_filter_dialog(),
widgets, G_N_ELEMENTS(widgets), FALSE);
}
} | false | false | false | false | false | 0 |
_create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) {
char namebuf[X509_NAME_MAXLEN];
int buflen;
PyObject *name_obj;
PyObject *value_obj;
PyObject *attr;
unsigned char *valuebuf = NULL;
buflen = OBJ_obj2txt(namebuf, sizeof(namebuf), name, 0);
if (buflen < 0) {
_setSSLError(NULL, 0, __FILE__, __LINE__);
goto fail;
}
name_obj = PyUnicode_FromStringAndSize(namebuf, buflen);
if (name_obj == NULL)
goto fail;
buflen = ASN1_STRING_to_UTF8(&valuebuf, value);
if (buflen < 0) {
_setSSLError(NULL, 0, __FILE__, __LINE__);
Py_DECREF(name_obj);
goto fail;
}
value_obj = PyUnicode_DecodeUTF8((char *) valuebuf,
buflen, "strict");
OPENSSL_free(valuebuf);
if (value_obj == NULL) {
Py_DECREF(name_obj);
goto fail;
}
attr = PyTuple_New(2);
if (attr == NULL) {
Py_DECREF(name_obj);
Py_DECREF(value_obj);
goto fail;
}
PyTuple_SET_ITEM(attr, 0, name_obj);
PyTuple_SET_ITEM(attr, 1, value_obj);
return attr;
fail:
return NULL;
} | false | false | false | false | false | 0 |
totem_compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b)
{
gboolean has_totem_a, has_totem_b;
has_totem_a = gtk_recent_info_has_group (a, "Totem");
has_totem_b = gtk_recent_info_has_group (b, "Totem");
if (has_totem_a && has_totem_b) {
time_t time_a, time_b;
time_a = gtk_recent_info_get_modified (a);
time_b = gtk_recent_info_get_modified (b);
return (time_b - time_a);
} else if (has_totem_a) {
return -1;
} else if (has_totem_b) {
return 1;
}
return 0;
} | false | false | false | false | false | 0 |
ReadXBit(Parser p)
{
if(p->peeked)
p->peeked = 0;
else
parse(p);
return &p->xbit;
} | false | false | false | false | false | 0 |
take_shadow_cp(void) {
u4_int i; /* wide counter */
for (i = 0u; i < shadow_cnt; i++)
if (shadow_cp[i]) {
constant_pool[i] = NULL;
#ifdef DEBUG_SHADOW
fprintf(stderr, "take cp entry %u\n", i);
#endif
}
} | false | false | false | false | false | 0 |
do_check_one_pubkey (int n, gcry_sexp_t skey, gcry_sexp_t pkey,
const unsigned char *grip, int algo, int flags)
{
if (flags & FLAG_SIGN)
{
if (algo == GCRY_PK_ECDSA)
check_pubkey_sign_ecdsa (n, skey, pkey);
else
check_pubkey_sign (n, skey, pkey, algo);
}
if (flags & FLAG_CRYPT)
check_pubkey_crypt (n, skey, pkey, algo);
if (grip && (flags & FLAG_GRIP))
check_pubkey_grip (n, grip, skey, pkey, algo);
} | false | false | false | false | false | 0 |
write_restart_file(char *file)
{
if (me) return;
char outfile[128];
sprintf(outfile,"%s.rigid",file);
FILE *fp = fopen(outfile,"w");
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open fix rigid restart file %s",outfile);
error->one(FLERR,str);
}
fprintf(fp,"# fix rigid mass, COM, inertia tensor info for "
"%d bodies on timestep " BIGINT_FORMAT "\n\n",
nbody,update->ntimestep);
fprintf(fp,"%d\n",nbody);
// compute I tensor against xyz axes from diagonalized I and current quat
// Ispace = P Idiag P_transpose
// P is stored column-wise in exyz_space
double p[3][3],pdiag[3][3],ispace[3][3];
int id;
for (int i = 0; i < nbody; i++) {
if (rstyle == SINGLE || rstyle == GROUP) id = i;
else id = body2mol[i];
MathExtra::col2mat(ex_space[i],ey_space[i],ez_space[i],p);
MathExtra::times3_diag(p,inertia[i],pdiag);
MathExtra::times3_transpose(pdiag,p,ispace);
fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e "
"%-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n",
id,masstotal[i],xcm[i][0],xcm[i][1],xcm[i][2],
ispace[0][0],ispace[1][1],ispace[2][2],
ispace[0][1],ispace[0][2],ispace[1][2]);
}
fclose(fp);
} | false | false | false | false | false | 0 |
zv_save(fp,x,name)
FILE *fp;
ZVEC *x;
char *name;
{
int i;
matlab mat;
if ( ! x )
error(E_NULL,"zv_save");
mat.type = 1000*MACH_ID + 100*ORDER + 10*PRECISION + 0;
mat.m = x->dim;
mat.n = 1;
mat.imag = TRUE;
mat.namlen = (name == (char *)NULL) ? 1 : strlen(name)+1;
/* write header */
fwrite(&mat,sizeof(matlab),1,fp);
/* write name */
if ( name == (char *)NULL )
fwrite("",sizeof(char),1,fp);
else
fwrite(name,sizeof(char),(int)(mat.namlen),fp);
/* write actual data */
for ( i = 0; i < x->dim; i++ )
fwrite(&(x->ve[i].re),sizeof(Real),1,fp);
for ( i = 0; i < x->dim; i++ )
fwrite(&(x->ve[i].im),sizeof(Real),1,fp);
return x;
} | false | false | false | true | false | 1 |
output_delayed_int (struct output * out, int * ptr)
{
struct derivation *tmp;
if (out->to_void)
return;
tmp = new_derivation (delayed_int);
tmp->delayed_int = ptr;
output_char (out, '\0');
da_append (out->derivations, tmp);
} | false | false | false | false | false | 0 |
filter_off(void)
{
if (panel->type == PANEL_TYPE_FILE)
filter_off_file();
else {
/* PANEL_TYPE_DIR, PANEL_TYPE_GROUP, PANEL_TYPE_HIST, PANEL_TYPE_USER */
panel->filtering = 0;
filter_update();
win_filter();
}
pan_adjust(panel);
win_filter();
win_panel();
} | false | false | false | false | false | 0 |
operator+=(const Attribute& a)
{
merge(a);
d->associatedActions += a.associatedActions();
for (int i = 0; i < a.d->dynamicAttributes.count(); ++i)
if (i < d->dynamicAttributes.count()) {
if (a.d->dynamicAttributes[i])
d->dynamicAttributes[i] = a.d->dynamicAttributes[i];
} else {
d->dynamicAttributes.append(a.d->dynamicAttributes[i]);
}
return *this;
} | false | false | false | false | false | 0 |
adaptive_keyboard_hotkey_notify_hotkey(unsigned int scancode)
{
int current_mode = 0;
int new_mode = 0;
int keycode;
switch (scancode) {
case DFR_CHANGE_ROW:
if (adaptive_keyboard_mode_is_saved) {
new_mode = adaptive_keyboard_prev_mode;
adaptive_keyboard_mode_is_saved = false;
} else {
current_mode = adaptive_keyboard_get_mode();
if (current_mode < 0)
return false;
new_mode = adaptive_keyboard_get_next_mode(
current_mode);
}
if (adaptive_keyboard_set_mode(new_mode) < 0)
return false;
return true;
case DFR_SHOW_QUICKVIEW_ROW:
current_mode = adaptive_keyboard_get_mode();
if (current_mode < 0)
return false;
adaptive_keyboard_prev_mode = current_mode;
adaptive_keyboard_mode_is_saved = true;
if (adaptive_keyboard_set_mode (FUNCTION_MODE) < 0)
return false;
return true;
default:
if (scancode < FIRST_ADAPTIVE_KEY ||
scancode >= FIRST_ADAPTIVE_KEY +
TP_ACPI_HOTKEYSCAN_EXTENDED_START -
TP_ACPI_HOTKEYSCAN_ADAPTIVE_START) {
pr_info("Unhandled adaptive keyboard key: 0x%x\n",
scancode);
return false;
}
keycode = hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY +
TP_ACPI_HOTKEYSCAN_ADAPTIVE_START];
if (keycode != KEY_RESERVED) {
mutex_lock(&tpacpi_inputdev_send_mutex);
input_report_key(tpacpi_inputdev, keycode, 1);
input_sync(tpacpi_inputdev);
input_report_key(tpacpi_inputdev, keycode, 0);
input_sync(tpacpi_inputdev);
mutex_unlock(&tpacpi_inputdev_send_mutex);
}
return true;
}
} | false | false | false | false | false | 0 |
h_enddo(OMPragma* p, ostream& os) {
int n = RExit(p);
if ( p->is_nowait() ) {
print_pragma(p, os);
} else {
p->add_nowait();
print_pragma(p, os);
generate_barrier(n, os);
}
generate_call("exit", "do", n, os);
if ( keepSrcInfo ) reset_src_info(p, os);
} | false | false | false | false | false | 0 |
load_theme (void)
{
if (ball_preimage)
g_object_unref (ball_preimage);
ball_preimage = load_image (ball_filename);
refresh_pixmaps ();
refresh_preview_surfaces ();
} | false | false | false | false | false | 0 |
manhattanLength(QScriptContext *ctx, QScriptEngine *eng)
{
DECLARE_SELF(QPoint, manhattanLength);
return QScriptValue(eng, self->manhattanLength());
} | false | false | false | false | false | 0 |
atoipr(const char *s, iprange *ir)
{
if((s = atoip(s, &ir->lr)) == NULL) return NULL;
ir->ur = ir->lr;
s += strspn(s, " \t");
if(*s == '-')
{
if(!(s = atoip(s + 1, &ir->ur)) || ir->lr > ir->ur) return NULL;
}
else if(*s == '/')
{
int m, n;
if(sscanf(s + 1, "%d%n", &m, &n) != 1 || m < 0 || m > 32) return NULL;
unsigned long bm = (1 << (32 - m)) - 1;
ir->lr &= ~bm;
ir->ur |= bm;
s += 1 + n;
}
return s;
} | false | false | false | false | false | 0 |
vmw_binding_scrub_dx_shader(struct vmw_ctx_bindinfo *bi, bool rebind)
{
struct vmw_ctx_bindinfo_shader *binding =
container_of(bi, typeof(*binding), bi);
struct vmw_private *dev_priv = bi->ctx->dev_priv;
struct {
SVGA3dCmdHeader header;
SVGA3dCmdDXSetShader body;
} *cmd;
cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), bi->ctx->id);
if (unlikely(cmd == NULL)) {
DRM_ERROR("Failed reserving FIFO space for DX shader "
"unbinding.\n");
return -ENOMEM;
}
cmd->header.id = SVGA_3D_CMD_DX_SET_SHADER;
cmd->header.size = sizeof(cmd->body);
cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN;
cmd->body.shaderId = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
vmw_fifo_commit(dev_priv, sizeof(*cmd));
return 0;
} | false | false | false | false | false | 0 |
qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
AddRemoveComboBox *_t = static_cast<AddRemoveComboBox *>(_o);
switch (_id) {
case 0: _t->aboutToAddItem(); break;
case 1: _t->itemAdded((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 2: _t->aboutToRemoveItem((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 3: _t->itemRemoved(); break;
case 4: _t->currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 5: _t->currentIndexChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 6: _t->setEditText((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 7: _t->addItem(); break;
case 8: _t->removeItem(); break;
case 9: _t->updateUi(); break;
case 10: _t->translateIntIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
}
} | false | false | false | false | false | 0 |
split_shorts(opal_cmd_line_t *cmd, char *token, char **args,
int *output_argc, char ***output_argv,
int *num_args_used, bool ignore_unknown)
{
int i, j, len;
cmd_line_option_t *option;
char fake_token[3];
int num_args;
/* Setup that we didn't use any of the args */
num_args = opal_argv_count(args);
*num_args_used = 0;
/* Traverse the token. If it's empty (e.g., if someone passes a
"-" token, which, since the upper level calls this function as
(argv[i] + 1), will be empty by the time it gets down here),
just return that we didn't find a short option. */
len = (int)strlen(token);
if (0 == len) {
return OPAL_ERR_BAD_PARAM;
}
fake_token[0] = '-';
fake_token[2] = '\0';
for (i = 0; i < len; ++i) {
fake_token[1] = token[i];
option = find_option(cmd, fake_token + 1);
/* If we don't find the option, either return an error or pass
it through unmodified to the new argv */
if (NULL == option) {
if (!ignore_unknown) {
return OPAL_ERR_BAD_PARAM;
} else {
opal_argv_append(output_argc, output_argv, fake_token);
}
}
/* If we do find the option, copy it and all of its parameters
to the output args. If we run out of paramters (i.e., no
more tokens in the original argv), that error will be
handled at a higher level) */
else {
opal_argv_append(output_argc, output_argv, fake_token);
for (j = 0; j < option->clo_num_params; ++j) {
if (*num_args_used < num_args) {
opal_argv_append(output_argc, output_argv,
args[*num_args_used]);
++(*num_args_used);
} else {
opal_argv_append(output_argc, output_argv,
special_empty_token);
}
}
}
}
/* All done */
return OPAL_SUCCESS;
} | false | false | false | false | false | 0 |
CWriteFile(const io::path& fileName, bool append)
: FileSize(0)
{
#ifdef _DEBUG
setDebugName("CWriteFile");
#endif
Filename = fileName;
openFile(append);
} | false | false | false | false | false | 0 |
volume_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
{
struct ast_datastore *datastore = NULL;
struct volume_information *vi = NULL;
int is_new = 0;
/* Separate options from argument */
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(direction);
AST_APP_ARG(options);
);
AST_STANDARD_APP_ARGS(args, data);
ast_channel_lock(chan);
if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) {
ast_channel_unlock(chan);
/* Allocate a new datastore to hold the reference to this volume and audiohook information */
if (!(datastore = ast_datastore_alloc(&volume_datastore, NULL)))
return 0;
if (!(vi = ast_calloc(1, sizeof(*vi)))) {
ast_datastore_free(datastore);
return 0;
}
ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
vi->audiohook.manipulate_callback = volume_callback;
ast_set_flag(&vi->audiohook, AST_AUDIOHOOK_WANTS_DTMF);
is_new = 1;
} else {
ast_channel_unlock(chan);
vi = datastore->data;
}
/* Adjust gain on volume information structure */
if (ast_strlen_zero(args.direction)) {
ast_log(LOG_ERROR, "Direction must be specified for VOLUME function\n");
return -1;
}
if (!strcasecmp(args.direction, "tx")) {
vi->tx_gain = atoi(value);
} else if (!strcasecmp(args.direction, "rx")) {
vi->rx_gain = atoi(value);
} else {
ast_log(LOG_ERROR, "Direction must be either RX or TX\n");
}
if (is_new) {
datastore->data = vi;
ast_channel_lock(chan);
ast_channel_datastore_add(chan, datastore);
ast_channel_unlock(chan);
ast_audiohook_attach(chan, &vi->audiohook);
}
/* Add Option data to struct */
if (!ast_strlen_zero(args.options)) {
struct ast_flags flags = { 0 };
ast_app_parse_options(volume_opts, &flags, NULL, args.options);
vi->flags = flags.flags;
} else {
vi->flags = 0;
}
return 0;
} | false | false | false | false | false | 0 |
fk42gal (dtheta,dphi)
double *dtheta; /* b1950.0 'FK4' ra in degrees
Galactic longitude (l2) in degrees (returned) */
double *dphi; /* b1950.0 'FK4' dec in degrees
Galactic latitude (b2) in degrees (returned) */
/* Note: The equatorial coordinates are b1950.0 'FK4'. use the
routine jpgalj if conversion from j2000.0 coordinates
is required.
Reference: blaauw et al, MNRAS,121,123 (1960) */
{
double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
void v2s3(),s2v3();
int i;
char *eqcoor, *eqstrn();
dra = *dtheta;
ddec = *dphi;
rra = degrad (dra);
rdec = degrad (ddec);
/* remove e-terms */
/* call jpabe (rra,rdec,-1,idg) */
/* Spherical to Cartesian */
r = 1.;
s2v3 (rra,rdec,r,pos);
/* rotate to galactic */
for (i = 0; i<3; i++) {
pos1[i] = pos[0]*bgal[i][0] + pos[1]*bgal[i][1] + pos[2]*bgal[i][2];
}
/* Cartesian to spherical */
v2s3 (pos1,&rl,&rb,&r);
dl = raddeg (rl);
db = raddeg (rb);
*dtheta = dl;
*dphi = db;
/* Print result if in diagnostic mode */
if (idg) {
eqcoor = eqstrn (dra,ddec);
fprintf (stderr,"FK42GAL: B1950 RA,Dec= %s\n",eqcoor);
fprintf (stderr,"FK42GAL: long = %.5f lat = %.5f\n",dl,db);
free (eqcoor);
}
return;
} | false | false | false | false | false | 0 |
run_script_awake(struct script_state *st)
{
struct map_session_data *sd = map_id2sd(st->rid);
if( (sd && sd->npc_sleep != &st->sleep) || (st->rid != 0 && !sd) ) {
st->rid = 0;
}
if(st->state != RERUNLINE) {
st->state = END;
st->sleep.tick = 0;
}
st->sleep.timer = -1;
if(sd)
npc_timeout_start(sd);
run_script_main(st);
return;
} | false | false | false | false | false | 0 |
o2hb_dead_threshold_set(unsigned int threshold)
{
if (threshold > O2HB_MIN_DEAD_THRESHOLD) {
spin_lock(&o2hb_live_lock);
if (list_empty(&o2hb_all_regions))
o2hb_dead_threshold = threshold;
spin_unlock(&o2hb_live_lock);
}
} | false | false | false | false | false | 0 |
_dump_slurmdb_assoc_records(List assoc_list)
{
slurmdb_association_rec_t *assoc = NULL;
ListIterator itr = NULL;
itr = list_iterator_create(assoc_list);
while((assoc = list_next(itr))) {
debug("\t\tid=%d", assoc->id);
}
list_iterator_destroy(itr);
} | false | false | false | false | false | 0 |
WriteMeshStatisticsFile( const char* AreaFileName, const char* QFileName,
const char* AngleMinFileName, const char* DegreeFileName )
{
std::ofstream area_file( AreaFileName );
std::ofstream Q_file( QFileName );
std::ofstream AngleMin_file( AngleMinFileName );
std::ofstream Degree_file( DegreeFileName );
double coeff = (12.0/sqrt(3.0));
vtkIdType v1, v2, v3;
double FP1[3], FP2[3], FP3[3];
double length = 0.;
double perimeter = 0.;
double area = 0.;
double lmax = 0.;
for( vtkIdType i = 0; i < this->GetNumberOfCells( ); i++ )
{
this->GetFaceVertices(i,v1,v2,v3);
this->GetPoints()->GetPoint(v1,FP1);
this->GetPoints()->GetPoint(v2,FP2);
this->GetPoints()->GetPoint(v3,FP3);
length=sqrt(vtkMath::Distance2BetweenPoints(FP1,FP2));
lmax=length;
perimeter=length;
length=sqrt(vtkMath::Distance2BetweenPoints(FP2,FP3));
if( lmax < length )
lmax=length;
perimeter+=length;
length=sqrt(vtkMath::Distance2BetweenPoints(FP1,FP3));
if( lmax < length)
lmax=length;
perimeter+=length;
area=vtkTriangle::TriangleArea(FP1,FP2,FP3);
area_file <<area <<std::endl;
Q_file <<coeff*area/(perimeter*lmax) <<std::endl;
vtkCell *Cell=this->GetCell(i);
AngleMin_file <<TriangleMinAngle(Cell) <<std::endl;
}
for( vtkIdType i = 0; i < this->GetNumberOfPoints( ); i++ )
Degree_file <<this->GetValence(i) <<std::endl;
area_file.close( );
Q_file.close( );
Q_file.close( );
Degree_file.close( );
} | false | false | false | false | false | 0 |
SubnRankFabricNodesByRegexp(IBFabric *p_fabric,
const char * nodeNameRex,
map_pnode_int &nodesRank)
{
regExp nodeRex(nodeNameRex);
rexMatch *p_rexRes;
list_pnode rootNodes;
// go over all nodes of the fabric;
for (map_str_pnode::iterator nI = p_fabric->NodeByName.begin();
nI != p_fabric->NodeByName.end(); nI++) {
// match rex ?
p_rexRes = nodeRex.apply((*nI).first.c_str());
if (p_rexRes) {
cout << "-I- Starting UpDown Routing from node:"
<< (*nI).second->name << endl;
rootNodes.push_back((*nI).second);
delete p_rexRes;
}
}
return SubnRankFabricNodesByRootNodes(p_fabric, rootNodes, nodesRank);
} | false | false | false | false | false | 0 |
H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
{
size_t enc_obj_size; /* Encoded object size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_tiny_remove)
/*
* Check arguments.
*/
HDassert(hdr);
HDassert(id);
/* Check if 'tiny' object ID is in extended form */
if(!hdr->tiny_len_extended)
enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
else
/* (performed in this odd way to avoid compiler bug on tg-login3 with
* gcc 3.2.2 - QAK)
*/
enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
/* Update statistics about heap */
hdr->tiny_size -= (enc_obj_size + 1);
hdr->tiny_nobjs--;
/* Mark heap header as modified */
if(H5HF_hdr_dirty(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} | false | false | false | false | false | 0 |
e_int_config_keybindings(E_Container *con,
const char *params)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
if (e_config_dialog_find("E", "keyboard_and_mouse/key_bindings")) return NULL;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
v->override_auto_apply = 1;
cfd = e_config_dialog_new(con, _("Key Bindings Settings"), "E",
"keyboard_and_mouse/key_bindings",
"preferences-desktop-keyboard-shortcuts", 0, v, NULL);
if ((params) && (params[0]))
{
cfd->cfdata->params = strdup(params);
_add_key_binding_cb(cfd->cfdata, NULL);
}
return cfd;
} | false | false | false | false | false | 0 |
SetStatus(uint8 in)
{
// PAUSED and INSUFFICIENT have extra flag variables m_paused and m_insufficient
// - they are never to be stored in status
wxASSERT( in != PS_PAUSED && in != PS_INSUFFICIENT );
status = in;
if (theApp->IsRunning()) {
UpdateDisplayedInfo( true );
if ( thePrefs::ShowCatTabInfos() ) {
Notify_ShowUpdateCatTabTitles();
}
Notify_DownloadCtrlSort();
}
} | false | false | false | false | false | 0 |
do_all_sorted_fn(const OBJ_NAME *name,void *d_)
{
struct doall_sorted *d=d_;
if(name->type != d->type)
return;
d->names[d->n++]=name;
} | false | false | false | false | false | 0 |
gst_asf_mux_write_content_description (GstAsfMux * asfmux, guint8 ** buf,
const GstTagList * tags)
{
guint8 *values = (*buf) + ASF_CONTENT_DESCRIPTION_OBJECT_SIZE;
guint64 size = 0;
GST_DEBUG_OBJECT (asfmux, "Writing content description object");
gst_asf_put_guid (*buf, guids[ASF_CONTENT_DESCRIPTION_INDEX]);
values += gst_asf_mux_write_content_description_entry (asfmux, tags,
GST_TAG_TITLE, *buf + 24, values);
values += gst_asf_mux_write_content_description_entry (asfmux, tags,
GST_TAG_ARTIST, *buf + 26, values);
values += gst_asf_mux_write_content_description_entry (asfmux, tags,
GST_TAG_COPYRIGHT, *buf + 28, values);
values += gst_asf_mux_write_content_description_entry (asfmux, tags,
GST_TAG_DESCRIPTION, *buf + 30, values);
/* rating is currently not present in gstreamer tags, so we put 0 */
GST_WRITE_UINT16_LE (*buf + 32, 0);
size += values - *buf;
GST_WRITE_UINT64_LE (*buf + 16, size);
*buf += size;
} | false | false | false | false | false | 0 |
sftp_pkt_ensure(struct sftp_packet *pkt, int length)
{
if ((int)pkt->maxlen < length) {
pkt->maxlen = length + 256;
pkt->data = sresize(pkt->data, pkt->maxlen, char);
}
} | false | false | false | false | false | 0 |
dissect_p1_ReportType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 1220 "../../asn1/p1/p1.cnf"
gint report = -1;
offset = dissect_ber_choice(actx, tree, tvb, offset,
ReportType_choice, hf_index, ett_p1_ReportType,
&report);
if( (report!=-1) && p1_ReportType_vals[report].strptr ){
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", p1_ReportType_vals[report].strptr);
}
return offset;
} | false | false | false | false | false | 0 |
OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen)
{
int ulen, i;
unsigned char *unitmp;
if (asclen == -1) asclen = strlen(asc);
ulen = asclen*2 + 2;
if (!(unitmp = OPENSSL_malloc(ulen))) return NULL;
for (i = 0; i < ulen - 2; i+=2) {
unitmp[i] = 0;
unitmp[i + 1] = asc[i>>1];
}
/* Make result double null terminated */
unitmp[ulen - 2] = 0;
unitmp[ulen - 1] = 0;
if (unilen) *unilen = ulen;
if (uni) *uni = unitmp;
return unitmp;
} | false | false | false | false | false | 0 |
disconnect_timeout(gpointer user_data)
{
struct avdtp *session = user_data;
struct audio_device *dev;
gboolean stream_setup;
session->dc_timer = 0;
stream_setup = session->stream_setup;
session->stream_setup = FALSE;
dev = manager_get_device(&session->server->src, &session->dst, FALSE);
if (dev && dev->sink && stream_setup)
sink_setup_stream(dev->sink, session);
else if (dev && dev->source && stream_setup)
source_setup_stream(dev->source, session);
else
connection_lost(session, ETIMEDOUT);
return FALSE;
} | false | false | false | false | false | 0 |
twl4030_init_irq(struct device *dev, int irq_num)
{
static struct irq_chip twl4030_irq_chip;
int status, i;
int irq_base, irq_end, nr_irqs;
struct device_node *node = dev->of_node;
/*
* TWL core and pwr interrupts must be contiguous because
* the hwirqs numbers are defined contiguously from 1 to 15.
* Create only one domain for both.
*/
nr_irqs = TWL4030_PWR_NR_IRQS + TWL4030_CORE_NR_IRQS;
irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
if (IS_ERR_VALUE(irq_base)) {
dev_err(dev, "Fail to allocate IRQ descs\n");
return irq_base;
}
irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
&irq_domain_simple_ops, NULL);
irq_end = irq_base + TWL4030_CORE_NR_IRQS;
/*
* Mask and clear all TWL4030 interrupts since initially we do
* not have any TWL4030 module interrupt handlers present
*/
status = twl4030_init_sih_modules(twl_irq_line);
if (status < 0)
return status;
twl4030_irq_base = irq_base;
/*
* Install an irq handler for each of the SIH modules;
* clone dummy irq_chip since PIH can't *do* anything
*/
twl4030_irq_chip = dummy_irq_chip;
twl4030_irq_chip.name = "twl4030";
twl4030_sih_irq_chip.irq_ack = dummy_irq_chip.irq_ack;
for (i = irq_base; i < irq_end; i++) {
irq_set_chip_and_handler(i, &twl4030_irq_chip,
handle_simple_irq);
irq_set_nested_thread(i, 1);
activate_irq(i);
}
dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", "PIH",
irq_num, irq_base, irq_end);
/* ... and the PWR_INT module ... */
status = twl4030_sih_setup(dev, TWL4030_MODULE_INT, irq_end);
if (status < 0) {
dev_err(dev, "sih_setup PWR INT --> %d\n", status);
goto fail;
}
/* install an irq handler to demultiplex the TWL4030 interrupt */
status = request_threaded_irq(irq_num, NULL, handle_twl4030_pih,
IRQF_ONESHOT,
"TWL4030-PIH", NULL);
if (status < 0) {
dev_err(dev, "could not claim irq%d: %d\n", irq_num, status);
goto fail_rqirq;
}
enable_irq_wake(irq_num);
return irq_base;
fail_rqirq:
/* clean up twl4030_sih_setup */
fail:
for (i = irq_base; i < irq_end; i++) {
irq_set_nested_thread(i, 0);
irq_set_chip_and_handler(i, NULL, NULL);
}
return status;
} | false | false | false | false | false | 0 |
select(const int &tableref, const int &fieldref, const QHash<int, QString> &conditions) const
{
QString toReturn;
toReturn = QString("SELECT `%2`.`%1` FROM `%2` WHERE %3")
.arg(fieldName(tableref, fieldref))
.arg(table(tableref))
.arg(getWhereClause(tableref, conditions));
if (WarnSqlCommands)
qWarning() << toReturn;
return toReturn;
} | false | false | false | false | false | 0 |
emulator_get_msr(struct x86_emulate_ctxt *ctxt,
u32 msr_index, u64 *pdata)
{
struct msr_data msr;
int r;
msr.index = msr_index;
msr.host_initiated = false;
r = kvm_get_msr(emul_to_vcpu(ctxt), &msr);
if (r)
return r;
*pdata = msr.data;
return 0;
} | false | false | false | false | false | 0 |
gst_play_sink_release_pad (GstPlaySink * playsink, GstPad * pad)
{
GstPad **res = NULL;
gboolean untarget = TRUE;
GST_DEBUG_OBJECT (playsink, "release pad %" GST_PTR_FORMAT, pad);
GST_PLAY_SINK_LOCK (playsink);
if (pad == playsink->video_pad) {
res = &playsink->video_pad;
g_signal_handlers_disconnect_by_func (playsink->video_pad, caps_notify_cb,
playsink);
} else if (pad == playsink->audio_pad) {
res = &playsink->audio_pad;
g_signal_handlers_disconnect_by_func (playsink->audio_pad, caps_notify_cb,
playsink);
} else if (pad == playsink->text_pad) {
res = &playsink->text_pad;
} else {
/* try to release the given pad anyway, these could be the FLUSHING pads. */
res = &pad;
untarget = FALSE;
}
GST_PLAY_SINK_UNLOCK (playsink);
if (*res) {
GST_DEBUG_OBJECT (playsink, "deactivate pad %" GST_PTR_FORMAT, *res);
gst_pad_set_active (*res, FALSE);
if (untarget) {
GST_DEBUG_OBJECT (playsink, "untargeting pad %" GST_PTR_FORMAT, *res);
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (*res), NULL);
}
GST_DEBUG_OBJECT (playsink, "remove pad %" GST_PTR_FORMAT, *res);
gst_element_remove_pad (GST_ELEMENT_CAST (playsink), *res);
*res = NULL;
}
} | false | false | false | false | false | 0 |
removeStatusPreset()
{
OptStatusUI *d = (OptStatusUI *)w;
int id = d->cb_preset->currentItem();
if(id == -1)
return;
emit dataChanged();
QString name = d->cb_preset->text(id);
if (newPresets.contains(name)) {
newPresets.remove(name);
} else {
deletedPresets += d->cb_preset->text(id);
presets.remove(d->cb_preset->text(id));
}
d->cb_preset->removeItem(id);
// select a new entry if possible
if(d->cb_preset->count() == 0) {
selectStatusPreset(-1);
return;
}
if(id >= (int)d->cb_preset->count())
id = d->cb_preset->count()-1;
d->cb_preset->setCurrentIndex(id);
selectStatusPreset(id);
} | 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.