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 |
|---|---|---|---|---|---|---|
list_tests_construct (GType object_type, const gchar* name) {
ListTests * self = NULL;
const gchar* _tmp0_ = NULL;
g_return_val_if_fail (name != NULL, NULL);
_tmp0_ = name;
self = (ListTests*) collection_tests_construct (object_type, _tmp0_);
gee_test_case_add_test ((GeeTestCase*) self, "[List] iterator is ordered", _list_tests_test_iterator_is_ordered_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] list iterator", _list_tests_test_list_iterator_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] duplicates are retained", _list_tests_test_duplicates_are_retained_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] get", _list_tests_test_get_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] set", _list_tests_test_set_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] insert", _list_tests_test_insert_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] remove_at", _list_tests_test_remove_at_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] index_of", _list_tests_test_index_of_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] first", _list_tests_test_first_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] last", _list_tests_test_last_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] insert_all", _list_tests_test_insert_all_gee_test_case_test_method, g_object_ref (self), g_object_unref);
gee_test_case_add_test ((GeeTestCase*) self, "[List] slice", _list_tests_test_slice_gee_test_case_test_method, g_object_ref (self), g_object_unref);
return self;
} | false | false | false | false | false | 0 |
bmc150_accel_buffer_predisable(struct iio_dev *indio_dev)
{
struct bmc150_accel_data *data = iio_priv(indio_dev);
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
return iio_triggered_buffer_predisable(indio_dev);
mutex_lock(&data->mutex);
if (!data->fifo_mode)
goto out;
bmc150_accel_set_interrupt(data, BMC150_ACCEL_INT_WATERMARK, false);
__bmc150_accel_fifo_flush(indio_dev, BMC150_ACCEL_FIFO_LENGTH, false);
data->fifo_mode = 0;
bmc150_accel_fifo_set_mode(data);
out:
mutex_unlock(&data->mutex);
return 0;
} | false | false | false | false | false | 0 |
ldns_soa_serial_unixtime(uint32_t s, void *data)
{
int32_t new_s = data ? (int32_t) (intptr_t) data
: (int32_t) ldns_time(NULL);
return new_s - ((int32_t) s) <= 0 ? s+1 : ((uint32_t) new_s);
} | false | false | false | false | false | 0 |
init_aux_patterns(Macro *spec, int mflag, AuxPat *aux)
{
init_pattern_str(&aux->name, spec->name);
init_pattern_str(&aux->body, spec->body ? spec->body->data : NULL);
init_pattern_str(&aux->expr, spec->expr ? spec->expr->data : NULL);
init_pattern_str(&aux->bind, spec->bind);
init_pattern_str(&aux->keyname, spec->keyname);
if (mflag < 0) mflag = matching;
return init_pattern_mflag(&aux->name, mflag, 0) &&
init_pattern_mflag(&aux->body, mflag, 0) &&
init_pattern_mflag(&aux->expr, mflag, 'E') &&
init_pattern_mflag(&aux->bind, mflag, 'b') &&
init_pattern_mflag(&aux->keyname, mflag, 'B');
} | false | false | false | false | false | 0 |
_pack_update_partition_msg(update_part_msg_t * msg, Buf buffer,
uint16_t protocol_version)
{
xassert(msg != NULL);
if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) {
packstr(msg->allow_groups, buffer);
packstr(msg->alternate, buffer);
pack32(msg-> grace_time, buffer);
pack32(msg-> max_time, buffer);
pack32(msg-> default_time, buffer);
pack32(msg-> max_nodes, buffer);
pack32(msg-> min_nodes, buffer);
pack32(msg-> def_mem_per_cpu, buffer);
pack32(msg-> max_mem_per_cpu, buffer);
packstr(msg->name, buffer);
packstr(msg->nodes, buffer);
pack16(msg-> flags, buffer);
pack16(msg-> max_share, buffer);
pack16(msg-> preempt_mode, buffer);
pack16(msg-> priority, buffer);
pack16(msg-> state_up, buffer);
packstr(msg->allow_alloc_nodes, buffer);
} else {
error("_pack_update_partition_msg: protocol_version "
"%hu not supported", protocol_version);
}
} | false | false | false | false | false | 0 |
devzone_draw_grid(struct mame_bitmap *bitmap)
{
UINT8 y;
data8_t *horz_PROM = memory_region(REGION_USER2);
data8_t *vert_PROM = memory_region(REGION_USER3);
offs_t horz_addr = 0;
UINT8 count = 0;
UINT8 horz_data = 0;
UINT8 vert_data;
for (y = 32; y < 224; y++)
{
UINT8 x = 0;
while (1)
{
int x1;
/* for the vertical lines, each bit indicates
if there should be a line at the x position */
vert_data = vert_PROM[x >> 3];
/* the horizontal (perspective) lines are RLE encoded.
When the screen is flipped, the address should be
decrementing. But since it's just a mirrored image,
this is easier. */
if (count == 0)
{
count = horz_PROM[horz_addr++];
}
count++;
if (count == 0)
{
horz_data = horz_PROM[horz_addr++];
}
for (x1 = 0; x1 < 8; x1++)
{
if (!(vert_data & horz_data & 0x80)) /* NAND gate */
{
pen_t pen = Machine->pens[4]; /* blue */
if (flip_screen)
plot_pixel(bitmap, 255-x, 255-y, pen);
else
plot_pixel(bitmap, x, y, pen);
}
horz_data = (horz_data << 1) | 0x01;
vert_data = (vert_data << 1) | 0x01;
x++;
}
if (x == 0) break;
}
}
} | false | false | false | false | false | 0 |
callback_long_format(struct output *o)
{
struct long_format_parameter *param = o->closure;
char *if_hostname = param->if_hostname;
struct gfarm_host_info *info = ¶m->info;
/* sizeof(struct sockaddr_in) == sizeof(struct sockaddr) */
struct sockaddr_in *addr_in = (struct sockaddr_in *)&o->peer_addr;
int i, print_ifaddr = if_hostname != NULL;
print_loadavg_authinfo(o);
printf("%s %d %s %d %d",
info->architecture, info->ncpu,
o->canonical_hostname, info->port, info->flags);
if (print_ifaddr &&
strcasecmp(o->canonical_hostname, if_hostname) == 0) {
print_ifaddr = 0;
printf("(%s)", inet_ntoa(addr_in->sin_addr));
}
for (i = 0; i < info->nhostaliases; i++) {
printf(" %s", info->hostaliases[i]);
if (print_ifaddr &&
strcasecmp(info->hostaliases[i], if_hostname) == 0) {
print_ifaddr = 0;
printf("(%s)", inet_ntoa(addr_in->sin_addr));
}
}
if (print_ifaddr) {
printf(" [%s(%s)]", if_hostname, inet_ntoa(addr_in->sin_addr));
}
putchar('\n');
if (opt_verbose && o->error != GFARM_ERR_NO_ERROR)
fprintf(stderr, "%s: %s\n", o->canonical_hostname,
gfarm_error_string(o->error));
gfarm_host_info_free(info);
if (if_hostname != NULL)
free(if_hostname);
free(param);
} | false | false | false | false | false | 0 |
parport_mos7715_write_compat(struct parport *pp,
const void *buffer,
size_t len, int flags)
{
int retval;
struct mos7715_parport *mos_parport = pp->private_data;
int actual_len;
if (parport_prologue(pp) < 0)
return 0;
mos7715_change_mode(mos_parport, PPF);
retval = usb_bulk_msg(mos_parport->serial->dev,
usb_sndbulkpipe(mos_parport->serial->dev, 2),
(void *)buffer, len, &actual_len,
MOS_WDR_TIMEOUT);
parport_epilogue(pp);
if (retval) {
dev_err(&mos_parport->serial->dev->dev,
"mos7720: usb_bulk_msg() failed: %d\n", retval);
return 0;
}
return actual_len;
} | false | false | false | false | false | 0 |
bAddDataBlocks(ULONG ulDataPosFirst, ULONG ulTotalLength,
ULONG ulStartBlock, const ULONG *aulBBD, size_t tBBDLen)
{
data_block_type tDataBlock;
ULONG ulDataPos, ulOffset, ulIndex;
long lToGo;
BOOL bSuccess;
fail(ulTotalLength > (ULONG)LONG_MAX);
fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
fail(aulBBD == NULL);
NO_DBG_HEX(ulDataPosFirst);
NO_DBG_DEC(ulTotalLength);
lToGo = (long)ulTotalLength;
ulDataPos = ulDataPosFirst;
ulOffset = ulDataPosFirst;
for (ulIndex = ulStartBlock;
ulIndex != END_OF_CHAIN && lToGo > 0;
ulIndex = aulBBD[ulIndex]) {
if (ulIndex == UNUSED_BLOCK || ulIndex >= (ULONG)tBBDLen) {
DBG_DEC(ulIndex);
DBG_DEC(tBBDLen);
return FALSE;
}
if (ulOffset >= BIG_BLOCK_SIZE) {
ulOffset -= BIG_BLOCK_SIZE;
continue;
}
tDataBlock.ulFileOffset =
(ulIndex + 1) * BIG_BLOCK_SIZE + ulOffset;
tDataBlock.ulDataPos = ulDataPos;
tDataBlock.ulLength = min(BIG_BLOCK_SIZE - ulOffset,
(ULONG)lToGo);
fail(tDataBlock.ulLength > BIG_BLOCK_SIZE);
ulOffset = 0;
if (!bAdd2DataBlockList(&tDataBlock)) {
DBG_HEX(tDataBlock.ulFileOffset);
DBG_HEX(tDataBlock.ulDataPos);
DBG_DEC(tDataBlock.ulLength);
return FALSE;
}
ulDataPos += tDataBlock.ulLength;
lToGo -= (long)tDataBlock.ulLength;
}
bSuccess = lToGo == 0 ||
(ulTotalLength == (ULONG)LONG_MAX && ulIndex == END_OF_CHAIN);
DBG_DEC_C(!bSuccess, lToGo);
DBG_DEC_C(!bSuccess, ulTotalLength);
DBG_DEC_C(!bSuccess, ulIndex);
return bSuccess;
} | false | false | false | false | false | 0 |
ktest_destroy_last_req(krb5_last_req_entry ***lr)
{
int i;
if (*lr) {
for (i=0; (*lr)[i] != NULL; i++)
free((*lr)[i]);
free(*lr);
}
} | false | false | false | false | false | 0 |
parse()
{
tchar c;
pos = 0;
while(pos < pattern.length()) {
c = pattern[pos++];
switch (state) {
case LITERAL_STATE :
// In literal state, the last char is always a literal.
if(pos == pattern.length()) {
currentLiteral += c;
continue;
}
if(c == ESCAPE_CHAR) {
// peek at the next char.
switch (pattern[pos]) {
case ESCAPE_CHAR:
currentLiteral += c;
pos++; // move pointer
break;
default:
if(! currentLiteral.empty ()) {
list.push_back
(new LiteralPatternConverter(currentLiteral));
//getLogLog().debug("Parsed LITERAL converter: \""
// +currentLiteral+"\".");
}
currentLiteral.resize(0);
currentLiteral += c; // append %
state = CONVERTER_STATE;
formattingInfo.reset();
}
}
else {
currentLiteral += c;
}
break;
case CONVERTER_STATE:
currentLiteral += c;
switch (c) {
case DCMTK_LOG4CPLUS_TEXT('-'):
formattingInfo.leftAlign = true;
break;
case DCMTK_LOG4CPLUS_TEXT('.'):
state = DOT_STATE;
break;
default:
if(c >= DCMTK_LOG4CPLUS_TEXT('0') && c <= DCMTK_LOG4CPLUS_TEXT('9')) {
formattingInfo.minLen = c - DCMTK_LOG4CPLUS_TEXT('0');
state = MIN_STATE;
}
else {
finalizeConverter(c);
}
} // switch
break;
case MIN_STATE:
currentLiteral += c;
if (c >= DCMTK_LOG4CPLUS_TEXT('0') && c <= DCMTK_LOG4CPLUS_TEXT('9')) {
formattingInfo.minLen = formattingInfo.minLen * 10 + (c - DCMTK_LOG4CPLUS_TEXT('0'));
}
else if(c == DCMTK_LOG4CPLUS_TEXT('.')) {
state = DOT_STATE;
}
else {
finalizeConverter(c);
}
break;
case DOT_STATE:
currentLiteral += c;
if(c >= DCMTK_LOG4CPLUS_TEXT('0') && c <= DCMTK_LOG4CPLUS_TEXT('9')) {
formattingInfo.maxLen = c - DCMTK_LOG4CPLUS_TEXT('0');
state = MAX_STATE;
}
else {
tostringstream buf;
buf << DCMTK_LOG4CPLUS_TEXT("Error occured in position ")
<< pos
<< DCMTK_LOG4CPLUS_TEXT(".\n Was expecting digit, instead got char \"")
<< c
<< DCMTK_LOG4CPLUS_TEXT("\".");
helpers::getLogLog().error(OFString(buf.str().c_str(), buf.str().length()));
state = LITERAL_STATE;
}
break;
case MAX_STATE:
currentLiteral += c;
if (c >= DCMTK_LOG4CPLUS_TEXT('0') && c <= DCMTK_LOG4CPLUS_TEXT('9'))
formattingInfo.maxLen = formattingInfo.maxLen * 10 + (c - DCMTK_LOG4CPLUS_TEXT('0'));
else {
finalizeConverter(c);
state = LITERAL_STATE;
}
break;
} // end switch
} // end while
if(! currentLiteral.empty ()) {
list.push_back(new LiteralPatternConverter(currentLiteral));
//getLogLog().debug("Parsed LITERAL converter: \""+currentLiteral+"\".");
}
return list;
} | false | false | false | false | false | 0 |
slotPsiDebug ( const QString & _msg )
{
QString msg = _msg;
msg = msg.replace( QRegExp( "<password>[^<]*</password>\n" ), "<password>[Filtered]</password>\n" );
msg = msg.replace( QRegExp( "<digest>[^<]*</digest>\n" ), "<digest>[Filtered]</digest>\n" );
emit debugMessage ( "Psi: " + msg );
} | false | false | false | false | false | 0 |
impexiterate(real_t z[], real_t y[], real_t **a, real_t h, real_t t,
real_t weights[], int ps[], int n, real_t eps,
void (*deriv)(real_t, real_t [], real_t [], int),
int (*available)(real_t, real_t [], real_t **, int))
{
/* this function is internally used by IMPEXLARGESTEP (IMPEX) */
int i,it,lit,fail;
real_t max,max1,conv,*dz,*f1,temp;
f1=allocate_real_vector(1,n);
dz=allocate_real_vector(1,n);
for (i=1; i<=n; i++) z[i]=(z[i]+y[i])/2.0;
it=lit=1;
conv=1.0;
fail=0;
while (1) {
deriv(t,z,f1,n);
for (i=1; i<=n; i++) f1[i]=dz[i]=z[i]-h*f1[i]/2.0-y[i];
sol(a,n,ps,dz);
elmvec(1,n,0,z,dz,-1.0);
max=0.0;
for (i=1; i<=n; i++) {
temp=weights[i]*dz[i];
max += temp*temp;
}
max=sqrt(max);
if (max*conv < eps/10.0) break;
it++;
if (it != 2) {
conv=max/max1;
if (conv > 0.2) {
if (lit == 0) {
fail=1;
break;
}
lit=0;
conv=1.0;
it=1;
if (impexrecomp(a,h,t,z,ps,n,available,deriv)) {
fail=1;
break;
}
}
}
max1=max;
}
if (!fail)
for (i=1; i<=n; i++) z[i]=2.0*z[i]-y[i];
free_real_vector(f1,1);
free_real_vector(dz,1);
return fail;
} | false | false | false | false | false | 0 |
stsd_read_common(bgav_input_context_t * input,
qt_sample_description_t * ret)
{
return (bgav_input_read_fourcc(input, &ret->fourcc) &&
(bgav_input_read_data(input, ret->reserved, 6) == 6) &&
bgav_input_read_16_be(input, &ret->data_reference_index) &&
bgav_input_read_16_be(input, &ret->version) &&
bgav_input_read_16_be(input, &ret->revision_level) &&
bgav_input_read_32_be(input, &ret->vendor));
} | false | false | false | false | false | 0 |
xmms_playlist_remove_unlocked (xmms_playlist_t *playlist, const gchar *plname,
xmmsv_coll_t *plcoll, guint pos, xmms_error_t *err)
{
gint currpos;
GTree *dict;
g_return_val_if_fail (playlist, FALSE);
currpos = xmms_playlist_coll_get_currpos (plcoll);
if (!xmmsv_coll_idlist_remove (plcoll, pos)) {
if (err) xmms_error_set (err, XMMS_ERROR_NOENT, "Entry was not in list!");
return FALSE;
}
dict = xmms_playlist_changed_msg_new (playlist, XMMS_PLAYLIST_CHANGED_REMOVE, 0, plname);
g_tree_insert (dict, (gpointer) "position", xmmsv_new_int (pos));
xmms_playlist_changed_msg_send (playlist, dict);
/* decrease currentpos if removed entry was before or if it's
* the current entry, but only if currentpos is a valid entry.
*/
if (currpos != -1 && pos <= currpos) {
currpos--;
xmms_collection_set_int_attr (plcoll, "position", currpos);
XMMS_PLAYLIST_CURRPOS_MSG (currpos, plname);
}
return TRUE;
} | false | false | false | false | false | 0 |
l3dss1_release(struct l3_process *pc, u_char pr, void *arg)
{
struct sk_buff *skb = arg;
u_char *p;
int ret, cause = 0;
StopAllL3Timer(pc);
if ((ret = l3dss1_get_cause(pc, skb)) > 0) {
if (pc->debug & L3_DEB_WARN)
l3_debug(pc->st, "REL get_cause ret(%d)", ret);
} else if (ret < 0)
pc->para.cause = NO_CAUSE;
if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) {
l3dss1_parse_facility(pc->st, pc, pc->callref, p);
}
if ((ret < 0) && (pc->state != 11))
cause = 96;
else if (ret > 0)
cause = 100;
ret = check_infoelements(pc, skb, ie_RELEASE);
if (ERR_IE_COMPREHENSION == ret)
cause = 96;
else if ((ERR_IE_UNRECOGNIZED == ret) && (!cause))
cause = 99;
if (cause)
l3dss1_message_cause(pc, MT_RELEASE_COMPLETE, cause);
else
l3dss1_message(pc, MT_RELEASE_COMPLETE);
pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc);
newl3state(pc, 0);
dss1_release_l3_process(pc);
} | false | false | false | false | false | 0 |
talloc_pool_cache(const void *context, size_t size, size_t objsize)
{
void *result;
struct talloc_chunk *tc;
unsigned int count;
unsigned int hdrsize;
if (unlikely(size <= 0) || unlikely(objsize <= 0) ) {
return NULL;
}
if ( unlikely(objsize > size) ) {
return NULL;
}
/*
* Wish we could restrict this to power of 2 but not required
* to impose restrictions.
* Align to objsize.
*/
size += objsize - 1;
size = size/objsize * objsize;
count = size/objsize; /* target */
/*
* Align size to objsize and also add the header per object.
*/
objsize += TC_HDR_SIZE;
objsize = (objsize + 15) & ~15;
size = objsize * count;
hdrsize = TALLOC_POOL_HDR_SPACE(count);
result = __talloc(context, size + hdrsize);
if (unlikely(result == NULL)) {
return NULL;
}
tc = talloc_chunk_from_ptr(result);
tc->flags |= TALLOC_FLAG_POOL | TALLOC_FLAG_POOLCACHE;
tc->pool = (char *)result + hdrsize;
*talloc_cache_objectcount(tc) = count;
*talloc_pool_objectcount(tc) = 1;
talloc_pool_map_reset(tc);
#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size);
#endif
return result;
} | false | false | false | false | true | 1 |
socksetup(char *listen_addr, int listen_port, int **socklist_p)
{
int socknum = 0, *socklist = NULL;
int maxfd = -1;
char pbuf[NI_MAXSERV];
struct addrinfo hints, *ai0, *ai;
int gai;
long flags;
sprintf(pbuf, "%d", listen_port);
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;
gai = getaddrinfo(listen_addr, pbuf, &hints, &ai0);
if (gai)
die("getaddrinfo() failed: %s\n", gai_strerror(gai));
for (ai = ai0; ai; ai = ai->ai_next) {
int sockfd;
sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sockfd < 0)
continue;
if (sockfd >= FD_SETSIZE) {
error("too large socket descriptor.");
close(sockfd);
continue;
}
#ifdef IPV6_V6ONLY
if (ai->ai_family == AF_INET6) {
int on = 1;
setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
&on, sizeof(on));
/* Note: error is not fatal */
}
#endif
if (set_reuse_addr(sockfd)) {
close(sockfd);
continue;
}
if (bind(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
close(sockfd);
continue; /* not fatal */
}
if (listen(sockfd, 5) < 0) {
close(sockfd);
continue; /* not fatal */
}
flags = fcntl(sockfd, F_GETFD, 0);
if (flags >= 0)
fcntl(sockfd, F_SETFD, flags | FD_CLOEXEC);
socklist = xrealloc(socklist, sizeof(int) * (socknum + 1));
socklist[socknum++] = sockfd;
if (maxfd < sockfd)
maxfd = sockfd;
}
freeaddrinfo(ai0);
*socklist_p = socklist;
return socknum;
} | true | true | false | false | false | 1 |
mpi_sche_write_main_function(fsbe_context *cx)
{
const char *or_name;
char name[256];
int i;
int total_pe;
Module_table *module_main = module_head;
total_pe = module_main->super_hmdf->pe_num;
or_name = !strcmp(module_main->name, "*MAIN*") ? "ORG_MAIN" : module_main->name;
for( i = 0; or_name[i] != '\0'; i++){
name[i] = tolower(or_name[i]);
}
name[i] = '\0';
mpi_sche_write_main_function0(cx, total_pe, "%s_pe%d_", name);
} | true | true | false | false | false | 1 |
monitor_on_interface_proxy_properties_changed (GDBusObjectManagerClient *manager,
GDBusObjectProxy *object_proxy,
GDBusProxy *interface_proxy,
GVariant *changed_properties,
const gchar* const *invalidated_properties,
gpointer user_data)
{
GVariantIter *iter;
const gchar *property_name;
GVariant *value;
guint max_property_name_len;
guint value_column;
if (!monitor_has_name_owner ())
goto out;
monitor_print_timestamp ();
g_print ("%s%s%s:%s %s%s%s:%s %s%sProperties Changed%s\n",
_color_get (_COLOR_BOLD_ON), _color_get (_COLOR_FG_BLUE),
g_dbus_object_get_object_path (G_DBUS_OBJECT (object_proxy)),
_color_get (_COLOR_RESET),
_color_get (_COLOR_BOLD_ON), _color_get (_COLOR_FG_MAGENTA),
g_dbus_proxy_get_interface_name (interface_proxy),
_color_get (_COLOR_RESET),
_color_get (_COLOR_BOLD_ON), _color_get (_COLOR_FG_YELLOW),
_color_get (_COLOR_RESET));
/* the daemon doesn't use the invalidated properties feature */
g_warn_if_fail (g_strv_length ((gchar **) invalidated_properties) == 0);
g_variant_get (changed_properties, "a{sv}", &iter);
max_property_name_len = 0;
while (g_variant_iter_next (iter, "{&sv}", &property_name, NULL))
{
guint property_name_len;
property_name_len = strlen (property_name);
if (max_property_name_len < property_name_len)
max_property_name_len = property_name_len;
}
value_column = ((max_property_name_len + 7) / 8) * 8 + 8;
if (value_column < 24)
value_column = 24;
else if (value_column > 64)
value_column = 64;
g_variant_get (changed_properties, "a{sv}", &iter);
while (g_variant_iter_next (iter, "{&sv}", &property_name, &value))
{
gchar *value_str;
guint rightmost;
gint value_indent;
rightmost = 2 + strlen (property_name) + 2;
value_indent = value_column - rightmost;
if (value_indent < 0)
value_indent = 0;
value_str = variant_to_string_with_indent (value, 2 + strlen (property_name) + 2 + value_indent);
g_print (" %s%s:%s %*s%s\n",
_color_get (_COLOR_FG_WHITE), property_name, _color_get (_COLOR_RESET),
value_indent, "",
value_str);
g_free (value_str);
g_variant_unref (value);
}
out:
;
} | false | false | false | false | false | 0 |
fm_dnd_dest_dispose(GObject *object)
{
FmDndDest *dd;
g_return_if_fail(object != NULL);
g_return_if_fail(FM_IS_DND_DEST(object));
dd = (FmDndDest*)object;
fm_dnd_dest_set_widget(dd, NULL);
clear_src_cache(dd);
G_OBJECT_CLASS(fm_dnd_dest_parent_class)->dispose(object);
} | false | false | false | false | false | 0 |
caml_float_of_substring(value vs, value idx, value l)
{
char parse_buffer[64];
char * buf, * src, * dst, * end;
mlsize_t len, lenvs;
double d;
intnat flen = Long_val(l);
intnat fidx = Long_val(idx);
lenvs = caml_string_length(vs);
len =
fidx >= 0 && fidx < lenvs && flen > 0 && flen <= lenvs - fidx
? flen : 0;
buf = len < sizeof(parse_buffer) ? parse_buffer : caml_stat_alloc(len + 1);
src = String_val(vs) + fidx;
dst = buf;
while (len--) {
char c = *src++;
if (c != '_') *dst++ = c;
}
*dst = 0;
if (dst == buf) goto error;
d = strtod((const char *) buf, &end);
if (end != dst) goto error;
if (buf != parse_buffer) caml_stat_free(buf);
return caml_copy_double(d);
error:
if (buf != parse_buffer) caml_stat_free(buf);
caml_failwith("float_of_string");
} | false | false | false | false | false | 0 |
fli_free_colormap( int vmode )
{
int i;
for( i = 0; i < 3; i++ )
if ( fli_gray_pattern[ i ] )
{
XFreePixmap( flx->display, fli_gray_pattern[ i ] );
fli_gray_pattern[ i ] = None;
}
if ( fli_visual( vmode ) != DefaultVisual( flx->display, fl_screen ) )
XFreeColormap( flx->display, fli_map( vmode ) );
fl_safe_free( defaultc );
} | false | false | false | false | false | 0 |
print_trace(int level, char *label, char *format, ...)
{
va_list args; /* arguments */
FILE *fp;
register int i; /* general purpose index */
trc_spec_t *trc;
int sav_errno = errno;
int sav_serrno = serrno;
va_start(args, format);
Cglobals_get(&trc_key,(void **)&trc,sizeof(trc_spec_t));
if (trace_level < level) return;
if (! trace_file)
fp = stdout;
else if ((fp = fopen(trace_file, "a")) == NULL)
goto restor;
for (i=0; i< level+indent_level ; i++) {
fprintf(fp," "); /* indentation */
}
fprintf(fp,"%s: ", label);
(void) vfprintf(fp, format, args);
fprintf(fp,"\n");
va_end(args);
fflush(fp);
if (trace_file)
fclose(fp);
restor:
errno = sav_errno;
serrno = sav_serrno;
} | true | true | false | false | true | 1 |
enableMembers(bool enable)
{
foreach(ParameterDefinition *parameterDefinition, members())
parameterDefinition->parentWidget()->setEnabled(enable);
} | false | false | false | false | false | 0 |
InjectCoverage(Function &F,
ArrayRef<BasicBlock *> AllBlocks) {
switch (Options.CoverageType) {
case SanitizerCoverageOptions::SCK_None:
return false;
case SanitizerCoverageOptions::SCK_Function:
InjectCoverageAtBlock(F, F.getEntryBlock(), false);
return true;
default: {
bool UseCalls = ClCoverageBlockThreshold < AllBlocks.size();
for (auto BB : AllBlocks)
InjectCoverageAtBlock(F, *BB, UseCalls);
return true;
}
}
} | false | false | false | false | false | 0 |
krb5_get_init_creds_opt_get_pa(krb5_context context,
krb5_get_init_creds_opt *opt,
int *num_preauth_data,
krb5_gic_opt_pa_data **preauth_data)
{
krb5_error_code retval;
krb5_gic_opt_ext *opte;
krb5_gic_opt_pa_data *p = NULL;
int i;
size_t allocsize;
retval = k5_gic_opt_to_opte(context, opt, &opte, 0,
"krb5_get_init_creds_opt_get_pa");
if (retval)
return retval;
if (num_preauth_data == NULL || preauth_data == NULL)
return EINVAL;
*num_preauth_data = 0;
*preauth_data = NULL;
if (opte->opt_private->num_preauth_data == 0)
return 0;
allocsize =
opte->opt_private->num_preauth_data * sizeof(krb5_gic_opt_pa_data);
p = malloc(allocsize);
if (p == NULL)
return ENOMEM;
/* Init these to make cleanup easier */
for (i = 0; i < opte->opt_private->num_preauth_data; i++) {
p[i].attr = NULL;
p[i].value = NULL;
}
for (i = 0; i < opte->opt_private->num_preauth_data; i++) {
p[i].attr = strdup(opte->opt_private->preauth_data[i].attr);
p[i].value = strdup(opte->opt_private->preauth_data[i].value);
if (p[i].attr == NULL || p[i].value == NULL)
goto cleanup;
}
*num_preauth_data = i;
*preauth_data = p;
return 0;
cleanup:
for (i = 0; i < opte->opt_private->num_preauth_data; i++) {
if (p[i].attr != NULL)
free(p[i].attr);
if (p[i].value != NULL)
free(p[i].value);
}
free(p);
return ENOMEM;
} | false | false | false | false | false | 0 |
__lpss_ssp_read_priv(struct driver_data *drv_data, unsigned offset)
{
WARN_ON(!drv_data->lpss_base);
return readl(drv_data->lpss_base + offset);
} | false | false | false | false | false | 0 |
blogc_template_parse_from_file(const char *f, blogc_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
size_t len;
char *s = blogc_file_get_contents(f, &len, err);
if (s == NULL)
return NULL;
b_slist_t *rv = blogc_template_parse(s, len, err);
free(s);
return rv;
} | false | false | false | false | false | 0 |
__ecereMethod_CodeEditor_ListEnumValues(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Class * _class)
{
struct CodeEditor * __ecerePointer_CodeEditor = (struct CodeEditor *)(this ? (((char *)this) + __ecereClass_CodeEditor->offset) : 0);
struct __ecereNameSpace__ecere__com__Instance * classes = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__com__List_TPL_ecere__com__Class_);
for(; _class && _class->type == 4; _class = _class->base)
((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * after, uint64 value))__extension__ ({
struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = classes;
__internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__List->_vTbl;
})[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Insert])(classes, (((void *)0)), (uint64)(_class));
{
struct __ecereNameSpace__ecere__com__Iterator _class =
{
(classes), 0
};
while(__ecereMethod___ecereNameSpace__ecere__com__Iterator_Next(&_class))
{
struct __ecereNameSpace__ecere__com__EnumClassData * enumeration = (struct __ecereNameSpace__ecere__com__EnumClassData *)((struct __ecereNameSpace__ecere__com__Class *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&_class))->data;
struct __ecereNameSpace__ecere__sys__NamedLink * item;
for(item = enumeration->values.first; item; item = item->next)
{
struct __ecereNameSpace__ecere__com__Instance * row = __ecereMethod___ecereNameSpace__ecere__gui__controls__ListBox_AddString(__ecerePointer_CodeEditor->membersList, item->name);
__ecereProp___ecereNameSpace__ecere__gui__controls__DataRow_Set_icon(row, __ecerePointer_CodeEditor->icons[7]);
}
}
}
(__ecereNameSpace__ecere__com__eInstance_DecRef(classes), classes = 0);
} | false | false | false | true | false | 1 |
startTable(int border, TableWidth interpretWAs, int width, TableWidth interpretHAs, int height, TableFrame frame, ASCString cssClass, const IntVec* cols) {
*buildingInfStream << "<table ";
if(cssClass!="") {
*buildingInfStream << "class=\"" + cssClass + "\" ";
}
if(interpretWAs != NONE) {
*buildingInfStream << "width=\"" << width;
switch(interpretWAs) {
case ABSOLUTE: *buildingInfStream << "px\""; break;
case RELATIVE: *buildingInfStream << "%%\"";
break;
default: break;
}
}
*buildingInfStream << "border=\"" << border << "\" ";
if(frame != VOID) {
*buildingInfStream << "frame=\"";
if(frame == BOX) {
*buildingInfStream << "box";
} else if(frame == RHS) {
*buildingInfStream << "RHS";
}
*buildingInfStream << "\"";
}
*buildingInfStream << ">" << endl;
if(cols) {
*buildingInfStream << "<colgroup>" << endl;
for(int i=0; i< cols->size(); i++) {
*buildingInfStream << "<col width=\"" << (*cols)[i] <<"%%\">" << endl;
}
*buildingInfStream << "</colgroup>" << endl;
}
} | false | false | false | false | false | 0 |
CellRendererList()
: Glib::ObjectBase(0) //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
//TODO: This should not be necessary - our gtkmm callbacks are somehow preventing the popup from appearing.
{
m_refModel = Gtk::ListStore::create(m_model_columns);
set_property("model", m_refModel);
set_property("text-column", 0); //This must be a text column, in m_refModel.
set_property("editable", true); //It would be useless if we couldn't edit it.
} | false | false | false | false | false | 0 |
e_cal_component_get_categories_list (ECalComponent *comp,
GSList **categ_list)
{
ECalComponentPrivate *priv;
icalproperty *prop;
const gchar *categories;
const gchar *p;
const gchar *cat_start;
gchar *str;
g_return_if_fail (comp != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
g_return_if_fail (categ_list != NULL);
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
if (!priv->categories_str) {
*categ_list = NULL;
return;
}
*categ_list = NULL;
for (prop = icalcomponent_get_first_property (priv->icalcomp, ICAL_CATEGORIES_PROPERTY);
prop;
prop = icalcomponent_get_next_property (priv->icalcomp, ICAL_CATEGORIES_PROPERTY)) {
categories = icalproperty_get_categories (prop);
g_return_if_fail (categories != NULL);
cat_start = categories;
for (p = categories; *p; p++) {
if (*p == ',') {
str = g_strndup (cat_start, p - cat_start);
*categ_list = g_slist_prepend (*categ_list, str);
cat_start = p + 1;
}
}
str = g_strndup (cat_start, p - cat_start);
*categ_list = g_slist_prepend (*categ_list, str);
}
*categ_list = g_slist_reverse (*categ_list);
} | false | false | false | false | false | 0 |
get_cairo_surface()
{
if (!gtk_widget_get_realized(drawingArea)) {
return 0;
}
return gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(drawingArea)));
} | false | false | false | false | false | 0 |
set_trace(int trace_flag)
{
if (trace_flag < 0) {
return;
} else if (trace_flag > 0) {
trace = true;
} else {
trace = false;
}
if (!trace && trace_fd) {
FILE *ltrace_fd = trace_fd;
trace_fd = NULL;
bmicrosleep(0, 100000); /* yield to prevent seg faults */
fclose(ltrace_fd);
}
} | false | false | false | false | false | 0 |
options_init_names(const struct copt_val_name *(*acc)(int),
struct strvec **support, struct strvec **pretty)
{
int val;
const struct copt_val_name *name;
fc_assert_ret(NULL != acc);
*support = strvec_new();
*pretty = strvec_new();
for (val=0; (name = acc(val)); val++) {
strvec_append(*support, name->support);
strvec_append(*pretty, name->pretty);
}
} | false | false | false | false | false | 0 |
gps_bb_apply_until_no_change(gm_gps_basic_block* entry, gps_apply_bb* apply) {
std::set<gm_gps_basic_block*> set;
bool b = false;
do {
apply->set_changed(false);
set.clear();
bb_apply_recurse(set, entry, apply);
if (apply->has_changed()) b = true;
} while (apply->has_changed());
return b; // return true if changed at least once
} | false | false | false | false | false | 0 |
mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
const u8 *key, const u8 hfunc)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = priv->mdev;
int port_up = 0;
int err = 0;
int i;
int rss_rings = 0;
/* Calculate RSS table size and make sure flows are spread evenly
* between rings
*/
for (i = 0; i < priv->rx_ring_num; i++) {
if (!ring_index)
continue;
if (i > 0 && !ring_index[i] && !rss_rings)
rss_rings = i;
if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num)))
return -EINVAL;
}
if (!rss_rings)
rss_rings = priv->rx_ring_num;
/* RSS table size must be an order of 2 */
if (!is_power_of_2(rss_rings))
return -EINVAL;
if (hfunc != ETH_RSS_HASH_NO_CHANGE) {
err = mlx4_en_check_rxfh_func(dev, hfunc);
if (err)
return err;
}
mutex_lock(&mdev->state_lock);
if (priv->port_up) {
port_up = 1;
mlx4_en_stop_port(dev, 1);
}
if (ring_index)
priv->prof->rss_rings = rss_rings;
if (key)
memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE);
if (hfunc != ETH_RSS_HASH_NO_CHANGE)
priv->rss_hash_fn = hfunc;
if (port_up) {
err = mlx4_en_start_port(dev);
if (err)
en_err(priv, "Failed starting port\n");
}
mutex_unlock(&mdev->state_lock);
return err;
} | false | false | false | false | false | 0 |
trace_entrylk (call_frame_t *frame, xlator_t *this,
const char *volume, loc_t *loc, const char *basename,
entrylk_cmd cmd, entrylk_type type, dict_t *xdata)
{
if (trace_fop_names[GF_FOP_ENTRYLK].enabled) {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s volume=%s, (path=%s basename=%s, "
"cmd=%s, type=%s)",
frame->root->unique, uuid_utoa (loc->inode->gfid),
volume, loc->path, basename,
((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
frame->local = loc->inode->gfid;
}
STACK_WIND (frame, trace_entrylk_cbk,
FIRST_CHILD (this),
FIRST_CHILD (this)->fops->entrylk,
volume, loc, basename, cmd, type, xdata);
return 0;
} | false | false | false | false | false | 0 |
iuu_port_probe(struct usb_serial_port *port)
{
struct iuu_private *priv;
int ret;
priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->buf = kzalloc(256, GFP_KERNEL);
if (!priv->buf) {
kfree(priv);
return -ENOMEM;
}
priv->writebuf = kzalloc(256, GFP_KERNEL);
if (!priv->writebuf) {
kfree(priv->buf);
kfree(priv);
return -ENOMEM;
}
priv->vcc = vcc_default;
spin_lock_init(&priv->lock);
usb_set_serial_port_data(port, priv);
ret = iuu_create_sysfs_attrs(port);
if (ret) {
kfree(priv->writebuf);
kfree(priv->buf);
kfree(priv);
return ret;
}
return 0;
} | false | false | false | false | false | 0 |
usage(int argc, char **argv)
{
const struct cmd *section, *cmd;
bool full = argc >= 0;
const char *sect_filt = NULL;
const char *cmd_filt = NULL;
if (argc > 0)
sect_filt = argv[0];
if (argc > 1)
cmd_filt = argv[1];
printf("Usage:\t%s [options] command\n", argv0);
usage_options();
printf("\t--version\tshow version (%s)\n", iw_version);
printf("Commands:\n");
for_each_cmd(section) {
if (section->parent)
continue;
if (sect_filt && strcmp(section->name, sect_filt))
continue;
if (section->handler && !section->hidden)
__usage_cmd(section, "\t", full);
for_each_cmd(cmd) {
if (section != cmd->parent)
continue;
if (!cmd->handler || cmd->hidden)
continue;
if (cmd_filt && strcmp(cmd->name, cmd_filt))
continue;
__usage_cmd(cmd, "\t", full);
}
}
printf("\nYou can omit the 'phy' or 'dev' if "
"the identification is unique,\n"
"e.g. \"iw wlan0 info\" or \"iw phy0 info\". "
"(Don't when scripting.)\n\n"
"Do NOT screenscrape this tool, we don't "
"consider its output stable.\n\n");
} | false | false | false | false | false | 0 |
soldier_attack2_refire1 (edict_t *self)
{
if (self->s.skinnum > 1)
return;
if (self->enemy->health <= 0)
return;
if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
self->monsterinfo.nextframe = FRAME_attak204;
else
self->monsterinfo.nextframe = FRAME_attak216;
} | false | false | false | false | true | 1 |
e_repos_delete_shift (gint pos,
gpointer data)
{
EReposDeleteShift *info = (EReposDeleteShift *) data;
g_return_val_if_fail (data, -1);
if (pos > info->pos + info->len)
pos -= info->len;
else if (pos > info->pos)
pos = info->pos;
return e_text_model_validate_position (info->model, pos);
} | false | false | false | false | false | 0 |
gtkaspell_change_dict(GtkAspell *gtkaspell, const gchar *dictionary,
gboolean always_set_alt_dict)
{
Dictionary *dict;
GtkAspeller *gtkaspeller;
cm_return_val_if_fail(gtkaspell, FALSE);
cm_return_val_if_fail(dictionary, FALSE);
dict = g_new0(Dictionary, 1);
if (strrchr(dictionary, '/')) {
dict->fullname = g_strdup(strrchr(dictionary, '/')+1);
dict->dictname = g_strdup(strrchr(dictionary, '/')+1);
} else {
dict->fullname = g_strdup(dictionary);
dict->dictname = g_strdup(dictionary);
}
if (dict->fullname && strchr(dict->fullname, '-')) {
*(strchr(dict->fullname, '-')) = '\0';
*(strchr(dict->dictname, '-')) = '\0';
}
if (!dict->fullname || !(*dict->fullname)) {
dictionary_delete(dict);
return FALSE;
}
gtkaspeller = gtkaspeller_new(dict);
if (!gtkaspeller) {
alertpanel_warning(_("The spell checker could not change dictionary.\n%s"),
gtkaspellcheckers->error_message);
} else {
if (gtkaspell->use_alternate) {
if (gtkaspell->alternate_speller) {
if (always_set_alt_dict) {
gtkaspeller_delete(gtkaspell->alternate_speller);
gtkaspell->alternate_speller = gtkaspell->gtkaspeller;
} else
gtkaspeller_delete(gtkaspell->gtkaspeller);
} else
/* should never be reached as the dicts are always set
to a default value */
gtkaspell->alternate_speller = gtkaspell->gtkaspeller;
} else
gtkaspeller_delete(gtkaspell->gtkaspeller);
gtkaspell->gtkaspeller = gtkaspeller;
}
dictionary_delete(dict);
return TRUE;
} | false | false | false | false | false | 0 |
Java_java_nio_Bits_copyToByteArray(JNIEnv *env, jobject this, jlong srcAddr,
jobject dst, jlong dstPos, jlong length)
{
jbyte *bytes;
size_t size;
while (length > 0) {
size = (length > MBYTE ? MBYTE : length);
GETCRITICAL(bytes, env, dst);
memcpy(bytes + dstPos, (void *)srcAddr, size);
RELEASECRITICAL(bytes, env, dst, 0);
length -= size;
srcAddr += size;
dstPos += size;
}
} | false | false | false | false | false | 0 |
make(ELObj *obj, const Location &, Interpreter &interp) const
{
return new IgnoredC(identifier(), index(), obj, interp);
} | false | false | false | false | false | 0 |
button_release_event_cb (ClutterActor *stage,
ClutterButtonEvent *event,
MxKineticScrollView *scroll)
{
MxKineticScrollViewPrivate *priv = scroll->priv;
if ((event->type != CLUTTER_BUTTON_RELEASE) ||
(event->button != priv->button))
return FALSE;
return button_release (scroll, event->x, event->y);
} | false | false | false | false | false | 0 |
gretl_coeff_vector_from_model (const MODEL *pmod, const char *select, int *err)
{
gretl_vector *b;
int i, j, nc;
int k = pmod->ncoeff;
if (select == NULL) {
nc = k;
} else {
nc = count_selection(select, k);
}
if (nc == 0) {
*err = E_DATA;
return NULL;
}
b = gretl_column_vector_alloc(nc);
if (b == NULL) {
*err = E_ALLOC;
return NULL;
}
j = 0;
for (i=0; i<k; i++) {
if (select != NULL && !select[i]) {
continue;
}
b->val[j++] = pmod->coeff[i];
}
return b;
} | false | false | false | false | false | 0 |
sv_byname(struct irs_sv *this, const char *name, const char *proto) {
#ifdef IRS_LCL_SV_DB
struct pvt *pvt = (struct pvt *)this->private;
#endif
struct servent *p;
char **cp;
sv_rewind(this);
#ifdef IRS_LCL_SV_DB
if (pvt->dbh != NULL) {
DBT key, data;
/* Note that (sizeof "/") == 2. */
if ((strlen(name) + sizeof "/" + proto ? strlen(proto) : 0)
> sizeof pvt->sv.line)
goto try_local;
key.data = pvt->sv.line;
key.size = SPRINTF((pvt->sv.line, "%s/%s", name,
proto ? proto : "")) + 1;
if (proto != NULL) {
if ((*pvt->dbh->get)(pvt->dbh, &key, &data, 0) != 0)
return (NULL);
} else if ((*pvt->dbh->seq)(pvt->dbh, &key, &data, R_CURSOR)
!= 0)
return (NULL);
return (sv_db_rec(&pvt->sv, &key, &data));
}
try_local:
#endif
while ((p = sv_next(this))) {
if (strcmp(name, p->s_name) == 0)
goto gotname;
for (cp = p->s_aliases; *cp; cp++)
if (strcmp(name, *cp) == 0)
goto gotname;
continue;
gotname:
if (proto == NULL || strcmp(p->s_proto, proto) == 0)
break;
}
return (p);
} | false | false | false | false | false | 0 |
init_table(struct nvkm_bios *bios, u16 *len)
{
struct bit_entry bit_I;
if (!bit_entry(bios, 'I', &bit_I)) {
*len = bit_I.length;
return bit_I.offset;
}
if (bmp_version(bios) >= 0x0510) {
*len = 14;
return bios->bmp_offset + 75;
}
return 0x0000;
} | false | false | false | false | false | 0 |
char2score(const char *score)
{
int score_f = 0;
if (score == NULL) {
} else if (safe_str_eq(score, MINUS_INFINITY_S)) {
score_f = -node_score_infinity;
} else if (safe_str_eq(score, INFINITY_S)) {
score_f = node_score_infinity;
} else if (safe_str_eq(score, "+" INFINITY_S)) {
score_f = node_score_infinity;
} else if (safe_str_eq(score, "red")) {
score_f = node_score_red;
} else if (safe_str_eq(score, "yellow")) {
score_f = node_score_yellow;
} else if (safe_str_eq(score, "green")) {
score_f = node_score_green;
} else {
score_f = crm_parse_int(score, NULL);
if (score_f > 0 && score_f > node_score_infinity) {
score_f = node_score_infinity;
} else if (score_f < 0 && score_f < -node_score_infinity) {
score_f = -node_score_infinity;
}
}
return score_f;
} | false | false | false | false | false | 0 |
uerror(char *s) {
if (s != NULL)
eprint("%s: %s\n", s, esstrerror(errno));
else
eprint("%s\n", esstrerror(errno));
} | false | false | false | false | false | 0 |
convert_block_to_byte( void *in, unsigned char *out, int npts,
int in_type, double *dispmin, double *dispmax )
{
if( (lastLookupMin==0.0 && lastLookupMax==0.0)
|| (*dispmin==0.0 && *dispmax==0.0) ) {
return convert_block( in, npts, in_type, dispmin, dispmax, out, NULL );
} else {
return convert_block( in, npts, in_type,
&lastLookupMin, &lastLookupMax, out, NULL );
}
} | false | false | false | false | false | 0 |
log(int level, const char* fmt, ...)
{
(void) level;
if (level > logLevel ) return -1;
int ret;
va_list arglist;
va_start(arglist, fmt);
ret = vfprintf(stream, fmt, arglist);
va_end(arglist);
return ret;
} | false | false | false | false | false | 0 |
vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
{
enum machine_mode mode = TYPE_MODE (vectype);
/* vect_permute_store_chain requires the group size to be a power of two. */
if (exact_log2 (count) == -1)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"the size of the group of accesses"
" is not a power of 2");
return false;
}
/* Check that the permutation is supported. */
if (VECTOR_MODE_P (mode))
{
unsigned int i, nelt = GET_MODE_NUNITS (mode);
unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
for (i = 0; i < nelt / 2; i++)
{
sel[i * 2] = i;
sel[i * 2 + 1] = i + nelt;
}
if (can_vec_perm_p (mode, false, sel))
{
for (i = 0; i < nelt; i++)
sel[i] += nelt / 2;
if (can_vec_perm_p (mode, false, sel))
return true;
}
}
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION,
"interleave op not supported by target.");
return false;
} | false | false | false | false | true | 1 |
__log_newfh(dblp, create)
DB_LOG *dblp;
int create;
{
ENV *env;
LOG *lp;
u_int32_t flags;
int ret;
logfile_validity status;
env = dblp->env;
lp = dblp->reginfo.primary;
/* Close any previous file descriptor. */
if (dblp->lfhp != NULL) {
(void)__os_closehandle(env, dblp->lfhp);
dblp->lfhp = NULL;
}
flags = DB_OSO_SEQ |
(create ? DB_OSO_CREATE : 0) |
(F_ISSET(dblp, DBLOG_DIRECT) ? DB_OSO_DIRECT : 0) |
(F_ISSET(dblp, DBLOG_DSYNC) ? DB_OSO_DSYNC : 0);
/* Get the path of the new file and open it. */
dblp->lfname = lp->lsn.file;
if ((ret = __log_valid(dblp, dblp->lfname, 0, &dblp->lfhp,
flags, &status, NULL)) != 0)
__db_err(env, ret,
"DB_ENV->log_newfh: %lu", (u_long)lp->lsn.file);
else if (status != DB_LV_NORMAL && status != DB_LV_INCOMPLETE &&
status != DB_LV_OLD_READABLE)
ret = DB_NOTFOUND;
return (ret);
} | false | false | false | false | false | 0 |
nfs4_check_open_reclaim(clientid_t *clid,
struct nfsd4_compound_state *cstate,
struct nfsd_net *nn)
{
__be32 status;
/* find clientid in conf_id_hashtbl */
status = lookup_clientid(clid, cstate, nn);
if (status)
return nfserr_reclaim_bad;
if (test_bit(NFSD4_CLIENT_RECLAIM_COMPLETE, &cstate->clp->cl_flags))
return nfserr_no_grace;
if (nfsd4_client_record_check(cstate->clp))
return nfserr_reclaim_bad;
return nfs_ok;
} | false | false | false | false | false | 0 |
getMACcount(pMAC_t pMAC)
{
pMAC_t cur = pMAC;
int count=0;
if(pMAC == NULL)
return -1;
while(cur->next != NULL)
{
cur = cur->next;
count++;
}
return count;
} | false | false | false | false | false | 0 |
readHeader()
{
// We now rely on zlib to read the full header (see the MAX_WBITS + 32 in init).
// We just use this method to check if the data is actually compressed.
#ifdef DEBUG_GZIP
qDebug() << "avail=" << d->zStream.avail_in;
#endif
// Assume not compressed until we see a gzip header
d->compressed = false;
Bytef *p = d->zStream.next_in;
int i = d->zStream.avail_in;
if ((i -= 10) < 0) return false; // Need at least 10 bytes
#ifdef DEBUG_GZIP
qDebug() << "first byte is " << QString::number(*p,16);
#endif
if (*p++ != 0x1f) return false; // GZip magic
#ifdef DEBUG_GZIP
qDebug() << "second byte is " << QString::number(*p,16);
#endif
if (*p++ != 0x8b) return false;
#if 0
int method = *p++;
int flags = *p++;
if ((method != Z_DEFLATED) || (flags & RESERVED) != 0) return false;
p += 6;
if ((flags & EXTRA_FIELD) != 0) // skip extra field
{
if ((i -= 2) < 0) return false; // Need at least 2 bytes
int len = *p++;
len += (*p++) << 8;
if ((i -= len) < 0) return false; // Need at least len bytes
p += len;
}
if ((flags & ORIG_NAME) != 0) // skip original file name
{
#ifdef DEBUG_GZIP
qDebug() << "ORIG_NAME=" << (char*)p;
#endif
while( (i > 0) && (*p))
{
i--; p++;
}
if (--i <= 0) return false;
p++;
}
if ((flags & COMMENT) != 0) // skip comment
{
while( (i > 0) && (*p))
{
i--; p++;
}
if (--i <= 0) return false;
p++;
}
if ((flags & HEAD_CRC) != 0) // skip the header crc
{
if ((i-=2) < 0) return false;
p += 2;
}
d->zStream.avail_in = i;
d->zStream.next_in = p;
#endif
d->compressed = true;
#ifdef DEBUG_GZIP
qDebug() << "header OK";
#endif
return true;
} | false | false | false | false | false | 0 |
elf_xtensa_do_asm_simplify (bfd_byte *contents,
bfd_vma address,
bfd_vma content_length,
char **error_message)
{
static xtensa_insnbuf insnbuf = NULL;
static xtensa_insnbuf slotbuf = NULL;
xtensa_format core_format = XTENSA_UNDEFINED;
xtensa_opcode opcode;
xtensa_opcode direct_call_opcode;
xtensa_isa isa = xtensa_default_isa;
bfd_byte *chbuf = contents + address;
int opn;
if (insnbuf == NULL)
{
insnbuf = xtensa_insnbuf_alloc (isa);
slotbuf = xtensa_insnbuf_alloc (isa);
}
if (content_length < address)
{
*error_message = _("Attempt to convert L32R/CALLX to CALL failed");
return bfd_reloc_other;
}
opcode = get_expanded_call_opcode (chbuf, content_length - address, 0);
direct_call_opcode = swap_callx_for_call_opcode (opcode);
if (direct_call_opcode == XTENSA_UNDEFINED)
{
*error_message = _("Attempt to convert L32R/CALLX to CALL failed");
return bfd_reloc_other;
}
/* Assemble a NOP ("or a1, a1, a1") into the 0 byte offset. */
core_format = xtensa_format_lookup (isa, "x24");
opcode = xtensa_opcode_lookup (isa, "or");
xtensa_opcode_encode (isa, core_format, 0, slotbuf, opcode);
for (opn = 0; opn < 3; opn++)
{
uint32 regno = 1;
xtensa_operand_encode (isa, opcode, opn, ®no);
xtensa_operand_set_field (isa, opcode, opn, core_format, 0,
slotbuf, regno);
}
xtensa_format_encode (isa, core_format, insnbuf);
xtensa_format_set_slot (isa, core_format, 0, insnbuf, slotbuf);
xtensa_insnbuf_to_chars (isa, insnbuf, chbuf, content_length - address);
/* Assemble a CALL ("callN 0") into the 3 byte offset. */
xtensa_opcode_encode (isa, core_format, 0, slotbuf, direct_call_opcode);
xtensa_operand_set_field (isa, opcode, 0, core_format, 0, slotbuf, 0);
xtensa_format_encode (isa, core_format, insnbuf);
xtensa_format_set_slot (isa, core_format, 0, insnbuf, slotbuf);
xtensa_insnbuf_to_chars (isa, insnbuf, chbuf + 3,
content_length - address - 3);
return bfd_reloc_ok;
} | false | false | false | false | false | 0 |
parse_expire_cfg_value(const char *var, const char *value, unsigned long *expire)
{
if (!value)
return config_error_nonbool(var);
if (!strcmp(value, "never") || !strcmp(value, "false")) {
*expire = 0;
return 0;
}
*expire = approxidate(value);
return 0;
} | false | false | false | false | false | 0 |
commit()
{
if(m_dirty) //current player was changed
{
m_pendingUpdates.insert(m_currentPlayerName, m_currentPlayer);
}
m_mapfile.seek(m_nplayers_offset);
m_mapds << m_nplayers;
// write non-committed changes
m_dataFileCurrentPosition = m_datafile.size();
m_datafile.seek(m_dataFileCurrentPosition);
QMap<QString, PlayerData>::Iterator it;
for(it = m_pendingUpdates.begin(); it != m_pendingUpdates.end(); ++it)
{
m_mapping.insert(it.key(), m_datafile.pos());
m_datads << it.value().dateOfBirth().asString();
m_datads << it.value().dateOfDeath().asString();
m_datads << it.value().country();
m_datads << it.value().title();
m_datads << it.value().eloListData();
m_datads << (qint32)(it.value().firstEloListIndex());
m_datads << (qint32)(it.value().lastEloListIndex());
m_datads << (qint32)(it.value().estimatedElo());
m_datads << (qint32)(it.value().peakElo());
m_datads << it.value().photo();
m_datads << it.value().biography();
}
m_mapds << m_mapping;
m_mapfile.flush();
m_datafile.flush();
m_pendingUpdates.clear();
m_dirty = false;
m_nplayers += m_npending_adds;
m_npending_adds = 0;
} | false | false | false | false | false | 0 |
set_user_limits(stepd_step_rec_t *job)
{
#ifdef RLIMIT_AS
#define SLURM_RLIMIT_VSIZE RLIMIT_AS
#define SLURM_RLIMIT_VNAME "RLIMIT_AS"
#elif defined(RLIMIT_DATA)
/* RLIMIT_DATA is useless on many systems which provide anonymous
* mmap()'s in addition to brk(), use it here only as a fallback for
* oddball systems lacking RLIMIT_AS. */
#define SLURM_RLIMIT_VSIZE RLIMIT_DATA
#define SLURM_RLIMIT_VNAME "RLIMIT_DATA"
#endif
slurm_rlimits_info_t *rli;
struct rlimit r;
rlim_t task_mem_bytes;
#ifdef SLURM_RLIMIT_VSIZE
uint16_t vsize_factor;
#endif
if (getrlimit(RLIMIT_CPU, &r) == 0) {
if (r.rlim_max != RLIM_INFINITY) {
error("SLURM process CPU time limit is %d seconds",
(int) r.rlim_max);
}
}
for (rli = get_slurm_rlimits_info(); rli->name; rli++)
_set_limit( job->env, rli );
/* Set soft and hard rss and vsize limit for this process,
* handle job limit (for all spawned processes) in slurmd */
task_mem_bytes = job->step_mem; /* MB */
task_mem_bytes *= (1024 * 1024);
/* Many systems, Linux included, ignore RSS limits, but set it
* here anyway for consistency and to provide a way for
* applications to interrogate what the RSS limit is (with the
* caveat that the real RSS limit is over all job tasks on the
* node and not per process, but hopefully this is better than
* nothing). */
#ifdef RLIMIT_RSS
if ((task_mem_bytes) && (getrlimit(RLIMIT_RSS, &r) == 0) &&
(r.rlim_max > task_mem_bytes)) {
r.rlim_max = r.rlim_cur = task_mem_bytes;
if (setrlimit(RLIMIT_RSS, &r)) {
/* Indicates that limit has already been exceeded */
fatal("setrlimit(RLIMIT_RSS, %u MB): %m",
job->step_mem);
} else
debug2("Set task rss(%u MB)", job->step_mem);
#if 0
getrlimit(RLIMIT_RSS, &r);
info("task RSS limits: %u %u", r.rlim_cur, r.rlim_max);
#endif
}
#endif
#ifdef SLURM_RLIMIT_VSIZE
if ((task_mem_bytes) &&
((vsize_factor = slurm_get_vsize_factor()) != 0) &&
(getrlimit(SLURM_RLIMIT_VSIZE, &r) == 0) &&
(r.rlim_max > task_mem_bytes)) {
r.rlim_max = task_mem_bytes * (vsize_factor / 100.0);
r.rlim_cur = r.rlim_max;
if (setrlimit(SLURM_RLIMIT_VSIZE, &r)) {
/* Indicates that limit has already been exceeded */
fatal("setrlimit(%s, %u MB): %m",
SLURM_RLIMIT_VNAME, job->step_mem);
} else
debug2("Set task vsize(%u MB)", job->step_mem);
#if 0
getrlimit(SLURM_RLIMIT_VSIZE, &r);
info("task VSIZE limits: %u %u", r.rlim_cur, r.rlim_max);
#endif
}
#endif
return SLURM_SUCCESS;
} | false | false | false | false | false | 0 |
tsAddPlotLabels(splotd *sp, GdkDrawable *drawable, ggobid *gg)
{
displayd *display = sp->displayptr;
GList *l = display->splots;
PangoLayout *layout = gtk_widget_create_pango_layout(sp->da, NULL);
PangoRectangle rect;
if (l->data == sp) {
layout_text(layout, ggobi_data_get_transformed_col_name(display->d, sp->xyvars.x), &rect);
gdk_draw_layout(drawable, gg->plot_GC,
sp->max.x - rect.width - 5,
sp->max.y - rect.height - 5,
layout
);
}
layout_text(layout, ggobi_data_get_transformed_col_name(display->d, sp->xyvars.y), &rect);
gdk_draw_layout(drawable, gg->plot_GC, 5, 5, layout);
g_object_unref(G_OBJECT(layout));
} | false | false | false | false | false | 0 |
LZ4_compress_continue (void* LZ4_Data, const char* source, char* dest, int inputSize)
{
return LZ4_compress_generic(LZ4_Data, source, dest, inputSize, 0, notLimited, byU32, withPrefix);
} | false | false | false | false | false | 0 |
efi_snp_poll ( struct efi_snp_device *snpdev ) {
struct io_buffer *iobuf;
unsigned int before = 0;
unsigned int after = 0;
unsigned int arrived;
/* We have to report packet arrivals, and this is the easiest
* way to fake it.
*/
list_for_each_entry ( iobuf, &snpdev->netdev->rx_queue, list )
before++;
netdev_poll ( snpdev->netdev );
list_for_each_entry ( iobuf, &snpdev->netdev->rx_queue, list )
after++;
arrived = ( after - before );
snpdev->rx_count_interrupts += arrived;
snpdev->rx_count_events += arrived;
} | false | false | false | false | false | 0 |
ensure_all(Code c) const
{
if (c >= 0 && (c >> 5) >= _all_sentinel.size())
_all_sentinel.resize((c >> 5) + 1, 0xFFFFFFFFU);
} | false | false | false | false | false | 0 |
iptux_get_hex64_number(const char *msg, char ch, uint8_t times)
{
const char *ptr;
int64_t number;
if (!(ptr = iptux_skip_section(msg, ch, times)))
return 0;
if (sscanf(ptr, "%" SCNx64, &number) == 1)
return number;
return 0;
} | false | false | false | false | false | 0 |
setOldCryptedPassword(const QString &crypted)
{
m_OldCryptedPass = crypted;
// Set title
m_ui->label->setText(tkTr(Trans::Constants::CHANGE_PASSWORD));
setWindowTitle(tkTr(Trans::Constants::CHANGE_PASSWORD));
// Manage ui
m_ui->oldLabel->show();
m_ui->labelNewPassword->show();
m_ui->labelControlPassword->show();
m_ui->oldPass->show();
m_ui->newPass->show();
m_ui->newControl->show();
} | false | false | false | false | false | 0 |
asn1PE_H245RequestChannelClose_reason (OOCTXT* pctxt, H245RequestChannelClose_reason* pvalue)
{
int stat = ASN_OK;
ASN1BOOL extbit;
/* extension bit */
extbit = (ASN1BOOL)(pvalue->t > 4);
encodeBit (pctxt, extbit);
if (!extbit) {
/* Encode choice index value */
stat = encodeConsUnsigned (pctxt, pvalue->t - 1, 0, 3);
if (stat != ASN_OK) return stat;
/* Encode root element data value */
switch (pvalue->t)
{
/* unknown */
case 1:
/* NULL */
break;
/* normal */
case 2:
/* NULL */
break;
/* reopen */
case 3:
/* NULL */
break;
/* reservationFailure */
case 4:
/* NULL */
break;
default:
return ASN_E_INVOPT;
}
}
else {
/* Encode extension choice index value */
stat = encodeSmallNonNegWholeNumber (pctxt, pvalue->t - 5);
if (stat != ASN_OK) return stat;
/* Encode extension element data value */
}
return (stat);
} | false | false | false | false | false | 0 |
doHiddenPlacement()
{
MSNodeItem *hp=childListHead();
MSNodeItem *np;
np = hp;
MSCollapsibleEntry* entry;
int xDisplacement =0;
int yDisplacement_ =height() - _handleSize;
while ((np=np->next())!=hp)
{
entry = (MSCollapsibleEntry*)np->data();
if(entry->state()==MSCollapsibleEntry::CLOSED)
xDisplacement += entry->height();
}
float xDifference = xDisplacement -width();
// if the buttons representing the hidden widgets are widder than this widgets current width
// shrink the buttons proportionatly to fit
float xDiff = (xDifference >=0) ? ((float)xDifference) / xDisplacement : 0;
xDisplacement = 0;
while ((np=np->next())!=hp)
{
entry = (MSCollapsibleEntry*)np->data();
if(entry->state()==MSCollapsibleEntry::CLOSED){
entry->moveTo(xDisplacement,yDisplacement_);
entry->resize((int)(entry->height()*(1-xDiff)),entry->height());
xDisplacement += (int)(entry->height()*(1-xDiff));
}
}
} | false | false | false | false | false | 0 |
file_browser_node_free_children (GeditFileBrowserStore *model,
FileBrowserNode *node)
{
GSList *item;
if (node == NULL || !NODE_IS_DIR (node))
return;
for (item = FILE_BROWSER_NODE_DIR (node)->children; item; item = item->next)
{
file_browser_node_free (model, (FileBrowserNode *) (item->data));
}
g_slist_free (FILE_BROWSER_NODE_DIR (node)->children);
FILE_BROWSER_NODE_DIR (node)->children = NULL;
/* This node is no longer loaded */
node->flags &= ~GEDIT_FILE_BROWSER_STORE_FLAG_LOADED;
} | false | false | false | false | false | 0 |
t4_edc_err_read(struct adapter *adap, int idx)
{
u32 edc_ecc_err_addr_reg;
u32 rdata_reg;
if (is_t4(adap->params.chip)) {
CH_WARN(adap, "%s: T4 NOT supported.\n", __func__);
return 0;
}
if (idx != 0 && idx != 1) {
CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx);
return 0;
}
edc_ecc_err_addr_reg = EDC_T5_REG(EDC_H_ECC_ERR_ADDR_A, idx);
rdata_reg = EDC_T5_REG(EDC_H_BIST_STATUS_RDATA_A, idx);
CH_WARN(adap,
"edc%d err addr 0x%x: 0x%x.\n",
idx, edc_ecc_err_addr_reg,
t4_read_reg(adap, edc_ecc_err_addr_reg));
CH_WARN(adap,
"bist: 0x%x, status %llx %llx %llx %llx %llx %llx %llx %llx %llx.\n",
rdata_reg,
(unsigned long long)t4_read_reg64(adap, rdata_reg),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 8),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 16),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 24),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 32),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 40),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 48),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 56),
(unsigned long long)t4_read_reg64(adap, rdata_reg + 64));
return 0;
} | false | false | false | false | false | 0 |
bLoadSchemFiles( void )
{
wxString os1, os2;
size_t sz1;
// Don't clear the current list of schematic file names
// m_ofnaSchemFiles.Empty( );
// Scan circuit description for schematic file name/s
for( sz1=0; sz1<m_osaNetLst.GetCount( ); sz1++ )
{
os1 = m_osaNetLst.Item( sz1 );
if( os1.IsEmpty( ) ) continue;
if( os1.GetChar( 0 ) != wxT('*') ) continue;
if( os1.StartsWith( wxT("* Schematic : "), &os2 ) )
{
if( ! bSetSchemFiles( os2 ) ) return( FALSE );
break;
}
}
return( TRUE );
} | false | false | false | false | false | 0 |
glob_create(const char *zPatternList){
int nList; /* Size of zPatternList in bytes */
int i; /* Loop counters */
Glob *p; /* The glob being created */
char *z; /* Copy of the pattern list */
char delimiter; /* '\'' or '\"' or 0 */
if( zPatternList==0 || zPatternList[0]==0 ) return 0;
nList = strlen(zPatternList);
p = fossil_malloc( sizeof(*p) + nList+1 );
memset(p, 0, sizeof(*p));
z = (char*)&p[1];
memcpy(z, zPatternList, nList+1);
while( z[0] ){
while( fossil_isspace(z[0]) || z[0]==',' ){
z++; /* Skip leading commas, spaces, and newlines */
}
if( z[0]==0 ) break;
if( z[0]=='\'' || z[0]=='"' ){
delimiter = z[0];
z++;
}else{
delimiter = ',';
}
p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
p->azPattern[p->nPattern++] = z;
/* Find the next delimter (or the end of the string). */
for(i=0; z[i] && z[i]!=delimiter; i++){
if( delimiter!=',' ) continue; /* If quoted, keep going. */
if( fossil_isspace(z[i]) ) break; /* If space, stop. */
}
if( z[i]==0 ) break;
z[i] = 0;
z += i+1;
}
return p;
} | false | false | false | false | false | 0 |
trace_magic_trampoline(struct compilation_unit *cu)
{
if (!cu_matches_regex(cu))
return;
trace_printf("jit_magic_trampoline: ret0=%p, ret1=%p: %s.%s #%d\n",
__builtin_return_address(1),
__builtin_return_address(2),
cu->method->class->name,
cu->method->name,
cu->method->method_index);
trace_flush();
} | false | false | false | false | false | 0 |
gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
guint size, GTimeVal * timeout)
{
guint offset;
gint retval;
GstClockTime to;
GstRTSPResult res;
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
g_return_val_if_fail (data != NULL || size == 0, GST_RTSP_EINVAL);
g_return_val_if_fail (conn->writefd != NULL, GST_RTSP_EINVAL);
gst_poll_set_controllable (conn->fdset, TRUE);
gst_poll_fd_ctl_write (conn->fdset, conn->writefd, TRUE);
gst_poll_fd_ctl_read (conn->fdset, conn->readfd, FALSE);
/* clear all previous poll results */
gst_poll_fd_ignored (conn->fdset, conn->writefd);
gst_poll_fd_ignored (conn->fdset, conn->readfd);
to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
offset = 0;
while (TRUE) {
/* try to write */
res = write_bytes (conn->writefd->fd, data, &offset, size);
if (G_LIKELY (res == GST_RTSP_OK))
break;
if (G_UNLIKELY (res != GST_RTSP_EINTR))
goto write_error;
/* not all is written, wait until we can write more */
do {
retval = gst_poll_wait (conn->fdset, to);
} while (retval == -1 && (errno == EINTR || errno == EAGAIN));
if (G_UNLIKELY (retval == 0))
goto timeout;
if (G_UNLIKELY (retval == -1)) {
if (errno == EBUSY)
goto stopped;
else
goto select_error;
}
/* could also be an error with read socket */
if (gst_poll_fd_has_error (conn->fdset, conn->readfd))
goto socket_error;
}
return GST_RTSP_OK;
/* ERRORS */
timeout:
{
return GST_RTSP_ETIMEOUT;
}
select_error:
{
return GST_RTSP_ESYS;
}
stopped:
{
return GST_RTSP_EINTR;
}
socket_error:
{
return GST_RTSP_ENET;
}
write_error:
{
return res;
}
} | false | false | false | false | false | 0 |
get_vision_status(const struct player *me,
const struct player *them)
{
if (me && them && gives_shared_vision(me, them)) {
if (gives_shared_vision(them, me)) {
return Q_("?vision:Both");
} else {
return Q_("?vision:To Them");
}
} else if (me && them && gives_shared_vision(them, me)) {
return Q_("?vision:To Us");
} else {
return "";
}
} | false | false | false | false | false | 0 |
AddSrcBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize)
{
SetBand(nBands + 1, new GDALProxyPoolRasterBand(this, nBands + 1, eDataType, nBlockXSize, nBlockYSize));
} | false | false | false | false | false | 0 |
__Pyx_ImportType(const char *module_name, const char *class_name,
size_t size, int strict)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
char warning[200];
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
#if PY_MAJOR_VERSION < 3
py_name = PyString_FromString(class_name);
#else
py_name = PyUnicode_FromString(class_name);
#endif
if (!py_name)
goto bad;
result = PyObject_GetAttr(py_module, py_name);
Py_DECREF(py_name);
py_name = 0;
Py_DECREF(py_module);
py_module = 0;
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
#if PY_VERSION_HEX < 0x02050000
if (PyErr_Warn(NULL, warning) < 0) goto bad;
#else
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
#endif
}
else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
PyErr_Format(PyExc_ValueError,
"%s.%s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(py_module);
Py_XDECREF(result);
return NULL;
} | false | false | false | false | false | 0 |
output_stored_text()
{
register int c;
register FILE *in, *out;
register int state; /* 0=middle of line, 1=start of line, 2=seen '#' */
state = 1;
fclose(text_file);
text_file = fopen(text_file_name, "r");
if (text_file == NULL)
open_error(text_file_name);
in = text_file;
if ((c = getc(in)) == EOF)
return;
out = code_file;
do {
if (c == '\n') {
++outline;
if (state == 2) {
fprintf(out, line_format+1, outline + 1, code_file_name);
state = 1;
continue; }
state = 1; }
else if (state == 1 && c == '#')
state = 2;
else
state = 0;
putc(c, out);
} while ((c = getc(in)) != EOF);
if (!lflag)
fprintf(out, line_format, ++outline + 1, code_file_name);
} | false | false | false | false | true | 1 |
sanitize_dlt_linux_sll(const Packet& pkt)
{
if ( pkt.header.caplen < 16 )
return -1;
uint16_t p = ntohs(*reinterpret_cast<uint16_t*>(pkt.data + 14));
if ( p != 0x0800 /* && p != 0x86dd */ )
// Not IP.
return -2;
// Zero out link-layer address-length and address.
memset(pkt.data + 4, 0, 10);
return 16;
} | false | false | false | false | false | 0 |
resize_z_stack(int32_t added_capacity)
{
int index_position;
size_t offset;
if (added_capacity == 0)
return;
TRACE_LOG("Enlarging stack capacity by %d entries.\n", (int)added_capacity);
// We'll have to remember the count of elements currently on the stack.
// This is required since a call to realloc might move the stack to
// some other place in memory. Keeping the current index number in mind
// will allow us to create a corrent pointer to a possibly new location.
index_position = z_stack_index - z_stack;
TRACE_LOG("current stack size: %d.\n", current_z_stack_size);
current_z_stack_size += added_capacity;
offset = local_variable_storage_index - z_stack;
TRACE_LOG("z_stack: %p, z_stack_index: %p, behind_z_stack: %p.\n",
z_stack, z_stack_index, behind_z_stack);
// Initially, z_stack is NULL. If realloc() is called with a pointer to
// null it works like malloc() which suits just fine.
z_stack = (uint16_t*)fizmo_realloc(
z_stack,
current_z_stack_size * sizeof(uint16_t));
behind_z_stack = z_stack + current_z_stack_size;
local_variable_storage_index = z_stack + offset;
if ((z_stack_index = z_stack + index_position) >= behind_z_stack)
{
// In case the stack has been shrunk the index may have to be re-adjusted.
z_stack_index = behind_z_stack - 1;
}
TRACE_LOG("Z-Stack now at %p (element behind: %p, z_stack_index: %p).\n",
z_stack, behind_z_stack, z_stack_index);
TRACE_LOG("new stack size: %d.\n", current_z_stack_size);
} | false | false | false | false | false | 0 |
isGuaranteedToExecuteForEveryIteration(const Instruction *I,
const Loop *L) {
// The loop header is guaranteed to be executed for every iteration.
//
// FIXME: Relax this constraint to cover all basic blocks that are
// guaranteed to be executed at every iteration.
if (I->getParent() != L->getHeader()) return false;
for (const Instruction &LI : *L->getHeader()) {
if (&LI == I) return true;
if (!isGuaranteedToTransferExecutionToSuccessor(&LI)) return false;
}
llvm_unreachable("Instruction not contained in its own parent basic block.");
} | false | false | false | false | false | 0 |
dynv_set(struct dynvSystem* dynv_system, const char* handler_name, const char* variable_path, const void* value){
string path(variable_path);
size_t found;
struct dynvSystem* dlevel = dynv_system_ref(dynv_system);
for (;;){
found = path.find('.');
if (found != string::npos){
struct dynvSystem* dlevel_new;
dlevel_new = (struct dynvSystem*)dynv_system_get(dlevel, "dynv", path.substr(0, found).c_str());
if (dlevel_new){
dynv_system_release(dlevel);
dlevel = dlevel_new;
}else{
struct dynvHandlerMap* handler_map = dynv_system_get_handler_map(dynv_system);
struct dynvSystem* dlevel_new = dynv_system_create(handler_map);
dynv_handler_map_release(handler_map);
dynv_system_set(dlevel, "dynv", path.substr(0, found).c_str(), dlevel_new);
dynv_system_release(dlevel);
dlevel = dlevel_new;
}
path = path.substr(found+1);
}else break;
}
int r = dynv_system_set(dlevel, handler_name, path.c_str(), (void*)value);
dynv_system_release(dlevel);
return r;
} | false | false | false | false | false | 0 |
rb_big2dbl(x)
VALUE x;
{
double d = 0.0;
long i = RBIGNUM(x)->len;
BDIGIT *ds = BDIGITS(x);
while (i--) {
d = ds[i] + BIGRAD*d;
}
if (isinf(d)) {
rb_warn("Bignum out of Float range");
d = HUGE_VAL;
}
if (!RBIGNUM(x)->sign) d = -d;
return d;
} | false | false | false | false | false | 0 |
jbig2_decode_pattern_dict(Jbig2Ctx *ctx, Jbig2Segment *segment,
const Jbig2PatternDictParams *params,
const byte *data, const size_t size,
Jbig2ArithCx *GB_stats)
{
Jbig2PatternDict *hd = NULL;
Jbig2Image *image = NULL;
Jbig2GenericRegionParams rparams;
int code = 0;
/* allocate the collective image */
image = jbig2_image_new(ctx,
params->HDPW * (params->GRAYMAX + 1), params->HDPH);
if (image == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
"failed to allocate collective bitmap for halftone dict!");
return NULL;
}
/* fill out the generic region decoder parameters */
rparams.MMR = params->HDMMR;
rparams.GBTEMPLATE = params->HDTEMPLATE;
rparams.TPGDON = 0; /* not used if HDMMR = 1 */
rparams.USESKIP = 0;
rparams.gbat[0] = -(int8_t)params->HDPW;
rparams.gbat[1] = 0;
rparams.gbat[2] = -3;
rparams.gbat[3] = -1;
rparams.gbat[4] = 2;
rparams.gbat[5] = -2;
rparams.gbat[6] = -2;
rparams.gbat[7] = -2;
if (params->HDMMR) {
code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data, size, image);
} else {
Jbig2WordStream *ws = jbig2_word_stream_buf_new(ctx, data, size);
if (ws != NULL)
{
Jbig2ArithState *as = jbig2_arith_new(ctx, ws);
if (as != NULL)
{
code = jbig2_decode_generic_region(ctx, segment, &rparams,
as, image, GB_stats);
}
else
{
code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
"failed to allocate storage for as in halftone dict!");
}
jbig2_free(ctx->allocator, as);
jbig2_word_stream_buf_free(ctx, ws);
}
else
{
code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
"failed to allocate storage for ws in halftone dict!");
}
}
if (code == 0) hd = jbig2_hd_new(ctx, params, image);
jbig2_image_release(ctx, image);
return hd;
} | false | false | false | false | false | 0 |
afp_getfiledirparms(struct afp_volume *volume, unsigned int did, unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
struct afp_file_info *fpp)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t command;
uint8_t pad;
uint16_t volid;
uint32_t did;
uint16_t file_bitmap;
uint16_t directory_bitmap;
} __attribute__((__packed__)) * getfiledirparms;
struct afp_server * server = volume->server;
int ret = 0;
char *path, * msg;
unsigned int len;
if (!pathname) return -1;
len = sizeof(*getfiledirparms)+sizeof_path_header(server)+strlen(pathname);
if ((msg = malloc(len))==NULL)
return -1;
path = msg + (sizeof(*getfiledirparms));
getfiledirparms=(void *) msg;
dsi_setup_header(server,&getfiledirparms->dsi_header,DSI_DSICommand);
getfiledirparms->command=afpGetFileDirParms;
getfiledirparms->pad=0;
getfiledirparms->volid=htons(volume->volid);
getfiledirparms->did=htonl(did);
getfiledirparms->file_bitmap=htons(filebitmap);
getfiledirparms->directory_bitmap=htons(dirbitmap);
copy_path(server,path,pathname,strlen(pathname));
unixpath_to_afppath(server,path);
ret=dsi_send(server, (char *) getfiledirparms,len,DSI_DEFAULT_TIMEOUT,
afpGetFileDirParms,(void *) fpp);
free(msg);
return ret;
} | false | false | false | false | false | 0 |
checkcondition_str(void *checkval, QueryOperand *val)
{
CHKVAL *chkval = (CHKVAL *) checkval;
WordEntry *StopLow = chkval->arrb;
WordEntry *StopHigh = chkval->arre;
WordEntry *StopMiddle = StopHigh;
int difference = -1;
bool res = false;
/* Loop invariant: StopLow <= val < StopHigh */
while (StopLow < StopHigh)
{
StopMiddle = StopLow + (StopHigh - StopLow) / 2;
difference = tsCompareString(chkval->operand + val->distance, val->length,
chkval->values + StopMiddle->pos, StopMiddle->len,
false);
if (difference == 0)
{
res = (val->weight && StopMiddle->haspos) ?
checkclass_str(chkval, StopMiddle, val) : true;
break;
}
else if (difference > 0)
StopLow = StopMiddle + 1;
else
StopHigh = StopMiddle;
}
if (!res && val->prefix)
{
/*
* there was a failed exact search, so we should scan further to find
* a prefix match.
*/
if (StopLow >= StopHigh)
StopMiddle = StopHigh;
while (res == false && StopMiddle < chkval->arre &&
tsCompareString(chkval->operand + val->distance, val->length,
chkval->values + StopMiddle->pos, StopMiddle->len,
true) == 0)
{
res = (val->weight && StopMiddle->haspos) ?
checkclass_str(chkval, StopMiddle, val) : true;
StopMiddle++;
}
}
return res;
} | false | false | false | false | false | 0 |
cmd_codesinfo()
{
coderec *code;
int num_cols = 4;
int col, row, num_rows, tot;
char line[160];
context;
line[0] = 0;
say("%d server codes.",Codes->num_codes);
say("");
say("Hit Code Hit Code Hit Code Hit Code");
say("------ ------- ------ ------- ------ ------- ------ -------");
tot = Codes_orderbycode();
num_rows = tot / num_cols;
if(tot % num_cols)
num_rows++;
for(row=1; row<=num_rows; row++)
{
for(col=1; col<=num_cols; col++)
{
code = Codes_codebyorder((num_rows * (col-1)) + row);
if(code)
sprintf(line,"%s%6lu %-7s ",line,code->accessed,code->name);
}
line[strlen(line) - 3] = 0;
say("%s",line);
line[0] = 0;
}
say("------ ------- ------ ------- ------ ------- ------ -------");
} | true | true | false | false | false | 1 |
clipPoly(const float* in, int n, float* out, float pnx, float pnz, float pd)
{
float d[12];
for (int i = 0; i < n; ++i)
d[i] = pnx*in[i*3+0] + pnz*in[i*3+2] + pd;
int m = 0;
for (int i = 0, j = n-1; i < n; j=i, ++i)
{
bool ina = d[j] >= 0;
bool inb = d[i] >= 0;
if (ina != inb)
{
float s = d[j] / (d[j] - d[i]);
out[m*3+0] = in[j*3+0] + (in[i*3+0] - in[j*3+0])*s;
out[m*3+1] = in[j*3+1] + (in[i*3+1] - in[j*3+1])*s;
out[m*3+2] = in[j*3+2] + (in[i*3+2] - in[j*3+2])*s;
m++;
}
if (inb)
{
out[m*3+0] = in[i*3+0];
out[m*3+1] = in[i*3+1];
out[m*3+2] = in[i*3+2];
m++;
}
}
return m;
} | false | false | false | false | false | 0 |
fail_request(struct mrpc_event *event, mrpc_status_t err)
{
struct mrpc_message *request=event->msg;
_mrpc_release_event(event);
if (request->hdr.cmd >= 0) {
if (mrpc_send_reply_error(request->conn->set->protocol,
request->hdr.cmd, request, err))
mrpc_free_message(request);
} else {
mrpc_free_message(request);
}
} | false | false | false | false | false | 0 |
ubuntu_online_accounts_config_sources (EUbuntuOnlineAccounts *extension,
ESource *source,
AgAccount *ag_account)
{
ESourceRegistryServer *server;
ECollectionBackend *backend;
GHashTable *account_services;
GList *list, *link;
account_services = ubuntu_online_accounts_new_account_services (
extension, ag_account);
ubuntu_online_accounts_config_collection (
extension, source, ag_account, account_services, NULL);
server = ubuntu_online_accounts_get_server (extension);
backend = e_source_registry_server_ref_backend (server, source);
g_return_if_fail (backend != NULL);
list = e_collection_backend_list_mail_sources (backend);
for (link = list; link != NULL; link = g_list_next (link)) {
const gchar *extension_name;
source = E_SOURCE (link->data);
extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
if (e_source_has_extension (source, extension_name))
ubuntu_online_accounts_config_mail_account (
extension, source, account_services, NULL);
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
if (e_source_has_extension (source, extension_name))
ubuntu_online_accounts_config_mail_identity (
extension, source, account_services, NULL);
extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
if (e_source_has_extension (source, extension_name))
ubuntu_online_accounts_config_mail_transport (
extension, source, account_services, NULL);
}
g_list_free_full (list, (GDestroyNotify) g_object_unref);
g_object_unref (backend);
g_hash_table_unref (account_services);
} | false | false | false | false | false | 0 |
__db_dump_pp(dbp, subname, callback, handle, pflag, keyflag)
DB *dbp;
const char *subname;
int (*callback) __P((void *, const void *));
void *handle;
int pflag, keyflag;
{
DB_THREAD_INFO *ip;
ENV *env;
int handle_check, ret, t_ret;
env = dbp->env;
DB_ILLEGAL_BEFORE_OPEN(dbp, "DB->dump");
ENV_ENTER(env, ip);
/* Check for replication block. */
handle_check = IS_ENV_REPLICATED(env);
if (handle_check && (ret = __db_rep_enter(dbp, 1, 0, 1)) != 0) {
handle_check = 0;
goto err;
}
ret = __db_dump(dbp, subname, callback, handle, pflag, keyflag);
/* Release replication block. */
if (handle_check && (t_ret = __env_db_rep_exit(env)) != 0 && ret == 0)
ret = t_ret;
err: ENV_LEAVE(env, ip);
return (ret);
} | false | false | false | true | false | 1 |
print_error() const {
Struct * s = (Struct *) p;
if(s->theStatus != OK) {
std::cerr << error_name() << std::endl;
}
return;
} | false | false | false | false | false | 0 |
ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address)
{
struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
if (slot != 0)
return -EINVAL;
return ttpci_budget_debiread(&budget_ci->budget, DEBICICAM,
DEBIADDR_ATTR | (address & 0xfff), 1, 1, 0);
} | false | false | false | false | false | 0 |
spot_oversized_zone(zone_t *zone)
{
g_assert(uint_is_positive(zone->zn_refcnt));
g_assert(zone->zn_cnt <= zone->zn_blocks);
if (!zlock_try(zone))
return;
/*
* It's not possible to create this object at zn_create() time because
* there is a danger of deadlocking from walloc() when the size of
* the objects to create matches the zone we're attempting to allocate.
*/
if G_UNLIKELY(NULL == zone->zn_mem && zalloc_memusage_ok) {
zunlock(zone);
zn_memusage_init(zone);
zlock(zone);
}
/*
* A zone is oversized if it contains more than 1 subzone and if it has
* at least "1.5 hint" blocks free (i.e. with potentially extra subzones
* that could be released).
*
* However, to account for demand variability, we wait for at least
* ZN_OVERSIZE_THRESH times before flagging the zone as definitively
* oversized and candidate for stricter free block management, when we
* have less than "4 hints" blocks free.
*
* As soon as we have "4 hints" blocks free, we unconditionally trigger
* garbage collection mode.
*/
if (
NULL == zone->zn_gc &&
zone->zn_subzones > 1 &&
zone->zn_blocks - zone->zn_cnt >= (zone->zn_hint + zone->zn_hint / 2)
) {
if (
++zone->zn_oversized >= ZN_OVERSIZE_THRESH ||
zgc_always(zone) ||
zone->zn_blocks - zone->zn_cnt >= (4 * zone->zn_hint)
) {
if (zalloc_debugging(4)) {
s_debug("ZGC %zu-byte zone %p %s: "
"%u blocks, %u used (hint=%u, %u subzones)",
zone->zn_size, (void *) zone,
zgc_always(zone) ? "forced in GC mode" : "oversized",
zone->zn_blocks, zone->zn_cnt, zone->zn_hint,
zone->zn_subzones);
}
/*
* If zone holds no blocks, we can shrink it.
* Otherwise set it up for garbage collection.
*/
if (0 == zone->zn_cnt) {
zn_shrink(zone);
} else {
zgc_allocate(zone);
if (1 == zone->zn_subzones && !zgc_always(zone))
zgc_dispose(zone);
}
if (zalloc_debugging(4)) {
s_debug("ZGC %zu-byte zone %p %s: "
"%u blocks, %u used (hint=%u, %u subzone%s)",
zone->zn_size, (void *) zone,
NULL == zone->zn_gc ? "after shrinking" : "has GC on",
zone->zn_blocks, zone->zn_cnt, zone->zn_hint,
zone->zn_subzones, 1 == zone->zn_subzones ? "" : "s");
}
}
} else if (zgc_always(zone)) {
if (NULL == zone->zn_gc) {
if (zalloc_debugging(4)) {
s_debug("ZGC %zu-byte zone %p forced in GC mode: "
"%u blocks, %u used (hint=%u, %u subzones)",
zone->zn_size, (void *) zone,
zone->zn_blocks, zone->zn_cnt, zone->zn_hint,
zone->zn_subzones);
}
zgc_allocate(zone);
} else if (zone->zn_gc->zg_flags & ZGC_SCAN_ALL) {
zgc_scan(zone);
}
} else {
if (zone->zn_gc != NULL && (zone->zn_gc->zg_flags & ZGC_SCAN_ALL)) {
zgc_scan(zone);
}
zone->zn_oversized = 0;
}
zunlock(zone);
} | false | false | false | false | false | 0 |
gammq(double a, double x)
{
double gamser, gammcf, gln;
if (x < 0.0 || a <= 0.0)
{ printf("*** error %s: invalid arguments\n",__func__);
exit(1);
}
if (x < (a+1.0))
{ gser(&gamser,a,x,&gln);
return 1.0-gamser;
}
else
{
gcf(&gammcf,a,x,&gln);
return gammcf;
}
} | false | false | false | false | false | 0 |
do_stat(int argc, char **argv, char **result)
{
char *filename, *fmt;
struct stat statbuf;
fmt = argv[1];
filename = argv[2];
if (stat(filename, &statbuf) == -1) {
*result = strdup(strerror(errno));
return(-1);
}
return(stat_to_text(filename, fmt, &statbuf, result));
} | false | false | false | false | false | 0 |
Rewind()
{
if ( ! this->InputStream ) //need to already have an open file
{
vtkGenericWarningMacro(<<"No input file opened to rewind...");
}
this->InputStream->clear();
this->InputStream->seekg(0);
} | false | false | false | true | false | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.