idx
int64
func
string
target
int64
42,382
osi_print_cksum(netdissect_options *ndo, const uint8_t *pptr, uint16_t checksum, int checksum_offset, u_int length) { uint16_t calculated_checksum; /* do not attempt to verify the checksum if it is zero, * if the offset is nonsense, * or the base pointer is not sane */ if (!checksum || checksum_offset < 0 || !ND_TTEST2(*(pptr + checksum_offset), 2) || (u_int)checksum_offset > length || !ND_TTEST2(*pptr, length)) { ND_PRINT((ndo, " (unverified)")); } else { #if 0 printf("\nosi_print_cksum: %p %u %u\n", pptr, checksum_offset, length); #endif calculated_checksum = create_osi_cksum(pptr, checksum_offset, length); if (checksum == calculated_checksum) { ND_PRINT((ndo, " (correct)")); } else { ND_PRINT((ndo, " (incorrect should be 0x%04x)", calculated_checksum)); } } }
0
276,500
void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref || !texture_manager()->CanGenerateMipmaps(texture_ref)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glGenerateMipmap", "Can not generate mips"); return; } if (target == GL_TEXTURE_CUBE_MAP) { for (int i = 0; i < 6; ++i) { GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; if (!texture_manager()->ClearTextureLevel(this, texture_ref, face, 0)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big"); return; } } } else { if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, 0)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big"); return; } } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glGenerateMipmap"); if (workarounds().set_texture_filter_before_generating_mipmap) { glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); } glGenerateMipmapEXT(target); if (workarounds().set_texture_filter_before_generating_mipmap) { glTexParameteri(target, GL_TEXTURE_MIN_FILTER, texture_ref->texture()->min_filter()); } GLenum error = LOCAL_PEEK_GL_ERROR("glGenerateMipmap"); if (error == GL_NO_ERROR) { texture_manager()->MarkMipmapsGenerated(texture_ref); } }
0
186,069
void WebContentsImpl::SetAudioMuted(bool mute) { DVLOG(1) << "SetAudioMuted(mute=" << mute << "), was " << IsAudioMuted() << " for WebContentsImpl@" << this; if (mute == IsAudioMuted()) return; if (mute) { if (!audio_muter_) audio_muter_.reset(new WebContentsAudioMuter(this)); audio_muter_->StartMuting(); } else { DCHECK(audio_muter_); audio_muter_->StopMuting(); } FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidUpdateAudioMutingState(mute)); NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); }
0
69,679
ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host) { ram_addr_t res = (uint8_t *)host - (uint8_t *)rb->host; assert((uintptr_t)host >= (uintptr_t)rb->host); assert(res < rb->max_length); return res; }
0
511,261
ignore_tty_job_signals () { #if defined (SIGTSTP) set_signal_handler (SIGTSTP, SIG_IGN); set_signal_handler (SIGTTIN, SIG_IGN); set_signal_handler (SIGTTOU, SIG_IGN); #endif }
0
339,589
static int decode_bdlt(uint8_t *frame, int width, int height, const uint8_t *src, const uint8_t *src_end) { const uint8_t *frame_end = frame + width * height; uint8_t *line_ptr; int count, lines, segments; count = bytestream_get_le16(&src); if (count >= height || width * count < 0) return -1; frame += width * count; lines = bytestream_get_le16(&src); if (frame + lines * width > frame_end || src >= src_end) return -1; while (lines--) { line_ptr = frame; frame += width; segments = *src++; while (segments--) { if (src_end - src < 3) return -1; line_ptr += *src++; if (line_ptr >= frame) return -1; count = (int8_t)*src++; if (count >= 0) { if (line_ptr + count > frame || src_end - src < count) return -1; bytestream_get_buffer(&src, line_ptr, count); } else { count = -count; if (line_ptr + count > frame || src >= src_end) return -1; memset(line_ptr, *src++, count); } line_ptr += count; } } return 0; }
1
396,830
STATIC void GC_CALLBACK GC_default_on_abort(const char *msg) { GC_find_leak = FALSE; /* disable at-exit GC_gcollect() */ if (msg != NULL) { # if defined(MSWIN32) GC_win32_MessageBoxA(msg, "Fatal error in GC", MB_ICONERROR | MB_OK); /* Also duplicate msg to GC log file. */ # endif # ifndef GC_ANDROID_LOG /* Avoid calling GC_err_printf() here, as GC_on_abort() could be */ /* called from it. Note 1: this is not an atomic output. */ /* Note 2: possible write errors are ignored. */ # if defined(THREADS) && defined(GC_ASSERTIONS) \ && (defined(MSWIN32) || defined(MSWINCE)) if (!GC_write_disabled) # endif { if (WRITE(GC_stderr, (void *)msg, strlen(msg)) >= 0) (void)WRITE(GC_stderr, (void *)("\n"), 1); } # else __android_log_assert("*" /* cond */, GC_ANDROID_LOG_TAG, "%s\n", msg); # endif } # if !defined(NO_DEBUGGING) && !defined(GC_ANDROID_LOG) if (GETENV("GC_LOOP_ON_ABORT") != NULL) { /* In many cases it's easier to debug a running process. */ /* It's arguably nicer to sleep, but that makes it harder */ /* to look at the thread if the debugger doesn't know much */ /* about threads. */ for(;;) { /* Empty */ } } # endif }
0
491,437
fetch_alt_indirect_string (dwarf_vma offset) { separate_info * i; if (! do_follow_links) return ""; if (first_separate_info == NULL) return _("<no links available>"); for (i = first_separate_info; i != NULL; i = i->next) { struct dwarf_section * section; const char * ret; if (! load_debug_section (separate_debug_str, i->handle)) continue; section = &debug_displays [separate_debug_str].section; if (section->start == NULL) continue; if (offset >= section->size) continue; ret = (const char *) (section->start + offset); /* Unfortunately we cannot rely upon the .debug_str section ending with a NUL byte. Since our caller is expecting to receive a well formed C string we test for the lack of a terminating byte here. */ if (strnlen ((const char *) ret, section->size - offset) == section->size - offset) return _("<no NUL byte at end of alt .debug_str section>"); return ret; } warn (_("DW_FORM_GNU_strp_alt offset (%s) too big or no string sections available\n"), dwarf_vmatoa ("x", offset)); return _("<offset is too big>"); }
0
422,858
int ioat_probe(struct ioatdma_device *device) { int err = -ENODEV; struct dma_device *dma = &device->common; struct pci_dev *pdev = device->pdev; struct device *dev = &pdev->dev; /* DMA coherent memory pool for DMA descriptor allocations */ device->dma_pool = pci_pool_create("dma_desc_pool", pdev, sizeof(struct ioat_dma_descriptor), 64, 0); if (!device->dma_pool) { err = -ENOMEM; goto err_dma_pool; } device->completion_pool = pci_pool_create("completion_pool", pdev, sizeof(u64), SMP_CACHE_BYTES, SMP_CACHE_BYTES); if (!device->completion_pool) { err = -ENOMEM; goto err_completion_pool; } device->enumerate_channels(device); dma_cap_set(DMA_MEMCPY, dma->cap_mask); dma->dev = &pdev->dev; if (!dma->chancnt) { dev_err(dev, "channel enumeration error\n"); goto err_setup_interrupts; } err = ioat_dma_setup_interrupts(device); if (err) goto err_setup_interrupts; err = device->self_test(device); if (err) goto err_self_test; return 0; err_self_test: ioat_disable_interrupts(device); err_setup_interrupts: pci_pool_destroy(device->completion_pool); err_completion_pool: pci_pool_destroy(device->dma_pool); err_dma_pool: return err; }
0
34,972
mrb_malloc(mrb_state *mrb, size_t len) { return mrb_realloc(mrb, 0, len); }
0
213,593
WebView* RenderViewImpl::createView( WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures& features, const WebString& frame_name, WebNavigationPolicy policy) { if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) return NULL; ViewHostMsg_CreateWindow_Params params; params.opener_id = routing_id_; params.user_gesture = creator->isProcessingUserGesture(); params.window_container_type = WindowFeaturesToContainerType(features); params.session_storage_namespace_id = session_storage_namespace_id_; params.frame_name = frame_name; params.opener_frame_id = creator->identifier(); params.opener_url = creator->document().url(); params.opener_security_origin = creator->document().securityOrigin().toString().utf8(); params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); params.disposition = NavigationPolicyToDisposition(policy); if (!request.isNull()) params.target_url = request.url(); int32 routing_id = MSG_ROUTING_NONE; int32 surface_id = 0; int64 cloned_session_storage_namespace_id; RenderThread::Get()->Send( new ViewHostMsg_CreateWindow(params, &routing_id, &surface_id, &cloned_session_storage_namespace_id)); if (routing_id == MSG_ROUTING_NONE) return NULL; RenderViewImpl* view = RenderViewImpl::Create( 0, routing_id_, renderer_preferences_, webkit_preferences_, shared_popup_counter_, routing_id, surface_id, cloned_session_storage_namespace_id, frame_name, 1, screen_info_); view->opened_by_user_gesture_ = params.user_gesture; view->opener_suppressed_ = params.opener_suppressed; GURL creator_url(creator->document().securityOrigin().toString().utf8()); if (!creator_url.is_valid() || !creator_url.IsStandard()) creator_url = GURL(); view->creator_url_ = creator_url; view->alternate_error_page_url_ = alternate_error_page_url_; return view->webview(); }
0
396,498
putHmarker(HmarkerList *ml, int line, int pos, int seq) { if (ml == NULL) { ml = New(HmarkerList); ml->marks = NULL; ml->nmark = 0; ml->markmax = 0; ml->prevhseq = -1; } if (ml->markmax == 0) { ml->markmax = FIRST_MARKER_SIZE; ml->marks = NewAtom_N(BufferPoint, ml->markmax); bzero(ml->marks, sizeof(BufferPoint) * ml->markmax); } if (seq + 1 > ml->nmark) ml->nmark = seq + 1; if (ml->nmark >= ml->markmax) { ml->markmax = ml->nmark * 2; ml->marks = New_Reuse(BufferPoint, ml->marks, ml->markmax); } ml->marks[seq].line = line; ml->marks[seq].pos = pos; ml->marks[seq].invalid = 0; return ml; }
0
127,963
static __always_inline void pv_wait(u8 *ptr, u8 val) { PVOP_VCALL2(lock.wait, ptr, val); }
0
122,912
static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col) { if (im->thick > 1) { int thickhalf = im->thick >> 1; _gdImageFilledHRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col); } else { if (x2 < x1) { int t = x2; x2 = x1; x1 = t; } for (;x1 <= x2; x1++) { gdImageSetPixel(im, x1, y, col); } } return; }
0
149,166
static inline void fwnet_make_uf_hdr(struct rfc2734_header *hdr, unsigned ether_type) { hdr->w0 = fwnet_set_hdr_lf(RFC2374_HDR_UNFRAG) | fwnet_set_hdr_ether_type(ether_type); }
0
198,154
void RenderFrameImpl::PluginDidStartLoading() { DidStartLoading(); }
0
300,116
inline void Mean(const tflite::MeanParams& op_params, const RuntimeShape& unextended_input_shape, const uint8_t* input_data, int32 input_zero_point, float input_scale, const RuntimeShape& unextended_output_shape, uint8_t* output_data, int32 output_zero_point, float output_scale, CpuBackendContext* cpu_backend_context) { ruy::profiler::ScopeLabel label("Mean4D/Uint8"); // Current implementation only supports dimension equals 4 and simultaneous // reduction over width and height. TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4); TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4); const RuntimeShape input_shape = RuntimeShape::ExtendedShape(4, unextended_input_shape); const RuntimeShape output_shape = RuntimeShape::ExtendedShape(4, unextended_output_shape); const int output_height = output_shape.Dims(1); const int output_width = output_shape.Dims(2); const int output_depth = output_shape.Dims(3); TFLITE_CHECK_EQ(op_params.axis_count, 2); TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || (op_params.axis[0] == 2 && op_params.axis[1] == 1)); TFLITE_CHECK_EQ(output_height, 1); TFLITE_CHECK_EQ(output_width, 1); const int input_height = input_shape.Dims(1); const int input_width = input_shape.Dims(2); const float num_elements_in_axis = input_width * input_height; float temp = input_zero_point * input_scale / output_scale; temp = temp > 0 ? temp + 0.5f : temp - 0.5f; int32_t bias = output_zero_point - static_cast<int32_t>(temp); float real_scale = input_scale / (num_elements_in_axis * output_scale); int32 multiplier, shift; QuantizeMultiplier(real_scale, &multiplier, &shift); constexpr int kMinDepthPerThread = 8; int thread_count = output_depth / kMinDepthPerThread; thread_count = thread_count > 0 ? thread_count : 1; const int capped_thread_count = std::min(thread_count, cpu_backend_context->max_num_threads()); if (capped_thread_count == 1) { MeanImpl(op_params, input_shape, input_data, multiplier, shift, bias, output_shape, output_data, 0, output_depth); } else { // Instead parallel for batch, we loop for the output_depth since batch // is typical 1. std::vector<MeanWorkerTask> tasks; // TODO(b/131746020) don't create new heap allocations every time. // At least we make it a single heap allocation by using reserve(). tasks.reserve(capped_thread_count); int depth_start = 0; for (int i = 0; i < capped_thread_count; ++i) { // Try to distribute the tasks as even as possible. int depth_end = depth_start + (output_depth - depth_start) / (capped_thread_count - i); tasks.emplace_back(op_params, input_shape, input_data, multiplier, shift, bias, output_shape, output_data, depth_start, depth_end); depth_start = depth_end; } cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), cpu_backend_context); } }
0
11,622
zsetdevice(i_ctx_t *i_ctx_p) { gx_device *dev = gs_currentdevice(igs); os_ptr op = osp; int code = 0; check_write_type(*op, t_device); if (dev->LockSafetyParams) { /* do additional checking if locked */ if(op->value.pdevice != dev) /* don't allow a different device */ return_error(gs_error_invalidaccess); } dev->ShowpageCount = 0; code = gs_setdevice_no_erase(igs, op->value.pdevice); if (code < 0) return code; make_bool(op, code != 0); /* erase page if 1 */ invalidate_stack_devices(i_ctx_p); clear_pagedevice(istate); return code; }
1
4,495
error_t enc624j600UpdateMacAddrFilter(NetInterface *interface) { uint_t i; uint_t k; uint32_t crc; uint16_t hashTable[4]; MacFilterEntry *entry; //Debug message TRACE_DEBUG("Updating MAC filter...\r\n"); //Clear hash table osMemset(hashTable, 0, sizeof(hashTable)); //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++) { //Point to the current entry entry = &interface->macAddrFilter[i]; //Valid entry? if(entry->refCount > 0) { //Compute CRC over the current MAC address crc = enc624j600CalcCrc(&entry->addr, sizeof(MacAddr)); //Calculate the corresponding index in the table k = (crc >> 23) & 0x3F; //Update hash table contents hashTable[k / 16] |= (1 << (k % 16)); } } //Write the hash table to the ENC624J600 controller enc624j600WriteReg(interface, ENC624J600_REG_EHT1, hashTable[0]); enc624j600WriteReg(interface, ENC624J600_REG_EHT2, hashTable[1]); enc624j600WriteReg(interface, ENC624J600_REG_EHT3, hashTable[2]); enc624j600WriteReg(interface, ENC624J600_REG_EHT4, hashTable[3]); //Debug message TRACE_DEBUG(" EHT1 = %04" PRIX16 "\r\n", enc624j600ReadReg(interface, ENC624J600_REG_EHT1)); TRACE_DEBUG(" EHT2 = %04" PRIX16 "\r\n", enc624j600ReadReg(interface, ENC624J600_REG_EHT2)); TRACE_DEBUG(" EHT3 = %04" PRIX16 "\r\n", enc624j600ReadReg(interface, ENC624J600_REG_EHT3)); TRACE_DEBUG(" EHT4 = %04" PRIX16 "\r\n", enc624j600ReadReg(interface, ENC624J600_REG_EHT4)); //Successful processing return NO_ERROR; }
1
316,509
long Segment::ParseCues(long long off, long long& pos, long& len) { if (m_pCues) return 0; // success if (off < 0) return -1; long long total, avail; const int status = m_pReader->Length(&total, &avail); if (status < 0) // error return status; assert((total < 0) || (avail <= total)); pos = m_start + off; if ((total < 0) || (pos >= total)) return 1; // don't bother parsing cues const long long element_start = pos; const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size; if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } long long result = GetUIntLength(m_pReader, pos, len); if (result < 0) // error return static_cast<long>(result); if (result > 0) // underflow (weird) { len = 1; return E_BUFFER_NOT_FULL; } if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long idpos = pos; const long long id = ReadID(m_pReader, idpos, len); if (id != 0x0C53BB6B) // Cues ID return E_FILE_FORMAT_INVALID; pos += len; // consume ID assert((segment_stop < 0) || (pos <= segment_stop)); if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } result = GetUIntLength(m_pReader, pos, len); if (result < 0) // error return static_cast<long>(result); if (result > 0) // underflow (weird) { len = 1; return E_BUFFER_NOT_FULL; } if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long size = ReadUInt(m_pReader, pos, len); if (size < 0) // error return static_cast<long>(size); if (size == 0) // weird, although technically not illegal return 1; // done pos += len; // consume length of size of element assert((segment_stop < 0) || (pos <= segment_stop)); const long long element_stop = pos + size; if ((segment_stop >= 0) && (element_stop > segment_stop)) return E_FILE_FORMAT_INVALID; if ((total >= 0) && (element_stop > total)) return 1; // don't bother parsing anymore len = static_cast<long>(size); if (element_stop > avail) return E_BUFFER_NOT_FULL; const long long element_size = element_stop - element_start; m_pCues = new (std::nothrow) Cues(this, pos, size, element_start, element_size); if (m_pCues == NULL) return -1; return 0; // success }
0
191,956
std::vector<std::string> RegisterAllFeatureVariationParameters( flags_ui::FlagsStorage* flags_storage, base::FeatureList* feature_list) { return FlagsStateSingleton::GetFlagsState() ->RegisterAllFeatureVariationParameters(flags_storage, feature_list); }
0
253,400
HttpBridgeFactory::HttpBridgeFactory( net::URLRequestContextGetter* baseline_context_getter) { DCHECK(baseline_context_getter != NULL); request_context_getter_ = new HttpBridge::RequestContextGetter(baseline_context_getter); }
0
411,572
**/ CImg<T>& operator%=(const char *const expression) { return *this%=(+*this)._fill(expression,true,true,0,0,"operator%=",this);
0
192,482
void readpng2_version_info(void) { fprintf(stderr, " Compiled with libpng %s; using libpng %s\n", PNG_LIBPNG_VER_STRING, png_libpng_ver); fprintf(stderr, " and with zlib %s; using zlib %s.\n", ZLIB_VERSION, zlib_version); }
0
449,965
int LUKS2_get_data_size(struct luks2_hdr *hdr, uint64_t *size, bool *dynamic) { int sector_size; json_object *jobj_segments, *jobj_size; uint64_t tmp = 0; if (!size || !json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments)) return -EINVAL; json_object_object_foreach(jobj_segments, key, val) { UNUSED(key); if (json_segment_is_backup(val)) continue; json_object_object_get_ex(val, "size", &jobj_size); if (!strcmp(json_object_get_string(jobj_size), "dynamic")) { sector_size = json_segment_get_sector_size(val); /* last dynamic segment must have at least one sector in size */ if (tmp) *size = tmp + (sector_size > 0 ? sector_size : SECTOR_SIZE); else *size = 0; if (dynamic) *dynamic = true; return 0; } tmp += crypt_jobj_get_uint64(jobj_size); } /* impossible, real device size must not be zero */ if (!tmp) return -EINVAL; *size = tmp; if (dynamic) *dynamic = false; return 0; }
0
298,969
void kvm_vcpu_block(struct kvm_vcpu *vcpu) { DEFINE_WAIT(wait); for (;;) { prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); if (kvm_arch_vcpu_runnable(vcpu)) { kvm_make_request(KVM_REQ_UNHALT, vcpu); break; } if (kvm_cpu_has_pending_timer(vcpu)) break; if (signal_pending(current)) break; schedule(); } finish_wait(&vcpu->wq, &wait); }
0
315,250
WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( content::WebContents* web_contents) : content::WebContentsObserver(web_contents), message_loop_runner_(new content::MessageLoopRunner) { }
0
319,546
void gic_complete_irq(GICState *s, int cpu, int irq) { int update = 0; int cm = 1 << cpu; DPRINTF("EOI %d\n", irq); if (irq >= s->num_irq) { /* This handles two cases: * 1. If software writes the ID of a spurious interrupt [ie 1023] * to the GICC_EOIR, the GIC ignores that write. * 2. If software writes the number of a non-existent interrupt * this must be a subcase of "value written does not match the last * valid interrupt value read from the Interrupt Acknowledge * register" and so this is UNPREDICTABLE. We choose to ignore it. */ return; } if (s->running_irq[cpu] == 1023) return; /* No active IRQ. */ if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { /* Mark level triggered interrupts as pending if they are still raised. */ if (!GIC_TEST_EDGE_TRIGGER(irq) && GIC_TEST_ENABLED(irq, cm) && GIC_TEST_LEVEL(irq, cm) && (GIC_TARGET(irq) & cm) != 0) { DPRINTF("Set %d pending mask %x\n", irq, cm); GIC_SET_PENDING(irq, cm); update = 1; } } if (irq != s->running_irq[cpu]) { /* Complete an IRQ that is not currently running. */ int tmp = s->running_irq[cpu]; while (s->last_active[tmp][cpu] != 1023) { if (s->last_active[tmp][cpu] == irq) { s->last_active[tmp][cpu] = s->last_active[irq][cpu]; break; } tmp = s->last_active[tmp][cpu]; } if (update) { gic_update(s); } } else { /* Complete the current running IRQ. */ gic_set_running_irq(s, cpu, s->last_active[s->running_irq[cpu]][cpu]); } }
0
277,213
int BrowserMainLoop::PreMainMessageLoopRun() { #if defined(OS_ANDROID) ui::SetScreenAndroid(); #endif if (parts_) { TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); parts_->PreMainMessageLoopRun(); } base::ThreadRestrictions::SetIOAllowed(false); base::ThreadRestrictions::DisallowWaiting(); return result_code_; }
0
280,199
int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { if (HasTextBeingDragged()) return ui::DragDropTypes::DRAG_NONE; if (data.HasURL()) { GURL url; base::string16 title; if (data.GetURLAndTitle( ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) { base::string16 text( StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); if (model()->CanPasteAndGo(text)) { model()->PasteAndGo(text); return ui::DragDropTypes::DRAG_COPY; } } } else if (data.HasString()) { base::string16 text; if (data.GetString(&text)) { base::string16 collapsed_text(CollapseWhitespace(text, true)); if (model()->CanPasteAndGo(collapsed_text)) model()->PasteAndGo(collapsed_text); return ui::DragDropTypes::DRAG_COPY; } } return ui::DragDropTypes::DRAG_NONE; }
0
388,764
const uint8_t *smb1cli_conn_server_challenge(struct smbXcli_conn *conn) { return conn->smb1.server.challenge; }
0
133,745
void sctp_hash_established(struct sctp_association *asoc) { if (asoc->temp) return; sctp_local_bh_disable(); __sctp_hash_established(asoc); sctp_local_bh_enable(); }
0
470,984
wl_array_copy(struct wl_array *array, struct wl_array *source) { if (array->size < source->size) { if (!wl_array_add(array, source->size - array->size)) return -1; } else { array->size = source->size; } if (source->size > 0) memcpy(array->data, source->data, source->size); return 0; }
0
401,192
static sci_t macsec_frame_sci(struct macsec_eth_header *hdr, bool sci_present) { sci_t sci; if (sci_present) memcpy(&sci, hdr->secure_channel_id, sizeof(hdr->secure_channel_id)); else sci = make_sci(hdr->eth.h_source, MACSEC_PORT_ES); return sci; }
0
262,858
static int cmd_queue(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags) { if (cmd_queue_full(adata)) { mutt_debug(LL_DEBUG3, "Draining IMAP command pipeline\n"); const int rc = imap_exec(adata, NULL, flags & IMAP_CMD_POLL); if (rc == IMAP_EXEC_ERROR) return IMAP_RES_BAD; } struct ImapCommand *cmd = cmd_new(adata); if (!cmd) return IMAP_RES_BAD; if (mutt_buffer_add_printf(&adata->cmdbuf, "%s %s\r\n", cmd->seq, cmdstr) < 0) return IMAP_RES_BAD; return 0; }
0
306,329
void ConnectDialog::sendPing(const QHostAddress &host, unsigned short port) { char blob[16]; ServerAddress addr(HostAddress(host), port); quint64 uiRand; if (qhPingRand.contains(addr)) { uiRand = qhPingRand.value(addr); } else { uiRand = (static_cast<quint64>(qrand()) << 32) | static_cast<quint64>(qrand()); qhPingRand.insert(addr, uiRand); } memset(blob, 0, sizeof(blob)); * reinterpret_cast<quint64 *>(blob+8) = tPing.elapsed() ^ uiRand; if (bIPv4 && host.protocol() == QAbstractSocket::IPv4Protocol) qusSocket4->writeDatagram(blob+4, 12, host, port); else if (bIPv6 && host.protocol() == QAbstractSocket::IPv6Protocol) qusSocket6->writeDatagram(blob+4, 12, host, port); else return; const QSet<ServerItem *> &qs = qhPings.value(addr); foreach(ServerItem *si, qs) ++ si->uiSent; }
0
494,578
void add_tree_ipv4(const unsigned long ip, const u_char *data, const int len, const int datalink) { tcpr_tree_t *newnode; assert(data); newnode = packet2tree(data, len, datalink); if (newnode) { assert(ip == newnode->u.ip); if (newnode->type == DIR_UNKNOWN) { /* couldn't figure out if packet was client or server */ dbgx(2, "%s (%lu) unknown client/server", get_addr2name4(newnode->u.ip, RESOLVE), newnode->u.ip); } add_tree_node(newnode); } }
0
184,787
void RenderFrameImpl::PepperDidReceiveMouseEvent( PepperPluginInstanceImpl* instance) { render_view_->set_pepper_last_mouse_event_target(instance); }
0
320,792
void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) { RAMBlock *block; ram_addr_t offset; int flags; void *area, *vaddr; QLIST_FOREACH(block, &ram_list.blocks, next) { offset = addr - block->offset; if (offset < block->length) { vaddr = block->host + offset; if (block->flags & RAM_PREALLOC_MASK) { ; } else { flags = MAP_FIXED; munmap(vaddr, length); if (mem_path) { #if defined(__linux__) && !defined(TARGET_S390X) if (block->fd) { #ifdef MAP_POPULATE flags |= mem_prealloc ? MAP_POPULATE | MAP_SHARED : MAP_PRIVATE; flags |= MAP_PRIVATE; #endif area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, block->fd, offset); } else { flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) flags |= MAP_SHARED | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_EXEC|PROT_READ|PROT_WRITE, flags, -1, 0); flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); #endif } if (area != vaddr) { fprintf(stderr, "Could not remap addr: %lx@%lx\n", length, addr); exit(1); } qemu_madvise(vaddr, length, QEMU_MADV_MERGEABLE); } return; } } }
1
429,792
static BOOL check_opcode_types(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend) { int count; PCRE2_SPTR slot; PCRE2_SPTR assert_back_end = cc - 1; /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */ while (cc < ccend) { switch(*cc) { case OP_SET_SOM: common->has_set_som = TRUE; common->might_be_empty = TRUE; cc += 1; break; case OP_REF: case OP_REFI: common->optimized_cbracket[GET2(cc, 1)] = 0; cc += 1 + IMM2_SIZE; break; case OP_CBRAPOS: case OP_SCBRAPOS: common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0; cc += 1 + LINK_SIZE + IMM2_SIZE; break; case OP_COND: case OP_SCOND: /* Only AUTO_CALLOUT can insert this opcode. We do not intend to support this case. */ if (cc[1 + LINK_SIZE] == OP_CALLOUT || cc[1 + LINK_SIZE] == OP_CALLOUT_STR) return FALSE; cc += 1 + LINK_SIZE; break; case OP_CREF: common->optimized_cbracket[GET2(cc, 1)] = 0; cc += 1 + IMM2_SIZE; break; case OP_DNREF: case OP_DNREFI: case OP_DNCREF: count = GET2(cc, 1 + IMM2_SIZE); slot = common->name_table + GET2(cc, 1) * common->name_entry_size; while (count-- > 0) { common->optimized_cbracket[GET2(slot, 0)] = 0; slot += common->name_entry_size; } cc += 1 + 2 * IMM2_SIZE; break; case OP_RECURSE: /* Set its value only once. */ if (common->recursive_head_ptr == 0) { common->recursive_head_ptr = common->ovector_start; common->ovector_start += sizeof(sljit_sw); } cc += 1 + LINK_SIZE; break; case OP_CALLOUT: case OP_CALLOUT_STR: if (common->capture_last_ptr == 0) { common->capture_last_ptr = common->ovector_start; common->ovector_start += sizeof(sljit_sw); } cc += (*cc == OP_CALLOUT) ? PRIV(OP_lengths)[OP_CALLOUT] : GET(cc, 1 + 2*LINK_SIZE); break; case OP_ASSERTBACK: slot = bracketend(cc); if (slot > assert_back_end) assert_back_end = slot; cc += 1 + LINK_SIZE; break; case OP_THEN_ARG: common->has_then = TRUE; common->control_head_ptr = 1; /* Fall through. */ case OP_COMMIT_ARG: case OP_PRUNE_ARG: case OP_MARK: if (common->mark_ptr == 0) { common->mark_ptr = common->ovector_start; common->ovector_start += sizeof(sljit_sw); } cc += 1 + 2 + cc[1]; break; case OP_THEN: common->has_then = TRUE; common->control_head_ptr = 1; cc += 1; break; case OP_SKIP: if (cc < assert_back_end) common->has_skip_in_assert_back = TRUE; cc += 1; break; case OP_SKIP_ARG: common->control_head_ptr = 1; common->has_skip_arg = TRUE; if (cc < assert_back_end) common->has_skip_in_assert_back = TRUE; cc += 1 + 2 + cc[1]; break; default: cc = next_opcode(common, cc); if (cc == NULL) return FALSE; break; } } return TRUE; }
0
316,884
std::string SerializeSeedBase64(const variations::VariationsSeed& seed) { std::string serialized_seed = SerializeSeed(seed); std::string base64_serialized_seed; base::Base64Encode(Compress(serialized_seed), &base64_serialized_seed); return base64_serialized_seed; }
0
385,078
static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, off_t offset TSRMLS_DC) { phar_entry_fp_info *data; if (!entry->is_persistent) { entry->fp_type = type; entry->offset = offset; return; } data = &(PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].manifest[entry->manifest_pos]); data->fp_type = type; data->offset = offset; }
0
341,004
static void virtio_net_add_queue(VirtIONet *n, int index) { VirtIODevice *vdev = VIRTIO_DEVICE(n); n->vqs[index].rx_vq = virtio_add_queue(vdev, n->net_conf.rx_queue_size, virtio_net_handle_rx); if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { n->vqs[index].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); n->vqs[index].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer, &n->vqs[index]); } else { n->vqs[index].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); n->vqs[index].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[index]); } n->vqs[index].tx_waiting = 0; n->vqs[index].n = n; }
0
246,312
void AutofillManager::OnFormSubmittedImpl(const FormData& form, bool known_success, SubmissionSource source, base::TimeTicks timestamp) { if (source == SubmissionSource::PROBABLY_FORM_SUBMITTED) return; std::unique_ptr<FormStructure> submitted_form = ValidateSubmittedForm(form); if (!submitted_form) { autocomplete_history_manager_->OnWillSubmitForm(form); return; } FormData form_for_autocomplete = submitted_form->ToFormData(); for (size_t i = 0; i < submitted_form->field_count(); ++i) { if (submitted_form->field(i)->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE) { form_for_autocomplete.fields[i].should_autocomplete = false; } } autocomplete_history_manager_->OnWillSubmitForm(form_for_autocomplete); address_form_event_logger_->OnWillSubmitForm(); if (IsCreditCardAutofillEnabled()) credit_card_form_event_logger_->OnWillSubmitForm(); MaybeStartVoteUploadProcess(std::move(submitted_form), timestamp, /*observed_submission=*/true); submitted_form = ValidateSubmittedForm(form); DCHECK(submitted_form); if (!submitted_form) return; CreditCard credit_card = form_data_importer_->ExtractCreditCardFromForm(*submitted_form); AutofillMetrics::CardNumberStatus card_number_status = GetCardNumberStatus(credit_card); address_form_event_logger_->OnFormSubmitted(/*force_logging=*/false, card_number_status); if (IsCreditCardAutofillEnabled()) credit_card_form_event_logger_->OnFormSubmitted(enable_ablation_logging_, card_number_status); if (!submitted_form->IsAutofillable()) return; form_data_importer_->ImportFormData(*submitted_form, IsCreditCardAutofillEnabled()); }
0
92,389
void rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const char *qname) { __rpc_init_priority_wait_queue(queue, qname, RPC_NR_PRIORITY); }
0
259,129
static inline int propagate_entity_load_avg(struct sched_entity *se) { return 0; }
0
44,181
static RectangleInfo CompareImagesBounds(const Image *image1, const Image *image2,const LayerMethod method,ExceptionInfo *exception) { RectangleInfo bounds; PixelInfo pixel1, pixel2; register const Quantum *p, *q; register ssize_t x; ssize_t y; /* Set bounding box of the differences between images. */ GetPixelInfo(image1,&pixel1); GetPixelInfo(image2,&pixel2); for (x=0; x < (ssize_t) image1->columns; x++) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for (y=0; y < (ssize_t) image1->rows; y++) { GetPixelInfoPixel(image1,p,&pixel1); GetPixelInfoPixel(image2,q,&pixel2); if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse) break; p+=GetPixelChannels(image1); q+=GetPixelChannels(image2); } if (y < (ssize_t) image1->rows) break; } if (x >= (ssize_t) image1->columns) { /* Images are identical, return a null image. */ bounds.x=-1; bounds.y=-1; bounds.width=1; bounds.height=1; return(bounds); } bounds.x=x; for (x=(ssize_t) image1->columns-1; x >= 0; x--) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for (y=0; y < (ssize_t) image1->rows; y++) { GetPixelInfoPixel(image1,p,&pixel1); GetPixelInfoPixel(image2,q,&pixel2); if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse) break; p+=GetPixelChannels(image1); q+=GetPixelChannels(image2); } if (y < (ssize_t) image1->rows) break; } bounds.width=(size_t) (x-bounds.x+1); for (y=0; y < (ssize_t) image1->rows; y++) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for (x=0; x < (ssize_t) image1->columns; x++) { GetPixelInfoPixel(image1,p,&pixel1); GetPixelInfoPixel(image2,q,&pixel2); if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse) break; p+=GetPixelChannels(image1); q+=GetPixelChannels(image2); } if (x < (ssize_t) image1->columns) break; } bounds.y=y; for (y=(ssize_t) image1->rows-1; y >= 0; y--) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for (x=0; x < (ssize_t) image1->columns; x++) { GetPixelInfoPixel(image1,p,&pixel1); GetPixelInfoPixel(image2,q,&pixel2); if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse) break; p+=GetPixelChannels(image1); q+=GetPixelChannels(image2); } if (x < (ssize_t) image1->columns) break; } bounds.height=(size_t) (y-bounds.y+1); return(bounds); }
0
183,323
static MagickStatusType CorrectPSDOpacity(LayerInfo* layer_info, ExceptionInfo *exception) { register PixelPacket *q; register ssize_t x; ssize_t y; if (layer_info->opacity == OpaqueOpacity) return(MagickTrue); layer_info->image->matte=MagickTrue; for (y=0; y < (ssize_t) layer_info->image->rows; y++) { q=GetAuthenticPixels(layer_info->image,0,y,layer_info->image->columns,1, exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) layer_info->image->columns; x++) { q->opacity=(Quantum) (QuantumRange-(Quantum) (QuantumScale*( (QuantumRange-q->opacity)*(QuantumRange-layer_info->opacity)))); q++; } if (SyncAuthenticPixels(layer_info->image,exception) == MagickFalse) return(MagickFalse); } return(MagickTrue); }
0
227,975
clearMediaPlayerAndAudioSourceProviderClientWithoutLocking() { getAudioSourceProvider().setClient(nullptr); if (m_webMediaPlayer) { m_audioSourceProvider.wrap(nullptr); m_webMediaPlayer.reset(); } }
0
160,245
static PayloadContext *h264_new_context(void) { PayloadContext *data = av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE); if (data) { data->cookie = MAGIC_COOKIE; } return data; }
1
238,033
Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) { ASSERT(!features.dialog || request.frameName().isEmpty()); if (!request.frameName().isEmpty() && request.frameName() != "_blank") { Frame* frame = frameLoaderForFrameLookup->frame()->tree()->find(request.frameName()); if (frame && shouldAllowNavigation(frame)) { if (!request.resourceRequest().url().isEmpty()) frame->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer); if (Page* page = frame->page()) page->chrome()->focus(); created = false; return frame; } } FrameLoadRequest requestWithReferrer = request; requestWithReferrer.resourceRequest().setHTTPReferrer(m_outgoingReferrer); addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), outgoingOrigin()); Page* oldPage = m_frame->page(); if (!oldPage) return 0; Page* page = oldPage->chrome()->createWindow(m_frame, requestWithReferrer, features); if (!page) return 0; Frame* frame = page->mainFrame(); if (request.frameName() != "_blank") frame->tree()->setName(request.frameName()); page->chrome()->setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); page->chrome()->setStatusbarVisible(features.statusBarVisible); page->chrome()->setScrollbarsVisible(features.scrollbarsVisible); page->chrome()->setMenubarVisible(features.menuBarVisible); page->chrome()->setResizable(features.resizable); FloatRect windowRect = page->chrome()->windowRect(); FloatSize pageSize = page->chrome()->pageRect().size(); if (features.xSet) windowRect.setX(features.x); if (features.ySet) windowRect.setY(features.y); if (features.widthSet) windowRect.setWidth(features.width + (windowRect.width() - pageSize.width())); if (features.heightSet) windowRect.setHeight(features.height + (windowRect.height() - pageSize.height())); page->chrome()->setWindowRect(windowRect); page->chrome()->show(); created = true; return frame; }
0
136,106
decrypt_R2004_header (Bit_Chain *restrict dat, BITCODE_RC *restrict decrypted, unsigned long size, Dwg_Data *restrict dwg) { unsigned int rseed = 1; unsigned i; /* Decrypt */ for (i = 0; i < size; i++) { rseed *= 0x343fd; rseed += 0x269ec3; decrypted[i] = bit_read_RC (dat) ^ (rseed >> 0x10); } }
0
421,274
static NOINLINE void send_inform(struct dhcp_packet *oldpacket) { struct dhcp_packet packet; /* "If a client has obtained a network address through some other means * (e.g., manual configuration), it may use a DHCPINFORM request message * to obtain other local configuration parameters. Servers receiving a * DHCPINFORM message construct a DHCPACK message with any local * configuration parameters appropriate for the client without: * allocating a new address, checking for an existing binding, filling * in 'yiaddr' or including lease time parameters. The servers SHOULD * unicast the DHCPACK reply to the address given in the 'ciaddr' field * of the DHCPINFORM message. * ... * The server responds to a DHCPINFORM message by sending a DHCPACK * message directly to the address given in the 'ciaddr' field * of the DHCPINFORM message. The server MUST NOT send a lease * expiration time to the client and SHOULD NOT fill in 'yiaddr'." */ //TODO: do a few sanity checks: is ciaddr set? //Better yet: is ciaddr == IP source addr? init_packet(&packet, oldpacket, DHCPACK); add_server_options(&packet); send_packet(&packet, /*force_bcast:*/ 0); }
0
181,186
void ContentSecurityPolicy::dispatchViolationEvents( const SecurityPolicyViolationEventInit& violationData, Element* element) { EventQueue* queue = m_executionContext->getEventQueue(); if (!queue) return; SecurityPolicyViolationEvent* event = SecurityPolicyViolationEvent::create( EventTypeNames::securitypolicyviolation, violationData); DCHECK(event->bubbles()); if (m_executionContext->isDocument()) { Document* document = toDocument(m_executionContext); if (element && element->isConnected() && element->document() == document) event->setTarget(element); else event->setTarget(document); } else if (m_executionContext->isWorkerGlobalScope()) { event->setTarget(toWorkerGlobalScope(m_executionContext)); } queue->enqueueEvent(event); }
0
295,879
WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, const char **argv,Image **image,ExceptionInfo *exception) { CompositeOperator compose; const char *format, *option; double attenuate; DrawInfo *draw_info; GeometryInfo geometry_info; ImageInfo *mogrify_info; MagickStatusType status; PixelInfo fill; MagickStatusType flags; PixelInterpolateMethod interpolate_method; QuantizeInfo *quantize_info; RectangleInfo geometry, region_geometry; register ssize_t i; /* Initialize method variables. */ 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); if (argc < 0) return(MagickTrue); mogrify_info=CloneImageInfo(image_info); draw_info=CloneDrawInfo(mogrify_info,(DrawInfo *) NULL); quantize_info=AcquireQuantizeInfo(mogrify_info); SetGeometryInfo(&geometry_info); GetPixelInfo(*image,&fill); fill=(*image)->background_color; attenuate=1.0; compose=(*image)->compose; interpolate_method=UndefinedInterpolatePixel; format=GetImageOption(mogrify_info,"format"); SetGeometry(*image,&region_geometry); /* Transmogrify the image. */ for (i=0; i < (ssize_t) argc; i++) { Image *mogrify_image; ssize_t count; option=argv[i]; if (IsCommandOption(option) == MagickFalse) continue; count=MagickMax(ParseCommandOption(MagickCommandOptions,MagickFalse,option), 0L); if ((i+count) >= (ssize_t) argc) break; status=MogrifyImageInfo(mogrify_info,(int) count+1,argv+i,exception); mogrify_image=(Image *) NULL; switch (*(option+1)) { case 'a': { if (LocaleCompare("adaptive-blur",option+1) == 0) { /* Adaptive blur image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=AdaptiveBlurImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("adaptive-resize",option+1) == 0) { /* Adaptive resize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=AdaptiveResizeImage(*image,geometry.width, geometry.height,exception); break; } if (LocaleCompare("adaptive-sharpen",option+1) == 0) { /* Adaptive sharpen image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=AdaptiveSharpenImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("affine",option+1) == 0) { /* Affine matrix. */ if (*option == '+') { GetAffineMatrix(&draw_info->affine); break; } (void) ParseAffineGeometry(argv[i+1],&draw_info->affine,exception); break; } if (LocaleCompare("alpha",option+1) == 0) { AlphaChannelOption alpha_type; (void) SyncImageSettings(mogrify_info,*image,exception); alpha_type=(AlphaChannelOption) ParseCommandOption( MagickAlphaChannelOptions,MagickFalse,argv[i+1]); (void) SetImageAlphaChannel(*image,alpha_type,exception); break; } if (LocaleCompare("annotate",option+1) == 0) { char *text, geometry_str[MagickPathExtent]; /* Annotate image. */ (void) SyncImageSettings(mogrify_info,*image,exception); SetGeometryInfo(&geometry_info); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; text=InterpretImageProperties(mogrify_info,*image,argv[i+2], exception); if (text == (char *) NULL) break; (void) CloneString(&draw_info->text,text); text=DestroyString(text); (void) FormatLocaleString(geometry_str,MagickPathExtent,"%+f%+f", geometry_info.xi,geometry_info.psi); (void) CloneString(&draw_info->geometry,geometry_str); draw_info->affine.sx=cos(DegreesToRadians( fmod(geometry_info.rho,360.0))); draw_info->affine.rx=sin(DegreesToRadians( fmod(geometry_info.rho,360.0))); draw_info->affine.ry=(-sin(DegreesToRadians( fmod(geometry_info.sigma,360.0)))); draw_info->affine.sy=cos(DegreesToRadians( fmod(geometry_info.sigma,360.0))); (void) AnnotateImage(*image,draw_info,exception); break; } if (LocaleCompare("antialias",option+1) == 0) { draw_info->stroke_antialias=(*option == '-') ? MagickTrue : MagickFalse; draw_info->text_antialias=(*option == '-') ? MagickTrue : MagickFalse; break; } if (LocaleCompare("attenuate",option+1) == 0) { if (*option == '+') { attenuate=1.0; break; } attenuate=StringToDouble(argv[i+1],(char **) NULL); break; } if (LocaleCompare("auto-gamma",option+1) == 0) { /* Auto Adjust Gamma of image based on its mean */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) AutoGammaImage(*image,exception); break; } if (LocaleCompare("auto-level",option+1) == 0) { /* Perfectly Normalize (max/min stretch) the image */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) AutoLevelImage(*image,exception); break; } if (LocaleCompare("auto-orient",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=AutoOrientImage(*image,(*image)->orientation, exception); break; } if (LocaleCompare("auto-threshold",option+1) == 0) { AutoThresholdMethod method; (void) SyncImageSettings(mogrify_info,*image,exception); method=(AutoThresholdMethod) ParseCommandOption( MagickAutoThresholdOptions,MagickFalse,argv[i+1]); (void) AutoThresholdImage(*image,method,exception); break; } break; } case 'b': { if (LocaleCompare("black-threshold",option+1) == 0) { /* Black threshold image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) BlackThresholdImage(*image,argv[i+1],exception); break; } if (LocaleCompare("blue-shift",option+1) == 0) { /* Blue shift image. */ (void) SyncImageSettings(mogrify_info,*image,exception); geometry_info.rho=1.5; if (*option == '-') flags=ParseGeometry(argv[i+1],&geometry_info); mogrify_image=BlueShiftImage(*image,geometry_info.rho,exception); break; } if (LocaleCompare("blur",option+1) == 0) { /* Gaussian blur image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=0.0; mogrify_image=BlurImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("border",option+1) == 0) { /* Surround image with a border of solid color. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=BorderImage(*image,&geometry,compose,exception); break; } if (LocaleCompare("bordercolor",option+1) == 0) { if (*option == '+') { (void) QueryColorCompliance(MogrifyBorderColor,AllCompliance, &draw_info->border_color,exception); break; } (void) QueryColorCompliance(argv[i+1],AllCompliance, &draw_info->border_color,exception); break; } if (LocaleCompare("box",option+1) == 0) { (void) QueryColorCompliance(argv[i+1],AllCompliance, &draw_info->undercolor,exception); break; } if (LocaleCompare("brightness-contrast",option+1) == 0) { double brightness, contrast; /* Brightness / contrast image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); brightness=geometry_info.rho; contrast=0.0; if ((flags & SigmaValue) != 0) contrast=geometry_info.sigma; (void) BrightnessContrastImage(*image,brightness,contrast, exception); break; } break; } case 'c': { if (LocaleCompare("canny",option+1) == 0) { /* Detect edges in the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=0.10; if ((flags & PsiValue) == 0) geometry_info.psi=0.30; if ((flags & PercentValue) != 0) { geometry_info.xi/=100.0; geometry_info.psi/=100.0; } mogrify_image=CannyEdgeImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception); break; } if (LocaleCompare("cdl",option+1) == 0) { char *color_correction_collection; /* Color correct with a color decision list. */ (void) SyncImageSettings(mogrify_info,*image,exception); color_correction_collection=FileToString(argv[i+1],~0UL,exception); if (color_correction_collection == (char *) NULL) break; (void) ColorDecisionListImage(*image,color_correction_collection, exception); break; } if (LocaleCompare("channel",option+1) == 0) { ChannelType channel; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { (void) SetPixelChannelMask(*image,DefaultChannels); break; } channel=(ChannelType) ParseChannelOption(argv[i+1]); (void) SetPixelChannelMask(*image,channel); break; } if (LocaleCompare("charcoal",option+1) == 0) { /* Charcoal image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=1.0; mogrify_image=CharcoalImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("chop",option+1) == 0) { /* Chop the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=ChopImage(*image,&geometry,exception); break; } if (LocaleCompare("clahe",option+1) == 0) { /* Contrast limited adaptive histogram equalization. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception); flags=ParseGeometry(argv[i+1],&geometry_info); (void) CLAHEImage(*image,geometry.width,geometry.height, (size_t) geometry.x,geometry_info.psi,exception); break; } if (LocaleCompare("clip",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { (void) SetImageMask(*image,WritePixelMask,(Image *) NULL, exception); break; } (void) ClipImage(*image,exception); break; } if (LocaleCompare("clip-mask",option+1) == 0) { Image *clip_mask; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { /* Remove a mask. */ (void) SetImageMask(*image,WritePixelMask,(Image *) NULL, exception); break; } /* Set the image mask. */ clip_mask=GetImageCache(mogrify_info,argv[i+1],exception); if (clip_mask == (Image *) NULL) break; (void) SetImageMask(*image,WritePixelMask,clip_mask,exception); clip_mask=DestroyImage(clip_mask); break; } if (LocaleCompare("clip-path",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) ClipImagePath(*image,argv[i+1],*option == '-' ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("colorize",option+1) == 0) { /* Colorize the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=ColorizeImage(*image,argv[i+1],&fill,exception); break; } if (LocaleCompare("color-matrix",option+1) == 0) { KernelInfo *kernel; (void) SyncImageSettings(mogrify_info,*image,exception); kernel=AcquireKernelInfo(argv[i+1],exception); if (kernel == (KernelInfo *) NULL) break; /* FUTURE: check on size of the matrix */ mogrify_image=ColorMatrixImage(*image,kernel,exception); kernel=DestroyKernelInfo(kernel); break; } if (LocaleCompare("colors",option+1) == 0) { /* Reduce the number of colors in the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); quantize_info->number_colors=StringToUnsignedLong(argv[i+1]); if (quantize_info->number_colors == 0) break; if (((*image)->storage_class == DirectClass) || (*image)->colors > quantize_info->number_colors) (void) QuantizeImage(quantize_info,*image,exception); else (void) CompressImageColormap(*image,exception); break; } if (LocaleCompare("colorspace",option+1) == 0) { ColorspaceType colorspace; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { (void) TransformImageColorspace(*image,sRGBColorspace, exception); break; } colorspace=(ColorspaceType) ParseCommandOption( MagickColorspaceOptions,MagickFalse,argv[i+1]); (void) TransformImageColorspace(*image,colorspace,exception); break; } if (LocaleCompare("compose",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions, MagickFalse,argv[i+1]); break; } if (LocaleCompare("connected-components",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=ConnectedComponentsImage(*image,(size_t) StringToInteger(argv[i+1]),(CCObjectInfo **) NULL,exception); break; } if (LocaleCompare("contrast",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) ContrastImage(*image,(*option == '-') ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("contrast-stretch",option+1) == 0) { double black_point, white_point; /* Contrast stretch image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); black_point=geometry_info.rho; white_point=(flags & SigmaValue) != 0 ? geometry_info.sigma : black_point; if ((flags & PercentValue) != 0) { black_point*=(double) (*image)->columns*(*image)->rows/100.0; white_point*=(double) (*image)->columns*(*image)->rows/100.0; } white_point=(double) (*image)->columns*(*image)->rows- white_point; (void) ContrastStretchImage(*image,black_point,white_point, exception); break; } if (LocaleCompare("convolve",option+1) == 0) { double gamma; KernelInfo *kernel_info; register ssize_t j; size_t extent; (void) SyncImageSettings(mogrify_info,*image,exception); kernel_info=AcquireKernelInfo(argv[i+1],exception); if (kernel_info == (KernelInfo *) NULL) break; extent=kernel_info->width*kernel_info->height; gamma=0.0; for (j=0; j < (ssize_t) extent; j++) gamma+=kernel_info->values[j]; gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma); for (j=0; j < (ssize_t) extent; j++) kernel_info->values[j]*=gamma; mogrify_image=MorphologyImage(*image,CorrelateMorphology,1, kernel_info,exception); kernel_info=DestroyKernelInfo(kernel_info); break; } if (LocaleCompare("crop",option+1) == 0) { /* Crop a image to a smaller size */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=CropImageToTiles(*image,argv[i+1],exception); break; } if (LocaleCompare("cycle",option+1) == 0) { /* Cycle an image colormap. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) CycleColormapImage(*image,(ssize_t) StringToLong(argv[i+1]), exception); break; } break; } case 'd': { if (LocaleCompare("decipher",option+1) == 0) { StringInfo *passkey; /* Decipher pixels. */ (void) SyncImageSettings(mogrify_info,*image,exception); passkey=FileToStringInfo(argv[i+1],~0UL,exception); if (passkey != (StringInfo *) NULL) { (void) PasskeyDecipherImage(*image,passkey,exception); passkey=DestroyStringInfo(passkey); } break; } if (LocaleCompare("density",option+1) == 0) { /* Set image density. */ (void) CloneString(&draw_info->density,argv[i+1]); break; } if (LocaleCompare("depth",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { (void) SetImageDepth(*image,MAGICKCORE_QUANTUM_DEPTH,exception); break; } (void) SetImageDepth(*image,StringToUnsignedLong(argv[i+1]), exception); break; } if (LocaleCompare("deskew",option+1) == 0) { double threshold; /* Straighten the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') threshold=40.0*QuantumRange/100.0; else threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+ 1.0); mogrify_image=DeskewImage(*image,threshold,exception); break; } if (LocaleCompare("despeckle",option+1) == 0) { /* Reduce the speckles within an image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=DespeckleImage(*image,exception); break; } if (LocaleCompare("display",option+1) == 0) { (void) CloneString(&draw_info->server_name,argv[i+1]); break; } if (LocaleCompare("distort",option+1) == 0) { char *args, token[MagickPathExtent]; const char *p; DistortMethod method; double *arguments; register ssize_t x; size_t number_arguments; /* Distort image. */ (void) SyncImageSettings(mogrify_info,*image,exception); method=(DistortMethod) ParseCommandOption(MagickDistortOptions, MagickFalse,argv[i+1]); if (method == ResizeDistortion) { double resize_args[2]; /* Special Case - Argument is actually a resize geometry! Convert that to an appropriate distortion argument array. */ (void) ParseRegionGeometry(*image,argv[i+2],&geometry, exception); resize_args[0]=(double) geometry.width; resize_args[1]=(double) geometry.height; mogrify_image=DistortImage(*image,method,(size_t)2, resize_args,MagickTrue,exception); break; } args=InterpretImageProperties(mogrify_info,*image,argv[i+2], exception); if (args == (char *) NULL) break; p=(char *) args; for (x=0; *p != '\0'; x++) { GetNextToken(p,&p,MagickPathExtent,token); if (*token == ',') GetNextToken(p,&p,MagickPathExtent,token); } number_arguments=(size_t) x; arguments=(double *) AcquireQuantumMemory(number_arguments, sizeof(*arguments)); if (arguments == (double *) NULL) ThrowWandFatalException(ResourceLimitFatalError, "MemoryAllocationFailed",(*image)->filename); (void) memset(arguments,0,number_arguments* sizeof(*arguments)); p=(char *) args; for (x=0; (x < (ssize_t) number_arguments) && (*p != '\0'); x++) { GetNextToken(p,&p,MagickPathExtent,token); if (*token == ',') GetNextToken(p,&p,MagickPathExtent,token); arguments[x]=StringToDouble(token,(char **) NULL); } args=DestroyString(args); mogrify_image=DistortImage(*image,method,number_arguments,arguments, (*option == '+') ? MagickTrue : MagickFalse,exception); arguments=(double *) RelinquishMagickMemory(arguments); break; } if (LocaleCompare("dither",option+1) == 0) { if (*option == '+') { quantize_info->dither_method=NoDitherMethod; break; } quantize_info->dither_method=(DitherMethod) ParseCommandOption( MagickDitherOptions,MagickFalse,argv[i+1]); break; } if (LocaleCompare("draw",option+1) == 0) { /* Draw image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) CloneString(&draw_info->primitive,argv[i+1]); (void) DrawImage(*image,draw_info,exception); break; } break; } case 'e': { if (LocaleCompare("edge",option+1) == 0) { /* Enhance edges in the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); mogrify_image=EdgeImage(*image,geometry_info.rho,exception); break; } if (LocaleCompare("emboss",option+1) == 0) { /* Emboss image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=EmbossImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("encipher",option+1) == 0) { StringInfo *passkey; /* Encipher pixels. */ (void) SyncImageSettings(mogrify_info,*image,exception); passkey=FileToStringInfo(argv[i+1],~0UL,exception); if (passkey != (StringInfo *) NULL) { (void) PasskeyEncipherImage(*image,passkey,exception); passkey=DestroyStringInfo(passkey); } break; } if (LocaleCompare("encoding",option+1) == 0) { (void) CloneString(&draw_info->encoding,argv[i+1]); break; } if (LocaleCompare("enhance",option+1) == 0) { /* Enhance image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=EnhanceImage(*image,exception); break; } if (LocaleCompare("equalize",option+1) == 0) { /* Equalize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) EqualizeImage(*image,exception); break; } if (LocaleCompare("evaluate",option+1) == 0) { double constant; MagickEvaluateOperator op; (void) SyncImageSettings(mogrify_info,*image,exception); op=(MagickEvaluateOperator) ParseCommandOption( MagickEvaluateOptions,MagickFalse,argv[i+1]); constant=StringToDoubleInterval(argv[i+2],(double) QuantumRange+ 1.0); (void) EvaluateImage(*image,op,constant,exception); break; } if (LocaleCompare("extent",option+1) == 0) { /* Set the image extent. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGravityGeometry(*image,argv[i+1],&geometry,exception); if (geometry.width == 0) geometry.width=(*image)->columns; if (geometry.height == 0) geometry.height=(*image)->rows; mogrify_image=ExtentImage(*image,&geometry,exception); break; } break; } case 'f': { if (LocaleCompare("family",option+1) == 0) { if (*option == '+') { if (draw_info->family != (char *) NULL) draw_info->family=DestroyString(draw_info->family); break; } (void) CloneString(&draw_info->family,argv[i+1]); break; } if (LocaleCompare("features",option+1) == 0) { if (*option == '+') { (void) DeleteImageArtifact(*image,"identify:features"); break; } (void) SetImageArtifact(*image,"identify:features",argv[i+1]); (void) SetImageArtifact(*image,"verbose","true"); break; } if (LocaleCompare("fill",option+1) == 0) { ExceptionInfo *sans; PixelInfo color; GetPixelInfo(*image,&fill); if (*option == '+') { (void) QueryColorCompliance("none",AllCompliance,&fill, exception); draw_info->fill=fill; if (draw_info->fill_pattern != (Image *) NULL) draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); break; } sans=AcquireExceptionInfo(); status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->fill_pattern=GetImageCache(mogrify_info,argv[i+1], exception); else draw_info->fill=fill=color; break; } if (LocaleCompare("flip",option+1) == 0) { /* Flip image scanlines. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=FlipImage(*image,exception); break; } if (LocaleCompare("floodfill",option+1) == 0) { PixelInfo target; /* Floodfill image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParsePageGeometry(*image,argv[i+1],&geometry,exception); (void) QueryColorCompliance(argv[i+2],AllCompliance,&target, exception); (void) FloodfillPaintImage(*image,draw_info,&target,geometry.x, geometry.y,*option == '-' ? MagickFalse : MagickTrue,exception); break; } if (LocaleCompare("flop",option+1) == 0) { /* Flop image scanlines. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=FlopImage(*image,exception); break; } if (LocaleCompare("font",option+1) == 0) { if (*option == '+') { if (draw_info->font != (char *) NULL) draw_info->font=DestroyString(draw_info->font); break; } (void) CloneString(&draw_info->font,argv[i+1]); break; } if (LocaleCompare("format",option+1) == 0) { format=argv[i+1]; break; } if (LocaleCompare("frame",option+1) == 0) { FrameInfo frame_info; /* Surround image with an ornamental border. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception); frame_info.width=geometry.width; frame_info.height=geometry.height; frame_info.outer_bevel=geometry.x; frame_info.inner_bevel=geometry.y; frame_info.x=(ssize_t) frame_info.width; frame_info.y=(ssize_t) frame_info.height; frame_info.width=(*image)->columns+2*frame_info.width; frame_info.height=(*image)->rows+2*frame_info.height; mogrify_image=FrameImage(*image,&frame_info,compose,exception); break; } if (LocaleCompare("function",option+1) == 0) { char *arguments, token[MagickPathExtent]; const char *p; double *parameters; MagickFunction function; register ssize_t x; size_t number_parameters; /* Function Modify Image Values */ (void) SyncImageSettings(mogrify_info,*image,exception); function=(MagickFunction) ParseCommandOption(MagickFunctionOptions, MagickFalse,argv[i+1]); arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2], exception); if (arguments == (char *) NULL) break; p=(char *) arguments; for (x=0; *p != '\0'; x++) { GetNextToken(p,&p,MagickPathExtent,token); if (*token == ',') GetNextToken(p,&p,MagickPathExtent,token); } number_parameters=(size_t) x; parameters=(double *) AcquireQuantumMemory(number_parameters, sizeof(*parameters)); if (parameters == (double *) NULL) ThrowWandFatalException(ResourceLimitFatalError, "MemoryAllocationFailed",(*image)->filename); (void) memset(parameters,0,number_parameters* sizeof(*parameters)); p=(char *) arguments; for (x=0; (x < (ssize_t) number_parameters) && (*p != '\0'); x++) { GetNextToken(p,&p,MagickPathExtent,token); if (*token == ',') GetNextToken(p,&p,MagickPathExtent,token); parameters[x]=StringToDouble(token,(char **) NULL); } arguments=DestroyString(arguments); (void) FunctionImage(*image,function,number_parameters,parameters, exception); parameters=(double *) RelinquishMagickMemory(parameters); break; } break; } case 'g': { if (LocaleCompare("gamma",option+1) == 0) { /* Gamma image. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') (*image)->gamma=StringToDouble(argv[i+1],(char **) NULL); else (void) GammaImage(*image,StringToDouble(argv[i+1],(char **) NULL), exception); break; } if ((LocaleCompare("gaussian-blur",option+1) == 0) || (LocaleCompare("gaussian",option+1) == 0)) { /* Gaussian blur image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=GaussianBlurImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("geometry",option+1) == 0) { /* Record Image offset, Resize last image. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { if ((*image)->geometry != (char *) NULL) (*image)->geometry=DestroyString((*image)->geometry); break; } flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception); if (((flags & XValue) != 0) || ((flags & YValue) != 0)) (void) CloneString(&(*image)->geometry,argv[i+1]); else mogrify_image=ResizeImage(*image,geometry.width,geometry.height, (*image)->filter,exception); break; } if (LocaleCompare("gravity",option+1) == 0) { if (*option == '+') { draw_info->gravity=UndefinedGravity; break; } draw_info->gravity=(GravityType) ParseCommandOption( MagickGravityOptions,MagickFalse,argv[i+1]); break; } if (LocaleCompare("grayscale",option+1) == 0) { PixelIntensityMethod method; (void) SyncImageSettings(mogrify_info,*image,exception); method=(PixelIntensityMethod) ParseCommandOption( MagickPixelIntensityOptions,MagickFalse,argv[i+1]); (void) GrayscaleImage(*image,method,exception); break; } break; } case 'h': { if (LocaleCompare("highlight-color",option+1) == 0) { (void) SetImageArtifact(*image,"compare:highlight-color",argv[i+1]); break; } if (LocaleCompare("hough-lines",option+1) == 0) { /* Detect edges in the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; if ((flags & XiValue) == 0) geometry_info.xi=40; mogrify_image=HoughLineImage(*image,(size_t) geometry_info.rho, (size_t) geometry_info.sigma,(size_t) geometry_info.xi,exception); break; } break; } case 'i': { if (LocaleCompare("identify",option+1) == 0) { char *text; (void) SyncImageSettings(mogrify_info,*image,exception); if (format == (char *) NULL) { (void) IdentifyImage(*image,stdout,mogrify_info->verbose, exception); break; } text=InterpretImageProperties(mogrify_info,*image,format, exception); if (text == (char *) NULL) break; (void) fputs(text,stdout); text=DestroyString(text); break; } if (LocaleCompare("implode",option+1) == 0) { /* Implode image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGeometry(argv[i+1],&geometry_info); mogrify_image=ImplodeImage(*image,geometry_info.rho, interpolate_method,exception); break; } if (LocaleCompare("interline-spacing",option+1) == 0) { if (*option == '+') (void) ParseGeometry("0",&geometry_info); else (void) ParseGeometry(argv[i+1],&geometry_info); draw_info->interline_spacing=geometry_info.rho; break; } if (LocaleCompare("interpolate",option+1) == 0) { interpolate_method=(PixelInterpolateMethod) ParseCommandOption( MagickInterpolateOptions,MagickFalse,argv[i+1]); break; } if (LocaleCompare("interword-spacing",option+1) == 0) { if (*option == '+') (void) ParseGeometry("0",&geometry_info); else (void) ParseGeometry(argv[i+1],&geometry_info); draw_info->interword_spacing=geometry_info.rho; break; } if (LocaleCompare("interpolative-resize",option+1) == 0) { /* Interpolative resize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=InterpolativeResizeImage(*image,geometry.width, geometry.height,interpolate_method,exception); break; } break; } case 'k': { if (LocaleCompare("kerning",option+1) == 0) { if (*option == '+') (void) ParseGeometry("0",&geometry_info); else (void) ParseGeometry(argv[i+1],&geometry_info); draw_info->kerning=geometry_info.rho; break; } if (LocaleCompare("kuwahara",option+1) == 0) { /* Edge preserving blur. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho-0.5; mogrify_image=KuwaharaImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } break; } case 'l': { if (LocaleCompare("lat",option+1) == 0) { /* Local adaptive threshold image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & PercentValue) != 0) geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0; mogrify_image=AdaptiveThresholdImage(*image,(size_t) geometry_info.rho,(size_t) geometry_info.sigma,(double) geometry_info.xi,exception); break; } if (LocaleCompare("level",option+1) == 0) { double black_point, gamma, white_point; /* Parse levels. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); black_point=geometry_info.rho; white_point=(double) QuantumRange; if ((flags & SigmaValue) != 0) white_point=geometry_info.sigma; gamma=1.0; if ((flags & XiValue) != 0) gamma=geometry_info.xi; if ((flags & PercentValue) != 0) { black_point*=(double) (QuantumRange/100.0); white_point*=(double) (QuantumRange/100.0); } if ((flags & SigmaValue) == 0) white_point=(double) QuantumRange-black_point; if ((*option == '+') || ((flags & AspectValue) != 0)) (void) LevelizeImage(*image,black_point,white_point,gamma, exception); else (void) LevelImage(*image,black_point,white_point,gamma, exception); break; } if (LocaleCompare("level-colors",option+1) == 0) { char token[MagickPathExtent]; const char *p; PixelInfo black_point, white_point; p=(const char *) argv[i+1]; GetNextToken(p,&p,MagickPathExtent,token); /* get black point color */ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0)) (void) QueryColorCompliance(token,AllCompliance, &black_point,exception); else (void) QueryColorCompliance("#000000",AllCompliance, &black_point,exception); if (isalpha((int) token[0]) || (token[0] == '#')) GetNextToken(p,&p,MagickPathExtent,token); if (*token == '\0') white_point=black_point; /* set everything to that color */ else { if ((isalpha((int) *token) == 0) && ((*token == '#') == 0)) GetNextToken(p,&p,MagickPathExtent,token); /* Get white point color. */ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0)) (void) QueryColorCompliance(token,AllCompliance, &white_point,exception); else (void) QueryColorCompliance("#ffffff",AllCompliance, &white_point,exception); } (void) LevelImageColors(*image,&black_point,&white_point, *option == '+' ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("linear-stretch",option+1) == 0) { double black_point, white_point; (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); black_point=geometry_info.rho; white_point=(double) (*image)->columns*(*image)->rows; if ((flags & SigmaValue) != 0) white_point=geometry_info.sigma; if ((flags & PercentValue) != 0) { black_point*=(double) (*image)->columns*(*image)->rows/100.0; white_point*=(double) (*image)->columns*(*image)->rows/100.0; } if ((flags & SigmaValue) == 0) white_point=(double) (*image)->columns*(*image)->rows- black_point; (void) LinearStretchImage(*image,black_point,white_point,exception); break; } if (LocaleCompare("liquid-rescale",option+1) == 0) { /* Liquid rescale image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception); if ((flags & XValue) == 0) geometry.x=1; if ((flags & YValue) == 0) geometry.y=0; mogrify_image=LiquidRescaleImage(*image,geometry.width, geometry.height,1.0*geometry.x,1.0*geometry.y,exception); break; } if (LocaleCompare("local-contrast",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & RhoValue) == 0) geometry_info.rho=10; if ((flags & SigmaValue) == 0) geometry_info.sigma=12.5; mogrify_image=LocalContrastImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("lowlight-color",option+1) == 0) { (void) SetImageArtifact(*image,"compare:lowlight-color",argv[i+1]); break; } break; } case 'm': { if (LocaleCompare("magnify",option+1) == 0) { /* Double image size. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=MagnifyImage(*image,exception); break; } if (LocaleCompare("map",option+1) == 0) { Image *remap_image; /* Transform image colors to match this set of colors. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') break; remap_image=GetImageCache(mogrify_info,argv[i+1],exception); if (remap_image == (Image *) NULL) break; (void) RemapImage(quantize_info,*image,remap_image,exception); remap_image=DestroyImage(remap_image); break; } if (LocaleCompare("mask",option+1) == 0) { Image *mask; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { /* Remove a mask. */ (void) SetImageMask(*image,WritePixelMask,(Image *) NULL, exception); break; } /* Set the image mask. */ mask=GetImageCache(mogrify_info,argv[i+1],exception); if (mask == (Image *) NULL) break; (void) SetImageMask(*image,WritePixelMask,mask,exception); mask=DestroyImage(mask); break; } if (LocaleCompare("matte",option+1) == 0) { (void) SetImageAlphaChannel(*image,(*option == '-') ? SetAlphaChannel : DeactivateAlphaChannel,exception); break; } if (LocaleCompare("mean-shift",option+1) == 0) { /* Detect edges in the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; if ((flags & XiValue) == 0) geometry_info.xi=0.10*QuantumRange; if ((flags & PercentValue) != 0) geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0; mogrify_image=MeanShiftImage(*image,(size_t) geometry_info.rho, (size_t) geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("median",option+1) == 0) { /* Median filter image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; mogrify_image=StatisticImage(*image,MedianStatistic,(size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception); break; } if (LocaleCompare("mode",option+1) == 0) { /* Mode image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; mogrify_image=StatisticImage(*image,ModeStatistic,(size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception); break; } if (LocaleCompare("modulate",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) ModulateImage(*image,argv[i+1],exception); break; } if (LocaleCompare("moments",option+1) == 0) { if (*option == '+') { (void) DeleteImageArtifact(*image,"identify:moments"); break; } (void) SetImageArtifact(*image,"identify:moments",argv[i+1]); (void) SetImageArtifact(*image,"verbose","true"); break; } if (LocaleCompare("monitor",option+1) == 0) { if (*option == '+') { (void) SetImageProgressMonitor(*image, (MagickProgressMonitor) NULL,(void *) NULL); break; } (void) SetImageProgressMonitor(*image,MonitorProgress, (void *) NULL); break; } if (LocaleCompare("monochrome",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) SetImageType(*image,BilevelType,exception); break; } if (LocaleCompare("morphology",option+1) == 0) { char token[MagickPathExtent]; const char *p; KernelInfo *kernel; MorphologyMethod method; ssize_t iterations; /* Morphological Image Operation */ (void) SyncImageSettings(mogrify_info,*image,exception); p=argv[i+1]; GetNextToken(p,&p,MagickPathExtent,token); method=(MorphologyMethod) ParseCommandOption( MagickMorphologyOptions,MagickFalse,token); iterations=1L; GetNextToken(p,&p,MagickPathExtent,token); if ((*p == ':') || (*p == ',')) GetNextToken(p,&p,MagickPathExtent,token); if ((*p != '\0')) iterations=(ssize_t) StringToLong(p); kernel=AcquireKernelInfo(argv[i+2],exception); if (kernel == (KernelInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError,"UnabletoParseKernel","morphology"); status=MagickFalse; break; } mogrify_image=MorphologyImage(*image,method,iterations,kernel, exception); kernel=DestroyKernelInfo(kernel); break; } if (LocaleCompare("motion-blur",option+1) == 0) { /* Motion blur image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=MotionBlurImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,exception); break; } break; } case 'n': { if (LocaleCompare("negate",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) NegateImage(*image,*option == '+' ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("noise",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '-') { flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; mogrify_image=StatisticImage(*image,NonpeakStatistic,(size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception); } else { NoiseType noise; noise=(NoiseType) ParseCommandOption(MagickNoiseOptions, MagickFalse,argv[i+1]); mogrify_image=AddNoiseImage(*image,noise,attenuate,exception); } break; } if (LocaleCompare("normalize",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) NormalizeImage(*image,exception); break; } break; } case 'o': { if (LocaleCompare("opaque",option+1) == 0) { PixelInfo target; (void) SyncImageSettings(mogrify_info,*image,exception); (void) QueryColorCompliance(argv[i+1],AllCompliance,&target, exception); (void) OpaquePaintImage(*image,&target,&fill,*option == '-' ? MagickFalse : MagickTrue,exception); break; } if (LocaleCompare("ordered-dither",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) OrderedDitherImage(*image,argv[i+1],exception); break; } break; } case 'p': { if (LocaleCompare("paint",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGeometry(argv[i+1],&geometry_info); mogrify_image=OilPaintImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("perceptible",option+1) == 0) { /* Perceptible image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) PerceptibleImage(*image,StringToDouble(argv[i+1], (char **) NULL),exception); break; } if (LocaleCompare("pointsize",option+1) == 0) { if (*option == '+') (void) ParseGeometry("12",&geometry_info); else (void) ParseGeometry(argv[i+1],&geometry_info); draw_info->pointsize=geometry_info.rho; break; } if (LocaleCompare("polaroid",option+1) == 0) { const char *caption; double angle; RandomInfo *random_info; /* Simulate a Polaroid picture. */ (void) SyncImageSettings(mogrify_info,*image,exception); random_info=AcquireRandomInfo(); angle=22.5*(GetPseudoRandomValue(random_info)-0.5); random_info=DestroyRandomInfo(random_info); if (*option == '-') { SetGeometryInfo(&geometry_info); flags=ParseGeometry(argv[i+1],&geometry_info); angle=geometry_info.rho; } caption=GetImageProperty(*image,"caption",exception); mogrify_image=PolaroidImage(*image,draw_info,caption,angle, interpolate_method,exception); break; } if (LocaleCompare("posterize",option+1) == 0) { /* Posterize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) PosterizeImage(*image,StringToUnsignedLong(argv[i+1]), quantize_info->dither_method,exception); break; } if (LocaleCompare("preview",option+1) == 0) { PreviewType preview_type; /* Preview image. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') preview_type=UndefinedPreview; else preview_type=(PreviewType) ParseCommandOption( MagickPreviewOptions,MagickFalse,argv[i+1]); mogrify_image=PreviewImage(*image,preview_type,exception); break; } if (LocaleCompare("profile",option+1) == 0) { const char *name; const StringInfo *profile; Image *profile_image; ImageInfo *profile_info; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { /* Remove a profile from the image. */ (void) ProfileImage(*image,argv[i+1],(const unsigned char *) NULL,0,exception); break; } /* Associate a profile with the image. */ profile_info=CloneImageInfo(mogrify_info); profile=GetImageProfile(*image,"iptc"); if (profile != (StringInfo *) NULL) profile_info->profile=(void *) CloneStringInfo(profile); profile_image=GetImageCache(profile_info,argv[i+1],exception); profile_info=DestroyImageInfo(profile_info); if (profile_image == (Image *) NULL) { StringInfo *file_data; profile_info=CloneImageInfo(mogrify_info); (void) CopyMagickString(profile_info->filename,argv[i+1], MagickPathExtent); file_data=FileToStringInfo(profile_info->filename,~0UL, exception); if (file_data != (StringInfo *) NULL) { (void) SetImageInfo(profile_info,0,exception); (void) ProfileImage(*image,profile_info->magick, GetStringInfoDatum(file_data), GetStringInfoLength(file_data),exception); file_data=DestroyStringInfo(file_data); } profile_info=DestroyImageInfo(profile_info); break; } ResetImageProfileIterator(profile_image); name=GetNextImageProfile(profile_image); while (name != (const char *) NULL) { profile=GetImageProfile(profile_image,name); if (profile != (StringInfo *) NULL) (void) ProfileImage(*image,name,GetStringInfoDatum(profile), (size_t) GetStringInfoLength(profile),exception); name=GetNextImageProfile(profile_image); } profile_image=DestroyImage(profile_image); break; } break; } case 'q': { if (LocaleCompare("quantize",option+1) == 0) { if (*option == '+') { quantize_info->colorspace=UndefinedColorspace; break; } quantize_info->colorspace=(ColorspaceType) ParseCommandOption( MagickColorspaceOptions,MagickFalse,argv[i+1]); break; } break; } case 'r': { if (LocaleCompare("rotational-blur",option+1) == 0) { /* Rotational blur image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); mogrify_image=RotationalBlurImage(*image,geometry_info.rho, exception); break; } if (LocaleCompare("raise",option+1) == 0) { /* Surround image with a raise of solid color. */ flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception); (void) RaiseImage(*image,&geometry,*option == '-' ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("random-threshold",option+1) == 0) { /* Random threshold image. */ double min_threshold, max_threshold; (void) SyncImageSettings(mogrify_info,*image,exception); min_threshold=0.0; max_threshold=(double) QuantumRange; flags=ParseGeometry(argv[i+1],&geometry_info); min_threshold=geometry_info.rho; max_threshold=geometry_info.sigma; if ((flags & SigmaValue) == 0) max_threshold=min_threshold; if (strchr(argv[i+1],'%') != (char *) NULL) { max_threshold*=(double) (0.01*QuantumRange); min_threshold*=(double) (0.01*QuantumRange); } (void) RandomThresholdImage(*image,min_threshold,max_threshold, exception); break; } if (LocaleCompare("range-threshold",option+1) == 0) { /* Range threshold image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; if ((flags & XiValue) == 0) geometry_info.xi=geometry_info.sigma; if ((flags & PsiValue) == 0) geometry_info.psi=geometry_info.xi; if (strchr(argv[i+1],'%') != (char *) NULL) { geometry_info.rho*=(double) (0.01*QuantumRange); geometry_info.sigma*=(double) (0.01*QuantumRange); geometry_info.xi*=(double) (0.01*QuantumRange); geometry_info.psi*=(double) (0.01*QuantumRange); } (void) RangeThresholdImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception); break; } if (LocaleCompare("read-mask",option+1) == 0) { Image *mask; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { /* Remove a mask. */ (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL, exception); break; } /* Set the image mask. */ mask=GetImageCache(mogrify_info,argv[i+1],exception); if (mask == (Image *) NULL) break; (void) SetImageMask(*image,ReadPixelMask,mask,exception); mask=DestroyImage(mask); break; } if (LocaleCompare("region",option+1) == 0) { /* Apply read mask as defined by a region geometry. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { (void) SetImageRegionMask(*image,WritePixelMask, (const RectangleInfo *) NULL,exception); break; } (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception); (void) SetImageRegionMask(*image,WritePixelMask,&geometry, exception); break; } if (LocaleCompare("render",option+1) == 0) { (void) SyncImageSettings(mogrify_info,*image,exception); draw_info->render=(*option == '+') ? MagickTrue : MagickFalse; break; } if (LocaleCompare("remap",option+1) == 0) { Image *remap_image; /* Transform image colors to match this set of colors. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') break; remap_image=GetImageCache(mogrify_info,argv[i+1],exception); if (remap_image == (Image *) NULL) break; (void) RemapImage(quantize_info,*image,remap_image,exception); remap_image=DestroyImage(remap_image); break; } if (LocaleCompare("repage",option+1) == 0) { if (*option == '+') { (void) ParseAbsoluteGeometry("0x0+0+0",&(*image)->page); break; } (void) ResetImagePage(*image,argv[i+1]); break; } if (LocaleCompare("resample",option+1) == 0) { /* Resample image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; mogrify_image=ResampleImage(*image,geometry_info.rho, geometry_info.sigma,(*image)->filter,exception); break; } if (LocaleCompare("resize",option+1) == 0) { /* Resize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=ResizeImage(*image,geometry.width,geometry.height, (*image)->filter,exception); break; } if (LocaleCompare("roll",option+1) == 0) { /* Roll image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception); if ((flags & PercentValue) != 0) { geometry.x*=(double) (*image)->columns/100.0; geometry.y*=(double) (*image)->rows/100.0; } mogrify_image=RollImage(*image,geometry.x,geometry.y,exception); break; } if (LocaleCompare("rotate",option+1) == 0) { char *rotation; /* Check for conditional image rotation. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (strchr(argv[i+1],'>') != (char *) NULL) if ((*image)->columns <= (*image)->rows) break; if (strchr(argv[i+1],'<') != (char *) NULL) if ((*image)->columns >= (*image)->rows) break; /* Rotate image. */ rotation=ConstantString(argv[i+1]); (void) SubstituteString(&rotation,">",""); (void) SubstituteString(&rotation,"<",""); (void) ParseGeometry(rotation,&geometry_info); rotation=DestroyString(rotation); mogrify_image=RotateImage(*image,geometry_info.rho,exception); break; } break; } case 's': { if (LocaleCompare("sample",option+1) == 0) { /* Sample image with pixel replication. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=SampleImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("scale",option+1) == 0) { /* Resize image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=ScaleImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("selective-blur",option+1) == 0) { /* Selectively blur pixels within a contrast threshold. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & PercentValue) != 0) geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0; mogrify_image=SelectiveBlurImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("separate",option+1) == 0) { /* Break channels into separate images. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=SeparateImages(*image,exception); break; } if (LocaleCompare("sepia-tone",option+1) == 0) { double threshold; /* Sepia-tone image. */ (void) SyncImageSettings(mogrify_info,*image,exception); threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+ 1.0); mogrify_image=SepiaToneImage(*image,threshold,exception); break; } if (LocaleCompare("segment",option+1) == 0) { /* Segment image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; (void) SegmentImage(*image,(*image)->colorspace, mogrify_info->verbose,geometry_info.rho,geometry_info.sigma, exception); break; } if (LocaleCompare("set",option+1) == 0) { char *value; /* Set image option. */ if (*option == '+') { if (LocaleNCompare(argv[i+1],"registry:",9) == 0) (void) DeleteImageRegistry(argv[i+1]+9); else if (LocaleNCompare(argv[i+1],"option:",7) == 0) { (void) DeleteImageOption(mogrify_info,argv[i+1]+7); (void) DeleteImageArtifact(*image,argv[i+1]+7); } else (void) DeleteImageProperty(*image,argv[i+1]); break; } value=InterpretImageProperties(mogrify_info,*image,argv[i+2], exception); if (value == (char *) NULL) break; if (LocaleNCompare(argv[i+1],"registry:",9) == 0) (void) SetImageRegistry(StringRegistryType,argv[i+1]+9,value, exception); else if (LocaleNCompare(argv[i+1],"option:",7) == 0) { (void) SetImageOption(image_info,argv[i+1]+7,value); (void) SetImageOption(mogrify_info,argv[i+1]+7,value); (void) SetImageArtifact(*image,argv[i+1]+7,value); } else (void) SetImageProperty(*image,argv[i+1],value,exception); value=DestroyString(value); break; } if (LocaleCompare("shade",option+1) == 0) { /* Shade image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=ShadeImage(*image,(*option == '-') ? MagickTrue : MagickFalse,geometry_info.rho,geometry_info.sigma,exception); break; } if (LocaleCompare("shadow",option+1) == 0) { /* Shadow image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=4.0; if ((flags & PsiValue) == 0) geometry_info.psi=4.0; mogrify_image=ShadowImage(*image,geometry_info.rho, geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5), (ssize_t) ceil(geometry_info.psi-0.5),exception); break; } if (LocaleCompare("sharpen",option+1) == 0) { /* Sharpen image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=0.0; mogrify_image=SharpenImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("shave",option+1) == 0) { /* Shave the image edges. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=ShaveImage(*image,&geometry,exception); break; } if (LocaleCompare("shear",option+1) == 0) { /* Shear image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; mogrify_image=ShearImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("sigmoidal-contrast",option+1) == 0) { /* Sigmoidal non-linearity contrast control. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=(double) QuantumRange/2.0; if ((flags & PercentValue) != 0) geometry_info.sigma=(double) QuantumRange*geometry_info.sigma/ 100.0; (void) SigmoidalContrastImage(*image,(*option == '-') ? MagickTrue : MagickFalse,geometry_info.rho,geometry_info.sigma, exception); break; } if (LocaleCompare("sketch",option+1) == 0) { /* Sketch image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=SketchImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,exception); break; } if (LocaleCompare("solarize",option+1) == 0) { double threshold; (void) SyncImageSettings(mogrify_info,*image,exception); threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+ 1.0); (void) SolarizeImage(*image,threshold,exception); break; } if (LocaleCompare("sparse-color",option+1) == 0) { SparseColorMethod method; char *arguments; /* Sparse Color Interpolated Gradient */ (void) SyncImageSettings(mogrify_info,*image,exception); method=(SparseColorMethod) ParseCommandOption( MagickSparseColorOptions,MagickFalse,argv[i+1]); arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2], exception); if (arguments == (char *) NULL) break; mogrify_image=SparseColorOption(*image,method,arguments, option[0] == '+' ? MagickTrue : MagickFalse,exception); arguments=DestroyString(arguments); break; } if (LocaleCompare("splice",option+1) == 0) { /* Splice a solid color into the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=SpliceImage(*image,&geometry,exception); break; } if (LocaleCompare("spread",option+1) == 0) { /* Spread an image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGeometry(argv[i+1],&geometry_info); mogrify_image=SpreadImage(*image,interpolate_method, geometry_info.rho,exception); break; } if (LocaleCompare("statistic",option+1) == 0) { StatisticType type; (void) SyncImageSettings(mogrify_info,*image,exception); type=(StatisticType) ParseCommandOption(MagickStatisticOptions, MagickFalse,argv[i+1]); (void) ParseGeometry(argv[i+2],&geometry_info); mogrify_image=StatisticImage(*image,type,(size_t) geometry_info.rho, (size_t) geometry_info.sigma,exception); break; } if (LocaleCompare("stretch",option+1) == 0) { if (*option == '+') { draw_info->stretch=UndefinedStretch; break; } draw_info->stretch=(StretchType) ParseCommandOption( MagickStretchOptions,MagickFalse,argv[i+1]); break; } if (LocaleCompare("strip",option+1) == 0) { /* Strip image of profiles and comments. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) StripImage(*image,exception); break; } if (LocaleCompare("stroke",option+1) == 0) { ExceptionInfo *sans; PixelInfo color; if (*option == '+') { (void) QueryColorCompliance("none",AllCompliance, &draw_info->stroke,exception); if (draw_info->stroke_pattern != (Image *) NULL) draw_info->stroke_pattern=DestroyImage( draw_info->stroke_pattern); break; } sans=AcquireExceptionInfo(); status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->stroke_pattern=GetImageCache(mogrify_info,argv[i+1], exception); else draw_info->stroke=color; break; } if (LocaleCompare("strokewidth",option+1) == 0) { draw_info->stroke_width=StringToDouble(argv[i+1],(char **) NULL); break; } if (LocaleCompare("style",option+1) == 0) { if (*option == '+') { draw_info->style=UndefinedStyle; break; } draw_info->style=(StyleType) ParseCommandOption(MagickStyleOptions, MagickFalse,argv[i+1]); break; } if (LocaleCompare("swirl",option+1) == 0) { /* Swirl image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseGeometry(argv[i+1],&geometry_info); mogrify_image=SwirlImage(*image,geometry_info.rho, interpolate_method,exception); break; } break; } case 't': { if (LocaleCompare("threshold",option+1) == 0) { double threshold; /* Threshold image. */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') threshold=(double) QuantumRange/2; else threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+ 1.0); (void) BilevelImage(*image,threshold,exception); break; } if (LocaleCompare("thumbnail",option+1) == 0) { /* Thumbnail image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=ThumbnailImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("tile",option+1) == 0) { if (*option == '+') { if (draw_info->fill_pattern != (Image *) NULL) draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); break; } draw_info->fill_pattern=GetImageCache(mogrify_info,argv[i+1], exception); break; } if (LocaleCompare("tint",option+1) == 0) { /* Tint the image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=TintImage(*image,argv[i+1],&fill,exception); break; } if (LocaleCompare("transform",option+1) == 0) { /* Affine transform image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=AffineTransformImage(*image,&draw_info->affine, exception); break; } if (LocaleCompare("transparent",option+1) == 0) { PixelInfo target; (void) SyncImageSettings(mogrify_info,*image,exception); (void) QueryColorCompliance(argv[i+1],AllCompliance,&target, exception); (void) TransparentPaintImage(*image,&target,(Quantum) TransparentAlpha,*option == '-' ? MagickFalse : MagickTrue, exception); break; } if (LocaleCompare("transpose",option+1) == 0) { /* Transpose image scanlines. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=TransposeImage(*image,exception); break; } if (LocaleCompare("transverse",option+1) == 0) { /* Transverse image scanlines. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=TransverseImage(*image,exception); break; } if (LocaleCompare("treedepth",option+1) == 0) { quantize_info->tree_depth=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare("trim",option+1) == 0) { /* Trim image. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=TrimImage(*image,exception); break; } if (LocaleCompare("type",option+1) == 0) { ImageType type; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') type=UndefinedType; else type=(ImageType) ParseCommandOption(MagickTypeOptions,MagickFalse, argv[i+1]); (*image)->type=UndefinedType; (void) SetImageType(*image,type,exception); break; } break; } case 'u': { if (LocaleCompare("undercolor",option+1) == 0) { (void) QueryColorCompliance(argv[i+1],AllCompliance, &draw_info->undercolor,exception); break; } if (LocaleCompare("unique",option+1) == 0) { if (*option == '+') { (void) DeleteImageArtifact(*image,"identify:unique-colors"); break; } (void) SetImageArtifact(*image,"identify:unique-colors","true"); (void) SetImageArtifact(*image,"verbose","true"); break; } if (LocaleCompare("unique-colors",option+1) == 0) { /* Unique image colors. */ (void) SyncImageSettings(mogrify_info,*image,exception); mogrify_image=UniqueImageColors(*image,exception); break; } if (LocaleCompare("unsharp",option+1) == 0) { /* Unsharp mask image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=1.0; if ((flags & PsiValue) == 0) geometry_info.psi=0.05; mogrify_image=UnsharpMaskImage(*image,geometry_info.rho, geometry_info.sigma,geometry_info.xi,geometry_info.psi, exception); break; } break; } case 'v': { if (LocaleCompare("verbose",option+1) == 0) { (void) SetImageArtifact(*image,option+1, *option == '+' ? "false" : "true"); break; } if (LocaleCompare("vignette",option+1) == 0) { /* Vignette image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) geometry_info.xi=0.1*(*image)->columns; if ((flags & PsiValue) == 0) geometry_info.psi=0.1*(*image)->rows; if ((flags & PercentValue) != 0) { geometry_info.xi*=(double) (*image)->columns/100.0; geometry_info.psi*=(double) (*image)->rows/100.0; } mogrify_image=VignetteImage(*image,geometry_info.rho, geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5), (ssize_t) ceil(geometry_info.psi-0.5),exception); break; } if (LocaleCompare("virtual-pixel",option+1) == 0) { if (*option == '+') { (void) SetImageVirtualPixelMethod(*image, UndefinedVirtualPixelMethod,exception); break; } (void) SetImageVirtualPixelMethod(*image,(VirtualPixelMethod) ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, argv[i+1]),exception); break; } break; } case 'w': { if (LocaleCompare("wave",option+1) == 0) { /* Wave image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; mogrify_image=WaveImage(*image,geometry_info.rho, geometry_info.sigma,interpolate_method,exception); break; } if (LocaleCompare("wavelet-denoise",option+1) == 0) { /* Wavelet denoise image. */ (void) SyncImageSettings(mogrify_info,*image,exception); flags=ParseGeometry(argv[i+1],&geometry_info); if ((flags & PercentValue) != 0) { geometry_info.rho=QuantumRange*geometry_info.rho/100.0; geometry_info.sigma=QuantumRange*geometry_info.sigma/100.0; } if ((flags & SigmaValue) == 0) geometry_info.sigma=0.0; mogrify_image=WaveletDenoiseImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("weight",option+1) == 0) { ssize_t weight; weight=ParseCommandOption(MagickWeightOptions,MagickFalse, argv[i+1]); if (weight == -1) weight=(ssize_t) StringToUnsignedLong(argv[i+1]); draw_info->weight=(size_t) weight; break; } if (LocaleCompare("white-threshold",option+1) == 0) { /* White threshold image. */ (void) SyncImageSettings(mogrify_info,*image,exception); (void) WhiteThresholdImage(*image,argv[i+1],exception); break; } if (LocaleCompare("write-mask",option+1) == 0) { Image *mask; (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { /* Remove a mask. */ (void) SetImageMask(*image,WritePixelMask,(Image *) NULL, exception); break; } /* Set the image mask. */ mask=GetImageCache(mogrify_info,argv[i+1],exception); if (mask == (Image *) NULL) break; (void) SetImageMask(*image,WritePixelMask,mask,exception); mask=DestroyImage(mask); break; } break; } default: break; } /* Replace current image with any image that was generated */ if (mogrify_image != (Image *) NULL) ReplaceImageInListReturnLast(image,mogrify_image); i+=count; } /* Free resources. */ quantize_info=DestroyQuantizeInfo(quantize_info); draw_info=DestroyDrawInfo(draw_info); mogrify_info=DestroyImageInfo(mogrify_info); status=(MagickStatusType) (exception->severity < ErrorException ? 1 : 0); return(status == 0 ? MagickFalse : MagickTrue); }
0
192,652
void RenderFrameHostImpl::OnScrollRectToVisibleInParentFrame( const gfx::Rect& rect_to_scroll, const blink::WebScrollIntoViewParams& params) { RenderFrameProxyHost* proxy = frame_tree_node_->render_manager()->GetProxyToParent(); if (!proxy) return; proxy->ScrollRectToVisible(rect_to_scroll, params); }
0
314,882
static int req_escape_html(lua_State *L) { request_rec *r = ap_lua_check_request_rec(L, 1); const char *s = luaL_checkstring(L, 2); lua_pushstring(L, ap_escape_html(r->pool, s)); return 1; }
0
407,963
TEST(MessageCompressorManager, BadCompressionRequested) { auto input = BSON("isMaster" << 1 << "compression" << BSON_ARRAY("fakecompressor")); checkServerNegotiation(input, {}); }
0
157,793
static int can_handle_new_request(RADIUS_PACKET *packet, RADCLIENT *client, struct main_config_t *root) { /* * Count the total number of requests, to see if * there are too many. If so, return with an * error. */ if (root->max_requests) { int request_count = fr_packet_list_num_elements(pl); /* * This is a new request. Let's see if * it makes us go over our configured * bounds. */ if (request_count > root->max_requests) { radlog(L_ERR, "Dropping request (%d is too many): " "from client %s port %d - ID: %d", request_count, client->shortname, packet->src_port, packet->id); radlog(L_INFO, "WARNING: Please check the configuration file.\n" "\tThe value for 'max_requests' is probably set too low.\n"); return 0; } /* else there were a small number of requests */ } /* else there was no configured limit for requests */ /* * FIXME: Add per-client checks. If one client is sending * too many packets, start discarding them. * * We increment the counters here, and decrement them * when the response is sent... somewhere in this file. */ /* * FUTURE: Add checks for system load. If the system is * busy, start dropping requests... * * We can probably keep some statistics ourselves... if * there are more requests coming in than we can handle, * start dropping some. */ return 1; }
0
20,909
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack ) ; DECL_PIOCTL ( PNewCell ) ; DECL_PIOCTL ( PNewAlias ) ; DECL_PIOCTL ( PListCells ) ; DECL_PIOCTL ( PListAliases ) ; DECL_PIOCTL ( PRemoveMount ) ; DECL_PIOCTL ( PGetCellStatus ) ; DECL_PIOCTL ( PSetCellStatus ) ; DECL_PIOCTL ( PFlushVolumeData ) ; DECL_PIOCTL ( PFlushAllVolumeData ) ; DECL_PIOCTL ( PGetVnodeXStatus ) ; DECL_PIOCTL ( PGetVnodeXStatus2 ) ; DECL_PIOCTL ( PSetSysName ) ; DECL_PIOCTL ( PSetSPrefs ) ; DECL_PIOCTL ( PSetSPrefs33 ) ; DECL_PIOCTL ( PGetSPrefs ) ; DECL_PIOCTL ( PExportAfs ) ; DECL_PIOCTL ( PGag ) ; DECL_PIOCTL ( PTwiddleRx ) ; DECL_PIOCTL ( PGetInitParams ) ; DECL_PIOCTL ( PGetRxkcrypt ) ; DECL_PIOCTL ( PSetRxkcrypt ) ; DECL_PIOCTL ( PGetCPrefs ) ; DECL_PIOCTL ( PSetCPrefs ) ; DECL_PIOCTL ( PFlushMount ) ; DECL_PIOCTL ( PRxStatProc )
0
86,816
GF_Err tpyl_box_read(GF_Box *s, GF_BitStream *bs) { GF_NTYLBox *ptr = (GF_NTYLBox *)s; if (ptr == NULL) return GF_BAD_PARAM; ISOM_DECREASE_SIZE(ptr, 8); ptr->nbBytes = gf_bs_read_u64(bs); return GF_OK; }
0
69,152
static inline wchar_t vfat_bad_char(wchar_t w) { return (w < 0x0020) || (w == '*') || (w == '?') || (w == '<') || (w == '>') || (w == '|') || (w == '"') || (w == ':') || (w == '/') || (w == '\\'); }
0
177,709
static int handle_pal_call(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { struct exit_ctl_data *p; p = kvm_get_exit_data(vcpu); if (p->exit_reason == EXIT_REASON_PAL_CALL) return kvm_pal_emul(vcpu, kvm_run); else { kvm_run->exit_reason = KVM_EXIT_UNKNOWN; kvm_run->hw.hardware_exit_reason = 2; return 0; } }
0
279,870
static void spl_array_set_array(zval *object, spl_array_object *intern, zval **array, long ar_flags, int just_array TSRMLS_DC) { if (Z_TYPE_PP(array) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array); } if (Z_TYPE_PP(array) == IS_OBJECT && (Z_OBJ_HT_PP(array) == &spl_handler_ArrayObject || Z_OBJ_HT_PP(array) == &spl_handler_ArrayIterator)) { zval_ptr_dtor(&intern->array); if (just_array) { spl_array_object *other = (spl_array_object*)zend_object_store_get_object(*array TSRMLS_CC); ar_flags = other->ar_flags & ~SPL_ARRAY_INT_MASK; } ar_flags |= SPL_ARRAY_USE_OTHER; intern->array = *array; } else { if (Z_TYPE_PP(array) != IS_OBJECT && Z_TYPE_PP(array) != IS_ARRAY) { zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); return; } zval_ptr_dtor(&intern->array); intern->array = *array; } if (object == *array) { intern->ar_flags |= SPL_ARRAY_IS_SELF; intern->ar_flags &= ~SPL_ARRAY_USE_OTHER; } else { intern->ar_flags &= ~SPL_ARRAY_IS_SELF; } intern->ar_flags |= ar_flags; Z_ADDREF_P(intern->array); if (Z_TYPE_PP(array) == IS_OBJECT) { zend_object_get_properties_t handler = Z_OBJ_HANDLER_PP(array, get_properties); if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_PP(array)->name, intern->std.ce->name); } } spl_array_rewind(intern TSRMLS_CC); }
0
491,358
find_cu_tu_set_v2 (dwarf_vma cu_offset, int do_types) { struct cu_tu_set *p; unsigned int nsets; unsigned int dw_sect; if (do_types) { p = tu_sets; nsets = tu_count; dw_sect = DW_SECT_TYPES; } else { p = cu_sets; nsets = cu_count; dw_sect = DW_SECT_INFO; } while (nsets > 0) { if (p->section_offsets [dw_sect] == cu_offset) return p; p++; nsets--; } return NULL; }
0
356,640
submit_page_section(struct dio *dio, struct page *page, unsigned offset, unsigned len, sector_t blocknr) { int ret = 0; if (dio->rw & WRITE) { /* * Read accounting is performed in submit_bio() */ task_io_account_write(len); } /* * Can we just grow the current page's presence in the dio? */ if ( (dio->cur_page == page) && (dio->cur_page_offset + dio->cur_page_len == offset) && (dio->cur_page_block + (dio->cur_page_len >> dio->blkbits) == blocknr)) { dio->cur_page_len += len; /* * If dio->boundary then we want to schedule the IO now to * avoid metadata seeks. */ if (dio->boundary) { ret = dio_send_cur_page(dio); page_cache_release(dio->cur_page); dio->cur_page = NULL; } goto out; } /* * If there's a deferred page already there then send it. */ if (dio->cur_page) { ret = dio_send_cur_page(dio); page_cache_release(dio->cur_page); dio->cur_page = NULL; if (ret) goto out; } page_cache_get(page); /* It is in dio */ dio->cur_page = page; dio->cur_page_offset = offset; dio->cur_page_len = len; dio->cur_page_block = blocknr; out: return ret; }
0
151,661
static int xemaclite_open(struct net_device *dev) { struct net_local *lp = netdev_priv(dev); int retval; /* Just to be safe, stop the device first */ xemaclite_disable_interrupts(lp); if (lp->phy_node) { u32 bmcr; lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node, xemaclite_adjust_link, 0, PHY_INTERFACE_MODE_MII); if (!lp->phy_dev) { dev_err(&lp->ndev->dev, "of_phy_connect() failed\n"); return -ENODEV; } /* EmacLite doesn't support giga-bit speeds */ phy_set_max_speed(lp->phy_dev, SPEED_100); /* Don't advertise 1000BASE-T Full/Half duplex speeds */ phy_write(lp->phy_dev, MII_CTRL1000, 0); /* Advertise only 10 and 100mbps full/half duplex speeds */ phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL | ADVERTISE_CSMA); /* Restart auto negotiation */ bmcr = phy_read(lp->phy_dev, MII_BMCR); bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); phy_write(lp->phy_dev, MII_BMCR, bmcr); phy_start(lp->phy_dev); } /* Set the MAC address each time opened */ xemaclite_update_address(lp, dev->dev_addr); /* Grab the IRQ */ retval = request_irq(dev->irq, xemaclite_interrupt, 0, dev->name, dev); if (retval) { dev_err(&lp->ndev->dev, "Could not allocate interrupt %d\n", dev->irq); if (lp->phy_dev) phy_disconnect(lp->phy_dev); lp->phy_dev = NULL; return retval; } /* Enable Interrupts */ xemaclite_enable_interrupts(lp); /* We're ready to go */ netif_start_queue(dev); return 0; }
0
298,351
inline size_t StringData::heapSize() const { return isFlat() ? isRefCounted() ? MemoryManager::sizeIndex2Size(m_aux16) : size() + kStringOverhead : sizeof(StringData) + sizeof(Proxy); }
0
328,613
void tcg_region_reset_all(void) { unsigned int i; qemu_mutex_lock(&region.lock); region.current = 0; region.agg_size_full = 0; for (i = 0; i < n_tcg_ctxs; i++) { bool err = tcg_region_initial_alloc__locked(tcg_ctxs[i]); g_assert(!err); } qemu_mutex_unlock(&region.lock); }
0
267,739
void rand_initialize_disk(struct gendisk *disk) { struct timer_rand_state *state; /* * If kzalloc returns null, we just won't use that entropy * source. */ state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL); if (state) { state->last_time = INITIAL_JIFFIES; disk->random = state; } }
0
83,063
static int set_array_info(struct mddev *mddev, mdu_array_info_t *info) { if (info->raid_disks == 0) { /* just setting version number for superblock loading */ if (info->major_version < 0 || info->major_version >= ARRAY_SIZE(super_types) || super_types[info->major_version].name == NULL) { /* maybe try to auto-load a module? */ printk(KERN_INFO "md: superblock version %d not known\n", info->major_version); return -EINVAL; } mddev->major_version = info->major_version; mddev->minor_version = info->minor_version; mddev->patch_version = info->patch_version; mddev->persistent = !info->not_persistent; /* ensure mddev_put doesn't delete this now that there * is some minimal configuration. */ mddev->ctime = get_seconds(); return 0; } mddev->major_version = MD_MAJOR_VERSION; mddev->minor_version = MD_MINOR_VERSION; mddev->patch_version = MD_PATCHLEVEL_VERSION; mddev->ctime = get_seconds(); mddev->level = info->level; mddev->clevel[0] = 0; mddev->dev_sectors = 2 * (sector_t)info->size; mddev->raid_disks = info->raid_disks; /* don't set md_minor, it is determined by which /dev/md* was * openned */ if (info->state & (1<<MD_SB_CLEAN)) mddev->recovery_cp = MaxSector; else mddev->recovery_cp = 0; mddev->persistent = ! info->not_persistent; mddev->external = 0; mddev->layout = info->layout; mddev->chunk_sectors = info->chunk_size >> 9; mddev->max_disks = MD_SB_DISKS; if (mddev->persistent) mddev->flags = 0; set_bit(MD_CHANGE_DEVS, &mddev->flags); mddev->bitmap_info.default_offset = MD_SB_BYTES >> 9; mddev->bitmap_info.default_space = 64*2 - (MD_SB_BYTES >> 9); mddev->bitmap_info.offset = 0; mddev->reshape_position = MaxSector; /* * Generate a 128 bit UUID */ get_random_bytes(mddev->uuid, 16); mddev->new_level = mddev->level; mddev->new_chunk_sectors = mddev->chunk_sectors; mddev->new_layout = mddev->layout; mddev->delta_disks = 0; mddev->reshape_backwards = 0; return 0; }
0
421,360
eb_unreserve_vma(struct i915_vma *vma, unsigned int *flags) { if (!(*flags & __EXEC_OBJECT_HAS_PIN)) return; __eb_unreserve_vma(vma, *flags); *flags &= ~__EXEC_OBJECT_RESERVED; }
0
199,132
static void activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->activityLoggingForAllWorldsPerWorldBindingsVoidMethod(); }
0
304,010
static int set_tracer_option(struct trace_array *tr, char *cmp, int neg) { struct tracer *trace = tr->current_trace; struct tracer_flags *tracer_flags = trace->flags; struct tracer_opt *opts = NULL; int i; for (i = 0; tracer_flags->opts[i].name; i++) { opts = &tracer_flags->opts[i]; if (strcmp(cmp, opts->name) == 0) return __set_tracer_option(tr, trace->flags, opts, neg); } return -EINVAL; }
0
96,075
CModule::EModRet CModule::OnPrivCTCPMessage(CCTCPMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnPrivCTCP(Message.GetNick(), sText); Message.SetText(sText); return ret; }
0
499,147
static int sqfs_disk_read(__u32 block, __u32 nr_blocks, void *buf) { ulong ret; if (!ctxt.cur_dev) return -1; ret = blk_dread(ctxt.cur_dev, ctxt.cur_part_info.start + block, nr_blocks, buf); if (ret != nr_blocks) return -1; return ret; }
0
400,533
MagickExport const OptionInfo *GetCommandOptionInfo(const char *option) { register ssize_t i; for (i=0; CommandOptions[i].mnemonic != (char *) NULL; i++) if (LocaleCompare(option,CommandOptions[i].mnemonic) == 0) break; return(CommandOptions+i); }
0
218,436
void smp_br_process_pairing_command(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t* p = p_data->p_data; tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(p_cb->pairing_bda); SMP_TRACE_DEBUG("%s", __func__); /* rejecting BR pairing request over non-SC BR link */ if (!p_dev_rec->new_encryption_key_is_p256 && p_cb->role == HCI_ROLE_SLAVE) { tSMP_INT_DATA smp_int_data; smp_int_data.status = SMP_XTRANS_DERIVE_NOT_ALLOW; smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &smp_int_data); return; } /* erase all keys if it is slave proc pairing req*/ if (p_dev_rec && (p_cb->role == HCI_ROLE_SLAVE)) btm_sec_clear_ble_keys(p_dev_rec); p_cb->flags |= SMP_PAIR_FLAG_ENC_AFTER_PAIR; STREAM_TO_UINT8(p_cb->peer_io_caps, p); STREAM_TO_UINT8(p_cb->peer_oob_flag, p); STREAM_TO_UINT8(p_cb->peer_auth_req, p); STREAM_TO_UINT8(p_cb->peer_enc_size, p); STREAM_TO_UINT8(p_cb->peer_i_key, p); STREAM_TO_UINT8(p_cb->peer_r_key, p); if (smp_command_has_invalid_parameters(p_cb)) { tSMP_INT_DATA smp_int_data; smp_int_data.status = SMP_INVALID_PARAMETERS; smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &smp_int_data); return; } /* peer (master) started pairing sending Pairing Request */ /* or being master device always use received i/r key as keys to distribute */ p_cb->local_i_key = p_cb->peer_i_key; p_cb->local_r_key = p_cb->peer_r_key; if (p_cb->role == HCI_ROLE_SLAVE) { p_dev_rec->new_encryption_key_is_p256 = false; /* shortcut to skip Security Grant step */ p_cb->cb_evt = SMP_BR_KEYS_REQ_EVT; } else { /* Master receives pairing response */ SMP_TRACE_DEBUG( "%s master rcvs valid PAIRING RESPONSE." " Supposed to move to key distribution phase. ", __func__); } /* auth_req received via BR/EDR SM channel is set to 0, but everything derived/exchanged has to be saved */ p_cb->peer_auth_req |= SMP_AUTH_BOND; p_cb->loc_auth_req |= SMP_AUTH_BOND; }
0
308,977
static int storebuffer(int output, FILE *data) { char **buffer = (char **)data; unsigned char outc = (unsigned char)output; **buffer = outc; (*buffer)++; return outc; /* act like fputc() ! */ }
0
400,942
innodb_switch_mapping( /*==================*/ ENGINE_HANDLE* handle, /*!< in: Engine handle */ const void* cookie, /*!< in: connection cookie */ const char* name, /*!< in: full name contains table map name, and possible key value */ size_t* name_len, /*!< in/out: name length, out with length excludes the table map name */ bool has_prefix) /*!< in: whether the name has "@@" prefix */ { struct innodb_engine* innodb_eng = innodb_handle(handle); innodb_conn_data_t* conn_data; char new_name[KEY_MAX_LENGTH]; meta_cfg_info_t* meta_info = innodb_eng->meta_info; char* new_map_name; unsigned int new_map_name_len = 0; char* last; meta_cfg_info_t* new_meta_info; int sep_len = 0; if (has_prefix) { char* sep = NULL; assert(*name_len > 2 && name[0] == '@' && name[1] == '@'); assert(*name_len < KEY_MAX_LENGTH); memcpy(new_name, &name[2], (*name_len) - 2); new_name[*name_len - 2] = 0; GET_OPTION(meta_info, OPTION_ID_TBL_MAP_SEP, sep, sep_len); assert(sep_len > 0); new_map_name = strtok_r(new_name, sep, &last); if (new_map_name == NULL) { return(ENGINE_KEY_ENOENT); } new_map_name_len = strlen(new_map_name); } else { /* This is used in the "bind" command, and without the "@@" prefix. */ if (name == NULL) { return(ENGINE_KEY_ENOENT); } new_map_name = (char*) name; new_map_name_len = *name_len; } conn_data = innodb_eng->server.cookie->get_engine_specific(cookie); /* Check if we are getting the same configure setting as existing one */ if (conn_data && conn_data->conn_meta && (new_map_name_len == conn_data->conn_meta->col_info[CONTAINER_NAME].col_name_len) && (strcmp( new_map_name, conn_data->conn_meta->col_info[CONTAINER_NAME].col_name) == 0)) { goto get_key_name; } new_meta_info = innodb_config( new_map_name, new_map_name_len, &innodb_eng->meta_hash); if (!new_meta_info) { return(ENGINE_KEY_ENOENT); } /* Clean up the existing connection metadata if exists */ if (conn_data) { innodb_conn_clean_data(conn_data, false, false); /* Point to the new metadata */ conn_data->conn_meta = new_meta_info; } conn_data = innodb_conn_init(innodb_eng, cookie, CONN_MODE_NONE, 0, false, new_meta_info); assert(conn_data->conn_meta == new_meta_info); get_key_name: /* Now calculate name length exclude the table mapping name, this is the length for the remaining key portion */ if (has_prefix) { assert(*name_len >= strlen(new_map_name) + 2); if (*name_len >= strlen(new_map_name) + 2 + sep_len) { *name_len -= strlen(new_map_name) + 2 + sep_len; } else { /* the name does not even contain a delimiter, so there will be no keys either */ *name_len = 0; } } return(ENGINE_SUCCESS); }
0
432,153
static int snd_line6_impulse_period_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2000; return 0; }
0
439,647
bool matches(const Ref *idA, double m11A, double m12A, double m21A, double m22A) { return fontID == *idA && m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; }
0
131,021
ex_tabs(exarg_T *eap UNUSED) { tabpage_T *tp; win_T *wp; int tabcount = 1; msg_start(); msg_scroll = TRUE; for (tp = first_tabpage; tp != NULL && !got_int; tp = tp->tp_next) { msg_putchar('\n'); vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++); msg_outtrans_attr(IObuff, HL_ATTR(HLF_T)); out_flush(); /* output one line at a time */ ui_breakcheck(); if (tp == curtab) wp = firstwin; else wp = tp->tp_firstwin; for ( ; wp != NULL && !got_int; wp = wp->w_next) { msg_putchar('\n'); msg_putchar(wp == curwin ? '>' : ' '); msg_putchar(' '); msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' '); msg_putchar(' '); if (buf_spname(wp->w_buffer) != NULL) vim_strncpy(IObuff, buf_spname(wp->w_buffer), IOSIZE - 1); else home_replace(wp->w_buffer, wp->w_buffer->b_fname, IObuff, IOSIZE, TRUE); msg_outtrans(IObuff); out_flush(); /* output one line at a time */ ui_breakcheck(); } } }
0
162,495
void WebContentsImpl::IncrementCapturerCount() { DCHECK(!is_being_destroyed_); ++capturer_count_; DVLOG(1) << "There are now " << capturer_count_ << " capturing(s) of WebContentsImpl@" << this; }
0
348,107
int dns_read_name(unsigned char *buffer, unsigned char *bufend, unsigned char *name, char *destination, int dest_len, int *offset) { int nb_bytes = 0, n = 0; int label_len; unsigned char *reader = name; char *dest = destination; while (1) { /* Name compression is in use */ if ((*reader & 0xc0) == 0xc0) { /* Must point BEFORE current position */ if ((buffer + reader[1]) > reader) goto err; n = dns_read_name(buffer, bufend, buffer + reader[1], dest, dest_len - nb_bytes, offset); if (n == 0) goto err; dest += n; nb_bytes += n; goto out; } label_len = *reader; if (label_len == 0) goto out; /* Check if: * - we won't read outside the buffer * - there is enough place in the destination */ if ((reader + label_len >= bufend) || (nb_bytes + label_len >= dest_len)) goto err; /* +1 to take label len + label string */ label_len++; memcpy(dest, reader, label_len); dest += label_len; nb_bytes += label_len; reader += label_len; } out: /* offset computation: * parse from <name> until finding either NULL or a pointer "c0xx" */ reader = name; *offset = 0; while (reader < bufend) { if ((reader[0] & 0xc0) == 0xc0) { *offset += 2; break; } else if (*reader == 0) { *offset += 1; break; } *offset += 1; ++reader; } return nb_bytes; err: return 0; }
1
502,958
static void ReplaceIRINode(GF_Node *FromNode, GF_Node *old_node, GF_Node *newNode) { GF_ChildNodeItem *prev = NULL; GF_ChildNodeItem *child = ((SVG_Element *)FromNode)->children; while (child) { if (child->node != old_node) { prev = child; child = child->next; continue; } if (newNode) { child->node = newNode; } else { if (prev) prev->next = child->next; else ((SVG_Element *)FromNode)->children = child->next; gf_free(child); } break; } }
0
394,125
PHP_METHOD(Phar, offsetExists) { char *fname; int fname_len; phar_entry_info *entry; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) { return; } if (zend_hash_exists(&phar_obj->arc.archive->manifest, fname, (uint) fname_len)) { if (SUCCESS == zend_hash_find(&phar_obj->arc.archive->manifest, fname, (uint) fname_len, (void**)&entry)) { if (entry->is_deleted) { /* entry is deleted, but has not been flushed to disk yet */ RETURN_FALSE; } } if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) { /* none of these are real files, so they don't exist */ RETURN_FALSE; } RETURN_TRUE; } else { if (zend_hash_exists(&phar_obj->arc.archive->virtual_dirs, fname, (uint) fname_len)) { RETURN_TRUE; } RETURN_FALSE; } }
0
489,779
static void nhmldump_send_header(GF_NHMLDumpCtx *ctx) { GF_FilterPacket *dst_pck; char nhml[1024]; u32 size; u8 *output; const GF_PropertyValue *p; ctx->szRootName = "NHNTStream"; if (ctx->dims) { ctx->szRootName = "DIMSStream"; } if (!ctx->filep) { sprintf(nhml, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } /*write header*/ sprintf(nhml, "<%s version=\"1.0\" ", ctx->szRootName); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); NHML_PRINT_UINT(GF_PROP_PID_ID, NULL, "trackID") NHML_PRINT_UINT(GF_PROP_PID_TIMESCALE, NULL, "timeScale") p = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_IN_IOD); if (p && p->value.boolean) { sprintf(nhml, "inRootOD=\"yes\" "); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } if (ctx->oti && (ctx->oti<GF_CODECID_LAST_MPEG4_MAPPING)) { sprintf(nhml, "streamType=\"%d\" objectTypeIndication=\"%d\" ", ctx->streamtype, ctx->oti); gf_bs_write_data(ctx->bs_w, nhml, (u32)strlen(nhml)); } else { p = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_SUBTYPE); if (p) { sprintf(nhml, "%s=\"%s\" ", "mediaType", gf_4cc_to_str(p->value.uint)); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); NHML_PRINT_4CC(GF_PROP_PID_ISOM_SUBTYPE, "mediaSubType", "mediaSubType") } else { NHML_PRINT_4CC(GF_PROP_PID_CODECID, NULL, "codecID") } } if (ctx->w && ctx->h) { //compatibility with old arch, we might want to remove this switch (ctx->streamtype) { case GF_STREAM_VISUAL: case GF_STREAM_SCENE: sprintf(nhml, "width=\"%d\" height=\"%d\" ", ctx->w, ctx->h); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); break; default: break; } } else if (ctx->sr && ctx->chan) { sprintf(nhml, "sampleRate=\"%d\" numChannels=\"%d\" ", ctx->sr, ctx->chan); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); p = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_AUDIO_FORMAT); if (p) { sprintf(nhml, "bitsPerSample=\"%d\" ", gf_audio_fmt_bit_depth(p->value.uint)); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } } NHML_PRINT_4CC(0, "codec_vendor", "codecVendor") NHML_PRINT_UINT(0, "codec_version", "codecVersion") NHML_PRINT_UINT(0, "codec_revision", "codecRevision") NHML_PRINT_STRING(0, "compressor_name", "compressorName") NHML_PRINT_UINT(0, "temporal_quality", "temporalQuality") NHML_PRINT_UINT(0, "spatial_quality", "spatialQuality") NHML_PRINT_UINT(0, "hres", "horizontalResolution") NHML_PRINT_UINT(0, "vres", "verticalResolution") NHML_PRINT_UINT(GF_PROP_PID_BIT_DEPTH_Y, NULL, "bitDepth") NHML_PRINT_STRING(0, "meta:xmlns", "xml_namespace") NHML_PRINT_STRING(0, "meta:schemaloc", "xml_schema_location") NHML_PRINT_STRING(0, "meta:mime", "mime_type") NHML_PRINT_STRING(0, "meta:config", "config") NHML_PRINT_STRING(0, "meta:aux_mimes", "aux_mime_type") if (ctx->codecid == GF_CODECID_DIMS) { if (gf_filter_pid_get_property_str(ctx->ipid, "meta:xmlns")==NULL) { sprintf(nhml, "xmlns=\"http://www.3gpp.org/richmedia\" "); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } NHML_PRINT_UINT(0, "dims:profile", "profile") NHML_PRINT_UINT(0, "dims:level", "level") NHML_PRINT_UINT(0, "dims:pathComponents", "pathComponents") p = gf_filter_pid_get_property_str(ctx->ipid, "dims:fullRequestHost"); if (p) { sprintf(nhml, "useFullRequestHost=\"%s\" ", p->value.boolean ? "yes" : "no"); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } p = gf_filter_pid_get_property_str(ctx->ipid, "dims:streamType"); if (p) { sprintf(nhml, "stream_type=\"%s\" ", p->value.boolean ? "primary" : "secondary"); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } p = gf_filter_pid_get_property_str(ctx->ipid, "dims:redundant"); if (p) { sprintf(nhml, "contains_redundant=\"%s\" ", (p->value.uint==1) ? "main" : ((p->value.uint==1) ? "redundant" : "main+redundant") ); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } NHML_PRINT_UINT(0, "dims:scriptTypes", "scriptTypes") } //send DCD if (ctx->opid_info) { sprintf(nhml, "specificInfoFile=\"%s\" ", gf_file_basename(ctx->info_file) ); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); dst_pck = gf_filter_pck_new_shared(ctx->opid_info, ctx->dcfg, ctx->dcfg_size, NULL); if (dst_pck) { gf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE); gf_filter_pck_set_readonly(dst_pck); gf_filter_pck_send(dst_pck); } } NHML_PRINT_STRING(0, "meta:encoding", "encoding") NHML_PRINT_STRING(0, "meta:contentEncoding", "content_encoding") ctx->uncompress = GF_FALSE; if (p) { if (!strcmp(p->value.string, "deflate")) ctx->uncompress = GF_TRUE; else { GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[NHMLMx] content_encoding %s not supported\n", p->value.string )); } } if (ctx->opid_mdia) { sprintf(nhml, "baseMediaFile=\"%s\" ", gf_file_basename(ctx->media_file) ); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); } sprintf(nhml, ">\n"); gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); gf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size); if (ctx->filep) { gf_fwrite(ctx->nhml_buffer, size, ctx->filep); return; } dst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output); if (!dst_pck) return; memcpy(output, ctx->nhml_buffer, size); gf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_FALSE); gf_filter_pck_send(dst_pck); }
0
119,605
void trace_printk_init_buffers(void) { if (buffers_allocated) return; if (alloc_percpu_trace_buffer()) return; /* trace_printk() is for debug use only. Don't use it in production. */ pr_warn("\n"); pr_warn("**********************************************************\n"); pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); pr_warn("** **\n"); pr_warn("** trace_printk() being used. Allocating extra memory. **\n"); pr_warn("** **\n"); pr_warn("** This means that this is a DEBUG kernel and it is **\n"); pr_warn("** unsafe for production use. **\n"); pr_warn("** **\n"); pr_warn("** If you see this message and you are not debugging **\n"); pr_warn("** the kernel, report this immediately to your vendor! **\n"); pr_warn("** **\n"); pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); pr_warn("**********************************************************\n"); /* Expand the buffers to set size */ tracing_update_buffers(); buffers_allocated = 1; /* * trace_printk_init_buffers() can be called by modules. * If that happens, then we need to start cmdline recording * directly here. If the global_trace.buffer is already * allocated here, then this was called by module code. */ if (global_trace.trace_buffer.buffer) tracing_start_cmdline_record(); }
0
436,318
onig_capture_tree_traverse(OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg) { #ifdef USE_CAPTURE_HISTORY return capture_tree_traverse(region->history_root, at, callback_func, 0, arg); #else return ONIG_NO_SUPPORT_CONFIG; #endif }
0
78,039
static void macvlan_port_destroy(struct net_device *dev) { struct macvlan_port *port = macvlan_port_get(dev); dev->priv_flags &= ~IFF_MACVLAN_PORT; netdev_rx_handler_unregister(dev); kfree_rcu(port, rcu); }
0
346,232
static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC) { unsigned exif_value_2a, offset_of_ifd; /* set the thumbnail stuff to nothing so we can test to see if they get set up */ if (memcmp(CharBuf, "II", 2) == 0) { ImageInfo->motorola_intel = 0; } else if (memcmp(CharBuf, "MM", 2) == 0) { ImageInfo->motorola_intel = 1; } else { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF alignment marker"); return; } /* Check the next two values for correctness. */ exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)"); return; } if (offset_of_ifd > length) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid IFD start"); return; } ImageInfo->sections_found |= FOUND_IFD0; /* First directory starts at offset 8. Offsets starts at 0. */ exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0 TSRMLS_CC); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done"); #endif /* Compute the CCD width, in milimeters. */ if (ImageInfo->FocalplaneXRes != 0) { ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes); } }
1
514,054
toggle_display_of_ipc_commands() { if (mouse_setting.verbose) mouse_setting.verbose = 0; else mouse_setting.verbose = 1; }
0
517,456
Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy<Item_ident_for_show>(thd, mem_root, this); }
0
323,255
static int compat_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt) { AVCodecInternal *avci = avctx->internal; int ret; av_assert0(avci->compat_decode_consumed == 0); *got_frame = 0; avci->compat_decode = 1; if (avci->compat_decode_partial_size > 0 && avci->compat_decode_partial_size != pkt->size) { av_log(avctx, AV_LOG_ERROR, "Got unexpected packet size after a partial decode\n"); ret = AVERROR(EINVAL); goto finish; } if (!avci->compat_decode_partial_size) { ret = avcodec_send_packet(avctx, pkt); if (ret == AVERROR_EOF) ret = 0; else if (ret == AVERROR(EAGAIN)) { /* we fully drain all the output in each decode call, so this should not * ever happen */ ret = AVERROR_BUG; goto finish; } else if (ret < 0) goto finish; } while (ret >= 0) { ret = avcodec_receive_frame(avctx, frame); if (ret < 0) { if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) ret = 0; goto finish; } if (frame != avci->compat_decode_frame) { if (!avctx->refcounted_frames) { ret = unrefcount_frame(avci, frame); if (ret < 0) goto finish; } *got_frame = 1; frame = avci->compat_decode_frame; } else { if (!avci->compat_decode_warned) { av_log(avctx, AV_LOG_WARNING, "The deprecated avcodec_decode_* " "API cannot return all the frames for this decoder. " "Some frames will be dropped. Update your code to the " "new decoding API to fix this.\n"); avci->compat_decode_warned = 1; } } if (avci->draining || (!avctx->codec->bsfs && avci->compat_decode_consumed < pkt->size)) break; } finish: if (ret == 0) { /* if there are any bsfs then assume full packet is always consumed */ if (avctx->codec->bsfs) ret = pkt->size; else ret = FFMIN(avci->compat_decode_consumed, pkt->size); } avci->compat_decode_consumed = 0; avci->compat_decode_partial_size = (ret >= 0) ? pkt->size - ret : 0; return ret; }
1
53,379
static int xen_evtchn_cpu_dead(unsigned int cpu) { int ret = 0; if (evtchn_ops->percpu_deinit) ret = evtchn_ops->percpu_deinit(cpu); return ret; }
0
486,942
grammar_current_rule_begin (symbol *lhs, location loc, named_ref *lhs_name) { /* Start a new rule and record its lhs. */ ++nrules; previous_rule_end = grammar_end; current_rule = grammar_symbol_append (lhs, loc); if (lhs_name) assign_named_ref (current_rule, named_ref_copy (lhs_name)); /* Mark the rule's lhs as a nonterminal if not already so. */ if (lhs->content->class == unknown_sym || lhs->content->class == pct_type_sym) symbol_class_set (lhs, nterm_sym, empty_loc, false); else if (lhs->content->class == token_sym) complain (&loc, complaint, _("rule given for %s, which is a token"), lhs->tag); }
0
327,063
void OPPROTO op_fdivr_ST0_FT0(void) { ST0 = FT0 / ST0; }
1
523,377
bool LEX::call_statement_start(THD *thd, sp_name *name) { Database_qualified_name pkgname(&null_clex_str, &null_clex_str); const Sp_handler *sph= &sp_handler_procedure; sql_command= SQLCOM_CALL; value_list.empty(); if (unlikely(sph->sp_resolve_package_routine(thd, thd->lex->sphead, name, &sph, &pkgname))) return true; if (unlikely(!(m_sql_cmd= new (thd->mem_root) Sql_cmd_call(name, sph)))) return true; sph->add_used_routine(this, thd, name); if (pkgname.m_name.length) sp_handler_package_body.add_used_routine(this, thd, &pkgname); return false; }
0
157,203
regexp_engine const * Perl_current_re_engine(pTHX) { if (IN_PERL_COMPILETIME) { HV * const table = GvHV(PL_hintgv); SV **ptr; if (!table || !(PL_hints & HINT_LOCALIZE_HH)) return &PL_core_reg_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) return &PL_core_reg_engine; return INT2PTR(regexp_engine*, SvIV(*ptr)); } else { SV *ptr; if (!PL_curcop->cop_hints_hash) return &PL_core_reg_engine; ptr = cop_hints_fetch_pvs(PL_curcop, "regcomp", 0); if ( !(ptr && SvIOK(ptr) && SvIV(ptr))) return &PL_core_reg_engine; return INT2PTR(regexp_engine*, SvIV(ptr)); }
0