idx
int64
func
string
target
int64
325,664
static int qemu_savevm_state(QEMUFile *f) { SaveStateEntry *se; int len, ret; int64_t cur_pos, len_pos, total_len_pos; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); total_len_pos = qemu_ftell(f); qemu_put_be64(f, 0); /* total size */ for(se = first_se; se != NULL; se = se->next) { if (se->save_state == NULL) /* this one has a loader only, for backwards compatibility */ continue; /* ID string */ len = strlen(se->idstr); qemu_put_byte(f, len); qemu_put_buffer(f, (uint8_t *)se->idstr, len); qemu_put_be32(f, se->instance_id); qemu_put_be32(f, se->version_id); /* record size: filled later */ len_pos = qemu_ftell(f); qemu_put_be32(f, 0); se->save_state(f, se->opaque); /* fill record size */ cur_pos = qemu_ftell(f); len = cur_pos - len_pos - 4; qemu_fseek(f, len_pos, SEEK_SET); qemu_put_be32(f, len); qemu_fseek(f, cur_pos, SEEK_SET); } cur_pos = qemu_ftell(f); qemu_fseek(f, total_len_pos, SEEK_SET); qemu_put_be64(f, cur_pos - total_len_pos - 8); qemu_fseek(f, cur_pos, SEEK_SET); ret = 0; return ret; }
1
137,162
void __fastcall TExternalConsole::Print(UnicodeString Str, bool FromBeginning, bool Error) { // need to do at least one iteration, even when Str is empty (new line) do { TConsoleCommStruct * CommStruct = GetCommStruct(); try { size_t MaxLen = LENOF(CommStruct->PrintEvent.Message) - 1; UnicodeString Piece = Str.SubString(1, MaxLen); Str.Delete(1, MaxLen); CommStruct->Event = TConsoleCommStruct::PRINT; wcscpy(CommStruct->PrintEvent.Message, Piece.c_str()); CommStruct->PrintEvent.FromBeginning = FromBeginning; CommStruct->PrintEvent.Error = Error; // In the next iteration we need to append never overwrite. // Note that this won't work properly for disk/pipe outputs, // when the next line is also FromBeginning, // as !FromBeginning print effectively commits previous FromBeginning print. // On the other hand, FromBeginning print is always initiated by us, // and it's not likely we ever issue print over 10 KB. FromBeginning = false; } __finally { FreeCommStruct(CommStruct); } SendEvent(INFINITE); } while (!Str.IsEmpty()); }
0
143,691
static void WritePixels(struct ngiflib_img * i, struct ngiflib_decode_context * context, const u8 * pixels, u16 n) { u16 tocopy; struct ngiflib_gif * p = i->parent; while(n > 0) { tocopy = (context->Xtogo < n) ? context->Xtogo : n; if(!i->gce.transparent_flag) { #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ ngiflib_memcpy(context->frbuff_p.p8, pixels, tocopy); pixels += tocopy; context->frbuff_p.p8 += tocopy; #ifndef NGIFLIB_INDEXED_ONLY } else { int j; for(j = (int)tocopy; j > 0; j--) { *(context->frbuff_p.p32++) = GifIndexToTrueColor(i->palette, *pixels++); } } #endif /* NGIFLIB_INDEXED_ONLY */ } else { int j; #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ for(j = (int)tocopy; j > 0; j--) { if(*pixels != i->gce.transparent_color) *context->frbuff_p.p8 = *pixels; pixels++; context->frbuff_p.p8++; } #ifndef NGIFLIB_INDEXED_ONLY } else { for(j = (int)tocopy; j > 0; j--) { if(*pixels != i->gce.transparent_color) { *context->frbuff_p.p32 = GifIndexToTrueColor(i->palette, *pixels); } pixels++; context->frbuff_p.p32++; } } #endif /* NGIFLIB_INDEXED_ONLY */ } context->Xtogo -= tocopy; if(context->Xtogo == 0) { #ifdef NGIFLIB_ENABLE_CALLBACKS if(p->line_cb) p->line_cb(p, context->line_p, context->curY); #endif /* NGIFLIB_ENABLE_CALLBACKS */ context->Xtogo = i->width; switch(context->pass) { case 0: context->curY++; break; case 1: /* 1st pass : every eighth row starting from 0 */ context->curY += 8; break; case 2: /* 2nd pass : every eighth row starting from 4 */ context->curY += 8; break; case 3: /* 3rd pass : every fourth row starting from 2 */ context->curY += 4; break; case 4: /* 4th pass : every odd row */ context->curY += 2; break; } while(context->pass > 0 && context->pass < 4 && context->curY >= p->height) { switch(++context->pass) { case 2: /* 2nd pass : every eighth row starting from 4 */ context->curY = i->posY + 4; break; case 3: /* 3rd pass : every fourth row starting from 2 */ context->curY = i->posY + 2; break; case 4: /* 4th pass : every odd row */ context->curY = i->posY + 1; break; } } #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ #ifdef NGIFLIB_ENABLE_CALLBACKS context->line_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width; context->frbuff_p.p8 = context->line_p.p8 + i->posX; #else context->frbuff_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ #ifndef NGIFLIB_INDEXED_ONLY } else { #ifdef NGIFLIB_ENABLE_CALLBACKS context->line_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width; context->frbuff_p.p32 = context->line_p.p32 + i->posX; #else context->frbuff_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ } #endif /* NGIFLIB_INDEXED_ONLY */ } n -= tocopy; } }
0
336,435
hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; target_ulong raddr; int prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; int old_exc = cs->exception_index; uint64_t asc = env->psw.mask & PSW_MASK_ASC; /* 31-Bit mode */ if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } mmu_translate(env, vaddr, 2, asc, &raddr, &prot); cs->exception_index = old_exc; return raddr; }
0
411,232
**/ CImg<T>& dilate(const unsigned int sx, const unsigned int sy, const unsigned int sz=1) { if (is_empty() || (sx==1 && sy==1 && sz==1)) return *this; if (sx>1 && _width>1) { // Along X-axis. const int L = width(), off = 1, s = (int)sx, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg<T> buf(L); cimg_pragma_openmp(parallel for collapse(3) firstprivate(buf) if (size()>524288)) cimg_forYZC(*this,y,z,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(0,y,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; T cur = *ptrs; ptrs+=off; bool is_first = true; for (int p = s2 - 1; p>0 && ptrs<=ptrse; --p) { const T val = *ptrs; ptrs+=off; if (val>=cur) { cur = val; is_first = false; } } *(ptrd++) = cur; if (ptrs>=ptrse) { T *pd = data(0,y,z,c); cur = std::max(cur,*ptrse); cimg_forX(buf,x) { *pd = cur; pd+=off; } } else { for (int p = s1; p>0 && ptrd<=ptrde; --p) { const T val = *ptrs; if (ptrs<ptrse) ptrs+=off; if (val>=cur) { cur = val; is_first = false; } *(ptrd++) = cur; } for (int p = L - s - 1; p>0; --p) { const T val = *ptrs; ptrs+=off; if (is_first) { const T *nptrs = ptrs - off; cur = val; for (int q = s - 2; q>0; --q) { nptrs-=off; const T nval = *nptrs; if (nval>cur) cur = nval; } nptrs-=off; const T nval = *nptrs; if (nval>cur) { cur = nval; is_first = true; } else is_first = false; } else { if (val>=cur) cur = val; else if (cur==*(ptrs-s*off)) is_first = true; } *(ptrd++) = cur; } ptrd = ptrde; ptrs = ptrse; cur = *ptrs; ptrs-=off; for (int p = s1; p>0 && ptrs>=ptrsb; --p) { const T val = *ptrs; ptrs-=off; if (val>cur) cur = val; } *(ptrd--) = cur; for (int p = s2 - 1; p>0 && ptrd>=ptrdb; --p) { const T val = *ptrs; if (ptrs>ptrsb) ptrs-=off; if (val>cur) cur = val; *(ptrd--) = cur; } T *pd = data(0,y,z,c); cimg_for(buf,ps,T) { *pd = *ps; pd+=off; } } } } if (sy>1 && _height>1) { // Along Y-axis. const int L = height(), off = width(), s = (int)sy, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg<T> buf(L); cimg_pragma_openmp(parallel for collapse(3) firstprivate(buf) if (size()>524288)) cimg_forXZC(*this,x,z,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,0,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; T cur = *ptrs; ptrs+=off; bool is_first = true; for (int p = s2 - 1; p>0 && ptrs<=ptrse; --p) { const T val = *ptrs; ptrs+=off; if (val>=cur) { cur = val; is_first = false; } } *(ptrd++) = cur; if (ptrs>=ptrse) { T *pd = data(x,0,z,c); cur = std::max(cur,*ptrse); cimg_forX(buf,x) { *pd = cur; pd+=off; } } else { for (int p = s1; p>0 && ptrd<=ptrde; --p) { const T val = *ptrs; if (ptrs<ptrse) ptrs+=off; if (val>=cur) { cur = val; is_first = false; } *(ptrd++) = cur; } for (int p = L - s - 1; p>0; --p) { const T val = *ptrs; ptrs+=off; if (is_first) { const T *nptrs = ptrs - off; cur = val; for (int q = s - 2; q>0; --q) { nptrs-=off; const T nval = *nptrs; if (nval>cur) cur = nval; } nptrs-=off; const T nval = *nptrs; if (nval>cur) { cur = nval; is_first = true; } else is_first = false; } else { if (val>=cur) cur = val; else if (cur==*(ptrs-s*off)) is_first = true; } *(ptrd++) = cur; } ptrd = ptrde; ptrs = ptrse; cur = *ptrs; ptrs-=off; for (int p = s1; p>0 && ptrs>=ptrsb; --p) { const T val = *ptrs; ptrs-=off; if (val>cur) cur = val; } *(ptrd--) = cur; for (int p = s2 - 1; p>0 && ptrd>=ptrdb; --p) { const T val = *ptrs; if (ptrs>ptrsb) ptrs-=off; if (val>cur) cur = val; *(ptrd--) = cur; } T *pd = data(x,0,z,c); cimg_for(buf,ps,T) { *pd = *ps; pd+=off; } } } } if (sz>1 && _depth>1) { // Along Z-axis. const int L = depth(), off = width()*height(), s = (int)sz, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg<T> buf(L); cimg_pragma_openmp(parallel for collapse(3) firstprivate(buf) if (size()>524288)) cimg_forXYC(*this,x,y,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,y,0,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; T cur = *ptrs; ptrs+=off; bool is_first = true; for (int p = s2 - 1; p>0 && ptrs<=ptrse; --p) { const T val = *ptrs; ptrs+=off; if (val>=cur) { cur = val; is_first = false; } } *(ptrd++) = cur; if (ptrs>=ptrse) { T *pd = data(x,y,0,c); cur = std::max(cur,*ptrse); cimg_forX(buf,x) { *pd = cur; pd+=off; } } else { for (int p = s1; p>0 && ptrd<=ptrde; --p) { const T val = *ptrs; if (ptrs<ptrse) ptrs+=off; if (val>=cur) { cur = val; is_first = false; } *(ptrd++) = cur; } for (int p = L - s - 1; p>0; --p) { const T val = *ptrs; ptrs+=off; if (is_first) { const T *nptrs = ptrs - off; cur = val; for (int q = s - 2; q>0; --q) { nptrs-=off; const T nval = *nptrs; if (nval>cur) cur = nval; } nptrs-=off; const T nval = *nptrs; if (nval>cur) { cur = nval; is_first = true; } else is_first = false; } else { if (val>=cur) cur = val; else if (cur==*(ptrs-s*off)) is_first = true; } *(ptrd++) = cur; } ptrd = ptrde; ptrs = ptrse; cur = *ptrs; ptrs-=off; for (int p = s1; p>0 && ptrs>=ptrsb; --p) { const T val = *ptrs; ptrs-=off; if (val>cur) cur = val; } *(ptrd--) = cur; for (int p = s2 - 1; p>0 && ptrd>=ptrdb; --p) { const T val = *ptrs; if (ptrs>ptrsb) ptrs-=off; if (val>cur) cur = val; *(ptrd--) = cur; } T *pd = data(x,y,0,c); cimg_for(buf,ps,T) { *pd = *ps; pd+=off; } } } } return *this;
0
293,264
void crm_diff_update(const char *event, xmlNode * msg) { int rc = -1; long now = time(NULL); const char *op = NULL; print_dot(); if (current_cib != NULL) { xmlNode *cib_last = current_cib; current_cib = NULL; rc = cib_apply_patch_event(msg, cib_last, &current_cib, LOG_DEBUG); free_xml(cib_last); switch(rc) { case pcmk_err_diff_resync: case pcmk_err_diff_failed: crm_warn("[%s] %s Patch aborted: %s (%d)", event, op, pcmk_strerror(rc), rc); case pcmk_ok: break; default: crm_warn("[%s] %s ABORTED: %s (%d)", event, op, pcmk_strerror(rc), rc); return; } } if (current_cib == NULL) { current_cib = get_cib_copy(cib); } if (crm_mail_to || snmp_target || external_agent) { /* Process operation updates */ xmlXPathObject *xpathObj = xpath_search(msg, "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_LRM_TAG_RSC_OP); if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { int lpc = 0, max = xpathObj->nodesetval->nodeNr; for (lpc = 0; lpc < max; lpc++) { xmlNode *rsc_op = getXpathResult(xpathObj, lpc); handle_rsc_op(rsc_op); } } if (xpathObj) { xmlXPathFreeObject(xpathObj); } } if ((now - last_refresh) > (reconnect_msec / 1000)) { /* Force a refresh */ mon_refresh_display(NULL); } else { mainloop_set_trigger(refresh_trigger);
0
12,499
void CameraSource::signalBufferReturned(MediaBuffer *buffer) { ALOGV("signalBufferReturned: %p", buffer->data()); Mutex::Autolock autoLock(mLock); for (List<sp<IMemory> >::iterator it = mFramesBeingEncoded.begin(); it != mFramesBeingEncoded.end(); ++it) { if ((*it)->pointer() == buffer->data()) { releaseOneRecordingFrame((*it)); mFramesBeingEncoded.erase(it); ++mNumFramesEncoded; buffer->setObserver(0); buffer->release(); mFrameCompleteCondition.signal(); return; } } CHECK(!"signalBufferReturned: bogus buffer"); }
1
502,512
static NTSTATUS pdb_samba_dsdb_lookup_names(struct pdb_methods *m, const struct dom_sid *domain_sid, int num_names, const char **pp_names, uint32_t *rids, enum lsa_SidType *attrs) { return NT_STATUS_NOT_IMPLEMENTED; }
0
270,639
static void r_coresym_cache_element_line_info_fini(RCoreSymCacheElementLineInfo *line) { if (line) { r_coresym_cache_element_flc_fini (&line->flc); } }
0
377,992
static void dn_dev_timer_func(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; struct dn_dev *dn_db; struct dn_ifaddr *ifa; rcu_read_lock(); dn_db = rcu_dereference(dev->dn_ptr); if (dn_db->t3 <= dn_db->parms.t2) { if (dn_db->parms.timer3) { for (ifa = rcu_dereference(dn_db->ifa_list); ifa; ifa = rcu_dereference(ifa->ifa_next)) { if (!(ifa->ifa_flags & IFA_F_SECONDARY)) dn_db->parms.timer3(dev, ifa); } } dn_db->t3 = dn_db->parms.t3; } else { dn_db->t3 -= dn_db->parms.t2; } rcu_read_unlock(); dn_dev_set_timer(dev); }
0
145
static void _UTF16LEFromUnicodeWithOffsets ( UConverterFromUnicodeArgs * pArgs , UErrorCode * pErrorCode ) { UConverter * cnv ; const UChar * source ; char * target ; int32_t * offsets ; uint32_t targetCapacity , length , sourceIndex ; UChar c , trail ; char overflow [ 4 ] ; source = pArgs -> source ; length = ( int32_t ) ( pArgs -> sourceLimit - source ) ; if ( length <= 0 ) { return ; } cnv = pArgs -> converter ; if ( cnv -> fromUnicodeStatus == UCNV_NEED_TO_WRITE_BOM ) { static const char bom [ ] = { ( char ) 0xff , ( char ) 0xfe } ; ucnv_fromUWriteBytes ( cnv , bom , 2 , & pArgs -> target , pArgs -> targetLimit , & pArgs -> offsets , - 1 , pErrorCode ) ; cnv -> fromUnicodeStatus = 0 ; } target = pArgs -> target ; if ( target >= pArgs -> targetLimit ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return ; } targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - pArgs -> target ) ; offsets = pArgs -> offsets ; sourceIndex = 0 ; if ( ( c = ( UChar ) cnv -> fromUChar32 ) != 0 && U16_IS_TRAIL ( trail = * source ) && targetCapacity >= 4 ) { ++ source ; -- length ; target [ 0 ] = ( uint8_t ) c ; target [ 1 ] = ( uint8_t ) ( c >> 8 ) ; target [ 2 ] = ( uint8_t ) trail ; target [ 3 ] = ( uint8_t ) ( trail >> 8 ) ; target += 4 ; targetCapacity -= 4 ; if ( offsets != NULL ) { * offsets ++ = - 1 ; * offsets ++ = - 1 ; * offsets ++ = - 1 ; * offsets ++ = - 1 ; } sourceIndex = 1 ; cnv -> fromUChar32 = c = 0 ; } if ( c == 0 ) { uint32_t count = 2 * length ; if ( count > targetCapacity ) { count = targetCapacity & ~ 1 ; } targetCapacity -= count ; count >>= 1 ; length -= count ; if ( offsets == NULL ) { while ( count > 0 ) { c = * source ++ ; if ( U16_IS_SINGLE ( c ) ) { target [ 0 ] = ( uint8_t ) c ; target [ 1 ] = ( uint8_t ) ( c >> 8 ) ; target += 2 ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = * source ) ) { ++ source ; -- count ; target [ 0 ] = ( uint8_t ) c ; target [ 1 ] = ( uint8_t ) ( c >> 8 ) ; target [ 2 ] = ( uint8_t ) trail ; target [ 3 ] = ( uint8_t ) ( trail >> 8 ) ; target += 4 ; } else { break ; } -- count ; } } else { while ( count > 0 ) { c = * source ++ ; if ( U16_IS_SINGLE ( c ) ) { target [ 0 ] = ( uint8_t ) c ; target [ 1 ] = ( uint8_t ) ( c >> 8 ) ; target += 2 ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ++ ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = * source ) ) { ++ source ; -- count ; target [ 0 ] = ( uint8_t ) c ; target [ 1 ] = ( uint8_t ) ( c >> 8 ) ; target [ 2 ] = ( uint8_t ) trail ; target [ 3 ] = ( uint8_t ) ( trail >> 8 ) ; target += 4 ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; sourceIndex += 2 ; } else { break ; } -- count ; } } if ( count == 0 ) { if ( length > 0 && targetCapacity > 0 ) { if ( U16_IS_SINGLE ( c = * source ++ ) ) { overflow [ 0 ] = ( char ) c ; overflow [ 1 ] = ( char ) ( c >> 8 ) ; length = 2 ; c = 0 ; } } else { length = 0 ; c = 0 ; } } else { targetCapacity += 2 * count ; } } else { length = 0 ; } if ( c != 0 ) { length = 0 ; if ( U16_IS_SURROGATE_LEAD ( c ) ) { if ( source < pArgs -> sourceLimit ) { if ( U16_IS_TRAIL ( trail = * source ) ) { ++ source ; overflow [ 0 ] = ( char ) c ; overflow [ 1 ] = ( char ) ( c >> 8 ) ; overflow [ 2 ] = ( char ) trail ; overflow [ 3 ] = ( char ) ( trail >> 8 ) ; length = 4 ; c = 0 ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } else { } } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } cnv -> fromUChar32 = c ; } if ( length > 0 ) { ucnv_fromUWriteBytes ( cnv , overflow , length , & target , pArgs -> targetLimit , & offsets , sourceIndex , pErrorCode ) ; targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - ( char * ) target ) ; } if ( U_SUCCESS ( * pErrorCode ) && source < pArgs -> sourceLimit && targetCapacity == 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } pArgs -> source = source ; pArgs -> target = target ; pArgs -> offsets = offsets ; }
1
467,982
static int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_sr_msg *sr = &req->sr_msg; if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->len = READ_ONCE(sqe->len); sr->bgid = READ_ONCE(sqe->buf_group); sr->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL; if (sr->msg_flags & MSG_DONTWAIT) req->flags |= REQ_F_NOWAIT; #ifdef CONFIG_COMPAT if (req->ctx->compat) sr->msg_flags |= MSG_CMSG_COMPAT; #endif return 0; }
0
297,290
static int ion_handle_put_nolock(struct ion_handle *handle) { int ret; ret = kref_put(&handle->ref, ion_handle_destroy); return ret; }
0
457,241
proxy_free (Proxy *py, unsigned finalize) { if (py) { if (finalize) p11_kit_modules_finalize (py->inited); free (py->inited); p11_dict_free (py->sessions); free (py->mappings); free (py); } }
0
266,111
void jslSeekTo(size_t seekToChar) { if (lex->it.var) jsvLockAgain(lex->it.var); // see jslGetNextCh jsvStringIteratorFree(&lex->it); jsvStringIteratorNew(&lex->it, lex->sourceVar, seekToChar); jsvUnLock(lex->it.var); // see jslGetNextCh lex->tokenStart.it.var = 0; lex->tokenStart.currCh = 0; jslPreload(); }
0
130,842
static inline ssize_t WriteBlobStream(Image *image,const size_t length, const unsigned char *data) { BlobInfo *magick_restrict blob_info; MagickSizeType extent; register unsigned char *q; assert(image->blob != (BlobInfo *) NULL); assert(image->blob->type != UndefinedStream); assert(data != (void *) NULL); blob_info=image->blob; if (blob_info->type != BlobStream) return(WriteBlob(image,length,data)); extent=(MagickSizeType) (blob_info->offset+(MagickOffsetType) length); if (extent >= blob_info->extent) { extent=blob_info->extent+blob_info->quantum+length; blob_info->quantum<<=1; if (SetBlobExtent(image,extent) == MagickFalse) return(0); } q=blob_info->data+blob_info->offset; (void) memcpy(q,data,length); blob_info->offset+=length; if (blob_info->offset >= (MagickOffsetType) blob_info->length) blob_info->length=(size_t) blob_info->offset; return((ssize_t) length); }
0
449,048
SRC_ActiveSources(void) { int i, r; for (i = r = 0; i < n_sources; i++) if (sources[i]->active) r++; return r; }
0
494,507
static const struct content_encoding *find_encoding(const char *name, size_t len) { const struct content_encoding * const *cep; for(cep = encodings; *cep; cep++) { const struct content_encoding *ce = *cep; if((strncasecompare(name, ce->name, len) && !ce->name[len]) || (ce->alias && strncasecompare(name, ce->alias, len) && !ce->alias[len])) return ce; } return NULL; }
0
403,097
TORRENT_TEST(dict_nonstring_key) { char b[] = "di5e1:ae"; bdecode_node e; error_code ec; int pos; int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos); TEST_EQUAL(ret, -1); TEST_EQUAL(pos, 1); TEST_EQUAL(ec, error_code(bdecode_errors::expected_digit)); printf("%s\n", print_entry(e).c_str()); }
0
175,203
error::Error GLES2DecoderPassthroughImpl::DoUseProgram(GLuint program) { api()->glUseProgramFn(GetProgramServiceID(program, resources_)); return error::kNoError; }
0
19,960
GSList * mainwindows_get_line ( MAIN_WINDOW_REC * rec ) { MAIN_WINDOW_REC * win ; GSList * list ; list = NULL ; for ( win = mainwindows_find_left ( rec , FALSE ) ; win != NULL ; win = mainwindows_find_left ( win , FALSE ) ) { list = g_slist_append ( list , win ) ; } if ( rec != NULL ) list = g_slist_append ( list , rec ) ; for ( win = mainwindows_find_right ( rec , FALSE ) ; win != NULL ; win = mainwindows_find_right ( win , FALSE ) ) { list = g_slist_append ( list , win ) ; } return list ; }
0
310,716
PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; if (RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX if (!noPanoramiXExtension && XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; int i; FOR_NSCREENS_FORWARD_SKIP(i) { if (RegionContainsPoint(&pSprite->windows[i]->borderSize, x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, &box)) return TRUE; } } #endif return FALSE; }
0
151,962
int CLASS nikon_is_compressed() { uchar test[256]; int i; fseek (ifp, data_offset, SEEK_SET); fread (test, 1, 256, ifp); for (i=15; i < 256; i+=16) if (test[i]) return 1; return 0; }
0
264,431
replace_param(char *buf, size_t max_len, char **multiline_ptr_ptr) { char *cur_pos = buf; size_t len_used = strlen(buf); def_t *def; char *s, *d, *e; ssize_t i; size_t extra_braces; size_t replacing_len; char *next_ptr = NULL; bool found_defn = false; char *multiline_ptr = *multiline_ptr_ptr; while ((cur_pos = strchr(cur_pos, '$')) && cur_pos[1] != '\0') { if ((def = find_definition(cur_pos + 1, 0, false))) { found_defn = true; extra_braces = cur_pos[1] == BOB[0] ? 2 : 0; next_ptr = multiline_ptr; /* We are in a multiline expansion, and now have another * one, so save the previous state on the multiline stack */ if (def->multiline && multiline_ptr) { if (!LIST_EXISTS(multiline_stack)) multiline_stack = alloc_list(NULL, NULL); list_add(multiline_stack, multiline_ptr); } if (def->fn) { /* This is a standard definition that uses a function for the replacement text */ if (def->value) FREE(def->value); def->value = (*def->fn)(); def->value_len = strlen(def->value); } /* Ensure there is enough room to replace $PARAM or ${PARAM} with value */ if (def->multiline) { replacing_len = strcspn(def->value, DEF_LINE_END); next_ptr = def->value + replacing_len + 1; multiline_ptr = next_ptr; } else replacing_len = def->value_len; if (len_used + replacing_len - (def->name_len + 1 + extra_braces) >= max_len) { log_message(LOG_INFO, "Parameter substitution on line '%s' would exceed maximum line length", buf); return NULL; } if (def->name_len + 1 + extra_braces != replacing_len) { /* We need to move the existing text */ if (def->name_len + 1 + extra_braces < replacing_len) { /* We are lengthening the buf text */ s = cur_pos + strlen(cur_pos); d = s - (def->name_len + 1 + extra_braces) + replacing_len; e = cur_pos; i = -1; } else { /* We are shortening the buf text */ s = cur_pos + (def->name_len + 1 + extra_braces) - replacing_len; d = cur_pos; e = cur_pos + strlen(cur_pos); i = 1; } do { *d = *s; if (s == e) break; d += i; s += i; } while (true); len_used = len_used + replacing_len - (def->name_len + 1 + extra_braces); } /* Now copy the replacement text */ strncpy(cur_pos, def->value, replacing_len); if (def->value[strspn(def->value, " \t")] == '~') break; } else cur_pos++; } /* If we did a replacement, update the multiline_ptr */ if (found_defn) *multiline_ptr_ptr = next_ptr; return found_defn; }
0
339,693
static BlockJob *find_block_job(const char *device, AioContext **aio_context, Error **errp) { BlockBackend *blk; BlockDriverState *bs; *aio_context = NULL; blk = blk_by_name(device); if (!blk) { goto notfound; } *aio_context = blk_get_aio_context(blk); aio_context_acquire(*aio_context); if (!blk_is_available(blk)) { goto notfound; } bs = blk_bs(blk); if (!bs->job) { goto notfound; } return bs->job; notfound: error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE, "No active block job on device '%s'", device); if (*aio_context) { aio_context_release(*aio_context); *aio_context = NULL; } return NULL; }
0
314,927
static int get_valid_interface(struct libusb_device_handle *dev_handle, int api_id) { struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle); struct windows_device_priv *priv = _device_priv(dev_handle->dev); int i; if ((api_id < USB_API_WINUSBX) || (api_id >= USB_API_MAX)) { usbi_dbg("unsupported API ID"); return -1; } for (i=0; i<USB_MAXINTERFACES; i++) { if ( (handle_priv->interface_handle[i].dev_handle != 0) && (handle_priv->interface_handle[i].dev_handle != INVALID_HANDLE_VALUE) && (handle_priv->interface_handle[i].api_handle != 0) && (handle_priv->interface_handle[i].api_handle != INVALID_HANDLE_VALUE) && (priv->usb_interface[i].apib->id == api_id) ) { return i; } } return -1; }
0
512,098
get_random_number () { int rv, pid; /* Reset for command and process substitution. */ pid = getpid (); if (subshell_environment && seeded_subshell != pid) { seedrand (); seeded_subshell = pid; } do rv = brand (); while (rv == last_random_value); return rv; }
0
152,123
dse_callback_new(int operation, int flags, const Slapi_DN *base, int scope, const char *filter, dseCallbackFn fn, void *fn_arg, struct slapdplugin *plugin) { struct dse_callback *p = NULL; p = (struct dse_callback *)slapi_ch_calloc(1, sizeof(struct dse_callback)); if (p != NULL) { p->operation = operation; p->flags = flags; p->base = slapi_sdn_dup(base); p->scope = scope; if (NULL == filter) { p->filter = NULL; p->slapifilter = NULL; } else { p->filter = slapi_ch_strdup(filter); p->slapifilter = slapi_str2filter(p->filter); filter_normalize(p->slapifilter); } p->fn = fn; p->fn_arg = fn_arg; p->plugin = plugin; p->next = NULL; } return p; }
0
394,640
isoent_traverse_tree(struct archive_write *a, struct vdd* vdd) { struct iso9660 *iso9660 = a->format_data; struct isoent *np; struct idr idr; int depth; int r; int (*genid)(struct archive_write *, struct isoent *, struct idr *); idr_init(iso9660, vdd, &idr); np = vdd->rootent; depth = 0; if (vdd->vdd_type == VDD_JOLIET) genid = isoent_gen_joliet_identifier; else genid = isoent_gen_iso9660_identifier; do { if (np->virtual && !archive_entry_mtime_is_set(np->file->entry)) { /* Set properly times to virtual directory */ archive_entry_set_mtime(np->file->entry, iso9660->birth_time, 0); archive_entry_set_atime(np->file->entry, iso9660->birth_time, 0); archive_entry_set_ctime(np->file->entry, iso9660->birth_time, 0); } if (np->children.first != NULL) { if (vdd->vdd_type != VDD_JOLIET && !iso9660->opt.rr && depth + 1 >= vdd->max_depth) { if (np->children.cnt > 0) iso9660->directories_too_deep = np; } else { /* Generate Identifier */ r = genid(a, np, &idr); if (r < 0) goto exit_traverse_tree; r = isoent_make_sorted_files(a, np, &idr); if (r < 0) goto exit_traverse_tree; if (np->subdirs.first != NULL && depth + 1 < vdd->max_depth) { /* Enter to sub directories. */ np = np->subdirs.first; depth++; continue; } } } while (np != np->parent) { if (np->drnext == NULL) { /* Return to the parent directory. */ np = np->parent; depth--; } else { np = np->drnext; break; } } } while (np != np->parent); r = ARCHIVE_OK; exit_traverse_tree: idr_cleanup(&idr); return (r); }
0
499,184
static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { int ret; HEVCContext *s = avctx->priv_data; if (!avpkt->size) { ret = ff_hevc_output_frame(s, data, 1); if (ret < 0) return ret; *got_output = ret; return 0; } s->ref = NULL; ret = decode_nal_units(s, avpkt->data, avpkt->size); if (ret < 0) return ret; /* verify the SEI checksum */ if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded && s->is_md5) { ret = verify_md5(s, s->ref->frame); if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) { ff_hevc_unref_frame(s, s->ref, ~0); return ret; } } s->is_md5 = 0; if (s->is_decoded) { av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc); s->is_decoded = 0; } if (s->output_frame->buf[0]) { av_frame_move_ref(data, s->output_frame); *got_output = 1; } return avpkt->size; }
0
420,153
int sk_wait_data(struct sock *sk, long *timeo, const struct sk_buff *skb) { DEFINE_WAIT_FUNC(wait, woken_wake_function); int rc; add_wait_queue(sk_sleep(sk), &wait); sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); rc = sk_wait_event(sk, timeo, skb_peek_tail(&sk->sk_receive_queue) != skb, &wait); sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); remove_wait_queue(sk_sleep(sk), &wait); return rc; }
0
173,176
bool ShouldSendPinchGesture() { static bool pinch_allowed = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViewport) || CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch); return pinch_allowed; }
0
132,004
PJ_DEF(pj_status_t) pj_stun_msg_add_uint64_attr(pj_pool_t *pool, pj_stun_msg *msg, int attr_type, const pj_timestamp *value) { pj_stun_uint64_attr *attr = NULL; pj_status_t status; status = pj_stun_uint64_attr_create(pool, attr_type, value, &attr); if (status != PJ_SUCCESS) return status; return pj_stun_msg_add_attr(msg, &attr->hdr); }
0
269,351
client_message_generates_reply (Header *header) { switch (header->type) { case G_DBUS_MESSAGE_TYPE_METHOD_CALL: return (header->flags & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED) == 0; case G_DBUS_MESSAGE_TYPE_SIGNAL: case G_DBUS_MESSAGE_TYPE_METHOD_RETURN: case G_DBUS_MESSAGE_TYPE_ERROR: default: return FALSE; } }
0
133,194
yaffscache_objects_free(YAFFSFS_INFO *yfs) { if((yfs != NULL) && (yfs->cache_objects != NULL)){ YaffsCacheObject *obj = yfs->cache_objects; while(obj != NULL) { YaffsCacheObject *to_free = obj; YaffsCacheVersion *ver = obj->yco_latest; while(ver != NULL) { YaffsCacheVersion *v_to_free = ver; ver = ver->ycv_prior; free(v_to_free); } obj = obj->yco_next; free(to_free); } } }
0
55,480
int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short *buffer, int num_shorts) { float **outputs; int len = num_shorts / channels; int n=0; int z = f->channels; if (z > channels) z = channels; while (n < len) { int k = f->channel_buffer_end - f->channel_buffer_start; if (n+k >= len) k = len - n; if (k) convert_channels_short_interleaved(channels, buffer, f->channels, f->channel_buffers, f->channel_buffer_start, k); buffer += k*channels; n += k; f->channel_buffer_start += k; if (n == len) break; if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; } return n; }
0
445,435
TEST_P(DnsImplZeroTimeoutTest, Timeout) { server_->addHosts("some.good.domain", {"201.134.56.7"}, RecordType::A); EXPECT_NE(nullptr, resolveWithExpectations("some.good.domain", DnsLookupFamily::V4Only, DnsResolver::ResolutionStatus::Failure, {}, {}, absl::nullopt)); dispatcher_->run(Event::Dispatcher::RunType::Block); }
0
362,923
static inline void sk_refcnt_debug_release(const struct sock *sk) { if (atomic_read(&sk->sk_refcnt) != 1) printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n", sk->sk_prot->name, sk, atomic_read(&sk->sk_refcnt)); }
0
108,482
error_t rza1EthUpdateMacAddrFilter(NetInterface *interface) { uint_t i; volatile uint32_t *addrHigh; volatile uint32_t *addrLow; MacFilterEntry *entry; //Debug message TRACE_DEBUG("Updating MAC filter...\r\n"); //Set the upper 32 bits of the MAC address ETHER.MAHR0 = (interface->macAddr.b[0] << 24) | (interface->macAddr.b[1] << 16) | (interface->macAddr.b[2] << 8) | interface->macAddr.b[3]; //Set the lower 16 bits of the MAC address ETHER.MALR0 = (interface->macAddr.b[4] << 8) | interface->macAddr.b[5]; //The MAC address filter contains the list of MAC addresses to accept //when receiving an Ethernet frame for(i = 0; i < MAC_ADDR_FILTER_SIZE && i < 32; i++) { //Point to the current entry entry = &interface->macAddrFilter[i]; //Valid entry? if(entry->refCount > 0) { //Debug message TRACE_DEBUG(" %s\r\n", macAddrToString(&entry->addr, NULL)); //Point to the CAM entry registers addrHigh = &ETHER.TSU_ADRH0 + 2 * i; addrLow = &ETHER.TSU_ADRL0 + 2 * i; //The contents of the CAM entry table registers cannot be //modified while the ADSBSY flag is set while((ETHER.TSU_ADSBSY & ETHER_TSU_ADSBSY_ADSBSY) != 0) { } //Set the upper 32 bits of the MAC address *addrHigh = (entry->addr.b[0] << 24) | (entry->addr.b[1] << 16) | (entry->addr.b[2] << 8) | entry->addr.b[3]; //Wait for the ADSBSY flag to be cleared while((ETHER.TSU_ADSBSY & ETHER_TSU_ADSBSY_ADSBSY) != 0) { } //Set the lower 16 bits of the MAC address *addrLow = (entry->addr.b[4] << 8) | entry->addr.b[5]; //Enable the CAM entry ETHER.TSU_TEN |= 1 << (31 - i); } else { //Disable the CAM entry ETHER.TSU_TEN &= ~(1 << (31 - i)); } } //Successful processing return NO_ERROR; }
0
119,522
u32 gf_isom_sample_get_subsamples_count(GF_ISOFile *movie, u32 track) { GF_TrackBox *trak = gf_isom_get_track_from_file(movie, track); if (!track) return 0; if (!trak->Media || !trak->Media->information->sampleTable || !trak->Media->information->sampleTable->sub_samples) return 0; return gf_list_count(trak->Media->information->sampleTable->sub_samples); }
0
468,538
ConnStateData::getSslContextDone(Security::ContextPointer &ctx) { if (port->secure.generateHostCertificates && !ctx) { debugs(33, 2, "Failed to generate TLS context for " << tlsConnectHostOrIp); } // If generated ssl context = NULL, try to use static ssl context. if (!ctx) { if (!port->secure.staticContext) { debugs(83, DBG_IMPORTANT, "Closing " << clientConnection->remote << " as lacking TLS context"); clientConnection->close(); return; } else { debugs(33, 5, "Using static TLS context."); ctx = port->secure.staticContext; } } if (!httpsCreate(this, ctx)) return; // bumped intercepted conns should already have Config.Timeout.request set // but forwarded connections may only have Config.Timeout.lifetime. [Re]set // to make sure the connection does not get stuck on non-SSL clients. resetReadTimeout(Config.Timeout.request); switchedToHttps_ = true; auto ssl = fd_table[clientConnection->fd].ssl.get(); BIO *b = SSL_get_rbio(ssl); Ssl::ClientBio *bio = static_cast<Ssl::ClientBio *>(BIO_get_data(b)); bio->setReadBufData(inBuf); inBuf.clear(); clientNegotiateSSL(clientConnection->fd, this); }
0
17,488
int ff_h263_decode_picture_header ( MpegEncContext * s ) { int format , width , height , i ; uint32_t startcode ; align_get_bits ( & s -> gb ) ; startcode = get_bits ( & s -> gb , 22 - 8 ) ; for ( i = get_bits_left ( & s -> gb ) ; i > 24 ; i -= 8 ) { startcode = ( ( startcode << 8 ) | get_bits ( & s -> gb , 8 ) ) & 0x003FFFFF ; if ( startcode == 0x20 ) break ; } if ( startcode != 0x20 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Bad picture start code\n" ) ; return - 1 ; } i = get_bits ( & s -> gb , 8 ) ; if ( ( s -> picture_number & ~ 0xFF ) + i < s -> picture_number ) i += 256 ; s -> current_picture_ptr -> f . pts = s -> picture_number = ( s -> picture_number & ~ 0xFF ) + i ; if ( get_bits1 ( & s -> gb ) != 1 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Bad marker\n" ) ; return - 1 ; } if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Bad H263 id\n" ) ; return - 1 ; } skip_bits1 ( & s -> gb ) ; skip_bits1 ( & s -> gb ) ; skip_bits1 ( & s -> gb ) ; format = get_bits ( & s -> gb , 3 ) ; if ( format != 7 && format != 6 ) { s -> h263_plus = 0 ; width = ff_h263_format [ format ] [ 0 ] ; height = ff_h263_format [ format ] [ 1 ] ; if ( ! width ) return - 1 ; s -> pict_type = AV_PICTURE_TYPE_I + get_bits1 ( & s -> gb ) ; s -> h263_long_vectors = get_bits1 ( & s -> gb ) ; if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "H263 SAC not supported\n" ) ; return - 1 ; } s -> obmc = get_bits1 ( & s -> gb ) ; s -> unrestricted_mv = s -> h263_long_vectors || s -> obmc ; s -> pb_frame = get_bits1 ( & s -> gb ) ; s -> chroma_qscale = s -> qscale = get_bits ( & s -> gb , 5 ) ; skip_bits1 ( & s -> gb ) ; s -> width = width ; s -> height = height ; s -> avctx -> sample_aspect_ratio = ( AVRational ) { 12 , 11 } ; s -> avctx -> time_base = ( AVRational ) { 1001 , 30000 } ; } else { int ufep ; s -> h263_plus = 1 ; ufep = get_bits ( & s -> gb , 3 ) ; if ( ufep == 1 ) { format = get_bits ( & s -> gb , 3 ) ; av_dlog ( s -> avctx , "ufep=1, format: %d\n" , format ) ; s -> custom_pcf = get_bits1 ( & s -> gb ) ; s -> umvplus = get_bits1 ( & s -> gb ) ; if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Syntax-based Arithmetic Coding (SAC) not supported\n" ) ; } s -> obmc = get_bits1 ( & s -> gb ) ; s -> h263_aic = get_bits1 ( & s -> gb ) ; s -> loop_filter = get_bits1 ( & s -> gb ) ; s -> unrestricted_mv = s -> umvplus || s -> obmc || s -> loop_filter ; s -> h263_slice_structured = get_bits1 ( & s -> gb ) ; if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Reference Picture Selection not supported\n" ) ; } if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Independent Segment Decoding not supported\n" ) ; } s -> alt_inter_vlc = get_bits1 ( & s -> gb ) ; s -> modified_quant = get_bits1 ( & s -> gb ) ; if ( s -> modified_quant ) s -> chroma_qscale_table = ff_h263_chroma_qscale_table ; skip_bits ( & s -> gb , 1 ) ; skip_bits ( & s -> gb , 3 ) ; } else if ( ufep != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Bad UFEP type (%d)\n" , ufep ) ; return - 1 ; } s -> pict_type = get_bits ( & s -> gb , 3 ) ; switch ( s -> pict_type ) { case 0 : s -> pict_type = AV_PICTURE_TYPE_I ; break ; case 1 : s -> pict_type = AV_PICTURE_TYPE_P ; break ; case 2 : s -> pict_type = AV_PICTURE_TYPE_P ; s -> pb_frame = 3 ; break ; case 3 : s -> pict_type = AV_PICTURE_TYPE_B ; break ; case 7 : s -> pict_type = AV_PICTURE_TYPE_I ; break ; default : return - 1 ; } skip_bits ( & s -> gb , 2 ) ; s -> no_rounding = get_bits1 ( & s -> gb ) ; skip_bits ( & s -> gb , 4 ) ; if ( ufep ) { if ( format == 6 ) { s -> aspect_ratio_info = get_bits ( & s -> gb , 4 ) ; av_dlog ( s -> avctx , "aspect: %d\n" , s -> aspect_ratio_info ) ; width = ( get_bits ( & s -> gb , 9 ) + 1 ) * 4 ; skip_bits1 ( & s -> gb ) ; height = get_bits ( & s -> gb , 9 ) * 4 ; av_dlog ( s -> avctx , "\nH.263+ Custom picture: %dx%d\n" , width , height ) ; if ( s -> aspect_ratio_info == FF_ASPECT_EXTENDED ) { s -> avctx -> sample_aspect_ratio . num = get_bits ( & s -> gb , 8 ) ; s -> avctx -> sample_aspect_ratio . den = get_bits ( & s -> gb , 8 ) ; } else { s -> avctx -> sample_aspect_ratio = ff_h263_pixel_aspect [ s -> aspect_ratio_info ] ; } } else { width = ff_h263_format [ format ] [ 0 ] ; height = ff_h263_format [ format ] [ 1 ] ; s -> avctx -> sample_aspect_ratio = ( AVRational ) { 12 , 11 } ; } if ( ( width == 0 ) || ( height == 0 ) ) return - 1 ; s -> width = width ; s -> height = height ; if ( s -> custom_pcf ) { int gcd ; s -> avctx -> time_base . den = 1800000 ; s -> avctx -> time_base . num = 1000 + get_bits1 ( & s -> gb ) ; s -> avctx -> time_base . num *= get_bits ( & s -> gb , 7 ) ; if ( s -> avctx -> time_base . num == 0 ) { av_log ( s , AV_LOG_ERROR , "zero framerate\n" ) ; return - 1 ; } gcd = av_gcd ( s -> avctx -> time_base . den , s -> avctx -> time_base . num ) ; s -> avctx -> time_base . den /= gcd ; s -> avctx -> time_base . num /= gcd ; } else { s -> avctx -> time_base = ( AVRational ) { 1001 , 30000 } ; } } if ( s -> custom_pcf ) { skip_bits ( & s -> gb , 2 ) ; } if ( ufep ) { if ( s -> umvplus ) { if ( get_bits1 ( & s -> gb ) == 0 ) skip_bits1 ( & s -> gb ) ; } if ( s -> h263_slice_structured ) { if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "rectangular slices not supported\n" ) ; } if ( get_bits1 ( & s -> gb ) != 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "unordered slices not supported\n" ) ; } } } s -> qscale = get_bits ( & s -> gb , 5 ) ; } s -> mb_width = ( s -> width + 15 ) / 16 ; s -> mb_height = ( s -> height + 15 ) / 16 ; s -> mb_num = s -> mb_width * s -> mb_height ; if ( s -> pb_frame ) { skip_bits ( & s -> gb , 3 ) ; if ( s -> custom_pcf ) skip_bits ( & s -> gb , 2 ) ; skip_bits ( & s -> gb , 2 ) ; } if ( s -> pict_type != AV_PICTURE_TYPE_B ) { s -> time = s -> picture_number ; s -> pp_time = s -> time - s -> last_non_b_time ; s -> last_non_b_time = s -> time ; } else { s -> time = s -> picture_number ; s -> pb_time = s -> pp_time - ( s -> last_non_b_time - s -> time ) ; if ( s -> pp_time <= s -> pb_time || s -> pp_time <= s -> pp_time - s -> pb_time || s -> pp_time <= 0 ) { s -> pp_time = 2 ; s -> pb_time = 1 ; } ff_mpeg4_init_direct_mv ( s ) ; } while ( get_bits1 ( & s -> gb ) != 0 ) { skip_bits ( & s -> gb , 8 ) ; } if ( s -> h263_slice_structured ) { if ( get_bits1 ( & s -> gb ) != 1 ) { av_log ( s -> avctx , AV_LOG_ERROR , "SEPB1 marker missing\n" ) ; return - 1 ; } ff_h263_decode_mba ( s ) ; if ( get_bits1 ( & s -> gb ) != 1 ) { av_log ( s -> avctx , AV_LOG_ERROR , "SEPB2 marker missing\n" ) ; return - 1 ; } } s -> f_code = 1 ; if ( s -> h263_aic ) { s -> y_dc_scale_table = s -> c_dc_scale_table = ff_aic_dc_scale_table ; } else { s -> y_dc_scale_table = s -> c_dc_scale_table = ff_mpeg1_dc_scale_table ; } ff_h263_show_pict_info ( s ) ; if ( s -> pict_type == AV_PICTURE_TYPE_I && s -> codec_tag == AV_RL32 ( "ZYGO" ) ) { int i , j ; for ( i = 0 ; i < 85 ; i ++ ) av_log ( s -> avctx , AV_LOG_DEBUG , "%d" , get_bits1 ( & s -> gb ) ) ; av_log ( s -> avctx , AV_LOG_DEBUG , "\n" ) ; for ( i = 0 ; i < 13 ; i ++ ) { for ( j = 0 ; j < 3 ; j ++ ) { int v = get_bits ( & s -> gb , 8 ) ; v |= get_sbits ( & s -> gb , 8 ) << 8 ; av_log ( s -> avctx , AV_LOG_DEBUG , " %5d" , v ) ; } av_log ( s -> avctx , AV_LOG_DEBUG , "\n" ) ; } for ( i = 0 ; i < 50 ; i ++ ) av_log ( s -> avctx , AV_LOG_DEBUG , "%d" , get_bits1 ( & s -> gb ) ) ; } return 0 ; }
0
496,902
static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, RE_LEX_ENVIRONMENT *lex_env) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, lex_env);
0
460,912
void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *client) { MainChannelClient *mcc; spice_debug("%p", client); mcc = client->get_main(); // TODO: not doing net test. consider doing it on client_migrate_info mcc->push_init(reds->qxl_instances.size(), reds->mouse_mode, reds->is_client_mouse_allowed, reds_get_mm_time() - MM_TIME_DELTA, reds_qxl_ram_size(reds)); reds_link_mig_target_channels(reds, client); mcc->migrate_dst_complete(); }
0
381,396
static struct connectdata *allocate_conn(struct SessionHandle *data) { struct connectdata *conn = calloc(1, sizeof(struct connectdata)); if(!conn) return NULL; conn->handler = &Curl_handler_dummy; /* Be sure we have a handler defined already from start to avoid NULL situations and checks */ /* and we setup a few fields in case we end up actually using this struct */ conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ conn->tempsock[0] = CURL_SOCKET_BAD; /* no file descriptor */ conn->tempsock[1] = CURL_SOCKET_BAD; /* no file descriptor */ conn->connection_id = -1; /* no ID */ conn->port = -1; /* unknown at this point */ conn->remote_port = -1; /* unknown */ /* Default protocol-independent behavior doesn't support persistent connections, so we set this to force-close. Protocols that support this need to set this to FALSE in their "curl_do" functions. */ connclose(conn, "Default to force-close"); /* Store creation time to help future close decision making */ conn->created = Curl_tvnow(); conn->data = data; /* Setup the association between this connection and the SessionHandle */ conn->proxytype = data->set.proxytype; /* type */ #ifdef CURL_DISABLE_PROXY conn->bits.proxy = FALSE; conn->bits.httpproxy = FALSE; conn->bits.proxy_user_passwd = FALSE; conn->bits.tunnel_proxy = FALSE; #else /* CURL_DISABLE_PROXY */ /* note that these two proxy bits are now just on what looks to be requested, they may be altered down the road */ conn->bits.proxy = (data->set.str[STRING_PROXY] && *data->set.str[STRING_PROXY])?TRUE:FALSE; conn->bits.httpproxy = (conn->bits.proxy && (conn->proxytype == CURLPROXY_HTTP || conn->proxytype == CURLPROXY_HTTP_1_0))?TRUE:FALSE; conn->bits.proxy_user_passwd = (NULL != data->set.str[STRING_PROXYUSERNAME])?TRUE:FALSE; conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy; #endif /* CURL_DISABLE_PROXY */ conn->bits.user_passwd = (NULL != data->set.str[STRING_USERNAME])?TRUE:FALSE; conn->bits.ftp_use_epsv = data->set.ftp_use_epsv; conn->bits.ftp_use_eprt = data->set.ftp_use_eprt; conn->verifypeer = data->set.ssl.verifypeer; conn->verifyhost = data->set.ssl.verifyhost; conn->ip_version = data->set.ipver; #if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \ defined(NTLM_WB_ENABLED) conn->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD; conn->ntlm_auth_hlpr_pid = 0; conn->challenge_header = NULL; conn->response_header = NULL; #endif if(Curl_multi_pipeline_enabled(data->multi) && !conn->master_buffer) { /* Allocate master_buffer to be used for pipelining */ conn->master_buffer = calloc(BUFSIZE, sizeof (char)); if(!conn->master_buffer) goto error; } /* Initialize the pipeline lists */ conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); if(!conn->send_pipe || !conn->recv_pipe) goto error; #ifdef HAVE_GSSAPI conn->data_prot = PROT_CLEAR; #endif /* Store the local bind parameters that will be used for this connection */ if(data->set.str[STRING_DEVICE]) { conn->localdev = strdup(data->set.str[STRING_DEVICE]); if(!conn->localdev) goto error; } conn->localportrange = data->set.localportrange; conn->localport = data->set.localport; /* the close socket stuff needs to be copied to the connection struct as it may live on without (this specific) SessionHandle */ conn->fclosesocket = data->set.fclosesocket; conn->closesocket_client = data->set.closesocket_client; return conn; error: Curl_llist_destroy(conn->send_pipe, NULL); Curl_llist_destroy(conn->recv_pipe, NULL); conn->send_pipe = NULL; conn->recv_pipe = NULL; Curl_safefree(conn->master_buffer); Curl_safefree(conn->localdev); Curl_safefree(conn); return NULL; }
0
412,846
xfs_bmap_one_block( xfs_inode_t *ip, /* incore inode */ int whichfork) /* data or attr fork */ { xfs_ifork_t *ifp; /* inode fork pointer */ int rval; /* return value */ xfs_bmbt_irec_t s; /* internal version of extent */ struct xfs_iext_cursor icur; #ifndef DEBUG if (whichfork == XFS_DATA_FORK) return XFS_ISIZE(ip) == ip->i_mount->m_sb.sb_blocksize; #endif /* !DEBUG */ if (XFS_IFORK_NEXTENTS(ip, whichfork) != 1) return 0; if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) return 0; ifp = XFS_IFORK_PTR(ip, whichfork); ASSERT(ifp->if_flags & XFS_IFEXTENTS); xfs_iext_first(ifp, &icur); xfs_iext_get_extent(ifp, &icur, &s); rval = s.br_startoff == 0 && s.br_blockcount == 1; if (rval && whichfork == XFS_DATA_FORK) ASSERT(XFS_ISIZE(ip) == ip->i_mount->m_sb.sb_blocksize); return rval; }
0
300,002
static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi) { int fd; struct lo_data *lo = lo_data(req); struct lo_inode *parent_inode; struct fuse_entry_param e; int err; struct lo_cred old = {}; fuse_log(FUSE_LOG_DEBUG, "lo_create(parent=%" PRIu64 ", name=%s)\n", parent, name); if (!is_safe_path_component(name)) { fuse_reply_err(req, EINVAL); return; } parent_inode = lo_inode(req, parent); if (!parent_inode) { fuse_reply_err(req, EBADF); return; } err = lo_change_cred(req, &old); if (err) { goto out; } update_open_flags(lo->writeback, lo->allow_direct_io, fi); fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW, mode); err = fd == -1 ? errno : 0; lo_restore_cred(&old); if (!err) { ssize_t fh; pthread_mutex_lock(&lo->mutex); fh = lo_add_fd_mapping(req, fd); pthread_mutex_unlock(&lo->mutex); if (fh == -1) { close(fd); err = ENOMEM; goto out; } fi->fh = fh; err = lo_do_lookup(req, parent, name, &e); } if (lo->cache == CACHE_NONE) { fi->direct_io = 1; } else if (lo->cache == CACHE_ALWAYS) { fi->keep_cache = 1; } out: lo_inode_put(lo, &parent_inode); if (err) { fuse_reply_err(req, err); } else { fuse_reply_create(req, &e, fi); } }
0
458,503
dp_packet_batch_refill_init(struct dp_packet_batch *batch) { batch->count = 0; };
0
361,192
int smb_vfs_call_lchown(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) { VFS_FIND(lchown); return handle->fns->lchown(handle, path, uid, gid); }
0
479,169
static bool is_finite(const cimg_int64) { return true; }
0
520,553
Item_int(THD *thd, longlong i,size_t length= MY_INT64_NUM_DECIMAL_DIGITS): Item_num(thd), value(i) { max_length=(uint32)length; }
0
312,735
void kvm_arch_commit_memory_region(struct kvm *kvm, struct kvm_userspace_memory_region *mem, struct kvm_memory_slot old, int user_alloc) { return; }
0
124,713
static void lock_mnt_tree(struct mount *mnt) { struct mount *p; for (p = mnt; p; p = next_mnt(p, mnt)) { int flags = p->mnt.mnt_flags; /* Don't allow unprivileged users to change mount flags */ flags |= MNT_LOCK_ATIME; if (flags & MNT_READONLY) flags |= MNT_LOCK_READONLY; if (flags & MNT_NODEV) flags |= MNT_LOCK_NODEV; if (flags & MNT_NOSUID) flags |= MNT_LOCK_NOSUID; if (flags & MNT_NOEXEC) flags |= MNT_LOCK_NOEXEC; /* Don't allow unprivileged users to reveal what is under a mount */ if (list_empty(&p->mnt_expire)) flags |= MNT_LOCKED; p->mnt.mnt_flags = flags; } }
0
470,288
static void textview_write_line(TextView *textview, const gchar *str, CodeConverter *conv, gboolean do_quote_folding) { GtkTextView *text; GtkTextBuffer *buffer; GtkTextIter iter; gchar buf[BUFFSIZE]; gchar *fg_color; gint quotelevel = -1, real_quotelevel = -1; gchar quote_tag_str[10]; text = GTK_TEXT_VIEW(textview->text); buffer = gtk_text_view_get_buffer(text); gtk_text_buffer_get_end_iter(buffer, &iter); if (!conv) strncpy2(buf, str, sizeof(buf)); else if (conv_convert(conv, buf, sizeof(buf), str) < 0) conv_localetodisp(buf, sizeof(buf), str); strcrchomp(buf); fg_color = NULL; /* change color of quotation >, foo>, _> ... ok, <foo>, foo bar>, foo-> ... ng Up to 3 levels of quotations are detected, and each level is colored using a different color. */ if (prefs_common.enable_color && !textview->is_attachment && line_has_quote_char(buf, prefs_common.quote_chars)) { real_quotelevel = get_quote_level(buf, prefs_common.quote_chars); quotelevel = real_quotelevel; /* set up the correct foreground color */ if (quotelevel > 2) { /* recycle colors */ if (prefs_common.recycle_quote_colors) quotelevel %= 3; else quotelevel = 2; } } if (quotelevel == -1) fg_color = NULL; else { g_snprintf(quote_tag_str, sizeof(quote_tag_str), "quote%d", quotelevel); fg_color = quote_tag_str; } if (prefs_common.enable_color) { if (textview->is_diff || textview->is_in_git_patch) { if (strncmp(buf, "+++ ", 4) == 0) fg_color = "diff-add-file"; else if (buf[0] == '+') fg_color = "diff-add"; else if (strncmp(buf, "--- ", 4) == 0) fg_color = "diff-del-file"; else if (buf[0] == '-') fg_color = "diff-del"; else if (strncmp(buf, "@@ ", 3) == 0 && strstr(&buf[3], " @@")) fg_color = "diff-hunk"; if (account_sigsep_matchlist_nchar_found(buf, "%s\n")) { textview->is_in_git_patch = FALSE; textview->is_in_signature = TRUE; fg_color = "signature"; } } else if (account_sigsep_matchlist_str_found(buf, "%s\n") || account_sigsep_matchlist_str_found(buf, "- %s\n") || textview->is_in_signature) { fg_color = "signature"; textview->is_in_signature = TRUE; } else if (strncmp(buf, "diff --git ", 11) == 0) { textview->is_in_git_patch = TRUE; } } if (!textview->is_attachment && real_quotelevel > -1 && do_quote_folding) { if (!g_utf8_validate(buf, -1, NULL)) { gchar *utf8buf = NULL; utf8buf = g_malloc(BUFFSIZE); conv_localetodisp(utf8buf, BUFFSIZE, buf); strncpy2(buf, utf8buf, BUFFSIZE-1); g_free(utf8buf); } do_quote: if ( textview->prev_quote_level != real_quotelevel ) { ClickableText *uri; uri = g_new0(ClickableText, 1); uri->uri = g_strdup(""); uri->data = g_strdup(buf); uri->data_len = strlen(uri->data); uri->start = gtk_text_iter_get_offset(&iter); uri->is_quote = TRUE; uri->quote_level = real_quotelevel; uri->fg_color = g_strdup(fg_color); gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, " [...]", -1, "qlink", fg_color, NULL); uri->end = gtk_text_iter_get_offset(&iter); gtk_text_buffer_insert(buffer, &iter, " \n", -1); uri->filename = NULL; textview->uri_list = g_slist_prepend(textview->uri_list, uri); textview->prev_quote_level = real_quotelevel; } else { GSList *last = textview->uri_list; ClickableText *lasturi = NULL; gint e_len = 0, n_len = 0; if (textview->uri_list) { lasturi = (ClickableText *)last->data; } else { g_print("oops (%d %d)\n", real_quotelevel, textview->prev_quote_level); } if (lasturi) { if (lasturi->is_quote == FALSE) { textview->prev_quote_level = -1; goto do_quote; } e_len = lasturi->data ? lasturi->data_len:0; n_len = strlen(buf); lasturi->data = g_realloc((gchar *)lasturi->data, e_len + n_len + 1); strcpy((gchar *)lasturi->data + e_len, buf); *((gchar *)lasturi->data + e_len + n_len) = '\0'; lasturi->data_len += n_len; } } } else { textview_make_clickable_parts(textview, fg_color, "link", buf, FALSE); textview->prev_quote_level = -1; } }
0
522,292
Partition_read_cursor(THD *thd, SQL_I_List<ORDER> *partition_list) : bound_tracker(thd, partition_list) {}
0
287,685
int CLASS parse_tiff_ifd (int base) { unsigned entries, tag, type, len, plen=16, save; int ifd, use_cm=0, cfa, i, j, c, ima_len=0; int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; char software[64], *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; double ab[]={ 1,1,1,1 }, asn[] = { 0,0,0,0 }, xyz[] = { 1,1,1 }; unsigned sony_curve[] = { 0,0,0,0,0,4095 }; unsigned *buf, sony_offset=0, sony_length=0, sony_key=0; struct jhead jh; #ifndef LIBRAW_LIBRARY_BUILD FILE *sfp; #endif if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0]) return 1; ifd = tiff_nifds++; for (j=0; j < 4; j++) for (i=0; i < 4; i++) cc[j][i] = i == j; entries = get2(); if (entries > 512) return 1; while (entries--) { tiff_get (base, &tag, &type, &len, &save); switch (tag) { case 5: width = get2(); break; case 6: height = get2(); break; case 7: width += get2(); break; case 9: filters = get2(); break; case 17: case 18: if (type == 3 && len == 1) cam_mul[(tag-17)*2] = get2() / 256.0; break; case 23: if (type == 3) iso_speed = get2(); break; case 36: case 37: case 38: cam_mul[tag-0x24] = get2(); break; case 39: if (len < 50 || cam_mul[0]) break; fseek (ifp, 12, SEEK_CUR); FORC3 cam_mul[c] = get2(); break; case 46: if (type != 7 || fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) break; thumb_offset = ftell(ifp) - 2; thumb_length = len; break; case 61440: /* Fuji HS10 table */ parse_tiff_ifd (base); break; case 2: case 256: case 61441: /* ImageWidth */ tiff_ifd[ifd].t_width = getint(type); break; case 3: case 257: case 61442: /* ImageHeight */ tiff_ifd[ifd].t_height = getint(type); break; case 258: /* BitsPerSample */ case 61443: tiff_ifd[ifd].samples = len & 7; tiff_ifd[ifd].bps = getint(type); break; case 61446: raw_height = 0; load_raw = &CLASS packed_load_raw; load_flags = get4() && (filters=0x16161616) ? 24:80; break; case 259: /* Compression */ tiff_ifd[ifd].comp = getint(type); break; case 262: /* PhotometricInterpretation */ tiff_ifd[ifd].phint = get2(); break; case 270: /* ImageDescription */ fread (desc, 512, 1, ifp); break; case 271: /* Make */ fgets (make, 64, ifp); break; case 272: /* Model */ fgets (model, 64, ifp); break; case 280: /* Panasonic RW2 offset */ if (type != 4) break; load_raw = &CLASS panasonic_load_raw; load_flags = 0x2008; case 273: /* StripOffset */ case 513: /* JpegIFOffset */ case 61447: tiff_ifd[ifd].offset = get4()+base; if (!tiff_ifd[ifd].bps && tiff_ifd[ifd].offset > 0) { fseek (ifp, tiff_ifd[ifd].offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { tiff_ifd[ifd].comp = 6; tiff_ifd[ifd].t_width = jh.wide; tiff_ifd[ifd].t_height = jh.high; tiff_ifd[ifd].bps = jh.bits; tiff_ifd[ifd].samples = jh.clrs; if (!(jh.sraw || (jh.clrs & 1))) tiff_ifd[ifd].t_width *= jh.clrs; i = order; parse_tiff (tiff_ifd[ifd].offset + 12); order = i; } } break; case 274: /* Orientation */ tiff_ifd[ifd].t_flip = "50132467"[get2() & 7]-'0'; break; case 277: /* SamplesPerPixel */ tiff_ifd[ifd].samples = getint(type) & 7; break; case 279: /* StripByteCounts */ case 514: case 61448: tiff_ifd[ifd].bytes = get4(); break; case 61454: FORC3 cam_mul[(4-c) % 3] = getint(type); break; case 305: case 11: /* Software */ fgets (software, 64, ifp); if (!strncmp(software,"Adobe",5) || !strncmp(software,"dcraw",5) || !strncmp(software,"UFRaw",5) || !strncmp(software,"Bibble",6) || !strncmp(software,"Nikon Scan",10) || !strcmp (software,"Digital Photo Professional")) is_raw = 0; break; case 306: /* DateTime */ get_timestamp(0); break; case 315: /* Artist */ fread (artist, 64, 1, ifp); break; case 322: /* TileWidth */ tiff_ifd[ifd].t_tile_width = getint(type); break; case 323: /* TileLength */ tiff_ifd[ifd].t_tile_length = getint(type); break; case 324: /* TileOffsets */ tiff_ifd[ifd].offset = len > 1 ? ftell(ifp) : get4(); if (len == 4) { load_raw = &CLASS sinar_4shot_load_raw; is_raw = 5; } break; #ifdef LIBRAW_LIBRARY_BUILD case 325: /* TileByteCount */ tiff_ifd[ifd].tile_maxbytes = 0; for(int jj=0;jj<len;jj++) { int s = get4(); if(s > tiff_ifd[ifd].tile_maxbytes) tiff_ifd[ifd].tile_maxbytes=s; } break; #endif case 330: /* SubIFDs */ if (!strcmp(model,"DSLR-A100") && tiff_ifd[ifd].t_width == 3872) { load_raw = &CLASS sony_arw_load_raw; data_offset = get4()+base; ifd++; break; } while (len--) { i = ftell(ifp); fseek (ifp, get4()+base, SEEK_SET); if (parse_tiff_ifd (base)) break; fseek (ifp, i+4, SEEK_SET); } break; case 400: strcpy (make, "Sarnoff"); maximum = 0xfff; break; case 28688: FORC4 sony_curve[c+1] = get2() >> 2 & 0xfff; for (i=0; i < 5; i++) for (j = sony_curve[i]+1; j <= sony_curve[i+1]; j++) curve[j] = curve[j-1] + (1 << i); break; case 29184: sony_offset = get4(); break; case 29185: sony_length = get4(); break; case 29217: sony_key = get4(); break; case 29264: parse_minolta (ftell(ifp)); raw_width = 0; break; case 29443: FORC4 cam_mul[c ^ (c < 2)] = get2(); break; case 29459: FORC4 cam_mul[c] = get2(); i = (cam_mul[1] == 1024 && cam_mul[2] == 1024) << 1; SWAP (cam_mul[i],cam_mul[i+1]) break; case 33405: /* Model2 */ fgets (model2, 64, ifp); break; case 33422: /* CFAPattern */ case 64777: /* Kodak P-series */ if ((plen=len) > 16) plen = 16; fread (cfa_pat, 1, plen, ifp); for (colors=cfa=i=0; i < plen; i++) { colors += !(cfa & (1 << cfa_pat[i])); cfa |= 1 << cfa_pat[i]; } if (cfa == 070) memcpy (cfa_pc,"\003\004\005",3); /* CMY */ if (cfa == 072) memcpy (cfa_pc,"\005\003\004\001",4); /* GMCY */ goto guess_cfa_pc; case 33424: case 65024: fseek (ifp, get4()+base, SEEK_SET); parse_kodak_ifd (base); break; case 33434: /* ExposureTime */ shutter = getreal(type); break; case 33437: /* FNumber */ aperture = getreal(type); break; case 34306: /* Leaf white balance */ FORC4 cam_mul[c ^ 1] = 4096.0 / get2(); break; case 34307: /* Leaf CatchLight color matrix */ fread (software, 1, 7, ifp); if (strncmp(software,"MATRIX",6)) break; colors = 4; for (raw_color = i=0; i < 3; i++) { FORC4 fscanf (ifp, "%f", &rgb_cam[i][c^1]); if (!use_camera_wb) continue; num = 0; FORC4 num += rgb_cam[i][c]; FORC4 rgb_cam[i][c] /= num; } break; case 34310: /* Leaf metadata */ parse_mos (ftell(ifp)); case 34303: strcpy (make, "Leaf"); break; case 34665: /* EXIF tag */ fseek (ifp, get4()+base, SEEK_SET); parse_exif (base); break; case 34853: /* GPSInfo tag */ fseek (ifp, get4()+base, SEEK_SET); parse_gps (base); break; case 34675: /* InterColorProfile */ case 50831: /* AsShotICCProfile */ profile_offset = ftell(ifp); profile_length = len; break; case 37122: /* CompressedBitsPerPixel */ kodak_cbpp = get4(); break; case 37386: /* FocalLength */ focal_len = getreal(type); break; case 37393: /* ImageNumber */ shot_order = getint(type); break; case 37400: /* old Kodak KDC tag */ for (raw_color = i=0; i < 3; i++) { getreal(type); FORC3 rgb_cam[i][c] = getreal(type); } break; case 46275: /* Imacon tags */ strcpy (make, "Imacon"); data_offset = ftell(ifp); ima_len = len; break; case 46279: if (!ima_len) break; fseek (ifp, 38, SEEK_CUR); case 46274: fseek (ifp, 40, SEEK_CUR); raw_width = get4(); raw_height = get4(); left_margin = get4() & 7; width = raw_width - left_margin - (get4() & 7); top_margin = get4() & 7; height = raw_height - top_margin - (get4() & 7); if (raw_width == 7262 && ima_len == 234317952 ) { height = 5412; width = 7216; left_margin = 7; filters=0; } else if (raw_width == 7262) { height = 5444; width = 7244; left_margin = 7; } fseek (ifp, 52, SEEK_CUR); FORC3 cam_mul[c] = getreal(11); fseek (ifp, 114, SEEK_CUR); flip = (get2() >> 7) * 90; if (width * height * 6 == ima_len) { if (flip % 180 == 90) SWAP(width,height); raw_width = width; raw_height = height; left_margin = top_margin = filters = flip = 0; } sprintf (model, "Ixpress %d-Mp", height*width/1000000); load_raw = &CLASS imacon_full_load_raw; if (filters) { if (left_margin & 1) filters = 0x61616161; load_raw = &CLASS unpacked_load_raw; } maximum = 0xffff; break; case 50454: /* Sinar tag */ case 50455: if (!(cbuf = (char *) malloc(len))) break; fread (cbuf, 1, len, ifp); for (cp = cbuf-1; cp && cp < cbuf+len; cp = strchr(cp,'\n')) if (!strncmp (++cp,"Neutral ",8)) sscanf (cp+8, "%f %f %f", cam_mul, cam_mul+1, cam_mul+2); free (cbuf); break; case 50458: if (!make[0]) strcpy (make, "Hasselblad"); break; case 50459: /* Hasselblad tag */ i = order; j = ftell(ifp); c = tiff_nifds; order = get2(); fseek (ifp, j+(get2(),get4()), SEEK_SET); parse_tiff_ifd (j); maximum = 0xffff; tiff_nifds = c; order = i; break; case 50706: /* DNGVersion */ FORC4 dng_version = (dng_version << 8) + fgetc(ifp); if (!make[0]) strcpy (make, "DNG"); is_raw = 1; break; case 50710: /* CFAPlaneColor */ if (len > 4) len = 4; colors = len; fread (cfa_pc, 1, colors, ifp); guess_cfa_pc: FORCC tab[cfa_pc[c]] = c; cdesc[c] = 0; for (i=16; i--; ) filters = filters << 2 | tab[cfa_pat[i % plen]]; break; case 50711: /* CFALayout */ if (get2() == 2) { fuji_width = 1; filters = 0x49494949; } break; case 291: case 50712: /* LinearizationTable */ linear_table (len); break; case 50713: /* BlackLevelRepeatDim */ blrr = get2(); blrc = get2(); break; case 61450: blrr = blrc = 2; case 50714: /* BlackLevel */ black = getreal(type); if (!filters || !~filters) break; dblack[0] = black; dblack[1] = (blrc == 2) ? getreal(type):dblack[0]; dblack[2] = (blrr == 2) ? getreal(type):dblack[0]; dblack[3] = (blrc == 2 && blrr == 2) ? getreal(type):dblack[1]; if (colors == 3) filters |= ((filters >> 2 & 0x22222222) | (filters << 2 & 0x88888888)) & filters << 1; FORC4 cblack[filters >> (c << 1) & 3] = dblack[c]; black = 0; break; case 50715: /* BlackLevelDeltaH */ case 50716: /* BlackLevelDeltaV */ for (num=i=0; i < len; i++) num += getreal(type); black += num/len + 0.5; break; case 50717: /* WhiteLevel */ maximum = getint(type); break; case 50718: /* DefaultScale */ pixel_aspect = getreal(type); pixel_aspect /= getreal(type); break; case 50721: /* ColorMatrix1 */ case 50722: /* ColorMatrix2 */ FORCC for (j=0; j < 3; j++) cm[c][j] = getreal(type); use_cm = 1; break; case 50723: /* CameraCalibration1 */ case 50724: /* CameraCalibration2 */ for (i=0; i < colors; i++) FORCC cc[i][c] = getreal(type); break; case 50727: /* AnalogBalance */ FORCC ab[c] = getreal(type); break; case 50728: /* AsShotNeutral */ FORCC asn[c] = getreal(type); break; case 50729: /* AsShotWhiteXY */ xyz[0] = getreal(type); xyz[1] = getreal(type); xyz[2] = 1 - xyz[0] - xyz[1]; FORC3 xyz[c] /= d65_white[c]; break; case 50740: /* DNGPrivateData */ if (dng_version) break; parse_minolta (j = get4()+base); fseek (ifp, j, SEEK_SET); parse_tiff_ifd (base); break; case 50752: read_shorts (cr2_slice, 3); break; case 50829: /* ActiveArea */ top_margin = getint(type); left_margin = getint(type); height = getint(type) - top_margin; width = getint(type) - left_margin; break; case 50830: /* MaskedAreas */ for (i=0; i < len && i < 32; i++) mask[0][i] = getint(type); black = 0; break; case 51009: /* OpcodeList2 */ meta_offset = ftell(ifp); break; case 64772: /* Kodak P-series */ if (len < 13) break; fseek (ifp, 16, SEEK_CUR); data_offset = get4(); fseek (ifp, 28, SEEK_CUR); data_offset += get4(); load_raw = &CLASS packed_load_raw; break; case 65026: if (type == 2) fgets (model2, 64, ifp); } fseek (ifp, save, SEEK_SET); } if (sony_length && (buf = (unsigned *) malloc(sony_length))) { fseek (ifp, sony_offset, SEEK_SET); fread (buf, sony_length, 1, ifp); sony_decrypt (buf, sony_length/4, 1, sony_key); #ifndef LIBRAW_LIBRARY_BUILD sfp = ifp; if ((ifp = tmpfile())) { fwrite (buf, sony_length, 1, ifp); fseek (ifp, 0, SEEK_SET); parse_tiff_ifd (-sony_offset); fclose (ifp); } ifp = sfp; #else if( !ifp->tempbuffer_open(buf,sony_length)) { parse_tiff_ifd(-sony_offset); ifp->tempbuffer_close(); } #endif free (buf); } for (i=0; i < colors; i++) FORCC cc[i][c] *= ab[i]; if (use_cm) { FORCC for (i=0; i < 3; i++) for (cam_xyz[c][i]=j=0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i] * xyz[i]; cam_xyz_coeff (cam_xyz); } if (asn[0]) { cam_mul[3] = 0; FORCC cam_mul[c] = 1 / asn[c]; } if (!use_cm) FORCC pre_mul[c] /= cc[c][c]; return 0; }
1
176,460
bool xmp_set_property(XmpPtr xmp, const char *schema, const char *name, const char *value, uint32_t optionBits) { CHECK_PTR(xmp, false); RESET_ERROR; bool ret = false; auto txmp = reinterpret_cast<SXMPMeta *>(xmp); if ((optionBits & (XMP_PROP_VALUE_IS_STRUCT | XMP_PROP_VALUE_IS_ARRAY)) && (*value == 0)) { value = NULL; } try { txmp->SetProperty(schema, name, value, optionBits); ret = true; } catch (const XMP_Error &e) { set_error(e); } catch (...) { } return ret; }
0
292,407
virtual void __fastcall Terminate() { TOwnConsole::FInstance->BreakInput(); }
0
459,323
major_from_header (const char *p, size_t s) { return from_header (p, s, "major_t", TYPE_MINIMUM (major_t), TYPE_MAXIMUM (major_t), false, false); }
0
267,905
launch_location_list_free (GList *list) { g_list_foreach (list, (GFunc) launch_location_free, NULL); g_list_free (list); }
0
494,453
flushupdates(struct interface *ifp) { babel_interface_nfo *babel_ifp = NULL; struct xroute *xroute; struct babel_route *route; const unsigned char *last_prefix = NULL; unsigned char last_plen = 0xFF; int i; if(ifp == NULL) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct interface *ifp_aux; FOR_ALL_INTERFACES(vrf, ifp_aux) flushupdates(ifp_aux); return; } babel_ifp = babel_get_if_nfo(ifp); if(babel_ifp->num_buffered_updates > 0) { struct buffered_update *b = babel_ifp->buffered_updates; int n = babel_ifp->num_buffered_updates; babel_ifp->buffered_updates = NULL; babel_ifp->update_bufsize = 0; babel_ifp->num_buffered_updates = 0; if(!if_up(ifp)) goto done; debugf(BABEL_DEBUG_COMMON," (flushing %d buffered updates on %s (%d))", n, ifp->name, ifp->ifindex); /* In order to send fewer update messages, we want to send updates with the same router-id together, with IPv6 going out before IPv4. */ for(i = 0; i < n; i++) { route = find_installed_route(b[i].prefix, b[i].plen); if(route) memcpy(b[i].id, route->src->id, 8); else memcpy(b[i].id, myid, 8); } qsort(b, n, sizeof(struct buffered_update), compare_buffered_updates); for(i = 0; i < n; i++) { /* The same update may be scheduled multiple times before it is sent out. Since our buffer is now sorted, it is enough to compare with the previous update. */ if(last_prefix) { if(b[i].plen == last_plen && memcmp(b[i].prefix, last_prefix, 16) == 0) continue; } xroute = find_xroute(b[i].prefix, b[i].plen); route = find_installed_route(b[i].prefix, b[i].plen); if(xroute && (!route || xroute->metric <= kernel_metric)) { really_send_update(ifp, myid, xroute->prefix, xroute->plen, myseqno, xroute->metric, NULL, 0); last_prefix = xroute->prefix; last_plen = xroute->plen; } else if(route) { unsigned char channels[DIVERSITY_HOPS]; int chlen; struct interface *route_ifp = route->neigh->ifp; struct babel_interface *babel_route_ifp = NULL; unsigned short metric; unsigned short seqno; seqno = route->seqno; metric = route_interferes(route, ifp) ? route_metric(route) : route_metric_noninterfering(route); if(metric < INFINITY) satisfy_request(route->src->prefix, route->src->plen, seqno, route->src->id, ifp); if((babel_ifp->flags & BABEL_IF_SPLIT_HORIZON) && route->neigh->ifp == ifp) continue; babel_route_ifp = babel_get_if_nfo(route_ifp); if(babel_route_ifp->channel ==BABEL_IF_CHANNEL_NONINTERFERING) { memcpy(channels, route->channels, DIVERSITY_HOPS); } else { if(babel_route_ifp->channel == BABEL_IF_CHANNEL_UNKNOWN) channels[0] = BABEL_IF_CHANNEL_INTERFERING; else { assert(babel_route_ifp->channel > 0 && babel_route_ifp->channel <= 255); channels[0] = babel_route_ifp->channel; } memcpy(channels + 1, route->channels, DIVERSITY_HOPS - 1); } chlen = channels_len(channels); really_send_update(ifp, route->src->id, route->src->prefix, route->src->plen, seqno, metric, channels, chlen); update_source(route->src, seqno, metric); last_prefix = route->src->prefix; last_plen = route->src->plen; } else { /* There's no route for this prefix. This can happen shortly after an xroute has been retracted, so send a retraction. */ really_send_update(ifp, myid, b[i].prefix, b[i].plen, myseqno, INFINITY, NULL, -1); } } schedule_flush_now(ifp); done: free(b); } babel_ifp->update_flush_timeout.tv_sec = 0; babel_ifp->update_flush_timeout.tv_usec = 0; }
0
6,772
static void snd_usb_mixer_free(struct usb_mixer_interface *mixer) { kfree(mixer->id_elems); if (mixer->urb) { kfree(mixer->urb->transfer_buffer); usb_free_urb(mixer->urb); } usb_free_urb(mixer->rc_urb); kfree(mixer->rc_setup_packet); kfree(mixer); }
1
120,718
static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) { __be32 *p; int status = 0; *maxname = 1024; if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXNAME - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) { p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) goto out_overflow; *maxname = be32_to_cpup(p); bitmap[0] &= ~FATTR4_WORD0_MAXNAME; } dprintk("%s: maxname=%u\n", __func__, *maxname); return status; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; }
0
250,571
util_getpass (char **lineptr, size_t *len, FILE *stream) { #define MAX_PASS_SIZE 128 char *buf; size_t i; int ch = 0; #ifndef _WIN32 struct termios old, new; fflush(stdout); if (tcgetattr (fileno (stdout), &old) != 0) return -1; new = old; new.c_lflag &= ~ECHO; if (tcsetattr (fileno (stdout), TCSAFLUSH, &new) != 0) return -1; #endif buf = calloc(1, MAX_PASS_SIZE); if (!buf) return -1; for (i = 0; i < MAX_PASS_SIZE - 1; i++) { #ifndef _WIN32 ch = getchar(); #else ch = _getch(); #endif if (ch == 0 || ch == 3) break; if (ch == '\n' || ch == '\r') break; buf[i] = (char) ch; } #ifndef _WIN32 tcsetattr (fileno (stdout), TCSAFLUSH, &old); fputs("\n", stdout); #endif if (ch == 0 || ch == 3) { free(buf); return -1; } if (*lineptr && (!len || *len < i+1)) { free(*lineptr); *lineptr = NULL; } if (*lineptr) { memcpy(*lineptr,buf,i+1); memset(buf, 0, MAX_PASS_SIZE); free(buf); } else { *lineptr = buf; if (len) *len = MAX_PASS_SIZE; } return i; }
0
417,285
static void h2_session_ev_conn_error(h2_session *session, int arg, const char *msg) { switch (session->state) { case H2_SESSION_ST_INIT: case H2_SESSION_ST_DONE: /* just leave */ transit(session, "conn error", H2_SESSION_ST_DONE); break; default: ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, H2_SSSN_LOG(APLOGNO(03401), session, "conn error -> shutdown")); h2_session_shutdown(session, arg, msg, 0); break; } }
0
388,452
bool asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx, struct asn1_data *data, const char **result) { DATA_BLOB string; if (!asn1_read_OctetString(data, mem_ctx, &string)) return false; *result = blob2string_talloc(mem_ctx, string); data_blob_free(&string); return true; }
0
11,809
std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target) { std::vector<GetLengthType> results; GetLengthType retval; retval.startOrder = target.startOrder; retval.startRow = target.startRow; const bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget; const bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions; SEQUENCEINDEX sequence = target.sequence; if(sequence >= Order.GetNumSequences()) sequence = Order.GetCurrentSequenceIndex(); const ModSequence &orderList = Order(sequence); GetLengthMemory memory(*this); CSoundFile::PlayState &playState = *memory.state; RowVisitor visitedRows(*this, sequence); playState.m_nNextRow = playState.m_nRow = target.startRow; playState.m_nNextOrder = playState.m_nCurrentOrder = target.startOrder; std::bitset<MAX_EFFECTS> forbiddenCommands; std::bitset<MAX_VOLCMDS> forbiddenVolCommands; if(adjustSamplePos) { forbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP); forbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_XFINEPORTAUPDOWN); forbiddenCommands.set(CMD_NOTESLIDEUP); forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG); forbiddenCommands.set(CMD_NOTESLIDEDOWN); forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG); forbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN); for(CHANNELINDEX i = 0; i < GetNumChannels(); i++) { if(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL; } if(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.size()) { const PATTERNINDEX seekPat = orderList[target.pos.order]; if(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row)) { const ModCommand *m = Patterns[seekPat].GetRow(target.pos.row); for(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++) { if(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments()) || (m->IsNote() && !m->IsPortamento())) { memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL; } } } } } uint32 oldTickDuration = 0; for (;;) { if(target.mode == GetLengthTarget::SeekSeconds && memory.elapsedTime >= target.time) { retval.targetReached = true; break; } uint32 rowDelay = 0, tickDelay = 0; playState.m_nRow = playState.m_nNextRow; playState.m_nCurrentOrder = playState.m_nNextOrder; if(orderList.IsValidPat(playState.m_nCurrentOrder) && playState.m_nRow >= Patterns[orderList[playState.m_nCurrentOrder]].GetNumRows()) { playState.m_nRow = 0; if(m_playBehaviour[kFT2LoopE60Restart]) { playState.m_nRow = playState.m_nNextPatStartRow; playState.m_nNextPatStartRow = 0; } playState.m_nCurrentOrder = ++playState.m_nNextOrder; } playState.m_nPattern = playState.m_nCurrentOrder < orderList.size() ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex(); bool positionJumpOnThisRow = false; bool patternBreakOnThisRow = false; bool patternLoopEndedOnThisRow = false, patternLoopStartedOnThisRow = false; if(!Patterns.IsValidPat(playState.m_nPattern) && playState.m_nPattern != orderList.GetInvalidPatIndex() && target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order) { retval.targetReached = true; break; } while(playState.m_nPattern >= Patterns.Size()) { if((playState.m_nPattern == orderList.GetInvalidPatIndex()) || (playState.m_nCurrentOrder >= orderList.size())) { if(playState.m_nCurrentOrder == orderList.GetRestartPos()) break; else playState.m_nCurrentOrder = orderList.GetRestartPos(); } else { playState.m_nCurrentOrder++; } playState.m_nPattern = (playState.m_nCurrentOrder < orderList.size()) ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex(); playState.m_nNextOrder = playState.m_nCurrentOrder; if((!Patterns.IsValidPat(playState.m_nPattern)) && visitedRows.IsVisited(playState.m_nCurrentOrder, 0, true)) { if(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true)) { break; } else { retval.duration = memory.elapsedTime; results.push_back(retval); retval.startRow = playState.m_nRow; retval.startOrder = playState.m_nNextOrder; memory.Reset(); playState.m_nCurrentOrder = playState.m_nNextOrder; playState.m_nPattern = orderList[playState.m_nCurrentOrder]; playState.m_nNextRow = playState.m_nRow; break; } } } if(playState.m_nNextOrder == ORDERINDEX_INVALID) { break; } if(!Patterns.IsValidPat(playState.m_nPattern)) { if(playState.m_nCurrentOrder == orderList.GetRestartPos()) { if(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true)) { break; } else { retval.duration = memory.elapsedTime; results.push_back(retval); retval.startRow = playState.m_nRow; retval.startOrder = playState.m_nNextOrder; memory.Reset(); playState.m_nNextRow = playState.m_nRow; continue; } } playState.m_nNextOrder = playState.m_nCurrentOrder + 1; continue; } if(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows()) playState.m_nRow = 0; if(target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order && playState.m_nRow == target.pos.row) { retval.targetReached = true; break; } if(visitedRows.IsVisited(playState.m_nCurrentOrder, playState.m_nRow, true)) { if(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true)) { break; } else { retval.duration = memory.elapsedTime; results.push_back(retval); retval.startRow = playState.m_nRow; retval.startOrder = playState.m_nNextOrder; memory.Reset(); playState.m_nNextRow = playState.m_nRow; continue; } } retval.endOrder = playState.m_nCurrentOrder; retval.endRow = playState.m_nRow; playState.m_nNextRow = playState.m_nRow + 1; if(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows()) { playState.m_nRow = 0; } if(!playState.m_nRow) { for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { memory.chnSettings[chn].patLoop = memory.elapsedTime; memory.chnSettings[chn].patLoopSmp = playState.m_lTotalSampleCount; } } ModChannel *pChn = playState.Chn; const ModCommand *p = Patterns[playState.m_nPattern].GetpModCommand(playState.m_nRow, 0); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++) { if(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; if(p->IsPcNote()) { #ifndef NO_PLUGINS if((adjustMode & eAdjust) && p->instr > 0 && p->instr <= MAX_MIXPLUGINS) { memory.plugParams[std::make_pair(p->instr, p->GetValueVolCol())] = p->GetValueEffectCol(); } #endif // NO_PLUGINS pChn[nChn].rowCommand.Clear(); continue; } pChn[nChn].rowCommand = *p; switch(p->command) { case CMD_SPEED: SetSpeed(playState, p->param); break; case CMD_TEMPO: if(m_playBehaviour[kMODVBlankTiming]) { if(p->param != 0) SetSpeed(playState, p->param); } break; case CMD_S3MCMDEX: if((p->param & 0xF0) == 0x60) { tickDelay += (p->param & 0x0F); } else if((p->param & 0xF0) == 0xE0 && !rowDelay) { if(!(GetType() & MOD_TYPE_S3M) || (p->param & 0x0F) != 0) { rowDelay = 1 + (p->param & 0x0F); } } break; case CMD_MODCMDEX: if((p->param & 0xF0) == 0xE0) { rowDelay = 1 + (p->param & 0x0F); } break; } } if(rowDelay == 0) rowDelay = 1; const uint32 numTicks = (playState.m_nMusicSpeed + tickDelay) * rowDelay; const uint32 nonRowTicks = numTicks - rowDelay; for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty()) { if(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; ModCommand::COMMAND command = pChn->rowCommand.command; ModCommand::PARAM param = pChn->rowCommand.param; ModCommand::NOTE note = pChn->rowCommand.note; if (pChn->rowCommand.instr) { pChn->nNewIns = pChn->rowCommand.instr; pChn->nLastNote = NOTE_NONE; memory.chnSettings[nChn].vol = 0xFF; } if (pChn->rowCommand.IsNote()) pChn->nLastNote = note; if(pChn->rowCommand.IsNote() || pChn->rowCommand.instr) { SAMPLEINDEX smp = 0; if(GetNumInstruments()) { ModInstrument *pIns; if(pChn->nNewIns <= GetNumInstruments() && (pIns = Instruments[pChn->nNewIns]) != nullptr) { if(pIns->dwFlags[INS_SETPANNING]) pChn->nPan = pIns->nPan; if(ModCommand::IsNote(note)) smp = pIns->Keyboard[note - NOTE_MIN]; } } else { smp = pChn->nNewIns; } if(smp > 0 && smp <= GetNumSamples() && Samples[smp].uFlags[CHN_PANNING]) { pChn->nPan = Samples[smp].nPan; } } switch(pChn->rowCommand.volcmd) { case VOLCMD_VOLUME: memory.chnSettings[nChn].vol = pChn->rowCommand.vol; break; case VOLCMD_VOLSLIDEUP: case VOLCMD_VOLSLIDEDOWN: if(pChn->rowCommand.vol != 0) pChn->nOldVolParam = pChn->rowCommand.vol; break; } switch(command) { case CMD_POSITIONJUMP: positionJumpOnThisRow = true; playState.m_nNextOrder = static_cast<ORDERINDEX>(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn)); playState.m_nNextPatStartRow = 0; // FT2 E60 bug if(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM))) playState.m_nNextRow = 0; if (adjustMode & eAdjust) { pChn->nPatternLoopCount = 0; pChn->nPatternLoop = 0; } break; case CMD_PATTERNBREAK: { ROWINDEX row = PatternBreak(playState, nChn, param); if(row != ROWINDEX_INVALID) { patternBreakOnThisRow = true; playState.m_nNextRow = row; if(!positionJumpOnThisRow) { playState.m_nNextOrder = playState.m_nCurrentOrder + 1; } if(adjustMode & eAdjust) { pChn->nPatternLoopCount = 0; pChn->nPatternLoop = 0; } } } break; case CMD_TEMPO: if(!m_playBehaviour[kMODVBlankTiming]) { TEMPO tempo(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn), 0); if ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) { if (tempo.GetInt()) pChn->nOldTempo = static_cast<uint8>(tempo.GetInt()); else tempo.Set(pChn->nOldTempo); } if (tempo.GetInt() >= 0x20) playState.m_nMusicTempo = tempo; else { TEMPO tempoDiff((tempo.GetInt() & 0x0F) * nonRowTicks, 0); if ((tempo.GetInt() & 0xF0) == 0x10) { playState.m_nMusicTempo += tempoDiff; } else { if(tempoDiff < playState.m_nMusicTempo) playState.m_nMusicTempo -= tempoDiff; else playState.m_nMusicTempo.Set(0); } } TEMPO tempoMin = GetModSpecifications().GetTempoMin(), tempoMax = GetModSpecifications().GetTempoMax(); if(m_playBehaviour[kTempoClamp]) // clamp tempo correctly in compatible mode { tempoMax.Set(255); } Limit(playState.m_nMusicTempo, tempoMin, tempoMax); } break; case CMD_S3MCMDEX: switch(param & 0xF0) { case 0x90: if(param <= 0x91) { pChn->dwFlags.set(CHN_SURROUND, param == 0x91); } break; case 0xA0: pChn->nOldHiOffset = param & 0x0F; break; case 0xB0: if (param & 0x0F) { patternLoopEndedOnThisRow = true; } else { CHANNELINDEX firstChn = nChn, lastChn = nChn; if(GetType() == MOD_TYPE_S3M) { firstChn = 0; lastChn = GetNumChannels() - 1; } for(CHANNELINDEX c = firstChn; c <= lastChn; c++) { memory.chnSettings[c].patLoop = memory.elapsedTime; memory.chnSettings[c].patLoopSmp = playState.m_lTotalSampleCount; memory.chnSettings[c].patLoopStart = playState.m_nRow; } patternLoopStartedOnThisRow = true; } break; case 0xF0: pChn->nActiveMacro = param & 0x0F; break; } break; case CMD_MODCMDEX: switch(param & 0xF0) { case 0x60: if (param & 0x0F) { playState.m_nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug patternLoopEndedOnThisRow = true; } else { patternLoopStartedOnThisRow = true; memory.chnSettings[nChn].patLoop = memory.elapsedTime; memory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount; memory.chnSettings[nChn].patLoopStart = playState.m_nRow; } break; case 0xF0: pChn->nActiveMacro = param & 0x0F; break; } break; case CMD_XFINEPORTAUPDOWN: if(((param & 0xF0) == 0xA0) && !m_playBehaviour[kFT2RestrictXCommand]) pChn->nOldHiOffset = param & 0x0F; break; } if (!(adjustMode & eAdjust)) continue; switch(command) { case CMD_PORTAMENTOUP: if(param) { if(!m_playBehaviour[kFT2PortaUpDownMemory]) pChn->nOldPortaDown = param; pChn->nOldPortaUp = param; } break; case CMD_PORTAMENTODOWN: if(param) { if(!m_playBehaviour[kFT2PortaUpDownMemory]) pChn->nOldPortaUp = param; pChn->nOldPortaDown = param; } break; case CMD_TONEPORTAMENTO: if (param) pChn->nPortamentoSlide = param << 2; break; case CMD_OFFSET: if (param) pChn->oldOffset = param << 8; break; case CMD_VOLUMESLIDE: case CMD_TONEPORTAVOL: if (param) pChn->nOldVolumeSlide = param; break; case CMD_VOLUME: memory.chnSettings[nChn].vol = param; break; case CMD_GLOBALVOLUME: if(!(GetType() & GLOBALVOL_7BIT_FORMATS) && param < 128) param *= 2; if(param <= 128) { playState.m_nGlobalVolume = param * 2; } else if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M))) { playState.m_nGlobalVolume = 256; } break; case CMD_GLOBALVOLSLIDE: if(m_playBehaviour[kPerChannelGlobalVolSlide]) { if (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide; } else { if (param) playState.Chn[0].nOldGlobalVolSlide = param; else param = playState.Chn[0].nOldGlobalVolSlide; } if (((param & 0x0F) == 0x0F) && (param & 0xF0)) { param >>= 4; if (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1; playState.m_nGlobalVolume += param << 1; } else if (((param & 0xF0) == 0xF0) && (param & 0x0F)) { param = (param & 0x0F) << 1; if (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1; playState.m_nGlobalVolume -= param; } else if (param & 0xF0) { param >>= 4; param <<= 1; if (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1; playState.m_nGlobalVolume += param * nonRowTicks; } else { param = (param & 0x0F) << 1; if (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1; playState.m_nGlobalVolume -= param * nonRowTicks; } Limit(playState.m_nGlobalVolume, 0, 256); break; case CMD_CHANNELVOLUME: if (param <= 64) pChn->nGlobalVol = param; break; case CMD_CHANNELVOLSLIDE: { if (param) pChn->nOldChnVolSlide = param; else param = pChn->nOldChnVolSlide; int32 volume = pChn->nGlobalVol; if((param & 0x0F) == 0x0F && (param & 0xF0)) volume += (param >> 4); // Fine Up else if((param & 0xF0) == 0xF0 && (param & 0x0F)) volume -= (param & 0x0F); // Fine Down else if(param & 0x0F) // Down volume -= (param & 0x0F) * nonRowTicks; else // Up volume += ((param & 0xF0) >> 4) * nonRowTicks; Limit(volume, 0, 64); pChn->nGlobalVol = volume; } break; case CMD_PANNING8: Panning(pChn, param, Pan8bit); break; case CMD_MODCMDEX: if(param < 0x10) { for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { playState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1)); } } MPT_FALLTHROUGH; case CMD_S3MCMDEX: if((param & 0xF0) == 0x80) { Panning(pChn, (param & 0x0F), Pan4bit); } break; case CMD_VIBRATOVOL: if (param) pChn->nOldVolumeSlide = param; param = 0; MPT_FALLTHROUGH; case CMD_VIBRATO: Vibrato(pChn, param); break; case CMD_FINEVIBRATO: FineVibrato(pChn, param); break; case CMD_TREMOLO: Tremolo(pChn, param); break; case CMD_PANBRELLO: Panbrello(pChn, param); break; } switch(pChn->rowCommand.volcmd) { case VOLCMD_PANNING: Panning(pChn, pChn->rowCommand.vol, Pan6bit); break; case VOLCMD_VIBRATOSPEED: if(m_playBehaviour[kFT2VolColVibrato]) pChn->nVibratoSpeed = pChn->rowCommand.vol & 0x0F; else Vibrato(pChn, pChn->rowCommand.vol << 4); break; case VOLCMD_VIBRATODEPTH: Vibrato(pChn, pChn->rowCommand.vol); break; } switch(pChn->rowCommand.command) { case CMD_VIBRATO: case CMD_FINEVIBRATO: case CMD_VIBRATOVOL: if(adjustMode & eAdjust) { uint32 vibTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks; uint32 inc = pChn->nVibratoSpeed * vibTicks; if(m_playBehaviour[kITVibratoTremoloPanbrello]) inc *= 4; pChn->nVibratoPos += static_cast<uint8>(inc); } break; case CMD_TREMOLO: if(adjustMode & eAdjust) { uint32 tremTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks; uint32 inc = pChn->nTremoloSpeed * tremTicks; if(m_playBehaviour[kITVibratoTremoloPanbrello]) inc *= 4; pChn->nTremoloPos += static_cast<uint8>(inc); } break; case CMD_PANBRELLO: if(adjustMode & eAdjust) { pChn->nPanbrelloPos += static_cast<uint8>(pChn->nPanbrelloSpeed * (numTicks - 1)); ProcessPanbrello(pChn); } break; } } if(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max) { break; } playState.m_nCurrentRowsPerBeat = m_nDefaultRowsPerBeat; if(Patterns[playState.m_nPattern].GetOverrideSignature()) { playState.m_nCurrentRowsPerBeat = Patterns[playState.m_nPattern].GetRowsPerBeat(); } const uint32 tickDuration = GetTickDuration(playState); const uint32 rowDuration = tickDuration * numTicks; memory.elapsedTime += static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); playState.m_lTotalSampleCount += rowDuration; if(adjustSamplePos) { pChn = playState.Chn; for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) { if(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL) continue; uint32 startTick = 0; const ModCommand &m = pChn->rowCommand; uint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F; bool porta = m.command == CMD_TONEPORTAMENTO || m.command == CMD_TONEPORTAVOL || m.volcmd == VOLCMD_TONEPORTAMENTO; bool stopNote = patternLoopStartedOnThisRow; // It's too much trouble to keep those pattern loops in sync... if(m.instr) pChn->proTrackerOffset = 0; if(m.IsNote()) { if(porta && memory.chnSettings[nChn].incChanged) { pChn->increment = GetChannelIncrement(pChn, pChn->nPeriod, 0); } int32 setPan = pChn->nPan; pChn->nNewNote = pChn->nLastNote; if(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta); NoteChange(pChn, m.note, porta); memory.chnSettings[nChn].incChanged = true; if((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks) { startTick = paramLo; } else if(m.command == CMD_DELAYCUT && paramHi < numTicks) { startTick = paramHi; } if(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) { startTick += (playState.m_nMusicSpeed + tickDelay) * (rowDelay - 1); } if(!porta) memory.chnSettings[nChn].ticksToRender = 0; if(m.command == CMD_PANNING8 || ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8) || m.volcmd == VOLCMD_PANNING) { pChn->nPan = setPan; } if(m.command == CMD_OFFSET) { bool isExtended = false; SmpLength offset = CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn, &isExtended); if(!isExtended) { offset <<= 8; if(offset == 0) offset = pChn->oldOffset; offset += static_cast<SmpLength>(pChn->nOldHiOffset) << 16; } SampleOffset(*pChn, offset); } else if(m.command == CMD_OFFSETPERCENTAGE) { SampleOffset(*pChn, Util::muldiv_unsigned(pChn->nLength, m.param, 255)); } else if(m.command == CMD_REVERSEOFFSET && pChn->pModSample != nullptr) { memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far ReverseSampleOffset(*pChn, m.param); startTick = playState.m_nMusicSpeed - 1; } else if(m.volcmd == VOLCMD_OFFSET) { if(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr) { SmpLength offset; if(m.vol == 0) offset = pChn->oldOffset; else offset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1]; SampleOffset(*pChn, offset); } } } if(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments()) || ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks) || (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks)) { stopNote = true; } if(m.command == CMD_VOLUME) { pChn->nVolume = m.param * 4; } else if(m.volcmd == VOLCMD_VOLUME) { pChn->nVolume = m.vol * 4; } if(pChn->pModSample && !stopNote) { if(m.command < MAX_EFFECTS) { if(forbiddenCommands[m.command]) { stopNote = true; } else if(m.command == CMD_MODCMDEX) { switch(m.param & 0xF0) { case 0x10: case 0x20: stopNote = true; } } } if(m.volcmd < forbiddenVolCommands.size() && forbiddenVolCommands[m.volcmd]) { stopNote = true; } } if(stopNote) { pChn->Stop(); memory.chnSettings[nChn].ticksToRender = 0; } else { if(oldTickDuration != tickDuration && oldTickDuration != 0) { memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far } switch(m.command) { case CMD_TONEPORTAVOL: case CMD_VOLUMESLIDE: case CMD_VIBRATOVOL: if(m.param || (GetType() != MOD_TYPE_MOD)) { for(uint32 i = 0; i < numTicks; i++) { pChn->isFirstTick = (i == 0); VolumeSlide(pChn, m.param); } } break; case CMD_MODCMDEX: if((m.param & 0x0F) || (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { pChn->isFirstTick = true; switch(m.param & 0xF0) { case 0xA0: FineVolumeUp(pChn, m.param & 0x0F, false); break; case 0xB0: FineVolumeDown(pChn, m.param & 0x0F, false); break; } } break; case CMD_S3MCMDEX: if(m.param == 0x9E) { memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far pChn->dwFlags.reset(CHN_PINGPONGFLAG); } else if(m.param == 0x9F) { memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far pChn->dwFlags.set(CHN_PINGPONGFLAG); if(!pChn->position.GetInt() && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP])) { pChn->position.Set(pChn->nLength - 1, SamplePosition::fractMax); } } else if((m.param & 0xF0) == 0x70) { } break; } pChn->isFirstTick = true; switch(m.volcmd) { case VOLCMD_FINEVOLUP: FineVolumeUp(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break; case VOLCMD_FINEVOLDOWN: FineVolumeDown(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break; case VOLCMD_VOLSLIDEUP: case VOLCMD_VOLSLIDEDOWN: { ModCommand::VOL vol = m.vol; if(vol == 0 && m_playBehaviour[kITVolColMemory]) { vol = pChn->nOldVolParam; if(vol == 0) break; } if(m.volcmd == VOLCMD_VOLSLIDEUP) vol <<= 4; for(uint32 i = 0; i < numTicks; i++) { pChn->isFirstTick = (i == 0); VolumeSlide(pChn, vol); } } break; } if(porta) { uint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1; memory.chnSettings[nChn].ticksToRender += numTicks; memory.RenderChannel(nChn, tickDuration, portaTick); } else { memory.chnSettings[nChn].ticksToRender += (numTicks - startTick); } } } } oldTickDuration = tickDuration; if(patternLoopEndedOnThisRow && (!m_playBehaviour[kFT2PatternLoopWithJumps] || !(positionJumpOnThisRow || patternBreakOnThisRow)) && (!m_playBehaviour[kITPatternLoopWithJumps] || !positionJumpOnThisRow)) { std::map<double, int> startTimes; pChn = playState.Chn; for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { ModCommand::COMMAND command = pChn->rowCommand.command; ModCommand::PARAM param = pChn->rowCommand.param; if((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF) || (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F)) { const double start = memory.chnSettings[nChn].patLoop; if(!startTimes[start]) startTimes[start] = 1; startTimes[start] = mpt::lcm(startTimes[start], 1 + (param & 0x0F)); } } for(const auto &i : startTimes) { memory.elapsedTime += (memory.elapsedTime - i.first) * (double)(i.second - 1); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { if(memory.chnSettings[nChn].patLoop == i.first) { playState.m_lTotalSampleCount += (playState.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i.second - 1); if(m_playBehaviour[kITPatternLoopTargetReset] || (GetType() == MOD_TYPE_S3M)) { memory.chnSettings[nChn].patLoop = memory.elapsedTime; memory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount; memory.chnSettings[nChn].patLoopStart = playState.m_nRow + 1; } break; } } } if(GetType() == MOD_TYPE_IT) { for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { if((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF)) { memory.chnSettings[nChn].patLoop = memory.elapsedTime; memory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount; } } } } } if(adjustSamplePos) { for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { if(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL) { memory.RenderChannel(nChn, oldTickDuration); } } } if(retval.targetReached || target.mode == GetLengthTarget::NoTarget) { retval.lastOrder = playState.m_nCurrentOrder; retval.lastRow = playState.m_nRow; } retval.duration = memory.elapsedTime; results.push_back(retval); if(adjustMode & eAdjust) { if(retval.targetReached || target.mode == GetLengthTarget::NoTarget) { m_PlayState = std::move(playState); m_PlayState.m_nNextRow = m_PlayState.m_nRow; m_PlayState.m_nFrameDelay = m_PlayState.m_nPatternDelay = 0; m_PlayState.m_nTickCount = Util::MaxValueOfType(m_PlayState.m_nTickCount) - 1; m_PlayState.m_bPositionChanged = true; for(CHANNELINDEX n = 0; n < GetNumChannels(); n++) { if(m_PlayState.Chn[n].nLastNote != NOTE_NONE) { m_PlayState.Chn[n].nNewNote = m_PlayState.Chn[n].nLastNote; } if(memory.chnSettings[n].vol != 0xFF && !adjustSamplePos) { m_PlayState.Chn[n].nVolume = std::min(memory.chnSettings[n].vol, uint8(64)) * 4; } } #ifndef NO_PLUGINS std::bitset<MAX_MIXPLUGINS> plugSetProgram; for(const auto &param : memory.plugParams) { PLUGINDEX plug = param.first.first - 1; IMixPlugin *plugin = m_MixPlugins[plug].pMixPlugin; if(plugin != nullptr) { if(!plugSetProgram[plug]) { plugSetProgram.set(plug); plugin->BeginSetProgram(); } plugin->SetParameter(param.first.second, param.second / PlugParamValue(ModCommand::maxColumnValue)); } } if(plugSetProgram.any()) { for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++) { if(plugSetProgram[i]) { m_MixPlugins[i].pMixPlugin->EndSetProgram(); } } } #endif // NO_PLUGINS } else if(adjustMode != eAdjustOnSuccess) { m_PlayState.m_nMusicSpeed = m_nDefaultSpeed; m_PlayState.m_nMusicTempo = m_nDefaultTempo; m_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume; } if(sequence != Order.GetCurrentSequenceIndex()) { Order.SetSequence(sequence); } visitedSongRows.Set(visitedRows); } return results; }
1
218,380
int js_hasproperty(js_State *J, int idx, const char *name) { return jsR_hasproperty(J, js_toobject(J, idx), name); }
0
76,729
static void init_once(void *foo) { struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo; inode_init_once(&fi->vfs_inode); }
0
30,006
static int dtls1_process_out_of_seq_message ( SSL * s , struct hm_header_st * msg_hdr , int * ok ) { int i = - 1 ; hm_fragment * frag = NULL ; pitem * item = NULL ; unsigned char seq64be [ 8 ] ; unsigned long frag_len = msg_hdr -> frag_len ; if ( ( msg_hdr -> frag_off + frag_len ) > msg_hdr -> msg_len ) goto err ; memset ( seq64be , 0 , sizeof ( seq64be ) ) ; seq64be [ 6 ] = ( unsigned char ) ( msg_hdr -> seq >> 8 ) ; seq64be [ 7 ] = ( unsigned char ) msg_hdr -> seq ; item = pqueue_find ( s -> d1 -> buffered_messages , seq64be ) ; if ( item != NULL && frag_len < msg_hdr -> msg_len ) item = NULL ; if ( msg_hdr -> seq <= s -> d1 -> handshake_read_seq || msg_hdr -> seq > s -> d1 -> handshake_read_seq + 10 || item != NULL || ( s -> d1 -> handshake_read_seq == 0 && msg_hdr -> type == SSL3_MT_FINISHED ) ) { unsigned char devnull [ 256 ] ; while ( frag_len ) { i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , devnull , frag_len > sizeof ( devnull ) ? sizeof ( devnull ) : frag_len , 0 ) ; if ( i <= 0 ) goto err ; frag_len -= i ; } } else { if ( frag_len && frag_len < msg_hdr -> msg_len ) return dtls1_reassemble_fragment ( s , msg_hdr , ok ) ; frag = dtls1_hm_fragment_new ( frag_len , 0 ) ; if ( frag == NULL ) goto err ; memcpy ( & ( frag -> msg_header ) , msg_hdr , sizeof ( * msg_hdr ) ) ; if ( frag_len ) { i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , frag -> fragment , frag_len , 0 ) ; if ( i <= 0 || ( unsigned long ) i != frag_len ) goto err ; } memset ( seq64be , 0 , sizeof ( seq64be ) ) ; seq64be [ 6 ] = ( unsigned char ) ( msg_hdr -> seq >> 8 ) ; seq64be [ 7 ] = ( unsigned char ) ( msg_hdr -> seq ) ; item = pitem_new ( seq64be , frag ) ; if ( item == NULL ) goto err ; pqueue_insert ( s -> d1 -> buffered_messages , item ) ; } return DTLS1_HM_FRAGMENT_RETRY ; err : if ( frag != NULL ) dtls1_hm_fragment_free ( frag ) ; if ( item != NULL ) OPENSSL_free ( item ) ; * ok = 0 ; return i ; }
0
182,339
void MigrationTest::SetUpVersion67Database() { sql::Connection connection; ASSERT_TRUE(connection.Open(GetDatabasePath())); ASSERT_TRUE(connection.BeginTransaction()); ASSERT_TRUE(connection.Execute( "CREATE TABLE extended_attributes(metahandle bigint, key varchar(127), " "value blob, PRIMARY KEY(metahandle, key) ON CONFLICT REPLACE);" "CREATE TABLE metas (metahandle bigint primary key ON CONFLICT FAIL," "base_version bigint default -1,server_version bigint default 0," "mtime bigint default 0,server_mtime bigint default 0," "ctime bigint default 0,server_ctime bigint default 0," "server_position_in_parent bigint default 0," "local_external_id bigint default 0,id varchar(255) default 'r'," "parent_id varchar(255) default 'r'," "server_parent_id varchar(255) default 'r'," "prev_id varchar(255) default 'r',next_id varchar(255) default 'r'," "is_unsynced bit default 0,is_unapplied_update bit default 0," "is_del bit default 0,is_dir bit default 0," "is_bookmark_object bit default 0,server_is_dir bit default 0," "server_is_del bit default 0,server_is_bookmark_object bit default 0," "name varchar(255), " /* COLLATE PATHNAME, */ "unsanitized_name varchar(255)," /* COLLATE PATHNAME, */ "non_unique_name varchar," "server_name varchar(255)," /* COLLATE PATHNAME */ "server_non_unique_name varchar," "bookmark_url varchar,server_bookmark_url varchar," "singleton_tag varchar,bookmark_favicon blob," "server_bookmark_favicon blob);" "INSERT INTO metas VALUES(1,-1,0,129079956640320000,0," "129079956640320000,0,0,0,'r','r','r','r','r',0,0,0,1,0,0,0,0,NULL," "NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);" "INSERT INTO metas VALUES(2,669,669,128976886618480000," "128976886618480000,128976886618480000,128976886618480000,-2097152," "4,'s_ID_2','s_ID_9','s_ID_9','s_ID_2','s_ID_2',0,0,1,0,1,0,1,1," "'Deleted Item',NULL,'Deleted Item','Deleted Item','Deleted Item'," "'http://www.google.com/','http://www.google.com/2',NULL,'AASGASGA'," "'ASADGADGADG');" "INSERT INTO metas VALUES(4,681,681,129002163642690000," "129002163642690000,129002163642690000,129002163642690000,-3145728," "3,'s_ID_4','s_ID_9','s_ID_9','s_ID_4','s_ID_4',0,0,1,0,1,0,1,1," "'Welcome to Chromium',NULL,'Welcome to Chromium'," "'Welcome to Chromium','Welcome to Chromium'," "'http://www.google.com/chrome/intl/en/welcome.html'," "'http://www.google.com/chrome/intl/en/welcome.html',NULL,NULL," "NULL);" "INSERT INTO metas VALUES(5,677,677,129001555500000000," "129001555500000000,129001555500000000,129001555500000000,1048576," "7,'s_ID_5','s_ID_9','s_ID_9','s_ID_5','s_ID_5',0,0,1,0,1,0,1,1," "'Google',NULL,'Google','Google','Google','http://www.google.com/'," "'http://www.google.com/',NULL,'AGASGASG','AGFDGASG');" "INSERT INTO metas VALUES(6,694,694,129053976170000000," "129053976170000000,129053976170000000,129053976170000000,-4194304," "6,'s_ID_6','s_ID_9','s_ID_9','r','r',0,0,0,1,1,1,0,1," "'The Internet',NULL,'The Internet','The Internet'," "'The Internet',NULL,NULL,NULL,NULL,NULL);" "INSERT INTO metas VALUES(7,663,663,128976864758480000," "128976864758480000,128976864758480000,128976864758480000," "1048576,0,'s_ID_7','r','r','r','r',0,0,0,1,1,1,0,1," "'Google Chrome',NULL,'Google Chrome','Google Chrome'," "'Google Chrome',NULL,NULL,'google_chrome',NULL,NULL);" "INSERT INTO metas VALUES(8,664,664,128976864758480000," "128976864758480000,128976864758480000,128976864758480000,1048576," "0,'s_ID_8','s_ID_7','s_ID_7','r','r',0,0,0,1,1,1,0,1,'Bookmarks'," "NULL,'Bookmarks','Bookmarks','Bookmarks',NULL,NULL," "'google_chrome_bookmarks',NULL,NULL);" "INSERT INTO metas VALUES(9,665,665,128976864758480000," "128976864758480000,128976864758480000,128976864758480000," "1048576,1,'s_ID_9','s_ID_8','s_ID_8','r','s_ID_10',0,0,0,1,1,1,0," "1,'Bookmark Bar',NULL,'Bookmark Bar','Bookmark Bar','Bookmark Bar'," "NULL,NULL,'bookmark_bar',NULL,NULL);" "INSERT INTO metas VALUES(10,666,666,128976864758480000," "128976864758480000,128976864758480000,128976864758480000,2097152," "2,'s_ID_10','s_ID_8','s_ID_8','s_ID_9','r',0,0,0,1,1,1,0,1," "'Other Bookmarks',NULL,'Other Bookmarks','Other Bookmarks'," "'Other Bookmarks',NULL,NULL,'other_bookmarks'," "NULL,NULL);" "INSERT INTO metas VALUES(11,683,683,129079956948440000," "129079956948440000,129079956948440000,129079956948440000,-1048576," "8,'s_ID_11','s_ID_6','s_ID_6','r','s_ID_13',0,0,0,0,1,0,0,1," "'Home (The Chromium Projects)',NULL,'Home (The Chromium Projects)'," "'Home (The Chromium Projects)','Home (The Chromium Projects)'," "'http://dev.chromium.org/','http://dev.chromium.org/other',NULL," "'AGATWA','AFAGVASF');" "INSERT INTO metas VALUES(12,685,685,129079957513650000," "129079957513650000,129079957513650000,129079957513650000,0,9," "'s_ID_12','s_ID_6','s_ID_6','s_ID_13','s_ID_14',0,0,0,1,1,1,0,1," "'Extra Bookmarks',NULL,'Extra Bookmarks','Extra Bookmarks'," "'Extra Bookmarks',NULL,NULL,NULL,NULL,NULL);" "INSERT INTO metas VALUES(13,687,687,129079957985300000," "129079957985300000,129079957985300000,129079957985300000,-917504," "10,'s_ID_13','s_ID_6','s_ID_6','s_ID_11','s_ID_12',0,0,0,0,1,0,0," "1,'ICANN | Internet Corporation for Assigned Names and Numbers'," "'ICANN Internet Corporation for Assigned Names and Numbers'," "'ICANN | Internet Corporation for Assigned Names and Numbers'," "'ICANN | Internet Corporation for Assigned Names and Numbers'," "'ICANN | Internet Corporation for Assigned Names and Numbers'," "'http://www.icann.com/','http://www.icann.com/',NULL," "'PNGAXF0AAFF','DAAFASF');" "INSERT INTO metas VALUES(14,692,692,129079958383000000," "129079958383000000,129079958383000000,129079958383000000,1048576," "11,'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,1,0,0,1," "'The WebKit Open Source Project',NULL," "'The WebKit Open Source Project','The WebKit Open Source Project'," "'The WebKit Open Source Project','http://webkit.org/'," "'http://webkit.org/x',NULL,'PNGX','PNG2Y');" "CREATE TABLE share_info (id VARCHAR(128) primary key, " "last_sync_timestamp INT, name VARCHAR(128), " "initial_sync_ended BIT default 0, store_birthday VARCHAR(256), " "db_create_version VARCHAR(128), db_create_time int, " "next_id bigint default -2, cache_guid VARCHAR(32));" "INSERT INTO share_info VALUES('nick@chromium.org',694," "'nick@chromium.org',1,'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb'," "'Unknown',1263522064,-65542," "'9010788312004066376x-6609234393368420856x');" "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" "INSERT INTO share_version VALUES('nick@chromium.org',68);")); ASSERT_TRUE(connection.CommitTransaction()); }
0
434,975
DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags) { unsigned char *dstPlanes[3]; int pw0, ph0, strides[3], retval = -1, jpegSubsamp = -1; int i, jpegwidth, jpegheight, scaledw, scaledh; GET_DINSTANCE(handle); this->jerr.stopOnWarning = (flags & TJFLAG_STOPONWARNING) ? TRUE : FALSE; if (jpegBuf == NULL || jpegSize <= 0 || dstBuf == NULL || width < 0 || pad < 1 || !IS_POW2(pad) || height < 0) THROW("tjDecompressToYUV2(): Invalid argument"); if (setjmp(this->jerr.setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error. */ return -1; } jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize); jpeg_read_header(dinfo, TRUE); jpegSubsamp = getSubsamp(dinfo); if (jpegSubsamp < 0) THROW("tjDecompressToYUV2(): Could not determine subsampling type for JPEG image"); jpegwidth = dinfo->image_width; jpegheight = dinfo->image_height; if (width == 0) width = jpegwidth; if (height == 0) height = jpegheight; for (i = 0; i < NUMSF; i++) { scaledw = TJSCALED(jpegwidth, sf[i]); scaledh = TJSCALED(jpegheight, sf[i]); if (scaledw <= width && scaledh <= height) break; } if (i >= NUMSF) THROW("tjDecompressToYUV2(): Could not scale down to desired image dimensions"); pw0 = tjPlaneWidth(0, width, jpegSubsamp); ph0 = tjPlaneHeight(0, height, jpegSubsamp); dstPlanes[0] = dstBuf; strides[0] = PAD(pw0, pad); if (jpegSubsamp == TJSAMP_GRAY) { strides[1] = strides[2] = 0; dstPlanes[1] = dstPlanes[2] = NULL; } else { int pw1 = tjPlaneWidth(1, width, jpegSubsamp); int ph1 = tjPlaneHeight(1, height, jpegSubsamp); strides[1] = strides[2] = PAD(pw1, pad); dstPlanes[1] = dstPlanes[0] + strides[0] * ph0; dstPlanes[2] = dstPlanes[1] + strides[1] * ph1; } this->headerRead = 1; return tjDecompressToYUVPlanes(handle, jpegBuf, jpegSize, dstPlanes, width, strides, height, flags); bailout: this->jerr.stopOnWarning = FALSE; return retval; }
0
71,233
static inline uint16_t vmid_to_domainid(uint16_t vm_id) { return vm_id + 1U; }
0
496,482
void visit(Halfedge_handle ) {}
0
193,372
void LayerTilerChromium::invalidateRect(const IntRect& contentRect) { if (contentRect.isEmpty()) return; growLayerToContain(contentRect); IntRect layerRect = contentRectToLayerRect(contentRect); int left, top, right, bottom; contentRectToTileIndices(contentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { Tile* tile = m_tiles[tileIndex(i, j)].get(); if (!tile) continue; IntRect bound = tileLayerRect(i, j); bound.intersect(layerRect); tile->m_dirtyLayerRect.unite(bound); } } }
0
482,698
htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding ATTRIBUTE_UNUSED) { xmlDtdPtr cur = doc->intSubset; if (cur == NULL) { htmlSaveErr(XML_SAVE_NO_DOCTYPE, (xmlNodePtr) doc, NULL); return; } xmlOutputBufferWriteString(buf, "<!DOCTYPE "); xmlOutputBufferWriteString(buf, (const char *)cur->name); if (cur->ExternalID != NULL) { xmlOutputBufferWriteString(buf, " PUBLIC "); xmlBufWriteQuotedString(buf->buffer, cur->ExternalID); if (cur->SystemID != NULL) { xmlOutputBufferWriteString(buf, " "); xmlBufWriteQuotedString(buf->buffer, cur->SystemID); } } else if (cur->SystemID != NULL && xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) { xmlOutputBufferWriteString(buf, " SYSTEM "); xmlBufWriteQuotedString(buf->buffer, cur->SystemID); } xmlOutputBufferWriteString(buf, ">\n"); }
0
295,524
static ssize_t bm_register_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { Node *e; struct inode *inode; struct dentry *root, *dentry; struct super_block *sb = file->f_path.dentry->d_sb; int err = 0; e = create_entry(buffer, count); if (IS_ERR(e)) return PTR_ERR(e); root = dget(sb->s_root); mutex_lock(&root->d_inode->i_mutex); dentry = lookup_one_len(e->name, root, strlen(e->name)); err = PTR_ERR(dentry); if (IS_ERR(dentry)) goto out; err = -EEXIST; if (dentry->d_inode) goto out2; inode = bm_get_inode(sb, S_IFREG | 0644); err = -ENOMEM; if (!inode) goto out2; err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count); if (err) { iput(inode); inode = NULL; goto out2; } e->dentry = dget(dentry); inode->i_private = e; inode->i_fop = &bm_entry_operations; d_instantiate(dentry, inode); write_lock(&entries_lock); list_add(&e->list, &entries); write_unlock(&entries_lock); err = 0; out2: dput(dentry); out: mutex_unlock(&root->d_inode->i_mutex); dput(root); if (err) { kfree(e); return -EINVAL; } return count; }
0
408,554
dvi_document_get_n_pages (EvDocument *document) { DviDocument *dvi_document = DVI_DOCUMENT (document); return dvi_document->context->npages; }
0
266,158
static byte cdecrypt(byte cipher, unsigned short *cr) { const byte plain = (cipher ^ (*cr >> 8)); *cr = (cipher + *cr) * t1_c1 + t1_c2; return plain; }
0
275,382
void BrowserView::UpdateDevToolsSplitPosition() { if (devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_RIGHT) { int split_offset = contents_split_->width() - devtools_window_->GetWidth(contents_split_->width()); contents_split_->set_divider_offset(split_offset); } else { int split_offset = contents_split_->height() - devtools_window_->GetHeight(contents_split_->height()); contents_split_->set_divider_offset(split_offset); } }
0
332,126
static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error **errp) { uint16_t nodenr; uint16List *cpus = NULL; if (node->has_nodeid) { nodenr = node->nodeid; } else { nodenr = nb_numa_nodes; } if (nodenr >= MAX_NODES) { error_setg(errp, "Max number of NUMA nodes reached: %" PRIu16 "", nodenr); return; } if (numa_info[nodenr].present) { error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr); return; } for (cpus = node->cpus; cpus; cpus = cpus->next) { if (cpus->value >= max_cpus) { error_setg(errp, "CPU index (%" PRIu16 ")" " should be smaller than maxcpus (%d)", cpus->value, max_cpus); return; } bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); } if (node->has_mem && node->has_memdev) { error_setg(errp, "qemu: cannot specify both mem= and memdev="); return; } if (have_memdevs == -1) { have_memdevs = node->has_memdev; } if (node->has_memdev != have_memdevs) { error_setg(errp, "qemu: memdev option must be specified for either " "all or no nodes"); return; } if (node->has_mem) { uint64_t mem_size = node->mem; const char *mem_str = qemu_opt_get(opts, "mem"); /* Fix up legacy suffix-less format */ if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) { mem_size <<= 20; } numa_info[nodenr].node_mem = mem_size; } if (node->has_memdev) { Object *o; o = object_resolve_path_type(node->memdev, TYPE_MEMORY_BACKEND, NULL); if (!o) { error_setg(errp, "memdev=%s is ambiguous", node->memdev); return; } object_ref(o); numa_info[nodenr].node_mem = object_property_get_int(o, "size", NULL); numa_info[nodenr].node_memdev = MEMORY_BACKEND(o); } numa_info[nodenr].present = true; max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1); }
0
374,604
_copyCreateFunctionStmt(const CreateFunctionStmt *from) { CreateFunctionStmt *newnode = makeNode(CreateFunctionStmt); COPY_SCALAR_FIELD(replace); COPY_NODE_FIELD(funcname); COPY_NODE_FIELD(parameters); COPY_NODE_FIELD(returnType); COPY_NODE_FIELD(options); COPY_NODE_FIELD(withClause); return newnode; }
0
283,200
void V8TestObject::VoidMethodArrayOfDoubleOrDOMStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodArrayOfDoubleOrDOMStringArg"); test_object_v8_internal::VoidMethodArrayOfDoubleOrDOMStringArgMethod(info); }
0
340,975
void helper_set_cp15(CPUState *env, uint32_t insn, uint32_t val) { uint32_t op2; uint32_t crm; op2 = (insn >> 5) & 7; crm = insn & 0xf; switch ((insn >> 16) & 0xf) { case 0: /* ID codes. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) break; if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; goto bad_reg; case 1: /* System configuration. */ if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (!arm_feature(env, ARM_FEATURE_XSCALE) || crm == 0) env->cp15.c1_sys = val; /* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush(env, 1); break; case 1: if (arm_feature(env, ARM_FEATURE_XSCALE)) { env->cp15.c1_xscaleauxcr = val; break; } goto bad_reg; case 2: if (arm_feature(env, ARM_FEATURE_XSCALE)) goto bad_reg; env->cp15.c1_coproc = val; /* ??? Is this safe when called from within a TB? */ tb_flush(env); break; default: goto bad_reg; } break; case 2: /* MMU Page table control / MPU cache control. */ if (arm_feature(env, ARM_FEATURE_MPU)) { switch (op2) { case 0: env->cp15.c2_data = val; break; case 1: env->cp15.c2_insn = val; break; default: goto bad_reg; } } else { env->cp15.c2_base = val; } break; case 3: /* MMU Domain access control / MPU write buffer control. */ env->cp15.c3 = val; break; case 4: /* Reserved. */ goto bad_reg; case 5: /* MMU Fault status / MPU access permission. */ if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_data = val; break; case 1: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_insn = val; break; case 2: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_data = val; break; case 3: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_insn = val; break; default: goto bad_reg; } break; case 6: /* MMU Fault address / MPU base/size. */ if (arm_feature(env, ARM_FEATURE_MPU)) { if (crm >= 8) goto bad_reg; env->cp15.c6_region[crm] = val; } else { if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: env->cp15.c6_data = val; break; case 1: env->cp15.c6_insn = val; break; default: goto bad_reg; } } break; case 7: /* Cache control. */ env->cp15.c15_i_max = 0x000; env->cp15.c15_i_min = 0xff0; /* No cache, so nothing to do. */ break; case 8: /* MMU TLB control. */ switch (op2) { case 0: /* Invalidate all. */ tlb_flush(env, 0); break; case 1: /* Invalidate single TLB entry. */ #if 0 /* ??? This is wrong for large pages and sections. */ /* As an ugly hack to make linux work we always flush a 4K pages. */ val &= 0xfffff000; tlb_flush_page(env, val); tlb_flush_page(env, val + 0x400); tlb_flush_page(env, val + 0x800); tlb_flush_page(env, val + 0xc00); #else tlb_flush(env, 1); #endif break; default: goto bad_reg; } break; case 9: if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; switch (crm) { case 0: /* Cache lockdown. */ switch (op2) { case 0: env->cp15.c9_data = val; break; case 1: env->cp15.c9_insn = val; break; default: goto bad_reg; } break; case 1: /* TCM memory region registers. */ /* Not implemented. */ goto bad_reg; default: goto bad_reg; } break; case 10: /* MMU TLB lockdown. */ /* ??? TLB lockdown not implemented. */ break; case 12: /* Reserved. */ goto bad_reg; case 13: /* Process ID. */ switch (op2) { case 0: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; /* Unlike real hardware the qemu TLB uses virtual addresses, not modified virtual addresses, so this causes a TLB flush. */ if (env->cp15.c13_fcse != val) tlb_flush(env, 1); env->cp15.c13_fcse = val; break; case 1: /* This changes the ASID, so do a TLB flush. */ if (env->cp15.c13_context != val && !arm_feature(env, ARM_FEATURE_MPU)) tlb_flush(env, 0); env->cp15.c13_context = val; break; default: goto bad_reg; } break; case 14: /* Reserved. */ goto bad_reg; case 15: /* Implementation specific. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) { if (op2 == 0 && crm == 1) { if (env->cp15.c15_cpar != (val & 0x3fff)) { /* Changes cp0 to cp13 behavior, so needs a TB flush. */ tb_flush(env); env->cp15.c15_cpar = val & 0x3fff; } break; } goto bad_reg; } if (arm_feature(env, ARM_FEATURE_OMAPCP)) { switch (crm) { case 0: break; case 1: /* Set TI925T configuration. */ env->cp15.c15_ticonfig = val & 0xe7; env->cp15.c0_cpuid = (val & (1 << 5)) ? /* OS_TYPE bit */ ARM_CPUID_TI915T : ARM_CPUID_TI925T; break; case 2: /* Set I_max. */ env->cp15.c15_i_max = val; break; case 3: /* Set I_min. */ env->cp15.c15_i_min = val; break; case 4: /* Set thread-ID. */ env->cp15.c15_threadid = val & 0xffff; break; case 8: /* Wait-for-interrupt (deprecated). */ cpu_interrupt(env, CPU_INTERRUPT_HALT); break; default: goto bad_reg; } } break; } return; bad_reg: /* ??? For debugging only. Should raise illegal instruction exception. */ cpu_abort(env, "Unimplemented cp15 register write\n"); }
0
328,202
static int vpc_create(const char *filename, QEMUOptionParameter *options) { uint8_t buf[1024]; struct vhd_footer *footer = (struct vhd_footer *) buf; QEMUOptionParameter *disk_type_param; int fd, i; uint16_t cyls = 0; uint8_t heads = 0; uint8_t secs_per_cyl = 0; int64_t total_sectors; int64_t total_size; int disk_type; int ret = -EIO; /* Read out options */ total_size = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n; disk_type_param = get_option_parameter(options, BLOCK_OPT_SUBFMT); if (disk_type_param && disk_type_param->value.s) { if (!strcmp(disk_type_param->value.s, "dynamic")) { disk_type = VHD_DYNAMIC; } else if (!strcmp(disk_type_param->value.s, "fixed")) { disk_type = VHD_FIXED; } else { return -EINVAL; } } else { disk_type = VHD_DYNAMIC; } /* Create the file */ fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd < 0) { return -EIO; } /* * Calculate matching total_size and geometry. Increase the number of * sectors requested until we get enough (or fail). This ensures that * qemu-img convert doesn't truncate images, but rather rounds up. */ total_sectors = total_size / BDRV_SECTOR_SIZE; for (i = 0; total_sectors > (int64_t)cyls * heads * secs_per_cyl; i++) { if (calculate_geometry(total_sectors + i, &cyls, &heads, &secs_per_cyl)) { ret = -EFBIG; goto fail; } } total_sectors = (int64_t) cyls * heads * secs_per_cyl; /* Prepare the Hard Disk Footer */ memset(buf, 0, 1024); memcpy(footer->creator, "conectix", 8); /* TODO Check if "qemu" creator_app is ok for VPC */ memcpy(footer->creator_app, "qemu", 4); memcpy(footer->creator_os, "Wi2k", 4); footer->features = be32_to_cpu(0x02); footer->version = be32_to_cpu(0x00010000); if (disk_type == VHD_DYNAMIC) { footer->data_offset = be64_to_cpu(HEADER_SIZE); } else { footer->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL); } footer->timestamp = be32_to_cpu(time(NULL) - VHD_TIMESTAMP_BASE); /* Version of Virtual PC 2007 */ footer->major = be16_to_cpu(0x0005); footer->minor = be16_to_cpu(0x0003); if (disk_type == VHD_DYNAMIC) { footer->orig_size = be64_to_cpu(total_sectors * 512); footer->size = be64_to_cpu(total_sectors * 512); } else { footer->orig_size = be64_to_cpu(total_size); footer->size = be64_to_cpu(total_size); } footer->cyls = be16_to_cpu(cyls); footer->heads = heads; footer->secs_per_cyl = secs_per_cyl; footer->type = be32_to_cpu(disk_type); /* TODO uuid is missing */ footer->checksum = be32_to_cpu(vpc_checksum(buf, HEADER_SIZE)); if (disk_type == VHD_DYNAMIC) { ret = create_dynamic_disk(fd, buf, total_sectors); } else { ret = create_fixed_disk(fd, buf, total_size); } fail: qemu_close(fd); return ret; }
0
248,295
WebLocalFrame* WebLocalFrameImpl::ToWebLocalFrame() { return this; }
0
7,077
static int br_multicast_add_group(struct net_bridge *br, struct net_bridge_port *port, struct br_ip *group) { struct net_bridge_mdb_entry *mp; struct net_bridge_port_group *p; struct net_bridge_port_group __rcu **pp; unsigned long now = jiffies; int err; spin_lock(&br->multicast_lock); if (!netif_running(br->dev) || (port && port->state == BR_STATE_DISABLED)) goto out; mp = br_multicast_new_group(br, port, group); err = PTR_ERR(mp); if (IS_ERR(mp)) goto err; if (!port) { hlist_add_head(&mp->mglist, &br->mglist); mod_timer(&mp->timer, now + br->multicast_membership_interval); goto out; } for (pp = &mp->ports; (p = mlock_dereference(*pp, br)) != NULL; pp = &p->next) { if (p->port == port) goto found; if ((unsigned long)p->port < (unsigned long)port) break; } p = kzalloc(sizeof(*p), GFP_ATOMIC); err = -ENOMEM; if (unlikely(!p)) goto err; p->addr = *group; p->port = port; p->next = *pp; hlist_add_head(&p->mglist, &port->mglist); setup_timer(&p->timer, br_multicast_port_group_expired, (unsigned long)p); setup_timer(&p->query_timer, br_multicast_port_group_query_expired, (unsigned long)p); rcu_assign_pointer(*pp, p); found: mod_timer(&p->timer, now + br->multicast_membership_interval); out: err = 0; err: spin_unlock(&br->multicast_lock); return err; }
1
380,378
HandleRFBServerMessage(rfbClient* client) { rfbServerToClientMsg msg; if (client->serverPort==-1) client->vncRec->readTimestamp = TRUE; if (!ReadFromRFBServer(client, (char *)&msg, 1)) return FALSE; switch (msg.type) { case rfbSetColourMapEntries: { /* TODO: int i; uint16_t rgb[3]; XColor xc; if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbSetColourMapEntriesMsg - 1)) return FALSE; msg.scme.firstColour = rfbClientSwap16IfLE(msg.scme.firstColour); msg.scme.nColours = rfbClientSwap16IfLE(msg.scme.nColours); for (i = 0; i < msg.scme.nColours; i++) { if (!ReadFromRFBServer(client, (char *)rgb, 6)) return FALSE; xc.pixel = msg.scme.firstColour + i; xc.red = rfbClientSwap16IfLE(rgb[0]); xc.green = rfbClientSwap16IfLE(rgb[1]); xc.blue = rfbClientSwap16IfLE(rgb[2]); xc.flags = DoRed|DoGreen|DoBlue; XStoreColor(dpy, cmap, &xc); } */ break; } case rfbFramebufferUpdate: { rfbFramebufferUpdateRectHeader rect; int linesToRead; int bytesPerLine; int i; if (!ReadFromRFBServer(client, ((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) return FALSE; msg.fu.nRects = rfbClientSwap16IfLE(msg.fu.nRects); for (i = 0; i < msg.fu.nRects; i++) { if (!ReadFromRFBServer(client, (char *)&rect, sz_rfbFramebufferUpdateRectHeader)) return FALSE; rect.encoding = rfbClientSwap32IfLE(rect.encoding); if (rect.encoding == rfbEncodingLastRect) break; rect.r.x = rfbClientSwap16IfLE(rect.r.x); rect.r.y = rfbClientSwap16IfLE(rect.r.y); rect.r.w = rfbClientSwap16IfLE(rect.r.w); rect.r.h = rfbClientSwap16IfLE(rect.r.h); if (rect.encoding == rfbEncodingXCursor || rect.encoding == rfbEncodingRichCursor) { if (!HandleCursorShape(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h, rect.encoding)) { return FALSE; } continue; } if (rect.encoding == rfbEncodingPointerPos) { if (!client->HandleCursorPos(client,rect.r.x, rect.r.y)) { return FALSE; } continue; } if (rect.encoding == rfbEncodingKeyboardLedState) { /* OK! We have received a keyboard state message!!! */ client->KeyboardLedStateEnabled = 1; if (client->HandleKeyboardLedState!=NULL) client->HandleKeyboardLedState(client, rect.r.x, 0); /* stash it for the future */ client->CurrentKeyboardLedState = rect.r.x; continue; } if (rect.encoding == rfbEncodingNewFBSize) { client->width = rect.r.w; client->height = rect.r.h; client->updateRect.x = client->updateRect.y = 0; client->updateRect.w = client->width; client->updateRect.h = client->height; if (!client->MallocFrameBuffer(client)) return FALSE; SendFramebufferUpdateRequest(client, 0, 0, rect.r.w, rect.r.h, FALSE); rfbClientLog("Got new framebuffer size: %dx%d\n", rect.r.w, rect.r.h); continue; } /* rect.r.w=byte count */ if (rect.encoding == rfbEncodingSupportedMessages) { int loop; if (!ReadFromRFBServer(client, (char *)&client->supportedMessages, sz_rfbSupportedMessages)) return FALSE; /* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */ /* currently ignored by this library */ rfbClientLog("client2server supported messages (bit flags)\n"); for (loop=0;loop<32;loop+=8) rfbClientLog("%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\n", loop, client->supportedMessages.client2server[loop], client->supportedMessages.client2server[loop+1], client->supportedMessages.client2server[loop+2], client->supportedMessages.client2server[loop+3], client->supportedMessages.client2server[loop+4], client->supportedMessages.client2server[loop+5], client->supportedMessages.client2server[loop+6], client->supportedMessages.client2server[loop+7]); rfbClientLog("server2client supported messages (bit flags)\n"); for (loop=0;loop<32;loop+=8) rfbClientLog("%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\n", loop, client->supportedMessages.server2client[loop], client->supportedMessages.server2client[loop+1], client->supportedMessages.server2client[loop+2], client->supportedMessages.server2client[loop+3], client->supportedMessages.server2client[loop+4], client->supportedMessages.server2client[loop+5], client->supportedMessages.server2client[loop+6], client->supportedMessages.server2client[loop+7]); continue; } /* rect.r.w=byte count, rect.r.h=# of encodings */ if (rect.encoding == rfbEncodingSupportedEncodings) { char *buffer; buffer = malloc(rect.r.w); if (!ReadFromRFBServer(client, buffer, rect.r.w)) { free(buffer); return FALSE; } /* buffer now contains rect.r.h # of uint32_t encodings that the server supports */ /* currently ignored by this library */ free(buffer); continue; } /* rect.r.w=byte count */ if (rect.encoding == rfbEncodingServerIdentity) { char *buffer; buffer = malloc(rect.r.w+1); if (!ReadFromRFBServer(client, buffer, rect.r.w)) { free(buffer); return FALSE; } buffer[rect.r.w]=0; /* null terminate, just in case */ rfbClientLog("Connected to Server \"%s\"\n", buffer); free(buffer); continue; } /* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */ if (rect.encoding != rfbEncodingUltraZip) { if ((rect.r.x + rect.r.w > client->width) || (rect.r.y + rect.r.h > client->height)) { rfbClientLog("Rect too large: %dx%d at (%d, %d)\n", rect.r.w, rect.r.h, rect.r.x, rect.r.y); return FALSE; } /* UltraVNC with scaling, will send rectangles with a zero W or H * if ((rect.encoding != rfbEncodingTight) && (rect.r.h * rect.r.w == 0)) { rfbClientLog("Zero size rect - ignoring (encoding=%d (0x%08x) %dx, %dy, %dw, %dh)\n", rect.encoding, rect.encoding, rect.r.x, rect.r.y, rect.r.w, rect.r.h); continue; } */ /* If RichCursor encoding is used, we should prevent collisions between framebuffer updates and cursor drawing operations. */ client->SoftCursorLockArea(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h); } switch (rect.encoding) { case rfbEncodingRaw: { int y=rect.r.y, h=rect.r.h; bytesPerLine = rect.r.w * client->format.bitsPerPixel / 8; linesToRead = RFB_BUFFER_SIZE / bytesPerLine; while (h > 0) { if (linesToRead > h) linesToRead = h; if (!ReadFromRFBServer(client, client->buffer,bytesPerLine * linesToRead)) return FALSE; CopyRectangle(client, (uint8_t *)client->buffer, rect.r.x, y, rect.r.w,linesToRead); h -= linesToRead; y += linesToRead; } } break; case rfbEncodingCopyRect: { rfbCopyRect cr; if (!ReadFromRFBServer(client, (char *)&cr, sz_rfbCopyRect)) return FALSE; cr.srcX = rfbClientSwap16IfLE(cr.srcX); cr.srcY = rfbClientSwap16IfLE(cr.srcY); /* If RichCursor encoding is used, we should extend our "cursor lock area" (previously set to destination rectangle) to the source rectangle as well. */ client->SoftCursorLockArea(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h); if (client->GotCopyRect != NULL) { client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h, rect.r.x, rect.r.y); } else CopyRectangleFromRectangle(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h, rect.r.x, rect.r.y); break; } case rfbEncodingRRE: { switch (client->format.bitsPerPixel) { case 8: if (!HandleRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } case rfbEncodingCoRRE: { switch (client->format.bitsPerPixel) { case 8: if (!HandleCoRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleCoRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleCoRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } case rfbEncodingHextile: { switch (client->format.bitsPerPixel) { case 8: if (!HandleHextile8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleHextile16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleHextile32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } case rfbEncodingUltra: { switch (client->format.bitsPerPixel) { case 8: if (!HandleUltra8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleUltra16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleUltra32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } case rfbEncodingUltraZip: { switch (client->format.bitsPerPixel) { case 8: if (!HandleUltraZip8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleUltraZip16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleUltraZip32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } #ifdef LIBVNCSERVER_HAVE_LIBZ case rfbEncodingZlib: { switch (client->format.bitsPerPixel) { case 8: if (!HandleZlib8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleZlib16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleZlib32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } #ifdef LIBVNCSERVER_HAVE_LIBJPEG case rfbEncodingTight: { switch (client->format.bitsPerPixel) { case 8: if (!HandleTight8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (!HandleTight16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 32: if (!HandleTight32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } break; } #endif case rfbEncodingZRLE: /* Fail safe for ZYWRLE unsupport VNC server. */ client->appData.qualityLevel = 9; /* fall through */ case rfbEncodingZYWRLE: { switch (client->format.bitsPerPixel) { case 8: if (!HandleZRLE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; case 16: if (client->si.format.greenMax > 0x1F) { if (!HandleZRLE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; } else { if (!HandleZRLE15(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; } break; case 32: { uint32_t maxColor=(client->format.redMax<<client->format.redShift)| (client->format.greenMax<<client->format.greenShift)| (client->format.blueMax<<client->format.blueShift); if ((client->format.bigEndian && (maxColor&0xff)==0) || (!client->format.bigEndian && (maxColor&0xff000000)==0)) { if (!HandleZRLE24(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; } else if (!client->format.bigEndian && (maxColor&0xff)==0) { if (!HandleZRLE24Up(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; } else if (client->format.bigEndian && (maxColor&0xff000000)==0) { if (!HandleZRLE24Down(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; } else if (!HandleZRLE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h)) return FALSE; break; } } break; } #endif #ifdef LIBVNCSERVER_CONFIG_LIBVA case rfbEncodingH264: { if (!HandleH264(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h)) return FALSE; break; } #endif default: { rfbBool handled = FALSE; rfbClientProtocolExtension* e; for(e = rfbClientExtensions; !handled && e; e = e->next) if(e->handleEncoding && e->handleEncoding(client, &rect)) handled = TRUE; if(!handled) { rfbClientLog("Unknown rect encoding %d\n", (int)rect.encoding); return FALSE; } } } /* Now we may discard "soft cursor locks". */ client->SoftCursorUnlockScreen(client); client->GotFrameBufferUpdate(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h); } if (!SendIncrementalFramebufferUpdateRequest(client)) return FALSE; if (client->FinishedFrameBufferUpdate) client->FinishedFrameBufferUpdate(client); break; } case rfbBell: { client->Bell(client); break; } case rfbServerCutText: { char *buffer; if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbServerCutTextMsg - 1)) return FALSE; msg.sct.length = rfbClientSwap32IfLE(msg.sct.length); buffer = malloc(msg.sct.length+1); if (!ReadFromRFBServer(client, buffer, msg.sct.length)) return FALSE; buffer[msg.sct.length] = 0; if (client->GotXCutText) client->GotXCutText(client, buffer, msg.sct.length); free(buffer); break; } case rfbTextChat: { char *buffer=NULL; if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbTextChatMsg- 1)) return FALSE; msg.tc.length = rfbClientSwap32IfLE(msg.sct.length); switch(msg.tc.length) { case rfbTextChatOpen: rfbClientLog("Received TextChat Open\n"); if (client->HandleTextChat!=NULL) client->HandleTextChat(client, (int)rfbTextChatOpen, NULL); break; case rfbTextChatClose: rfbClientLog("Received TextChat Close\n"); if (client->HandleTextChat!=NULL) client->HandleTextChat(client, (int)rfbTextChatClose, NULL); break; case rfbTextChatFinished: rfbClientLog("Received TextChat Finished\n"); if (client->HandleTextChat!=NULL) client->HandleTextChat(client, (int)rfbTextChatFinished, NULL); break; default: buffer=malloc(msg.tc.length+1); if (!ReadFromRFBServer(client, buffer, msg.tc.length)) { free(buffer); return FALSE; } /* Null Terminate <just in case> */ buffer[msg.tc.length]=0; rfbClientLog("Received TextChat \"%s\"\n", buffer); if (client->HandleTextChat!=NULL) client->HandleTextChat(client, (int)msg.tc.length, buffer); free(buffer); break; } break; } case rfbXvp: { if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbXvpMsg -1)) return FALSE; SetClient2Server(client, rfbXvp); /* technically, we only care what we can *send* to the server * but, we set Server2Client Just in case it ever becomes useful */ SetServer2Client(client, rfbXvp); if(client->HandleXvpMsg) client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code); break; } case rfbResizeFrameBuffer: { if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbResizeFrameBufferMsg -1)) return FALSE; client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth); client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth); client->updateRect.x = client->updateRect.y = 0; client->updateRect.w = client->width; client->updateRect.h = client->height; if (!client->MallocFrameBuffer(client)) return FALSE; SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE); rfbClientLog("Got new framebuffer size: %dx%d\n", client->width, client->height); break; } case rfbPalmVNCReSizeFrameBuffer: { if (!ReadFromRFBServer(client, ((char *)&msg) + 1, sz_rfbPalmVNCReSizeFrameBufferMsg -1)) return FALSE; client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w); client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h); client->updateRect.x = client->updateRect.y = 0; client->updateRect.w = client->width; client->updateRect.h = client->height; if (!client->MallocFrameBuffer(client)) return FALSE; SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE); rfbClientLog("Got new framebuffer size: %dx%d\n", client->width, client->height); break; } default: { rfbBool handled = FALSE; rfbClientProtocolExtension* e; for(e = rfbClientExtensions; !handled && e; e = e->next) if(e->handleMessage && e->handleMessage(client, &msg)) handled = TRUE; if(!handled) { char buffer[256]; rfbClientLog("Unknown message type %d from VNC server\n",msg.type); ReadFromRFBServer(client, buffer, 256); return FALSE; } } } return TRUE; }
0
237,721
void HideHostCursor() { CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor, (CreateInvisibleCursor(), ui::GetXDisplay())); XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()), invisible_cursor.get()); }
0
459,644
dissect_kafka_describe_groups_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, kafka_api_version_t api_version) { if (api_version >= 1) { offset = dissect_kafka_throttle_time(tvb, pinfo, tree, offset); } /* [group] */ offset = dissect_kafka_array(tree, tvb, pinfo, offset, api_version >= 5, api_version, &dissect_kafka_describe_groups_response_group, NULL); if (api_version >= 5) { offset = dissect_kafka_tagged_fields(tvb, pinfo, tree, offset, 0); } return offset; }
0
37,149
static int x86_pmu_extra_regs(u64 config, struct perf_event *event) { struct extra_reg *er; event->hw.extra_reg = 0; event->hw.extra_config = 0; if (!x86_pmu.extra_regs) return 0; for (er = x86_pmu.extra_regs; er->msr; er++) { if (er->event != (config & er->config_mask)) continue; if (event->attr.config1 & ~er->valid_mask) return -EINVAL; event->hw.extra_reg = er->msr; event->hw.extra_config = event->attr.config1; break; } return 0; }
0
501,555
TEST_F(HttpHealthCheckerImplTest, SuccessWithMultipleHosts) { setupNoServiceValidationHC(); EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged)).Times(2); cluster_->prioritySet().getMockHostSet(0)->hosts_ = { makeTestHost(cluster_->info_, "tcp://127.0.0.1:80", simTime()), makeTestHost(cluster_->info_, "tcp://127.0.0.1:81", simTime())}; cluster_->info_->stats().upstream_cx_total_.inc(); cluster_->info_->stats().upstream_cx_total_.inc(); expectSessionCreate(); expectStreamCreate(0); EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _)); expectSessionCreate(); expectStreamCreate(1); EXPECT_CALL(*test_sessions_[1]->timeout_timer_, enableTimer(_, _)); health_checker_->start(); EXPECT_CALL(runtime_.snapshot_, getInteger("health_check.max_interval", _)).Times(2); EXPECT_CALL(runtime_.snapshot_, getInteger("health_check.min_interval", _)) .Times(2) .WillRepeatedly(Return(45000)); EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(std::chrono::milliseconds(45000), _)); EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer()); EXPECT_CALL(*test_sessions_[1]->interval_timer_, enableTimer(std::chrono::milliseconds(45000), _)); EXPECT_CALL(*test_sessions_[1]->timeout_timer_, disableTimer()); respond(0, "200", false, false, true); respond(1, "200", false, false, true); EXPECT_EQ(Host::Health::Healthy, cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health()); EXPECT_EQ(Host::Health::Healthy, cluster_->prioritySet().getMockHostSet(0)->hosts_[1]->health()); }
0
316,099
void FrameSelection::SetUseSecureKeyboardEntry(bool enable) { if (enable) EnableSecureTextInput(); else DisableSecureTextInput(); }
0
354,627
pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f) { spin_unlock(&(x)->ctx_lock); }
0
461,766
static struct bus_type iscsi_flashnode_bus; int iscsi_flashnode_bus_match(struct device *dev, struct device_driver *drv) { if (dev->bus == &iscsi_flashnode_bus)
0
476,739
prologProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *next = s; int tok = XmlPrologTok(parser->m_encoding, s, end, &next); return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE, XML_ACCOUNT_DIRECT); }
0
118,845
GF_Err video_sample_entry_on_child_box(GF_Box *s, GF_Box *a) { GF_MPEGVisualSampleEntryBox *ptr = (GF_MPEGVisualSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; break; case GF_ISOM_BOX_TYPE_RINF: if (ptr->rinf) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->rinf = (GF_RestrictedSchemeInfoBox *) a; break; case GF_ISOM_BOX_TYPE_AVCC: if (ptr->avc_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->avc_config = (GF_AVCConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_HVCC: if (ptr->hevc_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->hevc_config = (GF_HEVCConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_SVCC: if (ptr->svc_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->svc_config = (GF_AVCConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_MVCC: if (ptr->mvc_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->mvc_config = (GF_AVCConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_LHVC: if (ptr->lhvc_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->lhvc_config = (GF_HEVCConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_AV1C: if (ptr->av1_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->av1_config = (GF_AV1ConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_VPCC: if (ptr->vp_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->vp_config = (GF_VPConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_DVCC: if (ptr->dovi_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->dovi_config = (GF_DOVIConfigurationBox*)a; break; case GF_ISOM_BOX_TYPE_UUID: if (! memcmp(((GF_UnknownUUIDBox*)a)->uuid, GF_ISOM_IPOD_EXT, 16)) { if (ptr->ipod_ext) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->ipod_ext = (GF_UnknownUUIDBox *)a; } else { return GF_OK; } break; case GF_ISOM_BOX_TYPE_D263: if (ptr->cfg_3gpp) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_3gpp = (GF_3GPPConfigBox *)a; /*for 3GP config, remember sample entry type in config*/ ptr->cfg_3gpp->cfg.type = ptr->type; break; case GF_ISOM_BOX_TYPE_JP2H: if (ptr->jp2h) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->jp2h = (GF_J2KHeaderBox *)a; return GF_OK; case GF_ISOM_BOX_TYPE_PASP: case GF_ISOM_BOX_TYPE_CLAP: case GF_ISOM_BOX_TYPE_COLR: case GF_ISOM_BOX_TYPE_MDCV: case GF_ISOM_BOX_TYPE_CLLI: case GF_ISOM_BOX_TYPE_CCST: case GF_ISOM_BOX_TYPE_AUXI: case GF_ISOM_BOX_TYPE_RVCC: case GF_ISOM_BOX_TYPE_M4DS: if (!gf_isom_box_check_unique(s->child_boxes, a)) { ERROR_ON_DUPLICATED_BOX(a, ptr) } return GF_OK; } return GF_OK; }
0
197,781
bool running() const { return running_; }
0
109,082
void sqlite3WithDelete(sqlite3 *db, With *pWith){ if( pWith ){ int i; for(i=0; i<pWith->nCte; i++){ struct Cte *pCte = &pWith->a[i]; sqlite3ExprListDelete(db, pCte->pCols); sqlite3SelectDelete(db, pCte->pSelect); sqlite3DbFree(db, pCte->zName); } sqlite3DbFree(db, pWith); } }
0
95,958
TiledInputFile::initialize () { // fix bad types in header (arises when a tool built against an older version of // OpenEXR converts a scanline image to tiled) // only applies when file is a single part, regular image, tiled file // if(!isMultiPart(_data->version) && !isNonImage(_data->version) && isTiled(_data->version) && _data->header.hasType() ) { _data->header.setType(TILEDIMAGE); } if (_data->partNumber == -1) { if (!isTiled (_data->version)) throw IEX_NAMESPACE::ArgExc ("Expected a tiled file but the file is not tiled."); } else { if(_data->header.hasType() && _data->header.type()!=TILEDIMAGE) { throw IEX_NAMESPACE::ArgExc ("TiledInputFile used for non-tiledimage part."); } } _data->header.sanityCheck (true); _data->tileDesc = _data->header.tileDescription(); _data->lineOrder = _data->header.lineOrder(); // // Save the dataWindow information // const Box2i &dataWindow = _data->header.dataWindow(); _data->minX = dataWindow.min.x; _data->maxX = dataWindow.max.x; _data->minY = dataWindow.min.y; _data->maxY = dataWindow.max.y; // // Precompute level and tile information to speed up utility functions // precalculateTileInfo (_data->tileDesc, _data->minX, _data->maxX, _data->minY, _data->maxY, _data->numXTiles, _data->numYTiles, _data->numXLevels, _data->numYLevels); _data->bytesPerPixel = calculateBytesPerPixel (_data->header); _data->maxBytesPerTileLine = _data->bytesPerPixel * _data->tileDesc.xSize; _data->tileBufferSize = _data->maxBytesPerTileLine * _data->tileDesc.ySize; // // Create all the TileBuffers and allocate their internal buffers // for (size_t i = 0; i < _data->tileBuffers.size(); i++) { _data->tileBuffers[i] = new TileBuffer (newTileCompressor (_data->header.compression(), _data->maxBytesPerTileLine, _data->tileDesc.ySize, _data->header)); if (!_data->_streamData->is->isMemoryMapped ()) _data->tileBuffers[i]->buffer = new char [_data->tileBufferSize]; } _data->tileOffsets = TileOffsets (_data->tileDesc.mode, _data->numXLevels, _data->numYLevels, _data->numXTiles, _data->numYTiles); }
0