processed_func string | target int64 | flaw_line string | flaw_line_index int64 | commit_url string | language class label |
|---|---|---|---|---|---|
static inline void last_modified(TSRMLS_D)
{
const char *path;
struct stat sb;
char buf[MAX_STR + 1];
path = SG(request_info).path_translated;
if (path) {
if (VCWD_STAT(path, &sb) == -1) {
return;
}
#define LAST_MODIFIED "Last-Modified: "
memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
ADD_HEADER(buf);
}
} | 0 | null | -1 | https://github.com/php/php-src/commit/8763c6090d627d8bb0ee1d030c30e58f406be9ce | 0CCPP |
function moveHandler(evt)
{
if (start != null)
{
var pt = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt));
onChange(Math.max(0, initial + ((horizontal) ? (pt.x - start.x) : (start.y - pt.y)) - dx));
mxEvent.consume(evt);
if (initial != getValue())
{
ignoreClick = true;
last = null;
}
}
}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
def prepare_context(self, request, context, *args, **kwargs):
pass
| 1 | 1 | -1 | https://github.com/ome/omero-web.git/commit/952f8e5d28532fbb14fb665982211329d137908c | 4Python |
title : this.i18n(opts.title || 'confirmReq'),
buttons : {},
close : function() {
!complete && opts.cancel.callback();
$(this).elfinderdialog('destroy');
}
},
apply = this.i18n('apllyAll'),
label, checkbox;
if (opts.reject) {
options.buttons[this.i18n(opts.reject.label)] = function() {
opts.reject.callback(!!(checkbox && checkbox.prop('checked')))
complete = true;
$(this).elfinderdialog('close')
};
}
options.buttons[this.i18n(opts.accept.label)] = function() {
opts.accept.callback(!!(checkbox && checkbox.prop('checked')))
complete = true;
$(this).elfinderdialog('close')
};
options.buttons[this.i18n(opts.cancel.label)] = function() {
$(this).elfinderdialog('close')
};
if (opts.all) {
if (opts.reject) {
options.width = 370;
}
options.create = function() {
checkbox = $('<input type="checkbox" />');
$(this).next().children().before($('<label>'+apply+'</label>').prepend(checkbox));
}
options.open = function() {
var pane = $(this).next(),
width = parseInt(pane.children(':first').outerWidth() + pane.children(':last').outerWidth());
if (width > parseInt(pane.width())) {
$(this).closest('.elfinder-dialog').width(width+30);
}
}
}
return this.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-confirm"/>' + this.i18n(opts.text), options);
}, | 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 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
Status ModelWeights::Initialize(OpKernelContext* const context) {
OpInputList sparse_indices_inputs;
TF_RETURN_IF_ERROR(
context->input_list("sparse_indices", &sparse_indices_inputs));
OpInputList sparse_weights_inputs;
TF_RETURN_IF_ERROR(
context->input_list("sparse_weights", &sparse_weights_inputs));
OpInputList dense_weights_inputs;
TF_RETURN_IF_ERROR(
context->input_list("dense_weights", &dense_weights_inputs));
OpOutputList sparse_weights_outputs;
TF_RETURN_IF_ERROR(context->output_list("out_delta_sparse_weights",
&sparse_weights_outputs));
OpOutputList dense_weights_outputs;
TF_RETURN_IF_ERROR(
context->output_list("out_delta_dense_weights", &dense_weights_outputs));
for (int i = 0; i < sparse_weights_inputs.size(); ++i) {
Tensor* delta_t;
TF_RETURN_IF_ERROR(sparse_weights_outputs.allocate(
i, sparse_weights_inputs[i].shape(), &delta_t));
auto deltas = delta_t->shaped<float, 2>({1, delta_t->NumElements()});
deltas.setZero();
sparse_weights_.emplace_back(FeatureWeightsSparseStorage{
sparse_indices_inputs[i].flat<int64>(),
sparse_weights_inputs[i].shaped<float, 2>(
{1, sparse_weights_inputs[i].NumElements()}),
deltas});
}
const auto initialize_weights =
[&](const OpInputList& weight_inputs, OpOutputList* const weight_outputs,
std::vector<FeatureWeightsDenseStorage>* const feature_weights) {
for (int i = 0; i < weight_inputs.size(); ++i) {
Tensor* delta_t;
TF_RETURN_IF_ERROR(
weight_outputs->allocate(i, weight_inputs[i].shape(), &delta_t));
auto deltas = delta_t->shaped<float, 2>({1, delta_t->NumElements()});
deltas.setZero();
feature_weights->emplace_back(FeatureWeightsDenseStorage{
weight_inputs[i].shaped<float, 2>(
{1, weight_inputs[i].NumElements()}),
deltas});
}
return Status::OK();
};
return initialize_weights(dense_weights_inputs, &dense_weights_outputs,
&dense_weights_);
} | 1 | null | -1 | https://github.com/tensorflow/tensorflow/commit/f7cc8755ac6683131fdfa7a8a121f9d7a9dec6fb | 0CCPP |
static void oz_display_conf_type(u8 t)
{
switch (t) {
case USB_REQ_GET_STATUS:
oz_dbg(ON, "USB_REQ_GET_STATUS - cnf\n");
break;
case USB_REQ_CLEAR_FEATURE:
oz_dbg(ON, "USB_REQ_CLEAR_FEATURE - cnf\n");
break;
case USB_REQ_SET_FEATURE:
oz_dbg(ON, "USB_REQ_SET_FEATURE - cnf\n");
break;
case USB_REQ_SET_ADDRESS:
oz_dbg(ON, "USB_REQ_SET_ADDRESS - cnf\n");
break;
case USB_REQ_GET_DESCRIPTOR:
oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n");
break;
case USB_REQ_SET_DESCRIPTOR:
oz_dbg(ON, "USB_REQ_SET_DESCRIPTOR - cnf\n");
break;
case USB_REQ_GET_CONFIGURATION:
oz_dbg(ON, "USB_REQ_GET_CONFIGURATION - cnf\n");
break;
case USB_REQ_SET_CONFIGURATION:
oz_dbg(ON, "USB_REQ_SET_CONFIGURATION - cnf\n");
break;
case USB_REQ_GET_INTERFACE:
oz_dbg(ON, "USB_REQ_GET_INTERFACE - cnf\n");
break;
case USB_REQ_SET_INTERFACE:
oz_dbg(ON, "USB_REQ_SET_INTERFACE - cnf\n");
break;
case USB_REQ_SYNCH_FRAME:
oz_dbg(ON, "USB_REQ_SYNCH_FRAME - cnf\n");
break;
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/b1bb5b49373b61bf9d2c73a4d30058ba6f069e4c | 0CCPP |
sixel_dither_new(
sixel_dither_t **ppdither, /* dither
int ncolors, /* requi
sixel_allocator_t *allocator) /* alloc
{
SIXELSTATUS status = SIXEL_FALSE;
size_t headsize;
size_t datasize;
size_t wholesize;
int quality_mode;
if (ppdither == NULL) {
sixel_helper_set_additional_message(
"sixel_dither_new: ppdither is null.");
status = SIXEL_BAD_ARGUMENT;
goto end;
}
if (allocator == NULL) {
status = sixel_allocator_new(&allocator, NULL, NULL, NULL, NULL);
if (SIXEL_FAILED(status)) {
*ppdither = NULL;
goto end;
}
} else {
sixel_allocator_ref(allocator);
}
if (ncolors < 0) {
ncolors = 256;
quality_mode = SIXEL_QUALITY_HIGHCOLOR;
} else {
if (ncolors > SIXEL_PALETTE_MAX) {
ncolors = 256;
} else if (ncolors < 2) {
ncolors = 2;
}
quality_mode = SIXEL_QUALITY_LOW;
}
headsize = sizeof(sixel_dither_t);
datasize = (size_t)(ncolors * 3);
wholesize = headsize + datasize;
*ppdither = (sixel_dither_t *)sixel_allocator_malloc(allocator, wholesize);
if (*ppdither == NULL) {
sixel_allocator_unref(allocator);
sixel_helper_set_additional_message(
"sixel_dither_new: sixel_allocator_malloc() failed.");
status = SIXEL_BAD_ALLOCATION;
goto end;
}
(*ppdither)->ref = 1;
(*ppdither)->palette = (unsigned char*)(*ppdither + 1);
(*ppdither)->cachetable = NULL;
(*ppdither)->reqcolors = ncolors;
(*ppdither)->ncolors = ncolors;
(*ppdither)->origcolors = (-1);
(*ppdither)->keycolor = (-1);
(*ppdither)->optimized = 0;
(*ppdither)->optimize_palette = 0;
(*ppdither)->complexion = 1;
(*ppdither)->bodyonly = 0;
(*ppdither)->method_for_largest = SIXEL_LARGE_NORM;
(*ppdither)->method_for_rep = SIXEL_REP_CENTER_BOX;
(*ppdither)->method_for_diffuse = SIXEL_DIFFUSE_FS;
(*ppdither)->quality_mode = quality_mode;
(*ppdither)->pixelformat = SIXEL_PIXELFORMAT_RGB888;
(*ppdither)->allocator = allocator;
status = SIXEL_OK;
end:
return status;
} | 1 | 31,32 | -1 | https://github.com/saitoha/libsixel/commit/cb373ab6614c910407c5e5a93ab935144e62b037 | 0CCPP |
juniper_pppoe_atm_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
uint16_t extracted_ethertype;
l2info.pictype = DLT_JUNIPER_PPPOE_ATM;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
extracted_ethertype = EXTRACT_16BITS(p);
if (ethertype_print(ndo, extracted_ethertype,
p+ETHERTYPE_LEN,
l2info.length-ETHERTYPE_LEN,
l2info.caplen-ETHERTYPE_LEN,
NULL, NULL) == 0)
ND_PRINT((ndo, "unknown ethertype 0x%04x", extracted_ethertype));
return l2info.header_len;
} | 1 | null | -1 | https://github.com/the-tcpdump-group/tcpdump/commit/b534e304568585707c4a92422aeca25cf908ff02 | 0CCPP |
static inline bool nested_exit_on_init(struct vcpu_svm *svm)
{
return vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_INIT);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/c7dfa4009965a9b2d7b329ee970eb8da0d32f0bc | 0CCPP |
private static void HandleDisconnect(WebSocket clientSocket)
{
var connectionId = CookieManager.GetConnectionId(clientSocket);
AuthClient temp = null;
if (AllClients.TryRemove(connectionId, out temp))
{
Console.WriteLine("Disconnection from " + clientSocket.RemoteEndpoint);
var userCount = AllClients.Count;
var extra = userCount < 1 ? "s" : string.Empty;
UlteriusTray.ShowMessage($"There are now {userCount} user{extra} connected.", "A user disconnected!");
}
} | 1 | 0,1,2,3,4,5,6,7,8,9,10,11 | -1 | https://github.com/Ulterius/server/commit/770d1821de43cf1d0a93c79025995bdd812a76ee | 1CS |
function(){b.hideDialog(!0)});l.className="geBtn";c=null!=c?mxUtils.button(mxResources.get("ignore"),c):null;null!=c&&(c.className="geBtn");b.editor.cancelFirst?(x.appendChild(l),null!=c&&x.appendChild(c),x.appendChild(D),x.appendChild(t)):(x.appendChild(t),x.appendChild(D),null!=c&&x.appendChild(c),x.appendChild(l));g.appendChild(x);g.appendChild(A);this.container=g},FindWindow=function(b,f,l,d,u,t){function D(V,X,p,C){if("object"===typeof X.value&&null!=X.value.attributes){X=X.value.attributes;
for(var I=0;I<X.length;I++)if("label"!=X[I].nodeName){var T=mxUtils.trim(X[I].nodeValue.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")).toLowerCase();if(null==V&&(C&&0<=T.indexOf(p)||!C&&T.substring(0,p.length)===p)||null!=V&&V.test(T))return!0}}return!1}function c(){v&&K.value?(S.removeAttribute("disabled"),U.removeAttribute("disabled")):(S.setAttribute("disabled","disabled"),U.setAttribute("disabled","disabled"));K.value&&y.value?Q.removeAttribute("disabled"):Q.setAttribute("disabled","disabled")}function e(V, | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
void pdf_get_version(FILE *fp, pdf_t *pdf)
{
char *header, *c;
header = get_header(fp);
/* Locate version string start and make sure we dont go past header */
if ((c = strstr(header, "%PDF-")) &&
(c + strlen("%PDF-M.m") + 2))
{
pdf->pdf_major_version = atoi(c + strlen("%PDF-"));
pdf->pdf_minor_version = atoi(c + strlen("%PDF-M."));
}
free(header);
} | 1 | 2,3,4,6 | -1 | https://github.com/enferex/pdfresurrect/commit/1b422459f07353adce2878806d5247d9e91fb397 | 0CCPP |
static void add_event_to_ctx(struct perf_event *event,
struct perf_event_context *ctx)
{
u64 tstamp = perf_event_time(event);
list_add_event(event, ctx);
perf_group_attach(event);
event->tstamp_enabled = tstamp;
event->tstamp_running = tstamp;
event->tstamp_stopped = tstamp;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/12ca6ad2e3a896256f086497a7c7406a547ee373 | 0CCPP |
crypto_retrieve_X509_key_usage(krb5_context context,
pkinit_plg_crypto_context plgcctx,
pkinit_req_crypto_context reqcctx,
X509 *x,
unsigned int *ret_ku_bits,
unsigned int *ret_eku_bits)
{
krb5_error_code retval = 0;
int i;
unsigned int eku_bits = 0, ku_bits = 0;
ASN1_BIT_STRING *usage = NULL;
if (ret_ku_bits == NULL && ret_eku_bits == NULL)
return EINVAL;
if (ret_eku_bits)
*ret_eku_bits = 0;
else {
pkiDebug("%s: EKUs not requested, not checking\n", __FUNCTION__);
goto check_kus;
}
i = X509_get_ext_by_NID(x, NID_ext_key_usage, -1);
if (i >= 0) {
EXTENDED_KEY_USAGE *eku;
eku = X509_get_ext_d2i(x, NID_ext_key_usage, NULL, NULL);
if (eku) {
for (i = 0; i < sk_ASN1_OBJECT_num(eku); i++) {
ASN1_OBJECT *certoid;
certoid = sk_ASN1_OBJECT_value(eku, i);
if ((OBJ_cmp(certoid, plgcctx->id_pkinit_KPClientAuth)) == 0)
eku_bits |= PKINIT_EKU_PKINIT;
else if ((OBJ_cmp(certoid, OBJ_nid2obj(NID_ms_smartcard_login))) == 0)
eku_bits |= PKINIT_EKU_MSSCLOGIN;
else if ((OBJ_cmp(certoid, OBJ_nid2obj(NID_client_auth))) == 0)
eku_bits |= PKINIT_EKU_CLIENTAUTH;
else if ((OBJ_cmp(certoid, OBJ_nid2obj(NID_email_protect))) == 0)
eku_bits |= PKINIT_EKU_EMAILPROTECTION;
}
EXTENDED_KEY_USAGE_free(eku);
}
}
pkiDebug("%s: returning eku 0x%08x\n", __FUNCTION__, eku_bits);
*ret_eku_bits = eku_bits;
check_kus:
if (ret_ku_bits)
*ret_ku_bits = 0;
else {
pkiDebug("%s: KUs not requested, not checking\n", __FUNCTION__);
goto out;
}
X509_check_ca(x);
usage = X509_get_ext_d2i(x, NID_key_usage, NULL, NULL);
if (usage) {
if (!ku_reject(x, X509v3_KU_DIGITAL_SIGNATURE))
ku_bits |= PKINIT_KU_DIGITALSIGNATURE;
if (!ku_reject(x, X509v3_KU_KEY_ENCIPHERMENT))
ku_bits |= PKINIT_KU_KEYENCIPHERMENT;
ASN1_BIT_STRING_free(usage);
}
pkiDebug("%s: returning ku 0x%08x\n", __FUNCTION__, ku_bits);
*ret_ku_bits = ku_bits;
retval = 0;
out:
return retval;
} | 0 | null | -1 | https://github.com/krb5/krb5/commit/fbb687db1088ddd894d975996e5f6a4252b9a2b4 | 0CCPP |
ifDefined: function(id, defaultValue) {
return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
}, | 1 | 0,1,2 | -1 | https://github.com/peerigon/angular-expressions/commit/061addfb9a9e932a970e5fcb913d020038e65667 | 3JavaScript |
InstanceFeatureDimKey() : instance(-1), feature_dim(-1) {} | 0 | null | -1 | https://github.com/tensorflow/tensorflow/commit/5c8c9a8bfe750f9743d0c859bae112060b216f5c | 0CCPP |
SFTPWrapper.prototype.fastGet = function(remotePath, localPath, opts, cb) {
return this._stream.fastGet(remotePath, localPath, opts, cb);
}; | 1 | 0,1,2 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry)
{
spin_lock(&dentry->d_lock);
if (unlikely(dname_external(dentry))) {
struct external_name *p = external_name(dentry);
atomic_inc(&p->u.count);
spin_unlock(&dentry->d_lock);
name->name = p->name;
} else {
memcpy(name->inline_name, dentry->d_iname, DNAME_INLINE_LEN);
spin_unlock(&dentry->d_lock);
name->name = name->inline_name;
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/49d31c2f389acfe83417083e1208422b4091cd9e | 0CCPP |
static inline ut64 dwarf_read_address(size_t size, bool big_endian, const ut8 **buf, const ut8 *buf_end) {
ut64 result;
switch (size) {
case 2:
result = READ16(*buf);
break;
case 4:
result = READ32(*buf);
break;
case 8:
result = READ64(*buf);
break;
default:
result = 0;
*buf += size;
eprintf("Weird dwarf address size: %zu.", size);
}
return result;
} | 0 | null | -1 | https://github.com/rizinorg/rizin/commit/aa6917772d2f32e5a7daab25a46c72df0b5ea406 | 0CCPP |
def reinit(self):
for i in range(2):
block = self._osrng.read(32 * 32)
for p in range(32):
self._osrng_es.feed(block[p * 32 : (p + 1) * 32])
block = None
self._osrng.flush()
| 1 | null | -1 | https://github.com/pycrypto/pycrypto.git/commit/19dcf7b15d61b7dc1a125a367151de40df6ef175 | 4Python |
static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
{
unsigned long i;
for (i = 0; i < npages; ++i)
kvm_release_pfn_clean(pfn + i);
} | 1 | 0,1,2,3,4,5 | -1 | https://github.com/torvalds/linux/commit/350b8bdd689cd2ab2c67c8a86a0be86cfa0751a7 | 0CCPP |
def _parse_cache_control(headers):
retval = {}
if "cache-control" in headers:
parts = headers["cache-control"].split(",")
parts_with_args = [
tuple([x.strip().lower() for x in part.split("=", 1)])
for part in parts
if -1 != part.find("=")
]
parts_wo_args = [
(name.strip().lower(), 1)
for name in parts
if -1 == name.find("=")
]
retval = dict(parts_with_args + parts_wo_args)
return retval
| 1 | 5,6,7,8,9,12 | -1 | https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc | 4Python |
TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
const TfLiteConvParams* params, int width,
int height, int filter_width, int filter_height,
int out_width, int out_height,
const TfLiteType data_type, OpData* data) {
bool has_bias = node->inputs->size == 3;
TF_LITE_ENSURE(context, has_bias || node->inputs->size == 2);
TF_LITE_ENSURE_EQ(context, node->outputs->size, 1);
auto padding = params->padding;
data->padding = ComputePaddingHeightWidth(
params->stride_height, params->stride_width,
params->dilation_height_factor, params->dilation_width_factor, height,
width, filter_height, filter_width, padding, &out_height, &out_width);
if (data_type != kTfLiteFloat32) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* filter = GetInput(context, node, kFilterTensor);
const TfLiteTensor* bias =
GetOptionalInputTensor(context, node, kBiasTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
int output_channels = filter->dims->data[kConvQuantizedDimension];
TF_LITE_ENSURE_STATUS(tflite::PopulateConvolutionQuantizationParams(
context, input, filter, bias, output, params->activation,
&data->output_multiplier, &data->output_shift,
&data->output_activation_min, &data->output_activation_max,
data->per_channel_output_multiplier,
reinterpret_cast<int*>(data->per_channel_output_shift),
output_channels));
}
return kTfLiteOk;
} | 1 | null | -1 | https://github.com/tensorflow/tensorflow/commit/fff2c8326280c07733828f990548979bdc893859 | 0CCPP |
box_poly(PG_FUNCTION_ARGS)
{
BOX *box = PG_GETARG_BOX_P(0);
POLYGON *poly;
int size;
size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * 4;
poly = (POLYGON *) palloc(size);
SET_VARSIZE(poly, size);
poly->npts = 4;
poly->p[0].x = box->low.x;
poly->p[0].y = box->low.y;
poly->p[1].x = box->low.x;
poly->p[1].y = box->high.y;
poly->p[2].x = box->high.x;
poly->p[2].y = box->high.y;
poly->p[3].x = box->high.x;
poly->p[3].y = box->low.y;
box_fill(&poly->boundbox, box->high.x, box->low.x,
box->high.y, box->low.y);
PG_RETURN_POLYGON_P(poly);
} | 0 | null | -1 | https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a | 0CCPP |
void AnnotateBenignRace(const char *file, int line,
const volatile void *mem,
const char *description){} | 1 | 0,1,2 | -1 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 0CCPP |
def host(self, value):
self._dns_host = value
| 0 | null | -1 | https://github.com/urllib3/urllib3.git/commit/1dd69c5c5982fae7c87a620d487c2ebf7a6b436b | 4Python |
private static AsciiString normalizeName(CharSequence name) {
checkArgument(requireNonNull(name, "name").length() > 0, "name is empty.");
return HttpHeaderNames.of(name);
} | 1 | 0,1,2,3 | -1 | https://github.com/line/armeria/commit/b597f7a865a527a84ee3d6937075cfbb4470ed20 | 2Java |
mxShapeInfographicRibbonSimple.prototype.getConstraints=function(a,d,e){a=[];var b=Math.max(0,Math.min(d,parseFloat(mxUtils.getValue(this.style,"notch1",this.notch2)))),c=Math.max(0,Math.min(d,parseFloat(mxUtils.getValue(this.style,"notch2",this.notch2))));d-=c;a.push(new mxConnectionConstraint(new mxPoint(0,0),!1));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.25*d,0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*d,0));a.push(new mxConnectionConstraint(new mxPoint(0,
0),!1,null,.75*d,0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,d,0));a.push(new mxConnectionConstraint(new mxPoint(1,.5),!1));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,d,e));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.75*d,e));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*d,e));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.25*d,e));a.push(new mxConnectionConstraint(new mxPoint(0,1),!1));a.push(new mxConnectionConstraint(new mxPoint(0,
0),!1,null,b,.5*e));return a};function mxShapeInfographicBarCallout(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1;this.dy=this.dx=.5}mxUtils.extend(mxShapeInfographicBarCallout,mxActor);mxShapeInfographicBarCallout.prototype.cst={BAR_CALLOUT:"mxgraph.infographic.barCallout"};mxShapeInfographicBarCallout.prototype.customProperties=[{name:"dx",dispName:"Callout Position",min:0,defVal:100},{name:"dy",dispName:"Callout Size",min:0,defVal:30}]; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
drag : function(e, ui) {
var helper = ui.helper;
if (helper.data('refreshPositions') && $(this).draggable('instance')) {
if (helper.data('refreshPositions') > 0) {
$(this).draggable('option', { refreshPositions : true });
helper.data('refreshPositions', -1);
} else {
$(this).draggable('option', { refreshPositions : false });
helper.data('refreshPositions', null);
}
}
}, | 1 | 1,2,4,7 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
var upload = function(args, on_success, on_failure) {
var codecov_endpoint =
args.options.url ||
process.env.codecov_url ||
process.env.CODECOV_URL ||
'https://codecov.io'
var query = {}
var debug = []
var yamlFile =
args.options.yml ||
process.env.codecov_yml ||
process.env.CODECOV_YML ||
'codecov.yml'
console.log(
'' +
' _____ _ \n' +
' / ____| | | \n' +
'| | ___ __| | ___ ___ _____ __ \n' +
'| | / _ \\ / _` |/ _ \\/ __/ _ \\ \\ / / \n' +
'| |___| (_) | (_| | __/ (_| (_) \\ V / \n' +
' \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ \n' +
' ' +
version
)
if ((args.options.disable || '').split(',').indexOf('detect') === -1) {
console.log('==> Detecting CI Provider')
query = detectProvider()
} else {
debug.push('disabled detect')
}
query.yaml = [yamlFile, '.codecov.yml'].reduce(function(result, file) {
return (
result ||
(fs.existsSync(path.resolve(process.cwd(), file))
? path.resolve(process.cwd(), file)
: undefined)
)
}, undefined)
if (args.options.build) {
query.build = args.options.build
}
if (args.options.commit) {
query.commit = args.options.commit
}
if (args.options.branch) {
query.branch = args.options.branch
}
if (args.options.slug) {
query.slug = args.options.slug
}
var flags =
args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS
if (flags) {
query.flags = flags
}
var yamlToken
try {
var loadedYamlFile = jsYaml.safeLoad(fs.readFileSync(query.yaml, 'utf8'))
yamlToken =
loadedYamlFile && loadedYamlFile.codecov && loadedYamlFile.codecov.token
} catch (e) {
}
var token =
args.options.token ||
yamlToken ||
process.env.codecov_token ||
process.env.CODECOV_TOKEN
if (token) {
query.token = token
}
query.package = 'node-' + version
console.log('==> Configuration: ')
console.log(' Endpoint: ' + codecov_endpoint)
console.log({
commit: query.commit,
branch: query.branch,
package: query.package,
})
var upload = ''
var env_found = false
if (args.options.env || process.env.CODECOV_ENV || process.env.codecov_env) {
var env = (
args.options.env +
',' +
(process.env.CODECOV_ENV || '') +
',' +
(process.env.codecov_env || '')
).split(',')
for (var i = env.length - 1; i >= 0; i--) {
if (env[i]) {
upload += env[i] + '=' + (process.env[env[i]] || '').toString() + '\n'
env_found = true
}
}
if (env_found) {
upload += '<<<<<< ENV\n'
}
}
var root = path.resolve(args.options.root || query.root || '.')
console.log('==> Building file structure')
try {
upload +=
execSync('git ls-files || hg locate', { cwd: root })
.toString()
.trim() + '\n<<<<<< network\n'
} catch (err) {
upload +=
walk
.sync({ path: root, ignoreFiles: ['.gitignore', '.hgignore'] })
.join('\n')
.trim() + '\n<<<<<< network\n'
}
if ((args.options.disable || '').split(',').indexOf('gcov') === -1) {
try {
console.log('==> Generating gcov reports (skip via --disable=gcov)')
var gcg = args.options['gcov-glob'] || ''
if (gcg) {
if (!isWindows) {
gcg = gcg
.split(' ')
.map(function(p) {
return "-not -path '" + p + "'"
})
.join(' ')
} else {
gcg = gcg
.split(' ')
.map(function(p) {
return '^| findstr /i /v ' + p
})
.join(' ')
}
}
var gcov
if (!isWindows) {
gcov =
'find ' +
(sanitizeVar(args.options['gcov-root']) || root) +
" -type f -name '*.gcno' " +
gcg +
' -exec ' +
(sanitizeVar(args.options['gcov-exec']) || 'gcov') +
' ' +
(sanitizeVar(args.options['gcov-args']) || '') +
' {} +'
} else {
gcov =
'for /f "delims=" %g in (\'dir /a-d /b /s *.gcno ' +
gcg +
"') do " +
(sanitizeVar(args.options['gcov-exec']) || 'gcov') +
' ' +
(sanitizeVar(args.options['gcov-args']) || '') +
' %g'
}
debug.push(gcov)
console.log(' $ ' + gcov)
execSync(gcov)
} catch (e) {
console.log(' Failed to run gcov command.')
}
} else {
debug.push('disabled gcov')
}
var bowerrc
if (!isWindows) {
bowerrc = execSync('test -f .bowerrc && cat .bowerrc || echo ""', {
cwd: root,
})
.toString()
.trim()
} else {
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root })
.toString()
.trim()
}
if (bowerrc) {
bowerrc = JSON.parse(bowerrc).directory
if (bowerrc) {
if (!isWindows) {
more_patterns =
" -not -path '*/" + bowerrc.toString().replace(/\/$/, '') + "/*'"
} else {
more_patterns =
'| findstr /i /v \\' + bowerrc.toString().replace(/\/$/, '') + '\\'
}
}
}
var files = [],
file = null
if (args.options.pipe) {
upload += '# path=piped\n' + args.options.pipe.join('') + '\n<<<<<< EOF\n'
console.log('==> Reading report from stdin')
} else if (args.options.file) {
file = args.options.file
console.log('==> Targeting specific file')
try {
upload +=
'# path=' +
file +
'\n' +
fs.readFileSync(file, 'utf8').toString() +
'\n<<<<<< EOF\n'
console.log(' + ' + file)
files.push(file)
} catch (e) {
debug.push('failed: ' + file.split('/').pop())
console.log(' X Failed to read file at ' + file)
}
} else if ((args.options.disable || '').split(',').indexOf('search') === -1) {
console.log('==> Scanning for reports')
var _files
if (!isWindows) {
_files = execSync('find ' + root + ' ' + patterns + more_patterns)
.toString()
.trim()
.split('\n')
} else {
_files = execSync('dir ' + patterns + more_patterns)
.toString()
.trim()
.split('\r\n')
}
if (_files) {
for (var i2 = _files.length - 1; i2 >= 0; i2--) {
file = _files[i2]
try {
upload +=
'# path=' +
file +
'\n' +
fs.readFileSync(file, 'utf8').toString() +
'\n<<<<<< EOF\n'
console.log(' + ' + file)
files.push(file)
} catch (e) {
debug.push('failed: ' + file.split('/').pop())
console.log(' X Failed to read file at ' + file)
}
}
}
} else {
debug.push('disabled search')
}
if (files) {
if (args.options.dump) {
console.log('-------- DEBUG START --------')
console.log(upload)
console.log('-------- DEBUG END --------')
} else {
console.log('==> Uploading reports')
var _upload
if ((args.options.disable || '').split(',').indexOf('s3') === -1) {
_upload = sendToCodecovV3
} else {
_upload = sendToCodecovV2
}
_upload(
codecov_endpoint,
query,
upload,
function() {
if (args.options.clear) {
for (var i = files.length - 1; i >= 0; i--) {
try {
fs.unlinkSync(files[i])
} catch (e) {}
}
}
if (on_success) {
on_success.apply(this, arguments)
}
},
on_failure || function() {}
)
}
}
return {
body: upload,
files: files,
query: query,
debug: debug,
url: codecov_endpoint,
}
} | 1 | 102,157,172,173,174,180,181,183,184,213,218 | -1 | https://github.com/codecov/codecov-node/commit/c0711c656686e902af2cd92d6aecc8074de4d83d | 3JavaScript |
bool WideToCharMap(const wchar *Src,char *Dest,size_t DestSize,bool &Success)
{
if (wcschr(Src,(wchar)MappedStringMark)==NULL)
return false;
Success=true;
uint SrcPos=0,DestPos=0;
while (Src[SrcPos]!=0 && DestPos<DestSize-MB_CUR_MAX)
{
if (uint(Src[SrcPos])==MappedStringMark)
{
SrcPos++;
continue;
}
if (uint(Src[SrcPos])>=MapAreaStart+0x80 && uint(Src[SrcPos])<MapAreaStart+0x100)
Dest[DestPos++]=char(uint(Src[SrcPos++])-MapAreaStart);
else
{
mbstate_t ps;
memset(&ps,0,sizeof(ps));
if (wcrtomb(Dest+DestPos,Src[SrcPos],&ps)==-1)
{
Dest[DestPos]='_';
Success=false;
}
SrcPos++;
memset(&ps,0,sizeof(ps));
int Length=mbrlen(Dest+DestPos,MB_CUR_MAX,&ps);
DestPos+=Max(Length,1);
}
}
Dest[Min(DestPos,DestSize-1)]=0;
return true;
} | 1 | 19 | -1 | https://github.com/aawc/unrar/commit/0ff832d31470471803b175cfff4e40c1b08ee779 | 0CCPP |
def get_markdown(self):
return get_markdown(self.comment)
| 0 | null | -1 | https://github.com/django-helpdesk/django-helpdesk.git/commit/a22eb0673fe0b7784f99c6b5fd343b64a6700f06 | 4Python |
public override IDisplayResult Display(HtmlMenuItemPart part, BuildPartDisplayContext context)
{
var settings = context.TypePartDefinition.GetSettings<HtmlMenuItemPartSettings>();
if (settings.SanitizeHtml)
{
part.Html = _htmlSanitizerService.Sanitize(part.Html);
}
return Combine(
Dynamic("HtmlMenuItemPart_Admin", shape =>
{
shape.MenuItemPart = part;
})
.Location("Admin", "Content:10"),
Dynamic("HtmlMenuItemPart_Thumbnail", shape =>
{
shape.MenuItemPart = part;
})
.Location("Thumbnail", "Content:10")
);
} | 0 | null | -1 | https://github.com/orchardcms/orchardcore/commit/218f25ddfadb66a54de7a82dffe3ab2e4ab7c4b4 | 1CS |
def canBeAdmin(self):
return self._blitzcon.canBeAdmin()
| 0 | null | -1 | https://github.com/ome/omero-web.git/commit/952f8e5d28532fbb14fb665982211329d137908c | 4Python |
static GF_Err gf_webvtt_import_report(void *user, GF_Err e, char *message, const char *line)
{
GF_LOG(e ? GF_LOG_WARNING : GF_LOG_INFO, GF_LOG_AUTHOR, ("[TXTIn] WebVTT line %s: %s\n", line, message) );
return e;
} | 0 | null | -1 | https://github.com/gpac/gpac/commit/30ac5e5236b790accd1f25347eebf2dc8c6c1bcb | 0CCPP |
ma);H.moveCells(ma,N,W)},!0,u);u=null}else if("organic"==P||"auto"==P&&ma.length>y.length){H.view.validate();var wa=new mxFastOrganicLayout(H);wa.forceConstant=3*fa;wa.disableEdgeStyle=!1;wa.resetEdges=!1;var Ea=wa.isVertexIgnored;wa.isVertexIgnored=function(Da){return Ea.apply(this,arguments)||0>mxUtils.indexOf(y,Da)};this.executeLayout(function(){wa.execute(H.getDefaultParent());Fa()},!0,u);u=null}}this.hideDialog()}finally{H.model.endUpdate()}null!=u&&u()}}catch(Da){this.handleError(Da)}};EditorUi.prototype.getSearch= | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
exports.unset = function(path, o) {
var parts = typeof path === 'string' ?
stringToParts(path) :
path;
if (!Array.isArray(parts)) {
throw new TypeError('Invalid `path`. Must be either string or array');
}
var len = parts.length;
var cur = o;
for (var i = 0; i < len; ++i) {
if (cur == null || typeof cur !== 'object' || !(parts[i] in cur)) {
return false;
}
if (ignoreProperties.indexOf(parts[i]) !== -1) {
return false;
}
if (i === len - 1) {
delete cur[parts[i]];
return true;
}
cur = cur instanceof Map ? cur.get(parts[i]) : cur[parts[i]];
}
return true;
}; | 1 | null | -1 | https://github.com/mongoosejs/mpath/commit/89402d2880d4ea3518480a8c9847c541f2d824fc | 3JavaScript |
register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
void *data)
{
struct ftrace_func_probe *entry;
struct ftrace_page *pg;
struct dyn_ftrace *rec;
int type, len, not;
unsigned long key;
int count = 0;
char *search;
type = filter_parse_regex(glob, strlen(glob), &search, ¬);
len = strlen(search);
if (WARN_ON(not))
return -EINVAL;
mutex_lock(&ftrace_lock);
if (unlikely(ftrace_disabled))
goto out_unlock;
do_for_each_ftrace_rec(pg, rec) {
if (!ftrace_match_record(rec, NULL, search, len, type))
continue;
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry) {
if (!count)
count = -ENOMEM;
goto out_unlock;
}
count++;
entry->data = data;
if (ops->callback) {
if (ops->callback(rec->ip, &entry->data) < 0) {
kfree(entry);
continue;
}
}
entry->ops = ops;
entry->ip = rec->ip;
key = hash_long(entry->ip, FTRACE_HASH_BITS);
hlist_add_head_rcu(&entry->node, &ftrace_func_hash[key]);
} while_for_each_ftrace_rec();
__enable_ftrace_function_probe();
out_unlock:
mutex_unlock(&ftrace_lock);
return count;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/6a76f8c0ab19f215af2a3442870eeb5f0e81998d | 0CCPP |
void __init proc_root_init(void)
{
struct vfsmount *mnt;
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
if (IS_ERR(mnt)) {
unregister_filesystem(&proc_fs_type);
return;
}
init_pid_ns.proc_mnt = mnt;
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
#ifdef CONFIG_SYSVIPC
proc_mkdir("sysvipc", NULL);
#endif
proc_mkdir("fs", NULL);
proc_mkdir("driver", NULL);
proc_mkdir("fs/nfsd", NULL);
#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
proc_mkdir("openprom", NULL);
#endif
proc_tty_init();
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
proc_mkdir("bus", NULL);
proc_sys_init();
} | 1 | 2,8,9,13 | -1 | https://github.com/torvalds/linux/commit/905ad269c55fc62bee3da29f7b1d1efeba8aa1e1 | 0CCPP |
static void _sx_sasl_features(sx_t s, sx_plugin_t p, nad_t nad) {
_sx_sasl_t ctx = (_sx_sasl_t) p->private;
Gsasl_session *sd = (Gsasl_session *) s->plugin_data[p->index];
int nmechs, ret;
char *mechs, *mech, *c;
if(s->type != type_SERVER)
return;
if(sd != NULL) {
_sx_debug(ZONE, "already auth'd, not offering sasl mechanisms");
return;
}
if(!(s->flags & SX_SASL_OFFER)) {
_sx_debug(ZONE, "application didn't ask us to offer sasl, so we won't");
return;
}
#ifdef HAVE_SSL
if((s->flags & SX_SSL_STARTTLS_REQUIRE) && s->ssf == 0) {
_sx_debug(ZONE, "ssl not established yet but the app requires it, not offering mechanisms");
return;
}
#endif
_sx_debug(ZONE, "offering sasl mechanisms");
ret = gsasl_server_mechlist(ctx->gsasl_ctx, &mechs);
if(ret != GSASL_OK) {
_sx_debug(ZONE, "gsasl_server_mechlist failed (%d): %s, not offering sasl for this conn", ret, gsasl_strerror (ret));
return;
}
mech = mechs;
nmechs = 0;
while(mech != NULL) {
c = strchr(mech, ' ');
if(c != NULL)
*c = '\0';
if ((ctx->cb)(sx_sasl_cb_CHECK_MECH, mech, NULL, s, ctx->cbarg)==sx_sasl_ret_OK) {
if (nmechs == 0) {
int ns = nad_add_namespace(nad, uri_SASL, NULL);
nad_append_elem(nad, ns, "mechanisms", 1);
}
_sx_debug(ZONE, "offering mechanism: %s", mech);
nad_append_elem(nad, -1 , "mechanism", 2);
nad_append_cdata(nad, mech, strlen(mech), 3);
nmechs++;
}
if(c == NULL)
mech = NULL;
else
mech = ++c;
}
free(mechs);
} | 0 | null | -1 | https://github.com/jabberd2/jabberd2/commit/8416ae54ecefa670534f27a31db71d048b9c7f16 | 0CCPP |
xid_map_enter(netdissect_options *ndo,
const struct sunrpc_msg *rp, const u_char *bp)
{
const struct ip *ip = NULL;
const struct ip6_hdr *ip6 = NULL;
struct xid_map_entry *xmep;
if (!ND_TTEST(rp->rm_call.cb_vers))
return (0);
switch (IP_V((const struct ip *)bp)) {
case 4:
ip = (const struct ip *)bp;
break;
case 6:
ip6 = (const struct ip6_hdr *)bp;
break;
default:
return (1);
}
xmep = &xid_map[xid_map_next];
if (++xid_map_next >= XIDMAPSIZE)
xid_map_next = 0;
UNALIGNED_MEMCPY(&xmep->xid, &rp->rm_xid, sizeof(xmep->xid));
if (ip) {
xmep->ipver = 4;
UNALIGNED_MEMCPY(&xmep->client, &ip->ip_src, sizeof(ip->ip_src));
UNALIGNED_MEMCPY(&xmep->server, &ip->ip_dst, sizeof(ip->ip_dst));
}
else if (ip6) {
xmep->ipver = 6;
UNALIGNED_MEMCPY(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src));
UNALIGNED_MEMCPY(&xmep->server, &ip6->ip6_dst, sizeof(ip6->ip6_dst));
}
xmep->proc = EXTRACT_32BITS(&rp->rm_call.cb_proc);
xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers);
return (1);
} | 1 | null | -1 | https://github.com/the-tcpdump-group/tcpdump/commit/b45a9a167ca6a3ef2752ae9d48d56ac14b001bfd | 0CCPP |
int add_control_packet(struct mt_packet *packet, enum mt_cptype cptype, void *cpdata, unsigned short data_len) {
unsigned char *data = packet->data + packet->size;
unsigned int act_size = data_len + (cptype == MT_CPTYPE_PLAINDATA ? 0 : MT_CPHEADER_LEN);
/* Something is really wrong. Packets should never become over 1500 bytes */
if (packet->size + act_size > MT_PACKET_LEN) {
fprintf(stderr, _("add_control_packet: ERROR, too large packet. Exceeds %d bytes\n"), MT_PACKET_LEN);
return -1;
}
if (cptype == MT_CPTYPE_PLAINDATA) {
memcpy(data, cpdata, data_len);
packet->size += data_len;
return data_len;
}
memcpy(data, mt_mactelnet_cpmagic, sizeof(mt_mactelnet_cpmagic));
data[4] = cptype;
#if BYTE_ORDER == LITTLE_ENDIAN
{
unsigned int templen;
templen = htonl(data_len);
memcpy(data + 5, &templen, sizeof(templen));
}
#else
memcpy(data + 5, &data_len, sizeof(data_len));
#endif
if (data_len > 0) {
memcpy(data + MT_CPHEADER_LEN, cpdata, data_len);
}
packet->size += act_size;
return act_size;
} | 1 | 3,4 | -1 | https://github.com/haakonnessjoen/MAC-Telnet/commit/9d946fa173acadcff7c80171d9b1186fab2e8daf | 0CCPP |
int mnt_clone_write(struct vfsmount *mnt)
{
if (__mnt_is_readonly(mnt))
return -EROFS;
preempt_disable();
mnt_inc_writers(real_mount(mnt));
preempt_enable();
return 0;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/e0c9c0afd2fc958ffa34b697972721d81df8a56f | 0CCPP |
default List<MediaType> accept() {
return getAll(HttpHeaders.ACCEPT)
.stream()
.flatMap(x -> Arrays.stream(x.split(",")))
.flatMap(s -> ConversionService.SHARED.convert(s, MediaType.class).map(Stream::of).orElse(Stream.empty()))
.distinct()
.collect(Collectors.toList());
} | 1 | 4 | -1 | https://github.com/micronaut-projects/micronaut-core/commit/b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3 | 2Java |
static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata,
struct beacon_data *beacon)
{
struct probe_resp *resp;
u8 *beacon_data;
size_t beacon_data_len;
int i;
u8 count = beacon->cntdwn_current_counter;
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP:
beacon_data = beacon->tail;
beacon_data_len = beacon->tail_len;
break;
case NL80211_IFTYPE_ADHOC:
beacon_data = beacon->head;
beacon_data_len = beacon->head_len;
break;
case NL80211_IFTYPE_MESH_POINT:
beacon_data = beacon->head;
beacon_data_len = beacon->head_len;
break;
default:
return;
}
rcu_read_lock();
for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; ++i) {
resp = rcu_dereference(sdata->u.ap.probe_resp);
if (beacon->cntdwn_counter_offsets[i]) {
if (WARN_ON_ONCE(beacon->cntdwn_counter_offsets[i] >=
beacon_data_len)) {
rcu_read_unlock();
return;
}
beacon_data[beacon->cntdwn_counter_offsets[i]] = count;
}
if (sdata->vif.type == NL80211_IFTYPE_AP && resp)
resp->data[resp->cntdwn_counter_offsets[i]] = count;
}
rcu_read_unlock();
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/bddc0c411a45d3718ac535a070f349be8eca8d48 | 0CCPP |
static void raw_dispatch(const MessagesMap_t *entry, const uint8_t *msg, uint32_t msg_size,
uint32_t frame_length)
{
static RawMessage raw_msg;
raw_msg.buffer = msg;
raw_msg.length = msg_size;
if(entry->process_func)
{
((raw_msg_handler_t)entry->process_func)(&raw_msg, frame_length);
}
} | 0 | null | -1 | https://github.com/keepkey/keepkey-firmware/commit/b222c66cdd7c3203d917c80ba615082d309d80c3 | 0CCPP |
function isDestinyTheStartingSection() {
var anchor = getAnchorsURL();
var destinationSection = getSectionByAnchor(anchor.section);
return !anchor.section || !destinationSection || typeof destinationSection !== 'undefined' && destinationSection.index() === index(getStartingSection());
} | 0 | null | -1 | https://github.com/alvarotrigo/fullpage.js/commit/48c474e366163ef341121a8c8f56aa2dc94ea60e | 3JavaScript |
function mapTOC(suite, obj) {
var ret = obj;
obj = obj[suite.title] = obj[suite.title] || { suite: suite };
suite.suites.forEach(function(suite){
mapTOC(suite, obj);
});
return ret;
} | 1 | 3 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
protected SymbolContext getContextLegacy() {
if (UseStyle.useBetaStyle() == false)
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(2));
final HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
final HColor backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
return new SymbolContext(backgroundColor, lineColor).withStroke(getStroke());
} | 1 | 0,1,2,3,4,5,6,7 | -1 | https://github.com/plantuml/plantuml/commit/93e5964e5f35914f3f7b89de620c596795550083 | 2Java |
init_sched_build_groups(const struct cpumask *span,
const struct cpumask *cpu_map,
int (*group_fn)(int cpu, const struct cpumask *cpu_map,
struct sched_group **sg,
struct cpumask *tmpmask),
struct cpumask *covered, struct cpumask *tmpmask)
{
struct sched_group *first = NULL, *last = NULL;
int i;
cpumask_clear(covered);
for_each_cpu(i, span) {
struct sched_group *sg;
int group = group_fn(i, cpu_map, &sg, tmpmask);
int j;
if (cpumask_test_cpu(i, covered))
continue;
cpumask_clear(sched_group_cpus(sg));
sg->cpu_power = 0;
for_each_cpu(j, span) {
if (group_fn(j, cpu_map, NULL, tmpmask) != group)
continue;
cpumask_set_cpu(j, covered);
cpumask_set_cpu(j, sched_group_cpus(sg));
}
if (!first)
first = sg;
if (last)
last->next = sg;
last = sg;
}
last->next = first;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64 | 0CCPP |
IW_IMPL(unsigned int) iw_get_ui16be(const iw_byte *b)
{
return (b[0]<<8) | b[1];
} | 1 | 2 | -1 | https://github.com/jsummers/imageworsener/commit/a00183107d4b84bc8a714290e824ca9c68dac738 | 0CCPP |
png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_color palette[PNG_MAX_PALETTE_LENGTH];
int max_palette_length, num, i;
#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_colorp pal_ptr;
#endif
png_debug(1, "in png_handle_PLTE");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & PNG_HAVE_PLTE) != 0)
png_chunk_error(png_ptr, "duplicate");
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
png_ptr->mode |= PNG_HAVE_PLTE;
if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "ignored in grayscale PNG");
return;
}
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
{
png_crc_finish(png_ptr, length);
return;
}
#endif
if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
{
png_crc_finish(png_ptr, length);
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
png_chunk_benign_error(png_ptr, "invalid");
else
png_chunk_error(png_ptr, "invalid");
return;
}
num = (int)length / 3;
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
max_palette_length = (1 << png_ptr->bit_depth);
else
max_palette_length = PNG_MAX_PALETTE_LENGTH;
if (num > max_palette_length)
num = max_palette_length;
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
{
png_byte buf[3];
png_crc_read(png_ptr, buf, 3);
pal_ptr->red = buf[0];
pal_ptr->green = buf[1];
pal_ptr->blue = buf[2];
}
#else
for (i = 0; i < num; i++)
{
png_byte buf[3];
png_crc_read(png_ptr, buf, 3);
palette[i].red = buf[0];
palette[i].green = buf[1];
palette[i].blue = buf[2];
}
#endif
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#endif
{
png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
}
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
else if (png_crc_error(png_ptr) != 0)
{
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE) == 0)
{
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) != 0)
return;
else
png_chunk_error(png_ptr, "CRC error");
}
else if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0)
png_chunk_warning(png_ptr, "CRC error");
}
#endif
png_set_PLTE(png_ptr, info_ptr, palette, num);
#ifdef PNG_READ_tRNS_SUPPORTED
if (png_ptr->num_trans > 0 ||
(info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0))
{
png_ptr->num_trans = 0;
if (info_ptr != NULL)
info_ptr->num_trans = 0;
png_chunk_benign_error(png_ptr, "tRNS must be after");
}
#endif
#ifdef PNG_READ_hIST_SUPPORTED
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
png_chunk_benign_error(png_ptr, "hIST must be after");
#endif
#ifdef PNG_READ_bKGD_SUPPORTED
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
png_chunk_benign_error(png_ptr, "bKGD must be after");
#endif
} | 0 | null | -1 | https://github.com/glennrp/libpng/commit/8a05766cb74af05c04c53e6c9d60c13fc4d59bf2 | 0CCPP |
def _prefix_from_uri(self, uriname):
uripart, tag = uriname.split("}", maxsplit=1)
uri = uripart.replace("{", "")
return self.REVERSE_NS[uri] + ":" + tag
| 0 | null | -1 | https://github.com/pikepdf/pikepdf.git/commit/3f38f73218e5e782fe411ccbb3b44a793c0b343a | 4Python |
def sanitize_path(path):
trailing_slash = "/" if path.endswith("/") else ""
path = posixpath.normpath(path)
new_path = "/"
for part in path.split("/"):
if not part or part in (".", ".."):
continue
new_path = posixpath.join(new_path, part)
trailing_slash = "" if new_path.endswith("/") else trailing_slash
return new_path + trailing_slash
| 1 | 9 | -1 | https://github.com/Unrud/Radicale.git/commit/b4b3d51f33c7623d312f289252dd7bbb8f58bbe6 | 4Python |
openlog_internal(const char *ident, int logstat, int logfac)
{
if (ident != NULL)
LogTag = ident;
LogStat = logstat;
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
LogFacility = logfac;
while (1) {
if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX;
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data));
if (LogStat & LOG_NDELAY) {
if ((LogFile = __socket(AF_UNIX, LogType, 0))
== -1)
return;
(void)__fcntl(LogFile, F_SETFD, 1);
}
}
if (LogFile != -1 && !connected)
{
int old_errno = errno;
if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))
== -1)
{
int saved_errno = errno;
(void)__close(LogFile);
LogFile = -1;
if (LogType == SOCK_DGRAM
&& saved_errno == EPROTOTYPE)
{
LogType = SOCK_STREAM;
__set_errno (old_errno);
continue;
}
} else
connected = 1;
}
break;
}
} | 0 | null | -1 | https://github.com/bminor/glibc/commit/2864e767053317538feafa815046fff89e5a16be | 0CCPP |
iasecc_check_sw(struct sc_card *card, unsigned int sw1, unsigned int sw2)
{
if (sw1 == 0x62 && sw2 == 0x82)
return SC_SUCCESS;
return iso_ops->check_sw(card, sw1, sw2);
} | 0 | null | -1 | https://github.com/OpenSC/OpenSC/commit/03628449b75a93787eb2359412a3980365dda49b | 0CCPP |
static void nlmclnt_rpc_release(void *data)
{
nlmclnt_release_call(data);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/0b760113a3a155269a3fba93a409c640031dd68f | 0CCPP |
static struct dentry *ext3_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/8d0c2d10dd72c5292eda7a06231056a4c972e4cc | 0CCPP |
MoveToRequestBean() {} | 1 | 0 | -1 | https://github.com/NationalSecurityAgency/emissary/commit/40260b1ec1f76cc92361702cc14fa1e4388e19d7 | 2Java |
GF_Err xml_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_XMLBox *ptr = (GF_XMLBox *)s;
return gf_isom_read_null_terminated_string(s, bs, s->size, &ptr->xml);
} | 0 | null | -1 | https://github.com/gpac/gpac/commit/ec64c7b8966d7e4642d12debb888be5acf18efb9 | 0CCPP |
public void close(final AjaxRequestTarget target)
{
target.appendJavaScript("$('#" + getMainContainerMarkupId() + "').modal('hide');");
} | 1 | null | -1 | https://github.com/micromata/projectforge-webapp/commit/422de35e3c3141e418a73bfb39b430d5fd74077e | 2Java |
void cJSON_AddItemToObject( cJSON *object, const char *string, cJSON *item )
{
if ( ! item )
return;
if ( item->string )
cJSON_free( item->string );
item->string = cJSON_strdup( string );
cJSON_AddItemToArray( object, item );
} | 1 | 0,1,2,3,4,5,6,7,8 | -1 | https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a | 0CCPP |
bcf_hdr_t *vcf_hdr_read(htsFile *fp)
{
kstring_t txt, *s = &fp->line;
int ret;
bcf_hdr_t *h;
tbx_t *idx = NULL;
const char **names = NULL;
h = bcf_hdr_init("r");
if (!h) {
hts_log_error("Failed to allocate bcf header");
return NULL;
}
txt.l = txt.m = 0; txt.s = 0;
while ((ret = hts_getline(fp, KS_SEP_LINE, s)) >= 0) {
int e = 0;
if (s->l == 0) continue;
if (s->s[0] != '#') {
hts_log_error("No sample line");
goto error;
}
if (s->s[1] != '#' && fp->fn_aux) {
kstring_t tmp = { 0, 0, NULL };
hFILE *f = hopen(fp->fn_aux, "r");
if (f == NULL) {
hts_log_error("Couldn't open \"%s\"", fp->fn_aux);
goto error;
}
while (tmp.l = 0, kgetline(&tmp, (kgets_func *) hgets, f) >= 0) {
char *tab = strchr(tmp.s, '\t');
if (tab == NULL) continue;
e |= (kputs("##contig=<ID=", &txt) < 0);
e |= (kputsn(tmp.s, tab - tmp.s, &txt) < 0);
e |= (kputs(",length=", &txt) < 0);
e |= (kputl(atol(tab), &txt) < 0);
e |= (kputsn(">\n", 2, &txt) < 0);
}
free(tmp.s);
if (hclose(f) != 0) {
hts_log_error("Error on closing %s", fp->fn_aux);
goto error;
}
if (e) goto error;
}
if (kputsn(s->s, s->l, &txt) < 0) goto error;
if (kputc('\n', &txt) < 0) goto error;
if (s->s[1] != '#') break;
}
if ( ret < -1 ) goto error;
if ( !txt.s )
{
hts_log_error("Could not read the header");
goto error;
}
if ( bcf_hdr_parse(h, txt.s) < 0 ) goto error;
idx = tbx_index_load3(fp->fn, NULL, HTS_IDX_SAVE_REMOTE|HTS_IDX_SILENT_FAIL);
if ( idx )
{
int i, n, need_sync = 0;
names = tbx_seqnames(idx, &n);
if (!names) goto error;
for (i=0; i<n; i++)
{
bcf_hrec_t *hrec = bcf_hdr_get_hrec(h, BCF_HL_CTG, "ID", (char*) names[i], NULL);
if ( hrec ) continue;
if (add_missing_contig_hrec(h, names[i]) < 0) goto error;
need_sync = 1;
}
if ( need_sync ) {
if (bcf_hdr_sync(h) < 0) goto error;
}
free(names);
tbx_destroy(idx);
}
free(txt.s);
return h;
error:
if (idx) tbx_destroy(idx);
free(names);
free(txt.s);
if (h) bcf_hdr_destroy(h);
return NULL;
} | 0 | null | -1 | https://github.com/samtools/htslib/commit/dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c | 0CCPP |
ready : function () {
return ssb.ready.value
}, | 1 | 0,1,2 | -1 | https://github.com/ssbc/ssb-db/commit/ee983727fc78eea94564733693ccda18a1fffcf2 | 3JavaScript |
this.exec = function(data) {
var fm = this.fm,
upload = function(data) {
dialog.elfinderdialog('close');
fm.upload(data)
.fail(function(error) {
dfrd.reject(error);
})
.done(function(data) {
dfrd.resolve(data);
});
},
dfrd, dialog, input, button, dropbox;
if (this.disabled()) {
return $.Deferred().reject();
}
if (data && (data.input || data.files)) {
return fm.upload(data);
}
dfrd = $.Deferred();
input = $('<input type="file" multiple="true"/>')
.change(function() {
upload({input : input[0]});
});
button = $('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+fm.i18n('selectForUpload')+'</span></div>')
.append($('<form/>').append(input))
.hover(function() {
button.toggleClass(hover)
})
dialog = $('<div class="elfinder-upload-dialog-wrapper"/>')
.append(button);
if (fm.dragUpload) {
dropbox = $('<div class="ui-corner-all elfinder-upload-dropbox">'+fm.i18n('dropFiles')+'</div>')
.prependTo(dialog)
.after('<div class="elfinder-upload-dialog-or">'+fm.i18n('or')+'</div>')[0];
dropbox.addEventListener('dragenter', function(e) {
e.stopPropagation();
e.preventDefault();
$(dropbox).addClass(hover);
}, false);
dropbox.addEventListener('dragleave', function(e) {
e.stopPropagation();
e.preventDefault();
$(dropbox).removeClass(hover);
}, false);
dropbox.addEventListener('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
}, false);
dropbox.addEventListener('drop', function(e) {
e.stopPropagation();
e.preventDefault();
upload({files : e.dataTransfer.files});
}, false);
}
fm.dialog(dialog, {
title : this.title,
modal : true,
resizable : false,
destroyOnClose : true
});
return dfrd;
} | 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,50,51,52,53,54,55,56,57,58,59,60,61,62 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
static int _clua_panic(lua_State *ls)
{
UNUSED(ls);
if (crawl_state.need_save && !crawl_state.saving_game
&& !crawl_state.updating_scores)
{
save_game(true);
}
return 0;
} | 0 | null | -1 | https://github.com/crawl/crawl/commit/768f60da87a3fa0b5561da5ade9309577c176d04 | 0CCPP |
static void iwjpeg_scan_exif(struct iwjpegrcontext *rctx,
const iw_byte *d, size_t d_len)
{
struct iw_exif_state e;
iw_uint32 ifd;
if(d_len<8) return;
iw_zeromem(&e,sizeof(struct iw_exif_state));
e.d = d;
e.d_len = d_len;
e.endian = d[0]=='I' ? IW_ENDIAN_LITTLE : IW_ENDIAN_BIG;
ifd = iw_get_ui32_e(&d[4],e.endian);
iwjpeg_scan_exif_ifd(rctx,&e,ifd);
} | 1 | 10 | -1 | https://github.com/jsummers/imageworsener/commit/b45cb1b665a14b0175b9cb1502ef7168e1fe0d5d | 0CCPP |
get_results(struct iperf_test *test)
{
int r = 0;
cJSON *j;
cJSON *j_cpu_util_total;
cJSON *j_cpu_util_user;
cJSON *j_cpu_util_system;
cJSON *j_sender_has_retransmits;
int result_has_retransmits;
cJSON *j_streams;
int n, i;
cJSON *j_stream;
cJSON *j_id;
cJSON *j_bytes;
cJSON *j_retransmits;
cJSON *j_jitter;
cJSON *j_errors;
cJSON *j_packets;
cJSON *j_server_output;
int sid, cerror, pcount;
double jitter;
iperf_size_t bytes_transferred;
int retransmits;
struct iperf_stream *sp;
j = JSON_read(test->ctrl_sck);
if (j == NULL) {
i_errno = IERECVRESULTS;
r = -1;
} else {
j_cpu_util_total = cJSON_GetObjectItem(j, "cpu_util_total");
j_cpu_util_user = cJSON_GetObjectItem(j, "cpu_util_user");
j_cpu_util_system = cJSON_GetObjectItem(j, "cpu_util_system");
j_sender_has_retransmits = cJSON_GetObjectItem(j, "sender_has_retransmits");
if (j_cpu_util_total == NULL || j_cpu_util_user == NULL || j_cpu_util_system == NULL || j_sender_has_retransmits == NULL) {
i_errno = IERECVRESULTS;
r = -1;
} else {
if (test->debug) {
printf("get_results\n%s\n", cJSON_Print(j));
}
test->remote_cpu_util[0] = j_cpu_util_total->valuefloat;
test->remote_cpu_util[1] = j_cpu_util_user->valuefloat;
test->remote_cpu_util[2] = j_cpu_util_system->valuefloat;
result_has_retransmits = j_sender_has_retransmits->valueint;
if (! test->sender)
test->sender_has_retransmits = result_has_retransmits;
j_streams = cJSON_GetObjectItem(j, "streams");
if (j_streams == NULL) {
i_errno = IERECVRESULTS;
r = -1;
} else {
n = cJSON_GetArraySize(j_streams);
for (i=0; i<n; ++i) {
j_stream = cJSON_GetArrayItem(j_streams, i);
if (j_stream == NULL) {
i_errno = IERECVRESULTS;
r = -1;
} else {
j_id = cJSON_GetObjectItem(j_stream, "id");
j_bytes = cJSON_GetObjectItem(j_stream, "bytes");
j_retransmits = cJSON_GetObjectItem(j_stream, "retransmits");
j_jitter = cJSON_GetObjectItem(j_stream, "jitter");
j_errors = cJSON_GetObjectItem(j_stream, "errors");
j_packets = cJSON_GetObjectItem(j_stream, "packets");
if (j_id == NULL || j_bytes == NULL || j_retransmits == NULL || j_jitter == NULL || j_errors == NULL || j_packets == NULL) {
i_errno = IERECVRESULTS;
r = -1;
} else {
sid = j_id->valueint;
bytes_transferred = j_bytes->valueint;
retransmits = j_retransmits->valueint;
jitter = j_jitter->valuefloat;
cerror = j_errors->valueint;
pcount = j_packets->valueint;
SLIST_FOREACH(sp, &test->streams, streams)
if (sp->id == sid) break;
if (sp == NULL) {
i_errno = IESTREAMID;
r = -1;
} else {
if (test->sender) {
sp->jitter = jitter;
sp->cnt_error = cerror;
sp->packet_count = pcount;
sp->result->bytes_received = bytes_transferred;
} else {
sp->result->bytes_sent = bytes_transferred;
sp->result->stream_retrans = retransmits;
}
}
}
}
}
if (test->role == 'c' && iperf_get_test_get_server_output(test)) {
j_server_output = cJSON_DetachItemFromObject(j, "server_output_json");
if (j_server_output != NULL) {
test->json_server_output = j_server_output;
}
else {
j_server_output = cJSON_GetObjectItem(j, "server_output_text");
if (j_server_output != NULL) {
test->server_output_text = strdup(j_server_output->valuestring);
}
}
}
}
}
cJSON_Delete(j);
}
return r;
} | 1 | 40,41,42,71 | -1 | https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a | 0CCPP |
tensorflow::gtl::CompactPointerSet<TFE_Py_Tape*>* GetTapeSet() {
thread_local std::unique_ptr<tensorflow::gtl::CompactPointerSet<TFE_Py_Tape*>>
tape_set;
thread_local ThreadLocalDestructionMarker marker;
if (!marker.alive) {
return nullptr;
}
if (tape_set == nullptr) {
tape_set.reset(new tensorflow::gtl::CompactPointerSet<TFE_Py_Tape*>);
}
return tape_set.get();
} | 0 | null | -1 | https://github.com/tensorflow/tensorflow/commit/237822b59fc504dda2c564787f5d3ad9c4aa62d9 | 0CCPP |
private void TimerElapsed(object sender, ElapsedEventArgs e) {
try {
ObjectFactory.GetInstance<ServiceWork>().Do();
} catch (Exception ex) {
_logger.Log("Exception was : " + ex.Message + "\nStackTrace Was: " + ex.StackTrace);
}
} | 1 | 6 | -1 | https://github.com/rackerlabs/openstack-guest-agents-windows-xenserver/commit/ef16f88f20254b8083e361f11707da25f8482401 | 1CS |
bool ACLosslessScan::WriteMCU(void)
{
#if ACCUSOFT_CODE
int i;
struct Line *top[4],*prev[4];
int lines = 8;
for(i = 0;i < m_ucCount;i++) {
class Component *comp = ComponentOf(i);
UBYTE idx = comp->IndexOf();
top[i] = m_pLineCtrl->CurrentLineOf(idx);
prev[i] = m_pLineCtrl->PreviousLineOf(idx);
m_ulX[i] = 0;
m_ulY[i] = m_pLineCtrl->CurrentYOf(idx);
}
do {
do {
BeginWriteMCU(m_Coder.ByteStreamOf());
WriteMCU(prev,top);
} while(AdvanceToTheRight());
for(i = 0;i < m_ucCount;i++) {
memset(m_plDa[i],0,sizeof(LONG) * m_ucMCUHeight[i]);
}
} while(AdvanceToTheNextLine(prev,top) && --lines);
#endif
return false;
} | 0 | null | -1 | https://github.com/thorfdbg/libjpeg/commit/ef4a29a62ab48b8dc235f4af52cfd6319eda9a6a | 0CCPP |
static CACHE_BRUSH_ORDER* update_read_cache_brush_order(rdpUpdate* update, wStream* s, UINT16 flags)
{
int i;
BYTE iBitmapFormat;
BOOL compressed = FALSE;
CACHE_BRUSH_ORDER* cache_brush = calloc(1, sizeof(CACHE_BRUSH_ORDER));
if (!cache_brush)
goto fail;
if (Stream_GetRemainingLength(s) < 6)
goto fail;
Stream_Read_UINT8(s, cache_brush->index);
Stream_Read_UINT8(s, iBitmapFormat);
if (iBitmapFormat >= ARRAYSIZE(BMF_BPP))
goto fail;
cache_brush->bpp = BMF_BPP[iBitmapFormat];
Stream_Read_UINT8(s, cache_brush->cx);
Stream_Read_UINT8(s, cache_brush->cy);
Stream_Read_UINT8(s, cache_brush->style);
Stream_Read_UINT8(s, cache_brush->length);
if ((cache_brush->cx == 8) && (cache_brush->cy == 8))
{
if (cache_brush->bpp == 1)
{
if (cache_brush->length != 8)
{
WLog_Print(update->log, WLOG_ERROR, "incompatible 1bpp brush of length:%" PRIu32 "",
cache_brush->length);
goto fail;
}
if (Stream_GetRemainingLength(s) < 8)
goto fail;
for (i = 7; i >= 0; i--)
{
Stream_Read_UINT8(s, cache_brush->data[i]);
}
}
else
{
if ((iBitmapFormat == BMF_8BPP) && (cache_brush->length == 20))
compressed = TRUE;
else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24))
compressed = TRUE;
else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32))
compressed = TRUE;
if (compressed != FALSE)
{
if (!update_decompress_brush(s, cache_brush->data, sizeof(cache_brush->data),
cache_brush->bpp))
goto fail;
}
else
{
UINT32 scanline = (cache_brush->bpp / 8) * 8;
if (Stream_GetRemainingLength(s) < scanline * 8)
goto fail;
for (i = 7; i >= 0; i--)
{
Stream_Read(s, &cache_brush->data[i * scanline], scanline);
}
}
}
}
return cache_brush;
fail:
free_cache_brush_order(update->context, cache_brush);
return NULL;
} | 1 | 12,14 | -1 | https://github.com/FreeRDP/FreeRDP/commit/b8beb55913471952f92770c90c372139d78c16c0 | 0CCPP |
internal void RequestPersonaStateUpdate() {
if (!IsConnectedAndLoggedOn) {
return;
}
SteamFriends.RequestFriendInfo(SteamID, EClientPersonaStateFlag.PlayerName | EClientPersonaStateFlag.Presence);
} | 0 | null | -1 | https://github.com/JustArchiNET/ArchiSteamFarm/commit/4cd581ec041912cf199c5512fe6d1dcaec0594c0 | 1CS |
static int read_opcode(unsigned long long pc, unsigned long *result_opcode, int from_user_mode)
{
int get_user_error;
unsigned long aligned_pc;
unsigned long opcode;
if ((pc & 3) == 1) {
aligned_pc = pc & ~3;
if (from_user_mode) {
if (!access_ok(VERIFY_READ, aligned_pc, sizeof(unsigned long))) {
get_user_error = -EFAULT;
} else {
get_user_error = __get_user(opcode, (unsigned long *)aligned_pc);
*result_opcode = opcode;
}
return get_user_error;
} else {
*result_opcode = *(unsigned long *) aligned_pc;
return 0;
}
} else if ((pc & 1) == 0) {
return -EFAULT;
} else {
return -EFAULT;
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
def _normalize_headers(headers):
return dict(
[
(
_convert_byte_str(key).lower(),
NORMALIZE_SPACE.sub(
_convert_byte_str(value), " "
).strip(),
)
for (key, value) in headers.items()
]
)
| 1 | 3,4,7,8 | -1 | https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc | 4Python |
}
static inline bool f2fs_force_buffered_io(struct inode *inode,
struct kiocb *iocb, struct iov_iter *iter)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
int rw = iov_iter_rw(iter);
if (f2fs_post_read_required(inode))
return true;
if (f2fs_is_multi_device(sbi))
return true;
if (f2fs_sb_has_blkzoned(sbi))
return true;
if (test_opt(sbi, LFS) && (rw == WRITE) &&
block_unaligned_IO(inode, iocb, iter))
return true;
if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
return true; | 1 | 15 | -1 | https://github.com/torvalds/linux/commit/4969c06a0d83c9c3dc50b8efcdc8eeedfce896f6 | 0CCPP |
static int copy_everything_to_user(struct ebt_table *t, void __user *user,
const int *len, int cmd)
{
struct ebt_replace tmp;
const struct ebt_counter *oldcounters;
unsigned int entries_size, nentries;
int ret;
char *entries;
if (cmd == EBT_SO_GET_ENTRIES) {
entries_size = t->private->entries_size;
nentries = t->private->nentries;
entries = t->private->entries;
oldcounters = t->private->counters;
} else {
entries_size = t->table->entries_size;
nentries = t->table->nentries;
entries = t->table->entries;
oldcounters = t->table->counters;
}
if (copy_from_user(&tmp, user, sizeof(tmp)))
return -EFAULT;
if (*len != sizeof(struct ebt_replace) + entries_size +
(tmp.num_counters? nentries * sizeof(struct ebt_counter): 0))
return -EINVAL;
if (tmp.nentries != nentries) {
BUGPRINT("Nentries wrong\n");
return -EINVAL;
}
if (tmp.entries_size != entries_size) {
BUGPRINT("Wrong size\n");
return -EINVAL;
}
ret = copy_counters_to_user(t, oldcounters, tmp.counters,
tmp.num_counters, nentries);
if (ret)
return ret;
if (copy_to_user(tmp.entries, entries, entries_size)) {
BUGPRINT("Couldn't copy entries to userspace\n");
return -EFAULT;
}
return EBT_ENTRY_ITERATE(entries, entries_size,
ebt_make_names, entries, tmp.entries);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/d846f71195d57b0bbb143382647c2c6638b04c5a | 0CCPP |
struct pipe_inode_info *alloc_pipe_info(void)
{
struct pipe_inode_info *pipe;
pipe = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
if (pipe) {
pipe->bufs = kzalloc(sizeof(struct pipe_buffer) * PIPE_DEF_BUFFERS, GFP_KERNEL);
if (pipe->bufs) {
init_waitqueue_head(&pipe->wait);
pipe->r_counter = pipe->w_counter = 1;
pipe->buffers = PIPE_DEF_BUFFERS;
mutex_init(&pipe->mutex);
return pipe;
}
kfree(pipe);
}
return NULL;
} | 1 | 5,9 | -1 | https://github.com/torvalds/linux/commit/759c01142a5d0f364a462346168a56de28a80f52 | 0CCPP |
static void buf_to_pages(const void *buf, size_t buflen,
struct page **pages, unsigned int *pgbase)
{
const void *p = buf;
*pgbase = offset_in_page(buf);
p -= *pgbase;
while (p < buf + buflen) {
*(pages++) = virt_to_page(p);
p += PAGE_CACHE_SIZE;
}
} | 1 | 0,1,2,3,4,5,6,7,8,9,10 | -1 | https://github.com/torvalds/linux/commit/bf118a342f10dafe44b14451a1392c3254629a1f | 0CCPP |
static void _rtl_usb_cleanup_rx(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
struct urb *urb;
usb_kill_anchored_urbs(&rtlusb->rx_submitted);
tasklet_kill(&rtlusb->rx_work_tasklet);
cancel_work_sync(&rtlpriv->works.lps_change_work);
flush_workqueue(rtlpriv->works.rtl_wq);
destroy_workqueue(rtlpriv->works.rtl_wq);
skb_queue_purge(&rtlusb->rx_queue);
while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) {
usb_free_coherent(urb->dev, urb->transfer_buffer_length,
urb->transfer_buffer, urb->transfer_dma);
usb_free_urb(urb);
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/3f93616951138a598d930dcaec40f2bfd9ce43bb | 0CCPP |
static int ovl_rename2(struct inode *olddir, struct dentry *old,
struct inode *newdir, struct dentry *new,
unsigned int flags)
{
int err;
enum ovl_path_type old_type;
enum ovl_path_type new_type;
struct dentry *old_upperdir;
struct dentry *new_upperdir;
struct dentry *olddentry;
struct dentry *newdentry;
struct dentry *trap;
bool old_opaque;
bool new_opaque;
bool new_create = false;
bool cleanup_whiteout = false;
bool overwrite = !(flags & RENAME_EXCHANGE);
bool is_dir = d_is_dir(old);
bool new_is_dir = false;
struct dentry *opaquedir = NULL;
const struct cred *old_cred = NULL;
struct cred *override_cred = NULL;
err = -EINVAL;
if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE))
goto out;
flags &= ~RENAME_NOREPLACE;
err = ovl_check_sticky(old);
if (err)
goto out;
old_type = ovl_path_type(old);
err = -EXDEV;
if (OVL_TYPE_MERGE_OR_LOWER(old_type) && is_dir)
goto out;
if (new->d_inode) {
err = ovl_check_sticky(new);
if (err)
goto out;
if (d_is_dir(new))
new_is_dir = true;
new_type = ovl_path_type(new);
err = -EXDEV;
if (!overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir)
goto out;
err = 0;
if (!OVL_TYPE_UPPER(new_type) && !OVL_TYPE_UPPER(old_type)) {
if (ovl_dentry_lower(old)->d_inode ==
ovl_dentry_lower(new)->d_inode)
goto out;
}
if (OVL_TYPE_UPPER(new_type) && OVL_TYPE_UPPER(old_type)) {
if (ovl_dentry_upper(old)->d_inode ==
ovl_dentry_upper(new)->d_inode)
goto out;
}
} else {
if (ovl_dentry_is_opaque(new))
new_type = __OVL_PATH_UPPER;
else
new_type = __OVL_PATH_UPPER | __OVL_PATH_PURE;
}
err = ovl_want_write(old);
if (err)
goto out;
err = ovl_copy_up(old);
if (err)
goto out_drop_write;
err = ovl_copy_up(new->d_parent);
if (err)
goto out_drop_write;
if (!overwrite) {
err = ovl_copy_up(new);
if (err)
goto out_drop_write;
}
old_opaque = !OVL_TYPE_PURE_UPPER(old_type);
new_opaque = !OVL_TYPE_PURE_UPPER(new_type);
if (old_opaque || new_opaque) {
err = -ENOMEM;
override_cred = prepare_creds();
if (!override_cred)
goto out_drop_write;
cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN);
cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE);
cap_raise(override_cred->cap_effective, CAP_FOWNER);
cap_raise(override_cred->cap_effective, CAP_FSETID);
cap_raise(override_cred->cap_effective, CAP_CHOWN);
old_cred = override_creds(override_cred);
}
if (overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir) {
opaquedir = ovl_check_empty_and_clear(new);
err = PTR_ERR(opaquedir);
if (IS_ERR(opaquedir)) {
opaquedir = NULL;
goto out_revert_creds;
}
}
if (overwrite) {
if (old_opaque) {
if (new->d_inode || !new_opaque) {
flags |= RENAME_WHITEOUT;
} else {
flags |= RENAME_EXCHANGE;
}
} else if (is_dir && !new->d_inode && new_opaque) {
flags |= RENAME_EXCHANGE;
cleanup_whiteout = true;
}
}
old_upperdir = ovl_dentry_upper(old->d_parent);
new_upperdir = ovl_dentry_upper(new->d_parent);
trap = lock_rename(new_upperdir, old_upperdir);
olddentry = ovl_dentry_upper(old);
newdentry = ovl_dentry_upper(new);
if (newdentry) {
if (opaquedir) {
newdentry = opaquedir;
opaquedir = NULL;
} else {
dget(newdentry);
}
} else {
new_create = true;
newdentry = lookup_one_len(new->d_name.name, new_upperdir,
new->d_name.len);
err = PTR_ERR(newdentry);
if (IS_ERR(newdentry))
goto out_unlock;
}
err = -ESTALE;
if (olddentry->d_parent != old_upperdir)
goto out_dput;
if (newdentry->d_parent != new_upperdir)
goto out_dput;
if (olddentry == trap)
goto out_dput;
if (newdentry == trap)
goto out_dput;
if (is_dir && !old_opaque && new_opaque) {
err = ovl_set_opaque(olddentry);
if (err)
goto out_dput;
}
if (!overwrite && new_is_dir && old_opaque && !new_opaque) {
err = ovl_set_opaque(newdentry);
if (err)
goto out_dput;
}
if (old_opaque || new_opaque) {
err = ovl_do_rename(old_upperdir->d_inode, olddentry,
new_upperdir->d_inode, newdentry,
flags);
} else {
BUG_ON(flags & ~RENAME_EXCHANGE);
err = vfs_rename(old_upperdir->d_inode, olddentry,
new_upperdir->d_inode, newdentry,
NULL, flags);
}
if (err) {
if (is_dir && !old_opaque && new_opaque)
ovl_remove_opaque(olddentry);
if (!overwrite && new_is_dir && old_opaque && !new_opaque)
ovl_remove_opaque(newdentry);
goto out_dput;
}
if (is_dir && old_opaque && !new_opaque)
ovl_remove_opaque(olddentry);
if (!overwrite && new_is_dir && !old_opaque && new_opaque)
ovl_remove_opaque(newdentry);
if (old_opaque != new_opaque) {
ovl_dentry_set_opaque(old, new_opaque);
if (!overwrite)
ovl_dentry_set_opaque(new, old_opaque);
}
if (cleanup_whiteout)
ovl_cleanup(old_upperdir->d_inode, newdentry);
ovl_dentry_version_inc(old->d_parent);
ovl_dentry_version_inc(new->d_parent);
out_dput:
dput(newdentry);
out_unlock:
unlock_rename(new_upperdir, old_upperdir);
out_revert_creds:
if (old_opaque || new_opaque) {
revert_creds(old_cred);
put_cred(override_cred);
}
out_drop_write:
ovl_drop_write(old);
out:
dput(opaquedir);
return err;
} | 1 | 111,112,113,115,116,118,122,123,124,125,126,128,129,130,131,132 | -1 | https://github.com/torvalds/linux/commit/11f3710417d026ea2f4fcf362d866342c5274185 | 0CCPP |
static void oidc_store_access_token_expiry(request_rec *r,
oidc_session_t *session, int expires_in) {
if (expires_in != -1) {
oidc_session_set(r, session, OIDC_ACCESSTOKEN_EXPIRES_SESSION_KEY,
apr_psprintf(r->pool, "%" APR_TIME_T_FMT,
apr_time_sec(apr_time_now()) + expires_in));
}
} | 0 | null | -1 | https://github.com/OpenIDC/mod_auth_openidc/commit/612e309bfffd6f9b8ad7cdccda3019fc0865f3b4 | 0CCPP |
function idX(id) { return id }; | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/f768ed73875d5eca20110b9c1d72f2789cd1bab7 | 3JavaScript |
snmp_mib_find_next(uint32_t *oid)
{
snmp_mib_resource_t *resource;
resource = NULL;
for(resource = list_head(snmp_mib);
resource; resource = resource->next) {
if(snmp_oid_cmp_oid(resource->oid, oid) > 0) {
return resource;
}
}
return NULL;
} | 1 | 0,6 | -1 | https://github.com/contiki-ng/contiki-ng/commit/12c824386ab60de757de5001974d73b32e19ad71 | 0CCPP |
mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){var p=this.state.scale;mxSvgCanvas2D.createCss(c+2,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor:null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end":
"center")+"; ",this.getTextCss(),p,mxUtils.bind(this,function(q,r,t,u,x){a+=this.state.dx;b+=this.state.dy;var y=n.firstChild,C=y.firstChild,A=C.firstChild,B=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0),z=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+")":"")+(1!=p?"scale("+p+")":"");this.setCssText(A.firstChild,x);this.setCssText(A,u);A.setAttribute("data-drawio-colors","color: "+this.state.fontColor+"; "+(null==this.state.fontBackgroundColor?"":"background-color: "+this.state.fontBackgroundColor+
"; ")+(null==this.state.fontBorderColor?"":"border-color: "+this.state.fontBorderColor+"; "));y.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");y.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");r=Math.round(b+r);0>r?y.setAttribute("y",r):(y.removeAttribute("y"),t+="padding-top: "+r+"px; ");this.setCssText(C,t+"margin-left: "+Math.round(a+q)+"px;");z+=0!=B?"rotate("+B+" "+a+" "+b+")":"";""!=z?n.setAttribute("transform",z):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",
this.state.alpha):n.removeAttribute("opacity")}))}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
Graph.sanitizeHtml=function(b,e){return DOMPurify.sanitize(b,{ADD_ATTR:["target"],FORBID_TAGS:["form"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|callto|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i})};Graph.sanitizeSvg=function(b){return DOMPurify.sanitize(b,{IN_PLACE:!0})}; | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/7a68ebe22a64fe722704e9c4527791209fee2034 | 3JavaScript |
public VFSItem resolve(String path) {
return rootContainer.resolve(path);
} | 0 | null | -1 | https://github.com/OpenOLAT/OpenOLAT/commit/5668a41ab3f1753102a89757be013487544279d5 | 2Java |
static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
u8 *dst, const u8 *src)
{
crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
dst, src);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/94f1bb15bed84ad6c893916b7e7b9db6f1d7eec6 | 0CCPP |
bool HHVM_FUNCTION(HH_global_key_exists, StringArg key) {
return g_context->m_globalNVTable->lookup(key.get()) != nullptr;
} | 0 | null | -1 | https://github.com/facebook/hhvm/commit/08193b7f0cd3910256e00d599f0f3eb2519c44ca | 0CCPP |
def safe_text(raw_text: str) -> jinja2.Markup:
return jinja2.Markup(
bleach.linkify(bleach.clean(raw_text, tags=[], attributes={}, strip=False))
)
| 1 | null | -1 | https://github.com/matrix-org/synapse.git/commit/e54746bdf7d5c831eabe4dcea76a7626f1de73df | 4Python |
static int ext3_write_info(struct super_block *sb, int type)
{
int ret, err;
handle_t *handle;
handle = ext3_journal_start(sb->s_root->d_inode, 2);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = dquot_commit_info(sb, type);
err = ext3_journal_stop(handle);
if (!ret)
ret = err;
return ret;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/8d0c2d10dd72c5292eda7a06231056a4c972e4cc | 0CCPP |
static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
struct vsock_sock *vsk,
struct msghdr *msg, size_t len,
int flags)
{
int err;
int noblock;
struct vmci_datagram *dg;
size_t payload_len;
struct sk_buff *skb;
noblock = flags & MSG_DONTWAIT;
if (flags & MSG_OOB || flags & MSG_ERRQUEUE)
return -EOPNOTSUPP;
msg->msg_namelen = 0;
err = 0;
skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err);
if (err)
return err;
if (!skb)
return -EAGAIN;
dg = (struct vmci_datagram *)skb->data;
if (!dg)
goto out;
payload_len = dg->payload_size;
if (payload_len != skb->len - sizeof(*dg)) {
err = -EINVAL;
goto out;
}
if (payload_len > len) {
payload_len = len;
msg->msg_flags |= MSG_TRUNC;
}
err = skb_copy_datagram_iovec(skb, sizeof(*dg), msg->msg_iov,
payload_len);
if (err)
goto out;
if (msg->msg_name) {
struct sockaddr_vm *vm_addr;
vm_addr = (struct sockaddr_vm *)msg->msg_name;
vsock_addr_init(vm_addr, dg->src.context, dg->src.resource);
msg->msg_namelen = sizeof(*vm_addr);
}
err = payload_len;
out:
skb_free_datagram(&vsk->sk, skb);
return err;
} | 1 | 13 | -1 | https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | 0CCPP |
static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
{
struct usb_device *dev = chip->dev;
struct usb_host_interface *host_iface;
struct usb_interface_descriptor *altsd;
void *control_header;
int i, protocol;
host_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0];
control_header = snd_usb_find_csint_desc(host_iface->extra,
host_iface->extralen,
NULL, UAC_HEADER);
altsd = get_iface_desc(host_iface);
protocol = altsd->bInterfaceProtocol;
if (!control_header) {
dev_err(&dev->dev, "cannot find UAC_HEADER\n");
return -EINVAL;
}
switch (protocol) {
default:
dev_warn(&dev->dev,
"unknown interface protocol %#02x, assuming v1\n",
protocol);
case UAC_VERSION_1: {
struct uac1_ac_header_descriptor *h1 = control_header;
if (!h1->bInCollection) {
dev_info(&dev->dev, "skipping empty audio interface (v1)\n");
return -EINVAL;
}
if (h1->bLength < sizeof(*h1) + h1->bInCollection) {
dev_err(&dev->dev, "invalid UAC_HEADER (v1)\n");
return -EINVAL;
}
for (i = 0; i < h1->bInCollection; i++)
snd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]);
break;
}
case UAC_VERSION_2: {
struct usb_interface_assoc_descriptor *assoc =
usb_ifnum_to_if(dev, ctrlif)->intf_assoc;
if (!assoc) {
struct usb_interface *iface =
usb_ifnum_to_if(dev, ctrlif + 1);
if (iface &&
iface->intf_assoc &&
iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&
iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)
assoc = iface->intf_assoc;
}
if (!assoc) {
dev_err(&dev->dev, "Audio class v2 interfaces need an interface association\n");
return -EINVAL;
}
for (i = 0; i < assoc->bInterfaceCount; i++) {
int intf = assoc->bFirstInterface + i;
if (intf != ctrlif)
snd_usb_create_stream(chip, ctrlif, intf);
}
break;
}
}
return 0;
} | 1 | null | -1 | https://github.com/torvalds/linux/commit/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991 | 0CCPP |
static inline int xrstor_state(struct xsave_struct *fx, u64 mask)
{
int err = 0;
u32 lmask = mask;
u32 hmask = mask >> 32;
alternative_input(
"1: " XRSTOR,
"1: " XRSTORS,
X86_FEATURE_XSAVES,
"D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
asm volatile("2:\n"
xstate_fault
: "0" (0)
: "memory");
return err;
} | 1 | 7 | -1 | https://github.com/torvalds/linux/commit/06c8173eb92bbfc03a0fe8bb64315857d0badd06 | 0CCPP |
GF_Err iSLT_dump(GF_Box *a, FILE * trace)
{
GF_ISMACrypSaltBox *p = (GF_ISMACrypSaltBox *)a;
gf_isom_box_dump_start(a, "ISMACrypSaltBox", trace);
fprintf(trace, "salt=\""LLU"\">\n", p->salt);
gf_isom_box_dump_done("ISMACrypSaltBox", a, trace);
return GF_OK;
} | 0 | null | -1 | https://github.com/gpac/gpac/commit/bceb03fd2be95097a7b409ea59914f332fb6bc86 | 0CCPP |
static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, struct sk_buff *skb)
{
struct nfc_llcp_sock *llcp_sock;
struct sock *sk;
u8 dsap, ssap;
dsap = nfc_llcp_dsap(skb);
ssap = nfc_llcp_ssap(skb);
llcp_sock = nfc_llcp_connecting_sock_get(local, dsap);
if (llcp_sock == NULL) {
pr_err("Invalid CC\n");
nfc_llcp_send_dm(local, dsap, ssap, LLCP_DM_NOCONN);
return;
}
sk = &llcp_sock->sk;
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
nfc_llcp_sock_link(&local->sockets, sk);
llcp_sock->dsap = ssap;
nfc_llcp_parse_connection_tlv(llcp_sock, &skb->data[LLCP_HEADER_SIZE],
skb->len - LLCP_HEADER_SIZE);
sk->sk_state = LLCP_CONNECTED;
sk->sk_state_change(sk);
nfc_llcp_sock_put(llcp_sock);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/58bdd544e2933a21a51eecf17c3f5f94038261b5 | 0CCPP |
get_vertical_data(Repodata *data, Repokey *key, Id off, Id len)
{
unsigned char *dp;
if (len <= 0)
return 0;
if (off >= data->lastverticaloffset)
{
off -= data->lastverticaloffset;
if ((unsigned int)off + len > data->vincorelen)
return 0;
return data->vincore + off;
}
if ((unsigned int)off + len > key->size)
return 0;
off += data->verticaloffset[key - data->keys];
dp = repopagestore_load_page_range(&data->store, off / REPOPAGE_BLOBSIZE, (off + len - 1) / REPOPAGE_BLOBSIZE);
data->storestate++;
if (dp)
dp += off % REPOPAGE_BLOBSIZE;
return dp;
} | 0 | null | -1 | https://github.com/openSUSE/libsolv/commit/fdb9c9c03508990e4583046b590c30d958f272da | 0CCPP |
public void setValue(String value) {
this.value = value;
this.valueAsBigInteger = new BigInteger(value);
} | 1 | 0,1,2,3 | -1 | https://github.com/NationalSecurityAgency/ghidra/commit/5adfe717dbb4bcef3300be2f846a6a7182021b0b | 2Java |
static void show_stacktrace(struct task_struct *task,
const struct pt_regs *regs)
{
const int field = 2 * sizeof(unsigned long);
long stackdata;
int i;
unsigned long __user *sp = (unsigned long __user *)regs->regs[29];
printk("Stack :");
i = 0;
while ((unsigned long) sp & (PAGE_SIZE - 1)) {
if (i && ((i % (64 / field)) == 0))
printk("\n ");
if (i > 39) {
printk(" ...");
break;
}
if (__get_user(stackdata, sp++)) {
printk(" (Bad stack address)");
break;
}
printk(" %0*lx", field, stackdata);
i++;
}
printk("\n");
show_backtrace(task, regs);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
callback : function(all) {
!last && !all
? confirm(++ndx)
: paste(files);
} | 1 | 0,1,2,3,4 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.