unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
163,061
0
void SandboxIPCHandler::HandleRequestFromChild(int fd) { std::vector<base::ScopedFD> fds; char buf[FontConfigIPC::kMaxFontFamilyLength + 128]; const ssize_t len = base::UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); if (len == -1) { NOTREACHED() << "Sandbox host message is larger than kMaxFontFamilyLength"; return; } if (fds.empty()) return; base::Pickle pickle(buf, len); base::PickleIterator iter(pickle); int kind; if (!iter.ReadInt(&kind)) return; if (kind == FontConfigIPC::METHOD_MATCH) { HandleFontMatchRequest(fd, iter, fds); } else if (kind == FontConfigIPC::METHOD_OPEN) { HandleFontOpenRequest(fd, iter, fds); } else if (kind == LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR) { HandleGetFallbackFontForChar(fd, iter, fds); } else if (kind == LinuxSandbox::METHOD_LOCALTIME) { HandleLocaltime(fd, iter, fds); } else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) { HandleGetStyleForStrike(fd, iter, fds); } else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) { HandleMakeSharedMemorySegment(fd, iter, fds); } else if (kind == LinuxSandbox::METHOD_MATCH_WITH_FALLBACK) { HandleMatchWithFallback(fd, iter, fds); } }
7,200
71,808
0
static void draw_stroke_color_rgb( wmfAPI* API, const wmfRGB* rgb ) { PixelWand *stroke_color; stroke_color=NewPixelWand(); PixelSetRedQuantum(stroke_color,ScaleCharToQuantum(rgb->r)); PixelSetGreenQuantum(stroke_color,ScaleCharToQuantum(rgb->g)); PixelSetBlueQuantum(stroke_color,ScaleCharToQuantum(rgb->b)); PixelSetOpacityQuantum(stroke_color,OpaqueOpacity); DrawSetStrokeColor(WmfDrawingWand,stroke_color); stroke_color=DestroyPixelWand(stroke_color); }
7,201
110,503
0
void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM( GLenum target, GLsizei width, GLsizei height, GLuint io_surface_id, GLuint plane) { #if defined(OS_MACOSX) if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { SetGLError( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "only supported on desktop GL."); return; } IOSurfaceSupport* surface_support = IOSurfaceSupport::Initialize(); if (!surface_support) { SetGLError(GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "only supported on 10.6."); return; } if (target != GL_TEXTURE_RECTANGLE_ARB) { SetGLError( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "requires TEXTURE_RECTANGLE_ARB target"); return; } TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "no rectangle texture bound"); return; } if (info == texture_manager()->GetDefaultTextureInfo(target)) { SetGLError(GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "can't bind default texture"); return; } CFTypeRef surface = surface_support->IOSurfaceLookup(io_surface_id); if (!surface) { SetGLError( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "no IOSurface with the given ID"); return; } ReleaseIOSurfaceForTexture(info->service_id()); texture_to_io_surface_map_.insert( std::make_pair(info->service_id(), surface)); CGLContextObj context = static_cast<CGLContextObj>(context_->GetHandle()); CGLError err = surface_support->CGLTexImageIOSurface2D( context, target, GL_RGBA, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, plane); if (err != kCGLNoError) { SetGLError( GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "error in CGLTexImageIOSurface2D"); return; } texture_manager()->SetLevelInfo( info, target, 0, GL_RGBA, width, height, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true); #else SetGLError(GL_INVALID_OPERATION, "glTexImageIOSurface2DCHROMIUM", "not supported."); #endif }
7,202
125,429
0
void GDataFileSystem::OnUpdatedFileUploaded( const FileOperationCallback& callback, GDataFileError error, scoped_ptr<UploadFileInfo> upload_file_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error); return; } AddUploadedFile(UPLOAD_EXISTING_FILE, upload_file_info->gdata_path.DirName(), upload_file_info->entry.Pass(), upload_file_info->file_path, GDataCache::FILE_OPERATION_MOVE, base::Bind(&OnAddUploadFileCompleted, callback, error)); }
7,203
147,575
0
static void NewObjectTestInterfaceMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); TestInterfaceImplementation* result = impl->newObjectTestInterfaceMethod(); DCHECK(!result || DOMDataStore::GetWrapper(result, info.GetIsolate()).IsEmpty()); V8SetReturnValue(info, result); }
7,204
72,339
0
cleanup_exit(int i) { cleanup_socket(); _exit(i); }
7,205
39,694
0
struct dentry *lookup_create(struct nameidata *nd, int is_dir) { struct dentry *dentry = ERR_PTR(-EEXIST); mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); /* * Yucky last component or no last component at all? * (foo/., foo/.., /////) */ if (nd->last_type != LAST_NORM) goto fail; nd->flags &= ~LOOKUP_PARENT; nd->flags |= LOOKUP_CREATE | LOOKUP_EXCL; nd->intent.open.flags = O_EXCL; /* * Do the final lookup. */ dentry = lookup_hash(nd); if (IS_ERR(dentry)) goto fail; if (dentry->d_inode) goto eexist; /* * Special case - lookup gave negative, but... we had foo/bar/ * From the vfs_mknod() POV we just have a negative dentry - * all is fine. Let's be bastards - you had / on the end, you've * been asking for (non-existent) directory. -ENOENT for you. */ if (unlikely(!is_dir && nd->last.name[nd->last.len])) { dput(dentry); dentry = ERR_PTR(-ENOENT); } return dentry; eexist: dput(dentry); dentry = ERR_PTR(-EEXIST); fail: return dentry; }
7,206
126,306
0
virtual ~SwichToMetroUIHandler() { default_browser_worker_->ObserverDestroyed(); }
7,207
41,599
0
static int irda_sendmsg_ultra(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; __u8 pid = 0; int bound = 0; struct sk_buff *skb; int err; pr_debug("%s(), len=%zd\n", __func__, len); err = -EINVAL; if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; lock_sock(sk); err = -EPIPE; if (sk->sk_shutdown & SEND_SHUTDOWN) { send_sig(SIGPIPE, current, 0); goto out; } self = irda_sk(sk); /* Check if an address was specified with sendto. Jean II */ if (msg->msg_name) { DECLARE_SOCKADDR(struct sockaddr_irda *, addr, msg->msg_name); err = -EINVAL; /* Check address, extract pid. Jean II */ if (msg->msg_namelen < sizeof(*addr)) goto out; if (addr->sir_family != AF_IRDA) goto out; pid = addr->sir_lsap_sel; if (pid & 0x80) { pr_debug("%s(), extension in PID not supp!\n", __func__); err = -EOPNOTSUPP; goto out; } } else { /* Check that the socket is properly bound to an Ultra * port. Jean II */ if ((self->lsap == NULL) || (sk->sk_state != TCP_ESTABLISHED)) { pr_debug("%s(), socket not bound to Ultra PID.\n", __func__); err = -ENOTCONN; goto out; } /* Use PID from socket */ bound = 1; } /* * Check that we don't send out too big frames. This is an unreliable * service, so we have no fragmentation and no coalescence */ if (len > self->max_data_size) { pr_debug("%s(), Warning too much data! Chopping frame from %zd to %d bytes!\n", __func__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size, msg->msg_flags & MSG_DONTWAIT, &err); err = -ENOBUFS; if (!skb) goto out; skb_reserve(skb, self->max_header_size); skb_reset_transport_header(skb); pr_debug("%s(), appending user data\n", __func__); skb_put(skb, len); err = memcpy_from_msg(skb_transport_header(skb), msg, len); if (err) { kfree_skb(skb); goto out; } err = irlmp_connless_data_request((bound ? self->lsap : NULL), skb, pid); if (err) pr_debug("%s(), err=%d\n", __func__, err); out: release_sock(sk); return err ? : len; }
7,208
83,778
0
static void hw_roc_done(struct work_struct *work) { struct mac80211_hwsim_data *hwsim = container_of(work, struct mac80211_hwsim_data, roc_done.work); mutex_lock(&hwsim->mutex); ieee80211_remain_on_channel_expired(hwsim->hw); hwsim->tmp_chan = NULL; mutex_unlock(&hwsim->mutex); wiphy_dbg(hwsim->hw->wiphy, "hwsim ROC expired\n"); }
7,209
14,341
0
static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned mac_size, orig_len; size_t extra; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra=SSL3_RT_MAX_EXTRA; else extra=0; if (extra && !s->s3->init_extra) { /* An application error: SLS_OP_MICROSOFT_BIG_SSLV3_BUFFER * set after ssl3_setup_buffers() was done */ SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR); return -1; } again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; p=s->packet; /* Pull apart the header into the SSL3_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; n2s(p,rr->length); #if 0 fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length); #endif /* Lets check version */ if (!s->first_packet) { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); if ((s->version & 0xFF00) == (version & 0xFF00) && !s->enc_write_ctx && !s->write_hash) /* Send back error using their minor version number :-) */ s->version = (unsigned short)version; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version>>8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); if (n <= 0) return(n); /* error or non-blocking io */ /* now n == rr->length, * and s->packet_length == SSL3_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input= &(s->packet[SSL3_RT_HEADER_LENGTH]); /* ok, we can now read from 's->packet' data into 'rr' * rr->input points at rr->length bytes, which * need to be copied into rr->data by either * the decryption or by the decompression * When the data is 'copied' into the rr->data buffer, * rr->input will be pointed at the new buffer */ /* We now have - encrypted [ MAC [ compressed [ plain ] ] ] * rr->length bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data=rr->input; enc_err = s->method->ssl3_enc->enc(s,0); /* enc_err is: * 0: (in non-constant time) if the record is publically invalid. * 1: if the padding is valid * -1: if the padding is invalid */ if (enc_err == 0) { al=SSL_AD_DECRYPTION_FAILED; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); goto f_err; } #ifdef TLS_DEBUG printf("dec %d\n",rr->length); { unsigned int z; for (z=0; z<rr->length; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ((sess != NULL) && (s->enc_read_ctx != NULL) && (EVP_MD_CTX_md(s->read_hash) != NULL)) { /* s->read_hash != NULL => mac_size != -1 */ unsigned char *mac = NULL; unsigned char mac_tmp[EVP_MAX_MD_SIZE]; mac_size=EVP_MD_CTX_size(s->read_hash); OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE); /* kludge: *_cbc_remove_padding passes padding length in rr->type */ orig_len = rr->length+((unsigned int)rr->type>>8); /* orig_len is the length of the record before any padding was * removed. This is public information, as is the MAC in use, * therefore we can safely process the record in a different * amount of time if it's too short to possibly contain a MAC. */ if (orig_len < mac_size || /* CBC records must have a padding length byte too. */ (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE && orig_len < mac_size+1)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); goto f_err; } if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) { /* We update the length so that the TLS header bytes * can be constructed correctly but we need to extract * the MAC in constant time from within the record, * without leaking the contents of the padding bytes. * */ mac = mac_tmp; ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len); rr->length -= mac_size; } else { /* In this case there's no padding, so |orig_len| * equals |rec->length| and we checked that there's * enough bytes for |mac_size| above. */ rr->length -= mac_size; mac = &rr->data[rr->length]; } i=s->method->ssl3_enc->mac(s,md,0 /* not send */); if (i < 0 || mac == NULL || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0) enc_err = -1; if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) enc_err = -1; } if (enc_err < 0) { /* A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, * we should not reveal which kind of error occured -- this * might become visible to an attacker (e.g. via a logfile) */ al=SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!ssl3_do_uncompress(s)) { al=SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off=0; /* So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length=0; /* just read a 0 length packet */ if (rr->length == 0) goto again; #if 0 fprintf(stderr, "Ultimate Record type=%d, Length=%d\n", rr->type, rr->length); #endif return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(ret); }
7,210
151,866
0
RenderFrameHostImpl::AccessibilityGetNativeViewAccessible() { RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( render_view_host_->GetWidget()->GetView()); if (view) return view->AccessibilityGetNativeViewAccessible(); return nullptr; }
7,211
75,665
0
error_detected(uint32_t errnum, char *errstr, ...) { va_list args; va_start(args, errstr); { TSK_ERROR_INFO *errInfo = tsk_error_get_info(); char *loc_errstr = errInfo->errstr; if (errInfo->t_errno == 0) errInfo->t_errno = errnum; else { size_t sl = strlen(errstr); snprintf(loc_errstr + sl, TSK_ERROR_STRING_MAX_LENGTH - sl, " Next errnum: 0x%x ", errnum); } if (errstr != NULL) { size_t sl = strlen(loc_errstr); vsnprintf(loc_errstr + sl, TSK_ERROR_STRING_MAX_LENGTH - sl, errstr, args); } } va_end(args); }
7,212
14,224
0
PHP_FUNCTION(openssl_open) { zval **privkey, *opendata; EVP_PKEY *pkey; int len1, len2; unsigned char *buf; long keyresource = -1; EVP_CIPHER_CTX ctx; char * data; int data_len; char * ekey; int ekey_len; char *method =NULL; int method_len = 0; const EVP_CIPHER *cipher; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szsZ|s", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len) == FAILURE) { return; } pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, &keyresource TSRMLS_CC); if (pkey == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to coerce parameter 4 into a private key"); RETURN_FALSE; } if (method) { cipher = EVP_get_cipherbyname(method); if (!cipher) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm."); RETURN_FALSE; } } else { cipher = EVP_rc4(); } buf = emalloc(data_len + 1); if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) { efree(buf); RETVAL_FALSE; } else { zval_dtor(opendata); buf[len1 + len2] = '\0'; ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0); RETVAL_TRUE; } } else { efree(buf); RETVAL_FALSE; } if (keyresource == -1) { EVP_PKEY_free(pkey); } EVP_CIPHER_CTX_cleanup(&ctx); }
7,213
71,205
0
static long kvm_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { long r = -EINVAL; switch (ioctl) { case KVM_GET_API_VERSION: if (arg) goto out; r = KVM_API_VERSION; break; case KVM_CREATE_VM: r = kvm_dev_ioctl_create_vm(arg); break; case KVM_CHECK_EXTENSION: r = kvm_vm_ioctl_check_extension_generic(NULL, arg); break; case KVM_GET_VCPU_MMAP_SIZE: if (arg) goto out; r = PAGE_SIZE; /* struct kvm_run */ #ifdef CONFIG_X86 r += PAGE_SIZE; /* pio data page */ #endif #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET r += PAGE_SIZE; /* coalesced mmio ring page */ #endif break; case KVM_TRACE_ENABLE: case KVM_TRACE_PAUSE: case KVM_TRACE_DISABLE: r = -EOPNOTSUPP; break; default: return kvm_arch_dev_ioctl(filp, ioctl, arg); } out: return r; }
7,214
14,810
0
ftp_site(ftpbuf_t *ftp, const char *cmd) { if (ftp == NULL) { return 0; } if (!ftp_putcmd(ftp, "SITE", cmd)) { return 0; } if (!ftp_getresp(ftp) || ftp->resp < 200 || ftp->resp >= 300) { return 0; } return 1; }
7,215
110,389
0
PP_Bool ReadImageData(PP_Resource device_context_2d, PP_Resource image, const PP_Point* top_left) { EnterResource<PPB_Graphics2D_API> enter(device_context_2d, true); if (enter.failed()) return PP_FALSE; return BoolToPPBool(static_cast<PPB_Graphics2D_Impl*>(enter.object())-> ReadImageData(image, top_left)); }
7,216
153,865
0
GLenum GLES2DecoderImpl::AdjustGetPname(GLenum pname) { if (GL_MAX_SAMPLES == pname && features().use_img_for_multisampled_render_to_texture) { return GL_MAX_SAMPLES_IMG; } if (GL_ALIASED_POINT_SIZE_RANGE == pname && gl_version_info().is_desktop_core_profile) { return GL_POINT_SIZE_RANGE; } return pname; }
7,217
137,374
0
bool cancel_composition_called() const { return cancel_composition_called_; }
7,218
14,587
0
polkit_backend_session_monitor_class_init (PolkitBackendSessionMonitorClass *klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = polkit_backend_session_monitor_finalize; /** * PolkitBackendSessionMonitor::changed: * @monitor: A #PolkitBackendSessionMonitor * * Emitted when something changes. */ signals[CHANGED_SIGNAL] = g_signal_new ("changed", POLKIT_BACKEND_TYPE_SESSION_MONITOR, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PolkitBackendSessionMonitorClass, changed), NULL, /* accumulator */ NULL, /* accumulator data */ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); }
7,219
135,087
0
AppCacheHost::~AppCacheHost() { service_->RemoveObserver(this); FOR_EACH_OBSERVER(Observer, observers_, OnDestructionImminent(this)); if (associated_cache_.get()) associated_cache_->UnassociateHost(this); if (group_being_updated_.get()) group_being_updated_->RemoveUpdateObserver(this); storage()->CancelDelegateCallbacks(this); if (service()->quota_manager_proxy() && !origin_in_use_.is_empty()) service()->quota_manager_proxy()->NotifyOriginNoLongerInUse(origin_in_use_); }
7,220
15,991
0
ImportTIFF_StandardMappings ( XMP_Uns8 ifd, const TIFF_Manager & tiff, SXMPMeta * xmp ) { const bool nativeEndian = tiff.IsNativeEndian(); TIFF_Manager::TagInfo tagInfo; const TIFF_MappingToXMP * mappings = 0; if ( ifd == kTIFF_PrimaryIFD ) { mappings = sPrimaryIFDMappings; } else if ( ifd == kTIFF_ExifIFD ) { mappings = sExifIFDMappings; } else if ( ifd == kTIFF_GPSInfoIFD ) { mappings = sGPSInfoIFDMappings; } else { XMP_Throw ( "Invalid IFD for standard mappings", kXMPErr_InternalFailure ); } for ( size_t i = 0; mappings[i].id != 0xFFFF; ++i ) { try { // Don't let errors with one stop the others. const TIFF_MappingToXMP & mapInfo = mappings[i]; const bool mapSingle = ((mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType)); if ( mapInfo.name[0] == 0 ) continue; // Skip special mappings, handled higher up. bool found = tiff.GetTag ( ifd, mapInfo.id, &tagInfo ); if ( ! found ) continue; XMP_Assert ( tagInfo.type != kTIFF_UndefinedType ); // These must have a special mapping. if ( tagInfo.type == kTIFF_UndefinedType ) continue; if ( ! ImportTIFF_CheckStandardMapping ( tagInfo, mapInfo ) ) continue; if ( mapSingle ) { ImportSingleTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name ); } else { ImportArrayTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name ); } } catch ( ... ) { } } } // ImportTIFF_StandardMappings
7,221
136,948
0
inline void HTMLInputElement::RemoveFromRadioButtonGroup() { if (RadioButtonGroupScope* scope = GetRadioButtonGroupScope()) scope->RemoveButton(this); }
7,222
75,759
0
void testToStringCharsRequired() { TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com:80/")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://user:[email protected]/")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/index.html")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/?abc")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/#def")); TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/?abc#def")); TEST_ASSERT(testToStringCharsRequiredHelper(L"/test")); TEST_ASSERT(testToStringCharsRequiredHelper(L"test")); }
7,223
112,044
0
string Get(int64 metahandle, syncable::StringField field) { return GetField(metahandle, field, string()); }
7,224
126,840
0
void BrowserView::ProcessFullscreen(bool fullscreen, FullscreenType type, const GURL& url, FullscreenExitBubbleType bubble_type) { ignore_layout_ = true; LocationBarView* location_bar = GetLocationBarView(); #if defined(OS_WIN) && !defined(USE_AURA) OmniboxViewWin* omnibox_win = GetOmniboxViewWin(location_bar->GetLocationEntry()); #endif if (type == FOR_METRO || !fullscreen) { fullscreen_bubble_.reset(); } if (fullscreen) { views::FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager); if (location_bar->Contains(focus_manager->GetFocusedView())) focus_manager->ClearFocus(); #if defined(OS_WIN) && !defined(USE_AURA) if (omnibox_win) { omnibox_win->set_force_hidden(true); ShowWindow(omnibox_win->m_hWnd, SW_HIDE); } #endif } #if defined(OS_WIN) && !defined(USE_AURA) views::ScopedFullscreenVisibility visibility(frame_->GetNativeView()); #endif if (type == FOR_METRO) { #if defined(OS_WIN) && !defined(USE_AURA) static_cast<views::NativeWidgetWin*>( frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); #endif } else { frame_->SetFullscreen(fullscreen); } browser_->WindowFullscreenStateChanged(); if (fullscreen) { bool is_kiosk = CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); if (!is_kiosk && type != FOR_METRO) { fullscreen_bubble_.reset(new FullscreenExitBubbleViews( GetWidget(), browser_.get(), url, bubble_type)); } } else { #if defined(OS_WIN) && !defined(USE_AURA) if (omnibox_win) { omnibox_win->set_force_hidden(false); ShowWindow(omnibox_win->m_hWnd, SW_SHOW); } #endif } ignore_layout_ = false; Layout(); }
7,225
122,630
0
ExtensionInfo::ExtensionInfo(const DictionaryValue* manifest, const std::string& id, const FilePath& path, Manifest::Location location) : extension_id(id), extension_path(path), extension_location(location) { if (manifest) extension_manifest.reset(manifest->DeepCopy()); }
7,226
164,258
0
void AppCacheUpdateJob::NotifySingleHost( AppCacheHost* host, blink::mojom::AppCacheEventID event_id) { host->frontend()->EventRaised(event_id); }
7,227
106,340
0
void SyncBackendHost::Core::NotifyPassphraseAccepted( const std::string& bootstrap_token) { if (!host_ || !host_->frontend_) return; DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); processing_passphrase_ = false; host_->PersistEncryptionBootstrapToken(bootstrap_token); host_->frontend_->OnPassphraseAccepted(); }
7,228
71,053
0
void Type_Signature_Free(struct _cms_typehandler_struct* self, void* Ptr) { _cmsFree(self ->ContextID, Ptr); }
7,229
120,365
0
bool mouse_release() const { return mouse_release_; }
7,230
97,527
0
void FrameLoader::write(const char* str, int len, bool flush) { if (len == 0 && !flush) return; if (len == -1) len = strlen(str); Tokenizer* tokenizer = m_frame->document()->tokenizer(); if (tokenizer && tokenizer->wantsRawData()) { if (len > 0) tokenizer->writeRawData(str, len); return; } if (!m_decoder) { if (Settings* settings = m_frame->settings()) { m_decoder = TextResourceDecoder::create(m_responseMIMEType, settings->defaultTextEncodingName(), settings->usesEncodingDetector()); Frame* parentFrame = m_frame->tree()->parent(); if (canReferToParentFrameEncoding(m_frame, parentFrame)) m_decoder->setHintEncoding(parentFrame->document()->decoder()); } else m_decoder = TextResourceDecoder::create(m_responseMIMEType, String()); Frame* parentFrame = m_frame->tree()->parent(); if (m_encoding.isEmpty()) { if (canReferToParentFrameEncoding(m_frame, parentFrame)) m_decoder->setEncoding(parentFrame->document()->inputEncoding(), TextResourceDecoder::EncodingFromParentFrame); } else { m_decoder->setEncoding(m_encoding, m_encodingWasChosenByUser ? TextResourceDecoder::UserChosenEncoding : TextResourceDecoder::EncodingFromHTTPHeader); } m_frame->document()->setDecoder(m_decoder.get()); } String decoded = m_decoder->decode(str, len); if (flush) decoded += m_decoder->flush(); if (decoded.isEmpty()) return; if (!m_receivedData) { m_receivedData = true; if (m_decoder->encoding().usesVisualOrdering()) m_frame->document()->setVisuallyOrdered(); m_frame->document()->recalcStyle(Node::Force); } if (tokenizer) { ASSERT(!tokenizer->wantsRawData()); tokenizer->write(decoded, true); } }
7,231
29,814
0
cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) { struct cifs_ses *ses; spin_lock(&cifs_tcp_ses_lock); list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { if (!match_session(ses, vol)) continue; ++ses->ses_count; spin_unlock(&cifs_tcp_ses_lock); return ses; } spin_unlock(&cifs_tcp_ses_lock); return NULL; }
7,232
106,473
0
void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) { if (!isValid()) return; #if ENABLE(WEB_PROCESS_SANDBOX) for (size_t i = 0; i < fileURLs.size(); ++i) { SandboxExtension::Handle sandboxExtensionHandle; SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle); process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID); } #endif process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); m_openPanelResultListener->invalidate(); m_openPanelResultListener = 0; }
7,233
160,937
0
void ChromeClientImpl::ChromeDestroyed() { }
7,234
147,699
0
void V8TestObject::PerWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_perWorldBindingsVoidMethodTestInterfaceEmptyArg"); test_object_v8_internal::PerWorldBindingsVoidMethodTestInterfaceEmptyArgMethod(info); }
7,235
6,353
0
nm_ip4_config_new (int ifindex) { g_return_val_if_fail (ifindex >= -1, NULL); return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NM_IP4_CONFIG_IFINDEX, ifindex, NULL); }
7,236
166,165
0
void MediaStreamDispatcherHost::GenerateStream( int32_t page_request_id, const StreamControls& controls, bool user_gesture, GenerateStreamCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); base::PostTaskAndReplyWithResult( base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}).get(), FROM_HERE, base::BindOnce(salt_and_origin_callback_, render_process_id_, render_frame_id_), base::BindOnce(&MediaStreamDispatcherHost::DoGenerateStream, weak_factory_.GetWeakPtr(), page_request_id, controls, user_gesture, std::move(callback))); }
7,237
90,458
0
static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev, struct ib_device *ib_dev) { struct ib_uverbs_file *file; struct ib_uverbs_async_event_file *event_file; struct ib_event event; /* Pending running commands to terminate */ uverbs_disassociate_api_pre(uverbs_dev); event.event = IB_EVENT_DEVICE_FATAL; event.element.port_num = 0; event.device = ib_dev; mutex_lock(&uverbs_dev->lists_mutex); while (!list_empty(&uverbs_dev->uverbs_file_list)) { file = list_first_entry(&uverbs_dev->uverbs_file_list, struct ib_uverbs_file, list); list_del_init(&file->list); kref_get(&file->ref); /* We must release the mutex before going ahead and calling * uverbs_cleanup_ufile, as it might end up indirectly calling * uverbs_close, for example due to freeing the resources (e.g * mmput). */ mutex_unlock(&uverbs_dev->lists_mutex); ib_uverbs_event_handler(&file->event_handler, &event); uverbs_destroy_ufile_hw(file, RDMA_REMOVE_DRIVER_REMOVE); kref_put(&file->ref, ib_uverbs_release_file); mutex_lock(&uverbs_dev->lists_mutex); } while (!list_empty(&uverbs_dev->uverbs_events_file_list)) { event_file = list_first_entry(&uverbs_dev-> uverbs_events_file_list, struct ib_uverbs_async_event_file, list); spin_lock_irq(&event_file->ev_queue.lock); event_file->ev_queue.is_closed = 1; spin_unlock_irq(&event_file->ev_queue.lock); list_del(&event_file->list); ib_unregister_event_handler( &event_file->uverbs_file->event_handler); event_file->uverbs_file->event_handler.device = NULL; wake_up_interruptible(&event_file->ev_queue.poll_wait); kill_fasync(&event_file->ev_queue.async_queue, SIGIO, POLL_IN); } mutex_unlock(&uverbs_dev->lists_mutex); uverbs_disassociate_api(uverbs_dev->uapi); }
7,238
147,137
0
bool DocumentLoader::ShouldPersistUserGestureValue( const SecurityOrigin* previous_security_origin, const SecurityOrigin* new_security_origin) { if (!CheckOriginIsHttpOrHttps(previous_security_origin) || !CheckOriginIsHttpOrHttps(new_security_origin)) return false; if (previous_security_origin->Host() == new_security_origin->Host()) return true; String previous_domain = NetworkUtils::GetDomainAndRegistry( previous_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); String new_domain = NetworkUtils::GetDomainAndRegistry( new_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); return !previous_domain.IsEmpty() && previous_domain == new_domain; }
7,239
145,480
0
DownloadInterruptReason CallbackAndReturn( const DownloadUrlParameters::OnStartedCallback& started_cb, DownloadInterruptReason interrupt_reason) { if (started_cb.is_null()) return interrupt_reason; BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind( started_cb, static_cast<DownloadItem*>(NULL), interrupt_reason)); return interrupt_reason; }
7,240
77,027
0
ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, unsigned int instructions_len, enum ofp_version version, const struct vl_mff_map *vl_mff_map, uint64_t *ofpacts_tlv_bitmap, struct ofpbuf *ofpacts) { const struct ofp11_instruction *instructions; const struct ofp11_instruction *insts[N_OVS_INSTRUCTIONS]; enum ofperr error; ofpbuf_clear(ofpacts); if (version == OFP10_VERSION) { return ofpacts_pull_openflow_actions__(openflow, instructions_len, version, (1u << N_OVS_INSTRUCTIONS) - 1, ofpacts, 0, vl_mff_map, ofpacts_tlv_bitmap); } if (instructions_len % OFP11_INSTRUCTION_ALIGN != 0) { VLOG_WARN_RL(&rl, "OpenFlow message instructions length %u is not a " "multiple of %d", instructions_len, OFP11_INSTRUCTION_ALIGN); error = OFPERR_OFPBIC_BAD_LEN; goto exit; } instructions = ofpbuf_try_pull(openflow, instructions_len); if (instructions == NULL) { VLOG_WARN_RL(&rl, "OpenFlow message instructions length %u exceeds " "remaining message length (%"PRIu32")", instructions_len, openflow->size); error = OFPERR_OFPBIC_BAD_LEN; goto exit; } error = decode_openflow11_instructions( instructions, instructions_len / OFP11_INSTRUCTION_ALIGN, insts); if (error) { goto exit; } if (insts[OVSINST_OFPIT13_METER]) { const struct ofp13_instruction_meter *oim; struct ofpact_meter *om; oim = ALIGNED_CAST(const struct ofp13_instruction_meter *, insts[OVSINST_OFPIT13_METER]); om = ofpact_put_METER(ofpacts); om->meter_id = ntohl(oim->meter_id); } if (insts[OVSINST_OFPIT11_APPLY_ACTIONS]) { const struct ofp_action_header *actions; size_t actions_len; get_actions_from_instruction(insts[OVSINST_OFPIT11_APPLY_ACTIONS], &actions, &actions_len); error = ofpacts_decode(actions, actions_len, version, vl_mff_map, ofpacts_tlv_bitmap, ofpacts); if (error) { goto exit; } } if (insts[OVSINST_OFPIT11_CLEAR_ACTIONS]) { instruction_get_OFPIT11_CLEAR_ACTIONS( insts[OVSINST_OFPIT11_CLEAR_ACTIONS]); ofpact_put_CLEAR_ACTIONS(ofpacts); } if (insts[OVSINST_OFPIT11_WRITE_ACTIONS]) { struct ofpact_nest *on; const struct ofp_action_header *actions; size_t actions_len; size_t start = ofpacts->size; ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS, offsetof(struct ofpact_nest, actions)); get_actions_from_instruction(insts[OVSINST_OFPIT11_WRITE_ACTIONS], &actions, &actions_len); error = ofpacts_decode_for_action_set(actions, actions_len, version, vl_mff_map, ofpacts_tlv_bitmap, ofpacts); if (error) { goto exit; } on = ofpbuf_at_assert(ofpacts, start, sizeof *on); on->ofpact.len = ofpacts->size - start; } if (insts[OVSINST_OFPIT11_WRITE_METADATA]) { const struct ofp11_instruction_write_metadata *oiwm; struct ofpact_metadata *om; oiwm = ALIGNED_CAST(const struct ofp11_instruction_write_metadata *, insts[OVSINST_OFPIT11_WRITE_METADATA]); om = ofpact_put_WRITE_METADATA(ofpacts); om->metadata = oiwm->metadata; om->mask = oiwm->metadata_mask; } if (insts[OVSINST_OFPIT11_GOTO_TABLE]) { const struct ofp11_instruction_goto_table *oigt; struct ofpact_goto_table *ogt; oigt = instruction_get_OFPIT11_GOTO_TABLE( insts[OVSINST_OFPIT11_GOTO_TABLE]); ogt = ofpact_put_GOTO_TABLE(ofpacts); ogt->table_id = oigt->table_id; } error = ofpacts_verify(ofpacts->data, ofpacts->size, (1u << N_OVS_INSTRUCTIONS) - 1, 0); exit: if (error) { ofpbuf_clear(ofpacts); } return error; }
7,241
186,678
1
int PDFiumEngine::GetVisiblePageIndex(FPDF_PAGE page) { for (int page_index : visible_pages_) { if (pages_[page_index]->GetPage() == page) return page_index; } return -1; }
7,242
97,857
0
void AutoFillHelper::SendForms(WebFrame* frame) { WebKit::WebVector<WebFormElement> web_forms; frame->forms(web_forms); std::vector<webkit_glue::FormData> forms; for (size_t i = 0; i < web_forms.size(); ++i) { const WebFormElement& web_form = web_forms[i]; webkit_glue::FormData form; if (FormManager::WebFormElementToFormData( web_form, FormManager::REQUIRE_NONE, false, &form)) { forms.push_back(form); } } if (!forms.empty()) { render_view_->Send(new ViewHostMsg_FormsSeen(render_view_->routing_id(), forms)); } }
7,243
112,554
0
void Document::setCookie(const String& value, ExceptionCode& ec) { if (page() && !page()->settings()->cookieEnabled()) return; if (!securityOrigin()->canAccessCookies()) { ec = SECURITY_ERR; return; } KURL cookieURL = this->cookieURL(); if (cookieURL.isEmpty()) return; setCookies(this, cookieURL, value); }
7,244
161,233
0
bool ShouldSendOnIO(const std::string& method) { return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || method == "Debugger.setBreakpointByUrl" || method == "Debugger.removeBreakpoint" || method == "Debugger.setBreakpointsActive" || method == "Performance.getMetrics" || method == "Page.crash"; }
7,245
115,677
0
bool HostNPScriptObject::Disconnect(const NPVariant* args, uint32_t arg_count, NPVariant* result) { CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); if (arg_count != 0) { SetException("disconnect: bad number of arguments"); return false; } DisconnectInternal(); return true; }
7,246
28,048
0
static av_always_inline void decode_line(FFV1Context *s, int w, int16_t *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_count = 0; int run_mode = 0; int run_index = s->run_index; for (x = 0; x < w; x++) { int diff, context, sign; context = get_context(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && run_mode == 0) run_mode = 1; if (run_mode) { if (run_count == 0 && run_mode == 1) { if (get_bits1(&s->gb)) { run_count = 1 << ff_log2_run[run_index]; if (x + run_count <= w) run_index++; } else { if (ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count = 0; if (run_index) run_index--; run_mode = 2; } } run_count--; if (run_count < 0) { run_mode = 0; run_count = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][x] = (predict(sample[1] + x, sample[0] + x) + diff) & ((1 << bits) - 1); } s->run_index = run_index; }
7,247
51,048
0
int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode) { struct inode *inode = old_dentry->d_inode; unsigned max_links = dir->i_sb->s_max_links; int error; if (!inode) return -ENOENT; error = may_create(dir, new_dentry); if (error) return error; if (dir->i_sb != inode->i_sb) return -EXDEV; /* * A link to an append-only or immutable file cannot be created. */ if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) return -EPERM; if (!dir->i_op->link) return -EPERM; if (S_ISDIR(inode->i_mode)) return -EPERM; error = security_inode_link(old_dentry, dir, new_dentry); if (error) return error; inode_lock(inode); /* Make sure we don't allow creating hardlink to an unlinked file */ if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE)) error = -ENOENT; else if (max_links && inode->i_nlink >= max_links) error = -EMLINK; else { error = try_break_deleg(inode, delegated_inode); if (!error) error = dir->i_op->link(old_dentry, dir, new_dentry); } if (!error && (inode->i_state & I_LINKABLE)) { spin_lock(&inode->i_lock); inode->i_state &= ~I_LINKABLE; spin_unlock(&inode->i_lock); } inode_unlock(inode); if (!error) fsnotify_link(dir, inode, new_dentry); return error; }
7,248
168,237
0
bool BrowserView::CanTriggerOnMouse() const { return !IsImmersiveModeEnabled(); }
7,249
149,063
0
static void checkPtrmap( IntegrityCk *pCheck, /* Integrity check context */ Pgno iChild, /* Child page number */ u8 eType, /* Expected pointer map type */ Pgno iParent /* Expected pointer map parent page number */ ){ int rc; u8 ePtrmapType; Pgno iPtrmapParent; rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent); if( rc!=SQLITE_OK ){ if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1; checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild); return; } if( ePtrmapType!=eType || iPtrmapParent!=iParent ){ checkAppendMsg(pCheck, "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)", iChild, eType, iParent, ePtrmapType, iPtrmapParent); } }
7,250
172,377
0
OMX_ERRORTYPE omx_video::use_EGL_image(OMX_IN OMX_HANDLETYPE hComp, OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr, OMX_IN OMX_U32 port, OMX_IN OMX_PTR appData, OMX_IN void* eglImage) { (void)hComp, (void)bufferHdr, (void)port, (void)appData, (void)eglImage; DEBUG_PRINT_ERROR("ERROR: use_EGL_image: Not Implemented"); return OMX_ErrorNotImplemented; }
7,251
164,576
0
static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; *pRowid = pCsr->pgno; return SQLITE_OK; }
7,252
170,943
0
static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, va_list args) { int *corrupted = va_arg(args, int *); VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; if (corrupted && pbi) { const YV12_BUFFER_CONFIG *const frame = pbi->common.frame_to_show; if (frame == NULL) return VPX_CODEC_ERROR; *corrupted = frame->corrupted; return VPX_CODEC_OK; } else return VPX_CODEC_INVALID_PARAM; }
7,253
118,109
0
ChromeWebContentsDelegateAndroid::ChromeWebContentsDelegateAndroid(JNIEnv* env, jobject obj) : WebContentsDelegateAndroid(env, obj) { }
7,254
45,781
0
static void gcm_hash_len_done(struct crypto_async_request *areq, int err) { struct aead_request *req = areq->data; __gcm_hash_len_done(req, err); }
7,255
77,302
0
ofproto_configure_table(struct ofproto *ofproto, int table_id, const struct ofproto_table_settings *s) { struct oftable *table; ovs_assert(table_id >= 0 && table_id < ofproto->n_tables); table = &ofproto->tables[table_id]; oftable_set_name(table, s->name); if (table->flags & OFTABLE_READONLY) { return; } if (classifier_set_prefix_fields(&table->cls, s->prefix_fields, s->n_prefix_fields)) { /* XXX: Trigger revalidation. */ } ovs_mutex_lock(&ofproto_mutex); unsigned int new_eviction = (s->enable_eviction ? table->eviction | EVICTION_CLIENT : table->eviction & ~EVICTION_CLIENT); oftable_configure_eviction(table, new_eviction, s->groups, s->n_groups); table->max_flows = s->max_flows; evict_rules_from_table(table); ovs_mutex_unlock(&ofproto_mutex); }
7,256
90,437
0
static ssize_t version_show(struct device_driver *dd, char *buf) { return snprintf(buf, strlen(MEGASAS_VERSION) + 2, "%s\n", MEGASAS_VERSION); }
7,257
181,170
1
int MSG_ReadBits( msg_t *msg, int bits ) { int value; int get; qboolean sgn; int i, nbits; // FILE* fp; value = 0; if ( bits < 0 ) { bits = -bits; sgn = qtrue; } else { sgn = qfalse; } if (msg->oob) { if(bits==8) { value = msg->data[msg->readcount]; msg->readcount += 1; msg->bit += 8; } else if(bits==16) { short temp; CopyLittleShort(&temp, &msg->data[msg->readcount]); value = temp; msg->readcount += 2; msg->bit += 16; } else if(bits==32) { CopyLittleLong(&value, &msg->data[msg->readcount]); msg->readcount += 4; msg->bit += 32; } else Com_Error(ERR_DROP, "can't read %d bits", bits); } else { nbits = 0; if (bits&7) { nbits = bits&7; for(i=0;i<nbits;i++) { value |= (Huff_getBit(msg->data, &msg->bit)<<i); } bits = bits - nbits; } if (bits) { // fp = fopen("c:\\netchan.bin", "a"); for(i=0;i<bits;i+=8) { Huff_offsetReceive (msgHuff.decompressor.tree, &get, msg->data, &msg->bit); // fwrite(&get, 1, 1, fp); value |= (get<<(i+nbits)); } // fclose(fp); } msg->readcount = (msg->bit>>3)+1; } if ( sgn && bits > 0 && bits < 32 ) { if ( value & ( 1 << ( bits - 1 ) ) ) { value |= -1 ^ ( ( 1 << bits ) - 1 ); } } return value; }
7,258
185,222
1
void UnloadController::TabDetachedAt(TabContents* contents, int index) { TabDetachedImpl(contents); }
7,259
140,841
0
bool IsValidPVRTCSize(GLint level, GLsizei size) { return GLES2Util::IsPOT(size); }
7,260
56,528
0
ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; struct inode *inode = file_inode(iocb->ki_filp); struct mutex *aio_mutex = NULL; struct blk_plug plug; int o_direct = iocb->ki_flags & IOCB_DIRECT; int overwrite = 0; ssize_t ret; /* * Unaligned direct AIO must be serialized; see comment above * In the case of O_APPEND, assume that we must always serialize */ if (o_direct && ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) && !is_sync_kiocb(iocb) && (iocb->ki_flags & IOCB_APPEND || ext4_unaligned_aio(inode, from, iocb->ki_pos))) { aio_mutex = ext4_aio_mutex(inode); mutex_lock(aio_mutex); ext4_unwritten_wait(inode); } mutex_lock(&inode->i_mutex); ret = generic_write_checks(iocb, from); if (ret <= 0) goto out; /* * If we have encountered a bitmap-format file, the size limit * is smaller than s_maxbytes, which is for extent-mapped files. */ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); if (iocb->ki_pos >= sbi->s_bitmap_maxbytes) { ret = -EFBIG; goto out; } iov_iter_truncate(from, sbi->s_bitmap_maxbytes - iocb->ki_pos); } iocb->private = &overwrite; if (o_direct) { size_t length = iov_iter_count(from); loff_t pos = iocb->ki_pos; blk_start_plug(&plug); /* check whether we do a DIO overwrite or not */ if (ext4_should_dioread_nolock(inode) && !aio_mutex && !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) { struct ext4_map_blocks map; unsigned int blkbits = inode->i_blkbits; int err, len; map.m_lblk = pos >> blkbits; map.m_len = (EXT4_BLOCK_ALIGN(pos + length, blkbits) >> blkbits) - map.m_lblk; len = map.m_len; err = ext4_map_blocks(NULL, inode, &map, 0); /* * 'err==len' means that all of blocks has * been preallocated no matter they are * initialized or not. For excluding * unwritten extents, we need to check * m_flags. There are two conditions that * indicate for initialized extents. 1) If we * hit extent cache, EXT4_MAP_MAPPED flag is * returned; 2) If we do a real lookup, * non-flags are returned. So we should check * these two conditions. */ if (err == len && (map.m_flags & EXT4_MAP_MAPPED)) overwrite = 1; } } ret = __generic_file_write_iter(iocb, from); mutex_unlock(&inode->i_mutex); if (ret > 0) { ssize_t err; err = generic_write_sync(file, iocb->ki_pos - ret, ret); if (err < 0) ret = err; } if (o_direct) blk_finish_plug(&plug); if (aio_mutex) mutex_unlock(aio_mutex); return ret; out: mutex_unlock(&inode->i_mutex); if (aio_mutex) mutex_unlock(aio_mutex); return ret; }
7,261
1,363
0
static __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) { __be32 *p; if (nbytes == 0) return xdr->p; if (xdr->p == xdr->end) return NULL; p = __xdr_inline_decode(xdr, nbytes); return p; }
7,262
148,614
0
void WaitForDidFirstVisuallyNonEmptyPaint() { if (did_fist_visually_non_empty_paint_) return; base::RunLoop run_loop; on_did_first_visually_non_empty_paint_ = run_loop.QuitClosure(); run_loop.Run(); }
7,263
105,976
0
bool JSTestEventTargetConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<JSTestEventTargetConstructor, JSDOMWrapper>(exec, &JSTestEventTargetConstructorTable, jsCast<JSTestEventTargetConstructor*>(object), propertyName, descriptor); }
7,264
43,277
0
int CLASS fscanf(FILE *stream, const char *format, void *ptr) { int count = ::fscanf(stream, format, ptr); if ( count != 1 ) dcraw_message(DCRAW_WARNING, "%s: fscanf %d != 1\n", ifname_display, count); return 1; }
7,265
167,577
0
void RenderFrameHostManager::OnEnforceInsecureNavigationsSet( const std::vector<uint32_t>& insecure_navigations_set) { for (const auto& pair : proxy_hosts_) { pair.second->Send(new FrameMsg_EnforceInsecureNavigationsSet( pair.second->GetRoutingID(), insecure_navigations_set)); } }
7,266
119,350
0
void OmniboxEditModel::OnWillKillFocus(gfx::NativeView view_gaining_focus) { if (user_input_in_progress_ || !in_revert_) delegate_->OnInputStateChanged(); }
7,267
95,161
0
static void cmd_search(char *tag, int usinguid) { int c; struct searchargs *searchargs; clock_t start = clock(); char mytime[100]; int n; if (backend_current) { /* remote mailbox */ const char *cmd = usinguid ? "UID Search" : "Search"; prot_printf(backend_current->out, "%s %s ", tag, cmd); if (!pipe_command(backend_current, 65536)) { pipe_including_tag(backend_current, tag, 0); } return; } /* local mailbox */ searchargs = new_searchargs(tag, GETSEARCH_CHARSET_KEYWORD|GETSEARCH_RETURN, &imapd_namespace, imapd_userid, imapd_authstate, imapd_userisadmin || imapd_userisproxyadmin); /* special case quirk for iPhones */ if (imapd_id.quirks & QUIRK_SEARCHFUZZY) searchargs->fuzzy_depth++; c = get_search_program(imapd_in, imapd_out, searchargs); if (c == EOF) { eatline(imapd_in, ' '); freesearchargs(searchargs); return; } if (c == '\r') c = prot_getc(imapd_in); if (c != '\n') { prot_printf(imapd_out, "%s BAD Unexpected extra arguments to Search\r\n", tag); eatline(imapd_in, c); freesearchargs(searchargs); return; } if (searchargs->charset == CHARSET_UNKNOWN_CHARSET) { prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(IMAP_UNRECOGNIZED_CHARSET)); } else { n = index_search(imapd_index, searchargs, usinguid); snprintf(mytime, sizeof(mytime), "%2.3f", (clock() - start) / (double) CLOCKS_PER_SEC); prot_printf(imapd_out, "%s OK %s (%d msgs in %s secs)\r\n", tag, error_message(IMAP_OK_COMPLETED), n, mytime); } freesearchargs(searchargs); }
7,268
149,161
0
void CheckAdjustedOffsets(const std::string& url_string, FormatUrlTypes format_types, net::UnescapeRule::Type unescape_rules, const size_t* output_offsets) { GURL url(url_string); size_t url_length = url_string.length(); std::vector<size_t> offsets; for (size_t i = 0; i <= url_length + 1; ++i) offsets.push_back(i); offsets.push_back(500000); // Something larger than any input length. offsets.push_back(std::string::npos); base::string16 formatted_url = FormatUrlWithOffsets(url, format_types, unescape_rules, nullptr, nullptr, &offsets); for (size_t i = 0; i < url_length; ++i) VerboseExpect(output_offsets[i], offsets[i], url_string, i, formatted_url); VerboseExpect(formatted_url.length(), offsets[url_length], url_string, url_length, formatted_url); VerboseExpect(base::string16::npos, offsets[url_length + 1], url_string, 500000, formatted_url); VerboseExpect(base::string16::npos, offsets[url_length + 2], url_string, std::string::npos, formatted_url); }
7,269
95,863
0
void Sys_Quit( void ) { Sys_Exit( 0 ); }
7,270
36,114
0
static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) { int slen; int rootflag; struct SL_component *oldslp; struct SL_component *slp; slen = rr->len - 5; slp = &rr->u.SL.link; while (slen > 1) { rootflag = 0; switch (slp->flags & ~1) { case 0: if (slp->len > plimit - rpnt) return NULL; memcpy(rpnt, slp->text, slp->len); rpnt += slp->len; break; case 2: if (rpnt >= plimit) return NULL; *rpnt++ = '.'; break; case 4: if (2 > plimit - rpnt) return NULL; *rpnt++ = '.'; *rpnt++ = '.'; break; case 8: if (rpnt >= plimit) return NULL; rootflag = 1; *rpnt++ = '/'; break; default: printk("Symlink component flag not implemented (%d)\n", slp->flags); } slen -= slp->len + 2; oldslp = slp; slp = (struct SL_component *)((char *)slp + slp->len + 2); if (slen < 2) { /* * If there is another SL record, and this component * record isn't continued, then add a slash. */ if ((!rootflag) && (rr->u.SL.flags & 1) && !(oldslp->flags & 1)) { if (rpnt >= plimit) return NULL; *rpnt++ = '/'; } break; } /* * If this component record isn't continued, then append a '/'. */ if (!rootflag && !(oldslp->flags & 1)) { if (rpnt >= plimit) return NULL; *rpnt++ = '/'; } } return rpnt; }
7,271
47,273
0
static int lzo_init(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); ctx->lzo_comp_mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); if (!ctx->lzo_comp_mem) ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); if (!ctx->lzo_comp_mem) return -ENOMEM; return 0; }
7,272
163,227
0
void ExpectChildFrameSetAsCollapsedInFTN(Shell* shell, bool expect_collapsed) { FrameTreeNode* root = static_cast<WebContentsImpl*>(shell->web_contents()) ->GetFrameTree() ->root(); ASSERT_EQ(1u, root->child_count()); FrameTreeNode* child = root->child_at(0u); EXPECT_EQ(expect_collapsed, child->is_collapsed()); }
7,273
95,024
0
cmd_http_loop(CMD_ARGS) { struct http *hp; unsigned n, m; char *s; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AN(av[2]); AZ(av[3]); n = strtoul(av[1], NULL, 0); for (m = 1 ; m <= n; m++) { vtc_log(vl, 4, "Loop #%u", m); s = strdup(av[2]); AN(s); parse_string(s, cmd, hp, vl); } }
7,274
140,795
0
error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetActiveUniformBlockiv& c = *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); GLuint program_id = c.program; GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); Program* program = GetProgramInfoNotShader( program_id, "glGetActiveUniformBlockiv"); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetActiveActiveUniformBlockiv", "program not linked"); return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetActiveUniformBlockiv"); GLsizei num_values = 1; if (pname == GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) { GLint num = 0; glGetActiveUniformBlockiv( service_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &num); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); return error::kNoError; } num_values = static_cast<GLsizei>(num); } typedef cmds::GetActiveUniformBlockiv::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); GLint* params = result ? result->GetData() : NULL; if (params == NULL) { return error::kOutOfBounds; } if (result->size != 0) { return error::kInvalidArguments; } glGetActiveUniformBlockiv(service_id, index, pname, params); GLenum error = glGetError(); if (error == GL_NO_ERROR) { result->SetNumResults(num_values); } else { LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); } return error::kNoError; }
7,275
48,227
0
combineSeparateSamplesBytes (unsigned char *srcbuffs[], unsigned char *out, uint32 cols, uint32 rows, uint16 spp, uint16 bps, FILE *dumpfile, int format, int level) { int i, bytes_per_sample; uint32 row, col, col_offset, src_rowsize, dst_rowsize, row_offset; unsigned char *src; unsigned char *dst; tsample_t s; src = srcbuffs[0]; dst = out; if ((src == NULL) || (dst == NULL)) { TIFFError("combineSeparateSamplesBytes","Invalid buffer address"); return (1); } bytes_per_sample = (bps + 7) / 8; src_rowsize = ((bps * cols) + 7) / 8; dst_rowsize = ((bps * spp * cols) + 7) / 8; for (row = 0; row < rows; row++) { if ((dumpfile != NULL) && (level == 2)) { for (s = 0; s < spp; s++) { dump_info (dumpfile, format, "combineSeparateSamplesBytes","Input data, Sample %d", s); dump_buffer(dumpfile, format, 1, cols, row, srcbuffs[s] + (row * src_rowsize)); } } dst = out + (row * dst_rowsize); row_offset = row * src_rowsize; for (col = 0; col < cols; col++) { col_offset = row_offset + (col * (bps / 8)); for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++) { src = srcbuffs[s] + col_offset; for (i = 0; i < bytes_per_sample; i++) *(dst + i) = *(src + i); src += bytes_per_sample; dst += bytes_per_sample; } } if ((dumpfile != NULL) && (level == 2)) { dump_info (dumpfile, format, "combineSeparateSamplesBytes","Output data, combined samples"); dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize)); } } return (0); } /* end combineSeparateSamplesBytes */
7,276
133,548
0
void WebContentsImpl::DetachInterstitialPage() { if (GetInterstitialPage()) GetRenderManager()->remove_interstitial_page(); FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidDetachInterstitialPage()); }
7,277
60,005
0
static void snd_usb_mixer_interrupt(struct urb *urb) { struct usb_mixer_interface *mixer = urb->context; int len = urb->actual_length; int ustatus = urb->status; if (ustatus != 0) goto requeue; if (mixer->protocol == UAC_VERSION_1) { struct uac1_status_word *status; for (status = urb->transfer_buffer; len >= sizeof(*status); len -= sizeof(*status), status++) { dev_dbg(&urb->dev->dev, "status interrupt: %02x %02x\n", status->bStatusType, status->bOriginator); /* ignore any notifications not from the control interface */ if ((status->bStatusType & UAC1_STATUS_TYPE_ORIG_MASK) != UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF) continue; if (status->bStatusType & UAC1_STATUS_TYPE_MEM_CHANGED) snd_usb_mixer_rc_memory_change(mixer, status->bOriginator); else snd_usb_mixer_notify_id(mixer, status->bOriginator); } } else { /* UAC_VERSION_2 */ struct uac2_interrupt_data_msg *msg; for (msg = urb->transfer_buffer; len >= sizeof(*msg); len -= sizeof(*msg), msg++) { /* drop vendor specific and endpoint requests */ if ((msg->bInfo & UAC2_INTERRUPT_DATA_MSG_VENDOR) || (msg->bInfo & UAC2_INTERRUPT_DATA_MSG_EP)) continue; snd_usb_mixer_interrupt_v2(mixer, msg->bAttribute, le16_to_cpu(msg->wValue), le16_to_cpu(msg->wIndex)); } } requeue: if (ustatus != -ENOENT && ustatus != -ECONNRESET && ustatus != -ESHUTDOWN) { urb->dev = mixer->chip->dev; usb_submit_urb(urb, GFP_ATOMIC); } }
7,278
89,289
0
static int boco_clear_bits(u8 reg, u8 flags) { int ret; u8 regval; /* give access to the EEPROM from FPGA */ ret = i2c_read(BOCO_ADDR, reg, 1, &regval, 1); if (ret) { printf("%s: error reading the BOCO @%#x !!\n", __func__, reg); return ret; } regval &= ~flags; ret = i2c_write(BOCO_ADDR, reg, 1, &regval, 1); if (ret) { printf("%s: error writing the BOCO @%#x !!\n", __func__, reg); return ret; } return 0; }
7,279
41,740
0
static int __ipv6_isatap_ifid(u8 *eui, __be32 addr) { if (addr == 0) return -1; eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) || ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) || ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || ipv4_is_lbcast(addr)) ? 0x00 : 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE; memcpy(eui + 4, &addr, 4); return 0; }
7,280
156,125
0
const AtomicString& HTMLLinkElement::Rel() const { return getAttribute(relAttr); }
7,281
135,807
0
static bool ShouldRespectSVGTextBoundaries( const Node& target_node, const FrameSelection& frame_selection) { const PositionInFlatTree& base = frame_selection.ComputeVisibleSelectionInFlatTree().Base(); const Node* const base_node = base.AnchorNode(); if (!base_node) return false; LayoutObject* const base_layout_object = base_node->GetLayoutObject(); if (!base_layout_object || !base_layout_object->IsSVGText()) return false; return target_node.GetLayoutObject()->ContainingBlock() != base_layout_object->ContainingBlock(); }
7,282
186,323
1
void BinaryUploadService::IsAuthorized(AuthorizationCallback callback) { // Start |timer_| on the first call to IsAuthorized. This is necessary in // order to invalidate the authorization every 24 hours. if (!timer_.IsRunning()) { timer_.Start(FROM_HERE, base::TimeDelta::FromHours(24), this, &BinaryUploadService::ResetAuthorizationData); } if (!can_upload_data_.has_value()) { // Send a request to check if the browser can upload data. if (!pending_validate_data_upload_request_) { std::string dm_token = GetDMToken(); if (dm_token.empty()) { std::move(callback).Run(false); return; } pending_validate_data_upload_request_ = true; auto request = std::make_unique<ValidateDataUploadRequest>(base::BindOnce( &BinaryUploadService::ValidateDataUploadRequestCallback, weakptr_factory_.GetWeakPtr())); request->set_dm_token(dm_token); UploadForDeepScanning(std::move(request)); } authorization_callbacks_.push_back(std::move(callback)); return; } std::move(callback).Run(can_upload_data_.value()); }
7,283
36,798
0
PHP_FUNCTION(gethostname) { char buf[HOST_NAME_MAX]; if (zend_parse_parameters_none() == FAILURE) { return; } if (gethostname(buf, sizeof(buf) - 1)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno)); RETURN_FALSE; } RETURN_STRING(buf, 1); }
7,284
111,837
0
void SyncBackendHost::Core::SaveChanges() { DCHECK_EQ(MessageLoop::current(), sync_loop_); sync_manager_->SaveChanges(); }
7,285
102,070
0
void SyncBackendHost::Core::HandleStopSyncingPermanentlyOnFrontendLoop() { if (!host_ || !host_->frontend_) return; host_->frontend_->OnStopSyncingPermanently(); }
7,286
145,501
0
ResourceDispatcherHostImpl::IncrementOutstandingRequestsMemory( int count, const ResourceRequestInfoImpl& info) { DCHECK_EQ(1, abs(count)); OustandingRequestsStats stats = GetOutstandingRequestsStats(info); stats.memory_cost += count * info.memory_cost(); DCHECK_GE(stats.memory_cost, 0); UpdateOutstandingRequestsStats(info, stats); return stats; }
7,287
89,383
0
int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, struct blk_desc **dev_desc, disk_partition_t *part_info) { /* Split the part_name if passed as "$dev_num#part_name". */ if (!part_get_info_by_dev_and_name(dev_iface, dev_part_str, dev_desc, part_info)) return 0; /* * Couldn't lookup by name, try looking up the partition description * directly. */ if (blk_get_device_part_str(dev_iface, dev_part_str, dev_desc, part_info, 1) < 0) { printf("Couldn't find partition %s %s\n", dev_iface, dev_part_str); return -EINVAL; } return 0; }
7,288
128,024
0
void AwContents::OnPermissionRequest( base::android::ScopedJavaLocalRef<jobject> j_request, AwPermissionRequest* request) { DCHECK(!j_request.is_null()); DCHECK(request); JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env); if (j_ref.is_null()) { permission_request_handler_->CancelRequest(request->GetOrigin(), request->GetResources()); return; } Java_AwContents_onPermissionRequest(env, j_ref.obj(), j_request.obj()); }
7,289
153,883
0
void GLES2DecoderImpl::BindTexImage2DCHROMIUMImpl(const char* function_name, GLenum target, GLenum internalformat, GLint image_id) { if (target == GL_TEXTURE_CUBE_MAP) { LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, function_name, "invalid target"); return; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "no texture bound"); return; } gl::GLImage* image = image_manager()->LookupImage(image_id); if (!image) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "no image found with the given ID"); return; } Texture::ImageState image_state = Texture::UNBOUND; if (image->ShouldBindOrCopy() == gl::GLImage::BIND) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", error_state_.get()); if (internalformat) { if (image->BindTexImageWithInternalformat(target, internalformat)) image_state = Texture::BOUND; } else { if (image->BindTexImage(target)) image_state = Texture::BOUND; } } gfx::Size size = image->GetSize(); GLenum texture_internalformat = internalformat ? internalformat : image->GetInternalFormat(); texture_manager()->SetLevelInfo( texture_ref, target, 0, texture_internalformat, size.width(), size.height(), 1, 0, TextureManager::ExtractFormatFromStorageFormat(texture_internalformat), GL_UNSIGNED_BYTE, gfx::Rect(size)); texture_manager()->SetLevelImage(texture_ref, target, 0, image, image_state); }
7,290
180,305
1
static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb) { /* unprotected vars, we dont care of overwrites */ static u32 challenge_timestamp; static unsigned int challenge_count; struct tcp_sock *tp = tcp_sk(sk); u32 now; /* First check our per-socket dupack rate limit. */ if (tcp_oow_rate_limited(sock_net(sk), skb, LINUX_MIB_TCPACKSKIPPEDCHALLENGE, &tp->last_oow_ack_time)) return; /* Then check the check host-wide RFC 5961 rate limit. * now = jiffies / HZ; if (now != challenge_timestamp) { challenge_timestamp = now; challenge_count = 0; } if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); tcp_send_ack(sk); } }
7,291
128,682
0
bool SettingsWindowEnabled() { #if defined(OS_CHROMEOS) return !base::CommandLine::ForCurrentProcess()->HasSwitch( ::switches::kDisableSettingsWindow); #else return base::CommandLine::ForCurrentProcess()->HasSwitch( ::switches::kEnableSettingsWindow); #endif }
7,292
90,623
0
static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { char timestamp[MagickPathExtent]; const char *value; CINInfo cin; const StringInfo *profile; MagickBooleanType status; MagickOffsetType offset; QuantumInfo *quantum_info; QuantumType quantum_type; register const Quantum *p; register ssize_t i; size_t length; ssize_t count, y; struct tm local_time; time_t seconds; unsigned char *pixels; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); if (image->colorspace != LogColorspace) (void) TransformImageColorspace(image,LogColorspace,exception); /* Write image information. */ (void) memset(&cin,0,sizeof(cin)); offset=0; cin.file.magic=0x802A5FD7UL; offset+=WriteBlobLong(image,(unsigned int) cin.file.magic); cin.file.image_offset=0x800; offset+=WriteBlobLong(image,(unsigned int) cin.file.image_offset); cin.file.generic_length=0x400; offset+=WriteBlobLong(image,(unsigned int) cin.file.generic_length); cin.file.industry_length=0x400; offset+=WriteBlobLong(image,(unsigned int) cin.file.industry_length); cin.file.user_length=0x00; profile=GetImageProfile(image,"dpx:user.data"); if (profile != (StringInfo *) NULL) { cin.file.user_length+=(size_t) GetStringInfoLength(profile); cin.file.user_length=(((cin.file.user_length+0x2000-1)/0x2000)*0x2000); } offset+=WriteBlobLong(image,(unsigned int) cin.file.user_length); cin.file.file_size=4*image->columns*image->rows+0x2000; offset+=WriteBlobLong(image,(unsigned int) cin.file.file_size); (void) CopyMagickString(cin.file.version,"V4.5",sizeof(cin.file.version)); offset+=WriteBlob(image,sizeof(cin.file.version),(unsigned char *) cin.file.version); value=GetCINProperty(image_info,image,"dpx:file.filename",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.file.filename,value,sizeof(cin.file.filename)); else (void) CopyMagickString(cin.file.filename,image->filename, sizeof(cin.file.filename)); offset+=WriteBlob(image,sizeof(cin.file.filename),(unsigned char *) cin.file.filename); seconds=time((time_t *) NULL); #if defined(MAGICKCORE_HAVE_LOCALTIME_R) (void) localtime_r(&seconds,&local_time); #else (void) memcpy(&local_time,localtime(&seconds),sizeof(local_time)); #endif (void) memset(timestamp,0,sizeof(timestamp)); (void) strftime(timestamp,MagickPathExtent,"%Y:%m:%d:%H:%M:%S%Z",&local_time); (void) memset(cin.file.create_date,0,sizeof(cin.file.create_date)); (void) CopyMagickString(cin.file.create_date,timestamp,11); offset+=WriteBlob(image,sizeof(cin.file.create_date),(unsigned char *) cin.file.create_date); (void) memset(cin.file.create_time,0,sizeof(cin.file.create_time)); (void) CopyMagickString(cin.file.create_time,timestamp+11,11); offset+=WriteBlob(image,sizeof(cin.file.create_time),(unsigned char *) cin.file.create_time); offset+=WriteBlob(image,sizeof(cin.file.reserve),(unsigned char *) cin.file.reserve); cin.image.orientation=0x00; offset+=WriteBlobByte(image,cin.image.orientation); cin.image.number_channels=3; offset+=WriteBlobByte(image,cin.image.number_channels); offset+=WriteBlob(image,sizeof(cin.image.reserve1),(unsigned char *) cin.image.reserve1); for (i=0; i < 8; i++) { cin.image.channel[i].designator[0]=0; /* universal metric */ offset+=WriteBlobByte(image,cin.image.channel[0].designator[0]); cin.image.channel[i].designator[1]=(unsigned char) (i > 3 ? 0 : i+1); /* channel color */; offset+=WriteBlobByte(image,cin.image.channel[1].designator[0]); cin.image.channel[i].bits_per_pixel=(unsigned char) image->depth; offset+=WriteBlobByte(image,cin.image.channel[0].bits_per_pixel); offset+=WriteBlobByte(image,cin.image.channel[0].reserve); cin.image.channel[i].pixels_per_line=image->columns; offset+=WriteBlobLong(image,(unsigned int) cin.image.channel[0].pixels_per_line); cin.image.channel[i].lines_per_image=image->rows; offset+=WriteBlobLong(image,(unsigned int) cin.image.channel[0].lines_per_image); cin.image.channel[i].min_data=0; offset+=WriteBlobFloat(image,cin.image.channel[0].min_data); cin.image.channel[i].min_quantity=0.0; offset+=WriteBlobFloat(image,cin.image.channel[0].min_quantity); cin.image.channel[i].max_data=(float) ((MagickOffsetType) GetQuantumRange(image->depth)); offset+=WriteBlobFloat(image,cin.image.channel[0].max_data); cin.image.channel[i].max_quantity=2.048f; offset+=WriteBlobFloat(image,cin.image.channel[0].max_quantity); } offset+=WriteBlobFloat(image,image->chromaticity.white_point.x); offset+=WriteBlobFloat(image,image->chromaticity.white_point.y); offset+=WriteBlobFloat(image,image->chromaticity.red_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.red_primary.y); offset+=WriteBlobFloat(image,image->chromaticity.green_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.green_primary.y); offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.y); value=GetCINProperty(image_info,image,"dpx:image.label",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.image.label,value,sizeof(cin.image.label)); offset+=WriteBlob(image,sizeof(cin.image.label),(unsigned char *) cin.image.label); offset+=WriteBlob(image,sizeof(cin.image.reserve),(unsigned char *) cin.image.reserve); /* Write data format information. */ cin.data_format.interleave=0; /* pixel interleave (rgbrgbr...) */ offset+=WriteBlobByte(image,cin.data_format.interleave); cin.data_format.packing=5; /* packing ssize_tword (32bit) boundaries */ offset+=WriteBlobByte(image,cin.data_format.packing); cin.data_format.sign=0; /* unsigned data */ offset+=WriteBlobByte(image,cin.data_format.sign); cin.data_format.sense=0; /* image sense: positive image */ offset+=WriteBlobByte(image,cin.data_format.sense); cin.data_format.line_pad=0; offset+=WriteBlobLong(image,(unsigned int) cin.data_format.line_pad); cin.data_format.channel_pad=0; offset+=WriteBlobLong(image,(unsigned int) cin.data_format.channel_pad); offset+=WriteBlob(image,sizeof(cin.data_format.reserve),(unsigned char *) cin.data_format.reserve); /* Write origination information. */ cin.origination.x_offset=0UL; value=GetCINProperty(image_info,image,"dpx:origination.x_offset",exception); if (value != (const char *) NULL) cin.origination.x_offset=(ssize_t) StringToLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.origination.x_offset); cin.origination.y_offset=0UL; value=GetCINProperty(image_info,image,"dpx:origination.y_offset",exception); if (value != (const char *) NULL) cin.origination.y_offset=(ssize_t) StringToLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.origination.y_offset); value=GetCINProperty(image_info,image,"dpx:origination.filename",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.filename,value, sizeof(cin.origination.filename)); else (void) CopyMagickString(cin.origination.filename,image->filename, sizeof(cin.origination.filename)); offset+=WriteBlob(image,sizeof(cin.origination.filename),(unsigned char *) cin.origination.filename); seconds=time((time_t *) NULL); (void) memset(timestamp,0,sizeof(timestamp)); (void) strftime(timestamp,MagickPathExtent,"%Y:%m:%d:%H:%M:%S%Z",&local_time); (void) memset(cin.origination.create_date,0, sizeof(cin.origination.create_date)); (void) CopyMagickString(cin.origination.create_date,timestamp,11); offset+=WriteBlob(image,sizeof(cin.origination.create_date),(unsigned char *) cin.origination.create_date); (void) memset(cin.origination.create_time,0, sizeof(cin.origination.create_time)); (void) CopyMagickString(cin.origination.create_time,timestamp+11,15); offset+=WriteBlob(image,sizeof(cin.origination.create_time),(unsigned char *) cin.origination.create_time); value=GetCINProperty(image_info,image,"dpx:origination.device",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.device,value, sizeof(cin.origination.device)); offset+=WriteBlob(image,sizeof(cin.origination.device),(unsigned char *) cin.origination.device); value=GetCINProperty(image_info,image,"dpx:origination.model",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.model,value, sizeof(cin.origination.model)); offset+=WriteBlob(image,sizeof(cin.origination.model),(unsigned char *) cin.origination.model); value=GetCINProperty(image_info,image,"dpx:origination.serial",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.serial,value, sizeof(cin.origination.serial)); offset+=WriteBlob(image,sizeof(cin.origination.serial),(unsigned char *) cin.origination.serial); cin.origination.x_pitch=0.0f; value=GetCINProperty(image_info,image,"dpx:origination.x_pitch",exception); if (value != (const char *) NULL) cin.origination.x_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.x_pitch); cin.origination.y_pitch=0.0f; value=GetCINProperty(image_info,image,"dpx:origination.y_pitch",exception); if (value != (const char *) NULL) cin.origination.y_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.y_pitch); cin.origination.gamma=image->gamma; offset+=WriteBlobFloat(image,cin.origination.gamma); offset+=WriteBlob(image,sizeof(cin.origination.reserve),(unsigned char *) cin.origination.reserve); /* Image film information. */ cin.film.id=0; value=GetCINProperty(image_info,image,"dpx:film.id",exception); if (value != (const char *) NULL) cin.film.id=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.id); cin.film.type=0; value=GetCINProperty(image_info,image,"dpx:film.type",exception); if (value != (const char *) NULL) cin.film.type=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.type); cin.film.offset=0; value=GetCINProperty(image_info,image,"dpx:film.offset",exception); if (value != (const char *) NULL) cin.film.offset=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.offset); offset+=WriteBlobByte(image,(unsigned char) cin.film.reserve1); cin.film.prefix=0UL; value=GetCINProperty(image_info,image,"dpx:film.prefix",exception); if (value != (const char *) NULL) cin.film.prefix=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.prefix); cin.film.count=0UL; value=GetCINProperty(image_info,image,"dpx:film.count",exception); if (value != (const char *) NULL) cin.film.count=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.count); value=GetCINProperty(image_info,image,"dpx:film.format",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.format,value,sizeof(cin.film.format)); offset+=WriteBlob(image,sizeof(cin.film.format),(unsigned char *) cin.film.format); cin.film.frame_position=0UL; value=GetCINProperty(image_info,image,"dpx:film.frame_position",exception); if (value != (const char *) NULL) cin.film.frame_position=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.frame_position); cin.film.frame_rate=0.0f; value=GetCINProperty(image_info,image,"dpx:film.frame_rate",exception); if (value != (const char *) NULL) cin.film.frame_rate=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.film.frame_rate); value=GetCINProperty(image_info,image,"dpx:film.frame_id",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.frame_id,value,sizeof(cin.film.frame_id)); offset+=WriteBlob(image,sizeof(cin.film.frame_id),(unsigned char *) cin.film.frame_id); value=GetCINProperty(image_info,image,"dpx:film.slate_info",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.slate_info,value, sizeof(cin.film.slate_info)); offset+=WriteBlob(image,sizeof(cin.film.slate_info),(unsigned char *) cin.film.slate_info); offset+=WriteBlob(image,sizeof(cin.film.reserve),(unsigned char *) cin.film.reserve); if (profile != (StringInfo *) NULL) offset+=WriteBlob(image,GetStringInfoLength(profile), GetStringInfoDatum(profile)); while (offset < (MagickOffsetType) cin.file.image_offset) offset+=WriteBlobByte(image,0x00); /* Convert pixel packets to CIN raster image. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); quantum_info->quantum=32; quantum_info->pack=MagickFalse; quantum_type=RGBQuantum; pixels=(unsigned char *) GetQuantumPixels(quantum_info); length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue); DisableMSCWarning(4127) if (0) RestoreMSCWarning { quantum_type=GrayQuantum; length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue); } for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; (void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } quantum_info=DestroyQuantumInfo(quantum_info); (void) CloseBlob(image); return(status); }
7,293
71,135
0
int mkfifo_atomic(const char *path, mode_t mode) { _cleanup_free_ char *t = NULL; int r; assert(path); r = tempfn_random(path, NULL, &t); if (r < 0) return r; if (mkfifo(t, mode) < 0) return -errno; if (rename(t, path) < 0) { unlink_noerrno(t); return -errno; } return 0; }
7,294
104,757
0
void NavigationController::LoadURL(const GURL& url, const GURL& referrer, PageTransition::Type transition) { needs_reload_ = false; NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, profile_); LoadEntry(entry); }
7,295
138,350
0
void ShutDown() { BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)->PostTask( FROM_HERE, base::Bind(&InProcessServiceManagerContext::ShutDownOnIOThread, this)); }
7,296
35,326
0
static void ipgre_tap_setup(struct net_device *dev) { ether_setup(dev); dev->netdev_ops = &ipgre_tap_netdev_ops; dev->destructor = ipgre_dev_free; dev->iflink = 0; dev->features |= NETIF_F_NETNS_LOCAL; }
7,297
94,767
0
static MagickBooleanType ClonePixelCacheRepository( CacheInfo *magick_restrict clone_info,CacheInfo *magick_restrict cache_info, ExceptionInfo *exception) { #define MaxCacheThreads 2 #define cache_threads(source,destination) \ num_threads(((source)->type == DiskCache) || \ ((destination)->type == DiskCache) || (((source)->rows) < \ (16*GetMagickResourceLimit(ThreadResource))) ? 1 : \ GetMagickResourceLimit(ThreadResource) < MaxCacheThreads ? \ GetMagickResourceLimit(ThreadResource) : MaxCacheThreads) MagickBooleanType optimize, status; NexusInfo **magick_restrict cache_nexus, **magick_restrict clone_nexus; size_t length; ssize_t y; assert(cache_info != (CacheInfo *) NULL); assert(clone_info != (CacheInfo *) NULL); assert(exception != (ExceptionInfo *) NULL); if (cache_info->type == PingCache) return(MagickTrue); length=cache_info->number_channels*sizeof(*cache_info->channel_map); if ((cache_info->columns == clone_info->columns) && (cache_info->rows == clone_info->rows) && (cache_info->number_channels == clone_info->number_channels) && (memcmp(cache_info->channel_map,clone_info->channel_map,length) == 0) && (cache_info->metacontent_extent == clone_info->metacontent_extent)) { /* Identical pixel cache morphology. */ if (((cache_info->type == MemoryCache) || (cache_info->type == MapCache)) && ((clone_info->type == MemoryCache) || (clone_info->type == MapCache))) { (void) memcpy(clone_info->pixels,cache_info->pixels, cache_info->columns*cache_info->number_channels*cache_info->rows* sizeof(*cache_info->pixels)); if ((cache_info->metacontent_extent != 0) && (clone_info->metacontent_extent != 0)) (void) memcpy(clone_info->metacontent,cache_info->metacontent, cache_info->columns*cache_info->rows* clone_info->metacontent_extent*sizeof(unsigned char)); return(MagickTrue); } if ((cache_info->type == DiskCache) && (clone_info->type == DiskCache)) return(ClonePixelCacheOnDisk(cache_info,clone_info)); } /* Mismatched pixel cache morphology. */ cache_nexus=AcquirePixelCacheNexus(MaxCacheThreads); clone_nexus=AcquirePixelCacheNexus(MaxCacheThreads); if ((cache_nexus == (NexusInfo **) NULL) || (clone_nexus == (NexusInfo **) NULL)) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); length=cache_info->number_channels*sizeof(*cache_info->channel_map); optimize=(cache_info->number_channels == clone_info->number_channels) && (memcmp(cache_info->channel_map,clone_info->channel_map,length) == 0) ? MagickTrue : MagickFalse; length=(size_t) MagickMin(cache_info->columns*cache_info->number_channels, clone_info->columns*clone_info->number_channels); status=MagickTrue; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ cache_threads(cache_info,clone_info) #endif for (y=0; y < (ssize_t) cache_info->rows; y++) { const int id = GetOpenMPThreadId(); Quantum *pixels; RectangleInfo region; register ssize_t x; if (status == MagickFalse) continue; if (y >= (ssize_t) clone_info->rows) continue; region.width=cache_info->columns; region.height=1; region.x=0; region.y=y; pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,&region, cache_nexus[id],exception); if (pixels == (Quantum *) NULL) continue; status=ReadPixelCachePixels(cache_info,cache_nexus[id],exception); if (status == MagickFalse) continue; region.width=clone_info->columns; pixels=SetPixelCacheNexusPixels(clone_info,WriteMode,&region, clone_nexus[id],exception); if (pixels == (Quantum *) NULL) continue; (void) ResetMagickMemory(clone_nexus[id]->pixels,0,(size_t) clone_nexus[id]->length); if (optimize != MagickFalse) (void) memcpy(clone_nexus[id]->pixels,cache_nexus[id]->pixels,length* sizeof(Quantum)); else { register const Quantum *magick_restrict p; register Quantum *magick_restrict q; /* Mismatched pixel channel map. */ p=cache_nexus[id]->pixels; q=clone_nexus[id]->pixels; for (x=0; x < (ssize_t) cache_info->columns; x++) { register ssize_t i; if (x == (ssize_t) clone_info->columns) break; for (i=0; i < (ssize_t) clone_info->number_channels; i++) { PixelChannel channel; PixelTrait traits; channel=clone_info->channel_map[i].channel; traits=cache_info->channel_map[channel].traits; if (traits != UndefinedPixelTrait) *q=*(p+cache_info->channel_map[channel].offset); q++; } p+=cache_info->number_channels; } } status=WritePixelCachePixels(clone_info,clone_nexus[id],exception); } if ((cache_info->metacontent_extent != 0) && (clone_info->metacontent_extent != 0)) { /* Clone metacontent. */ length=(size_t) MagickMin(cache_info->metacontent_extent, clone_info->metacontent_extent); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ cache_threads(cache_info,clone_info) #endif for (y=0; y < (ssize_t) cache_info->rows; y++) { const int id = GetOpenMPThreadId(); Quantum *pixels; RectangleInfo region; if (status == MagickFalse) continue; if (y >= (ssize_t) clone_info->rows) continue; region.width=cache_info->columns; region.height=1; region.x=0; region.y=y; pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,&region, cache_nexus[id],exception); if (pixels == (Quantum *) NULL) continue; status=ReadPixelCacheMetacontent(cache_info,cache_nexus[id],exception); if (status == MagickFalse) continue; region.width=clone_info->columns; pixels=SetPixelCacheNexusPixels(clone_info,WriteMode,&region, clone_nexus[id],exception); if (pixels == (Quantum *) NULL) continue; if ((clone_nexus[id]->metacontent != (void *) NULL) && (cache_nexus[id]->metacontent != (void *) NULL)) (void) memcpy(clone_nexus[id]->metacontent, cache_nexus[id]->metacontent,length*sizeof(unsigned char)); status=WritePixelCacheMetacontent(clone_info,clone_nexus[id],exception); } } cache_nexus=DestroyPixelCacheNexus(cache_nexus,MaxCacheThreads); clone_nexus=DestroyPixelCacheNexus(clone_nexus,MaxCacheThreads); if (cache_info->debug != MagickFalse) { char message[MagickPathExtent]; (void) FormatLocaleString(message,MagickPathExtent,"%s => %s", CommandOptionToMnemonic(MagickCacheOptions,(ssize_t) cache_info->type), CommandOptionToMnemonic(MagickCacheOptions,(ssize_t) clone_info->type)); (void) LogMagickEvent(CacheEvent,GetMagickModule(),"%s",message); } return(status); }
7,298
9,999
0
render_state_draw( RenderState state, const unsigned char* text, int idx, int x, int y, int width, int height ) { ColumnState column = &state->columns[idx]; const unsigned char* p = text; long load_flags = FT_LOAD_DEFAULT; FT_Face face = state->face; int left = x; int right = x + width; int bottom = y + height; int line_height; FT_UInt prev_glyph = 0; FT_Pos prev_rsb_delta = 0; FT_Pos x_origin = x << 6; HintMode rmode = column->hint_mode; if ( !face ) return; _render_state_rescale( state ); if ( column->use_lcd_filter ) FT_Library_SetLcdFilter( face->glyph->library, column->lcd_filter ); if ( column->use_custom_lcd_filter ) FT_Library_SetLcdFilterWeights( face->glyph->library, column->filter_weights ); y += state->size->metrics.ascender / 64; line_height = state->size->metrics.height / 64; if ( rmode == HINT_MODE_AUTOHINT ) load_flags = FT_LOAD_FORCE_AUTOHINT; if ( rmode == HINT_MODE_AUTOHINT_LIGHT ) load_flags = FT_LOAD_TARGET_LIGHT; if ( rmode == HINT_MODE_UNHINTED ) load_flags |= FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; if ( !column->use_global_advance_width ) load_flags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; for ( ; *p; p++ ) { FT_UInt gindex; FT_Error error; FT_GlyphSlot slot = face->glyph; FT_Bitmap* map = &slot->bitmap; int xmax; /* handle newlines */ if ( *p == 0x0A ) { if ( p[1] == 0x0D ) p++; x_origin = left << 6; y += line_height; prev_rsb_delta = 0; if ( y >= bottom ) break; continue; } else if ( *p == 0x0D ) { if ( p[1] == 0x0A ) p++; x_origin = left << 6; y += line_height; prev_rsb_delta = 0; if ( y >= bottom ) break; continue; } gindex = FT_Get_Char_Index( state->face, p[0] ); error = FT_Load_Glyph( face, gindex, load_flags ); if ( error ) continue; if ( column->use_kerning && gindex != 0 && prev_glyph != 0 ) { FT_Vector vec; FT_Int kerning_mode = FT_KERNING_DEFAULT; if ( rmode == HINT_MODE_UNHINTED ) kerning_mode = FT_KERNING_UNFITTED; FT_Get_Kerning( face, prev_glyph, gindex, kerning_mode, &vec ); x_origin += vec.x; } if ( column->use_deltas ) { if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) x_origin -= 64; else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) x_origin += 64; } prev_rsb_delta = face->glyph->rsb_delta; /* implement sub-pixel positining for un-hinted mode */ if ( rmode == HINT_MODE_UNHINTED && slot->format == FT_GLYPH_FORMAT_OUTLINE ) { FT_Pos shift = x_origin & 63; FT_Outline_Translate( &slot->outline, shift, 0 ); } if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { FT_BBox cbox; FT_Outline_Get_CBox( &slot->outline, &cbox ); xmax = ( x_origin + cbox.xMax + 63 ) >> 6; FT_Render_Glyph( slot, column->use_lcd_filter ? FT_RENDER_MODE_LCD : FT_RENDER_MODE_NORMAL ); } else xmax = ( x_origin >> 6 ) + slot->bitmap_left + slot->bitmap.width; if ( xmax >= right ) { x = left; y += line_height; if ( y >= bottom ) break; x_origin = x << 6; prev_rsb_delta = 0; } { DisplayMode mode = DISPLAY_MODE_MONO; if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ) mode = DISPLAY_MODE_GRAY; else if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD ) mode = DISPLAY_MODE_LCD; state->display.disp_draw( state->display.disp, mode, ( x_origin >> 6 ) + slot->bitmap_left, y - slot->bitmap_top, map->width, map->rows, map->pitch, map->buffer ); } if ( rmode == HINT_MODE_UNHINTED ) x_origin += slot->linearHoriAdvance >> 10; else x_origin += slot->advance.x; prev_glyph = gindex; } /* display footer on this column */ { void* disp = state->display.disp; const char *msg; char temp[64]; msg = render_mode_names[column->hint_mode]; state->display.disp_text( disp, left, bottom + 5, msg ); if ( !column->use_lcd_filter ) msg = "gray rendering"; else if ( column->use_custom_lcd_filter ) { int fwi = column->fw_index; unsigned char *fw = column->filter_weights; msg = ""; sprintf( temp, "%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s", fwi == 0 ? "[" : " ", fw[0], fwi == 0 ? "]" : ( fwi == 1 ? "[" : " " ), fw[1], fwi == 1 ? "]" : ( fwi == 2 ? "[" : " " ), fw[2], fwi == 2 ? "]" : ( fwi == 3 ? "[" : " " ), fw[3], fwi == 3 ? "]" : ( fwi == 4 ? "[" : " " ), fw[4], fwi == 4 ? "]" : " " ); state->display.disp_text( disp, left, bottom + 15, temp ); } else switch ( column->lcd_filter ) { case FT_LCD_FILTER_NONE: msg = "LCD without filtering"; break; case FT_LCD_FILTER_DEFAULT: msg = "default LCD filter"; break; case FT_LCD_FILTER_LIGHT: msg = "light LCD filter"; break; default: msg = "legacy LCD filter"; } state->display.disp_text( disp, left, bottom + 15, msg ); sprintf(temp, "%s %s %s", column->use_kerning ? "+kern" : "-kern", column->use_deltas ? "+delta" : "-delta", column->use_global_advance_width ? "+advance" : "-advance" ); state->display.disp_text( disp, left, bottom + 25, temp ); if ( state->col == idx ) state->display.disp_text( disp, left, bottom + 35, "**************" ); } }
7,299