idx
int64 | func
string | target
int64 |
|---|---|---|
443,921
|
socket_client_timed_out_write_connected (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
TestConnection *test = user_data;
GSocketConnection *connection;
GError *error = NULL;
connection = g_socket_client_connect_finish (G_SOCKET_CLIENT (source),
result, &error);
g_assert_no_error (error);
test->client_connection = G_IO_STREAM (connection);
/* We need to use an idle callback here to guarantee that the upcoming call
* to g_input_stream_read() executes on the next iteration of the main
* context. Otherwise, we could deadlock ourselves: the read would not be able
* to complete if GTask executes socket_client_timed_out_write_connected()
* using g_task_return_now() instead of posting the invocation to the next
* iteration of the main context, because the server will not progress until
* the main context is iterated, but iteration would be blocked waiting for
* client's read to complete.
*/
g_idle_add (socket_client_timed_out_write, test);
}
| 0
|
251,703
|
static void methodWithEnforceRangeInt64Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithEnforceRangeInt64", "TestObject", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
exceptionState.throwIfNeeded();
return;
}
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(long long, value, toInt64(info[0], EnforceRange, exceptionState), exceptionState);
imp->methodWithEnforceRangeInt64(value);
}
| 0
|
314,305
|
void HTMLInputElement::setFiles(FileList* files) {
input_type_->SetFiles(files);
}
| 0
|
403,398
|
static void store_param_double(NET *net, MYSQL_BIND *param)
{
double value= *(double*) param->buffer;
float8store(net->write_pos, value);
net->write_pos+= 8;
}
| 0
|
57,275
|
eval_fname_script(char_u *p)
{
// Use MB_STRICMP() because in Turkish comparing the "I" may not work with
// the standard library function.
if (p[0] == '<' && (MB_STRNICMP(p + 1, "SID>", 4) == 0
|| MB_STRNICMP(p + 1, "SNR>", 4) == 0))
return 5;
if (p[0] == 's' && p[1] == ':')
return 2;
return 0;
}
| 0
|
396,278
|
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC) /* {{{ */
{
zend_fcall_info_cache fcc;
if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, NULL, &fcc, NULL TSRMLS_CC)) {
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_dtor(callable);
array_init(callable);
add_next_index_string(callable, fcc.calling_scope->name, 1);
add_next_index_string(callable, fcc.function_handler->common.function_name, 1);
}
if (fcc.function_handler &&
((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
(fcc.function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER)) ||
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) {
efree((char*)fcc.function_handler->common.function_name);
}
efree(fcc.function_handler);
}
return 1;
}
return 0;
}
| 0
|
377,057
|
void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops,
void *opaque)
{
bs->dev_ops = ops;
bs->dev_opaque = opaque;
}
| 0
|
88,801
|
NOEXPORT void name_list_append(NAME_LIST **ptr, char *name) {
while(*ptr) /* find the null pointer */
ptr=&(*ptr)->next;
*ptr=str_alloc_detached(sizeof(NAME_LIST));
(*ptr)->name=str_dup_detached(name);
(*ptr)->next=NULL;
}
| 0
|
401,397
|
void Smb4KUnmountJob::setupUnmount( const QList<Smb4KShare *> &shares, bool force, bool silent, bool synchron, QWidget* parent )
{
QListIterator<Smb4KShare *> it( shares );
while ( it.hasNext() )
{
Smb4KShare *share = it.next();
Q_ASSERT( share );
m_shares << new Smb4KShare( *share );
}
m_force = force;
m_silent = silent;
m_synchron = synchron;
m_parent_widget = parent;
}
| 0
|
488,250
|
njs_value_method(njs_vm_t *vm, njs_value_t *value, njs_value_t *key,
njs_value_t *retval)
{
njs_int_t ret;
ret = njs_value_to_object(vm, value);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
ret = njs_value_property(vm, value, key, retval);
if (njs_slow_path(ret != NJS_OK)) {
return (ret == NJS_DECLINED) ? NJS_OK : ret;
}
if (njs_slow_path(!njs_is_function(retval))) {
njs_type_error(vm, "method is not callable");
return NJS_ERROR;
}
return NJS_OK;
}
| 0
|
14,895
|
vpx_codec_err_t vp9_parse_superframe_index ( const uint8_t * data , size_t data_sz , uint32_t sizes [ 8 ] , int * count , vpx_decrypt_cb decrypt_cb , void * decrypt_state ) {
uint8_t marker ;
assert ( data_sz ) ;
marker = read_marker ( decrypt_cb , decrypt_state , data + data_sz - 1 ) ;
* count = 0 ;
if ( ( marker & 0xe0 ) == 0xc0 ) {
const uint32_t frames = ( marker & 0x7 ) + 1 ;
const uint32_t mag = ( ( marker >> 3 ) & 0x3 ) + 1 ;
const size_t index_sz = 2 + mag * frames ;
if ( data_sz < index_sz ) return VPX_CODEC_CORRUPT_FRAME ;
{
const uint8_t marker2 = read_marker ( decrypt_cb , decrypt_state , data + data_sz - index_sz ) ;
if ( marker != marker2 ) return VPX_CODEC_CORRUPT_FRAME ;
}
{
uint32_t i , j ;
const uint8_t * x = & data [ data_sz - index_sz + 1 ] ;
uint8_t clear_buffer [ 32 ] ;
assert ( sizeof ( clear_buffer ) >= frames * mag ) ;
if ( decrypt_cb ) {
decrypt_cb ( decrypt_state , x , clear_buffer , frames * mag ) ;
x = clear_buffer ;
}
for ( i = 0 ;
i < frames ;
++ i ) {
uint32_t this_sz = 0 ;
for ( j = 0 ;
j < mag ;
++ j ) this_sz |= ( * x ++ ) << ( j * 8 ) ;
sizes [ i ] = this_sz ;
}
* count = frames ;
}
}
return VPX_CODEC_OK ;
}
| 0
|
120,922
|
void CoreUserInputHandler::handleBan(const BufferInfo &bufferInfo, const QString &msg)
{
banOrUnban(bufferInfo, msg, true);
}
| 0
|
456,371
|
int search_binary_handler(struct linux_binprm *bprm)
{
bool need_retry = IS_ENABLED(CONFIG_MODULES);
struct linux_binfmt *fmt;
int retval;
/* This allows 4 levels of binfmt rewrites before failing hard. */
if (bprm->recursion_depth > 5)
return -ELOOP;
retval = security_bprm_check(bprm);
if (retval)
return retval;
retval = -ENOENT;
retry:
read_lock(&binfmt_lock);
list_for_each_entry(fmt, &formats, lh) {
if (!try_module_get(fmt->module))
continue;
read_unlock(&binfmt_lock);
bprm->recursion_depth++;
retval = fmt->load_binary(bprm);
bprm->recursion_depth--;
read_lock(&binfmt_lock);
put_binfmt(fmt);
if (retval < 0 && !bprm->mm) {
/* we got to flush_old_exec() and failed after it */
read_unlock(&binfmt_lock);
force_sigsegv(SIGSEGV);
return retval;
}
if (retval != -ENOEXEC || !bprm->file) {
read_unlock(&binfmt_lock);
return retval;
}
}
read_unlock(&binfmt_lock);
if (need_retry) {
if (printable(bprm->buf[0]) && printable(bprm->buf[1]) &&
printable(bprm->buf[2]) && printable(bprm->buf[3]))
return retval;
if (request_module("binfmt-%04x", *(ushort *)(bprm->buf + 2)) < 0)
return retval;
need_retry = false;
goto retry;
}
return retval;
}
| 0
|
327,366
|
static void do_wav_capture(Monitor *mon, const QDict *qdict)
{
const char *path = qdict_get_str(qdict, "path");
int has_freq = qdict_haskey(qdict, "freq");
int freq = qdict_get_try_int(qdict, "freq", -1);
int has_bits = qdict_haskey(qdict, "bits");
int bits = qdict_get_try_int(qdict, "bits", -1);
int has_channels = qdict_haskey(qdict, "nchannels");
int nchannels = qdict_get_try_int(qdict, "nchannels", -1);
CaptureState *s;
s = qemu_mallocz (sizeof (*s));
freq = has_freq ? freq : 44100;
bits = has_bits ? bits : 16;
nchannels = has_channels ? nchannels : 2;
if (wav_start_capture (s, path, freq, bits, nchannels)) {
monitor_printf(mon, "Faied to add wave capture\n");
qemu_free (s);
}
QLIST_INSERT_HEAD (&capture_head, s, entries);
}
| 1
|
521,736
|
bool Item_func_locate::fix_length_and_dec()
{
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
}
| 0
|
71,342
|
int wc_PubKeyPemToDer(const unsigned char* pem, int pemSz,
unsigned char* buff, int buffSz)
{
int ret;
DerBuffer* der = NULL;
WOLFSSL_ENTER("wc_PubKeyPemToDer");
if (pem == NULL || buff == NULL || buffSz <= 0) {
WOLFSSL_MSG("Bad pem der args");
return BAD_FUNC_ARG;
}
ret = PemToDer(pem, pemSz, PUBLICKEY_TYPE, &der, NULL, NULL, NULL);
if (ret < 0 || der == NULL) {
WOLFSSL_MSG("Bad Pem To Der");
}
else {
if (der->length <= (word32)buffSz) {
XMEMCPY(buff, der->buffer, der->length);
ret = der->length;
}
else {
WOLFSSL_MSG("Bad der length");
ret = BAD_FUNC_ARG;
}
}
FreeDer(&der);
return ret;
}
| 0
|
436,443
|
static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp,
u8 feature_index, u8 char_index, char *device_name, int len_buf)
{
struct hidpp_report response;
int ret, i;
int count;
ret = hidpp_send_fap_command_sync(hidpp, feature_index,
CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME, &char_index, 1,
&response);
if (ret > 0) {
hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
__func__, ret);
return -EPROTO;
}
if (ret)
return ret;
switch (response.report_id) {
case REPORT_ID_HIDPP_VERY_LONG:
count = hidpp->very_long_report_length - 4;
break;
case REPORT_ID_HIDPP_LONG:
count = HIDPP_REPORT_LONG_LENGTH - 4;
break;
case REPORT_ID_HIDPP_SHORT:
count = HIDPP_REPORT_SHORT_LENGTH - 4;
break;
default:
return -EPROTO;
}
if (len_buf < count)
count = len_buf;
for (i = 0; i < count; i++)
device_name[i] = response.fap.params[i];
return count;
}
| 0
|
521,086
|
bool group() const { return m_group; }
| 0
|
204,964
|
bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::SubmitDecode(
const scoped_refptr<VP8Picture>& pic,
const media::Vp8FrameHeader* frame_hdr,
const scoped_refptr<VP8Picture>& last_frame,
const scoped_refptr<VP8Picture>& golden_frame,
const scoped_refptr<VP8Picture>& alt_frame) {
VAIQMatrixBufferVP8 iq_matrix_buf;
memset(&iq_matrix_buf, 0, sizeof(VAIQMatrixBufferVP8));
const media::Vp8SegmentationHeader& sgmnt_hdr = frame_hdr->segmentation_hdr;
const media::Vp8QuantizationHeader& quant_hdr = frame_hdr->quantization_hdr;
static_assert(
arraysize(iq_matrix_buf.quantization_index) == media::kMaxMBSegments,
"incorrect quantization matrix size");
for (size_t i = 0; i < media::kMaxMBSegments; ++i) {
int q = quant_hdr.y_ac_qi;
if (sgmnt_hdr.segmentation_enabled) {
if (sgmnt_hdr.segment_feature_mode ==
media::Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE)
q = sgmnt_hdr.quantizer_update_value[i];
else
q += sgmnt_hdr.quantizer_update_value[i];
}
#define CLAMP_Q(q) std::min(std::max(q, 0), 127)
static_assert(arraysize(iq_matrix_buf.quantization_index[i]) == 6,
"incorrect quantization matrix size");
iq_matrix_buf.quantization_index[i][0] = CLAMP_Q(q);
iq_matrix_buf.quantization_index[i][1] = CLAMP_Q(q + quant_hdr.y_dc_delta);
iq_matrix_buf.quantization_index[i][2] = CLAMP_Q(q + quant_hdr.y2_dc_delta);
iq_matrix_buf.quantization_index[i][3] = CLAMP_Q(q + quant_hdr.y2_ac_delta);
iq_matrix_buf.quantization_index[i][4] = CLAMP_Q(q + quant_hdr.uv_dc_delta);
iq_matrix_buf.quantization_index[i][5] = CLAMP_Q(q + quant_hdr.uv_ac_delta);
#undef CLAMP_Q
}
if (!vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType,
sizeof(VAIQMatrixBufferVP8),
&iq_matrix_buf))
return false;
VAProbabilityDataBufferVP8 prob_buf;
memset(&prob_buf, 0, sizeof(VAProbabilityDataBufferVP8));
const media::Vp8EntropyHeader& entr_hdr = frame_hdr->entropy_hdr;
ARRAY_MEMCPY_CHECKED(prob_buf.dct_coeff_probs, entr_hdr.coeff_probs);
if (!vaapi_wrapper_->SubmitBuffer(VAProbabilityBufferType,
sizeof(VAProbabilityDataBufferVP8),
&prob_buf))
return false;
VAPictureParameterBufferVP8 pic_param;
memset(&pic_param, 0, sizeof(VAPictureParameterBufferVP8));
pic_param.frame_width = frame_hdr->width;
pic_param.frame_height = frame_hdr->height;
if (last_frame) {
scoped_refptr<VaapiDecodeSurface> last_frame_surface =
VP8PictureToVaapiDecodeSurface(last_frame);
pic_param.last_ref_frame = last_frame_surface->va_surface()->id();
} else {
pic_param.last_ref_frame = VA_INVALID_SURFACE;
}
if (golden_frame) {
scoped_refptr<VaapiDecodeSurface> golden_frame_surface =
VP8PictureToVaapiDecodeSurface(golden_frame);
pic_param.golden_ref_frame = golden_frame_surface->va_surface()->id();
} else {
pic_param.golden_ref_frame = VA_INVALID_SURFACE;
}
if (alt_frame) {
scoped_refptr<VaapiDecodeSurface> alt_frame_surface =
VP8PictureToVaapiDecodeSurface(alt_frame);
pic_param.alt_ref_frame = alt_frame_surface->va_surface()->id();
} else {
pic_param.alt_ref_frame = VA_INVALID_SURFACE;
}
pic_param.out_of_loop_frame = VA_INVALID_SURFACE;
const media::Vp8LoopFilterHeader& lf_hdr = frame_hdr->loopfilter_hdr;
#define FHDR_TO_PP_PF(a, b) pic_param.pic_fields.bits.a = (b);
FHDR_TO_PP_PF(key_frame, frame_hdr->IsKeyframe() ? 0 : 1);
FHDR_TO_PP_PF(version, frame_hdr->version);
FHDR_TO_PP_PF(segmentation_enabled, sgmnt_hdr.segmentation_enabled);
FHDR_TO_PP_PF(update_mb_segmentation_map,
sgmnt_hdr.update_mb_segmentation_map);
FHDR_TO_PP_PF(update_segment_feature_data,
sgmnt_hdr.update_segment_feature_data);
FHDR_TO_PP_PF(filter_type, lf_hdr.type);
FHDR_TO_PP_PF(sharpness_level, lf_hdr.sharpness_level);
FHDR_TO_PP_PF(loop_filter_adj_enable, lf_hdr.loop_filter_adj_enable);
FHDR_TO_PP_PF(mode_ref_lf_delta_update, lf_hdr.mode_ref_lf_delta_update);
FHDR_TO_PP_PF(sign_bias_golden, frame_hdr->sign_bias_golden);
FHDR_TO_PP_PF(sign_bias_alternate, frame_hdr->sign_bias_alternate);
FHDR_TO_PP_PF(mb_no_coeff_skip, frame_hdr->mb_no_skip_coeff);
FHDR_TO_PP_PF(loop_filter_disable, lf_hdr.level == 0);
#undef FHDR_TO_PP_PF
ARRAY_MEMCPY_CHECKED(pic_param.mb_segment_tree_probs, sgmnt_hdr.segment_prob);
static_assert(arraysize(sgmnt_hdr.lf_update_value) ==
arraysize(pic_param.loop_filter_level),
"loop filter level arrays mismatch");
for (size_t i = 0; i < arraysize(sgmnt_hdr.lf_update_value); ++i) {
int lf_level = lf_hdr.level;
if (sgmnt_hdr.segmentation_enabled) {
if (sgmnt_hdr.segment_feature_mode ==
media::Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE)
lf_level = sgmnt_hdr.lf_update_value[i];
else
lf_level += sgmnt_hdr.lf_update_value[i];
}
lf_level = std::min(std::max(lf_level, 0), 63);
pic_param.loop_filter_level[i] = lf_level;
}
static_assert(arraysize(lf_hdr.ref_frame_delta) ==
arraysize(pic_param.loop_filter_deltas_ref_frame) &&
arraysize(lf_hdr.mb_mode_delta) ==
arraysize(pic_param.loop_filter_deltas_mode) &&
arraysize(lf_hdr.ref_frame_delta) ==
arraysize(lf_hdr.mb_mode_delta),
"loop filter deltas arrays size mismatch");
for (size_t i = 0; i < arraysize(lf_hdr.ref_frame_delta); ++i) {
pic_param.loop_filter_deltas_ref_frame[i] = lf_hdr.ref_frame_delta[i];
pic_param.loop_filter_deltas_mode[i] = lf_hdr.mb_mode_delta[i];
}
#define FHDR_TO_PP(a) pic_param.a = frame_hdr->a;
FHDR_TO_PP(prob_skip_false);
FHDR_TO_PP(prob_intra);
FHDR_TO_PP(prob_last);
FHDR_TO_PP(prob_gf);
#undef FHDR_TO_PP
ARRAY_MEMCPY_CHECKED(pic_param.y_mode_probs, entr_hdr.y_mode_probs);
ARRAY_MEMCPY_CHECKED(pic_param.uv_mode_probs, entr_hdr.uv_mode_probs);
ARRAY_MEMCPY_CHECKED(pic_param.mv_probs, entr_hdr.mv_probs);
pic_param.bool_coder_ctx.range = frame_hdr->bool_dec_range;
pic_param.bool_coder_ctx.value = frame_hdr->bool_dec_value;
pic_param.bool_coder_ctx.count = frame_hdr->bool_dec_count;
if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType,
sizeof(VAPictureParameterBufferVP8),
&pic_param))
return false;
VASliceParameterBufferVP8 slice_param;
memset(&slice_param, 0, sizeof(VASliceParameterBufferVP8));
slice_param.slice_data_size = frame_hdr->frame_size;
slice_param.slice_data_offset = frame_hdr->first_part_offset;
slice_param.slice_data_flag = VA_SLICE_DATA_FLAG_ALL;
slice_param.macroblock_offset = frame_hdr->macroblock_bit_offset;
slice_param.num_of_partitions = frame_hdr->num_of_dct_partitions + 1;
slice_param.partition_size[0] =
frame_hdr->first_part_size - ((frame_hdr->macroblock_bit_offset + 7) / 8);
for (size_t i = 0; i < frame_hdr->num_of_dct_partitions; ++i)
slice_param.partition_size[i + 1] = frame_hdr->dct_partition_sizes[i];
if (!vaapi_wrapper_->SubmitBuffer(VASliceParameterBufferType,
sizeof(VASliceParameterBufferVP8),
&slice_param))
return false;
void* non_const_ptr = const_cast<uint8*>(frame_hdr->data);
if (!vaapi_wrapper_->SubmitBuffer(VASliceDataBufferType,
frame_hdr->frame_size,
non_const_ptr))
return false;
scoped_refptr<VaapiDecodeSurface> dec_surface =
VP8PictureToVaapiDecodeSurface(pic);
return vaapi_dec_->DecodeSurface(dec_surface);
}
| 0
|
342,478
|
static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s)
{
CURLState *state = NULL;
int i, j;
do {
for (i=0; i<CURL_NUM_STATES; i++) {
for (j=0; j<CURL_NUM_ACB; j++)
if (s->states[i].acb[j])
continue;
if (s->states[i].in_use)
continue;
state = &s->states[i];
state->in_use = 1;
break;
}
if (!state) {
qemu_mutex_unlock(&s->mutex);
aio_poll(bdrv_get_aio_context(bs), true);
qemu_mutex_lock(&s->mutex);
}
} while(!state);
if (!state->curl) {
state->curl = curl_easy_init();
if (!state->curl) {
return NULL;
}
curl_easy_setopt(state->curl, CURLOPT_URL, s->url);
curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER,
(long) s->sslverify);
if (s->cookie) {
curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie);
}
curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout);
curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION,
(void *)curl_read_cb);
curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state);
curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state);
curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg);
curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1);
if (s->username) {
curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username);
}
if (s->password) {
curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password);
}
if (s->proxyusername) {
curl_easy_setopt(state->curl,
CURLOPT_PROXYUSERNAME, s->proxyusername);
}
if (s->proxypassword) {
curl_easy_setopt(state->curl,
CURLOPT_PROXYPASSWORD, s->proxypassword);
}
/* Restrict supported protocols to avoid security issues in the more
* obscure protocols. For example, do not allow POP3/SMTP/IMAP see
* CVE-2013-0249.
*
* Restricting protocols is only supported from 7.19.4 upwards.
*/
#if LIBCURL_VERSION_NUM >= 0x071304
curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS);
curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS);
#endif
#ifdef DEBUG_VERBOSE
curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1);
#endif
}
QLIST_INIT(&state->sockets);
state->s = s;
return state;
}
| 1
|
154,986
|
static int core_anal_graph_construct_edges(RCore *core, RAnalFunction *fcn, int opts, PJ *pj, Sdb *DB) {
RAnalBlock *bbi;
RListIter *iter;
int is_keva = opts & R_CORE_ANAL_KEYVALUE;
int is_star = opts & R_CORE_ANAL_STAR;
int is_json = opts & R_CORE_ANAL_JSON;
int is_html = r_cons_context ()->is_html;
char *pal_jump = palColorFor ("graph.true");
char *pal_fail = palColorFor ("graph.false");
char *pal_trfa = palColorFor ("graph.trufae");
int nodes = 0;
r_list_foreach (fcn->bbs, iter, bbi) {
if (bbi->jump != UT64_MAX) {
nodes++;
if (is_keva) {
char key[128];
char val[128];
snprintf (key, sizeof (key), "bb.0x%08"PFMT64x".to", bbi->addr);
if (bbi->fail != UT64_MAX) {
snprintf (val, sizeof (val), "0x%08"PFMT64x, bbi->jump);
} else {
snprintf (val, sizeof (val), "0x%08"PFMT64x ",0x%08"PFMT64x,
bbi->jump, bbi->fail);
}
// bb.<addr>.to=<jump>,<fail>
sdb_set (DB, key, val, 0);
} else if (is_html) {
r_cons_printf ("<div class=\"connector _0x%08"PFMT64x" _0x%08"PFMT64x"\">\n"
" <img class=\"connector-end\" src=\"img/arrow.gif\" /></div>\n",
bbi->addr, bbi->jump);
} else if (!is_json && !is_keva) {
if (is_star) {
char *from = get_title (bbi->addr);
char *to = get_title (bbi->jump);
r_cons_printf ("age %s %s\n", from, to);
free (from);
free (to);
} else {
r_strf_buffer (128);
const char* edge_color = bbi->fail != -1 ? pal_jump : pal_trfa;
if (sdb_const_get (core->sdb, r_strf ("agraph.edge.0x%"PFMT64x"_0x%"PFMT64x".highlight", bbi->addr, bbi->jump), 0)) {
edge_color = "cyan";
}
r_cons_printf (" \"0x%08"PFMT64x"\" -> \"0x%08"PFMT64x"\" "
"[color=\"%s\"];\n", bbi->addr, bbi->jump, edge_color);
core_anal_color_curr_node (core, bbi);
}
}
}
if (bbi->fail != -1) {
nodes++;
if (is_html) {
r_cons_printf ("<div class=\"connector _0x%08"PFMT64x" _0x%08"PFMT64x"\">\n"
" <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
bbi->addr, bbi->fail);
} else if (!is_keva && !is_json) {
if (is_star) {
char *from = get_title (bbi->addr);
char *to = get_title (bbi->fail);
r_cons_printf ("age %s %s\n", from, to);
free(from);
free(to);
} else {
r_cons_printf (" \"0x%08"PFMT64x"\" -> \"0x%08"PFMT64x"\" "
"[color=\"%s\"];\n", bbi->addr, bbi->fail, pal_fail);
core_anal_color_curr_node (core, bbi);
}
}
}
if (bbi->switch_op) {
RAnalCaseOp *caseop;
RListIter *iter;
if (bbi->fail != UT64_MAX) {
if (is_html) {
r_cons_printf ("<div class=\"connector _0x%08"PFMT64x" _0x%08"PFMT64x"\">\n"
" <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
bbi->addr, bbi->fail);
} else if (!is_keva && !is_json) {
if (is_star) {
char *from = get_title (bbi->addr);
char *to = get_title (bbi->fail);
r_cons_printf ("age %s %s\n", from, to);
free(from);
free(to);
} else {
r_cons_printf (" \"0x%08"PFMT64x"\" -> \"0x%08"PFMT64x"\" "
"[color=\"%s\"];\n", bbi->addr, bbi->fail, pal_fail);
core_anal_color_curr_node (core, bbi);
}
}
}
r_list_foreach (bbi->switch_op->cases, iter, caseop) {
nodes++;
if (is_keva) {
char key[128];
snprintf (key, sizeof (key),
"bb.0x%08"PFMT64x".switch.%"PFMT64d,
bbi->addr, caseop->value);
sdb_num_set (DB, key, caseop->jump, 0);
snprintf (key, sizeof (key),
"bb.0x%08"PFMT64x".switch", bbi->addr);
sdb_array_add_num (DB, key, caseop->value, 0);
} else if (is_html) {
r_cons_printf ("<div class=\"connector _0x%08" PFMT64x " _0x%08" PFMT64x "\">\n"
" <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
bbi->addr, caseop->addr);
} else if (!is_json && !is_keva) {
if (is_star) {
char *from = get_title (bbi->addr);
char *to = get_title (caseop->addr);
r_cons_printf ("age %s %s\n", from ,to);
free (from);
free (to);
} else {
r_cons_printf (" \"0x%08" PFMT64x "\" -> \"0x%08" PFMT64x "\" "
"[color=\"%s\"];\n",
bbi->addr, caseop->addr, pal_trfa);
core_anal_color_curr_node (core, bbi);
}
}
}
}
}
free(pal_jump);
free(pal_fail);
free(pal_trfa);
return nodes;
}
| 0
|
116,193
|
PHP_FUNCTION(imagefilledarc)
{
zval *IM;
long cx, cy, w, h, ST, E, col, style;
gdImagePtr im;
int e, st;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
e = E;
if (e < 0) {
e %= 360;
}
st = ST;
if (st < 0) {
st %= 360;
}
gdImageFilledArc(im, cx, cy, w, h, st, e, col, style);
RETURN_TRUE;
}
| 0
|
182,451
|
static void testObjectPythonAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectPythonV8Internal::testObjectPythonAttributeAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
459,158
|
MagickPrivate void ConvertRGBToLab(const double red,const double green,
const double blue,double *L,double *a,double *b)
{
double
X,
Y,
Z;
ConvertRGBToXYZ(red,green,blue,&X,&Y,&Z);
ConvertXYZToLab(X,Y,Z,L,a,b);
}
| 0
|
267,097
|
void ftrace_profile_free_filter(struct perf_event *event)
{
struct event_filter *filter = event->filter;
event->filter = NULL;
__free_filter(filter);
}
| 0
|
121,861
|
static sraSpan* sraNextSpan(sraRectangleIterator *i)
{
if(sraReverse(i))
return(i->sPtrs[i->ptrPos]->_prev);
else
return(i->sPtrs[i->ptrPos]->_next);
}
| 0
|
517,929
|
bool Item_param::convert_str_value(THD *thd)
{
bool rc= FALSE;
if ((state == SHORT_DATA_VALUE || state == LONG_DATA_VALUE) &&
value.type_handler()->cmp_type() == STRING_RESULT)
{
rc= value.cs_info.convert_if_needed(thd, &value.m_string);
/* Here str_value is guaranteed to be in final_character_set_of_str_value */
/*
str_value_ptr is returned from val_str(). It must be not alloced
to prevent it's modification by val_str() invoker.
*/
value.m_string_ptr.set(value.m_string.ptr(), value.m_string.length(),
value.m_string.charset());
/* Synchronize item charset and length with value charset */
fix_charset_and_length_from_str_value(value.m_string, DERIVATION_COERCIBLE);
}
return rc;
}
| 0
|
349,462
|
int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
off_t bl_len)
{
const char *content_type = NULL;
string content_type_str;
map<string, string> response_attrs;
map<string, string>::iterator riter;
bufferlist metadata_bl;
if (sent_header)
goto send_data;
if (custom_http_ret) {
set_req_state_err(s, 0);
dump_errno(s, custom_http_ret);
} else {
set_req_state_err(s, (partial_content && !op_ret) ? STATUS_PARTIAL_CONTENT
: op_ret);
dump_errno(s);
}
if (op_ret)
goto done;
if (range_str)
dump_range(s, start, end, s->obj_size);
if (s->system_request &&
s->info.args.exists(RGW_SYS_PARAM_PREFIX "prepend-metadata")) {
dump_header(s, "Rgwx-Object-Size", (long long)total_len);
if (rgwx_stat) {
/*
* in this case, we're not returning the object's content, only the prepended
* extra metadata
*/
total_len = 0;
}
/* JSON encode object metadata */
JSONFormatter jf;
jf.open_object_section("obj_metadata");
encode_json("attrs", attrs, &jf);
utime_t ut(lastmod);
encode_json("mtime", ut, &jf);
jf.close_section();
stringstream ss;
jf.flush(ss);
metadata_bl.append(ss.str());
dump_header(s, "Rgwx-Embedded-Metadata-Len", metadata_bl.length());
total_len += metadata_bl.length();
}
if (s->system_request && !real_clock::is_zero(lastmod)) {
/* we end up dumping mtime in two different methods, a bit redundant */
dump_epoch_header(s, "Rgwx-Mtime", lastmod);
uint64_t pg_ver = 0;
int r = decode_attr_bl_single_value(attrs, RGW_ATTR_PG_VER, &pg_ver, (uint64_t)0);
if (r < 0) {
ldout(s->cct, 0) << "ERROR: failed to decode pg ver attr, ignoring" << dendl;
}
dump_header(s, "Rgwx-Obj-PG-Ver", pg_ver);
uint32_t source_zone_short_id = 0;
r = decode_attr_bl_single_value(attrs, RGW_ATTR_SOURCE_ZONE, &source_zone_short_id, (uint32_t)0);
if (r < 0) {
ldout(s->cct, 0) << "ERROR: failed to decode pg ver attr, ignoring" << dendl;
}
if (source_zone_short_id != 0) {
dump_header(s, "Rgwx-Source-Zone-Short-Id", source_zone_short_id);
}
}
for (auto &it : crypt_http_responses)
dump_header(s, it.first, it.second);
dump_content_length(s, total_len);
dump_last_modified(s, lastmod);
dump_header_if_nonempty(s, "x-amz-version-id", version_id);
if (attrs.find(RGW_ATTR_APPEND_PART_NUM) != attrs.end()) {
dump_header(s, "x-rgw-object-type", "Appendable");
dump_header(s, "x-rgw-next-append-position", s->obj_size);
} else {
dump_header(s, "x-rgw-object-type", "Normal");
}
if (! op_ret) {
if (! lo_etag.empty()) {
/* Handle etag of Swift API's large objects (DLO/SLO). It's entirerly
* legit to perform GET on them through S3 API. In such situation,
* a client should receive the composited content with corresponding
* etag value. */
dump_etag(s, lo_etag);
} else {
auto iter = attrs.find(RGW_ATTR_ETAG);
if (iter != attrs.end()) {
dump_etag(s, iter->second.to_str());
}
}
for (struct response_attr_param *p = resp_attr_params; p->param; p++) {
bool exists;
string val = s->info.args.get(p->param, &exists);
if (exists) {
/* reject unauthenticated response header manipulation, see
* https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html */
if (s->auth.identity->is_anonymous()) {
return -EPERM;
}
if (strcmp(p->param, "response-content-type") != 0) {
response_attrs[p->http_attr] = val;
} else {
content_type_str = val;
content_type = content_type_str.c_str();
}
}
}
for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) {
const char *name = iter->first.c_str();
map<string, string>::iterator aiter = rgw_to_http_attrs.find(name);
if (aiter != rgw_to_http_attrs.end()) {
if (response_attrs.count(aiter->second) == 0) {
/* Was not already overridden by a response param. */
size_t len = iter->second.length();
string s(iter->second.c_str(), len);
while (len && !s[len - 1]) {
--len;
s.resize(len);
}
response_attrs[aiter->second] = s;
}
} else if (iter->first.compare(RGW_ATTR_CONTENT_TYPE) == 0) {
/* Special handling for content_type. */
if (!content_type) {
content_type_str = rgw_bl_str(iter->second);
content_type = content_type_str.c_str();
}
} else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) {
// this attr has an extra length prefix from encode() in prior versions
dump_header(s, "X-Object-Meta-Static-Large-Object", "True");
} else if (strncmp(name, RGW_ATTR_META_PREFIX,
sizeof(RGW_ATTR_META_PREFIX)-1) == 0) {
/* User custom metadata. */
name += sizeof(RGW_ATTR_PREFIX) - 1;
dump_header(s, name, iter->second);
} else if (iter->first.compare(RGW_ATTR_TAGS) == 0) {
RGWObjTags obj_tags;
try{
auto it = iter->second.cbegin();
obj_tags.decode(it);
} catch (buffer::error &err) {
ldout(s->cct,0) << "Error caught buffer::error couldn't decode TagSet " << dendl;
}
dump_header(s, RGW_AMZ_TAG_COUNT, obj_tags.count());
} else if (iter->first.compare(RGW_ATTR_OBJECT_RETENTION) == 0 && get_retention){
RGWObjectRetention retention;
try {
decode(retention, iter->second);
dump_header(s, "x-amz-object-lock-mode", retention.get_mode());
dump_time_header(s, "x-amz-object-lock-retain-until-date", retention.get_retain_until_date());
} catch (buffer::error& err) {
ldpp_dout(this, 0) << "ERROR: failed to decode RGWObjectRetention" << dendl;
}
} else if (iter->first.compare(RGW_ATTR_OBJECT_LEGAL_HOLD) == 0 && get_legal_hold) {
RGWObjectLegalHold legal_hold;
try {
decode(legal_hold, iter->second);
dump_header(s, "x-amz-object-lock-legal-hold",legal_hold.get_status());
} catch (buffer::error& err) {
ldpp_dout(this, 0) << "ERROR: failed to decode RGWObjectLegalHold" << dendl;
}
}
}
}
done:
for (riter = response_attrs.begin(); riter != response_attrs.end();
++riter) {
dump_header(s, riter->first, riter->second);
}
if (op_ret == -ERR_NOT_MODIFIED) {
end_header(s, this);
} else {
if (!content_type)
content_type = "binary/octet-stream";
end_header(s, this, content_type);
}
if (metadata_bl.length()) {
dump_body(s, metadata_bl);
}
sent_header = true;
send_data:
if (get_data && !op_ret) {
int r = dump_body(s, bl.c_str() + bl_ofs, bl_len);
if (r < 0)
return r;
}
return 0;
}
| 1
|
80,372
|
MOBI_RET mobi_load_reclist(MOBIData *m, FILE *file) {
if (m == NULL) {
debug_print("%s", "Mobi structure not initialized\n");
return MOBI_INIT_FAILED;
}
if (!file) {
debug_print("%s", "File not ready\n");
return MOBI_FILE_NOT_FOUND;
}
m->rec = calloc(1, sizeof(MOBIPdbRecord));
if (m->rec == NULL) {
debug_print("%s", "Memory allocation for pdb record failed\n");
return MOBI_MALLOC_FAILED;
}
MOBIPdbRecord *curr = m->rec;
for (int i = 0; i < m->ph->rec_count; i++) {
MOBIBuffer *buf = mobi_buffer_init(PALMDB_RECORD_INFO_SIZE);
if (buf == NULL) {
debug_print("%s\n", "Memory allocation failed");
return MOBI_MALLOC_FAILED;
}
const size_t len = fread(buf->data, 1, PALMDB_RECORD_INFO_SIZE, file);
if (len != PALMDB_RECORD_INFO_SIZE) {
mobi_buffer_free(buf);
return MOBI_DATA_CORRUPT;
}
if (i > 0) {
curr->next = calloc(1, sizeof(MOBIPdbRecord));
if (curr->next == NULL) {
debug_print("%s", "Memory allocation for pdb record failed\n");
mobi_buffer_free(buf);
return MOBI_MALLOC_FAILED;
}
curr = curr->next;
}
curr->offset = mobi_buffer_get32(buf);
curr->attributes = mobi_buffer_get8(buf);
const uint8_t h = mobi_buffer_get8(buf);
const uint16_t l = mobi_buffer_get16(buf);
curr->uid = (uint32_t) h << 16 | l;
curr->next = NULL;
mobi_buffer_free(buf);
}
return MOBI_SUCCESS;
}
| 0
|
85,658
|
bgp_attr_ext_communities(struct bgp_attr_parser_args *args)
{
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
const bgp_size_t length = args->length;
uint8_t sticky = 0;
if (length == 0) {
attr->ecommunity = NULL;
/* Empty extcomm doesn't seem to be invalid per se */
return BGP_ATTR_PARSE_PROCEED;
}
attr->ecommunity =
ecommunity_parse((uint8_t *)stream_pnt(peer->curr), length);
/* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp(peer->curr, length);
if (!attr->ecommunity)
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
/* Extract MAC mobility sequence number, if any. */
attr->mm_seqnum = bgp_attr_mac_mobility_seqnum(attr, &sticky);
attr->sticky = sticky;
/* Check if this is a Gateway MAC-IP advertisement */
attr->default_gw = bgp_attr_default_gw(attr);
/* Handle scenario where router flag ecommunity is not
* set but default gw ext community is present.
* Use default gateway, set and propogate R-bit.
*/
if (attr->default_gw)
attr->router_flag = 1;
/* Check EVPN Neighbor advertisement flags, R-bit */
bgp_attr_evpn_na_flag(attr, &attr->router_flag);
/* Extract the Rmac, if any */
bgp_attr_rmac(attr, &attr->rmac);
return BGP_ATTR_PARSE_PROCEED;
}
| 0
|
76,643
|
int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt)
{
int rc;
struct mntent *m;
if (!fs || !mnt)
return -EINVAL;
m = *mnt;
if (!m) {
m = calloc(1, sizeof(*m));
if (!m)
return -ENOMEM;
}
if ((rc = update_str(&m->mnt_fsname, mnt_fs_get_source(fs))))
goto err;
if ((rc = update_str(&m->mnt_dir, mnt_fs_get_target(fs))))
goto err;
if ((rc = update_str(&m->mnt_type, mnt_fs_get_fstype(fs))))
goto err;
errno = 0;
m->mnt_opts = mnt_fs_strdup_options(fs);
if (!m->mnt_opts && errno) {
rc = -errno;
goto err;
}
m->mnt_freq = mnt_fs_get_freq(fs);
m->mnt_passno = mnt_fs_get_passno(fs);
if (!m->mnt_fsname) {
m->mnt_fsname = strdup("none");
if (!m->mnt_fsname)
goto err;
}
*mnt = m;
return 0;
err:
if (m != *mnt)
mnt_free_mntent(m);
return rc;
}
| 0
|
3,578
|
static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,
oidc_session_t *session, const char *client_id,
const char *check_session_iframe) {
oidc_debug(r, "enter");
const char *java_script =
" <script type=\"text/javascript\">\n"
" var targetOrigin = '%s';\n"
" var message = '%s' + ' ' + '%s';\n"
" var timerID;\n"
"\n"
" function checkSession() {\n"
" console.debug('checkSession: posting ' + message + ' to ' + targetOrigin);\n"
" var win = window.parent.document.getElementById('%s').contentWindow;\n"
" win.postMessage( message, targetOrigin);\n"
" }\n"
"\n"
" function setTimer() {\n"
" checkSession();\n"
" timerID = setInterval('checkSession()', %s);\n"
" }\n"
"\n"
" function receiveMessage(e) {\n"
" console.debug('receiveMessage: ' + e.data + ' from ' + e.origin);\n"
" if (e.origin !== targetOrigin ) {\n"
" console.debug('receiveMessage: cross-site scripting attack?');\n"
" return;\n"
" }\n"
" if (e.data != 'unchanged') {\n"
" clearInterval(timerID);\n"
" if (e.data == 'changed') {\n"
" window.location.href = '%s?session=check';\n"
" } else {\n"
" window.location.href = '%s?session=logout';\n"
" }\n"
" }\n"
" }\n"
"\n"
" window.addEventListener('message', receiveMessage, false);\n"
"\n"
" </script>\n";
/* determine the origin for the check_session_iframe endpoint */
char *origin = apr_pstrdup(r->pool, check_session_iframe);
apr_uri_t uri;
apr_uri_parse(r->pool, check_session_iframe, &uri);
char *p = strstr(origin, uri.path);
*p = '\0';
/* the element identifier for the OP iframe */
const char *op_iframe_id = "openidc-op";
/* restore the OP session_state from the session */
const char *session_state = oidc_session_get_session_state(r, session);
if (session_state == NULL) {
oidc_warn(r,
"no session_state found in the session; the OP does probably not support session management!?");
return DONE;
}
char *s_poll_interval = NULL;
oidc_util_get_request_parameter(r, "poll", &s_poll_interval);
if (s_poll_interval == NULL)
s_poll_interval = "3000";
const char *redirect_uri = oidc_get_redirect_uri(r, c);
java_script = apr_psprintf(r->pool, java_script, origin, client_id,
session_state, op_iframe_id, s_poll_interval, redirect_uri,
redirect_uri);
return oidc_util_html_send(r, NULL, java_script, "setTimer", NULL, DONE);
}
| 1
|
80,111
|
IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
bool is_write, MemTxAttrs attrs)
{
MemoryRegionSection section;
hwaddr xlat, page_mask;
/*
* This can never be MMIO, and we don't really care about plen,
* but page mask.
*/
section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat,
NULL, &page_mask, is_write, false, &as,
attrs);
/* Illegal translation */
if (section.mr == &io_mem_unassigned) {
goto iotlb_fail;
}
/* Convert memory region offset into address space offset */
xlat += section.offset_within_address_space -
section.offset_within_region;
return (IOMMUTLBEntry) {
.target_as = as,
.iova = addr & ~page_mask,
.translated_addr = xlat & ~page_mask,
.addr_mask = page_mask,
/* IOTLBs are for DMAs, and DMA only allows on RAMs. */
.perm = IOMMU_RW,
};
iotlb_fail:
return (IOMMUTLBEntry) {0};
}
| 0
|
59,447
|
static inline void schedule_debug(struct task_struct *prev)
{
/*
* Test if we are atomic. Since do_exit() needs to call into
* schedule() atomically, we ignore that path for now.
* Otherwise, whine if we are scheduling when we should not be.
*/
if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
__schedule_bug(prev);
profile_hit(SCHED_PROFILING, __builtin_return_address(0));
schedstat_inc(this_rq(), sched_count);
}
| 0
|
211,081
|
setSwapBuffersCompleteCallbackCHROMIUM(
WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* cb) {
swapbuffers_complete_callback_ = cb;
}
| 0
|
234,613
|
void PageSnapshotTaker::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
SendMessage(false, "a modal dialog is active");
}
| 0
|
428,523
|
g_file_enumerate_children_async (GFile *file,
const char *attributes,
GFileQueryInfoFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GFileIface *iface;
g_return_if_fail (G_IS_FILE (file));
iface = G_FILE_GET_IFACE (file);
(* iface->enumerate_children_async) (file,
attributes,
flags,
io_priority,
cancellable,
callback,
user_data);
}
| 0
|
422,654
|
e_ews_connection_get_folder (EEwsConnection *cnc,
gint pri,
const gchar *folder_shape,
const EEwsAdditionalProps *add_props,
GSList *folder_ids,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
g_return_if_fail (cnc != NULL);
msg = e_ews_message_new_with_header (
cnc->priv->settings,
cnc->priv->uri,
cnc->priv->impersonate_user,
"GetFolder",
NULL,
NULL,
cnc->priv->version,
E_EWS_EXCHANGE_2007_SP1,
TRUE,
TRUE);
e_soap_message_start_element (msg, "FolderShape", "messages", NULL);
e_ews_message_write_string_parameter (msg, "BaseShape", NULL, folder_shape);
ews_append_additional_props_to_msg (msg, add_props);
e_soap_message_end_element (msg);
if (folder_ids) {
e_soap_message_start_element (msg, "FolderIds", "messages", NULL);
ews_append_folder_ids_to_msg (msg, cnc->priv->email, folder_ids);
e_soap_message_end_element (msg);
}
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_folder);
async_data = g_new0 (EwsAsyncData, 1);
async_data->cnc = cnc;
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
e_ews_connection_queue_request (
cnc, msg, get_folder_response_cb,
pri, cancellable, simple);
g_object_unref (simple);
}
| 0
|
295,544
|
R_API RConfigNode* r_config_set_i(RConfig *cfg, const char *name, const ut64 i) {
char buf[128], *ov = NULL;
if (!cfg || !name) {
return NULL;
}
RConfigNode *node = r_config_node_get (cfg, name);
if (node) {
if (node->flags & CN_RO) {
node = NULL;
goto beach;
}
if (node->value) {
ov = strdup (node->value);
if (!ov) {
node = NULL;
goto beach;
}
free (node->value);
}
if (node->flags & CN_BOOL) {
node->value = strdup (r_str_bool (i));
} else {
snprintf (buf, sizeof (buf) - 1, "%" PFMT64d, i);
node->value = strdup (buf);
}
if (!node->value) {
node = NULL;
goto beach;
}
//node->flags = CN_RW | CN_INT;
node->i_value = i;
} else {
if (!cfg->lock) {
if (i < 1024) {
snprintf (buf, sizeof (buf), "%" PFMT64d "", i);
} else {
snprintf (buf, sizeof (buf), "0x%08" PFMT64x "", i);
}
node = r_config_node_new (name, buf);
if (!node) {
node = NULL;
goto beach;
}
node->flags = CN_RW | CN_OFFT;
node->i_value = i;
if (cfg->ht) {
ht_insert (cfg->ht, node->name, node);
}
if (cfg->nodes) {
r_list_append (cfg->nodes, node);
cfg->n_nodes++;
}
} else {
eprintf ("(locked: no new keys can be created (%s))\n", name);
}
}
if (node && node->setter) {
ut64 oi = node->i_value;
int ret = node->setter (cfg->user, node);
if (!ret) {
node->i_value = oi;
free (node->value);
node->value = strdup (ov? ov: "");
}
}
beach:
free (ov);
return node;
}
| 0
|
170,301
|
DirectGLImageTransportFactory::DirectGLImageTransportFactory() {
WebKit::WebGraphicsContext3D::Attributes attrs;
attrs.shareResources = false;
attrs.noAutomaticFlushes = true;
context_.reset(
webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWindow(
attrs,
NULL,
NULL));
}
| 0
|
205,813
|
media::AudioParameters TryToFixAudioParameters(
const media::AudioParameters& params) {
DCHECK(!params.IsValid());
media::AudioParameters params_copy(params);
if (params.channels() > media::limits::kMaxChannels) {
DCHECK(params.channel_layout() == media::CHANNEL_LAYOUT_DISCRETE);
params_copy.set_channels_for_discrete(media::limits::kMaxChannels);
}
return params_copy.IsValid()
? params_copy
: media::AudioParameters::UnavailableDeviceParams();
}
| 0
|
511,942
|
vapply (func)
sh_var_map_func_t *func;
{
SHELL_VAR **list;
list = map_over (func, shell_variables);
if (list /* && posixly_correct */)
sort_variables (list);
return (list);
}
| 0
|
206,834
|
CGaiaCredentialBase::~CGaiaCredentialBase() {}
| 0
|
55,242
|
explicit MaxPoolingOp(OpKernelConstruction* context) : OpKernel(context) {
string data_format;
auto status = context->GetAttr("data_format", &data_format);
if (status.ok()) {
OP_REQUIRES(context, FormatFromString(data_format, &data_format_),
errors::InvalidArgument("Invalid data format"));
OP_REQUIRES(
context, data_format_ == FORMAT_NHWC,
errors::InvalidArgument("Default MaxPoolingOp only supports NHWC ",
"on device type ",
DeviceTypeString(context->device_type())));
} else {
data_format_ = FORMAT_NHWC;
}
OP_REQUIRES_OK(context, context->GetAttr("ksize", &ksize_));
OP_REQUIRES(context, ksize_.size() == 4,
errors::InvalidArgument("Sliding window ksize field must "
"specify 4 dimensions"));
for (int i = 0; i < ksize_.size(); ++i) {
OP_REQUIRES(context, ksize_[i] > 0,
errors::InvalidArgument("Sliding window ksize for dimension ",
i, " was zero."));
}
OP_REQUIRES_OK(context, context->GetAttr("strides", &stride_));
OP_REQUIRES(context, stride_.size() == 4,
errors::InvalidArgument("Sliding window stride field must "
"specify 4 dimensions"));
OP_REQUIRES_OK(context, context->GetAttr("padding", &padding_));
if (padding_ == Padding::EXPLICIT) {
OP_REQUIRES_OK(
context, context->GetAttr("explicit_paddings", &explicit_paddings_));
}
OP_REQUIRES(context, ksize_[0] == 1 && stride_[0] == 1,
errors::Unimplemented(
"Pooling is not yet supported on the batch dimension."));
}
| 0
|
469,579
|
Mat_VarReadData(mat_t *mat,matvar_t *matvar,void *data,
int *start,int *stride,int *edge)
{
int err = 0;
switch ( matvar->class_type ) {
case MAT_C_DOUBLE:
case MAT_C_SINGLE:
case MAT_C_INT64:
case MAT_C_UINT64:
case MAT_C_INT32:
case MAT_C_UINT32:
case MAT_C_INT16:
case MAT_C_UINT16:
case MAT_C_INT8:
case MAT_C_UINT8:
break;
default:
return -1;
}
switch ( mat->version ) {
case MAT_FT_MAT5:
err = Mat_VarReadData5(mat,matvar,data,start,stride,edge);
break;
case MAT_FT_MAT73:
#if defined(MAT73) && MAT73
err = Mat_VarReadData73(mat,matvar,data,start,stride,edge);
#else
err = 1;
#endif
break;
case MAT_FT_MAT4:
err = Mat_VarReadData4(mat,matvar,data,start,stride,edge);
break;
default:
err = 2;
break;
}
return err;
}
| 0
|
337,206
|
static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
TCGReg dest, TCGReg c1, TCGArg c2, int c2const)
{
int cc;
switch (cond) {
case TCG_COND_GTU:
case TCG_COND_GT:
do_greater:
/* The result of a compare has CC=2 for GT and CC=3 unused.
ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit. */
tgen_cmp(s, type, cond, c1, c2, c2const, true);
tcg_out_movi(s, type, dest, 0);
tcg_out_insn(s, RRE, ALCGR, dest, dest);
return;
case TCG_COND_GEU:
do_geu:
/* We need "real" carry semantics, so use SUBTRACT LOGICAL
instead of COMPARE LOGICAL. This needs an extra move. */
tcg_out_mov(s, type, TCG_TMP0, c1);
if (c2const) {
tcg_out_movi(s, TCG_TYPE_I64, dest, 0);
if (type == TCG_TYPE_I32) {
tcg_out_insn(s, RIL, SLFI, TCG_TMP0, c2);
} else {
tcg_out_insn(s, RIL, SLGFI, TCG_TMP0, c2);
}
} else {
if (type == TCG_TYPE_I32) {
tcg_out_insn(s, RR, SLR, TCG_TMP0, c2);
} else {
tcg_out_insn(s, RRE, SLGR, TCG_TMP0, c2);
}
tcg_out_movi(s, TCG_TYPE_I64, dest, 0);
}
tcg_out_insn(s, RRE, ALCGR, dest, dest);
return;
case TCG_COND_LEU:
case TCG_COND_LTU:
case TCG_COND_LT:
/* Swap operands so that we can use GEU/GTU/GT. */
if (c2const) {
tcg_out_movi(s, type, TCG_TMP0, c2);
c2 = c1;
c2const = 0;
c1 = TCG_TMP0;
} else {
TCGReg t = c1;
c1 = c2;
c2 = t;
}
if (cond == TCG_COND_LEU) {
goto do_geu;
}
cond = tcg_swap_cond(cond);
goto do_greater;
case TCG_COND_NE:
/* X != 0 is X > 0. */
if (c2const && c2 == 0) {
cond = TCG_COND_GTU;
goto do_greater;
}
break;
case TCG_COND_EQ:
/* X == 0 is X <= 0 is 0 >= X. */
if (c2const && c2 == 0) {
tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 0);
c2 = c1;
c2const = 0;
c1 = TCG_TMP0;
goto do_geu;
}
break;
default:
break;
}
cc = tgen_cmp(s, type, cond, c1, c2, c2const, false);
if (facilities & FACILITY_LOAD_ON_COND) {
/* Emit: d = 0, t = 1, d = (cc ? t : d). */
tcg_out_movi(s, TCG_TYPE_I64, dest, 0);
tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1);
tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc);
} else {
/* Emit: d = 1; if (cc) goto over; d = 0; over: */
tcg_out_movi(s, type, dest, 1);
tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1);
tcg_out_movi(s, type, dest, 0);
}
}
| 0
|
339,289
|
static void bmdma_map(PCIDevice *pci_dev, int region_num,
pcibus_t addr, pcibus_t size, int type)
{
PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, pci_dev);
int i;
for(i = 0;i < 2; i++) {
BMDMAState *bm = &d->bmdma[i];
d->bus[i].bmdma = bm;
bm->bus = d->bus+i;
qemu_add_vm_change_state_handler(ide_dma_restart_cb, bm);
register_ioport_write(addr, 1, 1, bmdma_cmd_writeb, bm);
register_ioport_write(addr + 1, 3, 1, bmdma_writeb, bm);
register_ioport_read(addr, 4, 1, bmdma_readb, bm);
register_ioport_write(addr + 4, 4, 1, bmdma_addr_writeb, bm);
register_ioport_read(addr + 4, 4, 1, bmdma_addr_readb, bm);
register_ioport_write(addr + 4, 4, 2, bmdma_addr_writew, bm);
register_ioport_read(addr + 4, 4, 2, bmdma_addr_readw, bm);
register_ioport_write(addr + 4, 4, 4, bmdma_addr_writel, bm);
register_ioport_read(addr + 4, 4, 4, bmdma_addr_readl, bm);
addr += 8;
}
}
| 1
|
64,864
|
static int tg3_init_rings(struct tg3 *tp)
{
int i;
/* Free up all the SKBs. */
tg3_free_rings(tp);
for (i = 0; i < tp->irq_cnt; i++) {
struct tg3_napi *tnapi = &tp->napi[i];
tnapi->last_tag = 0;
tnapi->last_irq_tag = 0;
tnapi->hw_status->status = 0;
tnapi->hw_status->status_tag = 0;
memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
tnapi->tx_prod = 0;
tnapi->tx_cons = 0;
if (tnapi->tx_ring)
memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES);
tnapi->rx_rcb_ptr = 0;
if (tnapi->rx_rcb)
memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) {
tg3_free_rings(tp);
return -ENOMEM;
}
}
return 0;
}
| 0
|
324,808
|
static void t_gen_lsl(TCGv d, TCGv a, TCGv b)
{
TCGv t0, t_31;
t0 = tcg_temp_new(TCG_TYPE_TL);
t_31 = tcg_temp_new(TCG_TYPE_TL);
tcg_gen_shl_tl(d, a, b);
tcg_gen_movi_tl(t_31, 31);
tcg_gen_sub_tl(t0, t_31, b);
tcg_gen_sar_tl(t0, t0, t_31);
tcg_gen_and_tl(t0, t0, d);
tcg_gen_xor_tl(d, d, t0);
tcg_temp_free(t0);
tcg_temp_free(t_31);
}
| 1
|
294,189
|
static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{
int rc;
if (!ipv6_addr_any(&sk->sk_v6_daddr)) {
sock_rps_save_rxhash(sk, skb);
sk_mark_napi_id(sk, skb);
}
rc = sock_queue_rcv_skb(sk, skb);
if (rc < 0) {
int is_udplite = IS_UDPLITE(sk);
/* Note that an ENOMEM error is charged twice */
if (rc == -ENOMEM)
UDP6_INC_STATS_BH(sock_net(sk),
UDP_MIB_RCVBUFERRORS, is_udplite);
UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
kfree_skb(skb);
return -1;
}
return 0;
}
| 0
|
441,083
|
CtPtr ProtocolV2::handle_reconnect_ok(ceph::bufferlist &payload)
{
ldout(cct, 20) << __func__
<< " payload.length()=" << payload.length() << dendl;
if (state != SESSION_RECONNECTING) {
lderr(cct) << __func__ << " not in session reconnect state!" << dendl;
return _fault();
}
auto reconnect_ok = ReconnectOkFrame::Decode(payload);
ldout(cct, 5) << __func__
<< " reconnect accepted: sms=" << reconnect_ok.msg_seq()
<< dendl;
out_seq = discard_requeued_up_to(out_seq, reconnect_ok.msg_seq());
backoff = utime_t();
ldout(cct, 10) << __func__ << " reconnect success " << connect_seq
<< ", lossy = " << connection->policy.lossy << ", features "
<< connection->get_features() << dendl;
if (connection->delay_state) {
ceph_assert(connection->delay_state->ready());
}
connection->dispatch_queue->queue_connect(connection);
messenger->ms_deliver_handle_fast_connect(connection);
return ready();
}
| 0
|
163,353
|
Parcel::Blob::Blob() :
mMapped(false), mData(NULL), mSize(0) {
}
| 0
|
437,506
|
static void __io_free_req(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
if (req->flags & REQ_F_FREE_SQE)
kfree(req->submit.sqe);
if (req->file && !(req->flags & REQ_F_FIXED_FILE))
fput(req->file);
if (req->flags & REQ_F_INFLIGHT) {
unsigned long flags;
spin_lock_irqsave(&ctx->inflight_lock, flags);
list_del(&req->inflight_entry);
if (waitqueue_active(&ctx->inflight_wait))
wake_up(&ctx->inflight_wait);
spin_unlock_irqrestore(&ctx->inflight_lock, flags);
}
if (req->flags & REQ_F_TIMEOUT)
kfree(req->timeout.data);
percpu_ref_put(&ctx->refs);
if (likely(!io_is_fallback_req(req)))
kmem_cache_free(req_cachep, req);
else
clear_bit_unlock(0, (unsigned long *) ctx->fallback_req);
}
| 0
|
153,521
|
BOOL Parser::PnodeLabelNoAST(IdentToken* pToken, LabelId* pLabelIdList)
{
StmtNest* pStmt;
LabelId* pLabelId;
// Look in the label stack.
for (pStmt = m_pstmtCur; pStmt != nullptr; pStmt = pStmt->pstmtOuter)
{
for (pLabelId = pStmt->pLabelId; pLabelId != nullptr; pLabelId = pLabelId->next)
{
if (pLabelId->pid == pToken->pid)
return TRUE;
}
}
// Also look in the pnodeLabels list.
for (pLabelId = pLabelIdList; pLabelId != nullptr; pLabelId = pLabelId->next)
{
if (pLabelId->pid == pToken->pid)
return TRUE;
}
return FALSE;
}
| 0
|
185,125
|
void webkit_web_frame_load_alternate_string(WebKitWebFrame* frame, const gchar* content, const gchar* baseURL, const gchar* unreachableURL)
{
g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
g_return_if_fail(content);
webkit_web_frame_load_data(frame, content, NULL, NULL, baseURL, unreachableURL);
}
| 0
|
141,100
|
void Transform::cmap( RawTile& in, enum cmap_type cmap ){
float value;
unsigned in_chan = in.channels;
unsigned out_chan = 3;
unsigned int ndata = in.dataLength * 8 / in.bpc;
const float max3 = 1.0/3.0;
const float max8 = 1.0/8.0;
float *fptr = (float*)in.data;
float *outptr = new float[ndata*out_chan];
float *outv = outptr;
switch(cmap){
case HOT:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( int unsigned n=0; n<ndata; n+=in_chan, outv+=3 ){
value = fptr[n];
if(value>1.)
{ outv[0]=outv[1]=outv[2]=1.; }
else if(value<=0.)
{ outv[0]=outv[1]=outv[2]=0.; }
else if(value<max3)
{ outv[0]=3.*value; outv[1]=outv[2]=0.; }
else if(value<2*max3)
{ outv[0]=1.; outv[1]=3.*value-1.; outv[2]=0.; }
else if(value<1.)
{ outv[0]=outv[1]=1.; outv[2]=3.*value-2.; }
else { outv[0]=outv[1]=outv[2]=1.; }
}
break;
case COLD:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( unsigned int n=0; n<ndata; n+=in_chan, outv+=3 ){
value = fptr[n];
if(value>1.)
{ outv[0]=outv[1]=outv[2]=1.; }
else if(value<=0.)
{ outv[0]=outv[1]=outv[2]=0.; }
else if(value<max3)
{ outv[0]=outv[1]=0.; outv[2]=3.*value; }
else if(value<2.*max3)
{ outv[0]=0.; outv[1]=3.*value-1.; outv[2]=1.; }
else if(value<1.)
{ outv[0]=3.*value-2.; outv[1]=outv[2]=1.; }
else {outv[0]=outv[1]=outv[2]=1.;}
}
break;
case JET:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( unsigned int n=0; n<ndata; n+=in_chan, outv+=3 ){
value = fptr[n];
if(value<0.)
{ outv[0]=outv[1]=outv[2]=0.; }
else if(value<max8)
{ outv[0]=outv[1]=0.; outv[2]= 4.*value + 0.5; }
else if(value<3.*max8)
{ outv[0]=0.; outv[1]= 4.*value - 0.5; outv[2]=1.; }
else if(value<5.*max8)
{ outv[0]= 4*value - 1.5; outv[1]=1.; outv[2]= 2.5 - 4.*value; }
else if(value<7.*max8)
{ outv[0]= 1.; outv[1]= 3.5 -4.*value; outv[2]= 0; }
else if(value<1.)
{ outv[0]= 4.5-4.*value; outv[1]= outv[2]= 0.; }
else { outv[0]=0.5; outv[1]=outv[2]=0.; }
}
break;
case RED:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( unsigned int n=0; n<ndata; n+=in_chan, outv+=3 ){
value = fptr[n];
outv[0] = value;
outv[1] = outv[2] = 0.;
}
break;
case GREEN:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( unsigned int n=0; n<ndata; n+=in_chan, outv+=3 ) {
value = fptr[n];
outv[0] = outv[2] = 0.;
outv[1] = value;
}
break;
case BLUE:
#if defined(__ICC) || defined(__INTEL_COMPILER)
#pragma ivdep
#endif
for( unsigned int n=0; n<ndata; n+=in_chan, outv+=3 ) {
value = fptr[n];
outv[0] = outv[1] = 0;
outv[2] = value;
}
break;
default:
break;
};
// Delete old data buffer
delete[] (float*) in.data;
in.data = outptr;
in.channels = out_chan;
in.dataLength = ndata * out_chan * (in.bpc/8);
}
| 0
|
44,972
|
TEST_F(HttpConnectionManagerImplTest, UnderlyingConnectionWatermarksUnwoundWithLazyCreation) {
setup(false, "");
// Make sure codec_ is created.
EXPECT_CALL(*codec_, dispatch(_));
Buffer::OwnedImpl fake_input("");
conn_manager_->onData(fake_input, false);
// Mark the connection manger as backed up before the stream is created.
ASSERT_EQ(decoder_filters_.size(), 0);
EXPECT_CALL(*codec_, onUnderlyingConnectionAboveWriteBufferHighWatermark());
conn_manager_->onAboveWriteBufferHighWatermark();
// Create the stream. Defer the creation of the filter chain by not sending
// complete headers.
StreamDecoder* decoder;
{
setUpBufferLimits();
EXPECT_CALL(*codec_, dispatch(_)).WillOnce(Invoke([&](Buffer::Instance&) -> void {
decoder = &conn_manager_->newStream(response_encoder_);
// Call the high buffer callbacks as the codecs do.
stream_callbacks_->onAboveWriteBufferHighWatermark();
}));
// Send fake data to kick off newStream being created.
Buffer::OwnedImpl fake_input2("asdf");
conn_manager_->onData(fake_input2, false);
}
// Now before the filter chain is created, fire the low watermark callbacks
// and ensure it is passed down to the stream.
ASSERT(stream_callbacks_ != nullptr);
EXPECT_CALL(*codec_, onUnderlyingConnectionBelowWriteBufferLowWatermark())
.WillOnce(Invoke([&]() -> void { stream_callbacks_->onBelowWriteBufferLowWatermark(); }));
conn_manager_->onBelowWriteBufferLowWatermark();
// Now set up the filter chain by sending full headers. The filters should
// not get any watermark callbacks.
{
setupFilterChain(2, 2);
EXPECT_CALL(filter_callbacks_.connection_, aboveHighWatermark()).Times(0);
EXPECT_CALL(*codec_, dispatch(_)).WillOnce(Invoke([&](Buffer::Instance&) -> void {
HeaderMapPtr headers{
new TestHeaderMapImpl{{":authority", "host"}, {":path", "/"}, {":method", "GET"}}};
decoder->decodeHeaders(std::move(headers), true);
}));
EXPECT_CALL(*decoder_filters_[0], decodeHeaders(_, true))
.WillOnce(InvokeWithoutArgs([&]() -> FilterHeadersStatus {
Buffer::OwnedImpl data("hello");
decoder_filters_[0]->callbacks_->addDecodedData(data, true);
return FilterHeadersStatus::Continue;
}));
EXPECT_CALL(*decoder_filters_[0], decodeComplete());
sendRequestHeadersAndData();
ASSERT_GE(decoder_filters_.size(), 1);
MockDownstreamWatermarkCallbacks callbacks;
EXPECT_CALL(callbacks, onAboveWriteBufferHighWatermark()).Times(0);
EXPECT_CALL(callbacks, onBelowWriteBufferLowWatermark()).Times(0);
decoder_filters_[0]->callbacks_->addDownstreamWatermarkCallbacks(callbacks);
}
}
| 0
|
395,389
|
stmt_has_updated_trans_table(Ha_trx_info* ha_list)
{
Ha_trx_info *ha_info;
for (ha_info= ha_list; ha_info; ha_info= ha_info->next())
{
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
return (TRUE);
}
return (FALSE);
}
| 0
|
155,970
|
static int mov_write_smhd_tag(AVIOContext *pb)
{
avio_wb32(pb, 16); /* size */
ffio_wfourcc(pb, "smhd");
avio_wb32(pb, 0); /* version & flags */
avio_wb16(pb, 0); /* reserved (balance, normally = 0) */
avio_wb16(pb, 0); /* reserved */
return 16;
}
| 0
|
211,767
|
void PaymentHandlerWebFlowViewController::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsSameDocument())
return;
if (!OriginSecurityChecker::IsOriginSecure(navigation_handle->GetURL()) ||
(!OriginSecurityChecker::IsSchemeCryptographic(
navigation_handle->GetURL()) &&
!OriginSecurityChecker::IsOriginLocalhostOrFile(
navigation_handle->GetURL()) &&
!navigation_handle->GetURL().IsAboutBlank()) ||
!SslValidityChecker::IsSslCertificateValid(
navigation_handle->GetWebContents())) {
if (!net::IsLocalhost(navigation_handle->GetURL())) {
log_.Error("Aborting payment handler window \"" + target_.spec() +
"\" because of navigation to an insecure url \"" +
navigation_handle->GetURL().spec() + "\"");
AbortPayment();
return;
}
}
if (first_navigation_complete_callback_) {
std::move(first_navigation_complete_callback_)
.Run(true, web_contents()->GetMainFrame()->GetProcess()->GetID(),
web_contents()->GetMainFrame()->GetRoutingID());
first_navigation_complete_callback_ = PaymentHandlerOpenWindowCallback();
}
UpdateHeaderView();
}
| 0
|
148,369
|
__releases(rq->lock)
{
struct mm_struct *mm = rq->prev_mm;
long prev_state;
rq->prev_mm = NULL;
/*
* A task struct has one reference for the use as "current".
* If a task dies, then it sets TASK_DEAD in tsk->state and calls
* schedule one last time. The schedule call will never return, and
* the scheduled task must drop that reference.
* The test for TASK_DEAD must occur while the runqueue locks are
* still held, otherwise prev could be scheduled on another cpu, die
* there before we look at prev->state, and then the reference would
* be dropped twice.
* Manfred Spraul <manfred@colorfullife.com>
*/
prev_state = prev->state;
vtime_task_switch(prev);
finish_arch_switch(prev);
perf_event_task_sched_in(prev, current);
finish_lock_switch(rq, prev);
finish_arch_post_lock_switch();
fire_sched_in_preempt_notifiers(current);
if (mm)
mmdrop(mm);
if (unlikely(prev_state == TASK_DEAD)) {
task_numa_free(prev);
if (prev->sched_class->task_dead)
prev->sched_class->task_dead(prev);
/*
* Remove function-return probe instances associated with this
* task and put them back on the free list.
*/
kprobe_flush_task(prev);
put_task_struct(prev);
}
tick_nohz_task_switch(current);
}
| 0
|
314,321
|
void GfxSubpath::close() {
if (x[n-1] != x[0] || y[n-1] != y[0]) {
lineTo(x[0], y[0]);
}
closed = gTrue;
}
| 0
|
61,660
|
int callback_glewlwyd_set_client_module (const struct _u_request * request, struct _u_response * response, void * client_data) {
struct config_elements * config = (struct config_elements *)client_data;
json_t * j_module, * j_module_valid, * j_search_module;
j_search_module = get_client_module(config, u_map_get(request->map_url, "name"));
if (check_result_value(j_search_module, G_OK)) {
j_module = ulfius_get_json_body_request(request, NULL);
if (j_module != NULL) {
json_object_del(j_module, "enabled");
j_module_valid = is_client_module_valid(config, j_module, 0);
if (check_result_value(j_module_valid, G_OK)) {
if (set_client_module(config, u_map_get(request->map_url, "name"), j_module) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_client_module - Error set_client_module");
response->status = 500;
} else {
y_log_message(Y_LOG_LEVEL_INFO, "Event - Client backend module '%s' updated", u_map_get(request->map_url, "name"));
}
} else if (check_result_value(j_module_valid, G_ERROR_PARAM)) {
if (json_object_get(j_module_valid, "error") != NULL) {
ulfius_set_json_body_response(response, 400, json_object_get(j_module_valid, "error"));
} else {
response->status = 400;
}
} else if (!check_result_value(j_module_valid, G_OK)) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_client_module - Error is_client_module_valid");
response->status = 500;
}
json_decref(j_module_valid);
} else {
response->status = 400;
}
json_decref(j_module);
} else if (check_result_value(j_search_module, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_client_module - Error get_client_module");
response->status = 500;
}
json_decref(j_search_module);
return U_CALLBACK_CONTINUE;
}
| 0
|
335,618
|
static int check_empty_sectors(BlockBackend *blk, int64_t sect_num,
int sect_count, const char *filename,
uint8_t *buffer, bool quiet)
{
int pnum, ret = 0;
ret = blk_pread(blk, sect_num << BDRV_SECTOR_BITS, buffer,
sect_count << BDRV_SECTOR_BITS);
if (ret < 0) {
error_report("Error while reading offset %" PRId64 " of %s: %s",
sectors_to_bytes(sect_num), filename, strerror(-ret));
return ret;
}
ret = is_allocated_sectors(buffer, sect_count, &pnum);
if (ret || pnum != sect_count) {
qprintf(quiet, "Content mismatch at offset %" PRId64 "!\n",
sectors_to_bytes(ret ? sect_num : sect_num + pnum));
return 1;
}
return 0;
}
| 0
|
147,892
|
/*this is using chpl format according to some NeroRecode samples*/
GF_Err tfdt_box_read(GF_Box *s,GF_BitStream *bs)
{
GF_TFBaseMediaDecodeTimeBox *ptr = (GF_TFBaseMediaDecodeTimeBox *)s;
if (ptr->version==1) {
ISOM_DECREASE_SIZE(ptr, 8);
ptr->baseMediaDecodeTime = gf_bs_read_u64(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 4);
ptr->baseMediaDecodeTime = (u32) gf_bs_read_u32(bs);
}
return GF_OK;
| 0
|
378,666
|
static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
{
return sys_acl_delete_def_file(handle, path);
}
| 0
|
460,522
|
static int reverse_path_check(void)
{
int error = 0;
struct file *current_file;
/* let's call this for all tfiles */
list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) {
path_count_init();
error = ep_call_nested(&poll_loop_ncalls,
reverse_path_check_proc, current_file,
current_file, current);
if (error)
break;
}
return error;
}
| 0
|
283,850
|
void SoundPool::moveToFront_l(SoundChannel* channel)
{
for (List<SoundChannel*>::iterator iter = mChannels.begin(); iter != mChannels.end(); ++iter) {
if (*iter == channel) {
mChannels.erase(iter);
mChannels.push_front(channel);
break;
}
}
}
| 0
|
305,204
|
void btreeFree(struct BTREE *btree) {
free(btree->records);
}
| 0
|
25,830
|
static int avi_probe ( AVProbeData * p ) {
int i ;
for ( i = 0 ;
avi_headers [ i ] [ 0 ] ;
i ++ ) if ( AV_RL32 ( p -> buf ) == AV_RL32 ( avi_headers [ i ] ) && AV_RL32 ( p -> buf + 8 ) == AV_RL32 ( avi_headers [ i ] + 4 ) ) return AVPROBE_SCORE_MAX ;
return 0 ;
}
| 0
|
91,532
|
TEST_METHOD(9) {
// getNewestGeneration returns null if there are no generations.
ServerInstanceDir dir(parentDir + "/passenger-test.1234");
ensure(dir.getNewestGeneration() == NULL);
}
| 0
|
45,378
|
ipmi_fru_upg_ekeying(struct ipmi_intf *intf, char *pFileName, uint8_t fruId)
{
struct fru_info fruInfo = {0};
uint8_t *buf = NULL;
uint32_t offFruMultiRec = 0;
uint32_t fruMultiRecSize = 0;
uint32_t offFileMultiRec = 0;
uint32_t fileMultiRecSize = 0;
int rc = 0;
if (!pFileName) {
lprintf(LOG_ERR, "File expected, but none given.");
ERR_EXIT;
}
if (ipmi_fru_get_multirec_location_from_fru(intf, fruId, &fruInfo,
&offFruMultiRec, &fruMultiRecSize) != 0) {
lprintf(LOG_ERR, "Failed to get multirec location from FRU.");
ERR_EXIT;
}
lprintf(LOG_DEBUG, "FRU Size : %lu\n", fruMultiRecSize);
lprintf(LOG_DEBUG, "Multi Rec offset: %lu\n", offFruMultiRec);
if (ipmi_fru_get_multirec_size_from_file(pFileName, &fileMultiRecSize,
&offFileMultiRec) != 0) {
lprintf(LOG_ERR, "Failed to get multirec size from file '%s'.", pFileName);
ERR_EXIT;
}
buf = malloc(fileMultiRecSize);
if (!buf) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
ERR_EXIT;
}
if (ipmi_fru_get_multirec_from_file(pFileName, buf, fileMultiRecSize,
offFileMultiRec) != 0) {
lprintf(LOG_ERR, "Failed to get multirec from file '%s'.", pFileName);
ERR_EXIT;
}
if (ipmi_fru_get_adjust_size_from_buffer(buf, &fileMultiRecSize) != 0) {
lprintf(LOG_ERR, "Failed to adjust size from buffer.");
ERR_EXIT;
}
if (write_fru_area(intf, &fruInfo, fruId, 0, offFruMultiRec,
fileMultiRecSize, buf) != 0) {
lprintf(LOG_ERR, "Failed to write FRU area.");
ERR_EXIT;
}
lprintf(LOG_INFO, "Done upgrading Ekey.");
exit:
free_n(&buf);
return rc;
}
| 0
|
139,778
|
static FontSizeSpec fontSizeSpec(QStringView spec)
{
switch (spec.at(0).unicode()) {
case 'x':
if (spec == QLatin1String("xx-small"))
return XXSmall;
if (spec == QLatin1String("x-small"))
return XSmall;
if (spec == QLatin1String("x-large"))
return XLarge;
if (spec == QLatin1String("xx-large"))
return XXLarge;
break;
case 's':
if (spec == QLatin1String("small"))
return Small;
break;
case 'm':
if (spec == QLatin1String("medium"))
return Medium;
break;
case 'l':
if (spec == QLatin1String("large"))
return Large;
break;
case 'n':
if (spec == QLatin1String("none"))
return FontSizeNone;
break;
default:
break;
}
return FontSizeValue;
}
| 0
|
299,501
|
int cipso_v4_doi_walk(u32 *skip_cnt,
int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
void *cb_arg)
{
int ret_val = -ENOENT;
u32 doi_cnt = 0;
struct cipso_v4_doi *iter_doi;
rcu_read_lock();
list_for_each_entry_rcu(iter_doi, &cipso_v4_doi_list, list)
if (atomic_read(&iter_doi->refcount) > 0) {
if (doi_cnt++ < *skip_cnt)
continue;
ret_val = callback(iter_doi, cb_arg);
if (ret_val < 0) {
doi_cnt--;
goto doi_walk_return;
}
}
doi_walk_return:
rcu_read_unlock();
*skip_cnt = doi_cnt;
return ret_val;
}
| 0
|
396,332
|
static void emitfunction(JF, js_Function *fun)
{
emit(J, F, OP_CLOSURE);
emitraw(J, F, addfunction(J, F, fun));
}
| 0
|
437,971
|
long long ReadUInt(IMkvReader* pReader, long long pos, long& len) {
if (!pReader || pos < 0)
return E_FILE_FORMAT_INVALID;
len = 1;
unsigned char b;
int status = pReader->Read(pos, 1, &b);
if (status < 0) // error or underflow
return status;
if (status > 0) // interpreted as "underflow"
return E_BUFFER_NOT_FULL;
if (b == 0) // we can't handle u-int values larger than 8 bytes
return E_FILE_FORMAT_INVALID;
unsigned char m = 0x80;
while (!(b & m)) {
m >>= 1;
++len;
}
long long result = b & (~m);
++pos;
for (int i = 1; i < len; ++i) {
status = pReader->Read(pos, 1, &b);
if (status < 0) {
len = 1;
return status;
}
if (status > 0) {
len = 1;
return E_BUFFER_NOT_FULL;
}
result <<= 8;
result |= b;
++pos;
}
return result;
}
| 0
|
237,446
|
void DaemonProcessTest::QuitMessageLoop() {
message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
| 0
|
130,793
|
void CModule::OnQuit(const CNick& Nick, const CString& sMessage,
const vector<CChan*>& vChans) {}
| 0
|
390,777
|
PHP_FUNCTION(iptcembed)
{
char *iptcdata, *jpeg_file;
int iptcdata_len, jpeg_file_len;
long spool = 0;
FILE *fp;
unsigned int marker, done = 0;
int inx;
unsigned char *spoolbuf = NULL, *poi = NULL;
struct stat sb;
zend_bool written = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
return;
}
if (php_check_open_basedir(jpeg_file TSRMLS_CC)) {
RETURN_FALSE;
}
if ((size_t)iptcdata_len >= SIZE_MAX - sizeof(psheader) - 1025) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "IPTC data too large");
RETURN_FALSE;
}
if ((fp = VCWD_FOPEN(jpeg_file, "rb")) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open %s", jpeg_file);
RETURN_FALSE;
}
if (spool < 2) {
fstat(fileno(fp), &sb);
poi = spoolbuf = safe_emalloc(1, (size_t)iptcdata_len + sizeof(psheader) + 1024 + 1, sb.st_size);
memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1);
}
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) {
fclose(fp);
if (spoolbuf) {
efree(spoolbuf);
}
RETURN_FALSE;
}
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xD8) {
fclose(fp);
if (spoolbuf) {
efree(spoolbuf);
}
RETURN_FALSE;
}
while (!done) {
marker = php_iptc_next_marker(fp, spool, poi?&poi:0 TSRMLS_CC);
if (marker == M_EOI) { /* EOF */
break;
} else if (marker != M_APP13) {
php_iptc_put1(fp, spool, (unsigned char)marker, poi?&poi:0 TSRMLS_CC);
}
switch (marker) {
case M_APP13:
/* we are going to write a new APP13 marker, so don't output the old one */
php_iptc_skip_variable(fp, 0, 0 TSRMLS_CC);
php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
done = 1;
break;
case M_APP0:
/* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
case M_APP1:
if (written) {
/* don't try to write the data twice */
break;
}
written = 1;
php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
if (iptcdata_len & 1) {
iptcdata_len++; /* make the length even */
}
psheader[ 2 ] = (iptcdata_len+28)>>8;
psheader[ 3 ] = (iptcdata_len+28)&0xff;
for (inx = 0; inx < 28; inx++) {
php_iptc_put1(fp, spool, psheader[inx], poi?&poi:0 TSRMLS_CC);
}
php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len>>8), poi?&poi:0 TSRMLS_CC);
php_iptc_put1(fp, spool, (unsigned char)(iptcdata_len&0xff), poi?&poi:0 TSRMLS_CC);
for (inx = 0; inx < iptcdata_len; inx++) {
php_iptc_put1(fp, spool, iptcdata[inx], poi?&poi:0 TSRMLS_CC);
}
break;
case M_SOS:
/* we hit data, no more marker-inserting can be done! */
php_iptc_read_remaining(fp, spool, poi?&poi:0 TSRMLS_CC);
done = 1;
break;
default:
php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
break;
}
}
fclose(fp);
if (spool < 2) {
RETVAL_STRINGL(spoolbuf, poi - spoolbuf, 0);
} else {
RETURN_TRUE;
}
}
| 0
|
354,904
|
static void isdn_header_cache_update(struct hh_cache *hh,
const struct net_device *dev,
const unsigned char *haddr)
{
isdn_net_local *lp = dev->priv;
if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
return eth_header_cache_update(hh, dev, haddr);
}
| 0
|
157,136
|
mono_image_emit_manifest (MonoReflectionModuleBuilder *moduleb)
{
MonoDynamicTable *table;
MonoDynamicImage *assembly;
MonoReflectionAssemblyBuilder *assemblyb;
MonoDomain *domain;
guint32 *values;
int i;
guint32 module_index;
assemblyb = moduleb->assemblyb;
assembly = moduleb->dynamic_image;
domain = mono_object_domain (assemblyb);
/* Emit ASSEMBLY table */
table = &assembly->tables [MONO_TABLE_ASSEMBLY];
alloc_table (table, 1);
values = table->values + MONO_ASSEMBLY_SIZE;
values [MONO_ASSEMBLY_HASH_ALG] = assemblyb->algid? assemblyb->algid: ASSEMBLY_HASH_SHA1;
values [MONO_ASSEMBLY_NAME] = string_heap_insert_mstring (&assembly->sheap, assemblyb->name);
if (assemblyb->culture) {
values [MONO_ASSEMBLY_CULTURE] = string_heap_insert_mstring (&assembly->sheap, assemblyb->culture);
} else {
values [MONO_ASSEMBLY_CULTURE] = string_heap_insert (&assembly->sheap, "");
}
values [MONO_ASSEMBLY_PUBLIC_KEY] = load_public_key (assemblyb->public_key, assembly);
values [MONO_ASSEMBLY_FLAGS] = assemblyb->flags;
set_version_from_string (assemblyb->version, values);
/* Emit FILE + EXPORTED_TYPE table */
module_index = 0;
for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
int j;
MonoReflectionModuleBuilder *file_module =
mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
if (file_module != moduleb) {
mono_image_fill_file_table (domain, (MonoReflectionModule*)file_module, assembly);
module_index ++;
if (file_module->types) {
for (j = 0; j < file_module->num_types; ++j) {
MonoReflectionTypeBuilder *tb = mono_array_get (file_module->types, MonoReflectionTypeBuilder*, j);
mono_image_fill_export_table (domain, tb, module_index, 0, assembly);
}
}
}
}
if (assemblyb->loaded_modules) {
for (i = 0; i < mono_array_length (assemblyb->loaded_modules); ++i) {
MonoReflectionModule *file_module =
mono_array_get (assemblyb->loaded_modules, MonoReflectionModule*, i);
mono_image_fill_file_table (domain, file_module, assembly);
module_index ++;
mono_image_fill_export_table_from_module (domain, file_module, module_index, assembly);
}
}
if (assemblyb->type_forwarders)
mono_image_fill_export_table_from_type_forwarders (assemblyb, assembly);
/* Emit MANIFESTRESOURCE table */
module_index = 0;
for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
int j;
MonoReflectionModuleBuilder *file_module =
mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
/* The table for the main module is emitted later */
if (file_module != moduleb) {
module_index ++;
if (file_module->resources) {
int len = mono_array_length (file_module->resources);
for (j = 0; j < len; ++j) {
MonoReflectionResource* res = (MonoReflectionResource*)mono_array_addr (file_module->resources, MonoReflectionResource, j);
assembly_add_resource_manifest (file_module, assembly, res, MONO_IMPLEMENTATION_FILE | (module_index << MONO_IMPLEMENTATION_BITS));
}
}
}
}
}
| 0
|
256,710
|
static void ohci_process_lists ( OHCIState * ohci , int completion ) {
if ( ( ohci -> ctl & OHCI_CTL_CLE ) && ( ohci -> status & OHCI_STATUS_CLF ) ) {
if ( ohci -> ctrl_cur && ohci -> ctrl_cur != ohci -> ctrl_head ) {
trace_usb_ohci_process_lists ( ohci -> ctrl_head , ohci -> ctrl_cur ) ;
}
if ( ! ohci_service_ed_list ( ohci , ohci -> ctrl_head , completion ) ) {
ohci -> ctrl_cur = 0 ;
ohci -> status &= ~ OHCI_STATUS_CLF ;
}
}
if ( ( ohci -> ctl & OHCI_CTL_BLE ) && ( ohci -> status & OHCI_STATUS_BLF ) ) {
if ( ! ohci_service_ed_list ( ohci , ohci -> bulk_head , completion ) ) {
ohci -> bulk_cur = 0 ;
ohci -> status &= ~ OHCI_STATUS_BLF ;
}
}
}
| 0
|
484,409
|
static RzList *create_cache_bins(RzDyldCache *cache) {
RzList *bins = rz_list_newf((RzListFree)free_bin);
if (!bins) {
return NULL;
}
char *target_libs = NULL;
RzList *target_lib_names = NULL;
int *deps = NULL;
target_libs = rz_sys_getenv("RZ_DYLDCACHE_FILTER");
if (target_libs) {
target_lib_names = rz_str_split_list(target_libs, ":", 0);
if (!target_lib_names) {
rz_list_free(bins);
return NULL;
}
deps = RZ_NEWS0(int, cache->hdr->imagesCount);
if (!deps) {
rz_list_free(bins);
rz_list_free(target_lib_names);
return NULL;
}
}
ut32 i;
for (i = 0; i < cache->n_hdr; i++) {
cache_hdr_t *hdr = &cache->hdr[i];
ut64 hdr_offset = cache->hdr_offset[i];
ut64 symbols_off = cache->symbols_off_base - hdr_offset;
ut32 maps_index = cache->maps_index[i];
cache_img_t *img = read_cache_images(cache->buf, hdr, hdr_offset);
if (!img) {
goto next;
}
ut32 j;
ut16 *depArray = NULL;
cache_imgxtr_t *extras = NULL;
if (target_libs) {
HtPU *path_to_idx = NULL;
if (cache->accel) {
depArray = RZ_NEWS0(ut16, cache->accel->depListCount);
if (!depArray) {
goto next;
}
if (rz_buf_fread_at(cache->buf, cache->accel->depListOffset, (ut8 *)depArray, "s", cache->accel->depListCount) != cache->accel->depListCount * 2) {
goto next;
}
extras = read_cache_imgextra(cache->buf, hdr, cache->accel);
if (!extras) {
goto next;
}
} else {
path_to_idx = create_path_to_index(cache->buf, img, hdr);
}
for (j = 0; j < hdr->imagesCount; j++) {
bool printing = !deps[j];
char *lib_name = get_lib_name(cache->buf, &img[j]);
if (!lib_name) {
break;
}
if (strstr(lib_name, "libobjc.A.dylib")) {
deps[j]++;
}
if (!rz_list_find(target_lib_names, lib_name, string_contains)) {
RZ_FREE(lib_name);
continue;
}
if (printing) {
RZ_LOG_INFO("FILTER: %s\n", lib_name);
}
RZ_FREE(lib_name);
deps[j]++;
if (extras && depArray) {
ut32 k;
for (k = extras[j].dependentsStartArrayIndex; depArray[k] != 0xffff; k++) {
ut16 dep_index = depArray[k] & 0x7fff;
deps[dep_index]++;
char *dep_name = get_lib_name(cache->buf, &img[dep_index]);
if (!dep_name) {
break;
}
if (printing) {
RZ_LOG_INFO("-> %s\n", dep_name);
}
free(dep_name);
}
} else if (path_to_idx) {
carve_deps_at_address(cache, img, path_to_idx, img[j].address, deps, printing);
}
}
ht_pu_free(path_to_idx);
RZ_FREE(depArray);
RZ_FREE(extras);
}
for (j = 0; j < hdr->imagesCount; j++) {
if (deps && !deps[j]) {
continue;
}
ut64 pa = va2pa(img[j].address, hdr->mappingCount, &cache->maps[maps_index], cache->buf, 0, NULL, NULL);
if (pa == UT64_MAX) {
continue;
}
ut8 magicbytes[4];
rz_buf_read_at(cache->buf, pa, magicbytes, 4);
int magic = rz_read_le32(magicbytes);
switch (magic) {
case MH_MAGIC_64: {
char file[256];
RzDyldBinImage *bin = RZ_NEW0(RzDyldBinImage);
if (!bin) {
goto next;
}
bin->header_at = pa;
bin->hdr_offset = hdr_offset;
bin->symbols_off = symbols_off;
bin->va = img[j].address;
if (rz_buf_read_at(cache->buf, img[j].pathFileOffset, (ut8 *)&file, sizeof(file)) == sizeof(file)) {
file[255] = 0;
char *last_slash = strrchr(file, '/');
if (last_slash && *last_slash) {
if (last_slash > file) {
char *scan = last_slash - 1;
while (scan > file && *scan != '/') {
scan--;
}
if (*scan == '/') {
bin->file = strdup(scan + 1);
} else {
bin->file = strdup(last_slash + 1);
}
} else {
bin->file = strdup(last_slash + 1);
}
} else {
bin->file = strdup(file);
}
}
rz_list_append(bins, bin);
break;
}
default:
RZ_LOG_WARN("Unknown sub-bin\n");
break;
}
}
next:
RZ_FREE(depArray);
RZ_FREE(extras);
RZ_FREE(img);
}
if (rz_list_empty(bins)) {
rz_list_free(bins);
bins = NULL;
}
RZ_FREE(deps);
RZ_FREE(target_libs);
rz_list_free(target_lib_names);
return bins;
}
| 0
|
415,605
|
static Image *ReadMETAImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*buff,
*image;
MagickBooleanType
status;
StringInfo
*profile;
size_t
length;
void
*blob;
/*
Open file containing binary metadata
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image->columns=1;
image->rows=1;
if (SetImageBackgroundColor(image) == MagickFalse)
{
InheritException(exception,&image->exception);
image=DestroyImageList(image);
return((Image *) NULL);
}
length=1;
if (LocaleNCompare(image_info->magick,"8BIM",4) == 0)
{
/*
Read 8BIM binary metadata.
*/
buff=AcquireImage((ImageInfo *) NULL);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (blob == (unsigned char *) NULL)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) memset(blob,0,length);
AttachBlob(buff->blob,blob,length);
if (LocaleCompare(image_info->magick,"8BIMTEXT") == 0)
{
length=(size_t) parse8BIM(image, buff);
if (length == 0)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(CorruptImageError,"CorruptImage");
}
if (length & 1)
(void) WriteBlobByte(buff,0x0);
}
else if (LocaleCompare(image_info->magick,"8BIMWTEXT") == 0)
{
length=(size_t) parse8BIMW(image, buff);
if (length == 0)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(CorruptImageError,"CorruptImage");
}
if (length & 1)
(void) WriteBlobByte(buff,0x0);
}
else
CopyBlob(image,buff);
profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
GetBlobSize(buff));
if (profile == (StringInfo *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
status=SetImageProfile(image,"8bim",profile);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
if (LocaleNCompare(image_info->magick,"APP1",4) == 0)
{
char
name[MaxTextExtent];
(void) FormatLocaleString(name,MaxTextExtent,"APP%d",1);
buff=AcquireImage((ImageInfo *) NULL);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (blob == (unsigned char *) NULL)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
if (LocaleCompare(image_info->magick,"APP1JPEG") == 0)
{
Image
*iptc;
int
result;
if (image_info->profile == (void *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(CoderError,"NoIPTCProfileAvailable");
}
profile=CloneStringInfo((StringInfo *) image_info->profile);
iptc=AcquireImage((ImageInfo *) NULL);
if (iptc == (Image *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(iptc->blob,GetStringInfoDatum(profile),
GetStringInfoLength(profile));
result=jpeg_embed(image,buff,iptc);
blob=DetachBlob(iptc->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
iptc=DestroyImage(iptc);
if (result == 0)
ThrowReaderException(CoderError,"JPEGEmbeddingFailed");
}
else
CopyBlob(image,buff);
profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
GetBlobSize(buff));
if (profile == (StringInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
status=SetImageProfile(image,name,profile);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
if (status == MagickFalse)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
}
if ((LocaleCompare(image_info->magick,"ICC") == 0) ||
(LocaleCompare(image_info->magick,"ICM") == 0))
{
buff=AcquireImage((ImageInfo *) NULL);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (blob == (unsigned char *) NULL)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
CopyBlob(image,buff);
profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
GetBlobSize(buff));
if (profile == (StringInfo *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) SetImageProfile(image,"icc",profile);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
}
if (LocaleCompare(image_info->magick,"IPTC") == 0)
{
buff=AcquireImage((ImageInfo *) NULL);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (blob == (unsigned char *) NULL)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
CopyBlob(image,buff);
profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
GetBlobSize(buff));
if (profile == (StringInfo *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) SetImageProfile(image,"iptc",profile);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
}
if (LocaleCompare(image_info->magick,"XMP") == 0)
{
buff=AcquireImage((ImageInfo *) NULL);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (blob == (unsigned char *) NULL)
{
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
CopyBlob(image,buff);
profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
GetBlobSize(buff));
if (profile == (StringInfo *) NULL)
{
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) SetImageProfile(image,"xmp",profile);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
}
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
| 0
|
195,372
|
static void VoidMethodDOMStringOrArrayBufferOrArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodDOMStringOrArrayBufferOrArrayBufferViewArg");
TestObject* impl = V8TestObject::ToImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length()));
return;
}
StringOrArrayBufferOrArrayBufferView arg;
V8StringOrArrayBufferOrArrayBufferView::ToImpl(info.GetIsolate(), info[0], arg, UnionTypeConversionMode::kNotNullable, exception_state);
if (exception_state.HadException())
return;
impl->voidMethodDOMStringOrArrayBufferOrArrayBufferViewArg(arg);
}
| 0
|
183,770
|
bool Connected() const { return true; }
| 0
|
34,502
|
EmitButtonCode(XtermWidget xw,
Char *line,
unsigned count,
XButtonEvent *event,
int button)
{
TScreen *screen = TScreenOf(xw);
int value;
if (okSendMousePos(xw) == X10_MOUSE) {
value = CharOf(' ' + button);
} else {
value = BtnCode(xw, event, button);
}
switch (screen->extend_coords) {
default:
line[count++] = CharOf(value);
break;
case SET_SGR_EXT_MODE_MOUSE:
case SET_PIXEL_POSITION_MOUSE:
value -= 32; /* encoding starts at zero */
/* FALLTHRU */
case SET_URXVT_EXT_MODE_MOUSE:
count += (unsigned) sprintf((char *) line + count, "%d", value);
break;
case SET_EXT_MODE_MOUSE:
if (value < 128) {
line[count++] = CharOf(value);
} else {
line[count++] = CharOf(0xC0 + (value >> 6));
line[count++] = CharOf(0x80 + (value & 0x3F));
}
break;
}
return count;
}
| 0
|
452,428
|
static void fn_null(struct vc_data *vc)
{
do_compute_shiftstate();
}
| 0
|
442,606
|
static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
struct hci_ev_mode_change *ev = (void *) skb->data;
struct hci_conn *conn;
BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
if (conn) {
conn->mode = ev->mode;
if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND,
&conn->flags)) {
if (conn->mode == HCI_CM_ACTIVE)
set_bit(HCI_CONN_POWER_SAVE, &conn->flags);
else
clear_bit(HCI_CONN_POWER_SAVE, &conn->flags);
}
if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags))
hci_sco_setup(conn, ev->status);
}
hci_dev_unlock(hdev);
}
| 0
|
421,234
|
static void send_packet(struct dhcp_packet *dhcp_pkt, int force_broadcast)
{
if (dhcp_pkt->gateway_nip)
send_packet_to_relay(dhcp_pkt);
else
send_packet_to_client(dhcp_pkt, force_broadcast);
}
| 0
|
14,793
|
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
RefPtr<SerializedScriptValue> serializedArg(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->serializedValue(serializedArg);
return JSValue::encode(jsUndefined());
}
| 1
|
276,344
|
void V8TestObject::CachedAttributeRaisesExceptionGetterAnyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_cachedAttributeRaisesExceptionGetterAnyAttribute_Getter");
test_object_v8_internal::CachedAttributeRaisesExceptionGetterAnyAttributeAttributeGetter(info);
}
| 0
|
104,311
|
nautilus_file_operations_copy (GList *files,
GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
gpointer done_callback_data)
{
GTask *task;
CopyMoveJob *job;
job = op_job_new (CopyMoveJob, parent_window);
job->desktop_location = nautilus_get_desktop_location ();
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
job->destination = g_object_ref (target_dir);
/* Need to indicate the destination for the operation notification open
* button. */
nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir);
if (relative_item_points != NULL &&
relative_item_points->len > 0)
{
job->icon_positions =
g_memdup (relative_item_points->data,
sizeof (GdkPoint) * relative_item_points->len);
job->n_icon_positions = relative_item_points->len;
}
job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
inhibit_power_manager ((CommonJob *) job, _("Copying Files"));
if (!nautilus_file_undo_manager_is_operating ())
{
GFile *src_dir;
src_dir = g_file_get_parent (files->data);
job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_COPY,
g_list_length (files),
src_dir, target_dir);
g_object_unref (src_dir);
}
task = g_task_new (NULL, job->common.cancellable, copy_task_done, job);
g_task_set_task_data (task, job, NULL);
g_task_run_in_thread (task, copy_task_thread_func);
g_object_unref (task);
}
| 0
|
203,076
|
static unsigned readChunk_tRNS(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength)
{
unsigned i;
if(color->colortype == LCT_PALETTE)
{
/*error: more alpha values given than there are palette entries*/
if(chunkLength > color->palettesize) return 38;
for(i = 0; i < chunkLength; i++) color->palette[4 * i + 3] = data[i];
}
else if(color->colortype == LCT_GREY)
{
/*error: this chunk must be 2 bytes for greyscale image*/
if(chunkLength != 2) return 30;
color->key_defined = 1;
color->key_r = color->key_g = color->key_b = 256u * data[0] + data[1];
}
else if(color->colortype == LCT_RGB)
{
/*error: this chunk must be 6 bytes for RGB image*/
if(chunkLength != 6) return 41;
color->key_defined = 1;
color->key_r = 256u * data[0] + data[1];
color->key_g = 256u * data[2] + data[3];
color->key_b = 256u * data[4] + data[5];
}
else return 42; /*error: tRNS chunk not allowed for other color models*/
return 0; /* OK */
}
| 0
|
383,482
|
void precompute_partition_info_sums_(
const FLAC__int32 residual[],
FLAC__uint64 abs_residual_partition_sums[],
unsigned residual_samples,
unsigned predictor_order,
unsigned min_partition_order,
unsigned max_partition_order,
unsigned bps
)
{
const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order;
unsigned partitions = 1u << max_partition_order;
FLAC__ASSERT(default_partition_samples > predictor_order);
/* first do max_partition_order */
{
unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order);
/* WATCHOUT: "+ bps + FLAC__MAX_EXTRA_RESIDUAL_BPS" is the maximum
* assumed size of the average residual magnitude */
if(FLAC__bitmath_ilog2(default_partition_samples) + bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < 32) {
FLAC__uint32 abs_residual_partition_sum;
for(partition = residual_sample = 0; partition < partitions; partition++) {
end += default_partition_samples;
abs_residual_partition_sum = 0;
for( ; residual_sample < end; residual_sample++)
abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
abs_residual_partition_sums[partition] = abs_residual_partition_sum;
}
}
else { /* have to pessimistically use 64 bits for accumulator */
FLAC__uint64 abs_residual_partition_sum;
for(partition = residual_sample = 0; partition < partitions; partition++) {
end += default_partition_samples;
abs_residual_partition_sum = 0;
for( ; residual_sample < end; residual_sample++)
abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
abs_residual_partition_sums[partition] = abs_residual_partition_sum;
}
}
}
/* now merge partitions for lower orders */
{
unsigned from_partition = 0, to_partition = partitions;
int partition_order;
for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) {
unsigned i;
partitions >>= 1;
for(i = 0; i < partitions; i++) {
abs_residual_partition_sums[to_partition++] =
abs_residual_partition_sums[from_partition ] +
abs_residual_partition_sums[from_partition+1];
from_partition += 2;
}
}
}
}
| 0
|
6,209
|
print_attr_string(netdissect_options *ndo,
register const u_char *data, u_int length, u_short attr_code)
{
register u_int i;
ND_TCHECK2(data[0],length);
switch(attr_code)
{
case TUNNEL_PASS:
if (length < 3)
{
ND_PRINT((ndo, "%s", tstr));
return;
}
if (*data && (*data <=0x1F) )
ND_PRINT((ndo, "Tag[%u] ", *data));
else
ND_PRINT((ndo, "Tag[Unused] "));
data++;
length--;
ND_PRINT((ndo, "Salt %u ", EXTRACT_16BITS(data)));
data+=2;
length-=2;
break;
case TUNNEL_CLIENT_END:
case TUNNEL_SERVER_END:
case TUNNEL_PRIV_GROUP:
case TUNNEL_ASSIGN_ID:
case TUNNEL_CLIENT_AUTH:
case TUNNEL_SERVER_AUTH:
if (*data <= 0x1F)
{
if (length < 1)
{
ND_PRINT((ndo, "%s", tstr));
return;
}
if (*data)
ND_PRINT((ndo, "Tag[%u] ", *data));
else
ND_PRINT((ndo, "Tag[Unused] "));
data++;
length--;
}
break;
case EGRESS_VLAN_NAME:
ND_PRINT((ndo, "%s (0x%02x) ",
tok2str(rfc4675_tagged,"Unknown tag",*data),
*data));
data++;
length--;
break;
}
for (i=0; *data && i < length ; i++, data++)
ND_PRINT((ndo, "%c", (*data < 32 || *data > 126) ? '.' : *data));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
| 1
|
307,198
|
static int __init printk_late_init(void)
{
struct console *con;
for_each_console(con) {
if (!keep_bootcon && con->flags & CON_BOOT) {
printk(KERN_INFO "turn off boot console %s%d\n",
con->name, con->index);
unregister_console(con);
}
}
hotcpu_notifier(console_cpu_notify, 0);
return 0;
}
| 0
|
423,333
|
int tcp_disconnect(struct sock *sk, int flags)
{
struct inet_sock *inet = inet_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk);
int err = 0;
int old_state = sk->sk_state;
if (old_state != TCP_CLOSE)
tcp_set_state(sk, TCP_CLOSE);
/* ABORT function of RFC793 */
if (old_state == TCP_LISTEN) {
inet_csk_listen_stop(sk);
} else if (unlikely(tp->repair)) {
sk->sk_err = ECONNABORTED;
} else if (tcp_need_reset(old_state) ||
(tp->snd_nxt != tp->write_seq &&
(1 << old_state) & (TCPF_CLOSING | TCPF_LAST_ACK))) {
/* The last check adjusts for discrepancy of Linux wrt. RFC
* states
*/
tcp_send_active_reset(sk, gfp_any());
sk->sk_err = ECONNRESET;
} else if (old_state == TCP_SYN_SENT)
sk->sk_err = ECONNRESET;
tcp_clear_xmit_timers(sk);
__skb_queue_purge(&sk->sk_receive_queue);
tcp_write_queue_purge(sk);
__skb_queue_purge(&tp->out_of_order_queue);
inet->inet_dport = 0;
if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
inet_reset_saddr(sk);
sk->sk_shutdown = 0;
sock_reset_flag(sk, SOCK_DONE);
tp->srtt = 0;
if ((tp->write_seq += tp->max_window + 2) == 0)
tp->write_seq = 1;
icsk->icsk_backoff = 0;
tp->snd_cwnd = 2;
icsk->icsk_probes_out = 0;
tp->packets_out = 0;
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
tp->snd_cwnd_cnt = 0;
tp->window_clamp = 0;
tcp_set_ca_state(sk, TCP_CA_Open);
tcp_clear_retrans(tp);
inet_csk_delack_init(sk);
tcp_init_send_head(sk);
memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
__sk_dst_reset(sk);
WARN_ON(inet->inet_num && !icsk->icsk_bind_hash);
sk->sk_error_report(sk);
return err;
}
| 0
|
329,537
|
static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties)
{
int compno;
if (s->buf_end - s->buf < 1)
return AVERROR(EINVAL);
compno = bytestream_get_byte(&s->buf);
properties[compno] |= HAD_QCC;
return get_qcx(s, n-1, q+compno);
}
| 1
|
268,907
|
static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport)
{
struct sk_buff *skb;
struct sadb_msg *hdr;
struct sadb_sa *sa;
struct sadb_address *addr;
struct sadb_x_nat_t_port *n_port;
int sockaddr_size;
int size;
__u8 satype = (x->id.proto == IPPROTO_ESP ? SADB_SATYPE_ESP : 0);
struct xfrm_encap_tmpl *natt = NULL;
sockaddr_size = pfkey_sockaddr_size(x->props.family);
if (!sockaddr_size)
return -EINVAL;
if (!satype)
return -EINVAL;
if (!x->encap)
return -EINVAL;
natt = x->encap;
/* Build an SADB_X_NAT_T_NEW_MAPPING message:
*
* HDR | SA | ADDRESS_SRC (old addr) | NAT_T_SPORT (old port) |
* ADDRESS_DST (new addr) | NAT_T_DPORT (new port)
*/
size = sizeof(struct sadb_msg) +
sizeof(struct sadb_sa) +
(sizeof(struct sadb_address) * 2) +
(sockaddr_size * 2) +
(sizeof(struct sadb_x_nat_t_port) * 2);
skb = alloc_skb(size + 16, GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
hdr = skb_put(skb, sizeof(struct sadb_msg));
hdr->sadb_msg_version = PF_KEY_V2;
hdr->sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING;
hdr->sadb_msg_satype = satype;
hdr->sadb_msg_len = size / sizeof(uint64_t);
hdr->sadb_msg_errno = 0;
hdr->sadb_msg_reserved = 0;
hdr->sadb_msg_seq = x->km.seq = get_acqseq();
hdr->sadb_msg_pid = 0;
/* SA */
sa = skb_put(skb, sizeof(struct sadb_sa));
sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t);
sa->sadb_sa_exttype = SADB_EXT_SA;
sa->sadb_sa_spi = x->id.spi;
sa->sadb_sa_replay = 0;
sa->sadb_sa_state = 0;
sa->sadb_sa_auth = 0;
sa->sadb_sa_encrypt = 0;
sa->sadb_sa_flags = 0;
/* ADDRESS_SRC (old addr) */
addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size);
addr->sadb_address_len =
(sizeof(struct sadb_address)+sockaddr_size)/
sizeof(uint64_t);
addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC;
addr->sadb_address_proto = 0;
addr->sadb_address_reserved = 0;
addr->sadb_address_prefixlen =
pfkey_sockaddr_fill(&x->props.saddr, 0,
(struct sockaddr *) (addr + 1),
x->props.family);
if (!addr->sadb_address_prefixlen)
BUG();
/* NAT_T_SPORT (old port) */
n_port = skb_put(skb, sizeof(*n_port));
n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t);
n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT;
n_port->sadb_x_nat_t_port_port = natt->encap_sport;
n_port->sadb_x_nat_t_port_reserved = 0;
/* ADDRESS_DST (new addr) */
addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size);
addr->sadb_address_len =
(sizeof(struct sadb_address)+sockaddr_size)/
sizeof(uint64_t);
addr->sadb_address_exttype = SADB_EXT_ADDRESS_DST;
addr->sadb_address_proto = 0;
addr->sadb_address_reserved = 0;
addr->sadb_address_prefixlen =
pfkey_sockaddr_fill(ipaddr, 0,
(struct sockaddr *) (addr + 1),
x->props.family);
if (!addr->sadb_address_prefixlen)
BUG();
/* NAT_T_DPORT (new port) */
n_port = skb_put(skb, sizeof(*n_port));
n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t);
n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT;
n_port->sadb_x_nat_t_port_port = sport;
n_port->sadb_x_nat_t_port_reserved = 0;
return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL,
xs_net(x));
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.