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 |
|---|---|---|---|---|---|---|
VSM_Seq(struct VSM_data *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
return (vd->VSM_head->alloc_seq);
} | false | false | false | true | false | 1 |
gst_soup_http_src_check_seekable (GstSoupHTTPSrc * src)
{
GstFlowReturn ret = GST_FLOW_OK;
/* Special case to check if the server allows range requests
* before really starting to get data in the buffer creation
* loops.
*/
if (!src->got_headers && GST_STATE (src) >= GST_STATE_PAUSED) {
g_mutex_lock (&src->mutex);
while (!src->got_headers && !src->interrupted && ret == GST_FLOW_OK) {
if ((src->msg && src->msg->method != SOUP_METHOD_HEAD) &&
src->session_io_status != GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE) {
/* wait for the current request to finish */
g_cond_wait (&src->request_finished_cond, &src->mutex);
} else {
if (gst_soup_http_src_session_open (src)) {
ret = gst_soup_http_src_do_request (src, SOUP_METHOD_HEAD, NULL);
}
}
}
if (src->ret == GST_FLOW_EOS) {
/* A HEAD request shouldn't lead to EOS */
src->ret = GST_FLOW_OK;
}
/* resets status to idle */
gst_soup_http_src_cancel_message (src);
g_mutex_unlock (&src->mutex);
}
} | false | false | false | false | false | 0 |
xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) {
xmlSecAssert(keyReq != NULL);
xmlSecAssert(output != NULL);
fprintf(output, "=== KeyReq:\n");
fprintf(output, "==== keyId: %s\n",
(xmlSecKeyDataKlassGetName(keyReq->keyId)) ?
xmlSecKeyDataKlassGetName(keyReq->keyId) :
BAD_CAST "NULL");
fprintf(output, "==== keyType: 0x%08x\n", keyReq->keyType);
fprintf(output, "==== keyUsage: 0x%08x\n", keyReq->keyUsage);
fprintf(output, "==== keyBitsSize: %d\n", keyReq->keyBitsSize);
xmlSecPtrListDebugDump(&(keyReq->keyUseWithList), output);
} | false | false | false | false | false | 0 |
set_DAC_volt(double volt)
{
DAC_voltage = volt;
if ((value.get() & (CPSON|CPSRM)) == (CPSON|CPSRM))
calculate_freq();
} | false | false | false | false | false | 0 |
_render_rle(GRAPHICS_CONTROLLER *gc,
int64_t pts,
BD_PG_RLE_ELEM *img,
uint16_t x, uint16_t y,
uint16_t width, uint16_t height,
BD_PG_PALETTE_ENTRY *palette)
{
if (gc->overlay_proc) {
BD_OVERLAY ov = {0};
ov.cmd = BD_OVERLAY_DRAW;
ov.pts = pts;
ov.plane = BD_OVERLAY_PG;
ov.x = x;
ov.y = y;
ov.w = width;
ov.h = height;
ov.palette = palette;
ov.img = img;
gc->overlay_proc(gc->overlay_proc_handle, &ov);
}
} | false | false | false | false | false | 0 |
key_unit_diplomat_actions(void)
{
struct city *pcity; /* need pcity->id */
unit_list_iterate(get_units_in_focus(), punit) {
if (is_diplomat_unit(punit)
&& (pcity = tile_city(unit_tile(punit)))
&& diplomat_can_do_action(punit, DIPLOMAT_ANY_ACTION,
unit_tile(punit))) {
process_diplomat_arrival(punit, pcity->id);
return;
/* FIXME: diplomat dialog for more than one unit at a time. */
}
} unit_list_iterate_end;
} | false | false | false | false | false | 0 |
port_mdr_in( void )
{
libspectrum_byte ret = 0xff;
int m;
for( m = 0; m < 8; m++ ) {
microdrive_t *mdr = µdrive[ m ];
if( mdr->motor_on && mdr->inserted ) {
if( mdr->transfered < mdr->max_bytes ) {
mdr->last = libspectrum_microdrive_data( mdr->cartridge,
mdr->head_pos );
increment_head( m );
}
mdr->transfered++;
ret &= mdr->last; /* I assume negative logic, but how know? */
}
}
return ret;
} | false | false | false | false | false | 0 |
symbol_bd_cobol_get_symbols_matches (Symbolizable *self, const gchar *symbol_prefix, gint flags)
{
gphpedit_debug (DEBUG_SYMBOLIZABLE);
SymbolBdCOBOLDetails *symbolbddet;
symbolbddet = SYMBOL_BD_COBOL_GET_PRIVATE(self);
symbolbddet->completion_prefix = (gchar *) symbol_prefix;
symbolbddet->completion_string = NULL;
if (symbol_bd_cobol_has_cache(symbolbddet->cache_str, symbolbddet->cache_completion, symbolbddet->cache_flags, symbol_prefix, flags)){
symbolbddet->completion_string = symbol_bd_get_autocomp_from_cache(symbolbddet->cache_str, symbolbddet->cache_completion, symbol_prefix);
} else {
symbolbddet->completion_tree = g_tree_new_full ((GCompareDataFunc) g_strcmp0, NULL, NULL,(GDestroyNotify) g_free);
if (((flags & SYMBOL_ALL) == SYMBOL_ALL) || ((flags & SYMBOL_FUNCTION) == SYMBOL_FUNCTION)) {
g_hash_table_foreach (symbolbddet->functionlist, add_result_item, symbolbddet);
/* add api functions */
g_tree_foreach (symbolbddet->cobol_api_tree, add_api_item, symbolbddet);
}
if (((flags & SYMBOL_ALL) == SYMBOL_ALL) || ((flags & SYMBOL_VAR) == SYMBOL_VAR)) {
g_hash_table_foreach (symbolbddet->cobol_variables_tree, add_var_item, symbolbddet);
}
g_tree_foreach (symbolbddet->completion_tree, make_result_string, symbolbddet);
g_tree_destroy (symbolbddet->completion_tree);
if (symbolbddet->completion_string) symbol_bd_cobol_save_result_in_cache(symbolbddet, symbolbddet->completion_string->str, symbol_prefix);
}
if (symbolbddet->completion_string){
gphpedit_debug_message(DEBUG_CLASSBROWSER, "prefix: %s autocomplete list:%s\n", symbol_prefix, symbolbddet->completion_string->str);
return g_string_free(symbolbddet->completion_string, FALSE);
}
gphpedit_debug_message(DEBUG_CLASSBROWSER, "prefix: %s autocomplete list:%s\n", symbol_prefix, "null");
return NULL;
} | false | false | false | false | false | 0 |
sendf(const char* msg)
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, outBufferLock, -1);
if (closing_)
return -1;
int msgLen = strlen(msg);
if (msgLen + outputBufferLen > RA_BUFF_SIZE)
return -1;
ACE_OS::memcpy(outputBuffer + outputBufferLen, msg, msgLen);
outputBufferLen += msgLen;
if (!outActive)
{
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
sLog.outError("RASocket::sendf error while schedule_wakeup");
return -1;
}
outActive = true;
}
return 0;
} | false | false | false | false | false | 0 |
mlx4_en_get_ringparam(struct net_device *dev,
struct ethtool_ringparam *param)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
memset(param, 0, sizeof(*param));
param->rx_max_pending = MLX4_EN_MAX_RX_SIZE;
param->tx_max_pending = MLX4_EN_MAX_TX_SIZE;
param->rx_pending = priv->port_up ?
priv->rx_ring[0]->actual_size : priv->rx_ring[0]->size;
param->tx_pending = priv->tx_ring[0]->size;
} | false | false | false | false | false | 0 |
translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
struct x86_exception *exception)
{
gpa_t t_gpa;
BUG_ON(!mmu_is_nested(vcpu));
/* NPT walks are always user-walks */
access |= PFERR_USER_MASK;
t_gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, gpa, access, exception);
return t_gpa;
} | false | false | false | false | false | 0 |
g_vfs_afp_connection_close_sync (GVfsAfpConnection *afp_connection,
GCancellable *cancellable,
GError **error)
{
GVfsAfpConnectionPrivate *priv = afp_connection->priv;
SyncData close_data;
/* Take lock */
g_mutex_lock (&priv->mutex);
if (!check_open (afp_connection, error)) {
g_mutex_unlock (&priv->mutex);
return FALSE;
}
sync_data_init (&close_data, afp_connection, error);
priv->pending_closes = g_slist_prepend (priv->pending_closes, &close_data);
/* Release lock */
g_mutex_unlock (&priv->mutex);
if (g_atomic_int_compare_and_exchange (&priv->atomic_state, STATE_CONNECTED, STATE_PENDING_CLOSE))
g_cancellable_cancel (priv->read_cancellable);
sync_data_wait (&close_data);
return close_data.res;
} | false | false | false | false | false | 0 |
no(FXint num){
register FXint old=*((FXint*)(ptr-1));
if(old!=num){
if(0<num){
if(ptr==EMPTY){
ptr=1+((FXObject**)malloc(ROUNDUP(num)*sizeof(FXObject*)+sizeof(FXObject*)));
}
else{
ptr=1+((FXObject**)realloc(ptr-1,ROUNDUP(num)*sizeof(FXObject*)+sizeof(FXObject*)));
}
if(num>old){memset(ptr+old,0,(num-old)*sizeof(FXObject*));}
*((FXint*)(ptr-1))=num;
}
else if(ptr!=EMPTY){
free(ptr-1);
ptr=EMPTY;
}
}
} | false | false | false | false | false | 0 |
on_time_entry_key_release (GtkWidget *widget,
GdkEvent *key_event,
EDateEdit *dedit)
{
guint event_keyval = 0;
gdk_event_get_keyval (key_event, &event_keyval);
if (event_keyval == GDK_KEY_Up || event_keyval == GDK_KEY_Down) {
g_signal_stop_emission_by_name (widget, "key_release_event");
e_date_edit_check_time_changed (dedit);
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
Transport_CreateWrapKey(TSS_HCONTEXT tspContext, /* in */
TCS_KEY_HANDLE hWrappingKey, /* in */
TPM_ENCAUTH *KeyUsageAuth, /* in */
TPM_ENCAUTH *KeyMigrationAuth, /* in */
UINT32 keyInfoSize, /* in */
BYTE * keyInfo, /* in */
UINT32 * keyDataSize, /* out */
BYTE ** keyData, /* out */
TPM_AUTH * pAuth) /* in, out */
{
TSS_RESULT result;
UINT32 handlesLen, decLen;
TCS_HANDLE *handles, handle;
BYTE *dec = NULL;
TPM_DIGEST pubKeyHash;
Trspi_HashCtx hashCtx;
UINT64 offset;
BYTE *data;
if ((result = obj_context_transport_init(tspContext)))
return result;
LogDebugFn("Executing in a transport session");
if ((result = obj_tcskey_get_pubkeyhash(hWrappingKey, pubKeyHash.digest)))
return result;
result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
result |= Trspi_Hash_DIGEST(&hashCtx, pubKeyHash.digest);
if ((result |= Trspi_HashFinal(&hashCtx, pubKeyHash.digest)))
return result;
handlesLen = 1;
handle = hWrappingKey;
handles = &handle;
if ((data = malloc(2 * sizeof(TPM_ENCAUTH) + keyInfoSize)) == NULL) {
LogError("malloc of %zd bytes failed", 2 * sizeof(TPM_ENCAUTH) + keyInfoSize);
return TSPERR(TSS_E_OUTOFMEMORY);
}
offset = 0;
Trspi_LoadBlob(&offset, sizeof(TPM_ENCAUTH), data, KeyUsageAuth->authdata);
Trspi_LoadBlob(&offset, sizeof(TPM_ENCAUTH), data, KeyMigrationAuth->authdata);
Trspi_LoadBlob(&offset, keyInfoSize, data, keyInfo);
if ((result = obj_context_transport_execute(tspContext, TPM_ORD_CreateWrapKey,
(2 * sizeof(TPM_ENCAUTH) + keyInfoSize), data,
&pubKeyHash, &handlesLen, &handles, pAuth, NULL,
&decLen, &dec)))
goto done;
*keyDataSize = decLen;
*keyData = dec;
done:
free(data);
return result;
} | false | false | false | false | false | 0 |
construct_packet(Ssh ssh, int pkttype, va_list ap)
{
int argtype;
Bignum bn;
struct Packet *pkt;
pkt = ssh1_pkt_init(pkttype);
while ((argtype = va_arg(ap, int)) != PKT_END) {
unsigned char *argp, argchar;
char *sargp;
unsigned long argint;
int arglen;
switch (argtype) {
/* Actual fields in the packet */
case PKT_INT:
argint = va_arg(ap, int);
ssh_pkt_adduint32(pkt, argint);
break;
case PKT_CHAR:
argchar = (unsigned char) va_arg(ap, int);
ssh_pkt_addbyte(pkt, argchar);
break;
case PKT_DATA:
argp = va_arg(ap, unsigned char *);
arglen = va_arg(ap, int);
ssh_pkt_adddata(pkt, argp, arglen);
break;
case PKT_STR:
sargp = va_arg(ap, char *);
ssh_pkt_addstring(pkt, sargp);
break;
case PKT_BIGNUM:
bn = va_arg(ap, Bignum);
ssh1_pkt_addmp(pkt, bn);
break;
/* Tokens for modifications to packet logging */
case PKTT_PASSWORD:
dont_log_password(ssh, pkt, PKTLOG_BLANK);
break;
case PKTT_DATA:
dont_log_data(ssh, pkt, PKTLOG_OMIT);
break;
case PKTT_OTHER:
end_log_omission(ssh, pkt);
break;
}
}
return pkt;
} | false | false | false | false | false | 0 |
BuildLoadNamedGeneric(HValue* obj,
Property* expr) {
ASSERT(expr->key()->IsPropertyName());
Handle<Object> name = expr->key()->AsLiteral()->handle();
HValue* context = environment()->LookupContext();
return new(zone()) HLoadNamedGeneric(context, obj, name);
} | false | false | false | false | false | 0 |
crush_adjust_straw_bucket_item_weight(struct crush_bucket_straw *bucket, int item, int weight)
{
unsigned idx;
int diff;
int r;
for (idx = 0; idx < bucket->h.size; idx++)
if (bucket->h.items[idx] == item)
break;
if (idx == bucket->h.size)
return 0;
diff = weight - bucket->item_weights[idx];
bucket->item_weights[idx] = weight;
bucket->h.weight += diff;
r = crush_calc_straw(bucket);
if (r < 0)
return r;
return diff;
} | false | false | false | false | false | 0 |
brigade_peek(apr_bucket_brigade *bbIn,
char *buff, apr_size_t bufflen)
{
apr_bucket *b;
apr_size_t readbytes = 0;
if (bufflen--)
/* compensate for NULL */
*buff = '\0';
else
return APR_EGENERAL;
if (APR_BRIGADE_EMPTY(bbIn))
return APR_EGENERAL;
b = APR_BRIGADE_FIRST(bbIn);
while ((b != APR_BRIGADE_SENTINEL(bbIn)) && (readbytes < bufflen)) {
const char *pos;
const char *str;
apr_size_t len;
apr_status_t rv;
if ((rv = apr_bucket_read(b, &str, &len, APR_NONBLOCK_READ))
!= APR_SUCCESS)
return rv;
if ((pos = memchr(str, APR_ASCII_LF, len)) != NULL)
len = pos - str;
if (len > bufflen - readbytes)
len = bufflen - readbytes;
memcpy (buff + readbytes, str, len);
readbytes += len;
buff[readbytes] = '\0';
b = APR_BUCKET_NEXT(b);
}
return APR_SUCCESS;
} | false | true | false | false | false | 1 |
monitor_id_show(struct device *dev,
struct device_attribute *dev_attr, char *buf)
{
struct hv_device *hv_dev = device_to_hv_device(dev);
if (!hv_dev->channel)
return -ENODEV;
return sprintf(buf, "%d\n", hv_dev->channel->offermsg.monitorid);
} | false | false | false | false | false | 0 |
ide_tape_probe(ide_drive_t *drive)
{
idetape_tape_t *tape;
struct gendisk *g;
int minor;
ide_debug_log(IDE_DBG_FUNC, "enter");
if (!strstr(DRV_NAME, drive->driver_req))
goto failed;
if (drive->media != ide_tape)
goto failed;
if ((drive->dev_flags & IDE_DFLAG_ID_READ) &&
ide_check_atapi_device(drive, DRV_NAME) == 0) {
printk(KERN_ERR "ide-tape: %s: not supported by this version of"
" the driver\n", drive->name);
goto failed;
}
tape = kzalloc(sizeof(idetape_tape_t), GFP_KERNEL);
if (tape == NULL) {
printk(KERN_ERR "ide-tape: %s: Can't allocate a tape struct\n",
drive->name);
goto failed;
}
g = alloc_disk(1 << PARTN_BITS);
if (!g)
goto out_free_tape;
ide_init_disk(g, drive);
tape->dev.parent = &drive->gendev;
tape->dev.release = ide_tape_release;
dev_set_name(&tape->dev, "%s", dev_name(&drive->gendev));
if (device_register(&tape->dev))
goto out_free_disk;
tape->drive = drive;
tape->driver = &idetape_driver;
tape->disk = g;
g->private_data = &tape->driver;
drive->driver_data = tape;
mutex_lock(&idetape_ref_mutex);
for (minor = 0; idetape_devs[minor]; minor++)
;
idetape_devs[minor] = tape;
mutex_unlock(&idetape_ref_mutex);
idetape_setup(drive, tape, minor);
device_create(idetape_sysfs_class, &drive->gendev,
MKDEV(IDETAPE_MAJOR, minor), NULL, "%s", tape->name);
device_create(idetape_sysfs_class, &drive->gendev,
MKDEV(IDETAPE_MAJOR, minor + 128), NULL,
"n%s", tape->name);
g->fops = &idetape_block_ops;
ide_register_region(g);
return 0;
out_free_disk:
put_disk(g);
out_free_tape:
kfree(tape);
failed:
return -ENODEV;
} | false | false | false | false | false | 0 |
find_token(char *token)
{
struct lexer_token *tok;
if (!ntokens)
init_ntokens();
tok = bsearch(&token, tokens, ntokens, sizeof(tokens[0]), token_compare);
return tok ? tok->value : 0;
} | false | false | false | false | false | 0 |
print_with_colorv (CutConsoleUI *console, const gchar *color,
gchar const *format, va_list args)
{
if (console->use_color) {
gchar *message;
message = g_strdup_vprintf(format, args);
g_print("%s%s%s", color, message, CUT_CONSOLE_COLOR_NORMAL);
g_free(message);
} else {
g_vprintf(format, args);
}
} | false | false | false | false | false | 0 |
list_common_cmds_help(void)
{
int i, longest = 0;
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
if (longest < strlen(common_cmds[i].name))
longest = strlen(common_cmds[i].name);
}
puts("The most commonly used git commands are:");
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
printf(" %s ", common_cmds[i].name);
mput_char(' ', longest - strlen(common_cmds[i].name));
puts(common_cmds[i].help);
}
} | false | false | false | false | false | 0 |
init(GtkWidget *widget)
{
if (gtk_gl_area_make_current(GTK_GL_AREA(widget))) {
GdkFont *font;
/* set viewport */
glViewport(0,0, widget->allocation.width, widget->allocation.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,widget->allocation.width, 0,widget->allocation.height, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* generate font display lists */
fontbase = glGenLists( 128 );
font = gdk_font_load(fontname);
if (!font) {
g_print("Can't load font '%s'\n", fontname);
gtk_exit(1);
}
gdk_gl_use_gdk_font(font, 0, 128, fontbase);
fontheight = font->ascent+font->descent;
gdk_font_unref(font);
}
return TRUE;
} | false | false | false | true | false | 1 |
has_permission(permission_enum which) const
{
switch (which) {
case perm_print:
return d->doc->okToPrint();
case perm_change:
return d->doc->okToChange();
case perm_copy:
return d->doc->okToCopy();
case perm_add_notes:
return d->doc->okToAddNotes();
case perm_fill_forms:
return d->doc->okToFillForm();
case perm_accessibility:
return d->doc->okToAccessibility();
case perm_assemble:
return d->doc->okToAssemble();
case perm_print_high_resolution:
return d->doc->okToPrintHighRes();
}
return true;
} | false | false | false | false | false | 0 |
gee_concurrent_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareDataFunc compare_func, void* compare_func_target, GDestroyNotify compare_func_target_destroy_notify) {
GeeConcurrentSet * self = NULL;
GCompareDataFunc _tmp0_ = NULL;
void* _tmp0__target = NULL;
GCompareDataFunc _tmp4_ = NULL;
void* _tmp4__target = NULL;
self = (GeeConcurrentSet*) gee_abstract_sorted_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
self->priv->g_type = g_type;
self->priv->g_dup_func = g_dup_func;
self->priv->g_destroy_func = g_destroy_func;
_tmp0_ = compare_func;
_tmp0__target = compare_func_target;
if (_tmp0_ == NULL) {
void* _tmp1_ = NULL;
GDestroyNotify _tmp2_ = NULL;
GCompareDataFunc _tmp3_ = NULL;
_tmp3_ = gee_functions_get_compare_func_for (g_type, &_tmp1_, &_tmp2_);
(compare_func_target_destroy_notify == NULL) ? NULL : (compare_func_target_destroy_notify (compare_func_target), NULL);
compare_func = NULL;
compare_func_target = NULL;
compare_func_target_destroy_notify = NULL;
compare_func = _tmp3_;
compare_func_target = _tmp1_;
compare_func_target_destroy_notify = _tmp2_;
}
_tmp4_ = compare_func;
_tmp4__target = compare_func_target;
(self->priv->_cmp_target_destroy_notify == NULL) ? NULL : (self->priv->_cmp_target_destroy_notify (self->priv->_cmp_target), NULL);
self->priv->_cmp = NULL;
self->priv->_cmp_target = NULL;
self->priv->_cmp_target_destroy_notify = NULL;
self->priv->_cmp = _tmp4_;
self->priv->_cmp_target = _tmp4__target;
self->priv->_cmp_target_destroy_notify = NULL;
(compare_func_target_destroy_notify == NULL) ? NULL : (compare_func_target_destroy_notify (compare_func_target), NULL);
compare_func = NULL;
compare_func_target = NULL;
compare_func_target_destroy_notify = NULL;
return self;
} | false | false | false | false | false | 0 |
rtp_source_class_init (RTPSourceClass * klass)
{
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
gobject_class->finalize = rtp_source_finalize;
gobject_class->set_property = rtp_source_set_property;
gobject_class->get_property = rtp_source_get_property;
g_object_class_install_property (gobject_class, PROP_SSRC,
g_param_spec_uint ("ssrc", "SSRC",
"The SSRC of this source", 0, G_MAXUINT, DEFAULT_SSRC,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_IS_CSRC,
g_param_spec_boolean ("is-csrc", "Is CSRC",
"If this SSRC is acting as a contributing source",
DEFAULT_IS_CSRC, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_IS_VALIDATED,
g_param_spec_boolean ("is-validated", "Is Validated",
"If this SSRC is validated", DEFAULT_IS_VALIDATED,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_IS_SENDER,
g_param_spec_boolean ("is-sender", "Is Sender",
"If this SSRC is a sender", DEFAULT_IS_SENDER,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* RTPSource::sdes
*
* The current SDES items of the source. Returns a structure with name
* application/x-rtp-source-sdes and may contain the following fields:
*
* 'cname' G_TYPE_STRING : The canonical name
* 'name' G_TYPE_STRING : The user name
* 'email' G_TYPE_STRING : The user's electronic mail address
* 'phone' G_TYPE_STRING : The user's phone number
* 'location' G_TYPE_STRING : The geographic user location
* 'tool' G_TYPE_STRING : The name of application or tool
* 'note' G_TYPE_STRING : A notice about the source
*
* other fields may be present and these represent private items in
* the SDES where the field name is the prefix.
*/
g_object_class_install_property (gobject_class, PROP_SDES,
g_param_spec_boxed ("sdes", "SDES",
"The SDES information for this source",
GST_TYPE_STRUCTURE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* RTPSource::stats
*
* The statistics of the source. This property returns a GstStructure with
* name application/x-rtp-source-stats with the following fields:
*
* "ssrc" G_TYPE_UINT The SSRC of this source
* "internal" G_TYPE_BOOLEAN If this source is a source of the session
* "validated" G_TYPE_BOOLEAN If the source is validated
* "received-bye" G_TYPE_BOOLEAN If we received a BYE from this source
* "is-csrc" G_TYPE_BOOLEAN If this source was found as CSRC
* "is-sender" G_TYPE_BOOLEAN If this source is a sender
* "seqnum-base" G_TYPE_INT first seqnum if known
* "clock-rate" G_TYPE_INT the clock rate of the media
*
* The following two fields are only present when known.
*
* "rtp-from" G_TYPE_STRING where we received the last RTP packet from
* "rtcp-from" G_TYPE_STRING where we received the last RTCP packet from
*
* The following fields make sense for internal sources and will only increase
* when "is-sender" is TRUE:
*
* "octets-sent" G_TYPE_UINT64 number of bytes we sent
* "packets-sent" G_TYPE_UINT64 number of packets we sent
*
* The following fields make sense for non-internal sources and will only
* increase when "is-sender" is TRUE.
*
* "octets-received" G_TYPE_UINT64 total number of bytes received
* "packets-received" G_TYPE_UINT64 total number of packets received
*
* Following fields are updated when "is-sender" is TRUE.
*
* "bitrate" G_TYPE_UINT64 bitrate in bits per second
* "jitter" G_TYPE_UINT estimated jitter
* "packets-lost" G_TYPE_INT estimated amount of packets lost
*
* The last SR report this source sent. This only updates when "is-sender" is
* TRUE.
*
* "have-sr" G_TYPE_BOOLEAN the source has sent SR
* "sr-ntptime" G_TYPE_UINT64 ntptime of SR
* "sr-rtptime" G_TYPE_UINT rtptime of SR
* "sr-octet-count" G_TYPE_UINT the number of bytes in the SR
* "sr-packet-count" G_TYPE_UINT the number of packets in the SR
*
* The following fields are only present for non-internal sources and
* represent the content of the last RB packet that was sent to this source.
* These values are only updated when the source is sending.
*
* "sent-rb" G_TYPE_BOOLEAN we have sent an RB
* "sent-rb-fractionlost" G_TYPE_UINT calculated lost fraction
* "sent-rb-packetslost" G_TYPE_INT lost packets
* "sent-rb-exthighestseq" G_TYPE_UINT last seen seqnum
* "sent-rb-jitter" G_TYPE_UINT jitter
* "sent-rb-lsr" G_TYPE_UINT last SR time
* "sent-rb-dlsr" G_TYPE_UINT delay since last SR
*
* The following fields are only present for non-internal sources and
* represents the last RB that this source sent. This is only updated
* when the source is receiving data and sending RB blocks.
*
* "have-rb" G_TYPE_BOOLEAN the source has sent RB
* "rb-fractionlost" G_TYPE_UINT lost fraction
* "rb-packetslost" G_TYPE_INT lost packets
* "rb-exthighestseq" G_TYPE_UINT highest received seqnum
* "rb-jitter" G_TYPE_UINT reception jitter
* "rb-lsr" G_TYPE_UINT last SR time
* "rb-dlsr" G_TYPE_UINT delay since last SR
*
* The round trip of this source. This is calculated from the last RB
* values and the recption time of the last RB packet. Only present for
* non-internal sources.
*
* "rb-round-trip" G_TYPE_UINT the round trip time in nanoseconds
*/
g_object_class_install_property (gobject_class, PROP_STATS,
g_param_spec_boxed ("stats", "Stats",
"The stats of this source", GST_TYPE_STRUCTURE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROBATION,
g_param_spec_uint ("probation", "Number of probations",
"Consecutive packet sequence numbers to accept the source",
0, G_MAXUINT, DEFAULT_PROBATION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
GST_DEBUG_CATEGORY_INIT (rtp_source_debug, "rtpsource", 0, "RTP Source");
} | false | false | false | false | false | 0 |
setContext(XML_Parser parser, const XML_Char *context)
{
DTD * const dtd = _dtd; /* save one level of indirection */
const XML_Char *s = context;
while (*context != XML_T('\0')) {
if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
ENTITY *e;
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
e = (ENTITY *)lookup(&dtd->generalEntities, poolStart(&tempPool), 0);
if (e)
e->open = XML_TRUE;
if (*s != XML_T('\0'))
s++;
context = s;
poolDiscard(&tempPool);
}
else if (*s == XML_T(ASCII_EQUALS)) {
PREFIX *prefix;
if (poolLength(&tempPool) == 0)
prefix = &dtd->defaultPrefix;
else {
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&tempPool),
sizeof(PREFIX));
if (!prefix)
return XML_FALSE;
if (prefix->name == poolStart(&tempPool)) {
prefix->name = poolCopyString(&dtd->pool, prefix->name);
if (!prefix->name)
return XML_FALSE;
}
poolDiscard(&tempPool);
}
for (context = s + 1;
*context != CONTEXT_SEP && *context != XML_T('\0');
context++)
if (!poolAppendChar(&tempPool, *context))
return XML_FALSE;
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
if (addBinding(parser, prefix, NULL, poolStart(&tempPool),
&inheritedBindings) != XML_ERROR_NONE)
return XML_FALSE;
poolDiscard(&tempPool);
if (*context != XML_T('\0'))
++context;
s = context;
}
else {
if (!poolAppendChar(&tempPool, *s))
return XML_FALSE;
s++;
}
}
return XML_TRUE;
} | false | false | false | false | false | 0 |
rescan_shortcut_cb (GtkMenuItem *item,
NemoPlacesSidebar *sidebar)
{
GtkTreeIter iter;
GDrive *drive;
if (!get_selected_iter (sidebar, &iter)) {
return;
}
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store), &iter,
PLACES_SIDEBAR_COLUMN_DRIVE, &drive,
-1);
if (drive != NULL) {
g_drive_poll_for_media (drive, NULL, drive_poll_for_media_cb, NULL);
}
g_object_unref (drive);
} | false | false | false | false | false | 0 |
ExpandResponseFile(const char *FName, StringSaver &Saver,
TokenizerCallback Tokenizer,
SmallVectorImpl<const char *> &NewArgv,
bool MarkEOLs = false) {
ErrorOr<std::unique_ptr<MemoryBuffer>> MemBufOrErr =
MemoryBuffer::getFile(FName);
if (!MemBufOrErr)
return false;
MemoryBuffer &MemBuf = *MemBufOrErr.get();
StringRef Str(MemBuf.getBufferStart(), MemBuf.getBufferSize());
// If we have a UTF-16 byte order mark, convert to UTF-8 for parsing.
ArrayRef<char> BufRef(MemBuf.getBufferStart(), MemBuf.getBufferEnd());
std::string UTF8Buf;
if (hasUTF16ByteOrderMark(BufRef)) {
if (!convertUTF16ToUTF8String(BufRef, UTF8Buf))
return false;
Str = StringRef(UTF8Buf);
}
// If we see UTF-8 BOM sequence at the beginning of a file, we shall remove
// these bytes before parsing.
// Reference: http://en.wikipedia.org/wiki/UTF-8#Byte_order_mark
else if (hasUTF8ByteOrderMark(BufRef))
Str = StringRef(BufRef.data() + 3, BufRef.size() - 3);
// Tokenize the contents into NewArgv.
Tokenizer(Str, Saver, NewArgv, MarkEOLs);
return true;
} | false | false | false | false | false | 0 |
cl_thread_cleanup(cl_thread_settings_t* thread_config) {
/* free all malloc()'ed pointers in cl_thread_settings_t structure */
int ret_val;
/* on CL_RETVAL_MUTEX_CLEANUP_ERROR or CL_RETVAL_CONDITION_CLEANUP_ERROR
the struct is NOT freed !!! */
if (thread_config == NULL) {
return CL_RETVAL_PARAMS;
}
if (thread_config->thread_event_condition != NULL) {
ret_val = cl_thread_delete_thread_condition(&(thread_config->thread_event_condition));
if (ret_val != CL_RETVAL_OK) {
return ret_val;
}
}
if (thread_config->thread_startup_condition != NULL) {
ret_val = cl_thread_delete_thread_condition(&(thread_config->thread_startup_condition));
if (ret_val != CL_RETVAL_OK) {
return ret_val;
}
}
if (thread_config->thread_name) {
CL_LOG_STR(CL_LOG_DEBUG,"cleanup for thread ->", thread_config->thread_name);
}
/* destroy thread name */
if (thread_config->thread_name) {
free(thread_config->thread_name);
thread_config->thread_name = NULL;
}
/* destroy thread_pointer */
if (thread_config->thread_pointer) {
free(thread_config->thread_pointer);
thread_config->thread_pointer = NULL;
}
return CL_RETVAL_OK;
} | false | false | false | false | false | 0 |
bufferevent_get_options_(struct bufferevent *bev)
{
struct bufferevent_private *bev_p =
EVUTIL_UPCAST(bev, struct bufferevent_private, bev);
enum bufferevent_options options;
BEV_LOCK(bev);
options = bev_p->options;
BEV_UNLOCK(bev);
return options;
} | false | false | false | false | false | 0 |
SimplifyPHINode(PHINode *PN, const DominatorTree *DT) {
// If all of the PHI's incoming values are the same then replace the PHI node
// with the common value.
Value *CommonValue = 0;
bool HasUndefInput = false;
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
Value *Incoming = PN->getIncomingValue(i);
// If the incoming value is the phi node itself, it can safely be skipped.
if (Incoming == PN) continue;
if (isa<UndefValue>(Incoming)) {
// Remember that we saw an undef value, but otherwise ignore them.
HasUndefInput = true;
continue;
}
if (CommonValue && Incoming != CommonValue)
return 0; // Not the same, bail out.
CommonValue = Incoming;
}
// If CommonValue is null then all of the incoming values were either undef or
// equal to the phi node itself.
if (!CommonValue)
return UndefValue::get(PN->getType());
// If we have a PHI node like phi(X, undef, X), where X is defined by some
// instruction, we cannot return X as the result of the PHI node unless it
// dominates the PHI block.
if (HasUndefInput)
return ValueDominatesPHI(CommonValue, PN, DT) ? CommonValue : 0;
return CommonValue;
} | false | false | false | false | false | 0 |
_releaseListener(void)
{
if (!m_pViewListener)
return;
DELETEP(m_pViewListener);
m_pViewListener = 0;
m_lid = 0;
} | false | false | false | false | false | 0 |
onListClicked(FXObject*,FXSelector sel,void* ptr){
button->handle(this,FXSEL(SEL_COMMAND,ID_UNPOST),NULL);
if(FXSELTYPE(sel)==SEL_COMMAND){
field->setText(list->getItemText((FXint)(FXival)ptr));
if(!(options&COMBOBOX_STATIC)) field->selectAll(); // Select if editable
if(target) target->tryHandle(this,FXSEL(SEL_COMMAND,message),(void*)getText().text());
}
return 1;
} | false | false | false | false | false | 0 |
tbm_union(TIDBitmap *a, const TIDBitmap *b)
{
Assert(!a->iterating);
/* Nothing to do if b is empty */
if (b->nentries == 0)
return;
/* Scan through chunks and pages in b, merge into a */
if (b->status == TBM_ONE_PAGE)
tbm_union_page(a, &b->entry1);
else
{
HASH_SEQ_STATUS status;
PagetableEntry *bpage;
Assert(b->status == TBM_HASH);
hash_seq_init(&status, b->pagetable);
while ((bpage = (PagetableEntry *) hash_seq_search(&status)) != NULL)
tbm_union_page(a, bpage);
}
} | false | false | false | false | false | 0 |
impFileIsExpImp(
IF_FileHdl * pFileHdl,
FLMBOOL * pbFileIsBinaryRV)
{
RCODE rc = FERR_OK;
FLMUINT64 ui64CurrPos;
FLMBYTE byHeader[ BINARY_GED_HEADER_LEN];
FLMUINT uiBytesRead;
*pbFileIsBinaryRV = FALSE;
// Save current position so we can return to it.
if (RC_BAD( rc = pFileHdl->seek( 0, FLM_IO_SEEK_CUR, &ui64CurrPos)))
{
goto Exit;
}
// Read the file's header information.
if (RC_BAD( rc = pFileHdl->read( (FLMUINT) 0, BINARY_GED_HEADER_LEN,
byHeader, &uiBytesRead)))
{
if (rc == FERR_IO_END_OF_FILE)
{
uiBytesRead = 0;
rc = FERR_OK;
}
else
{
goto Exit;
}
}
if ((uiBytesRead == BINARY_GED_HEADER_LEN) &&
((f_memcmp( byHeader, FlmBinaryGedHeader, BINARY_GED_HEADER_LEN) == 0) ||
(f_memcmp( byHeader, FlmBinaryRecHeader, BINARY_GED_HEADER_LEN) == 0)))
{
*pbFileIsBinaryRV = TRUE;
}
// Reset the file position to where it was before.
rc = pFileHdl->seek( ui64CurrPos, FLM_IO_SEEK_SET);
Exit:
return (rc);
} | false | false | false | false | false | 0 |
iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
if (state)
set_bit(STATUS_RF_KILL_HW, &priv->status);
else
clear_bit(STATUS_RF_KILL_HW, &priv->status);
wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
return false;
} | false | false | false | false | false | 0 |
msn_buddy_allow_response(MsnAccount *ma, int error, void *cbdata)
{
/* TODO Check for validity of response */
char *url = strdup("https://contacts.msn.com/abservice/abservice.asmx");
char *soap_action =
"http://www.msn.com/webservices/AddressBook/ABContactAdd";
MsnBuddy *bud = cbdata;
char passport_tag[512];
if (bud->type == MSN_BUDDY_PASSPORT)
snprintf(passport_tag, sizeof(passport_tag),
PASSPORT_CONTACT_INFO, bud->passport,
bud->friendlyname);
else
snprintf(passport_tag, sizeof(passport_tag), EMAIL_CONTACT_INFO,
bud->passport);
char *ab_request = msn_soap_build_request(MSN_CONTACT_ADD_REQUEST,
"ContactSave",
ma->contact_ticket,
passport_tag,
bud->friendlyname);
msn_http_request(ma, MSN_HTTP_POST, soap_action, url, ab_request,
msn_contact_add_response, NULL, bud);
free(url);
free(ab_request);
} | false | false | false | false | false | 0 |
cq_periodic_trampoline(cqueue_t *cq, void *data)
{
cperiodic_t *cp = data;
bool reschedule;
cqueue_check(cq);
cperiodic_check(cp);
cp->ev = NULL;
/*
* As long as the periodic event returns TRUE, keep scheduling it.
*
* To handle synchronous calls to cq_periodic_remove(), freeing of the
* periodic event is deferred until we come back from the user call.
*/
reschedule = (*cp->event)(cp->arg);
if (cp->to_free || !reschedule) {
cq_periodic_free(cp, TRUE);
} else {
cp->ev = cq_insert(cq, cp->period, cq_periodic_trampoline, cp);
}
} | false | false | false | false | false | 0 |
dm_config_get_uint64(const struct dm_config_node *cn, const char *path,
uint64_t *result)
{
const struct dm_config_node *n;
n = _find_config_node(cn, path);
if (!n || !n->v || n->v->type != DM_CFG_INT)
return 0;
if (result)
*result = (uint64_t) n->v->v.i;
return 1;
} | false | false | false | false | false | 0 |
wakeup_graph_entry(struct ftrace_graph_ent *trace)
{
struct trace_array *tr = wakeup_trace;
struct trace_array_cpu *data;
unsigned long flags;
int pc, ret = 0;
if (!func_prolog_preempt_disable(tr, &data, &pc))
return 0;
local_save_flags(flags);
ret = __trace_graph_entry(tr, trace, flags, pc);
atomic_dec(&data->disabled);
preempt_enable_notrace();
return ret;
} | false | false | false | false | false | 0 |
Remove(Address code_address) {
HashMap::Entry* entry = FindEntry(code_address);
if (entry != NULL) {
DeleteArray(static_cast<char*>(entry->value));
RemoveEntry(entry);
}
} | false | false | false | false | false | 0 |
p_radio_flip_both_callback(GtkWidget *widget, GapStbPropWidget *pw)
{
if(GTK_TOGGLE_BUTTON (widget)->active)
{
p_radio_flip_update(pw, GAP_STB_FLIP_BOTH);
}
} | false | false | false | false | false | 0 |
connection_destroy(DBusConnection *conn, void *user_data)
{
struct network_conn *nc = user_data;
if (nc->state == CONNECTED) {
bnep_if_down(nc->dev);
bnep_kill_connection(&nc->peer->dst);
} else if (nc->io)
cancel_connection(nc, NULL);
} | false | false | false | false | false | 0 |
gvrender_ptf_A(GVJ_t * job, pointf * af, pointf * AF, int n)
{
int i;
double t;
pointf translation, scale;
translation = job->translation;
scale.x = job->zoom * job->devscale.x;
scale.y = job->zoom * job->devscale.y;
if (job->rotation) {
for (i = 0; i < n; i++) {
t = -(af[i].y + translation.y) * scale.x;
AF[i].y = (af[i].x + translation.x) * scale.y;
AF[i].x = t;
}
} else {
for (i = 0; i < n; i++) {
AF[i].x = (af[i].x + translation.x) * scale.x;
AF[i].y = (af[i].y + translation.y) * scale.y;
}
}
return AF;
} | false | false | false | false | false | 0 |
connection_mark_all_noncontrol_connections(void)
{
SMARTLIST_FOREACH_BEGIN(get_connection_array(), connection_t *, conn) {
if (conn->marked_for_close)
continue;
switch (conn->type) {
case CONN_TYPE_CPUWORKER:
case CONN_TYPE_CONTROL_LISTENER:
case CONN_TYPE_CONTROL:
break;
case CONN_TYPE_AP:
connection_mark_unattached_ap(TO_ENTRY_CONN(conn),
END_STREAM_REASON_HIBERNATING);
break;
default:
connection_mark_for_close(conn);
break;
}
} SMARTLIST_FOREACH_END(conn);
} | false | false | false | false | false | 0 |
svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
uint32_t bit_cache;
uint8_t *list[63];
uint32_t *dst;
const uint32_t *codebook;
int entries[6];
int i, j, m, n;
int mean, stages;
unsigned x, y, width, height, level;
uint32_t n1, n2, n3, n4;
/* initialize list for breadth first processing of vectors */
list[0] = pixels;
/* recursively process vector */
for (i=0, m=1, n=1, level=5; i < n; i++) {
SVQ1_PROCESS_VECTOR();
/* destination address and vector size */
dst = (uint32_t *) list[i];
width = 1 << ((4 + level) /2);
height = 1 << ((3 + level) /2);
/* get number of stages (-1 skips vector, 0 for mean only) */
stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
if (stages == -1) {
for (y=0; y < height; y++) {
memset (&dst[y*(pitch / 4)], 0, width);
}
continue; /* skip vector */
}
if ((stages > 0) && (level >= 4)) {
#ifdef DEBUG_SVQ1
av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
#endif
return -1; /* invalid vector */
}
mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
if (stages == 0) {
for (y=0; y < height; y++) {
memset (&dst[y*(pitch / 4)], mean, width);
}
} else {
SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
SVQ1_DO_CODEBOOK_INTRA()
}
}
return 0;
} | false | false | false | false | false | 0 |
atom_getfloatarg(int which, int argc, t_atom *argv)
{
if (argc <= which) return (0);
argv += which;
if (argv->a_type == A_FLOAT) return (argv->a_w.w_float);
else return (0);
} | false | false | false | false | false | 0 |
reopen (res_state statp, int *terrno, int ns)
{
if (EXT(statp).nssocks[ns] == -1) {
struct sockaddr *nsap
= (struct sockaddr *) EXT(statp).nsaddrs[ns];
socklen_t slen;
/* only try IPv6 if IPv6 NS and if not failed before */
if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
#ifdef SOCK_NONBLOCK
if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
0);
#ifndef __ASSUME_SOCK_CLOEXEC
if (__have_o_nonblock == 0)
__have_o_nonblock
= (EXT(statp).nssocks[ns] == -1
&& errno == EINVAL ? -1 : 1);
#endif
}
if (__builtin_expect (__have_o_nonblock < 0, 0))
#endif
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM, 0);
if (EXT(statp).nssocks[ns] < 0)
statp->ipv6_unavail = errno == EAFNOSUPPORT;
slen = sizeof (struct sockaddr_in6);
} else if (nsap->sa_family == AF_INET) {
#ifdef SOCK_NONBLOCK
if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
0);
#ifndef __ASSUME_SOCK_CLOEXEC
if (__have_o_nonblock == 0)
__have_o_nonblock
= (EXT(statp).nssocks[ns] == -1
&& errno == EINVAL ? -1 : 1);
#endif
}
if (__builtin_expect (__have_o_nonblock < 0, 0))
#endif
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM, 0);
slen = sizeof (struct sockaddr_in);
}
if (EXT(statp).nssocks[ns] < 0) {
*terrno = errno;
Perror(statp, stderr, "socket(dg)", errno);
return (-1);
}
/*
* On a 4.3BSD+ machine (client and server,
* actually), sending to a nameserver datagram
* port with no nameserver will cause an
* ICMP port unreachable message to be returned.
* If our datagram socket is "connected" to the
* server, we get an ECONNREFUSED error on the next
* socket operation, and select returns if the
* error message is received. We can thus detect
* the absence of a nameserver without timing out.
*/
if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) {
Aerror(statp, stderr, "connect(dg)", errno, nsap);
__res_iclose(statp, false);
return (0);
}
#ifdef SOCK_NONBLOCK
if (__builtin_expect (__have_o_nonblock < 0, 0)) {
#else
{
#endif
/* Make socket non-blocking. */
int fl = __fcntl (EXT(statp).nssocks[ns], F_GETFL);
if (fl != -1)
__fcntl (EXT(statp).nssocks[ns], F_SETFL,
fl | O_NONBLOCK);
Dprint(statp->options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
}
}
return 1;
} | false | false | false | false | false | 0 |
li_allocate(void *ptr, size_t count, size_t size) {
if (ptr)
ptr = realloc(ptr, count*size);
else
ptr = calloc(count, size);
if (!ptr)
li_error("out of memory", li_null);
return ptr;
} | false | false | false | false | true | 1 |
gst_mpeg2dec_close (GstVideoDecoder * decoder)
{
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
if (mpeg2dec->decoder) {
mpeg2_close (mpeg2dec->decoder);
mpeg2dec->decoder = NULL;
mpeg2dec->info = NULL;
}
gst_mpeg2dec_clear_buffers (mpeg2dec);
return TRUE;
} | false | false | false | false | false | 0 |
gm_world_text_view_update_tags(GmWorldTextView *view) {
gint i;
for (i = 0; i < (int)(sizeof(ansi_colors) / sizeof(ansinamepair)); i++) {
gm_world_text_view_update_color_tag(view, ansi_colors[i].name, NULL);
}
/*
tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(
GM_WORLD_TEXT_VIEW_BUFFER(view)), "bold");
if (gm_color_table_bold(view->priv->color_table)) {
g_object_set(G_OBJECT(tag), "weight", PANGO_WEIGHT_NORMAL, NULL);
} else {
g_object_set(G_OBJECT(tag), "weight", PANGO_WEIGHT_ULTRABOLD, NULL);
}*/
} | false | false | false | false | false | 0 |
verify_node_count(const char *arg, int *min_nodes, int *max_nodes)
{
char *ptr, *min_str, *max_str;
char *leftover;
/* Does the string contain a "-" character? If so, treat as a range.
* otherwise treat as an absolute node count. */
if ((ptr = index(arg, '-')) != NULL) {
min_str = xstrndup(arg, ptr-arg);
*min_nodes = _str_to_nodes(min_str, &leftover);
if (!xstring_is_whitespace(leftover)) {
error("\"%s\" is not a valid node count", min_str);
xfree(min_str);
return false;
}
xfree(min_str);
#ifdef HAVE_ALPS_CRAY
if (*min_nodes < 0) {
#else
if (*min_nodes == 0) {
#endif
*min_nodes = 1;
}
max_str = xstrndup(ptr+1, strlen(arg)-((ptr+1)-arg));
*max_nodes = _str_to_nodes(max_str, &leftover);
if (!xstring_is_whitespace(leftover)) {
error("\"%s\" is not a valid node count", max_str);
xfree(max_str);
return false;
}
xfree(max_str);
} else {
*min_nodes = *max_nodes = _str_to_nodes(arg, &leftover);
if (!xstring_is_whitespace(leftover)) {
error("\"%s\" is not a valid node count", arg);
return false;
}
#ifdef HAVE_ALPS_CRAY
if (*min_nodes < 0) {
#else
if (*min_nodes == 0) {
#endif
/* whitespace does not a valid node count make */
error("\"%s\" is not a valid node count", arg);
return false;
}
}
if ((*max_nodes != 0) && (*max_nodes < *min_nodes)) {
error("Maximum node count %d is less than"
" minimum node count %d",
*max_nodes, *min_nodes);
return false;
}
return true;
} | false | false | false | false | false | 0 |
gathershadings(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
pdf_obj *shade;
pdf_obj *type;
int k;
shade = pdf_dict_get_val(dict, i);
if (!pdf_is_dict(shade))
{
fz_warn(ctx, "not a shading dict (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
continue;
}
type = pdf_dict_gets(shade, "ShadingType");
if (!pdf_is_int(type) || pdf_to_int(type) < 1 || pdf_to_int(type) > 7)
{
fz_warn(ctx, "not a shading type (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
type = NULL;
}
for (k = 0; k < shadings; k++)
if (!pdf_objcmp(shading[k].u.shading.obj, shade))
break;
if (k < shadings)
continue;
shading = fz_resize_array(ctx, shading, shadings+1, sizeof(struct info));
shadings++;
shading[shadings - 1].page = page;
shading[shadings - 1].pageref = pageref;
shading[shadings - 1].pageobj = pageobj;
shading[shadings - 1].u.shading.obj = shade;
shading[shadings - 1].u.shading.type = type;
}
} | false | false | false | false | false | 0 |
zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */
{
zend_trait_alias *alias, **alias_ptr;
alias_ptr = ce->trait_aliases;
alias = *alias_ptr;
while (alias) {
if (alias->alias_len == len &&
!strncasecmp(name, alias->alias, alias->alias_len)) {
return alias->alias;
}
alias_ptr++;
alias = *alias_ptr;
}
return name;
} | false | false | false | false | false | 0 |
markChange(int pos)
{
if (pos < m_changePos) {
m_backs += getSeqSteps(pos, m_changePos-1);
m_changePos = pos;
}
} | false | false | false | false | false | 0 |
ntfs_mkfs(cdico *d, char *partition, char *fsoptions)
{
char command[2048];
char buffer[2048];
char options[2048];
int exitst;
u64 temp64;
u32 temp32;
u16 temp16;
// there is no option that just displays the version and return 0 in mkfs.ntfs
if (exec_command(command, sizeof(command), NULL, NULL, 0, NULL, 0, "mkfs.ntfs")!=0)
{ errprintf("mkfs.ntfs not found. please install ntfsprogs-2.0.0 on your system or check the PATH.\n");
return -1;
}
// ---- set the advanced filesystem settings from the dico
memset(options, 0, sizeof(options));
strlcatf(options, sizeof(options), " %s ", fsoptions);
if (dico_get_string(d, 0, FSYSHEADKEY_FSLABEL, buffer, sizeof(buffer))==0 && strlen(buffer)>0)
strlcatf(options, sizeof(options), " --label '%s' ", buffer);
if (dico_get_u16(d, 0, FSYSHEADKEY_NTFSSECTORSIZE, &temp16)==0)
strlcatf(options, sizeof(options), " -s %ld ", (long)temp16);
if (dico_get_u32(d, 0, FSYSHEADKEY_NTFSCLUSTERSIZE, &temp32)==0)
strlcatf(options, sizeof(options), " -c %ld ", (long)temp32);
if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "mkfs.ntfs -f %s %s", partition, options)!=0 || exitst!=0)
{ errprintf("command [%s] failed\n", command);
return -1;
}
// ---- preserve ntfs uuid (attribute saved only with fsarchiver>=0.5.8)
if (dico_get_u64(d, 0, FSYSHEADKEY_NTFSUUID, &temp64)==0)
ntfs_replace_uuid(partition, cpu_to_le64(temp64));
return 0;
} | true | true | false | false | false | 1 |
ParseUnixCommandLine(FILE *in, int acmax, char **av)
{
register int c;
register char *p = commandline;
register int n = 1;
char *limit = p + MAX_PARAM_CHAR;
limit[1] = 0;
av[1] = p;
*p = 0;
do c = fgetc(in); while(MagickIsBlank(c));
while (c != EOF)
{
switch (c)
{
case '\'':
while((c = fgetc(in)) != '\'')
{
if (p >= limit )
{
while ((c = fgetc(in)) != '\n');
return 0;
}
*p++ = c;
}
break;
case '"':
while((c = fgetc(in)) != '"')
{
if (c == '\\')
{
int next = fgetc(in);
if (next != '\\' && next != '"')
*p++ = c;
c = next;
}
if (p >= limit )
{
while ((c = fgetc(in)) != '\n');
return 0;
}
*p++ = c;
}
break;
case ' ':
case '\t':
*p++ = '\0';
if (++n > acmax)
{
while ((c = fgetc(in)) != '\n');
return acmax+1;
}
av[n] = p;
*p = 0;
do { c = fgetc(in); }
while(MagickIsBlank(c));
continue;
case '\r':
break;
case '#':
while ((c = fgetc(in)) != '\n');
case '\n':
*p = 0;
n = av[n][0] ? n+1 : n;
av[n] = (char *)NULL;
return n;
case '\\':
c = fgetc(in);
default:
if (p >= limit )
{
while ((c = fgetc(in)) != '\n');
return 0;
}
*p++ = c;
break;
}
c = fgetc(in);
}
return EOF;
} | false | true | false | false | true | 1 |
visu_surfaces_createFromScalarField(VisuSurfaces **surf,
VisuScalarField *field,
double isoValue, int id,
const gchar *name)
{
/* Local variables*/
gboolean status;
/* Routine code*/
switch (visu_scalar_field_getMeshtype(field))
{
case VISU_SCALAR_FIELD_MESH_UNIFORM:
status = create_fromSF_uniform (surf, field, isoValue, id, name);
break;
case VISU_SCALAR_FIELD_MESH_NON_UNIFORM:
status = create_fromSF_nonuniform(surf, field, isoValue, id, name);
break;
default:
g_warning("Wrong value for 'meshtype'.");
return FALSE;
}
return status;
} | false | false | false | false | false | 0 |
change_listen_mode(int new_mode)
{
log1("Entering listen mode: %s",
new_mode != LISTEN_NONE
? (new_mode == LISTEN_KERNEL ? "kernel" : "raw")
: "none"
);
listen_mode = new_mode;
if (sockfd >= 0) {
close(sockfd);
sockfd = -1;
}
if (new_mode == LISTEN_KERNEL)
sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface);
else if (new_mode != LISTEN_NONE)
sockfd = udhcp_raw_socket(client_config.ifindex);
/* else LISTEN_NONE: sockfd stays closed */
} | false | false | false | false | false | 0 |
gf_term_play_from_time(GF_Terminal *term, u64 from_time, u32 pause_at_first_frame)
{
if (!term || !term->root_scene || !term->root_scene->root_od) return 0;
if (term->root_scene->root_od->flags & GF_ODM_NO_TIME_CTRL) return 1;
if (pause_at_first_frame==2) {
if (gf_term_get_option(term, GF_OPT_PLAY_STATE) != GF_STATE_PLAYING)
pause_at_first_frame = 1;
else
pause_at_first_frame = 0;
}
/*for dynamic scene OD ressources are static and all object use the same clock, so don't restart the root
OD, just act as a mediaControl on all playing streams*/
if (term->root_scene->is_dynamic_scene) {
/*exit pause mode*/
gf_term_set_play_state(term, GF_STATE_PLAYING, 1, 1);
if (pause_at_first_frame)
gf_term_set_play_state(term, GF_STATE_STEP_PAUSE, 0, 0);
gf_sc_lock(term->compositor, 1);
gf_scene_restart_dynamic(term->root_scene, from_time);
gf_sc_lock(term->compositor, 0);
return 2;
}
/*pause everything*/
gf_term_set_play_state(term, GF_STATE_PAUSED, 0, 1);
/*stop root*/
gf_odm_stop(term->root_scene->root_od, 1);
gf_scene_disconnect(term->root_scene, 0);
/*make sure we don't have OD queued*/
while (gf_list_count(term->media_queue)) gf_list_rem(term->media_queue, 0);
term->root_scene->root_od->media_start_time = from_time;
gf_odm_start(term->root_scene->root_od, 0);
gf_term_set_play_state(term, GF_STATE_PLAYING, 0, 1);
if (pause_at_first_frame)
gf_sc_set_option(term->compositor, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);
return 2;
} | false | false | false | false | false | 0 |
AlterTable(AlterTableStmt *stmt)
{
Relation rel;
LOCKMODE lockmode = AlterTableGetLockLevel(stmt->cmds);
/*
* Acquire same level of lock as already acquired during parsing.
*/
rel = relation_openrv(stmt->relation, lockmode);
CheckTableNotInUse(rel, "ALTER TABLE");
/* Check relation type against type specified in the ALTER command */
switch (stmt->relkind)
{
case OBJECT_TABLE:
/*
* For mostly-historical reasons, we allow ALTER TABLE to apply to
* almost all relation types.
*/
if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE
|| rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table",
RelationGetRelationName(rel))));
break;
case OBJECT_INDEX:
if (rel->rd_rel->relkind != RELKIND_INDEX)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not an index",
RelationGetRelationName(rel))));
break;
case OBJECT_SEQUENCE:
if (rel->rd_rel->relkind != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
RelationGetRelationName(rel))));
break;
case OBJECT_TYPE:
if (rel->rd_rel->relkind != RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a composite type",
RelationGetRelationName(rel))));
break;
case OBJECT_VIEW:
if (rel->rd_rel->relkind != RELKIND_VIEW)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a view",
RelationGetRelationName(rel))));
break;
case OBJECT_FOREIGN_TABLE:
if (rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a foreign table",
RelationGetRelationName(rel))));
break;
default:
elog(ERROR, "unrecognized object type: %d", (int) stmt->relkind);
}
ATController(rel, stmt->cmds, interpretInhOption(stmt->relation->inhOpt),
lockmode);
} | false | false | false | false | false | 0 |
gfire_clan_get_name(const gfire_clan *p_clan)
{
if(!p_clan)
return NULL;
if(p_clan->short_name)
return g_strdup_printf("%s [%s]", p_clan->long_name, p_clan->short_name);
else
return g_strdup(p_clan->long_name);
} | false | false | false | false | false | 0 |
_deleteFmtMarkWithNotify(PT_DocPosition dpos, pf_Frag_FmtMark * pffm,
pf_Frag_Strux * pfs,
pf_Frag ** ppfEnd, UT_uint32 * pfragOffsetEnd)
{
UT_return_val_if_fail (m_pts==PTS_Editing,false);
UT_return_val_if_fail (pfs,false);
PT_BlockOffset blockOffset = _computeBlockOffset(pfs,pffm);
PX_ChangeRecord_FmtMark * pcr
= new PX_ChangeRecord_FmtMark(PX_ChangeRecord::PXT_DeleteFmtMark,
dpos, pffm->getIndexAP(), blockOffset);
UT_return_val_if_fail (pcr,false);
// actually remove the fragment from the list and delete it.
_deleteFmtMark(pffm,ppfEnd,pfragOffsetEnd);
m_history.addChangeRecord(pcr);
m_pDocument->notifyListeners(pfs,pcr);
return true;
} | false | false | false | false | false | 0 |
strnrchr(const char * stop, char c, unsigned int size)
{
const char * i = stop + size - 1;
--stop;
while (i != stop) {
if (*i == c)
return i;
--i;
}
return 0;
} | false | false | false | false | false | 0 |
SearchCollection(default_collection_t *collection, char *name)
{
int i;
for (i=0; i<collection->numdefaults; ++i)
{
if (!strcmp(name, collection->defaults[i].name))
{
return &collection->defaults[i];
}
}
return NULL;
} | false | false | false | false | false | 0 |
etpan_mailbox_write(FILE * f, int * col,
struct mailimf_mailbox * mb)
{
int r;
if (* col > 1) {
if (* col + strlen(mb->mb_addr_spec) >= MAX_MAIL_COL) {
r = mailimf_string_write(f, col, "\r\n ", 3);
if (r != MAILIMF_NO_ERROR)
return ERROR_FILE;
* col = 1;
}
}
if (mb->mb_display_name) {
char * decoded_from;
size_t cur_token;
cur_token = 0;
r = mailmime_encoded_phrase_parse(DEST_CHARSET,
mb->mb_display_name, strlen(mb->mb_display_name),
&cur_token, DEST_CHARSET,
&decoded_from);
if (r != MAILIMF_NO_ERROR) {
decoded_from = strdup(mb->mb_display_name);
if (decoded_from == NULL)
return ERROR_MEMORY;
}
r = mailimf_quoted_string_write(f, col, decoded_from,
strlen(decoded_from));
if (r != MAILIMF_NO_ERROR) {
free(decoded_from);
return ERROR_FILE;
}
if (* col > 1) {
if (* col + strlen(decoded_from) + 3 >= MAX_MAIL_COL) {
r = mailimf_string_write(f, col, "\r\n ", 3);
if (r != MAILIMF_NO_ERROR) {
free(decoded_from);
return r;
}
* col = 1;
}
}
free(decoded_from);
r = mailimf_string_write(f, col, " <", 2);
if (r != MAILIMF_NO_ERROR)
return ERROR_FILE;
r = mailimf_string_write(f, col,
mb->mb_addr_spec, strlen(mb->mb_addr_spec));
if (r != MAILIMF_NO_ERROR)
return ERROR_FILE;
r = mailimf_string_write(f, col, ">", 1);
if (r != MAILIMF_NO_ERROR)
return ERROR_FILE;
}
else {
r = mailimf_string_write(f, col,
mb->mb_addr_spec, strlen(mb->mb_addr_spec));
if (r != MAILIMF_NO_ERROR)
return ERROR_FILE;
}
return NO_ERROR;
} | false | false | false | false | false | 0 |
isl_compute_flow_schedule_data_clear(
struct isl_compute_flow_schedule_data *data)
{
int i;
for (i = 0; i < data->n_sink; ++i) {
isl_map_free(data->sink[i].access);
isl_schedule_node_free(data->sink[i].node);
}
for (i = 0; i < data->n_source; ++i) {
isl_map_free(data->source[i].access);
isl_schedule_node_free(data->source[i].node);
}
free(data->sink);
} | false | false | false | false | true | 1 |
FormatStr(std::ostream &os, const char *name, const std::string &str)
{
ios_format_state state(os);
if( str.size() ) {
os << " " << setw(20) << name;
os << ": " << str << "\n";
}
} | false | false | false | false | false | 0 |
rv6xx_set_sw_voltage_to_low(struct radeon_device *rdev,
struct radeon_ps *old_ps)
{
struct rv6xx_ps *old_state = rv6xx_get_ps(old_ps);
rv6xx_program_voltage_stepping_entry(rdev, R600_POWER_LEVEL_CTXSW,
old_state->low.vddc);
WREG32_P(GENERAL_PWRMGT, SW_GPIO_INDEX(R600_POWER_LEVEL_CTXSW),
~SW_GPIO_INDEX_MASK);
} | false | false | false | false | false | 0 |
__add_alarm(struct alarm_block *alarm)
{
struct rb_node **new = &(alarm_root.rb_node);
struct rb_node *parent = NULL;
while (*new) {
struct alarm_block *this;
this = container_of(*new, struct alarm_block, node);
parent = *new;
if (timercmp(&alarm->tv, &this->tv, <))
new = &((*new)->rb_left);
else
new = &((*new)->rb_right);
}
rb_link_node(&alarm->node, parent, new);
rb_insert_color(&alarm->node, &alarm_root);
} | false | false | false | false | false | 0 |
get_exons(GtArray *exon_ranges, const void *sa)
{
GtSSplicedAlignment *alignment = *(GtSSplicedAlignment**) sa;
GtRange exon;
unsigned long i;
gt_assert(alignment);
for (i = 0; i < gt_sspliced_alignment_num_of_exons(alignment); i++) {
exon = gt_sspliced_alignment_get_exon(alignment, i);
gt_array_add(exon_ranges, exon);
}
} | false | false | false | false | false | 0 |
book_view_objects_removed_cb (EBookClientView *client_view,
const GSList *slist,
EBookView *book_view)
{
GList *list = NULL;
/* XXX Never use GSList in a public API. */
for (; slist != NULL; slist = g_slist_next (slist))
list = g_list_prepend (list, slist->data);
list = g_list_reverse (list);
g_signal_emit (book_view, signals[CONTACTS_REMOVED], 0, list);
g_list_free (list);
} | false | false | false | false | false | 0 |
affix_data_type (const char *param)
{
char *const type_or_decl = ASTRDUP (param);
char *p = type_or_decl;
char *qualifiers_then_data_type;
char saved;
/* Skip as many leading const's or volatile's as there are. */
for (;;)
{
if (!strncmp (p, "volatile ", 9))
{
p += 9;
continue;
}
if (!strncmp (p, "const ", 6))
{
p += 6;
continue;
}
break;
}
/* p now points to the place where we can insert the data type. We have to
add a blank after the data-type of course. */
if (p == type_or_decl)
return concat (data_type, " ", type_or_decl, NULL);
saved = *p;
*p = '\0';
qualifiers_then_data_type = concat (type_or_decl, data_type, NULL);
*p = saved;
return reconcat (qualifiers_then_data_type,
qualifiers_then_data_type, " ", p, NULL);
} | false | false | false | false | false | 0 |
memory_set_bankhandler_r(int bank, offs_t offset, mem_read_handler handler)
{
/* determine the new offset */
if (HANDLER_IS_RAM(handler) || HANDLER_IS_ROM(handler))
rmemhandler8[bank].offset = 0 - offset, handler = (mem_read_handler)STATIC_RAM;
else if (HANDLER_IS_BANK(handler))
rmemhandler8[bank].offset = bankdata[HANDLER_TO_BANK(handler)].readoffset - offset;
else
rmemhandler8[bank].offset = bankdata[bank].readoffset - offset;
/* set the new handler */
if (HANDLER_IS_STATIC(handler))
handler = rmemhandler8s[(FPTR)handler];
rmemhandler8[bank].handler = (void *)handler;
} | false | false | false | false | false | 0 |
_cdb_make_write(struct cdb_make *cdbmp, const unsigned char *ptr, unsigned len)
{
unsigned l = sizeof(cdbmp->cdb_buf) - (cdbmp->cdb_bpos - cdbmp->cdb_buf);
cdbmp->cdb_dpos += len;
if (len > l) {
memcpy(cdbmp->cdb_bpos, ptr, l);
cdbmp->cdb_bpos += l;
if (_cdb_make_flush(cdbmp) < 0)
return -1;
ptr += l; len -= l;
l = len / sizeof(cdbmp->cdb_buf);
if (l) {
l *= sizeof(cdbmp->cdb_buf);
if (_cdb_make_fullwrite(cdbmp->cdb_fd, ptr, l) < 0)
return -1;
ptr += l; len -= l;
}
}
if (len) {
memcpy(cdbmp->cdb_bpos, ptr, len);
cdbmp->cdb_bpos += len;
}
return 0;
} | false | false | false | false | false | 0 |
K054157_reset_tilemaps(void)
{
int i;
// To avoid crashes in K054157_reset_linescroll()
for(i=0; i<4; i++)
K054157_tilemap[i] = K054157_tilemaps[i];
for(i=0; i<4; i++)
K054157_change_tilemap(i);
} | false | false | false | false | false | 0 |
modssl_dispatch_ocsp_request(const apr_uri_t *uri,
apr_interval_time_t timeout,
OCSP_REQUEST *request,
conn_rec *c, apr_pool_t *p)
{
OCSP_RESPONSE *response = NULL;
apr_socket_t *sd;
BIO *bio;
bio = serialize_request(request, uri);
if (bio == NULL) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01989)
"could not serialize OCSP request");
ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, mySrvFromConn(c));
return NULL;
}
sd = send_request(bio, uri, timeout, c, p);
if (sd == NULL) {
/* Errors already logged. */
BIO_free(bio);
return NULL;
}
/* Clear the BIO contents, ready for the response. */
(void)BIO_reset(bio);
response = read_response(sd, bio, c, p);
apr_socket_close(sd);
BIO_free(bio);
return response;
} | false | false | false | false | false | 0 |
FactPNConstant2(
void *theEnv,
void *theValue,
DATA_OBJECT_PTR returnValue)
{
#if MAC_MCW || IBM_MCW || MAC_XCD
#pragma unused(returnValue)
#endif
struct factConstantPN2Call *hack;
struct field *fieldPtr;
struct expr *theConstant;
struct multifield *segmentPtr;
/*==========================================*/
/* Retrieve the arguments for the function. */
/*==========================================*/
hack = (struct factConstantPN2Call *) ValueToBitMap(theValue);
/*==========================================================*/
/* Extract the value from the specified slot. Note that the */
/* test to determine the slot's type (multifield) should be */
/* unnecessary since this routine should only be used for */
/* multifield slots. */
/*==========================================================*/
fieldPtr = &FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->whichSlot];
if (fieldPtr->type == MULTIFIELD)
{
segmentPtr = (struct multifield *) fieldPtr->value;
if (hack->fromBeginning)
{ fieldPtr = &segmentPtr->theFields[hack->offset]; }
else
{
fieldPtr = &segmentPtr->theFields[segmentPtr->multifieldLength -
(hack->offset + 1)];
}
}
/*====================================*/
/* Compare the value to the constant. */
/*====================================*/
theConstant = GetFirstArgument();
if (theConstant->type != fieldPtr->type) return(1 - hack->testForEquality);
if (theConstant->value != fieldPtr->value) return(1 - hack->testForEquality);
return(hack->testForEquality);
} | false | false | false | false | false | 0 |
free() {
if (isAllocated()) {
unsigned long pixel = m_pixel;
Display *disp = App::instance()->display();
XFreeColors(disp, DefaultColormap(disp, m_screen), &pixel, 1, 0);
setPixel(0);
setRGB(0, 0, 0);
setAllocated(false);
}
} | false | false | false | false | false | 0 |
getMean(CPose2D &est) const
{
est = CPose2D(0,0,0);
CPose2D p;
size_t i,n = m_particles.size();
double phi,w,W=0;
double W_phi_R=0,W_phi_L=0;
double phi_R=0,phi_L=0;
if (!n) return;
// First: XY
// -----------------------------------
for (i=0;i<n;i++)
{
p = m_particles[i].d->pose;
w = exp(m_particles[i].log_w);
W += w;
est.x_incr( p.x() * w );
est.y_incr( p.y() * w );
// PHI is special:
phi = p.phi();
if (fabs(phi)>1.5707963267948966192313216916398f)
{
// LEFT HALF: 0,2pi
if (phi<0) phi = (M_2PI + phi);
phi_L += phi * w;
W_phi_L += w;
}
else
{
// RIGHT HALF: -pi,pi
phi_R += phi * w;
W_phi_R += w;
}
}
est*=(1/W);
// Next: PHI
// -----------------------------------
// The mean value from each side:
if (W_phi_L>0) phi_L /= W_phi_L; // [0,2pi]
if (W_phi_R>0) phi_R /= W_phi_R; // [-pi,pi]
// Left side to [-pi,pi] again:
if (phi_L>M_PI) phi_L = phi_L - M_2PI;
// The total mean:
est.phi( ((phi_L * W_phi_L + phi_R * W_phi_R )/(W_phi_L+W_phi_R)) );
} | false | false | false | false | false | 0 |
write_output ()
{
STRINGDEF *next_string;
U_CHAR *cur_buf_loc;
int line_directive_len = 80;
char *line_directive = xmalloc (line_directive_len);
int len;
/* In each run through the loop, either cur_buf_loc ==
next_string_loc, in which case we print a series of strings, or
it is less than next_string_loc, in which case we write some of
the buffer. */
cur_buf_loc = outbuf.buf;
next_string = stringlist;
while (cur_buf_loc < outbuf.bufp || next_string) {
if (next_string
&& cur_buf_loc - outbuf.buf == next_string->output_mark) {
if (next_string->writeflag) {
len = 4 * strlen ((char *) next_string->filename) + 32;
while (len > line_directive_len)
line_directive = xrealloc (line_directive,
line_directive_len *= 2);
sprintf (line_directive, "\n# %d ", next_string->lineno);
strcpy (quote_string (line_directive + strlen (line_directive),
(char *) next_string->filename,
strlen ((char *) next_string->filename)),
"\n");
safe_write (fileno (stdout), line_directive, strlen (line_directive));
safe_write (fileno (stdout),
(char *) next_string->contents, next_string->len);
}
next_string = next_string->chain;
}
else {
len = (next_string
? (next_string->output_mark
- (cur_buf_loc - outbuf.buf))
: outbuf.bufp - cur_buf_loc);
safe_write (fileno (stdout), (char *) cur_buf_loc, len);
cur_buf_loc += len;
}
}
free (line_directive);
} | false | true | false | false | true | 1 |
o_printstring(FUNC UNUSED *fp, long index)
{
STRING *s;
char *cp;
s = findstring(index);
cp = s->s_str;
math_str(cp);
if (conf->traceflags & TRACE_OPCODES)
printf("\n");
math_flush();
} | false | false | false | false | false | 0 |
GetComponents(Interactor** c, int nc, Interactor**& a, int& n) {
register BoxElement* e;
register Interactor** ap;
n = nelements;
a = (n <= nc) ? c : new Interactor*[n];
ap = a;
for (e = head; e != nil; e = e->next) {
*ap++ = e->child;
}
} | false | false | false | false | false | 0 |
createTemplate()
{
if (m_CurrentDrugModel->rowCount() == 0)
return false;
// get the template content
QString content = drugsIo().prescriptionToXml(m_CurrentDrugModel, "");
// create a new template with it
Templates::TemplatesCreationDialog dlg(this);
dlg.setTemplateContent(content);
dlg.setTemplateSummary(prescriptionPrinter().prescriptionToHtml(m_CurrentDrugModel));
dlg.setTemplateMimeTypes(drugsIo().prescriptionMimeTypes());
dlg.setUserUuid(user()->uuid());
dlg.exec();
return true;
} | false | false | false | false | false | 0 |
gmm_free(Recog *recog)
{
if (recog->gc) {
free(recog->gc->OP_calced_score);
free(recog->gc->OP_calced_id);
free(recog->gc->is_voice);
#ifdef GMM_VAD
free(recog->gc->rates);
#endif
free(recog->gc->gmm_score);
free(recog->gc);
recog->gc = NULL;
}
} | false | false | false | false | false | 0 |
alloc_l2_table_index(struct mlx5_l2_table *l2_table, u32 *ix)
{
int err = 0;
*ix = find_first_zero_bit(l2_table->bitmap, l2_table->size);
if (*ix >= l2_table->size)
err = -ENOSPC;
else
__set_bit(*ix, l2_table->bitmap);
return err;
} | false | false | false | false | false | 0 |
input( const Trigger &trigger, const bool &isDown)
{
XTRACE();
Trigger t = trigger;
if( isDown)
{
switch( trigger.type)
{
case eKeyTrigger:
switch( trigger.data1)
{
case SDLK_ESCAPE:
case SDLK_RETURN:
turnOff();
break;
case SDLK_DELETE:
case SDLK_BACKSPACE:
if( _line.length() > 0)
{
_line.erase( _line.length()-1, 1);
}
break;
default:
break;
}
if( (_line.length() <= _maxLen) &&
(trigger.data1 > SDLK_SPACE) &&
(trigger.data1 <= SDLK_z))
{
char c;
//Accept simple unicode chars. Ie. ASCII
if( (trigger.data3 & ~0xff) == 0)
{
c=(char)(trigger.data3 & 0xff);
}
else
{
//Poor boy's version of ASCII...
c=(char)tolower(trigger.data1);
if( trigger.data2 & KMOD_SHIFT)
{
c = toupper(c);
}
}
_line += c;
}
break;
default:
break;
}
}
} | false | false | false | false | false | 0 |
option_set_command(int argc, const char *argv[])
{
if (argc != 3) {
config_msg = "Wrong number of arguments given to set command";
return ERR;
}
if (strcmp(argv[1], "=")) {
config_msg = "No value assigned";
return ERR;
}
if (!strcmp(argv[0], "show-author"))
return parse_enum(&opt_author, argv[2], author_map);
if (!strcmp(argv[0], "show-date"))
return parse_enum(&opt_date, argv[2], date_map);
if (!strcmp(argv[0], "show-rev-graph"))
return parse_bool(&opt_rev_graph, argv[2]);
if (!strcmp(argv[0], "show-refs"))
return parse_bool(&opt_show_refs, argv[2]);
if (!strcmp(argv[0], "show-line-numbers"))
return parse_bool(&opt_line_number, argv[2]);
if (!strcmp(argv[0], "line-graphics"))
return parse_bool(&opt_line_graphics, argv[2]);
if (!strcmp(argv[0], "line-number-interval"))
return parse_int(&opt_num_interval, argv[2], 1, 1024);
if (!strcmp(argv[0], "author-width"))
return parse_int(&opt_author_cols, argv[2], 0, 1024);
if (!strcmp(argv[0], "horizontal-scroll"))
return parse_step(&opt_hscroll, argv[2]);
if (!strcmp(argv[0], "split-view-height"))
return parse_step(&opt_scale_split_view, argv[2]);
if (!strcmp(argv[0], "tab-size"))
return parse_int(&opt_tab_size, argv[2], 1, 1024);
if (!strcmp(argv[0], "commit-encoding"))
return parse_string(opt_encoding, argv[2], sizeof(opt_encoding));
config_msg = "Unknown variable name";
return ERR;
} | false | false | false | false | false | 0 |
hub_plugins_load(struct hub_info* hub)
{
if (!hub->config->file_plugins || !*hub->config->file_plugins)
return 0;
hub->plugins = hub_malloc_zero(sizeof(struct uhub_plugins));
if (!hub->plugins)
return -1;
if (plugin_initialize(hub->config, hub) < 0)
{
hub_free(hub->plugins);
hub->plugins = 0;
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
evmap_signal_active(struct event_base *base, int sig, int ncalls)
{
struct event_signal_map *map = &base->sigmap;
struct evmap_signal *ctx;
struct event *ev;
EVUTIL_ASSERT(sig < map->nentries);
GET_SIGNAL_SLOT(ctx, map, sig, evmap_signal);
TAILQ_FOREACH(ev, &ctx->events, ev_signal_next)
event_active_nolock(ev, EV_SIGNAL, ncalls);
} | false | false | false | false | false | 0 |
number(double x)
{
QString tmp=QString::number(x, 'f', CUSTOM_DOUBLE_PRECISION);
//remove trailing zeroes AFTER decimal points
if(tmp.contains('.')){
int n=tmp.length()-1;
int del=0;
while(tmp.at(n)=='0'){
n--;
del++;
}
if(tmp.at(n)=='.'){
n--;
del++;
}
tmp.chop(del);
}
return tmp;
} | false | false | false | false | false | 0 |
_assuan_bytetohex (int nr, char *str)
{
static char hexdigits[] = "0123456789abcdef";
int i;
#define NROFHEXDIGITS 2
for (i = 0; i < NROFHEXDIGITS; i++)
{
int digit = (nr >> (i << 2)) & 0xf;
*(str++) = hexdigits[digit];
}
return str;
} | false | false | false | false | false | 0 |
sound_create(
snd_susp_type susp,
time_type t0,
rate_type sr,
promoted_sample_type scale)
{
sound_type sound;
falloc_sound(sound, "sound_create");
if (((long) sound) & 3) errputstr("sound not word aligned\n");
last_sound = sound; /* debug */
if (t0 < 0) xlerror("attempt to create a sound with negative starting time", s_unbound);
/* nyquist_printf("sound_create %p gets %g\n", sound, t0); */
sound->t0 = sound->true_t0 = sound->time = t0;
sound->stop = MAX_STOP;
sound->sr = sr;
sound->current = 0;
sound->scale = (float) scale;
sound->list = snd_list_create(susp);
sound->get_next = SND_get_first;
sound->logical_stop_cnt = UNKNOWN;
sound->table = NULL;
sound->extra = NULL;
/* nyquist_printf("sound_create susp %p snd_list %p\n", susp, sound->list);
nyquist_printf("sound_create'd %p\n", sound); */
#ifdef SNAPSHOTS
sound_created_flag = true;
#endif
#ifdef GC_DEBUG
if (sound == sound_to_watch) {
nyquist_printf("Created watched sound\n");
watch_snd_list(sound->list);
}
#endif
return sound;
} | false | false | false | false | false | 0 |
xl_xml_style_start (GsfXMLIn *xin, xmlChar const **attrs)
{
ExcelXMLReadState *state = (ExcelXMLReadState *)xin->user_state;
char const *id = NULL;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_SS, "ID"))
id = attrs[1];
else if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_SS, "Name"))
; /* does anything use this ? */
else
unknown_attr (xin, attrs, "Style");
if (id == NULL)
return;
g_return_if_fail (state->style == NULL);
state->style = (state->def_style != NULL)
? gnm_style_dup (state->def_style)
: gnm_style_new_default ();
if (!strcmp (id, "Default"))
state->def_style = state->style;
g_hash_table_replace (state->style_hash, g_strdup (id), state->style);
} | false | false | false | false | false | 0 |
needsQuotes(const std::string& s) {
if (! isLetter(s[0]) && (s[0] != '_')) {
return true;
}
for (int i = 0; i < (int)s.length(); ++i) {
char c = s[i];
// peek character
char p = (i == (int)s.length() - 1) ? '_' : s[i + 1];
// Identify separators
if ((c == '-' && p == '>') ||
(c == ':' && p == ':')) {
// Skip over this symbol
++i;
continue;
}
if (! isDigit(c) && ! isLetter(c) & (c != '.')) {
// This is an illegal character for an identifier, so we need quotes
return true;
}
}
return false;
} | false | false | false | false | false | 0 |
rtl2832_read_status(struct dvb_frontend *fe, enum fe_status *status)
{
struct rtl2832_dev *dev = fe->demodulator_priv;
struct i2c_client *client = dev->client;
int ret;
u32 uninitialized_var(tmp);
dev_dbg(&client->dev, "\n");
*status = 0;
if (dev->sleeping)
return 0;
ret = rtl2832_rd_demod_reg(dev, DVBT_FSM_STAGE, &tmp);
if (ret)
goto err;
if (tmp == 11) {
*status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
} else if (tmp == 10) {
*status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI;
}
dev->fe_status = *status;
return 0;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
} | false | false | false | false | false | 0 |
idset_count(IDSET *idset)
{
unsigned int id, count = 0;
for (id = idset_first(idset); id != END_OF_ID; id = idset_next(idset))
count++;
return count;
} | 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.