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 |
|---|---|---|---|---|---|---|
intel_get_param(__DRIscreen *psp, int param, int *value)
{
int ret;
struct drm_i915_getparam gp;
memset(&gp, 0, sizeof(gp));
gp.param = param;
gp.value = value;
ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
if (ret != -EINVAL)
_mesa_warning(NULL, "drm_i915_getparam: %d", ret);
return false;
}
return true;
} | false | false | false | false | false | 0 |
ocfs2_meta_lvb_is_trustable(struct inode *inode,
struct ocfs2_lock_res *lockres)
{
struct ocfs2_meta_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
if (ocfs2_dlm_lvb_valid(&lockres->l_lksb)
&& lvb->lvb_version == OCFS2_LVB_VERSION
&& be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
return 1;
return 0;
} | false | false | false | false | false | 0 |
rcpath(const char * file) {
static char path[4096] = { 0 };
memset(path, 0, sizeof(path));
if(getenv("SHELL_FM_HOME") != NULL) {
snprintf(path, sizeof(path), "%s/%s", getenv("SHELL_FM_HOME"), file);
}
else {
snprintf(path, sizeof(path), "%s/.shell-fm/%s", getenv("HOME"), file);
}
return path;
} | false | false | false | false | false | 0 |
frame_mrs_hide_unhide_parent(
FvwmWindow *fw, mr_args_internal *mra)
{
XSetWindowAttributes xswa;
if (mra->step_flags.do_unhide_parent)
{
Window w[2];
/* update the hidden position of the client */
frame_update_hidden_window_pos(fw, mra, True);
w[0] = hide_wins.w[3];
w[1] = FW_W_PARENT(fw);
XRestackWindows(dpy, w, 2);
}
else if (mra->step_flags.do_hide_parent)
{
/* When the parent gets hidden, unmap it automatically, lower
* it while hidden, then remap it. Necessary to eliminate
* flickering. */
xswa.win_gravity = UnmapGravity;
XChangeWindowAttributes(
dpy, FW_W_PARENT(fw), CWWinGravity, &xswa);
}
return;
} | false | false | false | false | false | 0 |
print_mpeg12(struct mpeg_codec_cap *mpeg)
{
DBG("Media Codec: MPEG12"
" Channel Modes: %s%s%s%s"
" Frequencies: %s%s%s%s%s%s"
" Layers: %s%s%s"
" CRC: %s",
mpeg->channel_mode & MPEG_CHANNEL_MODE_MONO ? "Mono " : "",
mpeg->channel_mode & MPEG_CHANNEL_MODE_DUAL_CHANNEL ?
"DualChannel " : "",
mpeg->channel_mode & MPEG_CHANNEL_MODE_STEREO ? "Stereo " : "",
mpeg->channel_mode & MPEG_CHANNEL_MODE_JOINT_STEREO ?
"JointStereo " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_16000 ? "16Khz " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_22050 ? "22.05Khz " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_24000 ? "24Khz " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_32000 ? "32Khz " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_44100 ? "44.1Khz " : "",
mpeg->frequency & MPEG_SAMPLING_FREQ_48000 ? "48Khz " : "",
mpeg->layer & MPEG_LAYER_MP1 ? "1 " : "",
mpeg->layer & MPEG_LAYER_MP2 ? "2 " : "",
mpeg->layer & MPEG_LAYER_MP3 ? "3 " : "",
mpeg->crc ? "Yes" : "No");
} | false | false | false | false | false | 0 |
tab_left()
{
#ifdef _DEBUG
std::cout << "MessageViewBase::tab_left\n";
#endif
int page = m_notebook.get_current_page();
if( page == PAGE_MESSAGE ) m_notebook.set_current_page( PAGE_PREVIEW );
else m_notebook.set_current_page( PAGE_MESSAGE );
focus_view();
} | false | false | false | false | false | 0 |
mct_encode_custom(
// MCT data
OPJ_BYTE * pCodingdata,
// size of components
OPJ_UINT32 n,
// components
OPJ_BYTE ** pData,
// nb of components (i.e. size of pData)
OPJ_UINT32 pNbComp,
// tells if the data is signed
OPJ_UINT32 isSigned)
{
OPJ_FLOAT32 * lMct = (OPJ_FLOAT32 *) pCodingdata;
OPJ_UINT32 i;
OPJ_UINT32 j;
OPJ_UINT32 k;
OPJ_UINT32 lNbMatCoeff = pNbComp * pNbComp;
OPJ_INT32 * lCurrentData = 00;
OPJ_INT32 * lCurrentMatrix = 00;
OPJ_INT32 ** lData = (OPJ_INT32 **) pData;
OPJ_UINT32 lMultiplicator = 1 << 13;
OPJ_INT32 * lMctPtr;
lCurrentData = (OPJ_INT32 *) opj_malloc((pNbComp + lNbMatCoeff) * sizeof(OPJ_INT32));
if
(! lCurrentData)
{
return false;
}
lCurrentMatrix = lCurrentData + pNbComp;
for
(i =0;i<lNbMatCoeff;++i)
{
lCurrentMatrix[i] = (OPJ_INT32) (*(lMct++) * lMultiplicator);
}
for
(i = 0; i < n; ++i)
{
lMctPtr = lCurrentMatrix;
for
(j=0;j<pNbComp;++j)
{
lCurrentData[j] = (*(lData[j]));
}
for
(j=0;j<pNbComp;++j)
{
*(lData[j]) = 0;
for
(k=0;k<pNbComp;++k)
{
*(lData[j]) += fix_mul(*lMctPtr, lCurrentData[k]);
++lMctPtr;
}
++lData[j];
}
}
opj_free(lCurrentData);
return true;
} | false | false | false | false | true | 1 |
validateForeignKeyConstraint(FkConstraint *fkconstraint,
Relation rel,
Relation pkrel)
{
HeapScanDesc scan;
HeapTuple tuple;
Trigger trig;
ListCell *list;
int count;
/*
* See if we can do it with a single LEFT JOIN query. A FALSE result
* indicates we must proceed with the fire-the-trigger method.
*/
if (RI_Initial_Check(fkconstraint, rel, pkrel))
return;
/*
* Scan through each tuple, calling RI_FKey_check_ins (insert trigger) as
* if that tuple had just been inserted. If any of those fail, it should
* ereport(ERROR) and that's that.
*/
MemSet(&trig, 0, sizeof(trig));
trig.tgoid = InvalidOid;
trig.tgname = fkconstraint->constr_name;
trig.tgenabled = TRUE;
trig.tgisconstraint = TRUE;
trig.tgconstrrelid = RelationGetRelid(pkrel);
trig.tgdeferrable = FALSE;
trig.tginitdeferred = FALSE;
trig.tgargs = (char **) palloc(sizeof(char *) *
(4 + list_length(fkconstraint->fk_attrs)
+ list_length(fkconstraint->pk_attrs)));
trig.tgargs[0] = trig.tgname;
trig.tgargs[1] = RelationGetRelationName(rel);
trig.tgargs[2] = RelationGetRelationName(pkrel);
trig.tgargs[3] = fkMatchTypeToString(fkconstraint->fk_matchtype);
count = 4;
foreach(list, fkconstraint->fk_attrs)
{
char *fk_at = strVal(lfirst(list));
trig.tgargs[count] = fk_at;
count += 2;
}
count = 5;
foreach(list, fkconstraint->pk_attrs)
{
char *pk_at = strVal(lfirst(list));
trig.tgargs[count] = pk_at;
count += 2;
}
trig.tgnargs = count - 1;
scan = heap_beginscan(rel, SnapshotNow, 0, NULL);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
FunctionCallInfoData fcinfo;
TriggerData trigdata;
/*
* Make a call to the trigger function
*
* No parameters are passed, but we do set a context
*/
MemSet(&fcinfo, 0, sizeof(fcinfo));
/*
* We assume RI_FKey_check_ins won't look at flinfo...
*/
trigdata.type = T_TriggerData;
trigdata.tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
trigdata.tg_relation = rel;
trigdata.tg_trigtuple = tuple;
trigdata.tg_newtuple = NULL;
trigdata.tg_trigger = &trig;
trigdata.tg_trigtuplebuf = scan->rs_cbuf;
trigdata.tg_newtuplebuf = InvalidBuffer;
fcinfo.context = (Node *) &trigdata;
RI_FKey_check_ins(&fcinfo);
}
heap_endscan(scan);
pfree(trig.tgargs);
} | false | false | false | false | false | 0 |
settings_free(rdpSettings* settings)
{
if (settings != NULL)
{
freerdp_uniconv_free(settings->uniconv);
xfree(settings->hostname);
xfree(settings->username);
xfree(settings->password);
xfree(settings->domain);
xfree(settings->shell);
xfree(settings->directory);
xfree(settings->client_dir);
xfree(settings);
}
} | false | false | false | false | false | 0 |
L17()
{register object *base=vs_base;
register object *sup=base+VM17; VC17
vs_check;
vs_top=sup;
goto TTL;
TTL:;
{frame_ptr fr;
fr=frs_sch_catch(((object)VV[69]));
if(fr==NULL) FEerror("The tag ~s is undefined.",1,((object)VV[69]));
base[0]= Cnil;
vs_top=(vs_base=base+0)+1;
unwind(fr,((object)VV[69]));}
} | false | false | false | false | false | 0 |
Read_Next_Char(StmInf *pstm, Bool convert)
{
c_orig = c = Stream_Getc(pstm);
if (c == EOF)
c_type = 0;
else
{
if (convert)
c = Char_Conversion(c);
c_type = char_type[c];
}
return c;
} | false | false | false | false | false | 0 |
signal_handler(int signo)
{
gotsig[signo - 1] = 1;
if (signo == SIGINT && !trap[SIGINT]) {
if (!suppress_int) {
pending_sig = 0;
raise_interrupt(); /* does not return */
}
pending_int = 1;
} else {
pending_sig = signo;
}
} | false | false | false | false | false | 0 |
max8660_pdata_from_dt(struct device *dev,
struct device_node **of_node,
struct max8660_platform_data *pdata)
{
int matched, i;
struct device_node *np;
struct max8660_subdev_data *sub;
struct of_regulator_match rmatch[ARRAY_SIZE(max8660_reg)] = { };
np = of_get_child_by_name(dev->of_node, "regulators");
if (!np) {
dev_err(dev, "missing 'regulators' subnode in DT\n");
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(rmatch); i++)
rmatch[i].name = max8660_reg[i].name;
matched = of_regulator_match(dev, np, rmatch, ARRAY_SIZE(rmatch));
of_node_put(np);
if (matched <= 0)
return matched;
pdata->subdevs = devm_kzalloc(dev, sizeof(struct max8660_subdev_data) *
matched, GFP_KERNEL);
if (!pdata->subdevs)
return -ENOMEM;
pdata->num_subdevs = matched;
sub = pdata->subdevs;
for (i = 0; i < matched; i++) {
sub->id = i;
sub->name = rmatch[i].name;
sub->platform_data = rmatch[i].init_data;
of_node[i] = rmatch[i].of_node;
sub++;
}
return 0;
} | false | false | false | false | false | 0 |
uih_printmenu(struct uih_context *c, const char *name, int recursive)
{
const char *fullname;
int i = 0;
const menuitem *item;
if ((fullname = menu_fullname(name)) == NULL) {
printf("Menu not found\n");
return;
}
printf("\n\nmenu \"%s\" \"%s\"\n", fullname, name);
for (i = 0; (item = menu_item(name, i)) != NULL; i++) {
if (item->type == MENU_SUBMENU) {
printf("submenu \"%s\" \"%s\"\n", item->name, item->shortname);
continue;
}
if (item->type == MENU_SUBMENU) {
printf("separator");
continue;
}
printf("menuentry \"%s\" \"%s\" ", item->name, item->shortname);
if (item->flags & MENUFLAG_RADIO)
printf("radio %s", menu_enabled(item, c) ? "on" : "off");
else if (item->flags & MENUFLAG_CHECKBOX)
printf("checkbox %s", menu_enabled(item, c) ? "on" : "off");
else
printf("normal");
if (item->flags & MENUFLAG_DIALOGATDISABLE)
printf(" dialogatdisable");
if (item->type == MENU_DIALOG || item->type == MENU_CUSTOMDIALOG)
printf(" dialog");
printf("\n");
}
printf("endmenu\n");
if (recursive)
for (i = 0; (item = menu_item(name, i)) != NULL; i++) {
if (item->type == MENU_SUBMENU) {
uih_printmenu(c, item->shortname, 1);
}
}
} | false | false | false | false | false | 0 |
of_overlay_create(struct device_node *tree)
{
struct of_overlay *ov;
int err, id;
/* allocate the overlay structure */
ov = kzalloc(sizeof(*ov), GFP_KERNEL);
if (ov == NULL)
return -ENOMEM;
ov->id = -1;
INIT_LIST_HEAD(&ov->node);
of_changeset_init(&ov->cset);
mutex_lock(&of_mutex);
id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL);
if (id < 0) {
pr_err("%s: idr_alloc() failed for tree@%s\n",
__func__, tree->full_name);
err = id;
goto err_destroy_trans;
}
ov->id = id;
/* build the overlay info structures */
err = of_build_overlay_info(ov, tree);
if (err) {
pr_err("%s: of_build_overlay_info() failed for tree@%s\n",
__func__, tree->full_name);
goto err_free_idr;
}
/* apply the overlay */
err = of_overlay_apply(ov);
if (err) {
pr_err("%s: of_overlay_apply() failed for tree@%s\n",
__func__, tree->full_name);
goto err_abort_trans;
}
/* apply the changeset */
err = of_changeset_apply(&ov->cset);
if (err) {
pr_err("%s: of_changeset_apply() failed for tree@%s\n",
__func__, tree->full_name);
goto err_revert_overlay;
}
/* add to the tail of the overlay list */
list_add_tail(&ov->node, &ov_list);
mutex_unlock(&of_mutex);
return id;
err_revert_overlay:
err_abort_trans:
of_free_overlay_info(ov);
err_free_idr:
idr_remove(&ov_idr, ov->id);
err_destroy_trans:
of_changeset_destroy(&ov->cset);
kfree(ov);
mutex_unlock(&of_mutex);
return err;
} | false | false | false | false | false | 0 |
parse_int(int *opt, const char *arg, int min, int max)
{
int value = atoi(arg);
if (min <= value && value <= max) {
*opt = value;
return OPT_OK;
}
return OPT_ERR_INTEGER_VALUE_OUT_OF_BOUND;
} | false | false | false | false | false | 0 |
xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
xmlSecBufferPtr buffer;
int ret;
xmlSecAssert2(xmlSecKeyDataIsValid(dst), -1);
xmlSecAssert2(xmlSecKeyDataCheckSize(dst, xmlSecKeyDataBinarySize), -1);
xmlSecAssert2(xmlSecKeyDataIsValid(src), -1);
xmlSecAssert2(xmlSecKeyDataCheckSize(src, xmlSecKeyDataBinarySize), -1);
buffer = xmlSecKeyDataBinaryValueGetBuffer(src);
xmlSecAssert2(buffer != NULL, -1);
/* copy data */
ret = xmlSecKeyDataBinaryValueSetBuffer(dst,
xmlSecBufferGetData(buffer),
xmlSecBufferGetSize(buffer));
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
"xmlSecKeyDataBinaryValueSetBuffer",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
return(0);
} | false | false | false | false | false | 0 |
rosGetColLbls( void )
{
static wxString osColLbls;
CmdNgSpicePR oCmdPR;
wxString osNodePair;
size_t sz1, sz2;
// Get a working copy of the PRINT command object to modify
oCmdPR = m_oCmdPR;
// Check if anything can be done
if( !m_oCmdPR.m_osaCpnts.IsEmpty( ) && !NetList::m_oaCpnts.IsEmpty( ) )
{
// Replace PRINT command node pairs with corresponding component names
for( sz1=0; sz1<oCmdPR.m_osaCpnts.GetCount( ); sz1++ )
{
// Get a node pair
osNodePair = oCmdPR.m_osaCpnts.Item( sz1 );
// Find a component name for a node pair
for( sz2=0; sz2<NetList::m_oaCpnts.GetCount( ); sz2++ )
{
Component & roCpnt1 = NetList::m_oaCpnts.Item( sz2 );
if( roCpnt1.m_osaNodes.GetCount( ) != 2 ) continue;
// Test if a component's nodes match the PRINT command node pair
if( roCpnt1.rosGetNodes( ) == osNodePair )
{
oCmdPR.m_osaCpnts.Item( sz1 ) = roCpnt1.m_osName;
break;
}
}
}
}
// Create the results file column labels
oCmdPR.bFormat( );
osColLbls = oCmdPR .AfterFirst( wxT(' ') );
osColLbls = osColLbls.AfterFirst( wxT(' ') );
return( osColLbls );
} | false | false | false | false | false | 0 |
refine_copper(const struct pkg *pkg_copper, struct inst *copper,
enum allow_overlap allow)
{
const struct pkg *pkg;
struct inst *other;
for (pkg = pkgs; pkg; pkg = pkg->next) {
/*
* Pads in distinct packages can happily coexist.
*/
if (pkg != pkgs && pkg_copper != pkgs && pkg_copper != pkg)
continue;
for (other = pkg->insts[ip_pad_copper]; other;
other = other->next)
if (copper != other && overlap(copper, other, allow)) {
fail("overlapping copper pads "
"(\"%s\" line %d, \"%s\" line %d)",
copper->u.pad.name, copper->obj->lineno,
other->u.pad.name, other->obj->lineno);
instantiation_error = copper->obj;
return 0;
}
for (other = pkg->insts[ip_pad_special]; other;
other = other->next)
if (overlap(copper, other, ao_none))
if (!refine_overlapping(copper, other))
return 0;
}
return 1;
} | false | false | false | false | false | 0 |
nemo_icon_container_accessible_initialize (AtkObject *accessible,
gpointer data)
{
NemoIconContainer *container;
NemoIconContainerAccessiblePrivate *priv;
if (ATK_OBJECT_CLASS (accessible_parent_class)->initialize) {
ATK_OBJECT_CLASS (accessible_parent_class)->initialize (accessible, data);
}
priv = g_new0 (NemoIconContainerAccessiblePrivate, 1);
g_object_set_qdata (G_OBJECT (accessible),
accessible_private_data_quark,
priv);
if (GTK_IS_ACCESSIBLE (accessible)) {
nemo_icon_container_accessible_update_selection
(ATK_OBJECT (accessible));
container = NEMO_ICON_CONTAINER (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
g_signal_connect (G_OBJECT (container), "selection_changed",
G_CALLBACK (nemo_icon_container_accessible_selection_changed_cb),
accessible);
g_signal_connect (G_OBJECT (container), "icon_added",
G_CALLBACK (nemo_icon_container_accessible_icon_added_cb),
accessible);
g_signal_connect (G_OBJECT (container), "icon_removed",
G_CALLBACK (nemo_icon_container_accessible_icon_removed_cb),
accessible);
g_signal_connect (G_OBJECT (container), "cleared",
G_CALLBACK (nemo_icon_container_accessible_cleared_cb),
accessible);
}
} | false | false | false | false | false | 0 |
appendShortStringElement(const char *src, int32_t len, char *result, int32_t *resultSize, int32_t capacity, char arg)
{
if(len) {
if(*resultSize) {
if(*resultSize < capacity) {
uprv_strcat(result, "_");
}
(*resultSize)++;
}
*resultSize += len + 1;
if(*resultSize < capacity) {
uprv_strncat(result, &arg, 1);
uprv_strncat(result, src, len);
}
}
} | false | false | false | false | false | 0 |
text_name(PG_FUNCTION_ARGS)
{
text *s = PG_GETARG_TEXT_P(0);
Name result;
int len;
len = VARSIZE(s) - VARHDRSZ;
/* Truncate oversize input */
if (len >= NAMEDATALEN)
len = NAMEDATALEN - 1;
#ifdef STRINGDEBUG
printf("text- convert string length %d (%d) ->%d\n",
VARSIZE(s) - VARHDRSZ, VARSIZE(s), len);
#endif
result = (Name) palloc(NAMEDATALEN);
memcpy(NameStr(*result), VARDATA(s), len);
/* now null pad to full length... */
while (len < NAMEDATALEN)
{
*(NameStr(*result) + len) = '\0';
len++;
}
PG_RETURN_NAME(result);
} | false | false | false | false | true | 1 |
mono_security_manager_get_methods (void)
{
/* Already initialized ? */
if (secman.securitymanager)
return &secman;
/* Initialize */
secman.securitymanager = mono_class_from_name (mono_defaults.corlib,
"System.Security", "SecurityManager");
g_assert (secman.securitymanager);
if (!secman.securitymanager->inited)
mono_class_init (secman.securitymanager);
secman.demand = mono_class_get_method_from_name (secman.securitymanager,
"InternalDemand", 2);
g_assert (secman.demand);
secman.demandchoice = mono_class_get_method_from_name (secman.securitymanager,
"InternalDemandChoice", 2);
g_assert (secman.demandchoice);
secman.demandunmanaged = mono_class_get_method_from_name (secman.securitymanager,
"DemandUnmanaged", 0);
g_assert (secman.demandunmanaged);
secman.inheritancedemand = mono_class_get_method_from_name (secman.securitymanager,
"InheritanceDemand", 3);
g_assert (secman.inheritancedemand);
secman.inheritsecurityexception = mono_class_get_method_from_name (secman.securitymanager,
"InheritanceDemandSecurityException", 4);
g_assert (secman.inheritsecurityexception);
secman.linkdemand = mono_class_get_method_from_name (secman.securitymanager,
"LinkDemand", 3);
g_assert (secman.linkdemand);
secman.linkdemandunmanaged = mono_class_get_method_from_name (secman.securitymanager,
"LinkDemandUnmanaged", 1);
g_assert (secman.linkdemandunmanaged);
secman.linkdemandfulltrust = mono_class_get_method_from_name (secman.securitymanager,
"LinkDemandFullTrust", 1);
g_assert (secman.linkdemandfulltrust);
secman.linkdemandsecurityexception = mono_class_get_method_from_name (secman.securitymanager,
"LinkDemandSecurityException", 2);
g_assert (secman.linkdemandsecurityexception);
secman.allowpartiallytrustedcallers = mono_class_from_name (mono_defaults.corlib, "System.Security",
"AllowPartiallyTrustedCallersAttribute");
g_assert (secman.allowpartiallytrustedcallers);
secman.suppressunmanagedcodesecurity = mono_class_from_name (mono_defaults.corlib, "System.Security",
"SuppressUnmanagedCodeSecurityAttribute");
g_assert (secman.suppressunmanagedcodesecurity);
return &secman;
} | false | false | false | false | false | 0 |
bgav_mms_close(bgav_mms_t * mms)
{
FREE(mms->server_version);
FREE(mms->tool_version);
FREE(mms->update_url);
FREE(mms->password_encryption_type);
FREE(mms->packet_buffer);
FREE(mms->header);
if(mms->fd >= 0)
closesocket(mms->fd);
FREE(mms);
} | false | false | false | false | false | 0 |
ff_logv(const char * file, const char * func, int line, ft_log_level level, int err, const char * fmt, va_list vargs)
{
/*
* note 1.1)
* log subsystem is automatically initialized upon first call to
* ff_log(), ff_vlog(), ff_log_register() or ff_log_set_threshold().
*/
ft_log_event event = {
ff_strftime(), file, "", func, fmt,
0, line, err,
level,
/* va_list vargs */
};
ff_pretty_file(event);
ft_string logger_name(event.file, event.file_len);
ft_log & logger = ft_log::get_logger(logger_name);
ff_va_copy(event.vargs, vargs);
logger.log(event);
va_end(event.vargs);
/* note 1.2.1) ff_log() and ff_vlog() always return errors as reported (-EINVAL, -ENOMEM...) */
return ff_log_is_reported(err) ? err : -err;
} | false | false | false | false | false | 0 |
construct_DME_tree(DME_NODE * l, int lnum, DME_TREE_NODE **Troot){
if ( (*Troot) == NULL ){
(*Troot) = (DME_TREE_NODE *) malloc ( sizeof(DME_TREE_NODE)) ;
if ( (*Troot) == NULL){
printf(" mallock Error 1 \n");
exit(1);
}
}
(*Troot) -> capacitance = l -> capacitance ;
(*Troot) -> delay = l->to_sink_delay;
(*Troot) -> left_direction = l->left_direction;
(*Troot) -> right_direction = l->right_direction ;
(*Troot) -> duplicate_first_buf = l ->duplicate_first_buf ;
(*Troot) -> is_sink = l->sink_index;
(*Troot) ->sink_index = l ->sink_index ;
(*Troot) ->is_blk = l ->blockage_node ;
// (*Troot) ->delta_length_buf = l->delta_length_buf ;
(*Troot) -> first_buf_fraction = l ->first_buf_fraction ;
(*Troot) ->detour = 0 ;
//(*Troot) ->factor = source_node ->factor;
(*Troot) ->ls = (*Troot) -> rs = NULL;
(*Troot) ->fa = NULL;
(*Troot) ->buf_num = l->buf_num;
(*Troot) ->altitude = 0;
(*Troot) -> x = 0;
(*Troot) -> y = 0;
(*Troot) ->reduntant = 0 ;
(*Troot) ->is_fake = 0 ;
(*Troot) ->wire_type = l->wire_type;
add_DME_node(l->pleft,& ((*Troot)->ls), 0, 0,(*Troot));
} | false | false | false | false | false | 0 |
explorer_update_gui(Explorer *self) {
/* If the GUI needs updating, update it. This includes limiting the maximum
* update rate, updating the iteration count display, and actually rendering
* frames to the drawing area.
*/
/* If we have rendering changes we're trying to push through as quickly
* as possible, don't bother with the status bar or with frame rate limiting.
*/
if (HISTOGRAM_IMAGER(self->map)->render_dirty_flag) {
histogram_view_update(HISTOGRAM_VIEW(self->view));
return;
}
/* If we have an important status change to report, update both
* the status bar and the view without frame rate limiting.
*/
if (self->status_dirty_flag) {
explorer_update_status_bar(self);
histogram_view_update(HISTOGRAM_VIEW(self->view));
return;
}
/* Update the status bar at a fixed rate. This will give the user
* the impression that things are moving along steadily even when
* we're actually updating the view very slowly later in the render.
*/
if (!limit_update_rate(self->status_update_rate_timer, 2.0 )) {
explorer_update_status_bar(self);
}
/* Use our funky automatic frame rate adjuster to time normal view updates.
* This will slow down updates nonlinearly as rendering progresses,
* to give good interactive response while making batch rendering
* still fairly efficient.
*/
if (!explorer_auto_limit_update_rate(self)) {
histogram_view_update(HISTOGRAM_VIEW(self->view));
}
} | false | false | false | false | false | 0 |
rpgo(nodeid, loadtag, rtf, argvtag, pid, idx)
int4 nodeid;
int4 loadtag;
int4 rtf;
int4 argvtag;
int4 *pid;
int4 *idx;
{
char *cwd = 0;
int r;
if (rtf & RTF_CWD) {
if ((cwd = getworkdir()) == 0)
return(LAMERROR);
}
r = rpgov(nodeid, loadtag, rtf, argvtag, 0, cwd, -1, pid, idx);
if (cwd)
free(cwd);
return(r);
} | false | false | false | false | false | 0 |
add_objc_string (tree ident, string_section section)
{
tree *chain, decl, type;
char buf[BUFSIZE];
switch (section)
{
case class_names:
chain = &class_names_chain;
snprintf (buf, BUFSIZE, "_OBJC_ClassName_%s", IDENTIFIER_POINTER (ident));
break;
case meth_var_names:
chain = &meth_var_names_chain;
snprintf (buf, BUFSIZE, "_OBJC_METH_VAR_NAME_%d", meth_var_names_idx++);
break;
case meth_var_types:
chain = &meth_var_types_chain;
snprintf (buf, BUFSIZE, "_OBJC_METH_VAR_TYPE_%d", meth_var_types_idx++);
break;
case prop_names_attr:
chain = &prop_names_attr_chain;
snprintf (buf, BUFSIZE, "_OBJC_PropertyAttributeOrName_%d", property_name_attr_idx++);
break;
default:
gcc_unreachable ();
}
while (*chain)
{
if (TREE_VALUE (*chain) == ident)
return convert (string_type_node,
build_unary_op (input_location,
ADDR_EXPR, TREE_PURPOSE (*chain), 1));
chain = &TREE_CHAIN (*chain);
}
type = build_sized_array_type (char_type_node, IDENTIFIER_LENGTH (ident) + 1);
/* Get a runtime-specific string decl which will be finish_var()'ed in
generate_strings (). */
decl = (*runtime.string_decl) (type, buf, section);
TREE_CONSTANT (decl) = 1;
*chain = tree_cons (decl, ident, NULL_TREE);
return convert (string_type_node,
build_unary_op (input_location, ADDR_EXPR, decl, 1));
} | true | true | false | false | false | 1 |
smallestInAbsValue(double x1,double x2,double x3,double x4) const
{
double x=x1;
double xabs=fabs(x);
if(fabs(x2)<xabs) {
x=x2;
xabs=fabs(x2);
}
if(fabs(x3)<xabs) {
x=x3;
xabs=fabs(x3);
}
if(fabs(x4)<xabs) {
x=x4;
}
return x;
} | false | false | false | false | false | 0 |
mini_gc_init_gc_map (MonoCompile *cfg)
{
if (COMPILE_LLVM (cfg))
return;
if (!mono_gc_is_moving ())
return;
if (cfg->compile_aot) {
if (!enable_gc_maps_for_aot)
return;
} else if (!mono_gc_precise_stack_mark_enabled ())
return;
#if 1
/* Debugging support */
{
static int precise_count;
precise_count ++;
if (g_getenv ("MONO_GCMAP_COUNT")) {
if (precise_count == atoi (g_getenv ("MONO_GCMAP_COUNT")))
printf ("LAST: %s\n", mono_method_full_name (cfg->method, TRUE));
if (precise_count > atoi (g_getenv ("MONO_GCMAP_COUNT")))
return;
}
}
#endif
cfg->compute_gc_maps = TRUE;
cfg->gc_info = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoCompileGC));
} | false | false | false | false | true | 1 |
mv_u3d_build_trb_chain(struct mv_u3d_req *req, unsigned *length,
struct mv_u3d_trb *trb, int *is_last)
{
u32 temp;
unsigned int direction;
struct mv_u3d *u3d;
/* how big will this transfer be? */
*length = min(req->req.length - req->req.actual,
(unsigned)MV_U3D_EP_MAX_LENGTH_TRANSFER);
u3d = req->ep->u3d;
trb->trb_dma = 0;
/* initialize buffer page pointers */
temp = (u32)(req->req.dma + req->req.actual);
trb->trb_hw->buf_addr_lo = cpu_to_le32(temp);
trb->trb_hw->buf_addr_hi = 0;
trb->trb_hw->trb_len = cpu_to_le32(*length);
trb->trb_hw->ctrl.own = 1;
if (req->ep->ep_num == 0)
trb->trb_hw->ctrl.type = TYPE_DATA;
else
trb->trb_hw->ctrl.type = TYPE_NORMAL;
req->req.actual += *length;
direction = mv_u3d_ep_dir(req->ep);
if (direction == MV_U3D_EP_DIR_IN)
trb->trb_hw->ctrl.dir = 1;
else
trb->trb_hw->ctrl.dir = 0;
/* zlp is needed if req->req.zero is set */
if (req->req.zero) {
if (*length == 0 || (*length % req->ep->ep.maxpacket) != 0)
*is_last = 1;
else
*is_last = 0;
} else if (req->req.length == req->req.actual)
*is_last = 1;
else
*is_last = 0;
/* Enable interrupt for the last trb of a request */
if (*is_last && !req->req.no_interrupt)
trb->trb_hw->ctrl.ioc = 1;
if (*is_last)
trb->trb_hw->ctrl.chain = 0;
else {
trb->trb_hw->ctrl.chain = 1;
dev_dbg(u3d->dev, "chain trb\n");
}
wmb();
return 0;
} | false | false | false | false | false | 0 |
gst_frei0r_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
{
GstClockTime time;
GstFrei0rSrc *self = GST_FREI0R_SRC (bsrc);
segment->time = segment->start;
time = segment->last_stop;
/* now move to the time indicated */
if (self->fps_n) {
self->n_frames = gst_util_uint64_scale (time,
self->fps_n, self->fps_d * GST_SECOND);
} else {
self->n_frames = 0;
}
return TRUE;
} | false | false | false | false | false | 0 |
append_dns(DBusMessageIter *iter, void *user_data)
{
struct vpn_provider *provider = user_data;
if (provider->nameservers != NULL)
append_nameservers(iter, provider->nameservers);
} | false | false | false | false | false | 0 |
GetAsString () const
{
if (str.length () == 0) {
char *buf = gcu_value_get_string (&val);
const_cast<SimpleValue*> (this)->str = buf;
g_free (buf);
}
return str.c_str ();
} | false | false | false | false | false | 0 |
__lambda40_ (Block4Data* _data4_) {
ClocksAlarmMainPanel * self;
GtkWidget* _tmp0_ = NULL;
GtkWidget* _tmp1_ = NULL;
ClocksContentView* _tmp2_ = NULL;
self = _data4_->self;
_tmp0_ = gtk_stack_get_visible_child ((GtkStack*) self);
_tmp1_ = _tmp0_;
_tmp2_ = self->priv->content_view;
if (_tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GTK_TYPE_WIDGET, GtkWidget)) {
ClocksHeaderBar* _tmp3_ = NULL;
_tmp3_ = _data4_->header_bar;
clocks_header_bar_set_mode (_tmp3_, CLOCKS_HEADER_BAR_MODE_NORMAL);
} else {
GtkWidget* _tmp4_ = NULL;
GtkWidget* _tmp5_ = NULL;
ClocksAlarmRingingPanel* _tmp6_ = NULL;
_tmp4_ = gtk_stack_get_visible_child ((GtkStack*) self);
_tmp5_ = _tmp4_;
_tmp6_ = self->priv->ringing_panel;
if (_tmp5_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GTK_TYPE_WIDGET, GtkWidget)) {
ClocksHeaderBar* _tmp7_ = NULL;
_tmp7_ = _data4_->header_bar;
clocks_header_bar_set_mode (_tmp7_, CLOCKS_HEADER_BAR_MODE_STANDALONE);
}
}
} | false | false | false | false | false | 0 |
strip_array_types (tree type)
{
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
return type;
} | false | false | false | false | false | 0 |
remove_extent_backref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
struct btrfs_extent_inline_ref *iref,
int refs_to_drop, int is_data, int *last_ref)
{
int ret = 0;
BUG_ON(!is_data && refs_to_drop != 1);
if (iref) {
update_inline_extent_backref(root, path, iref,
-refs_to_drop, NULL, last_ref);
} else if (is_data) {
ret = remove_extent_data_ref(trans, root, path, refs_to_drop,
last_ref);
} else {
*last_ref = 1;
ret = btrfs_del_item(trans, root, path);
}
return ret;
} | false | false | false | false | false | 0 |
obj_free(void *p)
{
ei_reg_obj *obj = p;
if (obj) {
switch (ei_reg_typeof(obj)) {
case EI_STR:
free(obj->val.s);
break;
case EI_BIN:
free(obj->val.p);
break;
}
/* really remove the inode (don't use freelist here) */
free(obj);
}
return;
} | false | false | false | false | false | 0 |
makeMasters(QString & message) {
QList<ViewLayer::ViewLayerPlacement> layerSpecs;
layerSpecs << ViewLayer::NewBottom;
if (m_bothSidesNow) layerSpecs << ViewLayer::NewTop;
foreach (ViewLayer::ViewLayerPlacement viewLayerPlacement, layerSpecs) {
LayerList viewLayerIDs = m_sketchWidget->routingLayers(viewLayerPlacement);
RenderThing renderThing;
renderThing.printerScale = GraphicsUtils::SVGDPI;
renderThing.blackOnly = true;
renderThing.dpi = GraphicsUtils::StandardFritzingDPI;
renderThing.hideTerminalPoints = renderThing.selectedItems = renderThing.renderBlocker = false;
QString master = m_sketchWidget->renderToSVG(renderThing, m_board, viewLayerIDs);
if (master.isEmpty()) {
continue;
}
QDomDocument * masterDoc = new QDomDocument();
m_masterDocs.insert(viewLayerPlacement, masterDoc);
QString errorStr;
int errorLine;
int errorColumn;
if (!masterDoc->setContent(master, &errorStr, &errorLine, &errorColumn)) {
message = tr("Unexpected SVG rendering failure--contact fritzing.org");
return false;
}
ProcessEventBlocker::processEvents();
if (m_cancelled) {
message = CancelledMessage;
return false;
}
QDomElement root = masterDoc->documentElement();
SvgFileSplitter::forceStrokeWidth(root, 2 * m_keepoutMils, "#000000", true, true);
//QString forDebugging = masterDoc->toByteArray();
//DebugDialog::debug("master " + forDebugging);
}
return true;
} | false | false | false | false | false | 0 |
__kmod_module_fill_softdep(struct kmod_module *mod,
struct kmod_list **list)
{
struct kmod_list *pre = NULL, *post = NULL, *l;
int err;
err = kmod_module_get_softdeps(mod, &pre, &post);
if (err < 0) {
ERR(mod->ctx, "could not get softdep: %s\n",
strerror(-err));
goto fail;
}
kmod_list_foreach(l, pre) {
struct kmod_module *m = l->data;
err = __kmod_module_get_probe_list(m, false, list);
if (err < 0)
goto fail;
}
l = kmod_list_append(*list, kmod_module_ref(mod));
if (l == NULL) {
kmod_module_unref(mod);
err = -ENOMEM;
goto fail;
}
*list = l;
mod->ignorecmd = (pre != NULL || post != NULL);
kmod_list_foreach(l, post) {
struct kmod_module *m = l->data;
err = __kmod_module_get_probe_list(m, false, list);
if (err < 0)
goto fail;
}
fail:
kmod_module_unref_list(pre);
kmod_module_unref_list(post);
return err;
} | false | false | false | false | false | 0 |
max6642_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct max6642_data *data;
struct device *hwmon_dev;
data = devm_kzalloc(dev, sizeof(struct max6642_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->client = client;
mutex_init(&data->update_lock);
/* Initialize the MAX6642 chip */
max6642_init_client(data, client);
hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
client->name, data,
max6642_groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
} | false | false | false | false | false | 0 |
folderview_select_next_marked(FolderView *folderview)
{
GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
GtkCMCTreeNode *node = NULL;
EntryAction last_summary_select_prio = prefs_common.summary_select_prio[0];
gboolean last_open = prefs_common.always_show_msg;
prefs_common.summary_select_prio[0] = ACTION_MARKED;
prefs_common.always_show_msg = OPENMSG_ALWAYS;
if ((node = folderview_find_next_marked(ctree, folderview->opened))
!= NULL) {
folderview_select_node(folderview, node);
goto out;
}
if (!folderview->opened ||
folderview->opened == GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list)) {
goto out;
}
/* search again from the first node */
if ((node = folderview_find_next_marked(ctree, NULL)) != NULL)
folderview_select_node(folderview, node);
out:
prefs_common.summary_select_prio[0] = last_summary_select_prio;
prefs_common.always_show_msg = last_open;
} | false | false | false | false | false | 0 |
proxy_authproc(sasl_conn_t *conn,
void *context __attribute__((unused)),
const char *requested_user,
unsigned rlen __attribute__((unused)),
const char *auth_identity,
unsigned alen __attribute__((unused)),
const char *def_realm __attribute__((unused)),
unsigned urlen __attribute__((unused)),
struct propctx *propctx __attribute__((unused)))
{
if(!strcmp(auth_identity, authname)
&& !strcmp(requested_user, proxyasname)) return SASL_OK;
if(!strcmp(auth_identity, requested_user)) {
printf("Warning: Authenticated name but DID NOT proxy (%s/%s)\n",
requested_user, auth_identity);
return SASL_OK;
}
sasl_seterror(conn, SASL_NOLOG, "authorization failed: %s by %s",
requested_user, auth_identity);
return SASL_BADAUTH;
} | true | true | false | false | false | 1 |
GetLCDStructPtr661(struct SiS_Private *SiS_Pr)
{
unsigned char *ROMAddr = SiS_Pr->VirtualRomBase;
unsigned char *myptr = NULL;
unsigned short romindex = 0, reg = 0, idx = 0;
/* Use the BIOS tables only for LVDS panels; TMDS is unreliable
* due to the variaty of panels the BIOS doesn't know about.
* Exception: If the BIOS has better knowledge (such as in case
* of machines with a 301C and a panel that does not support DDC)
* use the BIOS data as well.
*/
if((SiS_Pr->SiS_ROMNew) &&
((SiS_Pr->SiS_VBType & VB_SISLVDS) || (!SiS_Pr->PanelSelfDetected))) {
if(SiS_Pr->ChipType < SIS_661) reg = 0x3c;
else reg = 0x7d;
idx = (SiS_GetReg(SiS_Pr->SiS_P3d4,reg) & 0x1f) * 26;
if(idx < (8*26)) {
myptr = (unsigned char *)&SiS_LCDStruct661[idx];
}
romindex = SISGETROMW(0x100);
if(romindex) {
romindex += idx;
myptr = &ROMAddr[romindex];
}
}
return myptr;
} | false | false | false | false | false | 0 |
httpHeaderDelByName(HttpHeader * hdr, const char *name)
{
int count = 0;
HttpHeaderPos pos = HttpHeaderInitPos;
HttpHeaderEntry *e;
httpHeaderMaskInit(&hdr->mask, 0); /* temporal inconsistency */
debug(55, 7) ("deleting '%s' fields in hdr %p\n", name, hdr);
while ((e = httpHeaderGetEntry(hdr, &pos))) {
if (!strCaseCmp(e->name, name)) {
httpHeaderDelAt(hdr, pos);
count++;
} else
CBIT_SET(hdr->mask, e->id);
}
return count;
} | false | false | false | false | false | 0 |
e_bindings_mapping_change_enable(Eina_Bool enable)
{
if (enable)
_e_bindings_mapping_change_enabled++;
else
_e_bindings_mapping_change_enabled--;
if (_e_bindings_mapping_change_enabled < 0)
_e_bindings_mapping_change_enabled = 0;
} | false | false | false | false | false | 0 |
nv01_gr_mthd_bind_clip(struct nvkm_device *device, u32 inst, u32 data)
{
switch (nv04_gr_mthd_bind_class(device, data)) {
case 0x30:
nv04_gr_set_ctx1(device, inst, 0x2000, 0);
return true;
case 0x19:
nv04_gr_set_ctx1(device, inst, 0x2000, 0x2000);
return true;
}
return false;
} | false | false | false | false | false | 0 |
ikrt_fl_less_or_equal(ikptr x, ikptr y){
if(flonum_data(x) <= flonum_data(y)){
return true_object;
} else {
return false_object;
}
} | false | false | false | false | false | 0 |
un_rpwfile(void)
{
unsigned cnt;
struct uhash *hp, *np;
if (!doneit) /* Nothing to undo */
return;
for (cnt = 0; cnt < HASHMOD; cnt++) {
for (hp = uhash[cnt]; hp; hp = np) {
np = hp->pwh_next;
if (hp->pwh_homed)
free(hp->pwh_homed);
free((char *) hp);
}
uhash[cnt] = unhash[cnt] = (struct uhash *) 0;
}
doneit = 0;
} | false | false | false | false | false | 0 |
iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
u8 sta_id)
{
struct iwl_link_quality_cmd *link_cmd;
link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL);
if (!link_cmd) {
IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
return NULL;
}
iwl_sta_fill_lq(priv, ctx, sta_id, link_cmd);
return link_cmd;
} | false | false | false | false | false | 0 |
parseDtor()
{
DtorDeclaration *f;
Loc loc = token.loc;
nextToken();
check(TOKthis);
check(TOKlparen);
check(TOKrparen);
StorageClass stc = parsePostfix();
f = new DtorDeclaration(loc, Loc(), stc, Id::dtor);
parseContracts(f);
return f;
} | false | false | false | false | false | 0 |
num_cached_ip(cmd_parms *parms, void *dummy,
const char *arg)
{
mod_config *cfg = (mod_config *)dummy;
ap_get_module_config(parms->server->module_config, &spamhaus_module);
int nInCache = atoi(arg);
cfg->nip_incache = nInCache;
if (cfg->nip_incache > MAX_CACHE_SIZE) cfg->nip_incache = MAX_CACHE_SIZE;
return NULL;
} | false | false | false | false | false | 0 |
echoMatterTextureSet(echoScene *scene, echoObject *obj, Nrrd *ntext) {
if (scene && obj && ntext && echoObjectHasMatter[obj->type] &&
3 == ntext->dim &&
nrrdTypeUChar == ntext->type &&
4 == ntext->axis[0].size) {
obj->ntext = ntext;
_echoSceneNrrdAdd(scene, ntext);
}
} | false | false | false | false | false | 0 |
camel_imapx_command_queue_insert_sorted (CamelIMAPXCommandQueue *queue,
CamelIMAPXCommand *ic)
{
g_return_if_fail (queue != NULL);
g_return_if_fail (CAMEL_IS_IMAPX_COMMAND (ic));
camel_imapx_command_ref (ic);
g_queue_insert_sorted (
(GQueue *) queue, ic, (GCompareDataFunc)
camel_imapx_command_compare, NULL);
} | false | false | false | false | false | 0 |
InsertCell(const int& partType, const int& cellType,
const vtkIdType& npts, vtkIdType conn[8])
{
//get the correct iterator from the array of iterations
if(this->CellInsertionIterators[partType].pIt->part)
{
//only insert the cell if the part is turned on
this->CellInsertionIterators[partType].pIt->part->AddCell(
cellType,npts,conn);
}
this->CellInsertionIterators[partType].inc();
} | false | false | false | false | false | 0 |
icon_dir_list_append(GList **list, icon_dir_t *dir)
{
g_assert(list != NULL && dir != NULL);
*list = g_list_insert_sorted(*list, dir, (GCompareFunc) icon_dir_compare);
} | false | false | false | false | false | 0 |
br_hidden_alloc (GGobiData * d)
{
gint i, nprev = d->hidden.nels;
vectorb_realloc (&d->hidden, d->nrows);
vectorb_realloc (&d->hidden_now, d->nrows);
vectorb_realloc (&d->hidden_prev, d->nrows);
/* initialize to not hidden */
for (i = nprev; i < d->nrows; i++)
d->hidden.els[i] = d->hidden_now.els[i] = d->hidden_prev.els[i] = 0;
} | false | false | false | false | false | 0 |
bnx2i_process_login_resp(struct iscsi_session *session,
struct bnx2i_conn *bnx2i_conn,
struct cqe *cqe)
{
struct iscsi_conn *conn = bnx2i_conn->cls_conn->dd_data;
struct iscsi_task *task;
struct bnx2i_login_response *login;
struct iscsi_login_rsp *resp_hdr;
int pld_len;
int pad_len;
login = (struct bnx2i_login_response *) cqe;
spin_lock(&session->lock);
task = iscsi_itt_to_task(conn,
login->itt & ISCSI_LOGIN_RESPONSE_INDEX);
if (!task)
goto done;
resp_hdr = (struct iscsi_login_rsp *) &bnx2i_conn->gen_pdu.resp_hdr;
memset(resp_hdr, 0, sizeof(struct iscsi_hdr));
resp_hdr->opcode = login->op_code;
resp_hdr->flags = login->response_flags;
resp_hdr->max_version = login->version_max;
resp_hdr->active_version = login->version_active;
resp_hdr->hlength = 0;
hton24(resp_hdr->dlength, login->data_length);
memcpy(resp_hdr->isid, &login->isid_lo, 6);
resp_hdr->tsih = cpu_to_be16(login->tsih);
resp_hdr->itt = task->hdr->itt;
resp_hdr->statsn = cpu_to_be32(login->stat_sn);
resp_hdr->exp_cmdsn = cpu_to_be32(login->exp_cmd_sn);
resp_hdr->max_cmdsn = cpu_to_be32(login->max_cmd_sn);
resp_hdr->status_class = login->status_class;
resp_hdr->status_detail = login->status_detail;
pld_len = login->data_length;
bnx2i_conn->gen_pdu.resp_wr_ptr =
bnx2i_conn->gen_pdu.resp_buf + pld_len;
pad_len = 0;
if (pld_len & 0x3)
pad_len = 4 - (pld_len % 4);
if (pad_len) {
int i = 0;
for (i = 0; i < pad_len; i++) {
bnx2i_conn->gen_pdu.resp_wr_ptr[0] = 0;
bnx2i_conn->gen_pdu.resp_wr_ptr++;
}
}
__iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr,
bnx2i_conn->gen_pdu.resp_buf,
bnx2i_conn->gen_pdu.resp_wr_ptr - bnx2i_conn->gen_pdu.resp_buf);
done:
spin_unlock(&session->lock);
return 0;
} | false | true | false | false | false | 1 |
getSint32(Sint32 &sintVal,
const unsigned long pos)
{
/* get integer string value */
OFString str;
OFCondition l_error = getOFString(str, pos, OFTrue);
if (l_error.good())
{
/* convert string to integer value */
#if SIZEOF_LONG == 8
if (sscanf(str.c_str(), "%d", &sintVal) != 1)
#else
if (sscanf(str.c_str(), "%ld", &sintVal) != 1)
#endif
l_error = EC_CorruptedData;
}
return l_error;
} | false | false | false | false | false | 0 |
decode_switches (int argc, char **argv)
{
int c;
/* If DEFAULT_PRINT is still true after processing all the options,
that means the default printing options should be used. */
bool default_print = true;
while ((c = getopt_long (argc, argv, "hip:v", long_options, NULL)) != -1) {
switch (c) {
case 'h':
usage (0);
case 'v':
version ();
case 'i':
options.indent = " ";
break;
case 'p':
decode_print_options (optarg);
default_print = false;
break;
default:
usage (1);
}
}
if (default_print)
default_options ();
} | false | false | false | false | false | 0 |
netlink_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
{
libc_func(bind, int, int, const struct sockaddr *, socklen_t);
struct sockaddr_un sa;
const char *path = getenv("UMOCKDEV_DIR");
if (fd_map_get(&wrapped_netlink_sockets, sockfd, NULL) && path != NULL) {
DBG("testbed wrapped bind: intercepting netlink socket fd %i\n", sockfd);
/* we create one socket per fd, and send emulated uevents to all of
* them; poor man's multicast; this can become more elegant if/when
* AF_UNIX multicast lands */
sa.sun_family = AF_UNIX;
snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/event%i", path, sockfd);
/* clean up from previously closed fds, to avoid "already in use" error */
unlink(sa.sun_path);
return _bind(sockfd, (struct sockaddr *)&sa, sizeof(sa));
}
return UNHANDLED;
} | false | false | false | false | true | 1 |
notify_uninit (void)
{
GList *l;
if (!_initted) {
return;
}
if (_app_name != NULL) {
g_free (_app_name);
_app_name = NULL;
}
for (l = _active_notifications; l != NULL; l = l->next) {
NotifyNotification *n = NOTIFY_NOTIFICATION (l->data);
if (_notify_notification_get_timeout (n) == 0 ||
_notify_notification_has_nondefault_actions (n)) {
notify_notification_close (n, NULL);
}
}
if (_proxy != NULL) {
g_object_unref (_proxy);
_proxy = NULL;
}
_initted = FALSE;
} | false | false | false | false | false | 0 |
vzt_wr_init(const char *name)
{
struct vzt_wr_trace *lt=(struct vzt_wr_trace *)calloc(1, sizeof(struct vzt_wr_trace));
if((!name)||(!(lt->handle=fopen(name, "wb"))))
{
free(lt);
lt=NULL;
}
else
{
lt->vztname = strdup(name);
vzt_wr_emit_u16(lt, VZT_WR_HDRID);
vzt_wr_emit_u16(lt, VZT_WR_VERSION);
vzt_wr_emit_u8 (lt, VZT_WR_GRANULE_SIZE); /* currently 32 */
lt->timescale = -9;
lt->maxgranule = VZT_WR_GRANULE_NUM;
lt->timetable = calloc(lt->maxgranule * VZT_WR_GRANULE_SIZE, sizeof(vzttime_t));
vzt_wr_set_compression_depth(lt, 4); /* set fast/loose compression depth, user can fix this any time after init */
lt->initial_value = 'x';
lt->multi_state = 1;
}
return(lt);
} | false | false | false | false | false | 0 |
init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
{
netsnmp_agent_session *asp = (netsnmp_agent_session *)
calloc(1, sizeof(netsnmp_agent_session));
if (asp == NULL) {
return NULL;
}
DEBUGMSGTL(("snmp_agent","agent_sesion %8p created\n", asp));
asp->session = session;
asp->pdu = snmp_clone_pdu(pdu);
asp->orig_pdu = snmp_clone_pdu(pdu);
asp->rw = READ;
asp->exact = TRUE;
asp->next = NULL;
asp->mode = RESERVE1;
asp->status = SNMP_ERR_NOERROR;
asp->index = 0;
asp->oldmode = 0;
asp->treecache_num = -1;
asp->treecache_len = 0;
asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p created\n",
asp, asp->reqinfo));
return asp;
} | false | false | false | false | false | 0 |
read_rats_db (const char *fname, FILE *fp)
{
dbwrapper *dw;
long forward = 0;
int i, err = 0;
gretl_error_clear();
/* get into position */
fseek(fp, 30L, SEEK_SET); /* skip unneeded fields */
if (fread(&forward, sizeof forward, 1, fp) == 1) {
fseek(fp, 4L, SEEK_CUR);
}
/* basic check */
if (forward <= 0) {
gretl_errmsg_set(_("This is not a valid RATS 4.0 database"));
fprintf(stderr, "rats database: got forward = %ld\n", forward);
return NULL;
}
/* allocate table for series rows */
dw = dbwrapper_new(0, fname, GRETL_RATS_DB);
if (dw == NULL) {
gretl_errmsg_set(_("Out of memory!"));
return NULL;
}
/* Go find the series */
i = 0;
while (forward && !err) {
dw->nv += 1;
#if DB_DEBUG
fprintf(stderr, "read_rats_db: forward = %d, nv = %d\n",
(int) forward, dw->nv);
#endif
if (dw->nv > 0 && dw->nv % DB_INIT_ROWS == 0) {
err = dbwrapper_expand(dw);
if (err) {
gretl_errmsg_set(_("Out of memory!"));
}
}
if (!err) {
err = fseek(fp, (forward - 1) * 256L, SEEK_SET);
if (!err) {
forward = read_rats_directory(fp, NULL, &dw->sinfo[i++]);
if (forward == RATS_PARSE_ERROR) {
err = 1;
}
}
}
#if DB_DEBUG
fprintf(stderr, "bottom of loop, err = %d\n", err);
#endif
}
#if DB_DEBUG
fprintf(stderr, "read_rats_db: err = %d, dw = %p\n",
err, (void *) dw);
#endif
if (err) {
dbwrapper_destroy(dw);
return NULL;
}
return dw;
} | false | false | false | false | false | 0 |
add_1(uint64_t dest[], uint64_t x[], unsigned len, uint64_t y) {
for (unsigned i = 0; i < len; ++i) {
dest[i] = y + x[i];
if (dest[i] < y)
y = 1; // Carry one to next digit.
else {
y = 0; // No need to carry so exit early
break;
}
}
return y;
} | false | false | false | false | false | 0 |
dma_get_slave_channel(struct dma_chan *chan)
{
int err = -EBUSY;
/* lock against __dma_request_channel */
mutex_lock(&dma_list_mutex);
if (chan->client_count == 0) {
struct dma_device *device = chan->device;
dma_cap_set(DMA_PRIVATE, device->cap_mask);
device->privatecnt++;
err = dma_chan_get(chan);
if (err) {
pr_debug("%s: failed to get %s: (%d)\n",
__func__, dma_chan_name(chan), err);
chan = NULL;
if (--device->privatecnt == 0)
dma_cap_clear(DMA_PRIVATE, device->cap_mask);
}
} else
chan = NULL;
mutex_unlock(&dma_list_mutex);
return chan;
} | false | false | false | false | false | 0 |
reset_city_dialogs(void)
{
if (!city_dialogs_have_been_initialised) {
return;
}
init_citydlg_dimensions();
dialog_list_iterate(dialog_list, pdialog) {
/* There's no reasonable way to resize a GtkPixcomm, so we don't try.
Instead we just redraw the overview within the existing area. The
player has to close and reopen the dialog to fix this. */
city_dialog_update_map(pdialog);
} dialog_list_iterate_end;
popdown_all_city_dialogs();
} | false | false | false | false | false | 0 |
on_treeview_row_collapsed(GtkWidget *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
{
gchar *uri;
gtk_tree_model_get(GTK_TREE_MODEL(treestore), iter, TREEBROWSER_COLUMN_URI, &uri, -1);
if (uri == NULL)
return;
if (CONFIG_SHOW_ICONS)
{
GdkPixbuf *icon = utils_pixbuf_from_stock(GTK_STOCK_DIRECTORY);
gtk_tree_store_set(treestore, iter, TREEBROWSER_COLUMN_ICON, icon, -1);
g_object_unref(icon);
}
g_free(uri);
} | false | false | false | false | false | 0 |
ss_init(ss_context *ctx, FILE *handle)
{
if (NULL == ctx)
return TRUE;
ctx->ret = (char *)malloc(sizeof(char) * FUZZY_MAX_RESULT);
if (ctx->ret == NULL)
return TRUE;
if (handle != NULL)
ctx->total_chars = find_file_size(handle);
ctx->block_size = MIN_BLOCKSIZE;
while (ctx->block_size * SPAMSUM_LENGTH < ctx->total_chars) {
ctx->block_size = ctx->block_size * 2;
}
return FALSE;
} | false | false | false | false | false | 0 |
__ecereNameSpace__ecere__gfx3D__models__ReadCamera(struct __ecereNameSpace__ecere__gfx3D__models__FileInfo * info, struct __ecereNameSpace__ecere__com__Instance * object)
{
struct __ecereNameSpace__ecere__gfx3D__Mesh * mesh = __ecereProp___ecereNameSpace__ecere__gfx3D__Object_Get_mesh(object);
switch((*info).chunkId)
{
case 18192:
{
break;
}
case 18208:
{
struct __ecereNameSpace__ecere__com__Instance * camera = __ecereProp___ecereNameSpace__ecere__gfx3D__Object_Get_camera(object);
float nearRange = __ecereNameSpace__ecere__gfx3D__models__ReadFloat((*info).f);
float farRange = __ecereNameSpace__ecere__gfx3D__models__ReadFloat((*info).f);
break;
}
}
return 0x1;
} | false | false | false | false | false | 0 |
enable_random(PyObject *self, PyObject *args)
{
char *name;
int failnum;
PyObject *failinfo;
unsigned int flags;
double probability;
if (!PyArg_ParseTuple(args, "siOId:enable_random", &name, &failnum,
&failinfo, &flags, &probability))
return NULL;
/* See failinfo()'s comment regarding failinfo's RC */
return PyLong_FromLong(fiu_enable_random(name, failnum, failinfo,
flags, probability));
} | false | false | false | false | false | 0 |
lrpo(Term s, Term t, BOOL lex_order_vars)
{
if (VARIABLE(s)) {
if (lex_order_vars)
return VARIABLE(t) && VARNUM(s) > VARNUM(t);
else
return FALSE;
}
else if (VARIABLE(t)) {
if (lex_order_vars)
return TRUE;
else
return occurs_in(t, s); /* s > var iff s properly contains that var */
}
else if (SYMNUM(s) == SYMNUM(t) &&
sn_to_lrpo_status(SYMNUM(s)) == LRPO_LR_STATUS)
/* both have the same "left-to-right" symbol. */
return lrpo_lex(s, t, lex_order_vars);
else {
Ordertype p = sym_precedence(SYMNUM(s), SYMNUM(t));
if (p == SAME_AS)
return lrpo_multiset(s, t, lex_order_vars);
else if (p == GREATER_THAN) {
/* return (s > each arg of t) */
int i;
BOOL ok;
for (ok = TRUE, i = 0; ok && i < ARITY(t); i++)
ok = lrpo(s, ARG(t,i), lex_order_vars);
return ok;
}
else { /* LESS_THAN or NOT_COMPARABLE */
/* return (there is an arg of s s.t. arg >= t) */
int i;
BOOL ok;
for (ok = FALSE, i = 0; !ok && i < ARITY(s); i++)
ok = term_ident(ARG(s,i), t) || lrpo(ARG(s,i), t, lex_order_vars);
return ok;
}
}
} | false | false | false | false | false | 0 |
fso_framework_serial_transport_real_open (FsoFrameworkTransport* base) {
FsoFrameworkSerialTransport * self;
gboolean result = FALSE;
const gchar* _tmp0_ = NULL;
gint _tmp1_ = 0;
gint _tmp2_ = 0;
gboolean _tmp9_ = FALSE;
gboolean _tmp10_ = FALSE;
self = (FsoFrameworkSerialTransport*) base;
_tmp0_ = ((FsoFrameworkBaseTransport*) self)->name;
_tmp1_ = open (_tmp0_, (O_RDWR | O_NOCTTY) | O_NONBLOCK, (mode_t) 0);
((FsoFrameworkBaseTransport*) self)->fd = _tmp1_;
_tmp2_ = ((FsoFrameworkBaseTransport*) self)->fd;
if (_tmp2_ == (-1)) {
FsoFrameworkLogger* _tmp3_ = NULL;
const gchar* _tmp4_ = NULL;
gint _tmp5_ = 0;
const gchar* _tmp6_ = NULL;
gchar* _tmp7_ = NULL;
gchar* _tmp8_ = NULL;
_tmp3_ = ((FsoFrameworkTransport*) self)->logger;
_tmp4_ = ((FsoFrameworkBaseTransport*) self)->name;
_tmp5_ = errno;
_tmp6_ = strerror (_tmp5_);
_tmp7_ = g_strdup_printf ("could not open %s: %s", _tmp4_, _tmp6_);
_tmp8_ = _tmp7_;
fso_framework_logger_warning (_tmp3_, _tmp8_);
_g_free0 (_tmp8_);
result = FALSE;
return result;
}
fso_framework_base_transport_configure ((FsoFrameworkBaseTransport*) self);
_tmp9_ = self->dtr_cycle;
if (_tmp9_) {
fso_framework_serial_transport_set_dtr (self, FALSE);
sleep ((guint) 1);
fso_framework_serial_transport_set_dtr (self, TRUE);
}
_tmp10_ = FSO_FRAMEWORK_TRANSPORT_CLASS (fso_framework_serial_transport_parent_class)->open ((FsoFrameworkTransport*) G_TYPE_CHECK_INSTANCE_CAST (self, FSO_FRAMEWORK_TYPE_BASE_TRANSPORT, FsoFrameworkBaseTransport));
result = _tmp10_;
return result;
} | false | false | false | false | false | 0 |
gsicc_get_gscs_profile(gs_color_space *gs_colorspace,
gsicc_manager_t *icc_manager)
{
cmm_profile_t *profile = gs_colorspace->cmm_icc_profile_data;
gs_color_space_index color_space_index =
gs_color_space_get_index(gs_colorspace);
int code;
bool islab;
if (profile != NULL )
return(profile);
/* else, return the default types */
switch( color_space_index ) {
case gs_color_space_index_DeviceGray:
return(icc_manager->default_gray);
break;
case gs_color_space_index_DeviceRGB:
return(icc_manager->default_rgb);
break;
case gs_color_space_index_DeviceCMYK:
return(icc_manager->default_cmyk);
break;
/* Only used in 3x types */
case gs_color_space_index_DevicePixel:
return 0;
break;
case gs_color_space_index_DeviceN:
/* If we made it to here, then we will need to use the
alternate colorspace */
return 0;
break;
case gs_color_space_index_CIEDEFG:
/* For now just use default CMYK to avoid segfault. MJV to fix */
gs_colorspace->cmm_icc_profile_data = icc_manager->default_cmyk;
rc_increment(icc_manager->default_cmyk);
return(gs_colorspace->cmm_icc_profile_data);
/* Need to convert to an ICC form */
break;
case gs_color_space_index_CIEDEF:
/* For now just use default RGB to avoid segfault. MJV to fix */
gs_colorspace->cmm_icc_profile_data = icc_manager->default_rgb;
rc_increment(icc_manager->default_rgb);
return(gs_colorspace->cmm_icc_profile_data);
/* Need to convert to an ICC form */
break;
case gs_color_space_index_CIEABC:
gs_colorspace->cmm_icc_profile_data =
gsicc_profile_new(NULL, icc_manager->memory, NULL, 0);
code =
gsicc_create_fromabc(gs_colorspace,
&(gs_colorspace->cmm_icc_profile_data->buffer),
&(gs_colorspace->cmm_icc_profile_data->buffer_size),
icc_manager->memory,
&(gs_colorspace->params.abc->caches.DecodeABC.caches[0]),
&(gs_colorspace->params.abc->common.caches.DecodeLMN[0]),
&islab);
if (islab) {
/* Destroy the profile */
rc_decrement(gs_colorspace->cmm_icc_profile_data,
"gsicc_get_gscs_profile");
/* This may be an issue for pdfwrite */
return(icc_manager->lab_profile);
}
gs_colorspace->cmm_icc_profile_data->default_match = CIE_ABC;
return(gs_colorspace->cmm_icc_profile_data);
break;
case gs_color_space_index_CIEA:
gs_colorspace->cmm_icc_profile_data =
gsicc_profile_new(NULL, icc_manager->memory, NULL, 0);
code =
gsicc_create_froma(gs_colorspace,
&(gs_colorspace->cmm_icc_profile_data->buffer),
&(gs_colorspace->cmm_icc_profile_data->buffer_size),
icc_manager->memory,
&(gs_colorspace->params.a->caches.DecodeA),
&(gs_colorspace->params.a->common.caches.DecodeLMN[0]));
gs_colorspace->cmm_icc_profile_data->default_match = CIE_A;
return(gs_colorspace->cmm_icc_profile_data);
break;
case gs_color_space_index_Separation:
/* Caller should use named color path */
return(0);
break;
case gs_color_space_index_Pattern:
case gs_color_space_index_Indexed:
/* Caller should use the base space for these */
return(0);
break;
case gs_color_space_index_ICC:
/* This should not occur, as the space
should have had a populated profile handle */
return(0);
break;
}
return(0);
} | false | false | false | false | false | 0 |
printOneChildRepr(raw_ostream &OS, const void *Ptr,
NodeKind Kind) const {
switch (Kind) {
case Twine::NullKind:
OS << "null"; break;
case Twine::EmptyKind:
OS << "empty"; break;
case Twine::TwineKind:
OS << "rope:";
static_cast<const Twine*>(Ptr)->printRepr(OS);
break;
case Twine::CStringKind:
OS << "cstring:\""
<< static_cast<const char*>(Ptr) << "\"";
break;
case Twine::StdStringKind:
OS << "std::string:\""
<< static_cast<const std::string*>(Ptr) << "\"";
break;
case Twine::StringRefKind:
OS << "stringref:\""
<< static_cast<const StringRef*>(Ptr) << "\"";
break;
case Twine::DecUIKind:
OS << "decUI:\"" << (unsigned)(uintptr_t)Ptr << "\"";
break;
case Twine::DecIKind:
OS << "decI:\"" << (int)(intptr_t)Ptr << "\"";
break;
case Twine::DecULKind:
OS << "decUL:\"" << *static_cast<const unsigned long*>(Ptr) << "\"";
break;
case Twine::DecLKind:
OS << "decL:\"" << *static_cast<const long*>(Ptr) << "\"";
break;
case Twine::DecULLKind:
OS << "decULL:\"" << *static_cast<const unsigned long long*>(Ptr) << "\"";
break;
case Twine::DecLLKind:
OS << "decLL:\"" << *static_cast<const long long*>(Ptr) << "\"";
break;
case Twine::UHexKind:
OS << "uhex:\"" << static_cast<const uint64_t*>(Ptr) << "\"";
break;
}
} | false | false | false | false | false | 0 |
printing_page_setup(GtkWindow *parent)
{
GtkPageSetup *new_page_setup;
char *keyfile;
keyfile = NULL;
printing_get_settings();
printing_get_page_setup();
new_page_setup = gtk_print_run_page_setup_dialog(parent,page_setup,settings);
if (page_setup)
g_object_unref(page_setup);
page_setup = new_page_setup;
g_free(prefs_common.print_paper_type);
prefs_common.print_paper_type = g_strdup(gtk_paper_size_get_name(
gtk_page_setup_get_paper_size(page_setup)));
prefs_common.print_paper_orientation = gtk_page_setup_get_orientation(page_setup);
/* store 100th millimeters */
prefs_common.print_margin_top = (int) (100*gtk_page_setup_get_top_margin(page_setup,
PAGE_MARGIN_STORAGE_UNIT));
prefs_common.print_margin_bottom = (int) (100*gtk_page_setup_get_bottom_margin(page_setup,
PAGE_MARGIN_STORAGE_UNIT));
prefs_common.print_margin_left = (int) (100*gtk_page_setup_get_left_margin(page_setup,
PAGE_MARGIN_STORAGE_UNIT));
prefs_common.print_margin_right = (int) (100*gtk_page_setup_get_right_margin(page_setup,
PAGE_MARGIN_STORAGE_UNIT));
/* save to file */
keyfile = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
PRINTING_PAGE_SETUP_STORAGE_FILE, NULL);
if (!gtk_page_setup_to_file(page_setup, keyfile, NULL)) {
debug_print("Printing: Could not store page setup in file `%s'\n", keyfile);
}
g_free(keyfile);
} | false | false | false | false | false | 0 |
set_article_to_buffer()
{
std::list< Gtk::TreeModel::iterator > list_it = m_treeview.get_selected_iterators();
if( list_it.size() ){
CORE::DATA_INFO_LIST list_info;
Gtk::TreePath path( "0" );
std::list< Gtk::TreeModel::iterator >::iterator it = list_it.begin();
for( ; it != list_it.end(); ++it ){
Gtk::TreeModel::Row row = *( *it );
DBTREE::ArticleBase *art = row[ m_columns.m_col_article ];
const Glib::ustring name = row[ m_columns.m_col_subject ];
CORE::DATA_INFO info;
info.type = TYPE_THREAD;
info.parent = BOARD::get_admin()->get_win();
info.url = art->get_url();
info.name = name.raw();
info.path = path.to_string();
list_info.push_back( info );
#ifdef _DEBUG
std::cout << "append " << info.name << std::endl;
#endif
path.next();
}
CORE::SBUF_set_list( list_info );
}
} | false | false | false | false | false | 0 |
gfs2_ail1_empty(struct gfs2_sbd *sdp)
{
struct gfs2_trans *tr, *s;
int oldest_tr = 1;
int ret;
spin_lock(&sdp->sd_ail_lock);
list_for_each_entry_safe_reverse(tr, s, &sdp->sd_ail1_list, tr_list) {
gfs2_ail1_empty_one(sdp, tr);
if (list_empty(&tr->tr_ail1_list) && oldest_tr)
list_move(&tr->tr_list, &sdp->sd_ail2_list);
else
oldest_tr = 0;
}
ret = list_empty(&sdp->sd_ail1_list);
spin_unlock(&sdp->sd_ail_lock);
return ret;
} | false | false | false | false | false | 0 |
power_var_int(NumericVar *base, int exp, NumericVar *result, int rscale)
{
bool neg;
NumericVar base_prod;
int local_rscale;
switch (exp)
{
case 0:
/*
* While 0 ^ 0 can be either 1 or indeterminate (error), we treat
* it as 1 because most programming languages do this. SQL:2003
* also requires a return value of 1.
* http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_pow
* er
*/
set_var_from_var(&const_one, result);
result->dscale = rscale; /* no need to round */
return;
case 1:
set_var_from_var(base, result);
round_var(result, rscale);
return;
case -1:
div_var(&const_one, base, result, rscale, true);
return;
case 2:
mul_var(base, base, result, rscale);
return;
default:
break;
}
/*
* The general case repeatedly multiplies base according to the bit
* pattern of exp. We do the multiplications with some extra precision.
*/
neg = (exp < 0);
exp = Abs(exp);
local_rscale = rscale + MUL_GUARD_DIGITS * 2;
init_var(&base_prod);
set_var_from_var(base, &base_prod);
if (exp & 1)
set_var_from_var(base, result);
else
set_var_from_var(&const_one, result);
while ((exp >>= 1) > 0)
{
mul_var(&base_prod, &base_prod, &base_prod, local_rscale);
if (exp & 1)
mul_var(&base_prod, result, result, local_rscale);
}
free_var(&base_prod);
/* Compensate for input sign, and round to requested rscale */
if (neg)
div_var_fast(&const_one, result, result, rscale, true);
else
round_var(result, rscale);
} | false | false | false | false | false | 0 |
print_insn_with_notes (pretty_printer *pp, const_rtx x)
{
pp_string (pp, print_rtx_head);
print_insn (pp, x, 1);
pp_newline (pp);
if (INSN_P (x) && REG_NOTES (x))
for (rtx note = REG_NOTES (x); note; note = XEXP (note, 1))
{
pp_printf (pp, "%s %s ", print_rtx_head,
GET_REG_NOTE_NAME (REG_NOTE_KIND (note)));
print_pattern (pp, XEXP (note, 0), 1);
pp_newline (pp);
}
} | false | false | false | false | false | 0 |
find_simplerepeats(ESL_GETOPTS *go, FILE *ofp, P7_HMM *hmm)
{
int i, j;
int status;
int max_repeat_len = 5;
int min_repeat_cnt = 4;
int min_rep_len = 25;
int min_tot_len = 50;
float relent_thresh = 1.5;
P7_HMM_WINDOWLIST *windowlist;
ESL_ALLOC(windowlist, sizeof(P7_HMM_WINDOWLIST));
p7_hmmwindow_init(windowlist);
p7_hmm_GetSimpleRepeats(hmm, max_repeat_len, min_repeat_cnt, min_rep_len, relent_thresh, windowlist);
if (windowlist->count > 1) qsort(windowlist->windows, windowlist->count, sizeof(P7_HMM_WINDOW), repeat_sorter);
//merge neighboring windows
j = 0;
for (i=1; i<windowlist->count; i++) {
if (windowlist->windows[i].n < windowlist->windows[j].n + windowlist->windows[j].length + max_repeat_len ) {
windowlist->windows[j].length = (windowlist->windows[i].n+windowlist->windows[i].length)-windowlist->windows[j].n;
} else {
j++;
windowlist->windows[j].n = windowlist->windows[i].n;
windowlist->windows[j].length = windowlist->windows[i].length;
}
}
windowlist->count = j+1;
//print repeat ranges, if sufficiently long
fprintf(ofp, "Position ranges for simple repeats\n");
for (i=0; i<windowlist->count; i++) {
if (windowlist->windows[i].length >= min_tot_len) {
fprintf(ofp, "%d .. %d\n",windowlist->windows[i].n - min_rep_len, windowlist->windows[i].n - min_rep_len + windowlist->windows[i].length - 1 );
}
}
ERROR:
if (windowlist != NULL) free(windowlist);
} | false | false | false | false | false | 0 |
APar_FlagMovieHeader() {
if (movie_header_atom == NULL) movie_header_atom = APar_FindAtom("moov.mvhd", false, VERSIONED_ATOM, 0);
if (movie_header_atom == NULL) return;
if (movie_header_atom != NULL) movie_header_atom->ancillary_data = 0x666C6167;
return;
} | false | false | false | false | false | 0 |
save_locale(struct augeas *aug) {
if (aug->c_locale == NULL) {
aug->c_locale = newlocale(LC_ALL_MASK, "C", NULL);
ERR_NOMEM(aug->c_locale == NULL, aug);
}
aug->user_locale = uselocale(aug->c_locale);
error:
return;
} | false | false | false | false | false | 0 |
write_PCSNumber(icc *icp, icColorSpaceSignature csig, double pcs[3], char *p) {
double v[3];
int j;
if (csig == icmSigPCSData)
csig = icp->header->pcs;
if (csig == icSigLabData) {
if (icp->ver != 0)
csig = icmSigLabV4Data;
else
csig = icmSigLabV2Data;
}
switch (csig) {
case icSigXYZData:
Lut_XYZ2Lut(v, pcs);
break;
case icmSigLab8Data:
Lut_Lab2Lut_8(v, pcs);
break;
case icmSigLabV2Data:
Lut_Lab2LutV2_16(v, pcs);
break;
case icmSigLabV4Data:
Lut_Lab2LutV4_16(v, pcs);
break;
default:
return 1;
}
if (csig == icmSigLab8Data) {
for (j = 0; j < 3; j++) {
if (write_DCS8Number(v[j], p+j))
return 1;
}
} else {
for (j = 0; j < 3; j++) {
if (write_DCS16Number(v[j], p+(2 * j)))
return 1;
}
}
return 0;
} | false | false | false | false | false | 0 |
gkrellm_plugin_cancel_label(GkrellmMonitor *mon_plugin, gint id)
{
GList *list;
ExportLabel *el;
if (!mon_plugin || id < 1)
return;
for (list = export_label_list; list; list = list->next)
{
el = (ExportLabel *) list->data;
if (el->id == id)
{
export_label_list = g_list_remove(export_label_list, el);
g_free(el);
break;
}
}
} | false | false | false | false | false | 0 |
DumpDebug(const Proto* f, DumpState* D)
{
int i,n;
DumpString((D->strip) ? NULL : f->source,D);
n= (D->strip) ? 0 : f->sizelineinfo;
DumpVector(f->lineinfo,n,sizeof(int),D);
n= (D->strip) ? 0 : f->sizelocvars;
DumpInt(n,D);
for (i=0; i<n; i++)
{
DumpString(f->locvars[i].varname,D);
DumpInt(f->locvars[i].startpc,D);
DumpInt(f->locvars[i].endpc,D);
}
n= (D->strip) ? 0 : f->sizeupvalues;
DumpInt(n,D);
for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D);
} | false | false | false | false | false | 0 |
cmd_and(void)
{
double tmpnum = popnum();
top()->num = top()->num && tmpnum;
} | false | false | false | false | false | 0 |
e_web_view_new_activity (EWebView *web_view)
{
EActivity *activity;
EAlertSink *alert_sink;
GCancellable *cancellable;
g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
activity = e_activity_new ();
alert_sink = E_ALERT_SINK (web_view);
e_activity_set_alert_sink (activity, alert_sink);
cancellable = g_cancellable_new ();
e_activity_set_cancellable (activity, cancellable);
g_object_unref (cancellable);
g_signal_emit (web_view, signals[NEW_ACTIVITY], 0, activity);
return activity;
} | false | false | false | false | false | 0 |
cluster_generic(struct Client *source_p, const char *command, int cltype, const char *format, ...)
{
char buffer[BUFSIZE];
struct remote_conf *shared_p;
va_list args;
rb_dlink_node *ptr;
va_start(args, format);
rb_vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
RB_DLINK_FOREACH(ptr, cluster_conf_list.head)
{
shared_p = ptr->data;
if(!(shared_p->flags & cltype))
continue;
sendto_match_servs(source_p, shared_p->server, CAP_ENCAP, NOCAPS,
"ENCAP %s %s %s", shared_p->server, command, buffer);
}
} | true | true | false | false | false | 1 |
mytunetsvc_config_file()
{
if(strcmp(szConfigFile, "NULL") == 0)
return NULL;
#ifdef _WIN32
if(szConfigFile[0] == 0)
{
GetWindowsDirectory(szConfigFile, sizeof(szConfigFile));
lstrcat(szConfigFile, "\\mytunetsvc.ini");
}
#endif
#ifdef _POSIX
if(szConfigFile[0] == 0)
{
strcpy(szConfigFile, "/etc/mytunet.conf");
}
#endif
return szConfigFile;
} | false | false | false | false | false | 0 |
alloc_group_attrs(ssize_t (*show)(struct ib_port *,
struct port_attribute *, char *buf),
int len)
{
struct attribute **tab_attr;
struct port_table_attribute *element;
int i;
tab_attr = kcalloc(1 + len, sizeof(struct attribute *), GFP_KERNEL);
if (!tab_attr)
return NULL;
for (i = 0; i < len; i++) {
element = kzalloc(sizeof(struct port_table_attribute),
GFP_KERNEL);
if (!element)
goto err;
if (snprintf(element->name, sizeof(element->name),
"%d", i) >= sizeof(element->name)) {
kfree(element);
goto err;
}
element->attr.attr.name = element->name;
element->attr.attr.mode = S_IRUGO;
element->attr.show = show;
element->index = i;
sysfs_attr_init(&element->attr.attr);
tab_attr[i] = &element->attr.attr;
}
return tab_attr;
err:
while (--i >= 0)
kfree(tab_attr[i]);
kfree(tab_attr);
return NULL;
} | false | false | false | false | false | 0 |
operator()(int m, int n)
{
REPORT
if (n<=0 || m!=n || m>nrows_val || n>ncols_val)
Throw(IndexException(m,n,*this));
return store[n-1];
} | false | false | false | false | false | 0 |
considerSupr(const AttributeList &atts,
const AttributeList *linkAtts,
unsigned &thisSuppressFlags,
unsigned &newSuppressFlags,
Boolean &inhibitCache,
unsigned &arcSuprIndex)
{
arcSuprIndex = invalidAtt;
if (thisSuppressFlags & suppressSupr)
return;
if (!supportAtts_[rArcSuprA].size())
return;
const AttributeValue *val;
unsigned tem;
if (linkAtts && linkAtts->attributeIndex(supportAtts_[rArcSuprA], tem))
val = linkAtts->value(tem);
else if (atts.attributeIndex(supportAtts_[rArcSuprA], arcSuprIndex)) {
if (atts.current(arcSuprIndex) || atts.specified(arcSuprIndex))
inhibitCache = 1;
val = atts.value(arcSuprIndex);
}
else
return;
if (!val)
return;
const Text *textP = val->text();
if (!textP)
return;
StringC token = textP->string();
// FIXME trim spaces
docSyntax_->generalSubstTable()->subst(token);
// sArcForm suppress processing for all elements except
// those that have a non-implied ArcSupr attribute.
thisSuppressFlags &= ~suppressForm;
newSuppressFlags &= ~(suppressForm|suppressSupr);
if (matchName(token, "sArcForm"))
newSuppressFlags |= suppressForm;
#if 0
// I don't think this is useful
else if (matchName(token, "sArcSupr"))
newSuppressFlags |= suppressSupr;
#endif
else if (matchName(token, "sArcAll"))
newSuppressFlags |= (suppressSupr|suppressForm);
else if (!matchName(token, "sArcNone")) {
Messenger::setNextLocation(textP->charLocation(0));
Messenger::message(ArcEngineMessages::invalidSuppress,
StringMessageArg(token));
}
} | false | false | false | false | false | 0 |
initiate_automaton_gen (argc, argv)
int argc;
char **argv;
{
const char *base_name;
int i;
ndfa_flag = 0;
split_argument = 0; /* default value */
no_minimization_flag = 0;
time_flag = 0;
v_flag = 0;
w_flag = 0;
for (i = 2; i < argc; i++)
if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0)
no_minimization_flag = 1;
else if (strcmp (argv [i], TIME_OPTION) == 0)
time_flag = 1;
else if (strcmp (argv [i], V_OPTION) == 0)
v_flag = 1;
else if (strcmp (argv [i], W_OPTION) == 0)
w_flag = 1;
else if (strcmp (argv [i], NDFA_OPTION) == 0)
ndfa_flag = 1;
else if (strcmp (argv [i], "-split") == 0)
{
if (i + 1 >= argc)
fatal ("-split has no argument.");
fatal ("option `-split' has not been implemented yet\n");
/* split_argument = atoi (argument_vect [i + 1]); */
}
VLA_PTR_CREATE (decls, 150, "decls");
/* Initialize IR storage. */
obstack_init (&irp);
initiate_automaton_decl_table ();
initiate_insn_decl_table ();
initiate_decl_table ();
output_file = stdout;
output_description_file = NULL;
base_name = base_file_name (argv[1]);
obstack_grow (&irp, base_name,
strlen (base_name) - strlen (file_name_suffix (base_name)));
obstack_grow (&irp, STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX,
strlen (STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX) + 1);
obstack_1grow (&irp, '\0');
output_description_file_name = obstack_base (&irp);
obstack_finish (&irp);
} | false | false | false | false | false | 0 |
inputbyte(byte a)
{
if (setbyte(a)) {
(*curchar)++;
correct_viewpoint();
is_virgin = false;
return true;
}
return false;
} | false | false | false | false | false | 0 |
_internal_get_from_bb_string_alloc (xmmsv_t *bb, char **buf,
unsigned int *len)
{
char *str;
int32_t l;
if (!_internal_get_from_bb_int32_positive (bb, &l)) {
return false;
}
str = x_malloc (l + 1);
if (!str) {
return false;
}
if (!_internal_get_from_bb_data (bb, str, l)) {
free (str);
return false;
}
str[l] = '\0';
*buf = str;
*len = l;
return true;
} | false | false | false | false | false | 0 |
ccbaWriteSVGString(const char *filename,
CCBORDA *ccba)
{
char *svgstr;
char smallbuf[256];
char line0[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
char line1[] = "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20000303 Stylable//EN\" \"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd\">";
char line2[] = "<svg>";
char line3[] = "<polygon style=\"stroke-width:1;stroke:black;\" points=\"";
char line4[] = "\" />";
char line5[] = "</svg>";
l_int32 i, j, ncc, npt, x, y;
CCBORD *ccb;
PTA *pta;
SARRAY *sa;
PROCNAME("ccbaWriteSVGString");
if (!filename)
return (char *)ERROR_PTR("filename not defined", procName, NULL);
if (!ccba)
return (char *)ERROR_PTR("ccba not defined", procName, NULL);
if ((sa = sarrayCreate(0)) == NULL)
return (char *)ERROR_PTR("sa not made", procName, NULL);
sarrayAddString(sa, line0, 1);
sarrayAddString(sa, line1, 1);
sarrayAddString(sa, line2, 1);
ncc = ccbaGetCount(ccba);
for (i = 0; i < ncc; i++) {
if ((ccb = ccbaGetCcb(ccba, i)) == NULL)
return (char *)ERROR_PTR("ccb not found", procName, NULL);
if ((pta = ccb->spglobal) == NULL)
return (char *)ERROR_PTR("spglobal not made", procName, NULL);
sarrayAddString(sa, line3, 1);
npt = ptaGetCount(pta);
for (j = 0; j < npt; j++) {
ptaGetIPt(pta, j, &x, &y);
sprintf(smallbuf, "%0d,%0d", x, y);
sarrayAddString(sa, smallbuf, 1);
}
sarrayAddString(sa, line4, 1);
ccbDestroy(&ccb);
}
sarrayAddString(sa, line5, 1);
sarrayAddString(sa, " ", 1);
svgstr = sarrayToString(sa, 1);
/* fprintf(stderr, "%s", svgstr); */
sarrayDestroy(&sa);
return svgstr;
} | true | true | false | false | false | 1 |
Perl_get_db_sub(pTHX_ SV **svp, CV *cv)
{
dVAR;
SV * const dbsv = GvSVn(PL_DBsub);
const bool save_taint = TAINT_get;
/* When we are called from pp_goto (svp is null),
* we do not care about using dbsv to call CV;
* it's for informational purposes only.
*/
PERL_ARGS_ASSERT_GET_DB_SUB;
TAINT_set(FALSE);
save_item(dbsv);
if (!PERLDB_SUB_NN) {
GV *gv = CvGV(cv);
if (!svp) {
gv_efullname3(dbsv, gv, NULL);
}
else if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
|| strEQ(GvNAME(gv), "END")
|| ( /* Could be imported, and old sub redefined. */
(GvCV(gv) != cv || !S_gv_has_usable_name(aTHX_ gv))
&&
!( (SvTYPE(*svp) == SVt_PVGV)
&& (GvCV((const GV *)*svp) == cv)
/* Use GV from the stack as a fallback. */
&& S_gv_has_usable_name(aTHX_ gv = (GV *)*svp)
)
)
) {
/* GV is potentially non-unique, or contain different CV. */
SV * const tmp = newRV(MUTABLE_SV(cv));
sv_setsv(dbsv, tmp);
SvREFCNT_dec(tmp);
}
else {
sv_sethek(dbsv, HvENAME_HEK(GvSTASH(gv)));
sv_catpvs(dbsv, "::");
sv_catpvn_flags(
dbsv, GvNAME(gv), GvNAMELEN(gv),
GvNAMEUTF8(gv) ? SV_CATUTF8 : SV_CATBYTES
);
}
}
else {
const int type = SvTYPE(dbsv);
if (type < SVt_PVIV && type != SVt_IV)
sv_upgrade(dbsv, SVt_PVIV);
(void)SvIOK_on(dbsv);
SvIV_set(dbsv, PTR2IV(cv)); /* Do it the quickest way */
}
TAINT_IF(save_taint);
#ifdef NO_TAINT_SUPPORT
PERL_UNUSED_VAR(save_taint);
#endif
} | 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.