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
|
---|---|---|---|---|---|---|
FilterFrame( uint8_t *io, int width, int height, double position, double frame_delta )
{
GtkWidget* widget = glade_xml_get_widget( kinoplus_glade, "checkbutton_panzoom_interlace" );
interlace_on = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget ) );
widget = glade_xml_get_widget( kinoplus_glade, "checkbutton_panzoom_reverse" );
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget ) ) != reverse )
{
reverse = !reverse;
time_map.Invert();
}
PanZoomEntry *entry = time_map.Get( position );
ChangeController( entry );
if ( entry->IsEditable() )
{
GtkWidget* widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_panzoom_x" );
entry->x = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( widget ) );
widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_panzoom_y" );
entry->y = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( widget ) );
widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_panzoom_w" );
entry->width = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( widget ) );
widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_panzoom_h" );
entry->height = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( widget ) );
}
entry->interlace_on = interlace_on;
entry->interlace_first_field = interlace_first_field;
entry->RenderFinal( io, width, height );
time_map.FinishedWith( entry );
}
| false | false | false | false | false | 0 |
vector_set_and_comb_evals(
vector* tgt, /*!< Pointer to target vector to set eval_a/b/c supplemental bits */
vector* left, /*!< Pointer to target vector on the left */
vector* right /*!< Pointer to target vector on the right */
) { PROFILE(VECTOR_SET_AND_COMB_EVALS);
switch( tgt->suppl.part.data_type ) {
case VDATA_UL :
{
unsigned int i;
unsigned int size = UL_SIZE( tgt->width );
unsigned int lsize = UL_SIZE( left->width );
unsigned int rsize = UL_SIZE( right->width );
for( i=0; i<size; i++ ) {
ulong* val = tgt->value.ul[i];
ulong* lval = (i < lsize) ? left->value.ul[i] : 0;
ulong* rval = (i < rsize) ? right->value.ul[i] : 0;
ulong lvall = (i < lsize) ? lval[VTYPE_INDEX_EXP_VALL] : 0;
ulong nlvalh = (i < lsize) ? ~lval[VTYPE_INDEX_EXP_VALH] : UL_SET;
ulong rvall = (i < rsize) ? rval[VTYPE_INDEX_EXP_VALL] : 0;
ulong nrvalh = (i < rsize) ? ~rval[VTYPE_INDEX_EXP_VALH] : UL_SET;
val[VTYPE_INDEX_EXP_EVAL_A] |= nlvalh & ~lvall;
val[VTYPE_INDEX_EXP_EVAL_B] |= nrvalh & ~rvall;
val[VTYPE_INDEX_EXP_EVAL_C] |= nlvalh & nrvalh & lvall & rvall;
}
}
break;
case VDATA_R64 :
case VDATA_R32 :
break;
default : assert( 0 ); break;
}
PROFILE_END;
}
| false | false | false | false | false | 0 |
mg_load_dll(const char *dll_name, struct mg_dll_symbol *syms) {
void *dll_handle;
int i;
if ((dll_handle = mg_open_dll(dll_name)) == NULL) {
return dll_name;
} else {
for (i = 0; syms != NULL && syms[i].symbol_name != NULL; i++) {
syms[i].symbol_address.ptr = mg_find_dll_sym(dll_handle,
syms[i].symbol_name);
if (syms[i].symbol_address.ptr == NULL) {
return syms[i].symbol_name;
}
}
}
return NULL;
}
| false | false | false | false | false | 0 |
posix_setattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
int32_t op_ret = -1;
int32_t op_errno = 0;
char * real_path = 0;
struct iatt statpre = {0,};
struct iatt statpost = {0,};
DECLARE_OLD_FS_ID_VAR;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_INODE_HANDLE (real_path, this, loc, &statpre);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"setattr (lstat) on %s failed: %s", real_path,
strerror (op_errno));
goto out;
}
if (valid & GF_SET_ATTR_MODE) {
op_ret = posix_do_chmod (this, real_path, stbuf);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"setattr (chmod) on %s failed: %s", real_path,
strerror (op_errno));
goto out;
}
}
if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)){
op_ret = posix_do_chown (this, real_path, stbuf, valid);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"setattr (chown) on %s failed: %s", real_path,
strerror (op_errno));
goto out;
}
}
if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) {
op_ret = posix_do_utimes (this, real_path, stbuf);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"setattr (utimes) on %s failed: %s", real_path,
strerror (op_errno));
goto out;
}
}
if (!valid) {
op_ret = lchown (real_path, -1, -1);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"lchown (%s, -1, -1) failed => (%s)",
real_path, strerror (op_errno));
goto out;
}
}
op_ret = posix_pstat (this, loc->gfid, real_path, &statpost);
if (op_ret == -1) {
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"setattr (lstat) on %s failed: %s", real_path,
strerror (op_errno));
goto out;
}
op_ret = 0;
out:
SET_TO_OLD_FS_ID ();
STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno,
&statpre, &statpost, NULL);
return 0;
}
| false | false | false | false | false | 0 |
hns_xgmac_config(struct hns_mac_cb *mac_cb, struct mac_params *mac_param)
{
struct mac_driver *mac_drv;
mac_drv = devm_kzalloc(mac_cb->dev, sizeof(*mac_drv), GFP_KERNEL);
if (!mac_drv)
return NULL;
mac_drv->mac_init = hns_xgmac_init;
mac_drv->mac_enable = hns_xgmac_enable;
mac_drv->mac_disable = hns_xgmac_disable;
mac_drv->mac_id = mac_param->mac_id;
mac_drv->mac_mode = mac_param->mac_mode;
mac_drv->io_base = mac_param->vaddr;
mac_drv->dev = mac_param->dev;
mac_drv->mac_cb = mac_cb;
mac_drv->set_mac_addr = hns_xgmac_set_pausefrm_mac_addr;
mac_drv->set_an_mode = NULL;
mac_drv->config_loopback = NULL;
mac_drv->config_pad_and_crc = hns_xgmac_config_pad_and_crc;
mac_drv->config_half_duplex = NULL;
mac_drv->set_rx_ignore_pause_frames =
hns_xgmac_set_rx_ignore_pause_frames;
mac_drv->mac_get_id = hns_xgmac_get_id;
mac_drv->mac_free = hns_xgmac_free;
mac_drv->adjust_link = NULL;
mac_drv->set_tx_auto_pause_frames = hns_xgmac_set_tx_auto_pause_frames;
mac_drv->config_max_frame_length = hns_xgmac_config_max_frame_length;
mac_drv->mac_pausefrm_cfg = hns_xgmac_pausefrm_cfg;
mac_drv->autoneg_stat = NULL;
mac_drv->get_info = hns_xgmac_get_info;
mac_drv->get_pause_enable = hns_xgmac_get_pausefrm_cfg;
mac_drv->get_link_status = hns_xgmac_get_link_status;
mac_drv->get_regs = hns_xgmac_get_regs;
mac_drv->get_ethtool_stats = hns_xgmac_get_stats;
mac_drv->get_sset_count = hns_xgmac_get_sset_count;
mac_drv->get_regs_count = hns_xgmac_get_regs_count;
mac_drv->get_strings = hns_xgmac_get_strings;
mac_drv->update_stats = hns_xgmac_update_stats;
return (void *)mac_drv;
}
| false | false | false | false | false | 0 |
getColour(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, ColourValue *result, int maxEntries)
{
int n = 0;
while(i != end && n < maxEntries)
{
float v = 0;
if(getFloat(*i, &v))
{
switch(n)
{
case 0:
result->r = v;
break;
case 1:
result->g = v;
break;
case 2:
result->b = v;
break;
case 3:
result->a = v;
break;
}
}
else
{
return false;
}
++n;
++i;
}
// return error if we found less than rgb before end, unless constrained
return (n >= 3 || n == maxEntries);
}
| false | false | false | false | false | 0 |
scsi_data_dir_opcode(unsigned char op)
{
enum data_direction dir;
switch (op) {
case WRITE_6:
case WRITE_10:
case WRITE_VERIFY:
case WRITE_12:
case WRITE_16:
dir = DATA_WRITE;
break;
default:
dir = DATA_READ;
break;
}
return dir;
}
| false | false | false | false | false | 0 |
connection_event_update(int epfd, int fd, uint32_t events){
assert(fd != 0 || fd);
ev.events = events;
ev.data.fd = fd;
int res = epoll_ctl(epfd, EPOLL_CTL_MOD, fd, &ev);
if (res != 0){
DEBUG("[#] epoll_ctl() update failed on fd: %d.\n", fd);
}
return res == 0;
}
| false | false | false | false | false | 0 |
MixCoder_Free(CMixCoder *p)
{
int i;
for (i = 0; i < p->numCoders; i++)
{
IStateCoder *sc = &p->coders[i];
if (p->alloc && sc->p)
sc->Free(sc->p, p->alloc);
}
p->numCoders = 0;
if (p->buf)
p->alloc->Free(p->alloc, p->buf);
}
| false | false | false | true | false | 1 |
H5O_dec_rc_by_loc(const H5O_loc_t *loc, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* check args */
HDassert(loc);
/* Get header */
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Decrement the reference count on the object header */
/* (which will unpin it, if appropriate) */
if(H5O_dec_rc(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
done:
/* Release the object header from the cache */
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
}
| false | false | false | false | false | 0 |
uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
QUEUE* q;
uv_handle_t* h;
QUEUE_FOREACH(q, &loop->handle_queue) {
h = QUEUE_DATA(q, uv_handle_t, handle_queue);
if (h->flags & UV__HANDLE_INTERNAL) continue;
walk_cb(h, arg);
}
}
| false | false | false | false | false | 0 |
click_action_emit_long_press (gpointer data)
{
ClutterClickAction *action = data;
ClutterClickActionPrivate *priv = action->priv;
ClutterActor *actor;
gboolean result;
priv->long_press_id = 0;
actor = clutter_actor_meta_get_actor (data);
g_signal_emit (action, click_signals[LONG_PRESS], 0,
actor,
CLUTTER_LONG_PRESS_ACTIVATE,
&result);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
return FALSE;
}
| false | false | false | false | false | 0 |
sge_htable_destroy(htable ht)
{
int i;
Bucket *bucket, *next;
for(i=0; i < ht->mask+1; i++) {
for (bucket = ht->table[i]; bucket; bucket = next) {
next = bucket->next;
if(bucket->key != NULL) {
free((char *)bucket->key);
}
free((char *)bucket);
}
}
free((char *)ht->table);
free((char *)ht);
}
| false | false | false | false | false | 0 |
mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
u8 version = mei_me_cl_ver(cldev->me_cl);
if (add_uevent_var(env, "MEI_CL_VERSION=%d", version))
return -ENOMEM;
if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid))
return -ENOMEM;
if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name))
return -ENOMEM;
if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:%02X:",
cldev->name, uuid, version))
return -ENOMEM;
return 0;
}
| false | false | false | false | false | 0 |
text_dirname_base(char *buff, const char *path)
{
const char *last;
last = path;
while (*last)
{
last++;
}
while (--last > path && *last == '/');
while (last > path && *last-- != '/');
while (last > path && *last == '/')
{
last--;
}
if (path == last && *path != '/')
{
*buff++ = '.';
goto out_buff_end;
}
while (path <= last)
{
*buff++ = *path++;
}
out_buff_end:
*buff = 0;
return buff;
}
| false | false | false | false | false | 0 |
battery_level(DBusConnection *conn, DBusMessage *msg,
void *data)
{
dbus_uint32_t level;
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &level,
DBUS_TYPE_INVALID))
return btd_error_invalid_args(msg);
if (level > 5)
return btd_error_invalid_args(msg);
telephony_update_indicator(dummy_indicators, "battchg", level);
DBG("telephony-dummy: battery level set to %u", level);
return dbus_message_new_method_return(msg);
}
| false | false | false | false | false | 0 |
bnxt_hwrm_vnic_free(struct bnxt *bp)
{
u16 i;
for (i = 0; i < bp->nr_vnics; i++)
bnxt_hwrm_vnic_free_one(bp, i);
}
| false | false | false | false | false | 0 |
gf_w128_sse_bytwo_b_multiply(gf_t *gf, gf_val_128_t a128, gf_val_128_t b128, gf_val_128_t c128)
{
#if defined(INTEL_SSE4)
__m128i a, b, lmask, hmask, pp, c, middle_one;
gf_internal_t *h;
uint64_t topbit, middlebit;
h = (gf_internal_t *) gf->scratch;
c = _mm_setzero_si128();
lmask = _mm_insert_epi64(c, 1ULL << 63, 0);
hmask = _mm_insert_epi64(c, 1ULL << 63, 1);
b = _mm_insert_epi64(c, a128[0], 1);
b = _mm_insert_epi64(b, a128[1], 0);
a = _mm_insert_epi64(c, b128[0], 1);
a = _mm_insert_epi64(a, b128[1], 0);
pp = _mm_insert_epi64(c, h->prim_poly, 0);
middle_one = _mm_insert_epi64(c, 1, 0x1);
while (1) {
if (_mm_extract_epi32(a, 0x0) & 1) {
c = _mm_xor_si128(c, b);
}
middlebit = (_mm_extract_epi32(a, 0x2) & 1);
a = _mm_srli_epi64(a, 1);
if (middlebit) a = _mm_xor_si128(a, lmask);
if ((_mm_extract_epi64(a, 0x1) == 0ULL) && (_mm_extract_epi64(a, 0x0) == 0ULL)){
c128[0] = _mm_extract_epi64(c, 0x1);
c128[1] = _mm_extract_epi64(c, 0x0);
return;
}
topbit = (_mm_extract_epi64(_mm_and_si128(b, hmask), 1));
middlebit = (_mm_extract_epi64(_mm_and_si128(b, lmask), 0));
b = _mm_slli_epi64(b, 1);
if (middlebit) b = _mm_xor_si128(b, middle_one);
if (topbit) b = _mm_xor_si128(b, pp);
}
#endif
}
| false | false | false | false | false | 0 |
insert (tree *tr, nodeptr p, nodeptr q, boolean glob)
/* glob -- Smooth tree globally? */
/* q
/.
add/ .
/ .
pn .
s ---- p .remove
pnn .
\ .
add\ .
\. pn = p->next;
r pnn = p->next->next;
*/
{ /* insert */
nodeptr r, s;
r = q->back;
s = p->back;
# if BestInsertAverage && ! Master
{ double zqr, zqs, zrs, lzqr, lzqs, lzrs, lzsum, lzq, lzr, lzs, lzmax;
if ((zqr = makenewz(tr, q, r, q->z, iterations)) == badZ) return FALSE;
if ((zqs = makenewz(tr, q, s, defaultz, iterations)) == badZ) return FALSE;
if ((zrs = makenewz(tr, r, s, defaultz, iterations)) == badZ) return FALSE;
lzqr = (zqr > zmin) ? log(zqr) : log(zmin); /* long branches */
lzqs = (zqs > zmin) ? log(zqs) : log(zmin);
lzrs = (zrs > zmin) ? log(zrs) : log(zmin);
lzsum = 0.5 * (lzqr + lzqs + lzrs);
lzq = lzsum - lzrs;
lzr = lzsum - lzqs;
lzs = lzsum - lzqr;
lzmax = log(zmax);
if (lzq > lzmax) {lzq = lzmax; lzr = lzqr; lzs = lzqs;} /* short */
else if (lzr > lzmax) {lzr = lzmax; lzq = lzqr; lzs = lzrs;}
else if (lzs > lzmax) {lzs = lzmax; lzq = lzqs; lzr = lzrs;}
hookup(p->next, q, exp(lzq));
hookup(p->next->next, r, exp(lzr));
hookup(p, s, exp(lzs));
}
# else
{ double z;
z = sqrt(q->z);
hookup(p->next, q, z);
hookup(p->next->next, r, z);
}
# endif
if (! newview(tr, p)) return FALSE; /* So that p is valid at update */
tr->opt_level = 0;
# if ! Master /* Smoothings are done by slave */
if (glob) { /* Smooth whole tree */
if (! smoothTree(tr, smoothings)) return FALSE;
}
else { /* Smooth locale of p */
if (! localSmooth(tr, p, smoothings)) return FALSE;
}
# else
tr->likelihood = unlikely;
# endif
return TRUE;
}
| false | false | false | false | false | 0 |
load_maps(){
int i;
for(i = 0;i < 256;i++){
S5MAP[i] = -1;
S16MAP[i] = -1;
}
S5MAP['A'] = 0;
S5MAP['a'] = 0;
S5MAP['C'] = 1;
S5MAP['c'] = 1;
S5MAP['G'] = 2;
S5MAP['g'] = 2;
S5MAP['T'] = 3;
S5MAP['t'] = 3;
S5MAP['R'] = 4;
S5MAP['r'] = 4;
S5MAP['Y'] = 4;
S5MAP['y'] = 4;
S5MAP['M'] = 4;
S5MAP['m'] = 4;
S5MAP['K'] = 4;
S5MAP['k'] = 4;
S5MAP['W'] = 4;
S5MAP['w'] = 4;
S5MAP['S'] = 4;
S5MAP['s'] = 4;
S5MAP['B'] = 4;
S5MAP['b'] = 4;
S5MAP['D'] = 4;
S5MAP['d'] = 4;
S5MAP['H'] = 4;
S5MAP['h'] = 4;
S5MAP['V'] = 4;
S5MAP['v'] = 4;
S5MAP['N'] = 4;
S5MAP['n'] = 4;
S16MAP['A'] = 8;
S16MAP['a'] = 8;
S16MAP['C'] = 4;
S16MAP['c'] = 4;
S16MAP['G'] = 2;
S16MAP['g'] = 2;
S16MAP['T'] = 1;
S16MAP['t'] = 1;
S16MAP['R'] = 10;
S16MAP['r'] = 10;
S16MAP['Y'] = 5;
S16MAP['y'] = 5;
S16MAP['M'] = 12;
S16MAP['m'] = 12;
S16MAP['K'] = 3;
S16MAP['k'] = 3;
S16MAP['W'] = 9;
S16MAP['w'] = 9;
S16MAP['S'] = 6;
S16MAP['s'] = 6;
S16MAP['B'] = 7;
S16MAP['b'] = 7;
S16MAP['D'] = 11;
S16MAP['d'] = 11;
S16MAP['H'] = 13;
S16MAP['h'] = 13;
S16MAP['V'] = 14;
S16MAP['v'] = 14;
S16MAP['N'] = 15;
S16MAP['n'] = 15;
MAP_READY = 1;
}
| false | false | false | false | false | 0 |
openDosageDialog()
{
if (m_CurrentView) {
Q_ASSERT(m_CurrentView->prescriptionView());
m_CurrentView->prescriptionView()->showDosageDialog();
}
}
| false | false | false | false | false | 0 |
add_dense_dense(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &C)
{
CSYMPY_ASSERT(A.row_ == B.row_ && A.col_ == B.col_ &&
A.row_ == C.row_ && A.col_ == C.col_);
unsigned row = A.row_, col = A.col_;
for (unsigned i = 0; i < row; i++) {
for (unsigned j = 0; j < col; j++) {
C.m_[i*col + j] = add(A.m_[i*col + j], B.m_[i*col + j]);
}
}
}
| false | false | false | false | false | 0 |
_exvGettext(const char* str)
{
static bool exvGettextInitialized = false;
if (!exvGettextInitialized) {
bindtextdomain(EXV_PACKAGE, EXV_LOCALEDIR);
# ifdef EXV_HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (EXV_PACKAGE, "UTF-8");
# endif
exvGettextInitialized = true;
}
return dgettext(EXV_PACKAGE, str);
}
| false | false | false | false | false | 0 |
ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
{
#ifdef HAVE_CURL
int res = -1;
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set");
return EINA_FALSE;
}
if (!url_con->url) return EINA_FALSE;
if (url_con->dead) return EINA_FALSE;
if (!password) return EINA_FALSE;
if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
{
ERR("Proxy type should be socks5 and above");
return EINA_FALSE;
}
res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
if (res != CURLE_OK)
{
ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res));
return EINA_FALSE;
}
return EINA_TRUE;
#else
return EINA_FALSE;
(void)url_con;
(void)password;
#endif
}
| false | false | false | false | false | 0 |
createAsmStreamer(MCContext &Context,
std::unique_ptr<formatted_raw_ostream> OS,
bool isVerboseAsm, bool useDwarfDirectory,
MCInstPrinter *IP, MCCodeEmitter *CE,
MCAsmBackend *MAB, bool ShowInst) {
return new MCAsmStreamer(Context, std::move(OS), isVerboseAsm,
useDwarfDirectory, IP, CE, MAB, ShowInst);
}
| false | false | false | false | false | 0 |
nfs_idmap_lookup_id(const char *name, size_t namelen, const char *type,
__u32 *id, struct idmap *idmap)
{
char id_str[NFS_UINT_MAXLEN];
long id_long;
ssize_t data_size;
int ret = 0;
data_size = nfs_idmap_get_key(name, namelen, type, id_str, NFS_UINT_MAXLEN, idmap);
if (data_size <= 0) {
ret = -EINVAL;
} else {
ret = kstrtol(id_str, 10, &id_long);
*id = (__u32)id_long;
}
return ret;
}
| true | true | false | false | true | 1 |
set_width(unsigned w, bool)
{
unsigned sum = 0;
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1)
if (parms_[idx] != 0)
sum += parms_[idx]->expr_width();
sum *= repeat();
expr_width(sum);
if (sum != w) return false;
return true;
}
| false | false | false | false | false | 0 |
_Py_dg_infinity(int sign)
{
U rv;
word0(&rv) = POSINF_WORD0;
word1(&rv) = POSINF_WORD1;
return sign ? -dval(&rv) : dval(&rv);
}
| false | false | false | false | false | 0 |
img_color_allocate_alpha_tri(img, r, g, b, a)
VALUE img, r, g, b, a;
{
gdImagePtr im;
int c;
Data_Get_Struct(img, gdImage, im);
c = gdImageColorAllocateAlpha(im, NUM2INT(r), NUM2INT(g), NUM2INT(b), NUM2INT(a));
return INT2NUM(c);
}
| false | false | false | false | false | 0 |
hash_setup(char *str)
{
struct ima_template_desc *template_desc = ima_template_desc_current();
int i;
if (hash_setup_done)
return 1;
if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) {
if (strncmp(str, "sha1", 4) == 0)
ima_hash_algo = HASH_ALGO_SHA1;
else if (strncmp(str, "md5", 3) == 0)
ima_hash_algo = HASH_ALGO_MD5;
else
return 1;
goto out;
}
for (i = 0; i < HASH_ALGO__LAST; i++) {
if (strcmp(str, hash_algo_name[i]) == 0) {
ima_hash_algo = i;
break;
}
}
if (i == HASH_ALGO__LAST)
return 1;
out:
hash_setup_done = 1;
return 1;
}
| false | false | false | false | false | 0 |
ffm_write_data(AVFormatContext *s,
const uint8_t *buf, int size,
int64_t dts, int header)
{
FFMContext *ffm = s->priv_data;
int len;
if (header && ffm->frame_offset == 0) {
ffm->frame_offset = ffm->packet_ptr - ffm->packet + FFM_HEADER_SIZE;
ffm->dts = dts;
}
/* write as many packets as needed */
while (size > 0) {
len = ffm->packet_end - ffm->packet_ptr;
if (len > size)
len = size;
memcpy(ffm->packet_ptr, buf, len);
ffm->packet_ptr += len;
buf += len;
size -= len;
if (ffm->packet_ptr >= ffm->packet_end)
flush_packet(s);
}
}
| false | true | false | false | false | 1 |
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State)
{
ACPI_FUNCTION_ENTRY ();
/* Ignore null state */
if (State)
{
(void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
}
return;
}
| false | false | false | false | false | 0 |
wincursor(pdfapp_t *app, int curs)
{
if (curs == ARROW)
XDefineCursor(xdpy, xwin, xcarrow);
if (curs == HAND)
XDefineCursor(xdpy, xwin, xchand);
if (curs == WAIT)
XDefineCursor(xdpy, xwin, xcwait);
if (curs == CARET)
XDefineCursor(xdpy, xwin, xccaret);
XFlush(xdpy);
}
| false | false | false | false | false | 0 |
htmlize_to_blob(Blob *p, const char *zIn, int n){
int c, i, j;
if( n<0 ) n = strlen(zIn);
for(i=j=0; i<n; i++){
c = zIn[i];
switch( c ){
case '<':
if( j<i ) blob_append(p, zIn+j, i-j);
blob_append(p, "<", 4);
j = i+1;
break;
case '>':
if( j<i ) blob_append(p, zIn+j, i-j);
blob_append(p, ">", 4);
j = i+1;
break;
case '&':
if( j<i ) blob_append(p, zIn+j, i-j);
blob_append(p, "&", 5);
j = i+1;
break;
case '"':
if( j<i ) blob_append(p, zIn+j, i-j);
blob_append(p, """, 6);
j = i+1;
break;
}
}
if( j<i ) blob_append(p, zIn+j, i-j);
}
| false | false | false | false | false | 0 |
cache_rrset_register(cache_hash_t *hash, dns_cache_rrset_t *rrset, unsigned hvalue, dns_tls_t *tls)
{
int index;
if (cache_rrset_retain(rrset) < 0)
return -1;
index = hvalue % NELEMS(hash->hash_array);
if (hash->hash_array[index] == NULL) {
if (ATOMIC_CAS_PTR(&hash->hash_array[index], NULL, rrset))
return 0;
else {
/* retained in this function */
cache_rrset_release(rrset, tls);
return -1;
}
}
if (cache_rrset_register_force(hash, rrset, index, tls) < 0) {
/* retained in this function */
cache_rrset_release(rrset, tls);
return -1;
}
/* keep refcount */
return 0;
}
| false | false | false | false | false | 0 |
CDMakePolygon(SymbolDesc,Layer,Path,Pointer)
struct s *SymbolDesc;
int Layer;
struct p *Path;
struct o **Pointer;
{
struct po *PolygonDesc;
struct o *ObjectDesc;
struct p *Pair;
int i;
CDCheckPath(Path);
for (i = 0, Pair = Path; Pair; Pair = Pair->pSucc, i++) ;
if (!CDBogusPoly && i < 4) {
*Pointer = NULL;
return (True);
}
if ((PolygonDesc = alloc(po)) == NULL)
return (CDError(CDMALLOCFAILED));
if ((ObjectDesc = alloc(o)) == NULL)
return (CDError(CDMALLOCFAILED));
PolygonDesc->poPath = Path;
ObjectDesc->oRep = (struct o *)PolygonDesc;
ObjectDesc->oPrptyList = NULL;
ObjectDesc->oInfo = 0;
ObjectDesc->oType = CDPOLYGON;
ObjectDesc->oLayer = Layer;
ObjectDesc->oLeft = ObjectDesc->oBottom = CDINFINITY;
ObjectDesc->oRight = ObjectDesc->oTop = -CDINFINITY;
Pair = Path;
while(Pair != NULL) {
if (ObjectDesc->oLeft > Pair->pX)
ObjectDesc->oLeft = Pair->pX;
if (ObjectDesc->oRight < Pair->pX)
ObjectDesc->oRight = Pair->pX;
if (ObjectDesc->oBottom > Pair->pY)
ObjectDesc->oBottom = Pair->pY;
if (ObjectDesc->oTop < Pair->pY)
ObjectDesc->oTop = Pair->pY;
Pair = Pair->pSucc;
}
*Pointer = ObjectDesc;
if (Not CDInsertObjectDesc(SymbolDesc,ObjectDesc))
return (False);
return (True);
}
| false | false | false | false | false | 0 |
orte_grpcomm_base_pack_collective(opal_buffer_t *relay,
orte_jobid_t jobid,
orte_grpcomm_collective_t *coll,
orte_grpcomm_internal_stage_t stg)
{
opal_dss.pack(relay, &coll->id, 1, ORTE_GRPCOMM_COLL_ID_T);
if (ORTE_GRPCOMM_INTERNAL_STG_LOCAL == stg) {
opal_dss.pack(relay, &jobid, 1, ORTE_JOBID);
opal_dss.pack(relay, &coll->num_local_recvd, 1, ORTE_VPID);
opal_dss.copy_payload(relay, &coll->local_bucket);
} else if (ORTE_GRPCOMM_INTERNAL_STG_APP == stg) {
/* don't need the jobid here as the recipient can get
* it from the sender's name
*/
opal_dss.copy_payload(relay, &coll->buffer);
} else if (ORTE_GRPCOMM_INTERNAL_STG_GLOBAL == stg) {
opal_dss.pack(relay, &jobid, 1, ORTE_JOBID);
opal_dss.pack(relay, &coll->num_global_recvd, 1, ORTE_VPID);
opal_dss.copy_payload(relay, &coll->buffer);
} else {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
}
}
| false | false | false | false | false | 0 |
TMX_TestStepOffset(void)
{
struct timex txc;
/* Zero maxerror and check it's reset to a maximum after ADJ_SETOFFSET.
This seems to be the only way how to verify that the kernel really
supports the ADJ_SETOFFSET mode as it doesn't return an error on unknown
mode. */
txc.modes = ADJ_MAXERROR;
txc.maxerror = 0;
if (adjtimex(&txc) < 0 || txc.maxerror != 0)
return -1;
txc.modes = ADJ_SETOFFSET;
txc.time.tv_sec = 0;
txc.time.tv_usec = 0;
if (adjtimex(&txc) < 0 || txc.maxerror < 100000)
return -1;
return 0;
}
| false | false | false | false | false | 0 |
GetSpatialRef()
{
if (m_nMainTableIndex == -1)
{
CPLError(CE_Failure, CPLE_AssertionFailed,
"GetSpatialRef() failed: file has not been opened yet.");
return NULL;
}
return m_papoTABFiles[m_nMainTableIndex]->GetSpatialRef();
}
| false | false | false | false | false | 0 |
ProcessPreview(OFLibDlg *d,PreviewThread *cur) {
char *pt, *name;
FILE *final;
int ch;
cur->fi->downloading_in_background = false;
if ( cur->result==NULL ) /* Finished, but didn't work */
return;
rewind(cur->result);
pt = strrchr(cur->active->url,'/');
if ( pt==NULL ) { /* Can't happen */
fclose(cur->result);
return;
}
name = galloc(strlen(getOFLibDir()) + strlen(pt) + 10 );
sprintf( name,"%s%s", getOFLibDir(), pt);
final = fopen(name,"w");
if ( final==NULL ) {
fclose(cur->result);
return;
}
GDrawSetCursor(d->gw,ct_watch);
if ( cur->is_image ) {
while ( (ch=getc(cur->result))!=EOF )
putc(ch,final);
fclose(final);
fclose(cur->result);
} else {
SplineFont *sf = _ReadSplineFont(cur->result,cur->active->url,0);
/* The above routine closes cur->result */
if ( sf==NULL ) {
fclose(final);
unlink(name);
free(name);
GDrawSetCursor(d->gw,ct_mypointer);
return;
}
pt = strrchr(name,'.');
if ( pt==NULL || pt<strrchr(name,'/') )
strcat(name,".png");
else
strcpy(pt,".png");
SFDefaultImage(sf,name);
SplineFontFree(sf);
}
cur->fi->preview_filename = copy(strrchr(name,'/')+1);
free(name);
OFLibEnableButtons(d); /* This will load the image */
DumpOFLibState(&d->all);
GDrawSetCursor(d->gw,ct_mypointer);
}
| false | true | false | false | true | 1 |
send_echo (PING * ping)
{
size_t off = 0;
int rc;
if (PING_TIMING (data_length))
{
struct timeval tv;
gettimeofday (&tv, NULL);
ping_set_data (ping, &tv, 0, sizeof (tv), USE_IPV6);
off += sizeof (tv);
}
if (data_buffer)
ping_set_data (ping, data_buffer, off,
data_length > off ? data_length - off : data_length,
USE_IPV6);
rc = ping_xmit (ping);
if (rc < 0)
error (EXIT_FAILURE, errno, "sending packet");
return rc;
}
| false | false | false | false | false | 0 |
doc2000_read_byte(struct mtd_info *mtd)
{
struct nand_chip *this = mtd->priv;
struct doc_priv *doc = this->priv;
void __iomem *docptr = doc->virtadr;
u_char ret;
ReadDOC(docptr, CDSNSlowIO);
DoC_Delay(doc, 2);
ret = ReadDOC(docptr, 2k_CDSN_IO);
if (debug)
printk("read_byte returns %02x\n", ret);
return ret;
}
| false | false | false | false | false | 0 |
setSize(int x, int y)
{
if (x == xTiles() && y == yTiles()) {
return;
}
delete [] m_field;
m_field = new int[ x * y ];
m_xTiles = x;
m_yTiles = y;
for (int i = 0; i < x; ++i) {
for (int j = 0; j < y; ++j) {
setField(i, j, EMPTY);
}
}
// set the minimum size of the scalable window
const double MINIMUM_SCALE = 0.2;
int w = qRound(m_tiles.qWidth() * 2.0 * MINIMUM_SCALE) * xTiles();
int h = qRound(m_tiles.qHeight() * 2.0 * MINIMUM_SCALE) * yTiles();
w += m_tiles.width();
h += m_tiles.width();
setMinimumSize(w, h);
resizeBoard();
newGame();
emit changed();
}
| false | false | false | false | false | 0 |
sdbm_datfno(DBM *db)
{
sdbm_check(db);
if G_UNLIKELY(db->flags & DBM_BROKEN)
return -1;
#ifdef BIGDATA
return big_datfno(db);
#else
return -1;
#endif
}
| false | false | false | false | false | 0 |
handle_subagent_response(int op, netsnmp_session * session, int reqid,
netsnmp_pdu *pdu, void *magic)
{
ns_subagent_magic *smagic = (ns_subagent_magic *) magic;
netsnmp_variable_list *u = NULL, *v = NULL;
int rc = 0;
if (_invalid_op_and_magic(op, magic)) {
return 1;
}
pdu = snmp_clone_pdu(pdu);
DEBUGMSGTL(("agentx/subagent",
"handling AgentX response (cmd 0x%02x orig_cmd 0x%02x)"
" (req=0x%x,trans=0x%x,sess=0x%x)\n",
pdu->command, smagic->original_command,
(unsigned)pdu->reqid, (unsigned)pdu->transid,
(unsigned)pdu->sessid));
#ifndef NETSNMP_NO_WRITE_SUPPORT
if (pdu->command == SNMP_MSG_INTERNAL_SET_FREE ||
pdu->command == SNMP_MSG_INTERNAL_SET_UNDO ||
pdu->command == SNMP_MSG_INTERNAL_SET_COMMIT) {
free_set_vars(smagic->session, pdu);
}
#endif /* !NETSNMP_NO_WRITE_SUPPORT */
if (smagic->original_command == AGENTX_MSG_GETNEXT) {
DEBUGMSGTL(("agentx/subagent",
"do getNext scope processing %p %p\n", smagic->ovars,
pdu->variables));
for (u = smagic->ovars, v = pdu->variables; u != NULL && v != NULL;
u = u->next_variable, v = v->next_variable) {
if (snmp_oid_compare
(u->val.objid, u->val_len / sizeof(oid), nullOid,
nullOidLen/sizeof(oid)) != 0) {
/*
* The master agent requested scoping for this variable.
*/
rc = snmp_oid_compare(v->name, v->name_length,
u->val.objid,
u->val_len / sizeof(oid));
DEBUGMSGTL(("agentx/subagent", "result "));
DEBUGMSGOID(("agentx/subagent", v->name, v->name_length));
DEBUGMSG(("agentx/subagent", " scope to "));
DEBUGMSGOID(("agentx/subagent",
u->val.objid, u->val_len / sizeof(oid)));
DEBUGMSG(("agentx/subagent", " result %d\n", rc));
if (rc >= 0) {
/*
* The varbind is out of scope. From RFC2741, p. 66: "If
* the subagent cannot locate an appropriate variable,
* v.name is set to the starting OID, and the VarBind is
* set to `endOfMibView'".
*/
snmp_set_var_objid(v, u->name, u->name_length);
snmp_set_var_typed_value(v, SNMP_ENDOFMIBVIEW, NULL, 0);
DEBUGMSGTL(("agentx/subagent",
"scope violation -- return endOfMibView\n"));
}
} else {
DEBUGMSGTL(("agentx/subagent", "unscoped var\n"));
}
}
}
/*
* XXXJBPN: similar for GETBULK but the varbinds can get re-ordered I
* think which makes it er more difficult.
*/
if (smagic->ovars != NULL) {
snmp_free_varbind(smagic->ovars);
}
pdu->command = AGENTX_MSG_RESPONSE;
pdu->version = smagic->session->version;
if (!snmp_send(smagic->session, pdu)) {
snmp_free_pdu(pdu);
}
DEBUGMSGTL(("agentx/subagent", " FINISHED\n"));
free(smagic);
return 1;
}
| false | false | false | false | false | 0 |
irmo_server_assign_id(IrmoServer *server)
{
IrmoClientID result;
// Loop until next_id reaches an unused ID.
do {
result = server->next_id;
server->next_id = (server->next_id + 1) & 0xffff;
} while (irmo_hash_table_lookup(server->clients_by_id,
IRMO_POINTER_KEY(result)) != NULL);
return result;
}
| false | false | false | false | false | 0 |
__lambda9_ (FsoTestGsmCallTest* self, GAsyncResult* res, GError** error) {
FreeSmartphoneGSMNetwork* _tmp0_ = NULL;
GAsyncResult* _tmp1_ = NULL;
GError * _inner_error_ = NULL;
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
g_return_if_fail (res != NULL);
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
_tmp0_ = ((FsoTestGsmBaseTest*) self)->gsm_network;
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
_tmp1_ = res;
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
free_smartphone_gsm_network_get_signal_strength_finish (_tmp0_, _tmp1_, &_inner_error_);
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
if (_inner_error_ != NULL) {
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
g_propagate_error (error, _inner_error_);
#line 157 "/tmp/buildd/fso-gsmd-0.12.0/tests/integration/calltests.vala"
return;
#line 2482 "calltests.c"
}
}
| false | false | false | false | false | 0 |
EmptyIA()
{
EmptyAddr();
ClntCfgIALst.append(new TClntCfgIA());
ClntCfgIALst.getLast()->setOptions(ParserOptStack.getLast());
//ClntCfgIALst.getLast()->addAddr(ClntCfgAddrLst.getLast());
}
| false | false | false | false | false | 0 |
run_remote_archiver(const char *remote, int argc,
const char **argv)
{
char *url, buf[LARGE_PACKET_MAX];
int fd[2], i, len, rv;
pid_t pid;
const char *exec = "git-upload-archive";
int exec_at = 0;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!prefixcmp(arg, "--exec=")) {
if (exec_at)
die("multiple --exec specified");
exec = arg + 7;
exec_at = i;
break;
}
}
url = xstrdup(remote);
pid = git_connect(fd, url, exec, 0);
if (pid < 0)
return pid;
for (i = 1; i < argc; i++) {
if (i == exec_at)
continue;
packet_write(fd[1], "argument %s\n", argv[i]);
}
packet_flush(fd[1]);
len = packet_read_line(fd[0], buf, sizeof(buf));
if (!len)
die("git-archive: expected ACK/NAK, got EOF");
if (buf[len-1] == '\n')
buf[--len] = 0;
if (strcmp(buf, "ACK")) {
if (len > 5 && !prefixcmp(buf, "NACK "))
die("git-archive: NACK %s", buf + 5);
die("git-archive: protocol error");
}
len = packet_read_line(fd[0], buf, sizeof(buf));
if (len)
die("git-archive: expected a flush");
/* Now, start reading from fd[0] and spit it out to stdout */
rv = recv_sideband("archive", fd[0], 1, 2);
close(fd[0]);
close(fd[1]);
rv |= finish_connect(pid);
return !!rv;
}
| false | false | false | false | false | 0 |
eprn_map_rgb_color_for_RGB(gx_device *device,
const gx_color_value cv[])
{
gx_color_value red = cv[0], green = cv[1], blue = cv[2];
static const gx_color_value half = gx_max_color_value/2;
gx_color_index value = 0;
const eprn_Device *dev = (eprn_Device *)device;
#ifdef EPRN_TRACE
if_debug3(EPRN_TRACE_CHAR,
"! eprn_map_rgb_color_for_RGB() called for RGB = (%hu, %hu, %hu),\n",
red, green, blue);
#endif
assert(dev->eprn.colour_model == eprn_DeviceRGB);
if (red > half) value |= RED_BIT;
if (green > half) value |= GREEN_BIT;
if (blue > half) value |= BLUE_BIT;
#ifdef EPRN_TRACE
if_debug1(EPRN_TRACE_CHAR, " returning 0x%lX.\n", (unsigned long)value);
#endif
return value;
}
| false | false | false | false | false | 0 |
readFillStyles(ShapeRecord::FillStyles& styles, SWFStream& in,
SWF::TagType tag, movie_definition& m, const RunResources& /*r*/)
{
in.ensureBytes(1);
boost::uint16_t fillcount = in.read_u8();
if (tag != SWF::DEFINESHAPE) {
if (fillcount == 0xff) {
in.ensureBytes(2);
fillcount = in.read_u16();
}
}
IF_VERBOSE_PARSE(
log_parse(_(" fill styles: %1%"), fillcount);
);
// Read the styles.
styles.reserve(styles.size() + fillcount);
for (boost::uint16_t i = 0; i < fillcount; ++i) {
OptionalFillPair fp = readFills(in, tag, m, false);
styles.push_back(fp.first);
IF_VERBOSE_PARSE(
log_parse(_(" Read fill: %1%"), fp.first);
);
}
}
| false | false | false | false | false | 0 |
cleanup_fdlpenv_plans()
{
for (int i = 0; i < num_fdlpenv_plans; i++)
{
if (fdlpenv_plans != NULL)
{
if (fdlpenv_plans[i] != NULL)
{
lock_mutex(&fftw_mutex);
fftw_destroy_plan(fdlpenv_plans[i]);
unlock_mutex(&fftw_mutex);
}
}
if (fdlpenv_input_buffers != NULL)
{
if (fdlpenv_input_buffers[i] != NULL)
{
FREE(fdlpenv_input_buffers[i]);
fdlpenv_input_buffers[i] = NULL;
}
}
if (fdlpenv_output_buffers != NULL)
{
if (fdlpenv_output_buffers[i] != NULL)
{
FREE(fdlpenv_output_buffers[i]);
fdlpenv_output_buffers[i] = NULL;
}
}
}
if (fdlpenv_plans != NULL)
{
FREE(fdlpenv_plans);
fdlpenv_plans = NULL;
}
if (fdlpenv_plan_sizes != NULL)
{
FREE(fdlpenv_plan_sizes);
fdlpenv_plan_sizes = NULL;
}
if (fdlpenv_input_buffers != NULL)
{
FREE(fdlpenv_input_buffers);
fdlpenv_input_buffers = NULL;
}
if (fdlpenv_output_buffers != NULL)
{
FREE(fdlpenv_output_buffers);
fdlpenv_output_buffers = NULL;
}
num_fdlpenv_plans = 0;
}
| false | false | false | false | false | 0 |
nvidiafb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{
struct nvidia_par *par = info->par;
if (info->state != FBINFO_STATE_RUNNING)
return;
if (par->lockup) {
cfb_copyarea(info, region);
return;
}
NVDmaStart(info, par, BLIT_POINT_SRC, 3);
NVDmaNext(par, (region->sy << 16) | region->sx);
NVDmaNext(par, (region->dy << 16) | region->dx);
NVDmaNext(par, (region->height << 16) | region->width);
NVDmaKickoff(par);
}
| false | false | false | false | false | 0 |
listCert(char* tokenName) {
/* int expired = 0; */
CERTCertList *certList;
CERTCertListNode *cln;
PK11SlotInfo *slot = PK11_FindSlotByName(tokenName);
PK11SlotInfo *internal_slot;
char *internalTokenName;
if (!slot) {
errorRpt(GENERAL_FAILURE, getResourceString(DBT_TOKEN_NAME));
return;
}
if (PK11_IsInternal(slot)) {
internal_slot = slot;
} else {
internal_slot = PK11_GetInternalKeySlot();
if (!internal_slot) {
errorRpt(GENERAL_FAILURE, getResourceString(DBT_INIT_FAIL));
return;
}
}
internalTokenName = PK11_GetTokenName(internal_slot);
if (PK11_NeedUserInit(internal_slot) == PR_TRUE) {
fprintf(stdout, "<NEEDINIT_INTERNAL>TRUE</NEEDINIT_INTERNAL>\n");
} else {
fprintf(stdout, "<NEEDINIT_INTERNAL>FALSE</NEEDINIT_INTERNAL>\n");
}
certList = PK11_ListCerts(PK11CertListUnique, NULL);
if (certList == NULL) {
errorRpt(GENERAL_FAILURE, getResourceString(DBT_CERT_LIST_FAIL));
}
for (cln = CERT_LIST_HEAD(certList); !CERT_LIST_END(cln,certList);
cln = CERT_LIST_NEXT(cln)) {
char *certTokenName=NULL;
if (cln->cert->slot == NULL) {
certTokenName = internalTokenName;
}
else {
certTokenName = PK11_GetTokenName(cln->cert->slot);
}
/* Output the cert if it belongs to this token */
if (strcmp(tokenName, certTokenName) == 0) {
printCert(cln->cert, /*showDetail=*/PR_FALSE, NULL);
}
/*
* List "Builtin Object Token" as if it is the internal token
* This is a special NSS read-only token for storing predefined CA certs
*/
else if ((strcmp(tokenName, internalTokenName) == 0) &&
(strcmp(certTokenName, "Builtin Object Token") == 0)) {
printCert(cln->cert, /*showDetail=*/PR_FALSE, NULL);
}
}
CERT_DestroyCertList(certList);
if (PK11_IsInternal(slot)) {
showCRL(certdb, SEC_CRL_TYPE);
showCRL(certdb, SEC_KRL_TYPE);
}
if (slot != internal_slot) {
PK11_FreeSlot(internal_slot);
}
PK11_FreeSlot(slot);
}
| false | false | false | false | false | 0 |
nodir(spec, file)
STR spec, file; {
pchar ch;
ch = strrchr(spec, SLASH_CHAR);
if (!ch) ch = file; else ch++;
strcpy(file, ch);
}
| false | false | false | false | true | 1 |
aac_decode_close(AVCodecContext * avccontext) {
AACContext * ac = avccontext->priv_data;
int i, type;
for (i = 0; i < MAX_ELEM_ID; i++) {
for(type = 0; type < 4; type++)
av_freep(&ac->che[type][i]);
}
ff_mdct_end(&ac->mdct);
ff_mdct_end(&ac->mdct_small);
return 0 ;
}
| false | false | false | false | false | 0 |
d_identifier (struct d_info *di, int len)
{
const char *name;
name = d_str (di);
if (di->send - name < len)
return NULL;
d_advance (di, len);
/* A Java mangled name may have a trailing '$' if it is a C++
keyword. This '$' is not included in the length count. We just
ignore the '$'. */
if ((di->options & DMGL_JAVA) != 0
&& d_peek_char (di) == '$')
d_advance (di, 1);
/* Look for something which looks like a gcc encoding of an
anonymous namespace, and replace it with a more user friendly
name. */
if (len >= (int) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2
&& memcmp (name, ANONYMOUS_NAMESPACE_PREFIX,
ANONYMOUS_NAMESPACE_PREFIX_LEN) == 0)
{
const char *s;
s = name + ANONYMOUS_NAMESPACE_PREFIX_LEN;
if ((*s == '.' || *s == '_' || *s == '$')
&& s[1] == 'N')
{
di->expansion -= len - sizeof "(anonymous namespace)";
return d_make_name (di, "(anonymous namespace)",
sizeof "(anonymous namespace)" - 1);
}
}
return d_make_name (di, name, len);
}
| false | false | false | false | false | 0 |
from_file_input(void *buf, unsigned int buf_len, void *handle)
{
FILE *fstream = handle;
size_t result;
result = fread(buf, 1, buf_len, fstream);
if (result <= 0) {
if (feof(fstream)) {
return 0;
} else {
return -1;
}
} else {
return (int) result;
}
}
| false | false | false | false | true | 1 |
cleanUp(imp_sth_t *imp_sth) {
int i;
int numCols = DBIc_NUM_FIELDS(imp_sth);
for (i = 0; i < numCols; ++i) {
if (imp_sth->coldata[i].type == CS_CHAR_TYPE
|| imp_sth->coldata[i].type == CS_LONGCHAR_TYPE
|| imp_sth->coldata[i].type == CS_TEXT_TYPE
|| imp_sth->coldata[i].type == CS_IMAGE_TYPE) {
Safefree(imp_sth->coldata[i].value.c);
}
}
if (imp_sth->datafmt)
Safefree(imp_sth->datafmt);
if (imp_sth->coldata)
Safefree(imp_sth->coldata);
imp_sth->numCols = 0;
imp_sth->coldata = NULL;
imp_sth->datafmt = NULL;
}
| false | false | false | false | false | 0 |
addPlanet(Sector *sector, Player *player, int production, double killpercentage)
{
new Planet(UniquePlanetName(), sector, player, production, killpercentage);
}
| false | false | false | false | false | 0 |
l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
v = l2t_get_idx(seq, *pos);
if (v)
++*pos;
return v;
}
| false | false | false | false | false | 0 |
calc_filter_buf_size(TABLE *table, const prep_stmt& pst,
const record_filter *filters)
{
size_t filter_buf_len = 0;
for (const record_filter *f = filters; f->op.begin() != 0; ++f) {
if (f->val.begin() == 0) {
continue;
}
const uint32_t fn = pst.get_filter_fields()[f->ff_offset];
filter_buf_len += table->field[fn]->pack_length();
}
++filter_buf_len;
/* Field_medium::cmp() calls uint3korr(), which may read 4 bytes.
Allocate 1 more byte for safety. */
return filter_buf_len;
}
| false | false | false | false | false | 0 |
libmail_gpg_deletekey(const char *gpgdir, int secret,
const char *fingerprint,
int (*dump_func)(const char *, size_t, void *),
void *voidarg)
{
char *argvec[8];
int rc;
argvec[0]="gpg";
argvec[1]="--command-fd";
argvec[2]="0";
argvec[3]= secret ? "--delete-secret-key":"--delete-key";
argvec[4]="-q";
argvec[5]="--no-tty";
argvec[6]=(char *)fingerprint;
argvec[7]=0;
if (libmail_gpg_fork(&libmail_gpg_stdin, &libmail_gpg_stdout, NULL,
gpgdir, argvec) < 0)
rc= -1;
else
{
int rc2;
rc=dodeletekey(dump_func, voidarg);
rc2=libmail_gpg_cleanup();
if (rc2)
rc=rc2;
}
return (rc);
}
| true | true | false | false | false | 1 |
add_graph_edge (constraint_graph_t graph, unsigned int to,
unsigned int from)
{
if (to == from)
{
return false;
}
else
{
bool r = false;
if (!graph->succs[from])
graph->succs[from] = BITMAP_ALLOC (&pta_obstack);
if (bitmap_set_bit (graph->succs[from], to))
{
r = true;
if (to < FIRST_REF_NODE && from < FIRST_REF_NODE)
stats.num_edges++;
}
return r;
}
}
| false | false | false | false | false | 0 |
__update_selected(struct lacpdu *lacpdu, struct port *port)
{
if (lacpdu && port) {
const struct port_params *partner = &port->partner_oper;
/* check if any parameter is different then
* update the state machine selected variable.
*/
if (ntohs(lacpdu->actor_port) != partner->port_number ||
ntohs(lacpdu->actor_port_priority) != partner->port_priority ||
!MAC_ADDRESS_EQUAL(&lacpdu->actor_system, &partner->system) ||
ntohs(lacpdu->actor_system_priority) != partner->system_priority ||
ntohs(lacpdu->actor_key) != partner->key ||
(lacpdu->actor_state & AD_STATE_AGGREGATION) != (partner->port_state & AD_STATE_AGGREGATION)) {
port->sm_vars &= ~AD_PORT_SELECTED;
}
}
}
| false | false | false | false | false | 0 |
tdb_direct(struct tdb_context *tdb, tdb_off_t off, size_t len,
bool write_mode)
{
enum TDB_ERROR ecode;
if (unlikely(!tdb->file->map_ptr))
return NULL;
ecode = tdb_oob(tdb, off + len, false);
if (unlikely(ecode != TDB_SUCCESS))
return TDB_ERR_PTR(ecode);
return (char *)tdb->file->map_ptr + off;
}
| false | false | false | false | false | 0 |
waitForThread( ThreadIdentifierCref anId )
throw ( InvalidThreadException )
{
ThreadContextCref aContext(Thread::getThreadContext(anId));
Int aStatus(0);
waitpid(anId.getScalar(),&aStatus,0);
return aStatus;
}
| false | false | false | false | false | 0 |
font_family_convert (font_family_t const *self,
ccss_property_type_t target,
void *value)
{
/* Only conversion to string is supported. */
if (CCSS_PROPERTY_TYPE_STRING == target) {
* (char **) value = g_strdup (self->font_family);
return true;
}
return false;
}
| false | false | false | false | false | 0 |
visit(ir_dereference_record *ir)
{
const glsl_type *struct_type = ir->record->type;
ir->record->accept(this);
unsigned int offset = 0;
for (unsigned int i = 0; i < struct_type->length; i++) {
if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0)
break;
offset += type_size(struct_type->fields.structure[i].type);
}
this->result.reg_offset += offset;
this->result.type = brw_type_for_base_type(ir->type);
}
| false | false | false | false | false | 0 |
entangle_camera_picker_finalize(GObject *object)
{
EntangleCameraPicker *picker = ENTANGLE_CAMERA_PICKER(object);
EntangleCameraPickerPrivate *priv = picker->priv;
ENTANGLE_DEBUG("Finalize camera picker");
gtk_list_store_clear(priv->model);
if (priv->cameras)
g_object_unref(priv->cameras);
g_object_unref(priv->model);
g_object_unref(priv->builder);
G_OBJECT_CLASS(entangle_camera_picker_parent_class)->finalize(object);
}
| false | false | false | false | false | 0 |
elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
{
struct elf_obj_sy *srcelf = symbol_get_obj (src);
struct elf_obj_sy *destelf = symbol_get_obj (dest);
if (srcelf->size)
{
if (destelf->size == NULL)
destelf->size = (expressionS *) xmalloc (sizeof (expressionS));
*destelf->size = *srcelf->size;
}
else
{
if (destelf->size != NULL)
free (destelf->size);
destelf->size = NULL;
}
S_SET_SIZE (dest, S_GET_SIZE (src));
/* Don't copy visibility. */
S_SET_OTHER (dest, (ELF_ST_VISIBILITY (S_GET_OTHER (dest))
| (S_GET_OTHER (src) & ~ELF_ST_VISIBILITY (-1))));
}
| false | false | false | false | false | 0 |
DoParseProgram(Handle<String> source,
bool in_global_context,
StrictModeFlag strict_mode,
ZoneScope* zone_scope) {
ASSERT(target_stack_ == NULL);
if (pre_data_ != NULL) pre_data_->Initialize();
// Compute the parsing mode.
mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
Scope::Type type =
in_global_context
? Scope::GLOBAL_SCOPE
: Scope::EVAL_SCOPE;
Handle<String> no_name = isolate()->factory()->empty_symbol();
FunctionLiteral* result = NULL;
{ Scope* scope = NewScope(top_scope_, type, inside_with());
LexicalScope lexical_scope(this, scope, isolate());
if (strict_mode == kStrictMode) {
top_scope_->EnableStrictMode();
}
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16);
bool ok = true;
int beg_loc = scanner().location().beg_pos;
ParseSourceElements(body, Token::EOS, &ok);
if (ok && top_scope_->is_strict_mode()) {
CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok);
}
if (ok && harmony_block_scoping_) {
CheckConflictingVarDeclarations(scope, &ok);
}
if (ok) {
result = new(zone()) FunctionLiteral(
isolate(),
no_name,
top_scope_,
body,
lexical_scope.materialized_literal_count(),
lexical_scope.expected_property_count(),
lexical_scope.only_simple_this_property_assignments(),
lexical_scope.this_property_assignments(),
0,
0,
source->length(),
FunctionLiteral::ANONYMOUS_EXPRESSION,
false); // Does not have duplicate parameters.
} else if (stack_overflow_) {
isolate()->StackOverflow();
}
}
// Make sure the target stack is empty.
ASSERT(target_stack_ == NULL);
// If there was a syntax error we have to get rid of the AST
// and it is not safe to do so before the scope has been deleted.
if (result == NULL) zone_scope->DeleteOnExit();
return result;
}
| false | false | false | false | false | 0 |
selectExtractValue(const User *U) {
const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(U);
if (!EVI)
return false;
// Make sure we only try to handle extracts with a legal result. But also
// allow i1 because it's easy.
EVT RealVT = TLI.getValueType(DL, EVI->getType(), /*AllowUnknown=*/true);
if (!RealVT.isSimple())
return false;
MVT VT = RealVT.getSimpleVT();
if (!TLI.isTypeLegal(VT) && VT != MVT::i1)
return false;
const Value *Op0 = EVI->getOperand(0);
Type *AggTy = Op0->getType();
// Get the base result register.
unsigned ResultReg;
DenseMap<const Value *, unsigned>::iterator I = FuncInfo.ValueMap.find(Op0);
if (I != FuncInfo.ValueMap.end())
ResultReg = I->second;
else if (isa<Instruction>(Op0))
ResultReg = FuncInfo.InitializeRegForValue(Op0);
else
return false; // fast-isel can't handle aggregate constants at the moment
// Get the actual result register, which is an offset from the base register.
unsigned VTIndex = ComputeLinearIndex(AggTy, EVI->getIndices());
SmallVector<EVT, 4> AggValueVTs;
ComputeValueVTs(TLI, DL, AggTy, AggValueVTs);
for (unsigned i = 0; i < VTIndex; i++)
ResultReg += TLI.getNumRegisters(FuncInfo.Fn->getContext(), AggValueVTs[i]);
updateValueMap(EVI, ResultReg);
return true;
}
| false | false | false | false | false | 0 |
newJob( const KFileItemList & lstItems )
{
DirectorySizeJobPrivate *d = new DirectorySizeJobPrivate(lstItems);
DirectorySizeJob *job = new DirectorySizeJob(*d);
job->setUiDelegate(new JobUiDelegate);
QTimer::singleShot( 0, job, SLOT(processNextItem()) );
return job;
}
| false | false | false | false | false | 0 |
qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
AddSearch *_t = static_cast<AddSearch *>(_o);
switch (_id) {
case 0: _t->initializePage(); break;
case 1: { int _r = _t->nextId();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 2: { bool _r = _t->validatePage();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 3: _t->doScan(); break;
case 4: _t->scanFinished((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 5: _t->cleanupPage(); break;
case 6: _t->chooseCOMPort(); break;
default: ;
}
}
}
| false | false | false | false | false | 0 |
internalOpen(void)
{
havePose = false;
myFD = fopen(myLogFile, "r");
if (myFD == NULL)
{
myStatus = STATUS_OPEN_FAILED;
return OPEN_FILE_NOT_FOUND;
}
char buf[100];
if (fgets(buf,100,myFD) != NULL)
{
if (strncmp(buf, "// Saphira log file", 19) != 0)
{
myStatus = STATUS_OPEN_FAILED;
fclose(myFD);
myFD = NULL;
return OPEN_NOT_A_LOG_FILE;
}
}
else
{
myStatus = STATUS_OPEN_FAILED;
fclose(myFD);
myFD = NULL;
return OPEN_NOT_A_LOG_FILE;
}
// Set the robot pose
if (fgets(buf,100,myFD) != NULL)
{
if (strncmp(buf, "// Robot position", 17) == 0) // have a position!
{
int x,y,th;
char * dumm_ret = fgets(buf,100,myFD);
if (!dumm_ret) return OPEN_NOT_A_LOG_FILE;
sscanf(buf, "%d %d %d", &x, &y, &th);
myPose.setX(x);
myPose.setY(y);
myPose.setTh(th);
havePose = true;
}
if (strncmp(buf, "// Robot name", 13) == 0) // have a name!
{
char * dumm_ret =fgets(buf,100,myFD);
if (!dumm_ret) return OPEN_NOT_A_LOG_FILE;
sscanf(buf, "%s %s %s", myName, myType, mySubtype);
}
}
myStatus = STATUS_OPEN;
return 0;
}
| false | false | false | false | true | 1 |
vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
unsigned min_order)
{
gfp_t flags;
unsigned long i;
max_order++;
do {
/*
* Really try hard to get the needed memory.
* We need memory below the first 32MB, so we
* add the __GFP_DMA flag that guarantees that we are
* below the first 16MB.
*/
flags = __GFP_DMA | __GFP_HIGH | __GFP_KSWAPD_RECLAIM;
va->logical =
__get_free_pages(flags, --max_order);
} while (va->logical == 0 && max_order > min_order);
if (!va->logical)
return -ENOMEM;
va->phys = virt_to_phys((void *)va->logical);
va->size = PAGE_SIZE << max_order;
va->order = max_order;
/*
* It seems like __get_free_pages only ups the usage count
* of the first page. This doesn't work with fault mapping, so
* up the usage count once more (XXX: should use split_page or
* compound page).
*/
memset((void *)va->logical, 0x00, va->size);
for (i = va->logical; i < va->logical + va->size; i += PAGE_SIZE) {
get_page(virt_to_page(i));
}
/*
* Change caching policy of the linear kernel map to avoid
* mapping type conflicts with user-space mappings.
*/
set_pages_uc(virt_to_page(va->logical), va->size >> PAGE_SHIFT);
printk(KERN_DEBUG MODULE_NAME
": Allocated %ld bytes vram area at 0x%08lx\n",
va->size, va->phys);
return 0;
}
| false | false | false | false | false | 0 |
marker_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dict_t *params)
{
int32_t ret = 0;
marker_local_t *local = NULL;
marker_conf_t *priv = NULL;
priv = this->private;
if (priv->feature_enabled == 0)
goto wind;
ALLOCATE_OR_GOTO (local, marker_local_t, err);
MARKER_INIT_LOCAL (frame, local);
ret = loc_copy (&local->loc, loc);
if (ret == -1)
goto err;
wind:
STACK_WIND (frame, marker_mkdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->mkdir, loc, mode, params);
return 0;
err:
STACK_UNWIND_STRICT (mkdir, frame, -1, ENOMEM, NULL,
NULL, NULL, NULL);
return 0;
}
| false | false | false | false | false | 0 |
_generate_resv_name(resv_desc_msg_t *resv_ptr)
{
char *key, *name, *sep;
int len;
/* Generate name prefix, based upon the first account
* name if provided otherwise first user name */
if (resv_ptr->accounts && resv_ptr->accounts[0])
key = resv_ptr->accounts;
else
key = resv_ptr->users;
if (key[0] == '-')
key++;
sep = strchr(key, ',');
if (sep)
len = sep - key;
else
len = strlen(key);
name = xmalloc(len + 16);
strncpy(name, key, len);
xstrfmtcat(name, "_%d", top_suffix);
len++;
resv_ptr->name = name;
}
| false | false | false | false | false | 0 |
PyFFContour_init(PyFF_Contour *self, PyObject *args, PyObject *kwds) {
int quad=0;
if ( args!=NULL && !PyArg_ParseTuple(args, "|i", &quad))
return -1;
self->is_quadratic = (quad!=0);
return 0;
}
| false | true | false | false | false | 1 |
nm_client_get_version (NMClient *client)
{
NMClientPrivate *priv;
g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
priv = NM_CLIENT_GET_PRIVATE (client);
_nm_object_ensure_inited (NM_OBJECT (client));
return priv->manager_running ? priv->version : NULL;
}
| false | false | false | false | false | 0 |
cap_drop(gr_cap_t a, gr_cap_t b)
{
int i;
gr_cap_t ret;
for (i = 0; i < 2; i++)
ret.cap[i] = a.cap[i] &~ b.cap[i];
return ret;
}
| false | false | false | false | false | 0 |
spawn_apt_cache (GIOChannel **available, GError **error)
{
const gchar *argv[] = {"apt-cache", "dumpavail", NULL};
const gchar *envbinary;
gint cstdo;
envbinary = g_getenv (UNITY_WEBAPPS_APT_CACHE_BINARY_ENV_VARIABLE);
if (envbinary != NULL)
{
argv[0] = envbinary;
}
g_spawn_async_with_pipes (NULL, (gchar **)argv, NULL,
G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL,
&cstdo, NULL, error);
*available = NULL;
if (*error != NULL)
{
g_warning ("Failed to spawn apt-cache: %s\n", (*error)->message);
return FALSE;
}
*available = g_io_channel_unix_new (cstdo);
return TRUE;
}
| false | false | false | false | false | 0 |
PropagateUpdateExtentCallback(int* extent)
{
if (this->GetInput())
{
this->GetInput()->SetUpdateExtent(extent);
}
}
| false | false | false | false | false | 0 |
http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
enum http_host_state s;
const char *p;
size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len;
u->field_data[UF_HOST].len = 0;
s = found_at ? s_http_userinfo_start : s_http_host_start;
for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) {
enum http_host_state new_s = http_parse_host_char(s, *p);
if (new_s == s_http_host_dead) {
return 1;
}
switch(new_s) {
case s_http_host:
if (s != s_http_host) {
u->field_data[UF_HOST].off = p - buf;
}
u->field_data[UF_HOST].len++;
break;
case s_http_host_v6:
if (s != s_http_host_v6) {
u->field_data[UF_HOST].off = p - buf;
}
u->field_data[UF_HOST].len++;
break;
case s_http_host_port:
if (s != s_http_host_port) {
u->field_data[UF_PORT].off = p - buf;
u->field_data[UF_PORT].len = 0;
u->field_set |= (1 << UF_PORT);
}
u->field_data[UF_PORT].len++;
break;
case s_http_userinfo:
if (s != s_http_userinfo) {
u->field_data[UF_USERINFO].off = p - buf ;
u->field_data[UF_USERINFO].len = 0;
u->field_set |= (1 << UF_USERINFO);
}
u->field_data[UF_USERINFO].len++;
break;
default:
break;
}
s = new_s;
}
/* Make sure we don't end somewhere unexpected */
switch (s) {
case s_http_host_start:
case s_http_host_v6_start:
case s_http_host_v6:
case s_http_host_port_start:
case s_http_userinfo:
case s_http_userinfo_start:
return 1;
default:
break;
}
return 0;
}
| false | false | false | false | false | 0 |
Aggro(Unit* /*pWho*/) override
{
DoScriptText(SAY_AGGRO, m_creature);
// Note: on aggro the bats from the cave behind the boss should fly outside!
if (DoCastSpellIfCan(m_creature, SPELL_BAT_FORM) == CAST_OK)
{
m_creature->SetLevitate(true);
// override MMaps, by allowing the boss to fly up from the ledge
m_creature->SetWalk(false);
m_creature->GetMotionMaster()->MovePoint(1, -12281.58f, -1392.84f, 146.1f);
}
}
| false | false | false | false | false | 0 |
gst_asf_demux_add_video_stream (GstASFDemux * demux,
asf_stream_video_format * video, guint16 id,
guint8 ** p_data, guint64 * p_size)
{
GstTagList *tags = NULL;
GstBuffer *extradata = NULL;
GstPad *src_pad;
GstCaps *caps;
gchar *str;
gchar *name = NULL;
gchar *codec_name = NULL;
gint size_left = video->size - 40;
/* Create the video pad */
name = g_strdup_printf ("video_%u", demux->num_video_streams);
src_pad = gst_pad_new_from_static_template (&video_src_template, name);
g_free (name);
/* Now try some gstreamer formatted MIME types (from gst_avi_demux_strf_vids) */
if (size_left) {
GST_LOG ("Video header has %d bytes of codec specific data", size_left);
g_assert (size_left <= *p_size);
gst_asf_demux_get_buffer (&extradata, size_left, p_data, p_size);
}
GST_DEBUG ("video codec %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (video->tag));
/* yes, asf_stream_video_format and gst_riff_strf_vids are the same */
caps = gst_riff_create_video_caps (video->tag, NULL,
(gst_riff_strf_vids *) video, extradata, NULL, &codec_name);
if (caps == NULL) {
caps = gst_caps_new_simple ("video/x-asf-unknown", "fourcc",
G_TYPE_UINT, video->tag, NULL);
} else {
GstStructure *s;
gint ax, ay;
s = gst_asf_demux_get_metadata_for_stream (demux, id);
if (gst_structure_get_int (s, "AspectRatioX", &ax) &&
gst_structure_get_int (s, "AspectRatioY", &ay) && (ax > 0 && ay > 0)) {
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
ax, ay, NULL);
} else {
guint ax, ay;
/* retry with the global metadata */
GST_DEBUG ("Retrying with global metadata %" GST_PTR_FORMAT,
demux->global_metadata);
s = demux->global_metadata;
if (gst_structure_get_uint (s, "AspectRatioX", &ax) &&
gst_structure_get_uint (s, "AspectRatioY", &ay)) {
GST_DEBUG ("ax:%d, ay:%d", ax, ay);
if (ax > 0 && ay > 0)
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
ax, ay, NULL);
}
}
s = gst_caps_get_structure (caps, 0);
gst_structure_remove_field (s, "framerate");
}
/* add fourcc format to caps, some proprietary decoders seem to need it */
str = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (video->tag));
gst_caps_set_simple (caps, "format", G_TYPE_STRING, str, NULL);
g_free (str);
if (codec_name) {
tags = gst_tag_list_new (GST_TAG_VIDEO_CODEC, codec_name, NULL);
g_free (codec_name);
}
if (extradata)
gst_buffer_unref (extradata);
GST_INFO ("Adding video stream #%u, id %u, codec %"
GST_FOURCC_FORMAT " (0x%08x)", demux->num_video_streams, id,
GST_FOURCC_ARGS (video->tag), video->tag);
++demux->num_video_streams;
return gst_asf_demux_setup_pad (demux, src_pad, caps, id, TRUE, tags);
}
| false | false | false | false | false | 0 |
setImage( const QImage &image )
{
if( m_artworkCapability && m_artworkCapability.data()->canUpdateCover() )
{
// reset to initial values, let next call to image() re-fetch it
m_hasImagePossibility = true;
m_hasImageChecked = false;
m_artworkCapability.data()->setCover( MediaDeviceAlbumPtr( this ), image );
CoverCache::invalidateAlbum( this );
}
}
| false | false | false | false | false | 0 |
left(void)
{
if (myPrinting)
printf("left\n");
myRotRatio = 100;
}
| false | false | false | false | false | 0 |
scriptlevel( const QwtMmlNode *node ) const
{
QwtMmlNode *base = firstChild();
Q_ASSERT( base != 0 );
QwtMmlNode *under = base->nextSibling();
Q_ASSERT( under != 0 );
int sl = QwtMmlNode::scriptlevel();
if ( node != 0 && node == under )
return sl + 1;
else
return sl;
}
| false | false | false | false | false | 0 |
syncevo_config_set_value (SyncevoConfig *config,
const char *source,
const char *key,
const char *value)
{
gboolean changed;
char *name;
char *old_value;
GHashTable *source_config;
g_return_val_if_fail (config, FALSE);
g_return_val_if_fail (key, FALSE);
if (!source || strlen (source) == 0) {
name = g_strdup ("");
} else {
name = g_strdup_printf ("source/%s", source);
}
source_config = (GHashTable*)g_hash_table_lookup (config, name);
if (!source_config) {
source_config = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (config, name, source_config);
} else {
g_free (name);
}
old_value = g_hash_table_lookup (source_config, key);
if ((!old_value && !value) ||
(old_value && value && strcmp (old_value, value) == 0)) {
changed = FALSE;
} else {
changed = TRUE;
g_hash_table_insert (source_config, g_strdup (key), g_strdup (value));
}
return changed;
}
| false | false | false | false | false | 0 |
charTo2byte (char d[], char s[], int len)
{
/*
* copy ASCII string to 2 byte unicode string
* len is length of destination buffer
* Returns: number of characters copied
*/
int done = 0;
int copied = 0;
int i;
len = len / 2;
for (i = 0; i < len; i++)
{
d[2 * i] = '\0';
if (s[i] == '\0')
{
done = 1;
}
if (done == 0)
{
d[2 * i + 1] = s[i];
copied++;
}
else
d[2 * i + 1] = '\0';
}
return copied;
}
| false | false | false | false | true | 1 |
attach() {
if (!omni::internalLock) omni::internalLock = new omni_tracedmutex;
if (!omni::poRcLock) omni::poRcLock = new omni_tracedmutex;
if (!omni::objref_rc_lock) omni::objref_rc_lock = new omni_tracedmutex;
numObjectsInTable = 0;
minNumObjects = 0;
if( orbParameters::objectTableSize ) {
objectTableSize = orbParameters::objectTableSize;
maxNumObjects = 1ul << 31;
}
else {
objectTableSizeI = 0;
objectTableSize = objTblSizes[objectTableSizeI];
maxNumObjects = objectTableSize * 2 / 3;
}
objectTable = new omniObjTableEntry* [objectTableSize];
for( CORBA::ULong i = 0; i < objectTableSize; i++ ) objectTable[i] = 0;
#ifdef WIN32_EXCEPTION_HANDLING
if (abortOnNativeException) {
omniInterceptors* interceptors = omniORB::getInterceptors();
interceptors->createThread.add(abortOnNativeExceptionInterceptor);
}
#endif
}
| false | false | false | false | false | 0 |
wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
struct wilc *wl = nic->wilc;
if (!wl->initialized) {
wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
wlan_init_locks(dev);
linux_to_wlan(&nwi, wl);
ret = wilc_wlan_init(&nwi);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
goto _fail_locks_;
}
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
if (init_irq(dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
}
#endif
ret = wlan_initialize_threads(dev);
if (ret < 0) {
PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
goto _fail_wilc_wlan_;
}
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
if (enable_sdio_interrupt()) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}
#endif
if (linux_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
/*Download firmware*/
ret = linux_wlan_firmware_download(wl);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
/* Start firmware*/
ret = linux_wlan_start_firmware(nic);
if (ret < 0) {
PRINT_ER("Failed to start firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
wilc_bus_set_max_speed();
if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];
size = wilc_wlan_cfg_get_val(
WID_FIRMWARE_VERSION,
Firmware_ver, sizeof(Firmware_ver));
Firmware_ver[size] = '\0';
PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
}
/* Initialize firmware with default configuration */
ret = linux_wlan_init_test_config(dev, wl);
if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
ret = -EIO;
goto _fail_fw_start_;
}
wl->initialized = true;
return 0; /*success*/
_fail_fw_start_:
wilc_wlan_stop();
_fail_irq_enable_:
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
disable_sdio_interrupt();
_fail_irq_init_:
#endif
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
deinit_irq(dev);
#endif
wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
wilc_wlan_cleanup(dev);
_fail_locks_:
wlan_deinit_locks(dev);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
}
return ret;
}
| true | true | false | false | false | 1 |
_gda_postgres_meta_udt (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection *cnc,
GdaMetaStore *store, GdaMetaContext *context, GError **error,
const GValue *udt_catalog, const GValue *udt_schema)
{
GdaDataModel *model;
gboolean retval = TRUE;
GdaPostgresReuseable *rdata;
rdata = GDA_POSTGRES_GET_REUSEABLE_DATA (gda_connection_internal_get_provider_data_error (cnc, error));
if (!rdata)
return FALSE;
if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog, error))
return FALSE;
if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema, error))
return FALSE;
model = gda_connection_statement_execute_select_full (cnc,
internal_stmt[I_STMT_UDT],
i_set,
GDA_STATEMENT_MODEL_RANDOM_ACCESS,
_col_types_udt, error);
if (!model)
return FALSE;
gda_meta_store_set_reserved_keywords_func (store, _gda_postgres_reuseable_get_reserved_keywords_func
((GdaProviderReuseable*) rdata));
retval = gda_meta_store_modify_with_context (store, context, model, error);
g_object_unref (model);
return retval;
}
| false | false | false | false | false | 0 |
add_transaction_credits(journal_t *journal, int blocks,
int rsv_blocks)
{
transaction_t *t = journal->j_running_transaction;
int needed;
int total = blocks + rsv_blocks;
/*
* If the current transaction is locked down for commit, wait
* for the lock to be released.
*/
if (t->t_state == T_LOCKED) {
wait_transaction_locked(journal);
return 1;
}
/*
* If there is not enough space left in the log to write all
* potential buffers requested by this operation, we need to
* stall pending a log checkpoint to free some more log space.
*/
needed = atomic_add_return(total, &t->t_outstanding_credits);
if (needed > journal->j_max_transaction_buffers) {
/*
* If the current transaction is already too large,
* then start to commit it: we can then go back and
* attach this handle to a new transaction.
*/
atomic_sub(total, &t->t_outstanding_credits);
/*
* Is the number of reserved credits in the current transaction too
* big to fit this handle? Wait until reserved credits are freed.
*/
if (atomic_read(&journal->j_reserved_credits) + total >
journal->j_max_transaction_buffers) {
read_unlock(&journal->j_state_lock);
wait_event(journal->j_wait_reserved,
atomic_read(&journal->j_reserved_credits) + total <=
journal->j_max_transaction_buffers);
return 1;
}
wait_transaction_locked(journal);
return 1;
}
/*
* The commit code assumes that it can get enough log space
* without forcing a checkpoint. This is *critical* for
* correctness: a checkpoint of a buffer which is also
* associated with a committing transaction creates a deadlock,
* so commit simply cannot force through checkpoints.
*
* We must therefore ensure the necessary space in the journal
* *before* starting to dirty potentially checkpointed buffers
* in the new transaction.
*/
if (jbd2_log_space_left(journal) < jbd2_space_needed(journal)) {
atomic_sub(total, &t->t_outstanding_credits);
read_unlock(&journal->j_state_lock);
write_lock(&journal->j_state_lock);
if (jbd2_log_space_left(journal) < jbd2_space_needed(journal))
__jbd2_log_wait_for_space(journal);
write_unlock(&journal->j_state_lock);
return 1;
}
/* No reservation? We are done... */
if (!rsv_blocks)
return 0;
needed = atomic_add_return(rsv_blocks, &journal->j_reserved_credits);
/* We allow at most half of a transaction to be reserved */
if (needed > journal->j_max_transaction_buffers / 2) {
sub_reserved_credits(journal, rsv_blocks);
atomic_sub(total, &t->t_outstanding_credits);
read_unlock(&journal->j_state_lock);
wait_event(journal->j_wait_reserved,
atomic_read(&journal->j_reserved_credits) + rsv_blocks
<= journal->j_max_transaction_buffers / 2);
return 1;
}
return 0;
}
| false | false | false | false | false | 0 |
xd_get_unused_block(struct rtsx_chip *chip, int zone_no)
{
struct xd_info *xd_card = &(chip->xd_card);
struct zone_entry *zone;
u32 phy_blk;
if (zone_no >= xd_card->zone_cnt) {
dev_dbg(rtsx_dev(chip), "Get unused block from invalid zone (zone_no = %d, zone_cnt = %d)\n",
zone_no, xd_card->zone_cnt);
return BLK_NOT_FOUND;
}
zone = &(xd_card->zone[zone_no]);
if ((zone->unused_blk_cnt == 0) ||
(zone->set_index == zone->get_index)) {
free_zone(zone);
dev_dbg(rtsx_dev(chip), "Get unused block fail, no unused block available\n");
return BLK_NOT_FOUND;
}
if ((zone->get_index >= XD_FREE_TABLE_CNT) || (zone->get_index < 0)) {
free_zone(zone);
dev_dbg(rtsx_dev(chip), "Get unused block fail, invalid get_index\n");
return BLK_NOT_FOUND;
}
dev_dbg(rtsx_dev(chip), "Get unused block from index %d\n",
zone->get_index);
phy_blk = zone->free_table[zone->get_index];
zone->free_table[zone->get_index++] = 0xFFFF;
if (zone->get_index >= XD_FREE_TABLE_CNT)
zone->get_index = 0;
zone->unused_blk_cnt--;
phy_blk += ((u32)(zone_no) << 10);
return phy_blk;
}
| false | false | false | false | false | 0 |
namcos1_set_flipscreen(int flip)
{
int i;
int pos_x[] = {0x0b0,0x0b2,0x0b3,0x0b4};
int pos_y[] = {0x108,0x108,0x108,0x008};
int neg_x[] = {0x1d0,0x1d2,0x1d3,0x1d4};
int neg_y[] = {0x1e8,0x1e8,0x1e8,0x0e8};
flipscreen = flip;
if(!flip)
{
for ( i = 0; i < 4; i++ ) {
scrolloffsX[i] = pos_x[i];
scrolloffsY[i] = pos_y[i];
}
}
else
{
for ( i = 0; i < 4; i++ ) {
scrolloffsX[i] = neg_x[i];
scrolloffsY[i] = neg_y[i];
}
}
tilemap_set_flip(ALL_TILEMAPS,flipscreen ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0);
}
| false | false | false | false | false | 0 |
blank_frameset(Gt_Frameset *fset, int f1, int f2, int delete_object)
{
int i;
if (delete_object) f1 = 0, f2 = -1;
if (f2 < 0) f2 = fset->count - 1;
for (i = f1; i <= f2; i++) {
/* We may have deleted stream and image earlier to save on memory; see
above in merge_frame_interval(); but if we didn't, do it now. */
if (FRAME(fset, i).image && FRAME(fset, i).image->refcount > 1)
FRAME(fset, i).image->refcount--;
Gif_DeleteStream(FRAME(fset, i).stream);
Gif_DeleteComment(FRAME(fset, i).comment);
if (FRAME(fset, i).nest)
blank_frameset(FRAME(fset, i).nest, 0, 0, 1);
}
if (delete_object) {
Gif_DeleteArray(fset->f);
Gif_Delete(fset);
}
}
| false | false | false | false | false | 0 |
TransformPoints(const float *inPts, float *outPts, int n)
{
double *M = this->Matrix->GetData();
for (int i = 0; i < n; ++i)
{
vtkHomogeneousTransformPoint2D(M, &inPts[2*i], &outPts[2*i]);
}
}
| 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.