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 |
|---|---|---|---|---|---|---|
secure(dns_name_t *name, dns_dbnode_t *node) {
dns_rdataset_t dsset;
isc_result_t result;
if (dns_name_equal(name, gorigin))
return (ISC_FALSE);
dns_rdataset_init(&dsset);
result = dns_db_findrdataset(gdb, node, gversion, dns_rdatatype_ds,
0, 0, &dsset, NULL);
if (dns_rdataset_isassociated(&dsset))
dns_rdataset_disassociate(&dsset);
return (ISC_TF(result == ISC_R_SUCCESS));
} | false | false | false | false | false | 0 |
Create( void )
{
wxStaticBox * poSbxSigSrc;
#ifndef LAYOUT_MNGR
int ix, iy;
// Set the frequency sweep parameter labels
m_oSbxSwpPars.GetSize( &ix, &iy );
m_oSbxSwpPars.SetSize( ix, 167 );
m_oSbxSwpPars.SetLabel( wxT(" Frequency Sweep ") );
#endif // LAYOUT_MNGR
m_oPnlStart .bSetName( wxT("Start Frequency") );
m_oPnlStop .bSetName( wxT("Stop Frequency") );
m_oPnlStep .bSetName( wxT("Step Increment") );
// Set sweep parameter units
m_oPnlStart.bSetUnitsType( eUNITS_FREQ );
m_oPnlStop .bSetUnitsType( eUNITS_FREQ );
m_oPnlStep .bSetUnitsType( eUNITS_FREQ );
// Create and add generator controls
poSbxSigSrc = new wxStaticBox( this, ID_UNUSED, wxT(" Signal Source "),
wxPoint( 6, 175 ), wxSize( 241, 55 ) );
m_oChoSrcName.Create( this, ID_CHO_SRCNAME,
wxPoint( 18, 195 ), wxSize( 107, 29 ) );
m_oBtnSetup .Create( this, ID_BTN_SETUP, wxT("Setup ..."),
wxPoint( 130, 195 ), wxSize( 105, 29 ) );
poSbxSigSrc->SetOwnFont( FONT_SLANT );
CreateOutputs( ); // Create and add output parameters
PnlAnaBase::CreateInitC( ); // Create and add the initial conditions controls
PnlAnaBase::CreateTemp( ); // Create and add the analysis temp. controls
// PnlAnaBase::DoLayout( ); // Layout the panel's GUI objects
#ifdef LAYOUT_MNGR
SetSwpPnlLbl( wxT(" Frequency Sweep ") );
#endif // LAYOUT_MNGR
} | false | false | false | false | false | 0 |
STV_MkObject(struct worker *wrk, void *ptr, unsigned ltot,
const struct stv_objsecrets *soc)
{
struct object *o;
unsigned l;
CHECK_OBJ_NOTNULL(soc, STV_OBJ_SECRETES_MAGIC);
assert(PAOK(ptr));
assert(PAOK(soc->wsl));
assert(PAOK(soc->lhttp));
assert(ltot >= sizeof *o + soc->lhttp + soc->wsl);
o = ptr;
memset(o, 0, sizeof *o);
o->magic = OBJECT_MAGIC;
l = PRNDDN(ltot - (sizeof *o + soc->lhttp));
assert(l >= soc->wsl);
o->http = HTTP_create(o + 1, soc->nhttp);
WS_Init(o->ws_o, "obj", (char *)(o + 1) + soc->lhttp, soc->wsl);
WS_Assert(o->ws_o);
assert(o->ws_o->e <= (char*)ptr + ltot);
http_Setup(o->http, o->ws_o);
o->http->magic = HTTP_MAGIC;
o->exp = wrk->busyobj->exp;
VTAILQ_INIT(&o->store);
wrk->stats.n_object++;
if (wrk->sp->req->objcore != NULL) {
CHECK_OBJ_NOTNULL(wrk->sp->req->objcore, OBJCORE_MAGIC);
o->objcore = wrk->sp->req->objcore;
wrk->sp->req->objcore = NULL; /* refcnt follows pointer. */
BAN_NewObjCore(o->objcore);
o->objcore->methods = &default_oc_methods;
o->objcore->priv = o;
}
return (o);
} | false | false | false | false | false | 0 |
add_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
struct object *object;
struct rev_info *revs = (struct rev_info *)cb_data;
object = parse_object(osha1);
if (object)
add_pending_object(revs, object, "");
object = parse_object(nsha1);
if (object)
add_pending_object(revs, object, "");
return 0;
} | false | false | false | false | false | 0 |
make_cover_letter(struct rev_info *rev, int use_stdout,
int numbered, int numbered_files,
struct commit *origin,
int nr, struct commit **list, struct commit *head,
int quiet)
{
const char *committer;
const char *subject_start = NULL;
const char *body = "*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n";
const char *msg;
const char *extra_headers = rev->extra_headers;
struct shortlog log;
struct strbuf sb = STRBUF_INIT;
int i;
const char *encoding = "UTF-8";
struct diff_options opts;
int need_8bit_cte = 0;
struct commit *commit = NULL;
if (rev->commit_format != CMIT_FMT_EMAIL)
die(_("Cover letter needs email format"));
committer = git_committer_info(0);
if (!numbered_files) {
/*
* We fake a commit for the cover letter so we get the filename
* desired.
*/
commit = xcalloc(1, sizeof(*commit));
commit->buffer = xmalloc(400);
snprintf(commit->buffer, 400,
"tree 0000000000000000000000000000000000000000\n"
"parent %s\n"
"author %s\n"
"committer %s\n\n"
"cover letter\n",
sha1_to_hex(head->object.sha1), committer, committer);
}
if (!use_stdout && reopen_stdout(commit, rev, quiet))
return;
if (commit) {
free(commit->buffer);
free(commit);
}
log_write_email_headers(rev, head, &subject_start, &extra_headers,
&need_8bit_cte);
for (i = 0; !need_8bit_cte && i < nr; i++)
if (has_non_ascii(list[i]->buffer))
need_8bit_cte = 1;
msg = body;
pp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822,
encoding);
pp_title_line(CMIT_FMT_EMAIL, &msg, &sb, subject_start, extra_headers,
encoding, need_8bit_cte);
pp_remainder(CMIT_FMT_EMAIL, &msg, &sb, 0);
printf("%s\n", sb.buf);
strbuf_release(&sb);
shortlog_init(&log);
log.wrap_lines = 1;
log.wrap = 72;
log.in1 = 2;
log.in2 = 4;
for (i = 0; i < nr; i++)
shortlog_add_commit(&log, list[i]);
shortlog_output(&log);
/*
* We can only do diffstat with a unique reference point
*/
if (!origin)
return;
memcpy(&opts, &rev->diffopt, sizeof(opts));
opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
diff_setup_done(&opts);
diff_tree_sha1(origin->tree->object.sha1,
head->tree->object.sha1,
"", &opts);
diffcore_std(&opts);
diff_flush(&opts);
printf("\n");
print_signature();
} | false | false | false | false | false | 0 |
gst_nuv_demux_read_head_frame (GstNuvDemux * nuv)
{
GstFlowReturn ret = GST_FLOW_OK;
ret = gst_nuv_demux_frame_header_load (nuv, &nuv->fh);
if (ret != GST_FLOW_OK)
return ret;
nuv->state = GST_NUV_DEMUX_MOVI;
return ret;
} | false | false | false | false | false | 0 |
symbol_bd_varlist_add(GHashTable **variables_table, gchar *varname, gchar *funcname, const gchar *filename, guint *identifierid)
{
ClassBrowserVar *var;
var = g_hash_table_lookup (*variables_table, varname);
if (var){
var->remove = FALSE;
} else {
*identifierid=(*identifierid)++;
var = get_new_var(varname, funcname, filename, *identifierid);
g_hash_table_insert (*variables_table, g_strdup(varname), var); /* key =variables name value var struct */
}
} | false | false | false | false | false | 0 |
object_FA_would_be_obvious(const object_type *o_ptr)
{
bitflag flags[OF_SIZE];
if (!player_has(PF_CUMBER_GLOVE))
return FALSE;
if ((wield_slot(o_ptr) != INVEN_HANDS) || (o_ptr->sval == SV_SET_OF_ALCHEMISTS_GLOVES))
return FALSE;
object_flags(o_ptr, flags);
if (of_has(flags, OF_DEX))
return FALSE;
return TRUE;
} | false | false | false | false | false | 0 |
sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
unsigned size)
{
struct sk_buff *skb = re->skb;
int i;
re->data_addr = pci_map_single(pdev, skb->data, size, PCI_DMA_FROMDEVICE);
if (pci_dma_mapping_error(pdev, re->data_addr))
goto mapping_error;
dma_unmap_len_set(re, data_size, size);
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
re->frag_addr[i] = skb_frag_dma_map(&pdev->dev, frag, 0,
skb_frag_size(frag),
DMA_FROM_DEVICE);
if (dma_mapping_error(&pdev->dev, re->frag_addr[i]))
goto map_page_error;
}
return 0;
map_page_error:
while (--i >= 0) {
pci_unmap_page(pdev, re->frag_addr[i],
skb_frag_size(&skb_shinfo(skb)->frags[i]),
PCI_DMA_FROMDEVICE);
}
pci_unmap_single(pdev, re->data_addr, dma_unmap_len(re, data_size),
PCI_DMA_FROMDEVICE);
mapping_error:
if (net_ratelimit())
dev_warn(&pdev->dev, "%s: rx mapping error\n",
skb->dev->name);
return -EIO;
} | false | false | false | false | false | 0 |
ompi_comm_finalize(void)
{
int max, i;
ompi_communicator_t *comm;
/* Shut down MPI_COMM_SELF */
OBJ_DESTRUCT( &ompi_mpi_comm_self );
/* disconnect all dynamic communicators */
ompi_dpm.dyn_finalize();
/* Shut down MPI_COMM_WORLD */
OBJ_DESTRUCT( &ompi_mpi_comm_world );
/* Shut down the parent communicator, if it exists */
if( ompi_mpi_comm_parent != &ompi_mpi_comm_null.comm ) {
/* Note that we pass ompi_mpi_comm_parent here
(vs. &ompi_mpi_comm_parent) because it is of type
(ompi_communicator_t*), *NOT* (ompi_communicator_t). This
is because a parent communicator is created dynamically
during init, and we just set this pointer to it. Hence, we
just pass in the pointer here. */
OBJ_DESTRUCT (ompi_mpi_comm_parent);
/* Please note, that the we did increase the reference count
for ompi_mpi_comm_null, ompi_mpi_group_null, and
ompi_mpi_errors_are_fatal in ompi_comm_init because of
ompi_mpi_comm_parent. In case a
parent communicator is really created, the ref. counters
for these objects are decreased again by one. However, in a
static scenario, we should ideally decrease the ref. counter
for these objects by one here. The problem just is, that
if the app had a parent_comm, and this has been freed/disconnected,
ompi_comm_parent points again to ompi_comm_null, the reference count
for these objects has not been increased again.
So the point is, if ompi_mpi_comm_parent == &ompi_mpi_comm_null
we do not know whether we have to decrease the ref count for
those three objects or not. Since this is a constant, non-increasing
amount of memory, we stick with the current solution for now,
namely don't do anything.
*/
}
/* Shut down MPI_COMM_NULL */
OBJ_DESTRUCT( &ompi_mpi_comm_null );
/* Check whether we have some communicators left */
max = opal_pointer_array_get_size(&ompi_mpi_communicators);
for ( i=3; i<max; i++ ) {
comm = (ompi_communicator_t *)opal_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Communicator has not been freed before finalize */
OBJ_RELEASE(comm);
comm=(ompi_communicator_t *)opal_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Still here ? */
if ( !OMPI_COMM_IS_EXTRA_RETAIN(comm)) {
/* For communicator that have been marked as "extra retain", we do not further
* enforce to decrease the reference counter once more. These "extra retain"
* communicators created e.g. by the hierarch or inter module did increase
* the reference count by one more than other communicators, on order to
* allow for deallocation with the parent communicator. Note, that
* this only occurs if the cid of the local_comm is lower than of its
* parent communicator. Read the comment in comm_activate for
* a full explanation.
*/
if ( ompi_debug_show_handle_leaks && !(OMPI_COMM_IS_FREED(comm)) ){
opal_output(0,"WARNING: MPI_Comm still allocated in MPI_Finalize\n");
ompi_comm_dump ( comm);
OBJ_RELEASE(comm);
}
}
}
}
}
OBJ_DESTRUCT (&ompi_mpi_communicators);
/* finalize the comm_reg stuff */
ompi_comm_reg_finalize();
/* finalize communicator requests */
ompi_comm_request_fini ();
return OMPI_SUCCESS;
} | false | false | false | false | false | 0 |
b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
{
struct b43_phy *phy = &dev->phy;
u16 override = on ? 0x0 : 0x7FFF;
u16 core = on ? 0xD : 0x00FD;
if (phy->rev >= 19) {
/* TODO */
} else if (phy->rev >= 3) {
if (on) {
b43_phy_write(dev, B43_NPHY_AFECTL_C1, core);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, override);
b43_phy_write(dev, B43_NPHY_AFECTL_C2, core);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override);
} else {
b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, override);
b43_phy_write(dev, B43_NPHY_AFECTL_C1, core);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override);
b43_phy_write(dev, B43_NPHY_AFECTL_C2, core);
}
} else {
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override);
}
} | false | false | false | false | false | 0 |
load(nor_utils::StreamTokenizer& st)
{
// Calling the super-class method
FeaturewiseLearner::load(st);
_sigmoidSlope = UnSerialization::seekAndParseEnclosedValue<FeatureReal>(st, "sigSlope");
_sigmoidOffset = UnSerialization::seekAndParseEnclosedValue<FeatureReal>(st, "sigOffset");
stringstream parameterString;
parameterString << _sigmoidSlope << "_" << _sigmoidOffset;
_id = _id + parameterString.str();
} | false | false | false | false | false | 0 |
augment(double height,size_t numVertices) const {
size_t NV=mVertices.size();
size_t NF=mFaces.size();
size_t tnf=0;
size_t tnv=NV;
for (vector<TPolyhedronFace>::const_iterator it=mFaces.begin();it!=mFaces.end();++it) if (it->vertices.size()==numVertices) {
tnf+=numVertices;
tnv++;
} else tnf++;
if (tnv==NV) return CreateNoCheck(mVertices,mFaces);
vector<TPoint3D> vertices(tnv);
std::copy(mVertices.begin(),mVertices.end(),vertices.begin());
vector<TPolyhedronFace> faces(tnf);
TPolygon3D tmp(numVertices);
TPlane pTmp;
TPoint3D cTmp;
size_t iF=0;
size_t iV=NV;
TPoint3D phCenter;
getCenter(phCenter);
TPolyhedronFace fTmp;
fTmp.vertices.resize(3);
for (size_t i=0;i<NF;i++) {
const vector<uint32_t> &face=mFaces[i].vertices;
size_t N=face.size();
if (N!=numVertices) {
faces[iF].vertices=face;
iF++;
continue;
}
TPoint3D &vertex=vertices[iV];
for (size_t j=0;j<numVertices;j++) tmp[j]=mVertices[face[j]];
tmp.getBestFittingPlane(pTmp);
pTmp.unitarize();
tmp.getCenter(cTmp);
if (pTmp.evaluatePoint(phCenter)>0) for (size_t j=0;j<3;j++) vertex[j]=cTmp[j]-height*pTmp.coefs[j];
else for (size_t j=0;j<3;j++) vertex[j]=cTmp[j]+height*pTmp.coefs[j];
fTmp.vertices[0]=iV;
for (size_t j=0;j<N;j++) {
fTmp.vertices[1]=face[j];
fTmp.vertices[2]=face[(j+1)%N];
faces[iF+j]=fTmp;
}
iF+=N;
iV++;
}
return CreateNoCheck(vertices,faces);
} | false | false | false | false | false | 0 |
catalog_list_load_current_child (CatalogListData *list_data)
{
if (list_data->current_child == NULL) {
catalog_list_load_next_child (list_data->parent);
catalog_list_data_free (list_data);
return;
}
load_catalog_list ((CatalogListData *) list_data->current_child->data);
} | false | false | false | false | false | 0 |
saveAsXml(Stream &stream, int id, int pdfObjNum) const
{
assert(iImp);
stream << "<bitmap";
stream << " id=\"" << id << "\"";
stream << " width=\"" << width() << "\"";
stream << " height=\"" << height() << "\"";
stream << " length=\"" << size() << "\"";
switch (colorSpace()) {
case EDeviceGray:
stream << " ColorSpace=\"DeviceGray\"";
break;
case EDeviceRGB:
stream << " ColorSpace=\"DeviceRGB\"";
break;
case EDeviceCMYK:
stream << " ColorSpace=\"DeviceCMYK\"";
break;
}
switch (filter()) {
case EFlateDecode:
stream << " Filter=\"FlateDecode\"";
break;
case EDCTDecode:
stream << " Filter=\"DCTDecode\"";
break;
default:
// no filter
break;
}
stream << " BitsPerComponent=\"" << bitsPerComponent() << "\"";
if (iImp->iColorKey >= 0) {
char buf[10];
sprintf(buf, "%x", iImp->iColorKey);
stream << " ColorKey=\"" << buf << "\"";
}
if (pdfObjNum >= 0) {
stream << " pdfObject=\"" << pdfObjNum << "\"/>\n";
} else {
// save data
stream << " encoding=\"base64\">\n";
const char *p = data();
const char *fin = p + size();
Base64Stream b64(stream);
while (p != fin)
b64.putChar(*p++);
b64.close();
stream << "</bitmap>\n";
}
} | false | false | false | false | false | 0 |
billterms_delete_term_cb (GtkButton *button, BillTermsWindow *btw)
{
g_return_if_fail (btw);
if (!btw->current_term)
return;
if (gncBillTermGetRefcount (btw->current_term) > 0)
{
gnc_error_dialog (btw->dialog,
_("Term \"%s\" is in use. You cannot delete it."),
gncBillTermGetName (btw->current_term));
return;
}
if (gnc_verify_dialog (btw->dialog, FALSE,
_("Are you sure you want to delete \"%s\"?"),
gncBillTermGetName (btw->current_term)))
{
/* Ok, let's remove it */
gnc_suspend_gui_refresh ();
gncBillTermBeginEdit (btw->current_term);
gncBillTermDestroy (btw->current_term);
btw->current_term = NULL;
gnc_resume_gui_refresh ();
}
} | false | false | false | false | false | 0 |
H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(lnk);
/* Get information from the link */
if(info) {
info->cset = lnk->cset;
info->corder = lnk->corder;
info->corder_valid = lnk->corder_valid;
info->type = lnk->type;
switch(lnk->type) {
case H5L_TYPE_HARD:
info->u.address = lnk->u.hard.addr;
break;
case H5L_TYPE_SOFT:
info->u.val_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
break;
case H5L_TYPE_ERROR:
case H5L_TYPE_EXTERNAL:
case H5L_TYPE_MAX:
default:
{
const H5L_class_t *link_class; /* User-defined link class */
if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class")
/* User-defined link; call its query function to get the link udata size. */
/* Get the link class for this type of link. It's okay if the class
* isn't registered, though--we just can't give any more information
* about it
*/
link_class = H5L_find_class(lnk->type);
if(link_class != NULL && link_class->query_func != NULL) {
ssize_t cb_ret; /* Return value from UD callback */
/* Call the link's query routine to retrieve the user-defined link's value size */
/* (in case the query routine packs/unpacks the link value in some way that changes its size) */
if((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query buffer size callback returned failure")
info->u.val_size = (size_t)cb_ret;
} /* end if */
else
info->u.val_size = 0;
} /* end case */
} /* end switch */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} | false | false | false | false | false | 0 |
AddSky( u32 dome, const c8 *texture)
{
ISceneManager *smgr = Game->Device->getSceneManager ();
IVideoDriver * driver = Game->Device->getVideoDriver();
bool oldMipMapState = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
if ( 0 == dome )
{
// irrlicht order
//static const c8*p[] = { "ft", "lf", "bk", "rt", "up", "dn" };
// quake3 order
static const c8*p[] = { "ft", "rt", "bk", "lf", "up", "dn" };
u32 i = 0;
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
SkyNode = smgr->addSkyBoxSceneNode( driver->getTexture ( buf ), 0, 0, 0, 0, 0 );
if (SkyNode)
{
for ( i = 0; i < 6; ++i )
{
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
}
}
}
else
if ( 1 == dome )
{
snprintf ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), 32,32,
1.f, 1.f, 1000.f, 0, 11);
}
else
if ( 2 == dome )
{
snprintf ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), 16,8,
0.95f, 2.f, 1000.f, 0, 11);
}
if (SkyNode)
SkyNode->setName("Skydome");
//SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
} | false | false | false | false | false | 0 |
ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error)
{
int ret;
glong output_bytes = 0;
GUID disco_guid = WSAID_DISCONNECTEX;
GUID trans_guid = WSAID_TRANSMITFILE;
LPFN_DISCONNECTEX _wapi_disconnectex = NULL;
LPFN_TRANSMITFILE _wapi_transmitfile = NULL;
gboolean bret;
MONO_ARCH_SAVE_REGS;
*error = 0;
LOGDEBUG (g_message("%s: disconnecting from socket %p (reuse %d)", __func__, sock, reuse));
/* I _think_ the extension function pointers need to be looked
* up for each socket. FIXME: check the best way to store
* pointers to functions in managed objects that still works
* on 64bit platforms.
*/
ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER,
(void *)&disco_guid, sizeof(GUID),
(void *)&_wapi_disconnectex, sizeof(void *),
&output_bytes, NULL, NULL);
if (ret != 0) {
/* make sure that WSAIoctl didn't put crap in the
* output pointer
*/
_wapi_disconnectex = NULL;
/*
* Use the SIO_GET_EXTENSION_FUNCTION_POINTER to
* determine the address of the disconnect method without
* taking a hard dependency on a single provider
*
* For an explanation of why this is done, you can read
* the article at http://www.codeproject.com/internet/jbsocketserver3.asp
*/
ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER,
(void *)&trans_guid, sizeof(GUID),
(void *)&_wapi_transmitfile, sizeof(void *),
&output_bytes, NULL, NULL);
if (ret != 0) {
_wapi_transmitfile = NULL;
}
}
if (_wapi_disconnectex != NULL) {
bret = _wapi_disconnectex (sock, NULL, TF_REUSE_SOCKET, 0);
} else if (_wapi_transmitfile != NULL) {
bret = _wapi_transmitfile (sock, NULL, 0, 0, NULL, NULL,
TF_DISCONNECT | TF_REUSE_SOCKET);
} else {
*error = ERROR_NOT_SUPPORTED;
return;
}
if (bret == FALSE) {
*error = WSAGetLastError ();
}
} | false | false | false | false | false | 0 |
fileio_fputs(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
FileIO* ptr = ensure<ThisIsNative<FileIO> >(fn);
string str = fn.arg(0).to_string();
return as_value(ptr->fputs(str));
} | false | false | false | false | false | 0 |
HandleModifySpeedCommand(char* args)
{
if (!*args)
{ return false; }
float modSpeed = (float)atof(args);
if (modSpeed > 10 || modSpeed < 0.1)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
return false;
}
Player* chr = getSelectedPlayer();
if (chr == NULL)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// check online security
if (HasLowerSecurity(chr))
{ return false; }
std::string chrNameLink = GetNameLink(chr);
if (chr->IsTaxiFlying())
{
PSendSysMessage(LANG_CHAR_IN_FLIGHT, chrNameLink.c_str());
SetSentErrorMessage(true);
return false;
}
PSendSysMessage(LANG_YOU_CHANGE_SPEED, modSpeed, chrNameLink.c_str());
if (needReportToTarget(chr))
{ ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), modSpeed); }
chr->UpdateSpeed(MOVE_RUN, true, modSpeed);
return true;
} | false | false | false | false | false | 0 |
initPowerPrefixes() {
if (PowerPrefixes.count() == 0) {
PowerPrefixes << "p" << "n" << MicroSymbol << "u" << "m" << "" << "k" << "M" << "G" << "T";
PowerPrefixValues << 0.000000000001 << 0.000000001 << 0.000001 << 0.000001 << 0.001 << 1 << 1000 << 1000000 << 1000000000. << 1000000000000.;
}
} | false | false | false | false | false | 0 |
rb_thread_local_aset(thread, id, val)
VALUE thread;
ID id;
VALUE val;
{
rb_thread_t th = rb_thread_check(thread);
if (ruby_safe_level >= 4 && th != curr_thread) {
rb_raise(rb_eSecurityError, "Insecure: can't modify thread locals");
}
if (OBJ_FROZEN(thread)) rb_error_frozen("thread locals");
if (!th->locals) {
th->locals = st_init_numtable();
}
if (NIL_P(val)) {
st_delete(th->locals, (st_data_t*)&id, 0);
return Qnil;
}
st_insert(th->locals, id, val);
return val;
} | false | false | false | false | false | 0 |
stripe_sh_chown_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *preop, struct iatt *postop, dict_t *xdata)
{
int callcnt = -1;
stripe_local_t *local = NULL;
if (!this || !frame || !frame->local) {
gf_log ("stripe", GF_LOG_DEBUG, "possible NULL deref");
goto out;
}
local = frame->local;
LOCK (&frame->lock);
{
callcnt = --local->call_count;
}
UNLOCK (&frame->lock);
if (!callcnt) {
STRIPE_STACK_DESTROY (frame);
}
out:
return 0;
} | false | false | false | false | false | 0 |
snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_sframes_t sd;
int err = snd_pcm_delay(plugin->gen.slave, &sd);
if (err < 0)
return err;
if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
sd += snd_pcm_mmap_capture_avail(pcm);
}
*delayp = sd;
return 0;
} | false | false | false | false | true | 1 |
free_order(int **order)
{
int i = 0;
while (order[i] != NULL) {
FREE(order[i]);
i++;
}
FREE(order);
} | false | false | false | false | false | 0 |
_dbus_message_get_network_data (DBusMessage *message,
const DBusString **header,
const DBusString **body)
{
_dbus_assert (message->locked);
*header = &message->header.data;
*body = &message->body;
} | false | false | false | false | false | 0 |
count_virtual_methods (MonoClass *class)
{
int i, count = 0;
guint32 flags;
class = mono_class_get_generic_type_definition (class); /*We can find this information by looking at the GTD*/
if (class->methods || !MONO_CLASS_HAS_STATIC_METADATA (class)) {
mono_class_setup_methods (class);
if (class->exception_type)
return -1;
for (i = 0; i < class->method.count; ++i) {
flags = class->methods [i]->flags;
if (flags & METHOD_ATTRIBUTE_VIRTUAL)
++count;
}
} else {
for (i = 0; i < class->method.count; ++i) {
flags = mono_metadata_decode_table_row_col (class->image, MONO_TABLE_METHOD, class->method.first + i, MONO_METHOD_FLAGS);
if (flags & METHOD_ATTRIBUTE_VIRTUAL)
++count;
}
}
return count;
} | false | false | false | false | false | 0 |
write(
MIOFILE& out, bool include_net_info, bool include_coprocs
) {
char pv[265], pm[256], pf[1024], osn[256], osv[256], pn[256];
out.printf(
"<host_info>\n"
" <timezone>%d</timezone>\n",
timezone
);
if (include_net_info) {
out.printf(
" <domain_name>%s</domain_name>\n"
" <ip_addr>%s</ip_addr>\n",
domain_name,
ip_addr
);
}
xml_escape(p_vendor, pv, sizeof(pv));
xml_escape(p_model, pm, sizeof(pm));
xml_escape(p_features, pf, sizeof(pf));
xml_escape(os_name, osn, sizeof(osn));
xml_escape(os_version, osv, sizeof(osv));
out.printf(
" <host_cpid>%s</host_cpid>\n"
" <p_ncpus>%d</p_ncpus>\n"
" <p_vendor>%s</p_vendor>\n"
" <p_model>%s</p_model>\n"
" <p_features>%s</p_features>\n"
" <p_fpops>%f</p_fpops>\n"
" <p_iops>%f</p_iops>\n"
" <p_membw>%f</p_membw>\n"
" <p_calculated>%f</p_calculated>\n"
" <p_vm_extensions_disabled>%d</p_vm_extensions_disabled>\n"
" <m_nbytes>%f</m_nbytes>\n"
" <m_cache>%f</m_cache>\n"
" <m_swap>%f</m_swap>\n"
" <d_total>%f</d_total>\n"
" <d_free>%f</d_free>\n"
" <os_name>%s</os_name>\n"
" <os_version>%s</os_version>\n",
host_cpid,
p_ncpus,
pv,
pm,
pf,
p_fpops,
p_iops,
p_membw,
p_calculated,
p_vm_extensions_disabled?1:0,
m_nbytes,
m_cache,
m_swap,
d_total,
d_free,
osn,
osv
);
if (strlen(product_name)) {
xml_escape(product_name, pn, sizeof(pn));
out.printf(
" <product_name>%s</product_name>\n",
pn
);
}
if (strlen(mac_address)) {
out.printf(
" <mac_address>%s</mac_address>\n",
mac_address
);
}
if (strlen(virtualbox_version)) {
char buf[256];
xml_escape(virtualbox_version, buf, sizeof(buf));
out.printf(
" <virtualbox_version>%s</virtualbox_version>\n",
buf
);
}
if (include_coprocs) {
this->coprocs.write_xml(out, false);
}
// The same CPU can have a different cpu_opencl_prop
// for each of multiple OpenCL platforms.
// We send them all to the project server because:
// - Different OpenCL platforms report different values
// for the same CPU
// - Some OpenCL CPU apps may work better with certain
// OpenCL platforms
//
for (int i=0; i<num_cpu_opencl_platforms; i++) {
cpu_opencl_prop[i].write_xml(out);
}
out.printf(
"</host_info>\n"
);
return 0;
} | false | false | false | false | false | 0 |
rv770_populate_vddc_value(struct radeon_device *rdev, u16 vddc,
RV770_SMC_VOLTAGE_VALUE *voltage)
{
struct rv7xx_power_info *pi = rv770_get_pi(rdev);
int i;
if (!pi->voltage_control) {
voltage->index = 0;
voltage->value = 0;
return 0;
}
for (i = 0; i < pi->valid_vddc_entries; i++) {
if (vddc <= pi->vddc_table[i].vddc) {
voltage->index = pi->vddc_table[i].vddc_index;
voltage->value = cpu_to_be16(vddc);
break;
}
}
if (i == pi->valid_vddc_entries)
return -EINVAL;
return 0;
} | false | false | false | false | false | 0 |
motion_notify_cb (GtkWidget *w, GdkEventMotion *event, ggobid *gg)
{
GdkModifierType state;
icoords pos;
gboolean rval = false;
gfloat val;
GtkWidget *tree_view = get_tree_view_from_object (G_OBJECT (w));
GGobiData *d = NULL;
gint selected_var = -1;
icoords *mousepos = &gg->wvis.mousepos;
gint color = gg->wvis.nearest_color;
if(tree_view) {
d = (GGobiData *) g_object_get_data(G_OBJECT (tree_view), "datad");
selected_var = get_one_selection_from_tree_view (tree_view, d);
}
gdk_window_get_pointer (w->window, &pos.x, &pos.y, &state);
if (pos.x != mousepos->x) {
val = (gfloat) (pos.x - xmargin) /
(gfloat) (w->allocation.width - 2*xmargin);
/*-- don't allow it to cross its neighbors' boundaries --*/
if ((color == 0 && val <= gg->wvis.pct[color+1] && val >= 0) ||
(color == gg->wvis.npct-1 && val >= gg->wvis.pct[color+1]) ||
(val >= gg->wvis.pct[color-1] && val <= gg->wvis.pct[color+1]))
{
gg->wvis.pct[color] = val;
if (selected_var != -1 && selected_var < d->ncols)
bin_counts_reset (selected_var, d, gg);
g_signal_emit_by_name(G_OBJECT (w), "expose_event",
(gpointer) gg, (gpointer) &rval);
if (gg->wvis.update_method == WVIS_UPDATE_CONTINUOUSLY) {
record_colors_reset (selected_var, d, gg);
clusters_set (d, gg);
displays_plot (NULL, FULL, gg);
}
}
}
mousepos->x = pos.x;
return true;
} | false | false | false | false | false | 0 |
CHECKSUM_print(const void *ip, const struct xt_entry_target *target,
int numeric)
{
const struct xt_CHECKSUM_info *einfo =
(const struct xt_CHECKSUM_info *)target->data;
printf(" CHECKSUM");
if (einfo->operation & XT_CHECKSUM_OP_FILL)
printf(" fill");
} | false | false | false | false | false | 0 |
__dup_locks_to_fdctx (pl_inode_t *pl_inode, fd_t *fd,
pl_fdctx_t *fdctx)
{
posix_lock_t *l = NULL;
posix_lock_t *duplock = NULL;
int ret = 0;
list_for_each_entry (l, &pl_inode->ext_list, list) {
if ((l->fd_num == fd_to_fdnum(fd))) {
duplock = lock_dup (l);
if (!duplock) {
ret = -1;
break;
}
list_add_tail (&duplock->list, &fdctx->locks_list);
}
}
return ret;
} | false | false | false | false | false | 0 |
cb_testsuggs_button(Fl_Button*, void*) {
const char *helpmsg =
"CHILD WIDGET SIZING TESTS\n"
"=========================\n"
" 1) Start program\n"
" 2) Click the 'ccc button' and D1/D2 buttons.\n"
" Their sizes should not change.\n"
" 3) Click the 'Item h() from widget' checkbox.\n"
" 4) Click the 'ccc button' and D1/D2 buttons.\n"
" Their sizes should change, getting larger vertically.\n"
" This validates that widget's size can affect the tree.\n"
" 5) Disable the checkbox, widgets should resize back to the\n"
" size of the other items.\n"
" 6) Hit ^A to select all items\n"
" 7) Under 'Selected Items', drag the 'Label Size' slider around.\n"
" All the item's height should change, as well as child widgets.\n"
" 8) Put Label Size' slider back to normal\n"
"\n"
"CHILD WIDGET + LABEL ITEM DRAWING TESTS\n"
"=======================================\n"
" 1) Start program\n"
" 2) Click 'Show label + widget'.\n"
" The widgets should all show item labels to their left.\n"
" 3) Disable same, item labels should disappear,\n"
" showing the widgets in their place.\n"
"\n"
" COLORS\n"
" ======\n"
" 1) Start program\n"
" 2) Change 'Tree Fonts+Colors' -> color()\n"
" 3) Entire tree's background color will change, including items.\n"
" 4) Change the 'Tree Fonts + Colors -> item_labelbgcolor()'\n"
" 6) Click the '111' item to select it.\n"
" 7) Click 'Test Operations -> Insert Above'\n"
" New items should appear above the selected item using the new color.\n"
" This color will be different from the background color.\n"
" 8) Change the 'Tree Fonts+Colors' -> color()\n"
" The entire tree's bg should change, except the new items.\n"
" 9) Click the Tree Fonts+Colors -> item_labelbgcolor() 'X' button.\n"
" This resets item_labelbgcolor() to the default 'transparent' color (0xffffffff)\n"
" 10) Again, click the 'Insert Above' button.\n"
" New items will be created in the background color, and changing the color()\n"
" should affect the new items too.\n"
"";
static Fl_Double_Window *helpwin = 0;
static Fl_Text_Display *helpdisp = 0;
static Fl_Text_Buffer *helpbuff = 0;
if ( !helpwin ) {
Fl_Group::current(0); // ensure we don't become child of other win
helpwin = new Fl_Double_Window(600,600,"Test Suggestions");
helpdisp = new Fl_Text_Display(0,0,helpwin->w(),helpwin->h());
helpbuff = new Fl_Text_Buffer();
helpdisp->buffer(helpbuff);
helpdisp->textfont(FL_COURIER);
helpdisp->textsize(12);
helpbuff->text(helpmsg);
helpwin->end();
}
helpwin->resizable(helpdisp);
helpwin->show();
} | false | false | false | false | false | 0 |
xfs_bmap_first_unused(
xfs_trans_t *tp, /* transaction pointer */
xfs_inode_t *ip, /* incore inode */
xfs_extlen_t len, /* size of hole to find */
xfs_fileoff_t *first_unused, /* unused block */
int whichfork) /* data or attr fork */
{
int error; /* error return value */
int idx; /* extent record index */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_fileoff_t lastaddr; /* last block number seen */
xfs_fileoff_t lowest; /* lowest useful block */
xfs_fileoff_t max; /* starting useful block */
xfs_fileoff_t off; /* offset for this block */
xfs_extnum_t nextents; /* number of extent entries */
ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE ||
XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS ||
XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) {
*first_unused = 0;
return 0;
}
ifp = XFS_IFORK_PTR(ip, whichfork);
if (!(ifp->if_flags & XFS_IFEXTENTS) &&
(error = xfs_iread_extents(tp, ip, whichfork)))
return error;
lowest = *first_unused;
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) {
xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
off = xfs_bmbt_get_startoff(ep);
/*
* See if the hole before this extent will work.
*/
if (off >= lowest + len && off - max >= len) {
*first_unused = max;
return 0;
}
lastaddr = off + xfs_bmbt_get_blockcount(ep);
max = XFS_FILEOFF_MAX(lastaddr, lowest);
}
*first_unused = max;
return 0;
} | false | false | false | false | false | 0 |
gijoe_objdma(void)
{
data16_t *src_head, *src_tail, *dst_head, *dst_tail;
void *pdummy;
int idummy;
src_head = spriteram16;
src_tail = spriteram16 + 255*8;
K053247_export_config(&dst_head, (struct GfxElement**)&pdummy, (void**)&pdummy, &idummy, &idummy);
dst_tail = dst_head + 255*8;
for (; src_head<=src_tail; src_head+=8)
{
if (*src_head & 0x8000)
{
memcpy(dst_head, src_head, 0x10);
dst_head += 8;
}
else
{
*dst_tail = 0;
dst_tail -= 8;
}
}
} | false | false | false | false | false | 0 |
add_stat (GitgRevisionDetailsPanel *panel,
gchar const *line)
{
gchar **parts;
parts = g_strsplit_set (line, "\t ", -1);
if (g_strv_length (parts) == 3)
{
StatInfo *stat;
stat = g_slice_new (StatInfo);
stat->added = (guint)atoi (parts[0]);
stat->removed = (guint)atoi (parts[1]);
stat->file = g_strdup (parts[2]);
panel->priv->stats = g_slist_prepend (panel->priv->stats,
stat);
}
g_strfreev (parts);
} | false | false | false | false | false | 0 |
SetRepresentationState(int state)
{
if (this->RepresentationState == state)
{
return;
}
state = (state < vtkLineRepresentation::Outside ?
vtkLineRepresentation::Outside :
(state > vtkLineRepresentation::Scaling ?
vtkLineRepresentation::Scaling : state));
this->RepresentationState = state;
this->Modified();
if ( state == vtkLineRepresentation::Outside )
{
this->HighlightPoint(0,0);
this->HighlightPoint(1,0);
this->HighlightLine(0);
}
else if ( state == vtkLineRepresentation::OnP1 )
{
this->HighlightPoint(0,1);
this->HighlightPoint(1,0);
this->HighlightLine(0);
}
else if ( state == vtkLineRepresentation::OnP2 )
{
this->HighlightPoint(0,0);
this->HighlightPoint(1,1);
this->HighlightLine(0);
}
else if ( state == vtkLineRepresentation::OnLine )
{
this->HighlightPoint(0,0);
this->HighlightPoint(1,0);
this->HighlightLine(1);
}
else
{
this->HighlightPoint(0,1);
this->HighlightPoint(1,1);
this->HighlightLine(1);
}
} | false | false | false | false | false | 0 |
qla2x00_start_timer(scsi_qla_host_t *vha, void *func, unsigned long interval)
{
init_timer(&vha->timer);
vha->timer.expires = jiffies + interval * HZ;
vha->timer.data = (unsigned long)vha;
vha->timer.function = (void (*)(unsigned long))func;
add_timer(&vha->timer);
vha->timer_active = 1;
} | false | false | false | false | false | 0 |
fixJoy(int i)
{
// Forward joysticks.
if (min[i] < max[i])
{
if (value[i] <= home[i])
return (double) (value[i] - min[i]) / (double)(home[i] - min[i]) - 1.0;
else
return (double) (value[i] - home[i]) / (double)(max[i] - home[i]);
}
// Backwards joysticks.
else
if (value[i] >= home[i])
return ((double)(min[i] - value[i]) / (double)(min[i] - home[i]) - 1.0);
else
return ((double)(home[i] - value[i]) / (double)(home[i] - max[i]));
} | false | false | false | false | false | 0 |
inputcategories (rawdata *rdta)
/* read the category rates and the categories for each site */
{ /* inputcategories */
int i, j, ch, ci;
if (rdta->categs >= 0) {
printf("ERROR: Unexpected Categories auxiliary data line\n");
return FALSE;
}
if (fscanf(INFILE, "%d", & rdta->categs) != 1) {
printf("ERROR: Problem reading number of rate categories\n");
return FALSE;
}
if (rdta->categs < 1 || rdta->categs > maxcategories) {
printf("ERROR: Bad number of categories: %d\n", rdta->categs);
printf("Must be in range 1 - %d\n", maxcategories);
return FALSE;
}
for (j = 1; j <= rdta->categs
&& fscanf(INFILE, "%lf", &(rdta->catrat[j])) == 1; j++) ;
if ((j <= rdta->categs) || (findch('\n') == EOF)) {
printf("ERROR: Problem reading rate values\n");
return FALSE;
}
for (i = 1; i <= nmlngth; i++) (void) getc(INFILE);
i = 1;
while (i <= rdta->sites) {
ch = getc(INFILE);
ci = base36(ch);
if (ci >= 0 && ci <= rdta->categs)
rdta->sitecat[i++] = ci;
else if (! whitechar(ch)) {
printf("ERROR: Bad category character (%c) at site %d\n", ch, i);
return FALSE;
}
}
if (findch('\n') == EOF) { /* skip to end of line */
printf("ERROR: Missing newline at end of category data\n");
return FALSE;
}
return TRUE;
} | false | false | false | false | false | 0 |
recff_getmetatable(jit_State *J, RecordFFData *rd)
{
TRef tr = J->base[0];
if (tr) {
RecordIndex ix;
ix.tab = tr;
copyTV(J->L, &ix.tabv, &rd->argv[0]);
if (lj_record_mm_lookup(J, &ix, MM_metatable))
J->base[0] = ix.mobj;
else
J->base[0] = ix.mt;
} /* else: Interpreter will throw. */
} | false | false | false | false | false | 0 |
jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now)
{
jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now);
jb->info.frames_in++;
if (type == JB_TYPE_VOICE) {
/* presently, I'm only adding VOICE frames to history and drift
* calculations; mostly because with the IAX integrations, I'm
* sending retransmitted control frames with their awkward
* timestamps through
*/
if (history_put(jb,ts,now,ms))
return JB_DROP;
}
/* if put into head of queue, caller needs to reschedule */
if (queue_put(jb,data,type,ms,ts)) {
return JB_SCHED;
}
return JB_OK;
} | false | false | false | false | false | 0 |
main_hall_mouse_release_region(int region)
{
if (Main_hall_frame_skip) {
return;
}
// don't do anything if there are no animations to play
else if(Main_hall_door_anim.size() == 0)
{
return;
}
// run backwards and stop at the first frame
Main_hall_door_anim.at(region).direction = GENERIC_ANIM_DIRECTION_BACKWARDS | GENERIC_ANIM_DIRECTION_NOLOOP;
// check for door sounds, ignoring the OPTIONS_REGION (which isn't a door)
if (Main_hall_door_anim.at(region).num_frames > 0) {
// don't stop the toaster oven or microwave regions from playing all the way through
if (Main_hall_door_sound_handles.at(region) != -1) {
snd_stop(Main_hall_door_sound_handles.at(region));
}
int sound = Main_hall->door_sounds.at(region).at(1);
if (sound >= 0)
{
Main_hall_door_sound_handles.at(region) = snd_play(&Snds_iface[sound], Main_hall->door_sound_pan.at(region));
}
// TODO: track current frame
snd_set_pos(Main_hall_door_sound_handles.at(region), &Snds_iface[SND_MAIN_HALL_DOOR_CLOSE],
(float)((Main_hall_door_anim.at(region).keyframe) ? Main_hall_door_anim.at(region).keyframe :
Main_hall_door_anim.at(region).num_frames - Main_hall_door_anim.at(region).current_frame) /
(float)Main_hall_door_anim.at(region).num_frames, 1);
}
} | false | false | false | false | false | 0 |
dumpClients(int sig)
{
register int fd;
register char *base=config.log.dumpPrefix;
register char *name;
register int i;
register fdInfoType *info;
now=time((time_t*)NULL); /* used in makeLogRec, make it current */
if (!base) {
syslog(LOG_ERR,"No dump file.");
return;
}
name=malloc(strlen(base)+30);
if (name==NULL) {
freeSomeMemory(NULL);
name=malloc(strlen(base)+30);
}
if (name==NULL) {
syslog(LOG_ERR,"Out of memory in dumpClients");
return;
}
sprintf(name,"%s.client.%d",base,negotInfo->pid);
unlink(name);
fd=open(name,O_WRONLY|O_CREAT|O_EXCL,0600);
if (fd<0) {
syslog(LOG_ERR,"Couldn't open %s for write",name);
free(name);
return;
}
for (i=lowFd,info=fdInfo+lowFd; i<=highFd; i++,info++) {
if ((info->flags&FD_IS_CLIENT) && !(info->flags&FD_IS_UDP) && info->fd>=0) {
register int ret;
register logRecType *rec;
rec=makeLogRec(info,0);
if (rec) do {
ret=write(fd,rec,ntohs(rec->head.size));
} while (ret<0 && errno==EINTR);
}
}
close(fd);
free(name);
if (debug&DBG_SANITY)
dumpFootprint(-1);
} | false | false | false | false | false | 0 |
get_parameter_algo( struct para_data_s *para, enum para_name key )
{
int i;
struct para_data_s *r = get_parameter( para, key );
if( !r )
return -1;
if( digitp( r->u.value ) )
i = atoi( r->u.value );
else
i = string_to_pubkey_algo( r->u.value );
if (i == PUBKEY_ALGO_RSA_E || i == PUBKEY_ALGO_RSA_S)
i = 0; /* we don't want to allow generation of these algorithms */
return i;
} | false | false | false | false | false | 0 |
nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
loff_t start, loff_t end)
{
struct the_nilfs *nilfs = sb->s_fs_info;
struct nilfs_sc_info *sci = nilfs->ns_writer;
struct nilfs_inode_info *ii;
struct nilfs_transaction_info ti;
int err = 0;
if (!sci)
return -EROFS;
nilfs_transaction_lock(sb, &ti, 0);
ii = NILFS_I(inode);
if (test_bit(NILFS_I_INODE_SYNC, &ii->i_state) ||
nilfs_test_opt(nilfs, STRICT_ORDER) ||
test_bit(NILFS_SC_UNCLOSED, &sci->sc_flags) ||
nilfs_discontinued(nilfs)) {
nilfs_transaction_unlock(sb);
err = nilfs_segctor_sync(sci);
return err;
}
spin_lock(&nilfs->ns_inode_lock);
if (!test_bit(NILFS_I_QUEUED, &ii->i_state) &&
!test_bit(NILFS_I_BUSY, &ii->i_state)) {
spin_unlock(&nilfs->ns_inode_lock);
nilfs_transaction_unlock(sb);
return 0;
}
spin_unlock(&nilfs->ns_inode_lock);
sci->sc_dsync_inode = ii;
sci->sc_dsync_start = start;
sci->sc_dsync_end = end;
err = nilfs_segctor_do_construct(sci, SC_LSEG_DSYNC);
if (!err)
nilfs->ns_flushed_device = 0;
nilfs_transaction_unlock(sb);
return err;
} | false | false | false | false | false | 0 |
iscsi_add_portal(char *addr, int port, int tpgt, int do_create)
{
struct iscsi_portal *new_portal;
list_for_each_entry(new_portal, &iscsi_portals_list,
iscsi_portal_siblings) {
if (!strcmp(addr, new_portal->addr)
&& port == new_portal->port) {
eprintf("add_portal failed. This portal already "
"exists %s:%d\n", addr, port);
return -1;
}
}
new_portal = zalloc(sizeof(struct iscsi_portal));
new_portal->addr = strdup(addr);
new_portal->port = port ? port : ISCSI_LISTEN_PORT;
new_portal->tpgt = tpgt;
new_portal->fd = -1;
if (do_create && iscsi_tcp_init_portal(new_portal)) {
eprintf("failed to create/bind to portal %s:%d\n", addr, port);
free(new_portal->addr);
free(new_portal);
return -1;
}
list_add(&new_portal->iscsi_portal_siblings, &iscsi_portals_list);
return 0;
} | false | false | false | true | false | 1 |
pixBilateral(PIX *pixs,
l_float32 spatial_stdev,
l_float32 range_stdev,
l_int32 ncomps,
l_int32 reduction)
{
l_int32 d;
l_float32 sstdev; /* scaled spatial stdev */
PIX *pixt, *pixr, *pixg, *pixb, *pixd;
PROCNAME("pixBilateral");
if (!pixs || pixGetColormap(pixs))
return (PIX *)ERROR_PTR("pixs not defined or cmapped", procName, NULL);
d = pixGetDepth(pixs);
if (d != 8 && d != 32)
return (PIX *)ERROR_PTR("pixs not 8 or 32 bpp", procName, NULL);
if (reduction != 1 && reduction != 2 && reduction != 4)
return (PIX *)ERROR_PTR("reduction invalid", procName, NULL);
sstdev = spatial_stdev / (l_float32)reduction; /* reduced spat. stdev */
if (sstdev < 0.5)
return (PIX *)ERROR_PTR("sstdev < 0.5", procName, NULL);
if (range_stdev <= 5.0)
return (PIX *)ERROR_PTR("range_stdev <= 5.0", procName, NULL);
if (ncomps < 4 || ncomps > 30)
return (PIX *)ERROR_PTR("ncomps not in [4 ... 30]", procName, NULL);
if (ncomps * range_stdev < 100.0)
return (PIX *)ERROR_PTR("ncomps * range_stdev < 100.0", procName, NULL);
if (d == 8)
return pixBilateralGray(pixs, spatial_stdev, range_stdev,
ncomps, reduction);
pixt = pixGetRGBComponent(pixs, COLOR_RED);
pixr = pixBilateralGray(pixt, spatial_stdev, range_stdev, ncomps,
reduction);
pixDestroy(&pixt);
pixt = pixGetRGBComponent(pixs, COLOR_GREEN);
pixg = pixBilateralGray(pixt, spatial_stdev, range_stdev, ncomps,
reduction);
pixDestroy(&pixt);
pixt = pixGetRGBComponent(pixs, COLOR_BLUE);
pixb = pixBilateralGray(pixt, spatial_stdev, range_stdev, ncomps,
reduction);
pixDestroy(&pixt);
pixd = pixCreateRGBImage(pixr, pixg, pixb);
pixDestroy(&pixr);
pixDestroy(&pixg);
pixDestroy(&pixb);
return pixd;
} | false | false | false | false | false | 0 |
globus_i_gfs_log_close(void)
{
globus_list_t * list;
GlobusGFSName(globus_i_gfs_log_close);
GlobusGFSDebugEnter();
if(globus_l_gfs_log_handle != NULL)
{
globus_logging_flush(globus_l_gfs_log_handle);
globus_logging_destroy(globus_l_gfs_log_handle);
}
if(globus_l_gfs_log_file != stderr && globus_l_gfs_log_file != NULL)
{
fclose(globus_l_gfs_log_file);
globus_l_gfs_log_file = NULL;
}
if(globus_l_gfs_transfer_log_file != NULL)
{
fclose(globus_l_gfs_transfer_log_file);
globus_l_gfs_transfer_log_file = NULL;
}
list = globus_l_gfs_log_usage_handle_list;
while(!globus_list_empty(list))
{
globus_l_gfs_log_usage_ent_t * usage_ent;
usage_ent = (globus_l_gfs_log_usage_ent_t *)
globus_list_remove(&list, list);
if(usage_ent)
{
if(usage_ent->handle)
{
globus_usage_stats_handle_destroy(usage_ent->handle);
}
if(usage_ent->target)
{
globus_free(usage_ent->target);
}
if(usage_ent->taglist)
{
globus_free(usage_ent->taglist);
}
globus_free(usage_ent);
}
}
GlobusGFSDebugExit();
} | false | false | false | false | false | 0 |
accept()
{
if( AttalSettings::getInstance()->getDispositionMode() != (AttalSettings::DispositionMode) _dispositionMode->currentItem() ) {
AttalSettings::getInstance()->setDispositionMode( (AttalSettings::DispositionMode) _dispositionMode->currentItem() );
emit sig_dispositions();
}
QDialog::accept ();
} | false | false | false | false | false | 0 |
asm_loop(ASMState *as)
{
MCode *mcspill;
/* LOOP is a guard, so the snapno is up to date. */
as->loopsnapno = as->snapno;
if (as->gcsteps)
asm_gc_check(as);
/* LOOP marks the transition from the variant to the invariant part. */
as->flagmcp = as->invmcp = NULL;
as->sectref = 0;
if (!neverfuse(as)) as->fuseref = 0;
asm_phi_shuffle(as);
mcspill = as->mcp;
asm_phi_copyspill(as);
asm_loop_fixup(as);
as->mcloop = as->mcp;
RA_DBGX((as, "===== LOOP ====="));
if (!as->realign) RA_DBG_FLUSH();
if (as->mcp != mcspill)
emit_jmp(as, mcspill);
} | false | false | false | false | false | 0 |
gtkpod_has_lyrics_editor() {
g_return_val_if_fail (GTKPOD_IS_APP(gtkpod_app), FALSE);
return (GTKPOD_APP_GET_INTERFACE (gtkpod_app)->lyrics_editor != NULL);
} | false | false | false | false | false | 0 |
do_ibusy(char *inum, int fd, struct aufs_ibusy *ibusy)
{
int err;
err = -1;
errno = 0;
ibusy->ino = strtoul(inum, NULL, 0);
if (errno)
goto out;
err = 0;
if (ibusy->ino == AUFS_ROOT_INO)
goto out;
err = ioctl(fd, AUFS_CTL_IBUSY, ibusy);
if (!err && ibusy->h_ino)
printf("i%llu\tb%d\thi%llu\n",
(unsigned long long)ibusy->ino, ibusy->bindex,
(unsigned long long)ibusy->h_ino);
out:
return err;
} | false | false | false | false | false | 0 |
parser_term_2 (Parser* self) {
gboolean result = FALSE;
LexerToken* token = NULL;
Lexer* _tmp0_ = NULL;
LexerToken* _tmp1_ = NULL;
Lexer* _tmp2_ = NULL;
gboolean _tmp3_ = FALSE;
LexerToken* _tmp4_ = NULL;
LexerTokenType _tmp5_ = 0;
gboolean _tmp8_ = FALSE;
LexerToken* _tmp9_ = NULL;
LexerTokenType _tmp10_ = 0;
g_return_val_if_fail (self != NULL, FALSE);
_tmp0_ = self->priv->lexer;
_tmp1_ = lexer_get_next_token (_tmp0_);
token = _tmp1_;
_tmp2_ = self->priv->lexer;
lexer_roll_back (_tmp2_);
_tmp4_ = token;
_tmp5_ = _tmp4_->type;
if (_tmp5_ == LEXER_TOKEN_TYPE_PL_EOS) {
_tmp3_ = TRUE;
} else {
LexerToken* _tmp6_ = NULL;
LexerTokenType _tmp7_ = 0;
_tmp6_ = token;
_tmp7_ = _tmp6_->type;
_tmp3_ = _tmp7_ == LEXER_TOKEN_TYPE_ASSIGN;
}
_tmp8_ = _tmp3_;
if (_tmp8_) {
result = TRUE;
_lexer_token_unref0 (token);
return result;
}
_tmp9_ = token;
_tmp10_ = _tmp9_->type;
if (_tmp10_ == LEXER_TOKEN_TYPE_VARIABLE) {
guint _tmp11_ = 0U;
Associativity _tmp12_ = 0;
MultiplyNode* _tmp13_ = NULL;
MultiplyNode* _tmp14_ = NULL;
gboolean _tmp15_ = FALSE;
_tmp11_ = parser_make_precedence_p (self, PRECEDENCE_MULTIPLY);
_tmp12_ = parser_get_associativity_p (self, PRECEDENCE_MULTIPLY);
_tmp13_ = multiply_node_new (self, NULL, _tmp11_, _tmp12_);
_tmp14_ = _tmp13_;
parser_insert_into_tree (self, (ParseNode*) _tmp14_);
_parse_node_unref0 (_tmp14_);
_tmp15_ = parser_term (self);
if (!_tmp15_) {
result = FALSE;
_lexer_token_unref0 (token);
return result;
}
result = TRUE;
_lexer_token_unref0 (token);
return result;
} else {
result = TRUE;
_lexer_token_unref0 (token);
return result;
}
_lexer_token_unref0 (token);
} | false | false | false | false | false | 0 |
smsc95xx_resume(struct usb_interface *intf)
{
struct usbnet *dev = usb_get_intfdata(intf);
struct smsc95xx_priv *pdata;
u8 suspend_flags;
int ret;
u32 val;
BUG_ON(!dev);
pdata = (struct smsc95xx_priv *)(dev->data[0]);
suspend_flags = pdata->suspend_flags;
netdev_dbg(dev->net, "resume suspend_flags=0x%02x\n", suspend_flags);
/* do this first to ensure it's cleared even in error case */
pdata->suspend_flags = 0;
if (suspend_flags & SUSPEND_ALLMODES) {
/* clear wake-up sources */
ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val);
if (ret < 0)
return ret;
val &= ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_);
ret = smsc95xx_write_reg_nopm(dev, WUCSR, val);
if (ret < 0)
return ret;
/* clear wake-up status */
ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
if (ret < 0)
return ret;
val &= ~PM_CTL_WOL_EN_;
val |= PM_CTL_WUPS_;
ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
if (ret < 0)
return ret;
}
ret = usbnet_resume(intf);
if (ret < 0)
netdev_warn(dev->net, "usbnet_resume error\n");
return ret;
} | false | false | false | false | false | 0 |
print_ematch_list(FILE *fd, struct tcf_ematch_tree_hdr *hdr,
struct rtattr *rta)
{
int err = -1;
struct rtattr **tb;
tb = malloc((hdr->nmatches + 1) * sizeof(struct rtattr *));
if (tb == NULL)
return -1;
if (hdr->nmatches > 0) {
if (parse_rtattr_nested(tb, hdr->nmatches, rta) < 0)
goto errout;
fprintf(fd, "\n ");
if (print_ematch_seq(fd, tb, 1, 1) < 0)
goto errout;
}
err = 0;
errout:
free(tb);
return err;
} | false | false | false | false | false | 0 |
ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn)
{
int i;
for (i = 0; i < txn->ninvalidations; i++)
LocalExecuteInvalidationMessage(&txn->invalidations[i]);
} | false | false | false | false | false | 0 |
ev_debug(enum ev_type type, union ev_val *val, uint32_t count)
{
switch (type) {
case ev_string:
cli_dbgmsg("\t(%u): %s\n", count, val->v_string);
break;
case ev_data:
{
char *d = cli_str2hex(val->v_data, count);
cli_dbgmsg("\t%d bytes\n", count);
cli_dbgmsg("\t%s\n", d);
free(d);
break;
}
case ev_data_fast:
cli_dbgmsg("\t%08x checksum, %u bytes\n", (uint32_t)val->v_int, count);
break;
case ev_int:
cli_dbgmsg("\t(%u): 0x%llx\n", count, (long long)val->v_int);
break;
case ev_time:
cli_dbgmsg("\t(%u): %d.%06us\n", count, (signed)(val->v_int / 1000000),
(unsigned)(val->v_int % 1000000));
break;
}
} | false | false | false | false | false | 0 |
FLASH_EraseAllBank2Sectors(uint8_t VoltageRange)
{
uint32_t tmp_psize = 0x0;
FLASH_Status status = FLASH_COMPLETE;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation();
assert_param(IS_VOLTAGERANGE(VoltageRange));
if(VoltageRange == VoltageRange_1)
{
tmp_psize = FLASH_PSIZE_BYTE;
}
else if(VoltageRange == VoltageRange_2)
{
tmp_psize = FLASH_PSIZE_HALF_WORD;
}
else if(VoltageRange == VoltageRange_3)
{
tmp_psize = FLASH_PSIZE_WORD;
}
else
{
tmp_psize = FLASH_PSIZE_DOUBLE_WORD;
}
if(status == FLASH_COMPLETE)
{
/* if the previous operation is completed, proceed to erase all sectors */
FLASH->CR &= CR_PSIZE_MASK;
FLASH->CR |= tmp_psize;
FLASH->CR |= FLASH_CR_MER2;
FLASH->CR |= FLASH_CR_STRT;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation();
/* if the erase operation is completed, disable the MER Bit */
FLASH->CR &= (~FLASH_CR_MER2);
}
/* Return the Erase Status */
return status;
} | false | false | false | false | false | 0 |
est_mtdb_open(const char *name, int omode, int *ecp){
ESTMTDB *mtdb;
ESTDB *db;
char *path;
assert(name && ecp);
if(!est_global_lock()){
*ecp = ESTELOCK;
return NULL;
}
if(!est_global_db_names){
est_global_db_names = cbmapopenex(ESTMINIBNUM);
cbglobalgc(est_global_db_names, (void (*)(void *))cbmapclose);
}
path = est_realpath(name);
if(cbmapget(est_global_db_names, path, -1, NULL)){
free(path);
*ecp = ESTEACCES;
est_global_unlock();
return NULL;
}
mtdb = cbmalloc(sizeof(ESTMTDB));
if(!(db = est_db_open(name, omode, ecp))){
free(mtdb);
free(path);
est_global_unlock();
return NULL;
}
free(path);
path = est_realpath(name);
cbmapput(est_global_db_names, path, -1, "", 0, FALSE);
mtdb->db = db;
mtdb->path = path;
pthread_mutex_init(&(mtdb->mutex), NULL);
est_global_unlock();
return mtdb;
} | false | false | false | false | false | 0 |
amp_scalefac_bands(lame_internal_flags * gfc,
gr_info * const cod_info, FLOAT const *distort, FLOAT xrpow[576], int bRefine)
{
SessionConfig_t const *const cfg = &gfc->cfg;
int j, sfb;
FLOAT ifqstep34, trigger;
int noise_shaping_amp;
if (cod_info->scalefac_scale == 0) {
ifqstep34 = 1.29683955465100964055; /* 2**(.75*.5) */
}
else {
ifqstep34 = 1.68179283050742922612; /* 2**(.75*1) */
}
/* compute maximum value of distort[] */
trigger = 0;
for (sfb = 0; sfb < cod_info->sfbmax; sfb++) {
if (trigger < distort[sfb])
trigger = distort[sfb];
}
noise_shaping_amp = cfg->noise_shaping_amp;
if (noise_shaping_amp == 3) {
if (bRefine == 1)
noise_shaping_amp = 2;
else
noise_shaping_amp = 1;
}
switch (noise_shaping_amp) {
case 2:
/* amplify exactly 1 band */
break;
case 1:
/* amplify bands within 50% of max (on db scale) */
if (trigger > 1.0)
trigger = pow(trigger, .5);
else
trigger *= .95;
break;
case 0:
default:
/* ISO algorithm. amplify all bands with distort>1 */
if (trigger > 1.0)
trigger = 1.0;
else
trigger *= .95;
break;
}
j = 0;
for (sfb = 0; sfb < cod_info->sfbmax; sfb++) {
int const width = cod_info->width[sfb];
int l;
j += width;
if (distort[sfb] < trigger)
continue;
if (gfc->sv_qnt.substep_shaping & 2) {
gfc->sv_qnt.pseudohalf[sfb] = !gfc->sv_qnt.pseudohalf[sfb];
if (!gfc->sv_qnt.pseudohalf[sfb] && cfg->noise_shaping_amp == 2)
return;
}
cod_info->scalefac[sfb]++;
for (l = -width; l < 0; l++) {
xrpow[j + l] *= ifqstep34;
if (xrpow[j + l] > cod_info->xrpow_max)
cod_info->xrpow_max = xrpow[j + l];
}
if (cfg->noise_shaping_amp == 2)
return;
}
} | false | false | false | false | false | 0 |
layer_error(int x)
{
SecureLayer *s = (SecureLayer *)sender();
int type = s->type;
d->errorCode = x;
setOpenMode(QIODevice::NotOpen);
d->active = false;
while (!d->layers.isEmpty()) {
delete d->layers.takeFirst();
}
if(type == SecureLayer::TLS)
setError(ErrTLS);
else if(type == SecureLayer::SASL)
setError(ErrSASL);
#ifdef USE_TLSHANDLER
else if(type == SecureLayer::TLSH)
setError(ErrTLS);
#endif
} | false | false | false | false | false | 0 |
keyPress(SDL_KeyboardEvent *e) {
//Quit demo if the user presses ESC
if (e->type == SDL_KEYDOWN) {
#if SDL_VERSION_ATLEAST(1,3,0)
bool key_escape = e->keysym.scancode == SDL_SCANCODE_ESCAPE;
bool key_return = e->keysym.scancode == SDL_SCANCODE_RETURN;
#else
bool key_escape = e->keysym.unicode == SDLK_ESCAPE;
bool key_return = e->keysym.unicode == SDLK_RETURN;
#endif
if (key_escape) {
quit();
}
if(key_return) {
#if SDL_VERSION_ATLEAST(1,3,0)
Uint8* keystate = SDL_GetKeyboardState(NULL);
if(keystate[SDL_SCANCODE_RALT] || keystate[SDL_SCANCODE_LALT]) {
#else
Uint8* keystate = SDL_GetKeyState(NULL);
if(keystate[SDLK_RALT] || keystate[SDLK_LALT]) {
#endif
toggleFullscreen();
} else {
if(gGourceSettings.repo_count>1)
next = true;
}
}
}
if(gource!=0) gource->keyPress(e);
} | false | false | false | false | false | 0 |
bt_ctf_stream_class_add_event_class(
struct bt_ctf_stream_class *stream_class,
struct bt_ctf_event_class *event_class)
{
int ret = 0;
if (!stream_class || !event_class) {
ret = -1;
goto end;
}
/* Check for duplicate event classes */
struct search_query query = { .value = event_class, .found = 0 };
g_ptr_array_foreach(stream_class->event_classes, value_exists, &query);
if (query.found) {
ret = -1;
goto end;
}
if (bt_ctf_event_class_set_id(event_class,
stream_class->next_event_id++)) {
/* The event is already associated to a stream class */
ret = -1;
goto end;
}
bt_ctf_event_class_get(event_class);
g_ptr_array_add(stream_class->event_classes, event_class);
end:
return ret;
} | false | false | false | false | false | 0 |
init_nlm(void)
{
int err;
#ifdef CONFIG_SYSCTL
err = -ENOMEM;
nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root);
if (nlm_sysctl_table == NULL)
goto err_sysctl;
#endif
err = register_pernet_subsys(&lockd_net_ops);
if (err)
goto err_pernet;
err = lockd_create_procfs();
if (err)
goto err_procfs;
return 0;
err_procfs:
unregister_pernet_subsys(&lockd_net_ops);
err_pernet:
#ifdef CONFIG_SYSCTL
unregister_sysctl_table(nlm_sysctl_table);
err_sysctl:
#endif
return err;
} | false | false | false | false | false | 0 |
initCursors()
{
if (BendpointCursor == NULL) {
//timer.setSingleShot(true);
//timer.setInterval(0);
//connect(&timer, SIGNAL(timeout()), &TheCursorMaster, SLOT(moveCursor()));
QStringList names;
QStringList masks;
names << ":resources/images/cursor/bendpoint.bmp"
<< ":resources/images/cursor/new_bendpoint.bmp"
<< ":resources/images/cursor/make_wire.bmp"
<< ":resources/images/cursor/curve.bmp"
<< ":resources/images/cursor/rubberband_move.bmp"
<< ":resources/images/cursor/part_move.bmp"
<< ":resources/images/cursor/bendleg.bmp"
<< ":resources/images/cursor/rotate.bmp"
<< ":resources/images/cursor/scale.bmp";
masks << ":resources/images/cursor/bendpoint_mask.bmp"
<< ":resources/images/cursor/new_bendpoint_mask.bmp"
<< ":resources/images/cursor/make_wire_mask.bmp"
<< ":resources/images/cursor/curve_mask.bmp"
<< ":resources/images/cursor/rubberband_move_mask.bmp"
<< ":resources/images/cursor/part_move_mask.bmp"
<< ":resources/images/cursor/bendleg_mask.bmp"
<< ":resources/images/cursor/rotate_mask.bmp"
<< ":resources/images/cursor/scale_mask.bmp";
Cursors << &BendpointCursor
<< &NewBendpointCursor
<< &MakeWireCursor
<< &MakeCurveCursor
<< &RubberbandCursor
<< &MoveCursor
<< &BendlegCursor
<< &RotateCursor
<< &ScaleCursor;
for (int i = 0; i < Cursors.count(); i++) {
QBitmap bitmap1(names.at(i));
QBitmap bitmap1m(masks.at(i));
*Cursors.at(i) = new QCursor(bitmap1, bitmap1m, 0, 0);
}
QApplication::instance()->installEventFilter(instance());
}
} | false | false | false | false | false | 0 |
collect_bounds(CloogConstraint *c, void *user)
{
struct clast_minmax_data *d = (struct clast_minmax_data *) user;
if (!valid_bound(c, d))
return 0;
d->r->elts[d->n] = clast_bound_from_constraint(c, d->level,
d->infos->names);
if (d->lower_bound && d->infos->stride[d->level - 1]) {
update_lower_bound(d->r->elts[d->n], d->level,
d->infos->stride[d->level - 1]);
}
d->n++;
return 0;
} | false | false | false | false | false | 0 |
rl_old_menu_complete (count, invoking_key)
int count, invoking_key;
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
static char *orig_text;
static char **matches = (char **)0;
static int match_list_index = 0;
static int match_list_size = 0;
static int orig_start, orig_end;
static char quote_char;
static int delimiter;
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_old_menu_complete)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
_rl_free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
rl_completion_invoking_key = invoking_key;
RL_SETSTATE(RL_STATE_COMPLETING);
/* Only the completion entry function can change these. */
set_completion_defaults ('%');
our_func = rl_menu_completion_entry_function;
if (our_func == 0)
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
found_quote = delimiter = 0;
quote_char = '\0';
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
quote_char = _rl_find_completion_word (&found_quote, &delimiter);
orig_start = rl_point;
rl_point = orig_end;
orig_text = rl_copy_text (orig_start, orig_end);
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
rl_filename_completion_function does this. */
matching_filenames = rl_filename_completion_desired;
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
FREE (orig_text);
orig_text = (char *)0;
completion_changed_buffer = 0;
RL_UNSETSTATE(RL_STATE_COMPLETING);
return (0);
}
RL_UNSETSTATE(RL_STATE_COMPLETING);
for (match_list_size = 0; matches[match_list_size]; match_list_size++)
;
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if (match_list_size > 1 && _rl_complete_show_all)
display_matches (matches);
}
/* Now we have the list of matches. Replace the text between
rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
matches[match_list_index], and add any necessary closing char. */
if (matches == 0 || match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
completion_changed_buffer = 0;
return (0);
}
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
else
match_list_index %= match_list_size;
if (match_list_index == 0 && match_list_size > 1)
{
rl_ding ();
insert_match (orig_text, orig_start, MULT_MATCH, "e_char);
}
else
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, "e_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
strcmp (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
return (0);
} | false | false | false | false | false | 0 |
probability_map_new_raw (const guchar* data,
gint width,
gint height,
gint row_stride,
gint pixel_stride,
gint pixel_type)
{
ProbabilityMap *self = PROBABILITY_MAP(g_object_new(probability_map_get_type(), NULL));
gdouble sum = 0;
const guchar* row = data;
const guchar* pixel;
int x;
int y = height;
gfloat *output;
self->width = width;
self->height = height;
self->image_scale_x = 1.0 / (width - 1);
self->image_scale_y = 1.0 / (height - 1);
self->cumulative_length = width * height;
self->cumulative = g_new(gfloat, self->cumulative_length);
output = self->cumulative;
/* Caluclate a cumulative distribution. For each pixel, we save the
* sum of it and all prior pixels. For speed, these inner loops are
* implemented separately for each pixel type using a macro.
*/
#define CALCULATE_SUMS(type) do { \
while (y) { \
x = width; \
pixel = row; \
while (x) { \
sum += *(type*)pixel; \
*output = sum; \
output++; \
x--; \
pixel += pixel_stride; \
} \
y--; \
row += row_stride; \
}; \
} while (0)
switch (pixel_type) {
case G_TYPE_UCHAR:
CALCULATE_SUMS(guchar);
break;
case G_TYPE_UINT:
CALCULATE_SUMS(guint);
break;
case G_TYPE_ULONG:
CALCULATE_SUMS(gulong);
break;
case G_TYPE_FLOAT:
CALCULATE_SUMS(gfloat);
break;
case G_TYPE_DOUBLE:
CALCULATE_SUMS(gdouble);
break;
default:
g_warning("Unsupported pixel format");
}
#undef CALCULATE_SUMS
return self;
} | false | false | false | false | false | 0 |
_elm_flip_smart_focus_next(const Evas_Object *obj,
Elm_Focus_Direction dir,
Evas_Object **next)
{
ELM_FLIP_DATA_GET(obj, sd);
/* attempt to cycle focus on in sub-items */
if (sd->state)
return elm_widget_focus_next_get(sd->front.content, dir, next);
else
return elm_widget_focus_next_get(sd->back.content, dir, next);
} | false | false | false | false | false | 0 |
regtry(prog, string, restate)
regexp *prog;
char *string;
struct regexec_state *restate;
{
register int i;
register char **sp;
register char **ep;
restate->reginput = string;
restate->regstartp = prog->startp;
restate->regendp = prog->endp;
sp = prog->startp;
ep = prog->endp;
for (i = NSUBEXP; i > 0; i--) {
*sp++ = NULL;
*ep++ = NULL;
}
if (regmatch(prog->program + 1,restate)) {
prog->startp[0] = string;
prog->endp[0] = restate->reginput;
return(1);
} else
return(0);
} | false | false | false | false | false | 0 |
load_form_definition( const char * filename )
{
FILE *fp = fopen( filename, "r" );
int fd_magic, nf;
FL_FORM *form;
char buf[ 256 ],
ubuf[ 32 ];
if ( ! fp )
{
perror( filename );
return -1;
};
if ( fscanf( fp, "Magic: %d\n\n", &fd_magic ) != 1
|| ( fd_magic != MAGIC3
&& fd_magic != MAGIC4
&& fd_magic != MAGIC5 ) )
{
fclose( fp );
fprintf( stderr, "Unknown file %s (magic %d)\n", filename, fd_magic );
return -1;
}
psinfo.inverted = ( fd_magic == MAGIC4 );
if ( ! fgets( buf, sizeof buf, fp )
|| strcmp( buf, "Internal Form Definition File\n" )
|| ! fgets( buf, sizeof buf, fp )
|| strcmp( buf, " (do not change)\n" )
|| fgetc( fp ) != '\n'
|| fscanf( fp, "Number of forms: %d\n", &nf ) != 1 )
{
fclose( fp );
fprintf( stderr, "Failure to read file %s\n", filename );
return -1;
}
psinfo.pages = nf;
if ( nf > 1 && psinfo.eps )
fprintf( stderr, "Requesting EPS output with more than one form.\n" );
if ( psinfo.verbose )
fprintf( stderr, "%d forms will be converted\n", nf );
/* read until we hit a seperator line */
while ( fgets( buf, sizeof buf, fp ) && *buf != '\n' )
{
if ( strncmp( buf, "Unit", 4 ) == 0 )
{
float xs,
ys;
if ( sscanf( buf, "Unit of measure: %s", ubuf ) != 1 )
{
fclose( fp );
fprintf( stderr, "Failure to read file %s\n", filename );
return -1;
}
psinfo.unit = unit_val( ubuf );
get_scale_unit( psinfo.unit, &xs, &ys );
}
else if ( strncmp( buf, "Border", 6 ) == 0 )
{
if ( sscanf( buf, "Border Width: %s", ubuf ) != 1 )
{
fclose( fp );
fprintf( stderr, "Failure to read file %s\n", filename );
return -1;
}
psinfo.bw = atoi( ubuf );
}
else if ( strncmp( buf, "Snap", 4 ) == 0 )
/* empty */ ;
else
fprintf( stderr, "Unknown token: %s", buf );
}
if ( psinfo.user_bw )
psinfo.bw = psinfo.user_bw;
while ( --nf >= 0 )
{
form = read_form( fp );
ps_show_form( form );
}
fclose( fp );
return 0;
} | false | false | false | false | false | 0 |
acmp_strtoucs(ACMP *parser, const char *str, acmp_utf8_char_t *ucs_chars, int len) {
int i;
const char *c = str;
#ifdef ACMP_USE_UTF8
if (parser->is_utf8) {
for (i = 0; i < len; i++) {
*(ucs_chars++) = utf8_decodechar(c);
c += utf8_seq_len(c);
}
} else
#endif
{
for (i = 0; i < len; i++) {
*(ucs_chars++) = *(c++);
}
}
} | false | false | false | false | false | 0 |
vnc_cursor_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
VncCursor *cursor = VNC_CURSOR (object);
VncCursorPrivate *priv = cursor->priv;
switch (prop_id) {
case PROP_DATA:
g_free(priv->data);
priv->data = g_value_get_pointer(value);
break;
case PROP_HOTX:
priv->hotx = g_value_get_int(value);
break;
case PROP_HOTY:
priv->hoty = g_value_get_int(value);
break;
case PROP_WIDTH:
priv->width = g_value_get_int(value);
break;
case PROP_HEIGHT:
priv->height = g_value_get_int(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} | false | false | false | false | false | 0 |
test_upload_simple (UploadData *data, gconstpointer service)
{
GDataUploadStream *upload_stream;
GFileInputStream *file_stream;
const gchar * const *tags, * const *tags2;
gssize transfer_size;
GError *error = NULL;
gdata_test_mock_server_start_trace (mock_server, "upload-simple");
/* Prepare the upload stream */
upload_stream = gdata_youtube_service_upload_video (GDATA_YOUTUBE_SERVICE (service), data->video, data->slug, data->content_type, NULL,
&error);
g_assert_no_error (error);
g_assert (GDATA_IS_UPLOAD_STREAM (upload_stream));
/* Get an input stream for the file */
file_stream = g_file_read (data->video_file, NULL, &error);
g_assert_no_error (error);
g_assert (G_IS_FILE_INPUT_STREAM (file_stream));
/* Upload the video */
transfer_size = g_output_stream_splice (G_OUTPUT_STREAM (upload_stream), G_INPUT_STREAM (file_stream),
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error);
g_assert_no_error (error);
g_assert_cmpint (transfer_size, >, 0);
/* Finish off the upload */
data->updated_video = gdata_youtube_service_finish_video_upload (GDATA_YOUTUBE_SERVICE (service), upload_stream, &error);
g_assert_no_error (error);
g_assert (GDATA_IS_YOUTUBE_VIDEO (data->updated_video));
g_object_unref (file_stream);
g_object_unref (upload_stream);
/* Check the video's properties */
g_assert (gdata_entry_is_inserted (GDATA_ENTRY (data->updated_video)));
g_assert_cmpstr (gdata_entry_get_title (GDATA_ENTRY (data->updated_video)), ==, gdata_entry_get_title (GDATA_ENTRY (data->video)));
g_assert_cmpstr (gdata_youtube_video_get_description (data->updated_video), ==, gdata_youtube_video_get_description (data->video));
g_assert_cmpstr (gdata_media_category_get_category (gdata_youtube_video_get_category (data->updated_video)), ==,
gdata_media_category_get_category (gdata_youtube_video_get_category (data->video)));
tags = gdata_youtube_video_get_keywords (data->video);
tags2 = gdata_youtube_video_get_keywords (data->updated_video);
g_assert_cmpuint (g_strv_length ((gchar**) tags2), ==, g_strv_length ((gchar**) tags));
g_assert_cmpstr (tags2[0], ==, tags[0]);
g_assert_cmpstr (tags2[1], ==, tags[1]);
g_assert_cmpstr (tags2[2], ==, tags[2]);
gdata_mock_server_end_trace (mock_server);
} | false | false | false | false | false | 0 |
ZopfliBlockSplitSimple(const unsigned char* in,
size_t instart, size_t inend,
size_t blocksize,
size_t** splitpoints, size_t* npoints) {
size_t i = instart;
while (i < inend) {
ZOPFLI_APPEND_DATA(i, splitpoints, npoints);
i += blocksize;
}
(void)in;
} | false | false | false | false | false | 0 |
deviceinfo_free(gpointer user_data)
{
struct deviceinfo *d = user_data;
if (d->attioid > 0)
btd_device_remove_attio_callback(d->dev, d->attioid);
if (d->attrib != NULL)
g_attrib_unref(d->attrib);
g_slist_free_full(d->chars, g_free);
btd_device_unref(d->dev);
g_free(d->svc_range);
g_free(d);
} | false | false | false | false | false | 0 |
nmain_menu ()
{
nnumbers = 2;
nmenu = 8;
menu[0].text = "START GAME";
menu[0].func = start;
menu[1].text = playertext;
menu[1].func = playerchange;
minim[0].x = XPOSITION (1);
minim[0].y = YPOSITION (1);
minim[0].line = 1;
minim[0].number = &nrockets;
minim[0].max = 5;
minim[0].min = 1;
minim[0].func = playerchange;
maxim[0].x = XPOSITION (1) + 8 * 2;
maxim[0].y = YPOSITION (1);
maxim[0].line = 1;
maxim[0].number = &nrockets;
maxim[0].max = 5;
maxim[0].min = 1;
maxim[0].func = playerchange;
playerchange ();
levelchange ();
menu[2].text = leveltext;
menu[2].func = playerchange;
minim[1].x = XPOSITION (2) + 7 * 7;
minim[1].y = YPOSITION (2);
minim[1].line = 2;
minim[1].number = &lastlevel;
minim[1].max = maxlevel;
minim[1].min = 0;
minim[1].func = levelchange;
maxim[1].x = XPOSITION (2) + 11 * 7;
maxim[1].y = YPOSITION (2);
maxim[1].line = 2;
maxim[1].number = &lastlevel;
maxim[1].max = maxlevel;
maxim[1].min = 0;
maxim[1].func = levelchange;
nnumbers = 2;
menu[3].text = "CONTROL";
menu[3].func = change_menu;
menu[4].text = "GAME MODE";
menu[4].func = change_mode;
menu[5].text = "DIFFICULTY";
menu[5].func = change_obtiznost;
#ifdef SOUND
menu[6].text = ssound ? "SOUND ON" : (sndinit ? "SOUND OFF" : "SOUND OFF-NOT INITIALIZED");
#else
menu[6].text = "SOUND OFF(NOT AVAIABLE)";
#endif
menu[6].func = setsound;
menu[7].text = "QUIT";
menu[7].func = quit;
selected = 0;
fit_selector ();
} | false | false | false | false | false | 0 |
f_93 (anairiats_rec_12 arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp399) ;
ATSlocal (anairiats_rec_1, tmp400) ;
ATSlocal (ats_ptr_type, tmp401) ;
ATSlocal (ats_ptr_type, tmp402) ;
ATSlocal (anairiats_rec_11, tmp403) ;
ATSlocal (ats_ptr_type, tmp404) ;
ATSlocal (ats_ptr_type, tmp405) ;
ATSlocal (ats_int_type, tmp406) ;
ATSlocal (ats_int_type, tmp407) ;
__ats_lab_f_93:
tmp400 = ats_select_mac(arg0, atslab_0) ;
tmp401 = ats_select_mac(arg0, atslab_1) ;
tmp402 = ats_select_mac(tmp400, atslab_1) ;
tmp403 = loop_89 (tmp401, 0, tmp402) ;
tmp405 = ats_select_mac(tmp403, atslab_1) ;
tmp404 = ATS_2d0_2e2_2e11_2contrib_2parcomb_2SATS_2posloc_2esats__location_make (tmp402, tmp405) ;
tmp407 = ats_select_mac(tmp403, atslab_0) ;
tmp406 = atspre_neg_int (tmp407) ;
tmp399 = token_int_make_5 (tmp404, tmp406) ;
return (tmp399) ;
} | false | false | false | false | false | 0 |
CloseIntoRel(QueryDesc *queryDesc)
{
EState *estate = queryDesc->estate;
/* OpenIntoRel might never have gotten called */
if (estate->es_into_relation_descriptor)
{
/* If we skipped using WAL, must heap_sync before commit */
if (!estate->es_into_relation_use_wal)
heap_sync(estate->es_into_relation_descriptor);
/* close rel, but keep lock until commit */
heap_close(estate->es_into_relation_descriptor, NoLock);
estate->es_into_relation_descriptor = NULL;
}
} | false | false | false | false | false | 0 |
update_tabs_visibility (GeditNotebook *notebook,
gboolean before_inserting)
{
gboolean show_tabs;
switch (notebook->priv->show_tabs_mode)
{
case GEDIT_NOTEBOOK_SHOW_TABS_NEVER:
show_tabs = FALSE;
break;
case GEDIT_NOTEBOOK_SHOW_TABS_AUTO:
{
guint num;
num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
if (before_inserting)
++num;
show_tabs = num > 1;
}
break;
case GEDIT_NOTEBOOK_SHOW_TABS_ALWAYS:
default:
show_tabs = TRUE;
break;
}
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), show_tabs);
} | false | false | false | false | false | 0 |
schedule()
{
Ulong stime;
long interval = 0;
char *proc;
evptr new;
int procidx = 2;
if (targc != 3)
{
if (targc != 4 || targv[0][0] != 'e')
{
rsimerror(filename, lineno, "Missing time and/or procedure\n" );
return(0);
}
}
else if (targc == 3)
{
/* Note that "cancel" and "get" don't differentiate between */
/* "every" and "at" commands. */
if (!strcmp(targv[1], "cancel"))
{
short schedidx = atoi(targv[2]);
/* Remove the scheduled event */
DequeueScheduled(schedidx);
return(0);
}
else if (!strcmp(targv[1], "get"))
{
evptr ev;
short schedidx = atoi(targv[2]);
ev = FindScheduled(schedidx);
if (ev)
lprintf(stdout, "%s\n", (char *)ev->enode);
return(0);
}
}
stime = ns2d(atof(targv[1]));
if (targv[0][0] == 'e') /* "every" command */
{
interval = (long)stime;
if (targc == 4)
{
procidx++;
stime = ns2d(atof(targv[2])); /* Start at stated time */
if (targv[2][0] == '+')
stime += cur_delta; /* Relative to "now" */
}
else
stime += cur_delta; /* Schedule <interval> from now */
}
else if (targv[1][0] == '+')
stime += cur_delta; /* Time relative to "now" */
if (stime < cur_delta)
{
rsimerror(filename, lineno, "%s: invalid time\n", targv[1]);
return(0);
}
proc = strdup(targv[procidx]);
/* Create a new event */
new = EnqueueOther(TIMED_EV, stime);
new->enode = (nptr)proc;
new->delay = interval;
new->rtime = scheduletag;
#ifdef TCL_IRSIM
Tcl_SetObjResult(irsiminterp, Tcl_NewIntObj((int)scheduletag++));
#endif
/* Due to limited handling of return values, the non-Tcl version */
/* doesn't record scheduled event numbers. */
return (0);
} | false | false | false | false | false | 0 |
aui_service_dialog_finalize(GObject *object) {
AuiServiceDialog *d = AUI_SERVICE_DIALOG(object);
if (d->priv->domain_pulse_timeout > 0)
g_source_remove(d->priv->domain_pulse_timeout);
if (d->priv->service_pulse_timeout > 0)
g_source_remove(d->priv->service_pulse_timeout);
if (d->priv->start_idle > 0)
g_source_remove(d->priv->start_idle);
g_free(d->priv->host_name);
g_free(d->priv->domain);
g_free(d->priv->service_name);
avahi_string_list_free(d->priv->txt_data);
g_strfreev(d->priv->browse_service_types);
if (d->priv->domain_browser)
avahi_domain_browser_free(d->priv->domain_browser);
if (d->priv->resolver)
avahi_service_resolver_free(d->priv->resolver);
if (d->priv->browsers) {
AvahiServiceBrowser **sb;
for (sb = d->priv->browsers; *sb; sb++)
avahi_service_browser_free(*sb);
g_free(d->priv->browsers);
}
if (d->priv->client)
avahi_client_free(d->priv->client);
if (d->priv->glib_poll)
avahi_glib_poll_free(d->priv->glib_poll);
if (d->priv->service_list_store)
g_object_unref(d->priv->service_list_store);
if (d->priv->domain_list_store)
g_object_unref(d->priv->domain_list_store);
if (d->priv->service_type_names)
g_hash_table_unref (d->priv->service_type_names);
g_free(d->priv);
d->priv = NULL;
G_OBJECT_CLASS(aui_service_dialog_parent_class)->finalize(object);
} | false | false | false | false | false | 0 |
keyctl_join_session_keyring(const char __user *_name)
{
char *name;
long ret;
/* fetch the name from userspace */
name = NULL;
if (_name) {
name = strndup_user(_name, KEY_MAX_DESC_SIZE);
if (IS_ERR(name)) {
ret = PTR_ERR(name);
goto error;
}
ret = -EPERM;
if (name[0] == '.')
goto error_name;
}
/* join the session */
ret = join_session_keyring(name);
error_name:
kfree(name);
error:
return ret;
} | false | false | false | false | false | 0 |
vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
{
info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
info->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
info->port = PORT_FIBRE;
info->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(dev)) {
ethtool_cmd_speed_set(info, SPEED_10000);
info->duplex = DUPLEX_FULL;
} else {
ethtool_cmd_speed_set(info, SPEED_UNKNOWN);
info->duplex = DUPLEX_UNKNOWN;
}
info->autoneg = AUTONEG_DISABLE;
return 0;
} | false | false | false | false | false | 0 |
ParseTextureChunk(D3DS::Texture* pcOut)
{
ASSIMP_3DS_BEGIN_CHUNK();
// get chunk type
switch (chunk.Flag)
{
case Discreet3DS::CHUNK_MAPFILE:
{
// The material name string is already zero-terminated, but we need to be sure ...
const char* sz = (const char*)stream->GetPtr();
unsigned int cnt = 0;
while (stream->GetI1())
++cnt;
pcOut->mMapName = std::string(sz,cnt);
}
break;
case Discreet3DS::CHUNK_PERCENTF:
// Manually parse the blend factor
pcOut->mTextureBlend = stream->GetF4();
break;
case Discreet3DS::CHUNK_PERCENTW:
// Manually parse the blend factor
pcOut->mTextureBlend = (float)((uint16_t)stream->GetI2()) / 100.0f;
break;
case Discreet3DS::CHUNK_MAT_MAP_USCALE:
// Texture coordinate scaling in the U direction
pcOut->mScaleU = stream->GetF4();
if (0.0f == pcOut->mScaleU)
{
DefaultLogger::get()->warn("Texture coordinate scaling in the x direction is zero. Assuming 1.");
pcOut->mScaleU = 1.0f;
}
break;
case Discreet3DS::CHUNK_MAT_MAP_VSCALE:
// Texture coordinate scaling in the V direction
pcOut->mScaleV = stream->GetF4();
if (0.0f == pcOut->mScaleV)
{
DefaultLogger::get()->warn("Texture coordinate scaling in the y direction is zero. Assuming 1.");
pcOut->mScaleV = 1.0f;
}
break;
case Discreet3DS::CHUNK_MAT_MAP_UOFFSET:
// Texture coordinate offset in the U direction
pcOut->mOffsetU = -stream->GetF4();
break;
case Discreet3DS::CHUNK_MAT_MAP_VOFFSET:
// Texture coordinate offset in the V direction
pcOut->mOffsetV = stream->GetF4();
break;
case Discreet3DS::CHUNK_MAT_MAP_ANG:
// Texture coordinate rotation, CCW in DEGREES
pcOut->mRotation = -AI_DEG_TO_RAD( stream->GetF4() );
break;
case Discreet3DS::CHUNK_MAT_MAP_TILING:
{
const uint16_t iFlags = stream->GetI2();
// Get the mapping mode (for both axes)
if (iFlags & 0x2u)
pcOut->mMapMode = aiTextureMapMode_Mirror;
else if (iFlags & 0x10u)
pcOut->mMapMode = aiTextureMapMode_Decal;
// wrapping in all remaining cases
else pcOut->mMapMode = aiTextureMapMode_Wrap;
}
break;
};
ASSIMP_3DS_END_CHUNK();
} | false | false | false | false | false | 0 |
explain_buffer_errno_shmctl_explanation(explain_string_buffer_t *sb, int errnum,
const char *syscall_name, int shmid, int command, struct shmid_ds *data)
{
/*
* http://www.opengroup.org/onlinepubs/009695399/functions/shmctl.html
*/
switch (errnum)
{
case EFAULT:
if (!data)
explain_buffer_is_the_null_pointer(sb, "data");
else
explain_buffer_efault(sb, "data");
break;
#ifdef EIDRM
case EIDRM:
explain_buffer_gettext
(
sb,
/*
* xgettext: This erro rmessage is used to describe the cause of an
* EIDRM error reported by the shmctl(2) system call, in the case
* where the shmid refers to a removed identifier.
*/
i18n("shmid refers to a removed identifier")
);
break;
#endif
case EINVAL:
/*
* 1. shmid is not a valid identifier; or
* 2. command is not a valid command; or
* 3. for a SHM_STAT operation, the index value specified in
* shmid referred to an array slot that is currently unused.
*/
switch (command)
{
#ifdef IPC_STAT
case IPC_STAT:
#endif
#ifdef IPC_SET
case IPC_SET:
#endif
#ifdef IPC_RMID
case IPC_RMID:
#endif
#ifdef IPC_INFO
case IPC_INFO:
#endif
#ifdef SHM_INFO
case SHM_INFO:
#endif
#ifdef SHM_STAT
case SHM_STAT:
#endif
#ifdef SHM_LOCK
case SHM_LOCK:
#endif
#ifdef SHM_UNLOCK
case SHM_UNLOCK:
#endif
break;
default:
explain_buffer_einval_vague(sb, "command");
break;
}
explain_buffer_einval_vague(sb, "data");
break;
case ENOMEM:
explain_buffer_enomem_kernel(sb);
break;
case EOVERFLOW:
explain_buffer_eoverflow(sb);
break;
case EACCES:
case EPERM:
#ifdef SHM_LOCK
if (command == SHM_LOCK || command == SHM_UNLOCK)
{
/*
* "In kernels before 2.6.9, SHM_LOCK or SHM_UNLOCK was specified,
* but the process was not privileged (Linux did not have the
* CAP_IPC_LOCK capability). Since Linux 2.6.9, this error can
* also occur if the RLIMIT_MEMLOCK is 0 and the caller is not
* privileged."
*/
explain_string_buffer_printf
(
sb,
/* FIXME: i18n */
"the process does not have %s lock privileges",
explain_translate_shared_memory_segment()
);
explain_buffer_dac_ipc_lock(sb);
}
#endif
{
struct shmid_ds xyz;
if (wrap_shmctl(shmid, IPC_STAT, &xyz) >= 0)
{
explain_buffer_eacces_shmat(sb, &xyz.shm_perm, 1);
break;
}
}
explain_buffer_eacces_shmat_vague(sb);
break;
default:
explain_buffer_errno_generic(sb, errnum, syscall_name);
break;
}
} | false | false | false | false | false | 0 |
login_finish(Pulse *conn, Ecore_Fd_Handler *fdh)
{
Pulse_Tag *tag;
tag = calloc(1, sizeof(Pulse_Tag));
tag->dsize = 2 * PA_TAG_SIZE_U32; /* tag_simple_init */
proplist_init(tag);
DBG("prep %zu bytes", tag->dsize);
tag->data = malloc(tag->dsize);
tag_simple_init(conn, tag, PA_COMMAND_SET_CLIENT_NAME, PA_TAG_U32);
tag_proplist(tag);
tag_finish(tag);
msg_send_creds(conn, tag);
conn->state++;
if (msg_send(conn, tag))
ecore_main_fd_handler_active_set(fdh, ECORE_FD_READ);
else
conn->oq = eina_list_append(conn->oq, tag);
} | false | false | false | false | false | 0 |
update_pool_references(JCR *jcr, B_DB *db, POOL *pool)
{
POOL_DBR pr;
if (!pool->RecyclePool && !pool->ScratchPool) {
return 1;
}
memset(&pr, 0, sizeof(POOL_DBR));
bstrncpy(pr.Name, pool->name(), sizeof(pr.Name));
if (!db_get_pool_record(jcr, db, &pr)) {
return -1; /* not exists in database */
}
set_pooldbr_from_poolres(&pr, pool, POOL_OP_UPDATE);
if (!set_pooldbr_references(jcr, db, &pr, pool)) {
return -1; /* error */
}
if (!db_update_pool_record(jcr, db, &pr)) {
return -1; /* error */
}
return 1;
} | false | false | false | false | false | 0 |
naturalsize (int &w, int &h) const {
h = m_font->get_height();
w = 0;
const char * translation = _(m_text.c_str());
int len = strlen(translation);
int monoWidth = m_font->get_width(sampleChar);
for (int i = 0; i<len; i++) {
if (monoChars.empty() || monoChars.find_first_of(translation[i]) !=
std::string::npos) {
w += monoWidth;
} else {
w += m_font->get_width(translation[i]);
}
}
}
}} | false | false | false | false | false | 0 |
parport_uss720_write_control(struct parport *pp, unsigned char d)
{
struct parport_uss720_private *priv = pp->private_data;
d = (d & 0xf) | (priv->reg[1] & 0xf0);
if (set_1284_register(pp, 2, d, GFP_KERNEL))
return;
priv->reg[1] = d;
} | false | false | false | false | false | 0 |
ensure_fake_uptodate(command_t *cmd)
{
/* FIXME: could do the stat/touch here, but nah... */
char const *touch_args[3];
if (cmd->mode == MODE_INSTALL) {
return 0;
}
if (!cmd->fake_output_name) {
return 0;
}
touch_args[0] = "touch";
touch_args[1] = cmd->fake_output_name;
touch_args[2] = NULL;
return external_spawn(cmd, "touch", touch_args);
} | false | false | false | false | false | 0 |
print_multi_union_pw_aff_isl(
__isl_take isl_printer *p, __isl_keep isl_multi_union_pw_aff *mupa)
{
struct isl_print_space_data data = { 0 };
isl_space *space;
space = isl_multi_union_pw_aff_get_space(mupa);
if (isl_space_dim(space, isl_dim_param) > 0) {
struct isl_print_space_data space_data = { 0 };
p = print_tuple(space, p, isl_dim_param, &space_data);
p = isl_printer_print_str(p, s_to[0]);
}
data.print_dim = &print_union_pw_aff_dim;
data.user = mupa;
p = print_space(space, p, 0, &data);
isl_space_free(space);
return p;
} | false | false | false | false | false | 0 |
distribute_stop(void)
#else
void
distribute_stop()
#endif
{
int i;
struct client_command cc;
/*
* Only send one stop to the clients. Each client will
* send stop to the master, but the master only needs
* to distribute the first stop. Without this, the
* master may distribute too many stops and overflow
* the socket buffer on the client.
*/
if(sent_stop)
{
if(mdebug)
{
s_count++;
printf("Master not send stop %d\n",s_count);
}
return;
}
bzero(&cc,sizeof(struct client_command));
cc.c_command = R_STOP_FLAG;
cc.c_stop_flag = 1;
for(i=0;i<num_child;i++)
{
cc.c_client_number = (int)i;
if(mdebug)
printf("Master distributing stop flag to child %d\n",i);
master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
}
sent_stop=1;
} | false | false | false | false | false | 0 |
chick_fidget (edict_t *self)
{
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
return;
if (random() <= 0.3)
self->monsterinfo.currentmove = &chick_move_fidget;
} | false | false | false | false | false | 0 |
decode_ftime(uint8_t *buf)
{
int raw;
struct tm datetime;
raw = (int) lha_decode_uint32(buf);
if (raw == 0) {
return 0;
}
// Deconstruct the contents of the MS-DOS time value and populate the
// 'datetime' structure. Note that 'mktime' generates a timestamp for
// the local time zone: this is unfortunate, but probably the best
// that can be done, due to the limited data stored in MS-DOS time
// values.
memset(&datetime, 0, sizeof(struct tm));
datetime.tm_sec = (raw << 1) & 0x3e;
datetime.tm_min = (raw >> 5) & 0x3f;
datetime.tm_hour = (raw >> 11) & 0x1f;
datetime.tm_mday = (raw >> 16) & 0x1f;
datetime.tm_mon = ((raw >> 21) & 0xf) - 1;
datetime.tm_year = 80 + ((raw >> 25) & 0x7f);
datetime.tm_wday = 0;
datetime.tm_yday = 0;
datetime.tm_isdst = -1;
return (unsigned int) mktime(&datetime);
} | false | false | false | false | false | 0 |
clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
int cport, cfd;
char cip[128];
clusterLink *link;
REDIS_NOTUSED(el);
REDIS_NOTUSED(mask);
REDIS_NOTUSED(privdata);
cfd = anetTcpAccept(server.neterr, fd, cip, &cport);
if (cfd == AE_ERR) {
redisLog(REDIS_VERBOSE,"Accepting cluster node: %s", server.neterr);
return;
}
redisLog(REDIS_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
/* We need to create a temporary node in order to read the incoming
* packet in a valid contest. This node will be released once we
* read the packet and reply. */
link = createClusterLink(NULL);
link->fd = cfd;
aeCreateFileEvent(server.el,cfd,AE_READABLE,clusterReadHandler,link);
} | false | false | false | false | false | 0 |
on_end_element(GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data, GError **error) {
debug_printf("on_end_element %s\n", element_name);
if (strcmp(element_name, "fragment") == 0) {
}
else if (strcmp(element_name, "vertex") == 0) {
}
else {
return;
}
parse_data *data = user_data;
data->buffer[data->length] = 0;
if (data->error) {
}
else {
debug_printf("%s\n", data->buffer);
handle_element(data, element_name, data->buffer);
}
if (data->filter) {
g_free(data->filter);
data->filter = NULL;
}
} | false | false | false | false | false | 0 |
make_inheritable(PyObject *py_fds_to_keep, int errpipe_write)
{
Py_ssize_t i, len;
len = PySequence_Length(py_fds_to_keep);
for (i = 0; i < len; ++i) {
PyObject* fdobj = PySequence_Fast_GET_ITEM(py_fds_to_keep, i);
long fd = PyLong_AsLong(fdobj);
assert(!PyErr_Occurred());
assert(0 <= fd && fd <= INT_MAX);
if (fd == errpipe_write) {
/* errpipe_write is part of py_fds_to_keep. It must be closed at
exec(), but kept open in the child process until exec() is
called. */
continue;
}
if (_Py_set_inheritable((int)fd, 1, NULL) < 0)
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.