idx
int64 | func
string | target
int64 |
|---|---|---|
159,404
|
static int addrconf_notify(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct inet6_dev *idev = __in6_dev_get(dev);
int run_pending = 0;
int err;
switch (event) {
case NETDEV_REGISTER:
if (!idev && dev->mtu >= IPV6_MIN_MTU) {
idev = ipv6_add_dev(dev);
if (IS_ERR(idev))
return notifier_from_errno(PTR_ERR(idev));
}
break;
case NETDEV_UP:
case NETDEV_CHANGE:
if (dev->flags & IFF_SLAVE)
break;
if (idev && idev->cnf.disable_ipv6)
break;
if (event == NETDEV_UP) {
if (!addrconf_qdisc_ok(dev)) {
/* device is not ready yet. */
pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n",
dev->name);
break;
}
if (!idev && dev->mtu >= IPV6_MIN_MTU)
idev = ipv6_add_dev(dev);
if (!IS_ERR_OR_NULL(idev)) {
idev->if_flags |= IF_READY;
run_pending = 1;
}
} else {
if (!addrconf_qdisc_ok(dev)) {
/* device is still not ready. */
break;
}
if (idev) {
if (idev->if_flags & IF_READY)
/* device is already configured. */
break;
idev->if_flags |= IF_READY;
}
pr_info("ADDRCONF(NETDEV_CHANGE): %s: link becomes ready\n",
dev->name);
run_pending = 1;
}
switch (dev->type) {
#if IS_ENABLED(CONFIG_IPV6_SIT)
case ARPHRD_SIT:
addrconf_sit_config(dev);
break;
#endif
#if IS_ENABLED(CONFIG_NET_IPGRE)
case ARPHRD_IPGRE:
addrconf_gre_config(dev);
break;
#endif
case ARPHRD_LOOPBACK:
init_loopback(dev);
break;
default:
addrconf_dev_config(dev);
break;
}
if (!IS_ERR_OR_NULL(idev)) {
if (run_pending)
addrconf_dad_run(idev);
/*
* If the MTU changed during the interface down,
* when the interface up, the changed MTU must be
* reflected in the idev as well as routers.
*/
if (idev->cnf.mtu6 != dev->mtu &&
dev->mtu >= IPV6_MIN_MTU) {
rt6_mtu_change(dev, dev->mtu);
idev->cnf.mtu6 = dev->mtu;
}
idev->tstamp = jiffies;
inet6_ifinfo_notify(RTM_NEWLINK, idev);
/*
* If the changed mtu during down is lower than
* IPV6_MIN_MTU stop IPv6 on this interface.
*/
if (dev->mtu < IPV6_MIN_MTU)
addrconf_ifdown(dev, 1);
}
break;
case NETDEV_CHANGEMTU:
if (idev && dev->mtu >= IPV6_MIN_MTU) {
rt6_mtu_change(dev, dev->mtu);
idev->cnf.mtu6 = dev->mtu;
break;
}
if (!idev && dev->mtu >= IPV6_MIN_MTU) {
idev = ipv6_add_dev(dev);
if (!IS_ERR(idev))
break;
}
/*
* if MTU under IPV6_MIN_MTU.
* Stop IPv6 on this interface.
*/
case NETDEV_DOWN:
case NETDEV_UNREGISTER:
/*
* Remove all addresses from this interface.
*/
addrconf_ifdown(dev, event != NETDEV_DOWN);
break;
case NETDEV_CHANGENAME:
if (idev) {
snmp6_unregister_dev(idev);
addrconf_sysctl_unregister(idev);
err = addrconf_sysctl_register(idev);
if (err)
return notifier_from_errno(err);
err = snmp6_register_dev(idev);
if (err) {
addrconf_sysctl_unregister(idev);
return notifier_from_errno(err);
}
}
break;
case NETDEV_PRE_TYPE_CHANGE:
case NETDEV_POST_TYPE_CHANGE:
addrconf_type_change(dev, event);
break;
}
return NOTIFY_OK;
}
| 0
|
432,150
|
static int snd_line6_control_playback_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int i;
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
for (i = 0; i < 2; i++)
ucontrol->value.integer.value[i] = line6pcm->volume_playback[i];
return 0;
}
| 0
|
44,592
|
static int get_float64(QEMUFile *f, void *pv, size_t size)
{
float64 *v = pv;
*v = make_float64(qemu_get_be64(f));
return 0;
}
| 1
|
51,658
|
static inline bool kvm_apic_sw_enabled(struct kvm_lapic *apic)
{
if (static_key_false(&apic_sw_disabled.key))
return apic->sw_enabled;
return true;
}
| 0
|
32,139
|
static struct fdtable * alloc_fdtable(unsigned int nr)
{
struct fdtable *fdt;
void *data;
/*
* Figure out how many fds we actually want to support in this fdtable.
* Allocation steps are keyed to the size of the fdarray, since it
* grows far faster than any of the other dynamic data. We try to fit
* the fdarray into comfortable page-tuned chunks: starting at 1024B
* and growing in powers of two from there on.
*/
nr /= (1024 / sizeof(struct file *));
nr = roundup_pow_of_two(nr + 1);
nr *= (1024 / sizeof(struct file *));
/*
* Note that this can drive nr *below* what we had passed if sysctl_nr_open
* had been set lower between the check in expand_files() and here. Deal
* with that in caller, it's cheaper that way.
*
* We make sure that nr remains a multiple of BITS_PER_LONG - otherwise
* bitmaps handling below becomes unpleasant, to put it mildly...
*/
if (unlikely(nr > sysctl_nr_open))
nr = ((sysctl_nr_open - 1) | (BITS_PER_LONG - 1)) + 1;
fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL_ACCOUNT);
if (!fdt)
goto out;
fdt->max_fds = nr;
data = kvmalloc_array(nr, sizeof(struct file *), GFP_KERNEL_ACCOUNT);
if (!data)
goto out_fdt;
fdt->fd = data;
data = kvmalloc(max_t(size_t,
2 * nr / BITS_PER_BYTE + BITBIT_SIZE(nr), L1_CACHE_BYTES),
GFP_KERNEL_ACCOUNT);
if (!data)
goto out_arr;
fdt->open_fds = data;
data += nr / BITS_PER_BYTE;
fdt->close_on_exec = data;
data += nr / BITS_PER_BYTE;
fdt->full_fds_bits = data;
return fdt;
out_arr:
kvfree(fdt->fd);
out_fdt:
kfree(fdt);
out:
return NULL;
}
| 0
|
146,748
|
CURLcode Curl_auth_create_external_message(struct Curl_easy *data,
const char *user, char **outptr,
size_t *outlen)
{
/* This is the same formatting as the login message */
return Curl_auth_create_login_message(data, user, outptr, outlen);
}
| 0
|
275,146
|
void QtBuiltinBundlePage::registerNavigatorQtObject(JSGlobalContextRef context)
{
static JSStringRef postMessageName = JSStringCreateWithUTF8CString("postMessage");
static JSStringRef navigatorName = JSStringCreateWithUTF8CString("navigator");
static JSStringRef qtName = JSStringCreateWithUTF8CString("qt");
if (m_navigatorQtObject)
JSValueUnprotect(context, m_navigatorQtObject);
m_navigatorQtObject = JSObjectMake(context, navigatorQtObjectClass(), this);
JSValueProtect(context, m_navigatorQtObject);
JSObjectRef postMessage = JSObjectMakeFunctionWithCallback(context, postMessageName, qt_postMessageCallback);
JSObjectSetProperty(context, m_navigatorQtObject, postMessageName, postMessage, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, 0);
JSValueRef navigatorValue = JSObjectGetProperty(context, JSContextGetGlobalObject(context), navigatorName, 0);
if (!JSValueIsObject(context, navigatorValue))
return;
JSObjectRef navigatorObject = JSValueToObject(context, navigatorValue, 0);
JSObjectSetProperty(context, navigatorObject, qtName, m_navigatorQtObject, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, 0);
}
| 0
|
341,363
|
static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov)
{
BDRVQcowState *s = bs->opaque;
int index_in_cluster;
int ret = 0, n;
uint64_t cluster_offset;
struct iovec hd_iov;
QEMUIOVector hd_qiov;
uint8_t *buf;
void *orig_buf;
Error *err = NULL;
if (qiov->niov > 1) {
buf = orig_buf = qemu_try_blockalign(bs, qiov->size);
if (buf == NULL) {
return -ENOMEM;
}
} else {
orig_buf = NULL;
buf = (uint8_t *)qiov->iov->iov_base;
}
qemu_co_mutex_lock(&s->lock);
while (nb_sectors != 0) {
/* prepare next request */
cluster_offset = get_cluster_offset(bs, sector_num << 9,
0, 0, 0, 0);
index_in_cluster = sector_num & (s->cluster_sectors - 1);
n = s->cluster_sectors - index_in_cluster;
if (n > nb_sectors) {
n = nb_sectors;
}
if (!cluster_offset) {
if (bs->backing) {
/* read from the base image */
hd_iov.iov_base = (void *)buf;
hd_iov.iov_len = n * 512;
qemu_iovec_init_external(&hd_qiov, &hd_iov, 1);
qemu_co_mutex_unlock(&s->lock);
ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
goto fail;
}
} else {
/* Note: in this case, no need to wait */
memset(buf, 0, 512 * n);
}
} else if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
/* add AIO support for compressed blocks ? */
if (decompress_cluster(bs, cluster_offset) < 0) {
goto fail;
}
memcpy(buf,
s->cluster_cache + index_in_cluster * 512, 512 * n);
} else {
if ((cluster_offset & 511) != 0) {
goto fail;
}
hd_iov.iov_base = (void *)buf;
hd_iov.iov_len = n * 512;
qemu_iovec_init_external(&hd_qiov, &hd_iov, 1);
qemu_co_mutex_unlock(&s->lock);
ret = bdrv_co_readv(bs->file,
(cluster_offset >> 9) + index_in_cluster,
n, &hd_qiov);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
break;
}
if (bs->encrypted) {
assert(s->cipher);
if (encrypt_sectors(s, sector_num, buf,
n, false, &err) < 0) {
goto fail;
}
}
}
ret = 0;
nb_sectors -= n;
sector_num += n;
buf += n * 512;
}
done:
qemu_co_mutex_unlock(&s->lock);
if (qiov->niov > 1) {
qemu_iovec_from_buf(qiov, 0, orig_buf, qiov->size);
qemu_vfree(orig_buf);
}
return ret;
fail:
error_free(err);
ret = -EIO;
goto done;
}
| 0
|
174,236
|
DrawingBufferClientRestorePixelUnpackBufferBinding() {}
| 0
|
275,039
|
BOOLEAN btif_hl_find_app_idx_using_deleted_mdl_id( UINT8 mdl_id,
UINT8 *p_app_idx){
btif_hl_app_cb_t *p_acb;
BOOLEAN found=FALSE;
UINT8 i;
for (i=0; i<BTA_HL_NUM_APPS; i++)
{
p_acb =BTIF_HL_GET_APP_CB_PTR(i);
if (p_acb->delete_mdl.active) {
BTIF_TRACE_DEBUG("%s: app_idx=%d, mdl_id=%d",
__FUNCTION__,i,mdl_id);
}
if (p_acb->delete_mdl.active &&
(p_acb->delete_mdl.mdl_id == mdl_id))
{
found = TRUE;
*p_app_idx = i;
break;
}
}
BTIF_TRACE_DEBUG("%s found=%d app_idx=%d",__FUNCTION__,
found, i);
return found;
}
| 0
|
217,327
|
HTTP_Init(void)
{
#define HTTPH(a, b, c, d, e, f, g) b[0] = (char)strlen(b + 1);
#include "http_headers.h"
#undef HTTPH
}
| 0
|
127,161
|
iperf_setaffinity(int affinity)
{
#ifdef linux
cpu_set_t cpu_set;
CPU_ZERO(&cpu_set);
CPU_SET(affinity, &cpu_set);
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpu_set) != 0) {
i_errno = IEAFFINITY;
return -1;
}
return 0;
#else /*linux*/
i_errno = IEAFFINITY;
return -1;
#endif /*linux*/
}
| 0
|
38,941
|
auth_sig_compatible(uint8_t type)
{
switch (type) {
case IKEV2_AUTH_RSA_SIG:
case IKEV2_AUTH_ECDSA_256:
case IKEV2_AUTH_ECDSA_384:
case IKEV2_AUTH_ECDSA_521:
case IKEV2_AUTH_SIG_ANY:
return (1);
}
return (0);
}
| 0
|
372,598
|
void addHeader(string &headers, const char *name, const StaticString &value) {
if (name != NULL) {
headers.append(name);
headers.append(1, '\0');
headers.append(value.c_str(), value.size());
headers.append(1, '\0');
}
}
| 0
|
342,591
|
static void virtio_setup(uint64_t dev_info)
{
struct schib schib;
int ssid;
bool found = false;
uint16_t dev_no;
/*
* We unconditionally enable mss support. In every sane configuration,
* this will succeed; and even if it doesn't, stsch_err() can deal
* with the consequences.
*/
enable_mss_facility();
if (dev_info != -1) {
dev_no = dev_info & 0xffff;
debug_print_int("device no. ", dev_no);
blk_schid.ssid = (dev_info >> 16) & 0x3;
debug_print_int("ssid ", blk_schid.ssid);
found = find_dev(&schib, dev_no);
} else {
for (ssid = 0; ssid < 0x3; ssid++) {
blk_schid.ssid = ssid;
found = find_dev(&schib, -1);
if (found) {
break;
}
}
}
if (!found) {
virtio_panic("No virtio-blk device found!\n");
}
virtio_setup_block(blk_schid);
if (!virtio_ipl_disk_is_valid()) {
virtio_panic("No valid hard disk detected.\n");
}
}
| 1
|
302,107
|
static void uv__write_int(int fd, int val) {
ssize_t n;
do
n = write(fd, &val, sizeof(val));
while (n == -1 && errno == EINTR);
if (n == -1 && errno == EPIPE)
return; /* parent process has quit */
assert(n == sizeof(val));
}
| 0
|
224,060
|
ResourceFetcher::~ResourceFetcher() {}
| 0
|
273,662
|
hfs_make_badblockfile(HFS_INFO * hfs, TSK_FS_FILE * fs_file)
{
TSK_FS_ATTR *fs_attr;
unsigned char dummy1, dummy2;
uint64_t dummy3;
uint8_t result;
if (tsk_verbose)
tsk_fprintf(stderr,
"hfs_make_badblockfile: Making virtual badblock file\n");
if (hfs_make_specialbase(fs_file)) {
error_returned(" - hfs_make_badblockfile");
return 1;
}
fs_file->meta->addr = HFS_BAD_BLOCK_FILE_ID;
strncpy(fs_file->meta->name2->name, HFS_BAD_BLOCK_FILE_NAME,
TSK_FS_META_NAME_LIST_NSIZE);
fs_file->meta->size = 0;
if ((fs_attr =
tsk_fs_attrlist_getnew(fs_file->meta->attr,
TSK_FS_ATTR_NONRES)) == NULL) {
error_returned(" - hfs_make_badblockfile");
return 1;
}
// add the run to the file.
if (tsk_fs_attr_set_run(fs_file, fs_attr, NULL, NULL,
TSK_FS_ATTR_TYPE_DEFAULT, HFS_FS_ATTR_ID_DATA,
fs_file->meta->size, fs_file->meta->size, fs_file->meta->size,
0, 0)) {
error_returned(" - hfs_make_badblockfile");
return 1;
}
// see if file has additional runs
if (hfs_ext_find_extent_record_attr(hfs, HFS_BAD_BLOCK_FILE_ID,
fs_attr, TRUE)) {
error_returned(" - hfs_make_badblockfile");
fs_file->meta->attr_state = TSK_FS_META_ATTR_ERROR;
return 1;
}
/* @@@ We have a chicken and egg problem here... The current design of
* fs_attr_set() requires the size to be set, but we dont' know the size
* until we look into the extents file (which adds to an attribute...).
* This does not seem to be the best design... neeed a way to test this. */
fs_file->meta->size = fs_attr->nrd.initsize;
fs_attr->size = fs_file->meta->size;
fs_attr->nrd.allocsize = fs_file->meta->size;
result = hfs_load_extended_attrs(fs_file, &dummy1, &dummy2, &dummy3);
if (result != 0) {
if (tsk_verbose)
tsk_fprintf(stderr,
"WARNING: Extended attributes failed to load for the BadBlocks file.\n");
tsk_error_reset();
}
fs_file->meta->attr_state = TSK_FS_META_ATTR_STUDIED;
return 0;
}
| 0
|
463,963
|
static CURLcode gtls_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum, /* output */
size_t sha256len)
{
struct sha256_ctx SHA256pw;
sha256_init(&SHA256pw);
sha256_update(&SHA256pw, (unsigned int)tmplen, tmp);
sha256_digest(&SHA256pw, (unsigned int)sha256len, sha256sum);
return CURLE_OK;
}
| 0
|
305,829
|
static int cac_match_card(sc_card_t *card)
{
int r;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
/* Since we send an APDU, the card's logout function may be called...
* however it may be in dirty memory */
card->ops->logout = NULL;
r = cac_find_and_initialize(card, 0);
return (r == SC_SUCCESS); /* never match */
}
| 0
|
236,180
|
qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
guint32 fourcc, const guint8 * data, int len, gchar ** codec_name)
{
GstCaps *caps;
const GstStructure *s;
const gchar *name;
gint endian = 0;
GST_DEBUG_OBJECT (qtdemux, "resolve fourcc %08x", fourcc);
switch (fourcc) {
case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'):
case GST_MAKE_FOURCC ('r', 'a', 'w', ' '):
_codec ("Raw 8-bit PCM audio");
caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 8,
"depth", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, FALSE, NULL);
break;
case GST_MAKE_FOURCC ('t', 'w', 'o', 's'):
endian = G_BIG_ENDIAN;
/* fall-through */
case GST_MAKE_FOURCC ('s', 'o', 'w', 't'):
{
gchar *str;
gint depth;
if (!endian)
endian = G_LITTLE_ENDIAN;
depth = stream->bytes_per_packet * 8;
str = g_strdup_printf ("Raw %d-bit PCM audio", depth);
_codec (str);
g_free (str);
caps = gst_caps_new_simple ("audio/x-raw-int",
"width", G_TYPE_INT, depth, "depth", G_TYPE_INT, depth,
"endianness", G_TYPE_INT, endian,
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
break;
}
case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
_codec ("Raw 64-bit floating-point audio");
caps = gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 64,
"endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
break;
case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
_codec ("Raw 32-bit floating-point audio");
caps = gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 32,
"endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
break;
case GST_MAKE_FOURCC ('i', 'n', '2', '4'):
_codec ("Raw 24-bit PCM audio");
caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24,
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
break;
case GST_MAKE_FOURCC ('i', 'n', '3', '2'):
_codec ("Raw 32-bit PCM audio");
caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 32,
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
break;
case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'):
_codec ("Mu-law audio");
caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
break;
case GST_MAKE_FOURCC ('a', 'l', 'a', 'w'):
_codec ("A-law audio");
caps = gst_caps_new_simple ("audio/x-alaw", NULL);
break;
case 0x0200736d:
case 0x6d730002:
_codec ("Microsoft ADPCM");
/* Microsoft ADPCM-ACM code 2 */
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "microsoft", NULL);
break;
case 0x1100736d:
case 0x6d730011:
_codec ("IMA Loki SDL MJPEG ADPCM");
/* Loki ADPCM, See #550288 for a file that only decodes
* with the smjpeg variant of the ADPCM decoder. */
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "smjpeg", NULL);
break;
case 0x1700736d:
case 0x6d730017:
_codec ("DVI/Intel IMA ADPCM");
/* FIXME DVI/Intel IMA ADPCM/ACM code 17 */
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "quicktime", NULL);
break;
case 0x5500736d:
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case GST_MAKE_FOURCC ('.', 'm', 'p', '3'):
_codec ("MPEG-1 layer 3");
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
caps = gst_caps_new_simple ("audio/mpeg", "layer", G_TYPE_INT, 3,
"mpegversion", G_TYPE_INT, 1, NULL);
break;
case 0x20736d:
_codec ("AC-3 audio");
caps = gst_caps_new_simple ("audio/x-ac3", NULL);
break;
case GST_MAKE_FOURCC ('M', 'A', 'C', '3'):
_codec ("MACE-3");
caps = gst_caps_new_simple ("audio/x-mace",
"maceversion", G_TYPE_INT, 3, NULL);
break;
case GST_MAKE_FOURCC ('M', 'A', 'C', '6'):
_codec ("MACE-6");
caps = gst_caps_new_simple ("audio/x-mace",
"maceversion", G_TYPE_INT, 6, NULL);
break;
case GST_MAKE_FOURCC ('O', 'g', 'g', 'V'):
/* ogg/vorbis */
caps = gst_caps_new_simple ("application/ogg", NULL);
break;
case GST_MAKE_FOURCC ('d', 'v', 'c', 'a'):
_codec ("DV audio");
caps = gst_caps_new_simple ("audio/x-dv", NULL);
break;
case GST_MAKE_FOURCC ('m', 'p', '4', 'a'):
_codec ("MPEG-4 AAC audio");
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 4, "framed", G_TYPE_BOOLEAN, TRUE, NULL);
break;
case GST_MAKE_FOURCC ('Q', 'D', 'M', 'C'):
_codec ("QDesign Music");
caps = gst_caps_new_simple ("audio/x-qdm", NULL);
break;
case GST_MAKE_FOURCC ('Q', 'D', 'M', '2'):
_codec ("QDesign Music v.2");
/* FIXME: QDesign music version 2 (no constant) */
if (data) {
caps = gst_caps_new_simple ("audio/x-qdm2",
"framesize", G_TYPE_INT, QT_UINT32 (data + 52),
"bitrate", G_TYPE_INT, QT_UINT32 (data + 40),
"blocksize", G_TYPE_INT, QT_UINT32 (data + 44), NULL);
} else {
caps = gst_caps_new_simple ("audio/x-qdm2", NULL);
}
break;
case GST_MAKE_FOURCC ('a', 'g', 's', 'm'):
_codec ("GSM audio");
caps = gst_caps_new_simple ("audio/x-gsm", NULL);
break;
case GST_MAKE_FOURCC ('s', 'a', 'm', 'r'):
_codec ("AMR audio");
caps = gst_caps_new_simple ("audio/AMR", NULL);
break;
case GST_MAKE_FOURCC ('s', 'a', 'w', 'b'):
_codec ("AMR-WB audio");
caps = gst_caps_new_simple ("audio/AMR-WB", NULL);
break;
case GST_MAKE_FOURCC ('i', 'm', 'a', '4'):
_codec ("Quicktime IMA ADPCM");
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "quicktime", NULL);
break;
case GST_MAKE_FOURCC ('a', 'l', 'a', 'c'):
_codec ("Apple lossless audio");
caps = gst_caps_new_simple ("audio/x-alac", NULL);
break;
case GST_MAKE_FOURCC ('q', 't', 'v', 'r'):
/* ? */
case GST_MAKE_FOURCC ('Q', 'c', 'l', 'p'):
/* QUALCOMM PureVoice */
default:
{
char *s;
s = g_strdup_printf ("audio/x-gst-fourcc-%" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (fourcc));
caps = gst_caps_new_simple (s, NULL);
break;
}
}
/* enable clipping for raw audio streams */
s = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (s);
if (g_str_has_prefix (name, "audio/x-raw-")) {
stream->need_clip = TRUE;
}
return caps;
}
| 0
|
51,937
|
Status operator()(const GPUDevice& d,
typename TTypes<qint8, 4, int>::ConstTensor in,
int input_pad_top, int input_pad_bottom, int input_pad_left,
int input_pad_right,
typename TTypes<qint8, 4, int>::Tensor out,
TensorFormat format) {
return errors::InvalidArgument(
"Explicit padding not yet supported with qint8");
}
| 0
|
161,400
|
kernel_map_pages(struct page *page, int numpages, int enable)
{
if (!debug_pagealloc_enabled())
return;
__kernel_map_pages(page, numpages, enable);
}
| 0
|
227,955
|
void CreateLinearAccelerationFusionSensor() {
auto fusion_algorithm =
std::make_unique<LinearAccelerationFusionAlgorithmUsingAccelerometer>();
CreateFusionSensor(std::move(fusion_algorithm));
}
| 0
|
208,036
|
int WebContentsImpl::GetCrashedErrorCode() const {
return crashed_error_code_;
}
| 0
|
239,495
|
virtual status_t getSecureStops(List<Vector<uint8_t> > &secureStops) {
Parcel data, reply;
data.writeInterfaceToken(IDrm::getInterfaceDescriptor());
status_t status = remote()->transact(GET_SECURE_STOPS, data, &reply);
if (status != OK) {
return status;
}
secureStops.clear();
uint32_t count = reply.readInt32();
for (size_t i = 0; i < count; i++) {
Vector<uint8_t> secureStop;
readVector(reply, secureStop);
secureStops.push_back(secureStop);
}
return reply.readInt32();
}
| 0
|
1,200
|
int parse_CCategSpec ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) {
proto_item * item ;
proto_tree * tree ;
va_list ap ;
guint32 type ;
const char * txt ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CCategSpec , & item , txt ) ;
type = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_ccategspec_type , tvb , offset , 4 , type ) ;
proto_item_append_text ( item , " Type %u" , type ) ;
offset += 4 ;
offset = parse_CSort ( tvb , offset , tree , pad_tree , "CSort" ) ;
offset = parse_CRangeCategSpec ( tvb , offset , tree , pad_tree , "CRangeCategSpec" ) ;
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
}
| 1
|
49,438
|
static int snd_timer_user_params(struct file *file,
struct snd_timer_params __user *_params)
{
struct snd_timer_user *tu;
struct snd_timer_params params;
struct snd_timer *t;
int err;
tu = file->private_data;
if (!tu->timeri)
return -EBADFD;
t = tu->timeri->timer;
if (!t)
return -EBADFD;
if (copy_from_user(¶ms, _params, sizeof(params)))
return -EFAULT;
if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE)) {
u64 resolution;
if (params.ticks < 1) {
err = -EINVAL;
goto _end;
}
/* Don't allow resolution less than 1ms */
resolution = snd_timer_resolution(tu->timeri);
resolution *= params.ticks;
if (resolution < 1000000) {
err = -EINVAL;
goto _end;
}
}
if (params.queue_size > 0 &&
(params.queue_size < 32 || params.queue_size > 1024)) {
err = -EINVAL;
goto _end;
}
if (params.filter & ~((1<<SNDRV_TIMER_EVENT_RESOLUTION)|
(1<<SNDRV_TIMER_EVENT_TICK)|
(1<<SNDRV_TIMER_EVENT_START)|
(1<<SNDRV_TIMER_EVENT_STOP)|
(1<<SNDRV_TIMER_EVENT_CONTINUE)|
(1<<SNDRV_TIMER_EVENT_PAUSE)|
(1<<SNDRV_TIMER_EVENT_SUSPEND)|
(1<<SNDRV_TIMER_EVENT_RESUME)|
(1<<SNDRV_TIMER_EVENT_MSTART)|
(1<<SNDRV_TIMER_EVENT_MSTOP)|
(1<<SNDRV_TIMER_EVENT_MCONTINUE)|
(1<<SNDRV_TIMER_EVENT_MPAUSE)|
(1<<SNDRV_TIMER_EVENT_MSUSPEND)|
(1<<SNDRV_TIMER_EVENT_MRESUME))) {
err = -EINVAL;
goto _end;
}
snd_timer_stop(tu->timeri);
spin_lock_irq(&t->lock);
tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO|
SNDRV_TIMER_IFLG_EXCLUSIVE|
SNDRV_TIMER_IFLG_EARLY_EVENT);
if (params.flags & SNDRV_TIMER_PSFLG_AUTO)
tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO;
if (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE)
tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE;
if (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT)
tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT;
spin_unlock_irq(&t->lock);
if (params.queue_size > 0 &&
(unsigned int)tu->queue_size != params.queue_size) {
err = realloc_user_queue(tu, params.queue_size);
if (err < 0)
goto _end;
}
spin_lock_irq(&tu->qlock);
tu->qhead = tu->qtail = tu->qused = 0;
if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {
if (tu->tread) {
struct snd_timer_tread tread;
memset(&tread, 0, sizeof(tread));
tread.event = SNDRV_TIMER_EVENT_EARLY;
tread.tstamp.tv_sec = 0;
tread.tstamp.tv_nsec = 0;
tread.val = 0;
snd_timer_user_append_to_tqueue(tu, &tread);
} else {
struct snd_timer_read *r = &tu->queue[0];
r->resolution = 0;
r->ticks = 0;
tu->qused++;
tu->qtail++;
}
}
tu->filter = params.filter;
tu->ticks = params.ticks;
spin_unlock_irq(&tu->qlock);
err = 0;
_end:
if (copy_to_user(_params, ¶ms, sizeof(params)))
return -EFAULT;
return err;
}
| 0
|
304,421
|
Status TrySimplify(NodeDef* node, string* simplified_node_name) override {
Tensor pow;
if (!GetTensorFromConstNode(node->input(1), &pow)) return Status::OK();
complex128 prev, curr;
for (int i = 0; i < pow.NumElements(); ++i) {
if (!GetElementUnexhaustive(pow, i, {pow.dtype()}, &curr)) {
// input data type is not supported by Pow. Skip.
return Status::OK();
}
if (i != 0 && curr != prev) {
// pow has different values on different elements. Skip.
return Status::OK();
}
prev = curr;
}
NodeDef *x, *y;
TF_RETURN_IF_ERROR(GetInputNode(node->input(0), &x));
TF_RETURN_IF_ERROR(GetInputNode(node->input(1), &y));
const auto& value_props =
ctx().graph_properties->GetInputProperties(node->name())[0];
const TensorShapeProto& output_shape =
ctx().graph_properties->GetOutputProperties(node->name())[0].shape();
if (curr == complex128(2, 0)) {
node->set_op("Square");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
} else if (curr == complex128(3, 0)) {
// TODO(courbet): Use 'Cube' when it's added to TF ops.
if (NodeIsOnCpu(*node)) {
// We create an inner square node: inner_square = square(x)
const NodeScopeAndName scope_and_name =
ParseNodeScopeAndName(node->name());
const string inner_square_name =
OptimizedNodeName(scope_and_name, "_inner");
NodeDef* inner_square_node = ctx().node_map->GetNode(inner_square_name);
if (inner_square_node == nullptr) {
inner_square_node = AddCopyNode(inner_square_name, node);
inner_square_node->set_op("Square");
inner_square_node->mutable_input()->RemoveLast();
}
ctx().node_map->AddOutput(x->name(), inner_square_node->name());
// We modify `node`: node = mul(x, inner_square);
node->set_op("Mul");
node->set_input(1, inner_square_node->name());
node->add_input(AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(inner_square_node);
AddToOptimizationQueue(y);
}
} else if (curr == complex128(1, 0) &&
ShapesSymbolicallyEqual(value_props.shape(), output_shape)) {
// Pow could be used to broadcast, so make sure the shapes of the two
// arguments are identical before replacing Pow with Identity.
node->set_op("Identity");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
} else if (curr == complex128(0.5, 0)) {
node->set_op("Sqrt");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
} else if (curr == complex128(0, 0) &&
ShapesSymbolicallyEqual(value_props.shape(), output_shape) &&
PartialTensorShape(output_shape).IsFullyDefined()) {
const auto dtype = node->attr().at("T").type();
Tensor ones(dtype, output_shape);
for (int i = 0; i < ones.NumElements(); ++i) {
TF_RETURN_IF_ERROR(SetElementToOne(i, &ones));
}
node->set_op("Const");
(*node->mutable_attr())["dtype"].set_type(dtype);
node->mutable_attr()->erase("T");
ones.AsProtoTensorContent(
(*node->mutable_attr())["value"].mutable_tensor());
node->set_input(0, AsControlDependency(x->name()));
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(x);
AddToOptimizationQueue(y);
} else if (curr == complex128(-0.5, 0)) {
node->set_op("Rsqrt");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
} else if (curr == complex128(-1, 0)) {
node->set_op("Reciprocal");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
}
return Status::OK();
}
| 0
|
211,671
|
static int parseOptions(int argc, char **argv) {
int i;
for (i = 1; i < argc; i++) {
int lastarg = i==argc-1;
if (!strcmp(argv[i],"-h") && !lastarg) {
sdsfree(config.hostip);
config.hostip = sdsnew(argv[++i]);
} else if (!strcmp(argv[i],"-h") && lastarg) {
usage();
} else if (!strcmp(argv[i],"--help")) {
usage();
} else if (!strcmp(argv[i],"-x")) {
config.stdinarg = 1;
} else if (!strcmp(argv[i],"-p") && !lastarg) {
config.hostport = atoi(argv[++i]);
} else if (!strcmp(argv[i],"-s") && !lastarg) {
config.hostsocket = argv[++i];
} else if (!strcmp(argv[i],"-r") && !lastarg) {
config.repeat = strtoll(argv[++i],NULL,10);
} else if (!strcmp(argv[i],"-i") && !lastarg) {
double seconds = atof(argv[++i]);
config.interval = seconds*1000000;
} else if (!strcmp(argv[i],"-n") && !lastarg) {
config.dbnum = atoi(argv[++i]);
} else if (!strcmp(argv[i],"-a") && !lastarg) {
fputs("Warning: Using a password with '-a' option on the command line interface may not be safe.\n", stderr);
config.auth = argv[++i];
} else if (!strcmp(argv[i],"-u") && !lastarg) {
parseRedisUri(argv[++i]);
} else if (!strcmp(argv[i],"--raw")) {
config.output = OUTPUT_RAW;
} else if (!strcmp(argv[i],"--no-raw")) {
config.output = OUTPUT_STANDARD;
} else if (!strcmp(argv[i],"--csv")) {
config.output = OUTPUT_CSV;
} else if (!strcmp(argv[i],"--latency")) {
config.latency_mode = 1;
} else if (!strcmp(argv[i],"--latency-dist")) {
config.latency_dist_mode = 1;
} else if (!strcmp(argv[i],"--mono")) {
spectrum_palette = spectrum_palette_mono;
spectrum_palette_size = spectrum_palette_mono_size;
} else if (!strcmp(argv[i],"--latency-history")) {
config.latency_mode = 1;
config.latency_history = 1;
} else if (!strcmp(argv[i],"--lru-test") && !lastarg) {
config.lru_test_mode = 1;
config.lru_test_sample_size = strtoll(argv[++i],NULL,10);
} else if (!strcmp(argv[i],"--slave")) {
config.slave_mode = 1;
} else if (!strcmp(argv[i],"--stat")) {
config.stat_mode = 1;
} else if (!strcmp(argv[i],"--scan")) {
config.scan_mode = 1;
} else if (!strcmp(argv[i],"--pattern") && !lastarg) {
config.pattern = argv[++i];
} else if (!strcmp(argv[i],"--intrinsic-latency") && !lastarg) {
config.intrinsic_latency_mode = 1;
config.intrinsic_latency_duration = atoi(argv[++i]);
} else if (!strcmp(argv[i],"--rdb") && !lastarg) {
config.getrdb_mode = 1;
config.rdb_filename = argv[++i];
} else if (!strcmp(argv[i],"--pipe")) {
config.pipe_mode = 1;
} else if (!strcmp(argv[i],"--pipe-timeout") && !lastarg) {
config.pipe_timeout = atoi(argv[++i]);
} else if (!strcmp(argv[i],"--bigkeys")) {
config.bigkeys = 1;
} else if (!strcmp(argv[i],"--hotkeys")) {
config.hotkeys = 1;
} else if (!strcmp(argv[i],"--eval") && !lastarg) {
config.eval = argv[++i];
} else if (!strcmp(argv[i],"--ldb")) {
config.eval_ldb = 1;
config.output = OUTPUT_RAW;
} else if (!strcmp(argv[i],"--ldb-sync-mode")) {
config.eval_ldb = 1;
config.eval_ldb_sync = 1;
config.output = OUTPUT_RAW;
} else if (!strcmp(argv[i],"-c")) {
config.cluster_mode = 1;
} else if (!strcmp(argv[i],"-d") && !lastarg) {
sdsfree(config.mb_delim);
config.mb_delim = sdsnew(argv[++i]);
} else if (!strcmp(argv[i],"-v") || !strcmp(argv[i], "--version")) {
sds version = cliVersion();
printf("redis-cli %s\n", version);
sdsfree(version);
exit(0);
} else {
if (argv[i][0] == '-') {
fprintf(stderr,
"Unrecognized option or bad number of args for: '%s'\n",
argv[i]);
exit(1);
} else {
/* Likely the command name, stop here. */
break;
}
}
}
/* --ldb requires --eval. */
if (config.eval_ldb && config.eval == NULL) {
fprintf(stderr,"Options --ldb and --ldb-sync-mode require --eval.\n");
fprintf(stderr,"Try %s --help for more information.\n", argv[0]);
exit(1);
}
return i;
}
| 0
|
371,509
|
void AuthorizationManager::logoutDatabase(const std::string& dbname) {
Principal* principal = _authenticatedPrincipals.lookupByDBName(dbname);
if (!principal)
return;
_acquiredPrivileges.revokePrivilegesFromPrincipal(principal->getName());
_authenticatedPrincipals.removeByDBName(dbname);
}
| 0
|
79,770
|
static int init_types(void)
{
static int initialized;
if (initialized) return 1;
if (add_ast_fields() < 0) return 0;
mod_type = make_type("mod", &AST_type, NULL, 0);
if (!mod_type) return 0;
if (!add_attributes(mod_type, NULL, 0)) return 0;
Module_type = make_type("Module", mod_type, Module_fields, 2);
if (!Module_type) return 0;
Interactive_type = make_type("Interactive", mod_type, Interactive_fields,
1);
if (!Interactive_type) return 0;
Expression_type = make_type("Expression", mod_type, Expression_fields, 1);
if (!Expression_type) return 0;
FunctionType_type = make_type("FunctionType", mod_type,
FunctionType_fields, 2);
if (!FunctionType_type) return 0;
Suite_type = make_type("Suite", mod_type, Suite_fields, 1);
if (!Suite_type) return 0;
stmt_type = make_type("stmt", &AST_type, NULL, 0);
if (!stmt_type) return 0;
if (!add_attributes(stmt_type, stmt_attributes, 4)) return 0;
FunctionDef_type = make_type("FunctionDef", stmt_type, FunctionDef_fields,
6);
if (!FunctionDef_type) return 0;
AsyncFunctionDef_type = make_type("AsyncFunctionDef", stmt_type,
AsyncFunctionDef_fields, 6);
if (!AsyncFunctionDef_type) return 0;
ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 5);
if (!ClassDef_type) return 0;
Return_type = make_type("Return", stmt_type, Return_fields, 1);
if (!Return_type) return 0;
Delete_type = make_type("Delete", stmt_type, Delete_fields, 1);
if (!Delete_type) return 0;
Assign_type = make_type("Assign", stmt_type, Assign_fields, 3);
if (!Assign_type) return 0;
AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3);
if (!AugAssign_type) return 0;
AnnAssign_type = make_type("AnnAssign", stmt_type, AnnAssign_fields, 4);
if (!AnnAssign_type) return 0;
For_type = make_type("For", stmt_type, For_fields, 5);
if (!For_type) return 0;
AsyncFor_type = make_type("AsyncFor", stmt_type, AsyncFor_fields, 5);
if (!AsyncFor_type) return 0;
While_type = make_type("While", stmt_type, While_fields, 3);
if (!While_type) return 0;
If_type = make_type("If", stmt_type, If_fields, 3);
if (!If_type) return 0;
With_type = make_type("With", stmt_type, With_fields, 3);
if (!With_type) return 0;
AsyncWith_type = make_type("AsyncWith", stmt_type, AsyncWith_fields, 3);
if (!AsyncWith_type) return 0;
Raise_type = make_type("Raise", stmt_type, Raise_fields, 2);
if (!Raise_type) return 0;
Try_type = make_type("Try", stmt_type, Try_fields, 4);
if (!Try_type) return 0;
Assert_type = make_type("Assert", stmt_type, Assert_fields, 2);
if (!Assert_type) return 0;
Import_type = make_type("Import", stmt_type, Import_fields, 1);
if (!Import_type) return 0;
ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields, 3);
if (!ImportFrom_type) return 0;
Global_type = make_type("Global", stmt_type, Global_fields, 1);
if (!Global_type) return 0;
Nonlocal_type = make_type("Nonlocal", stmt_type, Nonlocal_fields, 1);
if (!Nonlocal_type) return 0;
Expr_type = make_type("Expr", stmt_type, Expr_fields, 1);
if (!Expr_type) return 0;
Pass_type = make_type("Pass", stmt_type, NULL, 0);
if (!Pass_type) return 0;
Break_type = make_type("Break", stmt_type, NULL, 0);
if (!Break_type) return 0;
Continue_type = make_type("Continue", stmt_type, NULL, 0);
if (!Continue_type) return 0;
expr_type = make_type("expr", &AST_type, NULL, 0);
if (!expr_type) return 0;
if (!add_attributes(expr_type, expr_attributes, 4)) return 0;
BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2);
if (!BoolOp_type) return 0;
NamedExpr_type = make_type("NamedExpr", expr_type, NamedExpr_fields, 2);
if (!NamedExpr_type) return 0;
BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3);
if (!BinOp_type) return 0;
UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2);
if (!UnaryOp_type) return 0;
Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2);
if (!Lambda_type) return 0;
IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3);
if (!IfExp_type) return 0;
Dict_type = make_type("Dict", expr_type, Dict_fields, 2);
if (!Dict_type) return 0;
Set_type = make_type("Set", expr_type, Set_fields, 1);
if (!Set_type) return 0;
ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2);
if (!ListComp_type) return 0;
SetComp_type = make_type("SetComp", expr_type, SetComp_fields, 2);
if (!SetComp_type) return 0;
DictComp_type = make_type("DictComp", expr_type, DictComp_fields, 3);
if (!DictComp_type) return 0;
GeneratorExp_type = make_type("GeneratorExp", expr_type,
GeneratorExp_fields, 2);
if (!GeneratorExp_type) return 0;
Await_type = make_type("Await", expr_type, Await_fields, 1);
if (!Await_type) return 0;
Yield_type = make_type("Yield", expr_type, Yield_fields, 1);
if (!Yield_type) return 0;
YieldFrom_type = make_type("YieldFrom", expr_type, YieldFrom_fields, 1);
if (!YieldFrom_type) return 0;
Compare_type = make_type("Compare", expr_type, Compare_fields, 3);
if (!Compare_type) return 0;
Call_type = make_type("Call", expr_type, Call_fields, 3);
if (!Call_type) return 0;
FormattedValue_type = make_type("FormattedValue", expr_type,
FormattedValue_fields, 3);
if (!FormattedValue_type) return 0;
JoinedStr_type = make_type("JoinedStr", expr_type, JoinedStr_fields, 1);
if (!JoinedStr_type) return 0;
Constant_type = make_type("Constant", expr_type, Constant_fields, 1);
if (!Constant_type) return 0;
Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3);
if (!Attribute_type) return 0;
Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3);
if (!Subscript_type) return 0;
Starred_type = make_type("Starred", expr_type, Starred_fields, 2);
if (!Starred_type) return 0;
Name_type = make_type("Name", expr_type, Name_fields, 2);
if (!Name_type) return 0;
List_type = make_type("List", expr_type, List_fields, 2);
if (!List_type) return 0;
Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2);
if (!Tuple_type) return 0;
expr_context_type = make_type("expr_context", &AST_type, NULL, 0);
if (!expr_context_type) return 0;
if (!add_attributes(expr_context_type, NULL, 0)) return 0;
Load_type = make_type("Load", expr_context_type, NULL, 0);
if (!Load_type) return 0;
Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);
if (!Load_singleton) return 0;
Store_type = make_type("Store", expr_context_type, NULL, 0);
if (!Store_type) return 0;
Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);
if (!Store_singleton) return 0;
Del_type = make_type("Del", expr_context_type, NULL, 0);
if (!Del_type) return 0;
Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);
if (!Del_singleton) return 0;
AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0);
if (!AugLoad_type) return 0;
AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);
if (!AugLoad_singleton) return 0;
AugStore_type = make_type("AugStore", expr_context_type, NULL, 0);
if (!AugStore_type) return 0;
AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);
if (!AugStore_singleton) return 0;
Param_type = make_type("Param", expr_context_type, NULL, 0);
if (!Param_type) return 0;
Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);
if (!Param_singleton) return 0;
NamedStore_type = make_type("NamedStore", expr_context_type, NULL, 0);
if (!NamedStore_type) return 0;
NamedStore_singleton = PyType_GenericNew(NamedStore_type, NULL, NULL);
if (!NamedStore_singleton) return 0;
slice_type = make_type("slice", &AST_type, NULL, 0);
if (!slice_type) return 0;
if (!add_attributes(slice_type, NULL, 0)) return 0;
Slice_type = make_type("Slice", slice_type, Slice_fields, 3);
if (!Slice_type) return 0;
ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1);
if (!ExtSlice_type) return 0;
Index_type = make_type("Index", slice_type, Index_fields, 1);
if (!Index_type) return 0;
boolop_type = make_type("boolop", &AST_type, NULL, 0);
if (!boolop_type) return 0;
if (!add_attributes(boolop_type, NULL, 0)) return 0;
And_type = make_type("And", boolop_type, NULL, 0);
if (!And_type) return 0;
And_singleton = PyType_GenericNew(And_type, NULL, NULL);
if (!And_singleton) return 0;
Or_type = make_type("Or", boolop_type, NULL, 0);
if (!Or_type) return 0;
Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);
if (!Or_singleton) return 0;
operator_type = make_type("operator", &AST_type, NULL, 0);
if (!operator_type) return 0;
if (!add_attributes(operator_type, NULL, 0)) return 0;
Add_type = make_type("Add", operator_type, NULL, 0);
if (!Add_type) return 0;
Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);
if (!Add_singleton) return 0;
Sub_type = make_type("Sub", operator_type, NULL, 0);
if (!Sub_type) return 0;
Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);
if (!Sub_singleton) return 0;
Mult_type = make_type("Mult", operator_type, NULL, 0);
if (!Mult_type) return 0;
Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);
if (!Mult_singleton) return 0;
MatMult_type = make_type("MatMult", operator_type, NULL, 0);
if (!MatMult_type) return 0;
MatMult_singleton = PyType_GenericNew(MatMult_type, NULL, NULL);
if (!MatMult_singleton) return 0;
Div_type = make_type("Div", operator_type, NULL, 0);
if (!Div_type) return 0;
Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);
if (!Div_singleton) return 0;
Mod_type = make_type("Mod", operator_type, NULL, 0);
if (!Mod_type) return 0;
Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);
if (!Mod_singleton) return 0;
Pow_type = make_type("Pow", operator_type, NULL, 0);
if (!Pow_type) return 0;
Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);
if (!Pow_singleton) return 0;
LShift_type = make_type("LShift", operator_type, NULL, 0);
if (!LShift_type) return 0;
LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);
if (!LShift_singleton) return 0;
RShift_type = make_type("RShift", operator_type, NULL, 0);
if (!RShift_type) return 0;
RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);
if (!RShift_singleton) return 0;
BitOr_type = make_type("BitOr", operator_type, NULL, 0);
if (!BitOr_type) return 0;
BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);
if (!BitOr_singleton) return 0;
BitXor_type = make_type("BitXor", operator_type, NULL, 0);
if (!BitXor_type) return 0;
BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);
if (!BitXor_singleton) return 0;
BitAnd_type = make_type("BitAnd", operator_type, NULL, 0);
if (!BitAnd_type) return 0;
BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);
if (!BitAnd_singleton) return 0;
FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0);
if (!FloorDiv_type) return 0;
FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);
if (!FloorDiv_singleton) return 0;
unaryop_type = make_type("unaryop", &AST_type, NULL, 0);
if (!unaryop_type) return 0;
if (!add_attributes(unaryop_type, NULL, 0)) return 0;
Invert_type = make_type("Invert", unaryop_type, NULL, 0);
if (!Invert_type) return 0;
Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);
if (!Invert_singleton) return 0;
Not_type = make_type("Not", unaryop_type, NULL, 0);
if (!Not_type) return 0;
Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);
if (!Not_singleton) return 0;
UAdd_type = make_type("UAdd", unaryop_type, NULL, 0);
if (!UAdd_type) return 0;
UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);
if (!UAdd_singleton) return 0;
USub_type = make_type("USub", unaryop_type, NULL, 0);
if (!USub_type) return 0;
USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);
if (!USub_singleton) return 0;
cmpop_type = make_type("cmpop", &AST_type, NULL, 0);
if (!cmpop_type) return 0;
if (!add_attributes(cmpop_type, NULL, 0)) return 0;
Eq_type = make_type("Eq", cmpop_type, NULL, 0);
if (!Eq_type) return 0;
Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);
if (!Eq_singleton) return 0;
NotEq_type = make_type("NotEq", cmpop_type, NULL, 0);
if (!NotEq_type) return 0;
NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);
if (!NotEq_singleton) return 0;
Lt_type = make_type("Lt", cmpop_type, NULL, 0);
if (!Lt_type) return 0;
Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);
if (!Lt_singleton) return 0;
LtE_type = make_type("LtE", cmpop_type, NULL, 0);
if (!LtE_type) return 0;
LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);
if (!LtE_singleton) return 0;
Gt_type = make_type("Gt", cmpop_type, NULL, 0);
if (!Gt_type) return 0;
Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);
if (!Gt_singleton) return 0;
GtE_type = make_type("GtE", cmpop_type, NULL, 0);
if (!GtE_type) return 0;
GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);
if (!GtE_singleton) return 0;
Is_type = make_type("Is", cmpop_type, NULL, 0);
if (!Is_type) return 0;
Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);
if (!Is_singleton) return 0;
IsNot_type = make_type("IsNot", cmpop_type, NULL, 0);
if (!IsNot_type) return 0;
IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);
if (!IsNot_singleton) return 0;
In_type = make_type("In", cmpop_type, NULL, 0);
if (!In_type) return 0;
In_singleton = PyType_GenericNew(In_type, NULL, NULL);
if (!In_singleton) return 0;
NotIn_type = make_type("NotIn", cmpop_type, NULL, 0);
if (!NotIn_type) return 0;
NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);
if (!NotIn_singleton) return 0;
comprehension_type = make_type("comprehension", &AST_type,
comprehension_fields, 4);
if (!comprehension_type) return 0;
if (!add_attributes(comprehension_type, NULL, 0)) return 0;
excepthandler_type = make_type("excepthandler", &AST_type, NULL, 0);
if (!excepthandler_type) return 0;
if (!add_attributes(excepthandler_type, excepthandler_attributes, 4))
return 0;
ExceptHandler_type = make_type("ExceptHandler", excepthandler_type,
ExceptHandler_fields, 3);
if (!ExceptHandler_type) return 0;
arguments_type = make_type("arguments", &AST_type, arguments_fields, 6);
if (!arguments_type) return 0;
if (!add_attributes(arguments_type, NULL, 0)) return 0;
arg_type = make_type("arg", &AST_type, arg_fields, 3);
if (!arg_type) return 0;
if (!add_attributes(arg_type, arg_attributes, 4)) return 0;
keyword_type = make_type("keyword", &AST_type, keyword_fields, 2);
if (!keyword_type) return 0;
if (!add_attributes(keyword_type, NULL, 0)) return 0;
alias_type = make_type("alias", &AST_type, alias_fields, 2);
if (!alias_type) return 0;
if (!add_attributes(alias_type, NULL, 0)) return 0;
withitem_type = make_type("withitem", &AST_type, withitem_fields, 2);
if (!withitem_type) return 0;
if (!add_attributes(withitem_type, NULL, 0)) return 0;
type_ignore_type = make_type("type_ignore", &AST_type, NULL, 0);
if (!type_ignore_type) return 0;
if (!add_attributes(type_ignore_type, NULL, 0)) return 0;
TypeIgnore_type = make_type("TypeIgnore", type_ignore_type,
TypeIgnore_fields, 1);
if (!TypeIgnore_type) return 0;
initialized = 1;
return 1;
}
| 0
|
111,142
|
unsigned long get_max_files(void)
{
return files_stat.max_files;
}
| 0
|
146,121
|
void initialize() override {
setMaxRequestHeadersKb(60);
setMaxRequestHeadersCount(100);
envoy::config::route::v3::RetryPolicy retry_policy;
auto pass_through = config_helper_.createVirtualHost("pass.through.internal.redirect");
config_helper_.addVirtualHost(pass_through);
auto handle = config_helper_.createVirtualHost("handle.internal.redirect");
handle.mutable_routes(0)->set_name("redirect");
handle.mutable_routes(0)->mutable_route()->mutable_internal_redirect_policy();
config_helper_.addVirtualHost(handle);
auto handle_max_3_hop =
config_helper_.createVirtualHost("handle.internal.redirect.max.three.hop");
handle_max_3_hop.mutable_routes(0)->set_name("max_three_hop");
handle_max_3_hop.mutable_routes(0)->mutable_route()->mutable_internal_redirect_policy();
handle_max_3_hop.mutable_routes(0)
->mutable_route()
->mutable_internal_redirect_policy()
->mutable_max_internal_redirects()
->set_value(3);
config_helper_.addVirtualHost(handle_max_3_hop);
auto handle_by_direct_response = config_helper_.createVirtualHost("handle.direct.response");
handle_by_direct_response.mutable_routes(0)->set_name("direct_response");
handle_by_direct_response.mutable_routes(0)->mutable_direct_response()->set_status(204);
handle_by_direct_response.mutable_routes(0)
->mutable_direct_response()
->mutable_body()
->set_inline_string(EMPTY_STRING);
config_helper_.addVirtualHost(handle_by_direct_response);
HttpProtocolIntegrationTest::initialize();
}
| 0
|
179,727
|
ofputil_put_ofp11_table_stats(const struct ofputil_table_stats *stats,
const struct ofputil_table_features *features,
struct ofpbuf *buf)
{
struct mf_bitmap wc = wild_or_nonmatchable_fields(features);
struct ofp11_table_stats *out;
out = ofpbuf_put_zeros(buf, sizeof *out);
out->table_id = features->table_id;
ovs_strlcpy(out->name, features->name, sizeof out->name);
out->wildcards = mf_bitmap_to_of11(&wc);
out->match = mf_bitmap_to_of11(&features->match);
out->instructions = ovsinst_bitmap_to_openflow(
features->nonmiss.instructions, OFP11_VERSION);
out->write_actions = ofpact_bitmap_to_openflow(
features->nonmiss.write.ofpacts, OFP11_VERSION);
out->apply_actions = ofpact_bitmap_to_openflow(
features->nonmiss.apply.ofpacts, OFP11_VERSION);
out->config = htonl(features->miss_config);
out->max_entries = htonl(features->max_entries);
out->active_count = htonl(stats->active_count);
out->lookup_count = htonll(stats->lookup_count);
out->matched_count = htonll(stats->matched_count);
}
| 0
|
445,938
|
BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width, UINT32 height)
{
if (!context)
return FALSE;
context->width = width;
context->height = height;
context->state = RFX_STATE_SEND_HEADERS;
context->expectedDataBlockType = WBT_FRAME_BEGIN;
context->frameIdx = 0;
return TRUE;
}
| 0
|
95,273
|
PJ_DEF(void) pjsip_tx_data_invalidate_msg( pjsip_tx_data *tdata )
{
tdata->buf.cur = tdata->buf.start;
tdata->info = NULL;
}
| 0
|
93,005
|
void CL_LocalServers_f( void ) {
char *message;
int i, j;
netadr_t to;
Com_Printf( "Scanning for servers on the local network...\n");
// reset the list, waiting for response
cls.numlocalservers = 0;
cls.pingUpdateSource = AS_LOCAL;
for (i = 0; i < MAX_OTHER_SERVERS; i++) {
qboolean b = cls.localServers[i].visible;
Com_Memset(&cls.localServers[i], 0, sizeof(cls.localServers[i]));
cls.localServers[i].visible = b;
}
Com_Memset( &to, 0, sizeof( to ) );
// The 'xxx' in the message is a challenge that will be echoed back
// by the server. We don't care about that here, but master servers
// can use that to prevent spoofed server responses from invalid ip
message = "\377\377\377\377getinfo xxx";
// send each message twice in case one is dropped
for ( i = 0 ; i < 2 ; i++ ) {
// send a broadcast packet on each server port
// we support multiple server ports so a single machine
// can nicely run multiple servers
for ( j = 0 ; j < NUM_SERVER_PORTS ; j++ ) {
to.port = BigShort( (short)(PORT_SERVER + j) );
to.type = NA_BROADCAST;
NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
to.type = NA_MULTICAST6;
NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
}
}
}
| 0
|
300,741
|
void RequestContext::FillCheckRequestInfo(
service_control::CheckRequestInfo *info) {
FillOperationInfo(info);
request_->FindHeader(kXAndroidPackage, &info->android_package_name);
request_->FindHeader(kXAndroidCert, &info->android_cert_fingerprint);
request_->FindHeader(kXIosBundleId, &info->ios_bundle_id);
}
| 0
|
27,417
|
static void cluster_all_databases ( bool verbose , const char * maintenance_db , const char * host , const char * port , const char * username , enum trivalue prompt_password , const char * progname , bool echo , bool quiet ) {
PGconn * conn ;
PGresult * result ;
PQExpBufferData connstr ;
int i ;
conn = connectMaintenanceDatabase ( maintenance_db , host , port , username , prompt_password , progname ) ;
result = executeQuery ( conn , "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;
" , progname , echo ) ;
PQfinish ( conn ) ;
initPQExpBuffer ( & connstr ) ;
for ( i = 0 ;
i < PQntuples ( result ) ;
i ++ ) {
char * dbname = PQgetvalue ( result , i , 0 ) ;
if ( ! quiet ) {
printf ( _ ( "%s: clustering database \"%s\"\n" ) , progname , dbname ) ;
fflush ( stdout ) ;
}
resetPQExpBuffer ( & connstr ) ;
appendPQExpBuffer ( & connstr , "dbname=" ) ;
appendConnStrVal ( & connstr , dbname ) ;
cluster_one_database ( connstr . data , verbose , NULL , host , port , username , prompt_password , progname , echo ) ;
}
termPQExpBuffer ( & connstr ) ;
PQclear ( result ) ;
}
| 0
|
433,023
|
v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
unsigned int flags)
{
umode_t mode;
struct v9fs_inode *v9inode = V9FS_I(inode);
if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) {
inode->i_atime.tv_sec = stat->st_atime_sec;
inode->i_atime.tv_nsec = stat->st_atime_nsec;
inode->i_mtime.tv_sec = stat->st_mtime_sec;
inode->i_mtime.tv_nsec = stat->st_mtime_nsec;
inode->i_ctime.tv_sec = stat->st_ctime_sec;
inode->i_ctime.tv_nsec = stat->st_ctime_nsec;
inode->i_uid = stat->st_uid;
inode->i_gid = stat->st_gid;
set_nlink(inode, stat->st_nlink);
mode = stat->st_mode & S_IALLUGO;
mode |= inode->i_mode & ~S_IALLUGO;
inode->i_mode = mode;
if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
v9fs_i_size_write(inode, stat->st_size);
inode->i_blocks = stat->st_blocks;
} else {
if (stat->st_result_mask & P9_STATS_ATIME) {
inode->i_atime.tv_sec = stat->st_atime_sec;
inode->i_atime.tv_nsec = stat->st_atime_nsec;
}
if (stat->st_result_mask & P9_STATS_MTIME) {
inode->i_mtime.tv_sec = stat->st_mtime_sec;
inode->i_mtime.tv_nsec = stat->st_mtime_nsec;
}
if (stat->st_result_mask & P9_STATS_CTIME) {
inode->i_ctime.tv_sec = stat->st_ctime_sec;
inode->i_ctime.tv_nsec = stat->st_ctime_nsec;
}
if (stat->st_result_mask & P9_STATS_UID)
inode->i_uid = stat->st_uid;
if (stat->st_result_mask & P9_STATS_GID)
inode->i_gid = stat->st_gid;
if (stat->st_result_mask & P9_STATS_NLINK)
set_nlink(inode, stat->st_nlink);
if (stat->st_result_mask & P9_STATS_MODE) {
inode->i_mode = stat->st_mode;
if ((S_ISBLK(inode->i_mode)) ||
(S_ISCHR(inode->i_mode)))
init_special_inode(inode, inode->i_mode,
inode->i_rdev);
}
if (stat->st_result_mask & P9_STATS_RDEV)
inode->i_rdev = new_decode_dev(stat->st_rdev);
if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) &&
stat->st_result_mask & P9_STATS_SIZE)
v9fs_i_size_write(inode, stat->st_size);
if (stat->st_result_mask & P9_STATS_BLOCKS)
inode->i_blocks = stat->st_blocks;
}
if (stat->st_result_mask & P9_STATS_GEN)
inode->i_generation = stat->st_gen;
/* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION
* because the inode structure does not have fields for them.
*/
v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
}
| 0
|
358,184
|
static int nfs4_init_client(struct nfs_client *clp,
int proto, int timeo, int retrans,
const char *ip_addr,
rpc_authflavor_t authflavour)
{
int error;
if (clp->cl_cons_state == NFS_CS_READY) {
/* the client is initialised already */
dprintk("<-- nfs4_init_client() = 0 [already %p]\n", clp);
return 0;
}
/* Check NFS protocol revision and initialize RPC op vector */
clp->rpc_ops = &nfs_v4_clientops;
error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
RPC_CLNT_CREATE_DISCRTRY);
if (error < 0)
goto error;
memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
error = nfs_idmap_new(clp);
if (error < 0) {
dprintk("%s: failed to create idmapper. Error = %d\n",
__FUNCTION__, error);
goto error;
}
__set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
nfs_mark_client_ready(clp, NFS_CS_READY);
return 0;
error:
nfs_mark_client_ready(clp, error);
dprintk("<-- nfs4_init_client() = xerror %d\n", error);
return error;
}
| 0
|
74,262
|
static void sig_exit_handler(int sig)
{
sig_exit_handler_sig = sig;
sig_exit_handler_called = 1;
}
| 0
|
513,839
|
cliprdr_server_file_contents_response(CliprdrServerContext* context,
const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
{
wStream* s;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*)context->handle;
if (fileContentsResponse->msgType != CB_FILECONTENTS_RESPONSE)
WLog_WARN(TAG, "[%s] called with invalid type %08" PRIx32, __FUNCTION__,
fileContentsResponse->msgType);
s = cliprdr_packet_file_contents_response_new(fileContentsResponse);
if (!s)
{
WLog_ERR(TAG, "cliprdr_packet_file_contents_response_new failed!");
return ERROR_INTERNAL_ERROR;
}
WLog_DBG(TAG, "ServerFileContentsResponse: streamId: 0x%08" PRIX32 "",
fileContentsResponse->streamId);
return cliprdr_server_packet_send(cliprdr, s);
}
| 0
|
505,434
|
void OpenSSLDie(const char *file,int line,const char *assertion)
{
OPENSSL_showfatal(
"%s(%d): OpenSSL internal error, assertion failed: %s\n",
file,line,assertion);
abort();
}
| 0
|
29,777
|
int qemuMonitorTextSetCPU ( qemuMonitorPtr mon , int cpu , int online ) {
char * cmd ;
char * reply = NULL ;
int ret = - 1 ;
if ( virAsprintf ( & cmd , "cpu_set %d %s" , cpu , online ? "online" : "offline" ) < 0 ) {
virReportOOMError ( ) ;
return - 1 ;
}
if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "could not change CPU online status" ) ) ;
VIR_FREE ( cmd ) ;
return - 1 ;
}
VIR_FREE ( cmd ) ;
if ( strstr ( reply , "unknown command:" ) ) {
ret = 0 ;
}
else {
ret = 1 ;
}
VIR_FREE ( reply ) ;
return ret ;
}
| 0
|
409,967
|
static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
{
skb_reset_mac_header(skb);
skb->mac_header += offset;
| 0
|
375,416
|
findchar(char *str, int c)
{
while (*str)
{
if (t_iseq(str, c))
return str;
str += pg_mblen(str);
}
return NULL;
}
| 0
|
134,924
|
get_option_value(
char_u *name,
long *numval,
char_u **stringval, // NULL when only checking existence
int opt_flags)
{
int opt_idx;
char_u *varp;
opt_idx = findoption(name);
if (opt_idx < 0) // option not in the table
{
int key;
if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
&& (key = find_key_option(name, FALSE)) != 0)
{
char_u key_name[2];
char_u *p;
// check for a terminal option
if (key < 0)
{
key_name[0] = KEY2TERMCAP0(key);
key_name[1] = KEY2TERMCAP1(key);
}
else
{
key_name[0] = KS_KEY;
key_name[1] = (key & 0xff);
}
p = find_termcode(key_name);
if (p != NULL)
{
if (stringval != NULL)
*stringval = vim_strsave(p);
return gov_string;
}
}
return gov_unknown;
}
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
if (options[opt_idx].flags & P_STRING)
{
if (varp == NULL) // hidden option
return gov_hidden_string;
if (stringval != NULL)
{
#ifdef FEAT_CRYPT
// never return the value of the crypt key
if ((char_u **)varp == &curbuf->b_p_key
&& **(char_u **)(varp) != NUL)
*stringval = vim_strsave((char_u *)"*****");
else
#endif
*stringval = vim_strsave(*(char_u **)(varp));
}
return gov_string;
}
if (varp == NULL) // hidden option
return (options[opt_idx].flags & P_NUM)
? gov_hidden_number : gov_hidden_bool;
if (options[opt_idx].flags & P_NUM)
*numval = *(long *)varp;
else
{
// Special case: 'modified' is b_changed, but we also want to consider
// it set when 'ff' or 'fenc' changed.
if ((int *)varp == &curbuf->b_changed)
*numval = curbufIsChanged();
else
*numval = (long) *(int *)varp;
}
return (options[opt_idx].flags & P_NUM) ? gov_number : gov_bool;
}
| 0
|
155,281
|
xfs_buf_ioerror(
xfs_buf_t *bp,
int error)
{
ASSERT(error >= 0 && error <= 0xffff);
bp->b_error = (unsigned short)error;
trace_xfs_buf_ioerror(bp, error, _RET_IP_);
}
| 0
|
90,866
|
static struct sock *ncp_connection_hack(struct ipx_interface *intrfc,
struct ipxhdr *ipx)
{
/* The packet's target is a NCP connection handler. We want to hand it
* to the correct socket directly within the kernel, so that the
* mars_nwe packet distribution process does not have to do it. Here we
* only care about NCP and BURST packets.
*
* You might call this a hack, but believe me, you do not want a
* complete NCP layer in the kernel, and this is VERY fast as well. */
struct sock *sk = NULL;
int connection = 0;
u8 *ncphdr = (u8 *)(ipx + 1);
if (*ncphdr == 0x22 && *(ncphdr + 1) == 0x22) /* NCP request */
connection = (((int) *(ncphdr + 5)) << 8) | (int) *(ncphdr + 3);
else if (*ncphdr == 0x77 && *(ncphdr + 1) == 0x77) /* BURST packet */
connection = (((int) *(ncphdr + 9)) << 8) | (int) *(ncphdr + 8);
if (connection) {
/* Now we have to look for a special NCP connection handling
* socket. Only these sockets have ipx_ncp_conn != 0, set by
* SIOCIPXNCPCONN. */
spin_lock_bh(&intrfc->if_sklist_lock);
sk_for_each(sk, &intrfc->if_sklist)
if (ipx_sk(sk)->ipx_ncp_conn == connection) {
sock_hold(sk);
goto found;
}
sk = NULL;
found:
spin_unlock_bh(&intrfc->if_sklist_lock);
}
return sk;
}
| 0
|
116,303
|
BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size)
{
_noLibzError();
}
| 0
|
77,542
|
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{
_noLibzError();
return NULL;
}
| 0
|
218,895
|
void ChromeNetworkDelegate::set_cookie_settings(
CookieSettings* cookie_settings) {
cookie_settings_ = cookie_settings;
}
| 0
|
164,911
|
aspath_add_asns (struct aspath *aspath, as_t asno, u_char type, unsigned num)
{
struct assegment *assegment = aspath->segments;
unsigned i;
if (assegment && assegment->type == type)
{
/* extend existing segment */
aspath->segments = assegment_prepend_asns (aspath->segments, asno, num);
}
else
{
/* prepend with new segment */
struct assegment *newsegment = assegment_new (type, num);
for (i = 0; i < num; i++)
newsegment->as[i] = asno;
/* insert potentially replacing empty segment */
if (assegment && assegment->length == 0)
{
newsegment->next = assegment->next;
assegment_free (assegment);
}
else
newsegment->next = assegment;
aspath->segments = newsegment;
}
aspath_str_update (aspath);
return aspath;
}
| 0
|
167,895
|
void BaseRenderingContext2D::ClearCanvas() {
FloatRect canvas_rect(0, 0, Width(), Height());
CheckOverdraw(canvas_rect, nullptr, CanvasRenderingContext2DState::kNoImage,
kClipFill);
PaintCanvas* c = DrawingCanvas();
if (c)
c->clear(HasAlpha() ? SK_ColorTRANSPARENT : SK_ColorBLACK);
}
| 0
|
313,184
|
handle_meter_request(struct ofconn *ofconn, const struct ofp_header *request,
enum ofptype type)
{
struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
struct ovs_list replies;
uint64_t bands_stub[256 / 8];
struct ofpbuf bands;
uint32_t meter_id, first, last;
ofputil_decode_meter_request(request, &meter_id);
if (meter_id == OFPM13_ALL) {
first = 1;
last = ofproto->meter_features.max_meters;
} else {
if (!meter_id || meter_id > ofproto->meter_features.max_meters ||
!ofproto->meters[meter_id]) {
return OFPERR_OFPMMFC_UNKNOWN_METER;
}
first = last = meter_id;
}
ofpbuf_use_stub(&bands, bands_stub, sizeof bands_stub);
ofpmp_init(&replies, request);
for (meter_id = first; meter_id <= last; ++meter_id) {
struct meter *meter = ofproto->meters[meter_id];
if (!meter) {
continue; /* Skip non-existing meters. */
}
if (type == OFPTYPE_METER_STATS_REQUEST) {
struct ofputil_meter_stats stats;
stats.meter_id = meter_id;
/* Provider sets the packet and byte counts, we do the rest. */
stats.flow_count = ovs_list_size(&meter->rules);
calc_duration(meter->created, time_msec(),
&stats.duration_sec, &stats.duration_nsec);
stats.n_bands = meter->n_bands;
ofpbuf_clear(&bands);
stats.bands
= ofpbuf_put_uninit(&bands,
meter->n_bands * sizeof *stats.bands);
if (!ofproto->ofproto_class->meter_get(ofproto,
meter->provider_meter_id,
&stats)) {
ofputil_append_meter_stats(&replies, &stats);
}
} else { /* type == OFPTYPE_METER_CONFIG_REQUEST */
struct ofputil_meter_config config;
config.meter_id = meter_id;
config.flags = meter->flags;
config.n_bands = meter->n_bands;
config.bands = meter->bands;
ofputil_append_meter_config(&replies, &config);
}
}
ofconn_send_replies(ofconn, &replies);
ofpbuf_uninit(&bands);
return 0;
}
| 0
|
518,187
|
bool Item_temporal_literal::eq(const Item *item, bool binary_cmp) const
{
return
item->basic_const_item() && type() == item->type() &&
field_type() == ((Item_temporal_literal *) item)->field_type() &&
!my_time_compare(&cached_time,
&((Item_temporal_literal *) item)->cached_time);
}
| 0
|
325,696
|
CPUPPCState *cpu_ppc_init(void)
{
CPUPPCState *env;
cpu_exec_init();
env = qemu_mallocz(sizeof(CPUPPCState));
if (!env)
return NULL;
#if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE)
setup_machine(env, 0);
#else
// env->spr[PVR] = 0; /* Basic PPC */
env->spr[PVR] = 0x00080100; /* G3 CPU */
// env->spr[PVR] = 0x00083100; /* MPC755 (G3 embedded) */
// env->spr[PVR] = 0x00070100; /* IBM 750FX */
#endif
tlb_flush(env, 1);
#if defined (DO_SINGLE_STEP)
/* Single step trace mode */
msr_se = 1;
#endif
msr_fp = 1; /* Allow floating point exceptions */
msr_me = 1; /* Allow machine check exceptions */
#if defined(CONFIG_USER_ONLY)
msr_pr = 1;
cpu_ppc_register(env, 0x00080000);
#else
env->nip = 0xFFFFFFFC;
#endif
env->access_type = ACCESS_INT;
cpu_single_env = env;
return env;
}
| 0
|
285,589
|
void InterstitialPage::DontProceed() {
DCHECK(action_taken_ != DONT_PROCEED_ACTION);
Disable();
action_taken_ = DONT_PROCEED_ACTION;
if (new_navigation_)
TakeActionOnResourceDispatcher(RESUME);
else
TakeActionOnResourceDispatcher(CANCEL);
if (should_discard_pending_nav_entry_) {
tab_->controller().DiscardNonCommittedEntries();
}
Hide();
}
| 0
|
429,505
|
dir_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
gpointer user_data)
{
GKeyfileSettingsBackend *kfsb = user_data;
g_keyfile_settings_backend_keyfile_writable (kfsb);
}
| 0
|
298,838
|
static void index_entry_adjust_namemask(
git_index_entry *entry,
size_t path_length)
{
entry->flags &= ~GIT_IDXENTRY_NAMEMASK;
if (path_length < GIT_IDXENTRY_NAMEMASK)
entry->flags |= path_length & GIT_IDXENTRY_NAMEMASK;
else
entry->flags |= GIT_IDXENTRY_NAMEMASK;
}
| 0
|
144,988
|
static int oom_reaper(void *unused)
{
while (true) {
struct task_struct *tsk = NULL;
wait_event_freezable(oom_reaper_wait, oom_reaper_list != NULL);
spin_lock(&oom_reaper_lock);
if (oom_reaper_list != NULL) {
tsk = oom_reaper_list;
oom_reaper_list = tsk->oom_reaper_list;
}
spin_unlock(&oom_reaper_lock);
if (tsk)
oom_reap_task(tsk);
}
return 0;
}
| 0
|
258,833
|
term_getjob(term_T *term)
{
return term != NULL ? term->tl_job : NULL;
}
| 0
|
250,318
|
static void on_connection_close(nw_ses *ses)
{
log_trace("connection %s close", nw_sock_human_addr(&ses->peer_addr));
struct clt_info *info = ses->privdata;
struct ws_svr *svr = ws_svr_from_ses(ses);
if (info->upgrade) {
if (svr->type.on_close) {
svr->type.on_close(ses, info->remote);
}
if (svr->type.on_privdata_free) {
svr->type.on_privdata_free(svr, info->privdata);
}
}
}
| 0
|
178,657
|
void WebContentsImpl::RequestToLockMouse(
RenderWidgetHostImpl* render_widget_host,
bool user_gesture,
bool last_unlocked_by_target,
bool privileged) {
for (WebContentsImpl* current = this; current;
current = current->GetOuterWebContents()) {
if (current->mouse_lock_widget_) {
render_widget_host->GotResponseToLockMouseRequest(false);
return;
}
}
if (privileged) {
DCHECK(!GetOuterWebContents());
mouse_lock_widget_ = render_widget_host;
render_widget_host->GotResponseToLockMouseRequest(true);
return;
}
bool widget_in_frame_tree = false;
for (FrameTreeNode* node : frame_tree_.Nodes()) {
if (node->current_frame_host()->GetRenderWidgetHost() ==
render_widget_host) {
widget_in_frame_tree = true;
break;
}
}
if (widget_in_frame_tree && delegate_) {
for (WebContentsImpl* current = this; current;
current = current->GetOuterWebContents()) {
current->mouse_lock_widget_ = render_widget_host;
}
delegate_->RequestToLockMouse(this, user_gesture, last_unlocked_by_target);
} else {
render_widget_host->GotResponseToLockMouseRequest(false);
}
}
| 0
|
219,933
|
void ClipboardMessageFilter::OnReadHTML(ui::ClipboardType type,
base::string16* markup,
GURL* url,
uint32* fragment_start,
uint32* fragment_end) {
std::string src_url_str;
GetClipboard()->ReadHTML(type, markup, &src_url_str, fragment_start,
fragment_end);
*url = GURL(src_url_str);
}
| 0
|
432,012
|
void tcp_send_ack(struct sock *sk)
{
struct sk_buff *buff;
/* If we have been reset, we may not send again. */
if (sk->sk_state == TCP_CLOSE)
return;
tcp_ca_event(sk, CA_EVENT_NON_DELAYED_ACK);
/* We are not putting this on the write queue, so
* tcp_transmit_skb() will set the ownership to this
* sock.
*/
buff = alloc_skb(MAX_TCP_HEADER,
sk_gfp_mask(sk, GFP_ATOMIC | __GFP_NOWARN));
if (unlikely(!buff)) {
inet_csk_schedule_ack(sk);
inet_csk(sk)->icsk_ack.ato = TCP_ATO_MIN;
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
TCP_DELACK_MAX, TCP_RTO_MAX);
return;
}
/* Reserve space for headers and prepare control bits. */
skb_reserve(buff, MAX_TCP_HEADER);
tcp_init_nondata_skb(buff, tcp_acceptable_seq(sk), TCPHDR_ACK);
/* We do not want pure acks influencing TCP Small Queues or fq/pacing
* too much.
* SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784
*/
skb_set_tcp_pure_ack(buff);
/* Send it off, this clears delayed acks for us. */
tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0);
}
| 0
|
155,649
|
static int irda_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
struct irda_device_list list;
struct irda_device_info *discoveries;
struct irda_ias_set * ias_opt; /* IAS get/query params */
struct ias_object * ias_obj; /* Object in IAS */
struct ias_attrib * ias_attr; /* Attribute in IAS object */
int daddr = DEV_ADDR_ANY; /* Dest address for IAS queries */
int val = 0;
int len = 0;
int err = 0;
int offset, total;
IRDA_DEBUG(2, "%s(%p)\n", __func__, self);
if (level != SOL_IRLMP)
return -ENOPROTOOPT;
if (get_user(len, optlen))
return -EFAULT;
if(len < 0)
return -EINVAL;
lock_sock(sk);
switch (optname) {
case IRLMP_ENUMDEVICES:
/* Offset to first device entry */
offset = sizeof(struct irda_device_list) -
sizeof(struct irda_device_info);
if (len < offset) {
err = -EINVAL;
goto out;
}
/* Ask lmp for the current discovery log */
discoveries = irlmp_get_discoveries(&list.len, self->mask.word,
self->nslots);
/* Check if the we got some results */
if (discoveries == NULL) {
err = -EAGAIN;
goto out; /* Didn't find any devices */
}
/* Write total list length back to client */
if (copy_to_user(optval, &list, offset))
err = -EFAULT;
/* Copy the list itself - watch for overflow */
if (list.len > 2048) {
err = -EINVAL;
goto bed;
}
total = offset + (list.len * sizeof(struct irda_device_info));
if (total > len)
total = len;
if (copy_to_user(optval+offset, discoveries, total - offset))
err = -EFAULT;
/* Write total number of bytes used back to client */
if (put_user(total, optlen))
err = -EFAULT;
bed:
/* Free up our buffer */
kfree(discoveries);
break;
case IRLMP_MAX_SDU_SIZE:
val = self->max_data_size;
len = sizeof(int);
if (put_user(len, optlen)) {
err = -EFAULT;
goto out;
}
if (copy_to_user(optval, &val, len)) {
err = -EFAULT;
goto out;
}
break;
case IRLMP_IAS_GET:
/* The user want an object from our local IAS database.
* We just need to query the IAS and return the value
* that we found */
/* Check that the user has allocated the right space for us */
if (len != sizeof(struct irda_ias_set)) {
err = -EINVAL;
goto out;
}
ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC);
if (ias_opt == NULL) {
err = -ENOMEM;
goto out;
}
/* Copy query to the driver. */
if (copy_from_user(ias_opt, optval, len)) {
kfree(ias_opt);
err = -EFAULT;
goto out;
}
/* Find the object we target.
* If the user gives us an empty string, we use the object
* associated with this socket. This will workaround
* duplicated class name - Jean II */
if(ias_opt->irda_class_name[0] == '\0')
ias_obj = self->ias_obj;
else
ias_obj = irias_find_object(ias_opt->irda_class_name);
if(ias_obj == (struct ias_object *) NULL) {
kfree(ias_opt);
err = -EINVAL;
goto out;
}
/* Find the attribute (in the object) we target */
ias_attr = irias_find_attrib(ias_obj,
ias_opt->irda_attrib_name);
if(ias_attr == (struct ias_attrib *) NULL) {
kfree(ias_opt);
err = -EINVAL;
goto out;
}
/* Translate from internal to user structure */
err = irda_extract_ias_value(ias_opt, ias_attr->value);
if(err) {
kfree(ias_opt);
goto out;
}
/* Copy reply to the user */
if (copy_to_user(optval, ias_opt,
sizeof(struct irda_ias_set))) {
kfree(ias_opt);
err = -EFAULT;
goto out;
}
/* Note : don't need to put optlen, we checked it */
kfree(ias_opt);
break;
case IRLMP_IAS_QUERY:
/* The user want an object from a remote IAS database.
* We need to use IAP to query the remote database and
* then wait for the answer to come back. */
/* Check that the user has allocated the right space for us */
if (len != sizeof(struct irda_ias_set)) {
err = -EINVAL;
goto out;
}
ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC);
if (ias_opt == NULL) {
err = -ENOMEM;
goto out;
}
/* Copy query to the driver. */
if (copy_from_user(ias_opt, optval, len)) {
kfree(ias_opt);
err = -EFAULT;
goto out;
}
/* At this point, there are two cases...
* 1) the socket is connected - that's the easy case, we
* just query the device we are connected to...
* 2) the socket is not connected - the user doesn't want
* to connect and/or may not have a valid service name
* (so can't create a fake connection). In this case,
* we assume that the user pass us a valid destination
* address in the requesting structure...
*/
if(self->daddr != DEV_ADDR_ANY) {
/* We are connected - reuse known daddr */
daddr = self->daddr;
} else {
/* We are not connected, we must specify a valid
* destination address */
daddr = ias_opt->daddr;
if((!daddr) || (daddr == DEV_ADDR_ANY)) {
kfree(ias_opt);
err = -EINVAL;
goto out;
}
}
/* Check that we can proceed with IAP */
if (self->iriap) {
IRDA_WARNING("%s: busy with a previous query\n",
__func__);
kfree(ias_opt);
err = -EBUSY;
goto out;
}
self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
irda_getvalue_confirm);
if (self->iriap == NULL) {
kfree(ias_opt);
err = -ENOMEM;
goto out;
}
/* Treat unexpected wakeup as disconnect */
self->errno = -EHOSTUNREACH;
/* Query remote LM-IAS */
iriap_getvaluebyclass_request(self->iriap,
self->saddr, daddr,
ias_opt->irda_class_name,
ias_opt->irda_attrib_name);
/* Wait for answer, if not yet finished (or failed) */
if (wait_event_interruptible(self->query_wait,
(self->iriap == NULL))) {
/* pending request uses copy of ias_opt-content
* we can free it regardless! */
kfree(ias_opt);
/* Treat signals as disconnect */
err = -EHOSTUNREACH;
goto out;
}
/* Check what happened */
if (self->errno)
{
kfree(ias_opt);
/* Requested object/attribute doesn't exist */
if((self->errno == IAS_CLASS_UNKNOWN) ||
(self->errno == IAS_ATTRIB_UNKNOWN))
err = -EADDRNOTAVAIL;
else
err = -EHOSTUNREACH;
goto out;
}
/* Translate from internal to user structure */
err = irda_extract_ias_value(ias_opt, self->ias_result);
if (self->ias_result)
irias_delete_value(self->ias_result);
if (err) {
kfree(ias_opt);
goto out;
}
/* Copy reply to the user */
if (copy_to_user(optval, ias_opt,
sizeof(struct irda_ias_set))) {
kfree(ias_opt);
err = -EFAULT;
goto out;
}
/* Note : don't need to put optlen, we checked it */
kfree(ias_opt);
break;
case IRLMP_WAITDEVICE:
/* This function is just another way of seeing life ;-)
* IRLMP_ENUMDEVICES assumes that you have a static network,
* and that you just want to pick one of the devices present.
* On the other hand, in here we assume that no device is
* present and that at some point in the future a device will
* come into range. When this device arrive, we just wake
* up the caller, so that he has time to connect to it before
* the device goes away...
* Note : once the node has been discovered for more than a
* few second, it won't trigger this function, unless it
* goes away and come back changes its hint bits (so we
* might call it IRLMP_WAITNEWDEVICE).
*/
/* Check that the user is passing us an int */
if (len != sizeof(int)) {
err = -EINVAL;
goto out;
}
/* Get timeout in ms (max time we block the caller) */
if (get_user(val, (int __user *)optval)) {
err = -EFAULT;
goto out;
}
/* Tell IrLMP we want to be notified */
irlmp_update_client(self->ckey, self->mask.word,
irda_selective_discovery_indication,
NULL, (void *) self);
/* Do some discovery (and also return cached results) */
irlmp_discovery_request(self->nslots);
/* Wait until a node is discovered */
if (!self->cachedaddr) {
IRDA_DEBUG(1, "%s(), nothing discovered yet, going to sleep...\n", __func__);
/* Set watchdog timer to expire in <val> ms. */
self->errno = 0;
setup_timer(&self->watchdog, irda_discovery_timeout,
(unsigned long)self);
mod_timer(&self->watchdog,
jiffies + msecs_to_jiffies(val));
/* Wait for IR-LMP to call us back */
err = __wait_event_interruptible(self->query_wait,
(self->cachedaddr != 0 || self->errno == -ETIME));
/* If watchdog is still activated, kill it! */
del_timer(&(self->watchdog));
IRDA_DEBUG(1, "%s(), ...waking up !\n", __func__);
if (err != 0)
goto out;
}
else
IRDA_DEBUG(1, "%s(), found immediately !\n",
__func__);
/* Tell IrLMP that we have been notified */
irlmp_update_client(self->ckey, self->mask.word,
NULL, NULL, NULL);
/* Check if the we got some results */
if (!self->cachedaddr) {
err = -EAGAIN; /* Didn't find any devices */
goto out;
}
daddr = self->cachedaddr;
/* Cleanup */
self->cachedaddr = 0;
/* We return the daddr of the device that trigger the
* wakeup. As irlmp pass us only the new devices, we
* are sure that it's not an old device.
* If the user want more details, he should query
* the whole discovery log and pick one device...
*/
if (put_user(daddr, (int __user *)optval)) {
err = -EFAULT;
goto out;
}
break;
default:
err = -ENOPROTOOPT;
}
out:
release_sock(sk);
return err;
}
| 0
|
96,398
|
BOOL CALLBACK win_init_once(
PINIT_ONCE InitOnce,
PVOID Parameter,
PVOID *lpContext)
{
return !mysql_once_init();
return TRUE;
}
| 0
|
41,766
|
void Compute(OpKernelContext* context) override {
const Tensor& input_sizes = context->input(0);
const Tensor& filter = context->input(1);
const Tensor& out_backprop = context->input(2);
TensorShape input_shape;
OP_REQUIRES_OK(context,
Conv2DBackpropComputeInputShape(input_sizes, filter.shape(),
out_backprop.shape(),
data_format_, &input_shape));
Tensor* in_backprop = nullptr;
OP_REQUIRES_OK(context,
context->allocate_output(0, input_shape, &in_backprop));
// If there is nothing to compute, return.
if (input_shape.num_elements() == 0) {
return;
}
// For now we take the stride from the second and third dimensions only (we
// do not support striding on the batch or depth dimension).
const int stride_rows = GetTensorDim(strides_, data_format_, 'H');
const int stride_cols = GetTensorDim(strides_, data_format_, 'W');
const int dilation_rows = GetTensorDim(dilations_, data_format_, 'H');
const int dilation_cols = GetTensorDim(dilations_, data_format_, 'W');
VLOG(2) << "Conv2DBackpropInput:"
<< " input: " << input_shape.DebugString()
<< " filter:" << filter.shape().DebugString()
<< " out_backprop: " << out_backprop.shape().DebugString()
<< " strides: [" << stride_rows << ", " << stride_cols << "]"
<< " dilations: [" << dilation_rows << ", " << dilation_cols << "]";
LaunchConv2DBackpropInputOp<Device, T> launch;
launch(context, use_cudnn_, cudnn_use_autotune_, out_backprop, filter,
dilation_rows, dilation_cols, stride_rows, stride_cols, padding_,
explicit_paddings_, in_backprop, data_format_);
}
| 0
|
456,918
|
static void remove_full(struct kmem_cache *s, struct kmem_cache_node *n, struct page *page)
{
if (!(s->flags & SLAB_STORE_USER))
return;
lockdep_assert_held(&n->list_lock);
list_del(&page->slab_list);
}
| 0
|
310,974
|
dhcpv4_print(netdissect_options *ndo,
const u_char *cp, u_int length, int indent)
{
u_int i, t;
const u_char *tlv, *value;
uint8_t type, optlen;
i = 0;
while (i < length) {
if (i + 2 > length)
return -1;
tlv = cp + i;
type = (uint8_t)tlv[0];
optlen = (uint8_t)tlv[1];
value = tlv + 2;
ND_PRINT((ndo, "\n"));
for (t = indent; t > 0; t--)
ND_PRINT((ndo, "\t"));
ND_PRINT((ndo, "%s", tok2str(dh4opt_str, "Unknown", type)));
ND_PRINT((ndo," (%u)", optlen + 2 ));
if (i + 2 + optlen > length)
return -1;
switch (type) {
case DH4OPT_DNS_SERVERS:
case DH4OPT_NTP_SERVERS: {
if (optlen < 4 || optlen % 4 != 0) {
return -1;
}
for (t = 0; t < optlen; t += 4)
ND_PRINT((ndo, " %s", ipaddr_string(ndo, value + t)));
}
break;
case DH4OPT_DOMAIN_SEARCH: {
const u_char *tp = value;
while (tp < value + optlen) {
ND_PRINT((ndo, " "));
if ((tp = ns_nprint(ndo, tp, value + optlen)) == NULL)
return -1;
}
}
break;
}
i += 2 + optlen;
}
return 0;
}
| 0
|
448,998
|
UTI_CompareNtp64(NTP_int64 *a, NTP_int64 *b)
{
int32_t diff;
if (a->hi == b->hi && a->lo == b->lo)
return 0;
diff = ntohl(a->hi) - ntohl(b->hi);
if (diff < 0)
return -1;
if (diff > 0)
return 1;
return ntohl(a->lo) < ntohl(b->lo) ? -1 : 1;
}
| 0
|
331,603
|
static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int offset)
{
uint8_t *prev, *cur;
int blk, blocks, t, blk2;
int blocktypes = 0;
int x, y, a, b;
int pattype, pattern;
const int width = c->avctx->width;
uint8_t *pstart = c->prev_frame;
uint8_t *pend = c->prev_frame + width*c->avctx->height;
prev = c->prev_frame + offset;
cur = c->frame;
blocks = (c->avctx->width >> 2) * (c->avctx->height >> 2);
blk2 = 0;
for(blk = 0; blk < blocks; blk++){
if(!(blk & 3))
blocktypes = bytestream_get_byte(&buf);
switch(blocktypes & 0xC0){
case 0x00: //skip
for(y = 0; y < 4; y++)
if(check_line(prev + y*width, pstart, pend))
memcpy(cur + y*width, prev + y*width, 4);
else
memset(cur + y*width, 0, 4);
break;
case 0x40:
t = bytestream_get_byte(&buf);
if(!t){ //raw block
for(y = 0; y < 4; y++)
memcpy(cur + y*width, buf + y*4, 4);
buf += 16;
}else{ // motion compensation
x = ((t & 0xF)^8) - 8;
y = ((t >> 4) ^8) - 8;
t = x + y*width;
for(y = 0; y < 4; y++)
if(check_line(prev + t + y*width, pstart, pend))
memcpy(cur + y*width, prev + t + y*width, 4);
else
memset(cur + y*width, 0, 4);
}
break;
case 0x80: // fill
t = bytestream_get_byte(&buf);
for(y = 0; y < 4; y++)
memset(cur + y*width, t, 4);
break;
case 0xC0: // pattern fill
t = bytestream_get_byte(&buf);
pattype = t >> 6;
pattern = vb_patterns[t & 0x3F];
switch(pattype){
case 0:
a = bytestream_get_byte(&buf);
b = bytestream_get_byte(&buf);
for(y = 0; y < 4; y++)
for(x = 0; x < 4; x++, pattern >>= 1)
cur[x + y*width] = (pattern & 1) ? b : a;
break;
case 1:
pattern = ~pattern;
case 2:
a = bytestream_get_byte(&buf);
for(y = 0; y < 4; y++)
for(x = 0; x < 4; x++, pattern >>= 1)
if(pattern & 1 && check_pixel(prev + x + y*width, pstart, pend))
cur[x + y*width] = prev[x + y*width];
else
cur[x + y*width] = a;
break;
case 3:
av_log(c->avctx, AV_LOG_ERROR, "Invalid opcode seen @%d\n",blk);
return -1;
}
break;
}
blocktypes <<= 2;
cur += 4;
prev += 4;
blk2++;
if(blk2 == (width >> 2)){
blk2 = 0;
cur += width * 3;
prev += width * 3;
}
}
return 0;
}
| 0
|
247,147
|
static Image *ReadJPEGImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
value[MaxTextExtent];
const char
*option;
ErrorManager
error_manager;
Image
*image;
IndexPacket
index;
JSAMPLE
*volatile jpeg_pixels;
JSAMPROW
scanline[1];
MagickBooleanType
debug,
status;
MagickSizeType
number_pixels;
MemoryInfo
*memory_info;
register ssize_t
i;
struct jpeg_decompress_struct
jpeg_info;
struct jpeg_error_mgr
jpeg_error;
register JSAMPLE
*p;
size_t
units;
ssize_t
y;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
debug=IsEventLogging();
(void) debug;
image=AcquireImage(image_info);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Verify that file size large enough to contain a JPEG datastream.
*/
if (GetBlobSize(image) < 107)
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
/*
Initialize JPEG parameters.
*/
(void) ResetMagickMemory(&error_manager,0,sizeof(error_manager));
(void) ResetMagickMemory(&jpeg_info,0,sizeof(jpeg_info));
(void) ResetMagickMemory(&jpeg_error,0,sizeof(jpeg_error));
jpeg_info.err=jpeg_std_error(&jpeg_error);
jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler;
jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler;
memory_info=(MemoryInfo *) NULL;
error_manager.image=image;
if (setjmp(error_manager.error_recovery) != 0)
{
jpeg_destroy_decompress(&jpeg_info);
if (error_manager.profile != (StringInfo *) NULL)
error_manager.profile=DestroyStringInfo(error_manager.profile);
(void) CloseBlob(image);
number_pixels=(MagickSizeType) image->columns*image->rows;
if (number_pixels != 0)
return(GetFirstImageInList(image));
InheritException(exception,&image->exception);
return(DestroyImage(image));
}
jpeg_info.client_data=(void *) &error_manager;
jpeg_create_decompress(&jpeg_info);
JPEGSourceManager(&jpeg_info,image);
jpeg_set_marker_processor(&jpeg_info,JPEG_COM,ReadComment);
option=GetImageOption(image_info,"profile:skip");
if (IsOptionMember("ICC",option) == MagickFalse)
jpeg_set_marker_processor(&jpeg_info,ICC_MARKER,ReadICCProfile);
if (IsOptionMember("IPTC",option) == MagickFalse)
jpeg_set_marker_processor(&jpeg_info,IPTC_MARKER,ReadIPTCProfile);
for (i=1; i < 16; i++)
if ((i != 2) && (i != 13) && (i != 14))
if (IsOptionMember("APP",option) == MagickFalse)
jpeg_set_marker_processor(&jpeg_info,(int) (JPEG_APP0+i),ReadProfile);
i=(ssize_t) jpeg_read_header(&jpeg_info,TRUE);
if ((image_info->colorspace == YCbCrColorspace) ||
(image_info->colorspace == Rec601YCbCrColorspace) ||
(image_info->colorspace == Rec709YCbCrColorspace))
jpeg_info.out_color_space=JCS_YCbCr;
/*
Set image resolution.
*/
units=0;
if ((jpeg_info.saw_JFIF_marker != 0) && (jpeg_info.X_density != 1) &&
(jpeg_info.Y_density != 1))
{
image->x_resolution=(double) jpeg_info.X_density;
image->y_resolution=(double) jpeg_info.Y_density;
units=(size_t) jpeg_info.density_unit;
}
if (units == 1)
image->units=PixelsPerInchResolution;
if (units == 2)
image->units=PixelsPerCentimeterResolution;
number_pixels=(MagickSizeType) image->columns*image->rows;
option=GetImageOption(image_info,"jpeg:size");
if ((option != (const char *) NULL) &&
(jpeg_info.out_color_space != JCS_YCbCr))
{
double
scale_factor;
GeometryInfo
geometry_info;
MagickStatusType
flags;
/*
Scale the image.
*/
flags=ParseGeometry(option,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
jpeg_calc_output_dimensions(&jpeg_info);
image->magick_columns=jpeg_info.output_width;
image->magick_rows=jpeg_info.output_height;
scale_factor=1.0;
if (geometry_info.rho != 0.0)
scale_factor=jpeg_info.output_width/geometry_info.rho;
if ((geometry_info.sigma != 0.0) &&
(scale_factor > (jpeg_info.output_height/geometry_info.sigma)))
scale_factor=jpeg_info.output_height/geometry_info.sigma;
jpeg_info.scale_num=1U;
jpeg_info.scale_denom=(unsigned int) scale_factor;
jpeg_calc_output_dimensions(&jpeg_info);
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Scale factor: %.20g",(double) scale_factor);
}
#if (JPEG_LIB_VERSION >= 61) && defined(D_PROGRESSIVE_SUPPORTED)
#if defined(D_LOSSLESS_SUPPORTED)
image->interlace=jpeg_info.process == JPROC_PROGRESSIVE ?
JPEGInterlace : NoInterlace;
image->compression=jpeg_info.process == JPROC_LOSSLESS ?
LosslessJPEGCompression : JPEGCompression;
if (jpeg_info.data_precision > 8)
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"12-bit JPEG not supported. Reducing pixel data to 8 bits","`%s'",
image->filename);
if (jpeg_info.data_precision == 16)
jpeg_info.data_precision=12;
#else
image->interlace=jpeg_info.progressive_mode != 0 ? JPEGInterlace :
NoInterlace;
image->compression=JPEGCompression;
#endif
#else
image->compression=JPEGCompression;
image->interlace=JPEGInterlace;
#endif
option=GetImageOption(image_info,"jpeg:colors");
if (option != (const char *) NULL)
{
/*
Let the JPEG library quantize for us.
*/
jpeg_info.quantize_colors=TRUE;
jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option);
}
option=GetImageOption(image_info,"jpeg:block-smoothing");
if (option != (const char *) NULL)
jpeg_info.do_block_smoothing=IsStringTrue(option) != MagickFalse ? TRUE :
FALSE;
jpeg_info.dct_method=JDCT_FLOAT;
option=GetImageOption(image_info,"jpeg:dct-method");
if (option != (const char *) NULL)
switch (*option)
{
case 'D':
case 'd':
{
if (LocaleCompare(option,"default") == 0)
jpeg_info.dct_method=JDCT_DEFAULT;
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(option,"fastest") == 0)
jpeg_info.dct_method=JDCT_FASTEST;
if (LocaleCompare(option,"float") == 0)
jpeg_info.dct_method=JDCT_FLOAT;
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(option,"ifast") == 0)
jpeg_info.dct_method=JDCT_IFAST;
if (LocaleCompare(option,"islow") == 0)
jpeg_info.dct_method=JDCT_ISLOW;
break;
}
}
option=GetImageOption(image_info,"jpeg:fancy-upsampling");
if (option != (const char *) NULL)
jpeg_info.do_fancy_upsampling=IsStringTrue(option) != MagickFalse ? TRUE :
FALSE;
(void) jpeg_start_decompress(&jpeg_info);
image->columns=jpeg_info.output_width;
image->rows=jpeg_info.output_height;
image->depth=(size_t) jpeg_info.data_precision;
switch (jpeg_info.out_color_space)
{
case JCS_RGB:
default:
{
(void) SetImageColorspace(image,sRGBColorspace);
break;
}
case JCS_GRAYSCALE:
{
(void) SetImageColorspace(image,GRAYColorspace);
break;
}
case JCS_YCbCr:
{
(void) SetImageColorspace(image,YCbCrColorspace);
break;
}
case JCS_CMYK:
{
(void) SetImageColorspace(image,CMYKColorspace);
break;
}
}
if (IsITUFaxImage(image) != MagickFalse)
{
(void) SetImageColorspace(image,LabColorspace);
jpeg_info.out_color_space=JCS_YCbCr;
}
option=GetImageOption(image_info,"jpeg:colors");
if (option != (const char *) NULL)
if (AcquireImageColormap(image,StringToUnsignedLong(option)) == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
if ((jpeg_info.output_components == 1) && (jpeg_info.quantize_colors == 0))
{
size_t
colors;
colors=(size_t) GetQuantumRange(image->depth)+1;
if (AcquireImageColormap(image,colors) == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
}
if (image->debug != MagickFalse)
{
if (image->interlace != NoInterlace)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Interlace: progressive");
else
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Interlace: nonprogressive");
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Data precision: %d",
(int) jpeg_info.data_precision);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %dx%d",
(int) jpeg_info.output_width,(int) jpeg_info.output_height);
}
JPEGSetImageQuality(&jpeg_info,image);
JPEGSetImageSamplingFactor(&jpeg_info,image);
(void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
jpeg_info.out_color_space);
(void) SetImageProperty(image,"jpeg:colorspace",value);
if (image_info->ping != MagickFalse)
{
jpeg_destroy_decompress(&jpeg_info);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
jpeg_destroy_decompress(&jpeg_info);
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
if ((jpeg_info.output_components != 1) &&
(jpeg_info.output_components != 3) && (jpeg_info.output_components != 4))
{
jpeg_destroy_decompress(&jpeg_info);
ThrowReaderException(CorruptImageError,"ImageTypeNotSupported");
}
memory_info=AcquireVirtualMemory((size_t) image->columns,
jpeg_info.output_components*sizeof(*jpeg_pixels));
if (memory_info == (MemoryInfo *) NULL)
{
jpeg_destroy_decompress(&jpeg_info);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info);
(void) ResetMagickMemory(jpeg_pixels,0,image->columns*
jpeg_info.output_components*sizeof(*jpeg_pixels));
/*
Convert JPEG pixels to pixel packets.
*/
if (setjmp(error_manager.error_recovery) != 0)
{
if (memory_info != (MemoryInfo *) NULL)
memory_info=RelinquishVirtualMemory(memory_info);
jpeg_destroy_decompress(&jpeg_info);
(void) CloseBlob(image);
number_pixels=(MagickSizeType) image->columns*image->rows;
if (number_pixels != 0)
return(GetFirstImageInList(image));
return(DestroyImage(image));
}
if (jpeg_info.quantize_colors != 0)
{
image->colors=(size_t) jpeg_info.actual_number_of_colors;
if (jpeg_info.out_color_space == JCS_GRAYSCALE)
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]);
image->colormap[i].green=image->colormap[i].red;
image->colormap[i].blue=image->colormap[i].red;
image->colormap[i].opacity=OpaqueOpacity;
}
else
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]);
image->colormap[i].green=ScaleCharToQuantum(jpeg_info.colormap[1][i]);
image->colormap[i].blue=ScaleCharToQuantum(jpeg_info.colormap[2][i]);
image->colormap[i].opacity=OpaqueOpacity;
}
}
scanline[0]=(JSAMPROW) jpeg_pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*magick_restrict indexes;
register ssize_t
x;
register PixelPacket
*magick_restrict q;
if (jpeg_read_scanlines(&jpeg_info,scanline,1) != 1)
{
(void) ThrowMagickException(exception,GetMagickModule(),
CorruptImageWarning,"SkipToSyncByte","`%s'",image->filename);
continue;
}
p=jpeg_pixels;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
if (jpeg_info.data_precision > 8)
{
unsigned short
scale;
scale=65535/(unsigned short) GetQuantumRange((size_t)
jpeg_info.data_precision);
if (jpeg_info.output_components == 1)
for (x=0; x < (ssize_t) image->columns; x++)
{
size_t
pixel;
pixel=(size_t) (scale*GETJSAMPLE(*p));
index=ConstrainColormapIndex(image,pixel);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
else
if (image->colorspace != CMYKColorspace)
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ScaleShortToQuantum((unsigned short)
(scale*GETJSAMPLE(*p++))));
SetPixelGreen(q,ScaleShortToQuantum((unsigned short)
(scale*GETJSAMPLE(*p++))));
SetPixelBlue(q,ScaleShortToQuantum((unsigned short)
(scale*GETJSAMPLE(*p++))));
SetPixelOpacity(q,OpaqueOpacity);
q++;
}
else
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelCyan(q,QuantumRange-ScaleShortToQuantum(
(unsigned short) (scale*GETJSAMPLE(*p++))));
SetPixelMagenta(q,QuantumRange-ScaleShortToQuantum(
(unsigned short) (scale*GETJSAMPLE(*p++))));
SetPixelYellow(q,QuantumRange-ScaleShortToQuantum(
(unsigned short) (scale*GETJSAMPLE(*p++))));
SetPixelBlack(indexes+x,QuantumRange-ScaleShortToQuantum(
(unsigned short) (scale*GETJSAMPLE(*p++))));
SetPixelOpacity(q,OpaqueOpacity);
q++;
}
}
else
if (jpeg_info.output_components == 1)
for (x=0; x < (ssize_t) image->columns; x++)
{
index=ConstrainColormapIndex(image,(size_t) GETJSAMPLE(*p));
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
else
if (image->colorspace != CMYKColorspace)
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelGreen(q,ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelBlue(q,ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelOpacity(q,OpaqueOpacity);
q++;
}
else
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelCyan(q,QuantumRange-ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelMagenta(q,QuantumRange-ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelYellow(q,QuantumRange-ScaleCharToQuantum((unsigned char)
GETJSAMPLE(*p++)));
SetPixelBlack(indexes+x,QuantumRange-ScaleCharToQuantum(
(unsigned char) GETJSAMPLE(*p++)));
SetPixelOpacity(q,OpaqueOpacity);
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
{
jpeg_abort_decompress(&jpeg_info);
break;
}
}
if (status != MagickFalse)
{
error_manager.finished=MagickTrue;
if (setjmp(error_manager.error_recovery) == 0)
(void) jpeg_finish_decompress(&jpeg_info);
}
/*
Free jpeg resources.
*/
jpeg_destroy_decompress(&jpeg_info);
memory_info=RelinquishVirtualMemory(memory_info);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
| 0
|
103,378
|
int cil_gen_tunif(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
{
enum cil_syntax syntax[] = {
CIL_SYN_STRING,
CIL_SYN_STRING | CIL_SYN_LIST,
CIL_SYN_LIST,
CIL_SYN_LIST | CIL_SYN_END,
CIL_SYN_END
};
int syntax_len = sizeof(syntax)/sizeof(*syntax);
struct cil_tunableif *tif = NULL;
struct cil_tree_node *next = NULL;
int rc = SEPOL_ERR;
if (db == NULL || parse_current == NULL || ast_node == NULL) {
goto exit;
}
rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
if (rc != SEPOL_OK) {
goto exit;
}
cil_tunif_init(&tif);
rc = cil_gen_expr(parse_current->next, CIL_TUNABLE, &tif->str_expr);
if (rc != SEPOL_OK) {
goto exit;
}
rc = cil_verify_conditional_blocks(parse_current->next->next);
if (rc != SEPOL_OK) {
goto exit;
}
/* Destroying expr tree */
next = parse_current->next->next;
cil_tree_subtree_destroy(parse_current->next);
parse_current->next = next;
ast_node->flavor = CIL_TUNABLEIF;
ast_node->data = tif;
return SEPOL_OK;
exit:
cil_tree_log(parse_current, CIL_ERR, "Bad tunableif declaration");
cil_destroy_tunif(tif);
return rc;
}
| 0
|
128,887
|
WasmResult set(absl::string_view vm_id, absl::string_view key, absl::string_view value,
uint32_t cas) {
absl::WriterMutexLock l(&mutex);
absl::flat_hash_map<std::string, std::pair<std::string, uint32_t>>* map;
auto map_it = data.find(vm_id);
if (map_it == data.end()) {
map = &data[vm_id];
} else {
map = &map_it->second;
}
auto it = map->find(key);
if (it != map->end()) {
if (cas && cas != it->second.second) {
return WasmResult::CasMismatch;
}
it->second = std::make_pair(std::string(value), nextCas());
} else {
map->emplace(key, std::make_pair(std::string(value), nextCas()));
}
return WasmResult::Ok;
}
| 0
|
384,325
|
static void dma_buf_commit(IDEState *s, uint32_t tx_bytes)
{
if (s->bus->dma->ops->commit_buf) {
s->bus->dma->ops->commit_buf(s->bus->dma, tx_bytes);
}
qemu_sglist_destroy(&s->sg);
}
| 0
|
146,865
|
static void l2tp_ip6_destroy_sock(struct sock *sk)
{
struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk);
lock_sock(sk);
ip6_flush_pending_frames(sk);
release_sock(sk);
if (tunnel) {
l2tp_tunnel_closeall(tunnel);
sock_put(sk);
}
inet6_destroy_sock(sk);
}
| 0
|
112,003
|
RAMBlock *qemu_ram_alloc(struct uc_struct *uc, ram_addr_t size, MemoryRegion *mr)
{
return qemu_ram_alloc_from_ptr(uc, size, NULL, mr);
}
| 0
|
493,232
|
RemoveStatisticsById(Oid statsOid)
{
Relation relation;
HeapTuple tup;
Form_pg_statistic_ext statext;
Oid relid;
/*
* First delete the pg_statistic_ext_data tuple holding the actual
* statistical data.
*/
relation = table_open(StatisticExtDataRelationId, RowExclusiveLock);
tup = SearchSysCache1(STATEXTDATASTXOID, ObjectIdGetDatum(statsOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for statistics data %u", statsOid);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
/*
* Delete the pg_statistic_ext tuple. Also send out a cache inval on the
* associated table, so that dependent plans will be rebuilt.
*/
relation = table_open(StatisticExtRelationId, RowExclusiveLock);
tup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statsOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for statistics object %u", statsOid);
statext = (Form_pg_statistic_ext) GETSTRUCT(tup);
relid = statext->stxrelid;
CacheInvalidateRelcacheByRelid(relid);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
| 0
|
304,425
|
char *url_decode_r(char *to, char *url, size_t size) {
char *s = url, // source
*d = to, // destination
*e = &to[size - 1]; // destination end
while(*s && d < e) {
if(unlikely(*s == '%')) {
if(likely(s[1] && s[2])) {
char t = from_hex(s[1]) << 4 | from_hex(s[2]);
// avoid HTTP header injection
*d++ = (char)((isprint(t))? t : ' ');
s += 2;
}
}
else if(unlikely(*s == '+'))
*d++ = ' ';
else
*d++ = *s;
s++;
}
*d = '\0';
return to;
}
| 0
|
474,584
|
static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
enum cgroup_filetype type)
{
struct cgroup_pidlist *l;
/* don't need task_nsproxy() if we're looking at ourself */
struct pid_namespace *ns = task_active_pid_ns(current);
lockdep_assert_held(&cgrp->pidlist_mutex);
list_for_each_entry(l, &cgrp->pidlists, links)
if (l->key.type == type && l->key.ns == ns)
return l;
return NULL;
}
| 0
|
48,618
|
static void spl_filesystem_tree_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
spl_filesystem_iterator *iterator = (spl_filesystem_iterator *)iter;
spl_filesystem_object *object = spl_filesystem_iterator_to_object(iterator);
if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
ZVAL_STRINGL(iterator->current, object->file_name, object->file_name_len, 1);
}
*data = &iterator->current;
} else if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_FILEINFO)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
spl_filesystem_object_create_type(0, object, SPL_FS_INFO, NULL, iterator->current TSRMLS_CC);
}
*data = &iterator->current;
} else {
*data = (zval**)&iterator->intern.data;
}
}
| 0
|
233,908
|
void AudioOutputDeviceTest::WaitUntilRenderCallback() {
io_loop_.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(),
TestTimeouts::action_timeout());
io_loop_.Run();
}
| 0
|
490,603
|
Bool gf_filter_has_pid_connection_pending(GF_Filter *filter, GF_Filter *stop_at_filter)
{
GF_FilterSession *fsess;
Bool res;
if (!filter) return GF_FALSE;
//lock session, this is an unsafe call
fsess = filter->session;
gf_mx_p(fsess->filters_mx);
res = gf_filter_has_pid_connection_pending_internal(filter, stop_at_filter);
gf_mx_v(fsess->filters_mx);
return res;
}
| 0
|
518,265
|
static void warn_if_datadir_altered(THD *thd,
const partition_element *part_elem)
{
DBUG_ASSERT(part_elem);
if (part_elem->engine_type &&
part_elem->engine_type->db_type != DB_TYPE_INNODB)
return;
if (part_elem->data_file_name)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_INNODB_PARTITION_OPTION_IGNORED,
ER(WARN_INNODB_PARTITION_OPTION_IGNORED),
"DATA DIRECTORY");
}
if (part_elem->index_file_name)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
WARN_INNODB_PARTITION_OPTION_IGNORED,
ER(WARN_INNODB_PARTITION_OPTION_IGNORED),
"INDEX DIRECTORY");
}
}
| 0
|
396,539
|
GC_API size_t GC_CALL GC_get_free_bytes(void)
{
/* ignore the memory space returned to OS */
return (size_t)(GC_large_free_bytes - GC_unmapped_bytes);
}
| 0
|
96,566
|
void NumberFormatTest::TestHostClone()
{
/*
Verify that a cloned formatter gives the same results
and is useable after the original has been deleted.
*/
// This is mainly important on Windows.
UErrorCode status = U_ZERO_ERROR;
Locale loc("en_US@compat=host");
UDate now = Calendar::getNow();
NumberFormat *full = NumberFormat::createInstance(loc, status);
if (full == NULL || U_FAILURE(status)) {
dataerrln("FAIL: Can't create NumberFormat date instance - %s", u_errorName(status));
return;
}
UnicodeString result1;
full->format(now, result1, status);
Format *fullClone = full->clone();
delete full;
full = NULL;
UnicodeString result2;
fullClone->format(now, result2, status);
if (U_FAILURE(status)) {
errln("FAIL: format failure.");
}
if (result1 != result2) {
errln("FAIL: Clone returned different result from non-clone.");
}
delete fullClone;
}
| 0
|
66,273
|
ParseNodePtr Parser::ParseMetaProperty(tokens metaParentKeyword, charcount_t ichMin, _Out_opt_ BOOL* pfCanAssign)
{
AssertMsg(metaParentKeyword == tkNEW, "Only supported for tkNEW parent keywords");
AssertMsg(this->m_token.tk == tkDot, "We must be currently sitting on the dot after the parent keyword");
m_pscan->Scan();
if (this->m_token.tk == tkID && this->m_token.GetIdentifier(m_phtbl) == this->GetTargetPid())
{
ThrowNewTargetSyntaxErrForGlobalScope();
if (pfCanAssign)
{
*pfCanAssign = FALSE;
}
if (buildAST)
{
return CreateNodeWithScanner<knopNewTarget>(ichMin);
}
}
else
{
Error(ERRsyntax);
}
return nullptr;
}
| 0
|
128,855
|
NOEXPORT void session_cache_retrieve(CLI *c) {
SSL_SESSION *sess;
CRYPTO_THREAD_read_lock(stunnel_locks[LOCK_SESSION]);
if(c->opt->option.delayed_lookup) {
sess=c->opt->session;
} else { /* per-destination client cache */
if(c->opt->connect_session) {
sess=c->opt->connect_session[c->idx];
} else {
s_log(LOG_ERR, "INTERNAL ERROR: Uninitialized client session cache");
sess=NULL;
}
}
if(sess)
SSL_set_session(c->ssl, sess);
CRYPTO_THREAD_unlock(stunnel_locks[LOCK_SESSION]);
}
| 0
|
522,010
|
double user_var_entry::val_real(bool *null_value)
{
if ((*null_value= (value == 0)))
return 0.0;
switch (type) {
case REAL_RESULT:
return *(double*) value;
case INT_RESULT:
return (double) *(longlong*) value;
case DECIMAL_RESULT:
{
double result;
my_decimal2double(E_DEC_FATAL_ERROR, (my_decimal *)value, &result);
return result;
}
case STRING_RESULT:
return my_atof(value); // This is null terminated
case ROW_RESULT:
case TIME_RESULT:
DBUG_ASSERT(0); // Impossible
break;
}
return 0.0; // Impossible
}
| 0
|
10,771
|
bool DeleteReparsePoint(HANDLE source) {
DWORD returned;
REPARSE_DATA_BUFFER data = {0};
data.ReparseTag = 0xa0000003;
if (!DeviceIoControl(source, FSCTL_DELETE_REPARSE_POINT, &data, 8, NULL, 0,
&returned, NULL)) {
return false;
}
return true;
}
| 1
|
261,228
|
static void __fput(struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = file->f_inode;
might_sleep();
fsnotify_close(file);
/*
* The function eventpoll_release() should be the first called
* in the file cleanup chain.
*/
eventpoll_release(file);
locks_remove_flock(file);
if (unlikely(file->f_flags & FASYNC)) {
if (file->f_op->fasync)
file->f_op->fasync(-1, file, 0);
}
ima_file_free(file);
if (file->f_op->release)
file->f_op->release(inode, file);
security_file_free(file);
if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
!(file->f_mode & FMODE_PATH))) {
cdev_put(inode->i_cdev);
}
fops_put(file->f_op);
put_pid(file->f_owner.pid);
if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
i_readcount_dec(inode);
if (file->f_mode & FMODE_WRITE)
drop_file_write_access(file);
file->f_path.dentry = NULL;
file->f_path.mnt = NULL;
file->f_inode = NULL;
file_free(file);
dput(dentry);
mntput(mnt);
}
| 0
|
386,724
|
OPJ_UINT32 opj_j2k_get_max_toc_size (opj_j2k_t *p_j2k)
{
OPJ_UINT32 i;
OPJ_UINT32 l_nb_tiles;
OPJ_UINT32 l_max = 0;
opj_tcp_t * l_tcp = 00;
l_tcp = p_j2k->m_cp.tcps;
l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th ;
for (i=0;i<l_nb_tiles;++i) {
l_max = opj_uint_max(l_max,l_tcp->m_nb_tile_parts);
++l_tcp;
}
return 12 * l_max;
}
| 0
|
223,780
|
static void deprecatedVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::voidMethod);
TestObjectPythonV8Internal::deprecatedVoidMethodMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
175,511
|
int TabStrip::GetInactiveTabWidth() const {
return layout_helper_->inactive_tab_width();
}
| 0
|
457,566
|
rb_update_read_stamp(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event)
{
u64 delta;
switch (event->type_len) {
case RINGBUF_TYPE_PADDING:
return;
case RINGBUF_TYPE_TIME_EXTEND:
delta = ring_buffer_event_time_stamp(event);
cpu_buffer->read_stamp += delta;
return;
case RINGBUF_TYPE_TIME_STAMP:
delta = ring_buffer_event_time_stamp(event);
cpu_buffer->read_stamp = delta;
return;
case RINGBUF_TYPE_DATA:
cpu_buffer->read_stamp += event->time_delta;
return;
default:
RB_WARN_ON(cpu_buffer, 1);
}
return;
}
| 0
|
175,267
|
void GuestViewBase::UpdatePreferredSize(
content::WebContents* target_web_contents,
const gfx::Size& pref_size) {
DCHECK_EQ(web_contents(), target_web_contents);
if (IsPreferredSizeModeEnabled()) {
OnPreferredSizeChanged(pref_size);
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.