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 |
|---|---|---|---|---|---|---|
automap_edges_mindist(void)
{
edgelist *p;
for(p = all_edges; p; p=p->next) {
int len = p->node->is_oneway ? 4 : 2;
p->node->min_length = p->node->guess_length = len;
}
} | false | false | false | false | false | 0 |
FindAttribute(const char* attr, Direction dir) const
{
if (attr)
{
if (dir == Both || dir == Encode)
{
avm::vector<AttributeInfo>::const_iterator it;
for (it = encoder_info.begin(); it != encoder_info.end(); it++)
if (it->IsAttr(attr))
return &(*it);
}
if (dir == Both || dir == Decode)
{
avm::vector<AttributeInfo>::const_iterator it;
for (it = decoder_info.begin(); it != decoder_info.end(); it++)
if (it->IsAttr(attr))
return &(*it);
}
}
return 0;
} | false | false | false | false | false | 0 |
cnic_get_vlan(struct net_device *dev,
struct net_device **vlan_dev)
{
if (dev->priv_flags & IFF_802_1Q_VLAN) {
*vlan_dev = vlan_dev_real_dev(dev);
return vlan_dev_vlan_id(dev);
}
*vlan_dev = dev;
return 0;
} | false | false | false | false | false | 0 |
midgard_core_dbcolumn_new(void)
{
MidgardDBColumn *mdc = g_new(MidgardDBColumn, 1);
mdc->table_name = NULL;
mdc->column_name = NULL;
mdc->column_desc = NULL;
mdc->dbtype = NULL;
mdc->gtype = 0;
mdc->index = FALSE;
mdc->unique = FALSE;
mdc->gvalue = NULL;
mdc->primary = FALSE;
mdc->dvalue = NULL;
mdc->autoinc = FALSE;
return mdc;
} | false | false | false | false | false | 0 |
pixmapToBase64(const QPixmap &pixmap)
{
QByteArray byteArray;
if (pixmap.isNull())
return byteArray;
QBuffer buffer(&byteArray);
if (!pixmap.save(&buffer, "PNG")) {
LOG_ERROR_FOR("Global",
QString("Unable to transform QPixmap to base64 QByteArray. "
"Pixmap size: (%1,%2)")
.arg(pixmap.size().width())
.arg(pixmap.size().height()));
return QByteArray();
}
return byteArray.toBase64();
} | false | false | false | false | false | 0 |
wait_or_whine(pid_t pid, const char *argv0, int silent_exec_failure)
{
int status, code = -1;
pid_t waiting;
int failed_errno = 0;
while ((waiting = waitpid(pid, &status, 0)) < 0 && errno == EINTR)
; /* nothing */
if (waiting < 0) {
failed_errno = errno;
error("waitpid for %s failed: %s", argv0, strerror(errno));
} else if (waiting != pid) {
error("waitpid is confused (%s)", argv0);
} else if (WIFSIGNALED(status)) {
code = WTERMSIG(status);
error("%s died of signal %d", argv0, code);
/*
* This return value is chosen so that code & 0xff
* mimics the exit code that a POSIX shell would report for
* a program that died from this signal.
*/
code -= 128;
} else if (WIFEXITED(status)) {
code = WEXITSTATUS(status);
/*
* Convert special exit code when execvp failed.
*/
if (code == 127) {
code = -1;
failed_errno = ENOENT;
if (!silent_exec_failure)
error("cannot run %s: %s", argv0,
strerror(ENOENT));
}
} else {
error("waitpid is confused (%s)", argv0);
}
errno = failed_errno;
return code;
} | false | false | false | false | false | 0 |
visitStoreInst(StoreInst &SI) {
auto &DL = SI.getModule()->getDataLayout();
uint64_t Size = DL.getTypeStoreSize(SI.getValueOperand()->getType());
if (Size == 0)
return;
uint64_t Align;
if (ClPreserveAlignment) {
Align = SI.getAlignment();
if (Align == 0)
Align = DL.getABITypeAlignment(SI.getValueOperand()->getType());
} else {
Align = 1;
}
Value* Shadow = DFSF.getShadow(SI.getValueOperand());
if (ClCombinePointerLabelsOnStore) {
Value *PtrShadow = DFSF.getShadow(SI.getPointerOperand());
Shadow = DFSF.combineShadows(Shadow, PtrShadow, &SI);
}
DFSF.storeShadow(SI.getPointerOperand(), Size, Align, Shadow, &SI);
} | false | false | false | false | false | 0 |
popup_candidate_window (GtkIMContextHangul *hcontext)
{
char* key;
HanjaList* list;
if (hcontext->candidate != NULL)
{
close_candidate_window(hcontext);
}
if (hanja_table == NULL)
hanja_table = hanja_table_load(NULL);
key = im_hangul_get_candidate_string(hcontext);
list = hanja_table_match_suffix(hanja_table, key);
if (list != NULL) {
hcontext->candidate = candidate_new (key,
9,
list,
hcontext->client_window,
&hcontext->cursor,
hcontext);
}
g_free(key);
} | false | false | false | false | false | 0 |
sqrt_vec(int n, float *vec)
{
int i;
double d;
for (i = 0; i < n; i++) {
/* do this in two steps to avoid a bug in gcc-4.00 on AIX */
d = sqrt(vec[i]);
vec[i] = (float) d;
}
} | false | false | false | false | false | 0 |
TAES_ENCRYPT(bst128 in,u32* rkey_enc,bst128 counter){
bst128 out;
int i;
u32 tempcount;
/*set rkeys 1,5,9 using the backups*/
for(i=0;i<4;i++){
tempcount=SWAP(counter.t[i]);
rkey_enc[4+i]=rkey_enc[44+i]^tempcount;
rkey_enc[20+i]=rkey_enc[48+i]^tempcount;
rkey_enc[36+i]=rkey_enc[52+i]^tempcount;
}
rijndaelEncrypt(rkey_enc,10,in.b,out.b);
return out;
} | false | false | false | false | false | 0 |
defineDotEdges(pANTLR3_BASE_TREE_ADAPTOR adaptor, void * t, pANTLR3_STRING dotSpec)
{
// How many nodes are we talking about?
//
int nCount;
int i;
if (t == NULL)
{
// No tree, so do nothing
//
return;
}
// Count the nodes
//
nCount = adaptor->getChildCount(adaptor, t);
if (nCount == 0)
{
// This will already have been included as a child of another node
// so there is nothing to add.
//
return;
}
// For each child, define an edge from this parent, then process
// and children of this child in the same way
//
for (i=0; i<nCount; i++)
{
pANTLR3_BASE_TREE child;
char buff[128];
pANTLR3_STRING text;
int j;
// Next child
//
child = adaptor->getChild(adaptor, t, i);
// Create the edge relation
//
sprintf(buff, "\t\tn%p -> n%p\t\t// ", t, child);
dotSpec->append8(dotSpec, buff);
// Document the relationship
//
text = adaptor->getText(adaptor, t);
for (j = 0; j < (ANTLR3_INT32)(text->len); j++)
{
switch(text->charAt(text, j))
{
case '"':
dotSpec->append8(dotSpec, "\\\"");
break;
case '\n':
dotSpec->append8(dotSpec, "\\n");
break;
case '\r':
dotSpec->append8(dotSpec, "\\r");
break;
default:
dotSpec->addc(dotSpec, text->charAt(text, j));
break;
}
}
dotSpec->append8(dotSpec, " -> ");
text = adaptor->getText(adaptor, child);
for (j = 0; j < (ANTLR3_INT32)(text->len); j++)
{
switch(text->charAt(text, j))
{
case '"':
dotSpec->append8(dotSpec, "\\\"");
break;
case '\n':
dotSpec->append8(dotSpec, "\\n");
break;
case '\r':
dotSpec->append8(dotSpec, "\\r");
break;
default:
dotSpec->addc(dotSpec, text->charAt(text, j));
break;
}
}
dotSpec->append8(dotSpec, "\n");
// Define edges for this child
//
defineDotEdges(adaptor, child, dotSpec);
}
// Done
//
return;
} | true | true | false | false | false | 1 |
DefineAccessor(String* name,
bool is_getter,
Object* fun,
PropertyAttributes attributes) {
ASSERT(fun->IsJSFunction() || fun->IsUndefined());
// Check access rights if needed.
if (IsAccessCheckNeeded() &&
!Top::MayNamedAccess(this, name, v8::ACCESS_SET)) {
Top::ReportFailedAccessCheck(this, v8::ACCESS_SET);
return Heap::undefined_value();
}
if (IsJSGlobalProxy()) {
Object* proto = GetPrototype();
if (proto->IsNull()) return this;
ASSERT(proto->IsJSGlobalObject());
return JSObject::cast(proto)->DefineAccessor(name, is_getter,
fun, attributes);
}
Object* array;
{ MaybeObject* maybe_array = DefineGetterSetter(name, attributes);
if (!maybe_array->ToObject(&array)) return maybe_array;
}
if (array->IsUndefined()) return array;
FixedArray::cast(array)->set(is_getter ? 0 : 1, fun);
return this;
} | false | false | false | false | false | 0 |
generateKt(const Lorentz5Momentum& p1,
const Lorentz5Momentum& p2,
Energy pt) {
if ( (p1+p2).m2() <= ZERO ) {
cerr << "cannot boost ... " << ((p1+p2).m2()/GeV2) << "\n";
throw Veto();
}
Boost beta = (p1+p2).findBoostToCM();
Lorentz5Momentum p1c = p1;
if (beta.mag2() > Constants::epsilon) {
p1c.boost(beta);
}
Lorentz5Momentum k (0.*GeV,0.*GeV,0.*GeV,0.*GeV);
double ct = p1c.vect().unit().z();
double st = sqrt(1.-ct*ct);
double phi = 2.*Constants::pi*rnd();
weight *= 2.*Constants::pi;
double cphi = cos(phi);
double sphi = sqrt(1.-cphi*cphi);
if (phi > Constants::pi) sphi = -sphi;
// adding an output somewhere around here results in the correct behaviour
// when compiling with g++-4.6.1 -O3
// cerr << "bla\n" << flush;
if (st > Constants::epsilon) {
double cchi = p1c.vect().unit().x()/st;
double schi = p1c.vect().unit().y()/st;
k.setX((cphi*cchi*ct-sphi*schi)*pt);
k.setY((cphi*schi*ct+sphi*cchi)*pt);
k.setZ(-cphi*st*pt);
} else {
k.setX(pt*cphi);
k.setY(pt*sphi);
k.setZ(0.*GeV);
}
if (beta.mag2() > Constants::epsilon)
k.boost(-beta);
return k;
} | false | false | false | false | false | 0 |
rtx_equal_p (rtx x, rtx y)
{
int i;
int j;
enum rtx_code code;
const char *fmt;
if (x == y)
return 1;
if (x == 0 || y == 0)
return 0;
code = GET_CODE (x);
/* Rtx's of different codes cannot be equal. */
if (code != GET_CODE (y))
return 0;
/* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
(REG:SI x) and (REG:HI x) are NOT equivalent. */
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* Some RTL can be compared nonrecursively. */
switch (code)
{
case REG:
/* Until rtl generation is complete, don't consider a reference
to the return register of the current function the same as
the return from a called function. This eases the job of
function integration. Once the distinction is no longer
needed, they can be considered equivalent. */
return (REGNO (x) == REGNO (y)
&& (! rtx_equal_function_value_matters
|| REG_FUNCTION_VALUE_P (x) == REG_FUNCTION_VALUE_P (y)));
case LABEL_REF:
return XEXP (x, 0) == XEXP (y, 0);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
case SCRATCH:
case CONST_DOUBLE:
case CONST_INT:
case CONST_VECTOR:
return 0;
default:
break;
}
/* Compare the elements. If any pair of corresponding elements
fail to match, return 0 for the whole thing. */
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
switch (fmt[i])
{
case 'w':
if (XWINT (x, i) != XWINT (y, i))
return 0;
break;
case 'n':
case 'i':
if (XINT (x, i) != XINT (y, i))
return 0;
break;
case 'V':
case 'E':
/* Two vectors must have the same length. */
if (XVECLEN (x, i) != XVECLEN (y, i))
return 0;
/* And the corresponding elements must match. */
for (j = 0; j < XVECLEN (x, i); j++)
if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
return 0;
break;
case 'e':
if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
return 0;
break;
case 'S':
case 's':
if ((XSTR (x, i) || XSTR (y, i))
&& (! XSTR (x, i) || ! XSTR (y, i)
|| strcmp (XSTR (x, i), XSTR (y, i))))
return 0;
break;
case 'u':
/* These are just backpointers, so they don't matter. */
break;
case '0':
case 't':
break;
/* It is believed that rtx's at this level will never
contain anything but integers and other rtx's,
except for within LABEL_REFs and SYMBOL_REFs. */
default:
abort ();
}
}
return 1;
} | false | false | false | false | false | 0 |
opal_graph_destruct(opal_graph_t *graph)
{
opal_adjacency_list_t *aj_list;
while (false == opal_list_is_empty(graph->adjacency_list)) {
aj_list = (opal_adjacency_list_t *)opal_list_remove_first(graph->adjacency_list);
OBJ_RELEASE(aj_list);
}
OBJ_RELEASE(graph->adjacency_list);
graph->number_of_vertices = 0;
graph->number_of_edges = 0;
} | false | false | false | false | false | 0 |
gbemol_mpd_init (GbemolMpd *obj)
{
obj->priv = g_new0 (GbemolMpdPrivate, 1);
/* Default values */
obj->status = NULL;
obj->priv->host = g_strdup ("localhost");
obj->priv->pass = NULL;
obj->priv->port = 6600;
obj->priv->timeout = 1.0;
obj->priv->connected = FALSE;
obj->priv->conn = NULL;
obj->priv->not_commands = NULL;
} | false | false | false | false | false | 0 |
mr_nick(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
struct Client *target_p = NULL;
char nick[NICKLEN];
char *s = NULL;
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
me.name, EmptyString(parv[0]) ? "*" : parv[0]);
return;
}
/* Terminate the nick at the first ~ */
if ((s = strchr(parv[1], '~')) != NULL)
*s = '\0';
/* copy the nick and terminate it */
strlcpy(nick, parv[1], sizeof(nick));
/* check the nickname is ok */
if (!clean_nick_name(nick, 1))
{
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME),
me.name, EmptyString(parv[0]) ? "*" : parv[0], parv[1]);
return;
}
/* check if the nick is resv'd */
if (find_matching_name_conf(NRESV_TYPE, nick, NULL, NULL, 0) &&
!IsExemptResv(source_p))
{
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME),
me.name, EmptyString(parv[0]) ? "*" : parv[0], nick);
return;
}
if ((target_p = find_client(nick)) == NULL)
set_initial_nick(source_p, nick);
else if (source_p == target_p)
strlcpy(source_p->name, nick, sizeof(source_p->name));
else
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, "*", nick);
} | false | false | false | false | false | 0 |
g_box_consider_split(ConsiderSplitContext *context, int dimNum,
double rightLower, int minLeftCount,
double leftUpper, int maxLeftCount)
{
int leftCount,
rightCount;
float4 ratio,
overlap;
double range;
/*
* Calculate entries distribution ratio assuming most uniform distribution
* of common entries.
*/
if (minLeftCount >= (context->entriesCount + 1) / 2)
{
leftCount = minLeftCount;
}
else
{
if (maxLeftCount <= context->entriesCount / 2)
leftCount = maxLeftCount;
else
leftCount = context->entriesCount / 2;
}
rightCount = context->entriesCount - leftCount;
/*
* Ratio of split - quotient between size of lesser group and total
* entries count.
*/
ratio = ((float4) Min(leftCount, rightCount)) /
((float4) context->entriesCount);
if (ratio > LIMIT_RATIO)
{
bool selectthis = false;
/*
* The ratio is acceptable, so compare current split with previously
* selected one. Between splits of one dimension we search for minimal
* overlap (allowing negative values) and minimal ration (between same
* overlaps. We switch dimension if find less overlap (non-negative)
* or less range with same overlap.
*/
if (dimNum == 0)
range = context->boundingBox.high.x - context->boundingBox.low.x;
else
range = context->boundingBox.high.y - context->boundingBox.low.y;
overlap = (leftUpper - rightLower) / range;
/* If there is no previous selection, select this */
if (context->first)
selectthis = true;
else if (context->dim == dimNum)
{
/*
* Within the same dimension, choose the new split if it has a
* smaller overlap, or same overlap but better ratio.
*/
if (overlap < context->overlap ||
(overlap == context->overlap && ratio > context->ratio))
selectthis = true;
}
else
{
/*
* Across dimensions, choose the new split if it has a smaller
* *non-negative* overlap, or same *non-negative* overlap but
* bigger range. This condition differs from the one described in
* the article. On the datasets where leaf MBRs don't overlap
* themselves, non-overlapping splits (i.e. splits which have zero
* *non-negative* overlap) are frequently possible. In this case
* splits tends to be along one dimension, because most distant
* non-overlapping splits (i.e. having lowest negative overlap)
* appears to be in the same dimension as in the previous split.
* Therefore MBRs appear to be very prolonged along another
* dimension, which leads to bad search performance. Using range
* as the second split criteria makes MBRs more quadratic. Using
* *non-negative* overlap instead of overlap as the first split
* criteria gives to range criteria a chance to matter, because
* non-overlapping splits are equivalent in this criteria.
*/
if (non_negative(overlap) < non_negative(context->overlap) ||
(range > context->range &&
non_negative(overlap) <= non_negative(context->overlap)))
selectthis = true;
}
if (selectthis)
{
/* save information about selected split */
context->first = false;
context->ratio = ratio;
context->range = range;
context->overlap = overlap;
context->rightLower = rightLower;
context->leftUpper = leftUpper;
context->dim = dimNum;
}
}
} | false | false | false | false | false | 0 |
alarm_list_window_rows_reordered (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer arg3,
gpointer data)
{
AlarmApplet *applet = (AlarmApplet *)data;
AlarmListWindow *list_window = applet->list_window;
// Return if list_window is not set. This happens during initialization.
if (!list_window)
return;
// Signal to selection_changed that the rows have been reordered.
list_window->reordered = TRUE;
} | false | false | false | false | false | 0 |
ATL_dJIK0x0x5TN4x1x1_a1_bX
(const int M, const int N, const int K, const double alpha, const double * ATL_RESTRICT A, const int lda, const double * ATL_RESTRICT B, const int ldb, const double beta, double * ATL_RESTRICT C, const int ldc)
/*
* matmul with TA=T, TB=N, MB=0, NB=0, KB=5,
* lda=5, ldb=5, ldc=0, mu=4, nu=1, ku=1, pf=0
* Generated by ATLAS/tune/blas/gemm/emit_mm.c (3.10.1)
*/
{
const int Mb = (M>>2)<<2;
#define Nb N
const double *ca=A, *cb=B;
double *cc=C;
const double *stM = A + (((Mb) << 2)+Mb);
const double *stN = B + (((Nb) << 2)+Nb);
#define incAk 1
const int incAm = 15, incAn = -(((Mb) << 2)+Mb);
#define incBk 1
const int incBm = -5, incBn = 5;
#define incCm 4
const int incCn = (ldc) - (Mb);
double *pC0=C;
const double *pA0=A;
const double *pB0=B;
register int k;
register double rA0, rA1, rA2, rA3;
register double rB0;
register double rC0_0, rC1_0, rC2_0, rC3_0;
if (pA0 != stM)
{
do /* N-loop */
{
do /* M-loop */
{
rA0 = beta;
rC0_0 = *pC0;
rC0_0 *= rA0;
rC1_0 = pC0[1];
rC1_0 *= rA0;
rC2_0 = pC0[2];
rC2_0 *= rA0;
rC3_0 = pC0[3];
rC3_0 *= rA0;
for (k=0; k < 5; k++) /* easy loop to unroll */
{
rA0 = *pA0;
rB0 = *pB0;
rA1 = pA0[5];
rC0_0 += rA0 * rB0;
rA2 = pA0[10];
rC1_0 += rA1 * rB0;
rA3 = pA0[15];
rC2_0 += rA2 * rB0;
rC3_0 += rA3 * rB0;
pA0 += incAk;
pB0 += incBk;
}
*pC0 = rC0_0;
pC0[1] = rC1_0;
pC0[2] = rC2_0;
pC0[3] = rC3_0;
pC0 += incCm;
pA0 += incAm;
pB0 += incBm;
}
while(pA0 != stM);
pC0 += incCn;
pA0 += incAn;
pB0 += incBn;
}
while(pB0 != stN);
}
if (k=M-Mb)
ATL_dJIK0x0x5TN1x1x1_a1_bX(k, N, 5, alpha, ca + (((Mb) << 2)+Mb), lda, cb, ldb, beta, cc + (Mb), ldc);
} | false | false | false | false | false | 0 |
tenm_collided_circle_segment2(double p_x, double p_y, double p_r,
double q_a_x, double q_a_y,
double q_b_x, double q_b_y)
{
if (tenm_point_nearer(p_x, p_y, q_a_x, q_a_y, p_r))
return 1;
if (tenm_point_nearer(p_x, p_y, q_b_x, q_b_y, p_r))
return 1;
if (! tenm_line_nearer(p_x, p_y,
q_a_x, q_a_y, q_b_x, q_b_y, p_r))
return 0;
if (tenm_same_side_vertical(q_a_x, q_a_y, q_b_x, q_b_y,
q_a_x, q_a_y, q_b_x, q_b_y,
p_x, p_y))
return 0;
return 1;
} | false | false | false | false | false | 0 |
check_required_attribute(const string & attr)
{
map < string, XMLAttribute >::iterator i = attribute_table.find(attr);
if (i == attribute_table.end())
ddx_fatal_error(this, "Required attribute '%s' not found.",
attr.c_str());
return true;
} | false | false | false | false | false | 0 |
Verify() const {
if (Addr == 0) return true;
SmallVector<Instruction*, 8> Tmp(InstInputs.begin(), InstInputs.end());
if (!VerifySubExpr(Addr, Tmp))
return false;
if (!Tmp.empty()) {
errs() << "PHITransAddr contains extra instructions:\n";
for (unsigned i = 0, e = InstInputs.size(); i != e; ++i)
errs() << " InstInput #" << i << " is " << *InstInputs[i] << "\n";
llvm_unreachable("This is unexpected.");
return false;
}
// a-ok.
return true;
} | false | false | false | false | false | 0 |
Scale(double *p1, double *p2, double eventPos[2])
{
//Get the motion vector
double v[3];
v[0] = p2[0] - p1[0];
v[1] = p2[1] - p1[1];
v[2] = p2[2] - p1[2];
double *bounds = this->GetBounds();
// Compute the scale factor
double sf = vtkMath::Norm(v) /
sqrt( (bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
(bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
(bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
if ( eventPos[1] > this->LastEventPosition[1] )
{
sf = 1.0 + sf;
}
else
{
sf = 1.0 - sf;
}
this->CurrentHandleSize *= sf;
this->CurrentHandleSize = (this->CurrentHandleSize < 0.001 ? 0.001 : this->CurrentHandleSize);
this->SizeBounds();
} | false | false | false | false | false | 0 |
Exists()
{
if (eExists == EXIST_UNKNOWN)
{
/* Consider that only the files whose extension ends up with one that is */
/* listed in CPL_VSIL_CURL_ALLOWED_EXTENSIONS exist on the server */
/* This can speeds up dramatically open experience, in case the server */
/* cannot return a file list */
/* For example : */
/* gdalinfo --config CPL_VSIL_CURL_ALLOWED_EXTENSIONS ".tif" /vsicurl_streaming/http://igskmncngs506.cr.usgs.gov/gmted/Global_tiles_GMTED/075darcsec/bln/W030/30N030W_20101117_gmted_bln075.tif */
const char* pszAllowedExtensions =
CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", NULL);
if (pszAllowedExtensions)
{
char** papszExtensions = CSLTokenizeString2( pszAllowedExtensions, ", ", 0 );
int nURLLen = strlen(pszURL);
int bFound = FALSE;
for(int i=0;papszExtensions[i] != NULL;i++)
{
int nExtensionLen = strlen(papszExtensions[i]);
if (nURLLen > nExtensionLen &&
EQUAL(pszURL + nURLLen - nExtensionLen, papszExtensions[i]))
{
bFound = TRUE;
break;
}
}
if (!bFound)
{
eExists = EXIST_NO;
fileSize = 0;
poFS->AcquireMutex();
CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
cachedFileProp->bHastComputedFileSize = TRUE;
cachedFileProp->fileSize = fileSize;
cachedFileProp->eExists = eExists;
poFS->ReleaseMutex();
CSLDestroy(papszExtensions);
return 0;
}
CSLDestroy(papszExtensions);
}
char chFirstByte;
int bExists = (Read(&chFirstByte, 1, 1) == 1);
AcquireMutex();
poFS->AcquireMutex();
CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
cachedFileProp->eExists = eExists = bExists ? EXIST_YES : EXIST_NO;
poFS->ReleaseMutex();
ReleaseMutex();
Seek(0, SEEK_SET);
}
return eExists == EXIST_YES;
} | false | false | false | false | false | 0 |
doConfigure()
{
if(this->CurrentState == Configuring)
{
// stop configure
doInterrupt();
return;
}
if(!prepareConfigure())
{
return;
}
this->enterState(Configuring);
bool ret = doConfigureInternal();
if(ret)
{
this->ConfigureNeeded = false;
}
if(ret && !this->CacheValues->cacheModel()->newPropertyCount())
{
this->enterState(ReadyGenerate);
}
else
{
this->enterState(ReadyConfigure);
this->CacheValues->scrollToTop();
}
this->ProgressBar->reset();
} | false | false | false | false | false | 0 |
dce_v8_0_crtc_load_lut(struct drm_crtc *crtc)
{
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private;
int i;
DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id);
WREG32(mmINPUT_CSC_CONTROL + amdgpu_crtc->crtc_offset,
((INPUT_CSC_BYPASS << INPUT_CSC_CONTROL__INPUT_CSC_GRPH_MODE__SHIFT) |
(INPUT_CSC_BYPASS << INPUT_CSC_CONTROL__INPUT_CSC_OVL_MODE__SHIFT)));
WREG32(mmPRESCALE_GRPH_CONTROL + amdgpu_crtc->crtc_offset,
PRESCALE_GRPH_CONTROL__GRPH_PRESCALE_BYPASS_MASK);
WREG32(mmPRESCALE_OVL_CONTROL + amdgpu_crtc->crtc_offset,
PRESCALE_OVL_CONTROL__OVL_PRESCALE_BYPASS_MASK);
WREG32(mmINPUT_GAMMA_CONTROL + amdgpu_crtc->crtc_offset,
((INPUT_GAMMA_USE_LUT << INPUT_GAMMA_CONTROL__GRPH_INPUT_GAMMA_MODE__SHIFT) |
(INPUT_GAMMA_USE_LUT << INPUT_GAMMA_CONTROL__OVL_INPUT_GAMMA_MODE__SHIFT)));
WREG32(mmDC_LUT_CONTROL + amdgpu_crtc->crtc_offset, 0);
WREG32(mmDC_LUT_BLACK_OFFSET_BLUE + amdgpu_crtc->crtc_offset, 0);
WREG32(mmDC_LUT_BLACK_OFFSET_GREEN + amdgpu_crtc->crtc_offset, 0);
WREG32(mmDC_LUT_BLACK_OFFSET_RED + amdgpu_crtc->crtc_offset, 0);
WREG32(mmDC_LUT_WHITE_OFFSET_BLUE + amdgpu_crtc->crtc_offset, 0xffff);
WREG32(mmDC_LUT_WHITE_OFFSET_GREEN + amdgpu_crtc->crtc_offset, 0xffff);
WREG32(mmDC_LUT_WHITE_OFFSET_RED + amdgpu_crtc->crtc_offset, 0xffff);
WREG32(mmDC_LUT_RW_MODE + amdgpu_crtc->crtc_offset, 0);
WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007);
WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0);
for (i = 0; i < 256; i++) {
WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset,
(amdgpu_crtc->lut_r[i] << 20) |
(amdgpu_crtc->lut_g[i] << 10) |
(amdgpu_crtc->lut_b[i] << 0));
}
WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset,
((DEGAMMA_BYPASS << DEGAMMA_CONTROL__GRPH_DEGAMMA_MODE__SHIFT) |
(DEGAMMA_BYPASS << DEGAMMA_CONTROL__OVL_DEGAMMA_MODE__SHIFT) |
(DEGAMMA_BYPASS << DEGAMMA_CONTROL__CURSOR_DEGAMMA_MODE__SHIFT)));
WREG32(mmGAMUT_REMAP_CONTROL + amdgpu_crtc->crtc_offset,
((GAMUT_REMAP_BYPASS << GAMUT_REMAP_CONTROL__GRPH_GAMUT_REMAP_MODE__SHIFT) |
(GAMUT_REMAP_BYPASS << GAMUT_REMAP_CONTROL__OVL_GAMUT_REMAP_MODE__SHIFT)));
WREG32(mmREGAMMA_CONTROL + amdgpu_crtc->crtc_offset,
((REGAMMA_BYPASS << REGAMMA_CONTROL__GRPH_REGAMMA_MODE__SHIFT) |
(REGAMMA_BYPASS << REGAMMA_CONTROL__OVL_REGAMMA_MODE__SHIFT)));
WREG32(mmOUTPUT_CSC_CONTROL + amdgpu_crtc->crtc_offset,
((OUTPUT_CSC_BYPASS << OUTPUT_CSC_CONTROL__OUTPUT_CSC_GRPH_MODE__SHIFT) |
(OUTPUT_CSC_BYPASS << OUTPUT_CSC_CONTROL__OUTPUT_CSC_OVL_MODE__SHIFT)));
/* XXX match this to the depth of the crtc fmt block, move to modeset? */
WREG32(0x1a50 + amdgpu_crtc->crtc_offset, 0);
/* XXX this only needs to be programmed once per crtc at startup,
* not sure where the best place for it is
*/
WREG32(mmALPHA_CONTROL + amdgpu_crtc->crtc_offset,
ALPHA_CONTROL__CURSOR_ALPHA_BLND_ENA_MASK);
} | false | false | false | false | false | 0 |
compare_mode_sense(Microtek_Scanner *ms, int *match)
{
uint8_t data[20], comm[6] = { 0x1A, 0, 0, 0, 0, 0};
size_t lenp;
SANE_Status status;
int i;
DBG(23, ".compare_mode_sense %d...\n", ms->sfd);
if (ms->onepass) comm[4] = 0x13;
else if (ms->midtone_support) comm[4] = 0x0B;
else comm[4] = 0x0A;
lenp = comm[4];
status = sanei_scsi_cmd(ms->sfd, comm, 6, data, &lenp);
*match = 1;
for (i=0; i<10; i++)
*match = *match && (ms->mode_sense_cache[i] == data[i]);
if (DBG_LEVEL >= 192) {
unsigned int i;
#if 0
fprintf(stderr, "CMS: ");
for (i=0;i<lenp;i++) fprintf(stderr, "%2x(%2x) ",
data[i],
ms->mode_sense_cache[i]);
fprintf(stderr, "\n");
#endif
MDBG_INIT("CMS: ");
for (i=0;i<lenp;i++) MDBG_ADD("%2x(%2x) ",
data[i],
ms->mode_sense_cache[i]);
MDBG_FINISH(192);
}
return status;
} | false | false | false | false | false | 0 |
rstrdup(const char *s)
{
char *t;
#ifndef HAVE_STRDUP
int i;
#endif
if (s==NULL) return NULL;
#ifdef HAVE_STRDUP
t=strdup(s);
#else
t=malloc((strlen(s)+1)*sizeof(char));
#endif
if (t==NULL && rm_trap)
{
printf("Memory duplication error: Out of memory.\n");
exit(EXIT_FAILURE);
}
if (rm_acct) ralloc_cnt++;
#ifndef HAVE_STRDUP
for(i=0;s[i]!=0;i++)
t[i]=s[i];
t[i]=0;
#endif
return t;
} | false | false | false | true | false | 1 |
fileName(const KUrl& url) const
{
return encode(url.fileName());
} | false | false | false | false | false | 0 |
PR_ErrorToString(PRErrorCode code, PRLanguageCode language)
{
/* static buffer only used if code is using inconsistent error message
* numbers, so just ignore the possible thread contention
*/
static char buffer[25];
const char *msg;
int offset;
PRErrorCode table_num;
struct PRErrorTableList *et;
int started = 0;
char *cp;
for (et = Table_List; et; et = et->next) {
if (et->table->base <= code &&
et->table->base + et->table->n_msgs > code) {
/* This is the right table */
if (callback_lookup) {
msg = callback_lookup(code, language, et->table,
callback_private, et->table_private);
if (msg) return msg;
}
return(et->table->msgs[code - et->table->base].en_text);
}
}
if (code >= 0 && code < 256) {
return strerror(code);
}
offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
table_num = code - offset;
strcpy (buffer, "Unknown code ");
if (table_num) {
strcat(buffer, error_table_name (table_num));
strcat(buffer, " ");
}
for (cp = buffer; *cp; cp++)
;
if (offset >= 100) {
*cp++ = (char)('0' + offset / 100);
offset %= 100;
started++;
}
if (started || offset >= 10) {
*cp++ = (char)('0' + offset / 10);
offset %= 10;
}
*cp++ = (char)('0' + offset);
*cp = '\0';
return(buffer);
} | false | false | false | false | false | 0 |
dsp_calc_ea(Uint32 ea_mode, Uint32 *dst_addr)
{
Uint32 value, numreg, curreg;
value = (ea_mode >> 3) & BITMASK(3);
numreg = ea_mode & BITMASK(3);
switch (value) {
case 0:
/* (Rx)-Nx */
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
dsp_update_rn(numreg, -dsp_core->registers[DSP_REG_N0+numreg]);
break;
case 1:
/* (Rx)+Nx */
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
dsp_update_rn(numreg, dsp_core->registers[DSP_REG_N0+numreg]);
break;
case 2:
/* (Rx)- */
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
dsp_update_rn(numreg, -1);
break;
case 3:
/* (Rx)+ */
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
dsp_update_rn(numreg, +1);
break;
case 4:
/* (Rx) */
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
break;
case 5:
/* (Rx+Nx) */
curreg = dsp_core->registers[DSP_REG_R0+numreg];
dsp_update_rn(numreg, dsp_core->registers[DSP_REG_N0+numreg]);
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
dsp_core->registers[DSP_REG_R0+numreg] = curreg;
break;
case 6:
/* aa */
*dst_addr = read_memory_p(dsp_core->pc+1);
cur_inst_len++;
if (numreg != 0) {
return 1; /* immediate value */
}
break;
case 7:
/* -(Rx) */
dsp_update_rn(numreg, -1);
*dst_addr = dsp_core->registers[DSP_REG_R0+numreg];
break;
}
/* address */
return 0;
} | false | false | false | false | false | 0 |
change_nation(int newNationRecno)
{
err_when( newNationRecno && nation_array.is_deleted(newNationRecno) );
err_when( unit_mode == UNIT_MODE_REBEL ); // rebels do not change nation
//---------------------------------//
int oldAiUnit = ai_unit;
int oldNationRecno = nation_recno;
group_select_id = 0; // clear group select id
if(way_point_count)
reset_way_point_array();
//-- if the player is giving a command to this unit, cancel the command --//
if( nation_recno == nation_array.player_recno &&
sprite_recno == unit_array.selected_recno &&
power.command_id )
{
power.command_id = 0;
}
//---------- stop all action to attack this unit ------------//
unit_array.stop_attack_unit(sprite_recno);
//---- update nation_unit_count_array[] ----//
unit_res[unit_id]->unit_change_nation(newNationRecno, nation_recno, rank_id);
//------- if the nation has an AI action -------//
stop2(); // clear the existing order
//---------------- update vars ----------------//
unit_group_id = unit_array.cur_group_id++; // separate from the current group
nation_recno = newNationRecno;
home_camp_firm_recno = 0; // reset it
original_action_mode = 0;
if( race_id )
{
nation_contribution = 0; // contribution to the nation
total_reward = 0;
}
//-------- if change to one of the existing nations ------//
ai_unit = nation_recno && nation_array[nation_recno]->is_ai();
//------------ update AI info --------------//
if( oldAiUnit )
{
Nation* nationPtr = nation_array[oldNationRecno];
if( rank_id == RANK_GENERAL || rank_id == RANK_KING )
nationPtr->del_general_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_CARAVAN )
nationPtr->del_caravan_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_SHIP )
nationPtr->del_ship_info(sprite_recno);
}
if( ai_unit && nation_recno != 0 )
{
Nation* nationPtr = nation_array[nation_recno];
if( rank_id == RANK_GENERAL || rank_id == RANK_KING )
nationPtr->add_general_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_CARAVAN )
nationPtr->add_caravan_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_SHIP )
nationPtr->add_ship_info(sprite_recno);
}
//------ if this unit oversees a firm -----//
if( unit_mode==UNIT_MODE_OVERSEE )
firm_array[unit_mode_para]->change_nation(newNationRecno);
//----- this unit was defending the town before it gets killed ----//
else if( unit_mode==UNIT_MODE_DEFEND_TOWN )
{
if( !town_array.is_deleted(unit_mode_para) )
town_array[unit_mode_para]->reduce_defender_count();
set_mode(0); // reset unit mode
}
//---- if the unit is no longer the same nation as the leader ----//
if( leader_unit_recno )
{
Unit* leaderUnit = unit_array[leader_unit_recno];
if( leaderUnit->nation_recno != nation_recno )
{
leaderUnit->del_team_member(sprite_recno);
leader_unit_recno = 0;
team_id = 0;
}
}
//------ if it is currently selected -------//
if( selected_flag )
info.disp();
} | false | false | false | false | false | 0 |
doc_unref(Doc *d)
{
int refcount;
GSview *a = d->app;
if (d->refcount > 0)
d->refcount--;
refcount = d->refcount;
if (debug & DEBUG_DEV) {
char buf[MAXSTR];
snprintf(buf, sizeof(buf), "doc refcount=%d\n", refcount);
buf[sizeof(buf)-1]='\0';
app_msg_len_nolock(d->app, buf, (int)strlen(buf));
}
if (d->refcount == 0) {
doc_close(d);
d->app = NULL;
app_unref(a); /* doc loses reference to app */
memset(d, 0, sizeof(Doc));
free(d);
}
return refcount;
} | false | false | false | false | false | 0 |
insert_jmp_if_necessary(RfmBranch branch)
{
RfmStm label_stm;
RfmOperand op_label;
RfmStm jmp_stm;
RfmQuad quad;
if ((branch->branch_kind == RFM_BRANCH_TAKEN) ||
(branch->branch_kind == RFM_BRANCH_NOT_TAKEN)) {
if (branch->fork_block->next != branch->join_block) {
return;
}
jmp_stm = branch->fork_block->stm_tail;
if (!IsJmpStm(jmp_stm)) {
return;
}
quad = jmp_stm->quad_tail;
if ((quad == NULL) ||
(quad->operator != OPE_JMP)) {
return;
}
op_label = quad->operand[0];
if (op_label->tbl.label != branch->label) {
return;
}
DeleteRfmQuad(quad);
branch->quad = NULL;
if ((branch->join_block->join_list == branch) &&
(branch->join_block->join_list->join_next == NULL)) {
label_stm = branch->join_block->stm_list;
if (!IsLabelStm(label_stm)) {
return;
}
op_label = label_stm->quad_list->operand[0];
if (op_label->tbl.label != branch->label) {
return;
}
if (branch->label->is_generate) {
DeleteRfmLabel(branch->label);
branch->label = NULL;
DeleteRfmStm(label_stm);
}
}
return;
}
if (branch->branch_kind != RFM_BRANCH_UNCONDITIONAL) {
return;
}
if (branch->fork_block->next == branch->join_block) {
jmp_stm = branch->fork_block->stm_tail;
if (IsJmpStm(jmp_stm)) {
DeleteRfmStm(jmp_stm);
branch->quad = NULL;
}
return;
}
if (branch->quad) {
return;
}
if (branch->label == NULL) {
label_stm = branch->join_block->stm_list;
if (!IsLabelStm(label_stm)) {
return;
}
op_label = label_stm->quad_list->operand[0];
branch->label = op_label->tbl.label;
}
jmp_stm = MakeRfmStm(branch->fork_block,
branch->fork_block->stm_tail, NULL);
op_label = MakeLabelRfmOperand(branch->label, jmp_stm);
quad = MakeRfmQuad(jmp_stm, NULL, NULL);
quad->operator = OPE_JMP;
quad->operand[0] = op_label;
branch->quad = quad;
} | false | false | false | false | false | 0 |
save_cl_flags(void)
{
int indx;
long int moving_bit = 1;
cl_flags_bit_map = 0;
for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
{
if ( *(cl_flags_list[indx].flag_var) )
{
cl_flags_bit_map |= moving_bit; /* The moving finger writes, */
}
moving_bit <<= 1; /* and having writ, moves on. */
}
} | false | false | false | false | false | 0 |
write_silence(FILE *out, int samples)
{
int a;
for (a = 0;a < samples;a++)
if (fputc(0x80, out) == EOF)
return -1;
return a;
} | false | false | false | false | false | 0 |
publisher_retry(struct publisher_entry *pe, int delay, const char *msg)
{
struct pubdata *pd;
publisher_check(pe);
g_assert(NULL == pe->publish_ev);
g_assert(delay > 0);
pd = get_pubdata(pe->sha1);
if (pd != NULL) {
pd->next_enqueue = time_advance(tm_time(), UNSIGNED(delay));
dbmw_write(db_pubdata, pe->sha1, pd, sizeof *pd);
}
pe->publish_ev = cq_insert(publish_cq, delay * 1000, handle_entry, pe);
pe->last_delayed = tm_time();
if (GNET_PROPERTY(publisher_debug) > 3) {
shared_file_t *sf = shared_file_by_sha1(pe->sha1);
g_debug("PUBLISHER will retry SHA-1 %s %s\"%s\" in %s: %s",
sha1_to_string(pe->sha1),
(sf && sf != SHARE_REBUILDING && shared_file_is_partial(sf)) ?
"partial " : "",
(sf && sf != SHARE_REBUILDING) ? shared_file_name_nfc(sf) : "",
compact_time(delay), msg != NULL ? msg : "<no reason>");
}
} | false | false | false | false | false | 0 |
vidioc_s_input(struct file *file, void *fh, unsigned int input)
{
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
dprintk(2, "VIDIOC_S_INPUT: %d\n", input);
if (!av7110->analog_tuner_flags)
return input ? -EINVAL : 0;
if (input >= 4)
return -EINVAL;
av7110->current_input = input;
return av7110_dvb_c_switch(fh);
} | false | false | false | false | false | 0 |
dotconf_register_options(configfile_t *configfile, const configoption_t * options)
{
int num = configfile->config_option_count;
#define GROW_BY 10
/* resize memoryblock for options blockwise */
if (configfile->config_options == NULL)
configfile->config_options = malloc(sizeof(void *) * (GROW_BY + 1));
else
{
if ( !(num % GROW_BY) )
configfile->config_options = realloc(configfile->config_options,
sizeof(void *) * (num + GROW_BY + 1));
}
#undef GROW_BY
/* append new options */
configfile->config_options[configfile->config_option_count] = options;
configfile->config_options[ ++configfile->config_option_count ] = 0;
} | false | false | false | false | true | 1 |
hybrid_chat_window_update_tips(HybridChatWindow *window)
{
GtkTreeModel *model;
GtkTreePath *path;
HybridConversation *conv;
HybridBuddy *buddy;
gchar *markup;
g_return_if_fail(window != NULL);
if (!IS_SYSTEM_CHAT(window)) {
return;
}
conv = window->parent;
buddy = window->data;
model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tablabel));
if (window->unread) {
markup = g_strdup_printf("<span color=\"blue\"><b>%s (%d)</b></span>",
buddy->name, window->unread);
} else {
markup = g_strdup(buddy->name);
}
gtk_list_store_set(GTK_LIST_STORE(model), &window->tabiter,
TAB_NAME_COLUMN, markup,
-1);
g_free(markup);
path = gtk_tree_path_new_from_string("0");
gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(window->tablabel), path);
gtk_tree_path_free(path);
} | false | false | false | false | false | 0 |
png_destroy_gamma_table(png_structp png_ptr)
{
png_free(png_ptr, png_ptr->gamma_table);
png_ptr->gamma_table = NULL;
if (png_ptr->gamma_16_table != NULL)
{
int i;
int istop = (1 << (8 - png_ptr->gamma_shift));
for (i = 0; i < istop; i++)
{
png_free(png_ptr, png_ptr->gamma_16_table[i]);
}
png_free(png_ptr, png_ptr->gamma_16_table);
png_ptr->gamma_16_table = NULL;
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_free(png_ptr, png_ptr->gamma_from_1);
png_ptr->gamma_from_1 = NULL;
png_free(png_ptr, png_ptr->gamma_to_1);
png_ptr->gamma_to_1 = NULL;
if (png_ptr->gamma_16_from_1 != NULL)
{
int i;
int istop = (1 << (8 - png_ptr->gamma_shift));
for (i = 0; i < istop; i++)
{
png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
}
png_free(png_ptr, png_ptr->gamma_16_from_1);
png_ptr->gamma_16_from_1 = NULL;
}
if (png_ptr->gamma_16_to_1 != NULL)
{
int i;
int istop = (1 << (8 - png_ptr->gamma_shift));
for (i = 0; i < istop; i++)
{
png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
}
png_free(png_ptr, png_ptr->gamma_16_to_1);
png_ptr->gamma_16_to_1 = NULL;
}
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
} | false | false | false | false | false | 0 |
addCurrentConstraint()
{
TimeConstraint *ctr=NULL;
double weight;
QString tmp=weightLineEdit->text();
weight_sscanf(tmp, "%lf", &weight);
if(weight<100.0 || weight>100.0){
QMessageBox::warning(this, tr("FET information"),
tr("Invalid weight (percentage). It has to be 100"));
return;
}
QList<int> days;
QList<int> hours;
for(int j=0; j<gt.rules.nDaysPerWeek; j++)
for(int i=0; i<gt.rules.nHoursPerDay; i++)
if(notAllowedTimesTable->item(i, j)->text()==YES){
days.append(j);
hours.append(i);
}
ctr=new ConstraintBreakTimes(weight, days, hours);
bool tmp2=gt.rules.addTimeConstraint(ctr);
if(tmp2)
LongTextMessageBox::information(this, tr("FET information"),
tr("Constraint added:")+"\n\n"+ctr->getDetailedDescription(gt.rules));
else{
QMessageBox::warning(this, tr("FET information"),
tr("Constraint NOT added - there must be another constraint of this "
"type. Please edit that one"));
delete ctr;
}
} | false | false | false | false | false | 0 |
Bind()
{
if(this->FBOIndex!=0 && this->PreviousFBOIndex==-1)
{
this->Context->MakeCurrent();
GLint framebufferBinding;
glGetIntegerv(vtkgl::FRAMEBUFFER_BINDING_EXT,&framebufferBinding);
this->PreviousFBOIndex=framebufferBinding;
vtkgl::BindFramebufferEXT(vtkgl::FRAMEBUFFER_EXT, this->FBOIndex);
}
} | false | false | false | false | false | 0 |
snd_at73c213_interrupt(int irq, void *dev_id)
{
struct snd_at73c213 *chip = dev_id;
struct snd_pcm_runtime *runtime = chip->substream->runtime;
u32 status;
int offset;
int block_size;
int next_period;
int retval = IRQ_NONE;
spin_lock(&chip->lock);
block_size = frames_to_bytes(runtime, runtime->period_size);
status = ssc_readl(chip->ssc->regs, IMR);
if (status & SSC_BIT(IMR_ENDTX)) {
chip->period++;
if (chip->period == runtime->periods)
chip->period = 0;
next_period = chip->period + 1;
if (next_period == runtime->periods)
next_period = 0;
offset = block_size * next_period;
ssc_writel(chip->ssc->regs, PDC_TNPR,
(long)runtime->dma_addr + offset);
ssc_writel(chip->ssc->regs, PDC_TNCR,
runtime->period_size * runtime->channels);
retval = IRQ_HANDLED;
}
ssc_readl(chip->ssc->regs, IMR);
spin_unlock(&chip->lock);
if (status & SSC_BIT(IMR_ENDTX))
snd_pcm_period_elapsed(chip->substream);
return retval;
} | false | false | false | false | false | 0 |
set(int W, int H, const uchar *bits) {
delete b;
bitmap(new Fl_Bitmap(bits, W, H));
} | false | false | false | false | false | 0 |
check_hostaliases(int nhostaliases, char **hostaliases)
{
int i;
for (i = 0; i < nhostaliases; i++) {
if (check_hostname(hostaliases[i]) != GFARM_ERR_NO_ERROR)
return (APP_ERR_HOSTALIAS_IS_ALREADY_REGISERED);
}
return (GFARM_ERR_NO_ERROR);
} | false | false | false | false | false | 0 |
static_list_system (gamgi_window *window)
{
GtkWidget *dialog = window->dialog0;
gamgi_slist *slist = NULL;
GtkEntry *entry;
char system[GAMGI_ENGINE_TOKEN];
char lattice[GAMGI_ENGINE_TOKEN];
char **systems = gamgi_phys_symmetry_systems;
char **groups = gamgi_phys_symmetry_groups;
const char *name;
int number, n;
/*****************************
* retrieve and check system *
*****************************/
entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_system");
name = gtk_entry_get_text (entry);
strcpy (system, "");
if (gamgi_io_token_check (name) == TRUE &&
gamgi_io_token_alpha_scan (name, system,
GAMGI_IO_TEXT, GAMGI_ENGINE_TOKEN) == FALSE) return slist;
if (strcmp (system, "") != 0 &&
strcmp (system, "a") != 0 && strcmp (system, "m") != 0 &&
strcmp (system, "o") != 0 && strcmp (system, "t") != 0 &&
strcmp (system, "h") != 0 && strcmp (system, "c")) return slist;
/******************************
* retrieve and check lattice *
******************************/
entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_lattice");
name = gtk_entry_get_text (entry);
strcpy (lattice, "");
if (gamgi_io_token_check (name) == TRUE &&
gamgi_io_token_alpha_scan (name, lattice,
GAMGI_IO_TEXT, GAMGI_ENGINE_TOKEN) == FALSE) return slist;
if (strcmp (lattice, "") != 0 &&
strcmp (lattice, "P") != 0 && strcmp (lattice, "I") != 0 &&
strcmp (lattice, "F") != 0 && strcmp (lattice, "C") != 0 &&
strcmp (lattice, "R") != 0) return slist;
/****************************
* retrieve and check group *
****************************/
entry = (GtkEntry *) g_object_get_data (G_OBJECT (dialog), "entry_group");
name = gtk_entry_get_text (entry);
number = 0;
if (gamgi_io_token_check (name) == TRUE &&
gamgi_io_token_int_scan (name, &number, 1, 230) == FALSE) return slist;
/********************************************************************
* system,lattice,group are correct or empty AND it is guaranteed *
* (by the "changed" signal callbacks) that they are all compatible *
********************************************************************/
for (n = 5; n >= 0; n--)
{
if (
(strcmp (system, "") == 0 || strcmp (systems[4*n + 0], system) == 0)
&&
(strcmp (lattice, "") == 0 || strstr (systems[4*n + 2], lattice) != NULL)
&&
(number == 0 || strcmp (systems[4*n + 0], groups[4*(number - 1) + 2]) == 0)
)
{
slist = gamgi_engine_slist_add_start (slist);
slist->data = GAMGI_INT_TO_POINTER (n);
}
}
return slist;
} | false | false | false | false | false | 0 |
isr_txrdy(SLMP_INFO * info)
{
if ( debug_level >= DEBUG_LEVEL_ISR )
printk("%s(%d):%s isr_txrdy() tx_count=%d\n",
__FILE__,__LINE__,info->device_name,info->tx_count);
if (info->params.mode != MGSL_MODE_ASYNC) {
/* disable TXRDY IRQ, enable IDLE IRQ */
info->ie0_value &= ~TXRDYE;
info->ie1_value |= IDLE;
write_reg16(info, IE0, (unsigned short)((info->ie1_value << 8) + info->ie0_value));
return;
}
if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) {
tx_stop(info);
return;
}
if ( info->tx_count )
tx_load_fifo( info );
else {
info->tx_active = false;
info->ie0_value &= ~TXRDYE;
write_reg(info, IE0, info->ie0_value);
}
if (info->tx_count < WAKEUP_CHARS)
info->pending_bh |= BH_TRANSMIT;
} | false | false | false | false | false | 0 |
mono_type_is_enum_type (MonoType *type)
{
if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype)
return TRUE;
if (type->type == MONO_TYPE_GENERICINST && type->data.generic_class->container_class->enumtype)
return TRUE;
return FALSE;
} | false | false | false | false | false | 0 |
gonzo_alias_delete_destination_sub(gonzo_ty *gp, string_ty *name)
{
gstate_ty *gstate_data;
size_t j;
//
// find the project in the gstate
//
trace(("gonzo_alias_delete_destination_sub(gp = %08lX, name = \"%s\")\n{\n",
(long)gp, name->str_text));
gstate_data = gonzo_gstate_get(gp);
assert(gstate_data->where);
for (j = 0; j < gstate_data->where->length; ++j)
{
gstate_where_ty *addr;
size_t k;
addr = gstate_data->where->list[j];
if (!addr->alias_for)
continue;
if (!is_leading_prefix(name, addr->alias_for))
continue;
trace_string (addr->alias_for->str_text);
//
// delete the item from the list
//
for (k = j + 1; k < gstate_data->where->length; ++k)
gstate_data->where->list[k - 1] = gstate_data->where->list[k];
gstate_data->where->length--;
--j;
//
// free the item
//
gstate_where_type.free(addr);
//
// mark this gstate file as modified
//
gp->modified = 1;
}
trace(("}\n"));
} | false | false | false | false | false | 0 |
gfarm_sockaddr_to_string(struct sockaddr *addr, char *string, size_t size)
{
unsigned char *a;
#ifndef HAVE_SNPRINTF
char s[GFARM_SOCKADDR_STRLEN];
if (size <= 0)
return;
#endif
switch (addr->sa_family) {
case AF_INET:
a = (unsigned char *)
&((struct sockaddr_in *)addr)->sin_addr.s_addr;
#ifdef HAVE_SNPRINTF
snprintf(string, size, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
#else
sprintf(s, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
strncpy(string, s, size);
string[size - 1] = '\0';
#endif
break;
default:
#ifdef HAVE_SNPRINTF
snprintf(string, size, "unknown address family %d",
addr->sa_family);
#else
sprintf(s, "unknown address family %d", addr->sa_family);
strncpy(string, s, size);
string[size - 1] = '\0';
#endif
break;
}
} | false | false | false | false | false | 0 |
yy_Ticks1()
{ int yypos0= yypos, yythunkpos0= yythunkpos;
yyprintf((stderr, "%s\n", "Ticks1")); if (!yymatchChar('`')) goto l92;
{ int yypos93= yypos, yythunkpos93= yythunkpos; if (!yymatchChar('`')) goto l93; goto l92;
l93:; yypos= yypos93; yythunkpos= yythunkpos93;
}
yyprintf((stderr, " ok %s @ %s\n", "Ticks1", yybuf+yypos));
return 1;
l92:; yypos= yypos0; yythunkpos= yythunkpos0;
yyprintf((stderr, " fail %s @ %s\n", "Ticks1", yybuf+yypos));
return 0;
} | false | false | false | false | false | 0 |
availablePlugins()
{
QStringList result;
const KService::List plugins = KServiceTypeTrader::self()->query("ThumbCreator");
for (KService::List::ConstIterator it = plugins.begin(); it != plugins.end(); ++it)
if (!result.contains((*it)->desktopEntryName()))
result.append((*it)->desktopEntryName());
return result;
} | false | false | false | false | false | 0 |
GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1,
struct GNUNET_TIME_Relative a2)
{
struct GNUNET_TIME_Relative ret;
if (a2.rel_value >= a1.rel_value)
return GNUNET_TIME_UNIT_ZERO;
if (a1.rel_value == UINT64_MAX)
return GNUNET_TIME_UNIT_FOREVER_REL;
ret.rel_value = a1.rel_value - a2.rel_value;
return ret;
} | false | false | false | false | false | 0 |
redraw_custum_statusline(wp)
win_T *wp;
{
int save_called_emsg = called_emsg;
called_emsg = FALSE;
win_redr_custom(wp, FALSE);
if (called_emsg)
set_string_option_direct((char_u *)"statusline", -1,
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
called_emsg |= save_called_emsg;
} | false | false | false | false | false | 0 |
wait_press(int timeOutSecond)
{
while( mouse.left_press || mouse.any_click() || mouse.key_code ) // avoid repeat clicking
{
sys.yield();
mouse.get_event();
}
int rc=0;
unsigned int timeOutTime = misc.get_time() + timeOutSecond*1000;
while(1)
{
sys.yield();
mouse.get_event();
if( sys.debug_session )
sys.blt_virtual_buf();
if( right_press || mouse.key_code==KEY_ESC )
{
rc = 2;
break;
}
if( left_press || mouse.key_code )
{
rc = 1;
break;
}
if( timeOutSecond && misc.get_time() > timeOutTime )
break;
}
while( mouse.left_press || mouse.any_click() || mouse.key_code ) // avoid repeat clicking
{
sys.yield();
mouse.get_event();
}
return rc;
} | false | false | false | false | false | 0 |
gg_convert_image_to_bgr (const gGraphImagePtr img)
{
/* converting this image to BGR */
int x;
int y;
void *pixels;
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char *p_in;
unsigned char *p_out;
if (img->pixel_format == GG_PIXEL_RGB || img->pixel_format == GG_PIXEL_RGBA
|| img->pixel_format == GG_PIXEL_ARGB
|| img->pixel_format == GG_PIXEL_BGR
|| img->pixel_format == GG_PIXEL_BGRA
|| img->pixel_format == GG_PIXEL_GRAYSCALE
|| img->pixel_format == GG_PIXEL_PALETTE)
;
else
return GGRAPH_INVALID_IMAGE;
if (img->pixel_format == GG_PIXEL_BGR)
return GGRAPH_OK;
pixels = malloc (img->width * img->height * 3);
if (!pixels)
return GGRAPH_INSUFFICIENT_MEMORY;
for (y = 0; y < img->height; y++)
{
/* processing any scanline */
p_in = img->pixels + (y * img->scanline_width);
p_out = pixels;
p_out += (y * img->width * 3);
for (x = 0; x < img->width; x++)
{
/* retrieving the origin pixel */
if (img->pixel_format == GG_PIXEL_RGB)
{
red = *p_in++;
green = *p_in++;
blue = *p_in++;
}
else if (img->pixel_format == GG_PIXEL_RGBA)
{
red = *p_in++;
green = *p_in++;
blue = *p_in++;
p_in++; /* skipping alpha */
}
else if (img->pixel_format == GG_PIXEL_ARGB)
{
p_in++; /* skipping alpha */
blue = *p_in++;
green = *p_in++;
red = *p_in++;
}
else if (img->pixel_format == GG_PIXEL_BGRA)
{
blue = *p_in++;
green = *p_in++;
red = *p_in++;
p_in++; /* skipping alpha */
}
else if (img->pixel_format == GG_PIXEL_GRAYSCALE)
{
red = *p_in++;
green = red;
blue = red;
}
else if (img->pixel_format == GG_PIXEL_PALETTE)
{
int index = *p_in++;
red = img->palette_red[index];
green = img->palette_green[index];
blue = img->palette_blue[index];
}
/* setting the destination pixel */
*p_out++ = blue;
*p_out++ = green;
*p_out++ = red;
}
}
free (img->pixels);
img->pixels = pixels;
img->pixel_format = GG_PIXEL_BGR;
img->scanline_width = img->width * 3;
img->pixel_size = 3;
img->max_palette = 0;
return GGRAPH_OK;
} | false | false | false | false | false | 0 |
xmms_playlist_client_remove_entry (xmms_playlist_t *playlist,
const gchar *plname,
gint32 pos, xmms_error_t *err)
{
gboolean ret = FALSE;
xmmsv_coll_t *plcoll;
g_return_if_fail (playlist);
g_mutex_lock (playlist->mutex);
plcoll = xmms_playlist_get_coll (playlist, plname, err);
if (plcoll != NULL) {
ret = xmms_playlist_remove_unlocked (playlist, plname, plcoll, pos, err);
}
g_mutex_unlock (playlist->mutex);
} | false | false | false | false | false | 0 |
l3dss1_dummy_return_result(struct PStack *st, int id, u_char *p, u_char nlen)
{ isdn_ctrl ic;
struct IsdnCardState *cs;
struct l3_process *pc = NULL;
if ((pc = l3dss1_search_dummy_proc(st, id)))
{ L3DelTimer(&pc->timer); /* remove timer */
cs = pc->st->l1.hardware;
ic.driver = cs->myid;
ic.command = ISDN_STAT_PROT;
ic.arg = DSS1_STAT_INVOKE_RES;
ic.parm.dss1_io.hl_id = pc->prot.dss1.invoke_id;
ic.parm.dss1_io.ll_id = pc->prot.dss1.ll_id;
ic.parm.dss1_io.proc = pc->prot.dss1.proc;
ic.parm.dss1_io.timeout = 0;
ic.parm.dss1_io.datalen = nlen;
ic.parm.dss1_io.data = p;
free_invoke_id(pc->st, pc->prot.dss1.invoke_id);
pc->prot.dss1.invoke_id = 0; /* reset id */
cs->iif.statcallb(&ic);
dss1_release_l3_process(pc);
}
else
l3_debug(st, "dummy return result id=0x%x result len=%d", id, nlen);
} | false | false | false | false | false | 0 |
gog_axis_view_render (GogView *view, GogViewAllocation const *bbox)
{
GSList *ptr;
(aview_parent_klass->render) (view, bbox);
/* Render every child except grid lines. Those are rendered
* before in gog_chart_view since we don't want to render them
* over axis. */
for (ptr = view->children ; ptr != NULL ; ptr = ptr->next) {
if (!GOG_IS_GRID_LINE (GOG_VIEW (ptr->data)->model))
gog_view_render (ptr->data, bbox);
}
} | false | false | false | false | false | 0 |
decompose (Hep3Vector & boost, HepAxisAngle & rotation) const {
rotation = HepAxisAngle();
boost = boostVector();
} | false | false | false | false | false | 0 |
pad_file (FileHandle *fh, gsize num, goffset current_size)
{
gpointer buf;
gsize written;
gint res;
res = 0;
buf = g_malloc0 (PAD_BLOCK_SIZE);
for (written = 0; written < num; written += PAD_BLOCK_SIZE)
{
res = write_stream (fh, buf, MIN (num - written, PAD_BLOCK_SIZE), current_size + written);
if (res < 0)
break;
}
g_free (buf);
return (res < 0 ? res : 0);
} | false | false | false | false | false | 0 |
mtq_maxlen_get(MtQueue* mtq){{
#line 144 "./queue.scm"
{int ml=MTQ_MAXLEN(mtq);
if ((ml)<(0)){return (SCM_FALSE);} else {return (SCM_MAKE_INT(ml));}}}} | false | false | false | false | false | 0 |
is_token(char ch)
{
unsigned char uch = (unsigned char) ch;
if (uch > 0x7F)
return FALSE;
if (uch == ' ')
return FALSE;
if (is_tspecials(ch))
return FALSE;
return TRUE;
} | false | false | false | false | false | 0 |
af9013_read_status(struct dvb_frontend *fe, enum fe_status *status)
{
struct af9013_state *state = fe->demodulator_priv;
int ret;
u8 tmp;
/*
* Return status from the cache if it is younger than 2000ms with the
* exception of last tune is done during 4000ms.
*/
if (time_is_after_jiffies(
state->read_status_jiffies + msecs_to_jiffies(2000)) &&
time_is_before_jiffies(
state->set_frontend_jiffies + msecs_to_jiffies(4000))
) {
*status = state->fe_status;
return 0;
} else {
*status = 0;
}
/* MPEG2 lock */
ret = af9013_rd_reg_bits(state, 0xd507, 6, 1, &tmp);
if (ret)
goto err;
if (tmp)
*status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI |
FE_HAS_SYNC | FE_HAS_LOCK;
if (!*status) {
/* TPS lock */
ret = af9013_rd_reg_bits(state, 0xd330, 3, 1, &tmp);
if (ret)
goto err;
if (tmp)
*status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI;
}
state->fe_status = *status;
state->read_status_jiffies = jiffies;
return ret;
err:
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
} | false | false | false | false | false | 0 |
_dxfFreeSimplificationDataStructure(SimpData *simp_data, float *vertex_data, float *old_positional_error)
{
if (simp_data->edge2index)
{
DXFree((Pointer) simp_data->edge2index);
simp_data->edge2index = NULL;
}
if (simp_data->index2edge)
{
DXFree((Pointer) simp_data->index2edge);
simp_data->index2edge = NULL;
}
if (simp_data->edge_father)
{
DXFree((Pointer) simp_data->edge_father);
simp_data->edge_father = NULL;
}
if (simp_data->normal)
{
DXFree((Pointer) simp_data->normal);
simp_data->normal = NULL;
}
if (simp_data->area)
{
DXFree((Pointer) simp_data->area);
simp_data->area = NULL;
}
if (simp_data->compactness)
{
DXFree((Pointer) simp_data->compactness);
simp_data->compactness = NULL;
}
if (simp_data->valence)
{
DXFree((Pointer) simp_data->valence);
simp_data->valence = NULL;
}
if (simp_data->boundary_vert)
{
DXFree((Pointer) simp_data->boundary_vert);
simp_data->boundary_vert = NULL;
}
if (simp_data->err_volume && simp_data->err_volume != old_positional_error)
{
DXFree((Pointer) simp_data->err_volume);
simp_data->err_volume = old_positional_error;
}
if (simp_data->tol_volume)
{
DXFree((Pointer) simp_data->tol_volume);
simp_data->tol_volume = NULL;
}
if (simp_data->vx_data && simp_data->vx_data != vertex_data)
{
DXFree((Pointer) simp_data->vx_data);
simp_data->vx_data = vertex_data;
}
if (simp_data->vx_data_error)
{
DXFree((Pointer) simp_data->vx_data_error);
simp_data->vx_data_error = NULL;
}
if (simp_data->vx_data_potential_values)
{
DXFree((Pointer)simp_data->vx_data_potential_values);
simp_data->vx_data_potential_values = NULL;
}
if (simp_data->edge_heap)
{
DXFree((Pointer) simp_data->edge_heap);
simp_data->edge_heap = NULL;
}
return 1;
} | false | false | false | false | false | 0 |
evas_common_rectangle_draw_do(const Cutout_Rects *reuse,
const Eina_Rectangle *clip,
RGBA_Image *dst, RGBA_Draw_Context *dc,
int x, int y, int w, int h)
{
Eina_Rectangle area;
Cutout_Rect *r;
int i;
if (!reuse)
{
evas_common_draw_context_clip_clip(dc,
clip->x, clip->y,
clip->w, clip->h);
rectangle_draw_internal(dst, dc, x, y, w, h);
return ;
}
for (i = 0; i < reuse->active; ++i)
{
r = reuse->rects + i;
EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
if (!eina_rectangle_intersection(&area, clip)) continue ;
evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
rectangle_draw_internal(dst, dc, x, y, w, h);
}
} | false | false | false | false | false | 0 |
g_udisks_mount_guess_content_type (GMount* base, gboolean force_rescan, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
GUDisksMount* mnt = G_UDISKS_MOUNT(base);
GFile* root = g_udisks_mount_get_root(base);
g_debug("guess content type");
if(root)
{
/* FIXME: this is not really cancellable. */
GuessContentData* data = g_slice_new(GuessContentData);
/* NOTE: this should be an asynchronous action, but
* g_content_type_guess_for_tree provided by glib is not
* cancellable. So, we got some problems here.
* If we really want a perfect asynchronous implementation,
* another option is using fork() to implement this. */
data->mnt = g_object_ref(mnt);
data->root = root;
data->callback = callback;
data->user_data = user_data;
g_io_scheduler_push_job(guess_content_job, data, guess_content_data_free, G_PRIORITY_DEFAULT, cancellable);
}
} | false | false | false | false | false | 0 |
cf_chksum_long_init()
{
int i, j;
uint crc;
for (i = 0; i < 256; i++) {
crc = i;
for (j = 8; j > 0; j--) {
if (crc & 1)
crc = (crc >> 1) ^ CRC32_POLYNOMIAL;
else
crc >>= 1;
}
CRCTable[i] = crc;
}
} | false | false | false | false | false | 0 |
generateFakeLabels(void)
{
UT_uint32 i;
//
// Start by generating 4 fake (pf_Frag_Strux* and fl_Layout pointers
//
// Jeeze gotta generate a fake void * pointer!! Try this hack.
//
for(i=0; i<4; i++)
{
DELETEP(m_pFakeLayout[i]);
m_pFakeSdh[i] = new pf_Frag_Strux_Block(NULL,0);
m_pFakeLayout[i] = new fl_Layout((PTStruxType) 0 , m_pFakeSdh[i] );
}
//
// Now generate the AutoNum
//
DELETEP(m_pFakeAuto);
UNREFP(m_pFakeDoc);
m_pFakeDoc = new PD_Document();
m_pFakeAuto = new fl_AutoNum(m_iID, 0, m_NewListType, m_newStartValue,
m_pszDelim.c_str(), m_pszDecimal.c_str(),
(PD_Document *) m_pFakeDoc,NULL);
m_pFakeAuto->insertFirstItem(m_pFakeSdh[0], NULL,1,false);
m_pFakeLayout[0]->setAutoNum(m_pFakeAuto);
for(i=1; i<4; i++)
{
m_pFakeAuto->insertItem(m_pFakeSdh[i],m_pFakeSdh[i-1],false);
m_pFakeLayout[i]->setAutoNum(m_pFakeAuto);
}
} | false | false | false | false | false | 0 |
countConnections()
{
int cnum = 0;
SingleList* list = _connections;
while (list) {
ConnectInfo* peer = (ConnectInfo*) list->data;
if (peer->state == PEER_CONNECTED) {
cnum++;
}
list = listSingleNext(list);
}
return cnum;
} | false | false | false | false | false | 0 |
detachThread(Thread *thread) {
ExecEnv *ee = thread->ee;
Object *jThread = ee->thread;
Object *group = INST_DATA(jThread, Object*, group_offset);
/* If there's an exception pending, it is uncaught */
if(exceptionOccurred0(ee))
uncaughtException();
/* Don't do anything if this is the main thread */
if(thread->prev == NULL)
return;
/* remove thread from thread group */
executeMethod(group, (CLASS_CB(group->class))->
method_table[rmveThrd_mtbl_idx], jThread);
/* Remove thread from the ID map hash table */
deleteThreadFromHash(thread);
objectLock(jThread);
/* Mark the thread as terminated. This state is used in
determining if the thread is alive and so must be
done before notifying joining threads */
classlibSetThreadState(thread, TERMINATED);
classlibMarkThreadTerminated(jThread);
/* Notify any threads waiting on the thread object -
these are joining this thread */
objectNotifyAll(jThread);
objectUnlock(jThread);
/* Thread's about to die, so no need to save registers for
scanning. Also no need to enable suspend afterwards. */
disableSuspend0(thread, &group);
/* Grab global lock, and update thread structures protected by
it (thread list, thread ID and number of daemon threads) */
pthread_mutex_lock(&lock);
/* remove from thread list... */
if((thread->prev->next = thread->next))
thread->next->prev = thread->prev;
/* One less live thread */
threads_count--;
/* Recycle the thread's thread ID */
freeThreadID(thread->id);
/* Handle daemon thread status */
if(!INST_DATA(jThread, int, daemon_offset))
non_daemon_thrds--;
pthread_mutex_unlock(&lock);
/* It is safe to free the thread's ExecEnv and stack now as these are
only used within the thread. It is _not_ safe to free the native
thread structure as another thread may be concurrently accessing it.
However, they must have a reference to the java level thread --
therefore, it is safe to free during GC when the thread is determined
to be no longer reachable. */
sysFree(ee->stack);
sysFree(ee);
/* If no more daemon threads notify the main thread (which
may be waiting to exit VM). Note, this is not protected
by lock, but main thread checks again */
if(non_daemon_thrds == 0) {
/* No need to bother with disabling suspension
around lock, as we're no longer on thread list */
pthread_mutex_lock(&exit_lock);
pthread_cond_signal(&exit_cv);
pthread_mutex_unlock(&exit_lock);
}
/* Finally, clear the thread local data */
setThreadSelf(NULL);
TRACE("Thread %p id: %d detached from VM\n", thread, thread->id);
} | false | false | false | false | false | 0 |
u8_reader(struct driver_data *drv_data)
{
while ((pxa2xx_spi_read(drv_data, SSSR) & SSSR_RNE)
&& (drv_data->rx < drv_data->rx_end)) {
*(u8 *)(drv_data->rx) = pxa2xx_spi_read(drv_data, SSDR);
++drv_data->rx;
}
return drv_data->rx == drv_data->rx_end;
} | false | false | false | false | false | 0 |
create_elements()
{
if (!_have_elements) {
for (RouterT::iterator x = _router->begin_elements(); x; ++x)
_elements.push_back(x);
if (_elements.size()) // sort by name
qsort(&_elements[0], _elements.size(), sizeof(ElementT *), element_name_compar);
_have_elements = true;
}
} | false | false | false | false | false | 0 |
ws_utf8_append_char(WsUtf8String *string, unsigned long ch)
{
unsigned char *d;
unsigned int num_bytes = WS_UTF8_ENC_TYPE(ch);
unsigned int len, i;
if (num_bytes == 0)
ws_fatal("ws_utf8_append_char(): 0x%lx is not a valid UTF-8 character",
ch);
d = ws_realloc(string->data, string->len + num_bytes);
if (d == NULL)
return 0;
len = string->len;
/* Encode the continuation bytes (n > 1). */
for (i = num_bytes - 1; i > 0; i--) {
d[len + i] = WS_UTF8_ENC_C_BITS;
d[len + i] |= ch & WS_UTF8_CONT_DATA_MASK;
ch >>= 6;
}
/* And continue the first byte. */
d[len] = utf8_hibits[num_bytes];
d[len] |= ch;
string->data = d;
string->len += num_bytes;
string->num_chars++;
return 1;
} | false | false | false | false | false | 0 |
fs_gl_bind_texture(int texture) {
if (g_current_texture == texture) {
return;
}
#ifdef TRACE
printf("glBindTexture %d\n", texture);
#endif
glBindTexture(GL_TEXTURE_2D, texture);
CHECK_GL_ERROR();
g_current_texture = texture;
} | false | false | false | false | false | 0 |
endElement(EndElementEvent *event)
{
SGMLApplication::EndElementEvent appEvent;
setString(appEvent.gi, event->name());
setLocation(appEvent.pos, event->location());
app_->endElement(appEvent);
delete event;
} | false | false | false | false | false | 0 |
gsb_file_load_currency ( const gchar **attribute_names,
const gchar **attribute_values )
{
gint i=0;
gint currency_number;
if ( !attribute_names[i] )
return;
currency_number = gsb_data_currency_new (NULL);
/* Default */
gsb_data_currency_set_floating_point ( currency_number, 2 );
do
{
/* we test at the beginning if the attribute_value is NULL, if yes, */
/* go to the next */
if ( !strcmp (attribute_values[i],
"(null)"))
{
i++;
continue;
}
if ( !strcmp ( attribute_names[i],
"Nb" ))
{
currency_number = gsb_data_currency_set_new_number ( currency_number,
utils_str_atoi (attribute_values[i]));
i++;
continue;
}
if ( !strcmp ( attribute_names[i],
"Na" ))
{
gsb_data_currency_set_name ( currency_number,
attribute_values[i]);
i++;
continue;
}
if ( !strcmp ( attribute_names[i],
"Co" ))
{
struct iso_4217_currency * currency = iso_4217_currencies;
gsb_data_currency_set_code ( currency_number, attribute_values[i]);
/* Check if a iso code is the same as currency code (old import). */
while ( currency -> country_name )
{
if ( !strcmp ( currency -> currency_code, attribute_values[i] ) )
{
gsb_data_currency_set_code_iso4217 ( currency_number,
attribute_values[i]);
}
currency++;
}
i++;
continue;
}
if ( !strcmp ( attribute_names[i],
"Ico" ))
{
gsb_data_currency_set_code_iso4217 ( currency_number,
attribute_values[i]);
i++;
continue;
}
if ( !strcmp ( attribute_names[i],
"Fl" ))
{
gsb_data_currency_set_floating_point ( currency_number,
utils_str_atoi (attribute_values[i]));
i++;
continue;
}
/* normally, shouldn't come here */
i++;
}
while ( attribute_names[i] );
/* initialization of the currency for the payees, categories and
* budgetary lines in case of need */
if ( no_devise_totaux_tiers == 0 )
{
GSList *tmp_list;
tmp_list = gsb_data_currency_get_currency_list ( );
if ( g_slist_length ( tmp_list ) > 0 )
no_devise_totaux_tiers = gsb_data_currency_get_no_currency (
g_slist_nth_data ( tmp_list, 0 ) );
}
if ( no_devise_totaux_categ == 0 )
{
GSList *tmp_list;
tmp_list = gsb_data_currency_get_currency_list ( );
if ( g_slist_length ( tmp_list ) > 0 )
no_devise_totaux_categ = gsb_data_currency_get_no_currency (
g_slist_nth_data ( tmp_list, 0 ) );
}
if ( no_devise_totaux_ib == 0 )
{
GSList *tmp_list;
tmp_list = gsb_data_currency_get_currency_list ( );
if ( g_slist_length ( tmp_list ) > 0 )
no_devise_totaux_ib = gsb_data_currency_get_no_currency (
g_slist_nth_data ( tmp_list, 0 ) );
}
} | false | false | false | false | false | 0 |
transport_set_vpd_ident(struct t10_vpd *vpd, unsigned char *page_83)
{
static const char hex_str[] = "0123456789abcdef";
int j = 0, i = 4; /* offset to start of the identifier */
/*
* The VPD Code Set (encoding)
*
* from spc3r23.pdf Section 7.6.3.1 Table 296
*/
vpd->device_identifier_code_set = (page_83[0] & 0x0f);
switch (vpd->device_identifier_code_set) {
case 0x01: /* Binary */
vpd->device_identifier[j++] =
hex_str[vpd->device_identifier_type];
while (i < (4 + page_83[3])) {
vpd->device_identifier[j++] =
hex_str[(page_83[i] & 0xf0) >> 4];
vpd->device_identifier[j++] =
hex_str[page_83[i] & 0x0f];
i++;
}
break;
case 0x02: /* ASCII */
case 0x03: /* UTF-8 */
while (i < (4 + page_83[3]))
vpd->device_identifier[j++] = page_83[i++];
break;
default:
break;
}
return transport_dump_vpd_ident(vpd, NULL, 0);
} | false | false | false | false | false | 0 |
BoyerMoore (char *query, int querylen, char *text, int textlen) {
#ifndef STANDALONE
Intlist_T hits = NULL;
#endif
int i, j, *good_suffix_shift, *bad_char_shift;
if (query_okay(query,querylen)) {
good_suffix_shift = precompute_good_suffix_shift(query,querylen);
bad_char_shift = precompute_bad_char_shift(query,querylen);
debug(
printf("bad_char_shift:\n");
for (i = 0; i < ASIZE; i++) {
printf("%d %d\n",i,bad_char_shift[i]);
}
printf("\n");
printf("good_suffix_shift:\n");
for (i = 0; i < querylen; i++) {
printf("%d %d\n",i,good_suffix_shift[i]);
}
);
j = 0;
while (j <= textlen - querylen) {
#ifdef PMAP
for (i = querylen - 1; i >= 0 && matchtable[query[i]-'A'][text[i+j]-'A'] == true; i--) ;
#else
for (i = querylen - 1; i >= 0 && query[i] == text[i+j]; i--) ;
#endif
if (i < 0) {
#ifndef STANDALONE
hits = Intlist_push(hits,j);
#endif
debug1(printf("Success at %d\n",j));
debug(printf("Shift by %d (Gs[0])\n",good_suffix_shift[0]));
j += good_suffix_shift[0];
} else {
debug(
if (good_suffix_shift[i] >
bad_char_shift[na_index(text[i+j])] - querylen + 1 + i) {
printf("Shift by %d (Gs[%d])\n",
good_suffix_shift[i],i);
} else {
printf("Shift by %d (Gs[%d] == Bc[%c] - %d + %d)\n",
bad_char_shift[na_index(text[i+j])] - querylen + 1 + i,
i,text[i+j],querylen,i+1);
}
);
j += MAX(good_suffix_shift[i],
bad_char_shift[na_index(text[i+j])] - querylen + 1 + i);
}
}
FREE(bad_char_shift);
FREE(good_suffix_shift);
}
#ifndef STANDALONE
return hits;
#endif
} | false | false | false | false | false | 0 |
dbrpcinit(DBPROCESS * dbproc, const char rpcname[], DBSMALLINT options)
{
DBREMOTE_PROC **rpc;
int dbrpcrecompile = 0;
tdsdump_log(TDS_DBG_FUNC, "dbrpcinit(%p, %s, %d)\n", dbproc, rpcname, options);
CHECK_DBPROC();
DBPERROR_RETURN(IS_TDSDEAD(dbproc->tds_socket), SYBEDDNE);
CHECK_NULP(rpcname, "dbrpcinit", 2, FAIL);
/*
* TODO: adhere to docs. Only Microsoft supports DBRPCRESET. They say:
* "Cancels a single stored procedure or a batch of stored procedures.
* If rpcname is specified, that new stored procedure is initialized after the cancellation is complete."
*/
if (options & DBRPCRESET) {
rpc_clear(dbproc->rpc);
dbproc->rpc = NULL;
return SUCCEED;
}
/* any bits we want from the options argument */
dbrpcrecompile = options & DBRPCRECOMPILE;
options &= ~DBRPCRECOMPILE; /* turn that one off, now that we've extracted it */
/* all other options except DBRPCRECOMPILE are invalid */
DBPERROR_RETURN3(options, SYBEIPV, (int) options, "options", "dbrpcinit");
/* find a free node */
for (rpc = &dbproc->rpc; *rpc != NULL; rpc = &(*rpc)->next) {
/* check existing nodes for name match (there shouldn't be one) */
if ((*rpc)->name == NULL || strcmp((*rpc)->name, rpcname) == 0) {
tdsdump_log(TDS_DBG_INFO1, "error: dbrpcinit called twice for procedure \"%s\"\n", rpcname);
return FAIL;
}
}
/* rpc now contains the address of the dbproc's first empty (null) DBREMOTE_PROC* */
/* allocate */
if ((*rpc = (DBREMOTE_PROC *) calloc(1, sizeof(DBREMOTE_PROC))) == NULL) {
dbperror(dbproc, SYBEMEM, errno);
return FAIL;
}
if (((*rpc)->name = strdup(rpcname)) == NULL) {
free(*rpc);
*rpc = NULL;
dbperror(dbproc, SYBEMEM, errno);
return FAIL;
}
/* store */
(*rpc)->options = options & DBRPCRECOMPILE;
(*rpc)->param_list = NULL;
/* completed */
tdsdump_log(TDS_DBG_INFO1, "dbrpcinit() added rpcname \"%s\"\n", rpcname);
return SUCCEED;
} | false | false | false | false | false | 0 |
search_module_table_by_mtgid_and_mtno(int mtg_id,
int mt_no)
{
Module_table *mdpt;
mdpt = module_head;
while (mdpt != NULL) {
if(search_mt_table_by_mtgid_and_mtno(mdpt->mt_head,
mtg_id,
mt_no) != NULL) {
return(mdpt);
} else {
mdpt = mdpt->next;
}
}
return(mdpt);
} | false | false | false | false | false | 0 |
fill_always_executed_in (struct loop *loop, sbitmap contains_call)
{
basic_block bb = NULL, *bbs, last = NULL;
unsigned i;
edge e;
struct loop *inn_loop = loop;
if (!loop->header->aux)
{
bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; i++)
{
edge_iterator ei;
bb = bbs[i];
if (dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
last = bb;
if (TEST_BIT (contains_call, bb->index))
break;
FOR_EACH_EDGE (e, ei, bb->succs)
if (!flow_bb_inside_loop_p (loop, e->dest))
break;
if (e)
break;
/* A loop might be infinite (TODO use simple loop analysis
to disprove this if possible). */
if (bb->flags & BB_IRREDUCIBLE_LOOP)
break;
if (!flow_bb_inside_loop_p (inn_loop, bb))
break;
if (bb->loop_father->header == bb)
{
if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
break;
/* In a loop that is always entered we may proceed anyway.
But record that we entered it and stop once we leave it. */
inn_loop = bb->loop_father;
}
}
while (1)
{
last->aux = loop;
if (last == loop->header)
break;
last = get_immediate_dominator (CDI_DOMINATORS, last);
}
free (bbs);
}
for (loop = loop->inner; loop; loop = loop->next)
fill_always_executed_in (loop, contains_call);
} | false | false | false | false | false | 0 |
raise_exception(struct ast_channel *chan, const char *reason, int priority)
{
struct ast_datastore *ds = ast_channel_datastore_find(chan, &exception_store_info, NULL);
struct pbx_exception *exception = NULL;
if (!ds) {
ds = ast_datastore_alloc(&exception_store_info, NULL);
if (!ds)
return -1;
if (!(exception = ast_calloc_with_stringfields(1, struct pbx_exception, 128))) {
ast_datastore_free(ds);
return -1;
}
ds->data = exception;
ast_channel_datastore_add(chan, ds);
} else
exception = ds->data;
ast_string_field_set(exception, reason, reason);
ast_string_field_set(exception, context, ast_channel_context(chan));
ast_string_field_set(exception, exten, ast_channel_exten(chan));
exception->priority = ast_channel_priority(chan);
set_ext_pri(chan, "e", priority);
return 0;
} | false | false | false | false | false | 0 |
substring(int pos, int len) const
{
if (pos < 0)
pos += _r.length;
int pos2;
if (len < 0)
pos2 = _r.length + len;
else if (pos >= 0 && len >= _r.length) // avoid integer overflow
pos2 = _r.length;
else
pos2 = pos + len;
if (pos < 0)
pos = 0;
if (pos2 > _r.length)
pos2 = _r.length;
if (pos >= pos2)
return String();
else {
_r.ref();
return String(_r.data + pos, pos2 - pos, _r.memo());
}
} | false | false | false | false | false | 0 |
perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
{
if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
/* TODO: We don't support guest os callchain now */
return;
}
perf_callchain_store(entry, regs->ip);
dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry);
} | false | false | false | false | false | 0 |
gather_blocks_in_sese_region (basic_block entry, basic_block exit,
vec<basic_block> *bbs_p)
{
basic_block son;
for (son = first_dom_son (CDI_DOMINATORS, entry);
son;
son = next_dom_son (CDI_DOMINATORS, son))
{
bbs_p->safe_push (son);
if (son != exit)
gather_blocks_in_sese_region (son, exit, bbs_p);
}
} | false | false | false | false | false | 0 |
strlencspn(const char *s, size_t len, const char *accept)
{
size_t i;
for (i = 0; i < len; ++i) {
/* likely we can do better by inlining this function
* but this works for now
*/
if (strchr(accept, s[i]) != NULL) {
return i;
}
}
return len;
} | false | false | false | false | false | 0 |
GetClientID (Window window)
/* This function returns the value of the session manager client ID property
* given a valid window handle. If no such property exists on a window then
* null is returned
*/
{
char *client_id = NULL;
Window client_leader;
XTextProperty tp;
Atom actual_type;
int actual_format;
unsigned long nitems;
unsigned long bytes_after;
unsigned char *prop = NULL;
if (XGetWindowProperty (dpy, window, _XA_WM_CLIENT_LEADER,
0L, 1L, False, AnyPropertyType, &actual_type, &actual_format,
&nitems, &bytes_after, &prop) == Success)
{
if (actual_type == XA_WINDOW && actual_format == 32 &&
nitems == 1 && bytes_after == 0)
{
client_leader = *((Window *) prop);
if (XGetTextProperty (dpy, client_leader, &tp, _XA_SM_CLIENT_ID))
{
if (tp.encoding == XA_STRING &&
tp.format == 8 && tp.nitems != 0)
client_id = (char *) tp.value;
}
}
if (prop)
XFree (prop);
}
return client_id;
} | false | false | false | false | false | 0 |
writeBlock(uint32_t *block, uint32_t value) {
uint32_t *limit=block+UTRIE2_DATA_BLOCK_LENGTH;
while(block<limit) {
*block++=value;
}
} | false | false | false | false | false | 0 |
FillRegexes()
{
wxListBox* list = XRCCTRL(*this, "lstRegex", wxListBox);
list->Clear();
for (size_t i = 0; i < m_Regexes.Count(); ++i)
{
RegExStruct& rs = m_Regexes[i];
list->Append(rs.desc);
}
list->SetSelection(m_SelectedRegex);
FillRegexDetails(m_SelectedRegex);
} | false | false | false | false | false | 0 |
process_sflag()
{
if (sflag) {
long n;
VALUE *args;
n = RARRAY(rb_argv)->len;
args = RARRAY(rb_argv)->ptr;
while (n > 0) {
VALUE v = *args++;
char *s = StringValuePtr(v);
char *p;
int hyphen = Qfalse;
if (s[0] != '-') break;
n--;
if (s[1] == '-' && s[2] == '\0') break;
v = Qtrue;
/* check if valid name before replacing - with _ */
for (p = s + 1; *p; p++) {
if (*p == '=') {
*p++ = '\0';
v = rb_str_new2(p);
break;
}
if (*p == '-') {
hyphen = Qtrue;
}
else if (*p != '_' && !ISALNUM(*p)) {
VALUE name_error[2];
name_error[0] = rb_str_new2("invalid name for global variable - ");
if (!(p = strchr(p, '='))) {
rb_str_cat2(name_error[0], s);
}
else {
rb_str_cat(name_error[0], s, p - s);
}
name_error[1] = args[-1];
rb_exc_raise(rb_class_new_instance(2, name_error, rb_eNameError));
}
}
s[0] = '$';
if (hyphen) {
for (p = s + 1; *p; ++p) {
if (*p == '-') *p = '_';
}
}
rb_gv_set(s, v);
}
n = RARRAY(rb_argv)->len - n;
while (n--) {
rb_ary_shift(rb_argv);
}
}
sflag = 0;
} | true | true | false | true | true | 1 |
esl_keyhash_Lookup(const ESL_KEYHASH *kh, const char *key, esl_pos_t n, int *opt_index)
{
uint32_t val = jenkins_hash(key, n, kh->hashsize);
int idx;
for (idx = kh->hashtable[val]; idx != -1; idx = kh->nxt[idx])
if (strcmp(key, kh->smem + kh->key_offset[idx]) == 0)
{
if (opt_index != NULL) *opt_index = idx;
return eslOK;
}
if (opt_index != NULL) *opt_index = -1;
return eslENOTFOUND;
} | false | false | false | false | false | 0 |
OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert)
{
OCSP_SIGNATURE *sig;
if (!req->optionalSignature)
req->optionalSignature = OCSP_SIGNATURE_new();
sig = req->optionalSignature;
if (!sig) return 0;
if (!cert) return 1;
if (!sig->certs && !(sig->certs = sk_X509_new_null()))
return 0;
if(!sk_X509_push(sig->certs, cert)) return 0;
CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509);
return 1;
} | false | false | false | false | false | 0 |
print_report_draw_column ( GtkTableChild *child,
gint line_position )
{
gint column_position = 0;
gint i;
/* calculate the column position */
for (i=0 ; i<child -> left_attach ; i++)
column_position = column_position + columns_width[i];
/* draw the line */
cairo_move_to (cr, column_position, line_position);
cairo_set_line_width (cr, 0.5);
cairo_line_to (cr, column_position, line_position + size_row );
cairo_stroke (cr);
} | false | false | false | false | false | 0 |
get_proof_pattern( const Expr& pf, Expr& modE )
{
if( pf[0]==d_cnf_add_unit_str )
{
if( pf[2][0]==d_iff_mp_str )
{
if( pf[2][3][0]==d_eq_symm_str && pf[2][4][0]==d_if_lift_rule_str )
{
if( pf[2][3][4][0]==d_iff_mp_str )
{
if( pf[2][3][4][3][0]==d_var_intro_str &&
pf[2][3][4][4][0]==d_assump_str )
{
return 1;
}
}
}
}
}
return 0;
} | false | false | false | false | false | 0 |
proc_anon_server_kx (gnutls_session_t session, opaque * data,
size_t _data_size)
{
int ret;
/* set auth_info */
if ((ret =
_gnutls_auth_info_set (session, GNUTLS_CRD_ANON,
sizeof (anon_auth_info_st), 1)) < 0)
{
gnutls_assert ();
return ret;
}
ret = _gnutls_proc_dh_common_server_kx (session, data, _data_size, 0);
if (ret < 0)
{
gnutls_assert ();
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
AddDescriptorToIsomOD(GF_IsomObjectDescriptor *od, GF_Descriptor *desc)
{
if (!od || !desc) return GF_BAD_PARAM;
//check if we can handle ContentClassif tags
if ( (desc->tag >= GF_ODF_OCI_BEGIN_TAG) &&
(desc->tag <= GF_ODF_OCI_END_TAG) ) {
return gf_list_add(od->OCIDescriptors, desc);
}
//or extension ...
if ( (desc->tag >= GF_ODF_EXT_BEGIN_TAG) &&
(desc->tag <= GF_ODF_EXT_END_TAG) ) {
return gf_list_add(od->extensionDescriptors, desc);
}
switch (desc->tag) {
case GF_ODF_ESD_TAG:
return GF_ODF_FORBIDDEN_DESCRIPTOR;
case GF_ODF_ESD_INC_TAG:
//there shouldn't be ref if inc
if (gf_list_count(od->ES_ID_RefDescriptors)) return GF_ODF_FORBIDDEN_DESCRIPTOR;
return gf_list_add(od->ES_ID_IncDescriptors, desc);
case GF_ODF_ESD_REF_TAG:
//there shouldn't be inc if ref
if (gf_list_count(od->ES_ID_IncDescriptors)) return GF_ODF_FORBIDDEN_DESCRIPTOR;
return gf_list_add(od->ES_ID_RefDescriptors, desc);
//we use the same struct for v1 and v2 IPMP DPs
case GF_ODF_IPMP_PTR_TAG:
case GF_ODF_IPMP_TAG:
return gf_list_add(od->IPMP_Descriptors, desc);
default:
return GF_BAD_PARAM;
}
} | false | false | false | false | false | 0 |
FinalizeWalls()
{
for(size_t z = 0; z < m_zone.size(); z++ ) {
const size_t startZone = m_zone[z][0];
const size_t endZone = m_zone[z][1];// note: wall after endZone is not local
for( size_t pos = startZone; pos < endZone; pos++ ) {
if (m_wall[ pos ]) {
m_localWall[ pos ] = z;
m_wall[ pos ] = false;
VERBOSE(3,"SETTING local wall " << pos << std::endl);
}
// enforce that local walls only apply to innermost zone
else if (m_localWall[ pos ] != NOT_A_ZONE) {
size_t assigned_z = m_localWall[ pos ];
if ((m_zone[assigned_z][0] < startZone) ||
(m_zone[assigned_z][1] > endZone)) {
m_localWall[ pos ] = z;
}
}
}
}
} | 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.