idx
int64
func
string
target
int64
438,762
push_glob0_caller(const char *path, VALUE val, void *enc) { struct push_glob0_args *arg = (struct push_glob0_args *)val; return ruby_glob0(path, arg->fd, arg->base, arg->flags, arg->funcs, arg->arg, enc); }
0
365,315
rb_str_center(argc, argv, str) int argc; VALUE *argv; VALUE str; { return rb_str_justify(argc, argv, str, 'c'); }
0
303,050
XML_GetIdAttributeIndex(XML_Parser parser) { if (parser == NULL) return -1; return parser->m_idAttIndex; }
0
458,515
skip_non_digits(char *str) { while (!isdigit(*str) && *str != 0) { str++; } return str; }
0
519,111
Field_timestampf(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, TABLE_SHARE *share, uint dec_arg) : Field_timestamp_with_dec(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, share, dec_arg) {}
0
275,387
static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, int flags TSRMLS_DC) /* {{{ */ { const char *spec_walk; int c, i; int min_num_args = -1; int max_num_args = 0; int post_varargs = 0; zval **arg; int arg_count; int quiet = flags & ZEND_PARSE_PARAMS_QUIET; zend_bool have_varargs = 0; zval ****varargs = NULL; int *n_varargs = NULL; for (spec_walk = type_spec; *spec_walk; spec_walk++) { c = *spec_walk; switch (c) { case 'l': case 'd': case 's': case 'b': case 'r': case 'a': case 'o': case 'O': case 'z': case 'Z': case 'C': case 'h': case 'f': case 'A': case 'H': case 'p': max_num_args++; break; case '|': min_num_args = max_num_args; break; case '/': case '!': /* Pass */ break; case '*': case '+': if (have_varargs) { if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", class_name, class_name[0] ? "::" : "", active_function->common.function_name); } return FAILURE; } have_varargs = 1; /* we expect at least one parameter in varargs */ if (c == '+') { max_num_args++; } /* mark the beginning of varargs */ post_varargs = max_num_args; break; default: if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", class_name, class_name[0] ? "::" : "", active_function->common.function_name); } return FAILURE; } } if (min_num_args < 0) { min_num_args = max_num_args; } if (have_varargs) { /* calculate how many required args are at the end of the specifier list */ post_varargs = max_num_args - post_varargs; max_num_args = -1; } if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", class_name, class_name[0] ? "::" : "", active_function->common.function_name, min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", num_args); } return FAILURE; } arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1); if (num_args > arg_count) { zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", get_active_function_name(TSRMLS_C)); return FAILURE; } i = 0; while (num_args-- > 0) { if (*type_spec == '|') { type_spec++; } if (*type_spec == '*' || *type_spec == '+') { int num_varargs = num_args + 1 - post_varargs; /* eat up the passed in storage even if it won't be filled in with varargs */ varargs = va_arg(*va, zval ****); n_varargs = va_arg(*va, int *); type_spec++; if (num_varargs > 0) { int iv = 0; zval **p = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - i)); *n_varargs = num_varargs; /* allocate space for array and store args */ *varargs = safe_emalloc(num_varargs, sizeof(zval **), 0); while (num_varargs-- > 0) { (*varargs)[iv++] = p++; } /* adjust how many args we have left and restart loop */ num_args = num_args + 1 - iv; i += iv; continue; } else { *varargs = NULL; *n_varargs = 0; } } arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i)); if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) { /* clean up varargs array if it was used */ if (varargs && *varargs) { efree(*varargs); *varargs = NULL; } return FAILURE; } i++; } return SUCCESS; } /* }}} */
0
515,328
smtp_server_connection_send_replies(struct smtp_server_connection *conn) { /* Send more replies until no more replies remain, the output blocks again, or the connection is closed */ while (!conn->disconnected && smtp_server_connection_next_reply(conn)); smtp_server_connection_timeout_update(conn); /* Accept more commands if possible */ smtp_server_connection_input_resume(conn); }
0
363,247
pango_ot_info_list_languages (PangoOTInfo *info, PangoOTTableType table_type, guint script_index, PangoOTTag language_tag G_GNUC_UNUSED) { hb_ot_layout_table_type_t tt = get_hb_table_type (table_type); PangoOTTag *result; unsigned int count, i; count = hb_ot_layout_script_get_language_count (info->layout, tt, script_index); result = g_new (PangoOTTag, count + 1); for (i = 0; i < count; i++) result[i] = hb_ot_layout_script_get_language_tag (info->layout, tt, script_index, i); result[i] = 0; return result; }
0
378,957
int LZ4IO_setNotificationLevel(int level) { displayLevel = level; return displayLevel; }
0
448,161
static char *mk_str(link_ctx *ctx, size_t end) { if (ctx->i < end) { return apr_pstrndup(ctx->pool, ctx->s + ctx->i, end - ctx->i); } return (char*)""; }
0
311,678
void LazyBackgroundPageNativeHandler::IncrementKeepaliveCount( const v8::FunctionCallbackInfo<v8::Value>& args) { if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) { content::RenderFrame* render_frame = context()->GetRenderFrame(); render_frame->Send(new ExtensionHostMsg_IncrementLazyKeepaliveCount( render_frame->GetRoutingID())); } }
0
466,578
TEST_F(HttpConnectionManagerImplTest, 100ContinueResponse) { proxy_100_continue_ = true; setup(false, "envoy-custom-server", false); // Store the basic request encoder during filter chain setup. std::shared_ptr<MockStreamDecoderFilter> filter(new NiceMock<MockStreamDecoderFilter>()); EXPECT_CALL(*filter, decodeHeaders(_, true)) .WillRepeatedly(Invoke([&](RequestHeaderMap& headers, bool) -> FilterHeadersStatus { EXPECT_NE(nullptr, headers.ForwardedFor()); EXPECT_EQ("http", headers.getForwardedProtoValue()); return FilterHeadersStatus::StopIteration; })); EXPECT_CALL(*filter, setDecoderFilterCallbacks(_)); EXPECT_CALL(filter_factory_, createFilterChain(_)) .WillRepeatedly(Invoke([&](FilterChainFactoryCallbacks& callbacks) -> void { callbacks.addStreamDecoderFilter(filter); })); EXPECT_CALL(filter_callbacks_.connection_.dispatcher_, deferredDelete_(_)); // When dispatch is called on the codec, we pretend to get a new stream and then fire a headers // only request into it. Then we respond into the filter. EXPECT_CALL(*codec_, dispatch(_)) .WillRepeatedly(Invoke([&](Buffer::Instance& data) -> Http::Status { decoder_ = &conn_manager_->newStream(response_encoder_); // Test not charging stats on the second call. RequestHeaderMapPtr headers{new TestRequestHeaderMapImpl{ {":authority", "host"}, {":path", "/"}, {":method", "GET"}}}; decoder_->decodeHeaders(std::move(headers), true); ResponseHeaderMapPtr continue_headers{new TestResponseHeaderMapImpl{{":status", "100"}}}; filter->callbacks_->encode100ContinueHeaders(std::move(continue_headers)); ResponseHeaderMapPtr response_headers{new TestResponseHeaderMapImpl{{":status", "200"}}}; filter->callbacks_->streamInfo().setResponseCodeDetails(""); filter->callbacks_->encodeHeaders(std::move(response_headers), true, "details"); data.drain(4); return Http::okStatus(); })); // Kick off the incoming data. Buffer::OwnedImpl fake_input("1234"); conn_manager_->onData(fake_input, false); EXPECT_EQ(1U, stats_.named_.downstream_rq_1xx_.value()); EXPECT_EQ(1U, listener_stats_.downstream_rq_1xx_.value()); EXPECT_EQ(1U, stats_.named_.downstream_rq_2xx_.value()); EXPECT_EQ(1U, listener_stats_.downstream_rq_2xx_.value()); EXPECT_EQ(2U, stats_.named_.downstream_rq_completed_.value()); EXPECT_EQ(2U, listener_stats_.downstream_rq_completed_.value()); }
0
198,395
GURL SavePackage::GetUrlToBeSaved() { NavigationEntry* active_entry = web_contents()->GetController().GetActiveEntry(); return active_entry->GetURL(); }
0
167,784
void InspectorOverlay::setOverridesTopOffset(int offset)
0
341,462
static int parse_presentation_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int64_t pts) { PGSSubContext *ctx = avctx->priv_data; int i, state, ret; const uint8_t *buf_end = buf + buf_size; // Video descriptor int w = bytestream_get_be16(&buf); int h = bytestream_get_be16(&buf); uint16_t object_index; ctx->presentation.pts = pts; av_dlog(avctx, "Video Dimensions %dx%d\n", w, h); ret = ff_set_dimensions(avctx, w, h); if (ret < 0) return ret; /* Skip 1 bytes of unknown, frame rate */ buf++; // Composition descriptor ctx->presentation.id_number = bytestream_get_be16(&buf); /* * state is a 2 bit field that defines pgs epoch boundaries * 00 - Normal, previously defined objects and palettes are still valid * 01 - Acquisition point, previous objects and palettes can be released * 10 - Epoch start, previous objects and palettes can be released * 11 - Epoch continue, previous objects and palettes can be released * * reserved 6 bits discarded */ state = bytestream_get_byte(&buf) >> 6; if (state != 0) { flush_cache(avctx); /* * skip palette_update_flag (0x80), */ buf += 1; ctx->presentation.palette_id = bytestream_get_byte(&buf); ctx->presentation.object_count = bytestream_get_byte(&buf); if (ctx->presentation.object_count > MAX_OBJECT_REFS) { av_log(avctx, AV_LOG_ERROR, "Invalid number of presentation objects %d\n", ctx->presentation.object_count); ctx->presentation.object_count = 2; if (avctx->err_recognition & AV_EF_EXPLODE) { for (i = 0; i < ctx->presentation.object_count; i++) { ctx->presentation.objects[i].id = bytestream_get_be16(&buf); ctx->presentation.objects[i].window_id = bytestream_get_byte(&buf); ctx->presentation.objects[i].composition_flag = bytestream_get_byte(&buf); ctx->presentation.objects[i].x = bytestream_get_be16(&buf); ctx->presentation.objects[i].y = bytestream_get_be16(&buf); // If cropping if (ctx->presentation.objects[i].composition_flag & 0x80) { ctx->presentation.objects[i].crop_x = bytestream_get_be16(&buf); ctx->presentation.objects[i].crop_y = bytestream_get_be16(&buf); ctx->presentation.objects[i].crop_w = bytestream_get_be16(&buf); ctx->presentation.objects[i].crop_h = bytestream_get_be16(&buf); av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", ctx->presentation.objects[i].x, ctx->presentation.objects[i].y); if (ctx->presentation.objects[i].x > avctx->width || ctx->presentation.objects[i].y > avctx->height) { av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n", ctx->presentation.objects[i].x, ctx->presentation.objects[i].y, avctx->width, avctx->height); ctx->presentation.objects[i].x = 0; ctx->presentation.objects[i].y = 0; if (avctx->err_recognition & AV_EF_EXPLODE) { return 0;
1
279,544
void GuestViewBase::WillAttach(content::WebContents* embedder_web_contents, int element_instance_id, bool is_full_page_plugin) { if (owner_web_contents_ != embedder_web_contents) { DCHECK_EQ(owner_contents_observer_->web_contents(), owner_web_contents_); StopTrackingEmbedderZoomLevel(); owner_web_contents_ = embedder_web_contents; owner_contents_observer_.reset( new OwnerContentsObserver(this, embedder_web_contents)); } StartTrackingEmbedderZoomLevel(); element_instance_id_ = element_instance_id; is_full_page_plugin_ = is_full_page_plugin; WillAttachToEmbedder(); }
0
298,959
Bool gf_sys_get_battery_state(Bool *onBattery, u32 *onCharge, u32*level, u32 *batteryLifeTime, u32 *batteryFullLifeTime) { #if defined(_WIN32_WCE) SYSTEM_POWER_STATUS_EX sps; GetSystemPowerStatusEx(&sps, 0); if (onBattery) *onBattery = sps.ACLineStatus ? 0 : 1; if (onCharge) *onCharge = (sps.BatteryFlag & BATTERY_FLAG_CHARGING) ? 1 : 0; if (level) *level = sps.BatteryLifePercent; if (batteryLifeTime) *batteryLifeTime = sps.BatteryLifeTime; if (batteryFullLifeTime) *batteryFullLifeTime = sps.BatteryFullLifeTime; #elif defined(WIN32) SYSTEM_POWER_STATUS sps; GetSystemPowerStatus(&sps); if (onBattery) *onBattery = sps.ACLineStatus ? GF_FALSE : GF_TRUE; if (onCharge) *onCharge = (sps.BatteryFlag & BATTERY_FLAG_CHARGING) ? 1 : 0; if (level) *level = sps.BatteryLifePercent; if (batteryLifeTime) *batteryLifeTime = sps.BatteryLifeTime; if (batteryFullLifeTime) *batteryFullLifeTime = sps.BatteryFullLifeTime; #endif return GF_TRUE; }
0
365,139
connection_dirserv_flushed_some(dir_connection_t *conn) { tor_assert(conn->_base.state == DIR_CONN_STATE_SERVER_WRITING); if (buf_datalen(conn->_base.outbuf) >= DIRSERV_BUFFER_MIN) return 0; switch (conn->dir_spool_src) { case DIR_SPOOL_EXTRA_BY_DIGEST: case DIR_SPOOL_EXTRA_BY_FP: case DIR_SPOOL_SERVER_BY_DIGEST: case DIR_SPOOL_SERVER_BY_FP: return connection_dirserv_add_servers_to_outbuf(conn); case DIR_SPOOL_MICRODESC: return connection_dirserv_add_microdescs_to_outbuf(conn); case DIR_SPOOL_CACHED_DIR: return connection_dirserv_add_dir_bytes_to_outbuf(conn); case DIR_SPOOL_NETWORKSTATUS: return connection_dirserv_add_networkstatus_bytes_to_outbuf(conn); case DIR_SPOOL_NONE: default: return 0; } }
0
304,094
static int instantiate_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; return 0; }
0
391,485
static int snd_usb_capture_open(struct snd_pcm_substream *substream) { return snd_usb_pcm_open(substream, SNDRV_PCM_STREAM_CAPTURE); }
0
420,805
http_open (http_t *r_hd, http_req_t reqtype, const char *url, const char *httphost, const char *auth, unsigned int flags, const char *proxy, http_session_t session, const char *srvtag, strlist_t headers) { gpg_error_t err; http_t hd; *r_hd = NULL; if (!(reqtype == HTTP_REQ_GET || reqtype == HTTP_REQ_POST)) return gpg_err_make (default_errsource, GPG_ERR_INV_ARG); /* Create the handle. */ hd = xtrycalloc (1, sizeof *hd); if (!hd) return gpg_error_from_syserror (); hd->magic = HTTP_CONTEXT_MAGIC; hd->req_type = reqtype; hd->flags = flags; hd->session = http_session_ref (session); err = parse_uri (&hd->uri, url, 0, !!(flags & HTTP_FLAG_FORCE_TLS)); if (!err) err = send_request (hd, httphost, auth, proxy, srvtag, hd->session? hd->session->connect_timeout : 0, headers); if (err) { my_socket_unref (hd->sock, NULL, NULL); if (hd->fp_read) es_fclose (hd->fp_read); if (hd->fp_write) es_fclose (hd->fp_write); http_session_unref (hd->session); xfree (hd); } else *r_hd = hd; return err; }
0
124,290
void MirrorJob::Statistics::Reset() { tot_files=new_files=mod_files=del_files= tot_symlinks=new_symlinks=mod_symlinks=del_symlinks= dirs=del_dirs=0; }
0
156,886
gboolean mono_verifier_is_method_full_trust (MonoMethod *method) { /* The verifier was disabled at compile time */ return TRUE;
0
438,169
long long Segment::CreateInstance(IMkvReader* pReader, long long pos, Segment*& pSegment) { if (pReader == NULL || pos < 0) return E_PARSE_FAILED; pSegment = NULL; long long total, available; const long status = pReader->Length(&total, &available); if (status < 0) // error return status; if (available < 0) return -1; if ((total >= 0) && (available > total)) return -1; // I would assume that in practice this loop would execute // exactly once, but we allow for other elements (e.g. Void) // to immediately follow the EBML header. This is fine for // the source filter case (since the entire file is available), // but in the splitter case over a network we should probably // just give up early. We could for example decide only to // execute this loop a maximum of, say, 10 times. // TODO: // There is an implied "give up early" by only parsing up // to the available limit. We do do that, but only if the // total file size is unknown. We could decide to always // use what's available as our limit (irrespective of whether // we happen to know the total file length). This would have // as its sense "parse this much of the file before giving up", // which a slightly different sense from "try to parse up to // 10 EMBL elements before giving up". for (;;) { if ((total >= 0) && (pos >= total)) return E_FILE_FORMAT_INVALID; // Read ID long len; long long result = GetUIntLength(pReader, pos, len); if (result) // error, or too few available bytes return result; if ((total >= 0) && ((pos + len) > total)) return E_FILE_FORMAT_INVALID; if ((pos + len) > available) return pos + len; const long long idpos = pos; const long long id = ReadID(pReader, pos, len); if (id < 0) return E_FILE_FORMAT_INVALID; pos += len; // consume ID // Read Size result = GetUIntLength(pReader, pos, len); if (result) // error, or too few available bytes return result; if ((total >= 0) && ((pos + len) > total)) return E_FILE_FORMAT_INVALID; if ((pos + len) > available) return pos + len; long long size = ReadUInt(pReader, pos, len); if (size < 0) // error return size; pos += len; // consume length of size of element // Pos now points to start of payload // Handle "unknown size" for live streaming of webm files. const long long unknown_size = (1LL << (7 * len)) - 1; if (id == libwebm::kMkvSegment) { if (size == unknown_size) size = -1; else if (total < 0) size = -1; else if ((pos + size) > total) size = -1; pSegment = new (std::nothrow) Segment(pReader, idpos, pos, size); if (pSegment == NULL) return E_PARSE_FAILED; return 0; // success } if (size == unknown_size) return E_FILE_FORMAT_INVALID; if ((total >= 0) && ((pos + size) > total)) return E_FILE_FORMAT_INVALID; if ((pos + size) > available) return pos + size; pos += size; // consume payload } }
0
478,112
static CImg<T> identity_matrix(const unsigned int N) { CImg<T> res(N,N,1,1,0); cimg_forX(res,x) res(x,x) = 1; return res; }
0
60,777
CertificateValidationContextSdsRotationApiTest() { envoy::config::core::v3::ConfigSource config_source; sds_api_ = std::make_unique<CertificateValidationContextSdsApi>( config_source, "abc.com", subscription_factory_, time_system_, validation_visitor_, stats_, []() {}, mock_dispatcher_, *api_); init_manager_.add(*sds_api_->initTarget()); initialize(); handle_ = sds_api_->addUpdateCallback([this]() { secret_callback_.onAddOrUpdateSecret(); }); }
0
272,398
static void sdma_desc_avail(struct sdma_engine *sde, uint avail) { struct iowait *wait, *nw, *twait; struct iowait *waits[SDMA_WAIT_BATCH_SIZE]; uint i, n = 0, seq, tidx = 0; #ifdef CONFIG_SDMA_VERBOSITY dd_dev_err(sde->dd, "CONFIG SDMA(%u) %s:%d %s()\n", sde->this_idx, slashstrip(__FILE__), __LINE__, __func__); dd_dev_err(sde->dd, "avail: %u\n", avail); #endif do { seq = read_seqbegin(&sde->waitlock); if (!list_empty(&sde->dmawait)) { /* at least one item */ write_seqlock(&sde->waitlock); /* Harvest waiters wanting DMA descriptors */ list_for_each_entry_safe( wait, nw, &sde->dmawait, list) { u32 num_desc; if (!wait->wakeup) continue; if (n == ARRAY_SIZE(waits)) break; iowait_init_priority(wait); num_desc = iowait_get_all_desc(wait); if (num_desc > avail) break; avail -= num_desc; /* Find the top-priority wait memeber */ if (n) { twait = waits[tidx]; tidx = iowait_priority_update_top(wait, twait, n, tidx); } list_del_init(&wait->list); waits[n++] = wait; } write_sequnlock(&sde->waitlock); break; } } while (read_seqretry(&sde->waitlock, seq)); /* Schedule the top-priority entry first */ if (n) waits[tidx]->wakeup(waits[tidx], SDMA_AVAIL_REASON); for (i = 0; i < n; i++) if (i != tidx) waits[i]->wakeup(waits[i], SDMA_AVAIL_REASON); }
0
285,955
void Document::setTitle(const String& title) { m_titleSetExplicitly = true; if (!isHTMLDocument() && !isXHTMLDocument()) m_titleElement = 0; else if (!m_titleElement) { if (HTMLElement* headElement = head()) { m_titleElement = createElement(titleTag, false); headElement->appendChild(m_titleElement, ASSERT_NO_EXCEPTION); } } updateTitle(StringWithDirection(title, LTR)); if (m_titleElement) { ASSERT(m_titleElement->hasTagName(titleTag)); if (m_titleElement->hasTagName(titleTag)) static_cast<HTMLTitleElement*>(m_titleElement.get())->setText(title); } }
0
242,994
void AppCacheUpdateJob::FetchMasterEntries() { DCHECK(internal_state_ == NO_UPDATE || internal_state_ == DOWNLOADING); while (master_entry_fetches_.size() < kMaxConcurrentUrlFetches && !master_entries_to_fetch_.empty()) { const GURL& url = *master_entries_to_fetch_.begin(); if (AlreadyFetchedEntry(url, AppCacheEntry::MASTER)) { ++master_entries_completed_; // saved a URL request if (internal_state_ == NO_UPDATE) { DCHECK(!inprogress_cache_.get()); AppCache* cache = group_->newest_complete_cache(); auto found = pending_master_entries_.find(url); DCHECK(found != pending_master_entries_.end()); PendingHosts& hosts = found->second; for (AppCacheHost* host : hosts) host->AssociateCompleteCache(cache); } } else { URLFetcher* fetcher = new URLFetcher(url, URLFetcher::MASTER_ENTRY_FETCH, this, kAppCacheFetchBufferSize); fetcher->Start(); master_entry_fetches_.insert(PendingUrlFetches::value_type(url, fetcher)); } master_entries_to_fetch_.erase(master_entries_to_fetch_.begin()); } }
0
392,234
void rebuild_check_host(void) { delete_dynamic(&acl_wild_hosts); my_hash_free(&acl_check_hosts); init_check_host(); }
0
121,485
SpoolssReplyOpenPrinter_r(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_) { dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data; e_ctx_hnd policy_hnd; proto_item *hnd_item; guint32 status; /* Parse packet */ offset = dissect_nt_policy_hnd( tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, &hnd_item, TRUE, FALSE); offset = dissect_doserror( tvb, offset, pinfo, tree, di, drep, hf_rc, &status); if( status == 0 ){ const char *pol_name; if (dcv->se_data){ pol_name = wmem_strdup_printf(wmem_packet_scope(), "ReplyOpenPrinter(%s)", (char *)dcv->se_data); } else { pol_name = "Unknown ReplyOpenPrinter() handle"; } if(!pinfo->fd->flags.visited){ dcerpc_store_polhnd_name(&policy_hnd, pinfo, pol_name); } if(hnd_item) proto_item_append_text(hnd_item, ": %s", pol_name); } return offset; }
0
344,880
private int mget(struct magic_set *ms, const unsigned char *s, struct magic *m, size_t nbytes, size_t o, unsigned int cont_level, int mode, int text, int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { uint32_t soffset, offset = ms->offset; uint32_t count = m->str_range; int rv, oneed_separator; char *sbuf, *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; if (recursion_level >= 20) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o), (uint32_t)nbytes, count) == -1) return -1; if ((ms->flags & MAGIC_DEBUG) != 0) { fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, " "nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o, nbytes, count); mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE)); } if (m->flag & INDIR) { int off = m->in_offset; if (m->in_op & FILE_OPINDIRECT) { const union VALUETYPE *q = CAST(const union VALUETYPE *, ((const void *)(s + offset + off))); switch (cvt_flip(m->in_type, flip)) { case FILE_BYTE: off = q->b; break; case FILE_SHORT: off = q->h; break; case FILE_BESHORT: off = (short)((q->hs[0]<<8)|(q->hs[1])); break; case FILE_LESHORT: off = (short)((q->hs[1]<<8)|(q->hs[0])); break; case FILE_LONG: off = q->l; break; case FILE_BELONG: case FILE_BEID3: off = (int32_t)((q->hl[0]<<24)|(q->hl[1]<<16)| (q->hl[2]<<8)|(q->hl[3])); break; case FILE_LEID3: case FILE_LELONG: off = (int32_t)((q->hl[3]<<24)|(q->hl[2]<<16)| (q->hl[1]<<8)|(q->hl[0])); break; case FILE_MELONG: off = (int32_t)((q->hl[1]<<24)|(q->hl[0]<<16)| (q->hl[3]<<8)|(q->hl[2])); break; } if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect offs=%u\n", off); } switch (cvt_flip(m->in_type, flip)) { case FILE_BYTE: if (nbytes < (offset + 1)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->b & off; break; case FILE_OPOR: offset = p->b | off; break; case FILE_OPXOR: offset = p->b ^ off; break; case FILE_OPADD: offset = p->b + off; break; case FILE_OPMINUS: offset = p->b - off; break; case FILE_OPMULTIPLY: offset = p->b * off; break; case FILE_OPDIVIDE: offset = p->b / off; break; case FILE_OPMODULO: offset = p->b % off; break; } } else offset = p->b; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BESHORT: if (nbytes < (offset + 2)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = (short)((p->hs[0]<<8)| (p->hs[1])) & off; break; case FILE_OPOR: offset = (short)((p->hs[0]<<8)| (p->hs[1])) | off; break; case FILE_OPXOR: offset = (short)((p->hs[0]<<8)| (p->hs[1])) ^ off; break; case FILE_OPADD: offset = (short)((p->hs[0]<<8)| (p->hs[1])) + off; break; case FILE_OPMINUS: offset = (short)((p->hs[0]<<8)| (p->hs[1])) - off; break; case FILE_OPMULTIPLY: offset = (short)((p->hs[0]<<8)| (p->hs[1])) * off; break; case FILE_OPDIVIDE: offset = (short)((p->hs[0]<<8)| (p->hs[1])) / off; break; case FILE_OPMODULO: offset = (short)((p->hs[0]<<8)| (p->hs[1])) % off; break; } } else offset = (short)((p->hs[0]<<8)| (p->hs[1])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LESHORT: if (nbytes < (offset + 2)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = (short)((p->hs[1]<<8)| (p->hs[0])) & off; break; case FILE_OPOR: offset = (short)((p->hs[1]<<8)| (p->hs[0])) | off; break; case FILE_OPXOR: offset = (short)((p->hs[1]<<8)| (p->hs[0])) ^ off; break; case FILE_OPADD: offset = (short)((p->hs[1]<<8)| (p->hs[0])) + off; break; case FILE_OPMINUS: offset = (short)((p->hs[1]<<8)| (p->hs[0])) - off; break; case FILE_OPMULTIPLY: offset = (short)((p->hs[1]<<8)| (p->hs[0])) * off; break; case FILE_OPDIVIDE: offset = (short)((p->hs[1]<<8)| (p->hs[0])) / off; break; case FILE_OPMODULO: offset = (short)((p->hs[1]<<8)| (p->hs[0])) % off; break; } } else offset = (short)((p->hs[1]<<8)| (p->hs[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_SHORT: if (nbytes < (offset + 2)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->h & off; break; case FILE_OPOR: offset = p->h | off; break; case FILE_OPXOR: offset = p->h ^ off; break; case FILE_OPADD: offset = p->h + off; break; case FILE_OPMINUS: offset = p->h - off; break; case FILE_OPMULTIPLY: offset = p->h * off; break; case FILE_OPDIVIDE: offset = p->h / off; break; case FILE_OPMODULO: offset = p->h % off; break; } } else offset = p->h; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BELONG: case FILE_BEID3: if (nbytes < (offset + 4)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) & off; break; case FILE_OPOR: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) | off; break; case FILE_OPXOR: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) ^ off; break; case FILE_OPADD: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) + off; break; case FILE_OPMINUS: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) - off; break; case FILE_OPMULTIPLY: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) * off; break; case FILE_OPDIVIDE: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) / off; break; case FILE_OPMODULO: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])) % off; break; } } else offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| (p->hl[2]<<8)| (p->hl[3])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LELONG: case FILE_LEID3: if (nbytes < (offset + 4)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) & off; break; case FILE_OPOR: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) | off; break; case FILE_OPXOR: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) ^ off; break; case FILE_OPADD: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) + off; break; case FILE_OPMINUS: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) - off; break; case FILE_OPMULTIPLY: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) * off; break; case FILE_OPDIVIDE: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) / off; break; case FILE_OPMODULO: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])) % off; break; } } else offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| (p->hl[1]<<8)| (p->hl[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_MELONG: if (nbytes < (offset + 4)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) & off; break; case FILE_OPOR: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) | off; break; case FILE_OPXOR: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) ^ off; break; case FILE_OPADD: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) + off; break; case FILE_OPMINUS: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) - off; break; case FILE_OPMULTIPLY: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) * off; break; case FILE_OPDIVIDE: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) / off; break; case FILE_OPMODULO: offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])) % off; break; } } else offset = (int32_t)((p->hl[1]<<24)| (p->hl[0]<<16)| (p->hl[3]<<8)| (p->hl[2])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LONG: if (nbytes < (offset + 4)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->l & off; break; case FILE_OPOR: offset = p->l | off; break; case FILE_OPXOR: offset = p->l ^ off; break; case FILE_OPADD: offset = p->l + off; break; case FILE_OPMINUS: offset = p->l - off; break; case FILE_OPMULTIPLY: offset = p->l * off; break; case FILE_OPDIVIDE: offset = p->l / off; break; case FILE_OPMODULO: offset = p->l % off; break; } } else offset = p->l; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; } switch (cvt_flip(m->in_type, flip)) { case FILE_LEID3: case FILE_BEID3: offset = ((((offset >> 0) & 0x7f) << 0) | (((offset >> 8) & 0x7f) << 7) | (((offset >> 16) & 0x7f) << 14) | (((offset >> 24) & 0x7f) << 21)) + 10; break; default: break; } if (m->flag & INDIROFFADD) { offset += ms->c.li[cont_level-1].off; if (offset == 0) { if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect *zero* offset\n"); return 0; } if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect +offs=%u\n", offset); } if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1) return -1; ms->offset = offset; if ((ms->flags & MAGIC_DEBUG) != 0) { mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE)); } } /* Verify we have enough data to match magic type */ switch (m->type) { case FILE_BYTE: if (nbytes < (offset + 1)) /* should always be true */ return 0; break; case FILE_SHORT: case FILE_BESHORT: case FILE_LESHORT: if (nbytes < (offset + 2)) return 0; break; case FILE_LONG: case FILE_BELONG: case FILE_LELONG: case FILE_MELONG: case FILE_DATE: case FILE_BEDATE: case FILE_LEDATE: case FILE_MEDATE: case FILE_LDATE: case FILE_BELDATE: case FILE_LELDATE: case FILE_MELDATE: case FILE_FLOAT: case FILE_BEFLOAT: case FILE_LEFLOAT: if (nbytes < (offset + 4)) return 0; break; case FILE_DOUBLE: case FILE_BEDOUBLE: case FILE_LEDOUBLE: if (nbytes < (offset + 8)) return 0; break; case FILE_STRING: case FILE_PSTRING: case FILE_SEARCH: if (nbytes < (offset + m->vallen)) return 0; break; case FILE_REGEX: if (nbytes < offset) return 0; break; case FILE_INDIRECT: if (offset == 0) return 0; if (nbytes < offset) return 0; sbuf = ms->o.buf; soffset = ms->offset; ms->o.buf = NULL; ms->offset = 0; rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); rbuf = ms->o.buf; ms->o.buf = sbuf; ms->offset = soffset; if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, m->desc, offset) == -1) return -1; if (file_printf(ms, "%s", rbuf) == -1) return -1; efree(rbuf); } return rv; case FILE_USE: if (nbytes < offset) return 0; sbuf = m->value.s; if (*sbuf == '^') { sbuf++; flip = !flip; } if (file_magicfind(ms, sbuf, &ml) == -1) { file_error(ms, 0, "cannot find entry `%s'", sbuf); return -1; } oneed_separator = *need_separator; if (m->flag & NOSPACE) *need_separator = 0; rv = match(ms, ml.magic, ml.nmagic, s, nbytes, offset + o, mode, text, flip, recursion_level, printed_something, need_separator, returnval); if (rv != 1) *need_separator = oneed_separator; return rv; case FILE_NAME: if (file_printf(ms, "%s", m->desc) == -1) return -1; return 1; case FILE_DEFAULT: /* nothing to check */ default: break; } if (!mconvert(ms, m, flip)) return 0;
1
496,535
bool operator() (SFace_handle sf1, SFace_handle sf2) const { CGAL_NEF_TRACEN("sort sfaces"); if(&*sf1 == &*sf2) return false; sort_vertices<T> SORT(*this->sncp()); CGAL_NEF_TRACEN(" vertices " << sf1->center_vertex()->point() << " , " << sf2->center_vertex()->point()); if(sf1->center_vertex() != sf2->center_vertex()) return SORT(sf1->center_vertex(), sf2->center_vertex()); // sort_sface_cycle_entries<Base> sort_cycles((Base) *this); // return sort_cycles(*sf1->sface_cycles_begin(), *sf2->sface_cycles_begin()); SM_decorator SD(&*sf1->center_vertex()); moreLeft<Base> ml((Base) *this); Vector_3 plus(1,0,0); SFace_cycle_iterator fc; CGAL_NEF_TRACEN(" sface 1"); SHalfedge_handle se1; SHalfloop_handle sl1; CGAL_forall_sface_cycles_of(fc,sf1) { if(fc.is_shalfedge()) { SHalfedge_handle se(fc); SHalfedge_around_sface_circulator ec(se),ee(se); CGAL_For_all(ec,ee) { CGAL_NEF_TRACEN(" " << ec->source()->point() << " | " << ec->circle().orthogonal_vector()); if(ml(ec, se1) == -1) se1 = ec; } } else if(fc.is_shalfloop()) sl1 = SHalfloop_handle(fc); else CGAL_assertion(fc.is_svertex()); } CGAL_NEF_TRACEN(" sface 2"); SHalfedge_handle se2; SHalfloop_handle sl2; CGAL_forall_sface_cycles_of(fc,sf2) { if(fc.is_shalfedge()) { SHalfedge_handle se(fc); SHalfedge_around_sface_circulator ec(se),ee(se); CGAL_For_all(ec,ee) { CGAL_NEF_TRACEN(" " << ec->source()->point() << " | " << ec->circle().orthogonal_vector()); if(ml(ec, se2) == -1) se2 = ec; } } else if(fc.is_shalfloop()) sl2 = SHalfloop_handle(fc); else CGAL_assertion(fc.is_svertex()); } CGAL_NEF_TRACEN(" sedge cycles existing? " << (se1 != SHalfedge_handle()) << " , " << (se2 != SHalfedge_handle())); if(se1 != SHalfedge_handle() && se2 == SHalfedge_handle()) return true; if(se1 == SHalfedge_handle() && se2 != SHalfedge_handle()) return false; if(se1 == SHalfedge_handle() && se2 == SHalfedge_handle()) { Vector_3 vec1 = sl1->circle().orthogonal_vector(); Vector_3 vec2 = sl2->circle().orthogonal_vector(); CGAL_NEF_TRACEN(" sloops " << vec1 << " , " << vec2); if(vec1.x() != vec2.x()) return vec1.x() < vec2.x(); else if(vec1.y() != vec2.y()) return vec1.y() < vec2.y(); else if(vec1.z() != vec2.z()) return vec1.z() < vec2.z(); } CGAL_assertion(se1 != SHalfedge_handle() && se2 != SHalfedge_handle()); CGAL_NEF_TRACEN(" minimal sedge in sface 1:" << se1->source()->point() << " , " << se1->circle().orthogonal_vector()); CGAL_NEF_TRACEN(" minimal sedge in sface 2:" << se2->source()->point() << " , " << se2->circle().orthogonal_vector()); CGAL_NEF_TRACEN("result " << ml(se1,se2)); switch(ml(se1, se2)) { case -1: return true; case 1: return false; } sort_sface_cycle_entries<T> SORTSFC(*this->sncp()); return SORTSFC(*sf1->sface_cycles_begin(), *sf2->sface_cycles_begin()); }
0
84,694
static void sig_chat_protocol_deinit(CHAT_PROTOCOL_REC *proto) { disconnect_servers(servers, proto->id); disconnect_servers(lookup_servers, proto->id); }
0
439,208
Ptr<FileStorageParser> createXMLParser(FileStorage_API* fs) { return makePtr<XMLParser>(fs); }
0
24,307
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , Navigate_Http ) { StartHttpServer ( ) ; NavigateTwiceInTabAndClose ( http_test_server_ -> GetURL ( "/simple.html" ) , GURL ( chrome : : kChromeUIVersionURL ) ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 1 ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ; FakeUserMetricsUpload ( ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementSessionPercentage , 1 ) ; int32_t ratio_bucket = histogram_tester_ . GetAllSamples ( internal : : kHttpsEngagementSessionPercentage ) [ 0 ] . min ; EXPECT_EQ ( 0 , ratio_bucket ) ; }
0
332,239
static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { SVQ1EncContext *const s = avctx->priv_data; AVFrame *const p = avctx->coded_frame; int i, ret; if (!pkt->data && (ret = av_new_packet(pkt, s->y_block_width * s->y_block_height * MAX_MB_BYTES * 3 + FF_MIN_BUFFER_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } if (avctx->pix_fmt != AV_PIX_FMT_YUV410P) { av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if (!s->current_picture->data[0]) { ret = ff_get_buffer(avctx, s->current_picture, 0); if (ret < 0) return ret; } if (!s->last_picture->data[0]) { ret = ff_get_buffer(avctx, s->last_picture, 0); if (ret < 0) return ret; } if (!s->scratchbuf) { s->scratchbuf = av_malloc(s->current_picture->linesize[0] * 16 * 2); if (!s->scratchbuf) return AVERROR(ENOMEM); } FFSWAP(AVFrame*, s->current_picture, s->last_picture); init_put_bits(&s->pb, pkt->data, pkt->size); p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; p->key_frame = p->pict_type == AV_PICTURE_TYPE_I; p->quality = pict->quality; svq1_write_header(s, p->pict_type); for (i = 0; i < 3; i++) if (svq1_encode_plane(s, i, pict->data[i], s->last_picture->data[i], s->current_picture->data[i], s->frame_width / (i ? 4 : 1), s->frame_height / (i ? 4 : 1), pict->linesize[i], s->current_picture->linesize[i]) < 0) return -1; // avpriv_align_put_bits(&s->pb); while (put_bits_count(&s->pb) & 31) put_bits(&s->pb, 1, 0); flush_put_bits(&s->pb); pkt->size = put_bits_count(&s->pb) / 8; if (p->pict_type == AV_PICTURE_TYPE_I) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
0
372,247
cmsBool Done(void) { jpeg_destroy_decompress(&Decompressor); jpeg_destroy_compress(&Compressor); return fclose(InFile) + fclose(OutFile); }
0
96,945
libFile(char *base) { return expandPath(Strnew_m_charp(w3m_lib_dir(), "/", base, NULL)->ptr); }
0
223,660
ftrace_snapshot_init(struct ftrace_probe_ops *ops, struct trace_array *tr, unsigned long ip, void *init_data, void **data) { struct ftrace_func_mapper *mapper = *data; if (!mapper) { mapper = allocate_ftrace_func_mapper(); if (!mapper) return -ENOMEM; *data = mapper; } return ftrace_func_mapper_add_ip(mapper, ip, init_data); }
0
236,828
bool InputMethodLinuxX11::DispatchFabricatedKeyEvent( const ui::KeyEvent& event) { if (DispatchFabricatedKeyEventPostIME(event.type(), event.key_code(), event.flags())) return true; if (event.type() == ET_KEY_PRESSED && GetTextInputClient()) { const uint16 ch = event.GetCharacter(); if (ch) { GetTextInputClient()->InsertChar(ch, event.flags()); return true; } } return false; }
0
447,508
smtp_rset (CamelSmtpTransport *transport, CamelStreamBuffer *istream, CamelStream *ostream, GCancellable *cancellable, GError **error) { /* we are going to reset the smtp server (just to be nice) */ gchar *cmdbuf, *respbuf = NULL; cmdbuf = g_strdup ("RSET\r\n"); d (fprintf (stderr, "[SMTP] sending: %s", cmdbuf)); if (camel_stream_write_string (ostream, cmdbuf, cancellable, error) == -1) { g_free (cmdbuf); g_prefix_error (error, _("RSET command failed: ")); camel_service_disconnect_sync ( CAMEL_SERVICE (transport), FALSE, cancellable, NULL); return FALSE; } g_free (cmdbuf); do { /* Check for "250" */ g_free (respbuf); respbuf = camel_stream_buffer_read_line (istream, cancellable, error); d (fprintf (stderr, "[SMTP] received: %s\n", respbuf ? respbuf : "(null)")); if (respbuf == NULL) { g_prefix_error (error, _("RSET command failed: ")); camel_service_disconnect_sync ( CAMEL_SERVICE (transport), FALSE, cancellable, NULL); return FALSE; } if (strncmp (respbuf, "250", 3) != 0) { smtp_set_error (transport, istream, respbuf, cancellable, error); g_prefix_error (error, _("RSET command failed: ")); g_free (respbuf); return FALSE; } } while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */ g_free (respbuf); return TRUE; }
0
414,674
ext4_find_extent(struct inode *inode, ext4_lblk_t block, struct ext4_ext_path **orig_path, int flags) { struct ext4_extent_header *eh; struct buffer_head *bh; struct ext4_ext_path *path = orig_path ? *orig_path : NULL; short int depth, i, ppos = 0; int ret; eh = ext_inode_hdr(inode); depth = ext_depth(inode); if (depth < 0 || depth > EXT4_MAX_EXTENT_DEPTH) { EXT4_ERROR_INODE(inode, "inode has invalid extent depth: %d", depth); ret = -EFSCORRUPTED; goto err; } if (path) { ext4_ext_drop_refs(path); if (depth > path[0].p_maxdepth) { kfree(path); *orig_path = path = NULL; } } if (!path) { /* account possible depth increase */ path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 2), GFP_NOFS); if (unlikely(!path)) return ERR_PTR(-ENOMEM); path[0].p_maxdepth = depth + 1; } path[0].p_hdr = eh; path[0].p_bh = NULL; i = depth; /* walk through the tree */ while (i) { ext_debug("depth %d: num %d, max %d\n", ppos, le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max)); ext4_ext_binsearch_idx(inode, path + ppos, block); path[ppos].p_block = ext4_idx_pblock(path[ppos].p_idx); path[ppos].p_depth = i; path[ppos].p_ext = NULL; bh = read_extent_tree_block(inode, path[ppos].p_block, --i, flags); if (IS_ERR(bh)) { ret = PTR_ERR(bh); goto err; } eh = ext_block_hdr(bh); ppos++; path[ppos].p_bh = bh; path[ppos].p_hdr = eh; } path[ppos].p_depth = i; path[ppos].p_ext = NULL; path[ppos].p_idx = NULL; /* find extent */ ext4_ext_binsearch(inode, path + ppos, block); /* if not an empty leaf */ if (path[ppos].p_ext) path[ppos].p_block = ext4_ext_pblock(path[ppos].p_ext); ext4_ext_show_path(inode, path); return path; err: ext4_ext_drop_refs(path); kfree(path); if (orig_path) *orig_path = NULL; return ERR_PTR(ret); }
0
253,398
MagickExport const IndexPacket *GetVirtualIndexesFromNexus(const Cache cache, NexusInfo *nexus_info) { CacheInfo *restrict cache_info; assert(cache != (Cache) NULL); cache_info=(CacheInfo *) cache; assert(cache_info->signature == MagickSignature); if (cache_info->storage_class == UndefinedClass) return((IndexPacket *) NULL); return(nexus_info->indexes); }
0
426,208
flatpak_context_load_metadata (FlatpakContext *context, GKeyFile *metakey, GError **error) { gboolean remove; g_auto(GStrv) groups = NULL; int i; if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL)) { g_auto(GStrv) shares = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL, error); if (shares == NULL) return FALSE; for (i = 0; shares[i] != NULL; i++) { FlatpakContextShares share; share = flatpak_context_share_from_string (parse_negated (shares[i], &remove), error); if (share == 0) return FALSE; if (remove) flatpak_context_remove_shares (context, share); else flatpak_context_add_shares (context, share); } } if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL)) { g_auto(GStrv) sockets = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL, error); if (sockets == NULL) return FALSE; for (i = 0; sockets[i] != NULL; i++) { FlatpakContextSockets socket = flatpak_context_socket_from_string (parse_negated (sockets[i], &remove), error); if (socket == 0) return FALSE; if (remove) flatpak_context_remove_sockets (context, socket); else flatpak_context_add_sockets (context, socket); } } if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL)) { g_auto(GStrv) devices = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL, error); if (devices == NULL) return FALSE; for (i = 0; devices[i] != NULL; i++) { FlatpakContextDevices device = flatpak_context_device_from_string (parse_negated (devices[i], &remove), error); if (device == 0) return FALSE; if (remove) flatpak_context_remove_devices (context, device); else flatpak_context_add_devices (context, device); } } if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FEATURES, NULL)) { g_auto(GStrv) features = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FEATURES, NULL, error); if (features == NULL) return FALSE; for (i = 0; features[i] != NULL; i++) { FlatpakContextFeatures feature = flatpak_context_feature_from_string (parse_negated (features[i], &remove), error); if (feature == 0) return FALSE; if (remove) flatpak_context_remove_features (context, feature); else flatpak_context_add_features (context, feature); } } if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FILESYSTEMS, NULL)) { g_auto(GStrv) filesystems = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FILESYSTEMS, NULL, error); if (filesystems == NULL) return FALSE; for (i = 0; filesystems[i] != NULL; i++) { const char *fs = parse_negated (filesystems[i], &remove); if (!flatpak_context_verify_filesystem (fs, error)) return FALSE; if (remove) flatpak_context_remove_filesystem (context, fs); else flatpak_context_add_filesystem (context, fs); } } if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_PERSISTENT, NULL)) { g_auto(GStrv) persistent = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_PERSISTENT, NULL, error); if (persistent == NULL) return FALSE; for (i = 0; persistent[i] != NULL; i++) flatpak_context_set_persistent (context, persistent[i]); } if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY)) { g_auto(GStrv) keys = NULL; gsize i, keys_count; keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY, &keys_count, NULL); for (i = 0; i < keys_count; i++) { const char *key = keys[i]; g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY, key, NULL); FlatpakPolicy policy; if (!flatpak_verify_dbus_name (key, error)) return FALSE; policy = flatpak_policy_from_string (value, error); if ((int) policy == -1) return FALSE; flatpak_context_set_session_bus_policy (context, key, policy); } } if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY)) { g_auto(GStrv) keys = NULL; gsize i, keys_count; keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY, &keys_count, NULL); for (i = 0; i < keys_count; i++) { const char *key = keys[i]; g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY, key, NULL); FlatpakPolicy policy; if (!flatpak_verify_dbus_name (key, error)) return FALSE; policy = flatpak_policy_from_string (value, error); if ((int) policy == -1) return FALSE; flatpak_context_set_system_bus_policy (context, key, policy); } } if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT)) { g_auto(GStrv) keys = NULL; gsize i, keys_count; keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT, &keys_count, NULL); for (i = 0; i < keys_count; i++) { const char *key = keys[i]; g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT, key, NULL); flatpak_context_set_env_var (context, key, value); } } groups = g_key_file_get_groups (metakey, NULL); for (i = 0; groups[i] != NULL; i++) { const char *group = groups[i]; const char *subsystem; int j; if (g_str_has_prefix (group, FLATPAK_METADATA_GROUP_PREFIX_POLICY)) { g_auto(GStrv) keys = NULL; subsystem = group + strlen (FLATPAK_METADATA_GROUP_PREFIX_POLICY); keys = g_key_file_get_keys (metakey, group, NULL, NULL); for (j = 0; keys != NULL && keys[j] != NULL; j++) { const char *key = keys[j]; g_autofree char *policy_key = g_strdup_printf ("%s.%s", subsystem, key); g_auto(GStrv) values = NULL; int k; values = g_key_file_get_string_list (metakey, group, key, NULL, NULL); for (k = 0; values != NULL && values[k] != NULL; k++) flatpak_context_apply_generic_policy (context, policy_key, values[k]); } } } return TRUE; }
0
450,449
static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *data) { struct nfs_open_confirmres *res = data; struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_putfh(xdr); if (status) goto out; status = decode_open_confirm(xdr, res); out: return status; }
0
453,752
static uint32_t dp8393x_wt(dp8393xState *s) { return s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0]; }
0
500,312
void qpdf_set_ignore_xref_streams(qpdf_data qpdf, QPDF_BOOL value) { QTC::TC("qpdf", "qpdf-c called qpdf_set_ignore_xref_streams"); qpdf->qpdf->setIgnoreXRefStreams(value); }
0
485,772
static int snd_pcm_oss_release(struct inode *inode, struct file *file) { struct snd_pcm *pcm; struct snd_pcm_substream *substream; struct snd_pcm_oss_file *pcm_oss_file; pcm_oss_file = file->private_data; substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; if (substream == NULL) substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; if (snd_BUG_ON(!substream)) return -ENXIO; pcm = substream->pcm; if (!pcm->card->shutdown) snd_pcm_oss_sync(pcm_oss_file); mutex_lock(&pcm->open_mutex); snd_pcm_oss_release_file(pcm_oss_file); mutex_unlock(&pcm->open_mutex); wake_up(&pcm->open_wait); module_put(pcm->card->module); snd_card_file_remove(pcm->card, file); return 0; }
0
406,542
Settable_routine_parameter *get_settable_routine_parameter() { return this; }
0
413,603
static void _fb_rdlock(void) { slurm_mutex_lock(&file_bcast_mutex); while (1) { if ((fb_write_wait_lock == 0) && (fb_write_lock == 0)) { fb_read_lock++; break; } else { /* wait for state change and retry */ slurm_cond_wait(&file_bcast_cond, &file_bcast_mutex); } } slurm_mutex_unlock(&file_bcast_mutex); }
0
49,387
static void __exit ip6_tables_fini(void) { nf_unregister_sockopt(&ip6t_sockopts); xt_unregister_matches(ip6t_builtin_mt, ARRAY_SIZE(ip6t_builtin_mt)); xt_unregister_targets(ip6t_builtin_tg, ARRAY_SIZE(ip6t_builtin_tg)); unregister_pernet_subsys(&ip6_tables_net_ops); }
0
137,813
int MemFile::getc() { assertx(m_len != -1); return File::getc(); }
0
421,252
void FAST_FUNC udhcp_add_binary_option(struct dhcp_packet *packet, uint8_t *addopt) { unsigned len; uint8_t *optionptr = packet->options; unsigned end = udhcp_end_option(optionptr); len = OPT_DATA + addopt[OPT_LEN]; /* end position + (option code/length + addopt length) + end option */ if (end + len + 1 >= DHCP_OPTIONS_BUFSIZE) { //TODO: learn how to use overflow option if we exhaust packet->options[] bb_error_msg("option 0x%02x did not fit into the packet", addopt[OPT_CODE]); return; } log_option("adding option", addopt); memcpy(optionptr + end, addopt, len); optionptr[end + len] = DHCP_END; }
0
508,894
int ssl3_send_server_key_exchange(SSL *s) { #ifndef OPENSSL_NO_RSA unsigned char *q; int j, num; RSA *rsa; unsigned char md_buf[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH]; unsigned int u; #endif #ifndef OPENSSL_NO_DH DH *dh = NULL, *dhp; #endif #ifndef OPENSSL_NO_ECDH EC_KEY *ecdh = NULL, *ecdhp; unsigned char *encodedPoint = NULL; int encodedlen = 0; int curve_id = 0; BN_CTX *bn_ctx = NULL; #endif EVP_PKEY *pkey; const EVP_MD *md = NULL; unsigned char *p, *d; int al, i; unsigned long type; int n; CERT *cert; BIGNUM *r[4]; int nr[4], kn; BUF_MEM *buf; EVP_MD_CTX md_ctx; EVP_MD_CTX_init(&md_ctx); if (s->state == SSL3_ST_SW_KEY_EXCH_A) { type = s->s3->tmp.new_cipher->algorithm_mkey; cert = s->cert; buf = s->init_buf; r[0] = r[1] = r[2] = r[3] = NULL; n = 0; #ifndef OPENSSL_NO_RSA if (type & SSL_kRSA) { rsa = cert->rsa_tmp; if ((rsa == NULL) && (s->cert->rsa_tmp_cb != NULL)) { rsa = s->cert->rsa_tmp_cb(s, SSL_C_IS_EXPORT(s->s3-> tmp.new_cipher), SSL_C_EXPORT_PKEYLENGTH(s->s3-> tmp.new_cipher)); if (rsa == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_ERROR_GENERATING_TMP_RSA_KEY); goto f_err; } RSA_up_ref(rsa); cert->rsa_tmp = rsa; } if (rsa == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_MISSING_TMP_RSA_KEY); goto f_err; } r[0] = rsa->n; r[1] = rsa->e; s->s3->tmp.use_rsa_tmp = 1; } else #endif #ifndef OPENSSL_NO_DH if (type & SSL_kEDH) { dhp = cert->dh_tmp; if ((dhp == NULL) && (s->cert->dh_tmp_cb != NULL)) dhp = s->cert->dh_tmp_cb(s, SSL_C_IS_EXPORT(s->s3-> tmp.new_cipher), SSL_C_EXPORT_PKEYLENGTH(s->s3-> tmp.new_cipher)); if (dhp == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_MISSING_TMP_DH_KEY); goto f_err; } if (s->s3->tmp.dh != NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if ((dh = DHparams_dup(dhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB); goto err; } s->s3->tmp.dh = dh; if (!DH_generate_key(dh)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB); goto err; } r[0] = dh->p; r[1] = dh->g; r[2] = dh->pub_key; } else #endif #ifndef OPENSSL_NO_ECDH if (type & SSL_kEECDH) { const EC_GROUP *group; ecdhp = cert->ecdh_tmp; if (s->cert->ecdh_tmp_auto) { /* Get NID of appropriate shared curve */ int nid = tls1_shared_curve(s, -2); if (nid != NID_undef) ecdhp = EC_KEY_new_by_curve_name(nid); } else if ((ecdhp == NULL) && s->cert->ecdh_tmp_cb) { ecdhp = s->cert->ecdh_tmp_cb(s, SSL_C_IS_EXPORT(s->s3-> tmp.new_cipher), SSL_C_EXPORT_PKEYLENGTH(s-> s3->tmp.new_cipher)); } if (ecdhp == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_MISSING_TMP_ECDH_KEY); goto f_err; } if (s->s3->tmp.ecdh != NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } /* Duplicate the ECDH structure. */ if (ecdhp == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } if (s->cert->ecdh_tmp_auto) ecdh = ecdhp; else if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } s->s3->tmp.ecdh = ecdh; if ((EC_KEY_get0_public_key(ecdh) == NULL) || (EC_KEY_get0_private_key(ecdh) == NULL) || (s->options & SSL_OP_SINGLE_ECDH_USE)) { if (!EC_KEY_generate_key(ecdh)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } } if (((group = EC_KEY_get0_group(ecdh)) == NULL) || (EC_KEY_get0_public_key(ecdh) == NULL) || (EC_KEY_get0_private_key(ecdh) == NULL)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && (EC_GROUP_get_degree(group) > 163)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER); goto err; } /* * XXX: For now, we only support ephemeral ECDH keys over named * (not generic) curves. For supported named curves, curve_id is * non-zero. */ if ((curve_id = tls1_ec_nid2curve_id(EC_GROUP_get_curve_name(group))) == 0) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE); goto err; } /* * Encode the public key. First check the size of encoding and * allocate memory accordingly. */ encodedlen = EC_POINT_point2oct(group, EC_KEY_get0_public_key(ecdh), POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL); encodedPoint = (unsigned char *) OPENSSL_malloc(encodedlen * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); if ((encodedPoint == NULL) || (bn_ctx == NULL)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } encodedlen = EC_POINT_point2oct(group, EC_KEY_get0_public_key(ecdh), POINT_CONVERSION_UNCOMPRESSED, encodedPoint, encodedlen, bn_ctx); if (encodedlen == 0) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } BN_CTX_free(bn_ctx); bn_ctx = NULL; /* * XXX: For now, we only support named (not generic) curves in * ECDH ephemeral key exchanges. In this situation, we need four * additional bytes to encode the entire ServerECDHParams * structure. */ n = 4 + encodedlen; /* * We'll generate the serverKeyExchange message explicitly so we * can set these to NULLs */ r[0] = NULL; r[1] = NULL; r[2] = NULL; r[3] = NULL; } else #endif /* !OPENSSL_NO_ECDH */ #ifndef OPENSSL_NO_PSK if (type & SSL_kPSK) { /* * reserve size for record length and PSK identity hint */ n += 2 + strlen(s->ctx->psk_identity_hint); } else #endif /* !OPENSSL_NO_PSK */ #ifndef OPENSSL_NO_SRP if (type & SSL_kSRP) { if ((s->srp_ctx.N == NULL) || (s->srp_ctx.g == NULL) || (s->srp_ctx.s == NULL) || (s->srp_ctx.B == NULL)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_MISSING_SRP_PARAM); goto err; } r[0] = s->srp_ctx.N; r[1] = s->srp_ctx.g; r[2] = s->srp_ctx.s; r[3] = s->srp_ctx.B; } else #endif { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE); goto f_err; } for (i = 0; i < 4 && r[i] != NULL; i++) { nr[i] = BN_num_bytes(r[i]); #ifndef OPENSSL_NO_SRP if ((i == 2) && (type & SSL_kSRP)) n += 1 + nr[i]; else #endif n += 2 + nr[i]; } if (!(s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aSRP)) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { if ((pkey = ssl_get_sign_pkey(s, s->s3->tmp.new_cipher, &md)) == NULL) { al = SSL_AD_DECODE_ERROR; goto f_err; } kn = EVP_PKEY_size(pkey); } else { pkey = NULL; kn = 0; } if (!BUF_MEM_grow_clean(buf, n + SSL_HM_HEADER_LENGTH(s) + kn)) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_LIB_BUF); goto err; } d = p = ssl_handshake_start(s); for (i = 0; i < 4 && r[i] != NULL; i++) { #ifndef OPENSSL_NO_SRP if ((i == 2) && (type & SSL_kSRP)) { *p = nr[i]; p++; } else #endif s2n(nr[i], p); BN_bn2bin(r[i], p); p += nr[i]; } #ifndef OPENSSL_NO_ECDH if (type & SSL_kEECDH) { /* * XXX: For now, we only support named (not generic) curves. In * this situation, the serverKeyExchange message has: [1 byte * CurveType], [2 byte CurveName] [1 byte length of encoded * point], followed by the actual encoded point itself */ *p = NAMED_CURVE_TYPE; p += 1; *p = 0; p += 1; *p = curve_id; p += 1; *p = encodedlen; p += 1; memcpy((unsigned char *)p, (unsigned char *)encodedPoint, encodedlen); OPENSSL_free(encodedPoint); encodedPoint = NULL; p += encodedlen; } #endif #ifndef OPENSSL_NO_PSK if (type & SSL_kPSK) { /* copy PSK identity hint */ s2n(strlen(s->ctx->psk_identity_hint), p); strncpy((char *)p, s->ctx->psk_identity_hint, strlen(s->ctx->psk_identity_hint)); p += strlen(s->ctx->psk_identity_hint); } #endif /* not anonymous */ if (pkey != NULL) { /* * n is the length of the params, they start at &(d[4]) and p * points to the space at the end. */ #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA && !SSL_USE_SIGALGS(s)) { q = md_buf; j = 0; for (num = 2; num > 0; num--) { EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); if (EVP_DigestInit_ex(&md_ctx, (num == 2) ? s->ctx->md5 : s->ctx->sha1, NULL) <= 0 || EVP_DigestUpdate(&md_ctx, &(s->s3->client_random[0]), SSL3_RANDOM_SIZE) <= 0 || EVP_DigestUpdate(&md_ctx, &(s->s3->server_random[0]), SSL3_RANDOM_SIZE) <= 0 || EVP_DigestUpdate(&md_ctx, d, n) <= 0 || EVP_DigestFinal_ex(&md_ctx, q, (unsigned int *)&i) <= 0) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_LIB_EVP); al = SSL_AD_INTERNAL_ERROR; goto f_err; } q += i; j += i; } if (RSA_sign(NID_md5_sha1, md_buf, j, &(p[2]), &u, pkey->pkey.rsa) <= 0) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_LIB_RSA); goto err; } s2n(u, p); n += u + 2; } else #endif if (md) { /* send signature algorithm */ if (SSL_USE_SIGALGS(s)) { if (!tls12_get_sigandhash(p, pkey, md)) { /* Should never happen */ al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; } p += 2; } #ifdef SSL_DEBUG fprintf(stderr, "Using hash %s\n", EVP_MD_name(md)); #endif if (EVP_SignInit_ex(&md_ctx, md, NULL) <= 0 || EVP_SignUpdate(&md_ctx, &(s->s3->client_random[0]), SSL3_RANDOM_SIZE) <= 0 || EVP_SignUpdate(&md_ctx, &(s->s3->server_random[0]), SSL3_RANDOM_SIZE) <= 0 || EVP_SignUpdate(&md_ctx, d, n) <= 0 || EVP_SignFinal(&md_ctx, &(p[2]), (unsigned int *)&i, pkey) <= 0) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_LIB_EVP); al = SSL_AD_INTERNAL_ERROR; goto f_err; } s2n(i, p); n += i + 2; if (SSL_USE_SIGALGS(s)) n += 2; } else { /* Is this error check actually needed? */ al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, SSL_R_UNKNOWN_PKEY_TYPE); goto f_err; } } ssl_set_handshake_header(s, SSL3_MT_SERVER_KEY_EXCHANGE, n); } s->state = SSL3_ST_SW_KEY_EXCH_B; EVP_MD_CTX_cleanup(&md_ctx); return ssl_do_write(s); f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: #ifndef OPENSSL_NO_ECDH if (encodedPoint != NULL) OPENSSL_free(encodedPoint); BN_CTX_free(bn_ctx); #endif EVP_MD_CTX_cleanup(&md_ctx); s->state = SSL_ST_ERR; return (-1); }
0
382,580
p_count(p) register struct parse *p; { register int count = 0; register int ndigits = 0; while (MORE() && my_isdigit(p->charset,PEEK()) && count <= DUPMAX) { count = count*10 + (GETNEXT() - '0'); ndigits++; } if(REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR)) {} return(count); }
0
426,678
void release() { if (set_) { set_ = false; LeaveCriticalSection(cs_); } }
0
371,420
void ZrtpStateClass::evWaitConfirm2(void) { DEBUGOUT((cout << "Checking for match in WaitConfirm2.\n")); char *msg, first, secondLast, last; uint8_t *pkt; uint32_t errorCode = 0; if (event->type == ZrtpPacket) { pkt = event->packet; msg = (char *)pkt + 4; first = tolower(*msg); secondLast = tolower(*(msg+6)); last = tolower(*(msg+7)); /* * DHPart2 or Commit in multi stream mode: * - resend Confirm1 packet * - stay in state */ if ((first == 'd' && secondLast == '2') || (multiStream && (first == 'c' && last == ' '))) { if (!parent->sendPacketZRTP(sentPacket)) { sendFailed(); // returns to state Initial } return; } /* * Confirm2: * - prepare ConfAck * - switch on security (SRTP) * - switch to SecureState */ if (first == 'c' && last == '2') { ZrtpPacketConfirm cpkt(pkt); ZrtpPacketConf2Ack* confack = parent->prepareConf2Ack(&cpkt, &errorCode); // Something went wrong during processing of the confirm2 packet if (confack == NULL) { sendErrorPacket(errorCode); return; } sentPacket = static_cast<ZrtpPacketBase *>(confack); if (!parent->sendPacketZRTP(sentPacket)) { sendFailed(); // returns to state Initial return; } if (!parent->srtpSecretsReady(ForReceiver) || !parent->srtpSecretsReady(ForSender)) { parent->sendInfo(Severe, CriticalSWError); sendErrorPacket(CriticalSWError); return; } nextState(SecureState); parent->sendInfo(Info, InfoSecureStateOn); } } else { // unknown Event type for this state (covers Error and ZrtpClose) if (event->type != ZrtpClose) { parent->zrtpNegotiationFailed(Severe, SevereProtocolError); } sentPacket = NULL; nextState(Initial); } }
0
418,742
amgtar_selfcheck( application_argument_t *argument) { char *option; if (argument->dle.disk) { char *qdisk = quote_string(argument->dle.disk); fprintf(stdout, "OK disk %s\n", qdisk); amfree(qdisk); } printf("OK amgtar version %s\n", VERSION); amgtar_build_exinclude(&argument->dle, 1, NULL, NULL, NULL, NULL); printf("OK amgtar\n"); if ((option = validate_command_options(argument))) { fprintf(stdout, "ERROR [Invalid '%s' COMMAND-OPTIONS\n", option); } if (gnutar_path) { char *gnutar_realpath = NULL; if (check_file(gnutar_path, X_OK) && check_exec_for_suid("GNUTAR_PATH", gnutar_path, stdout, &gnutar_realpath)) { char *gtar_version; GPtrArray *argv_ptr = g_ptr_array_new(); g_ptr_array_add(argv_ptr, gnutar_realpath); g_ptr_array_add(argv_ptr, "--version"); g_ptr_array_add(argv_ptr, NULL); gtar_version = get_first_line(argv_ptr); if (gtar_version) { char *gv; for (gv = gtar_version; *gv && !g_ascii_isdigit(*gv); gv++); printf("OK amgtar gtar-version %s\n", gv); } else { printf(_("ERROR [Can't get %s version]\n"), gnutar_realpath); } g_ptr_array_free(argv_ptr, TRUE); amfree(gtar_version); } amfree(gnutar_realpath); } else { printf(_("ERROR [GNUTAR program not available]\n")); } if (gnutar_listdir && strlen(gnutar_listdir) == 0) gnutar_listdir = NULL; if (gnutar_listdir) { check_dir(gnutar_listdir, R_OK|W_OK); } else { printf(_("ERROR [No GNUTAR-LISTDIR]\n")); } set_root_privs(1); if (gnutar_directory) { check_dir(gnutar_directory, R_OK); } else if (argument->dle.device) { check_dir(argument->dle.device, R_OK); } if (argument->calcsize) { char *calcsize = vstralloc(amlibexecdir, "/", "calcsize", NULL); check_file(calcsize, X_OK); check_suid(calcsize); amfree(calcsize); } set_root_privs(0); }
0
510,377
my_decimal *Item_int::val_decimal(my_decimal *decimal_value) { int2my_decimal(E_DEC_FATAL_ERROR, value, unsigned_flag, decimal_value); return decimal_value; }
0
21,780
static int SpoolssAddForm_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) { dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ; guint32 level ; proto_item * hidden_item ; hidden_item = proto_tree_add_uint ( tree , hf_form , tvb , offset , 0 , 1 ) ; PROTO_ITEM_SET_HIDDEN ( hidden_item ) ; offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , NULL , NULL , FALSE , FALSE ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_form_level , & level ) ; col_append_fstr ( pinfo -> cinfo , COL_INFO , ", level %d" , level ) ; if ( ! pinfo -> fd -> flags . visited ) { dcv -> se_data = GUINT_TO_POINTER ( ( int ) level ) ; } offset = dissect_FORM_CTR ( tvb , offset , pinfo , tree , di , drep ) ; return offset ; }
0
259,543
static int setup_netdev(struct lxc_netdev *netdev) { char ifname[IFNAMSIZ]; char *current_ifname = ifname; int err; /* empty network namespace */ if (!netdev->ifindex) { if (netdev->flags & IFF_UP) { err = lxc_netdev_up("lo"); if (err) { ERROR("failed to set the loopback up : %s", strerror(-err)); return -1; } } if (netdev->type != LXC_NET_VETH) return 0; netdev->ifindex = if_nametoindex(netdev->name); } /* get the new ifindex in case of physical netdev */ if (netdev->type == LXC_NET_PHYS) { if (!(netdev->ifindex = if_nametoindex(netdev->link))) { ERROR("failed to get ifindex for %s", netdev->link); return -1; } } /* retrieve the name of the interface */ if (!if_indextoname(netdev->ifindex, current_ifname)) { ERROR("no interface corresponding to index '%d'", netdev->ifindex); return -1; } /* default: let the system to choose one interface name */ if (!netdev->name) netdev->name = netdev->type == LXC_NET_PHYS ? netdev->link : "eth%d"; /* rename the interface name */ if (strcmp(ifname, netdev->name) != 0) { err = lxc_netdev_rename_by_name(ifname, netdev->name); if (err) { ERROR("failed to rename %s->%s : %s", ifname, netdev->name, strerror(-err)); return -1; } } /* Re-read the name of the interface because its name has changed * and would be automatically allocated by the system */ if (!if_indextoname(netdev->ifindex, current_ifname)) { ERROR("no interface corresponding to index '%d'", netdev->ifindex); return -1; } /* set a mac address */ if (netdev->hwaddr) { if (setup_hw_addr(netdev->hwaddr, current_ifname)) { ERROR("failed to setup hw address for '%s'", current_ifname); return -1; } } /* setup ipv4 addresses on the interface */ if (setup_ipv4_addr(&netdev->ipv4, netdev->ifindex)) { ERROR("failed to setup ip addresses for '%s'", ifname); return -1; } /* setup ipv6 addresses on the interface */ if (setup_ipv6_addr(&netdev->ipv6, netdev->ifindex)) { ERROR("failed to setup ipv6 addresses for '%s'", ifname); return -1; } /* set the network device up */ if (netdev->flags & IFF_UP) { int err; err = lxc_netdev_up(current_ifname); if (err) { ERROR("failed to set '%s' up : %s", current_ifname, strerror(-err)); return -1; } /* the network is up, make the loopback up too */ err = lxc_netdev_up("lo"); if (err) { ERROR("failed to set the loopback up : %s", strerror(-err)); return -1; } } /* We can only set up the default routes after bringing * up the interface, sine bringing up the interface adds * the link-local routes and we can't add a default * route if the gateway is not reachable. */ /* setup ipv4 gateway on the interface */ if (netdev->ipv4_gateway) { if (!(netdev->flags & IFF_UP)) { ERROR("Cannot add ipv4 gateway for %s when not bringing up the interface", ifname); return -1; } if (lxc_list_empty(&netdev->ipv4)) { ERROR("Cannot add ipv4 gateway for %s when not assigning an address", ifname); return -1; } err = lxc_ipv4_gateway_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { err = lxc_ipv4_dest_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { ERROR("failed to add ipv4 dest for '%s': %s", ifname, strerror(-err)); } err = lxc_ipv4_gateway_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { ERROR("failed to setup ipv4 gateway for '%s': %s", ifname, strerror(-err)); if (netdev->ipv4_gateway_auto) { char buf[INET_ADDRSTRLEN]; inet_ntop(AF_INET, netdev->ipv4_gateway, buf, sizeof(buf)); ERROR("tried to set autodetected ipv4 gateway '%s'", buf); } return -1; } } } /* setup ipv6 gateway on the interface */ if (netdev->ipv6_gateway) { if (!(netdev->flags & IFF_UP)) { ERROR("Cannot add ipv6 gateway for %s when not bringing up the interface", ifname); return -1; } if (lxc_list_empty(&netdev->ipv6) && !IN6_IS_ADDR_LINKLOCAL(netdev->ipv6_gateway)) { ERROR("Cannot add ipv6 gateway for %s when not assigning an address", ifname); return -1; } err = lxc_ipv6_gateway_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { err = lxc_ipv6_dest_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { ERROR("failed to add ipv6 dest for '%s': %s", ifname, strerror(-err)); } err = lxc_ipv6_gateway_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { ERROR("failed to setup ipv6 gateway for '%s': %s", ifname, strerror(-err)); if (netdev->ipv6_gateway_auto) { char buf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, netdev->ipv6_gateway, buf, sizeof(buf)); ERROR("tried to set autodetected ipv6 gateway '%s'", buf); } return -1; } } } DEBUG("'%s' has been setup", current_ifname); return 0; }
0
460,567
static int parseTreeDelete ( Operation *op, SlapReply *rs, LDAPControl *ctrl ) { if ( op->o_tree_delete != SLAP_CONTROL_NONE ) { rs->sr_text = "treeDelete control specified multiple times"; return LDAP_PROTOCOL_ERROR; } if ( !BER_BVISNULL( &ctrl->ldctl_value )) { rs->sr_text = "treeDelete control value not absent"; return LDAP_PROTOCOL_ERROR; } op->o_tree_delete = ctrl->ldctl_iscritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL; return LDAP_SUCCESS; }
0
493,057
void PM_io_parser<PMDEC>::dump(const PMDEC& D, std::ostream& os) { PM_io_parser<PMDEC> Out(os,D); Out.print(); }
0
283,081
explicit TaskManagerTableModel(TaskManagerModel* model) : model_(model), observer_(NULL) { model_->AddObserver(this); }
0
25,869
static VALUE mHash_to_json ( int argc , VALUE * argv , VALUE self ) { GENERATE_JSON ( object ) ; }
0
20,240
void unireg_end ( void ) { clean_up ( 1 ) ; my_thread_end ( ) ; # if defined ( SIGNALS_DONT_BREAK_READ ) exit ( 0 ) ; # else pthread_exit ( 0 ) ; # endif }
0
138,394
point_inside(Point *p, int npts, Point *plist) { double x0, y0; double prev_x, prev_y; int i = 0; double x, y; int cross, total_cross = 0; if (npts <= 0) return 0; /* compute first polygon point relative to single point */ x0 = plist[0].x - p->x; y0 = plist[0].y - p->y; prev_x = x0; prev_y = y0; /* loop over polygon points and aggregate total_cross */ for (i = 1; i < npts; i++) { /* compute next polygon point relative to single point */ x = plist[i].x - p->x; y = plist[i].y - p->y; /* compute previous to current point crossing */ if ((cross = lseg_crossing(x, y, prev_x, prev_y)) == POINT_ON_POLYGON) return 2; total_cross += cross; prev_x = x; prev_y = y; } /* now do the first point */ if ((cross = lseg_crossing(x0, y0, prev_x, prev_y)) == POINT_ON_POLYGON) return 2; total_cross += cross; if (total_cross != 0) return 1; return 0; }
0
84,061
static int ntop_get_interface_local_flows_info(lua_State* vm) { return(ntop_get_interface_flows(vm, location_local_only)); }
0
289,227
static void stroke_unroute ( private_stroke_socket_t * this , stroke_msg_t * msg , FILE * out ) { pop_string ( msg , & msg -> terminate . name ) ; DBG1 ( DBG_CFG , "received stroke: unroute '%s'" , msg -> route . name ) ; this -> control -> unroute ( this -> control , msg , out ) ; }
0
43,294
do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh) { struct svc_fh *current_fh = &cstate->current_fh; int accmode; __be32 status; *resfh = kmalloc(sizeof(struct svc_fh), GFP_KERNEL); if (!*resfh) return nfserr_jukebox; fh_init(*resfh, NFS4_FHSIZE); open->op_truncate = 0; if (open->op_create) { /* FIXME: check session persistence and pnfs flags. * The nfsv4.1 spec requires the following semantics: * * Persistent | pNFS | Server REQUIRED | Client Allowed * Reply Cache | server | | * -------------+--------+-----------------+-------------------- * no | no | EXCLUSIVE4_1 | EXCLUSIVE4_1 * | | | (SHOULD) * | | and EXCLUSIVE4 | or EXCLUSIVE4 * | | | (SHOULD NOT) * no | yes | EXCLUSIVE4_1 | EXCLUSIVE4_1 * yes | no | GUARDED4 | GUARDED4 * yes | yes | GUARDED4 | GUARDED4 */ /* * Note: create modes (UNCHECKED,GUARDED...) are the same * in NFSv4 as in v3 except EXCLUSIVE4_1. */ status = do_nfsd_create(rqstp, current_fh, open->op_fname.data, open->op_fname.len, &open->op_iattr, *resfh, open->op_createmode, (u32 *)open->op_verf.data, &open->op_truncate, &open->op_created); if (!status && open->op_label.len) nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval); /* * Following rfc 3530 14.2.16, and rfc 5661 18.16.4 * use the returned bitmask to indicate which attributes * we used to store the verifier: */ if (nfsd_create_is_exclusive(open->op_createmode) && status == 0) open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_MODIFY); } else /* * Note this may exit with the parent still locked. * We will hold the lock until nfsd4_open's final * lookup, to prevent renames or unlinks until we've had * a chance to an acquire a delegation if appropriate. */ status = nfsd_lookup(rqstp, current_fh, open->op_fname.data, open->op_fname.len, *resfh); if (status) goto out; status = nfsd_check_obj_isreg(*resfh); if (status) goto out; if (is_create_with_attrs(open) && open->op_acl != NULL) do_set_nfs4_acl(rqstp, *resfh, open->op_acl, open->op_bmval); nfsd4_set_open_owner_reply_cache(cstate, open, *resfh); accmode = NFSD_MAY_NOP; if (open->op_created || open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) accmode |= NFSD_MAY_OWNER_OVERRIDE; status = do_open_permission(rqstp, *resfh, open, accmode); set_change_info(&open->op_cinfo, current_fh); out: return status; }
0
124,875
static int doport3(const int protocol) { struct sockaddr_storage dataconn; /* his endpoint */ # ifndef NON_ROOT_FTP static const in_port_t portlist[] = FTP_ACTIVE_SOURCE_PORTS; const in_port_t *portlistpnt = portlist; # else static const in_port_t portlist[] = { 0U }; const in_port_t *portlistpnt = portlist; # endif int on; # ifndef NON_ROOT_FTP disablesignals(); seteuid((uid_t) 0); # endif if ((datafd = socket(protocol, SOCK_STREAM, IPPROTO_TCP)) == -1) { data_socket_error: # ifndef NON_ROOT_FTP if (seteuid(authresult.uid) != 0) { _EXIT(EXIT_FAILURE); } enablesignals(); # endif (void) close(datafd); datafd = -1; error(425, MSG_CANT_CREATE_DATA_SOCKET); return -1; } on = 1; # ifdef SO_REUSEPORT (void) setsockopt(datafd, SOL_SOCKET, SO_REUSEPORT, (char *) &on, sizeof on); # else (void) setsockopt(datafd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof on); # endif memcpy(&dataconn, &ctrlconn, sizeof dataconn); for (;;) { if (STORAGE_FAMILY(dataconn) == AF_INET6) { STORAGE_PORT6(dataconn) = htons(*portlistpnt); } else { STORAGE_PORT(dataconn) = htons(*portlistpnt); } if (bind(datafd, (struct sockaddr *) &dataconn, STORAGE_LEN(dataconn)) == 0) { break; } # ifdef USE_ONLY_FIXED_DATA_PORT (void) sleep(1U); # else if (*portlistpnt == (in_port_t) 0U) { goto data_socket_error; } portlistpnt++; # endif } # ifndef NON_ROOT_FTP if (seteuid(authresult.uid) != 0) { _EXIT(EXIT_FAILURE); } enablesignals(); # endif return 0; }
0
82,075
find_lively_task_by_vpid(pid_t vpid) { struct task_struct *task; int err; rcu_read_lock(); if (!vpid) task = current; else task = find_task_by_vpid(vpid); if (task) get_task_struct(task); rcu_read_unlock(); if (!task) return ERR_PTR(-ESRCH); /* Reuse ptrace permission checks for now. */ err = -EACCES; if (!ptrace_may_access(task, PTRACE_MODE_READ)) goto errout; return task; errout: put_task_struct(task); return ERR_PTR(err); }
0
296,474
static __always_inline bool bpf_tree_less(struct latch_tree_node *a, struct latch_tree_node *b) { return bpf_get_prog_addr_start(a) < bpf_get_prog_addr_start(b); }
0
446,682
virDomainHostdevMatchCapsMisc(virDomainHostdevDefPtr a, virDomainHostdevDefPtr b) { return STREQ_NULLABLE(a->source.caps.u.misc.chardev, b->source.caps.u.misc.chardev); }
0
463,758
void intel_pmu_pebs_enable(struct perf_event *event) { struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); struct hw_perf_event *hwc = &event->hw; struct debug_store *ds = cpuc->ds; hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT; cpuc->pebs_enabled |= 1ULL << hwc->idx; if ((event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT) && (x86_pmu.version < 5)) cpuc->pebs_enabled |= 1ULL << (hwc->idx + 32); else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST) cpuc->pebs_enabled |= 1ULL << 63; if (x86_pmu.intel_cap.pebs_baseline) { hwc->config |= ICL_EVENTSEL_ADAPTIVE; if (cpuc->pebs_data_cfg != cpuc->active_pebs_data_cfg) { wrmsrl(MSR_PEBS_DATA_CFG, cpuc->pebs_data_cfg); cpuc->active_pebs_data_cfg = cpuc->pebs_data_cfg; } } /* * Use auto-reload if possible to save a MSR write in the PMI. * This must be done in pmu::start(), because PERF_EVENT_IOC_PERIOD. */ if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD) { unsigned int idx = hwc->idx; if (idx >= INTEL_PMC_IDX_FIXED) idx = MAX_PEBS_EVENTS + (idx - INTEL_PMC_IDX_FIXED); ds->pebs_event_reset[idx] = (u64)(-hwc->sample_period) & x86_pmu.cntval_mask; } else { ds->pebs_event_reset[hwc->idx] = 0; } intel_pmu_pebs_via_pt_enable(event); }
0
255,640
int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v) { int m; /* We can reliably put at most 31 bits since ISO/IEC 9899 only guarantees that a long can represent values up to 2^31-1. */ assert(n >= 0 && n < 32); /* Ensure that only the bits to be output are nonzero. */ assert(!(v & (~JAS_ONES(n)))); /* Put the desired number of bits to the specified bit stream. */ m = n - 1; while (--n >= 0) { if (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) { return EOF; } v <<= 1; } return 0; }
1
457,134
p11_rpc_buffer_get_attribute_array_value (p11_buffer *buffer, size_t *offset, void *value, CK_ULONG *value_length) { uint32_t count, i; CK_ATTRIBUTE *attr, temp; if (!p11_rpc_buffer_get_uint32 (buffer, offset, &count)) return false; if (!value) { memset (&temp, 0, sizeof (CK_ATTRIBUTE)); attr = &temp; } else attr = value; for (i = 0; i < count; i++) { if (!p11_rpc_buffer_get_attribute (buffer, offset, attr)) return false; if (value) attr++; } if (value_length) *value_length = count * sizeof (CK_ATTRIBUTE); return true; }
0
97,873
const char *proxytype(proxytypes_t proxytype) { int i; for (i = 0; proxynames[i].name; i++) if (proxynames[i].proxytype == proxytype) return proxynames[i].name; return "invalid"; }
0
168,283
bool GLES2DecoderImpl::HasMoreIdleWork() const { return !pending_readpixel_fences_.empty() || gpu_tracer_->HasTracesToProcess() || !texture_refs_pending_destruction_.empty(); }
0
47,170
void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, struct ipv4_devconf *devconf) { struct sk_buff *skb; int err = -ENOBUFS; skb = nlmsg_new(inet_netconf_msgsize_devconf(type), GFP_ATOMIC); if (!skb) goto errout; err = inet_netconf_fill_devconf(skb, ifindex, devconf, 0, 0, RTM_NEWNETCONF, 0, type); if (err < 0) { /* -EMSGSIZE implies BUG in inet_netconf_msgsize_devconf() */ WARN_ON(err == -EMSGSIZE); kfree_skb(skb); goto errout; } rtnl_notify(skb, net, 0, RTNLGRP_IPV4_NETCONF, NULL, GFP_ATOMIC); return; errout: if (err < 0) rtnl_set_sk_err(net, RTNLGRP_IPV4_NETCONF, err); }
0
456,785
__add_partial(struct kmem_cache_node *n, struct page *page, int tail) { n->nr_partial++; if (tail == DEACTIVATE_TO_TAIL) list_add_tail(&page->slab_list, &n->partial); else list_add(&page->slab_list, &n->partial); }
0
282,447
virtual void AnimationProgressed(const ui::Animation* animation) { TabAnimation::AnimationProgressed(animation); int x = animation_.CurrentValueBetween(start_bounds_.x(), target_bounds_.x()); int width = animation_.CurrentValueBetween(start_bounds_.width(), target_bounds_.width()); gfx::Rect tab_bounds(x, start_bounds_.y(), width, start_bounds_.height()); tabstrip_->SetTabBounds(tab_, tab_bounds); }
0
440,910
vnc_display_setup_auth(int *auth, int *subauth, QCryptoTLSCreds *tlscreds, bool password, bool sasl, bool websocket, Error **errp) { /* * We have a choice of 3 authentication options * * 1. none * 2. vnc * 3. sasl * * The channel can be run in 2 modes * * 1. clear * 2. tls * * And TLS can use 2 types of credentials * * 1. anon * 2. x509 * * We thus have 9 possible logical combinations * * 1. clear + none * 2. clear + vnc * 3. clear + sasl * 4. tls + anon + none * 5. tls + anon + vnc * 6. tls + anon + sasl * 7. tls + x509 + none * 8. tls + x509 + vnc * 9. tls + x509 + sasl * * These need to be mapped into the VNC auth schemes * in an appropriate manner. In regular VNC, all the * TLS options get mapped into VNC_AUTH_VENCRYPT * sub-auth types. * * In websockets, the https:// protocol already provides * TLS support, so there is no need to make use of the * VeNCrypt extension. Furthermore, websockets browser * clients could not use VeNCrypt even if they wanted to, * as they cannot control when the TLS handshake takes * place. Thus there is no option but to rely on https://, * meaning combinations 4->6 and 7->9 will be mapped to * VNC auth schemes in the same way as combos 1->3. * * Regardless of fact that we have a different mapping to * VNC auth mechs for plain VNC vs websockets VNC, the end * result has the same security characteristics. */ if (websocket || !tlscreds) { if (password) { VNC_DEBUG("Initializing VNC server with password auth\n"); *auth = VNC_AUTH_VNC; } else if (sasl) { VNC_DEBUG("Initializing VNC server with SASL auth\n"); *auth = VNC_AUTH_SASL; } else { VNC_DEBUG("Initializing VNC server with no auth\n"); *auth = VNC_AUTH_NONE; } *subauth = VNC_AUTH_INVALID; } else { bool is_x509 = object_dynamic_cast(OBJECT(tlscreds), TYPE_QCRYPTO_TLS_CREDS_X509) != NULL; bool is_anon = object_dynamic_cast(OBJECT(tlscreds), TYPE_QCRYPTO_TLS_CREDS_ANON) != NULL; if (!is_x509 && !is_anon) { error_setg(errp, "Unsupported TLS cred type %s", object_get_typename(OBJECT(tlscreds))); return -1; } *auth = VNC_AUTH_VENCRYPT; if (password) { if (is_x509) { VNC_DEBUG("Initializing VNC server with x509 password auth\n"); *subauth = VNC_AUTH_VENCRYPT_X509VNC; } else { VNC_DEBUG("Initializing VNC server with TLS password auth\n"); *subauth = VNC_AUTH_VENCRYPT_TLSVNC; } } else if (sasl) { if (is_x509) { VNC_DEBUG("Initializing VNC server with x509 SASL auth\n"); *subauth = VNC_AUTH_VENCRYPT_X509SASL; } else { VNC_DEBUG("Initializing VNC server with TLS SASL auth\n"); *subauth = VNC_AUTH_VENCRYPT_TLSSASL; } } else { if (is_x509) { VNC_DEBUG("Initializing VNC server with x509 no auth\n"); *subauth = VNC_AUTH_VENCRYPT_X509NONE; } else { VNC_DEBUG("Initializing VNC server with TLS no auth\n"); *subauth = VNC_AUTH_VENCRYPT_TLSNONE; } } } return 0; }
0
193,867
EntryFolderFeature(bool is_machine_root, bool is_arbitrary_sync_folder, bool is_external_media) : is_machine_root(is_machine_root), is_arbitrary_sync_folder(is_arbitrary_sync_folder), is_external_media(is_external_media) {}
0
161,340
static void virtio_serial_port_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_INPUT, k->categories); k->bus_type = TYPE_VIRTIO_SERIAL_BUS; k->realize = virtser_port_device_realize; k->unrealize = virtser_port_device_unrealize; k->props = virtser_props; }
0
57,347
static int nl80211_valid_4addr(struct cfg80211_registered_device *rdev, struct net_device *netdev, u8 use_4addr, enum nl80211_iftype iftype) { if (!use_4addr) { if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT)) return -EBUSY; return 0; } switch (iftype) { case NL80211_IFTYPE_AP_VLAN: if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP) return 0; break; case NL80211_IFTYPE_STATION: if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_STATION) return 0; break; default: break; } return -EOPNOTSUPP; }
0
393,971
static int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) { u64 rt_runtime, rt_period; rt_period = rt_period_us * NSEC_PER_USEC; rt_runtime = tg->rt_bandwidth.rt_runtime; return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); }
0
131,933
static int binder_put_node_cmd(struct binder_proc *proc, struct binder_thread *thread, void __user **ptrp, binder_uintptr_t node_ptr, binder_uintptr_t node_cookie, int node_debug_id, uint32_t cmd, const char *cmd_name) { void __user *ptr = *ptrp; if (put_user(cmd, (uint32_t __user *)ptr)) return -EFAULT; ptr += sizeof(uint32_t); if (put_user(node_ptr, (binder_uintptr_t __user *)ptr)) return -EFAULT; ptr += sizeof(binder_uintptr_t); if (put_user(node_cookie, (binder_uintptr_t __user *)ptr)) return -EFAULT; ptr += sizeof(binder_uintptr_t); binder_stat_br(proc, thread, cmd); binder_debug(BINDER_DEBUG_USER_REFS, "%d:%d %s %d u%016llx c%016llx\n", proc->pid, thread->pid, cmd_name, node_debug_id, (u64)node_ptr, (u64)node_cookie); *ptrp = ptr; return 0; }
0
382,482
prepare_for_client_read(void) { if (DoingCommandRead) { /* Enable immediate processing of asynchronous signals */ EnableNotifyInterrupt(); EnableCatchupInterrupt(); /* Allow die interrupts to be processed while waiting */ ImmediateInterruptOK = true; /* And don't forget to detect one that already arrived */ CHECK_FOR_INTERRUPTS(); } }
0
223,277
gx_dc_binary_masked_load(gx_device_color * pdevc, const gs_gstate * pgs, gx_device * dev, gs_color_select_t select) { int code = (*gx_dc_type_data_ht_binary.load) (pdevc, pgs, dev, select); if (code < 0) return code; FINISH_PATTERN_LOAD }
0
323,463
void bdrv_io_limits_enable(BlockDriverState *bs) { qemu_co_queue_init(&bs->throttled_reqs); bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs); bs->io_limits_enabled = true; }
0
214,706
double EglRenderingVDAClient::frames_per_second() { base::TimeDelta delta = last_frame_delivered_ticks_ - initialize_done_ticks_; if (delta.InSecondsF() == 0) return 0; return num_decoded_frames_ / delta.InSecondsF(); }
0
114,919
Status ConstantFolding::MaterializeBroadcastGradientArgs( const NodeDef& node, const GraphProperties& properties) { const NodeDef* shape_node1 = node_map_->GetNode(node.input(0)); const NodeDef* shape_node2 = node_map_->GetNode(node.input(1)); if (shape_node1 == nullptr || (shape_node1->op() != "Shape" && !IsReallyConstant(*shape_node1)) || shape_node2 == nullptr || (shape_node2->op() != "Shape" && !IsReallyConstant(*shape_node2))) { return Status::OK(); } // Don't optimize this again if it was already optimized and folded. if (OptimizedNodeExists(node, "-folded-1") || OptimizedNodeExists(node, "-folded-2")) { return Status::OK(); } int64_t min_id = 0; BCast::Vec shape1; if (!ExtractShape(*shape_node1, properties, &shape1, &min_id)) { return Status::OK(); } BCast::Vec shape2; if (!ExtractShape(*shape_node2, properties, &shape2, &min_id)) { return Status::OK(); } // A value of -1 means we don't known anything about the dimension. Replace // the -1 values with unique dimension ids since we don't want two '-1' // dimensions to be considered equal. for (auto& id : shape1) { if (id == -1) { id = --min_id; } } for (auto& id : shape2) { if (id == -1) { id = --min_id; } } // Beware: the reduction dimensions computed by the BCast class are valid iff // we assume that two distinct symbolic dimensions can't be equal and a // symbolic dimension can't be equal to 1. This is often but not always true, // so to make this optimization safe we filter out these cases. const int common_dims = std::min(shape1.size(), shape2.size()); for (int i = 0; i < common_dims; ++i) { if (shape1[i] >= 0 && shape2[i] >= 0) { continue; } if (shape1[i] != shape2[i]) { // We're either dealing with 2 different symbolic dimensions or a symbolic // and a know dimensions. We can't be sure whether both are equal or not, // so we can't be sure whether we'll be broadcasting or not. return Status::OK(); } } // These extra dims could be equal to 1, in which case there is no // broadcasting. It could also be greater than 1, in which case there would // be broadcasting. Since we don't know, we'll just punt. for (int i = common_dims, end = shape1.size(); i < end; ++i) { if (shape1[i] < 0) { return Status::OK(); } } for (int i = common_dims, end = shape2.size(); i < end; ++i) { if (shape2[i] < 0) { return Status::OK(); } } BCast bcast(shape1, shape2); if (!bcast.IsValid()) { return Status::OK(); } BCast::Vec reduce_dims[2]; reduce_dims[0] = bcast.grad_x_reduce_idx(); reduce_dims[1] = bcast.grad_y_reduce_idx(); TF_RETURN_IF_ERROR(CheckAttrExists(node, "T")); const DataType type = node.attr().at("T").type(); NodeDef* out[2]; for (int j = 0; j < 2; ++j) { int reduction_indices = reduce_dims[j].size(); Tensor value(type, TensorShape({reduction_indices})); for (int i = 0; i < reduction_indices; ++i) { if (type == DT_INT32) { value.vec<int32>()(i) = reduce_dims[j][i]; } else { value.vec<int64_t>()(i) = reduce_dims[j][i]; } } string const_name = OptimizedNodeName(node, strings::StrCat("-bcastargs-", j)); out[j] = node_map_->GetNode(const_name); if (out[j] == nullptr) { out[j] = graph_->add_node(); TF_RETURN_IF_ERROR( CreateNodeDef(const_name, TensorValue(&value), out[j])); out[j]->set_device(node.device()); node_map_->AddNode(const_name, out[j]); string ctrl_dep = AddControlDependency(node.name(), graph_, node_map_.get()); *out[j]->add_input() = ctrl_dep; node_map_->AddOutput(NodeName(ctrl_dep), const_name); } } // We make a copy here since we might mutate the set. const auto outputs = node_map_->GetOutputs(node.name()); for (NodeDef* output : outputs) { for (int k = 0; k < output->input_size(); ++k) { int port; string node_name = ParseNodeName(output->input(k), &port); if (node_name == node.name() && port >= 0 && port < 2 && out[port]) { *output->mutable_input(k) = out[port]->name(); node_map_->UpdateInput(output->name(), node_name, out[port]->name()); } } } return Status::OK(); }
0
331,657
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } return 0; }
1
427,621
push_handlers (void) { orig_error_handler = TIFFSetErrorHandler (NULL); orig_warning_handler = TIFFSetWarningHandler (NULL); }
0
290,322
void xps_parse_brush ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , fz_xml * node ) { if ( doc -> cookie && doc -> cookie -> abort ) return ; if ( ! strcmp ( fz_xml_tag ( node ) , "ImageBrush" ) ) xps_parse_image_brush ( doc , ctm , area , base_uri , dict , node ) ; else if ( ! strcmp ( fz_xml_tag ( node ) , "VisualBrush" ) ) xps_parse_visual_brush ( doc , ctm , area , base_uri , dict , node ) ; else if ( ! strcmp ( fz_xml_tag ( node ) , "LinearGradientBrush" ) ) xps_parse_linear_gradient_brush ( doc , ctm , area , base_uri , dict , node ) ; else if ( ! strcmp ( fz_xml_tag ( node ) , "RadialGradientBrush" ) ) xps_parse_radial_gradient_brush ( doc , ctm , area , base_uri , dict , node ) ; else fz_warn ( doc -> ctx , "unknown brush tag: %s" , fz_xml_tag ( node ) ) ; }
0
119,267
extern "C" char *my_demangle(const char *mangled_name, int *status) { return abi::__cxa_demangle(mangled_name, NULL, NULL, status); }
0
308,761
float AXNodeObject::stepValueForRange() const { if (!isNativeSlider()) return 0.0; Decimal step = toHTMLInputElement(*getNode()).createStepRange(RejectAny).step(); return step.toString().toFloat(); }
0
252,097
static void sapi_update_response_code(int ncode TSRMLS_DC) { /* if the status code did not change, we do not want to change the status line, and no need to change the code */ if (SG(sapi_headers).http_response_code == ncode) { return; } if (SG(sapi_headers).http_status_line) { efree(SG(sapi_headers).http_status_line); SG(sapi_headers).http_status_line = NULL; } SG(sapi_headers).http_response_code = ncode; }
0