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
find_file_spec_function (int argc, const char **argv) { const char *file; if (argc != 1) abort (); file = find_file (argv[0]); return file; }
false
false
false
false
false
0
count_7mers_fwd_partial (int *counts, UINT4 high_rev, UINT4 low_rev, UINT4 nexthigh_rev, int startdiscard, int enddiscard) { UINT4 masked; int pos; pos = startdiscard; while (pos <= enddiscard && pos <= 9) { masked = high_rev >> (18 - 2*pos); masked &= MASK7; debug(printf("%d %04X\n",pos,masked)); counts[masked] += 1; pos++; } while (pos <= enddiscard && pos <= 15) { masked = low_rev >> (50 - 2*pos); masked |= high_rev << (2*pos - 18); masked &= MASK7; debug(printf("%d %04X\n",pos,masked)); counts[masked] += 1; pos++; } while (pos <= enddiscard && pos <= 25) { masked = low_rev >> (50 - 2*pos); masked &= MASK7; debug(printf("%d %04X\n",pos,masked)); counts[masked] += 1; pos++; } while (pos <= enddiscard && pos <= 31) { masked = nexthigh_rev >> (82 - 2*pos); masked |= low_rev << (2*pos - 50); masked &= MASK7; debug(printf("%d %04X\n",pos,masked)); counts[masked] += 1; pos++; } return; }
false
false
false
false
false
0
lzma_literal(struct xz_dec_lzma2 *s) { uint16_t *probs; uint32_t symbol; uint32_t match_byte; uint32_t match_bit; uint32_t offset; uint32_t i; probs = lzma_literal_probs(s); if (lzma_state_is_literal(s->lzma.state)) { symbol = rc_bittree(&s->rc, probs, 0x100); } else { symbol = 1; match_byte = dict_get(&s->dict, s->lzma.rep0) << 1; offset = 0x100; do { match_bit = match_byte & offset; match_byte <<= 1; i = offset + match_bit + symbol; if (rc_bit(&s->rc, &probs[i])) { symbol = (symbol << 1) + 1; offset &= match_bit; } else { symbol <<= 1; offset &= ~match_bit; } } while (symbol < 0x100); } dict_put(&s->dict, (uint8_t)symbol); lzma_state_literal(&s->lzma.state); }
false
false
false
false
false
0
cpl_image_get_fwhm( const cpl_image * in, cpl_size xpos, cpl_size ypos, double * fwhm_x, double * fwhm_y) { double half_max; double thres; const cpl_size minimum_size = 5; int is_rejected; /* Check entries - and initialize *fwhm_{x,y} */ if (fwhm_y != NULL) *fwhm_y = -1; cpl_ensure_code(fwhm_x, CPL_ERROR_NULL_INPUT); *fwhm_x = -1; cpl_ensure_code(fwhm_y, CPL_ERROR_NULL_INPUT); /* This call will check the validity of image, xpos and ypos */ half_max = 0.5 * cpl_image_get(in, xpos, ypos, &is_rejected); cpl_ensure_code(is_rejected >= 0, cpl_error_get_code()); cpl_ensure_code(!is_rejected, CPL_ERROR_DATA_NOT_FOUND); cpl_ensure_code(half_max > 0, CPL_ERROR_DATA_NOT_FOUND); /* FWHM in x */ if (in->nx >= minimum_size) { cpl_errorstate pstate; /* Extract the vector centered on the maximum */ cpl_vector * row = cpl_vector_new_from_image_row(in, ypos); /* If an error happened, update its location */ cpl_ensure_code(row, cpl_error_get_code()); pstate = cpl_errorstate_get(); /* Find out threshold */ thres = cpl_vector_get_noise(row, xpos); /* Compute the FWHM */ if (cpl_errorstate_is_equal(pstate)) *fwhm_x = cpl_vector_get_fwhm(row, xpos, half_max + thres * 0.5); cpl_vector_delete(row); /* Propagate the error, if any */ cpl_ensure_code(cpl_errorstate_is_equal(pstate), cpl_error_get_code()); } /* FWHM in y */ if (in->ny >= minimum_size) { cpl_errorstate pstate; /* Extract the vector centered on the maximum */ cpl_vector * col = cpl_vector_new_from_image_column(in, xpos); /* If an error happened, update its location */ cpl_ensure_code(col, cpl_error_get_code()); pstate = cpl_errorstate_get(); /* Find out threshold */ thres = cpl_vector_get_noise(col, ypos); /* Compute the FWHM */ if (cpl_errorstate_is_equal(pstate)) *fwhm_y = cpl_vector_get_fwhm(col, ypos, half_max + thres * 0.5); cpl_vector_delete(col); /* Propagate the error, if any */ cpl_ensure_code(cpl_errorstate_is_equal(pstate), cpl_error_get_code()); } return CPL_ERROR_NONE; }
false
false
false
false
false
0
slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb) { struct slic_rcvqueue *rcvq = &adapter->rcvqueue; void *paddr; u32 paddrl; u32 paddrh; struct slic_rcvbuf *rcvbuf = (struct slic_rcvbuf *)skb->head; struct device *dev; paddr = (void *)(unsigned long) pci_map_single(adapter->pcidev, skb->head, SLIC_RCVQ_RCVBUFSIZE, PCI_DMA_FROMDEVICE); rcvbuf->status = 0; skb->next = NULL; paddrl = SLIC_GET_ADDR_LOW(paddr); paddrh = SLIC_GET_ADDR_HIGH(paddr); if (paddrl == 0) { dev = &adapter->netdev->dev; dev_err(dev, "%s: LOW 32bits PHYSICAL ADDRESS == 0\n", __func__); dev_err(dev, "skb[%p] PROBLEM\n", skb); dev_err(dev, " skbdata[%p]\n", skb->data); dev_err(dev, " skblen[%x]\n", skb->len); dev_err(dev, " paddr[%p]\n", paddr); dev_err(dev, " paddrl[%x]\n", paddrl); dev_err(dev, " paddrh[%x]\n", paddrh); dev_err(dev, " rcvq->head[%p]\n", rcvq->head); dev_err(dev, " rcvq->tail[%p]\n", rcvq->tail); dev_err(dev, " rcvq->count[%x]\n", rcvq->count); } if (paddrh == 0) { slic_reg32_write(&adapter->slic_regs->slic_hbar, (u32)paddrl, DONT_FLUSH); } else { slic_reg64_write(adapter, &adapter->slic_regs->slic_hbar64, paddrl, &adapter->slic_regs->slic_addr_upper, paddrh, DONT_FLUSH); } if (rcvq->head) rcvq->tail->next = skb; else rcvq->head = skb; rcvq->tail = skb; rcvq->count++; return rcvq->count; }
false
false
false
false
false
0
merge_star(GList *csl, struct cat_star *new) { GList *sl; struct cat_star *cats; for (sl = csl; sl != NULL; sl = sl->next) { cats = CAT_STAR(sl->data); if (cats_is_duplicate(cats, new)) { /* these are the funny replacement/reject rules */ if (CATS_TYPE(cats) == CAT_STAR_TYPE_SREF) { cat_star_release(cats); cat_star_ref(new); sl->data = new; } else if (CATS_TYPE(cats) == CAT_STAR_TYPE_ALIGN) { if (CATS_TYPE(new) != CAT_STAR_TYPE_SREF) { cat_star_release(cats); cat_star_ref(new); sl->data = new; } } else if (CATS_TYPE(cats) == CAT_STAR_TYPE_CAT) { if (CATS_TYPE(new) != CAT_STAR_TYPE_SREF && CATS_TYPE(new) != CAT_STAR_TYPE_ALIGN) { cat_star_release(cats); cat_star_ref(new); sl->data = new; } } else if (CATS_TYPE(cats) == CAT_STAR_TYPE_APSTD || CATS_TYPE(cats) == CAT_STAR_TYPE_APSTAR) { if (CATS_TYPE(new) == CAT_STAR_TYPE_APSTD || CATS_TYPE(new) == CAT_STAR_TYPE_APSTAR) { cat_star_release(cats); cat_star_ref(new); sl->data = new; } } break; } } if (sl == NULL) { cat_star_ref(new); csl = g_list_prepend(csl, new); } return csl; }
false
false
false
false
false
0
array_slide_down(array *a, int n) { int i; a = array_check(a); if(n <= 0) { n = 0; } for(i = a->n; i > n; i--) { a->data[i] = a->data[i-1]; } return a; }
false
false
false
false
false
0
l2tp_tunnel_checkchallresp(uint8_t msgident, const struct l2tp_conn_t *conn, const struct l2tp_attr_t *challresp) { uint8_t challref[MD5_DIGEST_LENGTH]; if (conn->secret == NULL || conn->secret_len == 0) { if (challresp) { log_tunnel(log_warn, conn, "discarding unexpected Challenge Response" " sent by peer\n"); } return 0; } if (conn->challenge == NULL) { log_tunnel(log_error, conn, "impossible to authenticate peer:" " Challenge is unavailable\n"); return -1; } if (challresp == NULL) { log_tunnel(log_error, conn, "impossible to authenticate peer:" " no Challenge Response sent by peer\n"); return -1; } else if (challresp->length != MD5_DIGEST_LENGTH) { log_tunnel(log_error, conn, "impossible to authenticate peer:" " invalid Challenge Response sent by peer" " (inconsistent length: %i bytes)\n", challresp->length); return -1; } comp_chap_md5(challref, msgident, conn->secret, conn->secret_len, conn->challenge, conn->challenge_len); if (memcmp(challref, challresp->val.octets, MD5_DIGEST_LENGTH) != 0) { log_tunnel(log_error, conn, "impossible to authenticate peer:" " invalid Challenge Response sent by peer" " (wrong secret)\n"); return -1; } return 0; }
false
false
false
false
false
0
tray_constructor(plugin_instance *p) { tray_priv *tr; GdkScreen *screen; GtkWidget *ali; ENTER; tr = (tray_priv *) p; class_get("tray"); ali = gtk_alignment_new(0.5, 0.5, 0, 0); g_signal_connect(G_OBJECT(ali), "size-allocate", (GCallback) tray_size_alloc, tr); gtk_container_set_border_width(GTK_CONTAINER(ali), 0); gtk_container_add(GTK_CONTAINER(p->pwid), ali); tr->box = gtk_bar_new(p->panel->orientation, 0, p->panel->max_elem_height, p->panel->max_elem_height); gtk_container_add(GTK_CONTAINER(ali), tr->box); gtk_container_set_border_width(GTK_CONTAINER (tr->box), 0); gtk_widget_show_all(ali); tr->bg = fb_bg_get_for_display(); tr->sid = g_signal_connect(tr->bg, "changed", G_CALLBACK(tray_bg_changed), p->pwid); screen = gtk_widget_get_screen(p->panel->topgwin); if (egg_tray_manager_check_running(screen)) { tr->tray_manager = NULL; ERR("tray: another systray already running\n"); RET(1); } tr->tray_manager = egg_tray_manager_new (); if (!egg_tray_manager_manage_screen (tr->tray_manager, screen)) g_printerr("tray: can't get the system tray manager selection\n"); g_signal_connect(tr->tray_manager, "tray_icon_added", G_CALLBACK(tray_added), tr); g_signal_connect(tr->tray_manager, "tray_icon_removed", G_CALLBACK(tray_removed), tr); g_signal_connect(tr->tray_manager, "message_sent", G_CALLBACK(message_sent), tr); g_signal_connect(tr->tray_manager, "message_cancelled", G_CALLBACK(message_cancelled), tr); gtk_widget_show_all(tr->box); RET(1); }
false
false
false
false
false
0
mdb_stats_on(MdbHandle *mdb) { if (!mdb->stats) mdb->stats = g_malloc0(sizeof(MdbStatistics)); mdb->stats->collect = TRUE; }
false
false
false
false
false
0
set_var(struct fbtft_par *par) { /* MADCTL - Memory data access control RGB/BGR: 1. Mode selection pin SRGB RGB H/W pin for color filter setting: 0=RGB, 1=BGR 2. MADCTL RGB bit RGB-BGR ORDER color filter panel: 0=RGB, 1=BGR */ switch (par->info->var.rotate) { case 0: write_reg(par, 0x36, MX | MY | (par->bgr << 3)); break; case 270: write_reg(par, 0x36, MY | MV | (par->bgr << 3)); break; case 180: write_reg(par, 0x36, par->bgr << 3); break; case 90: write_reg(par, 0x36, MX | MV | (par->bgr << 3)); break; } return 0; }
false
false
false
false
false
0
deleteSubtree( const QModelIndex& idx ) { d->scene.deleteSubtree( d->scene.summaryHandlingModel()->mapFromSource( idx ) ); }
false
false
false
false
false
0
bd_queue_initialize(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q, u32 base, u32 size, u32 r, u32 w) { IPW_DEBUG_INFO("enter\n"); IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32) q->nic); write_register(priv->net_dev, base, q->nic); write_register(priv->net_dev, size, q->entries); write_register(priv->net_dev, r, q->oldest); write_register(priv->net_dev, w, q->next); IPW_DEBUG_INFO("exit\n"); }
false
false
false
false
false
0
gee_concurrent_set_sub_iterator_real_has_next (GeeIterator* base) { GeeConcurrentSetSubIterator * self; gboolean result = FALSE; GeeHazardPointerContext* ctx = NULL; GeeHazardPointerContext* _tmp0_ = NULL; GeeConcurrentSetTowerIter _tmp1_ = {0}; GeeConcurrentSetTower* _tmp2_ = NULL; self = (GeeConcurrentSetSubIterator*) base; _tmp0_ = gee_hazard_pointer_context_new (NULL); ctx = _tmp0_; _tmp1_ = self->priv->_prev; _tmp2_ = _tmp1_._iter[0]; if (_tmp2_ == NULL) { GeeConcurrentSetTower* next = NULL; GeeConcurrentSetRange* _tmp3_ = NULL; GeeConcurrentSetTower* _tmp4_ = NULL; gboolean _tmp5_ = FALSE; GeeConcurrentSetTower* _tmp6_ = NULL; gboolean _tmp10_ = FALSE; GeeConcurrentSetTower* _tmp11_ = NULL; _tmp3_ = self->priv->_range; gee_concurrent_set_range_improve_bookmark (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp3_, &_tmp4_, NULL); _gee_concurrent_set_tower_unref0 (next); next = _tmp4_; _tmp6_ = next; if (_tmp6_ != NULL) { GeeConcurrentSetRange* _tmp7_ = NULL; GeeConcurrentSetTower* _tmp8_ = NULL; gboolean _tmp9_ = FALSE; _tmp7_ = self->priv->_range; _tmp8_ = next; _tmp9_ = gee_concurrent_set_range_beyond (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp7_, _tmp8_); _tmp5_ = _tmp9_; } else { _tmp5_ = FALSE; } _tmp10_ = _tmp5_; if (_tmp10_) { _gee_concurrent_set_tower_unref0 (next); next = NULL; } _tmp11_ = next; result = _tmp11_ != NULL; _gee_concurrent_set_tower_unref0 (next); _gee_hazard_pointer_context_free0 (ctx); return result; } else { GeeConcurrentSetTower* new_prev = NULL; GeeConcurrentSetTowerIter _tmp12_ = {0}; GeeConcurrentSetTower* _tmp13_ = NULL; GeeConcurrentSetTower* _tmp14_ = NULL; GeeConcurrentSetTower* new_curr = NULL; GeeConcurrentSetTower* _tmp15_ = NULL; GeeConcurrentSetTower* _tmp16_ = NULL; GeeConcurrentSetRange* _tmp17_ = NULL; gboolean _tmp18_ = FALSE; _tmp12_ = self->priv->_prev; _tmp13_ = _tmp12_._iter[0]; _tmp14_ = _gee_concurrent_set_tower_ref0 (_tmp13_); new_prev = _tmp14_; _tmp15_ = self->priv->_curr; _tmp16_ = _gee_concurrent_set_tower_ref0 (_tmp15_); new_curr = _tmp16_; _tmp17_ = self->priv->_range; _tmp18_ = gee_concurrent_set_range_proceed (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp17_, &new_prev, &new_curr, (guint8) 0); result = _tmp18_; _gee_concurrent_set_tower_unref0 (new_curr); _gee_concurrent_set_tower_unref0 (new_prev); _gee_hazard_pointer_context_free0 (ctx); return result; } _gee_hazard_pointer_context_free0 (ctx); }
false
false
false
false
false
0
oceanic_vtpro_device_open (dc_device_t **out, dc_context_t *context, const char *name) { if (out == NULL) return DC_STATUS_INVALIDARGS; // Allocate memory. oceanic_vtpro_device_t *device = (oceanic_vtpro_device_t *) malloc (sizeof (oceanic_vtpro_device_t)); if (device == NULL) { ERROR (context, "Failed to allocate memory."); return DC_STATUS_NOMEMORY; } // Initialize the base class. oceanic_common_device_init (&device->base, context, &oceanic_vtpro_device_vtable); // Override the base class values. device->base.multipage = MULTIPAGE; // Set the default values. device->port = NULL; // Open the device. int rc = serial_open (&device->port, context, name); if (rc == -1) { ERROR (context, "Failed to open the serial port."); free (device); return DC_STATUS_IO; } // Set the serial communication protocol (9600 8N1). rc = serial_configure (device->port, 9600, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE); if (rc == -1) { ERROR (context, "Failed to set the terminal attributes."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Set the timeout for receiving data (3000 ms). if (serial_set_timeout (device->port, 3000) == -1) { ERROR (context, "Failed to set the timeout."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Set the DTR and RTS lines. if (serial_set_dtr (device->port, 1) == -1 || serial_set_rts (device->port, 1) == -1) { ERROR (context, "Failed to set the DTR/RTS line."); serial_close (device->port); free (device); return DC_STATUS_IO; } // Give the interface 100 ms to settle and draw power up. serial_sleep (device->port, 100); // Make sure everything is in a sane state. serial_flush (device->port, SERIAL_QUEUE_BOTH); // Initialize the data cable (MOD mode). dc_status_t status = oceanic_vtpro_init (device); if (status != DC_STATUS_SUCCESS) { serial_close (device->port); free (device); return status; } // Switch the device from surface mode into download mode. Before sending // this command, the device needs to be in PC mode (manually activated by // the user), or already in download mode. status = oceanic_vtpro_device_version ((dc_device_t *) device, device->base.version, sizeof (device->base.version)); if (status != DC_STATUS_SUCCESS) { serial_close (device->port); free (device); return status; } // Calibrate the device. Although calibration is optional, it's highly // recommended because it reduces the transfer time considerably, even // when processing the command itself is quite slow. status = oceanic_vtpro_calibrate (device); if (status != DC_STATUS_SUCCESS) { serial_close (device->port); free (device); return status; } // Override the base class values. if (OCEANIC_COMMON_MATCH (device->base.version, oceanic_wisdom_version)) { device->base.layout = &oceanic_wisdom_layout; } else { device->base.layout = &oceanic_vtpro_layout; } *out = (dc_device_t*) device; return DC_STATUS_SUCCESS; }
false
false
false
false
false
0
AutoVacuumingActive(void) { if (!autovacuum_start_daemon || !pgstat_collect_startcollector || !pgstat_collect_tuplelevel) return false; return true; }
false
false
false
false
false
0
ndmp_sxa_data_start_recover_filehist (struct ndm_session *sess, struct ndmp_xa_buf *xa, struct ndmconn *ref_conn) { ndmp9_error error; int rc; NDMS_WITH(ndmp9_data_start_recover) rc = data_ok_bu_type (sess, xa, ref_conn, request->bu_type); if (rc) { return rc; } if (request->addr.addr_type != NDMP9_ADDR_AS_CONNECTED) { rc = data_can_connect_and_start (sess, xa, ref_conn, &request->addr, NDMP9_MOVER_MODE_WRITE); } else { rc = data_can_start (sess, xa, ref_conn, NDMP9_MOVER_MODE_WRITE); } if (rc) { return rc; /* already tattled */ } strcpy (sess->data_acb.bu_type, request->bu_type); error = data_copy_environment (sess, request->env.env_val, request->env.env_len); if (error != NDMP9_NO_ERR) { ndmda_belay (sess); NDMADR_RAISE(error, "copy-env"); } error = data_copy_nlist (sess, request->nlist.nlist_val, request->nlist.nlist_len); if (error != NDMP9_NO_ERR) { ndmda_belay (sess); NDMADR_RAISE(error, "copy-nlist"); } if (request->addr.addr_type != NDMP9_ADDR_AS_CONNECTED) { rc = data_connect (sess, xa, ref_conn, &request->addr); if (rc) { ndmda_belay (sess); return rc; /* already tattled */ } } error = ndmda_data_start_recover_fh (sess); if (error != NDMP9_NO_ERR) { /* TODO: undo everything */ ndmda_belay (sess); NDMADR_RAISE(error, "start_recover_filehist"); } return 0; NDMS_ENDWITH }
false
false
false
false
false
0
TCSP_CMK_CreateTicket_Internal(TCS_CONTEXT_HANDLE hContext, /* in */ UINT32 PublicVerifyKeySize, /* in */ BYTE* PublicVerifyKey, /* in */ TPM_DIGEST SignedData, /* in */ UINT32 SigValueSize, /* in */ BYTE* SigValue, /* in */ TPM_AUTH* pOwnerAuth, /* in, out */ TPM_HMAC* SigTicket) /* out */ { TSS_RESULT result; UINT64 offset = 0; UINT32 paramSize; BYTE txBlob[TSS_TPM_TXBLOB_SIZE]; LogDebugFn("Enter"); if ((result = ctx_verify_context(hContext))) return result; if ((result = auth_mgr_check(hContext, &pOwnerAuth->AuthHandle))) return result; if ((result = tpm_rqu_build(TPM_ORD_CMK_CreateTicket, &offset, txBlob, PublicVerifyKeySize, PublicVerifyKey, &SignedData, SigValueSize, SigValue, pOwnerAuth))) goto done; if ((result = req_mgr_submit_req(txBlob))) goto done; result = UnloadBlob_Header(txBlob, &paramSize); if (!result) { result = tpm_rsp_parse(TPM_ORD_CMK_CreateTicket, txBlob, paramSize, SigTicket, pOwnerAuth); } LogResult("CMK_SetRestrictions", result); done: auth_mgr_release_auth(pOwnerAuth, NULL, hContext); return result; }
false
false
false
false
false
0
open_config() { FILE *fp = NULL; char *line; key_cmd *cmd; confentry *lastnode = NULL, *newnode = NULL; int lineno = 1, ret = 0; size_t n = 0; /* Allow the configuration file to be overridden */ if (!config) config = CONFIG; fp = fopen(config, "r"); if (fp == NULL) { lprintf("Warning: could not open the configuration file %s: %s\n", config, strerror(errno)); return OK; } if (verbose > 1) lprintf("Using configuration file %s\n", config); while (!feof(fp) && (ret >=0)) { line = NULL; ret = getline(&line, &n, fp); if ((ret > 0) && (proc_config(lineno, line, &cmd) == OK)) { newnode = (confentry *)(malloc(sizeof(confentry))); if (newnode == NULL) { lprintf("Error: memory allocation failed\n"); close_config(); free(line); return MEMERR; } newnode->cmd = cmd; newnode->next = NULL; if (list == NULL) { list = newnode; } else { lastnode->next = newnode; } lastnode = newnode; if (verbose > 1) { lprintf("Config: "); lprint_mask(cmd->keys); lprintf(" -:- "); print_etype(cmd->type); lprintf(" -:- "); print_attrs(cmd); lprintf(" -:- %s\n", cmd->command); } } free(line); ++lineno; } fclose(fp); return OK; }
false
false
false
true
false
1
__ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset, size_t size) { ioc_waitq_t *waitq = NULL; ioc_local_t *local = NULL; GF_VALIDATE_OR_GOTO ("io-cache", frame, out); local = frame->local; GF_VALIDATE_OR_GOTO (frame->this->name, local, out); if (page == NULL) { local->op_ret = -1; local->op_errno = ENOMEM; gf_log (frame->this->name, GF_LOG_WARNING, "asked to wait on a NULL page"); } waitq = GF_CALLOC (1, sizeof (*waitq), gf_ioc_mt_ioc_waitq_t); if (waitq == NULL) { local->op_ret = -1; local->op_errno = ENOMEM; goto out; } gf_log (frame->this->name, GF_LOG_TRACE, "frame(%p) waiting on page = %p, offset=%"PRId64", " "size=%"GF_PRI_SIZET"", frame, page, offset, size); waitq->data = frame; waitq->next = page->waitq; waitq->pending_offset = offset; waitq->pending_size = size; page->waitq = waitq; /* one frame can wait only once on a given page, * local->wait_count is number of pages a frame is waiting on */ ioc_local_lock (local); { local->wait_count++; } ioc_local_unlock (local); out: return; }
false
false
false
true
false
1
CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name) { if (conf == NULL) { return NCONF_get_string(NULL, group, name); } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_get_string(&ctmp, group, name); } }
false
false
false
false
false
0
soap_out_a__address(struct soap *soap, const char *tag, int id, const a__address *a, const char *type) { soap_set_attr(soap, "ID", soap_int2s(soap, ((a__address*)a)->ID), 1); if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_a__address), type)) return soap->error; if (soap_out_std__string(soap, "name", -1, &(a->a__address::name), "")) return soap->error; if (soap_out_std__string(soap, "street", -1, &(a->a__address::street), "")) return soap->error; if (soap_out_std__string(soap, "city", -1, &(a->a__address::city), "")) return soap->error; if (soap_out_std__string(soap, "zip", -1, &(a->a__address::zip), "")) return soap->error; if (soap_out_a__ISO_country(soap, "country", -1, &(a->a__address::country), "")) return soap->error; if (soap_out_PointerTostd__string(soap, "phone", -1, &(a->a__address::phone), "")) return soap->error; if (soap_out_PointerTostd__string(soap, "mobile", -1, &(a->a__address::mobile), "")) return soap->error; if (soap_out_PointerTotime(soap, "dob", -1, &(a->a__address::dob), "")) return soap->error; /* transient soap skipped */ return soap_element_end_out(soap, tag); }
false
false
false
false
false
0
reset() { delete dec; dec = 0; in.resize(0); out = ""; at = 0; paused = false; mightChangeEncoding = true; checkBad = true; last = QChar(); v_encoding = ""; resetLastData(); }
false
false
false
false
false
0
c67x00_add_iso_urb(struct c67x00_hcd *c67x00, struct urb *urb) { struct c67x00_urb_priv *urbp = urb->hcpriv; if (frame_after_eq(c67x00->current_frame, urbp->ep_data->next_frame)) { char *td_buf; int len, pid, ret; BUG_ON(urbp->cnt >= urb->number_of_packets); td_buf = urb->transfer_buffer + urb->iso_frame_desc[urbp->cnt].offset; len = urb->iso_frame_desc[urbp->cnt].length; pid = usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN; ret = c67x00_create_td(c67x00, urb, td_buf, len, pid, 0, urbp->cnt); if (ret) { dev_dbg(c67x00_hcd_dev(c67x00), "create failed: %d\n", ret); urb->iso_frame_desc[urbp->cnt].actual_length = 0; urb->iso_frame_desc[urbp->cnt].status = ret; if (urbp->cnt + 1 == urb->number_of_packets) c67x00_giveback_urb(c67x00, urb, 0); } urbp->ep_data->next_frame = frame_add(urbp->ep_data->next_frame, urb->interval); urbp->cnt++; } return 0; }
false
false
false
false
false
0
GEN_species_add_entry(GBDATA *gb_pseudo, const char *key, const char *value) { GB_ERROR error = 0; GB_clear_error(); GBDATA *gbd = GB_entry(gb_pseudo, key); if (!gbd) { // key does not exist yet -> create gbd = GB_create(gb_pseudo, key, GB_STRING); if (!gbd) error = GB_await_error(); } else { // key exists if (GB_read_type(gbd) != GB_STRING) { // test correct key type error = GB_export_errorf("field '%s' exists and has wrong type", key); } } if (!error) error = GB_write_string(gbd, value); return error; }
false
false
false
false
false
0
closeImg2(AbstractFile* file) { InfoImg2* info = (InfoImg2*) (file->data); uint32_t cksum; if(info->dirty) { info->file->seek(info->file, sizeof(info->header)); info->file->write(info->file, info->buffer, info->header.dataLen); info->header.dataLenPadded = info->header.dataLen; flipImg2Header(&(info->header)); cksum = crc32(0, (unsigned char *)&(info->header), 0x64); FLIPENDIANLE(cksum); info->header.header_checksum = cksum; info->file->seek(info->file, 0); info->file->write(info->file, &(info->header), sizeof(info->header)); } free(info->buffer); info->file->close(info->file); free(info); free(file); }
false
false
false
false
false
0
light_read(struct seq_file *m) { int status; if (!tp_features.light) { seq_printf(m, "status:\t\tnot supported\n"); } else if (!tp_features.light_status) { seq_printf(m, "status:\t\tunknown\n"); seq_printf(m, "commands:\ton, off\n"); } else { status = light_get_status(); if (status < 0) return status; seq_printf(m, "status:\t\t%s\n", onoff(status, 0)); seq_printf(m, "commands:\ton, off\n"); } return 0; }
false
false
false
false
false
0
traceSubObjects(Collector &c) const { c.trace(flowObj_); if (display_) for (ELObj **p = display_; *p; p++) c.trace(*p); }
false
false
false
false
false
0
startRendering() { if (m_thing)stopRendering(); m_thing = gluNewQuadric(); gluQuadricTexture(m_thing, GL_FALSE); gluQuadricDrawStyle(m_thing, static_cast<GLenum>(GLU_FILL)); m_change = 1; }
false
false
false
false
false
0
dw_mci_req_show(struct seq_file *s, void *v) { struct dw_mci_slot *slot = s->private; struct mmc_request *mrq; struct mmc_command *cmd; struct mmc_command *stop; struct mmc_data *data; /* Make sure we get a consistent snapshot */ spin_lock_bh(&slot->host->lock); mrq = slot->mrq; if (mrq) { cmd = mrq->cmd; data = mrq->data; stop = mrq->stop; if (cmd) seq_printf(s, "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", cmd->opcode, cmd->arg, cmd->flags, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[2], cmd->error); if (data) seq_printf(s, "DATA %u / %u * %u flg %x err %d\n", data->bytes_xfered, data->blocks, data->blksz, data->flags, data->error); if (stop) seq_printf(s, "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", stop->opcode, stop->arg, stop->flags, stop->resp[0], stop->resp[1], stop->resp[2], stop->resp[2], stop->error); } spin_unlock_bh(&slot->host->lock); return 0; }
false
false
false
false
false
0
_k_slotSymLink() { KNameAndUrlInputDialog* dlg = static_cast<KNameAndUrlInputDialog*>(m_fileDialog); m_copyData.m_chosenFileName = dlg->name(); // no path KUrl linkUrl = dlg->url(); // the url to put in the file if (m_copyData.m_chosenFileName.isEmpty() || linkUrl.isEmpty()) return; if (linkUrl.isRelative()) m_copyData.m_src = QUrl(linkUrl).toString(); else if (linkUrl.isLocalFile()) m_copyData.m_src = linkUrl.toLocalFile(); else { KDialog* dialog = new KDialog(m_parentWidget); dialog->setCaption( i18n("Sorry") ); dialog->setButtons( KDialog::Ok ); dialog->setObjectName( "sorry" ); dialog->setModal(m_modal); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setDefaultButton( KDialog::Ok ); dialog->setEscapeButton( KDialog::Ok ); m_fileDialog = dialog; KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, i18n("Basic links can only point to local files or directories.\nPlease use \"Link to Location\" for remote URLs."), QStringList(), QString(), 0, KMessageBox::NoExec, QString()); dialog->show(); return; } executeStrategy(); }
false
false
false
false
false
0
_dxf_ExReadDXRCFiles () { struct passwd *pass; char buf [1024]; struct stat curr; /* local dir */ struct stat home; /* home dir */ struct stat sys; /* system dir */ struct stat sys2; /* system dir */ int n; char *root; /* * Since the inputs get stacked we want them in reverse order. * * We use the stat calls to make sure that we don't include an init * file twice. This could occur previously if $HOME == current dir, * etc. */ /* If we are connected to the UI then this is called from the command * to get a license. The linefeed from the license command gets read * by the include in the dxrc system file. When we return we don't read * the linefeed from the license command and our char ptr is not reset. * this will cause a syntax error if the next command is a "$" command. */ if(_dxd_exRemote) yycharno = 0; curr.st_dev = curr.st_ino = 0; home.st_dev = home.st_ino = 0; sys .st_dev = sys .st_ino = 0; buf[0] = '\0'; if (getcwd (buf, 1022) == NULL) buf[0] = '\0'; n = strlen (buf); sprintf (&buf[n], "/%s", DXRC); stat (buf, &curr); one_dxrc (DXRC); /* local dir */ #if DXD_LACKS_UNIX_UID sprintf(buf, "C:\\%s", DXRC); stat(buf, &home); if(DIFFERENT_FILES (curr, home)) one_dxrc (buf); /* home dir */ #else if ((pass = getpwuid (geteuid ())) != NULL) { sprintf (buf, "%s/%s", pass->pw_dir, DXRC); stat (buf, &home); if (DIFFERENT_FILES (curr, home)) one_dxrc (buf); /* home dir */ } #endif if ((root = (char *) getenv ("DXROOT")) != NULL) { sprintf (buf, "%s/%s", root, DXRC); stat (buf, &sys); if (DIFFERENT_FILES (curr, sys) && DIFFERENT_FILES (home, sys)) one_dxrc (buf); /* system */ sprintf (buf, "%s/lib/%s", root, SYSDXRC); stat (buf, &sys2); if (DIFFERENT_FILES (curr, sys2) && DIFFERENT_FILES (home, sys2) && DIFFERENT_FILES (sys, sys2)) one_dxrc (buf); /* 2nd system */ } }
true
true
false
false
true
1
icmp_load(netsnmp_cache *cache, void *vmagic) { long ret_value = -1; ret_value = linux_read_icmp_stat(&icmpstat); if ( ret_value < 0 ) { DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (linux)\n")); } else { DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (linux)\n")); } icmp_stats_load(cache, vmagic); icmp_msg_stats_load(cache, vmagic); return ret_value; }
false
true
false
false
false
1
evhttp_read_header(struct evhttp_connection *evcon, struct evhttp_request *req) { enum message_read_status res; int fd = evcon->fd; res = evhttp_parse_headers(req, bufferevent_get_input(evcon->bufev)); if (res == DATA_CORRUPTED || res == DATA_TOO_LONG) { /* Error while reading, terminate */ event_debug(("%s: bad header lines on %d\n", __func__, fd)); evhttp_connection_fail(evcon, EVCON_HTTP_INVALID_HEADER); return; } else if (res == MORE_DATA_EXPECTED) { /* Need more header lines */ return; } /* Disable reading for now */ bufferevent_disable(evcon->bufev, EV_READ); /* Done reading headers, do the real work */ switch (req->kind) { case EVHTTP_REQUEST: event_debug(("%s: checking for post data on %d\n", __func__, fd)); evhttp_get_body(evcon, req); /* note the request may have been freed in evhttp_get_body */ break; case EVHTTP_RESPONSE: if (!evhttp_response_needs_body(req)) { event_debug(("%s: skipping body for code %d\n", __func__, req->response_code)); evhttp_connection_done(evcon); } else { event_debug(("%s: start of read body for %s on %d\n", __func__, req->remote_host, fd)); evhttp_get_body(evcon, req); /* note the request may have been freed in * evhttp_get_body */ } break; default: event_warnx("%s: bad header on %d", __func__, fd); evhttp_connection_fail(evcon, EVCON_HTTP_INVALID_HEADER); break; } /* request may have been freed above */ }
false
false
false
false
false
0
gst_tee_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstTee *tee = GST_TEE (object); GST_OBJECT_LOCK (tee); switch (prop_id) { case PROP_HAS_SINK_LOOP: tee->has_sink_loop = g_value_get_boolean (value); if (tee->has_sink_loop) { g_warning ("tee will never implement has-sink-loop==TRUE"); } break; case PROP_HAS_CHAIN: tee->has_chain = g_value_get_boolean (value); break; case PROP_SILENT: tee->silent = g_value_get_boolean (value); break; case PROP_PULL_MODE: tee->pull_mode = g_value_get_enum (value); break; case PROP_ALLOC_PAD: { GstPad *pad = g_value_get_object (value); GST_OBJECT_LOCK (pad); if (GST_OBJECT_PARENT (pad) == GST_OBJECT_CAST (object)) tee->allocpad = pad; else GST_WARNING_OBJECT (object, "Tried to set alloc pad %s which" " is not my pad", GST_OBJECT_NAME (pad)); GST_OBJECT_UNLOCK (pad); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } GST_OBJECT_UNLOCK (tee); }
false
false
false
false
false
0
add_load_option(DYNAMIC_STRING *str, const char *option, const char *option_value) { if (!option_value) { /* Null value means we don't add this option. */ return; } dynstr_append_checked(str, option); if (strncmp(option_value, "0x", sizeof("0x")-1) == 0) { /* It's a hex constant, don't escape */ dynstr_append_checked(str, option_value); } else { /* char constant; escape */ field_escape(str, option_value); } }
false
false
false
false
false
0
gt_computePackedIndexDefaults(struct bwtOptions *paramOutput, int extraToggles) { if (gt_option_is_set(paramOutput->useLocateBitmapOption)) paramOutput->final.featureToggles |= (paramOutput->useLocateBitmap?BWTLocateBitmap:BWTLocateCount); else paramOutput->final.featureToggles |= estimateBestLocateTypeFeature(paramOutput); if (paramOutput->final.sourceRankInterval >= 0 || paramOutput->useSourceRank) paramOutput->final.featureToggles |= BWTReversiblySorted; paramOutput->final.featureToggles |= extraToggles; paramOutput->final.seqParams.EISFeatureSet = gt_convertBWTOptFlags2EISFeatures(paramOutput->defaultOptimizationFlags); }
false
false
false
false
false
0
GetLocalFromGlobalCoordinates(const VectorType & globalPt, VectorType & localPt) const { Float x, x1, x2, x3, y, y1, y2, y3, A; localPt.set_size(3); x = globalPt[0]; y = globalPt[1]; x1 = this->m_node[0]->GetCoordinates()[0]; y1 = this->m_node[0]->GetCoordinates()[1]; x2 = this->m_node[1]->GetCoordinates()[0]; y2 = this->m_node[1]->GetCoordinates()[1]; x3 = this->m_node[2]->GetCoordinates()[0]; y3 = this->m_node[2]->GetCoordinates()[1]; A = x1 * y2 - x2 * y1 + x3 * y1 - x1 * y3 + x2 * y3 - x3 * y2; localPt[0] = ( ( y2 - y3 ) * x + ( x3 - x2 ) * y + x2 * y3 - x3 * y2 ) / A; localPt[1] = ( ( y3 - y1 ) * x + ( x1 - x3 ) * y + x3 * y1 - x1 * y3 ) / A; localPt[2] = ( ( y1 - y2 ) * x + ( x2 - x1 ) * y + x1 * y2 - x2 * y1 ) / A; if( localPt[0] < 0.0 || localPt[0] > 1.0 || localPt[1] < 0.0 || localPt[1] > 1.0 || localPt[2] < 0.0 || localPt[2] > 1.0 ) { return false; } else { return true; } }
false
false
false
false
false
0
tracker_spawn (gchar **argv, gint timeout, gchar **tmp_stdout, gchar **tmp_stderr, gint *exit_status) { GError *error = NULL; GSpawnFlags flags; gboolean result; g_return_val_if_fail (argv != NULL, FALSE); g_return_val_if_fail (argv[0] != NULL, FALSE); g_return_val_if_fail (timeout >= 0, FALSE); flags = G_SPAWN_SEARCH_PATH; if (tmp_stderr == NULL) flags |= G_SPAWN_STDERR_TO_DEV_NULL; if (!tmp_stdout) { flags = flags | G_SPAWN_STDOUT_TO_DEV_NULL; } result = g_spawn_sync (NULL, argv, NULL, flags, tracker_spawn_child_func, GINT_TO_POINTER (timeout), tmp_stdout, tmp_stderr, exit_status, &error); if (error) { g_warning ("Could not spawn command:'%s', %s", argv[0], error->message); g_error_free (error); } return result; }
false
false
false
false
false
0
RS_isRegis(const char *str) { int state = RS_IN_WAIT; const char *c = str; while (*c) { if (state == RS_IN_WAIT) { if (t_isalpha(c)) /* okay */ ; else if (t_iseq(c, '[')) state = RS_IN_ONEOF; else return false; } else if (state == RS_IN_ONEOF) { if (t_iseq(c, '^')) state = RS_IN_NONEOF; else if (t_isalpha(c)) state = RS_IN_ONEOF_IN; else return false; } else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF) { if (t_isalpha(c)) /* okay */ ; else if (t_iseq(c, ']')) state = RS_IN_WAIT; else return false; } else elog(ERROR, "internal error in RS_isRegis: state %d", state); c += pg_mblen(c); } return (state == RS_IN_WAIT); }
false
false
false
false
false
0
build_objc_method_call (location_t loc, int super_flag, tree method_prototype, tree lookup_object, tree selector, tree method_params) { tree sender = (super_flag ? umsg_super_decl : (flag_objc_direct_dispatch ? umsg_fast_decl : umsg_decl)); tree rcv_p = (super_flag ? objc_super_type : objc_object_type); vec<tree, va_gc> *parms; vec<tree, va_gc> *tv; unsigned nparm = (method_params ? list_length (method_params) : 0); /* If a prototype for the method to be called exists, then cast the sender's return type and arguments to match that of the method. Otherwise, leave sender as is. */ tree ret_type = (method_prototype ? TREE_VALUE (TREE_TYPE (method_prototype)) : objc_object_type); tree ftype = build_function_type_for_method (ret_type, method_prototype, METHOD_REF, super_flag); tree sender_cast; tree method, t; if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype)) ftype = build_type_attribute_variant (ftype, METHOD_TYPE_ATTRIBUTES (method_prototype)); sender_cast = build_pointer_type (ftype); lookup_object = build_c_cast (loc, rcv_p, lookup_object); /* Use SAVE_EXPR to avoid evaluating the receiver twice. */ lookup_object = save_expr (lookup_object); /* Param list + 2 slots for object and selector. */ vec_alloc (parms, nparm + 2); vec_alloc (tv, 2); /* First, call the lookup function to get a pointer to the method, then cast the pointer, then call it with the method arguments. */ tv->quick_push (lookup_object); tv->quick_push (selector); method = build_function_call_vec (loc, sender, tv, NULL); vec_free (tv); /* Pass the appropriate object to the method. */ parms->quick_push ((super_flag ? self_decl : lookup_object)); /* Pass the selector to the method. */ parms->quick_push (selector); /* Now append the remainder of the parms. */ if (nparm) for (; method_params; method_params = TREE_CHAIN (method_params)) parms->quick_push (TREE_VALUE (method_params)); /* Build an obj_type_ref, with the correct cast for the method call. */ t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object, size_zero_node); t = build_function_call_vec (loc, t, parms, NULL); vec_free (parms); return t; }
false
false
false
false
false
0
bcf_idx_core(bcf_t *bp, bcf_hdr_t *h) { bcf_idx_t *idx; int32_t last_coor, last_tid; uint64_t last_off; kstring_t *str; BGZF *fp = bp->fp; bcf1_t *b; int ret; b = calloc(1, sizeof(bcf1_t)); str = calloc(1, sizeof(kstring_t)); idx = (bcf_idx_t*)calloc(1, sizeof(bcf_idx_t)); idx->n = h->n_ref; idx->index2 = calloc(h->n_ref, sizeof(bcf_lidx_t)); last_tid = 0xffffffffu; last_off = bgzf_tell(fp); last_coor = 0xffffffffu; while ((ret = bcf_read(bp, h, b)) > 0) { int end, tmp; if (last_tid != b->tid) { // change of chromosomes last_tid = b->tid; } else if (last_coor > b->pos) { fprintf(stderr, "[bcf_idx_core] the input is out of order\n"); free(str->s); free(str); free(idx); bcf_destroy(b); return 0; } tmp = strlen(b->ref); end = b->pos + (tmp > 0? tmp : 1); insert_offset2(&idx->index2[b->tid], b->pos, end, last_off); last_off = bgzf_tell(fp); last_coor = b->pos; } free(str->s); free(str); bcf_destroy(b); return idx; }
false
false
false
false
false
0
gsm_store_foreach (GsmStore *store, GsmStoreFunc func, gpointer user_data) { g_return_if_fail (store != NULL); g_return_if_fail (func != NULL); g_hash_table_find (store->priv->objects, (GHRFunc)func, user_data); }
false
false
false
false
false
0
rc_proc_getent(const char *ent) { #ifdef __linux__ FILE *fp; char *proc, *p, *value = NULL; size_t i, len; if (!exists("/proc/cmdline")) return NULL; if (!(fp = fopen("/proc/cmdline", "r"))) return NULL; proc = NULL; i = 0; if (rc_getline(&proc, &i, fp) == -1 || proc == NULL) return NULL; if (proc != NULL) { len = strlen(ent); while ((p = strsep(&proc, " "))) { if (strncmp(ent, p, len) == 0 && (p[len] == '\0' || p[len] == ' ' || p[len] == '=')) { p += len; if (*p == '=') p++; value = xstrdup(p); } } } if (!value) errno = ENOENT; fclose(fp); free(proc); return value; #else return NULL; #endif }
false
false
true
false
true
1
page_objects_list_insert(fz_context *ctx, pdf_write_options *opts, int page, int object) { page_objects_list_ensure(ctx, &opts->page_object_lists, page+1); if (opts->page_object_lists->len < page+1) opts->page_object_lists->len = page+1; page_objects_insert(ctx, &opts->page_object_lists->page[page], object); }
false
false
false
false
false
0
detect_surround_target() { #define DIMENSION 3 #define CHECK_SIZE DIMENSION*DIMENSION int curXLoc = next_x_loc(); int curYLoc = next_y_loc(); int checkXLoc, checkYLoc, xShift, yShift; Unit *targetPtr; Location *locPtr; short targetRecno; for(int i=2; i<=CHECK_SIZE; ++i) { misc.cal_move_around_a_point(i, DIMENSION, DIMENSION, xShift, yShift); checkXLoc = curXLoc+xShift; checkYLoc = curYLoc+yShift; if(checkXLoc<0 || checkXLoc>=MAX_WORLD_X_LOC || checkYLoc<0 || checkYLoc>=MAX_WORLD_Y_LOC) continue; locPtr = world.get_loc(checkXLoc, checkYLoc); if(locPtr->has_unit(UNIT_LAND)) { targetRecno = locPtr->unit_recno(UNIT_LAND); if(unit_array.is_deleted(targetRecno)) continue; targetPtr = unit_array[targetRecno]; if(targetPtr->nation_recno==nation_recno) continue; if(idle_detect_unit_checking(targetRecno)) { attack_unit(targetRecno); return 1; } } } return 0; }
false
false
false
false
false
0
OpComplete(ClientInfo *pClient, int Err) { pClient->Err = Err; if(pClient->Complete != NULL) { pClient->Complete(pClient); } else { DeleteClient(pClient); } }
false
false
false
false
false
0
fastjetsiscone_(const double * p, const int & npart, const double & R, const double & f, double * f77jets, int & njets) { // prepare jet def plugin.reset(new SISConePlugin(R,f)); jet_def = plugin.get(); // do everything transfer_cluster_transfer(p,npart,jet_def,f77jets,njets); }
false
false
false
false
false
0
DailyRollingFileAppender( const Properties& properties) : FileAppender(properties, std::ios::app) , maxBackupIndex(10) { DailyRollingFileSchedule theSchedule = DAILY; tstring scheduleStr = properties.getProperty(LOG4CPLUS_TEXT("Schedule")); scheduleStr = helpers::toUpper(scheduleStr); if(scheduleStr == LOG4CPLUS_TEXT("MONTHLY")) theSchedule = MONTHLY; else if(scheduleStr == LOG4CPLUS_TEXT("WEEKLY")) theSchedule = WEEKLY; else if(scheduleStr == LOG4CPLUS_TEXT("DAILY")) theSchedule = DAILY; else if(scheduleStr == LOG4CPLUS_TEXT("TWICE_DAILY")) theSchedule = TWICE_DAILY; else if(scheduleStr == LOG4CPLUS_TEXT("HOURLY")) theSchedule = HOURLY; else if(scheduleStr == LOG4CPLUS_TEXT("MINUTELY")) theSchedule = MINUTELY; else { getLogLog().warn( LOG4CPLUS_TEXT("DailyRollingFileAppender::ctor()- \"Schedule\" not valid: ") + properties.getProperty(LOG4CPLUS_TEXT("Schedule"))); theSchedule = DAILY; } if(properties.exists( LOG4CPLUS_TEXT("MaxBackupIndex") )) { tstring tmp = properties.getProperty(LOG4CPLUS_TEXT("MaxBackupIndex")); maxBackupIndex = std::atoi(LOG4CPLUS_TSTRING_TO_STRING(tmp).c_str()); } init(theSchedule); }
false
false
false
false
false
0
Flags2String(int flags, const Flag *descr, const std::string &sep) { std::list<std::string> tmp; while (descr->m_flag) { if (flags & descr->m_flag) { tmp.push_back(descr->m_description); } ++descr; } return boost::join(tmp, ", "); }
false
false
false
false
false
0
canSplitCriticalExits(const SplitAnalysis::LoopBlocks &Blocks, BlockPtrSet &CriticalExits) { // If we don't allow critical edge splitting, require no critical exits. if (!AllowSplit) return CriticalExits.empty(); for (BlockPtrSet::iterator I = CriticalExits.begin(), E = CriticalExits.end(); I != E; ++I) { const MachineBasicBlock *Succ = *I; // We want to insert a new pre-exit MBB before Succ, and change all the // in-loop blocks to branch to the pre-exit instead of Succ. // Check that all the in-loop predecessors can be changed. for (MachineBasicBlock::const_pred_iterator PI = Succ->pred_begin(), PE = Succ->pred_end(); PI != PE; ++PI) { const MachineBasicBlock *Pred = *PI; // The external predecessors won't be altered. if (!Blocks.Loop.count(Pred) && !Blocks.Preds.count(Pred)) continue; if (!canAnalyzeBranch(Pred)) return false; } // If Succ's layout predecessor falls through, that too must be analyzable. // We need to insert the pre-exit block in the gap. MachineFunction::const_iterator MFI = Succ; if (MFI == mf_.begin()) continue; if (!canAnalyzeBranch(--MFI)) return false; } // No problems found. return true; }
false
false
false
false
false
0
initValue(GraphView const *gv, unsigned int chain) { double const *x = gv->nodes()[0]->value(chain); unsigned int N = gv->nodes()[0]->length(); vector<double> ivalue(N); for (unsigned int i = 0; i < N; ++i) { ivalue[i] = x[i]; } return ivalue; }
false
false
false
false
false
0
append_char(char **pp, char *e, char c) { if (*pp < e) *(*pp)++ = c; }
false
false
false
false
false
0
varm(aELEMENT *vary) { if (vary) { vazap(vary, 0, aLen(vary)); joe_free((int *) vary - 2); } }
false
false
false
false
false
0
_dbus_type_reader_read_raw (const DBusTypeReader *reader, const unsigned char **value_location) { _dbus_assert (!reader->klass->types_only); *value_location = _dbus_string_get_const_data_len (reader->value_str, reader->value_pos, 0); }
false
false
false
false
false
0
qcCopyValue(VimosDescriptor *header, const char *name, const char *unit, const char *comment) { const char fctid[] = "qcCopyValue"; VimosDescriptor *desc; int status = EXIT_FAILURE; int i; char *pafName; char *keep; char *pos; int ivalue; float fvalue; double dvalue; char *svalue = NULL; if (header == NULL) { cpl_msg_error(fctid, "Missing header!"); return status; } desc = findDescriptor(header, name); if (!desc) { cpl_msg_error(fctid, "Descriptor %s not found!", name); return status; } switch (desc->descType) { case VM_INT : ivalue = desc->descValue->i; break; case VM_FLOAT : fvalue = desc->descValue->f; break; case VM_DOUBLE : dvalue = desc->descValue->d; break; case VM_STRING : svalue = pil_strdup(desc->descValue->s); if (!svalue) { cpl_msg_error(fctid, "Memory failure!"); return status; } break; default : cpl_msg_error(fctid, "Unsupported descriptor type!"); return status; } /* * Construct entry name for PAF */ keep = pafName = pil_strdup(name); if (!pafName) { if (svalue) pil_free(svalue); cpl_msg_error(fctid, "Memory failure!"); return status; } pos = strstr(pafName, "ESO "); if (pos == pafName) pafName += 4; for (i = 0; pafName[i] != '\0'; i++) if (pafName[i] == ' ') pafName[i] = '.'; /* * Now write entry to PAF object. */ switch (desc->descType) { case VM_INT : status = pilQcWriteInt(pafName, ivalue, unit, comment); break; case VM_FLOAT : dvalue = fvalue; case VM_DOUBLE : status = pilQcWriteDouble(pafName, dvalue, unit, comment); break; default : /* VM_STRING */ status = pilQcWriteString(pafName, svalue, comment); } if (status) cpl_msg_error(fctid, "Could not copy descriptor value to QC1 PAF!"); if (svalue) pil_free(svalue); pil_free(keep); return status; }
false
false
false
false
false
0
xfs_btree_check_block( struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_block *block, /* generic btree block pointer */ int level, /* level of the btree block */ struct xfs_buf *bp) /* buffer containing block, if any */ { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) return xfs_btree_check_lblock(cur, block, level, bp); else return xfs_btree_check_sblock(cur, block, level, bp); }
false
false
false
false
false
0
render(Window& srcWindow, const ColourRect* modcols, const Rect* clipper) const { // TODO: Fix layer priority handling // render all layers defined for this state for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr) (*curr).render(srcWindow, modcols, clipper, d_clipToDisplay); }
false
false
false
false
false
0
c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long len) { ASN1_OBJECT *ret=NULL; const unsigned char *p; unsigned char *data; int i; /* Sanity check OID encoding: can't have leading 0x80 in * subidentifiers, see: X.690 8.19.2 */ for (i = 0, p = *pp; i < len; i++, p++) { if (*p == 0x80 && (!i || !(p[-1] & 0x80))) { ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING); return NULL; } } /* only the ASN1_OBJECTs from the 'table' will have values * for ->sn or ->ln */ if ((a == NULL) || ((*a) == NULL) || !((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) { if ((ret=ASN1_OBJECT_new()) == NULL) return(NULL); } else ret=(*a); p= *pp; /* detach data from object */ data = (unsigned char *)ret->data; ret->data = NULL; /* once detached we can change it */ if ((data == NULL) || (ret->length < len)) { ret->length=0; if (data != NULL) OPENSSL_free(data); data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); if (data == NULL) { i=ERR_R_MALLOC_FAILURE; goto err; } ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; } memcpy(data,p,(int)len); /* reattach data to object, after which it remains const */ ret->data =data; ret->length=(int)len; ret->sn=NULL; ret->ln=NULL; /* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */ p+=len; if (a != NULL) (*a)=ret; *pp=p; return(ret); err: ASN1err(ASN1_F_C2I_ASN1_OBJECT,i); if ((ret != NULL) && ((a == NULL) || (*a != ret))) ASN1_OBJECT_free(ret); return(NULL); }
false
false
false
false
false
0
evthread_notify_base(struct event_base *base) { EVENT_BASE_ASSERT_LOCKED(base); if (!base->th_notify_fn) return -1; if (base->is_notify_pending) return 0; base->is_notify_pending = 1; return base->th_notify_fn(base); }
false
false
false
false
false
0
float_up(heap_context ctx, int i, void *elt) { int p; for ( p = heap_parent(i); i > 1 && ctx->higher_priority(elt, ctx->heap[p]); i = p, p = heap_parent(i) ) { ctx->heap[i] = ctx->heap[p]; if (ctx->index != NULL) (ctx->index)(ctx->heap[i], i); } ctx->heap[i] = elt; if (ctx->index != NULL) (ctx->index)(ctx->heap[i], i); }
false
false
false
false
false
0
dump_attrs_list (attrs list) { for (; list; list = list->next) { if (dv_is_decl_p (list->dv)) print_mem_expr (dump_file, dv_as_decl (list->dv)); else print_rtl_single (dump_file, dv_as_value (list->dv)); fprintf (dump_file, "+" HOST_WIDE_INT_PRINT_DEC, list->offset); } fprintf (dump_file, "\n"); }
false
false
false
false
false
0
load_special(name) const char *name; { dlb *fd; boolean result = FALSE; char c; struct version_info vers_info; fd = dlb_fopen(name, RDBMODE); if (!fd) return FALSE; Fread((genericptr_t) &vers_info, sizeof vers_info, 1, fd); if (!check_version(&vers_info, name, TRUE)) goto give_up; Fread((genericptr_t) &c, sizeof c, 1, fd); /* c Header */ switch (c) { case SP_LEV_ROOMS: result = load_rooms(fd); break; case SP_LEV_MAZE: result = load_maze(fd); break; default: /* ??? */ result = FALSE; } give_up: (void)dlb_fclose(fd); return result; }
false
false
false
false
false
0
aodv_extension(const struct aodv_ext *ep, u_int length) { u_int i; const struct aodv_hello *ah; switch (ep->type) { case AODV_EXT_HELLO: if (snapend < (u_char *) ep) { printf(" [|hello]"); return; } i = min(length, (u_int)(snapend - (u_char *)ep)); if (i < sizeof(struct aodv_hello)) { printf(" [|hello]"); return; } i -= sizeof(struct aodv_hello); ah = (void *)ep; printf("\n\text HELLO %ld ms", (unsigned long)EXTRACT_32BITS(&ah->interval)); break; default: printf("\n\text %u %u", ep->type, ep->length); break; } }
false
false
false
false
false
0
directory_info_has_arrived(time_t now, int from_cache) { const or_options_t *options = get_options(); if (!router_have_minimum_dir_info()) { int quiet = directory_too_idle_to_fetch_descriptors(options, now); log(quiet ? LOG_INFO : LOG_NOTICE, LD_DIR, "I learned some more directory information, but not enough to " "build a circuit: %s", get_dir_info_status_string()); update_all_descriptor_downloads(now); return; } else { if (directory_fetches_from_authorities(options)) { update_all_descriptor_downloads(now); } /* if we have enough dir info, then update our guard status with * whatever we just learned. */ entry_guards_compute_status(options, now); /* Don't even bother trying to get extrainfo until the rest of our * directory info is up-to-date */ if (options->DownloadExtraInfo) update_extrainfo_downloads(now); } if (server_mode(options) && !net_is_disabled() && !from_cache && (can_complete_circuit || !any_predicted_circuits(now))) consider_testing_reachability(1, 1); }
false
false
false
false
false
0
get_colours (guint i, guint *bcol, guint *fcol) { guint tmp; /* ensure that we are within 1..10 */ i = i % 10; switch (i) { case 0: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_01); break; case 1: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_02); break; case 2: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_03); break; case 3: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_04); break; case 4: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_05); break; case 5: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_06); break; case 6: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_07); break; case 7: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_08); break; case 8: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_09); break; case 9: tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_10); break; default: sat_log_log (SAT_LOG_LEVEL_BUG, _("%s:%d: Colour index out of valid range (%d)"), __FILE__, __LINE__, i); tmp = sat_cfg_get_int (SAT_CFG_INT_SKYATGL_COL_01); break; } /* border colour is solid with no tranparency */ *bcol = (tmp * 0x100) | 0xFF; /* fill colour is slightly transparent */ *fcol = (tmp * 0x100) | 0xA0; }
false
false
false
false
false
0
msp_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq) { struct msp_state *state = to_state(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", freq); switch (freq) { case 1024000: state->i2s_mode = 0; break; case 2048000: state->i2s_mode = 1; break; default: return -EINVAL; } return 0; }
false
false
false
false
false
0
solo_valid_pixfmt(u32 pixfmt, int dev_type) { return (pixfmt == V4L2_PIX_FMT_H264 && dev_type == SOLO_DEV_6110) || (pixfmt == V4L2_PIX_FMT_MPEG4 && dev_type == SOLO_DEV_6010) || pixfmt == V4L2_PIX_FMT_MJPEG ? 0 : -EINVAL; }
false
false
false
false
false
0
xfxp(int nset, double x, double Q, double P2, int ip, int fl) { vector<double> r(13); fevolvepdfpm(&nset, &x, &Q, &P2, &ip, &r[0]); return r[fl+6]; }
false
false
false
false
false
0
is_authorized(struct connection *conn, const char *path, int is_directory) { FILE *fp; int authorized = MG_TRUE; if ((fp = open_auth_file(conn, path, is_directory)) != NULL) { authorized = mg_authorize_digest(&conn->mg_conn, fp); fclose(fp); } return authorized; }
false
false
false
false
false
0
selectUpperIslands(Island *f,int nX,int nY,int *incomplete) { int i,j; Island *l,*g; l=NULL; for(i=f->endX+f->endY+2,j=nX+nY-2;i<=j;i++) for(g=ZB[i];g;g=g->nextBeginIndex) if(g->beginX>f->endX&&g->beginY>f->endY) { if(!g->hasUpper) {*incomplete=TRUE; return(NULL);} g->nextSelected=l; l=g; } *incomplete=FALSE; return(l); }
false
false
false
false
false
0
PyFF_Font_get_woffMajor(PyFF_Font *self,void *closure) { int version = self->fv->sf->woffMajor; if ( version==woffUnset ) Py_RETURN_NONE; return( Py_BuildValue("i", version )); }
false
false
false
false
false
0
FuncHASH_FLAGS ( Obj self, Obj flags ) { Int4 hash; Int4 x; Int len; UInt4 * ptr; Int i; /* do some trivial checks */ while ( TNUM_OBJ(flags) != T_FLAGS ) { flags = ErrorReturnObj( "<flags> must be a flags list (not a %s)", (Int)TNAM_OBJ(flags), 0L, "you can replace <flags> via 'return <flags>;'" ); } if ( HASH_FLAGS(flags) != 0 ) { return HASH_FLAGS(flags); } /* do the real work*/ #ifndef SYS_IS_64_BIT /* 32 bit case -- this is the "defining" case, others are adjusted to comply with this */ len = NRB_FLAGS(flags); ptr = (UInt4 *)BLOCKS_FLAGS(flags); hash = 0; x = 1; for ( i = len; i >= 1; i-- ) { hash = (hash + (*ptr % HASH_FLAGS_SIZE) * x) % HASH_FLAGS_SIZE; x = ((8*sizeof(UInt4)-1) * x) % HASH_FLAGS_SIZE; ptr++; } #else #ifdef WORDS_BIGENDIAN /* This is the hardest case */ len = NRB_FLAGS(flags); ptr = (UInt4 *)BLOCKS_FLAGS(flags); hash = 0; x = 1; for ( i = len; i >= 1; i-- ) { /* least significant 32 bits first */ hash = (hash + (ptr[1] % HASH_FLAGS_SIZE) * x) % HASH_FLAGS_SIZE; x = ((8*sizeof(UInt4)-1) * x) % HASH_FLAGS_SIZE; /* now the more significant */ hash = (hash + (*ptr % HASH_FLAGS_SIZE) * x) % HASH_FLAGS_SIZE; x = ((8*sizeof(UInt4)-1) * x) % HASH_FLAGS_SIZE; ptr+= 2; } #else /* and the middle case -- for DEC alpha, the 32 bit chunks are in the right order, and we merely have to be sure to process them as 32 bit chunks */ len = NRB_FLAGS(flags)*(sizeof(UInt)/sizeof(UInt4)); ptr = (UInt4 *)BLOCKS_FLAGS(flags); hash = 0; x = 1; for ( i = len; i >= 1; i-- ) { hash = (hash + (*ptr % HASH_FLAGS_SIZE) * x) % HASH_FLAGS_SIZE; x = ((8*sizeof(UInt4)-1) * x) % HASH_FLAGS_SIZE; ptr++; } #endif #endif SET_HASH_FLAGS( flags, INTOBJ_INT((UInt)hash+1) ); CHANGED_BAG(flags); return HASH_FLAGS(flags); }
false
false
false
false
false
0
HighlightVisibleChildren(ListTreeWidget w, ListTreeItem * item, Boolean state, Boolean draw) #else static void HighlightVisibleChildren(w, item, state, draw) ListTreeWidget w; ListTreeItem * item; Boolean state; Boolean draw; #endif { while (item) { HighlightItem(w, item, state, draw); if (item->firstchild && item->open) { HighlightVisibleChildren(w, item->firstchild, state, draw); } item = item->nextsibling; } }
false
false
false
false
false
0
process_scan_header(jpeg *z) { int i; int Ls = get16(z->s); z->scan_n = get8(z->s); if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return e("bad SOS component count","Corrupt JPEG"); if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG"); for (i=0; i < z->scan_n; ++i) { int id = get8(z->s), which; int q = get8(z->s); for (which = 0; which < z->s->img_n; ++which) if (z->img_comp[which].id == id) break; if (which == z->s->img_n) return 0; z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG"); z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG"); z->order[i] = which; } if (get8(z->s) != 0) return e("bad SOS","Corrupt JPEG"); get8(z->s); // should be 63, but might be 0 if (get8(z->s) != 0) return e("bad SOS","Corrupt JPEG"); return 1; }
false
false
false
false
false
0
gamgi_engine_link_object_cell (gamgi_object *object, gamgi_cell *cell) { /****************************** * bonds have no cell parents * ******************************/ switch (object->class) { case GAMGI_ENGINE_TEXT: gamgi_engine_link_text_cell (GAMGI_CAST_TEXT object, cell); break; case GAMGI_ENGINE_ORBITAL: gamgi_engine_link_orbital_cell (GAMGI_CAST_ORBITAL object, cell); break; case GAMGI_ENGINE_ATOM: gamgi_engine_link_atom_cell (GAMGI_CAST_ATOM object, cell); break; case GAMGI_ENGINE_DIRECTION: gamgi_engine_link_direction_cell (GAMGI_CAST_DIRECTION object, cell); break; case GAMGI_ENGINE_PLANE: gamgi_engine_link_plane_cell (GAMGI_CAST_PLANE object, cell); break; case GAMGI_ENGINE_GROUP: gamgi_engine_link_group_cell (GAMGI_CAST_GROUP object, cell); break; case GAMGI_ENGINE_MOLECULE: gamgi_engine_link_molecule_cell (GAMGI_CAST_MOLECULE object, cell); break; case GAMGI_ENGINE_CLUSTER: gamgi_engine_link_cluster_cell (GAMGI_CAST_CLUSTER object, cell); break; default: break; } }
false
false
false
false
false
0
eval_state(state_t *state) { int ret; #ifdef USE_HASH_EVAL if (!hash_get_eval(state->zobrist, &ret)) { #endif int wmaterial = eval_material(state, WHITE); int bmaterial = eval_material(state, BLACK); int is_endgame = wmaterial < 1300 && bmaterial < 1300; ret = wmaterial - bmaterial; ret += eval_pawns(state, WHITE) - eval_pawns(state, BLACK); ret += eval_knights(state, WHITE) - eval_knights(state, BLACK); ret += eval_bishops(state, WHITE) - eval_bishops(state, BLACK); ret += eval_rooks(state, WHITE) - eval_rooks(state, BLACK); ret += eval_queens(state, WHITE) - eval_queens(state, BLACK); if (is_endgame) { ret += eval_kings_eg(state, WHITE) - eval_kings_eg(state, BLACK); } else { ret += eval_kings(state, WHITE) - eval_kings(state, BLACK); } if (state->turn != WHITE) ret = -ret; #ifdef USE_HASH_EVAL hash_add_eval(state->zobrist, ret); } #endif return ret; }
false
false
false
false
false
0
compute_ld_motion_mems (void) { struct ls_expr * ptr; basic_block bb; rtx insn; pre_ldst_mems = NULL; FOR_EACH_BB (bb) { for (insn = BB_HEAD (bb); insn && insn != NEXT_INSN (BB_END (bb)); insn = NEXT_INSN (insn)) { if (INSN_P (insn)) { if (GET_CODE (PATTERN (insn)) == SET) { rtx src = SET_SRC (PATTERN (insn)); rtx dest = SET_DEST (PATTERN (insn)); /* Check for a simple LOAD... */ if (GET_CODE (src) == MEM && simple_mem (src)) { ptr = ldst_entry (src); if (GET_CODE (dest) == REG) ptr->loads = alloc_INSN_LIST (insn, ptr->loads); else ptr->invalid = 1; } else { /* Make sure there isn't a buried load somewhere. */ invalidate_any_buried_refs (src); } /* Check for stores. Don't worry about aliased ones, they will block any movement we might do later. We only care about this exact pattern since those are the only circumstance that we will ignore the aliasing info. */ if (GET_CODE (dest) == MEM && simple_mem (dest)) { ptr = ldst_entry (dest); if (GET_CODE (src) != MEM && GET_CODE (src) != ASM_OPERANDS /* Check for REG manually since want_to_gcse_p returns 0 for all REGs. */ && (REG_P (src) || want_to_gcse_p (src))) ptr->stores = alloc_INSN_LIST (insn, ptr->stores); else ptr->invalid = 1; } } else invalidate_any_buried_refs (PATTERN (insn)); } } } }
false
false
false
false
false
0
add_layer_request(struct FlattenSpec *spec, const char *layer) { spec->layers = realloc(spec->layers, sizeof(struct xcfLayer) * (1+spec->numLayers)); if( spec->layers == NULL ) FatalUnexpected(_("Out of memory")); spec->layers[spec->numLayers].name = layer ; spec->layers[spec->numLayers].mode = (GimpLayerModeEffects)-1 ; spec->layers[spec->numLayers].opacity = 9999 ; spec->layers[spec->numLayers].hasMask = -1 ; spec->numLayers++ ; }
false
false
false
false
false
0
cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) { const unsigned int *flagp = type->of; int n = 0; cfg_print_chars(pctx, "( ", 2); if (*flagp & CFG_ADDR_V4OK) { cfg_print_cstr(pctx, "<ipv4_address>"); n++; } if (*flagp & CFG_ADDR_V6OK) { if (n != 0) cfg_print_chars(pctx, " | ", 3); cfg_print_cstr(pctx, "<ipv6_address>"); n++; } if (*flagp & CFG_ADDR_WILDOK) { if (n != 0) cfg_print_chars(pctx, " | ", 3); cfg_print_chars(pctx, "*", 1); n++; POST(n); } cfg_print_chars(pctx, " ) ", 3); if (*flagp & CFG_ADDR_WILDOK) { cfg_print_cstr(pctx, "[ port ( <integer> | * ) ]"); } else { cfg_print_cstr(pctx, "[ port <integer> ]"); } if ((*flagp & CFG_ADDR_DSCPOK) != 0) { cfg_print_cstr(pctx, " [ dscp <integer> ]"); } }
false
false
false
false
false
0
opendev(double width, double height, GLEFileLocation* outputfile, const string& inputfile) throw(ParserError) { m_width = width; m_height = height; m_OutputName.copy(outputfile); m_OutputName.addExtension(g_device_to_ext(getDeviceType())); m_surface = cairo_svg_surface_create(m_OutputName.getFullPath().c_str(), 72*width/CM_PER_INCH+2, 72*height/CM_PER_INCH+2); cairo_surface_set_fallback_resolution(m_surface, m_resolution, m_resolution); m_cr = cairo_create(m_surface); computeBoundingBox(width, height); g_scale(PS_POINTS_PER_INCH/CM_PER_INCH, PS_POINTS_PER_INCH/CM_PER_INCH); if (!g_is_fullpage()) { g_translate(1.0*CM_PER_INCH/72, 1.0*CM_PER_INCH/72); } }
false
false
false
false
false
0
pushcli(void) { int eflags; eflags = read_eflags(); cli(); if(cpus[cpu()].ncli++ == 0) cpus[cpu()].intena = eflags & FL_IF; }
false
false
false
false
false
0
send_game_beacon() { static uint32_t ticks = 0; uint32_t player_id; uint32_t cur_ticks; cur_ticks = misc.get_time(); if (game_sock && (cur_ticks > ticks + 3000 || cur_ticks < ticks)) { // send the session beacon struct MsgGameBeacon p; ticks = cur_ticks; p.msg_id = MPMSG_GAME_BEACON; strncpy(p.name, joined_session.session_name, MP_SESSION_NAME_LEN); if (joined_session.password[0]) p.password = 1; else p.password = 0; send_system_msg(game_sock, (char *)&p, sizeof(struct MsgGameBeacon), &lan_broadcast_address); if (use_remote_session_provider) { send_system_msg(game_sock, (char *)&p, sizeof(struct MsgGameBeacon), &remote_session_provider_address); } } }
false
false
false
false
false
0
xstrset(char *&mem,const char *s,size_t len) { if(!s) { xfree(mem); return mem=0; } #ifdef MEM_DEBUG printf("xstrset \"%.*s\"\n",len,s); #endif if(s==mem) { mem[len]=0; return mem; } size_t old_len=(mem?strlen(mem)+1:0); if(mem && s>mem && s<mem+old_len) { memmove(mem,s,len); mem[len]=0; return mem; } if(old_len<len+1) mem=(char*)xrealloc(mem,len+1); memcpy(mem,s,len); mem[len]=0; return mem; }
false
false
false
false
false
0
getParamValue() { string value; if((value = Utils::Xml::get_property(param_cur, "value")) != "") return value; else return Utils::Xml::get_property(param_cur, "default"); }
false
false
false
false
false
0
DoValAndDictTypesMatch( QTYPES eValType, FLMUINT uiDictType) { if (uiDictType > FLM_CONTEXT_TYPE) { return( FALSE); } else { // subtract 1 from QTYPES - array doesn't have space for the NO_TYPE enum return gv_DoValAndDictTypesMatch[ ((int)eValType) - FIRST_VALUE][ uiDictType]; } }
false
false
false
false
false
0
mono_bitset_clone (const MonoBitSet *set, guint32 new_size) { MonoBitSet *result; if (!new_size) new_size = set->size; result = mono_bitset_new (new_size, set->flags); result->flags &= ~MONO_BITSET_DONT_FREE; memcpy (result->data, set->data, set->size / 8); return result; }
false
false
false
false
false
0
getCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue) { if (_getCharPropertyFn) return _getCharPropertyFn(_widget, prop, index, defaultValue); else return defaultValue; }
false
false
false
false
false
0
ccid_error(int error, const char *file, int line, const char *function) { const char *text; char var_text[30]; switch (error) { case 0x00: text = "Command not supported or not allowed"; break; case 0x01: text = "Wrong command length"; break; case 0x05: text = "Invalid slot number"; break; case 0xA2: text = "Card short-circuiting. Card powered off"; break; case 0xA3: text = "ATR too long (> 33)"; break; case 0xAB: text = "No data exchanged"; break; case 0xB0: text = "Reader in EMV mode and T=1 message too long"; break; case 0xBB: text = "Protocol error in EMV mode"; break; case 0xBD: text = "Card error during T=1 exchange"; break; case 0xBE: text = "Wrong APDU command length"; break; case 0xE0: text = "Slot busy"; break; case 0xEF: text = "PIN cancelled"; break; case 0xF0: text = "PIN timeout"; break; case 0xF2: text = "Busy with autosequence"; break; case 0xF3: text = "Deactivated protocol"; break; case 0xF4: text = "Procedure byte conflict"; break; case 0xF5: text = "Class not supported"; break; case 0xF6: text = "Protocol not supported"; break; case 0xF7: text = "Invalid ATR checksum byte (TCK)"; break; case 0xF8: text = "Invalid ATR first byte"; break; case 0xFB: text = "Hardware error"; break; case 0xFC: text = "Overrun error"; break; case 0xFD: text = "Parity error during exchange"; break; case 0xFE: text = "Card absent or mute"; break; case 0xFF: text = "Activity aborted by Host"; break; default: if ((error >= 1) && (error <= 127)) (void)snprintf(var_text, sizeof(var_text), "error on byte %d", error); else (void)snprintf(var_text, sizeof(var_text), "Unknown CCID error: 0x%02X", error); text = var_text; break; } log_msg(PCSC_LOG_ERROR, "%s:%d:%s %s", file, line, function, text); }
true
true
false
false
false
1
ixgbe_set_mux(struct ixgbe_hw *hw, u8 state) { u32 esdp; if (!hw->bus.lan_id) return; esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); if (state) esdp |= IXGBE_ESDP_SDP1; else esdp &= ~IXGBE_ESDP_SDP1; IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); IXGBE_WRITE_FLUSH(hw); }
false
false
false
false
false
0
replace_selected_text (GtkTextBuffer * buffer, const gchar * replace) { g_return_if_fail (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL)); g_return_if_fail (replace != NULL); gtk_text_buffer_begin_user_action (buffer); gtk_text_buffer_delete_selection (buffer, FALSE, TRUE); gtk_text_buffer_insert_at_cursor (buffer, replace, strlen (replace)); gtk_text_buffer_end_user_action (buffer); }
false
false
false
false
false
0
amdgpu_cgs_read_ind_register(void *cgs_device, enum cgs_ind_reg space, unsigned index) { CGS_FUNC_ADEV; switch (space) { case CGS_IND_REG__MMIO: return RREG32_IDX(index); case CGS_IND_REG__PCIE: return RREG32_PCIE(index); case CGS_IND_REG__SMC: return RREG32_SMC(index); case CGS_IND_REG__UVD_CTX: return RREG32_UVD_CTX(index); case CGS_IND_REG__DIDT: return RREG32_DIDT(index); case CGS_IND_REG__AUDIO_ENDPT: DRM_ERROR("audio endpt register access not implemented.\n"); return 0; } WARN(1, "Invalid indirect register space"); return 0; }
false
false
false
false
false
0
gst_encoding_container_profile_has_video (GstEncodingContainerProfile * profile) { const GList *l; for (l = profile->encodingprofiles; l != NULL; l = l->next) { if (GST_IS_ENCODING_VIDEO_PROFILE (l->data)) return TRUE; if (GST_IS_ENCODING_CONTAINER_PROFILE (l->data) && gst_encoding_container_profile_has_video (l->data)) return TRUE; } return FALSE; }
false
false
false
false
false
0
maybe_warn_unused_local_typedefs (void) { int i; tree decl; /* The number of times we have emitted -Wunused-local-typedefs warnings. If this is different from errorcount, that means some unrelated errors have been issued. In which case, we'll avoid emitting "unused-local-typedefs" warnings. */ static int unused_local_typedefs_warn_count; struct c_language_function *l; if (cfun == NULL) return; if ((l = (struct c_language_function *) cfun->language) == NULL) return; if (warn_unused_local_typedefs && errorcount == unused_local_typedefs_warn_count) { FOR_EACH_VEC_SAFE_ELT (l->local_typedefs, i, decl) if (!TREE_USED (decl)) warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_local_typedefs, "typedef %qD locally defined but not used", decl); unused_local_typedefs_warn_count = errorcount; } vec_free (l->local_typedefs); }
false
false
false
false
false
0
clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) { struct clk_notifier *cn = NULL; int ret = -EINVAL; if (!clk || !nb) return -EINVAL; clk_prepare_lock(); list_for_each_entry(cn, &clk_notifier_list, node) if (cn->clk == clk) break; if (cn->clk == clk) { ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); clk->core->notifier_count--; /* XXX the notifier code should handle this better */ if (!cn->notifier_head.head) { srcu_cleanup_notifier_head(&cn->notifier_head); list_del(&cn->node); kfree(cn); } } else { ret = -ENOENT; } clk_prepare_unlock(); return ret; }
false
false
false
false
false
0
gst_video_format_from_rgb24_masks (int red_mask, int green_mask, int blue_mask) { if (red_mask == 0xff0000 && green_mask == 0x00ff00 && blue_mask == 0x0000ff) { return GST_VIDEO_FORMAT_RGB; } if (red_mask == 0x0000ff && green_mask == 0x00ff00 && blue_mask == 0xff0000) { return GST_VIDEO_FORMAT_BGR; } return GST_VIDEO_FORMAT_UNKNOWN; }
false
false
false
false
false
0
GetNumberOfClippingPlanes() { int n = 0; if ( this->ClippingPlanes ) { n = this->ClippingPlanes->GetNumberOfItems(); } return n; }
false
false
false
false
false
0
onenand_read_bufferram(struct mtd_info *mtd, int area, unsigned char *buffer, int offset, size_t count) { struct onenand_chip *this = mtd->priv; void __iomem *bufferram; bufferram = this->base + area; bufferram += onenand_bufferram_offset(mtd, area); if (ONENAND_CHECK_BYTE_ACCESS(count)) { unsigned short word; /* Align with word(16-bit) size */ count--; /* Read word and save byte */ word = this->read_word(bufferram + offset + count); buffer[count] = (word & 0xff); } memcpy(buffer, bufferram + offset, count); return 0; }
false
false
false
false
false
0
parser_cxx_assist_query_calltip (ParserCxxAssist* assist, const gchar *call_context, IAnjutaIterable* calltip_iter) { /* Search file */ if (IANJUTA_IS_FILE (assist->priv->itip)) { GFile *file = ianjuta_file_get_file (IANJUTA_FILE (assist->priv->itip), NULL); if (file != NULL) { assist->priv->async_calltip_file = 1; ianjuta_symbol_query_search_file (assist->priv->calltip_query_file, call_context, file, NULL); g_object_unref (file); } } /* Search Project */ assist->priv->async_calltip_project = 1; ianjuta_symbol_query_search (assist->priv->calltip_query_project, call_context, NULL); /* Search system */ assist->priv->async_calltip_system = 1; ianjuta_symbol_query_search (assist->priv->calltip_query_system, call_context, NULL); }
false
false
false
false
false
0
debug_func (GPLogLevel level, const char *domain, const char *str, void *data) { struct timeval tv; long sec, usec; FILE *logfile = (data != NULL)?(FILE *)data:stderr; gettimeofday (&tv,NULL); sec = tv.tv_sec - glob_tv_zero.tv_sec; usec = tv.tv_usec - glob_tv_zero.tv_usec; if (usec < 0) {sec--; usec += 1000000L;} fprintf (logfile, "%li.%06li %s(%i): %s\n", sec, usec, domain, level, str); }
false
false
false
false
false
0