idx
int64 | func
string | target
int64 |
|---|---|---|
502,242
|
WERROR dns_common_extract(struct ldb_context *samdb,
const struct ldb_message_element *el,
TALLOC_CTX *mem_ctx,
struct dnsp_DnssrvRpcRecord **records,
uint16_t *num_records)
{
uint16_t ri;
struct dnsp_DnssrvRpcRecord *recs;
*records = NULL;
*num_records = 0;
recs = talloc_zero_array(mem_ctx, struct dnsp_DnssrvRpcRecord,
el->num_values);
if (recs == NULL) {
return WERR_NOT_ENOUGH_MEMORY;
}
for (ri = 0; ri < el->num_values; ri++) {
bool am_rodc;
int ret;
const char *dnsHostName = NULL;
struct ldb_val *v = &el->values[ri];
enum ndr_err_code ndr_err;
ndr_err = ndr_pull_struct_blob(v, recs, &recs[ri],
(ndr_pull_flags_fn_t)ndr_pull_dnsp_DnssrvRpcRecord);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
TALLOC_FREE(recs);
DEBUG(0, ("Failed to grab dnsp_DnssrvRpcRecord\n"));
return DNS_ERR(SERVER_FAILURE);
}
/*
* In AD, except on an RODC (where we should list a random RWDC,
* we should over-stamp the MNAME with our own hostname
*/
if (recs[ri].wType != DNS_TYPE_SOA) {
continue;
}
ret = samdb_rodc(samdb, &am_rodc);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to confirm we are not an RODC: %s\n",
ldb_errstring(samdb)));
return DNS_ERR(SERVER_FAILURE);
}
if (am_rodc) {
continue;
}
ret = samdb_dns_host_name(samdb, &dnsHostName);
if (ret != LDB_SUCCESS || dnsHostName == NULL) {
DEBUG(0, ("Failed to get dnsHostName from rootDSE"));
return DNS_ERR(SERVER_FAILURE);
}
recs[ri].data.soa.mname = talloc_strdup(recs, dnsHostName);
}
*records = recs;
*num_records = el->num_values;
return WERR_OK;
}
| 0
|
218,305
|
void OnDestroy(GtkDialog* dialog, PageInfoWindowGtk* page_info) {
delete page_info;
}
| 0
|
18,915
|
static char * * subsystems_from_mount_options ( const char * mount_options , char * * kernel_list ) {
char * token , * str , * saveptr = NULL ;
char * * result = NULL ;
size_t result_capacity = 0 ;
size_t result_count = 0 ;
int saved_errno ;
int r ;
str = alloca ( strlen ( mount_options ) + 1 ) ;
strcpy ( str , mount_options ) ;
for ( ;
( token = strtok_r ( str , "," , & saveptr ) ) ;
str = NULL ) {
if ( ! strncmp ( token , "name=" , 5 ) || lxc_string_in_array ( token , ( const char * * ) kernel_list ) ) {
r = lxc_grow_array ( ( void * * * ) & result , & result_capacity , result_count + 1 , 12 ) ;
if ( r < 0 ) goto out_free ;
result [ result_count + 1 ] = NULL ;
result [ result_count ] = strdup ( token ) ;
if ( ! result [ result_count ] ) goto out_free ;
result_count ++ ;
}
}
return result ;
out_free : saved_errno = errno ;
lxc_free_array ( ( void * * ) result , free ) ;
errno = saved_errno ;
return NULL ;
}
| 0
|
439,304
|
static u8 dccp_feat_sp_list_ok(u8 feat_num, u8 const *sp_list, u8 sp_len)
{
if (sp_list == NULL || sp_len < 1)
return 0;
while (sp_len--)
if (!dccp_feat_is_valid_sp_val(feat_num, *sp_list++))
return 0;
return 1;
}
| 0
|
339,643
|
static void mov_update_dts_shift(MOVStreamContext *sc, int duration)
{
if (duration < 0) {
sc->dts_shift = FFMAX(sc->dts_shift, -duration);
| 1
|
176,772
|
static void RunAutofocusTask(ExecutionContext* context) {
if (!context)
return;
Document* document = To<Document>(context);
if (Element* element = document->AutofocusElement()) {
document->SetAutofocusElement(nullptr);
element->focus();
}
}
| 0
|
348,426
|
static struct db_arg_chain_tree *_db_tree_get(struct db_arg_chain_tree *tree)
{
struct db_arg_chain_tree *iter;
if (tree->nxt_t) {
iter = tree->nxt_t;
while (iter->lvl_prv != NULL)
iter = iter->lvl_prv;
do {
_db_tree_get(iter);
iter = iter->lvl_nxt;
} while (iter != NULL);
}
if (tree->nxt_f) {
iter = tree->nxt_f;
while (iter->lvl_prv != NULL)
iter = iter->lvl_prv;
do {
_db_tree_get(iter);
iter = iter->lvl_nxt;
} while (iter != NULL);
}
return _db_node_get(tree);
}
| 1
|
364,574
|
int service_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
char **envp __attribute__((unused)))
{
int opt;
const char *prefix;
initialize_nntp_error_table();
if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
setproctitle_init(argc, argv, envp);
/* set signal handlers */
signals_set_shutdown(&shut_down);
signal(SIGPIPE, SIG_IGN);
/* load the SASL plugins */
global_sasl_init(1, 1, mysasl_cb);
if ((prefix = config_getstring(IMAPOPT_NEWSPREFIX)))
snprintf(newsprefix, sizeof(newsprefix), "%s.", prefix);
newsgroups = split_wildmats((char *) config_getstring(IMAPOPT_NEWSGROUPS));
/* initialize duplicate delivery database */
if (duplicate_init(NULL, 0) != 0) {
syslog(LOG_ERR,
"unable to init duplicate delivery database\n");
fatal("unable to init duplicate delivery database", EC_SOFTWARE);
}
/* open the mboxlist, we'll need it for real work */
mboxlist_init(0);
mboxlist_open(NULL);
/* open the quota db, we'll need it for expunge */
quotadb_init(0);
quotadb_open(NULL);
/* open the user deny db */
denydb_init(0);
denydb_open(NULL);
/* setup for sending IMAP IDLE notifications */
idle_enabled();
while ((opt = getopt(argc, argv, "srfp:")) != EOF) {
switch(opt) {
case 's': /* nntps (do starttls right away) */
nntps = 1;
if (!tls_enabled()) {
syslog(LOG_ERR, "nntps: required OpenSSL options not present");
fatal("nntps: required OpenSSL options not present",
EC_CONFIG);
}
break;
case 'r': /* enter reader-only mode */
nntp_capa = MODE_READ;
break;
case 'f': /* enter feeder-only mode */
nntp_capa = MODE_FEED;
break;
case 'p': /* external protection */
extprops_ssf = atoi(optarg);
break;
default:
usage();
}
}
/* Initialize the annotatemore extention */
annotatemore_init(NULL, NULL);
annotatemore_open();
newsmaster = (char *) config_getstring(IMAPOPT_NEWSMASTER);
newsmaster_authstate = auth_newstate(newsmaster);
singleinstance = config_getswitch(IMAPOPT_SINGLEINSTANCESTORE);
/* Create a protgroup for input from the client and selected backend */
protin = protgroup_new(2);
return 0;
}
| 0
|
97,737
|
static int r_cmd_java_print_field_summary (RBinJavaObj *obj, ut16 idx) {
int res = r_bin_java_print_field_idx_summary (obj, idx);
if (res == false) {
eprintf ("Error: Field or Method @ index (%d) not found in the RBinJavaObj.\n", idx);
res = true;
}
return res;
}
| 0
|
235,500
|
void InstallTemplateURLWithNewTabPage(GURL new_tab_page_url) {
TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile(),
base::BindRepeating(&TemplateURLServiceFactory::BuildInstanceFor));
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(browser()->profile());
search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service);
TemplateURLData data;
data.SetShortName(base::ASCIIToUTF16("foo.com"));
data.SetURL("http://foo.com/url?bar={searchTerms}");
data.new_tab_url = new_tab_page_url.spec();
TemplateURL* template_url =
template_url_service->Add(std::make_unique<TemplateURL>(data));
template_url_service->SetUserSelectedDefaultSearchProvider(template_url);
}
| 0
|
72,081
|
static int _sx_sasl_gsasl_callback(Gsasl *gsasl_ctx, Gsasl_session *sd, Gsasl_property prop) {
_sx_sasl_sess_t sctx = gsasl_session_hook_get(sd);
_sx_sasl_t ctx = NULL;
struct sx_sasl_creds_st creds = {NULL, NULL, NULL, NULL};
char *value, *node, *host;
int len, i;
/*
* session hook data is not always available while its being set up,
* also not needed in many of the cases below.
*/
if(sctx != NULL) {
ctx = sctx->ctx;
}
_sx_debug(ZONE, "in _sx_sasl_gsasl_callback, property: %d", prop);
switch(prop) {
case GSASL_PASSWORD:
/* GSASL_AUTHID, GSASL_AUTHZID, GSASL_REALM */
assert(ctx);
assert(ctx->cb);
creds.authnid = gsasl_property_fast(sd, GSASL_AUTHID);
creds.realm = gsasl_property_fast(sd, GSASL_REALM);
if(!creds.authnid) return GSASL_NO_AUTHID;
if(!creds.realm) return GSASL_NO_AUTHZID;
if((ctx->cb)(sx_sasl_cb_GET_PASS, &creds, (void **)&value, sctx->s, ctx->cbarg) == sx_sasl_ret_OK) {
gsasl_property_set(sd, GSASL_PASSWORD, value);
}
return GSASL_NEEDS_MORE;
case GSASL_SERVICE:
gsasl_property_set(sd, GSASL_SERVICE, "xmpp");
return GSASL_OK;
case GSASL_HOSTNAME:
{
char hostname[256];
/* get hostname */
hostname[0] = '\0';
gethostname(hostname, 256);
hostname[255] = '\0';
gsasl_property_set(sd, GSASL_HOSTNAME, hostname);
}
return GSASL_OK;
case GSASL_VALIDATE_SIMPLE:
/* GSASL_AUTHID, GSASL_AUTHZID, GSASL_PASSWORD */
assert(ctx);
assert(ctx->cb);
creds.authnid = gsasl_property_fast(sd, GSASL_AUTHID);
creds.realm = gsasl_property_fast(sd, GSASL_REALM);
creds.pass = gsasl_property_fast(sd, GSASL_PASSWORD);
if(!creds.authnid) return GSASL_NO_AUTHID;
if(!creds.realm) return GSASL_NO_AUTHZID;
if(!creds.pass) return GSASL_NO_PASSWORD;
if((ctx->cb)(sx_sasl_cb_CHECK_PASS, &creds, NULL, sctx->s, ctx->cbarg) == sx_sasl_ret_OK)
return GSASL_OK;
else
return GSASL_AUTHENTICATION_ERROR;
case GSASL_VALIDATE_GSSAPI:
/* GSASL_AUTHZID, GSASL_GSSAPI_DISPLAY_NAME */
creds.authnid = gsasl_property_fast(sd, GSASL_GSSAPI_DISPLAY_NAME);
if(!creds.authnid) return GSASL_NO_AUTHID;
creds.authzid = gsasl_property_fast(sd, GSASL_AUTHZID);
if(!creds.authzid) return GSASL_NO_AUTHZID;
gsasl_property_set(sd, GSASL_AUTHID, creds.authnid);
return GSASL_OK;
case GSASL_VALIDATE_ANONYMOUS:
/* GSASL_ANONYMOUS_TOKEN */
creds.authnid = gsasl_property_fast(sd, GSASL_ANONYMOUS_TOKEN);
if(!creds.authnid) return GSASL_NO_ANONYMOUS_TOKEN;
/* set token as authid for later use */
gsasl_property_set(sd, GSASL_AUTHID, creds.authnid);
return GSASL_OK;
case GSASL_VALIDATE_EXTERNAL:
/* GSASL_AUTHID */
assert(ctx);
assert(ctx->ext_id);
creds.authzid = gsasl_property_fast(sd, GSASL_AUTHZID);
_sx_debug(ZONE, "sasl external");
_sx_debug(ZONE, "sasl creds.authzid is '%s'", creds.authzid);
for (i = 0; i < SX_CONN_EXTERNAL_ID_MAX_COUNT; i++) {
if (ctx->ext_id[i] == NULL)
break;
_sx_debug(ZONE, "sasl ext_id(%d) is '%s'", i, ctx->ext_id[i]);
/* XXX hackish.. detect c2s by existance of @ */
value = strstr(ctx->ext_id[i], "@");
if(value == NULL && creds.authzid != NULL && strcmp(ctx->ext_id[i], creds.authzid) == 0) {
// s2s connection and it's valid
/* TODO Handle wildcards and other thigs from XEP-0178 */
_sx_debug(ZONE, "sasl ctx->ext_id doesn't have '@' in it. Assuming s2s");
return GSASL_OK;
}
if(value != NULL &&
((creds.authzid != NULL && strcmp(ctx->ext_id[i], creds.authzid) == 0) ||
(creds.authzid == NULL)) ) {
// c2s connection
// creds.authzid == NULL condition is from XEP-0178 '=' auth reply
// This should be freed by gsasl_finish() but I'm not sure
// node = authnid
len = value - ctx->ext_id[i];
node = (char *) malloc(sizeof(char) * (len + 1)); // + null termination
strncpy(node, ctx->ext_id[i], len);
node[len] = '\0'; // null terminate the string
// host = realm
len = strlen(value) - 1 + 1; // - the @ + null termination
host = (char *) malloc(sizeof(char) * (len));
strcpy(host, value + 1); // skip the @
gsasl_property_set(sd, GSASL_AUTHID, node);
gsasl_property_set(sd, GSASL_REALM, host);
return GSASL_OK;
}
}
return GSASL_AUTHENTICATION_ERROR;
default:
break;
}
return GSASL_NO_CALLBACK;
}
| 0
|
137,696
|
void ConvolutionOpBuilder::FillCoreMLWeights() {
if (conv_type_ == ConvolutionType::kDepthwiseConv) {
layer_->mutable_convolution()->set_kernelchannels(1);
layer_->mutable_convolution()->set_outputchannels(weights_->dims->data[3]);
} else {
layer_->mutable_convolution()->set_kernelchannels(weights_->dims->data[3]);
layer_->mutable_convolution()->set_outputchannels(weights_->dims->data[0]);
}
layer_->mutable_convolution()->add_kernelsize(weights_->dims->data[1]);
layer_->mutable_convolution()->add_kernelsize(weights_->dims->data[2]);
TransposeKernelWeights(); // Should be called after CoreML shape is set.
}
| 0
|
174,860
|
InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client)
: m_page(page)
, m_client(client)
, m_inspectModeEnabled(false)
, m_drawViewSize(false)
, m_drawViewSizeWithGrid(false)
, m_timer(this, &InspectorOverlay::onTimer)
, m_overlayHost(InspectorOverlayHost::create())
{
}
| 0
|
268,816
|
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteEvalTensor* input =
tflite::micro::GetEvalInput(context, node, kInputTensor);
TfLiteEvalTensor* output =
tflite::micro::GetEvalOutput(context, node, kOutputTensor);
reference_ops::Ceil(tflite::micro::GetTensorShape(input),
tflite::micro::GetTensorData<float>(input),
tflite::micro::GetTensorShape(output),
tflite::micro::GetTensorData<float>(output));
return kTfLiteOk;
}
| 0
|
152,152
|
const Model* GetSimpleStatefulModel() {
static Model* model = nullptr;
if (!model) {
model = const_cast<Model*>(BuildSimpleStatefulModel());
}
return model;
}
| 0
|
395,123
|
vmxnet3_io_bar1_read(void *opaque, hwaddr addr, unsigned size)
{
VMXNET3State *s = opaque;
uint64_t ret = 0;
switch (addr) {
/* Vmxnet3 Revision Report Selection */
case VMXNET3_REG_VRRS:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_VRRS], size %d", size);
ret = VMXNET3_DEVICE_REVISION;
break;
/* UPT Version Report Selection */
case VMXNET3_REG_UVRS:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_UVRS], size %d", size);
ret = VMXNET3_UPT_REVISION;
break;
/* Command */
case VMXNET3_REG_CMD:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_CMD], size %d", size);
ret = vmxnet3_get_command_status(s);
break;
/* MAC Address Low */
case VMXNET3_REG_MACL:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_MACL], size %d", size);
ret = vmxnet3_get_mac_low(&s->conf.macaddr);
break;
/* MAC Address High */
case VMXNET3_REG_MACH:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_MACH], size %d", size);
ret = vmxnet3_get_mac_high(&s->conf.macaddr);
break;
/*
* Interrupt Cause Register
* Used for legacy interrupts only so interrupt index always 0
*/
case VMXNET3_REG_ICR:
VMW_CBPRN("Read BAR1 [VMXNET3_REG_ICR], size %d", size);
if (vmxnet3_interrupt_asserted(s, 0)) {
vmxnet3_clear_interrupt(s, 0);
ret = true;
} else {
ret = false;
}
break;
default:
VMW_CBPRN("Unknow read BAR1[%" PRIx64 "], %d bytes", addr, size);
break;
}
return ret;
}
| 0
|
30,776
|
TSReturnCode TSCacheKeyHostNameSet ( TSCacheKey key , const char * hostname , int host_len ) {
sdk_assert ( sdk_sanity_check_cachekey ( key ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) hostname ) == TS_SUCCESS ) ;
sdk_assert ( host_len > 0 ) ;
if ( ( ( CacheInfo * ) key ) -> magic != CACHE_INFO_MAGIC_ALIVE ) {
return TS_ERROR ;
}
CacheInfo * i = ( CacheInfo * ) key ;
i -> hostname = ( char * ) ats_malloc ( host_len ) ;
memcpy ( i -> hostname , hostname , host_len ) ;
i -> len = host_len ;
return TS_SUCCESS ;
}
| 0
|
70,633
|
static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size,
int uncompressed_size, EXRThreadData *td) {
const int8_t *sr = src;
int stay_to_uncompress = compressed_size;
int nb_b44_block_w, nb_b44_block_h;
int index_tl_x, index_tl_y, index_out, index_tmp;
uint16_t tmp_buffer[16]; /* B44 use 4x4 half float pixel */
int c, iY, iX, y, x;
int target_channel_offset = 0;
/* calc B44 block count */
nb_b44_block_w = td->xsize / 4;
if ((td->xsize % 4) != 0)
nb_b44_block_w++;
nb_b44_block_h = td->ysize / 4;
if ((td->ysize % 4) != 0)
nb_b44_block_h++;
for (c = 0; c < s->nb_channels; c++) {
if (s->channels[c].pixel_type == EXR_HALF) {/* B44 only compress half float data */
for (iY = 0; iY < nb_b44_block_h; iY++) {
for (iX = 0; iX < nb_b44_block_w; iX++) {/* For each B44 block */
if (stay_to_uncompress < 3) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
if (src[compressed_size - stay_to_uncompress + 2] == 0xfc) { /* B44A block */
unpack_3(sr, tmp_buffer);
sr += 3;
stay_to_uncompress -= 3;
} else {/* B44 Block */
if (stay_to_uncompress < 14) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
unpack_14(sr, tmp_buffer);
sr += 14;
stay_to_uncompress -= 14;
}
/* copy data to uncompress buffer (B44 block can exceed target resolution)*/
index_tl_x = iX * 4;
index_tl_y = iY * 4;
for (y = index_tl_y; y < FFMIN(index_tl_y + 4, td->ysize); y++) {
for (x = index_tl_x; x < FFMIN(index_tl_x + 4, td->xsize); x++) {
index_out = target_channel_offset * td->xsize + y * td->channel_line_size + 2 * x;
index_tmp = (y-index_tl_y) * 4 + (x-index_tl_x);
td->uncompressed_data[index_out] = tmp_buffer[index_tmp] & 0xff;
td->uncompressed_data[index_out + 1] = tmp_buffer[index_tmp] >> 8;
}
}
}
}
target_channel_offset += 2;
} else {/* Float or UINT 32 channel */
if (stay_to_uncompress < td->ysize * td->xsize * 4) {
av_log(s, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
for (y = 0; y < td->ysize; y++) {
index_out = target_channel_offset * td->xsize + y * td->channel_line_size;
memcpy(&td->uncompressed_data[index_out], sr, td->xsize * 4);
sr += td->xsize * 4;
}
target_channel_offset += 4;
stay_to_uncompress -= td->ysize * td->xsize * 4;
}
}
return 0;
}
| 0
|
191,186
|
bool LaunchBrowser(const CommandLine& command_line, Profile* profile,
const std::wstring& cur_dir, bool process_startup,
int* return_code, BrowserInit* browser_init) {
in_startup = process_startup;
DCHECK(profile);
if (command_line.HasSwitch(switches::kIncognito))
profile = profile->GetOffTheRecordProfile();
BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, browser_init);
bool launched = lwp.Launch(profile, process_startup);
in_startup = false;
if (!launched) {
LOG(ERROR) << "launch error";
if (return_code)
*return_code = ResultCodes::INVALID_CMDLINE_URL;
return false;
}
#if defined(OS_CHROMEOS)
TabOverviewMessageListener::instance();
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(switches::kEnableGView)) {
chromeos::GViewRequestInterceptor::GetGViewRequestInterceptor();
}
if (process_startup) {
chromeos::MountLibrary* lib = chromeos::MountLibrary::Get();
chromeos::USBMountObserver* observe = chromeos::USBMountObserver::Get();
observe->set_profile(profile);
lib->AddObserver(observe);
}
#endif
return true;
}
| 0
|
37,667
|
static void kvm_vcpu_ioctl_x86_get_xcrs(struct kvm_vcpu *vcpu,
struct kvm_xcrs *guest_xcrs)
{
if (!cpu_has_xsave) {
guest_xcrs->nr_xcrs = 0;
return;
}
guest_xcrs->nr_xcrs = 1;
guest_xcrs->flags = 0;
guest_xcrs->xcrs[0].xcr = XCR_XFEATURE_ENABLED_MASK;
guest_xcrs->xcrs[0].value = vcpu->arch.xcr0;
}
| 0
|
274,855
|
osd_stat_t get_osd_stat() {
Mutex::Locker l(stat_lock);
++seq;
osd_stat.up_from = up_epoch;
osd_stat.seq = ((uint64_t)osd_stat.up_from << 32) + seq;
return osd_stat;
}
| 0
|
459,733
|
dissect_kafka_offset_delete_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
kafka_api_version_t api_version)
{
proto_item *subti;
proto_tree *subtree;
offset = dissect_kafka_string(tree, hf_kafka_consumer_group, tvb, pinfo, offset, 0, NULL, NULL);
subtree = proto_tree_add_subtree(tree, tvb, offset, -1,
ett_kafka_topics,
&subti, "Topics");
offset = dissect_kafka_array(subtree, tvb, pinfo, offset, 0, api_version,
&dissect_kafka_offset_delete_request_topic, NULL);
proto_item_set_end(subti, tvb, offset);
return offset;
}
| 0
|
434,823
|
pdf_filter_Do_image(fz_context *ctx, pdf_processor *proc, const char *name, fz_image *image)
{
pdf_filter_processor *p = (pdf_filter_processor*)proc;
filter_flush(ctx, p, FLUSH_ALL);
if (p->chain->op_Do_image)
p->chain->op_Do_image(ctx, p->chain, name, image);
copy_resource(ctx, p, PDF_NAME(XObject), name);
}
| 0
|
161,554
|
generic_arguments_respect_constraints (VerifyContext *ctx, MonoGenericContainer *gc, MonoGenericContext *context, MonoGenericInst *ginst)
{
int i;
for (i = 0; i < ginst->type_argc; ++i) {
MonoType *type = ginst->type_argv [i];
MonoGenericParam *target = mono_generic_container_get_param (gc, i);
MonoGenericParam *candidate;
MonoClass *candidate_class;
if (!mono_type_is_generic_argument (type))
continue;
if (!is_valid_type_in_context (ctx, type))
return FALSE;
candidate = verifier_get_generic_param_from_type (ctx, type);
candidate_class = mono_class_from_mono_type (type);
if (!mono_generic_param_is_constraint_compatible (ctx, target, candidate, candidate_class, context))
return FALSE;
}
return TRUE;
}
| 0
|
103,065
|
void xmc4400EthInitGpio(NetInterface *interface)
{
uint32_t temp;
//Configure ETH0.TX_EN (P0.4)
temp = PORT0->IOCR4;
temp &= ~PORT0_IOCR4_PC4_Msk;
temp |= (17UL << PORT0_IOCR4_PC4_Pos);
PORT0->IOCR4 = temp;
//Configure ETH0.MDIO (P2.0), ETH0.RXD0A (P2.2) and ETH0.RXD1A (P2.3)
temp = PORT2->IOCR0;
temp &= ~(PORT2_IOCR0_PC0_Msk | PORT2_IOCR0_PC2_Msk | PORT2_IOCR0_PC3_Msk);
temp |= (0UL << PORT2_IOCR0_PC0_Pos) | (0UL << PORT2_IOCR0_PC2_Pos) | (0UL << PORT2_IOCR0_PC3_Pos);
PORT2->IOCR0 = temp;
//Configure ETH0.RXERA (P2.4)and ETH0.MDC (P2.7)
temp = PORT2->IOCR4;
temp &= ~(PORT2_IOCR4_PC4_Msk | PORT2_IOCR4_PC7_Msk);
temp |= (0UL << PORT2_IOCR4_PC4_Pos) | (17UL << PORT2_IOCR4_PC7_Pos);
PORT2->IOCR4 = temp;
//Configure ETH0.TXD0 (P2.8) and ETH0.TXD1 (P2.9)
temp = PORT2->IOCR8;
temp &= ~(PORT2_IOCR8_PC8_Msk | PORT2_IOCR8_PC9_Msk);
temp |= (17UL << PORT2_IOCR8_PC8_Pos) | (17UL << PORT2_IOCR8_PC9_Pos);
PORT2->IOCR8 = temp;
//Configure ETH0.CLK_RMIIC (P15.8) and ETH0.CRS_DVC (P15.9)
temp = PORT15->IOCR8;
temp &= ~(PORT15_IOCR8_PC8_Msk | PORT15_IOCR8_PC9_Msk);
temp |= (0UL << PORT15_IOCR8_PC8_Pos) | (0UL << PORT15_IOCR8_PC9_Pos);
PORT15->IOCR8 = temp;
//Assign ETH_MDIO (P2.0) to HW0
temp = PORT2->HWSEL & ~PORT2_HWSEL_HW0_Msk;
PORT2->HWSEL = temp | (1UL << PORT2_HWSEL_HW0_Pos);
//Select output driver strength for ETH0.TX_EN (P2.5)
temp = PORT2->PDR0;
temp &= ~PORT2_PDR0_PD5_Msk;
temp |= (0UL << PORT2_PDR0_PD5_Pos);
PORT2->PDR0 = temp;
//Select output driver strength for ETH0.TXD0 (P2.8) and ETH0.TXD1 (P2.9)
temp = PORT2->PDR1;
temp &= ~(PORT2_PDR1_PD8_Msk | PORT2_PDR1_PD9_Msk);
temp |= (0UL << PORT2_PDR1_PD8_Pos) | (0UL << PORT2_PDR1_PD9_Pos);
PORT2->PDR1 = temp;
//Use ETH0.CLK_RMIIC (P15.8) and ETH0.CRS_DVC (P15.9) as digital inputs
PORT15->PDISC &= ~(PORT15_PDISC_PDIS8_Msk | PORT15_PDISC_PDIS9_Msk);
//Select RMII operation mode
ETH0_CON->CON = ETH_CON_INFSEL_Msk | ETH_CON_MDIO_B | ETH_CON_RXER_A |
ETH_CON_CRS_DV_C | ETH_CON_CLK_RMII_C | ETH_CON_RXD1_A | ETH_CON_RXD0_A;
}
| 0
|
165,512
|
ProCamera2Client::ProCamera2Client(const sp<CameraService>& cameraService,
const sp<IProCameraCallbacks>& remoteCallback,
const String16& clientPackageName,
int cameraId,
int cameraFacing,
int clientPid,
uid_t clientUid,
int servicePid) :
Camera2ClientBase(cameraService, remoteCallback, clientPackageName,
cameraId, cameraFacing, clientPid, clientUid, servicePid)
{
ATRACE_CALL();
ALOGI("ProCamera %d: Opened", cameraId);
mExclusiveLock = false;
}
| 0
|
418,854
|
poppler_document_set_modification_date (PopplerDocument *document,
time_t modification_date)
{
g_return_if_fail (POPPLER_IS_DOCUMENT (document));
GooString *str = modification_date == (time_t)-1 ? nullptr : timeToDateString (&modification_date);
document->doc->setDocInfoModDate (str);
}
| 0
|
35,171
|
DeepScanLineInputFile::lastScanLineInChunk(int y) const
{
int minY = firstScanLineInChunk(y);
return min(minY+_data->linesInBuffer-1,_data->maxY);
}
| 0
|
401,044
|
jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id)
{
if (dict == NULL)
return NULL;
return dict->glyphs[id];
}
| 0
|
490,438
|
static GFINLINE void check_filter_error(GF_Filter *filter, GF_Err e, Bool for_reconnection)
{
GF_Err out_e = e;
Bool kill_filter = GF_FALSE;
if (e>GF_OK) e = GF_OK;
else if (e==GF_IP_NETWORK_EMPTY) e = GF_OK;
if (e) {
u64 diff;
filter->session->last_process_error = e;
filter->nb_errors ++;
if (!filter->nb_consecutive_errors) filter->time_at_first_error = gf_sys_clock_high_res();
filter->nb_consecutive_errors ++;
if (filter->nb_pck_io && !filter->session->in_final_flush)
filter->nb_consecutive_errors = 0;
//give it at most one second
diff = gf_sys_clock_high_res() - filter->time_at_first_error;
if (diff >= 1000000) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("[Filter] %s in error / not responding properly: %d consecutive errors in "LLU" us with no packet discarded or sent\n\tdiscarding all inputs and notifying end of stream on all outputs\n", filter->name, filter->nb_consecutive_errors, diff));
kill_filter = GF_TRUE;
}
} else {
if ((!filter->nb_pck_io && filter->pending_packets && (filter->nb_pids_playing>0) && !gf_filter_connections_pending(filter)) || for_reconnection) {
if (!filter->nb_consecutive_errors)
filter->time_at_first_error = gf_sys_clock_high_res();
filter->nb_consecutive_errors++;
out_e = GF_SERVICE_ERROR;
if (filter->nb_consecutive_errors >= 100000) {
if (for_reconnection) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("[Filter] %s not responding properly: %d consecutive attempts at reconfiguring\n\tdiscarding all inputs and notifying end of stream on all outputs\n", filter->name, filter->nb_consecutive_errors));
} else if (!filter->session->in_final_flush) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("[Filter] %s not responding properly: %d consecutive process with no packet discarded or sent, but %d packets pending\n\tdiscarding all inputs and notifying end of stream on all outputs\n", filter->name, filter->nb_consecutive_errors, filter->pending_packets));
} else {
out_e = GF_OK;
}
kill_filter = GF_TRUE;
}
} else {
filter->nb_consecutive_errors = 0;
filter->nb_pck_io = 0;
}
}
if (kill_filter) {
u32 i;
gf_mx_p(filter->tasks_mx);
for (i=0; i<filter->num_input_pids; i++) {
GF_FilterPidInst *pidi = gf_list_get(filter->input_pids, i);
gf_filter_pid_set_discard((GF_FilterPid *)pidi, GF_TRUE);
}
for (i=0; i<filter->num_output_pids; i++) {
GF_FilterPid *pid = gf_list_get(filter->output_pids, i);
gf_filter_pid_set_eos(pid);
}
gf_mx_v(filter->tasks_mx);
filter->session->last_process_error = out_e;
filter->disabled = GF_TRUE;
}
}
| 0
|
400,316
|
scheme_leading_string (enum url_scheme scheme)
{
return supported_schemes[scheme].leading_string;
}
| 0
|
352,943
|
static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
const int b_width = s->b_width << s->block_max_depth;
const int b_height= s->b_height << s->block_max_depth;
const int b_stride= b_width;
BlockNode *lt= &s->block[b_x + b_y*b_stride];
BlockNode *rt= lt+1;
BlockNode *lb= lt+b_stride;
BlockNode *rb= lb+1;
uint8_t *block[4];
int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
uint8_t *tmp = s->scratchbuf;
uint8_t *ptmp;
int x,y;
if(b_x<0){
lt= rt;
lb= rb;
}else if(b_x + 1 >= b_width){
rt= lt;
rb= lb;
}
if(b_y<0){
lt= lb;
rt= rb;
}else if(b_y + 1 >= b_height){
lb= lt;
rb= rt;
}
if(src_x<0){ //FIXME merge with prev & always round internal width up to *16
obmc -= src_x;
b_w += src_x;
if(!sliced && !offset_dst)
dst -= src_x;
src_x=0;
}else if(src_x + b_w > w){
b_w = w - src_x;
}
if(src_y<0){
obmc -= src_y*obmc_stride;
b_h += src_y;
if(!sliced && !offset_dst)
dst -= src_y*dst_stride;
src_y=0;
}else if(src_y + b_h> h){
b_h = h - src_y;
}
if(b_w<=0 || b_h<=0) return;
av_assert2(src_stride > 2*MB_SIZE + 5);
if(!sliced && offset_dst)
dst += src_x + src_y*dst_stride;
dst8+= src_x + src_y*src_stride;
// src += src_x + src_y*src_stride;
ptmp= tmp + 3*tmp_step;
block[0]= ptmp;
ptmp+=tmp_step;
ff_snow_pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt, plane_index, w, h);
if(same_block(lt, rt)){
block[1]= block[0];
}else{
block[1]= ptmp;
ptmp+=tmp_step;
ff_snow_pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt, plane_index, w, h);
}
if(same_block(lt, lb)){
block[2]= block[0];
}else if(same_block(rt, lb)){
block[2]= block[1];
}else{
block[2]= ptmp;
ptmp+=tmp_step;
ff_snow_pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb, plane_index, w, h);
}
if(same_block(lt, rb) ){
block[3]= block[0];
}else if(same_block(rt, rb)){
block[3]= block[1];
}else if(same_block(lb, rb)){
block[3]= block[2];
}else{
block[3]= ptmp;
ff_snow_pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb, plane_index, w, h);
}
if(sliced){
s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
}else{
for(y=0; y<b_h; y++){
//FIXME ugly misuse of obmc_stride
const uint8_t *obmc1= obmc + y*obmc_stride;
const uint8_t *obmc2= obmc1+ (obmc_stride>>1);
const uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1);
const uint8_t *obmc4= obmc3+ (obmc_stride>>1);
for(x=0; x<b_w; x++){
int v= obmc1[x] * block[3][x + y*src_stride]
+obmc2[x] * block[2][x + y*src_stride]
+obmc3[x] * block[1][x + y*src_stride]
+obmc4[x] * block[0][x + y*src_stride];
v <<= 8 - LOG2_OBMC_MAX;
if(FRAC_BITS != 8){
v >>= 8 - FRAC_BITS;
}
if(add){
v += dst[x + y*dst_stride];
v = (v + (1<<(FRAC_BITS-1))) >> FRAC_BITS;
if(v&(~255)) v= ~(v>>31);
dst8[x + y*src_stride] = v;
}else{
dst[x + y*dst_stride] -= v;
}
}
}
}
}
| 1
|
166,935
|
static void perform_renew(void)
{
bb_info_msg("Performing a DHCP renew");
switch (state) {
case BOUND:
change_listen_mode(LISTEN_KERNEL);
case RENEWING:
case REBINDING:
state = RENEW_REQUESTED;
break;
case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
udhcp_run_script(NULL, "deconfig");
case REQUESTING:
case RELEASED:
change_listen_mode(LISTEN_RAW);
state = INIT_SELECTING;
break;
case INIT_SELECTING:
break;
}
}
| 0
|
165,499
|
RenderFrameHostImpl::GetNavigationClientFromInterfaceProvider() {
mojom::NavigationClientAssociatedPtr navigation_client_ptr;
GetRemoteAssociatedInterfaces()->GetInterface(&navigation_client_ptr);
return navigation_client_ptr;
}
| 0
|
238,714
|
bool Allowed(const Extension* extension, const GURL& url) {
return Allowed(extension, url, -1);
}
| 0
|
300,917
|
void requestInit() override {
current_language = language;
current_internal_encoding = internal_encoding;
current_http_output_encoding = http_output_encoding;
current_filter_illegal_mode = filter_illegal_mode;
current_filter_illegal_substchar = filter_illegal_substchar;
if (!encoding_translation) {
illegalchars = 0;
}
mbfl_encoding **entry = nullptr;
int n = 0;
if (current_detect_order_list) {
return;
}
if (detect_order_list && detect_order_list_size > 0) {
n = detect_order_list_size;
entry = (mbfl_encoding **)malloc(n * sizeof(mbfl_encoding*));
std::copy(detect_order_list,
detect_order_list + (n * sizeof(mbfl_encoding*)), entry);
} else {
mbfl_no_encoding *src = default_detect_order_list;
n = default_detect_order_list_size;
entry = (mbfl_encoding **)malloc(n * sizeof(mbfl_encoding*));
for (int i = 0; i < n; i++) {
entry[i] = (mbfl_encoding*) mbfl_no2encoding(src[i]);
}
}
current_detect_order_list = entry;
current_detect_order_list_size = n;
}
| 0
|
390,973
|
static int ntop_host_reset_periodic_stats(lua_State* vm) {
NetworkInterfaceView *ntop_interface = getCurrentInterface(vm);
char *host_ip;
u_int16_t vlan_id = 0;
char buf[64];
Host *h;
ntop->getTrace()->traceEvent(TRACE_INFO, "%s() called", __FUNCTION__);
if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR);
get_host_vlan_info((char*)lua_tostring(vm, 1), &host_ip, &vlan_id, buf, sizeof(buf));
/* Optional VLAN id */
if(lua_type(vm, 2) == LUA_TNUMBER) vlan_id = (u_int16_t)lua_tonumber(vm, 2);
if((!ntop_interface)
|| ((h = ntop_interface->findHostsByIP(get_allowed_nets(vm), host_ip, vlan_id)) == NULL))
return(CONST_LUA_ERROR);
h->resetPeriodicStats();
return(CONST_LUA_OK);
}
| 0
|
419,532
|
int sa_fread(int ifd, void *buffer, size_t size, int mode, int oneof)
{
ssize_t n;
if ((n = read(ifd, buffer, size)) < 0) {
fprintf(stderr, _("Error while reading system activity file: %s\n"),
strerror(errno));
close(ifd);
exit(2);
}
if (!n && (mode == SOFT_SIZE))
return 1; /* EOF */
if (n < size) {
fprintf(stderr, _("End of system activity file unexpected\n"));
if (oneof == UEOF_CONT)
return 2;
close(ifd);
exit(2);
}
return 0;
}
| 0
|
179,140
|
ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
{
php_stream *tmpstream = NULL;
databuf_t *data = NULL;
char *ptr;
int ch, lastch;
size_t size, rcvd;
size_t lines;
char **ret = NULL;
char **entry;
char *text;
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create temporary file. Check permissions in temporary files directory.");
return NULL;
}
if (!ftp_type(ftp, FTPTYPE_ASCII)) {
goto bail;
}
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
goto bail;
}
ftp->data = data;
if (!ftp_putcmd(ftp, cmd, path)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125 && ftp->resp != 226)) {
goto bail;
}
/* some servers don't open a ftp-data connection if the directory is empty */
if (ftp->resp == 226) {
ftp->data = data_close(ftp, data);
php_stream_close(tmpstream);
return ecalloc(1, sizeof(char*));
}
/* pull data buffer into tmpfile */
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
goto bail;
}
size = 0;
lines = 0;
lastch = 0;
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
if (rcvd == -1 || rcvd > ((size_t)(-1))-size) {
goto bail;
}
php_stream_write(tmpstream, data->buf, rcvd);
size += rcvd;
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
if (*ptr == '\n' && lastch == '\r') {
lines++;
}
lastch = *ptr;
}
lastch = *ptr;
}
}
| 0
|
428,558
|
g_file_unmount_mountable_with_operation_finish (GFile *file,
GAsyncResult *result,
GError **error)
{
GFileIface *iface;
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
if (g_async_result_legacy_propagate_error (result, error))
return FALSE;
else if (g_async_result_is_tagged (result, g_file_unmount_mountable_with_operation))
return g_task_propagate_boolean (G_TASK (result), error);
iface = G_FILE_GET_IFACE (file);
if (iface->unmount_mountable_with_operation_finish != NULL)
return (* iface->unmount_mountable_with_operation_finish) (file, result, error);
else
return (* iface->unmount_mountable_finish) (file, result, error);
}
| 0
|
205,843
|
explicit FrameFactoryImpl(const service_manager::BindSourceInfo& source_info)
: source_info_(source_info), routing_id_highmark_(-1) {}
| 0
|
348,515
|
void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
{
struct brcmf_if *ifp;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
if (brcmf_rx_hdrpull(drvr, skb, &ifp))
return;
brcmf_fweh_process_skb(ifp->drvr, skb);
brcmu_pkt_buf_free_skb(skb);
}
| 1
|
67,585
|
void TNEFInitAttachment(Attachment *p) {
INITDTR(p->Date);
INITVARLENGTH(p->Title);
INITVARLENGTH(p->MetaFile);
INITDTR(p->CreateDate);
INITDTR(p->ModifyDate);
INITVARLENGTH(p->TransportFilename);
INITVARLENGTH(p->FileData);
INITVARLENGTH(p->IconData);
memset(&(p->RenderData), 0, sizeof(renddata));
TNEFInitMapi(&(p->MAPI));
p->next = NULL;
}
| 0
|
440,245
|
str_node_split_last_char(Node* node, OnigEncoding enc)
{
const UChar *p;
Node* rn;
StrNode* sn;
sn = STR_(node);
rn = NULL_NODE;
if (sn->end > sn->s) {
p = onigenc_get_prev_char_head(enc, sn->s, sn->end);
if (p && p > sn->s) { /* can be split. */
rn = node_new_str(p, sn->end);
CHECK_NULL_RETURN(rn);
if (NODE_STRING_IS_CRUDE(node))
NODE_STRING_SET_CRUDE(rn);
sn->end = (UChar* )p;
}
}
return rn;
}
| 0
|
80,526
|
static pj_bool_t ssock_on_accept_complete (pj_ssl_sock_t *ssock_parent,
pj_sock_t newsock,
void *newconn,
const pj_sockaddr_t *src_addr,
int src_addr_len,
pj_status_t accept_status)
{
pj_ssl_sock_t *ssock;
#ifndef SSL_SOCK_IMP_USE_OWN_NETWORK
pj_activesock_cb asock_cb;
#endif
pj_activesock_cfg asock_cfg;
unsigned i;
pj_status_t status;
#ifndef SSL_SOCK_IMP_USE_OWN_NETWORK
PJ_UNUSED_ARG(newconn);
#endif
if (accept_status != PJ_SUCCESS) {
if (ssock_parent->param.cb.on_accept_complete2) {
(*ssock_parent->param.cb.on_accept_complete2)(ssock_parent, NULL,
src_addr,
src_addr_len,
accept_status);
}
return PJ_TRUE;
}
/* Create new SSL socket instance */
status = pj_ssl_sock_create(ssock_parent->pool,
&ssock_parent->newsock_param, &ssock);
if (status != PJ_SUCCESS)
goto on_return;
/* Set parent and add ref count (avoid parent destroy during handshake) */
ssock->parent = ssock_parent;
if (ssock->parent->param.grp_lock)
pj_grp_lock_add_ref(ssock->parent->param.grp_lock);
/* Update new SSL socket attributes */
ssock->sock = newsock;
ssock->is_server = PJ_TRUE;
if (ssock_parent->cert) {
status = pj_ssl_sock_set_certificate(ssock, ssock->pool,
ssock_parent->cert);
if (status != PJ_SUCCESS)
goto on_return;
}
/* Set local address */
ssock->addr_len = src_addr_len;
pj_sockaddr_cp(&ssock->local_addr, &ssock_parent->local_addr);
/* Set remote address */
pj_sockaddr_cp(&ssock->rem_addr, src_addr);
/* Create SSL context */
status = ssl_create(ssock);
if (status != PJ_SUCCESS)
goto on_return;
/* Prepare read buffer */
ssock->asock_rbuf = (void**)pj_pool_calloc(ssock->pool,
ssock->param.async_cnt,
sizeof(void*));
if (!ssock->asock_rbuf) {
status = PJ_ENOMEM;
goto on_return;
}
for (i = 0; i<ssock->param.async_cnt; ++i) {
ssock->asock_rbuf[i] = (void*) pj_pool_alloc(
ssock->pool,
ssock->param.read_buffer_size +
sizeof(read_data_t*));
if (!ssock->asock_rbuf[i]) {
status = PJ_ENOMEM;
goto on_return;
}
}
/* If listener socket has group lock, automatically create group lock
* for the new socket.
*/
if (ssock_parent->param.grp_lock) {
pj_grp_lock_t *glock;
status = pj_grp_lock_create(ssock->pool, NULL, &glock);
if (status != PJ_SUCCESS)
goto on_return;
pj_grp_lock_add_ref(glock);
ssock->param.grp_lock = glock;
pj_grp_lock_add_handler(ssock->param.grp_lock, ssock->pool, ssock,
ssl_on_destroy);
}
#ifdef SSL_SOCK_IMP_USE_OWN_NETWORK
status = network_setup_connection(ssock, newconn);
if (status != PJ_SUCCESS)
goto on_return;
#else
/* Apply QoS, if specified */
status = pj_sock_apply_qos2(ssock->sock, ssock->param.qos_type,
&ssock->param.qos_params, 1,
ssock->pool->obj_name, NULL);
if (status != PJ_SUCCESS && !ssock->param.qos_ignore_error)
goto on_return;
/* Apply socket options, if specified */
if (ssock->param.sockopt_params.cnt) {
status = pj_sock_setsockopt_params(ssock->sock,
&ssock->param.sockopt_params);
if (status != PJ_SUCCESS && !ssock->param.sockopt_ignore_error)
goto on_return;
}
/* Create active socket */
pj_activesock_cfg_default(&asock_cfg);
asock_cfg.grp_lock = ssock->param.grp_lock;
asock_cfg.async_cnt = ssock->param.async_cnt;
asock_cfg.concurrency = ssock->param.concurrency;
asock_cfg.whole_data = PJ_TRUE;
pj_bzero(&asock_cb, sizeof(asock_cb));
asock_cb.on_data_read = asock_on_data_read;
asock_cb.on_data_sent = asock_on_data_sent;
status = pj_activesock_create(ssock->pool,
ssock->sock,
ssock->param.sock_type,
&asock_cfg,
ssock->param.ioqueue,
&asock_cb,
ssock,
&ssock->asock);
if (status != PJ_SUCCESS)
goto on_return;
/* Start read */
status = pj_activesock_start_read2(ssock->asock, ssock->pool,
(unsigned)ssock->param.read_buffer_size,
ssock->asock_rbuf,
PJ_IOQUEUE_ALWAYS_ASYNC);
if (status != PJ_SUCCESS)
goto on_return;
#endif
/* Update local address */
status = get_localaddr(ssock, &ssock->local_addr, &ssock->addr_len);
if (status != PJ_SUCCESS) {
/* This fails on few envs, e.g: win IOCP, just tolerate this and
* use parent local address instead.
*/
pj_sockaddr_cp(&ssock->local_addr, &ssock_parent->local_addr);
}
/* Prepare write/send state */
pj_assert(ssock->send_buf.max_len == 0);
ssock->send_buf.buf = (char*)
pj_pool_alloc(ssock->pool,
ssock->param.send_buffer_size);
if (!ssock->send_buf.buf)
return PJ_ENOMEM;
ssock->send_buf.max_len = ssock->param.send_buffer_size;
ssock->send_buf.start = ssock->send_buf.buf;
ssock->send_buf.len = 0;
/* Start handshake timer */
if (ssock->param.timer_heap && (ssock->param.timeout.sec != 0 ||
ssock->param.timeout.msec != 0))
{
pj_assert(ssock->timer.id == TIMER_NONE);
status = pj_timer_heap_schedule_w_grp_lock(ssock->param.timer_heap,
&ssock->timer,
&ssock->param.timeout,
TIMER_HANDSHAKE_TIMEOUT,
ssock->param.grp_lock);
if (status != PJ_SUCCESS) {
ssock->timer.id = TIMER_NONE;
status = PJ_SUCCESS;
}
}
/* Start SSL handshake */
ssock->ssl_state = SSL_STATE_HANDSHAKING;
ssl_set_state(ssock, PJ_TRUE);
status = ssl_do_handshake(ssock);
on_return:
if (ssock && status != PJ_EPENDING) {
on_handshake_complete(ssock, status);
}
/* Must return PJ_TRUE whatever happened, as we must continue listening */
return PJ_TRUE;
}
| 0
|
265,300
|
rfbBool rfbSendFileTransferChunk(rfbClientPtr cl)
{
/* Allocate buffer for compression */
char readBuf[sz_rfbBlockSize];
int bytesRead=0;
int retval=0;
fd_set wfds;
struct timeval tv;
int n;
#ifdef LIBVNCSERVER_HAVE_LIBZ
unsigned char compBuf[sz_rfbBlockSize + 1024];
unsigned long nMaxCompSize = sizeof(compBuf);
int nRetC = 0;
#endif
/*
* Don't close the client if we get into this one because
* it is called from many places to service file transfers.
* Note that permitFileTransfer is checked first.
*/
if (cl->screen->permitFileTransfer != TRUE ||
(cl->screen->getFileTransferPermission != NULL
&& cl->screen->getFileTransferPermission(cl) != TRUE)) {
return TRUE;
}
/* If not sending, or no file open... Return as if we sent something! */
if ((cl->fileTransfer.fd!=-1) && (cl->fileTransfer.sending==1))
{
FD_ZERO(&wfds);
FD_SET(cl->sock, &wfds);
/* return immediately */
tv.tv_sec = 0;
tv.tv_usec = 0;
n = select(cl->sock + 1, NULL, &wfds, NULL, &tv);
if (n<0) {
#ifdef WIN32
errno=WSAGetLastError();
#endif
rfbLog("rfbSendFileTransferChunk() select failed: %s\n", strerror(errno));
}
/* We have space on the transmit queue */
if (n > 0)
{
bytesRead = read(cl->fileTransfer.fd, readBuf, sz_rfbBlockSize);
switch (bytesRead) {
case 0:
/*
rfbLog("rfbSendFileTransferChunk(): End-Of-File Encountered\n");
*/
retval = rfbSendFileTransferMessage(cl, rfbEndOfFile, 0, 0, 0, NULL);
close(cl->fileTransfer.fd);
cl->fileTransfer.fd = -1;
cl->fileTransfer.sending = 0;
cl->fileTransfer.receiving = 0;
return retval;
case -1:
/* TODO : send an error msg to the client... */
#ifdef WIN32
errno=WSAGetLastError();
#endif
rfbLog("rfbSendFileTransferChunk(): %s\n",strerror(errno));
retval = rfbSendFileTransferMessage(cl, rfbAbortFileTransfer, 0, 0, 0, NULL);
close(cl->fileTransfer.fd);
cl->fileTransfer.fd = -1;
cl->fileTransfer.sending = 0;
cl->fileTransfer.receiving = 0;
return retval;
default:
/*
rfbLog("rfbSendFileTransferChunk(): Read %d bytes\n", bytesRead);
*/
if (!cl->fileTransfer.compressionEnabled)
return rfbSendFileTransferMessage(cl, rfbFilePacket, 0, 0, bytesRead, readBuf);
else
{
#ifdef LIBVNCSERVER_HAVE_LIBZ
nRetC = compress(compBuf, &nMaxCompSize, (unsigned char *)readBuf, bytesRead);
/*
rfbLog("Compressed the packet from %d -> %d bytes\n", nMaxCompSize, bytesRead);
*/
if ((nRetC==0) && (nMaxCompSize<bytesRead))
return rfbSendFileTransferMessage(cl, rfbFilePacket, 0, 1, nMaxCompSize, (char *)compBuf);
else
return rfbSendFileTransferMessage(cl, rfbFilePacket, 0, 0, bytesRead, readBuf);
#else
/* We do not support compression of the data stream */
return rfbSendFileTransferMessage(cl, rfbFilePacket, 0, 0, bytesRead, readBuf);
#endif
}
}
}
}
return TRUE;
}
| 0
|
178,631
|
void js_setglobal(js_State *J, const char *name)
{
jsR_setproperty(J, J->G, name);
js_pop(J, 1);
}
| 0
|
385,667
|
PHP_NAMED_FUNCTION(php_inet_ntop)
{
char *address;
int address_len, af = AF_INET;
char buffer[40];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) {
RETURN_FALSE;
}
#ifdef HAVE_IPV6
if (address_len == 16) {
af = AF_INET6;
} else
#endif
if (address_len != 4) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid in_addr value");
RETURN_FALSE;
}
if (!inet_ntop(af, address, buffer, sizeof(buffer))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred");
RETURN_FALSE;
}
RETURN_STRING(buffer, 1);
}
| 0
|
89,451
|
bool HHVM_FUNCTION(image2wbmp, const Resource& image,
const String& filename /* = null_string */,
int64_t threshold /* = -1 */) {
return _php_image_output(image, filename, threshold, -1,
PHP_GDIMG_CONVERT_WBM, "WBMP",
(void (*)())_php_image_bw_convert);
}
| 0
|
114,541
|
SWFRect SWFShape_getEdgeBounds(SWFShape shape)
{
if(shape->useVersion == SWF_SHAPE4)
return shape->edgeBounds;
else
return NULL;
}
| 0
|
207,475
|
xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlNodePtr inst) {
xmlNodePtr child;
int ret = 0;
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) ||
(inst->children == NULL))
return(0);
child = inst->children;
while (child != NULL) {
if ((IS_XSLT_ELEM(child)) &&
(xmlStrEqual(child->name, BAD_CAST "fallback"))) {
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
"applying xsl:fallback\n");
#endif
ret++;
xsltApplySequenceConstructor(ctxt, node, child->children,
NULL);
}
child = child->next;
}
return(ret);
}
| 0
|
435,830
|
static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
{
const char *end = repo + strlen(repo), *start, *ptr;
size_t len;
char *dir;
/*
* Skip scheme.
*/
start = strstr(repo, "://");
if (start == NULL)
start = repo;
else
start += 3;
/*
* Skip authentication data. The stripping does happen
* greedily, such that we strip up to the last '@' inside
* the host part.
*/
for (ptr = start; ptr < end && !is_dir_sep(*ptr); ptr++) {
if (*ptr == '@')
start = ptr + 1;
}
/*
* Strip trailing spaces, slashes and /.git
*/
while (start < end && (is_dir_sep(end[-1]) || isspace(end[-1])))
end--;
if (end - start > 5 && is_dir_sep(end[-5]) &&
!strncmp(end - 4, ".git", 4)) {
end -= 5;
while (start < end && is_dir_sep(end[-1]))
end--;
}
/*
* Strip trailing port number if we've got only a
* hostname (that is, there is no dir separator but a
* colon). This check is required such that we do not
* strip URI's like '/foo/bar:2222.git', which should
* result in a dir '2222' being guessed due to backwards
* compatibility.
*/
if (memchr(start, '/', end - start) == NULL
&& memchr(start, ':', end - start) != NULL) {
ptr = end;
while (start < ptr && isdigit(ptr[-1]) && ptr[-1] != ':')
ptr--;
if (start < ptr && ptr[-1] == ':')
end = ptr - 1;
}
/*
* Find last component. To remain backwards compatible we
* also regard colons as path separators, such that
* cloning a repository 'foo:bar.git' would result in a
* directory 'bar' being guessed.
*/
ptr = end;
while (start < ptr && !is_dir_sep(ptr[-1]) && ptr[-1] != ':')
ptr--;
start = ptr;
/*
* Strip .{bundle,git}.
*/
len = end - start;
strip_suffix_mem(start, &len, is_bundle ? ".bundle" : ".git");
if (!len || (len == 1 && *start == '/'))
die(_("No directory name could be guessed.\n"
"Please specify a directory on the command line"));
if (is_bare)
dir = xstrfmt("%.*s.git", (int)len, start);
else
dir = xstrndup(start, len);
/*
* Replace sequences of 'control' characters and whitespace
* with one ascii space, remove leading and trailing spaces.
*/
if (*dir) {
char *out = dir;
int prev_space = 1 /* strip leading whitespace */;
for (end = dir; *end; ++end) {
char ch = *end;
if ((unsigned char)ch < '\x20')
ch = '\x20';
if (isspace(ch)) {
if (prev_space)
continue;
prev_space = 1;
} else
prev_space = 0;
*out++ = ch;
}
*out = '\0';
if (out > dir && prev_space)
out[-1] = '\0';
}
return dir;
}
| 0
|
146,490
|
int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
program_config *pce_out)
{
program_config pce;
/* 1024 or 960 */
mp4ASC->frameLengthFlag = faad_get1bit(ld
DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag"));
#ifndef ALLOW_SMALL_FRAMELENGTH
if (mp4ASC->frameLengthFlag == 1)
return -3;
#endif
mp4ASC->dependsOnCoreCoder = faad_get1bit(ld
DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder"));
if (mp4ASC->dependsOnCoreCoder == 1)
{
mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14
DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay"));
}
mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag"));
if (mp4ASC->channelsConfiguration == 0)
{
if (program_config_element(&pce, ld))
return -3;
//mp4ASC->channelsConfiguration = pce.channels;
if (pce_out != NULL)
memcpy(pce_out, &pce, sizeof(program_config));
/*
if (pce.num_valid_cc_elements)
return -3;
*/
}
#ifdef ERROR_RESILIENCE
if (mp4ASC->extensionFlag == 1)
{
/* Error resilience not supported yet */
if (mp4ASC->objectTypeIndex >= ER_OBJECT_START)
{
mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld
DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag"));
mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld
DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag"));
mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld
DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag"));
}
/* 1 bit: extensionFlag3 */
faad_getbits(ld, 1);
}
#endif
return 0;
}
| 0
|
434,416
|
static int do_insert_tree(struct quota_handle *h, struct dquot *dquot,
unsigned int * treeblk, int depth)
{
dqbuf_t buf;
int newson = 0, newact = 0;
__le32 *ref;
unsigned int newblk;
int ret = 0;
log_debug("inserting in tree: treeblk=%u, depth=%d", *treeblk, depth);
buf = getdqbuf();
if (!buf)
return -ENOMEM;
if (!*treeblk) {
ret = get_free_dqblk(h);
if (ret < 0)
goto out_buf;
*treeblk = ret;
memset(buf, 0, QT_BLKSIZE);
newact = 1;
} else {
read_blk(h, *treeblk, buf);
}
ref = (__le32 *) buf;
newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
if (!newblk)
newson = 1;
if (depth == QT_TREEDEPTH - 1) {
if (newblk)
log_err("Inserting already present quota entry "
"(block %u).",
ref[get_index(dquot->dq_id, depth)]);
newblk = find_free_dqentry(h, dquot, &ret);
} else {
ret = do_insert_tree(h, dquot, &newblk, depth + 1);
}
if (newson && ret >= 0) {
ref[get_index(dquot->dq_id, depth)] =
ext2fs_cpu_to_le32(newblk);
write_blk(h, *treeblk, buf);
} else if (newact && ret < 0) {
put_free_dqblk(h, buf, *treeblk);
}
out_buf:
freedqbuf(buf);
return ret;
}
| 0
|
386,925
|
dns_sd_resolver_changed (GVfsDnsSdResolver *resolver,
GVfsBackendDav *dav_backend)
{
/* TODO: handle when DNS-SD data changes */
}
| 0
|
514,167
|
_fill_a8_lerp_spans (void *abstract_renderer, int y, int h,
const cairo_half_open_span_t *spans, unsigned num_spans)
{
cairo_image_span_renderer_t *r = abstract_renderer;
if (num_spans == 0)
return CAIRO_STATUS_SUCCESS;
if (likely(h == 1)) {
do {
uint8_t a = mul8_8 (spans[0].coverage, r->bpp);
if (a) {
int len = spans[1].x - spans[0].x;
uint8_t *d = r->u.fill.data + r->u.fill.stride*y + spans[0].x;
uint16_t p = (uint16_t)a * r->u.fill.pixel + 0x7f;
uint16_t ia = ~a;
while (len-- > 0) {
uint16_t t = *d*ia + p;
*d++ = (t + (t>>8)) >> 8;
}
}
spans++;
} while (--num_spans > 1);
} else {
do {
uint8_t a = mul8_8 (spans[0].coverage, r->bpp);
if (a) {
int yy = y, hh = h;
uint16_t p = (uint16_t)a * r->u.fill.pixel + 0x7f;
uint16_t ia = ~a;
do {
int len = spans[1].x - spans[0].x;
uint8_t *d = r->u.fill.data + r->u.fill.stride*yy + spans[0].x;
while (len-- > 0) {
uint16_t t = *d*ia + p;
*d++ = (t + (t>>8)) >> 8;
}
yy++;
} while (--hh);
}
spans++;
} while (--num_spans > 1);
}
return CAIRO_STATUS_SUCCESS;
}
| 0
|
107,383
|
SWFInput_length(SWFInput input)
{
int pos = SWFInput_tell(input);
SWFInput_seek(input, 0, SEEK_END);
SWFInput_seek(input, pos, SEEK_SET);
return input->length;
}
| 0
|
358,179
|
static inline unsigned int dt_type(struct inode *inode)
{
return (inode->i_mode >> 12) & 15;
}
| 0
|
98,413
|
static int jpc_siz_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate,
jas_stream_t *in)
{
jpc_siz_t *siz = &ms->parms.siz;
unsigned int i;
uint_fast8_t tmp;
/* Eliminate compiler warning about unused variables. */
cstate = 0;
if (jpc_getuint16(in, &siz->caps) ||
jpc_getuint32(in, &siz->width) ||
jpc_getuint32(in, &siz->height) ||
jpc_getuint32(in, &siz->xoff) ||
jpc_getuint32(in, &siz->yoff) ||
jpc_getuint32(in, &siz->tilewidth) ||
jpc_getuint32(in, &siz->tileheight) ||
jpc_getuint32(in, &siz->tilexoff) ||
jpc_getuint32(in, &siz->tileyoff) ||
jpc_getuint16(in, &siz->numcomps)) {
return -1;
}
if (!siz->width || !siz->height || !siz->tilewidth ||
!siz->tileheight || !siz->numcomps) {
return -1;
}
if (!(siz->comps = jas_alloc2(siz->numcomps, sizeof(jpc_sizcomp_t)))) {
return -1;
}
for (i = 0; i < siz->numcomps; ++i) {
if (jpc_getuint8(in, &tmp) ||
jpc_getuint8(in, &siz->comps[i].hsamp) ||
jpc_getuint8(in, &siz->comps[i].vsamp)) {
jas_free(siz->comps);
return -1;
}
if (siz->comps[i].hsamp == 0 || siz->comps[i].hsamp > 255) {
jas_eprintf("invalid XRsiz value %d\n", siz->comps[i].hsamp);
jas_free(siz->comps);
return -1;
}
if (siz->comps[i].vsamp == 0 || siz->comps[i].vsamp > 255) {
jas_eprintf("invalid YRsiz value %d\n", siz->comps[i].vsamp);
jas_free(siz->comps);
return -1;
}
siz->comps[i].sgnd = (tmp >> 7) & 1;
siz->comps[i].prec = (tmp & 0x7f) + 1;
}
if (jas_stream_eof(in)) {
jas_free(siz->comps);
return -1;
}
return 0;
}
| 0
|
423,634
|
dns_zone_set_parentcatz(dns_zone_t *zone, dns_catz_zone_t *catz) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(catz != NULL);
LOCK_ZONE(zone);
INSIST(zone->parentcatz == NULL || zone->parentcatz == catz);
zone->parentcatz = catz;
UNLOCK_ZONE(zone);
}
| 0
|
204,240
|
http_Setup(struct http *hp, struct ws *ws)
{
uint16_t shd;
txt *hd;
unsigned char *hdf;
/* XXX: This is not elegant, is it efficient ? */
shd = hp->shd;
hd = hp->hd;
hdf = hp->hdf;
memset(hp, 0, sizeof *hp);
memset(hd, 0, sizeof *hd * shd);
memset(hdf, 0, sizeof *hdf * shd);
hp->magic = HTTP_MAGIC;
hp->ws = ws;
hp->nhd = HTTP_HDR_FIRST;
hp->shd = shd;
hp->hd = hd;
hp->hdf = hdf;
}
| 0
|
337,848
|
static inline uint32_t reloc_26_val(tcg_insn_unit *pc, tcg_insn_unit *target)
{
assert((((uintptr_t)pc ^ (uintptr_t)target) & 0xf0000000) == 0);
return ((uintptr_t)target >> 2) & 0x3ffffff;
}
| 0
|
354,796
|
void make_bad_inode(struct inode *inode)
{
remove_inode_hash(inode);
inode->i_mode = S_IFREG;
inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb);
inode->i_op = &bad_inode_ops;
inode->i_fop = &bad_file_ops;
}
| 0
|
186,571
|
bool RenderProcessHostImpl::FastShutdownForPageCount(size_t count) {
if (render_widget_hosts_.size() == count)
return FastShutdownIfPossible();
return false;
}
| 0
|
428,237
|
static bool tcp_has_tx_tstamp(const struct sk_buff *skb)
{
return TCP_SKB_CB(skb)->txstamp_ack ||
(skb_shinfo(skb)->tx_flags & SKBTX_ANY_TSTAMP);
}
| 0
|
355,177
|
int raw_notifier_chain_unregister(struct raw_notifier_head *nh,
struct notifier_block *n)
{
return notifier_chain_unregister(&nh->head, n);
}
| 0
|
377,927
|
static void cgw_csum_xor_pos(struct can_frame *cf, struct cgw_csum_xor *xor)
{
u8 val = xor->init_xor_val;
int i;
for (i = xor->from_idx; i <= xor->to_idx; i++)
val ^= cf->data[i];
cf->data[xor->result_idx] = val;
}
| 0
|
64,880
|
void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
unsigned long size)
{
unsigned long uncached_ebase = CKSEG1ADDR(ebase);
if (!addr)
panic(panic_null_cerr);
memcpy((void *)(uncached_ebase + offset), addr, size);
}
| 0
|
65,458
|
ExprResolveInteger(struct xkb_context *ctx, const ExprDef *expr,
int *val_rtrn)
{
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
}
| 0
|
113,049
|
ModuleExport void UnregisterPDBImage(void)
{
(void) UnregisterMagickInfo("PDB");
}
| 0
|
133,176
|
sec_dist_func4 (xd3_stream *stream, xd3_output *data)
{
int i, ret, x;
for (i = 0; i < ALPHABET_SIZE*20; i += 1)
{
x = mt_exp_rand (10, ALPHABET_SIZE/2);
if ((ret = xd3_emit_byte (stream, & data, x))) { return ret; }
}
return 0;
}
| 0
|
259,036
|
static void reparent_thread(struct task_struct *p, struct task_struct *father)
{
if (p->pdeath_signal)
/* We already hold the tasklist_lock here. */
group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
list_move_tail(&p->sibling, &p->real_parent->children);
/* If this is a threaded reparent there is no need to
* notify anyone anything has happened.
*/
if (same_thread_group(p->real_parent, father))
return;
/* We don't want people slaying init. */
if (!task_detached(p))
p->exit_signal = SIGCHLD;
/* If we'd notified the old parent about this child's death,
* also notify the new parent.
*/
if (!ptrace_reparented(p) &&
p->exit_state == EXIT_ZOMBIE &&
!task_detached(p) && thread_group_empty(p))
do_notify_parent(p, p->exit_signal);
kill_orphaned_pgrp(p, father);
}
| 0
|
436,087
|
onig_free_shared_cclass_table(void)
{
if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
onig_st_free_table(OnigTypeCClassTable);
OnigTypeCClassTable = NULL;
}
return 0;
}
| 0
|
369,595
|
PHP_FUNCTION(openssl_cipher_iv_length)
{
char *method;
int method_len;
const EVP_CIPHER *cipher_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &method, &method_len) == FAILURE) {
return;
}
if (!method_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm");
RETURN_FALSE;
}
cipher_type = EVP_get_cipherbyname(method);
if (!cipher_type) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm");
RETURN_FALSE;
}
RETURN_LONG(EVP_CIPHER_iv_length(cipher_type));
}
| 0
|
33,000
|
static void get_kvmclock(struct kvm *kvm, struct kvm_clock_data *data)
{
struct kvm_arch *ka = &kvm->arch;
unsigned seq;
do {
seq = read_seqcount_begin(&ka->pvclock_sc);
__get_kvmclock(kvm, data);
} while (read_seqcount_retry(&ka->pvclock_sc, seq));
}
| 0
|
177,576
|
void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) {
DCHECK(!frame_ || frame_ == frame);
if (!frame->parent()) {
FrameMsg_UILoadMetricsReportType::Value report_type =
static_cast<FrameMsg_UILoadMetricsReportType::Value>(
frame->dataSource()->request().inputPerfMetricReportPolicy());
base::TimeTicks ui_timestamp = base::TimeTicks() +
base::TimeDelta::FromSecondsD(
frame->dataSource()->request().uiStartTime());
Send(new FrameHostMsg_DocumentOnLoadCompleted(
routing_id_, report_type, ui_timestamp));
}
}
| 0
|
424,150
|
void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix) {
char buf[FORMAT_TIMESTAMP_MAX];
assert(s);
assert(f);
if (s->pid <= 0)
return;
prefix = strempty(prefix);
fprintf(f,
"%sPID: "PID_FMT"\n",
prefix, s->pid);
if (dual_timestamp_is_set(&s->start_timestamp))
fprintf(f,
"%sStart Timestamp: %s\n",
prefix, format_timestamp(buf, sizeof(buf), s->start_timestamp.realtime));
if (dual_timestamp_is_set(&s->exit_timestamp))
fprintf(f,
"%sExit Timestamp: %s\n"
"%sExit Code: %s\n"
"%sExit Status: %i\n",
prefix, format_timestamp(buf, sizeof(buf), s->exit_timestamp.realtime),
prefix, sigchld_code_to_string(s->code),
prefix, s->status);
}
| 0
|
195,790
|
UNCURL_EXPORT int32_t uncurl_ws_close(struct uncurl_conn *ucc, uint16_t status_code)
{
uint16_t status_code_be = htons(status_code);
return uncurl_ws_write(ucc, (char *) &status_code_be, sizeof(uint16_t), UNCURL_WSOP_CLOSE);
}
| 0
|
277,870
|
nfsd4_free_slabs(void)
{
kmem_cache_destroy(odstate_slab);
kmem_cache_destroy(openowner_slab);
kmem_cache_destroy(lockowner_slab);
kmem_cache_destroy(file_slab);
kmem_cache_destroy(stateid_slab);
kmem_cache_destroy(deleg_slab);
}
| 0
|
408,223
|
int uprobe_apply(struct inode *inode, loff_t offset,
struct uprobe_consumer *uc, bool add)
{
struct uprobe *uprobe;
struct uprobe_consumer *con;
int ret = -ENOENT;
uprobe = find_uprobe(inode, offset);
if (WARN_ON(!uprobe))
return ret;
down_write(&uprobe->register_rwsem);
for (con = uprobe->consumers; con && con != uc ; con = con->next)
;
if (con)
ret = register_for_each_vma(uprobe, add ? uc : NULL);
up_write(&uprobe->register_rwsem);
put_uprobe(uprobe);
return ret;
}
| 0
|
370,461
|
int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct proxy *backend)
{
struct uri_auth *uri_auth = backend->uri_auth;
struct http_msg *msg = &txn->req;
const char *uri = msg->chn->buf->p+ msg->sl.rq.u;
const char *h;
if (!uri_auth)
return 0;
if (txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_HEAD && txn->meth != HTTP_METH_POST)
return 0;
memset(&si->applet.ctx.stats, 0, sizeof(si->applet.ctx.stats));
si->applet.ctx.stats.st_code = STAT_STATUS_INIT;
si->applet.ctx.stats.flags |= STAT_FMT_HTML; /* assume HTML mode by default */
/* check URI size */
if (uri_auth->uri_len > msg->sl.rq.u_l)
return 0;
h = uri;
if (memcmp(h, uri_auth->uri_prefix, uri_auth->uri_len) != 0)
return 0;
h += uri_auth->uri_len;
while (h <= uri + msg->sl.rq.u_l - 3) {
if (memcmp(h, ";up", 3) == 0) {
si->applet.ctx.stats.flags |= STAT_HIDE_DOWN;
break;
}
h++;
}
if (uri_auth->refresh) {
h = uri + uri_auth->uri_len;
while (h <= uri + msg->sl.rq.u_l - 10) {
if (memcmp(h, ";norefresh", 10) == 0) {
si->applet.ctx.stats.flags |= STAT_NO_REFRESH;
break;
}
h++;
}
}
h = uri + uri_auth->uri_len;
while (h <= uri + msg->sl.rq.u_l - 4) {
if (memcmp(h, ";csv", 4) == 0) {
si->applet.ctx.stats.flags &= ~STAT_FMT_HTML;
break;
}
h++;
}
h = uri + uri_auth->uri_len;
while (h <= uri + msg->sl.rq.u_l - 8) {
if (memcmp(h, ";st=", 4) == 0) {
int i;
h += 4;
si->applet.ctx.stats.st_code = STAT_STATUS_UNKN;
for (i = STAT_STATUS_INIT + 1; i < STAT_STATUS_SIZE; i++) {
if (strncmp(stat_status_codes[i], h, 4) == 0) {
si->applet.ctx.stats.st_code = i;
break;
}
}
break;
}
h++;
}
return 1;
}
| 0
|
120,002
|
static int genl_lock_done(struct netlink_callback *cb)
{
/* our ops are always const - netlink API doesn't propagate that */
const struct genl_ops *ops = cb->data;
int rc = 0;
if (ops->done) {
genl_lock();
rc = ops->done(cb);
genl_unlock();
}
return rc;
}
| 0
|
488,426
|
static void ma_put(struct ifmcaddr6 *mc)
{
if (refcount_dec_and_test(&mc->mca_refcnt)) {
in6_dev_put(mc->idev);
kfree_rcu(mc, rcu);
}
}
| 0
|
240,906
|
static MagickBooleanType SkipDXTMipmaps(Image *image,DDSInfo *dds_info,
int texel_size,ExceptionInfo *exception)
{
register ssize_t
i;
MagickOffsetType
offset;
size_t
h,
w;
/*
Only skip mipmaps for textures and cube maps
*/
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
return(MagickFalse);
}
if (dds_info->ddscaps1 & DDSCAPS_MIPMAP
&& (dds_info->ddscaps1 & DDSCAPS_TEXTURE
|| dds_info->ddscaps2 & DDSCAPS2_CUBEMAP))
{
w = DIV2(dds_info->width);
h = DIV2(dds_info->height);
/*
Mipmapcount includes the main image, so start from one
*/
for (i = 1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
{
offset = (MagickOffsetType) ((w + 3) / 4) * ((h + 3) / 4) * texel_size;
if (SeekBlob(image,offset,SEEK_CUR) < 0)
break;
w = DIV2(w);
h = DIV2(h);
}
}
return(MagickTrue);
}
| 0
|
519,646
|
longlong Field_datetime_with_dec::val_int(void)
{
MYSQL_TIME ltime;
get_date(<ime, 0);
return TIME_to_ulonglong_datetime(<ime);
}
| 0
|
130,873
|
static int shash_async_update(struct ahash_request *req)
{
return shash_ahash_update(req, ahash_request_ctx(req));
}
| 0
|
149,366
|
int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg)
{
int64_t deadline = -1;
QEMUClockType type;
bool play = replay_mode == REPLAY_MODE_PLAY;
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
if (qemu_clock_use_for_deadline(type)) {
if (!play || type == QEMU_CLOCK_REALTIME) {
deadline = qemu_soonest_timeout(deadline,
timerlist_deadline_ns(tlg->tl[type]));
} else {
/* Read clock from the replay file and
do not calculate the deadline, based on virtual clock. */
qemu_clock_get_ns(type);
}
}
}
return deadline;
}
| 0
|
373,096
|
void PostgreSqlStorage::removeIdentity(UserId user, IdentityId identityId)
{
QSqlDatabase db = logDb();
if (!db.transaction()) {
qWarning() << "PostgreSqlStorage::removeIdentity(): Unable to start Transaction!";
qWarning() << " -" << qPrintable(db.lastError().text());
return;
}
QSqlQuery query(db);
query.prepare(queryString("delete_identity"));
query.bindValue(":identityid", identityId.toInt());
query.bindValue(":userid", user.toInt());
safeExec(query);
if (!watchQuery(query)) {
db.rollback();
}
else {
db.commit();
}
}
| 0
|
382,605
|
keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr)
{
KEYDB_SEARCH_DESC desc;
memset (&desc, 0, sizeof desc);
desc.mode = KEYDB_SEARCH_MODE_FPR;
memcpy (desc.u.fpr, fpr, MAX_FINGERPRINT_LEN);
return keydb_search (hd, &desc, 1, NULL);
}
| 0
|
32,564
|
ParamsRegions ParamsWeightRegions() const override {
return params_desc_.params_weights();
}
| 0
|
398,510
|
static void megasas_write_sense(MegasasCmd *cmd, SCSISense sense)
{
uint8_t sense_buf[SCSI_SENSE_BUF_SIZE];
uint8_t sense_len = 18;
memset(sense_buf, 0, sense_len);
sense_buf[0] = 0xf0;
sense_buf[2] = sense.key;
sense_buf[7] = 10;
sense_buf[12] = sense.asc;
sense_buf[13] = sense.ascq;
megasas_build_sense(cmd, sense_buf, sense_len);
}
| 0
|
391,159
|
init_ecdh(SSL_CTX * sctx, host_item * host)
{
EC_KEY * ecdh;
uschar * exp_curve;
int nid;
BOOL rv;
#ifdef OPENSSL_NO_ECDH
return TRUE;
#else
if (host) /* No ECDH setup for clients, only for servers */
return TRUE;
# ifndef EXIM_HAVE_ECDH
DEBUG(D_tls)
debug_printf("No OpenSSL API to define ECDH parameters, skipping\n");
return TRUE;
# else
if (!expand_check(tls_eccurve, US"tls_eccurve", &exp_curve))
return FALSE;
if (!exp_curve || !*exp_curve)
return TRUE;
# ifdef EXIM_HAVE_OPENSSL_ECDH_AUTO
/* check if new enough library to support auto ECDH temp key parameter selection */
if (Ustrcmp(exp_curve, "auto") == 0)
{
DEBUG(D_tls) debug_printf(
"ECDH temp key parameter settings: OpenSSL 1.2+ autoselection\n");
SSL_CTX_set_ecdh_auto(sctx, 1);
return TRUE;
}
# endif
DEBUG(D_tls) debug_printf("ECDH: curve '%s'\n", exp_curve);
if ( (nid = OBJ_sn2nid (CCS exp_curve)) == NID_undef
# ifdef EXIM_HAVE_OPENSSL_EC_NIST2NID
&& (nid = EC_curve_nist2nid(CCS exp_curve)) == NID_undef
# endif
)
{
tls_error(string_sprintf("Unknown curve name tls_eccurve '%s'",
exp_curve),
host, NULL);
return FALSE;
}
if (!(ecdh = EC_KEY_new_by_curve_name(nid)))
{
tls_error("Unable to create ec curve", host, NULL);
return FALSE;
}
/* The "tmp" in the name here refers to setting a temporary key
not to the stability of the interface. */
if ((rv = SSL_CTX_set_tmp_ecdh(sctx, ecdh) == 0))
tls_error(string_sprintf("Error enabling '%s' curve", exp_curve), host, NULL);
else
DEBUG(D_tls) debug_printf("ECDH: enabled '%s' curve\n", exp_curve);
EC_KEY_free(ecdh);
return !rv;
# endif /*EXIM_HAVE_ECDH*/
#endif /*OPENSSL_NO_ECDH*/
}
| 0
|
404,235
|
static int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr)
{
struct ethtool_coalesce coalesce;
if (!dev->ethtool_ops->set_coalesce)
return -EOPNOTSUPP;
if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
return -EFAULT;
return dev->ethtool_ops->set_coalesce(dev, &coalesce);
}
| 0
|
24,186
|
static VALUE ossl_cipher_initialize ( VALUE self , VALUE str ) {
EVP_CIPHER_CTX * ctx ;
const EVP_CIPHER * cipher ;
char * name ;
name = StringValueCStr ( str ) ;
GetCipherInit ( self , ctx ) ;
if ( ctx ) {
ossl_raise ( rb_eRuntimeError , "Cipher already inititalized!" ) ;
}
AllocCipher ( self , ctx ) ;
if ( ! ( cipher = EVP_get_cipherbyname ( name ) ) ) {
ossl_raise ( rb_eRuntimeError , "unsupported cipher algorithm (%" PRIsVALUE ")" , str ) ;
}
if ( EVP_CipherInit_ex ( ctx , cipher , NULL , NULL , NULL , - 1 ) != 1 ) ossl_raise ( eCipherError , NULL ) ;
return self ;
}
| 0
|
42,316
|
int wc_ecc_export_private_raw(ecc_key* key, byte* qx, word32* qxLen,
byte* qy, word32* qyLen, byte* d, word32* dLen)
{
return wc_ecc_export_ex(key, qx, qxLen, qy, qyLen, d, dLen,
WC_TYPE_UNSIGNED_BIN);
}
| 0
|
301,691
|
static gboolean property_get_roles(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *user_data)
{
struct btd_adapter *adapter = user_data;
DBusMessageIter entry;
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &entry);
if (adapter->supported_settings & MGMT_SETTING_LE) {
const char *str = "central";
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
}
if (adapter->supported_settings & MGMT_SETTING_ADVERTISING) {
const char *str = "peripheral";
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
}
if (adapter->le_simult_roles_supported) {
const char *str = "central-peripheral";
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &str);
}
dbus_message_iter_close_container(iter, &entry);
return TRUE;
}
| 0
|
94,310
|
LineBitmapRequester::~LineBitmapRequester(void)
{
UBYTE i;
if (m_ppDownsampler) {
for(i = 0;i < m_ucCount;i++) {
delete m_ppDownsampler[i];
}
m_pEnviron->FreeMem(m_ppDownsampler,m_ucCount * sizeof(class DownsamplerBase *));
}
if (m_ppUpsampler) {
for(i = 0;i < m_ucCount;i++) {
delete m_ppUpsampler[i];
}
m_pEnviron->FreeMem(m_ppUpsampler,m_ucCount * sizeof(class UpsamplerBase *));
}
if (m_ppTempIBM) {
for(i = 0;i < m_ucCount;i++) {
delete m_ppTempIBM[i];
}
m_pEnviron->FreeMem(m_ppTempIBM,m_ucCount * sizeof(struct ImageBitMap *));
}
if (m_pulReadyLines)
m_pEnviron->FreeMem(m_pulReadyLines,m_ucCount * sizeof(ULONG));
if (m_pppImage)
m_pEnviron->FreeMem(m_pppImage,m_ucCount * sizeof(struct Line **));
}
| 0
|
408,880
|
page_objects_dump(pdf_write_state *opts)
{
page_objects_list *pol = opts->page_object_lists;
int i, j;
for (i = 0; i < pol->len; i++)
{
page_objects *p = pol->page[i];
fprintf(stderr, "Page %d\n", i+1);
for (j = 0; j < p->len; j++)
{
int o = p->object[j];
fprintf(stderr, "\tObject %d: use=%x\n", o, opts->use_list[o]);
}
fprintf(stderr, "Byte range=%d->%d\n", p->min_ofs, p->max_ofs);
fprintf(stderr, "Number of objects=%d, Number of shared objects=%d\n", p->num_objects, p->num_shared);
fprintf(stderr, "Page object number=%d\n", p->page_object_number);
}
}
| 0
|
513,581
|
uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *session)
{
return session->ext.max_fragment_len_mode;
}
| 0
|
429,621
|
MagickExport Image *NewMagickImage(const ImageInfo *image_info,
const size_t width,const size_t height,const PixelInfo *background,
ExceptionInfo *exception)
{
CacheView
*image_view;
Image
*image;
MagickBooleanType
status;
ssize_t
y;
assert(image_info != (const ImageInfo *) NULL);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image_info->signature == MagickCoreSignature);
assert(background != (const PixelInfo *) NULL);
image=AcquireImage(image_info,exception);
image->columns=width;
image->rows=height;
image->colorspace=background->colorspace;
image->alpha_trait=background->alpha_trait;
image->fuzz=background->fuzz;
image->depth=background->depth;
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(status) \
magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelViaPixelInfo(image,background,q);
q+=GetPixelChannels(image);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
image=DestroyImage(image);
return(image);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.