unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
8,052 | 0 | static int vnc_update_stats(VncDisplay *vd, struct timeval * tv)
{
int width = pixman_image_get_width(vd->guest.fb);
int height = pixman_image_get_height(vd->guest.fb);
int x, y;
struct timeval res;
int has_dirty = 0;
for (y = 0; y < height; y += VNC_STAT_RECT) {
for (x = 0; x < width; x += VNC_STAT_RECT) {
VncRectStat *rect = vnc_stat_rect(vd, x, y);
rect->updated = false;
}
}
qemu_timersub(tv, &VNC_REFRESH_STATS, &res);
if (timercmp(&vd->guest.last_freq_check, &res, >)) {
return has_dirty;
}
vd->guest.last_freq_check = *tv;
for (y = 0; y < height; y += VNC_STAT_RECT) {
for (x = 0; x < width; x += VNC_STAT_RECT) {
VncRectStat *rect= vnc_stat_rect(vd, x, y);
int count = ARRAY_SIZE(rect->times);
struct timeval min, max;
if (!timerisset(&rect->times[count - 1])) {
continue ;
}
max = rect->times[(rect->idx + count - 1) % count];
qemu_timersub(tv, &max, &res);
if (timercmp(&res, &VNC_REFRESH_LOSSY, >)) {
rect->freq = 0;
has_dirty += vnc_refresh_lossy_rect(vd, x, y);
memset(rect->times, 0, sizeof (rect->times));
continue ;
}
min = rect->times[rect->idx];
max = rect->times[(rect->idx + count - 1) % count];
qemu_timersub(&max, &min, &res);
rect->freq = res.tv_sec + res.tv_usec / 1000000.;
rect->freq /= count;
rect->freq = 1. / rect->freq;
}
}
return has_dirty;
}
| 100 |
149,182 | 0 | gfx::Size ScaleSizeToFitView(const gfx::Size& size,
const gfx::Size& view_size) {
if ((size.width() > view_size.width() ||
size.height() > view_size.height()) ||
(size.width() < view_size.width() &&
size.height() < view_size.height())) {
const float scale =
std::min(view_size.width() / static_cast<float>(size.width()),
view_size.height() / static_cast<float>(size.height()));
return gfx::ScaleToFlooredSize(size, scale);
}
return size;
}
| 101 |
61,530 | 0 | static size_t WritePSDChannel(const PSDInfo *psd_info,
const ImageInfo *image_info,Image *image,Image *next_image,
const QuantumType quantum_type, unsigned char *compact_pixels,
MagickOffsetType size_offset,const MagickBooleanType separate)
{
int
y;
MagickBooleanType
monochrome;
QuantumInfo
*quantum_info;
register const PixelPacket
*p;
register ssize_t
i;
size_t
count,
length;
unsigned char
*pixels;
#ifdef MAGICKCORE_ZLIB_DELEGATE
#define CHUNK 16384
int
flush,
level;
unsigned char
*compressed_pixels;
z_stream
stream;
compressed_pixels=(unsigned char *) NULL;
flush=Z_NO_FLUSH;
#endif
count=0;
if (separate != MagickFalse)
{
size_offset=TellBlob(image)+2;
count+=WriteCompressionStart(psd_info,image,next_image,1);
}
if (next_image->depth > 8)
next_image->depth=16;
monochrome=IsMonochromeImage(image,&image->exception) && (image->depth == 1)
? MagickTrue : MagickFalse;
quantum_info=AcquireQuantumInfo(image_info,next_image);
if (quantum_info == (QuantumInfo *) NULL)
return(0);
pixels=GetQuantumPixels(quantum_info);
#ifdef MAGICKCORE_ZLIB_DELEGATE
if (next_image->compression == ZipCompression)
{
compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,
sizeof(*compressed_pixels));
if (compressed_pixels == (unsigned char *) NULL)
{
quantum_info=DestroyQuantumInfo(quantum_info);
return(0);
}
ResetMagickMemory(&stream,0,sizeof(stream));
stream.data_type=Z_BINARY;
level=Z_DEFAULT_COMPRESSION;
if ((image_info->quality > 0 && image_info->quality < 10))
level=(int) image_info->quality;
if (deflateInit(&stream,level) != Z_OK)
{
quantum_info=DestroyQuantumInfo(quantum_info);
return(0);
}
}
#endif
for (y=0; y < (ssize_t) next_image->rows; y++)
{
p=GetVirtualPixels(next_image,0,y,next_image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,&image->exception);
if (monochrome != MagickFalse)
for (i=0; i < (ssize_t) length; i++)
pixels[i]=(~pixels[i]);
if (next_image->compression == RLECompression)
{
length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels);
count+=WriteBlob(image,length,compact_pixels);
size_offset+=WritePSDOffset(psd_info,image,length,size_offset);
}
#ifdef MAGICKCORE_ZLIB_DELEGATE
else if (next_image->compression == ZipCompression)
{
stream.avail_in=(uInt) length;
stream.next_in=(Bytef *) pixels;
if (y == (ssize_t) next_image->rows-1)
flush=Z_FINISH;
do {
stream.avail_out=(uInt) CHUNK;
stream.next_out=(Bytef *) compressed_pixels;
if (deflate(&stream,flush) == Z_STREAM_ERROR)
break;
length=(size_t) CHUNK-stream.avail_out;
if (length > 0)
count+=WriteBlob(image,length,compressed_pixels);
} while (stream.avail_out == 0);
}
#endif
else
count+=WriteBlob(image,length,pixels);
}
#ifdef MAGICKCORE_ZLIB_DELEGATE
if (next_image->compression == ZipCompression)
{
(void) deflateEnd(&stream);
compressed_pixels=(unsigned char *) RelinquishMagickMemory(
compressed_pixels);
}
#endif
quantum_info=DestroyQuantumInfo(quantum_info);
return(count);
}
| 102 |
179,598 | 1 | PHP_FUNCTION(imageconvolution)
{
zval *SIM, *hash_matrix;
zval **var = NULL, **var2 = NULL;
gdImagePtr im_src = NULL;
double div, offset;
int nelem, i, j, res;
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "radd", &SIM, &hash_matrix, &div, &offset) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
if (nelem != 3) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have 3x3 array");
RETURN_FALSE;
}
for (i=0; i<3; i++) {
if (zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i), (void **) &var) == SUCCESS && Z_TYPE_PP(var) == IS_ARRAY) {
if (Z_TYPE_PP(var) != IS_ARRAY || zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have 3x3 array");
RETURN_FALSE;
}
for (j=0; j<3; j++) {
if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) &var2) == SUCCESS) {
SEPARATE_ZVAL(var2);
convert_to_double(*var2);
matrix[i][j] = (float)Z_DVAL_PP(var2);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have a 3x3 matrix");
RETURN_FALSE;
}
}
}
}
res = gdImageConvolution(im_src, matrix, (float)div, (float)offset);
if (res) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
| 103 |
98,708 | 0 | NPError WebPluginDelegatePepper::DeviceAudioInitializeContext(
const NPDeviceContextAudioConfig* config,
NPDeviceContextAudio* context) {
if (!render_view_) {
return NPERR_GENERIC_ERROR;
}
scoped_ptr<AudioDeviceContext> audio(new AudioDeviceContext());
NPError status = audio->Initialize(render_view_->audio_message_filter(),
config, context);
if (NPERR_NO_ERROR == status) {
context->reserved =
reinterpret_cast<void *>(audio_contexts_.Add(audio.release()));
}
return status;
}
| 104 |
145,106 | 0 | int frameCount() { return m_frameCount; }
| 105 |
19,217 | 0 | static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
!test_bit(0, &nlk->state)) {
skb_set_owner_r(skb, sk);
__netlink_sendskb(sk, skb);
return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1);
}
return -1;
}
| 106 |
131,840 | 0 | static void unsignedShortAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
v8SetReturnValueUnsigned(info, imp->unsignedShortAttribute());
}
| 107 |
183,848 | 1 | void ExtensionTtsController::Stop() {
if (current_utterance_ && !current_utterance_->extension_id().empty()) {
current_utterance_->profile()->GetExtensionEventRouter()->
DispatchEventToExtension(
current_utterance_->extension_id(),
events::kOnStop,
"[]",
current_utterance_->profile(),
GURL());
} else {
GetPlatformImpl()->clear_error();
GetPlatformImpl()->StopSpeaking();
}
if (current_utterance_)
current_utterance_->set_error(kSpeechInterruptedError);
FinishCurrentUtterance();
ClearUtteranceQueue();
}
| 108 |
95,501 | 0 | void Field_CompletePlayerName( const char **names, int nameCount )
{
qboolean whitespace;
matchCount = 0;
shortestMatch[ 0 ] = 0;
if( nameCount <= 0 )
return;
Name_PlayerNameCompletion( names, nameCount, FindMatches );
if( completionString[0] == '\0' )
{
Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ 0 ] );
}
if( completionString[0] != '\0'
&& Q_stricmp( shortestMatch, completionString ) == 0
&& nameCount > 1 )
{
int i;
for( i = 0; i < nameCount; i++ ) {
if( Q_stricmp( names[ i ], completionString ) == 0 )
{
i++;
if( i >= nameCount )
{
i = 0;
}
Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ i ] );
break;
}
}
}
if( matchCount > 1 )
{
Com_Printf( "]%s\n", completionField->buffer );
Name_PlayerNameCompletion( names, nameCount, PrintMatches );
}
whitespace = nameCount == 1? qtrue: qfalse;
if( !Field_CompletePlayerNameFinal( whitespace ) )
{
}
}
| 109 |
55,021 | 0 | static void mark_tree_contents_uninteresting(struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
struct object *obj = &tree->object;
if (!has_object_file(&obj->oid))
return;
if (parse_tree(tree) < 0)
die("bad tree %s", oid_to_hex(&obj->oid));
init_tree_desc(&desc, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
switch (object_type(entry.mode)) {
case OBJ_TREE:
mark_tree_uninteresting(lookup_tree(entry.sha1));
break;
case OBJ_BLOB:
mark_blob_uninteresting(lookup_blob(entry.sha1));
break;
default:
/* Subproject commit - not in this repository */
break;
}
}
/*
* We don't care about the tree any more
* after it has been marked uninteresting.
*/
free_tree_buffer(tree);
}
| 110 |
90,832 | 0 | u32 gf_rand()
{
return rand();
}
| 111 |
17,978 | 0 | ssh_packet_connection_is_on_socket(struct ssh *ssh)
{
struct session_state *state = ssh->state;
struct sockaddr_storage from, to;
socklen_t fromlen, tolen;
if (state->connection_in == -1 || state->connection_out == -1)
return 0;
/* filedescriptors in and out are the same, so it's a socket */
if (state->connection_in == state->connection_out)
return 1;
fromlen = sizeof(from);
memset(&from, 0, sizeof(from));
if (getpeername(state->connection_in, (struct sockaddr *)&from,
&fromlen) < 0)
return 0;
tolen = sizeof(to);
memset(&to, 0, sizeof(to));
if (getpeername(state->connection_out, (struct sockaddr *)&to,
&tolen) < 0)
return 0;
if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0)
return 0;
if (from.ss_family != AF_INET && from.ss_family != AF_INET6)
return 0;
return 1;
}
| 112 |
175,094 | 0 | void SoundPool::setVolume(int channelID, float leftVolume, float rightVolume)
{
Mutex::Autolock lock(&mLock);
SoundChannel* channel = findChannel(channelID);
if (channel) {
channel->setVolume(leftVolume, rightVolume);
}
}
| 113 |
11,427 | 0 | fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed)
{
CARD32 pixel = READ((CARD16 *) bits + offset);
CARD32 r,g,b;
b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
return (0xff000000 | r | g | b);
}
| 114 |
65,295 | 0 | nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_attrstat *resp)
{
p = encode_wcc_data(rqstp, p, &resp->fh);
return xdr_ressize_check(rqstp, p);
}
| 115 |
139,445 | 0 | static bool ExecuteMakeTextWritingDirectionLeftToRight(LocalFrame& frame,
Event*,
EditorCommandSource,
const String&) {
MutableStylePropertySet* style =
MutableStylePropertySet::Create(kHTMLQuirksMode);
style->SetProperty(CSSPropertyUnicodeBidi, CSSValueIsolate);
style->SetProperty(CSSPropertyDirection, CSSValueLtr);
frame.GetEditor().ApplyStyle(
style, InputEvent::InputType::kFormatSetBlockTextDirection);
return true;
}
| 116 |
27,479 | 0 | static int ipgre_close(struct net_device *dev)
{
struct ip_tunnel *t = netdev_priv(dev);
if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) {
struct in_device *in_dev;
in_dev = inetdev_by_index(dev_net(dev), t->mlink);
if (in_dev) {
ip_mc_dec_group(in_dev, t->parms.iph.daddr);
in_dev_put(in_dev);
}
}
return 0;
}
| 117 |
117,440 | 0 | void WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged(
const GpuMemoryAllocation& allocation) {
if (memory_allocation_changed_callback_)
memory_allocation_changed_callback_->onMemoryAllocationChanged(
allocation.gpu_resource_size_in_bytes);
}
| 118 |
161,491 | 0 | TargetHandler::Throttle::WillProcessResponse() {
if (!target_handler_)
return PROCEED;
agent_host_ =
target_handler_->auto_attacher_.AutoAttachToFrame(navigation_handle());
if (!agent_host_.get())
return PROCEED;
target_handler_->auto_attached_sessions_[agent_host_.get()]->SetThrottle(
this);
return DEFER;
}
| 119 |
180,915 | 1 | SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
infop, int, options, struct rusage __user *, ru)
{
struct rusage r;
struct waitid_info info = {.status = 0};
long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
int signo = 0;
if (err > 0) {
signo = SIGCHLD;
err = 0;
}
if (!err) {
if (ru && copy_to_user(ru, &r, sizeof(struct rusage)))
return -EFAULT;
}
if (!infop)
return err;
user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault);
unsafe_put_user(0, &infop->si_errno, Efault);
unsafe_put_user(info.cause, &infop->si_code, Efault);
unsafe_put_user(info.pid, &infop->si_pid, Efault);
unsafe_put_user(info.uid, &infop->si_uid, Efault);
unsafe_put_user(info.status, &infop->si_status, Efault);
user_access_end();
return err;
Efault:
user_access_end();
return -EFAULT;
}
| 120 |
120,384 | 0 | bool swipe_down() const { return swipe_down_; }
| 121 |
168,086 | 0 | void SelectRightNameType(const ServerFieldTypeSet& old_types,
ServerFieldTypeSet* new_types,
bool is_credit_card) {
ServerFieldTypeSet upload_types;
if (old_types.count(NAME_FIRST) && old_types.count(CREDIT_CARD_NAME_FIRST)) {
if (is_credit_card) {
new_types->insert(CREDIT_CARD_NAME_FIRST);
} else {
new_types->insert(NAME_FIRST);
}
} else if (old_types.count(NAME_LAST) &&
old_types.count(CREDIT_CARD_NAME_LAST)) {
if (is_credit_card) {
new_types->insert(CREDIT_CARD_NAME_LAST);
} else {
new_types->insert(NAME_LAST);
}
} else if (old_types.count(NAME_FULL) &&
old_types.count(CREDIT_CARD_NAME_FULL)) {
if (is_credit_card) {
new_types->insert(CREDIT_CARD_NAME_FULL);
} else {
new_types->insert(NAME_FULL);
}
} else {
*new_types = old_types;
}
}
| 122 |
152,976 | 0 | void PDFiumEngine::Form_DisplayCaret(FPDF_FORMFILLINFO* param,
FPDF_PAGE page,
FPDF_BOOL visible,
double left,
double top,
double right,
double bottom) {
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
engine->client_->UpdateCursor(PP_CURSORTYPE_IBEAM);
std::vector<pp::Rect> tickmarks;
pp::Rect rect(left, top, right, bottom);
tickmarks.push_back(rect);
engine->client_->UpdateTickMarks(tickmarks);
}
| 123 |
40,966 | 0 | struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k)
{
unsigned long h = t->hash_fn(k);
unsigned long n = h % t->size;
int count = 0;
t->lookups++;
while( count < t->size ) {
if(t->table[n].k == LH_EMPTY) return NULL;
if(t->table[n].k != LH_FREED &&
t->equal_fn(t->table[n].k, k)) return &t->table[n];
if ((int)++n == t->size) n = 0;
count++;
}
return NULL;
}
| 124 |
7,613 | 0 | static void cirrus_write_bitblt(CirrusVGAState * s, unsigned reg_value)
{
unsigned old_value;
old_value = s->vga.gr[0x31];
s->vga.gr[0x31] = reg_value;
if (((old_value & CIRRUS_BLT_RESET) != 0) &&
((reg_value & CIRRUS_BLT_RESET) == 0)) {
cirrus_bitblt_reset(s);
} else if (((old_value & CIRRUS_BLT_START) == 0) &&
((reg_value & CIRRUS_BLT_START) != 0)) {
cirrus_bitblt_start(s);
}
}
| 125 |
169,485 | 0 | void NetworkThrottleManagerImpl::RecomputeOutstanding() {
base::TimeTicks now(tick_clock_->NowTicks());
base::TimeDelta age_horizon(base::TimeDelta::FromMilliseconds((
kMedianLifetimeMultiple * lifetime_median_estimate_.current_estimate())));
while (!outstanding_throttles_.empty()) {
ThrottleImpl* throttle = *outstanding_throttles_.begin();
if (throttle->start_time() + age_horizon >= now)
break;
outstanding_throttles_.erase(outstanding_throttles_.begin());
throttle->SetAged();
throttle->set_queue_pointer(outstanding_throttles_.end());
}
if (outstanding_throttles_.empty())
return;
if (outstanding_recomputation_timer_->IsRunning())
return;
ThrottleImpl* first_throttle(*outstanding_throttles_.begin());
DCHECK_GE(first_throttle->start_time() + age_horizon, now);
outstanding_recomputation_timer_->Start(
FROM_HERE,
((first_throttle->start_time() + age_horizon) - now +
base::TimeDelta::FromMilliseconds(kTimerFudgeInMs)),
base::Bind(&NetworkThrottleManagerImpl::MaybeUnblockThrottles,
base::Unretained(this)));
}
| 126 |
109,569 | 0 | bool Document::allowExecutingScripts(Node* node)
{
if (!frame() && !import())
return false;
if (!node->document().frame() && !node->document().import())
return false;
if (!contextDocument().get()->frame()->script()->canExecuteScripts(AboutToExecuteScript))
return false;
return true;
}
| 127 |
20,660 | 0 | static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
{
return (!irqchip_in_kernel(vcpu->kvm) && !kvm_cpu_has_interrupt(vcpu) &&
vcpu->run->request_interrupt_window &&
kvm_arch_interrupt_allowed(vcpu));
}
| 128 |
180,750 | 1 | void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
gfp_t gfp, struct dma_attrs *attrs)
{
pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel);
void *memory;
if (dma_alloc_from_coherent(dev, size, handle, &memory))
return memory;
return __dma_alloc(dev, size, handle, gfp, prot, false,
__builtin_return_address(0));
}
| 129 |
178,176 | 1 | gray_render_span( int y,
int count,
const FT_Span* spans,
PWorker worker )
{
unsigned char* p;
FT_Bitmap* map = &worker->target;
/* first of all, compute the scanline offset */
p = (unsigned char*)map->buffer - y * map->pitch;
if ( map->pitch >= 0 )
p += ( map->rows - 1 ) * map->pitch;
for ( ; count > 0; count--, spans++ )
{
unsigned char coverage = spans->coverage;
if ( coverage )
{
/* For small-spans it is faster to do it by ourselves than
* calling `memset'. This is mainly due to the cost of the
* function call.
*/
if ( spans->len >= 8 )
FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len );
else
{
unsigned char* q = p + spans->x;
switch ( spans->len )
{
case 7: *q++ = (unsigned char)coverage;
case 6: *q++ = (unsigned char)coverage;
case 5: *q++ = (unsigned char)coverage;
case 4: *q++ = (unsigned char)coverage;
case 3: *q++ = (unsigned char)coverage;
case 2: *q++ = (unsigned char)coverage;
case 1: *q = (unsigned char)coverage;
default:
;
}
}
}
}
}
| 130 |
64,602 | 0 | yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
| 131 |
139,028 | 0 | LayoutImageResource* ImageLoader::layoutImageResource() {
LayoutObject* layoutObject = m_element->layoutObject();
if (!layoutObject)
return 0;
if (layoutObject->isImage() &&
!static_cast<LayoutImage*>(layoutObject)->isGeneratedContent())
return toLayoutImage(layoutObject)->imageResource();
if (layoutObject->isSVGImage())
return toLayoutSVGImage(layoutObject)->imageResource();
if (layoutObject->isVideo())
return toLayoutVideo(layoutObject)->imageResource();
return 0;
}
| 132 |
113,319 | 0 | ACTION(DeleteDataBuffer) {
delete[] arg0->memory_pointer;
}
| 133 |
112,086 | 0 | SyncManager::SyncInternal::HandleTransactionEndingChangeEvent(
const ImmutableWriteTransactionInfo& write_transaction_info,
syncable::BaseTransaction* trans) {
if (!change_delegate_ || ChangeBuffersAreEmpty())
return ModelTypeSet();
ReadTransaction read_trans(GetUserShare(), trans);
ModelTypeSet models_with_changes;
for (int i = syncable::FIRST_REAL_MODEL_TYPE;
i < syncable::MODEL_TYPE_COUNT; ++i) {
const syncable::ModelType type = syncable::ModelTypeFromInt(i);
if (change_buffers_[type].IsEmpty())
continue;
ImmutableChangeRecordList ordered_changes;
CHECK(change_buffers_[type].GetAllChangesInTreeOrder(&read_trans,
&ordered_changes));
if (!ordered_changes.Get().empty()) {
change_delegate_->
OnChangesApplied(type, &read_trans, ordered_changes);
change_observer_.Call(FROM_HERE,
&SyncManager::ChangeObserver::OnChangesApplied,
type, write_transaction_info.Get().id, ordered_changes);
models_with_changes.Put(type);
}
change_buffers_[i].Clear();
}
return models_with_changes;
}
| 134 |
73,383 | 0 | MagickExport MagickBooleanType IsGrayImage(const Image *image,
ExceptionInfo *exception)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if ((image->type == BilevelType) || (image->type == GrayscaleType) ||
(image->type == GrayscaleMatteType))
return(MagickTrue);
return(MagickFalse);
}
| 135 |
2,202 | 0 | void FoFiType1C::buildEncoding() {
char buf[256];
int nCodes, nRanges, encFormat;
int pos, c, sid, nLeft, nSups, i, j;
if (topDict.encodingOffset == 0) {
encoding = (char **)fofiType1StandardEncoding;
} else if (topDict.encodingOffset == 1) {
encoding = (char **)fofiType1ExpertEncoding;
} else {
encoding = (char **)gmallocn(256, sizeof(char *));
for (i = 0; i < 256; ++i) {
encoding[i] = NULL;
}
pos = topDict.encodingOffset;
encFormat = getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
if ((encFormat & 0x7f) == 0) {
nCodes = 1 + getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
if (nCodes > nGlyphs) {
nCodes = nGlyphs;
}
for (i = 1; i < nCodes && i < charsetLength; ++i) {
c = getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
if (encoding[c]) {
gfree(encoding[c]);
}
encoding[c] = copyString(getString(charset[i], buf, &parsedOk));
}
} else if ((encFormat & 0x7f) == 1) {
nRanges = getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
nCodes = 1;
for (i = 0; i < nRanges; ++i) {
c = getU8(pos++, &parsedOk);
nLeft = getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
for (j = 0; j <= nLeft && nCodes < nGlyphs && nCodes < charsetLength; ++j) {
if (c < 256) {
if (encoding[c]) {
gfree(encoding[c]);
}
encoding[c] = copyString(getString(charset[nCodes], buf,
&parsedOk));
}
++nCodes;
++c;
}
}
}
if (encFormat & 0x80) {
nSups = getU8(pos++, &parsedOk);
if (!parsedOk) {
return;
}
for (i = 0; i < nSups; ++i) {
c = getU8(pos++, &parsedOk);;
if (!parsedOk) {
return;;
}
sid = getU16BE(pos, &parsedOk);
pos += 2;
if (!parsedOk) {
return;
}
if (encoding[c]) {
gfree(encoding[c]);
}
encoding[c] = copyString(getString(sid, buf, &parsedOk));
}
}
}
}
| 136 |
14,533 | 0 | static inline void pcnet_tmd_load(PCNetState *s, struct pcnet_TMD *tmd,
hwaddr addr)
{
if (!BCR_SSIZE32(s)) {
struct {
uint32_t tbadr;
int16_t length;
int16_t status;
} xda;
s->phys_mem_read(s->dma_opaque, addr, (void *)&xda, sizeof(xda), 0);
tmd->tbadr = le32_to_cpu(xda.tbadr) & 0xffffff;
tmd->length = le16_to_cpu(xda.length);
tmd->status = (le32_to_cpu(xda.tbadr) >> 16) & 0xff00;
tmd->misc = le16_to_cpu(xda.status) << 16;
tmd->res = 0;
} else {
s->phys_mem_read(s->dma_opaque, addr, (void *)tmd, sizeof(*tmd), 0);
le32_to_cpus(&tmd->tbadr);
le16_to_cpus((uint16_t *)&tmd->length);
le16_to_cpus((uint16_t *)&tmd->status);
le32_to_cpus(&tmd->misc);
le32_to_cpus(&tmd->res);
if (BCR_SWSTYLE(s) == 3) {
uint32_t tmp = tmd->tbadr;
tmd->tbadr = tmd->misc;
tmd->misc = tmp;
}
}
}
| 137 |
45,276 | 0 | static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *buf,
struct extent_buffer *parent, int parent_slot,
struct extent_buffer **cow_ret,
u64 search_start, u64 empty_size)
{
struct btrfs_disk_key disk_key;
struct extent_buffer *cow;
int level, ret;
int last_ref = 0;
int unlock_orig = 0;
u64 parent_start;
if (*cow_ret == buf)
unlock_orig = 1;
btrfs_assert_tree_locked(buf);
WARN_ON(test_bit(BTRFS_ROOT_REF_COWS, &root->state) &&
trans->transid != root->fs_info->running_transaction->transid);
WARN_ON(test_bit(BTRFS_ROOT_REF_COWS, &root->state) &&
trans->transid != root->last_trans);
level = btrfs_header_level(buf);
if (level == 0)
btrfs_item_key(buf, &disk_key, 0);
else
btrfs_node_key(buf, &disk_key, 0);
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) {
if (parent)
parent_start = parent->start;
else
parent_start = 0;
} else
parent_start = 0;
cow = btrfs_alloc_tree_block(trans, root, parent_start,
root->root_key.objectid, &disk_key, level,
search_start, empty_size);
if (IS_ERR(cow))
return PTR_ERR(cow);
/* cow is set to blocking by btrfs_init_new_buffer */
copy_extent_buffer(cow, buf, 0, 0, cow->len);
btrfs_set_header_bytenr(cow, cow->start);
btrfs_set_header_generation(cow, trans->transid);
btrfs_set_header_backref_rev(cow, BTRFS_MIXED_BACKREF_REV);
btrfs_clear_header_flag(cow, BTRFS_HEADER_FLAG_WRITTEN |
BTRFS_HEADER_FLAG_RELOC);
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)
btrfs_set_header_flag(cow, BTRFS_HEADER_FLAG_RELOC);
else
btrfs_set_header_owner(cow, root->root_key.objectid);
write_extent_buffer(cow, root->fs_info->fsid, btrfs_header_fsid(),
BTRFS_FSID_SIZE);
ret = update_ref_for_cow(trans, root, buf, cow, &last_ref);
if (ret) {
btrfs_abort_transaction(trans, root, ret);
return ret;
}
if (test_bit(BTRFS_ROOT_REF_COWS, &root->state)) {
ret = btrfs_reloc_cow_block(trans, root, buf, cow);
if (ret)
return ret;
}
if (buf == root->node) {
WARN_ON(parent && parent != buf);
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID ||
btrfs_header_backref_rev(buf) < BTRFS_MIXED_BACKREF_REV)
parent_start = buf->start;
else
parent_start = 0;
extent_buffer_get(cow);
tree_mod_log_set_root_pointer(root, cow, 1);
rcu_assign_pointer(root->node, cow);
btrfs_free_tree_block(trans, root, buf, parent_start,
last_ref);
free_extent_buffer(buf);
add_root_to_dirty_list(root);
} else {
if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)
parent_start = parent->start;
else
parent_start = 0;
WARN_ON(trans->transid != btrfs_header_generation(parent));
tree_mod_log_insert_key(root->fs_info, parent, parent_slot,
MOD_LOG_KEY_REPLACE, GFP_NOFS);
btrfs_set_node_blockptr(parent, parent_slot,
cow->start);
btrfs_set_node_ptr_generation(parent, parent_slot,
trans->transid);
btrfs_mark_buffer_dirty(parent);
if (last_ref) {
ret = tree_mod_log_free_eb(root->fs_info, buf);
if (ret) {
btrfs_abort_transaction(trans, root, ret);
return ret;
}
}
btrfs_free_tree_block(trans, root, buf, parent_start,
last_ref);
}
if (unlock_orig)
btrfs_tree_unlock(buf);
free_extent_buffer_stale(buf);
btrfs_mark_buffer_dirty(cow);
*cow_ret = cow;
return 0;
}
| 138 |
37,947 | 0 | int kvm_iommu_map_guest(struct kvm *kvm)
{
int r;
if (!iommu_present(&pci_bus_type)) {
printk(KERN_ERR "%s: iommu not found\n", __func__);
return -ENODEV;
}
mutex_lock(&kvm->slots_lock);
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
if (!kvm->arch.iommu_domain) {
r = -ENOMEM;
goto out_unlock;
}
if (!allow_unsafe_assigned_interrupts &&
!iommu_domain_has_cap(kvm->arch.iommu_domain,
IOMMU_CAP_INTR_REMAP)) {
printk(KERN_WARNING "%s: No interrupt remapping support,"
" disallowing device assignment."
" Re-enble with \"allow_unsafe_assigned_interrupts=1\""
" module option.\n", __func__);
iommu_domain_free(kvm->arch.iommu_domain);
kvm->arch.iommu_domain = NULL;
r = -EPERM;
goto out_unlock;
}
r = kvm_iommu_map_memslots(kvm);
if (r)
kvm_iommu_unmap_memslots(kvm);
out_unlock:
mutex_unlock(&kvm->slots_lock);
return r;
}
| 139 |
53,653 | 0 | static inline __u64 dccp_v6_init_sequence(struct sk_buff *skb)
{
return secure_dccpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
ipv6_hdr(skb)->saddr.s6_addr32,
dccp_hdr(skb)->dccph_dport,
dccp_hdr(skb)->dccph_sport );
}
| 140 |
55,846 | 0 | void __do_SAK(struct tty_struct *tty)
{
#ifdef TTY_SOFT_SAK
tty_hangup(tty);
#else
struct task_struct *g, *p;
struct pid *session;
int i;
if (!tty)
return;
session = tty->session;
tty_ldisc_flush(tty);
tty_driver_flush_buffer(tty);
read_lock(&tasklist_lock);
/* Kill the entire session */
do_each_pid_task(session, PIDTYPE_SID, p) {
tty_notice(tty, "SAK: killed process %d (%s): by session\n",
task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1);
} while_each_pid_task(session, PIDTYPE_SID, p);
/* Now kill any processes that happen to have the tty open */
do_each_thread(g, p) {
if (p->signal->tty == tty) {
tty_notice(tty, "SAK: killed process %d (%s): by controlling tty\n",
task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1);
continue;
}
task_lock(p);
i = iterate_fd(p->files, 0, this_tty, tty);
if (i != 0) {
tty_notice(tty, "SAK: killed process %d (%s): by fd#%d\n",
task_pid_nr(p), p->comm, i - 1);
force_sig(SIGKILL, p);
}
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
#endif
}
| 141 |
182,834 | 1 | static void parse_cfg(int flags, int argc, const char **argv, cfg_t *cfg) {
int i;
memset(cfg, 0, sizeof(cfg_t));
cfg->debug_file = stderr;
for (i = 0; i < argc; i++) {
if (strncmp(argv[i], "max_devices=", 12) == 0)
sscanf(argv[i], "max_devices=%u", &cfg->max_devs);
if (strcmp(argv[i], "manual") == 0)
cfg->manual = 1;
if (strcmp(argv[i], "debug") == 0)
cfg->debug = 1;
if (strcmp(argv[i], "nouserok") == 0)
cfg->nouserok = 1;
if (strcmp(argv[i], "openasuser") == 0)
cfg->openasuser = 1;
if (strcmp(argv[i], "alwaysok") == 0)
cfg->alwaysok = 1;
if (strcmp(argv[i], "interactive") == 0)
cfg->interactive = 1;
if (strcmp(argv[i], "cue") == 0)
cfg->cue = 1;
if (strcmp(argv[i], "nodetect") == 0)
cfg->nodetect = 1;
if (strncmp(argv[i], "authfile=", 9) == 0)
cfg->auth_file = argv[i] + 9;
if (strncmp(argv[i], "authpending_file=", 17) == 0)
cfg->authpending_file = argv[i] + 17;
if (strncmp(argv[i], "origin=", 7) == 0)
cfg->origin = argv[i] + 7;
if (strncmp(argv[i], "appid=", 6) == 0)
cfg->appid = argv[i] + 6;
if (strncmp(argv[i], "prompt=", 7) == 0)
cfg->prompt = argv[i] + 7;
if (strncmp (argv[i], "debug_file=", 11) == 0) {
const char *filename = argv[i] + 11;
if(strncmp (filename, "stdout", 6) == 0) {
cfg->debug_file = stdout;
}
else if(strncmp (filename, "stderr", 6) == 0) {
cfg->debug_file = stderr;
}
else if( strncmp (filename, "syslog", 6) == 0) {
cfg->debug_file = (FILE *)-1;
}
else {
struct stat st;
FILE *file;
if(lstat(filename, &st) == 0) {
if(S_ISREG(st.st_mode)) {
file = fopen(filename, "a");
if(file != NULL) {
cfg->debug_file = file;
}
}
}
}
}
}
if (cfg->debug) {
D(cfg->debug_file, "called.");
D(cfg->debug_file, "flags %d argc %d", flags, argc);
for (i = 0; i < argc; i++) {
D(cfg->debug_file, "argv[%d]=%s", i, argv[i]);
}
D(cfg->debug_file, "max_devices=%d", cfg->max_devs);
D(cfg->debug_file, "debug=%d", cfg->debug);
D(cfg->debug_file, "interactive=%d", cfg->interactive);
D(cfg->debug_file, "cue=%d", cfg->cue);
D(cfg->debug_file, "nodetect=%d", cfg->nodetect);
D(cfg->debug_file, "manual=%d", cfg->manual);
D(cfg->debug_file, "nouserok=%d", cfg->nouserok);
D(cfg->debug_file, "openasuser=%d", cfg->openasuser);
D(cfg->debug_file, "alwaysok=%d", cfg->alwaysok);
D(cfg->debug_file, "authfile=%s", cfg->auth_file ? cfg->auth_file : "(null)");
D(cfg->debug_file, "authpending_file=%s", cfg->authpending_file ? cfg->authpending_file : "(null)");
D(cfg->debug_file, "origin=%s", cfg->origin ? cfg->origin : "(null)");
D(cfg->debug_file, "appid=%s", cfg->appid ? cfg->appid : "(null)");
D(cfg->debug_file, "prompt=%s", cfg->prompt ? cfg->prompt : "(null)");
}
}
| 142 |
111,307 | 0 | void WebPagePrivate::resetScales()
{
TransformationMatrix identity;
*m_transformationMatrix = identity;
m_initialScale = m_webSettings->initialScale() > 0 ? m_webSettings->initialScale() : -1.0;
m_minimumScale = -1.0;
m_maximumScale = -1.0;
updateViewportSize();
}
| 143 |
106,665 | 0 | void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
{
RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
if (!callback) {
return;
}
callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
}
| 144 |
104,242 | 0 | void RTCPeerConnection::didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor> iceCandidateDescriptor)
{
ASSERT(scriptExecutionContext()->isContextThread());
if (!iceCandidateDescriptor)
dispatchEvent(RTCIceCandidateEvent::create(false, false, 0));
else {
RefPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(iceCandidateDescriptor);
dispatchEvent(RTCIceCandidateEvent::create(false, false, iceCandidate.release()));
}
}
| 145 |
60,145 | 0 | R_API void *r_bin_free(RBin *bin) {
if (!bin) {
return NULL;
}
if (bin->io_owned) {
r_io_free (bin->iob.io);
}
bin->file = NULL;
free (bin->force);
free (bin->srcdir);
r_list_free (bin->binfiles);
r_list_free (bin->binxtrs);
r_list_free (bin->plugins);
sdb_free (bin->sdb);
r_id_pool_free (bin->file_ids);
memset (bin, 0, sizeof (RBin));
free (bin);
return NULL;
}
| 146 |
160,408 | 0 | void NormalPageArena::updateRemainingAllocationSize() {
if (m_lastRemainingAllocationSize > remainingAllocationSize()) {
getThreadState()->increaseAllocatedObjectSize(
m_lastRemainingAllocationSize - remainingAllocationSize());
m_lastRemainingAllocationSize = remainingAllocationSize();
}
ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize());
}
| 147 |
88,590 | 0 | static void load_creator(FILE *fp, pdf_t *pdf)
{
int i, buf_idx;
char c, *buf, obj_id_buf[32] = {0};
long start;
size_t sz;
start = ftell(fp);
/* For each PDF version */
for (i=0; i<pdf->n_xrefs; ++i)
{
if (!pdf->xrefs[i].version)
continue;
/* Find trailer */
fseek(fp, pdf->xrefs[i].start, SEEK_SET);
while (SAFE_F(fp, (fgetc(fp) != 't')))
; /* Iterate to "trailer" */
/* Look for "<< ....... /Info ......" */
c = '\0';
while (SAFE_F(fp, ((c = fgetc(fp)) != '>')))
if (SAFE_F(fp, ((c == '/') &&
(fgetc(fp) == 'I') && ((fgetc(fp) == 'n')))))
break;
/* Could not find /Info in trailer */
END_OF_TRAILER(c, start, fp);
while (SAFE_F(fp, (!isspace(c = fgetc(fp)) && (c != '>'))))
; /* Iterate to first white space /Info<space><data> */
/* No space between /Info and it's data */
END_OF_TRAILER(c, start, fp);
while (SAFE_F(fp, (isspace(c = fgetc(fp)) && (c != '>'))))
; /* Iterate right on top of first non-whitespace /Info data */
/* No data for /Info */
END_OF_TRAILER(c, start, fp);
/* Get obj id as number */
buf_idx = 0;
obj_id_buf[buf_idx++] = c;
while ((buf_idx < (sizeof(obj_id_buf) - 1)) &&
SAFE_F(fp, (!isspace(c = fgetc(fp)) && (c != '>'))))
obj_id_buf[buf_idx++] = c;
END_OF_TRAILER(c, start, fp);
/* Get the object for the creator data. If linear, try both xrefs */
buf = get_object(fp, atoll(obj_id_buf), &pdf->xrefs[i], &sz, NULL);
if (!buf && pdf->xrefs[i].is_linear && (i+1 < pdf->n_xrefs))
buf = get_object(fp, atoll(obj_id_buf), &pdf->xrefs[i+1], &sz, NULL);
load_creator_from_buf(fp, &pdf->xrefs[i], buf);
free(buf);
}
fseek(fp, start, SEEK_SET);
}
| 148 |
119,789 | 0 | void NavigationControllerImpl::InsertOrReplaceEntry(NavigationEntryImpl* entry,
bool replace) {
DCHECK(entry->GetTransitionType() != PAGE_TRANSITION_AUTO_SUBFRAME);
const NavigationEntryImpl* const pending_entry =
(pending_entry_index_ == -1) ?
pending_entry_ : entries_[pending_entry_index_].get();
if (pending_entry)
entry->set_unique_id(pending_entry->GetUniqueID());
DiscardNonCommittedEntriesInternal();
int current_size = static_cast<int>(entries_.size());
if (current_size > 0) {
if (replace)
--last_committed_entry_index_;
int num_pruned = 0;
while (last_committed_entry_index_ < (current_size - 1)) {
num_pruned++;
entries_.pop_back();
current_size--;
}
if (num_pruned > 0) // Only notify if we did prune something.
NotifyPrunedEntries(this, false, num_pruned);
}
PruneOldestEntryIfFull();
entries_.push_back(linked_ptr<NavigationEntryImpl>(entry));
last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1;
web_contents_->UpdateMaxPageID(entry->GetPageID());
}
| 149 |
75,959 | 0 | get_vrrp_instance(const char *ifname, int vrid, int family)
{
element e;
vrrp_t *vrrp;
if (LIST_ISEMPTY(vrrp_data->vrrp))
return NULL;
for (e = LIST_HEAD(vrrp_data->vrrp); e; ELEMENT_NEXT(e)) {
vrrp = ELEMENT_DATA(e);
if (vrrp->vrid == vrid &&
vrrp->family == family &&
!valid_path_cmp(IF_BASE_IFP(vrrp->ifp)->ifname, ifname))
return vrrp;
}
return NULL;
}
| 150 |
44,056 | 0 | getXpathResult(xmlXPathObjectPtr xpathObj, int index)
{
xmlNode *match = NULL;
int max = numXpathResults(xpathObj);
CRM_CHECK(index >= 0, return NULL);
CRM_CHECK(xpathObj != NULL, return NULL);
if (index >= max) {
crm_err("Requested index %d of only %d items", index, max);
return NULL;
} else if(xpathObj->nodesetval->nodeTab[index] == NULL) {
/* Previously requested */
return NULL;
}
match = xpathObj->nodesetval->nodeTab[index];
CRM_CHECK(match != NULL, return NULL);
if (xpathObj->nodesetval->nodeTab[index]->type != XML_NAMESPACE_DECL) {
/* See the comment for freeXpathObject() */
xpathObj->nodesetval->nodeTab[index] = NULL;
}
if (match->type == XML_DOCUMENT_NODE) {
/* Will happen if section = '/' */
match = match->children;
} else if (match->type != XML_ELEMENT_NODE
&& match->parent && match->parent->type == XML_ELEMENT_NODE) {
/* reurning the parent instead */
match = match->parent;
} else if (match->type != XML_ELEMENT_NODE) {
/* We only support searching nodes */
crm_err("We only support %d not %d", XML_ELEMENT_NODE, match->type);
match = NULL;
}
return match;
}
| 151 |
120,749 | 0 | void BaseMultipleFieldsDateAndTimeInputType::valueAttributeChanged()
{
if (!element()->hasDirtyValue())
updateInnerTextValue();
}
| 152 |
182,307 | 1 | static int compile_search(struct Context *ctx, const struct Pattern *pat, struct Buffer *buf)
{
if (do_search(pat, 0) == 0)
return 0;
if (pat->not)
mutt_buffer_addstr(buf, "NOT ");
if (pat->child)
{
int clauses;
clauses = do_search(pat->child, 1);
if (clauses > 0)
{
const struct Pattern *clause = pat->child;
mutt_buffer_addch(buf, '(');
while (clauses)
{
if (do_search(clause, 0))
{
if (pat->op == MUTT_OR && clauses > 1)
mutt_buffer_addstr(buf, "OR ");
clauses--;
if (compile_search(ctx, clause, buf) < 0)
return -1;
if (clauses)
mutt_buffer_addch(buf, ' ');
}
clause = clause->next;
}
mutt_buffer_addch(buf, ')');
}
}
else
{
char term[STRING];
char *delim = NULL;
switch (pat->op)
{
case MUTT_HEADER:
mutt_buffer_addstr(buf, "HEADER ");
/* extract header name */
delim = strchr(pat->p.str, ':');
if (!delim)
{
mutt_error(_("Header search without header name: %s"), pat->p.str);
return -1;
}
*delim = '\0';
imap_quote_string(term, sizeof(term), pat->p.str);
mutt_buffer_addstr(buf, term);
mutt_buffer_addch(buf, ' ');
/* and field */
*delim = ':';
delim++;
SKIPWS(delim);
imap_quote_string(term, sizeof(term), delim);
mutt_buffer_addstr(buf, term);
break;
case MUTT_BODY:
mutt_buffer_addstr(buf, "BODY ");
imap_quote_string(term, sizeof(term), pat->p.str);
mutt_buffer_addstr(buf, term);
break;
case MUTT_WHOLE_MSG:
mutt_buffer_addstr(buf, "TEXT ");
imap_quote_string(term, sizeof(term), pat->p.str);
mutt_buffer_addstr(buf, term);
break;
case MUTT_SERVERSEARCH:
{
struct ImapData *idata = ctx->data;
if (!mutt_bit_isset(idata->capabilities, X_GM_EXT1))
{
mutt_error(_("Server-side custom search not supported: %s"), pat->p.str);
return -1;
}
}
mutt_buffer_addstr(buf, "X-GM-RAW ");
imap_quote_string(term, sizeof(term), pat->p.str);
mutt_buffer_addstr(buf, term);
break;
}
}
return 0;
}
| 153 |
659 | 0 | check_data_region (struct tar_sparse_file *file, size_t i)
{
off_t size_left;
if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
rdsize);
return false;
}
| 154 |
56,595 | 0 | int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
{
struct ext4_iloc iloc;
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
static unsigned int mnt_count;
int err, ret;
might_sleep();
trace_ext4_mark_inode_dirty(inode, _RET_IP_);
err = ext4_reserve_inode_write(handle, inode, &iloc);
if (ext4_handle_valid(handle) &&
EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize &&
!ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND)) {
/*
* We need extra buffer credits since we may write into EA block
* with this same handle. If journal_extend fails, then it will
* only result in a minor loss of functionality for that inode.
* If this is felt to be critical, then e2fsck should be run to
* force a large enough s_min_extra_isize.
*/
if ((jbd2_journal_extend(handle,
EXT4_DATA_TRANS_BLOCKS(inode->i_sb))) == 0) {
ret = ext4_expand_extra_isize(inode,
sbi->s_want_extra_isize,
iloc, handle);
if (ret) {
ext4_set_inode_state(inode,
EXT4_STATE_NO_EXPAND);
if (mnt_count !=
le16_to_cpu(sbi->s_es->s_mnt_count)) {
ext4_warning(inode->i_sb,
"Unable to expand inode %lu. Delete"
" some EAs or run e2fsck.",
inode->i_ino);
mnt_count =
le16_to_cpu(sbi->s_es->s_mnt_count);
}
}
}
}
if (!err)
err = ext4_mark_iloc_dirty(handle, inode, &iloc);
return err;
}
| 155 |
73,576 | 0 | static MagickBooleanType ReadPSDChannelRLE(Image *image,const PSDInfo *psd_info,
const ssize_t type,MagickOffsetType *offsets,ExceptionInfo *exception)
{
MagickBooleanType
status;
size_t
length,
row_size;
ssize_t
count,
y;
unsigned char
*compact_pixels,
*pixels;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" layer data is RLE compressed");
row_size=GetPSDRowSize(image);
pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
length=0;
for (y=0; y < (ssize_t) image->rows; y++)
if ((MagickOffsetType) length < offsets[y])
length=(size_t) offsets[y];
if (length > row_size + 256) // arbitrary number
{
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowBinaryException(ResourceLimitError,"InvalidLength",
image->filename);
}
compact_pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
if (compact_pixels == (unsigned char *) NULL)
{
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
(void) ResetMagickMemory(compact_pixels,0,length*sizeof(*compact_pixels));
status=MagickTrue;
for (y=0; y < (ssize_t) image->rows; y++)
{
status=MagickFalse;
count=ReadBlob(image,(size_t) offsets[y],compact_pixels);
if (count != (ssize_t) offsets[y])
break;
count=DecodePSDPixels((size_t) offsets[y],compact_pixels,
(ssize_t) (image->depth == 1 ? 123456 : image->depth),row_size,pixels);
if (count != (ssize_t) row_size)
break;
status=ReadPSDChannelPixels(image,psd_info->channels,y,type,pixels,
exception);
if (status == MagickFalse)
break;
}
compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(status);
}
| 156 |
70,527 | 0 | static int ext4_enable_quotas(struct super_block *sb)
{
int type, err = 0;
unsigned long qf_inums[EXT4_MAXQUOTAS] = {
le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum),
le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum)
};
bool quota_mopt[EXT4_MAXQUOTAS] = {
test_opt(sb, USRQUOTA),
test_opt(sb, GRPQUOTA),
test_opt(sb, PRJQUOTA),
};
sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
for (type = 0; type < EXT4_MAXQUOTAS; type++) {
if (qf_inums[type]) {
err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
DQUOT_USAGE_ENABLED |
(quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0));
if (err) {
ext4_warning(sb,
"Failed to enable quota tracking "
"(type=%d, err=%d). Please run "
"e2fsck to fix.", type, err);
return err;
}
}
}
return 0;
}
| 157 |
121,399 | 0 | void DevToolsWindow::DispatchOnEmbedder(const std::string& message) {
std::string method;
base::ListValue empty_params;
base::ListValue* params = &empty_params;
base::DictionaryValue* dict = NULL;
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
if (!parsed_message ||
!parsed_message->GetAsDictionary(&dict) ||
!dict->GetString(kFrontendHostMethod, &method) ||
(dict->HasKey(kFrontendHostParams) &&
!dict->GetList(kFrontendHostParams, ¶ms))) {
LOG(ERROR) << "Invalid message was sent to embedder: " << message;
return;
}
int id = 0;
dict->GetInteger(kFrontendHostId, &id);
std::string error = embedder_message_dispatcher_->Dispatch(method, params);
if (id) {
scoped_ptr<base::Value> id_value(base::Value::CreateIntegerValue(id));
scoped_ptr<base::Value> error_value(base::Value::CreateStringValue(error));
CallClientFunction("InspectorFrontendAPI.embedderMessageAck",
id_value.get(), error_value.get(), NULL);
}
}
| 158 |
31,221 | 0 | static int crypto_grab_nivaead(struct crypto_aead_spawn *spawn,
const char *name, u32 type, u32 mask)
{
struct crypto_alg *alg;
int err;
type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
type |= CRYPTO_ALG_TYPE_AEAD;
mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV;
alg = crypto_alg_mod_lookup(name, type, mask);
if (IS_ERR(alg))
return PTR_ERR(alg);
err = crypto_init_spawn(&spawn->base, alg, spawn->base.inst, mask);
crypto_mod_put(alg);
return err;
}
| 159 |
58,741 | 0 | static int tioccons(struct file *file)
{
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (file->f_op->write == redirected_tty_write) {
struct file *f;
spin_lock(&redirect_lock);
f = redirect;
redirect = NULL;
spin_unlock(&redirect_lock);
if (f)
fput(f);
return 0;
}
spin_lock(&redirect_lock);
if (redirect) {
spin_unlock(&redirect_lock);
return -EBUSY;
}
get_file(file);
redirect = file;
spin_unlock(&redirect_lock);
return 0;
}
| 160 |
33,056 | 0 | static int sctp_setsockopt_maxburst(struct sock *sk,
char __user *optval,
unsigned int optlen)
{
struct sctp_assoc_value params;
struct sctp_sock *sp;
struct sctp_association *asoc;
int val;
int assoc_id = 0;
if (optlen == sizeof(int)) {
pr_warn("Use of int in max_burst socket option deprecated\n");
pr_warn("Use struct sctp_assoc_value instead\n");
if (copy_from_user(&val, optval, optlen))
return -EFAULT;
} else if (optlen == sizeof(struct sctp_assoc_value)) {
if (copy_from_user(¶ms, optval, optlen))
return -EFAULT;
val = params.assoc_value;
assoc_id = params.assoc_id;
} else
return -EINVAL;
sp = sctp_sk(sk);
if (assoc_id != 0) {
asoc = sctp_id2assoc(sk, assoc_id);
if (!asoc)
return -EINVAL;
asoc->max_burst = val;
} else
sp->max_burst = val;
return 0;
}
| 161 |
109,600 | 0 | PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionState& es)
{
if (isHTMLDocument()) {
es.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
if (data.find("]]>") != WTF::kNotFound) {
es.throwDOMException(InvalidCharacterError, "String cannot contain ']]>' since that is the end delimiter of a CData section.");
return 0;
}
return CDATASection::create(*this, data);
}
| 162 |
40,686 | 0 | static inline int __sock_sendmsg_nosec(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size)
{
struct sock_iocb *si = kiocb_to_siocb(iocb);
si->sock = sock;
si->scm = NULL;
si->msg = msg;
si->size = size;
return sock->ops->sendmsg(iocb, sock, msg, size);
}
| 163 |
86,822 | 0 | static inline int compare(const char *s1, const char *s2, int l1, int l2) {
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
register const unsigned char *e1 = p1 + l1, *e2 = p2 + l2;
int c1, c2;
while (p1 < e1 && p2 < e2) {
GET_UTF8_CHAR(p1, e1, c1);
GET_UTF8_CHAR(p2, e2, c2);
if (c1 == c2) continue;
c1 = TOLOWER(c1);
c2 = TOLOWER(c2);
if (c1 != c2) return c1 - c2;
}
return l1 - l2;
}
| 164 |
40,262 | 0 | mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
int err = -ENOMEM;
struct sockaddr_mISDN *maddr;
if (*debug & DEBUG_SOCKET)
printk(KERN_DEBUG "%s: len %d flags %x ch %d proto %x\n",
__func__, (int)len, msg->msg_flags, _pms(sk)->ch.nr,
sk->sk_protocol);
if (msg->msg_flags & MSG_OOB)
return -EOPNOTSUPP;
if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_NOSIGNAL | MSG_ERRQUEUE))
return -EINVAL;
if (len < MISDN_HEADER_LEN)
return -EINVAL;
if (sk->sk_state != MISDN_BOUND)
return -EBADFD;
lock_sock(sk);
skb = _l2_alloc_skb(len, GFP_KERNEL);
if (!skb)
goto done;
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
err = -EFAULT;
goto done;
}
memcpy(mISDN_HEAD_P(skb), skb->data, MISDN_HEADER_LEN);
skb_pull(skb, MISDN_HEADER_LEN);
if (msg->msg_namelen >= sizeof(struct sockaddr_mISDN)) {
/* if we have a address, we use it */
maddr = (struct sockaddr_mISDN *)msg->msg_name;
mISDN_HEAD_ID(skb) = maddr->channel;
} else { /* use default for L2 messages */
if ((sk->sk_protocol == ISDN_P_LAPD_TE) ||
(sk->sk_protocol == ISDN_P_LAPD_NT))
mISDN_HEAD_ID(skb) = _pms(sk)->ch.nr;
}
if (*debug & DEBUG_SOCKET)
printk(KERN_DEBUG "%s: ID:%x\n",
__func__, mISDN_HEAD_ID(skb));
err = -ENODEV;
if (!_pms(sk)->ch.peer)
goto done;
err = _pms(sk)->ch.recv(_pms(sk)->ch.peer, skb);
if (err)
goto done;
else {
skb = NULL;
err = len;
}
done:
if (skb)
kfree_skb(skb);
release_sock(sk);
return err;
}
| 165 |
4,744 | 0 | user_register_extensions (User *user)
{
static const GDBusInterfaceVTable vtable = {
user_extension_method_call,
NULL /* get_property */,
NULL /* set_property */
};
GHashTable *extensions;
GHashTableIter iter;
gpointer iface;
gint i = 0;
g_assert (user->extension_ids == NULL);
g_assert (user->n_extension_ids == 0);
extensions = daemon_get_extension_ifaces (user->daemon);
user->n_extension_ids = g_hash_table_size (extensions);
user->extension_ids = g_new (guint, user->n_extension_ids);
g_hash_table_iter_init (&iter, extensions);
/* Ignore errors when registering more interfaces because (a)
* they won't happen and (b) even if they do, we still want to
* publish the main user interface.
*/
while (g_hash_table_iter_next (&iter, NULL, &iface))
user->extension_ids[i++] = g_dbus_connection_register_object (user->system_bus_connection,
g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (user)), iface,
&vtable, user, NULL, NULL);
}
| 166 |
185,247 | 1 | bool UnprivilegedProcessDelegate::CreateConnectedIpcChannel(
const std::string& channel_name,
IPC::Listener* delegate,
ScopedHandle* client_out,
scoped_ptr<IPC::ChannelProxy>* server_out) {
// Create the server end of the channel.
scoped_ptr<IPC::ChannelProxy> server;
if (!CreateIpcChannel(channel_name, kDaemonIpcSecurityDescriptor,
io_task_runner_, delegate, &server)) {
return false;
}
// Convert the channel name to the pipe name.
std::string pipe_name(kChromePipeNamePrefix);
pipe_name.append(channel_name);
SECURITY_ATTRIBUTES security_attributes;
security_attributes.nLength = sizeof(security_attributes);
security_attributes.lpSecurityDescriptor = NULL;
security_attributes.bInheritHandle = TRUE;
// Create the client end of the channel. This code should match the code in
// IPC::Channel.
ScopedHandle client;
client.Set(CreateFile(UTF8ToUTF16(pipe_name).c_str(),
GENERIC_READ | GENERIC_WRITE,
0,
&security_attributes,
OPEN_EXISTING,
SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION |
FILE_FLAG_OVERLAPPED,
NULL));
if (!client.IsValid())
return false;
*client_out = client.Pass();
*server_out = server.Pass();
return true;
}
| 167 |
37,728 | 0 | static void pit_set_gate(struct kvm *kvm, int channel, u32 val)
{
struct kvm_kpit_channel_state *c =
&kvm->arch.vpit->pit_state.channels[channel];
WARN_ON(!mutex_is_locked(&kvm->arch.vpit->pit_state.lock));
switch (c->mode) {
default:
case 0:
case 4:
/* XXX: just disable/enable counting */
break;
case 1:
case 2:
case 3:
case 5:
/* Restart counting on rising edge. */
if (c->gate < val)
c->count_load_time = ktime_get();
break;
}
c->gate = val;
}
| 168 |
129,654 | 0 | FloatPoint AffineTransform::mapPoint(const FloatPoint& point) const
{
double x2, y2;
map(point.x(), point.y(), x2, y2);
return FloatPoint(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2));
}
| 169 |
26,781 | 0 | static int nl80211_valid_4addr(struct cfg80211_registered_device *rdev,
struct net_device *netdev, u8 use_4addr,
enum nl80211_iftype iftype)
{
if (!use_4addr) {
if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
return -EBUSY;
return 0;
}
switch (iftype) {
case NL80211_IFTYPE_AP_VLAN:
if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP)
return 0;
break;
case NL80211_IFTYPE_STATION:
if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_STATION)
return 0;
break;
default:
break;
}
return -EOPNOTSUPP;
}
| 170 |
135,548 | 0 | void DispatchInputEvent(Element* target,
InputEvent::InputType input_type,
const String& data,
InputEvent::EventIsComposing is_composing) {
if (!RuntimeEnabledFeatures::InputEventEnabled())
return;
if (!target)
return;
InputEvent* input_event =
InputEvent::CreateInput(input_type, data, is_composing, nullptr);
target->DispatchScopedEvent(input_event);
}
| 171 |
22,411 | 0 | static void detach_destroy_domains(const struct cpumask *cpu_map)
{
/* Save because hotplug lock held. */
static DECLARE_BITMAP(tmpmask, CONFIG_NR_CPUS);
int i;
for_each_cpu(i, cpu_map)
cpu_attach_domain(NULL, &def_root_domain, i);
synchronize_sched();
arch_destroy_sched_domains(cpu_map, to_cpumask(tmpmask));
}
| 172 |
180,229 | 1 | SPL_METHOD(SplFileObject, next)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters_none() == FAILURE) {
return;
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) {
spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
}
intern->u.file.current_line_num++;
} /* }}} */
/* {{{ proto void SplFileObject::setFlags(int flags)
| 173 |
140,502 | 0 | int HttpProxyClientSocket::DoGenerateAuthToken() {
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
return auth_->MaybeGenerateAuthToken(&request_, io_callback_, net_log_);
}
| 174 |
128,681 | 0 | bool PowerOverlayEnabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnablePowerOverlay);
}
| 175 |
75,374 | 0 | static int opaam(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
int immediate = op->operands[0].immediate * op->operands[0].sign;
data[l++] = 0xd4;
if (immediate == 0) {
data[l++] = 0x0a;
} else if (immediate < 256 && immediate > -129) {
data[l++] = immediate;
}
return l;
}
| 176 |
73,421 | 0 | ossl_cipher_set_auth_tag(VALUE self, VALUE vtag)
{
EVP_CIPHER_CTX *ctx;
unsigned char *tag;
int tag_len;
StringValue(vtag);
tag = (unsigned char *) RSTRING_PTR(vtag);
tag_len = RSTRING_LENINT(vtag);
GetCipher(self, ctx);
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER))
ossl_raise(eCipherError, "authentication tag not supported by this cipher");
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, tag))
ossl_raise(eCipherError, "unable to set AEAD tag");
return vtag;
}
| 177 |
153,647 | 0 | void GLES2Implementation::GenBuffersHelper(GLsizei /* n */,
const GLuint* /* buffers */) {}
| 178 |
115,909 | 0 | Eina_Bool ewk_frame_feed_mouse_up(Evas_Object* ewkFrame, const Evas_Event_Mouse_Up* upEvent)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(upEvent, false);
WebCore::FrameView* view = smartData->frame->view();
DBG("ewkFrame=%p, view=%p, button=%d, pos=%d,%d",
ewkFrame, view, upEvent->button, upEvent->canvas.x, upEvent->canvas.y);
EINA_SAFETY_ON_NULL_RETURN_VAL(view, false);
Evas_Coord x, y;
evas_object_geometry_get(smartData->view, &x, &y, 0, 0);
WebCore::PlatformMouseEvent event(upEvent, WebCore::IntPoint(x, y));
return smartData->frame->eventHandler()->handleMouseReleaseEvent(event);
}
| 179 |
118,430 | 0 | void RenderFrameImpl::OnCompositorFrameSwapped(const IPC::Message& message) {
FrameMsg_CompositorFrameSwapped::Param param;
if (!FrameMsg_CompositorFrameSwapped::Read(&message, ¶m))
return;
scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
param.a.frame.AssignTo(frame.get());
if (!compositing_helper_.get()) {
compositing_helper_ =
ChildFrameCompositingHelper::CreateCompositingHelperForRenderFrame(
frame_, this, routing_id_);
compositing_helper_->EnableCompositing(true);
}
compositing_helper_->OnCompositorFrameSwapped(frame.Pass(),
param.a.producing_route_id,
param.a.output_surface_id,
param.a.producing_host_id,
param.a.shared_memory_handle);
}
| 180 |
183,705 | 1 | PrintingContextCairo::PrintingContextCairo(const std::string& app_locale)
#if defined(OS_CHROMEOS)
: PrintingContext(app_locale) {
#else
: PrintingContext(app_locale),
print_dialog_(NULL) {
#endif
}
PrintingContextCairo::~PrintingContextCairo() {
ReleaseContext();
#if !defined(OS_CHROMEOS)
if (print_dialog_)
print_dialog_->ReleaseDialog();
#endif
}
#if !defined(OS_CHROMEOS)
void PrintingContextCairo::SetCreatePrintDialogFunction(
PrintDialogGtkInterface* (*create_dialog_func)(
PrintingContextCairo* context)) {
DCHECK(create_dialog_func);
DCHECK(!create_dialog_func_);
create_dialog_func_ = create_dialog_func;
}
void PrintingContextCairo::PrintDocument(const Metafile* metafile) {
DCHECK(print_dialog_);
DCHECK(metafile);
print_dialog_->PrintDocument(metafile, document_name_);
}
#endif // !defined(OS_CHROMEOS)
void PrintingContextCairo::AskUserForSettings(
gfx::NativeView parent_view,
int max_pages,
bool has_selection,
PrintSettingsCallback* callback) {
#if defined(OS_CHROMEOS)
callback->Run(OK);
#else
print_dialog_->ShowDialog(callback);
#endif // defined(OS_CHROMEOS)
}
PrintingContext::Result PrintingContextCairo::UseDefaultSettings() {
DCHECK(!in_print_job_);
ResetSettings();
#if defined(OS_CHROMEOS)
int dpi = 300;
gfx::Size physical_size_device_units;
gfx::Rect printable_area_device_units;
int32_t width = 0;
int32_t height = 0;
UErrorCode error = U_ZERO_ERROR;
ulocdata_getPaperSize(app_locale_.c_str(), &height, &width, &error);
if (error != U_ZERO_ERROR) {
LOG(WARNING) << "ulocdata_getPaperSize failed, using 8.5 x 11, error: "
<< error;
width = static_cast<int>(8.5 * dpi);
height = static_cast<int>(11 * dpi);
} else {
width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi);
height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi);
}
physical_size_device_units.SetSize(width, height);
printable_area_device_units.SetRect(
static_cast<int>(PrintSettingsInitializerGtk::kLeftMarginInInch * dpi),
static_cast<int>(PrintSettingsInitializerGtk::kTopMarginInInch * dpi),
width - (PrintSettingsInitializerGtk::kLeftMarginInInch +
PrintSettingsInitializerGtk::kRightMarginInInch) * dpi,
height - (PrintSettingsInitializerGtk::kTopMarginInInch +
PrintSettingsInitializerGtk::kBottomMarginInInch) * dpi);
settings_.set_dpi(dpi);
settings_.SetPrinterPrintableArea(physical_size_device_units,
printable_area_device_units,
dpi);
#else
if (!print_dialog_) {
print_dialog_ = create_dialog_func_(this);
print_dialog_->AddRefToDialog();
}
print_dialog_->UseDefaultSettings();
#endif // defined(OS_CHROMEOS)
return OK;
}
PrintingContext::Result PrintingContextCairo::UpdatePrinterSettings(
const DictionaryValue& job_settings, const PageRanges& ranges) {
#if defined(OS_CHROMEOS)
bool landscape = false;
if (!job_settings.GetBoolean(kSettingLandscape, &landscape))
return OnError();
settings_.SetOrientation(landscape);
settings_.ranges = ranges;
return OK;
#else
DCHECK(!in_print_job_);
if (!print_dialog_->UpdateSettings(job_settings, ranges))
return OnError();
return OK;
#endif
}
PrintingContext::Result PrintingContextCairo::InitWithSettings(
const PrintSettings& settings) {
DCHECK(!in_print_job_);
settings_ = settings;
return OK;
}
PrintingContext::Result PrintingContextCairo::NewDocument(
const string16& document_name) {
DCHECK(!in_print_job_);
in_print_job_ = true;
#if !defined(OS_CHROMEOS)
document_name_ = document_name;
#endif // !defined(OS_CHROMEOS)
return OK;
}
PrintingContext::Result PrintingContextCairo::NewPage() {
if (abort_printing_)
return CANCEL;
DCHECK(in_print_job_);
return OK;
}
PrintingContext::Result PrintingContextCairo::PageDone() {
if (abort_printing_)
return CANCEL;
DCHECK(in_print_job_);
return OK;
}
PrintingContext::Result PrintingContextCairo::DocumentDone() {
if (abort_printing_)
return CANCEL;
DCHECK(in_print_job_);
ResetSettings();
return OK;
}
void PrintingContextCairo::Cancel() {
abort_printing_ = true;
in_print_job_ = false;
}
void PrintingContextCairo::ReleaseContext() {
}
gfx::NativeDrawingContext PrintingContextCairo::context() const {
return NULL;
}
} // namespace printing
| 181 |
49,163 | 0 | static unsigned int fanout_demux_qm(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
return skb_get_queue_mapping(skb) % num;
}
| 182 |
99,014 | 0 | void* WebGraphicsContext3DDefaultImpl::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
{
return 0;
}
| 183 |
113,275 | 0 | void PanelBrowserView::AnimationEnded(const ui::Animation* animation) {
panel_->manager()->OnPanelAnimationEnded(panel_.get());
}
| 184 |
152,898 | 0 | bool ImageBitmap::isAccelerated() const {
return m_image && (m_image->isTextureBacked() || m_image->hasMailbox());
}
| 185 |
95,273 | 0 | static void xfer_cleanup(struct xfer_header *xfer)
{
struct xfer_item *item, *next;
/* remove items */
item = xfer->items;
while (item) {
next = item->next;
mboxlist_entry_free(&item->mbentry);
free(item);
item = next;
}
xfer->items = NULL;
free(xfer->topart);
free(xfer->userid);
xfer->topart = xfer->userid = NULL;
seen_close(&xfer->seendb);
xfer->seendb = NULL;
}
| 186 |
134,499 | 0 | gfx::Size WebContentsViewAura::GetMaximumSize() const {
return gfx::Size();
}
| 187 |
154,714 | 0 | error::Error GLES2DecoderPassthroughImpl::DoGetTranslatedShaderSourceANGLE(
GLuint shader,
std::string* source) {
CheckErrorCallbackState();
GLuint service_id = GetShaderServiceID(shader, resources_);
GLint translated_source_length = 0;
api()->glGetShaderivFn(service_id, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE,
&translated_source_length);
if (CheckErrorCallbackState()) {
return error::kNoError;
}
if (translated_source_length > 0) {
std::vector<char> buffer(translated_source_length, 0);
api()->glGetTranslatedShaderSourceANGLEFn(
service_id, translated_source_length, nullptr, buffer.data());
*source = std::string(buffer.data());
}
return error::kNoError;
}
| 188 |
119,189 | 0 | static void replaceCharsetInMediaType(String& mediaType, const String& charsetValue)
{
unsigned int pos = 0, len = 0;
findCharsetInMediaType(mediaType, pos, len);
if (!len) {
return;
}
while (len) {
mediaType.replace(pos, len, charsetValue);
unsigned int start = pos + charsetValue.length();
findCharsetInMediaType(mediaType, pos, len, start);
}
}
| 189 |
24,356 | 0 | int test_set_oom_score_adj(int new_val)
{
struct sighand_struct *sighand = current->sighand;
int old_val;
spin_lock_irq(&sighand->siglock);
old_val = current->signal->oom_score_adj;
if (new_val != old_val) {
if (new_val == OOM_SCORE_ADJ_MIN)
atomic_inc(¤t->mm->oom_disable_count);
else if (old_val == OOM_SCORE_ADJ_MIN)
atomic_dec(¤t->mm->oom_disable_count);
current->signal->oom_score_adj = new_val;
}
spin_unlock_irq(&sighand->siglock);
return old_val;
}
| 190 |
182,073 | 1 | static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info,
ExceptionInfo *exception)
{
DDSColors
colors;
ssize_t
j,
y;
MagickSizeType
alpha_bits;
PixelPacket
*q;
register ssize_t
i,
x;
unsigned char
a0,
a1;
size_t
alpha,
bits,
code,
alpha_code;
unsigned short
c0,
c1;
for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
for (x = 0; x < (ssize_t) dds_info->width; x += 4)
{
/* Get 4x4 patch of pixels to write on */
q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
Min(4, dds_info->height - y),exception);
if (q == (PixelPacket *) NULL)
return MagickFalse;
/* Read alpha values (8 bytes) */
a0 = (unsigned char) ReadBlobByte(image);
a1 = (unsigned char) ReadBlobByte(image);
alpha_bits = (MagickSizeType)ReadBlobLSBLong(image);
alpha_bits = alpha_bits | ((MagickSizeType)ReadBlobLSBShort(image) << 32);
/* Read 8 bytes of data from the image */
c0 = ReadBlobLSBShort(image);
c1 = ReadBlobLSBShort(image);
bits = ReadBlobLSBLong(image);
CalculateColors(c0, c1, &colors, MagickTrue);
/* Write the pixels */
for (j = 0; j < 4; j++)
{
for (i = 0; i < 4; i++)
{
if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
{
code = (bits >> ((4*j+i)*2)) & 0x3;
SetPixelRed(q,ScaleCharToQuantum(colors.r[code]));
SetPixelGreen(q,ScaleCharToQuantum(colors.g[code]));
SetPixelBlue(q,ScaleCharToQuantum(colors.b[code]));
/* Extract alpha value */
alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7;
if (alpha_code == 0)
alpha = a0;
else if (alpha_code == 1)
alpha = a1;
else if (a0 > a1)
alpha = ((8-alpha_code) * a0 + (alpha_code-1) * a1) / 7;
else if (alpha_code == 6)
alpha = 0;
else if (alpha_code == 7)
alpha = 255;
else
alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5);
SetPixelAlpha(q,ScaleCharToQuantum((unsigned char)
alpha));
q++;
}
}
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
return MagickFalse;
}
}
SkipDXTMipmaps(image, dds_info, 16);
return MagickTrue;
}
| 191 |
140,576 | 0 | int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
DCHECK(write_callback_.is_null());
if (next_state_ != STATE_OPEN)
return ERR_SOCKET_NOT_CONNECTED;
DCHECK(spdy_stream_.get());
spdy_stream_->SendData(buf, buf_len, MORE_DATA_TO_SEND);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
buf_len, buf->data());
write_callback_ = callback;
write_buffer_len_ = buf_len;
return ERR_IO_PENDING;
}
| 192 |
126,463 | 0 | void TabContentsContainerGtk::Init() {
floating_.Own(gtk_floating_container_new());
gtk_widget_set_name(floating_.get(), "chrome-tab-contents-container");
g_signal_connect(floating_.get(), "focus", G_CALLBACK(OnFocusThunk), this);
expanded_ = gtk_expanded_container_new();
gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_);
if (status_bubble_) {
gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
status_bubble_->widget());
g_signal_connect(floating_.get(), "set-floating-position",
G_CALLBACK(OnSetFloatingPosition), this);
}
gtk_widget_show(expanded_);
gtk_widget_show(floating_.get());
ViewIDUtil::SetDelegateForWidget(widget(), this);
}
| 193 |
4,448 | 0 | PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
{
int i;
PHAR_GLOBALS->request_ends = 1;
if (PHAR_GLOBALS->request_init)
{
phar_release_functions(TSRMLS_C);
zend_hash_destroy(&(PHAR_GLOBALS->phar_alias_map));
PHAR_GLOBALS->phar_alias_map.arBuckets = NULL;
zend_hash_destroy(&(PHAR_GLOBALS->phar_fname_map));
PHAR_GLOBALS->phar_fname_map.arBuckets = NULL;
zend_hash_destroy(&(PHAR_GLOBALS->phar_persist_map));
PHAR_GLOBALS->phar_persist_map.arBuckets = NULL;
PHAR_GLOBALS->phar_SERVER_mung_list = 0;
if (PHAR_GLOBALS->cached_fp) {
for (i = 0; i < zend_hash_num_elements(&cached_phars); ++i) {
if (PHAR_GLOBALS->cached_fp[i].fp) {
php_stream_close(PHAR_GLOBALS->cached_fp[i].fp);
}
if (PHAR_GLOBALS->cached_fp[i].ufp) {
php_stream_close(PHAR_GLOBALS->cached_fp[i].ufp);
}
efree(PHAR_GLOBALS->cached_fp[i].manifest);
}
efree(PHAR_GLOBALS->cached_fp);
PHAR_GLOBALS->cached_fp = 0;
}
PHAR_GLOBALS->request_init = 0;
if (PHAR_G(cwd)) {
efree(PHAR_G(cwd));
}
PHAR_G(cwd) = NULL;
PHAR_G(cwd_len) = 0;
PHAR_G(cwd_init) = 0;
}
PHAR_GLOBALS->request_done = 1;
return SUCCESS;
}
/* }}} */
| 194 |
123,870 | 0 | void RenderViewImpl::InstrumentDidBeginFrame() {
if (!webview())
return;
if (!webview()->devToolsAgent())
return;
webview()->devToolsAgent()->didComposite();
}
| 195 |
37,391 | 0 | static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
struct kvm_mmu_pages *pvec)
{
int i, ret, nr_unsync_leaf = 0;
for_each_set_bit(i, sp->unsync_child_bitmap, 512) {
struct kvm_mmu_page *child;
u64 ent = sp->spt[i];
if (!is_shadow_present_pte(ent) || is_large_pte(ent))
goto clear_child_bitmap;
child = page_header(ent & PT64_BASE_ADDR_MASK);
if (child->unsync_children) {
if (mmu_pages_add(pvec, child, i))
return -ENOSPC;
ret = __mmu_unsync_walk(child, pvec);
if (!ret)
goto clear_child_bitmap;
else if (ret > 0)
nr_unsync_leaf += ret;
else
return ret;
} else if (child->unsync) {
nr_unsync_leaf++;
if (mmu_pages_add(pvec, child, i))
return -ENOSPC;
} else
goto clear_child_bitmap;
continue;
clear_child_bitmap:
__clear_bit(i, sp->unsync_child_bitmap);
sp->unsync_children--;
WARN_ON((int)sp->unsync_children < 0);
}
return nr_unsync_leaf;
}
| 196 |
17,931 | 0 | PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC)
{
php_stream_temp_data *self;
php_stream *stream;
self = ecalloc(1, sizeof(*self));
self->smax = max_memory_usage;
self->mode = mode;
self->meta = NULL;
stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
self->innerstream = php_stream_memory_create_rel(mode);
php_stream_encloses(stream, self->innerstream);
return stream;
}
| 197 |
135,862 | 0 | void TextTrack::AddListOfCues(
HeapVector<Member<TextTrackCue>>& list_of_new_cues) {
TextTrackCueList* cues = EnsureTextTrackCueList();
for (auto& new_cue : list_of_new_cues) {
new_cue->SetTrack(this);
cues->Add(new_cue);
}
if (GetCueTimeline() && mode() != DisabledKeyword())
GetCueTimeline()->AddCues(this, cues);
}
| 198 |
175,730 | 0 | IHEVCD_ERROR_T ihevcd_parse_pps(codec_t *ps_codec)
{
IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
WORD32 value;
WORD32 pps_id;
pps_t *ps_pps;
sps_t *ps_sps;
bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm;
if(0 == ps_codec->i4_sps_done)
return IHEVCD_INVALID_HEADER;
UEV_PARSE("pic_parameter_set_id", value, ps_bitstrm);
pps_id = value;
if((pps_id >= MAX_PPS_CNT) || (pps_id < 0))
{
if(ps_codec->i4_pps_done)
return IHEVCD_UNSUPPORTED_PPS_ID;
else
pps_id = 0;
}
ps_pps = (ps_codec->s_parse.ps_pps_base + MAX_PPS_CNT - 1);
ps_pps->i1_pps_id = pps_id;
UEV_PARSE("seq_parameter_set_id", value, ps_bitstrm);
ps_pps->i1_sps_id = value;
ps_pps->i1_sps_id = CLIP3(ps_pps->i1_sps_id, 0, MAX_SPS_CNT - 2);
ps_sps = (ps_codec->s_parse.ps_sps_base + ps_pps->i1_sps_id);
/* If the SPS that is being referred to has not been parsed,
* copy an existing SPS to the current location */
if(0 == ps_sps->i1_sps_valid)
{
return IHEVCD_INVALID_HEADER;
/*
sps_t *ps_sps_ref = ps_codec->ps_sps_base;
while(0 == ps_sps_ref->i1_sps_valid)
ps_sps_ref++;
ihevcd_copy_sps(ps_codec, ps_pps->i1_sps_id, ps_sps_ref->i1_sps_id);
*/
}
BITS_PARSE("dependent_slices_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_dependent_slice_enabled_flag = value;
BITS_PARSE("output_flag_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_output_flag_present_flag = value;
BITS_PARSE("num_extra_slice_header_bits", value, ps_bitstrm, 3);
ps_pps->i1_num_extra_slice_header_bits = value;
BITS_PARSE("sign_data_hiding_flag", value, ps_bitstrm, 1);
ps_pps->i1_sign_data_hiding_flag = value;
BITS_PARSE("cabac_init_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_cabac_init_present_flag = value;
UEV_PARSE("num_ref_idx_l0_default_active_minus1", value, ps_bitstrm);
ps_pps->i1_num_ref_idx_l0_default_active = value + 1;
UEV_PARSE("num_ref_idx_l1_default_active_minus1", value, ps_bitstrm);
ps_pps->i1_num_ref_idx_l1_default_active = value + 1;
SEV_PARSE("pic_init_qp_minus26", value, ps_bitstrm);
ps_pps->i1_pic_init_qp = value + 26;
BITS_PARSE("constrained_intra_pred_flag", value, ps_bitstrm, 1);
ps_pps->i1_constrained_intra_pred_flag = value;
BITS_PARSE("transform_skip_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_transform_skip_enabled_flag = value;
BITS_PARSE("cu_qp_delta_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_cu_qp_delta_enabled_flag = value;
if(ps_pps->i1_cu_qp_delta_enabled_flag)
{
UEV_PARSE("diff_cu_qp_delta_depth", value, ps_bitstrm);
ps_pps->i1_diff_cu_qp_delta_depth = value;
}
else
{
ps_pps->i1_diff_cu_qp_delta_depth = 0;
}
ps_pps->i1_log2_min_cu_qp_delta_size = ps_sps->i1_log2_ctb_size - ps_pps->i1_diff_cu_qp_delta_depth;
/* Print different */
SEV_PARSE("cb_qp_offset", value, ps_bitstrm);
ps_pps->i1_pic_cb_qp_offset = value;
/* Print different */
SEV_PARSE("cr_qp_offset", value, ps_bitstrm);
ps_pps->i1_pic_cr_qp_offset = value;
/* Print different */
BITS_PARSE("slicelevel_chroma_qp_flag", value, ps_bitstrm, 1);
ps_pps->i1_pic_slice_level_chroma_qp_offsets_present_flag = value;
BITS_PARSE("weighted_pred_flag", value, ps_bitstrm, 1);
ps_pps->i1_weighted_pred_flag = value;
BITS_PARSE("weighted_bipred_flag", value, ps_bitstrm, 1);
ps_pps->i1_weighted_bipred_flag = value;
BITS_PARSE("transquant_bypass_enable_flag", value, ps_bitstrm, 1);
ps_pps->i1_transquant_bypass_enable_flag = value;
BITS_PARSE("tiles_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_tiles_enabled_flag = value;
BITS_PARSE("entropy_coding_sync_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_entropy_coding_sync_enabled_flag = value;
ps_pps->i1_loop_filter_across_tiles_enabled_flag = 0;
if(ps_pps->i1_tiles_enabled_flag)
{
UEV_PARSE("num_tile_columns_minus1", value, ps_bitstrm);
ps_pps->i1_num_tile_columns = value + 1;
UEV_PARSE("num_tile_rows_minus1", value, ps_bitstrm);
ps_pps->i1_num_tile_rows = value + 1;
if((ps_pps->i1_num_tile_columns < 1) ||
(ps_pps->i1_num_tile_columns > ps_sps->i2_pic_wd_in_ctb) ||
(ps_pps->i1_num_tile_rows < 1) ||
(ps_pps->i1_num_tile_rows > ps_sps->i2_pic_ht_in_ctb))
return IHEVCD_INVALID_HEADER;
BITS_PARSE("uniform_spacing_flag", value, ps_bitstrm, 1);
ps_pps->i1_uniform_spacing_flag = value;
{
WORD32 start;
WORD32 i, j;
start = 0;
for(i = 0; i < ps_pps->i1_num_tile_columns; i++)
{
tile_t *ps_tile;
if(!ps_pps->i1_uniform_spacing_flag)
{
if(i < (ps_pps->i1_num_tile_columns - 1))
{
UEV_PARSE("column_width_minus1[ i ]", value, ps_bitstrm);
value += 1;
}
else
{
value = ps_sps->i2_pic_wd_in_ctb - start;
}
}
else
{
value = ((i + 1) * ps_sps->i2_pic_wd_in_ctb) / ps_pps->i1_num_tile_columns -
(i * ps_sps->i2_pic_wd_in_ctb) / ps_pps->i1_num_tile_columns;
}
for(j = 0; j < ps_pps->i1_num_tile_rows; j++)
{
ps_tile = ps_pps->ps_tile + j * ps_pps->i1_num_tile_columns + i;
ps_tile->u1_pos_x = start;
ps_tile->u2_wd = value;
}
start += value;
if((start > ps_sps->i2_pic_wd_in_ctb) ||
(value <= 0))
return IHEVCD_INVALID_HEADER;
}
start = 0;
for(i = 0; i < (ps_pps->i1_num_tile_rows); i++)
{
tile_t *ps_tile;
if(!ps_pps->i1_uniform_spacing_flag)
{
if(i < (ps_pps->i1_num_tile_rows - 1))
{
UEV_PARSE("row_height_minus1[ i ]", value, ps_bitstrm);
value += 1;
}
else
{
value = ps_sps->i2_pic_ht_in_ctb - start;
}
}
else
{
value = ((i + 1) * ps_sps->i2_pic_ht_in_ctb) / ps_pps->i1_num_tile_rows -
(i * ps_sps->i2_pic_ht_in_ctb) / ps_pps->i1_num_tile_rows;
}
for(j = 0; j < ps_pps->i1_num_tile_columns; j++)
{
ps_tile = ps_pps->ps_tile + i * ps_pps->i1_num_tile_columns + j;
ps_tile->u1_pos_y = start;
ps_tile->u2_ht = value;
}
start += value;
if((start > ps_sps->i2_pic_ht_in_ctb) ||
(value <= 0))
return IHEVCD_INVALID_HEADER;
}
}
BITS_PARSE("loop_filter_across_tiles_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_loop_filter_across_tiles_enabled_flag = value;
}
else
{
/* If tiles are not present, set first tile in each PPS to have tile
width and height equal to picture width and height */
ps_pps->i1_num_tile_columns = 1;
ps_pps->i1_num_tile_rows = 1;
ps_pps->i1_uniform_spacing_flag = 1;
ps_pps->ps_tile->u1_pos_x = 0;
ps_pps->ps_tile->u1_pos_y = 0;
ps_pps->ps_tile->u2_wd = ps_sps->i2_pic_wd_in_ctb;
ps_pps->ps_tile->u2_ht = ps_sps->i2_pic_ht_in_ctb;
}
BITS_PARSE("loop_filter_across_slices_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_loop_filter_across_slices_enabled_flag = value;
BITS_PARSE("deblocking_filter_control_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_deblocking_filter_control_present_flag = value;
/* Default values */
ps_pps->i1_pic_disable_deblocking_filter_flag = 0;
ps_pps->i1_deblocking_filter_override_enabled_flag = 0;
ps_pps->i1_beta_offset_div2 = 0;
ps_pps->i1_tc_offset_div2 = 0;
if(ps_pps->i1_deblocking_filter_control_present_flag)
{
BITS_PARSE("deblocking_filter_override_enabled_flag", value, ps_bitstrm, 1);
ps_pps->i1_deblocking_filter_override_enabled_flag = value;
BITS_PARSE("pic_disable_deblocking_filter_flag", value, ps_bitstrm, 1);
ps_pps->i1_pic_disable_deblocking_filter_flag = value;
if(!ps_pps->i1_pic_disable_deblocking_filter_flag)
{
SEV_PARSE("pps_beta_offset_div2", value, ps_bitstrm);
ps_pps->i1_beta_offset_div2 = value;
SEV_PARSE("pps_tc_offset_div2", value, ps_bitstrm);
ps_pps->i1_tc_offset_div2 = value;
}
}
BITS_PARSE("pps_scaling_list_data_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_pps_scaling_list_data_present_flag = value;
if(ps_pps->i1_pps_scaling_list_data_present_flag)
{
COPY_DEFAULT_SCALING_LIST(ps_pps->pi2_scaling_mat);
ihevcd_scaling_list_data(ps_codec, ps_pps->pi2_scaling_mat);
}
BITS_PARSE("lists_modification_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_lists_modification_present_flag = value;
UEV_PARSE("log2_parallel_merge_level_minus2", value, ps_bitstrm);
ps_pps->i1_log2_parallel_merge_level = value + 2;
BITS_PARSE("slice_header_extension_present_flag", value, ps_bitstrm, 1);
ps_pps->i1_slice_header_extension_present_flag = value;
/* Not present in HM */
BITS_PARSE("pps_extension_flag", value, ps_bitstrm, 1);
ps_codec->i4_pps_done = 1;
return ret;
}
| 199 |
Subsets and Splits