processed_func
string | target
int64 | flaw_line
string | flaw_line_index
int64 | commit_url
string | language
class label |
|---|---|---|---|---|---|
void* HardSwishInit(TfLiteContext* context, const char* buffer, size_t length) {
return new HardSwishData;
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35
| 0CCPP
|
acc_ctx_cont(OM_uint32 *minstat,
gss_buffer_t buf,
gss_ctx_id_t *ctx,
gss_buffer_t *responseToken,
gss_buffer_t *mechListMIC,
OM_uint32 *negState,
send_token_flag *return_token)
{
OM_uint32 ret, tmpmin;
gss_OID supportedMech;
spnego_gss_ctx_id_t sc;
unsigned int len;
unsigned char *ptr, *bufstart;
sc = (spnego_gss_ctx_id_t)*ctx;
ret = GSS_S_DEFECTIVE_TOKEN;
*negState = REJECT;
*minstat = 0;
supportedMech = GSS_C_NO_OID;
*return_token = ERROR_TOKEN_SEND;
*responseToken = *mechListMIC = GSS_C_NO_BUFFER;
ptr = bufstart = buf->value;
#define REMAIN (buf->length - (ptr - bufstart))
if (REMAIN == 0 || REMAIN > INT_MAX)
return GSS_S_DEFECTIVE_TOKEN;
if (*ptr == HEADER_ID) {
ret = g_verify_token_header(gss_mech_spnego,
&len, &ptr, 0, REMAIN);
if (ret) {
*minstat = ret;
return GSS_S_DEFECTIVE_TOKEN;
}
}
if (*ptr != (CONTEXT | 0x01)) {
return GSS_S_DEFECTIVE_TOKEN;
}
ret = get_negTokenResp(minstat, ptr, REMAIN,
negState, &supportedMech,
responseToken, mechListMIC);
if (ret != GSS_S_COMPLETE)
goto cleanup;
if (*responseToken == GSS_C_NO_BUFFER &&
*mechListMIC == GSS_C_NO_BUFFER) {
ret = GSS_S_DEFECTIVE_TOKEN;
goto cleanup;
}
if (supportedMech != GSS_C_NO_OID) {
ret = GSS_S_DEFECTIVE_TOKEN;
goto cleanup;
}
sc->firstpass = 0;
*negState = ACCEPT_INCOMPLETE;
*return_token = CONT_TOKEN_SEND;
cleanup:
if (supportedMech != GSS_C_NO_OID) {
generic_gss_release_oid(&tmpmin, &supportedMech);
}
return ret;
#undef REMAIN
}
| 0
| null | -1
|
https://github.com/krb5/krb5/commit/b51b33f2bc5d1497ddf5bd107f791c101695000d
| 0CCPP
|
smtp_proceed_commit(struct smtp_session *s, const char *args)
{
smtp_message_end(s->tx);
}
| 0
| null | -1
|
https://github.com/openbsd/src/commit/9dcfda045474d8903224d175907bfc29761dcb45
| 0CCPP
|
function initAllDialogs() {
if (typeof initGridLanguage === 'function') {
initGridLanguage(main.systemConfig.common.language);
}
$dialogCommand.modal({
dismissible: false
});
$dialogMessage.modal();
$dialogConfirm.modal({
dismissible: false
});
$dialogCommand.find('.progress-show-more').off('change').on('change', function () {
var val = $(this).prop('checked');
main.saveConfig('progressMore', val);
if (val) {
$dialogCommand.find('.textarea').show();
} else {
$dialogCommand.find('.textarea').hide();
}
});
if (main.config.progressClose === undefined) {
main.config.progressClose = true;
}
$dialogCommand.find('.progress-dont-close input').on('change', function () {
main.saveConfig('progressClose', $(this).prop('checked'));
});
$dialogCommand.find('input[type="checkbox"]+span').off('click').on('click', function () {
var $input = $(this).prev();
if ($input.parent().parent().hasClass('switch')) return;
if (!$input.prop('disabled')) {
$input.prop('checked', !$input.prop('checked')).trigger('change');
}
});
$dialogCommand.find('.progress-dont-close input').prop('checked', main.config.progressClose);
$dialogCommand.find('.progress-show-more').prop('checked', !!main.config.progressMore).trigger('change');
$dialogCommand.find('.btn').on('click', function () {
if ($dialogCommand.data('finished')) {
$adminSideMain.find('.button-command').hide();
} else {
$adminSideMain.find('.button-command').show();
}
});
$adminSideMain.find('.button-command').on('click', function () {
$dialogCommand.modal('open');
});
}
| 1
|
12,27
| -1
|
https://github.com/ioBroker/ioBroker.admin/commit/16b2b325ab47896090bc7f54b77b0a97ed74f5cd
| 3JavaScript
|
static void MSLReference(void *context,const xmlChar *name)
{
MSLInfo
*msl_info;
xmlParserCtxtPtr
parser;
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.reference(%s)",name);
msl_info=(MSLInfo *) context;
parser=msl_info->parser;
if (*name == '#')
(void) xmlAddChild(parser->node,xmlNewCharRef(msl_info->document,name));
else
(void) xmlAddChild(parser->node,xmlNewReference(msl_info->document,name));
}
| 0
| null | -1
|
https://github.com/ImageMagick/ImageMagick/commit/e793eb203e5e0f91f5037aed6585e81b1e27395b
| 0CCPP
|
void ogs_sbi_message_free(ogs_sbi_message_t *message)
{
int i;
ogs_assert(message);
if (message->NFProfile)
OpenAPI_nf_profile_free(message->NFProfile);
if (message->ProblemDetails)
OpenAPI_problem_details_free(message->ProblemDetails);
if (message->PatchItemList) {
OpenAPI_lnode_t *node = NULL;
OpenAPI_list_for_each(message->PatchItemList, node)
OpenAPI_patch_item_free(node->data);
OpenAPI_list_free(message->PatchItemList);
}
if (message->SubscriptionData)
OpenAPI_subscription_data_free(message->SubscriptionData);
if (message->NotificationData)
OpenAPI_notification_data_free(message->NotificationData);
if (message->SearchResult)
OpenAPI_search_result_free(message->SearchResult);
if (message->AuthenticationInfo)
OpenAPI_authentication_info_free(message->AuthenticationInfo);
if (message->AuthenticationInfoRequest)
OpenAPI_authentication_info_request_free(
message->AuthenticationInfoRequest);
if (message->AuthenticationInfoResult)
OpenAPI_authentication_info_result_free(
message->AuthenticationInfoResult);
if (message->AuthenticationSubscription)
OpenAPI_authentication_subscription_free(
message->AuthenticationSubscription);
if (message->UeAuthenticationCtx)
OpenAPI_ue_authentication_ctx_free(message->UeAuthenticationCtx);
if (message->ConfirmationData)
OpenAPI_confirmation_data_free(message->ConfirmationData);
if (message->ConfirmationDataResponse)
OpenAPI_confirmation_data_response_free(
message->ConfirmationDataResponse);
if (message->AuthEvent)
OpenAPI_auth_event_free(message->AuthEvent);
if (message->Amf3GppAccessRegistration)
OpenAPI_amf3_gpp_access_registration_free(
message->Amf3GppAccessRegistration);
if (message->AccessAndMobilitySubscriptionData)
OpenAPI_access_and_mobility_subscription_data_free(
message->AccessAndMobilitySubscriptionData);
if (message->SmfSelectionSubscriptionData)
OpenAPI_smf_selection_subscription_data_free(
message->SmfSelectionSubscriptionData);
if (message->UeContextInSmfData)
OpenAPI_ue_context_in_smf_data_free(message->UeContextInSmfData);
if (message->SmContextCreateData)
OpenAPI_sm_context_create_data_free(message->SmContextCreateData);
if (message->SmContextCreatedData)
OpenAPI_sm_context_created_data_free(message->SmContextCreatedData);
if (message->SmContextCreateError)
OpenAPI_sm_context_create_error_free(message->SmContextCreateError);
if (message->SmContextUpdateData)
OpenAPI_sm_context_update_data_free(message->SmContextUpdateData);
if (message->SmContextUpdatedData)
OpenAPI_sm_context_updated_data_free(message->SmContextUpdatedData);
if (message->SmContextUpdateError)
OpenAPI_sm_context_update_error_free(message->SmContextUpdateError);
if (message->SmContextReleaseData)
OpenAPI_sm_context_release_data_free(message->SmContextReleaseData);
if (message->SmContextReleasedData)
OpenAPI_sm_context_released_data_free(message->SmContextReleasedData);
if (message->SessionManagementSubscriptionData)
OpenAPI_session_management_subscription_data_free(
message->SessionManagementSubscriptionData);
if (message->N1N2MessageTransferReqData)
OpenAPI_n1_n2_message_transfer_req_data_free(
message->N1N2MessageTransferReqData);
if (message->N1N2MessageTransferRspData)
OpenAPI_n1_n2_message_transfer_rsp_data_free(
message->N1N2MessageTransferRspData);
if (message->N1N2MsgTxfrFailureNotification)
OpenAPI_n1_n2_msg_txfr_failure_notification_free(
message->N1N2MsgTxfrFailureNotification);
if (message->SmContextStatusNotification)
OpenAPI_sm_context_status_notification_free(
message->SmContextStatusNotification);
if (message->PolicyAssociationRequest)
OpenAPI_policy_association_request_free(
message->PolicyAssociationRequest);
if (message->PolicyAssociation)
OpenAPI_policy_association_free(message->PolicyAssociation);
if (message->AmPolicyData)
OpenAPI_am_policy_data_free(message->AmPolicyData);
if (message->SmPolicyContextData)
OpenAPI_sm_policy_context_data_free(message->SmPolicyContextData);
if (message->SmPolicyDecision)
OpenAPI_sm_policy_decision_free(message->SmPolicyDecision);
if (message->SmPolicyData)
OpenAPI_sm_policy_data_free(message->SmPolicyData);
if (message->SmPolicyDeleteData)
OpenAPI_sm_policy_delete_data_free(message->SmPolicyDeleteData);
if (message->AuthorizedNetworkSliceInfo)
OpenAPI_authorized_network_slice_info_free(
message->AuthorizedNetworkSliceInfo);
if (message->PcfBinding)
OpenAPI_pcf_binding_free(message->PcfBinding);
if (message->AppSessionContext)
OpenAPI_app_session_context_free(message->AppSessionContext);
if (message->AppSessionContextUpdateDataPatch)
OpenAPI_app_session_context_update_data_patch_free(message->AppSessionContextUpdateDataPatch);
if (message->SmPolicyNotification)
OpenAPI_sm_policy_notification_free(message->SmPolicyNotification);
if (message->TerminationNotification)
OpenAPI_termination_notification_free(message->TerminationNotification);
for (i = 0; i < message->num_of_part; i++) {
if (message->part[i].pkbuf)
ogs_pkbuf_free(message->part[i].pkbuf);
}
}
| 0
| null | -1
|
https://github.com/open5gs/open5gs/commit/d919b2744cd05abae043490f0a3dd1946c1ccb8c
| 0CCPP
|
static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur,
struct idpair *idmap)
{
if (!(rold->live & REG_LIVE_READ))
return true;
if (memcmp(rold, rcur, offsetof(struct bpf_reg_state, live)) == 0)
return true;
if (rold->type == NOT_INIT)
return true;
if (rcur->type == NOT_INIT)
return false;
switch (rold->type) {
case SCALAR_VALUE:
if (rcur->type == SCALAR_VALUE) {
return range_within(rold, rcur) &&
tnum_in(rold->var_off, rcur->var_off);
} else {
/* if we knew anything about the old value, we're not
* equal, because we can't know anything about the
* scalar value of the pointer in the new value.
*/
return rold->umin_value == 0 &&
rold->umax_value == U64_MAX &&
rold->smin_value == S64_MIN &&
rold->smax_value == S64_MAX &&
tnum_is_unknown(rold->var_off);
}
case PTR_TO_MAP_VALUE:
return memcmp(rold, rcur, offsetof(struct bpf_reg_state, id)) == 0 &&
range_within(rold, rcur) &&
tnum_in(rold->var_off, rcur->var_off);
case PTR_TO_MAP_VALUE_OR_NULL:
if (rcur->type != PTR_TO_MAP_VALUE_OR_NULL)
return false;
if (memcmp(rold, rcur, offsetof(struct bpf_reg_state, id)))
return false;
return check_ids(rold->id, rcur->id, idmap);
case PTR_TO_PACKET_META:
case PTR_TO_PACKET:
if (rcur->type != rold->type)
return false;
if (rold->range > rcur->range)
return false;
if (rold->off != rcur->off)
return false;
if (rold->id && !check_ids(rold->id, rcur->id, idmap))
return false;
return range_within(rold, rcur) &&
tnum_in(rold->var_off, rcur->var_off);
case PTR_TO_CTX:
case CONST_PTR_TO_MAP:
case PTR_TO_STACK:
case PTR_TO_PACKET_END:
default:
return false;
}
WARN_ON_ONCE(1);
return false;
}
| 1
|
17,18,19,21,22,23,24,25
| -1
|
https://github.com/torvalds/linux/commit/179d1c5602997fef5a940c6ddcf31212cbfebd14
| 0CCPP
|
mxPerimeter.OrthogonalPerimeter);mxPerimeter.BackbonePerimeter=function(b,h,q,l){l=parseFloat(h.style[mxConstants.STYLE_STROKEWIDTH]||1)*h.view.scale/2-1;null!=h.style.backboneSize&&(l+=parseFloat(h.style.backboneSize)*h.view.scale/2-1);if("south"==h.style[mxConstants.STYLE_DIRECTION]||"north"==h.style[mxConstants.STYLE_DIRECTION])return q.x<b.getCenterX()&&(l=-1*(l+1)),new mxPoint(b.getCenterX()+l,Math.min(b.y+b.height,Math.max(b.y,q.y)));q.y<b.getCenterY()&&(l=-1*(l+1));return new mxPoint(Math.min(b.x+
b.width,Math.max(b.x,q.x)),b.getCenterY()+l)};mxStyleRegistry.putValue("backbonePerimeter",mxPerimeter.BackbonePerimeter);mxPerimeter.CalloutPerimeter=function(b,h,q,l){return mxPerimeter.RectanglePerimeter(mxUtils.getDirectedBounds(b,new mxRectangle(0,0,0,Math.max(0,Math.min(b.height,parseFloat(mxUtils.getValue(h.style,"size",ba.prototype.size))*h.view.scale))),h.style),h,q,l)};mxStyleRegistry.putValue("calloutPerimeter",mxPerimeter.CalloutPerimeter);mxPerimeter.ParallelogramPerimeter=function(b,
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c287bef9101d024b1fd59d55ecd530f25000f9d8
| 3JavaScript
|
def _create_path(federation_prefix, path, *args):
return federation_prefix + path % tuple(urllib.parse.quote(arg, "") for arg in args)
| 0
| null | -1
|
https://github.com/matrix-org/synapse.git/commit/30fba6210834a4ecd91badf0c8f3eb278b72e746
| 4Python
|
*/
static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
{
st_entry *ent;
wddx_stack *stack = (wddx_stack *)user_data;
TSRMLS_FETCH();
if (!wddx_stack_is_empty(stack) && !stack->done) {
wddx_stack_top(stack, (void**)&ent);
switch (ent->type) {
case ST_STRING:
if (Z_STRLEN_P(ent->data) == 0) {
STR_FREE(Z_STRVAL_P(ent->data));
Z_STRVAL_P(ent->data) = estrndup(s, len);
Z_STRLEN_P(ent->data) = len;
} else {
Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
Z_STRLEN_P(ent->data) += len;
Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
}
break;
case ST_BINARY:
if (Z_STRLEN_P(ent->data) == 0) {
STR_FREE(Z_STRVAL_P(ent->data));
Z_STRVAL_P(ent->data) = estrndup(s, len + 1);
} else {
Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
}
Z_STRLEN_P(ent->data) += len;
Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
break;
case ST_NUMBER:
Z_TYPE_P(ent->data) = IS_STRING;
Z_STRLEN_P(ent->data) = len;
Z_STRVAL_P(ent->data) = estrndup(s, len);
convert_scalar_to_number(ent->data TSRMLS_CC);
break;
case ST_BOOLEAN:
if (!strcmp(s, "true")) {
Z_LVAL_P(ent->data) = 1;
} else if (!strcmp(s, "false")) {
Z_LVAL_P(ent->data) = 0;
} else {
zval_ptr_dtor(&ent->data);
if (ent->varname) {
efree(ent->varname);
}
ent->data = NULL;
}
break;
case ST_DATETIME: {
char *tmp;
tmp = emalloc(len + 1);
memcpy(tmp, s, len);
tmp[len] = '\0';
Z_LVAL_P(ent->data) = php_parse_date(tmp, NULL);
if (Z_LVAL_P(ent->data) == -1) {
Z_TYPE_P(ent->data) = IS_STRING;
Z_STRLEN_P(ent->data) = len;
Z_STRVAL_P(ent->data) = estrndup(s, len);
}
efree(tmp);
}
break;
default:
break;
}
}
| 1
| null | -1
|
https://github.com/php/php-src/commit/a44c89e8af7c2410f4bfc5e097be2a5d0639a60c
| 0CCPP
|
xfs_attr_get_ilocked(
struct xfs_inode *ip,
struct xfs_da_args *args)
{
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL));
if (!xfs_inode_hasattr(ip))
return -ENOATTR;
else if (ip->i_d.di_aformat == XFS_DINODE_FMT_LOCAL)
return xfs_attr_shortform_getvalue(args);
else if (xfs_bmap_one_block(ip, XFS_ATTR_FORK))
return xfs_attr_leaf_get(args);
else
return xfs_attr_node_get(args);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/7b38460dc8e4eafba06c78f8e37099d3b34d473c
| 0CCPP
|
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const int num_inputs = NumInputs(node);
const bool is_soft_nms = num_inputs == 6;
if (num_inputs != 5 && num_inputs != 6) {
context->ReportError(context, "Found NMS op with invalid num inputs: %d",
NumInputs(node));
return kTfLiteError;
}
const TfLiteTensor* input_boxes = GetInput(context, node, kInputTensorBoxes);
TF_LITE_ENSURE_EQ(context, input_boxes->type, kTfLiteFloat32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_boxes), 2);
TF_LITE_ENSURE_EQ(context, SizeOfDimension(input_boxes, 1), 4);
const int num_boxes = SizeOfDimension(input_boxes, 0);
const TfLiteTensor* input_scores =
GetInput(context, node, kInputTensorScores);
TF_LITE_ENSURE_EQ(context, input_scores->type, kTfLiteFloat32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_scores), 1);
TF_LITE_ENSURE_EQ(context, num_boxes, SizeOfDimension(input_scores, 0));
const TfLiteTensor* input_max_output_size =
GetInput(context, node, kInputTensorMaxOutputSize);
TF_LITE_ENSURE_EQ(context, input_max_output_size->type, kTfLiteInt32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_max_output_size), 0);
const bool is_max_output_size_const = IsConstantTensor(input_max_output_size);
int max_output_size_value = 0;
if (is_max_output_size_const) {
max_output_size_value = *GetTensorData<int>(input_max_output_size);
TF_LITE_ENSURE(context, (max_output_size_value >= 0));
}
const TfLiteTensor* input_iou_threshold =
GetInput(context, node, kInputTensorIouThreshold);
TF_LITE_ENSURE_EQ(context, input_iou_threshold->type, kTfLiteFloat32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_iou_threshold), 0);
const TfLiteTensor* input_score_threshold =
GetInput(context, node, kInputTensorScoreThreshold);
TF_LITE_ENSURE_EQ(context, input_iou_threshold->type, kTfLiteFloat32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_score_threshold), 0);
if (is_soft_nms) {
const TfLiteTensor* input_sigma =
GetInput(context, node, kInputTensorSigma);
TF_LITE_ENSURE_EQ(context, input_sigma->type, kTfLiteFloat32);
TF_LITE_ENSURE_EQ(context, NumDimensions(input_sigma), 0);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 3);
TfLiteTensor* output_selected_indices =
GetOutput(context, node, kSoftNMSOutputTensorSelectedIndices);
output_selected_indices->type = kTfLiteInt32;
TfLiteTensor* output_selected_scores =
GetOutput(context, node, kSoftNMSOutputTensorSelectedScores);
output_selected_scores->type = kTfLiteFloat32;
TfLiteTensor* output_num_selected_indices =
GetOutput(context, node, kSoftNMSOutputTensorNumSelectedIndices);
output_num_selected_indices->type = kTfLiteInt32;
SetTensorSizes(context, output_num_selected_indices, {});
if (is_max_output_size_const) {
SetTensorSizes(context, output_selected_indices, {max_output_size_value});
SetTensorSizes(context, output_selected_scores, {max_output_size_value});
} else {
SetTensorToDynamic(output_selected_indices);
SetTensorToDynamic(output_selected_scores);
}
} else {
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2);
TfLiteTensor* output_selected_indices =
GetOutput(context, node, kNMSOutputTensorSelectedIndices);
output_selected_indices->type = kTfLiteInt32;
TfLiteTensor* output_num_selected_indices =
GetOutput(context, node, kNMSOutputTensorNumSelectedIndices);
output_num_selected_indices->type = kTfLiteInt32;
SetTensorSizes(context, output_num_selected_indices, {});
if (is_max_output_size_const) {
SetTensorSizes(context, output_selected_indices, {max_output_size_value});
} else {
SetTensorToDynamic(output_selected_indices);
}
}
return kTfLiteOk;
}
| 1
|
8,13,14,18,19,28,29,32,33,37,38,42,43,45,46,48,49,61,62,64,65
| -1
|
https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35
| 0CCPP
|
log_hist_slice (const struct hist_slice *slice, time_t t)
{
size_t strftime(char *s, size_t max, const char *format,
const struct tm *tm);
if (slice->sl_packets_in == 0 &&
slice->sl_packets_out == 0 &&
slice->sl_del_mini_conns == 0 &&
slice->sl_del_full_conns == 0)
return;
struct tm tm;
char timestr[sizeof("12:00:00")];
localtime_r(&t, &tm);
strftime(timestr, sizeof(timestr), "%T", &tm);
LSQ_DEBUG("%s: pi: %u; po: %u; +mc: %u; -mc: %u; +fc: %u; -fc: %u",
timestr,
slice->sl_packets_in,
slice->sl_packets_out,
slice->sl_new_mini_conns,
slice->sl_del_mini_conns,
slice->sl_new_full_conns,
slice->sl_del_full_conns);
}
| 0
| null | -1
|
https://github.com/litespeedtech/lsquic/commit/a74702c630e108125e71898398737baec8f02238
| 0CCPP
|
SHA256_Init(struct SHA256_CTX * ctx)
{
/* Zero bits processed so far */
ctx->count[0] = ctx->count[1] = 0;
/* Magic initialization constants */
ctx->state[0] = 0x6A09E667;
ctx->state[1] = 0xBB67AE85;
ctx->state[2] = 0x3C6EF372;
ctx->state[3] = 0xA54FF53A;
ctx->state[4] = 0x510E527F;
ctx->state[5] = 0x9B05688C;
ctx->state[6] = 0x1F83D9AB;
ctx->state[7] = 0x5BE0CD19;
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13
| -1
|
https://github.com/facebook/hhvm/commit/cc331e4349e91706a673e2a09f1f2ea5bbb33815
| 0CCPP
|
void Compute(OpKernelContext* ctx) override {
const Tensor& gradient = ctx->input(0);
const Tensor& input = ctx->input(1);
Tensor* input_backprop = nullptr;
OP_REQUIRES_OK(ctx,
ctx->allocate_output(0, input.shape(), &input_backprop));
OP_REQUIRES(
ctx, input.IsSameSize(gradient),
errors::InvalidArgument("gradient and input must be the same size"));
const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);
const Tensor& input_min_tensor = ctx->input(2);
OP_REQUIRES(ctx,
input_min_tensor.dims() == 0 || input_min_tensor.dims() == 1,
errors::InvalidArgument(
"Input min tensor must have dimension 1. Recieved ",
input_min_tensor.dims(), "."));
const Tensor& input_max_tensor = ctx->input(3);
OP_REQUIRES(ctx,
input_max_tensor.dims() == 0 || input_max_tensor.dims() == 1,
errors::InvalidArgument(
"Input max tensor must have dimension 1. Recieved ",
input_max_tensor.dims(), "."));
if (axis_ != -1) {
OP_REQUIRES(
ctx, input_min_tensor.dim_size(0) == depth,
errors::InvalidArgument("min has incorrect size, expected ", depth,
" was ", input_min_tensor.dim_size(0)));
OP_REQUIRES(
ctx, input_max_tensor.dim_size(0) == depth,
errors::InvalidArgument("max has incorrect size, expected ", depth,
" was ", input_max_tensor.dim_size(0)));
}
TensorShape min_max_shape(input_min_tensor.shape());
Tensor* input_min_backprop;
OP_REQUIRES_OK(ctx,
ctx->allocate_output(1, min_max_shape, &input_min_backprop));
Tensor* input_max_backprop;
OP_REQUIRES_OK(ctx,
ctx->allocate_output(2, min_max_shape, &input_max_backprop));
if (axis_ == -1) {
functor::QuantizeAndDequantizeOneScaleGradientFunctor<Device, T> f;
f(ctx->eigen_device<Device>(), gradient.template flat<T>(),
input.template flat<T>(), input_min_tensor.scalar<T>(),
input_max_tensor.scalar<T>(), input_backprop->template flat<T>(),
input_min_backprop->template scalar<T>(),
input_max_backprop->template scalar<T>());
} else {
functor::QuantizeAndDequantizePerChannelGradientFunctor<Device, T> f;
f(ctx->eigen_device<Device>(),
gradient.template flat_inner_outer_dims<T, 3>(axis_ - 1),
input.template flat_inner_outer_dims<T, 3>(axis_ - 1),
&input_min_tensor, &input_max_tensor,
input_backprop->template flat_inner_outer_dims<T, 3>(axis_ - 1),
input_min_backprop->template flat<T>(),
input_max_backprop->template flat<T>());
}
}
| 1
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1
| 0CCPP
|
mt76_dma_rx_poll(struct napi_struct *napi, int budget)
{
struct mt76_dev *dev;
int qid, done = 0, cur;
dev = container_of(napi->dev, struct mt76_dev, napi_dev);
qid = napi - dev->napi;
rcu_read_lock();
do {
cur = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget - done);
mt76_rx_poll_complete(dev, qid, napi);
done += cur;
} while (cur && done < budget);
rcu_read_unlock();
if (done < budget && napi_complete(napi))
dev->drv->rx_poll_complete(dev, qid);
return done;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/b102f0c522cf668c8382c56a4f771b37d011cda2
| 0CCPP
|
static int tg3_rx_prodring_init(struct tg3 *tp,
struct tg3_rx_prodring_set *tpr)
{
tpr->rx_std_buffers = kzalloc(TG3_RX_STD_BUFF_RING_SIZE(tp),
GFP_KERNEL);
if (!tpr->rx_std_buffers)
return -ENOMEM;
tpr->rx_std = dma_alloc_coherent(&tp->pdev->dev,
TG3_RX_STD_RING_BYTES(tp),
&tpr->rx_std_mapping,
GFP_KERNEL);
if (!tpr->rx_std)
goto err_out;
if (tg3_flag(tp, JUMBO_CAPABLE) && !tg3_flag(tp, 5780_CLASS)) {
tpr->rx_jmb_buffers = kzalloc(TG3_RX_JMB_BUFF_RING_SIZE(tp),
GFP_KERNEL);
if (!tpr->rx_jmb_buffers)
goto err_out;
tpr->rx_jmb = dma_alloc_coherent(&tp->pdev->dev,
TG3_RX_JMB_RING_BYTES(tp),
&tpr->rx_jmb_mapping,
GFP_KERNEL);
if (!tpr->rx_jmb)
goto err_out;
}
return 0;
err_out:
tg3_rx_prodring_fini(tp, tpr);
return -ENOMEM;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/715230a44310a8cf66fbfb5a46f9a62a9b2de424
| 0CCPP
|
static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
int mask = 0x10000, bitbuf = 0;
int i, v, offset, count, segments;
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
if (mask == 0x10000) {
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (bitbuf & mask) {
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 2;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count*2 + width)
return AVERROR_INVALIDDATA;
for (i = 0; i < count; i++) {
frame[0] = frame[1] =
frame[width] = frame[width + 1] = frame[-offset];
frame += 2;
}
} else if (bitbuf & (mask << 1)) {
v = bytestream2_get_le16(gb)*2;
if (frame - frame_end < v)
return AVERROR_INVALIDDATA;
frame += v;
} else {
if (frame_end - frame < width + 3)
return AVERROR_INVALIDDATA;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
}
mask <<= 2;
}
return 0;
}
| 1
|
31
| -1
|
https://github.com/FFmpeg/FFmpeg/commit/f52fbf4f3ed02a7d872d8a102006f29b4421f360
| 0CCPP
|
def do_send_user_group_members_update_event(
event_name: str, user_group: UserGroup, user_ids: List[int]
) -> None:
event = dict(
type="user_group", op=event_name, group_id=user_group.id, user_ids=user_ids
)
transaction.on_commit(
lambda: send_event(
user_group.realm, event, active_user_ids(user_group.realm_id)
)
)
| 0
| null | -1
|
https://github.com/zulip/zulip.git/commit/62ba8e455d8f460001d9fb486a6dabfd1ed67717
| 4Python
|
edit = function(file) {
var hash = file.hash,
opts = fm.options,
dfrd = $.Deferred(),
data = {cmd : 'file', target : hash},
url = fm.url(hash) || fm.options.url,
id = 'edit-'+fm.namespace+'-'+file.hash,
d = fm.getUI().find('#'+id),
error;
if (d.length) {
d.elfinderdialog('toTop');
return dfrd.resolve();
}
if (!file.read || !file.write) {
error = ['errOpen', file.name, 'errPerm']
fm.error(error)
return dfrd.reject(error);
}
fm.request({
data : {cmd : 'get', target : hash},
notify : {type : 'openfile', cnt : 1},
syncOnFail : true
})
.done(function(data) {
dialog(id, file, data.content)
.done(function(content) {
fm.request({
options : {type : 'post'},
data : {
cmd : 'put',
target : hash,
content : content
},
notify : {type : 'save', cnt : 1},
syncOnFail : true
})
.fail(function(error) {
dfrd.reject(error);
})
.done(function(data) {
data.changed && data.changed.length && fm.change(data);
dfrd.resolve(data);
});
})
})
.fail(function(error) {
dfrd.reject(error);
})
return dfrd.promise();
};
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
fm.request({cmd : 'tree', target : fm.navId2Hash(link.attr('id'))})
.done(function(data) {
updateTree(filter(data.tree));
if (stree.children().length) {
link.addClass(collapsed+' '+expanded);
if (stree.children().length > slideTH) {
stree.show();
fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
} else {
stree.stop(true, true).slideDown('normal', function(){
fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
});
}
}
sync(true);
})
.always(function(data) {
spinner.remove();
link.addClass(loaded);
});
}
| 1
|
9
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
private ConsumerBrokerExchange getConsumerBrokerExchange(ConsumerId id) {
ConsumerBrokerExchange result = consumerExchanges.get(id);
return result;
}
| 0
| null | -1
|
https://github.com/apache/activemq/commit/00921f22ff9a8792d7663ef8fadd4823402a6324
| 2Java
|
bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
bool (*pred)(const void *), const void *param)
{
struct st_version_range_for_one_bug {
uint bug_id;
const uchar introduced_in[3];
const uchar fixed_in[3];
};
static struct st_version_range_for_one_bug versions_for_all_bugs[]=
{
{24432, { 5, 0, 24 }, { 5, 0, 38 } },
{24432, { 5, 1, 12 }, { 5, 1, 17 } },
{33029, { 5, 0, 0 }, { 5, 0, 58 } },
{33029, { 5, 1, 0 }, { 5, 1, 12 } },
{37426, { 5, 1, 0 }, { 5, 1, 26 } },
};
const uchar *master_ver=
rli->get_rli_description_event()->server_version_split;
DBUG_ASSERT(sizeof(rli->get_rli_description_event()->server_version_split) == 3);
for (uint i= 0;
i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++)
{
const uchar *introduced_in= versions_for_all_bugs[i].introduced_in,
*fixed_in= versions_for_all_bugs[i].fixed_in;
if ((versions_for_all_bugs[i].bug_id == bug_id) &&
(memcmp(introduced_in, master_ver, 3) <= 0) &&
(memcmp(fixed_in, master_ver, 3) > 0) &&
(pred == NULL || (*pred)(param)))
{
if (!report)
return TRUE;
my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from"
" http://bugs.mysql.com/bug.php?id=%u"
" so slave stops; check error log on slave"
" for more info", MYF(0), bug_id);
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR,
"According to the master's version ('%s'),"
" it is probable that master suffers from this bug:"
" http://bugs.mysql.com/bug.php?id=%u"
" and thus replicating the current binary log event"
" may make the slave's data become different from the"
" master's data."
" To take no risk, slave refuses to replicate"
" this event and stops."
" We recommend that all updates be stopped on the"
" master and slave, that the data of both be"
" manually synchronized,"
" that master's binary logs be deleted,"
" that master be upgraded to a version at least"
" equal to '%d.%d.%d'. Then replication can be"
" restarted.",
rli->get_rli_description_event()->server_version,
bug_id,
fixed_in[0], fixed_in[1], fixed_in[2]);
return TRUE;
}
}
return FALSE;
}
| 0
| null | -1
|
https://github.com/mysql/mysql-server/commit/3bd5589e1a5a93f9c224badf983cd65c45215390
| 0CCPP
|
mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
{
struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;
struct mpt_ioctl_iocinfo *karg;
MPT_ADAPTER *ioc;
struct pci_dev *pdev;
int iocnum;
unsigned int port;
int cim_rev;
struct scsi_device *sdev;
VirtDevice *vdevice;
if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev0))
cim_rev = 0;
else if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev1))
cim_rev = 1;
else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
cim_rev = 2;
else if (data_size == (sizeof(struct mpt_ioctl_iocinfo_rev0)+12))
cim_rev = 0;
else
return -EFAULT;
karg = memdup_user(uarg, data_size);
if (IS_ERR(karg)) {
printk(KERN_ERR MYNAM "%s@%d::mpt_ioctl_iocinfo() - memdup_user returned error [%ld]\n",
__FILE__, __LINE__, PTR_ERR(karg));
return PTR_ERR(karg);
}
if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
(ioc == NULL)) {
printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
__FILE__, __LINE__, iocnum);
kfree(karg);
return -ENODEV;
}
if (karg->hdr.maxDataSize != data_size) {
printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
"Structure size mismatch. Command not completed.\n",
ioc->name, __FILE__, __LINE__);
kfree(karg);
return -EFAULT;
}
dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_getiocinfo called.\n",
ioc->name));
if (ioc->bus_type == SAS)
karg->adapterType = MPT_IOCTL_INTERFACE_SAS;
else if (ioc->bus_type == FC)
karg->adapterType = MPT_IOCTL_INTERFACE_FC;
else
karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
if (karg->hdr.port > 1) {
kfree(karg);
return -EINVAL;
}
port = karg->hdr.port;
karg->port = port;
pdev = (struct pci_dev *) ioc->pcidev;
karg->pciId = pdev->device;
karg->hwRev = pdev->revision;
karg->subSystemDevice = pdev->subsystem_device;
karg->subSystemVendor = pdev->subsystem_vendor;
if (cim_rev == 1) {
karg->pciInfo.u.bits.busNumber = pdev->bus->number;
karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
} else if (cim_rev == 2) {
karg->pciInfo.u.bits.busNumber = pdev->bus->number;
karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
karg->pciInfo.segmentID = pci_domain_nr(pdev->bus);
}
karg->numDevices = 0;
if (ioc->sh) {
shost_for_each_device(sdev, ioc->sh) {
vdevice = sdev->hostdata;
if (vdevice == NULL || vdevice->vtarget == NULL)
continue;
if (vdevice->vtarget->tflags &
MPT_TARGET_FLAGS_RAID_COMPONENT)
continue;
karg->numDevices++;
}
}
karg->FWVersion = ioc->facts.FWVersion.Word;
karg->BIOSVersion = ioc->biosVersion;
strncpy (karg->driverVersion, MPT_LINUX_PACKAGE_NAME, MPT_IOCTL_VERSION_LENGTH);
karg->driverVersion[MPT_IOCTL_VERSION_LENGTH-1]='\0';
karg->busChangeEvent = 0;
karg->hostId = ioc->pfacts[port].PortSCSIID;
karg->rsvd[0] = karg->rsvd[1] = 0;
if (copy_to_user((char __user *)arg, karg, data_size)) {
printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
"Unable to write out mpt_ioctl_iocinfo struct @ %p\n",
ioc->name, __FILE__, __LINE__, uarg);
kfree(karg);
return -EFAULT;
}
kfree(karg);
return 0;
}
| 1
|
0,4,6,27,28,29,30,31,32,33
| -1
|
https://github.com/torvalds/linux/commit/28d76df18f0ad5bcf5fa48510b225f0ed262a99b
| 0CCPP
|
void Node::MaybeCopyOnWrite() {
if (!props_.unique()) {
props_ = std::make_shared<NodeProperties>(*props_);
}
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/c99d98cd189839dcf51aee94e7437b54b31f8abd
| 0CCPP
|
public static void setRegisterSession(MessageInfo messageInfo, String username, Set<String> roles) {
messageInfo.getMap().put("javax.servlet.http.registerSession", TRUE.toString());
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
request.setAttribute(LOGGEDIN_USERNAME, username);
request.setAttribute(LOGGEDIN_ROLES, roles);
}
| 1
| null | -1
|
https://github.com/wildfly-security/soteria/commit/1a6234e394a34612f4a73e84857af06ff2d412d7
| 2Java
|
static bool link_kind_filtered(const struct net_device *dev,
const struct rtnl_link_ops *kind_ops)
{
if (kind_ops && dev->rtnl_link_ops != kind_ops)
return true;
return false;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/5f8e44741f9f216e33736ea4ec65ca9ac03036e6
| 0CCPP
|
PJ_DEF(void) pj_scan_skip_whitespace( pj_scanner *scanner )
{
register char *s = scanner->curptr;
while (PJ_SCAN_IS_SPACE(*s)) {
++s;
}
if (PJ_SCAN_IS_NEWLINE(*s) && (scanner->skip_ws & PJ_SCAN_AUTOSKIP_NEWLINE)) {
for (;;) {
if (*s == '\r') {
++s;
if (*s == '\n') ++s;
++scanner->line;
scanner->curptr = scanner->start_line = s;
} else if (*s == '\n') {
++s;
++scanner->line;
scanner->curptr = scanner->start_line = s;
} else if (PJ_SCAN_IS_SPACE(*s)) {
do {
++s;
} while (PJ_SCAN_IS_SPACE(*s));
} else {
break;
}
}
}
if (PJ_SCAN_IS_NEWLINE(*s) && (scanner->skip_ws & PJ_SCAN_AUTOSKIP_WS_HEADER)==PJ_SCAN_AUTOSKIP_WS_HEADER) {
scanner->curptr = s;
if (*s == '\r') {
++s;
}
if (*s == '\n') {
++s;
}
scanner->start_line = s;
if (PJ_SCAN_IS_SPACE(*s)) {
register char *t = s;
do {
++t;
} while (PJ_SCAN_IS_SPACE(*t));
++scanner->line;
scanner->curptr = t;
}
} else {
scanner->curptr = s;
}
}
| 0
| null | -1
|
https://github.com/pjsip/pjproject/commit/077b465c33f0aec05a49cd2ca456f9a1b112e896
| 0CCPP
|
private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
{
e.Cancel = true;
Assembly mainAssembly = e.Argument as Assembly;
var companyAttribute =
(AssemblyCompanyAttribute) GetAttribute(mainAssembly, typeof(AssemblyCompanyAttribute));
if (string.IsNullOrEmpty(AppTitle))
{
var titleAttribute =
(AssemblyTitleAttribute) GetAttribute(mainAssembly, typeof(AssemblyTitleAttribute));
AppTitle = titleAttribute != null ? titleAttribute.Title : mainAssembly.GetName().Name;
}
string appCompany = companyAttribute != null ? companyAttribute.Company : "";
RegistryLocation = !string.IsNullOrEmpty(appCompany)
? $@"Software\{appCompany}\{AppTitle}\AutoUpdater"
: $@"Software\{AppTitle}\AutoUpdater";
InstalledVersion = mainAssembly.GetName().Version;
WebRequest webRequest = WebRequest.Create(AppCastURL);
webRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
if (Proxy != null)
{
webRequest.Proxy = Proxy;
}
var uri = new Uri(AppCastURL);
WebResponse webResponse;
try
{
if (uri.Scheme.Equals(Uri.UriSchemeFtp))
{
var ftpWebRequest = (FtpWebRequest) webRequest;
ftpWebRequest.Credentials = FtpCredentials;
ftpWebRequest.UseBinary = true;
ftpWebRequest.UsePassive = true;
ftpWebRequest.KeepAlive = true;
ftpWebRequest.Method = WebRequestMethods.Ftp.DownloadFile;
webResponse = ftpWebRequest.GetResponse();
}
else if(uri.Scheme.Equals(Uri.UriSchemeHttp) || uri.Scheme.Equals(Uri.UriSchemeHttps))
{
HttpWebRequest httpWebRequest = (HttpWebRequest) webRequest;
httpWebRequest.UserAgent = GetUserAgent();
if (BasicAuthXML != null)
{
httpWebRequest.Headers[HttpRequestHeader.Authorization] = BasicAuthXML.ToString();
}
webResponse = httpWebRequest.GetResponse();
}
else
{
webResponse = webRequest.GetResponse();
}
}
catch (Exception exception)
{
Debug.WriteLine(exception);
e.Cancel = false;
return;
}
UpdateInfoEventArgs args;
using (Stream appCastStream = webResponse.GetResponseStream())
{
if (appCastStream != null)
{
if (ParseUpdateInfoEvent != null)
{
using (StreamReader streamReader = new StreamReader(appCastStream))
{
string data = streamReader.ReadToEnd();
ParseUpdateInfoEventArgs parseArgs = new ParseUpdateInfoEventArgs(data);
ParseUpdateInfoEvent(parseArgs);
args = parseArgs.UpdateInfo;
}
}
else
{
XmlDocument receivedAppCastDocument = new XmlDocument();
try
{
receivedAppCastDocument.Load(appCastStream);
XmlNodeList appCastItems = receivedAppCastDocument.SelectNodes("item");
args = new UpdateInfoEventArgs();
if (appCastItems != null)
{
foreach (XmlNode item in appCastItems)
{
XmlNode appCastVersion = item.SelectSingleNode("version");
try
{
CurrentVersion = new Version(appCastVersion?.InnerText);
}
catch (Exception)
{
CurrentVersion = null;
}
args.CurrentVersion = CurrentVersion;
XmlNode appCastChangeLog = item.SelectSingleNode("changelog");
args.ChangelogURL = appCastChangeLog?.InnerText;
XmlNode appCastUrl = item.SelectSingleNode("url");
args.DownloadURL = appCastUrl?.InnerText;
if (Mandatory.Equals(false))
{
XmlNode mandatory = item.SelectSingleNode("mandatory");
Boolean.TryParse(mandatory?.InnerText, out Mandatory);
string mode = mandatory?.Attributes["mode"]?.InnerText;
if (!string.IsNullOrEmpty(mode))
{
UpdateMode = (Mode) Enum.Parse(typeof(Mode), mode);
if (ReportErrors && !Enum.IsDefined(typeof(Mode), UpdateMode))
{
throw new InvalidDataException(
$"{UpdateMode} is not an underlying value of the Mode enumeration.");
}
}
}
args.Mandatory = Mandatory;
args.UpdateMode = UpdateMode;
XmlNode appArgs = item.SelectSingleNode("args");
args.InstallerArgs = appArgs?.InnerText;
XmlNode checksum = item.SelectSingleNode("checksum");
args.HashingAlgorithm = checksum?.Attributes["algorithm"]?.InnerText;
args.Checksum = checksum?.InnerText;
}
}
}
catch (Exception)
{
e.Cancel = false;
webResponse.Close();
return;
}
}
}
else
{
e.Cancel = false;
webResponse.Close();
return;
}
}
if (args.CurrentVersion == null || string.IsNullOrEmpty(args.DownloadURL))
{
webResponse.Close();
if (ReportErrors)
{
throw new InvalidDataException();
}
return;
}
CurrentVersion = args.CurrentVersion;
ChangelogURL = args.ChangelogURL = GetURL(webResponse.ResponseUri, args.ChangelogURL);
DownloadURL = args.DownloadURL = GetURL(webResponse.ResponseUri, args.DownloadURL);
InstallerArgs = args.InstallerArgs ?? String.Empty;
HashingAlgorithm = args.HashingAlgorithm ?? "MD5";
Checksum = args.Checksum ?? String.Empty;
webResponse.Close();
if (Mandatory)
{
ShowRemindLaterButton = false;
ShowSkipButton = false;
}
else
{
using (RegistryKey updateKey = Registry.CurrentUser.OpenSubKey(RegistryLocation))
{
if (updateKey != null)
{
object skip = updateKey.GetValue("skip");
object applicationVersion = updateKey.GetValue("version");
if (skip != null && applicationVersion != null)
{
string skipValue = skip.ToString();
var skipVersion = new Version(applicationVersion.ToString());
if (skipValue.Equals("1") && CurrentVersion <= skipVersion)
return;
if (CurrentVersion > skipVersion)
{
using (RegistryKey updateKeyWrite = Registry.CurrentUser.CreateSubKey(RegistryLocation))
{
if (updateKeyWrite != null)
{
updateKeyWrite.SetValue("version", CurrentVersion.ToString());
updateKeyWrite.SetValue("skip", 0);
}
}
}
}
object remindLaterTime = updateKey.GetValue("remindlater");
if (remindLaterTime != null)
{
DateTime remindLater = Convert.ToDateTime(remindLaterTime.ToString(),
CultureInfo.CreateSpecificCulture("en-US").DateTimeFormat);
int compareResult = DateTime.Compare(DateTime.Now, remindLater);
if (compareResult < 0)
{
e.Cancel = false;
e.Result = remindLater;
return;
}
}
}
}
}
args.IsUpdateAvailable = CurrentVersion > InstalledVersion;
args.InstalledVersion = InstalledVersion;
e.Cancel = false;
e.Result = args;
}
| 1
|
75
| -1
|
https://github.com/ravibpatel/AutoUpdater.NET/commit/1dc25f2bea6ea522dbac1512b5563c4746d539c3
| 1CS
|
mxResources.get("loading"))&&(c.loadingOrgChart=!0,"1"==urlParams.dev?mxscript("js/orgchart/bridge.min.js",function(){mxscript("js/orgchart/bridge.collections.min.js",function(){mxscript("js/orgchart/OrgChart.Layout.min.js",function(){mxscript("js/orgchart/mxOrgChartLayout.js",K)})})}):mxscript("js/extensions.min.js",K))}var C=null,D=20,G=20,P=!0,K=function(){c.loadingOrgChart=!1;c.spinner.stop();if("undefined"!==typeof mxOrgChartLayout&&null!=C&&P){var X=c.editor.graph,u=new mxOrgChartLayout(X,C,
D,G),E=X.getDefaultParent();1<X.model.getChildCount(X.getSelectionCell())&&(E=X.getSelectionCell());u.execute(E);P=!1}},F=document.createElement("div"),H=document.createElement("div");H.style.marginTop="6px";H.style.display="inline-block";H.style.width="140px";mxUtils.write(H,mxResources.get("orgChartType")+": ");F.appendChild(H);var S=document.createElement("select");S.style.width="200px";S.style.boxSizing="border-box";H=[mxResources.get("linear"),mxResources.get("hanger2"),mxResources.get("hanger4"),
| 1
|
0,1
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
"1":null},G.getVerticesAndEdges())},{install:function(I){this.listener=function(){I(Editor.sketchMode)};C.addListener("sketchModeChanged",this.listener)},destroy:function(){C.removeListener(this.listener)}});B.appendChild(N)}return B};var M=Menus.prototype.init;Menus.prototype.init=function(){M.apply(this,arguments);var B=this.editorUi,C=B.editor.graph;B.actions.get("editDiagram").label=mxResources.get("formatXml")+"...";B.actions.get("createShape").label=mxResources.get("shape")+"...";B.actions.get("outline").label=
mxResources.get("outline")+"...";B.actions.get("layers").label=mxResources.get("layers")+"...";B.actions.get("tags").label=mxResources.get("tags")+"...";B.actions.get("comments").label=mxResources.get("comments")+"...";var G=B.actions.put("toggleDarkMode",new Action(mxResources.get("dark"),function(J){B.setDarkMode(!Editor.darkMode)}));G.setToggleAction(!0);G.setSelectedCallback(function(){return Editor.isDarkMode()});G=B.actions.put("toggleSketchMode",new Action(mxResources.get("sketch"),function(J){B.setSketchMode(!Editor.sketchMode)}));
G.setToggleAction(!0);G.setSelectedCallback(function(){return Editor.sketchMode});G=B.actions.put("togglePagesVisible",new Action(mxResources.get("pages"),function(J){B.setPagesVisible(!Editor.pagesVisible)}));G.setToggleAction(!0);G.setSelectedCallback(function(){return Editor.pagesVisible});B.actions.put("importCsv",new Action(mxResources.get("csv")+"...",function(){C.popupMenuHandler.hideMenu();B.showImportCsvDialog()}));B.actions.put("importText",new Action(mxResources.get("text")+"...",function(){var J=
new ParseDialog(B,"Insert from Text");B.showDialog(J.container,620,420,!0,!1);J.init()}));B.actions.put("formatSql",new Action(mxResources.get("formatSql")+"...",function(){var J=new ParseDialog(B,"Insert from Text","formatSql");B.showDialog(J.container,620,420,!0,!1);J.init()}));B.actions.put("toggleShapes",new Action(mxResources.get("1"==urlParams.sketch?"moreShapes":"shapes")+"...",function(){f(B)},null,null,Editor.ctrlKey+"+Shift+K"));B.actions.put("toggleFormat",new Action(mxResources.get("format")+
"...",function(){b(B)})).shortcut=B.actions.get("formatPanel").shortcut;EditorUi.enablePlantUml&&!B.isOffline()&&B.actions.put("plantUml",new Action(mxResources.get("plantUml")+"...",function(){var J=new ParseDialog(B,mxResources.get("plantUml")+"...","plantUml");B.showDialog(J.container,620,420,!0,!1);J.init()}));B.actions.put("mermaid",new Action(mxResources.get("mermaid")+"...",function(){var J=new ParseDialog(B,mxResources.get("mermaid")+"...","mermaid");B.showDialog(J.container,620,420,!0,!1);
J.init()}));var N=this.addPopupMenuCellEditItems;this.put("editCell",new Menu(mxUtils.bind(this,function(J,V){var U=this.editorUi.editor.graph,X=U.getSelectionCell();N.call(this,J,X,null,V);this.addMenuItems(J,["editTooltip"],V);U.model.isVertex(X)&&this.addMenuItems(J,["editGeometry"],V);this.addMenuItems(J,["-","edit"],V)})));this.addPopupMenuCellEditItems=function(J,V,U,X){J.addSeparator();this.addSubmenu("editCell",J,X,mxResources.get("edit"))};this.put("file",new Menu(mxUtils.bind(this,function(J,
V){var U=B.getCurrentFile();B.menus.addMenuItems(J,["new"],V);B.menus.addSubmenu("openFrom",J,V);isLocalStorage&&this.addSubmenu("openRecent",J,V);J.addSeparator(V);null!=U&&U.constructor==DriveFile?B.menus.addMenuItems(J,["save","rename","makeCopy","moveToFolder"],V):(B.menus.addMenuItems(J,["save","saveAs","-","rename"],V),B.isOfflineApp()?navigator.onLine&&"1"!=urlParams.stealth&&"1"!=urlParams.lockdown&&this.addMenuItems(J,["upload"],V):B.menus.addMenuItems(J,["makeCopy"],V));J.addSeparator(V);
null!=U&&(U.isRevisionHistorySupported()&&B.menus.addMenuItems(J,["revisionHistory"],V),mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||U.constructor==LocalFile&&null==U.fileHandle||B.menus.addMenuItems(J,["synchronize"],V));B.menus.addMenuItems(J,["autosave"],V);if(null!=U&&(J.addSeparator(V),U.constructor==DriveFile&&B.menus.addMenuItems(J,["share"],V),null!=B.fileNode&&"1"!=urlParams.embedInline)){var X=null!=U.getTitle()?U.getTitle():B.defaultFilename;(U.constructor==DriveFile&&null!=U.sync&&U.sync.isConnected()||
!/(\.html)$/i.test(X)&&!/(\.svg)$/i.test(X))&&this.addMenuItems(J,["-","properties"],V)}})));this.put("diagram",new Menu(mxUtils.bind(this,function(J,V){var U=B.getCurrentFile();B.menus.addSubmenu("extras",J,V,mxResources.get("preferences"));J.addSeparator(V);if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)B.menus.addMenuItems(J,"new open - synchronize - save saveAs -".split(" "),V);else if("1"==urlParams.embed||B.mode==App.MODE_ATLAS){"1"!=urlParams.noSaveBtn&&"1"!=urlParams.embedInline&&B.menus.addMenuItems(J,
["-","save"],V);if("1"==urlParams.saveAndExit||"1"==urlParams.noSaveBtn&&"0"!=urlParams.saveAndExit||B.mode==App.MODE_ATLAS)B.menus.addMenuItems(J,["saveAndExit"],V),null!=U&&U.isRevisionHistorySupported()&&B.menus.addMenuItems(J,["revisionHistory"],V);J.addSeparator(V)}else B.mode==App.MODE_ATLAS?B.menus.addMenuItems(J,["save","synchronize","-"],V):"1"!=urlParams.noFileMenu&&("1"!=urlParams.sketch?(B.menus.addMenuItems(J,["new"],V),B.menus.addSubmenu("openFrom",J,V),isLocalStorage&&this.addSubmenu("openRecent",
J,V),J.addSeparator(V),null!=U&&(U.constructor==DriveFile&&B.menus.addMenuItems(J,["share"],V),mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||U.constructor==LocalFile||B.menus.addMenuItems(J,["synchronize"],V)),J.addSeparator(V),B.menus.addSubmenu("save",J,V)):B.menus.addSubmenu("file",J,V));B.menus.addSubmenu("exportAs",J,V);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?B.menus.addMenuItems(J,["import"],V):"1"!=urlParams.noFileMenu&&B.menus.addSubmenu("importFrom",J,V);B.commentsSupported()&&B.menus.addMenuItems(J,
["-","comments"],V);B.menus.addMenuItems(J,"- findReplace outline layers tags - pageSetup".split(" "),V);"1"==urlParams.noFileMenu||mxClient.IS_IOS&&navigator.standalone||B.menus.addMenuItems(J,["print"],V);"1"!=urlParams.sketch&&null!=U&&null!=B.fileNode&&"1"!=urlParams.embedInline&&(U=null!=U.getTitle()?U.getTitle():B.defaultFilename,/(\.html)$/i.test(U)||/(\.svg)$/i.test(U)||this.addMenuItems(J,["-","properties"]));J.addSeparator(V);B.menus.addSubmenu("help",J,V);"1"==urlParams.embed||B.mode==
App.MODE_ATLAS?("1"!=urlParams.noExitBtn||B.mode==App.MODE_ATLAS)&&B.menus.addMenuItems(J,["-","exit"],V):"1"!=urlParams.noFileMenu&&B.menus.addMenuItems(J,["-","close"])})));this.put("save",new Menu(mxUtils.bind(this,function(J,V){var U=B.getCurrentFile();null!=U&&U.constructor==DriveFile?B.menus.addMenuItems(J,["save","makeCopy","-","rename","moveToFolder"],V):(B.menus.addMenuItems(J,["save","saveAs","-","rename"],V),B.isOfflineApp()?navigator.onLine&&"1"!=urlParams.stealth&&"1"!=urlParams.lockdown&&
this.addMenuItems(J,["upload"],V):B.menus.addMenuItems(J,["makeCopy"],V));B.menus.addMenuItems(J,["-","autosave"],V);null!=U&&U.isRevisionHistorySupported()&&B.menus.addMenuItems(J,["-","revisionHistory"],V)})));var I=this.get("exportAs");this.put("exportAs",new Menu(mxUtils.bind(this,function(J,V){I.funct(J,V);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||B.menus.addMenuItems(J,["publishLink"],V);B.mode!=App.MODE_ATLAS&&"1"!=urlParams.extAuth&&(J.addSeparator(V),B.menus.addSubmenu("embed",J,V))})));
var F=this.get("language");this.put("table",new Menu(mxUtils.bind(this,function(J,V){B.menus.addInsertTableCellItem(J,V)})));if("1"==urlParams.sketch){var H=this.get("units");this.put("units",new Menu(mxUtils.bind(this,function(J,V){H.funct(J,V);this.addMenuItems(J,["-","pageScale","-","ruler"],V)})))}this.put("extras",new Menu(mxUtils.bind(this,function(J,V){null!=F&&B.menus.addSubmenu("language",J,V);"1"!=urlParams.embed&&"1"!=urlParams.extAuth&&B.mode!=App.MODE_ATLAS&&B.menus.addSubmenu("theme",
J,V);B.menus.addSubmenu("units",J,V);J.addSeparator(V);"1"!=urlParams.sketch&&B.menus.addMenuItems(J,"pageScale ruler scrollbars - tooltips copyConnect collapseExpand".split(" "),V);"1"!=urlParams.embedInline&&"1"!=urlParams.sketch&&"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&B.mode!=App.MODE_ATLAS&&B.menus.addMenuItems(J,["-","showStartScreen","search","scratchpad"],V);J.addSeparator(V);"1"==urlParams.sketch?B.menus.addMenuItems(J,"configuration - copyConnect collapseExpand tooltips -".split(" "),
V):(B.mode!=App.MODE_ATLAS&&B.menus.addMenuItem(J,"configuration",V),!B.isOfflineApp()&&isLocalStorage&&B.mode!=App.MODE_ATLAS&&B.menus.addMenuItem(J,"plugins",V));var U=B.getCurrentFile();null!=U&&U.isRealtimeEnabled()&&U.isRealtimeSupported()&&this.addMenuItems(J,["-","showRemoteCursors","shareCursor","-"],V);J.addSeparator(V);B.mode!=App.MODE_ATLAS&&this.addMenuItems(J,["fullscreen"],V);("1"!=urlParams.embedInline&&Editor.isDarkMode()||!mxClient.IS_IE&&!mxClient.IS_IE11)&&this.addMenuItems(J,["toggleDarkMode"],
V);J.addSeparator(V)})));this.put("insertAdvanced",new Menu(mxUtils.bind(this,function(J,V){B.menus.addMenuItems(J,"importText plantUml mermaid - formatSql importCsv - createShape editDiagram".split(" "),V)})));mxUtils.bind(this,function(){var J=this.get("insert"),V=J.funct;J.funct=function(U,X){"1"==urlParams.sketch?(B.insertTemplateEnabled&&!B.isOffline()&&B.menus.addMenuItems(U,["insertTemplate"],X),B.menus.addMenuItems(U,["insertImage","insertLink","-"],X),B.menus.addSubmenu("insertAdvanced",
U,X,mxResources.get("advanced")),B.menus.addSubmenu("layout",U,X)):(V.apply(this,arguments),B.menus.addSubmenu("table",U,X))}})();var R="horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "),W=function(J,V,U,X){J.addItem(U,null,mxUtils.bind(this,function(){var t=new CreateGraphDialog(B,U,X);B.showDialog(t.container,620,420,!0,!1);t.init()}),V)};this.put("insertLayout",new Menu(mxUtils.bind(this,function(J,V){for(var U=0;U<R.length;U++)"-"==R[U]?J.addSeparator(V):
W(J,V,mxResources.get(R[U])+"...",R[U])})))};EditorUi.prototype.installFormatToolbar=function(B){var C=this.editor.graph,G=document.createElement("div");G.style.cssText="position:absolute;top:10px;z-index:1;border-radius:4px;box-shadow:0px 0px 3px 1px #d1d1d1;padding:6px;white-space:nowrap;background-color:#fff;transform:translate(-50%, 0);left:50%;";C.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(N,I){0<C.getSelectionCount()?(B.appendChild(G),G.innerHTML="Selected: "+
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
async function getOrgs (req, res, next) {
try {
options.sort = { short_name: 'asc' }
options.page = req.ctx.query.page ? parseInt(req.ctx.query.page) : CONSTANTS.PAGINATOR_PAGE
const repo = req.ctx.repositories.getOrgRepository()
const agt = setAggregateOrgObj({})
const pg = await repo.aggregatePaginate(agt, options)
const payload = { organizations: pg.itemsList }
if (pg.itemCount >= CONSTANTS.PAGINATOR_OPTIONS.limit) {
payload.totalCount = pg.itemCount
payload.itemsPerPage = pg.itemsPerPage
payload.pageCount = pg.pageCount
payload.currentPage = pg.currentPage
payload.prevPage = pg.prevPage
payload.nextPage = pg.nextPage
}
logger.info({ uuid: req.ctx.uuid, message: 'The orgs were sent to the user.' })
return res.status(200).json(payload)
} catch (err) {
next(err)
}
}
| 0
| null | -1
|
https://github.com/CVEProject/cve-services/commit/d1b44b5345b634026bc36af6a579c5ce4cde86b5
| 3JavaScript
|
B)):N.isSelectionEmpty()&&N.isEnabled()?(B.addSeparator(),this.addMenuItems(B,["editData"],null,G),B.addSeparator(),this.addSubmenu("layout",B),this.addSubmenu("insert",B),this.addMenuItems(B,["-","exitGroup"],null,G)):N.isEnabled()&&this.addMenuItems(B,["-","lockUnlock"],null,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(B,F,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(B,["copyAsImage"],null,G)};EditorUi.prototype.toggleFormatPanel=
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
(null!=this.sync?"-client_"+this.sync.clientId:"-nosync")+"-bytes_"+JSON.stringify(e).length+"-patches_"+e.length+"-size_"+this.getSize());try{EditorUi.logEvent({category:"CHECKSUM-ERROR-SYNC-FILE-"+f,action:D,label:"user_"+d+(null!=this.sync?"-client_"+this.sync.clientId:"-nosync")+"-bytes_"+JSON.stringify(e).length+"-patches_"+e.length+"-size_"+this.getSize()})}catch(g){}}}catch(g){}};
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
static const char *oidc_retrieve_claims_from_userinfo_endpoint(request_rec *r,
oidc_cfg *c, oidc_provider_t *provider, const char *access_token,
oidc_session_t *session, char *id_token_sub) {
oidc_debug(r, "enter");
if (provider->userinfo_endpoint_url == NULL) {
oidc_debug(r,
"not retrieving userinfo claims because userinfo_endpoint is not set");
return NULL;
}
if (access_token == NULL) {
oidc_debug(r,
"not retrieving userinfo claims because access_token is not provided");
return NULL;
}
if ((id_token_sub == NULL) && (session != NULL)) {
const char *s_id_token_claims = NULL;
oidc_session_get(r, session, OIDC_IDTOKEN_CLAIMS_SESSION_KEY,
&s_id_token_claims);
if (s_id_token_claims == NULL) {
oidc_error(r, "no id_token claims provided");
return NULL;
}
json_error_t json_error;
json_t *id_token_claims = json_loads(s_id_token_claims, 0, &json_error);
if (id_token_claims == NULL) {
oidc_error(r, "JSON parsing (json_loads) failed: %s (%s)",
json_error.text, s_id_token_claims);
return NULL;
}
oidc_jose_get_string(r->pool, id_token_claims, "sub", FALSE, &id_token_sub, NULL);
}
const char *result = NULL;
if (oidc_proto_resolve_userinfo(r, c, provider, id_token_sub, access_token,
&result) == FALSE) {
if (session != NULL) {
char *access_token = NULL;
if (oidc_refresh_access_token(r, c, session, provider,
&access_token) == TRUE) {
if (oidc_proto_resolve_userinfo(r, c, provider, id_token_sub, access_token,
&result) == FALSE) {
oidc_error(r,
"resolving user info claims with the refreshed access token failed, nothing will be stored in the session");
result = NULL;
}
} else {
oidc_warn(r,
"refreshing access token failed, claims will not be retrieved/refreshed from the userinfo endpoint");
result = NULL;
}
} else {
oidc_error(r,
"resolving user info claims with the existing/provided access token failed, nothing will be stored in the session");
result = NULL;
}
}
return result;
}
| 0
| null | -1
|
https://github.com/OpenIDC/mod_auth_openidc/commit/612e309bfffd6f9b8ad7cdccda3019fc0865f3b4
| 0CCPP
|
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
{
zend_uint i;
if (!objects->object_buckets) {
return;
}
for (i = 1; i < objects->top ; i++) {
if (objects->object_buckets[i].valid) {
objects->object_buckets[i].destructor_called = 1;
}
}
}
| 0
| null | -1
|
https://github.com/php/php-src/commit/6a7cc8ff85827fa9ac715b3a83c2d9147f33cd43
| 0CCPP
|
def validate_request(self, request):
if self.basic_auth:
basic_auth = get_request_basic_auth(request)
if basic_auth is None or basic_auth not in self.basic_auth:
raise AnymailWebhookValidationFailure(
"Missing or invalid basic auth in Anymail %s webhook" % self.esp_name
)
| 1
|
2,3
| -1
|
https://github.com/anymail/django-anymail.git/commit/db586ede1fbb41dce21310ea28ae15a1cf1286c5
| 4Python
|
void CLASS getOlympus_CameraType2 ()
{
if (OlyID != 0x0ULL) return;
int i=0;
fread(imgdata.makernotes.olympus.CameraType2, 6, 1, ifp);
while ((i < 6) &&
imgdata.makernotes.olympus.CameraType2[i]) {
OlyID = OlyID << 8 | imgdata.makernotes.olympus.CameraType2[i];
if (isspace(imgdata.makernotes.olympus.CameraType2[i+1]))
imgdata.makernotes.olympus.CameraType2[i+1] = '\0';
i++;
}
setOlympusBodyFeatures(OlyID);
return;
}
| 0
| null | -1
|
https://github.com/LibRaw/LibRaw/commit/e47384546b43d0fd536e933249047bc397a4d88b
| 0CCPP
|
static void kvm_cpu_vmxoff(void)
{
asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
intel_pt_handle_vmx(0);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/ef85b67385436ddc1998f45f1d6a210f935b3388
| 0CCPP
|
function wrapper() {
var args = new Array(arguments.length)
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}
var ret = fn.apply(this, args)
var cb = args[args.length-1]
if (typeof ret === 'function' && ret !== cb) {
Object.keys(cb).forEach(function (k) {
ret[k] = cb[k]
})
}
return ret
}
| 0
| null | -1
|
https://github.com/fastify/github-action-merge-dependabot/commit/309f39539c5d918d8a47075587aa8720a9c127f7
| 3JavaScript
|
CoreBasicHandler::CoreBasicHandler(CoreNetwork *parent)
: BasicHandler(parent),
_network(parent)
{
connect(this, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)),
network(), SLOT(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)));
connect(this, SIGNAL(putCmd(QString, const QList<QByteArray> &, const QByteArray &)),
network(), SLOT(putCmd(QString, const QList<QByteArray> &, const QByteArray &)));
connect(this, SIGNAL(putRawLine(const QByteArray &)),
network(), SLOT(putRawLine(const QByteArray &)));
}
| 1
| null | -1
|
https://github.com/quassel/quassel/commit/b5e38970ffd55e2dd9f706ce75af9a8d7730b1b8
| 0CCPP
|
void set_ndpi_flow_malloc(void *(*__ndpi_flow_malloc)(size_t size)) {
_ndpi_flow_malloc = __ndpi_flow_malloc;
}
| 0
| null | -1
|
https://github.com/ntop/nDPI/commit/61066fb106efa6d3d95b67e47b662de208b2b622
| 0CCPP
|
function Client() {
if (!(this instanceof Client))
return new Client();
EventEmitter.call(this);
this.config = {
host: undefined,
port: undefined,
localAddress: undefined,
localPort: undefined,
forceIPv4: undefined,
forceIPv6: undefined,
keepaliveCountMax: undefined,
keepaliveInterval: undefined,
readyTimeout: undefined,
username: undefined,
password: undefined,
privateKey: undefined,
tryKeyboard: undefined,
agent: undefined,
allowAgentFwd: undefined,
authHandler: undefined,
hostHashAlgo: undefined,
hostHashCb: undefined,
strictVendor: undefined,
debug: undefined
};
this._readyTimeout = undefined;
this._channels = undefined;
this._callbacks = undefined;
this._forwarding = undefined;
this._forwardingUnix = undefined;
this._acceptX11 = undefined;
this._agentFwdEnabled = undefined;
this._curChan = undefined;
this._remoteVer = undefined;
this._sshstream = undefined;
this._sock = undefined;
this._resetKA = undefined;
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38
| -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
def extend_search_term(
searchterm,
author_name,
book_title,
publisher,
pub_start,
pub_end,
tags,
rating_high,
rating_low,
read_status,
):
searchterm.extend((author_name.replace("|", ","), book_title, publisher))
if pub_start:
try:
searchterm.extend(
[
_("Published after ")
+ format_date(
datetime.strptime(pub_start, "%Y-%m-%d"),
format="medium",
locale=get_locale(),
)
]
)
except ValueError:
pub_start = ""
if pub_end:
try:
searchterm.extend(
[
_("Published before ")
+ format_date(
datetime.strptime(pub_end, "%Y-%m-%d"),
format="medium",
locale=get_locale(),
)
]
)
except ValueError:
pub_end = ""
elements = {
"tag": db.Tags,
"serie": db.Series,
"shelf": ub.Shelf,
}
for key, db_element in elements.items():
tag_names = (
calibre_db.session.query(db_element)
.filter(db_element.id.in_(tags["include_" + key]))
.all()
)
searchterm.extend(tag.name for tag in tag_names)
tag_names = (
calibre_db.session.query(db_element)
.filter(db_element.id.in_(tags["exclude_" + key]))
.all()
)
searchterm.extend(tag.name for tag in tag_names)
language_names = (
calibre_db.session.query(db.Languages)
.filter(db.Languages.id.in_(tags["include_language"]))
.all()
)
if language_names:
language_names = calibre_db.speaking_language(language_names)
searchterm.extend(language.name for language in language_names)
language_names = (
calibre_db.session.query(db.Languages)
.filter(db.Languages.id.in_(tags["exclude_language"]))
.all()
)
if language_names:
language_names = calibre_db.speaking_language(language_names)
searchterm.extend(language.name for language in language_names)
if rating_high:
searchterm.extend([_("Rating <= %(rating)s", rating=rating_high)])
if rating_low:
searchterm.extend([_("Rating >= %(rating)s", rating=rating_low)])
if read_status:
searchterm.extend([_("Read Status = %(status)s", status=read_status)])
searchterm.extend(ext for ext in tags["include_extension"])
searchterm.extend(ext for ext in tags["exclude_extension"])
searchterm = " + ".join(filter(None, searchterm))
return searchterm, pub_start, pub_end
| 1
|
45
| -1
|
https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367
| 4Python
|
struct mg_str mg_url_host(const char *url) {
struct url u = urlparse(url);
size_t n = u.port ? u.port - u.host - 1
: u.uri ? u.uri - u.host
: u.end - u.host;
struct mg_str s = mg_str_n(url + u.host, n);
return s;
}
| 0
| null | -1
|
https://github.com/cesanta/mongoose/commit/c65c8fdaaa257e0487ab0aaae9e8f6b439335945
| 0CCPP
|
PHP_FUNCTION(imageline)
{
zval *IM;
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
RETURN_FALSE;
}
#ifdef HAVE_GD_BUNDLED
if (im->antialias) {
gdImageAALine(im, x1, y1, x2, y2, col);
} else
#endif
{
gdImageLine(im, x1, y1, x2, y2, col);
}
RETURN_TRUE;
}
| 0
| null | -1
|
https://github.com/php/php-src/commit/28022c9b1fd937436ab67bb3d61f652c108baf96
| 0CCPP
|
static void iw_set_auto_resizetype(struct iw_context *ctx, int size1, int size2,
int dimension)
{
if(size2==size1 && !ctx->resize_settings[dimension].use_offset &&
!ctx->req.out_true_valid &&
ctx->resize_settings[dimension].translate==0.0)
{
iw_set_resize_alg(ctx, dimension, IW_RESIZETYPE_NULL, 1.0, 0.0, 0.0);
return;
}
iw_set_resize_alg(ctx, dimension, IW_RESIZETYPE_CUBIC, 1.0, 0.0, 0.5);
}
| 0
| null | -1
|
https://github.com/jsummers/imageworsener/commit/a4f247707f08e322f0b41e82c3e06e224240a654
| 0CCPP
|
static NTLM_AV_PAIR* ntlm_av_pair_next(NTLM_AV_PAIR* pAvPair, size_t* pcbAvPair)
{
size_t offset;
if (!pcbAvPair)
return NULL;
if (!ntlm_av_pair_check(pAvPair, *pcbAvPair))
return NULL;
offset = ntlm_av_pair_get_next_offset(pAvPair);
*pcbAvPair -= offset;
return (NTLM_AV_PAIR*)((PBYTE)pAvPair + offset);
}
| 1
|
7
| -1
|
https://github.com/FreeRDP/FreeRDP/commit/58a3122250d54de3a944c487776bcd4d1da4721e
| 0CCPP
|
function onCHANNEL_OPEN(self, info) {
// the server is trying to open a channel with us, this is usually when
var localChan = false;
var reason;
function accept() {
var chaninfo = {
type: info.type,
incoming: {
id: localChan,
window: Channel.MAX_WINDOW,
packetSize: Channel.PACKET_SIZE,
state: 'open'
},
outgoing: {
id: info.sender,
window: info.window,
packetSize: info.packetSize,
state: 'open'
}
};
var stream = new Channel(chaninfo, self);
self._sshstream.channelOpenConfirm(info.sender,
localChan,
Channel.MAX_WINDOW,
Channel.PACKET_SIZE);
return stream;
}
function reject() {
if (reason === undefined) {
if (localChan === false)
reason = consts.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE;
else
reason = consts.CHANNEL_OPEN_FAILURE.CONNECT_FAILED;
}
self._sshstream.channelOpenFail(info.sender, reason, '', '');
}
if (info.type === 'forwarded-tcpip'
|| info.type === 'x11'
|| info.type === 'auth-agent@openssh.com'
|| info.type === 'forwarded-streamlocal@openssh.com') {
// check for conditions for automatic rejection
var rejectConn = (
(info.type === 'forwarded-tcpip'
&& self._forwarding[info.data.destIP
+ ':'
+ info.data.destPort] === undefined)
|| (info.type === 'forwarded-streamlocal@openssh.com'
&& self._forwardingUnix[info.data.socketPath] === undefined)
|| (info.type === 'x11' && self._acceptX11 === 0)
|| (info.type === 'auth-agent@openssh.com'
&& !self._agentFwdEnabled)
);
if (!rejectConn) {
localChan = nextChannel(self);
if (localChan === false) {
self.config.debug('DEBUG: Client: Automatic rejection of incoming channel open: no channels available');
rejectConn = true;
} else
self._channels[localChan] = true;
} else {
reason = consts.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED;
self.config.debug('DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: '
+ info.type);
}
// TODO: automatic rejection after some timeout?
if (rejectConn)
reject();
if (localChan !== false) {
if (info.type === 'forwarded-tcpip') {
if (info.data.destPort === 0) {
info.data.destPort = self._forwarding[info.data.destIP
+ ':'
+ info.data.destPort];
}
self.emit('tcp connection', info.data, accept, reject);
} else if (info.type === 'x11') {
self.emit('x11', info.data, accept, reject);
} else if (info.type === 'forwarded-streamlocal@openssh.com') {
self.emit('unix connection', info.data, accept, reject);
} else {
agentQuery(self.config.agent, accept, reject);
}
}
} else {
// automatically reject any unsupported channel open requests
self.config.debug('DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: '
+ info.type);
reason = consts.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE;
reject();
}
}
| 1
|
1,2,3,4,5,9,10,20,21,22,23,24,26,27,29,30,32,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,83,84,85,86,87,88
| -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
unsigned int blk_plug_queued_count(struct request_queue *q)
{
struct blk_plug *plug;
struct request *rq;
struct list_head *plug_list;
unsigned int ret = 0;
plug = current->plug;
if (!plug)
goto out;
if (q->mq_ops)
plug_list = &plug->mq_list;
else
plug_list = &plug->list;
list_for_each_entry(rq, plug_list, queuelist) {
if (rq->q == q)
ret++;
}
out:
return ret;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24
| 0CCPP
|
void jsB_initstring(js_State *J)
{
J->String_prototype->u.s.string = "";
J->String_prototype->u.s.length = 0;
js_pushobject(J, J->String_prototype);
{
jsB_propf(J, "String.prototype.toString", Sp_toString, 0);
jsB_propf(J, "String.prototype.valueOf", Sp_valueOf, 0);
jsB_propf(J, "String.prototype.charAt", Sp_charAt, 1);
jsB_propf(J, "String.prototype.charCodeAt", Sp_charCodeAt, 1);
jsB_propf(J, "String.prototype.concat", Sp_concat, 0);
jsB_propf(J, "String.prototype.indexOf", Sp_indexOf, 1);
jsB_propf(J, "String.prototype.lastIndexOf", Sp_lastIndexOf, 1);
jsB_propf(J, "String.prototype.localeCompare", Sp_localeCompare, 1);
jsB_propf(J, "String.prototype.match", Sp_match, 1);
jsB_propf(J, "String.prototype.replace", Sp_replace, 2);
jsB_propf(J, "String.prototype.search", Sp_search, 1);
jsB_propf(J, "String.prototype.slice", Sp_slice, 2);
jsB_propf(J, "String.prototype.split", Sp_split, 2);
jsB_propf(J, "String.prototype.substring", Sp_substring, 2);
jsB_propf(J, "String.prototype.toLowerCase", Sp_toLowerCase, 0);
jsB_propf(J, "String.prototype.toLocaleLowerCase", Sp_toLowerCase, 0);
jsB_propf(J, "String.prototype.toUpperCase", Sp_toUpperCase, 0);
jsB_propf(J, "String.prototype.toLocaleUpperCase", Sp_toUpperCase, 0);
jsB_propf(J, "String.prototype.trim", Sp_trim, 0);
}
js_newcconstructor(J, jsB_String, jsB_new_String, "String", 0);
{
jsB_propf(J, "String.fromCharCode", S_fromCharCode, 0);
}
js_defglobal(J, "String", JS_DONTENUM);
}
| 0
| null | -1
|
https://github.com/ccxvii/mujs/commit/00d4606c3baf813b7b1c176823b2729bf51002a2
| 0CCPP
|
ldbm_config_idl_get_update(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
return (void *)((uintptr_t)li->li_idl_update);
}
| 0
| null | -1
|
https://github.com/389ds/389-ds-base/commit/cc0f69283abc082488824702dae485b8eae938bc
| 0CCPP
|
void __init sem_init (void)
{
sem_init_ns(&init_ipc_ns);
ipc_init_proc_interface("sysvipc/sem",
" key semid perms nsems uid gid cuid cgid otime ctime\n",
IPC_SEM_IDS, sysvipc_sem_proc_show);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/6062a8dc0517bce23e3c2f7d2fea5e22411269a3
| 0CCPP
|
mtime: Date.now()
});
}
| 1
|
0
| -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
static int read_exceptions(struct pstore *ps,
int (*callback)(void *callback_context, chunk_t old,
chunk_t new),
void *callback_context)
{
int r, full = 1;
for (ps->current_area = 0; full; ps->current_area++) {
r = area_io(ps, READ);
if (r)
return r;
r = insert_exceptions(ps, callback, callback_context, &full);
if (r)
return r;
}
ps->current_area--;
return 0;
}
| 1
| null | -1
|
https://github.com/torvalds/linux/commit/e9c6a182649f4259db704ae15a91ac820e63b0ca
| 0CCPP
|
const RETURN_FALSE = () => false;
| 0
| null | -1
|
https://github.com/patriksimek/vm2/commit/b4f6e2bd2c4a1ef52fc4483d8e35f28bc4481886
| 3JavaScript
|
return tag(tagName, { classes: field.classes() }, wrappedContent.join(''));
};
| 1
|
0
| -1
|
https://github.com/caolan/forms/commit/bc01e534a0ff863dedb2026a50bd03153bbc6a5d
| 3JavaScript
|
static int process_one_ticket(struct ceph_auth_client *ac,
struct ceph_crypto_key *secret,
void **p, void *end,
void *dbuf, void *ticket_buf)
{
struct ceph_x_info *xi = ac->private;
int type;
u8 tkt_struct_v, blob_struct_v;
struct ceph_x_ticket_handler *th;
void *dp, *dend;
int dlen;
char is_enc;
struct timespec validity;
struct ceph_crypto_key old_key;
void *tp, *tpend;
struct ceph_timespec new_validity;
struct ceph_crypto_key new_session_key;
struct ceph_buffer *new_ticket_blob;
unsigned long new_expires, new_renew_after;
u64 new_secret_id;
int ret;
ceph_decode_need(p, end, sizeof(u32) + 1, bad);
type = ceph_decode_32(p);
dout(" ticket type %d %s\n", type, ceph_entity_type_name(type));
tkt_struct_v = ceph_decode_8(p);
if (tkt_struct_v != 1)
goto bad;
th = get_ticket_handler(ac, type);
if (IS_ERR(th)) {
ret = PTR_ERR(th);
goto out;
}
dlen = ceph_x_decrypt(secret, p, end, dbuf,
TEMP_TICKET_BUF_LEN);
if (dlen <= 0) {
ret = dlen;
goto out;
}
dout(" decrypted %d bytes\n", dlen);
dp = dbuf;
dend = dp + dlen;
tkt_struct_v = ceph_decode_8(&dp);
if (tkt_struct_v != 1)
goto bad;
memcpy(&old_key, &th->session_key, sizeof(old_key));
ret = ceph_crypto_key_decode(&new_session_key, &dp, dend);
if (ret)
goto out;
ceph_decode_copy(&dp, &new_validity, sizeof(new_validity));
ceph_decode_timespec(&validity, &new_validity);
new_expires = get_seconds() + validity.tv_sec;
new_renew_after = new_expires - (validity.tv_sec / 4);
dout(" expires=%lu renew_after=%lu\n", new_expires,
new_renew_after);
ceph_decode_8_safe(p, end, is_enc, bad);
tp = ticket_buf;
if (is_enc) {
dout(" encrypted ticket\n");
dlen = ceph_x_decrypt(&old_key, p, end, ticket_buf,
TEMP_TICKET_BUF_LEN);
if (dlen < 0) {
ret = dlen;
goto out;
}
dlen = ceph_decode_32(&tp);
} else {
ceph_decode_32_safe(p, end, dlen, bad);
ceph_decode_need(p, end, dlen, bad);
ceph_decode_copy(p, ticket_buf, dlen);
}
tpend = tp + dlen;
dout(" ticket blob is %d bytes\n", dlen);
ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad);
blob_struct_v = ceph_decode_8(&tp);
new_secret_id = ceph_decode_64(&tp);
ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend);
if (ret)
goto out;
ceph_crypto_key_destroy(&th->session_key);
if (th->ticket_blob)
ceph_buffer_put(th->ticket_blob);
th->session_key = new_session_key;
th->ticket_blob = new_ticket_blob;
th->validity = new_validity;
th->secret_id = new_secret_id;
th->expires = new_expires;
th->renew_after = new_renew_after;
dout(" got ticket service %d (%s) secret_id %lld len %d\n",
type, ceph_entity_type_name(type), th->secret_id,
(int)th->ticket_blob->vec.iov_len);
xi->have_keys |= th->service;
out:
return ret;
bad:
ret = -EINVAL;
goto out;
}
| 1
|
2,3,32,33,55,58,59
| -1
|
https://github.com/torvalds/linux/commit/c27a3e4d667fdcad3db7b104f75659478e0c68d8
| 0CCPP
|
whoami : function () { return { id: feed.id } },
| 1
|
0
| -1
|
https://github.com/ssbc/ssb-db/commit/ee983727fc78eea94564733693ccda18a1fffcf2
| 3JavaScript
|
void LanLinkProvider::udpBroadcastReceived()
{
while (m_udpSocket.hasPendingDatagrams()) {
QByteArray datagram;
datagram.resize(m_udpSocket.pendingDatagramSize());
QHostAddress sender;
m_udpSocket.readDatagram(datagram.data(), datagram.size(), &sender);
if (sender.isLoopback() && !m_testMode)
continue;
NetworkPacket* receivedPacket = new NetworkPacket(QLatin1String(""));
bool success = NetworkPacket::unserialize(datagram, receivedPacket);
if (!success) {
qCDebug(KDECONNECT_CORE) << "Could not unserialize UDP packet";
delete receivedPacket;
continue;
}
if (receivedPacket->type() != PACKET_TYPE_IDENTITY) {
qCDebug(KDECONNECT_CORE) << "Received a UDP packet of wrong type" << receivedPacket->type();
delete receivedPacket;
continue;
}
if (receivedPacket->get<QString>(QStringLiteral("deviceId")) == KdeConnectConfig::instance().deviceId()) {
delete receivedPacket;
continue;
}
int tcpPort = receivedPacket->get<int>(QStringLiteral("tcpPort"));
QSslSocket* socket = new QSslSocket(this);
socket->setProxy(QNetworkProxy::NoProxy);
m_receivedIdentityPackets[socket].np = receivedPacket;
m_receivedIdentityPackets[socket].sender = sender;
connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::tcpSocketConnected);
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), this, &LanLinkProvider::connectError);
#else
connect(socket, &QAbstractSocket::errorOccurred, this, &LanLinkProvider::connectError);
#endif
socket->connectToHost(sender, tcpPort);
}
}
| 1
| null | -1
|
https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991
| 0CCPP
|
static void dgram_hash(struct sock *sk)
{
write_lock_bh(&dgram_lock);
sk_add_node(sk, &dgram_head);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
write_unlock_bh(&dgram_lock);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/bceaa90240b6019ed73b49965eac7d167610be69
| 0CCPP
|
static int maybe_start_packet(vorb *f)
{
if (f->next_seg == -1) {
int x = get8(f);
if (f->eof) return FALSE;
if (0x4f != x ) return error(f, VORBIS_missing_capture_pattern);
if (0x67 != get8(f)) return error(f, VORBIS_missing_capture_pattern);
if (0x67 != get8(f)) return error(f, VORBIS_missing_capture_pattern);
if (0x53 != get8(f)) return error(f, VORBIS_missing_capture_pattern);
if (!start_page_no_capturepattern(f)) return FALSE;
if (f->page_flag & PAGEFLAG_continued_packet) {
f->last_seg = FALSE;
f->bytes_in_seg = 0;
return error(f, VORBIS_continued_packet_flag_invalid);
}
}
return start_packet(f);
}
| 0
| null | -1
|
https://github.com/nothings/stb/commit/98fdfc6df88b1e34a736d5e126e6c8139c8de1a6
| 0CCPP
|
format_nid(const u_char *data)
{
static char buf[4][sizeof("01:01:01:01")];
static int i = 0;
i = (i + 1) % 4;
snprintf(buf[i], sizeof(buf[i]), "%02x:%02x:%02x:%02x",
data[0], data[1], data[2], data[3]);
return buf[i];
}
| 0
| null | -1
|
https://github.com/the-tcpdump-group/tcpdump/commit/c2f6833dddecf2d5fb89c9c898eee9981da342ed
| 0CCPP
|
"&from="+q;break}q=z.background;"png"!=g&&"pdf"!=g&&"svg"!=g||!p?p||null!=q&&q!=mxConstants.NONE||(q="#ffffff"):q=mxConstants.NONE;p={globalVars:z.getExportVariables()};A&&(p.grid={size:z.gridSize,steps:z.view.gridSteps,color:z.view.gridColor});Graph.translateDiagram&&(p.diagramLanguage=Graph.diagramLanguage);return new mxXmlRequest(EXPORT_URL,"format="+g+C+D+"&bg="+(null!=q?q:mxConstants.NONE)+"&base64="+l+"&embedXml="+B+"&xml="+encodeURIComponent(k)+(null!=d?"&filename="+encodeURIComponent(d):"")+
"&extras="+encodeURIComponent(JSON.stringify(p))+(null!=x?"&scale="+x:"")+(null!=y?"&border="+y:"")+(O&&isFinite(O)?"&w="+O:"")+(t&&isFinite(t)?"&h="+t:""))};EditorUi.prototype.setMode=function(d,g){this.mode=d};EditorUi.prototype.loadDescriptor=function(d,g,k){var l=window.location.hash,p=mxUtils.bind(this,function(q){var x=null!=d.data?d.data:"";null!=q&&0<q.length&&(0<x.length&&(x+="\n"),x+=q);q=new LocalFile(this,"csv"!=d.format&&0<x.length?x:this.emptyDiagramXml,null!=urlParams.title?decodeURIComponent(urlParams.title):
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
void __init acpi_osi_setup(char *str)
{
struct osi_setup_entry *osi;
bool enable = true;
int i;
if (!acpi_gbl_create_osi_method)
return;
if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
return;
}
if (*str == '!') {
str++;
if (*str == '\0') {
osi_linux.default_disabling = 1;
return;
} else if (*str == '*') {
acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
osi->enable = false;
}
return;
}
enable = false;
}
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
if (!strcmp(osi->string, str)) {
osi->enable = enable;
break;
} else if (osi->string[0] == '\0') {
osi->enable = enable;
strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
break;
}
}
}
| 0
| null | -1
|
https://github.com/mjg59/linux/commit/a4a5ed2835e8ea042868b7401dced3f517cafa76
| 0CCPP
|
public void addShellArg( String arg )
{
shellArgs.add( arg );
}
| 0
| null | -1
|
https://github.com/codehaus-plexus/plexus-utils/commit/b38a1b3a4352303e4312b2bb601a0d7ec6e28f41
| 2Java
|
Jsi_DbQuery(Jsi_Db *jdb, Jsi_CDataDb *dbopts, const char *query)
{
int rc = jsi_DbQuery(jdb, dbopts, query);
#ifdef JSI_DBQUERY_ERRORCMD
if (rc<0)
rc = JSI_DBQUERY_ERRORCMD(jdb, specs, data, arrSize, query, dopts, rc);
#endif
return rc;
}
| 0
| null | -1
|
https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18
| 0CCPP
|
public Iterator<WorkUnit> getWorkUnitIterator() {
return workUnitList.iterator();
}
| 0
| null | -1
|
https://github.com/NationalSecurityAgency/emissary/commit/40260b1ec1f76cc92361702cc14fa1e4388e19d7
| 2Java
|
void PrivateThreadPoolDatasetOp::MakeDatasetFromOptions(OpKernelContext* ctx,
DatasetBase* input,
int32_t num_threads,
DatasetBase** output) {
OP_REQUIRES_OK(ctx, ValidateNumThreads(num_threads));
*output = new Dataset(ctx,
DatasetContext(DatasetContext::Params(
{PrivateThreadPoolDatasetOp::kDatasetType,
PrivateThreadPoolDatasetOp::kDatasetOp})),
input, num_threads);
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/e3749a6d5d1e8d11806d4a2e9cc3123d1a90b75e
| 0CCPP
|
search.stats = function(files) {
if(files.length) {
var file = files.shift();
fs.stat(relativePath + '/' + file, function(err, stats) {
if(err) { writeError(err); }
else {
stats.name = file;
stats.isFile = stats.isFile();
stats.isDirectory = stats.isDirectory();
stats.isBlockDevice = stats.isBlockDevice();
stats.isFIFO = stats.isFIFO();
stats.isSocket = stats.isSocket();
results.push(stats);
search.stats(files);
}
});
} else {
if(query.type == 'json' || query.dir == 'json') {
res.setHeader('Content-Type', 'application/json');
res.write(JSON.stringify(results));
res.end();
} else {
res.setHeader('Content-Type', 'text/html');
res.write('<html><body>');
for(var f = 0; f < results.length; f++) {
var name = results[f].name;
var normalized = url + '/' + name;
while(normalized[0] == '/') { normalized = normalized.slice(1, normalized.length); }
res.write('\r\n<p><a href="/' + normalized + '">' + name + '</a></p>');
}
res.end('\r\n</body></html>');
}
}
};
| 1
|
28
| -1
|
https://github.com/omphalos/crud-file-server/commit/4155bfe068bf211b49a0b3ffd06e78cbaf1b40fa
| 3JavaScript
|
findSibling = function(subtree, dir) {
var node = subtree.children(':first'),
info;
while (node.length) {
info = fm.file(fm.navId2Hash(node.children('[id]').attr('id')));
if ((info = fm.file(fm.navId2Hash(node.children('[id]').attr('id'))))
&& dir.name.toLowerCase().localeCompare(info.name.toLowerCase()) < 0) {
return node;
}
node = node.next();
}
return $('');
},
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
krb5_gss_process_context_token(minor_status, context_handle,
token_buffer)
OM_uint32 *minor_status;
gss_ctx_id_t context_handle;
gss_buffer_t token_buffer;
{
krb5_gss_ctx_id_rec *ctx;
OM_uint32 majerr;
ctx = (krb5_gss_ctx_id_t) context_handle;
if (! ctx->established) {
*minor_status = KG_CTX_INCOMPLETE;
return(GSS_S_NO_CONTEXT);
}
if (GSS_ERROR(majerr = kg_unseal(minor_status, context_handle,
token_buffer,
GSS_C_NO_BUFFER, NULL, NULL,
KG_TOK_DEL_CTX)))
return(majerr);
/* that's it. delete the context */
return(krb5_gss_delete_sec_context(minor_status, &context_handle,
GSS_C_NO_BUFFER));
}
| 1
|
9,18,19,20
| -1
|
https://github.com/krb5/krb5/commit/82dc33da50338ac84c7b4102dc6513d897d0506a
| 0CCPP
|
def critical(__self, __message, *args, **kwargs):
__self._log("CRITICAL", None, False, __self._options, __message, args, kwargs)
| 0
| null | -1
|
https://github.com/delgan/loguru.git/commit/ea39375e62f9b8f18e2ca798a5c0fb8c972b7eaa
| 4Python
|
def _PktDecodeVendorAttribute(self, data):
if len(data) < 6:
return (26, data)
(vendor, type, length) = struct.unpack("!LBB", data[:6])[0:3]
if len(data) != length + 4:
return (26, data)
return ((vendor, type), data[6:])
| 0
| null | -1
|
https://github.com/pyradius/pyrad.git/commit/38f74b36814ca5b1a27d9898141126af4953bee5
| 4Python
|
predicate_parse(const char *str, int nr_parens, int nr_preds,
parse_pred_fn parse_pred, void *data,
struct filter_parse_error *pe)
{
struct prog_entry *prog_stack;
struct prog_entry *prog;
const char *ptr = str;
char *inverts = NULL;
int *op_stack;
int *top;
int invert = 0;
int ret = -ENOMEM;
int len;
int N = 0;
int i;
nr_preds += 2;
op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL);
if (!op_stack)
return ERR_PTR(-ENOMEM);
prog_stack = kcalloc(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
if (!prog_stack) {
parse_error(pe, -ENOMEM, 0);
goto out_free;
}
inverts = kmalloc_array(nr_preds, sizeof(*inverts), GFP_KERNEL);
if (!inverts) {
parse_error(pe, -ENOMEM, 0);
goto out_free;
}
top = op_stack;
prog = prog_stack;
*top = 0;
while (*ptr) {
const char *next = ptr++;
if (isspace(*next))
continue;
switch (*next) {
case '(':
if (top - op_stack > nr_parens)
return ERR_PTR(-EINVAL);
*(++top) = invert;
continue;
case '!':
if (!is_not(next))
break;
invert = !invert;
continue;
}
if (N >= nr_preds) {
parse_error(pe, FILT_ERR_TOO_MANY_PREDS, next - str);
goto out_free;
}
inverts[N] = invert;
prog[N].target = N-1;
len = parse_pred(next, data, ptr - str, pe, &prog[N].pred);
if (len < 0) {
ret = len;
goto out_free;
}
ptr = next + len;
N++;
ret = -1;
while (1) {
next = ptr++;
if (isspace(*next))
continue;
switch (*next) {
case ')':
case '\0':
break;
case '&':
case '|':
if (next[1] == next[0]) {
ptr++;
break;
}
default:
parse_error(pe, FILT_ERR_TOO_MANY_PREDS,
next - str);
goto out_free;
}
invert = *top & INVERT;
if (*top & PROCESS_AND) {
update_preds(prog, N - 1, invert);
*top &= ~PROCESS_AND;
}
if (*next == '&') {
*top |= PROCESS_AND;
break;
}
if (*top & PROCESS_OR) {
update_preds(prog, N - 1, !invert);
*top &= ~PROCESS_OR;
}
if (*next == '|') {
*top |= PROCESS_OR;
break;
}
if (!*next)
goto out;
if (top == op_stack) {
ret = -1;
parse_error(pe, FILT_ERR_TOO_MANY_CLOSE, ptr - str);
goto out_free;
}
top--;
}
}
out:
if (top != op_stack) {
parse_error(pe, FILT_ERR_TOO_MANY_OPEN, ptr - str);
goto out_free;
}
if (!N) {
ret = -EINVAL;
parse_error(pe, FILT_ERR_NO_FILTER, ptr - str);
goto out_free;
}
prog[N].pred = NULL;
prog[N].target = 1;
prog[N+1].pred = NULL;
prog[N+1].target = 0;
prog[N-1].target = N;
prog[N-1].when_to_branch = false;
for (i = N-1 ; i--; ) {
int target = prog[i].target;
if (prog[i].when_to_branch == prog[target].when_to_branch)
prog[i].target = prog[target].target;
}
for (i = 0; i < N; i++) {
invert = inverts[i] ^ prog[i].when_to_branch;
prog[i].when_to_branch = invert;
if (WARN_ON(prog[i].target <= i)) {
ret = -EINVAL;
goto out_free;
}
}
kfree(op_stack);
kfree(inverts);
return prog;
out_free:
kfree(op_stack);
kfree(inverts);
if (prog_stack) {
for (i = 0; prog_stack[i].pred; i++)
kfree(prog_stack[i].pred);
kfree(prog_stack);
}
return ERR_PTR(ret);
}
| 1
|
38,39
| -1
|
https://github.com/torvalds/linux/commit/96c5c6e6a5b6db592acae039fed54b5c8844cd35
| 0CCPP
|
var isSelected = function (value, choice) {
return value && (is.array(value) ? value.some(choiceValueEquals.bind(null, choice)) : choiceValueEquals(value, choice));
};
| 0
| null | -1
|
https://github.com/caolan/forms/commit/bc01e534a0ff863dedb2026a50bd03153bbc6a5d
| 3JavaScript
|
public PgConnection(HostSpec[] hostSpecs,
String user,
String database,
Properties info,
String url) throws SQLException {
LOGGER.log(Level.FINE, org.postgresql.util.DriverInfo.DRIVER_FULL_NAME);
this.creatingURL = url;
this.readOnlyBehavior = getReadOnlyBehavior(PGProperty.READ_ONLY_MODE.get(info));
setDefaultFetchSize(PGProperty.DEFAULT_ROW_FETCH_SIZE.getInt(info));
setPrepareThreshold(PGProperty.PREPARE_THRESHOLD.getInt(info));
if (prepareThreshold == -1) {
setForceBinary(true);
}
this.queryExecutor = ConnectionFactory.openConnection(hostSpecs, user, database, info);
if (LOGGER.isLoggable(Level.WARNING) && !haveMinimumServerVersion(ServerVersion.v8_2)) {
LOGGER.log(Level.WARNING, "Unsupported Server Version: {0}", queryExecutor.getServerVersion());
}
setSessionReadOnly = createQuery("SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY", false, true);
setSessionNotReadOnly = createQuery("SET SESSION CHARACTERISTICS AS TRANSACTION READ WRITE", false, true);
if (PGProperty.READ_ONLY.getBoolean(info)) {
setReadOnly(true);
}
this.hideUnprivilegedObjects = PGProperty.HIDE_UNPRIVILEGED_OBJECTS.getBoolean(info);
Set<Integer> binaryOids = getBinaryOids(info);
Set<Integer> useBinarySendForOids = new HashSet<Integer>(binaryOids);
Set<Integer> useBinaryReceiveForOids = new HashSet<Integer>(binaryOids);
useBinarySendForOids.remove(Oid.DATE);
queryExecutor.setBinaryReceiveOids(useBinaryReceiveForOids);
queryExecutor.setBinarySendOids(useBinarySendForOids);
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, " types using binary send = {0}", oidsToString(useBinarySendForOids));
LOGGER.log(Level.FINEST, " types using binary receive = {0}", oidsToString(useBinaryReceiveForOids));
LOGGER.log(Level.FINEST, " integer date/time = {0}", queryExecutor.getIntegerDateTimes());
}
String stringType = PGProperty.STRING_TYPE.get(info);
if (stringType != null) {
if (stringType.equalsIgnoreCase("unspecified")) {
bindStringAsVarchar = false;
} else if (stringType.equalsIgnoreCase("varchar")) {
bindStringAsVarchar = true;
} else {
throw new PSQLException(
GT.tr("Unsupported value for stringtype parameter: {0}", stringType),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else {
bindStringAsVarchar = true;
}
timestampUtils = new TimestampUtils(!queryExecutor.getIntegerDateTimes(), new Provider<TimeZone>() {
@Override
public TimeZone get() {
return queryExecutor.getTimeZone();
}
});
commitQuery = createQuery("COMMIT", false, true).query;
rollbackQuery = createQuery("ROLLBACK", false, true).query;
int unknownLength = PGProperty.UNKNOWN_LENGTH.getInt(info);
typeCache = createTypeInfo(this, unknownLength);
initObjectTypes(info);
if (PGProperty.LOG_UNCLOSED_CONNECTIONS.getBoolean(info)) {
openStackTrace = new Throwable("Connection was created at this point:");
}
this.disableColumnSanitiser = PGProperty.DISABLE_COLUMN_SANITISER.getBoolean(info);
if (haveMinimumServerVersion(ServerVersion.v8_3)) {
typeCache.addCoreType("uuid", Oid.UUID, Types.OTHER, "java.util.UUID", Oid.UUID_ARRAY);
typeCache.addCoreType("xml", Oid.XML, Types.SQLXML, "java.sql.SQLXML", Oid.XML_ARRAY);
}
this.clientInfo = new Properties();
if (haveMinimumServerVersion(ServerVersion.v9_0)) {
String appName = PGProperty.APPLICATION_NAME.get(info);
if (appName == null) {
appName = "";
}
this.clientInfo.put("ApplicationName", appName);
}
fieldMetadataCache = new LruCache<FieldMetadata.Key, FieldMetadata>(
Math.max(0, PGProperty.DATABASE_METADATA_CACHE_FIELDS.getInt(info)),
Math.max(0, PGProperty.DATABASE_METADATA_CACHE_FIELDS_MIB.getInt(info) * 1024 * 1024),
false);
replicationConnection = PGProperty.REPLICATION.get(info) != null;
}
| 1
| null | -1
|
https://github.com/pgjdbc/pgjdbc/commit/14b62aca4764d496813f55a43d050b017e01eb65
| 2Java
|
handle_update_write(int handle, ssize_t bytes)
{
if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0)
handles[handle].bytes_write += bytes;
}
| 0
| null | -1
|
https://github.com/openbsd/src/commit/a6981567e8e215acc1ef690c8dbb30f2d9b00a19
| 0CCPP
|
static unsigned long mmap_legacy_base(unsigned long rnd)
{
if (mmap_is_ia32())
return TASK_UNMAPPED_BASE;
else
return TASK_UNMAPPED_BASE + rnd;
}
| 1
|
0,1,2,3,4,5,6
| -1
|
https://github.com/torvalds/linux/commit/8b8addf891de8a00e4d39fc32f93f7c5eb8feceb
| 0CCPP
|
document.createElement("div");oa.className="geTempDlgNewDiagramCatItemLbl";oa.innerHTML=qa;ma.appendChild(oa);Da.appendChild(ma);mxEvent.addListener(ma,"click",function(){function Ja(){var Ra=Ga.querySelector(".geTemplateDrawioCatLink");null!=Ra?Ra.click():setTimeout(Ja,200)}Z=!0;var Ga=Q.querySelector(".geTemplatesList");Ga.style.display="block";Aa.style.width="";Oa.style.display="";Oa.value="";da=null;Ja()});ea.style.display=fa.length<=ba?"none":""}function G(fa,ca,ba){function ja(Qa,Ya){var La=
mxResources.get(Qa);null==La&&(La=Qa.substring(0,1).toUpperCase()+Qa.substring(1));Qa=La+" ("+Ya.length+")";var Ta=La=mxUtils.htmlEntities(La);15<La.length&&(La=La.substring(0,15)+"…");return{lbl:La+" ("+Ya.length+")",fullLbl:Qa,lblOnly:Ta}}function ia(Qa,Ya,La,Ta,Ua){mxEvent.addListener(La,"click",function(){X!=La&&(null!=X?(X.style.fontWeight="normal",X.style.textDecoration="none"):(xa.style.display="none",Fa.style.minHeight="100%"),X=La,X.style.fontWeight="bold",X.style.textDecoration="underline",
| 1
|
0,1
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
hfs_make_specialbase(TSK_FS_FILE * fs_file)
{
fs_file->meta->type = TSK_FS_META_TYPE_REG;
fs_file->meta->mode = 0;
fs_file->meta->nlink = 1;
fs_file->meta->flags =
(TSK_FS_META_FLAG_USED | TSK_FS_META_FLAG_ALLOC);
fs_file->meta->uid = fs_file->meta->gid = 0;
fs_file->meta->mtime = fs_file->meta->atime = fs_file->meta->ctime =
fs_file->meta->crtime = 0;
fs_file->meta->mtime_nano = fs_file->meta->atime_nano =
fs_file->meta->ctime_nano = fs_file->meta->crtime_nano = 0;
if (fs_file->meta->name2 == NULL) {
if ((fs_file->meta->name2 = (TSK_FS_META_NAME_LIST *)
tsk_malloc(sizeof(TSK_FS_META_NAME_LIST))) == NULL) {
error_returned
(" - hfs_make_specialbase, couldn't malloc space for a name list");
return 1;
}
fs_file->meta->name2->next = NULL;
}
if (fs_file->meta->attr != NULL) {
tsk_fs_attrlist_markunused(fs_file->meta->attr);
}
else {
fs_file->meta->attr = tsk_fs_attrlist_alloc();
}
return 0;
}
| 0
| null | -1
|
https://github.com/sleuthkit/sleuthkit/commit/8242588f4354339d9cb1ad82622e7c16c55391c9
| 0CCPP
|
module.exports = function(str, data) {
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(INTERPOLATE, function(match, code) {
return "'," + code.replace(/\\'/g, "'") + ",'"
})
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
+ "');}return __p.join('');"
var func = new Function('obj', tmpl)
return data ? func(data) : func
}
| 0
| null | -1
|
https://github.com/daaku/nodejs-tmpl/commit/4c654e4d1542f329ed561fd95ccd80f30c6872d6
| 3JavaScript
|
static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, mode_t openflags, struct nfs4_state **res)
{
struct nfs4_state *newstate;
int ret;
opendata->o_arg.open_flags = openflags;
memset(&opendata->o_res, 0, sizeof(opendata->o_res));
memset(&opendata->c_res, 0, sizeof(opendata->c_res));
nfs4_init_opendata_res(opendata);
ret = _nfs4_proc_open(opendata);
if (ret != 0)
return ret;
newstate = nfs4_opendata_to_nfs4_state(opendata);
if (IS_ERR(newstate))
return PTR_ERR(newstate);
nfs4_close_state(&opendata->path, newstate, openflags);
*res = newstate;
return 0;
}
| 1
|
0,4,14
| -1
|
https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
| 0CCPP
|
private String sanitizeTemplate(@Nullable String message) {
return escapeExpressions ? escapeMessageParameter(message) : message;
}
| 0
| null | -1
|
https://github.com/dropwizard/dropwizard/commit/d5a512f7abf965275f2a6b913ac4fe778e424242
| 2Java
|
static void __exit sock_diag_exit(void)
{
unregister_pernet_subsys(&diag_net_ops);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/6e601a53566d84e1ffd25e7b6fe0b6894ffd79c0
| 0CCPP
|
destroyUserInformationLists(DUL_USERINFO * userInfo)
{
PRV_SCUSCPROLE
* role;
role = (PRV_SCUSCPROLE*)LST_Dequeue(&userInfo->SCUSCPRoleList);
while (role != NULL) {
free(role);
role = (PRV_SCUSCPROLE*)LST_Dequeue(&userInfo->SCUSCPRoleList);
}
LST_Destroy(&userInfo->SCUSCPRoleList);
/* extended negotiation */
delete userInfo->extNegList; userInfo->extNegList = NULL;
/* user identity negotiation */
delete userInfo->usrIdent; userInfo->usrIdent = NULL;
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
| -1
|
https://github.com/DCMTK/dcmtk/commit/a9697dfeb672b0b9412c00c7d36d801e27ec85cb
| 0CCPP
|
void Compute(OpKernelContext* ctx) override {
const Tensor* hypothesis_indices;
const Tensor* hypothesis_values;
const Tensor* hypothesis_shape;
const Tensor* truth_indices;
const Tensor* truth_values;
const Tensor* truth_shape;
OP_REQUIRES_OK(ctx, ctx->input("hypothesis_indices", &hypothesis_indices));
OP_REQUIRES_OK(ctx, ctx->input("hypothesis_values", &hypothesis_values));
OP_REQUIRES_OK(ctx, ctx->input("hypothesis_shape", &hypothesis_shape));
OP_REQUIRES_OK(ctx, ctx->input("truth_indices", &truth_indices));
OP_REQUIRES_OK(ctx, ctx->input("truth_values", &truth_values));
OP_REQUIRES_OK(ctx, ctx->input("truth_shape", &truth_shape));
OP_REQUIRES_OK(
ctx, ValidateShapes(ctx, *hypothesis_indices, *hypothesis_values,
*hypothesis_shape, *truth_indices, *truth_values,
*truth_shape));
TensorShape hypothesis_st_shape;
OP_REQUIRES_OK(ctx,
TensorShapeUtils::MakeShape(
hypothesis_shape->vec<int64_t>().data(),
hypothesis_shape->NumElements(), &hypothesis_st_shape));
TensorShape truth_st_shape;
OP_REQUIRES_OK(ctx, TensorShapeUtils::MakeShape(
truth_shape->vec<int64_t>().data(),
truth_shape->NumElements(), &truth_st_shape));
std::vector<int64_t> sorted_order(truth_st_shape.dims());
std::iota(sorted_order.begin(), sorted_order.end(), 0);
sparse::SparseTensor hypothesis;
OP_REQUIRES_OK(ctx, sparse::SparseTensor::Create(
*hypothesis_indices, *hypothesis_values,
hypothesis_st_shape, sorted_order, &hypothesis));
sparse::SparseTensor truth;
OP_REQUIRES_OK(ctx, sparse::SparseTensor::Create(
*truth_indices, *truth_values, truth_st_shape,
sorted_order, &truth));
std::vector<int64_t> group_dims(truth_st_shape.dims() - 1);
std::iota(group_dims.begin(), group_dims.end(), 0);
TensorShape output_shape;
for (int d = 0; d < static_cast<int>(group_dims.size()); ++d) {
output_shape.AddDim(std::max(hypothesis_st_shape.dim_size(d),
truth_st_shape.dim_size(d)));
}
const auto output_elements = output_shape.num_elements();
OP_REQUIRES(
ctx, output_elements > 0,
errors::InvalidArgument("Got output shape ", output_shape.DebugString(),
" which has 0 elements"));
Tensor* output = nullptr;
OP_REQUIRES_OK(ctx, ctx->allocate_output("output", output_shape, &output));
auto output_t = output->flat<float>();
output_t.setZero();
std::vector<int64_t> output_strides(output_shape.dims());
output_strides[output_shape.dims() - 1] = 1;
for (int d = output_shape.dims() - 2; d >= 0; --d) {
output_strides[d] = output_strides[d + 1] * output_shape.dim_size(d + 1);
}
auto hypothesis_grouper = hypothesis.group(group_dims);
auto truth_grouper = truth.group(group_dims);
auto hypothesis_iter = hypothesis_grouper.begin();
auto truth_iter = truth_grouper.begin();
auto cmp = std::equal_to<T>();
while (hypothesis_iter != hypothesis_grouper.end() &&
truth_iter != truth_grouper.end()) {
sparse::Group truth_i = *truth_iter;
sparse::Group hypothesis_j = *hypothesis_iter;
std::vector<int64_t> g_truth = truth_i.group();
std::vector<int64_t> g_hypothesis = hypothesis_j.group();
auto truth_seq = truth_i.values<T>();
auto hypothesis_seq = hypothesis_j.values<T>();
if (g_truth == g_hypothesis) {
auto loc = std::inner_product(g_truth.begin(), g_truth.end(),
output_strides.begin(), int64_t{0});
OP_REQUIRES(
ctx, loc < output_elements,
errors::Internal("Got an inner product ", loc,
" which would require in writing to outside of "
"the buffer for the output tensor (max elements ",
output_elements, ")"));
output_t(loc) =
gtl::LevenshteinDistance<T>(truth_seq, hypothesis_seq, cmp);
if (normalize_) output_t(loc) /= truth_seq.size();
++hypothesis_iter;
++truth_iter;
} else if (g_truth > g_hypothesis) {
auto loc = std::inner_product(g_hypothesis.begin(), g_hypothesis.end(),
output_strides.begin(), int64_t{0});
OP_REQUIRES(
ctx, loc < output_elements,
errors::Internal("Got an inner product ", loc,
" which would require in writing to outside of "
"the buffer for the output tensor (max elements ",
output_elements, ")"));
output_t(loc) = hypothesis_seq.size();
if (normalize_ && output_t(loc) != 0.0f) {
output_t(loc) = std::numeric_limits<float>::infinity();
}
++hypothesis_iter;
} else {
auto loc = std::inner_product(g_truth.begin(), g_truth.end(),
output_strides.begin(), int64_t{0});
OP_REQUIRES(
ctx, loc < output_elements,
errors::Internal("Got an inner product ", loc,
" which would require in writing to outside of "
"the buffer for the output tensor (max elements ",
output_elements, ")"));
output_t(loc) = (normalize_) ? 1.0 : truth_seq.size();
++truth_iter;
}
}
while (hypothesis_iter != hypothesis_grouper.end()) {
sparse::Group hypothesis_j = *hypothesis_iter;
std::vector<int64_t> g_hypothesis = hypothesis_j.group();
auto hypothesis_seq = hypothesis_j.values<T>();
auto loc = std::inner_product(g_hypothesis.begin(), g_hypothesis.end(),
output_strides.begin(), int64_t{0});
OP_REQUIRES(
ctx, loc < output_elements,
errors::Internal("Got an inner product ", loc,
" which would require in writing to outside of the "
"buffer for the output tensor (max elements ",
output_elements, ")"));
output_t(loc) = hypothesis_seq.size();
if (normalize_ && output_t(loc) != 0.0f) {
output_t(loc) = std::numeric_limits<float>::infinity();
}
++hypothesis_iter;
}
while (truth_iter != truth_grouper.end()) {
sparse::Group truth_i = *truth_iter;
std::vector<int64_t> g_truth = truth_i.group();
auto truth_seq = truth_i.values<T>();
auto loc = std::inner_product(g_truth.begin(), g_truth.end(),
output_strides.begin(), int64_t{0});
OP_REQUIRES(
ctx, loc < output_elements,
errors::Internal("Got an inner product ", loc,
" which would require in writing to outside of the "
"buffer for the output tensor (max elements ",
output_elements, ")"));
output_t(loc) = (normalize_) ? 1.0 : truth_seq.size();
++truth_iter;
}
}
| 1
|
74,76,88,90,102,104,118,120,136,138
| -1
|
https://github.com/tensorflow/tensorflow/commit/30721cf564cb029d34535446d6a5a6357bebc8e7
| 0CCPP
|
int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
rtp_format_t *rtp_fmt )
{
assert( p_fmt != NULL || mux != NULL );
rtp_fmt->payload_type = 96;
rtp_fmt->cat = mux != NULL ? VIDEO_ES : p_fmt->i_cat;
if( rtp_fmt->cat == AUDIO_ES )
{
rtp_fmt->clock_rate = p_fmt->audio.i_rate;
rtp_fmt->channels = p_fmt->audio.i_channels;
}
else
rtp_fmt->clock_rate = 90000;
rtp_fmt->bitrate = p_fmt != NULL ? p_fmt->i_bitrate/1000 : 0;
rtp_fmt->fmtp = NULL;
if( mux != NULL )
{
if( strncmp( mux, "ts", 2 ) == 0 )
{
rtp_fmt->payload_type = 33;
rtp_fmt->ptname = "MP2T";
}
else
rtp_fmt->ptname = "MP2P";
return VLC_SUCCESS;
}
switch( p_fmt->i_codec )
{
case VLC_CODEC_MULAW:
if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 8000 )
rtp_fmt->payload_type = 0;
rtp_fmt->ptname = "PCMU";
rtp_fmt->pf_packetize = rtp_packetize_pcm;
break;
case VLC_CODEC_ALAW:
if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 8000 )
rtp_fmt->payload_type = 8;
rtp_fmt->ptname = "PCMA";
rtp_fmt->pf_packetize = rtp_packetize_pcm;
break;
case VLC_CODEC_S16B:
case VLC_CODEC_S16L:
if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 44100 )
{
rtp_fmt->payload_type = 11;
}
else if( p_fmt->audio.i_channels == 2 &&
p_fmt->audio.i_rate == 44100 )
{
rtp_fmt->payload_type = 10;
}
rtp_fmt->ptname = "L16";
if( p_fmt->i_codec == VLC_CODEC_S16B )
rtp_fmt->pf_packetize = rtp_packetize_pcm;
else
rtp_fmt->pf_packetize = rtp_packetize_swab;
break;
case VLC_CODEC_U8:
rtp_fmt->ptname = "L8";
rtp_fmt->pf_packetize = rtp_packetize_pcm;
break;
case VLC_CODEC_S24B:
rtp_fmt->ptname = "L24";
rtp_fmt->pf_packetize = rtp_packetize_pcm;
break;
case VLC_CODEC_MPGA:
rtp_fmt->payload_type = 14;
rtp_fmt->ptname = "MPA";
rtp_fmt->clock_rate = 90000;
rtp_fmt->pf_packetize = rtp_packetize_mpa;
break;
case VLC_CODEC_MPGV:
rtp_fmt->payload_type = 32;
rtp_fmt->ptname = "MPV";
rtp_fmt->pf_packetize = rtp_packetize_mpv;
break;
case VLC_CODEC_ADPCM_G726:
switch( p_fmt->i_bitrate / 1000 )
{
case 16:
rtp_fmt->ptname = "G726-16";
rtp_fmt->pf_packetize = rtp_packetize_g726_16;
break;
case 24:
rtp_fmt->ptname = "G726-24";
rtp_fmt->pf_packetize = rtp_packetize_g726_24;
break;
case 32:
rtp_fmt->ptname = "G726-32";
rtp_fmt->pf_packetize = rtp_packetize_g726_32;
break;
case 40:
rtp_fmt->ptname = "G726-40";
rtp_fmt->pf_packetize = rtp_packetize_g726_40;
break;
default:
msg_Err( obj, "cannot add this stream (unsupported "
"G.726 bit rate: %u)", p_fmt->i_bitrate );
return VLC_EGENERIC;
}
break;
case VLC_CODEC_A52:
rtp_fmt->ptname = "ac3";
rtp_fmt->pf_packetize = rtp_packetize_ac3;
break;
case VLC_CODEC_H263:
rtp_fmt->ptname = "H263-1998";
rtp_fmt->pf_packetize = rtp_packetize_h263;
break;
case VLC_CODEC_H264:
rtp_fmt->ptname = "H264";
rtp_fmt->pf_packetize = rtp_packetize_h264;
rtp_fmt->fmtp = NULL;
if( p_fmt->i_extra > 0 )
{
uint8_t *p_buffer = p_fmt->p_extra;
int i_buffer = p_fmt->i_extra;
char *p_64_sps = NULL;
char *p_64_pps = NULL;
char hexa[6+1];
while( i_buffer > 4 )
{
int i_offset = 0;
int i_size = 0;
while( p_buffer[0] != 0 || p_buffer[1] != 0 ||
p_buffer[2] != 1 )
{
p_buffer++;
i_buffer--;
if( i_buffer == 0 ) break;
}
if( i_buffer < 4 || memcmp(p_buffer, "\x00\x00\x01", 3 ) )
{
msg_Dbg( obj, "No startcode found..");
break;
}
p_buffer += 3;
i_buffer -= 3;
const int i_nal_type = p_buffer[0]&0x1f;
msg_Dbg( obj, "we found a startcode for NAL with TYPE:%d", i_nal_type );
i_size = i_buffer;
for( i_offset = 0; i_offset+2 < i_buffer ; i_offset++)
{
if( !memcmp(p_buffer + i_offset, "\x00\x00\x01", 3 ) )
{
while( i_offset > 0 && 0 == p_buffer[ i_offset - 1 ] )
i_offset--;
i_size = i_offset;
break;
}
}
if( i_size == 0 )
{
msg_Dbg( obj, "No-info found in nal ");
continue;
}
if( i_nal_type == 7 )
{
free( p_64_sps );
p_64_sps = vlc_b64_encode_binary( p_buffer, i_size );
sprintf_hexa( hexa, &p_buffer[1], 3 );
}
else if( i_nal_type == 8 )
{
free( p_64_pps );
p_64_pps = vlc_b64_encode_binary( p_buffer, i_size );
}
i_buffer -= i_size;
p_buffer += i_size;
}
if( p_64_sps && p_64_pps &&
( asprintf( &rtp_fmt->fmtp,
"packetization-mode=1;profile-level-id=%s;"
"sprop-parameter-sets=%s,%s;", hexa, p_64_sps,
p_64_pps ) == -1 ) )
rtp_fmt->fmtp = NULL;
free( p_64_sps );
free( p_64_pps );
}
if( rtp_fmt->fmtp == NULL )
rtp_fmt->fmtp = strdup( "packetization-mode=1" );
break;
case VLC_CODEC_MP4V:
{
rtp_fmt->ptname = "MP4V-ES";
rtp_fmt->pf_packetize = rtp_packetize_split;
if( p_fmt->i_extra > 0 )
{
char hexa[2*p_fmt->i_extra +1];
sprintf_hexa( hexa, p_fmt->p_extra, p_fmt->i_extra );
if( asprintf( &rtp_fmt->fmtp,
"profile-level-id=3; config=%s;", hexa ) == -1 )
rtp_fmt->fmtp = NULL;
}
break;
}
case VLC_CODEC_MP4A:
{
if( ! var_InheritBool( obj, "sout-rtp-mp4a-latm" ) )
{
char hexa[2*p_fmt->i_extra +1];
rtp_fmt->ptname = "mpeg4-generic";
rtp_fmt->pf_packetize = rtp_packetize_mp4a;
sprintf_hexa( hexa, p_fmt->p_extra, p_fmt->i_extra );
if( asprintf( &rtp_fmt->fmtp,
"streamtype=5; profile-level-id=15; "
"mode=AAC-hbr; config=%s; SizeLength=13; "
"IndexLength=3; IndexDeltaLength=3; Profile=1;",
hexa ) == -1 )
rtp_fmt->fmtp = NULL;
}
else
{
char hexa[13];
int i;
unsigned char config[6];
unsigned int aacsrates[15] = {
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000, 7350, 0, 0 };
for( i = 0; i < 15; i++ )
if( p_fmt->audio.i_rate == aacsrates[i] )
break;
config[0]=0x40;
config[1]=0;
config[2]=0x20|i;
config[3]=p_fmt->audio.i_channels<<4;
config[4]=0x3f;
config[5]=0xc0;
rtp_fmt->ptname = "MP4A-LATM";
rtp_fmt->pf_packetize = rtp_packetize_mp4a_latm;
sprintf_hexa( hexa, config, 6 );
if( asprintf( &rtp_fmt->fmtp, "profile-level-id=15; "
"object=2; cpresent=0; config=%s", hexa ) == -1 )
rtp_fmt->fmtp = NULL;
}
break;
}
case VLC_CODEC_AMR_NB:
rtp_fmt->ptname = "AMR";
rtp_fmt->fmtp = strdup( "octet-align=1" );
rtp_fmt->pf_packetize = rtp_packetize_amr;
break;
case VLC_CODEC_AMR_WB:
rtp_fmt->ptname = "AMR-WB";
rtp_fmt->fmtp = strdup( "octet-align=1" );
rtp_fmt->pf_packetize = rtp_packetize_amr;
break;
case VLC_CODEC_SPEEX:
rtp_fmt->ptname = "SPEEX";
rtp_fmt->pf_packetize = rtp_packetize_spx;
break;
case VLC_CODEC_VORBIS:
rtp_fmt->ptname = "vorbis";
rtp_fmt->pf_packetize = rtp_packetize_xiph;
if( p_fmt->i_extra > 0 )
{
rtp_fmt->fmtp = NULL;
char *config = rtp_xiph_b64_oob_config(p_fmt->p_extra,
p_fmt->i_extra, NULL);
if (config == NULL)
break;
if( asprintf( &rtp_fmt->fmtp,
"configuration=%s;", config ) == -1 )
rtp_fmt->fmtp = NULL;
free(config);
}
break;
case VLC_CODEC_THEORA:
rtp_fmt->ptname = "theora";
rtp_fmt->pf_packetize = rtp_packetize_xiph;
if( p_fmt->i_extra > 0 )
{
rtp_fmt->fmtp = NULL;
uint8_t pixel_fmt, c1, c2;
char *config = rtp_xiph_b64_oob_config(p_fmt->p_extra,
p_fmt->i_extra,
&pixel_fmt);
if (config == NULL)
break;
if (pixel_fmt == 1)
{
free(config);
break;
}
switch (pixel_fmt)
{
case 0:
c1 = 2;
c2 = 0;
break;
case 2:
c1 = c2 = 2;
break;
case 3:
c1 = c2 = 4;
break;
default:
assert(0);
}
if( asprintf( &rtp_fmt->fmtp,
"sampling=YCbCr-4:%d:%d; width=%d; height=%d; "
"delivery-method=inline; configuration=%s; "
"delivery-method=in_band;", c1, c2,
p_fmt->video.i_width, p_fmt->video.i_height,
config ) == -1 )
rtp_fmt->fmtp = NULL;
free(config);
}
break;
case VLC_CODEC_ITU_T140:
rtp_fmt->ptname = "t140" ;
rtp_fmt->clock_rate = 1000;
rtp_fmt->pf_packetize = rtp_packetize_t140;
break;
case VLC_CODEC_GSM:
rtp_fmt->payload_type = 3;
rtp_fmt->ptname = "GSM";
rtp_fmt->pf_packetize = rtp_packetize_split;
break;
case VLC_CODEC_OPUS:
if (p_fmt->audio.i_channels > 2)
{
msg_Err( obj, "Multistream opus not supported in RTP"
" (having %d channels input)",
p_fmt->audio.i_channels );
return VLC_EGENERIC;
}
rtp_fmt->ptname = "opus";
rtp_fmt->pf_packetize = rtp_packetize_simple;
rtp_fmt->clock_rate = 48000;
rtp_fmt->channels = 2;
if (p_fmt->audio.i_channels == 2)
rtp_fmt->fmtp = strdup( "sprop-stereo=1" );
break;
case VLC_CODEC_VP8:
rtp_fmt->ptname = "VP8";
rtp_fmt->pf_packetize = rtp_packetize_vp8;
break;
case VLC_CODEC_MJPG:
case VLC_CODEC_JPEG:
rtp_fmt->ptname = "JPEG";
rtp_fmt->payload_type = 26;
rtp_fmt->pf_packetize = rtp_packetize_jpeg;
break;
default:
msg_Err( obj, "cannot add this stream (unsupported "
"codec: %4.4s)", (char*)&p_fmt->i_codec );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
| 0
| null | -1
|
https://github.com/videolan/vlc/commit/204291467724867b79735c0ee3aeb0dbc2200f97
| 0CCPP
|
public Argument<Publisher> argumentType() {
return Argument.of(Publisher.class);
}
| 1
|
1
| -1
|
https://github.com/micronaut-projects/micronaut-core/commit/b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3
| 2Java
|
public static string UnicodeUtf8(this string strFrom)
{
var bytSrc = Encoding.Unicode.GetBytes(strFrom);
var bytDestination = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, bytSrc);
var strTo = Encoding.UTF8.GetString(bytDestination);
return strTo;
}
| 1
|
0,1,2,3,4,5,6
| -1
|
https://github.com/Ulterius/server/commit/770d1821de43cf1d0a93c79025995bdd812a76ee
| 1CS
|
end_element(void *user_data, const char *name)
{
rdfalist* context_stack = (rdfalist*)user_data;
rdfacontext* context = (rdfacontext*)rdfa_pop_item(context_stack);
rdfacontext* parent_context = (rdfacontext*)
context_stack->items[context_stack->num_items - 1]->data;
char* buffer = (char*)malloc(strlen(name) + 4);
if(DEBUG)
{
printf("DEBUG: </%s>\n", name);
}
sprintf(buffer, "</%s>", name);
if(context->xml_literal == NULL)
{
context->xml_literal =
rdfa_replace_string(context->xml_literal, buffer);
context->xml_literal_size = strlen(buffer);
}
else
{
context->xml_literal = rdfa_n_append_string(
context->xml_literal, &context->xml_literal_size,
buffer, strlen(buffer));
}
free(buffer);
if(context->property != NULL)
{
char* saved_xml_literal = context->xml_literal;
char* content_start = NULL;
char* content_end = NULL;
buffer = NULL;
if(context->xml_literal != NULL)
{
content_start = strchr(context->xml_literal, '>');
content_end = strrchr(context->xml_literal, '<');
if((content_start != NULL) && (content_end != NULL))
{
context->xml_literal = ++content_start;
*content_end = '\0';
}
}
if(strlen(context->xml_literal) == 0)
{
context->plain_literal =
rdfa_replace_string(context->plain_literal, "");
}
rdfa_complete_object_literal_triples(context);
if(content_end != NULL)
{
*content_end = '<';
}
if(saved_xml_literal != NULL)
{
context->xml_literal = saved_xml_literal;
}
}
if(context->xml_literal != NULL)
{
if(parent_context->xml_literal == NULL)
{
parent_context->xml_literal =
rdfa_replace_string(
parent_context->xml_literal, context->xml_literal);
parent_context->xml_literal_size = context->xml_literal_size;
}
else
{
parent_context->xml_literal =
rdfa_n_append_string(
parent_context->xml_literal, &parent_context->xml_literal_size,
context->xml_literal, context->xml_literal_size);
}
if(context->plain_literal != NULL)
{
if(parent_context->plain_literal == NULL)
{
parent_context->plain_literal =
rdfa_replace_string(
parent_context->plain_literal, context->plain_literal);
parent_context->plain_literal_size = context->plain_literal_size;
}
else
{
parent_context->plain_literal =
rdfa_n_append_string(
parent_context->plain_literal,
&parent_context->plain_literal_size,
context->plain_literal,
context->plain_literal_size);
}
}
}
parent_context->bnode_count = context->bnode_count;
parent_context->underscore_colon_bnode_name = \
rdfa_replace_string(parent_context->underscore_colon_bnode_name,
context->underscore_colon_bnode_name);
if((context->skip_element == 0) && (context->new_subject != NULL))
{
rdfa_complete_incomplete_triples(context);
}
rdfa_free_context(context);
}
| 0
| null | -1
|
https://github.com/dajobe/raptor/commit/a676f235309a59d4aa78eeffd2574ae5d341fcb0
| 0CCPP
|
char *create_output_name(char *fname) {
char *out, *p;
if ((out = malloc(strlen(fname) + 1))) {
while (*fname == '/' || *fname == '\\') fname++;
strcpy(out, (*fname) ? fname : "x");
for (p = out; *p; p++) {
if (p[0] == '.' && p[1] == '.' && (p[2] == '/' || p[2] == '\\')) {
p[0] = p[1] = 'x';
}
}
}
return out;
}
| 0
| null | -1
|
https://github.com/kyz/libmspack/commit/7cadd489698be117c47efcadd742651594429e6d
| 0CCPP
|
void crypto_remove_final(struct list_head *list)
{
struct crypto_alg *alg;
struct crypto_alg *n;
list_for_each_entry_safe(alg, n, list, cra_list) {
list_del_init(&alg->cra_list);
crypto_alg_put(alg);
}
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/4943ba16bbc2db05115707b3ff7b4874e9e3c560
| 0CCPP
|
handler: function ({log, command} = {}) {
this.connector = new ActiveConnector(this);
const rawConnection = _.get(command, 'arg', '').split(',');
if (rawConnection.length !== 6) return this.reply(425);
const ip = rawConnection.slice(0, 4).join('.');
const portBytes = rawConnection.slice(4).map((p) => parseInt(p));
const port = portBytes[0] * 256 + portBytes[1];
return this.connector.setupConnection(ip, port)
.then(() => this.reply(200))
.catch((err) => {
log.error(err);
return this.reply(425);
});
},
| 1
|
11
| -1
|
https://github.com/QuorumDMS/ftp-srv/commit/e449e75219d918c400dec65b4b0759f60476abca
| 3JavaScript
|
static gboolean key_press_event(GtkWidget *text_view, GdkEventKey *event)
{
GtkTextIter iter;
GtkTextBuffer *buffer;
switch (event->keyval)
{
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_iter_at_mark(buffer, &iter,
gtk_text_buffer_get_insert(buffer));
open_browse_if_link(text_view, &iter);
break;
default:
break;
}
return FALSE;
}
| 0
| null | -1
|
https://github.com/abrt/libreport/commit/257578a23d1537a2d235aaa2b1488ee4f818e360
| 0CCPP
|
static int inet_netconf_get_devconf(struct sk_buff *in_skb,
struct nlmsghdr *nlh)
{
struct net *net = sock_net(in_skb->sk);
struct nlattr *tb[NETCONFA_MAX+1];
struct netconfmsg *ncm;
struct sk_buff *skb;
struct ipv4_devconf *devconf;
struct in_device *in_dev;
struct net_device *dev;
int ifindex;
int err;
err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX,
devconf_ipv4_policy);
if (err < 0)
goto errout;
err = -EINVAL;
if (!tb[NETCONFA_IFINDEX])
goto errout;
ifindex = nla_get_s32(tb[NETCONFA_IFINDEX]);
switch (ifindex) {
case NETCONFA_IFINDEX_ALL:
devconf = net->ipv4.devconf_all;
break;
case NETCONFA_IFINDEX_DEFAULT:
devconf = net->ipv4.devconf_dflt;
break;
default:
dev = __dev_get_by_index(net, ifindex);
if (!dev)
goto errout;
in_dev = __in_dev_get_rtnl(dev);
if (!in_dev)
goto errout;
devconf = &in_dev->cnf;
break;
}
err = -ENOBUFS;
skb = nlmsg_new(inet_netconf_msgsize_devconf(NETCONFA_ALL), GFP_ATOMIC);
if (!skb)
goto errout;
err = inet_netconf_fill_devconf(skb, ifindex, devconf,
NETLINK_CB(in_skb).portid,
nlh->nlmsg_seq, RTM_NEWNETCONF, 0,
NETCONFA_ALL);
if (err < 0) {
WARN_ON(err == -EMSGSIZE);
kfree_skb(skb);
goto errout;
}
err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
errout:
return err;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/fbd40ea0180a2d328c5adc61414dc8bab9335ce2
| 0CCPP
|
static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12)
{
int msr;
struct page *page;
unsigned long *msr_bitmap_l1;
unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.msr_bitmap;
if (!nested_cpu_has_virt_x2apic_mode(vmcs12))
return false;
page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->msr_bitmap);
if (is_error_page(page))
return false;
msr_bitmap_l1 = (unsigned long *)kmap(page);
memset(msr_bitmap_l0, 0xff, PAGE_SIZE);
if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {
if (nested_cpu_has_apic_reg_virt(vmcs12))
for (msr = 0x800; msr <= 0x8ff; msr++)
nested_vmx_disable_intercept_for_msr(
msr_bitmap_l1, msr_bitmap_l0,
msr, MSR_TYPE_R);
nested_vmx_disable_intercept_for_msr(
msr_bitmap_l1, msr_bitmap_l0,
APIC_BASE_MSR + (APIC_TASKPRI >> 4),
MSR_TYPE_R | MSR_TYPE_W);
if (nested_cpu_has_vid(vmcs12)) {
nested_vmx_disable_intercept_for_msr(
msr_bitmap_l1, msr_bitmap_l0,
APIC_BASE_MSR + (APIC_EOI >> 4),
MSR_TYPE_W);
nested_vmx_disable_intercept_for_msr(
msr_bitmap_l1, msr_bitmap_l0,
APIC_BASE_MSR + (APIC_SELF_IPI >> 4),
MSR_TYPE_W);
}
}
kunmap(page);
kvm_release_page_clean(page);
return true;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/51aa68e7d57e3217192d88ce90fd5b8ef29ec94f
| 0CCPP
|
static int set_did(struct btd_adapter *adapter, uint16_t vendor,
uint16_t product, uint16_t version, uint16_t source)
{
struct mgmt_cp_set_device_id cp;
DBG("hci%u source %x vendor %x product %x version %x",
adapter->dev_id, source, vendor, product, version);
memset(&cp, 0, sizeof(cp));
cp.source = htobs(source);
cp.vendor = htobs(vendor);
cp.product = htobs(product);
cp.version = htobs(version);
if (mgmt_send(adapter->mgmt, MGMT_OP_SET_DEVICE_ID,
adapter->dev_id, sizeof(cp), &cp,
NULL, NULL, NULL) > 0)
return 0;
return -EIO;
}
| 0
| null | -1
|
https://github.com/bluez/bluez/commit/b497b5942a8beb8f89ca1c359c54ad67ec843055
| 0CCPP
|
}function oe(e, t) {
re(e), ie(e, t);
}function ne(e) {
| 0
| null | -1
|
https://github.com/TogaTech/tEnvoy/commit/a121b34a45e289d775c62e58841522891dee686b
| 3JavaScript
|
static int pipe_do_remove(struct sock *sk)
{
struct pep_sock *pn = pep_sk(sk);
struct pnpipehdr *ph;
struct sk_buff *skb;
skb = pep_alloc_skb(sk, NULL, 0, GFP_KERNEL);
if (!skb)
return -ENOMEM;
ph = pnp_hdr(skb);
ph->utid = 0;
ph->message_id = PNS_PIPE_REMOVE_REQ;
ph->pipe_handle = pn->pipe_handle;
ph->data0 = PAD;
return pn_skb_send(sk, skb, NULL);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/bcd0f93353326954817a4f9fa55ec57fb38acbb0
| 0CCPP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.