idx
int64 | func
string | target
int64 |
|---|---|---|
105,855
|
static int __init init_nfs_fs(void)
{
int err;
err = nfsiod_start();
if (err)
goto out6;
err = nfs_fs_proc_init();
if (err)
goto out5;
err = nfs_init_nfspagecache();
if (err)
goto out4;
err = nfs_init_inodecache();
if (err)
goto out3;
err = nfs_init_readpagecache();
if (err)
goto out2;
err = nfs_init_writepagecache();
if (err)
goto out1;
err = nfs_init_directcache();
if (err)
goto out0;
#ifdef CONFIG_PROC_FS
rpc_proc_register(&nfs_rpcstat);
#endif
if ((err = register_nfs_fs()) != 0)
goto out;
return 0;
out:
#ifdef CONFIG_PROC_FS
rpc_proc_unregister("nfs");
#endif
nfs_destroy_directcache();
out0:
nfs_destroy_writepagecache();
out1:
nfs_destroy_readpagecache();
out2:
nfs_destroy_inodecache();
out3:
nfs_destroy_nfspagecache();
out4:
nfs_fs_proc_exit();
out5:
nfsiod_stop();
out6:
return err;
}
| 0
|
360,789
|
static AsyncURB *async_alloc(void)
{
return (AsyncURB *) qemu_mallocz(sizeof(AsyncURB));
}
| 0
|
189,117
|
void OMXCodec::addCodecSpecificData(const void *data, size_t size) {
CodecSpecificData *specific =
(CodecSpecificData *)malloc(sizeof(CodecSpecificData) + size - 1);
specific->mSize = size;
memcpy(specific->mData, data, size);
mCodecSpecificData.push(specific);
}
| 0
|
459,055
|
coroutine_fn iscsi_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset,
int bytes, BdrvRequestFlags flags)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t nb_blocks;
bool use_16_for_ws = iscsilun->use_16_for_rw;
int r = 0;
if (!is_byte_request_lun_aligned(offset, bytes, iscsilun)) {
return -ENOTSUP;
}
if (flags & BDRV_REQ_MAY_UNMAP) {
if (!use_16_for_ws && !iscsilun->lbp.lbpws10) {
/* WRITESAME10 with UNMAP is unsupported try WRITESAME16 */
use_16_for_ws = true;
}
if (use_16_for_ws && !iscsilun->lbp.lbpws) {
/* WRITESAME16 with UNMAP is not supported by the target,
* fall back and try WRITESAME10/16 without UNMAP */
flags &= ~BDRV_REQ_MAY_UNMAP;
use_16_for_ws = iscsilun->use_16_for_rw;
}
}
if (!(flags & BDRV_REQ_MAY_UNMAP) && !iscsilun->has_write_same) {
/* WRITESAME without UNMAP is not supported by the target */
return -ENOTSUP;
}
lba = offset / iscsilun->block_size;
nb_blocks = bytes / iscsilun->block_size;
if (iscsilun->zeroblock == NULL) {
iscsilun->zeroblock = g_try_malloc0(iscsilun->block_size);
if (iscsilun->zeroblock == NULL) {
return -ENOMEM;
}
}
qemu_mutex_lock(&iscsilun->mutex);
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (use_16_for_ws) {
iTask.task = iscsi_writesame16_task(iscsilun->iscsi, iscsilun->lun, lba,
iscsilun->zeroblock, iscsilun->block_size,
nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP),
0, 0, iscsi_co_generic_cb, &iTask);
} else {
iTask.task = iscsi_writesame10_task(iscsilun->iscsi, iscsilun->lun, lba,
iscsilun->zeroblock, iscsilun->block_size,
nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP),
0, 0, iscsi_co_generic_cb, &iTask);
}
if (iTask.task == NULL) {
qemu_mutex_unlock(&iscsilun->mutex);
return -ENOMEM;
}
iscsi_co_wait_for_task(&iTask, iscsilun);
if (iTask.status == SCSI_STATUS_CHECK_CONDITION &&
iTask.task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST &&
(iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE ||
iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB)) {
/* WRITE SAME is not supported by the target */
iscsilun->has_write_same = false;
scsi_free_scsi_task(iTask.task);
r = -ENOTSUP;
goto out_unlock;
}
if (iTask.task != NULL) {
scsi_free_scsi_task(iTask.task);
iTask.task = NULL;
}
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
if (iTask.status != SCSI_STATUS_GOOD) {
iscsi_allocmap_set_invalid(iscsilun, offset, bytes);
error_report("iSCSI WRITESAME10/16 failed at lba %" PRIu64 ": %s",
lba, iTask.err_str);
r = iTask.err_code;
goto out_unlock;
}
if (flags & BDRV_REQ_MAY_UNMAP) {
iscsi_allocmap_set_invalid(iscsilun, offset, bytes);
} else {
iscsi_allocmap_set_allocated(iscsilun, offset, bytes);
}
out_unlock:
qemu_mutex_unlock(&iscsilun->mutex);
g_free(iTask.err_str);
return r;
}
| 0
|
372,138
|
static void call_nt_transact_notify_change(connection_struct *conn,
struct smb_request *req,
uint16 **ppsetup,
uint32 setup_count,
char **ppparams,
uint32 parameter_count,
char **ppdata, uint32 data_count,
uint32 max_data_count,
uint32 max_param_count)
{
uint16 *setup = *ppsetup;
files_struct *fsp;
uint32 filter;
NTSTATUS status;
bool recursive;
if(setup_count < 6) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
fsp = file_fsp(req, SVAL(setup,4));
filter = IVAL(setup, 0);
recursive = (SVAL(setup, 6) != 0) ? True : False;
DEBUG(3,("call_nt_transact_notify_change\n"));
if(!fsp) {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
{
char *filter_string;
if (!(filter_string = notify_filter_string(NULL, filter))) {
reply_nterror(req,NT_STATUS_NO_MEMORY);
return;
}
DEBUG(3,("call_nt_transact_notify_change: notify change "
"called on %s, filter = %s, recursive = %d\n",
fsp_str_dbg(fsp), filter_string, recursive));
TALLOC_FREE(filter_string);
}
if((!fsp->is_directory) || (conn != fsp->conn)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
if (fsp->notify == NULL) {
status = change_notify_create(fsp, filter, recursive);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("change_notify_create returned %s\n",
nt_errstr(status)));
reply_nterror(req, status);
return;
}
}
if (fsp->notify->num_changes != 0) {
/*
* We've got changes pending, respond immediately
*/
/*
* TODO: write a torture test to check the filtering behaviour
* here.
*/
change_notify_reply(req,
NT_STATUS_OK,
max_param_count,
fsp->notify,
smbd_smb1_notify_reply);
/*
* change_notify_reply() above has independently sent its
* results
*/
return;
}
/*
* No changes pending, queue the request
*/
status = change_notify_add_request(req,
max_param_count,
filter,
recursive, fsp,
smbd_smb1_notify_reply);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
}
return;
}
| 0
|
194,283
|
void Gfx::opEndMarkedContent(Object args[], int numArgs) {
if (mcStack)
popMarkedContent();
out->endMarkedContent(state);
}
| 0
|
188,755
|
void RenderViewImpl::FocusedNodeChanged(const WebNode& fromNode,
const WebNode& toNode) {
RenderFrameImpl* previous_frame = nullptr;
if (!fromNode.IsNull())
previous_frame =
RenderFrameImpl::FromWebFrame(fromNode.GetDocument().GetFrame());
RenderFrameImpl* new_frame = nullptr;
if (!toNode.IsNull())
new_frame = RenderFrameImpl::FromWebFrame(toNode.GetDocument().GetFrame());
if (previous_frame && previous_frame != new_frame)
previous_frame->FocusedNodeChanged(WebNode());
if (new_frame)
new_frame->FocusedNodeChanged(toNode);
if (main_render_frame_)
main_render_frame_->FocusedNodeChangedForAccessibility(toNode);
}
| 0
|
155,132
|
size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect)
{
return _get_chars(screen, 1, str, len, rect);
}
| 0
|
97,622
|
GF_Err elst_Write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i;
u32 nb_entries;
GF_EdtsEntry *p;
GF_EditListBox *ptr = (GF_EditListBox *)s;
if (!ptr) return GF_BAD_PARAM;
nb_entries = gf_list_count(ptr->entryList);
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u32(bs, nb_entries);
for (i = 0; i < nb_entries; i++ ) {
p = (GF_EdtsEntry*)gf_list_get(ptr->entryList, i);
if (ptr->version == 1) {
gf_bs_write_u64(bs, p->segmentDuration);
gf_bs_write_u64(bs, p->mediaTime);
} else {
gf_bs_write_u32(bs, (u32) p->segmentDuration);
gf_bs_write_u32(bs, (s32) p->mediaTime);
}
gf_bs_write_u16(bs, p->mediaRate);
gf_bs_write_u16(bs, 0);
}
return GF_OK;
}
| 0
|
385,772
|
AttVal *TY_(NewAttribute)( TidyDocImpl* doc )
{
AttVal *av = (AttVal*) TidyDocAlloc( doc, sizeof(AttVal) );
TidyClearMemory( av, sizeof(AttVal) );
return av;
}
| 0
|
370,499
|
void check_response_for_cacheability(struct session *t, struct channel *rtr)
{
struct http_txn *txn = &t->txn;
char *p1, *p2;
char *cur_ptr, *cur_end, *cur_next;
int cur_idx;
if (!(txn->flags & TX_CACHEABLE))
return;
/* Iterate through the headers.
* we start with the start line.
*/
cur_idx = 0;
cur_next = rtr->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[cur_idx].next)) {
struct hdr_idx_elem *cur_hdr;
int val;
cur_hdr = &txn->hdr_idx.v[cur_idx];
cur_ptr = cur_next;
cur_end = cur_ptr + cur_hdr->len;
cur_next = cur_end + cur_hdr->cr + 1;
/* We have one full header between cur_ptr and cur_end, and the
* next header starts at cur_next. We're only interested in
* "Cookie:" headers.
*/
val = http_header_match2(cur_ptr, cur_end, "Pragma", 6);
if (val) {
if ((cur_end - (cur_ptr + val) >= 8) &&
strncasecmp(cur_ptr + val, "no-cache", 8) == 0) {
txn->flags &= ~TX_CACHEABLE & ~TX_CACHE_COOK;
return;
}
}
val = http_header_match2(cur_ptr, cur_end, "Cache-control", 13);
if (!val)
continue;
/* OK, right now we know we have a cache-control header at cur_ptr */
p1 = cur_ptr + val; /* first non-space char after 'cache-control:' */
if (p1 >= cur_end) /* no more info */
continue;
/* p1 is at the beginning of the value */
p2 = p1;
while (p2 < cur_end && *p2 != '=' && *p2 != ',' && !isspace((unsigned char)*p2))
p2++;
/* we have a complete value between p1 and p2 */
if (p2 < cur_end && *p2 == '=') {
/* we have something of the form no-cache="set-cookie" */
if ((cur_end - p1 >= 21) &&
strncasecmp(p1, "no-cache=\"set-cookie", 20) == 0
&& (p1[20] == '"' || p1[20] == ','))
txn->flags &= ~TX_CACHE_COOK;
continue;
}
/* OK, so we know that either p2 points to the end of string or to a comma */
if (((p2 - p1 == 7) && strncasecmp(p1, "private", 7) == 0) ||
((p2 - p1 == 8) && strncasecmp(p1, "no-store", 8) == 0) ||
((p2 - p1 == 9) && strncasecmp(p1, "max-age=0", 9) == 0) ||
((p2 - p1 == 10) && strncasecmp(p1, "s-maxage=0", 10) == 0)) {
txn->flags &= ~TX_CACHEABLE & ~TX_CACHE_COOK;
return;
}
if ((p2 - p1 == 6) && strncasecmp(p1, "public", 6) == 0) {
txn->flags |= TX_CACHEABLE | TX_CACHE_COOK;
continue;
}
}
}
| 0
|
202,056
|
void ProcessBackingStore(HeapObjectHeader* header) {
EXPECT_TRUE(header->IsValid());
EXPECT_TRUE(header->IsMarked());
header->Unmark();
GCInfoTable::Get()
.GCInfoFromIndex(header->GcInfoIndex())
->trace_(this, header->Payload());
}
| 0
|
499,170
|
static int sqfs_frag_lookup(u32 inode_fragment_index,
struct squashfs_fragment_block_entry *e)
{
u64 start, n_blks, src_len, table_offset, start_block;
unsigned char *metadata_buffer, *metadata, *table;
struct squashfs_fragment_block_entry *entries;
struct squashfs_super_block *sblk = ctxt.sblk;
unsigned long dest_len;
int block, offset, ret;
u16 header;
metadata_buffer = NULL;
entries = NULL;
table = NULL;
if (inode_fragment_index >= get_unaligned_le32(&sblk->fragments))
return -EINVAL;
start = get_unaligned_le64(&sblk->fragment_table_start) /
ctxt.cur_dev->blksz;
n_blks = sqfs_calc_n_blks(sblk->fragment_table_start,
sblk->export_table_start,
&table_offset);
/* Allocate a proper sized buffer to store the fragment index table */
table = malloc_cache_aligned(n_blks * ctxt.cur_dev->blksz);
if (!table) {
ret = -ENOMEM;
goto out;
}
if (sqfs_disk_read(start, n_blks, table) < 0) {
ret = -EINVAL;
goto out;
}
block = SQFS_FRAGMENT_INDEX(inode_fragment_index);
offset = SQFS_FRAGMENT_INDEX_OFFSET(inode_fragment_index);
/*
* Get the start offset of the metadata block that contains the right
* fragment block entry
*/
start_block = get_unaligned_le64(table + table_offset + block *
sizeof(u64));
start = start_block / ctxt.cur_dev->blksz;
n_blks = sqfs_calc_n_blks(cpu_to_le64(start_block),
sblk->fragment_table_start, &table_offset);
metadata_buffer = malloc_cache_aligned(n_blks * ctxt.cur_dev->blksz);
if (!metadata_buffer) {
ret = -ENOMEM;
goto out;
}
if (sqfs_disk_read(start, n_blks, metadata_buffer) < 0) {
ret = -EINVAL;
goto out;
}
/* Every metadata block starts with a 16-bit header */
header = get_unaligned_le16(metadata_buffer + table_offset);
metadata = metadata_buffer + table_offset + SQFS_HEADER_SIZE;
if (!metadata || !header) {
ret = -ENOMEM;
goto out;
}
entries = malloc(SQFS_METADATA_BLOCK_SIZE);
if (!entries) {
ret = -ENOMEM;
goto out;
}
if (SQFS_COMPRESSED_METADATA(header)) {
src_len = SQFS_METADATA_SIZE(header);
dest_len = SQFS_METADATA_BLOCK_SIZE;
ret = sqfs_decompress(&ctxt, entries, &dest_len, metadata,
src_len);
if (ret) {
ret = -EINVAL;
goto out;
}
} else {
memcpy(entries, metadata, SQFS_METADATA_SIZE(header));
}
*e = entries[offset];
ret = SQFS_COMPRESSED_BLOCK(e->size);
out:
free(entries);
free(metadata_buffer);
free(table);
return ret;
}
| 0
|
33,376
|
static int madvise_free_single_vma(struct vm_area_struct *vma,
unsigned long start_addr, unsigned long end_addr)
{
unsigned long start, end;
struct mm_struct *mm = vma->vm_mm;
struct mmu_gather tlb;
/* MADV_FREE works for only anon vma at the moment */
if (!vma_is_anonymous(vma))
return -EINVAL;
start = max(vma->vm_start, start_addr);
if (start >= vma->vm_end)
return -EINVAL;
end = min(vma->vm_end, end_addr);
if (end <= vma->vm_start)
return -EINVAL;
lru_add_drain();
tlb_gather_mmu(&tlb, mm, start, end);
update_hiwater_rss(mm);
mmu_notifier_invalidate_range_start(mm, start, end);
madvise_free_page_range(&tlb, vma, start, end);
mmu_notifier_invalidate_range_end(mm, start, end);
tlb_finish_mmu(&tlb, start, end);
return 0;
}
| 0
|
177,341
|
void GeolocationInspectorAgent::setGeolocationOverride(ErrorString* error, const double* latitude, const double* longitude, const double* accuracy)
{
GeolocationPosition* position = m_controller->lastPosition();
if (!m_geolocationOverridden && position)
m_platformGeolocationPosition = position;
m_geolocationOverridden = true;
if (latitude && longitude && accuracy)
m_geolocationPosition = GeolocationPosition::create(currentTimeMS(), *latitude, *longitude, *accuracy);
else
m_geolocationPosition.clear();
m_controller->positionChanged(0); // Kick location update.
}
| 0
|
334,238
|
static int vm_can_run(void)
{
if (powerdown_requested)
return 0;
if (reset_requested)
return 0;
if (shutdown_requested)
return 0;
if (debug_requested)
return 0;
return 1;
}
| 0
|
206,366
|
void QuicClientPromisedInfo::Reset(QuicRstStreamErrorCode error_code) {
QuicClientPushPromiseIndex::Delegate* delegate = client_request_delegate_;
session_->ResetPromised(id_, error_code);
session_->DeletePromised(this);
if (delegate) {
delegate->OnRendezvousResult(nullptr);
}
}
| 0
|
169,633
|
void JSTestNamedConstructorNamedConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
{
Base::finishCreation(globalObject);
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestNamedConstructorPrototype::self(exec, globalObject), None);
}
| 0
|
360,322
|
compare_by_display_name (NautilusFile *file_1, NautilusFile *file_2)
{
const char *name_1, *name_2;
const char *key_1, *key_2;
gboolean sort_last_1, sort_last_2;
int compare;
name_1 = nautilus_file_peek_display_name (file_1);
name_2 = nautilus_file_peek_display_name (file_2);
sort_last_1 = name_1[0] == SORT_LAST_CHAR1 || name_1[0] == SORT_LAST_CHAR2;
sort_last_2 = name_2[0] == SORT_LAST_CHAR1 || name_2[0] == SORT_LAST_CHAR2;
if (sort_last_1 && !sort_last_2) {
compare = +1;
} else if (!sort_last_1 && sort_last_2) {
compare = -1;
} else {
key_1 = nautilus_file_peek_display_name_collation_key (file_1);
key_2 = nautilus_file_peek_display_name_collation_key (file_2);
compare = strcmp (key_1, key_2);
}
return compare;
}
| 0
|
448,563
|
zonetype_fromconfig(const cfg_obj_t *map) {
const cfg_obj_t *obj = NULL;
isc_result_t result;
result = cfg_map_get(map, "type", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
return (ns_config_getzonetype(obj));
}
| 0
|
65,664
|
int FLTIsBinaryComparisonFilterType(const char *pszValue)
{
if (pszValue) {
if (strcasecmp(pszValue, "PropertyIsEqualTo") == 0 ||
strcasecmp(pszValue, "PropertyIsNotEqualTo") == 0 ||
strcasecmp(pszValue, "PropertyIsLessThan") == 0 ||
strcasecmp(pszValue, "PropertyIsGreaterThan") == 0 ||
strcasecmp(pszValue, "PropertyIsLessThanOrEqualTo") == 0 ||
strcasecmp(pszValue, "PropertyIsGreaterThanOrEqualTo") == 0)
return MS_TRUE;
}
return MS_FALSE;
}
| 0
|
139,229
|
int tty_init_termios(struct tty_struct *tty)
{
struct ktermios *tp;
int idx = tty->index;
tp = tty->driver->termios[idx];
if (tp == NULL) {
tp = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL);
if (tp == NULL)
return -ENOMEM;
memcpy(tp, &tty->driver->init_termios,
sizeof(struct ktermios));
tty->driver->termios[idx] = tp;
}
tty->termios = tp;
tty->termios_locked = tp + 1;
/* Compatibility until drivers always set this */
tty->termios->c_ispeed = tty_termios_input_baud_rate(tty->termios);
tty->termios->c_ospeed = tty_termios_baud_rate(tty->termios);
return 0;
}
| 0
|
213,694
|
PHP_FUNCTION(pg_free_result)
{
zval *result;
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
if (Z_LVAL_P(result) == 0) {
RETURN_FALSE;
}
zend_list_delete(Z_RESVAL_P(result));
RETURN_TRUE;
}
| 0
|
15,812
|
static gcry_err_code_t pubkey_decrypt ( int algorithm , gcry_mpi_t * result , gcry_mpi_t * data , gcry_mpi_t * skey , int flags ) {
gcry_pk_spec_t * pubkey ;
gcry_module_t module ;
gcry_err_code_t rc ;
int i ;
* result = NULL ;
if ( DBG_CIPHER && ! fips_mode ( ) ) {
log_debug ( "pubkey_decrypt: algo=%d\n" , algorithm ) ;
for ( i = 0 ;
i < pubkey_get_nskey ( algorithm ) ;
i ++ ) log_mpidump ( " skey" , skey [ i ] ) ;
for ( i = 0 ;
i < pubkey_get_nenc ( algorithm ) ;
i ++ ) log_mpidump ( " data" , data [ i ] ) ;
}
ath_mutex_lock ( & pubkeys_registered_lock ) ;
module = _gcry_module_lookup_id ( pubkeys_registered , algorithm ) ;
if ( module ) {
pubkey = ( gcry_pk_spec_t * ) module -> spec ;
rc = pubkey -> decrypt ( algorithm , result , data , skey , flags ) ;
_gcry_module_release ( module ) ;
goto ready ;
}
rc = GPG_ERR_PUBKEY_ALGO ;
ready : ath_mutex_unlock ( & pubkeys_registered_lock ) ;
if ( ! rc && DBG_CIPHER && ! fips_mode ( ) ) log_mpidump ( " plain" , * result ) ;
return rc ;
}
| 0
|
190,968
|
void SoundTriggerHwService::recognitionCallback(struct sound_trigger_recognition_event *event,
void *cookie)
{
Module *module = (Module *)cookie;
if (module == NULL) {
return;
}
sp<SoundTriggerHwService> service = module->service().promote();
if (service == 0) {
return;
}
service->sendRecognitionEvent(event, module);
}
| 0
|
285,036
|
void ResourceDispatcherHostImpl::OnCancelRequest(int request_id) {
CancelRequest(filter_->child_id(), request_id, true);
}
| 0
|
253,706
|
void MockGenerateRandom(uint8_t* output, size_t n) {
memset(output, 0xaa, n);
}
| 0
|
203,138
|
bool IsEqualForTesting(const SendTabToSelfEntry& entry,
const sync_pb::SendTabToSelfSpecifics& specifics) {
return (
entry.GetGUID() == specifics.guid() &&
entry.GetURL() == specifics.url() &&
entry.GetTitle() == specifics.title() &&
entry.GetDeviceName() == specifics.device_name() &&
entry.GetTargetDeviceSyncCacheGuid() ==
specifics.target_device_sync_cache_guid() &&
specifics.shared_time_usec() ==
entry.GetSharedTime().ToDeltaSinceWindowsEpoch().InMicroseconds() &&
specifics.navigation_time_usec() == entry.GetOriginalNavigationTime()
.ToDeltaSinceWindowsEpoch()
.InMicroseconds());
}
| 0
|
103,249
|
absl::Status Parse(const TfLiteNode* tflite_node,
const TfLiteRegistration* registration,
GraphFloat32* graph, ObjectReader* reader) final {
Node* node = graph->NewNode();
node->operation.type = ToString(OperationType::PAD);
RETURN_IF_ERROR(reader->AddInput(node, 0));
RETURN_IF_ERROR(reader->AddOutputs(node));
PadAttributes attr;
if (mirror_pad_) {
attr.type = PaddingContentType::REFLECT;
} else /*zero pad*/ {
attr.type = PaddingContentType::ZEROS;
}
Tensor<HW, DataType::INT32> paddings;
RETURN_IF_ERROR(reader->ReadTensor(1, &paddings));
if (paddings.shape.h == 4 && paddings.shape.w == 2) {
// 4x2 tensor with paddings.
attr.prepended = BHWC(paddings.data[0], paddings.data[2],
paddings.data[4], paddings.data[6]);
attr.appended = BHWC(paddings.data[1], paddings.data[3], paddings.data[5],
paddings.data[7]);
} else if (paddings.shape.h == 3 && paddings.shape.w == 2) {
// 3x2 tensor with paddings.
attr.prepended =
BHWC(1, paddings.data[0], paddings.data[2], paddings.data[4]);
attr.appended =
BHWC(1, paddings.data[1], paddings.data[3], paddings.data[5]);
} else {
// It shouldn't fail here since it's checked at IsSupported().
return absl::InvalidArgumentError(
"Paddings tensor has unexpected shape.");
}
node->operation.attributes = attr;
return absl::OkStatus();
}
| 0
|
147,655
|
static bool rt_cache_valid(const struct rtable *rt)
{
return rt &&
rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK &&
!rt_is_expired(rt);
}
| 0
|
508,811
|
rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_data, const char *id)
{
RsvgDrawingCtx *draw;
RsvgNodeSvg *root;
RsvgNode *node;
RsvgBbox bbox;
RsvgDimensionData dimension_data;
cairo_surface_t *target = NULL;
cairo_t *cr = NULL;
gboolean ret = FALSE;
g_return_val_if_fail (handle, FALSE);
g_return_val_if_fail (position_data, FALSE);
/* Short-cut when no id is given. */
if (NULL == id || '\0' == *id) {
position_data->x = 0;
position_data->y = 0;
return TRUE;
}
memset (position_data, 0, sizeof (*position_data));
memset (&dimension_data, 0, sizeof (dimension_data));
node = rsvg_defs_lookup (handle->priv->defs, id);
if (!node) {
return FALSE;
} else if (node == handle->priv->treebase) {
/* Root node. */
position_data->x = 0;
position_data->y = 0;
return TRUE;
}
root = (RsvgNodeSvg *) handle->priv->treebase;
if (!root)
return FALSE;
target = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
cr = cairo_create (target);
draw = rsvg_cairo_new_drawing_ctx (cr, handle);
if (!draw)
goto bail;
while (node != NULL) {
draw->drawsub_stack = g_slist_prepend (draw->drawsub_stack, node);
node = node->parent;
}
rsvg_state_push (draw);
cairo_save (cr);
rsvg_node_draw (handle->priv->treebase, draw, 0);
bbox = RSVG_CAIRO_RENDER (draw->render)->bbox;
cairo_restore (cr);
rsvg_state_pop (draw);
rsvg_drawing_ctx_free (draw);
position_data->x = bbox.rect.x;
position_data->y = bbox.rect.y;
dimension_data.width = bbox.rect.width;
dimension_data.height = bbox.rect.height;
dimension_data.em = dimension_data.width;
dimension_data.ex = dimension_data.height;
if (handle->priv->size_func)
(*handle->priv->size_func) (&dimension_data.width, &dimension_data.height,
handle->priv->user_data);
ret = TRUE;
bail:
if (cr)
cairo_destroy (cr);
if (target)
cairo_surface_destroy (target);
return ret;
}
| 0
|
373,228
|
_PUBLIC_ int strcmp_safe(const char *s1, const char *s2)
{
if (s1 == s2) {
return 0;
}
if (s1 == NULL || s2 == NULL) {
return s1?-1:1;
}
return strcmp(s1, s2);
}
| 0
|
18,586
|
static const char * mgs_readable_cvm ( mgs_client_verification_method_e m ) {
switch ( m ) {
case mgs_cvm_unset : return "unset" ;
case mgs_cvm_cartel : return "cartel" ;
case mgs_cvm_msva : return "msva" ;
}
return "unknown" ;
}
| 0
|
380,215
|
static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && !container) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 0, BP_VAR_IS TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
ZEND_VM_NEXT_OPCODE();
}
| 0
|
125,618
|
xfs_attr_shortform_allfit(
struct xfs_buf *bp,
struct xfs_inode *dp)
{
struct xfs_attr_leafblock *leaf;
struct xfs_attr_leaf_entry *entry;
xfs_attr_leaf_name_local_t *name_loc;
struct xfs_attr3_icleaf_hdr leafhdr;
int bytes;
int i;
struct xfs_mount *mp = bp->b_target->bt_mount;
leaf = bp->b_addr;
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
entry = xfs_attr3_leaf_entryp(leaf);
bytes = sizeof(struct xfs_attr_sf_hdr);
for (i = 0; i < leafhdr.count; entry++, i++) {
if (entry->flags & XFS_ATTR_INCOMPLETE)
continue; /* don't copy partial entries */
if (!(entry->flags & XFS_ATTR_LOCAL))
return 0;
name_loc = xfs_attr3_leaf_name_local(leaf, i);
if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX)
return 0;
if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX)
return 0;
bytes += sizeof(struct xfs_attr_sf_entry) - 1
+ name_loc->namelen
+ be16_to_cpu(name_loc->valuelen);
}
if ((dp->i_mount->m_flags & XFS_MOUNT_ATTR2) &&
(dp->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
(bytes == sizeof(struct xfs_attr_sf_hdr)))
return -1;
return xfs_attr_shortform_bytesfit(dp, bytes);
}
| 0
|
173,063
|
void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) {
if (mode == accessibility_mode_)
return;
if (IsNeverVisible())
return;
accessibility_mode_ = mode;
for (FrameTreeNode* node : frame_tree_.Nodes()) {
UpdateAccessibilityModeOnFrame(node->current_frame_host());
RenderFrameHost* pending_frame_host =
node->render_manager()->pending_frame_host();
if (pending_frame_host)
UpdateAccessibilityModeOnFrame(pending_frame_host);
}
}
| 0
|
88,153
|
static void reload_tss(struct kvm_vcpu *vcpu)
{
int cpu = raw_smp_processor_id();
struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
sd->tss_desc->type = 9; /* available 32/64-bit TSS */
load_TR_desc();
}
| 0
|
133,633
|
void svhd_box_del(GF_Box *s)
{
GF_SphericalVideoInfoBox *ptr = (GF_SphericalVideoInfoBox *)s;
if (ptr->string) gf_free(ptr->string);
gf_free(s);
| 0
|
446,137
|
virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsysSCSIPtr scsisrc)
{
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
virDomainHostdevSubsysSCSIiSCSIClear(&scsisrc->u.iscsi);
else
VIR_FREE(scsisrc->u.host.adapter);
}
| 0
|
190,586
|
SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *srvr)
{
SSL_CIPHER *c,*ret=NULL;
STACK_OF(SSL_CIPHER) *prio, *allow;
int i,ii,ok;
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_EC)
unsigned int j;
int ec_ok, ec_nid;
unsigned char ec_search1 = 0, ec_search2 = 0;
#endif
CERT *cert;
unsigned long alg_k,alg_a,mask_k,mask_a,emask_k,emask_a;
/* Let's see which ciphers we can support */
cert=s->cert;
#if 0
/* Do not set the compare functions, because this may lead to a
* reordering by "id". We want to keep the original ordering.
* We may pay a price in performance during sk_SSL_CIPHER_find(),
* but would have to pay with the price of sk_SSL_CIPHER_dup().
*/
sk_SSL_CIPHER_set_cmp_func(srvr, ssl_cipher_ptr_id_cmp);
sk_SSL_CIPHER_set_cmp_func(clnt, ssl_cipher_ptr_id_cmp);
#endif
#ifdef CIPHER_DEBUG
printf("Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr), (void *)srvr);
for(i=0 ; i < sk_SSL_CIPHER_num(srvr) ; ++i)
{
c=sk_SSL_CIPHER_value(srvr,i);
printf("%p:%s\n",(void *)c,c->name);
}
printf("Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt), (void *)clnt);
for(i=0 ; i < sk_SSL_CIPHER_num(clnt) ; ++i)
{
c=sk_SSL_CIPHER_value(clnt,i);
printf("%p:%s\n",(void *)c,c->name);
}
#endif
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE)
{
prio = srvr;
allow = clnt;
}
else
{
prio = clnt;
allow = srvr;
}
for (i=0; i<sk_SSL_CIPHER_num(prio); i++)
{
c=sk_SSL_CIPHER_value(prio,i);
/* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
if ((c->algorithm_ssl & SSL_TLSV1_2) &&
(TLS1_get_version(s) < TLS1_2_VERSION))
continue;
ssl_set_cert_masks(cert,c);
mask_k = cert->mask_k;
mask_a = cert->mask_a;
emask_k = cert->export_mask_k;
emask_a = cert->export_mask_a;
#ifndef OPENSSL_NO_SRP
mask_k=cert->mask_k | s->srp_ctx.srp_Mask;
emask_k=cert->export_mask_k | s->srp_ctx.srp_Mask;
#endif
#ifdef KSSL_DEBUG
/* printf("ssl3_choose_cipher %d alg= %lx\n", i,c->algorithms);*/
#endif /* KSSL_DEBUG */
alg_k=c->algorithm_mkey;
alg_a=c->algorithm_auth;
#ifndef OPENSSL_NO_KRB5
if (alg_k & SSL_kKRB5)
{
if ( !kssl_keytab_is_available(s->kssl_ctx) )
continue;
}
#endif /* OPENSSL_NO_KRB5 */
#ifndef OPENSSL_NO_PSK
/* with PSK there must be server callback set */
if ((alg_k & SSL_kPSK) && s->psk_server_callback == NULL)
continue;
#endif /* OPENSSL_NO_PSK */
if (SSL_C_IS_EXPORT(c))
{
ok = (alg_k & emask_k) && (alg_a & emask_a);
#ifdef CIPHER_DEBUG
printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",ok,alg_k,alg_a,emask_k,emask_a,
(void *)c,c->name);
#endif
}
else
{
ok = (alg_k & mask_k) && (alg_a & mask_a);
#ifdef CIPHER_DEBUG
printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n",ok,alg_k,alg_a,mask_k,mask_a,(void *)c,
c->name);
#endif
}
#ifndef OPENSSL_NO_TLSEXT
#ifndef OPENSSL_NO_EC
if (
/* if we are considering an ECC cipher suite that uses our certificate */
(alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
/* and we have an ECC certificate */
&& (s->cert->pkeys[SSL_PKEY_ECC].x509 != NULL)
/* and the client specified a Supported Point Formats extension */
&& ((s->session->tlsext_ecpointformatlist_length > 0) && (s->session->tlsext_ecpointformatlist != NULL))
/* and our certificate's point is compressed */
&& (
(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data != NULL)
&& (
(*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data) == POINT_CONVERSION_COMPRESSED)
|| (*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data) == POINT_CONVERSION_COMPRESSED + 1)
)
)
)
{
ec_ok = 0;
/* if our certificate's curve is over a field type that the client does not support
* then do not allow this cipher suite to be negotiated */
if (
(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth != NULL)
&& (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_prime_field)
)
{
for (j = 0; j < s->session->tlsext_ecpointformatlist_length; j++)
{
if (s->session->tlsext_ecpointformatlist[j] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime)
{
ec_ok = 1;
break;
}
}
}
else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_characteristic_two_field)
{
for (j = 0; j < s->session->tlsext_ecpointformatlist_length; j++)
{
if (s->session->tlsext_ecpointformatlist[j] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2)
{
ec_ok = 1;
break;
}
}
}
ok = ok && ec_ok;
}
if (
/* if we are considering an ECC cipher suite that uses our certificate */
(alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
/* and we have an ECC certificate */
&& (s->cert->pkeys[SSL_PKEY_ECC].x509 != NULL)
/* and the client specified an EllipticCurves extension */
&& ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->tlsext_ellipticcurvelist != NULL))
)
{
ec_ok = 0;
if (
(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec != NULL)
&& (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group != NULL)
)
{
ec_nid = EC_GROUP_get_curve_name(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group);
if ((ec_nid == 0)
&& (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth != NULL)
)
{
if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_prime_field)
{
ec_search1 = 0xFF;
ec_search2 = 0x01;
}
else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_characteristic_two_field)
{
ec_search1 = 0xFF;
ec_search2 = 0x02;
}
}
else
{
ec_search1 = 0x00;
ec_search2 = tls1_ec_nid2curve_id(ec_nid);
}
if ((ec_search1 != 0) || (ec_search2 != 0))
{
for (j = 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j++)
{
if ((s->session->tlsext_ellipticcurvelist[2*j] == ec_search1) && (s->session->tlsext_ellipticcurvelist[2*j+1] == ec_search2))
{
ec_ok = 1;
break;
}
}
}
}
ok = ok && ec_ok;
}
if (
/* if we are considering an ECC cipher suite that uses an ephemeral EC key */
(alg_k & SSL_kEECDH)
/* and we have an ephemeral EC key */
&& (s->cert->ecdh_tmp != NULL)
/* and the client specified an EllipticCurves extension */
&& ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->tlsext_ellipticcurvelist != NULL))
)
{
ec_ok = 0;
if (s->cert->ecdh_tmp->group != NULL)
{
ec_nid = EC_GROUP_get_curve_name(s->cert->ecdh_tmp->group);
if ((ec_nid == 0)
&& (s->cert->ecdh_tmp->group->meth != NULL)
)
{
if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) == NID_X9_62_prime_field)
{
ec_search1 = 0xFF;
ec_search2 = 0x01;
}
else if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) == NID_X9_62_characteristic_two_field)
{
ec_search1 = 0xFF;
ec_search2 = 0x02;
}
}
else
{
ec_search1 = 0x00;
ec_search2 = tls1_ec_nid2curve_id(ec_nid);
}
if ((ec_search1 != 0) || (ec_search2 != 0))
{
for (j = 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j++)
{
if ((s->session->tlsext_ellipticcurvelist[2*j] == ec_search1) && (s->session->tlsext_ellipticcurvelist[2*j+1] == ec_search2))
{
ec_ok = 1;
break;
}
}
}
}
ok = ok && ec_ok;
}
#endif /* OPENSSL_NO_EC */
#endif /* OPENSSL_NO_TLSEXT */
if (!ok) continue;
ii=sk_SSL_CIPHER_find(allow,c);
if (ii >= 0)
{
#if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_TLSEXT)
if ((alg_k & SSL_kEECDH) && (alg_a & SSL_aECDSA) && s->s3->is_probably_safari)
{
if (!ret) ret=sk_SSL_CIPHER_value(allow,ii);
continue;
}
#endif
ret=sk_SSL_CIPHER_value(allow,ii);
break;
}
}
return(ret);
}
| 0
|
111,853
|
const char *configEnumGetName(configEnum *ce, int val) {
while(ce->name != NULL) {
if (ce->val == val) return ce->name;
ce++;
}
return NULL;
}
| 0
|
367,410
|
static int selinux_file_mmap(struct file *file, unsigned long reqprot,
unsigned long prot, unsigned long flags,
unsigned long addr, unsigned long addr_only)
{
int rc = 0;
u32 sid = current_sid();
/*
* notice that we are intentionally putting the SELinux check before
* the secondary cap_file_mmap check. This is such a likely attempt
* at bad behaviour/exploit that we always want to get the AVC, even
* if DAC would have also denied the operation.
*/
if (addr < CONFIG_LSM_MMAP_MIN_ADDR) {
rc = avc_has_perm(sid, sid, SECCLASS_MEMPROTECT,
MEMPROTECT__MMAP_ZERO, NULL);
if (rc)
return rc;
}
/* do DAC check on address space usage */
rc = cap_file_mmap(file, reqprot, prot, flags, addr, addr_only);
if (rc || addr_only)
return rc;
if (selinux_checkreqprot)
prot = reqprot;
return file_map_prot_check(file, prot,
(flags & MAP_TYPE) == MAP_SHARED);
}
| 0
|
12,917
|
int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
{
zval **login, **password;
zval **login, **password;
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS &&
!zend_hash_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"))) {
unsigned char* buf;
int len;
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
smart_str_appendc(&auth, ':');
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS) {
smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
}
smart_str_0(&auth);
efree(buf);
smart_str_free(&auth);
return 1;
}
return 0;
}
| 1
|
113,731
|
ca_by_subjectpubkey(X509_STORE *ctx, uint8_t *sig, size_t siglen)
{
STACK_OF(X509_OBJECT) *h;
X509_OBJECT *xo;
X509 *ca;
int i;
unsigned int len;
uint8_t md[EVP_MAX_MD_SIZE];
h = ctx->objs;
for (i = 0; i < sk_X509_OBJECT_num(h); i++) {
xo = sk_X509_OBJECT_value(h, i);
if (xo->type != X509_LU_X509)
continue;
ca = xo->data.x509;
len = sizeof(md);
ca_subjectpubkey_digest(ca, md, &len);
if (len == siglen && memcmp(md, sig, len) == 0)
return (ca);
}
return (NULL);
}
| 0
|
68,142
|
GF_Err rssr_Read(GF_Box *s, GF_BitStream *bs)
{
GF_ReceivedSsrcBox *ptr = (GF_ReceivedSsrcBox *)s;
ptr->ssrc = gf_bs_read_u32(bs);
return GF_OK;
}
| 0
|
338,141
|
static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
int x, int y, int w, int h)
{
DisplaySurface *surface = qemu_console_surface(s->vga.con);
int line;
int bypl;
int width;
int start;
uint8_t *src;
uint8_t *dst;
if (x < 0) {
fprintf(stderr, "%s: update x was < 0 (%d)\n", __func__, x);
w += x;
x = 0;
}
if (w < 0) {
fprintf(stderr, "%s: update w was < 0 (%d)\n", __func__, w);
w = 0;
}
if (x + w > surface_width(surface)) {
fprintf(stderr, "%s: update width too large x: %d, w: %d\n",
__func__, x, w);
x = MIN(x, surface_width(surface));
w = surface_width(surface) - x;
}
if (y < 0) {
fprintf(stderr, "%s: update y was < 0 (%d)\n", __func__, y);
h += y;
y = 0;
}
if (h < 0) {
fprintf(stderr, "%s: update h was < 0 (%d)\n", __func__, h);
h = 0;
}
if (y + h > surface_height(surface)) {
fprintf(stderr, "%s: update height too large y: %d, h: %d\n",
__func__, y, h);
y = MIN(y, surface_height(surface));
h = surface_height(surface) - y;
}
bypl = surface_stride(surface);
width = surface_bytes_per_pixel(surface) * w;
start = surface_bytes_per_pixel(surface) * x + bypl * y;
src = s->vga.vram_ptr + start;
dst = surface_data(surface) + start;
for (line = h; line > 0; line--, src += bypl, dst += bypl) {
memcpy(dst, src, width);
}
dpy_gfx_update(s->vga.con, x, y, w, h);
}
| 1
|
401,055
|
static int cirrus_vga_read_gr(CirrusVGAState * s, unsigned reg_index)
{
switch (reg_index) {
case 0x00: // Standard VGA, BGCOLOR 0x000000ff
return s->cirrus_shadow_gr0;
case 0x01: // Standard VGA, FGCOLOR 0x000000ff
return s->cirrus_shadow_gr1;
case 0x02: // Standard VGA
case 0x03: // Standard VGA
case 0x04: // Standard VGA
case 0x06: // Standard VGA
case 0x07: // Standard VGA
case 0x08: // Standard VGA
return s->vga.gr[s->vga.gr_index];
case 0x05: // Standard VGA, Cirrus extended mode
default:
break;
}
if (reg_index < 0x3a) {
return s->vga.gr[reg_index];
} else {
#ifdef DEBUG_CIRRUS
printf("cirrus: inport gr_index %02x\n", reg_index);
#endif
return 0xff;
}
}
| 0
|
172,759
|
BackgroundContents* BackgroundContentsService::GetAppBackgroundContents(
const string16& application_id) {
BackgroundContentsMap::const_iterator it = contents_map_.find(application_id);
return (it != contents_map_.end()) ? it->second.contents : NULL;
}
| 0
|
522,402
|
TABLE_LIST *st_select_lex::end_nested_join(THD *thd)
{
TABLE_LIST *ptr;
NESTED_JOIN *nested_join;
DBUG_ENTER("end_nested_join");
DBUG_ASSERT(embedding);
ptr= embedding;
join_list= ptr->join_list;
embedding= ptr->embedding;
nested_join= ptr->nested_join;
nested_join->nest_type= 0;
if (nested_join->join_list.elements == 1)
{
TABLE_LIST *embedded= nested_join->join_list.head();
join_list->pop();
embedded->join_list= join_list;
embedded->embedding= embedding;
join_list->push_front(embedded, thd->mem_root);
ptr= embedded;
embedded->lifted= 1;
if (embedded->nested_join)
embedded->nested_join->nest_type= 0;
}
else if (nested_join->join_list.elements == 0)
{
join_list->pop();
ptr= 0; // return value
}
DBUG_RETURN(ptr);
}
| 0
|
109,474
|
static int vcf_idx_init(htsFile *fp, bcf_hdr_t *h, int min_shift, const char *fnidx) {
int n_lvls, fmt;
if (min_shift == 0) {
min_shift = 14;
n_lvls = 5;
fmt = HTS_FMT_TBI;
} else {
// Set initial n_lvls to match tbx_index()
int starting_n_lvls = (TBX_MAX_SHIFT - min_shift + 2) / 3;
// Increase if necessary
n_lvls = idx_calc_n_lvls_ids(h, min_shift, starting_n_lvls, NULL);
fmt = HTS_FMT_CSI;
}
fp->idx = hts_idx_init(0, fmt, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);
if (!fp->idx) return -1;
// Tabix meta data, added even in CSI for VCF
uint8_t conf[4*7];
u32_to_le(TBX_VCF, conf+0); // fmt
u32_to_le(1, conf+4); // name col
u32_to_le(2, conf+8); // beg col
u32_to_le(0, conf+12); // end col
u32_to_le('#', conf+16); // comment
u32_to_le(0, conf+20); // n.skip
u32_to_le(0, conf+24); // ref name len
if (hts_idx_set_meta(fp->idx, sizeof(conf)*sizeof(*conf), (uint8_t *)conf, 1) < 0) {
hts_idx_destroy(fp->idx);
fp->idx = NULL;
return -1;
}
fp->fnidx = fnidx;
return 0;
}
| 0
|
181,238
|
void RenderView::DidInitiatePaint() {
pepper_delegate_.ViewInitiatedPaint();
for (std::set<WebPluginDelegatePepper*>::iterator i =
current_oldstyle_pepper_plugins_.begin();
i != current_oldstyle_pepper_plugins_.end(); ++i)
(*i)->RenderViewInitiatedPaint();
}
| 0
|
502,061
|
static int replmd_process_backlink(struct ldb_module *module, struct la_backlink *bl, struct ldb_request *parent)
{
struct ldb_dn *target_dn, *source_dn;
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct ldb_message *msg;
TALLOC_CTX *frame = talloc_stackframe();
char *dn_string;
/*
- find DN of target
- find DN of source
- construct ldb_message
- either an add or a delete
*/
ret = dsdb_module_dn_by_guid(module, frame, &bl->target_guid, &target_dn, parent);
if (ret != LDB_SUCCESS) {
struct GUID_txt_buf guid_str;
DBG_WARNING("Failed to find target DN for linked attribute with GUID %s\n",
GUID_buf_string(&bl->target_guid, &guid_str));
DBG_WARNING("Please run 'samba-tool dbcheck' to resolve any missing backlinks.\n");
talloc_free(frame);
return LDB_SUCCESS;
}
msg = ldb_msg_new(frame);
if (msg == NULL) {
ldb_module_oom(module);
talloc_free(frame);
return LDB_ERR_OPERATIONS_ERROR;
}
source_dn = ldb_dn_copy(frame, bl->forward_dn);
if (!source_dn) {
ldb_module_oom(module);
talloc_free(frame);
return LDB_ERR_OPERATIONS_ERROR;
} else {
/* Filter down to the attributes we want in the backlink */
const char *accept[] = { "GUID", "SID", NULL };
ldb_dn_extended_filter(source_dn, accept);
}
/* construct a ldb_message for adding/deleting the backlink */
msg->dn = target_dn;
dn_string = ldb_dn_get_extended_linearized(frame, bl->forward_dn, 1);
if (!dn_string) {
ldb_module_oom(module);
talloc_free(frame);
return LDB_ERR_OPERATIONS_ERROR;
}
ret = ldb_msg_add_steal_string(msg, bl->attr_name, dn_string);
if (ret != LDB_SUCCESS) {
talloc_free(frame);
return ret;
}
msg->elements[0].flags = bl->active?LDB_FLAG_MOD_ADD:LDB_FLAG_MOD_DELETE;
/* a backlink should never be single valued. Unfortunately the
exchange schema has a attribute
msExchBridgeheadedLocalConnectorsDNBL which is single
valued and a backlink. We need to cope with that by
ignoring the single value flag */
msg->elements[0].flags |= LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK;
ret = dsdb_module_modify(module, msg, DSDB_FLAG_NEXT_MODULE, parent);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE && !bl->active) {
/* we allow LDB_ERR_NO_SUCH_ATTRIBUTE as success to
cope with possible corruption where the backlink has
already been removed */
DEBUG(3,("WARNING: backlink from %s already removed from %s - %s\n",
ldb_dn_get_linearized(target_dn),
ldb_dn_get_linearized(source_dn),
ldb_errstring(ldb)));
ret = LDB_SUCCESS;
} else if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(ldb, "Failed to %s backlink from %s to %s - %s",
bl->active?"add":"remove",
ldb_dn_get_linearized(source_dn),
ldb_dn_get_linearized(target_dn),
ldb_errstring(ldb));
talloc_free(frame);
return ret;
}
talloc_free(frame);
return ret;
}
| 0
|
470,379
|
void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b) {
assert(b);
AVAHI_LLIST_REMOVE(AvahiSServiceTypeBrowser, browser, b->server->service_type_browsers, b);
if (b->record_browser)
avahi_s_record_browser_free(b->record_browser);
avahi_free(b->domain_name);
avahi_free(b);
}
| 0
|
95,051
|
static void tracked_request_end(BdrvTrackedRequest *req)
{
if (req->serialising) {
req->bs->serialising_in_flight--;
}
QLIST_REMOVE(req, list);
qemu_co_queue_restart_all(&req->wait_queue);
}
| 0
|
402,756
|
static MagickBooleanType ReadPSDChannelZip(Image *image,const size_t channels,
const ssize_t type,const PSDCompressionType compression,
const size_t compact_size,ExceptionInfo *exception)
{
MagickBooleanType
status;
register unsigned char
*p;
size_t
count,
length,
packet_size,
row_size;
ssize_t
y;
unsigned char
*compact_pixels,
*pixels;
z_stream
stream;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" layer data is ZIP compressed");
compact_pixels=(unsigned char *) AcquireQuantumMemory(compact_size,
sizeof(*compact_pixels));
if (compact_pixels == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
packet_size=GetPSDPacketSize(image);
row_size=image->columns*packet_size;
count=image->rows*row_size;
pixels=(unsigned char *) AcquireQuantumMemory(count,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
{
compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
ResetMagickMemory(&stream,0,sizeof(stream));
stream.data_type=Z_BINARY;
(void) ReadBlob(image,compact_size,compact_pixels);
stream.next_in=(Bytef *)compact_pixels;
stream.avail_in=(uInt) compact_size;
stream.next_out=(Bytef *)pixels;
stream.avail_out=(uInt) count;
if (inflateInit(&stream) == Z_OK)
{
int
ret;
while (stream.avail_out > 0)
{
ret=inflate(&stream,Z_SYNC_FLUSH);
if ((ret != Z_OK) && (ret != Z_STREAM_END))
{
(void) inflateEnd(&stream);
compact_pixels=(unsigned char *) RelinquishMagickMemory(
compact_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(MagickFalse);
}
}
(void) inflateEnd(&stream);
}
if (compression == ZipWithPrediction)
{
p=pixels;
while (count > 0)
{
length=image->columns;
while (--length)
{
if (packet_size == 2)
{
p[2]+=p[0]+((p[1]+p[3]) >> 8);
p[3]+=p[1];
}
else
*(p+1)+=*p;
p+=packet_size;
}
p+=packet_size;
count-=row_size;
}
}
status=MagickTrue;
p=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
status=ReadPSDChannelPixels(image,channels,y,type,p,exception);
if (status == MagickFalse)
break;
p+=row_size;
}
compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(status);
}
| 0
|
375,632
|
make_directory(const char *dir)
{
if (mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO) < 0)
{
fprintf(stderr, _("%s: could not create directory \"%s\": %s\n"),
progname, dir, strerror(errno));
exit(2);
}
}
| 0
|
233,084
|
bool ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Frame_Resource_Request* request)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, true);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, true);
if (!smartData->api->navigation_policy_decision)
return true;
return smartData->api->navigation_policy_decision(smartData, request);
}
| 0
|
416,798
|
void show_opcodes(struct pt_regs *regs, const char *loglvl)
{
#define PROLOGUE_SIZE 42
#define EPILOGUE_SIZE 21
#define OPCODE_BUFSIZE (PROLOGUE_SIZE + 1 + EPILOGUE_SIZE)
u8 opcodes[OPCODE_BUFSIZE];
unsigned long prologue = regs->ip - PROLOGUE_SIZE;
bool bad_ip;
/*
* Make sure userspace isn't trying to trick us into dumping kernel
* memory by pointing the userspace instruction pointer at it.
*/
bad_ip = user_mode(regs) &&
__chk_range_not_ok(prologue, OPCODE_BUFSIZE, TASK_SIZE_MAX);
if (bad_ip || probe_kernel_read(opcodes, (u8 *)prologue,
OPCODE_BUFSIZE)) {
printk("%sCode: Bad RIP value.\n", loglvl);
} else {
printk("%sCode: %" __stringify(PROLOGUE_SIZE) "ph <%02x> %"
__stringify(EPILOGUE_SIZE) "ph\n", loglvl, opcodes,
opcodes[PROLOGUE_SIZE], opcodes + PROLOGUE_SIZE + 1);
}
}
| 0
|
388,586
|
static void qmp_query_auth(VncDisplay *vd, VncInfo2 *info)
{
switch (vd->auth) {
case VNC_AUTH_VNC:
info->auth = VNC_PRIMARY_AUTH_VNC;
break;
case VNC_AUTH_RA2:
info->auth = VNC_PRIMARY_AUTH_RA2;
break;
case VNC_AUTH_RA2NE:
info->auth = VNC_PRIMARY_AUTH_RA2NE;
break;
case VNC_AUTH_TIGHT:
info->auth = VNC_PRIMARY_AUTH_TIGHT;
break;
case VNC_AUTH_ULTRA:
info->auth = VNC_PRIMARY_AUTH_ULTRA;
break;
case VNC_AUTH_TLS:
info->auth = VNC_PRIMARY_AUTH_TLS;
break;
case VNC_AUTH_VENCRYPT:
info->auth = VNC_PRIMARY_AUTH_VENCRYPT;
info->has_vencrypt = true;
switch (vd->subauth) {
case VNC_AUTH_VENCRYPT_PLAIN:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_PLAIN;
break;
case VNC_AUTH_VENCRYPT_TLSNONE:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_TLS_NONE;
break;
case VNC_AUTH_VENCRYPT_TLSVNC:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_TLS_VNC;
break;
case VNC_AUTH_VENCRYPT_TLSPLAIN:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_TLS_PLAIN;
break;
case VNC_AUTH_VENCRYPT_X509NONE:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_X509_NONE;
break;
case VNC_AUTH_VENCRYPT_X509VNC:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_X509_VNC;
break;
case VNC_AUTH_VENCRYPT_X509PLAIN:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_X509_PLAIN;
break;
case VNC_AUTH_VENCRYPT_TLSSASL:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_TLS_SASL;
break;
case VNC_AUTH_VENCRYPT_X509SASL:
info->vencrypt = VNC_VENCRYPT_SUB_AUTH_X509_SASL;
break;
default:
info->has_vencrypt = false;
break;
}
break;
case VNC_AUTH_SASL:
info->auth = VNC_PRIMARY_AUTH_SASL;
break;
case VNC_AUTH_NONE:
default:
info->auth = VNC_PRIMARY_AUTH_NONE;
break;
}
}
| 0
|
130,230
|
TEST_F(QuotedString_ExtractFrom_Tests, EscapedSolidus) {
whenInputIs("\"hello \\/world\\/\"");
resultMustBe("hello /world/");
}
| 0
|
209,332
|
static PHP_FUNCTION(gzfile)
{
char *filename;
int filename_len;
int flags = REPORT_ERRORS;
char buf[8192] = {0};
register int i = 0;
long use_include_path = 0;
php_stream *stream;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) {
return;
}
if (use_include_path) {
flags |= USE_PATH;
}
/* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */
stream = php_stream_gzopen(NULL, filename, "rb", flags, NULL, NULL STREAMS_CC TSRMLS_CC);
if (!stream) {
/* Error reporting is already done by stream code */
RETURN_FALSE;
}
/* Initialize return array */
array_init(return_value);
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf, 0, sizeof(buf));
while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
add_index_string(return_value, i++, buf, 1);
}
php_stream_close(stream);
}
| 0
|
306,605
|
void CLASS eight_bit_load_raw()
{
uchar *pixel;
unsigned row, col;
pixel = (uchar *) calloc (raw_width, sizeof *pixel);
merror (pixel, "eight_bit_load_raw()");
#ifdef LIBRAW_LIBRARY_BUILD
try {
#endif
for (row=0; row < raw_height; row++) {
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
if (fread (pixel, 1, raw_width, ifp) < raw_width) derror();
for (col=0; col < raw_width; col++)
RAW(row,col) = curve[pixel[col]];
}
#ifdef LIBRAW_LIBRARY_BUILD
} catch(...) {
free (pixel);
throw;
}
#endif
free (pixel);
maximum = curve[0xff];
}
| 0
|
393,329
|
xmlRelaxNGValidateAttribute(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGDefinePtr define)
{
int ret = 0, i;
xmlChar *value, *oldvalue;
xmlAttrPtr prop = NULL, tmp;
xmlNodePtr oldseq;
if (ctxt->state->nbAttrLeft <= 0)
return (-1);
if (define->name != NULL) {
for (i = 0; i < ctxt->state->nbAttrs; i++) {
tmp = ctxt->state->attrs[i];
if ((tmp != NULL) && (xmlStrEqual(define->name, tmp->name))) {
if ((((define->ns == NULL) || (define->ns[0] == 0)) &&
(tmp->ns == NULL)) ||
((tmp->ns != NULL) &&
(xmlStrEqual(define->ns, tmp->ns->href)))) {
prop = tmp;
break;
}
}
}
if (prop != NULL) {
value = xmlNodeListGetString(prop->doc, prop->children, 1);
oldvalue = ctxt->state->value;
oldseq = ctxt->state->seq;
ctxt->state->seq = (xmlNodePtr) prop;
ctxt->state->value = value;
ctxt->state->endvalue = NULL;
ret = xmlRelaxNGValidateValueContent(ctxt, define->content);
if (ctxt->state->value != NULL)
value = ctxt->state->value;
if (value != NULL)
xmlFree(value);
ctxt->state->value = oldvalue;
ctxt->state->seq = oldseq;
if (ret == 0) {
/*
* flag the attribute as processed
*/
ctxt->state->attrs[i] = NULL;
ctxt->state->nbAttrLeft--;
}
} else {
ret = -1;
}
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,
"xmlRelaxNGValidateAttribute(%s): %d\n",
define->name, ret);
#endif
} else {
for (i = 0; i < ctxt->state->nbAttrs; i++) {
tmp = ctxt->state->attrs[i];
if ((tmp != NULL) &&
(xmlRelaxNGAttributeMatch(ctxt, define, tmp) == 1)) {
prop = tmp;
break;
}
}
if (prop != NULL) {
value = xmlNodeListGetString(prop->doc, prop->children, 1);
oldvalue = ctxt->state->value;
oldseq = ctxt->state->seq;
ctxt->state->seq = (xmlNodePtr) prop;
ctxt->state->value = value;
ret = xmlRelaxNGValidateValueContent(ctxt, define->content);
if (ctxt->state->value != NULL)
value = ctxt->state->value;
if (value != NULL)
xmlFree(value);
ctxt->state->value = oldvalue;
ctxt->state->seq = oldseq;
if (ret == 0) {
/*
* flag the attribute as processed
*/
ctxt->state->attrs[i] = NULL;
ctxt->state->nbAttrLeft--;
}
} else {
ret = -1;
}
#ifdef DEBUG
if (define->ns != NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlRelaxNGValidateAttribute(nsName ns = %s): %d\n",
define->ns, ret);
} else {
xmlGenericError(xmlGenericErrorContext,
"xmlRelaxNGValidateAttribute(anyName): %d\n",
ret);
}
#endif
}
return (ret);
}
| 0
|
109,645
|
PyInit__ast3(void)
{
PyObject *m, *d;
if (!init_types()) return NULL;
m = PyModule_Create(&_astmodule);
if (!m) return NULL;
d = PyModule_GetDict(m);
if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return NULL;
if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)
return NULL;
if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) <
0) return NULL;
if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "FunctionType", (PyObject*)FunctionType_type) <
0) return NULL;
if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return NULL;
if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type) <
0) return NULL;
if (PyDict_SetItemString(d, "AsyncFunctionDef",
(PyObject*)AsyncFunctionDef_type) < 0) return NULL;
if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "AnnAssign", (PyObject*)AnnAssign_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return NULL;
if (PyDict_SetItemString(d, "AsyncFor", (PyObject*)AsyncFor_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return NULL;
if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return NULL;
if (PyDict_SetItemString(d, "AsyncWith", (PyObject*)AsyncWith_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Try", (PyObject*)Try_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Nonlocal", (PyObject*)Nonlocal_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return NULL;
if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Set", (PyObject*)Set_type) < 0) return NULL;
if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "SetComp", (PyObject*)SetComp_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "DictComp", (PyObject*)DictComp_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "GeneratorExp", (PyObject*)GeneratorExp_type) <
0) return NULL;
if (PyDict_SetItemString(d, "Await", (PyObject*)Await_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "YieldFrom", (PyObject*)YieldFrom_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return NULL;
if (PyDict_SetItemString(d, "FormattedValue",
(PyObject*)FormattedValue_type) < 0) return NULL;
if (PyDict_SetItemString(d, "JoinedStr", (PyObject*)JoinedStr_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Bytes", (PyObject*)Bytes_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "NameConstant", (PyObject*)NameConstant_type) <
0) return NULL;
if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Constant", (PyObject*)Constant_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Starred", (PyObject*)Starred_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return NULL;
if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "expr_context", (PyObject*)expr_context_type) <
0) return NULL;
if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return NULL;
if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return NULL;
if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return NULL;
if (PyDict_SetItemString(d, "MatMult", (PyObject*)MatMult_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return NULL;
if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return NULL;
if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return NULL;
if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return NULL;
if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return NULL;
if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return NULL;
if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return NULL;
if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return NULL;
if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return NULL;
if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "comprehension", (PyObject*)comprehension_type)
< 0) return NULL;
if (PyDict_SetItemString(d, "excepthandler", (PyObject*)excepthandler_type)
< 0) return NULL;
if (PyDict_SetItemString(d, "ExceptHandler", (PyObject*)ExceptHandler_type)
< 0) return NULL;
if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "arg", (PyObject*)arg_type) < 0) return NULL;
if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "withitem", (PyObject*)withitem_type) < 0)
return NULL;
if (PyDict_SetItemString(d, "type_ignore", (PyObject*)type_ignore_type) <
0) return NULL;
if (PyDict_SetItemString(d, "TypeIgnore", (PyObject*)TypeIgnore_type) < 0)
return NULL;
return m;
}
| 0
|
25,440
|
inline static HTTPKeepAlive is_header_keep_alive ( const HTTPVersion & http_version , const MIMEField * con_hdr ) {
enum {
CON_TOKEN_NONE = 0 , CON_TOKEN_KEEP_ALIVE , CON_TOKEN_CLOSE , }
;
int con_token = CON_TOKEN_NONE ;
HTTPKeepAlive keep_alive = HTTP_NO_KEEPALIVE ;
if ( con_hdr ) {
if ( con_hdr -> value_get_index ( "keep-alive" , 10 ) >= 0 ) con_token = CON_TOKEN_KEEP_ALIVE ;
else if ( con_hdr -> value_get_index ( "close" , 5 ) >= 0 ) con_token = CON_TOKEN_CLOSE ;
}
if ( HTTPVersion ( 1 , 0 ) == http_version ) {
keep_alive = ( con_token == CON_TOKEN_KEEP_ALIVE ) ? ( HTTP_KEEPALIVE ) : ( HTTP_NO_KEEPALIVE ) ;
}
else if ( HTTPVersion ( 1 , 1 ) == http_version ) {
keep_alive = ( ( con_token == CON_TOKEN_KEEP_ALIVE ) || ( con_token == CON_TOKEN_NONE && HTTPVersion ( 1 , 1 ) == http_version ) ) ? ( HTTP_KEEPALIVE ) : ( HTTP_NO_KEEPALIVE ) ;
}
else {
keep_alive = HTTP_NO_KEEPALIVE ;
}
return ( keep_alive ) ;
}
| 0
|
280,474
|
omx_video::omx_c2d_conv::omx_c2d_conv()
{
c2dcc = NULL;
mLibHandle = NULL;
mConvertOpen = NULL;
mConvertClose = NULL;
src_format = NV12_128m;
pthread_mutex_init(&c_lock, NULL);
}
| 0
|
201,990
|
bool OmniboxViewViews::TextAndUIDirectionMatch() const {
return (GetRenderText()->GetDisplayTextDirection() ==
base::i18n::RIGHT_TO_LEFT) == base::i18n::IsRTL();
}
| 0
|
124,163
|
int nfc_llcp_queue_i_frames(struct nfc_llcp_sock *sock)
{
int nr_frames = 0;
struct nfc_llcp_local *local = sock->local;
pr_debug("Remote ready %d tx queue len %d remote rw %d",
sock->remote_ready, skb_queue_len(&sock->tx_pending_queue),
sock->remote_rw);
/* Try to queue some I frames for transmission */
while (sock->remote_ready &&
skb_queue_len(&sock->tx_pending_queue) < sock->remote_rw) {
struct sk_buff *pdu;
pdu = skb_dequeue(&sock->tx_queue);
if (pdu == NULL)
break;
/* Update N(S)/N(R) */
nfc_llcp_set_nrns(sock, pdu);
skb_queue_tail(&local->tx_queue, pdu);
nr_frames++;
}
return nr_frames;
}
| 0
|
63,679
|
g_NPN_ReleaseObject(NPObject *npobj)
{
if (!thread_check()) {
npw_printf("WARNING: NPN_ReleaseObject not called from the main thread\n");
return;
}
if (npobj == NULL)
return;
if (rpc_method_invoke_possible(g_rpc_connection)) {
D(bug("NPN_ReleaseObject <now>\n"));
g_NPN_ReleaseObject_Now(npobj);
}
else {
D(bug("NPN_ReleaseObject <delayed>\n"));
g_NPN_ReleaseObject_Delayed(npobj);
}
}
| 0
|
463,832
|
int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
const struct btrfs_key *cpu_key, u32 *data_size,
int nr)
{
int ret = 0;
int slot;
int i;
u32 total_size = 0;
u32 total_data = 0;
for (i = 0; i < nr; i++)
total_data += data_size[i];
total_size = total_data + (nr * sizeof(struct btrfs_item));
ret = btrfs_search_slot(trans, root, cpu_key, path, total_size, 1);
if (ret == 0)
return -EEXIST;
if (ret < 0)
return ret;
slot = path->slots[0];
BUG_ON(slot < 0);
setup_items_for_insert(root, path, cpu_key, data_size, nr);
return 0;
}
| 0
|
139,966
|
int av_parse_cpu_flags(const char *s)
{
#define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV)
#define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX)
#define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW)
#define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT)
#define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE)
#define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2)
#define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2)
#define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3)
#define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3)
#define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3)
#define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4)
#define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42)
#define CPUFLAG_AVXSLOW (AV_CPU_FLAG_AVXSLOW | CPUFLAG_AVX)
#define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX)
#define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX)
#define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
#define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX)
#define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1)
static const AVOption cpuflags_opts[] = {
{ "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
#if ARCH_PPC
{ "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" },
#elif ARCH_X86
{ "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" },
{ "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" },
{ "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" },
{ "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" },
{ "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" },
{ "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" },
{ "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" },
{ "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" },
{ "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" },
{ "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" },
{ "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" },
{ "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" },
{ "avxslow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVXSLOW }, .unit = "flags" },
{ "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" },
{ "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "flags" },
{ "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" },
{ "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" },
{ "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "flags" },
{ "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "flags" },
{ "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" },
{ "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" },
{ "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" },
#elif ARCH_ARM
{ "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" },
{ "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" },
{ "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" },
{ "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
{ "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" },
{ "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
#elif ARCH_AARCH64
{ "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "flags" },
{ "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
{ "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
#endif
{ NULL },
};
static const AVClass class = {
.class_name = "cpuflags",
.item_name = av_default_item_name,
.option = cpuflags_opts,
.version = LIBAVUTIL_VERSION_INT,
};
int flags = 0, ret;
const AVClass *pclass = &class;
if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0)
return ret;
return flags & INT_MAX;
}
| 1
|
370,156
|
int sctp_outq_is_empty(const struct sctp_outq *q)
{
return q->empty;
}
| 0
|
267,671
|
const Handle<StringPrimitive> &strPrim() const {
assert(isHandle_ && "must be a handle");
// Need to go through a variable to placate gcc4.9.
const char *buffer = strPrim_.buffer;
return *reinterpret_cast<const Handle<StringPrimitive> *>(buffer);
}
| 0
|
257,240
|
static void prep_NVRAM_init ( void ) {
m48t59_t * nvram ;
nvram = m48t59_init ( 8 , 0x0074 , NVRAM_SIZE ) ;
NVRAM_set_word ( nvram , 0x00 , NVRAM_SIZE >> 10 ) ;
NVRAM_set_byte ( nvram , 0x02 , 0x01 ) ;
NVRAM_set_byte ( nvram , 0x03 , 0x01 ) ;
NVRAM_set_byte ( nvram , 0x08 , 0x00 ) ;
NVRAM_set_byte ( nvram , 0x09 , 'B' ) ;
NVRAM_set_byte ( nvram , 0x0A , 0x00 ) ;
NVRAM_set_byte ( nvram , 0x0B , 0x00 ) ;
NVRAM_set_word ( nvram , 0x0C , 0x01 ) ;
NVRAM_set_word ( nvram , 0x0E , 0x01 ) ;
NVRAM_set_lword ( nvram , 0x20 , 0x00 ) ;
NVRAM_set_lword ( nvram , 0x24 , 0x00 ) ;
NVRAM_set_lword ( nvram , 0x28 , 0x00 ) ;
NVRAM_set_crc ( nvram , 0x1C , 0x0C , 32 ) ;
NVRAM_set_lword ( nvram , 0xC4 , 0x0100 ) ;
NVRAM_set_lword ( nvram , 0xC8 , NVRAM_END - NVRAM_OSAREA_SIZE - NVRAM_CONFSIZE - 0x0100 ) ;
NVRAM_set_lword ( nvram , 0xD4 , NVRAM_END - NVRAM_CONFSIZE ) ;
NVRAM_set_lword ( nvram , 0xD8 , NVRAM_CONFSIZE ) ;
NVRAM_set_lword ( nvram , 0xE8 , NVRAM_END - NVRAM_CONFSIZE - NVRAM_OSAREA_SIZE ) ;
NVRAM_set_lword ( nvram , 0xEC , NVRAM_OSAREA_SIZE ) ;
NVRAM_set_crc ( nvram , 0x04 , 0x00 , NVRAM_END - NVRAM_CONFSIZE - NVRAM_OSAREA_SIZE ) ;
NVRAM_set_crc ( nvram , 0x06 , NVRAM_END - NVRAM_CONFSIZE , NVRAM_CONFSIZE ) ;
}
| 0
|
174,473
|
void DeleteTexture() {
if (texture_id_) {
host_context_->deleteTexture(texture_id_);
texture_id_ = 0;
}
}
| 0
|
503,982
|
static int _sqlite3_escape_str(char *to, const char *from)
{
char s;
while ( (s = *from++) != '\0' ) {
if (s == '\'' || s == '\\') {
*to++ = '\\';
}
*to++ = s;
}
*to = '\0';
return 0;
}
| 0
|
268,264
|
void imap_unmunge_mbox_name(bool unicode, char *s)
{
imap_unquote_string(s);
char *buf = mutt_str_dup(s);
if (buf)
{
imap_utf_decode(unicode, &buf);
strncpy(s, buf, strlen(s));
}
FREE(&buf);
}
| 0
|
175,414
|
static void vrend_hw_emit_framebuffer_state(struct vrend_context *ctx)
{
static const GLenum buffers[8] = {
GL_COLOR_ATTACHMENT0_EXT,
GL_COLOR_ATTACHMENT1_EXT,
GL_COLOR_ATTACHMENT2_EXT,
GL_COLOR_ATTACHMENT3_EXT,
GL_COLOR_ATTACHMENT4_EXT,
GL_COLOR_ATTACHMENT5_EXT,
GL_COLOR_ATTACHMENT6_EXT,
GL_COLOR_ATTACHMENT7_EXT,
};
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ctx->sub->fb_id);
if (ctx->sub->nr_cbufs == 0) {
glReadBuffer(GL_NONE);
glDisable(GL_FRAMEBUFFER_SRGB_EXT);
} else {
struct vrend_surface *surf = NULL;
int i;
for (i = 0; i < ctx->sub->nr_cbufs; i++) {
if (ctx->sub->surf[i]) {
surf = ctx->sub->surf[i];
}
}
if (util_format_is_srgb(surf->format)) {
glEnable(GL_FRAMEBUFFER_SRGB_EXT);
} else {
glDisable(GL_FRAMEBUFFER_SRGB_EXT);
}
}
glDrawBuffers(ctx->sub->nr_cbufs, buffers);
}
| 0
|
267,002
|
static inline int mxf_read_utf16_string(AVIOContext *pb, int size, char** str, int be)
{
int ret;
size_t buf_size;
if (size < 0)
return AVERROR(EINVAL);
buf_size = size + size / 2 + 1;
*str = av_malloc(buf_size);
if (!*str)
return AVERROR(ENOMEM);
if (be)
ret = avio_get_str16be(pb, size, *str, buf_size);
else
ret = avio_get_str16le(pb, size, *str, buf_size);
if (ret < 0) {
av_freep(str);
return ret;
}
return ret;
}
| 1
|
210,703
|
bool IsMarked() const {
return HeapObjectHeader::FromPayload(this)->IsMarked();
}
| 0
|
236,585
|
AutoLockOnValidThread(base::Lock& lock, base::ThreadChecker* thread_checker)
: auto_lock_(lock) {
DCHECK(!thread_checker || thread_checker->CalledOnValidThread());
}
| 0
|
327,353
|
static DWORD WINAPI do_suspend(LPVOID opaque)
{
GuestSuspendMode *mode = opaque;
DWORD ret = 0;
if (!SetSuspendState(*mode == GUEST_SUSPEND_MODE_DISK, TRUE, TRUE)) {
slog("failed to suspend guest, %s", GetLastError());
ret = -1;
}
g_free(mode);
return ret;
}
| 1
|
130,203
|
static int unlock_futex_pi(u32 __user *uaddr, u32 uval)
{
u32 oldval;
/*
* There is no waiter, so we unlock the futex. The owner died
* bit has not to be preserved here. We are the owner:
*/
oldval = cmpxchg_futex_value_locked(uaddr, uval, 0);
if (oldval == -EFAULT)
return oldval;
if (oldval != uval)
return -EAGAIN;
return 0;
}
| 0
|
28,885
|
static int pack_options_allow_reuse ( void ) {
return allow_ofs_delta ;
}
| 0
|
346,754
|
static int tstats_open(struct inode *inode, struct file *filp)
{
return single_open(filp, tstats_show, NULL);
}
| 1
|
4,628
|
QStringList JlCompress::extractDir(QuaZip &zip, const QString &dir)
{
if(!zip.open(QuaZip::mdUnzip)) {
return QStringList();
}
QDir directory(dir);
QStringList extracted;
if (!zip.goToFirstFile()) {
return QStringList();
}
do {
QString name = zip.getCurrentFileName();
QString absFilePath = directory.absoluteFilePath(name);
if (!extractFile(&zip, "", absFilePath)) {
removeFile(extracted);
return QStringList();
}
extracted.append(absFilePath);
} while (zip.goToNextFile());
// Chiudo il file zip
zip.close();
if(zip.getZipError()!=0) {
removeFile(extracted);
return QStringList();
}
return extracted;
}
| 1
|
494,490
|
static CURLcode inflate_stream(struct Curl_easy *data,
struct contenc_writer *writer,
zlibInitState started)
{
struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
uInt nread = z->avail_in;
Bytef *orig_in = z->next_in;
bool done = FALSE;
CURLcode result = CURLE_OK; /* Curl_client_write status */
char *decomp; /* Put the decompressed data here. */
/* Check state. */
if(zp->zlib_init != ZLIB_INIT &&
zp->zlib_init != ZLIB_INFLATING &&
zp->zlib_init != ZLIB_INIT_GZIP &&
zp->zlib_init != ZLIB_GZIP_INFLATING)
return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR);
/* Dynamically allocate a buffer for decompression because it's uncommonly
large to hold on the stack */
decomp = malloc(DSIZ);
if(!decomp)
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
/* because the buffer size is fixed, iteratively decompress and transfer to
the client via downstream_write function. */
while(!done) {
int status; /* zlib status */
done = TRUE;
/* (re)set buffer for decompressed output for every iteration */
z->next_out = (Bytef *) decomp;
z->avail_out = DSIZ;
#ifdef Z_BLOCK
/* Z_BLOCK is only available in zlib ver. >= 1.2.0.5 */
status = inflate(z, Z_BLOCK);
#else
/* fallback for zlib ver. < 1.2.0.5 */
status = inflate(z, Z_SYNC_FLUSH);
#endif
/* Flush output data if some. */
if(z->avail_out != DSIZ) {
if(status == Z_OK || status == Z_STREAM_END) {
zp->zlib_init = started; /* Data started. */
result = Curl_unencode_write(data, writer->downstream, decomp,
DSIZ - z->avail_out);
if(result) {
exit_zlib(data, z, &zp->zlib_init, result);
break;
}
}
}
/* Dispatch by inflate() status. */
switch(status) {
case Z_OK:
/* Always loop: there may be unflushed latched data in zlib state. */
done = FALSE;
break;
case Z_BUF_ERROR:
/* No more data to flush: just exit loop. */
break;
case Z_STREAM_END:
result = process_trailer(data, zp);
break;
case Z_DATA_ERROR:
/* some servers seem to not generate zlib headers, so this is an attempt
to fix and continue anyway */
if(zp->zlib_init == ZLIB_INIT) {
/* Do not use inflateReset2(): only available since zlib 1.2.3.4. */
(void) inflateEnd(z); /* don't care about the return code */
if(inflateInit2(z, -MAX_WBITS) == Z_OK) {
z->next_in = orig_in;
z->avail_in = nread;
zp->zlib_init = ZLIB_INFLATING;
zp->trailerlen = 4; /* Tolerate up to 4 unknown trailer bytes. */
done = FALSE;
break;
}
zp->zlib_init = ZLIB_UNINIT; /* inflateEnd() already called. */
}
result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z));
break;
default:
result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z));
break;
}
}
free(decomp);
/* We're about to leave this call so the `nread' data bytes won't be seen
again. If we are in a state that would wrongly allow restart in raw mode
at the next call, assume output has already started. */
if(nread && zp->zlib_init == ZLIB_INIT)
zp->zlib_init = started; /* Cannot restart anymore. */
return result;
}
| 0
|
292,561
|
static int bell(void *user)
{
VTermScreen *screen = user;
if(screen->callbacks && screen->callbacks->bell)
return (*screen->callbacks->bell)(screen->cbdata);
return 0;
}
| 0
|
368,813
|
xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) {
if (node == NULL)
return(NULL);
return(0);
}
| 0
|
335,935
|
static void common_init(MpegEncContext * s)
{
static int inited=0;
switch(s->msmpeg4_version){
case 1:
case 2:
s->y_dc_scale_table=
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
break;
case 3:
if(s->workaround_bugs){
s->y_dc_scale_table= old_ff_y_dc_scale_table;
s->c_dc_scale_table= old_ff_c_dc_scale_table;
} else{
s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
}
break;
case 4:
case 5:
s->y_dc_scale_table= wmv1_y_dc_scale_table;
s->c_dc_scale_table= wmv1_c_dc_scale_table;
break;
#if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC1_DECODER)
case 6:
s->y_dc_scale_table= wmv3_dc_scale_table;
s->c_dc_scale_table= wmv3_dc_scale_table;
break;
#endif
}
if(s->msmpeg4_version>=4){
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , wmv1_scantable[1]);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, wmv1_scantable[2]);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, wmv1_scantable[3]);
ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , wmv1_scantable[0]);
}
//Note the default tables are set in common_init in mpegvideo.c
if(!inited){
inited=1;
init_h263_dc_for_msmpeg4();
}
}
| 0
|
53,293
|
static int binder_inc_node(struct binder_node *node, int strong, int internal,
struct list_head *target_list)
{
int ret;
binder_node_inner_lock(node);
ret = binder_inc_node_nilocked(node, strong, internal, target_list);
binder_node_inner_unlock(node);
return ret;
}
| 0
|
166,868
|
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(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());
ExceptionCode ec = 0;
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptStateObjException(exec, ec)));
setDOMException(exec, ec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
return JSValue::encode(result);
}
| 0
|
26,145
|
static void dtap_gcc_term ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_DTAP , DE_GCC_CAUSE , NULL ) ;
}
| 0
|
36,989
|
UnicodeString::refCount() const {
return umtx_loadAcquire(*((u_atomic_int32_t *)fUnion.fFields.fArray - 1));
}
| 0
|
365,783
|
g_file_delete(const char* filename)
{
#if defined(_WIN32)
return DeleteFileA(filename);
#else
return unlink(filename) != -1;
#endif
}
| 0
|
80,697
|
static void updatePortStats(struct port_stats **stats, u_int32_t port,
u_int32_t addr, u_int8_t version,
u_int32_t num_pkts, u_int32_t num_bytes,
const char *proto) {
struct port_stats *s = NULL;
int count = 0;
HASH_FIND_INT(*stats, &port, s);
if(s == NULL) {
s = (struct port_stats*)calloc(1, sizeof(struct port_stats));
if(!s) return;
s->port = port, s->num_pkts = num_pkts, s->num_bytes = num_bytes;
s->num_addr = 1, s->cumulative_addr = 1; s->num_flows = 1;
updateTopIpAddress(addr, version, proto, 1, s->top_ip_addrs, MAX_NUM_IP_ADDRESS);
s->addr_tree = (addr_node *) malloc(sizeof(addr_node));
if(!s->addr_tree) {
free(s);
return;
}
s->addr_tree->addr = addr;
s->addr_tree->version = version;
strncpy(s->addr_tree->proto, proto, sizeof(s->addr_tree->proto));
s->addr_tree->count = 1;
s->addr_tree->left = NULL;
s->addr_tree->right = NULL;
HASH_ADD_INT(*stats, port, s);
}
else{
count = updateIpTree(addr, version, &(*s).addr_tree, proto);
if(count == UPDATED_TREE) s->num_addr++;
if(count) {
s->cumulative_addr++;
updateTopIpAddress(addr, version, proto, count, s->top_ip_addrs, MAX_NUM_IP_ADDRESS);
}
s->num_pkts += num_pkts, s->num_bytes += num_bytes, s->num_flows++;
}
}
| 0
|
232,422
|
SPL_METHOD(SplFileInfo, getBasename)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char *fname, *suffix = 0;
size_t flen;
int slen = 0, path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) {
return;
}
spl_filesystem_object_get_path(intern, &path_len TSRMLS_CC);
if (path_len && path_len < intern->file_name_len) {
fname = intern->file_name + path_len + 1;
flen = intern->file_name_len - (path_len + 1);
} else {
fname = intern->file_name;
flen = intern->file_name_len;
}
php_basename(fname, flen, suffix, slen, &fname, &flen TSRMLS_CC);
RETURN_STRINGL(fname, flen, 0);
}
| 0
|
352,569
|
switch (yych) {
case 'a': goto yy42;
default: goto yy41;
}
| 1
|
99,734
|
isdn_net_close(struct net_device *dev)
{
struct net_device *p;
#ifdef CONFIG_ISDN_X25
struct concap_proto * cprot =
((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
/* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name ); */
#endif
#ifdef CONFIG_ISDN_X25
if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
#endif
netif_stop_queue(dev);
p = MASTER_TO_SLAVE(dev);
if (p) {
/* If this interface has slaves, stop them also */
while (p) {
#ifdef CONFIG_ISDN_X25
cprot = ((isdn_net_local *) netdev_priv(p))
-> netdev -> cprot;
if( cprot && cprot -> pops )
cprot -> pops -> close( cprot );
#endif
isdn_net_hangup(p);
p = MASTER_TO_SLAVE(p);
}
}
isdn_net_hangup(dev);
isdn_unlock_drivers();
return 0;
}
| 0
|
269,689
|
SWFInput_input_seek(SWFInput input, long offset, int whence)
{
if ( whence == SEEK_CUR )
{
if ( offset >= 0 )
input->offset = min(input->length, input->offset + offset);
else
input->offset = max(0, input->offset + offset);
}
else if ( whence == SEEK_END )
input->offset = max(0, input->length - offset);
else if ( whence == SEEK_SET )
input->offset = min(input->length, offset);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.