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
|
---|---|---|---|---|---|---|
PostorderLoopBlocks(HLoopInformation* loop,
BitVector* visited,
ZoneList<HBasicBlock*>* order,
HBasicBlock* loop_header) {
for (int i = 0; i < loop->blocks()->length(); ++i) {
HBasicBlock* b = loop->blocks()->at(i);
for (HSuccessorIterator it(b->end()); !it.Done(); it.Advance()) {
Postorder(it.Current(), visited, order, loop_header);
}
if (b->IsLoopHeader() && b != loop->loop_header()) {
PostorderLoopBlocks(b->loop_information(), visited, order, loop_header);
}
}
} | false | false | false | false | false | 0 |
pmdie(SIGNAL_ARGS)
{
int save_errno = errno;
PG_SETMASK(&BlockSig);
ereport(DEBUG2,
(errmsg_internal("postmaster received signal %d",
postgres_signal_arg)));
switch (postgres_signal_arg)
{
case SIGTERM:
/*
* Smart Shutdown:
*
* Wait for children to end their work, then shut down.
*/
if (Shutdown >= SmartShutdown)
break;
Shutdown = SmartShutdown;
ereport(LOG,
(errmsg("received smart shutdown request")));
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
pmState == PM_HOT_STANDBY || pmState == PM_STARTUP)
{
/* autovacuum workers are told to shut down immediately */
SignalSomeChildren(SIGTERM, BACKEND_TYPE_AUTOVAC);
/* and the autovac launcher too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
/* and the walwriter too */
if (WalWriterPID != 0)
signal_child(WalWriterPID, SIGTERM);
/*
* If we're in recovery, we can't kill the startup process
* right away, because at present doing so does not release
* its locks. We might want to change this in a future
* release. For the time being, the PM_WAIT_READONLY state
* indicates that we're waiting for the regular (read only)
* backends to die off; once they do, we'll kill the startup
* and walreceiver processes.
*/
pmState = (pmState == PM_RUN) ?
PM_WAIT_BACKUP : PM_WAIT_READONLY;
}
/*
* Now wait for online backup mode to end and backends to exit. If
* that is already the case, PostmasterStateMachine will take the
* next step.
*/
PostmasterStateMachine();
break;
case SIGINT:
/*
* Fast Shutdown:
*
* Abort all children with SIGTERM (rollback active transactions
* and exit) and shut down when they are gone.
*/
if (Shutdown >= FastShutdown)
break;
Shutdown = FastShutdown;
ereport(LOG,
(errmsg("received fast shutdown request")));
if (StartupPID != 0)
signal_child(StartupPID, SIGTERM);
if (WalReceiverPID != 0)
signal_child(WalReceiverPID, SIGTERM);
if (pmState == PM_RECOVERY)
{
/* only bgwriter is active in this state */
pmState = PM_WAIT_BACKENDS;
}
else if (pmState == PM_RUN ||
pmState == PM_WAIT_BACKUP ||
pmState == PM_WAIT_READONLY ||
pmState == PM_WAIT_BACKENDS ||
pmState == PM_HOT_STANDBY)
{
ereport(LOG,
(errmsg("aborting any active transactions")));
/* shut down all backends and autovac workers */
SignalSomeChildren(SIGTERM,
BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC);
/* and the autovac launcher too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
/* and the walwriter too */
if (WalWriterPID != 0)
signal_child(WalWriterPID, SIGTERM);
pmState = PM_WAIT_BACKENDS;
}
/*
* Now wait for backends to exit. If there are none,
* PostmasterStateMachine will take the next step.
*/
PostmasterStateMachine();
break;
case SIGQUIT:
/*
* Immediate Shutdown:
*
* abort all children with SIGQUIT and exit without attempt to
* properly shut down data base system.
*/
ereport(LOG,
(errmsg("received immediate shutdown request")));
SignalChildren(SIGQUIT);
if (StartupPID != 0)
signal_child(StartupPID, SIGQUIT);
if (BgWriterPID != 0)
signal_child(BgWriterPID, SIGQUIT);
if (WalWriterPID != 0)
signal_child(WalWriterPID, SIGQUIT);
if (WalReceiverPID != 0)
signal_child(WalReceiverPID, SIGQUIT);
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGQUIT);
if (PgArchPID != 0)
signal_child(PgArchPID, SIGQUIT);
if (PgStatPID != 0)
signal_child(PgStatPID, SIGQUIT);
ExitPostmaster(0);
break;
}
PG_SETMASK(&UnBlockSig);
errno = save_errno;
} | false | false | false | false | false | 0 |
GetCA(Signer* signers, byte* hash)
{
Signer* ret = 0;
if (LockMutex(&ca_mutex) != 0)
return ret;
while (signers) {
if (XMEMCMP(hash, signers->hash, SHA_DIGEST_SIZE) == 0) {
ret = signers;
break;
}
signers = signers->next;
}
UnLockMutex(&ca_mutex);
return ret;
} | false | false | false | false | false | 0 |
Java_ncsa_hdf_hdflib_HDFLibrary_SDsetcal
( JNIEnv *env,
jclass clss,
jint sds_id,
jdouble cal,
jdouble cal_err,
jdouble offset,
jdouble offset_err,
jint number_type)
{
intn rval;
rval = SDsetcal((int32) sds_id, (float64) cal, (float64) cal_err,
(float64) offset, (float64) offset_err, (int32) number_type) ;
if (rval==FAIL) {
return JNI_FALSE;
} else {
return JNI_TRUE;
}
} | false | false | false | false | false | 0 |
gcm_inspect_print_data_info (const gchar *title, const guint8 *data, gsize length)
{
GcmProfile *profile = NULL;
GError *error = NULL;
gboolean ret;
/* parse the data */
profile = gcm_profile_new ();
ret = gcm_profile_parse_data (profile, data, length, &error);
if (!ret) {
g_warning ("failed to parse data: %s", error->message);
g_error_free (error);
goto out;
}
/* print title */
g_print ("%s\n", title);
/* TRANSLATORS: this is the ICC profile description stored in an atom in the XServer */
g_print (" - %s %s\n", _("Description:"), gcm_profile_get_description (profile));
/* TRANSLATORS: this is the ICC profile copyright */
g_print (" - %s %s\n", _("Copyright:"), gcm_profile_get_copyright (profile));
out:
if (profile != NULL)
g_object_unref (profile);
return ret;
} | false | false | false | false | false | 0 |
mlx4_ib_alloc_xrcd(struct ib_device *ibdev,
struct ib_ucontext *context,
struct ib_udata *udata)
{
struct mlx4_ib_xrcd *xrcd;
struct ib_cq_init_attr cq_attr = {};
int err;
if (!(to_mdev(ibdev)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC))
return ERR_PTR(-ENOSYS);
xrcd = kmalloc(sizeof *xrcd, GFP_KERNEL);
if (!xrcd)
return ERR_PTR(-ENOMEM);
err = mlx4_xrcd_alloc(to_mdev(ibdev)->dev, &xrcd->xrcdn);
if (err)
goto err1;
xrcd->pd = ib_alloc_pd(ibdev);
if (IS_ERR(xrcd->pd)) {
err = PTR_ERR(xrcd->pd);
goto err2;
}
cq_attr.cqe = 1;
xrcd->cq = ib_create_cq(ibdev, NULL, NULL, xrcd, &cq_attr);
if (IS_ERR(xrcd->cq)) {
err = PTR_ERR(xrcd->cq);
goto err3;
}
return &xrcd->ibxrcd;
err3:
ib_dealloc_pd(xrcd->pd);
err2:
mlx4_xrcd_free(to_mdev(ibdev)->dev, xrcd->xrcdn);
err1:
kfree(xrcd);
return ERR_PTR(err);
} | false | false | false | false | false | 0 |
sigsegvHandler(int sig, siginfo_t *info, void *secret) {
ucontext_t *uc = (ucontext_t*) secret;
sds infostring, clients;
struct sigaction act;
REDIS_NOTUSED(info);
bugReportStart();
redisLog(REDIS_WARNING,
" Redis %s crashed by signal: %d", REDIS_VERSION, sig);
if (sig == SIGSEGV) {
redisLog(REDIS_WARNING,
" SIGSEGV caused by address: %p", (void*)info->si_addr);
}
redisLog(REDIS_WARNING,
" Failed assertion: %s (%s:%d)", server.assert_failed,
server.assert_file, server.assert_line);
/* Log the stack trace */
redisLog(REDIS_WARNING, "--- STACK TRACE");
logStackTrace(uc);
/* Log INFO and CLIENT LIST */
redisLog(REDIS_WARNING, "--- INFO OUTPUT");
infostring = genRedisInfoString("all");
infostring = sdscatprintf(infostring, "hash_init_value: %u\n",
dictGetHashFunctionSeed());
redisLogRaw(REDIS_WARNING, infostring);
redisLog(REDIS_WARNING, "--- CLIENT LIST OUTPUT");
clients = getAllClientsInfoString();
redisLogRaw(REDIS_WARNING, clients);
sdsfree(infostring);
sdsfree(clients);
/* Log the current client */
logCurrentClient();
/* Log dump of processor registers */
logRegisters(uc);
#if defined(HAVE_PROC_MAPS)
/* Test memory */
redisLog(REDIS_WARNING, "--- FAST MEMORY TEST");
bioKillThreads();
if (memtest_test_linux_anonymous_maps()) {
redisLog(REDIS_WARNING,
"!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!");
} else {
redisLog(REDIS_WARNING,
"Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.");
}
#endif
redisLog(REDIS_WARNING,
"\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n"
" Please report the crash by opening an issue on github:\n\n"
" http://github.com/antirez/redis/issues\n\n"
" Suspect RAM error? Use redis-server --test-memory to verify it.\n\n"
);
/* free(messages); Don't call free() with possibly corrupted memory. */
if (server.daemonize) unlink(server.pidfile);
/* Make sure we exit with the right signal at the end. So for instance
* the core will be dumped if enabled. */
sigemptyset (&act.sa_mask);
act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND;
act.sa_handler = SIG_DFL;
sigaction (sig, &act, NULL);
kill(getpid(),sig);
} | false | false | false | false | false | 0 |
htc_config_pipe_credits(struct htc_target *target)
{
struct sk_buff *skb;
struct htc_config_pipe_msg *cp_msg;
int ret;
unsigned long time_left;
skb = alloc_skb(50 + sizeof(struct htc_frame_hdr), GFP_ATOMIC);
if (!skb) {
dev_err(target->dev, "failed to allocate send buffer\n");
return -ENOMEM;
}
skb_reserve(skb, sizeof(struct htc_frame_hdr));
cp_msg = (struct htc_config_pipe_msg *)
skb_put(skb, sizeof(struct htc_config_pipe_msg));
cp_msg->message_id = cpu_to_be16(HTC_MSG_CONFIG_PIPE_ID);
cp_msg->pipe_id = USB_WLAN_TX_PIPE;
cp_msg->credits = target->credits;
target->htc_flags |= HTC_OP_CONFIG_PIPE_CREDITS;
ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0);
if (ret)
goto err;
time_left = wait_for_completion_timeout(&target->cmd_wait, HZ);
if (!time_left) {
dev_err(target->dev, "HTC credit config timeout\n");
return -ETIMEDOUT;
}
return 0;
err:
kfree_skb(skb);
return -EINVAL;
} | false | false | false | false | false | 0 |
hmap_getentry(knh_hmap_t* hmap, khashcode_t hcode)
{
knh_hentry_t **hlist = hmap->hentry;
size_t idx = hcode % hmap->hmax;
knh_hentry_t *e = hlist[idx];
while(e != NULL) {
if(e->hcode == hcode) return e;
e = e->next;
}
return NULL;
} | false | false | false | false | false | 0 |
xbotch (mem, e, s, file, line)
PTR_T mem;
int e;
const char *s;
const char *file;
int line;
{
fprintf (stderr, _("\r\nmalloc: %s:%d: assertion botched\r\n"),
file ? file : _("unknown"), line);
#ifdef MALLOC_REGISTER
if (mem != NULL && malloc_register)
mregister_describe_mem (mem, stderr);
#endif
(void)fflush (stderr);
botch(s, file, line);
} | false | false | false | false | false | 0 |
cmd_objects_delete_undo (GnmCommand *cmd,
G_GNUC_UNUSED WorkbookControl *wbc)
{
CmdObjectsDelete *me = CMD_OBJECTS_DELETE (cmd);
GSList *l;
gint i;
g_slist_foreach (me->objects,
(GFunc) sheet_object_set_sheet, me->cmd.sheet);
for (l = me->objects, i = 0; l; l = l->next, i++)
cmd_objects_restore_location (SHEET_OBJECT (l->data),
g_array_index(me->location,
gint, i));
return FALSE;
} | false | false | false | false | false | 0 |
eval_string_expr_noquote(HSCPRC * hp, HSCATTR * dest) {
INFILE *inpf = hp->inpf;
STRPTR eval_result = NULL;
EXPSTR *tmpstr = init_estr(TMP_STEPSIZE);
BOOL end = FALSE;
/*
* read next char from input file until a
* closing quote if found.
* if the arg had no quote, a white space
* or a '>' is used to detect end of arg.
* if a LF is found, view error message
*/
while (!end) {
int ch = infgetc(inpf);
if (ch == EOF) {
hsc_msg_eof(hp, "reading attribute");
end = TRUE;
} else if ((ch == '\n') || (inf_isws((char)ch, inpf) || (ch == '>'))) {
/* end of arg reached */
inungetc(ch, inpf);
eval_result = estr2str(tmpstr);
end = TRUE;
} else {
/* append next char to tmpstr */
app_estrch(tmpstr, ch);
}
}
/* set new attribute value */
if (eval_result) {
set_vartext(dest, eval_result);
eval_result = get_vartext(dest);
}
/* remove temp. string */
del_estr(tmpstr);
return (eval_result);
} | false | false | false | false | false | 0 |
G3d__removeTile(G3D_Map * map, int tileIndex)
{
if (!map->useCache)
return 1;
if (!G3d_cache_remove_elt(map->cache, tileIndex)) {
G3d_error("G3d_removeTile: error in G3d_cache_remove_elt");
return 0;
}
return 1;
} | false | false | false | false | false | 0 |
orte_util_convert_string_to_jobid(orte_jobid_t *jobid, const char* jobidstring)
{
if (NULL == jobidstring) { /* got an error */
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
*jobid = ORTE_JOBID_INVALID;
return ORTE_ERR_BAD_PARAM;
}
/** check for wildcard character - handle appropriately */
if (0 == strcmp(ORTE_SCHEMA_WILDCARD_STRING, jobidstring)) {
*jobid = ORTE_JOBID_WILDCARD;
return ORTE_SUCCESS;
}
/* check for invalid value */
if (0 == strcmp(ORTE_SCHEMA_INVALID_STRING, jobidstring)) {
*jobid = ORTE_JOBID_INVALID;
return ORTE_SUCCESS;
}
*jobid = strtoul(jobidstring, NULL, 10);
return ORTE_SUCCESS;
} | false | false | false | false | false | 0 |
mic_free_interrupts(struct mic_device *mdev, struct pci_dev *pdev)
{
int i;
mdev->intr_ops->disable_interrupts(mdev);
if (mdev->irq_info.num_vectors > 1) {
for (i = 0; i < mdev->irq_info.num_vectors; i++) {
if (mdev->irq_info.mic_msi_map[i])
dev_warn(&pdev->dev, "irq %d may still be in use.\n",
mdev->irq_info.msix_entries[i].vector);
}
kfree(mdev->irq_info.mic_msi_map);
kfree(mdev->irq_info.msix_entries);
pci_disable_msix(pdev);
} else {
if (pci_dev_msi_enabled(pdev)) {
free_irq(pdev->irq, mdev);
kfree(mdev->irq_info.mic_msi_map);
pci_disable_msi(pdev);
} else {
free_irq(pdev->irq, mdev);
}
mic_release_callbacks(mdev);
}
} | false | false | false | false | false | 0 |
x264_hrd_fullness( x264_t *h )
{
x264_ratecontrol_t *rct = h->thread[0]->rc;
uint64_t denom = (uint64_t)h->sps->vui.hrd.i_bit_rate_unscaled * h->sps->vui.i_time_scale / rct->hrd_multiply_denom;
uint64_t cpb_state = rct->buffer_fill_final;
uint64_t cpb_size = (uint64_t)h->sps->vui.hrd.i_cpb_size_unscaled * h->sps->vui.i_time_scale;
uint64_t multiply_factor = 180000 / rct->hrd_multiply_denom;
if( rct->buffer_fill_final < 0 || rct->buffer_fill_final > cpb_size )
{
x264_log( h, X264_LOG_WARNING, "CPB %s: %.0lf bits in a %.0lf-bit buffer\n",
rct->buffer_fill_final < 0 ? "underflow" : "overflow", (float)rct->buffer_fill_final/denom, (float)cpb_size/denom );
}
h->initial_cpb_removal_delay = (multiply_factor * cpb_state + denom) / (2*denom);
h->initial_cpb_removal_delay_offset = (multiply_factor * cpb_size + denom) / (2*denom) - h->initial_cpb_removal_delay;
} | false | false | false | false | false | 0 |
mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig)
{
MonoReflectionModuleBuilder *module = sig->module;
MonoDynamicImage *assembly = module != NULL ? module->dynamic_image : NULL;
guint32 na = sig->arguments ? mono_array_length (sig->arguments) : 0;
guint32 buflen, i;
MonoArray *result;
SigBuffer buf;
check_array_for_usertypes (sig->arguments);
sigbuffer_init (&buf, 32);
sigbuffer_add_value (&buf, 0x07);
sigbuffer_add_value (&buf, na);
if (assembly != NULL){
for (i = 0; i < na; ++i) {
MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType*, i);
encode_reflection_type (assembly, type, &buf);
}
}
buflen = buf.p - buf.buf;
result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, buflen);
memcpy (mono_array_addr (result, char, 0), buf.buf, buflen);
sigbuffer_free (&buf);
return result;
} | false | false | false | false | false | 0 |
retrieveModelPart(const QString & moduleID) {
ModelPart * modelPart = m_partHash.value(moduleID, NULL);
if (modelPart != NULL) return modelPart;
if (m_referenceModel != NULL) {
return m_referenceModel->retrieveModelPart(moduleID);
}
return NULL;
} | false | false | false | false | false | 0 |
gw_file_to_str ( gchar *desc)
{
gchar **buf = NULL;
gchar *txt = NULL;
#ifdef GW_DEBUG_TOOLS_COMPONENT
g_print ( "*** GW - %s (%d) :: %s() : decode string=%s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, desc);
#endif
if ( desc != NULL )
{
txt = g_strdup ( desc);
buf = g_strsplit ( txt, "\\n", 0);
if ( buf != NULL )
{
g_free ( txt);
txt = g_strjoinv ( "\n", buf);
g_strfreev ( buf);
buf = NULL;
buf = g_strsplit ( txt, "\\#", 0);
if ( buf != NULL )
{
g_free ( txt);
txt = g_strjoinv ( ":", buf);
g_strfreev ( buf);
buf = NULL;
}
}
}
#ifdef GW_DEBUG_TOOLS_COMPONENT
g_print ( "*** GW - %s (%d) :: %s() : decoded string=%s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, txt);
#endif
return txt;
} | false | false | false | false | false | 0 |
HashExpression(
EXPRESSION *theExp)
{
unsigned long tally = PRIME_THREE;
if (theExp->argList != NULL)
tally += HashExpression(theExp->argList) * PRIME_ONE;
while (theExp != NULL)
{
tally += (unsigned long) (theExp->type * PRIME_TWO);
tally += (unsigned long) theExp->value;
theExp = theExp->nextArg;
}
return((unsigned) (tally % EXPRESSION_HASH_SIZE));
} | false | false | false | false | false | 0 |
panel_addto_populate_application_model (GtkTreeStore *store,
GtkTreeIter *parent,
GSList *app_list)
{
PanelAddtoAppList *data;
GtkTreeIter iter;
char *text;
GSList *app;
for (app = app_list; app != NULL; app = app->next) {
data = app->data;
gtk_tree_store_append (store, &iter, parent);
text = panel_addto_make_text (data->item_info.name,
data->item_info.description);
gtk_tree_store_set (store, &iter,
COLUMN_ICON, data->item_info.icon,
COLUMN_TEXT, text,
COLUMN_DATA, &(data->item_info),
COLUMN_SEARCH, data->item_info.name,
-1);
g_free (text);
if (data->children != NULL)
panel_addto_populate_application_model (store,
&iter,
data->children);
}
} | false | false | false | false | false | 0 |
hdp_establish_mcl(struct hdp_device *device,
hdp_continue_proc_f func,
gpointer data,
GDestroyNotify destroy,
GError **err)
{
struct conn_mcl_data *conn_data;
bdaddr_t dst, src;
uuid_t uuid;
device_get_address(device->dev, &dst, NULL);
adapter_get_address(device_get_adapter(device->dev), &src);
conn_data = g_new0(struct conn_mcl_data, 1);
conn_data->refs = 1;
conn_data->func = func;
conn_data->data = data;
conn_data->destroy = destroy;
conn_data->dev = health_device_ref(device);
bt_string2uuid(&uuid, HDP_UUID);
if (bt_search_service(&src, &dst, &uuid, search_cb, conn_data,
destroy_con_mcl_data) < 0) {
g_set_error(err, HDP_ERROR, HDP_CONNECTION_ERROR,
"Can't get remote SDP record");
g_free(conn_data);
return FALSE;
}
return TRUE;
} | false | false | false | false | false | 0 |
page_width()
const
{
struct stat st;
if (fstat(fileno(stdout), &st) == 0 && S_ISREG(st.st_mode))
return page_width_get(DEFAULT_PRINTER_WIDTH);
return page_width_get(-1) - 1;
} | false | false | false | false | false | 0 |
message_deserialize (Message *message, AnjutaSerializer *serializer)
{
gint type;
if (!anjuta_serializer_read_int (serializer, "type",
&type))
return FALSE;
message->type = type;
if (!anjuta_serializer_read_string (serializer, "summary",
&message->summary, TRUE))
return FALSE;
if (!anjuta_serializer_read_string (serializer, "details",
&message->details, TRUE))
return FALSE;
return TRUE;
} | false | false | false | false | false | 0 |
HENQueueScanner(Display *dpy, XEvent *ev, char *args)
{
if (ev->type == LeaveNotify) {
if (ev->xcrossing.window == ((HENScanArgs *) args)->w &&
ev->xcrossing.mode == NotifyNormal) {
((HENScanArgs *) args)->leaves = True;
/*
* Only the last event found matters for the Inferior field.
*/
((HENScanArgs *) args)->inferior =
(ev->xcrossing.detail == NotifyInferior);
}
} else if (ev->type == EnterNotify) {
if (ev->xcrossing.mode == NotifyUngrab)
((HENScanArgs *) args)->enters = True;
}
return (False);
} | false | false | false | false | false | 0 |
gigaset_freecs(struct cardstate *cs)
{
int i;
unsigned long flags;
if (!cs)
return;
mutex_lock(&cs->mutex);
spin_lock_irqsave(&cs->lock, flags);
cs->running = 0;
spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are
not rescheduled below */
tasklet_kill(&cs->event_tasklet);
del_timer_sync(&cs->timer);
switch (cs->cs_init) {
default:
/* clear B channel structures */
for (i = 0; i < cs->channels; ++i) {
gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
gigaset_freebcs(cs->bcs + i);
}
/* clear device sysfs */
gigaset_free_dev_sysfs(cs);
gigaset_if_free(cs);
gig_dbg(DEBUG_INIT, "clearing hw");
cs->ops->freecshw(cs);
/* fall through */
case 2: /* error in initcshw */
/* Deregister from LL */
make_invalid(cs, VALID_ID);
gigaset_isdn_unregdev(cs);
/* fall through */
case 1: /* error when registering to LL */
gig_dbg(DEBUG_INIT, "clearing at_state");
clear_at_state(&cs->at_state);
dealloc_temp_at_states(cs);
clear_events(cs);
tty_port_destroy(&cs->port);
/* fall through */
case 0: /* error in basic setup */
gig_dbg(DEBUG_INIT, "freeing inbuf");
kfree(cs->inbuf);
kfree(cs->bcs);
}
mutex_unlock(&cs->mutex);
free_cs(cs);
} | false | false | false | false | false | 0 |
dump_type_suffix (tree t, int flags)
{
if (TYPE_PTRMEMFUNC_P (t))
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
switch (TREE_CODE (t))
{
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
pp_cxx_right_paren (cxx_pp);
dump_type_suffix (TREE_TYPE (t), flags);
break;
case FUNCTION_TYPE:
case METHOD_TYPE:
{
tree arg;
if (TREE_CODE (t) == METHOD_TYPE)
/* Can only be reached through a pointer. */
pp_cxx_right_paren (cxx_pp);
arg = TYPE_ARG_TYPES (t);
if (TREE_CODE (t) == METHOD_TYPE)
arg = TREE_CHAIN (arg);
/* Function pointers don't have default args. Not in standard C++,
anyway; they may in g++, but we'll just pretend otherwise. */
dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
if (TREE_CODE (t) == METHOD_TYPE)
pp_cxx_cv_qualifier_seq (cxx_pp, class_of_this_parm (t));
else
pp_cxx_cv_qualifier_seq (cxx_pp, t);
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
dump_type_suffix (TREE_TYPE (t), flags);
break;
}
case ARRAY_TYPE:
pp_maybe_space (cxx_pp);
pp_cxx_left_bracket (cxx_pp);
if (TYPE_DOMAIN (t))
{
tree dtype = TYPE_DOMAIN (t);
tree max = TYPE_MAX_VALUE (dtype);
if (host_integerp (max, 0))
pp_wide_integer (cxx_pp, tree_low_cst (max, 0) + 1);
else if (TREE_CODE (max) == MINUS_EXPR)
dump_expr (TREE_OPERAND (max, 0),
flags & ~TFF_EXPR_IN_PARENS);
else
dump_expr (fold_build2_loc (input_location,
PLUS_EXPR, dtype, max,
build_int_cst (dtype, 1)),
flags & ~TFF_EXPR_IN_PARENS);
}
pp_cxx_right_bracket (cxx_pp);
dump_type_suffix (TREE_TYPE (t), flags);
break;
case ENUMERAL_TYPE:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
case TREE_LIST:
case TYPE_DECL:
case TREE_VEC:
case UNION_TYPE:
case LANG_TYPE:
case VOID_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case TYPEOF_TYPE:
case UNDERLYING_TYPE:
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
case NULLPTR_TYPE:
break;
default:
pp_unsupported_tree (cxx_pp, t);
case ERROR_MARK:
/* Don't mark it here, we should have already done in
dump_type_prefix. */
break;
}
} | false | false | false | false | false | 0 |
ghw_read_lsleb128 (struct ghw_handler *h, int64_t *res)
{
static const int64_t r_mask = -1;
int64_t r = 0;
unsigned int off = 0;
while (1)
{
int v = fgetc (h->stream);
if (v == EOF)
return -1;
r |= ((int64_t)(v & 0x7f)) << off;
off += 7;
if ((v & 0x80) == 0)
{
if ((v & 0x40) && off < 64)
r |= r_mask << off;
break;
}
}
*res = r;
return 0;
} | false | true | false | false | true | 1 |
xfs_allocbt_init_ptr_from_cur(
struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr)
{
struct xfs_agf *agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp);
ASSERT(cur->bc_private.a.agno == be32_to_cpu(agf->agf_seqno));
ASSERT(agf->agf_roots[cur->bc_btnum] != 0);
ptr->s = agf->agf_roots[cur->bc_btnum];
} | false | false | false | false | false | 0 |
load_script(state_t *s, seg_id_t seg)
{
resource_t *script, *heap;
script_t *scr = &(s->seg_manager.heap[seg]->data.script);
scr->buf = (byte *) malloc(scr->buf_size);
script = scir_find_resource(s->resmgr, sci_script, scr->nr, 0);
if (s->version >= SCI_VERSION(1,001,000))
heap = scir_find_resource(s->resmgr, sci_heap, scr->nr, 0);
switch (s->seg_manager.sci1_1)
{
case 0 :
sm_mcpy_in_out( &s->seg_manager, 0, script->data, script->size, seg, SEG_ID);
break;
case 1 :
sm_mcpy_in_out( &s->seg_manager, 0, script->data, script->size, seg, SEG_ID);
sm_mcpy_in_out( &s->seg_manager, scr->script_size, heap->data, heap->size, seg, SEG_ID);
break;
}
} | false | false | false | false | false | 0 |
ssl_init_socket_with_method(int sock, const char *host, int port,
SSL_CTX *ssl_ctx, SSLMethod method, void *data)
{
X509 *server_cert;
SSL *ssl;
int res = 0;
ssl = SSL_new(ssl_ctx);
if (ssl == NULL) {
eb_debug(DBG_CORE, "Error creating ssl context\n");
return NULL;
}
switch (method) {
case SSL_METHOD_SSLv23:
eb_debug(DBG_CORE, "Setting SSLv23 client method\n");
SSL_set_ssl_method(ssl, SSLv23_client_method());
break;
case SSL_METHOD_TLSv1:
eb_debug(DBG_CORE, "Setting TLSv1 client method\n");
SSL_set_ssl_method(ssl, TLSv1_client_method());
break;
default:
break;
}
SSL_set_fd(ssl, sock);
if ((res = SSL_connect(ssl)) == -1) {
eb_debug(DBG_CORE, ("SSL connect failed (%s)\n"),
ERR_error_string(SSL_get_error(ssl, res), NULL));
res = SSL_get_error(ssl, res);
switch (res) {
case SSL_ERROR_NONE:
printf("SSL_ERROR_NONE\n");
break;
case SSL_ERROR_WANT_READ:
printf("SSL_ERROR_WANT_READ\n");
break;
case SSL_ERROR_WANT_WRITE:
printf("SSL_ERROR_WANT_WRITE\n");
break;
case SSL_ERROR_ZERO_RETURN:
printf("SSL_ERROR_ZERO_RETURN\n");
break;
default:
printf("DEFAULT\n");
break;
}
SSL_free(ssl);
return NULL;
}
/* Get the cipher */
eb_debug(DBG_CORE, "SSL connection using %s\n", SSL_get_cipher(ssl));
/* Get server's certificate (note: beware of dynamic allocation) */
if ((server_cert = SSL_get_peer_certificate(ssl)) == NULL) {
eb_debug(DBG_CORE,
"server_cert is NULL ! this _should_not_ happen !\n");
SSL_free(ssl);
return NULL;
}
if (!ssl_certificate_check(server_cert, host, port, data)) {
X509_free(server_cert);
SSL_free(ssl);
return NULL;
}
X509_free(server_cert);
return ssl;
} | false | false | false | false | false | 0 |
sha256d(unsigned char *hash, const unsigned char *data, int len)
{
uint32_t S[16], T[16];
int i, r;
sha256_init(S);
for (r = len; r > -9; r -= 64) {
if (r < 64)
memset(T, 0, 64);
memcpy(T, data + len - r, r > 64 ? 64 : (r < 0 ? 0 : r));
if (r >= 0 && r < 64)
((unsigned char *)T)[r] = 0x80;
for (i = 0; i < 16; i++)
T[i] = be32dec(T + i);
if (r < 56)
T[15] = 8 * len;
sha256_transform(S, T, 0);
}
memcpy(S + 8, sha256d_hash1 + 8, 32);
sha256_init(T);
sha256_transform(T, S, 0);
for (i = 0; i < 8; i++)
be32enc((uint32_t *)hash + i, T[i]);
} | true | true | false | false | false | 1 |
_wrap_GooCanvasItem__do_button_release_event(PyObject *cls, PyObject *args, PyObject *kwargs)
{
GooCanvasItemIface *iface;
static char *kwlist[] = { "self", "target", "event", NULL };
PyGObject *self, *target;
GdkEvent *event = NULL;
int ret;
PyObject *py_event;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!O:GooCanvasItem.button_release_event", kwlist, &PyGooCanvasItem_Type, &self, &PyGooCanvasItem_Type, &target, &py_event))
return NULL;
if (pyg_boxed_check(py_event, GDK_TYPE_EVENT))
event = pyg_boxed_get(py_event, GdkEvent);
else {
PyErr_SetString(PyExc_TypeError, "event should be a GdkEvent");
return NULL;
}
iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object(cls)), GOO_TYPE_CANVAS_ITEM);
if (iface->button_release_event)
ret = iface->button_release_event(GOO_CANVAS_ITEM(self->obj), GOO_CANVAS_ITEM(target->obj), (GdkEventButton *)event);
else {
PyErr_SetString(PyExc_NotImplementedError, "interface method GooCanvasItem.button_release_event not implemented");
return NULL;
}
return PyBool_FromLong(ret);
} | false | false | false | false | false | 0 |
serial_bm_open(struct ipmi_intf * intf)
{
struct termios ti;
unsigned int rate = 9600;
char *p;
int i;
if (!intf->devfile) {
lprintf(LOG_ERR, "Serial device is not specified");
return -1;
}
is_system = 0;
/* check if baud rate is specified */
if ((p = strchr(intf->devfile, ':'))) {
char * pp;
/* separate device name from baud rate */
*p++ = '\0';
/* check for second colon */
if ((pp = strchr(p, ':'))) {
/* this is needed to normally acquire baud rate */
*pp++ = '\0';
/* check if it is a system interface */
if (pp[0] == 'S' || pp[0] == 's') {
is_system = 1;
}
}
if (str2uint(p, &rate)) {
lprintf(LOG_ERR, "Invalid baud rate specified\n");
return -1;
}
}
intf->fd = open(intf->devfile, O_RDWR | O_NONBLOCK, 0);
if (intf->fd < 0) {
lperror(LOG_ERR, "Could not open device at %s", intf->devfile);
return -1;
}
for (i = 0; i < sizeof(rates) / sizeof(rates[0]); i++) {
if (rates[i].baudrate == rate) {
break;
}
}
if (i >= sizeof(rates) / sizeof(rates[0])) {
lprintf(LOG_ERR, "Unsupported baud rate %i specified", rate);
return -1;
}
tcgetattr(intf->fd, &ti);
cfsetispeed(&ti, rates[i].baudinit);
cfsetospeed(&ti, rates[i].baudinit);
/* 8N1 */
ti.c_cflag &= ~PARENB;
ti.c_cflag &= ~CSTOPB;
ti.c_cflag &= ~CSIZE;
ti.c_cflag |= CS8;
/* enable the receiver and set local mode */
ti.c_cflag |= (CLOCAL | CREAD);
/* no flow control */
ti.c_cflag &= ~CRTSCTS;
ti.c_iflag &= ~(IGNBRK | IGNCR | INLCR | ICRNL | IUCLC | INPCK | ISTRIP
| IXON | IXOFF | IXANY);
ti.c_oflag &= ~(OPOST);
ti.c_lflag &= ~(ICANON | ISIG | ECHO | ECHONL | NOFLSH);
/* set the new options for the port with flushing */
tcsetattr(intf->fd, TCSAFLUSH, &ti);
if (intf->session->timeout == 0)
intf->session->timeout = SERIAL_BM_TIMEOUT;
if (intf->session->retry == 0)
intf->session->retry = SERIAL_BM_RETRY_COUNT;
intf->opened = 1;
return 0;
} | false | false | false | false | true | 1 |
btc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist)
{
u8 wifi_rssi_state;
u32 wifi_bw;
wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist,
0, 2, 15, 0);
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, true);
else
btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
btc8723b_coex_tbl_type(btcoexist, NORMAL_EXEC, 7);
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
if (BTC_WIFI_BW_HT40 == wifi_bw) {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
false, false);
btc8723b2ant_sw_mechanism2(btcoexist, true, false,
false, 0x18);
} else {
btc8723b2ant_sw_mechanism1(btcoexist, true, false,
false, false);
btc8723b2ant_sw_mechanism2(btcoexist, false, false,
false, 0x18);
}
} else {
if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
(wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
false, false);
btc8723b2ant_sw_mechanism2(btcoexist, true, false,
false, 0x18);
} else {
btc8723b2ant_sw_mechanism1(btcoexist, false, false,
false, false);
btc8723b2ant_sw_mechanism2(btcoexist, false, false,
false, 0x18);
}
}
} | false | false | false | false | false | 0 |
ComputeRowAMaxImpl(Vector& rows_norms, bool init) const
{
if (!matrices_valid_) {
matrices_valid_ = MatricesValid();
}
DBG_ASSERT(matrices_valid_);
// The vector is assumed to be compound Vectors as well except if
// there is only one component
CompoundVector* comp_vec = dynamic_cast<CompoundVector*>(&rows_norms);
// A few sanity checks
if (comp_vec) {
DBG_ASSERT(NComps_Dim()==comp_vec->NComps());
}
else {
DBG_ASSERT(NComps_Dim() == 1);
}
for (Index jcol = 0; jcol < NComps_Dim(); jcol++) {
for (Index irow = 0; irow < NComps_Dim(); irow++) {
SmartPtr<Vector> vec_i;
if (comp_vec) {
vec_i = comp_vec->GetCompNonConst(irow);
}
else {
vec_i = &rows_norms;
}
DBG_ASSERT(IsValid(vec_i));
if (jcol <= irow && ConstComp(irow,jcol)) {
ConstComp(irow, jcol)->ComputeRowAMax(*vec_i, false);
}
else if (jcol > irow && ConstComp(jcol, irow)) {
ConstComp(jcol, irow)->ComputeRowAMax(*vec_i, false);
}
}
}
} | false | false | false | false | false | 0 |
ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (MonoObject *this_obj, HANDLE process, gint32 ms)
{
guint32 ret;
if(ms<0) {
/* Wait forever */
ret=WaitForInputIdle (process, INFINITE);
} else {
ret=WaitForInputIdle (process, ms);
}
return (ret) ? FALSE : TRUE;
} | false | false | false | false | false | 0 |
scsi_read_capacity_10 ( struct block_device *blockdev ) {
struct scsi_device *scsi = block_to_scsi ( blockdev );
struct scsi_command command;
struct scsi_cdb_read_capacity_10 *cdb = &command.cdb.readcap10;
struct scsi_capacity_10 capacity;
int rc;
/* Issue READ CAPACITY (10) */
memset ( &command, 0, sizeof ( command ) );
cdb->opcode = SCSI_OPCODE_READ_CAPACITY_10;
command.data_in = virt_to_user ( &capacity );
command.data_in_len = sizeof ( capacity );
if ( ( rc = scsi_command ( scsi, &command ) ) != 0 )
return rc;
/* Fill in block device fields */
blockdev->blksize = be32_to_cpu ( capacity.blksize );
blockdev->blocks = ( be32_to_cpu ( capacity.lba ) + 1 );
return 0;
} | false | false | false | false | false | 0 |
jd_s_channel_read(mud_channel *pc, void *buf, int length, int sec_timeout, int *bytes_read)
{
mud_device *pd = &msp->device[pc->dindex];
int len=0;
struct timeval tmo;
fd_set master;
fd_set readfd;
int maxfd, ret;
enum HPMUD_RESULT stat = HPMUD_R_IO_ERROR;
*bytes_read = 0;
if (pc->socket<0)
{
stat = HPMUD_R_INVALID_STATE;
BUG("invalid data link socket=%d %s\n", pc->socket, pd->uri);
goto bugout;
}
FD_ZERO(&master);
FD_SET(pc->socket, &master);
maxfd = pc->socket;
tmo.tv_sec = sec_timeout;
tmo.tv_usec = 0;
readfd = master;
ret = select(maxfd+1, &readfd, NULL, NULL, &tmo);
if (ret < 0)
{
BUG("unable to read_channel: %m %s\n", pd->uri);
goto bugout;
}
if (ret == 0)
{
stat = HPMUD_R_IO_TIMEOUT;
// if (sec_timeout >= HPMUD_EXCEPTION_SEC_TIMEOUT)
BUG("timeout read_channel sec=%d %s\n", sec_timeout, pd->uri);
goto bugout;
}
else
{
if ((len = recv(pc->socket, buf, length, 0)) < 0)
{
BUG("unable to read_channel: %m %s\n", pd->uri);
goto bugout;
}
}
DBG("read socket=%d len=%d size=%d\n", pc->socket, len, length);
DBG_DUMP(buf, len < 32 ? len : 32);
*bytes_read = len;
stat = HPMUD_R_OK;
bugout:
return stat;
} | false | false | false | false | false | 0 |
gtk_main_flush(void)
{
gint val = FALSE;
gint i = 0;
while (gtk_events_pending() && i++ < GTK_ITERATION_MAX) {
val = gtk_main_iteration_do(FALSE);
if (val)
break;
}
if (i > GTK_ITERATION_MAX && !val) {
if (GUI_PROPERTY(gui_debug)) {
g_warning("gtk_main_flush: too much work");
}
}
return val;
} | false | false | false | false | false | 0 |
stp_get_parameter_active(const stp_vars_t *v, const char *parameter,
stp_parameter_type_t p_type)
{
if (p_type >= STP_PARAMETER_TYPE_STRING_LIST &&
p_type < STP_PARAMETER_TYPE_INVALID)
{
const stp_list_t *list = v->params[p_type];
const stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
if (item)
return ((const value_t *) stp_list_item_get_data(item))->active;
else
return 0;
}
return 0;
} | false | false | false | false | false | 0 |
truncate_inode_page(struct address_space *mapping, struct page *page)
{
if (page_mapped(page)) {
unmap_mapping_range(mapping,
(loff_t)page->index << PAGE_CACHE_SHIFT,
PAGE_CACHE_SIZE, 0);
}
return truncate_complete_page(mapping, page);
} | false | false | false | false | false | 0 |
tftp_error(struct inode *inode, uint16_t errnum,
const char *errstr)
{
static __lowmem struct {
uint16_t err_op;
uint16_t err_num;
char err_msg[64];
} __packed err_buf;
static __lowmem struct s_PXENV_UDP_WRITE udp_write;
int len = min(strlen(errstr), sizeof(err_buf.err_msg)-1);
struct pxe_pvt_inode *socket = PVT(inode);
err_buf.err_op = TFTP_ERROR;
err_buf.err_num = errnum;
memcpy(err_buf.err_msg, errstr, len);
err_buf.err_msg[len] = '\0';
udp_write.src_port = socket->tftp_localport;
udp_write.dst_port = socket->tftp_remoteport;
udp_write.ip = socket->tftp_remoteip;
udp_write.gw = gateway(udp_write.ip);
udp_write.buffer = FAR_PTR(&err_buf);
udp_write.buffer_size = 4 + len + 1;
/* If something goes wrong, there is nothing we can do, anyway... */
pxe_call(PXENV_UDP_WRITE, &udp_write);
} | false | false | false | false | false | 0 |
put_lut(Display *disp,Colormap cmap,
int ncolors,int lut_start,char overlay,
int *red,int *green,int *blue,
int *intensity_lut,int *red_lut,int *green_lut,int *blue_lut)
{
int i,j;
int index;
int background_index;
int mod_lstart;
#if !(defined(__WIN32__) || defined(macintosh))
int pseudoImages;
#endif
#ifdef DEBUG
printf("put_lut\n");
#endif
if(overlay == False) {
for (i=lut_start,j=0; j<ncolors; i++,j++) {
index = intensity_lut[j];
lut_colorcell_defs[i].pixel = i;
lut_colorcell_defs[i].red = (unsigned short) (red_lut[red[index]]<<8) ;
lut_colorcell_defs[i].green = (unsigned short) (green_lut[green[index]]<<8) ;
lut_colorcell_defs[i].blue = (unsigned short) (blue_lut[blue[index]]<<8) ;
lut_colorcell_defs[i].flags = DoRed | DoBlue | DoGreen;
}
} else {
mod_lstart = lut_start%2; /* helpful if we decide one day that lut_start should
be odd and not even as it is hard-coded now */
for (i=lut_start,j=0; j<ncolors; i++,j++) {
index = intensity_lut[j];
if( i%2==mod_lstart) {
lut_colorcell_defs[i].red = (unsigned short) (red_lut[red[index]]<<8) ;
lut_colorcell_defs[i].green = (unsigned short) (green_lut[green[index]]<<8) ;
lut_colorcell_defs[i].blue = (unsigned short) (blue_lut[blue[index]]<<8) ;
} else {
lut_colorcell_defs[i].red = (unsigned short) 0xfffffff;
if( index < 50 )
background_index = ncolors-1-50;
else background_index = ncolors-1-index;
lut_colorcell_defs[i].green = (unsigned short) (green_lut[green[background_index]]<<8) ;
lut_colorcell_defs[i].blue = (unsigned short) (blue_lut[blue[background_index]]<<8) ;
}
lut_colorcell_defs[i].flags = DoRed | DoBlue | DoGreen;
}
}
#if !(defined(__WIN32__) || defined(macintosh))
Tcl_GetInt(interp,Tcl_GetVar(interp,"powPseudoImages",TCL_GLOBAL_ONLY),
&pseudoImages);
if(pseudoImages) {
XStoreColors(disp,cmap,&lut_colorcell_defs[lut_start],ncolors) ;
XFlush(disp) ;
}
#endif
} | false | false | false | false | false | 0 |
invoke(void)
{
myDataMutex.lock();
std::map<int, ArFunctor *>::iterator it;
ArFunctor *functor;
ArLog::log(myLogLevel, "%s: Starting calls", myName.c_str());
for (it = myList.begin();
it != myList.end();
it++)
{
functor = (*it).second;
if (functor == NULL)
continue;
if (functor->getName() != NULL && functor->getName()[0] != '\0')
ArLog::log(myLogLevel, "%s: Calling functor '%s' at %d",
myName.c_str(), functor->getName(), -(*it).first);
else
ArLog::log(myLogLevel, "%s: Calling unnamed functor at %d",
myName.c_str(), -(*it).first);
functor->invoke();
}
ArLog::log(myLogLevel, "%s: Ended calls", myName.c_str());
myDataMutex.unlock();
} | false | false | false | false | false | 0 |
escp2_set_printhead_speed(stp_vars_t *v)
{
escp2_privdata_t *pd = get_privdata(v);
const char *direction = stp_get_string_parameter(v, "PrintingDirection");
int unidirectional = -1;
if (direction && strcmp(direction, "Unidirectional") == 0)
unidirectional = 1;
else if (direction && strcmp(direction, "Bidirectional") == 0)
unidirectional = 0;
else if (pd->bidirectional_upper_limit >= 0 &&
pd->res->printed_hres * pd->res->printed_vres *
pd->res->vertical_passes >= pd->bidirectional_upper_limit)
{
stp_dprintf(STP_DBG_ESCP2, v,
"Setting unidirectional: hres %d vres %d passes %d total %d limit %d\n",
pd->res->printed_hres, pd->res->printed_vres,
pd->res->vertical_passes,
(pd->res->printed_hres * pd->res->printed_vres *
pd->res->vertical_passes),
pd->bidirectional_upper_limit);
unidirectional = 1;
}
else if (pd->bidirectional_upper_limit >= 0)
{
stp_dprintf(STP_DBG_ESCP2, v,
"Setting bidirectional: hres %d vres %d passes %d total %d limit %d\n",
pd->res->printed_hres, pd->res->printed_vres,
pd->res->vertical_passes,
(pd->res->printed_hres * pd->res->printed_vres *
pd->res->vertical_passes),
pd->bidirectional_upper_limit);
unidirectional = 0;
}
if (unidirectional == 1)
{
stp_send_command(v, "\033U", "c", 1);
if (pd->res->hres > pd->physical_xdpi)
stp_send_command(v, "\033(s", "bc", 2);
}
else if (unidirectional == 0)
stp_send_command(v, "\033U", "c", 0);
} | false | false | false | false | false | 0 |
FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors)
{
FLAC__Metadata_SimpleIterator *it;
FLAC__uint64 max_area_seen = 0;
FLAC__uint64 max_depth_seen = 0;
FLAC__ASSERT(0 != filename);
FLAC__ASSERT(0 != picture);
*picture = 0;
it = FLAC__metadata_simple_iterator_new();
if(0 == it)
return false;
if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/true)) {
FLAC__metadata_simple_iterator_delete(it);
return false;
}
do {
if(FLAC__metadata_simple_iterator_get_block_type(it) == FLAC__METADATA_TYPE_PICTURE) {
FLAC__StreamMetadata *obj = FLAC__metadata_simple_iterator_get_block(it);
FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height;
/* check constraints */
if(
(type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) &&
(mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) &&
(description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) &&
obj->data.picture.width <= max_width &&
obj->data.picture.height <= max_height &&
obj->data.picture.depth <= max_depth &&
obj->data.picture.colors <= max_colors &&
(area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen))
) {
if(*picture)
FLAC__metadata_object_delete(*picture);
*picture = obj;
max_area_seen = area;
max_depth_seen = obj->data.picture.depth;
}
else {
FLAC__metadata_object_delete(obj);
}
}
} while(FLAC__metadata_simple_iterator_next(it));
FLAC__metadata_simple_iterator_delete(it);
return (0 != *picture);
} | false | false | false | false | false | 0 |
gwy_app_run_process_func(const gchar *name)
{
GwyRunType run_types[] = { GWY_RUN_INTERACTIVE, GWY_RUN_IMMEDIATE, };
GwyRunType available_run_modes;
gsize i;
gwy_debug("`%s'", name);
available_run_modes = gwy_process_func_get_run_types(name);
g_return_val_if_fail(available_run_modes, 0);
for (i = 0; i < G_N_ELEMENTS(run_types); i++) {
if (run_types[i] & available_run_modes) {
gwy_app_run_process_func_in_mode(name, run_types[i]);
return run_types[i];
}
}
return 0;
} | false | false | false | false | false | 0 |
_ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...)
{
int res;
va_list ap;
va_start(ap, fmt);
if ((res = vasprintf(ret, fmt, ap)) == -1) {
MALLOC_FAILURE_MSG;
}
va_end(ap);
return res;
} | false | false | false | false | false | 0 |
SilentChange(UFNumberArray *that, int index, double number) {
if (index < 0 || index >= Size)
that->Throw("index (%d) out of range 0..%d", index, Size - 1);
if (number > Maximum) {
that->Message(_("Value %.*f too large, truncated to %.*f."),
AccuracyDigits, number, AccuracyDigits, Maximum);
number = Maximum;
} else if (number < Minimum) {
that->Message(_("Value %.*f too small, truncated to %.*f."),
AccuracyDigits, number, AccuracyDigits, Minimum);
number = Minimum;
}
if (!that->IsEqual(index, number)) {
Array[index] = number;
return true;
}
// When numbers are equal up to Accuracy, we still want the new value
Array[index] = number;
return false;
} | false | false | false | false | false | 0 |
try_to_del_timer_sync(struct timer_list *timer)
{
struct tvec_base *base;
unsigned long flags;
int ret = -1;
debug_assert_init(timer);
base = lock_timer_base(timer, &flags);
if (base->running_timer != timer) {
timer_stats_timer_clear_start_info(timer);
ret = detach_if_pending(timer, base, true);
}
spin_unlock_irqrestore(&base->lock, flags);
return ret;
} | false | false | false | false | false | 0 |
diagrams(const DiagramVector & diags) const {
Selector<DiagramIndex> sel;
for ( DiagramIndex i = 0; i < diags.size(); ++i ) {
int id=abs(diags[i]->id());
if (id <= 2 ) sel.insert(meInfo()[id- 1],i);
else if(id <= 4 ) sel.insert(meInfo()[id- 3],i);
else if(id <= 6 ) sel.insert(meInfo()[id- 5],i);
else if(id <= 8 ) sel.insert(meInfo()[id- 7],i);
else if(id <= 10) sel.insert(meInfo()[id- 9],i);
else if(id <= 12) sel.insert(meInfo()[id-11],i);
}
return sel;
} | false | false | false | false | false | 0 |
Problem_11(const MATRIX &matrix){
unsigned matrixSize = matrix.size();
vector<vector<pair<int, int> > > matrixPreknowledge(matrixSize, vector<pair<int, int> >(matrixSize));
preprocessMatrix(matrix, matrixPreknowledge);
for(size_t i=matrixSize; i!=0; --i){
bool temp = findSubsquares(matrixPreknowledge, i);
if(temp)
return i;
}
return 0;
} | false | false | false | false | false | 0 |
open_logfiles(void)
{
int i;
close_logfiles();
log_main = fopen(logFileName, "a");
/* log_main is handled above, so just do the rest */
for(i = 1; i < LAST_LOGFILE; i++)
{
/* reopen those with paths */
if(!EmptyString(*log_table[i].name))
{
verify_logfile_access(*log_table[i].name);
*log_table[i].logfile = fopen(*log_table[i].name, "a");
}
}
} | false | false | false | false | true | 1 |
ssl2_GetPolicy(PRInt32 which, PRInt32 *oPolicy)
{
PRUint32 bitMask;
PRInt32 policy;
which &= 0x000f;
bitMask = 1 << which;
/* Caller assures oPolicy is not null. */
if (!(bitMask & SSL_CB_IMPLEMENTED)) {
PORT_SetError(SSL_ERROR_UNKNOWN_CIPHER_SUITE);
*oPolicy = SSL_NOT_ALLOWED;
return SECFailure;
}
if (maybeAllowedByPolicy & bitMask) {
policy = (allowedByPolicy & bitMask) ? SSL_ALLOWED : SSL_RESTRICTED;
} else {
policy = SSL_NOT_ALLOWED;
}
*oPolicy = policy;
return SECSuccess;
} | false | false | false | false | false | 0 |
nat_new_top_level_command() {
try { // for error handling
interface_label();
match(COMMA);
interface_label();
match(CLOSING_PAREN);
if ( inputState->guessing==0 ) {
#line 2064 "pix.g"
importer->addMessageToLog(
QString("Warning: Import of ASA 8.3 nat command "
"is not supported at this time"));
consumeUntil(NEWLINE);
#line 6763 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
if( inputState->guessing == 0 ) {
reportError(ex);
recover(ex,_tokenSet_5);
} else {
throw;
}
}
} | false | false | false | false | false | 0 |
markBadACELabel(UnicodeString &dest,
int32_t labelStart, int32_t labelLength,
UBool toASCII, IDNAInfo &info) const {
UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0;
UBool isASCII=TRUE;
UBool onlyLDH=TRUE;
const UChar *label=dest.getBuffer()+labelStart;
// Ok to cast away const because we own the UnicodeString.
UChar *s=(UChar *)label+4; // After the initial "xn--".
const UChar *limit=label+labelLength;
do {
UChar c=*s;
if(c<=0x7f) {
if(c==0x2e) {
info.labelErrors|=UIDNA_ERROR_LABEL_HAS_DOT;
*s=0xfffd;
isASCII=onlyLDH=FALSE;
} else if(asciiData[c]<0) {
onlyLDH=FALSE;
if(disallowNonLDHDot) {
*s=0xfffd;
isASCII=FALSE;
}
}
} else {
isASCII=onlyLDH=FALSE;
}
} while(++s<limit);
if(onlyLDH) {
dest.insert(labelStart+labelLength, (UChar)0xfffd);
++labelLength;
} else {
if(toASCII && isASCII && labelLength>63) {
info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG;
}
}
return labelLength;
} | false | false | false | false | false | 0 |
gwy_null_store_iter_children(GtkTreeModel *model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
GwyNullStore *store;
store = GWY_NULL_STORE(model);
if (parent || !store->n)
return FALSE;
iter->stamp = store->stamp;
iter->user_data = GUINT_TO_POINTER(0);
return TRUE;
} | false | false | false | false | false | 0 |
explain_buffer_sockopt_name(explain_string_buffer_t *sb, int level,
int name)
{
switch (level)
{
/* FIXME: add support for SOL_AAL */
/* FIXME: add support for SOL_ATALK */
/* FIXME: add support for SOL_ATM */
/* FIXME: add support for SOL_AX25 */
/* FIXME: add support for SOL_BLUETOOTH */
/* FIXME: add support for SOL_DCCP */
/* FIXME: add support for SOL_DECNET */
/* FIXME: add support for SOL_ICMP */
/* FIXME: add support for SOL_ICMPV6 */
#ifdef SOL_IP
case SOL_IP:
explain_parse_bits_print_single
(
sb,
name,
sol_ip_table,
SIZEOF(sol_ip_table)
);
break;
#endif
/* FIXME: add support for SOL_IPV6 */
/* FIXME: add support for SOL_IPX */
/* FIXME: add support for SOL_IRDA */
/* FIXME: add support for SOL_LLC */
/* FIXME: add support for SOL_NETBUEI */
/* FIXME: add support for SOL_NETLINK */
/* FIXME: add support for SOL_NETROM */
/* FIXME: add support for SOL_PACKET */
/* FIXME: add support for SOL_PPPOL2TP */
/* FIXME: add support for SOL_RAW */
/* FIXME: add support for SOL_ROSE */
/* FIXME: add support for SOL_RXRPC */
/* FIXME: add support for SOL_SCTP */
case SOL_SOCKET:
explain_parse_bits_print_single
(
sb,
name,
sol_socket_table,
SIZEOF(sol_socket_table)
);
break;
/* FIXME: add support for SOL_TCP */
/* FIXME: add support for SOL_TIPC */
/* FIXME: add support for SOL_UDP */
/* FIXME: add support for SOL_UDPLITE */
/* FIXME: add support for SOL_X25 */
default:
explain_string_buffer_printf(sb, "%d", name);
break;
}
} | false | false | false | false | false | 0 |
WalkLanguageTableElement(RefAST ast)
{
RefAST astLabel = ast->getFirstChild();
std::string staLabel(astLabel->getText().c_str());
RefAST astItem = astLabel->getNextSibling();
// Find or create the language class with that name:
GdlLangClass * plcls;
size_t ilcls;
for (ilcls = 0; ilcls < m_vplcls.size(); ilcls++)
{
if (strcmp(m_vplcls[ilcls]->m_staLabel.c_str(), staLabel.c_str()) == 0)
{
plcls = m_vplcls[ilcls];
break;
}
}
if (ilcls >= m_vplcls.size())
{
plcls = new GdlLangClass(staLabel);
m_vplcls.push_back(plcls);
}
WalkLanguageItem(astItem, plcls);
} | false | false | false | false | true | 1 |
CallbackAlert(const libcec_alert type, const libcec_parameter ¶m)
{
CLockObject lock(m_cbMutex);
if (m_configuration.callbacks &&
m_configuration.callbacks->CBCecAlert)
m_configuration.callbacks->CBCecAlert(m_configuration.callbackParam, type, param);
} | false | false | false | false | false | 0 |
config_layouts_list_remove_iter (GtkListStore *list,
GtkTreeIter *iter)
{
if (!gtk_list_store_remove (list, iter)) {
/* FIXME: Should set iter at the end again? */
return;
}
#if GTK_CHECK_VERSION (3, 0, 0)
if (!gtk_tree_model_iter_previous (GTK_TREE_MODEL (list), iter)) {
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list), iter);
}
#else
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list), iter);
#endif
} | false | false | false | false | false | 0 |
ld10k1_tram_alloc_for_patch(ld10k1_dsp_mgr_t *dsp_mgr, ld10k1_patch_t *patch, ld10k1_dsp_tram_resolve_t *res)
{
int i;
int grp;
int acc;
/* allocate tram grp and acc for patch */
for (i = 0; i < patch->tram_count; i++) {
grp = ld10k1_tram_grp_alloc(dsp_mgr);
patch->tram_grp[i].grp_idx = grp;
dsp_mgr->tram_grp[grp].type = patch->tram_grp[i].grp_type;
dsp_mgr->tram_grp[grp].size = patch->tram_grp[i].grp_size;
}
for (i = 0; i < res->item_count; i++) {
if (res->items[i].grp_idx < 0) {
res->items[i].grp_idx = patch->tram_grp[-(res->items[i].grp_idx + 1)].grp_idx;
dsp_mgr->tram_grp[res->items[i].grp_idx].pos = TRAM_POS_NONE;
dsp_mgr->tram_grp[res->items[i].grp_idx].acc_count = res->items[i].grp_acc_count;
}
}
for (i = 0; i < patch->tram_acc_count; i++) {
acc = ld10k1_tram_acc_alloc(dsp_mgr);
patch->tram_acc[i].acc_idx = acc;
dsp_mgr->tram_acc[acc].type = patch->tram_acc[i].acc_type;
dsp_mgr->tram_acc[acc].offset = patch->tram_acc[i].acc_offset;
dsp_mgr->tram_acc[acc].grp = patch->tram_grp[patch->tram_acc[i].grp].grp_idx;
}
ld10k1_tram_res_alloc_hwacc(dsp_mgr, res);
ld10k1_tram_realloc_space(dsp_mgr, res);
return 0;
} | false | false | false | false | false | 0 |
alloc_buffer(String *res,String *str,String *tmp_value,
ulong length)
{
if (res->alloced_length() < length)
{
if (str->alloced_length() >= length)
{
(void) str->copy(*res);
str->length(length);
return str;
}
if (tmp_value->alloc(length))
return 0;
(void) tmp_value->copy(*res);
tmp_value->length(length);
return tmp_value;
}
res->length(length);
return res;
} | false | false | false | false | false | 0 |
_self_heal_entry (xlator_t *this, afr_crawl_data_t *crawl_data, gf_dirent_t *entry,
loc_t *child, loc_t *parent, struct iatt *iattr)
{
struct iatt parentbuf = {0};
int ret = 0;
dict_t *xattr_rsp = NULL;
if (uuid_is_null (child->gfid))
gf_log (this->name, GF_LOG_DEBUG, "lookup %s", child->path);
else
gf_log (this->name, GF_LOG_DEBUG, "lookup %s",
uuid_utoa (child->gfid));
ret = syncop_lookup (this, child, NULL,
iattr, &xattr_rsp, &parentbuf);
_crawl_post_sh_action (this, parent, child, ret, errno, xattr_rsp,
crawl_data);
if (xattr_rsp)
dict_unref (xattr_rsp);
return ret;
} | false | false | false | false | false | 0 |
gimmix_window_visible_toggle (void)
{
static int x;
static int y;
if( !GTK_WIDGET_VISIBLE (main_window) )
{
gtk_window_move (GTK_WINDOW(main_window), x, y);
gtk_widget_show (GTK_WIDGET(main_window));
gtk_window_present (GTK_WINDOW(main_window));
}
else
{
gtk_window_get_position (GTK_WINDOW(main_window), &x, &y);
/* hide the volume window if not hidden */
gtk_widget_hide (GTK_WIDGET(volume_window));
gtk_widget_hide (GTK_WIDGET(main_window));
}
return;
} | false | false | false | false | false | 0 |
_callbacks_unregister(Evas_Object *obj)
{
ELM_GESTURE_LAYER_DATA_GET(obj, sd);
if (!sd->target) return;
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MULTI_DOWN, _multi_down_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MULTI_MOVE, _multi_move_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_MULTI_UP, _multi_up_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_KEY_DOWN, _key_down_cb);
evas_object_event_callback_del
(sd->target, EVAS_CALLBACK_KEY_UP, _key_up_cb);
} | false | false | false | false | false | 0 |
_ml_Sock_bind (ml_state_t *msp, ml_val_t arg)
{
int sock = REC_SELINT(arg, 0);
ml_val_t addr = REC_SEL(arg, 1);
int sts;
sts = bind (
sock,
GET_SEQ_DATAPTR(struct sockaddr, addr),
GET_SEQ_LEN(addr));
CHK_RETURN_UNIT(msp, sts);
} | false | false | false | false | false | 0 |
toCtype (void)
{
if (!ctype)
{
if (!isNaked())
{
ctype = castMod(0)->toCtype();
ctype = insert_type_modifiers (ctype, mod);
}
else
{
tree lentype = Type::tsize_t->toCtype();
tree ptrtype = next->toCtype();
ctype = build_two_field_type (lentype, build_pointer_type (ptrtype),
this, "length", "ptr");
TYPE_LANG_SPECIFIC (ctype) = build_d_type_lang_specific (this);
d_keep (ctype);
}
}
return ctype;
} | false | false | false | false | false | 0 |
ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
{
struct hardware_scb *hscb;
struct status_pkt *spkt;
uint32_t sgptr;
uint32_t resid_sgptr;
uint32_t resid;
/*
* 5 cases.
* 1) No residual.
* SG_RESID_VALID clear in sgptr.
* 2) Transferless command
* 3) Never performed any transfers.
* sgptr has SG_FULL_RESID set.
* 4) No residual but target did not
* save data pointers after the
* last transfer, so sgptr was
* never updated.
* 5) We have a partial residual.
* Use residual_sgptr to determine
* where we are.
*/
hscb = scb->hscb;
sgptr = ahc_le32toh(hscb->sgptr);
if ((sgptr & SG_RESID_VALID) == 0)
/* Case 1 */
return;
sgptr &= ~SG_RESID_VALID;
if ((sgptr & SG_LIST_NULL) != 0)
/* Case 2 */
return;
spkt = &hscb->shared_data.status;
resid_sgptr = ahc_le32toh(spkt->residual_sg_ptr);
if ((sgptr & SG_FULL_RESID) != 0) {
/* Case 3 */
resid = ahc_get_transfer_length(scb);
} else if ((resid_sgptr & SG_LIST_NULL) != 0) {
/* Case 4 */
return;
} else if ((resid_sgptr & ~SG_PTR_MASK) != 0) {
panic("Bogus resid sgptr value 0x%x\n", resid_sgptr);
} else {
struct ahc_dma_seg *sg;
/*
* Remainder of the SG where the transfer
* stopped.
*/
resid = ahc_le32toh(spkt->residual_datacnt) & AHC_SG_LEN_MASK;
sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK);
/* The residual sg_ptr always points to the next sg */
sg--;
/*
* Add up the contents of all residual
* SG segments that are after the SG where
* the transfer stopped.
*/
while ((ahc_le32toh(sg->len) & AHC_DMA_LAST_SEG) == 0) {
sg++;
resid += ahc_le32toh(sg->len) & AHC_SG_LEN_MASK;
}
}
if ((scb->flags & SCB_SENSE) == 0)
ahc_set_residual(scb, resid);
else
ahc_set_sense_residual(scb, resid);
#ifdef AHC_DEBUG
if ((ahc_debug & AHC_SHOW_MISC) != 0) {
ahc_print_path(ahc, scb);
printk("Handled %sResidual of %d bytes\n",
(scb->flags & SCB_SENSE) ? "Sense " : "", resid);
}
#endif
} | false | false | false | false | false | 0 |
gd_spf(DIRFILE* D, const char *field_code_in) gd_nothrow
{
gd_spf_t spf = 0;
gd_entry_t* entry;
char* field_code;
int repr;
dtrace("%p, \"%s\"", D, field_code_in);
if (D->flags & GD_INVALID) {/* don't crash */
_GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
dreturn("%u", 0);
return 0;
}
_GD_ClearError(D);
/* the representation is unimportant: it doesn't change the SPF of the field,
* yet we have to run the field code through here to potentially remove it
*/
entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
if (D->error) {
dreturn("%u", 0);
return 0;
}
if (entry->field_type & GD_SCALAR_ENTRY)
_GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
else
spf = _GD_GetSPF(D, entry);
if (field_code != field_code_in)
free(field_code);
dreturn("%u", spf);
return spf;
} | false | false | false | false | false | 0 |
choplast(mastr * m)
{
if (m && m->len) {
--m->len;
m->dat[m->len] = '\0';
}
} | false | false | false | false | false | 0 |
elf64_section_dump (ElfSection *sect)
{
Elf64_Shdr *secthdrs;
Elf64_Sym *syms;
Elf64_Dyn *dyn;
char *strtab;
size_t i, n;
secthdrs = (Elf64_Shdr *) sect->elfd->secthdrs;
i = sect->index;
printf ("Section name index: %u\n", secthdrs[i].sh_name);
if (sect->name != NULL)
printf ("Section name: %s\n", sect->name);
printf ("Section type: %u\n", secthdrs[i].sh_type);
printf ("Section flags: %u\n", secthdrs[i].sh_flags);
printf ("Section virtual addr at execution: 0x%x\n", secthdrs[i].sh_addr);
printf ("Section file offset: %u\n", secthdrs[i].sh_offset);
printf ("Section size in bytes: %u\n", secthdrs[i].sh_size);
printf ("Link to another section: %u\n", secthdrs[i].sh_link);
printf ("Additional section information: %u\n", secthdrs[i].sh_info);
printf ("Section alignment: %u\n", secthdrs[i].sh_addralign);
printf ("Entry size if section holds table: %u\n", secthdrs[i].sh_entsize);
if (sect->data != NULL) {
switch (secthdrs[i].sh_type) {
case SHT_SYMTAB:
case SHT_DYNSYM:
printf ("\nSymbol Table contains:\n");
syms = sect->data;
strtab = sect->link && sect->link->data ? sect->link->data : NULL;
n = secthdrs[i].sh_entsize;
for (i = 0; i < n; i++)
elf64_sym_dump (&syms[i], strtab);
break;
case SHT_DYNAMIC:
printf ("\nDynamic Linking Information:\n");
dyn = sect->data;
strtab = sect->link && sect->link->data ? sect->link->data : NULL;
n = secthdrs[i].sh_entsize;
for (i = 0; i < n; i++)
elf64_dyn_dump (&dyn[i], strtab);
break;
default:
printf ("\n");
break;
}
} else {
printf ("\n");
}
} | false | false | false | false | false | 0 |
git_remote_is_valid_name(
const char *remote_name)
{
git_buf buf = GIT_BUF_INIT;
git_refspec refspec;
int error = -1;
if (!remote_name || *remote_name == '\0')
return 0;
git_buf_printf(&buf, "refs/heads/test:refs/remotes/%s/test", remote_name);
error = git_refspec__parse(&refspec, git_buf_cstr(&buf), true);
git_buf_free(&buf);
git_refspec__free(&refspec);
giterr_clear();
return error == 0;
} | false | false | false | false | false | 0 |
g_auto_pointer_free(GAuto *auto_ptr)
{
AutoPointer *ptr;
AutoPointerRef *ref;
if (auto_ptr == NULL)
return;
ptr = auto_ptr;
ref = ptr->ref;
if (--(ref->cnt) == 0) {
#ifdef REF_DEBUG
G_PRINT_REF ("XXXX FREE(%lx) -- REF (%d)\n", ref->pointer, ref->cnt);
#endif
ref->free(ref->pointer);
g_free(ref);
}
#ifdef REF_DEBUG
else
G_PRINT_REF ("XXXX DEREF(%lx) -- REF (%d)\n", ref->pointer, ref->cnt);
#endif
g_free(ptr);
} | false | false | false | false | false | 0 |
wnck_workspace_accessible_contains (AtkComponent *component,
int x,
int y,
AtkCoordType coords)
{
int lx, ly, width, height;
wnck_workspace_accessible_get_extents (component, &lx, &ly, &width, &height, coords);
/*
* Check if the specified co-ordinates fall within the workspace.
*/
if ( (x > lx) && ((lx + width) >= x) && (y > ly) && ((ly + height) >= ly) )
return TRUE;
else
return FALSE;
} | false | false | false | false | false | 0 |
gst_level_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstLevel *filter = GST_LEVEL (object);
switch (prop_id) {
case PROP_SIGNAL_LEVEL:
filter->message = g_value_get_boolean (value);
break;
case PROP_SIGNAL_INTERVAL:
filter->interval = g_value_get_uint64 (value);
if (filter->rate) {
filter->interval_frames =
GST_CLOCK_TIME_TO_FRAMES (filter->interval, filter->rate);
}
break;
case PROP_PEAK_TTL:
filter->decay_peak_ttl =
gst_guint64_to_gdouble (g_value_get_uint64 (value));
break;
case PROP_PEAK_FALLOFF:
filter->decay_peak_falloff = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} | false | false | false | false | false | 0 |
__ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)
{
struct super_block *sb;
int err;
int rc;
if (!ext4_handle_valid(handle)) {
ext4_put_nojournal(handle);
return 0;
}
err = handle->h_err;
if (!handle->h_transaction) {
rc = jbd2_journal_stop(handle);
return err ? err : rc;
}
sb = handle->h_transaction->t_journal->j_private;
rc = jbd2_journal_stop(handle);
if (!err)
err = rc;
if (err)
__ext4_std_error(sb, where, line, err);
return err;
} | false | false | false | false | false | 0 |
caretSymbolFromString( const QString &symbol )
{
if ( symbol == QLatin1String( "None" ) )
return CaretAnnotation::None;
else if ( symbol == QLatin1String( "P" ) )
return CaretAnnotation::P;
return CaretAnnotation::None;
} | false | false | false | false | false | 0 |
scan_notes(int fd, loff_t start, loff_t lsize)
{
char *buf, *last, *note, *next;
size_t size;
ssize_t ret;
if (lsize > SSIZE_MAX) {
fprintf(stderr, "Unable to handle note section of %llu bytes\n",
(unsigned long long)lsize);
exit(20);
}
size = lsize;
buf = malloc(size);
if (!buf) {
fprintf(stderr, "Cannot malloc %zu bytes\n", size);
exit(21);
}
last = buf + size - 1;
ret = pread(fd, buf, size, start);
if (ret != (ssize_t)size) {
fprintf(stderr, "Cannot read note section @ 0x%llx of %zu bytes: %s\n",
(unsigned long long)start, size, strerror(errno));
exit(22);
}
for (note = buf; (note + sizeof(Elf_Nhdr)) < last; note = next)
{
Elf_Nhdr *hdr;
char *n_name, *n_desc;
size_t n_namesz, n_descsz, n_type;
hdr = (Elf_Nhdr *)note;
n_namesz = file32_to_cpu(hdr->n_namesz);
n_descsz = file32_to_cpu(hdr->n_descsz);
n_type = file32_to_cpu(hdr->n_type);
n_name = note + sizeof(*hdr);
n_desc = n_name + ((n_namesz + 3) & ~3);
next = n_desc + ((n_descsz + 3) & ~3);
if (next > (last + 1))
break;
if ((memcmp(n_name, "VMCOREINFO", 11) != 0) || (n_type != 0))
continue;
scan_vmcoreinfo(n_desc, n_descsz);
}
free(buf);
} | false | false | false | false | false | 0 |
clipRectangles(XRectangle *rects_,int n_,int ordering_)
{
if (data()->shared()==MSTrue)
{
MSMessageLog::warningMessage("MSGC error: setting clip rectangle on a shared GC");
}
XSetClipRectangles(display(),gc(),clipXOrigin(),clipYOrigin(),rects_,n_,ordering_);
} | false | false | false | false | false | 0 |
gap_story_vthumb_add_vthumb(GapStbMainGlobalParams *sgpp
,gint32 framenr
,guchar *th_data
,gint32 th_width
,gint32 th_height
,gint32 th_bpp
,gint32 video_id
)
{
GapVThumbElem *vthumb;
vthumb = p_new_vthumb(video_id
, framenr
, th_data
, th_width
, th_height
, th_bpp
);
if(vthumb)
{
/* link the new element as 1st into the list */
vthumb->next = sgpp->vthumb_list;
sgpp->vthumb_list = vthumb;
}
return(vthumb);
} | false | false | false | false | false | 0 |
collection_table_populate(CollectTable *ct, gboolean resize)
{
gint row;
GList *work;
collection_table_verify_selections(ct);
collection_table_clear_store(ct);
if (resize)
{
gint i;
gint thumb_width;
thumb_width = collection_table_get_icon_width(ct);
for (i = 0; i < COLLECT_TABLE_MAX_COLUMNS; i++)
{
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
GList *list;
column = gtk_tree_view_get_column(GTK_TREE_VIEW(ct->listview), i);
gtk_tree_view_column_set_visible(column, (i < ct->columns));
gtk_tree_view_column_set_fixed_width(column, thumb_width + (THUMB_BORDER_PADDING * 6));
#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
cell = (list) ? list->data : NULL;
g_list_free(list);
if (cell && GQV_IS_CELL_RENDERER_ICON(cell))
{
g_object_set(G_OBJECT(cell), "fixed_width", thumb_width,
"fixed_height", options->thumbnails.max_height,
"show_text", ct->show_text, NULL);
}
}
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_realized(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
#else
if (GTK_WIDGET_REALIZED(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
#endif
}
row = -1;
work = ct->cd->list;
while (work)
{
GList *list;
GtkTreeIter iter;
row++;
list = collection_table_add_row(ct, &iter);
while (work && list)
{
list->data = work->data;
list = list->next;
work = work->next;
}
}
ct->rows = row + 1;
collection_table_update_focus(ct);
collection_table_update_status(ct);
} | false | false | false | false | false | 0 |
handleClientsBlockedOnLists(void) {
while(listLength(server.ready_keys) != 0) {
list *l;
/* Point server.ready_keys to a fresh list and save the current one
* locally. This way as we run the old list we are free to call
* signalListAsReady() that may push new elements in server.ready_keys
* when handling clients blocked into BRPOPLPUSH. */
l = server.ready_keys;
server.ready_keys = listCreate();
while(listLength(l) != 0) {
listNode *ln = listFirst(l);
readyList *rl = ln->value;
/* First of all remove this key from db->ready_keys so that
* we can safely call signalListAsReady() against this key. */
dictDelete(rl->db->ready_keys,rl->key);
/* If the key exists and it's a list, serve blocked clients
* with data. */
robj *o = lookupKeyWrite(rl->db,rl->key);
if (o != NULL && o->type == REDIS_LIST) {
dictEntry *de;
/* We serve clients in the same order they blocked for
* this key, from the first blocked to the last. */
de = dictFind(rl->db->blocking_keys,rl->key);
if (de) {
list *clients = dictGetVal(de);
int numclients = listLength(clients);
while(numclients--) {
listNode *clientnode = listFirst(clients);
redisClient *receiver = clientnode->value;
robj *dstkey = receiver->bpop.target;
int where = (receiver->lastcmd &&
receiver->lastcmd->proc == blpopCommand) ?
REDIS_HEAD : REDIS_TAIL;
robj *value = listTypePop(o,where);
if (value) {
/* Protect receiver->bpop.target, that will be
* freed by the next unblockClient()
* call. */
if (dstkey) incrRefCount(dstkey);
unblockClient(receiver);
if (serveClientBlockedOnList(receiver,
rl->key,dstkey,rl->db,value,
where) == REDIS_ERR)
{
/* If we failed serving the client we need
* to also undo the POP operation. */
listTypePush(o,value,where);
}
if (dstkey) decrRefCount(dstkey);
decrRefCount(value);
} else {
break;
}
}
}
if (listTypeLength(o) == 0) dbDelete(rl->db,rl->key);
/* We don't call signalModifiedKey() as it was already called
* when an element was pushed on the list. */
}
/* Free this item. */
decrRefCount(rl->key);
zfree(rl);
listDelNode(l,ln);
}
listRelease(l); /* We have the new list on place at this point. */
}
} | false | false | false | false | false | 0 |
e_ascii_dtostr (gchar *buffer,
gint buf_len,
const gchar *format,
gdouble d)
{
struct lconv *locale_data;
const gchar *decimal_point;
gint decimal_point_len;
gchar *p;
gint rest_len;
gchar format_char;
g_return_val_if_fail (buffer != NULL, NULL);
g_return_val_if_fail (format[0] == '%', NULL);
g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
format_char = format[strlen (format) - 1];
g_return_val_if_fail (format_char == 'e' || format_char == 'E' ||
format_char == 'f' || format_char == 'F' ||
format_char == 'g' || format_char == 'G',
NULL);
if (format[0] != '%')
return NULL;
if (strpbrk (format + 1, "'l%"))
return NULL;
if (!(format_char == 'e' || format_char == 'E' ||
format_char == 'f' || format_char == 'F' ||
format_char == 'g' || format_char == 'G'))
return NULL;
g_snprintf (buffer, buf_len, format, d);
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
g_return_val_if_fail (decimal_point_len != 0, NULL);
if (strcmp (decimal_point, ".")) {
p = buffer;
if (*p == '+' || *p == '-')
p++;
while (isdigit ((guchar) * p))
p++;
if (strncmp (p, decimal_point, decimal_point_len) == 0) {
*p = '.';
p++;
if (decimal_point_len > 1) {
rest_len = strlen (p + (decimal_point_len - 1));
memmove (
p, p + (decimal_point_len - 1),
rest_len);
p[rest_len] = 0;
}
}
}
return buffer;
} | false | false | false | false | false | 0 |
coq_push_arguments(value args) {
int nargs,i;
nargs = Wosize_val(args) - 2;
coq_sp -= nargs;
print_instr("push_args");print_int(nargs);
for(i = 0; i < nargs; i++) coq_sp[i] = Field(args, i+2);
return Val_unit;
} | false | false | false | false | false | 0 |
privsep_recvfd(const int psfd)
{
char *buf;
int *fdptr;
struct cmsghdr *cmsg;
struct msghdr msg;
struct iovec vec;
const size_t sizeof_buf = CMSG_SPACE(sizeof *fdptr);
size_t sizeof_buf_ = sizeof_buf;
PrivSepCmd fodder = PRIVSEPCMD_NONE;
ssize_t received;
if (sizeof_buf_ < sizeof *cmsg) {
sizeof_buf_ = sizeof *cmsg;
}
if ((buf = ALLOCA(sizeof_buf_)) == NULL) {
return -1;
}
memset(&msg, 0, sizeof msg);
vec.iov_base = (void *) &fodder;
vec.iov_len = sizeof fodder;
msg.msg_name = NULL;
msg.msg_namelen = (socklen_t) 0;
msg.msg_iov = &vec;
msg.msg_iovlen = (size_t) 1U;
msg.msg_control = buf;
msg.msg_controllen = sizeof_buf;
msg.msg_flags = 0;
if ((cmsg = CMSG_FIRSTHDR(&msg)) == NULL ||
(fdptr = (int *) (void *) CMSG_DATA(cmsg)) == NULL) {
ALLOCA_FREE(buf);
return -1;
}
*fdptr = -1;
while ((received = recvmsg(psfd, &msg, 0)) == (ssize_t) -1 &&
errno == EINTR);
# if defined(MSG_TRUNC) && defined(MSG_CTRUNC)
if ((msg.msg_flags & MSG_TRUNC) || (msg.msg_flags & MSG_CTRUNC)) {
ALLOCA_FREE(buf);
return -1;
}
# endif
if (received != (ssize_t) sizeof fodder ||
fodder != PRIVSEPCMD_ANSWER_FD ||
(cmsg = CMSG_FIRSTHDR(&msg)) == NULL ||
(fdptr = (int *) (void *) CMSG_DATA(cmsg)) == NULL) {
ALLOCA_FREE(buf);
return -1;
}
return *fdptr;
} | false | false | false | false | false | 0 |
generateLookupTable( void )
{
// Declare Variables
int i,j;
// Allocate memory for lookup table w
w = new double*[kp];
// Traverse through kernel generating weight function
// lookup table w
// Assume kernel is uniform
uniformKernel = true;
for(i = 0; i < kp; i++)
{
switch(kernel[i])
{
// *Uniform Kernel* has weight funciton w(u) = 1
// therefore, a weight funciton lookup table is
// not needed for this kernel --> w[i] = NULL indicates
// this
case Uniform:
w [i] = NULL; //weight function not needed for this kernel
offset [i] = 1; //uniform kernel has u < 1.0
increment[i] = 1; //has no meaning
break;
// *Gaussian Kernel* has weight function w(u) = constant*exp(-u^2/[2h[i]^2])
case Gaussian:
// Set uniformKernel to false
uniformKernel = false;
// generate weight function using expression,
// exp(-u/2), where u = norm(xi - x)^2/h^2
// Allocate memory for weight table
w[i] = new double [GAUSS_NUM_ELS+1];
for(j = 0; j <= GAUSS_NUM_ELS; j++)
w[i][j] = exp(-j*GAUSS_INCREMENT/2);
// Set offset = offset^2, and set increment
offset [i] = (float)(GAUSS_LIMIT*GAUSS_LIMIT);
increment[i] = GAUSS_INCREMENT;
// done
break;
// *User Define Kernel* uses the weight function wf(u)
case UserDefined:
// Set uniformKernel to false
uniformKernel = false;
// Search for user defined weight function
// defined for subspace (i+1)
cur = head;
while((cur)&&(cur->subspace != (i+1)))
cur = cur->next;
// If a user defined subspace has not been found
// for this subspace, flag an error
if(cur == NULL)
{
fprintf(stderr, "\ngenerateLookupTable Fatal Error: User defined kernel for subspace %d undefined.\n\nAborting Program.\n\n", i+1);
exit(1);
}
// Otherwise, copy weight function lookup table to w[i]
w[i] = new double [cur->sampleNumber+1];
for(j = 0; j <= cur->sampleNumber; j++)
w[i][j] = cur->w[j];
// Set offset and increment accordingly
offset [i] = (float)(cur->halfWindow);
increment[i] = cur->halfWindow/(float)(cur->sampleNumber);
// done
break;
default:
ErrorHandler("MeanShift", "generateLookupTable", "Unknown kernel type.");
}
}
} | false | false | false | false | false | 0 |
iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
enum iscsi_param param, char *buf)
{
struct iscsi_conn *conn = cls_conn->dd_data;
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
struct sockaddr_in6 addr;
int rc, len;
switch(param) {
case ISCSI_PARAM_CONN_PORT:
case ISCSI_PARAM_CONN_ADDRESS:
case ISCSI_PARAM_LOCAL_PORT:
spin_lock_bh(&conn->session->lock);
if (!tcp_sw_conn || !tcp_sw_conn->sock) {
spin_unlock_bh(&conn->session->lock);
return -ENOTCONN;
}
if (param == ISCSI_PARAM_LOCAL_PORT)
rc = kernel_getsockname(tcp_sw_conn->sock,
(struct sockaddr *)&addr, &len);
else
rc = kernel_getpeername(tcp_sw_conn->sock,
(struct sockaddr *)&addr, &len);
spin_unlock_bh(&conn->session->lock);
if (rc)
return rc;
return iscsi_conn_get_addr_param((struct sockaddr_storage *)
&addr, param, buf);
default:
return iscsi_conn_get_param(cls_conn, param, buf);
}
return 0;
} | false | false | false | false | false | 0 |
mpicbe_task_write_mf_branch_modules_call(csbe_context *cx, List *list)
{
List *li;
Hmdf_table *hmdf;
csbe_printf(cx, "void %s(int mtg_id, int cl_no, int mt_no, int LAST_BRANCH)\n",
SCHE_FUNC_NAME_MFBS);
csbe_printf(cx, "{\n");
for (li = list; li != NULL; li = li->next) {
hmdf = li->data;
if (!hmdf->belong_control_flow) {
csbe_printf(cx, "if(mtg_id==%d){\n", hmdf->mtg_id);
mpicbe_task_write_mf_branch_modules_call_body(cx, hmdf);
csbe_printf(cx, "}\n");
}
}
csbe_printf(cx, "}\n");
} | false | false | false | false | false | 0 |
devm_devfreq_event_add_edev(struct device *dev,
struct devfreq_event_desc *desc)
{
struct devfreq_event_dev **ptr, *edev;
ptr = devres_alloc(devm_devfreq_event_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return ERR_PTR(-ENOMEM);
edev = devfreq_event_add_edev(dev, desc);
if (IS_ERR(edev)) {
devres_free(ptr);
return ERR_PTR(-ENOMEM);
}
*ptr = edev;
devres_add(dev, ptr);
return edev;
} | false | false | false | false | false | 0 |
imapx_search_by_uids (CamelFolder *folder,
const gchar *expression,
GPtrArray *uids,
GCancellable *cancellable,
GError **error)
{
CamelIMAPXStore *imapx_store;
CamelIMAPXFolder *imapx_folder;
CamelIMAPXSearch *imapx_search;
CamelIMAPXServer *imapx_server;
CamelStore *store;
GPtrArray *matches;
if (uids->len == 0)
return g_ptr_array_new ();
imapx_folder = CAMEL_IMAPX_FOLDER (folder);
store = camel_folder_get_parent_store (folder);
imapx_store = CAMEL_IMAPX_STORE (store);
imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
g_mutex_lock (&imapx_folder->search_lock);
imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
camel_imapx_search_set_server (imapx_search, imapx_server);
camel_folder_search_set_folder (imapx_folder->search, folder);
matches = camel_folder_search_search (
imapx_folder->search, expression, uids, cancellable, error);
camel_imapx_search_set_server (imapx_search, NULL);
g_mutex_unlock (&imapx_folder->search_lock);
g_clear_object (&imapx_server);
return matches;
} | false | false | false | false | false | 0 |
on_local_variables(GArray *nodes)
{
const char *token = parse_grab_token(nodes);
size_t len = *token - '0' + 1;
if (thread_id && frame_id && len == strlen(thread_id) &&
!memcmp(++token, thread_id, len) && !strcmp(token + len, frame_id))
{
GtkTreeIter iter;
LocalData ld = { NULL, stack_entry() };
if (gtk_tree_selection_get_selected(selection, NULL, &iter))
gtk_tree_model_get(model, &iter, LOCAL_NAME, &ld.name, -1);
locals_clear();
array_foreach(parse_lead_array(nodes), (GFunc) local_node_variable, &ld);
g_free(ld.name);
}
} | false | false | false | false | false | 0 |
pkix_pl_CertBasicConstraints_ToString(
PKIX_PL_Object *object,
PKIX_PL_String **pString,
void *plContext)
{
PKIX_PL_String *certBasicConstraintsString = NULL;
PKIX_PL_CertBasicConstraints *certB = NULL;
PKIX_Boolean isCA = PKIX_FALSE;
PKIX_Int32 pathLen = 0;
PKIX_PL_String *outString = NULL;
char *fmtString = NULL;
PKIX_Boolean pathlenArg = PKIX_FALSE;
PKIX_ENTER(CERTBASICCONSTRAINTS,
"pkix_pl_CertBasicConstraints_toString");
PKIX_NULLCHECK_TWO(object, pString);
PKIX_CHECK(pkix_CheckType
(object, PKIX_CERTBASICCONSTRAINTS_TYPE, plContext),
PKIX_FIRSTARGUMENTNOTCERTBASICCONSTRAINTSOBJECT);
certB = (PKIX_PL_CertBasicConstraints *)object;
/*
* if CA == TRUE
* if pathLen == CERT_UNLIMITED_PATH_CONSTRAINT
* print "CA(-1)"
* else print "CA(nnn)"
* if CA == FALSE, print "~CA"
*/
isCA = certB->isCA;
if (isCA) {
pathLen = certB->pathLen;
if (pathLen == CERT_UNLIMITED_PATH_CONSTRAINT) {
/* print "CA(-1)" */
fmtString = "CA(-1)";
pathlenArg = PKIX_FALSE;
} else {
/* print "CA(pathLen)" */
fmtString = "CA(%d)";
pathlenArg = PKIX_TRUE;
}
} else {
/* print "~CA" */
fmtString = "~CA";
pathlenArg = PKIX_FALSE;
}
PKIX_CHECK(PKIX_PL_String_Create
(PKIX_ESCASCII,
fmtString,
0,
&certBasicConstraintsString,
plContext),
PKIX_STRINGCREATEFAILED);
if (pathlenArg) {
PKIX_CHECK(PKIX_PL_Sprintf
(&outString,
plContext,
certBasicConstraintsString,
pathLen),
PKIX_SPRINTFFAILED);
} else {
PKIX_CHECK(PKIX_PL_Sprintf
(&outString,
plContext,
certBasicConstraintsString),
PKIX_SPRINTFFAILED);
}
*pString = outString;
cleanup:
PKIX_DECREF(certBasicConstraintsString);
PKIX_RETURN(CERTBASICCONSTRAINTS);
} | false | false | false | false | false | 0 |
polynomialToFraction(Polynomial const &p)
{
FieldRationalFunctions2Implementation *imp=dynamic_cast<FieldRationalFunctions2Implementation*>(implementingObject);
Polynomial q=Term(imp->getPolynomialRing().getField().zHomomorphism(1),Monomial(imp->getPolynomialRing()));
return new FieldElementRationalFunction2(*imp, p, q);
} | false | false | false | false | false | 0 |
ddf_FreeOfImplicitLinearity(ddf_MatrixPtr M, ddf_Arow certificate, ddf_rowset *imp_linrows, ddf_ErrorType *error)
/* 092 */
{
/* Checks whether the matrix M constains any implicit linearity at all.
It returns 1 if it is free of any implicit linearity. This means that
the present linearity rows define the linearity correctly. It returns
nonpositive values otherwise.
H-representation
f* = maximize z
subject to
b_I + A_I x - 1 z >= 0
b_L + A_L x = 0 (linearity)
z <= 1.
V-representation (=separation problem)
f* = maximize z
subject to
b_I x_0 + A_I x - 1 z >= 0 (all nonlinearity generators in one side)
b_L x_0 + A_L x = 0 (linearity generators)
z <= 1.
Here, the input matrix is considered as (b, A), i.e. b corresponds to the first column of input
and the row indices of input is partitioned into I and L where L is the set of linearity.
In both cases, any implicit linearity exists if and only if the optimal value f* is nonpositive.
The certificate has dimension one more for V-representation case.
*/
ddf_LPPtr lp;
ddf_rowrange i,m;
ddf_colrange j,d1;
ddf_ErrorType err=ddf_NoError;
ddf_Arow cvec; /* certificate for implicit linearity */
int answer=0,localdebug=ddf_FALSE;
*error=ddf_NoError;
/* Create an LP data for redundancy checking */
if (M->representation==ddf_Generator){
lp=ddf_CreateLP_V_ImplicitLinearity(M);
} else {
lp=ddf_CreateLP_H_ImplicitLinearity(M);
}
ddf_LPSolve(lp,ddf_choiceRedcheckAlgorithm,&err);
if (err!=ddf_NoError){
*error=err;
goto _L999;
} else {
for (j=0; j<lp->d; j++) {
ddf_set(certificate[j], lp->sol[j]);
}
if (localdebug) ddf_WriteLPResult(stderr,lp,err);
/* *posset contains a set of row indices that are recognized as nonlinearity. */
if (localdebug) {
fprintf(stderr,"==> The following variables are not implicit linearity:\n");
set_fwrite(stderr, lp->posset_extra);
fprintf(stderr,"\n");
}
if (M->representation==ddf_Generator){
d1=(M->colsize)+1;
} else {
d1=M->colsize;
}
m=M->rowsize;
ddf_InitializeArow(d1,&cvec);
set_initialize(imp_linrows,m);
if (lp->LPS==ddf_Optimal){
if (ddf_Positive(lp->optvalue)){
answer=1;
if (localdebug) fprintf(stderr,"==> The matrix has no implicit linearity.\n");
} else if (ddf_Negative(lp->optvalue)) {
answer=-1;
if (localdebug) fprintf(stderr,"==> The matrix defines the trivial system.\n");
} else {
answer=0;
if (localdebug) fprintf(stderr,"==> The matrix has some implicit linearity.\n");
}
} else {
answer=-2;
if (localdebug) fprintf(stderr,"==> The LP fails.\n");
}
if (answer==0){
/* List the implicit linearity rows */
for (i=m; i>=1; i--) {
if (!set_member(i,lp->posset_extra)) {
if (ddf_ImplicitLinearity(M, i, cvec, error)) {
set_addelem(*imp_linrows, i);
if (localdebug) {
fprintf(stderr," row %ld is implicit linearity\n",i);
fprintf(stderr,"\n");
}
}
if (*error!=ddf_NoError) goto _L999;
}
}
} /* end of if (answer==0) */
if (answer==-1) {
for (i=m; i>=1; i--) set_addelem(*imp_linrows, i);
} /* all rows are considered implicit linearity */
ddf_FreeArow(d1,cvec);
}
_L999:
ddf_FreeLPData(lp);
return answer;
} | false | false | false | false | false | 0 |
indexOfAny(const UChar* const strings[]) const
{
int result = -1;
for (int i = 0; strings[i]; i++) {
int32_t pos = ruleText.indexOf(*strings[i]);
if (pos != -1 && (result == -1 || pos < result)) {
result = pos;
}
}
return result;
} | false | false | false | false | false | 0 |
validator_step ( struct validator *validator ) {
struct x509_link *link;
struct x509_certificate *cert;
struct x509_certificate *issuer = NULL;
struct x509_certificate *last;
time_t now;
int rc;
/* Try validating chain. Try even if the chain is incomplete,
* since certificates may already have been validated
* previously.
*/
now = time ( NULL );
if ( ( rc = x509_validate_chain ( validator->chain, now,
NULL ) ) == 0 ) {
validator_finished ( validator, 0 );
return;
}
/* If there is a certificate that could be validated using
* OCSP, try it.
*/
list_for_each_entry ( link, &validator->chain->links, list ) {
cert = issuer;
issuer = link->cert;
if ( ! cert )
continue;
if ( ! issuer->valid )
continue;
/* The issuer is valid, but this certificate is not
* yet valid. If OCSP is applicable, start it.
*/
if ( cert->extensions.auth_info.ocsp.uri &&
( ! cert->extensions.auth_info.ocsp.good ) ) {
/* Start OCSP */
if ( ( rc = validator_start_ocsp ( validator, cert,
issuer ) ) != 0 ) {
validator_finished ( validator, rc );
return;
}
return;
}
/* Otherwise, this is a permanent failure */
validator_finished ( validator, rc );
return;
}
/* If chain ends with a self-issued certificate, then there is
* nothing more to do.
*/
last = x509_last ( validator->chain );
if ( asn1_compare ( &last->issuer.raw, &last->subject.raw ) == 0 ) {
validator_finished ( validator, rc );
return;
}
/* Otherwise, try to download a suitable cross-signing
* certificate.
*/
if ( ( rc = validator_start_download ( validator,
&last->issuer.raw ) ) != 0 ) {
validator_finished ( validator, rc );
return;
}
} | false | false | false | false | false | 0 |
handle_used_attribute (tree *pnode, tree name, tree ARG_UNUSED (args),
int ARG_UNUSED (flags), bool *no_add_attrs)
{
tree node = *pnode;
if (TREE_CODE (node) == FUNCTION_DECL
|| (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node)))
{
TREE_USED (node) = 1;
DECL_PRESERVE_P (node) = 1;
if (TREE_CODE (node) == VAR_DECL)
DECL_READ_P (node) = 1;
}
else
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
return NULL_TREE;
} | false | false | false | false | false | 0 |
output_local_subroutine_die (arg)
void *arg;
{
tree decl = arg;
tree origin = decl_ultimate_origin (decl);
ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_subroutine);
sibling_attribute ();
dienum_push ();
if (origin != NULL)
abstract_origin_attribute (origin);
else
{
tree type = TREE_TYPE (decl);
name_and_src_coords_attributes (decl);
inline_attribute (decl);
prototyped_attribute (type);
member_attribute (DECL_CONTEXT (decl));
type_attribute (TREE_TYPE (type), 0, 0);
pure_or_virtual_attribute (decl);
}
if (DECL_ABSTRACT (decl))
equate_decl_number_to_die_number (decl);
else
{
/* Avoid getting screwed up in cases where a function was declared
static but where no definition was ever given for it. */
if (TREE_ASM_WRITTEN (decl))
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
low_pc_attribute (function_start_label (decl));
sprintf (label, FUNC_END_LABEL_FMT, current_function_funcdef_no);
high_pc_attribute (label);
if (use_gnu_debug_info_extensions)
{
sprintf (label, BODY_BEGIN_LABEL_FMT,
current_function_funcdef_no);
body_begin_attribute (label);
sprintf (label, BODY_END_LABEL_FMT, current_function_funcdef_no);
body_end_attribute (label);
}
}
}
} | false | false | false | false | false | 0 |