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 |
|---|---|---|---|---|---|---|
jaw_table_get_summary (AtkTable *table)
{
JawObject *jaw_obj = JAW_OBJECT(table);
TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE);
jobject atk_table = data->atk_table;
JNIEnv *jniEnv = jaw_util_get_jni_env();
jclass classAtkTable = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTable");
jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTable, "get_summary", "()Ljavax/accessibility/AccessibleContext;");
jobject jac = (*jniEnv)->CallObjectMethod(jniEnv, atk_table, jmid);
if (!jac) {
return NULL;
}
JawImpl* jaw_impl = jaw_impl_get_instance( jniEnv, jac );
return ATK_OBJECT(jaw_impl);
} | false | false | false | false | false | 0 |
bcm6358_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
struct bcm6358_led *led =
container_of(led_cdev, struct bcm6358_led, cdev);
unsigned long flags;
spin_lock_irqsave(led->lock, flags);
bcm6358_led_mode(led, value);
spin_unlock_irqrestore(led->lock, flags);
} | false | false | false | false | false | 0 |
smp_save_segs(struct smp_sc *sc)
{
struct smp_seg *sg, *sg2;
Lck_AssertHeld(&sc->mtx);
/*
* Remove empty segments from the front of the list
* before we write the segments to disk.
*/
VTAILQ_FOREACH_SAFE(sg, &sc->segments, list, sg2) {
if (sg->nobj > 0)
break;
if (sg == sc->cur_seg)
continue;
VTAILQ_REMOVE(&sc->segments, sg, list);
LRU_Free(sg->lru);
FREE_OBJ(sg);
}
smp_save_seg(sc, &sc->seg1);
smp_save_seg(sc, &sc->seg2);
} | false | false | false | false | false | 0 |
X86PopulateOperands(
LiteralConstantEmitter *(&operandTypes)[EDIS_MAX_OPERANDS],
const CodeGenInstruction &inst) {
if (!inst.TheDef->isSubClassOf("X86Inst"))
return;
unsigned int index;
unsigned int numOperands = inst.Operands.size();
for (index = 0; index < numOperands; ++index) {
const CGIOperandList::OperandInfo &operandInfo = inst.Operands[index];
Record &rec = *operandInfo.Rec;
if (X86TypeFromOpName(operandTypes[index], rec.getName()) &&
!rec.isSubClassOf("PointerLikeRegClass")) {
errs() << "Operand type: " << rec.getName().c_str() << "\n";
errs() << "Operand name: " << operandInfo.Name.c_str() << "\n";
errs() << "Instruction name: " << inst.TheDef->getName().c_str() << "\n";
llvm_unreachable("Unhandled type");
}
}
} | false | false | false | false | false | 0 |
run_tag(char *pc, value mem) {
for (;;) {
unsigned char dst, src ;
dst = *pc++ ;
if (dst == 0xff)
return ;
src = *pc++ ;
if (src == 0xff) {
/* fprintf(stderr,"[%hhu] <- -1\n",dst) ; */
Field(mem,dst) = Val_int(-1) ;
} else {
/* fprintf(stderr,"[%hhu] <- [%hhu]\n",dst,src) ; */
Field(mem,dst) = Field(mem,src) ;
}
}
} | false | false | false | false | false | 0 |
VisitLiteral(Literal* expr) {
ASSERT(!HasStackOverflow());
ASSERT(current_block() != NULL);
ASSERT(current_block()->HasPredecessor());
HConstant* instr =
new(zone()) HConstant(expr->handle(), Representation::Tagged());
return ast_context()->ReturnInstruction(instr, expr->id());
} | false | false | false | false | false | 0 |
clickRecent(const QString & url) {
if (url == "open") {
emit openSketch();
return;
}
if (url == "new") {
emit newSketch();
return;
}
} | false | false | false | false | false | 0 |
fa_copy(const std::string& oldpath, const std::string& newpath, mode_t mode) {
RETRYLOOP {
STARTHEADER(CMD_COPY,sizeof(mode)+sizeof(int)+oldpath.length()+sizeof(int)+newpath.length());
if(!swrite(*file_access_,&mode,sizeof(mode))) ABORTALL;
if(!swrite_string(*file_access_,oldpath)) ABORTALL;
if(!swrite_string(*file_access_,newpath)) ABORTALL;
int res = 0;
ENDHEADER(CMD_COPY,0);
return (res == 0);
}
errno_ = -1;
return false;
} | false | false | false | false | false | 0 |
variable_is_on_stack(void *p)
{
if (!p)
return false;
if (stack_direction == 0)
stack_direction = find_stack_direction();
char dummy = 0;
char *cp = (char *)p;
return (stack_direction < 0 ? (&dummy < cp) : (&dummy > cp));
} | false | false | false | false | false | 0 |
convertOldFunctions( int abilities, const ASCString& location )
{
features.reset();
if ( abilities & 1 ) warningMessage ( location + ": The HQ function for buildings is not supported any more");
if ( abilities & 2 ) features.set( TrainingCenter );
if ( abilities & (1 << 3) ) features.set( InternalVehicleProduction );
if ( abilities & (1 << 4) ) features.set( AmmoProduction );
if ( abilities & (1 << 8) ) features.set( InternalUnitRepair );
if ( abilities & (1 << 9) ) features.set( RecycleUnits );
if ( abilities & (1 << 10) ) features.set( Research );
if ( abilities & (1 << 11) ) features.set( Sonar );
if ( abilities & (1 << 12) ) features.set( WindPowerPlant );
if ( abilities & (1 << 13) ) features.set( SolarPowerPlant );
if ( abilities & (1 << 14) ) features.set( MatterConverter );
if ( abilities & (1 << 15) ) features.set( MiningStation );
if ( abilities & (1 << 16) ) {
features.set( ExternalMaterialTransfer );
features.set( ExternalFuelTransfer );
features.set( ExternalAmmoTransfer );
}
if ( abilities & (1 << 17) ) features.set( ProduceNonLeavableUnits );
if ( abilities & (1 << 18) ) features.set( ResourceSink );
if ( abilities & (1 << 19) ) {
features.set( ExternalMaterialTransfer );
features.set( ExternalFuelTransfer );
}
if ( abilities & (1 << 20) ) features.set( ExternalAmmoTransfer );
if ( abilities & (1 << 21) ) features.set( NoObjectChaining );
if ( abilities & (1 << 22) ) features.set( SelfDestructOnConquer );
if ( abilities & (1 << 23) ) features.set( SatelliteView );
} | false | false | false | false | false | 0 |
dm_cell_error(struct dm_bio_prison *prison,
struct dm_bio_prison_cell *cell, int error)
{
struct bio_list bios;
struct bio *bio;
bio_list_init(&bios);
dm_cell_release(prison, cell, &bios);
while ((bio = bio_list_pop(&bios))) {
bio->bi_error = error;
bio_endio(bio);
}
} | false | false | false | false | false | 0 |
scif_unpin_pages(scif_pinned_pages_t pinned_pages)
{
int err = 0, ret;
if (!pinned_pages || SCIFEP_MAGIC != pinned_pages->magic)
return -EINVAL;
ret = atomic_sub_return(1, &pinned_pages->ref_count);
if (ret < 0) {
dev_err(scif_info.mdev.this_device,
"%s %d scif_unpin_pages called without pinning? rc %d\n",
__func__, __LINE__, ret);
return -EINVAL;
}
/*
* Destroy the window if the ref count for this set of pinned
* pages has dropped to zero. If it is positive then there is
* a valid registered window which is backed by these pages and
* it will be destroyed once all such windows are unregistered.
*/
if (!ret)
err = scif_destroy_pinned_pages(pinned_pages);
return err;
} | false | false | false | false | false | 0 |
opMarkPoint(Object args[], int numArgs) {
if (printCommands) {
printf(" mark point: %s ", args[0].getName());
if (numArgs == 2)
args[2].print(stdout);
printf("\n");
fflush(stdout);
}
if(numArgs == 2) {
//out->markPoint(args[0].getName(),args[1].getDict());
} else {
//out->markPoint(args[0].getName());
}
} | false | false | false | false | false | 0 |
_cb_signal_action_extra(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
E_Sys_Con_Action *sca;
e_syscon_hide();
sca = data;
if (!sca) return;
if (sca->func) sca->func((void *)sca->data);
} | false | false | false | false | false | 0 |
rewriteClientCommandVector(redisClient *c, int argc, ...) {
va_list ap;
int j;
robj **argv; /* The new argument vector */
argv = zmalloc(sizeof(robj*)*argc);
va_start(ap,argc);
for (j = 0; j < argc; j++) {
robj *a;
a = va_arg(ap, robj*);
argv[j] = a;
incrRefCount(a);
}
/* We free the objects in the original vector at the end, so we are
* sure that if the same objects are reused in the new vector the
* refcount gets incremented before it gets decremented. */
for (j = 0; j < c->argc; j++) decrRefCount(c->argv[j]);
zfree(c->argv);
/* Replace argv and argc with our new versions. */
c->argv = argv;
c->argc = argc;
va_end(ap);
} | false | false | false | false | false | 0 |
gzfile_read_raw_until_zero(struct gzfile *gz, long offset)
{
VALUE str;
char *p;
for (;;) {
p = memchr(RSTRING_PTR(gz->z.input) + offset, '\0',
RSTRING_LEN(gz->z.input) - offset);
if (p) break;
str = gzfile_read_raw(gz);
if (NIL_P(str)) {
rb_raise(cGzError, "unexpected end of file");
}
offset = RSTRING_LEN(gz->z.input);
zstream_append_input2(&gz->z, str);
}
return p;
} | false | false | false | false | false | 0 |
_tp_boxed_to_variant (GType gtype,
const gchar *variant_type,
gpointer boxed)
{
GValue v = G_VALUE_INIT;
GVariant *ret;
g_return_val_if_fail (boxed != NULL, NULL);
g_value_init (&v, gtype);
g_value_set_boxed (&v, boxed);
ret = dbus_g_value_build_g_variant (&v);
g_return_val_if_fail (!tp_strdiff (g_variant_get_type_string (ret), variant_type), NULL);
g_value_unset (&v);
return g_variant_ref_sink (ret);
} | false | false | false | false | false | 0 |
brcmf_pcie_release_scratchbuffers(struct brcmf_pciedev_info *devinfo)
{
if (devinfo->shared.scratch)
dma_free_coherent(&devinfo->pdev->dev,
BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
devinfo->shared.scratch,
devinfo->shared.scratch_dmahandle);
if (devinfo->shared.ringupd)
dma_free_coherent(&devinfo->pdev->dev,
BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
devinfo->shared.ringupd,
devinfo->shared.ringupd_dmahandle);
} | false | false | false | false | false | 0 |
Mat2QImage(const cv::Mat3b &src)
{
QImage dest(src.cols, src.rows, QImage::Format_ARGB32);
for (int y = 0; y < src.rows; ++y) {
const cv::Vec3b *srcrow = src[y];
QRgb *destrow = (QRgb*)dest.scanLine(y);
for (int x = 0; x < src.cols; ++x) {
destrow[x] = qRgba(srcrow[x][2], srcrow[x][1], srcrow[x][0], 255);
}
}
return dest;
} | false | false | false | false | false | 0 |
mfgets(char *s, int size, mFILE *mf) {
int i;
if (mf == m_channel[0]) init_mstdin();
*s = 0;
for (i = 0; i < size-1;) {
if (mf->offset < mf->size) {
s[i] = mf->data[mf->offset++];
if (s[i++] == '\n')
break;
} else {
mf->eof = 1;
break;
}
}
s[i] = 0;
return i ? s : NULL;
} | false | false | false | false | false | 0 |
makefilename_symbol(t_makefilename *x, t_symbol *s)
{
char buf[MAXPDSTRING];
if (x->x_accept == A_SYMBOL)
sprintf(buf, x->x_format->s_name, s->s_name);
else
sprintf(buf, x->x_format->s_name, 0);
if (buf[0]!=0)
outlet_symbol(x->x_obj.ob_outlet, gensym(buf));
} | true | true | false | false | true | 1 |
main(void)
{
unsigned int i;
const char *p;
puts ("(define_conditions [");
#if GCC_VERSION >= 3001
for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)
{
printf (" (%d \"", insn_conditions[i].value);
for (p = insn_conditions[i].expr; *p; p++)
{
switch (*p)
{
case '\\':
case '\"': putchar ('\\'); break;
default: break;
}
putchar (*p);
}
puts ("\")");
}
#endif /* gcc >= 3.0.1 */
puts ("])");
fflush (stdout);
return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;
} | false | false | false | false | false | 0 |
parseCommandLine() {
if (MRI) {
if (!RestOfArgs.empty())
fail("Cannot mix -M and other options");
runMRIScript();
}
getOptions();
// Keep track of number of operations. We can only specify one
// per execution.
unsigned NumOperations = 0;
// Keep track of the number of positional modifiers (a,b,i). Only
// one can be specified.
unsigned NumPositional = 0;
// Keep track of which operation was requested
ArchiveOperation Operation;
bool MaybeJustCreateSymTab = false;
for(unsigned i=0; i<Options.size(); ++i) {
switch(Options[i]) {
case 'd': ++NumOperations; Operation = Delete; break;
case 'm': ++NumOperations; Operation = Move ; break;
case 'p': ++NumOperations; Operation = Print; break;
case 'q': ++NumOperations; Operation = QuickAppend; break;
case 'r': ++NumOperations; Operation = ReplaceOrInsert; break;
case 't': ++NumOperations; Operation = DisplayTable; break;
case 'x': ++NumOperations; Operation = Extract; break;
case 'c': Create = true; break;
case 'l': /* accepted but unused */ break;
case 'o': OriginalDates = true; break;
case 's':
Symtab = true;
MaybeJustCreateSymTab = true;
break;
case 'S':
Symtab = false;
break;
case 'u': OnlyUpdate = true; break;
case 'v': Verbose = true; break;
case 'a':
getRelPos();
AddAfter = true;
NumPositional++;
break;
case 'b':
getRelPos();
AddBefore = true;
NumPositional++;
break;
case 'i':
getRelPos();
AddBefore = true;
NumPositional++;
break;
case 'D':
Deterministic = true;
break;
case 'U':
Deterministic = false;
break;
case 'T':
Thin = true;
break;
default:
cl::PrintHelpMessage();
}
}
// At this point, the next thing on the command line must be
// the archive name.
getArchive();
// Everything on the command line at this point is a member.
getMembers();
if (NumOperations == 0 && MaybeJustCreateSymTab) {
NumOperations = 1;
Operation = CreateSymTab;
if (!Members.empty())
show_help("The s operation takes only an archive as argument");
}
// Perform various checks on the operation/modifier specification
// to make sure we are dealing with a legal request.
if (NumOperations == 0)
show_help("You must specify at least one of the operations");
if (NumOperations > 1)
show_help("Only one operation may be specified");
if (NumPositional > 1)
show_help("You may only specify one of a, b, and i modifiers");
if (AddAfter || AddBefore) {
if (Operation != Move && Operation != ReplaceOrInsert)
show_help("The 'a', 'b' and 'i' modifiers can only be specified with "
"the 'm' or 'r' operations");
}
if (OriginalDates && Operation != Extract)
show_help("The 'o' modifier is only applicable to the 'x' operation");
if (OnlyUpdate && Operation != ReplaceOrInsert)
show_help("The 'u' modifier is only applicable to the 'r' operation");
// Return the parsed operation to the caller
return Operation;
} | false | false | false | false | false | 0 |
InterpolateTransform(double t,
vtkTransform *xform)
{
if ( this->TransformList->empty() )
{
return;
}
// Make sure the xform and this class are initialized properly
xform->Identity();
this->InitializeInterpolation();
// Evaluate the interpolators
if ( t < this->TransformList->front().Time )
{
t = this->TransformList->front().Time;
}
else if ( t > this->TransformList->back().Time )
{
t = this->TransformList->back().Time;
}
double P[3],S[3],Q[4];
this->PositionInterpolator->InterpolateTuple(t,P);
this->ScaleInterpolator->InterpolateTuple(t,S);
this->RotationInterpolator->InterpolateQuaternion(t,Q);
xform->Translate(P);
xform->RotateWXYZ(Q[0],Q+1);
xform->Scale(S);
} | false | false | false | false | false | 0 |
GetScoreProducerWeightShortName(unsigned idx) const
{
if (idx < GetNumInputScores()){
return "I";
}else{
return "tm";
}
} | false | false | false | false | false | 0 |
addcapa(ptsig,value)
losig_list *ptsig;
float value;
{
if( !ptsig->PRCN )
{
fflush(stdout);
fprintf(stderr,"*** mbk error *** : addcapa() impossible.\n");
fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX);
EXIT(1);
}
ptsig->PRCN->CAPA = ptsig->PRCN->CAPA + value ;
return( ptsig->PRCN->CAPA );
} | false | false | false | true | false | 1 |
single_dct(
int32_t u,
int32_t v,
struct FloatBlock const* input)
{
int32_t size = TIMG_BLOCK_SIZE;
double phasemult = M_PI/(double)size;
double scaleu = normalize_scale_factor(u);
double scalev = normalize_scale_factor(v);
double du = (double)u;
double dv = (double)v;
float sum = 0.0f;
// We investigate each pixel to find the crosscorrelation
// of the sample block on this frequency.
for (int32_t y=0;y<size;y++) {
for (int32_t x=0;x<size;x++) {
float sample = input->data[y][x];
float result;
result = cos(phasemult*(x+0.5)*du);
result *= cos(phasemult*(y+0.5)*dv);
result *= scaleu * scalev * sample;
sum += result;
}
}
return sum;
} | false | false | false | false | false | 0 |
entangle_preferences_finalize(GObject *object)
{
EntanglePreferences *preferences = ENTANGLE_PREFERENCES(object);
EntanglePreferencesPrivate *priv = preferences->priv;
ENTANGLE_DEBUG("Finalize preferences %p", object);
g_object_unref(priv->interfaceSettings);
g_object_unref(priv->captureSettings);
g_object_unref(priv->cmsSettings);
g_object_unref(priv->imgSettings);
G_OBJECT_CLASS(entangle_preferences_parent_class)->finalize(object);
} | false | false | false | false | false | 0 |
grl_media_get_thumbnail_binary_nth (GrlMedia *media, gsize *size, guint index)
{
GrlRelatedKeys *relkeys =
grl_data_get_related_keys (GRL_DATA (media),
GRL_METADATA_KEY_THUMBNAIL,
index);
if (!relkeys) {
return NULL;
} else {
return grl_related_keys_get_binary (relkeys,
GRL_METADATA_KEY_THUMBNAIL,
size);
}
} | false | false | false | false | false | 0 |
EmfPlusFillRects (MetafilePlayContext *context, WORD flags, BYTE* data, int size)
{
GpStatus status = Ok;
GpSolidFill *solid = NULL;
GpBrush *brush = NULL;
#ifdef DEBUG_EMFPLUS
printf ("EmfPlusRecordTypeFillRects flags %X", flags, size);
printf ("\n\tColor: 0x%X", GETDW(DWP2));
printf ("\n\t#rect: %d", GETDW(DWP3));
#endif
BOOL use_int16 = (flags & 0x4000);
BOOL use_color = (flags & 0x8000);
DWORD num = GETDW(DWP3);
int i = 0;
int n = 3;
if (use_color) {
status = GdipCreateSolidFill (GETDW(DWP2), &solid);
if (status != Ok)
return status;
brush = (GpBrush*)solid;
} else {
/* TODO - get brush from index */
}
while ((i++ < num) && (status == Ok)) {
float x, y, w, h;
if (use_int16) {
DWORD xy = GETDW(DWP(n));
n++;
x = (xy >> 16);
y = (WORD)xy;
DWORD wh = GETDW(DWP(n));
n++;
w = (wh >> 16);
h = (WORD)wh;
} else {
x = (float) GETDW(DWP(n));
n++;
y = (float) GETDW(DWP(n));
n++;
w = (float) GETDW(DWP(n));
n++;
h = (float) GETDW(DWP(n));
n++;
}
#ifdef DEBUG_EMFPLUS_2
printf ("\n\t\t%d - x %g, y %g, w %g, h %g", i, x, y, w, h);
#endif
status = GdipFillRectangle (context->graphics, brush, x, y, w, h);
}
if (solid)
GdipDeleteBrush (brush); /* brush == a GpBrush* typecasted solid, if used */
return status;
} | false | false | false | false | false | 0 |
dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
int stream, struct snd_soc_dapm_widget_list **list, int new)
{
if (new)
return dpcm_add_paths(fe, stream, list);
else
return dpcm_prune_paths(fe, stream, list);
} | false | false | false | false | false | 0 |
ilk_compute_wm_results(struct drm_device *dev,
const struct intel_pipe_wm *merged,
enum intel_ddb_partitioning partitioning,
struct ilk_wm_values *results)
{
struct intel_crtc *intel_crtc;
int level, wm_lp;
results->enable_fbc_wm = merged->fbc_wm_enabled;
results->partitioning = partitioning;
/* LP1+ register values */
for (wm_lp = 1; wm_lp <= 3; wm_lp++) {
const struct intel_wm_level *r;
level = ilk_wm_lp_to_level(wm_lp, merged);
r = &merged->wm[level];
/*
* Maintain the watermark values even if the level is
* disabled. Doing otherwise could cause underruns.
*/
results->wm_lp[wm_lp - 1] =
(ilk_wm_lp_latency(dev, level) << WM1_LP_LATENCY_SHIFT) |
(r->pri_val << WM1_LP_SR_SHIFT) |
r->cur_val;
if (r->enable)
results->wm_lp[wm_lp - 1] |= WM1_LP_SR_EN;
if (INTEL_INFO(dev)->gen >= 8)
results->wm_lp[wm_lp - 1] |=
r->fbc_val << WM1_LP_FBC_SHIFT_BDW;
else
results->wm_lp[wm_lp - 1] |=
r->fbc_val << WM1_LP_FBC_SHIFT;
/*
* Always set WM1S_LP_EN when spr_val != 0, even if the
* level is disabled. Doing otherwise could cause underruns.
*/
if (INTEL_INFO(dev)->gen <= 6 && r->spr_val) {
WARN_ON(wm_lp != 1);
results->wm_lp_spr[wm_lp - 1] = WM1S_LP_EN | r->spr_val;
} else
results->wm_lp_spr[wm_lp - 1] = r->spr_val;
}
/* LP0 register values */
for_each_intel_crtc(dev, intel_crtc) {
enum pipe pipe = intel_crtc->pipe;
const struct intel_wm_level *r =
&intel_crtc->wm.active.ilk.wm[0];
if (WARN_ON(!r->enable))
continue;
results->wm_linetime[pipe] = intel_crtc->wm.active.ilk.linetime;
results->wm_pipe[pipe] =
(r->pri_val << WM0_PIPE_PLANE_SHIFT) |
(r->spr_val << WM0_PIPE_SPRITE_SHIFT) |
r->cur_val;
}
} | false | false | false | false | false | 0 |
write_buffer (fd, buf, cnt)
int fd;
voidp buf;
unsigned int cnt;
{
if (INT_MAX < cnt)
cnt = INT_MAX;
return write (fd, buf, cnt);
} | false | false | false | false | false | 0 |
gen_NUL_trans ()
{ /* NOTE - changes in here should be reflected in gen_next_match() */
/* Only generate a definition for "yy_cp" if we'll generate code
* that uses it. Otherwise lint and the like complain.
*/
int need_backing_up = (num_backing_up > 0 && !reject);
if (need_backing_up && (!nultrans || fullspd || fulltbl))
/* We're going to need yy_cp lying around for the call
* below to gen_backing_up().
*/
indent_puts ("register char *yy_cp = YY_G(yy_c_buf_p);");
outc ('\n');
if (nultrans) {
indent_puts
("yy_current_state = yy_NUL_trans[yy_current_state];");
indent_puts ("yy_is_jam = (yy_current_state == 0);");
}
else if (fulltbl) {
do_indent ();
if (gentables)
out_dec ("yy_current_state = yy_nxt[yy_current_state][%d];\n", NUL_ec);
else
out_dec ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %d];\n", NUL_ec);
indent_puts ("yy_is_jam = (yy_current_state <= 0);");
}
else if (fullspd) {
do_indent ();
out_dec ("register int yy_c = %d;\n", NUL_ec);
indent_puts
("register yyconst struct yy_trans_info *yy_trans_info;\n");
indent_puts
("yy_trans_info = &yy_current_state[(unsigned int) yy_c];");
indent_puts ("yy_current_state += yy_trans_info->yy_nxt;");
indent_puts
("yy_is_jam = (yy_trans_info->yy_verify != yy_c);");
}
else {
char NUL_ec_str[20];
snprintf (NUL_ec_str, sizeof(NUL_ec_str), "%d", NUL_ec);
gen_next_compressed_state (NUL_ec_str);
do_indent ();
out_dec ("yy_is_jam = (yy_current_state == %d);\n",
jamstate);
if (reject) {
/* Only stack this state if it's a transition we
* actually make. If we stack it on a jam, then
* the state stack and yy_c_buf_p get out of sync.
*/
indent_puts ("if ( ! yy_is_jam )");
indent_up ();
indent_puts
("*YY_G(yy_state_ptr)++ = yy_current_state;");
indent_down ();
}
}
/* If we've entered an accepting state, back up; note that
* compressed tables have *already* done such backing up, so
* we needn't bother with it again.
*/
if (need_backing_up && (fullspd || fulltbl)) {
outc ('\n');
indent_puts ("if ( ! yy_is_jam )");
indent_up ();
indent_puts ("{");
gen_backing_up ();
indent_puts ("}");
indent_down ();
}
} | true | true | false | false | false | 1 |
xenbus_transaction_end(struct xenbus_transaction t, int abort)
{
char abortstr[2];
int err;
if (abort)
strcpy(abortstr, "F");
else
strcpy(abortstr, "T");
err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL));
transaction_end();
return err;
} | true | true | false | false | false | 1 |
remove_context (GUPnPLinuxContextManager *self,
const char *label,
struct ifaddrmsg *ifa)
{
NetworkInterface *device;
GUPnPContext *context;
device = g_hash_table_lookup (self->priv->interfaces,
GINT_TO_POINTER (ifa->ifa_index));
if (!device)
return;
context = g_hash_table_lookup (device->contexts, label);
if (context) {
if (device->flags & NETWORK_INTERFACE_UP) {
g_signal_emit_by_name (self,
"context-unavailable",
context);
}
g_hash_table_remove (device->contexts, label);
}
if (g_hash_table_size (device->contexts) == 0)
device->flags &= ~NETWORK_INTERFACE_PRECONFIGURED;
} | false | false | false | false | false | 0 |
cddb_search(cddb_conn_t *c, cddb_disc_t *disc, const char *str)
{
regmatch_t matches[11];
char *line;
int count;
cddb_disc_t *aux = NULL;
char paramstr[1024]; /* big enough! */
/* NOTE: For server access this function uses the special
'cddb_search_conn' connection structure. */
cddb_log_debug("cddb_search()");
/* copy proxy parameters */
cddb_clone_proxy(cddb_search_conn, c);
/* clear previous query result set */
list_flush(c->query_data);
if (!cddb_connect(cddb_search_conn)) {
/* connection not OK, copy error code */
cddb_errno_set(c, cddb_errno(cddb_search_conn));
return -1;
}
/* prepare search parameters string */
cddb_search_param_str(&c->srch, paramstr, sizeof(paramstr));
/* send query command and check response */
if (!cddb_send_cmd(cddb_search_conn, CMD_SEARCH, str, paramstr)) {
/* sending command failed, copy error code */
cddb_errno_set(c, cddb_errno(cddb_search_conn));
return -1;
}
/* parse HTML response page */
while ((line = cddb_read_line(cddb_search_conn)) != NULL) {
if (regexec(REGEX_TEXT_SEARCH, line, 11, matches, 0) == 0) {
/* process matching result line */
if (!cddb_parse_search_data(c, &aux, line, matches)) {
return -1;
}
}
}
/* return first disc in result set */
count = list_size(c->query_data);
if (count != 0) {
cddb_disc_copy(disc,
(cddb_disc_t *)element_data(list_first(c->query_data)));
}
/* close connection */
cddb_disconnect(cddb_search_conn);
cddb_log_debug("...number of matches: %d", count);
cddb_errno_set(c, CDDB_ERR_OK);
return count;
} | false | false | false | false | false | 0 |
read_add_inode(struct ubifs_info *c,
struct fsck_data *fsckd, ino_t inum)
{
int n, err;
union ubifs_key key;
struct ubifs_znode *znode;
struct ubifs_zbranch *zbr;
struct ubifs_ino_node *ino;
struct fsck_inode *fscki;
fscki = search_inode(fsckd, inum);
if (fscki)
return fscki;
ino_key_init(c, &key, inum);
err = ubifs_lookup_level0(c, &key, &znode, &n);
if (!err) {
ubifs_err(c, "inode %lu not found in index", (unsigned long)inum);
return ERR_PTR(-ENOENT);
} else if (err < 0) {
ubifs_err(c, "error %d while looking up inode %lu",
err, (unsigned long)inum);
return ERR_PTR(err);
}
zbr = &znode->zbranch[n];
if (zbr->len < UBIFS_INO_NODE_SZ) {
ubifs_err(c, "bad node %lu node length %d",
(unsigned long)inum, zbr->len);
return ERR_PTR(-EINVAL);
}
ino = kmalloc(zbr->len, GFP_NOFS);
if (!ino)
return ERR_PTR(-ENOMEM);
err = ubifs_tnc_read_node(c, zbr, ino);
if (err) {
ubifs_err(c, "cannot read inode node at LEB %d:%d, error %d",
zbr->lnum, zbr->offs, err);
kfree(ino);
return ERR_PTR(err);
}
fscki = add_inode(c, fsckd, ino);
kfree(ino);
if (IS_ERR(fscki)) {
ubifs_err(c, "error %ld while adding inode %lu node",
PTR_ERR(fscki), (unsigned long)inum);
return fscki;
}
return fscki;
} | false | false | false | false | false | 0 |
hwloc_memory_page_type_compare(const void *_a, const void *_b)
{
const struct hwloc_obj_memory_page_type_s *a = _a;
const struct hwloc_obj_memory_page_type_s *b = _b;
/* consider 0 as larger so that 0-size page_type go to the end */
if (!b->size)
return -1;
/* don't cast a-b in int since those are ullongs */
if (b->size == a->size)
return 0;
return a->size < b->size ? -1 : 1;
} | false | false | false | false | false | 0 |
rinoo_http_request_send(t_http *http, t_http_method method, const char *uri, t_buffer *body)
{
ssize_t ret;
t_rbtree_node *cur_node;
t_http_header *cur_header;
XASSERT(http != NULL, -1);
XASSERT(buffer_size(http->request.buffer) == 0, -1);
if (body != NULL) {
http->request.content_length = buffer_size(body);
}
http->request.method = method;
switch (http->request.method) {
case RINOO_HTTP_METHOD_OPTIONS:
buffer_add(http->request.buffer, "OPTIONS ", 8);
break;
case RINOO_HTTP_METHOD_GET:
buffer_add(http->request.buffer, "GET ", 4);
break;
case RINOO_HTTP_METHOD_HEAD:
buffer_add(http->request.buffer, "HEAD ", 5);
break;
case RINOO_HTTP_METHOD_POST:
buffer_add(http->request.buffer, "POST ", 5);
break;
case RINOO_HTTP_METHOD_PUT:
buffer_add(http->request.buffer, "PUT ", 4);
break;
case RINOO_HTTP_METHOD_DELETE:
buffer_add(http->request.buffer, "DELETE ", 7);
break;
case RINOO_HTTP_METHOD_TRACE:
buffer_add(http->request.buffer, "TRACE ", 6);
break;
case RINOO_HTTP_METHOD_CONNECT:
buffer_add(http->request.buffer, "CONNECT ", 8);
break;
case RINOO_HTTP_METHOD_UNKNOWN:
return -1;
}
strtobuffer(&http->request.uri, uri);
buffer_add(http->request.buffer, buffer_ptr(&http->request.uri), buffer_size(&http->request.uri));
rinoo_http_request_setdefaultheaders(http);
switch (http->version) {
case RINOO_HTTP_VERSION_10:
buffer_add(http->request.buffer, " HTTP/1.0\r\n", 11);
break;
default:
buffer_add(http->request.buffer, " HTTP/1.1\r\n", 11);
break;
}
for (cur_node = rbtree_head(&http->request.headers);
cur_node != NULL;
cur_node = rbtree_next(cur_node)) {
cur_header = container_of(cur_node, t_http_header, node);
buffer_print(http->request.buffer,
"%.*s: %.*s\r\n",
buffer_size(&cur_header->key),
buffer_ptr(&cur_header->key),
buffer_size(&cur_header->value),
buffer_ptr(&cur_header->value));
}
buffer_add(http->request.buffer, "\r\n", 2);
ret = rinoo_socket_writeb(http->socket, http->request.buffer);
if (ret != (ssize_t) buffer_size(http->request.buffer)) {
return -1;
}
if (body != NULL && rinoo_socket_writeb(http->socket, body) != (ssize_t) buffer_size(body)) {
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
msg_type_str(gint value)
{
static const char * const strs[] = {
N_("Unknown"),
N_("Ping"),
N_("Pong"),
N_("Bye"),
N_("QRP"),
N_("HSEP"),
N_("RUDP"),
N_("Vendor spec."),
N_("Vendor std."),
N_("Push"),
N_("Query"),
N_("Query hit"),
N_("DHT (truncated)"),
N_("DHT Ping"),
N_("DHT Pong"),
N_("DHT Store"),
N_("DHT Store Ack"),
N_("DHT Find Node"),
N_("DHT Found Node"),
N_("DHT Find Value"),
N_("DHT Value"),
N_("Total"),
};
STATIC_ASSERT(G_N_ELEMENTS(strs) == MSG_TYPE_COUNT);
if ((guint) value >= G_N_ELEMENTS(strs)) {
g_warning("Requested general_type_str %d is invalid", value);
return "";
}
return _(strs[value]);
} | false | false | false | false | false | 0 |
gf_isom_get_track_switch_group_count(GF_ISOFile *movie, u32 trackNumber, u32 *alternateGroupID, u32 *nb_groups)
{
GF_UserDataMap *map;
GF_TrackBox *trak;
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak) return GF_BAD_PARAM;
*alternateGroupID = trak->Header->alternate_group;
*nb_groups = 0;
if (!trak->udta) return GF_OK;
map = udta_getEntry(trak->udta, GF_ISOM_BOX_TYPE_TSEL, NULL);
if (!map) return 0;
*nb_groups = gf_list_count(map->other_boxes);
return GF_OK;
} | false | false | false | false | false | 0 |
InstantiateMulticlassDef(MultiClass &MC,
Record *DefProto,
Init *DefmPrefix,
SMLoc DefmPrefixLoc) {
// We need to preserve DefProto so it can be reused for later
// instantiations, so create a new Record to inherit from it.
// Add in the defm name. If the defm prefix is empty, give each
// instantiated def a unique name. Otherwise, if "#NAME#" exists in the
// name, substitute the prefix for #NAME#. Otherwise, use the defm name
// as a prefix.
if (DefmPrefix == 0)
DefmPrefix = StringInit::get(GetNewAnonymousName());
Init *DefName = DefProto->getNameInit();
StringInit *DefNameString = dynamic_cast<StringInit *>(DefName);
if (DefNameString != 0) {
// We have a fully expanded string so there are no operators to
// resolve. We should concatenate the given prefix and name.
DefName =
BinOpInit::get(BinOpInit::STRCONCAT,
UnOpInit::get(UnOpInit::CAST, DefmPrefix,
StringRecTy::get())->Fold(DefProto, &MC),
DefName, StringRecTy::get())->Fold(DefProto, &MC);
}
Record *CurRec = new Record(DefName, DefmPrefixLoc, Records);
SubClassReference Ref;
Ref.RefLoc = DefmPrefixLoc;
Ref.Rec = DefProto;
AddSubClass(CurRec, Ref);
if (DefNameString == 0) {
// We must resolve references to NAME.
if (SetValue(CurRec, Ref.RefLoc, "NAME", std::vector<unsigned>(),
DefmPrefix)) {
Error(DefmPrefixLoc, "Could not resolve "
+ CurRec->getNameInitAsString() + ":NAME to '"
+ DefmPrefix->getAsUnquotedString() + "'");
return 0;
}
RecordVal *DefNameRV = CurRec->getValue("NAME");
CurRec->resolveReferencesTo(DefNameRV);
}
if (!CurMultiClass) {
// We do this after resolving NAME because before resolution, many
// multiclass defs will have the same name expression. If we are
// currently in a multiclass, it means this defm appears inside a
// multiclass and its name won't be fully resolvable until we see
// the top-level defm. Therefore, we don't add this to the
// RecordKeeper at this point. If we did we could get duplicate
// defs as more than one probably refers to NAME or some other
// common internal placeholder.
// Ensure redefinition doesn't happen.
if (Records.getDef(CurRec->getNameInitAsString())) {
Error(DefmPrefixLoc, "def '" + CurRec->getNameInitAsString() +
"' already defined, instantiating defm with subdef '" +
DefProto->getNameInitAsString() + "'");
return 0;
}
Records.addDef(CurRec);
}
return CurRec;
} | false | false | false | false | false | 0 |
hfi1_dma_map_page(struct ib_device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
u64 addr;
if (WARN_ON(!valid_dma_direction(direction)))
return BAD_DMA_ADDRESS;
if (offset + size > PAGE_SIZE)
return BAD_DMA_ADDRESS;
addr = (u64) page_address(page);
if (addr)
addr += offset;
return addr;
} | false | false | false | false | false | 0 |
getDefaultDataFilename(const char *name) const {
return m_RC_PATH + string("/") + name;
} | false | false | false | false | false | 0 |
apple2_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
struct state *st = (struct state *) closure;
if (st->sim)
analogtv_reconfigure (st->sim->dec);
} | false | false | false | false | false | 0 |
drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
{
struct drm_hash_item *entry;
struct hlist_head *h_list;
unsigned int hashed_key;
int count = 0;
hashed_key = hash_long(key, ht->order);
DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
h_list = &ht->table[hashed_key];
hlist_for_each_entry(entry, h_list, head)
DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
} | false | false | false | false | false | 0 |
mxactMemberComparator(const void *arg1, const void *arg2)
{
MultiXactMember member1 = *(const MultiXactMember *) arg1;
MultiXactMember member2 = *(const MultiXactMember *) arg2;
if (member1.xid > member2.xid)
return 1;
if (member1.xid < member2.xid)
return -1;
if (member1.status > member2.status)
return 1;
if (member1.status < member2.status)
return -1;
return 0;
} | false | false | false | false | false | 0 |
bf_verb_code(Var arglist, Byte next, void *vdata, Objid progr)
{ /* (object, verb-desc [, fully-paren [, indent]]) */
int nargs = arglist.v.list[0].v.num;
Objid oid = arglist.v.list[1].v.obj;
Var desc = arglist.v.list[2];
int parens = nargs >= 3 && is_true(arglist.v.list[3]);
int indent = nargs < 4 || is_true(arglist.v.list[4]);
db_verb_handle h;
Var code;
enum error e;
if ((e = validate_verb_descriptor(desc)) != E_NONE
|| (e = E_INVARG, !valid(oid))) {
free_var(arglist);
return make_error_pack(e);
}
h = find_described_verb(oid, desc);
free_var(arglist);
if (!h.ptr)
return make_error_pack(E_VERBNF);
else if (!db_verb_allows(h, progr, VF_READ))
return make_error_pack(E_PERM);
code = new_list(0);
unparse_program(db_verb_program(h), lister, &code, parens, indent,
MAIN_VECTOR);
return make_var_pack(code);
} | false | false | false | false | false | 0 |
createPDFDoc(const GooString &uri, GooString *ownerPassword,
GooString *userPassword, void *guiDataA)
{
for (int i = builders->getLength() - 1; i >= 0 ; i--) {
PDFDocBuilder *builder = (PDFDocBuilder *) builders->get(i);
if (builder->supports(uri)) {
return builder->buildPDFDoc(uri, ownerPassword, userPassword, guiDataA);
}
}
error(errInternal, -1, "Cannot handle URI '{0:t}'.", &uri);
GooString *fileName = uri.copy();
return PDFDoc::ErrorPDFDoc(errOpenFile, fileName);
} | false | false | false | false | false | 0 |
TTIn_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
{
GF_Err e;
TTIn *tti = (TTIn *)plug->priv;
if (!plug || !url)
return GF_BAD_PARAM;
tti->service = serv;
if (tti->dnload) gf_term_download_del(tti->dnload);
tti->dnload = NULL;
/*remote fetch*/
if (!TTIn_is_local(url)) {
TTIn_download_file(plug, url);
return GF_OK;
}
e = TTIn_LoadFile(plug, url, 0);
gf_term_on_connect(serv, NULL, e);
if (!e && !tti->od_done) tti_setup_object(tti);
return GF_OK;
} | false | false | false | false | false | 0 |
ya_random (void)
{
register int ret = a[i1] + a[i2];
a[i1] = ret;
if (++i1 >= VectorSize) i1 = 0;
if (++i2 >= VectorSize) i2 = 0;
return ret;
} | false | false | false | false | false | 0 |
reduce FCN((j,k,c,d,n))
scrap_pointer j C0("")
short k C0("Number of items to be reduced.")
eight_bits c C0("Reduce to this type.")
short d C0("Move by this amount.")
RULE_NO n C1("Rule number.")
{
scrap_pointer i,i1;
j->cat= c;j->trans= text_ptr;
j->mathness= (eight_bits)(4*last_mathness+ini_mathness);
freeze_text;
if(k>1)
{
for(i= j+k,i1= j+1;i<=lo_ptr;i++,i1++)
{
i1->cat= i->cat;i1->trans= i->trans;
i1->mathness= i->mathness;
}
lo_ptr= lo_ptr-k+1;
}
if(pp+d>=scrp_base)pp= pp+d;
else pp= scrp_base;
;
#ifdef DEBUG
{
scrap_pointer k;
{
static RULE_NO last_rule= ULONG_MAX;
static int ncycles= 0;
if(n&&n==last_rule)
{
if(ncycles++>MAX_CYCLES)
{
confusion(OC("reduce"),OC("Infinite production loop, rule %lu"),n);
}
}
else
{
last_rule= n;
ncycles= 0;
}
}
if(tracing==VERBOSE)
{
printf("%5lu",n);
if(in_prototype)
printf(".%i",in_prototype);
printf(": ");
for(k= scrp_base;k<=lo_ptr;k++)
{
if(k==pp)
putxchar('*');
else
putxchar(' ');
prn_math(k);
}
if(hi_ptr<=scrp_ptr)printf("...");
{
printf(" ==\"");
if(lo_ptr>scrp_base)
{
prn_trans(lo_ptr-1);
printf("\" \"");
}
prn_trans(lo_ptr);
puts("\"");
}
}
}
;
#endif
pp--;
} | false | false | false | false | false | 0 |
account_mgmt(int lld_no, struct mgmt_task *mtask)
{
struct tgtadm_req *req = &mtask->req;
struct tgtadm_rsp *rsp = &mtask->rsp;
int err = TGTADM_UNSUPPORTED_OPERATION;
char *user, *password;
switch (req->op) {
case OP_NEW:
case OP_DELETE:
case OP_BIND:
case OP_UNBIND:
user = strstr(mtask->buf, "user=");
if (!user)
goto out;
user += 5;
if (req->op == OP_NEW) {
password = strchr(user, ',');
if (!password)
goto out;
*password++ = '\0';
password += strlen("password=");
err = account_add(user, password);
} else {
if (req->op == OP_DELETE) {
account_del(user);
err = 0;
} else
err = account_ctl(req->tid, req->ac_dir,
user, req->op == OP_BIND);
}
break;
case OP_SHOW:
retry:
err = account_show(mtask->buf, mtask->bsize);
if (err == mtask->bsize) {
char *p;
mtask->bsize <<= 1;
p = realloc(mtask->buf, mtask->bsize);
if (p) {
mtask->buf = p;
goto retry;
} else
err = TGTADM_NOMEM;
}
break;
default:
break;
}
out:
if (req->op == OP_SHOW)
set_show_results(rsp, &err);
else {
rsp->err = err;
rsp->len = sizeof(*rsp);
}
return err;
} | false | false | false | false | false | 0 |
should_i_die (ThreadPool *tp)
{
gboolean result = FALSE;
if (tp->destroy_thread == 1 && InterlockedCompareExchange (&tp->destroy_thread, 0, 1) == 1)
result = (tp->nthreads > tp->min_threads);
return result;
} | false | false | false | false | false | 0 |
dir_name (char const *file)
{
size_t length = dir_len (file);
bool append_dot = (length == 0
|| (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
&& length == FILE_SYSTEM_PREFIX_LEN (file)
&& file[2] != '\0' && ! ISSLASH (file[2])));
char *dir = xmalloc (length + append_dot + 1);
memcpy (dir, file, length);
if (append_dot)
dir[length++] = '.';
dir[length] = '\0';
return dir;
} | false | false | false | false | false | 0 |
gst_flv_demux_parse_and_add_index_entry (GstFlvDemux * demux, GstClockTime ts,
guint64 pos, gboolean keyframe)
{
GstIndexAssociation associations[2];
GstIndex *index;
GstIndexEntry *entry;
GST_LOG_OBJECT (demux,
"adding key=%d association %" GST_TIME_FORMAT "-> %" G_GUINT64_FORMAT,
keyframe, GST_TIME_ARGS (ts), pos);
/* if upstream is not seekable there is no point in building an index */
if (!demux->upstream_seekable)
return;
index = gst_flv_demux_get_index (GST_ELEMENT (demux));
if (!index)
return;
/* entry may already have been added before, avoid adding indefinitely */
entry = gst_index_get_assoc_entry (index, demux->index_id,
GST_INDEX_LOOKUP_EXACT, GST_ASSOCIATION_FLAG_NONE, GST_FORMAT_BYTES, pos);
if (entry) {
#ifndef GST_DISABLE_GST_DEBUG
gint64 time = 0;
gboolean key;
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
key = ! !(GST_INDEX_ASSOC_FLAGS (entry) & GST_ASSOCIATION_FLAG_KEY_UNIT);
GST_LOG_OBJECT (demux, "position already mapped to time %" GST_TIME_FORMAT
", keyframe %d", GST_TIME_ARGS (time), key);
/* there is not really a way to delete the existing one */
if (time != ts || key != ! !keyframe)
GST_DEBUG_OBJECT (demux, "metadata mismatch");
#endif
gst_object_unref (index);
return;
}
associations[0].format = GST_FORMAT_TIME;
associations[0].value = ts;
associations[1].format = GST_FORMAT_BYTES;
associations[1].value = pos;
gst_index_add_associationv (index, demux->index_id,
(keyframe) ? GST_ASSOCIATION_FLAG_KEY_UNIT :
GST_ASSOCIATION_FLAG_DELTA_UNIT, 2,
(const GstIndexAssociation *) &associations);
if (pos > demux->index_max_pos)
demux->index_max_pos = pos;
if (ts > demux->index_max_time)
demux->index_max_time = ts;
gst_object_unref (index);
} | false | true | false | false | false | 1 |
setup(const Config &, ParmStr enc0)
{
String buf;
const char * enc = fix_encoding_str(enc0,buf);
if (strcmp(enc, "utf-8") == 0) encoding = UTF8;
else if (strcmp(enc, "ucs-2") == 0) encoding = UCS2;
else if (strcmp(enc, "ucs-4") == 0) encoding = UCS4;
else encoding = Other;
return no_err;
} | false | false | false | false | false | 0 |
templates_editor_finalize (GObject *object)
{
TemplatesEditor *te = TEMPLATES_EDITOR (object);
TemplatesEditorPrivate *priv = TEMPLATES_EDITOR_GET_PRIVATE(te);
if(priv->tempmg) g_object_unref(priv->tempmg);
G_OBJECT_CLASS (templates_editor_parent_class)->finalize (object);
} | false | false | false | false | false | 0 |
SDPConeComputeSS(SDPCone sdpcone, int blockj, DSDPVec Y, DSDPVMat SS){
int info;
DSDPFunctionBegin;
info=DSDPVMatZeroEntries(SS); DSDPCHKBLOCKERR(blockj,info);
info=DSDPBlockASum(&sdpcone->blk[blockj].ADATA,1,Y,SS); DSDPCHKBLOCKERR(blockj,info);
DSDPFunctionReturn(0);
} | false | false | false | false | false | 0 |
UnrefGrid(const uint32& x, const uint32& y)
{
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
int16& iRef = m_GridRef[x][y];
LOCK_GUARD _lock(m_refMutex);
if (iRef > 0)
return (iRef -= 1);
return 0;
} | false | false | false | false | false | 0 |
getBottomBlock() {
MachineBasicBlock *BotMBB = getHeader();
MachineFunction::iterator End = BotMBB->getParent()->end();
if (BotMBB != prior(End)) {
MachineBasicBlock *NextMBB = llvm::next(MachineFunction::iterator(BotMBB));
while (contains(NextMBB)) {
BotMBB = NextMBB;
if (BotMBB == llvm::next(MachineFunction::iterator(BotMBB))) break;
NextMBB = llvm::next(MachineFunction::iterator(BotMBB));
}
}
return BotMBB;
} | false | false | false | false | false | 0 |
de_stop_rxtx (struct de_private *de)
{
u32 macmode;
unsigned int i = 1300/100;
macmode = dr32(MacMode);
if (macmode & RxTx) {
dw32(MacMode, macmode & ~RxTx);
dr32(MacMode);
}
/* wait until in-flight frame completes.
* Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin)
* Typically expect this loop to end in < 50 us on 100BT.
*/
while (--i) {
if (!de_is_running(de))
return;
udelay(100);
}
netdev_warn(de->dev, "timeout expired, stopping DMA\n");
} | false | false | false | false | false | 0 |
setname(int slot,char **argv)
{
if (our_name[0] == 0) {
strncpy(our_name, argv[0], MAXNAMELEN);
our_name[MAXNAMELEN-1] = 0;
}
return 1;
} | false | true | false | false | false | 1 |
gda_server_operation_perform_create_table (GdaServerOperation *op, GError **error)
{
GdaConnection *cnc;
g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_CREATE_TABLE, FALSE);
cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
if (cnc)
return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op, error);
else {
g_warning ("Could not find operation's associated connection, "
"did you use gda_connection_prepare_create_table() ?");
return FALSE;
}
} | false | false | false | false | false | 0 |
__tgammaf(float x)
{
int local_signgam;
float y = __ieee754_gammaf_r(x,&local_signgam);
if(__glibc_unlikely (!__finitef (y) || y == 0)
&& (__finitef (x) || __isinff (x) < 0)
&& _LIB_VERSION != _IEEE_) {
if (x == (float)0.0)
/* tgammaf pole */
return __kernel_standard_f(x, x, 150);
else if(__floorf(x)==x&&x<0.0f)
/* tgammaf domain */
return __kernel_standard_f(x, x, 141);
else if (y == 0)
/* tgammaf underflow */
__set_errno (ERANGE);
else
/* tgammaf overflow */
return __kernel_standard_f(x, x, 140);
}
return local_signgam < 0 ? - y : y;
} | false | false | false | false | false | 0 |
irq_domain_activate_irq(struct irq_data *irq_data)
{
if (irq_data && irq_data->domain) {
struct irq_domain *domain = irq_data->domain;
if (irq_data->parent_data)
irq_domain_activate_irq(irq_data->parent_data);
if (domain->ops->activate)
domain->ops->activate(domain, irq_data);
}
} | false | false | false | false | false | 0 |
_pullEnergyGaussEval(double *denr, double dist, const double *parm) {
AIR_UNUSED(parm);
*denr = _DGAUSS(dist, 0.25, 4);
return _GAUSS(dist, 0.25, 4);
} | false | false | false | false | false | 0 |
Perl_newGP(pTHX_ GV *const gv)
{
GP *gp;
U32 hash;
const char *file;
STRLEN len;
#ifndef USE_ITHREADS
SV * temp_sv;
#endif
dVAR;
PERL_ARGS_ASSERT_NEWGP;
Newxz(gp, 1, GP);
gp->gp_egv = gv; /* allow compiler to reuse gv after this */
#ifndef PERL_DONT_CREATE_GVSV
gp->gp_sv = newSV(0);
#endif
#ifdef USE_ITHREADS
if (PL_curcop) {
gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */
if (CopFILE(PL_curcop)) {
file = CopFILE(PL_curcop);
len = strlen(file);
}
else goto no_file;
}
else {
no_file:
file = "";
len = 0;
}
#else
if(PL_curcop)
gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */
temp_sv = CopFILESV(PL_curcop);
if (temp_sv) {
file = SvPVX(temp_sv);
len = SvCUR(temp_sv);
} else {
file = "";
len = 0;
}
#endif
PERL_HASH(hash, file, len);
gp->gp_file_hek = share_hek(file, len, hash);
gp->gp_refcnt = 1;
return gp;
} | false | false | false | false | false | 0 |
haveClients() {
for (YFrameWindow * f(topLayer()); f ; f = f->nextLayer())
if (f->canClose() && f->client()->adopted())
return true;
return false;
} | false | false | false | false | false | 0 |
probe_evms_tp(blkid_probe pr,
const struct blkid_idmag *mag __attribute__((__unused__)))
{
struct evms_stripe_info evms;
dev_t devno = blkid_probe_get_devno(pr);
if (!devno)
goto nothing; /* probably not a block device */
if (!is_evms_device(devno))
goto nothing;
memset(&evms, 0, sizeof(evms));
if (ioctl(pr->fd, EVMS_GET_STRIPE_INFO, &evms))
goto nothing;
blkid_topology_set_minimum_io_size(pr, evms.size << 9);
blkid_topology_set_optimal_io_size(pr, (evms.size * evms.width) << 9);
return 0;
nothing:
return 1;
} | false | false | false | false | false | 0 |
stop_ts_capture(struct av7110 *budget)
{
dprintk(2, "budget: %p\n", budget);
if (--budget->feeding1)
return budget->feeding1;
saa7146_write(budget->dev, MC1, MASK_20); /* DMA3 off */
SAA7146_IER_DISABLE(budget->dev, MASK_10);
SAA7146_ISR_CLEAR(budget->dev, MASK_10);
return 0;
} | false | false | false | false | false | 0 |
IsRdsRealVia(r)
rdsrec_list *r;
{
if(IsRdsVia(r))
{
if(GetLynxAttribute(r)!= C_X_N && GetLynxAttribute(r)!=C_X_P)
return(1);
}
return(0);
} | false | false | false | false | false | 0 |
mailbox_commit_cache(struct mailbox *mailbox)
{
if (!mailbox->cache_dirty)
return 0;
mailbox->cache_dirty = 0;
/* not open! That's bad */
if (mailbox->cache_fd == -1)
abort();
/* just fsync is all that's needed to commit */
(void)fsync(mailbox->cache_fd);
return 0;
} | false | false | false | false | false | 0 |
showrayparms(long treecolor, long namecolor, long backcolor,
long bottomcolor, long rx, long ry)
{
long i, loopcount;
Char ch,input[32];
long numtochange;
if (previewer == tek)
printf("%c\f", escape);
else {
for (i = 1; i <= 24; i++)
putchar('\n');
}
if (plotter == ray) {
printf("Settings for Rayshade file: \n\n");
printf(" (1) Tree color: %.10s\n",colors[treecolor-1].name);
printf(" (2) Species names color: %.10s\n",colors[namecolor-1].name);
printf(" (3) Background color: %.10s\n",colors[backcolor-1].name);
printf(" (4) Resolution: %2ld X %2ld\n\n",rx,ry);
} else if (plotter == pov) {
printf("Settings for POVray file: \n\n");
printf(" (1) Tree color: %.10s\n",colors[treecolor-1].name);
printf(" (2) Species names color: %.10s\n",colors[namecolor-1].name);
printf(" (3) Background color: %.10s\n",colors[backcolor-1].name);
printf(" (4) Bottom plane: %.10s\n",
bottomcolor == NO_PLANE ?
"(none)\0" : colors[bottomcolor-1].name);
}
printf(" Do you want to accept these? (Yes or No)\n");
loopcount = 0;
for (;;) {
printf(" Type Y or N or the number (1-4) of the one to change: \n");
#ifdef WIN32
phyFillScreenColor();
#endif
getstryng(input);
numtochange=atoi(input);
uppercase(&input[0]);
ch=input[0];
if (ch == 'Y' || ch == 'N' || (numtochange >= 1 && numtochange <= 4))
break;
countup(&loopcount, 10);
}
return (ch == 'Y') ? -1 : numtochange;
} | false | false | false | false | false | 0 |
run() {
Event e;
boolean& done = rep_->done_;
done = false;
do {
read(e);
e.handle();
} while (!done);
return 0;
} | false | false | false | false | false | 0 |
stored_display_free (StoredDisplay *stored_display)
{
char *id;
gdm_display_get_id (stored_display->display, &id, NULL);
g_signal_emit (G_OBJECT (stored_display->store),
signals[DISPLAY_REMOVED],
0,
id);
g_free (id);
g_debug ("GdmDisplayStore: Unreffing display: %p",
stored_display->display);
g_object_unref (stored_display->display);
g_slice_free (StoredDisplay, stored_display);
} | false | false | false | false | false | 0 |
nes_show_adapter(struct device_driver *ddp, char *buf)
{
unsigned int devfn = 0xffffffff;
unsigned char bus_number = 0xff;
unsigned int i = 0;
struct nes_device *nesdev;
list_for_each_entry(nesdev, &nes_dev_list, list) {
if (i == ee_flsh_adapter) {
devfn = nesdev->pcidev->devfn;
bus_number = nesdev->pcidev->bus->number;
break;
}
i++;
}
return snprintf(buf, PAGE_SIZE, "%x:%x\n", bus_number, devfn);
} | false | false | false | false | false | 0 |
nntp_folder_dispose (GObject *object)
{
CamelFolder *folder;
CamelStore *store;
folder = CAMEL_FOLDER (object);
camel_folder_summary_save_to_db (folder->summary, NULL);
store = camel_folder_get_parent_store (folder);
if (store != NULL) {
CamelNNTPStoreSummary *nntp_store_summary;
nntp_store_summary = camel_nntp_store_ref_summary (
CAMEL_NNTP_STORE (store));
camel_store_summary_disconnect_folder_summary (
CAMEL_STORE_SUMMARY (nntp_store_summary),
folder->summary);
g_clear_object (&nntp_store_summary);
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (camel_nntp_folder_parent_class)->dispose (object);
} | false | false | false | false | false | 0 |
_transform(Request& r, MethodParams& params) {
VXdoc& vdoc=GET_SELF(r, VXdoc);
// params
Array<const xmlChar*> transform_strings;
const xmlChar** transform_params=0;
if(params.count()>1)
if(HashStringValue* hash=params.as_hash(1, "transform options")) {
transform_params=new(UseGC) const xmlChar*[hash->count()*2+1];
Add_xslt_param_info info={
&r,
&transform_strings,
transform_params
};
hash->for_each<Add_xslt_param_info*>(add_xslt_param, &info);
transform_params[hash->count()*2]=0;
}
VXdoc* result;
if(Value *vxdoc=params[0].as(VXDOC_TYPE)) { // stylesheet (xdoc)
xmlDoc& stylesheetdoc=static_cast<VXdoc *>(vxdoc)->get_xmldoc();
// compile xdoc stylesheet
xsltStylesheet_auto_ptr stylesheet_ptr(xsltParseStylesheetDoc(&stylesheetdoc));
if(xmlHaveGenericErrors())
throw XmlException(0, r);
if(!stylesheet_ptr.get())
throw Exception("xml",
0,
"stylesheet failed to compile");
// strange thing - xsltParseStylesheetDoc records document and destroys it in stylesheet destructor
// we don't need that
stylesheet_ptr->doc=0;
// transform!
result=&_transform(r, 0,
vdoc, stylesheet_ptr.get(),
transform_params);
} else { // stylesheet (file name)
// extablish stylesheet connection
const String& stylesheet_filespec=
r.absolute(params.as_string(0, "stylesheet must be file name (string) or DOM document (xdoc)"));
Stylesheet_connection_ptr connection=stylesheet_manager->get_connection(stylesheet_filespec);
// load and compile file to stylesheet [or get cached if any]
// transform!
result=&_transform(r, &stylesheet_filespec, vdoc, connection->stylesheet(),
transform_params);
}
// write out result
r.write_no_lang(*result);
} | false | false | false | false | false | 0 |
objects_list(char** strs, List ls)
{
while (*strs != NULL){
*ls = mk_symbol(*strs++);
(*ls)->type = 2;
ls++;
}
*ls = NULL;
} | false | false | false | false | false | 0 |
OverflowUnscale (uint32_t *quo, gboolean remainder)
{
SPLIT64 sdlTmp;
// We have overflown, so load the high bit with a one.
sdlTmp.u.Hi = 1u;
sdlTmp.u.Lo = quo[2];
sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u);
quo[2] = sdlTmp.u.Lo;
sdlTmp.u.Lo = quo[1];
sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u);
quo[1] = sdlTmp.u.Lo;
sdlTmp.u.Lo = quo[0];
sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u);
quo[0] = sdlTmp.u.Lo;
// The remainder is the last digit that does not fit, so we can use it to work out if we need to round up
if ((sdlTmp.u.Hi > 5) || ((sdlTmp.u.Hi == 5) && ( remainder || (quo[0] & 1)))) {
Add32To96(quo, 1u);
}
} | false | false | false | false | false | 0 |
e_illume_border_is_softkey(E_Border *bd)
{
/* make sure we have a border */
if (!bd) return EINA_FALSE;
/* legacy code from illume 1 */
if (bd->client.qtopia.soft_menu) return EINA_TRUE;
/* softkey windows should be set to dock type, so check for that */
if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) return EINA_FALSE;
/* we have a softkey window, check against any matches in config */
/* check if we are matching on name */
if (_e_illume_cfg->policy.softkey.match.name)
{
if ((bd->client.icccm.name) &&
(!strcmp(bd->client.icccm.name,
_e_illume_cfg->policy.softkey.name)))
return EINA_TRUE;
}
/* check if we are matching on class */
if (_e_illume_cfg->policy.softkey.match.class)
{
if ((bd->client.icccm.class) &&
(!strcmp(bd->client.icccm.class,
_e_illume_cfg->policy.softkey.class)))
return EINA_TRUE;
}
/* check if we are matching on title */
if (_e_illume_cfg->policy.softkey.match.title)
{
const char *title;
if ((title = e_border_name_get(bd)))
if (!strcmp(title, _e_illume_cfg->policy.softkey.title))
return EINA_TRUE;
}
/* return a fallback */
return EINA_FALSE;
} | false | false | false | false | false | 0 |
pack_zu_triclinic(int n)
{
double **x = atom->x;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double *h = domain->h;
int zbox;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
zbox = (image[i] >> IMG2BITS) - IMGMAX;
vbuf[n] = x[i][2] + h[2]*zbox;
if (comflag) vbuf[n] -= cm[2];
} else vbuf[n] = 0.0;
n += nvalues;
}
} | false | false | false | false | false | 0 |
redirectsafe(union node *redir, int flags)
{
int err;
volatile int saveint;
struct jmploc *volatile savehandler = handler;
struct jmploc jmploc;
SAVEINT(saveint);
if (!(err = setjmp(jmploc.loc) * 2)) {
handler = &jmploc;
redirect(redir, flags);
}
handler = savehandler;
if (err && exception != EXERROR)
longjmp(handler->loc, 1);
RESTOREINT(saveint);
return err;
} | false | false | false | false | false | 0 |
sunkbd_event(struct input_dev *dev,
unsigned int type, unsigned int code, int value)
{
struct sunkbd *sunkbd = input_get_drvdata(dev);
switch (type) {
case EV_LED:
serio_write(sunkbd->serio, SUNKBD_CMD_SETLED);
serio_write(sunkbd->serio,
(!!test_bit(LED_CAPSL, dev->led) << 3) |
(!!test_bit(LED_SCROLLL, dev->led) << 2) |
(!!test_bit(LED_COMPOSE, dev->led) << 1) |
!!test_bit(LED_NUML, dev->led));
return 0;
case EV_SND:
switch (code) {
case SND_CLICK:
serio_write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value);
return 0;
case SND_BELL:
serio_write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value);
return 0;
}
break;
}
return -1;
} | false | false | false | false | false | 0 |
process_vorbis_headers (ogg_state_t *ogg_info, ogg_codec_t *codec)
{
vorbis_codec_t *source_vorbis = codec->specific;
if (source_vorbis->header [0] == NULL)
return 0;
DEBUG0 ("Adding the 3 header packets");
ogg_stream_packetin (&source_vorbis->new_os, source_vorbis->header [0]);
/* NOTE: we could build a separate comment packet each time */
if (source_vorbis->rebuild_comment)
{
vorbis_comment vc;
ogg_packet header;
ice_config_t *config;
vorbis_comment_init (&vc);
if (ogg_info->artist)
vorbis_comment_add_tag (&vc, "artist", ogg_info->artist);
if (ogg_info->title)
vorbis_comment_add_tag (&vc, "title", ogg_info->title);
config = config_get_config();
vorbis_comment_add_tag (&vc, "server", config->server_id);
config_release_config();
vorbis_commentheader_out (&vc, &header);
ogg_stream_packetin (&source_vorbis->new_os, &header);
vorbis_comment_clear (&vc);
ogg_packet_clear (&header);
}
else
ogg_stream_packetin (&source_vorbis->new_os, source_vorbis->header [1]);
ogg_stream_packetin (&source_vorbis->new_os, source_vorbis->header [2]);
source_vorbis->rebuild_comment = 0;
ogg_info->log_metadata = 1;
source_vorbis->get_buffer_page = get_buffer_header;
source_vorbis->process_packet = process_vorbis_audio;
source_vorbis->granulepos = source_vorbis->prev_window;
source_vorbis->initial_audio_packet = 1;
return 1;
} | false | true | false | false | false | 1 |
brasero_rename_do (BraseroRename *self,
GtkTreeSelection *selection,
guint column_num,
BraseroRenameCallback callback)
{
BraseroRenamePrivate *priv;
GtkTreeModel *model;
GList *selected;
guint item_num;
guint nb_items;
GList *item;
gint mode;
priv = BRASERO_RENAME_PRIVATE (self);
mode = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->combo));
mode -= priv->show_default;
if (mode < 0)
return TRUE;
selected = gtk_tree_selection_get_selected_rows (selection, &model);
nb_items = g_list_length (selected);
item_num = 0;
for (item = selected; item; item = item->next, item_num ++) {
GtkTreePath *treepath;
GtkTreeIter iter;
gboolean result;
gchar *new_name;
gchar *name;
treepath = item->data;
gtk_tree_model_get_iter (model, &iter, treepath);
gtk_tree_model_get (model, &iter,
column_num, &name,
-1);
redo:
switch (mode) {
case 0:
new_name = brasero_rename_insert_string (self, name);
break;
case 1:
new_name = brasero_rename_delete_string (self, name);
break;
case 2:
new_name = brasero_rename_substitute_string (self, name);
break;
case 3:
new_name = brasero_rename_number_string (self, name);
break;
case 4:
new_name = brasero_rename_sequence_string (self, name, item_num, nb_items);
break;
default:
new_name = NULL;
break;
}
if (!new_name) {
g_free (name);
continue;
}
result = callback (model, &iter, treepath, name, new_name);
if (!result) {
if (mode == 3)
goto redo;
g_free (name);
break;
}
g_free (name);
}
g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL);
g_list_free (selected);
return TRUE;
} | false | false | false | false | false | 0 |
evalGain (int sum, int count)
{
int gn;
float pct;
float avg;
float area=50;
float coeff=2.5;
float cnst=0.9;
/* after ~ 60 * 10 scans , it looks like 1 step is a 0.57% increase */
/* so we take the value and compute the percent increase to reach 250 */
/* (target code) not 255, because we want some room for inaccuracy */
/* pct=100-(value*100)/250 */
/* then correction is pct/0.57 */
avg = (float) (sum) / (float) (count);
pct = 100.0 - (avg * 100.0) / targetCode;
gn = (int) (pct / 0.57);
/* give gain for dark areas a boost */
#ifdef UMAX_PP_DANGEROUS_EXPERIMENT
if(getenv("AREA")!=NULL)
cnst=atol(getenv("AREA"));
if(getenv("COEFF")!=NULL)
cnst=atol(getenv("COEFF"));
if(getenv("CNST")!=NULL)
cnst=atol(getenv("CNST"));
#endif
pct = gn;
avg = exp((-pct)/area)*coeff+cnst;
gn = gn * avg;
/* bound checking : there are sightings of >127 values being negative */
if (gn < 0)
gn = 0;
else if (gn > 127)
gn = 127;
return gn;
} | false | false | false | false | false | 0 |
d3_np_fs(int n, double a[], double b[])
{
int i;
double *x;
double xmult;
//
// Check.
//
for (i = 0; i < n; i++) {
if (a[1 + i * 3] == 0.0E+00) {
return NULL;
}
}
x = (double *)calloc(n, sizeof(double));
nc_merror(x, "d3_np_fs");
for (i = 0; i < n; i++) {
x[i] = b[i];
}
for (i = 1; i < n; i++) {
xmult = a[2 + (i - 1) * 3] / a[1 + (i - 1) * 3];
a[1 + i * 3] = a[1 + i * 3] - xmult * a[0 + i * 3];
x[i] = x[i] - xmult * x[i - 1];
}
x[n - 1] = x[n - 1] / a[1 + (n - 1) * 3];
for (i = n - 2; 0 <= i; i--) {
x[i] = (x[i] - a[0 + (i + 1) * 3] * x[i + 1]) / a[1 + i * 3];
}
return x;
} | false | false | false | false | false | 0 |
ShowChannels(int ac, char *av[])
{
long flags;
int ii;
struct ChanInfo *cptr;
flags = parseargs(ac, av);
if ((flags & SHOW_FILE) && Filename)
{
MyFree(ChanServDB);
ChanServDB = MyStrdup(Filename);
}
InitData();
fprintf(stderr, "\n");
if (flags & SHOW_HELP)
{
fprintf(stderr,
"Usage: %s [-h|?] [-n] [-f file] [chan1 chan2 ...]\n" \
"-h/-? : Display this help screen\n" \
"-n : Display number of registered channels\n" \
"-f file : Use \"file\" as channel database\n" \
"chan1 ... : Display information about specific channels\n" \
"\n" \
"If no channels are specified, the entire database will be\n" \
"printed. Detailed information will be shown for given channels.\n" \
"If -n is specified, ONLY the number of registered channels will\n" \
"be displayed.\n", av[0]);
exit(EXIT_SUCCESS);
}
if (!(flags & SHOW_TOTALCOUNT))
{
/*
* If they gave specific channels, display
* detailed information about them - otherwise
* display all channels and the time they were
* last used
*/
if (flags & SHOW_DETAIL)
{
for (ii = ncidx; ii < ac; ii++)
{
if ((cptr = FindChan(av[ii])))
DisplayChan(cptr, 1);
else
fprintf(stderr, "No such channel: %s\n", av[ii]);
fprintf(stderr, "\n");
}
}
else
{
/*
* Print out all channels compactly
*/
fprintf(stderr,
"%-30s %-30s\n",
"Channel",
"Time Since Last Used");
for (ii = 0; ii < CHANLIST_MAX; ii++)
{
for (cptr = chanlist[ii]; cptr; cptr = cptr->next)
DisplayChan(cptr, 0);
}
fprintf(stderr, "\n");
}
} /* if (!(flags & SHOW_TOTALCOUNT)) */
fprintf(stderr, "There are %d registered channels\n",
Network->TotalChans);
} | false | false | false | false | false | 0 |
svdLAS2A(SMat A, long dimensions) {
double end[2] = {-1.0e-30, 1.0e-30};
double kappa = 1e-6;
if (!A) {
svd_error("svdLAS2A called with NULL array\n");
return NULL;
}
return svdLAS2(A, dimensions, 0, end, kappa);
} | false | false | false | false | false | 0 |
set_status (GSWatcher *watcher,
guint status)
{
gboolean is_idle;
if (! watcher->priv->active) {
gs_debug ("GSWatcher: not active, ignoring status changes");
return;
}
is_idle = (status == 3);
if (!is_idle && !watcher->priv->idle_notice) {
/* no change in idleness */
return;
}
if (is_idle) {
_gs_watcher_set_session_idle_notice (watcher, is_idle);
/* queue an activation */
if (watcher->priv->idle_id > 0) {
g_source_remove (watcher->priv->idle_id);
}
watcher->priv->idle_id = g_timeout_add (watcher->priv->delta_notice_timeout,
(GSourceFunc)on_idle_timeout,
watcher);
} else {
/* cancel notice too */
if (watcher->priv->idle_id > 0) {
g_source_remove (watcher->priv->idle_id);
}
_gs_watcher_set_session_idle (watcher, FALSE);
_gs_watcher_set_session_idle_notice (watcher, FALSE);
}
} | false | false | false | false | false | 0 |
remote_size() const
{
int size;
BOOST_MPI_CHECK_RESULT(MPI_Comm_remote_size, ((MPI_Comm)*this, &size));
return size;
} | false | false | false | false | false | 0 |
ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb)
{
int empty = 0;
unsigned long flags;
spin_lock_irqsave(&osb->dc_task_lock, flags);
if (list_empty(&osb->blocked_lock_list))
empty = 1;
spin_unlock_irqrestore(&osb->dc_task_lock, flags);
return empty;
} | false | false | false | false | false | 0 |
test_refs_overwrite__object_id(void)
{
// Overwrite an existing object id reference
git_reference *ref;
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
/* Create it */
cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 0, NULL, NULL));
git_reference_free(ref);
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_test_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
/* Ensure we can't overwrite unless we force it */
cl_git_fail(git_reference_create(&ref, g_repo, ref_name, &id, 0, NULL, NULL));
cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 1, NULL, NULL));
git_reference_free(ref);
/* Ensure it has been overwritten */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert_equal_oid(&id, git_reference_target(ref));
git_reference_free(ref);
} | false | false | false | false | false | 0 |
append(chain_list *pt1, chain_list *pt2)
{
chain_list *pt;
if (pt1 == NULL)
return pt2;
else {
for (pt = pt1; pt->NEXT; pt = pt->NEXT);
pt->NEXT = pt2; /* append the list 2 at the end of list 1 */
return pt1;
}
} | false | false | false | false | false | 0 |
isc_net_aton(const char *cp, struct in_addr *addr) {
isc_uint32_t val;
int base;
ptrdiff_t n;
unsigned char c;
isc_uint8_t parts[4];
isc_uint8_t *pp = parts;
int digit;
c = *cp;
for (;;) {
/*
* Collect number up to ``.''.
* Values are specified as for C:
* 0x=hex, 0=octal, isdigit=decimal.
*/
if (!isdigit(c & 0xff))
return (0);
val = 0; base = 10; digit = 0;
if (c == '0') {
c = *++cp;
if (c == 'x' || c == 'X')
base = 16, c = *++cp;
else {
base = 8;
digit = 1;
}
}
for (;;) {
/*
* isascii() is valid for all integer values, and
* when it is true, c is known to be in scope
* for isdigit(). No cast necessary. Similar
* comment applies for later ctype uses.
*/
if (isascii(c) && isdigit(c)) {
if (base == 8 && (c == '8' || c == '9'))
return (0);
val = (val * base) + (c - '0');
c = *++cp;
digit = 1;
} else if (base == 16 && isascii(c) && isxdigit(c)) {
val = (val << 4) |
(c + 10 - (islower(c) ? 'a' : 'A'));
c = *++cp;
digit = 1;
} else
break;
}
if (c == '.') {
/*
* Internet format:
* a.b.c.d
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3 || val > 0xffU)
return (0);
*pp++ = (isc_uint8_t)val;
c = *++cp;
} else
break;
}
/*
* Check for trailing characters.
*/
if (c != '\0' && (!isascii(c) || !isspace(c)))
return (0);
/*
* Did we get a valid digit?
*/
if (!digit)
return (0);
/*
* Concoct the address according to
* the number of parts specified.
*/
n = pp - parts + 1;
switch (n) {
case 1: /* a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffffU)
return (0);
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
}
if (addr != NULL)
addr->s_addr = htonl(val);
return (1);
} | false | false | false | false | false | 0 |
gst_ogg_stream_get_start_time_for_granulepos (GstOggStream * pad,
gint64 granulepos)
{
if (pad->frame_size == 0)
return GST_CLOCK_TIME_NONE;
return gst_ogg_stream_granule_to_time (pad,
gst_ogg_stream_granulepos_to_granule (pad, granulepos));
} | false | false | false | false | false | 0 |
__db_get_dup_compare(dbp, funcp)
DB *dbp;
int (**funcp) __P((DB *, const DBT *, const DBT *, size_t *));
{
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE | DB_OK_HASH);
if (funcp != NULL) {
#ifdef HAVE_COMPRESSION
if (DB_IS_COMPRESSED(dbp)) {
*funcp =
((BTREE *)dbp->bt_internal)->compress_dup_compare;
} else
#endif
*funcp = dbp->dup_compare;
}
return (0);
} | 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.