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 |
|---|---|---|---|---|---|---|
ReassociateOps(unsigned Opc, DebugLoc DL,
SDValue N0, SDValue N1) {
EVT VT = N0.getValueType();
if (N0.getOpcode() == Opc && isa<ConstantSDNode>(N0.getOperand(1))) {
if (isa<ConstantSDNode>(N1)) {
// reassoc. (op (op x, c1), c2) -> (op x, (op c1, c2))
SDValue OpNode =
DAG.FoldConstantArithmetic(Opc, VT,
cast<ConstantSDNode>(N0.getOperand(1)),
cast<ConstantSDNode>(N1));
return DAG.getNode(Opc, DL, VT, N0.getOperand(0), OpNode);
} else if (N0.hasOneUse()) {
// reassoc. (op (op x, c1), y) -> (op (op x, y), c1) iff x+c1 has one use
SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
N0.getOperand(0), N1);
AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, DL, VT, OpNode, N0.getOperand(1));
}
}
if (N1.getOpcode() == Opc && isa<ConstantSDNode>(N1.getOperand(1))) {
if (isa<ConstantSDNode>(N0)) {
// reassoc. (op c2, (op x, c1)) -> (op x, (op c1, c2))
SDValue OpNode =
DAG.FoldConstantArithmetic(Opc, VT,
cast<ConstantSDNode>(N1.getOperand(1)),
cast<ConstantSDNode>(N0));
return DAG.getNode(Opc, DL, VT, N1.getOperand(0), OpNode);
} else if (N1.hasOneUse()) {
// reassoc. (op y, (op x, c1)) -> (op (op x, y), c1) iff x+c1 has one use
SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
N1.getOperand(0), N0);
AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, DL, VT, OpNode, N1.getOperand(1));
}
}
return SDValue();
} | false | false | false | false | false | 0 |
radio_si4713_g_modulator(struct file *file, void *p,
struct v4l2_modulator *vm)
{
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
g_modulator, vm);
} | false | false | false | false | false | 0 |
section_entry_str_new(struct section *psection,
const char *name, const char *value,
bool escaped)
{
struct entry *pentry = entry_new(psection, name);
if (NULL != pentry) {
pentry->type = ENTRY_STR;
pentry->string.value = fc_strdup(NULL != value ? value : "");
pentry->string.escaped = escaped;
}
return pentry;
} | false | false | false | false | false | 0 |
option_gui_update(struct option *poption)
{
if (NULL != option_dialog
&& ODM_OPTSET == option_dialog->mode
&& option_optset(poption) == option_dialog->optset.poptset
&& option_category(poption) == option_dialog->optset.category) {
option_widget_update(poption);
}
} | false | false | false | false | false | 0 |
ppp_recv_proto_rej(struct ppp_t *ppp, uint16_t proto)
{
struct ppp_handler_t *ppp_h;
list_for_each_entry(ppp_h, &ppp->chan_handlers, entry) {
if (ppp_h->proto == proto) {
if (ppp_h->recv_proto_rej)
ppp_h->recv_proto_rej(ppp_h);
return;
}
}
list_for_each_entry(ppp_h, &ppp->unit_handlers, entry) {
if (ppp_h->proto == proto) {
if (ppp_h->recv_proto_rej)
ppp_h->recv_proto_rej(ppp_h);
return;
}
}
} | false | false | false | false | false | 0 |
pathconf_inner(const char *path, int arg)
{
long result;
errno = EINVAL; /* IRIX 5.2 fails to set on errors */
result = pathconf(path, arg);
if (result < 0)
{
switch (errno)
{
case ENOSYS: /* lotsa systems say this for EINVAL */
#ifdef EOPNOTSUPP
case EOPNOTSUPP: /* HPUX says this for EINVAL */
#endif
errno = EINVAL;
break;
}
}
return result;
} | false | false | false | false | false | 0 |
printLinkageType(GlobalValue::LinkageTypes LT) {
switch (LT) {
case GlobalValue::InternalLinkage:
Out << "GlobalValue::InternalLinkage"; break;
case GlobalValue::PrivateLinkage:
Out << "GlobalValue::PrivateLinkage"; break;
case GlobalValue::AvailableExternallyLinkage:
Out << "GlobalValue::AvailableExternallyLinkage "; break;
case GlobalValue::LinkOnceAnyLinkage:
Out << "GlobalValue::LinkOnceAnyLinkage "; break;
case GlobalValue::LinkOnceODRLinkage:
Out << "GlobalValue::LinkOnceODRLinkage "; break;
case GlobalValue::WeakAnyLinkage:
Out << "GlobalValue::WeakAnyLinkage"; break;
case GlobalValue::WeakODRLinkage:
Out << "GlobalValue::WeakODRLinkage"; break;
case GlobalValue::AppendingLinkage:
Out << "GlobalValue::AppendingLinkage"; break;
case GlobalValue::ExternalLinkage:
Out << "GlobalValue::ExternalLinkage"; break;
case GlobalValue::ExternalWeakLinkage:
Out << "GlobalValue::ExternalWeakLinkage"; break;
case GlobalValue::CommonLinkage:
Out << "GlobalValue::CommonLinkage"; break;
}
} | false | false | false | false | false | 0 |
drv_EFN_send(const char *data, const unsigned int len)
{
int n;
// transport command string to EUG 100
n = write(DataSocket, data, len);
if (n < 0) {
error("%s:drv_EFN_send: Failed to write to data socket\n", Name);
}
} | false | false | false | false | false | 0 |
getFCmpValue(bool isordered, unsigned code,
Value *LHS, Value *RHS,
InstCombiner::BuilderTy *Builder) {
CmpInst::Predicate Pred;
switch (code) {
default: llvm_unreachable("Illegal FCmp code!");
case 0: Pred = isordered ? FCmpInst::FCMP_ORD : FCmpInst::FCMP_UNO; break;
case 1: Pred = isordered ? FCmpInst::FCMP_OGT : FCmpInst::FCMP_UGT; break;
case 2: Pred = isordered ? FCmpInst::FCMP_OEQ : FCmpInst::FCMP_UEQ; break;
case 3: Pred = isordered ? FCmpInst::FCMP_OGE : FCmpInst::FCMP_UGE; break;
case 4: Pred = isordered ? FCmpInst::FCMP_OLT : FCmpInst::FCMP_ULT; break;
case 5: Pred = isordered ? FCmpInst::FCMP_ONE : FCmpInst::FCMP_UNE; break;
case 6: Pred = isordered ? FCmpInst::FCMP_OLE : FCmpInst::FCMP_ULE; break;
case 7:
if (!isordered)
return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1);
Pred = FCmpInst::FCMP_ORD; break;
}
return Builder->CreateFCmp(Pred, LHS, RHS);
} | false | false | false | false | false | 0 |
dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusError *error)
{
DBusPendingCall *pending;
SpiReentrantCallClosure *closure;
const char *unique_name = dbus_bus_get_unique_name (bus);
const char *destination = dbus_message_get_destination (message);
struct timeval tv;
DBusMessage *ret;
static gboolean in_dispatch = FALSE;
if (unique_name && destination &&
strcmp (destination, unique_name) != 0)
{
ret = dbus_connection_send_with_reply_and_block (bus, message,
dbind_timeout, error);
if (g_main_depth () == 0 && !in_dispatch)
{
in_dispatch = TRUE;
while (dbus_connection_dispatch (bus) == DBUS_DISPATCH_DATA_REMAINS);
in_dispatch = FALSE;
}
return ret;
}
closure = g_new0 (SpiReentrantCallClosure, 1);
closure->reply = NULL;
if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout)
|| !pending)
{
g_free (closure);
return NULL;
}
dbus_pending_call_set_notify (pending, set_reply, (void *) closure, g_free);
closure->reply = NULL;
gettimeofday (&tv, NULL);
dbus_pending_call_ref (pending);
while (!closure->reply)
{
if (!dbus_connection_read_write_dispatch (bus, dbind_timeout))
{
//dbus_pending_call_set_notify (pending, NULL, NULL, NULL);
dbus_pending_call_cancel (pending);
dbus_pending_call_unref (pending);
return NULL;
}
if (time_elapsed (&tv) > dbind_timeout)
{
//dbus_pending_call_set_notify (pending, NULL, NULL, NULL);
dbus_pending_call_cancel (pending);
dbus_pending_call_unref (pending);
dbus_set_error_const (error, "org.freedesktop.DBus.Error.NoReply",
"timeout from dbind");
return NULL;
}
}
ret = closure->reply;
dbus_pending_call_unref (pending);
return ret;
} | false | false | false | false | false | 0 |
dragEnterEvent( QDragEnterEvent *event )
{
// We want to indicate to the user that dropping to the same collection is not possible.
// CollectionTreeItemModel therefore needs to know what collection the drag originated
// so that is can play with Qt::ItemIsDropEnabled in flags()
const AmarokMimeData *mimeData =
qobject_cast<const AmarokMimeData *>( event->mimeData() );
if( mimeData ) // drag from within Amarok
{
QSet<Collection *> srcCollections;
foreach( Meta::TrackPtr track, mimeData->tracks() )
{
srcCollections.insert( track->collection() );
}
m_treeModel->setDragSourceCollections( srcCollections );
}
QAbstractItemView::dragEnterEvent( event );
} | false | false | false | false | false | 0 |
__kmem_cache_free_bulk(struct kmem_cache *s, size_t nr, void **p)
{
size_t i;
for (i = 0; i < nr; i++)
kmem_cache_free(s, p[i]);
} | false | false | false | false | false | 0 |
find_link(node *n) {
while (n) {
if (n->type == node::link) {
attribute *rel = find_attribute(n, "REL");
attribute *href = find_attribute(n, "HREF");
if (rel && href && rel->value && href->value) {
if (strcasecmp(rel->value, "previous") == 0) {
prevURL = newstr(href->value);
prevItem->setEnabled(true);
}
if (strcasecmp(rel->value, "next") == 0) {
nextURL = newstr(href->value);
nextItem->setEnabled(true);
}
if (strcasecmp(rel->value, "contents") == 0) {
contentsURL = newstr(href->value);
contentsItem->setEnabled(true);
}
}
}
if (n->container)
find_link(n->container);
n = n->next;
}
} | false | false | false | false | false | 0 |
decode_3d_i830(struct drm_intel_decode *ctx)
{
unsigned int idx;
uint32_t opcode;
uint32_t *data = ctx->data;
struct {
uint32_t opcode;
unsigned int min_len;
unsigned int max_len;
const char *name;
} opcodes_3d[] = {
{ 0x02, 1, 1, "3DSTATE_MODES_3" },
{ 0x03, 1, 1, "3DSTATE_ENABLES_1" },
{ 0x04, 1, 1, "3DSTATE_ENABLES_2" },
{ 0x05, 1, 1, "3DSTATE_VFT0" },
{ 0x06, 1, 1, "3DSTATE_AA" },
{ 0x07, 1, 1, "3DSTATE_RASTERIZATION_RULES" },
{ 0x08, 1, 1, "3DSTATE_MODES_1" },
{ 0x09, 1, 1, "3DSTATE_STENCIL_TEST" },
{ 0x0a, 1, 1, "3DSTATE_VFT1" },
{ 0x0b, 1, 1, "3DSTATE_INDPT_ALPHA_BLEND" },
{ 0x0c, 1, 1, "3DSTATE_MODES_5" },
{ 0x0d, 1, 1, "3DSTATE_MAP_BLEND_OP" },
{ 0x0e, 1, 1, "3DSTATE_MAP_BLEND_ARG" },
{ 0x0f, 1, 1, "3DSTATE_MODES_2" },
{ 0x15, 1, 1, "3DSTATE_FOG_COLOR" },
{ 0x16, 1, 1, "3DSTATE_MODES_4"},
}, *opcode_3d;
opcode = (data[0] & 0x1f000000) >> 24;
switch (opcode) {
case 0x1f:
return decode_3d_primitive(ctx);
case 0x1d:
return decode_3d_1d(ctx);
case 0x1c:
return decode_3d_1c(ctx);
}
for (idx = 0; idx < ARRAY_SIZE(opcodes_3d); idx++) {
opcode_3d = &opcodes_3d[idx];
if ((data[0] & 0x1f000000) >> 24 == opcode_3d->opcode) {
unsigned int len = 1, i;
instr_out(ctx, 0, "%s\n", opcode_3d->name);
if (opcode_3d->max_len > 1) {
len = (data[0] & 0xff) + 2;
if (len < opcode_3d->min_len ||
len > opcode_3d->max_len) {
fprintf(out, "Bad count in %s\n",
opcode_3d->name);
}
}
for (i = 1; i < len; i++) {
instr_out(ctx, i, "dword %d\n", i);
}
return len;
}
}
instr_out(ctx, 0, "3D UNKNOWN: 3d_i830 opcode = 0x%x\n",
opcode);
return 1;
} | false | false | false | false | false | 0 |
ImportDERPrivateKey(PK11SlotInfo* slot, const std::vector<uint8>& input, const std::string& name) {
SECItem der_private_key_info;
SECStatus rv;
der_private_key_info.data = const_cast<unsigned char*>(&input.front());
der_private_key_info.len = input.size();
//The private key is set to be used for
//key unwrapping, data decryption, and signature generation.
SECItem nickname;
nickname.data = (unsigned char*)(name.c_str());
nickname.len = name.size();
const unsigned int key_usage = KU_KEY_ENCIPHERMENT | KU_DATA_ENCIPHERMENT |
KU_DIGITAL_SIGNATURE;
rv = PK11_ImportDERPrivateKeyInfoAndReturnKey(
slot, &der_private_key_info, &nickname, NULL, PR_TRUE, PR_FALSE,
key_usage, NULL, NULL);//&privKey, NULL);
if(rv != SECSuccess) {
NSSUtilLogger.msg(ERROR, "Failed to import private key");
return false;
}
else NSSUtilLogger.msg(INFO, "Succeeded to import private key");
return true;
} | false | false | false | false | false | 0 |
thermal_of_populate_trip(struct device_node *np,
struct thermal_trip *trip)
{
int prop;
int ret;
ret = of_property_read_u32(np, "temperature", &prop);
if (ret < 0) {
pr_err("missing temperature property\n");
return ret;
}
trip->temperature = prop;
ret = of_property_read_u32(np, "hysteresis", &prop);
if (ret < 0) {
pr_err("missing hysteresis property\n");
return ret;
}
trip->hysteresis = prop;
ret = thermal_of_get_trip_type(np, &trip->type);
if (ret < 0) {
pr_err("wrong trip type property\n");
return ret;
}
/* Required for cooling map matching */
trip->np = np;
of_node_get(np);
return 0;
} | false | false | false | false | false | 0 |
SmiAddConstant(Register dst, Register src, Smi* constant) {
if (constant->value() == 0) {
if (!dst.is(src)) {
movq(dst, src);
}
return;
} else if (dst.is(src)) {
ASSERT(!dst.is(kScratchRegister));
switch (constant->value()) {
case 1:
addq(dst, kSmiConstantRegister);
return;
case 2:
lea(dst, Operand(src, kSmiConstantRegister, times_2, 0));
return;
case 4:
lea(dst, Operand(src, kSmiConstantRegister, times_4, 0));
return;
case 8:
lea(dst, Operand(src, kSmiConstantRegister, times_8, 0));
return;
default:
Register constant_reg = GetSmiConstant(constant);
addq(dst, constant_reg);
return;
}
} else {
switch (constant->value()) {
case 1:
lea(dst, Operand(src, kSmiConstantRegister, times_1, 0));
return;
case 2:
lea(dst, Operand(src, kSmiConstantRegister, times_2, 0));
return;
case 4:
lea(dst, Operand(src, kSmiConstantRegister, times_4, 0));
return;
case 8:
lea(dst, Operand(src, kSmiConstantRegister, times_8, 0));
return;
default:
LoadSmiConstant(dst, constant);
addq(dst, src);
return;
}
}
} | false | false | false | false | false | 0 |
mprRelease(void *ptr)
{
MprMem *mp;
if (ptr) {
mp = GET_MEM(ptr);
if (VALID_BLK(mp)) {
mprAssert(!IS_FREE(mp));
/* Lock-free update of mp->gen */
SET_FIELD2(mp, GET_SIZE(mp), heap->active, UNMARKED, 0);
}
}
} | false | false | false | false | false | 0 |
error(ErrorCategory category, Goffset pos, const char *msg, ...) {
va_list args;
GooString *s, *sanitized;
// NB: this can be called before the globalParams object is created
if (!errorCbk && globalParams && globalParams->getErrQuiet()) {
return;
}
va_start(args, msg);
s = GooString::formatv(msg, args);
va_end(args);
sanitized = new GooString ();
for (int i = 0; i < s->getLength(); ++i) {
const char c = s->getChar(i);
if (c < (char)0x20 || c >= (char)0x7f) {
sanitized->appendf("<{0:02x}>", c & 0xff);
} else {
sanitized->append(c);
}
}
if (errorCbk) {
(*errorCbk)(errorCbkData, category, pos, sanitized->getCString());
} else {
if (pos >= 0) {
fprintf(stderr, "%s (%lld): %s\n",
errorCategoryNames[category], (long long)pos, sanitized->getCString());
} else {
fprintf(stderr, "%s: %s\n",
errorCategoryNames[category], sanitized->getCString());
}
fflush(stderr);
}
delete s;
delete sanitized;
} | false | false | false | false | false | 0 |
fill_response_items(krb5_context context, krb5_init_creds_context ctx,
krb5_pa_data **in_padata)
{
struct krb5_preauth_context_st *pctx = context->preauth_context;
krb5_get_init_creds_opt *opt = (krb5_get_init_creds_opt *)ctx->opte;
krb5_error_code ret;
krb5_pa_data *pa;
clpreauth_handle h;
int i;
k5_response_items_reset(ctx->rctx.items);
for (i = 0; in_padata[i] != NULL; i++) {
pa = in_padata[i];
if (!pa_type_allowed(ctx, pa->pa_type))
continue;
h = find_module(pctx->handles, pa->pa_type);
if (h == NULL)
continue;
ret = clpreauth_prep_questions(context, h, opt, &callbacks,
(krb5_clpreauth_rock)ctx,
ctx->request, ctx->inner_request_body,
ctx->encoded_previous_request, pa);
if (ret)
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
asn1PE_H245NetworkAccessParameters_networkAddress (OOCTXT* pctxt, H245NetworkAccessParameters_networkAddress* pvalue)
{
static Asn1SizeCnst e164Address_lsize1 = { 0, 1, 128, 0 };
int stat = ASN_OK;
ASN1BOOL extbit;
/* extension bit */
extbit = (ASN1BOOL)(pvalue->t > 3);
encodeBit (pctxt, extbit);
if (!extbit) {
/* Encode choice index value */
stat = encodeConsUnsigned (pctxt, pvalue->t - 1, 0, 2);
if (stat != ASN_OK) return stat;
/* Encode root element data value */
switch (pvalue->t)
{
/* q2931Address */
case 1:
stat = asn1PE_H245Q2931Address (pctxt, pvalue->u.q2931Address);
if (stat != ASN_OK) return stat;
break;
/* e164Address */
case 2:
addSizeConstraint (pctxt, &e164Address_lsize1);
stat = encodeConstrainedStringEx (pctxt, pvalue->u.e164Address, gs_MULTIMEDIA_SYSTEM_CONTROL_NetworkAccessParameters_networkAddress_e164Address_CharSet, 4, 4, 7);
if (stat != ASN_OK) return stat;
break;
/* localAreaAddress */
case 3:
stat = asn1PE_H245TransportAddress (pctxt, pvalue->u.localAreaAddress);
if (stat != ASN_OK) return stat;
break;
default:
return ASN_E_INVOPT;
}
}
else {
/* Encode extension choice index value */
stat = encodeSmallNonNegWholeNumber (pctxt, pvalue->t - 4);
if (stat != ASN_OK) return stat;
/* Encode extension element data value */
}
return (stat);
} | false | false | false | false | false | 0 |
channel_detach_buffers(struct dim_channel *ch, u16 buffers_number)
{
if (buffers_number > ch->done_sw_buffers_number)
return dim_on_error(DIM_ERR_UNDERFLOW, "Channel underflow");
ch->done_sw_buffers_number -= buffers_number;
return true;
} | false | false | false | false | false | 0 |
mapprime()
{
register char *lp;
register char *up;
register int c;
register int i;
static char lower[] = "abcdefghijklmnopqrstuvwxyz";
static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (lp = lower, up = upper; *lp != '\0'; lp++, up++) {
c = *lp;
cmap[c+OFFSET] = c;
cmap[*up+OFFSET] = c;
}
for (i = 0; i < MAPSIZE; i++)
if (cmap[i] == '\0')
cmap[i] = (char)(i-OFFSET);
mprimed = 1;
} | false | false | false | false | false | 0 |
PruneLinedefs(void)
{
int i;
int new_num;
DisplayTicker();
// scan all linedefs
for (i=0, new_num=0; i < num_linedefs; i++)
{
linedef_t *L = lev_linedefs[i];
// handle duplicated vertices
while (L->start->equiv)
{
L->start->ref_count--;
L->start = L->start->equiv;
L->start->ref_count++;
}
while (L->end->equiv)
{
L->end->ref_count--;
L->end = L->end->equiv;
L->end->ref_count++;
}
// handle duplicated sidedefs
while (L->right && L->right->equiv)
{
L->right->ref_count--;
L->right = L->right->equiv;
L->right->ref_count++;
}
while (L->left && L->left->equiv)
{
L->left->ref_count--;
L->left = L->left->equiv;
L->left->ref_count++;
}
// remove zero length lines
if (L->zero_len)
{
L->start->ref_count--;
L->end->ref_count--;
UtilFree(L);
continue;
}
L->index = new_num;
lev_linedefs[new_num++] = L;
}
if (new_num < num_linedefs)
{
PrintVerbose("Pruned %d zero-length linedefs\n", num_linedefs - new_num);
num_linedefs = new_num;
}
if (new_num == 0)
FatalError("Couldn't find any Linedefs");
} | false | false | false | false | false | 0 |
xaccAccountConvertBalanceToCurrency(const Account *acc, /* for book */
gnc_numeric balance,
const gnc_commodity *balance_currency,
const gnc_commodity *new_currency)
{
QofBook *book;
GNCPriceDB *pdb;
if (gnc_numeric_zero_p (balance) ||
gnc_commodity_equiv (balance_currency, new_currency))
return balance;
book = gnc_account_get_book (acc);
pdb = gnc_pricedb_get_db (book);
balance = gnc_pricedb_convert_balance_latest_price(
pdb, balance, balance_currency, new_currency);
return balance;
} | false | false | false | false | false | 0 |
stringContains(char* string, char c) {
int len = stringLength(string);
for (int i = 0; i < len; i++) {
if (string[i] == c) {
return true;
}
}
return false;
} | false | false | false | false | false | 0 |
deceleration_new_frame_cb (ClutterTimeline *timeline,
gint frame_num,
MxKineticScrollView *scroll)
{
MxKineticScrollViewPrivate *priv = scroll->priv;
ClutterActor *child = mx_bin_get_child (MX_BIN (scroll));
if (child)
{
MxAdjustment *hadjust, *vadjust;
gboolean stop = TRUE;
mx_scrollable_get_adjustments (MX_SCROLLABLE (child),
&hadjust, &vadjust);
priv->accumulated_delta += clutter_timeline_get_delta (timeline);
if (priv->accumulated_delta <= 1000.0/60.0)
stop = FALSE;
while (priv->accumulated_delta > 1000.0/60.0)
{
gdouble hvalue, vvalue;
if (hadjust)
{
if (ABS (priv->dx) > 5)
{
hvalue = priv->dx + mx_adjustment_get_value (hadjust);
mx_adjustment_set_value (hadjust, hvalue);
if (priv->overshoot > 0.0)
{
if ((hvalue > mx_adjustment_get_upper (hadjust) -
mx_adjustment_get_page_size (hadjust)) ||
(hvalue < mx_adjustment_get_lower (hadjust)))
priv->dx *= priv->overshoot;
}
priv->dx = priv->dx / priv->decel_rate;
stop = FALSE;
}
else if (priv->hmoving)
{
guint duration;
priv->hmoving = FALSE;
duration = (priv->overshoot > 0.0) ?
priv->clamp_duration : 10;
clamp_adjustments (scroll, duration, TRUE, FALSE);
}
}
if (vadjust)
{
if (ABS (priv->dy) > 5)
{
vvalue = priv->dy + mx_adjustment_get_value (vadjust);
mx_adjustment_set_value (vadjust, vvalue);
if (priv->overshoot > 0.0)
{
if ((vvalue > mx_adjustment_get_upper (vadjust) -
mx_adjustment_get_page_size (vadjust)) ||
(vvalue < mx_adjustment_get_lower (vadjust)))
priv->dy *= priv->overshoot;
}
priv->dy = priv->dy / priv->decel_rate;
stop = FALSE;
}
else if (priv->vmoving)
{
guint duration;
priv->vmoving = FALSE;
duration = (priv->overshoot > 0.0) ?
priv->clamp_duration : 10;
clamp_adjustments (scroll, duration, FALSE, TRUE);
}
}
priv->accumulated_delta -= 1000.0/60.0;
}
if (stop)
{
clutter_timeline_stop (timeline);
deceleration_completed_cb (timeline, scroll);
}
}
} | false | false | false | false | false | 0 |
lookahead(int vert,
int color,
int upper_bound,
Graph* graph,
int* satur_degree){
int i;
int adj_satur;
int adj_num = graph[vert].adj_size;
int* adjs = graph[vert].adjacents;
//Recorro los vecinos del nodo
for (i=0; i<adj_num; ++i){
//Tomo la saturacion del vecino
adj_satur = satur_degree[adjs[i]];
//Si no tiene un nodo adyacente de menor rango
//con este color, aumento su saturacion
if (graph[adjs[i]].color_around[color] == 0)
adj_satur += 1;
//Si su saturacion es igual la cota superior
//menos uno, su FC sera vacio, devuelvo falso.
if (adj_satur == (upper_bound-1))
return 0;
}
//Si ningun vecino devolvio falso,
//devuelvo true.
return 1;
} | false | false | false | false | false | 0 |
fdshq_lt(FieldDoc *fd1, FieldDoc *fd2)
{
int c = 0, i;
Comparable *cmps1 = fd1->comparables;
Comparable *cmps2 = fd2->comparables;
for (i = 0; i < fd1->size && c == 0; i++) {
int type = cmps1[i].type;
switch (type) {
case SORT_TYPE_SCORE:
if (cmps1[i].val.f < cmps2[i].val.f) c = 1;
if (cmps1[i].val.f > cmps2[i].val.f) c = -1;
break;
case SORT_TYPE_FLOAT:
if (cmps1[i].val.f > cmps2[i].val.f) c = 1;
if (cmps1[i].val.f < cmps2[i].val.f) c = -1;
break;
case SORT_TYPE_DOC:
if (fd1->hit.doc > fd2->hit.doc) c = 1;
if (fd1->hit.doc < fd2->hit.doc) c = -1;
break;
case SORT_TYPE_INTEGER:
if (cmps1[i].val.i > cmps2[i].val.i) c = 1;
if (cmps1[i].val.i < cmps2[i].val.i) c = -1;
break;
case SORT_TYPE_BYTE:
if (cmps1[i].val.i > cmps2[i].val.i) c = 1;
if (cmps1[i].val.i < cmps2[i].val.i) c = -1;
break;
case SORT_TYPE_STRING:
do {
char *s1 = cmps1[i].val.s;
char *s2 = cmps2[i].val.s;
if (s1 == NULL) c = s2 ? 1 : 0;
else if (s2 == NULL) c = -1;
#ifdef POSH_OS_WIN32
else c = strcmp(s1, s2);
#else
else c = strcoll(s1, s2);
#endif
} while (0);
break;
default:
RAISE(ARG_ERROR, "Unknown sort type: %d.", type);
break;
}
if (cmps1[i].reverse) {
c = -c;
}
}
if (c == 0) {
return fd1->hit.doc > fd2->hit.doc;
}
else {
return c > 0;
}
} | false | false | false | false | false | 0 |
appendCols(const int numcols,
const CoinPackedVectorBase * const * cols)
{
if (colOrdered_)
appendMajorVectors(numcols, cols);
else
appendMinorVectors(numcols, cols);
} | false | false | false | false | false | 0 |
getLoadStoreMultipleOpcode(unsigned Opcode, ARM_AM::AMSubMode Mode) {
switch (Opcode) {
default: llvm_unreachable("Unhandled opcode!");
case ARM::LDRi12:
++NumLDMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::LDMIA;
case ARM_AM::da: return ARM::LDMDA;
case ARM_AM::db: return ARM::LDMDB;
case ARM_AM::ib: return ARM::LDMIB;
}
case ARM::STRi12:
++NumSTMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::STMIA;
case ARM_AM::da: return ARM::STMDA;
case ARM_AM::db: return ARM::STMDB;
case ARM_AM::ib: return ARM::STMIB;
}
case ARM::tLDRi:
case ARM::tLDRspi:
// tLDMIA is writeback-only - unless the base register is in the input
// reglist.
++NumLDMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::tLDMIA;
}
case ARM::tSTRi:
case ARM::tSTRspi:
// There is no non-writeback tSTMIA either.
++NumSTMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::tSTMIA_UPD;
}
case ARM::t2LDRi8:
case ARM::t2LDRi12:
++NumLDMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::t2LDMIA;
case ARM_AM::db: return ARM::t2LDMDB;
}
case ARM::t2STRi8:
case ARM::t2STRi12:
++NumSTMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::t2STMIA;
case ARM_AM::db: return ARM::t2STMDB;
}
case ARM::VLDRS:
++NumVLDMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::VLDMSIA;
case ARM_AM::db: return 0; // Only VLDMSDB_UPD exists.
}
case ARM::VSTRS:
++NumVSTMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::VSTMSIA;
case ARM_AM::db: return 0; // Only VSTMSDB_UPD exists.
}
case ARM::VLDRD:
++NumVLDMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::VLDMDIA;
case ARM_AM::db: return 0; // Only VLDMDDB_UPD exists.
}
case ARM::VSTRD:
++NumVSTMGened;
switch (Mode) {
default: llvm_unreachable("Unhandled submode!");
case ARM_AM::ia: return ARM::VSTMDIA;
case ARM_AM::db: return 0; // Only VSTMDDB_UPD exists.
}
}
} | false | false | false | false | false | 0 |
remove_fixup_regions (void)
{
int i;
rtx insn, note;
struct eh_region *fixup;
/* Walk the insn chain and adjust the REG_EH_REGION numbers
for instructions referencing fixup regions. This is only
strictly necessary for fixup regions with no parent, but
doesn't hurt to do it for all regions. */
for (insn = get_insns(); insn ; insn = NEXT_INSN (insn))
if (INSN_P (insn)
&& (note = find_reg_note (insn, REG_EH_REGION, NULL))
&& INTVAL (XEXP (note, 0)) > 0
&& (fixup = cfun->eh->region_array[INTVAL (XEXP (note, 0))])
&& fixup->type == ERT_FIXUP)
{
if (fixup->u.fixup.real_region)
XEXP (note, 0) = GEN_INT (fixup->u.fixup.real_region->region_number);
else
remove_note (insn, note);
}
/* Remove the fixup regions from the tree. */
for (i = cfun->eh->last_region_number; i > 0; --i)
{
fixup = cfun->eh->region_array[i];
if (! fixup)
continue;
/* Allow GC to maybe free some memory. */
if (fixup->type == ERT_CLEANUP)
fixup->u.cleanup.exp = NULL_TREE;
if (fixup->type != ERT_FIXUP)
continue;
if (fixup->inner)
{
struct eh_region *parent, *p, **pp;
parent = fixup->u.fixup.real_region;
/* Fix up the children's parent pointers; find the end of
the list. */
for (p = fixup->inner; ; p = p->next_peer)
{
p->outer = parent;
if (! p->next_peer)
break;
}
/* In the tree of cleanups, only outer-inner ordering matters.
So link the children back in anywhere at the correct level. */
if (parent)
pp = &parent->inner;
else
pp = &cfun->eh->region_tree;
p->next_peer = *pp;
*pp = fixup->inner;
fixup->inner = NULL;
}
remove_eh_handler (fixup);
}
} | false | false | false | false | false | 0 |
sanei_w_control_option_req (Wire *w, SANE_Control_Option_Req *req)
{
sanei_w_word (w, &req->handle);
sanei_w_word (w, &req->option);
sanei_w_word (w, &req->action);
/* Up to and including version 2, we incorrectly attempted to encode
the option value even the action was SANE_ACTION_SET_AUTO. */
if (w->version < 3 || req->action != SANE_ACTION_SET_AUTO)
{
sanei_w_word (w, &req->value_type);
sanei_w_word (w, &req->value_size);
w_option_value (w, req->value_type, req->value_size, &req->value);
}
} | false | false | false | false | false | 0 |
enableWindowMode(bool enable)
{
d->mWindowMode = enable;
if (enable && d->mCloseButton) {
d->mCloseButton->show();
} else if (d->mCloseButton) {
d->mCloseButton->hide();
}
} | false | false | false | false | false | 0 |
st_tree_dump_conn(st_tree_t *node, conn_t *conn)
{
int ret;
enum_t *etmp;
range_t *rtmp;
if (!node) {
return 1; /* not an error */
}
if (node->left) {
ret = st_tree_dump_conn(node->left, conn);
if (!ret) {
return 0; /* write failed in the child */
}
}
if (!send_to_one(conn, "SETINFO %s \"%s\"\n", node->var, node->val)) {
return 0; /* write failed, bail out */
}
/* send any enums */
for (etmp = node->enum_list; etmp; etmp = etmp->next) {
if (!send_to_one(conn, "ADDENUM %s \"%s\"\n", node->var, etmp->val)) {
return 0;
}
}
/* send any ranges */
for (rtmp = node->range_list; rtmp; rtmp = rtmp->next) {
if (!send_to_one(conn, "ADDRANGE %s %i %i\n", node->var, rtmp->min, rtmp->max)) {
return 0;
}
}
/* provide any auxiliary data */
if (node->aux) {
if (!send_to_one(conn, "SETAUX %s %d\n", node->var, node->aux)) {
return 0;
}
}
/* finally report any flags */
if (node->flags) {
char flist[SMALLBUF];
/* build the list */
snprintf(flist, sizeof(flist), "%s", node->var);
if (node->flags & ST_FLAG_RW) {
snprintfcat(flist, sizeof(flist), " RW");
}
if (node->flags & ST_FLAG_STRING) {
snprintfcat(flist, sizeof(flist), " STRING");
}
if (!send_to_one(conn, "SETFLAGS %s\n", flist)) {
return 0;
}
}
if (node->right) {
return st_tree_dump_conn(node->right, conn);
}
return 1; /* everything's OK here ... */
} | true | true | false | false | false | 1 |
ActiveObjectsNearGrid(uint32 x, uint32 y) const
{
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
CellPair cell_min(x * MAX_NUMBER_OF_CELLS, y * MAX_NUMBER_OF_CELLS);
CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord + MAX_NUMBER_OF_CELLS);
// we must find visible range in cells so we unload only non-visible cells...
float viewDist = GetVisibilityDistance();
int cell_range = (int)ceilf(viewDist / SIZE_OF_GRID_CELL) + 1;
cell_min << cell_range;
cell_min -= cell_range;
cell_max >> cell_range;
cell_max += cell_range;
for (MapRefManager::const_iterator iter = m_mapRefManager.begin(); iter != m_mapRefManager.end(); ++iter)
{
Player* plr = iter->getSource();
CellPair p = MaNGOS::ComputeCellPair(plr->GetPositionX(), plr->GetPositionY());
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
return true;
}
for (ActiveNonPlayers::const_iterator iter = m_activeNonPlayers.begin(); iter != m_activeNonPlayers.end(); ++iter)
{
WorldObject* obj = *iter;
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
return true;
}
return false;
} | false | false | false | false | false | 0 |
unnest_nesting_tree (struct nesting_info *root)
{
struct nesting_info *n;
FOR_EACH_NEST_INFO (n, root)
unnest_nesting_tree_1 (n);
} | false | false | false | false | false | 0 |
pps_unregister_cdev(struct pps_device *pps)
{
pr_debug("unregistering pps%d\n", pps->id);
pps->lookup_cookie = NULL;
device_destroy(pps_class, pps->dev->devt);
} | false | false | false | false | false | 0 |
__log_inmem_chkspace(dblp, len)
DB_LOG *dblp;
size_t len;
{
DB_LSN active_lsn, old_active_lsn;
ENV *env;
LOG *lp;
struct __db_filestart *filestart;
size_t offset;
int ret;
env = dblp->env;
lp = dblp->reginfo.primary;
DB_ASSERT(env, lp->db_log_inmemory);
/*
* Allow room for an extra header so that we don't need to check for
* space when switching files.
*/
len += sizeof(HDR);
/*
* If transactions are enabled and we're about to fill available space,
* update the active LSN and recheck. If transactions aren't enabled,
* don't even bother checking: in that case we can always overwrite old
* log records, because we're never going to abort.
*/
while (TXN_ON(env) &&
RINGBUF_LEN(lp, lp->b_off, lp->a_off) <= len) {
old_active_lsn = lp->active_lsn;
active_lsn = lp->lsn;
/*
* Drop the log region lock so we don't hold it while
* taking the transaction region lock.
*/
LOG_SYSTEM_UNLOCK(env);
ret = __txn_getactive(env, &active_lsn);
LOG_SYSTEM_LOCK(env);
if (ret != 0)
return (ret);
active_lsn.offset = 0;
/* If we didn't make any progress, give up. */
if (LOG_COMPARE(&active_lsn, &old_active_lsn) == 0) {
__db_errx(env, DB_STR("2535",
"In-memory log buffer is full (an active transaction spans the buffer)"));
return (DB_LOG_BUFFER_FULL);
}
/* Make sure we're moving the region LSN forwards. */
if (LOG_COMPARE(&active_lsn, &lp->active_lsn) > 0) {
lp->active_lsn = active_lsn;
offset = lp->a_off;
(void)__log_inmem_lsnoff(dblp, &active_lsn, &offset);
lp->a_off = (db_size_t)offset;
}
}
/*
* Remove the first file if it is invalidated by this write.
* Log records can't be bigger than a file, so we only need to
* check the first file.
*/
filestart = SH_TAILQ_FIRST(&lp->logfiles, __db_filestart);
if (filestart != NULL &&
RINGBUF_LEN(lp, lp->b_off, filestart->b_off) <= len) {
SH_TAILQ_REMOVE(&lp->logfiles, filestart,
links, __db_filestart);
SH_TAILQ_INSERT_HEAD(&lp->free_logfiles, filestart,
links, __db_filestart);
lp->f_lsn.file = filestart->file + 1;
}
return (0);
} | false | false | false | false | false | 0 |
balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
{
struct page *page, *tmp;
unsigned long flags;
bool dequeued_page;
dequeued_page = false;
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
list_for_each_entry_safe(page, tmp, &b_dev_info->pages, lru) {
/*
* Block others from accessing the 'page' while we get around
* establishing additional references and preparing the 'page'
* to be released by the balloon driver.
*/
if (trylock_page(page)) {
#ifdef CONFIG_BALLOON_COMPACTION
if (!PagePrivate(page)) {
/* raced with isolation */
unlock_page(page);
continue;
}
#endif
balloon_page_delete(page);
__count_vm_event(BALLOON_DEFLATE);
unlock_page(page);
dequeued_page = true;
break;
}
}
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
if (!dequeued_page) {
/*
* If we are unable to dequeue a balloon page because the page
* list is empty and there is no isolated pages, then something
* went out of track and some balloon pages are lost.
* BUG() here, otherwise the balloon driver may get stuck into
* an infinite loop while attempting to release all its pages.
*/
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
if (unlikely(list_empty(&b_dev_info->pages) &&
!b_dev_info->isolated_pages))
BUG();
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
page = NULL;
}
return page;
} | false | false | false | false | false | 0 |
max77693_haptic_close(struct input_dev *dev)
{
struct max77693_haptic *haptic = input_get_drvdata(dev);
int error;
cancel_work_sync(&haptic->work);
max77693_haptic_disable(haptic);
error = regulator_disable(haptic->motor_reg);
if (error)
dev_err(haptic->dev,
"failed to disable regulator: %d\n", error);
max77843_haptic_bias(haptic, false);
} | false | false | false | false | false | 0 |
read_grammar(struct grammar* g, const char* filename) {
char line[MAX_LINE_LEN + 3];
int counter = 0;
FILE* file = fopen(filename, "r");
if (file == NULL) {
fatal("Failed to open a file with grammar: %s\n", filename);
}
while (1) {
if (fgets(line, MAX_LINE_LEN, file) == 0) break;
strncpy(g->prod[counter], line, MAX_LINE_LEN);
counter++;
}
g->len = counter;
fclose(file);
} | true | true | false | false | true | 1 |
ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
int i;
printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
printf("Video attributes of VTSM_VOBS: ");
ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr);
printf("\n");
printf("Number of Audio streams: %i\n",
vts_attributes->nr_of_vtsm_audio_streams);
if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
printf("\tstream %i attributes: ", 1);
ifo_print_audio_attributes(5, &vts_attributes->vtsm_audio_attr);
printf("\n");
}
printf("Number of Subpicture streams: %i\n",
vts_attributes->nr_of_vtsm_subp_streams);
if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
printf("\tstream %2i attributes: ", 1);
ifo_print_subp_attributes(5, &vts_attributes->vtsm_subp_attr);
printf("\n");
}
printf("Video attributes of VTSTT_VOBS: ");
ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr);
printf("\n");
printf("Number of Audio streams: %i\n",
vts_attributes->nr_of_vtstt_audio_streams);
for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
printf("\tstream %i attributes: ", i);
ifo_print_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]);
printf("\n");
}
printf("Number of Subpicture streams: %i\n",
vts_attributes->nr_of_vtstt_subp_streams);
for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
printf("\tstream %2i attributes: ", i);
ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
printf("\n");
}
} | false | false | false | false | false | 0 |
ssl3_NewSessionID(sslSocket *ss, PRBool is_server)
{
sslSessionID *sid;
sid = PORT_ZNew(sslSessionID);
if (sid == NULL)
return sid;
if (is_server) {
const SECItem * srvName;
SECStatus rv = SECSuccess;
ssl_GetSpecReadLock(ss); /********************************/
srvName = &ss->ssl3.prSpec->srvVirtName;
if (srvName->len && srvName->data) {
rv = SECITEM_CopyItem(NULL, &sid->u.ssl3.srvName, srvName);
}
ssl_ReleaseSpecReadLock(ss); /************************************/
if (rv != SECSuccess) {
PORT_Free(sid);
return NULL;
}
}
sid->peerID = (ss->peerID == NULL) ? NULL : PORT_Strdup(ss->peerID);
sid->urlSvrName = (ss->url == NULL) ? NULL : PORT_Strdup(ss->url);
sid->addr = ss->sec.ci.peer;
sid->port = ss->sec.ci.port;
sid->references = 1;
sid->cached = never_cached;
sid->version = ss->version;
sid->u.ssl3.keys.resumable = PR_TRUE;
sid->u.ssl3.policy = SSL_ALLOWED;
sid->u.ssl3.clientWriteKey = NULL;
sid->u.ssl3.serverWriteKey = NULL;
if (is_server) {
SECStatus rv;
int pid = SSL_GETPID();
sid->u.ssl3.sessionIDLength = SSL3_SESSIONID_BYTES;
sid->u.ssl3.sessionID[0] = (pid >> 8) & 0xff;
sid->u.ssl3.sessionID[1] = pid & 0xff;
rv = PK11_GenerateRandom(sid->u.ssl3.sessionID + 2,
SSL3_SESSIONID_BYTES -2);
if (rv != SECSuccess) {
ssl_FreeSID(sid);
ssl_MapLowLevelError(SSL_ERROR_GENERATE_RANDOM_FAILURE);
return NULL;
}
}
return sid;
} | false | false | false | false | false | 0 |
prism2_ioctl_siwnickn(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *nickname)
{
struct hostap_interface *iface;
local_info_t *local;
iface = netdev_priv(dev);
local = iface->local;
memset(local->name, 0, sizeof(local->name));
memcpy(local->name, nickname, data->length);
local->name_set = 1;
if (hostap_set_string(dev, HFA384X_RID_CNFOWNNAME, local->name) ||
local->func->reset_port(dev))
return -EINVAL;
return 0;
} | false | true | false | false | false | 1 |
store_global_handler(const Handler &h)
{
for (int i = 0; i < nglobalh; i++)
if (globalh[i]._name == h._name) {
globalh[i] = h;
globalh[i]._use_count = 1;
return;
}
if (nglobalh >= globalh_cap) {
int n = (globalh_cap ? 2 * globalh_cap : 4);
Handler *hs = new Handler[n];
if (!hs) // out of memory
return;
for (int i = 0; i < nglobalh; i++)
hs[i] = globalh[i];
delete[] globalh;
globalh = hs;
globalh_cap = n;
}
globalh[nglobalh] = h;
globalh[nglobalh]._use_count = 1;
nglobalh++;
} | false | false | false | false | false | 0 |
traceGcEvent_stderr (Capability *cap, EventTypeNum tag)
{
ACQUIRE_LOCK(&trace_utx);
tracePreface();
switch (tag) {
case EVENT_REQUEST_SEQ_GC: // (cap)
debugBelch("cap %d: requesting sequential GC\n", cap->no);
break;
case EVENT_REQUEST_PAR_GC: // (cap)
debugBelch("cap %d: requesting parallel GC\n", cap->no);
break;
case EVENT_GC_START: // (cap)
debugBelch("cap %d: starting GC\n", cap->no);
break;
case EVENT_GC_END: // (cap)
debugBelch("cap %d: finished GC\n", cap->no);
break;
case EVENT_GC_IDLE: // (cap)
debugBelch("cap %d: GC idle\n", cap->no);
break;
case EVENT_GC_WORK: // (cap)
debugBelch("cap %d: GC working\n", cap->no);
break;
case EVENT_GC_DONE: // (cap)
debugBelch("cap %d: GC done\n", cap->no);
break;
case EVENT_GC_GLOBAL_SYNC: // (cap)
debugBelch("cap %d: all caps stopped for GC\n", cap->no);
break;
default:
barf("traceGcEvent: unknown event tag %d", tag);
break;
}
RELEASE_LOCK(&trace_utx);
} | false | false | false | false | false | 0 |
cnic_alloc_context(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
if (BNX2_CHIP(cp) == BNX2_CHIP_5709) {
int i, k, arr_size;
cp->ctx_blk_size = CNIC_PAGE_SIZE;
cp->cids_per_blk = CNIC_PAGE_SIZE / 128;
arr_size = BNX2_MAX_CID / cp->cids_per_blk *
sizeof(struct cnic_ctx);
cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL);
if (cp->ctx_arr == NULL)
return -ENOMEM;
k = 0;
for (i = 0; i < 2; i++) {
u32 j, reg, off, lo, hi;
if (i == 0)
off = BNX2_PG_CTX_MAP;
else
off = BNX2_ISCSI_CTX_MAP;
reg = cnic_reg_rd_ind(dev, off);
lo = reg >> 16;
hi = reg & 0xffff;
for (j = lo; j < hi; j += cp->cids_per_blk, k++)
cp->ctx_arr[k].cid = j;
}
cp->ctx_blks = k;
if (cp->ctx_blks >= (BNX2_MAX_CID / cp->cids_per_blk)) {
cp->ctx_blks = 0;
return -ENOMEM;
}
for (i = 0; i < cp->ctx_blks; i++) {
cp->ctx_arr[i].ctx =
dma_alloc_coherent(&dev->pcidev->dev,
CNIC_PAGE_SIZE,
&cp->ctx_arr[i].mapping,
GFP_KERNEL);
if (cp->ctx_arr[i].ctx == NULL)
return -ENOMEM;
}
}
return 0;
} | false | false | false | false | false | 0 |
zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
{
int ret1, ret2;
long lval1, lval2;
double dval1, dval2;
if ((ret1=is_numeric_string(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0)) &&
(ret2=is_numeric_string(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0))) {
if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) {
if (ret1!=IS_DOUBLE) {
dval1 = (double) lval1;
} else if (ret2!=IS_DOUBLE) {
dval2 = (double) lval2;
} else if (dval1 == dval2 && !zend_finite(dval1)) {
/* Both values overflowed and have the same sign,
* so a numeric comparison would be inaccurate */
goto string_cmp;
}
Z_DVAL_P(result) = dval1 - dval2;
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
} else { /* they both have to be long's */
ZVAL_LONG(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0));
}
} else {
string_cmp:
Z_LVAL_P(result) = zend_binary_zval_strcmp(s1, s2);
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)));
}
} | false | false | false | false | false | 0 |
mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
unsigned int i, entries;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
get_byte(pb); /* version */
get_be24(pb); /* flags */
entries = get_be32(pb);
dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
if(entries >= UINT_MAX / sizeof(*sc->ctts_data))
return -1;
sc->ctts_data = av_malloc(entries * sizeof(*sc->ctts_data));
if (!sc->ctts_data)
return AVERROR(ENOMEM);
sc->ctts_count = entries;
for(i=0; i<entries; i++) {
int count =get_be32(pb);
int duration =get_be32(pb);
if (duration < 0) {
sc->wrong_dts = 1;
st->codec->has_b_frames = 1;
}
sc->ctts_data[i].count = count;
sc->ctts_data[i].duration= duration;
sc->time_rate= av_gcd(sc->time_rate, FFABS(duration));
}
return 0;
} | false | false | false | false | false | 0 |
parse_opt(int key, char *arg, struct argp_state *state)
{
struct perf_event_attr *current_attr =
perf_ctrs.tail ? &perf_ctrs.tail->attr : &perf_base_attr;
switch (key)
{
case 'e':
if (!strcmp("help", arg))
events_usage();
else if (is_sw_event(arg))
init_sw_ctr(arg, state);
else if (is_hw_event(arg))
init_hw_ctr(arg, state);
else if (is_hwc_event(arg))
init_hwc_ctr(arg, state);
else if (is_raw_event(arg))
init_raw_ctr(arg, state);
else
argp_error(state,
"Invalid event specified, use 'help' to list "
"available events.\n");
break;
case KEY_PINNED:
perf_base_attr.pinned = 1;
break;
case KEY_EXCLUSIVE:
perf_base_attr.exclusive = 1;
break;
case KEY_SAMPLE_PERIOD:
current_attr->sample_period =
perf_argp_parse_long("sample period", arg, state);
current_attr->freq = 0;
break;
case KEY_SAMPLE_FREQ:
current_attr->sample_freq =
perf_argp_parse_long("sample freq", arg, state);
current_attr->freq = 1;
break;
#ifdef HAVE_PRECISE_IP
case KEY_PRECISE_IP:
current_attr->precise_ip =
perf_argp_parse_long("precise ip", arg, state);
break;
#endif
case ARGP_KEY_END:
if (!perf_ctrs.head) {
fprintf(stderr, "No performance counters specified.\n");
argp_usage(state);
}
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
} | false | false | false | false | false | 0 |
buffer_destroy(t_buffer *buffer)
{
if (buffer->ptr != NULL && buffer->class->free != NULL) {
if (buffer->class->free(buffer) != 0) {
return -1;
}
buffer->ptr = NULL;
}
free(buffer);
return 0;
} | false | false | false | false | false | 0 |
Init() {
static ClassDocumentation<ClusterHadronizationHandler> documentation
("This is the main handler class for the Cluster Hadronization",
"The hadronization was performed using the cluster model of \\cite{Webber:1983if}.",
"%\\cite{Webber:1983if}\n"
"\\bibitem{Webber:1983if}\n"
" B.~R.~Webber,\n"
" ``A QCD Model For Jet Fragmentation Including Soft Gluon Interference,''\n"
" Nucl.\\ Phys.\\ B {\\bf 238}, 492 (1984).\n"
" %%CITATION = NUPHA,B238,492;%%\n"
// main manual
);
static Reference<ClusterHadronizationHandler,PartonSplitter>
interfacePartonSplitter("PartonSplitter",
"A reference to the PartonSplitter object",
&Herwig::ClusterHadronizationHandler::_partonSplitter,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterFinder>
interfaceClusterFinder("ClusterFinder",
"A reference to the ClusterFinder object",
&Herwig::ClusterHadronizationHandler::_clusterFinder,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ColourReconnector>
interfaceColourReconnector("ColourReconnector",
"A reference to the ColourReconnector object",
&Herwig::ClusterHadronizationHandler::_colourReconnector,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterFissioner>
interfaceClusterFissioner("ClusterFissioner",
"A reference to the ClusterFissioner object",
&Herwig::ClusterHadronizationHandler::_clusterFissioner,
false, false, true, false);
static Reference<ClusterHadronizationHandler,LightClusterDecayer>
interfaceLightClusterDecayer("LightClusterDecayer",
"A reference to the LightClusterDecayer object",
&Herwig::ClusterHadronizationHandler::_lightClusterDecayer,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterDecayer>
interfaceClusterDecayer("ClusterDecayer",
"A reference to the ClusterDecayer object",
&Herwig::ClusterHadronizationHandler::_clusterDecayer,
false, false, true, false);
static Parameter<ClusterHadronizationHandler,Energy2> interfaceMinVirtuality2
("MinVirtuality2",
"Minimum virtuality^2 of partons to use in calculating distances (unit [GeV2]).",
&ClusterHadronizationHandler::_minVirtuality2, GeV2, 0.1*GeV2, ZERO, 10.0*GeV2,false,false,false);
static Parameter<ClusterHadronizationHandler,Length> interfaceMaxDisplacement
("MaxDisplacement",
"Maximum displacement that is allowed for a particle (unit [millimeter]).",
&ClusterHadronizationHandler::_maxDisplacement, mm, 1.0e-10*mm,
0.0*mm, 1.0e-9*mm,false,false,false);
static Reference<ClusterHadronizationHandler,StepHandler> interfaceUnderlyingEventHandler
("UnderlyingEventHandler",
"Pointer to the handler for the Underlying Event. "
"Set to NULL to disable.",
&ClusterHadronizationHandler::_underlyingEventHandler, false, false, true, true, false);
} | false | false | false | false | false | 0 |
create_iopin_map()
{
int i;
// Define the physical package.
// The Package class, which is a parent of all of the modules,
// is responsible for allocating memory for the I/O pins.
//
create_pkg(number_of_pins);
// Define the I/O pins and assign them to the package.
// There are two things happening here. First, there is
// a new I/O pin that is being created. For the binary
// indicator, both pins are inputs. The second thing is
// that the pins are "assigned" to the package. If we
// need to reference these newly created I/O pins (like
// below) then we can call the member function 'get_pin'.
// all logic gates have one or more inputs, but only one
// output. The output is arbitrarily assigned to position
// 0 on the I/O port while the inputs go to positions 1 and above
#define OUTPUT_BITPOSITION 0
#define INPUT_FIRST_BITPOSITION (OUTPUT_BITPOSITION + 1)
// Here, we name the port `pin'. So in gpsim, we will reference
// the bit positions as U1.pin0, U1.pin1, ..., where U1 is the
// name of the logic gate (which is assigned by the user and
// obtained with the name() member function call).
string outname = name() + ".out";
pOutputPin = new Logic_Output(this, OUTPUT_BITPOSITION, outname.c_str());
pOutputPin->update_direction(1,true); // make the bidirectional an output
// Position pin on middle right side of package
package->set_pin_position(1,2.5);
assign_pin(OUTPUT_BITPOSITION + 1, pOutputPin);
Logic_Input *LIP;
int j;
pInputPins = (IOPIN **) new char[sizeof (IOPIN *) * (number_of_pins-1)];
string inname;
for(i=j=INPUT_FIRST_BITPOSITION; i<number_of_pins; i++) {
char pin_number = i-j +'0';
inname = name() + ".in" + pin_number;
//p[2] = i-j +'0';
LIP = new Logic_Input(this, i-INPUT_FIRST_BITPOSITION,inname.c_str());
pInputPins[i-INPUT_FIRST_BITPOSITION] = LIP;
if(number_of_pins==2)
package->set_pin_position(i+1, 0.5); // Left side of package
else
package->set_pin_position(i+1, (float)((i-INPUT_FIRST_BITPOSITION)*0.9999)); // Left side of package
assign_pin(i+1, LIP ); // Pin numbers begin at 1
}
// Form the logic gate bit masks
input_bit_mask = (1<< (number_of_pins-1)) - 1;
//initializeAttributes();
} | false | false | false | false | false | 0 |
ath10k_conf_tx_uapsd(struct ath10k *ar, struct ieee80211_vif *vif,
u16 ac, bool enable)
{
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct wmi_sta_uapsd_auto_trig_arg arg = {};
u32 prio = 0, acc = 0;
u32 value = 0;
int ret = 0;
lockdep_assert_held(&ar->conf_mutex);
if (arvif->vdev_type != WMI_VDEV_TYPE_STA)
return 0;
switch (ac) {
case IEEE80211_AC_VO:
value = WMI_STA_PS_UAPSD_AC3_DELIVERY_EN |
WMI_STA_PS_UAPSD_AC3_TRIGGER_EN;
prio = 7;
acc = 3;
break;
case IEEE80211_AC_VI:
value = WMI_STA_PS_UAPSD_AC2_DELIVERY_EN |
WMI_STA_PS_UAPSD_AC2_TRIGGER_EN;
prio = 5;
acc = 2;
break;
case IEEE80211_AC_BE:
value = WMI_STA_PS_UAPSD_AC1_DELIVERY_EN |
WMI_STA_PS_UAPSD_AC1_TRIGGER_EN;
prio = 2;
acc = 1;
break;
case IEEE80211_AC_BK:
value = WMI_STA_PS_UAPSD_AC0_DELIVERY_EN |
WMI_STA_PS_UAPSD_AC0_TRIGGER_EN;
prio = 0;
acc = 0;
break;
}
if (enable)
arvif->u.sta.uapsd |= value;
else
arvif->u.sta.uapsd &= ~value;
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
WMI_STA_PS_PARAM_UAPSD,
arvif->u.sta.uapsd);
if (ret) {
ath10k_warn(ar, "failed to set uapsd params: %d\n", ret);
goto exit;
}
if (arvif->u.sta.uapsd)
value = WMI_STA_PS_RX_WAKE_POLICY_POLL_UAPSD;
else
value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
WMI_STA_PS_PARAM_RX_WAKE_POLICY,
value);
if (ret)
ath10k_warn(ar, "failed to set rx wake param: %d\n", ret);
ret = ath10k_mac_vif_recalc_ps_wake_threshold(arvif);
if (ret) {
ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n",
arvif->vdev_id, ret);
return ret;
}
ret = ath10k_mac_vif_recalc_ps_poll_count(arvif);
if (ret) {
ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n",
arvif->vdev_id, ret);
return ret;
}
if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) ||
test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) {
/* Only userspace can make an educated decision when to send
* trigger frame. The following effectively disables u-UAPSD
* autotrigger in firmware (which is enabled by default
* provided the autotrigger service is available).
*/
arg.wmm_ac = acc;
arg.user_priority = prio;
arg.service_interval = 0;
arg.suspend_interval = WMI_STA_UAPSD_MAX_INTERVAL_MSEC;
arg.delay_interval = WMI_STA_UAPSD_MAX_INTERVAL_MSEC;
ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id,
arvif->bssid, &arg, 1);
if (ret) {
ath10k_warn(ar, "failed to set uapsd auto trigger %d\n",
ret);
return ret;
}
}
exit:
return ret;
} | false | false | false | false | false | 0 |
mpd_song_get_tag(const struct mpd_song *song,
enum mpd_tag_type type, unsigned idx)
{
const struct mpd_tag_value *tag = &song->tags[type];
if ((int)type < 0)
return NULL;
if (tag->value == NULL)
return NULL;
while (idx-- > 0) {
tag = tag->next;
if (tag == NULL)
return NULL;
}
return tag->value;
} | false | false | false | false | false | 0 |
via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
{
struct page *page;
int i;
switch (vsg->state) {
case dr_via_device_mapped:
via_unmap_blit_from_device(pdev, vsg);
case dr_via_desc_pages_alloc:
for (i = 0; i < vsg->num_desc_pages; ++i) {
if (vsg->desc_pages[i] != NULL)
free_page((unsigned long)vsg->desc_pages[i]);
}
kfree(vsg->desc_pages);
case dr_via_pages_locked:
for (i = 0; i < vsg->num_pages; ++i) {
if (NULL != (page = vsg->pages[i])) {
if (!PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction))
SetPageDirty(page);
page_cache_release(page);
}
}
case dr_via_pages_alloc:
vfree(vsg->pages);
default:
vsg->state = dr_via_sg_init;
}
vfree(vsg->bounce_buffer);
vsg->bounce_buffer = NULL;
vsg->free_on_sequence = 0;
} | false | false | false | false | false | 0 |
guess_repository_DIRs(git_repository *repo, const char *repository_path)
{
char path_aux[GIT_PATH_MAX], *last_DIR;
int path_len;
if (gitfo_isdir(repository_path) < GIT_SUCCESS)
return GIT_ENOTAREPO;
path_len = strlen(repository_path);
strcpy(path_aux, repository_path);
if (path_aux[path_len - 1] != '/') {
path_aux[path_len] = '/';
path_aux[path_len + 1] = 0;
path_len = path_len + 1;
}
repo->path_repository = git__strdup(path_aux);
/* objects database */
strcpy(path_aux + path_len, GIT_OBJECTS_DIR);
if (gitfo_isdir(path_aux) < GIT_SUCCESS)
return GIT_ENOTAREPO;
repo->path_odb = git__strdup(path_aux);
/* HEAD file */
strcpy(path_aux + path_len, GIT_HEAD_FILE);
if (gitfo_exists(path_aux) < 0)
return GIT_ENOTAREPO;
path_aux[path_len] = 0;
last_DIR = (path_aux + path_len - 2);
while (*last_DIR != '/')
last_DIR--;
if (strcmp(last_DIR, GIT_DIR) == 0) {
repo->is_bare = 0;
/* index file */
strcpy(path_aux + path_len, GIT_INDEX_FILE);
repo->path_index = git__strdup(path_aux);
/* working dir */
*(last_DIR + 1) = 0;
repo->path_workdir = git__strdup(path_aux);
} else {
repo->is_bare = 1;
repo->path_workdir = NULL;
}
return GIT_SUCCESS;
} | true | true | true | false | false | 1 |
AddKeysFromJSArray(JSArray* array) {
ASSERT(!array->HasPixelElements() && !array->HasExternalArrayElements());
switch (array->GetElementsKind()) {
case JSObject::FAST_ELEMENTS:
return UnionOfKeys(FixedArray::cast(array->elements()));
case JSObject::DICTIONARY_ELEMENTS: {
NumberDictionary* dict = array->element_dictionary();
int size = dict->NumberOfElements();
// Allocate a temporary fixed array.
Object* object;
{ MaybeObject* maybe_object = Heap::AllocateFixedArray(size);
if (!maybe_object->ToObject(&object)) return maybe_object;
}
FixedArray* key_array = FixedArray::cast(object);
int capacity = dict->Capacity();
int pos = 0;
// Copy the elements from the JSArray to the temporary fixed array.
for (int i = 0; i < capacity; i++) {
if (dict->IsKey(dict->KeyAt(i))) {
key_array->set(pos++, dict->ValueAt(i));
}
}
// Compute the union of this and the temporary fixed array.
return UnionOfKeys(key_array);
}
default:
UNREACHABLE();
}
UNREACHABLE();
return Heap::null_value(); // Failure case needs to "return" a value.
} | false | false | false | false | false | 0 |
load_indent_settings(GeanyFiletype *ft, GKeyFile *config, GKeyFile *configh)
{
ft->indent_width = utils_get_setting(integer, configh, config, "indentation", "width", -1);
ft->indent_type = utils_get_setting(integer, configh, config, "indentation", "type", -1);
/* check whether the indent type is OK */
switch (ft->indent_type)
{
case GEANY_INDENT_TYPE_TABS:
case GEANY_INDENT_TYPE_SPACES:
case GEANY_INDENT_TYPE_BOTH:
case -1:
break;
default:
g_warning("Invalid indent type %d in file type %s", ft->indent_type, ft->name);
ft->indent_type = -1;
break;
}
} | false | false | false | false | false | 0 |
setCurrentView(TemplatesView *view)
{
// if (view)
// qWarning() << "TemplatesViewActionHandler" << view;
// disconnect old view
if (m_CurrentView) {
// disconnect(m_CurrentView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
// this, SLOT(templatesViewItemChanged()));
}
m_CurrentView = view;
if (!view) { // this should never be the case
return;
}
// reconnect some actions
// connect(m_CurrentView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
// this, SLOT(templatesViewItemChanged()));
m_IsLocked = m_CurrentView->isLocked();
updateActions();
} | false | false | false | false | false | 0 |
listen(Q_UINT16 port, bool udp)
{
stop();
if(!d->serv.listen(port))
return false;
if(udp) {
d->sd = new Q3SocketDevice(Q3SocketDevice::Datagram);
#ifdef Q_OS_UNIX
::fcntl(d->sd->socket(), F_SETFD, FD_CLOEXEC);
#endif
d->sd->setBlocking(false);
if(!d->sd->bind(QHostAddress(), port)) {
delete d->sd;
d->sd = 0;
d->serv.stop();
return false;
}
d->sn = new QSocketNotifier(d->sd->socket(), QSocketNotifier::Read);
connect(d->sn, SIGNAL(activated(int)), SLOT(sn_activated(int)));
}
return true;
} | false | false | false | false | false | 0 |
snapshot_copy_from( libspectrum_snap *snap )
{
int error;
libspectrum_machine machine;
module_snapshot_enabled( snap );
machine = libspectrum_snap_machine( snap );
settings_current.late_timings = libspectrum_snap_late_timings( snap );
if( machine != machine_current->machine ) {
error = machine_select( machine );
if( error ) {
ui_error( UI_ERROR_ERROR,
"Loading a %s snapshot, but that's not available",
libspectrum_machine_name( machine ) );
}
} else {
machine_reset( 0 );
}
module_snapshot_from( snap );
/* Need to reset memory_map_[read|write] after all modules have had a turn
initialising from the snapshot */
machine_current->memory_map();
return 0;
} | false | false | false | false | false | 0 |
VGZ_NewUngzip(struct sess *sp, const char *id)
{
struct vgz *vg;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
vg = vgz_alloc_vgz(sp, id);
vg->dir = VGZ_UN;
VSC_C_main->n_gunzip++;
/*
* Max memory usage according to zonf.h:
* mem_needed = "a few kb" + (1 << (windowBits))
* Since we don't control windowBits, we have to assume
* it is 15, so 34-35KB or so.
*/
assert(Z_OK == inflateInit2(&vg->vz, 31));
return (vg);
} | false | false | false | true | false | 1 |
dump_driver_feature(int length)
{
struct bdb_block *block;
struct bdb_driver_feature *feature;
block = find_section(BDB_DRIVER_FEATURES, length);
if (!block) {
printf("No Driver feature data block\n");
return;
}
feature = block->data;
printf("Driver feature Data Block:\n");
printf("\tBoot Device Algorithm: %s\n", feature->boot_dev_algorithm ?
"driver default" : "os default");
printf("\tBlock display switching when DVD active: %s\n",
YESNO(feature->block_display_switch));
printf("\tAllow display switching when in Full Screen DOS: %s\n",
YESNO(feature->allow_display_switch));
printf("\tHot Plug DVO: %s\n", YESNO(feature->hotplug_dvo));
printf("\tDual View Zoom: %s\n", YESNO(feature->dual_view_zoom));
printf("\tDriver INT 15h hook: %s\n", YESNO(feature->int15h_hook));
printf("\tEnable Sprite in Clone Mode: %s\n",
YESNO(feature->sprite_in_clone));
printf("\tUse 00000110h ID for Primary LFP: %s\n",
YESNO(feature->primary_lfp_id));
printf("\tBoot Mode X: %u\n", feature->boot_mode_x);
printf("\tBoot Mode Y: %u\n", feature->boot_mode_y);
printf("\tBoot Mode Bpp: %u\n", feature->boot_mode_bpp);
printf("\tBoot Mode Refresh: %u\n", feature->boot_mode_refresh);
printf("\tEnable LFP as primary: %s\n",
YESNO(feature->enable_lfp_primary));
printf("\tSelective Mode Pruning: %s\n",
YESNO(feature->selective_mode_pruning));
printf("\tDual-Frequency Graphics Technology: %s\n",
YESNO(feature->dual_frequency));
printf("\tDefault Render Clock Frequency: %s\n",
feature->render_clock_freq ? "low" : "high");
printf("\tNT 4.0 Dual Display Clone Support: %s\n",
YESNO(feature->nt_clone_support));
printf("\tDefault Power Scheme user interface: %s\n",
feature->power_scheme_ui ? "3rd party" : "CUI");
printf
("\tSprite Display Assignment when Overlay is Active in Clone Mode: %s\n",
feature->sprite_display_assign ? "primary" : "secondary");
printf("\tDisplay Maintain Aspect Scaling via CUI: %s\n",
YESNO(feature->cui_aspect_scaling));
printf("\tPreserve Aspect Ratio: %s\n",
YESNO(feature->preserve_aspect_ratio));
printf("\tEnable SDVO device power down: %s\n",
YESNO(feature->sdvo_device_power_down));
printf("\tCRT hotplug: %s\n", YESNO(feature->crt_hotplug));
printf("\tLVDS config: ");
switch (feature->lvds_config) {
case BDB_DRIVER_NO_LVDS:
printf("No LVDS\n");
break;
case BDB_DRIVER_INT_LVDS:
printf("Integrated LVDS\n");
break;
case BDB_DRIVER_SDVO_LVDS:
printf("SDVO LVDS\n");
break;
case BDB_DRIVER_EDP:
printf("Embedded DisplayPort\n");
break;
}
printf("\tDefine Display statically: %s\n",
YESNO(feature->static_display));
printf("\tLegacy CRT max X: %d\n", feature->legacy_crt_max_x);
printf("\tLegacy CRT max Y: %d\n", feature->legacy_crt_max_y);
printf("\tLegacy CRT max refresh: %d\n",
feature->legacy_crt_max_refresh);
free(block);
} | false | false | false | false | false | 0 |
Vect_find_node(struct Map_info *Map,
double ux, double uy, double uz, double maxdist, int with_z)
{
int i, nnodes, node;
BOUND_BOX box;
struct ilist *NList;
double x, y, z;
double cur_dist, dist;
G_debug(3, "Vect_find_node() for %f %f %f maxdist = %f", ux, uy, uz,
maxdist);
NList = Vect_new_list();
/* Select all nodes in box */
box.N = uy + maxdist;
box.S = uy - maxdist;
box.E = ux + maxdist;
box.W = ux - maxdist;
if (with_z) {
box.T = uz + maxdist;
box.B = uz - maxdist;
}
else {
box.T = HUGE_VAL;
box.B = -HUGE_VAL;
}
nnodes = Vect_select_nodes_by_box(Map, &box, NList);
G_debug(3, " %d nodes in box", nnodes);
if (nnodes == 0)
return 0;
/* find nearest */
cur_dist = PORT_DOUBLE_MAX;
node = 0;
for (i = 0; i < nnodes; i++) {
Vect_get_node_coor(Map, NList->value[i], &x, &y, &z);
dist = Vect_points_distance(ux, uy, uz, x, y, z, with_z);
if (dist < cur_dist) {
cur_dist = dist;
node = i;
}
}
G_debug(3, " nearest node %d in distance %f", NList->value[node],
cur_dist);
/* Check if in max distance */
if (cur_dist <= maxdist)
return (NList->value[node]);
else
return 0;
} | false | false | false | false | false | 0 |
gfs_surface_segment_normal (GfsGenericSurface * s,
FttCell * cell,
GfsSegment * I,
GtsVector n)
{
g_return_if_fail (s != NULL);
g_return_if_fail (cell != NULL);
g_return_if_fail (I != NULL);
g_return_if_fail (I->n > 0);
g_return_if_fail (n != NULL);
g_assert (GFS_GENERIC_SURFACE_CLASS (GTS_OBJECT (s)->klass)->segment_normal);
(* GFS_GENERIC_SURFACE_CLASS (GTS_OBJECT (s)->klass)->segment_normal) (s, cell, I, n);
} | false | false | false | false | false | 0 |
lpss_dma_filter(struct dma_chan *chan, void *param)
{
struct dw_dma_slave *dws = param;
if (dws->dma_dev != chan->device->dev)
return false;
chan->private = dws;
return true;
} | false | false | false | false | false | 0 |
altos_puts(struct altos_file *file, char *string)
{
char c;
while ((c = *string++))
altos_putchar(file, c);
} | false | false | false | false | false | 0 |
city_change_callback(Widget w, XtPointer client_data,
XtPointer call_data)
{
XawListReturnStruct *ret=XawListShowCurrent(city_list);
struct city *pcity;
struct universal production;
if(ret->list_index!=XAW_LIST_NONE &&
(pcity=cities_in_list[ret->list_index])) {
cid my_cid = (cid) XTPOINTER_TO_INT(client_data);
production = cid_decode(my_cid);
city_change_production(pcity, production);
}
} | false | false | false | false | false | 0 |
closeIncrblobChannels(SqliteDb *pDb){
IncrblobChannel *p;
IncrblobChannel *pNext;
for(p=pDb->pIncrblob; p; p=pNext){
pNext = p->pNext;
/* Note: Calling unregister here call Tcl_Close on the incrblob channel,
** which deletes the IncrblobChannel structure at *p. So do not
** call Tcl_Free() here.
*/
Tcl_UnregisterChannel(pDb->interp, p->channel);
}
} | false | false | false | false | false | 0 |
get_pi (struct ip_vs_service_entry *se, char *pi, size_t size)
{
struct in_addr addr;
int len = 0;
if ((NULL == se) || (NULL == pi))
return 0;
addr.s_addr = se->addr;
/* inet_ntoa() returns a pointer to a statically allocated buffer
* I hope non-glibc systems behave the same */
len = ssnprintf (pi, size, "%s_%s%u", inet_ntoa (addr),
(se->protocol == IPPROTO_TCP) ? "TCP" : "UDP",
ntohs (se->port));
if ((0 > len) || (size <= len)) {
log_err ("plugin instance truncated: %s", pi);
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
StrEqVerbose(const string& a, const string& b,
const string& text) {
if (a != b) {
printf("EXPECTED: %s\n", a.c_str());
printf("ACTUAL: %s\n", b.c_str());
printf("TEXT: %s\n", text.c_str());
return false;
}
return true;
} | false | false | false | false | false | 0 |
xml_emit_att_value(struct parser *parser, char *a, char *b)
{
struct element *head = parser->head;
struct attribute *att = head->atts;
char *s;
int c;
/* entities are all longer than UTFmax so runetochar is safe */
s = att->value = fz_malloc(parser->ctx, b - a + 1);
while (a < b) {
if (*a == '&') {
a += xml_parse_entity(&c, a);
s += fz_runetochar(s, c);
}
else {
*s++ = *a++;
}
}
*s = 0;
} | false | false | false | false | false | 0 |
nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_fs_locations_arg *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
uint32_t replen;
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
if (args->migration) {
encode_putfh(xdr, args->fh, &hdr);
replen = hdr.replen;
encode_fs_locations(xdr, args->bitmask, &hdr);
if (args->renew)
encode_renew(xdr, args->clientid, &hdr);
} else {
encode_putfh(xdr, args->dir_fh, &hdr);
encode_lookup(xdr, args->name, &hdr);
replen = hdr.replen;
encode_fs_locations(xdr, args->bitmask, &hdr);
}
/* Set up reply kvec to capture returned fs_locations array. */
xdr_inline_pages(&req->rq_rcv_buf, replen << 2, &args->page,
0, PAGE_SIZE);
encode_nops(&hdr);
} | false | false | false | false | false | 0 |
L52()
{register object *base=vs_base;
register object *sup=base+VM52; VC52
vs_check;
bds_check;
{object V204;
object V205;
V204=(base[0]);
V205=(base[1]);
vs_top=sup;
goto TTL;
TTL:;
bds_bind(((object)VV[47]),((object)VV[103]));
base[3]= ((object)VV[95]);
base[4]= (V204);
base[5]= (V205);
vs_top=(vs_base=base+3)+3;
(void) (*Lnk191)();
bds_unwind1;
return;
}
} | false | false | false | false | false | 0 |
vpn_provider_set_index(struct vpn_provider *provider, int index)
{
DBG("index %d provider %p", index, provider);
if (provider->ipconfig_ipv4 == NULL) {
provider->ipconfig_ipv4 = __vpn_ipconfig_create(index,
AF_INET);
if (provider->ipconfig_ipv4 == NULL) {
DBG("Couldnt create ipconfig for IPv4");
goto done;
}
}
__vpn_ipconfig_set_index(provider->ipconfig_ipv4, index);
if (provider->ipconfig_ipv6 == NULL) {
provider->ipconfig_ipv6 = __vpn_ipconfig_create(index,
AF_INET6);
if (provider->ipconfig_ipv6 == NULL) {
DBG("Couldnt create ipconfig for IPv6");
goto done;
}
}
__vpn_ipconfig_set_index(provider->ipconfig_ipv6, index);
done:
provider->index = index;
} | false | false | false | false | false | 0 |
writedict(fp)
FILE *fp;
{
u_char *buf;
long i, j, max;
if (fputbegin("dicttblbuf", fp) < 0) return(-1);
for (i = 0L; i < maxdict; i++) {
if (!(dictlist[i].size)) continue;
buf = &(strbuf[dictlist[i].ptr]);
if (fputbuf(buf, dictlist[i].klen, fp) < 0) return(-1);
for (j = max = 0L; j < dictlist[i].max; j++)
if (dictlist[i + j].size) max++;
if (max > MAXUTYPE(u_char)) max = MAXUTYPE(u_char);
if (fputbyte(max, fp) < 0) return(-1);
for (j = max = 0L; j < dictlist[i].max; j++) {
if (!(dictlist[i + j].size)) continue;
if (++max > MAXUTYPE(u_char)) break;
buf = &(strbuf[dictlist[i + j].ptr]);
buf += dictlist[i + j].klen;
if (fputbuf(buf, dictlist[i + j].size, fp) < 0)
return(-1);
}
i += dictlist[i].max - 1;
}
if (fputend(fp) < 0) return(-1);
return(0);
} | false | false | false | false | false | 0 |
playername_ok(const char *cp) {
/* Don't allow - or _ as first character in the name */
if (*cp == '-' || *cp == '_')
return 0;
for (; *cp != '\0'; cp++)
if (!((*cp >= 'a' && *cp <= 'z') || (*cp >= 'A' && *cp <= 'Z'))
&& *cp != '-'
&& *cp != '_')
return 0;
return 1;
} | false | false | false | false | false | 0 |
hpi_volume_auto_fade_profile(u32 h_control,
short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms,
u16 profile)
{
struct hpi_message hm;
struct hpi_response hr;
hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL,
HPI_CONTROL_SET_STATE);
if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index))
return HPI_ERROR_INVALID_HANDLE;
memcpy(hm.u.c.an_log_value, an_stop_gain0_01dB,
sizeof(short) * HPI_MAX_CHANNELS);
hm.u.c.attribute = HPI_VOLUME_AUTOFADE;
hm.u.c.param1 = duration_ms;
hm.u.c.param2 = profile;
hpi_send_recv(&hm, &hr);
return hr.error;
} | false | true | false | false | false | 1 |
RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkPolyData *input = vtkPolyData::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkPolyData *output = vtkPolyData::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
if (input->GetNumberOfPoints() < 1)
{
return 1;
}
if (!this->SizingFunctionArrayName)
{
vtkErrorMacro(<<"No SizingFunctionArrayName specified");
return 1;
}
input->BuildCells();
input->BuildLinks();
int numberOfPoints = input->GetNumberOfPoints();
vtkDoubleArray* sizingFunctionArray = vtkDoubleArray::New();
sizingFunctionArray->SetName(this->SizingFunctionArrayName);
sizingFunctionArray->SetNumberOfTuples(numberOfPoints);
sizingFunctionArray->FillComponent(0,0.0);
vtkIdList* pointCells = vtkIdList::New();
int i, j;
for (i=0; i<numberOfPoints; i++)
{
input->GetPointCells(i,pointCells);
int numberOfPointCells = pointCells->GetNumberOfIds();
double averageArea = 0.0;
if (numberOfPointCells == 0)
{
continue;
}
for (j=0; j<numberOfPointCells; j++)
{
vtkTriangle* triangle = vtkTriangle::SafeDownCast(input->GetCell(pointCells->GetId(j)));
if (!triangle)
{
vtkErrorMacro(<<"Cell not triangle: skipping cell for sizing function computation");
}
double point0[3], point1[3], point2[3];
triangle->GetPoints()->GetPoint(0,point0);
triangle->GetPoints()->GetPoint(1,point1);
triangle->GetPoints()->GetPoint(2,point2);
averageArea += vtkTriangle::TriangleArea(point0,point1,point2);
}
averageArea /= numberOfPointCells;
double sizingFunction = sqrt(averageArea) * this->ScaleFactor;
sizingFunctionArray->SetValue(i,sizingFunction);
}
output->DeepCopy(input);
output->GetPointData()->AddArray(sizingFunctionArray);
sizingFunctionArray->Delete();
pointCells->Delete();
return 1;
} | false | false | false | false | false | 0 |
read_dlpoly_is_shell(gchar *name)
{
/* check for postfixes: -shell _shell -shel _shel -shl _shl -sh _sh
* and return postfix length */
int len = strlen(name);
if (len > 6 && (g_ascii_strcasecmp(name+len-6, "-shell") == 0
|| g_ascii_strcasecmp(name+len-6, "_shell") == 0))
return 6;
else if (len > 5 && (g_ascii_strcasecmp(name+len-5, "-shel") == 0
|| g_ascii_strcasecmp(name+len-5, "_shel") == 0))
return 5;
else if (len > 4 && (g_ascii_strcasecmp(name+len-4, "-shl") == 0
|| g_ascii_strcasecmp(name+len-4, "_shl") == 0))
return 4;
else if (len > 3 && (g_ascii_strcasecmp(name+len-3, "-sh") == 0
|| g_ascii_strcasecmp(name+len-3, "_sh") == 0))
return 3;
else
return 0;
} | false | false | false | false | false | 0 |
gtksharp_clipboard_target_list_to_array (GSList *list)
{
GtkTargetEntry *targets;
GSList *iter;
int i;
targets = g_new0 (GtkTargetEntry, g_slist_length (list));
for (iter = list, i = 0; iter; iter = iter->next, i++) {
GtkTargetEntry *t = (GtkTargetEntry *) iter->data;
targets[i].target = t->target; /* NOT COPIED */
targets[i].flags = t->flags;
targets[i].info = t->info;
}
return targets;
} | false | false | false | false | false | 0 |
drm_context_switch(struct drm_device * dev, int old, int new)
{
if (test_and_set_bit(0, &dev->context_flag)) {
DRM_ERROR("Reentering -- FIXME\n");
return -EBUSY;
}
DRM_DEBUG("Context switch from %d to %d\n", old, new);
if (new == dev->last_context) {
clear_bit(0, &dev->context_flag);
return 0;
}
return 0;
} | false | false | false | false | false | 0 |
fs_value_boolean(int b)
{
fs_value v = fs_value_blank();
v.attr = fs_c.xsd_boolean;
v.valid = fs_valid_bit(FS_V_IN);
v.in = b ? 1 : 0;
if (v.in) {
v.lex = "true";
} else {
v.lex = "false";
}
return v;
} | false | false | false | false | false | 0 |
readLanguage(Lexer & lex)
{
enum LanguageTags {
LA_AS_BABELOPTS = 1,
LA_BABELNAME,
LA_ENCODING,
LA_END,
LA_GUINAME,
LA_INTERNAL_ENC,
LA_LANG_CODE,
LA_LANG_VARIETY,
LA_POLYGLOSSIANAME,
LA_POLYGLOSSIAOPTS,
LA_POSTBABELPREAMBLE,
LA_PREBABELPREAMBLE,
LA_RTL
};
// Keep these sorted alphabetically!
LexerKeyword languageTags[] = {
{ "asbabeloptions", LA_AS_BABELOPTS },
{ "babelname", LA_BABELNAME },
{ "encoding", LA_ENCODING },
{ "end", LA_END },
{ "guiname", LA_GUINAME },
{ "internalencoding", LA_INTERNAL_ENC },
{ "langcode", LA_LANG_CODE },
{ "langvariety", LA_LANG_VARIETY },
{ "polyglossianame", LA_POLYGLOSSIANAME },
{ "polyglossiaopts", LA_POLYGLOSSIAOPTS },
{ "postbabelpreamble", LA_POSTBABELPREAMBLE },
{ "prebabelpreamble", LA_PREBABELPREAMBLE },
{ "rtl", LA_RTL }
};
bool error = false;
bool finished = false;
lex.pushTable(languageTags);
// parse style section
while (!finished && lex.isOK() && !error) {
int le = lex.lex();
// See comment in LyXRC.cpp.
switch (le) {
case Lexer::LEX_FEOF:
continue;
case Lexer::LEX_UNDEF: // parse error
lex.printError("Unknown language tag `$$Token'");
error = true;
continue;
default:
break;
}
switch (static_cast<LanguageTags>(le)) {
case LA_END: // end of structure
finished = true;
break;
case LA_AS_BABELOPTS:
lex >> as_babel_options_;
break;
case LA_BABELNAME:
lex >> babel_;
break;
case LA_POLYGLOSSIANAME:
lex >> polyglossia_name_;
break;
case LA_POLYGLOSSIAOPTS:
lex >> polyglossia_opts_;
break;
case LA_ENCODING:
lex >> encodingStr_;
break;
case LA_GUINAME:
lex >> display_;
break;
case LA_INTERNAL_ENC:
lex >> internal_enc_;
break;
case LA_LANG_CODE:
lex >> code_;
break;
case LA_LANG_VARIETY:
lex >> variety_;
break;
case LA_POSTBABELPREAMBLE:
babel_postsettings_ =
lex.getLongString("EndPostBabelPreamble");
break;
case LA_PREBABELPREAMBLE:
babel_presettings_ =
lex.getLongString("EndPreBabelPreamble");
break;
case LA_RTL:
lex >> rightToLeft_;
break;
}
}
lex.popTable();
return finished && !error;
} | false | false | false | false | false | 0 |
sgen_is_thread_in_current_stw (SgenThreadInfo *info)
{
/*
A thread explicitly asked to be skiped because it holds no managed state.
This is used by TP and finalizer threads.
FIXME Use an atomic variable for this to avoid everyone taking the GC LOCK.
*/
if (info->client_info.gc_disabled) {
return FALSE;
}
/*
We have detected that this thread is failing/dying, ignore it.
FIXME: can't we merge this with thread_is_dying?
*/
if (info->client_info.skip) {
return FALSE;
}
/*
Suspending the current thread will deadlock us, bad idea.
*/
if (info == mono_thread_info_current ()) {
return FALSE;
}
/*
We can't suspend the workers that will do all the heavy lifting.
FIXME Use some state bit in SgenThreadInfo for this.
*/
if (sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info))) {
return FALSE;
}
/*
The thread has signaled that it started to detach, ignore it.
FIXME: can't we merge this with skip
*/
if (!mono_thread_info_is_live (info)) {
return FALSE;
}
return TRUE;
} | false | false | false | false | false | 0 |
set_facet_fe(f_id,fe)
facet_id f_id;
facetedge_id fe;
{
if ( inverted(f_id) ) { invert(fe); invert(f_id); }
fptr(f_id)->fe_id = fe;
if ( web.representation == STRING )
{ body_id b_id = get_facet_body(f_id);
if ( valid_id(b_id) )
set_body_facet(b_id,f_id);
b_id = get_facet_body(inverse_id(f_id));
if ( valid_id(b_id) )
set_body_facet(b_id,inverse_id(f_id));
}
top_timestamp = ++global_timestamp;
} | false | false | false | false | false | 0 |
createActions()
{
// Flow control actions
m_stopAct = new KToggleAction(KIcon(":/images/stop.png"), i18n("&Break at Next Statement"), this );
m_stopAct->setIconText(i18n("Break at Next"));
actionCollection()->addAction( "stop", m_stopAct );
m_stopAct->setEnabled(true);
connect(m_stopAct, SIGNAL(triggered(bool)), this, SLOT(stopAtNext()));
m_continueAct = new KAction(KIcon(":/images/continue.png"), i18n("Continue"), this );
actionCollection()->addAction( "continue", m_continueAct );
m_continueAct->setShortcut(Qt::Key_F9);
m_continueAct->setEnabled(false);
connect(m_continueAct, SIGNAL(triggered(bool)), this, SLOT(continueExecution()));
m_stepOverAct = new KAction(KIcon(":/images/step-over.png"), i18n("Step Over"), this );
actionCollection()->addAction( "stepOver", m_stepOverAct );
m_stepOverAct->setShortcut(Qt::Key_F10);
m_stepOverAct->setEnabled(false);
connect(m_stepOverAct, SIGNAL(triggered(bool)), this, SLOT(stepOver()) );
m_stepIntoAct = new KAction(KIcon(":/images/step-into.png"), i18n("Step Into"), this );
actionCollection()->addAction( "stepInto", m_stepIntoAct );
m_stepIntoAct->setShortcut(Qt::Key_F11);
m_stepIntoAct->setEnabled(false);
connect(m_stepIntoAct, SIGNAL(triggered(bool)), this, SLOT(stepInto()));
m_stepOutAct = new KAction(KIcon(":/images/step-out.png"), i18n("Step Out"), this );
actionCollection()->addAction( "stepOut", m_stepOutAct );
m_stepOutAct->setShortcut(Qt::Key_F12);
m_stepOutAct->setEnabled(false);
connect(m_stepOutAct, SIGNAL(triggered(bool)), this, SLOT(stepOut()) );
m_reindentAction = new KToggleAction(i18n("Reindent Sources"), this);
actionCollection()->addAction( "reindent", m_reindentAction );
m_reindentAction->setChecked( m_reindentSources );
connect(m_reindentAction, SIGNAL(toggled(bool)), this, SLOT(settingsChanged()));
m_catchExceptionsAction = new KToggleAction(i18n("Report Exceptions"), this);
actionCollection()->addAction( "except", m_catchExceptionsAction );
m_catchExceptionsAction->setChecked( m_catchExceptions );
connect(m_catchExceptionsAction, SIGNAL(toggled(bool)), this, SLOT(settingsChanged()));
} | false | false | false | false | false | 0 |
SetGeoTransform( double * padfTransform )
{
if( eAccess == GA_ReadOnly )
{
CPLError( CE_Failure, CPLE_NoWriteAccess,
"Unable to update geotransform on readonly file." );
return CE_Failure;
}
if( padfTransform[2] != 0.0 || padfTransform[4] != 0.0 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Rotated and sheared geotransforms not supported for CTable2.");
return CE_Failure;
}
memcpy( adfGeoTransform, padfTransform, sizeof(double)*6 );
/* -------------------------------------------------------------------- */
/* Update grid header. */
/* -------------------------------------------------------------------- */
double dfValue;
char achHeader[160];
double dfDegToRad = M_PI / 180.0;
// read grid header
VSIFSeekL( fpImage, 0, SEEK_SET );
VSIFReadL( achHeader, 1, sizeof(achHeader), fpImage );
// lower left origin (longitude, center of pixel, radians)
dfValue = (adfGeoTransform[0] + adfGeoTransform[1]*0.5) * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 96, &dfValue, 8 );
// lower left origin (latitude, center of pixel, radians)
dfValue = (adfGeoTransform[3] + adfGeoTransform[5] * (nRasterYSize-0.5)) * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 104, &dfValue, 8 );
// pixel width (radians)
dfValue = adfGeoTransform[1] * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 112, &dfValue, 8 );
// pixel height (radians)
dfValue = adfGeoTransform[5] * -1 * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 120, &dfValue, 8 );
// write grid header.
VSIFSeekL( fpImage, 0, SEEK_SET );
VSIFWriteL( achHeader, 11, 16, fpImage );
return CE_None;
} | false | false | false | false | false | 0 |
zf_ping(unsigned long data)
{
unsigned int ctrl_reg = 0;
unsigned long flags;
zf_writeb(COUNTER_2, 0xff);
if (time_before(jiffies, next_heartbeat)) {
dprintk("time_before: %ld\n", next_heartbeat - jiffies);
/*
* reset event is activated by transition from 0 to 1 on
* RESET_WD1 bit and we assume that it is already zero...
*/
spin_lock_irqsave(&zf_port_lock, flags);
ctrl_reg = zf_get_control();
ctrl_reg |= RESET_WD1;
zf_set_control(ctrl_reg);
/* ...and nothing changes until here */
ctrl_reg &= ~(RESET_WD1);
zf_set_control(ctrl_reg);
spin_unlock_irqrestore(&zf_port_lock, flags);
mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO);
} else
pr_crit("I will reset your machine\n");
} | false | false | false | false | false | 0 |
s48_get_os_string_encoding(void)
{
static char setlocale_called = PSFALSE;
char *codeset;
static char* encoding = NULL;
/* Mike has no clue what the rationale for needing this is. */
if (!setlocale_called)
{
setlocale(LC_CTYPE, "");
setlocale_called = PSTRUE;
}
if (encoding == NULL)
{
codeset = nl_langinfo(CODESET); /* this ain't reentrant */
encoding = malloc(strlen(codeset) + 1);
if (encoding == NULL)
return NULL;
strcpy(encoding, codeset);
}
return encoding;
} | false | false | false | false | false | 0 |
set_default(log_slow_config *conf) {
if (conf) {
conf->enabled = 0;
conf->long_request_time = DEFAULT_LOG_SLOW_REQUEST;
conf->filename= NULL;
conf->timeformat= NULL;
conf->buffered_logs= 0;
conf->log_buffer= NULL;
conf->fd = NULL;
}
} | false | false | false | false | false | 0 |
jas_icccurv_output(jas_iccattrval_t *attrval, jas_stream_t *out)
{
jas_icccurv_t *curv = &attrval->data.curv;
unsigned int i;
if (jas_iccputuint32(out, curv->numents))
goto error;
for (i = 0; i < curv->numents; ++i) {
if (jas_iccputuint16(out, curv->ents[i]))
goto error;
}
return 0;
error:
return -1;
} | false | false | false | false | false | 0 |
div_day(VALUE d, VALUE *f)
{
if (f)
*f = f_mod(d, INT2FIX(1));
return f_floor(d);
} | false | false | false | false | false | 0 |
dump(ostream&out, unsigned ind) const
{
out << setw(ind) << "" << "disable " << scope_ << "; /* "
<< get_fileline() << " */" << endl;
} | false | false | false | false | false | 0 |
uqabort ()
{
#if ! HAVE_HDB_LOGGING
/* When using HDB logging, it's a pain to have no system name. */
ulog_system ((const char *) NULL);
#endif
ulog_user ((const char *) NULL);
if (fQunlock_directory)
(void) fsysdep_unlock_uuxqt_dir (iQlock_seq);
if (zQunlock_file != NULL)
(void) fsysdep_unlock_uuxqt_file (zQunlock_file);
if (iQlock_seq >= 0)
(void) fsysdep_unlock_uuxqt (iQlock_seq, zQunlock_cmd, cQmaxuuxqts);
ulog_close ();
usysdep_exit (FALSE);
} | true | true | false | false | true | 1 |
print(STD_NAMESPACE ostream &out,
const size_t flags,
const int level,
const char *pixelFileName,
size_t *pixelCounter)
{
out << OFendl;
if (flags & DCMTypes::PF_useANSIEscapeCodes)
out << DCMDATA_ANSI_ESCAPE_CODE_COMMENT;
printNestingLevel(out, flags, level);
out << "# Dicom-File-Format";
if (flags & DCMTypes::PF_useANSIEscapeCodes)
out << DCMDATA_ANSI_ESCAPE_CODE_RESET;
out << OFendl;
if (!itemList->empty())
{
DcmObject *dO;
itemList->seek(ELP_first);
do {
dO = itemList->get();
dO->print(out, flags, level, pixelFileName, pixelCounter);
} while (itemList->seek(ELP_next));
} else {
if (flags & DCMTypes::PF_useANSIEscapeCodes)
out << DCMDATA_ANSI_ESCAPE_CODE_COMMENT;
printNestingLevel(out, flags, level);
out << "# Dicom-File-Format has been erased";
if (flags & DCMTypes::PF_useANSIEscapeCodes)
out << DCMDATA_ANSI_ESCAPE_CODE_RESET;
out << OFendl;
}
} | false | false | false | false | false | 0 |
clearHistoryDialog()
{
if (m_history && QMessageBox::question(0, tr("Clear History"), tr("Do you want to clear the history?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
m_history->clear();
}
} | false | false | false | false | false | 0 |
CheckRootTransparentButtons(ButtonArray *array)
{
Button *button;
Bool r = 0;
if (!CSET_IS_TRANSPARENT_ROOT(iconcolorset) &&
!CSET_IS_TRANSPARENT_ROOT(focuscolorset))
{
return r;
}
for(button=array->head; button!=NULL; button=button->next)
{
if ((button->iconified &&
CSET_IS_TRANSPARENT_ROOT(iconcolorset)) ||
(button->state == BUTTON_BRIGHT &&
CSET_IS_TRANSPARENT_ROOT(focuscolorset)))
{
r = True;
button->needsupdate = 1;
}
}
return r;
} | 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.