processed_func string | target int64 | flaw_line string | flaw_line_index int64 | commit_url string | language class label |
|---|---|---|---|---|---|
static inline bool vt_in_use(unsigned int i)
{
const struct vc_data *vc = vc_cons[i].d;
WARN_CONSOLE_UNLOCKED();
return vc && kref_read(&vc->port.kref) > 1;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/2287a51ba822384834dafc1c798453375d1107c7 | 0CCPP |
gssrpc__svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg,
bool_t *no_dispatch)
{
enum auth_stat retstat;
XDR xdrs;
SVCAUTH *auth;
struct svc_rpc_gss_data *gd;
struct rpc_gss_cred *gc;
struct rpc_gss_init_res gr;
int call_stat, offset;
OM_uint32 min_stat;
log_debug("in svcauth_gss()");
rqst->rq_xprt->xp_verf = gssrpc__null_auth;
if (rqst->rq_xprt->xp_auth == NULL ||
rqst->rq_xprt->xp_auth == &svc_auth_none) {
if ((auth = calloc(sizeof(*auth), 1)) == NULL) {
fprintf(stderr, "svcauth_gss: out_of_memory\n");
return (AUTH_FAILED);
}
if ((gd = calloc(sizeof(*gd), 1)) == NULL) {
fprintf(stderr, "svcauth_gss: out_of_memory\n");
return (AUTH_FAILED);
}
auth->svc_ah_ops = &svc_auth_gss_ops;
SVCAUTH_PRIVATE(auth) = gd;
rqst->rq_xprt->xp_auth = auth;
}
else gd = SVCAUTH_PRIVATE(rqst->rq_xprt->xp_auth);
log_debug("xp_auth=%p, gd=%p", rqst->rq_xprt->xp_auth, gd);
if (rqst->rq_cred.oa_length <= 0)
return (AUTH_BADCRED);
gc = (struct rpc_gss_cred *)rqst->rq_clntcred;
memset(gc, 0, sizeof(*gc));
log_debug("calling xdrmem_create()");
log_debug("oa_base=%p, oa_length=%u", rqst->rq_cred.oa_base,
rqst->rq_cred.oa_length);
xdrmem_create(&xdrs, rqst->rq_cred.oa_base,
rqst->rq_cred.oa_length, XDR_DECODE);
log_debug("xdrmem_create() returned");
if (!xdr_rpc_gss_cred(&xdrs, gc)) {
log_debug("xdr_rpc_gss_cred() failed");
XDR_DESTROY(&xdrs);
return (AUTH_BADCRED);
}
XDR_DESTROY(&xdrs);
retstat = AUTH_FAILED;
#define ret_freegc(code) do { retstat = code; goto freegc; } while (0)
if (gc->gc_v != RPCSEC_GSS_VERSION)
ret_freegc (AUTH_BADCRED);
if (gc->gc_svc != RPCSEC_GSS_SVC_NONE &&
gc->gc_svc != RPCSEC_GSS_SVC_INTEGRITY &&
gc->gc_svc != RPCSEC_GSS_SVC_PRIVACY)
ret_freegc (AUTH_BADCRED);
if (gd->established) {
if (gc->gc_seq > MAXSEQ)
ret_freegc (RPCSEC_GSS_CTXPROBLEM);
if ((offset = gd->seqlast - gc->gc_seq) < 0) {
gd->seqlast = gc->gc_seq;
offset = 0 - offset;
gd->seqmask <<= offset;
offset = 0;
} else if ((u_int)offset >= gd->win ||
(gd->seqmask & (1 << offset))) {
*no_dispatch = 1;
ret_freegc (RPCSEC_GSS_CTXPROBLEM);
}
gd->seq = gc->gc_seq;
gd->seqmask |= (1 << offset);
}
if (gd->established) {
rqst->rq_clntname = (char *)gd->client_name;
rqst->rq_svccred = (char *)gd->ctx;
}
switch (gc->gc_proc) {
case RPCSEC_GSS_INIT:
case RPCSEC_GSS_CONTINUE_INIT:
if (rqst->rq_proc != NULLPROC)
ret_freegc (AUTH_FAILED);
if (!svcauth_gss_acquire_cred())
ret_freegc (AUTH_FAILED);
if (!svcauth_gss_accept_sec_context(rqst, &gr))
ret_freegc (AUTH_REJECTEDCRED);
if (!svcauth_gss_nextverf(rqst, htonl(gr.gr_win))) {
gss_release_buffer(&min_stat, &gr.gr_token);
mem_free(gr.gr_ctx.value,
sizeof(gss_union_ctx_id_desc));
ret_freegc (AUTH_FAILED);
}
*no_dispatch = TRUE;
call_stat = svc_sendreply(rqst->rq_xprt, xdr_rpc_gss_init_res,
(caddr_t)&gr);
gss_release_buffer(&min_stat, &gr.gr_token);
gss_release_buffer(&min_stat, &gd->checksum);
mem_free(gr.gr_ctx.value, sizeof(gss_union_ctx_id_desc));
if (!call_stat)
ret_freegc (AUTH_FAILED);
if (gr.gr_major == GSS_S_COMPLETE)
gd->established = TRUE;
break;
case RPCSEC_GSS_DATA:
if (!svcauth_gss_validate(rqst, gd, msg))
ret_freegc (RPCSEC_GSS_CREDPROBLEM);
if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
ret_freegc (AUTH_FAILED);
break;
case RPCSEC_GSS_DESTROY:
if (rqst->rq_proc != NULLPROC)
ret_freegc (AUTH_FAILED);
if (!svcauth_gss_validate(rqst, gd, msg))
ret_freegc (RPCSEC_GSS_CREDPROBLEM);
if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
ret_freegc (AUTH_FAILED);
*no_dispatch = TRUE;
call_stat = svc_sendreply(rqst->rq_xprt,
xdr_void, (caddr_t)NULL);
log_debug("sendreply in destroy: %d", call_stat);
if (!svcauth_gss_release_cred())
ret_freegc (AUTH_FAILED);
SVCAUTH_DESTROY(rqst->rq_xprt->xp_auth);
rqst->rq_xprt->xp_auth = &svc_auth_none;
break;
default:
ret_freegc (AUTH_REJECTEDCRED);
break;
}
retstat = AUTH_OK;
freegc:
xdr_free(xdr_rpc_gss_cred, gc);
log_debug("returning %d from svcauth_gss()", retstat);
return (retstat);
} | 1 | 84,85,93 | -1 | https://github.com/krb5/krb5/commit/5bb8a6b9c9eb8dd22bc9526751610aaa255ead9c | 0CCPP |
ut64 MACH0_(get_main)(struct MACH0_(obj_t)* bin) {
ut64 addr = 0LL;
struct symbol_t *symbols;
int i;
if (!(symbols = MACH0_(get_symbols) (bin))) {
return 0;
}
for (i = 0; !symbols[i].last; i++) {
if (!strcmp (symbols[i].name, "_main")) {
addr = symbols[i].addr;
break;
}
}
free (symbols);
if (!addr && bin->main_cmd.cmd == LC_MAIN) {
addr = bin->entry + bin->baddr;
}
if (!addr) {
ut8 b[128];
ut64 entry = addr_to_offset(bin, bin->entry);
if (entry > bin->size || entry + sizeof (b) > bin->size)
return 0;
i = r_buf_read_at (bin->b, entry, b, sizeof (b));
if (i < 1) {
return 0;
}
for (i = 0; i < 64; i++) {
if (b[i] == 0xe8 && !b[i+3] && !b[i+4]) {
int delta = b[i+1] | (b[i+2] << 8) | (b[i+3] << 16) | (b[i+4] << 24);
return bin->entry + i + 5 + delta;
}
}
}
return addr;
} | 1 | 20 | -1 | https://github.com/radareorg/radare2/commit/d1e8ac62c6d978d4662f69116e30230d43033c92 | 0CCPP |
public List<Object> updateObjectsFromRequest(String className, String prefix) throws XWikiException
{
List<BaseObject> objs = getDoc().updateObjectsFromRequest(className, prefix, getXWikiContext());
List<Object> wrapped = new ArrayList<Object>();
for (BaseObject object : objs) {
wrapped.add(new com.xpn.xwiki.api.Object(object, getXWikiContext()));
}
updateAuthor();
return wrapped;
} | 0 | null | -1 | https://github.com/xwiki/xwiki-platform/commit/7ab0fe7b96809c7a3881454147598d46a1c9bbbe | 2Java |
BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
{
int x, y, pos;
Wbmp *wbmp;
if((wbmp = createwbmp(gdImageSX(image), gdImageSY(image), WBMP_WHITE)) == NULL) {
gd_error("Could not create WBMP\n");
return;
}
pos = 0;
for(y = 0; y < gdImageSY(image); y++) {
for(x = 0; x < gdImageSX(image); x++) {
if(gdImageGetPixel(image, x, y) == fg) {
wbmp->bitmap[pos] = WBMP_BLACK;
}
pos++;
}
}
if(writewbmp(wbmp, &gd_putout, out)) {
gd_error("Could not save WBMP\n");
}
freewbmp(wbmp);
} | 1 | 6 | -1 | https://github.com/libgd/libgd/commit/553702980ae89c83f2d6e254d62cf82e204956d0 | 0CCPP |
static void frob_text(const struct module_layout *layout,
int (*set_memory)(unsigned long start, int num_pages))
{
BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1));
BUG_ON((unsigned long)layout->text_size & (PAGE_SIZE-1));
set_memory((unsigned long)layout->base,
layout->text_size >> PAGE_SHIFT);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/0c18f29aae7ce3dadd26d8ee3505d07cc982df75 | 0CCPP |
internal void WriteSubscriptionXml(XmlTextWriter xmlWriter, bool embedded)
{
xmlWriter.WriteStartElement("subscription");
xmlWriter.WriteElementString("plan_code", PlanCode);
if (!embedded)
{
Account.WriteXml(xmlWriter);
xmlWriter.WriteElementString("currency", Currency);
xmlWriter.WriteElementString("customer_notes", CustomerNotes);
xmlWriter.WriteElementString("terms_and_conditions", TermsAndConditions);
xmlWriter.WriteElementString("vat_reverse_charge_notes", VatReverseChargeNotes);
xmlWriter.WriteElementString("po_number", PoNumber);
}
xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);
xmlWriter.WriteStringIfValid("coupon_code", _couponCode);
if (_couponCodes != null && _couponCodes.Length != 0) {
xmlWriter.WriteStartElement("coupon_codes");
foreach (var _coupon_code in _couponCodes)
{
xmlWriter.WriteElementString("coupon_code", _coupon_code);
}
xmlWriter.WriteEndElement();
}
if (UnitAmountInCents.HasValue)
xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
xmlWriter.WriteElementString("quantity", Quantity.AsString());
if (TrialPeriodEndsAt.HasValue)
xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
if (BankAccountAuthorizedAt.HasValue)
xmlWriter.WriteElementString("bank_account_authorized_at", BankAccountAuthorizedAt.Value.ToString("s"));
if (StartsAt.HasValue)
xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
if (TotalBillingCycles.HasValue)
xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
if (FirstRenewalDate.HasValue)
xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
if (Bulk.HasValue)
xmlWriter.WriteElementString("bulk", Bulk.ToString().ToLower());
if (CollectionMethod.Like("manual"))
{
xmlWriter.WriteElementString("collection_method", "manual");
if (NetTerms.HasValue)
xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
}
else if (CollectionMethod.Like("automatic"))
xmlWriter.WriteElementString("collection_method", "automatic");
if (ShippingAddressId.HasValue)
{
xmlWriter.WriteElementString("shipping_address_id", ShippingAddressId.Value.ToString());
}
if (ImportedTrial.HasValue)
{
xmlWriter.WriteElementString("imported_trial", ImportedTrial.Value.ToString().ToLower());
}
if (RevenueScheduleType.HasValue)
xmlWriter.WriteElementString("revenue_schedule_type", RevenueScheduleType.Value.ToString().EnumNameToTransportCase());
xmlWriter.WriteEndElement();
} | 0 | null | -1 | https://github.com/recurly/recurly-client-dotnet/commit/9eef460c0084afd5c24d66220c8b7a381cf9a1f1 | 1CS |
static int get_debug_info(struct PE_(r_bin_pe_obj_t)* bin, PE_(image_debug_directory_entry)* dbg_dir_entry, ut8* dbg_data, int dbg_data_len, SDebugInfo* res) {
#define SIZEOF_FILE_NAME 255
int i = 0;
const char* basename;
if (!dbg_data) {
return 0;
}
switch (dbg_dir_entry->Type) {
case IMAGE_DEBUG_TYPE_CODEVIEW:
if (!strncmp ((char*) dbg_data, "RSDS", 4)) {
SCV_RSDS_HEADER rsds_hdr;
init_rsdr_hdr (&rsds_hdr);
if (!get_rsds (dbg_data, dbg_data_len, &rsds_hdr)) {
bprintf ("Warning: Cannot read PE debug info\n");
return 0;
}
snprintf (res->guidstr, GUIDSTR_LEN,
"%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x%x",
rsds_hdr.guid.data1,
rsds_hdr.guid.data2,
rsds_hdr.guid.data3,
rsds_hdr.guid.data4[0],
rsds_hdr.guid.data4[1],
rsds_hdr.guid.data4[2],
rsds_hdr.guid.data4[3],
rsds_hdr.guid.data4[4],
rsds_hdr.guid.data4[5],
rsds_hdr.guid.data4[6],
rsds_hdr.guid.data4[7],
rsds_hdr.age);
basename = r_file_basename ((char*) rsds_hdr.file_name);
strncpy (res->file_name, (const char*)
basename, sizeof (res->file_name));
res->file_name[sizeof (res->file_name) - 1] = 0;
rsds_hdr.free ((struct SCV_RSDS_HEADER*) &rsds_hdr);
} else if (strncmp ((const char*) dbg_data, "NB10", 4) == 0) {
SCV_NB10_HEADER nb10_hdr;
init_cv_nb10_header (&nb10_hdr);
get_nb10 (dbg_data, &nb10_hdr);
snprintf (res->guidstr, sizeof (res->guidstr),
"%x%x", nb10_hdr.timestamp, nb10_hdr.age);
strncpy (res->file_name, (const char*)
nb10_hdr.file_name, sizeof(res->file_name) - 1);
res->file_name[sizeof (res->file_name) - 1] = 0;
nb10_hdr.free ((struct SCV_NB10_HEADER*) &nb10_hdr);
} else {
bprintf ("CodeView section not NB10 or RSDS\n");
return 0;
}
break;
default:
return 0;
}
while (i < 33) {
res->guidstr[i] = toupper ((int) res->guidstr[i]);
i++;
}
return 1;
} | 1 | 36,41,42 | -1 | https://github.com/radareorg/radare2/commit/4e1cf0d3e6f6fe2552a269def0af1cd2403e266c | 0CCPP |
static void chase_port(struct edgeport_port *port, unsigned long timeout,
int flush)
{
int baud_rate;
struct tty_struct *tty = tty_port_tty_get(&port->port->port);
struct usb_serial *serial = port->port->serial;
wait_queue_t wait;
unsigned long flags;
if (!timeout)
timeout = (HZ * EDGE_CLOSING_WAIT)/100;
spin_lock_irqsave(&port->ep_lock, flags);
init_waitqueue_entry(&wait, current);
add_wait_queue(&tty->write_wait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (kfifo_len(&port->write_fifo) == 0
|| timeout == 0 || signal_pending(current)
|| serial->disconnected)
break;
spin_unlock_irqrestore(&port->ep_lock, flags);
timeout = schedule_timeout(timeout);
spin_lock_irqsave(&port->ep_lock, flags);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&tty->write_wait, &wait);
if (flush)
kfifo_reset_out(&port->write_fifo);
spin_unlock_irqrestore(&port->ep_lock, flags);
tty_kref_put(tty);
timeout += jiffies;
while ((long)(jiffies - timeout) < 0 && !signal_pending(current)
&& !serial->disconnected) {
if (!tx_active(port))
break;
msleep(10);
}
if (serial->disconnected)
return;
baud_rate = port->baud_rate;
if (baud_rate == 0)
baud_rate = 50;
msleep(max(1, DIV_ROUND_UP(10000, baud_rate)));
} | 1 | null | -1 | https://github.com/torvalds/linux/commit/1ee0a224bc9aad1de496c795f96bc6ba2c394811 | 0CCPP |
getClass (type: 'avatar' | 'initial') {
const base = [ 'avatar' ]
if (this.size) base.push(`avatar-${this.size}`)
if (this.channel) base.push('channel')
else base.push('account')
if (type === 'initial' && this.initial) {
base.push('initial')
base.push(this.getColorTheme())
}
return base
} | 0 | null | -1 | https://github.com/chocobozzz/peertube/commit/0ea2f79d45b301fcd660efc894469a99b2239bf6 | 5TypeScript |
export function get(key: "apiUrl"): string;
export function get(key: "images.markdownPasteFormat"): "markdown" | "html"; | 1 | 0 | -1 | https://github.com/lostintangent/gistpad/commit/230b05e8dea8d7ac5aae998bbe0a591d7f081b70 | 5TypeScript |
int GetAsnTimeString(void* currTime, byte* buf, word32 len)
{
struct tm* ts = NULL;
struct tm* tmpTime = NULL;
byte* data_ptr = buf;
word32 data_len = 0;
int year, mon, day, hour, mini, sec;
#if defined(NEED_TMP_TIME)
struct tm tmpTimeStorage;
tmpTime = &tmpTimeStorage;
#else
(void)tmpTime;
#endif
WOLFSSL_ENTER("SetAsnTimeString");
if (buf == NULL || len == 0)
return BAD_FUNC_ARG;
ts = (struct tm *)XGMTIME((time_t*)currTime, tmpTime);
if (ts == NULL){
WOLFSSL_MSG("failed to get time data.");
return ASN_TIME_E;
}
if (ts->tm_year >= 50 && ts->tm_year < 150) {
char utc_str[ASN_UTC_TIME_SIZE];
data_len = ASN_UTC_TIME_SIZE - 1 + 2;
if (len < data_len)
return BUFFER_E;
if (ts->tm_year >= 50 && ts->tm_year < 100) {
year = ts->tm_year;
} else if (ts->tm_year >= 100 && ts->tm_year < 150) {
year = ts->tm_year - 100;
}
else {
WOLFSSL_MSG("unsupported year range");
return BAD_FUNC_ARG;
}
mon = ts->tm_mon + 1;
day = ts->tm_mday;
hour = ts->tm_hour;
mini = ts->tm_min;
sec = ts->tm_sec;
XSNPRINTF((char *)utc_str, ASN_UTC_TIME_SIZE,
"%02d%02d%02d%02d%02d%02dZ", year, mon, day, hour, mini, sec);
*data_ptr = (byte) ASN_UTC_TIME; data_ptr++;
*data_ptr = (byte) ASN_UTC_TIME_SIZE - 1; data_ptr++;
XMEMCPY(data_ptr,(byte *)utc_str, ASN_UTC_TIME_SIZE - 1);
} else {
char gt_str[ASN_GENERALIZED_TIME_SIZE];
data_len = ASN_GENERALIZED_TIME_SIZE - 1 + 2;
if (len < data_len)
return BUFFER_E;
year = ts->tm_year + 1900;
mon = ts->tm_mon + 1;
day = ts->tm_mday;
hour = ts->tm_hour;
mini = ts->tm_min;
sec = ts->tm_sec;
XSNPRINTF((char *)gt_str, ASN_GENERALIZED_TIME_SIZE,
"%4d%02d%02d%02d%02d%02dZ", year, mon, day, hour, mini, sec);
*data_ptr = (byte) ASN_GENERALIZED_TIME; data_ptr++;
*data_ptr = (byte) ASN_GENERALIZED_TIME_SIZE - 1; data_ptr++;
XMEMCPY(data_ptr,(byte *)gt_str, ASN_GENERALIZED_TIME_SIZE - 1);
}
return data_len;
} | 0 | null | -1 | https://github.com/wolfSSL/wolfssl/commit/f93083be72a3b3d956b52a7ec13f307a27b6e093 | 0CCPP |
TIFFReadDirEntryCheckRangeLong8Slong8(int64 value)
{
if (value < 0)
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
} | 0 | null | -1 | https://github.com/vadz/libtiff/commit/9a72a69e035ee70ff5c41541c8c61cd97990d018 | 0CCPP |
int cipso_v4_sock_setattr(struct sock *sk,
const struct cipso_v4_doi *doi_def,
const struct netlbl_lsm_secattr *secattr)
{
int ret_val = -EPERM;
unsigned char *buf = NULL;
u32 buf_len;
u32 opt_len;
struct ip_options *opt = NULL;
struct inet_sock *sk_inet;
struct inet_connection_sock *sk_conn;
if (sk == NULL)
return 0;
buf_len = CIPSO_V4_OPT_LEN_MAX;
buf = kmalloc(buf_len, GFP_ATOMIC);
if (buf == NULL) {
ret_val = -ENOMEM;
goto socket_setattr_failure;
}
ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
if (ret_val < 0)
goto socket_setattr_failure;
buf_len = ret_val;
opt_len = (buf_len + 3) & ~3;
opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC);
if (opt == NULL) {
ret_val = -ENOMEM;
goto socket_setattr_failure;
}
memcpy(opt->__data, buf, buf_len);
opt->optlen = opt_len;
opt->cipso = sizeof(struct iphdr);
kfree(buf);
buf = NULL;
sk_inet = inet_sk(sk);
if (sk_inet->is_icsk) {
sk_conn = inet_csk(sk);
if (sk_inet->opt)
sk_conn->icsk_ext_hdr_len -= sk_inet->opt->optlen;
sk_conn->icsk_ext_hdr_len += opt->optlen;
sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie);
}
opt = xchg(&sk_inet->opt, opt);
kfree(opt);
return 0;
socket_setattr_failure:
kfree(buf);
kfree(opt);
return ret_val;
} | 1 | 8,29,30,31,37,38,39,42,43 | -1 | https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259 | 0CCPP |
def getitem(self, obj, argument):
try:
return obj[argument]
except (TypeError, LookupError):
if isinstance(argument, string_types):
try:
attr = str(argument)
except Exception:
pass
else:
try:
value = getattr(obj, attr)
except AttributeError:
pass
else:
if self.is_safe_attribute(obj, argument, value):
return value
return self.unsafe_undefined(obj, argument)
return self.undefined(obj=obj, name=argument)
| 0 | null | -1 | https://github.com/pallets/jinja.git/commit/9b53045c34e61013dc8f09b7e52a555fa16bed16 | 4Python |
static void iov_fault_in_pages_read(struct iovec *iov, unsigned long len)
{
while (!iov->iov_len)
iov++;
while (len > 0) {
unsigned long this_len;
this_len = min_t(unsigned long, len, iov->iov_len);
fault_in_pages_readable(iov->iov_base, this_len);
len -= this_len;
iov++;
}
} | 1 | 0,1,2,3,4,5,6,7,8,9,10,11 | -1 | https://github.com/torvalds/linux/commit/f0d1bec9d58d4c038d0ac958c9af82be6eb18045 | 0CCPP |
void nfs_commitdata_release(struct nfs_commit_data *data)
{
put_nfs_open_context(data->context);
nfs_commit_free(data);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/263b4509ec4d47e0da3e753f85a39ea12d1eff24 | 0CCPP |
Client.prototype.destroy = function() {
this._sock && this._sock.destroy();
}; | 1 | 0,1,2 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name)
{
struct device *dev = &priv->udev->dev;
const struct firmware *fw;
int ret = 0;
u16 signature;
dev_info(dev, "%s: Loading firmware %s\n", DRIVER_NAME, fw_name);
if (request_firmware(&fw, fw_name, &priv->udev->dev)) {
dev_warn(dev, "request_firmware(%s) failed\n", fw_name);
ret = -EAGAIN;
goto exit;
}
if (!fw) {
dev_warn(dev, "Firmware data not available\n");
ret = -EINVAL;
goto exit;
}
priv->fw_data = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!priv->fw_data) {
ret = -ENOMEM;
goto exit;
}
priv->fw_size = fw->size - sizeof(struct rtl8xxxu_firmware_header);
signature = le16_to_cpu(priv->fw_data->signature);
switch (signature & 0xfff0) {
case 0x92e0:
case 0x92c0:
case 0x88c0:
case 0x5300:
case 0x2300:
break;
default:
ret = -EINVAL;
dev_warn(dev, "%s: Invalid firmware signature: 0x%04x\n",
__func__, signature);
}
dev_info(dev, "Firmware revision %i.%i (signature 0x%04x)\n",
le16_to_cpu(priv->fw_data->major_version),
priv->fw_data->minor_version, signature);
exit:
release_firmware(fw);
return ret;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/a2cdd07488e666aa93a49a3fc9c9b1299e27ef3c | 0CCPP |
def decrypt(self, k, a, iv, e, t):
raise NotImplementedError
| 0 | null | -1 | https://github.com/latchset/jwcrypto.git/commit/eb5be5bd94c8cae1d7f3ba9801377084d8e5a7ba | 4Python |
private URL findPathConsideringContracts(ClassLoader loader,
LibraryInfo library,
String resourceName,
String localePrefix,
ContractInfo [] outContract,
String [] outBasePath,
FacesContext ctx) {
UIViewRoot root = ctx.getViewRoot();
List<String> contracts = null;
URL result = null;
if (library != null) {
if(library.getContract() == null) {
contracts = Collections.emptyList();
} else {
contracts = new ArrayList<String>(1);
contracts.add(library.getContract());
}
} else if (root == null) {
String contractName = ctx.getExternalContext().getRequestParameterMap()
.get("con");
if (null != contractName && 0 < contractName.length()) {
contracts = new ArrayList<>();
contracts.add(contractName);
} else {
return null;
}
} else {
contracts = ctx.getResourceLibraryContracts();
}
String basePath = null;
for (String curContract : contracts) {
if (library != null) {
basePath = library.getPath(localePrefix) + '/' + resourceName;
} else {
if (localePrefix == null) {
basePath = getBaseContractsPath() + '/' + curContract + '/' + resourceName;
} else {
basePath = getBaseContractsPath()
+ '/' + curContract
+ '/'
+ localePrefix
+ '/'
+ resourceName;
}
}
if (null != (result = loader.getResource(basePath))) {
outContract[0] = new ContractInfo(curContract);
outBasePath[0] = basePath;
break;
} else {
basePath = null;
}
}
return result;
} | 1 | 20 | -1 | https://github.com/eclipse-ee4j/mojarra/commit/cefbb9447e7be560e59da2da6bd7cb93776f7741 | 2Java |
export function get_full_time(timestamp: number): string {
return formatISO(timestamp * 1000);
} | 0 | null | -1 | https://github.com/zulip/zulip/commit/e090027adcbf62737d5b1f83a9618a9500a49321 | 5TypeScript |
void file_bcast_purge(void)
{
_fb_wrlock();
list_destroy(file_bcast_list);
} | 0 | null | -1 | https://github.com/SchedMD/slurm/commit/92362a92fffe60187df61f99ab11c249d44120ee | 0CCPP |
public PlayerRobustConcise(TimingStyle type, String full, ISkinParam skinParam, TimingRuler ruler,
boolean compact) {
super(full, skinParam, ruler, compact);
this.type = type;
this.suggestedHeight = 0;
} | 1 | 0,1,2 | -1 | https://github.com/plantuml/plantuml/commit/93e5964e5f35914f3f7b89de620c596795550083 | 2Java |
__acquires(&tty->atomic_write_lock)
{
if (!mutex_trylock(&tty->atomic_write_lock)) {
if (ndelay)
return -EAGAIN;
if (mutex_lock_interruptible(&tty->atomic_write_lock))
return -ERESTARTSYS;
}
return 0;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/c290f8358acaeffd8e0c551ddcc24d1206143376 | 0CCPP |
close : function() {
delete self.dialog;
dfrd.state() == 'pending' && dfrd.reject();
}, | 1 | 0,1,2,3 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
is_link_trusted (NautilusFile *file,
gboolean is_launcher)
{
GFile *location;
gboolean res;
if (!is_launcher)
{
return TRUE;
}
if (nautilus_file_can_execute (file))
{
return TRUE;
}
res = FALSE;
if (nautilus_file_is_local (file))
{
location = nautilus_file_get_location (file);
res = nautilus_is_in_system_dir (location);
g_object_unref (location);
}
return res;
} | 1 | 9 | -1 | https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0 | 0CCPP |
static inline __be32 try_6rd(struct ip_tunnel *tunnel,
const struct in6_addr *v6dst)
{
__be32 dst = 0;
check_6rd(tunnel, v6dst, &dst);
return dst;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/07f12b26e21ab359261bf75cfcb424fdc7daeb6d | 0CCPP |
sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) {
sraSpan *vcurr, *hcurr;
sraSpan *vend, *hend;
rfbBool right2left = (flags & 2) == 2;
rfbBool bottom2top = (flags & 1) == 1;
if (bottom2top) {
vcurr = ((sraSpanList*)rgn)->back._prev;
vend = &(((sraSpanList*)rgn)->front);
} else {
vcurr = ((sraSpanList*)rgn)->front._next;
vend = &(((sraSpanList*)rgn)->back);
}
if (vcurr != vend) {
rect->y1 = vcurr->start;
rect->y2 = vcurr->end;
if (right2left) {
hcurr = vcurr->subspan->back._prev;
hend = &(vcurr->subspan->front);
} else {
hcurr = vcurr->subspan->front._next;
hend = &(vcurr->subspan->back);
}
if (hcurr != hend) {
rect->x1 = hcurr->start;
rect->x2 = hcurr->end;
sraSpanRemove(hcurr);
sraSpanDestroy(hcurr);
if (sraSpanListEmpty(vcurr->subspan)) {
sraSpanRemove(vcurr);
sraSpanDestroy(vcurr);
}
#if 0
printf("poprect:(%dx%d)-(%dx%d)\n",
rect->x1, rect->y1, rect->x2, rect->y2);
#endif
return 1;
}
}
return 0;
} | 0 | null | -1 | https://github.com/LibVNC/libvncserver/commit/38e98ee61d74f5f5ab4aa4c77146faad1962d6d0 | 0CCPP |
function renderBreadcrumb()
{
var bcDiv = _$('.odFilesBreadcrumb');
if (bcDiv == null) return;
bcDiv.innerHTML = '';
for (var i = 0; i < breadcrumb.length - 1; i++)
{
var folder = document.createElement('span');
folder.className = 'odBCFolder';
folder.innerHTML = mxUtils.htmlEntities(breadcrumb[i].name || mxResources.get('home'));
bcDiv.appendChild(folder);
(function(bcItem, index)
{
folder.addEventListener('click', function()
{
previewFn(null);
breadcrumb = breadcrumb.slice(0, index);
fillFolderFiles(bcItem.driveId, bcItem.folderId, bcItem.siteId, bcItem.name);
});
})(breadcrumb[i], i);
var sep = document.createElement('span');
sep.innerHTML = ' > ';
bcDiv.appendChild(sep);
}
if (breadcrumb[breadcrumb.length - 1] != null)
{
var curr = document.createElement('span');
curr.innerHTML = mxUtils.htmlEntities((breadcrumb.length == 1) ?
mxResources.get('officeSelDiag') : (breadcrumb[breadcrumb.length - 1].name || mxResources.get('home')));
bcDiv.appendChild(curr);
}
}; | 1 | 4 | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
def instance_info_cache_update(context, instance_uuid, values):
return IMPL.instance_info_cache_update(context, instance_uuid, values)
| 0 | null | -1 | https://github.com/openstack/nova.git/commit/1f644d210557b1254f7c7b39424b09a45329ade7 | 4Python |
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;
} | 1 | 0,1,5,6,16,17,18,19,20,22 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a)
{
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
sqr_add_c(a,0,c1,c2,c3);
r[0]=c1;
c1=0;
sqr_add_c2(a,1,0,c2,c3,c1);
r[1]=c2;
c2=0;
sqr_add_c(a,1,c3,c1,c2);
sqr_add_c2(a,2,0,c3,c1,c2);
r[2]=c3;
c3=0;
sqr_add_c2(a,3,0,c1,c2,c3);
sqr_add_c2(a,2,1,c1,c2,c3);
r[3]=c1;
c1=0;
sqr_add_c(a,2,c2,c3,c1);
sqr_add_c2(a,3,1,c2,c3,c1);
r[4]=c2;
c2=0;
sqr_add_c2(a,3,2,c3,c1,c2);
r[5]=c3;
c3=0;
sqr_add_c(a,3,c1,c2,c3);
r[6]=c1;
r[7]=c2;
} | 1 | 2 | -1 | https://github.com/openssl/openssl/commit/a7a44ba55cb4f884c6bc9ceac90072dea38e66d0 | 0CCPP |
validatorFunction: function (val, $el, conf) {
if (val !== '') {
var allowing = $el.valAttr('allowing') || '',
decimalSeparator = $el.valAttr('decimal-separator') || conf.decimalSeparator,
allowsRange = false,
begin,
end,
steps = $el.valAttr('step') || '',
allowsSteps = false,
sanitize = $el.attr('data-sanitize') || '',
isFormattedWithNumeral = sanitize.match(/(^|[\s])numberFormat([\s]|$)/i)
if (isFormattedWithNumeral) {
if (!window.numeral) {
throw new ReferenceError(
'The data-sanitize value numberFormat cannot be used without the numeral' +
' library. Please see Data Validation in http://www.formvalidator.net for more information.'
)
}
if (val.length) {
val = String(numeral().unformat(val))
}
}
if (allowing.indexOf('number') === -1) {
allowing += ',number'
}
if (allowing.indexOf('negative') === -1 && val.indexOf('-') === 0) {
return false
}
if (allowing.indexOf('range') > -1) {
begin = parseFloat(allowing.substring(allowing.indexOf('[') + 1, allowing.indexOf(';')))
end = parseFloat(allowing.substring(allowing.indexOf(';') + 1, allowing.indexOf(']')))
allowsRange = true
}
if (steps !== '') {
allowsSteps = true
}
if (decimalSeparator === ',') {
if (val.indexOf('.') > -1) {
return false
}
val = val.replace(',', '.')
}
if (
val.replace(/[0-9-]/g, '') === '' &&
(!allowsRange || (val >= begin && val <= end)) &&
(!allowsSteps || val % steps === 0)
) {
return true
}
if (
allowing.indexOf('float') > -1 &&
val.match(new RegExp('^([0-9-]+)\\.([0-9]+)$')) !== null &&
(!allowsRange || (val >= begin && val <= end)) &&
(!allowsSteps || val % steps === 0)
) {
return true
}
}
return false
}, | 0 | null | -1 | https://github.com/polonel/trudesk/commit/13dd6c61fc85fa773b4065f075fceda563129c53 | 3JavaScript |
static void free_user(struct kref *ref)
{
struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
kfree(user);
} | 1 | null | -1 | https://github.com/torvalds/linux/commit/77f8269606bf95fcb232ee86f6da80886f1dfae8 | 0CCPP |
authz_status oidc_authz_checker_claim(request_rec *r, const char *require_args,
const void *parsed_require_args) {
return oidc_authz_checker(r, require_args, parsed_require_args,
oidc_authz_match_claim);
} | 0 | null | -1 | https://github.com/OpenIDC/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b | 0CCPP |
function userBroadcast(msg, source) {
var sourceMsg = '> ' + msg;
var name = '{cyan-fg}{bold}' + source.name + '{/}';
msg = ': ' + msg;
for (var i = 0; i < users.length; ++i) {
var user = users[i];
var output = user.output;
if (source === user)
output.add(sourceMsg);
else
output.add(formatMessage(name, output) + msg);
}
} | 1 | 1,2,3,4,5,6 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
{
int r;
bool req_int_win =
dm_request_for_irq_injection(vcpu) &&
kvm_cpu_accept_dm_intr(vcpu);
bool req_immediate_exit = false;
if (vcpu->requests) {
if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
kvm_mmu_unload(vcpu);
if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
__kvm_migrate_timers(vcpu);
if (kvm_check_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu))
kvm_gen_update_masterclock(vcpu->kvm);
if (kvm_check_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu))
kvm_gen_kvmclock_update(vcpu);
if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, vcpu)) {
r = kvm_guest_time_update(vcpu);
if (unlikely(r))
goto out;
}
if (kvm_check_request(KVM_REQ_MMU_SYNC, vcpu))
kvm_mmu_sync_roots(vcpu);
if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
kvm_vcpu_flush_tlb(vcpu);
if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) {
vcpu->run->exit_reason = KVM_EXIT_TPR_ACCESS;
r = 0;
goto out;
}
if (kvm_check_request(KVM_REQ_TRIPLE_FAULT, vcpu)) {
vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
r = 0;
goto out;
}
if (kvm_check_request(KVM_REQ_DEACTIVATE_FPU, vcpu)) {
vcpu->fpu_active = 0;
kvm_x86_ops->fpu_deactivate(vcpu);
}
if (kvm_check_request(KVM_REQ_APF_HALT, vcpu)) {
vcpu->arch.apf.halted = true;
r = 1;
goto out;
}
if (kvm_check_request(KVM_REQ_STEAL_UPDATE, vcpu))
record_steal_time(vcpu);
if (kvm_check_request(KVM_REQ_SMI, vcpu))
process_smi(vcpu);
if (kvm_check_request(KVM_REQ_NMI, vcpu))
process_nmi(vcpu);
if (kvm_check_request(KVM_REQ_PMU, vcpu))
kvm_pmu_handle_event(vcpu);
if (kvm_check_request(KVM_REQ_PMI, vcpu))
kvm_pmu_deliver_pmi(vcpu);
if (kvm_check_request(KVM_REQ_IOAPIC_EOI_EXIT, vcpu)) {
BUG_ON(vcpu->arch.pending_ioapic_eoi > 255);
if (test_bit(vcpu->arch.pending_ioapic_eoi,
(void *) vcpu->arch.eoi_exit_bitmap)) {
vcpu->run->exit_reason = KVM_EXIT_IOAPIC_EOI;
vcpu->run->eoi.vector =
vcpu->arch.pending_ioapic_eoi;
r = 0;
goto out;
}
}
if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
vcpu_scan_ioapic(vcpu);
if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
kvm_vcpu_reload_apic_access_page(vcpu);
if (kvm_check_request(KVM_REQ_HV_CRASH, vcpu)) {
vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
vcpu->run->system_event.type = KVM_SYSTEM_EVENT_CRASH;
r = 0;
goto out;
}
if (kvm_check_request(KVM_REQ_HV_RESET, vcpu)) {
vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
vcpu->run->system_event.type = KVM_SYSTEM_EVENT_RESET;
r = 0;
goto out;
}
}
if (kvm_lapic_enabled(vcpu)) {
if (kvm_x86_ops->hwapic_irr_update)
kvm_x86_ops->hwapic_irr_update(vcpu,
kvm_lapic_find_highest_irr(vcpu));
}
if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
kvm_apic_accept_events(vcpu);
if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
r = 1;
goto out;
}
if (inject_pending_event(vcpu, req_int_win) != 0)
req_immediate_exit = true;
else if (vcpu->arch.nmi_pending)
kvm_x86_ops->enable_nmi_window(vcpu);
else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
kvm_x86_ops->enable_irq_window(vcpu);
if (kvm_lapic_enabled(vcpu)) {
update_cr8_intercept(vcpu);
kvm_lapic_sync_to_vapic(vcpu);
}
}
r = kvm_mmu_reload(vcpu);
if (unlikely(r)) {
goto cancel_injection;
}
preempt_disable();
kvm_x86_ops->prepare_guest_switch(vcpu);
if (vcpu->fpu_active)
kvm_load_guest_fpu(vcpu);
kvm_load_guest_xcr0(vcpu);
vcpu->mode = IN_GUEST_MODE;
srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
smp_mb__after_srcu_read_unlock();
local_irq_disable();
if (vcpu->mode == EXITING_GUEST_MODE || vcpu->requests
|| need_resched() || signal_pending(current)) {
vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb();
local_irq_enable();
preempt_enable();
vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
r = 1;
goto cancel_injection;
}
if (req_immediate_exit)
smp_send_reschedule(vcpu->cpu);
trace_kvm_entry(vcpu->vcpu_id);
wait_lapic_expire(vcpu);
__kvm_guest_enter();
if (unlikely(vcpu->arch.switch_db_regs)) {
set_debugreg(0, 7);
set_debugreg(vcpu->arch.eff_db[0], 0);
set_debugreg(vcpu->arch.eff_db[1], 1);
set_debugreg(vcpu->arch.eff_db[2], 2);
set_debugreg(vcpu->arch.eff_db[3], 3);
set_debugreg(vcpu->arch.dr6, 6);
vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
}
kvm_x86_ops->run(vcpu);
if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
int i;
WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
kvm_x86_ops->sync_dirty_debug_regs(vcpu);
for (i = 0; i < KVM_NR_DB_REGS; i++)
vcpu->arch.eff_db[i] = vcpu->arch.db[i];
}
if (hw_breakpoint_active())
hw_breakpoint_restore();
vcpu->arch.last_guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb();
kvm_x86_ops->handle_external_intr(vcpu);
++vcpu->stat.exits;
barrier();
kvm_guest_exit();
preempt_enable();
vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
if (unlikely(prof_on == KVM_PROFILING)) {
unsigned long rip = kvm_rip_read(vcpu);
profile_hit(KVM_PROFILING, (void *)rip);
}
if (unlikely(vcpu->arch.tsc_always_catchup))
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
if (vcpu->arch.apic_attention)
kvm_lapic_sync_from_vapic(vcpu);
r = kvm_x86_ops->handle_exit(vcpu);
return r;
cancel_injection:
kvm_x86_ops->cancel_injection(vcpu);
if (unlikely(vcpu->arch.apic_attention))
kvm_lapic_sync_from_vapic(vcpu);
out:
return r;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/0185604c2d82c560dab2f2933a18f797e74ab5a8 | 0CCPP |
plus: function(left, right) {
return 'plus(' + left + ',' + right + ')';
}, | 1 | 0,1,2 | -1 | https://github.com/peerigon/angular-expressions/commit/061addfb9a9e932a970e5fcb913d020038e65667 | 3JavaScript |
[H],"{1} ago"));F.setAttribute("title",K.toLocaleDateString()+" "+K.toLocaleTimeString())}function k(K){var F=document.createElement("img");F.className="geCommentBusyImg";F.src=IMAGE_PATH+"/spin.gif";K.appendChild(F);K.busyImg=F}function l(K){K.style.border="1px solid red";K.removeChild(K.busyImg)}function p(K){K.style.border="";K.removeChild(K.busyImg)}function q(K,F,H,S,V){function M(N,Q,R){var Y=document.createElement("li");Y.className="geCommentAction";var ba=document.createElement("a");ba.className=
"geCommentActionLnk";mxUtils.write(ba,N);Y.appendChild(ba);mxEvent.addListener(ba,"click",function(ea){Q(ea,K);ea.preventDefault();mxEvent.consume(ea)});T.appendChild(Y);R&&(Y.style.display="none")}function W(){function N(Y){Q.push(R);if(null!=Y.replies)for(var ba=0;ba<Y.replies.length;ba++)R=R.nextSibling,N(Y.replies[ba])}var Q=[],R=X;N(K);return{pdiv:R,replies:Q}}function U(N,Q,R,Y,ba){function ea(){k(va);K.addReply(aa,function(ja){aa.id=ja;K.replies.push(aa);p(va);R&&R()},function(ja){Z();l(va); | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
public DropFileContainer(final String id, final String mimeType) {
super(id);
this.mimeType = mimeType;
main = new WebMarkupContainer("main");
add(main);
} | 1 | 0 | -1 | https://github.com/micromata/projectforge-webapp/commit/422de35e3c3141e418a73bfb39b430d5fd74077e | 2Java |
void gf_isom_cenc_get_default_info_internal(GF_TrackBox *trak, u32 sampleDescriptionIndex, u32 *container_type, Bool *default_IsEncrypted, u8 *crypt_byte_block, u8 *skip_byte_block, const u8 **key_info, u32 *key_info_size)
{
GF_ProtectionSchemeInfoBox *sinf;
if (default_IsEncrypted) *default_IsEncrypted = GF_FALSE;
if (crypt_byte_block) *crypt_byte_block = 0;
if (skip_byte_block) *skip_byte_block = 0;
if (container_type) *container_type = 0;
if (key_info) *key_info = NULL;
if (key_info_size) *key_info_size = 0;
sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CENC_SCHEME, NULL);
if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CBC_SCHEME, NULL);
if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CENS_SCHEME, NULL);
if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CBCS_SCHEME, NULL);
if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_PIFF_SCHEME, NULL);
if (!sinf) {
u32 i, nb_stsd = gf_list_count(trak->Media->information->sampleTable->SampleDescription->child_boxes);
for (i=0; i<nb_stsd; i++) {
GF_ProtectionSchemeInfoBox *a_sinf;
GF_SampleEntryBox *sentry=NULL;
if (i+1==sampleDescriptionIndex) continue;
sentry = gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, i);
a_sinf = (GF_ProtectionSchemeInfoBox *) gf_isom_box_find_child(sentry->child_boxes, GF_ISOM_BOX_TYPE_SINF);
if (!a_sinf) continue;
return;
}
}
if (sinf && sinf->info && sinf->info->tenc) {
if (default_IsEncrypted) *default_IsEncrypted = sinf->info->tenc->isProtected;
if (crypt_byte_block) *crypt_byte_block = sinf->info->tenc->crypt_byte_block;
if (skip_byte_block) *skip_byte_block = sinf->info->tenc->skip_byte_block;
if (key_info) *key_info = sinf->info->tenc->key_info;
if (key_info_size) {
*key_info_size = 20;
if (!sinf->info->tenc->key_info[3])
*key_info_size += 1 + sinf->info->tenc->key_info[20];
}
if (container_type) *container_type = GF_ISOM_BOX_TYPE_SENC;
} else if (sinf && sinf->info && sinf->info->piff_tenc) {
if (default_IsEncrypted) *default_IsEncrypted = GF_TRUE;
if (key_info) *key_info = sinf->info->piff_tenc->key_info;
if (key_info_size) *key_info_size = 19;
if (container_type) *container_type = GF_ISOM_BOX_UUID_PSEC;
} else {
u32 i, count = 0;
GF_CENCSampleEncryptionGroupEntry *seig_entry = NULL;
if (!trak->moov->mov->is_smooth)
count = gf_list_count(trak->Media->information->sampleTable->sampleGroupsDescription);
for (i=0; i<count; i++) {
GF_SampleGroupDescriptionBox *sgdesc = (GF_SampleGroupDescriptionBox*)gf_list_get(trak->Media->information->sampleTable->sampleGroupsDescription, i);
if (sgdesc->grouping_type!=GF_ISOM_SAMPLE_GROUP_SEIG) continue;
if (sgdesc->default_description_index)
seig_entry = gf_list_get(sgdesc->group_descriptions, sgdesc->default_description_index-1);
else
seig_entry = gf_list_get(sgdesc->group_descriptions, 0);
if (!seig_entry->key_info[0])
seig_entry = NULL;
break;
}
if (seig_entry) {
if (default_IsEncrypted) *default_IsEncrypted = seig_entry->IsProtected;
if (crypt_byte_block) *crypt_byte_block = seig_entry->crypt_byte_block;
if (skip_byte_block) *skip_byte_block = seig_entry->skip_byte_block;
if (key_info) *key_info = seig_entry->key_info;
if (key_info_size) *key_info_size = seig_entry->key_info_size;
if (container_type) *container_type = GF_ISOM_BOX_TYPE_SENC;
} else {
if (! trak->moov->mov->is_smooth ) {
trak->moov->mov->is_smooth = GF_TRUE;
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] senc box without tenc, assuming MS smooth+piff\n"));
}
if (default_IsEncrypted) *default_IsEncrypted = GF_TRUE;
if (container_type) *container_type = GF_ISOM_BOX_UUID_PSEC;
}
}
if (container_type && trak->sample_encryption) {
if (trak->sample_encryption->type == GF_ISOM_BOX_TYPE_SENC) *container_type = GF_ISOM_BOX_TYPE_SENC;
else if (trak->sample_encryption->type == GF_ISOM_BOX_TYPE_UUID) *container_type = ((GF_UUIDBox*)trak->sample_encryption)->internal_4cc;
}
} | 1 | 54 | -1 | https://github.com/gpac/gpac/commit/3b84ffcbacf144ce35650df958432f472b6483f8 | 0CCPP |
salsa20_8(__m128i B[4])
{
__m128i X0, X1, X2, X3;
__m128i T;
size_t i;
X0 = B[0];
X1 = B[1];
X2 = B[2];
X3 = B[3];
for (i = 0; i < 8; i += 2) {
/* Operate on "columns". */
T = _mm_add_epi32(X0, X3);
X1 = _mm_xor_si128(X1, _mm_slli_epi32(T, 7));
X1 = _mm_xor_si128(X1, _mm_srli_epi32(T, 25));
T = _mm_add_epi32(X1, X0);
X2 = _mm_xor_si128(X2, _mm_slli_epi32(T, 9));
X2 = _mm_xor_si128(X2, _mm_srli_epi32(T, 23));
T = _mm_add_epi32(X2, X1);
X3 = _mm_xor_si128(X3, _mm_slli_epi32(T, 13));
X3 = _mm_xor_si128(X3, _mm_srli_epi32(T, 19));
T = _mm_add_epi32(X3, X2);
X0 = _mm_xor_si128(X0, _mm_slli_epi32(T, 18));
X0 = _mm_xor_si128(X0, _mm_srli_epi32(T, 14));
/* Rearrange data. */
X1 = _mm_shuffle_epi32(X1, 0x93);
X2 = _mm_shuffle_epi32(X2, 0x4E);
X3 = _mm_shuffle_epi32(X3, 0x39);
/* Operate on "rows". */
T = _mm_add_epi32(X0, X1);
X3 = _mm_xor_si128(X3, _mm_slli_epi32(T, 7));
X3 = _mm_xor_si128(X3, _mm_srli_epi32(T, 25));
T = _mm_add_epi32(X3, X0);
X2 = _mm_xor_si128(X2, _mm_slli_epi32(T, 9));
X2 = _mm_xor_si128(X2, _mm_srli_epi32(T, 23));
T = _mm_add_epi32(X2, X3);
X1 = _mm_xor_si128(X1, _mm_slli_epi32(T, 13));
X1 = _mm_xor_si128(X1, _mm_srli_epi32(T, 19));
T = _mm_add_epi32(X1, X2);
X0 = _mm_xor_si128(X0, _mm_slli_epi32(T, 18));
X0 = _mm_xor_si128(X0, _mm_srli_epi32(T, 14));
/* Rearrange data. */
X1 = _mm_shuffle_epi32(X1, 0x39);
X2 = _mm_shuffle_epi32(X2, 0x4E);
X3 = _mm_shuffle_epi32(X3, 0x93);
}
B[0] = _mm_add_epi32(B[0], X0);
B[1] = _mm_add_epi32(B[1], X1);
B[2] = _mm_add_epi32(B[2], X2);
B[3] = _mm_add_epi32(B[3], X3);
} | 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/facebook/hhvm/commit/cc331e4349e91706a673e2a09f1f2ea5bbb33815 | 0CCPP |
function closeRoom(Room) {
Room.Players.forEach((player) => {
ids.splice(player.Id, 1);
});
ActiveRooms.splice(ActiveRooms.indexOf(Room), 1);
} | 0 | null | -1 | https://github.com/math-geon/Geon/commit/005456d752d5434b60026edbc83b2665b8557d19 | 3JavaScript |
OurModifiers(XtermWidget xw)
{
return (ShiftMask
| ControlMask
| MetaMask(xw));
} | 0 | null | -1 | https://github.com/ThomasDickey/xterm-snapshots/commit/82ba55b8f994ab30ff561a347b82ea340ba7075c | 0CCPP |
public void setContent(InputStream inputStream) throws IOException {
ObjectUtil.checkNotNull(inputStream, "inputStream");
if (file != null) {
delete();
}
file = tempFile();
RandomAccessFile accessFile = new RandomAccessFile(file, "rw");
int written = 0;
try {
accessFile.setLength(0);
FileChannel localfileChannel = accessFile.getChannel();
byte[] bytes = new byte[4096 * 4];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
int read = inputStream.read(bytes);
while (read > 0) {
byteBuffer.position(read).flip();
written += localfileChannel.write(byteBuffer);
checkSize(written);
read = inputStream.read(bytes);
}
localfileChannel.force(false);
} finally {
accessFile.close();
}
size = written;
if (definedSize > 0 && definedSize < size) {
if (!file.delete()) {
logger.warn("Failed to delete: {}", file);
}
file = null;
throw new IOException("Out of size: " + size + " > " + definedSize);
}
isRenamed = true;
setCompleted();
} | 0 | null | -1 | https://github.com/netty/netty/commit/c735357bf29d07856ad171c6611a2e1a0e0000ec | 2Java |
encode_UNROLL_XLATE(const struct ofpact_unroll_xlate *unroll OVS_UNUSED,
enum ofp_version ofp_version OVS_UNUSED,
struct ofpbuf *out OVS_UNUSED)
{
OVS_NOT_REACHED();
} | 0 | null | -1 | https://github.com/openvswitch/ovs/commit/77cccc74deede443e8b9102299efc869a52b65b2 | 0CCPP |
re_compile_fastmap (bufp)
struct re_pattern_buffer *bufp;
{
int j, k;
#ifdef MATCH_MAY_ALLOCATE
fail_stack_type fail_stack;
#endif
#ifndef REGEX_MALLOC
char *destination;
#endif
register char *fastmap = bufp->fastmap;
unsigned char *pattern = bufp->buffer;
unsigned char *p = pattern;
register unsigned char *pend = pattern + bufp->used;
#ifdef REL_ALLOC
fail_stack_elt_t *failure_stack_ptr;
#endif
boolean path_can_be_null = true;
boolean succeed_n_p = false;
assert (fastmap != NULL && p != NULL);
INIT_FAIL_STACK ();
bzero (fastmap, 1 << BYTEWIDTH);
bufp->fastmap_accurate = 1;
bufp->can_be_null = 0;
while (1)
{
if (p == pend || *p == succeed)
{
if (!FAIL_STACK_EMPTY ())
{
bufp->can_be_null |= path_can_be_null;
path_can_be_null = true;
p = fail_stack.stack[--fail_stack.avail].pointer;
continue;
}
else
break;
}
assert (p < pend);
switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
{
case duplicate:
bufp->can_be_null = 1;
goto done;
case exactn:
fastmap[p[1]] = 1;
break;
case charset:
for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
fastmap[j] = 1;
break;
case charset_not:
for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
fastmap[j] = 1;
for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
fastmap[j] = 1;
break;
case wordchar:
for (j = 0; j < (1 << BYTEWIDTH); j++)
if (SYNTAX (j) == Sword)
fastmap[j] = 1;
break;
case notwordchar:
for (j = 0; j < (1 << BYTEWIDTH); j++)
if (SYNTAX (j) != Sword)
fastmap[j] = 1;
break;
case anychar:
{
int fastmap_newline = fastmap['\n'];
for (j = 0; j < (1 << BYTEWIDTH); j++)
fastmap[j] = 1;
if (!(bufp->syntax & RE_DOT_NEWLINE))
fastmap['\n'] = fastmap_newline;
else if (bufp->can_be_null)
goto done;
break;
}
#ifdef emacs
case syntaxspec:
k = *p++;
for (j = 0; j < (1 << BYTEWIDTH); j++)
if (SYNTAX (j) == (enum syntaxcode) k)
fastmap[j] = 1;
break;
case notsyntaxspec:
k = *p++;
for (j = 0; j < (1 << BYTEWIDTH); j++)
if (SYNTAX (j) != (enum syntaxcode) k)
fastmap[j] = 1;
break;
case before_dot:
case at_dot:
case after_dot:
continue;
#endif
case no_op:
case begline:
case endline:
case begbuf:
case endbuf:
case wordbound:
case notwordbound:
case wordbeg:
case wordend:
case push_dummy_failure:
continue;
case jump_n:
case pop_failure_jump:
case maybe_pop_jump:
case jump:
case jump_past_alt:
case dummy_failure_jump:
EXTRACT_NUMBER_AND_INCR (j, p);
p += j;
if (j > 0)
continue;
if ((re_opcode_t) *p != on_failure_jump
&& (re_opcode_t) *p != succeed_n)
continue;
p++;
EXTRACT_NUMBER_AND_INCR (j, p);
p += j;
if (!FAIL_STACK_EMPTY ()
&& fail_stack.stack[fail_stack.avail - 1].pointer == p)
fail_stack.avail--;
continue;
case on_failure_jump:
case on_failure_keep_string_jump:
handle_on_failure_jump:
EXTRACT_NUMBER_AND_INCR (j, p);
if (p + j < pend)
{
if (!PUSH_PATTERN_OP (p + j, fail_stack))
{
RESET_FAIL_STACK ();
return -2;
}
}
else
bufp->can_be_null = 1;
if (succeed_n_p)
{
EXTRACT_NUMBER_AND_INCR (k, p);
succeed_n_p = false;
}
continue;
case succeed_n:
p += 2;
EXTRACT_NUMBER_AND_INCR (k, p);
if (k == 0)
{
p -= 4;
succeed_n_p = true;
goto handle_on_failure_jump;
}
continue;
case set_number_at:
p += 4;
continue;
case start_memory:
case stop_memory:
p += 2;
continue;
default:
abort ();
}
path_can_be_null = false;
p = pend;
}
bufp->can_be_null |= path_can_be_null;
done:
RESET_FAIL_STACK ();
return 0;
} | 0 | null | -1 | https://github.com/bminor/glibc/commit/2864e767053317538feafa815046fff89e5a16be | 0CCPP |
key.decrypt = function(data, scheme, schemeOptions) {
if(typeof scheme === 'string') {
scheme = scheme.toUpperCase();
} else if(scheme === undefined) {
scheme = 'RSAES-PKCS1-V1_5';
}
var d = pki.rsa.decrypt(data, key, false, false);
if(scheme === 'RSAES-PKCS1-V1_5') {
scheme = {decode: _decodePkcs1_v1_5};
} else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') {
scheme = {
decode: function(d, key) {
return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions);
}
};
} else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) {
scheme = {decode: function(d) {return d;}};
} else {
throw new Error('Unsupported encryption scheme: "' + scheme + '".');
}
return scheme.decode(d, key, false);
}; | 0 | null | -1 | https://github.com/digitalbazaar/forge/commit/3f0b49a0573ef1bb7af7f5673c0cfebf00424df1 | 3JavaScript |
static bool validate_hash(uuid_t type, int size)
{
if (uuid_equals(&type, &EFI_CERT_SHA1_GUID) && (size == 20))
return true;
if (uuid_equals(&type, &EFI_CERT_SHA224_GUID) && (size == 28))
return true;
if (uuid_equals(&type, &EFI_CERT_SHA256_GUID) && (size == 32))
return true;
if (uuid_equals(&type, &EFI_CERT_SHA384_GUID) && (size == 48))
return true;
if (uuid_equals(&type, &EFI_CERT_SHA512_GUID) && (size == 64))
return true;
return false;
} | 0 | null | -1 | https://github.com/open-power/skiboot/commit/5be38b672c1410e2f10acd3ad2eecfdc81d5daf7 | 0CCPP |
x[D].apply(this,arguments);null!=G&&C.push(G)}b.sidebar.showEntries(0<C.length?C.join(";"):"",B.checked);b.hideDialog()});g.className="geBtn gePrimaryBtn";f=document.createElement("div");f.style.marginTop="26px";f.style.textAlign="right"}b.editor.cancelFirst?(f.appendChild(n),f.appendChild(g)):(f.appendChild(g),f.appendChild(n));c.appendChild(f);this.container=c},PluginsDialog=function(b,e,f,c){function m(){g=!0;if(0==d.length)v.innerHTML=mxUtils.htmlEntities(mxResources.get("noPlugins"));else{v.innerHTML=
"";for(var y=0;y<d.length;y++){var A=document.createElement("span");A.style.whiteSpace="nowrap";var B=document.createElement("span");B.className="geSprite geSprite-delete";B.style.position="relative";B.style.cursor="pointer";B.style.top="5px";B.style.marginRight="4px";B.style.display="inline-block";A.appendChild(B);mxUtils.write(A,d[y]);v.appendChild(A);mxUtils.br(v);mxEvent.addListener(B,"click",function(I){return function(){b.confirm(mxResources.get("delete")+' "'+d[I]+'"?',function(){null!=f&&
f(d[I]);d.splice(I,1);m()})}}(y))}}}var n=document.createElement("div"),v=document.createElement("div");v.style.height="180px";v.style.overflow="auto";var d=mxSettings.getPlugins().slice(),g=!1;n.appendChild(v);m();g=!1;var k=mxUtils.button(mxResources.get("add"),null!=e?function(){e(function(y){y&&0>mxUtils.indexOf(d,y)&&d.push(y);m()})}:function(){var y=document.createElement("div"),A=document.createElement("span");A.style.marginTop="6px";mxUtils.write(A,mxResources.get("builtinPlugins")+": "); | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
dbus_main(__attribute__ ((unused)) void *unused)
{
gchar *introspection_xml;
guint owner_id;
const char *service_name;
objects = g_hash_table_new(g_str_hash, g_str_equal);
#ifdef DBUS_NEED_G_TYPE_INIT
g_type_init();
#endif
GError *error = NULL;
introspection_xml = read_file(DBUS_VRRP_INTERFACE_FILE_PATH);
if (!introspection_xml)
return NULL;
vrrp_introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, &error);
FREE(introspection_xml);
if (error != NULL) {
log_message(LOG_INFO, "Parsing DBus interface %s from file %s failed: %s",
DBUS_VRRP_INTERFACE, DBUS_VRRP_INTERFACE_FILE_PATH, error->message);
g_clear_error(&error);
return NULL;
}
introspection_xml = read_file(DBUS_VRRP_INSTANCE_INTERFACE_FILE_PATH);
if (!introspection_xml)
return NULL;
vrrp_instance_introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, &error);
FREE(introspection_xml);
if (error != NULL) {
log_message(LOG_INFO, "Parsing DBus interface %s from file %s failed: %s",
DBUS_VRRP_INSTANCE_INTERFACE, DBUS_VRRP_INSTANCE_INTERFACE_FILE_PATH, error->message);
g_clear_error(&error);
return NULL;
}
service_name = global_data->dbus_service_name ? global_data->dbus_service_name : DBUS_SERVICE_NAME;
owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
service_name,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
on_name_acquired,
on_name_lost,
NULL,
NULL);
loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
g_main_loop_unref(loop);
g_bus_unown_name(owner_id);
global_connection = NULL;
sem_post(&thread_end);
pthread_exit(0);
} | 0 | null | -1 | https://github.com/acassen/keepalived/commit/04f2d32871bb3b11d7dc024039952f2fe2750306 | 0CCPP |
static DataSource lookupDataSource(Hints hints) throws FactoryException {
Object hint = hints.get(Hints.EPSG_DATA_SOURCE);
if (hint instanceof DataSource) {
return (DataSource) hint;
} else if (hint instanceof String) {
String name = (String) hint;
InitialContext context;
try {
context = GeoTools.getInitialContext();
// name = GeoTools.fixName( context, name );
return (DataSource) context.lookup(name);
} catch (Exception e) {
throw new FactoryException("EPSG_DATA_SOURCE '" + name + "' not found:" + e, e);
}
}
throw new FactoryException("EPSG_DATA_SOURCE must be provided");
} | 1 | 6,8,9,10 | -1 | https://github.com/geotools/geotools/commit/4f70fa3234391dd0cda883a20ab0ec75688cba49 | 2Java |
static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
size_t ignored)
{
int limit = ALG_MAX_PAGES * PAGE_SIZE;
struct sock *sk = sock->sk;
struct alg_sock *ask = alg_sk(sk);
struct hash_ctx *ctx = ask->private;
long copied = 0;
int err;
if (limit > sk->sk_sndbuf)
limit = sk->sk_sndbuf;
lock_sock(sk);
if (!ctx->more) {
err = crypto_ahash_init(&ctx->req);
if (err)
goto unlock;
}
ctx->more = 0;
while (msg_data_left(msg)) {
int len = msg_data_left(msg);
if (len > limit)
len = limit;
len = af_alg_make_sg(&ctx->sgl, &msg->msg_iter, len);
if (len < 0) {
err = copied ? 0 : len;
goto unlock;
}
ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len);
err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req),
&ctx->completion);
af_alg_free_sg(&ctx->sgl);
if (err)
goto unlock;
copied += len;
iov_iter_advance(&msg->msg_iter, len);
}
err = 0;
ctx->more = msg->msg_flags & MSG_MORE;
if (!ctx->more) {
ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);
err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req),
&ctx->completion);
}
unlock:
release_sock(sk);
return err ?: copied;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/4afa5f9617927453ac04b24b584f6c718dfb4f45 | 0CCPP |
input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)
{
struct grid_cell *gc = &ictx->cell.cell;
char *s = ictx->param_list[i].str, *copy, *ptr, *out;
int p[8];
u_int n;
const char *errstr;
for (n = 0; n < nitems(p); n++)
p[n] = -1;
n = 0;
ptr = copy = xstrdup(s);
while ((out = strsep(&ptr, ":")) != NULL) {
if (*out != '\0') {
p[n++] = strtonum(out, 0, INT_MAX, &errstr);
if (errstr != NULL || n == nitems(p)) {
free(copy);
return;
}
} else
n++;
log_debug("%s: %u = %d", __func__, n - 1, p[n - 1]);
}
free(copy);
if (n == 0)
return;
if (p[0] == 4) {
if (n != 2)
return;
switch (p[1]) {
case 0:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
break;
case 1:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE;
break;
case 2:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE_2;
break;
case 3:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE_3;
break;
case 4:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE_4;
break;
case 5:
gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE_5;
break;
}
return;
}
if (n < 2 || (p[0] != 38 && p[0] != 48 && p[0] != 58))
return;
switch (p[1]) {
case 2:
if (n < 3)
break;
if (n == 5)
i = 2;
else
i = 3;
if (n < i + 3)
break;
input_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],
p[i + 2]);
break;
case 5:
if (n < 3)
break;
input_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);
break;
}
} | 1 | 18 | -1 | https://github.com/tmux/tmux/commit/a868bacb46e3c900530bed47a1c6f85b0fbe701c | 0CCPP |
private static String addTrailingSeparator(String path) {
if (!path.endsWith(File.separator)) {
return path + File.separator;
}
return path;
} | 1 | 0,1,2,3,4 | -1 | https://github.com/whitesource/CureKit/commit/77e276de00ef1b5a3c927709db72ef75b866b06a | 2Java |
void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
{
int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;
int wid;
int w, wstart;
int thick = im->thick;
if (color == gdAntiAliased) {
/*
gdAntiAliased passed as color: use the much faster, much cheaper
and equally attractive gdImageAALine implementation. That
clips too, so don't clip twice.
*/
gdImageAALine(im, x1, y1, x2, y2, im->AA_color);
return;
}
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
return;
}
dx = abs (x2 - x1);
dy = abs (y2 - y1);
if (dx == 0) {
gdImageVLine(im, x1, y1, y2, color);
return;
} else if (dy == 0) {
gdImageHLine(im, y1, x1, x2, color);
return;
}
if (dy <= dx) {
if ((dx == 0) && (dy == 0)) {
wid = 1;
} else {
double ac = cos (atan2 (dy, dx));
if (ac != 0) {
wid = thick / ac;
} else {
wid = 1;
}
if (wid == 0) {
wid = 1;
}
}
d = 2 * dy - dx;
incr1 = 2 * dy;
incr2 = 2 * (dy - dx);
if (x1 > x2) {
x = x2;
y = y2;
ydirflag = (-1);
xend = x1;
} else {
x = x1;
y = y1;
ydirflag = 1;
xend = x2;
}
wstart = y - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel(im, x, w, color);
}
if (((y2 - y1) * ydirflag) > 0) {
while (x < xend) {
x++;
if (d < 0) {
d += incr1;
} else {
y++;
d += incr2;
}
wstart = y - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel (im, x, w, color);
}
}
} else {
while (x < xend) {
x++;
if (d < 0) {
d += incr1;
} else {
y--;
d += incr2;
}
wstart = y - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel (im, x, w, color);
}
}
}
} else {
double as = sin (atan2 (dy, dx));
if (as != 0) {
wid = thick / as;
} else {
wid = 1;
}
if (wid == 0) {
wid = 1;
}
d = 2 * dx - dy;
incr1 = 2 * dx;
incr2 = 2 * (dx - dy);
if (y1 > y2) {
y = y2;
x = x2;
yend = y1;
xdirflag = (-1);
} else {
y = y1;
x = x1;
yend = y2;
xdirflag = 1;
}
wstart = x - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel (im, w, y, color);
}
if (((x2 - x1) * xdirflag) > 0) {
while (y < yend) {
y++;
if (d < 0) {
d += incr1;
} else {
x++;
d += incr2;
}
wstart = x - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel (im, w, y, color);
}
}
} else {
while (y < yend) {
y++;
if (d < 0) {
d += incr1;
} else {
x--;
d += incr2;
}
wstart = x - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel (im, w, y, color);
}
}
}
}
} | 1 | 7,12 | -1 | https://github.com/php/php-src/commit/c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6 | 0CCPP |
int open_debug_log(void)
{
int fh;
struct stat st;
if(verify_config || test_scheduling == TRUE)
return OK;
if(debug_level == DEBUGL_NONE)
return OK;
if ((fh = open(log_file, O_RDWR|O_APPEND|O_CREAT|O_NOFOLLOW, S_IRUSR|S_IWUSR)) == -1)
return ERROR;
if((debug_file_fp = fdopen(fh, "a+")) == NULL)
return ERROR;
if ((fstat(fh, &st)) == -1) {
debug_file_fp = NULL;
close(fh);
return ERROR;
}
if (st.st_nlink != 1 || (st.st_mode & S_IFMT) != S_IFREG) {
debug_file_fp = NULL;
close(fh);
return ERROR;
}
(void)fcntl(fh, F_SETFD, FD_CLOEXEC);
return OK;
} | 1 | 8 | -1 | https://github.com/NagiosEnterprises/nagioscore/commit/8e6e1cb29f3c1b933b0e13fb937ad5ca8b448ccc | 0CCPP |
mxShapeERHierarchy.prototype.shapeText=function(a,d,e,b,c,f,g,h,k,l){a.begin();a.setFontSize(h);a.setFontColor(k);a.text(.25*b,.5*(c-h),0,0,f[0],mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0);a.text(.25*b,.5*(c+h),0,0,f[1],mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0);a.text(.7*b,.5*(c-h),0,0,g[0],mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0);a.text(.7*b,.5*(c+h),0,0,g[1],mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0)}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
return function valueRef() {
return value;
}; | 0 | null | -1 | https://github.com/peerigon/angular-expressions/commit/07edb62902b1f6127b3dcc013da61c6316dd0bf1 | 3JavaScript |
SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
{
struct k_itimer *timr;
int overrun;
unsigned long flags;
timr = lock_timer(timer_id, &flags);
if (!timr)
return -EINVAL;
overrun = timr->it_overrun_last;
unlock_timer(timr, flags);
return overrun;
} | 1 | 8 | -1 | https://github.com/torvalds/linux/commit/78c9c4dfbf8c04883941445a195276bb4bb92c76 | 0CCPP |
public void close() throws IOException {
if ((_outputBuffer != null)
&& isEnabled(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT)) {
while (true) {
JsonStreamContext ctxt = getOutputContext();
if (ctxt.inArray()) {
writeEndArray();
} else if (ctxt.inObject()) {
writeEndObject();
} else {
break;
}
}
}
super.close();
_flushBuffer();
if (_ioContext.isResourceManaged()
|| isEnabled(JsonGenerator.Feature.AUTO_CLOSE_TARGET)) {
_out.close();
} else if (isEnabled(JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM)) {
_out.flush();
}
_releaseBuffers();
} | 0 | null | -1 | https://github.com/FasterXML/jackson-dataformats-binary/commit/de072d314af8f5f269c8abec6930652af67bc8e6 | 2Java |
evutil_socket_geterror(evutil_socket_t sock)
{
int optval, optvallen=sizeof(optval);
int err = WSAGetLastError();
if (err == WSAEWOULDBLOCK && sock >= 0) {
if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&optval,
&optvallen))
return err;
if (optval)
return optval;
}
return err;
} | 0 | null | -1 | https://github.com/libevent/libevent/commit/329acc18a0768c21ba22522f01a5c7f46cacc4d5 | 0CCPP |
public void Postpone(DateTime nextRenewalDate, bool bulk = false)
{
Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,
UrlPrefix + Uri.EscapeUriString(Uuid) + "/postpone?next_renewal_date=" + nextRenewalDate.ToString("s") + "&bulk=" + bulk.ToString().ToLower(),
ReadXml);
} | 1 | 3 | -1 | https://github.com/recurly/recurly-client-dotnet/commit/9eef460c0084afd5c24d66220c8b7a381cf9a1f1 | 1CS |
write_int (unsigned char * data, int offset, int value)
{ data [offset] = value >> 24 ;
data [offset + 1] = value >> 16 ;
data [offset + 2] = value >> 8 ;
data [offset + 3] = value ;
} | 0 | null | -1 | https://github.com/libsndfile/libsndfile/commit/dbe14f00030af5d3577f4cabbf9861db59e9c378 | 0CCPP |
Mocha.prototype.checkLeaks = function(){
this.options.ignoreLeaks = false;
return this;
}; | 1 | 0 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
def merge_list_book():
vals = request.get_json().get('Merge_books')
to_file = list()
if vals:
to_book = calibre_db.get_book(vals[0])
vals.pop(0)
if to_book:
for file in to_book.data:
to_file.append(file.format)
to_name = helper.get_valid_filename(to_book.title, chars=96) + ' - ' + \
helper.get_valid_filename(to_book.authors[0].name, chars=96)
for book_id in vals:
from_book = calibre_db.get_book(book_id)
if from_book:
for element in from_book.data:
if element.format not in to_file:
filepath_new = os.path.normpath(os.path.join(config.config_calibre_dir,
to_book.path,
to_name + "." + element.format.lower()))
filepath_old = os.path.normpath(os.path.join(config.config_calibre_dir,
from_book.path,
element.name + "." + element.format.lower()))
copyfile(filepath_old, filepath_new)
to_book.data.append(db.Data(to_book.id,
element.format,
element.uncompressed_size,
to_name))
delete_book_from_table(from_book.id,"", True)
return json.dumps({'success': True})
return "" | 1 | 9,10,27 | -1 | https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367 | 4Python |
static int stack_trace_open(struct inode *inode, struct file *file)
{
return seq_open(file, &stack_trace_seq_ops);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/6a76f8c0ab19f215af2a3442870eeb5f0e81998d | 0CCPP |
long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group)
{
struct key_user *newowner, *zapowner = NULL;
struct key *key;
key_ref_t key_ref;
long ret;
kuid_t uid;
kgid_t gid;
uid = make_kuid(current_user_ns(), user);
gid = make_kgid(current_user_ns(), group);
ret = -EINVAL;
if ((user != (uid_t) -1) && !uid_valid(uid))
goto error;
if ((group != (gid_t) -1) && !gid_valid(gid))
goto error;
ret = 0;
if (user == (uid_t) -1 && group == (gid_t) -1)
goto error;
key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL,
KEY_NEED_SETATTR);
if (IS_ERR(key_ref)) {
ret = PTR_ERR(key_ref);
goto error;
}
key = key_ref_to_ptr(key_ref);
ret = -EACCES;
down_write(&key->sem);
if (!capable(CAP_SYS_ADMIN)) {
if (user != (uid_t) -1 && !uid_eq(key->uid, uid))
goto error_put;
if (group != (gid_t) -1 && !gid_eq(gid, key->gid) && !in_group_p(gid))
goto error_put;
}
if (user != (uid_t) -1 && !uid_eq(uid, key->uid)) {
ret = -ENOMEM;
newowner = key_user_lookup(uid);
if (!newowner)
goto error_put;
if (test_bit(KEY_FLAG_IN_QUOTA, &key->flags)) {
unsigned maxkeys = uid_eq(uid, GLOBAL_ROOT_UID) ?
key_quota_root_maxkeys : key_quota_maxkeys;
unsigned maxbytes = uid_eq(uid, GLOBAL_ROOT_UID) ?
key_quota_root_maxbytes : key_quota_maxbytes;
spin_lock(&newowner->lock);
if (newowner->qnkeys + 1 >= maxkeys ||
newowner->qnbytes + key->quotalen >= maxbytes ||
newowner->qnbytes + key->quotalen <
newowner->qnbytes)
goto quota_overrun;
newowner->qnkeys++;
newowner->qnbytes += key->quotalen;
spin_unlock(&newowner->lock);
spin_lock(&key->user->lock);
key->user->qnkeys--;
key->user->qnbytes -= key->quotalen;
spin_unlock(&key->user->lock);
}
atomic_dec(&key->user->nkeys);
atomic_inc(&newowner->nkeys);
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
atomic_dec(&key->user->nikeys);
atomic_inc(&newowner->nikeys);
}
zapowner = key->user;
key->user = newowner;
key->uid = uid;
}
if (group != (gid_t) -1)
key->gid = gid;
ret = 0;
error_put:
up_write(&key->sem);
key_put(key);
if (zapowner)
key_user_put(zapowner);
error:
return ret;
quota_overrun:
spin_unlock(&newowner->lock);
zapowner = newowner;
ret = -EDQUOT;
goto error_put;
} | 1 | 59 | -1 | https://github.com/torvalds/linux/commit/363b02dab09b3226f3bd1420dad9c72b79a42a76 | 0CCPP |
static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
{
int cur = *cnt;
while (cur == *cnt) {
pipe_wait(pipe);
if (signal_pending(current))
break;
}
return cur == *cnt ? -ERESTARTSYS : 0;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/759c01142a5d0f364a462346168a56de28a80f52 | 0CCPP |
static void spl_filesystem_dir_it_rewind(zend_object_iterator *iter TSRMLS_DC)
{
spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter);
object->u.dir.index = 0;
if (object->u.dir.dirp) {
php_stream_rewinddir(object->u.dir.dirp);
}
spl_filesystem_dir_read(object TSRMLS_CC);
} | 1 | null | -1 | https://github.com/php/php-src/commit/7245bff300d3fa8bacbef7897ff080a6f1c23eba | 0CCPP |
static int decode_pixdata(deark *c, lctx *d, struct fmtutil_macbitmap_info *bi, i64 pos)
{
int retval = 0;
de_dbg_indent(c, 1);
if(bi->npwidth==0 || bi->height==0) {
de_warn(c, "Ignoring zero-size bitmap (%d"DE_CHAR_TIMES"%d)",
(int)bi->npwidth, (int)bi->height);
goto done;
}
if(!de_good_image_dimensions(c, bi->npwidth, bi->height)) goto done;
if(bi->pixelsize!=1 && bi->pixelsize!=2 && bi->pixelsize!=4 && bi->pixelsize!=8 &&
bi->pixelsize!=16 && bi->pixelsize!=24 && bi->pixelsize!=32)
{
de_err(c, "%d bits/pixel images are not supported", (int)bi->pixelsize);
goto done;
}
if((bi->uses_pal && bi->pixeltype!=0) || (!bi->uses_pal && bi->pixeltype!=16)) {
de_err(c, "Pixel type %d is not supported", (int)bi->pixeltype);
goto done;
}
if(bi->cmpcount!=1 && bi->cmpcount!=3 && bi->cmpcount!=4) {
de_err(c, "Component count %d is not supported", (int)bi->cmpcount);
goto done;
}
if(bi->cmpsize!=1 && bi->cmpsize!=2 && bi->cmpsize!=4 && bi->cmpsize!=5 &&
bi->cmpsize!=8)
{
de_err(c, "%d-bit components are not supported", (int)bi->cmpsize);
goto done;
}
if(bi->packing_type!=0 && bi->packing_type!=1 && bi->packing_type!=3 && bi->packing_type!=4) {
de_err(c, "Packing type %d is not supported", (int)bi->packing_type);
goto done;
}
if((bi->uses_pal &&
(bi->packing_type==0 || bi->packing_type==1) &&
(bi->pixelsize==1 || bi->pixelsize==2 || bi->pixelsize==4 || bi->pixelsize==8) &&
bi->cmpcount==1 && bi->cmpsize==bi->pixelsize) ||
(!bi->uses_pal && bi->packing_type==3 && bi->pixelsize==16 && bi->cmpcount==3 && bi->cmpsize==5) ||
(!bi->uses_pal && bi->packing_type==4 && bi->pixelsize==32 && bi->cmpcount==3 && bi->cmpsize==8) ||
(!bi->uses_pal && bi->packing_type==4 && bi->pixelsize==32 && bi->cmpcount==4 && bi->cmpsize==8))
{
;
}
else {
de_err(c, "This type of image is not supported");
goto done;
}
if(bi->cmpcount==4) {
de_warn(c, "This image might have transparency, which is not supported.");
}
decode_bitmap(c, d, bi, pos);
done:
de_dbg_indent(c, -1);
return retval;
} | 0 | null | -1 | https://github.com/jsummers/deark/commit/287f5ac31dfdc074669182f51ece637706070eeb | 0CCPP |
njs_promise_perform_all_settled_handler(njs_vm_t *vm, njs_iterator_args_t *args,
njs_value_t *value, int64_t index)
{
njs_int_t ret;
njs_array_t *array;
njs_value_t arguments[2], next;
njs_function_t *on_fulfilled, *on_rejected;
njs_promise_capability_t *capability;
njs_promise_all_context_t *context;
njs_promise_iterator_args_t *pargs;
pargs = (njs_promise_iterator_args_t *) args;
capability = pargs->capability;
array = args->data;
njs_set_undefined(&array->start[index]);
ret = njs_function_call(vm, pargs->function, pargs->constructor, value,
1, &next);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
on_fulfilled = njs_promise_create_function(vm,
sizeof(njs_promise_all_context_t));
if (njs_slow_path(on_fulfilled == NULL)) {
return NJS_ERROR;
}
context = on_fulfilled->context;
context->already_called = 0;
context->index = (uint32_t) index;
context->values = pargs->args.data;
context->capability = capability;
context->remaining_elements = pargs->remaining;
on_rejected = njs_promise_create_function(vm, 0);
if (njs_slow_path(on_rejected == NULL)) {
return NJS_ERROR;
}
on_fulfilled->u.native = njs_promise_all_settled_element_functions;
on_rejected->u.native = njs_promise_all_settled_element_functions;
on_rejected->magic8 = 1;
on_fulfilled->args_count = 1;
on_rejected->args_count = 1;
on_rejected->context = context;
(*pargs->remaining)++;
njs_set_function(&arguments[0], on_fulfilled);
njs_set_function(&arguments[1], on_rejected);
ret = njs_promise_invoke_then(vm, &next, arguments, 2);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
return NJS_OK;
} | 1 | null | -1 | https://github.com/nginx/njs/commit/31ed93a5623f24ca94e6d47e895ba735d9d97d46 | 0CCPP |
R_API int r_core_bin_set_arch_bits(RCore *r, const char *name, const char * arch, ut16 bits) {
RCoreFile *cf = r_core_file_cur (r);
RBinFile *binfile;
if (!name) {
name = (cf && cf->desc) ? cf->desc->name : NULL;
}
if (!name) {
return false;
}
if (!r_asm_is_valid (r->assembler, arch)) {
return false;
}
binfile = r_bin_file_find_by_arch_bits (r->bin, arch, bits, name);
if (!binfile) {
return false;
}
if (!r_bin_use_arch (r->bin, arch, bits, name)) {
return false;
}
r_core_bin_set_cur (r, binfile);
return r_core_bin_set_env (r, binfile);
} | 0 | null | -1 | https://github.com/radareorg/radare2/commit/f85bc674b2a2256a364fe796351bc1971e106005 | 0CCPP |
static int db_dict_iter_lookup_key_values(struct db_dict_value_iter *iter)
{
struct db_dict_iter_key *key;
string_t *path;
const char *error;
int ret;
array_sort(&iter->keys, db_dict_iter_key_cmp);
path = t_str_new(128);
str_append(path, DICT_PATH_SHARED);
array_foreach_modifiable(&iter->keys, key) {
if (!key->used)
continue;
str_truncate(path, strlen(DICT_PATH_SHARED));
ret = var_expand(path, key->key->key, iter->var_expand_table, &error);
if (ret <= 0) {
auth_request_log_error(iter->auth_request, AUTH_SUBSYS_DB,
"Failed to expand key %s: %s", key->key->key, error);
return -1;
}
ret = dict_lookup(iter->conn->dict, iter->pool,
str_c(path), &key->value, &error);
if (ret > 0) {
auth_request_log_debug(iter->auth_request, AUTH_SUBSYS_DB,
"Lookup: %s = %s", str_c(path),
key->value);
} else if (ret < 0) {
auth_request_log_error(iter->auth_request, AUTH_SUBSYS_DB,
"Failed to lookup key %s: %s", str_c(path), error);
return -1;
} else if (key->key->default_value != NULL) {
auth_request_log_debug(iter->auth_request, AUTH_SUBSYS_DB,
"Lookup: %s not found, using default value %s",
str_c(path), key->key->default_value);
key->value = key->key->default_value;
} else {
return 0;
}
}
return 1;
} | 1 | 13,14,15,16,17,18 | -1 | https://github.com/dovecot/core/commit/000030feb7a30f193197f1aab8a7b04a26b42735 | 0CCPP |
static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_esn,
struct nlattr *rp)
{
struct xfrm_replay_state_esn *up;
int ulen;
if (!replay_esn || !rp)
return 0;
up = nla_data(rp);
ulen = xfrm_replay_state_esn_len(up);
if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
return -EINVAL;
if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
return -EINVAL;
return 0;
} | 1 | 9 | -1 | https://github.com/torvalds/linux/commit/f843ee6dd019bcece3e74e76ad9df0155655d0df | 0CCPP |
int snd_timer_open(struct snd_timer_instance **ti,
char *owner, struct snd_timer_id *tid,
unsigned int slave_id)
{
struct snd_timer *timer;
struct snd_timer_instance *timeri = NULL;
struct device *card_dev_to_put = NULL;
int err;
mutex_lock(®ister_mutex);
if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||
tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {
pr_debug("ALSA: timer: invalid slave class %i\n",
tid->dev_sclass);
err = -EINVAL;
goto unlock;
}
timeri = snd_timer_instance_new(owner, NULL);
if (!timeri) {
err = -ENOMEM;
goto unlock;
}
timeri->slave_class = tid->dev_sclass;
timeri->slave_id = tid->device;
timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;
list_add_tail(&timeri->open_list, &snd_timer_slave_list);
err = snd_timer_check_slave(timeri);
if (err < 0) {
snd_timer_close_locked(timeri, &card_dev_to_put);
timeri = NULL;
}
goto unlock;
}
timer = snd_timer_find(tid);
#ifdef CONFIG_MODULES
if (!timer) {
mutex_unlock(®ister_mutex);
snd_timer_request(tid);
mutex_lock(®ister_mutex);
timer = snd_timer_find(tid);
}
#endif
if (!timer) {
err = -ENODEV;
goto unlock;
}
if (!list_empty(&timer->open_list_head)) {
timeri = list_entry(timer->open_list_head.next,
struct snd_timer_instance, open_list);
if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {
err = -EBUSY;
timeri = NULL;
goto unlock;
}
}
if (timer->num_instances >= timer->max_instances) {
err = -EBUSY;
goto unlock;
}
timeri = snd_timer_instance_new(owner, timer);
if (!timeri) {
err = -ENOMEM;
goto unlock;
}
if (timer->card)
get_device(&timer->card->card_dev);
timeri->slave_class = tid->dev_sclass;
timeri->slave_id = slave_id;
if (list_empty(&timer->open_list_head) && timer->hw.open) {
err = timer->hw.open(timer);
if (err) {
kfree(timeri->owner);
kfree(timeri);
timeri = NULL;
if (timer->card)
card_dev_to_put = &timer->card->card_dev;
module_put(timer->module);
goto unlock;
}
}
list_add_tail(&timeri->open_list, &timer->open_list_head);
timer->num_instances++;
err = snd_timer_check_master(timeri);
if (err < 0) {
snd_timer_close_locked(timeri, &card_dev_to_put);
timeri = NULL;
}
unlock:
mutex_unlock(®ister_mutex);
if (card_dev_to_put)
put_device(card_dev_to_put);
*ti = timeri;
return err;
} | 1 | 47,49,51 | -1 | https://github.com/torvalds/linux/commit/e7af6307a8a54f0b873960b32b6a644f2d0fbd97 | 0CCPP |
public ModalDialog setResizable(final boolean resizable)
{
this.resizable = resizable;
return this;
} | 0 | null | -1 | https://github.com/micromata/projectforge-webapp/commit/422de35e3c3141e418a73bfb39b430d5fd74077e | 2Java |
__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr)
{
if (addr->sa_family == AF_IB)
return ((struct sockaddr_ib *) addr)->sib_sid;
return cpu_to_be64(((u64)id->ps << 16) + be16_to_cpu(cma_port(addr)));
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/b2853fd6c2d0f383dbdf7427e263eb576a633867 | 0CCPP |
header_gets (SF_PRIVATE *psf, char *ptr, int bufsize)
{ int k ;
for (k = 0 ; k < bufsize - 1 ; k++)
{ if (psf->headindex < psf->headend)
{ ptr [k] = psf->header [psf->headindex] ;
psf->headindex ++ ;
}
else
{ psf->headend += psf_fread (psf->header + psf->headend, 1, 1, psf) ;
ptr [k] = psf->header [psf->headindex] ;
psf->headindex = psf->headend ;
} ;
if (ptr [k] == '\n')
break ;
} ;
ptr [k] = 0 ;
return k ;
} | 1 | 3,4,5,8,9,10 | -1 | https://github.com/libsndfile/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074 | 0CCPP |
void ctrl_alt_del(void)
{
static DECLARE_WORK(cad_work, deferred_cad);
if (C_A_D)
schedule_work(&cad_work);
else
kill_cad_pid(SIGINT, 1);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/2702b1526c7278c4d65d78de209a465d4de2885e | 0CCPP |
private double getPart1MaxWidth(StringBounder stringBounder) {
double width = 0;
for (Player player : players.values())
width = Math.max(width, player.getPart1(0, 0).calculateDimension(stringBounder).getWidth());
return width;
} | 0 | null | -1 | https://github.com/plantuml/plantuml/commit/93e5964e5f35914f3f7b89de620c596795550083 | 2Java |
static void process_blob(struct rev_info *revs,
struct blob *blob,
show_object_fn show,
struct strbuf *path,
const char *name,
void *cb_data)
{
struct object *obj = &blob->object;
if (!revs->blob_objects)
return;
if (!obj)
die("bad blob object");
if (obj->flags & (UNINTERESTING | SEEN))
return;
obj->flags |= SEEN;
show(obj, path, name, cb_data);
} | 1 | 15 | -1 | https://github.com/git/git/commit/de1e67d0703894cb6ea782e36abb63976ab07e60 | 0CCPP |
static void cma_ndev_work_handler(struct work_struct *_work)
{
struct cma_ndev_work *work = container_of(_work, struct cma_ndev_work, work);
struct rdma_id_private *id_priv = work->id;
int destroy = 0;
mutex_lock(&id_priv->handler_mutex);
if (id_priv->state == RDMA_CM_DESTROYING ||
id_priv->state == RDMA_CM_DEVICE_REMOVAL)
goto out;
if (id_priv->id.event_handler(&id_priv->id, &work->event)) {
cma_exch(id_priv, RDMA_CM_DESTROYING);
destroy = 1;
}
out:
mutex_unlock(&id_priv->handler_mutex);
cma_deref_id(id_priv);
if (destroy)
rdma_destroy_id(&id_priv->id);
kfree(work);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/b2853fd6c2d0f383dbdf7427e263eb576a633867 | 0CCPP |
static inline int mk_vhost_fdt_close(struct session_request *sr)
{
int id;
unsigned int hash;
struct vhost_fdt_hash_table *ht = NULL;
struct vhost_fdt_hash_chain *hc;
if (config->fdt == MK_FALSE) {
return close(sr->fd_file);
}
id = sr->vhost_fdt_id;
hash = sr->vhost_fdt_hash;
ht = mk_vhost_fdt_table_lookup(id, sr->host_conf);
if (mk_unlikely(!ht)) {
return close(sr->fd_file);
}
hc = mk_vhost_fdt_chain_lookup(hash, ht);
if (hc) {
hc->readers--;
if (hc->readers == 0) {
hc->fd = -1;
hc->hash = 0;
ht->av_slots++;
return close(sr->fd_file);
}
else {
return 0;
}
}
return close(sr->fd_file);
} | 1 | null | -1 | https://github.com/monkey/monkey/commit/b2d0e6f92310bb14a15aa2f8e96e1fb5379776dd | 0CCPP |
static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,
poll_table *wait)
{
struct sock *sk = sock->sk, *other;
unsigned int mask, writable;
sock_poll_wait(file, sk_sleep(sk), wait);
mask = 0;
if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
mask |= POLLERR |
(sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0);
if (sk->sk_shutdown & RCV_SHUTDOWN)
mask |= POLLRDHUP | POLLIN | POLLRDNORM;
if (sk->sk_shutdown == SHUTDOWN_MASK)
mask |= POLLHUP;
if (!skb_queue_empty(&sk->sk_receive_queue))
mask |= POLLIN | POLLRDNORM;
if (sk->sk_type == SOCK_SEQPACKET) {
if (sk->sk_state == TCP_CLOSE)
mask |= POLLHUP;
if (sk->sk_state == TCP_SYN_SENT)
return mask;
}
if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT)))
return mask;
writable = unix_writable(sk);
other = unix_peer_get(sk);
if (other) {
if (unix_peer(other) != sk) {
sock_poll_wait(file, &unix_sk(other)->peer_wait, wait);
if (unix_recvq_full(other))
writable = 0;
}
sock_put(other);
}
if (writable)
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
else
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
return mask;
} | 1 | 25,26,27,28,29,30,31,32 | -1 | https://github.com/torvalds/linux/commit/7d267278a9ece963d77eefec61630223fce08c6c | 0CCPP |
let random = bytes => {
fillPool(bytes)
return pool.subarray(poolOffset - bytes, poolOffset)
} | 1 | 1 | -1 | https://github.com/ai/nanoid/commit/2b7bd9332bc49b6330c7ddb08e5c661833db2575 | 3JavaScript |
void Compute(OpKernelContext* context) override {
const Tensor& input = context->input(0);
const Tensor& filter = context->input(1);
const Tensor& out_backprop = context->input(2);
int stride_rows = 0, stride_cols = 0;
int rate_rows = 0, rate_cols = 0;
int64 pad_top = 0, pad_left = 0;
int64 out_rows = 0, out_cols = 0;
ParseSizes(context, strides_, rates_, padding_, &stride_rows, &stride_cols,
&rate_rows, &rate_cols, &pad_top, &pad_left, &out_rows,
&out_cols);
const int batch = input.dim_size(0);
const int depth = input.dim_size(3);
OP_REQUIRES(context,
batch == out_backprop.dim_size(0) &&
out_rows == out_backprop.dim_size(1) &&
out_cols == out_backprop.dim_size(2) &&
depth == out_backprop.dim_size(3),
errors::InvalidArgument("out_backprop has incompatible size."));
Tensor* in_backprop = nullptr;
OP_REQUIRES_OK(context,
context->allocate_output(0, input.shape(), &in_backprop));
if (input.shape().num_elements() == 0) {
return;
}
functor::DilationBackpropInput<Device, T>()(
context->eigen_device<Device>(), input.tensor<T, 4>(),
filter.tensor<T, 3>(), out_backprop.tensor<T, 4>(), stride_rows,
stride_cols, rate_rows, rate_cols, pad_top, pad_left,
in_backprop->tensor<T, 4>());
} | 1 | null | -1 | https://github.com/tensorflow/tensorflow/commit/3f6fe4dfef6f57e768260b48166c27d148f3015f | 0CCPP |
update: (proxy, data) => {
const handledData = handleDataErrors(
(data: any) => data.tokenCreate,
data.data,
data.errors
);
if (!handledData.errors && handledData.data) {
setAuthToken(handledData.data.token);
if (window.PasswordCredential && variables) {
navigator.credentials.store(
new window.PasswordCredential({
id: variables.email,
password: variables.password,
})
);
}
}
if (options && options.update) {
options.update(proxy, data);
}
}, | 1 | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 | -1 | https://github.com/saleor/saleor-storefront/commit/0b0842f25ef88d181d303b7de15099317c6b3ae0 | 5TypeScript |
bool onlySpaces (const char*str)
{
while (*str)
{
if (' ' != *str && '\t' != *str && '\r' != *str && '\n' != *str)
return false;
str++;
}
return true;
} | 0 | null | -1 | https://github.com/yast/yast-core/commit/7fe2e3df308b8b6a901cb2cfd60f398df53219de | 0CCPP |
def _cnonce():
dig = _md5(
"%s:%s"
% (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])
).hexdigest()
return dig[:16]
| 0 | null | -1 | https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc | 4Python |
Jsi_Number Jsi_ValueToNumberInt(Jsi_Interp *interp, Jsi_Value *v, int isInt)
{
char *endPtr = NULL, *sptr;
Jsi_Number a = 0;
switch(v->vt) {
case JSI_VT_BOOL:
a = (Jsi_Number)(v->d.val ? 1.0: 0);
break;
case JSI_VT_NULL:
a = 0;
break;
case JSI_VT_OBJECT: {
Jsi_Obj *obj = v->d.obj;
switch(obj->ot) {
case JSI_OT_BOOL:
a = (Jsi_Number)(obj->d.val ? 1.0: 0);
break;
case JSI_OT_NUMBER:
a = obj->d.num;
break;
case JSI_OT_STRING:
sptr = obj->d.s.str;
goto donum;
break;
default:
a = 0;
break;
}
break;
}
case JSI_VT_UNDEF:
a = Jsi_NumberNaN();
break;
case JSI_VT_NUMBER:
a = v->d.num;
break;
case JSI_VT_STRING:
sptr = v->d.s.str;
donum:
if (!isInt) {
a = strtod(sptr, &endPtr);
if (endPtr && *endPtr) {
a = interp->NaNValue->d.num;
}
} else {
a = (Jsi_Number)strtol(sptr, &endPtr, 0);
if (!isdigit(*sptr))
a = interp->NaNValue->d.num;
}
break;
default:
Jsi_LogBug("Convert a unknown type: 0x%x to number", v->vt);
break;
}
if (isInt && Jsi_NumberIsNormal(a))
a = (Jsi_Number)((int64_t)(a));
return a;
} | 0 | null | -1 | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | 0CCPP |
static int mptctl_do_reset(unsigned long arg)
{
struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;
struct mpt_ioctl_diag_reset krinfo;
MPT_ADAPTER *iocp;
if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
"Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
__FILE__, __LINE__, urinfo);
return -EFAULT;
}
if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
__FILE__, __LINE__, krinfo.hdr.iocnum);
return -ENODEV; /*
}
dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
iocp->name));
if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) {
printk (MYIOC_s_ERR_FMT "%s@%d::mptctl_do_reset - reset failed.\n",
iocp->name, __FILE__, __LINE__);
return -1;
}
return 0;
} | 1 | 0,4,11,12,13,14,15 | -1 | https://github.com/torvalds/linux/commit/28d76df18f0ad5bcf5fa48510b225f0ed262a99b | 0CCPP |
static void start_apic_timer(struct kvm_lapic *apic)
{
ktime_t now;
atomic_set(&apic->lapic_timer.pending, 0);
if (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic)) {
now = apic->lapic_timer.timer.base->get_time();
apic->lapic_timer.period = (u64)kvm_apic_get_reg(apic, APIC_TMICT)
* APIC_BUS_CYCLE_NS * apic->divide_count;
if (!apic->lapic_timer.period)
return;
if (apic_lvtt_period(apic)) {
s64 min_period = min_timer_period_us * 1000LL;
if (apic->lapic_timer.period < min_period) {
pr_info_ratelimited(
"kvm: vcpu %i: requested %lld ns "
"lapic timer period limited to %lld ns\n",
apic->vcpu->vcpu_id,
apic->lapic_timer.period, min_period);
apic->lapic_timer.period = min_period;
}
}
hrtimer_start(&apic->lapic_timer.timer,
ktime_add_ns(now, apic->lapic_timer.period),
HRTIMER_MODE_ABS);
apic_debug("%s: bus cycle is %" PRId64 "ns, now 0x%016"
PRIx64 ", "
"timer initial count 0x%x, period %lldns, "
"expire @ 0x%016" PRIx64 ".\n", __func__,
APIC_BUS_CYCLE_NS, ktime_to_ns(now),
kvm_apic_get_reg(apic, APIC_TMICT),
apic->lapic_timer.period,
ktime_to_ns(ktime_add_ns(now,
apic->lapic_timer.period)));
} else if (apic_lvtt_tscdeadline(apic)) {
u64 guest_tsc, tscdeadline = apic->lapic_timer.tscdeadline;
u64 ns = 0;
struct kvm_vcpu *vcpu = apic->vcpu;
unsigned long this_tsc_khz = vcpu->arch.virtual_tsc_khz;
unsigned long flags;
if (unlikely(!tscdeadline || !this_tsc_khz))
return;
local_irq_save(flags);
now = apic->lapic_timer.timer.base->get_time();
guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu, native_read_tsc());
if (likely(tscdeadline > guest_tsc)) {
ns = (tscdeadline - guest_tsc) * 1000000ULL;
do_div(ns, this_tsc_khz);
}
hrtimer_start(&apic->lapic_timer.timer,
ktime_add_ns(now, ns), HRTIMER_MODE_ABS);
local_irq_restore(flags);
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/fda4e2e85589191b123d31cdc21fd33ee70f50fd | 0CCPP |
netsnmp_mibindex_lookup( const char *dirname )
{
int i;
static char tmpbuf[300];
for (i=0; i<_mibindex; i++) {
if ( _mibindexes[i] &&
strcmp( _mibindexes[i], dirname ) == 0) {
snprintf(tmpbuf, sizeof(tmpbuf), "%s/mib_indexes/%d",
get_persistent_directory(), i);
tmpbuf[sizeof(tmpbuf)-1] = 0;
DEBUGMSGTL(("mibindex", "lookup: %s (%d) %s\n", dirname, i, tmpbuf ));
return tmpbuf;
}
}
DEBUGMSGTL(("mibindex", "lookup: (none)\n"));
return NULL;
} | 1 | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 | -1 | https://github.com/net-snmp/net-snmp/commit/4fd9a450444a434a993bc72f7c3486ccce41f602 | 0CCPP |
def category_list():
if current_user.check_visibility(constants.SIDEBAR_CATEGORY):
if current_user.get_view_property('category', 'dir') == 'desc':
order = db.Tags.name.desc()
order_no = 0
else:
order = db.Tags.name.asc()
order_no = 1
entries = calibre_db.session.query(db.Tags, func.count('books_tags_link.book').label('count')) \
.join(db.books_tags_link).join(db.Books).order_by(order).filter(calibre_db.common_filters()) \
.group_by(text('books_tags_link.tag')).all()
charlist = calibre_db.session.query(func.upper(func.substr(db.Tags.name, 1, 1)).label('char')) \
.join(db.books_tags_link).join(db.Books).filter(calibre_db.common_filters()) \
.group_by(func.upper(func.substr(db.Tags.name, 1, 1))).all()
return render_title_template('list.html', entries=entries, folder='web.books_list', charlist=charlist,
title=_(u"Categories"), page="catlist", data="category", order=order_no)
else:
abort(404) | 1 | 11,12,13,14 | -1 | https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367 | 4Python |
void Compute(OpKernelContext* context) override {
OpInputList ragged_nested_splits_in;
OP_REQUIRES_OK(context, context->input_list("rt_nested_splits",
&ragged_nested_splits_in));
const int ragged_nested_splits_len = ragged_nested_splits_in.size();
RaggedTensorVariant batched_ragged_input;
batched_ragged_input.set_values(context->input(ragged_nested_splits_len));
batched_ragged_input.mutable_nested_splits()->reserve(
ragged_nested_splits_len);
for (int i = 0; i < ragged_nested_splits_len; i++) {
batched_ragged_input.append_splits(ragged_nested_splits_in[i]);
}
if (!batched_input_) {
Tensor* encoded_scalar;
OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape({}),
&encoded_scalar));
encoded_scalar->scalar<Variant>()() = std::move(batched_ragged_input);
return;
}
std::vector<RaggedTensorVariant> unbatched_ragged_input;
auto batched_splits_top_vec =
batched_ragged_input.splits(0).vec<SPLIT_TYPE>();
int num_components = batched_splits_top_vec.size() - 1;
OP_REQUIRES(context, num_components >= 0,
errors::Internal("Invalid split argument."));
OP_REQUIRES_OK(context, UnbatchRaggedZerothDim<VALUE_TYPE, SPLIT_TYPE>(
batched_ragged_input, &unbatched_ragged_input));
Tensor* encoded_vector;
int output_size = unbatched_ragged_input.size();
OP_REQUIRES_OK(context,
context->allocate_output(0, TensorShape({output_size}),
&encoded_vector));
auto encoded_vector_t = encoded_vector->vec<Variant>();
for (int i = 0; i < output_size; i++) {
encoded_vector_t(i) = unbatched_ragged_input[i];
}
} | 1 | null | -1 | https://github.com/tensorflow/tensorflow/commit/be7a4de6adfbd303ce08be4332554dff70362612 | 0CCPP |
bool_t ksz8851IrqHandler(NetInterface *interface)
{
bool_t flag;
size_t n;
uint16_t ier;
uint16_t isr;
flag = FALSE;
ier = ksz8851ReadReg(interface, KSZ8851_IER);
ksz8851WriteReg(interface, KSZ8851_IER, 0);
isr = ksz8851ReadReg(interface, KSZ8851_ISR);
if((isr & KSZ8851_ISR_LCIS) != 0)
{
ier &= ~KSZ8851_IER_LCIE;
interface->nicEvent = TRUE;
flag |= osSetEventFromIsr(&netEvent);
}
if((isr & KSZ8851_ISR_TXIS) != 0)
{
ksz8851WriteReg(interface, KSZ8851_ISR, KSZ8851_ISR_TXIS);
n = ksz8851ReadReg(interface, KSZ8851_TXMIR) & KSZ8851_TXMIR_TXMA;
if(n >= (ETH_MAX_FRAME_SIZE + 8))
{
flag |= osSetEventFromIsr(&interface->nicTxEvent);
}
}
if((isr & KSZ8851_ISR_RXIS) != 0)
{
ier &= ~KSZ8851_IER_RXIE;
interface->nicEvent = TRUE;
flag |= osSetEventFromIsr(&netEvent);
}
ksz8851WriteReg(interface, KSZ8851_IER, ier);
return flag;
} | 0 | null | -1 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 0CCPP |
char *strdup(const char *s1)
{
char *s2 = 0;
if (s1) {
s2 = malloc(strlen(s1) + 1);
strcpy(s2, s1);
}
return s2;
} | 1 | 4,5 | -1 | https://github.com/git/git/commit/34fa79a6cde56d6d428ab0d3160cb094ebad3305 | 0CCPP |
static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn,
unsigned access)
{
unsigned int gen = kvm_current_mmio_generation(kvm);
u64 mask = generation_mmio_spte_mask(gen);
access &= ACC_WRITE_MASK | ACC_USER_MASK;
mask |= shadow_mmio_mask | access | gfn << PAGE_SHIFT;
trace_mark_mmio_spte(sptep, gfn, access, gen);
mmu_spte_set(sptep, mask);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/bfd0a56b90005f8c8a004baf407ad90045c2b11e | 0CCPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.