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 |
|---|---|---|---|---|---|---|
IsPoint (void) const
{
// Return whether triangle covers only one vertex
if (!R3Contains(v[0]->Position(), v[1]->Position())) return FALSE;
if (!R3Contains(v[0]->Position(), v[2]->Position())) return FALSE;
return TRUE;
} | false | false | false | false | false | 0 |
ArgusClientTimeout ()
{
struct timeval tvpbuf, *tvp = &tvpbuf;
gettimeofday(tvp, 0L);
ArgusAdjustGlobalTime (tvp);
if (Sflag || Cflag || Bflag)
RaProcessArray (RaBinMergeArray, ARGUS_STATUS);
#ifdef ARGUSDEBUG
if ((tvp->tv_sec % 60) == 0) {
if (ArgusClientLastTimeout.tv_sec < tvp->tv_sec) {
struct RaBinStruct *bin = NULL;
int i, qcount = 0, hcount = 0;
for (i = 0; i < RaBinCount; i++) {
if ((bin = RaBinMergeArray[i]) != NULL) {
if (bin->queue && (bin->queue->count > 0))
qcount += bin->queue->count;
if (bin->hashtable.count > 0)
hcount += bin->hashtable.count;
}
}
ArgusDebug (2, "ArgusClientTimeout: RaBinCount %d RaHoldTime %d Hash %d HashHdrs %d Queue %d\n",
RaBinCount, RaHoldTime, hcount, RaAllocHashTableHeaders, qcount);
}
ArgusClientLastTimeout = *tvp;
}
ArgusDebug (7, "ArgusClientTimeout: done\n");
#endif
} | false | false | false | false | false | 0 |
_mic_start(struct cosm_device *cdev, int id)
{
struct mic_device *mdev = cosmdev_to_mdev(cdev);
int rc;
mic_bootparam_init(mdev);
mdev->dma_mbdev = mbus_register_device(&mdev->pdev->dev,
MBUS_DEV_DMA_HOST, &mic_dma_ops,
&mbus_hw_ops, id, mdev->mmio.va);
if (IS_ERR(mdev->dma_mbdev)) {
rc = PTR_ERR(mdev->dma_mbdev);
goto unlock_ret;
}
if (!mic_request_dma_chans(mdev)) {
rc = -ENODEV;
goto dma_remove;
}
mdev->scdev = scif_register_device(&mdev->pdev->dev, MIC_SCIF_DEV,
&__mic_dma_ops, &scif_hw_ops,
id + 1, 0, &mdev->mmio,
&mdev->aper, mdev->dp, NULL,
mdev->dma_ch, mdev->num_dma_ch,
true);
if (IS_ERR(mdev->scdev)) {
rc = PTR_ERR(mdev->scdev);
goto dma_free;
}
rc = mdev->ops->load_mic_fw(mdev, NULL);
if (rc)
goto scif_remove;
mic_smpt_restore(mdev);
mic_intr_restore(mdev);
mdev->intr_ops->enable_interrupts(mdev);
mdev->ops->write_spad(mdev, MIC_DPLO_SPAD, mdev->dp_dma_addr);
mdev->ops->write_spad(mdev, MIC_DPHI_SPAD, mdev->dp_dma_addr >> 32);
mdev->ops->send_firmware_intr(mdev);
goto unlock_ret;
scif_remove:
scif_unregister_device(mdev->scdev);
dma_free:
mic_free_dma_chans(mdev);
dma_remove:
mbus_unregister_device(mdev->dma_mbdev);
unlock_ret:
return rc;
} | false | false | false | false | false | 0 |
k5_json_number_create(long long number, k5_json_number *val_out)
{
k5_json_number n;
*val_out = NULL;
n = alloc_value(&number_type, sizeof(long long));
if (n == NULL)
return ENOMEM;
*((long long *)n) = number;
*val_out = n;
return 0;
} | false | false | false | false | false | 0 |
deref_check_access(Slapi_PBlock *pb, const Slapi_Entry *ent, const char *entdn,
const char **attrs, char ***retattrs, int rights)
{
Slapi_Entry *etest = NULL;
const char *attrname;
/* if there is no entry, create a dummy entry - this can save a search
on an entry we should not be allowed to search */
if (!ent) {
etest = slapi_entry_alloc();
slapi_sdn_set_dn_byref(slapi_entry_get_sdn(etest), entdn);
} else {
etest = (Slapi_Entry *)ent;
}
*retattrs = NULL;
for (attrname = *attrs; attrname; attrname = *(++attrs)) {
/* first, check access control - see if client can read the requested attribute */
int ret = slapi_access_allowed(pb, etest, (char *)attrname, NULL, rights);
if (ret != LDAP_SUCCESS) {
slapi_log_error(SLAPI_LOG_PLUGIN, DEREF_PLUGIN_SUBSYSTEM,
"The client does not have permission to read attribute %s in entry %s\n",
attrname, slapi_entry_get_dn_const(etest));
} else {
slapi_ch_array_add(retattrs, (char *)attrname); /* retattrs and attrs share pointer to attrname */
}
}
if (ent != etest) {
slapi_entry_free(etest);
}
/* see if we had at least one attribute that could be accessed */
return *retattrs == NULL ? LDAP_INSUFFICIENT_ACCESS : LDAP_SUCCESS;
} | false | false | false | false | false | 0 |
gnome_sort_debug(data array[], int len, STAT *stat) {
int pos = 0; // position of the gnome
data tmp; // temporary variable used to swap elements
stat->space++;
stat->allo++;
while (pos < len-1) { // while the gnome has not reached the end
if (pos < 0 || array[pos] <= array[pos+1])
pos++;
else {
tmp = array[pos];
array[pos] = array[pos+1];
array[pos+1] = tmp;
pos--;
stat->swap++;
}
stat->comp++;
}
} | false | false | false | false | false | 0 |
gt_progressbar_start(const unsigned long long *current_computation,
unsigned long long number_of_computations)
{
computation_counter = current_computation;
last_computation = number_of_computations;
computed_eta = 0;
gt_assert(*current_computation == 0);
computation_start = gt_xtime(NULL);
set_window_size();
if (gt_process_is_foreground())
refresh_progressbar();
/* register signal handlers */
(void) gt_xsignal(SIGALRM, update_progressbar); /* the timer */
(void) gt_xsignal(SIGWINCH, gt_sig_winch); /* window resizing */
(void) alarm(UPDATE_INTERVAL); /* set alarm */
} | false | false | false | false | false | 0 |
f_confirm(argvars, rettv)
typval_T *argvars UNUSED;
typval_T *rettv UNUSED;
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
char_u *message;
char_u *buttons = NULL;
char_u buf[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
int def = 1;
int type = VIM_GENERIC;
char_u *typestr;
int error = FALSE;
message = get_tv_string_chk(&argvars[0]);
if (message == NULL)
error = TRUE;
if (argvars[1].v_type != VAR_UNKNOWN)
{
buttons = get_tv_string_buf_chk(&argvars[1], buf);
if (buttons == NULL)
error = TRUE;
if (argvars[2].v_type != VAR_UNKNOWN)
{
def = get_tv_number_chk(&argvars[2], &error);
if (argvars[3].v_type != VAR_UNKNOWN)
{
typestr = get_tv_string_buf_chk(&argvars[3], buf2);
if (typestr == NULL)
error = TRUE;
else
{
switch (TOUPPER_ASC(*typestr))
{
case 'E': type = VIM_ERROR; break;
case 'Q': type = VIM_QUESTION; break;
case 'I': type = VIM_INFO; break;
case 'W': type = VIM_WARNING; break;
case 'G': type = VIM_GENERIC; break;
}
}
}
}
}
if (buttons == NULL || *buttons == NUL)
buttons = (char_u *)_("&Ok");
if (!error)
rettv->vval.v_number = do_dialog(type, NULL, message, buttons,
def, NULL, FALSE);
#endif
} | false | false | false | false | false | 0 |
pair() const
{
QStringList pair;
pair.append( mMail->text() );
switch ( mPolicy->currentIndex() ) {
case 0:
pair.append( "ACT_ALWAYS_ACCEPT" );
break;
case 1:
pair.append( "ACT_ALWAYS_REJECT" );
break;
case 2:
pair.append( "ACT_REJECT_IF_CONFLICTS" );
break;
case 3:
pair.append( "ACT_MANUAL_IF_CONFLICTS" );
break;
case 4:
pair.append( "ACT_MANUAL" );
break;
}
return pair;
} | false | false | false | false | false | 0 |
gf_bbox_equal(GF_BBox *b1, GF_BBox *b2)
{
return (gf_vec_equal(b1->min_edge, b2->min_edge) && gf_vec_equal(b1->max_edge, b2->max_edge));
} | false | false | false | false | false | 0 |
atoi255(const char *s) {
int ans;
if (*s == '\0')
return(-1);
for (ans = 0; ISDIGIT(*s); s++) {
ans *= 10;
ans += *s - '0';
if (ans > 255)
return(-1);
}
if (*s != '\0')
return(-1);
return(ans);
} | false | false | false | false | false | 0 |
AllocElem(cmsContext ContextID, _cmsDICelem* e, cmsUInt32Number Count)
{
e->Offsets = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number));
if (e->Offsets == NULL) return FALSE;
e->Sizes = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number));
if (e->Sizes == NULL) {
_cmsFree(ContextID, e -> Offsets);
return FALSE;
}
e ->ContextID = ContextID;
return TRUE;
} | false | false | false | false | false | 0 |
write_hex(unsigned long long N) {
// Zero is a special case.
if (N == 0)
return *this << '0';
char NumberBuffer[20];
char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
char *CurPtr = EndPtr;
while (N) {
uintptr_t x = N % 16;
*--CurPtr = (x < 10 ? '0' + x : 'a' + x - 10);
N /= 16;
}
return write(CurPtr, EndPtr-CurPtr);
} | false | false | false | false | false | 0 |
p54_wake_queues(struct p54_common *priv)
{
unsigned long flags;
unsigned int i;
if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED))
return ;
p54_tx_pending(priv);
spin_lock_irqsave(&priv->tx_stats_lock, flags);
for (i = 0; i < priv->hw->queues; i++) {
if (priv->tx_stats[i + P54_QUEUE_DATA].len <
priv->tx_stats[i + P54_QUEUE_DATA].limit)
ieee80211_wake_queue(priv->hw, i);
}
spin_unlock_irqrestore(&priv->tx_stats_lock, flags);
} | false | false | false | false | false | 0 |
gethomedir(int *l)
{
static char *home = NULL;
static short hlen = 0;
if(home == NULL){
char buf[NLINE];
#ifndef _WINDOWS
strncpy(buf, "~", sizeof(buf));
buf[sizeof(buf)-1] = '\0';
fixpath(buf, sizeof(buf)); /* let fixpath do the work! */
#else /* _WINDOWS */
if(Pmaster && Pmaster->home_dir)
snprintf(buf, sizeof(buf), "%s", Pmaster->home_dir);
else
snprintf(buf, sizeof(buf), "%c:\\", _getdrive() + 'A' - 1);
#endif /* _WINDOWS */
hlen = strlen(buf);
if((home = (char *)malloc((hlen + 1) * sizeof(char))) == NULL){
emlwrite("Problem allocating space for home dir", NULL);
return(0);
}
strncpy(home, buf, hlen);
home[hlen] = '\0';
}
if(l)
*l = hlen;
return(home);
} | true | true | false | false | false | 1 |
insert(CAction &action)
{
m_actions.push_back( CActionPtr( static_cast<CAction*>( action.duplicate() )) );
} | false | false | false | false | false | 0 |
on_file_open (GtkAction *action,
GitgWindow *window)
{
if (window->priv->open_dialog)
{
gtk_window_present (GTK_WINDOW(window->priv->open_dialog));
return;
}
window->priv->open_dialog = gtk_file_chooser_dialog_new (_ ("Open git repository"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN,
GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(window->priv->open_dialog), TRUE);
g_object_add_weak_pointer (G_OBJECT(window->priv->open_dialog), (gpointer *)&(window->priv->open_dialog));
gtk_window_present (GTK_WINDOW(window->priv->open_dialog));
g_signal_connect (window->priv->open_dialog, "response", G_CALLBACK(on_open_dialog_response), window);
} | false | false | false | false | false | 0 |
sqliteBeginParse(Parse *pParse, int explainFlag){
sqlite *db = pParse->db;
int i;
pParse->explain = explainFlag;
if((db->flags & SQLITE_Initialized)==0 && db->init.busy==0 ){
int rc = sqliteInit(db, &pParse->zErrMsg);
if( rc!=SQLITE_OK ){
pParse->rc = rc;
pParse->nErr++;
}
}
for(i=0; i<db->nDb; i++){
DbClearProperty(db, i, DB_Locked);
if( !db->aDb[i].inTrans ){
DbClearProperty(db, i, DB_Cookie);
}
}
pParse->nVar = 0;
} | false | false | false | false | false | 0 |
sig_cs_writew(
struct sig_cs *b,
void *s,
uint16_t val,
unsigned long addr
)
{
unsigned int nr;
int (*func)(void *, uint16_t, unsigned long);
for (nr = 0; ; nr++) {
if (nr == b->nmembers) {
return 1;
}
if (b->member[nr].s == s) {
continue;
}
func = b->member[nr].f->writew;
if (func != 0 && func(b->member[nr].s, val, addr) == 0) {
return 0;
}
}
} | false | false | false | false | false | 0 |
GdipDeletePathIter (GpPathIterator *iterator)
{
if (!iterator)
return InvalidParameter;
if (iterator->path) {
GdipDeletePath (iterator->path);
iterator->path = NULL;
}
GdipFree (iterator);
return Ok;
} | false | false | false | false | false | 0 |
cb_entry_focus_out (GtkEntry *entry, G_GNUC_UNUSED GdkEvent *event, GOImageSelState *state)
{
char const *new_name = gtk_entry_get_text (entry);
if (new_name && *new_name && !go_doc_get_image (state->doc, new_name)) {
g_free (state->name);
state->name = g_strdup (new_name);
}
} | false | false | false | false | false | 0 |
rb_reg_mbclen2(c, re)
unsigned int c;
VALUE re;
{
int len;
if (!FL_TEST(re, KCODE_FIXED))
return mbclen(c);
kcode_set_option(re);
len = mbclen(c);
kcode_reset_option();
return len;
} | false | false | false | false | false | 0 |
dna_postop_init(Slapi_PBlock *pb)
{
int status = DNA_SUCCESS;
int addfn = SLAPI_PLUGIN_BE_TXN_POST_ADD_FN;
int delfn = SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN;
int modfn = SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN;
int mdnfn = SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN;
if (slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION,
SLAPI_PLUGIN_VERSION_01) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION,
(void *) &pdesc) != 0 ||
slapi_pblock_set(pb, addfn, (void *) dna_config_check_post_op) != 0 ||
slapi_pblock_set(pb, mdnfn, (void *) dna_config_check_post_op) != 0 ||
slapi_pblock_set(pb, delfn, (void *) dna_config_check_post_op) != 0 ||
slapi_pblock_set(pb, modfn, (void *) dna_config_check_post_op) != 0) {
slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
"dna_postop_init: failed to register plugin\n");
status = DNA_FAILURE;
}
return status;
} | false | false | false | false | false | 0 |
rebind(const TranslationMap & trans) {
_theFFZVertex = trans.translate(_theFFZVertex);
_theFFPVertex = trans.translate(_theFFPVertex);
_Z0 = trans.translate(_Z0);
_gamma = trans.translate(_gamma);
HwMEBase::rebind(trans);
} | false | false | false | false | false | 0 |
resource_alignment(struct resource *res)
{
switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
case IORESOURCE_SIZEALIGN:
return resource_size(res);
case IORESOURCE_STARTALIGN:
return res->start;
default:
return 0;
}
} | false | false | false | false | false | 0 |
GWEN_Inherit_MakeId(const char *typeName){
unsigned int i, j;
uint32_t result;
result=0;
j=strlen(typeName);
for (i=0; i<j; i++) {
uint32_t tmpResult;
unsigned char c;
tmpResult=result<<8;
c=((result>>24)&0xff);
result=tmpResult|c;
result^=(unsigned char)(typeName[i]);
}
DBG_VERBOUS(GWEN_LOGDOMAIN,
"Id for type \"%s\" is \"%08x\"",
typeName, result);
return result;
} | false | false | false | false | false | 0 |
PreCompile(void)
{
QCC_PR_ResetErrorScope();
qccClearHunk();
strcpy(qcc_gamedir, "");
qcchunk = malloc(qcchunksize=128*1024*1024);
while(!qcchunk && qcchunksize > 8*1024*1024)
{
qcchunksize /= 2;
qcchunk = malloc(qcchunksize);
}
qccalloced=0;
return !!qcchunk;
} | false | true | false | false | false | 1 |
gst_cogcolorspace_init (GstCogcolorspace * colorspace,
GstCogcolorspaceClass * klass)
{
GST_DEBUG ("gst_cogcolorspace_init");
colorspace->quality = DEFAULT_QUALITY;
} | false | false | false | false | false | 0 |
brightness_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int rc;
struct backlight_device *bd = to_backlight_device(dev);
unsigned long brightness;
rc = kstrtoul(buf, 0, &brightness);
if (rc)
return rc;
rc = -ENXIO;
mutex_lock(&bd->ops_lock);
if (bd->ops) {
if (brightness > bd->props.max_brightness)
rc = -EINVAL;
else {
pr_debug("set brightness to %lu\n", brightness);
bd->props.brightness = brightness;
backlight_update_status(bd);
rc = count;
}
}
mutex_unlock(&bd->ops_lock);
backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS);
return rc;
} | false | false | false | false | false | 0 |
repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
{
uint32_t mode = 0, content_offset = 0;
struct repo_dirent *src_dent;
src_dent = repo_read_dirent(revision, src);
if (src_dent != NULL) {
mode = src_dent->mode;
content_offset = src_dent->content_offset;
repo_write_dirent(dst, mode, content_offset, 0);
}
return mode;
} | false | false | false | false | false | 0 |
check_encoding_name(const char *name)
{
size_t i, n;
if (name == NULL)
return -1;
for (i = n = 0; name[i] != '\0'; i++) {
if (!enca_isname(name[i]))
return -1;
if (enca_isalnum(name[i]))
n++;
}
return n;
} | false | false | false | false | false | 0 |
folder_scan_close (struct _header_scan_state *s)
{
g_free (s->realbuf);
g_free (s->outbuf);
while (s->parts)
folder_pull_part (s);
if (s->fd != -1)
close (s->fd);
if (s->stream) {
g_object_unref (s->stream);
}
g_free (s);
} | false | false | false | false | false | 0 |
dav_fs_load_locknull_list(apr_pool_t *p, const char *dirpath,
dav_buffer *pbuf)
{
apr_finfo_t finfo;
apr_file_t *file = NULL;
dav_error *err = NULL;
apr_size_t amt;
apr_status_t rv;
dav_buffer_init(p, pbuf, dirpath);
if (pbuf->buf[pbuf->cur_len - 1] == '/')
pbuf->buf[--pbuf->cur_len] = '\0';
dav_buffer_place(p, pbuf, "/" DAV_FS_STATE_DIR "/" DAV_FS_LOCK_NULL_FILE);
/* reset this in case we leave w/o reading into the buffer */
pbuf->cur_len = 0;
if (apr_file_open(&file, pbuf->buf, APR_READ | APR_BINARY, APR_OS_DEFAULT,
p) != APR_SUCCESS) {
return NULL;
}
rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, file);
if (rv != APR_SUCCESS) {
err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Opened but could not stat file %s",
pbuf->buf));
goto loaderror;
}
if (finfo.size != (apr_size_t)finfo.size) {
err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
apr_psprintf(p,
"Opened but rejected huge file %s",
pbuf->buf));
goto loaderror;
}
amt = (apr_size_t)finfo.size;
dav_set_bufsize(p, pbuf, amt);
if ((rv = apr_file_read(file, pbuf->buf, &amt)) != APR_SUCCESS
|| amt != finfo.size) {
err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
apr_psprintf(p,
"Failure reading locknull file "
"for %s", dirpath));
/* just in case the caller disregards the returned error */
pbuf->cur_len = 0;
goto loaderror;
}
loaderror:
apr_file_close(file);
return err;
} | false | false | false | false | false | 0 |
setupParse()
{
if (_namespaces && !_namespacePrefixes)
_engine.setNamespaceStrategy(new NoNamespacePrefixesStrategy);
else if (_namespaces && _namespacePrefixes)
_engine.setNamespaceStrategy(new NamespacePrefixesStrategy);
else
_engine.setNamespaceStrategy(new NoNamespacesStrategy);
} | false | false | false | false | false | 0 |
w5100_writebuf_indirect(struct w5100_priv *priv,
u16 offset, u8 *buf, int len)
{
u16 addr = W5100_TX_MEM_START + (offset & W5100_TX_MEM_MASK);
unsigned long flags;
int i;
spin_lock_irqsave(&priv->reg_lock, flags);
w5100_write16_direct(priv, W5100_IDM_AR, addr);
mmiowb();
for (i = 0; i < len; i++, addr++) {
if (unlikely(addr > W5100_TX_MEM_END)) {
addr = W5100_TX_MEM_START;
w5100_write16_direct(priv, W5100_IDM_AR, addr);
mmiowb();
}
w5100_write_direct(priv, W5100_IDM_DR, *buf++);
}
mmiowb();
spin_unlock_irqrestore(&priv->reg_lock, flags);
} | false | false | false | false | false | 0 |
C3DSMeshFileLoader(ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs), Vertices(0), Indices(0), SmoothingGroups(0), TCoords(0),
CountVertices(0), CountFaces(0), CountTCoords(0), Mesh(0)
{
#ifdef _DEBUG
setDebugName("C3DSMeshFileLoader");
#endif
TransformationMatrix.makeIdentity();
if (FileSystem)
FileSystem->grab();
} | false | false | false | false | false | 0 |
isns_attr_list_scanner_get_pg(struct isns_attr_list_scanner *st)
{
isns_attr_t *attr, *next = NULL;
unsigned int pos = st->pos;
attr = st->orig_attrs.ial_data[st->pos++];
if (st->pgt_next_attr == ISNS_TAG_PG_TAG) {
isns_object_t *base = st->pgt_base_object;
if (ISNS_ATTR_IS_NIL(attr))
st->pgt_value = 0;
else if (ISNS_ATTR_IS_UINT32(attr))
st->pgt_value = attr->ia_value.iv_uint32;
else
return ISNS_INVALID_REGISTRATION;
if (ISNS_IS_PORTAL(base)
&& isns_portal_from_object(&st->pgt_portal_info,
ISNS_TAG_PORTAL_IP_ADDRESS,
ISNS_TAG_PORTAL_TCP_UDP_PORT,
base)) {
st->pgt_next_attr = ISNS_TAG_PG_ISCSI_NAME;
} else
if (ISNS_IS_ISCSI_NODE(base)
&& isns_object_get_string(base,
ISNS_TAG_ISCSI_NAME,
&st->pgt_iscsi_name)) {
st->pgt_next_attr = ISNS_TAG_PORTAL_IP_ADDRESS;
} else {
return ISNS_INTERNAL_ERROR;
}
/* Trailing PGT at end of list. Shrug. */
if (st->pos >= st->orig_attrs.ial_count)
return ISNS_NO_SUCH_ENTRY;
attr = st->orig_attrs.ial_data[st->pos++];
if (attr->ia_tag_id != st->pgt_next_attr) {
/* Some clients may do this; catch them so
* we can fix it. */
isns_error("Oops, client sends PGT followed by <%s>\n",
attr->ia_tag->it_name);
return ISNS_INVALID_REGISTRATION;
}
}
st->tmpl = &isns_iscsi_pg_template;
if (st->pgt_next_attr == ISNS_TAG_PG_ISCSI_NAME) {
isns_attr_list_append_attr(&st->keys, attr);
isns_portal_to_attr_list(&st->pgt_portal_info,
ISNS_TAG_PG_PORTAL_IP_ADDR,
ISNS_TAG_PG_PORTAL_TCP_UDP_PORT,
&st->keys);
} else
if (st->pgt_next_attr == ISNS_TAG_PG_PORTAL_IP_ADDR) {
if (st->pos >= st->orig_attrs.ial_count)
return ISNS_INVALID_REGISTRATION;
next = st->orig_attrs.ial_data[st->pos++];
if (next->ia_tag_id != ISNS_TAG_PORTAL_TCP_UDP_PORT)
return ISNS_INVALID_REGISTRATION;
isns_attr_list_append_string(&st->keys,
ISNS_TAG_PG_ISCSI_NAME,
st->pgt_iscsi_name);
isns_attr_list_append_attr(&st->keys, attr);
isns_attr_list_append_attr(&st->keys, next);
} else {
return ISNS_INTERNAL_ERROR;
}
isns_attr_list_append_uint32(&st->attrs,
ISNS_TAG_PG_TAG,
st->pgt_value);
/* Copy other PG attributes if present */
for (pos = st->pos; pos < st->orig_attrs.ial_count; ++pos) {
uint32_t tag;
attr = st->orig_attrs.ial_data[pos];
tag = attr->ia_tag_id;
/*
* Additional sets of PGTs and PG iSCSI Names to be
* associated to the registered Portal MAY follow.
*/
if (tag == ISNS_TAG_PG_TAG) {
st->pgt_next_attr = tag;
break;
}
if (tag == ISNS_TAG_PG_ISCSI_NAME
|| tag == ISNS_TAG_PG_PORTAL_IP_ADDR
|| tag == ISNS_TAG_PG_PORTAL_TCP_UDP_PORT
|| !isns_object_attr_valid(st->tmpl, tag))
break;
isns_attr_list_append_attr(&st->attrs, attr);
}
st->pos = pos;
return ISNS_SUCCESS;
} | false | false | false | false | false | 0 |
UpdateLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists,
bool has_prev, bool has_next)
{
emit updateLookupTable(Args2LookupTable(labels, candis, attrlists, has_prev, has_next));
} | false | false | false | false | false | 0 |
printFailureLocation( SourceLine sourceLine )
{
if ( !sourceLine.isValid() )
return;
m_stream << "line: " << sourceLine.lineNumber()
<< ' ' << sourceLine.fileName();
} | false | false | false | false | false | 0 |
allocate_positions (Genomicpos_T **pointers, Genomicpos_T **positions,
bool *overabundant, bool *inquery, int *counts, int *relevant_counts,
int oligospace) {
int totalcounts;
Genomicpos_T *p;
int overabundance_threshold;
int n, i;
n = 0;
for (i = 0; i < oligospace; i++) {
if (overabundant[i] == true) {
counts[i] = 0;
} else if (inquery[i] == false) {
counts[i] = 0;
} else if (counts[i] > 0) {
relevant_counts[n++] = counts[i];
}
}
totalcounts = 0;
if (n < OVERABUNDANCE_CHECK) {
for (i = 0; i < oligospace; i++) {
totalcounts += counts[i];
}
} else {
overabundance_threshold = Orderstat_int_pct_inplace(relevant_counts,n,OVERABUNDANCE_PCT);
debug1(printf("overabundance threshold is %d\n",overabundance_threshold));
if (overabundance_threshold < OVERABUNDANCE_MIN) {
overabundance_threshold = OVERABUNDANCE_MIN;
debug1(printf(" => resetting to %d\n",overabundance_threshold));
}
for (i = 0; i < oligospace; i++) {
if (counts[i] > overabundance_threshold) {
overabundant[i] = true;
counts[i] = 0;
} else {
totalcounts += counts[i];
}
}
}
if (totalcounts == 0) {
positions[0] = (Genomicpos_T *) NULL;
} else {
p = (Genomicpos_T *) CALLOC(totalcounts,sizeof(Genomicpos_T));
for (i = 0; i < oligospace; i++) {
positions[i] = p;
p += counts[i];
}
memcpy((void *) pointers,positions,oligospace*sizeof(Genomicpos_T *));
}
return totalcounts;
} | false | false | false | false | false | 0 |
tooltip_update (void)
{
if (!tooltip_widget_)
return;
// Get text for tooltip
std::string text = get_mailbox_status_text ();
// Put text in tooltip
gtk_widget_set_tooltip_text (tooltip_widget_, text.c_str());
} | false | false | false | false | false | 0 |
installServerCert(char *tokenName, char *certname)
{
SECStatus rv;
CERTCertificate *cert;
CERTCertTrust trust;
PK11SlotInfo *slot = PK11_FindSlotByName(tokenName);
/* need to decode der cert */
char *derCertBase64 = getParameter("dercert",getResourceString(DBT_DER_CERT));
CERTDERCerts *collectArgs = decodeDERCert(derCertBase64);
/* if slot can not be found, then certificate can not be added */
if (slot == NULL) {
errorRpt(GENERAL_FAILURE, getResourceString(DBT_NO_SLOT));
}
/* import just the first certificate */
{
CERTCertificate **retCerts;
unsigned int ncerts = 1;
PRBool keepCerts = PR_FALSE;
PRBool caOnly = PR_FALSE;
char *nickname = certname;
rv = CERT_ImportCerts(certdb, certUsageSSLServer,
ncerts, &collectArgs->rawCerts,
&retCerts, keepCerts,
caOnly, nickname);
if (rv != SECSuccess) {
goto bail;
}
cert = retCerts[0];
}
/*
* if the user didn't specify certificate name then
* Try using fields from the subject name as the certificate name
*/
if (!certname) {
certname = constructNameDesc(&cert->subject);
}
/* remove leading space in certificate name */
if (certname) {
while (isspace(*certname)) ++certname;
}
/* A server cert must have a matching private key in the keydb */
{
/*check to see if certificate has a matching private key under the key db*/
SECKEYPrivateKey *key = PK11_FindKeyByDERCert(slot, cert, NULL);
if (!key) {
PR_snprintf(line, sizeof(line), getResourceString(DBT_NO_PRIVATE_KEY_WHY), tokenName);
rpt_err(INCORRECT_USAGE,
getResourceString(DBT_NO_PRIVATE_KEY),
line,
NULL);
}
}
/* set thust bits */
memset((char *)&trust, 0, sizeof(trust));
trust.sslFlags = CERTDB_USER;;
cert->trust = &trust;
/* import certificate to the PKCS11 module */
rv = PK11_ImportCertForKeyToSlot(slot, cert, certname, PR_TRUE, 0);
bail:
if (rv != SECSuccess) {
PR_snprintf(line, sizeof(line), "%d:%s", PR_GetError(),
PR_ErrorToString(PR_GetError(), PR_LANGUAGE_EN));
/* if unable to import report error */
rpt_err(SYSTEM_ERROR,
getResourceString(DBT_INTERNAL_ERROR),
getResourceString(DBT_INSTALL_FAIL),
line);
}
} | false | false | false | false | false | 0 |
setAutoSaveSettings( const KConfigGroup & group,
bool saveWindowSize )
{
K_D(KMainWindow);
d->autoSaveSettings = true;
d->autoSaveGroup = group;
d->autoSaveWindowSize = saveWindowSize;
if (!saveWindowSize && d->sizeTimer) {
d->sizeTimer->stop();
}
// Now read the previously saved settings
applyMainWindowSettings(d->autoSaveGroup);
} | false | false | false | false | false | 0 |
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i < in_len; ++i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o + 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m && in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
break;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} | false | true | false | false | false | 1 |
calcMinMaxWidth()
{
#ifdef DEBUG_LAYOUT
qDebug("AutoTableLayout::calcMinMaxWidth");
#endif
fullRecalc();
int spanMaxWidth = calcEffectiveWidth();
int minWidth = 0;
int maxWidth = 0;
int maxPercent = 0;
int maxNonPercent = 0;
int remainingPercent = 100 * PERCENT_SCALE_FACTOR;
for ( int i = 0; i < layoutStruct.size(); i++ ) {
minWidth += layoutStruct[i].effMinWidth;
maxWidth += layoutStruct[i].effMaxWidth;
if ( layoutStruct[i].effWidth.isPercent() ) {
int percent = qMin(layoutStruct[i].effWidth.rawValue(), remainingPercent);
int pw = ( layoutStruct[i].effMaxWidth * 100 * PERCENT_SCALE_FACTOR) / qMax(percent, 1);
remainingPercent -= percent;
maxPercent = qMax( pw, maxPercent );
} else {
maxNonPercent += layoutStruct[i].effMaxWidth;
}
}
if (shouldScaleColumns(table)) {
maxNonPercent = (maxNonPercent * 100 * PERCENT_SCALE_FACTOR) / qMax(remainingPercent, 1);
maxWidth = qMax( maxNonPercent, maxWidth );
maxWidth = qMax( maxWidth, maxPercent );
}
maxWidth = qMax( maxWidth, spanMaxWidth );
int bs = table->bordersPaddingAndSpacing();
minWidth += bs;
maxWidth += bs;
Length tw = table->style()->width();
if ( tw.isFixed() && tw.isPositive() ) {
int width = table->calcBoxWidth(tw.value());
minWidth = qMax( minWidth, width );
maxWidth = minWidth;
}
table->m_maxWidth = qMin(maxWidth, 0x7fff);
table->m_minWidth = qMin(minWidth, 0x7fff);
#ifdef DEBUG_LAYOUT
qDebug(" minWidth=%d, maxWidth=%d", table->m_minWidth, table->m_maxWidth );
#endif
} | false | false | false | false | false | 0 |
source_selector_dispose (GObject *object)
{
ESourceSelectorPrivate *priv;
priv = E_SOURCE_SELECTOR_GET_PRIVATE (object);
if (priv->registry != NULL) {
g_signal_handlers_disconnect_matched (
priv->registry,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, object);
g_object_unref (priv->registry);
priv->registry = NULL;
}
g_hash_table_remove_all (priv->source_index);
g_hash_table_remove_all (priv->pending_writes);
clear_saved_primary_selection (E_SOURCE_SELECTOR (object));
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_source_selector_parent_class)->dispose (object);
} | false | false | false | false | false | 0 |
push_curtain(Gameboard *g,void(*redraw_callback)(Gameboard *g)){
if(!g->pushed_curtain){
cairo_t *c = cairo_create(g->background);
g->pushed_curtain=1;
g->redraw_callback=redraw_callback;
update_push(g,c);
cairo_destroy(c);
expose_full(g);
//gameboard_draw(g,0,0,w,h);
}
} | false | false | false | false | false | 0 |
AuULAW8ToNative(AuUint8 * p, AuInt32 tracks, AuInt32 numSamples)
{
AuUint8 *s;
AuInt16 i, *d;
s = p + _numSamples * tracks - 1;
d = (AuInt16 *) (p + (_numSamples * tracks - 1) * 2);
for (i = 0; i < _numSamples * tracks; i++, s--, d--)
*d = ulawToLinear(*s);
} | false | false | false | false | false | 0 |
dfa_free(struct aa_dfa *dfa)
{
if (dfa) {
int i;
for (i = 0; i < ARRAY_SIZE(dfa->tables); i++) {
kvfree(dfa->tables[i]);
dfa->tables[i] = NULL;
}
kfree(dfa);
}
} | false | false | false | false | false | 0 |
getFiles(QDir fromDir, const QStringList &filters, DirSearchType recursive)
{
QFileInfoList files;
// Don't proceed non-existing dirs
if (!fromDir.exists())
return files;
if (fromDir.path() == ".")
return files;
// Get content
foreach (const QFileInfo & file, fromDir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::DirsFirst | QDir::Name)) {
if (file.isFile() && (filters.isEmpty() || QDir::match(filters, file.fileName())))
files << file;
else if (file.isDir() && recursive==Recursively) {
fromDir.cd(file.filePath());
files << getFiles(fromDir, filters, recursive);
fromDir.cdUp();
}
}
return files;
} | false | false | false | false | false | 0 |
gc_master_client_get_best_provider (GcMasterClient *client,
GList **provider_list,
GcInterfaceFlags iface)
{
GList *l = *provider_list;
/* TODO: should maybe choose a acquiring provider if better ones are are not available */
g_debug ("client: choosing best provider");
while (l) {
GcMasterProvider *provider = l->data;
g_debug (" ...trying provider %s", gc_master_provider_get_name (provider));
if (gc_master_provider_subscribe (provider, client, iface)) {
/* provider was started, so accuracy may have changed
(which re-sorts provider lists), restart provider selection */
/* TODO re-think this: restarting provider selection leads to potentially
never-ending looping */
g_debug (" ...started %s (status %d), re-starting provider selection",
gc_master_provider_get_name (provider),
gc_master_provider_get_status (provider));
l = *provider_list;
continue;
}
/* provider did not need to be started */
/* TODO: currently returning even providers that are worse than priv->min_accuracy,
* if nothing else is available */
if (gc_master_provider_get_status (provider) == GEOCLUE_STATUS_AVAILABLE) {
/* unsubscribe from all providers worse than this */
gc_master_client_unsubscribe_providers (client, l->next, iface);
return provider;
}
l = l->next;
}
/* no provider found */
gc_master_client_unsubscribe_providers (client, *provider_list, iface);
return NULL;
} | false | false | false | false | false | 0 |
P_Let (Object argl) {
if (TYPE(Car (argl)) == T_Symbol)
return Named_Let (argl);
else
return General_Let (argl, 0);
} | false | false | false | false | false | 0 |
Exec6502(M6502 *R)
{
register pair J,K;
register byte I;
byte cycles;
I = Op6502(R->PC.W++);
cycles = Cycles[I];
R->Cycles += cycles * MASTER_CLOCK_DIVIDER;
switch(I)
{
#include "Codes.h"
}
/* We are done */
return(R->PC.W);
} | false | false | false | false | false | 0 |
render_nice_data_pixmaps(void)
{
GList *list;
CpuMon *cpu;
gint h_max;
gkrellm_render_data_grid_pixmap(nice_data_grid_piximage,
&nice_data_grid_pixmap, &nice_grid_color);
h_max = 2;
for (list = cpu_mon_list; list; list = list->next)
{
cpu = (CpuMon *) list->data;
if (cpu->chart && (cpu->chart->h > h_max))
h_max = cpu->chart->h;
}
gkrellm_render_data_pixmap(nice_data_piximage,
&nice_data_pixmap, &nice_color, h_max);
} | false | false | false | false | false | 0 |
reset_palette(struct vc_data *vc)
{
int j, k;
for (j=k=0; j<16; j++) {
vc->vc_palette[k++] = default_red[j];
vc->vc_palette[k++] = default_grn[j];
vc->vc_palette[k++] = default_blu[j];
}
set_palette(vc);
} | false | false | false | false | false | 0 |
hasAllocatableSuperReg(unsigned Reg) const {
for (const unsigned* AS = tri_->getSuperRegisters(Reg); *AS; ++AS)
if (allocatableRegs_[*AS] && hasInterval(*AS))
return true;
return false;
} | false | false | false | false | false | 0 |
avc_quick_copy_xperms_decision(u8 perm,
struct extended_perms_decision *dest,
struct extended_perms_decision *src)
{
/*
* compute index of the u32 of the 256 bits (8 u32s) that contain this
* command permission
*/
u8 i = perm >> 5;
dest->used = src->used;
if (dest->used & XPERMS_ALLOWED)
dest->allowed->p[i] = src->allowed->p[i];
if (dest->used & XPERMS_AUDITALLOW)
dest->auditallow->p[i] = src->auditallow->p[i];
if (dest->used & XPERMS_DONTAUDIT)
dest->dontaudit->p[i] = src->dontaudit->p[i];
} | false | false | false | false | false | 0 |
Lset_macro_character()
{
# line 2339 "read.d"
int c;
int narg;
register object *DPPbase=vs_base;
#define chr DPPbase[0]
#define fnc DPPbase[1]
#define ntp DPPbase[2+0]
#define rdtbl DPPbase[2+1]
narg = vs_top - vs_base;
if (narg < 2)
too_few_arguments();
if (narg <= 2 + 0) {
vs_push(Cnil);
narg++;
}
if (narg <= 2 + 1) {
vs_push(current_readtable());
narg++;
}
if (narg > 2 + 2)
too_many_arguments();
# line 2341 "read.d"
check_type_character(&chr);
check_type_readtable(&rdtbl);
c = char_code(chr);
if (ntp != Cnil)
rdtbl->rt.rt_self[c].rte_chattrib
= cat_non_terminating;
else
rdtbl->rt.rt_self[c].rte_chattrib
= cat_terminating;
rdtbl->rt.rt_self[c].rte_macro = fnc;
{
vs_base[0] = Ct;
vs_top = vs_base + 1;
return;
}
# line 2352 "read.d"
#undef chr
#undef fnc
#undef ntp
#undef rdtbl
} | false | false | false | false | false | 0 |
draw_string(int x, int y, const char *string, int length)
{
/* sanity check */
if (font == NULL)
return 0;
if (string == NULL)
return 0;
if (length <= 0)
return 0;
if (tenm_draw_string(x, y, font, string, length) != 0)
{
fprintf(stderr, "draw_string: tenm_draw_string failed\n");
return 1;
}
return 0;
} | false | false | false | false | false | 0 |
msgbox_todo (GtkWidget *widget, gpointer data)
{
GtkWidget *dialog;
GtkWidget *box;
GtkWidget *label;
GtkWidget *button;
char buf[1024];
GdkPixmap *beer_pixmap;
GdkBitmap *beer_mask;
GtkStyle *style;
dialog = gtk_dialog_new();
gtk_window_set_title (GTK_WINDOW (dialog), _("Gerstensaft Todo"));
g_signal_connect (G_OBJECT (dialog), "delete_event",
G_CALLBACK (msgbox_delete), (gpointer) dialog);
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtk_widget_destroy), NULL);
box = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), box, TRUE, TRUE, 5);
gtk_widget_show (box);
gtk_widget_show (dialog);
snprintf(buf, sizeof(buf), "Gerstensaft %s", version);
label = gtk_label_new (buf);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 5);
gtk_widget_show (label);
snprintf (buf, sizeof(buf), "%s/%s", PIXMAP_WM_DIR, "beer.xpm");
style = gtk_widget_get_style (dialog);
beer_pixmap = gdk_pixmap_create_from_xpm (dialog->window, &beer_mask, &style->bg[GTK_STATE_NORMAL], buf);
if (beer_pixmap != NULL) {
label = gtk_pixmap_new (beer_pixmap, beer_mask);
gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
label = gtk_label_new (_(" Things to do for Gerstensaft "));
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 5);
gtk_widget_show (label);
label = gtk_label_new (_(" Select/Unselect via pattern "));
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 5);
gtk_widget_show (label);
label = gtk_label_new (_(" Gnomification / Support for drag and drop "));
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 5);
gtk_widget_show (label);
button = gtk_button_new_from_stock ("gtk-close");
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy), (gpointer) dialog);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area), button, TRUE, FALSE, 0);
gtk_widget_show (button);
gtk_widget_grab_default (button);
} | true | true | false | false | false | 1 |
mthca_alloc_memfree(struct mthca_dev *dev,
struct mthca_qp *qp)
{
if (mthca_is_memfree(dev)) {
qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
qp->qpn, &qp->rq.db);
if (qp->rq.db_index < 0)
return -ENOMEM;
qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
qp->qpn, &qp->sq.db);
if (qp->sq.db_index < 0) {
mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
return -ENOMEM;
}
}
return 0;
} | false | false | false | false | false | 0 |
cuddHashTableLookup(
DdHashTable * hash,
DdNodePtr * key)
{
unsigned int posn;
DdHashItem *item, *prev;
unsigned int i, keysize;
#ifdef DD_DEBUG
assert(hash->keysize > 3);
#endif
posn = ddLCHash(key,hash->keysize,hash->shift);
item = hash->bucket[posn];
prev = NULL;
keysize = hash->keysize;
while (item != NULL) {
DdNodePtr *key2 = item->key;
int equal = 1;
for (i = 0; i < keysize; i++) {
if (key[i] != key2[i]) {
equal = 0;
break;
}
}
if (equal) {
DdNode *value = item->value;
cuddSatDec(item->count);
if (item->count == 0) {
cuddDeref(value);
if (prev == NULL) {
hash->bucket[posn] = item->next;
} else {
prev->next = item->next;
}
item->next = hash->nextFree;
hash->nextFree = item;
hash->size--;
}
return(value);
}
prev = item;
item = item->next;
}
return(NULL);
} | false | false | false | false | true | 1 |
mpir_dump_proctable(void)
{
#if defined HAVE_BG_FILES && !defined HAVE_BG_L_P
/* Use symbols from the runjob.so library provided by IBM.
* Do NOT use debugger symbols local to the srun command */
#else
MPIR_PROCDESC *tv;
int i;
for (i = 0; i < MPIR_proctable_size; i++) {
tv = &MPIR_proctable[i];
if (!tv)
break;
info("task:%d, host:%s, pid:%d, executable:%s",
i, tv->host_name, tv->pid, tv->executable_name);
}
#endif
} | false | false | false | false | false | 0 |
read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size)
{
int skip, len;
for(;;) {
len = get_buffer(pb, buf, TS_PACKET_SIZE);
if (len != TS_PACKET_SIZE)
return AVERROR(EIO);
/* check paquet sync byte */
if (buf[0] != 0x47) {
/* find a new packet start */
url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
if (mpegts_resync(pb) < 0)
return AVERROR_INVALIDDATA;
else
continue;
} else {
skip = raw_packet_size - TS_PACKET_SIZE;
if (skip > 0)
url_fskip(pb, skip);
break;
}
}
return 0;
} | false | false | false | false | false | 0 |
SendVendorCommandCapabilities(const cec_logical_address initiator, const cec_logical_address destination)
{
if (PowerUpEventReceived())
{
cec_command response;
cec_command::Format(response, initiator, destination, CEC_OPCODE_VENDOR_COMMAND);
uint8_t iResponseData[] = {0x10, 0x02, 0xFF, 0xFF, 0x00, 0x05, 0x05, 0x45, 0x55, 0x5c, 0x58, 0x32};
response.PushArray(12, iResponseData);
if (Transmit(response, false, true))
{
CLockObject lock(m_mutex);
m_bCapabilitiesSent = true;
}
}
} | false | false | false | false | false | 0 |
calculate_first_cell(
ali_prealigner_cell * left_cell, ali_prealigner_cell * akt_cell,
unsigned long pos_x)
{
float v1, v2, v3;
unsigned long positionx;
positionx = start_x + pos_x;
/***
v1 = profile->w_ins_multi_unweighted(start_x, positionx) +
profile->w_del(start_y,start_y);
v2 = profile->w_ins_multi_unweighted(start_x, positionx - 1) +
profile->w_sub(start_y, positionx);
***/
v1 = profile->w_ins_multi_cheap(start_x, positionx) +
profile->w_sub_gap(start_y);
v2 = profile->w_ins_multi_cheap(start_x, positionx - 1) +
profile->w_sub(start_y, positionx);
v3 = left_cell->d + profile->w_ins(positionx, start_y);
akt_cell->d = minimum3(v1, v2, v3);
if (v1 == akt_cell->d)
path_map->set(pos_x, 0, ALI_UP);
if (v2 == akt_cell->d)
path_map->set(pos_x, 0, ALI_DIAG);
if (v3 == akt_cell->d)
path_map->set(pos_x, 0, ALI_LEFT);
} | false | false | false | false | false | 0 |
ModifySkillDependancy(int sk, int i, char *dep, int lev)
{
if(sk < 0 || sk > (NSKILLS-1)) return;
if(i < 0 || i >= (int)(sizeof(SkillDefs[sk].depends)/sizeof(SkillDepend)))
return;
if (dep && (FindSkill(dep) == NULL)) return;
if(lev < 0) return;
SkillDefs[sk].depends[i].skill = dep;
SkillDefs[sk].depends[i].level = lev;
} | false | false | false | false | false | 0 |
stv090x_send_diseqc_burst(struct dvb_frontend *fe,
enum fe_sec_mini_cmd burst)
{
struct stv090x_state *state = fe->demodulator_priv;
u32 reg, idle = 0, fifo_full = 1;
u8 mode, value;
int i;
reg = STV090x_READ_DEMOD(state, DISTXCTL);
if (burst == SEC_MINI_A) {
mode = (state->config->diseqc_envelope_mode) ? 5 : 3;
value = 0x00;
} else {
mode = (state->config->diseqc_envelope_mode) ? 4 : 2;
value = 0xFF;
}
STV090x_SETFIELD_Px(reg, DISTX_MODE_FIELD, mode);
STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 1);
if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0)
goto err;
STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 0);
if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0)
goto err;
STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 1);
if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0)
goto err;
while (fifo_full) {
reg = STV090x_READ_DEMOD(state, DISTXSTATUS);
fifo_full = STV090x_GETFIELD_Px(reg, FIFO_FULL_FIELD);
}
if (STV090x_WRITE_DEMOD(state, DISTXDATA, value) < 0)
goto err;
reg = STV090x_READ_DEMOD(state, DISTXCTL);
STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 0);
if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0)
goto err;
i = 0;
while ((!idle) && (i < 10)) {
reg = STV090x_READ_DEMOD(state, DISTXSTATUS);
idle = STV090x_GETFIELD_Px(reg, TX_IDLE_FIELD);
msleep(10);
i++;
}
return 0;
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
} | false | false | false | false | false | 0 |
chirp_fs_hdfs_md5(const char *path, unsigned char digest[16])
{
return cfs_basic_md5(FIXPATH(path), digest);
} | true | true | false | false | false | 1 |
advance()
{
// move down the column
current.y += 2*mparams.B;
// our current pos is SE of our next pos
nextSE = pos;
// when we reset at the top of a column, we may not get an E neighbor, but we always
// gete a N one; so if we have no N neighbor at the moment, we're on the left edge
if (nextN != -1)
{
// if we're not on the left edge, then our N neighbor is our next position's E
// neighbor, etc.
nextE = nextN; // can't just do nextE++; nextE might have been -1
nextN++;
// gotta watch for the bottom, though, where we might have no N neighbor
if (nextE == lastBottom)
nextN = -1;
}
// advance to next pos
pos++;
// if we went off the bottom, we need to reset some stuff
if (current.y >= expandedBBox.bottomRight.y)
{
// move over to the next column
current.x += 2*mparams.B;
// ...and we can abort now if we've gone off the right edge; that means we're done
if (current.x >= expandedBBox.bottomRight.x)
{
end = true;
return;
}
// find the top of our new column
current.y = topPixelY(current.x, expandedBBox.topLeft.y, mparams.B);
// since we're up at the top, we have no SE neighbor
nextSE = -1;
// however, we do have a N neighbor, and if the top of the column to the left
// is above us, we have an E as well
if (topPixelY(current.x - 2*mparams.B, expandedBBox.topLeft.y, mparams.B) < current.y)
{
nextE = lastTop;
nextN = nextE + 1;
}
else
{
nextE = -1;
nextN = lastTop;
}
// finally, remember this new column top's position, and remember that our previous
// position was the old column's bottom
lastTop = pos;
lastBottom = pos - 1;
}
} | false | false | false | false | false | 0 |
tp_debug_sender_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer exclude)
{
GTimeVal now = { 0, 0 };
if (debug_sender != NULL &&
((TpDebugSender *) debug_sender)->priv->timestamps)
{
gchar *now_str, *tmp;
g_get_current_time (&now);
now_str = g_time_val_to_iso8601 (&now);
tmp = g_strdup_printf ("%s: %s", now_str, message);
g_log_default_handler (log_domain, log_level, tmp, NULL);
g_free (now_str);
g_free (tmp);
}
else
{
g_log_default_handler (log_domain, log_level, message, NULL);
}
if (exclude == NULL || tp_strdiff (log_domain, exclude))
{
if (now.tv_sec == 0)
g_get_current_time (&now);
g_idle_add_full (G_PRIORITY_HIGH, tp_debug_sender_idle,
debug_message_new (&now, log_domain, log_level, message),
NULL);
}
} | false | false | false | false | false | 0 |
libisocodes_iso_3166_item_construct (GType object_type, GeeHashMap* item) {
libisocodesISO_3166_Item * self = NULL;
GeeHashMap* _tmp0_;
gpointer _tmp1_ = NULL;
GeeHashMap* _tmp2_;
gpointer _tmp3_ = NULL;
GeeHashMap* _tmp4_;
gpointer _tmp5_ = NULL;
GeeHashMap* _tmp6_;
gpointer _tmp7_ = NULL;
GeeHashMap* _tmp8_;
gpointer _tmp9_ = NULL;
GeeHashMap* _tmp10_;
gpointer _tmp11_ = NULL;
g_return_val_if_fail (item != NULL, NULL);
self = (libisocodesISO_3166_Item*) g_object_new (object_type, NULL);
_tmp0_ = item;
_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, "alpha_2_code");
_g_free0 (self->alpha_2_code);
self->alpha_2_code = (gchar*) _tmp1_;
_tmp2_ = item;
_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, "alpha_3_code");
_g_free0 (self->alpha_3_code);
self->alpha_3_code = (gchar*) _tmp3_;
_tmp4_ = item;
_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, "numeric_code");
_g_free0 (self->numeric_code);
self->numeric_code = (gchar*) _tmp5_;
_tmp6_ = item;
_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, "name");
_g_free0 (self->name);
self->name = (gchar*) _tmp7_;
_tmp8_ = item;
_tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp8_, "official_name");
_g_free0 (self->official_name);
self->official_name = (gchar*) _tmp9_;
_tmp10_ = item;
_tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp10_, "common_name");
_g_free0 (self->common_name);
self->common_name = (gchar*) _tmp11_;
return self;
} | false | false | false | false | false | 0 |
L6()
{register object *base=vs_base;
register object *sup=base+VM6; VC6
vs_check;
bds_check;
{object V41;
object V42;
V41=(base[0]);
V42=(base[1]);
vs_top=sup;
goto TTL;
TTL:;
bds_bind(((object)VV[5]),Cnil);
bds_bind(((object)VV[7]),Cnil);
bds_bind(((object)VV[3]),Cnil);
bds_bind(((object)VV[8]),Cnil);
base[6]= (V41);
base[7]= (V42);
vs_top=(vs_base=base+6)+2;
(void) (*Lnk4)();
vs_top=sup;
if((vs_base[0])!=Cnil){
goto T156;}
{frame_ptr fr;
fr=frs_sch_catch(((object)VV[9]));
if(fr==NULL) FEerror("The tag ~s is undefined.",1,((object)VV[9]));
base[6]= ((object)VV[11]);
vs_top=(vs_base=base+6)+1;
unwind(fr,((object)VV[9]));}
goto T156;
T156:;
base[6]= (((object)VV[5])->s.s_dbind);
vs_top=(vs_base=base+6)+1;
(void) (*Lnk22)();
vs_top=sup;
V43= vs_base[0];
base[6]= (((object)VV[7])->s.s_dbind);
vs_top=(vs_base=base+6)+1;
(void) (*Lnk23)();
vs_top=sup;
V44= vs_base[0];
base[6]= make_cons(V43,V44);
vs_top=(vs_base=base+6)+1;
bds_unwind1;
bds_unwind1;
bds_unwind1;
bds_unwind1;
return;
}
} | false | false | false | false | false | 0 |
mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements)
{
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
if (new_seekhead == NULL)
return NULL;
new_seekhead->segment_offset = segment_offset;
if (numelements > 0) {
new_seekhead->filepos = url_ftell(pb);
// 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
// and size, and 3 bytes to guarantee that an EBML void element
// will fit afterwards
new_seekhead->reserved_size = numelements * MAX_SEEKENTRY_SIZE + 13;
new_seekhead->max_entries = numelements;
put_ebml_void(pb, new_seekhead->reserved_size);
}
return new_seekhead;
} | false | false | false | false | false | 0 |
ResolveBreaks(SQFuncState *funcstate, SQInteger ntoresolve)
{
while(ntoresolve > 0) {
SQInteger pos = funcstate->_unresolvedbreaks.back();
funcstate->_unresolvedbreaks.pop_back();
//set the jmp instruction
funcstate->SetIntructionParams(pos, 0, funcstate->GetCurrentPos() - pos, 0);
ntoresolve--;
}
} | false | false | false | false | false | 0 |
RemovePlugin( WokXMLTag *tag )
{
UnLoadPlugin(tag->GetAttr("filename"));
return 0;
} | false | false | false | false | false | 0 |
move_jobs(void)
{
unsigned cnt;
struct job_save *jp;
for (cnt = 0; cnt < HASHMOD; cnt++)
for (jp = hashtab[cnt]; jp; jp = jp->next) {
char *nnam = my_mkspid(SPNAM, jp->jnum, set_subs);
/* Might end up in the same place, in which case, skip it. */
if (strcmp(nnam, jp->job_path) == 0)
continue;
/* We might be able to renumber the jobs - but not if we
are reducing the subdirectories and we are off the end. */
if (renumber && cnt < set_subs) {
/* Find a vacant job number. */
jobno_t jn = cnt + set_subs + RENUMB_OFFSET;
jn -= jn % set_subs;
while (find_hash(jn))
jn += set_subs;
nnam = my_mkspid(SPNAM, jn, set_subs);
if (!job_rename(jp->job_path, nnam))
goto abort_move;
jp->job_newname = stracpy(nnam);
if (jp->page_path) {
nnam = my_mkspid(PFNAM, jn, set_subs);
if (!job_rename(jp->page_path, nnam))
goto abort_move;
jp->page_newname = stracpy(nnam);
}
jp->newnum = jn;
renumbered++;
}
else {
if (!job_rename(jp->job_path, nnam))
goto abort_move;
jp->job_newname = stracpy(nnam);
if (jp->page_path) {
nnam = my_mkspid(PFNAM, jp->jnum, set_subs);
if (!job_rename(jp->page_path, nnam))
goto abort_move;
jp->page_newname = stracpy(nnam);
}
}
}
return 1;
abort_move:
fprintf(stderr, "Cancelling job move\n");
for (cnt = 0; cnt < HASHMOD; cnt++)
for (jp = hashtab[cnt]; jp; jp = jp->next) {
if (jp->job_newname && !job_rename(jp->job_newname, jp->job_path))
fprintf(stderr, "Panic! could not fix back %s\n", jp->job_path);
if (jp->page_newname && !job_rename(jp->page_newname, jp->page_path))
fprintf(stderr, "Panic! could not fix back %s\n", jp->job_path);
}
return 0;
} | false | false | false | false | false | 0 |
_ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
{
lclTocEntry *tctx;
char fn[MAXPGPATH];
tctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
if (te->dataDumper)
{
snprintf(fn, MAXPGPATH, "%d.dat", te->dumpId);
tctx->filename = pg_strdup(fn);
}
else if (strcmp(te->desc, "BLOBS") == 0)
tctx->filename = pg_strdup("blobs.toc");
else
tctx->filename = NULL;
te->formatData = (void *) tctx;
} | false | false | false | false | false | 0 |
init()
{
DEBUG_BLOCK
GpodderServiceConfig config;
const QString &username = config.username();
const QString &password = config.password();
if ( m_apiRequest )
delete m_apiRequest;
//We have to check this here too, since KWallet::openWallet() doesn't
//guarantee that it will always return a wallet.
//Notice that LastFm service does the same verification.
if ( !config.isDataLoaded() )
{
debug() << "Failed to read gpodder credentials.";
m_apiRequest = new mygpo::ApiRequest( The::networkAccessManager() );
}
else
{
if( config.enableProvider() )
{
m_apiRequest = new mygpo::ApiRequest( username,
password,
The::networkAccessManager() );
if( m_podcastProvider )
delete m_podcastProvider;
enableGpodderProvider( username );
}
else
m_apiRequest = new mygpo::ApiRequest( The::networkAccessManager() );
}
setServiceReady( true );
m_inited = true;
} | false | false | false | false | false | 0 |
amitk_roi_erase_volume(const AmitkRoi * roi,
AmitkDataSet * ds,
const gboolean outside,
AmitkUpdateFunc update_func,
gpointer update_data) {
guint i_frame;
guint i_gate;
for (i_frame=0; i_frame<AMITK_DATA_SET_NUM_FRAMES(ds); i_frame++)
for (i_gate=0; i_gate<AMITK_DATA_SET_NUM_GATES(ds); i_gate++)
amitk_roi_calculate_on_data_set(roi, ds, i_frame, i_gate, outside, FALSE, erase_volume, ds);
/* recalc max and min */
amitk_data_set_calc_min_max(ds, update_func, update_data);
/* mark the distribution data as invalid */
if (AMITK_DATA_SET_DISTRIBUTION(ds) != NULL) {
g_object_unref(AMITK_DATA_SET_DISTRIBUTION(ds));
ds->distribution = NULL;
}
/* this is a no-op to get a data_set_changed signal */
amitk_data_set_set_value(AMITK_DATA_SET(ds), zero_voxel,
amitk_data_set_get_value(AMITK_DATA_SET(ds), zero_voxel),
TRUE);
return;
} | false | false | false | false | false | 0 |
ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
{
ByteIOContext *pb;
int ret = url_open_dyn_buf(&pb);
if(ret < 0)
return ret;
ff_avc_parse_nal_units(pb, buf_in, *size);
av_freep(buf);
*size = url_close_dyn_buf(pb, buf);
return 0;
} | false | false | false | false | false | 0 |
BuildSubAggregate(Value *From, Value* To, Type *IndexedType,
SmallVectorImpl<unsigned> &Idxs,
unsigned IdxSkip,
Instruction *InsertBefore) {
llvm::StructType *STy = dyn_cast<llvm::StructType>(IndexedType);
if (STy) {
// Save the original To argument so we can modify it
Value *OrigTo = To;
// General case, the type indexed by Idxs is a struct
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
// Process each struct element recursively
Idxs.push_back(i);
Value *PrevTo = To;
To = BuildSubAggregate(From, To, STy->getElementType(i), Idxs, IdxSkip,
InsertBefore);
Idxs.pop_back();
if (!To) {
// Couldn't find any inserted value for this index? Cleanup
while (PrevTo != OrigTo) {
InsertValueInst* Del = cast<InsertValueInst>(PrevTo);
PrevTo = Del->getAggregateOperand();
Del->eraseFromParent();
}
// Stop processing elements
break;
}
}
// If we successfully found a value for each of our subaggregates
if (To)
return To;
}
// Base case, the type indexed by SourceIdxs is not a struct, or not all of
// the struct's elements had a value that was inserted directly. In the latter
// case, perhaps we can't determine each of the subelements individually, but
// we might be able to find the complete struct somewhere.
// Find the value that is at that particular spot
Value *V = FindInsertedValue(From, Idxs);
if (!V)
return nullptr;
// Insert the value in the new (sub) aggregrate
return llvm::InsertValueInst::Create(To, V, makeArrayRef(Idxs).slice(IdxSkip),
"tmp", InsertBefore);
} | false | false | false | false | false | 0 |
parse_http_url(const char *headers, char **url)
{
char *s, *start, *tmp;
s = (char *)eat_whitespace_no_nl(headers);
if (!*s) return -1;
s = (char *)find_whitespace(s); /* get past GET/POST */
if (!*s) return -1;
s = (char *)eat_whitespace_no_nl(s);
if (!*s) return -1;
start = s; /* this is it, assuming it's valid */
s = (char *)find_whitespace(start);
if (!*s) return -1;
/* tolerate the http[s] proxy style of putting the hostname in the url */
if (s-start >= 4 && !strcmpstart(start,"http")) {
tmp = start + 4;
if (*tmp == 's')
tmp++;
if (s-tmp >= 3 && !strcmpstart(tmp,"://")) {
tmp = strchr(tmp+3, '/');
if (tmp && tmp < s) {
log_debug(LD_DIR,"Skipping over 'http[s]://hostname/' string");
start = tmp;
}
}
}
if (s-start < 5 || strcmpstart(start,"/tor/")) { /* need to rewrite it */
*url = tor_malloc(s - start + 5);
strlcpy(*url,"/tor", s-start+5);
strlcat((*url)+4, start, s-start+1);
} else {
*url = tor_strndup(start, s-start);
}
return 0;
} | false | false | false | false | false | 0 |
IDirectFB_Destruct( IDirectFB *thiz )
{
int i;
IDirectFB_data *data = (IDirectFB_data*)thiz->priv;
D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
drop_window( data );
if (data->primary.context)
dfb_layer_context_unref( data->primary.context );
dfb_layer_context_unref( data->context );
for (i=0; i<MAX_LAYERS; i++) {
if (data->layers[i].context) {
if (data->layers[i].palette)
dfb_palette_unref( data->layers[i].palette );
dfb_surface_unref( data->layers[i].surface );
dfb_layer_region_unref( data->layers[i].region );
dfb_layer_context_unref( data->layers[i].context );
}
}
dfb_core_destroy( data->core, false );
idirectfb_singleton = NULL;
DIRECT_DEALLOCATE_INTERFACE( thiz );
direct_shutdown();
} | false | false | false | false | false | 0 |
restore_sort()
{
m_search_invert = false;
m_col = get_default_sort_column();
m_sortmode = get_default_view_sort_mode();
m_previous_col = get_default_view_sort_pre_column();
m_previous_sortmode = get_default_view_sort_pre_mode();
if( get_row_size() ){
exec_sort();
goto_top();
}
} | false | false | false | false | false | 0 |
mga_verify_state(drm_mga_private_t *dev_priv)
{
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty;
int ret = 0;
if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
if (dirty & MGA_UPLOAD_CONTEXT)
ret |= mga_verify_context(dev_priv);
if (dirty & MGA_UPLOAD_TEX0)
ret |= mga_verify_tex(dev_priv, 0);
if (dev_priv->chipset >= MGA_CARD_TYPE_G400) {
if (dirty & MGA_UPLOAD_TEX1)
ret |= mga_verify_tex(dev_priv, 1);
if (dirty & MGA_UPLOAD_PIPE)
ret |= (sarea_priv->warp_pipe > MGA_MAX_G400_PIPES);
} else {
if (dirty & MGA_UPLOAD_PIPE)
ret |= (sarea_priv->warp_pipe > MGA_MAX_G200_PIPES);
}
return (ret == 0);
} | false | false | false | false | false | 0 |
lcd_patch_skew(struct lvds_setting_information
*plvds_setting_info, struct lvds_chip_information *plvds_chip_info)
{
DEBUG_MSG(KERN_INFO "lcd_patch_skew\n");
switch (plvds_chip_info->output_interface) {
case INTERFACE_DVP0:
lcd_patch_skew_dvp0(plvds_setting_info, plvds_chip_info);
break;
case INTERFACE_DVP1:
lcd_patch_skew_dvp1(plvds_setting_info, plvds_chip_info);
break;
case INTERFACE_DFP_LOW:
if (UNICHROME_P4M900 == viaparinfo->chip_info->gfx_chip_name) {
viafb_write_reg_mask(CR99, VIACR, 0x08,
BIT0 + BIT1 + BIT2 + BIT3);
}
break;
}
} | false | false | false | false | false | 0 |
tst_si_eql(int line_num,
tst_case *tc,
SegmentInfo *si,
const char *name,
int doc_cnt,
Store *store)
{
if (tst_str_equal(line_num, tc, name, si->name) &&
tst_int_equal(line_num, tc, doc_cnt, si->doc_cnt) &&
tst_ptr_equal(line_num, tc, store, si->store)) {
return true;
}
else {
return false;
}
} | false | false | false | false | false | 0 |
adjustOverlays(
DcmItem *dataset,
DicomImage& image) const
{
if (dataset == NULL) return EC_IllegalCall;
unsigned int overlayCount = image.getOverlayCount();
if (overlayCount > 0)
{
Uint16 group = 0;
DcmStack stack;
unsigned long bytesAllocated = 0;
Uint8 *buffer = NULL;
unsigned int width = 0;
unsigned int height = 0;
unsigned long frames = 0;
DcmElement *elem = NULL;
OFCondition result = EC_Normal;
// adjust overlays (prior to grayscale compression)
for (unsigned int i=0; i < overlayCount; i++)
{
// check if current overlay is embedded in pixel data
group = (Uint16) image.getOverlayGroupNumber(i);
stack.clear();
if ((dataset->search(DcmTagKey(group, 0x3000), stack, ESM_fromHere, OFFalse)).bad())
{
// separate Overlay Data not found. Assume overlay is embedded.
bytesAllocated = image.create6xxx3000OverlayData(buffer, i, width, height, frames);
if (bytesAllocated > 0)
{
elem = new DcmOverlayData(DcmTagKey(group, 0x3000)); // DCM_OverlayData
if (elem)
{
result = elem->putUint8Array(buffer, bytesAllocated);
delete[] buffer;
if (result.good())
{
dataset->insert(elem, OFTrue /*replaceOld*/);
// DCM_OverlayBitsAllocated
result = dataset->putAndInsertUint16(DcmTagKey(group, 0x0100), 1);
// DCM_OverlayBitPosition
if (result.good()) result = dataset->putAndInsertUint16(DcmTagKey(group, 0x0102), 0);
}
else
{
delete elem;
return result;
}
}
else
{
delete[] buffer;
return EC_MemoryExhausted;
}
}
else return EC_IllegalCall;
}
}
}
return EC_Normal;
} | false | false | false | false | false | 0 |
camel_vee_data_cache_contains_message_info_data (CamelVeeDataCache *data_cache,
CamelFolder *folder,
const gchar *orig_message_uid)
{
gboolean res;
VeeData vdata;
g_return_val_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache), FALSE);
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
g_return_val_if_fail (orig_message_uid != NULL, FALSE);
g_mutex_lock (&data_cache->priv->mi_mutex);
/* make sure the orig_message_uid comes from the string pool */
vdata.folder = folder;
vdata.orig_message_uid = camel_pstring_strdup (orig_message_uid);
res = g_hash_table_lookup (data_cache->priv->orig_message_uid_hash, &vdata) != NULL;
camel_pstring_free (vdata.orig_message_uid);
g_mutex_unlock (&data_cache->priv->mi_mutex);
return res;
} | false | false | false | false | false | 0 |
pp_c_direct_declarator (c_pretty_printer *pp, tree t)
{
switch (TREE_CODE (t))
{
case VAR_DECL:
case PARM_DECL:
case TYPE_DECL:
case FIELD_DECL:
case LABEL_DECL:
pp_c_space_for_pointer_operator (pp, TREE_TYPE (t));
pp_c_tree_decl_identifier (pp, t);
break;
case ARRAY_TYPE:
case POINTER_TYPE:
pp_abstract_declarator (pp, TREE_TYPE (t));
break;
case FUNCTION_TYPE:
pp_parameter_list (pp, t);
pp_abstract_declarator (pp, TREE_TYPE (t));
break;
case FUNCTION_DECL:
pp_c_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
pp_c_tree_decl_identifier (pp, t);
if (pp_c_base (pp)->flags & pp_c_flag_abstract)
pp_abstract_declarator (pp, TREE_TYPE (t));
else
{
pp_parameter_list (pp, t);
pp_abstract_declarator (pp, TREE_TYPE (TREE_TYPE (t)));
}
break;
case INTEGER_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
case ENUMERAL_TYPE:
case UNION_TYPE:
case RECORD_TYPE:
break;
default:
pp_unsupported_tree (pp, t);
break;
}
} | false | false | false | false | false | 0 |
throtl_pd_alloc(gfp_t gfp, int node)
{
struct throtl_grp *tg;
int rw;
tg = kzalloc_node(sizeof(*tg), gfp, node);
if (!tg)
return NULL;
throtl_service_queue_init(&tg->service_queue);
for (rw = READ; rw <= WRITE; rw++) {
throtl_qnode_init(&tg->qnode_on_self[rw], tg);
throtl_qnode_init(&tg->qnode_on_parent[rw], tg);
}
RB_CLEAR_NODE(&tg->rb_node);
tg->bps[READ] = -1;
tg->bps[WRITE] = -1;
tg->iops[READ] = -1;
tg->iops[WRITE] = -1;
return &tg->pd;
} | false | false | false | false | false | 0 |
free_data(struct llist *leaves_queue,
struct rnode *root, struct llist *all_children)
{
struct rnode *kid;
destroy_llist(leaves_queue);
//destroy_rnode(root, NULL);
struct list_elem *elem;
for (elem = all_children->head; NULL != elem; elem = elem->next) {
kid = elem->data;
free(kid->edge_length_as_string);
free(kid->label);
free(kid->data);
free(kid);
}
destroy_llist(all_children);
} | false | false | false | false | false | 0 |
filtre(unsigned char lettre)
{
if ((lettre>=32) && (lettre <=125))
return lettre;
else
switch(lettre)
{
case(131):
case(132):
case(133):
case(134):
case(160):
return 'a';
case(130):
case(136):
case(137):
case(138):
return 'e';
case(139):
case(140):
case(141):
case(161):
return 'i';
case(164):
return 'n';
case(147):
case(148):
case(149):
case(162):
return 'o';
case(150):
case(151):
case(163):
return 'u';
case(152):
return 'y';
case(142):
case(143):
return 'A';
case(144):
return 'E';
case(165):
return 'N';
case(153):
return 'O';
case(154):
return 'U';
default:
return ' ';
}
} | false | false | false | false | false | 0 |
Perl_report_evil_fh(pTHX_ const GV *gv)
{
const IO *io = gv ? GvIO(gv) : NULL;
const PERL_BITFIELD16 op = PL_op->op_type;
const char *vile;
I32 warn_type;
if (io && IoTYPE(io) == IoTYPE_CLOSED) {
vile = "closed";
warn_type = WARN_CLOSED;
}
else {
vile = "unopened";
warn_type = WARN_UNOPENED;
}
if (ckWARN(warn_type)) {
SV * const name
= gv && isGV_with_GP(gv) && GvENAMELEN(gv) ?
sv_2mortal(newSVhek(GvENAME_HEK(gv))) : NULL;
const char * const pars =
(const char *)(OP_IS_FILETEST(op) ? "" : "()");
const char * const func =
(const char *)
(op == OP_READLINE ? "readline" : /* "<HANDLE>" not nice */
op == OP_LEAVEWRITE ? "write" : /* "write exit" not nice */
PL_op_desc[op]);
const char * const type =
(const char *)
(OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET)
? "socket" : "filehandle");
const bool have_name = name && SvCUR(name);
Perl_warner(aTHX_ packWARN(warn_type),
"%s%s on %s %s%s%"SVf, func, pars, vile, type,
have_name ? " " : "",
SVfARG(have_name ? name : &PL_sv_no));
if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
Perl_warner(
aTHX_ packWARN(warn_type),
"\t(Are you trying to call %s%s on dirhandle%s%"SVf"?)\n",
func, pars, have_name ? " " : "",
SVfARG(have_name ? name : &PL_sv_no)
);
}
} | false | false | false | false | false | 0 |
auth_verify_cram(struct hmac_hashinfo *hash,
const char *challenge, const char *response,
const char *hashsecret)
{
int rc;
rc = do_auth_verify_cram(hash, challenge, response, hashsecret);
DPRINTF(rc ? "cram validation failed" : "cram validation succeeded");
return rc;
} | false | false | false | false | false | 0 |
writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& param, bool marshal,
const string& str, const StringList& metaData, int typeCtx)
{
string fixedParam = fixKwd(param);
string stream;
if(str.empty())
{
stream = marshal ? "__outS" : "__inS";
}
else
{
stream = str;
}
if(marshal)
{
out << nl << stream << "->write(" << fixedParam << ");";
}
else
{
out << nl << stream << "->read(" << fixedParam << ");";
}
} | false | false | false | false | false | 0 |
parsediropres(const u_int32_t *dp)
{
int er;
if (!(dp = parsestatus(dp, &er)))
return (0);
if (er)
return (1);
dp = parsefh(dp, 0);
if (dp == NULL)
return (0);
return (parsefattr(dp, vflag, 0) != NULL);
} | false | false | false | false | false | 0 |
endTransparencyGroup(GfxState *state) {
// restore state
delete splash;
bitmap = transpGroupStack->origBitmap;
splash = transpGroupStack->origSplash;
state->shiftCTM(transpGroupStack->tx, transpGroupStack->ty);
updateCTM(state, 0, 0, 0, 0, 0, 0);
} | false | false | false | false | false | 0 |
load_registered(private_plugin_loader_t *this,
registered_feature_t *registered,
int level)
{
enumerator_t *enumerator;
provided_feature_t *provided;
enumerator = registered->plugins->create_enumerator(registered->plugins);
while (enumerator->enumerate(enumerator, &provided))
{
load_provided(this, provided, level);
}
enumerator->destroy(enumerator);
} | 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.