idx
int64 | func
string | target
int64 |
|---|---|---|
433,566
|
static u32 iwl_trans_pcie_get_cmdlen(struct iwl_trans *trans, void *tfd)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 cmdlen = 0;
int i;
for (i = 0; i < trans_pcie->max_tbs; i++)
cmdlen += iwl_pcie_tfd_tb_get_len(trans, tfd, i);
return cmdlen;
}
| 0
|
59,144
|
static inline bool nested_cpu_has2(struct vmcs12 *vmcs12, u32 bit)
{
return (vmcs12->cpu_based_vm_exec_control &
CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) &&
(vmcs12->secondary_vm_exec_control & bit);
}
| 0
|
234,869
|
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 2)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
| 0
|
172,484
|
void VariationsService::RecordLastFetchTime() {
DCHECK(thread_checker_.CalledOnValidThread());
if (local_state_) {
local_state_->SetInt64(prefs::kVariationsLastFetchTime,
base::Time::Now().ToInternalValue());
}
}
| 0
|
315,578
|
int SafeSock::get_bytes(void *dta, int size)
{
ASSERT( size > 0 );
while(!_msgReady) {
if(_timeout > 0) {
Selector selector;
selector.set_timeout( _timeout );
selector.add_fd( _sock, Selector::IO_READ );
selector.execute();
if ( selector.timed_out() ) {
return 0;
} else if ( !selector.has_ready() ) {
dprintf(D_NETWORK, "select returns %d, recv failed\n",
selector.select_retval());
return 0;
}
}
(void)handle_incoming_packet();
}
char *tempBuf = (char *)malloc(size);
if (!tempBuf) { EXCEPT("malloc failed"); }
int readSize, length;
unsigned char * dec;
if(_longMsg) {
readSize = _longMsg->getn(tempBuf, size);
}
else {
readSize = _shortMsg.getn(tempBuf, size);
}
if(readSize == size) {
if (get_encryption()) {
unwrap((unsigned char *) tempBuf, readSize, dec, length);
memcpy(dta, dec, readSize);
free(dec);
}
else {
memcpy(dta, tempBuf, readSize);
}
free(tempBuf);
return readSize;
} else {
free(tempBuf);
dprintf(D_NETWORK,
"SafeSock::get_bytes - failed because bytes read is different from bytes requested\n");
return -1;
}
}
| 0
|
119,070
|
void Tensor::FillDescription(TensorDescription* description) const {
description->set_dtype(dtype());
shape().AsProto(description->mutable_shape());
if (buf_ != nullptr && buf_->data() != nullptr) {
buf_->FillAllocationDescription(
description->mutable_allocation_description());
}
}
| 0
|
78,868
|
static struct net_device_stats *veth_get_stats(struct net_device *dev)
{
struct veth_priv *priv;
int cpu;
struct veth_net_stats *stats, total = {0};
priv = netdev_priv(dev);
for_each_possible_cpu(cpu) {
stats = per_cpu_ptr(priv->stats, cpu);
total.rx_packets += stats->rx_packets;
total.tx_packets += stats->tx_packets;
total.rx_bytes += stats->rx_bytes;
total.tx_bytes += stats->tx_bytes;
total.tx_dropped += stats->tx_dropped;
total.rx_dropped += stats->rx_dropped;
}
dev->stats.rx_packets = total.rx_packets;
dev->stats.tx_packets = total.tx_packets;
dev->stats.rx_bytes = total.rx_bytes;
dev->stats.tx_bytes = total.tx_bytes;
dev->stats.tx_dropped = total.tx_dropped;
dev->stats.rx_dropped = total.rx_dropped;
return &dev->stats;
}
| 0
|
423,125
|
static void tcp_clamp_window(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
icsk->icsk_ack.quick = 0;
if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] &&
!(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
!sk_under_memory_pressure(sk) &&
sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) {
sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc),
sysctl_tcp_rmem[2]);
}
if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf)
tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss);
}
| 0
|
146,973
|
njs_typed_array_get_u8(const void *a)
{
return *(const uint8_t *) a;
}
| 0
|
250,505
|
PassOwnPtrWillBeRawPtr<LocalFileSystem> LocalFileSystem::create(PassOwnPtr<FileSystemClient> client)
{
return adoptPtrWillBeNoop(new LocalFileSystem(client));
}
| 0
|
272,246
|
gst_asf_demux_handle_seek_push (GstASFDemux * demux, GstEvent * event)
{
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
guint packet;
gboolean res;
GstEvent *byte_event;
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop);
stop_type = GST_SEEK_TYPE_NONE;
stop = -1;
GST_DEBUG_OBJECT (demux, "seeking to %" GST_TIME_FORMAT, GST_TIME_ARGS (cur));
/* determine packet, by index or by estimation */
if (!gst_asf_demux_seek_index_lookup (demux, &packet, cur, NULL, NULL, FALSE,
NULL)) {
packet =
(guint) gst_util_uint64_scale (demux->num_packets, cur,
demux->play_time);
}
if (packet > demux->num_packets) {
GST_DEBUG_OBJECT (demux, "could not determine packet to seek to, "
"seek aborted.");
return FALSE;
}
GST_DEBUG_OBJECT (demux, "seeking to packet %d", packet);
cur = demux->data_offset + ((guint64) packet * demux->packet_size);
GST_DEBUG_OBJECT (demux, "Pushing BYTE seek rate %g, "
"start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT, rate, cur, stop);
/* BYTE seek event */
byte_event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, cur_type,
cur, stop_type, stop);
gst_event_set_seqnum (byte_event, gst_event_get_seqnum (event));
res = gst_pad_push_event (demux->sinkpad, byte_event);
return res;
}
| 0
|
434,367
|
int mutt_check_overwrite (const char *attname, const char *path,
char *fname, size_t flen, int *append, char **directory)
{
int rc = 0;
char tmp[_POSIX_PATH_MAX];
struct stat st;
strfcpy (fname, path, flen);
if (access (fname, F_OK) != 0)
return 0;
if (stat (fname, &st) != 0)
return -1;
if (S_ISDIR (st.st_mode))
{
if (directory)
{
switch (mutt_multi_choice
(_("File is a directory, save under it? [(y)es, (n)o, (a)ll]"), _("yna")))
{
case 3: /* all */
mutt_str_replace (directory, fname);
break;
case 1: /* yes */
FREE (directory); /* __FREE_CHECKED__ */
break;
case -1: /* abort */
FREE (directory); /* __FREE_CHECKED__ */
return -1;
case 2: /* no */
FREE (directory); /* __FREE_CHECKED__ */
return 1;
}
}
else if ((rc = mutt_yesorno (_("File is a directory, save under it?"), M_YES)) != M_YES)
return (rc == M_NO) ? 1 : -1;
if (!attname || !attname[0])
{
tmp[0] = 0;
if (mutt_get_field (_("File under directory: "), tmp, sizeof (tmp),
M_FILE | M_CLEAR) != 0 || !tmp[0])
return (-1);
mutt_concat_path (fname, path, tmp, flen);
}
else
mutt_concat_path (fname, path, mutt_basename (attname), flen);
}
if (*append == 0 && access (fname, F_OK) == 0)
{
switch (mutt_multi_choice
(_("File exists, (o)verwrite, (a)ppend, or (c)ancel?"), _("oac")))
{
case -1: /* abort */
return -1;
case 3: /* cancel */
return 1;
case 2: /* append */
*append = M_SAVE_APPEND;
break;
case 1: /* overwrite */
*append = M_SAVE_OVERWRITE;
break;
}
}
return 0;
}
| 0
|
419,233
|
input_osc_11(struct input_ctx *ictx, const char *p)
{
struct window_pane *wp = ictx->wp;
u_int r, g, b;
if (sscanf(p, "rgb:%2x/%2x/%2x", &r, &g, &b) != 3)
goto bad;
wp->colgc.bg = colour_join_rgb(r, g, b);
wp->flags |= PANE_REDRAW;
return;
bad:
log_debug("bad OSC 11: %s", p);
}
| 0
|
394,286
|
BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b)
{
return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque);
}
| 0
|
391,213
|
static void rng_backend_free_requests(RngBackend *s)
{
GSList *i;
for (i = s->requests; i; i = i->next) {
rng_backend_free_request(i->data);
}
g_slist_free(s->requests);
s->requests = NULL;
}
| 0
|
97,383
|
//! Load image from a BMP file \newinstance.
static CImg<T> get_load_bmp(std::FILE *const file) {
return CImg<T>().load_bmp(file);
| 0
|
169,180
|
std::wstring LocaleWindowCaptionFromPageTitle(
const std::wstring& expected_title) {
std::wstring page_title = WindowCaptionFromPageTitle(expected_title);
#if defined(OS_WIN)
std::string locale = g_browser_process->GetApplicationLocale();
if (base::i18n::GetTextDirectionForLocale(locale.c_str()) ==
base::i18n::RIGHT_TO_LEFT) {
base::i18n::WrapStringWithLTRFormatting(&page_title);
}
return page_title;
#else
return page_title;
#endif
}
| 0
|
444,834
|
void StreamEncoderImpl::encodeHeader(const char* key, uint32_t key_size, const char* value,
uint32_t value_size) {
ASSERT(key_size > 0);
connection_.copyToBuffer(key, key_size);
connection_.addCharToBuffer(':');
connection_.addCharToBuffer(' ');
connection_.copyToBuffer(value, value_size);
connection_.addToBuffer(CRLF);
}
| 0
|
437,968
|
const BlockEntry* Cluster::GetEntry(const CuePoint& cp,
const CuePoint::TrackPosition& tp) const {
assert(m_pSegment);
const long long tc = cp.GetTimeCode();
if (tp.m_block > 0) {
const long block = static_cast<long>(tp.m_block);
const long index = block - 1;
while (index >= m_entries_count) {
long long pos;
long len;
const long status = Parse(pos, len);
if (status < 0) // TODO: can this happen?
return NULL;
if (status > 0) // nothing remains to be parsed
return NULL;
}
const BlockEntry* const pEntry = m_entries[index];
assert(pEntry);
assert(!pEntry->EOS());
const Block* const pBlock = pEntry->GetBlock();
assert(pBlock);
if ((pBlock->GetTrackNumber() == tp.m_track) &&
(pBlock->GetTimeCode(this) == tc)) {
return pEntry;
}
}
long index = 0;
for (;;) {
if (index >= m_entries_count) {
long long pos;
long len;
const long status = Parse(pos, len);
if (status < 0) // TODO: can this happen?
return NULL;
if (status > 0) // nothing remains to be parsed
return NULL;
assert(m_entries);
assert(index < m_entries_count);
}
const BlockEntry* const pEntry = m_entries[index];
assert(pEntry);
assert(!pEntry->EOS());
const Block* const pBlock = pEntry->GetBlock();
assert(pBlock);
if (pBlock->GetTrackNumber() != tp.m_track) {
++index;
continue;
}
const long long tc_ = pBlock->GetTimeCode(this);
if (tc_ < tc) {
++index;
continue;
}
if (tc_ > tc)
return NULL;
const Tracks* const pTracks = m_pSegment->GetTracks();
assert(pTracks);
const long tn = static_cast<long>(tp.m_track);
const Track* const pTrack = pTracks->GetTrackByNumber(tn);
if (pTrack == NULL)
return NULL;
const long long type = pTrack->GetType();
if (type == 2) // audio
return pEntry;
if (type != 1) // not video
return NULL;
if (!pBlock->IsKey())
return NULL;
return pEntry;
}
}
| 0
|
286,871
|
int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct vmw_private *dev_priv = vmw_priv(dev);
struct vmw_user_surface *user_srf;
struct vmw_surface *srf;
struct vmw_resource *res;
struct vmw_resource *tmp;
union drm_vmw_gb_surface_create_arg *arg =
(union drm_vmw_gb_surface_create_arg *)data;
struct drm_vmw_gb_surface_create_req *req = &arg->req;
struct drm_vmw_gb_surface_create_rep *rep = &arg->rep;
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
int ret;
uint32_t size;
uint32_t backup_handle;
if (req->multisample_count != 0)
return -EINVAL;
if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS)
return -EINVAL;
if (unlikely(vmw_user_surface_size == 0))
vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) +
128;
size = vmw_user_surface_size + 128;
/* Define a surface based on the parameters. */
ret = vmw_surface_gb_priv_define(dev,
size,
req->svga3d_flags,
req->format,
req->drm_surface_flags & drm_vmw_surface_flag_scanout,
req->mip_levels,
req->multisample_count,
req->array_size,
req->base_size,
&srf);
if (unlikely(ret != 0))
return ret;
user_srf = container_of(srf, struct vmw_user_surface, srf);
if (drm_is_primary_client(file_priv))
user_srf->master = drm_master_get(file_priv->master);
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
if (unlikely(ret != 0))
return ret;
res = &user_srf->srf.res;
if (req->buffer_handle != SVGA3D_INVALID_ID) {
ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle,
&res->backup,
&user_srf->backup_base);
if (ret == 0 && res->backup->base.num_pages * PAGE_SIZE <
res->backup_size) {
DRM_ERROR("Surface backup buffer is too small.\n");
vmw_dmabuf_unreference(&res->backup);
ret = -EINVAL;
goto out_unlock;
}
} else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer)
ret = vmw_user_dmabuf_alloc(dev_priv, tfile,
res->backup_size,
req->drm_surface_flags &
drm_vmw_surface_flag_shareable,
&backup_handle,
&res->backup,
&user_srf->backup_base);
if (unlikely(ret != 0)) {
vmw_resource_unreference(&res);
goto out_unlock;
}
tmp = vmw_resource_reference(res);
ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime,
req->drm_surface_flags &
drm_vmw_surface_flag_shareable,
VMW_RES_SURFACE,
&vmw_user_surface_base_release, NULL);
if (unlikely(ret != 0)) {
vmw_resource_unreference(&tmp);
vmw_resource_unreference(&res);
goto out_unlock;
}
rep->handle = user_srf->prime.base.hash.key;
rep->backup_size = res->backup_size;
if (res->backup) {
rep->buffer_map_handle =
drm_vma_node_offset_addr(&res->backup->base.vma_node);
rep->buffer_size = res->backup->base.num_pages * PAGE_SIZE;
rep->buffer_handle = backup_handle;
} else {
rep->buffer_map_handle = 0;
rep->buffer_size = 0;
rep->buffer_handle = SVGA3D_INVALID_ID;
}
vmw_resource_unreference(&res);
out_unlock:
ttm_read_unlock(&dev_priv->reservation_sem);
return ret;
}
| 1
|
423,213
|
*/
struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
struct rtnl_link_stats64 *storage)
{
const struct net_device_ops *ops = dev->netdev_ops;
if (ops->ndo_get_stats64) {
memset(storage, 0, sizeof(*storage));
ops->ndo_get_stats64(dev, storage);
} else if (ops->ndo_get_stats) {
netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev));
} else {
netdev_stats_to_stats64(storage, &dev->stats);
}
storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
return storage;
| 0
|
331,275
|
static void set_dirty_tracking(void)
{
BlkMigDevState *bmds;
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE);
}
}
| 1
|
51,186
|
static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct scatterlist *sg;
enum dma_data_direction dir;
BUG_ON(!ch);
BUG_ON(!ioctx);
BUG_ON(ioctx->n_rdma && !ioctx->rdma_wrs);
while (ioctx->n_rdma)
kfree(ioctx->rdma_wrs[--ioctx->n_rdma].wr.sg_list);
kfree(ioctx->rdma_wrs);
ioctx->rdma_wrs = NULL;
if (ioctx->mapped_sg_count) {
sg = ioctx->sg;
WARN_ON(!sg);
dir = ioctx->cmd.data_direction;
BUG_ON(dir == DMA_NONE);
ib_dma_unmap_sg(ch->sport->sdev->device, sg, ioctx->sg_cnt,
opposite_dma_dir(dir));
ioctx->mapped_sg_count = 0;
}
}
| 0
|
477,811
|
CImg<T>& operator-=(const t value) {
if (is_empty()) return *this;
cimg_openmp_for(*this,*ptr - value,524288);
return *this;
}
| 0
|
180,968
|
void InitializeSpdySsl() {
ssl_data_->SetNextProto(kProtoSPDY2);
}
| 0
|
510,275
|
my_decimal *Item_ref::val_decimal_result(my_decimal *decimal_value)
{
if (result_field)
{
if ((null_value= result_field->is_null()))
return 0;
return result_field->val_decimal(decimal_value);
}
return val_decimal(decimal_value);
}
| 0
|
475,660
|
static void nft_netdev_unregister_hooks(struct net *net,
struct list_head *hook_list)
{
struct nft_hook *hook;
list_for_each_entry(hook, hook_list, list)
nf_unregister_net_hook(net, &hook->ops);
}
| 0
|
68,003
|
static int handle_triple_fault(struct kvm_vcpu *vcpu)
{
vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
return 0;
}
| 0
|
477,478
|
static void tcf_block_owner_del(struct tcf_block *block,
struct Qdisc *q,
enum flow_block_binder_type binder_type)
{
struct tcf_block_owner_item *item;
list_for_each_entry(item, &block->owner_list, list) {
if (item->q == q && item->binder_type == binder_type) {
list_del(&item->list);
kfree(item);
return;
}
}
WARN_ON(1);
}
| 0
|
421,396
|
add_to_client(struct i915_request *rq, struct drm_file *file)
{
rq->file_priv = file->driver_priv;
list_add_tail(&rq->client_link, &rq->file_priv->mm.request_list);
}
| 0
|
380,026
|
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
bitwise_not_function(&EX_T(opline->result.u.var).tmp_var,
_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
| 0
|
360,033
|
nautilus_file_get_parent_location (NautilusFile *file)
{
g_assert (NAUTILUS_IS_FILE (file));
if (nautilus_file_is_self_owned (file)) {
/* Callers expect an empty string, not a NULL. */
return NULL;
}
return nautilus_directory_get_location (file->details->directory);
}
| 0
|
251,339
|
static void overloadedStaticMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedStaticMethod", "TestObjectPython", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 2)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
exceptionState.throwIfNeeded();
return;
}
V8TRYCATCH_EXCEPTION_VOID(int, longArg1, toInt32(info[0], exceptionState), exceptionState);
V8TRYCATCH_EXCEPTION_VOID(int, longArg2, toInt32(info[1], exceptionState), exceptionState);
TestObjectPython::overloadedStaticMethod(longArg1, longArg2);
}
| 0
|
415,860
|
bool switch_to_ns(pid_t pid, const char *ns) {
int fd, ret;
char nspath[MAXPATHLEN];
/* Switch to new ns */
ret = snprintf(nspath, MAXPATHLEN, "/proc/%d/ns/%s", pid, ns);
if (ret < 0 || ret >= MAXPATHLEN)
return false;
fd = open(nspath, O_RDONLY);
if (fd < 0) {
SYSERROR("Failed to open %s", nspath);
return false;
}
ret = setns(fd, 0);
if (ret) {
SYSERROR("Failed to set process %d to %s of %d.", pid, ns, fd);
close(fd);
return false;
}
close(fd);
return true;
}
| 0
|
298,494
|
bool ValidateARIA()
{
std::cout << "\nARIA validation suite running...\n\n";
bool pass1 = true, pass2 = true, pass3 = true;
ARIAEncryption enc;
pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1;
pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1;
pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1;
pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1;
pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1;
pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1;
pass1 = enc.StaticGetValidKeyLength(0) == enc.MinKeyLength() && pass1;
pass1 = enc.StaticGetValidKeyLength(SIZE_MAX) == enc.MaxKeyLength() && pass1;
ARIADecryption dec;
pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2;
pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2;
pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2;
pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2;
pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2;
pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2;
pass2 = dec.StaticGetValidKeyLength(0) == dec.MinKeyLength() && pass2;
pass2 = dec.StaticGetValidKeyLength(SIZE_MAX) == dec.MaxKeyLength() && pass2;
std::cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";
FileSource valdata(CRYPTOPP_DATA_DIR "TestData/aria.dat", true, new HexDecoder);
pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(16), valdata, 15) && pass3;
pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(24), valdata, 15) && pass3;
pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(32), valdata, 15) && pass3;
return pass1 && pass2 && pass3;
}
| 0
|
107,957
|
static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
{
struct vm_area_struct *mpnt, *tmp, *prev, **pprev;
struct rb_node **rb_link, *rb_parent;
int retval;
unsigned long charge;
struct mempolicy *pol;
uprobe_start_dup_mmap();
down_write(&oldmm->mmap_sem);
flush_cache_dup_mm(oldmm);
uprobe_dup_mmap(oldmm, mm);
/*
* Not linked in yet - no deadlock potential:
*/
down_write_nested(&mm->mmap_sem, SINGLE_DEPTH_NESTING);
mm->locked_vm = 0;
mm->mmap = NULL;
mm->mmap_cache = NULL;
mm->free_area_cache = oldmm->mmap_base;
mm->cached_hole_size = ~0UL;
mm->map_count = 0;
cpumask_clear(mm_cpumask(mm));
mm->mm_rb = RB_ROOT;
rb_link = &mm->mm_rb.rb_node;
rb_parent = NULL;
pprev = &mm->mmap;
retval = ksm_fork(mm, oldmm);
if (retval)
goto out;
retval = khugepaged_fork(mm, oldmm);
if (retval)
goto out;
prev = NULL;
for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
struct file *file;
if (mpnt->vm_flags & VM_DONTCOPY) {
vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
-vma_pages(mpnt));
continue;
}
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned long len = vma_pages(mpnt);
if (security_vm_enough_memory_mm(oldmm, len)) /* sic */
goto fail_nomem;
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
if (!tmp)
goto fail_nomem;
*tmp = *mpnt;
INIT_LIST_HEAD(&tmp->anon_vma_chain);
pol = mpol_dup(vma_policy(mpnt));
retval = PTR_ERR(pol);
if (IS_ERR(pol))
goto fail_nomem_policy;
vma_set_policy(tmp, pol);
tmp->vm_mm = mm;
if (anon_vma_fork(tmp, mpnt))
goto fail_nomem_anon_vma_fork;
tmp->vm_flags &= ~VM_LOCKED;
tmp->vm_next = tmp->vm_prev = NULL;
file = tmp->vm_file;
if (file) {
struct inode *inode = file_inode(file);
struct address_space *mapping = file->f_mapping;
get_file(file);
if (tmp->vm_flags & VM_DENYWRITE)
atomic_dec(&inode->i_writecount);
mutex_lock(&mapping->i_mmap_mutex);
if (tmp->vm_flags & VM_SHARED)
mapping->i_mmap_writable++;
flush_dcache_mmap_lock(mapping);
/* insert tmp into the share list, just after mpnt */
if (unlikely(tmp->vm_flags & VM_NONLINEAR))
vma_nonlinear_insert(tmp,
&mapping->i_mmap_nonlinear);
else
vma_interval_tree_insert_after(tmp, mpnt,
&mapping->i_mmap);
flush_dcache_mmap_unlock(mapping);
mutex_unlock(&mapping->i_mmap_mutex);
}
/*
* Clear hugetlb-related page reserves for children. This only
* affects MAP_PRIVATE mappings. Faults generated by the child
* are not guaranteed to succeed, even if read-only
*/
if (is_vm_hugetlb_page(tmp))
reset_vma_resv_huge_pages(tmp);
/*
* Link in the new vma and copy the page table entries.
*/
*pprev = tmp;
pprev = &tmp->vm_next;
tmp->vm_prev = prev;
prev = tmp;
__vma_link_rb(mm, tmp, rb_link, rb_parent);
rb_link = &tmp->vm_rb.rb_right;
rb_parent = &tmp->vm_rb;
mm->map_count++;
retval = copy_page_range(mm, oldmm, mpnt);
if (tmp->vm_ops && tmp->vm_ops->open)
tmp->vm_ops->open(tmp);
if (retval)
goto out;
}
/* a new mm has just been created */
arch_dup_mmap(oldmm, mm);
retval = 0;
out:
up_write(&mm->mmap_sem);
flush_tlb_mm(oldmm);
up_write(&oldmm->mmap_sem);
uprobe_end_dup_mmap();
return retval;
fail_nomem_anon_vma_fork:
mpol_put(pol);
fail_nomem_policy:
kmem_cache_free(vm_area_cachep, tmp);
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
goto out;
}
| 0
|
509,941
|
TIFFjpeg_alloc_sarray(JPEGState* sp, int pool_id,
JDIMENSION samplesperrow, JDIMENSION numrows)
{
return CALLJPEG(sp, (JSAMPARRAY) NULL,
(*sp->cinfo.comm.mem->alloc_sarray)
(&sp->cinfo.comm, pool_id, samplesperrow, numrows));
}
| 0
|
202,809
|
static void calc_matrix(double mat[4][4], const double *mat_freq, const int *index)
{
for (int i = 0; i < 4; ++i) {
mat[i][i] = mat_freq[2 * index[i]] + 3 * mat_freq[0] - 4 * mat_freq[index[i]];
for (int j = i + 1; j < 4; ++j)
mat[i][j] = mat[j][i] =
mat_freq[index[i] + index[j]] + mat_freq[index[j] - index[i]] +
2 * (mat_freq[0] - mat_freq[index[i]] - mat_freq[index[j]]);
}
for (int k = 0; k < 4; ++k) {
int ip = k, jp = k; // pivot
double z = 1 / mat[ip][jp];
mat[ip][jp] = 1;
for (int i = 0; i < 4; ++i) {
if (i == ip)
continue;
double mul = mat[i][jp] * z;
mat[i][jp] = 0;
for (int j = 0; j < 4; ++j)
mat[i][j] -= mat[ip][j] * mul;
}
for (int j = 0; j < 4; ++j)
mat[ip][j] *= z;
}
}
| 0
|
259,264
|
static inline void blk_pm_put_request(struct request *rq) {}
| 0
|
426,605
|
int pn_ssl_domain_set_protocols(pn_ssl_domain_t *domain, const char *protocols)
{
static const struct {
const char *name;
const long option;
} protocol_options[] =
{
{"TLSv1", SSL_OP_NO_TLSv1},
{"TLSv1.1", SSL_OP_NO_TLSv1_1},
{"TLSv1.2", SSL_OP_NO_TLSv1_2},
#ifdef SSL_OP_NO_TLSv1_3
{"TLSv1.3", SSL_OP_NO_TLSv1_3},
#endif
};
static const char seps[] = " ,;";
static const long all_prots =
SSL_OP_NO_TLSv1
| SSL_OP_NO_TLSv1_1
| SSL_OP_NO_TLSv1_2
#ifdef SSL_OP_NO_TLSv1_3
| SSL_OP_NO_TLSv1_3
#endif
;
// Start with all protocols turned off
long options = all_prots;
// For each separate token in protocols
const char *token = protocols;
while (*token!=0) {
// Find next separator
size_t tsize = strcspn(token, seps);
while (tsize==0 && *token!=0) {
++token;
tsize = strcspn(token, seps);
}
if (tsize==0) break; // No more tokens
// Linear search the possibilities for the option to set
for (size_t i = 0; i<sizeof(protocol_options)/sizeof(*protocol_options); ++i) {
if (strncmp(token, protocol_options[i].name, tsize)==0) {
options &= ~protocol_options[i].option;
goto found;
}
}
// Didn't find any match - error
return PN_ARG_ERR;
found:
token += tsize;
}
// Check if we found anything
if (options==all_prots) return PN_ARG_ERR;
SSL_CTX_clear_options(domain->ctx, all_prots);
SSL_CTX_set_options(domain->ctx, options);
return 0;
}
| 0
|
234,055
|
void VideoCaptureManager::OnDeviceLaunchAborted() {
EmitLogMessage("Launching device has been aborted.", 1);
device_start_request_queue_.pop_front();
ProcessDeviceStartRequestQueue();
}
| 0
|
364,130
|
void rfbScheduleCopyRect(rfbScreenInfoPtr screen,int x1,int y1,int x2,int y2,int dx,int dy)
{
sraRegionPtr region = sraRgnCreateRect(x1,y1,x2,y2);
rfbScheduleCopyRegion(screen,region,dx,dy);
sraRgnDestroy(region);
}
| 0
|
271,844
|
//! Compute Haar multiscale wavelet transform \newinstance.
CImg<Tfloat> get_haar(const bool invert=false, const unsigned int nb_scales=1) const {
CImg<Tfloat> res;
if (nb_scales==1) { // Single scale transform
if (_width>1) get_haar('x',invert,1).move_to(res);
if (_height>1) { if (res) res.haar('y',invert,1); else get_haar('y',invert,1).move_to(res); }
if (_depth>1) { if (res) res.haar('z',invert,1); else get_haar('z',invert,1).move_to(res); }
if (res) return res;
} else { // Multi-scale transform
if (invert) { // Inverse transform
res.assign(*this,false);
if (_width>1) {
if (_height>1) {
if (_depth>1) {
unsigned int w = _width, h = _height, d = _depth;
for (unsigned int s = 1; w && h && d && s<nb_scales; ++s) { w/=2; h/=2; d/=2; }
for (w = w?w:1, h = h?h:1, d = d?d:1; w<=_width && h<=_height && d<=_depth; w*=2, h*=2, d*=2)
res.draw_image(res.get_crop(0,0,0,w - 1,h - 1,d - 1).get_haar(true,1));
} else {
unsigned int w = _width, h = _height;
for (unsigned int s = 1; w && h && s<nb_scales; ++s) { w/=2; h/=2; }
for (w = w?w:1, h = h?h:1; w<=_width && h<=_height; w*=2, h*=2)
res.draw_image(res.get_crop(0,0,0,w - 1,h - 1,0).get_haar(true,1));
}
} else {
if (_depth>1) {
unsigned int w = _width, d = _depth;
for (unsigned int s = 1; w && d && s<nb_scales; ++s) { w/=2; d/=2; }
for (w = w?w:1, d = d?d:1; w<=_width && d<=_depth; w*=2, d*=2)
res.draw_image(res.get_crop(0,0,0,w - 1,0,d - 1).get_haar(true,1));
} else {
unsigned int w = _width;
for (unsigned int s = 1; w && s<nb_scales; ++s) w/=2;
for (w = w?w:1; w<=_width; w*=2)
res.draw_image(res.get_crop(0,0,0,w - 1,0,0).get_haar(true,1));
}
}
} else {
if (_height>1) {
if (_depth>1) {
unsigned int h = _height, d = _depth;
for (unsigned int s = 1; h && d && s<nb_scales; ++s) { h/=2; d/=2; }
for (h = h?h:1, d = d?d:1; h<=_height && d<=_depth; h*=2, d*=2)
res.draw_image(res.get_crop(0,0,0,0,h - 1,d - 1).get_haar(true,1));
} else {
unsigned int h = _height;
for (unsigned int s = 1; h && s<nb_scales; ++s) h/=2;
for (h = h?h:1; h<=_height; h*=2)
res.draw_image(res.get_crop(0,0,0,0,h - 1,0).get_haar(true,1));
}
} else {
if (_depth>1) {
unsigned int d = _depth;
for (unsigned int s = 1; d && s<nb_scales; ++s) d/=2;
for (d = d?d:1; d<=_depth; d*=2)
res.draw_image(res.get_crop(0,0,0,0,0,d - 1).get_haar(true,1));
} else return *this;
}
}
} else { // Direct transform
res = get_haar(false,1);
if (_width>1) {
if (_height>1) {
if (_depth>1)
for (unsigned int s = 1, w = _width/2, h = _height/2, d = _depth/2; w && h && d && s<nb_scales;
++s, w/=2, h/=2, d/=2)
res.draw_image(res.get_crop(0,0,0,w - 1,h - 1,d - 1).haar(false,1));
else for (unsigned int s = 1, w = _width/2, h = _height/2; w && h && s<nb_scales; ++s, w/=2, h/=2)
res.draw_image(res.get_crop(0,0,0,w - 1,h - 1,0).haar(false,1));
} else {
if (_depth>1) for (unsigned int s = 1, w = _width/2, d = _depth/2; w && d && s<nb_scales; ++s, w/=2, d/=2)
res.draw_image(res.get_crop(0,0,0,w - 1,0,d - 1).haar(false,1));
else for (unsigned int s = 1, w = _width/2; w && s<nb_scales; ++s, w/=2)
res.draw_image(res.get_crop(0,0,0,w - 1,0,0).haar(false,1));
}
} else {
if (_height>1) {
if (_depth>1)
for (unsigned int s = 1, h = _height/2, d = _depth/2; h && d && s<nb_scales; ++s, h/=2, d/=2)
res.draw_image(res.get_crop(0,0,0,0,h - 1,d - 1).haar(false,1));
else for (unsigned int s = 1, h = _height/2; h && s<nb_scales; ++s, h/=2)
res.draw_image(res.get_crop(0,0,0,0,h - 1,0).haar(false,1));
} else {
if (_depth>1) for (unsigned int s = 1, d = _depth/2; d && s<nb_scales; ++s, d/=2)
res.draw_image(res.get_crop(0,0,0,0,0,d - 1).haar(false,1));
else return *this;
}
}
}
return res;
}
return *this;
| 0
|
172,774
|
bool deleteFile(const String& path)
{
String filename = path;
return !!DeleteFileW(filename.charactersWithNullTermination());
}
| 0
|
32,614
|
TEST_P(DownstreamProtocolIntegrationTest, MissingHeadersLocalReplyWithBody) {
useAccessLog("%RESPONSE_CODE_DETAILS%");
config_helper_.prependFilter("{ name: invalid-header-filter, typed_config: { \"@type\": "
"type.googleapis.com/google.protobuf.Empty } }");
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));
// Missing method
auto response =
codec_client_->makeRequestWithBody(Http::TestRequestHeaderMapImpl{{":method", "GET"},
{":path", "/test/long/url"},
{":scheme", "http"},
{":authority", "host"},
{"remove-method", "yes"},
{"send-reply", "yes"}},
1024);
ASSERT_TRUE(response->waitForEndStream());
EXPECT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().getStatusValue());
EXPECT_THAT(waitForAccessLog(access_log_name_), HasSubstr("invalid_header_filter_ready\n"));
}
| 0
|
378,510
|
static int Adapter_run(AdapterObject *self, PyObject *object)
{
PyObject *vars = NULL;
PyObject *start = NULL;
PyObject *args = NULL;
PyObject *iterator = NULL;
PyObject *close = NULL;
const char *msg = NULL;
int length = 0;
#if defined(MOD_WSGI_WITH_DAEMONS)
if (wsgi_inactivity_timeout) {
apr_thread_mutex_lock(wsgi_shutdown_lock);
wsgi_inactivity_shutdown_time = apr_time_now();
wsgi_inactivity_shutdown_time += wsgi_inactivity_timeout;
apr_thread_mutex_unlock(wsgi_shutdown_lock);
}
#endif
vars = Adapter_environ(self);
start = PyObject_GetAttrString((PyObject *)self, "start_response");
args = Py_BuildValue("(OO)", vars, start);
self->sequence = PyEval_CallObject(object, args);
if (self->sequence != NULL) {
if (!Adapter_process_file_wrapper(self)) {
int aborted = 0;
iterator = PyObject_GetIter(self->sequence);
if (iterator != NULL) {
PyObject *item = NULL;
while ((item = PyIter_Next(iterator))) {
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_Check(item)) {
PyObject *latin_item;
latin_item = PyUnicode_AsLatin1String(item);
if (!latin_item) {
PyErr_Format(PyExc_TypeError, "sequence of "
"byte string values expected, value "
"containing non 'latin-1' characters "
"found");
Py_DECREF(item);
break;
}
Py_DECREF(item);
item = latin_item;
}
#endif
if (!PyString_Check(item)) {
PyErr_Format(PyExc_TypeError, "sequence of byte "
"string values expected, value of "
"type %.200s found",
item->ob_type->tp_name);
Py_DECREF(item);
break;
}
msg = PyString_AsString(item);
length = PyString_Size(item);
if (!msg) {
Py_DECREF(item);
break;
}
if (length && !Adapter_output(self, msg, length, 0)) {
if (!PyErr_Occurred())
aborted = 1;
Py_DECREF(item);
break;
}
Py_DECREF(item);
}
}
if (!PyErr_Occurred() && !aborted) {
if (Adapter_output(self, "", 0, 0))
self->result = OK;
}
Py_XDECREF(iterator);
}
/*
* Log warning if more response content generated than was
* indicated, or less if there was no errors generated by
* the application.
*/
if (self->content_length_set && ((!PyErr_Occurred() &&
self->output_length != self->content_length) ||
(self->output_length > self->content_length))) {
ap_log_rerror(APLOG_MARK, WSGI_LOG_DEBUG(0), self->r,
"mod_wsgi (pid=%d): Content length mismatch, "
"expected %s, response generated %s: %s", getpid(),
apr_off_t_toa(self->r->pool, self->content_length),
apr_off_t_toa(self->r->pool, self->output_length),
self->r->filename);
}
if (PyErr_Occurred()) {
/*
* Response content has already been sent, so cannot
* return an internal server error as Apache will
* append its own error page. Thus need to return OK
* and just truncate the response.
*/
if (self->status_line && !self->headers)
self->result = OK;
wsgi_log_python_error(self->r, self->log, self->r->filename);
}
if (PyObject_HasAttrString(self->sequence, "close")) {
PyObject *args = NULL;
PyObject *data = NULL;
close = PyObject_GetAttrString(self->sequence, "close");
args = Py_BuildValue("()");
data = PyEval_CallObject(close, args);
Py_DECREF(args);
Py_XDECREF(data);
Py_DECREF(close);
}
if (PyErr_Occurred())
wsgi_log_python_error(self->r, self->log, self->r->filename);
Py_DECREF(self->sequence);
self->sequence = NULL;
}
Py_DECREF(args);
Py_DECREF(start);
Py_DECREF(vars);
/* Log details of any final Python exceptions. */
if (PyErr_Occurred())
wsgi_log_python_error(self->r, self->log, self->r->filename);
/*
* If result indicates an internal server error, then
* replace the status line in the request object else
* that provided by the application will be what is used
* in any error page automatically generated by Apache.
*/
if (self->result == HTTP_INTERNAL_SERVER_ERROR)
self->r->status_line = "500 Internal Server Error";
return self->result;
}
| 0
|
265,516
|
static void ParaNdis_RemoveDriverOKStatus(PPARANDIS_ADAPTER pContext )
{
VirtIODeviceRemoveStatus(pContext->IODevice, VIRTIO_CONFIG_S_DRIVER_OK);
KeMemoryBarrier();
pContext->bDeviceInitialized = FALSE;
}
| 0
|
442,247
|
applyLut (const unsigned short lut[USHORT_RANGE],
unsigned short data[/*nData*/],
int nData)
{
for (int i = 0; i < nData; ++i)
data[i] = lut[data[i]];
}
| 0
|
503,979
|
static void *_sqlite_open(char *host __attribute__((unused)),
char *port __attribute__((unused)),
int usessl __attribute__((unused)),
const char *user __attribute__((unused)),
const char *password __attribute__((unused)),
const char *database, const sasl_utils_t *utils)
{
int rc;
sqlite *db;
char *zErrMsg = NULL;
db = sqlite_open(database, 0, &zErrMsg);
if (db == NULL) {
utils->log(utils->conn, SASL_LOG_ERR, "sql plugin: %s", zErrMsg);
sqlite_freemem (zErrMsg);
return NULL;
}
rc = sqlite_exec(db, "PRAGMA empty_result_callbacks = ON", NULL, NULL, &zErrMsg);
if (rc != SQLITE_OK) {
utils->log(utils->conn, SASL_LOG_ERR, "sql plugin: %s", zErrMsg);
sqlite_freemem (zErrMsg);
sqlite_close(db);
return NULL;
}
return (void*)db;
}
| 0
|
156,316
|
test_asnprintf ()
{
test_function (asnprintf);
}
| 0
|
480,771
|
static int kgdb_io_ready(int print_wait)
{
if (!dbg_io_ops)
return 0;
if (kgdb_connected)
return 1;
if (atomic_read(&kgdb_setting_breakpoint))
return 1;
if (print_wait) {
#ifdef CONFIG_KGDB_KDB
if (!dbg_kdb_mode)
pr_crit("waiting... or $3#33 for KDB\n");
#else
pr_crit("Waiting for remote debugger\n");
#endif
}
return 1;
}
| 0
|
57,022
|
nghttp2_stream *nghttp2_session_find_stream(nghttp2_session *session,
int32_t stream_id) {
if (stream_id == 0) {
return &session->root;
}
return nghttp2_session_get_stream_raw(session, stream_id);
}
| 0
|
193,225
|
png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size)
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp; /* to save current jump buffer */
#endif
int i = 0;
png_structp png_ptr=*ptr_ptr;
if (png_ptr == NULL)
return;
do
{
if (user_png_ver == NULL || user_png_ver[i] != png_libpng_ver[i])
{
#ifdef PNG_LEGACY_SUPPORTED
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else
png_ptr->warning_fn = NULL;
png_warning(png_ptr,
"Application uses deprecated png_read_init() and should be"
" recompiled.");
break;
#endif
}
} while (png_libpng_ver[i++]);
png_debug(1, "in png_read_init_3");
#ifdef PNG_SETJMP_SUPPORTED
/* Save jump buffer and error functions */
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
#endif
if (png_sizeof(png_struct) > png_struct_size)
{
png_destroy_struct(png_ptr);
*ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
png_ptr = *ptr_ptr;
}
/* Reset all variables to 0 */
png_memset(png_ptr, 0, png_sizeof(png_struct));
#ifdef PNG_SETJMP_SUPPORTED
/* Restore jump buffer */
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
#endif
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = (voidpf)png_ptr;
switch (inflateInit(&png_ptr->zstream))
{
case Z_OK: /* Do nothing */ break;
case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break;
case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error");
break;
default: png_error(png_ptr, "Unknown zlib error");
}
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
}
| 0
|
181,054
|
ofpact_is_set_or_move_action(const struct ofpact *a)
{
switch (a->type) {
case OFPACT_SET_FIELD:
case OFPACT_REG_MOVE:
case OFPACT_SET_ETH_DST:
case OFPACT_SET_ETH_SRC:
case OFPACT_SET_IP_DSCP:
case OFPACT_SET_IP_ECN:
case OFPACT_SET_IP_TTL:
case OFPACT_SET_IPV4_DST:
case OFPACT_SET_IPV4_SRC:
case OFPACT_SET_L4_DST_PORT:
case OFPACT_SET_L4_SRC_PORT:
case OFPACT_SET_MPLS_LABEL:
case OFPACT_SET_MPLS_TC:
case OFPACT_SET_MPLS_TTL:
case OFPACT_SET_QUEUE:
case OFPACT_SET_TUNNEL:
case OFPACT_SET_VLAN_PCP:
case OFPACT_SET_VLAN_VID:
return true;
case OFPACT_BUNDLE:
case OFPACT_CLEAR_ACTIONS:
case OFPACT_CT:
case OFPACT_CT_CLEAR:
case OFPACT_CLONE:
case OFPACT_NAT:
case OFPACT_CONTROLLER:
case OFPACT_DEC_MPLS_TTL:
case OFPACT_DEC_TTL:
case OFPACT_ENQUEUE:
case OFPACT_EXIT:
case OFPACT_UNROLL_XLATE:
case OFPACT_FIN_TIMEOUT:
case OFPACT_GOTO_TABLE:
case OFPACT_GROUP:
case OFPACT_LEARN:
case OFPACT_CONJUNCTION:
case OFPACT_METER:
case OFPACT_MULTIPATH:
case OFPACT_NOTE:
case OFPACT_OUTPUT:
case OFPACT_OUTPUT_REG:
case OFPACT_OUTPUT_TRUNC:
case OFPACT_POP_MPLS:
case OFPACT_POP_QUEUE:
case OFPACT_PUSH_MPLS:
case OFPACT_PUSH_VLAN:
case OFPACT_RESUBMIT:
case OFPACT_SAMPLE:
case OFPACT_STACK_POP:
case OFPACT_STACK_PUSH:
case OFPACT_STRIP_VLAN:
case OFPACT_WRITE_ACTIONS:
case OFPACT_WRITE_METADATA:
case OFPACT_DEBUG_RECIRC:
return false;
default:
OVS_NOT_REACHED();
}
}
| 0
|
431,131
|
static Status _extractRoleDocumentElements(const BSONObj& roleObject,
BSONElement* roleNameElement,
BSONElement* roleSourceElement) {
*roleNameElement = roleObject[ROLE_NAME_FIELD_NAME];
*roleSourceElement = roleObject[ROLE_DB_FIELD_NAME];
if (roleNameElement->type() != String || roleNameElement->valueStringData().empty()) {
return Status(ErrorCodes::UnsupportedFormat, "Role names must be non-empty strings");
}
if (roleSourceElement->type() != String || roleSourceElement->valueStringData().empty()) {
return Status(ErrorCodes::UnsupportedFormat, "Role db must be non-empty strings");
}
return Status::OK();
}
| 0
|
458,439
|
handle_alg_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx,
struct dp_packet *pkt, enum ct_alg_ctl_type ct_alg_ctl,
struct conn *conn, long long now, bool nat)
{
/* ALG control packet handling with expectation creation. */
if (OVS_UNLIKELY(alg_helpers[ct_alg_ctl] && conn && conn->alg)) {
ovs_mutex_lock(&conn->lock);
alg_helpers[ct_alg_ctl](ct, ctx, pkt, conn, now, CT_FTP_CTL_INTEREST,
nat);
ovs_mutex_unlock(&conn->lock);
}
}
| 0
|
419,674
|
static int get_process_ns(pid_t pid, const char *namespace, ino_t *ns) {
const char *p;
struct stat stbuf;
_cleanup_close_ int proc_ns_dir_fd;
p = procfs_file_alloca(pid, "ns");
proc_ns_dir_fd = open(p, O_DIRECTORY | O_CLOEXEC | O_RDONLY);
if (proc_ns_dir_fd < 0)
return -errno;
if (fstatat(proc_ns_dir_fd, namespace, &stbuf, /* flags */0) < 0)
return -errno;
*ns = stbuf.st_ino;
return 0;
}
| 0
|
478,377
|
CImg<T>& set_matrix_at(const CImg<t>& mat, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) {
return set_vector_at(mat,x,y,z);
}
| 0
|
349,635
|
main (int argc,
char *argv[])
{
int ret;
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/");
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
g_assert_true (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 0);
g_test_add ("/tls/" BACKEND "/connection/basic", TestConnection, NULL,
setup_connection, test_basic_connection, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified", TestConnection, NULL,
setup_connection, test_verified_connection, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified-chain", TestConnection, NULL,
setup_connection, test_verified_chain, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified-chain-with-redundant-root-cert", TestConnection, NULL,
setup_connection, test_verified_chain_with_redundant_root_cert, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified-chain-with-duplicate-server-cert", TestConnection, NULL,
setup_connection, test_verified_chain_with_duplicate_server_cert, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified-unordered-chain", TestConnection, NULL,
setup_connection, test_verified_unordered_chain, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/verified-chain-with-alternative-ca-cert", TestConnection, NULL,
setup_connection, test_verified_chain_with_alternative_ca_cert, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/invalid-chain-with-alternative-ca-cert", TestConnection, NULL,
setup_connection, test_invalid_chain_with_alternative_ca_cert, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth", TestConnection, NULL,
setup_connection, test_client_auth_connection, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-rehandshake", TestConnection, NULL,
setup_connection, test_client_auth_rehandshake, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-failure", TestConnection, NULL,
setup_connection, test_client_auth_failure, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-fail-missing-client-private-key", TestConnection, NULL,
setup_connection, test_client_auth_fail_missing_client_private_key, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-request-cert", TestConnection, NULL,
setup_connection, test_client_auth_request_cert, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-request-fail", TestConnection, NULL,
setup_connection, test_client_auth_request_fail, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/client-auth-request-none", TestConnection, NULL,
setup_connection, test_client_auth_request_none, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/no-database", TestConnection, NULL,
setup_connection, test_connection_no_database, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/failed", TestConnection, NULL,
setup_connection, test_failed_connection, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/socket-client", TestConnection, NULL,
setup_connection, test_connection_socket_client, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/socket-client-failed", TestConnection, NULL,
setup_connection, test_connection_socket_client_failed, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/read-time-out-then-write", TestConnection, NULL,
setup_connection, test_connection_read_time_out_write, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/simultaneous-async", TestConnection, NULL,
setup_connection, test_simultaneous_async, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/simultaneous-sync", TestConnection, NULL,
setup_connection, test_simultaneous_sync, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/simultaneous-async-rehandshake", TestConnection, NULL,
setup_connection, test_simultaneous_async_rehandshake, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/simultaneous-sync-rehandshake", TestConnection, NULL,
setup_connection, test_simultaneous_sync_rehandshake, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/close-immediately", TestConnection, NULL,
setup_connection, test_close_immediately, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/unclean-close-by-server", TestConnection, NULL,
setup_connection, test_unclean_close_by_server, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/async-implicit-handshake", TestConnection, NULL,
setup_connection, test_async_implicit_handshake, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/output-stream-close", TestConnection, NULL,
setup_connection, test_output_stream_close, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/fallback", TestConnection, NULL,
setup_connection, test_fallback, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/garbage-database", TestConnection, NULL,
setup_connection, test_garbage_database, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/readwrite-after-connection-destroyed", TestConnection, NULL,
setup_connection, test_readwrite_after_connection_destroyed, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/alpn/match", TestConnection, NULL,
setup_connection, test_alpn_match, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/alpn/no-match", TestConnection, NULL,
setup_connection, test_alpn_no_match, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/alpn/client-only", TestConnection, NULL,
setup_connection, test_alpn_client_only, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/alpn/server-only", TestConnection, NULL,
setup_connection, test_alpn_server_only, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/sync-op-during-handshake", TestConnection, NULL,
setup_connection, test_sync_op_during_handshake, teardown_connection);
g_test_add ("/tls/" BACKEND "/connection/socket-timeout", TestConnection, NULL,
setup_connection, test_socket_timeout, teardown_connection);
ret = g_test_run ();
/* for valgrinding */
g_main_context_unref (g_main_context_default ());
return ret;
}
| 1
|
486,764
|
void KrecipesView::translate()
{
button0->setTitle( i18n( "Find/Edit Recipes" ) );
button1->setTitle( i18n( "Shopping List" ) );
button2->setTitle( i18n( "Ingredients" ) );
button3->setTitle( i18n( "Properties" ) );
button4->setTitle( i18n( "Units" ) );
button9->setTitle( i18n( "Preparation Methods" ) );
button5->setTitle( i18n( "Categories" ) );
button6->setTitle( i18n( "Authors" ) );
button7->setTitle( i18n( "Diet Helper" ) );
button8->setTitle( i18n( "Ingredient Matcher" ) );
}
| 0
|
58,775
|
crm_initiate_client_tls_handshake(void *session_data, int timeout_ms)
{
int rc = 0;
int pollrc = 0;
time_t start = time(NULL);
gnutls_session *session = session_data;
do {
rc = gnutls_handshake(*session);
if (rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN) {
pollrc = crm_recv_remote_ready(session, TRUE, 1000);
if (pollrc < 0) {
/* poll returned error, there is no hope */
rc = -1;
}
}
} while (((time(NULL) - start) < (timeout_ms/1000)) &&
(rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN));
return rc;
}
| 0
|
239,673
|
GDataEntry* GDataDirectoryService::FindEntryByPathSync(
const FilePath& file_path) {
if (file_path == root_->GetFilePath())
return root_.get();
std::vector<FilePath::StringType> components;
file_path.GetComponents(&components);
GDataDirectory* current_dir = root_.get();
for (size_t i = 1; i < components.size() && current_dir; ++i) {
GDataEntry* entry = current_dir->FindChild(components[i]);
if (!entry)
return NULL;
if (i == components.size() - 1) // Last component.
return entry;
else
current_dir = entry->AsGDataDirectory();
}
return NULL;
}
| 0
|
456,457
|
static inline int vt_unbind(struct con_driver *con)
{
return 0;
}
| 0
|
517,792
|
Field *find_field_in_table_sef(TABLE *table, const char *name)
{
Field **field_ptr;
if (table->s->name_hash.records)
{
field_ptr= (Field**)my_hash_search(&table->s->name_hash,(uchar*) name,
strlen(name));
if (field_ptr)
{
/*
field_ptr points to field in TABLE_SHARE. Convert it to the matching
field in table
*/
field_ptr= (table->field + (field_ptr - table->s->field));
}
}
else
{
if (!(field_ptr= table->field))
return (Field *)0;
for (; *field_ptr; ++field_ptr)
if (!my_strcasecmp(system_charset_info, (*field_ptr)->field_name.str,
name))
break;
}
if (field_ptr)
return *field_ptr;
else
return (Field *)0;
}
| 0
|
390,440
|
X509::X509(const char* i, size_t iSz, const char* s, size_t sSz,
const char* b, int bSz, const char* a, int aSz, int issPos,
int issLen, int subPos, int subLen)
: issuer_(i, iSz, issPos, issLen), subject_(s, sSz, subPos, subLen),
beforeDate_(b, bSz), afterDate_(a, aSz)
{}
| 0
|
70,000
|
qboolean CL_ConnectedToRemoteServer( void ) {
return (qboolean)( com_sv_running && !com_sv_running->integer && cls.state >= CA_CONNECTED && !clc.demoplaying );
}
| 0
|
160,071
|
int MDSDaemon::_handle_command(
const cmdmap_t &cmdmap,
MCommand *m,
bufferlist *outbl,
std::string *outs,
Context **run_later,
bool *need_reply)
{
assert(outbl != NULL);
assert(outs != NULL);
class SuicideLater : public Context
{
MDSDaemon *mds;
public:
explicit SuicideLater(MDSDaemon *mds_) : mds(mds_) {}
void finish(int r) override {
// Wait a little to improve chances of caller getting
// our response before seeing us disappear from mdsmap
sleep(1);
mds->suicide();
}
};
class RespawnLater : public Context
{
MDSDaemon *mds;
public:
explicit RespawnLater(MDSDaemon *mds_) : mds(mds_) {}
void finish(int r) override {
// Wait a little to improve chances of caller getting
// our response before seeing us disappear from mdsmap
sleep(1);
mds->respawn();
}
};
std::stringstream ds;
std::stringstream ss;
std::string prefix;
std::string format;
std::unique_ptr<Formatter> f(Formatter::create(format));
cmd_getval(cct, cmdmap, "prefix", prefix);
int r = 0;
if (prefix == "get_command_descriptions") {
int cmdnum = 0;
std::unique_ptr<JSONFormatter> f(ceph::make_unique<JSONFormatter>());
f->open_object_section("command_descriptions");
for (MDSCommand *cp = mds_commands;
cp < &mds_commands[ARRAY_SIZE(mds_commands)]; cp++) {
ostringstream secname;
secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
dump_cmddesc_to_json(f.get(), secname.str(), cp->cmdstring, cp->helpstring,
cp->module, cp->perm, cp->availability, 0);
cmdnum++;
}
f->close_section(); // command_descriptions
f->flush(ds);
goto out;
}
cmd_getval(cct, cmdmap, "format", format);
if (prefix == "version") {
if (f) {
f->open_object_section("version");
f->dump_string("version", pretty_version_to_str());
f->close_section();
f->flush(ds);
} else {
ds << pretty_version_to_str();
}
} else if (prefix == "injectargs") {
vector<string> argsvec;
cmd_getval(cct, cmdmap, "injected_args", argsvec);
if (argsvec.empty()) {
r = -EINVAL;
ss << "ignoring empty injectargs";
goto out;
}
string args = argsvec.front();
for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a)
args += " " + *a;
r = cct->_conf->injectargs(args, &ss);
} else if (prefix == "config set") {
std::string key;
cmd_getval(cct, cmdmap, "key", key);
std::string val;
cmd_getval(cct, cmdmap, "value", val);
r = cct->_conf->set_val(key, val, true, &ss);
if (r == 0) {
cct->_conf->apply_changes(nullptr);
}
} else if (prefix == "exit") {
// We will send response before executing
ss << "Exiting...";
*run_later = new SuicideLater(this);
} else if (prefix == "respawn") {
// We will send response before executing
ss << "Respawning...";
*run_later = new RespawnLater(this);
} else if (prefix == "session kill") {
if (mds_rank == NULL) {
r = -EINVAL;
ss << "MDS not active";
goto out;
}
// FIXME harmonize `session kill` with admin socket session evict
int64_t session_id = 0;
bool got = cmd_getval(cct, cmdmap, "session_id", session_id);
assert(got);
bool killed = mds_rank->evict_client(session_id, false,
g_conf->mds_session_blacklist_on_evict,
ss);
if (!killed)
r = -ENOENT;
} else if (prefix == "heap") {
if (!ceph_using_tcmalloc()) {
r = -EOPNOTSUPP;
ss << "could not issue heap profiler command -- not using tcmalloc!";
} else {
string heapcmd;
cmd_getval(cct, cmdmap, "heapcmd", heapcmd);
vector<string> heapcmd_vec;
get_str_vec(heapcmd, heapcmd_vec);
ceph_heap_profiler_handle_command(heapcmd_vec, ds);
}
} else if (prefix == "cpu_profiler") {
string arg;
cmd_getval(cct, cmdmap, "arg", arg);
vector<string> argvec;
get_str_vec(arg, argvec);
cpu_profiler_handle_command(argvec, ds);
} else {
// Give MDSRank a shot at the command
if (!mds_rank) {
ss << "MDS not active";
r = -EINVAL;
}
else {
bool handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss,
need_reply);
if (!handled) {
// MDSDaemon doesn't know this command
ss << "unrecognized command! " << prefix;
r = -EINVAL;
}
}
}
out:
*outs = ss.str();
outbl->append(ds);
return r;
}
| 0
|
470,057
|
h2_rx_priority(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
{
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
ASSERT_RXTHR(h2);
CHECK_OBJ_ORNULL(r2, H2_REQ_MAGIC);
return (0);
}
| 0
|
305,342
|
TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node,
const OpData& data,
const TfLiteEvalTensor* input,
const TfLiteEvalTensor* filter,
const TfLiteEvalTensor* bias,
TfLiteEvalTensor* output) {
tflite::FullyConnectedParams op_params;
op_params.input_offset = -data.input_zero_point;
op_params.weights_offset = -data.filter_zero_point;
op_params.output_offset = data.output_zero_point;
op_params.output_multiplier = data.output_multiplier;
// TODO(b/138810107): Figure out whether output shift should be inverted
op_params.output_shift = -data.output_shift;
op_params.quantized_activation_min = data.output_activation_min;
op_params.quantized_activation_max = data.output_activation_max;
reference_integer_ops::FullyConnected(
op_params, tflite::micro::GetTensorShape(input),
tflite::micro::GetTensorData<int8_t>(input),
tflite::micro::GetTensorShape(filter),
tflite::micro::GetTensorData<int8_t>(filter),
tflite::micro::GetTensorShape(bias),
tflite::micro::GetTensorData<int32_t>(bias),
tflite::micro::GetTensorShape(output),
tflite::micro::GetTensorData<int8_t>(output));
return kTfLiteOk;
}
| 0
|
271,012
|
static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids,
const struct ipc_ops *ops, struct ipc_params *params)
{
int err;
down_write(&ids->rwsem);
err = ops->getnew(ns, params);
up_write(&ids->rwsem);
return err;
}
| 0
|
504,976
|
rsvg_filter_primitive_gaussian_blur_free (RsvgNode * self)
{
RsvgFilterPrimitiveGaussianBlur *upself;
upself = (RsvgFilterPrimitiveGaussianBlur *) self;
g_string_free (upself->super.result, TRUE);
g_string_free (upself->super.in, TRUE);
_rsvg_node_free (self);
}
| 0
|
59,609
|
PackLinuxElf64::check_pt_load(Elf64_Phdr const *const phdr)
{
u64_t filesz = get_te64(&phdr->p_filesz);
u64_t offset = get_te64(&phdr->p_offset), offend = filesz + offset;
u64_t vaddr = get_te64(&phdr->p_vaddr);
u64_t paddr = get_te64(&phdr->p_paddr);
u64_t align = get_te64(&phdr->p_align);
if ((-1+ align) & (paddr ^ vaddr)
|| (u64_t)file_size <= (u64_t)offset
|| (u64_t)file_size < (u64_t)offend
|| (u64_t)file_size <= (u64_t)filesz) {
char msg[50]; snprintf(msg, sizeof(msg), "bad PT_LOAD phdr[%u]",
(unsigned)(phdr - phdri));
throwCantPack(msg);
}
return offset;
}
| 0
|
107,479
|
void print_event_filter(struct trace_event_file *file, struct trace_seq *s)
{
struct event_filter *filter = event_filter(file);
if (filter && filter->filter_string)
trace_seq_printf(s, "%s\n", filter->filter_string);
else
trace_seq_puts(s, "none\n");
}
| 0
|
103,757
|
static inline int check_target(struct arpt_entry *e, const char *name)
{
struct xt_entry_target *t = arpt_get_target(e);
struct xt_tgchk_param par = {
.table = name,
.entryinfo = e,
.target = t->u.kernel.target,
.targinfo = t->data,
.hook_mask = e->comefrom,
.family = NFPROTO_ARP,
};
return xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false);
}
| 0
|
510,565
|
void item_init(void)
{
item_user_lock_init();
uuid_short_init();
}
| 0
|
47,704
|
void socketRegisterEvents(Socket *socket, OsEvent *event, uint_t eventMask)
{
//Valid socket handle?
if(socket != NULL)
{
//Get exclusive access
osAcquireMutex(&netMutex);
//An user event may have been previously registered...
if(socket->userEvent != NULL)
{
socket->eventMask |= eventMask;
}
else
{
socket->eventMask = eventMask;
}
//Suscribe to get notified of events
socket->userEvent = event;
#if (TCP_SUPPORT == ENABLED)
//Handle TCP specific events
if(socket->type == SOCKET_TYPE_STREAM)
{
tcpUpdateEvents(socket);
}
#endif
#if (UDP_SUPPORT == ENABLED)
//Handle UDP specific events
if(socket->type == SOCKET_TYPE_DGRAM)
{
udpUpdateEvents(socket);
}
#endif
#if (RAW_SOCKET_SUPPORT == ENABLED)
//Handle events that are specific to raw sockets
if(socket->type == SOCKET_TYPE_RAW_IP ||
socket->type == SOCKET_TYPE_RAW_ETH)
{
rawSocketUpdateEvents(socket);
}
#endif
//Release exclusive access
osReleaseMutex(&netMutex);
}
}
| 0
|
314,457
|
void LauncherView::LayoutToIdealBounds() {
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
if (bounds_animator_->IsAnimating())
AnimateToIdealBounds();
else
views::ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_);
overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds);
}
| 0
|
476,456
|
static void rtsx_usb_ms_handle_req(struct work_struct *work)
{
struct rtsx_usb_ms *host = container_of(work,
struct rtsx_usb_ms, handle_req);
struct rtsx_ucr *ucr = host->ucr;
struct memstick_host *msh = host->msh;
int rc;
if (!host->req) {
pm_runtime_get_sync(ms_dev(host));
do {
rc = memstick_next_req(msh, &host->req);
dev_dbg(ms_dev(host), "next req %d\n", rc);
if (!rc) {
mutex_lock(&ucr->dev_mutex);
if (rtsx_usb_card_exclusive_check(ucr,
RTSX_USB_MS_CARD))
host->req->error = -EIO;
else
host->req->error =
rtsx_usb_ms_issue_cmd(host);
mutex_unlock(&ucr->dev_mutex);
dev_dbg(ms_dev(host), "req result %d\n",
host->req->error);
}
} while (!rc);
pm_runtime_put_sync(ms_dev(host));
}
}
| 0
|
393,920
|
ext_t_1_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
{
char *str = wmem_strdup_printf(wmem_packet_scope(), "Variable substitution - unescaped: '%s'",
tvb_get_const_stringz(tvb, str_tbl + value, NULL));
return str;
}
| 0
|
148,234
|
prepare_viminfo_registers(void)
{
y_read_regs = ALLOC_CLEAR_MULT(yankreg_T, NUM_REGISTERS);
}
| 0
|
446,353
|
virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics)
{
bool ret = false;
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS)
ret = true;
return ret;
}
| 0
|
124,311
|
void kgdb_arch_late(void)
{
int i, cpu;
struct perf_event_attr attr;
struct perf_event **pevent;
/*
* Pre-allocate the hw breakpoint structions in the non-atomic
* portion of kgdb because this operation requires mutexs to
* complete.
*/
hw_breakpoint_init(&attr);
attr.bp_addr = (unsigned long)kgdb_arch_init;
attr.bp_len = HW_BREAKPOINT_LEN_1;
attr.bp_type = HW_BREAKPOINT_W;
attr.disabled = 1;
for (i = 0; i < HBP_NUM; i++) {
if (breakinfo[i].pev)
continue;
breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL);
if (IS_ERR((void * __force)breakinfo[i].pev)) {
printk(KERN_ERR "kgdb: Could not allocate hw"
"breakpoints\nDisabling the kernel debugger\n");
breakinfo[i].pev = NULL;
kgdb_arch_exit();
return;
}
for_each_online_cpu(cpu) {
pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
pevent[0]->hw.sample_period = 1;
pevent[0]->overflow_handler = kgdb_hw_overflow_handler;
if (pevent[0]->destroy != NULL) {
pevent[0]->destroy = NULL;
release_bp_slot(*pevent);
}
}
}
}
| 0
|
403,095
|
std::string print_entry(bdecode_node const& e
, bool single_line, int indent)
{
char indent_str[200];
using std::memset;
memset(indent_str, ' ', 200);
indent_str[0] = ',';
indent_str[1] = '\n';
indent_str[199] = 0;
if (indent < 197 && indent >= 0) indent_str[indent+2] = 0;
std::string ret;
switch (e.type())
{
case bdecode_node::none_t: return "none";
case bdecode_node::int_t:
{
char str[100];
snprintf(str, sizeof(str), "%" PRId64, e.int_value());
return str;
}
case bdecode_node::string_t:
{
print_string(ret, e.string_ptr(), e.string_length(), single_line);
return ret;
}
case bdecode_node::list_t:
{
ret += '[';
bool one_liner = line_longer_than(e, 200) != -1 || single_line;
if (!one_liner) ret += indent_str + 1;
for (int i = 0; i < e.list_size(); ++i)
{
if (i == 0 && one_liner) ret += " ";
ret += print_entry(e.list_at(i), single_line, indent + 2);
if (i < e.list_size() - 1) ret += (one_liner?", ":indent_str);
else ret += (one_liner?" ":indent_str+1);
}
ret += "]";
return ret;
}
case bdecode_node::dict_t:
{
ret += "{";
bool one_liner = line_longer_than(e, 200) != -1 || single_line;
if (!one_liner) ret += indent_str+1;
for (int i = 0; i < e.dict_size(); ++i)
{
if (i == 0 && one_liner) ret += " ";
std::pair<std::string, bdecode_node> ent = e.dict_at(i);
print_string(ret, ent.first.c_str(), ent.first.size(), true);
ret += ": ";
ret += print_entry(ent.second, single_line, indent + 2);
if (i < e.dict_size() - 1) ret += (one_liner?", ":indent_str);
else ret += (one_liner?" ":indent_str+1);
}
ret += "}";
return ret;
}
}
return ret;
}
| 0
|
378,670
|
static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
size_t n, off_t offset)
{
ssize_t result;
#if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
START_PROFILE_BYTES(syscall_pwrite, n);
result = sys_pwrite(fsp->fh->fd, data, n, offset);
END_PROFILE(syscall_pwrite);
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be sought on. */
result = SMB_VFS_WRITE(fsp, data, n);
}
#else /* HAVE_PWRITE */
off_t curr;
int lerrno;
curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
if (curr == -1) {
return -1;
}
if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
return -1;
}
result = SMB_VFS_WRITE(fsp, data, n);
lerrno = errno;
SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
errno = lerrno;
#endif /* HAVE_PWRITE */
return result;
}
| 0
|
52,526
|
void kvm_arch_pre_destroy_vm(struct kvm *kvm)
{
kvm_mmu_pre_destroy_vm(kvm);
}
| 0
|
249,148
|
DevToolsWindow::~DevToolsWindow() {
content::DevToolsManager::GetInstance()->ClientHostClosing(
frontend_host_.get());
UpdateBrowserToolbar();
DevToolsWindows* instances = &g_instances.Get();
DevToolsWindows::iterator it(
std::find(instances->begin(), instances->end(), this));
DCHECK(it != instances->end());
instances->erase(it);
for (IndexingJobsMap::const_iterator jobs_it(indexing_jobs_.begin());
jobs_it != indexing_jobs_.end(); ++jobs_it) {
jobs_it->second->Stop();
}
indexing_jobs_.clear();
}
| 0
|
424,644
|
static int _php_mb_regex_globals_ctor(zend_mb_regex_globals *pglobals)
{
pglobals->default_mbctype = ONIG_ENCODING_UTF8;
pglobals->current_mbctype = ONIG_ENCODING_UTF8;
ZVAL_UNDEF(&pglobals->search_str);
pglobals->search_re = (php_mb_regex_t*)NULL;
pglobals->search_pos = 0;
pglobals->search_regs = (OnigRegion*)NULL;
pglobals->regex_default_options = ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE;
pglobals->regex_default_syntax = ONIG_SYNTAX_RUBY;
return SUCCESS;
}
| 0
|
425,661
|
CpuMpPeimInit (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
//
// For the sake of special initialization needing to be done right after
// memory discovery.
//
Status = PeiServicesNotifyPpi (&mPostMemNotifyList[0]);
ASSERT_EFI_ERROR (Status);
return Status;
}
| 0
|
176,917
|
ui::EventDispatchDetails MockInputMethod::DispatchKeyEvent(ui::KeyEvent* key) {
#if defined(OS_MACOSX)
if (key->is_char())
return DispatchKeyEventPostIME(key);
#endif
if (key->is_char() && key->HasNativeEvent()) {
key->SetHandled();
return ui::EventDispatchDetails();
}
ui::EventDispatchDetails dispatch_details;
bool handled = !IsTextInputTypeNone() && HasComposition();
ClearStates();
if (handled) {
DCHECK(!key->is_char());
ui::KeyEvent mock_key(ui::ET_KEY_PRESSED,
ui::VKEY_PROCESSKEY,
key->flags());
dispatch_details = DispatchKeyEventPostIME(&mock_key);
} else {
dispatch_details = DispatchKeyEventPostIME(key);
}
if (key->handled() || dispatch_details.dispatcher_destroyed)
return dispatch_details;
ui::TextInputClient* client = GetTextInputClient();
if (client) {
if (handled) {
if (result_text_.length())
client->InsertText(result_text_);
if (composition_.text.length())
client->SetCompositionText(composition_);
else
client->ClearCompositionText();
} else if (key->type() == ui::ET_KEY_PRESSED) {
base::char16 ch = key->GetCharacter();
if (ch)
client->InsertChar(*key);
}
}
ClearComposition();
return dispatch_details;
}
| 0
|
336,571
|
static void lsi_command_complete(SCSIBus *bus, int reason, uint32_t tag,
uint32_t arg)
{
LSIState *s = DO_UPCAST(LSIState, dev.qdev, bus->qbus.parent);
int out;
out = (s->sstat1 & PHASE_MASK) == PHASE_DO;
if (reason == SCSI_REASON_DONE) {
DPRINTF("Command complete status=%d\n", (int)arg);
s->status = arg;
s->command_complete = 2;
if (s->waiting && s->dbc != 0) {
/* Raise phase mismatch for short transfers. */
lsi_bad_phase(s, out, PHASE_ST);
} else {
lsi_set_phase(s, PHASE_ST);
}
qemu_free(s->current);
s->current = NULL;
lsi_resume_script(s);
return;
}
if (s->waiting == 1 || !s->current || tag != s->current->tag ||
(lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
if (lsi_queue_tag(s, tag, arg))
return;
}
/* host adapter (re)connected */
DPRINTF("Data ready tag=0x%x len=%d\n", tag, arg);
s->current->dma_len = arg;
s->command_complete = 1;
if (!s->waiting)
return;
if (s->waiting == 1 || s->dbc == 0) {
lsi_resume_script(s);
} else {
lsi_do_dma(s, out);
}
}
| 1
|
468,300
|
subject_iface_init (PolkitSubjectIface *subject_iface)
{
subject_iface->hash = polkit_system_bus_name_hash;
subject_iface->equal = polkit_system_bus_name_equal;
subject_iface->to_string = polkit_system_bus_name_to_string;
subject_iface->exists = polkit_system_bus_name_exists;
subject_iface->exists_finish = polkit_system_bus_name_exists_finish;
subject_iface->exists_sync = polkit_system_bus_name_exists_sync;
}
| 0
|
12,373
|
void MojoVideoEncodeAccelerator::Encode(const scoped_refptr<VideoFrame>& frame,
bool force_keyframe) {
DVLOG(2) << __func__ << " tstamp=" << frame->timestamp();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_EQ(PIXEL_FORMAT_I420, frame->format());
DCHECK_EQ(VideoFrame::STORAGE_SHMEM, frame->storage_type());
DCHECK(frame->shared_memory_handle().IsValid());
const size_t allocation_size = frame->shared_memory_handle().GetSize();
mojo::ScopedSharedBufferHandle handle =
mojo::WrapSharedMemoryHandle(frame->shared_memory_handle().Duplicate(),
allocation_size, true /* read_only */);
const size_t y_offset = frame->shared_memory_offset();
const size_t u_offset = y_offset + frame->data(VideoFrame::kUPlane) -
frame->data(VideoFrame::kYPlane);
const size_t v_offset = y_offset + frame->data(VideoFrame::kVPlane) -
frame->data(VideoFrame::kYPlane);
scoped_refptr<MojoSharedBufferVideoFrame> mojo_frame =
MojoSharedBufferVideoFrame::Create(
frame->format(), frame->coded_size(), frame->visible_rect(),
frame->natural_size(), std::move(handle), allocation_size, y_offset,
u_offset, v_offset, frame->stride(VideoFrame::kYPlane),
frame->stride(VideoFrame::kUPlane),
frame->stride(VideoFrame::kVPlane), frame->timestamp());
DCHECK(vea_.is_bound());
vea_->Encode(mojo_frame, force_keyframe,
base::Bind(&KeepVideoFrameAlive, frame));
}
| 1
|
490,049
|
static int asn1_encode_se_info(sc_context_t *ctx,
struct sc_pkcs15_sec_env_info **se, size_t se_num,
unsigned char **buf, size_t *bufsize, int depth)
{
unsigned char *ptr = NULL, *out = NULL, *p;
size_t ptrlen = 0, outlen = 0, idx;
int ret;
for (idx=0; idx < se_num; idx++) {
struct sc_asn1_entry asn1_se[2];
struct sc_asn1_entry asn1_se_info[4];
sc_copy_asn1_entry(c_asn1_se, asn1_se);
sc_copy_asn1_entry(c_asn1_se_info, asn1_se_info);
sc_format_asn1_entry(asn1_se_info + 0, &se[idx]->se, NULL, 1);
if (sc_valid_oid(&se[idx]->owner))
sc_format_asn1_entry(asn1_se_info + 1, &se[idx]->owner, NULL, 1);
if (se[idx]->aid.len)
sc_format_asn1_entry(asn1_se_info + 2, &se[idx]->aid.value, &se[idx]->aid.len, 1);
sc_format_asn1_entry(asn1_se + 0, asn1_se_info, NULL, 1);
ret = sc_asn1_encode(ctx, asn1_se, &ptr, &ptrlen);
if (ret != SC_SUCCESS)
goto err;
p = (unsigned char *) realloc(out, outlen + ptrlen);
if (!p) {
ret = SC_ERROR_OUT_OF_MEMORY;
goto err;
}
out = p;
memcpy(out + outlen, ptr, ptrlen);
outlen += ptrlen;
free(ptr);
ptr = NULL;
ptrlen = 0;
}
*buf = out;
*bufsize = outlen;
ret = SC_SUCCESS;
err:
if (ret != SC_SUCCESS && out != NULL)
free(out);
return ret;
}
| 0
|
81,088
|
int git_path_cmp(
const char *name1, size_t len1, int isdir1,
const char *name2, size_t len2, int isdir2,
int (*compare)(const char *, const char *, size_t))
{
unsigned char c1, c2;
size_t len = len1 < len2 ? len1 : len2;
int cmp;
cmp = compare(name1, name2, len);
if (cmp)
return cmp;
c1 = name1[len];
c2 = name2[len];
if (c1 == '\0' && isdir1)
c1 = '/';
if (c2 == '\0' && isdir2)
c2 = '/';
return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
}
| 0
|
22,055
|
static int cirrus_bitblt_common_patterncopy ( CirrusVGAState * s ) {
uint32_t patternsize ;
bool videosrc = ! s -> cirrus_srccounter ;
if ( videosrc ) {
switch ( s -> vga . get_bpp ( & s -> vga ) ) {
case 8 : patternsize = 64 ;
break ;
case 15 : case 16 : patternsize = 128 ;
break ;
case 24 : case 32 : default : patternsize = 256 ;
break ;
}
s -> cirrus_blt_srcaddr &= ~ ( patternsize - 1 ) ;
if ( s -> cirrus_blt_srcaddr + patternsize > s -> vga . vram_size ) {
return 0 ;
}
}
if ( blit_is_unsafe ( s , true ) ) {
return 0 ;
}
( * s -> cirrus_rop ) ( s , s -> cirrus_blt_dstaddr , videosrc ? s -> cirrus_blt_srcaddr : 0 , s -> cirrus_blt_dstpitch , 0 , s -> cirrus_blt_width , s -> cirrus_blt_height ) ;
cirrus_invalidate_region ( s , s -> cirrus_blt_dstaddr , s -> cirrus_blt_dstpitch , s -> cirrus_blt_width , s -> cirrus_blt_height ) ;
return 1 ;
}
| 0
|
7,099
|
bool all_tests () {
mu_run_test (test_r_str_newf);
mu_run_test (test_r_str_replace_char_once);
mu_run_test (test_r_str_replace_char);
mu_run_test (test_r_str_replace);
mu_run_test (test_r_str_bits64);
mu_run_test (test_r_str_rwx);
mu_run_test (test_r_str_rwx_i);
mu_run_test (test_r_str_bool);
mu_run_test (test_r_str_trim);
mu_run_test (test_r_str_case);
mu_run_test (test_r_str_split);
mu_run_test (test_r_str_tokenize);
mu_run_test (test_r_str_char_count);
mu_run_test (test_r_str_word_count);
mu_run_test (test_r_str_ichr);
mu_run_test (test_r_str_lchr);
mu_run_test (test_r_sub_str_lchr);
mu_run_test (test_r_sub_str_rchr);
mu_run_test (test_r_str_rchr);
mu_run_test (test_r_str_ansi_len);
mu_run_test (test_r_str_len_utf8_ansi);
mu_run_test (test_r_str_utf8_charsize);
mu_run_test (test_r_str_utf8_charsize_prev);
mu_run_test (test_r_str_sanitize_sdb_key);
mu_run_test (test_r_str_unescape);
mu_run_test (test_r_str_constpool);
mu_run_test (test_r_str_format_msvc_argv);
mu_run_test (test_r_str_str_xy);
return tests_passed != tests_run;
}
| 1
|
463
|
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 1
|
115,645
|
static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg)
{
struct crypto_stat_hash rhash;
memset(&rhash, 0, sizeof(rhash));
strscpy(rhash.type, "shash", sizeof(rhash.type));
rhash.stat_hash_cnt = atomic64_read(&alg->stats.hash.hash_cnt);
rhash.stat_hash_tlen = atomic64_read(&alg->stats.hash.hash_tlen);
rhash.stat_err_cnt = atomic64_read(&alg->stats.hash.err_cnt);
return nla_put(skb, CRYPTOCFGA_STAT_HASH, sizeof(rhash), &rhash);
}
| 0
|
442,651
|
static inline int hci_proto_disconn_ind(struct hci_conn *conn)
{
if (conn->type != ACL_LINK && conn->type != LE_LINK)
return HCI_ERROR_REMOTE_USER_TERM;
return l2cap_disconn_ind(conn);
}
| 0
|
91,515
|
static void pipe_destruct(struct sock *sk)
{
struct pep_sock *pn = pep_sk(sk);
skb_queue_purge(&sk->sk_receive_queue);
skb_queue_purge(&pn->ctrlreq_queue);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.