idx
int64 | func
string | target
int64 |
|---|---|---|
368,774
|
_compare_pairs(const void **a, const void **b)
{
const fp_pair_t *fp1 = *a, *fp2 = *b;
int r;
if ((r = fast_memcmp(fp1->first, fp2->first, DIGEST_LEN)))
return r;
else
return fast_memcmp(fp1->second, fp2->second, DIGEST_LEN);
}
| 0
|
493,887
|
checkprotoprefix(struct Curl_easy *data, struct connectdata *conn,
const char *s, size_t len)
{
#ifndef CURL_DISABLE_RTSP
if(conn->handler->protocol & CURLPROTO_RTSP)
return checkrtspprefix(data, s, len);
#else
(void)conn;
#endif /* CURL_DISABLE_RTSP */
return checkhttpprefix(data, s, len);
}
| 0
|
240,105
|
void CompareDrawQuad(DrawQuad* quad,
DrawQuad* copy,
SharedQuadState* copy_shared_state) {
EXPECT_EQ(quad->material, copy->material);
EXPECT_EQ(quad->rect, copy->rect);
EXPECT_EQ(quad->visible_rect, copy->visible_rect);
EXPECT_EQ(quad->opaque_rect, copy->opaque_rect);
EXPECT_EQ(quad->needs_blending, copy->needs_blending);
EXPECT_EQ(copy_shared_state, copy->shared_quad_state);
}
| 0
|
429,203
|
job_handler_callback (gpointer data,
gpointer user_data)
{
GVfsJob *job = G_VFS_JOB (data);
g_vfs_job_run (job);
}
| 0
|
378,985
|
static int local_LZ4_decompress_fast_withPrefix64k(const char* in, char* out, int inSize, int outSize)
{
(void)inSize;
LZ4_decompress_fast_withPrefix64k(in, out, outSize);
return outSize;
}
| 0
|
262,230
|
cherokee_validator_ldap_add_headers (cherokee_validator_ldap_t *ldap, cherokee_connection_t *conn, cherokee_buffer_t *buf)
{
UNUSED(ldap);
UNUSED(conn);
UNUSED(buf);
return ret_ok;
}
| 0
|
168,590
|
static int kvm_init_mmu_notifier(struct kvm *kvm)
{
return 0;
}
| 0
|
296,276
|
static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_closeargs *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_close(xdr, args, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
}
| 0
|
156,504
|
int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
{
skb_orphan(skb);
if (!(dev->flags & IFF_UP) ||
(skb->len > (dev->mtu + dev->hard_header_len))) {
kfree_skb(skb);
return NET_RX_DROP;
}
skb_set_dev(skb, dev);
skb->tstamp.tv64 = 0;
skb->pkt_type = PACKET_HOST;
skb->protocol = eth_type_trans(skb, dev);
return netif_rx(skb);
}
| 0
|
409,584
|
static int bnx2x_configure_ptp(struct bnx2x *bp)
{
int rc, port = BP_PORT(bp);
u32 wb_data[2];
/* Reset PTP event detection rules - will be configured in the IOCTL */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK :
NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7FF);
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FFF);
REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK :
NIG_REG_P0_TLLH_PTP_PARAM_MASK, 0x7FF);
REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_RULE_MASK :
NIG_REG_P0_TLLH_PTP_RULE_MASK, 0x3FFF);
/* Disable PTP packets to host - will be configured in the IOCTL*/
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_TO_HOST :
NIG_REG_P0_LLH_PTP_TO_HOST, 0x0);
/* Enable the PTP feature */
REG_WR(bp, port ? NIG_REG_P1_PTP_EN :
NIG_REG_P0_PTP_EN, 0x3F);
/* Enable the free-running counter */
wb_data[0] = 0;
wb_data[1] = 0;
REG_WR_DMAE(bp, NIG_REG_TIMESYNC_GEN_REG + tsgen_ctrl, wb_data, 2);
/* Reset drift register (offset register is not reset) */
rc = bnx2x_send_reset_timesync_ramrod(bp);
if (rc) {
BNX2X_ERR("Failed to reset PHC drift register\n");
return -EFAULT;
}
/* Reset possibly old timestamps */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_HOST_BUF_SEQID :
NIG_REG_P0_LLH_PTP_HOST_BUF_SEQID, 0x10000);
REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_BUF_SEQID :
NIG_REG_P0_TLLH_PTP_BUF_SEQID, 0x10000);
return 0;
}
| 0
|
520,456
|
Longlong_null to_longlong_null()
{
longlong nr= val_int();
/*
C++ does not guarantee the order of parameter evaluation,
so to make sure "null_value" is passed to the constructor
after the val_int() call, val_int() is caled on a separate line.
*/
return Longlong_null(nr, null_value);
}
| 0
|
226,651
|
bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver(
AutomationProvider* automation,
Browser* browser,
int command,
IPC::Message* reply_message,
bool use_json_interface) {
bool result = true;
switch (command) {
case IDC_NEW_TAB: {
new NewTabObserver(automation, reply_message, use_json_interface);
break;
}
case IDC_NEW_WINDOW:
case IDC_NEW_INCOGNITO_WINDOW: {
BrowserOpenedNotificationObserver* observer =
new BrowserOpenedNotificationObserver(automation, reply_message,
use_json_interface);
observer->set_for_browser_command(true);
break;
}
case IDC_CLOSE_WINDOW: {
BrowserClosedNotificationObserver* observer =
new BrowserClosedNotificationObserver(browser, automation,
reply_message,
use_json_interface);
observer->set_for_browser_command(true);
break;
}
case IDC_CLOSE_TAB: {
TabClosedNotificationObserver* observer =
new TabClosedNotificationObserver(automation, true, reply_message,
use_json_interface);
observer->set_for_browser_command(true);
break;
}
case IDC_BACK:
case IDC_FORWARD:
case IDC_RELOAD: {
new NavigationNotificationObserver(
&chrome::GetActiveWebContents(browser)->GetController(),
automation, reply_message, 1, false, use_json_interface);
break;
}
default: {
ExecuteBrowserCommandObserver* observer =
new ExecuteBrowserCommandObserver(automation, reply_message,
use_json_interface);
if (!observer->Register(command)) {
observer->ReleaseReply();
delete observer;
result = false;
}
break;
}
}
return result;
}
| 0
|
312,928
|
void RenderFrameHostImpl::SimulateBeforeUnloadAck() {
DCHECK(is_waiting_for_beforeunload_ack_);
base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_;
OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now());
}
| 0
|
116,259
|
static bool generic_pkt_to_tuple(const struct sk_buff *skb,
unsigned int dataoff,
struct nf_conntrack_tuple *tuple)
{
tuple->src.u.all = 0;
tuple->dst.u.all = 0;
return true;
}
| 0
|
477,218
|
static int virtbt_setup_zephyr(struct hci_dev *hdev)
{
struct sk_buff *skb;
/* Read Build Information */
skb = __hci_cmd_sync(hdev, 0xfc08, 0, NULL, HCI_INIT_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);
bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
hci_set_fw_info(hdev, "%s", skb->data + 1);
kfree_skb(skb);
return 0;
}
| 0
|
289,366
|
static void vb_decode_palette ( VBDecContext * c , int data_size ) {
int start , size , i ;
start = bytestream2_get_byte ( & c -> stream ) ;
size = ( bytestream2_get_byte ( & c -> stream ) - 1 ) & 0xFF ;
if ( start + size > 255 ) {
av_log ( c -> avctx , AV_LOG_ERROR , "Palette change runs beyond entry 256\n" ) ;
return ;
}
if ( size * 3 + 2 > data_size ) {
av_log ( c -> avctx , AV_LOG_ERROR , "Palette data runs beyond chunk size\n" ) ;
return ;
}
for ( i = start ;
i <= start + size ;
i ++ ) c -> pal [ i ] = bytestream2_get_be24 ( & c -> stream ) ;
}
| 0
|
201,239
|
virtual ~MockFreeDiskSpaceGetter() {}
| 0
|
61,184
|
ModuleExport size_t RegisterTIFFImage(void)
{
#define TIFFDescription "Tagged Image File Format"
char
version[MaxTextExtent];
MagickInfo
*entry;
#if defined(MAGICKCORE_TIFF_DELEGATE)
if (tiff_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&tiff_semaphore);
LockSemaphoreInfo(tiff_semaphore);
if (instantiate_key == MagickFalse)
{
if (CreateMagickThreadKey(&tiff_exception,NULL) == MagickFalse)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
error_handler=TIFFSetErrorHandler(TIFFErrors);
warning_handler=TIFFSetWarningHandler(TIFFWarnings);
#if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER)
if (tag_extender == (TIFFExtendProc) NULL)
tag_extender=TIFFSetTagExtender(TIFFTagExtender);
#endif
instantiate_key=MagickTrue;
}
UnlockSemaphoreInfo(tiff_semaphore);
#endif
*version='\0';
#if defined(TIFF_VERSION)
(void) FormatLocaleString(version,MaxTextExtent,"%d",TIFF_VERSION);
#endif
#if defined(MAGICKCORE_TIFF_DELEGATE)
{
const char
*p;
register ssize_t
i;
p=TIFFGetVersion();
for (i=0; (i < (MaxTextExtent-1)) && (*p != 0) && (*p != '\n'); i++)
version[i]=(*p++);
version[i]='\0';
}
#endif
entry=SetMagickInfo("GROUP4");
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadGROUP4Image;
entry->encoder=(EncodeImageHandler *) WriteGROUP4Image;
#endif
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
entry->adjoin=MagickFalse;
entry->format_type=ImplicitFormatType;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Raw CCITT Group4");
entry->mime_type=ConstantString("image/tiff");
entry->module=ConstantString("TIFF");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PTIF");
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadTIFFImage;
entry->encoder=(EncodeImageHandler *) WritePTIFImage;
#endif
entry->endian_support=MagickTrue;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Pyramid encoded TIFF");
entry->mime_type=ConstantString("image/tiff");
entry->module=ConstantString("TIFF");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("TIF");
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadTIFFImage;
entry->encoder=(EncodeImageHandler *) WriteTIFFImage;
#endif
entry->endian_support=MagickTrue;
entry->seekable_stream=MagickTrue;
entry->stealth=MagickTrue;
entry->description=ConstantString(TIFFDescription);
if (*version != '\0')
entry->version=ConstantString(version);
entry->mime_type=ConstantString("image/tiff");
entry->module=ConstantString("TIFF");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("TIFF");
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadTIFFImage;
entry->encoder=(EncodeImageHandler *) WriteTIFFImage;
#endif
entry->magick=(IsImageFormatHandler *) IsTIFF;
entry->endian_support=MagickTrue;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString(TIFFDescription);
if (*version != '\0')
entry->version=ConstantString(version);
entry->mime_type=ConstantString("image/tiff");
entry->module=ConstantString("TIFF");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("TIFF64");
#if defined(TIFF_VERSION_BIG)
entry->decoder=(DecodeImageHandler *) ReadTIFFImage;
entry->encoder=(EncodeImageHandler *) WriteTIFFImage;
#endif
entry->adjoin=MagickFalse;
entry->endian_support=MagickTrue;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Tagged Image File Format (64-bit)");
if (*version != '\0')
entry->version=ConstantString(version);
entry->mime_type=ConstantString("image/tiff");
entry->module=ConstantString("TIFF");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 0
|
83,945
|
static void init_slave_skip_errors()
{
DBUG_ENTER("init_slave_skip_errors");
DBUG_ASSERT(!use_slave_mask); // not already initialized
if (bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0))
{
fprintf(stderr, "Badly out of memory, please check your system status\n");
exit(1);
}
use_slave_mask = 1;
DBUG_VOID_RETURN;
}
| 0
|
144,997
|
template<typename T>
inline void sgels(char & TRANS, int &M, int &N, int &NRHS, T* lapA, int &LDA,
T* lapB, int &LDB, T* WORK, int &LWORK, int &INFO){
dgels_(&TRANS, &M, &N, &NRHS, lapA, &LDA, lapB, &LDB, WORK, &LWORK, &INFO);
| 0
|
283,560
|
pdf_init_csi(fz_context *ctx, pdf_csi *csi, pdf_document *doc, pdf_obj *rdb, pdf_lexbuf *buf, fz_cookie *cookie)
{
memset(csi, 0, sizeof *csi);
csi->doc = doc;
csi->rdb = rdb;
csi->buf = buf;
csi->cookie = cookie;
}
| 0
|
21,930
|
static size_t qio_channel_websock_extract_headers ( QIOChannelWebsock * ioc , char * buffer , QIOChannelWebsockHTTPHeader * hdrs , size_t nhdrsalloc , Error * * errp ) {
char * nl , * sep , * tmp ;
size_t nhdrs = 0 ;
nl = strstr ( buffer , QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM ) ;
if ( ! nl ) {
error_setg ( errp , "Missing HTTP header delimiter" ) ;
goto bad_request ;
}
* nl = '\0' ;
tmp = strchr ( buffer , ' ' ) ;
if ( ! tmp ) {
error_setg ( errp , "Missing HTTP path delimiter" ) ;
return 0 ;
}
* tmp = '\0' ;
if ( ! g_str_equal ( buffer , QIO_CHANNEL_WEBSOCK_HTTP_METHOD ) ) {
error_setg ( errp , "Unsupported HTTP method %s" , buffer ) ;
goto bad_request ;
}
buffer = tmp + 1 ;
tmp = strchr ( buffer , ' ' ) ;
if ( ! tmp ) {
error_setg ( errp , "Missing HTTP version delimiter" ) ;
goto bad_request ;
}
* tmp = '\0' ;
if ( ! g_str_equal ( buffer , QIO_CHANNEL_WEBSOCK_HTTP_PATH ) ) {
qio_channel_websock_handshake_send_res_err ( ioc , QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_NOT_FOUND ) ;
error_setg ( errp , "Unexpected HTTP path %s" , buffer ) ;
return 0 ;
}
buffer = tmp + 1 ;
if ( ! g_str_equal ( buffer , QIO_CHANNEL_WEBSOCK_HTTP_VERSION ) ) {
error_setg ( errp , "Unsupported HTTP version %s" , buffer ) ;
goto bad_request ;
}
buffer = nl + strlen ( QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM ) ;
do {
QIOChannelWebsockHTTPHeader * hdr ;
nl = strstr ( buffer , QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM ) ;
if ( nl ) {
* nl = '\0' ;
}
sep = strchr ( buffer , ':' ) ;
if ( ! sep ) {
error_setg ( errp , "Malformed HTTP header" ) ;
goto bad_request ;
}
* sep = '\0' ;
sep ++ ;
while ( * sep == ' ' ) {
sep ++ ;
}
if ( nhdrs >= nhdrsalloc ) {
error_setg ( errp , "Too many HTTP headers" ) ;
goto bad_request ;
}
hdr = & hdrs [ nhdrs ++ ] ;
hdr -> name = buffer ;
hdr -> value = sep ;
for ( tmp = hdr -> name ;
* tmp ;
tmp ++ ) {
* tmp = g_ascii_tolower ( * tmp ) ;
}
if ( nl ) {
buffer = nl + strlen ( QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM ) ;
}
}
while ( nl != NULL ) ;
return nhdrs ;
bad_request : qio_channel_websock_handshake_send_res_err ( ioc , QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_BAD_REQUEST ) ;
return 0 ;
}
| 0
|
327,711
|
static int vhost_user_get_vring_base(struct vhost_dev *dev,
struct vhost_vring_state *ring)
{
VhostUserMsg msg = {
.request = VHOST_USER_GET_VRING_BASE,
.flags = VHOST_USER_VERSION,
.state = *ring,
.size = sizeof(*ring),
};
vhost_user_write(dev, &msg, NULL, 0);
if (vhost_user_read(dev, &msg) < 0) {
return 0;
}
if (msg.request != VHOST_USER_GET_VRING_BASE) {
error_report("Received unexpected msg type. Expected %d received %d",
VHOST_USER_GET_VRING_BASE, msg.request);
return -1;
}
if (msg.size != sizeof(m.state)) {
error_report("Received bad msg size.");
return -1;
}
*ring = msg.state;
return 0;
}
| 1
|
114,409
|
deep_count_more_files_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
DeepCountState *state;
NautilusDirectory *directory;
GList *files, *l;
GFileInfo *info;
state = user_data;
if (state->directory == NULL)
{
/* Operation was cancelled. Bail out */
deep_count_state_free (state);
return;
}
directory = nautilus_directory_ref (state->directory);
g_assert (directory->details->deep_count_in_progress != NULL);
g_assert (directory->details->deep_count_in_progress == state);
files = g_file_enumerator_next_files_finish (state->enumerator,
res, NULL);
for (l = files; l != NULL; l = l->next)
{
info = l->data;
deep_count_one (state, info);
g_object_unref (info);
}
if (files == NULL)
{
g_file_enumerator_close_async (state->enumerator, 0, NULL, NULL, NULL);
g_object_unref (state->enumerator);
state->enumerator = NULL;
deep_count_next_dir (state);
}
else
{
g_file_enumerator_next_files_async (state->enumerator,
DIRECTORY_LOAD_ITEMS_PER_CALLBACK,
G_PRIORITY_LOW,
state->cancellable,
deep_count_more_files_callback,
state);
}
g_list_free (files);
nautilus_directory_unref (directory);
}
| 0
|
405,068
|
static int racls_del_cb(void *rock,
const char *key, size_t keylen,
const char *data __attribute__((unused)),
size_t datalen __attribute__((unused)))
{
struct txn **txn = (struct txn **)rock;
return cyrusdb_delete(mbdb, key, keylen, txn, /*force*/0);
}
| 0
|
170,887
|
String UrlForFrame(LocalFrame* frame) {
KURL url = frame->GetDocument()->Url();
url.RemoveFragmentIdentifier();
return url.GetString();
}
| 0
|
374,430
|
get_call_expr_arg_stable(Node *expr, int argnum)
{
List *args;
Node *arg;
if (expr == NULL)
return false;
if (IsA(expr, FuncExpr))
args = ((FuncExpr *) expr)->args;
else if (IsA(expr, OpExpr))
args = ((OpExpr *) expr)->args;
else if (IsA(expr, DistinctExpr))
args = ((DistinctExpr *) expr)->args;
else if (IsA(expr, ScalarArrayOpExpr))
args = ((ScalarArrayOpExpr *) expr)->args;
else if (IsA(expr, ArrayCoerceExpr))
args = list_make1(((ArrayCoerceExpr *) expr)->arg);
else if (IsA(expr, NullIfExpr))
args = ((NullIfExpr *) expr)->args;
else if (IsA(expr, WindowFunc))
args = ((WindowFunc *) expr)->args;
else
return false;
if (argnum < 0 || argnum >= list_length(args))
return false;
arg = (Node *) list_nth(args, argnum);
/*
* Either a true Const or an external Param will have a value that doesn't
* change during the execution of the query. In future we might want to
* consider other cases too, e.g. now().
*/
if (IsA(arg, Const))
return true;
if (IsA(arg, Param) &&
((Param *) arg)->paramkind == PARAM_EXTERN)
return true;
return false;
}
| 0
|
401,557
|
GSList* menu_cache_list_all_apps(MenuCache* cache)
{
GSList* list;
MENU_CACHE_LOCK;
if (G_UNLIKELY(!cache->root_dir)) /* empty cache */
list = NULL;
else
list = list_app_in_dir(cache->root_dir, NULL);
MENU_CACHE_UNLOCK;
return list;
}
| 0
|
58,623
|
static int mnt_fs_get_flags(struct libmnt_fs *fs)
{
return fs ? fs->flags : 0;
}
| 0
|
240,661
|
void Browser::TogglePresentationMode() {
window_->SetPresentationMode(!window_->InPresentationMode());
WindowFullscreenStateChanged();
}
| 0
|
444,337
|
TEST_F(HttpConnectionManagerImplTest, UpstreamWatermarkCallbacks) {
setup(false, "");
setUpEncoderAndDecoder(false, false);
sendRequestHeadersAndData();
// Mimic the upstream connection backing up. The router would call
// onDecoderFilterAboveWriteBufferHighWatermark which should readDisable the stream and increment
// stats.
EXPECT_CALL(response_encoder_, getStream()).WillOnce(ReturnRef(stream_));
EXPECT_CALL(stream_, readDisable(true));
ASSERT(decoder_filters_[0]->callbacks_ != nullptr);
decoder_filters_[0]->callbacks_->onDecoderFilterAboveWriteBufferHighWatermark();
EXPECT_EQ(1U, stats_.named_.downstream_flow_control_paused_reading_total_.value());
// Resume the flow of data. When the router buffer drains it calls
// onDecoderFilterBelowWriteBufferLowWatermark which should re-enable reads on the stream.
EXPECT_CALL(response_encoder_, getStream()).WillOnce(ReturnRef(stream_));
EXPECT_CALL(stream_, readDisable(false));
ASSERT(decoder_filters_[0]->callbacks_ != nullptr);
decoder_filters_[0]->callbacks_->onDecoderFilterBelowWriteBufferLowWatermark();
EXPECT_EQ(1U, stats_.named_.downstream_flow_control_resumed_reading_total_.value());
// Backup upstream once again.
EXPECT_CALL(response_encoder_, getStream()).WillOnce(ReturnRef(stream_));
EXPECT_CALL(stream_, readDisable(true));
ASSERT(decoder_filters_[0]->callbacks_ != nullptr);
decoder_filters_[0]->callbacks_->onDecoderFilterAboveWriteBufferHighWatermark();
EXPECT_EQ(2U, stats_.named_.downstream_flow_control_paused_reading_total_.value());
// Send a full response.
EXPECT_CALL(*encoder_filters_[0], encodeHeaders(_, true));
EXPECT_CALL(*encoder_filters_[0], encodeComplete());
EXPECT_CALL(*encoder_filters_[1], encodeHeaders(_, true));
EXPECT_CALL(*encoder_filters_[1], encodeComplete());
EXPECT_CALL(response_encoder_, encodeHeaders(_, true));
expectOnDestroy();
decoder_filters_[1]->callbacks_->encodeHeaders(
ResponseHeaderMapPtr{new TestResponseHeaderMapImpl{{":status", "200"}}}, true);
}
| 0
|
66,554
|
void f2fs_wait_on_block_writeback(struct f2fs_sb_info *sbi, block_t blkaddr)
{
struct page *cpage;
if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
return;
cpage = find_lock_page(META_MAPPING(sbi), blkaddr);
if (cpage) {
f2fs_wait_on_page_writeback(cpage, DATA, true);
f2fs_put_page(cpage, 1);
}
}
| 0
|
505,449
|
static int ssl3_handshake_mac(SSL *s, EVP_MD_CTX *in_ctx,
const char *sender, int len, unsigned char *p)
{
unsigned int ret;
int npad,n;
unsigned int i;
unsigned char md_buf[EVP_MAX_MD_SIZE];
EVP_MD_CTX ctx;
EVP_MD_CTX_init(&ctx);
EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
EVP_MD_CTX_copy_ex(&ctx,in_ctx);
n=EVP_MD_CTX_size(&ctx);
npad=(48/n)*n;
if (sender != NULL)
EVP_DigestUpdate(&ctx,sender,len);
EVP_DigestUpdate(&ctx,s->session->master_key,
s->session->master_key_length);
EVP_DigestUpdate(&ctx,ssl3_pad_1,npad);
EVP_DigestFinal_ex(&ctx,md_buf,&i);
EVP_DigestInit_ex(&ctx,EVP_MD_CTX_md(&ctx), NULL);
EVP_DigestUpdate(&ctx,s->session->master_key,
s->session->master_key_length);
EVP_DigestUpdate(&ctx,ssl3_pad_2,npad);
EVP_DigestUpdate(&ctx,md_buf,i);
EVP_DigestFinal_ex(&ctx,p,&ret);
EVP_MD_CTX_cleanup(&ctx);
return((int)ret);
}
| 0
|
137,916
|
static inline pte_t pte_mkglobal(pte_t pte)
{
return pte_set_flags(pte, _PAGE_GLOBAL);
}
| 0
|
332,193
|
static void qpci_pc_config_writeb(QPCIBus *bus, int devfn, uint8_t offset, uint8_t value)
{
outl(0xcf8, (1 << 31) | (devfn << 8) | offset);
outb(0xcfc, value);
}
| 1
|
399,412
|
static void create_kthread(struct kthread_create_info *create)
{
int pid;
#ifdef CONFIG_NUMA
current->pref_node_fork = create->node;
#endif
/* We want our own signal handler (we take no signals by default). */
pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD);
if (pid < 0) {
/* If user was SIGKILLed, I release the structure. */
struct completion *done = xchg(&create->done, NULL);
if (!done) {
kfree(create);
return;
}
create->result = ERR_PTR(pid);
complete(done);
}
}
| 0
|
28,172
|
static void gs_heap_free_string ( gs_memory_t * mem , byte * data , uint nbytes , client_name_t cname ) {
gs_heap_free_object ( mem , data , cname ) ;
}
| 0
|
200,654
|
void LayerTreeHost::PaintLayerContents(
const RenderSurfaceLayerList& render_surface_layer_list,
ResourceUpdateQueue* queue,
bool* did_paint_content,
bool* need_more_updates) {
OcclusionTracker<Layer> occlusion_tracker(
root_layer_->render_surface()->content_rect());
occlusion_tracker.set_minimum_tracking_size(
settings_.minimum_occlusion_tracking_size);
PrioritizeTextures(render_surface_layer_list);
in_paint_layer_contents_ = true;
typedef LayerIterator<Layer> LayerIteratorType;
LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
for (LayerIteratorType it =
LayerIteratorType::Begin(&render_surface_layer_list);
it != end;
++it) {
occlusion_tracker.EnterLayer(it);
if (it.represents_target_render_surface()) {
PaintMasksForRenderSurface(
*it, queue, did_paint_content, need_more_updates);
} else if (it.represents_itself() && it->DrawsContent()) {
DCHECK(!it->paint_properties().bounds.IsEmpty());
*did_paint_content |= it->Update(queue, &occlusion_tracker);
*need_more_updates |= it->NeedMoreUpdates();
}
occlusion_tracker.LeaveLayer(it);
}
in_paint_layer_contents_ = false;
}
| 0
|
236,658
|
void PushMessagingServiceImpl::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
shutdown_started_ = true;
#if BUILDFLAG(ENABLE_BACKGROUND)
in_flight_keep_alive_.reset();
#endif // BUILDFLAG(ENABLE_BACKGROUND)
}
| 0
|
320,030
|
static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
AC3DecodeContext *s = avctx->priv_data;
int16_t *out_samples = (int16_t *)data;
int blk, ch, err;
const uint8_t *channel_map;
const float *output[AC3_MAX_CHANNELS];
/* initialize the GetBitContext with the start of valid AC-3 Frame */
if (s->input_buffer) {
/* copy input buffer to decoder context to avoid reading past the end
of the buffer, which can be caused by a damaged input stream. */
memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
} else {
init_get_bits(&s->gbc, buf, buf_size * 8);
}
/* parse the syncinfo */
*data_size = 0;
err = parse_frame_header(s);
if (err) {
switch(err) {
case AAC_AC3_PARSE_ERROR_SYNC:
av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
return -1;
case AAC_AC3_PARSE_ERROR_BSID:
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
break;
case AAC_AC3_PARSE_ERROR_SAMPLE_RATE:
av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
break;
case AAC_AC3_PARSE_ERROR_FRAME_SIZE:
av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
break;
case AAC_AC3_PARSE_ERROR_FRAME_TYPE:
/* skip frame if CRC is ok. otherwise use error concealment. */
/* TODO: add support for substreams and dependent frames */
if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n");
return s->frame_size;
} else {
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
}
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid header\n");
break;
}
} else {
/* check that reported frame size fits in input buffer */
if (s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
err = AAC_AC3_PARSE_ERROR_FRAME_SIZE;
} else if (avctx->error_recognition >= FF_ER_CAREFUL) {
/* check for crc mismatch */
if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
err = AAC_AC3_PARSE_ERROR_CRC;
}
}
}
/* if frame is ok, set audio parameters */
if (!err) {
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
/* channel config */
s->out_channels = s->channels;
s->output_mode = s->channel_mode;
if(s->lfe_on)
s->output_mode |= AC3_OUTPUT_LFEON;
if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
avctx->request_channels < s->channels) {
s->out_channels = avctx->request_channels;
s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
s->channel_layout = ff_ac3_channel_layout_tab[s->output_mode];
}
avctx->channels = s->out_channels;
avctx->channel_layout = s->channel_layout;
/* set downmixing coefficients if needed */
if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) &&
s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
} else if (!s->out_channels) {
s->out_channels = avctx->channels;
if(s->out_channels < s->channels)
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
}
/* decode the audio blocks */
channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
for (ch = 0; ch < s->out_channels; ch++)
output[ch] = s->output[channel_map[ch]];
for (blk = 0; blk < s->num_blocks; blk++) {
if (!err && decode_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
err = 1;
}
s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
out_samples += 256 * s->out_channels;
}
*data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
return FFMIN(buf_size, s->frame_size);
}
| 1
|
26,220
|
void TSVConnActiveTimeoutCancel ( TSVConn connp ) {
sdk_assert ( sdk_sanity_check_iocore_structure ( connp ) == TS_SUCCESS ) ;
NetVConnection * vc = ( NetVConnection * ) connp ;
vc -> cancel_active_timeout ( ) ;
}
| 0
|
43,500
|
ssize_t proc_projid_map_write(struct file *file, const char __user *buf,
size_t size, loff_t *ppos)
{
struct seq_file *seq = file->private_data;
struct user_namespace *ns = seq->private;
struct user_namespace *seq_ns = seq_user_ns(seq);
if (!ns->parent)
return -EPERM;
if ((seq_ns != ns) && (seq_ns != ns->parent))
return -EPERM;
/* Anyone can set any valid project id no capability needed */
return map_write(file, buf, size, ppos, -1,
&ns->projid_map, &ns->parent->projid_map);
}
| 0
|
68,149
|
TEST_P(Http2CodecImplTest, TrailingHeaders) {
initialize();
TestHeaderMapImpl request_headers;
HttpTestUtility::addDefaultHeaders(request_headers);
EXPECT_CALL(request_decoder_, decodeHeaders_(_, false));
request_encoder_->encodeHeaders(request_headers, false);
EXPECT_CALL(request_decoder_, decodeData(_, false));
Buffer::OwnedImpl hello("hello");
request_encoder_->encodeData(hello, false);
EXPECT_CALL(request_decoder_, decodeTrailers_(_));
request_encoder_->encodeTrailers(TestHeaderMapImpl{{"trailing", "header"}});
TestHeaderMapImpl response_headers{{":status", "200"}};
EXPECT_CALL(response_decoder_, decodeHeaders_(_, false));
response_encoder_->encodeHeaders(response_headers, false);
EXPECT_CALL(response_decoder_, decodeData(_, false));
Buffer::OwnedImpl world("world");
response_encoder_->encodeData(world, false);
EXPECT_CALL(response_decoder_, decodeTrailers_(_));
response_encoder_->encodeTrailers(TestHeaderMapImpl{{"trailing", "header"}});
}
| 0
|
435,954
|
void net_enable_timestamp(void)
{
#ifdef CONFIG_JUMP_LABEL
int wanted;
while (1) {
wanted = atomic_read(&netstamp_wanted);
if (wanted <= 0)
break;
if (atomic_cmpxchg(&netstamp_wanted, wanted, wanted + 1) == wanted)
return;
}
atomic_inc(&netstamp_needed_deferred);
schedule_work(&netstamp_work);
#else
static_branch_inc(&netstamp_needed_key);
#endif
}
| 0
|
178,993
|
bool RenderFrameHostImpl::CreateNetworkServiceDefaultFactory(
network::mojom::URLLoaderFactoryRequest default_factory_request) {
return CreateNetworkServiceDefaultFactoryInternal(
last_committed_origin_, std::move(default_factory_request));
}
| 0
|
10,244
|
static void BooleanOrNullAttributeAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestObject* impl = V8TestObject::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "booleanOrNullAttribute");
bool cpp_value = NativeValueTraits<IDLBoolean>::NativeValue(info.GetIsolate(), v8_value, exception_state);
if (exception_state.HadException())
return;
bool is_null = IsUndefinedOrNull(v8_value);
impl->setBooleanOrNullAttribute(cpp_value, is_null);
}
| 1
|
37,308
|
static int orinoco_ioctl_setibssport(struct net_device *dev,
struct iw_request_info *info,
void *wrqu,
char *extra)
{
struct orinoco_private *priv = ndev_priv(dev);
int val = *((int *) extra);
unsigned long flags;
if (orinoco_lock(priv, &flags) != 0)
return -EBUSY;
priv->ibss_port = val;
/* Actually update the mode we are using */
set_port_type(priv);
orinoco_unlock(priv, &flags);
return -EINPROGRESS; /* Call commit handler */
}
| 0
|
404,905
|
static struct sk_buff *l2cap_ertm_seq_in_queue(struct sk_buff_head *head,
u16 seq)
{
struct sk_buff *skb;
skb_queue_walk(head, skb) {
if (bt_cb(skb)->l2cap.txseq == seq)
return skb;
}
return NULL;
}
| 0
|
490,475
|
void gf_fs_print_all_connections(GF_FilterSession *session, char *filter_name, void (*print_fn)(FILE *output, GF_SysPrintArgFlags flags, const char *fmt, ...) )
{
Bool found = GF_FALSE;
GF_List *done;
u32 i, j, count;
u32 llev = gf_log_get_tool_level(GF_LOG_FILTER);
gf_log_set_tool_level(GF_LOG_FILTER, GF_LOG_INFO);
//load JS to inspect its connections
if (filter_name && strstr(filter_name, ".js")) {
gf_fs_print_jsf_connection(session, filter_name, NULL, print_fn);
gf_log_set_tool_level(GF_LOG_FILTER, llev);
return;
}
done = gf_list_new();
count = gf_list_count(session->links);
for (i=0; i<count; i++) {
const GF_FilterRegDesc *src = gf_list_get(session->links, i);
if (filter_name && strcmp(src->freg->name, filter_name))
continue;
if (!src->nb_edges) {
if (print_fn)
print_fn(stderr, 1, "%s: no sources\n", src->freg->name);
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("%s: no sources\n", src->freg->name));
}
continue;
}
found = GF_TRUE;
if (print_fn)
print_fn(stderr, 1, "%s sources:", src->freg->name);
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("%s sources:", src->freg->name));
}
for (j=0; j<src->nb_edges; j++) {
if (gf_list_find(done, (void *) src->edges[j].src_reg->freg->name)<0) {
if (print_fn)
print_fn(stderr, 0, " %s", src->edges[j].src_reg->freg->name);
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, (" %s", src->edges[j].src_reg->freg->name));
}
gf_list_add(done, (void *) src->edges[j].src_reg->freg->name);
}
}
if (print_fn)
print_fn(stderr, 0, "\n");
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("\n"));
}
gf_list_reset(done);
}
if (found && filter_name) {
if (print_fn)
print_fn(stderr, 1, "%s sinks:", filter_name);
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("%s sinks:", filter_name));
}
count = gf_list_count(session->links);
for (i=0; i<count; i++) {
const GF_FilterRegDesc *src = gf_list_get(session->links, i);
if (!strcmp(src->freg->name, filter_name)) {
if (!(src->freg->flags & GF_FS_REG_EXPLICIT_ONLY) || !(src->freg->flags & GF_FS_REG_ALLOW_CYCLIC))
continue;
}
for (j=0; j<src->nb_edges; j++) {
if (strcmp(src->edges[j].src_reg->freg->name, filter_name)) continue;
if (gf_list_find(done, (void *) src->freg->name)<0) {
if (print_fn)
print_fn(stderr, 0, " %s", src->freg->name);
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, (" %s", src->freg->name));
}
gf_list_add(done, (void *) src->freg->name);
}
}
gf_list_reset(done);
}
if (print_fn)
print_fn(stderr, 1, " \n");
else {
GF_LOG(GF_LOG_INFO, GF_LOG_APP, (" \n"));
}
}
if (!found && filter_name) {
GF_Err e = GF_OK;
GF_Filter *f = gf_fs_load_filter(session, filter_name, &e);
if (f) {
gf_fs_print_jsf_connection(session, filter_name, f, print_fn);
}
else if (print_fn)
print_fn(stderr, 1, "%s filter not found\n", filter_name);
else {
GF_LOG(GF_LOG_ERROR, GF_LOG_APP, ("%s filter not found\n", filter_name));
}
}
gf_list_del(done);
gf_log_set_tool_level(GF_LOG_FILTER, llev);
}
| 0
|
232,135
|
PHP_FUNCTION(locale_lookup)
{
char* fallback_loc = NULL;
int fallback_loc_len = 0;
const char* loc_range = NULL;
int loc_range_len = 0;
zval* arr = NULL;
HashTable* hash_arr = NULL;
zend_bool boolCanonical = 0;
char* result =NULL;
intl_error_reset( NULL TSRMLS_CC );
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "as|bs", &arr, &loc_range, &loc_range_len,
&boolCanonical, &fallback_loc, &fallback_loc_len) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 TSRMLS_CC );
RETURN_FALSE;
}
if(loc_range_len == 0) {
loc_range = intl_locale_get_default(TSRMLS_C);
}
hash_arr = HASH_OF(arr);
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
RETURN_EMPTY_STRING();
}
result = lookup_loc_range(loc_range, hash_arr, boolCanonical TSRMLS_CC);
if(result == NULL || result[0] == '\0') {
if( fallback_loc ) {
result = estrndup(fallback_loc, fallback_loc_len);
} else {
RETURN_EMPTY_STRING();
}
}
RETVAL_STRINGL(result, strlen(result), 0);
}
| 0
|
81,701
|
uint32_t writeI32(const int32_t i32) {
T_VIRTUAL_CALL();
return writeI32_virt(i32);
}
| 0
|
241,240
|
void RenderFrameHostImpl::OnBubbleLogicalScrollInParentFrame(
blink::WebScrollDirection direction,
blink::WebScrollGranularity granularity) {
if (!is_active())
return;
RenderFrameProxyHost* proxy =
frame_tree_node()->render_manager()->GetProxyToParent();
if (!proxy) {
bad_message::ReceivedBadMessage(GetProcess(),
bad_message::RFH_NO_PROXY_TO_PARENT);
return;
}
proxy->BubbleLogicalScroll(direction, granularity);
}
| 0
|
475,113
|
static struct vrend_linked_shader_program *add_shader_program(struct vrend_sub_context *sub_ctx,
struct vrend_shader *vs,
struct vrend_shader *fs,
struct vrend_shader *gs,
struct vrend_shader *tcs,
struct vrend_shader *tes)
{
struct vrend_linked_shader_program *sprog = CALLOC_STRUCT(vrend_linked_shader_program);
char name[64];
int i;
GLuint prog_id;
GLint lret;
int last_shader;
if (!sprog)
return NULL;
prog_id = glCreateProgram();
glAttachShader(prog_id, vs->id);
if (tcs && tcs->id > 0)
glAttachShader(prog_id, tcs->id);
if (tes && tes->id > 0)
glAttachShader(prog_id, tes->id);
if (gs) {
if (gs->id > 0)
glAttachShader(prog_id, gs->id);
set_stream_out_varyings(sub_ctx, prog_id, &gs->sel->sinfo);
} else if (tes)
set_stream_out_varyings(sub_ctx, prog_id, &tes->sel->sinfo);
else
set_stream_out_varyings(sub_ctx, prog_id, &vs->sel->sinfo);
glAttachShader(prog_id, fs->id);
if (fs->sel->sinfo.num_outputs > 1) {
sprog->dual_src_linked = util_blend_state_is_dual(&sub_ctx->blend_state, 0);
if (sprog->dual_src_linked) {
if (has_feature(feat_dual_src_blend)) {
if (!vrend_state.use_gles) {
glBindFragDataLocationIndexed(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexed(prog_id, 0, 1, "fsout_c1");
} else {
glBindFragDataLocationIndexedEXT(prog_id, 0, 0, "fsout_c0");
glBindFragDataLocationIndexedEXT(prog_id, 0, 1, "fsout_c1");
}
} else {
vrend_report_context_error(sub_ctx->parent, VIRGL_ERROR_CTX_ILLEGAL_DUAL_SRC_BLEND, 0);
}
} else if (has_feature(feat_dual_src_blend)) {
for (int i = 0; i < fs->sel->sinfo.num_outputs; ++i) {
if (fs->sel->sinfo.fs_output_layout[i] >= 0) {
char buf[64];
snprintf(buf, sizeof(buf), "fsout_c%d", fs->sel->sinfo.fs_output_layout[i]);
if (!vrend_state.use_gles)
glBindFragDataLocationIndexed(prog_id, fs->sel->sinfo.fs_output_layout[i], 0, buf);
else
glBindFragDataLocationIndexedEXT(prog_id, fs->sel->sinfo.fs_output_layout[i], 0, buf);
}
}
} else {
vrend_report_context_error(sub_ctx->parent, VIRGL_ERROR_CTX_UNSUPPORTED_FUNCTION, 0);
}
} else
sprog->dual_src_linked = false;
if (has_feature(feat_gles31_vertex_attrib_binding)) {
uint32_t mask = vs->sel->sinfo.attrib_input_mask;
while (mask) {
i = u_bit_scan(&mask);
snprintf(name, 32, "in_%d", i);
glBindAttribLocation(prog_id, i, name);
}
}
glLinkProgram(prog_id);
glGetProgramiv(prog_id, GL_LINK_STATUS, &lret);
if (lret == GL_FALSE) {
char infolog[65536];
int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog);
vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */
vrend_report_context_error(sub_ctx->parent, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0);
vrend_shader_dump(vs);
if (tcs)
vrend_shader_dump(tcs);
if (tes)
vrend_shader_dump(tes);
if (gs)
vrend_shader_dump(gs);
vrend_shader_dump(fs);
glDeleteProgram(prog_id);
free(sprog);
return NULL;
}
sprog->ss[PIPE_SHADER_VERTEX] = vs;
sprog->ss[PIPE_SHADER_FRAGMENT] = fs;
sprog->vs_fs_key = (((uint64_t)fs->id) << 32) | (vs->id & ~VREND_PROGRAM_NQUEUE_MASK) |
(sprog->dual_src_linked ? 1 : 0);
sprog->ss[PIPE_SHADER_GEOMETRY] = gs;
sprog->ss[PIPE_SHADER_TESS_CTRL] = tcs;
sprog->ss[PIPE_SHADER_TESS_EVAL] = tes;
list_add(&sprog->sl[PIPE_SHADER_VERTEX], &vs->programs);
list_add(&sprog->sl[PIPE_SHADER_FRAGMENT], &fs->programs);
if (gs)
list_add(&sprog->sl[PIPE_SHADER_GEOMETRY], &gs->programs);
if (tcs)
list_add(&sprog->sl[PIPE_SHADER_TESS_CTRL], &tcs->programs);
if (tes)
list_add(&sprog->sl[PIPE_SHADER_TESS_EVAL], &tes->programs);
last_shader = tes ? PIPE_SHADER_TESS_EVAL : (gs ? PIPE_SHADER_GEOMETRY : PIPE_SHADER_FRAGMENT);
sprog->id = prog_id;
list_addtail(&sprog->head, &sub_ctx->gl_programs[vs->id & VREND_PROGRAM_NQUEUE_MASK]);
if (fs->key.pstipple_tex)
sprog->fs_stipple_loc = glGetUniformLocation(prog_id, "pstipple_sampler");
else
sprog->fs_stipple_loc = -1;
if (vrend_state.use_core_profile) {
sprog->fs_alpha_ref_val_loc = glGetUniformLocation(prog_id, "alpha_ref_val");
sprog->fs_alpha_func_loc = glGetUniformLocation(prog_id, "alpha_func");
} else {
sprog->fs_alpha_ref_val_loc = -1;
sprog->fs_alpha_func_loc = -1;
}
sprog->vs_ws_adjust_loc = glGetUniformLocation(prog_id, "winsys_adjust_y");
vrend_use_program(sub_ctx, prog_id);
int next_ubo_id = 0, next_sampler_id = 0;
for (int shader_type = PIPE_SHADER_VERTEX; shader_type <= last_shader; shader_type++) {
if (!sprog->ss[shader_type])
continue;
next_sampler_id = bind_sampler_locs(sprog, shader_type, next_sampler_id);
bind_const_locs(sprog, shader_type);
next_ubo_id = bind_ubo_locs(sprog, shader_type, next_ubo_id);
bind_image_locs(sprog, shader_type);
bind_ssbo_locs(sprog, shader_type);
}
if (!has_feature(feat_gles31_vertex_attrib_binding)) {
if (vs->sel->sinfo.num_inputs) {
sprog->attrib_locs = calloc(vs->sel->sinfo.num_inputs, sizeof(uint32_t));
if (sprog->attrib_locs) {
for (i = 0; i < vs->sel->sinfo.num_inputs; i++) {
snprintf(name, 32, "in_%d", i);
sprog->attrib_locs[i] = glGetAttribLocation(prog_id, name);
}
}
} else
sprog->attrib_locs = NULL;
}
sprog->clip_enabled_loc = glGetUniformLocation(prog_id, "clip_plane_enabled");
for (i = 0; i < VIRGL_NUM_CLIP_PLANES; i++) {
snprintf(name, 32, "clipp[%d]", i);
sprog->clip_locs[i] = glGetUniformLocation(prog_id, name);
}
return sprog;
}
| 0
|
6,149
|
tok_nextc(struct tok_state *tok)
{
for (;;) {
if (tok->cur != tok->inp) {
return Py_CHARMASK(*tok->cur++); /* Fast path */
}
if (tok->done != E_OK)
return EOF;
if (tok->fp == NULL) {
char *end = strchr(tok->inp, '\n');
if (end != NULL)
end++;
else {
end = strchr(tok->inp, '\0');
if (end == tok->inp) {
tok->done = E_EOF;
return EOF;
}
}
if (tok->start == NULL)
tok->buf = tok->cur;
tok->line_start = tok->cur;
tok->lineno++;
tok->inp = end;
return Py_CHARMASK(*tok->cur++);
}
if (tok->prompt != NULL) {
char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
#ifndef PGEN
if (newtok != NULL) {
char *translated = translate_newlines(newtok, 0, tok);
PyMem_FREE(newtok);
if (translated == NULL)
return EOF;
newtok = translated;
}
if (tok->encoding && newtok && *newtok) {
/* Recode to UTF-8 */
Py_ssize_t buflen;
const char* buf;
PyObject *u = translate_into_utf8(newtok, tok->encoding);
PyMem_FREE(newtok);
if (!u) {
tok->done = E_DECODE;
return EOF;
}
buflen = PyBytes_GET_SIZE(u);
buf = PyBytes_AS_STRING(u);
newtok = PyMem_MALLOC(buflen+1);
strcpy(newtok, buf);
Py_DECREF(u);
}
#endif
if (tok->nextprompt != NULL)
tok->prompt = tok->nextprompt;
if (newtok == NULL)
tok->done = E_INTR;
else if (*newtok == '\0') {
PyMem_FREE(newtok);
tok->done = E_EOF;
}
else if (tok->start != NULL) {
size_t start = tok->start - tok->buf;
size_t oldlen = tok->cur - tok->buf;
size_t newlen = oldlen + strlen(newtok);
char *buf = tok->buf;
buf = (char *)PyMem_REALLOC(buf, newlen+1);
tok->lineno++;
if (buf == NULL) {
PyMem_FREE(tok->buf);
tok->buf = NULL;
PyMem_FREE(newtok);
tok->done = E_NOMEM;
return EOF;
}
tok->buf = buf;
tok->cur = tok->buf + oldlen;
tok->line_start = tok->cur;
strcpy(tok->buf + oldlen, newtok);
PyMem_FREE(newtok);
tok->inp = tok->buf + newlen;
tok->end = tok->inp + 1;
tok->start = tok->buf + start;
}
else {
tok->lineno++;
if (tok->buf != NULL)
PyMem_FREE(tok->buf);
tok->buf = newtok;
tok->cur = tok->buf;
tok->line_start = tok->buf;
tok->inp = strchr(tok->buf, '\0');
tok->end = tok->inp + 1;
}
}
else {
int done = 0;
Py_ssize_t cur = 0;
char *pt;
if (tok->start == NULL) {
if (tok->buf == NULL) {
tok->buf = (char *)
PyMem_MALLOC(BUFSIZ);
if (tok->buf == NULL) {
tok->done = E_NOMEM;
return EOF;
}
tok->end = tok->buf + BUFSIZ;
}
if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf),
tok) == NULL) {
if (!tok->decoding_erred)
tok->done = E_EOF;
done = 1;
}
else {
tok->done = E_OK;
tok->inp = strchr(tok->buf, '\0');
done = tok->inp == tok->buf || tok->inp[-1] == '\n';
}
}
else {
cur = tok->cur - tok->buf;
if (decoding_feof(tok)) {
tok->done = E_EOF;
done = 1;
}
else
tok->done = E_OK;
}
tok->lineno++;
/* Read until '\n' or EOF */
while (!done) {
Py_ssize_t curstart = tok->start == NULL ? -1 :
tok->start - tok->buf;
Py_ssize_t curvalid = tok->inp - tok->buf;
Py_ssize_t newsize = curvalid + BUFSIZ;
char *newbuf = tok->buf;
newbuf = (char *)PyMem_REALLOC(newbuf,
newsize);
if (newbuf == NULL) {
tok->done = E_NOMEM;
tok->cur = tok->inp;
return EOF;
}
tok->buf = newbuf;
tok->cur = tok->buf + cur;
tok->line_start = tok->cur;
tok->inp = tok->buf + curvalid;
tok->end = tok->buf + newsize;
tok->start = curstart < 0 ? NULL :
tok->buf + curstart;
if (decoding_fgets(tok->inp,
(int)(tok->end - tok->inp),
tok) == NULL) {
/* Break out early on decoding
errors, as tok->buf will be NULL
*/
if (tok->decoding_erred)
return EOF;
/* Last line does not end in \n,
fake one */
strcpy(tok->inp, "\n");
}
tok->inp = strchr(tok->inp, '\0');
done = tok->inp[-1] == '\n';
}
if (tok->buf != NULL) {
tok->cur = tok->buf + cur;
tok->line_start = tok->cur;
/* replace "\r\n" with "\n" */
/* For Mac leave the \r, giving a syntax error */
pt = tok->inp - 2;
if (pt >= tok->buf && *pt == '\r') {
*pt++ = '\n';
*pt = '\0';
tok->inp = pt;
}
}
}
if (tok->done != E_OK) {
if (tok->prompt != NULL)
PySys_WriteStderr("\n");
tok->cur = tok->inp;
return EOF;
}
}
/*NOTREACHED*/
}
| 1
|
464,064
|
ecc_ecdsa_sign (const struct ecc_curve *ecc,
const mp_limb_t *zp,
/* Random nonce, must be invertible mod ecc group
order. */
const mp_limb_t *kp,
size_t length, const uint8_t *digest,
mp_limb_t *rp, mp_limb_t *sp,
mp_limb_t *scratch)
{
#define P scratch
#define kinv scratch
#define hp (scratch + ecc->p.size) /* NOTE: ecc->p.size + 1 limbs! */
#define tp (scratch + 2*ecc->p.size)
/* Procedure, according to RFC 6090, "KT-I". q denotes the group
order.
1. k <-- uniformly random, 0 < k < q
2. R <-- (r_x, r_y) = k g
3. s1 <-- r_x mod q
4. s2 <-- (h + z*s1)/k mod q.
*/
ecc->mul_g (ecc, P, kp, P + 3*ecc->p.size);
/* x coordinate only, modulo q */
ecc->h_to_a (ecc, 2, rp, P, P + 3*ecc->p.size);
/* Invert k, uses up to 7 * ecc->p.size including scratch (for secp384). */
ecc->q.invert (&ecc->q, kinv, kp, tp);
/* Process hash digest */
ecc_hash (&ecc->q, hp, length, digest);
ecc_mod_mul (&ecc->q, tp, zp, rp, tp);
ecc_mod_add (&ecc->q, hp, hp, tp);
ecc_mod_mul_canonical (&ecc->q, sp, hp, kinv, tp);
#undef P
#undef hp
#undef kinv
#undef tp
}
| 0
|
358,959
|
static int rsvp_change(struct tcf_proto *tp, unsigned long base,
u32 handle,
struct rtattr **tca,
unsigned long *arg)
{
struct rsvp_head *data = tp->root;
struct rsvp_filter *f, **fp;
struct rsvp_session *s, **sp;
struct tc_rsvp_pinfo *pinfo = NULL;
struct rtattr *opt = tca[TCA_OPTIONS-1];
struct rtattr *tb[TCA_RSVP_MAX];
struct tcf_exts e;
unsigned h1, h2;
u32 *dst;
int err;
if (opt == NULL)
return handle ? -EINVAL : 0;
if (rtattr_parse_nested(tb, TCA_RSVP_MAX, opt) < 0)
return -EINVAL;
err = tcf_exts_validate(tp, tb, tca[TCA_RATE-1], &e, &rsvp_ext_map);
if (err < 0)
return err;
if ((f = (struct rsvp_filter*)*arg) != NULL) {
/* Node exists: adjust only classid */
if (f->handle != handle && handle)
goto errout2;
if (tb[TCA_RSVP_CLASSID-1]) {
f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]);
tcf_bind_filter(tp, &f->res, base);
}
tcf_exts_change(tp, &f->exts, &e);
return 0;
}
/* Now more serious part... */
err = -EINVAL;
if (handle)
goto errout2;
if (tb[TCA_RSVP_DST-1] == NULL)
goto errout2;
err = -ENOBUFS;
f = kmalloc(sizeof(struct rsvp_filter), GFP_KERNEL);
if (f == NULL)
goto errout2;
memset(f, 0, sizeof(*f));
h2 = 16;
if (tb[TCA_RSVP_SRC-1]) {
err = -EINVAL;
if (RTA_PAYLOAD(tb[TCA_RSVP_SRC-1]) != sizeof(f->src))
goto errout;
memcpy(f->src, RTA_DATA(tb[TCA_RSVP_SRC-1]), sizeof(f->src));
h2 = hash_src(f->src);
}
if (tb[TCA_RSVP_PINFO-1]) {
err = -EINVAL;
if (RTA_PAYLOAD(tb[TCA_RSVP_PINFO-1]) < sizeof(struct tc_rsvp_pinfo))
goto errout;
pinfo = RTA_DATA(tb[TCA_RSVP_PINFO-1]);
f->spi = pinfo->spi;
f->tunnelhdr = pinfo->tunnelhdr;
}
if (tb[TCA_RSVP_CLASSID-1]) {
err = -EINVAL;
if (RTA_PAYLOAD(tb[TCA_RSVP_CLASSID-1]) != 4)
goto errout;
f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]);
}
err = -EINVAL;
if (RTA_PAYLOAD(tb[TCA_RSVP_DST-1]) != sizeof(f->src))
goto errout;
dst = RTA_DATA(tb[TCA_RSVP_DST-1]);
h1 = hash_dst(dst, pinfo ? pinfo->protocol : 0, pinfo ? pinfo->tunnelid : 0);
err = -ENOMEM;
if ((f->handle = gen_handle(tp, h1 | (h2<<8))) == 0)
goto errout;
if (f->tunnelhdr) {
err = -EINVAL;
if (f->res.classid > 255)
goto errout;
err = -ENOMEM;
if (f->res.classid == 0 &&
(f->res.classid = gen_tunnel(data)) == 0)
goto errout;
}
for (sp = &data->ht[h1]; (s=*sp) != NULL; sp = &s->next) {
if (dst[RSVP_DST_LEN-1] == s->dst[RSVP_DST_LEN-1] &&
pinfo && pinfo->protocol == s->protocol &&
memcmp(&pinfo->dpi, &s->dpi, sizeof(s->dpi)) == 0
#if RSVP_DST_LEN == 4
&& dst[0] == s->dst[0]
&& dst[1] == s->dst[1]
&& dst[2] == s->dst[2]
#endif
&& pinfo->tunnelid == s->tunnelid) {
insert:
/* OK, we found appropriate session */
fp = &s->ht[h2];
f->sess = s;
if (f->tunnelhdr == 0)
tcf_bind_filter(tp, &f->res, base);
tcf_exts_change(tp, &f->exts, &e);
for (fp = &s->ht[h2]; *fp; fp = &(*fp)->next)
if (((*fp)->spi.mask&f->spi.mask) != f->spi.mask)
break;
f->next = *fp;
wmb();
*fp = f;
*arg = (unsigned long)f;
return 0;
}
}
/* No session found. Create new one. */
err = -ENOBUFS;
s = kmalloc(sizeof(struct rsvp_session), GFP_KERNEL);
if (s == NULL)
goto errout;
memset(s, 0, sizeof(*s));
memcpy(s->dst, dst, sizeof(s->dst));
if (pinfo) {
s->dpi = pinfo->dpi;
s->protocol = pinfo->protocol;
s->tunnelid = pinfo->tunnelid;
}
for (sp = &data->ht[h1]; *sp; sp = &(*sp)->next) {
if (((*sp)->dpi.mask&s->dpi.mask) != s->dpi.mask)
break;
}
s->next = *sp;
wmb();
*sp = s;
goto insert;
errout:
if (f)
kfree(f);
errout2:
tcf_exts_destroy(tp, &e);
return err;
}
| 0
|
461,462
|
static void coroutine_fn v9fs_link(void *opaque)
{
V9fsPDU *pdu = opaque;
int32_t dfid, oldfid;
V9fsFidState *dfidp, *oldfidp;
V9fsString name;
size_t offset = 7;
int err = 0;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data);
if (name_is_illegal(name.data)) {
err = -ENOENT;
goto out_nofid;
}
if (!strcmp(".", name.data) || !strcmp("..", name.data)) {
err = -EEXIST;
goto out_nofid;
}
dfidp = get_fid(pdu, dfid);
if (dfidp == NULL) {
err = -ENOENT;
goto out_nofid;
}
oldfidp = get_fid(pdu, oldfid);
if (oldfidp == NULL) {
err = -ENOENT;
goto out;
}
err = v9fs_co_link(pdu, oldfidp, dfidp, &name);
if (!err) {
err = offset;
}
put_fid(pdu, oldfidp);
out:
put_fid(pdu, dfidp);
out_nofid:
v9fs_string_free(&name);
pdu_complete(pdu, err);
}
| 0
|
208,921
|
AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
AutofillDriver* driver)
: manager_(manager), driver_(driver) {
DCHECK(manager);
}
| 0
|
156,814
|
ves_icall_Type_GetInterfaces (MonoReflectionType* type)
{
MonoError error;
MonoDomain *domain = mono_object_domain (type);
MonoArray *intf;
GPtrArray *ifaces = NULL;
int i;
MonoClass *class = mono_class_from_mono_type (type->type);
MonoClass *parent;
MonoBitSet *slots;
MonoGenericContext *context = NULL;
MONO_ARCH_SAVE_REGS;
if (class->generic_class && class->generic_class->context.class_inst->is_open) {
context = mono_class_get_context (class);
class = class->generic_class->container_class;
}
mono_class_setup_vtable (class);
slots = mono_bitset_new (class->max_interface_id + 1, 0);
for (parent = class; parent; parent = parent->parent) {
GPtrArray *tmp_ifaces = mono_class_get_implemented_interfaces (parent, &error);
if (!mono_error_ok (&error)) {
mono_bitset_free (slots);
mono_error_raise_exception (&error);
return NULL;
} else if (tmp_ifaces) {
for (i = 0; i < tmp_ifaces->len; ++i) {
MonoClass *ic = g_ptr_array_index (tmp_ifaces, i);
if (mono_bitset_test (slots, ic->interface_id))
continue;
mono_bitset_set (slots, ic->interface_id);
if (ifaces == NULL)
ifaces = g_ptr_array_new ();
g_ptr_array_add (ifaces, ic);
}
g_ptr_array_free (tmp_ifaces, TRUE);
}
}
mono_bitset_free (slots);
if (!ifaces)
return mono_array_new_cached (domain, mono_defaults.monotype_class, 0);
intf = mono_array_new_cached (domain, mono_defaults.monotype_class, ifaces->len);
for (i = 0; i < ifaces->len; ++i) {
MonoClass *ic = g_ptr_array_index (ifaces, i);
MonoType *ret = &ic->byval_arg, *inflated = NULL;
if (context && ic->generic_class && ic->generic_class->context.class_inst->is_open)
inflated = ret = mono_class_inflate_generic_type (ret, context);
mono_array_setref (intf, i, mono_type_get_object (domain, ret));
if (inflated)
mono_metadata_free_type (inflated);
}
g_ptr_array_free (ifaces, TRUE);
return intf;
}
| 0
|
343,649
|
void unix_notinflight(struct file *fp)
{
struct sock *s = unix_get_socket(fp);
if(s) {
atomic_dec(&unix_sk(s)->inflight);
atomic_dec(&unix_tot_inflight);
}
}
| 1
|
255,014
|
static void chs_assemble_msbs_lsbs(DCAXllDecoder *s, DCAXllChSet *c, int band)
{
DCAXllBand *b = &c->bands[band];
int n, ch, nsamples = s->nframesamples;
for (ch = 0; ch < c->nchannels; ch++) {
int shift = chs_get_lsb_width(s, c, band, ch);
if (shift) {
int32_t *msb = b->msb_sample_buffer[ch];
if (b->nscalablelsbs[ch]) {
int32_t *lsb = b->lsb_sample_buffer[ch];
int adj = b->bit_width_adjust[ch];
for (n = 0; n < nsamples; n++)
msb[n] = msb[n] * (1 << shift) + (lsb[n] << adj);
} else {
for (n = 0; n < nsamples; n++)
msb[n] = msb[n] * (1 << shift);
}
}
}
}
| 1
|
28,695
|
static int decode_residuals ( FLACContext * s , int32_t * decoded , int pred_order ) {
int i , tmp , partition , method_type , rice_order ;
int rice_bits , rice_esc ;
int samples ;
method_type = get_bits ( & s -> gb , 2 ) ;
if ( method_type > 1 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "illegal residual coding method %d\n" , method_type ) ;
return - 1 ;
}
rice_order = get_bits ( & s -> gb , 4 ) ;
samples = s -> blocksize >> rice_order ;
if ( pred_order > samples ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid predictor order: %i > %i\n" , pred_order , samples ) ;
return - 1 ;
}
rice_bits = 4 + method_type ;
rice_esc = ( 1 << rice_bits ) - 1 ;
decoded += pred_order ;
i = pred_order ;
for ( partition = 0 ;
partition < ( 1 << rice_order ) ;
partition ++ ) {
tmp = get_bits ( & s -> gb , rice_bits ) ;
if ( tmp == rice_esc ) {
tmp = get_bits ( & s -> gb , 5 ) ;
for ( ;
i < samples ;
i ++ ) * decoded ++ = get_sbits_long ( & s -> gb , tmp ) ;
}
else {
for ( ;
i < samples ;
i ++ ) {
* decoded ++ = get_sr_golomb_flac ( & s -> gb , tmp , INT_MAX , 0 ) ;
}
}
i = 0 ;
}
return 0 ;
}
| 0
|
284,627
|
static inline int unicode_cp_is_allowed(unsigned uni_cp, int document_type)
{
/* XML 1.0 HTML 4.01 HTML 5
* 0x09..0x0A 0x09..0x0A 0x09..0x0A
* 0x0D 0x0D 0x0C..0x0D
* 0x0020..0xD7FF 0x20..0x7E 0x20..0x7E
* 0x00A0..0xD7FF 0x00A0..0xD7FF
* 0xE000..0xFFFD 0xE000..0x10FFFF 0xE000..0xFDCF
* 0x010000..0x10FFFF 0xFDF0..0x10FFFF (*)
*
* (*) exclude code points where ((code & 0xFFFF) >= 0xFFFE)
*
* References:
* XML 1.0: <http://www.w3.org/TR/REC-xml/#charsets>
* HTML 4.01: <http://www.w3.org/TR/1999/PR-html40-19990824/sgml/sgmldecl.html>
* HTML 5: <http://dev.w3.org/html5/spec/Overview.html#preprocessing-the-input-stream>
*
* Not sure this is the relevant part for HTML 5, though. I opted to
* disallow the characters that would result in a parse error when
* preprocessing of the input stream. See also section 8.1.3.
*
* It's unclear if XHTML 1.0 allows C1 characters. I'll opt to apply to
* XHTML 1.0 the same rules as for XML 1.0.
* See <http://cmsmcq.com/2007/C1.xml>.
*/
switch (document_type) {
case ENT_HTML_DOC_HTML401:
return (uni_cp >= 0x20 && uni_cp <= 0x7E) ||
(uni_cp == 0x0A || uni_cp == 0x09 || uni_cp == 0x0D) ||
(uni_cp >= 0xA0 && uni_cp <= 0xD7FF) ||
(uni_cp >= 0xE000 && uni_cp <= 0x10FFFF);
case ENT_HTML_DOC_HTML5:
return (uni_cp >= 0x20 && uni_cp <= 0x7E) ||
(uni_cp >= 0x09 && uni_cp <= 0x0D && uni_cp != 0x0B) || /* form feed U+0C allowed */
(uni_cp >= 0xA0 && uni_cp <= 0xD7FF) ||
(uni_cp >= 0xE000 && uni_cp <= 0x10FFFF &&
((uni_cp & 0xFFFF) < 0xFFFE) && /* last two of each plane (nonchars) disallowed */
(uni_cp < 0xFDD0 || uni_cp > 0xFDEF)); /* U+FDD0-U+FDEF (nonchars) disallowed */
case ENT_HTML_DOC_XHTML:
case ENT_HTML_DOC_XML1:
return (uni_cp >= 0x20 && uni_cp <= 0xD7FF) ||
(uni_cp == 0x0A || uni_cp == 0x09 || uni_cp == 0x0D) ||
(uni_cp >= 0xE000 && uni_cp <= 0x10FFFF && uni_cp != 0xFFFE && uni_cp != 0xFFFF);
default:
return 1;
}
}
| 0
|
419,113
|
format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
{
struct format_tree *ft;
if (!event_initialized(&format_job_event)) {
evtimer_set(&format_job_event, format_job_timer, NULL);
format_job_timer(-1, 0, NULL);
}
ft = xcalloc(1, sizeof *ft);
RB_INIT(&ft->tree);
if (c != NULL) {
ft->client = c;
ft->client->references++;
}
ft->tag = tag;
ft->flags = flags;
format_add_cb(ft, "host", format_cb_host);
format_add_cb(ft, "host_short", format_cb_host_short);
format_add_cb(ft, "pid", format_cb_pid);
format_add(ft, "socket_path", "%s", socket_path);
format_add_tv(ft, "start_time", &start_time);
if (item != NULL) {
if (item->cmd != NULL)
format_add(ft, "command", "%s", item->cmd->entry->name);
if (item->shared != NULL && item->shared->formats != NULL)
format_merge(ft, item->shared->formats);
}
return (ft);
}
| 0
|
335,454
|
static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
int buf_size)
{
int start_found, i;
uint32_t state;
ParseContext *pc = &pc1->pc;
start_found = pc->frame_start_found;
state = pc->state;
i = 0;
if (!start_found) {
for (i = 0; i < buf_size; i++) {
state = (state << 8) | buf[i];
if (IS_MARKER(state, i, buf, buf_size)) {
if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM) {
start_found = 1;
pc1->lastmarker = state;
i++;
break;
}
}
}
}
if (start_found) {
for (; i < buf_size; i++) {
pc1->size++;
state = (state << 8) | buf[i];
if (state == DCA_SYNCWORD_SUBSTREAM && !pc1->hd_pos)
pc1->hd_pos = pc1->size;
if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM)) {
if (pc1->framesize > pc1->size)
continue;
pc->frame_start_found = 0;
pc->state = -1;
pc1->size = 0;
return i - 3;
}
}
}
pc->frame_start_found = start_found;
pc->state = state;
return END_NOT_FOUND;
}
| 0
|
127,749
|
static void cmd_anal_hint(RCore *core, const char *input) {
switch (input[0]) {
case '?':
if (input[1]) {
ut64 addr = r_num_math (core->num, input + 1);
r_core_anal_hint_print (core->anal, addr, 0);
} else {
r_core_cmd_help (core, help_msg_ah);
}
break;
case '.': // "ah."
r_core_anal_hint_print (core->anal, core->offset, 0);
break;
case 'a': // "aha" set arch
if (input[1]) {
int i;
char *ptr = strdup (input + 2);
i = r_str_word_set0 (ptr);
if (i == 2) {
r_num_math (core->num, r_str_word_get0 (ptr, 1));
}
r_anal_hint_set_arch (core->anal, core->offset, r_str_word_get0 (ptr, 0));
free (ptr);
} else if (input[1] == '-') {
r_anal_hint_unset_arch (core->anal, core->offset);
} else {
eprintf ("Missing argument\n");
}
break;
case 'b': // "ahb" set bits
if (input[1]) {
char *ptr = strdup (input + 2);
int bits;
int i = r_str_word_set0 (ptr);
if (i == 2) {
r_num_math (core->num, r_str_word_get0 (ptr, 1));
}
bits = r_num_math (core->num, r_str_word_get0 (ptr, 0));
r_anal_hint_set_bits (core->anal, core->offset, bits);
free (ptr);
} else if (input[1] == '-') {
r_anal_hint_unset_bits (core->anal, core->offset);
} else {
eprintf ("Missing argument\n");
}
break;
case 'i': // "ahi"
if (input[1] == '?') {
r_core_cmd_help (core, help_msg_ahi);
} else if (input[1] == ' ') {
// You can either specify immbase with letters, or numbers
const int base =
(input[2] == 's') ? 1 :
(input[2] == 'b') ? 2 :
(input[2] == 'p') ? 3 :
(input[2] == 'o') ? 8 :
(input[2] == 'd') ? 10 :
(input[2] == 'h') ? 16 :
(input[2] == 'i') ? 32 : // ip address
(input[2] == 'S') ? 80 : // syscall
(int) r_num_math (core->num, input + 1);
r_anal_hint_set_immbase (core->anal, core->offset, base);
} else if (input[1] == '-') { // "ahi-"
r_anal_hint_set_immbase (core->anal, core->offset, 0);
} else {
eprintf ("|ERROR| Usage: ahi [base]\n");
}
break;
case 'h': // "ahh"
if (input[1] == '-') {
r_anal_hint_unset_high (core->anal, core->offset);
} else if (input[1] == ' ') {
r_anal_hint_set_high (core->anal, r_num_math (core->num, input + 1));
} else {
r_anal_hint_set_high (core->anal, core->offset);
}
break;
case 'c': // "ahc"
if (input[1] == ' ') {
r_anal_hint_set_jump (
core->anal, core->offset,
r_num_math (core->num, input + 1));
} else if (input[1] == '-') {
r_anal_hint_unset_jump (core->anal, core->offset);
}
break;
case 'f': // "ahf"
if (input[1] == ' ') {
r_anal_hint_set_fail (
core->anal, core->offset,
r_num_math (core->num, input + 1));
} else if (input[1] == '-') {
r_anal_hint_unset_fail (core->anal, core->offset);
}
break;
case 's': // "ahs" set size (opcode length)
if (input[1] == ' ') {
r_anal_hint_set_size (core->anal, core->offset, atoi (input + 1));
} else if (input[1] == '-') {
r_anal_hint_unset_size (core->anal, core->offset);
} else {
eprintf ("Usage: ahs 16\n");
}
break;
case 'S': // "ahS" set size (opcode length)
if (input[1] == ' ') {
r_anal_hint_set_syntax (core->anal, core->offset, input + 2);
} else if (input[1] == '-') {
r_anal_hint_unset_syntax (core->anal, core->offset);
} else {
eprintf ("Usage: ahS att\n");
}
break;
case 'o': // "aho" set opcode string
if (input[1] == ' ') {
r_anal_hint_set_opcode (core->anal, core->offset, input + 2);
} else if (input[1] == '-') {
r_anal_hint_unset_opcode (core->anal, core->offset);
} else {
eprintf ("Usage: aho popall\n");
}
break;
case 'e': // "ahe" set ESIL string
if (input[1] == ' ') {
r_anal_hint_set_esil (core->anal, core->offset, input + 2);
} else if (input[1] == '-') {
r_anal_hint_unset_esil (core->anal, core->offset);
} else {
eprintf ("Usage: ahe r0,pc,=\n");
}
break;
#if 0
case 'e': // set endian
if (input[1] == ' ') {
r_anal_hint_set_opcode (core->anal, core->offset, atoi (input + 1));
} else if (input[1] == '-') {
r_anal_hint_unset_opcode (core->anal, core->offset);
}
break;
#endif
case 'p': // "ahp"
if (input[1] == ' ') {
r_anal_hint_set_pointer (core->anal, core->offset, r_num_math (core->num, input + 1));
} else if (input[1] == '-') { // "ahp-"
r_anal_hint_unset_pointer (core->anal, core->offset);
}
break;
case 'r': // "ahr"
if (input[1] == ' ') {
r_anal_hint_set_ret (core->anal, core->offset, r_num_math (core->num, input + 1));
} else if (input[1] == '-') { // "ahr-"
r_anal_hint_unset_ret (core->anal, core->offset);
}
case '*': // "ah*"
if (input[1] == ' ') {
char *ptr = strdup (r_str_trim_ro (input + 2));
r_str_word_set0 (ptr);
ut64 addr = r_num_math (core->num, r_str_word_get0 (ptr, 0));
r_core_anal_hint_print (core->anal, addr, '*');
} else {
r_core_anal_hint_list (core->anal, input[0]);
}
break;
case 'j': // "ahj"
case '\0': // "ah"
r_core_anal_hint_list (core->anal, input[0]);
break;
case '-': // "ah-"
if (input[1]) {
if (input[1] == '*') {
r_anal_hint_clear (core->anal);
} else {
char *ptr = strdup (r_str_trim_ro (input + 1));
ut64 addr;
int size = 1;
int i = r_str_word_set0 (ptr);
if (i == 2) {
size = r_num_math (core->num, r_str_word_get0 (ptr, 1));
}
const char *a0 = r_str_word_get0 (ptr, 0);
if (a0 && *a0) {
addr = r_num_math (core->num, a0);
} else {
addr = core->offset;
}
r_anal_hint_del (core->anal, addr, size);
free (ptr);
}
} else {
r_anal_hint_clear (core->anal);
}
break;
}
}
| 0
|
441,206
|
void RGWGetObjRetention_ObjStore_S3::send_response()
{
if (op_ret) {
set_req_state_err(s, op_ret);
}
dump_errno(s);
end_header(s, this, "application/xml");
dump_start(s);
if (op_ret) {
return;
}
encode_xml("Retention", obj_retention, s->formatter);
rgw_flush_formatter_and_reset(s, s->formatter);
}
| 0
|
105,145
|
static void start_interleave_scan(struct hci_dev *hdev)
{
hdev->interleave_scan_state = INTERLEAVE_SCAN_NO_FILTER;
queue_delayed_work(hdev->req_workqueue,
&hdev->interleave_scan, 0);
}
| 0
|
288,459
|
static int cli_scanfile ( const char * filename , cli_ctx * ctx ) {
int fd , ret ;
fd = safe_open ( filename , O_RDONLY | O_BINARY ) ;
if ( fd < 0 ) return CL_EOPEN ;
ret = cli_magic_scandesc ( fd , ctx ) ;
close ( fd ) ;
return ret ;
}
| 0
|
394,198
|
blkid_parttable blkid_partlist_get_table(blkid_partlist ls)
{
if (list_empty(&ls->l_tabs))
return NULL;
return list_entry(ls->l_tabs.next,
struct blkid_struct_parttable, t_tabs);
}
| 0
|
55,954
|
apr_byte_t oidc_cache_mutex_destroy(server_rec *s, oidc_cache_mutex_t *m) {
apr_status_t rv = APR_SUCCESS;
// oidc_sdebug(s, "enter: %d (m=%pp,s=%pp, p=%d)", (m && m->sema) ? *m->sema : -1, m->mutex ? m->mutex : 0, s, m->is_parent);
if (m->mutex != NULL) {
apr_global_mutex_lock(m->mutex);
(*m->sema)--;
//oidc_sdebug(s, "semaphore: %d (m=%pp,s=%pp)", *m->sema, m->mutex, s);
// oidc_sdebug(s, "processing: %d (m=%pp,s=%pp, p=%d)", (m && m->sema) ? *m->sema : -1, m->mutex ? m->mutex : 0, s, m->is_parent);
if ((m->shm != NULL) && (*m->sema == 0)) {
rv = apr_shm_destroy(m->shm);
oidc_sdebug(s, "apr_shm_destroy for semaphore returned: %d", rv);
m->shm = NULL;
apr_global_mutex_unlock(m->mutex);
rv = apr_global_mutex_destroy(m->mutex);
oidc_sdebug(s, "apr_global_mutex_destroy returned :%d", rv);
m->mutex = NULL;
rv = APR_SUCCESS;
} else {
apr_global_mutex_unlock(m->mutex);
}
}
return rv;
}
| 0
|
312,900
|
void HWNDMessageHandler::OnThemeChanged() {
ui::NativeThemeWin::instance()->CloseHandles();
}
| 0
|
37,315
|
//! Resize image to dimensions of a display window \newinstance.
CImg<T> get_resize(const CImgDisplay& disp,
const int interpolation_type=1, const unsigned int boundary_conditions=0,
const float centering_x = 0, const float centering_y = 0,
const float centering_z = 0, const float centering_c = 0) const {
return get_resize(disp.width(),disp.height(),_depth,_spectrum,interpolation_type,boundary_conditions,
centering_x,centering_y,centering_z,centering_c);
| 0
|
482,126
|
static void xennet_alloc_rx_buffers(struct netfront_queue *queue)
{
RING_IDX req_prod = queue->rx.req_prod_pvt;
int notify;
int err = 0;
if (unlikely(!netif_carrier_ok(queue->info->netdev)))
return;
for (req_prod = queue->rx.req_prod_pvt;
req_prod - queue->rx.rsp_cons < NET_RX_RING_SIZE;
req_prod++) {
struct sk_buff *skb;
unsigned short id;
grant_ref_t ref;
struct page *page;
struct xen_netif_rx_request *req;
skb = xennet_alloc_one_rx_buffer(queue);
if (!skb) {
err = -ENOMEM;
break;
}
id = xennet_rxidx(req_prod);
BUG_ON(queue->rx_skbs[id]);
queue->rx_skbs[id] = skb;
ref = gnttab_claim_grant_reference(&queue->gref_rx_head);
WARN_ON_ONCE(IS_ERR_VALUE((unsigned long)(int)ref));
queue->grant_rx_ref[id] = ref;
page = skb_frag_page(&skb_shinfo(skb)->frags[0]);
req = RING_GET_REQUEST(&queue->rx, req_prod);
gnttab_page_grant_foreign_access_ref_one(ref,
queue->info->xbdev->otherend_id,
page,
0);
req->id = id;
req->gref = ref;
}
queue->rx.req_prod_pvt = req_prod;
/* Try again later if there are not enough requests or skb allocation
* failed.
* Enough requests is quantified as the sum of newly created slots and
* the unconsumed slots at the backend.
*/
if (req_prod - queue->rx.rsp_cons < NET_RX_SLOTS_MIN ||
unlikely(err)) {
mod_timer(&queue->rx_refill_timer, jiffies + (HZ/10));
return;
}
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&queue->rx, notify);
if (notify)
notify_remote_via_irq(queue->rx_irq);
}
| 0
|
324,077
|
static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVQcow2State *s = bs->opaque;
unsigned int len, i;
int ret = 0;
QCowHeader header;
Error *local_err = NULL;
uint64_t ext_end;
uint64_t l1_vm_state_index;
ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read qcow2 header");
goto fail;
}
be32_to_cpus(&header.magic);
be32_to_cpus(&header.version);
be64_to_cpus(&header.backing_file_offset);
be32_to_cpus(&header.backing_file_size);
be64_to_cpus(&header.size);
be32_to_cpus(&header.cluster_bits);
be32_to_cpus(&header.crypt_method);
be64_to_cpus(&header.l1_table_offset);
be32_to_cpus(&header.l1_size);
be64_to_cpus(&header.refcount_table_offset);
be32_to_cpus(&header.refcount_table_clusters);
be64_to_cpus(&header.snapshots_offset);
be32_to_cpus(&header.nb_snapshots);
if (header.magic != QCOW_MAGIC) {
error_setg(errp, "Image is not in qcow2 format");
ret = -EINVAL;
goto fail;
}
if (header.version < 2 || header.version > 3) {
error_setg(errp, "Unsupported qcow2 version %" PRIu32, header.version);
ret = -ENOTSUP;
goto fail;
}
s->qcow_version = header.version;
/* Initialise cluster size */
if (header.cluster_bits < MIN_CLUSTER_BITS ||
header.cluster_bits > MAX_CLUSTER_BITS) {
error_setg(errp, "Unsupported cluster size: 2^%" PRIu32,
header.cluster_bits);
ret = -EINVAL;
goto fail;
}
s->cluster_bits = header.cluster_bits;
s->cluster_size = 1 << s->cluster_bits;
s->cluster_sectors = 1 << (s->cluster_bits - 9);
/* Initialise version 3 header fields */
if (header.version == 2) {
header.incompatible_features = 0;
header.compatible_features = 0;
header.autoclear_features = 0;
header.refcount_order = 4;
header.header_length = 72;
} else {
be64_to_cpus(&header.incompatible_features);
be64_to_cpus(&header.compatible_features);
be64_to_cpus(&header.autoclear_features);
be32_to_cpus(&header.refcount_order);
be32_to_cpus(&header.header_length);
if (header.header_length < 104) {
error_setg(errp, "qcow2 header too short");
ret = -EINVAL;
goto fail;
}
}
if (header.header_length > s->cluster_size) {
error_setg(errp, "qcow2 header exceeds cluster size");
ret = -EINVAL;
goto fail;
}
if (header.header_length > sizeof(header)) {
s->unknown_header_fields_size = header.header_length - sizeof(header);
s->unknown_header_fields = g_malloc(s->unknown_header_fields_size);
ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields,
s->unknown_header_fields_size);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read unknown qcow2 header "
"fields");
goto fail;
}
}
if (header.backing_file_offset > s->cluster_size) {
error_setg(errp, "Invalid backing file offset");
ret = -EINVAL;
goto fail;
}
if (header.backing_file_offset) {
ext_end = header.backing_file_offset;
} else {
ext_end = 1 << header.cluster_bits;
}
/* Handle feature bits */
s->incompatible_features = header.incompatible_features;
s->compatible_features = header.compatible_features;
s->autoclear_features = header.autoclear_features;
if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) {
void *feature_table = NULL;
qcow2_read_extensions(bs, header.header_length, ext_end,
&feature_table, NULL);
report_unsupported_feature(errp, feature_table,
s->incompatible_features &
~QCOW2_INCOMPAT_MASK);
ret = -ENOTSUP;
g_free(feature_table);
goto fail;
}
if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) {
/* Corrupt images may not be written to unless they are being repaired
*/
if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) {
error_setg(errp, "qcow2: Image is corrupt; cannot be opened "
"read/write");
ret = -EACCES;
goto fail;
}
}
/* Check support for various header values */
if (header.refcount_order > 6) {
error_setg(errp, "Reference count entry width too large; may not "
"exceed 64 bits");
ret = -EINVAL;
goto fail;
}
s->refcount_order = header.refcount_order;
s->refcount_bits = 1 << s->refcount_order;
s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1);
s->refcount_max += s->refcount_max - 1;
if (header.crypt_method > QCOW_CRYPT_AES) {
error_setg(errp, "Unsupported encryption method: %" PRIu32,
header.crypt_method);
ret = -EINVAL;
goto fail;
}
if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128,
QCRYPTO_CIPHER_MODE_CBC)) {
error_setg(errp, "AES cipher not available");
ret = -EINVAL;
goto fail;
}
s->crypt_method_header = header.crypt_method;
if (s->crypt_method_header) {
if (bdrv_uses_whitelist() &&
s->crypt_method_header == QCOW_CRYPT_AES) {
error_setg(errp,
"Use of AES-CBC encrypted qcow2 images is no longer "
"supported in system emulators");
error_append_hint(errp,
"You can use 'qemu-img convert' to convert your "
"image to an alternative supported format, such "
"as unencrypted qcow2, or raw with the LUKS "
"format instead.\n");
ret = -ENOSYS;
goto fail;
}
bs->encrypted = true;
}
s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */
s->l2_size = 1 << s->l2_bits;
/* 2^(s->refcount_order - 3) is the refcount width in bytes */
s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3);
s->refcount_block_size = 1 << s->refcount_block_bits;
bs->total_sectors = header.size / 512;
s->csize_shift = (62 - (s->cluster_bits - 8));
s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;
s->cluster_offset_mask = (1LL << s->csize_shift) - 1;
s->refcount_table_offset = header.refcount_table_offset;
s->refcount_table_size =
header.refcount_table_clusters << (s->cluster_bits - 3);
if (header.refcount_table_clusters > qcow2_max_refcount_clusters(s)) {
error_setg(errp, "Reference count table too large");
ret = -EINVAL;
goto fail;
}
ret = validate_table_offset(bs, s->refcount_table_offset,
s->refcount_table_size, sizeof(uint64_t));
if (ret < 0) {
error_setg(errp, "Invalid reference count table offset");
goto fail;
}
/* Snapshot table offset/length */
if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) {
error_setg(errp, "Too many snapshots");
ret = -EINVAL;
goto fail;
}
ret = validate_table_offset(bs, header.snapshots_offset,
header.nb_snapshots,
sizeof(QCowSnapshotHeader));
if (ret < 0) {
error_setg(errp, "Invalid snapshot table offset");
goto fail;
}
/* read the level 1 table */
if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) {
error_setg(errp, "Active L1 table too large");
ret = -EFBIG;
goto fail;
}
s->l1_size = header.l1_size;
l1_vm_state_index = size_to_l1(s, header.size);
if (l1_vm_state_index > INT_MAX) {
error_setg(errp, "Image is too big");
ret = -EFBIG;
goto fail;
}
s->l1_vm_state_index = l1_vm_state_index;
/* the L1 table must contain at least enough entries to put
header.size bytes */
if (s->l1_size < s->l1_vm_state_index) {
error_setg(errp, "L1 table is too small");
ret = -EINVAL;
goto fail;
}
ret = validate_table_offset(bs, header.l1_table_offset,
header.l1_size, sizeof(uint64_t));
if (ret < 0) {
error_setg(errp, "Invalid L1 table offset");
goto fail;
}
s->l1_table_offset = header.l1_table_offset;
if (s->l1_size > 0) {
s->l1_table = qemu_try_blockalign(bs->file->bs,
align_offset(s->l1_size * sizeof(uint64_t), 512));
if (s->l1_table == NULL) {
error_setg(errp, "Could not allocate L1 table");
ret = -ENOMEM;
goto fail;
}
ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table,
s->l1_size * sizeof(uint64_t));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read L1 table");
goto fail;
}
for(i = 0;i < s->l1_size; i++) {
be64_to_cpus(&s->l1_table[i]);
}
}
/* Parse driver-specific options */
ret = qcow2_update_options(bs, options, flags, errp);
if (ret < 0) {
goto fail;
}
s->cluster_cache = g_malloc(s->cluster_size);
/* one more sector for decompressed data alignment */
s->cluster_data = qemu_try_blockalign(bs->file->bs, QCOW_MAX_CRYPT_CLUSTERS
* s->cluster_size + 512);
if (s->cluster_data == NULL) {
error_setg(errp, "Could not allocate temporary cluster buffer");
ret = -ENOMEM;
goto fail;
}
s->cluster_cache_offset = -1;
s->flags = flags;
ret = qcow2_refcount_init(bs);
if (ret != 0) {
error_setg_errno(errp, -ret, "Could not initialize refcount handling");
goto fail;
}
QLIST_INIT(&s->cluster_allocs);
QTAILQ_INIT(&s->discards);
/* read qcow2 extensions */
if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL,
&local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
}
/* read the backing file name */
if (header.backing_file_offset != 0) {
len = header.backing_file_size;
if (len > MIN(1023, s->cluster_size - header.backing_file_offset) ||
len >= sizeof(bs->backing_file)) {
error_setg(errp, "Backing file name too long");
ret = -EINVAL;
goto fail;
}
ret = bdrv_pread(bs->file, header.backing_file_offset,
bs->backing_file, len);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read backing file name");
goto fail;
}
bs->backing_file[len] = '\0';
s->image_backing_file = g_strdup(bs->backing_file);
}
/* Internal snapshots */
s->snapshots_offset = header.snapshots_offset;
s->nb_snapshots = header.nb_snapshots;
ret = qcow2_read_snapshots(bs);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read snapshots");
goto fail;
}
/* Clear unknown autoclear feature bits */
if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_features) {
s->autoclear_features = 0;
ret = qcow2_update_header(bs);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2 header");
goto fail;
}
}
/* Initialise locks */
qemu_co_mutex_init(&s->lock);
bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
/* Repair image if dirty */
if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only &&
(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
BdrvCheckResult result = {0};
ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not repair dirty image");
goto fail;
}
}
#ifdef DEBUG_ALLOC
{
BdrvCheckResult result = {0};
qcow2_check_refcounts(bs, &result, 0);
}
#endif
return ret;
fail:
g_free(s->unknown_header_fields);
cleanup_unknown_header_ext(bs);
qcow2_free_snapshots(bs);
qcow2_refcount_close(bs);
qemu_vfree(s->l1_table);
/* else pre-write overlap checks in cache_destroy may crash */
s->l1_table = NULL;
cache_clean_timer_del(bs);
if (s->l2_table_cache) {
qcow2_cache_destroy(bs, s->l2_table_cache);
}
if (s->refcount_block_cache) {
qcow2_cache_destroy(bs, s->refcount_block_cache);
}
g_free(s->cluster_cache);
qemu_vfree(s->cluster_data);
return ret;
}
| 0
|
453,922
|
string str() {
return string("a\0b", 3);
}
| 0
|
235,226
|
RenderView::~RenderView() {
if (decrement_shared_popup_at_destruction_)
shared_popup_counter_->data--;
for (ImageResourceFetcherSet::iterator i = image_fetchers_.begin();
i != image_fetchers_.end(); ++i) {
delete *i;
}
while (!file_chooser_completions_.empty()) {
if (file_chooser_completions_.front()->completion) {
file_chooser_completions_.front()->completion->didChooseFile(
WebVector<WebString>());
}
file_chooser_completions_.pop_front();
}
#if defined(OS_MACOSX)
if (has_document_tag_)
Send(new ViewHostMsg_DocumentWithTagClosed(routing_id_, document_tag_));
#endif
render_thread_->RemoveFilter(audio_message_filter_);
#ifndef NDEBUG
ViewMap* views = Singleton<ViewMap>::get();
for (ViewMap::iterator it = views->begin(); it != views->end(); ++it)
DCHECK_NE(this, it->second) << "Failed to call Close?";
#endif
}
| 0
|
150,192
|
static void airo_print_status(const char *devname, u16 status)
{
u8 reason = status & 0xFF;
switch (status & 0xFF00) {
case STAT_NOBEACON:
switch (status) {
case STAT_NOBEACON:
airo_print_dbg(devname, "link lost (missed beacons)");
break;
case STAT_MAXRETRIES:
case STAT_MAXARL:
airo_print_dbg(devname, "link lost (max retries)");
break;
case STAT_FORCELOSS:
airo_print_dbg(devname, "link lost (local choice)");
break;
case STAT_TSFSYNC:
airo_print_dbg(devname, "link lost (TSF sync lost)");
break;
default:
airo_print_dbg(devname, "unknow status %x\n", status);
break;
}
break;
case STAT_DEAUTH:
airo_print_dbg(devname, "deauthenticated (reason: %d)", reason);
break;
case STAT_DISASSOC:
airo_print_dbg(devname, "disassociated (reason: %d)", reason);
break;
case STAT_ASSOC_FAIL:
airo_print_dbg(devname, "association failed (reason: %d)",
reason);
break;
case STAT_AUTH_FAIL:
airo_print_dbg(devname, "authentication failed (reason: %d)",
reason);
break;
case STAT_ASSOC:
case STAT_REASSOC:
break;
default:
airo_print_dbg(devname, "unknow status %x\n", status);
break;
}
}
| 0
|
123,195
|
static MagickBooleanType ReadPSDChannelPixels(Image *image,
const size_t channels,const size_t row,const ssize_t type,
const unsigned char *pixels,ExceptionInfo *exception)
{
Quantum
pixel;
register const unsigned char
*p;
register Quantum
*q;
register ssize_t
x;
size_t
packet_size;
unsigned short
nibble;
p=pixels;
q=GetAuthenticPixels(image,0,row,image->columns,1,exception);
if (q == (Quantum *) NULL)
return MagickFalse;
packet_size=GetPSDPacketSize(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (packet_size == 1)
pixel=ScaleCharToQuantum(*p++);
else
{
p=PushShortPixel(MSBEndian,p,&nibble);
pixel=ScaleShortToQuantum(nibble);
}
switch (type)
{
case -1:
{
SetPixelAlpha(image,pixel,q);
break;
}
case -2:
case 0:
{
SetPixelRed(image,pixel,q);
if (channels == 1 || type == -2)
SetPixelGray(image,pixel,q);
if (image->storage_class == PseudoClass)
{
if (packet_size == 1)
SetPixelIndex(image,ScaleQuantumToChar(pixel),q);
else
SetPixelIndex(image,ScaleQuantumToShort(pixel),q);
SetPixelViaPixelInfo(image,image->colormap+(ssize_t)
ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q);
if (image->depth == 1)
{
ssize_t
bit,
number_bits;
number_bits=image->columns-x;
if (number_bits > 8)
number_bits=8;
for (bit=0; bit < number_bits; bit++)
{
SetPixelIndex(image,(((unsigned char) pixel) &
(0x01 << (7-bit))) != 0 ? 0 : 255,q);
SetPixelViaPixelInfo(image,image->colormap+(ssize_t)
ConstrainColormapIndex(image,GetPixelIndex(image,q),
exception),q);
q+=GetPixelChannels(image);
x++;
}
x--;
continue;
}
}
break;
}
case 1:
{
if (image->storage_class == PseudoClass)
SetPixelAlpha(image,pixel,q);
else
SetPixelGreen(image,pixel,q);
break;
}
case 2:
{
if (image->storage_class == PseudoClass)
SetPixelAlpha(image,pixel,q);
else
SetPixelBlue(image,pixel,q);
break;
}
case 3:
{
if (image->colorspace == CMYKColorspace)
SetPixelBlack(image,pixel,q);
else
if (image->alpha_trait != UndefinedPixelTrait)
SetPixelAlpha(image,pixel,q);
break;
}
case 4:
{
if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) &&
(channels > 3))
break;
if (image->alpha_trait != UndefinedPixelTrait)
SetPixelAlpha(image,pixel,q);
break;
}
default:
break;
}
q+=GetPixelChannels(image);
}
return(SyncAuthenticPixels(image,exception));
}
| 0
|
368,858
|
void disconnect_server(PgSocket *server, bool notify, const char *reason, ...)
{
PgPool *pool = server->pool;
PgSocket *client;
static const uint8_t pkt_term[] = {'X', 0,0,0,4};
int send_term = 1;
usec_t now = get_cached_time();
char buf[128];
va_list ap;
va_start(ap, reason);
vsnprintf(buf, sizeof(buf), reason, ap);
va_end(ap);
reason = buf;
if (cf_log_disconnections)
slog_info(server, "closing because: %s (age=%" PRIu64 ")", reason,
(now - server->connect_time) / USEC);
switch (server->state) {
case SV_ACTIVE:
client = server->link;
if (client) {
client->link = NULL;
server->link = NULL;
disconnect_client(client, true, "%s", reason);
}
break;
case SV_TESTED:
case SV_USED:
case SV_IDLE:
break;
case SV_LOGIN:
/*
* usually disconnect means problems in startup phase,
* except when sending cancel packet
*/
if (!server->ready)
pool->last_connect_failed = 1;
else
send_term = 0;
break;
default:
fatal("disconnect_server: bad server state (%d)", server->state);
}
Assert(server->link == NULL);
/* notify server and close connection */
if (send_term && notify) {
if (!sbuf_answer(&server->sbuf, pkt_term, sizeof(pkt_term)))
/* ignore result */
notify = false;
}
if (server->dns_token) {
adns_cancel(adns, server->dns_token);
server->dns_token = NULL;
}
change_server_state(server, SV_JUSTFREE);
if (!sbuf_close(&server->sbuf))
log_noise("sbuf_close failed, retry later");
}
| 0
|
135,030
|
void send_open_url(const char *url)
{
GF_Event evt;
memset(&evt, 0, sizeof(GF_Event));
evt.type = GF_EVENT_NAVIGATE;
evt.navigate.to_url = url;
gf_term_send_event(term, &evt);
}
| 0
|
436,883
|
static int fts3InitVtab(
int isCreate, /* True for xCreate, false for xConnect */
sqlite3 *db, /* The SQLite database connection */
void *pAux, /* Hash table containing tokenizers */
int argc, /* Number of elements in argv array */
const char * const *argv, /* xCreate/xConnect argument array */
sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */
char **pzErr /* Write any error message here */
){
Fts3Hash *pHash = (Fts3Hash *)pAux;
Fts3Table *p = 0; /* Pointer to allocated vtab */
int rc = SQLITE_OK; /* Return code */
int i; /* Iterator variable */
sqlite3_int64 nByte; /* Size of allocation used for *p */
int iCol; /* Column index */
int nString = 0; /* Bytes required to hold all column names */
int nCol = 0; /* Number of columns in the FTS table */
char *zCsr; /* Space for holding column names */
int nDb; /* Bytes required to hold database name */
int nName; /* Bytes required to hold table name */
int isFts4 = (argv[0][3]=='4'); /* True for FTS4, false for FTS3 */
const char **aCol; /* Array of column names */
sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */
int nIndex = 0; /* Size of aIndex[] array */
struct Fts3Index *aIndex = 0; /* Array of indexes for this table */
/* The results of parsing supported FTS4 key=value options: */
int bNoDocsize = 0; /* True to omit %_docsize table */
int bDescIdx = 0; /* True to store descending indexes */
char *zPrefix = 0; /* Prefix parameter value (or NULL) */
char *zCompress = 0; /* compress=? parameter (or NULL) */
char *zUncompress = 0; /* uncompress=? parameter (or NULL) */
char *zContent = 0; /* content=? parameter (or NULL) */
char *zLanguageid = 0; /* languageid=? parameter (or NULL) */
char **azNotindexed = 0; /* The set of notindexed= columns */
int nNotindexed = 0; /* Size of azNotindexed[] array */
assert( strlen(argv[0])==4 );
assert( (sqlite3_strnicmp(argv[0], "fts4", 4)==0 && isFts4)
|| (sqlite3_strnicmp(argv[0], "fts3", 4)==0 && !isFts4)
);
nDb = (int)strlen(argv[1]) + 1;
nName = (int)strlen(argv[2]) + 1;
nByte = sizeof(const char *) * (argc-2);
aCol = (const char **)sqlite3_malloc64(nByte);
if( aCol ){
memset((void*)aCol, 0, nByte);
azNotindexed = (char **)sqlite3_malloc64(nByte);
}
if( azNotindexed ){
memset(azNotindexed, 0, nByte);
}
if( !aCol || !azNotindexed ){
rc = SQLITE_NOMEM;
goto fts3_init_out;
}
/* Loop through all of the arguments passed by the user to the FTS3/4
** module (i.e. all the column names and special arguments). This loop
** does the following:
**
** + Figures out the number of columns the FTSX table will have, and
** the number of bytes of space that must be allocated to store copies
** of the column names.
**
** + If there is a tokenizer specification included in the arguments,
** initializes the tokenizer pTokenizer.
*/
for(i=3; rc==SQLITE_OK && i<argc; i++){
char const *z = argv[i];
int nKey;
char *zVal;
/* Check if this is a tokenizer specification */
if( !pTokenizer
&& strlen(z)>8
&& 0==sqlite3_strnicmp(z, "tokenize", 8)
&& 0==sqlite3Fts3IsIdChar(z[8])
){
rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr);
}
/* Check if it is an FTS4 special argument. */
else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){
struct Fts4Option {
const char *zOpt;
int nOpt;
} aFts4Opt[] = {
{ "matchinfo", 9 }, /* 0 -> MATCHINFO */
{ "prefix", 6 }, /* 1 -> PREFIX */
{ "compress", 8 }, /* 2 -> COMPRESS */
{ "uncompress", 10 }, /* 3 -> UNCOMPRESS */
{ "order", 5 }, /* 4 -> ORDER */
{ "content", 7 }, /* 5 -> CONTENT */
{ "languageid", 10 }, /* 6 -> LANGUAGEID */
{ "notindexed", 10 } /* 7 -> NOTINDEXED */
};
int iOpt;
if( !zVal ){
rc = SQLITE_NOMEM;
}else{
for(iOpt=0; iOpt<SizeofArray(aFts4Opt); iOpt++){
struct Fts4Option *pOp = &aFts4Opt[iOpt];
if( nKey==pOp->nOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){
break;
}
}
switch( iOpt ){
case 0: /* MATCHINFO */
if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "fts3", 4) ){
sqlite3Fts3ErrMsg(pzErr, "unrecognized matchinfo: %s", zVal);
rc = SQLITE_ERROR;
}
bNoDocsize = 1;
break;
case 1: /* PREFIX */
sqlite3_free(zPrefix);
zPrefix = zVal;
zVal = 0;
break;
case 2: /* COMPRESS */
sqlite3_free(zCompress);
zCompress = zVal;
zVal = 0;
break;
case 3: /* UNCOMPRESS */
sqlite3_free(zUncompress);
zUncompress = zVal;
zVal = 0;
break;
case 4: /* ORDER */
if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, "asc", 3))
&& (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "desc", 4))
){
sqlite3Fts3ErrMsg(pzErr, "unrecognized order: %s", zVal);
rc = SQLITE_ERROR;
}
bDescIdx = (zVal[0]=='d' || zVal[0]=='D');
break;
case 5: /* CONTENT */
sqlite3_free(zContent);
zContent = zVal;
zVal = 0;
break;
case 6: /* LANGUAGEID */
assert( iOpt==6 );
sqlite3_free(zLanguageid);
zLanguageid = zVal;
zVal = 0;
break;
case 7: /* NOTINDEXED */
azNotindexed[nNotindexed++] = zVal;
zVal = 0;
break;
default:
assert( iOpt==SizeofArray(aFts4Opt) );
sqlite3Fts3ErrMsg(pzErr, "unrecognized parameter: %s", z);
rc = SQLITE_ERROR;
break;
}
sqlite3_free(zVal);
}
}
/* Otherwise, the argument is a column name. */
else {
nString += (int)(strlen(z) + 1);
aCol[nCol++] = z;
}
}
/* If a content=xxx option was specified, the following:
**
** 1. Ignore any compress= and uncompress= options.
**
** 2. If no column names were specified as part of the CREATE VIRTUAL
** TABLE statement, use all columns from the content table.
*/
if( rc==SQLITE_OK && zContent ){
sqlite3_free(zCompress);
sqlite3_free(zUncompress);
zCompress = 0;
zUncompress = 0;
if( nCol==0 ){
sqlite3_free((void*)aCol);
aCol = 0;
rc = fts3ContentColumns(db, argv[1], zContent,&aCol,&nCol,&nString,pzErr);
/* If a languageid= option was specified, remove the language id
** column from the aCol[] array. */
if( rc==SQLITE_OK && zLanguageid ){
int j;
for(j=0; j<nCol; j++){
if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){
int k;
for(k=j; k<nCol; k++) aCol[k] = aCol[k+1];
nCol--;
break;
}
}
}
}
}
if( rc!=SQLITE_OK ) goto fts3_init_out;
if( nCol==0 ){
assert( nString==0 );
aCol[0] = "content";
nString = 8;
nCol = 1;
}
if( pTokenizer==0 ){
rc = sqlite3Fts3InitTokenizer(pHash, "simple", &pTokenizer, pzErr);
if( rc!=SQLITE_OK ) goto fts3_init_out;
}
assert( pTokenizer );
rc = fts3PrefixParameter(zPrefix, &nIndex, &aIndex);
if( rc==SQLITE_ERROR ){
assert( zPrefix );
sqlite3Fts3ErrMsg(pzErr, "error parsing prefix parameter: %s", zPrefix);
}
if( rc!=SQLITE_OK ) goto fts3_init_out;
/* Allocate and populate the Fts3Table structure. */
nByte = sizeof(Fts3Table) + /* Fts3Table */
nCol * sizeof(char *) + /* azColumn */
nIndex * sizeof(struct Fts3Index) + /* aIndex */
nCol * sizeof(u8) + /* abNotindexed */
nName + /* zName */
nDb + /* zDb */
nString; /* Space for azColumn strings */
p = (Fts3Table*)sqlite3_malloc64(nByte);
if( p==0 ){
rc = SQLITE_NOMEM;
goto fts3_init_out;
}
memset(p, 0, nByte);
p->db = db;
p->nColumn = nCol;
p->nPendingData = 0;
p->azColumn = (char **)&p[1];
p->pTokenizer = pTokenizer;
p->nMaxPendingData = FTS3_MAX_PENDING_DATA;
p->bHasDocsize = (isFts4 && bNoDocsize==0);
p->bHasStat = (u8)isFts4;
p->bFts4 = (u8)isFts4;
p->bDescIdx = (u8)bDescIdx;
p->nAutoincrmerge = 0xff; /* 0xff means setting unknown */
p->zContentTbl = zContent;
p->zLanguageid = zLanguageid;
zContent = 0;
zLanguageid = 0;
TESTONLY( p->inTransaction = -1 );
TESTONLY( p->mxSavepoint = -1 );
p->aIndex = (struct Fts3Index *)&p->azColumn[nCol];
memcpy(p->aIndex, aIndex, sizeof(struct Fts3Index) * nIndex);
p->nIndex = nIndex;
for(i=0; i<nIndex; i++){
fts3HashInit(&p->aIndex[i].hPending, FTS3_HASH_STRING, 1);
}
p->abNotindexed = (u8 *)&p->aIndex[nIndex];
/* Fill in the zName and zDb fields of the vtab structure. */
zCsr = (char *)&p->abNotindexed[nCol];
p->zName = zCsr;
memcpy(zCsr, argv[2], nName);
zCsr += nName;
p->zDb = zCsr;
memcpy(zCsr, argv[1], nDb);
zCsr += nDb;
/* Fill in the azColumn array */
for(iCol=0; iCol<nCol; iCol++){
char *z;
int n = 0;
z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);
if( n>0 ){
memcpy(zCsr, z, n);
}
zCsr[n] = '\0';
sqlite3Fts3Dequote(zCsr);
p->azColumn[iCol] = zCsr;
zCsr += n+1;
assert( zCsr <= &((char *)p)[nByte] );
}
/* Fill in the abNotindexed array */
for(iCol=0; iCol<nCol; iCol++){
int n = (int)strlen(p->azColumn[iCol]);
for(i=0; i<nNotindexed; i++){
char *zNot = azNotindexed[i];
if( zNot && n==(int)strlen(zNot)
&& 0==sqlite3_strnicmp(p->azColumn[iCol], zNot, n)
){
p->abNotindexed[iCol] = 1;
sqlite3_free(zNot);
azNotindexed[i] = 0;
}
}
}
for(i=0; i<nNotindexed; i++){
if( azNotindexed[i] ){
sqlite3Fts3ErrMsg(pzErr, "no such column: %s", azNotindexed[i]);
rc = SQLITE_ERROR;
}
}
if( rc==SQLITE_OK && (zCompress==0)!=(zUncompress==0) ){
char const *zMiss = (zCompress==0 ? "compress" : "uncompress");
rc = SQLITE_ERROR;
sqlite3Fts3ErrMsg(pzErr, "missing %s parameter in fts4 constructor", zMiss);
}
p->zReadExprlist = fts3ReadExprList(p, zUncompress, &rc);
p->zWriteExprlist = fts3WriteExprList(p, zCompress, &rc);
if( rc!=SQLITE_OK ) goto fts3_init_out;
/* If this is an xCreate call, create the underlying tables in the
** database. TODO: For xConnect(), it could verify that said tables exist.
*/
if( isCreate ){
rc = fts3CreateTables(p);
}
/* Check to see if a legacy fts3 table has been "upgraded" by the
** addition of a %_stat table so that it can use incremental merge.
*/
if( !isFts4 && !isCreate ){
p->bHasStat = 2;
}
/* Figure out the page-size for the database. This is required in order to
** estimate the cost of loading large doclists from the database. */
fts3DatabasePageSize(&rc, p);
p->nNodeSize = p->nPgsz-35;
#if defined(SQLITE_DEBUG)||defined(SQLITE_TEST)
p->nMergeCount = FTS3_MERGE_COUNT;
#endif
/* Declare the table schema to SQLite. */
fts3DeclareVtab(&rc, p);
fts3_init_out:
sqlite3_free(zPrefix);
sqlite3_free(aIndex);
sqlite3_free(zCompress);
sqlite3_free(zUncompress);
sqlite3_free(zContent);
sqlite3_free(zLanguageid);
for(i=0; i<nNotindexed; i++) sqlite3_free(azNotindexed[i]);
sqlite3_free((void *)aCol);
sqlite3_free((void *)azNotindexed);
if( rc!=SQLITE_OK ){
if( p ){
fts3DisconnectMethod((sqlite3_vtab *)p);
}else if( pTokenizer ){
pTokenizer->pModule->xDestroy(pTokenizer);
}
}else{
assert( p->pSegments==0 );
*ppVTab = &p->base;
}
return rc;
}
| 0
|
362,145
|
Process_Event( grEvent* event )
{
int ret = 0;
if ( event->key >= '1' && event->key < '1' + N_RENDER_MODES )
{
status.render_mode = event->key - '1';
event_render_mode_change( 0 );
return ret;
}
switch ( event->key )
{
case grKeyEsc:
case grKEY( 'q' ):
ret = 1;
break;
case grKeyF1:
case grKEY( '?' ):
event_help();
break;
case grKEY( 'a' ):
handle->antialias = !handle->antialias;
status.header = handle->antialias
? (char *)"anti-aliasing is now on"
: (char *)"anti-aliasing is now off";
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( 'b' ):
handle->use_sbits = !handle->use_sbits;
status.header = handle->use_sbits
? (char *)"now using embedded bitmaps (if available)"
: (char *)"now ignoring embedded bitmaps";
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( 'c' ):
handle->use_sbits_cache = !handle->use_sbits_cache;
status.header = handle->use_sbits_cache
? (char *)"now using sbits cache"
: (char *)"now using normal cache";
break;
case grKEY( 'f' ):
handle->autohint = !handle->autohint;
status.header = handle->autohint
? (char *)"forced auto-hinting is now on"
: (char *)"forced auto-hinting is now off";
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( 'h' ):
handle->hinted = !handle->hinted;
status.header = handle->hinted
? (char *)"glyph hinting is now active"
: (char *)"glyph hinting is now ignored";
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( 'l' ):
handle->low_prec = !handle->low_prec;
status.header = handle->low_prec
? (char *)"rendering precision is now forced to low"
: (char *)"rendering precision is now normal";
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( 'L' ):
handle->lcd_mode = ( handle->lcd_mode + 1 ) % N_LCD_MODES;
switch ( handle->lcd_mode )
{
case LCD_MODE_AA:
status.header = (char *)"use normal anti-aliased rendering";
break;
case LCD_MODE_LIGHT:
status.header = (char *)"use light anti-aliased rendering";
break;
case LCD_MODE_RGB:
status.header = (char *)"use horizontal LCD-optimized rendering (RGB)";
break;
case LCD_MODE_BGR:
status.header = (char *)"use horizontal LCD-optimized rendering (BGR)";
break;
case LCD_MODE_VRGB:
status.header = (char *)"use vertical LCD-optimized rendering (RGB)";
break;
case LCD_MODE_VBGR:
status.header = (char *)"use vertical LCD-optimized rendering (BGR)";
break;
}
FTDemo_Update_Current_Flags( handle );
break;
case grKEY( ' ' ):
event_render_mode_change( 1 );
break;
case grKEY( 'G' ):
event_gamma_grid();
break;
case grKEY( 's' ):
event_slant_change( 0.02 );
break;
case grKEY( 'S' ):
event_slant_change( -0.02 );
break;
case grKEY( 'e' ):
event_bold_change( 0.002 );
break;
case grKEY( 'E' ):
event_bold_change( -0.002 );
break;
case grKEY( 'g' ):
event_gamma_change( 0.1 );
break;
case grKEY( 'v' ):
event_gamma_change( -0.1 );
break;
case grKEY( 'n' ):
event_font_change( 1 );
break;
case grKEY( 'p' ):
event_font_change( -1 );
break;
case grKeyUp: event_size_change( 64 ); break;
case grKeyDown: event_size_change( -64 ); break;
case grKeyPageUp: event_size_change( 640 ); break;
case grKeyPageDown: event_size_change( -640 ); break;
case grKeyLeft: event_index_change( -1 ); break;
case grKeyRight: event_index_change( 1 ); break;
case grKeyF7: event_index_change( -10 ); break;
case grKeyF8: event_index_change( 10 ); break;
case grKeyF9: event_index_change( -100 ); break;
case grKeyF10: event_index_change( 100 ); break;
case grKeyF11: event_index_change( -1000 ); break;
case grKeyF12: event_index_change( 1000 ); break;
case grKEY( 'F' ):
FTC_Manager_RemoveFaceID( handle->cache_manager,
handle->scaler.face_id );
status.use_custom_lcd_filter = !status.use_custom_lcd_filter;
if ( status.use_custom_lcd_filter )
FT_Library_SetLcdFilterWeights( handle->library,
status.filter_weights );
else
FT_Library_SetLcdFilterWeights( handle->library,
(unsigned char*)"\x10\x40\x70\x40\x10" );
status.header = status.use_custom_lcd_filter
? (char *)"using custom LCD filter weights"
: (char *)"using default LCD filter";
break;
case grKEY( '[' ):
if ( !status.use_custom_lcd_filter )
break;
status.fw_index--;
if ( status.fw_index < 0 )
status.fw_index = 4;
break;
case grKEY( ']' ):
if ( !status.use_custom_lcd_filter )
break;
status.fw_index++;
if ( status.fw_index > 4 )
status.fw_index = 0;
break;
case grKEY( '-' ):
if ( !status.use_custom_lcd_filter )
break;
FTC_Manager_RemoveFaceID( handle->cache_manager,
handle->scaler.face_id );
status.filter_weights[status.fw_index]--;
FT_Library_SetLcdFilterWeights( handle->library,
status.filter_weights );
break;
case grKEY( '+' ):
case grKEY( '=' ):
if ( !status.use_custom_lcd_filter )
break;
FTC_Manager_RemoveFaceID( handle->cache_manager,
handle->scaler.face_id );
status.filter_weights[status.fw_index]++;
FT_Library_SetLcdFilterWeights( handle->library,
status.filter_weights );
break;
default:
break;
}
return ret;
}
| 0
|
410,440
|
QUtil::setRandomDataProvider(RandomDataProvider* p)
{
random_data_provider = p;
}
| 0
|
374,270
|
convert_tablespace_priv_string(text *priv_type_text)
{
static const priv_map tablespace_priv_map[] = {
{"CREATE", ACL_CREATE},
{"CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)},
{NULL, 0}
};
return convert_any_priv_string(priv_type_text, tablespace_priv_map);
}
| 0
|
510,806
|
void HttpErrorString(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
uint32_t val = args[0]->Uint32Value(env->context()).ToChecked();
args.GetReturnValue().Set(
String::NewFromOneByte(
env->isolate(),
reinterpret_cast<const uint8_t*>(nghttp2_strerror(val)),
v8::NewStringType::kInternalized).ToLocalChecked());
}
| 0
|
395,805
|
gs_setdefaultgrayicc(const gs_gstate * pgs, gs_param_string * pval)
{
int code;
char *pname;
int namelen = (pval->size)+1;
gs_memory_t *mem = pgs->memory;
bool not_initialized;
/* Detect if this is our first time in here. If so, then we need to
reset up the default gray color spaces that are in the graphic state
to be ICC based. It was not possible to do it until after we get
the profile */
not_initialized = (pgs->icc_manager->default_gray == NULL);
pname = (char *)gs_alloc_bytes(mem, namelen,
"set_default_gray_icc");
if (pname == NULL)
return_error(gs_error_VMerror);
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
code = gsicc_set_profile(pgs->icc_manager,
(const char*) pname, namelen, DEFAULT_GRAY);
gs_free_object(mem, pname,
"set_default_gray_icc");
if (code < 0)
return gs_throw(code, "cannot find default gray icc profile");
/* if this is our first time in here then we need to properly install the
color spaces that were initialized in the graphic state at this time */
if (not_initialized) {
code = gsicc_init_gs_colors((gs_gstate*) pgs);
}
if (code < 0)
return gs_throw(code, "error initializing gstate color spaces to icc");
return code;
}
| 0
|
301,902
|
static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
return(ReadPNGImage(image_info,exception));
}
| 0
|
79,383
|
do_local_notify(xmlNode * notify_src, const char *client_id,
gboolean sync_reply, gboolean from_peer)
{
/* send callback to originating child */
cib_client_t *client_obj = NULL;
int local_rc = pcmk_ok;
if (client_id != NULL) {
client_obj = g_hash_table_lookup(client_list, client_id);
} else {
crm_trace("No client to sent the response to. F_CIB_CLIENTID not set.");
}
if (client_obj == NULL) {
local_rc = -ECONNRESET;
} else {
int rid = 0;
if(sync_reply) {
if (client_obj->ipc) {
CRM_LOG_ASSERT(client_obj->request_id);
rid = client_obj->request_id;
client_obj->request_id = 0;
crm_trace("Sending response %d to %s %s",
rid, client_obj->name, from_peer?"(originator of delegated request)":"");
} else {
crm_trace("Sending response to %s %s",
client_obj->name, from_peer?"(originator of delegated request)":"");
}
} else {
crm_trace("Sending an event to %s %s",
client_obj->name, from_peer?"(originator of delegated request)":"");
}
if (client_obj->ipc && crm_ipcs_send(client_obj->ipc, rid, notify_src, !sync_reply) < 0) {
local_rc = -ENOMSG;
#ifdef HAVE_GNUTLS_GNUTLS_H
} else if (client_obj->session) {
crm_send_remote_msg(client_obj->session, notify_src, client_obj->encrypted);
#endif
} else if(client_obj->ipc == NULL) {
crm_err("Unknown transport for %s", client_obj->name);
}
}
if (local_rc != pcmk_ok && client_obj != NULL) {
crm_warn("%sSync reply to %s failed: %s",
sync_reply ? "" : "A-",
client_obj ? client_obj->name : "<unknown>", pcmk_strerror(local_rc));
}
}
| 0
|
484,701
|
static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl,
struct snd_ctl_elem_info __user *_info)
{
struct snd_ctl_elem_info info;
int result;
if (copy_from_user(&info, _info, sizeof(info)))
return -EFAULT;
result = snd_ctl_elem_info(ctl, &info);
if (result < 0)
return result;
/* drop internal access flags */
info.access &= ~(SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK|
SNDRV_CTL_ELEM_ACCESS_LED_MASK);
if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
return result;
}
| 0
|
388,081
|
gdm_session_handle_client_begin_verification_for_user (GdmDBusUserVerifier *user_verifier_interface,
GDBusMethodInvocation *invocation,
const char *service_name,
const char *username,
GdmSession *self)
{
GdmSessionConversation *conversation;
conversation = begin_verification_conversation (self, invocation, service_name);
if (conversation != NULL) {
conversation->starting_invocation = g_object_ref (invocation);
conversation->starting_username = g_strdup (username);
}
return TRUE;
}
| 0
|
16,913
|
static int check_authenticated_user_and_ip ( int userid , struct query * q ) {
int res = check_user_and_ip ( userid , q ) ;
if ( res ) return res ;
if ( ! users [ userid ] . authenticated ) return 1 ;
return 0 ;
}
| 0
|
48,794
|
Status CalculateOutputIndex(OpKernelContext* context, int dimension,
const vector<INDEX_TYPE>& parent_output_index,
INDEX_TYPE output_index_multiplier,
INDEX_TYPE output_size,
vector<INDEX_TYPE>* result) {
const RowPartitionTensor row_partition_tensor =
GetRowPartitionTensor(context, dimension);
auto partition_type = GetRowPartitionTypeByDimension(dimension);
switch (partition_type) {
case RowPartitionType::VALUE_ROWIDS:
return CalculateOutputIndexValueRowID(
row_partition_tensor, parent_output_index, output_index_multiplier,
output_size, result);
case RowPartitionType::ROW_SPLITS:
if (row_partition_tensor.size() - 1 > parent_output_index.size()) {
return errors::InvalidArgument(
"Row partition size is greater than output size: ",
row_partition_tensor.size() - 1, " > ",
parent_output_index.size());
}
return CalculateOutputIndexRowSplit(
row_partition_tensor, parent_output_index, output_index_multiplier,
output_size, result);
default:
return errors::InvalidArgument(
"Unsupported partition type:",
RowPartitionTypeToString(partition_type));
}
}
| 0
|
432,167
|
char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2,
int size)
{
char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_ATOMIC);
if (!buffer)
return NULL;
buffer[0] = LINE6_SYSEX_BEGIN;
memcpy(buffer + 1, line6_midi_id, sizeof(line6_midi_id));
buffer[sizeof(line6_midi_id) + 1] = code1;
buffer[sizeof(line6_midi_id) + 2] = code2;
buffer[sizeof(line6_midi_id) + 3 + size] = LINE6_SYSEX_END;
return buffer;
}
| 0
|
10,852
|
get_caller_uid (GDBusMethodInvocation *context, gint *uid)
{
PolkitSubject *subject;
PolkitSubject *process;
subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (context));
process = polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, NULL);
if (!process) {
g_object_unref (subject);
return FALSE;
}
*uid = polkit_unix_process_get_uid (POLKIT_UNIX_PROCESS (process));
g_object_unref (subject);
g_object_unref (process);
return TRUE;
}
| 1
|
489,588
|
GF_Err gf_lz_compress_payload(u8 **data, u32 data_len, u32 *max_size)
{
*max_size = 0;
return GF_NOT_SUPPORTED;
}
| 0
|
183,158
|
void CastDetailedView::AppendHeaderEntry() {
CreateSpecialRow(IDS_ASH_STATUS_TRAY_CAST, this);
}
| 0
|
91,238
|
LogL16fromY(double Y, int em) /* get 16-bit LogL from Y */
{
if (Y >= 1.8371976e19)
return (0x7fff);
if (Y <= -1.8371976e19)
return (0xffff);
if (Y > 5.4136769e-20)
return itrunc(256.*(log2(Y) + 64.), em);
if (Y < -5.4136769e-20)
return (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em));
return (0);
}
| 0
|
401,103
|
static void cirrus_get_offsets(VGACommonState *s1,
uint32_t *pline_offset,
uint32_t *pstart_addr,
uint32_t *pline_compare)
{
CirrusVGAState * s = container_of(s1, CirrusVGAState, vga);
uint32_t start_addr, line_offset, line_compare;
line_offset = s->vga.cr[0x13]
| ((s->vga.cr[0x1b] & 0x10) << 4);
line_offset <<= 3;
*pline_offset = line_offset;
start_addr = (s->vga.cr[0x0c] << 8)
| s->vga.cr[0x0d]
| ((s->vga.cr[0x1b] & 0x01) << 16)
| ((s->vga.cr[0x1b] & 0x0c) << 15)
| ((s->vga.cr[0x1d] & 0x80) << 12);
*pstart_addr = start_addr;
line_compare = s->vga.cr[0x18] |
((s->vga.cr[0x07] & 0x10) << 4) |
((s->vga.cr[0x09] & 0x40) << 3);
*pline_compare = line_compare;
}
| 0
|
370,219
|
void sctp_transport_burst_limited(struct sctp_transport *t)
{
struct sctp_association *asoc = t->asoc;
u32 old_cwnd = t->cwnd;
u32 max_burst_bytes;
if (t->burst_limited)
return;
max_burst_bytes = t->flight_size + (asoc->max_burst * asoc->pathmtu);
if (max_burst_bytes < old_cwnd) {
t->cwnd = max_burst_bytes;
t->burst_limited = old_cwnd;
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.