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 |
|---|---|---|---|---|---|---|
find_confirmed_client(clientid_t *clid, bool sessions, struct nfsd_net *nn)
{
struct list_head *tbl = nn->conf_id_hashtbl;
lockdep_assert_held(&nn->client_lock);
return find_client_in_id_table(tbl, clid, sessions);
} | false | false | false | false | false | 0 |
disambiguate_loops_with_multiple_latches (void)
{
loop_iterator li;
struct loop *loop;
FOR_EACH_LOOP (li, loop, 0)
{
if (!loop->latch)
disambiguate_multiple_latches (loop);
}
} | false | false | false | false | false | 0 |
find_item_in_menu(GtkWidget *menu, gchar *name)
{
GList *children = gtk_container_get_children(GTK_CONTAINER(GTK_MENU_SHELL(menu)));
GList *amenu = children;
const gchar *existing_name;
while (amenu) {
GtkWidget *item = GTK_WIDGET(amenu->data);
if ((existing_name = g_object_get_data(G_OBJECT(item), "s_name")) != NULL &&
!strcmp2(name, existing_name))
{
g_list_free(children);
return item;
}
amenu = amenu->next;
}
g_list_free(children);
return NULL;
} | false | false | false | false | false | 0 |
GetOverview( int iOverview )
{
if( apoOverviews.size() > 0 )
{
if( iOverview < 0 || iOverview >= (int) apoOverviews.size() )
return NULL;
if( apoOverviews[iOverview].poBand == NULL
&& !apoOverviews[iOverview].bTriedToOpen )
{
apoOverviews[iOverview].bTriedToOpen = TRUE;
GDALDataset *poSrcDS = (GDALDataset *)
GDALOpenShared( apoOverviews[iOverview].osFilename, GA_ReadOnly );
if( poSrcDS == NULL )
return NULL;
apoOverviews[iOverview].poBand = poSrcDS->GetRasterBand(
apoOverviews[iOverview].nBand );
if (apoOverviews[iOverview].poBand == NULL)
{
GDALClose( (GDALDatasetH)poSrcDS );
}
}
return apoOverviews[iOverview].poBand;
}
else
return GDALRasterBand::GetOverview( iOverview );
} | false | false | false | false | false | 0 |
Union(const geom::MultiPolygon* multipoly)
{
std::vector<geom::Polygon*> polys;
typedef geom::MultiPolygon::const_iterator iterator;
iterator end = multipoly->end();
for (iterator i = multipoly->begin(); i != end; ++i)
polys.push_back(dynamic_cast<geom::Polygon*>(*i));
CascadedPolygonUnion op (&polys);
return op.Union();
} | false | false | false | false | false | 0 |
posix_fork(s48_call_t call)
{
pid_t pid = fork();
if (pid < 0)
s48_os_error_2(call, "posix_fork", errno, 0);
return s48_enter_long_2(call, pid);
} | false | false | false | false | false | 0 |
ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
{
pll_value_t pll;
unsigned int uiActualPixelClk;
pll.inputFreq = DEFAULT_INPUT_CLOCK;
pll.clockType = clock;
uiActualPixelClk = calcPllValue(parm->pixel_clock, &pll);
if (getChipType() == SM750LE) {
/* set graphic mode via IO method */
outb_p(0x88, 0x3d4);
outb_p(0x06, 0x3d5);
}
programModeRegisters(parm, &pll);
return 0;
} | false | false | false | false | false | 0 |
mprAddKey(MprHash *hash, cvoid *key, cvoid *ptr)
{
MprKey *sp, *prevSp;
int index;
if (hash == 0) {
mprAssert(hash);
return 0;
}
lock(hash);
sp = lookupHash(&index, &prevSp, hash, key);
if (sp != 0) {
/*
Already exists. Just update the data.
*/
sp->data = ptr;
unlock(hash);
return sp;
}
/*
Hash entries are managed by manageHashTable
*/
if ((sp = mprAllocStruct(MprKey)) == 0) {
unlock(hash);
return 0;
}
sp->data = ptr;
if (!(hash->flags & MPR_HASH_STATIC_KEYS)) {
sp->key = dupKey(hash, sp, key);
} else {
sp->key = (void*) key;
}
sp->bucket = index;
sp->next = hash->buckets[index];
hash->buckets[index] = sp;
hash->length++;
unlock(hash);
return sp;
} | false | false | false | false | false | 0 |
has_mate_threat(Color c) {
UndoInfo u1, u2;
Color stm = this->side_to_move();
// The following lines are useless and silly, but prevents gcc from
// emitting a stupid warning stating that u1.lastMove and u1.epSquare might
// be used uninitialized.
u1.lastMove = lastMove;
u1.epSquare = epSquare;
if(this->is_check())
return false;
// If the input color is not equal to the side to move, do a null move
if(c != stm) this->do_null_move(u1);
MoveStack mlist[120];
int count;
bool result = false;
// Generate legal moves
count = generate_legal_moves(*this, mlist);
// Loop through the moves, and see if one of them is mate.
for(int i = 0; i < count; i++) {
this->do_move(mlist[i].move, u2);
if(this->is_mate()) result = true;
this->undo_move(mlist[i].move, u2);
}
// Undo null move, if necessary
if(c != stm) this->undo_null_move(u1);
return result;
} | false | false | false | false | false | 0 |
unblockJobs()
{
// WORKAROUND: Queue an empty job to force ThreadWeaver to awaken threads
if (searchJobs.isEmpty() && Weaver::instance()->isIdle()) {
qDeleteAll(oldSearchJobs);
oldSearchJobs.clear();
checkTearDown();
return;
}
DummyJob *dummy = new DummyJob(q);
Weaver::instance()->enqueue(dummy);
QObject::connect(dummy, SIGNAL(done(ThreadWeaver::Job*)), dummy, SLOT(deleteLater()));
} | false | false | false | false | false | 0 |
gausselim(bmp)
BMDATA *bmp;
{
word2 *v, *vect, *vectb, *piv;
unsigned pivot, minc;
int i;
int vn, v2n, baslen;
size_t rk;
minc = bmp->matinc;
rk = bmp->rank;
vn = bmp->vlen;
v2n = 2*vn;
baslen = bmp->baslen;
vect = bmp->bitmat + rk * minc;
vectb = vect + vn;
setarr(vectb,vn,0);
setbit(vectb,rk);
v = bmp->bitmat;
piv = bmp->piv;
for(i=0; i<rk; i++) {
pivot = piv[i];
if(testbit(vect,pivot))
xorarr(vect,v2n,v);
v += minc;
}
for(i=0; i<vn; i++) {
if(vect[i])
break;
}
if(i == vn)
return(1); /* then vect is identically zero */
/* find new pivot */
for(i=rk; i<=baslen; i++) {
pivot = piv[i];
if(testbit(vect,pivot)) {
piv[i] = piv[rk];
piv[rk] = pivot;
break;
}
}
bmp->rank = rk + 1;
return(0);
} | false | false | false | false | false | 0 |
basic_authorization_field(const char* user, const char* pass) {
if(!user&& !pass)
return 0;
String combined;
if(user)
combined<<user;
combined<<":";
if(pass)
combined<<pass;
String* result=new String("Basic ");
*result<<pa_base64_encode(combined.cstr(), combined.length());
return result;
} | false | false | false | false | false | 0 |
CompileFile(const string& f, const string& untilPro, bool searchForPro)
{
ifstream in(f.c_str());
if( !in) return false; // maybe throw exception here
RefDNode theAST;
try {
GDLLexer lexer(in, f, GDLParser::NONE, untilPro, searchForPro);
GDLParser& parser=lexer.Parser();
// parsing
parser.translation_unit();
theAST=parser.getAST();
if( !theAST)
{
cout << "No parser output generated." << endl;
return false;
}
}
catch( GDLException e)
{
ReportCompileError( e, f);
return false;
}
catch( ANTLRException e)
{
cerr << "Lexer/Parser exception: " << e.getMessage() << endl;
return false;
}
#ifdef GDL_DEBUG
cout << "Parser output:" << endl;
antlr::print_tree pt;
pt.pr_tree(static_cast<antlr::RefAST>(theAST));
cout << "CompileFile: Parser end." << endl;
#endif
#ifdef GDL_DEBUG
RefDNode trAST;
#endif
GDLTreeParser treeParser( f, untilPro);
try
{
treeParser.translation_unit(theAST);
// #ifdef GDL_DEBUG
// nothing is returned (pro/funList are changed)
// trAST=treeParser.getAST();
// #endif
if( treeParser.ActiveProCompiled()) RetAll();
}
catch( GDLException e)
{
ReportCompileError( e, f);
if( treeParser.ActiveProCompiled()) RetAll();
return false;
}
catch( ANTLRException e)
{
cerr << "Compiler exception: " << e.getMessage() << endl;
if( treeParser.ActiveProCompiled()) RetAll();
return false;
}
// #ifdef GDL_DEBUG
// cout << "Tree parser output:" << endl;
// pt.pr_tree(static_cast<antlr::RefAST>(trAST));
// cout << "ExecuteLine: Tree parser end." << endl;
// #endif
/*#ifdef GDL_DEBUG
cout << "Tree parser output:" << endl;
antlr::print_tree ptTP;
ptTP.pr_tree(static_cast<antlr::RefAST>(trAST));
cout << "CompileFile: Tree parser end." << endl;
#endif*/
return true;
} | false | false | false | false | false | 0 |
carl9170_unregister_hwrng(struct ar9170 *ar)
{
if (ar->rng.initialized) {
hwrng_unregister(&ar->rng.rng);
ar->rng.initialized = false;
}
} | false | false | false | false | false | 0 |
ptn3460_select_edid(struct ptn3460_bridge *ptn_bridge)
{
int ret;
char val;
/* Load the selected edid into SRAM (accessed at PTN3460_EDID_ADDR) */
ret = ptn3460_write_byte(ptn_bridge, PTN3460_EDID_SRAM_LOAD_ADDR,
ptn_bridge->edid_emulation);
if (ret) {
DRM_ERROR("Failed to transfer EDID to sram, ret=%d\n", ret);
return ret;
}
/* Enable EDID emulation and select the desired EDID */
val = 1 << PTN3460_EDID_ENABLE_EMULATION |
ptn_bridge->edid_emulation << PTN3460_EDID_EMULATION_SELECTION;
ret = ptn3460_write_byte(ptn_bridge, PTN3460_EDID_EMULATION_ADDR, val);
if (ret) {
DRM_ERROR("Failed to write EDID value, ret=%d\n", ret);
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
ink_comboboxentry_action_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
Ink_ComboBoxEntry_Action *action = INK_COMBOBOXENTRY_ACTION (object);
switch(property_id) {
case PROP_MODEL:
action->model = GTK_TREE_MODEL( g_value_get_object( value ));
break;
case PROP_COMBOBOX:
action->combobox = GTK_COMBO_BOX_ENTRY( g_value_get_object( value ));
break;
case PROP_ENTRY:
action->entry = GTK_ENTRY( g_value_get_object( value ));
break;
case PROP_ENTRY_WIDTH:
action->entry_width = g_value_get_int( value );
break;
case PROP_EXTRA_WIDTH:
action->extra_width = g_value_get_int( value );
break;
case PROP_CELL_DATA_FUNC:
action->cell_data_func = g_value_get_pointer( value );
break;
case PROP_POPUP:
action->popup = g_value_get_boolean( value );
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
} | false | false | false | false | false | 0 |
jabber_params_split(const char *line, int allow_empty)
{
char **arr, **ret = NULL;
int num = 0, i = 0, z = 0;
if (!line)
return NULL;
arr = array_make(line, " ", 0, 1, 1);
while (arr[i]) {
ret = (char **)xrealloc (ret, (num + 2)*sizeof (char *));
if (!z) {
if (arr[i][0] == '-' && arr[i][1] == '-' && xstrlen(arr[i]) > 2)
ret[num++] = xstrdup (arr[i]+2);
else if (allow_empty) {
ret[num++] = xstrdup("");
} else {
array_free (arr);
ret[num] = NULL;
array_free (ret);
return NULL;
//ret[num++] = xstrdup ("");
}
i++;
} else {
// this is the name of next param, so use "" as value and
// do not increment i, so we'll parse it in next loop
if (arr[i][0] == '-' && arr[i][1] == '-' && xstrlen(arr[i]) > 2)
ret[num++] = xstrdup("");
else {
ret[num++] = xstrdup(arr[i]);
i++;
}
}
z^=1;
}
// if the last is --param
if (z) {
ret = (char **)xrealloc (ret, (num + 2)*sizeof (char *));
ret[num++] = xstrdup("");
}
ret [num] = NULL;
array_free (arr);
i = 0;
while (ret[i]) {
debug (" *[%d]* %s\n", i, ret[i]);
i++;
}
return ret;
} | false | false | false | false | false | 0 |
firstattr(Agedge_t *e)
{
Agraph_t *g;
if (!e)
return NULL;
g = agraphof(agtail(e));
return agnxtattr(g,AGEDGE,NULL);
} | false | false | false | false | false | 0 |
_pullBinPointAdd(pullContext *pctx, pullBin *bin, pullPoint *point) {
static const char me[]="_pullBinPointAdd";
int pntI;
pullPtrPtrUnion pppu;
AIR_UNUSED(pctx);
if (!(bin->pointArr)) {
pppu.points = &(bin->point);
bin->pointArr = airArrayNew(pppu.v, &(bin->pointNum),
sizeof(pullPoint *), _PULL_BIN_INCR);
if (!( bin->pointArr )) {
biffAddf(PULL, "%s: couldn't create point array", me);
return 1;
}
}
if (!( bin->neighBin )) {
/* set up neighbor bin vector if not done so already */
if (_pullBinNeighborSet(pctx, bin)) {
biffAddf(PULL, "%s: couldn't initialize neighbor bins", me);
return 1;
}
}
pntI = airArrayLenIncr(bin->pointArr, 1);
bin->point[pntI] = point;
return 0;
} | false | false | false | false | false | 0 |
totem_pl_item_free (gpointer data, gpointer user_data)
{
TotemPlItem *item = (TotemPlItem *) data;
if (!item)
return;
g_free (item->uri);
g_free (item->title);
g_free (item->subtitle);
g_slice_free (TotemPlItem, item);
} | false | false | false | false | false | 0 |
sshv2_buffer_get_string (gftp_request * request, sshv2_message * message,
int return_string)
{
guint32 len, buflen;
char *string;
if (sshv2_buffer_get_int32 (request, message, 0, 0, &len) < 0)
return (NULL);
buflen = message->end - message->pos;
if (len > SSH_MAX_STRING_SIZE || (buflen < len))
{
sshv2_wrong_response (request, message);
return (NULL);
}
if (return_string)
{
string = g_malloc0 (len + 1);
memcpy (string, message->pos, len);
string[len] = '\0';
}
else
string = NULL;
message->pos += len;
return (string);
} | false | false | false | false | false | 0 |
setComposite(UChar32 composite, int32_t combMarkIndex) {
fArray[fLastStarterIndex]=composite<<8;
// Remove the combining mark that contributed to the composite.
--fLength;
while(combMarkIndex<fLength) {
fArray[combMarkIndex]=fArray[combMarkIndex+1];
++combMarkIndex;
}
} | false | false | false | false | false | 0 |
setInitialSize() {
double w = m_modelPart->localProp("width").toDouble();
if (w == 0) {
// set the size so the infoGraphicsView will display the size as you drag
modelPart()->setLocalProp("width", 25.4 * OriginalWidth / GraphicsUtils::StandardFritzingDPI);
modelPart()->setLocalProp("height", 25.4 * OriginalHeight / GraphicsUtils::StandardFritzingDPI);
}
} | false | false | false | false | false | 0 |
__ecereMethod_OptionBox_UnsetOption(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Instance * options)
{
struct OptionBox * __ecerePointer_OptionBox = (struct OptionBox *)(this ? (((char *)this) + __ecereClass_OptionBox->offset) : 0);
uint64 value = (uint64)0;
(memcpy((uint64 *)((unsigned char *)options + __ecerePointer_OptionBox->option), (char *)(((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 1) ? value : ((char *)&value + __ENDIAN_PAD((((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 1 || ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 0 || ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 5) ? sizeof(void *) : ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->typeSize)), (((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 0 || ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->type == 5) ? sizeof(void *) : ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].dataTypeClass->typeSize));
} | false | false | false | true | true | 1 |
rerere_remaining(struct string_list *merge_rr)
{
int i;
if (read_cache() < 0)
return error("Could not read index");
for (i = 0; i < active_nr;) {
int conflict_type;
struct cache_entry *e = active_cache[i];
i = check_one_conflict(i, &conflict_type);
if (conflict_type == PUNTED)
string_list_insert(merge_rr, (const char *)e->name);
else if (conflict_type == RESOLVED) {
struct string_list_item *it;
it = string_list_lookup(merge_rr, (const char *)e->name);
if (it != NULL) {
free(it->util);
it->util = RERERE_RESOLVED;
}
}
}
return 0;
} | false | false | false | false | false | 0 |
defendel(struct Global *global,
char *name,
int delete) /* TRUE to delete a symbol */
{
/*
* Enter this name in the lookup table (delete = FALSE)
* or delete this name (delete = TRUE).
* Returns a pointer to the define block (delete = FALSE)
* Returns NULL if the symbol wasn't defined (delete = TRUE).
*/
DEFBUF *dp;
DEFBUF **prevp;
char *np;
int nhash;
int temp;
int size;
for (nhash = 0, np = name; *np != EOS;)
nhash += *np++;
size = (np - name);
nhash += size;
prevp = &global->symtab[nhash % SBSIZE];
while ((dp = *prevp) != (DEFBUF *) NULL) {
if (dp->hash == nhash
&& (temp = strcmp(dp->name, name)) >= 0) {
if (temp > 0)
dp = NULL; /* Not found */
else {
*prevp = dp->link; /* Found, unlink and */
if (dp->repl != NULL) /* Free the replacement */
Freemem(dp->repl); /* if any, and then */
Freemem((char *) dp); /* Free the symbol */
}
break;
}
prevp = &dp->link;
}
if (!delete) {
dp = (DEFBUF *) Getmem(global, (int) (sizeof (DEFBUF) + size));
dp->link = *prevp;
*prevp = dp;
dp->hash = nhash;
dp->repl = NULL;
dp->nargs = 0;
strcpy(dp->name, name);
}
return(dp);
} | false | false | false | false | false | 0 |
operator==(const Collator& that) const
{
/* only checks for address equals here */
if (Collator::operator==(that))
return TRUE;
if (getDynamicClassID() != that.getDynamicClassID())
return FALSE; /* not the same class */
RuleBasedCollator& thatAlias = (RuleBasedCollator&)that;
// weiv: use C function, commented code below is wrong
return ucol_equals(this->ucollator, thatAlias.ucollator);
/*
synwee : orginal code does not check for data compatibility
*/
/*
if (ucollator != thatAlias.ucollator)
return FALSE;
return TRUE;
*/
} | false | false | false | false | false | 0 |
fh_decomp_raw(const unfs3_fh_t * fh)
{
int rec = 0;
static char result[NFS_MAXPATHLEN];
/* valid fh? */
if (!fh)
return NULL;
/* special case for root directory */
if (fh->len == 0)
return "/";
rec = fh_rec(fh, 0, "/", result);
if (rec)
return result;
/* could not find object */
return NULL;
} | false | false | false | false | false | 0 |
do_diagonale(rect_tab, nb_rect, xtab, ytab)
rect_t rect_tab[];
type_l nb_rect;
long xtab[], ytab[];
{
register int i, j;
register coord_t *tab;
tab = (coord_t * )malloc(nb_rect * 2 * sizeof(coord_t));
if (tab == (coord_t * )NULL) {
ruterror( RDS_NOT_ENOUGH_MEMORY, "do_diagonale");
return((coord_t * )NULL);
}
for (i = 0; i < nb_rect; i++) {
j = 2 * i;
tab[j].X = xtab[rect_tab[i].r_g];
tab[j].Y = ytab[rect_tab[i].r_b];
tab[j+1].X = xtab[rect_tab[i].r_d];
tab[j+1].Y = ytab[rect_tab[i].r_h];
}
return(tab);
} | false | false | false | false | false | 0 |
isDynamicAlloca(AllocaInst &AI) const {
return AI.isArrayAllocation() || !AI.isStaticAlloca();
} | false | false | false | false | false | 0 |
parse_option (int key, char *arg, struct argp_state *state)
{
char *endp;
switch (key)
{
case 's':
endp = strchr (arg, ':');
if (endp == NULL)
/* No specific database, change them all. */
for (int i = 0; databases[i].name != NULL; ++i)
__nss_configure_lookup (databases[i].name, arg);
else
{
int i;
for (i = 0; databases[i].name != NULL; ++i)
if (strncmp (databases[i].name, arg, endp - arg) == 0)
{
__nss_configure_lookup (databases[i].name, endp + 1);
break;
}
if (databases[i].name == NULL)
error (EXIT_FAILURE, 0, gettext ("Unknown database name"));
}
break;
case 'i':
idn_flags = 0;
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
} | false | false | false | false | false | 0 |
at76_ledtrig_tx_timerfunc(unsigned long data)
{
static int tx_lastactivity;
if (tx_lastactivity != tx_activity) {
tx_lastactivity = tx_activity;
led_trigger_event(ledtrig_tx, LED_FULL);
mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
} else
led_trigger_event(ledtrig_tx, LED_OFF);
} | false | false | false | false | false | 0 |
tomoyo_parse_name_union(struct tomoyo_acl_param *param,
struct tomoyo_name_union *ptr)
{
char *filename;
if (param->data[0] == '@') {
param->data++;
ptr->group = tomoyo_get_group(param, TOMOYO_PATH_GROUP);
return ptr->group != NULL;
}
filename = tomoyo_read_token(param);
if (!tomoyo_correct_word(filename))
return false;
ptr->filename = tomoyo_get_name(filename);
return ptr->filename != NULL;
} | false | false | false | false | false | 0 |
cursor_home()
{
Gtk::TextIter it = get_buffer()->get_insert()->get_iter();
it.set_line_offset( 0 );
get_buffer()->place_cursor( it );
} | false | false | false | false | false | 0 |
exo_icon_view_real_activate_cursor_item (ExoIconView *icon_view)
{
GtkTreePath *path;
GtkCellRendererMode mode;
ExoIconViewCellInfo *info = NULL;
if (!icon_view->priv->cursor_item)
return FALSE;
info = g_list_nth_data (icon_view->priv->cell_list,
icon_view->priv->cursor_cell);
if (info)
{
g_object_get (info->cell, "mode", &mode, NULL);
if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
{
exo_icon_view_item_activate_cell (icon_view,
icon_view->priv->cursor_item,
info, NULL);
return TRUE;
}
else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
{
exo_icon_view_start_editing (icon_view,
icon_view->priv->cursor_item,
info, NULL);
return TRUE;
}
}
path = gtk_tree_path_new_from_indices (g_list_index (icon_view->priv->items, icon_view->priv->cursor_item), -1);
exo_icon_view_item_activated (icon_view, path);
gtk_tree_path_free (path);
return TRUE;
} | false | false | false | false | false | 0 |
tx_start(struct slgt_info *info)
{
if (!info->tx_enabled) {
wr_reg16(info, TCR,
(unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2));
info->tx_enabled = true;
}
if (desc_count(info->tbufs[info->tbuf_start])) {
info->drop_rts_on_tx_done = false;
if (info->params.mode != MGSL_MODE_ASYNC) {
if (info->params.flags & HDLC_FLAG_AUTO_RTS) {
get_signals(info);
if (!(info->signals & SerialSignal_RTS)) {
info->signals |= SerialSignal_RTS;
set_signals(info);
info->drop_rts_on_tx_done = true;
}
}
slgt_irq_off(info, IRQ_TXDATA);
slgt_irq_on(info, IRQ_TXUNDER + IRQ_TXIDLE);
/* clear tx idle and underrun status bits */
wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER));
} else {
slgt_irq_off(info, IRQ_TXDATA);
slgt_irq_on(info, IRQ_TXIDLE);
/* clear tx idle status bit */
wr_reg16(info, SSR, IRQ_TXIDLE);
}
/* set 1st descriptor address and start DMA */
wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc);
wr_reg32(info, TDCSR, BIT2 + BIT0);
info->tx_active = true;
}
} | false | false | false | false | false | 0 |
r128_get_line(struct r128_ctx *ctx, struct r128_image *im, int line, int rotation)
{
int min_len = ctx->min_len, max_gap = ctx->max_gap;
u_int8_t *data;
int len, start = 0, pixmult;
struct r128_line *linetab = im->lines;
if(rotation & 1) linetab += im->height;
if(linetab[line].offset != 0xffffffff) return &linetab[line];
data = im->gray_data;
if(rotation & 1)
{
/* Vertical line */
start = line;
len = im->height;
pixmult = im->width;
}
else
{
/* Horizontal line */
start = line * im->width;
len = im->width;
pixmult = 1;
}
if((min_len >= max_gap) && (!(ctx->flags & R128_FL_NOCROP)))
{
int prev_so_far = R128_MARGIN_CLASS(ctx, data[(min_len - max_gap) * pixmult]);
int so_far, gap;
/* Left margin */
for(gap = 1; prev_so_far && (gap + min_len - max_gap)<len; prev_so_far = so_far, gap++)
if((so_far = R128_MARGIN_CLASS(ctx, data[start + (gap + min_len - max_gap) * pixmult])) != prev_so_far)
break;
/* Indeed a gap! */
if(gap > max_gap)
{
gap += min_len - max_gap;
start += gap * pixmult;
len -= gap;
}
/* Right margin */
if(len > min_len)
{
prev_so_far = R128_MARGIN_CLASS(ctx, data[start + (len - min_len + max_gap) * pixmult]);
for(gap = 1; prev_so_far && start + (len - gap - min_len + max_gap) * pixmult >= 0; prev_so_far = so_far, gap++)
{
if((so_far = R128_MARGIN_CLASS(ctx, data[start + (len - gap - min_len + max_gap) * pixmult])) != prev_so_far)
break;
}
/* Indeed a gap! */
if(gap > max_gap)
len -= gap;
}
}
if(len < min_len) len = 0;
r128_log(ctx, R128_DEBUG2, "Prepared line %d of %s %simage %s: start = %d, len = %d\n", line, im->root ? "blurred " : "",
(rotation & 1) ? "rotated " : "",
im->root ? im->root->filename : im->filename, start, len);
linetab[line].offset = start;
linetab[line].linesize = len;
return &linetab[line];
} | false | false | false | false | false | 0 |
DefaultOpenEDB( std::string filename, std::string access )
{
// it would be nice to be able to pass in an appropriate PCIDSKInterface!
PCIDSKFile *file = PCIDSK::Open( filename, access, NULL );
return new PCIDSK_EDBFile( file );
} | false | false | false | false | false | 0 |
add_action( const string & action_name,
const string & result,
const string & timestamp,
const string & content )
{
remove_action( action_name );
xml::element_ptr action( new xml::element(action_name) );
m_root->elements.push_back( action );
action->attributes.push_back( xml::attribute( "result", result ) );
action->attributes.push_back( xml::attribute( "timestamp", timestamp ) );
action->content = content;
}
} | false | false | false | false | false | 0 |
rtl2832u_frontend_callback(void *adapter_priv, int component,
int cmd, int arg)
{
struct i2c_adapter *adapter = adapter_priv;
struct device *parent = adapter->dev.parent;
struct i2c_adapter *parent_adapter;
struct dvb_usb_device *d;
struct rtl28xxu_dev *dev;
/*
* All tuners are connected to demod muxed I2C adapter. We have to
* resolve its parent adapter in order to get handle for this driver
* private data. That is a bit hackish solution, GPIO or direct driver
* callback would be better...
*/
if (parent != NULL && parent->type == &i2c_adapter_type)
parent_adapter = to_i2c_adapter(parent);
else
return -EINVAL;
d = i2c_get_adapdata(parent_adapter);
dev = d->priv;
dev_dbg(&d->intf->dev, "component=%d cmd=%d arg=%d\n",
component, cmd, arg);
switch (component) {
case DVB_FRONTEND_COMPONENT_TUNER:
switch (dev->tuner) {
case TUNER_RTL2832_FC0012:
return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
case TUNER_RTL2832_TUA9001:
return rtl2832u_tua9001_tuner_callback(d, cmd, arg);
}
}
return 0;
} | false | false | false | false | false | 0 |
ksDel(KeySet *ks)
{
int rc;
if (!ks) return -1;
rc=ksClose(ks);
kdbiFree(ks);
return rc;
} | false | false | false | false | false | 0 |
blk_alloc_in_rg(struct gfs2_sbd *sdp, unsigned int type, struct rgrp_tree *rl, uint64_t *blkno)
{
struct gfs2_rindex *ri;
struct gfs2_rgrp *rg;
unsigned int block, bn = 0, x = 0, y = 0;
unsigned int state;
unsigned int release = 0;
struct gfs2_buffer_head *bh;
if (rl == NULL || rl->rg.rg_free == 0) {
errno = ENOSPC;
return -1;
}
if (rl->bh[0] == NULL) {
if (gfs2_rgrp_read(sdp, rl) != 0)
return -1;
release = 1;
}
ri = &rl->ri;
rg = &rl->rg;
for (block = 0; block < ri->ri_length; block++) {
bh = rl->bh[block];
x = (block) ? sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_rgrp);
for (; x < sdp->bsize; x++)
for (y = 0; y < GFS2_NBBY; y++) {
state = (bh->b_data[x] >> (GFS2_BIT_SIZE * y)) & 0x03;
if (state == GFS2_BLKST_FREE)
goto found;
bn++;
}
}
fprintf(stderr, "allocation is broken (1): %"PRIu64" %u\n",
(uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
goto out_err;
found:
if (bn >= ri->ri_bitbytes * GFS2_NBBY) {
fprintf(stderr, "allocation is broken (2): bn: %u %u rgrp: %"PRIu64
" (0x%" PRIx64 ") Free:%u\n",
bn, ri->ri_bitbytes * GFS2_NBBY, (uint64_t)rl->ri.ri_addr,
(uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
goto out_err;
}
switch (type) {
case DATA:
case META:
state = GFS2_BLKST_USED;
break;
case DINODE:
state = GFS2_BLKST_DINODE;
rg->rg_dinodes++;
break;
default:
fprintf(stderr, "bad state\n");
goto out_err;
}
bh->b_data[x] &= ~(0x03 << (GFS2_BIT_SIZE * y));
bh->b_data[x] |= state << (GFS2_BIT_SIZE * y);
rg->rg_free--;
bmodified(bh);
if (sdp->gfs1)
gfs_rgrp_out((struct gfs_rgrp *)rg, rl->bh[0]);
else
gfs2_rgrp_out_bh(rg, rl->bh[0]);
sdp->blks_alloced++;
*blkno = ri->ri_data0 + bn;
if (release)
gfs2_rgrp_relse(rl);
return 0;
out_err:
if (release)
gfs2_rgrp_relse(rl);
return -1;
} | false | false | false | false | false | 0 |
CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,
bool allow_system_table_mods)
{
int i;
int j;
int natts = tupdesc->natts;
/* Sanity check on column count */
if (natts < 0 || natts > MaxHeapAttributeNumber)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_COLUMNS),
errmsg("tables can have at most %d columns",
MaxHeapAttributeNumber)));
/*
* first check for collision with system attribute names
*
* Skip this for a view or type relation, since those don't have system
* attributes.
*/
if (relkind != RELKIND_VIEW && relkind != RELKIND_COMPOSITE_TYPE)
{
for (i = 0; i < natts; i++)
{
if (SystemAttributeByName(NameStr(tupdesc->attrs[i]->attname),
tupdesc->tdhasoid) != NULL)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column name \"%s\" conflicts with a system column name",
NameStr(tupdesc->attrs[i]->attname))));
}
}
/*
* next check for repeated attribute names
*/
for (i = 1; i < natts; i++)
{
for (j = 0; j < i; j++)
{
if (strcmp(NameStr(tupdesc->attrs[j]->attname),
NameStr(tupdesc->attrs[i]->attname)) == 0)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column name \"%s\" specified more than once",
NameStr(tupdesc->attrs[j]->attname))));
}
}
/*
* next check the attribute types
*/
for (i = 0; i < natts; i++)
{
CheckAttributeType(NameStr(tupdesc->attrs[i]->attname),
tupdesc->attrs[i]->atttypid,
allow_system_table_mods);
}
} | false | false | false | false | false | 0 |
DES_InitContext(DESContext *cx, const unsigned char *key, unsigned int keylen,
const unsigned char *iv, int mode, unsigned int encrypt,
unsigned int unused)
{
DESDirection opposite;
if (!cx) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
cx->direction = encrypt ? DES_ENCRYPT : DES_DECRYPT;
opposite = encrypt ? DES_DECRYPT : DES_ENCRYPT;
switch (mode) {
case NSS_DES: /* DES ECB */
DES_MakeSchedule( cx->ks0, key, cx->direction);
cx->worker = &DES_ECB;
break;
case NSS_DES_EDE3: /* DES EDE ECB */
cx->worker = &DES_EDE3_ECB;
if (encrypt) {
DES_MakeSchedule(cx->ks0, key, cx->direction);
DES_MakeSchedule(cx->ks1, key + 8, opposite);
DES_MakeSchedule(cx->ks2, key + 16, cx->direction);
} else {
DES_MakeSchedule(cx->ks2, key, cx->direction);
DES_MakeSchedule(cx->ks1, key + 8, opposite);
DES_MakeSchedule(cx->ks0, key + 16, cx->direction);
}
break;
case NSS_DES_CBC: /* DES CBC */
COPY8BTOHALF(cx->iv, iv);
cx->worker = encrypt ? &DES_CBCEn : &DES_CBCDe;
DES_MakeSchedule(cx->ks0, key, cx->direction);
break;
case NSS_DES_EDE3_CBC: /* DES EDE CBC */
COPY8BTOHALF(cx->iv, iv);
if (encrypt) {
cx->worker = &DES_EDE3CBCEn;
DES_MakeSchedule(cx->ks0, key, cx->direction);
DES_MakeSchedule(cx->ks1, key + 8, opposite);
DES_MakeSchedule(cx->ks2, key + 16, cx->direction);
} else {
cx->worker = &DES_EDE3CBCDe;
DES_MakeSchedule(cx->ks2, key, cx->direction);
DES_MakeSchedule(cx->ks1, key + 8, opposite);
DES_MakeSchedule(cx->ks0, key + 16, cx->direction);
}
break;
default:
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
return SECSuccess;
} | false | false | false | false | false | 0 |
FoldAll(int action) {
pdoc->EnsureStyledTo(pdoc->Length());
int maxLine = pdoc->LinesTotal();
bool expanding = action == SC_FOLDACTION_EXPAND;
if (action == SC_FOLDACTION_TOGGLE) {
// Discover current state
for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) {
if (pdoc->GetLevel(lineSeek) & SC_FOLDLEVELHEADERFLAG) {
expanding = !cs.GetExpanded(lineSeek);
break;
}
}
}
if (expanding) {
cs.SetVisible(0, maxLine-1, true);
for (int line = 0; line < maxLine; line++) {
int levelLine = pdoc->GetLevel(line);
if (levelLine & SC_FOLDLEVELHEADERFLAG) {
SetFoldExpanded(line, true);
}
}
} else {
for (int line = 0; line < maxLine; line++) {
int level = pdoc->GetLevel(line);
if ((level & SC_FOLDLEVELHEADERFLAG) &&
(SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) {
SetFoldExpanded(line, false);
int lineMaxSubord = pdoc->GetLastChild(line, -1);
if (lineMaxSubord > line) {
cs.SetVisible(line + 1, lineMaxSubord, false);
}
}
}
}
SetScrollBars();
Redraw();
} | false | false | false | false | false | 0 |
ReadGeometryVertexDeclaration(VertexData *dest)
{
if (!AtEnd())
{
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_GEOMETRY_VERTEX_ELEMENT)
{
ReadGeometryVertexElement(dest);
if (!AtEnd())
id = ReadHeader();
}
if (!AtEnd())
RollbackHeader();
}
} | false | false | false | false | false | 0 |
initMemOFile(OFile *fp, char *s, int len)
{
fp->fp = 0;
fp->s = s;
fp->len = 0;
fp->limit = s?len:0;
fp->alloc = s?0:1;
fp->fail = 0;
} | false | false | false | false | false | 0 |
gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view,
Account *account)
{
GtkTreeModel *model, *f_model, *s_model;
GtkTreePath *path, *f_path, *s_path, *parent_path;
GtkTreeSelection *selection;
ENTER("view %p, account %p (%s)", view,
account, xaccAccountGetName (account));
g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
/* Clear any existing selection. */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
gtk_tree_selection_unselect_all (selection);
if (account == NULL)
return;
s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
path = gnc_tree_model_account_get_path_from_account (
GNC_TREE_MODEL_ACCOUNT(model), account);
if (path == NULL)
{
LEAVE("no path");
return;
}
debug_path(DEBUG, path);
f_path = gtk_tree_model_filter_convert_child_path_to_path (
GTK_TREE_MODEL_FILTER (f_model), path);
gtk_tree_path_free(path);
if (f_path == NULL)
{
LEAVE("no filter path");
return;
}
debug_path(DEBUG, f_path);
s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
f_path);
gtk_tree_path_free(f_path);
if (s_path == NULL)
{
LEAVE("no sort path");
return;
}
/* gtk_tree_view requires that a row be visible before it can be selected */
parent_path = gtk_tree_path_copy (s_path);
if (gtk_tree_path_up (parent_path))
{
/* This function is misnamed. It expands the actual item
* specified, not the path to the item specified. I.E. It expands
* one level too many, thus the get of the parent. */
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
}
gtk_tree_path_free(parent_path);
gtk_tree_selection_select_path (selection, s_path);
/* give gtk+ a chance to resize the tree view first by handling pending
* configure events */
while (gtk_events_pending ())
gtk_main_iteration ();
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
debug_path(LEAVE, s_path);
gtk_tree_path_free(s_path);
} | false | false | false | false | false | 0 |
ajCvtSposToPosStart(size_t len, size_t imin, ajlong ipos)
{
ajlong jpos;
ajlong jmin = imin;
ajlong jlen = len;
if(ipos < 0)
jpos = len + ipos;
else
jpos = ipos;
if(jpos >= jlen)
jpos = len - 1;
if(jpos < jmin)
jpos = imin;
return (size_t) jpos;
} | false | false | false | false | false | 0 |
cmdlookup(const char *name, int add)
{
unsigned int hashval;
const char *p;
struct tblentry *cmdp;
struct tblentry **pp;
p = name;
hashval = (unsigned char)*p << 4;
while (*p)
hashval += (unsigned char)*p++;
hashval &= 0x7FFF;
pp = &cmdtable[hashval % CMDTABLESIZE];
for (cmdp = *pp; cmdp; cmdp = cmdp->next) {
if (strcmp(cmdp->cmdname, name) == 0)
break;
pp = &cmdp->next;
}
if (add && cmdp == NULL) {
cmdp = *pp = ckzalloc(sizeof(struct tblentry)
+ strlen(name)
/* + 1 - already done because
* tblentry::cmdname is char[1] */);
/*cmdp->next = NULL; - ckzalloc did it */
cmdp->cmdtype = CMDUNKNOWN;
strcpy(cmdp->cmdname, name);
}
lastcmdentry = pp;
return cmdp;
} | false | false | false | false | false | 0 |
ext4_expand_extra_isize(struct inode *inode,
unsigned int new_extra_isize,
struct ext4_iloc iloc,
handle_t *handle)
{
struct ext4_inode *raw_inode;
struct ext4_xattr_ibody_header *header;
if (EXT4_I(inode)->i_extra_isize >= new_extra_isize)
return 0;
raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
/* No extended attributes present */
if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) {
memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
EXT4_I(inode)->i_extra_isize, 0,
new_extra_isize - EXT4_I(inode)->i_extra_isize);
EXT4_I(inode)->i_extra_isize = new_extra_isize;
return 0;
}
/* try to expand with EAs present */
return ext4_expand_extra_isize_ea(inode, new_extra_isize,
raw_inode, handle);
} | false | false | false | false | false | 0 |
PyFF_Glyph_get_verticalComponents(PyFF_Glyph *self,void *closure) {
if ( self->sc->vert_variants==0 || self->sc->vert_variants->part_cnt==0 )
Py_RETURN_NONE;
return( BuildComponentTuple(self->sc->vert_variants ));
} | false | false | false | false | false | 0 |
handle_sigchld( int sig )
{
const int oerrno = errno;
pid_t pid;
int status;
#ifndef HAVE_SIGSET
/* Set up handler again. */
(void) signal( SIGCHLD, handle_sigchld );
#endif /* ! HAVE_SIGSET */
/* Reap defunct children until there aren't any more. */
for (;;)
{
#ifdef HAVE_WAITPID
pid = waitpid( (pid_t) -1, &status, WNOHANG );
#else /* HAVE_WAITPID */
pid = wait3( &status, WNOHANG, (struct rusage*) 0 );
#endif /* HAVE_WAITPID */
if ( (int) pid == 0 ) /* none left */
break;
if ( (int) pid < 0 )
{
if ( errno == EINTR || errno == EAGAIN )
continue;
/* ECHILD shouldn't happen with the WNOHANG option,
** but with some kernels it does anyway. Ignore it.
*/
if ( errno != ECHILD )
{
syslog( LOG_ERR, "child wait - %m" );
perror( "child wait" );
}
break;
}
}
/* Restore previous errno. */
errno = oerrno;
} | false | false | false | false | false | 0 |
FindFirstMap() {
ASSERT(is_inline_cache_stub());
AssertNoAllocation no_allocation;
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(this, mask); !it.done(); it.next()) {
RelocInfo* info = it.rinfo();
Object* object = info->target_object();
if (object->IsMap()) return Map::cast(object);
}
return NULL;
} | false | false | false | false | false | 0 |
roken_gethostbyaddr(const void *addr, size_t len, int type)
{
struct in_addr a;
const char *p;
struct hostent *he;
he = gethostbyaddr(addr, len, type);
if(he)
return he;
if(type != AF_INET || len != 4)
return NULL;
p = addr;
a.s_addr = htonl((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
return roken_gethostby(inet_ntoa(a));
} | false | false | false | false | false | 0 |
gst_audio_rate_change_state (GstElement * element, GstStateChange transition)
{
GstAudioRate *audiorate = GST_AUDIO_RATE (element);
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
audiorate->in = 0;
audiorate->out = 0;
audiorate->drop = 0;
audiorate->add = 0;
gst_audio_info_init (&audiorate->info);
gst_audio_rate_reset (audiorate);
break;
default:
break;
}
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
} | false | false | false | false | false | 0 |
redrawStackPlot()
{
if (showStack->isChecked()) {
// turn off display updates whilst we
// do this, it takes a while and is prone
// to screen flicker
stackFrame->setUpdatesEnabled(false);
// remove current plots - then recreate
resetStackedDatas();
// now they are all set, lets replot
foreach(AllPlot *plot, allPlots) plot->replot();
// we're done, go update the display now
stackFrame->setUpdatesEnabled(true);
}
} | false | false | false | false | false | 0 |
jmpBVC(machine_6502 *machine, m6502_AddrMode adm){
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
if (bitOff(machine->regP,OVERFLOW_FL))
jumpBranch(machine, ptr.addr);
} | false | false | false | false | false | 0 |
isConnectorColor(ViewLayer::ViewID m_viewID, const QColor & color) {
RatsnestColors * ratsnestColors = m_viewList.value(m_viewID, NULL);
if (ratsnestColors == NULL) return false;
foreach (RatsnestColor * ratsnestColor, ratsnestColors->m_ratsnestColorList) {
if (ratsnestColor->m_ratsnest == color) {
return (ratsnestColor->m_connectorNames.length() > 0);
}
}
return false;
} | false | false | false | false | false | 0 |
AddLODMapper(vtkMapper *mapper)
{
if (this->MediumMapper)
{
this->DeleteOwnLODs();
}
if (this->Mapper == NULL)
{
this->SetMapper(mapper);
}
this->LODMappers->AddItem(mapper);
} | false | false | false | false | false | 0 |
dump_child_devices(int length)
{
struct bdb_block *block;
struct bdb_child_devices *child_devs;
struct child_device_config *child;
int i;
block = find_section(BDB_CHILD_DEVICE_TABLE, length);
if (!block) {
printf("No child device table found\n");
return;
}
child_devs = block->data;
printf("Child devices block:\n");
for (i = 0; i < DEVICE_CHILD_SIZE; i++) {
child = &child_devs->children[i];
/* Skip nonexistent children */
if (!child->device_type)
continue;
printf("\tChild device %d\n", i);
printf("\t\tType: 0x%04x (%s)\n", child->device_type,
child_device_type(child->device_type));
printf("\t\tDVO port: 0x%02x\n", child->dvo_port);
printf("\t\tI2C pin: 0x%02x\n", child->i2c_pin);
printf("\t\tSlave addr: 0x%02x\n", child->slave_addr);
printf("\t\tDDC pin: 0x%02x\n", child->ddc_pin);
printf("\t\tDVO config: 0x%02x\n", child->dvo_cfg);
printf("\t\tDVO wiring: 0x%02x\n", child->dvo_wiring);
}
free(block);
} | false | false | false | false | false | 0 |
OutputFeatureWeightsForHypergraph(size_t index, const FeatureFunction* ff, std::ostream &outputSearchGraphStream)
{
size_t numScoreComps = ff->GetNumScoreComponents();
if (numScoreComps != ScoreProducer::unlimited) {
vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff);
if (numScoreComps > 1) {
for (size_t i = 0; i < numScoreComps; ++i) {
outputSearchGraphStream << ff->GetScoreProducerWeightShortName()
<< i
<< "=" << values[i] << endl;
}
} else {
outputSearchGraphStream << ff->GetScoreProducerWeightShortName()
<< "=" << values[0] << endl;
}
return index+numScoreComps;
} else {
cerr << "Sparse features are not yet supported when outputting hypergraph format" << endl;
assert(false);
return 0;
}
} | false | false | false | false | false | 0 |
octstr_case_nsearch(const Octstr *haystack, const Octstr *needle, long pos, long n)
{
long i, j;
int c1, c2;
seems_valid(haystack);
seems_valid(needle);
gw_assert(pos >= 0);
/* Always "find" an empty string */
if (needle->len == 0)
return 0;
for (i = pos; i <= haystack->len - needle->len && i < n; ++i) {
for (j = 0; j < needle->len && j < n; ++j) {
c1 = toupper(haystack->data[i + j]);
c2 = toupper(needle->data[j]);
if (c1 != c2)
break;
}
if (j == needle->len)
return i;
}
return -1;
} | false | false | false | false | false | 0 |
parse_zph_mode(enum zph_mode *mode)
{
char *token = strtok(NULL, w_space);
if (!token)
self_destruct();
if (strcmp(token, "off") == 0)
*mode = ZPH_OFF;
else if (strcmp(token, "tos") == 0)
*mode = ZPH_TOS;
else if (strcmp(token, "priority") == 0)
*mode = ZPH_PRIORITY;
else if (strcmp(token, "option") == 0)
*mode = ZPH_OPTION;
else {
debug(3, 0) ("WARNING: unsupported zph_mode argument '%s'\n", token);
}
} | false | false | false | false | false | 0 |
flattenTo2D()
{
for( int iRing = 0; iRing < nRingCount; iRing++ )
papoRings[iRing]->flattenTo2D();
nCoordDimension = 2;
} | false | false | false | false | false | 0 |
alm_file_type_blacklist_populate_file_types (AlmFileTypeBlacklist* self) {
AlmBlacklist* _tmp0_ = NULL;
GHashTable* _tmp1_ = NULL;
GHashTable* _tmp2_ = NULL;
GList* _tmp3_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->blacklist_interface;
_tmp1_ = alm_blacklist_get_all_templates (_tmp0_);
_tmp2_ = _tmp1_;
_tmp3_ = g_hash_table_get_keys (_tmp2_);
{
GList* key_collection = NULL;
GList* key_it = NULL;
key_collection = _tmp3_;
for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
gchar* _tmp4_ = NULL;
gchar* key = NULL;
_tmp4_ = g_strdup ((const gchar*) key_it->data);
key = _tmp4_;
{
const gchar* _tmp5_ = NULL;
const gchar* _tmp6_ = NULL;
gboolean _tmp7_ = FALSE;
_tmp5_ = key;
_tmp6_ = alm_file_type_blacklist_interpretation_prefix;
_tmp7_ = g_str_has_prefix (_tmp5_, _tmp6_);
if (_tmp7_) {
gchar* inter = NULL;
AlmBlacklist* _tmp8_ = NULL;
GHashTable* _tmp9_ = NULL;
GHashTable* _tmp10_ = NULL;
const gchar* _tmp11_ = NULL;
gconstpointer _tmp12_ = NULL;
ZeitgeistSubject* _tmp13_ = NULL;
ZeitgeistSubject* _tmp14_ = NULL;
const gchar* _tmp15_ = NULL;
const gchar* _tmp16_ = NULL;
gchar* _tmp17_ = NULL;
gchar* _tmp18_ = NULL;
gboolean _tmp19_ = FALSE;
GeeHashMap* _tmp20_ = NULL;
const gchar* _tmp21_ = NULL;
gboolean _tmp22_ = FALSE;
GeeHashMap* _tmp23_ = NULL;
const gchar* _tmp24_ = NULL;
gpointer _tmp25_ = NULL;
GtkCheckButton* _tmp26_ = NULL;
gboolean _tmp27_ = FALSE;
_tmp8_ = self->priv->blacklist_interface;
_tmp9_ = alm_blacklist_get_all_templates (_tmp8_);
_tmp10_ = _tmp9_;
_tmp11_ = key;
_tmp12_ = g_hash_table_lookup (_tmp10_, _tmp11_);
_tmp13_ = zeitgeist_event_get_subject ((ZeitgeistEvent*) _tmp12_, 0);
_tmp14_ = _tmp13_;
_tmp15_ = zeitgeist_subject_get_interpretation (_tmp14_);
_tmp16_ = _tmp15_;
_tmp17_ = g_strdup (_tmp16_);
_tmp18_ = _tmp17_;
_g_object_unref0 (_tmp14_);
inter = _tmp18_;
_tmp20_ = self->priv->checkboxes;
_tmp21_ = inter;
_tmp22_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp20_, _tmp21_);
if (_tmp22_) {
_tmp19_ = FALSE;
} else {
_tmp19_ = TRUE;
}
_tmp23_ = self->priv->checkboxes;
_tmp24_ = inter;
_tmp25_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp23_, _tmp24_);
_tmp26_ = (GtkCheckButton*) _tmp25_;
_tmp27_ = _tmp19_;
gtk_toggle_button_set_active ((GtkToggleButton*) _tmp26_, _tmp27_);
_g_object_unref0 (_tmp26_);
_g_free0 (inter);
}
_g_free0 (key);
}
}
_g_list_free0 (key_collection);
}
} | false | false | false | false | false | 0 |
strucsdist(const uint32_t* aary, size_t anum, const uint32_t* bary, size_t bnum) {
_assert_(aary && anum <= MEMMAXSIZ && bary && bnum <= MEMMAXSIZ);
return anum > UINT8MAX || bnum > UINT8MAX ?
levdist<const uint32_t, uint32_t>(aary, anum, bary, bnum) :
levdist<const uint32_t, uint8_t>(aary, anum, bary, bnum);
} | false | false | false | false | false | 0 |
tracker_sparql_expression_escape_sql_string_literal (TrackerSparqlExpression* self, const gchar* literal) {
gchar* result = NULL;
const gchar* _tmp0_;
gchar** _tmp1_;
gchar** _tmp2_ = NULL;
gchar** _tmp3_;
gint _tmp3__length1;
gchar* _tmp4_ = NULL;
gchar* _tmp5_;
gchar* _tmp6_ = NULL;
gchar* _tmp7_;
#line 71 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 71 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
g_return_val_if_fail (literal != NULL, NULL);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp0_ = literal;
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, "'", 0);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp3_ = _tmp2_;
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp3__length1 = _vala_array_length (_tmp1_);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp4_ = g_strjoinv ("''", _tmp3_);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp5_ = _tmp4_;
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp6_ = g_strdup_printf ("'%s'", _tmp5_);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp7_ = _tmp6_;
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_g_free0 (_tmp5_);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
result = _tmp7_;
#line 72 "/home/martyn/Source/tracker/src/libtracker-data/tracker-sparql-expression.vala"
return result;
#line 779 "tracker-sparql-expression.c"
} | false | false | false | false | false | 0 |
get_e ( uint16_t ioaddr, int offset ) {
GO_WINDOW(ioaddr,0);
if (!eeprom_rdy(ioaddr))
return (0xffff);
outw(EEPROM_CMD_RD | offset, ioaddr + EP_W0_EEPROM_COMMAND);
if (!eeprom_rdy(ioaddr))
return (0xffff);
return (inw(ioaddr + EP_W0_EEPROM_DATA));
} | false | false | false | false | false | 0 |
parse_rotation (ClutterActor *actor,
JsonNode *node,
RotationInfo *info)
{
JsonArray *array;
guint len, i;
gboolean retval = FALSE;
if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY)
{
g_warning ("Invalid node of type '%s' found, expecting an array",
json_node_type_name (node));
return FALSE;
}
array = json_node_get_array (node);
len = json_array_get_length (array);
for (i = 0; i < len; i++)
{
JsonNode *element = json_array_get_element (array, i);
JsonObject *object;
JsonNode *member;
if (JSON_NODE_TYPE (element) != JSON_NODE_OBJECT)
{
g_warning ("Invalid node of type '%s' found, expecting an object",
json_node_type_name (element));
return FALSE;
}
object = json_node_get_object (element);
if (json_object_has_member (object, "x-axis"))
{
member = json_object_get_member (object, "x-axis");
info->axis = CLUTTER_X_AXIS;
if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
{
info->angle = json_node_get_double (member);
retval = TRUE;
}
else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
retval = parse_rotation_array (actor,
json_node_get_array (member),
info);
else
retval = FALSE;
}
else if (json_object_has_member (object, "y-axis"))
{
member = json_object_get_member (object, "y-axis");
info->axis = CLUTTER_Y_AXIS;
if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
{
info->angle = json_node_get_double (member);
retval = TRUE;
}
else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
retval = parse_rotation_array (actor,
json_node_get_array (member),
info);
else
retval = FALSE;
}
else if (json_object_has_member (object, "z-axis"))
{
member = json_object_get_member (object, "z-axis");
info->axis = CLUTTER_Z_AXIS;
if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
{
info->angle = json_node_get_double (member);
retval = TRUE;
}
else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
retval = parse_rotation_array (actor,
json_node_get_array (member),
info);
else
retval = FALSE;
}
}
return retval;
} | false | false | false | false | false | 0 |
doTest(std::vector<std::string> &Prefix,
std::vector<std::string> &Suffix,
std::string &Error) {
sys::Path PrefixOutput;
Module *OrigProgram = 0;
if (!Prefix.empty()) {
outs() << "Checking to see if these passes crash: "
<< getPassesString(Prefix) << ": ";
std::string PfxOutput;
if (BD.runPasses(BD.getProgram(), Prefix, PfxOutput))
return KeepPrefix;
PrefixOutput.set(PfxOutput);
OrigProgram = BD.Program;
BD.Program = ParseInputFile(PrefixOutput.str(), BD.getContext());
if (BD.Program == 0) {
errs() << BD.getToolName() << ": Error reading bitcode file '"
<< PrefixOutput.str() << "'!\n";
exit(1);
}
PrefixOutput.eraseFromDisk();
}
outs() << "Checking to see if these passes crash: "
<< getPassesString(Suffix) << ": ";
if (BD.runPasses(BD.getProgram(), Suffix)) {
delete OrigProgram; // The suffix crashes alone...
return KeepSuffix;
}
// Nothing failed, restore state...
if (OrigProgram) {
delete BD.Program;
BD.Program = OrigProgram;
}
return NoFailure;
} | false | false | false | false | false | 0 |
decode_test_stateid(struct xdr_stream *xdr,
struct nfs41_test_stateid_res *res)
{
__be32 *p;
int status;
int num_res;
status = decode_op_hdr(xdr, OP_TEST_STATEID);
if (status)
return status;
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
num_res = be32_to_cpup(p++);
if (num_res != 1)
goto out;
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
res->status = be32_to_cpup(p++);
return status;
out_overflow:
print_overflow_msg(__func__, xdr);
out:
return -EIO;
} | false | false | false | false | false | 0 |
read_maps(unsigned long addr, char *buf)
{
FILE *f;
char line[MAPS_BUF_SZ];
char *tmp;
f = fopen("/proc/self/maps", "r");
if (!f) {
ERROR("Failed to open /proc/self/maps: %s\n", strerror(errno));
return -1;
}
while (1) {
unsigned long start, end, off, ino;
int ret;
tmp = fgets(line, MAPS_BUF_SZ, f);
if (!tmp)
break;
buf[0] = '\0';
ret = sscanf(line, "%lx-%lx %*s %lx %*s %ld %255s",
&start, &end, &off, &ino,
buf);
if ((ret < 4) || (ret > 5)) {
ERROR("Couldn't parse /proc/self/maps line: %s\n",
line);
fclose(f);
return -1;
}
if ((start <= addr) && (addr < end)) {
fclose(f);
return 1;
}
}
fclose(f);
return 0;
} | false | false | false | false | false | 0 |
_wrap_svn_repos_fs_change_node_prop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
svn_fs_root_t *arg1 = (svn_fs_root_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
svn_string_t *arg4 = (svn_string_t *) 0 ;
apr_pool_t *arg5 = (apr_pool_t *) 0 ;
apr_pool_t *_global_pool = NULL ;
PyObject *_global_py_pool = NULL ;
svn_string_t value4 ;
PyObject * obj0 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
svn_error_t *result = 0 ;
if (svn_swig_py_get_pool_arg(args, SWIGTYPE_p_apr_pool_t,
&_global_py_pool, &_global_pool))
SWIG_fail;
arg5 = _global_pool;
if (!PyArg_ParseTuple(args,(char *)"OssO|O:svn_repos_fs_change_node_prop",&obj0,&arg2,&arg3,&obj3,&obj4)) SWIG_fail;
{
arg1 = (svn_fs_root_t *)svn_swig_MustGetPtr(obj0, SWIGTYPE_p_svn_fs_root_t, svn_argnum_obj0);
if (PyErr_Occurred()) {
SWIG_fail;
}
}
{
if (obj3 == Py_None)
arg4 = NULL;
else {
if (!PyString_Check(obj3)) {
PyErr_SetString(PyExc_TypeError, "not a string");
SWIG_fail;
}
value4.data = PyString_AS_STRING(obj3);
value4.len = PyString_GET_SIZE(obj3);
arg4 = &value4;
}
}
if (obj4) {
/* Verify that the user supplied a valid pool */
if (obj4 != Py_None && obj4 != _global_py_pool) {
SWIG_Python_TypeError(SWIG_TypePrettyName(SWIGTYPE_p_apr_pool_t), obj4);
SWIG_arg_fail(svn_argnum_obj4);
SWIG_fail;
}
}
{
svn_swig_py_release_py_lock();
result = (svn_error_t *)svn_repos_fs_change_node_prop(arg1,(char const *)arg2,(char const *)arg3,(struct svn_string_t const *)arg4,arg5);
svn_swig_py_acquire_py_lock();
}
{
if (result != NULL) {
if (result->apr_err != SVN_ERR_SWIG_PY_EXCEPTION_SET)
svn_swig_py_svn_exception(result);
else
svn_error_clear(result);
SWIG_fail;
}
Py_INCREF(Py_None);
resultobj = Py_None;
}
{
Py_XDECREF(_global_py_pool);
}
return resultobj;
fail:
{
Py_XDECREF(_global_py_pool);
}
return NULL;
} | false | false | false | false | false | 0 |
ComputeFPSForThisFrame(void)
{
// In the following paragraph the framerate calculation is done.
// There are basically two ways to do this:
// The first way is to use SDL_GetTicks(), a function measuring milliseconds
// since the initialisation of the SDL.
// The second way is to use gettimeofday, a standard ANSI C function I guess,
// defined in time.h or so.
//
// I have arranged for a definition set in defs.h to switch between the two
// methods of ramerate calculation. THIS MIGHT INDEED MAKE SENSE, SINCE THERE
// ARE SOME UNEXPLAINED FRAMERATE PHENOMENA WHICH HAVE TO TO WITH KEYBOARD
// SPACE KEY, SO PLEASE DO NOT ERASE EITHER METHOD. PLEASE ASK JP FIRST.
//
if (SkipAFewFrames) return;
Now_SDL_Ticks=SDL_GetTicks();
oneframedelay=Now_SDL_Ticks-One_Frame_SDL_Ticks;
FPSover1 = 1000.0/(float)oneframedelay;
} | false | false | false | false | false | 0 |
start (unsigned channels, unsigned samplerate, unsigned bits_per_sample)
{
yield = true;
PWaitAndSignal m_pri(core_mutex[primary]);
if (current_primary_config.active) {
PTRACE(1, "AudioOutputCore\tTrying to start output device although already started");
return;
}
internal_set_manager(primary, desired_primary_device); /* may be left undetermined after the last call */
average_level = 0;
internal_open(primary, channels, samplerate, bits_per_sample);
current_primary_config.active = true;
current_primary_config.channels = channels;
current_primary_config.samplerate = samplerate;
current_primary_config.bits_per_sample = bits_per_sample;
current_primary_config.buffer_size = 0;
current_primary_config.num_buffers = 0;
} | false | false | false | false | false | 0 |
exec_page_free(cpu_mips_t *cpu,insn_exec_page_t *p)
{
if (p) {
p->next = cpu->exec_page_free_list;
cpu->exec_page_free_list = p;
cpu->exec_page_alloc--;
}
} | false | false | false | false | false | 0 |
l2_connected(struct FsmInst *fi, int event, void *arg)
{
struct PStack *st = fi->userdata;
struct sk_buff *skb = arg;
int pr = -1;
if (!get_PollFlag(st, skb)) {
l2_mdl_error_ua(fi, event, arg);
return;
}
dev_kfree_skb(skb);
if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag))
l2_disconnect(fi, event, arg);
if (test_and_clear_bit(FLG_L3_INIT, &st->l2.flag)) {
pr = DL_ESTABLISH | CONFIRM;
} else if (st->l2.vs != st->l2.va) {
skb_queue_purge(&st->l2.i_queue);
pr = DL_ESTABLISH | INDICATION;
}
stop_t200(st, 5);
st->l2.vr = 0;
st->l2.vs = 0;
st->l2.va = 0;
st->l2.sow = 0;
FsmChangeState(fi, ST_L2_7);
FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 4);
if (pr != -1)
st->l2.l2l3(st, pr, NULL);
if (!skb_queue_empty(&st->l2.i_queue) && cansend(st))
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
} | false | false | false | false | false | 0 |
ParseConditionalExpression(bool accept_IN, bool* ok) {
// ConditionalExpression ::
// LogicalOrExpression
// LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression
// We start using the binary expression parser for prec >= 4 only!
Expression* expression = ParseBinaryExpression(4, accept_IN, CHECK_OK);
if (peek() != Token::CONDITIONAL) return expression;
Consume(Token::CONDITIONAL);
// In parsing the first assignment expression in conditional
// expressions we always accept the 'in' keyword; see ECMA-262,
// section 11.12, page 58.
int left_position = scanner().peek_location().beg_pos;
Expression* left = ParseAssignmentExpression(true, CHECK_OK);
Expect(Token::COLON, CHECK_OK);
int right_position = scanner().peek_location().beg_pos;
Expression* right = ParseAssignmentExpression(accept_IN, CHECK_OK);
return new(zone()) Conditional(
isolate(), expression, left, right, left_position, right_position);
} | false | false | false | false | false | 0 |
gst_tee_do_push (GstTee * tee, GstPad * pad, gpointer data, gboolean is_list)
{
GstFlowReturn res;
/* Push */
if (pad == tee->pull_pad) {
/* don't push on the pad we're pulling from */
res = GST_FLOW_OK;
} else if (is_list) {
res =
gst_pad_push_list (pad,
gst_buffer_list_ref (GST_BUFFER_LIST_CAST (data)));
} else {
res = gst_pad_push (pad, gst_buffer_ref (GST_BUFFER_CAST (data)));
}
return res;
} | false | false | false | false | false | 0 |
buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return;
}
if(bytes!=NULL && bytesLength>0) {
// Already built.
return;
}
if(bytesLength==0) {
if(elementsLength==0) {
errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return;
}
uprv_sortArray(elements, elementsLength, (int32_t)sizeof(BytesTrieElement),
compareElementStrings, strings,
FALSE, // need not be a stable sort
&errorCode);
if(U_FAILURE(errorCode)) {
return;
}
// Duplicate strings are not allowed.
StringPiece prev=elements[0].getString(*strings);
for(int32_t i=1; i<elementsLength; ++i) {
StringPiece current=elements[i].getString(*strings);
if(prev==current) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
prev=current;
}
}
// Create and byte-serialize the trie for the elements.
bytesLength=0;
int32_t capacity=strings->length();
if(capacity<1024) {
capacity=1024;
}
if(bytesCapacity<capacity) {
uprv_free(bytes);
bytes=static_cast<char *>(uprv_malloc(capacity));
if(bytes==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
bytesCapacity=0;
return;
}
bytesCapacity=capacity;
}
StringTrieBuilder::build(buildOption, elementsLength, errorCode);
if(bytes==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
} | false | false | false | false | false | 0 |
jswrap_graphics_fillPoly(JsVar *parent, JsVar *poly) {
JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return;
if (!jsvIsIterable(poly)) return;
const int maxVerts = 128;
short verts[maxVerts];
int idx = 0;
JsvIterator it;
jsvIteratorNew(&it, poly);
while (jsvIteratorHasElement(&it) && idx<maxVerts) {
verts[idx++] = (short)jsvIteratorGetIntegerValue(&it);
jsvIteratorNext(&it);
}
jsvIteratorFree(&it);
if (idx==maxVerts) {
jsWarn("Maximum number of points (%d) exceeded for fillPoly", maxVerts/2);
}
graphicsFillPoly(&gfx, idx/2, verts);
} | false | false | false | false | false | 0 |
destroy_queues (amb_dev * dev) {
// all queues assumed empty
void * memory = dev->cq.ptrs.start;
// includes txq.in, txq.out, rxq[].in and rxq[].out
PRINTD (DBG_FLOW, "destroy_queues %p", dev);
PRINTD (DBG_INIT, "freeing queues at %p", memory);
kfree (memory);
return;
} | false | false | false | false | false | 0 |
ast_custom_function_find(const char *name)
{
struct ast_custom_function *acf = NULL;
AST_RWLIST_RDLOCK(&acf_root);
AST_RWLIST_TRAVERSE(&acf_root, acf, acflist) {
if (!strcmp(name, acf->name))
break;
}
AST_RWLIST_UNLOCK(&acf_root);
return acf;
} | false | false | false | false | false | 0 |
on_leave_event(GdkEventCrossing * ev)
{
if (tipTimeout.connected()) {
tipTimeout.disconnect();
tooltips->hideTooltip();
}
return false;
} | false | false | false | false | false | 0 |
component(int what)
{
switch (what) {
case D_CLASS: return &name;
case D_CXX_CLASS: return &cxx;
case D_HEADER_FILE: return &header_file;
case D_SOURCE_FILE: return &source_file;
case D_PORT_COUNT: return &port_count_code;
case D_PROCESSING: return &processing_code;
case D_FLOW_CODE: return &flow_code;
case D_FLAGS: return &flags;
case D_METHODS: return &methods;
case D_REQUIREMENTS: return &requirements;
case D_PROVISIONS: return &provisions;
case D_LIBS: return &libs;
case D_DOC_NAME: return &documentation_name;
default: return 0;
}
} | false | false | false | false | false | 0 |
mathmlize(MathStream & ms) const
{
std::string entity;
switch (char_) {
case '<': entity = "<"; break;
case '>': entity = ">"; break;
case '&': entity = "&"; break;
case ' ': {
ms << from_ascii(" ");
return;
}
default: break;
}
if (ms.inText()) {
if (entity.empty())
ms.os().put(char_);
else
ms << from_ascii(entity);
return;
}
if (!entity.empty()) {
ms << "<mo>" << from_ascii(entity) << "</mo>";
return;
}
char const * type =
(isAlphaASCII(char_) || Encodings::isMathAlpha(char_))
? "mi" : "mo";
// we don't use MTag and ETag because we do not want the spacing
ms << "<" << type << ">" << char_type(char_) << "</" << type << ">";
} | false | false | false | false | false | 0 |
alloc_tnd(typ, init, lvl)
int typ;
struct node *init;
int lvl;
{
register struct init_tend *tnd;
if (lvl > 2) {
/*
* This declaration occurs in an inner compound statement. There
* may be slots created for parallel compound statement, but were
* freed and can be reused here.
*/
tnd = tend_lst;
while (tnd != NULL && (tnd->in_use || tnd->init_typ != typ))
tnd = tnd->next;
if (tnd != NULL) {
tnd->in_use = 1;
tnd->nest_lvl = lvl;
return tnd->t_indx;
}
}
/*
* Allocate a new tended slot, compute its index in the array, and
* set initialization and other information.
*/
tnd = NewStruct(init_tend);
if (tend_lst == NULL)
tnd->t_indx = 0;
else
tnd->t_indx = tend_lst->t_indx + 1;
tnd->init_typ = typ;
/*
* The initialization from the declaration will only be used to
* set up the tended location if the declaration is in the outermost
* "block". Otherwise a generic initialization will be done during
* the set up and the one from the declaration will be put off until
* the block is entered.
*/
if (lvl == 2)
tnd->init = init;
else
tnd->init = NULL;
tnd->in_use = 1;
tnd->nest_lvl = lvl;
tnd->next = tend_lst;
tend_lst = tnd;
return tnd->t_indx;
} | false | false | false | false | false | 0 |
getraw0vert(
gamut *s,
double pos[3], /* Return absolute position */
int ix /* Input index */
) {
if (ix < 0)
return -1;
/* Find then next used in the triangulation and direction 0 */
for (; ix < s->nv; ix++) {
if (!(s->verts[ix]->f & GVERT_SET)
|| !(s->verts[ix]->k0 > 0))
continue;
break;
}
if (ix >= s->nv)
return -1;
pos[0] = s->verts[ix]->p[0];
pos[1] = s->verts[ix]->p[1];
pos[2] = s->verts[ix]->p[2];
return ix+1;
} | false | false | false | false | false | 0 |
DownloadPit(void)
{
deviceDetectedRadioButton->setChecked(false);
utilityOutputPlainTextEdit->clear();
heimdallState = HeimdallState::DownloadingPit;
heimdallFailed = false;
QStringList arguments;
arguments.append("download-pit");
arguments.append("--output");
arguments.append(pitDestinationLineEdit->text());
arguments.append("--no-reboot");
if (resume)
arguments.append("--resume");
if (verboseOutput)
arguments.append("--verbose");
arguments.append("--stdout-errors");
StartHeimdall(arguments);
} | false | false | false | false | false | 0 |
isdn_info_update(void)
{
infostruct *p = dev->infochain;
while (p) {
*(p->private) = 1;
p = (infostruct *) p->next;
}
wake_up_interruptible(&(dev->info_waitq));
} | false | false | false | false | false | 0 |
gfire_buddy_proto_clan_alias_change(gfire_data *p_gfire, guint16 p_packet_len)
{
guint32 offset;
guint32 clanid = 0;
guint32 uid = 0;
gchar *nick = NULL;
gfire_buddy *gf_buddy = NULL;
offset = XFIRE_HEADER_LEN;
// grab the clanid
offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &clanid, 0x6C, offset);
if(offset == -1)
return;
// grab the userid
offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &uid, 0x01, offset);
if(offset == -1)
return;
// grab the new nick
offset = gfire_proto_read_attr_string_bs(p_gfire->buff_in, &nick, 0x0D, offset);
if(offset == -1 || !nick)
return;
gf_buddy = gfire_find_buddy(p_gfire, (gpointer) &uid, GFFB_USERID);
if (!gf_buddy)
{
purple_debug(PURPLE_DEBUG_ERROR, "gfire", "gfire_buddy_proto_clan_alias_change: unknown user ID from Xfire\n");
g_free(nick);
return;
}
gfire_clan *clan = gfire_find_clan(p_gfire, clanid);
if(clan)
purple_debug(PURPLE_DEBUG_INFO, "gfire", "User %s changed nick for clan %s (%u) to \"%s\"\n",
gfire_buddy_get_name(gf_buddy), clan->long_name, clanid, nick);
gfire_buddy_set_clan_alias(gf_buddy, clanid, nick);
g_free(nick);
} | false | false | false | false | false | 0 |
con_send_alert(cnu user, char *text, char *subject, const char *status)
{
xmlnode msg = _con_send_alert(user, text, subject, status,0);
if(msg)
{
deliver(dpacket_new(msg), NULL);
}
} | false | false | false | false | false | 0 |
adt7316_i2c_read(void *client, u8 reg, u8 *data)
{
struct i2c_client *cl = client;
int ret = 0;
ret = i2c_smbus_write_byte(cl, reg);
if (ret < 0) {
dev_err(&cl->dev, "I2C fail to select reg\n");
return ret;
}
ret = i2c_smbus_read_byte(client);
if (ret < 0) {
dev_err(&cl->dev, "I2C read error\n");
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
get_hmdf_list_under(Hmdf_table *top)
{
List *list = NULL;
List *list0;
Hmdf_table *h;
for (h = top->children; h != NULL; h = h->brothers) {
list = list_append(list, h);
list0 = get_hmdf_list_under(h);
list = list_concat(list, list0);
}
return list;
} | false | false | false | false | false | 0 |
DeleteStuff()
{
delete thermal_;
delete gray256_;
delete gray16_;
delete rainbow_;
delete redblue16_;
delete classic8_;
delete topo256_;
delete default_;
delete userdefined_;
std::vector<GRA_color*>::const_iterator end = namedColors_.end();
for( std::vector<GRA_color*>::const_iterator i=namedColors_.begin(); i!=end; ++i )
delete *i;
} | false | false | false | false | false | 0 |
inverse( bool* pbIsSingular, float epsilon )
{
float determinant = m_elements[ 0 ] * m_elements[ 3 ] - m_elements[ 2 ] * m_elements[ 1 ];
bool isSingular = ( fabs( determinant ) < epsilon );
if( isSingular )
{
if( pbIsSingular != NULL )
{
*pbIsSingular = true;
}
return Matrix2f();
}
else
{
if( pbIsSingular != NULL )
{
*pbIsSingular = false;
}
float reciprocalDeterminant = 1.0f / determinant;
return Matrix2f
(
m_elements[ 3 ] * reciprocalDeterminant, -m_elements[ 2 ] * reciprocalDeterminant,
-m_elements[ 1 ] * reciprocalDeterminant, m_elements[ 0 ] * reciprocalDeterminant
);
}
} | false | false | false | false | false | 0 |
srv_result_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct srv_result_datastore *srds;
struct ast_datastore *datastore;
struct srv_context *srv_context;
char *parse;
const char *host;
unsigned short port, priority, weight;
unsigned int num;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(id);
AST_APP_ARG(resultnum);
AST_APP_ARG(field);
);
if (!chan) {
ast_log(LOG_WARNING, "%s cannot be used without a channel\n", cmd);
return -1;
}
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "%s requires two arguments (id and resultnum)\n", cmd);
return -1;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
ast_channel_lock(chan);
datastore = ast_channel_datastore_find(chan, &srv_result_datastore_info, args.id);
ast_channel_unlock(chan);
if (!datastore) {
/* They apparently decided to call SRVRESULT without first calling SRVQUERY.
* No problem, we'll do the SRV lookup now.
*/
srv_context = srv_datastore_setup(args.id, chan);
if (!srv_context) {
return -1;
}
} else {
srds = datastore->data;
srv_context = srds->context;
}
if (!strcasecmp(args.resultnum, "getnum")) {
snprintf(buf, len, "%u", ast_srv_get_record_count(srv_context));
return 0;
}
if (ast_strlen_zero(args.field)) {
ast_log(LOG_ERROR, "A field must be provided when requesting SRV data\n");
return -1;
}
if (sscanf(args.resultnum, "%30u", &num) != 1) {
ast_log(LOG_ERROR, "Invalid value '%s' for resultnum to %s\n", args.resultnum, cmd);
return -1;
}
if (ast_srv_get_nth_record(srv_context, num, &host, &port, &priority, &weight)) {
ast_log(LOG_ERROR, "Failed to get record number %u for %s\n", num, cmd);
return -1;
}
if (!strcasecmp(args.field, "host")) {
ast_copy_string(buf, host, len);
} else if (!strcasecmp(args.field, "port")) {
snprintf(buf, len, "%u", port);
} else if (!strcasecmp(args.field, "priority")) {
snprintf(buf, len, "%u", priority);
} else if (!strcasecmp(args.field, "weight")) {
snprintf(buf, len, "%u", weight);
} else {
ast_log(LOG_WARNING, "Unrecognized SRV field '%s'\n", args.field);
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
gtm601_modem_real_createChannels (FsoGsmAbstractModem* base) {
Gtm601Modem * self;
FsoFrameworkTransport* transport = NULL;
FsoFrameworkTransportSpec* _tmp0_ = NULL;
FsoFrameworkTransportSpec* _tmp1_ = NULL;
FsoFrameworkTransport* _tmp2_ = NULL;
FsoGsmStateBasedAtParser* parser = NULL;
FsoGsmStateBasedAtParser* _tmp3_ = NULL;
FsoFrameworkTransport* _tmp4_ = NULL;
FsoGsmStateBasedAtParser* _tmp5_ = NULL;
FsoGsmAtChannel* _tmp6_ = NULL;
FsoGsmAtChannel* _tmp7_ = NULL;
gchar* modem_urc_access = NULL;
FsoFrameworkSmartKeyFile* _tmp8_ = NULL;
gchar* _tmp9_ = NULL;
const gchar* _tmp10_ = NULL;
gint _tmp11_ = 0;
gint _tmp12_ = 0;
self = (Gtm601Modem*) base;
_tmp0_ = fso_gsm_abstract_modem_get_modem_transport_spec ((FsoGsmAbstractModem*) self);
_tmp1_ = _tmp0_;
_tmp2_ = fso_framework_transport_spec_create (_tmp1_);
transport = _tmp2_;
_tmp3_ = fso_gsm_state_based_at_parser_new ();
parser = _tmp3_;
_tmp4_ = transport;
_tmp5_ = parser;
_tmp6_ = fso_gsm_at_channel_new ((FsoGsmModem*) self, GTM601_MODEM_CHANNEL_NAME, _tmp4_, (FsoFrameworkParser*) _tmp5_);
_tmp7_ = _tmp6_;
_g_object_unref0 (_tmp7_);
_tmp8_ = fso_framework_theConfig;
_tmp9_ = fso_framework_smart_key_file_stringValue (_tmp8_, "fsogsm.modem_option_gtm601", "modem_urc_access", "");
modem_urc_access = _tmp9_;
_tmp10_ = modem_urc_access;
_tmp11_ = strlen (_tmp10_);
_tmp12_ = _tmp11_;
if (_tmp12_ > 0) {
const gchar* _tmp13_ = NULL;
FsoFrameworkTransportSpec* _tmp14_ = NULL;
FsoFrameworkTransportSpec* _tmp15_ = NULL;
FsoFrameworkTransport* _tmp16_ = NULL;
FsoGsmStateBasedAtParser* _tmp17_ = NULL;
FsoFrameworkTransport* _tmp18_ = NULL;
FsoGsmStateBasedAtParser* _tmp19_ = NULL;
FsoGsmAtChannel* _tmp20_ = NULL;
FsoGsmAtChannel* _tmp21_ = NULL;
_tmp13_ = modem_urc_access;
_tmp14_ = fso_framework_transport_spec_parse (_tmp13_);
_tmp15_ = _tmp14_;
_tmp16_ = fso_framework_transport_spec_create (_tmp15_);
_g_object_unref0 (transport);
transport = _tmp16_;
_fso_framework_transport_spec_unref0 (_tmp15_);
_tmp17_ = fso_gsm_state_based_at_parser_new ();
_g_object_unref0 (parser);
parser = _tmp17_;
_tmp18_ = transport;
_tmp19_ = parser;
_tmp20_ = fso_gsm_at_channel_new ((FsoGsmModem*) self, GTM601_MODEM_URC_CHANNEL_NAME, _tmp18_, (FsoFrameworkParser*) _tmp19_);
_tmp21_ = _tmp20_;
_g_object_unref0 (_tmp21_);
}
_g_free0 (modem_urc_access);
_g_object_unref0 (parser);
_g_object_unref0 (transport);
} | false | false | false | false | false | 0 |
xudc_irq(int irq, void *_udc)
{
struct xusb_udc *udc = _udc;
u32 intrstatus;
u32 ier;
u8 index;
u32 bufintr;
unsigned long flags;
spin_lock_irqsave(&udc->lock, flags);
/*
* Event interrupts are level sensitive hence first disable
* IER, read ISR and figure out active interrupts.
*/
ier = udc->read_fn(udc->addr + XUSB_IER_OFFSET);
ier &= ~XUSB_STATUS_INTR_EVENT_MASK;
udc->write_fn(udc->addr, XUSB_IER_OFFSET, ier);
/* Read the Interrupt Status Register.*/
intrstatus = udc->read_fn(udc->addr + XUSB_STATUS_OFFSET);
/* Call the handler for the event interrupt.*/
if (intrstatus & XUSB_STATUS_INTR_EVENT_MASK) {
/*
* Check if there is any action to be done for :
* - USB Reset received {XUSB_STATUS_RESET_MASK}
* - USB Suspend received {XUSB_STATUS_SUSPEND_MASK}
* - USB Resume received {XUSB_STATUS_RESUME_MASK}
* - USB Disconnect received {XUSB_STATUS_DISCONNECT_MASK}
*/
xudc_startup_handler(udc, intrstatus);
}
/* Check the buffer completion interrupts */
if (intrstatus & XUSB_STATUS_INTR_BUFF_COMP_ALL_MASK) {
/* Enable Reset, Suspend, Resume and Disconnect */
ier = udc->read_fn(udc->addr + XUSB_IER_OFFSET);
ier |= XUSB_STATUS_INTR_EVENT_MASK;
udc->write_fn(udc->addr, XUSB_IER_OFFSET, ier);
if (intrstatus & XUSB_STATUS_EP0_BUFF1_COMP_MASK)
xudc_ctrl_ep_handler(udc, intrstatus);
for (index = 1; index < 8; index++) {
bufintr = ((intrstatus &
(XUSB_STATUS_EP1_BUFF1_COMP_MASK <<
(index - 1))) || (intrstatus &
(XUSB_STATUS_EP1_BUFF2_COMP_MASK <<
(index - 1))));
if (bufintr) {
xudc_nonctrl_ep_handler(udc, index,
intrstatus);
}
}
}
spin_unlock_irqrestore(&udc->lock, flags);
return IRQ_HANDLED;
} | 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.