processed_func string | target int64 | flaw_line string | flaw_line_index int64 | commit_url string | language class label |
|---|---|---|---|---|---|
public void translate(ServerMultiBlockChangePacket packet, GeyserSession session) {
for (BlockChangeRecord record : packet.getRecords()) {
ChunkUtils.updateBlock(session, record.getBlock(), record.getPosition());
}
} | 1 | 0 | -1 | https://github.com/GeyserMC/Geyser/commit/b9541505af68ac7b7c093206ac7b1ba88957a5a6 | 2Java |
def needs_clamp(t, encoding):
if encoding not in (Encoding.ABI, Encoding.JSON_ABI):
return False
if isinstance(t, (ByteArrayLike, DArrayType)):
if encoding == Encoding.JSON_ABI:
return False
return True
if isinstance(t, BaseType) and t.typ not in (
"int256",
"uint256",
"bytes32",
):
return True
if isinstance(t, SArrayType):
return needs_clamp(t.subtype, encoding)
if isinstance(t, TupleLike):
return any(needs_clamp(m, encoding) for m in t.tuple_members())
return False
| 1 | 1,4,5,6,11,17 | -1 | https://github.com/vyperlang/vyper.git/commit/049dbdc647b2ce838fae7c188e6bb09cf16e470b | 4Python |
auto ReferenceHandle::Get(Local<Value> key_handle, MaybeLocal<Object> maybe_options) -> Local<Value> {
return ThreePhaseTask::Run<async, GetRunner>(*isolate, *this, key_handle, maybe_options, inherit);
} | 1 | 1 | -1 | https://github.com/laverdet/isolated-vm/commit/2646e6c1558bac66285daeab54c7d490ed332b15 | 0CCPP |
static const ut8 *fill_block_data(const ut8 *buf, const ut8 *buf_end, RzBinDwarfBlock *block) {
block->data = calloc(sizeof(ut8), block->length);
if (!block->data) {
return NULL;
}
if (block->data) {
size_t j = 0;
for (j = 0; j < block->length; j++) {
block->data[j] = READ8(buf);
}
}
return buf;
} | 0 | null | -1 | https://github.com/rizinorg/rizin/commit/aa6917772d2f32e5a7daab25a46c72df0b5ea406 | 0CCPP |
void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs)
{
kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));
kfree(ubufs);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/bd97120fc3d1a11f3124c7c9ba1d91f51829eb85 | 0CCPP |
static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data)
{
int pad = ndisc_addr_option_pad(skb->dev->type);
int data_len = skb->dev->addr_len;
int space = ndisc_opt_addr_space(skb->dev);
u8 *opt = skb_put(skb, space);
opt[0] = type;
opt[1] = space>>3;
memset(opt + 2, 0, pad);
opt += pad;
space -= pad;
memcpy(opt+2, data, data_len);
data_len += 2;
opt += data_len;
space -= data_len;
if (space > 0)
memset(opt, 0, space);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/6fd99094de2b83d1d4c8457f2c83483b2828e75a | 0CCPP |
static inline int TxsFreeUnit(struct atl2_adapter *adapter)
{
u32 txs_write_ptr = (u32) atomic_read(&adapter->txs_write_ptr);
return (adapter->txs_next_clear >= txs_write_ptr) ?
(int) (adapter->txs_ring_size - adapter->txs_next_clear +
txs_write_ptr - 1) :
(int) (txs_write_ptr - adapter->txs_next_clear - 1);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f43bfaeddc79effbf3d0fcb53ca477cca66f3db8 | 0CCPP |
def connect(self, port=None):
"""connect to the chroot; nothing to do here"""
vvv("THIS IS A LOCAL CHROOT DIR", host=self.jail)
return self
| 1 | 1,2 | -1 | https://github.com/ansible/ansible.git/commit/ca2f2c4ebd7b5e097eab0a710f79c1f63badf95b | 4Python |
njs_vmcode_await(njs_vm_t *vm, njs_vmcode_await_t *await)
{
size_t size;
njs_int_t ret;
njs_frame_t *frame;
njs_value_t ctor, val, on_fulfilled, on_rejected, *value;
njs_promise_t *promise;
njs_function_t *fulfilled, *rejected;
njs_async_ctx_t *ctx;
njs_native_frame_t *active;
active = &vm->active_frame->native;
value = njs_scope_valid_value(vm, await->retval);
if (njs_slow_path(value == NULL)) {
return NJS_ERROR;
}
njs_set_function(&ctor, &vm->constructors[NJS_OBJ_TYPE_PROMISE]);
promise = njs_promise_resolve(vm, &ctor, value);
if (njs_slow_path(promise == NULL)) {
return NJS_ERROR;
}
ctx = active->function->await;
if (ctx == NULL) {
ctx = njs_mp_alloc(vm->mem_pool, sizeof(njs_async_ctx_t));
if (njs_slow_path(ctx == NULL)) {
njs_memory_error(vm);
return NJS_ERROR;
}
size = njs_function_frame_size(active);
fulfilled = njs_promise_create_function(vm, size);
if (njs_slow_path(fulfilled == NULL)) {
return NJS_ERROR;
}
ctx->await = fulfilled->context;
ctx->capability = active->function->context;
active->function->context = NULL;
ret = njs_function_frame_save(vm, ctx->await, NULL);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
} else {
fulfilled = njs_promise_create_function(vm, 0);
if (njs_slow_path(fulfilled == NULL)) {
return NJS_ERROR;
}
}
ctx->pc = (u_char *) await + sizeof(njs_vmcode_await_t);
ctx->index = await->retval;
frame = (njs_frame_t *) active;
if (frame->exception.catch != NULL) {
ctx->await->native.pc = frame->exception.catch;
} else {
ctx->await->native.pc = ctx->pc;
}
fulfilled->context = ctx;
fulfilled->args_count = 1;
fulfilled->u.native = njs_await_fulfilled;
rejected = njs_promise_create_function(vm, 0);
if (njs_slow_path(rejected == NULL)) {
return NJS_ERROR;
}
rejected->context = ctx;
rejected->args_count = 1;
rejected->u.native = njs_await_rejected;
njs_set_object(&val, &promise->object);
njs_set_function(&on_fulfilled, fulfilled);
njs_set_function(&on_rejected, rejected);
ret = njs_promise_perform_then(vm, &val, &on_fulfilled, &on_rejected, NULL);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
(void) njs_vmcode_return(vm, NULL, &vm->retval);
return NJS_AGAIN;
} | 1 | 63 | -1 | https://github.com/nginx/njs/commit/6a40a85ff239497c6458c7dbef18f6a2736fe992 | 0CCPP |
Graph.prototype.getGlobalVariable=function(b){var e=null;"date"==b?e=(new Date).toLocaleDateString():"time"==b?e=(new Date).toLocaleTimeString():"timestamp"==b?e=(new Date).toLocaleString():"date{"==b.substring(0,5)&&(b=b.substring(5,b.length-1),e=this.formatDate(new Date,b));return e}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
{
if (is_muted) {
sendServerMessage("You cannot speak while muted.");
return;
}
if (!server->can_send_ic_messages) {
return;
}
AOPacket validated_packet = validateIcPacket(packet);
if (validated_packet.header == "INVALID")
return;
if (pos != "")
validated_packet.contents[5] = pos;
area->log(current_char, ipid, validated_packet);
server->broadcast(validated_packet, current_area);
area->updateLastICMessage(validated_packet.contents);
server->can_send_ic_messages = false;
server->next_message_timer.start(ConfigManager::messageFloodguard());
} | 0 | null | -1 | https://github.com/AttorneyOnline/akashi/commit/5566cdfedddef1f219aee33477d9c9690bf2f78b | 0CCPP |
int ssl3_get_cert_verify(SSL *s)
{
EVP_PKEY *pkey=NULL;
unsigned char *p;
int al,ok,ret=0;
long n;
int type=0,i,j;
X509 *peer;
const EVP_MD *md = NULL;
EVP_MD_CTX mctx;
EVP_MD_CTX_init(&mctx);
n=s->method->ssl_get_message(s,
SSL3_ST_SR_CERT_VRFY_A,
SSL3_ST_SR_CERT_VRFY_B,
-1,
SSL3_RT_MAX_PLAIN_LENGTH,
&ok);
if (!ok) return((int)n);
if (s->session->peer != NULL)
{
peer=s->session->peer;
pkey=X509_get_pubkey(peer);
type=X509_certificate_type(peer,pkey);
}
else
{
peer=NULL;
pkey=NULL;
}
if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY)
{
s->s3->tmp.reuse_message=1;
if ((peer != NULL) && (type & EVP_PKT_SIGN))
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE);
goto f_err;
}
ret=1;
goto end;
}
if (peer == NULL)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED);
al=SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
if (!(type & EVP_PKT_SIGN))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
al=SSL_AD_ILLEGAL_PARAMETER;
goto f_err;
}
if (s->s3->change_cipher_spec)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY);
al=SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
p=(unsigned char *)s->init_msg;
if (n==64 && (pkey->type==NID_id_GostR3410_94 ||
pkey->type == NID_id_GostR3410_2001) )
{
i=64;
}
else
{
if (SSL_USE_SIGALGS(s))
{
int rv = tls12_check_peer_sigalg(&md, s, p, pkey);
if (rv == -1)
{
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
else if (rv == 0)
{
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
#endif
p += 2;
n -= 2;
}
n2s(p,i);
n-=2;
if (i > n)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH);
al=SSL_AD_DECODE_ERROR;
goto f_err;
}
}
j=EVP_PKEY_size(pkey);
if ((i > j) || (n > j) || (n <= 0))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE);
al=SSL_AD_DECODE_ERROR;
goto f_err;
}
if (SSL_USE_SIGALGS(s))
{
long hdatalen = 0;
void *hdata;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al=SSL_AD_INTERNAL_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
EVP_MD_name(md));
#endif
if (!EVP_VerifyInit_ex(&mctx, md, NULL)
|| !EVP_VerifyUpdate(&mctx, hdata, hdatalen))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
al=SSL_AD_INTERNAL_ERROR;
goto f_err;
}
if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE);
goto f_err;
}
}
else
#ifndef OPENSSL_NO_RSA
if (pkey->type == EVP_PKEY_RSA)
{
i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,
MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i,
pkey->pkey.rsa);
if (i < 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT);
goto f_err;
}
if (i == 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE);
goto f_err;
}
}
else
#endif
#ifndef OPENSSL_NO_DSA
if (pkey->type == EVP_PKEY_DSA)
{
j=DSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa);
if (j <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE);
goto f_err;
}
}
else
#endif
#ifndef OPENSSL_NO_ECDSA
if (pkey->type == EVP_PKEY_EC)
{
j=ECDSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec);
if (j <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
}
else
#endif
if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001)
{ unsigned char signature[64];
int idx;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL);
EVP_PKEY_verify_init(pctx);
if (i!=64) {
fprintf(stderr,"GOST signature length is %d",i);
}
for (idx=0;idx<64;idx++) {
signature[63-idx]=p[idx];
}
j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32);
EVP_PKEY_CTX_free(pctx);
if (j<=0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
}
else
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR);
al=SSL_AD_UNSUPPORTED_CERTIFICATE;
goto f_err;
}
ret=1;
if (0)
{
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
}
end:
if (s->s3->handshake_buffer)
{
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE;
}
EVP_MD_CTX_cleanup(&mctx);
EVP_PKEY_free(pkey);
return(ret);
} | 1 | 32 | -1 | https://github.com/openssl/openssl/commit/1421e0c584ae9120ca1b88098f13d6d2e90b83a3 | 0CCPP |
PROTO.localize = function() {
F.onLocale && (this.$language = F.onLocale(this, this.res, this.isStaticFile));
return this.$language;
}; | 0 | null | -1 | https://github.com/totaljs/framework/commit/c37cafbf3e379a98db71c1125533d1e8d5b5aef7 | 3JavaScript |
res.writeHead(200, _getServerHeaders({ "Content-Type": Array.isArray(mime)?mime[0]:mime, "Content-Encoding": "gzip" }, stats));
rawStream.pipe(zlib.createGzip()).pipe(res)
.on("error", err => _sendError(req, res, 500, `500: ${req.url}, Server error: ${err}`))
.on("end", _ => res.end());
} else {
res.writeHead(200, mime ? _getServerHeaders({"Content-Type":Array.isArray(mime)?mime[0]:mime}, stats) : _getServerHeaders({}, stats));
rawStream.on("data", chunk => res.write(chunk, "binary"))
.on("error", err => _sendError(req, res, 500, `500: ${req.url}, Server error: ${err}`))
.on("end", _ => res.end());
}
}
});
} | 1 | 2,7 | -1 | https://github.com/TekMonksGitHub/monkshu/commit/4601a9bfdc934d7ac32619ce621652fad0cf452b | 3JavaScript |
void ntlm_write_message_header(wStream* s, NTLM_MESSAGE_HEADER* header)
{
Stream_Write(s, header->Signature, sizeof(NTLM_SIGNATURE));
Stream_Write_UINT32(s, header->MessageType);
} | 1 | 0 | -1 | https://github.com/FreeRDP/FreeRDP/commit/2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6 | 0CCPP |
async def dirsearch(ctx, *, argument):
Path = TOOLS["dirsearch"]
MainPath = getcwd()
chdir(Path)
await ctx.send(
f"**Running Your Dirsearch Scan, We Will Send The Results When It's Done**"
)
Process = subprocess.Popen(
f"python3 dirsearch.py -u {argument} -e * -b",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
Output = Process.communicate()[0].decode("UTF-8")
Output = removeColors.Remove(Output)
chdir(MainPath)
if len(Output) > 2000:
RandomStr = randomStrings.Genrate()
with open(f"messages/{RandomStr}", "w") as Message:
Message.write(Output)
Message.close()
await ctx.send("Results: ", file=discord.File(f"messages/{RandomStr}"))
await ctx.send(f"\n**- {ctx.message.author}**")
else:
await ctx.send(f"Results:")
await ctx.send(f"```{Output}```")
await ctx.send(f"\n**- {ctx.message.author}**")
| 1 | null | -1 | https://github.com/DEMON1A/Discord-Recon.git/commit/26e2a084679679cccdeeabbb6889ce120eff7e50 | 4Python |
static void pf_release(struct gendisk *disk, fmode_t mode)
{
struct pf_unit *pf = disk->private_data;
mutex_lock(&pf_mutex);
if (pf->access <= 0) {
mutex_unlock(&pf_mutex);
WARN_ON(1);
return;
}
pf->access--;
if (!pf->access && pf->removable)
pf_lock(pf, 0);
mutex_unlock(&pf_mutex);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/58ccd2d31e502c37e108b285bf3d343eb00c235b | 0CCPP |
def google_remote_app():
if "google" not in oauth.remote_apps:
oauth.remote_app(
"google",
base_url="https://www.google.com/accounts/",
authorize_url="https://accounts.google.com/o/oauth2/auth?prompt=select_account+consent",
request_token_url=None,
request_token_params={
"scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
},
access_token_url="https://accounts.google.com/o/oauth2/token",
access_token_method="POST",
consumer_key=settings.GOOGLE_CLIENT_ID,
consumer_secret=settings.GOOGLE_CLIENT_SECRET,
)
return oauth.google
| 1 | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 | -1 | https://github.com/getredash/redash.git/commit/da696ff7f84787cbf85967460fac52886cbe063e | 4Python |
__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
__be16 sport, __be16 dport)
{
__u32 seq;
__u32 hash[4];
struct keydata *keyptr = get_keyptr();
/*
* Pick a unique starting offset for each TCP connection endpoints
* (saddr, daddr, sport, dport).
* Note that the words are placed into the starting vector, which is
* then mixed with a partial MD4 over random data.
*/
hash[0] = (__force u32)saddr;
hash[1] = (__force u32)daddr;
hash[2] = ((__force u16)sport << 16) + (__force u16)dport;
hash[3] = keyptr->secret[11];
seq = half_md4_transform(hash, keyptr->secret) & HASH_MASK;
seq += keyptr->count;
/*
* As close as possible to RFC 793, which
* suggests using a 250 kHz clock.
* Further reading shows this assumes 2 Mb/s networks.
* For 10 Mb/s Ethernet, a 1 MHz clock is appropriate.
* For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but
* we also need to limit the resolution so that the u32 seq
* overlaps less than one time per MSL (2 minutes).
* Choosing a clock of 64 ns period is OK. (period of 274 s)
*/
seq += ktime_to_ns(ktime_get_real()) >> 6;
return seq;
} | 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 | -1 | https://github.com/torvalds/linux/commit/6e5714eaf77d79ae1c8b47e3e040ff5411b717ec | 0CCPP |
public static List<Camera> GetCameras()
{
return Cameras.Values.ToList();
} | 0 | null | -1 | https://github.com/Ulterius/server/commit/770d1821de43cf1d0a93c79025995bdd812a76ee | 1CS |
static void update_read_window_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
{
} | 0 | null | -1 | https://github.com/FreeRDP/FreeRDP/commit/6b2bc41935e53b0034fe5948aeeab4f32e80f30f | 0CCPP |
Graph.prototype.isReplacePlaceholders = function(cell)
{
return cell.value != null && typeof(cell.value) == 'object' &&
cell.value.getAttribute('placeholders') == '1';
}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
function setupGrid() {
var i, axes = allAxes(), showGrid = options.grid.show;
for (var a in plotOffset) {
var margin = options.grid.margin || 0;
plotOffset[a] = typeof margin == "number" ? margin : margin[a] || 0;
}
executeHooks(hooks.processOffset, [plotOffset]);
for (var a in plotOffset) {
if(typeof(options.grid.borderWidth) == "object") {
plotOffset[a] += showGrid ? options.grid.borderWidth[a] : 0;
}
else {
plotOffset[a] += showGrid ? options.grid.borderWidth : 0;
}
}
$.each(axes, function (_, axis) {
var axisOpts = axis.options;
axis.show = axisOpts.show == null ? axis.used : axisOpts.show;
axis.reserveSpace = axisOpts.reserveSpace == null ? axis.show : axisOpts.reserveSpace;
setRange(axis);
});
if (showGrid) {
var allocatedAxes = $.grep(axes, function (axis) {
return axis.show || axis.reserveSpace;
});
$.each(allocatedAxes, function (_, axis) {
setupTickGeneration(axis);
setTicks(axis);
snapRangeToTicks(axis, axis.ticks);
measureTickLabels(axis);
});
for (i = allocatedAxes.length - 1; i >= 0; --i)
allocateAxisBoxFirstPhase(allocatedAxes[i]);
adjustLayoutForThingsStickingOut();
$.each(allocatedAxes, function (_, axis) {
allocateAxisBoxSecondPhase(axis);
});
}
plotWidth = surface.width - plotOffset.left - plotOffset.right;
plotHeight = surface.height - plotOffset.bottom - plotOffset.top;
$.each(axes, function (_, axis) {
setTransformationHelpers(axis);
});
if (showGrid) {
drawAxisLabels();
}
insertLegend();
} | 1 | 8 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
sigalrm_handler(int sig)
{
sig = sig;
sigalrm_seen = TRUE;
os_non_restarting_signal(SIGALRM, sigalrm_handler);
} | 0 | null | -1 | https://github.com/Exim/exim/commit/65e061b76867a9ea7aeeb535341b790b90ae6c21 | 0CCPP |
navId2Hash : function(id) {
return typeof(id) == 'string' ? id.substr(4) : false;
}, | 1 | 0,1,2 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
Graph.prototype.replaceElement=function(t,z){z=t.ownerDocument.createElement(null!=z?z:"span");for(var B=Array.prototype.slice.call(t.attributes);attr=B.pop();)z.setAttribute(attr.nodeName,attr.nodeValue);z.innerHTML=t.innerHTML;t.parentNode.replaceChild(z,t)};Graph.prototype.processElements=function(t,z){if(null!=t){t=t.getElementsByTagName("*");for(var B=0;B<t.length;B++)z(t[B])}};Graph.prototype.updateLabelElements=function(t,z,B){t=null!=t?t:this.getSelectionCells();for(var D=document.createElement("div"), | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c287bef9101d024b1fd59d55ecd530f25000f9d8 | 3JavaScript |
module.exports = async function unadded() {
const output = await exec('git add --dry-run .');
return output
.split('\n')
.map(extract)
.filter(Boolean)
;
}; | 1 | 1 | -1 | https://github.com/omrilotan/async-git/commit/d1950a5021f4e19d92f347614be0d85ce991510d | 3JavaScript |
SFTPWrapper.prototype.mkdir = function(path, attrs, cb) {
return this._stream.mkdir(path, attrs, cb);
}; | 1 | 0,1,2 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
function clear_loging_storage() {
var name = self.prefix_name(true) + '_';
storage.remove(name + 'token');
storage.remove(name + 'login');
} | 0 | null | -1 | https://github.com/jcubic/jquery.terminal/commit/77eb044d0896e990d48a9157f0bc6648f81a84b5 | 3JavaScript |
void sched_exec(void)
{
struct task_struct *p = current;
unsigned long flags;
struct rq *rq;
int dest_cpu;
rq = task_rq_lock(p, &flags);
dest_cpu = p->sched_class->select_task_rq(rq, p, SD_BALANCE_EXEC, 0);
if (dest_cpu == smp_processor_id())
goto unlock;
if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed) &&
likely(cpu_active(dest_cpu)) && migrate_task(p, dest_cpu)) {
struct migration_arg arg = { p, dest_cpu };
task_rq_unlock(rq, &flags);
stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg);
return;
}
unlock:
task_rq_unlock(rq, &flags);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64 | 0CCPP |
local block_state deflate_huff(s, flush)
deflate_state *s;
int flush;
{
int bflush;
for (;;) {
if (s->lookahead == 0) {
fill_window(s);
if (s->lookahead == 0) {
if (flush == Z_NO_FLUSH)
return need_more;
break;
}
}
s->match_length = 0;
Tracevv((stderr,"%c", s->window[s->strstart]));
_tr_tally_lit (s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
if (bflush) FLUSH_BLOCK(s, 0);
}
s->insert = 0;
if (flush == Z_FINISH) {
FLUSH_BLOCK(s, 1);
return finish_done;
}
if (s->last_lit)
FLUSH_BLOCK(s, 0);
return block_done;
} | 1 | 26 | -1 | https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531 | 0CCPP |
exports = module.exports = function directory(root, options){
options = options || {};
// root required
if (!root) throw new Error('directory() root path required');
var hidden = options.hidden
, icons = options.icons
, view = options.view || 'tiles'
, filter = options.filter
, root = normalize(root + sep)
, template = options.template || defaultTemplate;
return function directory(req, res, next) {
if ('GET' != req.method && 'HEAD' != req.method) return next();
var url = parse(req.url)
, dir = decodeURIComponent(url.pathname)
, path = normalize(join(root, dir))
, originalUrl = parse(req.originalUrl)
, originalDir = decodeURIComponent(originalUrl.pathname)
, showUp = path != root;
// null byte(s), bad request
if (~path.indexOf('\0')) return next(utils.error(400));
// malicious path, forbidden
if (0 != path.indexOf(root)) return next(utils.error(403));
// check if we have a directory
fs.stat(path, function(err, stat){
if (err) return 'ENOENT' == err.code
? next()
: next(err);
if (!stat.isDirectory()) return next();
// fetch files
fs.readdir(path, function(err, files){
if (err) return next(err);
if (!hidden) files = removeHidden(files);
if (filter) files = files.filter(filter);
files.sort();
// content-negotiation
var type = new Negotiator(req).preferredMediaType(mediaTypes);
// not acceptable
if (!type) return next(utils.error(406));
exports[mediaType[type]](req, res, files, next, originalDir, showUp, icons, path, view, template);
});
});
};
}; | 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 | -1 | https://github.com/senchalabs/connect/commit/6d5dd30075d2bc4ee97afdbbe3d9d98d8d52d74b | 3JavaScript |
static struct rtable *rt_dst_alloc(struct net_device *dev,
bool nopolicy, bool noxfrm)
{
return dst_alloc(&ipv4_dst_ops, dev, 1, -1,
DST_HOST |
(nopolicy ? DST_NOPOLICY : 0) |
(noxfrm ? DST_NOXFRM : 0));
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/6e5714eaf77d79ae1c8b47e3e040ff5411b717ec | 0CCPP |
check_OUTPUT_TRUNC(const struct ofpact_output_trunc *a,
const struct ofpact_check_params *cp)
{
return ofpact_check_output_port(a->port, cp->max_ports);
} | 0 | null | -1 | https://github.com/openvswitch/ovs/commit/77cccc74deede443e8b9102299efc869a52b65b2 | 0CCPP |
0==T?ba():R()}else this.stoppingCustomActions=this.executingCustomActions=!1,R(),null!=E&&E()});ba()}};Graph.prototype.doUpdateCustomLinksForCell=function(u,E){var J=this.getLinkForCell(E);null!=J&&"data:action/json,"==J.substring(0,17)&&this.setLinkForCell(E,this.updateCustomLink(u,J));if(this.isHtmlLabel(E)){var T=document.createElement("div");T.innerHTML=this.sanitizeHtml(this.getLabel(E));for(var N=T.getElementsByTagName("a"),Q=!1,R=0;R<N.length;R++)J=N[R].getAttribute("href"),null!=J&&"data:action/json,"==
J.substring(0,17)&&(N[R].setAttribute("href",this.updateCustomLink(u,J)),Q=!0);Q&&this.labelChanged(E,T.innerHTML)}};Graph.prototype.updateCustomLink=function(u,E){if("data:action/json,"==E.substring(0,17))try{var J=JSON.parse(E.substring(17));null!=J.actions&&(this.updateCustomLinkActions(u,J.actions),E="data:action/json,"+JSON.stringify(J))}catch(T){}return E};Graph.prototype.updateCustomLinkActions=function(u,E){for(var J=0;J<E.length;J++){var T=E[J],N;for(N in T)this.updateCustomLinkAction(u, | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
void imap_keepalive(void)
{
time_t now = mutt_date_epoch();
struct Account *np = NULL;
TAILQ_FOREACH(np, &NeoMutt->accounts, entries)
{
if (np->type != MUTT_IMAP)
continue;
struct ImapAccountData *adata = np->adata;
if (!adata || !adata->mailbox)
continue;
const short c_imap_keepalive =
cs_subset_number(NeoMutt->sub, "imap_keepalive");
if ((adata->state >= IMAP_AUTHENTICATED) && (now >= (adata->lastread + c_imap_keepalive)))
imap_check_mailbox(adata->mailbox, true);
}
} | 0 | null | -1 | https://github.com/neomutt/neomutt/commit/fa1db5785e5cfd9d3cd27b7571b9fe268d2ec2dc | 0CCPP |
static bool cqspi_is_idle(struct cqspi_st *cqspi)
{
u32 reg = readl(cqspi->iobase + CQSPI_REG_CONFIG);
return reg & (1 << CQSPI_REG_CONFIG_IDLE_LSB);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/193e87143c290ec16838f5368adc0e0bc94eb931 | 0CCPP |
function set(obj, path, value, doNotReplace){
if (typeof path === 'number') {
path = [path];
}
if (!path || path.length === 0) {
return obj;
}
if (typeof path === 'string') {
return set(obj, path.split('.').map(getKey), value, doNotReplace);
}
var currentPath = path[0];
var currentValue = getShallowProperty(obj, currentPath);
if (options.includeInheritedProps && (currentPath === '__proto__' ||
(currentPath === 'constructor' && typeof currentValue === 'function'))) {
throw new Error('For security reasons, object\'s magic properties cannot be set')
}
if (path.length === 1) {
if (currentValue === void 0 || !doNotReplace) {
obj[currentPath] = value;
}
return currentValue;
}
if (currentValue === void 0) {
if(typeof path[1] === 'number') {
obj[currentPath] = [];
} else {
obj[currentPath] = {};
}
}
return set(obj[currentPath], path.slice(1), value, doNotReplace);
} | 1 | null | -1 | https://github.com/mariocasciaro/object-path/commit/7bdf4abefd102d16c163d633e8994ef154cab9eb | 3JavaScript |
TfLiteStatus EvalSum(TfLiteContext* context, TfLiteNode* node) {
OpContext op_context(context, node);
ruy::profiler::ScopeLabel label("Sum");
const auto& input = op_context.input;
const auto& output = op_context.output;
const bool same_scale =
(input->params.scale == output->params.scale &&
input->params.zero_point == output->params.zero_point);
const bool eight_bit_quantized =
input->type == kTfLiteUInt8 || input->type == kTfLiteInt8;
const bool need_rescale = (eight_bit_quantized && !same_scale);
if (need_rescale) {
int num_axis = static_cast<int>(NumElements(op_context.axis));
TfLiteTensor* temp_index = GetTemporary(context, node, /*;
TfLiteTensor* resolved_axis = GetTemporary(context, node, /*;
TfLiteTensor* temp_sum = GetTemporary(context, node, /*;
if (IsDynamicTensor(op_context.output)) {
TF_LITE_ENSURE_OK(context,
ResizeTempAxis(context, &op_context, resolved_axis));
TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
TF_LITE_ENSURE_OK(context, ResizeTempSum(context, &op_context, temp_sum));
}
if (input->type == kTfLiteUInt8) {
TF_LITE_ENSURE(
context,
reference_ops::QuantizedMeanOrSum<>(
GetTensorData<uint8_t>(op_context.input),
op_context.input->params.zero_point,
op_context.input->params.scale, op_context.input->dims->data,
op_context.input->dims->size,
GetTensorData<uint8_t>(op_context.output),
op_context.output->params.zero_point,
op_context.output->params.scale, op_context.output->dims->data,
op_context.output->dims->size,
GetTensorData<int>(op_context.axis), num_axis,
op_context.params->keep_dims, GetTensorData<int>(temp_index),
GetTensorData<int>(resolved_axis), GetTensorData<int32>(temp_sum),
true));
}
if (input->type == kTfLiteInt8) {
TF_LITE_ENSURE(
context,
reference_ops::QuantizedMeanOrSum<>(
GetTensorData<int8_t>(op_context.input),
op_context.input->params.zero_point,
op_context.input->params.scale, op_context.input->dims->data,
op_context.input->dims->size,
GetTensorData<int8_t>(op_context.output),
op_context.output->params.zero_point,
op_context.output->params.scale, op_context.output->dims->data,
op_context.output->dims->size,
GetTensorData<int>(op_context.axis), num_axis,
op_context.params->keep_dims, GetTensorData<int>(temp_index),
GetTensorData<int>(resolved_axis), GetTensorData<int32>(temp_sum),
true));
}
} else {
return EvalGeneric<kReference, kSum>(context, node);
}
return kTfLiteOk;
} | 1 | 13,14,15 | -1 | https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35 | 0CCPP |
monitor_child (int event_fd)
{
int res;
uint64_t val;
ssize_t s;
int signal_fd;
sigset_t mask;
struct pollfd fds[2];
int num_fds;
struct signalfd_siginfo fdsi;
int dont_close[] = { event_fd, -1 };
fdwalk (proc_fd, close_extra_fds, dont_close);
sigemptyset (&mask);
sigaddset (&mask, SIGCHLD);
signal_fd = signalfd (-1, &mask, SFD_CLOEXEC | SFD_NONBLOCK);
if (signal_fd == -1)
die_with_error ("Can't create signalfd");
num_fds = 1;
fds[0].fd = signal_fd;
fds[0].events = POLLIN;
if (event_fd != -1)
{
fds[1].fd = event_fd;
fds[1].events = POLLIN;
num_fds++;
}
while (1)
{
fds[0].revents = fds[1].revents = 0;
res = poll (fds, num_fds, -1);
if (res == -1 && errno != EINTR)
die_with_error ("poll");
if (event_fd != -1)
{
s = read (event_fd, &val, 8);
if (s == -1 && errno != EINTR && errno != EAGAIN)
die_with_error ("read eventfd");
else if (s == 8)
exit ((int) val - 1);
}
s = read (signal_fd, &fdsi, sizeof (struct signalfd_siginfo));
if (s == -1 && errno != EINTR && errno != EAGAIN)
{
die_with_error ("read signalfd");
}
else if (s == sizeof (struct signalfd_siginfo))
{
if (fdsi.ssi_signo != SIGCHLD)
die ("Read unexpected signal\n");
exit (fdsi.ssi_status);
}
}
} | 0 | null | -1 | https://github.com/containers/bubblewrap/commit/d7fc532c42f0e9bf427923bab85433282b3e5117 | 0CCPP |
void Node::RunForwardTypeInference() {
VLOG(4) << "Forward type inference: " << props_->node_def.DebugString();
if (props_->fwd_type_fn == nullptr) {
return;
}
std::vector<Node*> input_nodes(props_->input_types.size(), nullptr);
std::vector<int> input_idx(props_->input_types.size(), 0);
for (const auto& edge : in_edges_) {
if (edge->IsControlEdge()) {
continue;
}
DCHECK(edge->dst_input() < input_nodes.size()) << DebugString();
int i = edge->dst_input();
input_nodes.at(i) = edge->src();
input_idx.at(i) = edge->src_output();
}
for (const auto* node : input_nodes) {
if (node == nullptr) {
ClearTypeInfo();
return;
}
}
static FullTypeDef* no_type = new FullTypeDef();
std::vector<std::reference_wrapper<const FullTypeDef>> input_types;
for (int i = 0; i < input_nodes.size(); i++) {
const auto* node = input_nodes[i];
if (node->def().has_experimental_type()) {
const auto& node_t = node->def().experimental_type();
if (node_t.type_id() != TFT_UNSET) {
int ix = input_idx[i];
DCHECK(ix < node_t.args_size())
<< "input " << i << " should have an output " << ix
<< " but instead only has " << node_t.args_size()
<< " outputs: " << node_t.DebugString();
input_types.emplace_back(node_t.args(ix));
} else {
input_types.emplace_back(*no_type);
}
} else {
ClearTypeInfo();
return;
}
}
const auto infer_type = props_->fwd_type_fn(input_types);
const FullTypeDef infer_typedef = infer_type.ValueOrDie();
if (infer_typedef.type_id() != TFT_UNSET) {
MaybeCopyOnWrite();
*(props_->node_def.mutable_experimental_type()) = infer_typedef;
}
} | 1 | 30,31,32,33 | -1 | https://github.com/tensorflow/tensorflow/commit/c99d98cd189839dcf51aee94e7437b54b31f8abd | 0CCPP |
flatpak_dir_get_oci_cache_file (FlatpakDir *self,
const char *remote,
const char *suffix,
GError **error)
{
g_autoptr(GFile) oci_dir = NULL;
g_autofree char *filename = NULL;
oci_dir = g_file_get_child (flatpak_dir_get_path (self), "oci");
if (g_mkdir_with_parents (flatpak_file_get_path_cached (oci_dir), 0755) != 0)
{
glnx_set_error_from_errno (error);
return NULL;
}
filename = g_strconcat (remote, suffix, NULL);
return g_file_get_child (oci_dir, filename);
} | 0 | null | -1 | https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042 | 0CCPP |
static void change_node_zval(xmlNodePtr node, const Variant& value) {
if (value.isNull()) {
xmlNodeSetContentLen(node, (xmlChar*)"", 0);
return;
}
if (value.isInteger() || value.isBoolean() || value.isDouble() ||
value.isNull() || value.isString()) {
xmlChar* buffer =
xmlEncodeEntitiesReentrant(node->doc,
(xmlChar*)value.toString().data());
int64_t buffer_len = xmlStrlen(buffer);
if (buffer) {
xmlNodeSetContentLen(node, buffer, buffer_len);
xmlFree(buffer);
}
} else {
raise_warning("It is not possible to assign complex types to nodes");
}
} | 0 | null | -1 | https://github.com/facebook/hhvm/commit/8e7266fef1f329b805b37f32c9ad0090215ab269 | 0CCPP |
body: (req.method !== 'GET' && req.method !== 'HEAD') ? req : undefined
}
).then(f => {
res.statusCode = f.status
for (let h of exposeHeaders) {
if (h === 'content-length') continue
if (f.headers.has(h)) {
res.setHeader(h, f.headers.get(h))
}
}
if (f.redirected) {
res.setHeader('x-redirected-url', f.url)
}
f.body.pipe(res)
})
} | 1 | null | -1 | https://github.com/isomorphic-git/cors-proxy/commit/1b1c91e71d946544d97ccc7cf0ac62b859e03311 | 3JavaScript |
null,"Error fetching folder items")+(null!=oa?" ("+oa+")":""));W=!1;N.stop()}})}}function D(P){K.className=K.className.replace("odCatSelected","");K=P;K.className+=" odCatSelected"}function B(P){W||(T=null,u("search",null,null,null,P))}var C="";null==e&&(e=L,C='<div style="text-align: center;" class="odPreview"></div>');null==m&&(m=function(){var P=null;try{P=JSON.parse(localStorage.getItem("mxODPickerRecentList"))}catch(Q){}return P});null==n&&(n=function(P){if(null!=P){var Q=m()||{};delete P["@microsoft.graph.downloadUrl"];
Q[P.id]=P;localStorage.setItem("mxODPickerRecentList",JSON.stringify(Q))}});C='<div class="odCatsList"><div class="odCatsListLbl">OneDrive</div><div id="odFiles" class="odCatListTitle odCatSelected">'+mxUtils.htmlEntities(mxResources.get("files"))+'</div><div id="odRecent" class="odCatListTitle">'+mxUtils.htmlEntities(mxResources.get("recent"))+'</div><div id="odShared" class="odCatListTitle">'+mxUtils.htmlEntities(mxResources.get("shared"))+'</div><div id="odSharepoint" class="odCatListTitle">'+ | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
error_t httpClientDisconnect(HttpClientContext *context)
{
error_t error;
if(context == NULL)
return ERROR_INVALID_PARAMETER;
error = NO_ERROR;
while(!error)
{
if(context->state == HTTP_CLIENT_STATE_CONNECTED)
{
httpClientChangeState(context, HTTP_CLIENT_STATE_DISCONNECTING);
}
else if(context->state == HTTP_CLIENT_STATE_DISCONNECTING)
{
error = httpClientShutdownConnection(context);
if(error == NO_ERROR)
{
httpClientCloseConnection(context);
httpClientChangeState(context, HTTP_CLIENT_STATE_DISCONNECTED);
}
else if(error == ERROR_WOULD_BLOCK || error == ERROR_TIMEOUT)
{
error = httpClientCheckTimeout(context);
}
else
{
}
}
else if(context->state == HTTP_CLIENT_STATE_DISCONNECTED)
{
break;
}
else
{
error = ERROR_WRONG_STATE;
}
}
if(error != NO_ERROR && error != ERROR_WOULD_BLOCK)
{
httpClientCloseConnection(context);
httpClientChangeState(context, HTTP_CLIENT_STATE_DISCONNECTED);
}
return error;
} | 0 | null | -1 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 0CCPP |
postJsonSuccess('/-/move-post', (patch: StorePatch) => {
ReactActions.patchTheStore(patch);
const post = _.values(patch.postsByPageId)[0][0];
dieIf(!post, 'EsE7YKGW2');
success(post);
}, { | 0 | null | -1 | https://github.com/debiki/talkyard/commit/b0712915d8a22a20b09a129924e8a29c25ae5761 | 5TypeScript |
DEFFUNC_llExecFunc(doIterateAllActions)
{
DEFiRet;
ruleset_t* pThis = (ruleset_t*) pData;
iterateAllActions_t *pMyParam = (iterateAllActions_t*) pParam;
iRet = iterateRulesetAllActions(pThis, pMyParam->pFunc, pMyParam->pParam);
RETiRet;
} | 0 | null | -1 | https://github.com/rsyslog/rsyslog/commit/1ef709cc97d54f74d3fdeb83788cc4b01f4c6a2a | 0CCPP |
public <K, V> Map<K, V> parseAsMap(
final String string, final Class<K> keyType, final Class<V> valueType) {
return new JsonParser()
.map(JsonParser.KEYS, keyType)
.map(JsonParser.VALUES, valueType)
.parse(string);
} | 0 | null | -1 | https://github.com/oblac/jodd/commit/9bffc3913aeb8472c11bb543243004b4b4376f16 | 2Java |
SFTPWrapper.prototype.readdir = function(where, opts, cb) {
return this._stream.readdir(where, opts, cb);
}; | 1 | 0,1,2 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
def __init__(
self,
proxy_type,
proxy_host,
proxy_port,
proxy_rdns=True,
proxy_user=None,
proxy_pass=None,
proxy_headers=None,
):
self.proxy_type = proxy_type
self.proxy_host = proxy_host
self.proxy_port = proxy_port
self.proxy_rdns = proxy_rdns
self.proxy_user = proxy_user
self.proxy_pass = proxy_pass
self.proxy_headers = proxy_headers
| 1 | 1,2,3,4,5,6,7,8 | -1 | https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc | 4Python |
static inline const char *spectre_v2_module_string(void)
{
return spectre_v2_bad_module ? " - vulnerable module loaded" : "";
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/fdf82a7856b32d905c39afc85e34364491e46346 | 0CCPP |
def encrypt(self, text, recv_key="", template="", key_type=""):
if not key_type:
key_type = self.encrypt_key_type
if not template:
template = self.template
return self.crypto.encrypt(text, recv_key, template, key_type)
| 0 | null | -1 | https://github.com/IdentityPython/pysaml2.git/commit/5e9d5acbcd8ae45c4e736ac521fd2df5b1c62e25 | 4Python |
var spinnerRequestFinished = function()
{
inFlightRequests -= 1;
if (inFlightRequests === 0)
{
spinner.stop();
}
} | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
static void unlayer_stream(AVStream *st, LayeredAVStream *lst)
{
avcodec_free_context(&st->codec);
avcodec_parameters_free(&st->codecpar);
#define COPY(a) st->a = lst->a;
COPY(index)
COPY(id)
COPY(codec)
COPY(codecpar)
COPY(time_base)
COPY(pts_wrap_bits)
COPY(sample_aspect_ratio)
COPY(recommended_encoder_configuration)
} | 0 | null | -1 | https://github.com/FFmpeg/FFmpeg/commit/a5d25faa3f4b18dac737fdb35d0dd68eb0dc2156 | 0CCPP |
static int gtextfield_mouse(GGadget *g, GEvent *event) {
GTextField *gt = (GTextField *) g;
GListField *ge = (GListField *) g;
unichar_t *end=NULL, *end1, *end2;
int i=0,ll,curlen;
if ( gt->hidden_cursor ) {
GDrawSetCursor(gt->g.base,gt->old_cursor);
gt->hidden_cursor = false;
_GWidget_ClearGrabGadget(g);
}
if ( !g->takes_input || (g->state!=gs_enabled && g->state!=gs_active && g->state!=gs_focused ))
return( false );
if ( event->type == et_crossing )
return( false );
if ( gt->completionfield && ((GCompletionField *) gt)->choice_popup!=NULL &&
event->type==et_mousedown )
GCompletionDestroy((GCompletionField *) gt);
if (( gt->listfield && event->u.mouse.x>=ge->buttonrect.x &&
event->u.mouse.x<ge->buttonrect.x+ge->buttonrect.width &&
event->u.mouse.y>=ge->buttonrect.y &&
event->u.mouse.y<ge->buttonrect.y+ge->buttonrect.height ) ||
( gt->listfield && ge->popup!=NULL ))
return( glistfield_mouse(ge,event));
if ( gt->numericfield && event->u.mouse.x>=ge->buttonrect.x &&
event->u.mouse.x<ge->buttonrect.x+ge->buttonrect.width &&
event->u.mouse.y>=ge->buttonrect.y &&
event->u.mouse.y<ge->buttonrect.y+ge->buttonrect.height )
return( gnumericfield_mouse(gt,event));
if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button>=4 && event->u.mouse.button<=7)) {
int isv = event->u.mouse.button<=5;
if ( event->u.mouse.state&ksm_shift ) isv = !isv;
if ( isv && gt->vsb!=NULL )
return( GGadgetDispatchEvent(>->vsb->g,event));
else if ( !isv && gt->hsb!=NULL )
return( GGadgetDispatchEvent(>->hsb->g,event));
else
return( true );
}
if ( gt->pressed==NULL && event->type == et_mousemove && g->popup_msg!=NULL &&
GGadgetWithin(g,event->u.mouse.x,event->u.mouse.y))
GGadgetPreparePopup(g->base,g->popup_msg);
curlen = u_strlen(gt->text);
if ( event->type == et_mousedown || gt->pressed ) {
i = (event->u.mouse.y-g->inner.y)/gt->fh + gt->loff_top;
if ( i<0 ) i = 0;
if ( !gt->multi_line ) i = 0;
if ( i>=gt->lcnt ) {
end = gt->text+curlen;
i = gt->lcnt - 1;
if (i < 0) i = 0;
} else
end = GTextFieldGetPtFromPos(gt,i,event->u.mouse.x);
}
if ( event->type == et_mousedown ) {
int end8;
if ( event->u.mouse.button==3 &&
GGadgetWithin(g,event->u.mouse.x,event->u.mouse.y)) {
GTFPopupMenu(gt,event);
return( true );
}
ll = gt->lines8[i+1]==-1?-1:gt->lines8[i+1]-gt->lines8[i]-1;
GDrawLayoutInit(gt->g.base,gt->utf8_text+gt->lines8[i],ll,NULL);
end8 = GDrawLayoutXYToIndex(gt->g.base,event->u.mouse.x-g->inner.x+gt->xoff_left,0);
end1 = end2 = gt->text + gt->lines[i] + utf82u_index(end8,gt->utf8_text+gt->lines8[i]);
gt->wordsel = gt->linesel = false;
if ( event->u.mouse.button==1 && event->u.mouse.clicks>=3 ) {
gt->sel_start = gt->lines[i]; gt->sel_end = gt->lines[i+1];
if ( gt->sel_end==-1 ) gt->sel_end = curlen;
gt->wordsel = false; gt->linesel = true;
} else if ( event->u.mouse.button==1 && event->u.mouse.clicks==2 ) {
gt->sel_start = gt->sel_end = gt->sel_base = end-gt->text;
gt->wordsel = true;
GTextFieldSelectWords(gt,gt->sel_base);
} else if ( end1-gt->text>=gt->sel_start && end2-gt->text<gt->sel_end &&
gt->sel_start!=gt->sel_end &&
event->u.mouse.button==1 ) {
gt->drag_and_drop = true;
if ( !gt->hidden_cursor )
gt->old_cursor = GDrawGetCursor(gt->g.base);
GDrawSetCursor(gt->g.base,ct_draganddrop);
} else if ( !(event->u.mouse.state&ksm_shift) ) {
if ( event->u.mouse.button==1 )
GTextFieldGrabPrimarySelection(gt);
gt->sel_start = gt->sel_end = gt->sel_base = end-gt->text;
} else if ( end-gt->text>gt->sel_base ) {
gt->sel_start = gt->sel_base;
gt->sel_end = end-gt->text;
} else {
gt->sel_start = gt->sel_base = gt->sel_end = end-gt->text;
}
if ( gt->pressed==NULL )
gt->pressed = GDrawRequestTimer(gt->g.base,200,100,NULL);
if ( gt->sel_start > curlen )
fprintf( stderr, "About to crash\n" );
_ggadget_redraw(g);
return( true );
} else if ( gt->pressed && (event->type == et_mousemove || event->type == et_mouseup )) {
int refresh = true;
if ( gt->drag_and_drop ) {
refresh = GTextFieldDoDrop(gt,event,end-gt->text);
} else if ( gt->linesel ) {
int j;
for ( j=i; j>0 && gt->text[gt->lines[j]-1] != '\n'; --j )
;
gt->sel_start = gt->lines[j];
for ( j=i+1; gt->lines[j]!=-1 && gt->text[gt->lines[j]-1] != '\n'; ++j )
;
gt->sel_end = gt->lines[j]!=-1 ? gt->lines[j]-1 : curlen;
} else if ( gt->wordsel )
GTextFieldSelectWords(gt,end-gt->text);
else if ( event->u.mouse.button!=2 ) {
int e = end-gt->text;
if ( e>gt->sel_base ) {
gt->sel_start = gt->sel_base; gt->sel_end = e;
} else {
gt->sel_start = e; gt->sel_end = gt->sel_base;
}
}
if ( event->type==et_mouseup ) {
GDrawCancelTimer(gt->pressed); gt->pressed = NULL;
if ( event->u.mouse.button==2 )
GTextFieldPaste(gt,sn_primary);
if ( gt->sel_start==gt->sel_end )
GTextField_Show(gt,gt->sel_start);
GTextFieldChanged(gt,-1);
if ( gt->sel_start<gt->sel_end && _GDraw_InsCharHook!=NULL && !gt->donthook )
(_GDraw_InsCharHook)(GDrawGetDisplayOfWindow(gt->g.base),
gt->text[gt->sel_start]);
}
if ( gt->sel_end > u_strlen(gt->text) )
fprintf( stderr, "About to crash\n" );
if ( refresh )
_ggadget_redraw(g);
return( true );
}
return( false );
} | 0 | null | -1 | https://github.com/fontforge/fontforge/commit/626f751752875a0ddd74b9e217b6f4828713573c | 0CCPP |
SPL_METHOD(SplFileInfo, getRealPath)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
char buff[MAXPATHLEN];
char *filename;
zend_error_handling error_handling;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
if (intern->type == SPL_FS_DIR && !intern->file_name && intern->u.dir.entry.d_name[0]) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
}
if (intern->orig_path) {
filename = intern->orig_path;
} else {
filename = intern->file_name;
}
if (filename && VCWD_REALPATH(filename, buff)) {
#ifdef ZTS
if (VCWD_ACCESS(buff, F_OK)) {
RETVAL_FALSE;
} else
#endif
RETVAL_STRING(buff, 1);
} else {
RETVAL_FALSE;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
} | 1 | 15 | -1 | https://github.com/php/php-src/commit/7245bff300d3fa8bacbef7897ff080a6f1c23eba | 0CCPP |
itemhtml = function(f) {
f.name = fm.escape(f.name);
return templates[list ? 'row' : 'icon']
.replace(/\{([a-z]+)\}/g, function(s, e) {
return replacement[e] ? replacement[e](f) : (f[e] ? f[e] : '');
});
}, | 1 | 0,1,2,3,4,5,6 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
b=RegExp("\\\\(?:(?:[0-9a-fA-F]{1,6}[\\t\\n\\f ]?|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|[\\ud800-\\udbff][\\udc00-\\udfff])|[\\n\\f])","g"),a=RegExp("^url\\([\\t\\n\\f ]*[\"']?|[\"']?[\\t\\n\\f ]*\\)$","gi");X=function(a){return a.replace(b,g)};U=function(b){for(var b=(""+b).replace(/\r\n?/g,"\n").match(v)||[],f=0,h=" ",d=0,y=b.length;d<y;++d){var l=X(b[d]),V=l.length,g=l.charCodeAt(0),l=34==g||39==g?w(l.substring(1,V-1),M):47==g&&1<V||"\\"==l||"--\>"==l||"<\!--"==l||"\ufeff"==l||32>=g?" ": | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/f768ed73875d5eca20110b9c1d72f2789cd1bab7 | 3JavaScript |
snmp_mib_add(snmp_mib_resource_t *new_resource)
{
snmp_mib_resource_t *resource;
for(resource = list_head(snmp_mib);
resource; resource = resource->next) {
if(snmp_oid_cmp_oid(resource->oid, new_resource->oid) > 0) {
break;
}
}
if(resource == NULL) {
list_add(snmp_mib, new_resource);
} else {
list_insert(snmp_mib, new_resource, resource);
}
#if LOG_LEVEL == LOG_LEVEL_DBG
/*
* We print the entire resource table
*/
LOG_DBG("Table after insert.\n");
for(resource = list_head(snmp_mib);
resource; resource = resource->next) {
snmp_oid_print(resource->oid);
}
#endif /*
} | 1 | 5,14,15,16,17,18,19,20,21,23 | -1 | https://github.com/contiki-ng/contiki-ng/commit/12c824386ab60de757de5001974d73b32e19ad71 | 0CCPP |
JPoint.prototype.eq = function eq(p) {
if (p.type === 'affine')
return this.eq(p.toJ());
if (this === p)
return true;
var z2 = this.z.redSqr();
var pz2 = p.z.redSqr();
if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
return false;
var z3 = z2.redMul(this.z);
var pz3 = pz2.redMul(p.z);
return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
}; | 0 | null | -1 | https://github.com/TogaTech/tEnvoy/commit/a121b34a45e289d775c62e58841522891dee686b | 3JavaScript |
static u16 tsk_inc(struct tipc_sock *tsk, int msglen)
{
if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL))
return ((msglen / FLOWCTL_BLK_SZ) + 1);
return 1;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/45e093ae2830cd1264677d47ff9a95a71f5d9f9c | 0CCPP |
psf_f2s_array (const float *src, short *dest, int count, int normalize)
{ float normfact ;
normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ;
while (--count >= 0)
dest [count] = lrintf (src [count] * normfact) ;
return ;
} | 0 | null | -1 | https://github.com/libsndfile/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074 | 0CCPP |
static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct device *dev = &intf->dev;
struct usb_device *usbdev = interface_to_usbdev(intf);
struct net_device *netdev;
struct catc *catc;
u8 broadcast[ETH_ALEN];
int i, pktsz, ret;
if (usb_set_interface(usbdev,
intf->altsetting->desc.bInterfaceNumber, 1)) {
dev_err(dev, "Can't set altsetting 1.\n");
return -EIO;
}
netdev = alloc_etherdev(sizeof(struct catc));
if (!netdev)
return -ENOMEM;
catc = netdev_priv(netdev);
netdev->netdev_ops = &catc_netdev_ops;
netdev->watchdog_timeo = TX_TIMEOUT;
netdev->ethtool_ops = &ops;
catc->usbdev = usbdev;
catc->netdev = netdev;
spin_lock_init(&catc->tx_lock);
spin_lock_init(&catc->ctrl_lock);
init_timer(&catc->timer);
catc->timer.data = (long) catc;
catc->timer.function = catc_stats_timer;
catc->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
if ((!catc->ctrl_urb) || (!catc->tx_urb) ||
(!catc->rx_urb) || (!catc->irq_urb)) {
dev_err(&intf->dev, "No free urbs available.\n");
ret = -ENOMEM;
goto fail_free;
}
if (le16_to_cpu(usbdev->descriptor.idVendor) == 0x0423 &&
le16_to_cpu(usbdev->descriptor.idProduct) == 0xa &&
le16_to_cpu(catc->usbdev->descriptor.bcdDevice) == 0x0130) {
dev_dbg(dev, "Testing for f5u011\n");
catc->is_f5u011 = 1;
atomic_set(&catc->recq_sz, 0);
pktsz = RX_PKT_SZ;
} else {
pktsz = RX_MAX_BURST * (PKT_SZ + 2);
}
usb_fill_control_urb(catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0),
NULL, NULL, 0, catc_ctrl_done, catc);
usb_fill_bulk_urb(catc->tx_urb, usbdev, usb_sndbulkpipe(usbdev, 1),
NULL, 0, catc_tx_done, catc);
usb_fill_bulk_urb(catc->rx_urb, usbdev, usb_rcvbulkpipe(usbdev, 1),
catc->rx_buf, pktsz, catc_rx_done, catc);
usb_fill_int_urb(catc->irq_urb, usbdev, usb_rcvintpipe(usbdev, 2),
catc->irq_buf, 2, catc_irq_done, catc, 1);
if (!catc->is_f5u011) {
dev_dbg(dev, "Checking memory size\n");
i = 0x12345678;
catc_write_mem(catc, 0x7a80, &i, 4);
i = 0x87654321;
catc_write_mem(catc, 0xfa80, &i, 4);
catc_read_mem(catc, 0x7a80, &i, 4);
switch (i) {
case 0x12345678:
catc_set_reg(catc, TxBufCount, 8);
catc_set_reg(catc, RxBufCount, 32);
dev_dbg(dev, "64k Memory\n");
break;
default:
dev_warn(&intf->dev,
"Couldn't detect memory size, assuming 32k\n");
case 0x87654321:
catc_set_reg(catc, TxBufCount, 4);
catc_set_reg(catc, RxBufCount, 16);
dev_dbg(dev, "32k Memory\n");
break;
}
dev_dbg(dev, "Getting MAC from SEEROM.\n");
catc_get_mac(catc, netdev->dev_addr);
dev_dbg(dev, "Setting MAC into registers.\n");
for (i = 0; i < 6; i++)
catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]);
dev_dbg(dev, "Filling the multicast list.\n");
eth_broadcast_addr(broadcast);
catc_multicast(broadcast, catc->multicast);
catc_multicast(netdev->dev_addr, catc->multicast);
catc_write_mem(catc, 0xfa80, catc->multicast, 64);
dev_dbg(dev, "Clearing error counters.\n");
for (i = 0; i < 8; i++)
catc_set_reg(catc, EthStats + i, 0);
catc->last_stats = jiffies;
dev_dbg(dev, "Enabling.\n");
catc_set_reg(catc, MaxBurst, RX_MAX_BURST);
catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits);
catc_set_reg(catc, LEDCtrl, LEDLink);
catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast);
} else {
dev_dbg(dev, "Performing reset\n");
catc_reset(catc);
catc_get_mac(catc, netdev->dev_addr);
dev_dbg(dev, "Setting RX Mode\n");
catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast;
catc->rxmode[1] = 0;
f5u011_rxmode(catc, catc->rxmode);
}
dev_dbg(dev, "Init done.\n");
printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s, %pM.\n",
netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate",
usbdev->bus->bus_name, usbdev->devpath, netdev->dev_addr);
usb_set_intfdata(intf, catc);
SET_NETDEV_DEV(netdev, &intf->dev);
ret = register_netdev(netdev);
if (ret)
goto fail_clear_intfdata;
return 0;
fail_clear_intfdata:
usb_set_intfdata(intf, NULL);
fail_free:
usb_free_urb(catc->ctrl_urb);
usb_free_urb(catc->tx_urb);
usb_free_urb(catc->rx_urb);
usb_free_urb(catc->irq_urb);
free_netdev(netdev);
return ret;
} | 1 | 7,57,58,59,60,61,62 | -1 | https://github.com/torvalds/linux/commit/2d6a0e9de03ee658a9adc3bfb2f0ca55dff1e478 | 0CCPP |
function(n){g.editorUiRefresh.apply(b,arguments);u()};u();var q=document.createElement("canvas");q.width=m.offsetWidth;q.height=m.offsetHeight;m.style.overflow="hidden";q.style.position="relative";m.appendChild(q);var v=q.getContext("2d");this.ui=b;var x=b.editor.graph;this.graph=x;this.container=m;this.canvas=q;var A=function(n,y,K,B,F){n=Math.round(n);y=Math.round(y);K=Math.round(K);B=Math.round(B);v.beginPath();v.moveTo(n+.5,y+.5);v.lineTo(K+.5,B+.5);v.stroke();F&&(l?(v.save(),v.translate(n,y),
v.rotate(-Math.PI/2),v.fillText(F,0,0),v.restore()):v.fillText(F,n,y))},z=function(){v.clearRect(0,0,q.width,q.height);v.beginPath();v.lineWidth=.7;v.strokeStyle=k.strokeClr;v.setLineDash([]);v.font="9px Arial";v.textAlign="center";var n=x.view.scale,y=x.view.getBackgroundPageBounds(),K=x.view.translate,B=x.pageVisible;K=B?e+(l?y.y-x.container.scrollTop:y.x-x.container.scrollLeft):e+(l?K.y*n-x.container.scrollTop:K.x*n-x.container.scrollLeft);var F=0;B&&(F=x.getPageLayout(),F=l?F.y*x.pageFormat.height: | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
bool ValidateCMAC()
{
std::cout << "\nCMAC validation suite running...\n";
return RunTestDataFile(CRYPTOPP_DATA_DIR "TestVectors/cmac.txt");
} | 0 | null | -1 | https://github.com/weidai11/cryptopp/commit/07dbcc3d9644b18e05c1776db2a57fe04d780965 | 0CCPP |
v3d_lookup_bos(struct drm_device *dev,
struct drm_file *file_priv,
struct v3d_job *job,
u64 bo_handles,
u32 bo_count)
{
u32 *handles;
int ret = 0;
int i;
job->bo_count = bo_count;
if (!job->bo_count) {
DRM_DEBUG("Rendering requires BOs\n");
return -EINVAL;
}
job->bo = kvmalloc_array(job->bo_count,
sizeof(struct drm_gem_cma_object *),
GFP_KERNEL | __GFP_ZERO);
if (!job->bo) {
DRM_DEBUG("Failed to allocate validated BO pointers\n");
return -ENOMEM;
}
handles = kvmalloc_array(job->bo_count, sizeof(u32), GFP_KERNEL);
if (!handles) {
ret = -ENOMEM;
DRM_DEBUG("Failed to allocate incoming GEM handles\n");
goto fail;
}
if (copy_from_user(handles,
(void __user *)(uintptr_t)bo_handles,
job->bo_count * sizeof(u32))) {
ret = -EFAULT;
DRM_DEBUG("Failed to copy in GEM handles\n");
goto fail;
}
spin_lock(&file_priv->table_lock);
for (i = 0; i < job->bo_count; i++) {
struct drm_gem_object *bo = idr_find(&file_priv->object_idr,
handles[i]);
if (!bo) {
DRM_DEBUG("Failed to look up GEM BO %d: %d\n",
i, handles[i]);
ret = -ENOENT;
spin_unlock(&file_priv->table_lock);
goto fail;
}
drm_gem_object_get(bo);
job->bo[i] = bo;
}
spin_unlock(&file_priv->table_lock);
fail:
kvfree(handles);
return ret;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/29cd13cfd7624726d9e6becbae9aa419ef35af7f | 0CCPP |
var currentPath = function currentPath(i) {
var tKey = options.transformKey(i);
return parentPath ? parentPath + "." + tKey : tKey;
}; | 0 | null | -1 | https://github.com/Irrelon/irrelon-path/commit/8a126b160c1a854ae511659c111413ad9910ebe3 | 3JavaScript |
FontData::FontData(FontData* data, int32_t offset) {
Init(data->array_);
Bound(data->bound_offset_ + offset,
(data->bound_length_ == GROWABLE_SIZE)
? GROWABLE_SIZE : data->bound_length_ - offset);
} | 1 | 4 | -1 | https://github.com/googlefonts/sfntly/commit/de776d4ef06ca29c240de3444348894f032b03ff | 0CCPP |
build_unc_path_to_root(const struct smb_vol *vol,
const struct cifs_sb_info *cifs_sb)
{
char *full_path, *pos;
unsigned int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0;
unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1);
full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL);
if (full_path == NULL)
return ERR_PTR(-ENOMEM);
strncpy(full_path, vol->UNC, unc_len);
pos = full_path + unc_len;
if (pplen) {
*pos++ = CIFS_DIR_SEP(cifs_sb);
strncpy(pos, vol->prepath, pplen);
pos += pplen;
}
*pos = '\0';
convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
cifs_dbg(FYI, "%s: full_path=%s\n", __func__, full_path);
return full_path;
} | 1 | 12,13 | -1 | https://github.com/torvalds/linux/commit/1fc29bacedeabb278080e31bb9c1ecb49f143c3b | 0CCPP |
static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *m, size_t total_len, int flags)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
int error = 0;
if (sk->sk_state & PPPOX_BOUND) {
error = -EIO;
goto end;
}
skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
flags & MSG_DONTWAIT, &error);
if (error < 0)
goto end;
m->msg_namelen = 0;
if (skb) {
total_len = min_t(size_t, total_len, skb->len);
error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
if (error == 0) {
consume_skb(skb);
return total_len;
}
}
kfree_skb(skb);
end:
return error;
} | 1 | 14 | -1 | https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | 0CCPP |
lsquic_stream_set_priority_internal (lsquic_stream_t *stream, unsigned priority)
{
if (lsquic_stream_is_critical(stream))
return -1;
if (stream->sm_bflags & SMBF_HTTP_PRIO)
{
if (priority > LSQUIC_MAX_HTTP_URGENCY)
return -1;
stream->sm_priority = priority;
}
else
{
if (priority < 1 || priority > 256)
return -1;
stream->sm_priority = 256 - priority;
}
lsquic_send_ctl_invalidate_bpt_cache(stream->conn_pub->send_ctl);
LSQ_DEBUG("set priority to %u", priority);
SM_HISTORY_APPEND(stream, SHE_SET_PRIO);
return 0;
} | 0 | null | -1 | https://github.com/litespeedtech/lsquic/commit/a74702c630e108125e71898398737baec8f02238 | 0CCPP |
GF_Err gf_bin128_parse(const char *string, bin128 value)
{
u32 len;
u32 i=0;
if (!strnicmp(string, "0x", 2)) string += 2;
len = (u32) strlen(string);
if (len >= 32) {
u32 j;
for (j=0; j<len; j+=2) {
u32 v;
char szV[5];
while (string[j] && !isalnum(string[j]))
j++;
if (!string[j])
break;
sprintf(szV, "%c%c", string[j], string[j+1]);
sscanf(szV, "%x", &v);
value[i] = v;
i++;
}
}
if (i != 16) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[CORE] 128bit blob is not 16-bytes long: %s\n", string));
return GF_BAD_PARAM;
}
return GF_OK;
} | 1 | null | -1 | https://github.com/gpac/gpac/commit/f3698bb1bce62402805c3fda96551a23101a32f9 | 0CCPP |
name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)
char *cp = name_out;
const char *const end = name_out + name_out_len;
for (;;) {
u8 label_len;
if (j >= length) return -1;
GET8(label_len);
if (!label_len) break;
if (label_len & 0xc0) {
u8 ptr_low;
GET8(ptr_low);
if (name_end < 0) name_end = j;
j = (((int)label_len & 0x3f) << 8) + ptr_low;
if (j < 0 || j >= length) return -1;
if (++ptr_count > length) return -1;
continue;
}
if (label_len > 63) return -1;
if (cp != name_out) {
if (cp + 1 >= end) return -1;
*cp++ = '.';
}
if (cp + label_len >= end) return -1;
memcpy(cp, packet + j, label_len);
cp += label_len;
j += label_len;
}
if (cp >= end) return -1;
*cp = '\0';
if (name_end < 0)
*idx = j;
else
*idx = name_end;
return 0;
err:
return -1;
} | 1 | 11 | -1 | https://github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d | 0CCPP |
def _fetch_user_by_name(username):
return (
ub.session.query(ub.User)
.filter(func.lower(ub.User.name) == username.lower())
.first()
)
| 0 | null | -1 | https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367 | 4Python |
def get(self, path, include_body=True):
self.path = self.parse_url_path(path)
del path
absolute_path = self.get_absolute_path(self.root, self.path)
self.absolute_path = self.validate_absolute_path(self.root, absolute_path)
if self.absolute_path is None:
return
self.modified = self.get_modified_time()
self.set_headers()
if self.should_return_304():
self.set_status(304)
return
request_range = None
range_header = self.request.headers.get("Range")
if range_header:
request_range = httputil._parse_request_range(range_header)
if request_range:
start, end = request_range
size = self.get_content_size()
if (start is not None and start >= size) or end == 0:
self.set_status(416)
self.set_header("Content-Type", "text/plain")
self.set_header("Content-Range", "bytes */%s" % (size,))
return
if start is not None and start < 0:
start += size
if end is not None and end > size:
end = size
if size != (end or size) - (start or 0):
self.set_status(206)
self.set_header(
"Content-Range", httputil._get_content_range(start, end, size)
)
else:
start = end = None
content = self.get_content(self.absolute_path, start, end)
if isinstance(content, bytes_type):
content = [content]
content_length = 0
for chunk in content:
if include_body:
self.write(chunk)
else:
content_length += len(chunk)
if not include_body:
assert self.request.method == "HEAD"
self.set_header("Content-Length", content_length)
| 0 | null | -1 | https://github.com/tornadoweb/tornado.git/commit/1c36307463b1e8affae100bf9386948e6c1b2308 | 4Python |
S&&S(M)}}))}catch(L){null!=S&&S(L)}}),N,sa)}catch(Pa){null!=S&&S(Pa)}};Editor.crcTable=[];for(var D=0;256>D;D++)for(var t=D,F=0;8>F;F++)t=1==(t&1)?3988292384^t>>>1:t>>>1,Editor.crcTable[D]=t;Editor.updateCRC=function(u,J,N,W){for(var S=0;S<W;S++)u=Editor.crcTable[(u^J.charCodeAt(N+S))&255]^u>>>8;return u};Editor.crc32=function(u){for(var J=-1,N=0;N<u.length;N++)J=J>>>8^Editor.crcTable[(J^u.charCodeAt(N))&255];return(J^-1)>>>0};Editor.writeGraphModelToPng=function(u,J,N,W,S){function P(sa,Ba){var ta= | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
static int get_recursion_context(int *recursion)
{
int rctx;
if (in_nmi())
rctx = 3;
else if (in_irq())
rctx = 2;
else if (in_softirq())
rctx = 1;
else
rctx = 0;
if (recursion[rctx])
return -1;
recursion[rctx]++;
barrier();
return rctx;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
g_NPN_GetValue(NPP instance, NPNVariable variable, void *value)
{
D(bug("NPN_GetValue instance=%p, variable=%d [%s]\n", instance, variable, string_of_NPNVariable(variable)));
if (!thread_check()) {
npw_printf("WARNING: NPN_GetValue not called from the main thread\n");
return NPERR_INVALID_INSTANCE_ERROR;
}
PluginInstance *plugin = NULL;
if (instance)
plugin = PLUGIN_INSTANCE(instance);
switch (variable) {
case NPNVxDisplay:
*(void **)value = x_display;
break;
case NPNVxtAppContext:
*(void **)value = XtDisplayToApplicationContext(x_display);
break;
case NPNVToolkit:
*(NPNToolkitType *)value = NPW_TOOLKIT;
break;
#if USE_XPCOM
case NPNVserviceManager: {
nsIServiceManager *sm;
int ret = NS_GetServiceManager(&sm);
if (NS_FAILED(ret)) {
npw_printf("WARNING: NS_GetServiceManager failed\n");
return NPERR_GENERIC_ERROR;
}
*(nsIServiceManager **)value = sm;
break;
}
case NPNVDOMWindow:
case NPNVDOMElement:
npw_printf("WARNING: %s is not supported by NPN_GetValue()\n", string_of_NPNVariable(variable));
return NPERR_INVALID_PARAM;
#endif
case NPNVnetscapeWindow:
if (plugin == NULL) {
npw_printf("ERROR: NPNVnetscapeWindow requires a non NULL instance\n");
return NPERR_INVALID_INSTANCE_ERROR;
}
if (plugin->browser_toplevel == NULL) {
GdkNativeWindow netscape_xid = None;
NPError error = g_NPN_GetValue_real(instance, variable, &netscape_xid);
if (error != NPERR_NO_ERROR)
return error;
if (netscape_xid == None)
return NPERR_GENERIC_ERROR;
plugin->browser_toplevel = gdk_window_foreign_new(netscape_xid);
if (plugin->browser_toplevel == NULL)
return NPERR_GENERIC_ERROR;
}
*((GdkNativeWindow *)value) = GDK_WINDOW_XWINDOW(plugin->browser_toplevel);
break;
#if ALLOW_WINDOWLESS_PLUGINS
case NPNVSupportsWindowless:
#endif
case NPNVSupportsXEmbedBool:
case NPNVWindowNPObject:
case NPNVPluginElementNPObject:
return g_NPN_GetValue_real(instance, variable, value);
default:
switch (variable & 0xff) {
case 13:
if (NPW_TOOLKIT == NPNVGtk2) {
*(NPNToolkitType *)value = NPW_TOOLKIT;
return NPERR_NO_ERROR;
}
break;
}
D(bug("WARNING: unhandled variable %d (%s) in NPN_GetValue()\n", variable, string_of_NPNVariable(variable)));
return NPERR_INVALID_PARAM;
}
return NPERR_NO_ERROR;
} | 1 | null | -1 | https://github.com/davidben/nspluginwrapper/commit/7e4ab8e1189846041f955e6c83f72bc1624e7a98 | 0CCPP |
onBannerChange (input: HTMLInputElement) {
this.bannerfileInput = new ElementRef(input)
const bannerfile = this.bannerfileInput.nativeElement.files[0]
if (bannerfile.size > this.maxBannerSize) {
this.notifier.error('Error', $localize`This image is too large.`)
return
}
const formData = new FormData()
formData.append('bannerfile', bannerfile)
this.bannerPopover?.close()
this.bannerChange.emit(formData)
if (this.previewImage) {
this.preview = this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(bannerfile))
}
} | 1 | 12 | -1 | https://github.com/chocobozzz/peertube/commit/0ea2f79d45b301fcd660efc894469a99b2239bf6 | 5TypeScript |
static void call_snmp_init_once(void) {
static int have_init = 0;
if (have_init == 0)
init_snmp(PACKAGE_NAME);
have_init = 1;
} | 0 | null | -1 | https://github.com/collectd/collectd/commit/d16c24542b2f96a194d43a73c2e5778822b9cb47 | 0CCPP |
void CConnectionTransportUDPBase::Received_Data( const uint8 *pPkt, int cbPkt, SteamNetworkingMicroseconds usecNow )
{
if ( cbPkt < sizeof(UDPDataMsgHdr) )
{
ReportBadUDPPacketFromConnectionPeer( "DataPacket", "Packet of size %d is too small.", cbPkt );
return;
}
const UDPDataMsgHdr *hdr = (const UDPDataMsgHdr *)pPkt;
if ( LittleDWord( hdr->m_unToConnectionID ) != ConnectionIDLocal() )
{
ReportBadUDPPacketFromConnectionPeer( "DataPacket", "Incorrect connection ID" );
if ( BCheckGlobalSpamReplyRateLimit( usecNow ) )
{
SendNoConnection( LittleDWord( hdr->m_unToConnectionID ), 0 );
}
return;
}
uint16 nWirePktNumber = LittleWord( hdr->m_unSeqNum );
switch ( ConnectionState() )
{
case k_ESteamNetworkingConnectionState_Dead:
case k_ESteamNetworkingConnectionState_None:
default:
Assert( false );
return;
case k_ESteamNetworkingConnectionState_ClosedByPeer:
case k_ESteamNetworkingConnectionState_FinWait:
case k_ESteamNetworkingConnectionState_ProblemDetectedLocally:
SendConnectionClosedOrNoConnection();
return;
case k_ESteamNetworkingConnectionState_Connecting:
return;
case k_ESteamNetworkingConnectionState_Linger:
case k_ESteamNetworkingConnectionState_Connected:
case k_ESteamNetworkingConnectionState_FindingRoute:
break;
}
const uint8 *pIn = pPkt + sizeof(*hdr);
const uint8 *pPktEnd = pPkt + cbPkt;
static CMsgSteamSockets_UDP_Stats msgStats;
CMsgSteamSockets_UDP_Stats *pMsgStatsIn = nullptr;
uint32 cbStatsMsgIn = 0;
if ( hdr->m_unMsgFlags & hdr->kFlag_ProtobufBlob )
{
pIn = DeserializeVarInt( pIn, pPktEnd, cbStatsMsgIn );
if ( pIn == NULL )
{
ReportBadUDPPacketFromConnectionPeer( "DataPacket", "Failed to varint decode size of stats blob" );
return;
}
if ( pIn + cbStatsMsgIn > pPktEnd )
{
ReportBadUDPPacketFromConnectionPeer( "DataPacket", "stats message size doesn't make sense. Stats message size %d, packet size %d", cbStatsMsgIn, cbPkt );
return;
}
if ( !msgStats.ParseFromArray( pIn, cbStatsMsgIn ) )
{
ReportBadUDPPacketFromConnectionPeer( "DataPacket", "protobuf failed to parse inline stats message" );
return;
}
pMsgStatsIn = &msgStats;
pIn += cbStatsMsgIn;
}
const void *pChunk = pIn;
int cbChunk = pPktEnd - pIn;
UDPRecvPacketContext_t ctx;
ctx.m_usecNow = usecNow;
ctx.m_pTransport = this;
ctx.m_pStatsIn = pMsgStatsIn;
if ( !m_connection.DecryptDataChunk( nWirePktNumber, cbPkt, pChunk, cbChunk, ctx ) )
return;
RecvValidUDPDataPacket( ctx );
int usecTimeSinceLast = 0;
if ( !m_connection.ProcessPlainTextDataChunk( usecTimeSinceLast, ctx ) )
return;
if ( pMsgStatsIn )
RecvStats( *pMsgStatsIn, usecNow );
} | 1 | 50,52 | -1 | https://github.com/ValveSoftware/GameNetworkingSockets/commit/d944a10808891d202bb1d5e1998de6e0423af678 | 0CCPP |
function customFilter(node) {
if (that.currentFilter) {
if (!that.data[node.key]) return false;
var title = that.data[node.key].title;
if (title && typeof title === 'object') {
title = title[systemLang] || title.en;
}
var desc = that.data[node.key].desc;
if (desc && typeof desc === 'object') {
desc = desc[systemLang] || desc.en;
}
if ((that.data[node.key].name && that.data[node.key].name.toLowerCase().indexOf(that.currentFilter) !== -1) ||
(title && title.toLowerCase().indexOf(that.currentFilter) !== -1) ||
(that.data[node.key].keywords && that.data[node.key].keywords.toLowerCase().indexOf(that.currentFilter) !== -1) ||
(desc && desc.toLowerCase().indexOf(that.currentFilter) !== -1)){
return true;
} else {
return false;
}
} else {
return true;
}
} | 1 | 2,3,4,6,7,9,11,12,13,14,16,17,18 | -1 | https://github.com/ioBroker/ioBroker.admin/commit/16b2b325ab47896090bc7f54b77b0a97ed74f5cd | 3JavaScript |
close : function() {
!complete && opts.cancel.callback();
$(this).elfinderdialog('destroy');
} | 1 | 0,1,2,3 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
error: function error() {
success(null);
} | 0 | null | -1 | https://github.com/jcubic/jquery.terminal/commit/77eb044d0896e990d48a9157f0bc6648f81a84b5 | 3JavaScript |
static inline void x86_assign_hw_event(struct perf_event *event,
struct cpu_hw_events *cpuc, int i)
{
struct hw_perf_event *hwc = &event->hw;
hwc->idx = cpuc->assign[i];
hwc->last_cpu = smp_processor_id();
hwc->last_tag = ++cpuc->tags[i];
if (hwc->idx == X86_PMC_IDX_FIXED_BTS) {
hwc->config_base = 0;
hwc->event_base = 0;
} else if (hwc->idx >= X86_PMC_IDX_FIXED) {
hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
hwc->event_base = MSR_ARCH_PERFMON_FIXED_CTR0;
} else {
hwc->config_base = x86_pmu_config_addr(hwc->idx);
hwc->event_base = x86_pmu_event_addr(hwc->idx);
}
} | 1 | 12 | -1 | https://github.com/torvalds/linux/commit/fc66c5210ec2539e800e87d7b3a985323c7be96e | 0CCPP |
string sanitize_proprietary_tags(string input_string)
{
unsigned int i;
size_t input_string_size;
bool strip = false;
bool tag_open = false;
int tag_open_idx = 0;
bool closing_tag_open = false;
int orig_tag_open_idx = 0;
bool proprietary_tag = false;
bool proprietary_closing_tag = false;
int crop_end_idx = 0;
char buffer[READ_BUFFER_SIZE] = "";
char tagname[READ_BUFFER_SIZE] = "";
int tagname_idx = 0;
char close_tagname[READ_BUFFER_SIZE] = "";
for (i = 0; i < READ_BUFFER_SIZE; i++)
{
buffer[i] = 0;
tagname[i] = 0;
close_tagname[i] = 0;
}
input_string_size = input_string.size();
for (i = 0; i < input_string_size; i++)
{
if (input_string.c_str()[i] == '<')
{
tag_open = true;
tag_open_idx = i;
if (proprietary_tag == true && input_string.c_str()[i+1] == '/')
{
closing_tag_open = true;
if (strncmp(tagname, &(input_string.c_str()[i+2]), strlen(tagname)) != 0)
{
crop_end_idx = i - 1;
strip = true;
}
else
{
proprietary_closing_tag = true;
}
}
else if (proprietary_tag == true)
{
crop_end_idx = i - 1;
strip = true;
}
}
else if (input_string.c_str()[i] == '>')
{
tag_open = false;
closing_tag_open = false;
tagname[tagname_idx] = 0;
tagname_idx = 0;
if (proprietary_closing_tag == true)
{
crop_end_idx = i;
strip = true;
}
}
else if (tag_open == true && closing_tag_open == false)
{
if (input_string.c_str()[i] == '.')
{
if (proprietary_tag != true)
{
orig_tag_open_idx = tag_open_idx;
proprietary_tag = true;
}
}
tagname[tagname_idx] = input_string.c_str()[i];
tagname_idx++;
}
if (strip == true && orig_tag_open_idx < input_string.size())
{
input_string.copy(buffer, (crop_end_idx - orig_tag_open_idx) + 1, orig_tag_open_idx);
message_out(INFO, "sanitize_proprietary_tags() (end tag or new tag) removed: " + string(buffer));
input_string.erase(orig_tag_open_idx, (crop_end_idx - orig_tag_open_idx) + 1);
i = orig_tag_open_idx - 1;
proprietary_tag = false;
proprietary_closing_tag = false;
closing_tag_open = false;
tag_open = false;
strip = false;
input_string_size = input_string.size();
}
}
if (proprietary_tag == true && orig_tag_open_idx < input_string.size())
{
if (crop_end_idx == 0)
{
crop_end_idx = input_string.size() - 1;
}
input_string.copy(buffer, (crop_end_idx - orig_tag_open_idx) + 1, orig_tag_open_idx);
message_out(INFO, "sanitize_proprietary_tags() (end of line) removed: " + string(buffer));
input_string.erase(orig_tag_open_idx, (crop_end_idx - orig_tag_open_idx) + 1);
input_string_size = input_string.size();
}
return input_string;
} | 1 | 3,22,23 | -1 | https://github.com/libofx/libofx/commit/a70934eea95c76a7737b83773bffe8738935082d | 0CCPP |
void Context::onHttpCallSuccess(uint32_t token, Envoy::Http::MessagePtr& response) {
auto body =
absl::string_view(static_cast<char*>(response->body()->linearize(response->body()->length())),
response->body()->length());
onHttpCallResponse(token, headerMapToPairs(&response->headers()), body,
headerMapToPairs(response->trailers()));
http_request_.erase(token);
} | 0 | null | -1 | https://github.com/istio/envoy/commit/8788a3cf255b647fd14e6b5e2585abaaedb28153 | 0CCPP |
constructor(options) {
this.name = "default";
this.optsSettings = options.settings;
this.View = options.view;
this.request = options.request;
this.renditionQueue = options.queue;
this.q = new Queue(this);
this.settings = extend(this.settings || {}, {
infinite: true,
hidden: false,
width: undefined,
height: undefined,
axis: undefined,
writingMode: undefined,
flow: "scrolled",
ignoreClass: "",
fullsize: undefined
});
extend(this.settings, options.settings || {});
this.viewSettings = {
ignoreClass: this.settings.ignoreClass,
axis: this.settings.axis,
flow: this.settings.flow,
layout: this.layout,
method: this.settings.method,
width: 0,
height: 0,
forceEvenPages: true
};
this.rendered = false;
} | 1 | 16,27 | -1 | https://github.com/futurepress/epub.js/commit/ab4dd46408cce0324e1c67de4a3ba96b59e5012e | 3JavaScript |
static bool decide_startup_pool(PgSocket *client, PktHdr *pkt)
{
const char *username = NULL, *dbname = NULL;
const char *key, *val;
bool ok;
bool appname_found = false;
while (1) {
ok = mbuf_get_string(&pkt->data, &key);
if (!ok || *key == 0)
break;
ok = mbuf_get_string(&pkt->data, &val);
if (!ok)
break;
if (strcmp(key, "database") == 0) {
slog_debug(client, "got var: %s=%s", key, val);
dbname = val;
} else if (strcmp(key, "user") == 0) {
slog_debug(client, "got var: %s=%s", key, val);
username = val;
} else if (strcmp(key, "application_name") == 0) {
set_appname(client, val);
appname_found = true;
} else if (varcache_set(&client->vars, key, val)) {
slog_debug(client, "got var: %s=%s", key, val);
} else if (strlist_contains(cf_ignore_startup_params, key)) {
slog_debug(client, "ignoring startup parameter: %s=%s", key, val);
} else {
slog_warning(client, "unsupported startup parameter: %s=%s", key, val);
disconnect_client(client, true, "Unsupported startup parameter: %s", key);
return false;
}
}
if (!username || !username[0]) {
disconnect_client(client, true, "No username supplied");
return false;
}
if (!dbname || !dbname[0])
dbname = username;
if (!appname_found)
set_appname(client, NULL);
if (get_active_client_count() > cf_max_client_conn) {
if (strcmp(dbname, "pgbouncer") != 0) {
disconnect_client(client, true, "no more connections allowed (max_client_conn)");
return false;
}
}
return set_pool(client, dbname, username, "", false);
} | 0 | null | -1 | https://github.com/pgbouncer/pgbouncer/commit/7ca3e5279d05fceb1e8a043c6f5b6f58dea3ed38 | 0CCPP |
tracing_thresh_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
int ret;
mutex_lock(&trace_types_lock);
ret = tracing_nsecs_write(&tracing_thresh, ubuf, cnt, ppos);
if (ret < 0)
goto out;
if (tr->current_trace->update_thresh) {
ret = tr->current_trace->update_thresh(tr);
if (ret < 0)
goto out;
}
ret = cnt;
out:
mutex_unlock(&trace_types_lock);
return ret;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/15fab63e1e57be9fdb5eec1bbc5916e9825e9acb | 0CCPP |
ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs)
{
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
netif_stop_queue(dev);
if (ar->arWmiReady == true)
{
if (!bypasswmi)
{
bool disconnectIssued;
disconnectIssued = (ar->arConnected) || (ar->arConnectPending);
ar6000_disconnect(ar);
if (!keepprofile) {
ar6000_init_profile_info(ar);
}
A_UNTIMEOUT(&ar->disconnect_timer);
if (getdbglogs) {
ar6000_dbglog_get_debug_logs(ar);
}
ar->arWmiReady = false;
wmi_shutdown(ar->arWmi);
ar->arWmiEnabled = false;
ar->arWmi = NULL;
if (disconnectIssued) {
if(ar->arNetworkType & AP_NETWORK) {
ar6000_disconnect_event(ar, DISCONNECT_CMD, bcast_mac, 0, NULL, 0);
} else {
ar6000_disconnect_event(ar, DISCONNECT_CMD, ar->arBssid, 0, NULL, 0);
}
}
ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
ar->user_key_ctrl = 0;
}
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI stopped\n", __func__));
}
else
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI not ready 0x%lx 0x%lx\n",
__func__, (unsigned long) ar, (unsigned long) ar->arWmi));
if(ar->arWmiEnabled == true)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Shut down WMI\n", __func__));
wmi_shutdown(ar->arWmi);
ar->arWmiEnabled = false;
ar->arWmi = NULL;
}
}
if (ar->arHtcTarget != NULL) {
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
if (NULL != ar6kHciTransCallbacks.cleanupTransport) {
ar6kHciTransCallbacks.cleanupTransport(NULL);
}
#else
if (NULL != ar->exitCallback) {
struct ar3k_config_info ar3kconfig;
int status;
A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig));
ar6000_set_default_ar3kconfig(ar, (void *)&ar3kconfig);
status = ar->exitCallback(&ar3kconfig);
if (0 != status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to reset AR3K baud rate! \n"));
}
}
if (setuphci)
ar6000_cleanup_hci(ar);
#endif
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Shutting down HTC .... \n"));
HTCStop(ar->arHtcTarget);
}
if (resetok) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Attempting to reset target on instance destroy.... \n"));
if (ar->arHifDevice != NULL) {
bool coldReset = (ar->arTargetType == TARGET_TYPE_AR6003) ? true: false;
ar6000_reset_device(ar->arHifDevice, ar->arTargetType, true, coldReset);
}
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Host does not want target reset. \n"));
}
ar6000_cookie_cleanup(ar);
ar6000_cleanup_amsdu_rxbufs(ar);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162 | 0CCPP |
process_options(argc, argv)
int argc;
char *argv[];
{
int i, l;
while (argc > 1 && argv[1][0] == '-') {
argv++;
argc--;
l = (int) strlen(*argv);
if (l < 4)
l = 4;
switch (argv[0][1]) {
case 'D':
case 'd':
if ((argv[0][1] == 'D' && !argv[0][2])
|| !strcmpi(*argv, "-debug")) {
wizard = TRUE, discover = FALSE;
} else if (!strncmpi(*argv, "-DECgraphics", l)) {
load_symset("DECGraphics", PRIMARY);
switch_symbols(TRUE);
} else {
raw_printf("Unknown option: %s", *argv);
}
break;
case 'X':
discover = TRUE, wizard = FALSE;
break;
#ifdef NEWS
case 'n':
iflags.news = FALSE;
break;
#endif
case 'u':
if (argv[0][2]) {
(void) strncpy(plname, argv[0] + 2, sizeof plname - 1);
} else if (argc > 1) {
argc--;
argv++;
(void) strncpy(plname, argv[0], sizeof plname - 1);
} else {
raw_print("Player name expected after -u");
}
break;
case 'I':
case 'i':
if (!strncmpi(*argv, "-IBMgraphics", l)) {
load_symset("IBMGraphics", PRIMARY);
load_symset("RogueIBM", ROGUESET);
switch_symbols(TRUE);
} else {
raw_printf("Unknown option: %s", *argv);
}
break;
case 'p':
if (argv[0][2]) {
if ((i = str2role(&argv[0][2])) >= 0)
flags.initrole = i;
} else if (argc > 1) {
argc--;
argv++;
if ((i = str2role(argv[0])) >= 0)
flags.initrole = i;
}
break;
case 'r':
if (argv[0][2]) {
if ((i = str2race(&argv[0][2])) >= 0)
flags.initrace = i;
} else if (argc > 1) {
argc--;
argv++;
if ((i = str2race(argv[0])) >= 0)
flags.initrace = i;
}
break;
case 'w':
config_error_init(FALSE, "command line", FALSE);
choose_windows(&argv[0][2]);
config_error_done();
break;
case '@':
flags.randomall = 1;
break;
default:
if ((i = str2role(&argv[0][1])) >= 0) {
flags.initrole = i;
break;
}
/* else raw_printf("Unknown option: %s", *argv); */
}
}
#ifdef SYSCF
if (argc > 1)
raw_printf("MAXPLAYERS are set in sysconf file.\n");
#else
if (argc > 1)
locknum = atoi(argv[1]);
#endif
#ifdef MAX_NR_OF_PLAYERS
if (!locknum || locknum > MAX_NR_OF_PLAYERS)
locknum = MAX_NR_OF_PLAYERS;
#endif
#ifdef SYSCF
if (!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))
locknum = sysopt.maxplayers;
#endif
} | 1 | 21,50,88 | -1 | https://github.com/NetHack/NetHack/commit/f3def5c0b999478da2d0a8f0b6a7c370a2065f77 | 0CCPP |
static int http_stream_write_chunked(
git_smart_subtransport_stream *stream,
const char *buffer,
size_t len)
{
http_stream *s = (http_stream *)stream;
http_subtransport *t = OWNING_SUBTRANSPORT(s);
assert(t->connected);
if (!s->sent_request) {
git_buf request = GIT_BUF_INIT;
clear_parser_state(t);
if (gen_request(&request, s, 0) < 0)
return -1;
if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) {
git_buf_free(&request);
return -1;
}
git_buf_free(&request);
s->sent_request = 1;
}
if (len > CHUNK_SIZE) {
if (s->chunk_buffer_len > 0) {
if (write_chunk(t->io, s->chunk_buffer, s->chunk_buffer_len) < 0)
return -1;
s->chunk_buffer_len = 0;
}
if (write_chunk(t->io, buffer, len) < 0)
return -1;
}
else {
int count = min(CHUNK_SIZE - s->chunk_buffer_len, len);
if (!s->chunk_buffer)
s->chunk_buffer = git__malloc(CHUNK_SIZE);
memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
s->chunk_buffer_len += count;
buffer += count;
len -= count;
if (CHUNK_SIZE == s->chunk_buffer_len) {
if (write_chunk(t->io, s->chunk_buffer, s->chunk_buffer_len) < 0)
return -1;
s->chunk_buffer_len = 0;
if (len > 0) {
memcpy(s->chunk_buffer, buffer, len);
s->chunk_buffer_len = len;
}
}
}
return 0;
} | 0 | null | -1 | https://github.com/libgit2/libgit2/commit/9a64e62f0f20c9cf9b2e1609f037060eb2d8eb22 | 0CCPP |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
static const int kOutputUniqueTensor = 0;
static const int kOutputIndexTensor = 1;
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output_unique_tensor =
GetOutput(context, node, kOutputUniqueTensor);
TfLiteTensor* output_index_tensor =
GetOutput(context, node, kOutputIndexTensor);
TF_LITE_ENSURE_EQ(context, NumDimensions(input), 1);
TfLiteIntArray* output_index_shape = TfLiteIntArrayCopy(input->dims);
SetTensorToDynamic(output_unique_tensor);
return context->ResizeTensor(context, output_index_tensor,
output_index_shape);
} | 1 | 5,6,7,8,9 | -1 | https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35 | 0CCPP |
show : typeof(opts.show) == 'function' ? opts.show : function() { },
hide : typeof(opts.hide) == 'function' ? opts.hide : function() { }
});
});
if (opts == 'show') {
var o = this.eq(0),
cnt = o.data('cnt') + 1,
show = o.data('show');
o.data('cnt', cnt);
if (o.is(':hidden')) {
o.zIndex(o.parent().zIndex()+1);
o.show();
show();
}
}
if (opts == 'hide') {
var o = this.eq(0),
cnt = o.data('cnt') - 1,
hide = o.data('hide');
o.data('cnt', cnt);
if (cnt == 0 && o.is(':visible')) {
o.hide();
hide();
}
}
return this;
} | 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 | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
static struct ip_options *tcp_v4_save_options(struct sock *sk,
struct sk_buff *skb)
{
struct ip_options *opt = &(IPCB(skb)->opt);
struct ip_options *dopt = NULL;
if (opt && opt->optlen) {
int opt_size = optlength(opt);
dopt = kmalloc(opt_size, GFP_ATOMIC);
if (dopt) {
if (ip_options_echo(dopt, skb)) {
kfree(dopt);
dopt = NULL;
}
}
}
return dopt;
} | 1 | 0,1,3,4,6,9 | -1 | https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259 | 0CCPP |
static void *mcryptd_alloc_instance(struct crypto_alg *alg, unsigned int head,
unsigned int tail)
{
char *p;
struct crypto_instance *inst;
int err;
p = kzalloc(head + sizeof(*inst) + tail, GFP_KERNEL);
if (!p)
return ERR_PTR(-ENOMEM);
inst = (void *)(p + head);
err = -ENAMETOOLONG;
if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
"mcryptd(%s)", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME)
goto out_free_inst;
memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME);
inst->alg.cra_priority = alg->cra_priority + 50;
inst->alg.cra_blocksize = alg->cra_blocksize;
inst->alg.cra_alignmask = alg->cra_alignmask;
out:
return p;
out_free_inst:
kfree(p);
p = ERR_PTR(err);
goto out;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/48a992727d82cb7db076fa15d372178743b1f4cd | 0CCPP |
def calc(self, irc, msg, args, text):
try:
self.log.info("evaluating %q from %s", text, msg.prefix)
x = complex(safe_eval(text, allow_ints=False))
irc.reply(self._complexToString(x))
except OverflowError:
maxFloat = math.ldexp(0.9999999999999999, 1024)
irc.error(_("The answer exceeded %s or so.") % maxFloat)
except InvalidNode as e:
irc.error(_("Invalid syntax: %s") % e.args[0])
except NameError as e:
irc.error(_("%s is not a defined function.") % e.args[0])
except Exception as e:
irc.error(str(e))
| 0 | null | -1 | https://github.com/ProgVal/Limnoria.git/commit/3848ae78de45b35c029cc333963d436b9d2f0a35 | 4Python |
pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
lookbehind: true
}
}); | 1 | 0 | -1 | https://github.com/PrismJS/prism/commit/c2f6a64426f44497a675cb32dccb079b3eff1609 | 3JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.