processed_func
string | target
int64 | flaw_line
string | flaw_line_index
int64 | commit_url
string | language
class label |
|---|---|---|---|---|---|
valid: function() {
return this.size() === 0;
},
| 0
| null | -1
|
https://github.com/jquery-validation/jquery-validation/commit/5d8f29eef363d043a8fec4eb86d42cadb5fa5f7d
| 3JavaScript
|
static int input_dev_suspend(struct device *dev)
{
struct input_dev *input_dev = to_input_dev(dev);
spin_lock_irq(&input_dev->event_lock);
input_dev_release_keys(input_dev);
input_dev_toggle(input_dev, false);
spin_unlock_irq(&input_dev->event_lock);
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/cb222aed03d798fc074be55e59d9a112338ee784
| 0CCPP
|
public void DoUpdate(AgentUpdateInfo agentUpdateInfo) {
_agentUpdateInfo = agentUpdateInfo;
_logger.Log(String.Format("Received from Agent the following data:\r\nURL:{0}\r\nCHECKSUM:{1}, will resume in a minute", _agentUpdateInfo.url, _agentUpdateInfo.signature));
new Timer(TimerElapsed,null,60000,0);
}
| 1
|
3
| -1
|
https://github.com/rackerlabs/openstack-guest-agents-windows-xenserver/commit/ef16f88f20254b8083e361f11707da25f8482401
| 1CS
|
static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
{
struct sctp_association *asoc = chunk->asoc;
struct sock *sk = asoc->base.sk;
sctp_association_hold(asoc);
skb_set_owner_w(chunk->skb, sk);
chunk->skb->destructor = sctp_wfree;
*((struct sctp_chunk **)(chunk->skb->cb)) = chunk;
asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk) +
sizeof(struct sk_buff) +
sizeof(struct sctp_chunk);
atomic_add(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/ea2bc483ff5caada7c4aa0d5fbf87d3a6590273d
| 0CCPP
|
void md_wakeup_thread(struct md_thread *thread)
{
if (thread) {
pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm);
set_bit(THREAD_WAKEUP, &thread->flags);
wake_up(&thread->wqueue);
}
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/b6878d9e03043695dbf3fa1caa6dfc09db225b16
| 0CCPP
|
read_config_file(void)
{
init_data(conf_file, global_init_keywords);
}
| 0
| null | -1
|
https://github.com/acassen/keepalived/commit/c6247a9ef2c7b33244ab1d3aa5d629ec49f0a067
| 0CCPP
|
protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException, InterruptedException {
StartTls startTlsFeature = getFeature(StartTls.ELEMENT, StartTls.NAMESPACE);
if (startTlsFeature != null) {
if (startTlsFeature.required() && config.getSecurityMode() == SecurityMode.disabled) {
notifyConnectionError(new SecurityRequiredByServerException());
return;
}
if (config.getSecurityMode() != ConnectionConfiguration.SecurityMode.disabled) {
sendNonza(new StartTls());
}
}
// If TLS is required but the server doesn't offer it, disconnect
// from the server and throw an error. First check if we've already negotiated TLS
// and are secure, however (features get parsed a second time after TLS is established).
if (!isSecureConnection() && startTlsFeature == null
&& getConfiguration().getSecurityMode() == SecurityMode.required) {
throw new SecurityRequiredByClientException();
}
if (getSASLAuthentication().authenticationSuccessful()) {
maybeCompressFeaturesReceived.reportSuccess();
}
}
| 1
|
0,11,12,13,14,15,16,17
| -1
|
https://github.com/igniterealtime/Smack/commit/a9d5cd4a611f47123f9561bc5a81a4555fe7cb04
| 2Java
|
public static ApplicationConfiguration CreateServerConfiguration()
{
ApplicationConfiguration configuration = new ApplicationConfiguration();
configuration.ApplicationName = "My Server Name";
configuration.ApplicationType = ApplicationType.Server;
configuration.ApplicationUri = "http://localhost/VendorId/ApplicationId/InstanceId";
configuration.ProductUri = "http://VendorId/ProductId/VersionId";
configuration.SecurityConfiguration = new SecurityConfiguration();
configuration.SecurityConfiguration.ApplicationCertificate = new CertificateIdentifier();
configuration.SecurityConfiguration.ApplicationCertificate.StoreType = CertificateStoreType.Windows;
configuration.SecurityConfiguration.ApplicationCertificate.StorePath = "LocalMachine\\My";
configuration.SecurityConfiguration.ApplicationCertificate.SubjectName = configuration.ApplicationName;
configuration.SecurityConfiguration.TrustedPeerCertificates.StoreType = CertificateStoreType.Windows;
configuration.SecurityConfiguration.TrustedPeerCertificates.StorePath = "LocalMachine\\My";
X509Certificate2 serverCertificate = configuration.SecurityConfiguration.ApplicationCertificate.Find(true);
if (serverCertificate == null)
{
serverCertificate = CertificateFactory.CreateCertificate(
configuration.SecurityConfiguration.ApplicationCertificate.StoreType,
configuration.SecurityConfiguration.ApplicationCertificate.StorePath,
configuration.ApplicationUri,
configuration.ApplicationName,
null,
null,
2048,
300);
Console.WriteLine("Created server certificate: {0}", serverCertificate.Subject);
}
configuration.TransportQuotas = new TransportQuotas();
configuration.TransportQuotas.OperationTimeout = 60000;
configuration.ServerConfiguration = new ServerConfiguration();
configuration.ServerConfiguration.MaxRegistrationInterval = 0;
configuration.ServerConfiguration.BaseAddresses.Add(DefaultHttpUrl);
configuration.ServerConfiguration.BaseAddresses.Add(DefaultTcpUrl);
ServerSecurityPolicy policy1 = new ServerSecurityPolicy();
policy1.SecurityMode = MessageSecurityMode.SignAndEncrypt;
policy1.SecurityPolicyUri = SecurityPolicies.Basic128Rsa15;
policy1.SecurityLevel = 1;
configuration.ServerConfiguration.SecurityPolicies.Add(policy1);
ServerSecurityPolicy policy2 = new ServerSecurityPolicy();
policy2.SecurityMode = MessageSecurityMode.None;
policy2.SecurityPolicyUri = SecurityPolicies.None;
policy2.SecurityLevel = 0;
configuration.ServerConfiguration.SecurityPolicies.Add(policy2);
configuration.ServerConfiguration.UserTokenPolicies.Add(new UserTokenPolicy(UserTokenType.Anonymous));
configuration.ServerConfiguration.UserTokenPolicies.Add(new UserTokenPolicy(UserTokenType.UserName));
configuration.Validate(ApplicationType.Server);
return configuration;
}
| 1
|
36,37
| -1
|
https://github.com/OPCFoundation/UA-.NET-Legacy/commit/e2a781b38efb8686d2bd850c2f2372b5c670bc45
| 1CS
|
static bool need_wrongsec_check(struct svc_rqst *rqstp)
{
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfsd4_compoundargs *argp = rqstp->rq_argp;
struct nfsd4_op *this = &argp->ops[resp->opcnt - 1];
struct nfsd4_op *next = &argp->ops[resp->opcnt];
struct nfsd4_operation *thisd;
struct nfsd4_operation *nextd;
thisd = OPDESC(this);
if (!(thisd->op_flags & OP_IS_PUTFH_LIKE))
return false;
if (argp->opcnt == resp->opcnt)
return false;
if (next->opnum == OP_ILLEGAL)
return false;
nextd = OPDESC(next);
return !(nextd->op_flags & OP_HANDLES_WRONGSEC);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/b550a32e60a4941994b437a8d662432a486235a5
| 0CCPP
|
decompose_rpath (const char *rpath, struct link_map *l, const char *what)
{
const char *where = l->l_name;
char *copy;
char *cp;
struct r_search_path_elem **result;
size_t nelems;
if (_dl_inhibit_rpath != NULL && !__libc_enable_secure)
{
const char *found = strstr (_dl_inhibit_rpath, where);
if (found != NULL)
{
size_t len = strlen (where);
if ((found == _dl_inhibit_rpath || found[-1] == ':')
&& (found[len] == '\0' || found[len] == ':'))
{
result = (struct r_search_path_elem **)
malloc (sizeof (*result));
if (result == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
result[0] = NULL;
return result;
}
}
}
copy = expand_dynamic_string_token (l, rpath);
if (copy == NULL)
_dl_signal_error (ENOMEM, NULL, "cannot create RUNPATH/RPATH copy");
nelems = 0;
for (cp = copy; *cp != '\0'; ++cp)
if (*cp == ':')
++nelems;
result = (struct r_search_path_elem **) malloc ((nelems + 1 + 1)
* sizeof (*result));
if (result == NULL)
_dl_signal_error (ENOMEM, NULL, "cannot create cache for search path");
return fillin_rpath (copy, result, ":", 0, what, where);
}
| 0
| null | -1
|
https://github.com/bminor/glibc/commit/2864e767053317538feafa815046fff89e5a16be
| 0CCPP
|
static ut64 baddr(RBinFile *arch) {
return 0;
}
| 0
| null | -1
|
https://github.com/radareorg/radare2/commit/ead645853a63bf83d8386702cad0cf23b31d7eeb
| 0CCPP
|
this.init = function() {
$.each(msg, function(k, v) {
msg[k] = fm.i18n(v);
});
}
| 1
|
0,1,2,3,4
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
xhr.onerror = function(e) {
that._subscriptions.malware.last_update_failed_at = Date.now();
}
| 0
| null | -1
|
https://github.com/kzar/watchadblock/commit/5b77de6ea77e0eff2aa726d9722d64fb4964b985
| 3JavaScript
|
static void flush_tmregs_to_thread(struct task_struct *tsk)
{
if (tsk != current)
return;
if (MSR_TM_SUSPENDED(mfmsr())) {
tm_reclaim_current(TM_CAUSE_SIGNAL);
} else {
tm_enable();
tm_save_sprs(&(tsk->thread));
}
}
| 1
|
2
| -1
|
https://github.com/torvalds/linux/commit/c1fa0768a8713b135848f78fd43ffc208d8ded70
| 0CCPP
|
function validateEmail(email) {
if (Meteor.loginWithLDAP) {
return true
}
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(String(email).toLowerCase())
}
| 0
| null | -1
|
https://github.com/kromitgmbh/titra/commit/e606b674a2b7564407d89e38a341d72e22b14694
| 3JavaScript
|
void mddev_suspend(struct mddev *mddev)
{
BUG_ON(mddev->suspended);
mddev->suspended = 1;
synchronize_rcu();
wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0);
mddev->pers->quiesce(mddev, 1);
del_timer_sync(&mddev->safemode_timer);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/b6878d9e03043695dbf3fa1caa6dfc09db225b16
| 0CCPP
|
pixFillMapHoles(PIX *pix,
l_int32 nx,
l_int32 ny,
l_int32 filltype)
{
l_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest;
l_uint32 val, lastval;
NUMA *na;
PIX *pixt;
PROCNAME("pixFillMapHoles");
if (!pix || pixGetDepth(pix) != 8)
return ERROR_INT("pix not defined or not 8 bpp", procName, 1);
if (pixGetColormap(pix))
return ERROR_INT("pix is colormapped", procName, 1);
pixGetDimensions(pix, &w, &h, NULL);
na = numaCreate(0);
nmiss = 0;
valtest = (filltype == L_FILL_WHITE) ? 255 : 0;
for (j = 0; j < nx; j++) {
found = FALSE;
for (i = 0; i < ny; i++) {
pixGetPixel(pix, j, i, &val);
if (val != valtest) {
y = i;
found = TRUE;
break;
}
}
if (found == FALSE) {
numaAddNumber(na, 0);
nmiss++;
}
else {
numaAddNumber(na, 1);
for (i = y - 1; i >= 0; i--)
pixSetPixel(pix, j, i, val);
pixGetPixel(pix, j, 0, &lastval);
for (i = 1; i < h; i++) {
pixGetPixel(pix, j, i, &val);
if (val == valtest)
pixSetPixel(pix, j, i, lastval);
else
lastval = val;
}
}
}
numaAddNumber(na, 0);
if (nmiss == nx) {
numaDestroy(&na);
L_WARNING("no bg found; no data in any column\n", procName);
return 1;
}
if (nmiss > 0) {
pixt = pixCopy(NULL, pix);
goodcol = 0;
for (j = 0; j < w; j++) {
numaGetIValue(na, j, &ival);
if (ival == 1) {
goodcol = j;
break;
}
}
if (goodcol > 0) {
for (j = goodcol - 1; j >= 0; j--) {
pixRasterop(pix, j, 0, 1, h, PIX_SRC, pixt, j + 1, 0);
pixRasterop(pixt, j, 0, 1, h, PIX_SRC, pix, j, 0);
}
}
for (j = goodcol + 1; j < w; j++) {
numaGetIValue(na, j, &ival);
if (ival == 0) {
pixRasterop(pix, j, 0, 1, h, PIX_SRC, pixt, j - 1, 0);
pixRasterop(pixt, j, 0, 1, h, PIX_SRC, pix, j, 0);
}
}
pixDestroy(&pixt);
}
if (w > nx) {
for (i = 0; i < h; i++) {
pixGetPixel(pix, w - 2, i, &val);
pixSetPixel(pix, w - 1, i, val);
}
}
numaDestroy(&na);
return 0;
}
| 1
|
8,53,63,64,65,66,71,72,75
| -1
|
https://github.com/DanBloomberg/leptonica/commit/3c18c43b6a3f753f0dfff99610d46ad46b8bfac4
| 0CCPP
|
error_t am335xEthAddVlanAddrEntry(uint_t port, uint_t vlanId, MacAddr *macAddr)
{
error_t error;
uint_t index;
Am335xAleEntry entry;
index = am335xEthFindVlanAddrEntry(vlanId, macAddr);
if(index >= CPSW_ALE_MAX_ENTRIES)
{
index = am335xEthFindFreeEntry();
}
if(index < CPSW_ALE_MAX_ENTRIES)
{
entry.word2 = 0;
entry.word1 = CPSW_ALE_WORD1_ENTRY_TYPE_VLAN_ADDR;
entry.word0 = 0;
if(macIsMulticastAddr(macAddr))
{
entry.word2 |= CPSW_ALE_WORD2_SUPER |
CPSW_ALE_WORD2_PORT_LIST(1 << port) |
CPSW_ALE_WORD2_PORT_LIST(1 << CPSW_CH0);
entry.word1 |= CPSW_ALE_WORD1_MCAST_FWD_STATE(0);
}
entry.word1 |= CPSW_ALE_WORD1_VLAN_ID(vlanId);
entry.word1 |= (macAddr->b[0] << 8) | macAddr->b[1];
entry.word0 |= (macAddr->b[2] << 24) | (macAddr->b[3] << 16) |
(macAddr->b[4] << 8) | macAddr->b[5];
am335xEthWriteEntry(index, &entry);
//Sucessful processing
error = NO_ERROR;
}
else
{
error = ERROR_FAILURE;
}
return error;
}
| 1
|
27
| -1
|
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
| 0CCPP
|
const dnn::AlgorithmConfig& algorithm_config() const {
return algorithm_config_;
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/14755416e364f17fb1870882fa778c7fec7f16e3
| 0CCPP
|
TcpOption *tcpGetOption(TcpHeader *segment, uint8_t kind)
{
size_t length;
uint_t i;
TcpOption *option;
if(segment->dataOffset < 5)
return NULL;
//Compute the length of the options field
length = segment->dataOffset * 4 - sizeof(TcpHeader);
//Point to the very first option
i = 0;
//Parse TCP options
while(i < length)
{
//Point to the current option
option = (TcpOption *) (segment->options + i);
//NOP option detected?
if(option->kind == TCP_OPTION_NOP)
{
i++;
continue;
}
//END option detected?
if(option->kind == TCP_OPTION_END)
break;
//Check option length
if((i + 1) >= length || (i + option->length) > length)
break;
//Current option kind match the specified one?
if(option->kind == kind)
return option;
//Jump to next the next option
i += option->length;
}
//Specified option code not found
return NULL;
}
| 1
|
3,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,34
| -1
|
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
| 0CCPP
|
static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct sock *sk = sock->sk;
struct sock *other = NULL;
int err, size;
struct sk_buff *skb;
int sent = 0;
struct scm_cookie tmp_scm;
bool fds_sent = false;
int max_level;
if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
wait_for_unix_gc();
err = scm_send(sock, msg, siocb->scm, false);
if (err < 0)
return err;
err = -EOPNOTSUPP;
if (msg->msg_flags&MSG_OOB)
goto out_err;
if (msg->msg_namelen) {
err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
goto out_err;
} else {
err = -ENOTCONN;
other = unix_peer(sk);
if (!other)
goto out_err;
}
if (sk->sk_shutdown & SEND_SHUTDOWN)
goto pipe_err;
while (sent < len) {
size = len-sent;
if (size > ((sk->sk_sndbuf >> 1) - 64))
size = (sk->sk_sndbuf >> 1) - 64;
if (size > SKB_MAX_ALLOC)
size = SKB_MAX_ALLOC;
skb = sock_alloc_send_skb(sk, size, msg->msg_flags&MSG_DONTWAIT,
&err);
if (skb == NULL)
goto out_err;
size = min_t(int, size, skb_tailroom(skb));
err = unix_scm_to_skb(siocb->scm, skb, !fds_sent);
if (err < 0) {
kfree_skb(skb);
goto out_err;
}
max_level = err + 1;
fds_sent = true;
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
if (err) {
kfree_skb(skb);
goto out_err;
}
unix_state_lock(other);
if (sock_flag(other, SOCK_DEAD) ||
(other->sk_shutdown & RCV_SHUTDOWN))
goto pipe_err_free;
maybe_add_creds(skb, sock, other);
skb_queue_tail(&other->sk_receive_queue, skb);
if (max_level > unix_sk(other)->recursion_level)
unix_sk(other)->recursion_level = max_level;
unix_state_unlock(other);
other->sk_data_ready(other, size);
sent += size;
}
scm_destroy(siocb->scm);
siocb->scm = NULL;
return sent;
pipe_err_free:
unix_state_unlock(other);
kfree_skb(skb);
pipe_err:
if (sent == 0 && !(msg->msg_flags&MSG_NOSIGNAL))
send_sig(SIGPIPE, current, 0);
err = -EPIPE;
out_err:
scm_destroy(siocb->scm);
siocb->scm = NULL;
return sent ? : err;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea
| 0CCPP
|
static int fsmVerify(const char *path, rpmfi fi)
{
int rc;
int saveerrno = errno;
struct stat dsb;
mode_t mode = rpmfiFMode(fi);
rc = fsmStat(path, 1, &dsb);
if (rc)
return rc;
if (S_ISREG(mode)) {
char *rmpath = rstrscat(NULL, path, "-RPMDELETE", NULL);
rc = fsmRename(path, rmpath);
if (!rc)
(void) fsmUnlink(rmpath);
else
rc = RPMERR_UNLINK_FAILED;
free(rmpath);
return (rc ? rc : RPMERR_ENOENT);
} else if (S_ISDIR(mode)) {
if (S_ISDIR(dsb.st_mode)) return 0;
if (S_ISLNK(dsb.st_mode)) {
rc = fsmStat(path, 0, &dsb);
if (rc == RPMERR_ENOENT) rc = 0;
if (rc) return rc;
errno = saveerrno;
if (S_ISDIR(dsb.st_mode)) return 0;
}
} else if (S_ISLNK(mode)) {
if (S_ISLNK(dsb.st_mode)) {
char buf[8 * BUFSIZ];
size_t len;
rc = fsmReadLink(path, buf, 8 * BUFSIZ, &len);
errno = saveerrno;
if (rc) return rc;
if (rstreq(rpmfiFLink(fi), buf)) return 0;
}
} else if (S_ISFIFO(mode)) {
if (S_ISFIFO(dsb.st_mode)) return 0;
} else if (S_ISCHR(mode) || S_ISBLK(mode)) {
if ((S_ISCHR(dsb.st_mode) || S_ISBLK(dsb.st_mode)) &&
(dsb.st_rdev == rpmfiFRdev(fi))) return 0;
} else if (S_ISSOCK(mode)) {
if (S_ISSOCK(dsb.st_mode)) return 0;
}
rc = fsmUnlink(path);
if (rc == 0) rc = RPMERR_ENOENT;
return (rc ? rc : RPMERR_ENOENT);
}
| 1
|
0,25
| -1
|
https://github.com/rpm-software-management/rpm/commit/f2d3be2a8741234faaa96f5fd05fdfdc75779a79
| 0CCPP
|
ta.style.width="40px";ta.style.height="12px";ta.style.marginBottom="-2px";ta.style.backgroundImage="url("+mxWindow.prototype.normalizeImage+")";ta.style.backgroundPosition="top center";ta.style.backgroundRepeat="no-repeat";ta.setAttribute("title","Minimize");var Na=!1,Ca=mxUtils.bind(this,function(){S.innerHTML="";if(!Na){var za=function(Ea,La,Ta){Ea=X("",Ea.funct,null,La,Ea,Ta);Ea.style.width="40px";Ea.style.opacity="0.7";return wa(Ea,null,"pointer")},wa=function(Ea,La,Ta){null!=La&&Ea.setAttribute("title",
La);Ea.style.cursor=null!=Ta?Ta:"default";Ea.style.margin="2px 0px";S.appendChild(Ea);mxUtils.br(S);return Ea};wa(U.sidebar.createVertexTemplate("text;strokeColor=none;fillColor=none;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;",60,30,"Text",mxResources.get("text"),!0,!1,null,!0,!0),mxResources.get("text")+" ("+Editor.ctrlKey+"+Shift+X)");wa(U.sidebar.createVertexTemplate("shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;fontColor=#000000;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;shadow=1;size=20;pointerEvents=1;",
| 1
|
0,1
| -1
|
https://github.com/jgraph/drawio/commit/c287bef9101d024b1fd59d55ecd530f25000f9d8
| 3JavaScript
|
BOOL nego_read_request(rdpNego* nego, wStream* s)
{
BYTE li;
BYTE type;
UINT16 length;
if (!tpkt_read_header(s, &length))
return FALSE;
if (!tpdu_read_connection_request(s, &li, length))
return FALSE;
if (li != Stream_GetRemainingLength(s) + 6)
{
WLog_ERR(TAG, "Incorrect TPDU length indicator.");
return FALSE;
}
if (!nego_read_request_token_or_cookie(nego, s))
{
WLog_ERR(TAG, "Failed to parse routing token or cookie.");
return FALSE;
}
if (Stream_GetRemainingLength(s) >= 8)
{
Stream_Read_UINT8(s, type);
if (type != TYPE_RDP_NEG_REQ)
{
WLog_ERR(TAG, "Incorrect negotiation request type %" PRIu8 "", type);
return FALSE;
}
nego_process_negotiation_request(nego, s);
}
return tpkt_ensure_stream_consumed(s, length);
}
| 1
|
27
| -1
|
https://github.com/FreeRDP/FreeRDP/commit/6b485b146a1b9d6ce72dfd7b5f36456c166e7a16
| 0CCPP
|
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null) {
return true;
}
CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(type);
CronParser cronParser = new CronParser(cronDefinition);
try {
cronParser.parse(value).validate();
return true;
} catch (IllegalArgumentException e) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(e.getMessage()).addConstraintViolation();
return false;
}
}
| 1
|
11
| -1
|
https://github.com/jmrozanec/cron-utils/commit/d7c6e3cd8c8c7732330b00c01fc881845b4a6fbe
| 2Java
|
create = function(dir, hash) {
return $(tpl.replace(/\{id\}/, hash2id(dir? dir.hash : hash))
.replace(/\{name\}/, fm.escape(dir? dir.name : hash))
.replace(/\{cssclass\}/, dir? (fm.UA.Touch ? 'elfinder-touch ' : '')+fm.perms2class(dir) : '')
.replace(/\{permissions\}/, (dir && (!dir.read || !dir.write))? ptpl : '')
.replace(/\{title\}/, (dir && dir.path)? fm.escape(dir.path) : '')
.replace(/\{symlink\}/, '')
.replace(/\{style\}/, ''));
},
| 1
|
3,4
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
static void ssdp_recv(int sd)
{
ssize_t len;
struct sockaddr sa;
socklen_t salen;
char buf[MAX_PKT_SIZE];
memset(buf, 0, sizeof(buf));
len = recvfrom(sd, buf, sizeof(buf), MSG_DONTWAIT, &sa, &salen);
if (len > 0) {
buf[len] = 0;
if (sa.sa_family != AF_INET)
return;
if (strstr(buf, "M-SEARCH *")) {
size_t i;
char *ptr, *type;
struct ifsock *ifs;
struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
ifs = find_outbound(&sa);
if (!ifs) {
logit(LOG_DEBUG, "No matching socket for client %s", inet_ntoa(sin->sin_addr));
return;
}
logit(LOG_DEBUG, "Matching socket for client %s", inet_ntoa(sin->sin_addr));
type = strcasestr(buf, "\r\nST:");
if (!type) {
logit(LOG_DEBUG, "No Search Type (ST:) found in M-SEARCH *, assuming " SSDP_ST_ALL);
type = SSDP_ST_ALL;
send_message(ifs, type, &sa);
return;
}
type = strchr(type, ':');
if (!type)
return;
type++;
while (isspace(*type))
type++;
ptr = strstr(type, "\r\n");
if (!ptr)
return;
*ptr = 0;
for (i = 0; supported_types[i]; i++) {
if (!strcmp(supported_types[i], type)) {
logit(LOG_DEBUG, "M-SEARCH * ST: %s from %s port %d", type,
inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
send_message(ifs, type, &sa);
return;
}
}
logit(LOG_DEBUG, "M-SEARCH * for unsupported ST: %s from %s", type,
inet_ntoa(sin->sin_addr));
}
}
}
| 1
|
5,7,9
| -1
|
https://github.com/troglobit/ssdp-responder/commit/ce04b1f29a137198182f60bbb628d5ceb8171765
| 0CCPP
|
static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
struct iovec iov[], int iov_size)
{
const struct vhost_memory_region *reg;
struct vhost_memory *mem;
struct iovec *_iov;
u64 s = 0;
int ret = 0;
rcu_read_lock();
mem = rcu_dereference(dev->memory);
while ((u64)len > s) {
u64 size;
if (unlikely(ret >= iov_size)) {
ret = -ENOBUFS;
break;
}
reg = find_region(mem, addr, len);
if (unlikely(!reg)) {
ret = -EFAULT;
break;
}
_iov = iov + ret;
size = reg->memory_size - addr + reg->guest_phys_addr;
_iov->iov_len = min((u64)len, size);
_iov->iov_base = (void __user *)(unsigned long)
(reg->userspace_addr + addr - reg->guest_phys_addr);
s += size;
addr += size;
++ret;
}
rcu_read_unlock();
return ret;
}
| 1
|
23
| -1
|
https://github.com/torvalds/linux/commit/bd97120fc3d1a11f3124c7c9ba1d91f51829eb85
| 0CCPP
|
int mainloop(CLIENT *client) {
struct nbd_request request;
struct nbd_reply reply;
gboolean go_on=TRUE;
#ifdef DODBG
int i = 0;
#endif
negotiate(client->net, client, NULL);
DEBUG("Entering request loop!\n");
reply.magic = htonl(NBD_REPLY_MAGIC);
reply.error = 0;
while (go_on) {
char buf[BUFSIZE];
size_t len;
#ifdef DODBG
i++;
printf("%d: ", i);
#endif
readit(client->net, &request, sizeof(request));
request.from = ntohll(request.from);
request.type = ntohl(request.type);
if (request.type==NBD_CMD_DISC) {
msg2(LOG_INFO, "Disconnect request received.");
if (client->server->flags & F_COPYONWRITE) {
if (client->difmap) g_free(client->difmap) ;
close(client->difffile);
unlink(client->difffilename);
free(client->difffilename);
}
go_on=FALSE;
continue;
}
len = ntohl(request.len);
if (request.magic != htonl(NBD_REQUEST_MAGIC))
err("Not enough magic.");
if (len > BUFSIZE + sizeof(struct nbd_reply))
err("Request too big!");
#ifdef DODBG
printf("%s from %llu (%llu) len %d, ", request.type ? "WRITE" :
"READ", (unsigned long long)request.from,
(unsigned long long)request.from / 512, len);
#endif
memcpy(reply.handle, request.handle, sizeof(reply.handle));
if ((request.from + len) > (OFFT_MAX)) {
DEBUG("[Number too large!]");
ERROR(client, reply, EINVAL);
continue;
}
if (((ssize_t)((off_t)request.from + len) > client->exportsize)) {
DEBUG("[RANGE!]");
ERROR(client, reply, EINVAL);
continue;
}
if (request.type==NBD_CMD_WRITE) {
DEBUG("wr: net->buf, ");
readit(client->net, buf, len);
DEBUG("buf->exp, ");
if ((client->server->flags & F_READONLY) ||
(client->server->flags & F_AUTOREADONLY)) {
DEBUG("[WRITE to READONLY!]");
ERROR(client, reply, EPERM);
continue;
}
if (expwrite(request.from, buf, len, client)) {
DEBUG("Write failed: %m" );
ERROR(client, reply, errno);
continue;
}
SEND(client->net, reply);
DEBUG("OK!\n");
continue;
}
DEBUG("exp->buf, ");
if (expread(request.from, buf + sizeof(struct nbd_reply), len, client)) {
DEBUG("Read failed: %m");
ERROR(client, reply, errno);
continue;
}
DEBUG("buf->net, ");
memcpy(buf, &reply, sizeof(struct nbd_reply));
writeit(client->net, buf, len + sizeof(struct nbd_reply));
DEBUG("OK!\n");
}
return 0;
}
| 1
|
35
| -1
|
https://github.com/NetworkBlockDevice/nbd/commit/3ef52043861ab16352d49af89e048ba6339d6df8
| 0CCPP
|
static void atl2_set_multi(struct net_device *netdev)
{
struct atl2_adapter *adapter = netdev_priv(netdev);
struct atl2_hw *hw = &adapter->hw;
struct netdev_hw_addr *ha;
u32 rctl;
u32 hash_value;
rctl = ATL2_READ_REG(hw, REG_MAC_CTRL);
if (netdev->flags & IFF_PROMISC) {
rctl |= MAC_CTRL_PROMIS_EN;
} else if (netdev->flags & IFF_ALLMULTI) {
rctl |= MAC_CTRL_MC_ALL_EN;
rctl &= ~MAC_CTRL_PROMIS_EN;
} else
rctl &= ~(MAC_CTRL_PROMIS_EN | MAC_CTRL_MC_ALL_EN);
ATL2_WRITE_REG(hw, REG_MAC_CTRL, rctl);
ATL2_WRITE_REG(hw, REG_RX_HASH_TABLE, 0);
ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
netdev_for_each_mc_addr(ha, netdev) {
hash_value = atl2_hash_mc_addr(hw, ha->addr);
atl2_hash_set(hw, hash_value);
}
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/f43bfaeddc79effbf3d0fcb53ca477cca66f3db8
| 0CCPP
|
void pin_remove(struct fs_pin *pin)
{
spin_lock(&pin_lock);
hlist_del(&pin->m_list);
hlist_del(&pin->s_list);
spin_unlock(&pin_lock);
spin_lock_irq(&pin->wait.lock);
pin->done = 1;
wake_up_locked(&pin->wait);
spin_unlock_irq(&pin->wait.lock);
}
| 1
|
3,4
| -1
|
https://github.com/torvalds/linux/commit/820f9f147dcce2602eefd9b575bbbd9ea14f0953
| 0CCPP
|
mxShapeMockupVerButtonBar.prototype.background=function(a,d,e,b,c,f,g,h,k,l,m,n,p){a.begin();a.setStrokeColor(h);a.setFillColor(l);a.moveTo(0,b);a.arcTo(b,b,0,0,1,b,0);a.lineTo(d-b,0);a.arcTo(b,b,0,0,1,d,b);a.lineTo(d,e-b);a.arcTo(b,b,0,0,1,d-b,e);a.lineTo(b,e);a.arcTo(b,b,0,0,1,0,e-b);a.close();a.fillAndStroke();a.setStrokeColor(k);a.begin();for(f=1;f<c;f++)f!==n&&f!==n+1&&(k=f*p*e/g,a.moveTo(0,k),a.lineTo(d,k));a.stroke();a.setFillColor(m);0===n?(a.begin(),g=p*e/g,a.moveTo(0,b),a.arcTo(b,b,0,0,
1,b,0),a.lineTo(d-b,0),a.arcTo(b,b,0,0,1,d,b),a.lineTo(d,g),a.lineTo(0,g),a.close(),a.fill()):n===c-1?(a.begin(),c=e-p*e/g,a.moveTo(0,c),a.lineTo(d,c),a.lineTo(d,e-b),a.arcTo(b,b,0,0,1,d-b,e),a.lineTo(b,e),a.arcTo(b,b,0,0,1,0,e-b),a.close(),a.fill()):-1!==n&&(a.begin(),c=p*n*e/g,g=p*(n+1)*e/g,a.moveTo(0,c),a.lineTo(d,c),a.lineTo(d,g),a.lineTo(0,g),a.close(),a.fill());a.begin();a.setStrokeColor(h);a.setFillColor(l);a.moveTo(0,b);a.arcTo(b,b,0,0,1,b,0);a.lineTo(d-b,0);a.arcTo(b,b,0,0,1,d,b);a.lineTo(d,
e-b);a.arcTo(b,b,0,0,1,d-b,e);a.lineTo(b,e);a.arcTo(b,b,0,0,1,0,e-b);a.close();a.stroke()};mxShapeMockupVerButtonBar.prototype.buttonText=function(a,d,e,b,c){b.charAt(0)===mxShapeMockupVerButtonBar.prototype.cst.SELECTED&&(b=b.substring(1));a.begin();a.setFontSize(c);a.text(.5*d,e,0,0,b,mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0)};mxCellRenderer.registerShape(mxShapeMockupVerButtonBar.prototype.cst.SHAPE_VER_BUTTON_BAR,mxShapeMockupVerButtonBar);
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
| 3JavaScript
|
public RecurlyList<Adjustment> GetAdjustments(Adjustment.AdjustmentType type = Adjustment.AdjustmentType.All,
Adjustment.AdjustmentState state = Adjustment.AdjustmentState.Any)
{
var adjustments = new AdjustmentList();
var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,
UrlPrefix + Uri.EscapeUriString(AccountCode) + "/adjustments/"
+ Build.QueryStringWith(Adjustment.AdjustmentState.Any == state ? "" : "state=" + state.ToString().EnumNameToTransportCase())
.AndWith(Adjustment.AdjustmentType.All == type ? "" : "type=" + type.ToString().EnumNameToTransportCase())
, adjustments.ReadXmlList);
return statusCode == HttpStatusCode.NotFound ? null : adjustments;
}
| 1
|
5
| -1
|
https://github.com/recurly/recurly-client-dotnet/commit/9eef460c0084afd5c24d66220c8b7a381cf9a1f1
| 1CS
|
this.request = function(options) {
var self = this,
o = this.options,
dfrd = $.Deferred(),
// request data
data = $.extend({}, o.customData, {mimes : o.onlyMimes}, options.data || options),
// command name
cmd = data.cmd,
// call default fail callback (display error dialog) ?
deffail = !(options.preventDefault || options.preventFail),
// call default success callback ?
defdone = !(options.preventDefault || options.preventDone),
// options for notify dialog
notify = $.extend({}, options.notify),
// do not normalize data - return as is
raw = !!options.raw,
// sync files on request fail
syncOnFail = options.syncOnFail,
// open notify dialog timeout
timeout,
// request options
options = $.extend({
url : o.url,
async : true,
type : this.requestType,
dataType : 'json',
cache : false,
// timeout : 100,
data : data
}, options.options || {}),
/**
* Default success handler.
* Call default data handlers and fire event with command name.
*
* @param Object normalized response data
* @return void
**/
done = function(data) {
data.warning && self.error(data.warning);
cmd == 'open' && open($.extend(true, {}, data));
// fire some event to update cache/ui
data.removed && data.removed.length && self.remove(data);
data.added && data.added.length && self.add(data);
data.changed && data.changed.length && self.change(data);
// fire event with command name
self.trigger(cmd, data);
// force update content
data.sync && self.sync();
},
/**
* Request error handler. Reject dfrd with correct error message.
*
* @param jqxhr request object
* @param String request status
* @return void
**/
error = function(xhr, status) {
var error;
switch (status) {
case 'abort':
error = xhr.quiet ? '' : ['errConnect', 'errAbort'];
break;
case 'timeout':
error = ['errConnect', 'errTimeout'];
break;
case 'parsererror':
error = ['errResponse', 'errDataNotJSON'];
break;
default:
if (xhr.status == 403) {
error = ['errConnect', 'errAccess'];
} else if (xhr.status == 404) {
error = ['errConnect', 'errNotFound'];
} else {
error = 'errConnect';
}
}
dfrd.reject(error, xhr, status);
},
/**
* Request success handler. Valid response data and reject/resolve dfrd.
*
* @param Object response data
* @param String request status
* @return void
**/
success = function(response) {
if (raw) {
return dfrd.resolve(response);
}
if (!response) {
return dfrd.reject(['errResponse', 'errDataEmpty'], xhr);
} else if (!$.isPlainObject(response)) {
return dfrd.reject(['errResponse', 'errDataNotJSON'], xhr);
} else if (response.error) {
return dfrd.reject(response.error, xhr);
} else if (!self.validResponse(cmd, response)) {
return dfrd.reject('errResponse', xhr);
}
response = self.normalize(response);
if (!self.api) {
self.api = response.api || 1;
self.newAPI = self.api >= 2;
self.oldAPI = !self.newAPI;
}
if (response.options) {
cwdOptions = $.extend({}, cwdOptions, response.options);
}
if (response.netDrivers) {
self.netDrivers = response.netDrivers;
}
dfrd.resolve(response);
response.debug && self.debug('backend-debug', response.debug);
},
xhr, _xhr
;
defdone && dfrd.done(done);
dfrd.fail(function(error) {
if (error) {
deffail ? self.error(error) : self.debug('error', self.i18n(error));
}
})
if (!cmd) {
return dfrd.reject('errCmdReq');
}
if (syncOnFail) {
dfrd.fail(function(error) {
error && self.sync();
});
}
if (notify.type && notify.cnt) {
timeout = setTimeout(function() {
self.notify(notify);
dfrd.always(function() {
notify.cnt = -(parseInt(notify.cnt)||0);
self.notify(notify);
})
}, self.notifyDelay)
dfrd.always(function() {
clearTimeout(timeout);
});
}
// quiet abort not completed "open" requests
if (cmd == 'open') {
while ((_xhr = queue.pop())) {
if (_xhr.state() == 'pending') {
_xhr.quiet = true;
_xhr.abort();
}
}
}
delete options.preventFail
xhr = this.transport.send(options).fail(error).done(success);
// this.transport.send(options)
// add "open" xhr into queue
if (cmd == 'open') {
queue.unshift(xhr);
dfrd.always(function() {
var ndx = $.inArray(xhr, queue);
ndx !== -1 && queue.splice(ndx, 1);
});
}
return dfrd;
};
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
explicit SparseReduceSparseOp(OpKernelConstruction *ctx) : OpKernel(ctx) {
OP_REQUIRES_OK(ctx, ctx->GetAttr("keep_dims", &keep_dims_));
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/87158f43f05f2720a374f3e6d22a7aaa3a33f750
| 0CCPP
|
notify_clients_deletion(struct lldpd_hardware *hardware,
struct lldpd_port *rport)
{
TRACE(LLDPD_NEIGHBOR_DELETE(hardware->h_ifname,
rport->p_chassis->c_name,
rport->p_descr));
levent_ctl_notify(hardware->h_ifname, NEIGHBOR_CHANGE_DELETED,
rport);
#ifdef USE_SNMP
agent_notify(hardware, NEIGHBOR_CHANGE_DELETED, rport);
#endif
}
| 0
| null | -1
|
https://github.com/lldpd/lldpd/commit/9221b5c249f9e4843f77c7f888d5705348d179c0
| 0CCPP
|
Graph.sanitizeHtml=function(b,e){return DOMPurify.sanitize(b,{ADD_ATTR:["target"],FORBID_TAGS:["form"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i})};Graph.sanitizeSvg=function(b){return DOMPurify.sanitize(b,{IN_PLACE:!0})};
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
def dataReceived(self, data: bytes) -> None:
self.stream.write(data)
self.length += len(data)
if self.max_size is not None and self.length >= self.max_size:
self.deferred.errback(
SynapseError(
502,
"Requested file is too large > %r bytes"
% (self.max_size,),
Codes.TOO_LARGE,
)
)
self.deferred = defer.Deferred()
self.transport.loseConnection()
| 1
|
4,5,6,8,9,10,11
| -1
|
https://github.com/matrix-org/synapse.git/commit/ff5c4da1289cb5e097902b3e55b771be342c29d6
| 4Python
|
MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entry;
} DirectoryInfo;
DirectoryInfo
directory_stack[MaxDirectoryStack];
EndianType
endian;
size_t
entry,
length,
number_entries;
ssize_t
id,
level,
offset;
static int
format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
unsigned char
*directory,
*exif;
length=GetStringInfoLength(profile);
exif=GetStringInfoDatum(profile);
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
if ((id != 0x4949) && (id != 0x4D4D))
{
while (length != 0)
{
if (ReadProfileByte(&exif,&length) != 0x45)
continue;
if (ReadProfileByte(&exif,&length) != 0x78)
continue;
if (ReadProfileByte(&exif,&length) != 0x69)
continue;
if (ReadProfileByte(&exif,&length) != 0x66)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
break;
}
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
}
endian=LSBEndian;
if (id == 0x4949)
endian=LSBEndian;
else
if (id == 0x4D4D)
endian=MSBEndian;
else
return(MagickFalse);
if (ReadProfileShort(endian,exif+2) != 0x002a)
return(MagickFalse);
offset=(ssize_t) ReadProfileLong(endian,exif+4);
if ((offset < 0) || (size_t) offset >= length)
return(MagickFalse);
directory=exif+offset;
level=0;
entry=0;
do
{
if (level > 0)
{
level--;
directory=directory_stack[level].directory;
entry=directory_stack[level].entry;
}
if ((directory < exif) || (directory > (exif+length-2)))
break;
number_entries=ReadProfileShort(endian,directory);
for ( ; entry < number_entries; entry++)
{
int
components;
register unsigned char
*p,
*q;
size_t
number_bytes;
ssize_t
format,
tag_value;
q=(unsigned char *) (directory+2+(12*entry));
if (q > (exif+length-12))
break;
tag_value=(ssize_t) ReadProfileShort(endian,q);
format=(ssize_t) ReadProfileShort(endian,q+2);
if ((format-1) >= EXIF_NUM_FORMATS)
break;
components=(ssize_t) ReadProfileLong(endian,q+4);
if (components < 0)
break;
number_bytes=(size_t) components*format_bytes[format];
if ((ssize_t) number_bytes < components)
break;
if (number_bytes <= 4)
p=q+8;
else
{
offset=(ssize_t) ReadProfileLong(endian,q+8);
if ((size_t) (offset+number_bytes) > length)
continue;
if (~length < number_bytes)
continue;
p=(unsigned char *) (exif+offset);
}
switch (tag_value)
{
case 0x011a:
{
(void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x011b:
{
(void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x0112:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) image->orientation,p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) image->orientation,
p);
break;
}
case 0x0128:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) (image->units+1),p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);
break;
}
default:
break;
}
if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))
{
offset=(ssize_t) ReadProfileLong(endian,p);
if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=directory;
entry++;
directory_stack[level].entry=entry;
level++;
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
if ((directory+2+(12*number_entries)) > (exif+length))
break;
offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*
number_entries));
if ((offset != 0) && ((size_t) offset < length) &&
(level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
}
}
break;
}
}
} while (level > 0);
return(MagickTrue);
}
| 1
|
102
| -1
|
https://github.com/ImageMagick/ImageMagick/commit/a7bb158b7bedd1449a34432feb3a67c8f1873bfa
| 0CCPP
|
lsquic_gquic_full_conn_srej (struct lsquic_conn *lconn)
{
struct full_conn *const conn = (struct full_conn *) lconn;
const unsigned cce_idx = lconn->cn_cur_cce_idx;
struct conn_cid_elem *const cce = &lconn->cn_cces[ cce_idx ];
struct lsquic_stream *stream;
enum lsquic_version version;
if (lconn->cn_esf_c->esf_is_sess_resume_enabled(conn->fc_conn.cn_enc_session))
{
LSQ_DEBUG("received SREJ when 0RTT was on: fail handshake and let "
"caller retry");
full_conn_ci_hsk_done(lconn, LSQ_HSK_RESUMED_FAIL);
return -1;
}
LSQ_DEBUG("reinitialize CID and other state due to SREJ");
if (cce->cce_hash_el.qhe_flags & QHE_HASHED)
{
lsquic_engine_retire_cid(conn->fc_enpub, lconn, cce_idx,
0 , 0);
lconn->cn_cces_mask |= 1 << cce_idx;
lsquic_generate_cid_gquic(&cce->cce_cid);
if (0 != lsquic_engine_add_cid(conn->fc_enpub, lconn, cce_idx))
return -1;
}
else
{
LSQ_DEBUG("not hashed by CID, no need to reinsert");
lsquic_generate_cid_gquic(&cce->cce_cid);
}
lconn->cn_esf.g->esf_reset_cid(lconn->cn_enc_session, &cce->cce_cid);
version = highest_bit_set(conn->fc_orig_versions);
init_ver_neg(conn, conn->fc_orig_versions, &version);
lsquic_rechist_cleanup(&conn->fc_rechist);
lsquic_rechist_init(&conn->fc_rechist, 0, MAX_ACK_RANGES);
lsquic_send_ctl_cleanup(&conn->fc_send_ctl);
lsquic_send_ctl_init(&conn->fc_send_ctl, &conn->fc_alset, conn->fc_enpub,
&conn->fc_ver_neg, &conn->fc_pub, 0);
stream = find_stream_by_id(conn, hsk_stream_id(conn));
if (!stream)
return -1;
stream->n_unacked = 0;
stream->tosend_off = 0;
stream->read_offset = 0;
stream->fc.sf_read_off = 0;
stream->fc.sf_max_recv_off = 0;
lsquic_alarmset_unset(&conn->fc_alset, AL_RETX_APP);
lsquic_alarmset_unset(&conn->fc_alset, AL_ACK_APP);
conn->fc_flags &= ~(FC_ACK_QUEUED|FC_ACK_HAD_MISS|FC_NSTP);
conn->fc_flags |= FC_GOT_SREJ;
return 0;
}
| 0
| null | -1
|
https://github.com/litespeedtech/lsquic/commit/a74702c630e108125e71898398737baec8f02238
| 0CCPP
|
static void exec_write_cb(struct bt_att_chan *chan, uint8_t opcode,
const void *pdu, uint16_t length,
void *user_data)
{
struct bt_gatt_server *server = user_data;
struct exec_data *data;
uint8_t flags;
uint8_t ecode;
bool write;
uint16_t ehandle = 0;
if (length != 1) {
ecode = BT_ATT_ERROR_INVALID_PDU;
goto error;
}
flags = ((uint8_t *) pdu)[0];
util_debug(server->debug_callback, server->debug_data,
"Exec Write Req - flags: 0x%02x", flags);
if (flags == 0x00)
write = false;
else if (flags == 0x01)
write = true;
else {
ecode = BT_ATT_ERROR_INVALID_PDU;
goto error;
}
if (!write) {
queue_remove_all(server->prep_queue, NULL, NULL,
prep_write_data_destroy);
bt_att_chan_send_rsp(chan, BT_ATT_OP_EXEC_WRITE_RSP, NULL, 0);
return;
}
if (queue_length(server->prep_queue) > 1) {
struct prep_write_data *prep_data;
prep_data = queue_find(server->prep_queue,
find_no_reliable_characteristic, NULL);
if (prep_data) {
ecode = BT_ATT_ERROR_REQUEST_NOT_SUPPORTED;
ehandle = prep_data->handle;
goto error;
}
}
data = new0(struct exec_data, 1);
data->chan = chan;
data->server = server;
exec_next_prep_write(data, 0, 0);
return;
error:
queue_remove_all(server->prep_queue, NULL, NULL,
prep_write_data_destroy);
bt_att_chan_send_error_rsp(chan, opcode, ehandle, ecode);
}
| 0
| null | -1
|
https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0
| 0CCPP
|
static void var_field_free(RAnalVarField *field) {
if (!field) {
return;
}
free (field->name);
free (field);
}
| 0
| null | -1
|
https://github.com/radareorg/radare2/commit/a7ce29647fcb38386d7439696375e16e093d6acb
| 0CCPP
|
static Jsi_RC WebSocketQueryCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
return WebSocketIdCmdOp(interp, args, _this, ret, funcPtr, 2);
}
| 0
| null | -1
|
https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18
| 0CCPP
|
ast2obj_comprehension(void* _o)
{
comprehension_ty o = (comprehension_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
Py_INCREF(Py_None);
return Py_None;
}
result = PyType_GenericNew(comprehension_type, NULL, NULL);
if (!result) return NULL;
value = ast2obj_expr(o->target);
if (!value) goto failed;
if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)
goto failed;
Py_DECREF(value);
value = ast2obj_expr(o->iter);
if (!value) goto failed;
if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)
goto failed;
Py_DECREF(value);
value = ast2obj_list(o->ifs, ast2obj_expr);
if (!value) goto failed;
if (_PyObject_SetAttrId(result, &PyId_ifs, value) == -1)
goto failed;
Py_DECREF(value);
value = ast2obj_int(o->is_async);
if (!value) goto failed;
if (_PyObject_SetAttrId(result, &PyId_is_async, value) == -1)
goto failed;
Py_DECREF(value);
return result;
failed:
Py_XDECREF(value);
Py_XDECREF(result);
return NULL;
}
| 1
|
5,6
| -1
|
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
| 0CCPP
|
private void SendNotAuthorized( HttpContext context )
{
context.Response.StatusCode = System.Net.HttpStatusCode.Forbidden.ConvertToInt();
context.Response.StatusDescription = "Not authorized to view person";
context.ApplicationInstance.CompleteRequest();
}
| 1
|
0,1,2,3,4,5
| -1
|
https://github.com/SparkDevNetwork/Rock/commit/576f5ec22b1c43f123a377612981c68538167c61
| 1CS
|
afterCallback: idTokenValidator(options.afterCallback, options.organization || config.organization)
});
};
| 1
|
0,1
| -1
|
https://github.com/auth0/nextjs-auth0/commit/e051d6abd1738d1ac614c7722bc2d1ad967c01a2
| 5TypeScript
|
mm_zfree(struct mm_master *mm, void *address)
{
mm_free(mm, address);
}
| 1
|
0,1,2,3
| -1
|
https://github.com/openbsd/src/commit/3095060f479b86288e31c79ecbc5131a66bcd2f9
| 0CCPP
|
urlParams.sketch&&1E3<=n||null!=urlParams.clibs||null!=urlParams.libs||null!=urlParams["search-shapes"])k(this,!0),null!=this.sidebar&&null!=urlParams["search-shapes"]&&null!=this.sidebar.searchShapes&&(this.sidebar.searchShapes(urlParams["search-shapes"]),this.sidebar.showEntries("search"));var U=this;mxWindow.prototype.fit=function(){if(Editor.inlineFullscreen||null==U.embedViewport)mxUtils.fit(this.div);else{var za=parseInt(this.div.offsetLeft),wa=parseInt(this.div.offsetWidth),Ea=U.embedViewport.x+
U.embedViewport.width,Da=parseInt(this.div.offsetTop),La=parseInt(this.div.offsetHeight),Ya=U.embedViewport.y+U.embedViewport.height;this.div.style.left=Math.max(U.embedViewport.x,Math.min(za,Ea-wa))+"px";this.div.style.top=Math.max(U.embedViewport.y,Math.min(Da,Ya-La))+"px";this.div.style.height=Math.min(U.embedViewport.height,parseInt(this.div.style.height))+"px";this.div.style.width=Math.min(U.embedViewport.width,parseInt(this.div.style.width))+"px"}};this.keyHandler.bindAction(75,!0,"toggleShapes",
| 1
|
1
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
renamestates(int xx_nstates, ss_state *xx_state, int from, int to)
{
int i, j;
if (Py_DebugFlag)
printf("Rename state %d to %d.\n", from, to);
for (i = 0; i < xx_nstates; i++) {
if (xx_state[i].ss_deleted)
continue;
for (j = 0; j < xx_state[i].ss_narcs; j++) {
if (xx_state[i].ss_arc[j].sa_arrow == from)
xx_state[i].ss_arc[j].sa_arrow = to;
}
}
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13
| -1
|
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
| 0CCPP
|
int bcf_hdr_write(htsFile *hfp, bcf_hdr_t *h)
{
if (!h) {
errno = EINVAL;
return -1;
}
if ( h->dirty ) {
if (bcf_hdr_sync(h) < 0) return -1;
}
hfp->format.category = variant_data;
if (hfp->format.format == vcf || hfp->format.format == text_format) {
hfp->format.format = vcf;
return vcf_hdr_write(hfp, h);
}
if (hfp->format.format == binary_format)
hfp->format.format = bcf;
kstring_t htxt = {0,0,0};
bcf_hdr_format(h, 1, &htxt);
kputc('\0', &htxt);
BGZF *fp = hfp->fp.bgzf;
if ( bgzf_write(fp, "BCF\2\2", 5) !=5 ) return -1;
uint8_t hlen[4];
u32_to_le(htxt.l, hlen);
if ( bgzf_write(fp, hlen, 4) !=4 ) return -1;
if ( bgzf_write(fp, htxt.s, htxt.l) != htxt.l ) return -1;
free(htxt.s);
return 0;
}
| 0
| null | -1
|
https://github.com/samtools/htslib/commit/dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c
| 0CCPP
|
ast_for_dotted_name(struct compiling *c, const node *n)
{
expr_ty e;
identifier id;
int lineno, col_offset;
int i;
REQ(n, dotted_name);
lineno = LINENO(n);
col_offset = n->n_col_offset;
id = NEW_IDENTIFIER(CHILD(n, 0));
if (!id)
return NULL;
e = Name(id, Load, lineno, col_offset, c->c_arena);
if (!e)
return NULL;
for (i = 2; i < NCH(n); i+=2) {
id = NEW_IDENTIFIER(CHILD(n, i));
if (!id)
return NULL;
e = Attribute(e, id, Load, lineno, col_offset, c->c_arena);
if (!e)
return NULL;
}
return e;
}
| 0
| null | -1
|
https://github.com/python/typed_ast/commit/dc317ac9cff859aa84eeabe03fb5004982545b3b
| 0CCPP
|
public void ProcessRequest (HttpContext context)
{
HttpRequest req = context != null ? context.Request : null;
string path = req != null ? req.Path : null;
string description = "The type of page you have requested is not served because it has been explicitly forbidden. The extension '" +
(path == null ? String.Empty : VirtualPathUtility.GetExtension (path)) +
"' may be incorrect. Please review the URL below and make sure that it is spelled correctly.";
throw new HttpException (403,
"This type of page is not served.",
req != null ? req.Path : null,
description);
}
| 1
|
9
| -1
|
https://github.com/mono/mono/commit/d16d4623edb210635bec3ca3786481b82cde25a2
| 1CS
|
void ping_unhash(struct sock *sk)
{
struct inet_sock *isk = inet_sk(sk);
pr_debug("ping_unhash(isk=%p,isk->num=%u)\n", isk, isk->inet_num);
if (sk_hashed(sk)) {
write_lock_bh(&ping_table.lock);
hlist_nulls_del(&sk->sk_nulls_node);
sk_nulls_node_init(&sk->sk_nulls_node);
sock_put(sk);
isk->inet_num = 0;
isk->inet_sport = 0;
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
write_unlock_bh(&ping_table.lock);
}
}
| 1
|
5,12
| -1
|
https://github.com/torvalds/linux/commit/43a6684519ab0a6c52024b5e25322476cabad893
| 0CCPP
|
static MagickPixelPacket **AcquirePixelThreadSet(const Image *images)
{
const Image
*next;
MagickPixelPacket
**pixels;
register ssize_t
i,
j;
size_t
columns,
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(MagickPixelPacket **) AcquireQuantumMemory(number_threads,
sizeof(*pixels));
if (pixels == (MagickPixelPacket **) NULL)
return((MagickPixelPacket **) NULL);
(void) memset(pixels,0,number_threads*sizeof(*pixels));
columns=images->columns;
for (next=images; next != (Image *) NULL; next=next->next)
columns=MagickMax(next->columns,columns);
for (i=0; i < (ssize_t) number_threads; i++)
{
pixels[i]=(MagickPixelPacket *) AcquireQuantumMemory(columns,
sizeof(**pixels));
if (pixels[i] == (MagickPixelPacket *) NULL)
return(DestroyPixelThreadSet(pixels));
for (j=0; j < (ssize_t) columns; j++)
GetMagickPixelPacket(images,&pixels[i][j]);
}
return(pixels);
}
| 1
|
11,12,13,14,17,21
| -1
|
https://github.com/ImageMagick/ImageMagick6/commit/91e58d967a92250439ede038ccfb0913a81e59fe
| 0CCPP
|
XMLNode::attribute_value()
{
XMLNodeList children = this->children();
if (_is_content)
throw XMLException("XMLNode: attribute_value failed (is_content) for requested node: " + name());
if (children.size() != 1)
throw XMLException("XMLNode: attribute_value failed (children.size != 1) for requested node: " + name());
XMLNode* child = *(children.begin());
if (!child->is_content())
throw XMLException("XMLNode: attribute_value failed (!child->is_content()) for requested node: " + name());
return child->content();
}
| 0
| null | -1
|
https://github.com/Ardour/ardour/commit/96daa4036a425ff3f23a7dfcba57bfb0f942bec6
| 0CCPP
|
static inline void fib6_walker_link(struct fib6_walker_t *w)
{
write_lock_bh(&fib6_walker_lock);
list_add(&w->lh, &fib6_walkers);
write_unlock_bh(&fib6_walker_lock);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/ae7b4e1f213aa659aedf9c6ecad0bf5f0476e1e2
| 0CCPP
|
gplotCreate(const char *rootname,
l_int32 outformat,
const char *title,
const char *xlabel,
const char *ylabel)
{
char *newroot;
char buf[L_BUF_SIZE];
l_int32 badchar;
GPLOT *gplot;
PROCNAME("gplotCreate");
if (!rootname)
return (GPLOT *)ERROR_PTR("rootname not defined", procName, NULL);
if (outformat != GPLOT_PNG && outformat != GPLOT_PS &&
outformat != GPLOT_EPS && outformat != GPLOT_LATEX)
return (GPLOT *)ERROR_PTR("outformat invalid", procName, NULL);
stringCheckForChars(rootname, "`;&|><\"?*", &badchar);
if (badchar)
return (GPLOT *)ERROR_PTR("invalid rootname", procName, NULL);
if ((gplot = (GPLOT *)LEPT_CALLOC(1, sizeof(GPLOT))) == NULL)
return (GPLOT *)ERROR_PTR("gplot not made", procName, NULL);
gplot->cmddata = sarrayCreate(0);
gplot->datanames = sarrayCreate(0);
gplot->plotdata = sarrayCreate(0);
gplot->plottitles = sarrayCreate(0);
gplot->plotstyles = numaCreate(0);
newroot = genPathname(rootname, NULL);
gplot->rootname = newroot;
gplot->outformat = outformat;
snprintf(buf, L_BUF_SIZE, "%s.cmd", rootname);
gplot->cmdname = stringNew(buf);
if (outformat == GPLOT_PNG)
snprintf(buf, L_BUF_SIZE, "%s.png", newroot);
else if (outformat == GPLOT_PS)
snprintf(buf, L_BUF_SIZE, "%s.ps", newroot);
else if (outformat == GPLOT_EPS)
snprintf(buf, L_BUF_SIZE, "%s.eps", newroot);
else if (outformat == GPLOT_LATEX)
snprintf(buf, L_BUF_SIZE, "%s.tex", newroot);
gplot->outname = stringNew(buf);
if (title) gplot->title = stringNew(title);
if (xlabel) gplot->xlabel = stringNew(xlabel);
if (ylabel) gplot->ylabel = stringNew(ylabel);
return gplot;
}
| 1
|
7,29,32,34,36,38
| -1
|
https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a
| 0CCPP
|
static int cenc_filter(MOVContext *c, MOVStreamContext *sc, int64_t index, uint8_t *input, int size)
{
uint32_t encrypted_bytes;
uint16_t subsample_count;
uint16_t clear_bytes;
uint8_t* input_end = input + size;
int ret;
if (index != sc->cenc.auxiliary_info_index) {
ret = mov_seek_auxiliary_info(c, sc, index);
if (ret < 0) {
return ret;
}
}
if (AES_CTR_IV_SIZE > sc->cenc.auxiliary_info_end - sc->cenc.auxiliary_info_pos) {
av_log(c->fc, AV_LOG_ERROR, "failed to read iv from the auxiliary info\n");
return AVERROR_INVALIDDATA;
}
av_aes_ctr_set_iv(sc->cenc.aes_ctr, sc->cenc.auxiliary_info_pos);
sc->cenc.auxiliary_info_pos += AES_CTR_IV_SIZE;
if (!sc->cenc.use_subsamples)
{
av_aes_ctr_crypt(sc->cenc.aes_ctr, input, input, size);
return 0;
}
if (sizeof(uint16_t) > sc->cenc.auxiliary_info_end - sc->cenc.auxiliary_info_pos) {
av_log(c->fc, AV_LOG_ERROR, "failed to read subsample count from the auxiliary info\n");
return AVERROR_INVALIDDATA;
}
subsample_count = AV_RB16(sc->cenc.auxiliary_info_pos);
sc->cenc.auxiliary_info_pos += sizeof(uint16_t);
for (; subsample_count > 0; subsample_count--)
{
if (6 > sc->cenc.auxiliary_info_end - sc->cenc.auxiliary_info_pos) {
av_log(c->fc, AV_LOG_ERROR, "failed to read subsample from the auxiliary info\n");
return AVERROR_INVALIDDATA;
}
clear_bytes = AV_RB16(sc->cenc.auxiliary_info_pos);
sc->cenc.auxiliary_info_pos += sizeof(uint16_t);
encrypted_bytes = AV_RB32(sc->cenc.auxiliary_info_pos);
sc->cenc.auxiliary_info_pos += sizeof(uint32_t);
if ((uint64_t)clear_bytes + encrypted_bytes > input_end - input) {
av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
return AVERROR_INVALIDDATA;
}
input += clear_bytes;
av_aes_ctr_crypt(sc->cenc.aes_ctr, input, input, encrypted_bytes);
input += encrypted_bytes;
}
if (input < input_end) {
av_log(c->fc, AV_LOG_ERROR, "leftover packet bytes after subsample processing\n");
return AVERROR_INVALIDDATA;
}
sc->cenc.auxiliary_info_index++;
return 0;
}
| 0
| null | -1
|
https://github.com/FFmpeg/FFmpeg/commit/9cb4eb772839c5e1de2855d126bf74ff16d13382
| 0CCPP
|
IOBuf::IOBuf(
TakeOwnershipOp,
void* buf,
std::size_t capacity,
std::size_t offset,
std::size_t length,
FreeFunction freeFn,
void* userData,
bool freeOnError)
: next_(this),
prev_(this),
data_(static_cast<uint8_t*>(buf) + offset),
buf_(static_cast<uint8_t*>(buf)),
length_(length),
capacity_(capacity),
flagsAndSharedInfo_(
packFlagsAndSharedInfo(kFlagFreeSharedInfo, nullptr)) {
DCHECK(!userData || (userData && freeFn));
auto rollback = makeGuard([&] {
takeOwnershipError(freeOnError, buf, freeFn, userData);
});
setSharedInfo(new SharedInfo(freeFn, userData));
rollback.dismiss();
}
| 0
| null | -1
|
https://github.com/facebook/folly/commit/4f304af1411e68851bdd00ef6140e9de4616f7d3
| 0CCPP
|
int sqlite3WindowRewrite(Parse *pParse, Select *p){
int rc = SQLITE_OK;
if( p->pWin && p->pPrior==0 && (p->selFlags & SF_WinRewrite)==0 ){
Vdbe *v = sqlite3GetVdbe(pParse);
sqlite3 *db = pParse->db;
Select *pSub = 0;
SrcList *pSrc = p->pSrc;
Expr *pWhere = p->pWhere;
ExprList *pGroupBy = p->pGroupBy;
Expr *pHaving = p->pHaving;
ExprList *pSort = 0;
ExprList *pSublist = 0;
Window *pMWin = p->pWin;
Window *pWin;
Table *pTab;
pTab = sqlite3DbMallocZero(db, sizeof(Table));
if( pTab==0 ){
return sqlite3ErrorToParser(db, SQLITE_NOMEM);
}
p->pSrc = 0;
p->pWhere = 0;
p->pGroupBy = 0;
p->pHaving = 0;
p->selFlags &= ~SF_Aggregate;
p->selFlags |= SF_WinRewrite;
pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0);
pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy, 1);
if( pSort && p->pOrderBy && p->pOrderBy->nExpr<=pSort->nExpr ){
int nSave = pSort->nExpr;
pSort->nExpr = p->pOrderBy->nExpr;
if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){
sqlite3ExprListDelete(db, p->pOrderBy);
p->pOrderBy = 0;
}
pSort->nExpr = nSave;
}
pMWin->iEphCsr = pParse->nTab++;
pParse->nTab += 3;
selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist);
selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist);
pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0);
pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition, 0);
pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy, 0);
for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
ExprList *pArgs = pWin->pOwner->x.pList;
if( pWin->pFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
pWin->bExprArgs = 1;
}else{
pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
pSublist = exprListAppendList(pParse, pSublist, pArgs, 0);
}
if( pWin->pFilter ){
Expr *pFilter = sqlite3ExprDup(db, pWin->pFilter, 0);
pSublist = sqlite3ExprListAppend(pParse, pSublist, pFilter);
}
pWin->regAccum = ++pParse->nMem;
pWin->regResult = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
}
if( pSublist==0 ){
pSublist = sqlite3ExprListAppend(pParse, 0,
sqlite3Expr(db, TK_INTEGER, "0")
);
}
pSub = sqlite3SelectNew(
pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
);
p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
if( p->pSrc ){
Table *pTab2;
p->pSrc->a[0].pSelect = pSub;
sqlite3SrcListAssignCursors(pParse, p->pSrc);
pSub->selFlags |= SF_Expanded;
pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE);
if( pTab2==0 ){
rc = SQLITE_NOMEM;
}else{
memcpy(pTab, pTab2, sizeof(Table));
pTab->tabFlags |= TF_Ephemeral;
p->pSrc->a[0].pTab = pTab;
pTab = pTab2;
}
sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr);
sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr);
sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr);
sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr);
}else{
sqlite3SelectDelete(db, pSub);
}
if( db->mallocFailed ) rc = SQLITE_NOMEM;
sqlite3DbFree(db, pTab);
}
if( rc && pParse->nErr==0 ){
assert( pParse->db->mallocFailed );
return sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM);
}
return rc;
}
| 0
| null | -1
|
https://github.com/sqlite/sqlite/commit/8654186b0236d556aa85528c2573ee0b6ab71be3
| 0CCPP
|
BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile)
{
gdIOCtx *out = gdNewFileCtx(outFile);
if (out == NULL) {
return;
}
_gdImageWebpCtx(im, out, -1);
out->gd_free(out);
}
| 0
| null | -1
|
https://github.com/libgd/libgd/commit/a49feeae76d41959d85ee733925a4cf40bac61b2
| 0CCPP
|
static ssize_t disk_capability_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct gendisk *disk = dev_to_disk(dev);
return sprintf(buf, "%x\n", disk->flags);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/77da160530dd1dc94f6ae15a981f24e5f0021e84
| 0CCPP
|
module.exports = function killport(port) {
return (new Promise(function(resolve, reject) {
var cmd = 'lsof -i:' + port;
cp.exec(cmd, function(err, stdout, stderr){
if (stderr) return reject(stderr);
var lines = String(stdout).split('\n').filter(notEmpty);
var pids = lines.map(function(line){
var blocks = line.split(/\s+/);
if (blocks[1] && +blocks[1]) {
return +blocks[1];
}
return null;
}).filter(notEmpty);
if (!pids.length) {
return resolve('no pids found');
}
var infs = [];
return async.each(pids, function(pid, next) {
console.log('kill ' + pid);
cp.exec('kill ' + pid, function (err, stdout, stderr) {
infs.push({
pid: pid,
err: err,
stderr: stderr,
stdout: stdout
});
next();
});
}, function(err) {
resolve(infs);
});
});
}))
};
| 1
| null | -1
|
https://github.com/ssnau/killport/commit/bec8e371f170a12e11cd222ffc7a6e1ae9942638
| 3JavaScript
|
static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm,
unsigned char *name, int maxlen, int term_only)
{
struct iterm_name_combo *names;
if (iterm->name)
return snd_usb_copy_string_desc(state, iterm->name,
name, maxlen);
if (iterm->type >> 16) {
if (term_only)
return 0;
switch (iterm->type >> 16) {
case UAC_SELECTOR_UNIT:
strcpy(name, "Selector");
return 8;
case UAC1_PROCESSING_UNIT:
strcpy(name, "Process Unit");
return 12;
case UAC1_EXTENSION_UNIT:
strcpy(name, "Ext Unit");
return 8;
case UAC_MIXER_UNIT:
strcpy(name, "Mixer");
return 5;
default:
return sprintf(name, "Unit %d", iterm->id);
}
}
switch (iterm->type & 0xff00) {
case 0x0100:
strcpy(name, "PCM");
return 3;
case 0x0200:
strcpy(name, "Mic");
return 3;
case 0x0400:
strcpy(name, "Headset");
return 7;
case 0x0500:
strcpy(name, "Phone");
return 5;
}
for (names = iterm_names; names->type; names++) {
if (names->type == iterm->type) {
strcpy(name, names->name);
return strlen(names->name);
}
}
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/124751d5e63c823092060074bd0abaae61aaa9c4
| 0CCPP
|
static int hidp_setup_hid(struct hidp_session *session,
struct hidp_connadd_req *req)
{
struct hid_device *hid;
int err;
session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
if (!session->rd_data)
return -ENOMEM;
if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) {
err = -EFAULT;
goto fault;
}
session->rd_size = req->rd_size;
hid = hid_allocate_device();
if (IS_ERR(hid)) {
err = PTR_ERR(hid);
goto fault;
}
session->hid = hid;
hid->driver_data = session;
hid->bus = BUS_BLUETOOTH;
hid->vendor = req->vendor;
hid->product = req->product;
hid->version = req->version;
hid->country = req->country;
strncpy(hid->name, req->name, 128);
snprintf(hid->phys, sizeof(hid->phys), "%pMR",
&bt_sk(session->ctrl_sock->sk)->src);
snprintf(hid->uniq, sizeof(hid->uniq), "%pMR",
&bt_sk(session->ctrl_sock->sk)->dst);
hid->dev.parent = &session->conn->dev;
hid->ll_driver = &hidp_hid_driver;
hid->hid_get_raw_report = hidp_get_raw_report;
hid->hid_output_raw_report = hidp_output_raw_report;
if (hid_ignore(hid)) {
hid_destroy_device(session->hid);
session->hid = NULL;
return -ENODEV;
}
return 0;
fault:
kfree(session->rd_data);
session->rd_data = NULL;
return err;
}
| 1
|
25
| -1
|
https://github.com/torvalds/linux/commit/0a9ab9bdb3e891762553f667066190c1d22ad62b
| 0CCPP
|
static void rpc_release_resources_task(struct rpc_task *task)
{
if (task->tk_rqstp)
xprt_release(task);
if (task->tk_msg.rpc_cred) {
put_rpccred(task->tk_msg.rpc_cred);
task->tk_msg.rpc_cred = NULL;
}
rpc_task_release_client(task);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/0b760113a3a155269a3fba93a409c640031dd68f
| 0CCPP
|
int git_path_validate_system_file_ownership(const char *path)
{
#ifndef GIT_WIN32
GIT_UNUSED(path);
return GIT_OK;
#else
git_win32_path buf;
PSID owner_sid;
PSECURITY_DESCRIPTOR descriptor = NULL;
HANDLE token;
TOKEN_USER *info = NULL;
DWORD err, len;
int ret;
if (git_win32_path_from_utf8(buf, path) < 0)
return -1;
err = GetNamedSecurityInfoW(buf, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION,
&owner_sid, NULL, NULL, NULL, &descriptor);
if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) {
ret = GIT_ENOTFOUND;
goto cleanup;
}
if (err != ERROR_SUCCESS) {
git_error_set(GIT_ERROR_OS, "failed to get security information");
ret = GIT_ERROR;
goto cleanup;
}
if (!IsValidSid(owner_sid)) {
git_error_set(GIT_ERROR_INVALID, "programdata configuration file owner is unknown");
ret = GIT_ERROR;
goto cleanup;
}
if (IsWellKnownSid(owner_sid, WinBuiltinAdministratorsSid) ||
IsWellKnownSid(owner_sid, WinLocalSystemSid)) {
ret = GIT_OK;
goto cleanup;
}
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token) &&
!GetTokenInformation(token, TokenUser, NULL, 0, &len)) {
info = git__malloc(len);
GIT_ERROR_CHECK_ALLOC(info);
if (!GetTokenInformation(token, TokenUser, info, len, &len)) {
git__free(info);
info = NULL;
}
}
if (info && EqualSid(owner_sid, info->User.Sid))
ret = GIT_OK;
else {
git_error_set(GIT_ERROR_INVALID, "programdata configuration file owner is not valid");
ret = GIT_ERROR;
}
free(info);
cleanup:
if (descriptor)
LocalFree(descriptor);
return ret;
#endif
}
| 0
| null | -1
|
https://github.com/libgit2/libgit2/commit/e1832eb20a7089f6383cfce474f213157f5300cb
| 0CCPP
|
static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
{
int this_cpu = this_rq->cpu;
unsigned int flags;
if (!(atomic_read(nohz_flags(this_cpu)) & NOHZ_KICK_MASK))
return false;
if (idle != CPU_IDLE) {
atomic_andnot(NOHZ_KICK_MASK, nohz_flags(this_cpu));
return false;
}
flags = atomic_fetch_andnot(NOHZ_KICK_MASK, nohz_flags(this_cpu));
if (!(flags & NOHZ_KICK_MASK))
return false;
_nohz_idle_balance(this_rq, flags, idle);
return true;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/c40f7d74c741a907cfaeb73a7697081881c497d0
| 0CCPP
|
const char *MACH0_(get_cputype)(struct MACH0_(obj_t) *bin) {
return bin? MACH0_(get_cputype_from_hdr) (&bin->hdr): "unknown";
}
| 0
| null | -1
|
https://github.com/radareorg/radare2/commit/0052500c1ed5bf8263b26b9fd7773dbdc6f170c4
| 0CCPP
|
Variant HHVM_FUNCTION(mcrypt_generic_init, const Resource& td,
const String& key,
const String& iv) {
auto pm = get_valid_mcrypt_resource(td);
if (!pm) {
return false;
}
int max_key_size = mcrypt_enc_get_key_size(pm->m_td);
int iv_size = mcrypt_enc_get_iv_size(pm->m_td);
if (key.empty()) {
raise_warning("Key size is 0");
}
unsigned char *key_s = (unsigned char *)malloc(key.size());
memset(key_s, 0, key.size());
unsigned char *iv_s = (unsigned char *)malloc(iv_size + 1);
memset(iv_s, 0, iv_size + 1);
int key_size;
if (key.size() > max_key_size) {
raise_warning("Key size too large; supplied length: %d, max: %d",
key.size(), max_key_size);
key_size = max_key_size;
} else {
key_size = key.size();
}
memcpy(key_s, key.data(), key.size());
if (iv.size() != iv_size) {
raise_warning("Iv size incorrect; supplied length: %d, needed: %d",
iv.size(), iv_size);
}
memcpy(iv_s, iv.data(), std::min(iv_size, iv.size()));
mcrypt_generic_deinit(pm->m_td);
int result = mcrypt_generic_init(pm->m_td, key_s, key_size, iv_s);
if (result < 0) {
pm->close();
switch (result) {
case -3:
raise_warning("Key length incorrect");
break;
case -4:
raise_warning("Memory allocation error");
break;
case -1:
default:
raise_warning("Unknown error");
break;
}
} else {
pm->m_init = true;
}
free(iv_s);
free(key_s);
return result;
}
| 1
|
18,26,29
| -1
|
https://github.com/facebook/hhvm/commit/08193b7f0cd3910256e00d599f0f3eb2519c44ca
| 0CCPP
|
def update(self, **kwargs):
consumer_id = load_consumer_id(self.context)
if not consumer_id:
self.prompt.render_failure_message(
"This consumer is not registered to the Pulp server."
)
return
delta = dict([(k, v) for k, v in kwargs.items() if v is not None])
if "note" in delta.keys():
if delta["note"]:
delta["notes"] = args_to_notes_dict(kwargs["note"], include_none=False)
delta.pop("note")
key = "display-name"
if key in delta:
v = delta.pop(key)
key = key.replace("-", "_")
delta[key] = v
if kwargs.get(OPTION_EXCHANGE_KEYS.keyword):
path = self.context.config["authentication"]["rsa_pub"]
fp = open(path)
try:
delta["rsa_pub"] = fp.read()
finally:
fp.close()
try:
self.context.server.consumer.update(consumer_id, delta)
self.prompt.render_success_message(
"Consumer [%s] successfully updated" % consumer_id
)
if not kwargs.get(OPTION_EXCHANGE_KEYS.keyword):
return
try:
update_server_key(self.context.config)
except Exception, e:
msg = _(
"Download server RSA key failed [%(e)s]" % {"e": e}
)
self.prompt.render_failure_message(msg)
except NotFoundException:
self.prompt.write(
"Consumer [%s] does not exist on the server" % consumer_id, tag="not-found"
)
| 1
|
31,32,33,36,37
| -1
|
https://github.com/pulp/pulp.git/commit/b542d7465f7e6e02e1ea1aec059ac607a65cefe7
| 4Python
|
virtual void SetLength(size_t l) { m_total = l; }
| 0
| null | -1
|
https://github.com/vslavik/winsparkle/commit/bb454857348245a7397f9e4fbb3a902f4ac25913
| 0CCPP
|
int update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush, UINT16* flags)
{
return 64;
}
| 0
| null | -1
|
https://github.com/FreeRDP/FreeRDP/commit/e7bffa64ef5ed70bac94f823e2b95262642f5296
| 0CCPP
|
def instance_type_extra_specs_get_item(context, instance_type_id, key, session=None):
result = (
_instance_type_extra_specs_get_query(context, instance_type_id, session=session)
.filter_by(key=key)
.first()
)
if not result:
raise exception.InstanceTypeExtraSpecsNotFound(
extra_specs_key=key, instance_type_id=instance_type_id
)
return result
| 0
| null | -1
|
https://github.com/openstack/nova.git/commit/1f644d210557b1254f7c7b39424b09a45329ade7
| 4Python
|
static int64_t MakeInt(PyObject* integer) {
#if PY_MAJOR_VERSION >= 3
return PyLong_AsLong(integer);
#else
return PyInt_AsLong(integer);
#endif
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/237822b59fc504dda2c564787f5d3ad9c4aa62d9
| 0CCPP
|
(req, reply) => Promise.all(validators(req)).catch(err => reply.code(400).send(err))
const formatMultipartData = (arrayTypeKeys: [string, boolean][]): preValidationHookHandler => (req, _, done) => {
| 0
| null | -1
|
https://github.com/frouriojs/frourio/commit/7c19ac5363305b81b1c6b5232620228763d427af
| 5TypeScript
|
void sqlite3EndTable(
Parse *pParse,
Token *pCons,
Token *pEnd,
u8 tabOpts,
Select *pSelect
){
Table *p;
sqlite3 *db = pParse->db;
int iDb;
Index *pIdx;
if( pEnd==0 && pSelect==0 ){
return;
}
assert( !db->mallocFailed );
p = pParse->pNewTable;
if( p==0 ) return;
if( pSelect==0 && isShadowTableName(db, p->zName) ){
p->tabFlags |= TF_Shadow;
}
if( db->init.busy ){
if( pSelect ){
sqlite3ErrorMsg(pParse, "");
return;
}
p->tnum = db->init.newTnum;
if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
}
assert( (p->tabFlags & TF_HasPrimaryKey)==0
|| p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 );
assert( (p->tabFlags & TF_HasPrimaryKey)!=0
|| (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) );
if( tabOpts & TF_WithoutRowid ){
if( (p->tabFlags & TF_Autoincrement) ){
sqlite3ErrorMsg(pParse,
"AUTOINCREMENT not allowed on WITHOUT ROWID tables");
return;
}
if( (p->tabFlags & TF_HasPrimaryKey)==0 ){
sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName);
return;
}
p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid;
convertToWithoutRowidTable(pParse, p);
}
iDb = sqlite3SchemaToIndex(db, p->pSchema);
#ifndef SQLITE_OMIT_CHECK
if( p->pCheck ){
sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck);
}
#endif
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
if( p->tabFlags & TF_HasGenerated ){
int ii, nNG = 0;
testcase( p->tabFlags & TF_HasVirtual );
testcase( p->tabFlags & TF_HasStored );
for(ii=0; ii<p->nCol; ii++){
u32 colFlags = p->aCol[ii].colFlags;
if( (colFlags & COLFLAG_GENERATED)!=0 ){
testcase( colFlags & COLFLAG_VIRTUAL );
testcase( colFlags & COLFLAG_STORED );
sqlite3ResolveSelfReference(pParse, p, NC_GenCol,
p->aCol[ii].pDflt, 0);
}else{
nNG++;
}
}
if( nNG==0 ){
sqlite3ErrorMsg(pParse, "must have at least one non-generated column");
return;
}
}
#endif
estimateTableWidth(p);
for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
estimateIndexWidth(pIdx);
}
if( !db->init.busy ){
int n;
Vdbe *v;
char *zType;
char *zType2;
char *zStmt;
v = sqlite3GetVdbe(pParse);
if( NEVER(v==0) ) return;
sqlite3VdbeAddOp1(v, OP_Close, 0);
if( p->pSelect==0 ){
zType = "table";
zType2 = "TABLE";
#ifndef SQLITE_OMIT_VIEW
}else{
zType = "view";
zType2 = "VIEW";
#endif
}
if( pSelect ){
SelectDest dest;
int regYield;
int addrTop;
int regRec;
int regRowid;
int addrInsLoop;
Table *pSelTab;
regYield = ++pParse->nMem;
regRec = ++pParse->nMem;
regRowid = ++pParse->nMem;
assert(pParse->nTab==1);
sqlite3MayAbort(pParse);
sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);
sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);
pParse->nTab = 2;
addrTop = sqlite3VdbeCurrentAddr(v) + 1;
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
if( pParse->nErr ) return;
pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB);
if( pSelTab==0 ) return;
assert( p->aCol==0 );
p->nCol = p->nNVCol = pSelTab->nCol;
p->aCol = pSelTab->aCol;
pSelTab->nCol = 0;
pSelTab->aCol = 0;
sqlite3DeleteTable(db, pSelTab);
sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);
sqlite3Select(pParse, pSelect, &dest);
if( pParse->nErr ) return;
sqlite3VdbeEndCoroutine(v, regYield);
sqlite3VdbeJumpHere(v, addrTop - 1);
addrInsLoop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm);
VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec);
sqlite3TableAffinity(v, p, 0);
sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid);
sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid);
sqlite3VdbeGoto(v, addrInsLoop);
sqlite3VdbeJumpHere(v, addrInsLoop);
sqlite3VdbeAddOp1(v, OP_Close, 1);
}
if( pSelect ){
zStmt = createTableStmt(db, p);
}else{
Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd;
n = (int)(pEnd2->z - pParse->sNameToken.z);
if( pEnd2->z[0]!=';' ) n += pEnd2->n;
zStmt = sqlite3MPrintf(db,
"CREATE %s %.*s", zType2, n, pParse->sNameToken.z
);
}
sqlite3NestedParse(pParse,
"UPDATE %Q.%s "
"SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q "
"WHERE rowid=#%d",
db->aDb[iDb].zDbSName, MASTER_NAME,
zType,
p->zName,
p->zName,
pParse->regRoot,
zStmt,
pParse->regRowid
);
sqlite3DbFree(db, zStmt);
sqlite3ChangeCookie(pParse, iDb);
#ifndef SQLITE_OMIT_AUTOINCREMENT
if( (p->tabFlags & TF_Autoincrement)!=0 ){
Db *pDb = &db->aDb[iDb];
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
if( pDb->pSchema->pSeqTab==0 ){
sqlite3NestedParse(pParse,
"CREATE TABLE %Q.sqlite_sequence(name,seq)",
pDb->zDbSName
);
}
}
#endif
sqlite3VdbeAddParseSchemaOp(v, iDb,
sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
}
if( db->init.busy ){
Table *pOld;
Schema *pSchema = p->pSchema;
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
if( pOld ){
assert( p==pOld );
sqlite3OomFault(db);
return;
}
pParse->pNewTable = 0;
db->mDbFlags |= DBFLAG_SchemaChange;
#ifndef SQLITE_OMIT_ALTERTABLE
if( !p->pSelect ){
const char *zName = (const char *)pParse->sNameToken.z;
int nName;
assert( !pSelect && pCons && pEnd );
if( pCons->z==0 ){
pCons = pEnd;
}
nName = (int)((const char *)pCons->z - zName);
p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
}
#endif
}
}
| 1
|
17
| -1
|
https://github.com/sqlite/sqlite/commit/527cbd4a104cb93bf3994b3dd3619a6299a78b13
| 0CCPP
|
def call(__self, __context, __obj, *args, **kwargs):
if not __self.is_safe_callable(__obj):
raise SecurityError("%r is not safely callable" % (__obj,))
return __context.call(__obj, *args, **kwargs)
| 1
| null | -1
|
https://github.com/pallets/jinja.git/commit/9b53045c34e61013dc8f09b7e52a555fa16bed16
| 4Python
|
void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){
if( p ){
struct SrcList_item *pItem = &p->a[p->nSrc-1];
assert( pItem->fg.notIndexed==0 );
assert( pItem->fg.isIndexedBy==0 );
assert( pItem->fg.isTabFunc==0 );
pItem->u1.pFuncArg = pList;
pItem->fg.isTabFunc = 1;
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
}
| 0
| null | -1
|
https://github.com/sqlite/sqlite/commit/38096961c7cd109110ac21d3ed7dad7e0cb0ae06
| 0CCPP
|
static void tcfullsanitycheck(threadcache *tc) THROWSPEC
{
threadcacheblk **tcbptr=tc->bins;
int n;
for(n=0; n<=THREADCACHEMAXBINS; n++, tcbptr+=2)
{
threadcacheblk *b, *ob=0;
tcsanitycheck(tcbptr);
for(b=tcbptr[0]; b; ob=b, b=b->next)
{
assert(*(unsigned int *) "NEDN"==b->magic);
assert(!ob || ob->next==b);
assert(!ob || b->prev==ob);
}
}
}
| 0
| null | -1
|
https://github.com/git/git/commit/34fa79a6cde56d6d428ab0d3160cb094ebad3305
| 0CCPP
|
def _cnonce():
dig = _md5(
(
% (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])
).encode("utf-8")
).hexdigest()
return dig[:16]
| 1
|
2,3,4
| -1
|
https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc
| 4Python
|
function resetKA() {
if (kainterval > 0) {
kacount = 0;
clearInterval(katimer);
if (sock.writable)
katimer = setInterval(sendKA, kainterval);
}
}
| 1
|
0,1,2,3,4,5,6,7
| -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
AP4_StszAtom::AP4_StszAtom(AP4_UI32 size,
AP4_UI08 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_STSZ, size, version, flags)
{
stream.ReadUI32(m_SampleSize);
stream.ReadUI32(m_SampleCount);
if (m_SampleSize == 0) {
AP4_Cardinal sample_count = m_SampleCount;
m_Entries.SetItemCount(sample_count);
unsigned char* buffer = new unsigned char[sample_count*4];
AP4_Result result = stream.Read(buffer, sample_count*4);
if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
for (unsigned int i=0; i<sample_count; i++) {
m_Entries[i] = AP4_BytesToUInt32BE(&buffer[i*4]);
}
delete[] buffer;
}
}
| 1
| null | -1
|
https://github.com/axiomatic-systems/Bento4/commit/5eb8cf89d724ccb0b4ce5f24171ec7c11f0a7647
| 0CCPP
|
def save(self):
self["__meta__"] = {
"httpie": __version__
}
if self.helpurl:
self["__meta__"]["help"] = self.helpurl
if self.about:
self["__meta__"]["about"] = self.about
self.ensure_directory()
json_string = json.dumps(
obj=self,
indent=4,
sort_keys=True,
ensure_ascii=True,
)
self.path.write_text(json_string + "\n", encoding=UTF8)
| 1
|
0,1,2,3,10
| -1
|
https://github.com/httpie/cli.git/commit/65ab7d5caaaf2f95e61f9dd65441801c2ddee38b
| 4Python
|
juniper_services_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
struct juniper_services_header {
uint8_t svc_id;
uint8_t flags_len;
uint8_t svc_set_id[2];
uint8_t dir_iif[4];
};
const struct juniper_services_header *sh;
l2info.pictype = DLT_JUNIPER_SERVICES;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
sh = (const struct juniper_services_header *)p;
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
sh->svc_id,
sh->flags_len,
EXTRACT_16BITS(&sh->svc_set_id),
EXTRACT_24BITS(&sh->dir_iif[1])));
ip_heuristic_guess (ndo, p, l2info.length);
return l2info.header_len;
}
| 1
| null | -1
|
https://github.com/the-tcpdump-group/tcpdump/commit/b534e304568585707c4a92422aeca25cf908ff02
| 0CCPP
|
explicit CachedRepoOptions(RepoOptions&& opts)
: options(new RepoOptions(std::move(opts)))
{}
| 0
| null | -1
|
https://github.com/facebook/hhvm/commit/abe0b29e4d3a610f9bc920b8be4ad8403364c2d4
| 0CCPP
|
def create(request, topic_id):
topic = get_object_or_404(Topic.objects.for_access(request.user), pk=topic_id)
form = NotificationCreationForm(user=request.user, topic=topic, data=request.POST)
if form.is_valid():
form.save()
else:
messages.error(request, utils.render_form_errors(form))
return redirect(
request.POST.get("next", topic.get_absolute_url())
)
| 1
|
9
| -1
|
https://github.com/nitely/spirit.git/commit/8f32f89654d6c30d56e0dd167059d32146fb32ef
| 4Python
|
PHP_FUNCTION( locale_get_keywords )
{
UEnumeration* e = NULL;
UErrorCode status = U_ZERO_ERROR;
const char* kw_key = NULL;
int32_t kw_key_len = 0;
const char* loc_name = NULL;
int loc_name_len = 0;
char* kw_value = NULL;
int32_t kw_value_len = 100;
intl_error_reset( NULL TSRMLS_CC );
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
&loc_name, &loc_name_len ) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"locale_get_keywords: unable to parse input params", 0 TSRMLS_CC );
RETURN_FALSE;
}
if(loc_name_len == 0) {
loc_name = intl_locale_get_default(TSRMLS_C);
}
e = uloc_openKeywords( loc_name, &status );
if( e != NULL )
{
array_init( return_value );
while( ( kw_key = uenum_next( e, &kw_key_len, &status ) ) != NULL ){
kw_value = ecalloc( 1 , kw_value_len );
kw_value_len=uloc_getKeywordValue( loc_name,kw_key, kw_value, kw_value_len , &status );
if (status == U_BUFFER_OVERFLOW_ERROR) {
status = U_ZERO_ERROR;
kw_value = erealloc( kw_value , kw_value_len+1);
kw_value_len=uloc_getKeywordValue( loc_name,kw_key, kw_value, kw_value_len+1 , &status );
} else if(!U_FAILURE(status)) {
kw_value = erealloc( kw_value , kw_value_len+1);
}
if (U_FAILURE(status)) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC );
if( kw_value){
efree( kw_value );
}
zval_dtor(return_value);
RETURN_FALSE;
}
add_assoc_stringl( return_value, (char *)kw_key, kw_value , kw_value_len, 0);
}
}
uenum_close( e );
}
| 0
| null | -1
|
https://github.com/php/php-src/commit/97eff7eb57fc2320c267a949cffd622c38712484
| 0CCPP
|
void CtcpParser::query(CoreNetwork *net, const QString &bufname, const QString &ctcpTag, const QString &message)
{
QList<QByteArray> params;
params << net->serverEncode(bufname) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message)));
static const char *splitter = " .,-!?";
int maxSplitPos = message.count();
int splitPos = maxSplitPos;
int overrun = net->userInputHandler()->lastParamOverrun("PRIVMSG", params);
if (overrun) {
maxSplitPos = message.count() - overrun -2;
splitPos = -1;
for (const char *splitChar = splitter; *splitChar != 0; splitChar++) {
splitPos = qMax(splitPos, message.lastIndexOf(*splitChar, maxSplitPos) + 1); //
}
if (splitPos <= 0 || splitPos > maxSplitPos)
splitPos = maxSplitPos;
params = params.mid(0, 1) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message.left(splitPos))));
}
net->putCmd("PRIVMSG", params);
if (splitPos < message.count())
query(net, bufname, ctcpTag, message.mid(splitPos));
}
| 1
|
2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
| -1
|
https://github.com/quassel/quassel/commit/b5e38970ffd55e2dd9f706ce75af9a8d7730b1b8
| 0CCPP
|
static const struct sys_reg_desc *find_reg(const struct sys_reg_params *params,
const struct sys_reg_desc table[],
unsigned int num)
{
unsigned long pval = reg_to_match_value(params);
return bsearch((void *)pval, table, num, sizeof(table[0]), match_sys_reg);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/9e3f7a29694049edd728e2400ab57ad7553e5aa9
| 0CCPP
|
static int mov_write_dops_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
avio_wb32(pb, 0);
ffio_wfourcc(pb, "dOps");
avio_w8(pb, 0);
if (track->par->extradata_size < 19) {
av_log(pb, AV_LOG_ERROR, "invalid extradata size\n");
return AVERROR_INVALIDDATA;
}
avio_w8(pb, AV_RB8(track->par->extradata + 9));
avio_wb16(pb, AV_RL16(track->par->extradata + 10));
avio_wb32(pb, AV_RL32(track->par->extradata + 12));
avio_wb16(pb, AV_RL16(track->par->extradata + 16));
avio_write(pb, track->par->extradata + 18, track->par->extradata_size - 18);
return update_size(pb, pos);
}
| 0
| null | -1
|
https://github.com/FFmpeg/FFmpeg/commit/ed22dc22216f74c75ee7901f82649e1ff725ba50
| 0CCPP
|
public override bool Equals(object obj)
{
if (obj is RECT)
return Equals((RECT)obj);
else if (obj is Rectangle)
return Equals(new RECT((Rectangle)obj));
return false;
}
| 1
|
0,1,2,3,4,5,6,7
| -1
|
https://github.com/Ulterius/server/commit/770d1821de43cf1d0a93c79025995bdd812a76ee
| 1CS
|
_pango_emoji_iter_next (PangoEmojiIter *iter)
{
PangoEmojiType current_emoji_type = PANGO_EMOJI_TYPE_INVALID;
if (iter->end == iter->text_end)
return FALSE;
iter->start = iter->end;
for (; iter->end < iter->text_end; iter->end = g_utf8_next_char (iter->end))
{
gunichar ch = g_utf8_get_char (iter->end);
if ((!(ch == kZeroWidthJoinerCharacter && !iter->is_emoji) &&
ch != kVariationSelector15Character &&
ch != kVariationSelector16Character &&
ch != kCombiningEnclosingCircleBackslashCharacter &&
!_pango_Is_Regional_Indicator(ch) &&
!((ch == kLeftSpeechBubbleCharacter ||
ch == kRainbowCharacter ||
ch == kMaleSignCharacter ||
ch == kFemaleSignCharacter ||
ch == kStaffOfAesculapiusCharacter) &&
!iter->is_emoji)) ||
current_emoji_type == PANGO_EMOJI_TYPE_INVALID) {
current_emoji_type = _pango_get_emoji_type (ch);
}
if (g_utf8_next_char (iter->end) < iter->text_end)
{
gunichar peek_char = g_utf8_get_char (g_utf8_next_char (iter->end));
if (current_emoji_type ==
PANGO_EMOJI_TYPE_EMOJI_EMOJI &&
peek_char == kVariationSelector15Character) {
current_emoji_type = PANGO_EMOJI_TYPE_EMOJI_TEXT;
}
if ((current_emoji_type ==
PANGO_EMOJI_TYPE_EMOJI_TEXT ||
_pango_Is_Emoji_Keycap_Base(ch)) &&
peek_char == kVariationSelector16Character) {
current_emoji_type = PANGO_EMOJI_TYPE_EMOJI_EMOJI;
}
if (_pango_Is_Emoji_Keycap_Base(ch) &&
peek_char == kCombiningEnclosingKeycapCharacter) {
current_emoji_type = PANGO_EMOJI_TYPE_EMOJI_EMOJI;
};
if (_pango_Is_Regional_Indicator(ch) &&
_pango_Is_Regional_Indicator(peek_char)) {
current_emoji_type = PANGO_EMOJI_TYPE_EMOJI_EMOJI;
}
if ((ch == kEyeCharacter ||
ch == kWavingWhiteFlagCharacter) &&
peek_char == kZeroWidthJoinerCharacter) {
current_emoji_type = PANGO_EMOJI_TYPE_EMOJI_EMOJI;
}
}
if (iter->is_emoji == (gboolean) 2)
iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
if (iter->is_emoji == PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type))
{
iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
return TRUE;
}
}
iter->is_emoji = PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
return TRUE;
}
| 1
| null | -1
|
https://github.com/GNOME/pango/commit/71aaeaf020340412b8d012fe23a556c0420eda5f
| 0CCPP
|
public boolean isMergeAdjacentText() {
return mergeAdjacentText;
}
| 1
|
0,1,2
| -1
|
https://github.com/dom4j/dom4j/commit/a8228522a99a02146106672a34c104adbda5c658
| 2Java
|
nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_symlinkargs *args)
{
unsigned int len, avail;
char *old, *new;
struct kvec *vec;
if (!(p = decode_fh(p, &args->ffh)) ||
!(p = decode_filename(p, &args->fname, &args->flen))
)
return 0;
p = decode_sattr3(p, &args->attrs);
len = ntohl(*p++);
if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE)
return 0;
args->tname = new = page_address(*(rqstp->rq_next_page++));
args->tlen = len;
old = (char*)p;
vec = &rqstp->rq_arg.head[0];
avail = vec->iov_len - (old - (char*)vec->iov_base);
while (len && avail && *old) {
*new++ = *old++;
len--;
avail--;
}
if (len && !avail && rqstp->rq_arg.page_len) {
avail = min_t(unsigned int, rqstp->rq_arg.page_len, PAGE_SIZE);
old = page_address(rqstp->rq_arg.pages[0]);
}
while (len && avail && *old) {
*new++ = *old++;
len--;
avail--;
}
*new = '\0';
if (len)
return 0;
return 1;
}
| 1
| null | -1
|
https://github.com/torvalds/linux/commit/13bf9fbff0e5e099e2b6f003a0ab8ae145436309
| 0CCPP
|
mxSettings.settings.sidebarTitles),this.formatWidth=mxSettings.getFormatWidth());var d=this,g=this.editor.graph;Editor.isDarkMode()&&(g.view.defaultGridColor=mxGraphView.prototype.defaultDarkGridColor);Graph.touchStyle&&(g.panningHandler.isPanningTrigger=function(D){var G=D.getEvent();return null==D.getState()&&!mxEvent.isMouseEvent(G)&&!g.freehand.isDrawing()||mxEvent.isPopupTrigger(G)&&(null==D.getState()||mxEvent.isControlDown(G)||mxEvent.isShiftDown(G))});g.cellEditor.editPlantUmlData=function(D,
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
Graph.prototype.resizeParentStacks=function(a,b,f,d){if(null!=this.layoutManager&&null!=b&&b.constructor==mxStackLayout&&!b.resizeLast){this.model.beginUpdate();try{for(var g=b.horizontal;null!=a&&null!=b&&b.constructor==mxStackLayout&&b.horizontal==g&&!b.resizeLast;){var e=this.getCellGeometry(a),k=this.view.getState(a);null!=k&&null!=e&&(e=e.clone(),b.horizontal?e.width+=f+Math.min(0,k.width/this.view.scale-e.width):e.height+=d+Math.min(0,k.height/this.view.scale-e.height),this.model.setGeometry(a,
e));a=this.model.getParent(a);b=this.layoutManager.getLayout(a)}}finally{this.model.endUpdate()}}};Graph.prototype.isContainer=function(a){var b=this.getCurrentCellStyle(a);return this.isSwimlane(a)?"0"!=b.container:"1"==b.container};Graph.prototype.isCellConnectable=function(a){var b=this.getCurrentCellStyle(a);return null!=b.connectable?"0"!=b.connectable:mxGraph.prototype.isCellConnectable.apply(this,arguments)};
Graph.prototype.isLabelMovable=function(a){var b=this.getCurrentCellStyle(a);return null!=b.movableLabel?"0"!=b.movableLabel:mxGraph.prototype.isLabelMovable.apply(this,arguments)};Graph.prototype.selectAll=function(a){a=a||this.getDefaultParent();this.isCellLocked(a)||mxGraph.prototype.selectAll.apply(this,arguments)};Graph.prototype.selectCells=function(a,b,f){f=f||this.getDefaultParent();this.isCellLocked(f)||mxGraph.prototype.selectCells.apply(this,arguments)};
Graph.prototype.getSwimlaneAt=function(a,b,f){var d=mxGraph.prototype.getSwimlaneAt.apply(this,arguments);this.isCellLocked(d)&&(d=null);return d};Graph.prototype.isCellFoldable=function(a){var b=this.getCurrentCellStyle(a);return this.foldingEnabled&&"0"!=mxUtils.getValue(b,mxConstants.STYLE_RESIZABLE,"1")&&("1"==b.treeFolding||!this.isCellLocked(a)&&(this.isContainer(a)&&"0"!=b.collapsible||!this.isContainer(a)&&"1"==b.collapsible))};
Graph.prototype.reset=function(){this.isEditing()&&this.stopEditing(!0);this.escape();this.isSelectionEmpty()||this.clearSelection()};Graph.prototype.zoom=function(a,b){a=Math.max(.01,Math.min(this.view.scale*a,160))/this.view.scale;mxGraph.prototype.zoom.apply(this,arguments)};Graph.prototype.zoomIn=function(){.15>this.view.scale?this.zoom((this.view.scale+.01)/this.view.scale):this.zoom(Math.round(this.view.scale*this.zoomFactor*20)/20/this.view.scale)};
Graph.prototype.zoomOut=function(){.15>=this.view.scale?this.zoom((this.view.scale-.01)/this.view.scale):this.zoom(Math.round(1/this.zoomFactor*this.view.scale*20)/20/this.view.scale)};
Graph.prototype.fitWindow=function(a,b){b=null!=b?b:10;var f=this.container.clientWidth-b,d=this.container.clientHeight-b,g=Math.floor(20*Math.min(f/a.width,d/a.height))/20;this.zoomTo(g);if(mxUtils.hasScrollbars(this.container)){var e=this.view.translate;this.container.scrollTop=(a.y+e.y)*g-Math.max((d-a.height*g)/2+b/2,0);this.container.scrollLeft=(a.x+e.x)*g-Math.max((f-a.width*g)/2+b/2,0)}};
Graph.prototype.getTooltipForCell=function(a){var b="";if(mxUtils.isNode(a.value)){var f=null;Graph.translateDiagram&&null!=Graph.diagramLanguage&&(f=a.value.getAttribute("tooltip_"+Graph.diagramLanguage));null==f&&(f=a.value.getAttribute("tooltip"));if(null!=f)null!=f&&this.isReplacePlaceholders(a)&&(f=this.replacePlaceholders(a,f)),b=this.sanitizeHtml(f);else{f=this.builtInProperties;a=a.value.attributes;var d=[];this.isEnabled()&&(f.push("linkTarget"),f.push("link"));for(var g=0;g<a.length;g++)0>
mxUtils.indexOf(f,a[g].nodeName)&&0<a[g].nodeValue.length&&d.push({name:a[g].nodeName,value:a[g].nodeValue});d.sort(function(e,k){return e.name<k.name?-1:e.name>k.name?1:0});for(g=0;g<d.length;g++)"link"==d[g].name&&this.isCustomLink(d[g].value)||(b+=("link"!=d[g].name?"<b>"+d[g].name+":</b> ":"")+mxUtils.htmlEntities(d[g].value)+"\n");0<b.length&&(b=b.substring(0,b.length-1),mxClient.IS_SVG&&(b='<div style="max-width:360px;text-overflow:ellipsis;overflow:hidden;">'+b+"</div>"))}}return b};
Graph.prototype.getFlowAnimationStyle=function(){var a=document.getElementsByTagName("head")[0];if(null!=a&&null==this.flowAnimationStyle){this.flowAnimationStyle=document.createElement("style");this.flowAnimationStyle.setAttribute("id","geEditorFlowAnimation-"+Editor.guid());this.flowAnimationStyle.type="text/css";var b=this.flowAnimationStyle.getAttribute("id");this.flowAnimationStyle.innerHTML=this.getFlowAnimationStyleCss(b);a.appendChild(this.flowAnimationStyle)}return this.flowAnimationStyle};
Graph.prototype.getFlowAnimationStyleCss=function(a){return"."+a+" {\nanimation: "+a+" 0.5s linear;\nanimation-iteration-count: infinite;\n}\n@keyframes "+a+" {\nto {\nstroke-dashoffset: "+-16*this.view.scale+";\n}\n}"};Graph.prototype.stringToBytes=function(a){return Graph.stringToBytes(a)};Graph.prototype.bytesToString=function(a){return Graph.bytesToString(a)};Graph.prototype.compressNode=function(a){return Graph.compressNode(a)};Graph.prototype.compress=function(a,b){return Graph.compress(a,b)};
Graph.prototype.decompress=function(a,b){return Graph.decompress(a,b)};Graph.prototype.zapGremlins=function(a){return Graph.zapGremlins(a)};HoverIcons=function(a){mxEventSource.call(this);this.graph=a;this.init()};mxUtils.extend(HoverIcons,mxEventSource);HoverIcons.prototype.arrowSpacing=2;HoverIcons.prototype.updateDelay=500;HoverIcons.prototype.activationDelay=140;HoverIcons.prototype.currentState=null;HoverIcons.prototype.activeArrow=null;HoverIcons.prototype.inactiveOpacity=15;
HoverIcons.prototype.cssCursor="copy";HoverIcons.prototype.checkCollisions=!0;HoverIcons.prototype.arrowFill="#29b6f2";HoverIcons.prototype.triangleUp=mxClient.IS_SVG?Graph.createSvgImage(18,28,'<path d="m 6 26 L 12 26 L 12 12 L 18 12 L 9 1 L 1 12 L 6 12 z" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'"/>'):new mxImage(IMAGE_PATH+"/triangle-up.png",26,14);
HoverIcons.prototype.triangleRight=mxClient.IS_SVG?Graph.createSvgImage(26,18,'<path d="m 1 6 L 14 6 L 14 1 L 26 9 L 14 18 L 14 12 L 1 12 z" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'"/>'):new mxImage(IMAGE_PATH+"/triangle-right.png",14,26);HoverIcons.prototype.triangleDown=mxClient.IS_SVG?Graph.createSvgImage(18,26,'<path d="m 6 1 L 6 14 L 1 14 L 9 26 L 18 14 L 12 14 L 12 1 z" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'"/>'):new mxImage(IMAGE_PATH+"/triangle-down.png",26,14);
HoverIcons.prototype.triangleLeft=mxClient.IS_SVG?Graph.createSvgImage(28,18,'<path d="m 1 9 L 12 1 L 12 6 L 26 6 L 26 12 L 12 12 L 12 18 z" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'"/>'):new mxImage(IMAGE_PATH+"/triangle-left.png",14,26);HoverIcons.prototype.roundDrop=mxClient.IS_SVG?Graph.createSvgImage(26,26,'<circle cx="13" cy="13" r="12" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'"/>'):new mxImage(IMAGE_PATH+"/round-drop.png",26,26);
HoverIcons.prototype.refreshTarget=new mxImage(mxClient.IS_SVG?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjM2cHgiIGhlaWdodD0iMzZweCI+PGVsbGlwc2UgZmlsbD0iIzI5YjZmMiIgY3g9IjEyIiBjeT0iMTIiIHJ4PSIxMiIgcnk9IjEyIi8+PHBhdGggdHJhbnNmb3JtPSJzY2FsZSgwLjgpIHRyYW5zbGF0ZSgyLjQsIDIuNCkiIHN0cm9rZT0iI2ZmZiIgZmlsbD0iI2ZmZiIgZD0iTTEyIDZ2M2w0LTQtNC00djNjLTQuNDIgMC04IDMuNTgtOCA4IDAgMS41Ny40NiAzLjAzIDEuMjQgNC4yNkw2LjcgMTQuOGMtLjQ1LS44My0uNy0xLjc5LS43LTIuOCAwLTMuMzEgMi42OS02IDYtNnptNi43NiAxLjc0TDE3LjMgOS4yYy40NC44NC43IDEuNzkuNyAyLjggMCAzLjMxLTIuNjkgNi02IDZ2LTNsLTQgNCA0IDR2LTNjNC40MiAwIDgtMy41OCA4LTggMC0xLjU3LS40Ni0zLjAzLTEuMjQtNC4yNnoiLz48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PC9zdmc+Cg==":
IMAGE_PATH+"/refresh.png",38,38);HoverIcons.prototype.tolerance=mxClient.IS_TOUCH?6:0;
HoverIcons.prototype.init=function(){this.arrowUp=this.createArrow(this.triangleUp,mxResources.get("plusTooltip"),mxConstants.DIRECTION_NORTH);this.arrowRight=this.createArrow(this.triangleRight,mxResources.get("plusTooltip"),mxConstants.DIRECTION_EAST);this.arrowDown=this.createArrow(this.triangleDown,mxResources.get("plusTooltip"),mxConstants.DIRECTION_SOUTH);this.arrowLeft=this.createArrow(this.triangleLeft,mxResources.get("plusTooltip"),mxConstants.DIRECTION_WEST);this.elts=[this.arrowUp,this.arrowRight,
this.arrowDown,this.arrowLeft];this.resetHandler=mxUtils.bind(this,function(){this.reset()});this.repaintHandler=mxUtils.bind(this,function(){this.repaint()});this.graph.selectionModel.addListener(mxEvent.CHANGE,this.resetHandler);this.graph.model.addListener(mxEvent.CHANGE,this.repaintHandler);this.graph.view.addListener(mxEvent.SCALE_AND_TRANSLATE,this.repaintHandler);this.graph.view.addListener(mxEvent.TRANSLATE,this.repaintHandler);this.graph.view.addListener(mxEvent.SCALE,this.repaintHandler);
this.graph.view.addListener(mxEvent.DOWN,this.repaintHandler);this.graph.view.addListener(mxEvent.UP,this.repaintHandler);this.graph.addListener(mxEvent.ROOT,this.repaintHandler);this.graph.addListener(mxEvent.ESCAPE,this.resetHandler);mxEvent.addListener(this.graph.container,"scroll",this.resetHandler);this.graph.addListener(mxEvent.ESCAPE,mxUtils.bind(this,function(){this.mouseDownPoint=null}));mxEvent.addListener(this.graph.container,"mouseleave",mxUtils.bind(this,function(f){null!=f.relatedTarget&&
mxEvent.getSource(f)==this.graph.container&&this.setDisplay("none")}));this.graph.addListener(mxEvent.START_EDITING,mxUtils.bind(this,function(f){this.reset()}));var a=this.graph.click;this.graph.click=mxUtils.bind(this,function(f){a.apply(this.graph,arguments);null==this.currentState||this.graph.isCellSelected(this.currentState.cell)||!mxEvent.isTouchEvent(f.getEvent())||this.graph.model.isVertex(f.getCell())||this.reset()});var b=!1;this.graph.addMouseListener({mouseDown:mxUtils.bind(this,function(f,
d){b=!1;f=d.getEvent();this.isResetEvent(f)?this.reset():this.isActive()||(d=this.getState(d.getState()),null==d&&mxEvent.isTouchEvent(f)||this.update(d));this.setDisplay("none")}),mouseMove:mxUtils.bind(this,function(f,d){f=d.getEvent();this.isResetEvent(f)?this.reset():this.graph.isMouseDown||mxEvent.isTouchEvent(f)||this.update(this.getState(d.getState()),d.getGraphX(),d.getGraphY());null!=this.graph.connectionHandler&&null!=this.graph.connectionHandler.shape&&(b=!0)}),mouseUp:mxUtils.bind(this,
function(f,d){f=d.getEvent();mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(f),mxEvent.getClientY(f));this.isResetEvent(f)?this.reset():this.isActive()&&!b&&null!=this.mouseDownPoint?this.click(this.currentState,this.getDirection(),d):this.isActive()?1==this.graph.getSelectionCount()&&this.graph.model.isEdge(this.graph.getSelectionCell())?this.reset():this.update(this.getState(this.graph.view.getState(this.graph.getCellAt(d.getGraphX(),d.getGraphY())))):mxEvent.isTouchEvent(f)||null!=
this.bbox&&mxUtils.contains(this.bbox,d.getGraphX(),d.getGraphY())?(this.setDisplay(""),this.repaint()):mxEvent.isTouchEvent(f)||this.reset();b=!1;this.resetActiveArrow()})})};HoverIcons.prototype.isResetEvent=function(a,b){return mxEvent.isAltDown(a)||null==this.activeArrow&&mxEvent.isShiftDown(a)||mxEvent.isPopupTrigger(a)&&!this.graph.isCloneEvent(a)};
| 1
|
8
| -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
mxShapeIosTopButton.prototype.cst={TOP_BUTTON:"mxgraph.ios.topButton",R_SIZE:"rSize"};mxShapeIosTopButton.prototype.customProperties=[{name:"rSize",dispName:"Arc Size",type:"float",min:0,defVal:5}];mxShapeIosTopButton.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);d=parseInt(mxUtils.getValue(this.style,mxShapeIosTopButton.prototype.cst.R_SIZE,"10"));a.begin();a.moveTo(0,d);a.arcTo(d,d,0,0,1,d,0);a.lineTo(b-d,0);a.arcTo(d,d,0,0,1,b,d);a.lineTo(b,c);a.lineTo(0,c);a.close();a.fillAndStroke()};
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
| 3JavaScript
|
"",fa=0;fa<k.length;fa++)aa=document.createElement("option"),mxUtils.write(aa,k[fa].getAttribute("name")||mxResources.get("pageWithNumber",[fa+1])),aa.setAttribute("value",fa),fa==l&&aa.setAttribute("selected","selected"),M.appendChild(aa);W=function(){try{var Ha=parseInt(M.value);l=g=Ha;ja(k[Ha])}catch(ra){M.value=g,b.handleError(ra)}}}else Ba(va);fa=R.lastModifyingUserName;null!=fa&&20<fa.length&&(fa=fa.substring(0,20)+"...");H.innerHTML="";mxUtils.write(H,(null!=fa?fa+" ":"")+Y.toLocaleDateString()+
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
static size_t NumElements(const TensorProto& proto) {
return proto.int64_val().size();
}
| 0
| null | -1
|
https://github.com/tensorflow/tensorflow/commit/14fea662350e7c26eb5fe1be2ac31704e5682ee6
| 0CCPP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.