idx
int64 | func
string | target
int64 |
|---|---|---|
9,073
|
static int clone_file(const char *from, const char *to,
const char **err_status, int copy_if_rename_fails) {
FILE *from_fp = NULL, *to_fp = NULL;
char buf[BUFSIZ];
size_t len;
int result = -1;
if (rename(from, to) == 0)
return 0;
if ((errno != EXDEV && errno != EBUSY) || !copy_if_rename_fails) {
*err_status = "rename";
return -1;
}
/* rename not possible, copy file contents */
if (!(from_fp = fopen(from, "r"))) {
*err_status = "clone_open_src";
goto done;
}
if (!(to_fp = fopen(to, "w"))) {
*err_status = "clone_open_dst";
goto done;
}
if (transfer_file_attrs(from_fp, to_fp, err_status) < 0)
goto done;
while ((len = fread(buf, 1, BUFSIZ, from_fp)) > 0) {
if (fwrite(buf, 1, len, to_fp) != len) {
*err_status = "clone_write";
goto done;
}
}
if (ferror(from_fp)) {
*err_status = "clone_read";
goto done;
}
if (fflush(to_fp) != 0) {
*err_status = "clone_flush";
goto done;
}
if (fsync(fileno(to_fp)) < 0) {
*err_status = "clone_sync";
goto done;
}
result = 0;
done:
if (from_fp != NULL)
fclose(from_fp);
if (to_fp != NULL && fclose(to_fp) != 0)
result = -1;
if (result != 0)
unlink(to);
if (result == 0)
unlink(from);
return result;
}
| 1
|
24,394
|
static void ATinit ( struct alltabs * at , SplineFont * sf , EncMap * map , int flags , int layer , enum fontformat format , enum bitmapformat bf , int * bsizes ) {
at -> gi . flags = flags ;
at -> gi . layer = layer ;
at -> gi . is_ttf = format == ff_ttf || format == ff_ttfsym || format == ff_ttfmacbin || format == ff_ttfdfont ;
at -> gi . sf = sf ;
at -> applemode = ( flags & ttf_flag_applemode ) ? 1 : 0 ;
at -> opentypemode = ( flags & ttf_flag_otmode ) ? 1 : 0 ;
at -> msbitmaps = bsizes != NULL && at -> opentypemode ;
at -> applebitmaps = bsizes != NULL && at -> applemode ;
at -> gi . onlybitmaps = format == ff_none ;
if ( bf == bf_sfnt_dfont ) {
at -> msbitmaps = false ;
at -> applebitmaps = true ;
at -> opentypemode = false ;
at -> gi . onlybitmaps = true ;
}
if ( bf == bf_sfnt_ms ) {
at -> msbitmaps = true ;
at -> applebitmaps = false ;
at -> applemode = false ;
at -> gi . onlybitmaps = true ;
}
if ( bf == bf_otb ) {
at -> otbbitmaps = true ;
at -> applebitmaps = at -> msbitmaps = false ;
at -> applemode = false ;
at -> gi . onlybitmaps = true ;
}
if ( bsizes != NULL && ! at -> applebitmaps && ! at -> otbbitmaps && ! at -> msbitmaps ) at -> msbitmaps = true ;
at -> gi . bsizes = bsizes ;
at -> gi . fixed_width = CIDOneWidth ( sf ) ;
at -> isotf = format == ff_otf || format == ff_otfcid ;
at -> format = format ;
at -> next_strid = 256 ;
if ( at -> applemode && sf -> mm != NULL && sf -> mm -> apple && ( format == ff_ttf || format == ff_ttfsym || format == ff_ttfmacbin || format == ff_ttfdfont ) && MMValid ( sf -> mm , false ) ) {
at -> dovariations = true ;
at -> gi . dovariations = true ;
sf = sf -> mm -> normal ;
}
at -> sf = sf ;
at -> map = map ;
}
| 0
|
18,884
|
static gboolean logcat_seek_read ( wtap * wth , gint64 seek_off , struct wtap_pkthdr * phdr , Buffer * buf , int * err , gchar * * err_info ) {
if ( file_seek ( wth -> random_fh , seek_off , SEEK_SET , err ) == - 1 ) return FALSE ;
if ( ! logcat_read_packet ( ( struct logcat_phdr * ) wth -> priv , wth -> random_fh , phdr , buf , err , err_info ) ) {
if ( * err == 0 ) * err = WTAP_ERR_SHORT_READ ;
return FALSE ;
}
return TRUE ;
}
| 0
|
182,599
|
LRESULT HWNDMessageHandler::OnKeyEvent(UINT message,
WPARAM w_param,
LPARAM l_param) {
MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime() };
ui::KeyEvent key(msg, message == WM_CHAR);
if (!delegate_->HandleUntranslatedKeyEvent(key))
DispatchKeyEventPostIME(key);
return 0;
}
| 0
|
10,522
|
void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
impeg2d_video_decode_op_t *ps_op)
{
UWORD32 u4_bits_read;
dec_state_t *ps_dec;
UWORD32 u4_size = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
ps_dec = (dec_state_t *)pv_dec;
ps_op->s_ivd_video_decode_op_t.u4_error_code = 0;
if (u4_size > MAX_BITSTREAM_BUFFER_SIZE)
{
u4_size = MAX_BITSTREAM_BUFFER_SIZE;
}
memcpy(ps_dec->pu1_input_buffer, ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer, u4_size);
impeg2d_bit_stream_init(&(ps_dec->s_bit_stream), ps_dec->pu1_input_buffer,
u4_size);
{
{
IMPEG2D_ERROR_CODES_T e_error;
e_error = impeg2d_process_video_header(ps_dec);
if ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE != e_error)
{
ps_op->s_ivd_video_decode_op_t.u4_error_code = e_error;
u4_bits_read = impeg2d_bit_stream_num_bits_read(&ps_dec->s_bit_stream);
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = u4_bits_read>> 3;
if(ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed > ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes)
{
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
if(ps_op->s_ivd_video_decode_op_t.u4_error_code == 0)
ps_op->s_ivd_video_decode_op_t.u4_error_code = e_error;
if (IMPEG2D_UNSUPPORTED_DIMENSIONS == e_error)
{
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = 0;
ps_dec->u2_header_done = 0;
ps_op->s_ivd_video_decode_op_t.u4_pic_ht = ps_dec->u2_reinit_max_height;
ps_op->s_ivd_video_decode_op_t.u4_pic_wd = ps_dec->u2_reinit_max_width;
}
impeg2d_next_code(ps_dec, SEQUENCE_HEADER_CODE);
return;
}
}
ps_op->s_ivd_video_decode_op_t.u4_pic_ht = ps_dec->u2_vertical_size;
ps_op->s_ivd_video_decode_op_t.u4_pic_wd = ps_dec->u2_horizontal_size;
ps_op->s_ivd_video_decode_op_t.e_pic_type = IV_NA_FRAME;
ps_op->s_ivd_video_decode_op_t.u4_error_code = IV_SUCCESS;
u4_bits_read = impeg2d_bit_stream_num_bits_read(&ps_dec->s_bit_stream);
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = u4_bits_read>> 3;
if(ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed > ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes)
{
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
ps_op->s_ivd_video_decode_op_t.u4_frame_decoded_flag = 0;
/* MOD */
ps_dec->u2_header_done = 1;
}
}
| 1
|
115,003
|
bool CommandData::ExclDirByAttr(uint FileAttr)
{
#ifdef _WIN_ALL
if ((FileAttr & FILE_ATTRIBUTE_REPARSE_POINT)!=0 &&
(ExclFileAttr & FILE_ATTRIBUTE_REPARSE_POINT)!=0)
return true;
#endif
return false;
}
| 0
|
197,686
|
gst_qtdemux_prepare_current_sample (GstQTDemux * qtdemux,
QtDemuxStream * stream, guint64 * offset, guint * size, guint64 * timestamp,
guint64 * duration, gboolean * keyframe)
{
QtDemuxSample *sample;
guint64 time_position;
guint32 seg_idx;
g_return_val_if_fail (stream != NULL, FALSE);
time_position = stream->time_position;
if (time_position == -1)
goto eos;
seg_idx = stream->segment_index;
if (seg_idx == -1) {
/* find segment corresponding to time_position if we are looking
* for a segment. */
seg_idx = gst_qtdemux_find_segment (qtdemux, stream, time_position);
/* nothing found, we're really eos */
if (seg_idx == -1)
goto eos;
}
/* different segment, activate it, sample_index will be set. */
if (stream->segment_index != seg_idx)
gst_qtdemux_activate_segment (qtdemux, stream, seg_idx, time_position);
GST_LOG_OBJECT (qtdemux, "segment active, index = %u of %u",
stream->sample_index, stream->n_samples);
/* send out pending buffers */
while (stream->buffers) {
GstBuffer *buffer = (GstBuffer *) stream->buffers->data;
if (stream->discont) {
GST_LOG_OBJECT (qtdemux, "marking discont buffer");
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
}
gst_buffer_set_caps (buffer, stream->caps);
gst_pad_push (stream->pad, buffer);
stream->buffers = g_slist_delete_link (stream->buffers, stream->buffers);
}
if (stream->sample_index >= stream->n_samples)
goto eos;
/* now get the info for the sample we're at */
sample = &stream->samples[stream->sample_index];
*timestamp = sample->timestamp + sample->pts_offset;
*offset = sample->offset;
*size = sample->size;
*duration = sample->duration;
*keyframe = stream->all_keyframe || sample->keyframe;
/* add padding */
if (stream->padding) {
*offset += stream->padding;
*size -= stream->padding;
}
return TRUE;
/* special cases */
eos:
{
stream->time_position = -1;
return FALSE;
}
}
| 0
|
86,164
|
static void jsi_ValueToPrimitiveRes(Jsi_Interp *interp, Jsi_Value *v, Jsi_Value *rPtr)
{
if (v->vt != JSI_VT_OBJECT) {
#ifdef JSI_MEM_DEBUG
memcpy(rPtr, v, sizeof(*v)-sizeof(v->VD));
#else
*rPtr = *v; //TODO: usde only by ValueCompare, so refCnt doesn't matter?
#endif
return;
}
Jsi_Obj *obj = v->d.obj;
switch(obj->ot) {
case JSI_OT_BOOL:
Jsi_ValueMakeBool(interp, &rPtr, obj->d.val);
break;
case JSI_OT_NUMBER:
Jsi_ValueMakeNumber(interp, &rPtr, obj->d.num);
break;
case JSI_OT_STRING:
rPtr->vt = JSI_VT_STRING;
rPtr->d.s = obj->d.s;
rPtr->f.bits.isstrkey = 1;
break;
default:
break;
}
}
| 0
|
85,090
|
void d_move(struct dentry *dentry, struct dentry *target)
{
write_seqlock(&rename_lock);
__d_move(dentry, target, false);
write_sequnlock(&rename_lock);
}
| 0
|
283,742
|
bool SyncTest::WaitForTestServerToStart(int time_ms, int intervals) {
for (int i = 0; i < intervals; ++i) {
if (IsTestServerRunning())
return true;
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
time_ms / intervals));
}
return false;
}
| 0
|
153,242
|
struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type,
u32 mask)
{
struct crypto_tfm *tfm = NULL;
unsigned int tfm_size;
int err = -ENOMEM;
tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask);
tfm = kzalloc(tfm_size, GFP_KERNEL);
if (tfm == NULL)
goto out_err;
tfm->__crt_alg = alg;
err = crypto_init_ops(tfm, type, mask);
if (err)
goto out_free_tfm;
if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm)))
goto cra_init_failed;
goto out;
cra_init_failed:
crypto_exit_ops(tfm);
out_free_tfm:
if (err == -EAGAIN)
crypto_shoot_alg(alg);
kfree(tfm);
out_err:
tfm = ERR_PTR(err);
out:
return tfm;
}
| 0
|
189,884
|
void PaymentHandlerWebFlowViewController::LoadProgressChanged(
content::WebContents* source,
double progress) {
DCHECK(source == web_contents());
progress_bar_->SetValue(progress);
if (progress == 1.0 && show_progress_bar_) {
show_progress_bar_ = false;
UpdateHeaderContentSeparatorView();
return;
}
if (progress < 1.0 && !show_progress_bar_) {
show_progress_bar_ = true;
UpdateHeaderContentSeparatorView();
return;
}
}
| 0
|
420,352
|
Convert an 8bit string to a base64 string */
PHP_FUNCTION(imap_binary)
{
char *text, *decode;
int text_len;
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &text, &text_len) == FAILURE) {
return;
}
decode = rfc822_binary(text, text_len, &newlength);
if (decode == NULL) {
RETURN_FALSE;
}
RETVAL_STRINGL_CHECK(decode, newlength, 1);
fs_give((void**) &decode);
| 0
|
201,544
|
void Browser::SwapTabContents(TabContentsWrapper* old_tab_contents,
TabContentsWrapper* new_tab_contents) {
int index =
tab_handler_->GetTabStripModel()->GetIndexOfTabContents(old_tab_contents);
DCHECK_NE(TabStripModel::kNoTab, index);
tab_handler_->GetTabStripModel()->ReplaceTabContentsAt(index,
new_tab_contents);
}
| 0
|
151,147
|
int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, const u8 *addr)
{
struct sta_info *sta;
int ret;
mutex_lock(&sdata->local->sta_mtx);
sta = sta_info_get(sdata, addr);
ret = __sta_info_destroy(sta);
mutex_unlock(&sdata->local->sta_mtx);
return ret;
}
| 0
|
423,020
|
static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
{
return NULL;
}
| 0
|
250,287
|
void NTPResourceCache::CreateNewTabIncognitoCSS() {
ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
DCHECK(tp);
SkColor color_background =
GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND);
std::vector<std::string> subst;
subst.push_back(
profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
subst.push_back(SkColorToRGBAString(color_background)); // $2
subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3
subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4
subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5
static const base::StringPiece new_tab_theme_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_NEW_INCOGNITO_TAB_THEME_CSS));
std::string full_css = ReplaceStringPlaceholders(
new_tab_theme_css, subst, NULL);
new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css);
}
| 0
|
432,344
|
static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi *wmi, u8 *datap, int len,
struct ath6kl_vif *vif)
{
struct wmi_tkip_micerr_event *ev;
if (len < sizeof(struct wmi_tkip_micerr_event))
return -EINVAL;
ev = (struct wmi_tkip_micerr_event *) datap;
ath6kl_tkip_micerr_event(vif, ev->key_id, ev->is_mcast);
return 0;
}
| 0
|
122,124
|
static inline int vmcs12_write_any(struct kvm_vcpu *vcpu,
unsigned long field, u64 field_value){
short offset = vmcs_field_to_offset(field);
char *p = ((char *) get_vmcs12(vcpu)) + offset;
if (offset < 0)
return offset;
switch (vmcs_field_type(field)) {
case VMCS_FIELD_TYPE_U16:
*(u16 *)p = field_value;
return 0;
case VMCS_FIELD_TYPE_U32:
*(u32 *)p = field_value;
return 0;
case VMCS_FIELD_TYPE_U64:
*(u64 *)p = field_value;
return 0;
case VMCS_FIELD_TYPE_NATURAL_WIDTH:
*(natural_width *)p = field_value;
return 0;
default:
WARN_ON(1);
return -ENOENT;
}
}
| 0
|
150,579
|
PHPAPI void
mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
{
DBG_ENTER("mysqlnd_protocol_free");
if (protocol) {
zend_bool pers = protocol->persistent;
mnd_pefree(protocol, pers);
}
DBG_VOID_RETURN;
| 0
|
227,752
|
void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const BlackBerry::Platform::String& overrideContentType, const BlackBerry::Platform::String& suggestedSaveName)
{
stopCurrentLoad();
DeferredTaskLoadManualScript::finishOrCancel(this);
String urlString(url);
if (urlString.startsWith("vs:", false)) {
urlString = urlString.substring(3);
m_mainFrame->setInViewSourceMode(true);
} else
m_mainFrame->setInViewSourceMode(false);
KURL kurl = parseUrl(urlString);
if (protocolIs(kurl, "javascript")) {
if (m_page->defersLoading())
m_deferredTasks.append(adoptPtr(new DeferredTaskLoadManualScript(this, kurl)));
else
m_mainFrame->script()->executeIfJavaScriptURL(kurl, DoNotReplaceDocumentIfJavaScriptURL);
return;
}
if (isInitial)
NetworkManager::instance()->setInitialURL(kurl);
ResourceRequest request(kurl);
request.setToken(networkToken);
if (isInitial || mustHandleInternally)
request.setMustHandleInternally(true);
request.setHTTPMethod(method);
request.setCachePolicy(toWebCoreCachePolicy(cachePolicy));
if (!overrideContentType.empty())
request.setOverrideContentType(overrideContentType);
if (data)
request.setHTTPBody(FormData::create(data, dataLength));
for (unsigned i = 0; i + 1 < headersLength; i += 2)
request.addHTTPHeaderField(headers[i], headers[i + 1]);
if (forceDownload)
request.setForceDownload(true);
request.setSuggestedSaveName(suggestedSaveName);
FrameLoadRequest frameRequest(m_mainFrame, request);
frameRequest.setFrameName("");
frameRequest.setShouldCheckNewWindowPolicy(true);
m_mainFrame->loader()->load(frameRequest);
}
| 0
|
376,075
|
static void openpic_init(Object *obj)
{
OpenPICState *opp = OPENPIC(obj);
memory_region_init(&opp->mem, obj, "openpic", 0x40000);
}
| 0
|
464,167
|
nm_utils_get_reverse_dns_domains_ip_4(guint32 addr, guint8 plen, GPtrArray *domains)
{
guint32 ip, ip2, mask;
guchar *p;
guint octets;
guint i;
gsize len0, len;
char * str, *s;
g_return_if_fail(domains);
g_return_if_fail(plen <= 32);
if (!plen)
return;
octets = (plen - 1) / 8 + 1;
ip = ntohl(addr);
mask = 0xFFFFFFFF << (32 - plen);
ip &= mask;
ip2 = ip;
len0 = NM_STRLEN("in-addr.arpa") + (4 * octets) + 1;
while ((ip2 & mask) == ip) {
addr = htonl(ip2);
p = (guchar *) &addr;
len = len0;
str = s = g_malloc(len);
for (i = octets; i > 0; i--)
nm_utils_strbuf_append(&s, &len, "%u.", p[i - 1] & 0xff);
nm_utils_strbuf_append_str(&s, &len, "in-addr.arpa");
g_ptr_array_add(domains, str);
ip2 += 1 << ((32 - plen) & ~7);
}
}
| 0
|
498,541
|
DetectPrefilterBuildNonPrefilterList(DetectEngineThreadCtx *det_ctx, SignatureMask mask, uint8_t alproto)
{
uint32_t x = 0;
for (x = 0; x < det_ctx->non_pf_store_cnt; x++) {
/* only if the mask matches this rule can possibly match,
* so build the non_mpm array only for match candidates */
const SignatureMask rule_mask = det_ctx->non_pf_store_ptr[x].mask;
const uint8_t rule_alproto = det_ctx->non_pf_store_ptr[x].alproto;
if ((rule_mask & mask) == rule_mask && (rule_alproto == 0 || rule_alproto == alproto)) { // TODO dce?
det_ctx->non_pf_id_array[det_ctx->non_pf_id_cnt++] = det_ctx->non_pf_store_ptr[x].id;
}
}
}
| 0
|
499,854
|
QPDFFormFieldObjectHelper::getQuadding()
{
int result = 0;
QPDFObjectHandle fv = getInheritableFieldValue("/Q");
if (fv.isInteger())
{
QTC::TC("qpdf", "QPDFFormFieldObjectHelper Q present");
result = QIntC::to_int(fv.getIntValue());
}
return result;
}
| 0
|
330,355
|
static int proxy_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
{
int retval;
retval = v9fs_request(s->private, T_STATFS, stbuf, "s", fs_path);
if (retval < 0) {
errno = -retval;
return -1;
}
return retval;
}
| 0
|
452,057
|
static void php_openssl_add_method_or_alias(const OBJ_NAME *name, void *arg) /* {{{ */
{
add_next_index_string((zval*)arg, (char*)name->name);
}
| 0
|
113,557
|
void video_sample_entry_del(GF_Box *s)
{
GF_MPEGVisualSampleEntryBox *ptr = (GF_MPEGVisualSampleEntryBox *)s;
if (ptr == NULL) return;
gf_isom_sample_entry_predestroy((GF_SampleEntryBox *)s);
if (ptr->esd) gf_isom_box_del((GF_Box *)ptr->esd);
if (ptr->slc) gf_odf_desc_del((GF_Descriptor *)ptr->slc);
/*for publishing*/
if (ptr->emul_esd) gf_odf_desc_del((GF_Descriptor *)ptr->emul_esd);
if (ptr->avc_config) gf_isom_box_del((GF_Box *) ptr->avc_config);
if (ptr->svc_config) gf_isom_box_del((GF_Box *) ptr->svc_config);
if (ptr->mvc_config) gf_isom_box_del((GF_Box *) ptr->mvc_config);
if (ptr->hevc_config) gf_isom_box_del((GF_Box *) ptr->hevc_config);
if (ptr->lhvc_config) gf_isom_box_del((GF_Box *) ptr->lhvc_config);
if (ptr->av1_config) gf_isom_box_del((GF_Box *)ptr->av1_config);
if (ptr->vp_config) gf_isom_box_del((GF_Box *)ptr->vp_config);
if (ptr->cfg_3gpp) gf_isom_box_del((GF_Box *)ptr->cfg_3gpp);
if (ptr->descr) gf_isom_box_del((GF_Box *) ptr->descr);
if (ptr->ipod_ext) gf_isom_box_del((GF_Box *)ptr->ipod_ext);
if (ptr->pasp) gf_isom_box_del((GF_Box *)ptr->pasp);
if (ptr->clap) gf_isom_box_del((GF_Box *)ptr->clap);
if (ptr->rinf) gf_isom_box_del((GF_Box *)ptr->rinf);
if (ptr->ccst) gf_isom_box_del((GF_Box *)ptr->ccst);
if (ptr->rvcc) gf_isom_box_del((GF_Box *)ptr->rvcc);
if (ptr->auxi) gf_isom_box_del((GF_Box *)ptr->auxi);
gf_free(ptr);
}
| 0
|
425,094
|
static void init_fstein_dither(int line)
{
;
}
| 0
|
173,862
|
void PartialMagnificationController::SwitchTargetRootWindow(
| 0
|
208,737
|
void HTMLSelectElement::defaultEventHandler(Event* event)
{
if (!renderer())
return;
if (isDisabledFormControl()) {
HTMLFormControlElementWithState::defaultEventHandler(event);
return;
}
if (usesMenuList())
menuListDefaultEventHandler(event);
else
listBoxDefaultEventHandler(event);
if (event->defaultHandled())
return;
if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
KeyboardEvent* keyboardEvent = toKeyboardEvent(event);
if (!keyboardEvent->ctrlKey() && !keyboardEvent->altKey() && !keyboardEvent->metaKey() && isPrintableChar(keyboardEvent->charCode())) {
typeAheadFind(keyboardEvent);
event->setDefaultHandled();
return;
}
}
HTMLFormControlElementWithState::defaultEventHandler(event);
}
| 0
|
365,516
|
static struct dentry *proc_task_instantiate(struct inode *dir,
struct dentry *dentry, struct task_struct *task, const void *ptr)
{
struct dentry *error = ERR_PTR(-ENOENT);
struct inode *inode;
inode = proc_pid_make_inode(dir->i_sb, task);
if (!inode)
goto out;
inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
inode->i_op = &proc_tid_base_inode_operations;
inode->i_fop = &proc_tid_base_operations;
inode->i_flags|=S_IMMUTABLE;
set_nlink(inode, 2 + pid_entry_count_dirs(tid_base_stuff,
ARRAY_SIZE(tid_base_stuff)));
d_set_d_op(dentry, &pid_dentry_operations);
d_add(dentry, inode);
/* Close the race of the process dying before we return the dentry */
if (pid_revalidate(dentry, NULL))
error = NULL;
out:
return error;
}
| 0
|
101,243
|
perf_event_exit_event(struct perf_event *child_event,
struct perf_event_context *child_ctx,
struct task_struct *child)
{
struct perf_event *parent_event = child_event->parent;
/*
* Do not destroy the 'original' grouping; because of the context
* switch optimization the original events could've ended up in a
* random child task.
*
* If we were to destroy the original group, all group related
* operations would cease to function properly after this random
* child dies.
*
* Do destroy all inherited groups, we don't care about those
* and being thorough is better.
*/
raw_spin_lock_irq(&child_ctx->lock);
WARN_ON_ONCE(child_ctx->is_active);
if (parent_event)
perf_group_detach(child_event);
list_del_event(child_event, child_ctx);
child_event->state = PERF_EVENT_STATE_EXIT; /* is_event_hup() */
raw_spin_unlock_irq(&child_ctx->lock);
/*
* Parent events are governed by their filedesc, retain them.
*/
if (!parent_event) {
perf_event_wakeup(child_event);
return;
}
/*
* Child events can be cleaned up.
*/
sync_child_event(child_event, child);
/*
* Remove this event from the parent's list
*/
WARN_ON_ONCE(parent_event->ctx->parent_ctx);
mutex_lock(&parent_event->child_mutex);
list_del_init(&child_event->child_list);
mutex_unlock(&parent_event->child_mutex);
/*
* Kick perf_poll() for is_event_hup().
*/
perf_event_wakeup(parent_event);
free_event(child_event);
put_event(parent_event);
}
| 0
|
513,109
|
void Gfx::opBeginMarkedContent(Object args[], int numArgs) {
// push a new stack entry
pushMarkedContent();
OCGs *contentConfig = catalog->getOptContentConfig();
char* name0 = args[0].getName();
if ( strncmp( name0, "OC", 2) == 0 && contentConfig) {
if ( numArgs >= 2 ) {
if (!args[1].isName()) {
error(getPos(), "Unexpected MC Type: %i", args[1].getType());
}
char* name1 = args[1].getName();
Object markedContent;
if ( res->lookupMarkedContentNF( name1, &markedContent ) ) {
if ( markedContent.isRef() ) {
bool visible = contentConfig->optContentIsVisible( &markedContent );
MarkedContentStack *mc = mcStack;
mc->ocSuppressed = !(visible);
}
} else {
error(getPos(), "DID NOT find %s", name1);
}
} else {
error(getPos(), "insufficient arguments for Marked Content");
}
}
if (printCommands) {
printf(" marked content: %s ", args[0].getName());
if (numArgs == 2)
args[1].print(stdout);
printf("\n");
fflush(stdout);
}
if(numArgs == 2 && args[1].isDict ()) {
out->beginMarkedContent(args[0].getName(),args[1].getDict());
} else if(numArgs == 1) {
out->beginMarkedContent(args[0].getName(),NULL);
}
}
| 0
|
253,075
|
int Parcel::readParcelFileDescriptor(int& outCommChannel) const {
int fd;
outCommChannel = -1;
if (readInt32() == 0) {
fd = -1;
} else {
fd = readFileDescriptor();
if (fd >= 0 && readInt32() != 0) {
outCommChannel = readFileDescriptor();
}
}
return fd;
}
| 0
|
23,677
|
static inline char * w_newword ( size_t * actlen , size_t * maxlen ) {
* actlen = * maxlen = 0 ;
return NULL ;
}
| 0
|
144,330
|
static void __hrtick_start(void *arg)
{
struct rq *rq = arg;
raw_spin_lock(&rq->lock);
hrtimer_restart(&rq->hrtick_timer);
rq->hrtick_csd_pending = 0;
raw_spin_unlock(&rq->lock);
}
| 0
|
86,140
|
generate_code(mrb_state *mrb, parser_state *p, int val)
{
codegen_scope *scope = scope_new(mrb, 0, 0);
struct mrb_jmpbuf *prev_jmp = mrb->jmp;
struct mrb_jmpbuf jmpbuf;
struct RProc *proc;
mrb->jmp = &jmpbuf;
scope->mrb = mrb;
scope->parser = p;
scope->filename_sym = p->filename_sym;
scope->filename_index = p->current_filename_index;
MRB_TRY(mrb->jmp) {
/* prepare irep */
codegen(scope, p->tree, val);
proc = mrb_proc_new(mrb, scope->irep);
mrb_irep_decref(mrb, scope->irep);
mrb_pool_close(scope->mpool);
proc->c = NULL;
if (mrb->c->cibase && mrb->c->cibase->proc == proc->upper) {
proc->upper = NULL;
}
mrb->jmp = prev_jmp;
return proc;
}
MRB_CATCH(mrb->jmp) {
mrb_irep_decref(mrb, scope->irep);
mrb_pool_close(scope->mpool);
mrb->jmp = prev_jmp;
return NULL;
}
MRB_END_EXC(mrb->jmp);
}
| 0
|
67,690
|
static void persistent_dtr(struct dm_exception_store *store)
{
struct pstore *ps = get_info(store);
destroy_workqueue(ps->metadata_wq);
/* Created in read_header */
if (ps->io_client)
dm_io_client_destroy(ps->io_client);
free_area(ps);
/* Allocated in persistent_read_metadata */
if (ps->callbacks)
vfree(ps->callbacks);
kfree(ps);
}
| 0
|
21,673
|
static bool fpop_ip_dp_needed ( void * opaque ) {
X86CPU * cpu = opaque ;
CPUX86State * env = & cpu -> env ;
return env -> fpop != 0 || env -> fpip != 0 || env -> fpdp != 0 ;
}
| 0
|
99,788
|
int key_update(key_ref_t key_ref, const void *payload, size_t plen)
{
struct key_preparsed_payload prep;
struct key *key = key_ref_to_ptr(key_ref);
int ret;
key_check(key);
/* the key must be writable */
ret = key_permission(key_ref, KEY_NEED_WRITE);
if (ret < 0)
return ret;
/* attempt to update it if supported */
if (!key->type->update)
return -EOPNOTSUPP;
memset(&prep, 0, sizeof(prep));
prep.data = payload;
prep.datalen = plen;
prep.quotalen = key->type->def_datalen;
prep.expiry = TIME_T_MAX;
if (key->type->preparse) {
ret = key->type->preparse(&prep);
if (ret < 0)
goto error;
}
down_write(&key->sem);
ret = key->type->update(key, &prep);
if (ret == 0)
/* Updating a negative key positively instantiates it */
mark_key_instantiated(key, 0);
up_write(&key->sem);
error:
if (key->type->preparse)
key->type->free_preparse(&prep);
return ret;
}
| 0
|
229,785
|
void RenderFrameHostManager::OnDidStartLoading() {
for (const auto& pair : proxy_hosts_) {
pair.second->Send(
new FrameMsg_DidStartLoading(pair.second->GetRoutingID()));
}
}
| 0
|
995
|
static int truemotion1_decode_header ( TrueMotion1Context * s ) {
int i , ret ;
int width_shift = 0 ;
int new_pix_fmt ;
struct frame_header header ;
uint8_t header_buffer [ 128 ] = {
0 }
;
const uint8_t * sel_vector_table ;
header . header_size = ( ( s -> buf [ 0 ] >> 5 ) | ( s -> buf [ 0 ] << 3 ) ) & 0x7f ;
if ( s -> buf [ 0 ] < 0x10 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid header size (%d)\n" , s -> buf [ 0 ] ) ;
return AVERROR_INVALIDDATA ;
}
for ( i = 1 ;
i < header . header_size ;
i ++ ) header_buffer [ i - 1 ] = s -> buf [ i ] ^ s -> buf [ i + 1 ] ;
header . compression = header_buffer [ 0 ] ;
header . deltaset = header_buffer [ 1 ] ;
header . vectable = header_buffer [ 2 ] ;
header . ysize = AV_RL16 ( & header_buffer [ 3 ] ) ;
header . xsize = AV_RL16 ( & header_buffer [ 5 ] ) ;
header . checksum = AV_RL16 ( & header_buffer [ 7 ] ) ;
header . version = header_buffer [ 9 ] ;
header . header_type = header_buffer [ 10 ] ;
header . flags = header_buffer [ 11 ] ;
header . control = header_buffer [ 12 ] ;
if ( header . version >= 2 ) {
if ( header . header_type > 3 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid header type (%d)\n" , header . header_type ) ;
return AVERROR_INVALIDDATA ;
}
else if ( ( header . header_type == 2 ) || ( header . header_type == 3 ) ) {
s -> flags = header . flags ;
if ( ! ( s -> flags & FLAG_INTERFRAME ) ) s -> flags |= FLAG_KEYFRAME ;
}
else s -> flags = FLAG_KEYFRAME ;
}
else s -> flags = FLAG_KEYFRAME ;
if ( s -> flags & FLAG_SPRITE ) {
av_log_ask_for_sample ( s -> avctx , "SPRITE frame found.\n" ) ;
return AVERROR_PATCHWELCOME ;
}
else {
s -> w = header . xsize ;
s -> h = header . ysize ;
if ( header . header_type < 2 ) {
if ( ( s -> w < 213 ) && ( s -> h >= 176 ) ) {
s -> flags |= FLAG_INTERPOLATED ;
av_log_ask_for_sample ( s -> avctx , "INTERPOLATION selected.\n" ) ;
}
}
}
if ( header . compression >= 17 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid compression type (%d)\n" , header . compression ) ;
return AVERROR_INVALIDDATA ;
}
if ( ( header . deltaset != s -> last_deltaset ) || ( header . vectable != s -> last_vectable ) ) select_delta_tables ( s , header . deltaset ) ;
if ( ( header . compression & 1 ) && header . header_type ) sel_vector_table = pc_tbl2 ;
else {
if ( header . vectable > 0 && header . vectable < 4 ) sel_vector_table = tables [ header . vectable - 1 ] ;
else {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid vector table id (%d)\n" , header . vectable ) ;
return AVERROR_INVALIDDATA ;
}
}
if ( compression_types [ header . compression ] . algorithm == ALGO_RGB24H ) {
new_pix_fmt = AV_PIX_FMT_RGB32 ;
width_shift = 1 ;
}
else new_pix_fmt = AV_PIX_FMT_RGB555 ;
s -> w >>= width_shift ;
if ( ( ret = av_image_check_size ( s -> w , s -> h , 0 , s -> avctx ) ) < 0 ) return ret ;
if ( s -> w != s -> avctx -> width || s -> h != s -> avctx -> height || new_pix_fmt != s -> avctx -> pix_fmt ) {
if ( s -> frame . data [ 0 ] ) s -> avctx -> release_buffer ( s -> avctx , & s -> frame ) ;
s -> avctx -> sample_aspect_ratio = ( AVRational ) {
1 << width_shift , 1 }
;
s -> avctx -> pix_fmt = new_pix_fmt ;
avcodec_set_dimensions ( s -> avctx , s -> w , s -> h ) ;
av_fast_malloc ( & s -> vert_pred , & s -> vert_pred_size , s -> avctx -> width * sizeof ( unsigned int ) ) ;
}
s -> mb_change_bits_row_size = ( ( s -> avctx -> width >> ( 2 - width_shift ) ) + 7 ) >> 3 ;
if ( ( header . deltaset != s -> last_deltaset ) || ( header . vectable != s -> last_vectable ) ) {
if ( compression_types [ header . compression ] . algorithm == ALGO_RGB24H ) gen_vector_table24 ( s , sel_vector_table ) ;
else if ( s -> avctx -> pix_fmt == AV_PIX_FMT_RGB555 ) gen_vector_table15 ( s , sel_vector_table ) ;
else gen_vector_table16 ( s , sel_vector_table ) ;
}
s -> mb_change_bits = s -> buf + header . header_size ;
if ( s -> flags & FLAG_KEYFRAME ) {
s -> index_stream = s -> mb_change_bits ;
}
else {
s -> index_stream = s -> mb_change_bits + ( s -> mb_change_bits_row_size * ( s -> avctx -> height >> 2 ) ) ;
}
s -> index_stream_size = s -> size - ( s -> index_stream - s -> buf ) ;
s -> last_deltaset = header . deltaset ;
s -> last_vectable = header . vectable ;
s -> compression = header . compression ;
s -> block_width = compression_types [ header . compression ] . block_width ;
s -> block_height = compression_types [ header . compression ] . block_height ;
s -> block_type = compression_types [ header . compression ] . block_type ;
if ( s -> avctx -> debug & FF_DEBUG_PICT_INFO ) av_log ( s -> avctx , AV_LOG_INFO , "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n" , s -> last_deltaset , s -> last_vectable , s -> compression , s -> block_width , s -> block_height , s -> block_type , s -> flags & FLAG_KEYFRAME ? " KEY" : "" , s -> flags & FLAG_INTERFRAME ? " INTER" : "" , s -> flags & FLAG_SPRITE ? " SPRITE" : "" , s -> flags & FLAG_INTERPOLATED ? " INTERPOL" : "" ) ;
return header . header_size ;
}
| 1
|
237,559
|
static inline ssize_t RandomY(RandomInfo *random_info,const size_t rows)
{
return((ssize_t) (rows*GetPseudoRandomValue(random_info)));
}
| 0
|
305,349
|
static void net_tx_action(struct softirq_action *h)
{
struct softnet_data *sd = this_cpu_ptr(&softnet_data);
if (sd->completion_queue) {
struct sk_buff *clist;
local_irq_disable();
clist = sd->completion_queue;
sd->completion_queue = NULL;
local_irq_enable();
while (clist) {
struct sk_buff *skb = clist;
clist = clist->next;
WARN_ON(atomic_read(&skb->users));
if (likely(get_kfree_skb_cb(skb)->reason == SKB_REASON_CONSUMED))
trace_consume_skb(skb);
else
trace_kfree_skb(skb, net_tx_action);
if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
__kfree_skb(skb);
else
__kfree_skb_defer(skb);
}
__kfree_skb_flush();
}
if (sd->output_queue) {
struct Qdisc *head;
local_irq_disable();
head = sd->output_queue;
sd->output_queue = NULL;
sd->output_queue_tailp = &sd->output_queue;
local_irq_enable();
while (head) {
struct Qdisc *q = head;
spinlock_t *root_lock;
head = head->next_sched;
root_lock = qdisc_lock(q);
if (spin_trylock(root_lock)) {
smp_mb__before_atomic();
clear_bit(__QDISC_STATE_SCHED,
&q->state);
qdisc_run(q);
spin_unlock(root_lock);
} else {
if (!test_bit(__QDISC_STATE_DEACTIVATED,
&q->state)) {
__netif_reschedule(q);
} else {
smp_mb__before_atomic();
clear_bit(__QDISC_STATE_SCHED,
&q->state);
}
}
}
}
| 0
|
398,868
|
gst_date_time_get_minute (const GstDateTime * datetime)
{
g_return_val_if_fail (datetime != NULL, 0);
g_return_val_if_fail (gst_date_time_has_time (datetime), 0);
return g_date_time_get_minute (datetime->datetime);
}
| 0
|
227,047
|
unsigned ImageInputType::height() const
{
RefPtrWillBeRawPtr<HTMLInputElement> element(this->element());
if (!element->layoutObject()) {
unsigned height;
if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), height))
return height;
HTMLImageLoader* imageLoader = element->imageLoader();
if (imageLoader && imageLoader->image())
return imageLoader->image()->imageSize(LayoutObject::shouldRespectImageOrientation(nullptr), 1).height();
}
element->document().updateLayout();
LayoutBox* box = element->layoutBox();
return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
}
| 0
|
174,361
|
void RenderWidget::set_next_paint_is_repaint_ack() {
next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK;
}
| 0
|
496,453
|
OperatorShellMake(const char *operatorName,
Oid operatorNamespace,
Oid leftTypeId,
Oid rightTypeId)
{
Relation pg_operator_desc;
Oid operatorObjectId;
int i;
HeapTuple tup;
Datum values[Natts_pg_operator];
bool nulls[Natts_pg_operator];
NameData oname;
TupleDesc tupDesc;
/*
* validate operator name
*/
if (!validOperatorName(operatorName))
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("\"%s\" is not a valid operator name",
operatorName)));
/*
* open pg_operator
*/
pg_operator_desc = table_open(OperatorRelationId, RowExclusiveLock);
tupDesc = pg_operator_desc->rd_att;
/*
* initialize our *nulls and *values arrays
*/
for (i = 0; i < Natts_pg_operator; ++i)
{
nulls[i] = false;
values[i] = (Datum) NULL; /* redundant, but safe */
}
/*
* initialize values[] with the operator name and input data types. Note
* that oprcode is set to InvalidOid, indicating it's a shell.
*/
operatorObjectId = GetNewOidWithIndex(pg_operator_desc, OperatorOidIndexId,
Anum_pg_operator_oid);
values[Anum_pg_operator_oid - 1] = ObjectIdGetDatum(operatorObjectId);
namestrcpy(&oname, operatorName);
values[Anum_pg_operator_oprname - 1] = NameGetDatum(&oname);
values[Anum_pg_operator_oprnamespace - 1] = ObjectIdGetDatum(operatorNamespace);
values[Anum_pg_operator_oprowner - 1] = ObjectIdGetDatum(GetUserId());
values[Anum_pg_operator_oprkind - 1] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l');
values[Anum_pg_operator_oprcanmerge - 1] = BoolGetDatum(false);
values[Anum_pg_operator_oprcanhash - 1] = BoolGetDatum(false);
values[Anum_pg_operator_oprleft - 1] = ObjectIdGetDatum(leftTypeId);
values[Anum_pg_operator_oprright - 1] = ObjectIdGetDatum(rightTypeId);
values[Anum_pg_operator_oprresult - 1] = ObjectIdGetDatum(InvalidOid);
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(InvalidOid);
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(InvalidOid);
values[Anum_pg_operator_oprcode - 1] = ObjectIdGetDatum(InvalidOid);
values[Anum_pg_operator_oprrest - 1] = ObjectIdGetDatum(InvalidOid);
values[Anum_pg_operator_oprjoin - 1] = ObjectIdGetDatum(InvalidOid);
/*
* create a new operator tuple
*/
tup = heap_form_tuple(tupDesc, values, nulls);
/*
* insert our "shell" operator tuple
*/
CatalogTupleInsert(pg_operator_desc, tup);
/* Add dependencies for the entry */
makeOperatorDependencies(tup, false);
heap_freetuple(tup);
/* Post creation hook for new shell operator */
InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
/*
* Make sure the tuple is visible for subsequent lookups/updates.
*/
CommandCounterIncrement();
/*
* close the operator relation and return the oid.
*/
table_close(pg_operator_desc, RowExclusiveLock);
return operatorObjectId;
}
| 0
|
224,422
|
quint64 QQuickWebViewPrivate::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage)
{
Q_Q(QQuickWebView);
QtDialogRunner dialogRunner(q);
if (!dialogRunner.initForDatabaseQuotaDialog(databaseName, displayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage))
return 0;
dialogRunner.run();
return dialogRunner.wasAccepted() ? dialogRunner.databaseQuota() : 0;
}
| 0
|
42,499
|
*/
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name)
{
struct charset_info_st *cs;
const char *save_csdir= charsets_dir;
if (mysql->options.charset_dir)
charsets_dir= mysql->options.charset_dir;
if (!mysql->net.vio)
{
/* Initialize with automatic OS character set detection. */
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, cs_name);
mysql_init_character_set(mysql);
/*
In case of automatic OS character set detection
mysql_init_character_set changes mysql->options.charset_name
from "auto" to the real character set name.
Reset cs_name to the detected character set name, accordingly.
*/
cs_name= mysql->options.charset_name;
}
if (strlen(cs_name) < MY_CS_NAME_SIZE &&
(cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))))
{
char buff[MY_CS_NAME_SIZE + 10];
charsets_dir= save_csdir;
if (!mysql->net.vio)
{
/* If there is no connection yet we don't send "SET NAMES" query */
mysql->charset= cs;
return 0;
}
/* Skip execution of "SET NAMES" for pre-4.1 servers */
if (mysql_get_server_version(mysql) < 40100)
return 0;
sprintf(buff, "SET NAMES %s", cs_name);
if (!mysql_real_query(mysql, buff, (uint) strlen(buff)))
{
mysql->charset= cs;
}
}
else
{
char cs_dir_name[FN_REFLEN];
get_charsets_dir(cs_dir_name);
set_mysql_extended_error(mysql, CR_CANT_READ_CHARSET, unknown_sqlstate,
ER(CR_CANT_READ_CHARSET), cs_name, cs_dir_name);
}
charsets_dir= save_csdir;
return mysql->net.last_errno;
| 0
|
500,619
|
QPDF_BOOL qpdf_is_linearized(qpdf_data qpdf)
{
QTC::TC("qpdf", "qpdf-c called qpdf_is_linearized");
return (qpdf->qpdf->isLinearized() ? QPDF_TRUE : QPDF_FALSE);
}
| 0
|
85,289
|
static stb_vorbis * vorbis_alloc(stb_vorbis *f)
{
stb_vorbis *p = (stb_vorbis *) setup_malloc(f, sizeof(*p));
return p;
}
| 0
|
521,426
|
create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
{
TABLE *table;
SQL_SELECT *select;
bool quick_created= FALSE;
SORT_INFO *file_sort= 0;
DBUG_ENTER("create_sort_index");
if (fsort == NULL)
fsort= tab->filesort;
table= tab->table;
select= fsort->select;
table->status=0; // May be wrong if quick_select
if (!tab->preread_init_done && tab->preread_init())
goto err;
// If table has a range, move it to select
if (select && tab->ref.key >= 0)
{
if (!select->quick)
{
if (tab->quick)
{
select->quick= tab->quick;
tab->quick= NULL;
/*
We can only use 'Only index' if quick key is same as ref_key
and in index_merge 'Only index' cannot be used
*/
if (((uint) tab->ref.key != select->quick->index))
table->file->ha_end_keyread();
}
else
{
/*
We have a ref on a const; Change this to a range that filesort
can use.
For impossible ranges (like when doing a lookup on NULL on a NOT NULL
field, quick will contain an empty record set.
*/
if (!(select->quick= (tab->type == JT_FT ?
get_ft_select(thd, table, tab->ref.key) :
get_quick_select_for_ref(thd, table, &tab->ref,
tab->found_records))))
goto err;
quick_created= TRUE;
}
fsort->own_select= true;
}
else
{
DBUG_ASSERT(tab->type == JT_REF || tab->type == JT_EQ_REF);
// Update ref value
if ((cp_buffer_from_ref(thd, table, &tab->ref) && thd->is_fatal_error))
goto err; // out of memory
}
}
/* Fill schema tables with data before filesort if it's necessary */
if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX))
goto err;
if (table->s->tmp_table)
table->file->info(HA_STATUS_VARIABLE); // Get record count
file_sort= filesort(thd, table, fsort, fsort->tracker, join, tab->table->map);
DBUG_ASSERT(tab->filesort_result == 0);
tab->filesort_result= file_sort;
tab->records= 0;
if (file_sort)
{
tab->records= join->select_options & OPTION_FOUND_ROWS ?
file_sort->found_rows : file_sort->return_rows;
tab->join->join_examined_rows+= file_sort->examined_rows;
}
if (quick_created)
{
/* This will delete the quick select. */
select->cleanup();
}
table->file->ha_end_keyread();
if (tab->type == JT_FT)
table->file->ft_end();
else
table->file->ha_index_or_rnd_end();
DBUG_RETURN(file_sort == 0);
err:
DBUG_RETURN(-1);
}
| 0
|
216,089
|
bool TabStripModel::WillContextMenuPin(int index) {
std::vector<int> indices = GetIndicesForCommand(index);
bool all_pinned = true;
for (size_t i = 0; i < indices.size() && all_pinned; ++i) {
if (!IsAppTab(index)) // We never change app tabs.
all_pinned = IsTabPinned(indices[i]);
}
return !all_pinned;
}
| 0
|
229,468
|
GfxIndexedColorSpace::GfxIndexedColorSpace(GfxColorSpace *baseA,
int indexHighA) {
base = baseA;
indexHigh = indexHighA;
lookup = (Guchar *)gmallocn((indexHigh + 1) * base->getNComps(),
sizeof(Guchar));
}
| 0
|
313,813
|
tar_sparse_fixup_header (struct tar_sparse_file *file)
{
if (file->optab->fixup_header)
return file->optab->fixup_header (file);
return true;
}
| 0
|
322,281
|
int avio_read(AVIOContext *s, unsigned char *buf, int size)
{
int len, size1;
size1 = size;
while (size > 0) {
len = FFMIN(s->buf_end - s->buf_ptr, size);
if (len == 0 || s->write_flag) {
if((s->direct || size > s->buffer_size) && !s->update_checksum) {
// bypass the buffer and read data directly into buf
if(s->read_packet)
len = s->read_packet(s->opaque, buf, size);
else
len = AVERROR_EOF;
if (len == AVERROR_EOF) {
/* do not modify buffer if EOF reached so that a seek back can
be done without rereading data */
s->eof_reached = 1;
break;
} else if (len < 0) {
s->eof_reached = 1;
s->error= len;
break;
} else {
s->pos += len;
s->bytes_read += len;
size -= len;
buf += len;
// reset the buffer
s->buf_ptr = s->buffer;
s->buf_end = s->buffer/* + len*/;
}
} else {
fill_buffer(s);
len = s->buf_end - s->buf_ptr;
if (len == 0)
break;
}
} else {
memcpy(buf, s->buf_ptr, len);
buf += len;
s->buf_ptr += len;
size -= len;
}
}
if (size1 == size) {
if (s->error) return s->error;
if (avio_feof(s)) return AVERROR_EOF;
}
return size1 - size;
}
| 0
|
207,395
|
void LayoutBlockFlow::layoutBlockChild(LayoutBox& child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom)
{
LayoutBlockFlow* childLayoutBlockFlow = child.isLayoutBlockFlow() ? toLayoutBlockFlow(&child) : nullptr;
LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore();
child.computeAndSetBlockDirectionMargins(this);
LayoutUnit estimateWithoutPagination;
LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo, estimateWithoutPagination);
LayoutRect oldRect = child.frameRect();
bool childNeededLayout = positionAndLayoutOnceIfNeeded(child, logicalTopEstimate, previousFloatLogicalBottom);
bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
bool childIsSelfCollapsing = child.isSelfCollapsingBlock();
bool childDiscardMarginBefore = mustDiscardMarginBeforeForChild(child);
bool childDiscardMarginAfter = mustDiscardMarginAfterForChild(child);
LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo, childIsSelfCollapsing, childDiscardMarginBefore, childDiscardMarginAfter);
bool childDiscardMargin = childDiscardMarginBefore || childDiscardMarginAfter;
LayoutUnit newLogicalTop = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear, childIsSelfCollapsing, childDiscardMargin);
bool paginated = view()->layoutState()->isPaginated();
if (paginated) {
if (estimateWithoutPagination != newLogicalTop) {
positionAndLayoutOnceIfNeeded(child, newLogicalTop, previousFloatLogicalBottom);
}
newLogicalTop = adjustBlockChildForPagination(newLogicalTop, child, atBeforeSideOfBlock && logicalTopBeforeClear == newLogicalTop);
}
if (newLogicalTop != logicalTopEstimate
|| child.needsLayout()
|| (paginated && childLayoutBlockFlow && childLayoutBlockFlow->shouldBreakAtLineToAvoidWidow())) {
positionAndLayoutOnceIfNeeded(child, newLogicalTop, previousFloatLogicalBottom);
}
if (!marginInfo.canCollapseMarginAfterWithLastChild() && !childIsSelfCollapsing)
marginInfo.setCanCollapseMarginAfterWithLastChild(true);
if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing)
marginInfo.setAtBeforeSideOfBlock(false);
determineLogicalLeftPositionForChild(child);
LayoutSize childOffset = child.location() - oldRect.location();
setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
if (mustSeparateMarginAfterForChild(child)) {
setLogicalHeight(logicalHeight() + marginAfterForChild(child));
marginInfo.clearMargin();
}
if (childLayoutBlockFlow)
addOverhangingFloats(childLayoutBlockFlow, !childNeededLayout);
if (!selfNeedsLayout() && (childOffset.width() || childOffset.height()))
child.invalidatePaintForOverhangingFloats(true);
if (paginated) {
LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInfo);
if (newHeight != size().height())
setLogicalHeight(newHeight);
}
if (child.isLayoutMultiColumnSpannerPlaceholder()) {
positionSpannerDescendant(toLayoutMultiColumnSpannerPlaceholder(child));
}
}
| 0
|
438,670
|
static void __execlists_submission_tasklet(struct intel_engine_cs *const engine)
{
lockdep_assert_held(&engine->active.lock);
if (!engine->execlists.pending[0]) {
rcu_read_lock(); /* protect peeking at execlists->active */
execlists_dequeue(engine);
rcu_read_unlock();
}
}
| 0
|
48,034
|
void HttpFile::setFileName(const std::string &fileName)
{
implPtr_->setFileName(fileName);
}
| 0
|
244,687
|
void RootWindow::ScheduleDraw() {
if (compositor_lock_) {
draw_on_compositor_unlock_ = true;
} else if (!defer_draw_scheduling_) {
defer_draw_scheduling_ = true;
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()));
}
}
| 0
|
497,389
|
static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan)
{
struct sock *sk, *parent = chan->data;
lock_sock(parent);
/* Check for backlog size */
if (sk_acceptq_is_full(parent)) {
BT_DBG("backlog full %d", parent->sk_ack_backlog);
release_sock(parent);
return NULL;
}
sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP,
GFP_ATOMIC, 0);
if (!sk) {
release_sock(parent);
return NULL;
}
bt_sock_reclassify_lock(sk, BTPROTO_L2CAP);
l2cap_sock_init(sk, parent);
bt_accept_enqueue(parent, sk, false);
release_sock(parent);
return l2cap_pi(sk)->chan;
}
| 0
|
282,748
|
viz::FrameSinkId CompositorImpl::GetFrameSinkId() {
return frame_sink_id_;
}
| 0
|
83,166
|
static int debugfs_apply_options(struct super_block *sb)
{
struct debugfs_fs_info *fsi = sb->s_fs_info;
struct inode *inode = d_inode(sb->s_root);
struct debugfs_mount_opts *opts = &fsi->mount_opts;
inode->i_mode &= ~S_IALLUGO;
inode->i_mode |= opts->mode;
inode->i_uid = opts->uid;
inode->i_gid = opts->gid;
return 0;
}
| 0
|
42,638
|
static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name) {
// Basic ZIP archive filename validity checks: Valid filenames cannot start
// with a forward slash, cannot contain a drive letter, and cannot use
// DOS-style backward slashes.
if (*pArchive_name == '/') return MZ_FALSE;
while (*pArchive_name) {
if ((*pArchive_name == '\\') || (*pArchive_name == ':')) return MZ_FALSE;
pArchive_name++;
}
return MZ_TRUE;
}
| 0
|
76,988
|
static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long) (thd->query_start() - server_start_time);
return 0;
}
| 0
|
29,715
|
static int com_pager ( String * buffer __attribute__ ( ( unused ) ) , char * line __attribute__ ( ( unused ) ) ) {
char pager_name [ FN_REFLEN ] , * end , * param ;
if ( status . batch ) return 0 ;
while ( my_isspace ( charset_info , * line ) ) line ++ ;
param = strchr ( line , ' ' ) ;
while ( param && my_isspace ( charset_info , * param ) ) param ++ ;
if ( ! param || ! strlen ( param ) ) {
if ( ! default_pager_set ) {
tee_fprintf ( stdout , "Default pager wasn't set, using stdout.\n" ) ;
opt_nopager = 1 ;
strmov ( pager , "stdout" ) ;
PAGER = stdout ;
return 0 ;
}
strmov ( pager , default_pager ) ;
}
else {
end = strmake_buf ( pager_name , param ) ;
while ( end > pager_name && ( my_isspace ( charset_info , end [ - 1 ] ) || my_iscntrl ( charset_info , end [ - 1 ] ) ) ) end -- ;
end [ 0 ] = 0 ;
strmov ( pager , pager_name ) ;
strmov ( default_pager , pager_name ) ;
}
opt_nopager = 0 ;
tee_fprintf ( stdout , "PAGER set to '%s'\n" , pager ) ;
return 0 ;
}
| 0
|
426,337
|
DnD_CPNameListToDynBufArray(char *fileList, // IN: CPName format
size_t listSize, // IN
DynBufArray *dynBufArray) // OUT
{
DynBuf buf;
BufRead r;
int32 pathLen;
size_t count;
size_t i;
ASSERT(fileList);
r.pos = fileList;
r.unreadLen = listSize;
DynBufArray_Init(dynBufArray, 0);
while (r.unreadLen > 0) {
DynBuf_Init(&buf);
if (!DnDReadBuffer(&r, &pathLen, sizeof pathLen) ||
(pathLen > r.unreadLen) ||
!DynBuf_Append(&buf, r.pos, pathLen)) {
goto error;
}
if (!DnDSlideBuffer(&r, pathLen)) {
goto error;
}
if (!DynBufArray_Push(dynBufArray, buf)) {
goto error;
}
}
return TRUE;
error:
DynBuf_Destroy(&buf);
count = DynBufArray_Count(dynBufArray);
for (i = 0; i < count; i++) {
DynBuf *b = DynArray_AddressOf(dynBufArray, i);
DynBuf_Destroy(b);
}
DynBufArray_SetCount(dynBufArray, 0);
DynBufArray_Destroy(dynBufArray);
return FALSE;
}
| 0
|
26,938
|
static int proc_setintf ( struct usb_dev_state * ps , void __user * arg ) {
struct usbdevfs_setinterface setintf ;
int ret ;
if ( copy_from_user ( & setintf , arg , sizeof ( setintf ) ) ) return - EFAULT ;
ret = checkintf ( ps , setintf . interface ) ;
if ( ret ) return ret ;
destroy_async_on_interface ( ps , setintf . interface ) ;
return usb_set_interface ( ps -> dev , setintf . interface , setintf . altsetting ) ;
}
| 0
|
305,766
|
int jpc_ppxstab_grow(jpc_ppxstab_t *tab, int maxents)
{
jpc_ppxstabent_t **newents;
if (tab->maxents < maxents) {
newents = (tab->ents) ? jas_realloc2(tab->ents, maxents,
sizeof(jpc_ppxstabent_t *)) : jas_alloc2(maxents, sizeof(jpc_ppxstabent_t *));
if (!newents) {
return -1;
}
tab->ents = newents;
tab->maxents = maxents;
}
return 0;
}
| 0
|
7,623
|
static void nsc_decode(NSC_CONTEXT* context)
{
UINT16 x;
UINT16 y;
UINT16 rw = ROUND_UP_TO(context->width, 8);
BYTE shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */
BYTE* bmpdata = context->BitmapData;
for (y = 0; y < context->height; y++)
{
const BYTE* yplane;
const BYTE* coplane;
const BYTE* cgplane;
const BYTE* aplane = context->priv->PlaneBuffers[3] + y * context->width; /* A */
if (context->ChromaSubsamplingLevel)
{
yplane = context->priv->PlaneBuffers[0] + y * rw; /* Y */
coplane = context->priv->PlaneBuffers[1] + (y >> 1) * (rw >>
1); /* Co, supersampled */
cgplane = context->priv->PlaneBuffers[2] + (y >> 1) * (rw >>
1); /* Cg, supersampled */
}
else
{
yplane = context->priv->PlaneBuffers[0] + y * context->width; /* Y */
coplane = context->priv->PlaneBuffers[1] + y * context->width; /* Co */
cgplane = context->priv->PlaneBuffers[2] + y * context->width; /* Cg */
}
for (x = 0; x < context->width; x++)
{
INT16 y_val = (INT16) * yplane;
INT16 co_val = (INT16)(INT8)(*coplane << shift);
INT16 cg_val = (INT16)(INT8)(*cgplane << shift);
INT16 r_val = y_val + co_val - cg_val;
INT16 g_val = y_val + cg_val;
INT16 b_val = y_val - co_val - cg_val;
*bmpdata++ = MINMAX(b_val, 0, 0xFF);
*bmpdata++ = MINMAX(g_val, 0, 0xFF);
*bmpdata++ = MINMAX(r_val, 0, 0xFF);
*bmpdata++ = *aplane;
yplane++;
coplane += (context->ChromaSubsamplingLevel ? x % 2 : 1);
cgplane += (context->ChromaSubsamplingLevel ? x % 2 : 1);
aplane++;
}
}
}
| 1
|
55,272
|
file_ff_differs(buf_T *buf, int ignore_empty)
{
/* In a buffer that was never loaded the options are not valid. */
if (buf->b_flags & BF_NEVERLOADED)
return FALSE;
if (ignore_empty
&& (buf->b_flags & BF_NEW)
&& buf->b_ml.ml_line_count == 1
&& *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
return FALSE;
if (buf->b_start_ffc != *buf->b_p_ff)
return TRUE;
if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
return TRUE;
#ifdef FEAT_MBYTE
if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
return TRUE;
if (buf->b_start_fenc == NULL)
return (*buf->b_p_fenc != NUL);
return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
#else
return FALSE;
#endif
}
| 0
|
244,946
|
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->methodReturningSequence(intArg));
return JSValue::encode(result);
}
| 0
|
7,307
|
TfLiteStatus UseDynamicOutputTensors(TfLiteContext* context, TfLiteNode* node) {
for (int i = 0; i < NumOutputs(node); ++i) {
SetTensorToDynamic(GetOutput(context, node, i));
}
return kTfLiteOk;
}
| 1
|
491,992
|
void chargeErrorStats(const int result) { decompressor_.chargeErrorStats(result); }
| 0
|
17,160
|
int test_setup ( void ) {
static int x = 0 ;
x ++ ;
snprintf_func ( TEST_TARGET_FILE , TESTFILESIZE , "/tmp/xdtest.target.%d" , x ) ;
snprintf_func ( TEST_SOURCE_FILE , TESTFILESIZE , "/tmp/xdtest.source.%d" , x ) ;
snprintf_func ( TEST_DELTA_FILE , TESTFILESIZE , "/tmp/xdtest.delta.%d" , x ) ;
snprintf_func ( TEST_RECON_FILE , TESTFILESIZE , "/tmp/xdtest.recon.%d" , x ) ;
snprintf_func ( TEST_RECON2_FILE , TESTFILESIZE , "/tmp/xdtest.recon2.%d" , x ) ;
snprintf_func ( TEST_COPY_FILE , TESTFILESIZE , "/tmp/xdtest.copy.%d" , x ) ;
snprintf_func ( TEST_NOPERM_FILE , TESTFILESIZE , "/tmp/xdtest.noperm.%d" , x ) ;
test_cleanup ( ) ;
return 0 ;
}
| 0
|
278,623
|
BarProp* LocalDOMWindow::menubar() const {
if (!menubar_)
menubar_ = BarProp::Create(GetFrame(), BarProp::kMenubar);
return menubar_.Get();
}
| 0
|
279,479
|
attrhash_cmp (const void *p1, const void *p2)
{
const struct attr * attr1 = p1;
const struct attr * attr2 = p2;
if (attr1->flag == attr2->flag
&& attr1->origin == attr2->origin
&& attr1->nexthop.s_addr == attr2->nexthop.s_addr
&& attr1->aspath == attr2->aspath
&& attr1->community == attr2->community
&& attr1->med == attr2->med
&& attr1->local_pref == attr2->local_pref)
{
const struct attr_extra *ae1 = attr1->extra;
const struct attr_extra *ae2 = attr2->extra;
if (ae1 && ae2
&& ae1->aggregator_as == ae2->aggregator_as
&& ae1->aggregator_addr.s_addr == ae2->aggregator_addr.s_addr
&& ae1->weight == ae2->weight
#ifdef HAVE_IPV6
&& ae1->mp_nexthop_len == ae2->mp_nexthop_len
&& IPV6_ADDR_SAME (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global)
&& IPV6_ADDR_SAME (&ae1->mp_nexthop_local, &ae2->mp_nexthop_local)
#endif /* HAVE_IPV6 */
&& IPV4_ADDR_SAME (&ae1->mp_nexthop_global_in, &ae2->mp_nexthop_global_in)
&& ae1->ecommunity == ae2->ecommunity
&& ae1->cluster == ae2->cluster
&& ae1->transit == ae2->transit)
return 1;
else if (ae1 || ae2)
return 0;
/* neither attribute has extra attributes, so they're same */
return 1;
}
else
return 0;
}
| 0
|
137,408
|
static void test_change_user()
{
char buff[256];
const char *user_pw= "mysqltest_pw";
const char *user_no_pw= "mysqltest_no_pw";
const char *pw= "password";
const char *db= "mysqltest_user_test_database";
int rc;
MYSQL *l_mysql;
DBUG_ENTER("test_change_user");
myheader("test_change_user");
l_mysql= mysql_client_init(NULL);
DIE_UNLESS(l_mysql != NULL);
l_mysql= mysql_real_connect(l_mysql, opt_host, opt_user,
opt_password, current_db, opt_port,
opt_unix_socket, 0);
DIE_UNLESS(l_mysql != 0);
/* Prepare environment */
sprintf(buff, "drop database if exists %s", db);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
sprintf(buff, "create database %s", db);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
sprintf(buff,
"grant select on %s.* to %s@'%%' identified by '%s'",
db,
user_pw,
pw);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
sprintf(buff,
"grant select on %s.* to %s@'localhost' identified by '%s'",
db,
user_pw,
pw);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
sprintf(buff,
"grant select on %s.* to %s@'%%'",
db,
user_no_pw);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
sprintf(buff,
"grant select on %s.* to %s@'localhost'",
db,
user_no_pw);
rc= mysql_query(l_mysql, buff);
myquery2(l_mysql, rc);
/* Try some combinations */
rc= mysql_change_user(l_mysql, NULL, NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", "", NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", "", "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, NULL, "", "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, NULL, NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, "", "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, "", NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, "", db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, NULL, db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_pw, pw, db);
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_pw, pw, NULL);
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_pw, pw, "");
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_no_pw, pw, db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
rc= mysql_change_user(l_mysql, user_no_pw, pw, "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_no_pw, pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, user_no_pw, "", NULL);
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_no_pw, "", "");
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_no_pw, "", db);
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, user_no_pw, NULL, db);
myquery2(l_mysql, rc);
rc= mysql_change_user(l_mysql, "", pw, db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", pw, "");
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
rc= mysql_change_user(l_mysql, NULL, pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, NULL, NULL, db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, NULL, "", db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
rc= mysql_change_user(l_mysql, "", "", db);
DIE_UNLESS(rc);
if (! opt_silent)
printf("Got error (as expected): %s\n", mysql_error(l_mysql));
reconnect(&l_mysql);
/* Cleanup the environment */
mysql_close(l_mysql);
sprintf(buff, "drop database %s", db);
rc= mysql_query(mysql, buff);
myquery(rc);
sprintf(buff, "drop user %s@'%%'", user_pw);
rc= mysql_query(mysql, buff);
myquery(rc);
sprintf(buff, "drop user %s@'%%'", user_no_pw);
rc= mysql_query(mysql, buff);
myquery(rc);
sprintf(buff, "drop user %s@'localhost'", user_pw);
rc= mysql_query(mysql, buff);
myquery(rc);
sprintf(buff, "drop user %s@'localhost'", user_no_pw);
rc= mysql_query(mysql, buff);
myquery(rc);
DBUG_VOID_RETURN;
}
| 0
|
274,993
|
TIFFReadRGBAStripExt(TIFF* tif, uint32 row, uint32 * raster, int stop_on_error)
{
char emsg[1024] = "";
TIFFRGBAImage img;
int ok;
uint32 rowsperstrip, rows_to_read;
if( TIFFIsTiled( tif ) )
{
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
"Can't use TIFFReadRGBAStrip() with tiled file.");
return (0);
}
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
if( (row % rowsperstrip) != 0 )
{
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
"Row passed to TIFFReadRGBAStrip() must be first in a strip.");
return (0);
}
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg)) {
img.row_offset = row;
img.col_offset = 0;
if( row + rowsperstrip > img.height )
rows_to_read = img.height - row;
else
rows_to_read = rowsperstrip;
ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );
TIFFRGBAImageEnd(&img);
} else {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
ok = 0;
}
return (ok);
}
| 0
|
4,333
|
PixarLogClose(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
/* In a really sneaky (and really incorrect, and untruthful, and
* troublesome, and error-prone) maneuver that completely goes against
* the spirit of TIFF, and breaks TIFF, on close, we covertly
* modify both bitspersample and sampleformat in the directory to
* indicate 8-bit linear. This way, the decode "just works" even for
* readers that don't know about PixarLog, or how to set
* the PIXARLOGDATFMT pseudo-tag.
*/
td->td_bitspersample = 8;
td->td_sampleformat = SAMPLEFORMAT_UINT;
}
| 1
|
516,868
|
join_read_prev_same(READ_RECORD *info)
{
int error;
TABLE *table= info->table;
JOIN_TAB *tab=table->reginfo.join_tab;
if (unlikely((error= table->file->ha_index_prev(table->record[0]))))
return report_error(table, error);
if (key_cmp_if_same(table, tab->ref.key_buff, tab->ref.key,
tab->ref.key_length))
{
table->status=STATUS_NOT_FOUND;
error= -1;
}
return error;
}
| 0
|
348,164
|
FileSpec::FileSpec(const Object *fileSpecA)
{
ok = true;
fileName = nullptr;
platformFileName = nullptr;
embFile = nullptr;
desc = nullptr;
fileSpec = fileSpecA->copy();
Object obj1 = getFileSpecName(fileSpecA);
if (!obj1.isString()) {
ok = false;
error(errSyntaxError, -1, "Invalid FileSpec");
return;
}
fileName = obj1.getString()->copy();
if (fileSpec.isDict()) {
obj1 = fileSpec.dictLookup("EF");
if (obj1.isDict()) {
fileStream = obj1.dictLookupNF("F");
if (!fileStream.isRef()) {
ok = false;
fileStream.setToNull();
error(errSyntaxError, -1, "Invalid FileSpec: Embedded file stream is not an indirect reference");
return;
}
}
}
obj1 = fileSpec.dictLookup("Desc");
if (obj1.isString())
desc = obj1.getString()->copy();
}
| 1
|
21,116
|
gboolean bluetooth_gatt_has_no_parameter ( guint8 opcode ) {
return is_readable_request ( opcode ) || opcode == ATT_OPCODE_WRITE_RESPONSE || opcode == ATT_OPCODE_HANDLE_VALUE_CONFIRMATION ;
}
| 0
|
264,674
|
group_sched_in(struct perf_event *group_event,
struct perf_cpu_context *cpuctx,
struct perf_event_context *ctx)
{
struct perf_event *event, *partial_group = NULL;
struct pmu *pmu = group_event->pmu;
u64 now = ctx->time;
bool simulate = false;
if (group_event->state == PERF_EVENT_STATE_OFF)
return 0;
pmu->start_txn(pmu);
if (event_sched_in(group_event, cpuctx, ctx)) {
pmu->cancel_txn(pmu);
return -EAGAIN;
}
/*
* Schedule in siblings as one group (if any):
*/
list_for_each_entry(event, &group_event->sibling_list, group_entry) {
if (event_sched_in(event, cpuctx, ctx)) {
partial_group = event;
goto group_error;
}
}
if (!pmu->commit_txn(pmu))
return 0;
group_error:
/*
* Groups can be scheduled in as one unit only, so undo any
* partial group before returning:
* The events up to the failed event are scheduled out normally,
* tstamp_stopped will be updated.
*
* The failed events and the remaining siblings need to have
* their timings updated as if they had gone thru event_sched_in()
* and event_sched_out(). This is required to get consistent timings
* across the group. This also takes care of the case where the group
* could never be scheduled by ensuring tstamp_stopped is set to mark
* the time the event was actually stopped, such that time delta
* calculation in update_event_times() is correct.
*/
list_for_each_entry(event, &group_event->sibling_list, group_entry) {
if (event == partial_group)
simulate = true;
if (simulate) {
event->tstamp_running += now - event->tstamp_stopped;
event->tstamp_stopped = now;
} else {
event_sched_out(event, cpuctx, ctx);
}
}
event_sched_out(group_event, cpuctx, ctx);
pmu->cancel_txn(pmu);
return -EAGAIN;
}
| 0
|
299,183
|
__must_hold(&ctx->uring_lock)
{
struct io_submit_state *state = &ctx->submit_state;
gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
void *reqs[IO_REQ_ALLOC_BATCH];
struct io_kiocb *req;
int ret, i;
if (likely(state->free_list.next || io_flush_cached_reqs(ctx)))
return true;
ret = kmem_cache_alloc_bulk(req_cachep, gfp, ARRAY_SIZE(reqs), reqs);
/*
* Bulk alloc is all-or-nothing. If we fail to get a batch,
* retry single alloc to be on the safe side.
*/
if (unlikely(ret <= 0)) {
reqs[0] = kmem_cache_alloc(req_cachep, gfp);
if (!reqs[0])
return false;
ret = 1;
}
percpu_ref_get_many(&ctx->refs, ret);
for (i = 0; i < ret; i++) {
req = reqs[i];
io_preinit_req(req, ctx);
wq_stack_add_head(&req->comp_list, &state->free_list);
}
return true;
}
| 0
|
470,284
|
static void open_uri_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->link_popup_menu),
"menu_button");
const gchar *raw_url = g_object_get_data(G_OBJECT(textview->link_popup_menu),
"raw_url");
if (uri) {
if (textview_uri_security_check(textview, uri) == TRUE)
open_uri(uri->uri,
prefs_common_get_uri_cmd());
g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
NULL);
}
if (raw_url) {
open_uri(raw_url, prefs_common_get_uri_cmd());
g_object_set_data(G_OBJECT(textview->link_popup_menu), "raw_url",
NULL);
}
}
| 0
|
347,389
|
gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
{
int BitPixel;
#if 0
int ColorResolution;
int Background;
int AspectRatio;
#endif
int Transparent = (-1);
unsigned char buf[16];
unsigned char c;
unsigned char ColorMap[3][MAXCOLORMAPSIZE];
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
int imw, imh, screen_width, screen_height;
int gif87a, useGlobalColormap;
int bitPixel;
int i;
/*1.4//int imageCount = 0; */
int ZeroDataBlock = FALSE;
int haveGlobalColormap;
gdImagePtr im = 0;
memset(ColorMap, 0, 3 * MAXCOLORMAPSIZE);
memset(localColorMap, 0, 3 * MAXCOLORMAPSIZE);
/*1.4//imageNumber = 1; */
if (! ReadOK(fd,buf,6)) {
return 0;
}
if (strncmp((char *)buf,"GIF",3) != 0) {
return 0;
}
if (memcmp((char *)buf+3, "87a", 3) == 0) {
gif87a = 1;
} else if (memcmp((char *)buf+3, "89a", 3) == 0) {
gif87a = 0;
} else {
return 0;
}
if (! ReadOK(fd,buf,7)) {
return 0;
}
BitPixel = 2<<(buf[4]&0x07);
#if 0
ColorResolution = (int) (((buf[4]&0x70)>>3)+1);
Background = buf[5];
AspectRatio = buf[6];
#endif
screen_width = imw = LM_to_uint(buf[0],buf[1]);
screen_height = imh = LM_to_uint(buf[2],buf[3]);
haveGlobalColormap = BitSet(buf[4], LOCALCOLORMAP); /* Global Colormap */
if (haveGlobalColormap) {
if (ReadColorMap(fd, BitPixel, ColorMap)) {
return 0;
}
}
for (;;) {
int top, left;
int width, height;
if (! ReadOK(fd,&c,1)) {
return 0;
}
if (c == ';') { /* GIF terminator */
goto terminated;
}
if (c == '!') { /* Extension */
if (! ReadOK(fd,&c,1)) {
return 0;
}
DoExtension(fd, c, &Transparent, &ZeroDataBlock);
continue;
}
if (c != ',') { /* Not a valid start character */
continue;
}
/*1.4//++imageCount; */
if (! ReadOK(fd,buf,9)) {
return 0;
}
useGlobalColormap = ! BitSet(buf[8], LOCALCOLORMAP);
bitPixel = 1<<((buf[8]&0x07)+1);
left = LM_to_uint(buf[0], buf[1]);
top = LM_to_uint(buf[2], buf[3]);
width = LM_to_uint(buf[4], buf[5]);
height = LM_to_uint(buf[6], buf[7]);
if (left + width > screen_width || top + height > screen_height) {
if (VERBOSE) {
printf("Frame is not confined to screen dimension.\n");
}
return 0;
}
if (!(im = gdImageCreate(width, height))) {
return 0;
}
im->interlace = BitSet(buf[8], INTERLACE);
if (!useGlobalColormap) {
if (ReadColorMap(fd, bitPixel, localColorMap)) {
gdImageDestroy(im);
return 0;
}
ReadImage(im, fd, width, height, localColorMap,
BitSet(buf[8], INTERLACE), &ZeroDataBlock);
} else {
if (!haveGlobalColormap) {
gdImageDestroy(im);
return 0;
}
ReadImage(im, fd, width, height,
ColorMap,
BitSet(buf[8], INTERLACE), &ZeroDataBlock);
}
if (Transparent != (-1)) {
gdImageColorTransparent(im, Transparent);
}
goto terminated;
}
terminated:
/* Terminator before any image was declared! */
if (!im) {
return 0;
}
if (!im->colorsTotal) {
gdImageDestroy(im);
return 0;
}
/* Check for open colors at the end, so
we can reduce colorsTotal and ultimately
BitsPerPixel */
for (i=((im->colorsTotal-1)); (i>=0); i--) {
if (im->open[i]) {
im->colorsTotal--;
} else {
break;
}
}
return im;
}
| 1
|
410,260
|
void printIFD(std::ostream& out, PrintStructureOption option, uint64_t dir_offset, int depth)
{
BasicIo& io = Image::io();
depth++;
bool bFirst = true;
// buffer
bool bPrint = true;
do
{
// Read top of directory
io.seek(dir_offset, BasicIo::beg);
const uint64_t entries = readData(header_.format() == Header::StandardTiff? 2: 8);
const bool tooBig = entries > 500;
if ( bFirst && bPrint )
{
out << Internal::indent(depth) << Internal::stringFormat("STRUCTURE OF BIGTIFF FILE ") << io.path() << std::endl;
if (tooBig)
out << Internal::indent(depth) << "entries = " << entries << std::endl;
}
if (tooBig)
break;
// Read the dictionary
for ( uint64_t i = 0; i < entries; i ++ )
{
if ( bFirst && bPrint )
out << Internal::indent(depth)
<< " address | tag | "
<< " type | count | offset | value\n";
bFirst = false;
const uint16_t tag = (uint16_t) readData(2);
const uint16_t type = (uint16_t) readData(2);
const uint64_t count = readData(dataSize_);
const DataBuf data = io.read(dataSize_); // Read data as raw value. what should be done about it will be decided depending on type
std::string sp = "" ; // output spacer
//prepare to print the value
// TODO: figure out what's going on with kount
const uint64_t kount = isStringType(type)? (count > 32 ? 32 : count) // restrict long arrays
: count > 5 ? 5
: count
;
const uint32_t pad = isStringType(type) ? 1 : 0;
const uint32_t size = isStringType(type) ? 1
: is2ByteType(type) ? 2
: is4ByteType(type) ? 4
: is8ByteType(type) ? 8
: 1;
// #55 and #56 memory allocation crash test/data/POC8
// size * count > std::numeric_limits<uint64_t>::max()
// =>
// size > std::numeric_limits<uint64_t>::max() / count
if (size > std::numeric_limits<uint64_t>::max() / count)
throw Error(57); // we got number bigger than 2^64
// more than we can handle
if (size * count > std::numeric_limits<uint64_t>::max() - pad)
throw Error(57); // again more than 2^64
const uint64_t allocate = size*count + pad;
if ( allocate > io.size() ) {
throw Error(57);
}
DataBuf buf(static_cast<long>(allocate));
const uint64_t offset = header_.format() == Header::StandardTiff?
byteSwap4(data, 0, doSwap_):
byteSwap8(data, 0, doSwap_);
// big data? Use 'data' as pointer to real data
const bool usePointer = (size_t) count*size > (size_t) dataSize_;
if ( usePointer ) // read into buffer
{
size_t restore = io.tell(); // save
io.seek(offset, BasicIo::beg); // position
io.read(buf.pData_, (long) count * size); // read
io.seek(restore, BasicIo::beg); // restore
}
else // use 'data' as data :)
std::memcpy(buf.pData_, data.pData_, (size_t) count * size); // copy data
if ( bPrint )
{
const uint64_t entrySize = header_.format() == Header::StandardTiff? 12: 20;
const uint64_t address = dir_offset + 2 + i * entrySize;
const std::string offsetString = usePointer?
Internal::stringFormat("%10u", offset):
"";
out << Internal::indent(depth)
<< Internal::stringFormat("%8u | %#06x %-25s |%10s |%9u |%10s | ",
address, tag, tagName(tag).c_str(), typeName(type), count, offsetString.c_str());
if ( isShortType(type) )
{
for ( size_t k = 0 ; k < kount ; k++ )
{
out << sp << byteSwap2(buf, k*size, doSwap_);
sp = " ";
}
}
else if ( isLongType(type) )
{
for ( size_t k = 0 ; k < kount ; k++ )
{
out << sp << byteSwap4(buf, k*size, doSwap_);
sp = " ";
}
}
else if ( isLongLongType(type) )
{
for ( size_t k = 0 ; k < kount ; k++ )
{
out << sp << byteSwap8(buf, k*size, doSwap_);
sp = " ";
}
}
else if ( isRationalType(type) )
{
for ( size_t k = 0 ; k < kount ; k++ )
{
uint32_t a = byteSwap4(buf, k*size+0, doSwap_);
uint32_t b = byteSwap4(buf, k*size+4, doSwap_);
out << sp << a << "/" << b;
sp = " ";
}
}
else if ( isStringType(type) )
out << sp << Internal::binaryToString(buf, (size_t) kount);
sp = kount == count ? "" : " ...";
out << sp << std::endl;
if ( option == kpsRecursive &&
(tag == 0x8769 /* ExifTag */ || tag == 0x014a/*SubIFDs*/ || type == tiffIfd || type == tiffIfd8) )
{
for ( size_t k = 0 ; k < count ; k++ )
{
const size_t restore = io.tell();
const uint64_t ifdOffset = type == tiffIfd8?
byteSwap8(buf, k*size, doSwap_):
byteSwap4(buf, k*size, doSwap_);
printIFD(out, option, ifdOffset, depth);
io.seek(restore, BasicIo::beg);
}
}
else if ( option == kpsRecursive && tag == 0x83bb /* IPTCNAA */ )
{
const size_t restore = io.tell(); // save
io.seek(offset, BasicIo::beg); // position
byte* bytes=new byte[(size_t)count] ; // allocate memory
io.read(bytes,(long)count) ; // read
io.seek(restore, BasicIo::beg); // restore
IptcData::printStructure(out,bytes,(size_t)count,depth);
delete[] bytes; // free
}
else if ( option == kpsRecursive && tag == 0x927c /* MakerNote */ && count > 10)
{
size_t restore = io.tell(); // save
uint32_t jump= 10 ;
byte bytes[20] ;
const char* chars = (const char*) &bytes[0] ;
io.seek(dir_offset, BasicIo::beg); // position
io.read(bytes,jump ) ; // read
bytes[jump]=0 ;
if ( ::strcmp("Nikon",chars) == 0 )
{
// tag is an embedded tiff
byte* bytes=new byte[(size_t)count-jump] ; // allocate memory
io.read(bytes,(long) count-jump) ; // read
MemIo memIo(bytes,(long)count-jump) ; // create a file
std::cerr << "Nikon makernote" << std::endl;
// printTiffStructure(memIo,out,option,depth); TODO: fix it
delete[] bytes ; // free
}
else
{
// tag is an IFD
io.seek(0, BasicIo::beg); // position
std::cerr << "makernote" << std::endl;
printIFD(out,option,offset,depth);
}
io.seek(restore,BasicIo::beg); // restore
}
}
}
const uint64_t nextDirOffset = readData(dataSize_);
dir_offset = tooBig ? 0 : nextDirOffset;
out.flush();
} while (dir_offset != 0);
if ( bPrint )
out << Internal::indent(depth) << "END " << io.path() << std::endl;
depth--;
}
| 0
|
374,659
|
_copyFieldSelect(const FieldSelect *from)
{
FieldSelect *newnode = makeNode(FieldSelect);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(fieldnum);
COPY_SCALAR_FIELD(resulttype);
COPY_SCALAR_FIELD(resulttypmod);
COPY_SCALAR_FIELD(resultcollid);
return newnode;
}
| 0
|
281,849
|
void BackFramebuffer::AttachRenderTexture(BackTexture* texture) {
DCHECK_NE(id_, 0u);
ScopedGLErrorSuppressor suppressor(
"BackFramebuffer::AttachRenderTexture", decoder_->GetErrorState());
ScopedFramebufferBinder binder(decoder_, id_);
GLuint attach_id = texture ? texture->id() : 0;
api()->glFramebufferTexture2DEXTFn(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
texture->Target(), attach_id, 0);
}
| 0
|
218,207
|
RenderViewHostManager::RenderViewHostManager(
RenderViewHostDelegate* render_view_delegate,
RenderWidgetHostDelegate* render_widget_delegate,
Delegate* delegate)
: delegate_(delegate),
cross_navigation_pending_(false),
render_view_delegate_(render_view_delegate),
render_widget_delegate_(render_widget_delegate),
render_view_host_(NULL),
pending_render_view_host_(NULL),
interstitial_page_(NULL) {
}
| 0
|
278,492
|
static MagickBooleanType sixel_encode_impl(unsigned char *pixels, size_t width,size_t height,
unsigned char *palette, size_t ncolors, int keycolor,
sixel_output_t *context)
{
#define RelinquishNodesAndMap \
while ((np = context->node_free) != NULL) { \
context->node_free = np->next; \
np=(sixel_node_t *) RelinquishMagickMemory(np); \
} \
map = (unsigned char *) RelinquishMagickMemory(map)
int x, y, i, n, c;
int left, right;
int pix;
size_t len;
unsigned char *map;
sixel_node_t *np, *tp, top;
int nwrite;
context->pos = 0;
if (ncolors < 1) {
return (MagickFalse);
}
len = ncolors * width;
context->active_palette = (-1);
if ((map = (unsigned char *)AcquireQuantumMemory(len, sizeof(unsigned char))) == NULL) {
return (MagickFalse);
}
(void) ResetMagickMemory(map, 0, len);
if (context->has_8bit_control) {
nwrite = sprintf((char *)context->buffer, "\x90" "0;0;0" "q");
} else {
nwrite = sprintf((char *)context->buffer, "\x1bP" "0;0;0" "q");
}
if (nwrite <= 0) {
return (MagickFalse);
}
sixel_advance(context, nwrite);
nwrite = sprintf((char *)context->buffer + context->pos, "\"1;1;%d;%d", (int) width, (int) height);
if (nwrite <= 0) {
RelinquishNodesAndMap;
return (MagickFalse);
}
sixel_advance(context, nwrite);
if (ncolors != 2 || keycolor == -1) {
for (n = 0; n < (ssize_t) ncolors; n++) {
/* DECGCI Graphics Color Introducer # Pc ; Pu; Px; Py; Pz */
nwrite = sprintf((char *)context->buffer + context->pos, "#%d;2;%d;%d;%d",
n,
(palette[n * 3 + 0] * 100 + 127) / 255,
(palette[n * 3 + 1] * 100 + 127) / 255,
(palette[n * 3 + 2] * 100 + 127) / 255);
if (nwrite <= 0) {
RelinquishNodesAndMap;
return (MagickFalse);
}
sixel_advance(context, nwrite);
if (nwrite <= 0) {
RelinquishNodesAndMap;
return (MagickFalse);
}
}
}
for (y = i = 0; y < (ssize_t) height; y++) {
for (x = 0; x < (ssize_t) width; x++) {
pix = pixels[y * width + x];
if (pix >= 0 && pix < (ssize_t) ncolors && pix != keycolor) {
map[pix * width + x] |= (1 << i);
}
}
if (++i < 6 && (y + 1) < (ssize_t) height) {
continue;
}
for (c = 0; c < (ssize_t) ncolors; c++) {
for (left = 0; left < (ssize_t) width; left++) {
if (*(map + c * width + left) == 0) {
continue;
}
for (right = left + 1; right < (ssize_t) width; right++) {
if (*(map + c * width + right) != 0) {
continue;
}
for (n = 1; (right + n) < (ssize_t) width; n++) {
if (*(map + c * width + right + n) != 0) {
break;
}
}
if (n >= 10 || right + n >= (ssize_t) width) {
break;
}
right = right + n - 1;
}
if ((np = context->node_free) != NULL) {
context->node_free = np->next;
} else if ((np = (sixel_node_t *)AcquireMagickMemory(sizeof(sixel_node_t))) == NULL) {
RelinquishNodesAndMap;
return (MagickFalse);
}
np->color = c;
np->left = left;
np->right = right;
np->map = map + c * width;
top.next = context->node_top;
tp = ⊤
while (tp->next != NULL) {
if (np->left < tp->next->left) {
break;
}
if (np->left == tp->next->left && np->right > tp->next->right) {
break;
}
tp = tp->next;
}
np->next = tp->next;
tp->next = np;
context->node_top = top.next;
left = right - 1;
}
}
for (x = 0; (np = context->node_top) != NULL;) {
if (x > np->left) {
/* DECGCR Graphics Carriage Return */
context->buffer[context->pos] = '$';
sixel_advance(context, 1);
x = 0;
}
x = sixel_put_node(context, x, np, (int) ncolors, keycolor);
sixel_node_del(context, np);
np = context->node_top;
while (np != NULL) {
if (np->left < x) {
np = np->next;
continue;
}
x = sixel_put_node(context, x, np, (int) ncolors, keycolor);
sixel_node_del(context, np);
np = context->node_top;
}
}
/* DECGNL Graphics Next Line */
context->buffer[context->pos] = '-';
sixel_advance(context, 1);
if (nwrite <= 0) {
RelinquishNodesAndMap;
return (MagickFalse);
}
i = 0;
(void) ResetMagickMemory(map, 0, len);
}
if (context->has_8bit_control) {
context->buffer[context->pos] = 0x9c;
sixel_advance(context, 1);
} else {
context->buffer[context->pos] = 0x1b;
context->buffer[context->pos + 1] = '\\';
sixel_advance(context, 2);
}
if (nwrite <= 0) {
RelinquishNodesAndMap;
return (MagickFalse);
}
/* flush buffer */
if (context->pos > 0) {
(void) WriteBlob(context->image,context->pos,context->buffer);
}
RelinquishNodesAndMap;
return(MagickTrue);
}
| 0
|
8,742
|
exif_data_load_data (ExifData *data, const unsigned char *d_orig,
unsigned int ds)
{
unsigned int l;
ExifLong offset;
ExifShort n;
const unsigned char *d = d_orig;
unsigned int len, fullds;
if (!data || !data->priv || !d || !ds)
return;
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"Parsing %i byte(s) EXIF data...\n", ds);
/*
* It can be that the data starts with the EXIF header. If it does
* not, search the EXIF marker.
*/
if (ds < 6) {
LOG_TOO_SMALL;
return;
}
if (!memcmp (d, ExifHeader, 6)) {
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"Found EXIF header at start.");
} else {
while (ds >= 3) {
while (ds && (d[0] == 0xff)) {
d++;
ds--;
}
/* JPEG_MARKER_SOI */
if (ds && d[0] == JPEG_MARKER_SOI) {
d++;
ds--;
continue;
}
/* JPEG_MARKER_APP1 */
if (ds && d[0] == JPEG_MARKER_APP1)
break;
/* Skip irrelevant APP markers. The branch for APP1 must come before this,
otherwise this code block will cause APP1 to be skipped. This code path
is only relevant for files that are nonconformant to the EXIF
specification. For conformant files, the APP1 code path above will be
taken. */
if (ds >= 3 && d[0] >= 0xe0 && d[0] <= 0xef) { /* JPEG_MARKER_APPn */
d++;
ds--;
l = (d[0] << 8) | d[1];
if (l > ds)
return;
d += l;
ds -= l;
continue;
}
/* Unknown marker or data. Give up. */
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifData", _("EXIF marker not found."));
return;
}
if (ds < 3) {
LOG_TOO_SMALL;
return;
}
d++;
ds--;
len = (d[0] << 8) | d[1];
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"We have to deal with %i byte(s) of EXIF data.",
len);
d += 2;
ds -= 2;
}
/*
* Verify the exif header
* (offset 2, length 6).
*/
if (ds < 6) {
LOG_TOO_SMALL;
return;
}
if (memcmp (d, ExifHeader, 6)) {
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifData", _("EXIF header not found."));
return;
}
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"Found EXIF header.");
/* Sanity check the data length */
if (ds < 14)
return;
/* The JPEG APP1 section can be no longer than 64 KiB (including a
16-bit length), so cap the data length to protect against overflow
in future offset calculations */
fullds = ds;
if (ds > 0xfffe)
ds = 0xfffe;
/* Byte order (offset 6, length 2) */
if (!memcmp (d + 6, "II", 2))
data->priv->order = EXIF_BYTE_ORDER_INTEL;
else if (!memcmp (d + 6, "MM", 2))
data->priv->order = EXIF_BYTE_ORDER_MOTOROLA;
else {
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifData", _("Unknown encoding."));
return;
}
/* Fixed value */
if (exif_get_short (d + 8, data->priv->order) != 0x002a)
return;
/* IFD 0 offset */
offset = exif_get_long (d + 10, data->priv->order);
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"IFD 0 at %i.", (int) offset);
/* Sanity check the offset, being careful about overflow */
if (offset > ds || offset + 6 + 2 > ds)
return;
/* Parse the actual exif data (usually offset 14 from start) */
exif_data_load_data_content (data, EXIF_IFD_0, d + 6, ds - 6, offset, 0);
/* IFD 1 offset */
n = exif_get_short (d + 6 + offset, data->priv->order);
if (offset + 6 + 2 + 12 * n + 4 > ds)
return;
offset = exif_get_long (d + 6 + offset + 2 + 12 * n, data->priv->order);
if (offset) {
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
"IFD 1 at %i.", (int) offset);
/* Sanity check. */
if (offset > ds || offset + 6 > ds) {
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifData", "Bogus offset of IFD1.");
} else {
exif_data_load_data_content (data, EXIF_IFD_1, d + 6, ds - 6, offset, 0);
}
}
/*
* If we got an EXIF_TAG_MAKER_NOTE, try to interpret it. Some
* cameras use pointers in the maker note tag that point to the
* space between IFDs. Here is the only place where we have access
* to that data.
*/
interpret_maker_note(data, d, fullds);
/* Fixup tags if requested */
if (data->priv->options & EXIF_DATA_OPTION_FOLLOW_SPECIFICATION)
exif_data_fix (data);
}
| 1
|
472,815
|
static void scsi_cd_change_media_cb(void *opaque, bool load, Error **errp)
{
SCSIDiskState *s = opaque;
/*
* When a CD gets changed, we have to report an ejected state and
* then a loaded state to guests so that they detect tray
* open/close and media change events. Guests that do not use
* GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close
* states rely on this behavior.
*
* media_changed governs the state machine used for unit attention
* report. media_event is used by GET EVENT STATUS NOTIFICATION.
*/
s->media_changed = load;
s->tray_open = !load;
scsi_device_set_ua(&s->qdev, SENSE_CODE(UNIT_ATTENTION_NO_MEDIUM));
s->media_event = true;
s->eject_request = false;
}
| 0
|
419,854
|
Gets the ACL for a given mailbox */
PHP_FUNCTION(imap_getacl)
{
zval *streamind;
zend_string *mailbox;
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &mailbox) == FAILURE) {
return;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
RETURN_FALSE;
}
/* initializing the special array for the return values */
array_init(return_value);
IMAPG(imap_acl_list) = return_value;
/* set the callback for the GET_ACL function */
mail_parameters(NIL, SET_ACL, (void *) mail_getacl);
if (!imap_getacl(imap_le_struct->imap_stream, ZSTR_VAL(mailbox))) {
php_error(E_WARNING, "c-client imap_getacl failed");
zval_dtor(return_value);
RETURN_FALSE;
}
IMAPG(imap_acl_list) = NIL;
| 0
|
73,548
|
static size_t BufferBytesForLength(int length) {
return (length + 1) * sizeof(TypedValue) / 2; // Worst case: "[0,0,...,0]"
}
| 0
|
277,157
|
void DesktopWindowTreeHostX11::AfterActivationStateChanged() {
if (had_pointer_grab_ && !has_pointer_grab_)
dispatcher()->OnHostLostMouseGrab();
bool had_pointer_capture = had_pointer_ || had_pointer_grab_;
bool has_pointer_capture = has_pointer_ || has_pointer_grab_;
if (had_pointer_capture && !has_pointer_capture)
OnHostLostWindowCapture();
if (!was_active_ && IsActive()) {
FlashFrame(false);
open_windows().remove(xwindow_);
open_windows().insert(open_windows().begin(), xwindow_);
}
if (was_active_ != IsActive()) {
desktop_native_widget_aura_->HandleActivationChanged(IsActive());
native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint();
}
}
| 0
|
498,112
|
void read_coding_quadtree(thread_context* tctx,
int x0, int y0,
int log2CbSize,
int ctDepth)
{
logtrace(LogSlice,"- read_coding_quadtree %d;%d cbsize:%d depth:%d POC:%d\n",x0,y0,1<<log2CbSize,ctDepth,tctx->img->PicOrderCntVal);
de265_image* img = tctx->img;
const seq_parameter_set& sps = img->get_sps();
const pic_parameter_set& pps = img->get_pps();
int split_flag;
// We only send a split flag if CU is larger than minimum size and
// completely contained within the image area.
// If it is partly outside the image area and not at minimum size,
// it is split. If already at minimum size, it is not split further.
if (x0+(1<<log2CbSize) <= sps.pic_width_in_luma_samples &&
y0+(1<<log2CbSize) <= sps.pic_height_in_luma_samples &&
log2CbSize > sps.Log2MinCbSizeY) {
split_flag = decode_split_cu_flag(tctx, x0,y0, ctDepth);
} else {
if (log2CbSize > sps.Log2MinCbSizeY) { split_flag=1; }
else { split_flag=0; }
}
if (pps.cu_qp_delta_enabled_flag &&
log2CbSize >= pps.Log2MinCuQpDeltaSize)
{
tctx->IsCuQpDeltaCoded = 0;
tctx->CuQpDelta = 0;
}
else
{
// shdr->CuQpDelta = 0; // TODO check: is this the right place to set to default value ?
}
if (tctx->shdr->cu_chroma_qp_offset_enabled_flag &&
log2CbSize >= pps.Log2MinCuChromaQpOffsetSize) {
tctx->IsCuChromaQpOffsetCoded = 0;
}
if (split_flag) {
int x1 = x0 + (1<<(log2CbSize-1));
int y1 = y0 + (1<<(log2CbSize-1));
read_coding_quadtree(tctx,x0,y0, log2CbSize-1, ctDepth+1);
if (x1<sps.pic_width_in_luma_samples)
read_coding_quadtree(tctx,x1,y0, log2CbSize-1, ctDepth+1);
if (y1<sps.pic_height_in_luma_samples)
read_coding_quadtree(tctx,x0,y1, log2CbSize-1, ctDepth+1);
if (x1<sps.pic_width_in_luma_samples &&
y1<sps.pic_height_in_luma_samples)
read_coding_quadtree(tctx,x1,y1, log2CbSize-1, ctDepth+1);
}
else {
// set ctDepth of this CU
img->set_ctDepth(x0,y0, log2CbSize, ctDepth);
read_coding_unit(tctx, x0,y0, log2CbSize, ctDepth);
}
logtrace(LogSlice,"-\n");
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.