processed_func
string
target
int64
flaw_line
string
flaw_line_index
int64
commit_url
string
language
class label
decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s, size_t len) { PyObject *u; char *buf; char *p; const char *end; if (len > SIZE_MAX / 6) return NULL; u = PyBytes_FromStringAndSize((char *)NULL, len * 6); if (u == NULL) return NULL; p = buf = PyBytes_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { *p++ = *s++; if (*s & 0x80) { strcpy(p, "u005c"); p += 5; } } if (*s & 0x80) { PyObject *w; int kind; void *data; Py_ssize_t len, i; w = decode_utf8(c, &s, end); if (w == NULL) { Py_DECREF(u); return NULL; } kind = PyUnicode_KIND(w); data = PyUnicode_DATA(w); len = PyUnicode_GET_LENGTH(w); for (i = 0; i < len; i++) { Py_UCS4 chr = PyUnicode_READ(kind, data, i); sprintf(p, "\\U%08x", chr); p += 10; } assert(p - buf <= Py_SIZE(u)); Py_DECREF(w); } else { *p++ = *s++; } } len = p - buf; s = buf; return PyUnicode_DecodeUnicodeEscape(s, len, NULL); }
1
3,17,40,48
-1
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
0CCPP
process_add_smartcard_key(SocketEntry *e) { char *provider = NULL, *pin; int r, i, version, count = 0, success = 0, confirm = 0; u_int seconds; time_t death = 0; u_char type; struct sshkey **keys = NULL, *k; Identity *id; Idtab *tab; if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 || (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); while (sshbuf_len(e->request)) { if ((r = sshbuf_get_u8(e->request, &type)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); switch (type) { case SSH_AGENT_CONSTRAIN_LIFETIME: if ((r = sshbuf_get_u32(e->request, &seconds)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); death = monotime() + seconds; break; case SSH_AGENT_CONSTRAIN_CONFIRM: confirm = 1; break; default: error("process_add_smartcard_key: " "Unknown constraint type %d", type); goto send; } } if (lifetime && !death) death = monotime() + lifetime; count = pkcs11_add_provider(provider, pin, &keys); for (i = 0; i < count; i++) { k = keys[i]; version = k->type == KEY_RSA1 ? 1 : 2; tab = idtab_lookup(version); if (lookup_identity(k, version) == NULL) { id = xcalloc(1, sizeof(Identity)); id->key = k; id->provider = xstrdup(provider); id->comment = xstrdup(provider); /* id->death = death; id->confirm = confirm; TAILQ_INSERT_TAIL(&tab->idlist, id, next); tab->nentries++; success = 1; } else { sshkey_free(k); } keys[i] = NULL; } send: free(pin); free(provider); free(keys); send_status(e, success); }
1
2,34,42,43
-1
https://github.com/openbsd/src/commit/9476ce1dd37d3c3218d5640b74c34c65e5f4efe5
0CCPP
function reqPty(chan, opts, cb) { var rows = 24; var cols = 80; var width = 640; var height = 480; var term = 'vt100'; var modes = null; if (typeof opts === 'function') cb = opts; else if (typeof opts === 'object' && opts !== null) { if (typeof opts.rows === 'number') rows = opts.rows; if (typeof opts.cols === 'number') cols = opts.cols; if (typeof opts.width === 'number') width = opts.width; if (typeof opts.height === 'number') height = opts.height; if (typeof opts.term === 'string') term = opts.term; if (typeof opts.modes === 'object') modes = opts.modes; } var wantReply = (typeof cb === 'function'); if (chan.outgoing.state !== 'open') { wantReply && cb(new Error('Channel is not open')); return true; } if (wantReply) { chan._callbacks.push(function(had_err) { if (had_err) { return cb(had_err !== true ? had_err : new Error('Unable to request a pseudo-terminal')); } cb(); }); } return chan._client._sshstream.pty(chan.outgoing.id, rows, cols, height, width, term, modes, wantReply); }
1
1,2,3,4,5,6,7,9,23,25,26,29,31,32,33,38,39,40,41,42,43,44,45
-1
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
3JavaScript
updateHandle : function() { rhandle.width(img.width()).height(img.height()); },
1
0,1,2
-1
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
3JavaScript
static inline void trace_access_lock_init(void) { }
0
null
-1
https://github.com/torvalds/linux/commit/15fab63e1e57be9fdb5eec1bbc5916e9825e9acb
0CCPP
static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_ccb) { bool error; uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy; int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle; unsigned long flags; struct ARCMSR_CDB *arcmsr_cdb; struct CommandControlBlock *pCCB; struct MessageUnit_D *pmu = acb->pmuD; polling_hbaD_ccb_retry: poll_count++; while (1) { spin_lock_irqsave(&acb->doneq_lock, flags); outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1; doneq_index = pmu->doneq_index; if ((outbound_write_pointer & 0xFFF) == (doneq_index & 0xFFF)) { spin_unlock_irqrestore(&acb->doneq_lock, flags); if (poll_ccb_done) { rtn = SUCCESS; break; } else { msleep(25); if (poll_count > 40) { rtn = FAILED; break; } goto polling_hbaD_ccb_retry; } } toggle = doneq_index & 0x4000; index_stripped = (doneq_index & 0xFFF) + 1; index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE; pmu->doneq_index = index_stripped ? (index_stripped | toggle) : ((toggle ^ 0x4000) + 1); doneq_index = pmu->doneq_index; spin_unlock_irqrestore(&acb->doneq_lock, flags); flag_ccb = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow; ccb_cdb_phy = (flag_ccb & 0xFFFFFFF0); arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset + ccb_cdb_phy); pCCB = container_of(arcmsr_cdb, struct CommandControlBlock, arcmsr_cdb); poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0; if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) { if (pCCB->startdone == ARCMSR_CCB_ABORTED) { pr_notice("arcmsr%d: scsi id = %d " "lun = %d ccb = '0x%p' poll command " "abort successfully\n" , acb->host->host_no , pCCB->pcmd->device->id , (u32)pCCB->pcmd->device->lun , pCCB); pCCB->pcmd->result = DID_ABORT << 16; arcmsr_ccb_complete(pCCB); continue; } pr_notice("arcmsr%d: polling an illegal " "ccb command done ccb = '0x%p' " "ccboutstandingcount = %d\n" , acb->host->host_no , pCCB , atomic_read(&acb->ccboutstandingcount)); continue; } error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? true : false; arcmsr_report_ccb_state(acb, pCCB, error); } return rtn; }
0
null
-1
https://github.com/torvalds/linux/commit/7bc2b55a5c030685b399bb65b6baa9ccc3d1f167
0CCPP
static void SQLITE_NOINLINE vdbeChangeP4Full( Vdbe *p, Op *pOp, const char *zP4, int n ){ if( pOp->p4type ){ freeP4(p->db, pOp->p4type, pOp->p4.p); pOp->p4type = 0; pOp->p4.p = 0; } if( n<0 ){ sqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n); }else{ if( n==0 ) n = sqlite3Strlen30(zP4); pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n); pOp->p4type = P4_DYNAMIC; } }
0
null
-1
https://github.com/sqlite/sqlite/commit/8654186b0236d556aa85528c2573ee0b6ab71be3
0CCPP
var leafNodes = function leafNodes(obj) { var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; var objCache = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; var paths = []; objCache.push(obj); for (var i in obj) { if (obj.hasOwnProperty(i)) { if (obj[i] !== undefined) { var currentPath = join(parentPath, i); if ((0, _typeof2["default"])(obj[i]) !== "object" || objCache.indexOf(obj[i]) > -1) { paths.push(currentPath); } else { paths.push.apply(paths, (0, _toConsumableArray2["default"])(leafNodes(obj[i], currentPath, objCache))); } } } } return paths; };
0
null
-1
https://github.com/Irrelon/irrelon-path/commit/8a126b160c1a854ae511659c111413ad9910ebe3
3JavaScript
static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, struct dj_report *dj_report) { struct hid_device *djrcv_hdev = djrcv_dev->hdev; struct usb_interface *intf = to_usb_interface(djrcv_hdev->dev.parent); struct usb_device *usbdev = interface_to_usbdev(intf); struct hid_device *dj_hiddev; struct dj_device *dj_dev; unsigned char tmpstr[3]; if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & SPFUNCTION_DEVICE_LIST_EMPTY) { dbg_hid("%s: device list is empty\n", __func__); djrcv_dev->querying_devices = false; return; } if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n", __func__, dj_report->device_index); return; } if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { dbg_hid("%s: device is already known\n", __func__); return; } dj_hiddev = hid_allocate_device(); if (IS_ERR(dj_hiddev)) { dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", __func__); return; } dj_hiddev->ll_driver = &logi_dj_ll_driver; dj_hiddev->dev.parent = &djrcv_hdev->dev; dj_hiddev->bus = BUS_USB; dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor); dj_hiddev->product = le16_to_cpu(usbdev->descriptor.idProduct); snprintf(dj_hiddev->name, sizeof(dj_hiddev->name), "Logitech Unifying Device. Wireless PID:%02x%02x", dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB], dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB]); usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys)); snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index); strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys)); dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL); if (!dj_dev) { dev_err(&djrcv_hdev->dev, "%s: failed allocating dj_device\n", __func__); goto dj_device_allocate_fail; } dj_dev->reports_supported = get_unaligned_le32( dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE); dj_dev->hdev = dj_hiddev; dj_dev->dj_receiver_dev = djrcv_dev; dj_dev->device_index = dj_report->device_index; dj_hiddev->driver_data = dj_dev; djrcv_dev->paired_dj_devices[dj_report->device_index] = dj_dev; if (hid_add_device(dj_hiddev)) { dev_err(&djrcv_hdev->dev, "%s: failed adding dj_device\n", __func__); goto hid_add_device_fail; } return; hid_add_device_fail: djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL; kfree(dj_dev); dj_device_allocate_fail: hid_destroy_device(dj_hiddev); }
1
15,16,17,18,19,20
-1
https://github.com/torvalds/linux/commit/ad3e14d7c5268c2e24477c6ef54bbdf88add5d36
0CCPP
static void i40e_enable_misc_int_causes(struct i40e_pf *pf) { struct i40e_hw *hw = &pf->hw; u32 val; wr32(hw, I40E_PFINT_ICR0_ENA, 0); rd32(hw, I40E_PFINT_ICR0); val = I40E_PFINT_ICR0_ENA_ECC_ERR_MASK | I40E_PFINT_ICR0_ENA_MAL_DETECT_MASK | I40E_PFINT_ICR0_ENA_GRST_MASK | I40E_PFINT_ICR0_ENA_PCI_EXCEPTION_MASK | I40E_PFINT_ICR0_ENA_GPIO_MASK | I40E_PFINT_ICR0_ENA_HMC_ERR_MASK | I40E_PFINT_ICR0_ENA_VFLR_MASK | I40E_PFINT_ICR0_ENA_ADMINQ_MASK; if (pf->flags & I40E_FLAG_IWARP_ENABLED) val |= I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK; if (pf->flags & I40E_FLAG_PTP) val |= I40E_PFINT_ICR0_ENA_TIMESYNC_MASK; wr32(hw, I40E_PFINT_ICR0_ENA, val); wr32(hw, I40E_PFINT_DYN_CTL0, I40E_PFINT_DYN_CTL0_SW_ITR_INDX_MASK | I40E_PFINT_DYN_CTL0_INTENA_MSK_MASK); wr32(hw, I40E_PFINT_STAT_CTL0, 0); }
0
null
-1
https://github.com/torvalds/linux/commit/27d461333459d282ffa4a2bdb6b215a59d493a8f
0CCPP
ngx_gmtime(time_t t, ngx_tm_t *tp) { ngx_int_t yday; ngx_uint_t sec, min, hour, mday, mon, year, wday, days, leap; if (t < 0) { t = 0; } days = t / 86400; sec = t % 86400; wday = (4 + days) % 7; hour = sec / 3600; sec %= 3600; min = sec / 60; sec %= 60; days = days - (31 + 28) + 719527; year = (days + 2) * 400 / (365 * 400 + 100 - 4 + 1); yday = days - (365 * year + year / 4 - year / 100 + year / 400); if (yday < 0) { leap = (year % 4 == 0) && (year % 100 || (year % 400 == 0)); yday = 365 + leap + yday; year--; } mon = (yday + 31) * 10 / 306; mday = yday - (367 * mon / 12 - 30) + 1; if (yday >= 306) { year++; mon -= 10; } else { mon += 2; } tp->ngx_tm_sec = (ngx_tm_sec_t) sec; tp->ngx_tm_min = (ngx_tm_min_t) min; tp->ngx_tm_hour = (ngx_tm_hour_t) hour; tp->ngx_tm_mday = (ngx_tm_mday_t) mday; tp->ngx_tm_mon = (ngx_tm_mon_t) mon; tp->ngx_tm_year = (ngx_tm_year_t) year; tp->ngx_tm_wday = (ngx_tm_wday_t) wday; }
1
null
-1
https://github.com/nginx/nginx/commit/b900cc28fcbb4cf5a32ab62f80b59292e1c85b4b
0CCPP
this.editorUi.editor.graph,X=U.getSelectionCell();P.call(this,M,X,null,W);this.addMenuItems(M,["editTooltip"],W);U.model.isVertex(X)&&this.addMenuItems(M,["editGeometry"],W);this.addMenuItems(M,["-","edit"],W)})));this.addPopupMenuCellEditItems=function(M,W,U,X){M.addSeparator();this.addSubmenu("editCell",M,X,mxResources.get("edit"))};this.put("file",new Menu(mxUtils.bind(this,function(M,W){var U=C.getCurrentFile();C.menus.addMenuItems(M,["new"],W);C.menus.addSubmenu("openFrom",M,W);isLocalStorage&&
1
0
-1
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
3JavaScript
static __net_init int pppol2tp_init_net(struct net *net) { struct proc_dir_entry *pde; int err = 0; pde = proc_create("pppol2tp", S_IRUGO, net->proc_net, &pppol2tp_proc_fops); if (!pde) { err = -ENOMEM; goto out; } out: return err; }
0
null
-1
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
0CCPP
njs_array_expand(njs_vm_t *vm, njs_array_t *array, uint32_t prepend, uint32_t append) { uint32_t free_before, free_after; uint64_t size; njs_value_t *start, *old; free_before = array->start - array->data; free_after = array->size - array->length - free_before; if (njs_fast_path(free_before >= prepend && free_after >= append)) { return NJS_OK; } size = (uint64_t) prepend + array->length + append; if (size < 16) { size *= 2; } else { size += size / 2; } if (njs_slow_path(size > (UINT32_MAX / sizeof(njs_value_t)))) { goto memory_error; } start = njs_mp_align(vm->mem_pool, sizeof(njs_value_t), size * sizeof(njs_value_t)); if (njs_slow_path(start == NULL)) { goto memory_error; } array->size = size; old = array->data; array->data = start; start += prepend; if (array->length != 0) { memcpy(start, array->start, array->length * sizeof(njs_value_t)); } array->start = start; njs_mp_free(vm->mem_pool, old); return NJS_OK; memory_error: njs_memory_error(vm); return NJS_ERROR; }
1
null
-1
https://github.com/nginx/njs/commit/e673ae41a998d1391bd562edb2ed6d49db7cc716
0CCPP
static void hns_ppe_cnt_clr_ce(struct hns_ppe_cb *ppe_cb) { dsaf_set_dev_bit(ppe_cb, PPE_TNL_0_5_CNT_CLR_CE_REG, PPE_CNT_CLR_CE_B, 1); }
0
null
-1
https://github.com/torvalds/linux/commit/412b65d15a7f8a93794653968308fc100f2aa87c
0CCPP
static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_getaclres *resp) { struct dentry *dentry = resp->fh.fh_dentry; p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); if (resp->status == 0 && dentry && d_really_is_positive(dentry)) { struct inode *inode = d_inode(dentry); struct kvec *head = rqstp->rq_res.head; unsigned int base; int n; int w; *p++ = htonl(resp->mask); if (!xdr_ressize_check(rqstp, p)) return 0; base = (char *)p - (char *)head->iov_base; rqstp->rq_res.page_len = w = nfsacl_size( (resp->mask & NFS_ACL) ? resp->acl_access : NULL, (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); while (w > 0) { if (!*(rqstp->rq_next_page++)) return 0; w -= PAGE_SIZE; } n = nfsacl_encode(&rqstp->rq_res, base, inode, resp->acl_access, resp->mask & NFS_ACL, 0); if (n > 0) n = nfsacl_encode(&rqstp->rq_res, base + n, inode, resp->acl_default, resp->mask & NFS_DFACL, NFS_ACL_DEFAULT); if (n <= 0) return 0; } else if (!xdr_ressize_check(rqstp, p)) return 0; return 1; }
0
null
-1
https://github.com/torvalds/linux/commit/999653786df6954a31044528ac3f7a5dadca08f4
0CCPP
export function getCurSid12Maybe3(): St | N { const store: Store = debiki2.ReactStore.allData(); const cookieName = debiki2.store_isFeatFlagOn(store, 'ffUseNewSid') ? 'TyCoSid123' : 'dwCoSid'; let sid = getSetCookie(cookieName); if (!sid) { const typs: PageSession = getMainWin().typs; sid = typs.weakSessionId; } return sid || null; }
1
3
-1
https://github.com/debiki/talkyard/commit/b0712915d8a22a20b09a129924e8a29c25ae5761
5TypeScript
var HiddenTagsWindow = function(editorUi, x, y, w, h) { var graph = editorUi.editor.graph; var div = document.createElement('div'); div.style.overflow = 'hidden'; div.style.padding = '12px 8px 12px 8px'; div.style.height = 'auto'; var searchInput = document.createElement('input'); searchInput.setAttribute('placeholder', 'Type in the tags and press Enter to add them'); searchInput.setAttribute('type', 'text'); searchInput.style.width = '100%'; searchInput.style.boxSizing = 'border-box'; searchInput.style.fontSize = '12px'; searchInput.style.borderRadius = '4px'; searchInput.style.padding = '4px'; searchInput.style.marginBottom = '8px'; div.appendChild(searchInput); var filterInput = searchInput.cloneNode(true); filterInput.setAttribute('placeholder', 'Filter tags'); div.appendChild(filterInput); var tagCloud = document.createElement('div'); tagCloud.style.position = 'relative'; tagCloud.style.fontSize = '12px'; tagCloud.style.height = 'auto'; div.appendChild(tagCloud); var graph = editorUi.editor.graph; var lastValue = null; function getLookup(tagList) { var lookup = {}; for (var i = 0; i < tagList.length; i++) { lookup[tagList[i].toLowerCase()] = true; } return lookup; }; function getAllTags() { return graph.getTagsForCells(graph.model.getDescendants( graph.model.getRoot())); }; function matchTags(tags, lookup, tagCount) { if (tags.length > 0) { var tmp = tags.toLowerCase().split(' '); if (tmp.length > tagCount) { return false; } else { for (var i = 0; i < tmp.length; i++) { if (lookup[tmp[i]] == null) { return false; } } return true; } } else { return false; } }; var hiddenTags = {}; var hiddenTagCount = 0; var graphIsCellVisible = graph.isCellVisible; graph.isCellVisible = function(cell) { return graphIsCellVisible.apply(this, arguments) && (hiddenTagCount == 0 || !matchTags(graph.getTagsForCell(cell), hiddenTags, hiddenTagCount)); }; function setCellsVisibleForTag(tag, visible) { var cells = graph.getCellsForTags([tag], null, true); var temp = []; for (var i = 0; i < cells.length; i++) { if (graph.model.isVertex(cells[i]) || graph.model.isEdge(cells[i])) { temp.push(cells[i]); } } graph.setCellsVisible(cells, visible); }; function updateSelectedTags(tags, selected, selectedColor, filter) { tagCloud.innerHTML = ''; var title = document.createElement('div'); title.style.marginBottom = '8px'; mxUtils.write(title, (filter != null) ? 'Select hidden tags:' : 'Or add/remove existing tags for cell(s):'); tagCloud.appendChild(title); var found = 0; for (var i = 0; i < tags.length; i++) { if (filter == null || tags[i].substring(0, filter.length) == filter) { var span = document.createElement('span'); span.style.display = 'inline-block'; span.style.padding = '6px 8px'; span.style.borderRadius = '6px'; span.style.marginBottom = '8px'; span.style.maxWidth = '80px'; span.style.overflow = 'hidden'; span.style.textOverflow = 'ellipsis'; span.style.cursor = 'pointer'; span.setAttribute('title', tags[i]); span.style.border = '1px solid #808080'; mxUtils.write(span, tags[i]); if (selected[tags[i]]) { span.style.background = selectedColor; span.style.color = '#ffffff'; } else { span.style.background = (Editor.isDarkMode()) ? 'transparent' : '#ffffff'; } mxEvent.addListener(span, 'click', (function(tag) { return function() { if (!selected[tag]) { if (!graph.isSelectionEmpty()) { graph.addTagsForCells(graph.getSelectionCells(), [tag]) } else { hiddenTags[tag] = true; hiddenTagCount++; refreshUi(); window.setTimeout(function() { graph.refresh(); }, 0); } } else { if (!graph.isSelectionEmpty()) { graph.removeTagsForCells(graph.getSelectionCells(), [tag]) } else { delete hiddenTags[tag]; hiddenTagCount--; refreshUi(); window.setTimeout(function() { graph.refresh(); }, 0); } } }; })(tags[i])); tagCloud.appendChild(span); mxUtils.write(tagCloud, ' '); found++; } } if (found == 0) { mxUtils.write(tagCloud, 'No tags found'); } }; function updateTagCloud(tags) { updateSelectedTags(tags, hiddenTags, '#bb0000', filterInput.value); }; function refreshUi() { if (graph.isSelectionEmpty()) { updateTagCloud(getAllTags(), hiddenTags); searchInput.style.display = 'none'; filterInput.style.display = ''; } else { updateSelectedTags(getAllTags(), getLookup(graph.getCommonTagsForCells(graph.getSelectionCells())), '#2873e1'); searchInput.style.display = ''; filterInput.style.display = 'none'; } } refreshUi(); graph.selectionModel.addListener(mxEvent.CHANGE, function(sender, evt) { refreshUi(); }); graph.model.addListener(mxEvent.CHANGE, function(sender, evt) { refreshUi(); }); mxEvent.addListener(filterInput, 'keyup', function() { updateTagCloud(getAllTags()); }); mxEvent.addListener(searchInput, 'keyup', function(evt) { if (evt.keyCode == 13) { graph.addTagsForCells(graph.getSelectionCells(), searchInput.value.toLowerCase().split(' ')); searchInput.value = ''; } }); this.window = new mxWindow(mxResources.get('hiddenTags'), div, x, y, w, null, true, true); this.window.destroyOnClose = false; this.window.setMaximizable(false); this.window.setResizable(true); this.window.setScrollable(true); this.window.setClosable(true); this.window.contentWrapper.style.overflowY = 'scroll'; this.window.addListener('show', mxUtils.bind(this, function() { this.window.fit(); if (this.window.isVisible()) { searchInput.focus(); if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5) { searchInput.select(); } else { document.execCommand('selectAll', false, null); } } else { graph.container.focus(); } })); this.window.setLocation = function(x, y) { var iw = window.innerWidth || document.body.clientWidth || document.documentElement.clientWidth; var ih = window.innerHeight || document.body.clientHeight || document.documentElement.clientHeight; x = Math.max(0, Math.min(x, iw - this.table.clientWidth)); y = Math.max(0, Math.min(y, ih - this.table.clientHeight - 48)); if (this.getX() != x || this.getY() != y) { mxWindow.prototype.setLocation.apply(this, arguments); } }; var resizeListener = mxUtils.bind(this, function() { var x = this.window.getX(); var y = this.window.getY(); this.window.setLocation(x, y); }); mxEvent.addListener(window, 'resize', resizeListener); this.destroy = function() { mxEvent.removeListener(window, 'resize', resizeListener); this.window.destroy(); } };
1
91
-1
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
3JavaScript
kex_reset_dispatch(struct ssh *ssh) { ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN, SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error); ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit); }
0
null
-1
https://github.com/openssh/openssh-portable/commit/ec165c392ca54317dbe3064a8c200de6531e89ad
0CCPP
public InternetAddress requestResetPassword(UserReference user) throws ResetPasswordException { if (this.authorizationManager.hasAccess(Right.PROGRAM)) { ResetPasswordRequestResponse resetPasswordRequestResponse = this.resetPasswordManager.requestResetPassword(user); this.resetPasswordManager.sendResetPasswordEmailRequest(resetPasswordRequestResponse); return resetPasswordRequestResponse.getUserEmail(); } else { return null; } }
1
0,6,7,8
-1
https://github.com/xwiki/xwiki-platform/commit/d8a3cce48e0ac1a0f4a3cea7a19747382d9c9494
2Java
public SVNAuthenticationProviderImpl(RemotableSVNAuthenticationProvider local, RemotableSVNAuthenticationProvider global) { this.global = global; this.local = local; }
0
null
-1
https://github.com/jenkinsci/subversion-plugin/commit/7d4562d6f7e40de04bbe29577b51c79f07d05ba6
2Java
tflite::Interpreter* GetInterpreter() { return interpreter_.get(); }
0
null
-1
https://github.com/tensorflow/tensorflow/commit/e11f55585f614645b360563072ffeb5c3eeff162
0CCPP
static int get_siz(Jpeg2000DecoderContext *s) { int i; int ncomponents; uint32_t log2_chroma_wh = 0; const enum AVPixelFormat *possible_fmts = NULL; int possible_fmts_nb = 0; if (bytestream2_get_bytes_left(&s->g) < 36) return AVERROR_INVALIDDATA; s->avctx->profile = bytestream2_get_be16u(&s->g); s->width = bytestream2_get_be32u(&s->g); s->height = bytestream2_get_be32u(&s->g); s->image_offset_x = bytestream2_get_be32u(&s->g); s->image_offset_y = bytestream2_get_be32u(&s->g); s->tile_width = bytestream2_get_be32u(&s->g); s->tile_height = bytestream2_get_be32u(&s->g); s->tile_offset_x = bytestream2_get_be32u(&s->g); s->tile_offset_y = bytestream2_get_be32u(&s->g); ncomponents = bytestream2_get_be16u(&s->g); if (ncomponents <= 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of components: %d\n", s->ncomponents); return AVERROR_INVALIDDATA; } if (ncomponents > 4) { avpriv_request_sample(s->avctx, "Support for %d components", s->ncomponents); return AVERROR_PATCHWELCOME; } s->ncomponents = ncomponents; if (s->tile_width <= 0 || s->tile_height <= 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid tile dimension %dx%d.\n", s->tile_width, s->tile_height); return AVERROR_INVALIDDATA; } if (bytestream2_get_bytes_left(&s->g) < 3 * s->ncomponents) return AVERROR_INVALIDDATA; for (i = 0; i < s->ncomponents; i++) { uint8_t x = bytestream2_get_byteu(&s->g); s->cbps[i] = (x & 0x7f) + 1; s->precision = FFMAX(s->cbps[i], s->precision); s->sgnd[i] = !!(x & 0x80); s->cdx[i] = bytestream2_get_byteu(&s->g); s->cdy[i] = bytestream2_get_byteu(&s->g); if (!s->cdx[i] || !s->cdy[i]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid sample seperation\n"); return AVERROR_INVALIDDATA; } log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2; } s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width); s->numYtiles = ff_jpeg2000_ceildiv(s->height - s->tile_offset_y, s->tile_height); if (s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(*s->tile)) { s->numXtiles = s->numYtiles = 0; return AVERROR(EINVAL); } s->tile = av_mallocz_array(s->numXtiles * s->numYtiles, sizeof(*s->tile)); if (!s->tile) { s->numXtiles = s->numYtiles = 0; return AVERROR(ENOMEM); } for (i = 0; i < s->numXtiles * s->numYtiles; i++) { Jpeg2000Tile *tile = s->tile + i; tile->comp = av_mallocz(s->ncomponents * sizeof(*tile->comp)); if (!tile->comp) return AVERROR(ENOMEM); } s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x, s->reduction_factor); s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y, s->reduction_factor); if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K || s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) { possible_fmts = xyz_pix_fmts; possible_fmts_nb = FF_ARRAY_ELEMS(xyz_pix_fmts); } else { switch (s->colour_space) { case 16: possible_fmts = rgb_pix_fmts; possible_fmts_nb = FF_ARRAY_ELEMS(rgb_pix_fmts); break; case 17: possible_fmts = gray_pix_fmts; possible_fmts_nb = FF_ARRAY_ELEMS(gray_pix_fmts); break; case 18: possible_fmts = yuv_pix_fmts; possible_fmts_nb = FF_ARRAY_ELEMS(yuv_pix_fmts); break; default: possible_fmts = all_pix_fmts; possible_fmts_nb = FF_ARRAY_ELEMS(all_pix_fmts); break; } } for (i = 0; i < possible_fmts_nb; ++i) { if (pix_fmt_match(possible_fmts[i], ncomponents, s->precision, log2_chroma_wh, s->pal8)) { s->avctx->pix_fmt = possible_fmts[i]; break; } } if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(s->avctx, AV_LOG_ERROR, "Unknown pix_fmt, profile: %d, colour_space: %d, " "components: %d, precision: %d, " "cdx[1]: %d, cdy[1]: %d, cdx[2]: %d, cdy[2]: %d\n", s->avctx->profile, s->colour_space, ncomponents, s->precision, ncomponents > 2 ? s->cdx[1] : 0, ncomponents > 2 ? s->cdy[1] : 0, ncomponents > 2 ? s->cdx[2] : 0, ncomponents > 2 ? s->cdy[2] : 0); } return 0; }
1
44
-1
https://github.com/FFmpeg/FFmpeg/commit/8bb11c3ca77b52e05a9ed1496a65f8a76e6e2d8f
0CCPP
static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; zend_long r,g,b,tmp; zend_long a = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { RETURN_FALSE; } if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) { RETURN_FALSE; } if (im_src == NULL) { RETURN_FALSE; } if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) { RETURN_TRUE; } RETURN_FALSE; }
0
null
-1
https://github.com/php/php-src/commit/28022c9b1fd937436ab67bb3d61f652c108baf96
0CCPP
void var_check_int(VAR *v) { char *endptr; char *str= v->str_val; v->int_val= 0; v->is_int= false; v->int_dirty= false; if (!str) return; v->int_val = (int) strtol(str, &endptr, 10); if (endptr > str && (!*endptr || *endptr == ' ' || *endptr == '\t')) v->is_int= true; }
0
null
-1
https://github.com/mysql/mysql-server/commit/3bd5589e1a5a93f9c224badf983cd65c45215390
0CCPP
static void _crng_backtrack_protect(struct crng_state *crng, __u8 tmp[CHACHA_BLOCK_SIZE], int used) { unsigned long flags; __u32 *s, *d; int i; used = round_up(used, sizeof(__u32)); if (used + CHACHA_KEY_SIZE > CHACHA_BLOCK_SIZE) { extract_crng(tmp); used = 0; } spin_lock_irqsave(&crng->lock, flags); s = (__u32 *) &tmp[used]; d = &crng->state[4]; for (i=0; i < 8; i++) *d++ ^= *s++; spin_unlock_irqrestore(&crng->lock, flags); }
0
null
-1
https://github.com/torvalds/linux/commit/f227e3ec3b5cad859ad15666874405e8c1bbc1d4
0CCPP
b.childNodes&&0<b.childNodes.length)for(e=0;e<b.childNodes.length;e++)d.appendChild(mxUtils.importNodeImplementation(a,b.childNodes[e],c));return d;case 3:case 4:case 8:return a.createTextNode(null!=b.nodeValue?b.nodeValue:b.value)}},createXmlDocument:function(){var a=null;document.implementation&&document.implementation.createDocument&&(a=document.implementation.createDocument("","",null));return a},parseXml:function(a){return(new DOMParser).parseFromString(a,"text/xml")},clearSelection:function(){return document.selection? function(){document.selection.empty()}:window.getSelection?function(){window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges()}:function(){}}(),removeWhitespace:function(a,b){for(a=b?a.previousSibling:a.nextSibling;null!=a&&a.nodeType==mxConstants.NODETYPE_TEXT;){var c=b?a.previousSibling:a.nextSibling,d=mxUtils.getTextContent(a);0==mxUtils.trim(d).length&&a.parentNode.removeChild(a);a=c}},htmlEntities:function(a,b){a=
1
0
-1
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
3JavaScript
static int sco_sock_listen(struct socket *sock, int backlog) { struct sock *sk = sock->sk; bdaddr_t *src = &bt_sk(sk)->src; int err = 0; BT_DBG("sk %p backlog %d", sk, backlog); lock_sock(sk); if (sk->sk_state != BT_BOUND) { err = -EBADFD; goto done; } if (sk->sk_type != SOCK_SEQPACKET) { err = -EINVAL; goto done; } write_lock(&sco_sk_list.lock); if (__sco_get_sock_listen_by_addr(src)) { err = -EADDRINUSE; goto unlock; } sk->sk_max_ack_backlog = backlog; sk->sk_ack_backlog = 0; sk->sk_state = BT_LISTEN; unlock: write_unlock(&sco_sk_list.lock); done: release_sock(sk); return err; }
0
null
-1
https://github.com/torvalds/linux/commit/c8c499175f7d295ef867335bceb9a76a2c3cdc38
0CCPP
void Compute(OpKernelContext* context) override { const Tensor& boxes = context->input(0); const Tensor& scores = context->input(1); OP_REQUIRES( context, (boxes.dim_size(0) == scores.dim_size(0)), errors::InvalidArgument("boxes and scores must have same batch size")); const Tensor& max_output_size = context->input(2); OP_REQUIRES( context, TensorShapeUtils::IsScalar(max_output_size.shape()), errors::InvalidArgument("max_size_per_class must be 0-D, got shape ", max_output_size.shape().DebugString())); const int max_size_per_class = max_output_size.scalar<int>()(); const Tensor& max_total_size = context->input(3); OP_REQUIRES( context, TensorShapeUtils::IsScalar(max_total_size.shape()), errors::InvalidArgument("max_total_size must be 0-D, got shape ", max_total_size.shape().DebugString())); const int max_total_size_per_batch = max_total_size.scalar<int>()(); OP_REQUIRES(context, max_total_size_per_batch > 0, errors::InvalidArgument("max_total_size must be > 0")); if (max_total_size_per_batch > pow(10, 6)) { LOG(WARNING) << "Detected a large value for `max_total_size`. This may " << "cause OOM error. (max_total_size: " << max_total_size.scalar<int>()() << ")"; } const Tensor& iou_threshold = context->input(4); OP_REQUIRES(context, TensorShapeUtils::IsScalar(iou_threshold.shape()), errors::InvalidArgument("iou_threshold must be 0-D, got shape ", iou_threshold.shape().DebugString())); const float iou_threshold_val = iou_threshold.scalar<float>()(); const Tensor& score_threshold = context->input(5); OP_REQUIRES( context, TensorShapeUtils::IsScalar(score_threshold.shape()), errors::InvalidArgument("score_threshold must be 0-D, got shape ", score_threshold.shape().DebugString())); const float score_threshold_val = score_threshold.scalar<float>()(); OP_REQUIRES(context, iou_threshold_val >= 0 && iou_threshold_val <= 1, errors::InvalidArgument("iou_threshold must be in [0, 1]")); int num_boxes = 0; const int num_classes = scores.dim_size(2); ParseAndCheckCombinedNMSBoxSizes(context, boxes, &num_boxes, num_classes); CheckCombinedNMSScoreSizes(context, num_boxes, scores); if (!context->status().ok()) { return; } BatchedNonMaxSuppressionOp(context, boxes, scores, num_boxes, max_size_per_class, max_total_size_per_batch, score_threshold_val, iou_threshold_val, pad_per_class_, clip_boxes_); }
1
null
-1
https://github.com/tensorflow/tensorflow/commit/b5cdbf12ffcaaffecf98f22a6be5a64bb96e4f58
0CCPP
YYYY: function (str) { return this.exec(/^\d{4}/, str); },
0
null
-1
https://github.com/knowledgecode/date-and-time/commit/9e4b501eacddccc8b1f559fb414f48472ee17c2a
3JavaScript
public virtual async Task<MkfileResponse> MkfileAsync(MkfileCommand cmd, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); var targetPath = cmd.TargetPath; var volume = targetPath.Volume; var targetHash = targetPath.HashedTarget; if (!targetPath.Directory.CanCreateObject()) throw new PermissionDeniedException(); var newFile = new FileSystemFile(Path.Combine(targetPath.Directory.FullName, cmd.Name), volume); OnBeforeMakeFile?.Invoke(this, newFile); await newFile.CreateAsync(cancellationToken: cancellationToken); OnAfterMakeFile?.Invoke(this, newFile); var mkfileResp = new MkfileResponse(); mkfileResp.added.Add(await newFile.ToFileInfoAsync(targetHash, volume, pathParser, pictureEditor, videoEditor, cancellationToken: cancellationToken)); return mkfileResp; }
1
7
-1
https://github.com/trannamtrung1st/elFinder.Net.Core/commit/5498c8a86b76ef089cfbd7ef8be014b61fa11c73
1CS
static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx)); }
1
null
-1
https://github.com/torvalds/linux/commit/3ce424e45411cf5a13105e0386b6ecf6eeb4f66f
0CCPP
def table_get_default_lang(): languages = calibre_db.speaking_language() ret = list() ret.append({"value": "all", "text": _("Show All")}) for lang in languages: ret.append({"value": lang.lang_code, "text": lang.name}) return json.dumps(ret)
0
null
-1
https://github.com/janeczku/calibre-web.git/commit/785726deee13b4d56f6c3503dd57c1e3eb7d6f30
4Python
struct timespec timespec_trunc(struct timespec t, unsigned gran) { if (gran <= jiffies_to_usecs(1) * 1000) { } else if (gran == 1000000000) { t.tv_nsec = 0; } else { t.tv_nsec -= t.tv_nsec % gran; } return t; }
0
null
-1
https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d
0CCPP
return { session: new Capnp.Capability(new ExternalWebSession(this.url, options), ApiSession) };
1
0
-1
https://github.com/sandstorm-io/sandstorm/commit/164997fb958effbc90c5328c166706280a84aaa1
3JavaScript
public void setHidden(boolean hidden) { this.doc.setHidden(hidden); }
0
null
-1
https://github.com/xwiki/xwiki-platform/commit/7ab0fe7b96809c7a3881454147598d46a1c9bbbe
2Java
mxGraph.prototype.getAllEdges=function(a){var b=[];if(null!=a)for(var c=0;c<a.length;c++){for(var d=this.model.getEdgeCount(a[c]),e=0;e<d;e++)b.push(this.model.getEdgeAt(a[c],e));d=this.model.getChildren(a[c]);b=b.concat(this.getAllEdges(d))}return b};mxGraph.prototype.updateCellSize=function(a,b){b=null!=b?b:!1;this.model.beginUpdate();try{this.cellSizeUpdated(a,b),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",a,"ignoreChildren",b))}finally{this.model.endUpdate()}return a};
0
null
-1
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
3JavaScript
async def get_file( self, destination: str, path: str, output_stream, args: Optional[QueryArgs] = None, retry_on_dns_fail: bool = True, max_size: Optional[int] = None, ignore_backoff: bool = False, ) -> Tuple[int, Dict[bytes, List[bytes]]]: request = MatrixFederationRequest( method="GET", destination=destination, path=path, query=args ) response = await self._send_request( request, retry_on_dns_fail=retry_on_dns_fail, ignore_backoff=ignore_backoff ) headers = dict(response.headers.getAllRawHeaders()) try: d = readBodyToFile(response, output_stream, max_size) d.addTimeout(self.default_timeout, self.reactor) length = await make_deferred_yieldable(d) except Exception as e: logger.warning( "{%s} [%s] Error reading response: %s", request.txn_id, request.destination, e, ) raise logger.info( "{%s} [%s] Completed: %d %s [%d bytes] %s %s", request.txn_id, request.destination, response.code, response.phrase.decode("ascii", errors="replace"), length, request.method, request.uri.decode("ascii"), ) return (length, headers)
1
18
-1
https://github.com/matrix-org/synapse.git/commit/ff5c4da1289cb5e097902b3e55b771be342c29d6
4Python
JsVar *jspeBinaryExpression() { return __jspeBinaryExpression(jspeUnaryExpression(),0); }
0
null
-1
https://github.com/espruino/Espruino/commit/bf4416ab9129ee3afd56739ea4e3cd0da5484b6b
0CCPP
def del_project(request, client_id, project): if request.method == "GET": client = Client.objects.get(id=client_id) try: scrapyd = get_scrapyd(client) result = scrapyd.delete_project(project=project) return JsonResponse(result) except ConnectionError: return JsonResponse({"message": "Connect Error"})
1
3,4,5,6,7,8
-1
https://github.com/Gerapy/Gerapy.git/commit/e8446605eb2424717418eae199ec7aad573da2d2
4Python
pci_lintr_route(struct pci_vdev *dev) { struct businfo *bi; struct intxinfo *ii; if (dev->lintr.pin == 0) return; bi = pci_businfo[dev->bus]; assert(bi != NULL); ii = &bi->slotinfo[dev->slot].si_intpins[dev->lintr.pin - 1]; if (ii->ii_ioapic_irq == 0) ii->ii_ioapic_irq = ioapic_pci_alloc_irq(dev); assert(ii->ii_ioapic_irq > 0); if (ii->ii_pirq_pin == 0) ii->ii_pirq_pin = pirq_alloc_pin(dev); assert(ii->ii_pirq_pin > 0); dev->lintr.ioapic_irq = ii->ii_ioapic_irq; dev->lintr.pirq_pin = ii->ii_pirq_pin; pci_set_cfgdata8(dev, PCIR_INTLINE, pirq_irq(ii->ii_pirq_pin)); }
1
7,11,14
-1
https://github.com/projectacrn/acrn-hypervisor/commit/2b3dedfb9ba13f15887f22b935d373f36c9a59fa
0CCPP
static inline unsigned short queue_logical_block_size(struct request_queue *q) { int retval = 512; if (q && q->limits.logical_block_size) retval = q->limits.logical_block_size; return retval; }
0
null
-1
https://github.com/torvalds/linux/commit/0bfc96cb77224736dfa35c3c555d37b3646ef35e
0CCPP
buttonsNotGone = `Should disappear: ${JSON.stringify(stillVisible)}`; } await this.#br.refresh(); await this.adminArea.review.waitUntilLoaded(); }, {
0
null
-1
https://github.com/debiki/talkyard/commit/b0310df019887f3464895529c773bc7d85ddcf34
5TypeScript
const writeStream = async (filePath, data) => pipeline(data, external_node_fs_.createWriteStream(filePath));
0
null
-1
https://github.com/fastify/github-action-merge-dependabot/commit/309f39539c5d918d8a47075587aa8720a9c127f7
3JavaScript
public final HColor getBackColor(ISkinParam skinParam, Style style) { if (colors == null || colors.getColor(ColorType.BACK) == null) { if (UseStyle.useBetaStyle() == false) return HColorUtils.COL_D7E0F2; return style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } return colors.getColor(ColorType.BACK); }
1
1,2,3,5
-1
https://github.com/plantuml/plantuml/commit/93e5964e5f35914f3f7b89de620c596795550083
2Java
mxCoordinateAssignment.prototype.localEdgeProcessing=function(a){for(var b=0;b<a.ranks.length;b++)for(var c=a.ranks[b],d=0;d<c.length;d++){var e=c[d];if(e.isVertex())for(var f=e.getPreviousLayerConnectedCells(b),g=b-1,k=0;2>k;k++){if(-1<g&&g<a.ranks.length&&null!=f&&0<f.length){for(var l=[],m=0;m<f.length;m++){var n=new WeightedCellSorter(f[m],f[m].getX(g));l.push(n)}l.sort(WeightedCellSorter.prototype.compare);n=e.x[0]-e.width/2;var p=n+e.width,q=f=0;g=[];for(m=0;m<l.length;m++){var r=l[m].cell; if(r.isVertex()){var t=0==k?e.connectsAsSource:e.connectsAsTarget;for(var u=0;u<t.length;u++)if(t[u].source==r||t[u].target==r)f+=t[u].edges.length,q++,g.push(t[u])}else f+=r.edges.length,q++,g.push(r)}e.width>(f+1)*this.prefHozEdgeSep+2*this.prefHozEdgeSep&&(n+=this.prefHozEdgeSep,p-=this.prefHozEdgeSep);l=(p-n)/f;n+=l/2;p=this.minEdgeJetty-this.prefVertEdgeOff;for(m=0;m<g.length;m++)for(q=g[m].edges.length,r=this.jettyPositions[g[m].ids[0]],null==r&&(r=[],this.jettyPositions[g[m].ids[0]]=r),m<f/ 2?p+=this.prefVertEdgeOff:m>f/2&&(p-=this.prefVertEdgeOff),t=0;t<q;t++)r[4*t+2*k]=n,n+=l,r[4*t+2*k+1]=p}f=e.getNextLayerConnectedCells(b);g=b+1}}};
0
null
-1
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
3JavaScript
const getConfigFromFile = () => { const path = getConfigPath() if (!path) return {} const rawdata = fs.readFileSync(getConfigPath()) return JSON.parse(rawdata) }
0
null
-1
https://github.com/transloadit/uppy/commit/267c34045a1e62c98406d8c31261c604a11e544a
3JavaScript
index:J,defVal:ja.defVal,countProperty:ja.countProperty,size:ja.size},0==J%2,ja.flipBkg),E.parentNode.insertBefore(Ga,E.nextSibling),E=Ga;u.appendChild(va);ra();return u};StyleFormatPanel.prototype.addStyles=function(u){function E(ja){mxEvent.addListener(ja,"mouseenter",function(){ja.style.opacity="1"});mxEvent.addListener(ja,"mouseleave",function(){ja.style.opacity="0.5"})}var J=this.editorUi,T=J.editor.graph,N=document.createElement("div");N.style.whiteSpace="nowrap";N.style.paddingLeft="24px";
1
0
-1
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
3JavaScript
def http_reflect_with_auth( allow_scheme, allow_credentials, out_renew_nonce=None, out_requests=None ): glastnc = [None] gnextnonce = [None] gserver_nonce = [gen_digest_nonce(salt=b"n")] realm = "httplib2 test" server_opaque = gen_digest_nonce(salt=b"o") def renew_nonce(): if gnextnonce[0]: assert False, "previous nextnonce was not used, probably bug in test code" gnextnonce[0] = gen_digest_nonce() return gserver_nonce[0], gnextnonce[0] if out_renew_nonce: out_renew_nonce[0] = renew_nonce def deny(**kwargs): nonce_stale = kwargs.pop("nonce_stale", False) if nonce_stale: kwargs.setdefault("body", b"nonce stale") if allow_scheme == "basic": authenticate = 'basic realm="{realm}"'.format(realm=realm) elif allow_scheme == "digest": authenticate = ( 'digest realm="{realm}", qop="auth"' + ', nonce="{nonce}", opaque="{opaque}"' + (", stale=true" if nonce_stale else "") ).format(realm=realm, nonce=gserver_nonce[0], opaque=server_opaque) elif allow_scheme == "wsse": authenticate = 'wsse realm="{realm}", profile="UsernameToken"'.format( realm=realm ) else: raise Exception("unknown allow_scheme={0}".format(allow_scheme)) deny_headers = {"www-authenticate": authenticate} kwargs.setdefault("status", 401) deny_headers.update(kwargs.get("headers", {})) kwargs["headers"] = deny_headers kwargs.setdefault("body", b"HTTP authorization required") return http_response_bytes(**kwargs) @store_request_response(out_requests) def http_reflect_with_auth_handler(request): auth_header = request.headers.get("authorization", "") if not auth_header: return deny() if " " not in auth_header: return http_response_bytes( status=400, body=b"authorization header syntax error" ) scheme, data = auth_header.split(" ", 1) scheme = scheme.lower() if scheme != allow_scheme: return deny(body=b"must use different auth scheme") if scheme == "basic": decoded = base64.b64decode(data).decode() username, password = decoded.split(":", 1) if (username, password) in allow_credentials: return make_http_reflect()(request) else: return deny(body=b"supplied credentials are not allowed") elif scheme == "digest": server_nonce_old = gserver_nonce[0] nextnonce = gnextnonce[0] if nextnonce: gserver_nonce[0] = nextnonce gnextnonce[0] = None server_nonce_current = gserver_nonce[0] auth_info = http_parse_auth(data) client_cnonce = auth_info.get("cnonce", "") client_nc = auth_info.get("nc", "") client_nonce = auth_info.get("nonce", "") client_opaque = auth_info.get("opaque", "") client_qop = auth_info.get("qop", "auth").strip('"') hasher = hashlib.md5 ha2 = hasher(":".join((request.method, request.uri)).encode()).hexdigest() if client_nonce != server_nonce_current: if client_nonce == server_nonce_old: return deny(nonce_stale=True) return deny(body=b"invalid nonce") if not client_nc: return deny(body=b"auth-info nc missing") if client_opaque != server_opaque: return deny( body="auth-info opaque mismatch expected={} actual={}".format( server_opaque, client_opaque ).encode() ) for allow_username, allow_password in allow_credentials: ha1 = hasher( ":".join( (allow_username, realm, allow_password) ).encode() ).hexdigest() allow_response = hasher( ":".join( ( ha1, client_nonce, client_nc, client_cnonce, client_qop, ha2, ) ).encode() ).hexdigest() rspauth_ha2 = hasher(":{}".format(request.uri).encode()).hexdigest() rspauth = hasher( ":".join( ( ha1, client_nonce, client_nc, client_cnonce, client_qop, rspauth_ha2, ) ).encode() ).hexdigest() if auth_info.get("response", "") == allow_response: glastnc[0] = client_nc allow_headers = { "authentication-info": " ".join( ( 'nextnonce="{}"'.format(nextnonce) if nextnonce else "", "qop={}".format(client_qop), 'rspauth="{}"'.format(rspauth), 'cnonce="{}"'.format(client_cnonce), "nc={}".format(client_nc), ) ).strip() } return make_http_reflect(headers=allow_headers)(request) return deny(body=b"supplied credentials are not allowed") elif scheme == "wsse": x_wsse = request.headers.get("x-wsse", "") if x_wsse.count(",") != 3: return http_response_bytes( status=400, body=b"x-wsse header syntax error" ) auth_info = http_parse_auth(x_wsse) client_username = auth_info.get("username", "") client_nonce = auth_info.get("nonce", "") client_created = auth_info.get("created", "") client_digest = auth_info.get("passworddigest", "") allow_password = None for allow_username, allow_password in allow_credentials: if client_username == allow_username: break else: return deny(body=b"unknown username") digest = hashlib.sha1( "".join((client_nonce, client_created, allow_password)).encode("utf-8") ).digest() digest_b64 = base64.b64encode(digest).decode() print( "$$$ check client={} == real={}".format(client_digest, digest_b64) ) if client_digest == digest_b64: return make_http_reflect()(request) return deny(body=b"supplied credentials are not allowed") else: return http_response_bytes( status=400, body="unknown authorization scheme={0}".format(scheme).encode(), ) return http_reflect_with_auth_handler
1
48,52,53,57,70,86,87,88,91,94,95,97,105,106,110,111,112,113,114,115,116,117,118,119,124,131,142,143,144,145,146,159
-1
https://github.com/httplib2/httplib2.git/commit/bd9ee252c8f099608019709e22c0d705e98d26bc
4Python
Da.addListener("stateChanged",function(){La.style.opacity=Da.enabled?"":"0.1"});var Aa=function(){Na.style.display=0<F.editor.undoManager.history.length||H.isEditing()?"inline-block":"none";Fa.style.display=Na.style.display;Na.style.opacity=za.enabled?"":"0.1";Fa.style.opacity=Ga.enabled?"":"0.1"};Q.appendChild(Na);Q.appendChild(Fa);za.addListener("stateChanged",Aa);Ga.addListener("stateChanged",Aa);Aa();var ta=this.createPageMenuTab(!1,!0);ta.style.display="none";ta.style.position="";ta.style.marginLeft=
1
0
-1
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
3JavaScript
mxFloorplanWallCorner.prototype.paintVertexShape=function(a,d,e,b,c){a.translate(d,e);this.background(a,d,e,b,c)};mxFloorplanWallCorner.prototype.background=function(a,d,e,b,c){d=parseFloat(mxUtils.getValue(this.style,mxFloorplanWallCorner.prototype.cst.WALL_THICKNESS,"10"));a.begin();a.moveTo(0,c);a.lineTo(0,0);a.lineTo(b,0);a.lineTo(b,d);a.lineTo(d,d);a.lineTo(d,c);a.close();a.fillAndStroke()};mxCellRenderer.registerShape(mxFloorplanWallCorner.prototype.cst.WALL_CORNER,mxFloorplanWallCorner);
0
null
-1
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
3JavaScript
def whitelist(allow_guest=False, xss_safe=False, methods=None): if not methods: methods = ["GET", "POST", "PUT", "DELETE"] def innerfn(fn): global whitelisted, guest_methods, xss_safe_methods, allowed_http_methods_for_whitelisted_func whitelisted.append(fn) allowed_http_methods_for_whitelisted_func[fn] = methods if allow_guest: guest_methods.append(fn) if xss_safe: xss_safe_methods.append(fn) return fn return innerfn
1
6
-1
https://github.com/frappe/frappe.git/commit/497ea861f481c6a3c52fe2aed9d0df1b6c99e9d7
4Python
int vb2_fop_release(struct file *file) { struct video_device *vdev = video_devdata(file); struct mutex *lock = vdev->queue->lock ? vdev->queue->lock : vdev->lock; return _vb2_fop_release(file, lock); }
0
null
-1
https://github.com/torvalds/linux/commit/2c1f6951a8a82e6de0d82b1158b5e493fc6c54ab
0CCPP
error_t smtpClientRegisterTlsInitCallback(SmtpClientContext *context, SmtpClientTlsInitCallback callback) { if(context == NULL || callback == NULL) return ERROR_INVALID_PARAMETER; context->tlsInitCallback = callback; return NO_ERROR; }
0
null
-1
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
0CCPP
static noinline __kprobes int vmalloc_fault(unsigned long address) { pgd_t *pgd, *pgd_ref; pud_t *pud, *pud_ref; pmd_t *pmd, *pmd_ref; pte_t *pte, *pte_ref; if (!(address >= VMALLOC_START && address < VMALLOC_END)) return -1; WARN_ON_ONCE(in_nmi()); pgd = pgd_offset(current->active_mm, address); pgd_ref = pgd_offset_k(address); if (pgd_none(*pgd_ref)) return -1; if (pgd_none(*pgd)) set_pgd(pgd, *pgd_ref); else BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); pud = pud_offset(pgd, address); pud_ref = pud_offset(pgd_ref, address); if (pud_none(*pud_ref)) return -1; if (pud_none(*pud) || pud_page_vaddr(*pud) != pud_page_vaddr(*pud_ref)) BUG(); pmd = pmd_offset(pud, address); pmd_ref = pmd_offset(pud_ref, address); if (pmd_none(*pmd_ref)) return -1; if (pmd_none(*pmd) || pmd_page(*pmd) != pmd_page(*pmd_ref)) BUG(); pte_ref = pte_offset_kernel(pmd_ref, address); if (!pte_present(*pte_ref)) return -1; pte = pte_offset_kernel(pmd, address); if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) BUG(); return 0; }
0
null
-1
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
0CCPP
static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, void __user *arg) { int ret = 0; int size; struct btrfs_ioctl_logical_ino_args *loi; struct btrfs_data_container *inodes = NULL; struct btrfs_path *path = NULL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; loi = memdup_user(arg, sizeof(*loi)); if (IS_ERR(loi)) { ret = PTR_ERR(loi); loi = NULL; goto out; } path = btrfs_alloc_path(); if (!path) { ret = -ENOMEM; goto out; } size = min_t(u32, loi->size, 64 * 1024); inodes = init_data_container(size); if (IS_ERR(inodes)) { ret = PTR_ERR(inodes); inodes = NULL; goto out; } ret = iterate_inodes_from_logical(loi->logical, root->fs_info, path, build_ino_list, inodes); if (ret == -EINVAL) ret = -ENOENT; if (ret < 0) goto out; ret = copy_to_user((void *)(unsigned long)loi->inodes, (void *)(unsigned long)inodes, size); if (ret) ret = -EFAULT; out: btrfs_free_path(path); vfree(inodes); kfree(loi); return ret; }
0
null
-1
https://github.com/torvalds/linux/commit/9c52057c698fb96f8f07e7a4bcf4801a092bda89
0CCPP
function mxChildChange(a,b,c,d){this.model=a;this.previous=this.parent=b;this.child=c;this.previousIndex=this.index=d}
0
null
-1
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
3JavaScript
def bom_items(self): return self.part.get_bom_items()
0
null
-1
https://github.com/inventree/inventree.git/commit/63b4ff3eb6e80861962fafe79c9b483cd7239d6c
4Python
Status MaybeUpdateNodeContextOutput(const NodeDef& node, const bool is_fed, NodeContext* c) { InferenceContext* ic = c->inference_context.get(); if (!is_fed) { if (IsConstant(node)) { const TensorProto& tensor_proto = node.attr().at("value").tensor(); c->output_tensor_protos.resize(1); c->output_tensor_protos[0] = &tensor_proto; c->output_tensors_as_shapes.resize(1); MaybeTensorProtoToShape(ic, tensor_proto, &c->output_tensors_as_shapes[0]); } else if (IsRank(node)) { if (ic->RankKnown(ic->input(0))) { int32_t rank = ic->Rank(ic->input(0)); const_tensors_to_propagate_.push_back( MakeIntegerScalarTensorProto(DT_INT32, rank)); c->output_tensor_protos.resize(1); c->output_tensor_protos[0] = &const_tensors_to_propagate_.back(); } } else if (IsSize(node)) { DimensionHandle size = ic->NumElements(ic->input(0)); if (ic->ValueKnown(size)) { int64_t sz = ic->Value(size); bool valid = false; if (node.attr().at("out_type").type() == DT_INT32) { if (sz < std::numeric_limits<int32>::max()) { const_tensors_to_propagate_.push_back( MakeIntegerScalarTensorProto(DT_INT32, sz)); valid = true; } } else { const_tensors_to_propagate_.push_back( MakeIntegerScalarTensorProto(DT_INT64, sz)); valid = true; } if (valid) { c->output_tensor_protos.resize(1); c->output_tensor_protos[0] = &const_tensors_to_propagate_.back(); } } } else if (IsShape(node)) { c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = c->inference_context->input(0); } else if (IsShapeN(node)) { c->output_tensors_as_shapes.resize(c->inference_context->num_inputs()); for (int i = 0; i < c->inference_context->num_inputs(); ++i) { c->output_tensors_as_shapes[i] = c->inference_context->input(i); } } else if (node.op() == "ConcatV2") { bool valid = true; ShapeHandle result; for (int i = 0; i < ic->num_inputs() - 1; ++i) { ShapeHandle input = c->input_tensors_as_shapes_to_propagate[i]; if (!ic->RankKnown(input)) { valid = false; break; } else if (i == 0) { result = input; } else { TF_RETURN_IF_ERROR(ic->Concatenate(result, input, &result)); } } if (valid) { c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = result; } } else if (IsPack(node)) { std::vector<DimensionHandle> dims; bool valid = true; for (int i = 0; i < ic->num_inputs(); ++i) { const Tensor* t = ic->input_tensor(i); if (t) { if (t->dims() != 0 || (t->dtype() != DT_INT32 && t->dtype() != DT_INT64)) { valid = false; break; } int64_t size = t->dtype() == DT_INT32 ? t->scalar<int32>()() : t->scalar<int64_t>()(); dims.push_back(size < 0 ? ic->MakeDim(kUnknownDimFromConst) : ic->MakeDim(size)); } else { const ShapeHandle& shape_handle = c->input_tensors_as_shapes_to_propagate[i]; if (ic->RankKnown(shape_handle) && ic->Rank(shape_handle) >= 1 && ic->ValueKnown(ic->Dim(shape_handle, 0))) { dims.push_back(ic->Dim(shape_handle, 0)); } else { dims.push_back(ic->MakeDim(kUnknownDimFromConst)); } } } if (valid) { c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = ic->MakeShape(dims); } } else if (IsIdentity(node) || IsIdentityNSingleInput(node)) { c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = c->input_tensors_as_shapes_to_propagate[0]; if (c->input_tensor_protos[0] != nullptr) { c->output_tensor_protos.resize(1); c->output_tensor_protos[0] = c->input_tensor_protos[0]; } } else if (IsSlice(node)) { ShapeHandle input = c->input_tensors_as_shapes_to_propagate[0]; bool valid = ic->RankKnown(input); const Tensor* slice_offset = ic->input_tensor(1); valid &= slice_offset != nullptr && slice_offset->NumElements() == 1; const Tensor* slice_size = ic->input_tensor(2); valid &= slice_size != nullptr && slice_size->NumElements() == 1; if (valid) { int64_t start = slice_offset->dtype() == DT_INT32 ? slice_offset->flat<int32>()(0) : slice_offset->flat<int64_t>()(0); int64_t size = (slice_size->dtype() == DT_INT32 ? slice_size->flat<int32>()(0) : slice_size->flat<int64_t>()(0)); ShapeHandle result; if (size == -1) { TF_RETURN_IF_ERROR(ic->Subshape(input, start, &result)); } else { int64_t end = start + size; TF_RETURN_IF_ERROR(ic->Subshape(input, start, end, &result)); } c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = result; } } else if (IsStridedSlice(node)) { ShapeHandle input = c->input_tensors_as_shapes_to_propagate[0]; bool valid = ic->RankKnown(input); const Tensor* slice_begin = ic->input_tensor(1); valid &= slice_begin != nullptr && slice_begin->NumElements() == 1; const Tensor* slice_end = ic->input_tensor(2); valid &= slice_end != nullptr && slice_end->NumElements() == 1; const Tensor* slice_stride = ic->input_tensor(3); valid &= slice_stride != nullptr && slice_stride->NumElements() == 1; if (node.attr().count("ellipsis_mask") > 0 && node.attr().at("ellipsis_mask").i() != 0) { valid = false; } if (node.attr().count("new_axis_mask") > 0 && node.attr().at("new_axis_mask").i() != 0) { valid = false; } if (node.attr().count("shrink_axis_mask") > 0 && node.attr().at("shrink_axis_mask").i() != 0) { valid = false; } int begin_mask = 0; if (node.attr().count("begin_mask") > 0) { begin_mask = node.attr().at("begin_mask").i(); } int end_mask = 0; if (node.attr().count("end_mask") > 0) { end_mask = node.attr().at("end_mask").i(); } if (begin_mask < 0 || begin_mask > 1 || end_mask < 0 || end_mask > 1) { valid = false; } if (valid) { int64_t begin = 0; if (begin_mask == 0) { begin = slice_begin->dtype() == DT_INT32 ? slice_begin->flat<int32>()(0) : slice_begin->flat<int64_t>()(0); } int64_t end = std::numeric_limits<int64_t>::max(); if (end_mask == 0) { end = (slice_end->dtype() == DT_INT32 ? slice_end->flat<int32>()(0) : slice_end->flat<int64_t>()(0)); } int64_t stride = slice_stride->dtype() == DT_INT32 ? slice_stride->flat<int32>()(0) : slice_stride->flat<int64_t>()(0); ShapeHandle result; TF_RETURN_IF_ERROR(ic->Subshape(input, begin, end, stride, &result)); c->output_tensors_as_shapes.resize(1); c->output_tensors_as_shapes[0] = result; } } } if (aggressive_shape_inference_) { UpdateOutputShapesUsingAnnotatedInformation(node, c).IgnoreError(); const int max_element_size = 17; if (AllOutputValuesKnown(c) || !AllInputValuesKnown(c) || !ShouldUpdateOutputShapesAndValues(c, max_element_size)) { return Status::OK(); } UpdateOutputShapesAndValues(node, c).IgnoreError(); } return Status::OK(); }
0
null
-1
https://github.com/tensorflow/tensorflow/commit/97282c6d0d34476b6ba033f961590b783fa184cd
0CCPP
static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info, void __user *arg, int version) { int ret = 0; int size; struct btrfs_ioctl_logical_ino_args *loi; struct btrfs_data_container *inodes = NULL; struct btrfs_path *path = NULL; bool ignore_offset; if (!capable(CAP_SYS_ADMIN)) return -EPERM; loi = memdup_user(arg, sizeof(*loi)); if (IS_ERR(loi)) return PTR_ERR(loi); if (version == 1) { ignore_offset = false; size = min_t(u32, loi->size, SZ_64K); } else { if (memchr_inv(loi->reserved, 0, sizeof(loi->reserved))) { ret = -EINVAL; goto out_loi; } if (loi->flags & ~(BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET)) { ret = -EINVAL; goto out_loi; } ignore_offset = loi->flags & BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET; size = min_t(u32, loi->size, SZ_16M); } path = btrfs_alloc_path(); if (!path) { ret = -ENOMEM; goto out; } inodes = init_data_container(size); if (IS_ERR(inodes)) { ret = PTR_ERR(inodes); inodes = NULL; goto out; } ret = iterate_inodes_from_logical(loi->logical, fs_info, path, build_ino_list, inodes, ignore_offset); if (ret == -EINVAL) ret = -ENOENT; if (ret < 0) goto out; ret = copy_to_user((void __user *)(unsigned long)loi->inodes, inodes, size); if (ret) ret = -EFAULT; out: btrfs_free_path(path); kvfree(inodes); out_loi: kfree(loi); return ret; }
0
null
-1
https://github.com/torvalds/linux/commit/09ba3bc9dd150457c506e4661380a6183af651c1
0CCPP
context.suite.only = function(title, fn){ var suite = context.suite(title, fn); mocha.grep(suite.fullTitle()); };
1
0
-1
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
3JavaScript
check_symlinks(struct archive_write_disk *a) { #if !defined(HAVE_LSTAT) (void)a; return (ARCHIVE_OK); #else char *pn; char c; int r; struct stat st; /* Whatever we checked last time doesn't need to be re-checked. */ pn = a->name; if (archive_strlen(&(a->path_safe)) > 0) { char *p = a->path_safe.s; while ((*pn != '\0') && (*p == *pn)) ++p, ++pn; } if(pn == a->name && pn[0] == '/') ++pn; c = pn[0]; /* Keep going until we've checked the entire name. */ while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) { while (*pn != '\0' && *pn != '/') ++pn; c = pn[0]; pn[0] = '\0'; r = lstat(a->name, &st); if (r != 0) { if (errno == ENOENT) { break; } else { /* Note: This effectively disables deep directory * support when security checks are enabled. * Otherwise, very long pathnames that trigger * an error here could evade the sandbox. * TODO: We could do better, but it would probably * require merging the symlink checks with the * deep-directory editing. */ return (ARCHIVE_FAILED); } } else if (S_ISLNK(st.st_mode)) { if (c == '\0') { if (unlink(a->name)) { archive_set_error(&a->archive, errno, "Could not remove symlink %s", a->name); pn[0] = c; return (ARCHIVE_FAILED); } a->pst = NULL; if (!S_ISLNK(a->mode)) { archive_set_error(&a->archive, 0, "Removing symlink %s", a->name); } pn[0] = c; return (0); } else if (a->flags & ARCHIVE_EXTRACT_UNLINK) { if (unlink(a->name) != 0) { archive_set_error(&a->archive, 0, "Cannot remove intervening symlink %s", a->name); pn[0] = c; return (ARCHIVE_FAILED); } a->pst = NULL; } else { archive_set_error(&a->archive, 0, "Cannot extract through symlink %s", a->name); pn[0] = c; return (ARCHIVE_FAILED); } } pn[0] = c; if (pn[0] != '\0') pn++; /* } pn[0] = c; /* We've checked and/or cleaned the whole path, so remember it. */ archive_strcpy(&a->path_safe, a->name); return (ARCHIVE_OK); #endif }
1
0,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,31,38,41,42,43,44,45,46,47,49,50,51,52,53,55,56,57,58,59,60,61,62,63,65,67,68,69,70,71,74,75,76,78,79,80,81
-1
https://github.com/libarchive/libarchive/commit/dfd6b54ce33960e420fb206d8872fb759b577ad9
0CCPP
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; nCoeffs= s->block_last_index[n]; quant_matrix = s->inter_matrix; for(i=0; i<=nCoeffs; i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; level = (level - 1) | 1; level = -level; } else { level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; level = (level - 1) | 1; } block[j] = level; } } }
0
null
-1
https://github.com/FFmpeg/FFmpeg/commit/b3332a182f8ba33a34542e4a0370f38b914ccf7d
0CCPP
scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk) { tui32 version = 0; tui32 size; struct SCP_SESSION *session = 0; tui16 sz; tui32 code = 0; char *buf = 0; if (!skipVchk) { LOG_DBG("[v0:%d] starting connection", __LINE__); if (0 == scp_tcp_force_recv(c->in_sck, c->in_s->data, 8)) { c->in_s->end = c->in_s->data + 8; in_uint32_be(c->in_s, version); if (version != 0) { log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: version error", __LINE__); return SCP_SERVER_STATE_VERSION_ERR; } } else { log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); return SCP_SERVER_STATE_NETWORK_ERR; } } in_uint32_be(c->in_s, size); init_stream(c->in_s, 8196); if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8)) { log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); return SCP_SERVER_STATE_NETWORK_ERR; } c->in_s->end = c->in_s->data + (size - 8); in_uint16_be(c->in_s, code); if (code == 0 || code == 10 || code == 20) { session = scp_session_create(); if (0 == session) { log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); return SCP_SERVER_STATE_INTERNAL_ERR; } scp_session_set_version(session, version); if (code == 0) { scp_session_set_type(session, SCP_SESSION_TYPE_XVNC); } else if (code == 10) { scp_session_set_type(session, SCP_SESSION_TYPE_XRDP); } else if (code == 20) { scp_session_set_type(session, SCP_SESSION_TYPE_XORG); } in_uint16_be(c->in_s, sz); buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; if (0 != scp_session_set_username(session, buf)) { scp_session_destroy(session); log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting username", __LINE__); g_free(buf); return SCP_SERVER_STATE_INTERNAL_ERR; } g_free(buf); in_uint16_be(c->in_s, sz); buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; if (0 != scp_session_set_password(session, buf)) { scp_session_destroy(session); log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting password", __LINE__); g_free(buf); return SCP_SERVER_STATE_INTERNAL_ERR; } g_free(buf); /* width */ in_uint16_be(c->in_s, sz); scp_session_set_width(session, sz); /* height */ in_uint16_be(c->in_s, sz); scp_session_set_height(session, sz); /* bpp */ in_uint16_be(c->in_s, sz); if (0 != scp_session_set_bpp(session, (tui8)sz)) { scp_session_destroy(session); log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: unsupported bpp: %d", __LINE__, (tui8)sz); return SCP_SERVER_STATE_INTERNAL_ERR; } if (s_check_rem(c->in_s, 2)) { in_uint16_be(c->in_s, sz); if (sz > 0) { buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; scp_session_set_domain(session, buf); g_free(buf); } } if (s_check_rem(c->in_s, 2)) { in_uint16_be(c->in_s, sz); if (sz > 0) { buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; scp_session_set_program(session, buf); g_free(buf); } } if (s_check_rem(c->in_s, 2)) { in_uint16_be(c->in_s, sz); if (sz > 0) { buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; scp_session_set_directory(session, buf); g_free(buf); } } if (s_check_rem(c->in_s, 2)) { in_uint16_be(c->in_s, sz); if (sz > 0) { buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; scp_session_set_client_ip(session, buf); g_free(buf); } } } else if (code == SCP_GW_AUTHENTICATION) { /* g_writeln("Command is SCP_GW_AUTHENTICATION"); */ session = scp_session_create(); if (0 == session) { /* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);*/ return SCP_SERVER_STATE_INTERNAL_ERR; } scp_session_set_version(session, version); scp_session_set_type(session, SCP_GW_AUTHENTICATION); in_uint16_be(c->in_s, sz); buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; if (0 != scp_session_set_username(session, buf)) { scp_session_destroy(session); g_free(buf); return SCP_SERVER_STATE_INTERNAL_ERR; } g_free(buf); in_uint16_be(c->in_s, sz); buf = g_new0(char, sz + 1); in_uint8a(c->in_s, buf, sz); buf[sz] = '\0'; if (0 != scp_session_set_password(session, buf)) { scp_session_destroy(session); g_free(buf); return SCP_SERVER_STATE_INTERNAL_ERR; } g_free(buf); } else { log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: sequence error", __LINE__); return SCP_SERVER_STATE_SEQUENCE_ERR; } (*s) = session; return SCP_SERVER_STATE_OK; }
1
0,2,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,38,39,40,41,42,43,44,57,58,59,60,63,65,68,69,70,71,72,75,77,80,81,82,83,84,85,86,87,88,89,91,94,99,100,102,103,104,106,111,112,114,115,116,118,123,124,126,127,128,130,135,136,138,139,140,142,148,149,150,151,152,153,154,155,157,158,159,160,163,164,167,168,169,170,171,174,175,178,185
-1
https://github.com/neutrinolabs/xrdp/commit/e593f58a82bf79b556601ae08e9e25e366a662fb
0CCPP
void CLASS tiff_get(unsigned base, unsigned *tag, unsigned *type, unsigned *len, unsigned *save) { #ifdef LIBRAW_IOSPACE_CHECK INT64 pos = ftell(ifp); INT64 fsize = ifp->size(); if(fsize < 12 || (fsize-pos) < 12) throw LIBRAW_EXCEPTION_IO_EOF; #endif *tag = get2(); *type = get2(); *len = get4(); *save = ftell(ifp) + 4; if (*len * ("11124811248484"[*type < 14 ? *type : 0] - '0') > 4) fseek(ifp, get4() + base, SEEK_SET); }
0
null
-1
https://github.com/LibRaw/LibRaw/commit/e47384546b43d0fd536e933249047bc397a4d88b
0CCPP
static inline bool netif_is_bridge_master(const struct net_device *dev) { return dev->priv_flags & IFF_EBRIDGE; }
0
null
-1
https://github.com/torvalds/linux/commit/fac8e0f579695a3ecbc4d3cac369139d7f819971
0CCPP
def _configuration_oauth_helper(to_save): active_oauths = 0 reboot_required = False for element in oauthblueprints: if ( to_save["config_" + str(element["id"]) + "_oauth_client_id"] != element["oauth_client_id"] or to_save["config_" + str(element["id"]) + "_oauth_client_secret"] != element["oauth_client_secret"] ): reboot_required = True element["oauth_client_id"] = to_save[ "config_" + str(element["id"]) + "_oauth_client_id" ] element["oauth_client_secret"] = to_save[ "config_" + str(element["id"]) + "_oauth_client_secret" ] if ( to_save["config_" + str(element["id"]) + "_oauth_client_id"] and to_save["config_" + str(element["id"]) + "_oauth_client_secret"] ): active_oauths += 1 element["active"] = 1 else: element["active"] = 0 ub.session.query(ub.OAuthProvider).filter( ub.OAuthProvider.id == element["id"] ).update( { "oauth_client_id": to_save[ "config_" + str(element["id"]) + "_oauth_client_id" ], "oauth_client_secret": to_save[ "config_" + str(element["id"]) + "_oauth_client_secret" ], "active": element["active"], } ) return reboot_required
1
9,20
-1
https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367
4Python
int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) { int i; int num_frags = skb_shinfo(skb)->nr_frags; struct page *page, *head = NULL; struct ubuf_info *uarg = skb_shinfo(skb)->destructor_arg; for (i = 0; i < num_frags; i++) { u8 *vaddr; skb_frag_t *f = &skb_shinfo(skb)->frags[i]; page = alloc_page(gfp_mask); if (!page) { while (head) { struct page *next = (struct page *)page_private(head); put_page(head); head = next; } return -ENOMEM; } vaddr = kmap_atomic(skb_frag_page(f)); memcpy(page_address(page), vaddr + f->page_offset, skb_frag_size(f)); kunmap_atomic(vaddr); set_page_private(page, (unsigned long)head); head = page; } for (i = 0; i < num_frags; i++) skb_frag_unref(skb, i); uarg->callback(uarg, false); for (i = num_frags - 1; i >= 0; i--) { __skb_fill_page_desc(skb, i, head, 0, skb_shinfo(skb)->frags[i].size); head = (struct page *)page_private(head); } skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; return 0; }
0
null
-1
https://github.com/torvalds/linux/commit/1fd819ecb90cc9b822cd84d3056ddba315d3340f
0CCPP
unsigned CjfifDecode::DecodeApp2Flashpix() { CString strTmp; unsigned nFpxVer; unsigned nFpxSegType; unsigned nFpxInteropCnt; unsigned nFpxEntitySz; unsigned nFpxDefault; bool bFpxStorage; CString strFpxStorageClsStr; unsigned nFpxStIndexCont; unsigned nFpxStOffset; unsigned nFpxStWByteOrder; unsigned nFpxStWFormat; CString strFpxStClsidStr; unsigned nFpxStDwOsVer; unsigned nFpxStRsvd; CString streamStr; nFpxVer = Buf(m_nPos++); nFpxSegType = Buf(m_nPos++); if (nFpxSegType == 1) { strTmp.Format(_T(" Segment: CONTENTS LIST")); m_pLog->AddLine(strTmp); nFpxInteropCnt = (Buf(m_nPos++)<<8) + Buf(m_nPos++); strTmp.Format(_T(" Interoperability Count = %u"),nFpxInteropCnt); m_pLog->AddLine(strTmp); for (unsigned ind=0;ind<nFpxInteropCnt;ind++) { strTmp.Format(_T(" Entity Index #%u"),ind); m_pLog->AddLine(strTmp); nFpxEntitySz = (Buf(m_nPos++)<<24) + (Buf(m_nPos++)<<16) + (Buf(m_nPos++)<<8) + Buf(m_nPos++); bFpxStorage = false; if (nFpxEntitySz == 0xFFFFFFFF) { bFpxStorage = true; } if (!bFpxStorage) { strTmp.Format(_T(" Entity Size = %u"),nFpxEntitySz); m_pLog->AddLine(strTmp); } else { strTmp.Format(_T(" Entity is Storage")); m_pLog->AddLine(strTmp); } nFpxDefault = Buf(m_nPos++); streamStr = m_pWBuf->BufReadUniStr2(m_nPos,MAX_BUF_READ_STR); m_nPos += 2*((unsigned)_tcslen(streamStr)+1); strTmp.Format(_T(" Stream Name = [%s]"),(LPCTSTR)streamStr); m_pLog->AddLine(strTmp); if (bFpxStorage) { strFpxStorageClsStr.Format(_T("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X"), Buf(m_nPos+3),Buf(m_nPos+2),Buf(m_nPos+1),Buf(m_nPos+0), Buf(m_nPos+5),Buf(m_nPos+4), Buf(m_nPos+7),Buf(m_nPos+6), Buf(m_nPos+8),Buf(m_nPos+9), Buf(m_nPos+10),Buf(m_nPos+11),Buf(m_nPos+12),Buf(m_nPos+13),Buf(m_nPos+14),Buf(m_nPos+15) ); m_nPos+= 16; strTmp.Format(_T(" Storage Class = [%s]"),(LPCTSTR)strFpxStorageClsStr); m_pLog->AddLine(strTmp); } } return 0; } else if (nFpxSegType == 2) { strTmp.Format(_T(" Segment: STREAM DATA")); m_pLog->AddLine(strTmp); nFpxStIndexCont = (Buf(m_nPos++)<<8) + Buf(m_nPos++); strTmp.Format(_T(" Index in Contents List = %u"),nFpxStIndexCont); m_pLog->AddLine(strTmp); nFpxStOffset = (Buf(m_nPos++)<<24) + (Buf(m_nPos++)<<16) + (Buf(m_nPos++)<<8) + Buf(m_nPos++); strTmp.Format(_T(" Offset in stream = %u (0x%08X)"),nFpxStOffset,nFpxStOffset); m_pLog->AddLine(strTmp); nFpxStWByteOrder = (Buf(m_nPos++)<<8) + Buf(m_nPos++); nFpxStWFormat = (Buf(m_nPos++)<<8) + Buf(m_nPos++); nFpxStDwOsVer = (Buf(m_nPos++)<<24) + (Buf(m_nPos++)<<16) + (Buf(m_nPos++)<<8) + Buf(m_nPos++); strFpxStClsidStr.Format(_T("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X"), Buf(m_nPos+3),Buf(m_nPos+2),Buf(m_nPos+1),Buf(m_nPos+0), Buf(m_nPos+5),Buf(m_nPos+4), Buf(m_nPos+7),Buf(m_nPos+6), Buf(m_nPos+8),Buf(m_nPos+9), Buf(m_nPos+10),Buf(m_nPos+11),Buf(m_nPos+12),Buf(m_nPos+13),Buf(m_nPos+14),Buf(m_nPos+15) ); m_nPos+= 16; nFpxStRsvd = (Buf(m_nPos++)<<8) + Buf(m_nPos++); strTmp.Format(_T(" ByteOrder = 0x%04X"),nFpxStWByteOrder); m_pLog->AddLine(strTmp); strTmp.Format(_T(" Format = 0x%04X"),nFpxStWFormat); m_pLog->AddLine(strTmp); strTmp.Format(_T(" OSVer = 0x%08X"),nFpxStDwOsVer); m_pLog->AddLine(strTmp); strTmp.Format(_T(" clsid = %s"),(LPCTSTR)strFpxStClsidStr); m_pLog->AddLine(strTmp); strTmp.Format(_T(" reserved = 0x%08X"),nFpxStRsvd); m_pLog->AddLine(strTmp); return 2; } else { strTmp.Format(_T(" Reserved Segment. Stopping.")); m_pLog->AddLineErr(strTmp); return 1; } }
0
null
-1
https://github.com/ImpulseAdventure/JPEGsnoop/commit/b4e458612d4294e0cfe01dbf1c0b09a07a8133a4
0CCPP
static int phar_tmpclose_apply(void *pDest TSRMLS_DC) { phar_entry_info *entry = (phar_entry_info *) pDest; if (entry->fp_type != PHAR_TMP) { return ZEND_HASH_APPLY_KEEP; } if (entry->fp && !entry->fp_refcount) { php_stream_close(entry->fp); entry->fp = NULL; } return ZEND_HASH_APPLY_KEEP; }
0
null
-1
https://github.com/php/php-src/commit/ca46d0acbce55019b970fcd4c1e8a10edfdded93
0CCPP
n)for(v=0;v<n.length;v++)n[v].node.style.visibility=c?"visible":"hidden"};var f=mxGuide.prototype.destroy;mxGuide.prototype.destroy=function(){f.call(this);var c=this.guidesArrVer,m=this.guidesArrHor;if(null!=c){for(var n=0;n<c.length;n++)c[n].destroy();this.guidesArrVer=null}if(null!=m){for(n=0;n<m.length;n++)m[n].destroy();this.guidesArrHor=null}}})();function mxRuler(b,e,f,c){function m(){var M=b.diagramContainer;p.style.top=M.offsetTop-g+"px";p.style.left=M.offsetLeft-g+"px";p.style.width=(f?0:M.offsetWidth)+g+"px";p.style.height=(f?M.offsetHeight:0)+g+"px"}function n(M,u,D){if(null!=v)return M;var B;return function(){var C=this,G=arguments,N=D&&!B;clearTimeout(B);B=setTimeout(function(){B=null;D||M.apply(C,G)},u);N&&M.apply(C,G)}}var v=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame, d=window.cancelAnimationFrame||window.mozCancelAnimationFrame,g=this.RULER_THICKNESS,k=this;this.unit=e;var l=Editor.isDarkMode()?{bkgClr:"#202020",outBkgClr:Editor.darkColor,cornerClr:Editor.darkColor,strokeClr:"#505759",fontClr:"#BBBBBB",guideClr:"#0088cf"}:{bkgClr:"#ffffff",outBkgClr:"#e8e9ed",cornerClr:"#fbfbfb",strokeClr:"#dadce0",fontClr:"#BBBBBB",guideClr:"#0000BB"},p=document.createElement("div");p.style.position="absolute";this.updateStyle=mxUtils.bind(this,function(){l=Editor.isDarkMode()? {bkgClr:"#202020",outBkgClr:Editor.darkColor,cornerClr:Editor.darkColor,strokeClr:"#505759",fontClr:"#BBBBBB",guideClr:"#0088cf"}:{bkgClr:"#ffffff",outBkgClr:"#e8e9ed",cornerClr:"#fbfbfb",strokeClr:"#dadce0",fontClr:"#BBBBBB",guideClr:"#0000BB"};p.style.background=l.bkgClr;p.style[f?"borderRight":"borderBottom"]="0.5px solid "+l.strokeClr;p.style.borderLeft="0.5px solid "+l.strokeClr});this.updateStyle();document.body.appendChild(p);mxEvent.disableContextMenu(p);this.editorUiRefresh=b.refresh;b.refresh= function(M){k.editorUiRefresh.apply(b,arguments);m()};m();var q=document.createElement("canvas");q.width=p.offsetWidth;q.height=p.offsetHeight;p.style.overflow="hidden";q.style.position="relative";p.appendChild(q);var x=q.getContext("2d");this.ui=b;var y=b.editor.graph;this.graph=y;this.container=p;this.canvas=q;var z=function(M,u,D,B,C){M=Math.round(M);u=Math.round(u);D=Math.round(D);B=Math.round(B);x.beginPath();x.moveTo(M+.5,u+.5);x.lineTo(D+.5,B+.5);x.stroke();C&&(f?(x.save(),x.translate(M,u), x.rotate(-Math.PI/2),x.fillText(C,0,0),x.restore()):x.fillText(C,M,u))},A=function(){x.clearRect(0,0,q.width,q.height);x.beginPath();x.lineWidth=.7;x.strokeStyle=l.strokeClr;x.setLineDash([]);x.font="9px Arial";x.textAlign="center";var M=y.view.scale,u=y.view.getBackgroundPageBounds(),D=y.view.translate,B=y.pageVisible;D=B?g+(f?u.y-y.container.scrollTop:u.x-y.container.scrollLeft):g+(f?D.y*M-y.container.scrollTop:D.x*M-y.container.scrollLeft);var C=0;B&&(C=y.getPageLayout(),C=f?C.y*y.pageFormat.height: C.x*y.pageFormat.width);var G;switch(k.unit){case mxConstants.POINTS:var N=G=10;var I=[3,5,5,5,5,10,5,5,5,5];break;case mxConstants.MILLIMETERS:G=10;N=mxConstants.PIXELS_PER_MM;I=[5,3,3,3,3,6,3,3,3,3];break;case mxConstants.METERS:G=20;N=mxConstants.PIXELS_PER_MM;I=[5,3,3,3,3,6,3,3,3,3,10,3,3,3,3,6,3,3,3,3];break;case mxConstants.INCHES:G=.5>=M||4<=M?8:16,N=mxConstants.PIXELS_PER_INCH/G,I=[5,3,5,3,7,3,5,3,7,3,5,3,7,3,5,3]}var F=N;2<=M?F=N/(2*Math.floor(M/2)):.5>=M&&(F=N*Math.floor(1/M/2)*(k.unit== mxConstants.MILLIMETERS?2:1));N=null;u=B?Math.min(D+(f?u.height:u.width),f?q.height:q.width):f?q.height:q.width;if(B)if(x.fillStyle=l.outBkgClr,f){var H=D-g;0<H&&x.fillRect(0,g,g,H);u<q.height&&x.fillRect(0,u,g,q.height)}else H=D-g,0<H&&x.fillRect(g,0,H,g),u<q.width&&x.fillRect(u,0,q.width,g);x.fillStyle=l.fontClr;for(B=B?D:D%(F*M);B<=u;B+=F*M)if(H=Math.round((B-D)/M/F),!(B<g||H==N)){N=H;var R=null;0==H%G&&(R=k.formatText(C+H*F)+"");f?z(g-I[Math.abs(H)%G],B,g,B,R):z(B,g-I[Math.abs(H)%G],B,g,R)}x.lineWidth= 1;z(f?0:g,f?g:0,g,g);x.fillStyle=l.cornerClr;x.fillRect(0,0,g,g)},L=-1,O=function(){null!=v?(null!=d&&d(L),L=v(A)):A()};this.drawRuler=O;this.sizeListener=e=n(function(){var M=y.container;f?(M=M.offsetHeight+g,q.height!=M&&(q.height=M,p.style.height=M+"px",O())):(M=M.offsetWidth+g,q.width!=M&&(q.width=M,p.style.width=M+"px",O()))},10);this.pageListener=function(){O()};this.scrollListener=c=n(function(){var M=f?y.container.scrollTop:y.container.scrollLeft;k.lastScroll!=M&&(k.lastScroll=M,O())},10); this.unitListener=function(M,u){k.setUnit(u.getProperty("unit"))};y.addListener(mxEvent.SIZE,e);y.container.addEventListener("scroll",c);y.view.addListener("unitChanged",this.unitListener);b.addListener("pageViewChanged",this.pageListener);b.addListener("pageScaleChanged",this.pageListener);b.addListener("pageFormatChanged",this.pageListener);this.setStyle=function(M){l=M;p.style.background=l.bkgClr;A()};this.origGuideMove=mxGuide.prototype.move;mxGuide.prototype.move=function(M,u,D,B){if(f&&4<M.height|| !f&&4<M.width){if(null!=k.guidePart)try{x.putImageData(k.guidePart.imgData1,k.guidePart.x1,k.guidePart.y1),x.putImageData(k.guidePart.imgData2,k.guidePart.x2,k.guidePart.y2),x.putImageData(k.guidePart.imgData3,k.guidePart.x3,k.guidePart.y3)}catch(U){}var C=k.origGuideMove.apply(this,arguments);try{x.lineWidth=.5;x.strokeStyle=l.guideClr;x.setLineDash([2]);if(f){var G=M.y+C.y+g-this.graph.container.scrollTop;var N=0;var I=G+M.height/2;var F=g/2;var H=G+M.height;var R=0;var W=x.getImageData(N,G-1,g, 3);z(N,G,g,G);G--;var J=x.getImageData(F,I-1,g,3);z(F,I,g,I);I--;var V=x.getImageData(R,H-1,g,3);z(R,H,g,H);H--}else G=0,N=M.x+C.x+g-this.graph.container.scrollLeft,I=g/2,F=N+M.width/2,H=0,R=N+M.width,W=x.getImageData(N-1,G,3,g),z(N,G,N,g),N--,J=x.getImageData(F-1,I,3,g),z(F,I,F,g),F--,V=x.getImageData(R-1,H,3,g),z(R,H,R,g),R--;if(null==k.guidePart||k.guidePart.x1!=N||k.guidePart.y1!=G)k.guidePart={imgData1:W,x1:N,y1:G,imgData2:J,x2:F,y2:I,imgData3:V,x3:R,y3:H}}catch(U){}}else C=k.origGuideMove.apply(this, arguments);return C};this.origGuideDestroy=mxGuide.prototype.destroy;mxGuide.prototype.destroy=function(){var M=k.origGuideDestroy.apply(this,arguments);if(null!=k.guidePart)try{x.putImageData(k.guidePart.imgData1,k.guidePart.x1,k.guidePart.y1),x.putImageData(k.guidePart.imgData2,k.guidePart.x2,k.guidePart.y2),x.putImageData(k.guidePart.imgData3,k.guidePart.x3,k.guidePart.y3),k.guidePart=null}catch(u){}return M}}mxRuler.prototype.RULER_THICKNESS=14;mxRuler.prototype.unit=mxConstants.POINTS;
0
null
-1
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
3JavaScript
static void *createArrayObject(const redisReadTask *task, size_t elements) { redisReply *r, *parent; r = createReplyObject(task->type); if (r == NULL) return NULL; if (elements > 0) { r->element = hi_calloc(elements,sizeof(redisReply*)); if (r->element == NULL) { freeReplyObject(r); return NULL; } } r->elements = elements; if (task->parent) { parent = task->parent->obj; assert(parent->type == REDIS_REPLY_ARRAY || parent->type == REDIS_REPLY_MAP || parent->type == REDIS_REPLY_SET || parent->type == REDIS_REPLY_PUSH); parent->element[task->idx] = r; } return r; }
1
null
-1
https://github.com/redis/redis/commit/0215324a66af949be39b34be2d55143232c1cb71
0CCPP
pixFewColorsOctcubeQuantMixed(PIX *pixs, l_int32 level, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_float32 minfract, l_int32 maxspan) { l_int32 i, j, w, h, wplc, wplm, wpld, ncolors, index; l_int32 rval, gval, bval, val, minval, maxval; l_int32 *lut; l_uint32 *datac, *datam, *datad, *linec, *linem, *lined; PIX *pixc, *pixm, *pixg, *pixd; PIXCMAP *cmap, *cmapd; PROCNAME("pixFewColorsOctcubeQuantMixed"); if (!pixs || pixGetDepth(pixs) != 32) return (PIX *)ERROR_PTR("pixs undefined or not 32 bpp", procName, NULL); if (level <= 0) level = 3; if (level > 6) return (PIX *)ERROR_PTR("invalid level", procName, NULL); if (darkthresh <= 0) darkthresh = 20; if (lightthresh <= 0) lightthresh = 244; if (diffthresh <= 0) diffthresh = 20; if (minfract <= 0.0) minfract = 0.05; if (maxspan <= 2) maxspan = 15; if ((pixc = pixFewColorsOctcubeQuant1(pixs, level)) == NULL) return (PIX *)ERROR_PTR("too many colors", procName, NULL); cmap = pixGetColormap(pixc); ncolors = pixcmapGetCount(cmap); cmapd = pixcmapCreate(8); lut = (l_int32 *)LEPT_CALLOC(256, sizeof(l_int32)); for (i = 0; i < 256; i++) lut[i] = -1; for (i = 0, index = 0; i < ncolors; i++) { pixcmapGetColor(cmap, i, &rval, &gval, &bval); minval = L_MIN(rval, gval); minval = L_MIN(minval, bval); if (minval > lightthresh) continue; maxval = L_MAX(rval, gval); maxval = L_MAX(maxval, bval); if (maxval < darkthresh) continue; if (maxval - minval >= diffthresh) { pixcmapAddColor(cmapd, rval, gval, bval); lut[i] = index; index++; } } pixGetDimensions(pixs, &w, &h, NULL); pixd = pixCreate(w, h, 8); pixSetColormap(pixd, cmapd); pixm = pixCreate(w, h, 1); datac = pixGetData(pixc); datam = pixGetData(pixm); datad = pixGetData(pixd); wplc = pixGetWpl(pixc); wplm = pixGetWpl(pixm); wpld = pixGetWpl(pixd); for (i = 0; i < h; i++) { linec = datac + i * wplc; linem = datam + i * wplm; lined = datad + i * wpld; for (j = 0; j < w; j++) { val = GET_DATA_BYTE(linec, j); if (lut[val] == -1) SET_DATA_BIT(linem, j); else SET_DATA_BYTE(lined, j, lut[val]); } } pixg = pixConvertTo8(pixs, 0); pixGrayQuantFromHisto(pixd, pixg, pixm, minfract, maxspan); LEPT_FREE(lut); pixDestroy(&pixc); pixDestroy(&pixm); pixDestroy(&pixg); return pixd; }
1
12,25
-1
https://github.com/DanBloomberg/leptonica/commit/5ee24b398bb67666f6d173763eaaedd9c36fb1e5
0CCPP
listen_loop(void *x) { int optval = 1; struct pollfd pa[100]; struct pollfd *p; struct _agooErr err = AGOO_ERR_INIT; struct sockaddr_in client_addr; int client_sock; int pcnt = 0; socklen_t alen = 0; agooCon con; int i; uint64_t cnt = 0; agooBind b; for (b = agoo_server.binds, p = pa; NULL != b; b = b->next, p++, pcnt++) { p->fd = b->fd; p->events = POLLIN; p->revents = 0; } memset(&client_addr, 0, sizeof(client_addr)); atomic_fetch_add(&agoo_server.running, 1); while (agoo_server.active) { if (0 > (i = poll(pa, pcnt, 200))) { if (EAGAIN == errno) { continue; } agoo_log_cat(&agoo_error_cat, "Server polling error. %s.", strerror(errno)); break; } if (0 == i) { continue; } for (b = agoo_server.binds, p = pa; NULL != b; b = b->next, p++) { if (0 != (p->revents & POLLIN)) { if (0 > (client_sock = accept(p->fd, (struct sockaddr*)&client_addr, &alen))) { agoo_log_cat(&agoo_error_cat, "Server with pid %d accept connection failed. %s.", getpid(), strerror(errno)); } else if (NULL == (con = agoo_con_create(&err, client_sock, ++cnt, b))) { agoo_log_cat(&agoo_error_cat, "Server with pid %d accept connection failed. %s.", getpid(), err.msg); close(client_sock); cnt--; agoo_err_clear(&err); } else { int con_cnt; #ifdef OSX_OS setsockopt(client_sock, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval)); #endif #ifdef PLATFORM_LINUX setsockopt(client_sock, IPPROTO_TCP, TCP_QUICKACK, &optval, sizeof(optval)); #endif fcntl(client_sock, F_SETFL, O_NONBLOCK); setsockopt(client_sock, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)); setsockopt(client_sock, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)); agoo_log_cat(&agoo_con_cat, "Server with pid %d accepted connection %llu on %s [%d]", getpid(), (unsigned long long)cnt, b->id, con->sock); con_cnt = atomic_fetch_add(&agoo_server.con_cnt, 1); if (agoo_server.loop_max > agoo_server.loop_cnt && agoo_server.loop_cnt * LOOP_UP < con_cnt) { add_con_loop(); } agoo_queue_push(&agoo_server.con_queue, (void*)con); } } if (0 != (p->revents & (POLLERR | POLLHUP | POLLNVAL))) { if (0 != (p->revents & (POLLHUP | POLLNVAL))) { agoo_log_cat(&agoo_error_cat, "Agoo server with pid %d socket on %s closed.", getpid(), b->id); } else { agoo_log_cat(&agoo_error_cat, "Agoo server with pid %d socket on %s error.", getpid(), b->id); } agoo_server.active = false; } p->revents = 0; } } for (b = agoo_server.binds; NULL != b; b = b->next) { agoo_bind_close(b); } atomic_fetch_sub(&agoo_server.running, 1); return NULL; }
1
51,52
-1
https://github.com/ohler55/agoo/commit/23d03535cf7b50d679a60a953a0cae9519a4a130
0CCPP
public ResetPasswordRequestResponse checkVerificationCode(UserReference userReference, String verificationCode) throws ResetPasswordException { this.checkUserReference(userReference); XWikiContext context = this.contextProvider.get(); UserProperties userProperties = this.userPropertiesResolver.resolve(userReference); InternetAddress email = userProperties.getEmail(); DocumentUserReference documentUserReference = (DocumentUserReference) userReference; DocumentReference reference = documentUserReference.getReference(); String exceptionMessage = this.localizationManager.getTranslationPlain("xe.admin.passwordReset.step2.error.wrongParameters", userReference.toString()); try { XWikiDocument userDocument = context.getWiki().getDocument(reference, context); BaseObject xObject = userDocument.getXObject(RESET_PASSWORD_REQUEST_CLASS_REFERENCE); if (xObject == null) { throw new ResetPasswordException(exceptionMessage); } String storedVerificationCode = xObject.getStringValue(VERIFICATION_PROPERTY); BaseClass xClass = xObject.getXClass(context); PropertyInterface verification = xClass.get(VERIFICATION_PROPERTY); if (!(verification instanceof PasswordClass)) { throw new ResetPasswordException("Bad definition of ResetPassword XClass."); } PasswordClass passwordClass = (PasswordClass) verification; String equivalentPassword = passwordClass.getEquivalentPassword(storedVerificationCode, verificationCode); // We ensure to reset the verification code before checking if it's correct to avoid any bruteforce attack. String newVerificationCode = context.getWiki().generateRandomString(30); xObject.set(VERIFICATION_PROPERTY, newVerificationCode, context); String saveComment = this.localizationManager .getTranslationPlain("xe.admin.passwordReset.step2.versionComment.changeValidationKey"); context.getWiki().saveDocument(userDocument, saveComment, true, context); if (!storedVerificationCode.equals(equivalentPassword)) { throw new ResetPasswordException(exceptionMessage); } return new DefaultResetPasswordRequestResponse(userReference, email, newVerificationCode); } catch (XWikiException e) { throw new ResetPasswordException("Cannot open user document to check verification code.", e); } }
1
3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38
-1
https://github.com/xwiki/xwiki-platform/commit/d8a3cce48e0ac1a0f4a3cea7a19747382d9c9494
2Java
static rgb2hex(rgb) { rgb = rgb.match( /^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i ) return rgb && rgb.length === 4 ? '#' + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) : '' }
1
6,7,8
-1
https://github.com/apexcharts/apexcharts.js/commit/9a7425c0fcec4c7081f32ceceae2f11a90aed255
3JavaScript
protected Clob makeClob(long oid) throws SQLException { return new PgClob(this, oid); }
0
null
-1
https://github.com/pgjdbc/pgjdbc/commit/14b62aca4764d496813f55a43d050b017e01eb65
2Java
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d); SCSIRequest *req; SCSIDiskReq *r; req = scsi_req_alloc(&scsi_disk_reqops, &s->qdev, tag, lun, hba_private); r = DO_UPCAST(SCSIDiskReq, req, req); r->iov.iov_base = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE); return req; }
1
5,7,8
-1
https://github.com/bonzini/qemu/commit/7285477ab11831b1cf56e45878a89170dd06d9b9
0CCPP
int cifs_setup_session(unsigned int xid, struct cifsSesInfo *ses, struct nls_table *nls_info) { int rc = 0; struct TCP_Server_Info *server = ses->server; ses->flags = 0; ses->capabilities = server->capabilities; if (linuxExtEnabled == 0) ses->capabilities &= (~CAP_UNIX); cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", server->secMode, server->capabilities, server->timeAdj); rc = CIFS_SessSetup(xid, ses, nls_info); if (rc) { cERROR(1, "Send error in SessSetup = %d", rc); } else { cFYI(1, "CIFS Session Established successfully"); spin_lock(&GlobalMid_Lock); ses->status = CifsGood; ses->need_reconnect = false; spin_unlock(&GlobalMid_Lock); } return rc; }
0
null
-1
https://github.com/torvalds/linux/commit/4ff67b720c02c36e54d55b88c2931879b7db1cd2
0CCPP
void OverlaySettings::save(QSettings* settings_ptr) { OverlaySettings def; SAVELOAD(bEnable, "enable"); SAVELOAD(osShow, "show"); SAVELOAD(bAlwaysSelf, "alwaysself"); SAVELOAD(uiActiveTime, "activetime"); SAVELOAD(osSort, "sort"); SAVELOAD(fX, "x"); SAVELOAD(fY, "y"); SAVELOAD(fZoom, "zoom"); SAVELOAD(uiColumns, "columns"); settings_ptr->beginReadArray(QLatin1String("states")); for (int i=0; i<4; ++i) { settings_ptr->setArrayIndex(i); SAVELOAD(qcUserName[i], "color"); SAVELOAD(fUser[i], "opacity"); } settings_ptr->endArray(); SAVELOAD(qfUserName, "userfont"); SAVELOAD(qfChannel, "channelfont"); SAVELOAD(qcChannel, "channelcolor"); SAVELOAD(qfFps, "fpsfont"); SAVELOAD(qcFps, "fpscolor"); SAVELOAD(fBoxPad, "padding"); SAVELOAD(fBoxPenWidth, "penwidth"); SAVELOAD(qcBoxPen, "pencolor"); SAVELOAD(qcBoxFill, "fillcolor"); SAVELOAD(bUserName, "usershow"); SAVELOAD(bChannel, "channelshow"); SAVELOAD(bMutedDeafened, "mutedshow"); SAVELOAD(bAvatar, "avatarshow"); SAVELOAD(bBox, "boxshow"); SAVELOAD(bFps, "fpsshow"); SAVELOAD(fUserName, "useropacity"); SAVELOAD(fChannel, "channelopacity"); SAVELOAD(fMutedDeafened, "mutedopacity"); SAVELOAD(fAvatar, "avataropacity"); SAVELOAD(fFps, "fpsopacity"); SAVELOAD(qrfUserName, "userrect"); SAVELOAD(qrfChannel, "channelrect"); SAVELOAD(qrfMutedDeafened, "mutedrect"); SAVELOAD(qrfAvatar, "avatarrect"); SAVELOAD(qrfFps, "fpsrect"); SAVEFLAG(qaUserName, "useralign"); SAVEFLAG(qaChannel, "channelalign"); SAVEFLAG(qaMutedDeafened, "mutedalign"); SAVEFLAG(qaAvatar, "avataralign"); settings_ptr->setValue(QLatin1String("usewhitelist"), bUseWhitelist); settings_ptr->setValue(QLatin1String("blacklist"), qslBlacklist); settings_ptr->setValue(QLatin1String("whitelist"), qslWhitelist); }
1
null
-1
https://github.com/mumble-voip/mumble/commit/5632c35d6759f5e13a7dfe78e4ee6403ff6a8e3e
0CCPP
uint16_t mesg_id (void) { static uint16_t id = 0; if (!id) { srandom (time (NULL)); id = random (); } id++; if (T.debug > 4) syslog (LOG_DEBUG, "mesg_id() = %d", id); return id; }
1
0,1,2,3,4,5,6,7,8,9
-1
https://github.com/fwdillema/totd/commit/afd8a10a6a21f82a70940d1b43cff48143250399
0CCPP
public Group find(Context context, UUID id) throws SQLException { if (id == null) { return null; } else { return groupDAO.findByID(context, Group.class, id); } }
0
null
-1
https://github.com/DSpace/DSpace/commit/277b499a5cd3a4f5eb2370513a1b7e4ec2a6e041
2Java
int main(int argc, char **argv) { int fmtid; int id; char *infile; jas_stream_t *instream; jas_image_t *image; int width; int height; int depth; int numcmpts; int verbose; char *fmtname; if (jas_init()) { abort(); } cmdname = argv[0]; infile = 0; verbose = 0; while ((id = jas_getopt(argc, argv, opts)) >= 0) { switch (id) { case OPT_VERBOSE: verbose = 1; break; case OPT_VERSION: printf("%s\n", JAS_VERSION); exit(EXIT_SUCCESS); break; case OPT_INFILE: infile = jas_optarg; break; case OPT_HELP: default: usage(); break; } } if (infile) { if (!(instream = jas_stream_fopen(infile, "rb"))) { fprintf(stderr, "cannot open input image file %s\n", infile); exit(EXIT_FAILURE); } } else { if (!(instream = jas_stream_fdopen(0, "rb"))) { fprintf(stderr, "cannot open standard input\n"); exit(EXIT_FAILURE); } } if ((fmtid = jas_image_getfmt(instream)) < 0) { fprintf(stderr, "unknown image format\n"); } if (!(image = jas_image_decode(instream, fmtid, 0))) { fprintf(stderr, "cannot load image\n"); return EXIT_FAILURE; } jas_stream_close(instream); numcmpts = jas_image_numcmpts(image); width = jas_image_cmptwidth(image, 0); height = jas_image_cmptheight(image, 0); depth = jas_image_cmptprec(image, 0); if (!(fmtname = jas_image_fmttostr(fmtid))) { abort(); } printf("%s %d %d %d %d %ld\n", fmtname, numcmpts, width, height, depth, (long) jas_image_rawsize(image)); jas_image_destroy(image); jas_image_clearfmts(); return EXIT_SUCCESS; }
1
null
-1
https://github.com/jasper-software/jasper/commit/8f62b4761711d036fd8964df256b938c809b7fca
0CCPP
void MainWindow::setCurrentFile(const QString &filename) { QString shownName = tr("Untitled"); if (filename == untitledFileName()) m_currentFile.clear(); else m_currentFile = filename; if (!m_currentFile.isEmpty()) shownName = QFileInfo(m_currentFile).fileName(); #ifdef Q_OS_MAC setWindowTitle(QString("%1 - %2").arg(shownName).arg(qApp->applicationName())); #else setWindowTitle(QString("%1[*] - %2").arg(shownName).arg(qApp->applicationName())); #endif }
0
null
-1
https://github.com/mltframework/shotcut/commit/f008adc039642307f6ee3378d378cdb842e52c1d
0CCPP
mxUtils.bind(this,function(){var u=new mxImageExport,D=m.getGraphBounds(),B=m.view.scale,C=mxUtils.createXmlDocument(),G=C.createElement("output");C.appendChild(G);C=new mxXmlCanvas2D(G);C.translate(Math.floor((1-D.x)/B),Math.floor((1-D.y)/B));C.scale(1/B);var N=0,I=C.save;C.save=function(){N++;I.apply(this,arguments)};var F=C.restore;C.restore=function(){N--;F.apply(this,arguments)};var H=u.drawShape;u.drawShape=function(R){mxLog.debug("entering shape",R,N);H.apply(this,arguments);mxLog.debug("leaving shape", R,N)};u.drawState(m.getView().getState(m.model.root),C);mxLog.show();mxLog.debug(mxUtils.getXml(G));mxLog.debug("stateCounter",N)}));c.actions.addAction("testShowConsole",function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show();mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-2});this.put("testDevelop",new Menu(mxUtils.bind(this,function(u,D){this.addMenuItems(u,"createSidebarEntry showBoundingBox - testInspectPages testFixPages - testCheckFile testDiff - testInspect testOptimize - testXmlImageExport - testShowConsole".split(" "),
0
null
-1
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
3JavaScript
void do_send_trap(struct pt_regs *regs, unsigned long address, unsigned long error_code, int signal_code, int breakpt) { siginfo_t info; current->thread.trap_nr = signal_code; if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 11, SIGSEGV) == NOTIFY_STOP) return; info.si_signo = SIGTRAP; info.si_errno = breakpt; info.si_code = signal_code; info.si_addr = (void __user *)address; force_sig_info(SIGTRAP, &info, current); }
0
null
-1
https://github.com/torvalds/linux/commit/7f821fc9c77a9b01fe7b1d6e72717b33d8d64142
0CCPP
__acquires(&current->sighand->siglock) { bool gstop_done = false; if (arch_ptrace_stop_needed(exit_code, info)) { spin_unlock_irq(&current->sighand->siglock); arch_ptrace_stop(exit_code, info); spin_lock_irq(&current->sighand->siglock); if (sigkill_pending(current)) return; } set_current_state(TASK_TRACED); current->last_siginfo = info; current->exit_code = exit_code; if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING)) gstop_done = task_participate_group_stop(current); task_clear_jobctl_pending(current, JOBCTL_TRAP_STOP); if (info && info->si_code >> 8 == PTRACE_EVENT_STOP) task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY); task_clear_jobctl_trapping(current); spin_unlock_irq(&current->sighand->siglock); read_lock(&tasklist_lock); if (may_ptrace_stop()) { do_notify_parent_cldstop(current, true, why); if (gstop_done && ptrace_reparented(current)) do_notify_parent_cldstop(current, false, why); preempt_disable(); read_unlock(&tasklist_lock); preempt_enable_no_resched(); freezable_schedule(); } else { if (gstop_done) do_notify_parent_cldstop(current, false, why); __set_current_state(TASK_RUNNING); if (clear_code) current->exit_code = 0; read_unlock(&tasklist_lock); } spin_lock_irq(&current->sighand->siglock); current->last_siginfo = NULL; current->jobctl &= ~JOBCTL_LISTENING; recalc_sigpending_tsk(current); }
1
null
-1
https://github.com/torvalds/linux/commit/9899d11f654474d2d54ea52ceaa2a1f4db3abd68
0CCPP
static RList *r_bin_wasm_get_global_entries (RBinWasmObj *bin, RBinWasmSection *sec) { RList *ret = NULL; RBinWasmGlobalEntry *ptr = NULL; int buflen = bin->buf->length; if (sec->payload_data + 32 > buflen) { return NULL; } if (!(ret = r_list_newf ((RListFree)free))) { return NULL; } ut8* buf = bin->buf->buf + (ut32)sec->payload_data; ut32 len = sec->payload_len; ut32 count = sec->count; ut32 i = 0, r = 0; while (i < len && len < buflen && r < count) { if (!(ptr = R_NEW0 (RBinWasmGlobalEntry))) { return ret; } if (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, (ut8*)&ptr->content_type, &i))) { goto beach; } if (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, &ptr->mutability, &i))) { goto beach; } if (len + 8 > buflen || !(consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) { goto beach; } r_list_append (ret, ptr); r++; } return ret; beach: free (ptr); return ret; }
1
3,4,5,6
-1
https://github.com/radareorg/radare2/commit/d2632f6483a3ceb5d8e0a5fb11142c51c43978b4
0CCPP
static int nl80211_vendor_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) { struct cfg80211_registered_device *rdev; struct wireless_dev *wdev; unsigned int vcmd_idx; const struct wiphy_vendor_command *vcmd; void *data; int data_len; int err; struct nlattr *vendor_data; rtnl_lock(); err = nl80211_prepare_vendor_dump(skb, cb, &rdev, &wdev); if (err) goto out; vcmd_idx = cb->args[2]; data = (void *)cb->args[3]; data_len = cb->args[4]; vcmd = &rdev->wiphy.vendor_commands[vcmd_idx]; if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV)) { if (!wdev) { err = -EINVAL; goto out; } if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV && !wdev->netdev) { err = -EINVAL; goto out; } if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) { if (!wdev_running(wdev)) { err = -ENETDOWN; goto out; } } } while (1) { void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, NL80211_CMD_VENDOR); if (!hdr) break; if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || (wdev && nla_put_u64_64bit(skb, NL80211_ATTR_WDEV, wdev_id(wdev), NL80211_ATTR_PAD))) { genlmsg_cancel(skb, hdr); break; } vendor_data = nla_nest_start_noflag(skb, NL80211_ATTR_VENDOR_DATA); if (!vendor_data) { genlmsg_cancel(skb, hdr); break; } err = vcmd->dumpit(&rdev->wiphy, wdev, skb, data, data_len, (unsigned long *)&cb->args[5]); nla_nest_end(skb, vendor_data); if (err == -ENOBUFS || err == -ENOENT) { genlmsg_cancel(skb, hdr); break; } else if (err) { genlmsg_cancel(skb, hdr); goto out; } genlmsg_end(skb, hdr); } err = skb->len; out: rtnl_unlock(); return err; }
0
null
-1
https://github.com/torvalds/linux/commit/1399c59fa92984836db90538cf92397fe7caaa57
0CCPP
onOk: () => Vo, onError: (message: St) => Vo) {
0
null
-1
https://github.com/debiki/talkyard/commit/b0712915d8a22a20b09a129924e8a29c25ae5761
5TypeScript
void migrate_page_copy(struct page *newpage, struct page *page) { int cpupid; if (PageHuge(page) || PageTransHuge(page)) copy_huge_page(newpage, page); else copy_highpage(newpage, page); if (PageError(page)) SetPageError(newpage); if (PageReferenced(page)) SetPageReferenced(newpage); if (PageUptodate(page)) SetPageUptodate(newpage); if (TestClearPageActive(page)) { VM_BUG_ON_PAGE(PageUnevictable(page), page); SetPageActive(newpage); } else if (TestClearPageUnevictable(page)) SetPageUnevictable(newpage); if (PageChecked(page)) SetPageChecked(newpage); if (PageMappedToDisk(page)) SetPageMappedToDisk(newpage); if (PageDirty(page)) { clear_page_dirty_for_io(page); /* * Want to mark the page and the radix tree as dirty, and * redo the accounting that clear_page_dirty_for_io undid, * but we can't use set_page_dirty because that function * is actually a signal that all of the page has become dirty. * Whereas only part of our page may be dirty. */ if (PageSwapBacked(page)) SetPageDirty(newpage); else __set_page_dirty_nobuffers(newpage); } if (page_is_young(page)) set_page_young(newpage); if (page_is_idle(page)) set_page_idle(newpage); cpupid = page_cpupid_xchg_last(page, -1); page_cpupid_xchg_last(newpage, cpupid); ksm_migrate_page(newpage, page); if (PageSwapCache(page)) ClearPageSwapCache(page); ClearPagePrivate(page); set_page_private(page, 0); if (PageWriteback(newpage)) end_page_writeback(newpage); }
1
22,23,24,25,26,27,28,29,30,31,32,33,34,35
-1
https://github.com/torvalds/linux/commit/42cb14b110a5698ccf26ce59c4441722605a3743
0CCPP
HTTPSession::checkForShutdown() { VLOG(10) << *this << " checking for shutdown, readShutdown=" << readsShutdown() << ", writesShutdown=" << writesShutdown() << ", transaction set empty=" << transactions_.empty(); if (writesShutdown() && transactions_.empty() && !isLoopCallbackScheduled()) { VLOG(4) << "destroying " << *this; sock_->setReadCB(nullptr); auto asyncSocket = sock_->getUnderlyingTransport<folly::AsyncSocket>(); if (asyncSocket) { asyncSocket->setBufferCallback(nullptr); } reads_ = SocketState::SHUTDOWN; if (resetSocketOnShutdown_) { sock_->closeWithReset(); } else { sock_->closeNow(); } destroy(); } }
0
null
-1
https://github.com/facebook/proxygen/commit/0600ebe59c3e82cd012def77ca9ca1918da74a71
0CCPP
tok2strbuf(register const struct tok *lp, register const char *fmt, register u_int v, char *buf, size_t bufsize) { if (lp != NULL) { while (lp->s != NULL) { if (lp->v == v) return (lp->s); ++lp; } } if (fmt == NULL) fmt = "#%d"; (void)snprintf(buf, bufsize, fmt, v); return (const char *)buf; }
0
null
-1
https://github.com/the-tcpdump-group/tcpdump/commit/9f0730bee3eb65d07b49fd468bc2f269173352fe
0CCPP
function unwatchFile(path) { fs.unwatchFile(path); }
0
null
-1
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
3JavaScript
zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, umode_t obj_type, vsecattr_t *vsecp, cred_t *cr, zfs_fuid_info_t **fuidp, zfs_acl_t **zaclp) { zfs_acl_t *aclp; zfs_acl_node_t *aclnode; int aclcnt = vsecp->vsa_aclcnt; int error; if (vsecp->vsa_aclcnt > MAX_ACL_ENTRIES || vsecp->vsa_aclcnt <= 0) return (SET_ERROR(EINVAL)); aclp = zfs_acl_alloc(zfs_acl_version(zfsvfs->z_version)); aclp->z_hints = 0; aclnode = zfs_acl_node_alloc(aclcnt * sizeof (zfs_object_ace_t)); if (aclp->z_version == ZFS_ACL_VERSION_INITIAL) { if ((error = zfs_copy_ace_2_oldace(obj_type, aclp, (ace_t *)vsecp->vsa_aclentp, aclnode->z_acldata, aclcnt, &aclnode->z_size)) != 0) { zfs_acl_free(aclp); zfs_acl_node_free(aclnode); return (error); } } else { if ((error = zfs_copy_ace_2_fuid(zfsvfs, obj_type, aclp, vsecp->vsa_aclentp, aclnode->z_acldata, aclcnt, &aclnode->z_size, fuidp, cr)) != 0) { zfs_acl_free(aclp); zfs_acl_node_free(aclnode); return (error); } } aclp->z_acl_bytes = aclnode->z_size; aclnode->z_ace_count = aclcnt; aclp->z_acl_count = aclcnt; list_insert_head(&aclp->z_acl, aclnode); if (vsecp->vsa_mask & VSA_ACE_ACLFLAGS) { if (vsecp->vsa_aclflags & ACL_PROTECTED) aclp->z_hints |= ZFS_ACL_PROTECTED; if (vsecp->vsa_aclflags & ACL_DEFAULTED) aclp->z_hints |= ZFS_ACL_DEFAULTED; if (vsecp->vsa_aclflags & ACL_AUTO_INHERIT) aclp->z_hints |= ZFS_ACL_AUTO_INHERIT; } *zaclp = aclp; return (0); }
0
null
-1
https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f
0CCPP
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Path relativeFile = source.relativize(file); final Path destFile = Paths.get(destDir.toString(), relativeFile.toString()); Path normalizedPath = destFile.normalize(); if(!normalizedPath.startsWith(destDir)) { throw new OLATRuntimeException("Invalid ZIP"); } if(filter.matches(file)) { Files.copy(file, destFile, StandardCopyOption.REPLACE_EXISTING); } return FileVisitResult.CONTINUE; }
0
null
-1
https://github.com/OpenOLAT/OpenOLAT/commit/699490be8e931af0ef1f135c55384db1f4232637
2Java
public boolean isUserOnDuty(final String user, final Calendar time) throws IOException { update(); m_readLock.lock(); try { if (!m_dutySchedules.containsKey(user)) return true; for (final DutySchedule curSchedule : m_dutySchedules.get(user)) { if (curSchedule.isInSchedule(time)) { return true; } } } finally { m_readLock.unlock(); } return false; }
0
null
-1
https://github.com/OpenNMS/opennms/commit/607151ea8f90212a3fb37c977fa57c7d58d26a84
2Java
static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan, Quantum *restrict pixel) { pixel[image->channel_map[CyanPixelChannel].offset]=cyan; }
0
null
-1
https://github.com/ImageMagick/ImageMagick/commit/450bd716ed3b9186dd10f9e60f630a3d9eeea2a4
0CCPP
poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { if (! pool->ptr && ! poolGrow(pool)) { return NULL; } for (; n > 0; --n, s++) { if (! poolAppendChar(pool, *s)) return NULL; } s = pool->start; poolFinish(pool); return s; }
0
null
-1
https://github.com/libexpat/libexpat/commit/c20b758c332d9a13afbbb276d30db1d183a85d43
0CCPP
unique_ptr<IOBuf> IOBuf::cloneOne() const { if (SharedInfo* info = sharedInfo()) { info->refcount.fetch_add(1, std::memory_order_acq_rel); } return std::unique_ptr<IOBuf>(new IOBuf( InternalConstructor(), flagsAndSharedInfo_, buf_, capacity_, data_, length_)); }
0
null
-1
https://github.com/facebook/folly/commit/4f304af1411e68851bdd00ef6140e9de4616f7d3
0CCPP