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 |
|---|---|---|---|---|---|---|
tea5764_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct tea5764_device *radio;
struct v4l2_device *v4l2_dev;
struct v4l2_ctrl_handler *hdl;
struct tea5764_regs *r;
int ret;
PDEBUG("probe");
radio = kzalloc(sizeof(struct tea5764_device), GFP_KERNEL);
if (!radio)
return -ENOMEM;
v4l2_dev = &radio->v4l2_dev;
ret = v4l2_device_register(&client->dev, v4l2_dev);
if (ret < 0) {
v4l2_err(v4l2_dev, "could not register v4l2_device\n");
goto errfr;
}
hdl = &radio->ctrl_handler;
v4l2_ctrl_handler_init(hdl, 1);
v4l2_ctrl_new_std(hdl, &tea5764_ctrl_ops,
V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
v4l2_dev->ctrl_handler = hdl;
if (hdl->error) {
ret = hdl->error;
v4l2_err(v4l2_dev, "Could not register controls\n");
goto errunreg;
}
mutex_init(&radio->mutex);
radio->i2c_client = client;
ret = tea5764_i2c_read(radio);
if (ret)
goto errunreg;
r = &radio->regs;
PDEBUG("chipid = %04X, manid = %04X", r->chipid, r->manid);
if (r->chipid != TEA5764_CHIPID ||
(r->manid & 0x0fff) != TEA5764_MANID) {
PWARN("This chip is not a TEA5764!");
ret = -EINVAL;
goto errunreg;
}
radio->vdev = tea5764_radio_template;
i2c_set_clientdata(client, radio);
video_set_drvdata(&radio->vdev, radio);
radio->vdev.lock = &radio->mutex;
radio->vdev.v4l2_dev = v4l2_dev;
/* initialize and power off the chip */
tea5764_i2c_read(radio);
tea5764_set_audout_mode(radio, V4L2_TUNER_MODE_STEREO);
tea5764_mute(radio, 1);
tea5764_power_down(radio);
ret = video_register_device(&radio->vdev, VFL_TYPE_RADIO, radio_nr);
if (ret < 0) {
PWARN("Could not register video device!");
goto errunreg;
}
PINFO("registered.");
return 0;
errunreg:
v4l2_ctrl_handler_free(hdl);
v4l2_device_unregister(v4l2_dev);
errfr:
kfree(radio);
return ret;
} | false | false | false | false | false | 0 |
vtkParse_FreeTemplateDecomposition(
const char *name, int n, const char **args)
{
int i;
if (name)
{
free((char *)name);
}
if (n > 0)
{
for (i = 0; i < n; i++)
{
free((char *)args[i]);
}
free((char **)args);
}
} | true | true | false | false | false | 1 |
create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t * data_set)
{
node_t *new_node = NULL;
if (pe_find_node(data_set->nodes, uname) != NULL) {
crm_config_warn("Detected multiple node entries with uname=%s"
" - this is rarely intended", uname);
}
new_node = calloc(1, sizeof(node_t));
if (new_node == NULL) {
return NULL;
}
new_node->weight = char2score(score);
new_node->fixed = FALSE;
new_node->details = calloc(1, sizeof(struct node_shared_s));
if (new_node->details == NULL) {
free(new_node);
return NULL;
}
crm_trace("Creating node for entry %s/%s", uname, id);
new_node->details->id = id;
new_node->details->uname = uname;
new_node->details->online = FALSE;
new_node->details->shutdown = FALSE;
new_node->details->running_rsc = NULL;
new_node->details->type = node_ping;
if (safe_str_eq(type, "remote")) {
new_node->details->type = node_remote;
} else if (type == NULL || safe_str_eq(type, "member")
|| safe_str_eq(type, NORMALNODE)) {
new_node->details->type = node_member;
}
new_node->details->attrs = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str,
g_hash_destroy_str);
new_node->details->utilization =
g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str,
g_hash_destroy_str);
new_node->details->digest_cache =
g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str,
destroy_digest_cache);
data_set->nodes = g_list_insert_sorted(data_set->nodes, new_node, sort_node_uname);
return new_node;
} | false | false | false | false | false | 0 |
cfq_rb_erase(struct rb_node *n, struct cfq_rb_root *root)
{
if (root->left == n)
root->left = NULL;
rb_erase_init(n, &root->rb);
--root->count;
} | false | false | false | false | false | 0 |
sum_volume (FttCell * cell, GtsRange * vol)
{
gdouble size = ftt_cell_size (cell);
if (GFS_IS_MIXED (cell))
gts_range_add_value (vol, size*size*GFS_STATE (cell)->solid->a);
else
gts_range_add_value (vol, size*size);
} | false | false | false | false | false | 0 |
RemoveLine(int line) {
// Retain the markers from the deleted line by oring them into the previous line
if (markers.Length()) {
if (line > 0) {
MergeMarkers(line - 1);
}
markers.Delete(line);
}
} | false | false | false | false | false | 0 |
printantsynset(SynsetPtr synptr, char *tail, int anttype, int definition)
{
int i, wdcnt;
char tbuf[SMLINEBUF];
char *str;
int first = 1;
tbuf[0] = '\0';
if (offsetflag)
sprintf(tbuf,"{%8.8ld} ", synptr->hereiam);
if (fileinfoflag) {
sprintf(tbuf + strlen(tbuf),"<%s> ", lexfiles[synptr->fnum]);
prlexid = 1;
} else
prlexid = 0;
/* print anotnyms from cluster head (of indirect ant) */
strcat(tbuf, "INDIRECT (VIA ");
for(i = 0, wdcnt = synptr->wcount; i < wdcnt; i++) {
if (first) {
str = printant(ADJ, synptr, i + 1, "%s", ", ");
first = 0;
} else
str = printant(ADJ, synptr, i + 1, ", %s", ", ");
if (*str)
strcat(tbuf, str);
}
strcat(tbuf, ") -> ");
/* now print synonyms from cluster head (of indirect ant) */
for (i = 0, wdcnt = synptr->wcount; i < wdcnt; i++) {
catword(tbuf, synptr, i, SKIP_MARKER, SKIP_ANTS);
if (i < wdcnt - 1)
strcat(tbuf, ", ");
}
if(dflag && synptr->defn && definition) {
strcat(tbuf," -- ");
strcat(tbuf,synptr->defn);
}
strcat(tbuf,tail);
printbuffer(tbuf);
} | true | true | false | false | false | 1 |
toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (!hgs->hdrgen)
{
buf->writestring("shared ");
StaticDtorDeclaration::toCBuffer(buf, hgs);
}
} | false | false | false | false | false | 0 |
_zin_prod(a,b,i0,flag)
ZVEC *a,*b;
u_int i0, flag;
{
u_int limit;
if ( a==ZVNULL || b==ZVNULL )
error(E_NULL,"_zin_prod");
limit = min(a->dim,b->dim);
if ( i0 > limit )
error(E_BOUNDS,"_zin_prod");
return __zip__(&(a->ve[i0]),&(b->ve[i0]),(int)(limit-i0),flag);
} | false | false | false | true | false | 1 |
new_integer(struct alisp_instance *instance, long value)
{
struct alisp_object * obj;
obj = search_object_integer(instance, value);
if (obj != NULL)
return obj;
obj = new_object(instance, ALISP_OBJ_INTEGER);
if (obj) {
list_add(&obj->list, &instance->used_objs_list[value & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_INTEGER]);
obj->value.i = value;
}
return obj;
} | false | false | false | false | false | 0 |
ResetCatParts(uint8 cat)
{
// ADUNANZA BEGIN
#if 0
for (FileQueue::iterator it = m_filelist.begin(); it != m_filelist.end(); it++) {
#else
for (FileQueue::iterator it = m_filelist.begin(); it != m_filelist.end(); ++it) {
#endif
// ADUNANZA END
CPartFile* file = *it;
file->RemoveCategory(cat);
}
// ADUNANZA BEGIN
#if 0
for (FileList::iterator it = m_completedDownloads.begin(); it != m_completedDownloads.end(); it++) {
#else
for (FileList::iterator it = m_completedDownloads.begin(); it != m_completedDownloads.end(); ++it) {
#endif
// ADUNANZA END
CPartFile* file = *it;
file->RemoveCategory(cat);
}
} | false | false | false | false | false | 0 |
Sys_Milliseconds( void )
{
static qboolean first_time = true;
static time_t start_secs = 0;
int errorflag;
struct timespec tp;
long timeofday;
errorflag = clock_gettime( CLOCK_REALTIME, &tp );
if ( errorflag )
{
Com_Printf("Sys_Milliseconds: clock_gettime() error\n");
timeofday = 0L;
// fail
}
else if ( first_time )
{
start_secs = tp.tv_sec;
timeofday = tp.tv_nsec / 1000000L;
first_time = false;
}
else
{
timeofday = ( tp.tv_sec - start_secs ) * 1000L;
timeofday += tp.tv_nsec / 1000000L;
}
return (int)timeofday;
} | false | false | false | false | false | 0 |
H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
size_t size, const void *buf)
{
H5FD_core_t *file = (H5FD_core_t*)_file;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(file && file->pub.cls);
HDassert(buf);
/* Check for overflow conditions */
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
if(addr + size > file->eoa)
HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
/*
* Allocate more memory if necessary, careful of overflow. Also, if the
* allocation fails then the file should remain in a usable state. Be
* careful of non-Posix realloc() that doesn't understand what to do when
* the first argument is null.
*/
if(addr + size > file->eof) {
unsigned char *x;
size_t new_eof;
/* Determine new size of memory buffer */
H5_ASSIGN_OVERFLOW(new_eof, file->increment * ((addr + size) / file->increment), hsize_t, size_t);
if((addr + size) % file->increment)
new_eof += file->increment;
/* (Re)allocate memory for the file buffer, using callbacks if available */
if(file->fi_callbacks.image_realloc) {
if(NULL == (x = (unsigned char *)file->fi_callbacks.image_realloc(file->mem, new_eof, H5FD_FILE_IMAGE_OP_FILE_RESIZE, file->fi_callbacks.udata)))
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes with callback", (unsigned long long)new_eof)
} /* end if */
else {
if(NULL == (x = (unsigned char *)H5MM_realloc(file->mem, new_eof)))
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof)
} /* end else */
#ifdef H5_CLEAR_MEMORY
HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof));
#endif /* H5_CLEAR_MEMORY */
file->mem = x;
file->eof = new_eof;
} /* end if */
/* Write from BUF to memory */
HDmemcpy(file->mem + addr, buf, size);
/* Mark memory buffer as modified */
file->dirty = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
} | false | false | false | false | false | 0 |
remove_solutions (struct up_solution *update, struct problem_list *pblist,
struct board *board, char **matrix, short psol)
{
short x, y, z, j, ps;
short tsol = 0, *temp, *tprobs;
short probs = 0;
temp = (short *) malloc (MAXSOLS * sizeof (short));
tprobs = (short *) malloc (GROUPS * sizeof (short));
if (!temp || !tprobs)
fatal_error ("Not enough memory!");
for (y = 0; y < board->solution[psol]->solgroupsnumb; y++) {
z = board->solution[psol]->solgroups[y];
j = pblist->pointer[z];
if (j == -1)
fatal_error ("No real problem found");
if (!pblist->problem[j]->solved) {
pblist->problem[j]->solved = YES;
tprobs[probs++] = j;
pblist->final[j] = psol;
}
}
for (x = 0; x < board->sp; x++) {
if (x > psol)
ps = matrix[x][psol];
else
ps = matrix[psol][x];
if (ps == NO && board->solution[x]->valid) {
board->solution[x]->valid = NO;
temp[tsol++] = x;
}
}
if (tsol >= MAXSOLS)
fatal_error ("Wrote beyond buffer allocation");
update->howmany = tsol;
if (tsol > 0) {
update->which = (short *) malloc (tsol * sizeof (short));
if (!update->which)
fatal_error ("No memory left");
memcpy (update->which, temp, tsol * sizeof (short));
}
update->hmprobs = probs;
if (probs > 0) {
update->wprobs = (short *) malloc (probs * sizeof (short));
if (!update->wprobs)
fatal_error ("No memory left");
memcpy (update->wprobs, tprobs, probs * sizeof (short));
}
free (tprobs);
free (temp);
} | false | true | false | false | true | 1 |
qlcnic_83xx_alloc_mbx_args(struct qlcnic_cmd_args *mbx,
struct qlcnic_adapter *adapter, u32 type)
{
int i, size;
u32 temp;
const struct qlcnic_mailbox_metadata *mbx_tbl;
memset(mbx, 0, sizeof(struct qlcnic_cmd_args));
mbx_tbl = qlcnic_83xx_mbx_tbl;
size = ARRAY_SIZE(qlcnic_83xx_mbx_tbl);
for (i = 0; i < size; i++) {
if (type == mbx_tbl[i].cmd) {
mbx->op_type = QLC_83XX_FW_MBX_CMD;
mbx->req.num = mbx_tbl[i].in_args;
mbx->rsp.num = mbx_tbl[i].out_args;
mbx->req.arg = kcalloc(mbx->req.num, sizeof(u32),
GFP_ATOMIC);
if (!mbx->req.arg)
return -ENOMEM;
mbx->rsp.arg = kcalloc(mbx->rsp.num, sizeof(u32),
GFP_ATOMIC);
if (!mbx->rsp.arg) {
kfree(mbx->req.arg);
mbx->req.arg = NULL;
return -ENOMEM;
}
temp = adapter->ahw->fw_hal_version << 29;
mbx->req.arg[0] = (type | (mbx->req.num << 16) | temp);
mbx->cmd_op = type;
return 0;
}
}
dev_err(&adapter->pdev->dev, "%s: Invalid mailbox command opcode 0x%x\n",
__func__, type);
return -EINVAL;
} | false | false | false | false | false | 0 |
MatrixMultiply(
const ADD& B,
vector<ADD> z) const
{
int nz = z.size();
DdManager *mgr = checkSameManager(B);
DdNode **Z = new DdNode *[nz];
for (int i = 0; i < nz; i++) {
Z[i] = z[i].node;
}
DdNode *result = Cudd_addMatrixMultiply(mgr, node, B.node, Z, nz);
delete [] Z;
checkReturnValue(result);
return ADD(p, result);
} | false | false | false | false | false | 0 |
_dep_agent(void *args)
{
struct job_record *job_ptr = (struct job_record *) args;
slurmctld_lock_t job_write_lock = {
NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK};
char *end_ptr = NULL, *tok;
int cnt = 0;
usleep(100000);
lock_slurmctld(job_write_lock);
if (job_ptr && job_ptr->details && (job_ptr->magic == JOB_MAGIC) &&
job_ptr->comment && strstr(job_ptr->comment, "on:")) {
char *new_depend = job_ptr->details->dependency;
job_ptr->details->dependency = NULL;
update_job_dependency(job_ptr, new_depend);
xfree(new_depend);
tok = strstr(job_ptr->comment, "on:");
cnt = strtol(tok + 3, &end_ptr, 10);
}
if (cnt == 0)
set_job_prio(job_ptr);
unlock_slurmctld(job_write_lock);
return NULL;
} | false | false | false | false | false | 0 |
gdk_pixbuf_new_from_xpm_data (const char **data)
{
GdkPixbuf *(* load_xpm_data) (const char **data);
GdkPixbuf *pixbuf;
GError *error = NULL;
GdkPixbufModule *xpm_module;
g_return_val_if_fail (data != NULL, NULL);
xpm_module = _gdk_pixbuf_get_named_module ("xpm", &error);
if (xpm_module == NULL) {
g_warning ("Error loading XPM image loader: %s", error->message);
g_error_free (error);
return NULL;
}
if (!_gdk_pixbuf_load_module (xpm_module, &error)) {
g_warning ("Error loading XPM image loader: %s", error->message);
g_error_free (error);
return NULL;
}
if (xpm_module->load_xpm_data == NULL) {
g_warning ("gdk-pixbuf XPM module lacks XPM data capability");
pixbuf = NULL;
} else {
load_xpm_data = xpm_module->load_xpm_data;
pixbuf = (* load_xpm_data) (data);
}
return pixbuf;
} | false | false | false | false | false | 0 |
_s_print_cdr(FILE *fp, CELL *cell)
{
if (!Null(cell)) {
if (Consp(cell)) {
fprintf(fp, " ");
_s_print_(fp, _Car(cell));
_s_print_cdr(fp, _Cdr(cell));
} else {
fputc(' ', fp);
_s_print_(fp, cell);
}
}
return cell;
} | false | false | false | false | false | 0 |
fetch_cursor_param_value(ExprContext *econtext, int paramId)
{
ParamListInfo paramInfo = econtext->ecxt_param_list_info;
if (paramInfo &&
paramId > 0 && paramId <= paramInfo->numParams)
{
ParamExternData *prm = ¶mInfo->params[paramId - 1];
/* give hook a chance in case parameter is dynamic */
if (!OidIsValid(prm->ptype) && paramInfo->paramFetch != NULL)
(*paramInfo->paramFetch) (paramInfo, paramId);
if (OidIsValid(prm->ptype) && !prm->isnull)
{
/* safety check in case hook did something unexpected */
if (prm->ptype != REFCURSOROID)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)",
paramId,
format_type_be(prm->ptype),
format_type_be(REFCURSOROID))));
/* We know that refcursor uses text's I/O routines */
return TextDatumGetCString(prm->value);
}
}
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("no value found for parameter %d", paramId)));
return NULL;
} | false | false | false | false | false | 0 |
emitPreOp(const Instruction *i)
{
if (i->encSize == 8) {
emitForm_B(i, HEX64(60000000, 00000000));
if (i->op == OP_PREEX2)
code[0] |= 0x20;
if (i->src(0).mod.abs()) code[0] |= 1 << 6;
if (i->src(0).mod.neg()) code[0] |= 1 << 8;
} else {
emitForm_S(i, i->op == OP_PREEX2 ? 0x74000008 : 0x70000008, true);
}
} | false | false | false | false | false | 0 |
kadm5_delete_principal(void *server_handle, krb5_principal principal)
{
unsigned int ret;
krb5_db_entry *kdb;
osa_princ_ent_rec adb;
kadm5_server_handle_t handle = server_handle;
CHECK_HANDLE(server_handle);
krb5_clear_error_message(handle->context);
if (principal == NULL)
return EINVAL;
if ((ret = kdb_get_entry(handle, principal, &kdb, &adb)))
return(ret);
ret = k5_kadm5_hook_remove(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_PRECOMMIT, principal);
if (ret) {
kdb_free_entry(handle, kdb, &adb);
return ret;
}
ret = kdb_delete_entry(handle, principal);
kdb_free_entry(handle, kdb, &adb);
if (ret == 0)
(void) k5_kadm5_hook_remove(handle->context,
handle->hook_handles,
KADM5_HOOK_STAGE_POSTCOMMIT, principal);
return ret;
} | false | false | false | false | false | 0 |
inputMaskCharacter(char inputMaskCharacter_)
{
_editor->inputMaskCharacter(inputMaskCharacter_);
//this could either take a new inputMaskCharacter into account, or reset it back.
if(autoMaskInput() == MSTrue) generateInputMask();
} | false | false | false | false | false | 0 |
prepare_tpacket_socket(pcap_t *handle)
{
#ifdef HAVE_TPACKET2
socklen_t len;
int val;
#endif
handle->md.tp_version = TPACKET_V1;
handle->md.tp_hdrlen = sizeof(struct tpacket_hdr);
#ifdef HAVE_TPACKET2
/* Probe whether kernel supports TPACKET_V2 */
val = TPACKET_V2;
len = sizeof(val);
if (getsockopt(handle->fd, SOL_PACKET, PACKET_HDRLEN, &val, &len) < 0) {
if (errno == ENOPROTOOPT)
return 1; /* no - just drive on */
/* Yes - treat as a failure. */
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"can't get TPACKET_V2 header len on packet socket: %s",
pcap_strerror(errno));
return -1;
}
handle->md.tp_hdrlen = val;
val = TPACKET_V2;
if (setsockopt(handle->fd, SOL_PACKET, PACKET_VERSION, &val,
sizeof(val)) < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"can't activate TPACKET_V2 on packet socket: %s",
pcap_strerror(errno));
return -1;
}
handle->md.tp_version = TPACKET_V2;
/* Reserve space for VLAN tag reconstruction */
val = VLAN_TAG_LEN;
if (setsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE, &val,
sizeof(val)) < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"can't set up reserve on packet socket: %s",
pcap_strerror(errno));
return -1;
}
#endif /* HAVE_TPACKET2 */
return 1;
} | false | false | false | false | false | 0 |
parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
struct dir_context *ctx, u64 attr_version)
{
struct fuse_direntplus *direntplus;
struct fuse_dirent *dirent;
size_t reclen;
int over = 0;
int ret;
while (nbytes >= FUSE_NAME_OFFSET_DIRENTPLUS) {
direntplus = (struct fuse_direntplus *) buf;
dirent = &direntplus->dirent;
reclen = FUSE_DIRENTPLUS_SIZE(direntplus);
if (!dirent->namelen || dirent->namelen > FUSE_NAME_MAX)
return -EIO;
if (reclen > nbytes)
break;
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
return -EIO;
if (!over) {
/* We fill entries into dstbuf only as much as
it can hold. But we still continue iterating
over remaining entries to link them. If not,
we need to send a FORGET for each of those
which we did not link.
*/
over = !dir_emit(ctx, dirent->name, dirent->namelen,
dirent->ino, dirent->type);
if (!over)
ctx->pos = dirent->off;
}
buf += reclen;
nbytes -= reclen;
ret = fuse_direntplus_link(file, direntplus, attr_version);
if (ret)
fuse_force_forget(file, direntplus->entry_out.nodeid);
}
return 0;
} | false | false | false | false | false | 0 |
sfnts_next_elem(sfnts_reader *r)
{
ref s;
int code;
if (r->error)
return;
do {
r->index++;
code = array_get(r->memory, r->sfnts, r->index, &s);
if (code == e_rangecheck) {
r->error |= 2;
}
else if (code < 0) {
r->error |= 1;
}
if (r->error)
return;
r->p = s.value.const_bytes;
r->length = r_size(&s) & ~(uint) 1; /* See Adobe Technical Note # 5012, section 4.2. */
} while (r->length == 0);
r->offset = 0;
} | false | false | false | false | false | 0 |
found_unsupported_format (struct GRD_HEADER *h, char *text, char *file)
{
GMT_LONG i;
static char *not_supported[N_NOT_SUPPORTED] = {"rb", "rf", "sf", "sd", "af", "gd"};
for (i = 0; i < N_NOT_SUPPORTED; i++) { /* Only allow netcdf (both v3 and new) and native binary output */
if (h->type == GMT_grd_format_decoder (not_supported[i])) {
fprintf (stderr, "grdblend: %s: Grid format type %s for file %s is not supported in grdblend\n", text, not_supported[i], file);
return (1);
}
}
return (0);
} | false | false | false | false | false | 0 |
strio_eof(VALUE self)
{
struct StringIO *ptr = readable(StringIO(self));
if (ptr->pos < RSTRING_LEN(ptr->string)) return Qfalse;
return Qtrue;
} | false | false | false | false | false | 0 |
matewnck_pager_drag_motion_timeout (gpointer data)
{
MatewnckPager *pager = MATEWNCK_PAGER (data);
MatewnckWorkspace *active_workspace, *dnd_workspace;
pager->priv->dnd_activate = 0;
active_workspace = matewnck_screen_get_active_workspace (pager->priv->screen);
dnd_workspace = matewnck_screen_get_workspace (pager->priv->screen,
pager->priv->prelight);
if (dnd_workspace &&
(pager->priv->prelight != matewnck_workspace_get_number (active_workspace)))
matewnck_workspace_activate (dnd_workspace, pager->priv->dnd_time);
return FALSE;
} | false | false | false | false | false | 0 |
cb_ok_clicked (G_GNUC_UNUSED GtkButton *button,
AutoFormatState *state)
{
if (state->selected_template)
cmd_selection_autoformat (WORKBOOK_CONTROL (state->wbcg),
format_template_clone (state->selected_template));
gtk_widget_destroy (GTK_WIDGET (state->dialog));
} | false | false | false | false | false | 0 |
dw_mass( FMField *out, FMField *coef, FMField *state, int32 offset,
FMField *bf, VolumeGeometry *vg,
int32 *conn, int32 nEl, int32 nEP,
int32 *elList, int32 elList_nRow,
int32 isDiff )
{
int32 ii, iel, dim, nQP, ret = RET_OK;
FMField *st = 0, *fu = 0, *ftfu = 0, *ftf1 = 0, *ftf = 0;
nQP = vg->bfGM->nLev;
dim = vg->bfGM->nRow;
/* output( "%d %d %d %d %d %d\n", offset, nEl, nEP, nQP, dim, elList_nRow ); */
if (isDiff) {
fmf_createAlloc( &ftf, 1, nQP, nEP * dim, nEP * dim );
fmf_createAlloc( &ftf1, 1, nQP, nEP, nEP );
fmf_mulATB_nn( ftf1, bf, bf );
/* fmf_print( bf, stdout, 0 ); */
/* fmf_print( ftf1, stdout, 0 ); */
/* fmf_print( ftf, stdout, 0 ); */
/* sys_pause(); */
for (ii = 0; ii < elList_nRow; ii++) {
iel = elList[ii];
FMF_SetCell( out, ii );
FMF_SetCell( coef, ii );
FMF_SetCell( vg->det, iel );
bf_buildFTF( ftf, ftf1 );
fmf_mul( ftf, coef->val );
fmf_sumLevelsMulF( out, ftf, vg->det->val );
/* printf("%d %d\n", ii, iel); */
/* fmf_print( out, stdout, 0 ); */
/* sys_pause(); */
ERR_CheckGo( ret );
}
} else {
state->val = FMF_PtrFirst( state ) + offset;
fmf_createAlloc( &st, 1, 1, dim, nEP );
fmf_createAlloc( &fu, 1, nQP, dim, 1 );
fmf_createAlloc( &ftfu, 1, nQP, dim * nEP, 1 );
for (ii = 0; ii < elList_nRow; ii++) {
iel = elList[ii];
FMF_SetCell( out, ii );
FMF_SetCell( coef, ii );
FMF_SetCell( vg->det, iel );
ele_extractNodalValuesDBD( st, state, conn + nEP * iel );
bf_act( fu, bf, st );
bf_actt( ftfu, bf, fu );
fmf_mul( ftfu, coef->val );
fmf_sumLevelsMulF( out, ftfu, vg->det->val );
ERR_CheckGo( ret );
}
}
end_label:
if (isDiff) {
fmf_freeDestroy( &ftf1 );
fmf_freeDestroy( &ftf );
} else {
fmf_freeDestroy( &st );
fmf_freeDestroy( &fu );
fmf_freeDestroy( &ftfu );
}
return( ret );
} | false | false | false | false | false | 0 |
finish_join(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
gs_context_t *current = (gs_context_t *)i_ctx_p;
gs_scheduler_t *psched = current->scheduler;
gs_context_t *pctx;
int code;
if ((code = context_param(psched, op, &pctx)) < 0)
return code;
if_debug2('\'', "[']finish_join %ld, status = %d\n",
pctx->index, pctx->status);
if (pctx->joiner_index != current->index)
return_error(e_invalidcontext);
pctx->joiner_index = 0;
return zjoin(i_ctx_p);
} | false | false | false | false | true | 1 |
bit_copy(PutBitContext *pb, GetBitContext *gb)
{
int bits_left = get_bits_left(gb);
while (bits_left >= MIN_CACHE_BITS) {
put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS));
bits_left -= MIN_CACHE_BITS;
}
if (bits_left > 0) {
put_bits(pb, bits_left, get_bits(gb, bits_left));
}
} | false | false | false | false | false | 0 |
ghwp_file_v5_get_hwp_version_string (GHWPFile *file)
{
g_return_val_if_fail (GHWP_IS_FILE_V5 (file), NULL);
return g_strdup_printf ("%d.%d.%d.%d", GHWP_FILE_V5(file)->major_version,
GHWP_FILE_V5(file)->minor_version,
GHWP_FILE_V5(file)->micro_version,
GHWP_FILE_V5(file)->extra_version);
} | false | false | false | false | false | 0 |
get_position(const bam_pileup1_t *p, int *len)
{
int icig, n_tot_bases = 0, iread = 0, edist = p->qpos + 1;
for (icig=0; icig<p->b->core.n_cigar; icig++)
{
// Conversion from uint32_t to MIDNSHP
// 0123456
// MIDNSHP
int cig = bam1_cigar(p->b)[icig] & BAM_CIGAR_MASK;
int ncig = bam1_cigar(p->b)[icig] >> BAM_CIGAR_SHIFT;
if ( cig==0 )
{
n_tot_bases += ncig;
iread += ncig;
}
else if ( cig==1 )
{
n_tot_bases += ncig;
iread += ncig;
}
else if ( cig==4 )
{
iread += ncig;
if ( iread<=p->qpos ) edist -= ncig;
}
}
*len = n_tot_bases;
return edist;
} | false | false | false | false | false | 0 |
G_spawn(const char *command, ...)
{
const char *args[MAX_ARGS];
int num_args = 0, i;
va_list va;
int status = -1;
va_start(va, command);
for (i = 0; ; i++) {
const char *arg = va_arg(va, const char *);
args[num_args++] = arg;
if (!arg)
break;
}
va_end(va);
status = G_spawn_ex(
command,
#ifndef __MINGW32__
SF_SIGNAL, SST_PRE, SSA_IGNORE, SIGINT,
SF_SIGNAL, SST_PRE, SSA_IGNORE, SIGQUIT,
SF_SIGNAL, SST_PRE, SSA_BLOCK, SIGCHLD,
#endif
SF_ARGVEC, args,
NULL);
return status;
} | true | true | false | false | false | 1 |
plugin_get_config (struct slapdplugin *plugin)
{
struct slapdplugin *temp = plugin;
PR_ASSERT (plugin);
while (temp->plg_group)
{
temp = temp->plg_group;
}
return &(temp->plg_conf);
} | false | false | false | false | false | 0 |
update(size_t index, ValType delta) {
// Handle previously unseen weights
while(index>=m_weights.size()) {
m_weights.push_back(0.0);
m_totals.push_back(0.0);
m_lastUpdated.push_back(0);
}
// Book keeping for w = w + delta
m_totals[index] += (m_numUpdates - m_lastUpdated[index]) * m_weights[index] + delta;
m_weights[index] += delta;
m_lastUpdated[index] = m_numUpdates;
} | false | false | false | false | false | 0 |
memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
{
Slapi_DN *group_sdn = slapi_entry_get_sdn(e);
char *group_dn = slapi_entry_get_ndn(e);
Slapi_Value *group_dn_val = 0;
Slapi_ValueSet *groupvals = *((memberof_get_groups_data*)callback_data)->groupvals;
int rc = 0;
if(slapi_is_shutting_down()){
rc = -1;
goto bail;
}
if (!groupvals)
{
slapi_log_error( SLAPI_LOG_PLUGIN, MEMBEROF_PLUGIN_SUBSYSTEM,
"memberof_get_groups_callback: NULL groupvals\n");
rc = -1;
goto bail;
}
/* get the DN of the group */
group_dn_val = slapi_value_new_string(group_dn);
/* group_dn is case-normalized */
slapi_value_set_flags(group_dn_val, SLAPI_ATTR_FLAG_NORMALIZED_CIS);
/* check if e is the same as our original member entry */
if (0 == memberof_compare(((memberof_get_groups_data*)callback_data)->config,
&((memberof_get_groups_data*)callback_data)->memberdn_val, &group_dn_val))
{
/* A recursive group caused us to find our original
* entry we passed to memberof_get_groups(). We just
* skip processing this entry. */
slapi_log_error( SLAPI_LOG_PLUGIN, MEMBEROF_PLUGIN_SUBSYSTEM,
"memberof_get_groups_callback: group recursion"
" detected in %s\n" ,group_dn);
slapi_value_free(&group_dn_val);
goto bail;
}
/* Have we been here before? Note that we don't loop through all of the group_slapiattrs
* in config. We only need this attribute for it's syntax so the comparison can be
* performed. Since all of the grouping attributes are validated to use the Dinstinguished
* Name syntax, we can safely just use the first group_slapiattr. */
if (groupvals && slapi_valueset_find(
((memberof_get_groups_data*)callback_data)->config->group_slapiattrs[0], groupvals, group_dn_val))
{
/* we either hit a recursive grouping, or an entry is
* a member of a group through multiple paths. Either
* way, we can just skip processing this entry since we've
* already gone through this part of the grouping hierarchy. */
slapi_log_error( SLAPI_LOG_PLUGIN, MEMBEROF_PLUGIN_SUBSYSTEM,
"memberof_get_groups_callback: possible group recursion"
" detected in %s\n" ,group_dn);
slapi_value_free(&group_dn_val);
goto bail;
}
/* Push group_dn_val into the valueset. This memory is now owned
* by the valueset. */
slapi_valueset_add_value_ext(groupvals, group_dn_val, SLAPI_VALUE_FLAG_PASSIN);
/* now recurse to find parent groups of e */
memberof_get_groups_r(((memberof_get_groups_data*)callback_data)->config,
group_sdn, callback_data);
bail:
return rc;
} | false | false | false | false | false | 0 |
mongo_message_send( mongo *conn, mongo_message *mm ) {
mongo_header head; /* little endian */
int res;
bson_little_endian32( &head.len, &mm->head.len );
bson_little_endian32( &head.id, &mm->head.id );
bson_little_endian32( &head.responseTo, &mm->head.responseTo );
bson_little_endian32( &head.op, &mm->head.op );
res = mongo_env_write_socket( conn, &head, sizeof( head ) );
if( res != MONGO_OK ) {
bson_free( mm );
return res;
}
res = mongo_env_write_socket( conn, &mm->data, mm->head.len - sizeof( head ) );
if( res != MONGO_OK ) {
bson_free( mm );
return res;
}
bson_free( mm );
return MONGO_OK;
} | false | false | false | false | false | 0 |
encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
int x, y, p, i;
const int ring_size= s->avctx->context_model ? 3 : 2;
int_fast16_t sample_buffer[3][ring_size][w+6], *sample[3][ring_size];
s->run_index=0;
memset(sample_buffer, 0, sizeof(sample_buffer));
for(y=0; y<h; y++){
for(i=0; i<ring_size; i++)
for(p=0; p<3; p++)
sample[p][i]= sample_buffer[p][(h+i-y)%ring_size]+3;
for(x=0; x<w; x++){
int v= src[x + stride*y];
int b= v&0xFF;
int g= (v>>8)&0xFF;
int r= (v>>16)&0xFF;
b -= g;
r -= g;
g += (b + r)>>2;
b += 0x100;
r += 0x100;
// assert(g>=0 && b>=0 && r>=0);
// assert(g<256 && b<512 && r<512);
sample[0][0][x]= g;
sample[1][0][x]= b;
sample[2][0][x]= r;
}
for(p=0; p<3; p++){
sample[p][0][-1]= sample[p][1][0 ];
sample[p][1][ w]= sample[p][1][w-1];
encode_line(s, w, sample[p], FFMIN(p, 1), 9);
}
}
} | false | false | false | false | true | 1 |
update_or_history(or_history_t *hist, time_t when)
{
tor_assert(hist);
if (hist->up_since) {
tor_assert(!hist->down_since);
hist->uptime += (when - hist->up_since);
hist->up_since = when;
} else if (hist->down_since) {
hist->downtime += (when - hist->down_since);
hist->down_since = when;
}
} | false | false | false | false | false | 0 |
check_outerjoin_delay(PlannerInfo *root,
Relids *relids_p, /* in/out parameter */
Relids *nullable_relids_p, /* output parameter */
bool is_pushed_down)
{
Relids relids;
Relids nullable_relids;
bool outerjoin_delayed;
bool found_some;
/* fast path if no outer joins */
if (root->oj_info_list == NIL)
{
*nullable_relids_p = NULL;
return false;
}
/* must copy relids because we need the original value at the end */
relids = bms_copy(*relids_p);
nullable_relids = NULL;
outerjoin_delayed = false;
do
{
ListCell *l;
found_some = false;
foreach(l, root->oj_info_list)
{
OuterJoinInfo *ojinfo = (OuterJoinInfo *) lfirst(l);
/* do we reference any nullable rels of this OJ? */
if (bms_overlap(relids, ojinfo->min_righthand) ||
(ojinfo->is_full_join &&
bms_overlap(relids, ojinfo->min_lefthand)))
{
/* yes; have we included all its rels in relids? */
if (!bms_is_subset(ojinfo->min_lefthand, relids) ||
!bms_is_subset(ojinfo->min_righthand, relids))
{
/* no, so add them in */
relids = bms_add_members(relids, ojinfo->min_lefthand);
relids = bms_add_members(relids, ojinfo->min_righthand);
outerjoin_delayed = true;
/* we'll need another iteration */
found_some = true;
}
/* track all the nullable rels of relevant OJs */
nullable_relids = bms_add_members(nullable_relids,
ojinfo->min_righthand);
if (ojinfo->is_full_join)
nullable_relids = bms_add_members(nullable_relids,
ojinfo->min_lefthand);
/* set delay_upper_joins if needed */
if (is_pushed_down && !ojinfo->is_full_join &&
bms_overlap(relids, ojinfo->min_lefthand))
ojinfo->delay_upper_joins = true;
}
}
} while (found_some);
/* identify just the actually-referenced nullable rels */
nullable_relids = bms_int_members(nullable_relids, *relids_p);
/* replace *relids_p, and return nullable_relids */
bms_free(*relids_p);
*relids_p = relids;
*nullable_relids_p = nullable_relids;
return outerjoin_delayed;
} | false | false | false | false | false | 0 |
_elm_diskselector_smart_focus_next(const Evas_Object *obj,
Elm_Focus_Direction dir,
Evas_Object **next)
{
Eina_List *items = NULL;
Eina_List *elist = NULL;
Elm_Diskselector_Item *it;
ELM_DISKSELECTOR_CHECK(obj) EINA_FALSE;
ELM_DISKSELECTOR_DATA_GET(obj, sd);
EINA_LIST_FOREACH (sd->items, elist, it)
items = eina_list_append(items, it->base.access_obj);
if (!sd->round)
return elm_widget_focus_list_next_get
(obj, items, eina_list_data_get, dir, next);
if (!elm_widget_focus_list_next_get
(obj, items, eina_list_data_get, dir, next))
{
elm_widget_focused_object_clear((Evas_Object *)obj);
elm_widget_focus_list_next_get
(obj, items, eina_list_data_get, dir, next);
}
return EINA_TRUE;
} | false | false | false | false | false | 0 |
__mark_sit_entry_dirty(struct f2fs_sb_info *sbi, unsigned int segno)
{
struct sit_info *sit_i = SIT_I(sbi);
if (!__test_and_set_bit(segno, sit_i->dirty_sentries_bitmap)) {
sit_i->dirty_sentries++;
return false;
}
return true;
} | false | false | false | false | false | 0 |
bam_block_find_free(kct_bam_t &bam)
{
unsigned int a;
for (a = 0;a < 8 * sizeof(kct_bam_t);a++)
{
if (bam_block_available(bam, a))
{
bam_block_allocate(bam, a);
return a * 256;
}
}
return 0;
} | false | false | false | false | false | 0 |
mgt_cpu_to_le(int type, void *data)
{
switch (type) {
case OID_TYPE_U32:
*(u32 *) data = cpu_to_le32(*(u32 *) data);
break;
case OID_TYPE_BUFFER:{
struct obj_buffer *buff = data;
buff->size = cpu_to_le32(buff->size);
buff->addr = cpu_to_le32(buff->addr);
break;
}
case OID_TYPE_BSS:{
struct obj_bss *bss = data;
bss->age = cpu_to_le16(bss->age);
bss->channel = cpu_to_le16(bss->channel);
bss->capinfo = cpu_to_le16(bss->capinfo);
bss->rates = cpu_to_le16(bss->rates);
bss->basic_rates = cpu_to_le16(bss->basic_rates);
break;
}
case OID_TYPE_BSSLIST:{
struct obj_bsslist *list = data;
int i;
list->nr = cpu_to_le32(list->nr);
for (i = 0; i < list->nr; i++)
mgt_cpu_to_le(OID_TYPE_BSS, &list->bsslist[i]);
break;
}
case OID_TYPE_FREQUENCIES:{
struct obj_frequencies *freq = data;
int i;
freq->nr = cpu_to_le16(freq->nr);
for (i = 0; i < freq->nr; i++)
freq->mhz[i] = cpu_to_le16(freq->mhz[i]);
break;
}
case OID_TYPE_MLME:{
struct obj_mlme *mlme = data;
mlme->id = cpu_to_le16(mlme->id);
mlme->state = cpu_to_le16(mlme->state);
mlme->code = cpu_to_le16(mlme->code);
break;
}
case OID_TYPE_MLMEEX:{
struct obj_mlmeex *mlme = data;
mlme->id = cpu_to_le16(mlme->id);
mlme->state = cpu_to_le16(mlme->state);
mlme->code = cpu_to_le16(mlme->code);
mlme->size = cpu_to_le16(mlme->size);
break;
}
case OID_TYPE_ATTACH:{
struct obj_attachment *attach = data;
attach->id = cpu_to_le16(attach->id);
attach->size = cpu_to_le16(attach->size);
break;
}
case OID_TYPE_SSID:
case OID_TYPE_KEY:
case OID_TYPE_ADDR:
case OID_TYPE_RAW:
break;
default:
BUG();
}
} | false | false | false | false | false | 0 |
atEnd() const
{
return (d->result == KFilterBase::End)
&& QIODevice::atEnd() // take QIODevice's internal buffer into account
&& d->filter->device()->atEnd();
} | false | false | false | false | false | 0 |
watch_flags_from_poll_revents (short revents)
{
unsigned int condition = 0;
if (revents & _DBUS_POLLIN)
condition |= DBUS_WATCH_READABLE;
if (revents & _DBUS_POLLOUT)
condition |= DBUS_WATCH_WRITABLE;
if (revents & _DBUS_POLLHUP)
condition |= DBUS_WATCH_HANGUP;
if (revents & _DBUS_POLLERR)
condition |= DBUS_WATCH_ERROR;
if (_DBUS_UNLIKELY (revents & _DBUS_POLLNVAL))
condition |= _DBUS_WATCH_NVAL;
return condition;
} | false | false | false | false | false | 0 |
DumpResource(FILE *to,struct resource *rcur) {
uint32 len;
int ch;
rcur->merged_off = ftell(to);
fseek(rcur->srcf,rcur->src_off,SEEK_SET);
len = getlong(rcur->srcf);
if ( len==EOF ) {
fprintf( stderr, "Bad resource length at offset %d\n", rcur->src_off );
exit(1);
}
putlong(len,to);
while ( len>0 ) {
ch = getc(rcur->srcf);
putc(ch,to);
--len;
}
} | false | false | false | false | false | 0 |
_theme_file_used(Eina_List *tlist, const char *filename)
{
E_Config_Theme *theme;
Eina_List *l;
if (!filename) return 0;
EINA_LIST_FOREACH(tlist, l, theme)
if (theme->file == filename) return 1;
return 0;
} | false | false | false | false | false | 0 |
dwc2_kill_urbs_in_qh_list(struct dwc2_hsotg *hsotg,
struct list_head *qh_list)
{
struct dwc2_qh *qh, *qh_tmp;
struct dwc2_qtd *qtd, *qtd_tmp;
list_for_each_entry_safe(qh, qh_tmp, qh_list, qh_list_entry) {
list_for_each_entry_safe(qtd, qtd_tmp, &qh->qtd_list,
qtd_list_entry) {
dwc2_host_complete(hsotg, qtd, -ECONNRESET);
dwc2_hcd_qtd_unlink_and_free(hsotg, qtd, qh);
}
}
} | false | false | false | false | false | 0 |
ConstantFoldExtractValueInstruction(Constant *Agg,
const unsigned *Idxs,
unsigned NumIdx) {
// Base case: no indices, so return the entire value.
if (NumIdx == 0)
return Agg;
if (isa<UndefValue>(Agg)) // ev(undef, x) -> undef
return UndefValue::get(ExtractValueInst::getIndexedType(Agg->getType(),
Idxs,
Idxs + NumIdx));
if (isa<ConstantAggregateZero>(Agg)) // ev(0, x) -> 0
return
Constant::getNullValue(ExtractValueInst::getIndexedType(Agg->getType(),
Idxs,
Idxs + NumIdx));
// Otherwise recurse.
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Agg))
return ConstantFoldExtractValueInstruction(CS->getOperand(*Idxs),
Idxs+1, NumIdx-1);
if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg))
return ConstantFoldExtractValueInstruction(CA->getOperand(*Idxs),
Idxs+1, NumIdx-1);
ConstantVector *CV = cast<ConstantVector>(Agg);
return ConstantFoldExtractValueInstruction(CV->getOperand(*Idxs),
Idxs+1, NumIdx-1);
} | false | false | false | false | false | 0 |
matrix_red_row_echelon(matrix_t *mat)
{
int i, j, lead, r;
double t1, t2;
lead = 0;
matrix_t *res = matrix_copy(mat);
for (r = 0; r < res->nrows; ++r)
{
if (res->ncols <= lead)
break;
i = r;
//while((res->data[i][lead]) == 0)
while(err_eq(res->data[i][lead], 0))
{
i++;
if (i == res->nrows)
{
i = r;
lead++;
if (res->ncols == lead)
return res;
}
}
for (j = 0; j < res->ncols; ++j)
{
double swap = res->data[i][j];
res->data[i][j] = res->data[r][j];
res->data[r][j] = swap;
}
if (!err_eq(res->data[r][lead], 0))
matrix_normalise_row(res, r, lead);
for (i = 0; i < res->nrows; ++i)
{
if (i != r)
{
t2 = res->data[i][lead];
for (j = 0; j < res->ncols; ++j)
{
t1 = t2 * res->data[r][j];
res->data[i][j] = res->data[i][j] - t1;
}
}
}
lead++;
}
return res;
} | false | false | false | false | false | 0 |
mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter)
{
if (c >= 0 && c < 0x80) {
CK((*filter->output_function)(c, filter->data));
}
return c;
} | false | false | false | false | false | 0 |
bytes_per_sample ( unsigned char bt )
{
int recsiz = 1;
if ( S710_HAS_ALTITUDE(bt) ) recsiz += 2;
if ( S710_HAS_SPEED(bt) ) {
if ( S710_HAS_ALTITUDE(bt) ) recsiz -= 1;
recsiz += 2;
if ( S710_HAS_POWER(bt) ) recsiz += 4;
if ( S710_HAS_CADENCE(bt) ) recsiz += 1;
}
return recsiz;
} | false | false | false | false | false | 0 |
zeitgeist_data_source_registry_extension_real_register_data_source_data_free (gpointer _data) {
ZeitgeistDataSourceRegistryExtensionRegisterDataSourceData* _data_;
_data_ = _data;
_g_free0 (_data_->unique_id);
_g_free0 (_data_->name);
_g_free0 (_data_->description);
_g_variant_unref0 (_data_->event_templates);
_g_object_unref0 (_data_->cancellable);
_g_free0 (_data_->sender);
_g_object_unref0 (_data_->self);
g_slice_free (ZeitgeistDataSourceRegistryExtensionRegisterDataSourceData, _data_);
} | false | false | false | false | false | 0 |
reduceu(const void* src, int sstride, int uw, int vw,
void* dst, int dstride, DataType dt, int nchan)
{
switch (dt) {
case dt_uint8: ::reduceu((const uint8_t*) src, sstride, uw, vw,
(uint8_t*) dst, dstride, nchan); break;
case dt_half: ::reduceu((const PtexHalf*) src, sstride, uw, vw,
(PtexHalf*) dst, dstride, nchan); break;
case dt_uint16: ::reduceu((const uint16_t*) src, sstride, uw, vw,
(uint16_t*) dst, dstride, nchan); break;
case dt_float: ::reduceu((const float*) src, sstride, uw, vw,
(float*) dst, dstride, nchan); break;
}
} | false | false | false | false | false | 0 |
settings_value_as_int(char *value, int def)
{
int intval;
if (value)
{
errno = 0;
intval = strtol(value, NULL, 10);
if (errno == 0)
{
return intval;
}
}
return def;
} | false | false | false | false | false | 0 |
detune(detune_state *s, float x)
{
float *a1, *a2, *b1, *b2, a, b;
float c;
float y;
// advance
*(s->dl.p) = x;
(s->dl.p)++;
wrap(DETUNE_RING_m-1, s->dl.w, &s->dl.p);
if (s->delta == 1)
s->offset = s->dl.p - s->dl.w;
int i = floor(s->offset);
float frac = s->offset - i;
// get pointers to a and b, then linearly interpolate
a1 = s->dl.w + i;
a2 = a1+1;
wrap(DETUNE_RING_m-1, s->dl.w, &a1);
wrap(DETUNE_RING_m-1, s->dl.w, &a2);
i = i + DETUNE_RING_m/2;
b1 = s->ring + i;
b2 = b1+1;
wrap(DETUNE_RING_m-1, s->dl.w, &b1);
wrap(DETUNE_RING_m-1, s->dl.w, &b2);
a = linterpolate(*a1, *a2, frac);
b = linterpolate(*b1, *b2, frac);
// how much crossfade?
int p = s->dl.p - s->dl.w;
c = fabs(s->offset - p);
#if 0
// This doesn't seem to work very well.
if (c > DETUNE_RING_m/2)
c -= DETUNE_RING_m/2;
c /= DETUNE_RING_m;
#else
c = 1; // always a. seems to work best. yes, could optimize away b
#endif
// calculate y
y = c*a + (1-c)*b;
s->offset += s->delta;
while (s->offset > DETUNE_RING_m-1)
s->offset -= DETUNE_RING_m;
return y;
} | false | false | false | false | false | 0 |
l2tp_session_try_send(struct l2tp_sess_t *sess,
struct l2tp_packet_t *pack)
{
if (sess->paren_conn->send_queue_len >= sess->paren_conn->peer_rcv_wnd_sz)
return -1;
l2tp_session_send(sess, pack);
return 0;
} | false | false | false | false | false | 0 |
kdb_input_flush(void)
{
get_char_func *f;
int res;
int flush_delay = 1;
while (flush_delay) {
flush_delay--;
empty:
touch_nmi_watchdog();
for (f = &kdb_poll_funcs[0]; *f; ++f) {
res = (*f)();
if (res != -1) {
flush_delay = 1;
goto empty;
}
}
if (flush_delay)
mdelay(1);
}
} | true | true | false | false | false | 1 |
initialize_openssl(const SSL_METHOD *method, const char *ciphers)
{
SSL_CTX *ssl_ctx;
(void)SSL_library_init();
SSL_load_error_strings();
(void)atexit(ERR_free_strings);
/*
* In earlier versions, we called
*
* OPENSSL_config(NULL);
* (void)atexit(CONF_modules_free);
*
* at this point. The OPENSSL_config(3) man page claims that this
* function "ignores all errors", but that's not true: at least OpenSSL
* 1.0.1e exit(3)s in OPENSSL_config(3) on certain error conditions.
*/
if ((ssl_ctx = SSL_CTX_new(method)) == NULL)
die("Cannot create SSL context");
if (SSL_CTX_set_cipher_list(ssl_ctx, ciphers) != 1)
die("Cannot set SSL cipher(s)");
(void)SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
(void)SSL_CTX_set_mode(ssl_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
(void)signal(SIGPIPE, SIG_IGN);
return ssl_ctx;
} | false | false | false | false | false | 0 |
ran2()
{
gint i,j;
gdouble f;
i=j=0;
/* generate 2 random (non 0) integers */
while(!i)
i = rand();
while(!j)
j = rand();
/* convert to a single float (0.0,1.0] */
if (i > j)
f = (gdouble) j / (gdouble) i;
else
f = (gdouble) i / (gdouble) j;
return f;
} | false | false | false | false | false | 0 |
host_is_centry_referenced(const lListElem *this_elem, const lListElem *centry)
{
bool ret = false;
DENTER(TOP_LAYER, "host_is_centry_referenced");
if (this_elem != NULL) {
const char *name = lGetString(centry, CE_name);
const lList *ce_values = lGetList(this_elem, EH_consumable_config_list);
const lList *load_list = lGetList(this_elem, EH_load_list);
const lList *rep_vars = lGetList(this_elem, EH_report_variables);
/*
* centry may be referenced in
* - complex_values
* - load_list
* - report_variables
*/
if (lGetElemStr(ce_values, CE_name, name) != NULL ||
lGetElemStr(load_list, HL_name, name) != NULL ||
lGetElemStr(rep_vars, STU_name, name) != NULL) {
ret = true;
}
}
DRETURN(ret);
} | false | false | false | false | false | 0 |
enterLoop(void *owner, bool showIt)
{
void *old_owner = _loop_owner;
int l = _loopLevel;
GtkWindowGroup *oldGroup;
oldGroup = enterGroup();
if (showIt) ((gControl *)owner)->show();
_loopLevel++;
_loop_owner = owner;
do
{
MAIN_do_iteration(false);
}
while (_loopLevel > l);
_loop_owner = old_owner;
exitGroup(oldGroup);
} | false | false | false | false | false | 0 |
http_rxhdr(struct http *hp)
{
int i;
char *p;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
hp->prxbuf = 0;
hp->body = NULL;
while (1) {
http_rxchar(hp, 1);
p = hp->rxbuf + hp->prxbuf - 1;
for (i = 0; p > hp->rxbuf; p--) {
if (*p != '\n')
break;
if (p - 1 > hp->rxbuf && p[-1] == '\r')
p--;
if (++i == 2)
break;
}
if (i == 2)
break;
}
vtc_dump(hp->vl, 4, "rxhdr", hp->rxbuf, -1);
} | false | false | false | false | false | 0 |
sorted_set_tests_test_last (SortedSetTests* self) {
GeeSortedSet* test_set = NULL;
GeeCollection* _tmp0_ = NULL;
GeeSortedSet* _tmp1_ = NULL;
gboolean _tmp2_ = FALSE;
GeeSortedSet* _tmp7_ = NULL;
gboolean _tmp8_ = FALSE;
GeeSortedSet* _tmp9_ = NULL;
gboolean _tmp10_ = FALSE;
GeeSortedSet* _tmp11_ = NULL;
gboolean _tmp12_ = FALSE;
GeeSortedSet* _tmp13_ = NULL;
gboolean _tmp14_ = FALSE;
GeeSortedSet* _tmp15_ = NULL;
gboolean _tmp16_ = FALSE;
GeeSortedSet* _tmp17_ = NULL;
gboolean _tmp18_ = FALSE;
GeeSortedSet* _tmp19_ = NULL;
gpointer _tmp20_ = NULL;
gchar* _tmp21_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = ((CollectionTests*) self)->test_collection;
_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL);
test_set = _tmp1_;
_tmp2_ = self->priv->strict;
if (_tmp2_) {
gboolean _tmp3_ = FALSE;
_tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
if (_tmp3_) {
GeeSortedSet* _tmp4_ = NULL;
gpointer _tmp5_ = NULL;
gchar* _tmp6_ = NULL;
_tmp4_ = test_set;
_tmp5_ = gee_sorted_set_last (_tmp4_);
_tmp6_ = (gchar*) _tmp5_;
_g_free0 (_tmp6_);
exit (0);
}
g_test_trap_assert_failed ();
}
_tmp7_ = test_set;
_tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one");
_vala_assert (_tmp8_, "test_set.add (\"one\")");
_tmp9_ = test_set;
_tmp10_ = gee_collection_add ((GeeCollection*) _tmp9_, "two");
_vala_assert (_tmp10_, "test_set.add (\"two\")");
_tmp11_ = test_set;
_tmp12_ = gee_collection_add ((GeeCollection*) _tmp11_, "three");
_vala_assert (_tmp12_, "test_set.add (\"three\")");
_tmp13_ = test_set;
_tmp14_ = gee_collection_add ((GeeCollection*) _tmp13_, "four");
_vala_assert (_tmp14_, "test_set.add (\"four\")");
_tmp15_ = test_set;
_tmp16_ = gee_collection_add ((GeeCollection*) _tmp15_, "five");
_vala_assert (_tmp16_, "test_set.add (\"five\")");
_tmp17_ = test_set;
_tmp18_ = gee_collection_add ((GeeCollection*) _tmp17_, "six");
_vala_assert (_tmp18_, "test_set.add (\"six\")");
_tmp19_ = test_set;
_tmp20_ = gee_sorted_set_last (_tmp19_);
_tmp21_ = (gchar*) _tmp20_;
_vala_assert (g_strcmp0 (_tmp21_, "two") == 0, "test_set.last () == \"two\"");
_g_free0 (_tmp21_);
_g_object_unref0 (test_set);
} | false | false | false | false | false | 0 |
RunScript(cmCTest* ctest, const char *sname,
bool InProcess)
{
cmCTestScriptHandler* sh = new cmCTestScriptHandler();
sh->SetCTestInstance(ctest);
sh->AddConfigurationScript(sname,InProcess);
sh->ProcessHandler();
delete sh;
return true;
} | false | false | false | false | false | 0 |
assuan_disconnect (assuan_context_t ctx)
{
if (ctx)
{
assuan_write_line (ctx, "BYE");
ctx->finish_handler (ctx);
ctx->deinit_handler (ctx);
ctx->deinit_handler = NULL;
_assuan_release_context (ctx);
}
} | false | false | false | false | false | 0 |
storeSwapMetaPack(tlv * tlv_list, int *length)
{
int buflen = 0;
tlv *t;
int j = 0;
char *buf;
assert(length != NULL);
buflen++; /* STORE_META_OK */
buflen += sizeof(int); /* size of header to follow */
for (t = tlv_list; t; t = t->next)
buflen += sizeof(char) + sizeof(int) + t->length;
buf = xmalloc(buflen);
buf[j++] = (char) STORE_META_OK;
xmemcpy(&buf[j], &buflen, sizeof(int));
j += sizeof(int);
for (t = tlv_list; t; t = t->next) {
buf[j++] = (char) t->type;
xmemcpy(&buf[j], &t->length, sizeof(int));
j += sizeof(int);
xmemcpy(&buf[j], t->value, t->length);
j += t->length;
}
assert((int) j == buflen);
*length = buflen;
return buf;
} | false | false | false | true | false | 1 |
cmdline_parse (int key, char *arg, struct argp_state *state)
{
struct ipmi_sensors_config_arguments *cmd_args = state->input;
error_t ret;
switch (key)
{
case ARGP_KEY_ARG:
/* Too many arguments. */
argp_usage (state);
break;
case ARGP_KEY_END:
break;
default:
ret = config_parse_opt (key, arg, &cmd_args->config_args);
if (ret == ARGP_ERR_UNKNOWN)
ret = common_parse_opt (key, arg, &(cmd_args->config_args.common));
if (ret == ARGP_ERR_UNKNOWN)
ret = sdr_parse_opt (key, arg, &(cmd_args->sdr));
if (ret == ARGP_ERR_UNKNOWN)
ret = hostrange_parse_opt (key, arg, &(cmd_args->config_args.hostrange));
return (ret);
}
return (0);
} | false | false | false | false | false | 0 |
HeaderFocus(int h, int offset)
{
register struct hdr_line *l;
register int i;
int last = 0;
if(offset == -1) /* focus on last line */
last = 1;
l = headents[h].hd_text;
while(1){
if(last && l->next == NULL){
break;
}
else{
if((i=ucs4_strlen(l->text)) >= offset)
break;
else
offset -= i;
}
if((l = l->next) == NULL)
return(FALSE);
}
ods.cur_l = l;
ods.p_len = ucs4_strlen(l->text);
ods.p_ind = (last) ? 0 : offset;
return(TRUE);
} | false | false | false | false | false | 0 |
isEndpointNotSupported(const std::string& endpoint) const {
const std::string::size_type pos = endpoint.find("://");
return pos != std::string::npos && lower(endpoint.substr(0, pos)) != "gsiftp";
} | false | false | false | false | false | 0 |
child_setup (gpointer user_data)
{
ChildData *child_data = user_data;
gint i;
gint result;
/* We're on the child side now. "Rename" the file descriptors in
* child_data.fds[] to stdin/stdout/stderr.
*
* We don't close the originals. It's possible that the originals
* should not be closed and if they should be closed then they should
* have been created O_CLOEXEC.
*/
for (i = 0; i < 3; i++)
{
if (child_data->fds[i] != -1 && child_data->fds[i] != i)
{
do
result = dup2 (child_data->fds[i], i);
while (G_UNLIKELY (result == -1 && errno == EINTR));
}
}
/* Unset the CLOEXEC flag for the child *should* inherit */
for (i = 0; i < child_data->inherit_fds->len; i++)
{
int fd = g_array_index (child_data->inherit_fds, int, i);
int flags;
do
flags = fcntl (fd, F_GETFL);
while (G_UNLIKELY (flags == -1 && errno == EINTR));
flags &= ~FD_CLOEXEC;
do
result = fcntl (fd, F_SETFD, flags);
while (G_UNLIKELY (result == -1 && errno == EINTR));
}
if (child_data->child_setup_func)
child_data->child_setup_func (child_data->child_setup_data);
} | false | false | false | false | false | 0 |
e_def_10_(
fortint * inputArray,
unsigned char * gribSection1,
fortint * bitPointer) {
/*
// Encodes ECMWF local definition 10 (from byte 41 onwards) into
// gribSection1 using integer array values in inputArray.
//
// inputArray[0] corresponds to KSEC1(37) in the description at
// http://www.ecmwf.int/publications/manuals/libraries/gribex/localDefinition10.html
//
// If *bitPointer is not equal to zero, the length of the GRIB section
// 1 is stored in 3 bytes starting at (gribSection1-40).
// *bitPointer is updated by the number of bits in local definition 10.
//
// Returns the number of bytes (octets) in local definition 10 after
// byte 40.
*/
int loop, N;
fortint value, byteLength;
fortint * n = inputArray;
unsigned char * p = gribSection1;
encodeMarsPart(n,p);
p += 9;
n += 5;
*p++ = ONEBYTE(n);n++; /* NUMBER */
*p++ = ONEBYTE(n);n++; /* TOTAL */
*p++ = ONEBYTE(n);n++; /* CENTRALDEFINITION */
*p++ = ONEBYTE(n);n++; /* PARAMETER */
*p++ = ONEBYTE(n);n++; /* LEVELTYPE */
/*
// When coding values, set sign bit to 1, if value is negative.
*/
value = *n++; /* NORTH */
if( value < 0 ) value = 0x800000 | (-value);
MOVE3BYTES(p,&value);
p += 3;
value = *n++; /* WEST */
if( value < 0 ) value = 0x800000 | (-value);
MOVE3BYTES(p,&value);
p += 3;
value = *n++; /* SOUTH */
if( value < 0 ) value = 0x800000 | (-value);
MOVE3BYTES(p,&value);
p += 3;
value = *n++; /* EAST */
if( value < 0 ) value = 0x800000 | (-value);
MOVE3BYTES(p,&value);
p += 3;
*p++ = ONEBYTE(n);n++; /* OPERFORECASTTUBE */
*p++ = ONEBYTE(n);n++; /* CONTROLFORECASTTUBE */
MOVE2BYTES(p,n); /* HEIGHT */
p += 2;
n++;
MOVE2BYTES(p,n); /* STEP */
p += 2;
n++;
MOVE2BYTES(p,n); /* RADIUS */
p += 2;
n++;
MOVE2BYTES(p,n); /* ENSEMBLEDEVIATION */
p += 2;
n++;
MOVE2BYTES(p,n); /* DISTANCEEXTREME */
p += 2;
n++;
N = *n; /* NUMBERINTUBE */
*p++ = ONEBYTE(n++);
for( loop = 0; loop < N; loop++) /* ENSEMBLE FORECAST NUMBERS */
*p++ = ONEBYTE(n++);
/*
// Definition 10 has a fixed length section 1 (334 bytes)
*/
for( loop = N; loop < (334-39); loop++)
*p++ = (unsigned char) 0;
byteLength = 334;
if( *bitPointer ) {
MOVE3BYTES(gribSection1-40,&byteLength);
*bitPointer += (byteLength-40)*8;
}
return (fortint) byteLength;
} | false | false | false | false | false | 0 |
removeConnection(Connection *connection)
{
if (peers.contains(connection->peerAddress())) {
peers.remove(connection->peerAddress());
QString nick = connection->name();
if (!nick.isEmpty())
emit participantLeft(nick);
}
connection->deleteLater();
} | false | false | false | false | false | 0 |
resend_events (GstPad * pad, GstEvent ** event, gpointer user_data)
{
GstRTPMux *rtp_mux = user_data;
if (GST_EVENT_TYPE (*event) == GST_EVENT_CAPS) {
GstCaps *caps;
gst_event_parse_caps (*event, &caps);
gst_rtp_mux_setcaps (pad, rtp_mux, caps);
} else {
gst_pad_push_event (rtp_mux->srcpad, gst_event_ref (*event));
}
return TRUE;
} | false | false | false | false | false | 0 |
gf_size(gf_t *gf)
{
gf_internal_t *h;
int s;
s = sizeof(gf_t);
h = (gf_internal_t *) gf->scratch;
s += gf_scratch_size(h->w, h->mult_type, h->region_type, h->divide_type, h->arg1, h->arg2);
if (h->mult_type == GF_MULT_COMPOSITE) s += gf_size(h->base_gf);
return s;
} | false | false | false | false | false | 0 |
fuse_ll_destroy(void *data)
{
struct fuse_ll *f = (struct fuse_ll *) data;
struct fuse_ll_pipe *llp;
if (f->got_init && !f->got_destroy) {
if (f->op.destroy)
f->op.destroy(f->userdata);
}
llp = pthread_getspecific(f->pipe_key);
if (llp != NULL)
fuse_ll_pipe_free(llp);
pthread_key_delete(f->pipe_key);
pthread_mutex_destroy(&f->lock);
free(f->cuse_data);
free(f);
} | false | false | false | false | false | 0 |
mpegpsmux_create_streams (MpegPsMux * mux)
{
/* Create stream for each pad */
GstFlowReturn ret = GST_FLOW_OK;
GSList *walk = mux->collect->data;
/* Create the streams */
while (walk) {
GstCollectData *c_data = (GstCollectData *) walk->data;
MpegPsPadData *ps_data = (MpegPsPadData *) walk->data;
walk = g_slist_next (walk);
if (ps_data->stream == NULL) {
ret = mpegpsmux_create_stream (mux, ps_data, c_data->pad);
if (ret != GST_FLOW_OK)
goto no_stream;
}
}
return GST_FLOW_OK;
no_stream:
GST_ELEMENT_ERROR (mux, STREAM, MUX,
("Could not create handler for stream"), (NULL));
return ret;
} | false | false | false | false | false | 0 |
nemo_clipboard_real_set_up (gpointer target,
GtkUIManager *ui_manager,
gboolean shares_selection_changes,
SelectAllCallback select_all_callback,
ConnectCallbacksFunc connect_callbacks,
ConnectCallbacksFunc disconnect_callbacks)
{
TargetCallbackData *target_data;
if (g_object_get_data (G_OBJECT (target), "Nemo:clipboard_target_data") != NULL) {
return;
}
target_data = initialize_clipboard_component_with_callback_data
(target,
ui_manager,
shares_selection_changes,
select_all_callback,
connect_callbacks,
disconnect_callbacks);
g_signal_connect (target, "focus_in_event",
G_CALLBACK (focus_changed_callback), target_data);
g_signal_connect (target, "focus_out_event",
G_CALLBACK (focus_changed_callback), target_data);
g_signal_connect (target, "destroy",
G_CALLBACK (target_destroy_callback), target_data);
g_object_set_data_full (G_OBJECT (target), "Nemo:clipboard_target_data",
target_data, (GDestroyNotify) target_data_free);
/* Call the focus changed callback once to merge if the window is
* already in focus.
*/
focus_changed_callback (GTK_WIDGET (target), NULL, target_data);
} | false | false | false | false | false | 0 |
error(const yy::location& l, const std::string& msg)
{
if (mWant2ndPass) return;
mErrorOccured = true;
warning(l, msg);
} | false | false | false | false | false | 0 |
dbs_put(const DB *dbs, DBT *key, const DBT *data, unsigned int flags)
{
DBT blob;
int ret = 0;
DBS *dbsp = (DBS *)dbs;
DB *db = (DB *)dbs->internal;
dbs_freemap(dbsp);
/* If the db is readonly, just pass the data down to rdb and let it fail */
if (!dbsp->readOnly) {
DBT oldData;
int ret1;
/* make sure the current record is deleted if it's a blob */
ret1 = (*db->get)(db,key,&oldData,0);
if ((ret1 == 0) && flags == R_NOOVERWRITE) {
/* let DBM return the error to maintain consistancy */
return (* db->put)(db, key, data, flags);
}
if ((ret1 == 0) && dbs_IsBlob(&oldData)) {
dbs_removeBlob(dbsp, &oldData);
}
if (data->size > DBS_MAX_ENTRY_SIZE) {
dbs_mkBlob(dbsp,key,data,&blob);
ret = dbs_writeBlob(dbsp, dbsp->mode, &blob, data);
data = &blob;
}
}
if (ret == 0) {
ret = (* db->put)(db, key, data, flags);
}
return(ret);
} | false | false | false | false | false | 0 |
seqiv_geniv(struct seqiv_ctx *ctx, u8 *info, u64 seq,
unsigned int ivsize)
{
unsigned int len = ivsize;
if (ivsize > sizeof(u64)) {
memset(info, 0, ivsize - sizeof(u64));
len = sizeof(u64);
}
seq = cpu_to_be64(seq);
memcpy(info + ivsize - len, &seq, len);
crypto_xor(info, ctx->salt, ivsize);
} | false | false | false | false | false | 0 |
os_adjust_filename(CHAR *filename)
{
CHAR *p;
if(filename)
{
p = filename;
while(*p)
{
if( *p == '\'' ||
*p == '\"' ||
*p == '\\' ||
*p == '\t' ||
*p == '=' ||
*p == ',' ||
*p == ';' ||
*p == ':' ||
*p == '*' ||
*p == '?' ||
*p == '|' ||
*p == '/' ||
*p == '>' ||
*p == '<' )
{
*p = '_';
}
p++;
}
}
return filename;
} | false | false | false | false | false | 0 |
setExistingAttribute(const char *key, const char *value) {
string itkey = string(key) + "=" + value;
unordered_map<string,size_t>::iterator it = this->disused_attributes.find(itkey);
if (it == this->disused_attributes.end()) this->disused_attributes[itkey] = 1;
else it->second++;
} | false | false | false | false | false | 0 |
SetImageExtent(Image *image,
const size_t columns,const size_t rows)
{
if ((columns == 0) || (rows == 0))
return(MagickFalse);
image->columns=columns;
image->rows=rows;
return(SyncImagePixelCache(image,&image->exception));
} | false | false | false | false | false | 0 |
asic_should_init(struct hfi1_devdata *dd)
{
unsigned long flags;
struct hfi1_devdata *tmp, *peer = NULL;
spin_lock_irqsave(&hfi1_devs_lock, flags);
/* Find our peer device */
list_for_each_entry(tmp, &hfi1_dev_list, list) {
if ((HFI_BASE_GUID(dd) == HFI_BASE_GUID(tmp)) &&
dd->unit != tmp->unit) {
peer = tmp;
break;
}
}
/*
* "Claim" the ASIC for initialization if it hasn't been
" "claimed" yet.
*/
if (!peer || !(peer->flags & HFI1_DO_INIT_ASIC))
dd->flags |= HFI1_DO_INIT_ASIC;
spin_unlock_irqrestore(&hfi1_devs_lock, flags);
} | false | false | false | false | false | 0 |
verify_edge_list (FILE *f, struct edge_list *elist)
{
int pred, succ, index;
edge e;
basic_block bb, p, s;
edge_iterator ei;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
{
FOR_EACH_EDGE (e, ei, bb->succs)
{
pred = e->src->index;
succ = e->dest->index;
index = EDGE_INDEX (elist, e->src, e->dest);
if (index == EDGE_INDEX_NO_EDGE)
{
fprintf (f, "*p* No index for edge from %d to %d\n", pred, succ);
continue;
}
if (INDEX_EDGE_PRED_BB (elist, index)->index != pred)
fprintf (f, "*p* Pred for index %d should be %d not %d\n",
index, pred, INDEX_EDGE_PRED_BB (elist, index)->index);
if (INDEX_EDGE_SUCC_BB (elist, index)->index != succ)
fprintf (f, "*p* Succ for index %d should be %d not %d\n",
index, succ, INDEX_EDGE_SUCC_BB (elist, index)->index);
}
}
/* We've verified that all the edges are in the list, now lets make sure
there are no spurious edges in the list. */
FOR_BB_BETWEEN (p, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
FOR_BB_BETWEEN (s, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
{
int found_edge = 0;
FOR_EACH_EDGE (e, ei, p->succs)
if (e->dest == s)
{
found_edge = 1;
break;
}
FOR_EACH_EDGE (e, ei, s->preds)
if (e->src == p)
{
found_edge = 1;
break;
}
if (EDGE_INDEX (elist, p, s)
== EDGE_INDEX_NO_EDGE && found_edge != 0)
fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
p->index, s->index);
if (EDGE_INDEX (elist, p, s)
!= EDGE_INDEX_NO_EDGE && found_edge == 0)
fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
p->index, s->index, EDGE_INDEX (elist, p, s));
}
} | false | false | false | true | false | 1 |
log(const c8* message, const c8* hint, ELOG_LEVEL ll)
{
if (Logger)
Logger->log(message, hint, ll);
} | false | false | false | false | false | 0 |
MangleClassName(char * className)
{
char output[1024];
int c, d = 0;
char ch;
for(c = 0; (ch = className[c]); c++)
{
if(ch == ' ')
output[d++] = '_';
else if(ch == '*')
{
output[d++] = '_';
output[d++] = 'P';
output[d++] = 'T';
output[d++] = 'R';
output[d++] = '_';
}
else if(ch == '<')
{
output[d++] = '_';
output[d++] = 'T';
output[d++] = 'P';
output[d++] = 'L';
output[d++] = '_';
}
else if(ch == '=')
{
output[d++] = '_';
output[d++] = 'E';
output[d++] = 'Q';
output[d++] = 'U';
output[d++] = '_';
}
else if(ch == '>')
{
output[d++] = '_';
}
else if(ch == ',')
{
output[d++] = '__';
}
else
output[d++] = ch;
}
output[d] = (char)0;
} | true | true | false | false | false | 1 |
sort(int l, int r, int dim, int rank[])
{
int i;
if (r > l)
{
i = partition(l, r, dim, rank);
sort(l, i - 1, dim, rank);
sort(i + 1, r, dim, rank);
}
} | false | false | false | false | false | 0 |
enum_list(int first, int last)
{
char buf[50];
for(int i = first; i <= last; i++)
{
snprintf(buf, sizeof(buf), "%d", i);
item(buf, i);
}
} | false | false | false | false | false | 0 |
smu_free_memory(void *device, void *handle)
{
cgs_handle_t cgs_handle = (cgs_handle_t)handle;
if (device == NULL || handle == NULL)
return -EINVAL;
cgs_kunmap_gpu_mem(device, cgs_handle);
cgs_gunmap_gpu_mem(device, cgs_handle);
cgs_free_gpu_mem(device, cgs_handle);
return 0;
} | false | false | false | false | false | 0 |
enable_count_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct devfreq_event_dev *edev = to_devfreq_event(dev);
if (!edev || !edev->desc)
return -EINVAL;
return sprintf(buf, "%d\n", edev->enable_count);
} | false | false | false | false | false | 0 |
pixaWriteStream(FILE *fp,
PIXA *pixa)
{
l_int32 n, i;
PIX *pix;
PROCNAME("pixaWriteStream");
#if !HAVE_LIBPNG /* defined in environ.h and config_auto.h */
return ERROR_INT("no libpng: can't write data", procName, 1);
#endif /* !HAVE_LIBPNG */
if (!fp)
return ERROR_INT("stream not defined", procName, 1);
if (!pixa)
return ERROR_INT("pixa not defined", procName, 1);
n = pixaGetCount(pixa);
fprintf(fp, "\nPixa Version %d\n", PIXA_VERSION_NUMBER);
fprintf(fp, "Number of pix = %d\n", n);
boxaWriteStream(fp, pixa->boxa);
for (i = 0; i < n; i++) {
if ((pix = pixaGetPix(pixa, i, L_CLONE)) == NULL)
return ERROR_INT("pix not found", procName, 1);
fprintf(fp, " pix[%d]: xres = %d, yres = %d\n",
i, pix->xres, pix->yres);
pixWriteStreamPng(fp, pix, 0.0);
pixDestroy(&pix);
}
return 0;
} | false | false | false | false | false | 0 |
dump_cattrs_for_method_params (MonoImage *m, guint32 midx, MonoMethodSignature *sig) {
MonoTableInfo *methodt;
MonoTableInfo *paramt;
guint param_index, lastp, i;
methodt = &m->tables [MONO_TABLE_METHOD];
paramt = &m->tables [MONO_TABLE_PARAM];
param_index = mono_metadata_decode_row_col (methodt, midx, MONO_METHOD_PARAMLIST);
if (midx + 1 < methodt->rows)
lastp = mono_metadata_decode_row_col (methodt, midx + 1, MONO_METHOD_PARAMLIST);
else
lastp = paramt->rows + 1;
for (i = param_index; i < lastp; ++i) {
char *lit;
int crow;
guint32 param_cols [MONO_PARAM_SIZE];
GList *list;
list = dis_get_custom_attrs (m, MONO_TOKEN_PARAM_DEF | i);
mono_metadata_decode_row (paramt, i-1, param_cols, MONO_PARAM_SIZE);
if (!(param_cols[MONO_PARAM_FLAGS] & PARAM_ATTRIBUTE_HAS_DEFAULT)) {
if(list != NULL)
fprintf (output, "\t.param [%d]\n", param_cols[MONO_PARAM_SEQUENCE]);
} else {
fprintf (output, "\t.param [%d] = ", param_cols[MONO_PARAM_SEQUENCE]);
if ((crow = mono_metadata_get_constant_index(m, MONO_TOKEN_PARAM_DEF | i, 0))) {
guint32 const_cols [MONO_CONSTANT_SIZE];
mono_metadata_decode_row( &m->tables[MONO_TABLE_CONSTANT], crow-1, const_cols, MONO_CONSTANT_SIZE);
lit = get_constant (m, (MonoTypeEnum)const_cols [MONO_CONSTANT_TYPE], const_cols [MONO_CONSTANT_VALUE]);
}
else {
lit = g_strdup ("not found");
}
fprintf(output, "%s\n", lit);
g_free(lit);
}
dump_cattrs_list (list, "\t");
}
} | false | false | false | false | false | 0 |
shell_cf( ConfigArgs *c )
{
struct shellinfo *si = (struct shellinfo *) c->be->be_private;
char ***arr = &si->si_bind;
if ( c->op == SLAP_CONFIG_EMIT ) {
struct berval bv;
if ( !arr[c->type] ) return 1;
bv.bv_val = ldap_charray2str( arr[c->type], " " );
bv.bv_len = strlen( bv.bv_val );
ber_bvarray_add( &c->rvalue_vals, &bv );
} else if ( c->op == LDAP_MOD_DELETE ) {
ldap_charray_free( arr[c->type] );
arr[c->type] = NULL;
} else {
arr[c->type] = ldap_charray_dup( &c->argv[1] );
}
return 0;
} | false | false | false | false | false | 0 |
init_rand(struct frand_state *state, int use64)
{
state->use64 = use64;
if (!use64)
__init_rand32(&state->state32, 1);
else
__init_rand64(&state->state64, 1);
} | 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.