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 |
|---|---|---|---|---|---|---|
hexdigit_value(U8 c)
{
return c <= '9' ? c - '0' : c <= 'F' ? c - 'A' + 10 : c - 'a' + 10;
} | false | false | false | false | false | 0 |
id_all(void)
{
short i;
for (i = 0; i < SCROLS; i++) {
id_scrolls[i].id_status = IDENTIFIED;
}
for (i = 0; i < WEAPONS; i++) {
id_weapons[i].id_status = IDENTIFIED;
}
for (i = 0; i < ARMORS; i++) {
id_armors[i].id_status = IDENTIFIED;
}
for (i = 0; i < WANDS; i++) {
id_wands[i].id_s... | false | false | false | false | false | 0 |
string_seq (void)
{
const char *s1, *s2;
size_t l1, l2;
char *buf;
s1 = require (STRING);
if (s1 == 0)
return "";
while (token () == STRING)
{
s2 = advance ();
l1 = strlen (s1);
l2 = strlen (s2);
buf = XRESIZEVEC (char, CONST_CAST (char *, s1), l1 + l2 + 1);
memcpy (b... | false | false | false | false | false | 0 |
us5182d_get_platform_data(struct iio_dev *indio_dev)
{
struct us5182d_data *data = iio_priv(indio_dev);
if (device_property_read_u32(&data->client->dev, "upisemi,glass-coef",
&data->ga))
data->ga = US5182D_GA_RESOLUTION;
if (device_property_read_u16_array(&data->client->dev,
"upisemi,dark-ths",
... | false | false | false | false | false | 0 |
pm_waitForReqCmpltnOrSttChnge(omniOrbPOAManager::State state)
{
ASSERT_OMNI_TRACEDMUTEX_HELD(*omni::internalLock, 0);
// Wait until all outstanding requests have completed,
// or until the state has changed.
omni::internalLock->lock();
pd_signalOnZeroInvocations++;
while( pd_rq_state == (int) state && pd... | false | false | false | false | false | 0 |
ghash_grow(struct ghash* d, unsigned count)
{
unsigned i;
unsigned newsize;
void** newtable;
void** oldtable;
unsigned oldsize;
count *= 2;
if (d->size >= count) return 1;
for (i = 0; count > size_prime_list[i]; ++i) ;
newsize = size_prime_list[i];
if ((newtable = malloc(newsize * sizeof *newtable))... | false | false | false | false | false | 0 |
fc_timeout_deleted_rport(struct work_struct *work)
{
struct fc_rport *rport =
container_of(work, struct fc_rport, dev_loss_work.work);
struct Scsi_Host *shost = rport_to_shost(rport);
struct fc_internal *i = to_fc_internal(shost->transportt);
struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
unsigned long... | false | false | false | false | false | 0 |
status_menu_set_option (StatusMenu *self,
const std::string & presence,
const std::string & status)
{
GtkTreeIter iter;
bool valid = false;
gchar *sstatus = NULL;
int i = 0;
int cpt = 0;
if (presence.empty ())
return;
valid = gtk_tree_model_get_iter_f... | false | false | false | false | false | 0 |
tlv_valid(const struct forces_tlv *tlv, u_int rlen)
{
if (rlen < TLV_HDRL)
return INVALID_RLEN;
if (EXTRACT_16BITS(&tlv->length) < TLV_HDRL)
return INVALID_STLN;
if (EXTRACT_16BITS(&tlv->length) > rlen)
return INVALID_LTLN;
if (rlen < F_ALN_LEN(EXTRACT_16BITS(&tlv->length)))
return INVALID_ALEN;
return 0;... | false | false | false | false | false | 0 |
TypeHasComponent(Type *T, uint64_t Offset, uint64_t Size,
const DataLayout &DL) {
Type *EltTy;
uint64_t EltSize;
if (StructType *ST = dyn_cast<StructType>(T)) {
const StructLayout *Layout = DL.getStructLayout(ST);
unsigned EltIdx = Layout->getElementContainingOffset(Offset);
... | false | false | false | false | false | 0 |
sync_bail( sync_vars_t *svars )
{
sync_rec_t *srec, *nsrec;
for (srec = svars->srecs; srec; srec = nsrec) {
nsrec = srec->next;
free( srec );
}
unlink( svars->lname );
sync_bail1( svars );
} | false | false | false | false | false | 0 |
execute()
{
if(!initialized)
runtime_initialize();
unsigned int r = cpu_pic->registers[source]->get();
cpu_pic->registers[destination]->put(r);
cpu16->pc->skip();
//cpu16->pc->increment();
} | false | false | false | false | false | 0 |
img_pwm_probe(struct platform_device *pdev)
{
int ret;
u64 val;
unsigned long clk_rate;
struct resource *res;
struct img_pwm_chip *pwm;
const struct of_device_id *of_dev_id;
pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
if (!pwm)
return -ENOMEM;
pwm->dev = &pdev->dev;
res = platform_get_resou... | false | false | false | false | false | 0 |
snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
{
struct snd_pcm *pcm;
struct snd_kcontrol *kctl;
int err;
if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0)
return err;
pcm->private_data = emu;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_emu10k1_fx8010_playback_ops)... | false | false | false | false | false | 0 |
get_term_capabilities (bp)
char **bp;
{
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
#endif
tcap_initialized = 1;
} | false | false | false | false | false | 0 |
_fill_data(E_Config_Dialog_Data *cfdata)
{
Eina_List *todo = eina_list_clone(e_color_class_list());
E_Color_Class *cc;
_fill_data_add_header(cfdata, _("Window Manager"), "enlightenment");
_fill_data_add_batch(cfdata, &todo, _color_classes_wm);
_fill_data_add_header(cfdata, _("Widgets"), NULL);
_fill_... | true | true | false | false | false | 1 |
write_register(struct net_device *dev, u32 reg, u32 val)
{
struct ipw2100_priv *priv = libipw_priv(dev);
iowrite32(val, priv->ioaddr + reg);
IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val);
} | false | false | false | false | false | 0 |
parse_u32(const char *str, int *r)
{
char *endptr;
*r = strtol(str, &endptr, 10);
return *endptr != 0 || *r < 0;
} | false | false | false | false | false | 0 |
midi_mt32_patch001_type(guint8 *data, unsigned int length)
{
if (data == NULL) /* kq4 doesn't have a patch */
return 2;
/* length test */
if (length < 1155)
return 0;
if (length > 16889)
return 1;
if (midi_mt32_patch001_type0_length(data, length) &&
!midi_mt32_patch001_type1_length(data, length))
re... | false | false | false | false | false | 0 |
kDeviceInfo_Unix(state_t *s, int funct_nr, int argc, reg_t *argv)
{
int mode = UKPV(0);
switch(mode) {
case K_DEVICE_INFO_GET_DEVICE: {
char *output_s = kernel_dereference_char_pointer(s, argv[2], 0);
strcpy(output_s, "/");
}
break;
case K_DEVICE_INFO_GET_CURRENT_DEVICE: {
char *output_s = kernel_deref... | false | false | false | false | false | 0 |
xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
xmlNodePtr next;
xmlDictPtr dict;
dict = reader->ctxt->dict;
if (cur == NULL) return;
if (cur->type == XML_NAMESPACE_DECL) {
xmlFreeNsList((xmlNsPtr) cur);
return;
}
if ((cur->type == XML_DOCUMENT_NODE) ||
... | false | false | false | false | false | 0 |
mono_store_remote_field_new (MonoObject *this, MonoClass *klass, MonoClassField *field, MonoObject *arg)
{
static MonoMethod *setter = NULL;
MonoDomain *domain = mono_domain_get ();
MonoTransparentProxy *tp = (MonoTransparentProxy *) this;
MonoClass *field_class;
MonoMethodMessage *msg;
MonoArray *out_args;
Mono... | false | false | false | false | false | 0 |
gth_toggle_menu_action_create_tool_item (GtkAction *action)
{
GthToggleMenuAction *self = GTH_TOGGLE_MENU_ACTION (action);
GtkWidget *tool_item;
tool_item = g_object_new (GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON,
"show-arrow", self->priv->show_arrow,
NULL);
if (self->priv->show_menu_func != NULL)
g... | false | false | false | false | false | 0 |
dumpProcedureDataEntry(const COFFObjectFile &COFF,
const SectionRef Section, unsigned Index,
ArrayRef<uint8_t> Contents) {
uint64_t Offset = PDataEntrySize * Index;
const ulittle32_t *Data =
reinterpret_cast<const ulittle32_t *>(Contents.... | false | false | false | false | false | 0 |
parse_window_geometry(char *geom, int is_button_geometry)
{
int flags;
int g_x;
int g_y;
unsigned int width;
unsigned int height;
flags = FScreenParseGeometry(geom, &g_x, &g_y, &width, &height);
UberButton->w = 0;
UberButton->h = 0;
UberButton->x = 0;
UberButton->y = 0;
if (is_button_geometry)
{
if (flag... | false | false | false | false | false | 0 |
xinput(ev, cldata)
XEvent *ev;
XtPointer cldata;
{
XClientMessageEvent *event = (XClientMessageEvent *)ev;
IMConnection *conn = (IMConnection *)cldata;
int cond;
Atom msg_type;
TRACE(("imlib:xinput()\n"));
if (event->type != ClientMessage ||
event->window != conn->transport.priv.x.server) {
... | false | false | false | false | false | 0 |
abraca_collections_model_on_collection_remove (AbracaCollectionsModel* self, AbracaClient* c, const gchar* name, const gchar* ns) {
GtkTreeIter iter = {0};
GtkTreeIter parent = {0};
const gchar* _tmp0_;
GtkTreeIter _tmp3_;
GtkTreeIter _tmp4_ = {0};
g_return_if_fail (self != NULL);
g_return_if_fail (c != NULL);
... | false | false | false | false | false | 0 |
hitprank(t1, t2)
struct hit *t1, *t2;
{
double diff;
diff = t1->rank_pvalue - t2->rank_pvalue;
if (diff < 0.0 ) { return(-1); }
else
{
if (diff > 0.0) { return(1); }
else
{
diff = t1->prob_min - t2->prob_min;
if (diff < 0.0 ) { return(-1); }
... | false | false | false | false | false | 0 |
emptyCache()
{
bool hasTrack, hasAlbum, hasArtist, hasYear, hasGenre, hasComposer, hasLabel;
hasTrack = hasAlbum = hasArtist = hasYear = hasGenre = hasComposer = hasLabel = false;
//try to avoid possible deadlocks by aborting when we can't get all locks
if ( ( hasTrack = m_trackLock.tryLockForWrite() )... | false | false | false | false | false | 0 |
close()
{
if(mFilePtr != 0)
fclose(mFilePtr);
mFilePtr = 0;
m3DgFilePath.clear();
} | false | false | false | false | false | 0 |
OptimizeBranches(MachineFunction &MF) {
bool MadeChange = false;
// Make sure blocks are numbered in order
MF.RenumberBlocks();
for (MachineFunction::iterator I = llvm::next(MF.begin()), E = MF.end();
I != E; ) {
MachineBasicBlock *MBB = I++;
MadeChange |= OptimizeBlock(MBB);
// If it is d... | false | false | false | false | false | 0 |
MergeUsingImpl(io::ZeroCopyInputStream* input,
Message* output,
ParserImpl* parser_impl) {
if (!parser_impl->Parse(output)) return false;
if (!allow_partial_ && !output->IsInitialized()) {
vector<string> missing_fields;
output->... | false | false | false | false | false | 0 |
libconfig_yyerror(void *scanner, struct parse_context *ctx,
struct scan_context *scan_ctx, char const *s)
{
if(ctx->config->error_text) return;
ctx->config->error_line = libconfig_yyget_lineno(scanner);
ctx->config->error_text = s;
} | false | false | false | false | false | 0 |
carl9170_usb_load_firmware(struct ar9170 *ar)
{
const u8 *data;
u8 *buf;
unsigned int transfer;
size_t len;
u32 addr;
int err = 0;
buf = kmalloc(4096, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto err_out;
}
data = ar->fw.fw->data;
len = ar->fw.fw->size;
addr = ar->fw.address;
/* this removes the min... | false | true | false | false | false | 1 |
umockdev_script_runner_construct (GType object_type, const gchar* device, const gchar* script_file, gint fd, GError** error) {
UMockdevScriptRunner* self = NULL;
const gchar* _tmp0_ = NULL;
FILE* _tmp1_ = NULL;
FILE* _tmp2_ = NULL;
const gchar* _tmp8_ = NULL;
const gchar* _tmp9_ = NULL;
gchar* _tmp10_ = NULL;
g... | false | false | false | false | false | 0 |
QueryCloseAll()
{
for (int i = m_pNotebook->GetPageCount() - 1; i >= 0; --i)
{
SEditorBase* eb = InternalGetEditorBase(i);
if(eb && !QueryClose(eb))
return false; // aborted
}
return true;
} | false | false | false | false | false | 0 |
current_titlebar_color(void)
{
TITLE_S *tc;
COLOR_PAIR *col;
COLOR_PAIR *the_color = NULL;
tc = format_titlebar();
col = tc ? &tc->color : NULL;
if(col && col->fg && col->fg[0] && col->bg && col->bg[0])
the_color = new_color_pair(col->fg, col->bg);
return(the_color);
} | false | false | false | false | false | 0 |
get_sdram_scrub_rate(struct mem_ctl_info *mci)
{
const struct scrubrate *scrubrates;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info;
struct pci_dev *pdev = pvt->dev_d0f0;
u16 scrubval;
int i;
if (pvt->dev_info->ctl_dev == PCI_DEVICE_ID_INTEL_3100_0)
scrubrates = scrubrates_i3100;
else
scrubrates... | false | false | false | false | false | 0 |
test_property (CRDocHandler * a_handler,
CRString * a_name,
CRTerm * a_expr,
gboolean a_important)
{
g_return_if_fail (a_handler);
fprintf (stdout, "***************\n");
fprintf (stdout, "property\n");
if (a_name
&& a_name->st... | false | false | false | false | false | 0 |
asn1PE_H245IS11172VideoMode (OOCTXT* pctxt, H245IS11172VideoMode* pvalue)
{
int stat = ASN_OK;
ASN1BOOL extbit;
/* extension bit */
extbit = 0;
encodeBit (pctxt, extbit);
encodeBit (pctxt, (ASN1BOOL)pvalue->m.videoBitRatePresent);
encodeBit (pctxt, (ASN1BOOL)pvalue->m.vbvBufferSizePresent);
... | false | false | false | false | false | 0 |
XmtChooserLookupItemName(Widget w, int n)
#else
String XmtChooserLookupItemName(w, n)
Widget w;
int n;
#endif
{
XmtChooserWidget cw = (XmtChooserWidget)w;
XmtAssertWidgetClass(w, xmtChooserWidgetClass,"XmtChooserLookupItemName");
if ((n < 0) || (n > cw->chooser.num_items)) {
BoundsWarning(cw, n);
... | false | false | false | false | false | 0 |
deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
LightData.AmbientColor = in->getAttributeAsColorf("AmbientColor");
LightData.DiffuseColor = in->getAttributeAsColorf("DiffuseColor");
LightData.SpecularColor = in->getAttributeAsColorf("SpecularColor");
//TODO: clearify Rad... | false | false | false | false | false | 0 |
isl_tab_kill_col(struct isl_tab *tab, int col)
{
var_from_col(tab, col)->is_zero = 1;
if (tab->need_undo) {
if (isl_tab_push_var(tab, isl_tab_undo_zero,
var_from_col(tab, col)) < 0)
return -1;
if (col != tab->n_dead)
swap_cols(tab, col, tab->n_dead);
tab->n_dead++;
return 0;
} else {
if (col... | false | false | false | false | false | 0 |
mptlan_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
struct net_device *dev;
int i;
for (i = 0; i < ioc->facts.NumberOfPorts; i++) {
printk(KERN_INFO MYNAM ": %s: PortNum=%x, "
"ProtocolFlags=%02Xh (%c%c%c%c)\n",
ioc->name, ioc->pfac... | false | false | false | false | false | 0 |
tree_apply_cb(knot_node_t **node, void *data)
{
if (node == NULL || data == NULL) {
return KNOT_EINVAL;
}
knot_zone_tree_func_t *f = (knot_zone_tree_func_t *)data;
return f->func(*node, f->data);
} | false | false | false | false | false | 0 |
photo_data_set_bytes (PhotoData *photo_data,
GBytes *bytes)
{
g_mutex_lock (&photo_data->lock);
if (photo_data->bytes != NULL) {
g_bytes_unref (photo_data->bytes);
photo_data->bytes = NULL;
}
if (bytes != NULL)
photo_data->bytes = g_bytes_ref (bytes);
g_mutex_unlock (&photo_data->loc... | false | false | false | false | false | 0 |
drbd_bm_words(struct drbd_device *device)
{
struct drbd_bitmap *b = device->bitmap;
if (!expect(b))
return 0;
if (!expect(b->bm_pages))
return 0;
return b->bm_words;
} | false | false | false | false | false | 0 |
hfi1_diag_add(struct hfi1_devdata *dd)
{
char name[16];
int ret = 0;
snprintf(name, sizeof(name), "%s_diagpkt%d", class_name(),
dd->unit);
/*
* Do this for each device as opposed to the normal diagpkt
* interface which is one per host
*/
ret = hfi1_snoop_add(dd, name);
if (ret)
dd_dev_err(dd, "Unable ... | true | true | false | false | false | 1 |
wildcard_get_filename(WildcardMatcher *dir) {
if (dir->i < dir->globbed.gl_pathc) {
return dupstr(dir->globbed.gl_pathv[dir->i++]);
} else
return NULL;
} | false | false | false | false | false | 0 |
getClosestNeighbors(
const SimpleParticle& particle,
int numClosest
)
{
ParticleVector neighbourVector =
getNTable().getUniqueNeighbourVector(particle.getPos(), m_maxRadius + getTolerance());
std::sort(neighbourVector.begin(), neighbourVector.end(), ParticleComparer(particle));
... | false | false | false | false | false | 0 |
ast_ext_ctx(const char *src, char **ext, char **ctx)
{
struct chan_oss_pvt *o = find_desc(oss_active);
if (ext == NULL || ctx == NULL)
return NULL; /* error */
*ext = *ctx = NULL;
if (src && *src != '\0')
*ext = ast_strdup(src);
if (*ext == NULL)
return NULL;
if (!o->overridecontext) {
/* parse fro... | false | false | false | false | false | 0 |
aliasing_fill_contact_attributes (GObject *object,
const GArray *contacts,
GHashTable *attributes)
{
ExampleContactListConnection *self =
EXAMPLE_CONTACT_LIST_CONNECTION (object);
guint i;
for (i = 0; i < contacts->len; i++)
{
TpHa... | false | false | false | false | false | 0 |
InsChrInsert(void) {
long ch = InsChrUniVal();
GEvent e;
e.type = et_char;
e.w = GWidgetGetPreviousFocusTopWindow();
if ( e.w==NULL || e.w==inschr.icw ) {
GDrawBeep(NULL);
return;
}
e.u.chr.state = 0;
e.u.chr.x = e.u.chr.y = -1;
e.u.chr.keysym = 0;
e.u.chr.chars[0] = ch;
e.... | false | false | false | false | false | 0 |
snd_es1968_free(struct es1968 *chip)
{
cancel_work_sync(&chip->hwvol_work);
#ifdef CONFIG_SND_ES1968_INPUT
if (chip->input_dev)
input_unregister_device(chip->input_dev);
#endif
if (chip->io_port) {
if (chip->irq >= 0)
synchronize_irq(chip->irq);
outw(1, chip->io_port + 0x04); /* clear WP interrupts */
ou... | false | false | false | false | false | 0 |
simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos,
const void *from, size_t available)
{
loff_t pos = *ppos;
size_t ret;
if (pos < 0)
return -EINVAL;
if (pos >= available || !count)
return 0;
if (count > available - pos)
count = available - pos;
ret = copy_to_user(to, from + pos, coun... | false | false | false | false | false | 0 |
Itcl_GetEnsemblePart(interp, ensName, partName, infoPtr)
Tcl_Interp *interp; /* interpreter to be updated */
CONST char *ensName; /* ensemble containing the part */
CONST char *partName; /* name of the desired part */
Tcl_CmdInfo *infoPtr; /* returns: info associat... | false | false | false | false | false | 0 |
_cgcef_cook(CGCEf *cgcef) {
cgcef_assert(_cgcef_scn_init.s_magic == SCN_MAGIC);
cgcef_assert(_cgcef_data_init.sd_magic == DATA_MAGIC);
cgcef_assert(cgcef);
cgcef_assert(cgcef->e_magic == CGCEF_MAGIC);
cgcef_assert(cgcef->e_kind == CGCEF_K_CGCEF);
cgcef_assert(!cgcef->e_ehdr);
if (!valid_vers... | false | false | false | false | false | 0 |
create_element (const gchar * factory_name, const gchar * elem_name,
GstElement ** element, GError ** err)
{
*element = gst_element_factory_make (factory_name, elem_name);
if (*element)
return TRUE;
if (err && *err == NULL) {
*err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_MISSING_PLUGIN,
... | false | false | false | false | false | 0 |
getCurrentWord(UT_sint32& iLength) const
{
iLength = m_iWordLength;
if (NULL != m_pMutatedString)
{
return m_pMutatedString;
}
else
{
return &m_pText[m_iWordOffset];
}
} | false | false | false | false | false | 0 |
free_tsin()
{
free(current_tsin_fname); current_tsin_fname=NULL;
if (fph) {
fclose(fph); fph = NULL;
}
if (fp_phidx) {
fclose(fp_phidx); fp_phidx=NULL;
}
} | false | false | false | false | false | 0 |
remove_linebreaks(const QByteArray &s)
{
QByteArray out = s;
int removed = 0;
int at = findLF(out, 0);
while(at != -1)
{
int next = findLF(out, at + 1);
int len;
if(next != -1)
len = next - at;
else
len = out.size() - at;
if(len > 1)
{
char *p = out.data() + at;
memmove(p - removed, p + 1... | false | false | false | false | false | 0 |
doprintAlias()
{
char *aliasroot = NULL;
if (targc >= 3) {
alias(targc, targv);
}
else {
if (targc >= 2) aliasroot = targv[1];
if (naliases == 0)
lprintf( stdout, "there are no aliases\n" );
else {
if (targc == 1)
lprintf(stdout, "there are %d aliases:\n", nalia... | false | false | false | false | false | 0 |
number_width(wp)
win_T *wp;
{
int n;
linenr_T lnum;
lnum = wp->w_buffer->b_ml.ml_line_count;
if (lnum == wp->w_nrwidth_line_count)
return wp->w_nrwidth_width;
wp->w_nrwidth_line_count = lnum;
n = 0;
do
{
lnum /= 10;
++n;
} while (lnum > 0);
/* 'numberwidth' gives the m... | false | false | false | false | false | 0 |
ProcessClassEnumValues(int classType, struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol, struct __ecereNameSpace__ecere__sys__OldList * baseSpecs, struct __ecereNameSpace__ecere__sys__OldList * enumValues)
{
struct __ecereNameSpace__ecere__com__Class * regClass = symbol->registered;
if... | false | false | false | false | false | 0 |
Learn(float lc,float alpha) {
int i,j;
const double E = 2.7182818285;
for(i=0;i<num_inner;i++) {
if(i<num_per_layer) {
for(j=0;j<inner[i].num_inputs;j++)
inner[i].weights[j]+=lc*(1/(1+pow(E,double(-alpha*inner[i].output)))-0.5)*(input[inner[i].inputs[j]]-0.5); // Yaeger's model
} else {
for(j... | false | false | false | false | false | 0 |
gwy_data_field_resize(GwyDataField *data_field,
gint ulcol, gint ulrow,
gint brcol, gint brrow)
{
GwyDataField *b;
gint i, xres, yres;
g_return_if_fail(GWY_IS_DATA_FIELD(data_field));
if (ulcol > brcol)
GWY_SWAP(gint, ulcol, brcol);
if (ulrow > br... | false | true | false | false | false | 1 |
io_flush (void) {
FILE *f = getfile(FIRSTARG);
luaL_arg_check(f || lua_getparam(FIRSTARG) == LUA_NOOBJECT, FIRSTARG,
"invalid file handle");
pushresult(fflush(f) == 0);
} | false | false | false | false | false | 0 |
sdp_get_service_avail(const sdp_record_t *rec, uint8_t *svcAvail)
{
get_basic_attr(SDP_ATTR_SERVICE_AVAILABILITY, svcAvail, uint8);
} | false | false | false | false | false | 0 |
property_page_quick_find_entry_changed(GtkWidget *entry,
gpointer userdata)
{
struct property_page *pp;
const gchar *text;
GtkWidget *w;
GtkTreeViewColumn *col;
struct property_filter *pf;
bool matched;
pp = userdata;
text = gtk_entry_get_text(GTK_ENTR... | true | true | false | false | false | 1 |
write(hsStream* S, plResManager* mgr) {
hsKeyedObject::write(S, mgr);
S->writeInt(fSceneObjects.getSize());
for (size_t i=0; i<fSceneObjects.getSize(); i++)
mgr->writeKey(S, fSceneObjects[i]);
S->writeInt(fPoolObjects.getSize());
for (size_t i=0; i<fPoolObjects.getSize(); i++)
mgr->... | false | false | false | false | false | 0 |
filter_buffer(int fd, void *data)
{
/*
* Spawn cmd and feed the buffer contents through its stdin.
*/
struct child_process child_process;
struct filter_params *params = (struct filter_params *)data;
int write_err, status;
const char *argv[] = { "sh", "-c", params->cmd, NULL };
memset(&child_process, 0, sizeo... | false | false | false | false | false | 0 |
normal (HepRandomEngine* eptr) // mf 1/13/06
{
double r;
double v1,v2,fac;
do {
v1 = 2.0 * eptr->flat() - 1.0;
v2 = 2.0 * eptr->flat() - 1.0;
r = v1*v1 + v2*v2;
} while ( r > 1.0 );
fac = std::sqrt(-2.0*std::log(r)/r);
return v2*fac;
} | false | false | false | false | false | 0 |
qlcnic_82xx_napi_enable(struct qlcnic_adapter *adapter)
{
int ring;
struct qlcnic_host_sds_ring *sds_ring;
struct qlcnic_host_tx_ring *tx_ring;
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC)
return;
for (ring = 0; ring < adapter->drv_sds_rings; ring++)... | false | false | false | false | false | 0 |
radeonEnsureEmitSize( struct gl_context * ctx , GLuint inputs )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
GLuint space_required;
GLuint state_size;
GLuint nr_aos = 1; /* radeonEmitArrays does always emit one */
int i;
/* list of ... | false | false | false | false | false | 0 |
tfhd_dump(GF_Box *a, FILE * trace)
{
GF_TrackFragmentHeaderBox *p;
p = (GF_TrackFragmentHeaderBox *)a;
fprintf(trace, "<TrackFragmentHeaderBox TrackID=\"%d\"", p->trackID);
fprintf(trace, " BaseDataOffset=\"%s\"", (p->flags & GF_ISOM_MOOF_BASE_OFFSET) ? "moof" : ((p->flags & GF_ISOM_TRAF_BASE_OFFSET) ? "traf" : "... | false | false | false | false | false | 0 |
PyObject_GetAttr(PyObject *v, PyObject *name)
{
PyTypeObject *tp = Py_TYPE(v);
if (!PyString_Check(name)) {
#ifdef Py_USING_UNICODE
/* The Unicode to string conversion is done here because the
existing tp_getattro slots expect a string object as name
and we wouldn't want to break ... | false | false | false | false | false | 0 |
main( int argc, char **argv )
{
int c, error;
libspectrum_tape *tzx;
progname = argv[0];
error = init_libspectrum(); if( error ) return error;
while( ( c = getopt( argc, argv, "r:" ) ) != -1 ) {
switch( c ) {
case 'r': sample_rate = abs( atol( optarg ) ); break;
}
}
argc -= optind;
a... | false | true | false | false | true | 1 |
DeallocateBsaveData(
void *theEnv)
{
struct BinaryItem *tmpPtr, *nextPtr;
tmpPtr = BsaveData(theEnv)->ListOfBinaryItems;
while (tmpPtr != NULL)
{
nextPtr = tmpPtr->next;
rtn_struct(theEnv,BinaryItem,tmpPtr);
tmpPtr = nextPtr;
}
} | false | false | false | false | false | 0 |
fw_free_buf(struct firmware_buf *buf)
{
struct firmware_cache *fwc = buf->fwc;
spin_lock(&fwc->lock);
if (!kref_put(&buf->ref, __fw_free_buf))
spin_unlock(&fwc->lock);
} | false | false | false | false | false | 0 |
Load() const
{
std::string path = GetPaths();
// for each path, load libraries
std::vector <std::string> environmentPaths = SplitPathVariable(path);
for (unsigned i=0; i<environmentPaths.size(); i++)
{
debug && std::cout << "RunTimeLibraryLoader: Scanning for libraries in " << environmentPaths[i] << std::endl;
... | false | false | false | false | false | 0 |
RecvMsg(const Arguments& args) {
HandleScope scope;
if (args.Length() < 4) {
return ThrowException(Exception::TypeError(
String::New("Takes 4 parameters")));
}
FD_ARG(args[0])
if (!Buffer::HasInstance(args[1])) {
return ThrowException(Exception::TypeError(
String::New("Second ar... | false | false | false | false | false | 0 |
iofunctions_init (void) {
GuIOFunc* io = g_new0(GuIOFunc, 1);
io->sig_hook = g_object_new(G_TYPE_OBJECT, NULL);
/* Connect signals */
g_signal_connect (io->sig_hook, "document-load",
G_CALLBACK(iofunctions_real_load_file), NULL);
g_signal_connect (io->sig_hook, "document-write",
G_... | false | false | false | false | false | 0 |
qprecision(NUMBER *q)
{
long r;
if (qiszero(q) || qisneg(q)) {
math_error("Non-positive number for precision");
/*NOTREACHED*/
}
r = - qilog2(q);
return (r < 0 ? 0 : r);
} | false | false | false | false | false | 0 |
addLink(int xMin, int yMin, int xMax, int yMax, AnnotLink *link) {
links->append(new TextLink(xMin, yMin, xMax, yMax, link));
} | false | false | false | false | false | 0 |
restore_symbol(char *out, char *in)
{
int len;
len = strlen(in);
if (len > 0)
{
if ((len == 1 && in[0] == ormark) ||
(in[0] == escape) ||
(in[0] == '\'') ||
(in[len - 1] == '\'') ||
(strchr(in, ' ') != NULL &&
... | false | false | false | false | false | 0 |
fini_copy_prop (void)
{
unsigned i;
/* Set the final copy-of value for each variable by traversing the
copy-of chains. */
for (i = 1; i < num_ssa_names; i++)
{
tree var = ssa_name (i);
if (!var
|| !copy_of[i].value
|| copy_of[i].value == var)
continue;
/* In theory the points-... | false | false | false | false | false | 0 |
mouseDoubleClickEvent( QGraphicsSceneMouseEvent * e )
{
QGraphicsItem * topItem = itemAt( e->scenePos() );
KCard * card = qgraphicsitem_cast<KCard*>( topItem );
KCardPile * pile = qgraphicsitem_cast<KCardPile*>( topItem );
if ( !d->cardsBeingDragged.isEmpty() )
{
updatePileLayout( d->cardsB... | false | false | false | false | false | 0 |
Initial(const std::string &list)
{
//
// Split the list of urls up into individual urls.
//
StringList tokens(list.c_str(), " \t");
std::string sig;
std::string url;
unsigned int IDUrl;
for (int i = 0; i < tokens.Count(); i++)
{
switch(AddUrl(tokens[i], IDUrl, false))
{... | false | false | false | false | false | 0 |
wbsd_irq(int irq, void *dev_id)
{
struct wbsd_host *host = dev_id;
int isr;
isr = inb(host->base + WBSD_ISR);
/*
* Was it actually our hardware that caused the interrupt?
*/
if (isr == 0xff || isr == 0x00)
return IRQ_NONE;
host->isr |= isr;
/*
* Schedule tasklets as needed.
*/
if (isr & WBSD_INT_C... | false | false | false | false | false | 0 |
active_connection_state_changed (NMActiveConnection *active,
GParamSpec *pspec,
NMPolicy *policy)
{
switch (nm_active_connection_get_state (active)) {
case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
if (NM_IS_VPN_CONNECTION (active))
vpn_connection_act... | false | false | false | false | false | 0 |
contentHeightForWidth(int width) const
{
// if no text size is available, use default
if (m_textRect.width() < 1 || m_textRect.height() < 1)
return AbstractContent::contentHeightForWidth(width);
return (m_textRect.height() * width) / m_textRect.width();
} | false | false | false | false | false | 0 |
rltty_set_default_bindings (kmap)
Keymap kmap;
{
#if !defined (NO_TTY_DRIVER)
TIOTYPE ttybuff;
int tty;
tty = fileno (rl_instream);
if (get_tty_settings (tty, &ttybuff) == 0)
_rl_bind_tty_special_chars (kmap, ttybuff);
#endif
} | false | false | false | false | false | 0 |
DXTrimItems(Array a, int nitems)
{
CHECKARRAY(a, CLASS_ARRAY); /* only valid for irregular arrays */
/* reset the item count only if smaller,
* and release any extra space in either case.
*/
if (a->items > nitems)
a->items = nitems;
return DXTrim(a);
} | false | false | false | false | false | 0 |
mca_btl_tcp_proc_tosocks(mca_btl_tcp_addr_t* proc_addr,
struct sockaddr_storage* output)
{
memset(output, 0, sizeof (*output));
switch (proc_addr->addr_family) {
case AF_INET:
output->ss_family = AF_INET;
memcpy(&((struct sockaddr_in*)output)->sin_addr,
... | false | false | false | false | false | 0 |
devfreq_cooling_gen_tables(struct devfreq_cooling_device *dfc)
{
struct devfreq *df = dfc->devfreq;
struct device *dev = df->dev.parent;
int ret, num_opps;
unsigned long freq;
u32 *power_table = NULL;
u32 *freq_table;
int i;
num_opps = dev_pm_opp_get_opp_count(dev);
if (dfc->power_ops) {
power_table = kcal... | true | true | false | false | false | 1 |
lwgeom_constructempty_buf(int SRID, char hasz, char hasm,
uchar *buf, size_t *retsize)
{
int ngeoms = 0;
buf[0] =(uchar) lwgeom_makeType( hasz, hasm, SRID != -1, COLLECTIONTYPE);
if (SRID != -1)
{
memcpy(&buf[1],&SRID,4);
buf += 5;
}
else
buf += 1;
memcpy(buf, &ngeoms, 4);
if (retsize) *retsize = lwg... | false | true | false | false | false | 1 |
smsg_alloc(gnet_search_t sh, pmsg_t *mb, query_hashvec_t *qhv)
{
smsg_t *sb;
WALLOC(sb);
sb->shandle = sh;
sb->mb = mb;
sb->qhv = qhv;
return sb;
} | false | false | false | false | false | 0 |
irq_enable(struct irq_desc *desc)
{
irq_state_clr_disabled(desc);
if (desc->irq_data.chip->irq_enable)
desc->irq_data.chip->irq_enable(&desc->irq_data);
else
desc->irq_data.chip->irq_unmask(&desc->irq_data);
irq_state_clr_masked(desc);
} | false | false | false | false | false | 0 |
xml_print_pwr_usb_stats(struct activity *a, int curr, int tab,
unsigned long long itv)
{
int i;
struct stats_pwr_usb *suc;
if (!IS_SELECTED(a->options) || (a->nr <= 0))
goto close_xml_markup;
xml_markup_power_management(tab, OPEN_XML_MARKUP);
tab++;
xprintf(tab++, "<usb-devices>");
for (i = 0; i < a->... | false | false | false | false | false | 0 |
object_var_get_submatrix (const char *oname, int idx, NODE *t, parser *p,
int needs_data)
{
NODE *r = eval(t->v.b2.r, p);
gretl_matrix *M, *S = NULL;
if (r == NULL || r->t != MSPEC) {
if (!p->err) {
p->err = E_TYPES;
}
return NULL;
}
if (needs_data) {
M = saved_object_build_matrix(on... | 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.