idx
int64 | func
string | target
int64 |
|---|---|---|
262,578
|
Filter::UpstreamRequest::~UpstreamRequest() {
if (span_ != nullptr) {
Tracing::HttpTracerUtility::finalizeUpstreamSpan(*span_, upstream_headers_.get(),
upstream_trailers_.get(), stream_info_,
Tracing::EgressConfig::get());
}
if (per_try_timeout_ != nullptr) {
// Allows for testing.
per_try_timeout_->disableTimer();
}
clearRequestEncoder();
stream_info_.setUpstreamTiming(upstream_timing_);
stream_info_.onRequestComplete();
// Prior to logging, refresh the byte size of the HeaderMaps.
// TODO(asraa): Remove this when entries in HeaderMap can no longer be modified by reference and
// HeaderMap holds an accurate internal byte size count.
if (upstream_headers_ != nullptr) {
upstream_headers_->refreshByteSize();
}
if (upstream_trailers_ != nullptr) {
upstream_trailers_->refreshByteSize();
}
for (const auto& upstream_log : parent_.config_.upstream_logs_) {
upstream_log->log(parent_.downstream_headers_, upstream_headers_.get(),
upstream_trailers_.get(), stream_info_);
}
}
| 0
|
49,841
|
char_idx2byte(char_u *str, size_t str_len, varnumber_T idx)
{
varnumber_T nchar = idx;
size_t nbyte = 0;
if (nchar >= 0)
{
while (nchar > 0 && nbyte < str_len)
{
nbyte += mb_ptr2len(str + nbyte);
--nchar;
}
}
else
{
nbyte = str_len;
while (nchar < 0 && nbyte > 0)
{
--nbyte;
nbyte -= mb_head_off(str, str + nbyte);
++nchar;
}
if (nchar < 0)
return -1;
}
return (long)nbyte;
}
| 0
|
322,402
|
static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]]+1;
tc[1] = tc0_table[index_a][bS[1]]+1;
tc[2] = tc0_table[index_a][bS[2]]+1;
tc[3] = tc0_table[index_a][bS[3]]+1;
h->h264dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
| 0
|
390,662
|
PHP_FUNCTION(log10)
{
double num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
return;
}
RETURN_DOUBLE(log10(num));
}
| 0
|
169,859
|
static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
{
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int ret = -1;
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dirpath);
if (dirfd == -1) {
goto out;
}
if ((credp->fc_uid == -1 && credp->fc_gid == -1) ||
(fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
ret = fchownat(dirfd, name, credp->fc_uid, credp->fc_gid,
AT_SYMLINK_NOFOLLOW);
} else if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
ret = local_set_xattrat(dirfd, name, credp);
} else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
ret = local_set_mapped_file_attrat(dirfd, name, credp);
}
close_preserve_errno(dirfd);
out:
g_free(name);
g_free(dirpath);
return ret;
}
| 0
|
95,058
|
CLASS ~DCRaw()
{
free(ifname);
free(ifname_display);
}
| 0
|
419,225
|
server_client_detach(struct client *c, enum msgtype msgtype)
{
struct session *s = c->session;
if (s == NULL || (c->flags & CLIENT_DETACHING))
return;
c->flags |= CLIENT_DETACHING;
notify_client("client-detached", c);
proc_send(c->peer, msgtype, -1, s->name, strlen(s->name) + 1);
}
| 0
|
449,653
|
HttpStateData::closeServer()
{
debugs(11,5, HERE << "closing HTTP server " << serverConnection << " this " << this);
if (Comm::IsConnOpen(serverConnection)) {
fwd->unregister(serverConnection);
comm_remove_close_handler(serverConnection->fd, closeHandler);
closeHandler = NULL;
serverConnection->close();
}
}
| 0
|
407,155
|
rotate_backups(const char *fname)
{
#ifdef __VMS
# define SEP "_"
# define AVS ";*" /* All-version suffix. */
# define AVSL (sizeof (AVS) - 1)
#else
# define SEP "."
# define AVSL 0
#endif
int maxlen = strlen (fname) + sizeof (SEP) + numdigit (opt.backups) + AVSL;
char *from = alloca (maxlen);
char *to = alloca (maxlen);
struct stat sb;
int i;
if (stat (fname, &sb) == 0)
if (S_ISREG (sb.st_mode) == 0)
return;
for (i = opt.backups; i > 1; i--)
{
#ifdef VMS
/* Delete (all versions of) any existing max-suffix file, to avoid
* creating multiple versions of it. (On VMS, rename() will
* create a new version of an existing destination file, not
* destroy/overwrite it.)
*/
if (i == opt.backups)
{
snprintf (to, sizeof(to), "%s%s%d%s", fname, SEP, i, AVS);
delete (to);
}
#endif
snprintf (to, maxlen, "%s%s%d", fname, SEP, i);
snprintf (from, maxlen, "%s%s%d", fname, SEP, i - 1);
if (rename (from, to))
logprintf (LOG_NOTQUIET, "Failed to rename %s to %s: (%d) %s\n",
from, to, errno, strerror (errno));
}
snprintf (to, maxlen, "%s%s%d", fname, SEP, 1);
if (rename(fname, to))
logprintf (LOG_NOTQUIET, "Failed to rename %s to %s: (%d) %s\n",
fname, to, errno, strerror (errno));
}
| 0
|
471,110
|
parse_absolute_time(const char *s, uint64_t *tp)
{
struct tm tm;
time_t tt;
char buf[32], *fmt;
*tp = 0;
/*
* POSIX strptime says "The application shall ensure that there
* is white-space or other non-alphanumeric characters between
* any two conversion specifications" so arrange things this way.
*/
switch (strlen(s)) {
case 8: /* YYYYMMDD */
fmt = "%Y-%m-%d";
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2s", s, s + 4, s + 6);
break;
case 12: /* YYYYMMDDHHMM */
fmt = "%Y-%m-%dT%H:%M";
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2sT%.2s:%.2s",
s, s + 4, s + 6, s + 8, s + 10);
break;
case 14: /* YYYYMMDDHHMMSS */
fmt = "%Y-%m-%dT%H:%M:%S";
snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2sT%.2s:%.2s:%.2s",
s, s + 4, s + 6, s + 8, s + 10, s + 12);
break;
default:
return SSH_ERR_INVALID_FORMAT;
}
memset(&tm, 0, sizeof(tm));
if (strptime(buf, fmt, &tm) == NULL)
return SSH_ERR_INVALID_FORMAT;
if ((tt = mktime(&tm)) < 0)
return SSH_ERR_INVALID_FORMAT;
/* success */
*tp = (uint64_t)tt;
return 0;
}
| 0
|
522,571
|
void ha_close_connection(THD* thd)
{
plugin_foreach_with_mask(thd, closecon_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN,
PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
}
| 0
|
316,698
|
bool HTMLCanvasElement::IsWebGL2Enabled() const {
Document& document = GetDocument();
LocalFrame* frame = document.GetFrame();
if (!frame)
return false;
Settings* settings = frame->GetSettings();
return settings && settings->GetWebGL2Enabled();
}
| 0
|
377,197
|
static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)
{
BlockDriverAIOCBCoroutine *acb = opaque;
BlockDriverState *bs = acb->common.bs;
acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors);
acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
qemu_bh_schedule(acb->bh);
}
| 0
|
143,042
|
static int nl80211_set_cqm_rssi(struct genl_info *info,
s32 threshold, u32 hysteresis)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct wireless_dev *wdev;
struct net_device *dev = info->user_ptr[1];
if (threshold > 0)
return -EINVAL;
wdev = dev->ieee80211_ptr;
if (!rdev->ops->set_cqm_rssi_config)
return -EOPNOTSUPP;
if (wdev->iftype != NL80211_IFTYPE_STATION &&
wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
return -EOPNOTSUPP;
return rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev,
threshold, hysteresis);
| 0
|
298,026
|
static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col)
{
if (im->thick > 1) {
int thickhalf = im->thick >> 1;
gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col);
} else {
if (y2 < y1) {
int t = y1;
y1 = y2;
y2 = t;
}
for (;y1 <= y2; y1++) {
gdImageSetPixel(im, x, y1, col);
}
}
return;
}
| 0
|
119,068
|
static void CL_OldGame(void)
{
if(cl_oldGameSet)
{
// change back to previous fs_game
cl_oldGameSet = qfalse;
Cvar_Set2("fs_game", cl_oldGame, qtrue);
FS_ConditionalRestart(clc.checksumFeed, qfalse);
}
}
| 0
|
477,003
|
void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
const char *reason, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:rejected-adjacency";
struct list *arguments = yang_data_list_new();
char xpath_arg[XPATH_MAXLEN];
struct yang_data *data;
struct isis_area *area = circuit->area;
notif_prep_instance_hdr(xpath, area, "default", arguments);
notif_prepr_iface_hdr(xpath, circuit, arguments);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/reason", xpath);
data = yang_data_new_string(xpath_arg, reason);
listnode_add(arguments, data);
snprintf(xpath_arg, sizeof(xpath_arg), "%s/raw-pdu", xpath);
data = yang_data_new_binary(xpath_arg, raw_pdu, raw_pdu_len);
listnode_add(arguments, data);
hook_call(isis_hook_reject_adjacency, circuit, raw_pdu, raw_pdu_len);
nb_notification_send(xpath, arguments);
}
| 0
|
417,942
|
int RGWSetRequestPayment::verify_permission()
{
return verify_bucket_owner_or_policy(s, rgw::IAM::s3PutBucketRequestPayment);
}
| 0
|
203,840
|
void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) {
CompositorDependencies* compositor_deps = this;
is_scroll_animator_enabled_ = params->web_preferences.enable_scroll_animator;
RenderViewImpl::Create(compositor_deps, std::move(params),
RenderWidget::ShowCallback());
}
| 0
|
301,970
|
is_wc_option(optnam)
const char *optnam;
{
int k = 0;
while (wc_options[k].wc_name) {
if (strcmp(wc_options[k].wc_name, optnam) == 0)
return TRUE;
k++;
}
return FALSE;
}
| 0
|
121,574
|
static struct mount *next_mnt(struct mount *p, struct mount *root)
{
struct list_head *next = p->mnt_mounts.next;
if (next == &p->mnt_mounts) {
while (1) {
if (p == root)
return NULL;
next = p->mnt_child.next;
if (next != &p->mnt_parent->mnt_mounts)
break;
p = p->mnt_parent;
}
}
return list_entry(next, struct mount, mnt_child);
}
| 0
|
246,997
|
void ChromeContentBrowserClient::AddNewCertificate(
net::URLRequest* request,
net::X509Certificate* cert,
int render_process_id,
int render_view_id) {
new SSLAddCertHandler(request, cert, render_process_id, render_view_id);
}
| 0
|
406,568
|
table_map not_null_tables() const { return (*ref)->not_null_tables(); }
| 0
|
243,452
|
bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr)
{
bdstr_t bdstr;
BTIF_TRACE_EVENT("%s: bd_addr=%s", __FUNCTION__, bdaddr_to_string(bd_addr, bdstr, sizeof(bdstr)));
/* TODO:
** 1. Restore scan modes
** 2. special handling for HID devices
*/
if (pairing_cb.state == BT_BOND_STATE_BONDING)
{
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
if (pairing_cb.is_ssp)
{
if (pairing_cb.is_le_only)
{
BTA_DmBleSecurityGrant((UINT8 *)bd_addr->address,BTA_DM_SEC_PAIR_NOT_SPT);
}
else
{
BTA_DmConfirm( (UINT8 *)bd_addr->address, FALSE);
BTA_DmBondCancel ((UINT8 *)bd_addr->address);
btif_storage_remove_bonded_device((bt_bdaddr_t *)bd_addr);
}
}
else
{
if (pairing_cb.is_le_only)
{
BTA_DmBondCancel ((UINT8 *)bd_addr->address);
}
else
{
BTA_DmPinReply( (UINT8 *)bd_addr->address, FALSE, 0, NULL);
}
/* Cancel bonding, in case it is in ACL connection setup state */
BTA_DmBondCancel ((UINT8 *)bd_addr->address);
}
#else
if (pairing_cb.is_ssp)
{
BTA_DmConfirm( (UINT8 *)bd_addr->address, FALSE);
}
else
{
BTA_DmPinReply( (UINT8 *)bd_addr->address, FALSE, 0, NULL);
}
/* Cancel bonding, in case it is in ACL connection setup state */
BTA_DmBondCancel ((UINT8 *)bd_addr->address);
btif_storage_remove_bonded_device((bt_bdaddr_t *)bd_addr);
#endif
}
return BT_STATUS_SUCCESS;
}
| 0
|
10,052
|
xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
xmlChar limit = 0;
xmlChar *buf = NULL;
xmlChar *rep = NULL;
int len = 0;
int buf_size = 0;
int c, l, in_space = 0;
xmlChar *current = NULL;
xmlEntityPtr ent;
if (NXT(0) == '"') {
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
limit = '"';
NEXT;
} else if (NXT(0) == '\'') {
limit = '\'';
ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
NEXT;
} else {
xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL);
return(NULL);
}
/*
* allocate a translation buffer.
*/
buf_size = XML_PARSER_BUFFER_SIZE;
buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar));
if (buf == NULL) goto mem_error;
/*
* OK loop until we reach one of the ending char or a size limit.
*/
c = CUR_CHAR(l);
while ((NXT(0) != limit) && /* checked */
(IS_CHAR(c)) && (c != '<')) {
if (c == 0) break;
if (c == '&') {
in_space = 0;
if (NXT(1) == '#') {
int val = xmlParseCharRef(ctxt);
if (val == '&') {
if (ctxt->replaceEntities) {
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
buf[len++] = '&';
} else {
/*
* The reparsing will be done in xmlStringGetNodeList()
* called by the attribute() function in SAX.c
*/
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
buf[len++] = '&';
buf[len++] = '#';
buf[len++] = '3';
buf[len++] = '8';
buf[len++] = ';';
}
} else if (val != 0) {
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
len += xmlCopyChar(0, &buf[len], val);
}
} else {
ent = xmlParseEntityRef(ctxt);
ctxt->nbentities++;
if (ent != NULL)
ctxt->nbentities += ent->owner;
if ((ent != NULL) &&
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
if ((ctxt->replaceEntities == 0) &&
(ent->content[0] == '&')) {
buf[len++] = '&';
buf[len++] = '#';
buf[len++] = '3';
buf[len++] = '8';
buf[len++] = ';';
} else {
buf[len++] = ent->content[0];
}
} else if ((ent != NULL) &&
(ctxt->replaceEntities != 0)) {
if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) {
rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF,
0, 0, 0);
if (rep != NULL) {
current = rep;
while (*current != 0) { /* non input consuming */
if ((*current == 0xD) || (*current == 0xA) ||
(*current == 0x9)) {
buf[len++] = 0x20;
current++;
} else
buf[len++] = *current++;
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
}
xmlFree(rep);
rep = NULL;
}
} else {
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
if (ent->content != NULL)
buf[len++] = ent->content[0];
}
} else if (ent != NULL) {
int i = xmlStrlen(ent->name);
const xmlChar *cur = ent->name;
/*
* This may look absurd but is needed to detect
* entities problems
*/
if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
(ent->content != NULL)) {
rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF, 0, 0, 0);
if (rep != NULL) {
xmlFree(rep);
rep = NULL;
}
}
/*
* Just output the reference
*/
buf[len++] = '&';
while (len > buf_size - i - 10) {
growBuffer(buf, i + 10);
}
for (;i > 0;i--)
buf[len++] = *cur++;
buf[len++] = ';';
}
}
} else {
if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) {
if ((len != 0) || (!normalize)) {
if ((!normalize) || (!in_space)) {
COPY_BUF(l,buf,len,0x20);
while (len > buf_size - 10) {
growBuffer(buf, 10);
}
}
in_space = 1;
}
} else {
in_space = 0;
COPY_BUF(l,buf,len,c);
if (len > buf_size - 10) {
growBuffer(buf, 10);
}
}
NEXTL(l);
}
GROW;
c = CUR_CHAR(l);
}
if ((in_space) && (normalize)) {
while (buf[len - 1] == 0x20) len--;
}
buf[len] = 0;
if (RAW == '<') {
xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL);
} else if (RAW != limit) {
if ((c != 0) && (!IS_CHAR(c))) {
xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR,
"invalid character in attribute value\n");
} else {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue: ' expected\n");
}
} else
NEXT;
if (attlen != NULL) *attlen = len;
return(buf);
mem_error:
xmlErrMemory(ctxt, NULL);
if (buf != NULL)
xmlFree(buf);
if (rep != NULL)
xmlFree(rep);
return(NULL);
}
| 1
|
39,829
|
fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto)
{
char hdr[VAR_CELL_MAX_HEADER_SIZE];
var_cell_t *result;
uint8_t command;
uint16_t length;
const int wide_circ_ids = linkproto >= MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS;
const int circ_id_len = get_circ_id_size(wide_circ_ids);
const unsigned header_len = get_var_cell_header_size(wide_circ_ids);
check();
*out = NULL;
if (buf->datalen < header_len)
return 0;
peek_from_buf(hdr, header_len, buf);
command = get_uint8(hdr + circ_id_len);
if (!(cell_command_is_var_length(command, linkproto)))
return 0;
length = ntohs(get_uint16(hdr + circ_id_len + 1));
if (buf->datalen < (size_t)(header_len+length))
return 1;
result = var_cell_new(length);
result->command = command;
if (wide_circ_ids)
result->circ_id = ntohl(get_uint32(hdr));
else
result->circ_id = ntohs(get_uint16(hdr));
buf_remove_from_front(buf, header_len);
peek_from_buf((char*) result->payload, length, buf);
buf_remove_from_front(buf, length);
check();
*out = result;
return 1;
}
| 0
|
480,130
|
strendswith(const char *str, const char *suffix)
{
size_t slen = strlen(str);
size_t suffixlen = strlen(suffix);
size_t offset;
if (slen == 0 || suffixlen == 0 || suffixlen > slen)
return false;
offset = slen - suffixlen;
return strneq(&str[offset], suffix, suffixlen);
}
| 0
|
508,455
|
int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx)
{
return (X509_STORE_set_default_paths(ctx->cert_store));
}
| 0
|
59,465
|
static void gf_hevc_vvc_parse_sei(char *buffer, u32 nal_size, HEVCState *hevc, VVCState *vvc)
{
u32 ptype, psize, hdr;
u64 start;
GF_BitStream *bs;
hdr = buffer[0];
if (((hdr & 0x7e) >> 1) != GF_HEVC_NALU_SEI_PREFIX) return;
bs = gf_bs_new(buffer, nal_size, GF_BITSTREAM_READ);
gf_bs_enable_emulation_byte_removal(bs, GF_TRUE);
gf_bs_read_int(bs, 16);
/*parse SEI*/
while (gf_bs_available(bs)) {
u32 consumed;
ptype = 0;
while (gf_bs_peek_bits(bs, 8, 0)==0xFF) {
gf_bs_read_int(bs, 8);
ptype += 255;
}
ptype += gf_bs_read_int(bs, 8);
psize = 0;
while (gf_bs_peek_bits(bs, 8, 0)==0xFF) {
gf_bs_read_int(bs, 8);
psize += 255;
}
psize += gf_bs_read_int(bs, 8);
start = gf_bs_get_position(bs);
if (start+psize >= nal_size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[%s] SEI user message type %d size error (%d but %d remain), skipping SEI message\n", hevc ? "HEVC" : "VVC", ptype, psize, nal_size-start));
break;
}
switch (ptype) {
case 4: /*user registered ITU-T T35*/
if (hevc) {
avc_parse_itu_t_t35_sei(bs, &hevc->sei.dovi);
}
break;
default:
break;
}
gf_bs_align(bs);
consumed = (u32) (gf_bs_get_position(bs) - start);
psize-=consumed;
gf_bs_skip_bytes(bs, psize);
if (gf_bs_available(bs) <= 2)
break;
}
gf_bs_del(bs);
}
| 0
|
142,819
|
virConnectDomainEventDeregisterAny(virConnectPtr conn,
int callbackID)
{
VIR_DEBUG("conn=%p, callbackID=%d", conn, callbackID);
virResetLastError();
virCheckConnectReturn(conn, -1);
virCheckNonNegativeArgGoto(callbackID, error);
if (conn->driver && conn->driver->connectDomainEventDeregisterAny) {
int ret;
ret = conn->driver->connectDomainEventDeregisterAny(conn, callbackID);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(conn);
return -1;
}
| 0
|
153,623
|
msg_home_replace_hl(char_u *fname)
{
msg_home_replace_attr(fname, HL_ATTR(HLF_D));
}
| 0
|
106,934
|
void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, unsigned int size)
{
u8 *ptr = NULL;
if (k >= SKF_NET_OFF)
ptr = skb_network_header(skb) + k - SKF_NET_OFF;
else if (k >= SKF_LL_OFF)
ptr = skb_mac_header(skb) + k - SKF_LL_OFF;
if (ptr >= skb->head && ptr + size <= skb_tail_pointer(skb))
return ptr;
return NULL;
}
| 0
|
329,015
|
static float get_band_cost_ZERO_mips(struct AACEncContext *s,
PutBitContext *pb, const float *in,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
int *bits)
{
int i;
float cost = 0;
for (i = 0; i < size; i += 4) {
cost += in[i ] * in[i ];
cost += in[i+1] * in[i+1];
cost += in[i+2] * in[i+2];
cost += in[i+3] * in[i+3];
}
if (bits)
*bits = 0;
return cost * lambda;
}
| 1
|
409,290
|
static void digit_gen(diy_fp_t Mp, diy_fp_t delta, char* buffer, int* len, int* K)
{
uint32_t div, p1;
uint64_t p2;
int d,kappa;
diy_fp_t one;
one.f = ((uint64_t) 1) << -Mp.e; one.e = Mp.e;
p1 = Mp.f >> -one.e;
p2 = Mp.f & (one.f - 1);
*len = 0; kappa = 3; div = TEN2;
while (kappa > 0) {
d = p1 / div;
if (d || *len) buffer[(*len)++] = '0' + d;
p1 %= div; kappa--; div /= 10;
if ((((uint64_t)p1)<<-one.e)+p2 <= delta.f) {
*K += kappa; return;
}
}
do {
p2 *= 10;
d = p2 >> -one.e;
if (d || *len) buffer[(*len)++] = '0' + d;
p2 &= one.f - 1; kappa--; delta.f *= 10;
} while (p2 > delta.f);
*K += kappa;
}
| 0
|
458,259
|
opj_jp2_t* opj_jp2_create(OPJ_BOOL p_is_decoder)
{
opj_jp2_t *jp2 = (opj_jp2_t*)opj_calloc(1, sizeof(opj_jp2_t));
if (jp2) {
/* create the J2K codec */
if (! p_is_decoder) {
jp2->j2k = opj_j2k_create_compress();
} else {
jp2->j2k = opj_j2k_create_decompress();
}
if (jp2->j2k == 00) {
opj_jp2_destroy(jp2);
return 00;
}
/* Color structure */
jp2->color.icc_profile_buf = NULL;
jp2->color.icc_profile_len = 0;
jp2->color.jp2_cdef = NULL;
jp2->color.jp2_pclr = NULL;
jp2->color.jp2_has_colr = 0;
/* validation list creation */
jp2->m_validation_list = opj_procedure_list_create();
if (! jp2->m_validation_list) {
opj_jp2_destroy(jp2);
return 00;
}
/* execution list creation */
jp2->m_procedure_list = opj_procedure_list_create();
if (! jp2->m_procedure_list) {
opj_jp2_destroy(jp2);
return 00;
}
}
return jp2;
}
| 0
|
195,578
|
static MagickBooleanType ClonePixelCacheOnDisk(
CacheInfo *magick_restrict cache_info,CacheInfo *magick_restrict clone_info,
ExceptionInfo *exception)
{
MagickSizeType
extent;
size_t
quantum;
ssize_t
count;
struct stat
file_stats;
unsigned char
*buffer;
/*
Clone pixel cache on disk with identical morphology.
*/
if ((OpenPixelCacheOnDisk(cache_info,ReadMode) == MagickFalse) ||
(OpenPixelCacheOnDisk(clone_info,IOMode) == MagickFalse))
return(MagickFalse);
quantum=(size_t) MagickMaxBufferExtent;
if ((fstat(cache_info->file,&file_stats) == 0) && (file_stats.st_size > 0))
quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);
buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));
if (buffer == (unsigned char *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
extent=0;
while ((count=read(cache_info->file,buffer,quantum)) > 0)
{
ssize_t
number_bytes;
number_bytes=write(clone_info->file,buffer,(size_t) count);
if (number_bytes != count)
break;
extent+=number_bytes;
}
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
if (extent != cache_info->length)
return(MagickFalse);
return(MagickTrue);
}
| 0
|
168,540
|
static TCGv_i64 gen_addq_msw(TCGv_i64 a, TCGv b)
{
TCGv_i64 tmp64 = tcg_temp_new_i64();
tcg_gen_extu_i32_i64(tmp64, b);
dead_tmp(b);
tcg_gen_shli_i64(tmp64, tmp64, 32);
tcg_gen_add_i64(a, tmp64, a);
tcg_temp_free_i64(tmp64);
return a;
}
| 1
|
521,151
|
Item_func_regex::fix_length_and_dec()
{
if (Item_bool_func::fix_length_and_dec() ||
agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE;
re.init(cmp_collation.collation, 0);
re.fix_owner(this, args[0], args[1]);
return FALSE;
}
| 0
|
498,998
|
static const char *reg_name_for_access(RzAnalysisOp *op, RzAnalysisVarAccessType type) {
if (type == RZ_ANALYSIS_VAR_ACCESS_TYPE_WRITE) {
if (op->dst && op->dst->reg) {
return op->dst->reg->name;
}
} else {
if (op->src[0] && op->src[0]->reg) {
return op->src[0]->reg->name;
}
}
return NULL;
}
| 0
|
7,951
|
static int pop_fetch_message (CONTEXT* ctx, MESSAGE* msg, int msgno)
{
int ret;
void *uidl;
char buf[LONG_STRING];
char path[_POSIX_PATH_MAX];
progress_t progressbar;
POP_DATA *pop_data = (POP_DATA *)ctx->data;
POP_CACHE *cache;
HEADER *h = ctx->hdrs[msgno];
unsigned short bcache = 1;
/* see if we already have the message in body cache */
if ((msg->fp = mutt_bcache_get (pop_data->bcache, h->data)))
return 0;
/*
* see if we already have the message in our cache in
* case $message_cachedir is unset
*/
cache = &pop_data->cache[h->index % POP_CACHE_LEN];
if (cache->path)
{
if (cache->index == h->index)
{
/* yes, so just return a pointer to the message */
msg->fp = fopen (cache->path, "r");
if (msg->fp)
return 0;
mutt_perror (cache->path);
mutt_sleep (2);
return -1;
}
else
{
/* clear the previous entry */
unlink (cache->path);
FREE (&cache->path);
}
}
FOREVER
{
if (pop_reconnect (ctx) < 0)
return -1;
/* verify that massage index is correct */
if (h->refno < 0)
{
mutt_error _("The message index is incorrect. Try reopening the mailbox.");
mutt_sleep (2);
return -1;
}
mutt_progress_init (&progressbar, _("Fetching message..."),
MUTT_PROGRESS_SIZE, NetInc, h->content->length + h->content->offset - 1);
/* see if we can put in body cache; use our cache as fallback */
if (!(msg->fp = mutt_bcache_put (pop_data->bcache, h->data, 1)))
{
/* no */
bcache = 0;
mutt_mktemp (path, sizeof (path));
if (!(msg->fp = safe_fopen (path, "w+")))
{
mutt_perror (path);
mutt_sleep (2);
return -1;
}
}
snprintf (buf, sizeof (buf), "RETR %d\r\n", h->refno);
ret = pop_fetch_data (pop_data, buf, &progressbar, fetch_message, msg->fp);
if (ret == 0)
break;
safe_fclose (&msg->fp);
/* if RETR failed (e.g. connection closed), be sure to remove either
* the file in bcache or from POP's own cache since the next iteration
* of the loop will re-attempt to put() the message */
if (!bcache)
unlink (path);
if (ret == -2)
{
mutt_error ("%s", pop_data->err_msg);
mutt_sleep (2);
return -1;
}
if (ret == -3)
{
mutt_error _("Can't write message to temporary file!");
mutt_sleep (2);
return -1;
}
}
/* Update the header information. Previously, we only downloaded a
* portion of the headers, those required for the main display.
*/
if (bcache)
mutt_bcache_commit (pop_data->bcache, h->data);
else
{
cache->index = h->index;
cache->path = safe_strdup (path);
}
rewind (msg->fp);
uidl = h->data;
/* we replace envelop, key in subj_hash has to be updated as well */
if (ctx->subj_hash && h->env->real_subj)
hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL);
mutt_label_hash_remove (ctx, h);
mutt_free_envelope (&h->env);
h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0);
if (ctx->subj_hash && h->env->real_subj)
hash_insert (ctx->subj_hash, h->env->real_subj, h);
mutt_label_hash_add (ctx, h);
h->data = uidl;
h->lines = 0;
fgets (buf, sizeof (buf), msg->fp);
while (!feof (msg->fp))
{
ctx->hdrs[msgno]->lines++;
fgets (buf, sizeof (buf), msg->fp);
}
h->content->length = ftello (msg->fp) - h->content->offset;
/* This needs to be done in case this is a multipart message */
if (!WithCrypto)
h->security = crypt_query (h->content);
mutt_clear_error();
rewind (msg->fp);
return 0;
}
| 1
|
52,966
|
static inline void print_stream_params(AVIOContext *pb, FFServerStream *stream)
{
int i, stream_no;
const char *type = "unknown";
char parameters[64];
LayeredAVStream *st;
AVCodec *codec;
stream_no = stream->nb_streams;
avio_printf(pb, "<table><tr><th>Stream<th>"
"type<th>kbit/s<th>codec<th>"
"Parameters\n");
for (i = 0; i < stream_no; i++) {
st = stream->streams[i];
codec = avcodec_find_encoder(st->codecpar->codec_id);
parameters[0] = 0;
switch(st->codecpar->codec_type) {
case AVMEDIA_TYPE_AUDIO:
type = "audio";
snprintf(parameters, sizeof(parameters), "%d channel(s), %d Hz",
st->codecpar->channels, st->codecpar->sample_rate);
break;
case AVMEDIA_TYPE_VIDEO:
type = "video";
snprintf(parameters, sizeof(parameters),
"%dx%d, q=%d-%d, fps=%d", st->codecpar->width,
st->codecpar->height, st->codec->qmin, st->codec->qmax,
st->time_base.den / st->time_base.num);
break;
default:
abort();
}
avio_printf(pb, "<tr><td>%d<td>%s<td>%"PRId64
"<td>%s<td>%s\n",
i, type, (int64_t)st->codecpar->bit_rate/1000,
codec ? codec->name : "", parameters);
}
avio_printf(pb, "</table>\n");
}
| 0
|
376,672
|
void HInferRepresentation::InferBasedOnUses(HValue* value) {
Representation r = value->representation();
if (r.IsSpecialization() || value->HasNoUses()) return;
ASSERT(value->CheckFlag(HValue::kFlexibleRepresentation));
Representation new_rep = TryChange(value);
if (!new_rep.IsNone()) {
if (!value->representation().Equals(new_rep)) {
if (FLAG_trace_representation) {
PrintF("Changing #%d representation %s -> %s based on uses\n",
value->id(),
r.Mnemonic(),
new_rep.Mnemonic());
}
value->ChangeRepresentation(new_rep);
AddDependantsToWorklist(value);
}
}
}
| 0
|
333,527
|
static int gif_image_write_header(ByteIOContext *pb,
int width, int height, uint32_t *palette)
{
int i;
unsigned int v;
put_tag(pb, "GIF");
put_tag(pb, "89a");
put_le16(pb, width);
put_le16(pb, height);
put_byte(pb, 0xf7); /* flags: global clut, 256 entries */
put_byte(pb, 0x1f); /* background color index */
put_byte(pb, 0); /* aspect ratio */
/* the global palette */
if (!palette) {
put_buffer(pb, (unsigned char *)gif_clut, 216*3);
for(i=0;i<((256-216)*3);i++)
put_byte(pb, 0);
} else {
for(i=0;i<256;i++) {
v = palette[i];
put_byte(pb, (v >> 16) & 0xff);
put_byte(pb, (v >> 8) & 0xff);
put_byte(pb, (v) & 0xff);
}
}
/* application extension header */
/* XXX: not really sure what to put in here... */
#ifdef GIF_ADD_APP_HEADER
put_byte(pb, 0x21);
put_byte(pb, 0xff);
put_byte(pb, 0x0b);
put_tag(pb, "NETSCAPE2.0");
put_byte(pb, 0x03);
put_byte(pb, 0x01);
put_byte(pb, 0x00);
put_byte(pb, 0x00);
#endif
return 0;
}
| 0
|
7,246
|
static struct key *construct_key_and_link(struct keyring_search_context *ctx,
const char *callout_info,
size_t callout_len,
void *aux,
struct key *dest_keyring,
unsigned long flags)
{
struct key_user *user;
struct key *key;
int ret;
kenter("");
if (ctx->index_key.type == &key_type_keyring)
return ERR_PTR(-EPERM);
user = key_user_lookup(current_fsuid());
if (!user)
return ERR_PTR(-ENOMEM);
construct_get_dest_keyring(&dest_keyring);
ret = construct_alloc_key(ctx, dest_keyring, flags, user, &key);
key_user_put(user);
if (ret == 0) {
ret = construct_key(key, callout_info, callout_len, aux,
dest_keyring);
if (ret < 0) {
kdebug("cons failed");
goto construction_failed;
}
} else if (ret == -EINPROGRESS) {
ret = 0;
} else {
goto couldnt_alloc_key;
}
key_put(dest_keyring);
kleave(" = key %d", key_serial(key));
return key;
construction_failed:
key_negate_and_link(key, key_negative_timeout, NULL, NULL);
key_put(key);
couldnt_alloc_key:
key_put(dest_keyring);
kleave(" = %d", ret);
return ERR_PTR(ret);
}
| 1
|
379,046
|
PHPAPI void php_info_print_box_end(void) /* {{{ */
{
if (!sapi_module.phpinfo_as_text) {
php_info_print("</td></tr>\n");
}
php_info_print_table_end();
| 0
|
122,923
|
inline void getrs(char &TRANS, int &N, float *lapA, int *IPIV, float *lapB, int &INFO) {
int one = 1;
sgetrs_(&TRANS,&N,&one,lapA,&N,IPIV,lapB,&N,&INFO);
| 0
|
189,936
|
void RenderViewHostImpl::DragTargetDragOver(
const gfx::Point& client_pt,
const gfx::Point& screen_pt,
WebDragOperationsMask operations_allowed,
int key_modifiers) {
Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt,
operations_allowed, key_modifiers));
}
| 0
|
257,777
|
static VALUE join_der ( VALUE enumerable ) {
VALUE str = rb_str_new ( 0 , 0 ) ;
rb_block_call ( enumerable , rb_intern ( "each" ) , 0 , 0 , join_der_i , str ) ;
return str ;
}
| 0
|
17,290
|
static int dissect_usb_video_frame ( proto_tree * tree , tvbuff_t * tvb , int offset , guint8 subtype ) {
static const int * capability_bits [ ] = {
& hf_usb_vid_frame_stills_supported , & hf_usb_vid_frame_fixed_frame_rate , NULL }
;
proto_item * desc_item ;
guint8 bFrameIntervalType ;
guint8 frame_index ;
guint16 frame_width ;
guint16 frame_height ;
frame_index = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_index , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset ++ ;
proto_tree_add_bitmask ( tree , tvb , offset , hf_usb_vid_frame_capabilities , ett_frame_capability_flags , capability_bits , ENC_NA ) ;
offset ++ ;
proto_tree_add_item ( tree , hf_usb_vid_frame_width , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_height , tvb , offset + 2 , 2 , ENC_LITTLE_ENDIAN ) ;
frame_width = tvb_get_letohs ( tvb , offset ) ;
frame_height = tvb_get_letohs ( tvb , offset + 2 ) ;
desc_item = proto_tree_get_parent ( tree ) ;
proto_item_append_text ( desc_item , " (Index %2u): %4u x %4u" , frame_index , frame_width , frame_height ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_min_bit_rate , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_max_bit_rate , tvb , offset + 8 , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 12 ;
if ( subtype != VS_FRAME_FRAME_BASED ) {
proto_tree_add_item ( tree , hf_usb_vid_frame_max_frame_sz , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
}
proto_tree_add_item ( tree , hf_usb_vid_frame_default_interval , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
bFrameIntervalType = tvb_get_guint8 ( tvb , offset ) ;
if ( bFrameIntervalType == 0 ) {
proto_tree_add_uint_format_value ( tree , hf_usb_vid_frame_interval_type , tvb , offset , 1 , bFrameIntervalType , "Continuous (0)" ) ;
offset ++ ;
if ( subtype == VS_FRAME_FRAME_BASED ) {
proto_tree_add_item ( tree , hf_usb_vid_frame_bytes_per_line , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
}
proto_tree_add_item ( tree , hf_usb_vid_frame_min_interval , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_max_interval , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_usb_vid_frame_step_interval , tvb , offset + 8 , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 12 ;
}
else {
guint8 i ;
proto_tree_add_uint_format_value ( tree , hf_usb_vid_frame_interval_type , tvb , offset , 1 , bFrameIntervalType , "Discrete (%u choice%s)" , bFrameIntervalType , ( bFrameIntervalType > 1 ) ? "s" : "" ) ;
offset ++ ;
if ( subtype == VS_FRAME_FRAME_BASED ) {
proto_tree_add_item ( tree , hf_usb_vid_frame_bytes_per_line , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
}
for ( i = 0 ;
i < bFrameIntervalType ;
++ i ) {
proto_tree_add_item ( tree , hf_usb_vid_frame_interval , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
}
}
return offset ;
}
| 0
|
309,261
|
DownloadProtectionService::RegisterClientDownloadRequestCallback(
const ClientDownloadRequestCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return client_download_request_callbacks_.Add(callback);
}
| 0
|
22,060
|
extern int main ( int argc , char * argv [ ] ) {
# if ! UCONFIG_NO_IDNA char * filename = NULL ;
# endif const char * srcDir = NULL , * destDir = NULL , * icuUniDataDir = NULL ;
const char * bundleName = NULL , * inputFileName = NULL ;
char * basename = NULL ;
int32_t sprepOptions = 0 ;
UErrorCode errorCode = U_ZERO_ERROR ;
U_MAIN_INIT_ARGS ( argc , argv ) ;
options [ DESTDIR ] . value = u_getDataDirectory ( ) ;
options [ SOURCEDIR ] . value = "" ;
options [ UNICODE_VERSION ] . value = "0" ;
options [ BUNDLE_NAME ] . value = DATA_NAME ;
options [ NORMALIZE ] . value = "" ;
argc = u_parseArgs ( argc , argv , UPRV_LENGTHOF ( options ) , options ) ;
if ( argc < 0 ) {
fprintf ( stderr , "error in command line argument \"%s\"\n" , argv [ - argc ] ) ;
}
if ( argc < 0 || options [ HELP ] . doesOccur || options [ HELP_QUESTION_MARK ] . doesOccur ) {
return printHelp ( argc , argv ) ;
}
beVerbose = options [ VERBOSE ] . doesOccur ;
haveCopyright = options [ COPYRIGHT ] . doesOccur ;
srcDir = options [ SOURCEDIR ] . value ;
destDir = options [ DESTDIR ] . value ;
bundleName = options [ BUNDLE_NAME ] . value ;
if ( options [ NORMALIZE ] . doesOccur ) {
icuUniDataDir = options [ NORMALIZE ] . value ;
}
else {
icuUniDataDir = options [ NORM_CORRECTION_DIR ] . value ;
}
if ( argc < 2 ) {
return printHelp ( argc , argv ) ;
}
else {
inputFileName = argv [ 1 ] ;
}
if ( ! options [ UNICODE_VERSION ] . doesOccur ) {
return printHelp ( argc , argv ) ;
}
if ( options [ ICUDATADIR ] . doesOccur ) {
u_setDataDirectory ( options [ ICUDATADIR ] . value ) ;
}
# if UCONFIG_NO_IDNA fprintf ( stderr , "gensprep writes dummy " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " because UCONFIG_NO_IDNA is set, \n" "see icu/source/common/unicode/uconfig.h\n" ) ;
generateData ( destDir , bundleName ) ;
# else setUnicodeVersion ( options [ UNICODE_VERSION ] . value ) ;
filename = ( char * ) uprv_malloc ( uprv_strlen ( srcDir ) + uprv_strlen ( inputFileName ) + ( icuUniDataDir == NULL ? 0 : uprv_strlen ( icuUniDataDir ) ) + 40 ) ;
if ( uprv_strchr ( srcDir , U_FILE_SEP_CHAR ) == NULL && uprv_strchr ( srcDir , U_FILE_ALT_SEP_CHAR ) == NULL ) {
filename [ 0 ] = '.' ;
filename [ 1 ] = U_FILE_SEP_CHAR ;
uprv_strcpy ( filename + 2 , srcDir ) ;
}
else {
uprv_strcpy ( filename , srcDir ) ;
}
basename = filename + uprv_strlen ( filename ) ;
if ( basename > filename && * ( basename - 1 ) != U_FILE_SEP_CHAR ) {
* basename ++ = U_FILE_SEP_CHAR ;
}
init ( ) ;
uprv_strcpy ( basename , inputFileName ) ;
parseMappings ( filename , FALSE , & errorCode ) ;
if ( U_FAILURE ( errorCode ) ) {
fprintf ( stderr , "Could not open file %s for reading. Error: %s \n" , filename , u_errorName ( errorCode ) ) ;
return errorCode ;
}
if ( options [ NORMALIZE ] . doesOccur ) {
uprv_strcpy ( filename , icuUniDataDir ) ;
basename = filename + uprv_strlen ( filename ) ;
if ( basename > filename && * ( basename - 1 ) != U_FILE_SEP_CHAR ) {
* basename ++ = U_FILE_SEP_CHAR ;
}
* basename ++ = U_FILE_SEP_CHAR ;
uprv_strcpy ( basename , NORM_CORRECTIONS_FILE_NAME ) ;
parseNormalizationCorrections ( filename , & errorCode ) ;
if ( U_FAILURE ( errorCode ) ) {
fprintf ( stderr , "Could not open file %s for reading \n" , filename ) ;
return errorCode ;
}
sprepOptions |= _SPREP_NORMALIZATION_ON ;
}
if ( options [ CHECK_BIDI ] . doesOccur ) {
sprepOptions |= _SPREP_CHECK_BIDI_ON ;
}
setOptions ( sprepOptions ) ;
if ( U_SUCCESS ( errorCode ) ) {
generateData ( destDir , bundleName ) ;
cleanUpData ( ) ;
}
uprv_free ( filename ) ;
u_cleanup ( ) ;
# endif return errorCode ;
}
| 0
|
249,496
|
void FS_Restart( int checksumFeed ) {
const char *lastGameDir;
FS_Shutdown( qfalse );
fs_checksumFeed = checksumFeed;
FS_ClearPakReferences( 0 );
FS_Startup(com_basegame->string);
#ifndef STANDALONE
FS_CheckPak0( );
#endif
if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
if ( lastValidBase[0] ) {
FS_PureServerSetLoadedPaks( "", "" );
Cvar_Set( "fs_basepath", lastValidBase );
Cvar_Set( "com_basegame", lastValidComBaseGame );
Cvar_Set( "fs_basegame", lastValidFsBaseGame );
Cvar_Set( "fs_game", lastValidGame );
lastValidBase[0] = '\0';
lastValidComBaseGame[0] = '\0';
lastValidFsBaseGame[0] = '\0';
lastValidGame[0] = '\0';
FS_Restart( checksumFeed );
Com_Error( ERR_DROP, "Invalid game folder" );
return;
}
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
}
lastGameDir = ( lastValidGame[0] ) ? lastValidGame : lastValidComBaseGame;
if ( Q_stricmp( FS_GetCurrentGameDir(), lastGameDir ) ) {
Sys_RemovePIDFile( lastGameDir );
Sys_InitPIDFile( FS_GetCurrentGameDir() );
if ( !Com_SafeMode() ) {
Cbuf_AddText("exec " Q3CONFIG_CFG "\n");
}
}
Q_strncpyz( lastValidBase, fs_basepath->string, sizeof( lastValidBase ) );
Q_strncpyz( lastValidComBaseGame, com_basegame->string, sizeof( lastValidComBaseGame ) );
Q_strncpyz( lastValidFsBaseGame, fs_basegame->string, sizeof( lastValidFsBaseGame ) );
Q_strncpyz( lastValidGame, fs_gamedirvar->string, sizeof( lastValidGame ) );
}
| 0
|
389,525
|
loop_info(
sockaddr_u *srcadr,
endpt *inter,
struct req_pkt *inpkt
)
{
struct info_loop *li;
l_fp ltmp;
li = (struct info_loop *)prepare_pkt(srcadr, inter, inpkt,
sizeof(struct info_loop));
DTOLFP(last_offset, <mp);
HTONL_FP(<mp, &li->last_offset);
DTOLFP(drift_comp * 1e6, <mp);
HTONL_FP(<mp, &li->drift_comp);
li->compliance = htonl((u_int32)(tc_counter));
li->watchdog_timer = htonl((u_int32)(current_time - sys_epoch));
(void) more_pkt();
flush_pkt();
}
| 0
|
90,896
|
TfLiteRegistration* Register_MATRIX_DIAG() {
static TfLiteRegistration r = {nullptr, nullptr, matrix_diag::Prepare,
matrix_diag::Eval};
return &r;
}
| 0
|
165,751
|
LayoutUnit RenderBox::computeReplacedLogicalHeight() const
{
return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight()));
}
| 0
|
162,184
|
in_any_exception_block (MonoMethodHeader *header, guint offset)
{
int i;
MonoExceptionClause *clause;
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
if (MONO_OFFSET_IN_HANDLER (clause, offset))
return TRUE;
if (MONO_OFFSET_IN_FILTER (clause, offset))
return TRUE;
}
return FALSE;
}
| 0
|
126,496
|
uint64_t ahotDefault() {
return RuntimeOption::RepoAuthoritative ? 4 << 20 : 0;
}
| 0
|
61,276
|
static int perf_event_period(struct perf_event *event, u64 __user *arg)
{
u64 value;
if (!is_sampling_event(event))
return -EINVAL;
if (copy_from_user(&value, arg, sizeof(value)))
return -EFAULT;
if (!value)
return -EINVAL;
if (event->attr.freq && value > sysctl_perf_event_sample_rate)
return -EINVAL;
event_function_call(event, __perf_event_period, &value);
return 0;
}
| 0
|
219,989
|
void ID3::Iterator::getstring(String8 *id, bool otherdata) const {
id->setTo("");
const uint8_t *frameData = mFrameData;
if (frameData == NULL) {
return;
}
uint8_t encoding = *frameData;
if (mParent.mVersion == ID3_V1 || mParent.mVersion == ID3_V1_1) {
if (mOffset == 126 || mOffset == 127) {
char tmp[16];
sprintf(tmp, "%d", (int)*frameData);
id->setTo(tmp);
return;
}
id->setTo((const char*)frameData, mFrameSize);
return;
}
if (mFrameSize < getHeaderLength() + 1) {
return;
}
size_t n = mFrameSize - getHeaderLength() - 1;
if (otherdata) {
frameData += 4;
int32_t i = n - 4;
while(--i >= 0 && *++frameData != 0) ;
int skipped = (frameData - mFrameData);
if (skipped >= (int)n) {
return;
}
n -= skipped;
}
if (n <= 0) {
return;
}
if (encoding == 0x00) {
id->setTo((const char*)frameData + 1, n);
} else if (encoding == 0x03) {
id->setTo((const char *)(frameData + 1), n);
} else if (encoding == 0x02) {
int len = n / 2;
const char16_t *framedata = (const char16_t *) (frameData + 1);
char16_t *framedatacopy = NULL;
#if BYTE_ORDER == LITTLE_ENDIAN
if (len > 0) {
framedatacopy = new (std::nothrow) char16_t[len];
if (framedatacopy == NULL) {
return;
}
for (int i = 0; i < len; i++) {
framedatacopy[i] = bswap_16(framedata[i]);
}
framedata = framedatacopy;
}
#endif
id->setTo(framedata, len);
if (framedatacopy != NULL) {
delete[] framedatacopy;
}
} else if (encoding == 0x01) {
int len = n / 2;
const char16_t *framedata = (const char16_t *) (frameData + 1);
char16_t *framedatacopy = NULL;
if (*framedata == 0xfffe) {
if (len <= 1) {
return; // nothing after the marker
}
framedatacopy = new (std::nothrow) char16_t[len];
if (framedatacopy == NULL) {
return;
}
for (int i = 0; i < len; i++) {
framedatacopy[i] = bswap_16(framedata[i]);
}
framedata = framedatacopy;
framedata++;
len--;
} else if (*framedata == 0xfeff) {
if (len <= 1) {
return; // nothing after the marker
}
framedata++;
len--;
}
bool eightBit = true;
for (int i = 0; i < len; i++) {
if (framedata[i] > 0xff) {
eightBit = false;
break;
}
}
if (eightBit) {
char *frame8 = new (std::nothrow) char[len];
if (frame8 != NULL) {
for (int i = 0; i < len; i++) {
frame8[i] = framedata[i];
}
id->setTo(frame8, len);
delete [] frame8;
} else {
id->setTo(framedata, len);
}
} else {
id->setTo(framedata, len);
}
if (framedatacopy != NULL) {
delete[] framedatacopy;
}
}
}
| 0
|
519,235
|
Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg,
const LEX_CSTRING *field_name_arg)
: Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg),
bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
bytes_in_rec(len_arg / 8)
{
DBUG_ENTER("Field_bit::Field_bit");
DBUG_PRINT("enter", ("ptr_arg: %p, null_ptr_arg: %p, len_arg: %u, bit_len: %u, bytes_in_rec: %u",
ptr_arg, null_ptr_arg, len_arg, bit_len, bytes_in_rec));
flags|= UNSIGNED_FLAG;
/*
Ensure that Field::eq() can distinguish between two different bit fields.
(two bit fields that are not null, may have same ptr and null_ptr)
*/
if (!null_ptr_arg)
null_bit= bit_ofs_arg;
DBUG_VOID_RETURN;
}
| 0
|
345,979
|
void recv_additional_file_list(int f)
{
struct file_list *flist;
int ndx = read_ndx(f);
if (ndx == NDX_FLIST_EOF) {
flist_eof = 1;
if (DEBUG_GTE(FLIST, 3))
rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i());
change_local_filter_dir(NULL, 0, 0);
} else {
ndx = NDX_FLIST_OFFSET - ndx;
if (ndx < 0 || ndx >= dir_flist->used) {
ndx = NDX_FLIST_OFFSET - ndx;
rprintf(FERROR,
"[%s] Invalid dir index: %d (%d - %d)\n",
who_am_i(), ndx, NDX_FLIST_OFFSET,
NDX_FLIST_OFFSET - dir_flist->used + 1);
exit_cleanup(RERR_PROTOCOL);
}
if (DEBUG_GTE(FLIST, 3)) {
rprintf(FINFO, "[%s] receiving flist for dir %d\n",
who_am_i(), ndx);
}
flist = recv_file_list(f);
flist->parent_ndx = ndx;
}
}
| 1
|
388,046
|
stop_all_conversations (GdmSession *self)
{
stop_all_other_conversations (self, NULL, TRUE);
}
| 0
|
439,845
|
ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
struct sdr_record_common_sensor *sensor,
uint8_t sdr_record_type, int precision)
{
static struct sensor_reading sr;
if (!sensor)
return NULL;
/* Initialize to reading valid value of zero */
memset(&sr, 0, sizeof(sr));
switch (sdr_record_type) {
unsigned int idlen;
case (SDR_RECORD_TYPE_FULL_SENSOR):
sr.full = (struct sdr_record_full_sensor *)sensor;
idlen = sr.full->id_code & 0x1f;
idlen = idlen < sizeof(sr.s_id) ?
idlen : sizeof(sr.s_id) - 1;
memcpy(sr.s_id, sr.full->id_string, idlen);
break;
case SDR_RECORD_TYPE_COMPACT_SENSOR:
sr.compact = (struct sdr_record_compact_sensor *)sensor;
idlen = sr.compact->id_code & 0x1f;
idlen = idlen < sizeof(sr.s_id) ?
idlen : sizeof(sr.s_id) - 1;
memcpy(sr.s_id, sr.compact->id_string, idlen);
break;
default:
return NULL;
}
/*
* Get current reading via IPMI interface
*/
struct ipmi_rs *rsp;
rsp = ipmi_sdr_get_sensor_reading_ipmb(intf,
sensor->keys.sensor_num,
sensor->keys.owner_id,
sensor->keys.lun,
sensor->keys.channel);
sr.s_a_val = 0.0; /* init analog value to a floating point 0 */
sr.s_a_str[0] = '\0'; /* no converted analog value string */
sr.s_a_units = ""; /* no converted analog units units */
if (!rsp) {
lprintf(LOG_DEBUG, "Error reading sensor %s (#%02x)",
sr.s_id, sensor->keys.sensor_num);
return &sr;
}
if (rsp->ccode) {
if ( !((sr.full && rsp->ccode == 0xcb) ||
(sr.compact && rsp->ccode == 0xcd)) ) {
lprintf(LOG_DEBUG,
"Error reading sensor %s (#%02x): %s", sr.s_id,
sensor->keys.sensor_num,
val2str(rsp->ccode, completion_code_vals));
}
return &sr;
}
if (rsp->data_len < 2) {
/*
* We must be returned both a value (data[0]), and the validity
* of the value (data[1]), in order to correctly interpret
* the reading. If we don't have both of these we can't have
* a valid sensor reading.
*/
lprintf(LOG_DEBUG, "Error reading sensor %s invalid len %d",
sr.s_id, rsp->data_len);
return &sr;
}
if (IS_READING_UNAVAILABLE(rsp->data[1]))
sr.s_reading_unavailable = 1;
if (IS_SCANNING_DISABLED(rsp->data[1])) {
sr.s_scanning_disabled = 1;
lprintf(LOG_DEBUG, "Sensor %s (#%02x) scanning disabled",
sr.s_id, sensor->keys.sensor_num);
return &sr;
}
if ( !sr.s_reading_unavailable ) {
sr.s_reading_valid = 1;
sr.s_reading = rsp->data[0];
}
if (rsp->data_len > 2)
sr.s_data2 = rsp->data[2];
if (rsp->data_len > 3)
sr.s_data3 = rsp->data[3];
if (sdr_sensor_has_analog_reading(intf, &sr)) {
sr.s_has_analog_value = 1;
if (sr.s_reading_valid) {
sr.s_a_val = sdr_convert_sensor_reading(sr.full, sr.s_reading);
}
/* determine units string with possible modifiers */
sr.s_a_units = ipmi_sdr_get_unit_string(sr.full->cmn.unit.pct,
sr.full->cmn.unit.modifier,
sr.full->cmn.unit.type.base,
sr.full->cmn.unit.type.modifier);
snprintf(sr.s_a_str, sizeof(sr.s_a_str), "%.*f",
(sr.s_a_val == (int) sr.s_a_val) ? 0 :
precision, sr.s_a_val);
}
return &sr;
}
| 0
|
224,097
|
void WebGLRenderingContextBase::DestroyContext() {
if (!GetDrawingBuffer())
return;
extensions_util_.reset();
WTF::RepeatingClosure null_closure;
WTF::RepeatingFunction<void(const char*, int32_t)> null_function;
GetDrawingBuffer()->ContextProvider()->SetLostContextCallback(
std::move(null_closure));
GetDrawingBuffer()->ContextProvider()->SetErrorMessageCallback(
std::move(null_function));
DCHECK(GetDrawingBuffer());
drawing_buffer_->BeginDestruction();
drawing_buffer_ = nullptr;
}
| 0
|
365,228
|
rb_str_resize(str, len)
VALUE str;
long len;
{
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
rb_str_modify(str);
if (len != RSTRING(str)->len) {
if (RSTRING(str)->len < len || RSTRING(str)->len - len > 1024) {
REALLOC_N(RSTRING(str)->ptr, char, len+1);
if (!FL_TEST(str, STR_NOCAPA)) {
RSTRING(str)->aux.capa = len;
}
}
RSTRING(str)->len = len;
RSTRING(str)->ptr[len] = '\0'; /* sentinel */
}
return str;
}
| 0
|
47,400
|
GF_ESD *gf_isom_get_esd(GF_ISOFile *movie, u32 trackNumber, u32 StreamDescriptionIndex)
{
GF_ESD *esd;
GF_Err e;
e = GetESD(movie->moov, gf_isom_get_track_id(movie, trackNumber), StreamDescriptionIndex, &esd);
if (e && (e!= GF_ISOM_INVALID_MEDIA)) {
movie->LastError = e;
if (esd) gf_odf_desc_del((GF_Descriptor *)esd);
return NULL;
}
return esd;
}
| 0
|
422,959
|
static void tcp_push(struct sock *sk, int flags, int mss_now,
int nonagle, int size_goal)
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
if (!tcp_send_head(sk))
return;
skb = tcp_write_queue_tail(sk);
if (!(flags & MSG_MORE) || forced_push(tp))
tcp_mark_push(tp, skb);
tcp_mark_urg(tp, flags);
if (tcp_should_autocork(sk, skb, size_goal)) {
/* avoid atomic op if TSQ_THROTTLED bit is already set */
if (!test_bit(TSQ_THROTTLED, &tp->tsq_flags)) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPAUTOCORKING);
set_bit(TSQ_THROTTLED, &tp->tsq_flags);
}
/* It is possible TX completion already happened
* before we set TSQ_THROTTLED.
*/
if (atomic_read(&sk->sk_wmem_alloc) > skb->truesize)
return;
}
if (flags & MSG_MORE)
nonagle = TCP_NAGLE_CORK;
__tcp_push_pending_frames(sk, mss_now, nonagle);
}
| 0
|
16,428
|
static inline int mpeg2_fast_decode_block_intra ( MpegEncContext * s , int16_t * block , int n ) {
int level , dc , diff , j , run ;
int component ;
RLTable * rl ;
uint8_t * scantable = s -> intra_scantable . permutated ;
const uint16_t * quant_matrix ;
const int qscale = s -> qscale ;
if ( n < 4 ) {
quant_matrix = s -> intra_matrix ;
component = 0 ;
}
else {
quant_matrix = s -> chroma_intra_matrix ;
component = ( n & 1 ) + 1 ;
}
diff = decode_dc ( & s -> gb , component ) ;
if ( diff >= 0xffff ) return - 1 ;
dc = s -> last_dc [ component ] ;
dc += diff ;
s -> last_dc [ component ] = dc ;
block [ 0 ] = dc << ( 3 - s -> intra_dc_precision ) ;
if ( s -> intra_vlc_format ) rl = & ff_rl_mpeg2 ;
else rl = & ff_rl_mpeg1 ;
{
OPEN_READER ( re , & s -> gb ) ;
for ( ;
;
) {
UPDATE_CACHE ( re , & s -> gb ) ;
GET_RL_VLC ( level , run , re , & s -> gb , rl -> rl_vlc [ 0 ] , TEX_VLC_BITS , 2 , 0 ) ;
if ( level == 127 ) {
break ;
}
else if ( level != 0 ) {
scantable += run ;
j = * scantable ;
level = ( level * qscale * quant_matrix [ j ] ) >> 4 ;
level = ( level ^ SHOW_SBITS ( re , & s -> gb , 1 ) ) - SHOW_SBITS ( re , & s -> gb , 1 ) ;
LAST_SKIP_BITS ( re , & s -> gb , 1 ) ;
}
else {
run = SHOW_UBITS ( re , & s -> gb , 6 ) + 1 ;
LAST_SKIP_BITS ( re , & s -> gb , 6 ) ;
UPDATE_CACHE ( re , & s -> gb ) ;
level = SHOW_SBITS ( re , & s -> gb , 12 ) ;
SKIP_BITS ( re , & s -> gb , 12 ) ;
scantable += run ;
j = * scantable ;
if ( level < 0 ) {
level = ( - level * qscale * quant_matrix [ j ] ) >> 4 ;
level = - level ;
}
else {
level = ( level * qscale * quant_matrix [ j ] ) >> 4 ;
}
}
block [ j ] = level ;
}
CLOSE_READER ( re , & s -> gb ) ;
}
s -> block_last_index [ n ] = scantable - s -> intra_scantable . permutated ;
return 0 ;
}
| 0
|
356,112
|
static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
{
struct inode *inode = old_dentry->d_inode;
int ret;
/*
* No ordinary (disk based) filesystem counts links as inodes;
* but each new link needs a new dentry, pinning lowmem, and
* tmpfs dentries cannot be pruned until they are unlinked.
*/
ret = shmem_reserve_inode(inode->i_sb);
if (ret)
goto out;
dir->i_size += BOGO_DIRENT_SIZE;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
inc_nlink(inode);
atomic_inc(&inode->i_count); /* New dentry reference */
dget(dentry); /* Extra pinning count for the created dentry */
d_instantiate(dentry, inode);
out:
return ret;
}
| 0
|
62,817
|
void rds_for_each_conn_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens,
int (*visitor)(struct rds_connection *, void *),
u64 *buffer,
size_t item_len)
{
struct hlist_head *head;
struct rds_connection *conn;
size_t i;
rcu_read_lock();
lens->nr = 0;
lens->each = item_len;
for (i = 0, head = rds_conn_hash; i < ARRAY_SIZE(rds_conn_hash);
i++, head++) {
hlist_for_each_entry_rcu(conn, head, c_hash_node) {
/* XXX no c_lock usage.. */
if (!visitor(conn, buffer))
continue;
/* We copy as much as we can fit in the buffer,
* but we count all items so that the caller
* can resize the buffer. */
if (len >= item_len) {
rds_info_copy(iter, buffer, item_len);
len -= item_len;
}
lens->nr++;
}
}
rcu_read_unlock();
}
| 0
|
354,871
|
static void dccp_mib_exit(void)
{
free_percpu(dccp_statistics[0]);
free_percpu(dccp_statistics[1]);
dccp_statistics[0] = dccp_statistics[1] = NULL;
}
| 0
|
261,808
|
int cil_resolve_genfscon(struct cil_tree_node *current, void *extra_args)
{
struct cil_genfscon *genfscon = current->data;
struct cil_symtab_datum *context_datum = NULL;
int rc = SEPOL_ERR;
if (genfscon->context_str != NULL) {
rc = cil_resolve_name(current, genfscon->context_str, CIL_SYM_CONTEXTS, extra_args, &context_datum);
if (rc != SEPOL_OK) {
goto exit;
}
genfscon->context = (struct cil_context*)context_datum;
} else {
rc = cil_resolve_context(current, genfscon->context, extra_args);
if (rc != SEPOL_OK) {
goto exit;
}
}
return SEPOL_OK;
exit:
return rc;
}
| 0
|
522,105
|
void Item_func::count_decimal_length(Item **item, uint nitems)
{
int max_int_part= 0;
decimals= 0;
unsigned_flag= 1;
for (uint i=0 ; i < nitems ; i++)
{
set_if_bigger(decimals, item[i]->decimals);
set_if_bigger(max_int_part, item[i]->decimal_int_part());
set_if_smaller(unsigned_flag, item[i]->unsigned_flag);
}
int precision= MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION);
fix_char_length(my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag));
}
| 0
|
394,743
|
xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr tmp, obj, point;
xmlLocationSetPtr newset = NULL;
xmlLocationSetPtr oldset = NULL;
CHECK_ARITY(1);
if ((ctxt->value == NULL) ||
((ctxt->value->type != XPATH_LOCATIONSET) &&
(ctxt->value->type != XPATH_NODESET)))
XP_ERROR(XPATH_INVALID_TYPE)
obj = valuePop(ctxt);
if (obj->type == XPATH_NODESET) {
/*
* First convert to a location set
*/
tmp = xmlXPtrNewLocationSetNodeSet(obj->nodesetval);
xmlXPathFreeObject(obj);
if (tmp == NULL)
XP_ERROR(XPATH_MEMORY_ERROR)
obj = tmp;
}
newset = xmlXPtrLocationSetCreate(NULL);
if (newset == NULL) {
xmlXPathFreeObject(obj);
XP_ERROR(XPATH_MEMORY_ERROR);
}
oldset = (xmlLocationSetPtr) obj->user;
if (oldset != NULL) {
int i;
for (i = 0; i < oldset->locNr; i++) {
tmp = oldset->locTab[i];
if (tmp == NULL)
continue;
point = NULL;
switch (tmp->type) {
case XPATH_POINT:
point = xmlXPtrNewPoint(tmp->user, tmp->index);
break;
case XPATH_RANGE: {
xmlNodePtr node = tmp->user2;
if (node != NULL) {
if (node->type == XML_ATTRIBUTE_NODE) {
/* TODO: Namespace Nodes ??? */
xmlXPathFreeObject(obj);
xmlXPtrFreeLocationSet(newset);
XP_ERROR(XPTR_SYNTAX_ERROR);
}
point = xmlXPtrNewPoint(node, tmp->index2);
} else if (tmp->user == NULL) {
point = xmlXPtrNewPoint(node,
xmlXPtrNbLocChildren(node));
}
break;
}
default:
/*** Should we raise an error ?
xmlXPathFreeObject(obj);
xmlXPathFreeObject(newset);
XP_ERROR(XPATH_INVALID_TYPE)
***/
break;
}
if (point != NULL)
xmlXPtrLocationSetAdd(newset, point);
}
}
xmlXPathFreeObject(obj);
valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
}
| 0
|
471,411
|
void serverLog(int level, const char *fmt, ...) {
va_list ap;
char msg[LOG_MAX_LEN];
if ((level&0xff) < server.verbosity) return;
va_start(ap, fmt);
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
serverLogRaw(level,msg);
}
| 0
|
153,815
|
void IniSection::initValue (const string&key,const string&val,const string&comment,int rb)
{
string k = ip->changeCase (key);
IniEntry e;
IniEntryIdxIterator exi;
if (!ip->repeatNames () && (exi = ivalues.find (k)) != ivalues.end ())
{
IniIterator ei = exi->second;
// update existing value
// copy the old value
e = ei->e ();
// remove and unindex the old value
// This means that container needs to be a list, not vector,
// so that iterators kept in ivalues are still valid
container.erase (ei);
ivalues.erase (exi);
}
else
{
// nothing
}
// create new value
e.init (k, comment, rb, val);
// insert it
IniContainerElement ce (e);
container.push_back (ce);
// index it
ivalues.insert (IniEntryIndex::value_type (k, --container.end ()));
}
| 0
|
172,322
|
InspectorOverlayChromeClient(ChromeClient& client, InspectorOverlay* overlay)
: m_client(client)
, m_overlay(overlay)
{ }
| 0
|
340,035
|
int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
int64_t pos_min, int64_t pos_max, int64_t pos_limit,
int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))
{
int64_t pos, ts;
int64_t start_pos, filesize;
int no_change;
av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts));
if(ts_min == AV_NOPTS_VALUE){
pos_min = s->data_offset;
ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
if (ts_min == AV_NOPTS_VALUE)
return -1;
}
if(ts_min >= target_ts){
*ts_ret= ts_min;
return pos_min;
}
if(ts_max == AV_NOPTS_VALUE){
int64_t step= 1024;
int64_t limit;
filesize = avio_size(s->pb);
pos_max = filesize - 1;
do{
limit = pos_max;
pos_max = FFMAX(0, pos_max - step);
ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp);
step += step;
}while(ts_max == AV_NOPTS_VALUE && pos_max > 0);
if (ts_max == AV_NOPTS_VALUE)
return -1;
for(;;){
int64_t tmp_pos= pos_max + 1;
int64_t tmp_ts= ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp);
if(tmp_ts == AV_NOPTS_VALUE)
break;
ts_max= tmp_ts;
pos_max= tmp_pos;
if(tmp_pos >= filesize)
break;
}
pos_limit= pos_max;
}
if(ts_max <= target_ts){
*ts_ret= ts_max;
return pos_max;
}
if(ts_min > ts_max){
return -1;
}else if(ts_min == ts_max){
pos_limit= pos_min;
}
no_change=0;
while (pos_min < pos_limit) {
av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n",
pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max));
assert(pos_limit <= pos_max);
if(no_change==0){
int64_t approximate_keyframe_distance= pos_max - pos_limit;
// interpolate position (better than dichotomy)
pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min)
+ pos_min - approximate_keyframe_distance;
}else if(no_change==1){
// bisection, if interpolation failed to change min or max pos last time
pos = (pos_min + pos_limit)>>1;
}else{
/* linear search if bisection failed, can only happen if there
are very few or no keyframes between min/max */
pos=pos_min;
}
if(pos <= pos_min)
pos= pos_min + 1;
else if(pos > pos_limit)
pos= pos_limit;
start_pos= pos;
ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp); //may pass pos_limit instead of -1
if(pos == pos_max)
no_change++;
else
no_change=0;
av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %s %s %s target:%s limit:%"PRId64" start:%"PRId64" noc:%d\n",
pos_min, pos, pos_max,
av_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts),
pos_limit, start_pos, no_change);
if(ts == AV_NOPTS_VALUE){
av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");
return -1;
}
assert(ts != AV_NOPTS_VALUE);
if (target_ts <= ts) {
pos_limit = start_pos - 1;
pos_max = pos;
ts_max = ts;
}
if (target_ts >= ts) {
pos_min = pos;
ts_min = ts;
}
}
pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;
#if 0
pos_min = pos;
ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
pos_min++;
ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
av_dlog(s, "pos=0x%"PRIx64" %s<=%s<=%s\n",
pos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max));
#endif
*ts_ret= ts;
return pos;
}
| 0
|
135,439
|
void ecdsa_sign_legacy(ecdsa_signature_t *signature, const ecc_int256_t *hash, const ecc_int256_t *secret) {
ecc_int256_t hash_r, k, krecip, tmp;
ecc_25519_work_t kG;
uint8_t V[32], K[32];
// Reduce hash (instead of clearing 3 bits)
ecc_25519_gf_reduce(&hash_r, hash);
// Generate k
generate_k_prepare(V, K, secret->p, hash_r.p);
regenerate:
generate_k(k.p, V, K);
ecc_25519_gf_sanitize_secret(&k, &k);
// calculate k^(-1)
ecc_25519_gf_recip(&krecip, &k);
// calculate kG = k * base point
ecc_25519_scalarmult_base(&kG, &k);
// store x coordinate of kG in r
ecc_25519_store_xy_legacy(&tmp, NULL, &kG);
ecc_25519_gf_reduce(&signature->r, &tmp);
if (ecc_25519_gf_is_zero(&signature->r))
goto regenerate;
// tmp = r * secret
ecc_25519_gf_mult(&tmp, &signature->r, secret);
// s = hash + tmp = hash + r * secret
ecc_25519_gf_add(&signature->s, &hash_r, &tmp);
// tmp = krecip * s = k^(-1) * s
ecc_25519_gf_mult(&tmp, &krecip, &signature->s);
// mod n (order of G)
ecc_25519_gf_reduce(&signature->s, &tmp);
if (ecc_25519_gf_is_zero(&signature->s))
goto regenerate;
}
| 0
|
422,324
|
e_ews_connection_move_items (EEwsConnection *cnc,
gint pri,
const gchar *folder_id,
gboolean docopy,
const GSList *ids,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
const GSList *iter;
g_return_if_fail (cnc != NULL);
if (docopy)
msg = e_ews_message_new_with_header (
cnc->priv->settings,
cnc->priv->uri,
cnc->priv->impersonate_user,
"CopyItem",
NULL,
NULL,
cnc->priv->version,
E_EWS_EXCHANGE_2007_SP1,
FALSE,
TRUE);
else
msg = e_ews_message_new_with_header (
cnc->priv->settings,
cnc->priv->uri,
cnc->priv->impersonate_user,
"MoveItem",
NULL,
NULL,
cnc->priv->version,
E_EWS_EXCHANGE_2007_SP1,
FALSE,
TRUE);
e_soap_message_start_element (msg, "ToFolderId", "messages", NULL);
e_soap_message_start_element (msg, "FolderId", NULL, NULL);
e_soap_message_add_attribute (msg, "Id", folder_id, NULL, NULL);
e_soap_message_end_element (msg); /* FolderId */
e_soap_message_end_element (msg); /* ToFolderId */
e_soap_message_start_element (msg, "ItemIds", "messages", NULL);
for (iter = ids; iter != NULL; iter = g_slist_next (iter))
e_ews_message_write_string_parameter_with_attribute (msg, "ItemId", NULL, NULL, "Id", iter->data);
e_soap_message_end_element (msg); /* ItemIds */
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (
G_OBJECT (cnc), callback, user_data,
e_ews_connection_move_items);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
e_ews_connection_queue_request (
cnc, msg, get_items_response_cb,
pri, cancellable, simple);
g_object_unref (simple);
}
| 0
|
125,481
|
static unsigned postProcessScanlines(unsigned char* out, unsigned char* in,
unsigned w, unsigned h, const LodePNGInfo* info_png)
{
/*
This function converts the filtered-padded-interlaced data into pure 2D image buffer with the PNG's colortype.
Steps:
*) if no Adam7: 1) unfilter 2) remove padding bits (= posible extra bits per scanline if bpp < 8)
*) if adam7: 1) 7x unfilter 2) 7x remove padding bits 3) Adam7_deinterlace
NOTE: the in buffer will be overwritten with intermediate data!
*/
unsigned bpp = lodepng_get_bpp(&info_png->color);
if(bpp == 0) return 31; /*error: invalid colortype*/
if(info_png->interlace_method == 0)
{
if(bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8)
{
CERROR_TRY_RETURN(unfilter(in, in, w, h, bpp));
removePaddingBits(out, in, w * bpp, ((w * bpp + 7) / 8) * 8, h);
}
/*we can immediatly filter into the out buffer, no other steps needed*/
else CERROR_TRY_RETURN(unfilter(out, in, w, h, bpp));
}
else /*interlace_method is 1 (Adam7)*/
{
unsigned passw[7], passh[7]; size_t filter_passstart[8], padded_passstart[8], passstart[8];
unsigned i;
Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp);
for(i = 0; i < 7; i++)
{
CERROR_TRY_RETURN(unfilter(&in[padded_passstart[i]], &in[filter_passstart[i]], passw[i], passh[i], bpp));
/*TODO: possible efficiency improvement: if in this reduced image the bits fit nicely in 1 scanline,
move bytes instead of bits or move not at all*/
if(bpp < 8)
{
/*remove padding bits in scanlines; after this there still may be padding
bits between the different reduced images: each reduced image still starts nicely at a byte*/
removePaddingBits(&in[passstart[i]], &in[padded_passstart[i]], passw[i] * bpp,
((passw[i] * bpp + 7) / 8) * 8, passh[i]);
}
}
Adam7_deinterlace(out, in, w, h, bpp);
}
return 0;
}
| 0
|
488,412
|
static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
int sfmode, int sfcount, const struct in6_addr *psfsrc,
int delta)
{
struct ifmcaddr6 *pmc;
int isexclude;
int i, err;
if (!idev)
return -ENODEV;
for_each_mc_mclock(idev, pmc) {
if (ipv6_addr_equal(pmca, &pmc->mca_addr))
break;
}
if (!pmc)
return -ESRCH;
sf_markstate(pmc);
isexclude = pmc->mca_sfmode == MCAST_EXCLUDE;
if (!delta)
pmc->mca_sfcount[sfmode]++;
err = 0;
for (i = 0; i < sfcount; i++) {
err = ip6_mc_add1_src(pmc, sfmode, &psfsrc[i]);
if (err)
break;
}
if (err) {
int j;
if (!delta)
pmc->mca_sfcount[sfmode]--;
for (j = 0; j < i; j++)
ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);
} else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) {
struct ip6_sf_list *psf;
/* filter mode change */
if (pmc->mca_sfcount[MCAST_EXCLUDE])
pmc->mca_sfmode = MCAST_EXCLUDE;
else if (pmc->mca_sfcount[MCAST_INCLUDE])
pmc->mca_sfmode = MCAST_INCLUDE;
/* else no filters; keep old mode for reports */
pmc->mca_crcount = idev->mc_qrv;
idev->mc_ifc_count = pmc->mca_crcount;
for_each_psf_mclock(pmc, psf)
psf->sf_crcount = 0;
mld_ifc_event(idev);
} else if (sf_setstate(pmc)) {
mld_ifc_event(idev);
}
return err;
}
| 0
|
292,169
|
static pyc_object *get_none_object(void) {
pyc_object *ret = R_NEW0 (pyc_object);
if (!ret) {
return NULL;
}
ret->type = TYPE_NONE;
ret->data = strdup ("None");
if (!ret->data) {
R_FREE (ret);
}
return ret;
}
| 0
|
472,446
|
static int selinux_task_getsid(struct task_struct *p)
{
return avc_has_perm(&selinux_state,
current_sid(), task_sid_obj(p), SECCLASS_PROCESS,
PROCESS__GETSESSION, NULL);
}
| 0
|
269,505
|
ofpact_init(struct ofpact *ofpact, enum ofpact_type type, size_t len)
{
memset(ofpact, 0, len);
ofpact->type = type;
ofpact->raw = -1;
ofpact->len = len;
}
| 0
|
374,075
|
int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
{
bool pr = false;
switch (msr) {
case MSR_EFER:
return set_efer(vcpu, data);
case MSR_K7_HWCR:
data &= ~(u64)0x40; /* ignore flush filter disable */
data &= ~(u64)0x100; /* ignore ignne emulation enable */
data &= ~(u64)0x8; /* ignore TLB cache disable */
if (data != 0) {
pr_unimpl(vcpu, "unimplemented HWCR wrmsr: 0x%llx\n",
data);
return 1;
}
break;
case MSR_FAM10H_MMIO_CONF_BASE:
if (data != 0) {
pr_unimpl(vcpu, "unimplemented MMIO_CONF_BASE wrmsr: "
"0x%llx\n", data);
return 1;
}
break;
case MSR_AMD64_NB_CFG:
break;
case MSR_IA32_DEBUGCTLMSR:
if (!data) {
/* We support the non-activated case already */
break;
} else if (data & ~(DEBUGCTLMSR_LBR | DEBUGCTLMSR_BTF)) {
/* Values other than LBR and BTF are vendor-specific,
thus reserved and should throw a #GP */
return 1;
}
pr_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
__func__, data);
break;
case MSR_IA32_UCODE_REV:
case MSR_IA32_UCODE_WRITE:
case MSR_VM_HSAVE_PA:
case MSR_AMD64_PATCH_LOADER:
break;
case 0x200 ... 0x2ff:
return set_msr_mtrr(vcpu, msr, data);
case MSR_IA32_APICBASE:
kvm_set_apic_base(vcpu, data);
break;
case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
return kvm_x2apic_msr_write(vcpu, msr, data);
case MSR_IA32_TSCDEADLINE:
kvm_set_lapic_tscdeadline_msr(vcpu, data);
break;
case MSR_IA32_MISC_ENABLE:
vcpu->arch.ia32_misc_enable_msr = data;
break;
case MSR_KVM_WALL_CLOCK_NEW:
case MSR_KVM_WALL_CLOCK:
vcpu->kvm->arch.wall_clock = data;
kvm_write_wall_clock(vcpu->kvm, data);
break;
case MSR_KVM_SYSTEM_TIME_NEW:
case MSR_KVM_SYSTEM_TIME: {
kvmclock_reset(vcpu);
vcpu->arch.time = data;
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
/* we verify if the enable bit is set... */
if (!(data & 1))
break;
/* ...but clean it before doing the actual write */
vcpu->arch.time_offset = data & ~(PAGE_MASK | 1);
vcpu->arch.time_page =
gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT);
if (is_error_page(vcpu->arch.time_page)) {
kvm_release_page_clean(vcpu->arch.time_page);
vcpu->arch.time_page = NULL;
}
break;
}
case MSR_KVM_ASYNC_PF_EN:
if (kvm_pv_enable_async_pf(vcpu, data))
return 1;
break;
case MSR_KVM_STEAL_TIME:
if (unlikely(!sched_info_on()))
return 1;
if (data & KVM_STEAL_RESERVED_MASK)
return 1;
if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime,
data & KVM_STEAL_VALID_BITS))
return 1;
vcpu->arch.st.msr_val = data;
if (!(data & KVM_MSR_ENABLED))
break;
vcpu->arch.st.last_steal = current->sched_info.run_delay;
preempt_disable();
accumulate_steal_time(vcpu);
preempt_enable();
kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
break;
case MSR_IA32_MCG_CTL:
case MSR_IA32_MCG_STATUS:
case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1:
return set_msr_mce(vcpu, msr, data);
/* Performance counters are not protected by a CPUID bit,
* so we should check all of them in the generic path for the sake of
* cross vendor migration.
* Writing a zero into the event select MSRs disables them,
* which we perfectly emulate ;-). Any other value should be at least
* reported, some guests depend on them.
*/
case MSR_K7_EVNTSEL0:
case MSR_K7_EVNTSEL1:
case MSR_K7_EVNTSEL2:
case MSR_K7_EVNTSEL3:
if (data != 0)
pr_unimpl(vcpu, "unimplemented perfctr wrmsr: "
"0x%x data 0x%llx\n", msr, data);
break;
/* at least RHEL 4 unconditionally writes to the perfctr registers,
* so we ignore writes to make it happy.
*/
case MSR_K7_PERFCTR0:
case MSR_K7_PERFCTR1:
case MSR_K7_PERFCTR2:
case MSR_K7_PERFCTR3:
pr_unimpl(vcpu, "unimplemented perfctr wrmsr: "
"0x%x data 0x%llx\n", msr, data);
break;
case MSR_P6_PERFCTR0:
case MSR_P6_PERFCTR1:
pr = true;
case MSR_P6_EVNTSEL0:
case MSR_P6_EVNTSEL1:
if (kvm_pmu_msr(vcpu, msr))
return kvm_pmu_set_msr(vcpu, msr, data);
if (pr || data != 0)
pr_unimpl(vcpu, "disabled perfctr wrmsr: "
"0x%x data 0x%llx\n", msr, data);
break;
case MSR_K7_CLK_CTL:
/*
* Ignore all writes to this no longer documented MSR.
* Writes are only relevant for old K7 processors,
* all pre-dating SVM, but a recommended workaround from
* AMD for these chips. It is possible to speicify the
* affected processor models on the command line, hence
* the need to ignore the workaround.
*/
break;
case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15:
if (kvm_hv_msr_partition_wide(msr)) {
int r;
mutex_lock(&vcpu->kvm->lock);
r = set_msr_hyperv_pw(vcpu, msr, data);
mutex_unlock(&vcpu->kvm->lock);
return r;
} else
return set_msr_hyperv(vcpu, msr, data);
break;
case MSR_IA32_BBL_CR_CTL3:
/* Drop writes to this legacy MSR -- see rdmsr
* counterpart for further detail.
*/
pr_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n", msr, data);
break;
case MSR_AMD64_OSVW_ID_LENGTH:
if (!guest_cpuid_has_osvw(vcpu))
return 1;
vcpu->arch.osvw.length = data;
break;
case MSR_AMD64_OSVW_STATUS:
if (!guest_cpuid_has_osvw(vcpu))
return 1;
vcpu->arch.osvw.status = data;
break;
default:
if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr))
return xen_hvm_config(vcpu, data);
if (kvm_pmu_msr(vcpu, msr))
return kvm_pmu_set_msr(vcpu, msr, data);
if (!ignore_msrs) {
pr_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n",
msr, data);
return 1;
} else {
pr_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n",
msr, data);
break;
}
}
return 0;
}
| 0
|
42,765
|
static void ccp_process_data(struct ccp_data *src, struct ccp_data *dst,
struct ccp_op *op)
{
op->init = 0;
if (dst) {
if (op->dst.u.dma.address == dst->dm_wa.dma.address)
ccp_empty_queue_buf(dst);
else
ccp_update_sg_workarea(&dst->sg_wa,
op->dst.u.dma.length);
}
}
| 0
|
397,231
|
gst_mpegts_section_send_event (GstMpegtsSection * section, GstElement * element)
{
GstEvent *event;
g_return_val_if_fail (section != NULL, FALSE);
g_return_val_if_fail (element != NULL, FALSE);
event = _mpegts_section_get_event (section);
if (!gst_element_send_event (element, event)) {
gst_event_unref (event);
return FALSE;
}
return TRUE;
}
| 0
|
481,272
|
_lou_defaultTableResolver(const char *tableList, const char *base) {
char *searchPath;
char **tableFiles;
char *subTable;
char *tableList_copy;
char *cp;
int last;
int k;
/* Set up search path */
searchPath = _lou_getTablePath();
/* Count number of subtables in table list */
k = 0;
for (cp = (char *)tableList; *cp != '\0'; cp++)
if (*cp == ',') k++;
tableFiles = (char **)calloc(k + 2, sizeof(char *));
if (!tableFiles) _lou_outOfMemory();
/* Resolve subtables */
k = 0;
tableList_copy = strdup(tableList);
for (subTable = tableList_copy;; subTable = cp + 1) {
for (cp = subTable; *cp != '\0' && *cp != ','; cp++)
;
last = (*cp == '\0');
*cp = '\0';
if (!(tableFiles[k++] = resolveSubtable(subTable, base, searchPath))) {
char *path;
_lou_logMessage(LOU_LOG_ERROR, "Cannot resolve table '%s'", subTable);
path = getenv("LOUIS_TABLEPATH");
if (path != NULL && path[0] != '\0')
_lou_logMessage(LOU_LOG_ERROR, "LOUIS_TABLEPATH=%s", path);
free(searchPath);
free(tableList_copy);
free_tablefiles(tableFiles);
return NULL;
}
if (k == 1) base = subTable;
if (last) break;
}
free(searchPath);
free(tableList_copy);
tableFiles[k] = NULL;
return tableFiles;
}
| 0
|
78,030
|
u_save_line(undoline_T *ul, linenr_T lnum)
{
char_u *line = ml_get(lnum);
if (curbuf->b_ml.ml_line_len == 0)
{
ul->ul_len = 1;
ul->ul_line = vim_strsave((char_u *)"");
}
else
{
// This uses the length in the memline, thus text properties are
// included.
ul->ul_len = curbuf->b_ml.ml_line_len;
ul->ul_line = vim_memsave(line, ul->ul_len);
}
return ul->ul_line == NULL ? FAIL : OK;
}
| 0
|
339,667
|
static int configure_video_filters(FilterGraph *fg)
{
InputStream *ist = fg->inputs[0]->ist;
OutputStream *ost = fg->outputs[0]->ost;
AVFilterContext *in_filter, *out_filter, *filter;
AVCodecContext *codec = ost->st->codec;
AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
char *pix_fmts;
AVRational sample_aspect_ratio;
char args[255];
int ret;
avfilter_graph_free(&fg->graph);
fg->graph = avfilter_graph_alloc();
if (!fg->graph)
return AVERROR(ENOMEM);
if (ist->st->sample_aspect_ratio.num) {
sample_aspect_ratio = ist->st->sample_aspect_ratio;
} else
sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d:flags=%d", ist->st->codec->width,
ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
sample_aspect_ratio.num, sample_aspect_ratio.den, SWS_BILINEAR + ((ist->st->codec->flags&CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0));
ret = avfilter_graph_create_filter(&fg->inputs[0]->filter,
avfilter_get_by_name("buffer"),
"src", args, NULL, fg->graph);
if (ret < 0)
return ret;
#if FF_API_OLD_VSINK_API
ret = avfilter_graph_create_filter(&fg->outputs[0]->filter,
avfilter_get_by_name("buffersink"),
"out", NULL, NULL, fg->graph);
#else
ret = avfilter_graph_create_filter(&fg->outputs[0]->filter,
avfilter_get_by_name("buffersink"),
"out", NULL, buffersink_params, fg->graph);
#endif
av_freep(&buffersink_params);
if (ret < 0)
return ret;
in_filter = fg->inputs[0]->filter;
out_filter = fg->outputs[0]->filter;
if (codec->width || codec->height) {
snprintf(args, 255, "%d:%d:flags=0x%X",
codec->width,
codec->height,
(unsigned)ost->sws_flags);
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
NULL, args, NULL, fg->graph)) < 0)
return ret;
if ((ret = avfilter_link(in_filter, 0, filter, 0)) < 0)
return ret;
in_filter = filter;
}
if ((pix_fmts = choose_pixel_fmts(ost))) {
if ((ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
"format", pix_fmts, NULL,
fg->graph)) < 0)
return ret;
if ((ret = avfilter_link(filter, 0, out_filter, 0)) < 0)
return ret;
out_filter = filter;
av_freep(&pix_fmts);
}
snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
fg->graph->scale_sws_opts = av_strdup(args);
if (ost->avfilter) {
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
outputs->name = av_strdup("in");
outputs->filter_ctx = in_filter;
outputs->pad_idx = 0;
outputs->next = NULL;
inputs->name = av_strdup("out");
inputs->filter_ctx = out_filter;
inputs->pad_idx = 0;
inputs->next = NULL;
if ((ret = avfilter_graph_parse(fg->graph, ost->avfilter, &inputs, &outputs, NULL)) < 0)
return ret;
av_freep(&ost->avfilter);
} else {
if ((ret = avfilter_link(in_filter, 0, out_filter, 0)) < 0)
return ret;
}
if (ost->keep_pix_fmt)
avfilter_graph_set_auto_convert(fg->graph,
AVFILTER_AUTO_CONVERT_NONE);
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
return ret;
ost->filter = fg->outputs[0];
return 0;
}
| 1
|
88,394
|
bool CZNC::AddListener(CListener* pListener) {
if (!pListener->GetRealListener()) {
// Listener doesn't actually listen
delete pListener;
return false;
}
// We don't check if there is an identical listener already listening
// since one can't listen on e.g. the same port multiple times
m_vpListeners.push_back(pListener);
return true;
}
| 0
|
238,756
|
explicit LastMuteMetadata(content::WebContents* contents) {}
| 0
|
282,220
|
InlineBox* RenderBox::createInlineBox()
{
return new (renderArena()) InlineBox(this);
}
| 0
|
88,325
|
**/
explicit CImg(const CImgDisplay &disp):_width(0),_height(0),_depth(0),_spectrum(0),_is_shared(false),_data(0) {
disp.snapshot(*this);
| 0
|
398,110
|
ip_has_invalid_namespace_p(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp *)NULL) {
/* deleted IP */
return Qtrue;
}
#if TCL_NAMESPACE_DEBUG
if (rbtk_invalid_namespace(ptr)) {
return Qtrue;
} else {
return Qfalse;
}
#else
return Qfalse;
#endif
}
| 0
|
521,439
|
void JOIN::clear()
{
clear_tables(this);
copy_fields(&tmp_table_param);
if (sum_funcs)
{
Item_sum *func, **func_ptr= sum_funcs;
while ((func= *(func_ptr++)))
func->clear();
}
}
| 0
|
9,394
|
ReleaseAccelerator(ui::KeyboardCode keycode,
bool shift_pressed,
bool ctrl_pressed,
bool alt_pressed)
: ui::Accelerator(keycode, shift_pressed, ctrl_pressed, alt_pressed) {
set_type(ui::ET_KEY_RELEASED);
}
| 1
|
408,860
|
objects_dump(fz_context *ctx, pdf_document *doc, pdf_write_state *opts)
{
int i;
for (i=0; i < pdf_xref_len(ctx, doc); i++)
{
fprintf(stderr, "Object %d use=%x offset=%d\n", i, opts->use_list[i], (int)opts->ofs_list[i]);
}
}
| 0
|
340,058
|
static void mem_info(Monitor *mon)
{
CPUState *env;
int l1, l2, prot, last_prot;
uint32_t pgd, pde, pte, start, end;
env = mon_get_cpu();
if (!env)
return;
if (!(env->cr[0] & CR0_PG_MASK)) {
monitor_printf(mon, "PG disabled\n");
return;
}
pgd = env->cr[3] & ~0xfff;
last_prot = 0;
start = -1;
for(l1 = 0; l1 < 1024; l1++) {
cpu_physical_memory_read(pgd + l1 * 4, (uint8_t *)&pde, 4);
pde = le32_to_cpu(pde);
end = l1 << 22;
if (pde & PG_PRESENT_MASK) {
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
mem_print(mon, &start, &last_prot, end, prot);
} else {
for(l2 = 0; l2 < 1024; l2++) {
cpu_physical_memory_read((pde & ~0xfff) + l2 * 4,
(uint8_t *)&pte, 4);
pte = le32_to_cpu(pte);
end = (l1 << 22) + (l2 << 12);
if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
} else {
prot = 0;
}
mem_print(mon, &start, &last_prot, end, prot);
}
}
} else {
prot = 0;
mem_print(mon, &start, &last_prot, end, prot);
}
}
}
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.