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 |
|---|---|---|---|---|---|---|
sgen_split_nursery_init (SgenMinorCollector *collector)
{
collector->is_split = TRUE;
collector->alloc_for_promotion = minor_alloc_for_promotion;
collector->par_alloc_for_promotion = minor_par_alloc_for_promotion;
collector->prepare_to_space = prepare_to_space;
collector->clear_fragments = clear_fragments;
collector->build_fragments_get_exclude_head = build_fragments_get_exclude_head;
collector->build_fragments_release_exclude_head = build_fragments_release_exclude_head;
collector->build_fragments_finish = build_fragments_finish;
collector->init_nursery = init_nursery;
collector->handle_gc_param = handle_gc_param;
collector->print_gc_param_usage = print_gc_param_usage;
FILL_MINOR_COLLECTOR_COPY_OBJECT (collector);
FILL_MINOR_COLLECTOR_SCAN_OBJECT (collector);
LOCK_INIT (par_alloc_buffer_refill_mutex);
} | false | false | false | false | false | 0 |
pm3393_interrupt_handler(struct cmac *cmac)
{
u32 master_intr_status;
/* Read the master interrupt status register. */
pmread(cmac, SUNI1x10GEXP_REG_MASTER_INTERRUPT_STATUS,
&master_intr_status);
if (netif_msg_intr(cmac->adapter))
dev_dbg(&cmac->adapter->pdev->dev, "PM3393 intr cause 0x%x\n",
master_intr_status);
/* TBD XXX Lets just clear everything for now */
pm3393_interrupt_clear(cmac);
return 0;
} | false | false | false | false | false | 0 |
PyFFFont_Generate(PyObject *self, PyObject *args, PyObject *keywds) {
char *filename;
char *locfilename = NULL;
FontViewBase *fv = ((PyFF_Font *) self)->fv;
PyObject *flags=NULL;
int iflags = -1;
int resolution = -1;
char *bitmaptype="", *subfontdirectory=NULL, *namelist=NULL;
NameList *rename_to = NULL;
int layer = fv->active_layer;
char *layer_str=NULL;
if ( !PyArg_ParseTupleAndKeywords(args, keywds, "es|sOissi", gen_keywords,
"UTF-8",&filename, &bitmaptype, &flags, &resolution, &subfontdirectory,
&namelist, &layer) ) {
PyErr_Clear();
if ( !PyArg_ParseTupleAndKeywords(args, keywds, "es|sOisss", gen_keywords,
"UTF-8",&filename, &bitmaptype, &flags, &resolution, &subfontdirectory,
&namelist, &layer_str) )
return( NULL );
layer = SFFindLayerIndexByName(fv->sf,layer_str);
if ( layer<0 )
return( NULL );
}
if ( layer<0 || layer>=fv->sf->layer_cnt ) {
PyErr_Format(PyExc_ValueError, "Layer is out of range" );
return( NULL );
}
if ( flags!=NULL ) {
iflags = FlagsFromTuple(flags,gen_flags);
if ( iflags==PYFF_FLAG_UNKNOWN ) {
PyErr_Format(PyExc_TypeError, "Unknown flag");
return( NULL );
}
/* Legacy screw ups mean that opentype & apple bits don't mean what */
/* I want them to. Python users should not see that, but fix it up */
/* here */
if ( (iflags&0x80) && (iflags&0x10) ) /* Both */
iflags &= ~0x10;
else if ( (iflags&0x80) && !(iflags&0x10)) /* Just opentype */
iflags &= ~0x80;
else if ( !(iflags&0x80) && (iflags&0x10)) /* Just apple */
/* This one's set already */;
else
iflags |= 0x90;
}
if ( namelist!=NULL ) {
rename_to = NameListByName(namelist);
if ( rename_to==NULL ) {
PyErr_Format(PyExc_EnvironmentError, "Unknown namelist");
return( NULL );
}
}
locfilename = utf82def_copy(filename);
free(filename);
if ( !GenerateScript(fv->sf,locfilename,bitmaptype,iflags,resolution,subfontdirectory,
NULL,fv->normal==NULL?fv->map:fv->normal,rename_to,layer) ) {
PyErr_Format(PyExc_EnvironmentError, "Font generation failed");
return( NULL );
}
free(locfilename);
Py_RETURN( self );
} | false | false | false | false | false | 0 |
enet_peer_disconnect (ENetPeer * peer, enet_uint32 data)
{
ENetProtocol command;
if (peer -> state == ENET_PEER_STATE_DISCONNECTING ||
peer -> state == ENET_PEER_STATE_DISCONNECTED ||
peer -> state == ENET_PEER_STATE_ZOMBIE)
return;
enet_peer_reset_queues (peer);
command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT;
command.header.channelID = 0xFF;
command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED;
command.header.commandLength = sizeof (ENetProtocolDisconnect);
command.disconnect.data = data;
if (peer -> state == ENET_PEER_STATE_CONNECTED)
command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE;
enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);
if (peer -> state == ENET_PEER_STATE_CONNECTED)
peer -> state = ENET_PEER_STATE_DISCONNECTING;
else
{
enet_host_flush (peer -> host);
enet_peer_reset (peer);
}
} | false | false | false | false | false | 0 |
current_done(int ok)
{
if (!fp)
return;
fclose(fp);
fp = NULL;
if (!snarfing)
ahead_cache[0].status = ok ? StatusOk : StatusEmpty;
if (cache_notice)
show_cache_stats();
} | false | false | false | false | false | 0 |
cb_systray_volume_scroll (GtkWidget *widget, GdkEventScroll *event)
{
gint volume;
GtkAdjustment *volume_adj;
if (event->type != GDK_SCROLL)
return;
volume_adj = gtk_range_get_adjustment (GTK_RANGE(volume_scale));
switch (event->direction)
{
case GDK_SCROLL_UP:
volume = gtk_adjustment_get_value (GTK_ADJUSTMENT(volume_adj)) + 2;
gtk_adjustment_set_value (GTK_ADJUSTMENT (volume_adj), volume);
break;
case GDK_SCROLL_DOWN:
volume = gtk_adjustment_get_value (GTK_ADJUSTMENT(volume_adj)) - 2;
gtk_adjustment_set_value (GTK_ADJUSTMENT(volume_adj), volume);
break;
default:
return;
}
return;
} | false | false | false | false | false | 0 |
hgroup_list_exists(const lList *this_list, lList **answer_list,
const lList *href_list)
{
bool ret = true;
DENTER(HGROUP_LAYER, "hgroup_list_exists");
if (href_list != NULL && this_list != NULL) {
lListElem *href;
for_each(href, href_list) {
const char *name = lGetHost(href, HR_name);
if (is_hgroup_name(name)) {
lListElem *hgroup = hgroup_list_locate(this_list, name);
if (hgroup == NULL) {
ret = false;
SGE_ADD_MSG_ID(sprintf(SGE_EVENT,
MSG_SGETEXT_DOESNOTEXIST_SS, "host group", name));
answer_list_add(answer_list, SGE_EVENT,
STATUS_EEXIST, ANSWER_QUALITY_ERROR);
break;
}
}
}
}
DEXIT;
return ret;
} | false | false | false | false | false | 0 |
read(hsStream* S) {
fType = S->readByte();
switch (fType) {
case kString:
case kAny:
fString = S->readSafeStr();
break;
case kBool:
fBool = S->readBool();
break;
case kByte:
fByte = S->readByte();
break;
case kInt:
case kUint:
fUint = S->readInt();
break;
case kFloat:
fFloat = S->readFloat();
break;
case kDouble:
fDouble = S->readDouble();
break;
default:
throw hsBadParamException(__FILE__, __LINE__, "Invalid variable type");
}
} | false | false | false | false | false | 0 |
f_create_chan(int var, const char* fname, int rd_wr) {
GLEFile* file = new GLEFile();
int freechn = -1;
for (vector<GLEFile*>::size_type i = 0; i < g_Files.size() && freechn == -1; i++) {
if (g_Files[i] == NULL) {
freechn = i;
}
}
if (freechn == -1) {
freechn = g_Files.size();
g_Files.push_back(file);
} else {
g_Files[freechn] = file;
}
file->setRdWr(rd_wr == 0 ? true : false);
var_set(var, freechn);
file->open(fname);
} | false | false | false | false | true | 1 |
ExecResult(ResultState *node)
{
TupleTableSlot *outerTupleSlot;
TupleTableSlot *resultSlot;
PlanState *outerPlan;
ExprContext *econtext;
ExprDoneCond isDone;
econtext = node->ps.ps_ExprContext;
/*
* check constant qualifications like (2 > 1), if not already done
*/
if (node->rs_checkqual)
{
bool qualResult = ExecQual((List *) node->resconstantqual,
econtext,
false);
node->rs_checkqual = false;
if (!qualResult)
{
node->rs_done = true;
return NULL;
}
}
/*
* Check to see if we're still projecting out tuples from a previous scan
* tuple (because there is a function-returning-set in the projection
* expressions). If so, try to project another one.
*/
if (node->ps.ps_TupFromTlist)
{
resultSlot = ExecProject(node->ps.ps_ProjInfo, &isDone);
if (isDone == ExprMultipleResult)
return resultSlot;
/* Done with that source tuple... */
node->ps.ps_TupFromTlist = false;
}
/*
* Reset per-tuple memory context to free any expression evaluation
* storage allocated in the previous tuple cycle. Note this can't happen
* until we're done projecting out tuples from a scan tuple.
*/
ResetExprContext(econtext);
/*
* if rs_done is true then it means that we were asked to return a
* constant tuple and we already did the last time ExecResult() was
* called, OR that we failed the constant qual check. Either way, now we
* are through.
*/
while (!node->rs_done)
{
outerPlan = outerPlanState(node);
if (outerPlan != NULL)
{
/*
* retrieve tuples from the outer plan until there are no more.
*/
outerTupleSlot = ExecProcNode(outerPlan);
if (TupIsNull(outerTupleSlot))
return NULL;
node->ps.ps_OuterTupleSlot = outerTupleSlot;
/*
* XXX gross hack. use outer tuple as scan tuple for projection
*/
econtext->ecxt_outertuple = outerTupleSlot;
econtext->ecxt_scantuple = outerTupleSlot;
}
else
{
/*
* if we don't have an outer plan, then we are just generating the
* results from a constant target list. Do it only once.
*/
node->rs_done = true;
}
/*
* form the result tuple using ExecProject(), and return it --- unless
* the projection produces an empty set, in which case we must loop
* back to see if there are more outerPlan tuples.
*/
resultSlot = ExecProject(node->ps.ps_ProjInfo, &isDone);
if (isDone != ExprEndResult)
{
node->ps.ps_TupFromTlist = (isDone == ExprMultipleResult);
return resultSlot;
}
}
return NULL;
} | false | false | false | false | false | 0 |
hz_value(data_t prev, data_t curr, data_t itv)
{
//bb_error_msg("curr:%lld prev:%lld G.hz:%u", curr, prev, G.hz);
return ((double)overflow_safe_sub(prev, curr)) / itv * G.hz;
} | false | false | false | false | false | 0 |
create_cipher (GkmSecret *login, int calgo, int halgo, const guchar *salt,
gsize n_salt, guint iterations, gcry_cipher_hd_t *cipher)
{
gsize n_key, n_block;
const gchar *password;
gsize n_password;
guchar *key, *iv;
gcry_error_t gcry;
g_assert (login);
g_assert (salt);
g_assert (cipher);
n_key = gcry_cipher_get_algo_keylen (calgo);
g_return_val_if_fail (n_key, FALSE);
n_block = gcry_cipher_get_algo_blklen (calgo);
g_return_val_if_fail (n_block, FALSE);
/* Allocate memory for the keys */
key = gcry_malloc_secure (n_key);
g_return_val_if_fail (key, FALSE);
iv = g_malloc0 (n_block);
password = gkm_secret_get_password (login, &n_password);
if (!egg_symkey_generate_simple (calgo, halgo, password, n_password,
salt, n_salt, iterations, &key, &iv)) {
gcry_free (key);
g_free (iv);
return FALSE;
}
gcry = gcry_cipher_open (cipher, calgo, GCRY_CIPHER_MODE_CBC, 0);
if (gcry) {
g_warning ("couldn't create cipher context: %s", gcry_strerror (gcry));
gcry_free (key);
g_free (iv);
return FALSE;
}
gcry = gcry_cipher_setkey (*cipher, key, n_key);
g_return_val_if_fail (!gcry, FALSE);
gcry_free (key);
gcry = gcry_cipher_setiv (*cipher, iv, n_block);
g_return_val_if_fail (!gcry, FALSE);
g_free (iv);
return TRUE;
} | false | false | false | false | false | 0 |
find_lb_table(void)
{
struct lb_header *head;
head = 0;
if (!head) {
/* First try at address 0 */
head = __find_lb_table(0x00000, 0x1000);
}
if (!head) {
/* Then try at address 0xf0000 */
head = __find_lb_table(0xf0000, 0x100000);
}
return head;
} | false | false | false | false | false | 0 |
test_cases(std::string filename)
{
//Variables for parsing the data file
std::string line;
std::stringstream parse;
int ssize = 100; //establish a buffer size to store attribute values, which for binary classification string are no bigger than 1
char c[ssize];
char delimiter = ',';
//Variables to store the values in the data file
std::vector<char> tmpcase;
//Variables to traverse the decision tree and store results
dectree_node* tmp_node;
std::vector<bool> results;
int good_classif = 0;
int bad_classif = 0;
std::ifstream dataset_file(filename.c_str(), std::ios::in);
if(!dataset_file)
{
std::cerr << "Cannot load test file" << std::endl;
}
else
{
while( (getline(dataset_file, line))!= NULL )
{
parse << line;
while( parse.getline(c,ssize,delimiter) )
tmpcase.push_back(*c);
parse.str(""); //safety measure to erase previous contents
parse.clear(); //clear flags to be able to read from it again
//traverse the decision tree and evaluate the parsed case
tmp_node = dbst;
//std::cout << "***Case***" << std::endl;
while(tmp_node != NULL && !(tmpcase.empty()))
{
if(!(tmp_node->type.compare("terminal")))
{
parse << tmp_node->output_id;
/*
std::cout << "decide" << std::endl;
std::cout << "++" << tmp_node->output_id << std::endl;
std::cout << "++" << tmpcase.at(0)<< std::endl;
*/
if(*(parse.str().c_str())==tmpcase.at(0))
{
results.push_back(true);
good_classif++;
}
else
{
results.push_back(false);
bad_classif++;
}
parse.str("");
parse.clear();
tmp_node = NULL;
}
else
{
if(tmpcase.at(tmp_node->attribute_id)=='0')
{
//std::cout << "go left" << std::endl;
tmp_node = tmp_node->f;
}
else
{
//std::cout << "go right" << std::endl;
tmp_node = tmp_node->t;
}
}
}
tmpcase.clear();
}
}
per_error = (double)bad_classif / (good_classif+bad_classif);
return results;
} | false | false | false | false | false | 0 |
item_event_valid (GooCanvasItem *item,
GooCanvasItem *target,
GdkEventButton *event,
gpointer data)
{
if (((char *)data)[0]=='R')
{
// The user is Ready
wait_for_ready = FALSE;
ask_ready(FALSE);
pause_board(FALSE);
}
else if(!wait_for_ready) {
if ((((char *)data)[0]=='Y' && textToFindIndex == -1)
|| (((char *)data)[0]=='N' && textToFindIndex == NOT_THERE))
{
player_win();
}
else
{
player_loose();
}
}
return TRUE;
} | true | true | false | false | false | 1 |
_print_printer_name (GtkPrinter *printer,
PhotoData *data)
{
GtkPrintBackend *backend;
const char *backend_name;
/* Don't list the "Print to File" printer */
backend = gtk_printer_get_backend (printer);
backend_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (backend));
if (g_strcmp0 (backend_name, "GtkPrintBackendFile") == 0)
return FALSE;
if (gtk_printer_is_active (printer))
/* Translators: the leading spaces are a way to add tabulation in some text
* printed on the terminal; %s is the name of a printer. */
g_printerr (_(" %s\n"), gtk_printer_get_name (printer));
else
/* Translators: the leading spaces are a way to add tabulation in some text
* printed on the terminal; %s is the name of a printer; "active" applies
* to the printer. */
g_printerr (_(" %s (not active)\n"), gtk_printer_get_name (printer));
return FALSE;
} | false | false | false | false | false | 0 |
import_style (CRDocHandler * a_this,
GList * a_media_list,
CRString * a_uri,
CRString * a_uri_default_ns,
CRParsingLocation *a_location)
{
enum CRStatus status = CR_OK;
CRString *uri = NULL;
CRStatement *stmt = NULL,
*stmt2 = NULL;
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL ;
g_return_if_fail (a_this);
ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
uri = cr_string_dup (a_uri) ;
if (a_media_list)
media_list = cr_utils_dup_glist_of_cr_string (a_media_list) ;
stmt = cr_statement_new_at_import_rule
(ctxt->stylesheet, uri, media_list, NULL);
if (!stmt)
goto error;
if (ctxt->cur_stmt) {
stmt2 = cr_statement_append (ctxt->cur_stmt, stmt);
if (!stmt2)
goto error;
ctxt->cur_stmt = stmt2;
stmt2 = NULL;
stmt = NULL;
} else {
stmt2 = cr_statement_append (ctxt->stylesheet->statements,
stmt);
if (!stmt2)
goto error;
ctxt->stylesheet->statements = stmt2;
stmt2 = NULL;
stmt = NULL;
}
return;
error:
if (uri) {
cr_string_destroy (uri);
}
if (stmt) {
cr_statement_destroy (stmt);
stmt = NULL;
}
a_uri_default_ns = NULL; /*keep compiler happy */
} | false | false | false | false | false | 0 |
fill(FXColor color){
if(data){
register FXColor *pix=data;
register FXColor *end=pix+height*width;
do{ *pix++=color; }while(pix<end);
}
} | false | false | false | false | false | 0 |
iobuf_writestr (iobuf_t a, const char *buf)
{
int rc;
for (; *buf; buf++)
if ((rc=iobuf_writebyte (a, *buf)))
return rc;
return 0;
} | false | false | false | false | false | 0 |
dai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task,
struct tile *ptile)
{
/* Keep ai_unit_task in sync with adv task */
switch(task) {
case AUT_AUTO_SETTLER:
ai_unit_new_task(punit, AIUNIT_AUTO_SETTLER, ptile);
break;
case AUT_BUILD_CITY:
ai_unit_new_task(punit, AIUNIT_BUILD_CITY, ptile);
break;
case AUT_NONE:
ai_unit_new_task(punit, AIUNIT_NONE, ptile);
break;
}
} | false | false | false | false | false | 0 |
arvo_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data, int size)
{
struct arvo_device *arvo = hid_get_drvdata(hdev);
if (size != 3)
return 0;
if (arvo && arvo->roccat_claimed)
arvo_report_to_chrdev(arvo, data);
return 0;
} | false | false | false | false | false | 0 |
show_create_trigger_impl(THD *thd,
Table_triggers_list *triggers,
int trigger_idx)
{
int ret_code;
Protocol *p= thd->protocol;
List<Item> fields;
LEX_STRING trg_name;
ulonglong trg_sql_mode;
LEX_STRING trg_sql_mode_str;
LEX_STRING trg_sql_original_stmt;
LEX_STRING trg_client_cs_name;
LEX_STRING trg_connection_cl_name;
LEX_STRING trg_db_cl_name;
CHARSET_INFO *trg_client_cs;
/*
TODO: Check privileges here. This functionality will be added by
implementation of the following WL items:
- WL#2227: New privileges for new objects
- WL#3482: Protect SHOW CREATE PROCEDURE | FUNCTION | VIEW | TRIGGER
properly
SHOW TRIGGERS and I_S.TRIGGERS will be affected too.
*/
/* Prepare trigger "object". */
triggers->get_trigger_info(thd,
trigger_idx,
&trg_name,
&trg_sql_mode,
&trg_sql_original_stmt,
&trg_client_cs_name,
&trg_connection_cl_name,
&trg_db_cl_name);
sql_mode_string_representation(thd, trg_sql_mode, &trg_sql_mode_str);
/* Resolve trigger client character set. */
if (resolve_charset(trg_client_cs_name.str, NULL, &trg_client_cs))
return TRUE;
/* Send header. */
fields.push_back(new Item_empty_string("Trigger", NAME_LEN));
fields.push_back(new Item_empty_string("sql_mode", trg_sql_mode_str.length));
{
/*
NOTE: SQL statement field must be not less than 1024 in order not to
confuse old clients.
*/
Item_empty_string *stmt_fld=
new Item_empty_string("SQL Original Statement",
max(trg_sql_original_stmt.length, 1024));
stmt_fld->maybe_null= TRUE;
fields.push_back(stmt_fld);
}
fields.push_back(new Item_empty_string("character_set_client",
MY_CS_NAME_SIZE));
fields.push_back(new Item_empty_string("collation_connection",
MY_CS_NAME_SIZE));
fields.push_back(new Item_empty_string("Database Collation",
MY_CS_NAME_SIZE));
if (p->send_result_set_metadata(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
return TRUE;
/* Send data. */
p->prepare_for_resend();
p->store(trg_name.str,
trg_name.length,
system_charset_info);
p->store(trg_sql_mode_str.str,
trg_sql_mode_str.length,
system_charset_info);
p->store(trg_sql_original_stmt.str,
trg_sql_original_stmt.length,
trg_client_cs);
p->store(trg_client_cs_name.str,
trg_client_cs_name.length,
system_charset_info);
p->store(trg_connection_cl_name.str,
trg_connection_cl_name.length,
system_charset_info);
p->store(trg_db_cl_name.str,
trg_db_cl_name.length,
system_charset_info);
ret_code= p->write();
if (!ret_code)
my_eof(thd);
return ret_code != 0;
} | false | false | false | false | false | 0 |
getKey()
{
static const QString keyTemplate("solid-disk-info-1-%1-%2");
static const QString tableSize(
QString::number(sizeof(ContentTypesCache)));
return keyTemplate.arg(tableSize, QString::number(geteuid()));
} | false | false | false | false | false | 0 |
ldns_axfr_next(ldns_resolver *resolver)
{
ldns_rr *cur_rr;
uint8_t *packet_wire;
size_t packet_wire_size;
ldns_lookup_table *rcode;
ldns_status status;
/* check if start() has been called */
if (!resolver || resolver->_socket == 0) {
return NULL;
}
if (resolver->_cur_axfr_pkt) {
if (resolver->_axfr_i == ldns_pkt_ancount(resolver->_cur_axfr_pkt)) {
ldns_pkt_free(resolver->_cur_axfr_pkt);
resolver->_cur_axfr_pkt = NULL;
return ldns_axfr_next(resolver);
}
cur_rr = ldns_rr_clone(ldns_rr_list_rr(
ldns_pkt_answer(resolver->_cur_axfr_pkt),
resolver->_axfr_i));
resolver->_axfr_i++;
if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) {
resolver->_axfr_soa_count++;
if (resolver->_axfr_soa_count >= 2) {
#ifndef USE_WINSOCK
close(resolver->_socket);
#else
closesocket(resolver->_socket);
#endif
resolver->_socket = 0;
ldns_pkt_free(resolver->_cur_axfr_pkt);
resolver->_cur_axfr_pkt = NULL;
}
}
return cur_rr;
} else {
packet_wire = ldns_tcp_read_wire(resolver->_socket, &packet_wire_size);
if(!packet_wire)
return NULL;
status = ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire,
packet_wire_size);
LDNS_FREE(packet_wire);
resolver->_axfr_i = 0;
if (status != LDNS_STATUS_OK) {
/* TODO: make status return type of this function (...api change) */
#ifdef STDERR_MSGS
fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status));
#endif
/* we must now also close the socket, otherwise subsequent uses of the
same resolver structure will fail because the link is still open or
in an undefined state */
#ifndef USE_WINSOCK
close(resolver->_socket);
#else
closesocket(resolver->_socket);
#endif
resolver->_socket = 0;
return NULL;
} else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) {
rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt));
#ifdef STDERR_MSGS
if (rcode) {
fprintf(stderr, "Error in AXFR: %s\n",
rcode->name);
} else {
fprintf(stderr, "Error in AXFR: %d\n",
(int) ldns_pkt_get_rcode(
resolver->_cur_axfr_pkt));
}
#endif
/* we must now also close the socket, otherwise subsequent uses of the
same resolver structure will fail because the link is still open or
in an undefined state */
#ifndef USE_WINSOCK
close(resolver->_socket);
#else
closesocket(resolver->_socket);
#endif
resolver->_socket = 0;
return NULL;
} else {
return ldns_axfr_next(resolver);
}
}
} | false | false | false | false | false | 0 |
Match_find(Match_Type type){
if(!local_match_cache[type]){
local_match_cache[type] = Match_create(type);
local_match_cache[Match_Type_mirror(type)]
= local_match_cache[type]->mirror;
}
return local_match_cache[type];
} | false | false | false | false | false | 0 |
FindPluginByFileName(const wxString& pluginFileName)
{
for (unsigned int i = 0; i < m_Plugins.GetCount(); ++i)
{
PluginElement* plugElem = m_Plugins[i];
if (plugElem->fileName == pluginFileName)
return plugElem->plugin;
}
return nullptr;
} | false | false | false | false | false | 0 |
nvkm_memx_nsec(struct nvkm_memx *memx, u32 nsec)
{
nvkm_debug(&memx->pmu->subdev, " DELAY = %d ns\n", nsec);
memx_cmd(memx, MEMX_DELAY, 1, (u32[]){ nsec });
memx_out(memx); /* fuc can't handle multiple */
} | false | false | false | false | false | 0 |
gmpc_provider_music_tree_check_directory_for_files_finish (GmpcProviderMusicTree* self, GAsyncResult* _res_, GList** list) {
GmpcProviderMusicTreeCheckDirectoryForFilesData* _data_;
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
if (list) {
*list = _data_->list;
} else {
__g_list_free__meta_data_free0_0 (_data_->list);
}
_data_->list = NULL;
} | false | false | false | false | false | 0 |
transaction_direct(struct tdb_context *tdb, tdb_off_t off,
size_t len, bool write_mode)
{
size_t blk = off / PAGESIZE, end_blk;
/* This is wrong for zero-length blocks, but will fail gracefully */
end_blk = (off + len - 1) / PAGESIZE;
/* Can only do direct if in single block and we've already copied. */
if (write_mode) {
tdb->stats.transaction_write_direct++;
if (blk != end_blk
|| blk >= tdb->tdb2.transaction->num_blocks
|| tdb->tdb2.transaction->blocks[blk] == NULL) {
tdb->stats.transaction_write_direct_fail++;
return NULL;
}
return tdb->tdb2.transaction->blocks[blk] + off % PAGESIZE;
}
tdb->stats.transaction_read_direct++;
/* Single which we have copied? */
if (blk == end_blk
&& blk < tdb->tdb2.transaction->num_blocks
&& tdb->tdb2.transaction->blocks[blk])
return tdb->tdb2.transaction->blocks[blk] + off % PAGESIZE;
/* Otherwise must be all not copied. */
while (blk <= end_blk) {
if (blk >= tdb->tdb2.transaction->num_blocks)
break;
if (tdb->tdb2.transaction->blocks[blk]) {
tdb->stats.transaction_read_direct_fail++;
return NULL;
}
blk++;
}
return tdb->tdb2.transaction->io_methods->direct(tdb, off, len, false);
} | false | false | false | false | false | 0 |
match(const giopAddressList& addrlist) const
{
if (addrlist.size() != pd_addresses.size()) return 0;
if (orbParameters::offerBiDirectionalGIOP != pd_offerBiDir) return 0;
giopAddressList::const_iterator i, last, j;
i = addrlist.begin();
j = pd_addresses.begin();
last = addrlist.end();
for (; i != last; i++, j++) {
if (!omni::ptrStrMatch((*i)->address(),(*j)->address())) return 0;
}
return 1;
} | false | false | false | false | false | 0 |
WriteData()
{
vtkPointSet *input = vtkPointSet::SafeDownCast(this->GetInput());
vtkIdType numberOfPoints = 0;
if (input)
{
numberOfPoints = input->GetNumberOfPoints();
}
// OpenVTKFile() will report any errors that happen
ostream *outfilep = this->OpenVTKFile();
if (!outfilep)
{
return;
}
ostream &outfile = *outfilep;
for(vtkIdType i = 0; i < numberOfPoints; i++)
{
double p[3];
input->GetPoint(i,p);
outfile << std::setprecision(this->DecimalPrecision)
<< p[0] << " " << p[1] << " " << p[2] << std::endl;
}
// Close the file
this->CloseVTKFile(outfilep);
// Delete the file if an error occurred
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{
vtkErrorMacro("Ran out of disk space; deleting file: "
<< this->FileName);
unlink(this->FileName);
}
} | false | false | false | false | false | 0 |
klp_enable_patch(struct klp_patch *patch)
{
int ret;
mutex_lock(&klp_mutex);
if (!klp_is_patch_registered(patch)) {
ret = -EINVAL;
goto err;
}
ret = __klp_enable_patch(patch);
err:
mutex_unlock(&klp_mutex);
return ret;
} | false | false | false | false | false | 0 |
genie_assignation_constant (NODE_T * p)
{
NODE_T *dst = SUB (p);
NODE_T *src = SOURCE (&PROP (GINFO (NEXT_NEXT (dst))));
A68_REF *z = (A68_REF *) STACK_TOP;
PROP_T self;
UNIT (&self) = genie_assignation_constant;
SOURCE (&self) = p;
EXECUTE_UNIT (dst);
CHECK_REF (p, *z, MOID (p));
COPY (ADDRESS (z), CONSTANT (GINFO (src)), SIZE (GINFO (src)));
return (self);
} | false | false | false | false | false | 0 |
InitializeClass()
{
if (NOT DXType::DXTypeClassInitialized)
{
//
// Create and initialize the type list with the base types.
//
DXType::TypeList = new List;
for (int i = 0; i < _numBaseTypes; i++)
{
DXType::TypeList->appendElement(&_baseType[i]);
}
DXType::DXTypeClassInitialized = TRUE;
}
} | false | false | false | false | false | 0 |
xmlSecGnuTLSKeyDataRsaAdoptPublicKey(xmlSecKeyDataPtr data,
gnutls_datum_t * m, gnutls_datum_t * e) {
gnutls_datum_t params[2];
gcry_mpi_t mpis[2];
gcry_sexp_t pub_key = NULL;
int rc;
int ret;
xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecGnuTLSKeyDataRsaId), -1);
xmlSecAssert2(m != NULL, -1);
xmlSecAssert2(e != NULL, -1);
/* copy */
memcpy(&(params[0]), m, sizeof(*m));
memcpy(&(params[1]), e, sizeof(*e));
/* convert to mpis */
ret = xmlSecGnuTLSConvertParamsToMpis(
params, sizeof(params)/sizeof(params[0]),
mpis, sizeof(mpis)/sizeof(mpis[0]));
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecGnuTLSConvertParamsToMpis",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
/* don't destroy params - we got them from outside !!! */
return(-1);
}
/* don't destroy params - we got them from outside !!! */
/* build expressions */
rc = gcry_sexp_build(&(pub_key), NULL, "(public-key(rsa((n%m)(e%m))))",
mpis[0], mpis[1]);
if((rc != GPG_ERR_NO_ERROR) || (pub_key == NULL)) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"gcry_sexp_build(private/rsa)",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_GNUTLS_GCRYPT_REPORT_ERROR(rc));
xmlSecGnuTLSDestroyMpis(mpis, sizeof(mpis)/sizeof(mpis[0]));
return(-1);
}
xmlSecGnuTLSDestroyMpis(mpis, sizeof(mpis)/sizeof(mpis[0]));
ret = xmlSecGCryptKeyDataRsaAdoptKeyPair(data, pub_key, NULL);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecGCryptKeyDataRsaAdoptKeyPair",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
gcry_sexp_release(pub_key);
return(-1);
}
/* done, we "adopted" the key - destroy it! */
gnutls_free(m->data);
gnutls_free(e->data);
return(0);
} | false | false | false | false | false | 0 |
next_log(int log_num) {
return log_num>=log_generations?1:log_num+1;
} | false | false | false | false | false | 0 |
sign()const
{
if(isZero())return 0;
return p.terms.rbegin()->second.sign();
} | false | false | false | false | false | 0 |
update_tooltip(GtkTreeView *tv, GtkTreePath *path)
{
const struct node_data *data = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
g_assert(tv != NULL);
if (path) {
GtkTreeIter parent;
model = gtk_tree_view_get_model(tv);
if (!gtk_tree_model_get_iter(model, &iter, path)) {
g_warning("gtk_tree_model_get_iter() failed");
return;
}
if (gtk_tree_model_iter_parent(model, &parent, &iter))
iter = parent;
gtk_tree_model_get(model, &iter, 0, &data, (-1));
}
if (data && find_node(data->node_id)) {
gnet_node_info_t info;
gnet_node_flags_t flags;
gchar text[1024];
guc_node_fill_flags(data->node_id, &flags);
guc_node_fill_info(data->node_id, &info);
g_assert(info.node_id == data->node_id);
str_bprintf(text, sizeof text,
"%s %s\n"
"%s %s (%s)\n"
"%s %s (%s)\n"
"%s %.64s",
_("Peer:"),
host_addr_port_to_string(info.gnet_addr, info.gnet_port),
_("Peermode:"),
guc_node_peermode_to_string(flags.peermode),
flags.incoming ? _("incoming") : _("outgoing"),
_("Country:"),
iso3166_country_name(info.country),
iso3166_country_cc(info.country),
_("Vendor:"),
info.vendor ? info.vendor : _("Unknown"));
guc_node_clear_info(&info);
gtk_tooltips_set_tip(settings_gui_tooltips(),
GTK_WIDGET(tv), text, NULL);
} else {
GtkWidget *w;
gtk_tooltips_set_tip(settings_gui_tooltips(), GTK_WIDGET(tv),
_("Move the cursor over a row to see details."), NULL);
w = settings_gui_tooltips()->tip_window;
if (w)
gtk_widget_hide(w);
}
} | false | false | false | false | false | 0 |
inode_dead_file_copy_added(gfarm_ino_t inum, gfarm_int64_t igen,
struct host *host)
{
struct inode *inode = inode_lookup(inum);
if (inode == NULL || !inode_is_file(inode))
return;
if (igen != inode->i_gen)
return;
inode_add_replica_internal(inode, host, FILE_COPY_BEING_REMOVED, 0);
} | false | false | false | false | false | 0 |
func_not (struct _ESExp *f,
gint argc,
struct _ESExpResult **argv,
gpointer data)
{
EBookBackendLDAPSExpData *ldap_data = data;
ESExpResult *r;
/* just replace the head of the list with the NOT of it. */
if (argc > 0) {
gchar *term = ldap_data->list->data;
ldap_data->list->data = g_strdup_printf ("(!%s)", term);
g_free (term);
}
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.boolean = FALSE;
return r;
} | false | false | false | false | false | 0 |
pa_globals_init() {
// global variables
cache_managers=new Cache_managers;
// in various libraries
gc_substitute_memory_management_functions();
// hex value
setup_hex_value();
#ifdef XML
// initializing xml libs
// Register the EXSLT extensions and the test module
exsltRegisterAll();
xsltRegisterTestModule();
xmlDefaultSAXHandlerInit();
// disable CDATA from being built in the document tree
// never added yet xmlDefaultSAXHandler.cdataBlock = NULL;
// Initialization function for the XML parser. This is not reentrant.
// Call once before processing in case of use in multithreaded programs.
xmlInitParser();
// 1. this is needed for proper parsing of stylesheets
// there were a situation where honest entity ruined innocent xpath compilation
// doc says "you sould turn it on on stylesheet load" without deepening into details
// 2. when dom tree with entites goes under transform text nodes
// got [erroreosly] cut on first entity occurance
// --
// that is why this is:
xmlSubstituteEntitiesDefault(1);
// Bit in the loadsubset context field to tell to do ID/REFs lookups
xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
// Bit in the loadsubset context field to tell to do complete the elements attributes lists
// with the ones defaulted from the DTDs
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
// validate each document after load/create (?)
// xmlDoValidityCheckingDefaultValue = 1;
// regretfully this not only replaces entities on parse, but also on generate xmlSubstituteEntitiesDefault(1);
// never switched this on xmlIndentTreeOutput=1;
xmlSetGenericErrorFunc(0, xmlParserGenericErrorFunc);
xsltSetGenericErrorFunc(0, xmlParserGenericErrorFunc);
// FILE *f=fopen("y:\\xslt.log", "wt");
// xsltSetGenericDebugFunc(f/*stderr*/, 0);
pa_xml_io_init();
#endif
} | false | false | false | false | false | 0 |
Problem_6(MATRIX &matrix){
int N = matrix.size();
if(N<=1)
return;
int numRound = N/2;
for(int i=0; i<numRound; ++i){
//for each inner round
for(int j=i; j<N-i-1; ++j){
int temp = matrix[i][j];
matrix[i][j]=matrix[N-1-j][i];
matrix[N-1-j][i]=matrix[N-1-i][N-1-j];
matrix[N-1-i][N-1-j]=matrix[j][N-1-i];
matrix[j][N-1-i]=temp;
}
}
} | false | false | false | false | false | 0 |
UpdateMapPointersInObject(HeapObject* obj) {
ASSERT(!obj->IsMarked());
Map* map = obj->map();
ASSERT(Heap::map_space()->Contains(map));
MapWord map_word = map->map_word();
ASSERT(!map_word.IsMarked());
if (map_word.IsOverflowed()) {
Map* new_map = GetForwardedMap(map_word);
ASSERT(Heap::map_space()->Contains(new_map));
obj->set_map(new_map);
#ifdef DEBUG
if (FLAG_gc_verbose) {
PrintF("update %p : %p -> %p\n",
obj->address(),
reinterpret_cast<void*>(map),
reinterpret_cast<void*>(new_map));
}
#endif
}
int size = obj->SizeFromMap(map);
obj->IterateBody(map->instance_type(), size, &map_updating_visitor_);
return size;
} | false | false | false | false | false | 0 |
start_resource(struct ast_module *mod)
{
char tmp[256];
enum ast_module_load_result res;
if (mod->flags.running) {
return AST_MODULE_LOAD_SUCCESS;
}
if (!mod->info->load) {
return AST_MODULE_LOAD_FAILURE;
}
res = mod->info->load();
switch (res) {
case AST_MODULE_LOAD_SUCCESS:
if (!ast_fully_booted) {
ast_verb(1, "%s => (%s)\n", mod->resource, term_color(tmp, mod->info->description, COLOR_BROWN, COLOR_BLACK, sizeof(tmp)));
if (ast_opt_console && !option_verbose) {
/* This never looks good on anything but the root console, so
* it's best not to try to funnel it through the logger. */
fprintf(stdout, ".");
}
} else {
ast_verb(1, "Loaded %s => (%s)\n", mod->resource, mod->info->description);
}
mod->flags.running = 1;
ast_update_use_count();
break;
case AST_MODULE_LOAD_DECLINE:
mod->flags.declined = 1;
break;
case AST_MODULE_LOAD_FAILURE:
case AST_MODULE_LOAD_SKIP: /* modules should never return this value */
case AST_MODULE_LOAD_PRIORITY:
break;
}
return res;
} | false | false | false | false | false | 0 |
log_store_pidgin_search_new (TplLogStore *self,
const gchar *text,
gint type_mask)
{
GList *files;
GList *retval;
g_return_val_if_fail (TPL_IS_LOG_STORE_PIDGIN (self), NULL);
g_return_val_if_fail (!tp_str_empty (text), NULL);
if (!(type_mask & TPL_EVENT_MASK_TEXT))
return NULL;
files = log_store_pidgin_get_all_files (self, NULL);
DEBUG ("Found %d log files in total", g_list_length (files));
retval = _log_store_pidgin_search_in_files (TPL_LOG_STORE_PIDGIN (self),
text, files);
g_list_foreach (files, (GFunc) g_free, NULL);
g_list_free (files);
return retval;
} | false | false | false | false | false | 0 |
b44_suspend(struct ssb_device *sdev, pm_message_t state)
{
struct net_device *dev = ssb_get_drvdata(sdev);
struct b44 *bp = netdev_priv(dev);
if (!netif_running(dev))
return 0;
del_timer_sync(&bp->timer);
spin_lock_irq(&bp->lock);
b44_halt(bp);
netif_carrier_off(bp->dev);
netif_device_detach(bp->dev);
b44_free_rings(bp);
spin_unlock_irq(&bp->lock);
free_irq(dev->irq, dev);
if (bp->flags & B44_FLAG_WOL_ENABLE) {
b44_init_hw(bp, B44_PARTIAL_RESET);
b44_setup_wol(bp);
}
ssb_pcihost_set_power_state(sdev, PCI_D3hot);
return 0;
} | false | false | false | false | false | 0 |
P_SpawnPuff
( fixed_t x,
fixed_t y,
fixed_t z )
{
mobj_t* th;
int t;
t = P_Random();
z += ((t - P_Random()) << 10);
// [STRIFE] removed momz and tics randomization
th = P_SpawnMobj(x, y, z, MT_STRIFEPUFF); // [STRIFE]: new type
// don't make punches spark on the wall
// [STRIFE] Use a separate melee attack range for the player
if(attackrange == PLAYERMELEERANGE)
P_SetMobjState(th, S_POW2_00); // 141
// villsa [STRIFE] unused
/*
if (th->tics < 1)
th->tics = 1;
*/
} | false | false | false | false | false | 0 |
gcr_trust_is_certificate_pinned_finish (GAsyncResult *result, GError **error)
{
trust_closure *closure;
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (!error || !*error, FALSE);
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL,
gcr_trust_is_certificate_pinned_async), FALSE);
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
return FALSE;
closure = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
return closure->found;
} | false | false | false | false | false | 0 |
sys_close(void)
{
if (new_style_driver && ppp_dev_fd >= 0)
close(ppp_dev_fd);
if (sock_fd >= 0)
close(sock_fd);
#ifdef INET6
if (sock6_fd >= 0)
close(sock6_fd);
#endif
if (slave_fd >= 0)
close(slave_fd);
if (master_fd >= 0)
close(master_fd);
} | false | false | false | false | false | 0 |
suggest_hentry_gen(hentry * rv, char * pattern)
{
char result[MAXLNLEN];
*result = '\0';
int sfxcount = get_sfxcount(pattern);
if (get_sfxcount(HENTRY_DATA(rv)) > sfxcount) return NULL;
if (HENTRY_DATA(rv)) {
char * aff = pAMgr->morphgen(HENTRY_WORD(rv), rv->blen, rv->astr, rv->alen,
HENTRY_DATA(rv), pattern, 0);
if (aff) {
mystrcat(result, aff, MAXLNLEN);
mystrcat(result, "\n", MAXLNLEN);
free(aff);
}
}
// check all allomorphs
char allomorph[MAXLNLEN];
char * p = NULL;
if (HENTRY_DATA(rv)) p = (char *) strstr(HENTRY_DATA2(rv), MORPH_ALLOMORPH);
while (p) {
struct hentry * rv2 = NULL;
p += MORPH_TAG_LEN;
int plen = fieldlen(p);
strncpy(allomorph, p, plen);
allomorph[plen] = '\0';
rv2 = pAMgr->lookup(allomorph);
while (rv2) {
// if (HENTRY_DATA(rv2) && get_sfxcount(HENTRY_DATA(rv2)) <= sfxcount) {
if (HENTRY_DATA(rv2)) {
char * st = (char *) strstr(HENTRY_DATA2(rv2), MORPH_STEM);
if (st && (strncmp(st + MORPH_TAG_LEN,
HENTRY_WORD(rv), fieldlen(st + MORPH_TAG_LEN)) == 0)) {
char * aff = pAMgr->morphgen(HENTRY_WORD(rv2), rv2->blen, rv2->astr, rv2->alen,
HENTRY_DATA(rv2), pattern, 0);
if (aff) {
mystrcat(result, aff, MAXLNLEN);
mystrcat(result, "\n", MAXLNLEN);
free(aff);
}
}
}
rv2 = rv2->next_homonym;
}
p = strstr(p + plen, MORPH_ALLOMORPH);
}
return (*result) ? mystrdup(result) : NULL;
} | false | false | false | false | false | 0 |
qf_free(qi, idx)
qf_info_T *qi;
int idx;
{
qfline_T *qfp;
while (qi->qf_lists[idx].qf_count)
{
qfp = qi->qf_lists[idx].qf_start->qf_next;
vim_free(qi->qf_lists[idx].qf_start->qf_text);
vim_free(qi->qf_lists[idx].qf_start->qf_pattern);
vim_free(qi->qf_lists[idx].qf_start);
qi->qf_lists[idx].qf_start = qfp;
--qi->qf_lists[idx].qf_count;
}
} | false | false | false | false | false | 0 |
autohelperowl_attackpat298(int trans, int move, int color, int action)
{
int a, b, c, d;
UNUSED(color);
UNUSED(action);
a = AFFINE_TRANSFORM(722, trans, move);
b = AFFINE_TRANSFORM(759, trans, move);
c = AFFINE_TRANSFORM(796, trans, move);
d = AFFINE_TRANSFORM(720, trans, move);
return play_attack_defend_n(color, 1, 1, b, d) && play_attack_defend_n(color, 1, 2, move, a, a)&& play_attack_defend_n(color, 1, 4, move, b, NO_MOVE, a, a) && !play_attack_defend_n(color, 1, 2, move, b, c);
} | false | false | false | false | false | 0 |
SkipFrame()
{
AVM_WRITE(__MODULE__, 2, "SkipFrame()\n");
if (m_pPacket)
m_pPacket->Release();
m_pPacket = 0;
Flush();
return m_pPacket ? 0 : -1;
} | false | false | false | false | false | 0 |
ipmiconsole_packet_object (ipmiconsole_ctx_t c,
ipmiconsole_packet_type_t p)
{
assert (c);
assert (c->magic == IPMICONSOLE_CTX_MAGIC);
assert (IPMICONSOLE_PACKET_TYPE_VALID (p));
if (p == IPMICONSOLE_PACKET_TYPE_GET_AUTHENTICATION_CAPABILITIES_RQ)
return (c->connection.obj_authentication_capabilities_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_AUTHENTICATION_CAPABILITIES_RS)
return (c->connection.obj_authentication_capabilities_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_OPEN_SESSION_REQUEST)
return (c->connection.obj_open_session_request);
else if (p == IPMICONSOLE_PACKET_TYPE_OPEN_SESSION_RESPONSE)
return (c->connection.obj_open_session_response);
else if (p == IPMICONSOLE_PACKET_TYPE_RAKP_MESSAGE_1)
return (c->connection.obj_rakp_message_1);
else if (p == IPMICONSOLE_PACKET_TYPE_RAKP_MESSAGE_2)
return (c->connection.obj_rakp_message_2);
else if (p == IPMICONSOLE_PACKET_TYPE_RAKP_MESSAGE_3)
return (c->connection.obj_rakp_message_3);
else if (p == IPMICONSOLE_PACKET_TYPE_RAKP_MESSAGE_4)
return (c->connection.obj_rakp_message_4);
else if (p == IPMICONSOLE_PACKET_TYPE_SET_SESSION_PRIVILEGE_LEVEL_RQ)
return (c->connection.obj_set_session_privilege_level_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_SET_SESSION_PRIVILEGE_LEVEL_RS)
return (c->connection.obj_set_session_privilege_level_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_CHANNEL_PAYLOAD_SUPPORT_RQ)
return (c->connection.obj_get_channel_payload_support_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_CHANNEL_PAYLOAD_SUPPORT_RS)
return (c->connection.obj_get_channel_payload_support_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_PAYLOAD_ACTIVATION_STATUS_RQ)
return (c->connection.obj_get_payload_activation_status_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_PAYLOAD_ACTIVATION_STATUS_RS)
return (c->connection.obj_get_payload_activation_status_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_ACTIVATE_PAYLOAD_RQ)
return (c->connection.obj_activate_payload_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_ACTIVATE_PAYLOAD_RS)
return (c->connection.obj_activate_payload_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_SOL_PAYLOAD_DATA_RQ)
return (c->connection.obj_sol_payload_data_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_SOL_PAYLOAD_DATA_RS)
return (c->connection.obj_sol_payload_data_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_CHANNEL_PAYLOAD_VERSION_RQ)
return (c->connection.obj_get_channel_payload_version_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_GET_CHANNEL_PAYLOAD_VERSION_RS)
return (c->connection.obj_get_channel_payload_version_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_DEACTIVATE_PAYLOAD_RQ)
return (c->connection.obj_deactivate_payload_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_DEACTIVATE_PAYLOAD_RS)
return (c->connection.obj_deactivate_payload_rs);
else if (p == IPMICONSOLE_PACKET_TYPE_CLOSE_SESSION_RQ)
return (c->connection.obj_close_session_rq);
else if (p == IPMICONSOLE_PACKET_TYPE_CLOSE_SESSION_RS)
return (c->connection.obj_close_session_rs);
else
{
IPMICONSOLE_CTX_DEBUG (c, ("invalid packet type: %d", p));
ipmiconsole_ctx_set_errnum (c, IPMICONSOLE_ERR_INTERNAL_ERROR);
return (NULL);
}
} | false | false | false | false | false | 0 |
toFile(QAction *action)
{
if (action == aSavePdf) {
QString f = QFileDialog::getSaveFileName(this, tr("Save File"),
QDir::homePath(),
tr("PDF file (*.pdf)"));
if (f.isEmpty())
return;
if (QFileInfo(f).completeSuffix().compare("pdf", Qt::CaseInsensitive) != 0)
f.append(".pdf");
if (m_Printer)
m_Printer->toPdf(f, "DFSDF");
} else if (action == aMailPdf) {
// TODO: code this
// QString fileName = QString("%1/%2.pdf")
// .arg(settings()->path(Core::ISettings::ApplicationTempPath))
// .arg(Utils::createUid());
// QDesktopServices::openUrl(QUrl(QString("mailto:?&subject=--&attachement=%1").arg("/Users/eric/essai.pdf")));
} else if (action == aSaveHtml) {
QString f = QFileDialog::getSaveFileName(this, tr("Save File"),
QDir::homePath(),
tr("HTML file (*.html *.htm)"));
if (f.isEmpty())
return;
if (QFileInfo(f).completeSuffix().compare("html", Qt::CaseInsensitive) != 0
&& QFileInfo(f).completeSuffix().compare("htm", Qt::CaseInsensitive) != 0)
f.append(".html");
if (m_Printer)
Utils::saveStringToFile(m_Printer->toHtml(), f);
} else if (action == aMailHtml) {
// TODO: code this
}
} | false | false | false | false | false | 0 |
Selector()
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
Gxw::Regler(Glib::ConstructParams(selector_class_.init()))
{
} | false | false | false | false | false | 0 |
CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const
{
const std::string extension = GetExtension(pFile);
if (extension == "hmp" )
return true;
// if check for extension is not enough, check for the magic tokens
if (!extension.length() || cs) {
uint32_t tokens[3];
tokens[0] = AI_HMP_MAGIC_NUMBER_LE_4;
tokens[1] = AI_HMP_MAGIC_NUMBER_LE_5;
tokens[2] = AI_HMP_MAGIC_NUMBER_LE_7;
return CheckMagicToken(pIOHandler,pFile,tokens,3,0);
}
return false;
} | false | false | false | false | false | 0 |
gck_attribute_init_copy (GckAttribute *dest,
const GckAttribute *src)
{
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);
dest->type = src->type;
if (src->length == G_MAXULONG) {
dest->value = NULL;
dest->length = G_MAXULONG;
} else if (src->value == NULL) {
dest->value = NULL;
dest->length = 0;
} else {
dest->value = value_ref (src->value);
dest->length = src->length;
}
} | false | false | false | false | false | 0 |
gtc_visit (tree t1, tree t2,
struct sccs *state,
vec<type_pair_t> *sccstack,
struct pointer_map_t *sccstate,
struct obstack *sccstate_obstack)
{
struct sccs *cstate = NULL;
type_pair_t p;
void **slot;
tree leader1, leader2;
/* Check first for the obvious case of pointer identity. */
if (t1 == t2)
return true;
/* Check that we have two types to compare. */
if (t1 == NULL_TREE || t2 == NULL_TREE)
return false;
/* Can't be the same type if the types don't have the same code. */
if (TREE_CODE (t1) != TREE_CODE (t2))
return false;
/* Can't be the same type if they have different CV qualifiers. */
if (TYPE_QUALS (t1) != TYPE_QUALS (t2))
return false;
if (TREE_ADDRESSABLE (t1) != TREE_ADDRESSABLE (t2))
return false;
/* Void types and nullptr types are always the same. */
if (TREE_CODE (t1) == VOID_TYPE
|| TREE_CODE (t1) == NULLPTR_TYPE)
return true;
/* Can't be the same type if they have different alignment or mode. */
if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2)
|| TYPE_MODE (t1) != TYPE_MODE (t2))
return false;
/* Do some simple checks before doing three hashtable queries. */
if (INTEGRAL_TYPE_P (t1)
|| SCALAR_FLOAT_TYPE_P (t1)
|| FIXED_POINT_TYPE_P (t1)
|| TREE_CODE (t1) == VECTOR_TYPE
|| TREE_CODE (t1) == COMPLEX_TYPE
|| TREE_CODE (t1) == OFFSET_TYPE
|| POINTER_TYPE_P (t1))
{
/* Can't be the same type if they have different sign or precision. */
if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2)
|| TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2))
return false;
if (TREE_CODE (t1) == INTEGER_TYPE
&& TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2))
return false;
/* That's all we need to check for float and fixed-point types. */
if (SCALAR_FLOAT_TYPE_P (t1)
|| FIXED_POINT_TYPE_P (t1))
return true;
/* For other types fall through to more complex checks. */
}
/* If the types have been previously registered and found equal
they still are. */
leader1 = gimple_lookup_type_leader (t1);
leader2 = gimple_lookup_type_leader (t2);
if (leader1 == t2
|| t1 == leader2
|| (leader1 && leader1 == leader2))
return true;
/* If the hash values of t1 and t2 are different the types can't
possibly be the same. This helps keeping the type-pair hashtable
small, only tracking comparisons for hash collisions. */
if (gimple_type_hash (t1) != gimple_type_hash (t2))
return false;
/* Allocate a new cache entry for this comparison. */
p = lookup_type_pair (t1, t2);
if (p->same_p == 0 || p->same_p == 1)
{
/* We have already decided whether T1 and T2 are the
same, return the cached result. */
return p->same_p == 1;
}
if ((slot = pointer_map_contains (sccstate, p)) != NULL)
cstate = (struct sccs *)*slot;
/* Not yet visited. DFS recurse. */
if (!cstate)
{
gimple_types_compatible_p_1 (t1, t2, p,
sccstack, sccstate, sccstate_obstack);
cstate = (struct sccs *)* pointer_map_contains (sccstate, p);
state->low = MIN (state->low, cstate->low);
}
/* If the type is still on the SCC stack adjust the parents low. */
if (cstate->dfsnum < state->dfsnum
&& cstate->on_sccstack)
state->low = MIN (cstate->dfsnum, state->low);
/* Return the current lattice value. We start with an equality
assumption so types part of a SCC will be optimistically
treated equal unless proven otherwise. */
return cstate->u.same_p;
} | false | false | false | false | false | 0 |
setGroupName(GroupRecord *groupRec, Symbol groupID)
{
GroupRecord *grec = NUL(GroupRecord*);
if (this->groups)
grec = (GroupRecord*)this->groups->findDefinition (groupID);
else if (groupRec)
this->groups = new Dictionary;
if (grec) {
if (groupRec)
this->groups->replaceDefinition (groupID, groupRec);
else
this->groups->removeDefinition (groupID);
} else if (groupRec)
this->groups->addDefinition (groupID, groupRec);
this->getNetwork()->setDirty();
} | false | false | false | false | false | 0 |
do_write(void * data, const char * str, size_t length)
{
MMAPString * f;
f = data;
if (mmap_string_append_len(f, str, length) == NULL)
return 0;
else
return (int) length;
} | false | false | false | false | false | 0 |
inthash_insert(inthash_t *tptr, int key, int data) {
int tmp;
inthash_node_t *node;
int h;
/* check to see if the entry exists */
if ((tmp=inthash_lookup(tptr, key)) != HASH_FAIL)
return(tmp);
/* expand the table if needed */
while (tptr->entries>=HASH_LIMIT*tptr->size)
rebuild_table_int(tptr);
/* insert the new entry */
h=inthash(tptr, key);
node=(struct inthash_node_t *) malloc(sizeof(inthash_node_t));
node->data=data;
node->key=key;
node->next=tptr->bucket[h];
tptr->bucket[h]=node;
tptr->entries++;
return HASH_FAIL;
} | false | false | false | false | false | 0 |
net_read( DirectStream *stream,
unsigned int length,
void *buf,
unsigned int *read_out )
{
int size;
size = recv( stream->fd, buf, length, 0 );
switch (size) {
case 0:
return DR_EOF;
case -1:
if (errno == EAGAIN || errno == EWOULDBLOCK)
return DR_BUFFEREMPTY;
return errno2result( errno );
}
stream->offset += size;
if (read_out)
*read_out = size;
return DR_OK;
} | false | false | false | false | false | 0 |
res_compare_resource (sc_resourceref_t from, sc_resourceref_t with)
{
return strcmp (from->name, with->name) == 0
&& from->offset == with->offset && from->length == with->length;
} | false | false | false | false | false | 0 |
index_index2prefix (const char* indextype)
{
char* prefix;
if ( indextype == NULL ) prefix = NULL;
else if ( indextype == indextype_PRESENCE ) prefix = prefix_PRESENCE;
else if ( indextype == indextype_EQUALITY ) prefix = prefix_EQUALITY;
else if ( indextype == indextype_APPROX ) prefix = prefix_APPROX;
else if ( indextype == indextype_SUB ) prefix = prefix_SUB;
else { /* indextype is a matching rule name */
const size_t len = strlen (indextype);
char* p = slapi_ch_malloc (len + 3);
p[0] = RULE_PREFIX;
memcpy( p+1, indextype, len );
p[len+1] = ':';
p[len+2] = '\0';
prefix = p;
}
return( prefix );
} | false | false | false | false | false | 0 |
slapi_index_register_decoder(char *plugin_id, index_validate_callback validate_op)
{
static int firstTime = 1;
static int gotIDLapi = 0;
int ret = 0;
indexPlugin *plg;
if(firstTime)
{
/* create the cache */
theCache = (globalIndexCache*)slapi_ch_malloc(sizeof(globalIndexCache));
if(theCache)
{
theCache->pPlugins = 0;
theCache->ppIndexIndex = 0;
theCache->index_count = 0;
theCache->cache_lock = slapi_new_rwlock();
firstTime = 0;
if(!gotIDLapi)
{
if(slapi_apib_get_interface(IDL_v1_0_GUID, &idl_api))
{
gotIDLapi = 1;
}
}
}
else
{
ret = -1;
goto bail;
}
}
index_subsys_write_lock();
/* add the index decoder to the cache - no checks, better register once only*/
plg = (indexPlugin*)slapi_ch_malloc(sizeof(indexPlugin));
if(plg)
{
plg->id = slapi_ch_strdup(plugin_id);
plg->indexes = 0;
plg->validate_op = validate_op;
/* we always add to the start of the linked list */
plg->list.pPrev = 0;
if(theCache->pPlugins)
{
plg->list.pNext = theCache->pPlugins;
theCache->pPlugins->list.pPrev = plg;
}
else
plg->list.pNext = 0;
theCache->pPlugins = plg;
}
else
ret = -1;
index_subsys_unlock();
bail:
return ret;
} | false | false | false | false | false | 0 |
exceptions_attribute_print(const ExceptionsAttribute* exceptions,
const ConstantPool* constant_pool)
{
char* exception_name;
int j;
printf("throws");
if (exceptions->no_exceptions > 0)
{
exception_name = jclass_cp_get_class_name(constant_pool, exceptions->exception_index[0], 0);
printf(" %s", exception_name);
free(exception_name);
}
for(j = 1; j < exceptions->no_exceptions; j++)
{
exception_name = jclass_cp_get_class_name(constant_pool, exceptions->exception_index[j], 0);
printf(", %s", exception_name);
free(exception_name);
}
} | false | false | false | false | false | 0 |
get_query_def(Query *query, StringInfo buf, List *parentnamespace,
TupleDesc resultDesc, int prettyFlags, int startIndent)
{
deparse_context context;
deparse_namespace dpns;
/*
* Before we begin to examine the query, acquire locks on referenced
* relations, and fix up deleted columns in JOIN RTEs. This ensures
* consistent results. Note we assume it's OK to scribble on the passed
* querytree!
*/
AcquireRewriteLocks(query, false);
context.buf = buf;
context.namespaces = lcons(&dpns, list_copy(parentnamespace));
context.windowClause = NIL;
context.windowTList = NIL;
context.varprefix = (parentnamespace != NIL ||
list_length(query->rtable) != 1);
context.prettyFlags = prettyFlags;
context.indentLevel = startIndent;
memset(&dpns, 0, sizeof(dpns));
dpns.rtable = query->rtable;
dpns.ctes = query->cteList;
switch (query->commandType)
{
case CMD_SELECT:
get_select_query_def(query, &context, resultDesc);
break;
case CMD_UPDATE:
get_update_query_def(query, &context);
break;
case CMD_INSERT:
get_insert_query_def(query, &context);
break;
case CMD_DELETE:
get_delete_query_def(query, &context);
break;
case CMD_NOTHING:
appendStringInfo(buf, "NOTHING");
break;
case CMD_UTILITY:
get_utility_query_def(query, &context);
break;
default:
elog(ERROR, "unrecognized query command type: %d",
query->commandType);
break;
}
} | false | false | false | false | false | 0 |
_clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline)
{
gboolean is_first;
if (g_slist_find (master_clock->timelines, timeline))
return;
is_first = master_clock->timelines == NULL;
master_clock->timelines = g_slist_prepend (master_clock->timelines,
timeline);
if (is_first)
{
master_clock_schedule_stage_updates (master_clock);
_clutter_master_clock_start_running (master_clock);
}
} | false | false | false | false | false | 0 |
halfpict ( void* vbuf )
{
char* buf = (char*) vbuf;
Uint16* wp = (Uint16*) xlatbuffer;
char* dest = (char*) xlatbuffer;
trleheader* hd = (trleheader*) vbuf;
if ( hd->id == 16973 ) {
wp[0] = hd->x / 2;
wp[1] = hd->y / 2;
if ( ( wp[0] + 1 ) * ( wp[1] + 1 ) + 4 >= xlatbuffersize )
throw fatalgraphicserror ( "halfpict : picture larger than buffer ! " );
dest += 4;
buf += sizeof ( *hd );
int linecount = 0;
int rowcount = 0;
for ( int c = 0; c < hd->size; c++ ) {
if ( *buf == hd->rle ) {
for ( int i = buf[1]; i > 0; i-- ) {
if ( !(linecount & 1) && !(rowcount & 1)) {
*dest = buf[2];
dest++;
}
rowcount++;
if ( rowcount > hd->x ) {
rowcount = 0;
linecount++;
}
}
buf += 3;
c += 2;
} else {
if ( !(linecount & 1) && !(rowcount & 1)) {
*dest = *buf;
dest++;
}
buf++;
rowcount++;
if ( rowcount > hd->x ) {
rowcount = 0;
linecount++;
}
}
if ( (PointerSizedInt)dest - (PointerSizedInt)xlatbuffer > xlatbuffersize )
throw fatalgraphicserror ( "halfpict : picture larger than buffer ! " );
}
} else {
int linecount = 0;
int rowcount = 0;
Uint16* wp2 = (Uint16*) vbuf;
wp[0] = wp2[0] / 2;
wp[1] = wp2[1] / 2;
if ( ( wp[0] + 1 ) * ( wp[1] + 1 ) + 4 >= xlatbuffersize )
throw fatalgraphicserror ( "halfpict : picture larger than buffer ! " );
dest += 4;
buf += 4;
for ( int c = (wp2[0] + 1) * (wp2[1] + 1); c > 0; c-- ) {
if ( !(linecount & 1) && !(rowcount & 1)) {
*dest = *buf;
dest++;
}
buf++;
rowcount++;
if ( rowcount > wp2[0] ) {
rowcount = 0;
linecount++;
}
}
}
return xlatbuffer;
} | false | false | false | false | false | 0 |
copy_skel_file( const char *sfile, /*source file*/
const char *dfile, /*destination file*/
const struct stat *st, /*stat of source file*/
uid_t uid, /*file owner*/
gid_t gid ) /*file group*/
{
char buf[ READ_BUF_SIZE ];
int sfd, dfd, count = 0, n;
/*must be absolute path*/
if( ! sfile || ! dfile ||
sfile[ 0 ] != '/' ||
dfile[ 0 ] != '/' )
{
msglog( MSG_WARNING, "copy_skel_file: invalid path" );
return 0;
}
if( ! ah_conf.noskelcheck )
{
/*definitly NO*/
if( st->st_mode & S_IWOTH )
{
msglog( MSG_WARNING, "copy_skel_file: " \
"world write permission for %s. omitting", sfile );
return 0;
}
/*we do not want more then one door to this file*/
if( st->st_nlink > 1 )
{
msglog( MSG_WARNING, "copy_skel_file: " \
"more then one hard link for %s. omitting", sfile );
return 0;
}
}
if( ( sfd = open( sfile, O_RDONLY ) ) == -1 )
{
msglog( MSG_WARNING, "copy_skel_file: " \
"open %s", sfile );
return 0;
}
dfd = open( dfile, O_WRONLY | O_CREAT | O_EXCL,
st->st_mode & S_IRWXU );
if( dfd == -1 )
{
if( errno == EEXIST )
{
msglog( MSG_NOTICE, "copy_skel_file: " \
"file %s already exists", dfile );
check_file_owner( dfile, uid );
}
else msglog( MSG_ERR|LOG_ERRNO, "copy_skel_file: open %s",
dfile );
return 0;
}
while( 1 )
{
n = read( sfd, buf, sizeof(buf) );
if( ! n )
{
if( fchown( dfd, uid, gid ) == -1 )
{
msglog( MSG_ERR|LOG_ERRNO,
"copy_skel_file: fchown %s", dfile );
return 0;
}
close( sfd );
close( dfd );
return 1;
}
else if( n < 0 )
msglog( MSG_ERR|LOG_ERRNO, "copy_skel_file: read %s",
sfile );
else if( ( count = count + n ) > SKEL_FILE_MAX_COPY
&& ! ah_conf.noskelcheck )
msglog( MSG_WARNING, "copy_skel_file: " \
"%s exceeding size limit", sfile );
else if( ! write_all( dfd, buf, n ) )
msglog( MSG_ERR, "copy_skel_file: write error %s",
dfile );
else continue;
/*Remove the file if half copied or for some other errors.*/
/*Assuming nothing better then something in inconsistent state.*/
unlink( dfile );
break;
}
close( sfd );
close( dfd );
return 0;
} | false | false | false | false | false | 0 |
ubiblock_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd)
{
struct request *req = bd->rq;
struct ubiblock *dev = hctx->queue->queuedata;
struct ubiblock_pdu *pdu = blk_mq_rq_to_pdu(req);
if (req->cmd_type != REQ_TYPE_FS)
return BLK_MQ_RQ_QUEUE_ERROR;
if (rq_data_dir(req) != READ)
return BLK_MQ_RQ_QUEUE_ERROR; /* Write not implemented */
ubi_sgl_init(&pdu->usgl);
queue_work(dev->wq, &pdu->work);
return BLK_MQ_RQ_QUEUE_OK;
} | false | false | false | false | false | 0 |
df_bb_luids_set (struct df *df, basic_block bb)
{
rtx insn;
int luid = 0;
/* The LUIDs are monotonically increasing for each basic block. */
for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
{
if (INSN_P (insn))
DF_INSN_LUID (df, insn) = luid++;
DF_INSN_LUID (df, insn) = luid;
if (insn == BB_END (bb))
break;
}
return luid;
} | false | false | false | false | false | 0 |
gfs_stat_caching(const char *path, struct gfs_stat *st)
{
int nattrs;
char **attrnames;
void **attrvalues;
size_t *attrsizes;
gfarm_error_t e = gfs_getattrplus_caching(path,
gfarm_xattr_caching_patterns(),
gfarm_xattr_caching_patterns_number(),
st, &nattrs, &attrnames, &attrvalues, &attrsizes);
if (e != GFARM_ERR_NO_ERROR)
return (e);
gfarm_strings_free_deeply(nattrs, attrnames);
gfarm_anyptrs_free_deeply(nattrs, attrvalues);
free(attrsizes);
return (e);
} | false | false | false | false | false | 0 |
__pyx_tp_clear_6Cython_8Compiler_7Visitor_RecursiveNodeReplacer(PyObject *o) {
PyObject* tmp;
struct __pyx_obj_6Cython_8Compiler_7Visitor_RecursiveNodeReplacer *p = (struct __pyx_obj_6Cython_8Compiler_7Visitor_RecursiveNodeReplacer *)o;
__pyx_tp_clear_6Cython_8Compiler_7Visitor_TreeVisitor(o);
tmp = ((PyObject*)p->orig_node);
p->orig_node = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->new_node);
p->new_node = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
} | false | false | false | false | false | 0 |
get_array_subscript_semnode(SemanticNode *array_node, int dim)
{
List *tlist;
for(tlist = array_node->ldata->data.leaf->subtree;
dim > 0 && tlist != NULL;
dim--, tlist = tlist->next);
return tlist->data;
} | false | false | false | true | false | 1 |
fffile (qdaemon, qtrans, fstart, fsend, cbytes, pfhandled)
struct sdaemon *qdaemon;
struct stransfer *qtrans;
boolean fstart;
boolean fsend;
long cbytes ATTRIBUTE_UNUSED;
boolean *pfhandled;
{
DEBUG_MESSAGE3 (DEBUG_PROTO, "fffile: fstart %s; fsend %s; fFacked %s",
fstart ? "true" : "false", fsend ? "true" : "false",
fFacked ? "true" : "false");
*pfhandled = FALSE;
if (fstart)
{
iFcheck = 0xffff;
cFretries = 0;
fFacked = FALSE;
if (! fsend)
{
bFspecial = 0;
fFfile = TRUE;
}
return TRUE;
}
else
{
struct sfinfo *qinfo;
/* We need to handle the checksum and the acknowledgement. If
we get a successful ACK, we set fFacked to TRUE and call the
send or receive function by hand. This will wind up calling
here again, so if fFacked is TRUE we just return out and let
the send or receive function do whatever it does. This is a
bit of a hack. */
if (fFacked)
{
fFacked = FALSE;
return TRUE;
}
if (fsend)
{
char ab[sizeof "\176\176ABCD\r"];
/* Send the final checksum. */
sprintf (ab, "\176\176%04x\r", iFcheck & 0xffff);
if (! fsend_data (qdaemon->qconn, ab, (size_t) 7, TRUE))
return FALSE;
/* Now wait for the acknowledgement. */
fFfile = FALSE;
qinfo = (struct sfinfo *) xmalloc (sizeof (struct sfinfo));
qinfo->psendfn = qtrans->psendfn;
qinfo->precfn = qtrans->precfn;
qinfo->pinfo = qtrans->pinfo;
qtrans->psendfn = NULL;
qtrans->precfn = ffawait_ack;
qtrans->pinfo = (pointer) qinfo;
qtrans->fcmd = TRUE;
*pfhandled = TRUE;
return fqueue_receive (qdaemon, qtrans);
}
else
{
/* Wait for the checksum. */
fFfile = FALSE;
qinfo = (struct sfinfo *) xmalloc (sizeof (struct sfinfo));
qinfo->psendfn = qtrans->psendfn;
qinfo->precfn = qtrans->precfn;
qinfo->pinfo = qtrans->pinfo;
qtrans->psendfn = NULL;
qtrans->precfn = ffawait_cksum;
qtrans->pinfo = (pointer) qinfo;
qtrans->fcmd = TRUE;
*pfhandled = TRUE;
return fqueue_receive (qdaemon, qtrans);
}
}
} | false | false | false | false | false | 0 |
createTabWidget() {
//return new QStackedWidget(this);
FTabWidget * tabWidget = new FTabWidget(this);
tabWidget->setObjectName("sketch_tabs");
return tabWidget;
} | false | false | false | false | false | 0 |
blinkTimeOut(void)
{
V v = (model()!=0)?((AplusModel*)model())->aplusVar():0;
if (blinkPhase()==Normal)
{
A newBlink=blinkFunc()->invoke(v,aplus_nl);
if (verifyBlink(newBlink)==MSTrue)
{
MSBoolean stopTimer=(drawBlink(newBlink,Reverse)==MSTrue)?MSFalse:MSTrue;
blink(newBlink);
toggleBlinkPhase();
if (stopTimer==MSTrue) stopBlinkTimer();
}
dc(newBlink);
}
else // reverse
{
(void)drawBlink(blink(),Normal);
toggleBlinkPhase();
}
} | false | false | false | false | false | 0 |
gretl_list_from_vector (const gretl_vector *v, int *err)
{
int i, n = gretl_vector_get_length(v);
int *list = NULL;
if (n == 0) {
*err = E_DATA;
} else {
list = gretl_list_new(n);
if (list == NULL) {
*err = E_ALLOC;
} else {
for (i=0; i<n; i++) {
list[i+1] = (int) v->val[i];
}
}
}
return list;
} | false | false | false | false | false | 0 |
stmpe811_enable(struct stmpe *stmpe, unsigned int blocks,
bool enable)
{
unsigned int mask = 0;
if (blocks & STMPE_BLOCK_GPIO)
mask |= STMPE811_SYS_CTRL2_GPIO_OFF;
if (blocks & STMPE_BLOCK_ADC)
mask |= STMPE811_SYS_CTRL2_ADC_OFF;
if (blocks & STMPE_BLOCK_TOUCHSCREEN)
mask |= STMPE811_SYS_CTRL2_TSC_OFF;
return __stmpe_set_bits(stmpe, STMPE811_REG_SYS_CTRL2, mask,
enable ? 0 : mask);
} | false | false | false | false | false | 0 |
spawnPrenegs(int num) {
int loopstart, node, spawned = 0, r;
if(nextprenegnode < 0) nextprenegnode = rand() % (maxvpnnodeid + 1);
loopstart = nextprenegnode;
node = loopstart;
for(;;) {
if(NODEINFO_EXISTS(node) && node != global_config.id && !NODEINFO_INFO(node).negotiated) {
if(!tcpcon_checkExistingConn(node, TCPCON_NEGOTIATION, 2)) {
logmsg(LOGGER_DEBUG, "Spawning negotiation to node %d", node);
r = tcpcon_newnegotiate(node);
if(r != TCPCON_OK) {
logmsg(LOGGER_ERR, "Error starting negotiation");
} else {
spawned++;
}
}
}
node++;
if(node > maxvpnnodeid) node = 0;
if(node == loopstart) break;
if(spawned >= num) break;
}
nextprenegnode = node;
return 0;
} | false | false | false | false | false | 0 |
ui_create_properties (const ui_property_t *prop, se_o_t *parent,
se_prop_type_t type)
{
int i;
se_prop_cb_t cb = NULL;
switch (type)
{
case SE_TYPE_INT: cb = ui_prop_set_int; break;
case SE_TYPE_BOOL: cb = ui_prop_set_bool; break;
default:;
}
for (i = 0; prop[i].name; ++i)
{
se_o_t *obj =
se_create_object (gse, parent, prop[i].name, NULL, SE_GROUP_PROPERTIES,
gettext (prop[i].help));
se_prop_create_with_reader (gse, obj, "v", "", type, (intptr_t) &prop[i],
FALSE, ui_prop_get);
if (prop[i].listen.cb)
se_prop_add_listener (gse, obj, "v", prop[i].listen.cb,
prop[i].listen.user_data);
else
se_prop_add_listener (gse, obj, "v", cb, (void *)&prop[i]);
switch (type)
{
case SE_TYPE_INT:
se_prop_create_int (gse, obj, "min", prop[i].min, TRUE);
se_prop_create_int (gse, obj, "max", prop[i].max, TRUE);
break;
case SE_TYPE_BOOL:
se_defun (gse, obj, "toggle", ui_prop_toggle_bool, 0, JSFUN_FAST_NATIVE,
SE_GROUP_HIDDEN, NULL, NULL);
break;
default:; /* we don't handle string and float */
}
}
} | false | false | false | false | false | 0 |
resolve_symbol (const char *name,
bfd *input_bfd,
struct elf_final_link_info *flinfo,
bfd_vma *result,
Elf_Internal_Sym *isymbuf,
size_t locsymcount)
{
Elf_Internal_Sym *sym;
struct bfd_link_hash_entry *global_entry;
const char *candidate = NULL;
Elf_Internal_Shdr *symtab_hdr;
size_t i;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
for (i = 0; i < locsymcount; ++ i)
{
sym = isymbuf + i;
if (ELF_ST_BIND (sym->st_info) != STB_LOCAL)
continue;
candidate = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym->st_name);
#ifdef DEBUG
printf ("Comparing string: '%s' vs. '%s' = 0x%lx\n",
name, candidate, (unsigned long) sym->st_value);
#endif
if (candidate && strcmp (candidate, name) == 0)
{
asection *sec = flinfo->sections [i];
*result = _bfd_elf_rel_local_sym (input_bfd, sym, &sec, 0);
*result += sec->output_offset + sec->output_section->vma;
#ifdef DEBUG
printf ("Found symbol with value %8.8lx\n",
(unsigned long) *result);
#endif
return TRUE;
}
}
/* Hmm, haven't found it yet. perhaps it is a global. */
global_entry = bfd_link_hash_lookup (flinfo->info->hash, name,
FALSE, FALSE, TRUE);
if (!global_entry)
return FALSE;
if (global_entry->type == bfd_link_hash_defined
|| global_entry->type == bfd_link_hash_defweak)
{
*result = (global_entry->u.def.value
+ global_entry->u.def.section->output_section->vma
+ global_entry->u.def.section->output_offset);
#ifdef DEBUG
printf ("Found GLOBAL symbol '%s' with value %8.8lx\n",
global_entry->root.string, (unsigned long) *result);
#endif
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
merge_identical_invariants (void)
{
unsigned i;
struct invariant *inv;
htab_t eq = htab_create (VEC_length (invariant_p, invariants),
hash_invariant_expr, eq_invariant_expr, free);
FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv)
find_identical_invariants (eq, inv);
htab_delete (eq);
} | false | false | false | false | false | 0 |
statistic_result_get_pos(gint tmpfor, guint from, Transaction *ope)
{
gint pos = 0;
switch(tmpfor)
{
case STAT_CATEGORY:
{
Category *catentry = da_cat_get(ope->kcat);
if(catentry)
pos = (catentry->flags & GF_SUB) ? catentry->parent : catentry->key;
}
break;
case STAT_SUBCATEGORY:
pos = ope->kcat;
break;
case STAT_PAYEE:
pos = ope->kpay;
break;
case STAT_MONTH:
pos = DateInPer(from, ope->date);
break;
case STAT_YEAR:
pos = DateInYear(from, ope->date);
break;
}
return pos;
} | false | false | false | false | false | 0 |
sarrayCreateLinesFromString(char *string,
l_int32 blankflag)
{
l_int32 i, nsub, size, startptr;
char *cstring, *substring;
SARRAY *sa;
PROCNAME("sarrayCreateLinesFromString");
if (!string)
return (SARRAY *)ERROR_PTR("textstr not defined", procName, NULL);
/* find the number of lines */
size = strlen(string);
nsub = 0;
for (i = 0; i < size; i++) {
if (string[i] == '\n')
nsub++;
}
if ((sa = sarrayCreate(nsub)) == NULL)
return (SARRAY *)ERROR_PTR("sa not made", procName, NULL);
if (blankflag) { /* keep blank lines as null strings */
/* Make a copy for munging */
if ((cstring = stringNew(string)) == NULL)
return (SARRAY *)ERROR_PTR("cstring not made", procName, NULL);
/* We'll insert nulls like strtok */
startptr = 0;
for (i = 0; i < size; i++) {
if (cstring[i] == '\n') {
cstring[i] = '\0';
if ((substring = stringNew(cstring + startptr)) == NULL)
return (SARRAY *)ERROR_PTR("substring not made",
procName, NULL);
sarrayAddString(sa, substring, L_INSERT);
/* fprintf(stderr, "substring = %s\n", substring); */
startptr = i + 1;
}
}
if (startptr < size) { /* no newline at end of last line */
if ((substring = stringNew(cstring + startptr)) == NULL)
return (SARRAY *)ERROR_PTR("substring not made",
procName, NULL);
sarrayAddString(sa, substring, L_INSERT);
/* fprintf(stderr, "substring = %s\n", substring); */
}
FREE(cstring);
}
else { /* remove blank lines; use strtok */
sarraySplitString(sa, string, "\n");
}
return sa;
} | false | false | false | false | false | 0 |
depmod_load_dependencies(struct depmod *depmod)
{
struct mod **itr, **itr_end;
DBG("load dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
itr = (struct mod **)depmod->modules.array;
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
struct mod *mod = *itr;
if (mod->dep_sym_list == NULL) {
DBG("ignoring %s: no dependency symbols\n", mod->path);
continue;
}
depmod_load_module_dependencies(depmod, mod);
}
DBG("loaded dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
} | false | false | false | false | false | 0 |
openoutput(struct mimestruct *m)
{
if (!m->outputfile)
m->outputfile="-";
m->outputfp= openfile_or_pipe(m->outputfile, "w");
} | false | false | false | false | false | 0 |
find_output_segment(elfcpp::PT type, elfcpp::Elf_Word set,
elfcpp::Elf_Word clear) const
{
for (Segment_list::const_iterator p = this->segment_list_.begin();
p != this->segment_list_.end();
++p)
if (static_cast<elfcpp::PT>((*p)->type()) == type
&& ((*p)->flags() & set) == set
&& ((*p)->flags() & clear) == 0)
return *p;
return NULL;
} | false | false | false | false | false | 0 |
decimal_bin_size(int precision, int scale)
{
int intg=precision-scale,
intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1;
DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision);
return intg0*sizeof(dec1)+dig2bytes[intg0x]+
frac0*sizeof(dec1)+dig2bytes[frac0x];
} | false | false | false | false | false | 0 |
vmw_dx_shader_unbind(struct vmw_resource *res,
bool readback,
struct ttm_validate_buffer *val_buf)
{
struct vmw_private *dev_priv = res->dev_priv;
struct vmw_fence_obj *fence;
int ret;
BUG_ON(res->backup->base.mem.mem_type != VMW_PL_MOB);
mutex_lock(&dev_priv->binding_mutex);
ret = vmw_dx_shader_scrub(res);
mutex_unlock(&dev_priv->binding_mutex);
if (ret)
return ret;
(void) vmw_execbuf_fence_commands(NULL, dev_priv,
&fence, NULL);
vmw_fence_single_bo(val_buf->bo, fence);
if (likely(fence != NULL))
vmw_fence_obj_unreference(&fence);
return 0;
} | false | false | false | false | false | 0 |
o_material(obj, material)
struct obj* obj;
unsigned material;
{
register struct obj* otmp;
struct obj *temp;
if (objects[obj->otyp].oc_material == material) return obj;
if (Has_contents(obj)) {
for (otmp = obj->cobj; otmp; otmp = otmp->nobj)
if (objects[otmp->otyp].oc_material == material) return otmp;
else if (Has_contents(otmp) && (temp = o_material(otmp, material)))
return temp;
}
return (struct obj *) 0;
} | false | false | false | false | false | 0 |
kvm_load_guest_xcr0(struct kvm_vcpu *vcpu)
{
if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) &&
!vcpu->guest_xcr0_loaded) {
/* kvm_set_xcr() also depends on this */
xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0);
vcpu->guest_xcr0_loaded = 1;
}
} | false | false | false | false | false | 0 |
SetColorTable( GDALColorTable *poColorTable )
{
RMFDataset *poGDS = (RMFDataset *) poDS;
if ( poColorTable )
{
if ( poGDS->eRMFType == RMFT_RSW && poGDS->nBands == 1 )
{
GDALColorEntry oEntry;
GUInt32 i;
if ( !poGDS->pabyColorTable )
return CE_Failure;
for( i = 0; i < poGDS->nColorTableSize; i++ )
{
poColorTable->GetColorEntryAsRGB( i, &oEntry );
poGDS->pabyColorTable[i * 4] = (GByte) oEntry.c1; // Red
poGDS->pabyColorTable[i * 4 + 1] = (GByte) oEntry.c2; // Green
poGDS->pabyColorTable[i * 4 + 2] = (GByte) oEntry.c3; // Blue
poGDS->pabyColorTable[i * 4 + 3] = 0;
}
poGDS->bHeaderDirty = TRUE;
}
}
else
return CE_Failure;
return CE_None;
} | false | false | false | false | false | 0 |
pointer_diff (tree op0, tree op1, tree ptrtype, tsubst_flags_t complain)
{
tree result;
tree restype = ptrdiff_type_node;
tree target_type = TREE_TYPE (ptrtype);
if (!complete_type_or_else (target_type, NULL_TREE))
return error_mark_node;
if (TREE_CODE (target_type) == VOID_TYPE)
{
if (complain & tf_error)
permerror (input_location, "ISO C++ forbids using pointer of "
"type %<void *%> in subtraction");
else
return error_mark_node;
}
if (TREE_CODE (target_type) == FUNCTION_TYPE)
{
if (complain & tf_error)
permerror (input_location, "ISO C++ forbids using pointer to "
"a function in subtraction");
else
return error_mark_node;
}
if (TREE_CODE (target_type) == METHOD_TYPE)
{
if (complain & tf_error)
permerror (input_location, "ISO C++ forbids using pointer to "
"a method in subtraction");
else
return error_mark_node;
}
/* First do the subtraction as integers;
then drop through to build the divide operator. */
op0 = cp_build_binary_op (input_location,
MINUS_EXPR,
cp_convert (restype, op0, complain),
cp_convert (restype, op1, complain),
complain);
/* This generates an error if op1 is a pointer to an incomplete type. */
if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
{
if (complain & tf_error)
error ("invalid use of a pointer to an incomplete type in "
"pointer arithmetic");
else
return error_mark_node;
}
op1 = (TYPE_PTROB_P (ptrtype)
? size_in_bytes (target_type)
: integer_one_node);
/* Do the division. */
result = build2 (EXACT_DIV_EXPR, restype, op0,
cp_convert (restype, op1, complain));
return fold_if_not_in_template (result);
} | false | false | false | false | false | 0 |
_dbus_string_append_byte_as_hex (DBusString *str,
unsigned char byte)
{
const char hexdigits[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'
};
if (!_dbus_string_append_byte (str,
hexdigits[(byte >> 4)]))
return FALSE;
if (!_dbus_string_append_byte (str,
hexdigits[(byte & 0x0f)]))
{
_dbus_string_set_length (str,
_dbus_string_get_length (str) - 1);
return FALSE;
}
return TRUE;
} | true | true | false | false | false | 1 |
unpack_border(int n, int first, double *buf)
{
int i,m,last;
m = 0;
last = first + n;
for (i = first; i < last; i++) {
if (i == nmax) grow(0);
x[i][0] = buf[m++];
x[i][1] = buf[m++];
x[i][2] = buf[m++];
tag[i] = static_cast<int> (buf[m++]);
type[i] = static_cast<int> (buf[m++]);
mask[i] = static_cast<int> (buf[m++]);
q[i] = buf[m++];
}
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} | false | false | false | false | false | 0 |
libnet_seed_prand()
{
struct timeval seed;
if (gettimeofday(&seed, NULL) == -1)
{
perror("seed_rand: cannot gettimeofday");
return (-1);
}
/*
* More entropy then just seeding with time(2).
*/
srandom((unsigned)(seed.tv_sec ^ seed.tv_usec));
return (1);
} | false | false | false | false | false | 0 |
last_chars(struct fa *fa) {
bitset *bs = bitset_init(UCHAR_NUM);
list_for_each(s, fa->initial) {
for (int i=0; i < s->tused; i++) {
if (s->trans[i].to->accept) {
for (uint c = s->trans[i].min; c <= s->trans[i].max; c++)
bitset_set(bs, c);
}
}
}
return bs;
} | 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.