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 |
|---|---|---|---|---|---|---|
copy_attrs(const char *from, const char *to)
{
struct stat st;
if (lstat(from, &st) == -1)
return -1;
if (!(discofs_options.copyattr & COPYATTR_NO_MODE))
{
if (chmod(to, st.st_mode) == -1)
PERROR("copy_attrs: setting mode failed");
}
if (!(discofs_options.copyattr & COPYATTR_NO_OWNER))
{
if (lchown(to, st.st_uid, (gid_t)-1) == -1)
PERROR("copy_attrs: setting owner failed");
}
if (!(discofs_options.copyattr & COPYATTR_NO_GROUP))
{
if (lchown(to, (uid_t)-1, st.st_gid) == -1)
PERROR("copy_attrs: setting group failed");
}
#if HAVE_SETXATTR
if ((discofs_options.fs_features & FEAT_XATTR) && !(discofs_options.copyattr & COPYATTR_NO_XATTR))
{
if (copy_xattrs(from, to) == -1)
PERROR("copy_attrs: copy_xattrs failed");
}
#endif
return 0;
} | false | false | false | false | false | 0 |
nss_ShutdownShutdownList(void)
{
SECStatus rv = SECSuccess;
int i;
/* call all the registerd functions first */
for (i=0; i < nssShutdownList.peakFuncs; i++) {
struct NSSShutdownFuncPair *funcPair = &nssShutdownList.funcs[i];
if (funcPair->func) {
if ((*funcPair->func)(funcPair->appData,NULL) != SECSuccess) {
rv = SECFailure;
}
}
}
nssShutdownList.peakFuncs = 0;
nssShutdownList.allocatedFuncs = 0;
PORT_Free(nssShutdownList.funcs);
nssShutdownList.funcs = NULL;
if (nssShutdownList.lock) {
PZ_DestroyLock(nssShutdownList.lock);
}
nssShutdownList.lock = NULL;
return rv;
} | false | false | false | false | false | 0 |
elm_entry_context_menu_clear(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Entry_Context_Menu_Item *it;
if (!wd) return;
EINA_LIST_FREE(wd->items, it)
{
eina_stringshare_del(it->label);
eina_stringshare_del(it->icon_file);
eina_stringshare_del(it->icon_group);
free(it);
}
} | false | false | false | false | false | 0 |
factors_satisfies(const struct webauth_factors *factors, const char *factor)
{
int i;
const char *candidate;
if (factors == NULL || apr_is_empty_array(factors->factors))
return false;
if (strcmp(factor, WA_FA_RANDOM_MULTIFACTOR) == 0 && factors->multifactor)
return true;
for (i = 0; i < factors->factors->nelts; i++) {
candidate = APR_ARRAY_IDX(factors->factors, i, const char *);
if (strcmp(factor, candidate) == 0)
return true;
}
return false;
} | false | false | false | false | false | 0 |
process (GeglOperation *op,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
gfloat *m;
gfloat ma[25] = { 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.2125, 0.7154, 0.0721, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0};
glong i;
m = ma;
for (i=0; i<n_pixels; i++)
{
out[0] = m[0] * in[0] + m[1] * in[1] + m[2] * in[2] + m[3] * in[3] + m[4];
out[1] = m[5] * in[0] + m[6] * in[1] + m[7] * in[2] + m[8] * in[3] + m[9];
out[2] = m[10] * in[0] + m[11] * in[1] + m[12] * in[2] + m[13] * in[3] + m[14];
out[3] = m[15] * in[0] + m[16] * in[1] + m[17] * in[2] + m[18] * in[3] + m[19];
in += 4;
out += 4;
}
return TRUE;
} | false | false | false | false | false | 0 |
set_current_groups(struct group_info *group_info)
{
struct cred *new;
new = prepare_creds();
if (!new)
return -ENOMEM;
set_groups(new, group_info);
return commit_creds(new);
} | false | false | false | false | false | 0 |
error_exit_client(struct Client *client_p, int error)
{
/*
* ...hmm, with non-blocking sockets we might get
* here from quite valid reasons, although.. why
* would select report "data available" when there
* wasn't... so, this must be an error anyway... --msa
* actually, EOF occurs when read() returns 0 and
* in due course, select() returns that fd as ready
* for reading even though it ends up being an EOF. -avalon
*/
char errmsg[255];
int current_error = rb_get_sockerr(client_p->localClient->F);
SetIOError(client_p);
if(IsServer(client_p) || IsHandshake(client_p))
{
if(error == 0)
{
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) && !IsServer(client_p) ? L_NETWIDE : L_ALL,
"Server %s closed the connection",
client_p->name);
ilog(L_SERVER, "Server %s closed the connection",
log_client_name(client_p, SHOW_IP));
}
else
{
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) && !IsServer(client_p) ? L_NETWIDE : L_ALL,
"Lost connection to %s: %s",
client_p->name, strerror(current_error));
ilog(L_SERVER, "Lost connection to %s: %s",
log_client_name(client_p, SHOW_IP), strerror(current_error));
}
}
if(error == 0)
rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
else
rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error));
exit_client(client_p, client_p, &me, errmsg);
} | true | true | false | false | false | 1 |
setName(const QString &name)
{
d->name = name;
// now reset the config, which may be based on our name
delete d->config;
d->config = 0;
delete d->dummyConfig;
d->dummyConfig = 0;
registerOperationsScheme();
emit serviceReady(this);
} | false | false | false | false | false | 0 |
insertString(int pos_,const MSString &string_)
{
pasting(MSTrue);
MSString buffer;
formatOutput(buffer);
if (pos_==-1) buffer<<string_;
else
{
buffer.insert(string_,pos_);
if (pos_<=selectionStart())
{
selectionStart(selectionStart()+string_.length());
selectionEnd(selectionEnd()+string_.length());
}
}
MSBoolean validated=validateInput(buffer);
if (validated==MSTrue)
{
valueChange();
}
else
{
if (pos_<=selectionStart())
{
selectionStart(selectionStart()-string_.length());
selectionEnd(selectionEnd()-string_.length());
}
server()->bell();
}
pasting(MSFalse);
return validated;
} | false | false | false | false | false | 0 |
XORWORD(ulong32 w, unsigned char *b)
{
ulong32 t;
LOAD32L(t, b);
t ^= w;
STORE32L(t, b);
} | false | false | false | false | true | 1 |
OnPageChanged( wxWizardExEvent& WXUNUSED(event) ) {
CMainDocument* pDoc = wxGetApp().GetDocument();
wxString strBuffer = wxEmptyString;
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
wxASSERT(m_pTitleStaticCtrl);
wxASSERT(m_pProxyHTTPDescriptionCtrl);
wxASSERT(m_pProxyHTTPServerStaticCtrl);
wxASSERT(m_pProxyHTTPServerCtrl);
wxASSERT(m_pProxyHTTPPortStaticCtrl);
wxASSERT(m_pProxyHTTPPortCtrl);
wxASSERT(m_pProxyHTTPUsernameStaticCtrl);
wxASSERT(m_pProxyHTTPUsernameCtrl);
wxASSERT(m_pProxyHTTPPasswordStaticCtrl);
wxASSERT(m_pProxyHTTPPasswordCtrl);
wxASSERT(m_pProxySOCKSDescriptionCtrl);
wxASSERT(m_pProxySOCKSServerStaticCtrl);
wxASSERT(m_pProxySOCKSServerCtrl);
wxASSERT(m_pProxySOCKSPortStaticCtrl);
wxASSERT(m_pProxySOCKSPortCtrl);
wxASSERT(m_pProxySOCKSUsernameStaticCtrl);
wxASSERT(m_pProxySOCKSUsernameCtrl);
wxASSERT(m_pProxySOCKSPasswordStaticCtrl);
wxASSERT(m_pProxySOCKSPasswordCtrl);
// Moving from the previous page, update text and get state
m_pTitleStaticCtrl->SetLabel(
_("Proxy configuration")
);
m_pProxyHTTPDescriptionCtrl->SetLabel(
_("HTTP proxy")
);
m_pProxyHTTPServerStaticCtrl->SetLabel(
_("Server:")
);
m_pProxyHTTPPortStaticCtrl->SetLabel(
_("Port:")
);
m_pProxyHTTPUsernameStaticCtrl->SetLabel(
_("User Name:")
);
m_pProxyHTTPPasswordStaticCtrl->SetLabel(
_("Password:")
);
#if 0
m_pProxyHTTPAutodetectCtrl->SetLabel(
_("Autodetect")
);
#endif
m_pProxySOCKSDescriptionCtrl->SetLabel(
_("SOCKS proxy")
);
m_pProxySOCKSServerStaticCtrl->SetLabel(
_("Server:")
);
m_pProxySOCKSPortStaticCtrl->SetLabel(
_("Port:")
);
m_pProxySOCKSUsernameStaticCtrl->SetLabel(
_("User Name:")
);
m_pProxySOCKSPasswordStaticCtrl->SetLabel(
_("Password:")
);
pDoc->GetProxyConfiguration();
m_pProxyHTTPServerCtrl->SetValue(wxString(pDoc->proxy_info.http_server_name.c_str(), wxConvUTF8));
m_pProxyHTTPUsernameCtrl->SetValue(wxString(pDoc->proxy_info.http_user_name.c_str(), wxConvUTF8));
m_pProxyHTTPPasswordCtrl->SetValue(wxString(pDoc->proxy_info.http_user_passwd.c_str(), wxConvUTF8));
strBuffer.Printf(wxT("%d"), pDoc->proxy_info.http_server_port);
m_pProxyHTTPPortCtrl->SetValue(strBuffer);
m_pProxySOCKSServerCtrl->SetValue(wxString(pDoc->proxy_info.socks_server_name.c_str(), wxConvUTF8));
m_pProxySOCKSUsernameCtrl->SetValue(wxString(pDoc->proxy_info.socks5_user_name.c_str(), wxConvUTF8));
m_pProxySOCKSPasswordCtrl->SetValue(wxString(pDoc->proxy_info.socks5_user_passwd.c_str(), wxConvUTF8));
strBuffer.Printf(wxT("%d"), pDoc->proxy_info.socks_server_port);
m_pProxySOCKSPortCtrl->SetValue(strBuffer);
Fit();
m_pProxyHTTPServerCtrl->SetFocus();
} | false | false | false | false | false | 0 |
rsvg_compile_bg (RsvgDrawingCtx * ctx)
{
RsvgCairoRender *render = RSVG_CAIRO_RENDER (ctx->render);
cairo_surface_t *surface;
cairo_t *cr;
GList *i;
surface = _rsvg_image_surface_new (render->width, render->height);
if (surface == NULL)
return NULL;
cr = cairo_create (surface);
for (i = g_list_last (render->cr_stack); i != NULL; i = g_list_previous (i)) {
cairo_t *draw = i->data;
gboolean nest = draw != render->initial_cr;
cairo_set_source_surface (cr, cairo_get_target (draw),
nest ? 0 : -render->offset_x,
nest ? 0 : -render->offset_y);
cairo_paint (cr);
}
cairo_destroy (cr);
return surface;
} | false | false | false | false | false | 0 |
quote_string(const char *s, char *out, size_t idx, size_t len, int display)
{
const char *p, *q;
for(p = s; *p && idx < len; p++){
q = strchr(quotable_chars, *p);
if (q && display) {
add_char(out, idx, len, replace_chars[q - quotable_chars]);
} else if (q) {
add_char(out, idx, len, '\\');
add_char(out, idx, len, replace_chars[q - quotable_chars]);
}else
add_char(out, idx, len, *p);
}
if(idx < len)
out[idx] = '\0';
return idx;
} | false | false | false | false | false | 0 |
wbcir_idle_rx(struct rc_dev *dev, bool idle)
{
struct wbcir_data *data = dev->priv;
if (!idle && data->rxstate == WBCIR_RXSTATE_INACTIVE)
data->rxstate = WBCIR_RXSTATE_ACTIVE;
if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) {
data->rxstate = WBCIR_RXSTATE_INACTIVE;
if (data->carrier_report_enabled)
wbcir_carrier_report(data);
/* Tell hardware to go idle by setting RXINACTIVE */
outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR);
}
} | false | false | false | false | false | 0 |
gtk_plot_bar_set_width (GtkPlotBar *bar, gdouble width)
{
if(width < 0.0) return;
bar->width = width;
} | false | false | false | false | false | 0 |
acl_chk_key(struct iscsi_acl *client, int key_type, int *negotiated_option,
unsigned int option_count, int *option_list,
const char *(*value_to_text) (int))
{
const char *key_val;
int length;
unsigned int i;
key_val = acl_get_key_val(&client->recv_key_block, key_type);
if (!key_val) {
*negotiated_option = AUTH_OPTION_NOT_PRESENT;
return;
}
while (*key_val != '\0') {
length = 0;
while (*key_val != '\0' && *key_val != ',')
client->scratch_key_value[length++] = *key_val++;
if (*key_val == ',')
key_val++;
client->scratch_key_value[length++] = '\0';
for (i = 0; i < option_count; i++) {
const char *s = (*value_to_text)(option_list[i]);
if (!s)
continue;
if (strcmp(client->scratch_key_value, s) == 0) {
*negotiated_option = option_list[i];
return;
}
}
}
*negotiated_option = AUTH_OPTION_REJECT;
} | false | false | false | false | false | 0 |
traverse(const Shape& parent, bool tr, Renderer* r) const
{
double caseValue = 0.0;
if (mSwitchExp->evaluate(&caseValue, 1, r) != 1) {
CfdgError::Error(mLocation, "Error evaluating switch selector");
return;
}
switchMap::const_iterator it = mCaseStatements.find((int)floor(caseValue));
if (it != mCaseStatements.end()) (*it).second->traverse(parent, tr, r);
else mElseBody.traverse(parent, tr, r);
} | false | false | false | false | false | 0 |
inferAggregate(Scope *sc, Dsymbol *&sapply)
{
Identifier *idapply = (op == TOKforeach) ? Id::apply : Id::applyReverse;
#if DMDV2
Identifier *idfront = (op == TOKforeach) ? Id::Ffront : Id::Fback;
int sliced = 0;
#endif
Type *tab;
Type *att = NULL;
Expression *org_aggr = aggr;
AggregateDeclaration *ad;
while (1)
{
aggr = aggr->semantic(sc);
aggr = resolveProperties(sc, aggr);
aggr = aggr->optimize(WANTvalue);
if (!aggr->type)
goto Lerr;
tab = aggr->type->toBasetype();
if (att == tab)
{ aggr = org_aggr;
goto Lerr;
}
switch (tab->ty)
{
case Tarray:
case Tsarray:
case Ttuple:
case Taarray:
break;
case Tclass:
ad = ((TypeClass *)tab)->sym;
goto Laggr;
case Tstruct:
ad = ((TypeStruct *)tab)->sym;
goto Laggr;
Laggr:
#if DMDV2
if (!sliced)
{
sapply = search_function(ad, idapply);
if (sapply)
{ // opApply aggregate
break;
}
Dsymbol *s = search_function(ad, Id::slice);
if (s)
{ Expression *rinit = new SliceExp(aggr->loc, aggr, NULL, NULL);
rinit = rinit->trySemantic(sc);
if (rinit) // if application of [] succeeded
{ aggr = rinit;
sliced = 1;
continue;
}
}
}
if (Dsymbol *shead = ad->search(Loc(), idfront, 0))
{ // range aggregate
break;
}
if (ad->aliasthis)
{
if (!att && tab->checkAliasThisRec())
att = tab;
aggr = new DotIdExp(aggr->loc, aggr, ad->aliasthis->ident);
continue;
}
#else
sapply = search_function(ad, idapply);
if (sapply)
{ // opApply aggregate
break;
}
#endif
goto Lerr;
case Tdelegate:
if (aggr->op == TOKdelegate)
{ DelegateExp *de = (DelegateExp *)aggr;
sapply = de->func->isFuncDeclaration();
}
break;
case Terror:
break;
default:
goto Lerr;
}
break;
}
return 1;
Lerr:
return 0;
} | false | false | false | false | false | 0 |
map_addnickdb(struct map_session_data *sd)
{
nullpo_retv(sd);
strdb_insert(nick_db,sd->status.name,sd);
} | false | false | false | false | false | 0 |
verbsChar(V p) {R (p>=DT_VERB_OFFSET && p < DT_SPECIAL_VERB_OFFSET)?vc[((I)p-DT_VERB_OFFSET)/2]:'\0';} | false | false | false | false | false | 0 |
RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation,
Oid rangeSubOpclass, RegProcedure rangeCanonical,
RegProcedure rangeSubDiff)
{
Relation pg_range;
Datum values[Natts_pg_range];
bool nulls[Natts_pg_range];
HeapTuple tup;
ObjectAddress myself;
ObjectAddress referenced;
pg_range = heap_open(RangeRelationId, RowExclusiveLock);
memset(nulls, 0, sizeof(nulls));
values[Anum_pg_range_rngtypid - 1] = ObjectIdGetDatum(rangeTypeOid);
values[Anum_pg_range_rngsubtype - 1] = ObjectIdGetDatum(rangeSubType);
values[Anum_pg_range_rngcollation - 1] = ObjectIdGetDatum(rangeCollation);
values[Anum_pg_range_rngsubopc - 1] = ObjectIdGetDatum(rangeSubOpclass);
values[Anum_pg_range_rngcanonical - 1] = ObjectIdGetDatum(rangeCanonical);
values[Anum_pg_range_rngsubdiff - 1] = ObjectIdGetDatum(rangeSubDiff);
tup = heap_form_tuple(RelationGetDescr(pg_range), values, nulls);
simple_heap_insert(pg_range, tup);
CatalogUpdateIndexes(pg_range, tup);
heap_freetuple(tup);
/* record type's dependencies on range-related items */
myself.classId = TypeRelationId;
myself.objectId = rangeTypeOid;
myself.objectSubId = 0;
referenced.classId = TypeRelationId;
referenced.objectId = rangeSubType;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
referenced.classId = OperatorClassRelationId;
referenced.objectId = rangeSubOpclass;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
if (OidIsValid(rangeCollation))
{
referenced.classId = CollationRelationId;
referenced.objectId = rangeCollation;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
if (OidIsValid(rangeCanonical))
{
referenced.classId = ProcedureRelationId;
referenced.objectId = rangeCanonical;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
if (OidIsValid(rangeSubDiff))
{
referenced.classId = ProcedureRelationId;
referenced.objectId = rangeSubDiff;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
heap_close(pg_range, RowExclusiveLock);
} | false | false | false | false | false | 0 |
setFixedHandicap(int handicap)
{
Q_ASSERT(handicap >= 2 && handicap <= 9);
if (!isRunning()) {
return false;
}
if (handicap <= fixedHandicapUpperBound()) {
m_process.write("fixed_handicap " + QByteArray::number(handicap) + '\n');
if (waitResponse()) {
// Black starts with setting his (fixed) handicap as it's first turn
// which means, white is next.
setCurrentPlayer(m_whitePlayer);
m_fixedHandicap = handicap;
emit boardChanged();
return true;
} else {
return false;
}
} else {
//kWarning() << "Handicap" << handicap << " not set, it is too high!";
return false;
}
} | false | false | false | false | false | 0 |
nifti_nim_is_valid(nifti_image * nim, int complain)
{
int errs = 0;
if( !nim ){
fprintf(stderr,"** is_valid_nim: nim is NULL\n");
return 0;
}
if( g_opts.debug > 2 ) fprintf(stderr,"-d nim_is_valid check...\n");
/**- check that dim[] matches the individual values ndim, nx, ny, ... */
if( ! nifti_nim_has_valid_dims(nim,complain) ){
if( !complain ) return 0;
errs++;
}
/* might check nbyper, pixdim, q/sforms, swapsize, nifti_type, ... */
/**- be explicit in return of 0 or 1 */
if( errs > 0 ) return 0;
else return 1;
} | false | false | false | false | false | 0 |
resourceModifiedTime(ResourceGroup* grp, const String& resourceName)
{
OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME); // lock group mutex
// Try indexes first
ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(resourceName);
if (rit != grp->resourceIndexCaseSensitive.end())
{
return rit->second->getModifiedTime(resourceName);
}
else
{
// try case insensitive
String lcResourceName = resourceName;
StringUtil::toLowerCase(lcResourceName);
rit = grp->resourceIndexCaseInsensitive.find(lcResourceName);
if (rit != grp->resourceIndexCaseInsensitive.end())
{
return rit->second->getModifiedTime(resourceName);
}
else
{
// Search the hard way
LocationList::iterator li, liend;
liend = grp->locationList.end();
for (li = grp->locationList.begin(); li != liend; ++li)
{
Archive* arch = (*li)->archive;
time_t testTime = arch->getModifiedTime(resourceName);
if (testTime > 0)
{
return testTime;
}
}
}
}
return 0;
} | false | false | false | false | false | 0 |
meter_ptime(double t, char *s, double elapsed)
{
long hour;
long min;
long sec;
long frac;
char buffer[50];
if (elapsed > 0)
snprintf(buffer, sizeof(buffer), " %5.1f%%", 100. * t / elapsed);
else
buffer[0] = 0;
frac = t * 1000 + 0.5;
sec = frac / 1000;
frac %= 1000;
min = sec / 60;
sec %= 60;
hour = min / 60;
min %= 60;
fprintf
(
stderr,
"%2ld:%02ld:%02ld.%03ld %s%s\n",
hour,
min,
sec,
frac,
s,
buffer
);
} | true | true | false | false | false | 1 |
_NP_decrRefCount()
{
omni::poRcLock->lock();
int done = --pd_refCount > 0;
omni::poRcLock->unlock();
if( done ) return;
OMNIORB_USER_CHECK(pd_refCount == 0);
// If this fails then the application has released a Policy
// reference too many times.
delete this;
} | false | false | false | false | false | 0 |
DecipherUpdate(char* data, int len, unsigned char** out, int* out_len) {
if (!initialised_) {
*out_len = 0;
*out = NULL;
return 0;
}
*out_len=len+EVP_CIPHER_CTX_block_size(&ctx);
*out= new unsigned char[*out_len];
EVP_CipherUpdate(&ctx, *out, out_len, (unsigned char*)data, len);
return 1;
} | false | false | false | false | false | 0 |
PyErr_SetArgsError(PyTypeObject *type, char *name, PyObject *args)
{
if (!PyErr_Occurred())
{
PyObject *err = Py_BuildValue("(OsO)", type, name, args);
PyErr_SetObject(PyExc_InvalidArgsError, err);
Py_DECREF(err);
}
return NULL;
} | false | false | false | false | false | 0 |
Symbols_To_Bits (Object x, int mflag, SYMDESCR *stab) {
register SYMDESCR *syms;
register unsigned long int mask = 0;
Object l, s;
register char *p;
register int n;
if (!mflag) Check_Type (x, T_Symbol);
for (l = x; !Nullp (l); l = Cdr (l)) {
if (mflag) {
Check_Type (l, T_Pair);
x = Car (l);
}
Check_Type (x, T_Symbol);
s = SYMBOL(x)->name;
p = STRING(s)->data;
n = STRING(s)->size;
for (syms = stab; syms->name; syms++)
if (n && strncmp (syms->name, p, n) == 0) break;
if (syms->name == 0)
Primitive_Error ("invalid argument: ~s", x);
mask |= syms->val;
if (!mflag) break;
}
return mask;
} | false | false | false | false | false | 0 |
gf_isom_modify_edit_segment(GF_ISOFile *movie, u32 trackNumber, u32 seg_index, u64 EditDuration, u64 MediaTime, u8 EditMode)
{
GF_Err e;
GF_TrackBox *trak;
GF_EdtsEntry *ent;
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak || !seg_index) return GF_BAD_PARAM;
e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE);
if (e) return e;
if (!trak->editBox || !trak->editBox->editList) return GF_OK;
if (gf_list_count(trak->editBox->editList->entryList)<seg_index) return GF_BAD_PARAM;
ent = (GF_EdtsEntry*) gf_list_get(trak->editBox->editList->entryList, seg_index-1);
ent->segmentDuration = EditDuration;
switch (EditMode) {
case GF_ISOM_EDIT_EMPTY:
ent->mediaRate = 1;
ent->mediaTime = -1;
break;
case GF_ISOM_EDIT_DWELL:
ent->mediaRate = 0;
ent->mediaTime = MediaTime;
break;
default:
ent->mediaRate = 1;
ent->mediaTime = MediaTime;
break;
}
return SetTrackDuration(trak);
} | false | false | false | false | false | 0 |
flip() {
if (subIdx_ || TargetRegisterInfo::isPhysicalRegister(dstReg_))
return false;
std::swap(srcReg_, dstReg_);
flipped_ = !flipped_;
return true;
} | false | false | false | false | false | 0 |
ifx_spi_power_state_clear(struct ifx_spi_device *ifx_dev, unsigned char val)
{
unsigned long flags;
spin_lock_irqsave(&ifx_dev->power_lock, flags);
if (ifx_dev->power_status) {
ifx_dev->power_status &= ~val;
if (!ifx_dev->power_status)
pm_runtime_put(&ifx_dev->spi_dev->dev);
}
spin_unlock_irqrestore(&ifx_dev->power_lock, flags);
} | false | false | false | false | false | 0 |
ladish_app_supervisor_set_project_name(
ladish_app_supervisor_handle supervisor_handle,
const char * project_name)
{
char * dup;
if (project_name != NULL)
{
dup = strdup(project_name);
if (dup == NULL)
{
log_error("strdup(\"%s\") failed", project_name);
return false;
}
}
else
{
dup = NULL;
}
free(supervisor_ptr->project_name);
supervisor_ptr->project_name = dup;
return true;
} | false | false | false | false | false | 0 |
goc_path_draw (GocItem const *item, cairo_t *cr)
{
GocPath *path = GOC_PATH (item);
gboolean scale_line_width = goc_styled_item_get_scale_line_width (GOC_STYLED_ITEM (item));
gboolean needs_restore;
cairo_save(cr);
needs_restore = TRUE;
cairo_set_fill_rule (cr, path->fill_rule? CAIRO_FILL_RULE_EVEN_ODD: CAIRO_FILL_RULE_WINDING);
if (goc_path_prepare_draw (item, cr, 1)) {
if (path->closed)
go_styled_object_fill (GO_STYLED_OBJECT (item), cr, TRUE);
if (!scale_line_width) {
cairo_restore (cr);
needs_restore = FALSE;
}
if (go_styled_object_set_cairo_line (GO_STYLED_OBJECT (item), cr)) {
cairo_stroke (cr);
} else {
cairo_new_path (cr);
}
}
if (needs_restore)
cairo_restore(cr);
} | false | false | false | false | false | 0 |
lookup_fnfields (tree xbasetype, tree name, int protect)
{
tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false,
tf_warning_or_error);
/* Ignore non-functions, but propagate the ambiguity list. */
if (!error_operand_p (rval)
&& (rval && !BASELINK_P (rval)))
return NULL_TREE;
return rval;
} | false | false | false | false | false | 0 |
exif_data_unref (ExifData *data)
{
if (!data)
return;
data->priv->ref_count--;
if (!data->priv->ref_count)
exif_data_free (data);
} | false | false | false | false | false | 0 |
switch_modifier(snd_use_case_mgr_t *uc_mgr,
const char *old_modifier,
const char *new_modifier)
{
struct use_case_modifier *xold, *xnew;
struct transition_sequence *trans;
struct list_head *pos;
int err, seq_found = 0;
if (uc_mgr->active_verb == NULL)
return -ENOENT;
if (modifier_status(uc_mgr, old_modifier) == 0) {
uc_error("error: modifier %s not enabled", old_modifier);
return -EINVAL;
}
if (modifier_status(uc_mgr, new_modifier) != 0) {
uc_error("error: modifier %s already enabled", new_modifier);
return -EINVAL;
}
xold = find_modifier(uc_mgr, uc_mgr->active_verb, old_modifier, 1);
if (xold == NULL)
return -ENOENT;
xnew = find_modifier(uc_mgr, uc_mgr->active_verb, new_modifier, 1);
if (xnew == NULL)
return -ENOENT;
err = 0;
list_for_each(pos, &xold->transition_list) {
trans = list_entry(pos, struct transition_sequence, list);
if (strcmp(trans->name, new_modifier) == 0) {
err = execute_sequence(uc_mgr, &trans->transition_list,
&xold->value_list,
&uc_mgr->active_verb->value_list,
&uc_mgr->value_list);
if (err >= 0) {
list_del(&xold->active_list);
list_add_tail(&xnew->active_list, &uc_mgr->active_modifiers);
}
seq_found = 1;
break;
}
}
if (!seq_found) {
err = set_modifier(uc_mgr, xold, 0);
if (err < 0)
return err;
err = set_modifier(uc_mgr, xnew, 1);
if (err < 0)
return err;
}
return err;
} | false | false | false | false | false | 0 |
tonga_get_voltage_index(phm_ppt_v1_voltage_lookup_table *look_up_table,
uint16_t voltage)
{
uint8_t count = (uint8_t) (look_up_table->count);
uint8_t i;
PP_ASSERT_WITH_CODE((NULL != look_up_table), "Lookup Table empty.", return 0;);
PP_ASSERT_WITH_CODE((0 != count), "Lookup Table empty.", return 0;);
for (i = 0; i < count; i++) {
/* find first voltage equal or bigger than requested */
if (look_up_table->entries[i].us_vdd >= voltage)
return i;
}
/* voltage is bigger than max voltage in the table */
return i-1;
} | false | false | false | false | false | 0 |
config_set_hash_filters(const char *attrname, char *value, char *errorbuf, int apply)
{
int val = 0;
int retVal = LDAP_SUCCESS;
retVal = config_set_onoff(attrname,
value,
&val,
errorbuf,
apply);
if (retVal == LDAP_SUCCESS) {
set_hash_filters(val);
}
return retVal;
} | false | false | false | false | false | 0 |
focus_order_to_top(ObClient *c)
{
focus_order = g_list_remove(focus_order, c);
if (!c->iconic) {
focus_order = g_list_prepend(focus_order, c);
} else {
GList *it;
/* insert before first iconic window */
for (it = focus_order;
it && !((ObClient*)it->data)->iconic; it = g_list_next(it));
focus_order = g_list_insert_before(focus_order, it, c);
}
focus_cycle_reorder();
} | false | false | false | false | false | 0 |
aac_sa_intr(int irq, void *dev_id)
{
struct aac_dev *dev = dev_id;
unsigned short intstat, mask;
intstat = sa_readw(dev, DoorbellReg_p);
/*
* Read mask and invert because drawbridge is reversed.
* This allows us to only service interrupts that have been enabled.
*/
mask = ~(sa_readw(dev, SaDbCSR.PRISETIRQMASK));
/* Check to see if this is our interrupt. If it isn't just return */
if (intstat & mask) {
if (intstat & PrintfReady) {
aac_printf(dev, sa_readl(dev, Mailbox5));
sa_writew(dev, DoorbellClrReg_p, PrintfReady); /* clear PrintfReady */
sa_writew(dev, DoorbellReg_s, PrintfDone);
} else if (intstat & DOORBELL_1) { // dev -> Host Normal Command Ready
sa_writew(dev, DoorbellClrReg_p, DOORBELL_1);
aac_command_normal(&dev->queues->queue[HostNormCmdQueue]);
} else if (intstat & DOORBELL_2) { // dev -> Host Normal Response Ready
sa_writew(dev, DoorbellClrReg_p, DOORBELL_2);
aac_response_normal(&dev->queues->queue[HostNormRespQueue]);
} else if (intstat & DOORBELL_3) { // dev -> Host Normal Command Not Full
sa_writew(dev, DoorbellClrReg_p, DOORBELL_3);
} else if (intstat & DOORBELL_4) { // dev -> Host Normal Response Not Full
sa_writew(dev, DoorbellClrReg_p, DOORBELL_4);
}
return IRQ_HANDLED;
}
return IRQ_NONE;
} | false | false | false | false | false | 0 |
auth_resolve_groups(struct userlist *l, char *groups)
{
char *group = NULL;
unsigned int g, group_mask = 0;
if (!groups || !*groups)
return 0;
while ((group = strtok(group?NULL:groups," "))) {
for (g = 0; g < l->grpcnt; g++)
if (!strcmp(l->groups[g], group))
break;
if (g == l->grpcnt) {
Alert("No such group '%s' in userlist '%s'.\n",
group, l->name);
return 0;
}
group_mask |= (1 << g);
}
return group_mask;
} | false | false | false | false | false | 0 |
mreadmsg(mtmp, otmp)
struct monst *mtmp;
struct obj *otmp;
{
boolean vismon = canseemon(mtmp);
char onambuf[BUFSZ];
short saverole;
unsigned savebknown;
if (!vismon && !flags.soundok)
return; /* no feedback */
otmp->dknown = 1; /* seeing or hearing it read reveals its label */
/* shouldn't be able to hear curse/bless status of unseen scrolls;
for priest characters, bknown will always be set during naming */
savebknown = otmp->bknown;
saverole = Role_switch;
if (!vismon) {
otmp->bknown = 0;
if (Role_if(PM_PRIEST)) Role_switch = 0;
}
Strcpy(onambuf, singular(otmp, doname));
Role_switch = saverole;
otmp->bknown = savebknown;
if (vismon)
pline("%s reads %s!", Monnam(mtmp), onambuf);
else
You_hear("%s reading %s.",
x_monnam(mtmp, ARTICLE_A, (char *)0,
(SUPPRESS_IT|SUPPRESS_INVISIBLE|SUPPRESS_SADDLE), FALSE),
onambuf);
if (mtmp->mconf)
pline("Being confused, %s mispronounces the magic words...",
vismon ? mon_nam(mtmp) : mhe(mtmp));
} | false | false | false | true | false | 1 |
createvar(varname name, int status, int n, int mode)
{
int bytes;
vari *v;
/*
compute the length of the variable in bytes. some systems
mess up is this is not a multiple of 8.
*/
bytes = vbytes(n,mode);
while ( (bytes & 8) > 0 ) bytes++;
if (lf_error)
return(NULL);
// Don't delete the hidden vars
if (status==STSYSTEM || status==STREGULAR || status==STPLOTVAR)
deletename(name);
v = findvar(name,0,NULL);
if (v != NULL)
{
fprintf(stderr, "Error: attempting to re-initialize still-live variable %s\n", name);
}
pair<map<string, vari*>::iterator, bool> inserted;
string str_name = name;
pair<string, vari*> p;
p.first = str_name;
p.second = (vari*)calloc(1, sizeof(vari));
inserted = var_table.insert(p);
v = inserted.first->second;
strcpy(v->name,name);
vlength(v) = n;
v->stat = status;
v->bytes = bytes;
v->mode = mode;
if (status!=STSYSPEC)
{
v->dpr = (double*)calloc(bytes, 1);
}
return(v);
} | false | false | false | false | false | 0 |
assoc_allreduce(void *sbuf, void *rbuf, int count,
MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
{
int err, rank;
char *local_buffer = NULL, *local_origin;
char *send_ptr, *recv_ptr;
lam_ssi_coll_data_t *lcd = comm->c_ssi_coll_data;
MPI_Comm_rank(comm, &rank);
/* Set root to setup coordinator comms, etc. */
lam_ssi_coll_smp_set_root(comm, 0);
/* Do local reductions first */
/* If I'm the local root, allocate a temp buffer to receive into */
if (lcd->lcd_local_size == 1) {
recv_ptr = sbuf;
} else {
if (lcd->lcd_coord_comms[0] != MPI_COMM_NULL) {
err = lam_dtbuffer(dtype, count, &local_buffer, &local_origin);
if (err != MPI_SUCCESS)
return err;
recv_ptr = local_origin;
} else
recv_ptr = NULL;
err = MPI_Reduce(sbuf, recv_ptr, count, dtype, op,
lcd->lcd_local_roots[0],
lcd->lcd_local_comm);
if (err != MPI_SUCCESS)
return err;
}
/* MagPIe does an alltoall between the coordinators and then
finishes the computation locally. However, at least in the
linear case, this is the same (in terms of latency and bytes
transferred) as a reduce to one of the coordinators followed by a
bcast from that coordinator. */
if (lcd->lcd_coord_comms[0] != MPI_COMM_NULL) {
send_ptr = recv_ptr;
if (rank == 0)
recv_ptr = rbuf;
else
recv_ptr = NULL;
err = MPI_Reduce(send_ptr, recv_ptr, count, dtype, op,
lcd->lcd_coord_roots[0],
lcd->lcd_coord_comms[0]);
if (err != MPI_SUCCESS)
return err;
/* Now do the bcast */
err = MPI_Bcast(rbuf, count, dtype, lcd->lcd_coord_roots[0],
lcd->lcd_coord_comms[0]);
}
/* Finally, do a local bcast to communicate the final result to my
local peers */
if (lcd->lcd_local_size > 1)
MPI_Bcast(rbuf, count, dtype, lcd->lcd_local_roots[0],
lcd->lcd_local_comm);
/* Free temporary buffer */
if (local_buffer != NULL)
free(local_buffer);
/* All done */
return MPI_SUCCESS;
} | false | false | false | false | false | 0 |
v9fs_fid_clone(struct dentry *dentry)
{
struct p9_fid *fid, *ret;
fid = v9fs_fid_lookup(dentry);
if (IS_ERR(fid))
return fid;
ret = p9_client_walk(fid, 0, NULL, 1);
return ret;
} | false | false | false | false | false | 0 |
r_postlude(struct SN_env * z) {
int among_var;
while(1) { /* repeat, line 62 */
int c = z->c;
z->bra = z->c; /* [, line 63 */
among_var = find_among(z, a_1, 3); /* substring, line 63 */
if (!(among_var)) goto lab0;
z->ket = z->c; /* ], line 63 */
switch(among_var) {
case 0: goto lab0;
case 1:
{ int ret;
ret = slice_from_s(z, 1, s_2); /* <-, line 64 */
if (ret < 0) return ret;
}
break;
case 2:
{ int ret;
ret = slice_from_s(z, 1, s_3); /* <-, line 65 */
if (ret < 0) return ret;
}
break;
case 3:
if (z->c >= z->l) goto lab0;
z->c++; /* next, line 66 */
break;
}
continue;
lab0:
z->c = c;
break;
}
return 1;
} | false | false | false | false | false | 0 |
PageSetChecksumInplace(Page page, BlockNumber blkno)
{
/* If we don't need a checksum, just return */
if (PageIsNew(page) || !DataChecksumsEnabled())
return;
((PageHeader) page)->pd_checksum = pg_checksum_page((char *) page, blkno);
} | false | false | false | false | false | 0 |
eliminate_degenerate_phis (void)
{
bitmap interesting_names;
bitmap interesting_names1;
/* Bitmap of blocks which need EH information updated. We can not
update it on-the-fly as doing so invalidates the dominator tree. */
need_eh_cleanup = BITMAP_ALLOC (NULL);
/* INTERESTING_NAMES is effectively our worklist, indexed by
SSA_NAME_VERSION.
A set bit indicates that the statement or PHI node which
defines the SSA_NAME should be (re)examined to determine if
it has become a degenerate PHI or trivial const/copy propagation
opportunity.
Experiments have show we generally get better compilation
time behavior with bitmaps rather than sbitmaps. */
interesting_names = BITMAP_ALLOC (NULL);
interesting_names1 = BITMAP_ALLOC (NULL);
calculate_dominance_info (CDI_DOMINATORS);
cfg_altered = false;
/* First phase. Eliminate degenerate PHIs via a dominator
walk of the CFG.
Experiments have indicated that we generally get better
compile-time behavior by visiting blocks in the first
phase in dominator order. Presumably this is because walking
in dominator order leaves fewer PHIs for later examination
by the worklist phase. */
eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR, interesting_names);
/* Second phase. Eliminate second order degenerate PHIs as well
as trivial copies or constant initializations identified by
the first phase or this phase. Basically we keep iterating
until our set of INTERESTING_NAMEs is empty. */
while (!bitmap_empty_p (interesting_names))
{
unsigned int i;
bitmap_iterator bi;
/* EXECUTE_IF_SET_IN_BITMAP does not like its bitmap
changed during the loop. Copy it to another bitmap and
use that. */
bitmap_copy (interesting_names1, interesting_names);
EXECUTE_IF_SET_IN_BITMAP (interesting_names1, 0, i, bi)
{
tree name = ssa_name (i);
/* Ignore SSA_NAMEs that have been released because
their defining statement was deleted (unreachable). */
if (name)
eliminate_const_or_copy (SSA_NAME_DEF_STMT (ssa_name (i)),
interesting_names);
}
}
if (cfg_altered)
{
free_dominance_info (CDI_DOMINATORS);
/* If we changed the CFG schedule loops for fixup by cfgcleanup. */
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
}
/* Propagation of const and copies may make some EH edges dead. Purge
such edges from the CFG as needed. */
if (!bitmap_empty_p (need_eh_cleanup))
{
gimple_purge_all_dead_eh_edges (need_eh_cleanup);
BITMAP_FREE (need_eh_cleanup);
}
BITMAP_FREE (interesting_names);
BITMAP_FREE (interesting_names1);
return 0;
} | false | false | false | false | false | 0 |
appendTo(
UChar *buffer, int32_t *len) const {
int32_t origLen = *len;
int32_t kId = id;
for (int32_t i = origLen + idLen - 1; i >= origLen; i--) {
int32_t digit = kId % 10;
buffer[i] = digit + 0x30;
kId /= 10;
}
*len = origLen + idLen;
} | false | false | false | false | false | 0 |
startswith(object_cref prefix, object_cref start) const
{
bool result = _BOOST_PYTHON_ASLONG(this->attr("startswith")(prefix,start).ptr());
if (PyErr_Occurred())
throw_error_already_set();
return result;
} | false | false | false | false | false | 0 |
HasBarryPlugins() const
{
const_iterator b = begin(), e = end();
for( ; b != e; ++b ) {
if( (*b)->GetAppName() == Config::Barry::AppName() )
return true;
}
return false;
} | false | false | false | false | false | 0 |
gst_aspect_ratio_crop_transform_caps (GstAspectRatioCrop * aspect_ratio_crop,
GstCaps * caps)
{
GstCaps *transform;
gint size, i;
transform = gst_caps_new_empty ();
size = gst_caps_get_size (caps);
for (i = 0; i < size; i++) {
GstStructure *s;
GstStructure *trans_s;
s = gst_caps_get_structure (caps, i);
gst_aspect_ratio_transform_structure (aspect_ratio_crop, s, &trans_s,
FALSE);
gst_caps_append_structure (transform, trans_s);
}
return transform;
} | false | false | false | false | false | 0 |
eventually_available_single( const Research& res, list<const Technology*>* dependencies, list<int>& stack, int id )
{
Technology* tech = technologyRepository.getObject_byID( id );
if ( !tech )
return false;
else
return tech->eventually_available( res, dependencies, stack );
} | false | false | false | false | false | 0 |
bmap(struct inode *inode, sector_t block)
{
sector_t res = 0;
if (inode->i_mapping->a_ops->bmap)
res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block);
return res;
} | false | false | false | false | false | 0 |
kprobe_int3_handler(struct pt_regs *regs)
{
kprobe_opcode_t *addr;
struct kprobe *p;
struct kprobe_ctlblk *kcb;
if (user_mode(regs))
return 0;
addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t));
/*
* We don't want to be preempted for the entire
* duration of kprobe processing. We conditionally
* re-enable preemption at the end of this function,
* and also in reenter_kprobe() and setup_singlestep().
*/
preempt_disable();
kcb = get_kprobe_ctlblk();
p = get_kprobe(addr);
if (p) {
if (kprobe_running()) {
if (reenter_kprobe(p, regs, kcb))
return 1;
} else {
set_current_kprobe(p, regs, kcb);
kcb->kprobe_status = KPROBE_HIT_ACTIVE;
/*
* If we have no pre-handler or it returned 0, we
* continue with normal processing. If we have a
* pre-handler and it returned non-zero, it prepped
* for calling the break_handler below on re-entry
* for jprobe processing, so get out doing nothing
* more here.
*/
if (!p->pre_handler || !p->pre_handler(p, regs))
setup_singlestep(p, regs, kcb, 0);
return 1;
}
} else if (*addr != BREAKPOINT_INSTRUCTION) {
/*
* The breakpoint instruction was removed right
* after we hit it. Another cpu has removed
* either a probepoint or a debugger breakpoint
* at this address. In either case, no further
* handling of this interrupt is appropriate.
* Back up over the (now missing) int3 and run
* the original instruction.
*/
regs->ip = (unsigned long)addr;
preempt_enable_no_resched();
return 1;
} else if (kprobe_running()) {
p = __this_cpu_read(current_kprobe);
if (p->break_handler && p->break_handler(p, regs)) {
if (!skip_singlestep(p, regs, kcb))
setup_singlestep(p, regs, kcb, 0);
return 1;
}
} /* else: not a kprobe fault; let the kernel handle it */
preempt_enable_no_resched();
return 0;
} | false | false | false | false | true | 1 |
gudev_add_device (GMtpVolumeMonitor *monitor, GUdevDevice *device, gboolean do_emit)
{
GMtpVolume *volume;
const char *usb_bus_num, *usb_device_num;
char *uri;
GFile *activation_mount_root;
usb_bus_num = g_udev_device_get_property (device, "BUSNUM");
if (usb_bus_num == NULL) {
g_warning ("device %s has no BUSNUM property, ignoring", g_udev_device_get_device_file (device));
return;
}
usb_device_num = g_udev_device_get_property (device, "DEVNUM");
if (usb_device_num == NULL) {
g_warning ("device %s has no DEVNUM property, ignoring", g_udev_device_get_device_file (device));
return;
}
g_debug ("gudev_add_device: device %s (bus: %s, device: %s)",
g_udev_device_get_device_file (device),
usb_bus_num, usb_device_num);
uri = g_strdup_printf ("mtp://[usb:%s,%s]", usb_bus_num, usb_device_num);
activation_mount_root = g_file_new_for_uri (uri);
g_free (uri);
volume = g_mtp_volume_new (G_VOLUME_MONITOR (monitor),
device,
monitor->gudev_client,
activation_mount_root);
if (volume != NULL) {
monitor->device_volumes = g_list_prepend (monitor->device_volumes, volume);
if (do_emit)
g_signal_emit_by_name (monitor, "volume_added", volume);
}
if (activation_mount_root != NULL)
g_object_unref (activation_mount_root);
} | false | false | false | false | false | 0 |
reader_free(struct cube_reader *rd)
{
DBG_fprintf(stderr, "Cube: free the reader structure.\n");
g_string_free(rd->line, TRUE);
if (rd->comment)
g_free(rd->comment);
g_hash_table_destroy(rd->elements);
if (rd->nodeTypes)
g_free(rd->nodeTypes);
if (rd->coords)
g_free(rd->coords);
if (rd->density)
g_array_unref(rd->density);
if (g_io_channel_shutdown(rd->flux, FALSE, (GError**)0) != G_IO_STATUS_NORMAL)
g_warning("Cube: can't close file.");
g_io_channel_unref(rd->flux);
} | false | false | false | false | false | 0 |
CColorControl(gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, const wchar_t *text, IGUIElement* parent, s32 id=-1 )
: gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect< s32 >(pos, pos+core::dimension2d<s32>(80, 75)))
, DirtyFlag(true)
, ColorStatic(0)
, EditAlpha(0)
, EditRed(0)
, EditGreen(0)
, EditBlue(0)
{
using namespace gui;
ButtonSetId = makeUniqueId();
const core::rect< s32 > rectControls(0,0,AbsoluteRect.getWidth(),AbsoluteRect.getHeight() );
IGUIStaticText * groupElement = guiEnv->addStaticText (L"", rectControls, true, false, this, -1, false);
groupElement->setNotClipped(true);
guiEnv->addStaticText (text, core::rect<s32>(0,0,80,15), false, false, groupElement, -1, false);
EditAlpha = addEditForNumbers(guiEnv, core::position2d<s32>(0,15), L"a", -1, groupElement );
EditRed = addEditForNumbers(guiEnv, core::position2d<s32>(0,30), L"r", -1, groupElement );
EditGreen = addEditForNumbers(guiEnv, core::position2d<s32>(0,45), L"g", -1, groupElement );
EditBlue = addEditForNumbers(guiEnv, core::position2d<s32>(0,60), L"b", -1, groupElement );
ColorStatic = guiEnv->addStaticText (L"", core::rect<s32>(60,15,80,75), true, false, groupElement, -1, true);
guiEnv->addButton (core::rect<s32>(60,35,80,50), groupElement, ButtonSetId, L"set");
SetEditsFromColor(Color);
} | false | false | false | false | false | 0 |
merge_branch(void)
{
git_oid their_oids[1];
git_annotated_commit *their_head;
git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
int error;
cl_git_pass(git_oid_fromstr(&their_oids[0], MERGE_BRANCH_OID));
cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_oids[0]));
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
error = git_merge(repo, (const git_annotated_commit **)&their_head, 1, &merge_opts, &checkout_opts);
git_annotated_commit_free(their_head);
return error;
} | false | false | false | false | false | 0 |
nmc_is_nm_running (NmCli *nmc, GError **error)
{
DBusGConnection *connection = NULL;
DBusGProxy *proxy = NULL;
GError *err = NULL;
gboolean has_owner = FALSE;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
if (!connection) {
g_string_printf (nmc->return_text, _("Error: Couldn't connect to system bus: %s"), err->message);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
g_propagate_error (error, err);
goto done;
}
proxy = dbus_g_proxy_new_for_name (connection,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus");
if (!proxy) {
g_string_printf (nmc->return_text, _("Error: Couldn't create D-Bus object proxy for org.freedesktop.DBus"));
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
if (error)
g_set_error_literal (error, NMCLI_ERROR, 0, nmc->return_text->str);
goto done;
}
if (!org_freedesktop_DBus_name_has_owner (proxy, NM_DBUS_SERVICE, &has_owner, &err)) {
g_string_printf (nmc->return_text, _("Error: NameHasOwner request failed: %s"),
(err && err->message) ? err->message : _("(unknown)"));
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
g_propagate_error (error, err);
goto done;
}
done:
if (connection)
dbus_g_connection_unref (connection);
if (proxy)
g_object_unref (proxy);
return has_owner;
} | false | false | false | false | false | 0 |
scanHeap(int mark_soft_refs) {
for(mark_scan_ptr = heapbase; mark_scan_ptr < heaplimit;) {
uintptr_t hdr = HEADER(mark_scan_ptr);
uintptr_t size;
if(HDR_ALLOCED(hdr)) {
Object *ob = (Object*)(mark_scan_ptr + HEADER_SIZE);
int mark = IS_MARKED(ob);
size = HDR_SIZE(hdr);
if(mark) {
markChildren(ob, mark, mark_soft_refs);
markStack(mark_soft_refs);
}
} else
size = hdr;
/* Skip to next block */
mark_scan_ptr += size;
}
} | false | false | false | false | false | 0 |
voutlet_dspprolog(struct _voutlet *x, t_signal **parentsigs,
int myvecsize, int calcsize, int phase, int period, int frequency,
int downsample, int upsample, int reblock, int switched)
{
/* no buffer means we're not a signal outlet */
if (!x->x_buf)
return;
x->x_updown.downsample=downsample;
x->x_updown.upsample=upsample;
x->x_justcopyout = (switched && !reblock);
if (reblock)
{
x->x_directsignal = 0;
}
else
{
if (!parentsigs) bug("voutlet_dspprolog");
x->x_directsignal =
parentsigs[outlet_getsignalindex(x->x_parentoutlet)];
}
} | false | false | false | true | false | 1 |
save_state (GnomeClient *client,
gint phase,
GnomeRestartStyle save_style,
gint shutdown,
GnomeInteractStyle interact_style,
gint fast,
gpointer client_data)
{
char *argv[20];
int i = 0, j;
gint xpos, ypos;
gdk_window_get_origin (window->window, &xpos, &ypos);
argv[i++] = (char *) client_data;
argv[i++] = "-x";
argv[i++] = nstr (xpos);
argv[i++] = "-y";
argv[i++] = nstr (ypos);
gnome_client_set_restart_command (client, i, argv);
/* i.e. clone_command = restart_command - '--sm-client-id' */
gnome_client_set_clone_command (client, 0, NULL);
for (j = 2; j < i; j += 2)
free (argv[j]);
return TRUE;
} | false | false | false | false | false | 0 |
dig_angle_next_line(struct Plus_head *plus, plus_t current_line, int side,
int type)
{
int i, next;
int current;
int line;
plus_t node;
P_NODE *Node;
P_LINE *Line;
const char *dstr;
int debug_level;
dstr = G__getenv("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
else
debug_level = 0;
G_debug(3, "dig__angle_next_line: line = %d, side = %d, type = %d",
current_line, side, type);
Line = plus->Line[abs(current_line)];
if (current_line > 0)
node = Line->N1;
else
node = Line->N2;
G_debug(3, " node = %d", node);
Node = plus->Node[node];
G_debug(3, " n_lines = %d", Node->n_lines);
/* avoid loop when not debugging */
if (debug_level > 2) {
for (i = 0; i < Node->n_lines; i++) {
G_debug(3, " i = %d line = %d angle = %f", i, Node->lines[i],
Node->angles[i]);
}
}
/* first find index for that line */
next = -1;
for (current = 0; current < Node->n_lines; current++) {
if (Node->lines[current] == current_line)
next = current;
}
if (next == -1)
return 0; /* not found */
G_debug(3, " current position = %d", next);
while (1) {
if (side == GV_RIGHT) { /* go up (greater angle) */
if (next == Node->n_lines - 1)
next = 0;
else
next++;
}
else { /* go down (smaller angle) */
if (next == 0)
next = Node->n_lines - 1;
else
next--;
}
G_debug(3, " next = %d line = %d angle = %f", next,
Node->lines[next], Node->angles[next]);
if (Node->angles[next] == -9.) { /* skip points and degenerated */
G_debug(3, " point/degenerated -> skip");
if (Node->lines[next] == current_line)
break; /* Yes, that may happen if input line is degenerated and isolated and this breaks loop */
else
continue;
}
line = abs(Node->lines[next]);
Line = plus->Line[line];
if (Line->type & type) { /* line found */
G_debug(3, " this one");
return (Node->lines[next]);
}
/* input line reached, this must be last, because current_line may be correct return value (dangle) */
if (Node->lines[next] == current_line)
break;
}
G_debug(3, " Line NOT found at node %d", (int)node);
return 0;
} | false | false | false | false | true | 1 |
get_text_tile_info( int offset ){
const data16_t *source = sys16_textram;
int tile_number = source[offset];
int pri = tile_number >> 8;
if( sys16_textmode==2 ){ /* afterburner: ?---CCCT TTTTTTTT */
SET_TILE_INFO(
0,
(tile_number&0x1ff) + sys16_tile_bank0 * 0x1000,
512+384+((tile_number>>9)&0x7),
0)
}
else if(sys16_textmode==0){
SET_TILE_INFO(
0,
(tile_number&0x1ff) + sys16_tile_bank0 * 0x1000,
(tile_number>>9)%8,
0)
}
else{
SET_TILE_INFO(
0,
(tile_number&0xff) + sys16_tile_bank0 * 0x1000,
(tile_number>>8)%8,
0)
}
if(pri>=sys16_textlayer_lo_min && pri<=sys16_textlayer_lo_max)
tile_info.priority = 1;
if(pri>=sys16_textlayer_hi_min && pri<=sys16_textlayer_hi_max)
tile_info.priority = 0;
} | false | false | false | false | false | 0 |
CloseZipU(HZIP hz)
{ if (hz==0) {lasterrorU=ZR_ARGS;return ZR_ARGS;}
TUnzipHandleData *han = (TUnzipHandleData*)hz;
if (han->flag!=1) {lasterrorU=ZR_ZMODE;return ZR_ZMODE;}
TUnzip *unz = han->unz;
lasterrorU = unz->Close();
delete unz;
delete han;
return lasterrorU;
} | false | false | false | false | false | 0 |
genie_get_sound (NODE_T * p)
{
A68_INT channel, sample;
A68_SOUND w;
int addr, k, n, z, m;
BYTE_T *d;
POP_OBJECT (p, &sample, A68_INT);
POP_OBJECT (p, &channel, A68_INT);
POP_OBJECT (p, &w, A68_SOUND);
if (!(VALUE (&channel) >= 1 && VALUE (&channel) <= (int) NUM_CHANNELS (&w))) {
diagnostic_node (A68_RUNTIME_ERROR, p, ERROR_SOUND_INTERNAL, MODE (SOUND), "channel index out of range");
exit_genie (p, A68_RUNTIME_ERROR);
}
if (!(VALUE (&sample) >= 1 && VALUE (&sample) <= (int) NUM_SAMPLES (&w))) {
diagnostic_node (A68_RUNTIME_ERROR, p, ERROR_SOUND_INTERNAL, MODE (SOUND), "sample index out of range");
exit_genie (p, A68_RUNTIME_ERROR);
}
if (IS_NIL (DATA (&w))) {
diagnostic_node (A68_RUNTIME_ERROR, p, ERROR_SOUND_INTERNAL, MODE (SOUND), "sound has no data");
exit_genie (p, A68_RUNTIME_ERROR);
}
n = A68_SOUND_BYTES (&w);
addr = ((VALUE (&sample) - 1) * (int) (NUM_CHANNELS (&w)) + (VALUE (&channel) - 1)) * n;
ABEND (addr < 0 || addr >= (int) DATA_SIZE (&w), ERROR_INTERNAL_CONSISTENCY, NO_TEXT);
d = &(ADDRESS (&(DATA (&w)))[addr]);
/* Convert from little-endian, irrespective from the platform we work on */
for (k = 0, z = 0, m = 0; k < n; k++) {
z += ((int) (d[k]) * (int) (pow256[k]));
m = k;
}
PUSH_PRIMITIVE (p, (d[m] & 0x80 ? (n == 4 ? z : z - (int) pow256[m + 1]) : z), A68_INT);
} | false | false | false | false | false | 0 |
show_size( off_t size )
{
switch ( sizefmt )
{
case SF_BYTES:
(void) printf( "%ld", (long) size ); /* spec says should have commas */
break;
case SF_ABBREV:
if ( size < 1024 )
(void) printf( "%ld", (long) size );
else if ( size < 1024 )
(void) printf( "%ldK", (long) size / 1024L );
else if ( size < 1024*1024 )
(void) printf( "%ldM", (long) size / (1024L*1024L) );
else
(void) printf( "%ldG", (long) size / (1024L*1024L*1024L) );
break;
}
} | false | false | false | false | false | 0 |
build_v2_class_reference_decl (tree ident)
{
tree decl;
char buf[BUFSIZE];
snprintf (buf, BUFSIZE, "_OBJC_ClassRef_%s", IDENTIFIER_POINTER (ident));
decl = start_var_decl (objc_class_type, buf);
OBJCMETA (decl, objc_meta, meta_class_ref);
return decl;
} | false | false | false | false | false | 0 |
hirsch_ps_dyn(const float* prof1,const int* seq2,struct hirsch_mem* hm, int* hirsch_path,int sip)
{
int mid = ((hm->enda - hm->starta) / 2)+ hm->starta;
float input_states[6] = {hm->f[0].a,hm->f[0].ga,hm->f[0].gb,hm->b[0].a,hm->b[0].ga,hm->b[0].gb};
int old_cor[5] = {hm->starta,hm->enda,hm->startb,hm->endb,mid};
if(hm->starta >= hm->enda){
return hirsch_path;
}
if(hm->startb >= hm->endb){
return hirsch_path;
}
hm->enda = mid;
hm->f = foward_hirsch_ps_dyn(prof1,seq2,hm,sip);
/*int i;
fprintf(stderr,"FOWARD\n");
for (i = hm->startb; i <= hm->endb;i++){
fprintf(stderr,"%d %d %d\n",hm->f[i].a,hm->f[i].ga,hm->f[i].gb);
}*/
hm->starta = mid;
hm->enda = old_cor[1];
hm->b = backward_hirsch_ps_dyn(prof1,seq2,hm,sip);
/*fprintf(stderr,"BaCKWARD\n");
for (i = hm->startb; i <= hm->endb;i++){
fprintf(stderr,"%d %d %d\n",hm->b[i].a,hm->b[i].ga,hm->b[i].gb);
}*/
hirsch_path = hirsch_align_two_ps_vector(prof1,seq2,hm,hirsch_path,input_states,old_cor,sip);
return hirsch_path;
} | false | false | false | false | false | 0 |
onPaint(FXObject*,FXSelector,void*){
#ifdef HAVE_GL_H
FXGLVisual *vis=(FXGLVisual*)getVisual();
FXASSERT(xid);
if(makeCurrent()){
drawWorld(wvt);
if(vis->isDoubleBuffer()) swapBuffers();
makeNonCurrent();
}
#endif
return 1;
} | false | false | false | false | false | 0 |
sel_make_classes(void)
{
int rc, nclasses, i;
char **classes;
/* delete any existing entries */
sel_remove_entries(class_dir);
rc = security_get_classes(&classes, &nclasses);
if (rc)
return rc;
/* +2 since classes are 1-indexed */
last_class_ino = sel_class_to_ino(nclasses + 2);
for (i = 0; i < nclasses; i++) {
struct dentry *class_name_dir;
class_name_dir = sel_make_dir(class_dir, classes[i],
&last_class_ino);
if (IS_ERR(class_name_dir)) {
rc = PTR_ERR(class_name_dir);
goto out;
}
/* i+1 since class values are 1-indexed */
rc = sel_make_class_dir_entries(classes[i], i + 1,
class_name_dir);
if (rc)
goto out;
}
rc = 0;
out:
for (i = 0; i < nclasses; i++)
kfree(classes[i]);
kfree(classes);
return rc;
} | false | false | false | false | false | 0 |
exp_table(float x)
{
int index;
index = (int) ((x + 16.0) * 1000.0);
if (index >= EXP_TABLE_LEN)
index = EXP_TABLE_LEN - 1;
else if (index < 0)
index = 0;
return (exp_data[index]);
} | false | false | false | false | false | 0 |
HISsync(struct history *h)
{
bool r = false;
if (his_checknull(h))
return false;
TMRstart(TMR_HISSYNC);
r = (*h->methods->sync)(h->sub);
TMRstop(TMR_HISSYNC);
return r;
} | false | false | false | false | false | 0 |
tdfxBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
{
TDFXDriverData *tdrv = (TDFXDriverData*) drv;
TDFXDeviceData *tdev = (TDFXDeviceData*) dev;
Voodoo2D *voodoo2D = tdrv->voodoo2D;
u32 cmd = 1 | (1 <<8) | (0xCC << 24);//SST_2D_GO | SST_2D_SCRNTOSCRNBLIT | (ROP_COPY << 24);
if (rect->x <= dx) {
cmd |= (1 << 14);//SST_2D_X_RIGHT_TO_LEFT;
rect->x += rect->w-1;
dx += rect->w-1;
}
if (rect->y <= dy) {
cmd |= (1 << 15);//SST_2D_Y_BOTTOM_TO_TOP;
rect->y += rect->h-1;
dy += rect->h-1;
}
tdfx_waitfifo( tdrv, tdev, 4 );
voodoo2D->srcXY = ((rect->y & 0x1FFF) << 16) | (rect->x & 0x1FFF);
voodoo2D->dstXY = ((dy & 0x1FFF) << 16) | (dx & 0x1FFF);
voodoo2D->dstSize = ((rect->h & 0x1FFF) << 16) | (rect->w & 0x1FFF);
voodoo2D->command = cmd;
return true;
} | false | false | false | false | false | 0 |
toXml() const
{
switch (_type) {
case TypeNil: return nilToXml();
case TypeBoolean: return boolToXml();
case TypeInt: return intToXml();
case TypeDouble: return doubleToXml();
case TypeString: return stringToXml();
case TypeDateTime: return timeToXml();
case TypeBase64: return binaryToXml();
case TypeArray: return arrayToXml();
case TypeStruct: return structToXml();
default: break;
}
return std::string(); // Invalid value
} | false | false | false | false | false | 0 |
readstdin(int len)
{
int ll, l1, lt, lr;
int cpulim;
cpulim=rlimit_cpu; rlimit_cpu=3;
lr=len; l1=0;
while(lr>0) {
nowtime=time(0); initalarm();
ll=lr; if(ll>READSTDIN_WINDOW) ll=READSTDIN_WINDOW;
lt=fread(stdinbuf+l1,1,ll,stdin);
if(lt!=ll) user_error("parm_too_long");
lr-=ll; l1+=ll;
}
if(l1!=len) user_error("parm_too_long");
stdinbuf[len]=0; rlimit_cpu=cpulim;
} | false | false | false | false | true | 1 |
qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
{
struct qcaspi *qca = netdev_priv(dev);
if ((ring->rx_pending) ||
(ring->rx_mini_pending) ||
(ring->rx_jumbo_pending))
return -EINVAL;
if (netif_running(dev))
qcaspi_netdev_close(dev);
qca->txr.count = max_t(u32, ring->tx_pending, TX_RING_MIN_LEN);
qca->txr.count = min_t(u16, qca->txr.count, TX_RING_MAX_LEN);
if (netif_running(dev))
qcaspi_netdev_open(dev);
return 0;
} | false | false | false | false | false | 0 |
gucharmap_chartable_paste_received_cb (GtkClipboard *clipboard,
const char *text,
gpointer user_data)
{
gpointer *data = (gpointer *) user_data;
GucharmapChartable *chartable = *data;
gunichar wc;
g_slice_free (gpointer, data);
if (!chartable)
return;
g_object_remove_weak_pointer (G_OBJECT (chartable), data);
if (!text)
return;
wc = g_utf8_get_char_validated (text, -1);
if (wc == 0 ||
!gucharmap_unichar_validate (wc)) {
gtk_widget_error_bell (GTK_WIDGET (chartable));
return;
}
gucharmap_chartable_set_active_character (chartable, wc);
} | false | false | false | false | false | 0 |
createDockWindows()
{
int size1 = 0;
int size2 = 0;
const QByteArray& state = settings->mainWindowState();
if (!state.isEmpty()) {
const int* sizes = (const int*)state.constData();
size1 = sizes[0];
size2 = sizes[1];
}
propertyDock = new QDockWidget(tr("Properties"), this);
propertyDock->setObjectName("GLEPropertyEditor");
propertyDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, propertyDock);
propertyEditor = new GLEPropertyEditor(propertyDock, size1);
propertyDock->setWidget(propertyEditor);
objectBlocksDock = new QDockWidget(tr("Objects"), this);
objectBlocksDock->setObjectName("GLEObjectBlocksList");
objectBlocksDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, objectBlocksDock);
objectBlocksList = new GLEObjectBlocksList(objectBlocksDock, this, drawingArea, size2);
objectBlocksDock->setWidget(objectBlocksList);
} | false | false | false | false | false | 0 |
sky81452_reg_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct regulator_init_data *init_data = dev_get_platdata(dev);
struct regulator_config config = { };
struct regulator_dev *rdev;
config.dev = dev->parent;
config.init_data = init_data;
config.of_node = dev->of_node;
config.regmap = dev_get_drvdata(dev->parent);
rdev = devm_regulator_register(dev, &sky81452_reg, &config);
if (IS_ERR(rdev)) {
dev_err(dev, "failed to register. err=%ld\n", PTR_ERR(rdev));
return PTR_ERR(rdev);
}
platform_set_drvdata(pdev, rdev);
return 0;
} | false | false | false | false | false | 0 |
protein_ramachandran_phi( const MMonomer& m1, const MMonomer& m2 )
{
ftype result = clipper::Util::nan();
int index_cx = m1.lookup( " C ", clipper::MM::ANY );
int index_n = m2.lookup( " N ", clipper::MM::ANY );
int index_ca = m2.lookup( " CA ", clipper::MM::ANY );
int index_c = m2.lookup( " C ", clipper::MM::ANY );
// if we have all three atoms, then add residue
if ( index_cx >= 0 && index_ca >= 0 && index_c >= 0 && index_n >= 0 ) {
Coord_orth coord_cx = m1[index_cx].coord_orth();
Coord_orth coord_n = m2[index_n ].coord_orth();
Coord_orth coord_ca = m2[index_ca].coord_orth();
Coord_orth coord_c = m2[index_c ].coord_orth();
// ramachandran calc
result = Coord_orth::torsion( coord_cx, coord_n, coord_ca, coord_c );
}
return result;
} | false | false | false | false | false | 0 |
send_filter_frame(struct net_device *dev, int mc_cnt)
{
struct uli526x_board_info *db = netdev_priv(dev);
void __iomem *ioaddr = db->ioaddr;
struct netdev_hw_addr *ha;
struct tx_desc *txptr;
u16 * addrptr;
u32 * suptr;
int i;
ULI526X_DBUG(0, "send_filter_frame()", 0);
txptr = db->tx_insert_ptr;
suptr = (u32 *) txptr->tx_buf_ptr;
/* Node address */
addrptr = (u16 *) dev->dev_addr;
*suptr++ = addrptr[0] << FLT_SHIFT;
*suptr++ = addrptr[1] << FLT_SHIFT;
*suptr++ = addrptr[2] << FLT_SHIFT;
/* broadcast address */
*suptr++ = 0xffff << FLT_SHIFT;
*suptr++ = 0xffff << FLT_SHIFT;
*suptr++ = 0xffff << FLT_SHIFT;
/* fit the multicast address */
netdev_for_each_mc_addr(ha, dev) {
addrptr = (u16 *) ha->addr;
*suptr++ = addrptr[0] << FLT_SHIFT;
*suptr++ = addrptr[1] << FLT_SHIFT;
*suptr++ = addrptr[2] << FLT_SHIFT;
}
for (i = netdev_mc_count(dev); i < 14; i++) {
*suptr++ = 0xffff << FLT_SHIFT;
*suptr++ = 0xffff << FLT_SHIFT;
*suptr++ = 0xffff << FLT_SHIFT;
}
/* prepare the setup frame */
db->tx_insert_ptr = txptr->next_tx_desc;
txptr->tdes1 = cpu_to_le32(0x890000c0);
/* Resource Check and Send the setup packet */
if (db->tx_packet_cnt < TX_DESC_CNT) {
/* Resource Empty */
db->tx_packet_cnt++;
txptr->tdes0 = cpu_to_le32(0x80000000);
update_cr6(db->cr6_data | 0x2000, ioaddr);
uw32(DCR1, 0x1); /* Issue Tx polling */
update_cr6(db->cr6_data, ioaddr);
dev->trans_start = jiffies;
} else
netdev_err(dev, "No Tx resource - Send_filter_frame!\n");
} | false | false | false | false | false | 0 |
sig_catch(int sig_no)
{
if(SIGINT == sig_no || SIGTERM == sig_no){
Tracker.ClearRestart();
Tracker.SetStoped();
signal(sig_no,sig_catch2);
}
} | false | false | false | false | false | 0 |
DumpTString(TaggedString* s, FILE* D)
{
if (s==NULL)
DumpString(NULL,0,D);
else
DumpString(s->str,s->u.s.len+1,D);
} | false | false | false | false | false | 0 |
on_ok_button()
{
if(board.getLayout().isValid())
{
hide();
signal_on_close(board.getLayout());
signal_on_close.clear();
}
else
error_dialog("This is not a valid board. There has to "\
"be at least one piece of each color and "\
"player 1 must be able to make a move.", Gtk::MESSAGE_INFO);
} | false | false | false | false | false | 0 |
ocsp_ResponderIDTypeByTag(int derTag)
{
CERTOCSPResponderIDType responderIDType;
switch (derTag) {
case 1:
responderIDType = ocspResponderID_byName;
break;
case 2:
responderIDType = ocspResponderID_byKey;
break;
default:
responderIDType = ocspResponderID_other;
break;
}
return responderIDType;
} | false | false | false | false | false | 0 |
isns_scn_setup(isns_scn_t *scn, isns_object_t *node)
{
isns_object_list_t portals = ISNS_OBJECT_LIST_INIT;
isns_object_t *entity;
unsigned int i;
entity = isns_object_get_entity(node);
if (entity == NULL
|| !isns_object_find_descendants(entity,
&isns_portal_template, NULL, &portals))
return NULL;
for (i = 0; i < portals.iol_count; ++i) {
isns_object_t *portal = portals.iol_data[i];
isns_portal_info_t info;
isns_scn_funnel_t *funnel;
/* Extract address and SCN port from portal */
if (!isns_portal_from_object(&info,
ISNS_TAG_PORTAL_IP_ADDRESS,
ISNS_TAG_SCN_PORT,
portal))
continue;
/* We know where to send our notifications! */
if (scn == NULL) {
isns_attr_t *attr;
if (!isns_object_get_attr(node, ISNS_TAG_ISCSI_NAME, &attr)
&& !isns_object_get_attr(node, ISNS_TAG_FC_PORT_NAME_WWPN, &attr)) {
isns_error("Attempt to set up SCN for strange node type\n");
return NULL;
}
scn = isns_calloc(1, sizeof(*scn));
scn->scn_entity = isns_object_get(entity);
scn->scn_owner = isns_object_get(node);
scn->scn_attr = isns_attr_get(attr);
scn->scn_name = isns_strdup(attr->ia_value.iv_string);
}
funnel = isns_calloc(1, sizeof(*funnel));
funnel->scn_portal = info;
funnel->scn_next = scn->scn_funnels;
scn->scn_funnels = funnel;
}
isns_object_list_destroy(&portals);
return scn;
} | false | false | false | false | false | 0 |
ldr_split_string(struct list_main *dst, char *src)
{
char *word, *pos;
char c;
pos = src;
do {
word = pos;
while (*word && issep_map[ARCH_INDEX(*word)]) word++;
if (!*word) break;
pos = word;
while (!issep_map[ARCH_INDEX(*pos)]) pos++;
c = *pos;
*pos = 0;
list_add_unique(dst, word);
*pos++ = c;
} while (c && dst->count < LDR_WORDS_MAX);
} | false | false | false | false | false | 0 |
drawMsgWin( WINDOW* win, std::vector<std::string> words )
{
wclear( win );
box( win, 0, 0 );
int i = 1;
std::vector<std::string>::const_iterator j = words.begin();
while( j != words.end() ) {
mvwprintw( win, i, 1, j->c_str() );
i++;
j++;
}
wrefresh( win );
} | false | false | false | false | false | 0 |
check_input(){
int i ;
printf("check input\n");
printf("%d,%d,%d,%d\n",frame.ll.x,frame.ll.y,frame.ur.x,frame.ur.y);
printf("source %d %d %d %d\n", source.name, source.location.x,source.location.y,source.bufname);
printf("num sink %d\n",sink.num);
for(i=0;i<sink.num; i++){
printf("%d %d %d %d\n", sink.pool[i].index,sink.pool[i].x, sink.pool[i].y, sink.pool[i].lc);
}
printf("num wirelib %d\n", wirelib.num);
for(i=0;i<wirelib.num;i++)
printf("%d %f %f\n",wirelib.lib[i].wiretype,wirelib.lib[i].r,wirelib.lib[i].c);
printf("num buflib %d\n", buflib.num);
for(i=0;i<buflib.num;i++)
printf("%d %s %d %f %f %f\n",buflib.lib[i].buf_id,buflib.lib[i].spice_subckt,buflib.lib[i].inverted, buflib.lib[i].icap,buflib.lib[i].ocap,buflib.lib[i].ores);
printf("simulation vdd %f %f\n",vddlib.lib[0],vddlib.lib[1]);
printf("limit slew %d\n", SlewLimit);
printf("limit cap %d\n", CapLimit);
printf("num blockage %d\n", blockage.num);
for(i=0;i<blockage.num;i++){
printf("%d %d %d %d\n",blockage.pool[i].ll.x,blockage.pool[i].ll.y,blockage.pool[i].ur.x,blockage.pool[i].ur.y);
}
return 0 ;
} | false | false | false | false | false | 0 |
dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
struct i2c_msg *msg, int num)
{
struct dvb_usb_device *d = i2c_get_adapdata(adap);
struct dib0700_state *st = d->priv;
int i,len;
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EINTR;
if (mutex_lock_interruptible(&d->usb_mutex) < 0) {
err("could not acquire lock");
mutex_unlock(&d->i2c_mutex);
return -EINTR;
}
for (i = 0; i < num; i++) {
/* fill in the address */
st->buf[1] = msg[i].addr << 1;
/* fill the buffer */
memcpy(&st->buf[2], msg[i].buf, msg[i].len);
/* write/read request */
if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
st->buf[0] = REQUEST_I2C_READ;
st->buf[1] |= 1;
/* special thing in the current firmware: when length is zero the read-failed */
len = dib0700_ctrl_rd(d, st->buf, msg[i].len + 2,
msg[i+1].buf, msg[i+1].len);
if (len <= 0) {
deb_info("I2C read failed on address 0x%02x\n",
msg[i].addr);
break;
}
msg[i+1].len = len;
i++;
} else {
st->buf[0] = REQUEST_I2C_WRITE;
if (dib0700_ctrl_wr(d, st->buf, msg[i].len + 2) < 0)
break;
}
}
mutex_unlock(&d->usb_mutex);
mutex_unlock(&d->i2c_mutex);
return i;
} | false | true | false | false | false | 1 |
throw_error(CELL error, F_STACK_FRAME *callstack_top)
{
/* If the error handler is set, we rewind any C stack frames and
pass the error to user-space. */
if(userenv[BREAK_ENV] != F)
{
/* If error was thrown during heap scan, we re-enable the GC */
gc_off = false;
/* Reset local roots */
gc_locals = gc_locals_region->start - CELLS;
extra_roots = extra_roots_region->start - CELLS;
/* If we had an underflow or overflow, stack pointers might be
out of bounds */
fix_stacks();
dpush(error);
/* Errors thrown from C code pass NULL for this parameter.
Errors thrown from Factor code, or signal handlers, pass the
actual stack pointer at the time, since the saved pointer is
not necessarily up to date at that point. */
if(callstack_top)
{
callstack_top = fix_callstack_top(callstack_top,
stack_chain->callstack_bottom);
}
else
callstack_top = stack_chain->callstack_top;
throw_impl(userenv[BREAK_ENV],callstack_top);
}
/* Error was thrown in early startup before error handler is set, just
crash. */
else
{
print_string("You have triggered a bug in Factor. Please report.\n");
print_string("early_error: ");
print_obj(error);
nl();
factorbug();
}
} | false | false | false | false | false | 0 |
ISolveWithin(const Spline *spline,int major,
extended val,extended tlow, extended thigh) {
Spline1D temp;
extended ts[3];
const Spline1D *sp = &spline->splines[major];
int i;
/* Calculation for t=1 can yield rounding errors. Insist on the endpoints */
/* (the Spline1D is not a perfectly accurate description of the spline, */
/* but the control points are right -- at least that's my defn.) */
if ( tlow==0 && val==(&spline->from->me.x)[major] )
return( 0 );
if ( thigh==1.0 && val==(&spline->to->me.x)[major] )
return( 1.0 );
temp = *sp;
temp.d -= val;
IterateSolve(&temp,ts);
if ( tlow<thigh ) {
for ( i=0; i<3; ++i )
if ( ts[i]>=tlow && ts[i]<=thigh )
return( ts[i] );
for ( i=0; i<3; ++i ) {
if ( ts[i]>=tlow-1./1024. && ts[i]<=tlow )
return( tlow );
if ( ts[i]>=thigh && ts[i]<=thigh+1./1024 )
return( thigh );
}
} else {
for ( i=0; i<3; ++i )
if ( ts[i]>=thigh && ts[i]<=tlow )
return( ts[i] );
for ( i=0; i<3; ++i ) {
if ( ts[i]>=thigh-1./1024. && ts[i]<=thigh )
return( thigh );
if ( ts[i]>=tlow && ts[i]<=tlow+1./1024 )
return( tlow );
}
}
return( -1 );
} | false | false | false | false | false | 0 |
setOriginator(const char *aetitle)
{
if ((aetitle == NULL) || (strlen(aetitle) == 0))
return originator.clear();
else
return originator.putString(aetitle);
} | false | false | false | false | false | 0 |
runtime_initialized (MonoProfiler *prof)
{
process_profiler_event (EVENT_KIND_VM_START, mono_thread_current ());
if (agent_config.defer)
start_debugger_thread ();
} | false | false | false | false | false | 0 |
PublishItem(
const std::string& itemid, XmlElement* payload, std::string* task_id_out) {
std::vector<XmlElement*> children;
children.push_back(payload);
PublishItem(itemid, children, task_id_out);
} | false | false | false | false | false | 0 |
handle_focus_out(event_t *ev)
{
D_EVENTS(("handle_focus_out(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
if (TermWin.focus) {
TermWin.focus = 0;
if (images[image_bg].current != images[image_bg].disabled) {
images[image_bg].current = images[image_bg].disabled;
redraw_image(image_bg);
}
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) {
map_scrollbar(0);
} else {
scrollbar_set_focus(TermWin.focus);
scrollbar_draw(IMAGE_STATE_DISABLED, MODE_SOLID);
}
bbar_draw_all(IMAGE_STATE_DISABLED, MODE_SOLID);
#ifdef USE_XIM
if (xim_input_context)
XUnsetICFocus(xim_input_context);
#endif
}
return 1;
} | false | false | false | false | false | 0 |
lxt2_wr_set_initial_value(struct lxt2_wr_trace *lt, char value)
{
if(lt)
{
switch(value)
{
case '0':
case '1':
case 'x':
case 'z': break;
case 'Z': value = 'z'; break;
default: value = 'x'; break;
}
lt->initial_value = value;
}
} | 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.