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 |
|---|---|---|---|---|---|---|
bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
{
struct bfa_itnim_s *itnim = tskim->itnim;
struct bfi_tskim_abortreq_s *m;
/*
* check for room in queue to send request now
*/
m = bfa_reqq_next(tskim->bfa, itnim->reqq);
if (!m)
return BFA_FALSE;
/*
* build i/o request message next
*/
bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ,
bfa_fn_lpu(tskim->bfa));
m->tsk_tag = cpu_to_be16(tskim->tsk_tag);
/*
* queue I/O message to firmware
*/
bfa_reqq_produce(tskim->bfa, itnim->reqq, m->mh);
return BFA_TRUE;
} | false | false | false | false | false | 0 |
expand_bahe_ui_internal(TreeNode *x, int pos)
{
TreeNode *nn, *y, *nz, *z, *c;
int n, i, j, n_ui, n_b, ui_start;
y = x->data.nonterm.children[pos];
if (y->type == N_NONTERM) {
n = y->data.nonterm.nchildren;
for (i=0; i<n; i++) {
expand_bahe_ui_internal(y, i);
}
} else {
if (y->bahe || (y->ui_next != (TreeNode *) &y->ui_next)) {
nn = new_node();
nn->type = N_NONTERM;
for (z = y->bahe, n_b = 0;
z;
z = z->bahe) {
n_b++;
}
n_ui = 0;
for (c=y->ui_next; c != (TreeNode *) &y->ui_next; c = c->next) {
n_ui++;
}
nn->data.nonterm.type = AUGMENTED;
nn->data.nonterm.brackets = BR_NONE;
nn->data.nonterm.nchildren = n_b + 1 + n_ui;
nn->data.nonterm.children = new_array(TreeNode *, nn->data.nonterm.nchildren);
j = 0;
for (z = y->bahe;
z;
z = nz) {
nn->data.nonterm.children[n_b - ++j] = z;
nz = z->bahe;
z->bahe = NULL;
}
nn->data.nonterm.children[j++] = y;
ui_start = j;
for (c=y->ui_next; c != (TreeNode *) &y->ui_next; c = c->next) {
nn->data.nonterm.children[j++] = c;
}
y->ui_next = y->ui_prev = (TreeNode *) &y->ui_next;
x->data.nonterm.children[pos] = nn;
/* And handle the case that the UI chain itself may have BAhE
tokens in front of some of its members */
for (j=ui_start; j<nn->data.nonterm.nchildren; j++) {
expand_bahe_ui_internal(nn, j);
}
}
}
} | false | false | false | false | false | 0 |
nfs3_fh_resolve_found_parent (nfs3_call_state_t *cs, gf_dirent_t *candidate)
{
int ret = 0;
nfs_user_t nfu = {0, };
uuid_t gfid = {0, };
if ((!cs) || (!candidate))
return -EFAULT;
uuid_copy (gfid, cs->resolvedloc.inode->gfid);
nfs_loc_wipe (&cs->resolvedloc);
ret = nfs_entry_loc_fill (cs->vol->itable, gfid, candidate->d_name,
&cs->resolvedloc, NFS_RESOLVE_CREATE);
if (ret == -ENOENT) {
nfs_user_root_create (&nfu);
ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3_fh_resolve_parent_lookup_cbk,
cs);
} else
nfs3_fh_resolve_entry_hard (cs);
return ret;
} | false | false | false | false | false | 0 |
clutter_text_select_line (ClutterText *self)
{
ClutterTextPrivate *priv = self->priv;
gint cursor_pos = priv->position;
gint start_pos, end_pos;
if (priv->single_line_mode)
{
start_pos = 0;
end_pos = -1;
}
else
{
start_pos = clutter_text_move_line_start (self, cursor_pos);
end_pos = clutter_text_move_line_end (self, cursor_pos);
}
clutter_text_set_selection (self, start_pos, end_pos);
} | false | false | false | false | false | 0 |
HandleSignal(int signum)
{
if (signum != SIGCHLD)
{
snprintf(OUTPUT,CF_BUFSIZE*2,"Received signal %d (%s) while doing [%s]",signum,SIGNALS[signum],CFLOCK);
Chop(OUTPUT);
CfLog(cferror,OUTPUT,"");
snprintf(OUTPUT,CF_BUFSIZE*2,"Logical start time %s ",ctime(&CFSTARTTIME));
Chop(OUTPUT);
CfLog(cferror,OUTPUT,"");
snprintf(OUTPUT,CF_BUFSIZE*2,"This sub-task started really at %s\n",ctime(&CFINITSTARTTIME));
CfLog(cferror,OUTPUT,"");
fflush(stdout);
if (signum == SIGTERM || signum == SIGINT || signum == SIGHUP || signum == SIGSEGV || signum == SIGKILL|| signum == SIGPIPE)
{
unlink(PIDFILE);
ReleaseCurrentLock();
CloseAuditLog();
closelog();
exit(0);
}
else if (signum == SIGUSR1)
{
DEBUG= true;
D2= true;
}
else if (signum == SIGUSR2)
{
DEBUG= false;
D2= false;
}
else /* zombie cleanup - how hard does it have to be? */
{
}
/* Reset the signal handler */
signal(signum,HandleSignal);
}
} | false | false | false | false | false | 0 |
put_forward_diag(ull *board_l, ull *board_u, ushort stream, int diag)
{
int len = GET_FDIAG_LEN(diag);
int i;
ull *board;
int pos=diag;
ushort mask = 0x1;
for (i=0; i<len; i++)
{
if (pos > 49)
board = board_u;
else
board = board_l;
*board |= ((ull) (stream & mask ) << (pos % 50));
pos +=10;
mask <<= 1;
}
} | false | false | false | false | false | 0 |
list2proftime(arg, tm)
typval_T *arg;
proftime_T *tm;
{
long n1, n2;
int error = FALSE;
if (arg->v_type != VAR_LIST || arg->vval.v_list == NULL
|| arg->vval.v_list->lv_len != 2)
return FAIL;
n1 = list_find_nr(arg->vval.v_list, 0L, &error);
n2 = list_find_nr(arg->vval.v_list, 1L, &error);
# ifdef WIN3264
tm->HighPart = n1;
tm->LowPart = n2;
# else
tm->tv_sec = n1;
tm->tv_usec = n2;
# endif
return error ? FAIL : OK;
} | false | false | false | false | false | 0 |
doDefineUnit()
{
Location loc(in_->currentLocation());
Token tok;
if (!getToken(allowIdentifier, tok))
return 0;
Unit *unit = interp_->lookupUnit(currentToken_);
Owner<Expression> expr;
Identifier::SyntacticKey key;
if (!parseExpression(0, expr, key, tok))
return 0;
if (!getToken(allowCloseParen, tok))
return 0;
Location defLoc;
unsigned defPart;
if (unit->defined(defPart, defLoc)
&& defPart <= interp_->currentPartIndex()) {
if (defPart == interp_->currentPartIndex())
message(InterpreterMessages::duplicateUnitDefinition,
StringMessageArg(unit->name()),
defLoc);
}
else
unit->setDefinition(expr, interp_->currentPartIndex(), loc);
return 1;
} | false | false | false | false | false | 0 |
on_key( struct SCNotification* nt,
ScintillaObject* scintilla,
presage_t presage )
{
g_print("on_key()\n");
g_print("key: %i\n", nt->ch);
if (glob_function_keys_mode)
{
uptr_t completion_active;
completion_active = scintilla_send_message (scintilla,
SCI_AUTOCACTIVE,
0,
0);
if (completion_active)
{
/* figure out which function key it is */
int fkn;
char fk[4];
fkn = nt->ch - GDK_F1 + 1;
g_print ("fkn: F%d\n", fkn);
sprintf (fk, "F%d", fkn);
g_print ("fk: %s\n", fk);
/* select autocompletion */
scintilla_send_message (scintilla,
SCI_AUTOCSELECT,
0,
(sptr_t) fk);
/* and complete it */
scintilla_send_message (scintilla,
SCI_AUTOCCOMPLETE,
0,
0);
}
}
} | false | false | false | false | false | 0 |
_load_ipv4(netsnmp_container* container, u_long *index )
{
FILE *in;
char line[256];
netsnmp_route_entry *entry = NULL;
char name[16];
int fd;
DEBUGMSGTL(("access:route:container",
"route_container_arch_load ipv4\n"));
netsnmp_assert(NULL != container);
/*
* fetch routes from the proc file-system:
*/
if (!(in = fopen("/proc/net/route", "r"))) {
NETSNMP_LOGONCE((LOG_ERR, "cannot open /proc/net/route\n"));
return -2;
}
/*
* create socket for ioctls (see NOTE[1], below)
*/
fd = socket(AF_INET, SOCK_DGRAM, 0);
if(fd < 0) {
snmp_log(LOG_ERR, "could not create socket\n");
fclose(in);
return -2;
}
fgets(line, sizeof(line), in); /* skip header */
while (fgets(line, sizeof(line), in)) {
char rtent_name[32];
int refcnt, rc;
uint32_t dest, nexthop, mask;
unsigned flags, use;
entry = netsnmp_access_route_entry_create();
/*
* as with 1.99.14:
* Iface Dest GW Flags RefCnt Use Met Mask MTU Win IRTT
* BE eth0 00000000 C0A80101 0003 0 0 0 FFFFFFFF 1500 0 0
* LE eth0 00000000 0101A8C0 0003 0 0 0 00FFFFFF 0 0 0
*/
rc = sscanf(line, "%s %x %x %x %d %u %d %x %*d %*d %*d\n",
rtent_name, &dest, &nexthop,
/*
* XXX: fix type of the args
*/
&flags, &refcnt, &use, &entry->rt_metric1,
&mask);
DEBUGMSGTL(("9:access:route:container", "line |%s|\n", line));
if (8 != rc) {
snmp_log(LOG_ERR,
"/proc/net/route data format error (%d!=8), line ==|%s|",
rc, line);
netsnmp_access_route_entry_free(entry);
continue;
}
/*
* temporary null terminated name
*/
strncpy(name, rtent_name, sizeof(name));
name[ sizeof(name)-1 ] = 0;
/*
* don't bother to try and get the ifindex for routes with
* no interface name.
* NOTE[1]: normally we'd use netsnmp_access_interface_index_find,
* but since that will open/close a socket, and we might
* have a lot of routes, call the ioctl routine directly.
*/
if ('*' != name[0])
entry->if_index =
netsnmp_access_interface_ioctl_ifindex_get(fd,name);
/*
* arbitrary index
*/
entry->ns_rt_index = ++(*index);
#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
memcpy(&entry->rt_mask, &mask, 4);
/** entry->rt_tos = XXX; */
/** rt info ?? */
#endif
/*
* copy dest & next hop
*/
entry->rt_dest_type = INETADDRESSTYPE_IPV4;
entry->rt_dest_len = 4;
memcpy(entry->rt_dest, &dest, 4);
entry->rt_nexthop_type = INETADDRESSTYPE_IPV4;
entry->rt_nexthop_len = 4;
memcpy(entry->rt_nexthop, &nexthop, 4);
/*
* count bits in mask
*/
mask = htonl(mask);
entry->rt_pfx_len = netsnmp_ipaddress_ipv4_prefix_len(mask);
#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
/*
inetCidrRoutePolicy OBJECT-TYPE
SYNTAX OBJECT IDENTIFIER
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"This object is an opaque object without any defined
semantics. Its purpose is to serve as an additional
index which may delineate between multiple entries to
the same destination. The value { 0 0 } shall be used
as the default value for this object."
*/
/*
* on linux, default routes all look alike, and would have the same
* indexed based on dest and next hop. So we use the if index
* as the policy, to distinguise between them. Hopefully this is
* unique.
* xxx-rks: It should really only be for the duplicate case, but that
* would be more complicated than I want to get into now. Fix later.
*/
if (0 == nexthop) {
entry->rt_policy = calloc(3, sizeof(oid));
entry->rt_policy[2] = entry->if_index;
entry->rt_policy_len = sizeof(oid)*3;
}
#endif
/*
* get protocol and type from flags
*/
entry->rt_type = _type_from_flags(flags);
entry->rt_proto = (flags & RTF_DYNAMIC)
? IANAIPROUTEPROTOCOL_ICMP : IANAIPROUTEPROTOCOL_LOCAL;
/*
* insert into container
*/
if (CONTAINER_INSERT(container, entry) < 0)
{
DEBUGMSGTL(("access:route:container", "error with route_entry: insert into container failed.\n"));
netsnmp_access_route_entry_free(entry);
continue;
}
}
fclose(in);
close(fd);
return 0;
} | false | false | false | false | false | 0 |
make_stack_label (char *label, char *s)
{
char *p = strstr(s, "--");
int len = strlen(s);
if (p == NULL) {
if (len > MAXLABEL - 1) {
strncat(label, s, MAXLABEL - 4);
strcat(label, "...");
} else {
strcat(label, s);
}
} else {
int llen = strlen(p);
char *q = strstr(p + 2, "--");
int sp = 1 + (q != NULL);
len++;
*p = '\0';
if (len + sp > MAXLABEL - 1) {
strncat(label, s, MAXLABEL - 4 - (llen + sp));
strcat(label, "...");
} else {
strcat(label, s);
}
strcat(label, " -");
if (q == NULL) {
strcat(label, p + 1);
} else {
strncat(label, p + 1, q - p - 1);
strcat(label, " ");
strcat(label, q);
}
}
} | false | true | false | false | false | 1 |
xmlInternalSchemaEntityLoader(const char *URL, const char *ID,
xmlParserCtxtPtr context)
{
if (streq(URL, (const char *) NS_SAML_11))
return(xmlNewStringInputStream(context,
oasis_sstc_saml_schema_assertion_1_1));
else if (streq(URL, (const char *) URL_DSIG)
|| streq(URL, (const char *) NS_DSIG))
return(xmlNewStringInputStream(context, xmldsig_core_schema));
return(NULL);
} | false | false | false | false | false | 0 |
shoot(HepRandomEngine* anEngine, double mean) {
if ( mean < RandPoissonQ::tableBoundary() ) {
return RandPoissonQ::shoot ( anEngine, mean );
} else {
return RandPoisson::shoot( anEngine, mean );
}
} | false | false | false | false | false | 0 |
ttm_bo_swapout_all(struct ttm_bo_device *bdev)
{
while (ttm_bo_swapout(&bdev->glob->shrink) == 0)
;
} | false | false | false | false | false | 0 |
perm_stringlist_to_permlist (GSList *strlist)
{
GSList *list = NULL, *iter;
for (iter = strlist; iter; iter = g_slist_next (iter)) {
Permission *p;
p = permission_new_from_str ((const char *) iter->data);
if (p)
list = g_slist_append (list, p);
}
return list;
} | false | false | false | false | false | 0 |
read_igmp(struct ma_info **result_p)
{
struct ma_info m;
char buf[256];
FILE *fp = fopen("/proc/net/igmp", "r");
if (!fp)
return;
memset(&m, 0, sizeof(m));
if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return;
}
m.addr.family = AF_INET;
m.addr.bitlen = 32;
m.addr.bytelen = 4;
while (fgets(buf, sizeof(buf), fp)) {
struct ma_info *ma;
if (buf[0] != '\t') {
sscanf(buf, "%d%s", &m.index, m.name);
continue;
}
if (filter.dev && strcmp(filter.dev, m.name))
continue;
sscanf(buf, "%08x%d", (__u32*)&m.addr.data, &m.users);
ma = malloc(sizeof(m));
memcpy(ma, &m, sizeof(m));
maddr_ins(result_p, ma);
}
fclose(fp);
} | true | true | false | false | true | 1 |
observationsOverlap(
const mrpt::obs::CObservation* o1,
const mrpt::obs::CObservation* o2,
const mrpt::poses::CPose3D *pose_o2_wrt_o1 )
{
if (IS_CLASS(o1,CObservation2DRangeScan) && IS_CLASS(o2,CObservation2DRangeScan))
{
const CObservation2DRangeScan *this_obs = static_cast<const CObservation2DRangeScan *>(o1);
const CObservation2DRangeScan *obs = static_cast<const CObservation2DRangeScan *>(o2);
const CPointsMap *map1 = this_obs->buildAuxPointsMap<mrpt::maps::CPointsMap>();
const CPointsMap *map2 = obs->buildAuxPointsMap<mrpt::maps::CPointsMap>();
// if PDF is available, get "mean" value as an estimation:
CPose3D otherObsPose;
if (pose_o2_wrt_o1)
otherObsPose = *pose_o2_wrt_o1;
mrpt::utils::TMatchingPairList correspondences;
mrpt::maps::TMatchingParams matchParams;
mrpt::maps::TMatchingExtraResults matchExtraResults;
matchParams.maxDistForCorrespondence = 0.04f;
matchParams.maxAngularDistForCorrespondence = 0;
map1->determineMatching3D(
map2, // The other map
otherObsPose, // The other map pose
correspondences,
matchParams, matchExtraResults);
return matchExtraResults.correspondencesRatio;
}
else
{
// No idea...
return 0;
}
} | false | false | false | false | false | 0 |
test_just_vertex_shader (void)
{
TestState state;
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
paint_legacy (&state);
validate_result (test_fb);
paint (&state);
validate_result (test_fb);
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");
} | false | false | false | false | false | 0 |
bus_driver_send_service_owner_changed (const char *service_name,
const char *old_owner,
const char *new_owner,
BusTransaction *transaction,
DBusError *error)
{
DBusMessage *message;
dbus_bool_t retval;
const char *null_service;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
null_service = "";
_dbus_verbose ("sending name owner changed: %s [%s -> %s]\n",
service_name,
old_owner ? old_owner : null_service,
new_owner ? new_owner : null_service);
message = dbus_message_new_signal (DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"NameOwnerChanged");
if (message == NULL)
{
BUS_SET_OOM (error);
return FALSE;
}
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
goto oom;
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &service_name,
DBUS_TYPE_STRING, old_owner ? &old_owner : &null_service,
DBUS_TYPE_STRING, new_owner ? &new_owner : &null_service,
DBUS_TYPE_INVALID))
goto oom;
_dbus_assert (dbus_message_has_signature (message, "sss"));
retval = bus_dispatch_matches (transaction, NULL, NULL, message, error);
dbus_message_unref (message);
return retval;
oom:
dbus_message_unref (message);
BUS_SET_OOM (error);
return FALSE;
} | false | false | false | false | false | 0 |
dm_get_rq_mapinfo(struct request *rq)
{
if (rq && rq->end_io_data)
return &((struct dm_rq_target_io *)rq->end_io_data)->info;
return NULL;
} | false | false | false | false | false | 0 |
freelaunchlist(list, max)
lsparse_t *list;
int max;
{
int i;
if (list) for (i = 0; i < max; i++) freelaunch(&(list[i]));
} | false | false | false | false | false | 0 |
_swrast_update_specular_vertex_add(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
(ctx->Light.Enabled &&
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
swrast->SpecularVertexAdd = (separateSpecular
&& ctx->Texture._EnabledUnits == 0x0
&& !_swrast_use_fragment_program(ctx)
&& !ctx->ATIFragmentShader._Enabled);
} | false | false | false | false | false | 0 |
backsql_operational_entryUUID( backsql_info *bi, backsql_entryID *id )
{
int rc;
struct berval val, nval;
AttributeDescription *desc = slap_schema.si_ad_entryUUID;
Attribute *a;
backsql_entryUUID( bi, id, &val, NULL );
rc = (*desc->ad_type->sat_equality->smr_normalize)(
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
desc->ad_type->sat_syntax,
desc->ad_type->sat_equality,
&val, &nval, NULL );
if ( rc != LDAP_SUCCESS ) {
ber_memfree( val.bv_val );
return NULL;
}
a = attr_alloc( desc );
a->a_numvals = 1;
a->a_vals = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
a->a_vals[ 0 ] = val;
BER_BVZERO( &a->a_vals[ 1 ] );
a->a_nvals = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
a->a_nvals[ 0 ] = nval;
BER_BVZERO( &a->a_nvals[ 1 ] );
return a;
} | false | false | false | false | false | 0 |
Clone() const
{
return new CHashingEvent(GetEventType(), m_result, m_owner);
} | false | false | false | false | false | 0 |
update_secretion_grid ( void )
{
int16_t cur_x, cur_y;
double ** new_secretion = new double*[_grid_width];
for ( int16_t x = 0 ; x < _grid_width ; x++ )
{
new_secretion[x] = new double[_grid_height];
for ( int16_t y = 0 ; y < _grid_height ; y++ )
{
new_secretion[x][y] = _pop_grid[x][y]->get_compound_amount();
}
}
for ( int16_t x = 0 ; x < _grid_width ; x++ )
{
for ( int16_t y = 0 ; y < _grid_height ; y++ )
{
// look at the entire neighborhood
for ( int8_t i = -1 ; i < 2 ; i++ )
{
for ( int8_t j = -1 ; j < 2 ; j ++ )
{
cur_x = (x + i + _grid_width) % _grid_width;
cur_y = (y + j + _grid_height) % _grid_height;
// add the diffusion from the neighboring cells
new_secretion[x][y] += _pop_grid[cur_x][cur_y]->get_compound_amount() * _secretion_diffusion_prop;
}
}
}
}
// substract what has diffused from each cell, and calculate the compound degradation
for ( int16_t x = 0 ; x < _grid_width ; x++ )
{
for ( int16_t y = 0 ; y < _grid_height ; y++ )
{
_pop_grid[x][y]->set_compound_amount( new_secretion[x][y] - 9 * _pop_grid[x][y]->get_compound_amount()
* _secretion_diffusion_prop );
_pop_grid[x][y]->set_compound_amount( _pop_grid[x][y]->get_compound_amount()
* (1 - _secretion_degradation_prop) );
}
}
for ( int16_t x = 0 ; x < _grid_width ; x++ )
{
delete [] new_secretion[x];
}
delete [] new_secretion;
} | false | false | false | false | false | 0 |
gsb_form_scheduler_recover_splits_of_transaction ( gint scheduled_transaction,
gint transaction_number )
{
GSList *tmp_list;
/* first clone the transactions */
gsb_transactions_list_splitted_to_scheduled (transaction_number, scheduled_transaction);
/* add the children to the list */
tmp_list = gsb_data_scheduled_get_scheduled_list ();
while (tmp_list)
{
gint scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
if (gsb_data_scheduled_get_mother_scheduled_number (scheduled_number) == scheduled_transaction)
gsb_scheduler_list_append_new_scheduled (scheduled_number, NULL);
tmp_list = tmp_list -> next;
}
return FALSE;
} | false | false | false | false | false | 0 |
sci_controller_process_completions(struct isci_host *ihost)
{
u32 completion_count = 0;
u32 ent;
u32 get_index;
u32 get_cycle;
u32 event_get;
u32 event_cycle;
dev_dbg(&ihost->pdev->dev,
"%s: completion queue beginning get:0x%08x\n",
__func__,
ihost->completion_queue_get);
/* Get the component parts of the completion queue */
get_index = NORMALIZE_GET_POINTER(ihost->completion_queue_get);
get_cycle = SMU_CQGR_CYCLE_BIT & ihost->completion_queue_get;
event_get = NORMALIZE_EVENT_POINTER(ihost->completion_queue_get);
event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & ihost->completion_queue_get;
while (
NORMALIZE_GET_POINTER_CYCLE_BIT(get_cycle)
== COMPLETION_QUEUE_CYCLE_BIT(ihost->completion_queue[get_index])
) {
completion_count++;
ent = ihost->completion_queue[get_index];
/* increment the get pointer and check for rollover to toggle the cycle bit */
get_cycle ^= ((get_index+1) & SCU_MAX_COMPLETION_QUEUE_ENTRIES) <<
(SMU_COMPLETION_QUEUE_GET_CYCLE_BIT_SHIFT - SCU_MAX_COMPLETION_QUEUE_SHIFT);
get_index = (get_index+1) & (SCU_MAX_COMPLETION_QUEUE_ENTRIES-1);
dev_dbg(&ihost->pdev->dev,
"%s: completion queue entry:0x%08x\n",
__func__,
ent);
switch (SCU_GET_COMPLETION_TYPE(ent)) {
case SCU_COMPLETION_TYPE_TASK:
sci_controller_task_completion(ihost, ent);
break;
case SCU_COMPLETION_TYPE_SDMA:
sci_controller_sdma_completion(ihost, ent);
break;
case SCU_COMPLETION_TYPE_UFI:
sci_controller_unsolicited_frame(ihost, ent);
break;
case SCU_COMPLETION_TYPE_EVENT:
sci_controller_event_completion(ihost, ent);
break;
case SCU_COMPLETION_TYPE_NOTIFY: {
event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) <<
(SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT);
event_get = (event_get+1) & (SCU_MAX_EVENTS-1);
sci_controller_event_completion(ihost, ent);
break;
}
default:
dev_warn(&ihost->pdev->dev,
"%s: SCIC Controller received unknown "
"completion type %x\n",
__func__,
ent);
break;
}
}
/* Update the get register if we completed one or more entries */
if (completion_count > 0) {
ihost->completion_queue_get =
SMU_CQGR_GEN_BIT(ENABLE) |
SMU_CQGR_GEN_BIT(EVENT_ENABLE) |
event_cycle |
SMU_CQGR_GEN_VAL(EVENT_POINTER, event_get) |
get_cycle |
SMU_CQGR_GEN_VAL(POINTER, get_index);
writel(ihost->completion_queue_get,
&ihost->smu_registers->completion_queue_get);
}
dev_dbg(&ihost->pdev->dev,
"%s: completion queue ending get:0x%08x\n",
__func__,
ihost->completion_queue_get);
} | false | false | false | false | false | 0 |
center_limited_gradient (FttCell * cell,
FttComponent c,
guint v,
gdouble (* limiter) (gdouble))
{
FttDirection d = 2*c;
FttCellFace f1;
gdouble v0;
f1 = gfs_cell_face (cell, FTT_OPPOSITE_DIRECTION (d));
v0 = GFS_VARIABLE (cell, v);
if (f1.neighbor) {
FttCellFace f2 = gfs_cell_face (cell, d);
if (f2.neighbor) {
/* two neighbors */
gdouble x1 = 1., v1, x2 = 1., v2;
v1 = neighbor_value (&f1, v, &x1);
v2 = neighbor_value (&f2, v, &x2);
gdouble g;
if (v0 == v1)
g = 0.;
else
g = (* limiter) ((v2 - v0)*x1/((v0 - v1)*x2))*(v0 - v1)/x1;
return g;
}
}
/* only one or no neighbors */
return 0.;
} | false | false | false | false | false | 0 |
generic_msg(const char *from, const char *target, const char *fmt, ...)
{
va_list ap;
char *buf;
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0)
{
va_end(ap);
return;
}
va_end(ap);
slog(LG_INFO, "Cannot send message to %s (%s): don't know how. Load a protocol module perhaps?", target, buf);
free(buf);
} | false | false | false | false | false | 0 |
reg_reqs(struct gspca_dev *gspca_dev,
const struct dtcs033_usb_requests *preqs, int n_reqs)
{
int i = 0;
const struct dtcs033_usb_requests *preq;
while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
preq = &preqs[i];
reg_rw(gspca_dev, preq->bRequestType, preq->bRequest,
preq->wValue, preq->wIndex, preq->wLength);
if (gspca_dev->usb_err < 0) {
PERR("usb error request no: %d / %d\n",
i, n_reqs);
} else if (preq->bRequestType & USB_DIR_IN) {
PDEBUG(D_STREAM,
"USB IN (%d) returned[%d] %02X %02X %02X %s",
i,
preq->wLength,
gspca_dev->usb_buf[0],
gspca_dev->usb_buf[1],
gspca_dev->usb_buf[2],
preq->wLength > 3 ? "...\n" : "\n");
}
i++;
}
return gspca_dev->usb_err;
} | false | false | false | false | false | 0 |
globus_range_list_merge(
globus_range_list_t * dest,
globus_range_list_t src1,
globus_range_list_t src2)
{
int rc;
globus_range_list_t src1_tmp;
globus_range_list_t src2_tmp;
if(src1 == NULL && src2 == NULL)
{
return -1;
}
rc = globus_range_list_copy(&src1_tmp, src1);
if(rc != 0)
{
return -1;
}
rc = globus_range_list_copy(&src2_tmp, src2);
if(rc != 0)
{
goto err1;
}
rc = globus_range_list_merge_destructive(dest, src1_tmp, src2_tmp);
if(rc != 0)
{
goto err2;
}
globus_range_list_destroy(src2_tmp);
globus_range_list_destroy(src1_tmp);
return GLOBUS_SUCCESS;
err2:
globus_range_list_destroy(src2_tmp);
err1:
globus_range_list_destroy(src1_tmp);
return -1;
} | false | false | false | false | false | 0 |
varnode_to_tigentry(GNode* node, gpointer data)
{
if(node)
{
if(node->data)
{
VarEntry* ve = node->data;
TigEntry* te;
gchar *basename, *filename;
// create filename
basename = ticonv_varname_to_filename(GFMFile.model, ve->name, ve->type);
filename = g_strconcat(basename, ".", tifiles_vartype2fext(GFMFile.model, ve->type), NULL);
g_free(basename);
te = tifiles_te_create(filename, TIFILE_SINGLE, GFMFile.model);
g_free(filename);
tifiles_content_add_te((TigContent *)data, te);
tifiles_content_add_entry(te->content.regular, tifiles_ve_dup(ve));
}
}
return FALSE;
} | false | false | false | false | false | 0 |
_get_node_state(struct node_record *node_ptr)
{
static bool got_select_type = false;
static bool node_allocations;
if (!got_select_type) {
char * select_type = slurm_get_select_type();
if (select_type &&
(strcasecmp(select_type, "select/linear") == 0))
node_allocations = true;
else
node_allocations = false;
xfree(select_type);
got_select_type = true;
}
if (IS_NODE_DRAIN(node_ptr) || IS_NODE_FAIL(node_ptr))
return "Draining";
if (IS_NODE_COMPLETING(node_ptr))
return "Busy";
if (IS_NODE_DOWN(node_ptr))
return "Down";
if (IS_NODE_ALLOCATED(node_ptr)) {
if (node_allocations)
return "Busy";
else
return "Running";
}
if (IS_NODE_IDLE(node_ptr))
return "Idle";
return "Unknown";
} | false | false | false | false | false | 0 |
SetFds(int &Fd,fd_set *RSet,fd_set *WSet)
{
for (Worker *I = Workers; I != 0; I = I->NextAcquire)
{
if (I->InReady == true && I->InFd >= 0)
{
if (Fd < I->InFd)
Fd = I->InFd;
FD_SET(I->InFd,RSet);
}
if (I->OutReady == true && I->OutFd >= 0)
{
if (Fd < I->OutFd)
Fd = I->OutFd;
FD_SET(I->OutFd,WSet);
}
}
} | false | false | false | false | false | 0 |
getPlatforms()
{
map<string,string> vs;
for (map<string,Resources*>::iterator i1=platform_res.begin();
i1!=platform_res.end(); ++i1)
{
Resources *res = (*i1).second;
if (res)
{
string desc = res->getResourceStr(
"/FWBuilderResources/Target/description");
vs[ (*i1).first ]=desc;
}
}
return vs;
} | false | false | false | false | false | 0 |
smk_copy_rules(struct list_head *nhead, struct list_head *ohead,
gfp_t gfp)
{
struct smack_rule *nrp;
struct smack_rule *orp;
int rc = 0;
INIT_LIST_HEAD(nhead);
list_for_each_entry_rcu(orp, ohead, list) {
nrp = kzalloc(sizeof(struct smack_rule), gfp);
if (nrp == NULL) {
rc = -ENOMEM;
break;
}
*nrp = *orp;
list_add_rcu(&nrp->list, nhead);
}
return rc;
} | false | false | false | false | false | 0 |
ReadInputData(char * buf, unsigned int * size, void * param)
{
TDataInfo * pInfo = (TDataInfo *)param;
unsigned int nMaxAvail = (unsigned int)(pInfo->pbInBuffEnd - pInfo->pbInBuff);
unsigned int nToRead = *size;
// Check the case when not enough data available
if(nToRead > nMaxAvail)
nToRead = nMaxAvail;
// Load data and increment offsets
memcpy(buf, pInfo->pbInBuff, nToRead);
pInfo->pbInBuff += nToRead;
assert(pInfo->pbInBuff <= pInfo->pbInBuffEnd);
return nToRead;
} | false | false | false | false | false | 0 |
xenvif_rx_ring_slots_available(struct xenvif_queue *queue)
{
RING_IDX prod, cons;
int needed;
needed = xenvif_rx_ring_slots_needed(queue->vif);
do {
prod = queue->rx.sring->req_prod;
cons = queue->rx.req_cons;
if (prod - cons >= needed)
return true;
queue->rx.sring->req_event = prod + 1;
/* Make sure event is visible before we check prod
* again.
*/
mb();
} while (queue->rx.sring->req_prod != prod);
return false;
} | false | false | false | false | false | 0 |
t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems)
{
s->supported_modems = supported_modems;
if ((s->supported_modems & T30_SUPPORT_V17))
s->t38x.t38.fastest_image_data_rate = 14400;
else if ((s->supported_modems & T30_SUPPORT_V29))
s->t38x.t38.fastest_image_data_rate = 9600;
else
s->t38x.t38.fastest_image_data_rate = 4800;
} | false | false | false | false | false | 0 |
checktz(const char *check)
{
unsigned int i;
const struct tzinfo *what;
bool found= FALSE;
what = tz;
for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) {
if(Curl_raw_equal(check, what->name)) {
found=TRUE;
break;
}
what++;
}
return found?what->offset*60:-1;
} | false | false | false | false | false | 0 |
create(const String& name, const String& group,
GpuProgramType gptype, const String& syntaxCode, bool isManual,
ManualResourceLoader* loader)
{
// Call creation implementation
ResourcePtr ret = ResourcePtr(
createImpl(name, getNextHandle(), group, isManual, loader, gptype, syntaxCode));
addImpl(ret);
// Tell resource group manager
ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
return ret;
} | false | false | false | false | false | 0 |
cd_sensor_get_sample_state_finish (CdSensorAsyncState *state,
const GError *error)
{
CdSensorArgyllPrivate *priv = cd_sensor_argyll_get_private (state->sensor);
if (state->ret) {
g_simple_async_result_set_op_res_gpointer (state->res,
state->sample,
(GDestroyNotify) cd_color_xyz_free);
} else {
g_simple_async_result_set_from_error (state->res, error);
}
/* set state */
cd_sensor_set_state (state->sensor, CD_SENSOR_STATE_IDLE);
/* complete */
g_simple_async_result_complete_in_idle (state->res);
/* disconnect handlers */
g_signal_handler_disconnect (priv->spawn, state->exit_id);
g_signal_handler_disconnect (priv->spawn, state->stdout_id);
g_source_remove (state->timeout_id);
g_object_unref (state->res);
g_object_unref (state->sensor);
g_slice_free (CdSensorAsyncState, state);
} | false | false | false | false | false | 0 |
deleteaddr(htsblk * r) {
if (r->adr != NULL) {
freet(r->adr);
r->adr = NULL;
}
if (r->headers != NULL) {
freet(r->headers);
r->headers = NULL;
}
return 1;
} | false | false | false | false | false | 0 |
loco_get_rice_param(RICEContext *r)
{
int cnt = 0;
int val = r->count;
while(r->sum > val && cnt < 9) {
val <<= 1;
cnt++;
}
return cnt;
} | false | false | false | false | false | 0 |
receive(const Event& e)
{
Atom atom;
char* name;
WindowRep& w = *Window::rep();
DisplayRep& d = *w.display_->rep();
XEvent& xe = e.rep()->xevent_;
SelectionManager* s;
switch (xe.type) {
case SelectionRequest:
// check type of selection
atom = xe.xselectionrequest.selection;
name = XGetAtomName(d.display_, atom);
s = w.display_->find_selection(name);
// request the selecton
s->rep()->request(s, xe.xselectionrequest);
XFree(name);
break;
case SelectionNotify:
// check type of selection
atom = xe.xselectionrequest.selection;
name = XGetAtomName(d.display_, atom);
s = w.display_->find_selection(name);
// notify about the selection
s->rep()->notify(s, xe.xselection);
XFree(name);
default:
// pass everything else to Window::receive
Window::receive(e);
break;
}
} | false | false | false | false | false | 0 |
documentable_get_session_entry (Documentable *self)
{
if (!self) return NULL;
return DOCUMENTABLE_GET_IFACE (self)->get_session_entry (self);
} | false | false | false | false | false | 0 |
valtric_draw_sprites(struct mame_bitmap *bitmap, const struct rectangle *cliprect)
{
int offs;
/* Draw the sprites */
for (offs = 11 ; offs < spriteram_size ; offs += 16)
{
if ( !(spriteram[offs+4] == 0 && spriteram[offs] == 0xf0) )
{
int sx, sy, tile, flipx, flipy, color;
sx = spriteram[offs + 1];
sy = spriteram[offs];
if (argus_flipscreen)
{
sx = 240 - sx;
sy = 240 - sy;
}
if (!argus_flipscreen)
{
if ( spriteram[offs+2] & 0x01) sx -= 256;
if (!(spriteram[offs+2] & 0x02)) sy -= 256;
}
else
{
if ( spriteram[offs+2] & 0x01) sx += 256;
if (!(spriteram[offs+2] & 0x02)) sy += 256;
}
tile = spriteram[offs+3] + ((spriteram[offs+2] & 0xc0) << 2);
flipx = spriteram[offs+2] & 0x10;
flipy = spriteram[offs+2] & 0x20;
color = spriteram[offs+4] & 0x0f;
if (argus_flipscreen)
{
flipx ^= 0x10;
flipy ^= 0x20;
}
drawgfx(bitmap,Machine->gfx[0],
tile,
color,
flipx, flipy,
sx, sy,
cliprect,
TRANSPARENCY_PEN, 15);
}
}
} | false | false | false | false | false | 0 |
cdio_destroy (CdIo_t *p_cdio)
{
CdIo_last_driver = CDIO_DRIVER_UNINIT;
if (p_cdio == NULL) return;
if (p_cdio->op.free != NULL && p_cdio->env)
p_cdio->op.free (p_cdio->env);
p_cdio->env = NULL;
free (p_cdio);
} | false | false | false | false | false | 0 |
DetermineOutputFilenameStub(void) {
// if user supplied output filename stub, use that
if ( m_settings->HasCustomOutputStub )
m_outputFilenameStub = m_settings->CustomOutputStub;
// else if user supplied input BAM filename, use that (minus ".bam" extension) as stub
else if ( m_settings->HasInputFilename )
m_outputFilenameStub = RemoveFilenameExtension(m_settings->InputFilename);
// otherwise, user did not specify -stub, and input is coming from STDIN
// generate stub from timestamp
else m_outputFilenameStub = GetTimestampString();
} | false | false | false | false | false | 0 |
position_changed (GcMasterProvider *provider,
GeocluePositionFields fields,
int timestamp,
double latitude,
double longitude,
double altitude,
GeoclueAccuracy *accuracy,
GcMasterClient *client)
{
GcMasterClientPrivate *priv = GET_PRIVATE (client);
time_t now;
now = time (NULL);
if (priv->min_time > (now - priv->last_position_changed)) {
/* NOTE: currently no-one makes sure there is an emit
* after min_time */
return;
}
priv->last_position_changed = now;
gc_iface_position_emit_position_changed
(GC_IFACE_POSITION (client),
fields,
timestamp,
latitude, longitude, altitude,
accuracy);
} | false | false | false | false | false | 0 |
process_repContainer(ASTrepContainer& c)
{
for (ASTparameters::iterator it = c.mParameters.begin(),
eit= c.mParameters.end(); it != eit; ++it)
{
if (it->isParameter || !it->mDefinition) {
it->mStackIndex = mLocalStackDepth;
c.mStackCount += it->mTuplesize;
mLocalStackDepth += it->mTuplesize;
}
}
} | false | false | false | false | false | 0 |
button_press_event(GtkWidget *widget, /* {{{ */
GdkEventButton *ev) {
GtkWidget *menu = NULL;
GtkWidget *item = NULL;
int num_groups = 0;
xkbGroup groups[XKB_MAX_GROUPS];
int active_group;
int i;
if (! widget) return;
if (ev->button == 1) {
memset(groups, 0, sizeof(groups));
if (! xkb_status(GDK_DISPLAY(), &num_groups, &active_group, groups))
goto cleanup;
menu = gtk_menu_new();
/* Create the menu items */
for (i = 0; i < num_groups; i++) {
GdkPixmap *img_gdk;
GtkWidget *img;
if (! (img_gdk = gdk_pixmap_colormap_create_from_xpm_d(NULL,
gdk_colormap_get_system (), NULL, NULL, groups[i].flag_xpm)))
continue;
if (! (img = gtk_image_new_from_pixmap(img_gdk, NULL)))
continue;
item = gtk_image_menu_item_new_with_label(groups[i].name ? groups[i].name : "N/A");
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img);
g_signal_connect(G_OBJECT(item), "activate",
G_CALLBACK(keyboard_selection), GINT_TO_POINTER(i));
gtk_widget_show(item);
gtk_widget_show(img);
}
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, ev->button, ev->time);
cleanup:
xkb_free_groups(num_groups, groups);
} else if (ev->button == 3) {
cycle_layout();
}
} | false | false | false | false | false | 0 |
labelIsolatedEdges(int thisIndex,int targetIndex)
{
std::vector<Edge*> *edges=(*arg)[thisIndex]->getEdges();
for(std::vector<Edge*>::iterator i=edges->begin();i<edges->end();i++) {
Edge *e=*i;
if (e->isIsolated()) {
labelIsolatedEdge(e,targetIndex,(*arg)[targetIndex]->getGeometry());
isolatedEdges.push_back(e);
}
}
} | false | false | false | false | false | 0 |
runMonoAmplifier(LADSPA_Handle Instance,
unsigned long SampleCount) {
LADSPA_Data * pfInput;
LADSPA_Data * pfOutput;
LADSPA_Data fGain;
Amplifier * psAmplifier;
unsigned long lSampleIndex;
psAmplifier = (Amplifier *)Instance;
pfInput = psAmplifier->m_pfInputBuffer1;
pfOutput = psAmplifier->m_pfOutputBuffer1;
fGain = *(psAmplifier->m_pfControlValue);
for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
*(pfOutput++) = *(pfInput++) * fGain;
} | false | false | false | false | false | 0 |
pci_find_next_bus(const struct pci_bus *from)
{
struct list_head *n;
struct pci_bus *b = NULL;
WARN_ON(in_interrupt());
down_read(&pci_bus_sem);
n = from ? from->node.next : pci_root_buses.next;
if (n != &pci_root_buses)
b = list_entry(n, struct pci_bus, node);
up_read(&pci_bus_sem);
return b;
} | false | false | false | false | false | 0 |
lockall ( char **lkfiles, int log )
{
int err = 0 ;
char **p = lkfiles ;
while ( *p && **p && ! err )
if ( ( err = ttlock ( *p++, log ) ) == 3 ) err = 0 ;
return err ;
} | false | false | false | false | false | 0 |
be_eqd_update(struct be_adapter *adapter, bool force_update)
{
struct be_set_eqd set_eqd[MAX_EVT_QS];
struct be_aic_obj *aic;
struct be_eq_obj *eqo;
int i, num = 0, eqd;
for_all_evt_queues(adapter, eqo, i) {
aic = &adapter->aic_obj[eqo->idx];
eqd = be_get_new_eqd(eqo);
if (force_update || eqd != aic->prev_eqd) {
set_eqd[num].delay_multiplier = (eqd * 65)/100;
set_eqd[num].eq_id = eqo->q.id;
aic->prev_eqd = eqd;
num++;
}
}
if (num)
be_cmd_modify_eqd(adapter, set_eqd, num);
} | false | false | false | false | false | 0 |
timer_init( void )
{
start_time = timer_get_time(); if( start_time < 0 ) return 1;
timer_event = event_register( timer_frame, "Timer" );
event_add( 0, timer_event );
return 0;
} | false | false | false | false | false | 0 |
elm_hoversel_item_add(Evas_Object *obj,
const char *label,
const char *icon_file,
Elm_Icon_Type icon_type,
Evas_Smart_Cb func,
const void *data)
{
ELM_HOVERSEL_CHECK(obj) NULL;
ELM_HOVERSEL_DATA_GET(obj, sd);
Elm_Hoversel_Item *item = elm_widget_item_new(obj, Elm_Hoversel_Item);
if (!item) return NULL;
elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
item->label = eina_stringshare_add(label);
item->icon_file = eina_stringshare_add(icon_file);
item->icon_type = icon_type;
item->func = func;
item->base.data = data;
sd->items = eina_list_append(sd->items, item);
return (Elm_Object_Item *)item;
} | false | false | false | false | false | 0 |
es_getVideoInfo(sdl_data *sd, int len, char *buff)
{
char *bp, *start;
int sendlen;
const SDL_VideoInfo *vi;
bp = start = sdl_get_temp_buff(sd, 9+2*8);
vi = SDL_GetVideoInfo();
if(vi->hw_available) put8(bp, 1);
else put8(bp, 0);
if(vi->wm_available) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_hw) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_hw_CC) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_hw_A) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_sw) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_sw_CC) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_sw_A) put8(bp, 1);
else put8(bp, 0);
if(vi->blit_fill) put8(bp, 1);
else put8(bp, 0);
put32be(bp, vi->video_mem);
PUSHGLPTR(vi->vfmt, bp);
sendlen = bp - start;
sdl_send(sd, sendlen);
} | false | false | false | false | false | 0 |
PopFontSettings(void)
{
if (FontInfoDepth == 0)
diagnostics(WARNING, "FontInfoDepth = 0, cannot PopFontSettings()!");
FontInfoDepth--;
diagnostics(6, "PopFontSettings depth=%2d, family=%2d, size=%2d, shape=%2d, series=%2d, encoding=%2d",
FontInfoDepth, RtfFontInfo[FontInfoDepth].family,
RtfFontInfo[FontInfoDepth].size,
RtfFontInfo[FontInfoDepth].shape,
RtfFontInfo[FontInfoDepth].series,
RtfFontInfo[FontInfoDepth].encoding);
} | false | false | false | false | false | 0 |
mxs_auart_reset_deassert(struct uart_port *u)
{
int i;
unsigned int reg;
writel(AUART_CTRL0_SFTRST, u->membase + AUART_CTRL0_CLR);
for (i = 0; i < 10000; i++) {
reg = readl(u->membase + AUART_CTRL0);
if (!(reg & AUART_CTRL0_SFTRST))
break;
udelay(3);
}
writel(AUART_CTRL0_CLKGATE, u->membase + AUART_CTRL0_CLR);
} | false | false | false | false | false | 0 |
printCounterValue( Control* c, uint32_t counter, uint64_t value ) {
uint32_t properties = OTF_COUNTER_VARTYPE_UNSIGNED8;
std::map<uint32_t,uint32_t>::const_iterator it
= c->counter_props.find( counter );
if( it != c->counter_props.end() ) {
properties= it->second & OTF_COUNTER_VARTYPE_BITS;
}
switch( properties ) {
case OTF_COUNTER_VARTYPE_UNSIGNED8:
case OTF_COUNTER_VARTYPE_UNSIGNED4:
case OTF_COUNTER_VARTYPE_UNSIGNED2: {
uint64_t conv_value = OTF_Counter2Unsigned( value );
fprintf( c->outfile, "%llu", (unsigned long long) conv_value );
break;
}
case OTF_COUNTER_VARTYPE_SIGNED8:
case OTF_COUNTER_VARTYPE_SIGNED4:
case OTF_COUNTER_VARTYPE_SIGNED2: {
int64_t conv_value = OTF_Counter2Signed( value );
fprintf( c->outfile, "%lld", (long long) conv_value );
break;
}
case OTF_COUNTER_VARTYPE_FLOAT: {
float conv_value = OTF_Counter2Float( value );
fprintf( c->outfile, "%f", conv_value );
break;
}
case OTF_COUNTER_VARTYPE_DOUBLE: {
double conv_value = OTF_Counter2Double( value );
fprintf( c->outfile, "%f", conv_value );
break;
}
default:
fprintf( c->outfile, "INVALID TYPE <%08llx>",
(unsigned long long)value );
}
} | false | false | false | false | false | 0 |
kchar_toucs4(kutext_t *utf8) /* utf8 -> ucs4 */
{
#if defined(K_USING_UTF8)
kint_t ucs4 = 0;
int i= 0;
kchar_t ret = 0;
if (!utf8_isSingleton(utf8[0])) {
kushort_t length_utf8 = utf8len(utf8[i]);
kchar_t mask = (kchar_t)(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3);
switch(length_utf8){
case 2:
/* 110xxxxx 10xxxxxx */
TODO();
break;
case 3:
/* format 1110xxxx 10xxxxxx 10xxxxxx */
// first 4 bits
ucs4 = 0;
ret = utf8[0] & mask;
ucs4 = ucs4 | ret;
// second bit
ucs4 = ucs4 << 6;
mask = mask | 1 << 4 | 1 << 5;
ret = utf8[1] & mask;
ucs4 = ucs4 | ret;
// third bit
ucs4 = ucs4 << 6;
ret = mask & utf8[2];
ucs4 = ucs4 | ret;
break;
default:
/* TODO: */
break;
}
} else {
/* ASCII, let it goes...*/
ucs4 = utf8[0];
}
return ucs4;
#else
return (kint_t)utf8[0];
#endif
} | false | false | false | false | false | 0 |
tech_free(Tech_type_id tech)
{
struct advance *p = &advances[tech];
if (NULL != p->helptext) {
strvec_destroy(p->helptext);
p->helptext = NULL;
}
if (p->bonus_message) {
free(p->bonus_message);
p->bonus_message = NULL;
}
} | false | false | false | false | false | 0 |
format(int32_t number,
UnicodeString& toAppendTo,
FieldPosition& /* pos */) const
{
if (defaultRuleSet) {
int32_t startPos = toAppendTo.length();
defaultRuleSet->format((int64_t)number, toAppendTo, toAppendTo.length());
adjustForCapitalizationContext(startPos, toAppendTo);
}
return toAppendTo;
} | false | false | false | false | false | 0 |
FreeSL(l)
SkipList l;
{
register SLNode p,q;
void (*freeitem)() = l->freeitem;
if (l == NULL || l->header == NULL)
return;
p = l->header; /* free header node first, because it doesn't */
q = p->forward[0]; /* have a real key to it */
free(p);
p = q;
while (p != NULL)
{
q = p->forward[0];
if (freeitem)
(*freeitem)(p->key);
free(p);
p = q;
}
free(l);
} | false | false | false | false | false | 0 |
unpackScalar(SV * arg, void * var, int datatype) {
SV* tmp_sv[2];
if (var == NULL) {
sv_setpvn(arg,"",0);
return;
}
switch (datatype) {
case TSTRING:
sv_setpv(arg,(char *)var); break;
case TLOGICAL:
sv_setiv(arg,(IV)(*(logical *)var)); break;
case TSBYTE:
sv_setiv(arg,(IV)(*(sbyte *)var)); break;
case TBYTE:
sv_setuv(arg,(UV)(*(byte *)var)); break;
case TUSHORT:
sv_setuv(arg,(UV)(*(unsigned short *)var)); break;
case TSHORT:
sv_setiv(arg,(IV)(*(short *)var)); break;
case TUINT:
sv_setuv(arg,(UV)(*(unsigned int *)var)); break;
case TINT:
sv_setiv(arg,(IV)(*(int *)var)); break;
case TULONG:
sv_setuv(arg,(UV)(*(unsigned long *)var)); break;
case TLONG:
sv_setiv(arg,(IV)(*(long *)var)); break;
case TLONGLONG:
sv_setiv(arg,(IV)(*(LONGLONG *)var)); break;
case TFLOAT:
sv_setnv(arg,(double)(*(float *)var)); break;
case TDOUBLE:
sv_setnv(arg,(double)(*(double *)var)); break;
case TCOMPLEX:
tmp_sv[0] = newSVnv(*((float *)var));
tmp_sv[1] = newSVnv(*((float *)var+1));
sv_setsv(arg,newRV_noinc((SV*)av_make(2,tmp_sv)));
SvREFCNT_dec(tmp_sv[0]);
SvREFCNT_dec(tmp_sv[1]);
break;
case TDBLCOMPLEX:
tmp_sv[0] = newSVnv(*((double *)var));
tmp_sv[1] = newSVnv(*((double *)var+1));
sv_setsv(arg,newRV_noinc((SV*)av_make(2,tmp_sv)));
SvREFCNT_dec(tmp_sv[0]);
SvREFCNT_dec(tmp_sv[1]);
break;
default:
croak("unpackScalar() - invalid type (%d) given",datatype);
}
return;
} | false | false | false | false | false | 0 |
setLegend(bool legend, int coltype)
{
if (legend == true && coltype != MODEL_NONE) {
showColorLegend(true);
} else {
showColorLegend(false);
}
} | false | false | false | false | false | 0 |
plot_hd(cairo_t* cairo, plot_args_t* pargs, plotann_t* ann) {
int i, N;
hd_catalog_t* hdcat = NULL;
double ra,dec,rad;
bl* hdlist = NULL;
if (!ann->hd_catalog)
return;
hdcat = henry_draper_open(ann->hd_catalog);
if (!hdcat) {
ERROR("Failed to open Henry Draper catalog file \"%s\"", ann->hd_catalog);
return;
}
if (plotstuff_get_radec_center_and_radius(pargs, &ra, &dec, &rad)) {
ERROR("Failed to get RA,Dec,radius from plotstuff");
return;
}
hdlist = henry_draper_get(hdcat, ra, dec, deg2arcsec(rad));
logverb("Got %i Henry Draper stars\n", bl_size(hdlist));
N = bl_size(hdlist);
for (i=0; i<N; i++) {
hd_entry_t* entry = bl_access(hdlist, i);
double px, py;
char label[16];
if (!plotstuff_radec2xy(pargs, entry->ra, entry->dec, &px, &py))
continue;
px -= 1;
py -= 1;
if (px < 1 || py < 1 || px > pargs->W || py > pargs->H)
continue;
logverb("HD %i at RA,Dec (%g,%g) -> xy (%g, %g)\n", entry->hd, entry->ra, entry->dec, px, py);
plotstuff_stack_marker(pargs, px, py);
if (ann->HD_labels) {
sprintf(label, "HD %i", entry->hd);
plotstuff_stack_text(pargs, cairo, label, px, py);
}
}
bl_free(hdlist);
henry_draper_close(hdcat);
} | false | false | false | false | false | 0 |
findReserved (char *name)
{
int l = 0;
int h = RESERVEDSIZE - 1;
while (l <= h)
{
int m = (l+h)/2;
int comp = strcmp(name, reserved[m].name);
if (comp < 0)
h = m-1;
else if (comp == 0)
return reserved[m].token;
else
l = m+1;
}
return 0;
} | false | false | false | false | false | 0 |
mv88e1xxx_reset(struct cphy *cphy, int wait)
{
u32 ctl;
int time_out = 1000;
mdio_set_bit(cphy, MII_BMCR, BMCR_RESET);
do {
(void) simple_mdio_read(cphy, MII_BMCR, &ctl);
ctl &= BMCR_RESET;
if (ctl)
udelay(1);
} while (ctl && --time_out);
return ctl ? -1 : 0;
} | false | false | false | false | false | 0 |
qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf,
loff_t offset, size_t size)
{
int ret = 0;
u32 data;
if (qlcnic_api_lock(adapter)) {
dev_err(&adapter->pdev->dev,
"%s: failed to acquire lock. addr offset 0x%x\n",
__func__, (u32)offset);
return;
}
data = QLCRD32(adapter, (u32) offset, &ret);
qlcnic_api_unlock(adapter);
if (ret == -EIO) {
dev_err(&adapter->pdev->dev,
"%s: failed. addr offset 0x%x\n",
__func__, (u32)offset);
return;
}
memcpy(buf, &data, size);
} | false | true | false | false | false | 1 |
writeIncomingMessage(const QByteArray &packet, bool *notStun, const QHostAddress &from_addr, int from_port)
{
if(!checkActiveAndFrom(from_addr, from_port))
{
// could be STUN, don't really know for sure
*notStun = false;
return false;
}
int validationFlags = 0;
StunMessage msg = parse_stun_message(packet, &validationFlags, key);
if(msg.isNull())
{
// packet doesn't parse at all, surely not STUN
*notStun = true;
return false;
}
if(fpRequired && !(validationFlags & StunMessage::Fingerprint))
{
// fingerprint failed when required. consider the
// packet to be surely not STUN
*notStun = true;
return false;
}
processIncoming(msg, (validationFlags & StunMessage::MessageIntegrity) ? true : false);
return true;
} | false | false | false | false | false | 0 |
system_suspend(void)
{
FILE *fComp;
FILE *fSig;
FILE *fConn;
FILE *fSched;
fComp = fopen("./Components.suspend", "wb");
fSig = fopen("./Signals.suspend", "wb");
fConn = fopen("./Connections.suspend", "wb");
fSched = fopen("./Schedules.suspend", "wb");
if (fComp == NULL){
fprintf(stderr, "\nCreating Components.suspend failed\n");
return;
}
if (fSig == NULL){
fprintf(stderr, "\nCreating Signals.suspend failed\n");
return;
}
if (fConn == NULL){
fprintf(stderr, "\nCreating Connections.suspend failed\n");
return;
}
if (fSched == NULL){
fprintf(stderr, "\nCreating Schedules.suspend failed\n");
return;
}
suspend_components(fComp);
suspend_signals(fSig);
suspend_connections(fConn);
suspend_schedules(fSched);
fclose(fComp);
fclose(fSig);
fclose(fConn);
fclose(fSched);
} | false | false | false | false | true | 1 |
operator<<(const double* r)
{
REPORT
Tracer tr("SubMatrix(<<double*)");
SetUpLHS();
if (row_skip+row_number > gm->Nrows() || col_skip+col_number > gm->Ncols())
Throw(SubMatrixDimensionException());
MatrixRow mr(gm, LoadOnEntry+StoreOnExit+Node_pairPart, row_skip);
// do need LoadOnEntry
MatrixRowCol sub; int i = row_number;
while (i--)
{
mr.SubRowCol(sub, col_skip, col_number); // put values in sub
sub.Copy(r); mr.Next();
}
} | false | false | false | false | false | 0 |
_tenFiberAnisoSpeed(double *step, double xx, double parm[3]) {
double aa, dd, tt, yy;
tt = parm[1];
dd = parm[2];
aa = 1.0/(DBL_EPSILON + 4*dd*(1.0-tt));
yy = xx - tt + dd;
xx = (xx < tt - dd
? 0
: (xx < tt + dd
? aa*yy*yy
: (xx - tt)/(1 - tt)));
xx = AIR_LERP(parm[0], 1, xx);
ELL_3V_SCALE(step, xx, step);
} | false | false | false | false | false | 0 |
mx_box_layout_set_spacing (MxBoxLayout *box,
guint spacing)
{
MxBoxLayoutPrivate *priv;
g_return_if_fail (MX_IS_BOX_LAYOUT (box));
priv = box->priv;
if (priv->spacing != spacing)
{
priv->spacing = spacing;
priv->ignore_css_spacing = TRUE;
clutter_actor_queue_relayout (CLUTTER_ACTOR (box));
g_object_notify (G_OBJECT (box), "spacing");
}
} | false | false | false | false | false | 0 |
brasero_track_data_set_source (BraseroTrackData *track,
GSList *grafts,
GSList *unreadable)
{
BraseroTrackDataClass *klass;
g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), BRASERO_BURN_ERR);
klass = BRASERO_TRACK_DATA_GET_CLASS (track);
return klass->set_source (track, grafts, unreadable);
} | false | false | false | true | false | 1 |
js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp)
{
uintN nslots, minargs, skip;
if (fp->callobj)
JS_CALL_OBJECT_TRACER(trc, fp->callobj, "call");
if (fp->argsobj)
JS_CALL_OBJECT_TRACER(trc, JSVAL_TO_OBJECT(fp->argsobj), "arguments");
if (fp->varobj)
JS_CALL_OBJECT_TRACER(trc, fp->varobj, "variables");
if (fp->script) {
js_TraceScript(trc, fp->script);
/* fp->slots is null for watch pseudo-frames, see js_watch_set. */
if (fp->slots) {
/*
* Don't mark what has not been pushed yet, or what has been
* popped already.
*/
if (fp->regs && fp->regs->sp) {
nslots = (uintN) (fp->regs->sp - fp->slots);
JS_ASSERT(nslots >= fp->script->nfixed);
} else {
nslots = fp->script->nfixed;
}
TRACE_JSVALS(trc, nslots, fp->slots, "slot");
}
} else {
JS_ASSERT(!fp->slots);
JS_ASSERT(!fp->regs);
}
/* Allow for primitive this parameter due to JSFUN_THISP_* flags. */
JS_ASSERT(JSVAL_IS_OBJECT((jsval)fp->thisp) ||
(fp->fun && JSFUN_THISP_FLAGS(fp->fun->flags)));
JS_CALL_VALUE_TRACER(trc, (jsval)fp->thisp, "this");
if (fp->argv) {
JS_CALL_VALUE_TRACER(trc, fp->argv[-2], "callee");
nslots = fp->argc;
skip = 0;
if (fp->fun) {
minargs = FUN_MINARGS(fp->fun);
if (minargs > nslots)
nslots = minargs;
if (!FUN_INTERPRETED(fp->fun)) {
JS_ASSERT(!(fp->fun->flags & JSFUN_FAST_NATIVE));
nslots += fp->fun->u.n.extra;
}
if (fp->fun->flags & JSFRAME_ROOTED_ARGV)
skip = 2 + fp->argc;
}
TRACE_JSVALS(trc, 2 + nslots - skip, fp->argv - 2 + skip, "operand");
}
JS_CALL_VALUE_TRACER(trc, fp->rval, "rval");
if (fp->scopeChain)
JS_CALL_OBJECT_TRACER(trc, fp->scopeChain, "scope chain");
if (fp->sharpArray)
JS_CALL_OBJECT_TRACER(trc, fp->sharpArray, "sharp array");
} | false | false | false | false | false | 0 |
OTFAUX_State_declareProcess( OTFAUX_State* auxState,
uint64_t processId,
int isThumbnailProcess )
{
OTFAUX_Process* process;
if ( !auxState )
return 0;
process = get_process( auxState, processId );
if ( !process )
return 0;
if ( isThumbnailProcess )
return OTFAUX_Process_enableThumbnail( process,
auxState->timestampsSize );
return 1;
} | false | false | false | false | false | 0 |
rsvg_css_parse_font_weight (const char *str, gboolean * inherit)
{
SETINHERIT ();
if (str) {
if (!strcmp (str, "lighter"))
return PANGO_WEIGHT_LIGHT;
else if (!strcmp (str, "bold"))
return PANGO_WEIGHT_BOLD;
else if (!strcmp (str, "bolder"))
return PANGO_WEIGHT_ULTRABOLD;
else if (!strcmp (str, "100"))
return (PangoWeight) 100;
else if (!strcmp (str, "200"))
return (PangoWeight) 200;
else if (!strcmp (str, "300"))
return (PangoWeight) 300;
else if (!strcmp (str, "400"))
return (PangoWeight) 400;
else if (!strcmp (str, "500"))
return (PangoWeight) 500;
else if (!strcmp (str, "600"))
return (PangoWeight) 600;
else if (!strcmp (str, "700"))
return (PangoWeight) 700;
else if (!strcmp (str, "800"))
return (PangoWeight) 800;
else if (!strcmp (str, "900"))
return (PangoWeight) 900;
else if (!strcmp (str, "inherit")) {
UNSETINHERIT ();
return PANGO_WEIGHT_NORMAL;
}
}
UNSETINHERIT ();
return PANGO_WEIGHT_NORMAL;
} | false | false | false | false | false | 0 |
pmem_map_cl(int fd, size_t len)
{
void *base;
if ((base = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED,
fd, 0)) == MAP_FAILED)
return NULL;
return base;
} | false | false | false | false | false | 0 |
get_digitize_raw (GMT_LONG digunit, FILE *fpd, GMT_LONG USB, double *xdig, double *ydig, struct GMTDIGITIZE_CTRL *C) {
GMT_LONG i, n, ix, iy;
char buffer[256], button;
if (USB) {
if (!GMT_fgets (buffer, 256, fpd)) return (END_BUTTON);
n = strlen (buffer);
}
else
n = read (digunit, buffer, (size_t)255);
if (n <= 0) return (END_BUTTON);
n--;
buffer[n] = 0;
#ifdef DEBUG
fprintf (stderr, "Got %ld bytes [%s]\n", n, buffer);
#endif
for (i = 0; i < n; i++) if (buffer[i] == ',') buffer[i] = ' ';
sscanf (buffer, "%" GMT_LL "d %" GMT_LL "d %c", &ix, &iy, &button);
*xdig = (double)(ix) * C->INV_LPI; /* Convert from lines per inch to inches */
*ydig = (double)(iy) * C->INV_LPI;
return ((GMT_LONG)(button - '0'));
} | false | false | false | false | false | 0 |
AssignOriAvg(const Image& grad, const Image& ori, float octSize,
float octScale, float octRow, float octCol, float strength, KeyList& keys)
{
int r, c, irow, icol, rows, cols, radius;
float gval, sigma, distsq, weight, angle, xvec = 0.0, yvec = 0.0;
rows = grad.rows;
cols = grad.cols;
irow = (int) (octRow+0.5);
icol = (int) (octCol+0.5);
/* Look at pixels within 3 sigma around the point and put their
Gaussian weighted vector values in (xvec, yvec).
*/
sigma = OriSigma * octScale;
radius = (int) (3.0 * sigma);
for (r = irow - radius; r <= irow + radius; r++)
for (c = icol - radius; c <= icol + radius; c++)
if (r >= 0 && c >= 0 && r < rows && c < cols) {
gval = grad.pixels[r][c];
distsq = (r - octRow) * (r - octRow) + (c - octCol) * (c - octCol);
if (distsq <= radius * radius) {
weight = exp(- distsq / (2.0 * sigma * sigma));
/* Angle is in range of -pi to pi. */
angle = ori.pixels[r][c];
xvec += gval * cos(angle);
yvec += gval * sin(angle);
}
}
/* atan2 returns angle in range [-pi,pi]. */
angle = atan2(yvec, xvec);
MakeKeypoint(grad, ori, octSize, octScale, octRow, octCol,
angle, strength, keys);
} | false | false | false | false | false | 0 |
get_mainwin(gpointer data)
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin = NULL;
MessageView *msgview;
cm_return_val_if_fail(toolbar_item != NULL, NULL);
switch(toolbar_item->type) {
case TOOLBAR_MAIN:
mainwin = (MainWindow*)toolbar_item->parent;
break;
case TOOLBAR_MSGVIEW:
msgview = (MessageView*)toolbar_item->parent;
mainwin = (MainWindow*)msgview->mainwin;
break;
default:
break;
}
return mainwin;
} | false | false | false | false | false | 0 |
ltsGetFreeBlock(LogicalTapeSet *lts)
{
/*
* If there are multiple free blocks, we select the one appearing last in
* freeBlocks[] (after sorting the array if needed). If there are none,
* assign the next block at the end of the file.
*/
if (lts->nFreeBlocks > 0)
{
if (!lts->blocksSorted)
{
qsort((void *) lts->freeBlocks, lts->nFreeBlocks,
sizeof(long), freeBlocks_cmp);
lts->blocksSorted = true;
}
return lts->freeBlocks[--lts->nFreeBlocks];
}
else
return lts->nFileBlocks++;
} | false | false | false | false | false | 0 |
discover_conf_name_to_bus(char *name, discover_error_t *status)
{
int i;
for (i = 0; bus_map[i].name; i++) {
if (strcmp(bus_map[i].name, name) == 0) {
return i;
}
}
status->code = DISCOVER_EBUSNOTFOUND;
return -1;
} | false | false | false | false | false | 0 |
xfs_corruption_error(
const char *tag,
int level,
struct xfs_mount *mp,
void *p,
const char *filename,
int linenum,
void *ra)
{
if (level <= xfs_error_level)
xfs_hex_dump(p, 64);
xfs_error_report(tag, level, mp, filename, linenum, ra);
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
} | false | false | false | false | false | 0 |
gr_scanline( int x1, int x2, int y )
{
if ((y<0)||(y>MAXY)) return;
if (x2 < x1 ) x2 ^= x1 ^= x2;
if (x1 > MAXX) return;
if (x2 < MINX) return;
if (x1 < MINX) x1 = MINX;
if (x2 > MAXX) x2 = MAXX;
if (grd_curcanv->cv_fade_level >= GR_FADE_OFF) {
switch(TYPE)
{
case BM_LINEAR:
#ifdef OGL
case BM_OGL:
#endif
gr_linear_stosd( DATA + ROWSIZE*y + x1, (unsigned char)COLOR, x2-x1+1);
break;
}
} else {
switch(TYPE)
{
case BM_LINEAR:
#ifdef OGL
case BM_OGL:
#endif
gr_linear_darken( DATA + ROWSIZE*y + x1, grd_curcanv->cv_fade_level, x2-x1+1, gr_fade_table);
break;
}
}
} | false | false | false | false | false | 0 |
skip( const char *in )
{
while ( in && *in && (unsigned char) *in <= 32 )
in++;
return in;
} | false | false | false | false | false | 0 |
sample_load_twice(struct drm_device *dev, bool sense[2])
{
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvif_object *device = &drm->device.object;
int i;
for (i = 0; i < 2; i++) {
bool sense_a, sense_b, sense_b_prime;
int j = 0;
/*
* wait for bit 0 clear -- out of hblank -- (say reg value 0x4),
* then wait for transition 0x4->0x5->0x4: enter hblank, leave
* hblank again
* use a 10ms timeout (guards against crtc being inactive, in
* which case blank state would never change)
*/
if (nvif_msec(&drm->device, 10,
if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
break;
) < 0)
return -EBUSY;
if (nvif_msec(&drm->device, 10,
if ( (nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
break;
) < 0)
return -EBUSY;
if (nvif_msec(&drm->device, 10,
if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
break;
) < 0)
return -EBUSY;
udelay(100);
/* when level triggers, sense is _LO_ */
sense_a = nvif_rd08(device, NV_PRMCIO_INP0) & 0x10;
/* take another reading until it agrees with sense_a... */
do {
udelay(100);
sense_b = nvif_rd08(device, NV_PRMCIO_INP0) & 0x10;
if (sense_a != sense_b) {
sense_b_prime =
nvif_rd08(device, NV_PRMCIO_INP0) & 0x10;
if (sense_b == sense_b_prime) {
/* ... unless two consecutive subsequent
* samples agree; sense_a is replaced */
sense_a = sense_b;
/* force mis-match so we loop */
sense_b = !sense_a;
}
}
} while ((sense_a != sense_b) && ++j < MAX_HBLANK_OSC);
if (j == MAX_HBLANK_OSC)
/* with so much oscillation, default to sense:LO */
sense[i] = false;
else
sense[i] = sense_a;
}
return 0;
} | false | false | false | false | false | 0 |
integrated_lvds_disable(struct lvds_setting_information
*plvds_setting_info,
struct lvds_chip_information *plvds_chip_info)
{
bool turn_off_first_powersequence = false;
bool turn_off_second_powersequence = false;
if (INTERFACE_LVDS0LVDS1 == plvds_chip_info->output_interface)
turn_off_first_powersequence = true;
if (INTERFACE_LVDS0 == plvds_chip_info->output_interface)
turn_off_first_powersequence = true;
if (INTERFACE_LVDS1 == plvds_chip_info->output_interface)
turn_off_second_powersequence = true;
if (turn_off_second_powersequence) {
/* Use second power sequence control: */
/* Turn off power sequence. */
viafb_write_reg_mask(CRD4, VIACR, 0, BIT1);
/* Turn off back light. */
viafb_write_reg_mask(CRD3, VIACR, 0xC0, BIT6 + BIT7);
}
if (turn_off_first_powersequence) {
/* Use first power sequence control: */
/* Turn off power sequence. */
viafb_write_reg_mask(CR6A, VIACR, 0, BIT3);
/* Turn off back light. */
viafb_write_reg_mask(CR91, VIACR, 0xC0, BIT6 + BIT7);
}
/* Power off LVDS channel. */
switch (plvds_chip_info->output_interface) {
case INTERFACE_LVDS0:
{
viafb_write_reg_mask(CRD2, VIACR, 0x80, BIT7);
break;
}
case INTERFACE_LVDS1:
{
viafb_write_reg_mask(CRD2, VIACR, 0x40, BIT6);
break;
}
case INTERFACE_LVDS0LVDS1:
{
viafb_write_reg_mask(CRD2, VIACR, 0xC0, BIT6 + BIT7);
break;
}
}
} | false | false | false | false | false | 0 |
Gal_tv_get_timings(unsigned long flags, PGAL_TVTIMING pTV)
{
INIT_GAL(pTV);
pTV->dwSubfunction = GALFN_GETTVTIMING;
pTV->dwFlags = flags;
if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
return 0;
else {
return 1;
}
} | false | false | false | false | false | 0 |
dump_scope (tree scope, int flags)
{
int f = flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF);
if (scope == NULL_TREE)
return;
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
if (scope != global_namespace)
{
dump_decl (scope, f);
pp_cxx_colon_colon (cxx_pp);
}
}
else if (AGGREGATE_TYPE_P (scope))
{
dump_type (scope, f);
pp_cxx_colon_colon (cxx_pp);
}
else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL)
{
dump_function_decl (scope, f);
pp_cxx_colon_colon (cxx_pp);
}
} | false | false | false | false | false | 0 |
base_alias_check (rtx x, rtx y, enum machine_mode x_mode,
enum machine_mode y_mode)
{
rtx x_base = find_base_term (x);
rtx y_base = find_base_term (y);
/* If the address itself has no known base see if a known equivalent
value has one. If either address still has no known base, nothing
is known about aliasing. */
if (x_base == 0)
{
rtx x_c;
if (! flag_expensive_optimizations || (x_c = canon_rtx (x)) == x)
return 1;
x_base = find_base_term (x_c);
if (x_base == 0)
return 1;
}
if (y_base == 0)
{
rtx y_c;
if (! flag_expensive_optimizations || (y_c = canon_rtx (y)) == y)
return 1;
y_base = find_base_term (y_c);
if (y_base == 0)
return 1;
}
/* If the base addresses are equal nothing is known about aliasing. */
if (rtx_equal_p (x_base, y_base))
return 1;
/* The base addresses are different expressions. If they are not accessed
via AND, there is no conflict. We can bring knowledge of object
alignment into play here. For example, on alpha, "char a, b;" can
alias one another, though "char a; long b;" cannot. AND addesses may
implicitly alias surrounding objects; i.e. unaligned access in DImode
via AND address can alias all surrounding object types except those
with aligment 8 or higher. */
if (GET_CODE (x) == AND && GET_CODE (y) == AND)
return 1;
if (GET_CODE (x) == AND
&& (!CONST_INT_P (XEXP (x, 1))
|| (int) GET_MODE_UNIT_SIZE (y_mode) < -INTVAL (XEXP (x, 1))))
return 1;
if (GET_CODE (y) == AND
&& (!CONST_INT_P (XEXP (y, 1))
|| (int) GET_MODE_UNIT_SIZE (x_mode) < -INTVAL (XEXP (y, 1))))
return 1;
/* Differing symbols not accessed via AND never alias. */
if (GET_CODE (x_base) != ADDRESS && GET_CODE (y_base) != ADDRESS)
return 0;
if (unique_base_value_p (x_base) || unique_base_value_p (y_base))
return 0;
return 1;
} | false | false | false | false | false | 0 |
CountSubstituteArgs(const SubstituteArg* const* args_array) {
int count = 0;
while (args_array[count] != NULL && args_array[count]->size() != -1) {
++count;
}
return count;
} | false | false | false | false | false | 0 |
gst_pad_store_sticky_event (GstPad * pad, GstEvent * event)
{
GstFlowReturn ret;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
GST_OBJECT_LOCK (pad);
ret = store_sticky_event (pad, event);
GST_OBJECT_UNLOCK (pad);
return ret;
} | false | false | false | false | false | 0 |
ConcreteConfigure( const ProcessingConfig& cfg )
{
RemoveOldControls();
CopyAsConcreteConfig( _config, cfg );
_config.AddAll();
_config.UpdateData();
unsigned nInputs = GetInputsNumber();
if (nInputs == 0)
{
AddConfigErrorMessage("No proper OSCTypeSpec setup. Use: 'f' for float, 'd' for double, 'i' for integer, 'h' for integer 64, 'M' for MIDI Message.");
return false;
}
std::string baseName = nInputs==1 ? "In Control" : _config.GetIdentifier();
ResizeControls(nInputs, baseName);
return true;
} | false | false | false | false | false | 0 |
addComponent(const char * component)
{
Pool pool;
if (0 == component)
return;
// in case of an empty string, return
if (*component == 0)
return;
// if the @a component is absolute, simply
// use it
if (isAbsolute(component))
{
m_path = component;
return;
}
if (Url::isValid(m_path.c_str()))
{
const char * newPath =
svn_path_url_add_component(m_path.c_str(),
component,
pool);
m_path = newPath;
}
else
{
svn_stringbuf_t * pathStringbuf =
svn_stringbuf_create(m_path.c_str(), pool);
svn_path_add_component(pathStringbuf,
component);
m_path = pathStringbuf->data;
}
} | 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.