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 |
|---|---|---|---|---|---|---|
require_user(int pass)
{
char *id = queue_remove(id_queue);
user_datum_t *user = NULL;
int retval;
if (pass == 1) {
free(id);
return 0;
}
if (id == NULL) {
yyerror("no user name");
return -1;
}
if ((user = malloc(sizeof(*user))) == NULL) {
free(id);
yyerror("Out of memory!");
return -1;
}
user_datum_init(user);
retval =
require_symbol(SYM_USERS, id, (hashtab_datum_t *) user,
&user->s.value, &user->s.value);
if (retval != 0) {
free(id);
user_datum_destroy(user);
}
switch (retval) {
case -3:{
yyerror("Out of memory!");
return -1;
}
case -2:{
yyerror("duplicate declaration of user");
return -1;
}
case -1:{
yyerror("could not require user here");
return -1;
}
case 0:{
return 0;
}
case 1:{
return 0; /* user already required */
}
default:{
assert(0); /* should never get here */
}
}
} | false | false | false | false | false | 0 |
get_rx_page_info(struct be_rx_obj *rxo)
{
struct be_adapter *adapter = rxo->adapter;
struct be_rx_page_info *rx_page_info;
struct be_queue_info *rxq = &rxo->q;
u16 frag_idx = rxq->tail;
rx_page_info = &rxo->page_info_tbl[frag_idx];
BUG_ON(!rx_page_info->page);
if (rx_page_info->last_frag) {
dma_unmap_page(&adapter->pdev->dev,
dma_unmap_addr(rx_page_info, bus),
adapter->big_page_size, DMA_FROM_DEVICE);
rx_page_info->last_frag = false;
} else {
dma_sync_single_for_cpu(&adapter->pdev->dev,
dma_unmap_addr(rx_page_info, bus),
rx_frag_size, DMA_FROM_DEVICE);
}
queue_tail_inc(rxq);
atomic_dec(&rxq->used);
return rx_page_info;
} | false | false | false | false | false | 0 |
vm_class_resolve_class(const struct vm_class *vmc, uint16_t i)
{
const struct cafebabe_constant_info_class *constant_class;
if (cafebabe_class_constant_get_class(vmc->class, i, &constant_class))
return NULL;
const struct cafebabe_constant_info_utf8 *class_name;
if (cafebabe_class_constant_get_utf8(vmc->class,
constant_class->name_index, &class_name))
{
NOT_IMPLEMENTED;
return NULL;
}
char *class_name_str = strndup((char *) class_name->bytes,
class_name->length);
if (!class_name_str) {
NOT_IMPLEMENTED;
return NULL;
}
struct vm_class *class
= classloader_load(vmc->classloader, class_name_str);
if (!class) {
warn("failed to load class %s", class_name_str);
return NULL;
}
return class;
} | false | false | false | false | false | 0 |
trio_fpclassify_and_signbit
TRIO_ARGS2((number, is_negative),
double number,
int *is_negative)
{
/* The TRIO_FUNC_xxx_FPCLASSIFY_AND_SIGNBIT macros are mutually exclusive */
#if defined(TRIO_FUNC_C99_FPCLASSIFY_AND_SIGNBIT)
return c99_fpclassify_and_signbit(number, is_negative);
#endif
#if defined(TRIO_FUNC_DECC_FPCLASSIFY_AND_SIGNBIT)
return decc_fpclassify_and_signbit(number, is_negative);
#endif
#if defined(TRIO_FUNC_MS_FPCLASSIFY_AND_SIGNBIT)
return ms_fpclassify_and_signbit(number, is_negative);
#endif
#if defined(TRIO_FUNC_HP_FPCLASSIFY_AND_SIGNBIT)
return hp_fpclassify_and_signbit(number, is_negative);
#endif
#if defined(TRIO_FUNC_XLC_FPCLASSIFY_AND_SIGNBIT)
return xlc_fpclassify_and_signbit(number, is_negative);
#endif
#if defined(TRIO_FUNC_INTERNAL_FPCLASSIFY_AND_SIGNBIT)
/*
* Fallback solution.
*/
int rc;
if (number == 0.0) {
/*
* In IEEE 754 the sign of zero is ignored in comparisons, so we
* have to handle this as a special case by examining the sign bit
* directly.
*/
# if defined(TRIO_IEEE_754)
*is_negative = internal_is_negative(number);
# else
*is_negative = TRIO_FALSE; /* FIXME */
# endif
return TRIO_FP_ZERO;
}
if (internal_isnan(number)) {
*is_negative = TRIO_FALSE;
return TRIO_FP_NAN;
}
rc = internal_isinf(number);
if (rc != 0) {
*is_negative = (rc == -1);
return TRIO_FP_INFINITE;
}
if ((number > 0.0) && (number < DBL_MIN)) {
*is_negative = TRIO_FALSE;
return TRIO_FP_SUBNORMAL;
}
if ((number < 0.0) && (number > -DBL_MIN)) {
*is_negative = TRIO_TRUE;
return TRIO_FP_SUBNORMAL;
}
*is_negative = (number < 0.0);
return TRIO_FP_NORMAL;
#endif
} | false | false | false | false | false | 0 |
write(const Sphere* sphere, size_t count)
{
for (size_t i = 0; i < count; ++i, ++sphere)
{
write(&sphere->getCenter());
Real radius = sphere->getRadius();
write(&radius);
}
} | false | false | false | false | false | 0 |
treeFormatOptionsMenu()
{
while (true)
{
lin1 = "";
cout<< "\n\n\n";
cout<<" ****** Format of Phylogenetic Tree Output ******\n\n\n";
cout<<" 1. Toggle CLUSTAL format tree output = "
<< ((!userParameters->getOutputTreeClustal()) ? "OFF" : "ON")<<"\n";
cout<<" 2. Toggle Phylip format tree output = "
<< ((!userParameters->getOutputTreePhylip()) ? "OFF" : "ON")<<"\n";
cout<<" 3. Toggle Phylip distance matrix output = "
<< ((!userParameters->getOutputTreeDistances()) ? "OFF" : "ON")<<"\n";
cout<<" 4. Toggle Nexus format tree output = "
<< ((!userParameters->getOutputTreeNexus()) ? "OFF" : "ON")<<"\n\n";
cout<<" 5. Toggle Phylip bootstrap positions = "
<<((userParameters->getBootstrapFormat() == BS_NODE_LABELS) ? "NODE LABELS" :
"BRANCH LABELS") <<"\n\n\n";
cout<<" H. HELP\n\n\n";
choice = utilityObject->getChoice(string("Enter number (or [RETURN] to exit)"));
if (choice == '\n')
{
return ;
}
switch (toupper(choice))
{
case '1':
userParameters->toggleOutputTreeClustal();
break;
case '2':
userParameters->toggleOutputTreePhylip();
break;
case '3':
userParameters->toggleOutputTreeDistances();
break;
case '4':
userParameters->toggleOutputTreeNexus();
break;
case '5':
userParameters->toggleBootstrapFormat();
break;
case '?':
case 'H':
clustalObj->getHelp('0');
break;
default:
cout<< "\n\nUnrecognised Command\n\n";
break;
}
}
} | false | false | false | false | false | 0 |
meye_init(void)
{
gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS));
if (gbufsize > MEYE_MAX_BUFSIZE)
gbufsize = MEYE_MAX_BUFSIZE;
gbufsize = PAGE_ALIGN(gbufsize);
printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) "
"for capture\n",
gbuffers,
gbufsize / 1024, gbuffers * gbufsize / 1024);
return pci_register_driver(&meye_driver);
} | false | false | false | false | false | 0 |
header(unsigned char *sha1, char *path1, int mode1,
unsigned char *sha2, char *path2, int mode2)
{
char *abbrev1, *abbrev2;
int subproject;
subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2));
html("<div class='head'>");
html("diff --git a/");
html_txt(path1);
html(" b/");
html_txt(path2);
if (is_null_sha1(sha1))
path1 = "dev/null";
if (is_null_sha1(sha2))
path2 = "dev/null";
if (mode1 == 0)
htmlf("<br/>new file mode %.6o", mode2);
if (mode2 == 0)
htmlf("<br/>deleted file mode %.6o", mode1);
if (!subproject) {
abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV));
abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV));
htmlf("<br/>index %s..%s", abbrev1, abbrev2);
free(abbrev1);
free(abbrev2);
if (mode1 != 0 && mode2 != 0) {
htmlf(" %.6o", mode1);
if (mode2 != mode1)
htmlf("..%.6o", mode2);
}
html("<br/>--- a/");
if (mode1 != 0)
cgit_tree_link(path1, NULL, NULL, ctx.qry.head,
sha1_to_hex(old_rev_sha1), path1);
else
html_txt(path1);
html("<br/>+++ b/");
if (mode2 != 0)
cgit_tree_link(path2, NULL, NULL, ctx.qry.head,
sha1_to_hex(new_rev_sha1), path2);
else
html_txt(path2);
}
html("</div>");
} | false | false | false | false | false | 0 |
SockConnect(char *host, int port, char *lhost, int lport, int async)
{
SOCKET sock;
struct sockaddr_in lsa;
struct sockaddr_in sa;
int err;
if (Ns_GetSockAddr(&sa, host, port) != NS_OK ||
Ns_GetSockAddr(&lsa, lhost, lport) != NS_OK) {
return INVALID_SOCKET;
}
sock = Ns_SockBind(&lsa);
if (sock != INVALID_SOCKET) {
if (async) {
Ns_SockSetNonBlocking(sock);
}
if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) != 0) {
err = ns_sockerrno;
if (!async || (err != EINPROGRESS && err != EWOULDBLOCK)) {
ns_sockclose(sock);
sock = INVALID_SOCKET;
}
}
if (async && sock != INVALID_SOCKET) {
Ns_SockSetBlocking(sock);
}
}
return sock;
} | false | false | false | false | false | 0 |
handle_net_input(int len)
{
int i;
int cstart = 0;
for (i = 0; i < len; i++) {
byte c = G.buf[i];
if (G.telstate == TS_NORMAL) { /* most typical state */
if (c == IAC) {
cstart = i;
G.telstate = TS_IAC;
}
else if (c == '\r') {
cstart = i + 1;
G.telstate = TS_CR;
}
/* No IACs were seen so far, no need to copy
* bytes within G.buf: */
continue;
}
switch (G.telstate) {
case TS_CR:
/* Prev char was CR. If cur one is NUL, ignore it.
* See RFC 1123 section 3.3.1 for discussion of telnet EOL handling.
*/
G.telstate = TS_COPY;
if (c == '\0')
break;
/* else: fall through - need to handle CR IAC ... properly */
case TS_COPY: /* Prev char was ordinary */
/* Similar to NORMAL, but in TS_COPY we need to copy bytes */
if (c == IAC)
G.telstate = TS_IAC;
else
G.buf[cstart++] = c;
if (c == '\r')
G.telstate = TS_CR;
break;
case TS_IAC: /* Prev char was IAC */
if (c == IAC) { /* IAC IAC -> one IAC */
G.buf[cstart++] = c;
G.telstate = TS_COPY;
break;
}
/* else */
switch (c) {
case SB:
G.telstate = TS_SUB1;
break;
case DO:
case DONT:
case WILL:
case WONT:
G.telwish = c;
G.telstate = TS_OPT;
break;
/* DATA MARK must be added later */
default:
G.telstate = TS_COPY;
}
break;
case TS_OPT: /* Prev chars were IAC WILL/WONT/DO/DONT */
telopt(c);
G.telstate = TS_COPY;
break;
case TS_SUB1: /* Subnegotiation */
case TS_SUB2: /* Subnegotiation */
subneg(c); /* can change G.telstate */
break;
}
}
if (G.telstate != TS_NORMAL) {
/* We had some IACs, or CR */
if (G.iaclen)
iac_flush();
if (G.telstate == TS_COPY) /* we aren't in the middle of IAC */
G.telstate = TS_NORMAL;
len = cstart;
}
if (len)
full_write(STDOUT_FILENO, G.buf, len);
} | false | false | false | false | false | 0 |
M_Destroy(void)
{
if(m_AutoFreeElementData && m_ElementData != NULL)
{
delete [] (char *)m_ElementData;
}
m_ElementData = NULL;
if(m_CompressionTable && m_CompressionTable->compressedStream)
{
inflateEnd(m_CompressionTable->compressedStream);
delete m_CompressionTable->compressedStream;
delete [] m_CompressionTable->buffer;
m_CompressionTable->buffer = NULL;
}
delete m_CompressionTable;
m_CompressionTable = NULL;
MetaObject::M_Destroy();
} | false | false | false | false | false | 0 |
loadLineSegment(double x1, double y1,
double x2, double y2)
{
if (x1 > myLineMax.getX())
myLineMax.setX(x1);
if (y1 > myLineMax.getY())
myLineMax.setY(y1);
if (x1 < myLineMin.getX())
myLineMin.setX(x1);
if (y1 < myLineMin.getY())
myLineMin.setY(y1);
if (x2 > myLineMax.getX())
myLineMax.setX(x2);
if (y2 > myLineMax.getY())
myLineMax.setY(y2);
if (x2 < myLineMin.getX())
myLineMin.setX(x2);
if (y2 < myLineMin.getY())
myLineMin.setY(y2);
myLines.push_back(ArLineSegment(x1, y1, x2, y2));
} | false | false | false | false | false | 0 |
traverse(QvState *state)
{
ANNOUNCE(QvLOD);
indent++;
// ??? In a real implementation, this would choose a child based
// ??? on the distance to the eye point.
if (getNumChildren() > 0)
getChild(0)->traverse(state);
indent--;
} | false | false | false | false | false | 0 |
iax2_read(struct ast_channel *c)
{
ast_debug(1, "I should never be called!\n");
return &ast_null_frame;
} | false | false | false | false | false | 0 |
udc_free_request(struct usb_ep *usbep, struct usb_request *usbreq)
{
struct udc_ep *ep;
struct udc_request *req;
if (!usbep || !usbreq)
return;
ep = container_of(usbep, struct udc_ep, ep);
req = container_of(usbreq, struct udc_request, req);
VDBG(ep->dev, "free_req req=%p\n", req);
BUG_ON(!list_empty(&req->queue));
if (req->td_data) {
VDBG(ep->dev, "req->td_data=%p\n", req->td_data);
/* free dma chain if created */
if (req->chain_len > 1)
udc_free_dma_chain(ep->dev, req);
pci_pool_free(ep->dev->data_requests, req->td_data,
req->td_phys);
}
kfree(req);
} | false | false | false | false | false | 0 |
davicom_reset(struct nic *nic)
{
unsigned long to;
whereami("davicom_reset\n");
/* Stop Tx and RX */
outl(inl(ioaddr + CSR6) & ~0x00002002, ioaddr + CSR6);
/* Reset the chip, holding bit 0 set at least 50 PCI cycles. */
outl(0x00000001, ioaddr + CSR0);
davicom_wait(TICKS_PER_SEC);
/* TX/RX descriptor burst */
outl(0x0C00000, ioaddr + CSR0); /* Sten 10/9 */
/* set up transmit and receive descriptors */
davicom_init_chain(nic); /* Sten 10/9 */
/* Point to receive descriptor */
outl(virt_to_bus(&rxd[0]), ioaddr + CSR3);
outl(virt_to_bus(&txd[0]), ioaddr + CSR4); /* Sten 10/9 */
/* According phyxcer media mode to set CR6,
DM9102/A phyxcer can auto-detect media mode */
davicom_media_chk(nic);
/* Prepare Setup Frame Sten 10/9 */
txd[TxPtr].buf1sz = 192;
txd[TxPtr].control = 0x024; /* SF/CE */
txd[TxPtr].status = 0x80000000; /* Give ownership to device */
/* Start Tx */
outl(inl(ioaddr + CSR6) | 0x00002000, ioaddr + CSR6);
/* immediate transmit demand */
outl(0, ioaddr + CSR1);
to = currticks() + TX_TIME_OUT;
while ((txd[TxPtr].status & 0x80000000) && (currticks() < to)) /* Sten 10/9 */
/* wait */ ;
if (currticks() >= to) {
DBG ("TX Setup Timeout!\n");
}
/* Point to next TX descriptor */
TxPtr = (++TxPtr >= NTXD) ? 0:TxPtr; /* Sten 10/9 */
DBG("txd.status = %lX\n", txd[TxPtr].status);
DBG("ticks = %ld\n", currticks() - (to - TX_TIME_OUT));
DBG_MORE();
/* enable RX */
outl(inl(ioaddr + CSR6) | 0x00000002, ioaddr + CSR6);
/* immediate poll demand */
outl(0, ioaddr + CSR2);
} | false | false | false | false | false | 0 |
add_message(game *g, tut_lesson lesson)
{
// Cycle through intro lessons
if (lesson == LESSON_INTRO) {
while (lesson != NUM_LESSONS && tutorials_seen[lesson]) {
switch (lesson) {
case LESSON_INTRO: lesson = LESSON_MOVE; break;
case LESSON_MOVE: lesson = LESSON_LOOK; break;
case LESSON_LOOK: lesson = NUM_LESSONS; break;
}
}
if (lesson == NUM_LESSONS)
return;
}
if (tutorials_seen[lesson])
return;
tutorials_seen[lesson] = true;
popup_top(tut_text[lesson].c_str());
g->refresh_all();
} | false | false | false | false | false | 0 |
node_set_vendor(gnutella_node_t *n, const char *vendor)
{
char *wbuf = NULL;
size_t size = 0;
if (n->flags & NODE_F_FAKE_NAME) {
size = w_concat_strings(&wbuf, "!", vendor, (void *) 0);
} else {
static const char full[] = "Morpheus";
bool fix;
/*
* Morpheus names its servents as "morph350" or "morph461" and
* this perturbs the anti-monopoly features by making them appear
* as all different whereas they are really incarnations of the
* same servent. Normalize their name.
*/
fix = is_strcaseprefix(vendor, "morph") &&
0 != ascii_strcmp_delimit(vendor, full, " /");
if (fix)
size = w_concat_strings(&wbuf, full, " (", vendor, ")", (void *) 0);
}
atom_str_change(&n->vendor, lazy_iso8859_1_to_utf8(wbuf ? wbuf : vendor));
if (wbuf) {
wfree(wbuf, size);
wbuf = NULL;
}
node_fire_node_info_changed(n);
} | false | false | false | false | false | 0 |
ensure_nonzero_step_increments (ETableFieldChooser *etfc)
{
GtkAdjustment *va, *ha;
va = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (etfc->canvas));
ha = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (etfc->canvas));
/*
it looks pretty complicated to get height of column header
so use 16 pixels which should be OK
*/
if (va)
gtk_adjustment_set_step_increment (va, 16.0);
if (ha)
gtk_adjustment_set_step_increment (ha, 16.0);
} | false | false | false | false | false | 0 |
FcStringIsConst (const FcChar8 *string,
const FcStringConst *c,
int nc)
{
int i;
for (i = 0; i < nc; i++)
if (FcStrCmpIgnoreBlanksAndCase (string, c[i].name) == 0)
return c[i].value;
return -1;
} | false | false | false | false | false | 0 |
make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3)
{
expr_t *e;
e = xmalloc(sizeof(expr_t));
e->type = type;
e->ref = expr1;
e->u.ext = expr2;
e->ext2 = expr3;
e->is_const = FALSE;
/* check for compile-time optimization */
if (expr1->is_const && expr2->is_const && expr3->is_const)
{
e->is_const = TRUE;
switch (type)
{
case EXPR_COND:
e->cval = expr1->cval ? expr2->cval : expr3->cval;
break;
default:
e->is_const = FALSE;
break;
}
}
return e;
} | false | false | false | false | false | 0 |
dialog_child_set(gpointer data, const gchar *key, gpointer value)
{
struct dialog_pak *dialog = data;
if (!dialog->children)
dialog->children = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
/* use replace, so old g_strdup() key gets freed */
g_hash_table_replace(dialog->children, g_strdup(key), value);
} | false | false | false | false | false | 0 |
mulawdec_sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstMuLawDec *mulawdec;
GstStructure *structure;
int rate, channels;
gboolean ret;
GstCaps *outcaps;
mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad));
structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_int (structure, "rate", &rate);
ret = ret && gst_structure_get_int (structure, "channels", &channels);
if (!ret)
return FALSE;
outcaps = gst_caps_new_simple ("audio/x-raw-int",
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, TRUE,
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, channels, NULL);
ret = gst_pad_set_caps (mulawdec->srcpad, outcaps);
gst_caps_unref (outcaps);
if (ret) {
GST_DEBUG_OBJECT (mulawdec, "rate=%d, channels=%d", rate, channels);
mulawdec->rate = rate;
mulawdec->channels = channels;
}
return ret;
} | false | false | false | false | false | 0 |
config_param_val_bool (char *val, int *res) {
if (val == NULL) return 0;
if (
strcasecmp(val, CFG_BOOL_ON) == 0 ||
strcasecmp(val, "yes") == 0 ||
strcasecmp(val, "y") == 0 ||
strcasecmp(val, "true") == 0 ||
strcasecmp(val, "t") == 0 ||
strcasecmp(val, "1") == 0) {
*res = 1;
}
return 1;
} | false | false | false | false | false | 0 |
main (int argc, char **argv)
{
rtx desc;
max_opno = -1;
progname = "genpeep";
if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genpeep'\n\
from the machine description file `md'. */\n\n");
printf ("#include \"config.h\"\n");
printf ("#include \"system.h\"\n");
printf ("#include \"coretypes.h\"\n");
printf ("#include \"tm.h\"\n");
printf ("#include \"insn-config.h\"\n");
printf ("#include \"tree.h\"\n");
printf ("#include \"varasm.h\"\n");
printf ("#include \"stor-layout.h\"\n");
printf ("#include \"calls.h\"\n");
printf ("#include \"rtl.h\"\n");
printf ("#include \"tm_p.h\"\n");
printf ("#include \"regs.h\"\n");
printf ("#include \"output.h\"\n");
printf ("#include \"recog.h\"\n");
printf ("#include \"except.h\"\n");
printf ("#include \"function.h\"\n");
printf ("#include \"diagnostic-core.h\"\n");
printf ("#include \"flags.h\"\n");
printf ("#include \"tm-constrs.h\"\n\n");
printf ("#ifdef HAVE_peephole\n");
printf ("extern rtx peep_operand[];\n\n");
printf ("#define operands peep_operand\n\n");
printf ("rtx\npeephole (rtx ins1)\n{\n");
printf (" rtx insn ATTRIBUTE_UNUSED, x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
/* Early out: no peepholes for insns followed by barriers. */
printf (" if (NEXT_INSN (ins1)\n");
printf (" && BARRIER_P (NEXT_INSN (ins1)))\n");
printf (" return 0;\n\n");
/* Read the machine description. */
while (1)
{
int line_no;
int insn_code_number;
desc = read_md_rtx (&line_no, &insn_code_number);
if (desc == NULL)
break;
if (GET_CODE (desc) == DEFINE_PEEPHOLE)
gen_peephole (desc, insn_code_number);
}
printf (" return 0;\n}\n\n");
if (max_opno == -1)
max_opno = 1;
printf ("rtx peep_operand[%d];\n", max_opno + 1);
printf ("#endif\n");
fflush (stdout);
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
} | false | false | false | false | false | 0 |
count_ops (const char *p)
{
int n = 0 ;
while (*p) {
if (*p == '+' || *p == '-') n++;
if (*p == '=') break;
p++;
}
return n;
} | false | false | false | false | false | 0 |
size() const
{
// SFB: Why is d->key.size() used when size() returns the length in UniChars and not UTF-8?
int result = 8 + d->key.size() /* d->key.data(String::UTF8).size() */ + 1;
switch (d->type) {
case Text:
if(d->text.size()) {
StringList::ConstIterator it = d->text.begin();
result += it->data(String::UTF8).size();
it++;
for(; it != d->text.end(); ++it)
result += 1 + it->data(String::UTF8).size();
}
break;
case Binary:
case Locator:
result += d->value.size();
break;
}
return result;
} | false | false | false | false | false | 0 |
pack_loc (char **buf, LocMsg *lmsg)
{
char *ptr;
int len;
len = 4 + 4 + (lmsg->file ? strlen (lmsg->file) : 0) + 4;
*buf = ptr = emalloc (len);
pack_type (&ptr, CK_MSG_LOC);
pack_str (&ptr, lmsg->file);
pack_int (&ptr, lmsg->line);
return len;
} | false | false | false | false | false | 0 |
soap_recv_fault(struct soap *soap)
{ register int status = soap->error;
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Receiving SOAP Fault\n"));
soap->error = SOAP_OK;
if (soap_getfault(soap))
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Error: soap_get_soapfault() failed. Is this a SOAP message at all?\n"));
*soap_faultcode(soap) = (soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client");
soap->error = status;
soap_set_fault(soap);
}
else
{ register const char *s = *soap_faultcode(soap);
if (!soap_match_tag(soap, s, "SOAP-ENV:Server") || !soap_match_tag(soap, s, "SOAP-ENV:Receiver"))
status = SOAP_SVR_FAULT;
else if (!soap_match_tag(soap, s, "SOAP-ENV:Client") || !soap_match_tag(soap, s, "SOAP-ENV:Sender"))
status = SOAP_CLI_FAULT;
else if (!soap_match_tag(soap, s, "SOAP-ENV:MustUnderstand"))
status = SOAP_MUSTUNDERSTAND;
else if (!soap_match_tag(soap, s, "SOAP-ENV:VersionMismatch"))
status = SOAP_VERSIONMISMATCH;
else
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Fault code %s\n", s));
status = SOAP_FAULT;
}
if (soap_body_end_in(soap)
|| soap_envelope_end_in(soap)
|| soap_end_recv(soap))
return soap_closesock(soap);
soap->error = status;
}
return soap_closesock(soap);
} | false | false | false | false | false | 0 |
push_base_cleanups (void)
{
tree binfo, base_binfo;
int i;
tree member;
tree expr;
VEC(tree,gc) *vbases;
/* Run destructors for all virtual baseclasses. */
if (CLASSTYPE_VBASECLASSES (current_class_type))
{
tree cond = (condition_conversion
(build2 (BIT_AND_EXPR, integer_type_node,
current_in_charge_parm,
integer_two_node)));
/* The CLASSTYPE_VBASECLASSES vector is in initialization
order, which is also the right order for pushing cleanups. */
for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
VEC_iterate (tree, vbases, i, base_binfo); i++)
{
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo)))
{
expr = build_special_member_call (current_class_ref,
base_dtor_identifier,
NULL,
base_binfo,
(LOOKUP_NORMAL
| LOOKUP_NONVIRTUAL),
tf_warning_or_error);
expr = build3 (COND_EXPR, void_type_node, cond,
expr, void_zero_node);
finish_decl_cleanup (NULL_TREE, expr);
}
}
}
/* Take care of the remaining baseclasses. */
for (binfo = TYPE_BINFO (current_class_type), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo))
|| BINFO_VIRTUAL_P (base_binfo))
continue;
expr = build_special_member_call (current_class_ref,
base_dtor_identifier,
NULL, base_binfo,
LOOKUP_NORMAL | LOOKUP_NONVIRTUAL,
tf_warning_or_error);
finish_decl_cleanup (NULL_TREE, expr);
}
/* Don't automatically destroy union members. */
if (TREE_CODE (current_class_type) == UNION_TYPE)
return;
for (member = TYPE_FIELDS (current_class_type); member;
member = DECL_CHAIN (member))
{
tree this_type = TREE_TYPE (member);
if (this_type == error_mark_node
|| TREE_CODE (member) != FIELD_DECL
|| DECL_ARTIFICIAL (member))
continue;
if (ANON_UNION_TYPE_P (this_type))
continue;
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (this_type))
{
tree this_member = (build_class_member_access_expr
(current_class_ref, member,
/*access_path=*/NULL_TREE,
/*preserve_reference=*/false,
tf_warning_or_error));
expr = build_delete (this_type, this_member,
sfk_complete_destructor,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
0, tf_warning_or_error);
finish_decl_cleanup (NULL_TREE, expr);
}
}
} | false | false | false | false | false | 0 |
compute_ID( str *name )
{
char *p;
unsigned short id;
id=0;
for( p=name->s+name->len-1 ; p>=name->s ; p-- )
id ^= *p;
return id;
} | false | false | false | false | true | 1 |
draw_select( FL_OBJECT * obj )
{
FL_COLOR color;
FLI_SELECT_SPEC *sp = obj->spec;
int bw = FL_abs( obj->bw ) + ( obj->bw > 0 );
int box_w = 0;
color = ( obj->belowmouse && sp->popup ) ? obj->col2 : obj->col1;
/* Draw the box of the object, possibly lowered if the object is pushed */
if ( FL_IS_UPBOX( obj->boxtype ) && obj->pushed )
fl_drw_box( FL_TO_DOWNBOX( obj->boxtype ), obj->x, obj->y, obj->w,
obj->h, color, obj->bw );
else
fl_drw_box( obj->boxtype, obj->x, obj->y, obj->w, obj->h, color,
obj->bw );
/* The FL_MENU_SELECT type has a small raised box on the right hand
side */
if ( obj->type == FL_MENU_SELECT )
{
int box_x,
box_y,
box_h = FL_max( 6 + ( obj->bw > 0 ), 0.1 * obj->h ),
box_bw = - FL_max( bw - ( obj->bw > 0 ), 1 );
box_w = FL_max( 0.11 * obj->w, 13 );
if ( box_w <= obj->w - 2 * bw
&& box_h <= obj->h - 2 * bw
&& box_w >= 2 * box_bw
&& box_h >= 2 * box_bw )
{
box_x = obj->x + obj->w -box_w - bw - 2;
box_y = obj->y + ( obj->h - box_h ) / 2;
fl_drw_box( FL_UP_BOX, box_x, box_y, box_w, box_h, obj->col1,
box_bw );
box_w += 3;
}
}
if ( sp->sel && sp->sel->label && *sp->sel->label )
{
fl_set_text_clipping( obj->x + bw, obj->y + bw,
obj->w - box_w - 2 * bw, obj->h - 2 * bw );
fl_drw_text( sp->align, obj->x + bw, obj->y + bw,
obj->w - box_w - 2 * bw, obj->h - 2 * bw,
sp->color, sp->style, sp->size, sp->sel->label );
fl_unset_text_clipping( );
}
} | false | false | false | false | false | 0 |
mlx4_en_change_mcast_lb(struct mlx4_en_priv *priv, struct mlx4_qp *qp,
int loopback)
{
int ret;
struct mlx4_update_qp_params qp_params;
memset(&qp_params, 0, sizeof(qp_params));
if (!loopback)
qp_params.flags = MLX4_UPDATE_QP_PARAMS_FLAGS_ETH_CHECK_MC_LB;
ret = mlx4_update_qp(priv->mdev->dev, qp->qpn,
MLX4_UPDATE_QP_ETH_SRC_CHECK_MC_LB,
&qp_params);
return ret;
} | false | false | false | false | false | 0 |
Verify(uint64_t iSizeofData, string* pstrProblem) const
{
uint64_t iCorrectSize = ComputeDataSize();
bool bResult = iCorrectSize == iSizeofData;
if (!bResult && pstrProblem != NULL) {
stringstream s;
s << "GeometryDataBlock::Verify: size mismatch. Should be " << iCorrectSize << " but parameter was " << iSizeofData << ".";
*pstrProblem = s.str();
}
return bResult;
} | false | false | false | false | false | 0 |
garmin_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count)
{
struct device *dev = &port->dev;
int pktid, pktsiz, len;
struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
__le32 *privpkt = (__le32 *)garmin_data_p->privpkt;
usb_serial_debug_data(dev, __func__, count, buf);
if (garmin_data_p->state == STATE_RESET)
return -EIO;
/* check for our private packets */
if (count >= GARMIN_PKTHDR_LENGTH) {
len = PRIVPKTSIZ;
if (count < len)
len = count;
memcpy(garmin_data_p->privpkt, buf, len);
pktsiz = getDataLength(garmin_data_p->privpkt);
pktid = getPacketId(garmin_data_p->privpkt);
if (count == (GARMIN_PKTHDR_LENGTH+pktsiz)
&& GARMIN_LAYERID_PRIVATE ==
getLayerId(garmin_data_p->privpkt)) {
dev_dbg(dev, "%s - processing private request %d\n",
__func__, pktid);
/* drop all unfinished transfers */
garmin_clear(garmin_data_p);
switch (pktid) {
case PRIV_PKTID_SET_MODE:
if (pktsiz != 4)
return -EINVPKT;
garmin_data_p->mode = __le32_to_cpu(privpkt[3]);
dev_dbg(dev, "%s - mode set to %d\n",
__func__, garmin_data_p->mode);
break;
case PRIV_PKTID_INFO_REQ:
priv_status_resp(port);
break;
case PRIV_PKTID_RESET_REQ:
process_resetdev_request(port);
break;
case PRIV_PKTID_SET_DEF_MODE:
if (pktsiz != 4)
return -EINVPKT;
initial_mode = __le32_to_cpu(privpkt[3]);
dev_dbg(dev, "%s - initial_mode set to %d\n",
__func__,
garmin_data_p->mode);
break;
}
return count;
}
}
if (garmin_data_p->mode == MODE_GARMIN_SERIAL) {
return gsp_receive(garmin_data_p, buf, count);
} else { /* MODE_NATIVE */
return nat_receive(garmin_data_p, buf, count);
}
} | false | true | false | false | false | 1 |
fillContains(const FloatPoint& point, bool requiresFill) const
{
if (m_path.isEmpty())
return false;
if (requiresFill && !SVGPaintServer::fillPaintServer(style(), this))
return false;
return m_path.contains(point, style()->svgStyle()->fillRule());
} | false | false | false | false | false | 0 |
updateRange(FXint sr,FXint er,FXint sc,FXint ec) const {
FXint xl,xr,yt,yb;
if(sr<0 || sc<0 || nrows<=er || ncols<=ec){ fxerror("%s::updateRange: index out of range.\n",getClassName()); }
if(sr<=er && sc<=ec){
xl=colHeader->getX()+colHeader->getItemOffset(sc);
xr=colHeader->getX()+colHeader->getItemOffset(ec)+colHeader->getItemSize(ec);
yt=rowHeader->getY()+rowHeader->getItemOffset(sr);
yb=rowHeader->getY()+rowHeader->getItemOffset(er)+rowHeader->getItemSize(er);
update(xl,yt,xr-xl+vgrid,yb-yt+hgrid);
}
} | false | false | false | false | false | 0 |
xfersetup_generic(
const char *zTitle, /* Page title */
const char *zDbField, /* Configuration field being edited */
const char *zDfltValue, /* Default text value */
const char *zDesc, /* Description of this field */
char *(*xText)(const char*), /* Validity test or NULL */
void (*xRebuild)(void), /* Run after successful update */
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
login_needed();
}
if( P("setup") ){
cgi_redirect("xfersetup");
}
isSubmit = P("submit")!=0;
z = P("x");
if( z==0 ){
z = db_get(zDbField, (char*)zDfltValue);
}
style_header("Edit %s", zTitle);
if( P("clear")!=0 ){
login_verify_csrf_secret();
db_unset(zDbField, 0);
if( xRebuild ) xRebuild();
z = zDfltValue;
}else if( isSubmit ){
char *zErr = 0;
login_verify_csrf_secret();
if( xText && (zErr = xText(z))!=0 ){
cgi_printf("<p class=\"xfersetupError\">ERROR: %h</p>\n",(zErr));
}else{
db_set(zDbField, z, 0);
if( xRebuild ) xRebuild();
cgi_redirect("xfersetup");
}
}
cgi_printf("<form action=\"%s/%s\" method=\"post\"><div>\n",(g.zTop),(g.zPath));
login_insert_csrf_secret();
cgi_printf("<p>%s</p>\n"
"<textarea name=\"x\" rows=\"%d\" cols=\"80\">%h</textarea>\n"
"<blockquote><p>\n"
"<input type=\"submit\" name=\"submit\" value=\"Apply Changes\" />\n"
"<input type=\"submit\" name=\"clear\" value=\"Revert To Default\" />\n"
"<input type=\"submit\" name=\"setup\" value=\"Cancel\" />\n"
"</p></blockquote>\n"
"</div></form>\n"
"<hr />\n",(zDesc),(height),(z));
if ( zDfltValue ){
cgi_printf("<h2>Default %s</h2>\n"
"<blockquote><pre>\n"
"%h\n"
"</pre></blockquote>\n",(zTitle),(zDfltValue));
}
style_footer();
} | false | false | false | false | false | 0 |
yytbl_dmap_lookup (struct yytbl_dmap * dmap, int id )
{
while (dmap->dm_id)
if (dmap->dm_id == id)
return dmap;
else
dmap++;
return NULL;
} | false | false | false | false | false | 0 |
M_FlyCheck (edict_t * self)
{
if (self->waterlevel)
return;
if (random () > 0.5)
return;
self->think = M_FliesOn;
self->nextthink = level.time + 5 + 10 * random ();
} | false | false | false | false | false | 0 |
popupdead_close()
{
if ( !Popupdead_active ) {
return;
}
gamesnd_play_iface(SND_POPUP_DISAPPEAR);
Popupdead_window.destroy();
game_flush();
Popupdead_active = 0;
Popupdead_skip_active = 0;
Popupdead_skip_already_shown = 0;
} | false | false | false | false | false | 0 |
dent(int n)
{
if(sindent == NULL) {
sindent = (char*)ocmalloc(102);
MEMCHECK(sindent,NULL);
memset((void*)sindent,(int)' ',(size_t)101);
sindent[101] = '\0';
}
if(n > 100) n = 100;
return sindent+(100-n);
} | false | false | false | false | false | 0 |
trans_select_break(bool do_not_add_pos)
{
BEGIN_NO_BREAK
{
if (current_ctrl->value)
{
if (!do_not_add_pos)
{
control_add_current_pos();
CODE_jump();
}
CODE_jump_length(current_ctrl->value, CODE_get_current_pos());
}
}
END_NO_BREAK
} | false | false | false | false | false | 0 |
access(uint param){
uint mult=0;
register uint j;
uint partialSum=0;
uint ini = param-1;
byte readByte;
uint cont,pos, rankini;
partialSum=0;
j=0;
pos=levelsIndex[j]+ini;
mult=0;
cont = iniLevel[j]+ini*base_bits[j];
readByte = bitread(levels,cont,base_bits[j]);
while((!bitget(((BitSequenceRG *)bS)->data,pos))){
rankini = bS->rank1(levelsIndex[j]+ini-1) - rankLevels[j];
ini = ini-rankini;
partialSum = partialSum+ (readByte<<mult);
mult+=base_bits[j];
j++;
cont = iniLevel[j]+ini*base_bits[j];
pos=levelsIndex[j]+ini;
readByte = bitread(levels,cont,base_bits[j]);
if(j==(uint)nLevels-1)
break;
}
partialSum = partialSum + (readByte<<mult) + tablebase[j];
return partialSum;
} | false | false | false | false | false | 0 |
LexSingleQuote() {
int CurChar = getNextChar();
if (CurChar == '\\')
CurChar = getNextChar();
if (CurChar == EOF)
return ReturnError(TokStart, "unterminated single quote");
CurChar = getNextChar();
if (CurChar != '\'')
return ReturnError(TokStart, "single quote way too long");
// The idea here being that 'c' is basically just an integral
// constant.
StringRef Res = StringRef(TokStart,CurPtr - TokStart);
long long Value;
if (Res.startswith("\'\\")) {
char theChar = Res[2];
switch (theChar) {
default: Value = theChar; break;
case '\'': Value = '\''; break;
case 't': Value = '\t'; break;
case 'n': Value = '\n'; break;
case 'b': Value = '\b'; break;
}
} else
Value = TokStart[1];
return AsmToken(AsmToken::Integer, Res, Value);
} | false | false | false | false | false | 0 |
H5O_get_rc(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(loc);
HDassert(rc);
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Save the refcount for the object header */
*rc = oh->nlink;
done:
/* Release the object header */
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
FUNC_LEAVE_NOAPI(ret_value)
} | false | false | false | false | false | 0 |
do_spec (spec)
const char *spec;
{
int value;
value = do_spec_2 (spec);
/* Force out any unfinished command.
If -pipe, this forces out the last command if it ended in `|'. */
if (value == 0)
{
if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
argbuf_index--;
set_collect_gcc_options ();
if (argbuf_index > 0)
value = execute ();
}
return value;
} | false | false | false | false | false | 0 |
c2_find_qpn(struct c2_dev *c2dev, int qpn)
{
unsigned long flags;
struct c2_qp *qp;
spin_lock_irqsave(&c2dev->qp_table.lock, flags);
qp = idr_find(&c2dev->qp_table.idr, qpn);
spin_unlock_irqrestore(&c2dev->qp_table.lock, flags);
return qp;
} | false | false | false | false | false | 0 |
auth_gssapi_mic(ssh_session session, const char *user, const char *principal, void *userdata){
(void)userdata;
client_creds = ssh_gssapi_get_creds(session);
printf("Authenticating user %s with gssapi principal %s\n",user, principal);
if (client_creds != NULL)
printf("Received some gssapi credentials\n");
else
printf("Not received any forwardable creds\n");
printf("authenticated\n");
authenticated = 1;
username = strdup(principal);
return SSH_AUTH_SUCCESS;
} | false | false | false | false | false | 0 |
loadMeta(const QDomElement &i, const QString &dir)
{
Q_UNUSED(dir);
for (QDomNode node = i.firstChild(); !node.isNull(); node = node.nextSibling()) {
QDomElement e = node.toElement();
if( e.isNull() )
continue;
QString tag = e.tagName();
if ( tag == "name" ) {
name = e.text();
}
else if ( tag == "version" ) {
version = e.text();
}
else if ( tag == "description" ) {
description = e.text();
}
else if ( tag == "author" ) {
QString n = e.text();
QString tmp = "<br> ";
if ( !e.attribute("email").isEmpty() ) {
QString s = e.attribute("email");
n += tmp + QString("Email: <a href='mailto:%1'>%2</a>").arg( s ).arg( s );
}
if ( !e.attribute("jid").isEmpty() ) {
QString s = e.attribute("jid");
n += tmp + QString("JID: <a href='jabber:%1'>%2</a>").arg( s ).arg( s );
}
if ( !e.attribute("www").isEmpty() ) {
QString s = e.attribute("www");
n += tmp + QString("WWW: <a href='%1'>%2</a>").arg( s ).arg( s );
}
authors += n;
}
else if ( tag == "creation" ) {
creation = e.text();
}
else if ( tag == "home" ) {
homeUrl = e.text();
}
}
} | false | false | false | false | false | 0 |
rsc_next_conj(struct rsc *rsc)
{
unsigned int i;
for (i = 0; (i < 8) && (!(rsc->msr & (0x1 << i))); )
i++;
rsc->conj += (AUDIO_SLOT_BLOCK_NUM >> i);
return rsc->conj;
} | false | false | false | false | false | 0 |
Stmt_tadd(CTX ctx, kStmtExpr *stmt, tkitr_t *itr, knh_FisTerm f, const char *whatis)
{
if(STT_(stmt) == STT_ERR) return;
if(ITR_hasNext(itr) && f(ITR_tk(itr))) {
knh_Stmt_add(ctx, stmt, ITR_nextTK(itr));
}
else {
_ERROR(ctx, stmt, itr, whatis);
}
} | false | false | false | false | false | 0 |
findstr(const char *hay, size_t slen, const char *needle)
{
const char *ret = NULL;
if(hay && slen && needle) {
size_t nlen=strlen(needle);
if(nlen<=slen) {
size_t smax = slen-nlen+1;
size_t i;
const char *sp = hay;
for(i=0;i<smax;++i) {
if(sheadof(needle,sp+i)) {
ret = sp+i;
break;
}
}
}
}
return ret;
} | false | false | false | false | false | 0 |
usbScanDevicesInBus(unsigned bus, const char *bus_name,
uint16_t vid, uint16_t pid,
USBFindDevicesCallback callback, void *data)
{
DIR *dir;
char path[NAME_MAX+1];
struct dirent *de;
USBDevice *dev;
char *endptr;
const USBDeviceDescriptor *ddesc;
int stop = 0;
unsigned idVendor, idProduct;
snprintf(path, sizeof(path), "%s/%s", usbRoot, bus_name);
dir = opendir(path);
if (!dir)
return stop;
while (!stop && (de = readdir(dir))) {
int devnum = strtol(de->d_name, &endptr, 10);
if (*endptr != '\0' || devnum < 0)
continue;
dev = usbGetDevice(usbLocation(bus, devnum));
ddesc = usbGetDeviceDescriptor(dev);
if (!ddesc) {
usbFreeDevice(dev);
continue;
}
idVendor = ddesc->idVendor;
idProduct = ddesc->idProduct;
usbFreeDevice(dev);
if ((vid == 0 || (idVendor == vid)) &&
(pid == 0 || (idProduct == pid)))
stop = callback(usbLocation(bus, devnum), data);
}
closedir(dir);
return stop;
} | false | false | false | false | false | 0 |
u_wipe_engr(cnt)
register int cnt;
{
if (can_reach_floor())
wipe_engr_at(u.ux, u.uy, cnt);
} | false | false | false | false | false | 0 |
cc_wacom_nav_button_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
CcWacomNavButton *nav = CC_WACOM_NAV_BUTTON (object);
CcWacomNavButtonPrivate *priv = nav->priv;
switch (property_id) {
case PROP_NOTEBOOK:
if (priv->notebook) {
g_signal_handler_disconnect (priv->notebook, priv->page_added_id);
g_signal_handler_disconnect (priv->notebook, priv->page_removed_id);
g_signal_handler_disconnect (priv->notebook, priv->page_switched_id);
g_object_unref (priv->notebook);
}
priv->notebook = g_value_dup_object (value);
priv->page_added_id = g_signal_connect (G_OBJECT (priv->notebook), "page-added",
G_CALLBACK (pages_changed), nav);
priv->page_removed_id = g_signal_connect (G_OBJECT (priv->notebook), "page-removed",
G_CALLBACK (pages_changed), nav);
priv->page_switched_id = g_signal_connect (G_OBJECT (priv->notebook), "notify::page",
G_CALLBACK (page_switched), nav);
cc_wacom_nav_button_update (nav);
break;
case PROP_IGNORE_FIRST:
priv->ignore_first_page = g_value_get_boolean (value);
cc_wacom_nav_button_update (nav);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
} | false | false | false | false | false | 0 |
GC_malloc(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
void *result;
void **tiny_fl;
# if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC)
GC_key_t k = GC_thread_key;
if (EXPECT(0 == k, FALSE)) {
/* We haven't yet run GC_init_parallel. That means */
/* we also aren't locking, so this is fairly cheap. */
return GC_core_malloc(bytes);
}
tsd = GC_getspecific(k);
# else
tsd = GC_getspecific(GC_thread_key);
# endif
# if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS)
if (EXPECT(0 == tsd, FALSE)) {
return GC_core_malloc(bytes);
}
# endif
GC_ASSERT(GC_is_initialized);
GC_ASSERT(GC_is_thread_tsd_valid(tsd));
tiny_fl = ((GC_tlfs)tsd) -> normal_freelists;
GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
NORMAL, GC_core_malloc(bytes), obj_link(result)=0);
# ifdef LOG_ALLOCS
GC_err_printf("GC_malloc(%u) = %p : %u\n",
(unsigned)bytes, result, (unsigned)GC_gc_no);
# endif
return result;
} | false | false | false | false | false | 0 |
H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void *data)
{
hid_t did;
/* Open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Read */
if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto out;
/* End access to the dataset and release resources used by it. */
if(H5Dclose(did))
return -1;
return 0;
out:
H5Dclose(did);
return -1;
} | false | false | false | false | false | 0 |
j_on_state_handler(jconn conn, int state)
{
int previous_state;
JABBER_Conn *JConn = NULL;
char buff[4096];
JConn = JCfindConn(conn);
previous_state = JConn->state;
eb_debug(DBG_JBR, "Entering: new state: %i previous_state: %i\n", state,
previous_state);
switch (state) {
case JCONN_STATE_OFF:
if (previous_state != JCONN_STATE_OFF) {
eb_debug(DBG_JBR,
"The Jabber server has disconnected you: %i\n",
previous_state);
snprintf(buff, 4096,
_("The Jabber server %s has disconnected you."),
JCgetServerName(JConn));
JABBERError(buff, _("Disconnect"));
JABBERLogout(JConn);
ay_connection_input_remove(JConn->listenerID);
/* FIXME: Do we need to free anything? */
j_remove_agents_from_host(JCgetServerName(JConn));
} else if (!JConn->conn
|| JConn->conn->state == JCONN_STATE_OFF) {
snprintf(buff, 4096,
_("Connection to the jabber server %s failed!"),
conn->user->server);
JABBERError(buff, _("Jabber server not responding"));
JABBERLogout(JConn);
jab_delete(JConn->conn);
}
break;
case JCONN_STATE_CONNECTED:
eb_debug(DBG_JBR, "JCONN_STATE_CONNECTED\n");
break;
case JCONN_STATE_AUTH:
eb_debug(DBG_JBR, "JCONN_STATE_AUTH\n");
break;
case JCONN_STATE_ON:
eb_debug(DBG_JBR, "JCONN_STATE_ON\n");
if (previous_state == JCONN_STATE_CONNECTED) {
jab_auth(JConn->conn);
JConn->listenerID =
ay_connection_input_add(JConn->connection,
EB_INPUT_READ, jabber_callback_handler, JConn);
eb_debug(DBG_JBR, "*** ListenerID: %i\n",
JConn->listenerID);
JABBERConnected(JConn);
}
break;
default:
eb_debug(DBG_JBR, "UNKNOWN state: %i\n", state);
break;
}
JConn->state = state;
eb_debug(DBG_JBR, "Leaving\n");
} | false | false | false | false | false | 0 |
knh_DictMap_getNULL(CTX ctx, kDictMap *m, kbytes_t key)
{
knh_dmap_t *dmap = (knh_dmap_t*)m->mapptr;
kindex_t loc = dmap_index(dmap, 0, dmap->sorted, key);
if(loc == -1) {
loc = dmap_index(dmap, dmap->sorted, dmap->size, key);
}
return (loc == -1) ? NULL : dmap->dentry[loc].value;
} | false | false | false | false | false | 0 |
m68hc11_eq_compare_operator (op, mode)
register rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
return GET_CODE (op) == EQ || GET_CODE (op) == NE;
} | false | false | false | false | false | 0 |
fmgr_internal_validator(PG_FUNCTION_ARGS)
{
Oid funcoid = PG_GETARG_OID(0);
HeapTuple tuple;
bool isnull;
Datum tmp;
char *prosrc;
/*
* We do not honor check_function_bodies since it's unlikely the function
* name will be found later if it isn't there now.
*/
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
if (isnull)
elog(ERROR, "null prosrc");
prosrc = TextDatumGetCString(tmp);
if (fmgr_internal_function(prosrc) == InvalidOid)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("there is no built-in function named \"%s\"",
prosrc)));
ReleaseSysCache(tuple);
PG_RETURN_VOID();
} | false | false | false | false | false | 0 |
plain_account_init(FILE *fp)
{
char buf[BUFSIZE], *p, *q;
u32 tid;
int idx;
tid = 0;
while (fgets(buf, sizeof(buf), fp)) {
q = buf;
p = target_sep_string(&q);
if (!p || *p == '#')
continue;
if (!strcasecmp(p, "Target")) {
struct target *target;
tid = 0;
if (!(p = target_sep_string(&q)))
continue;
target = target_find_by_name(p);
if (target)
tid = target->tid;
} else if (!((idx = param_index_by_name(p, user_keys)) < 0)) {
char *name, *pass;
name = target_sep_string(&q);
pass = target_sep_string(&q);
if (plain_account_add(tid, idx, name, pass) < 0)
fprintf(stderr, "%s %s\n", name, pass);
}
}
return;
} | false | false | false | false | false | 0 |
H5P_get_driver_info(H5P_genplist_t *plist)
{
void *ret_value=NULL;
FUNC_ENTER_NOAPI(H5P_get_driver_info, NULL);
/* Get the current driver info */
if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
} else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
} else {
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list");
}
done:
FUNC_LEAVE_NOAPI(ret_value);
} | false | false | false | false | false | 0 |
nv_restore_phy ( struct forcedeth_private *priv )
{
u16 phy_reserved, mii_control;
if ( priv->phy_oui == PHY_OUI_REALTEK &&
priv->phy_model == PHY_MODEL_REALTEK_8201 ) {
mii_rw ( priv, priv->phyaddr, PHY_REALTEK_INIT_REG1,
PHY_REALTEK_INIT3 );
phy_reserved = mii_rw ( priv, priv->phyaddr,
PHY_REALTEK_INIT_REG2, MII_READ );
phy_reserved &= ~PHY_REALTEK_INIT_MSK1;
phy_reserved |= PHY_REALTEK_INIT8;
mii_rw ( priv, priv->phyaddr, PHY_REALTEK_INIT_REG2,
phy_reserved );
mii_rw ( priv, priv->phyaddr, PHY_REALTEK_INIT_REG1,
PHY_REALTEK_INIT1 );
/* restart auto negotiation */
mii_control = mii_rw ( priv, priv->phyaddr, MII_BMCR, MII_READ );
mii_control |= ( BMCR_ANRESTART | BMCR_ANENABLE );
mii_rw ( priv, priv->phyaddr, MII_BMCR, mii_control );
}
} | false | false | false | false | false | 0 |
GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a,
const GNUNET_HashCode * delta, GNUNET_HashCode * result)
{
int i;
for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
result->bits[i] = delta->bits[i] + a->bits[i];
} | false | false | false | false | false | 0 |
gnominv(
double x, /* (O) X projection coordinate */
double y, /* (O) Y projection coordinate */
double *lon, /* (I) Longitude */
double *lat) /* (I) Latitude */
{
double rh;
double z,sinz,cosz;
double con;
/* Inverse equations
-----------------*/
x -= false_easting;
y -= false_northing;
rh = sqrt(x * x + y * y);
z = atan(rh / R);
tsincos(z,&sinz,&cosz);
*lon = lon_center;
if (fabs(rh) <= EPSLN)
{
*lat = lat_center;
return(OK);
}
*lat = asinz(cosz * sin_p13 + (y * sinz * cos_p13) / rh);
con = fabs(lat_center) - HALF_PI;
if (fabs(con) <= EPSLN)
{
if (lat_center >= 0.0)
{
*lon = adjust_lon(lon_center + atan2(x, -y));
return(OK);
}
else
{
*lon = adjust_lon(lon_center - atan2(-x, y));
return(OK);
}
}
con = cosz - sin_p13 * sin(*lat);
if ((fabs(con) < EPSLN) && (fabs(x) < EPSLN))
return(OK);
*lon = adjust_lon(lon_center + atan2((x * sinz * cos_p13), (con * rh)));
return(OK);
} | false | false | false | false | false | 0 |
unixCurrentTime(unqlite_vfs *pVfs,Sytm *pOut)
{
struct tm *pTm;
time_t tt;
SXUNUSED(pVfs);
time(&tt);
pTm = gmtime(&tt);
if( pTm ){ /* Yes, it can fail */
STRUCT_TM_TO_SYTM(pTm,pOut);
}
return UNQLITE_OK;
} | false | false | false | false | false | 0 |
GetCoreClientStatus(CC_STATUS& ccs, bool bForce) {
wxString strMachine = wxEmptyString;
int iRetVal = 0;
if (IsConnected()) {
if (!m_bWaitingForRPC) { // Prevent recursive entry of RequestRPC()
#if USE_CACHE_TIMEOUTS
wxTimeSpan ts(wxDateTime::Now() - m_dtCachedCCStatusTimestamp);
if (ts.GetSeconds() >= (10 * CCSTATUS_RPC_INTERVAL)) bForce = true;
#endif
if (m_dtCachedCCStatusTimestamp.IsEqualTo(wxDateTime((time_t)0))) bForce = true;
}
if (bForce) {
m_dtCachedCCStatusTimestamp = wxDateTime::Now();
m_iGet_status_rpc_result = rpc.get_cc_status(ccs);
if (0 == iRetVal) {
status = ccs;
} else {
iRetVal = m_iGet_status_rpc_result;
}
} else {
ccs = status;
iRetVal = m_iGet_status_rpc_result;
}
if (m_iGet_status_rpc_result) {
m_pNetworkConnection->SetStateDisconnected();
} else {
if (ccs.manager_must_quit) {
GetConnectedComputerName(strMachine);
if (IsComputerNameLocal(strMachine)) {
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));
pFrame->Close(true);
}
}
}
} else {
iRetVal = -1;
}
return iRetVal;
} | false | false | false | false | false | 0 |
selinux_xfrm_skb_sid_ingress(struct sk_buff *skb,
u32 *sid, int ckall)
{
u32 sid_session = SECSID_NULL;
struct sec_path *sp = skb->sp;
if (sp) {
int i;
for (i = sp->len - 1; i >= 0; i--) {
struct xfrm_state *x = sp->xvec[i];
if (selinux_authorizable_xfrm(x)) {
struct xfrm_sec_ctx *ctx = x->security;
if (sid_session == SECSID_NULL) {
sid_session = ctx->ctx_sid;
if (!ckall)
goto out;
} else if (sid_session != ctx->ctx_sid) {
*sid = SECSID_NULL;
return -EINVAL;
}
}
}
}
out:
*sid = sid_session;
return 0;
} | false | false | false | false | false | 0 |
ekiga_main_window_init (EkigaMainWindow *mw)
{
mw->priv = new EkigaMainWindowPrivate ();
/* Accelerators */
mw->priv->accel = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (mw), mw->priv->accel);
g_object_unref (mw->priv->accel);
mw->priv->current_call = boost::shared_ptr<Ekiga::Call>();
mw->priv->calling_state = Standby;
for (int i = 0 ; i < NUM_SECTIONS ; i++)
mw->priv->toggle_buttons[i] = NULL;
} | false | false | false | false | false | 0 |
gia(A i,I r){R!r&&i&&i->t<Et?enc((I)i):(I)i;} | false | false | false | false | false | 0 |
event_alloc(void)
{
struct event *event = malloc(sizeof(struct event));
if (event) {
/* The new event is initialized with values that represents
* unset values: -1 for uid and pid and 0 (or NULL) for numbers
* and pointers. For example, event->end = 0 represents an
* unfinished event.
*/
memset(event, 0, sizeof(struct event));
event->uid = -1;
event->pid = -1;
}
return event;
} | false | false | false | false | false | 0 |
panel_separator_parent_set (GtkWidget *widget,
GtkWidget *previous_parent)
{
PanelSeparator *separator;
GtkWidget *parent;
separator = PANEL_SEPARATOR (widget);
parent = gtk_widget_get_parent (widget);
g_assert (!parent || PANEL_IS_WIDGET (parent));
separator->priv->panel = (PanelWidget *) parent;
} | false | false | false | false | false | 0 |
clean_resv_nick(const char *nick)
{
char tmpch;
int as = 0;
int q = 0;
int ch = 0;
if(*nick == '-' || IsDigit(*nick))
return 0;
while((tmpch = *nick++))
{
if(tmpch == '?' || tmpch == '@' || tmpch == '#')
q++;
else if(tmpch == '*')
as++;
else if(IsNickChar(tmpch))
ch++;
else
return 0;
}
if(!ch && as)
return 0;
return 1;
} | false | false | false | false | false | 0 |
jswrap_string_replace(JsVar *parent, JsVar *subStr, JsVar *newSubStr) {
JsVar *str = jsvAsString(parent, false);
subStr = jsvAsString(subStr, false);
newSubStr = jsvAsString(newSubStr, false);
int idx = jswrap_string_indexOf(parent, subStr, 0, false);
if (idx>=0) {
JsVar *newStr = jsvNewFromStringVar(str, 0, (size_t)idx);
jsvAppendStringVar(newStr, newSubStr, 0, JSVAPPENDSTRINGVAR_MAXLENGTH);
jsvAppendStringVar(newStr, str, (size_t)idx+jsvGetStringLength(subStr), JSVAPPENDSTRINGVAR_MAXLENGTH);
jsvUnLock(str);
str = newStr;
}
jsvUnLock(subStr);
jsvUnLock(newSubStr);
return str;
} | false | false | false | false | false | 0 |
drop_nlink(struct inode *inode)
{
WARN_ON(inode->i_nlink == 0);
inode->__i_nlink--;
if (!inode->i_nlink)
atomic_long_inc(&inode->i_sb->s_remove_count);
} | false | false | false | false | false | 0 |
DeleteThisItem(struct Item **liststart,struct Item *entry)
{ struct Item *ip, *sp;
if (entry != NULL)
{
if (entry->name != NULL)
{
free(entry->name);
}
sp = entry->next;
if (entry == *liststart)
{
*liststart = sp;
}
else
{
for (ip = *liststart; ip->next != entry; ip=ip->next)
{
}
ip->next = sp;
}
free((char *)entry);
}
} | false | false | false | false | false | 0 |
photo_populate (EContact *contact,
struct berval **ber_values)
{
if (ber_values && ber_values[0]) {
EContactPhoto photo;
photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
photo.data.inlined.mime_type = NULL;
photo.data.inlined.data = (guchar *) ber_values[0]->bv_val;
photo.data.inlined.length = ber_values[0]->bv_len;
e_contact_set (contact, E_CONTACT_PHOTO, &photo);
}
} | false | true | false | false | false | 1 |
iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
{
struct iwl_bt_iterator_data data = {
.mvm = mvm,
.notif = &mvm->last_bt_notif_old,
};
struct iwl_bt_coex_ci_cmd_old cmd = {};
u8 ci_bw_idx;
/* Ignore updates if we are in force mode */
if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
return;
rcu_read_lock();
ieee80211_iterate_active_interfaces_atomic(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_bt_notif_iterator, &data);
if (data.primary) {
struct ieee80211_chanctx_conf *chan = data.primary;
if (WARN_ON(!chan->def.chan)) {
rcu_read_unlock();
return;
}
if (chan->def.width < NL80211_CHAN_WIDTH_40) {
ci_bw_idx = 0;
cmd.co_run_bw_primary = 0;
} else {
cmd.co_run_bw_primary = 1;
if (chan->def.center_freq1 >
chan->def.chan->center_freq)
ci_bw_idx = 2;
else
ci_bw_idx = 1;
}
cmd.bt_primary_ci =
iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
cmd.primary_ch_phy_id = *((u16 *)data.primary->drv_priv);
}
if (data.secondary) {
struct ieee80211_chanctx_conf *chan = data.secondary;
if (WARN_ON(!data.secondary->def.chan)) {
rcu_read_unlock();
return;
}
if (chan->def.width < NL80211_CHAN_WIDTH_40) {
ci_bw_idx = 0;
cmd.co_run_bw_secondary = 0;
} else {
cmd.co_run_bw_secondary = 1;
if (chan->def.center_freq1 >
chan->def.chan->center_freq)
ci_bw_idx = 2;
else
ci_bw_idx = 1;
}
cmd.bt_secondary_ci =
iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
cmd.secondary_ch_phy_id = *((u16 *)data.secondary->drv_priv);
}
rcu_read_unlock();
/* Don't spam the fw with the same command over and over */
if (memcmp(&cmd, &mvm->last_bt_ci_cmd_old, sizeof(cmd))) {
if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0,
sizeof(cmd), &cmd))
IWL_ERR(mvm, "Failed to send BT_CI cmd\n");
memcpy(&mvm->last_bt_ci_cmd_old, &cmd, sizeof(cmd));
}
if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm))
IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n");
} | false | false | false | false | false | 0 |
hex_decode(char ch, unsigned char* val) {
if ((ch >= '0') && (ch <= '9')) {
*val = ch - '0';
} else if ((ch >= 'A') && (ch <= 'Z')) {
*val = (ch - 'A') + 10;
} else if ((ch >= 'a') && (ch <= 'z')) {
*val = (ch - 'a') + 10;
} else {
return false;
}
return true;
} | false | false | false | false | false | 0 |
deviceAdapter() const
{
QString string = device();
int pos = string.lastIndexOf('/');
if (pos < 0)
return -1;
string = string.left(pos);
pos = string.lastIndexOf('/');
if (pos < 0)
return -1;
string = string.mid(pos + 1);
if (!string.startsWith(QLatin1String("adapter")))
return -1;
string = string.mid(7);
bool ok;
int adapter = string.toInt(&ok, 10);
if (ok)
return adapter;
else
return -1;
} | false | false | false | false | false | 0 |
men_z135_startup(struct uart_port *port)
{
struct men_z135_port *uart = to_men_z135(port);
int err;
u32 conf_reg = 0;
err = men_z135_request_irq(uart);
if (err)
return -ENODEV;
conf_reg = ioread32(port->membase + MEN_Z135_CONF_REG);
/* Activate all but TX space available IRQ */
conf_reg |= MEN_Z135_ALL_IRQS & ~MEN_Z135_IER_TXCIEN;
conf_reg &= ~(0xff << 16);
conf_reg |= (txlvl << 16);
conf_reg |= (rxlvl << 20);
iowrite32(conf_reg, port->membase + MEN_Z135_CONF_REG);
if (rx_timeout)
iowrite32(rx_timeout, port->membase + MEN_Z135_TIMEOUT);
return 0;
} | false | false | false | false | false | 0 |
read_instructions(exec_list *instructions, s_expression *expr,
ir_loop *loop_ctx)
{
// Read in a list of instructions
s_list *list = SX_AS_LIST(expr);
if (list == NULL) {
ir_read_error(expr, "Expected (<instruction> ...); found an atom.");
return;
}
foreach_iter(exec_list_iterator, it, list->subexpressions) {
s_expression *sub = (s_expression*) it.get();
ir_instruction *ir = read_instruction(sub, loop_ctx);
if (ir != NULL) {
/* Global variable declarations should be moved to the top, before
* any functions that might use them. Functions are added to the
* instruction stream when scanning for prototypes, so without this
* hack, they always appear before variable declarations.
*/
if (state->current_function == NULL && ir->as_variable() != NULL)
instructions->push_head(ir);
else
instructions->push_tail(ir);
}
}
} | false | false | false | false | false | 0 |
jas_image_rawsize(jas_image_t *image)
{
uint_fast32_t rawsize;
int cmptno;
jas_image_cmpt_t *cmpt;
rawsize = 0;
for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
cmpt = image->cmpts_[cmptno];
rawsize += (cmpt->width_ * cmpt->height_ * cmpt->prec_ +
7) / 8;
}
return rawsize;
} | false | false | false | false | false | 0 |
getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals)
{
IAttribute* att = getAttributeP(attributeName);
if (att && att->getType() == EAT_ENUM)
outLiterals = ((CEnumAttribute*)att)->EnumLiterals;
} | false | false | false | false | false | 0 |
_fingerprint(struct printer *p)
{
int c;
uint32_t result = 0;
struct dfa_state *node;
while ((node = _pop_node(p))) {
result = _combine(result, (node->final < 0) ? 0 : node->final);
for (c = 0; c < 256; c++)
result = _combine(result,
_push_node(p, node->lookup[c]));
}
return result;
} | false | false | false | false | false | 0 |
send_ring(struct unistimsession *pte, char volume, char style)
{
BUFFSEND;
if (unistimdebug) {
ast_verb(0, "Sending ring packet\n");
}
memcpy(buffsend + SIZE_HEADER, packet_send_ring, sizeof(packet_send_ring));
buffsend[24] = style + 0x10;
buffsend[29] = volume * 0x10;
send_client(SIZE_HEADER + sizeof(packet_send_ring), buffsend, pte);
} | false | true | false | false | false | 1 |
command_select(GtkComboBox *combobox, gpointer d)
{
GtkTreeIter iter;
gchar* data = NULL;
if (gtk_combo_box_get_active_iter (combobox, &iter))
{
GtkTreeModel* model = gtk_combo_box_get_model(combobox);
gtk_tree_model_get (model, &iter, 0, &data, -1);
}
if(FrameShow !=NULL) gtk_widget_destroy(FrameShow);
if (!strcmp((char *)data,"hf") ) { create_frame_option(_("HF Options")); button_hfoption(FrameShow); }
else if (!strcmp((char *)data,"uhf") ) { create_frame_option(_("UHF Options")); button_hfoption(FrameShow); }
else if (!strcmp((char *)data,"multi") ) { create_frame_option(_("Multi Options")); button_multioption(FrameShow); }
else if (!strcmp((char *)data,"ci") ) { create_frame_option(_("CI Options")); button_cioption(FrameShow); }
else if (!strcmp((char *)data,"fci") ) { create_frame_option(_("FCI Options")); button_fcioption(FrameShow); }
if (strcmp((char *)data,_("Please select the type of calculation")) )
{
if(!begin) gabedit_text_insert (GABEDIT_TEXT(text2), NULL, NULL, NULL, "}\n",-1);
gabedit_text_insert (GABEDIT_TEXT(text2), NULL, NULL, NULL, "{ ",-1);
gabedit_text_insert (GABEDIT_TEXT(text2), NULL, NULL, NULL, (char *)data,-1);
gabedit_text_insert (GABEDIT_TEXT(text2), NULL, NULL, NULL, "; ",-1);
begin = 0;
}
} | false | false | false | false | false | 0 |
set_cgats_type(cgats *p, const char *osym) {
cgatsAlloc *al = p->al;
p->errc = 0;
p->err[0] = '\000';
if (p->cgats_type != NULL)
al->free(al, p->cgats_type);
if ((p->cgats_type = (char *)al->malloc(al, (strlen(osym)+1) * sizeof(char))) == NULL)
return err(p,-2,"cgats.add_cgats_type(), malloc failed!");
strcpy(p->cgats_type,osym);
return 0;
} | false | false | false | false | false | 0 |
js_PurgeCachedNativeEnumerators(JSContext *cx, JSThreadData *data)
{
jsuword *cachep = &data->nativeEnumCache[0];
jsuword *end = cachep + JS_ARRAY_LENGTH(data->nativeEnumCache);
for (; cachep != end; ++cachep)
SetEnumeratorCache(cx, cachep, jsuword(0));
#ifdef JS_DUMP_ENUM_CACHE_STATS
printf("nativeEnumCache hit rate %g%%\n",
100.0 * (cx->runtime->nativeEnumProbes -
cx->runtime->nativeEnumMisses) /
cx->runtime->nativeEnumProbes);
#endif
} | false | false | false | false | false | 0 |
check_normal(Ipnt PC,
HMatrix norm,
Ipnt *refpt, Ipnt *newpt){
Hint dot,dmin,dmax;
int i,first=TRUE;
Ipnt pmin = NULL;
Ipnt pmax = NULL;
Hinit(dot,0);
Hinit(dmin,0);
Hinit(dmax,0);
while(PC!=0){
Hnorm_dot(dot,norm,PC);
if (first==TRUE) {
HHset(dmin,dot);
HHset(dmax,dot);
pmin=pmax=PC;
first=FALSE;
}
else {
if (HHlt(dot,dmin)){
HHset(dmin,dot);
pmin=PC;
}
else if (HHlt(dmax,dot)){
HHset(dmax,dot);
pmax=PC;
}
}
PC=Ipnt_next(PC);
}
if (HHeq(dmin,dmax)) return FALSE;
if (*refpt==0) {
*refpt=pmin;
*newpt=pmax;
}
else{
Hnorm_dot(dot,norm,*refpt);
if (HHeq(dot,dmin)) *newpt=pmax;
else *newpt=pmin;
}
Hfree(dot);
Hfree(dmin);
Hfree(dmax);
return TRUE;
} | false | false | false | false | false | 0 |
isoent_new(struct isofile *file)
{
struct isoent *isoent;
static const struct archive_rb_tree_ops rb_ops = {
isoent_cmp_node, isoent_cmp_key,
};
isoent = calloc(1, sizeof(*isoent));
if (isoent == NULL)
return (NULL);
isoent->file = file;
isoent->children.first = NULL;
isoent->children.last = &(isoent->children.first);
__archive_rb_tree_init(&(isoent->rbtree), &rb_ops);
isoent->subdirs.first = NULL;
isoent->subdirs.last = &(isoent->subdirs.first);
isoent->extr_rec_list.first = NULL;
isoent->extr_rec_list.last = &(isoent->extr_rec_list.first);
isoent->extr_rec_list.current = NULL;
if (archive_entry_filetype(file->entry) == AE_IFDIR)
isoent->dir = 1;
return (isoent);
} | false | false | false | false | false | 0 |
static_style (GtkWidget *widget, void *data)
{
gamgi_window *window = GAMGI_CAST_WINDOW data;
GtkWidget *dialog = window->dialog0;
GtkWidget *entry;
GtkWidget *label_size, *label_variancy;
GtkWidget *combo_style, *combo_size, *combo_variancy;
char token[GAMGI_ENGINE_TOKEN];
int row;
/****************
* update style *
****************/
combo_style = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_style");
row = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_style));
combo_size = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_size");
label_size = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_size");
combo_variancy = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_variancy");
label_variancy = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_variancy");
if (row == GAMGI_MESA_WIRED - 1)
{
entry = gtk_bin_get_child (GTK_BIN (combo_size));
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_widget_set_sensitive (combo_size, FALSE);
gtk_widget_set_sensitive (label_size, FALSE);
entry = gtk_bin_get_child (GTK_BIN (combo_variancy));
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_widget_set_sensitive (combo_variancy, FALSE);
gtk_widget_set_sensitive (label_variancy, FALSE);
}
if (row == GAMGI_MESA_SOLID - 1)
{
gtk_widget_set_sensitive (combo_size, TRUE);
gtk_widget_set_sensitive (label_size, TRUE);
sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_SIZE, gamgi->atom->size);
entry = gtk_bin_get_child (GTK_BIN (combo_size));
gtk_entry_set_text (GTK_ENTRY (entry), token);
gtk_widget_set_sensitive (combo_variancy, TRUE);
gtk_widget_set_sensitive (label_variancy, TRUE);
sprintf (token, "%.*f", GAMGI_MATH_DECIMAL_VARIANCY, gamgi->atom->variancy);
entry = gtk_bin_get_child (GTK_BIN (combo_variancy));
gtk_entry_set_text (GTK_ENTRY (entry), token);
}
} | true | true | false | false | false | 1 |
GetReferenceSystemPointId(vtkPolyData* referenceSystems, const char* groupIdsArrayName, vtkIdType groupId)
{
vtkDataArray* groupIdsArray = referenceSystems->GetPointData()->GetArray(groupIdsArrayName);
int numberOfPoints = referenceSystems->GetNumberOfPoints();
vtkIdType pointId = -1;
for (int i=0; i<numberOfPoints; i++)
{
vtkIdType current_groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
if (current_groupId == groupId)
{
pointId = i;
break;
}
}
return pointId;
} | false | false | false | false | false | 0 |
lalr1AddFollow2( TransAp *trans, FollowToAdd &followKeys )
{
for ( ExpandToSet::Iter ets = trans->expandTo; ets.lte(); ets++ ) {
int prodId = ets->prodId;
StateAp *expandTo = ets->state;
for ( FollowToAdd::Iter fkey = followKeys; fkey.lte(); fkey++ ) {
TransMapEl *transEl = expandTo->transMap.find( fkey->key );
if ( transEl != 0 ) {
/* Set up the follow transition. */
TransAp *destTrans = transEl->value;
transferCommits( destTrans, expandTo, prodId );
graph->addInReduction( destTrans, prodId, fkey->value );
}
else {
/* Set up the follow transition. */
TransAp *followTrans = new TransAp;
followTrans->lowKey = fkey->key;
followTrans->isShift = false;
followTrans->reductions.insert( prodId, fkey->value );
transferCommits( followTrans, expandTo, prodId );
graph->attachTrans( expandTo, actionDestState, followTrans );
expandTo->transMap.insert( followTrans->lowKey, followTrans );
graph->transClosureQueue.append( followTrans );
}
}
}
} | false | false | false | false | false | 0 |
get_basic_block(struct compilation_unit *cu, unsigned long start, unsigned long end)
{
struct basic_block *bb;
bb = alloc_basic_block(cu, start, end);
if (bb)
list_add_tail(&bb->bb_list_node, &cu->bb_list);
return bb;
} | false | false | false | false | false | 0 |
Set_file_error(int value)
{
if (File_error>=0)
File_error=value;
} | false | false | false | false | false | 0 |
CmiAllocateHashTableCell (
IN PCMHIVE RegistryHive,
OUT PCM_KEY_FAST_INDEX *HashBlock,
OUT HCELL_INDEX *HBOffset,
IN USHORT SubKeyCount,
IN HSTORAGE_TYPE Storage)
{
PCM_KEY_FAST_INDEX NewHashBlock;
ULONG NewHashSize;
NTSTATUS Status;
Status = STATUS_SUCCESS;
*HashBlock = NULL;
NewHashSize = FIELD_OFFSET(CM_KEY_FAST_INDEX, List) +
(SubKeyCount * sizeof(CM_INDEX));
*HBOffset = HvAllocateCell(&RegistryHive->Hive, NewHashSize, Storage, HCELL_NIL);
if (*HBOffset == HCELL_NIL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}
else
{
NewHashBlock = (PCM_KEY_FAST_INDEX)HvGetCell (&RegistryHive->Hive, *HBOffset);
NewHashBlock->Signature = CM_KEY_FAST_LEAF;
NewHashBlock->Count = 0;
*HashBlock = NewHashBlock;
}
return Status;
} | false | false | false | false | false | 0 |
ubifs_sync_wbufs_by_inode(struct ubifs_info *c, struct inode *inode)
{
int i, err = 0;
for (i = 0; i < c->jhead_cnt; i++) {
struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
if (i == GCHD)
/*
* GC head is special, do not look at it. Even if the
* head contains something related to this inode, it is
* a _copy_ of corresponding on-flash node which sits
* somewhere else.
*/
continue;
if (!wbuf_has_ino(wbuf, inode->i_ino))
continue;
mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
if (wbuf_has_ino(wbuf, inode->i_ino))
err = ubifs_wbuf_sync_nolock(wbuf);
mutex_unlock(&wbuf->io_mutex);
if (err) {
ubifs_ro_mode(c, err);
return err;
}
}
return 0;
} | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.