processed_func
string | target
int64 | flaw_line
string | flaw_line_index
int64 | commit_url
string | language
class label |
|---|---|---|---|---|---|
def __init__(self):
super(JSONReportWriter, self).__init__()
self.data = {}
| 0
| null | -1
|
https://github.com/shuup/shuup.git/commit/0a2db392e8518410c282412561461cd8797eea51
| 4Python
|
bool verGreaterEqual(const std::string &src_ver, const std::string &target_ver)
{
string_size src_pos_beg = 0, src_pos_end, target_pos_beg = 0, target_pos_end;
while(true)
{
src_pos_end = src_ver.find('.', src_pos_beg);
if(src_pos_end == src_ver.npos)
src_pos_end = src_ver.size();
int part_src = std::stoi(src_ver.substr(src_pos_beg, src_pos_end - src_pos_beg));
target_pos_end = target_ver.find('.', target_pos_beg);
if(target_pos_end == target_ver.npos)
target_pos_end = target_ver.size();
int part_target = std::stoi(target_ver.substr(target_pos_beg, target_pos_end - target_pos_beg));
if(part_src > part_target)
break;
else if(part_src < part_target)
return false;
else if(src_pos_end >= src_ver.size() - 1 || target_pos_end >= target_ver.size() - 1)
break;
src_pos_beg = src_pos_end + 1;
target_pos_beg = target_pos_end + 1;
}
return true;
}
| 0
| null | -1
|
https://github.com/tindy2013/subconverter/commit/ce8d2bd0f13f05fcbd2ed90755d097f402393dd3
| 0CCPP
|
public DefaultServerAuthContext(CallbackHandler handler, ServerAuthModule serverAuthModule) throws AuthException {
this.serverAuthModule = serverAuthModule;
serverAuthModule.initialize(null, null, handler, Collections.<String, String> emptyMap());
}
| 1
|
0,1
| -1
|
https://github.com/wildfly-security/soteria/commit/1a6234e394a34612f4a73e84857af06ff2d412d7
| 2Java
|
static enum enc_level
decrypt_packet (struct lsquic_enc_session *enc_session, uint8_t path_id,
uint64_t pack_num, unsigned char *buf, size_t *header_len,
size_t data_len, unsigned char *buf_out, size_t max_out_len,
size_t *out_len)
{
int ret;
uint8_t nonce[12];
uint64_t path_id_packet_number;
EVP_AEAD_CTX *key = NULL;
int try_times = 0;
enum enc_level enc_level;
path_id_packet_number = combine_path_id_pack_num(path_id, pack_num);
memcpy(buf_out, buf, *header_len);
do
{
if (enc_session->have_key == 3 && try_times == 0)
{
key = enc_session->dec_ctx_f;
memcpy(nonce, enc_session->dec_key_nonce_f, 4);
LSQ_DEBUG("decrypt_packet using 'F' key...");
enc_level = ENC_LEV_FORW;
}
else
{
key = enc_session->dec_ctx_i;
memcpy(nonce, enc_session->dec_key_nonce_i, 4);
LSQ_DEBUG("decrypt_packet using 'I' key...");
enc_level = ENC_LEV_INIT;
}
memcpy(nonce + 4, &path_id_packet_number,
sizeof(path_id_packet_number));
*out_len = data_len;
ret = lsquic_aes_aead_dec(key,
buf, *header_len,
nonce, 12,
buf + *header_len, data_len,
buf_out + *header_len, out_len);
if (ret != 0)
++try_times;
else
{
if (enc_session->peer_have_final_key == 0 &&
enc_session->have_key == 3 &&
try_times == 0)
{
LSQ_DEBUG("!!!decrypt_packet find peer have final key.");
enc_session->peer_have_final_key = 1;
EV_LOG_CONN_EVENT(&enc_session->cid, "settled on private key "
"'%c' after %d tries (packet number %"PRIu64")",
key == enc_session->dec_ctx_f ? 'F' : 'I',
try_times, pack_num);
}
break;
}
}
while (try_times < 2);
LSQ_DEBUG("***decrypt_packet %s.", (ret == 0 ? "succeed" : "failed"));
return ret == 0 ? enc_level : (enum enc_level) -1;
| 0
| null | -1
|
https://github.com/litespeedtech/lsquic/commit/a74702c630e108125e71898398737baec8f02238
| 0CCPP
|
SFTPWrapper.prototype.readFile = function(path, options, callback_) {
return this._stream.readFile(path, options, callback_);
};
| 1
|
0,1,2
| -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
textfieldrep(Str s, int width)
{
Lineprop c_type;
Str n = Strnew_size(width + 2);
int i, j, k, c_len;
j = 0;
for (i = 0; i < s->length; i += c_len) {
c_type = get_mctype((unsigned char *)&s->ptr[i]);
c_len = get_mclen(&s->ptr[i]);
if (s->ptr[i] == '\r')
continue;
k = j + get_mcwidth(&s->ptr[i]);
if (k > width)
break;
if (c_type == PC_CTRL)
Strcat_char(n, ' ');
#ifdef USE_M17N
else if (c_type & PC_UNKNOWN)
Strcat_char(n, ' ');
#endif
else if (s->ptr[i] == '&')
Strcat_charp(n, "&");
else if (s->ptr[i] == '<')
Strcat_charp(n, "<");
else if (s->ptr[i] == '>')
Strcat_charp(n, ">");
else
Strcat_charp_n(n, &s->ptr[i], c_len);
j = k;
}
for (; j < width; j++)
Strcat_char(n, ' ');
return n;
}
| 0
| null | -1
|
https://github.com/tats/w3m/commit/7fdc83b0364005a0b5ed869230dd81752ba022e8
| 0CCPP
|
int read_header_tga(gdIOCtx *ctx, oTga *tga)
{
unsigned char header[18];
if (gdGetBuf(header, sizeof(header), ctx) < 18) {
gd_error("fail to read header");
return -1;
}
tga->identsize = header[0];
tga->colormaptype = header[1];
tga->imagetype = header[2];
tga->colormapstart = header[3] + (header[4] << 8);
tga->colormaplength = header[5] + (header[6] << 8);
tga->colormapbits = header[7];
tga->xstart = header[8] + (header[9] << 8);
tga->ystart = header[10] + (header[11] << 8);
tga->width = header[12] + (header[13] << 8);
tga->height = header[14] + (header[15] << 8);
tga->bits = header[16];
tga->alphabits = header[17] & 0x0f;
tga->fliph = (header[17] & 0x10) ? 1 : 0;
tga->flipv = (header[17] & 0x20) ? 0 : 1;
#if DEBUG
printf("format bps: %i\n", tga->bits);
printf("flip h/v: %i / %i\n", tga->fliph, tga->flipv);
printf("alpha: %i\n", tga->alphabits);
printf("wxh: %i %i\n", tga->width, tga->height);
#endif
switch(tga->bits) {
case 8:
case 16:
case 24:
case 32:
break;
default:
gd_error("bps %i not supported", tga->bits);
return -1;
break;
}
tga->ident = NULL;
if (tga->identsize > 0) {
tga->ident = (char *) gdMalloc(tga->identsize * sizeof(char));
if(tga->ident == NULL) {
return -1;
}
gdGetBuf(tga->ident, tga->identsize, ctx);
}
return 1;
}
| 1
|
27,28,29,30,31,32,33,34,36
| -1
|
https://github.com/libgd/libgd/commit/10ef1dca63d62433fda13309b4a228782db823f7
| 0CCPP
|
ImagePopover.prototype._loadImage = function(src, callback) {
if (/^data:image/.test(src) && !this.editor.uploader) {
if (callback) {
callback(false);
}
return;
}
if (this.target.attr('src') === src) {
return;
}
return this.button.loadImage(this.target, src, (function(_this) {
return function(img) {
var blob;
if (!img) {
return;
}
if (_this.active) {
_this.width = img.width;
_this.height = img.height;
_this.widthEl.val(_this.width);
_this.heightEl.val(_this.height);
}
if (/^data:image/.test(src)) {
blob = _this.editor.util.dataURLtoBlob(src);
blob.name = "Base64 Image.png";
_this.editor.uploader.upload(blob, {
inline: true,
img: _this.target
});
} else {
_this.editor.trigger('valuechanged');
}
if (callback) {
return callback(img);
}
};
})(this));
};
| 0
| null | -1
|
https://github.com/mycolorway/simditor/commit/ef01a643cbb7f8163535d6bfb71135f80ec6a6fd
| 3JavaScript
|
public static boolean zipAll(File rootFile, File targetZipFile, boolean withMetadata) {
Set<String> fileSet = new HashSet<>();
String[] files = rootFile.list();
for (int i = 0; i < files.length; i++) {
fileSet.add(files[i]);
}
return zip(fileSet, rootFile, targetZipFile, VFSAllItemsFilter.ACCEPT_ALL, withMetadata);
}
| 0
| null | -1
|
https://github.com/OpenOLAT/OpenOLAT/commit/5668a41ab3f1753102a89757be013487544279d5
| 2Java
|
"nTh": nTh ? nTh : document.createElement('th'),
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
"mData": oDefaults.mData ? oDefaults.mData : iCol,
idx: iCol
} );
oSettings.aoColumns.push( oCol );
var searchCols = oSettings.aoPreSearchCols;
searchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] );
_fnColumnOptions( oSettings, iCol, $(nTh).data() );
}
| 0
| null | -1
|
https://github.com/DataTables/Dist-DataTables/commit/59a8d3f8a3c1138ab08704e783bc52bfe88d7c9b
| 3JavaScript
|
cs.get.hwb = function (string) {
if (!string) {
return null;
}
var hwb = /^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
var match = string.match(hwb);
if (match) {
var alpha = parseFloat(match[4]);
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
var w = clamp(parseFloat(match[2]), 0, 100);
var b = clamp(parseFloat(match[3]), 0, 100);
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, w, b, a];
}
return null;
};
| 1
|
4
| -1
|
https://github.com/Qix-/color-string/commit/0789e21284c33d89ebc4ab4ca6f759b9375ac9d3
| 3JavaScript
|
exports.get = function(obj, path) {
var cachekey = 'G=' + path;
if (F.temporary.other[cachekey])
return F.temporary.other[cachekey](obj);
var arr = parsepath(path);
var builder = [];
for (var i = 0, length = arr.length - 1; i < length; i++)
builder.push('if(!w' + (!arr[i] || arr[i][0] === '[' ? '' : '.') + arr[i] + ')return');
var v = arr[arr.length - 1];
var fn = (new Function('w', builder.join(';') + ';return w' + (v[0] === '[' ? '' : '.') + v));
F.temporary.other[cachekey] = fn;
return fn(obj);
};
| 1
| null | -1
|
https://github.com/totaljs/framework/commit/887b0fa9e162ef7a2dd9cec20a5ca122726373b3
| 3JavaScript
|
TfLiteStatus Relu1Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
const ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data);
switch (input->type) {
case kTfLiteFloat32: {
optimized_ops::Relu1(GetTensorShape(input), GetTensorData<float>(input),
GetTensorShape(output),
GetTensorData<float>(output));
return kTfLiteOk;
} break;
case kTfLiteUInt8: {
QuantizedReluX<uint8_t>(-1.0f, 1.0f, input, output, data);
return kTfLiteOk;
} break;
case kTfLiteInt8: {
QuantizedReluX<int8_t>(-1, 1, input, output, data);
return kTfLiteOk;
} break;
default:
TF_LITE_KERNEL_LOG(context,
"Only float32, uint8, int8 supported "
"currently, got %s.",
TfLiteTypeGetName(input->type));
return kTfLiteError;
}
}
| 1
|
1,2
| -1
|
https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35
| 0CCPP
|
_flumeUse : function (name, flumeview) {
ssb.use(name, flumeview)
return ssb[name]
},
| 0
| null | -1
|
https://github.com/ssbc/ssb-db/commit/ee983727fc78eea94564733693ccda18a1fffcf2
| 3JavaScript
|
void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)
{
QWriteLocker locker(&lock);
Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };
m_peers.push_back(temp);
if (m_peers.size() >= MAX_LOG_MESSAGES)
m_peers.pop_front();
emit newLogPeer(temp);
}
| 1
|
3
| -1
|
https://github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16
| 0CCPP
|
void init_xml_schema()
{
VALUE nokogiri = rb_define_module("Nokogiri");
VALUE xml = rb_define_module_under(nokogiri, "XML");
VALUE klass = rb_define_class_under(xml, "Schema", rb_cObject);
cNokogiriXmlSchema = klass;
rb_define_singleton_method(klass, "read_memory", read_memory, 1);
rb_define_singleton_method(klass, "from_document", from_document, 1);
rb_define_private_method(klass, "validate_document", validate_document, 1);
rb_define_private_method(klass, "validate_file", validate_file, 1);
}
| 1
|
6,7
| -1
|
https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b
| 0CCPP
|
public String getLanguagePreference(XWikiContext context)
{
return getLocalePreference(context).toString();
}
| 0
| null | -1
|
https://github.com/xwiki/xwiki-platform/commit/f9a677408ffb06f309be46ef9d8df1915d9099a4
| 2Java
|
explicit UnravelIndexOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
| 1
|
0
| -1
|
https://github.com/tensorflow/tensorflow/commit/58b34c6c8250983948b5a781b426f6aa01fd47af
| 0CCPP
|
map_engine_active_zone(void)
{
return s_current_zone;
}
| 0
| null | -1
|
https://github.com/spheredev/neosphere/commit/252c1ca184cb38e1acb917aa0e451c5f08519996
| 0CCPP
|
set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
{
char *startCur = ciphers;
int algCount = 0;
static ALG_ID algIds[45]; /*
while(startCur && (0 != *startCur) && (algCount < 45)) {
long alg = strtol(startCur, 0, 0);
if(!alg)
alg = get_alg_id_by_name(startCur);
if(alg)
algIds[algCount++] = alg;
else if(!strncmp(startCur, "USE_STRONG_CRYPTO",
sizeof("USE_STRONG_CRYPTO") - 1) ||
!strncmp(startCur, "SCH_USE_STRONG_CRYPTO",
sizeof("SCH_USE_STRONG_CRYPTO") - 1))
schannel_cred->dwFlags |= SCH_USE_STRONG_CRYPTO;
else
return CURLE_SSL_CIPHER;
startCur = strchr(startCur, ':');
if(startCur)
startCur++;
}
schannel_cred->palgSupportedAlgs = algIds;
schannel_cred->cSupportedAlgs = algCount;
return CURLE_OK;
}
| 1
|
0,4,5
| -1
|
https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a32834511
| 0CCPP
|
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
Subgraph* subgraph = reinterpret_cast<Subgraph*>(context->impl_);
const TfLiteTensor* input_resource_id_tensor =
GetInput(context, node, kInputVariableId);
const TfLiteTensor* input_value_tensor = GetInput(context, node, kInputValue);
int resource_id = input_resource_id_tensor->data.i32[0];
auto& resources = subgraph->resources();
resource::CreateResourceVariableIfNotAvailable(&resources, resource_id);
auto* variable = resource::GetResourceVariable(&resources, resource_id);
TF_LITE_ENSURE(context, variable != nullptr);
variable->AssignFrom(input_value_tensor);
return kTfLiteOk;
}
| 1
|
2,3,4
| -1
|
https://github.com/tensorflow/tensorflow/commit/1970c2158b1ffa416d159d03c3370b9a462aee35
| 0CCPP
|
snmp_oid_decode_oid(uint8_t *buf, uint32_t *buff_len, uint32_t *oid, uint32_t *oid_len)
{
uint32_t *start;
uint8_t *buf_end, type;
uint8_t len;
div_t first;
start = oid;
buf = snmp_ber_decode_type(buf, buff_len, &type);
if(buf == NULL) {
return NULL;
}
if(type != SNMP_DATA_TYPE_OBJECT) {
return NULL;
}
buf = snmp_ber_decode_length(buf, buff_len, &len);
if(buf == NULL) {
return NULL;
}
buf_end = buf + len;
(*buff_len)--;
first = div(*buf++, 40);
*oid++ = (uint32_t)first.quot;
*oid++ = (uint32_t)first.rem;
while(buf != buf_end) {
--(*oid_len);
if(*oid_len == 0) {
return NULL;
}
int i;
*oid = (uint32_t)(*buf & 0x7F);
for(i = 0; i < 4; i++) {
(*buff_len)--;
if((*buf++ & 0x80) == 0) {
break;
}
*oid <<= 7;
*oid |= (*buf & 0x7F);
}
++oid;
}
*oid++ = ((uint32_t)-1);
*oid_len = (uint32_t)(oid - start);
return buf;
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43
| -1
|
https://github.com/contiki-ng/contiki-ng/commit/12c824386ab60de757de5001974d73b32e19ad71
| 0CCPP
|
static int check_map_access_type(struct bpf_verifier_env *env, u32 regno,
int off, int size, enum bpf_access_type type)
{
struct bpf_reg_state *regs = cur_regs(env);
struct bpf_map *map = regs[regno].map_ptr;
u32 cap = bpf_map_flags_to_cap(map);
if (type == BPF_WRITE && !(cap & BPF_MAP_CAN_WRITE)) {
verbose(env, "write into map forbidden, value_size=%d off=%d size=%d\n",
map->value_size, off, size);
return -EACCES;
}
if (type == BPF_READ && !(cap & BPF_MAP_CAN_READ)) {
verbose(env, "read from map forbidden, value_size=%d off=%d size=%d\n",
map->value_size, off, size);
return -EACCES;
}
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/801c6058d14a82179a7ee17a4b532cac6fad067f
| 0CCPP
|
public void translate(ServerPlaySoundPacket packet, GeyserSession session) {
String packetSound;
if (packet.getSound() instanceof BuiltinSound) {
packetSound = ((BuiltinSound) packet.getSound()).getName();
} else if (packet.getSound() instanceof CustomSound) {
packetSound = ((CustomSound) packet.getSound()).getName();
} else {
session.getConnector().getLogger().debug("Unknown sound packet, we were unable to map this. " + packet.toString());
return;
}
SoundMapping soundMapping = Registries.SOUNDS.get(packetSound.replace("minecraft:", ""));
String playsound;
if (soundMapping == null || soundMapping.getPlaysound() == null) {
session.getConnector().getLogger()
.debug("[PlaySound] Defaulting to sound server gave us for " + packet.toString());
playsound = packetSound.replace("minecraft:", "");
} else {
playsound = soundMapping.getPlaysound();
}
PlaySoundPacket playSoundPacket = new PlaySoundPacket();
playSoundPacket.setSound(playsound);
playSoundPacket.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ()));
playSoundPacket.setVolume(packet.getVolume());
playSoundPacket.setPitch(packet.getPitch());
session.sendUpstreamPacket(playSoundPacket);
}
| 1
|
0
| -1
|
https://github.com/GeyserMC/Geyser/commit/b9541505af68ac7b7c093206ac7b1ba88957a5a6
| 2Java
|
GF_Err av1dmx_parse_vp9(GF_Filter *filter, GF_AV1DmxCtx *ctx)
{
Bool key_frame = GF_FALSE;
u64 frame_size = 0, pts = 0;
u64 pos, pos_ivf_hdr;
u32 width = 0, height = 0, renderWidth, renderHeight;
u32 num_frames_in_superframe = 0, superframe_index_size = 0, i = 0;
u32 frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME];
u8 *output;
GF_Err e;
pos_ivf_hdr = gf_bs_get_position(ctx->bs);
e = gf_media_parse_ivf_frame_header(ctx->bs, &frame_size, &pts);
if (e) return e;
pos = gf_bs_get_position(ctx->bs);
if (gf_bs_available(ctx->bs) < frame_size) {
gf_bs_seek(ctx->bs, pos_ivf_hdr);
return GF_EOS;
}
if (ctx->pts_from_file) {
pts += ctx->cumulated_dur;
if (ctx->last_pts && (ctx->last_pts>pts)) {
pts -= ctx->cumulated_dur;
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[IVF/VP9] Corrupted timestamp "LLU" less than previous timestamp "LLU", assuming concatenation\n", pts, ctx->last_pts));
ctx->cumulated_dur = ctx->last_pts + ctx->cur_fps.den;
ctx->cumulated_dur -= pts;
pts = ctx->cumulated_dur;
}
ctx->last_pts = pts;
}
e = gf_media_vp9_parse_superframe(ctx->bs, frame_size, &num_frames_in_superframe, frame_sizes, &superframe_index_size);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[VP9Dmx] Error parsing superframe structure\n"));
return e;
}
for (i = 0; i < num_frames_in_superframe; ++i) {
u64 pos2 = gf_bs_get_position(ctx->bs);
if (gf_media_vp9_parse_sample(ctx->bs, ctx->vp_cfg, &key_frame, &width, &height, &renderWidth, &renderHeight) != GF_OK) {
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[VP9Dmx] Error parsing frame\n"));
return e;
}
e = gf_bs_seek(ctx->bs, pos2 + frame_sizes[i]);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[VP9Dmx] Seek bad param (offset "LLU") (1)", pos2 + frame_sizes[i]));
return e;
}
}
if (gf_bs_get_position(ctx->bs) + superframe_index_size != pos + frame_size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[VP9Dmx] Inconsistent IVF frame size of "LLU" bytes.\n", frame_size));
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (" Detected %d frames (+ %d bytes for the superframe index):\n", num_frames_in_superframe, superframe_index_size));
for (i = 0; i < num_frames_in_superframe; ++i) {
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (" superframe %d, size is %u bytes\n", i, frame_sizes[i]));
}
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("\n"));
}
e = gf_bs_seek(ctx->bs, pos + frame_size);
if (e) {
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[VP9Dmx] Seek bad param (offset "LLU") (2)", pos + frame_size));
return e;
}
u32 pck_size = (u32)(gf_bs_get_position(ctx->bs) - pos);
assert(pck_size == frame_size);
av1dmx_check_pid(filter, ctx);
if (!ctx->opid) {
return GF_OK;
}
if (!ctx->is_playing) {
gf_bs_seek(ctx->bs, pos_ivf_hdr);
return GF_EOS;
}
GF_FilterPacket *pck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output);
if (!pck) {
gf_bs_seek(ctx->bs, pos_ivf_hdr);
return GF_OUT_OF_MEM;
}
if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck);
if (ctx->pts_from_file) {
gf_filter_pck_set_cts(pck, pts);
} else {
gf_filter_pck_set_cts(pck, ctx->cts);
}
if (key_frame) {
gf_filter_pck_set_sap(pck, GF_FILTER_SAP_1);
}
if (ctx->deps) {
u8 flags = 0;
flags = (key_frame) ? 2 : 1;
flags <<= 2;
flags <<= 2;
gf_filter_pck_set_dependency_flags(pck, flags);
}
gf_bs_seek(ctx->bs, pos);
gf_bs_read_data(ctx->bs, output, pck_size);
gf_filter_pck_send(pck);
av1dmx_update_cts(ctx);
return GF_OK;
}
| 0
| null | -1
|
https://github.com/gpac/gpac/commit/13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec
| 0CCPP
|
int enc_untrusted_listen(int sockfd, int backlog) {
return EnsureInitializedAndDispatchSyscall(asylo::system_call::kSYS_listen,
sockfd, backlog);
}
| 0
| null | -1
|
https://github.com/google/asylo/commit/ed0926bff0e423cd122a18b3d2fc772817f66825
| 0CCPP
|
exports.create = function(parent, title){
var suite = new Suite(title, parent.ctx);
suite.parent = parent;
if (parent.pending) suite.pending = true;
title = suite.fullTitle();
parent.addSuite(suite);
return suite;
};
| 1
|
0
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
ushort *CLASS make_decoder(const uchar *source) { return make_decoder_ref(&source); }
| 0
| null | -1
|
https://github.com/LibRaw/LibRaw/commit/e47384546b43d0fd536e933249047bc397a4d88b
| 0CCPP
|
static void nfs4_open_release(void *calldata)
{
struct nfs4_opendata *data = calldata;
struct nfs4_state *state = NULL;
if (data->cancelled == 0)
goto out_free;
if (data->rpc_status != 0 || !data->rpc_done)
goto out_free;
if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
goto out_free;
state = nfs4_opendata_to_nfs4_state(data);
if (!IS_ERR(state))
nfs4_close_state(state, data->o_arg.fmode);
out_free:
nfs4_opendata_put(data);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/18e3b739fdc826481c6a1335ce0c5b19b3d415da
| 0CCPP
|
u=0:V==mxConstants.DIRECTION_NORTH?(u=0,I=-I):V==mxConstants.DIRECTION_WEST?(u=-u,I=0):V==mxConstants.DIRECTION_EAST&&(I=0);C.moveCells(ta,u,I);return C.addCells(R,ia)}finally{C.model.endUpdate()}}function m(J,V){C.model.beginUpdate();try{var P=C.model.getParent(J),R=C.getIncomingTreeEdges(J),ia=d(J);0==R.length&&(R=[C.createEdge(P,null,"",null,null,C.createCurrentEdgeStyle())],ia=V);var la=C.cloneCells([R[0],J]);C.model.setTerminal(la[0],J,!0);if(null==C.model.getTerminal(la[0],!1)){C.model.setTerminal(la[0],
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
void LanLinkProvider::sslErrors(const QList<QSslError>& errors)
{
QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
if (!socket) return;
bool fatal = false;
for (const QSslError& error : errors) {
if (error.error() != QSslError::SelfSignedCertificate) {
qCCritical(KDECONNECT_CORE) << "Disconnecting due to fatal SSL Error: " << error;
fatal = true;
} else {
qCDebug(KDECONNECT_CORE) << "Ignoring self-signed cert error";
}
}
if (fatal) {
socket->disconnectFromHost();
delete m_receivedIdentityPackets.take(socket).np;
}
}
| 0
| null | -1
|
https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991
| 0CCPP
|
static int handle_vmread(struct kvm_vcpu *vcpu)
{
unsigned long field;
u64 field_value;
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
gva_t gva = 0;
if (!nested_vmx_check_permission(vcpu) ||
!nested_vmx_check_vmcs12(vcpu))
return 1;
field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
if (vmcs12_read_any(vcpu, field, &field_value) < 0) {
nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
skip_emulated_instruction(vcpu);
return 1;
}
if (vmx_instruction_info & (1u << 10)) {
kvm_register_writel(vcpu, (((vmx_instruction_info) >> 3) & 0xf),
field_value);
} else {
if (get_vmx_mem_address(vcpu, exit_qualification,
vmx_instruction_info, true, &gva))
return 1;
kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, gva,
&field_value, (is_long_mode(vcpu) ? 8 : 4), NULL);
}
nested_vmx_succeed(vcpu);
skip_emulated_instruction(vcpu);
return 1;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/54a20552e1eae07aa240fa370a0293e006b5faed
| 0CCPP
|
int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
const char *name, unsigned int flags,
struct path *path)
{
struct filename *filename = getname_kernel(name);
int err = PTR_ERR(filename);
BUG_ON(flags & LOOKUP_PARENT);
if (!IS_ERR(filename)) {
struct nameidata nd;
nd.root.dentry = dentry;
nd.root.mnt = mnt;
err = filename_lookup(AT_FDCWD, filename,
flags | LOOKUP_ROOT, &nd);
if (!err)
*path = nd.path;
putname(filename);
}
return err;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/f15133df088ecadd141ea1907f2c96df67c729f0
| 0CCPP
|
convertChangesToDMP: function(changes){
var ret = [], change;
for ( var i = 0; i < changes.length; i++) {
change = changes[i];
ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);
}
return ret;
}
| 1
|
0
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
CModules::CModules()
: m_pUser(nullptr), m_pNetwork(nullptr), m_pClient(nullptr) {}
| 0
| null | -1
|
https://github.com/znc/znc/commit/8de9e376ce531fe7f3c8b0aa4876d15b479b7311
| 0CCPP
|
static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct wireless_dev *wdev;
struct net_device *dev = info->user_ptr[1];
u8 ps_state;
bool state;
int err;
if (!info->attrs[NL80211_ATTR_PS_STATE])
return -EINVAL;
ps_state = nla_get_u32(info->attrs[NL80211_ATTR_PS_STATE]);
if (ps_state != NL80211_PS_DISABLED && ps_state != NL80211_PS_ENABLED)
return -EINVAL;
wdev = dev->ieee80211_ptr;
if (!rdev->ops->set_power_mgmt)
return -EOPNOTSUPP;
state = (ps_state == NL80211_PS_ENABLED) ? true : false;
if (state == wdev->ps)
return 0;
err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, state,
wdev->ps_timeout);
if (!err)
wdev->ps = state;
return err;
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/208c72f4fe44fe09577e7975ba0e7fa0278f3d03
| 0CCPP
|
def __init__(
self,
reactor: IReactorTime,
agent: IAgent,
user_agent: bytes,
well_known_cache: Optional[TTLCache] = None,
had_well_known_cache: Optional[TTLCache] = None,
):
self._reactor = reactor
self._clock = Clock(reactor)
if well_known_cache is None:
well_known_cache = _well_known_cache
if had_well_known_cache is None:
had_well_known_cache = _had_valid_well_known_cache
self._well_known_cache = well_known_cache
self._had_valid_well_known_cache = had_well_known_cache
self._well_known_agent = RedirectAgent(agent)
self.user_agent = user_agent
| 0
| null | -1
|
https://github.com/matrix-org/synapse.git/commit/ff5c4da1289cb5e097902b3e55b771be342c29d6
| 4Python
|
function reqExec(chan, cmd, opts, cb) {
if (chan.outgoing.state !== 'open') {
cb(new Error('Channel is not open'));
return;
}
chan._callbacks.push((had_err) => {
if (had_err) {
cb(had_err !== true ? had_err : new Error('Unable to exec'));
return;
}
chan.subtype = 'exec';
chan.allowHalfOpen = (opts.allowHalfOpen !== false);
cb(undefined, chan);
});
chan._client._protocol.exec(chan.outgoing.id, cmd, true);
}
| 0
| null | -1
|
https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21
| 3JavaScript
|
0>ea&&(ea=N.strokeWidth/2);u.setStrokeAlpha(u.state.fillAlpha);u.setStrokeColor(N.fill||"");u.setStrokeWidth(ea);u.setDashed(!1);this._drawToContext(J,T,N);u.setDashed(ba);u.setStrokeWidth(R);u.setStrokeColor(Q);u.setStrokeAlpha(Y)};E._drawToContext=function(J,T,N){J.begin();for(var Q=0;Q<T.ops.length;Q++){var R=T.ops[Q],Y=R.data;switch(R.op){case "move":J.moveTo(Y[0],Y[1]);break;case "bcurveTo":J.curveTo(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);break;case "lineTo":J.lineTo(Y[0],Y[1])}}J.end();"fillPath"===
T.type&&N.filled?J.fill():J.stroke()};return E};(function(){function u(Q,R,Y){this.canvas=Q;this.rc=R;this.shape=Y;this.canvas.setLineJoin("round");this.canvas.setLineCap("round");this.originalBegin=this.canvas.begin;this.canvas.begin=mxUtils.bind(this,u.prototype.begin);this.originalEnd=this.canvas.end;this.canvas.end=mxUtils.bind(this,u.prototype.end);this.originalRect=this.canvas.rect;this.canvas.rect=mxUtils.bind(this,u.prototype.rect);this.originalRoundrect=this.canvas.roundrect;this.canvas.roundrect=
| 1
|
0,1
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
static int input_devices_seq_show(struct seq_file *seq, void *v)
{
struct input_dev *dev = container_of(v, struct input_dev, node);
const char *path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL);
struct input_handle *handle;
seq_printf(seq, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
seq_printf(seq, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : "");
seq_printf(seq, "S: Sysfs=%s\n", path ? path : "");
seq_printf(seq, "U: Uniq=%s\n", dev->uniq ? dev->uniq : "");
seq_puts(seq, "H: Handlers=");
list_for_each_entry(handle, &dev->h_list, d_node)
seq_printf(seq, "%s ", handle->name);
seq_putc(seq, '\n');
input_seq_print_bitmap(seq, "PROP", dev->propbit, INPUT_PROP_MAX);
input_seq_print_bitmap(seq, "EV", dev->evbit, EV_MAX);
if (test_bit(EV_KEY, dev->evbit))
input_seq_print_bitmap(seq, "KEY", dev->keybit, KEY_MAX);
if (test_bit(EV_REL, dev->evbit))
input_seq_print_bitmap(seq, "REL", dev->relbit, REL_MAX);
if (test_bit(EV_ABS, dev->evbit))
input_seq_print_bitmap(seq, "ABS", dev->absbit, ABS_MAX);
if (test_bit(EV_MSC, dev->evbit))
input_seq_print_bitmap(seq, "MSC", dev->mscbit, MSC_MAX);
if (test_bit(EV_LED, dev->evbit))
input_seq_print_bitmap(seq, "LED", dev->ledbit, LED_MAX);
if (test_bit(EV_SND, dev->evbit))
input_seq_print_bitmap(seq, "SND", dev->sndbit, SND_MAX);
if (test_bit(EV_FF, dev->evbit))
input_seq_print_bitmap(seq, "FF", dev->ffbit, FF_MAX);
if (test_bit(EV_SW, dev->evbit))
input_seq_print_bitmap(seq, "SW", dev->swbit, SW_MAX);
seq_putc(seq, '\n');
kfree(path);
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/cb222aed03d798fc074be55e59d9a112338ee784
| 0CCPP
|
getScriptOperations(script: Buffer) {
let ops: PushDataOperation[] = [];
try {
let n = 0;
let dlen: number;
while (n < script.length) {
let op: PushDataOperation = { opcode: script[n], data: null }
n += 1;
if(op.opcode <= this.BITBOX.Script.opcodes.OP_PUSHDATA4) {
if(op.opcode < this.BITBOX.Script.opcodes.OP_PUSHDATA1)
dlen = op.opcode;
else if(op.opcode === this.BITBOX.Script.opcodes.OP_PUSHDATA1) {
dlen = script[n];
n += 1;
}
else if(op.opcode === this.BITBOX.Script.opcodes.OP_PUSHDATA2) {
dlen = script.slice(n, n + 2).readUIntLE(0,2);
n += 2;
}
else {
dlen = script.slice(n, n + 4).readUIntLE(0,4);
n += 4;
}
if((n + dlen) > script.length) {
throw Error('IndexError');
}
if(dlen > 0)
op.data = script.slice(n, n + dlen);
n += dlen
}
ops.push(op);
}
} catch(e) {
//console.log(e);
throw Error('truncated script')
}
return ops;
}
| 1
|
0,1,6,8,9,11,14,15,16,18,19,20,23,24,26,28,32,33,34
| -1
|
https://github.com/simpleledger/slpjs/commit/ac8809b42e47790a6f0205991b36f2699ed10c84
| 5TypeScript
|
static CPU_MODEL *get_cpu_model(char *model) {
static CPU_MODEL *cpu = NULL;
if (cpu && !strcasecmp (model, cpu->model))
return cpu;
cpu = __get_cpu_model_recursive (model);
return cpu;
}
| 0
| null | -1
|
https://github.com/radareorg/radare2/commit/d04c78773f6959bcb427453f8e5b9824d5ba9eff
| 0CCPP
|
AP_DECLARE(int) ap_state_query(int query)
{
switch (query) {
case AP_SQ_MAIN_STATE:
return ap_main_state;
case AP_SQ_RUN_MODE:
return ap_run_mode;
case AP_SQ_CONFIG_GEN:
return ap_config_generation;
default:
return AP_SQ_NOT_SUPPORTED;
}
}
| 0
| null | -1
|
https://github.com/apache/httpd/commit/4cc27823899e070268b906ca677ee838d07cf67a
| 0CCPP
|
static int _hostsock_close(oe_fd_t* sock_)
{
int ret = -1;
sock_t* sock = _cast_sock(sock_);
oe_errno = 0;
if (!sock)
OE_RAISE_ERRNO(OE_EINVAL);
if (oe_syscall_close_socket_ocall(&ret, sock->host_fd) != OE_OK)
OE_RAISE_ERRNO(OE_EINVAL);
if (ret == 0)
oe_free(sock);
done:
return ret;
}
| 0
| null | -1
|
https://github.com/openenclave/openenclave/commit/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
| 0CCPP
|
d[c]=e,"o"===b[1]&&Y(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||Y(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Fa(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&F(a,a,"sZeroRecords","sLoadingRecords");
a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":"");"boolean"===typeof a.scrollX&&(a.scrollX=
| 1
|
0,1
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
success = function(response) {
if (raw) {
return dfrd.resolve(response);
}
if (!response) {
return dfrd.reject(['errResponse', 'errDataEmpty'], xhr);
} else if (!$.isPlainObject(response)) {
return dfrd.reject(['errResponse', 'errDataNotJSON'], xhr);
} else if (response.error) {
return dfrd.reject(response.error, xhr);
} else if (!self.validResponse(cmd, response)) {
return dfrd.reject('errResponse', xhr);
}
response = self.normalize(response);
if (!self.api) {
self.api = response.api || 1;
self.newAPI = self.api >= 2;
self.oldAPI = !self.newAPI;
}
if (response.options) {
cwdOptions = $.extend({}, cwdOptions, response.options);
}
if (response.netDrivers) {
self.netDrivers = response.netDrivers;
}
dfrd.resolve(response);
response.debug && self.debug('backend-debug', response.debug);
},
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
| -1
|
https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f
| 3JavaScript
|
mwifiex_set_wmm_params(struct mwifiex_private *priv,
struct mwifiex_uap_bss_param *bss_cfg,
struct cfg80211_ap_settings *params)
{
const u8 *vendor_ie;
const u8 *wmm_ie;
u8 wmm_oui[] = {0x00, 0x50, 0xf2, 0x02};
vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WMM,
params->beacon.tail,
params->beacon.tail_len);
if (vendor_ie) {
wmm_ie = vendor_ie;
memcpy(&bss_cfg->wmm_info, wmm_ie +
sizeof(struct ieee_types_header), *(wmm_ie + 1));
priv->wmm_enabled = 1;
} else {
memset(&bss_cfg->wmm_info, 0, sizeof(bss_cfg->wmm_info));
memcpy(&bss_cfg->wmm_info.oui, wmm_oui, sizeof(wmm_oui));
bss_cfg->wmm_info.subtype = MWIFIEX_WMM_SUBTYPE;
bss_cfg->wmm_info.version = MWIFIEX_WMM_VERSION;
priv->wmm_enabled = 0;
}
bss_cfg->qos_info = 0x00;
return;
}
| 1
| null | -1
|
https://github.com/torvalds/linux/commit/7caac62ed598a196d6ddf8d9c121e12e082cac3a
| 0CCPP
|
H.x+" "+H.y;S="";d=[];for(V=2;V<x.length;V+=2)H=P(V),S+=" L"+H.x+" "+H.y,d.push(H);c.setAttribute("d",n+S)}p&&(H=b.view.translate,b.scrollRectToVisible((new mxRectangle(K.x-H.x,K.y-H.y)).grow(20)));F.consume()}}),mouseUp:mxUtils.bind(this,function(K,F){c&&b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(z(F.getEvent()),F.consume())})});var D=function(K){return mxUtils.convertPoint(b.container,mxEvent.getClientX(K),mxEvent.getClientY(K))},G=function(K){for(x.push(K);x.length>f;)x.shift()},P=
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
function(){return this.editor.isExportToCanvas()};EditorUi.prototype.createImageDataUri=function(d,g,k,l){d=d.toDataURL("image/"+k);if(null!=d&&6<d.length)null!=g&&(d=Editor.writeGraphModelToPng(d,"tEXt","mxfile",encodeURIComponent(g))),0<l&&(d=Editor.writeGraphModelToPng(d,"pHYs","dpi",l));else throw{message:mxResources.get("unknownError")};return d};EditorUi.prototype.saveCanvas=function(d,g,k,l,p){var q="jpeg"==k?"jpg":k;l=this.getBaseFilename(l)+(null!=g?".drawio":"")+"."+q;d=this.createImageDataUri(d,
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c287bef9101d024b1fd59d55ecd530f25000f9d8
| 3JavaScript
|
static void checkSizes (lua_State *L, global_State *g) {
if (!g->gcemergency) {
if (g->strt.nuse < g->strt.size / 4) {
l_mem olddebt = g->GCdebt;
luaS_resize(L, g->strt.size / 2);
g->GCestimate += g->GCdebt - olddebt;
}
}
}
| 0
| null | -1
|
https://github.com/lua/lua/commit/a6da1472c0c5e05ff249325f979531ad51533110
| 0CCPP
|
GF_Err gf_isom_box_parse_ex(GF_Box **outBox, GF_BitStream *bs, u32 parent_type, Bool is_root_box, u64 parent_size)
{
u32 type, uuid_type, hdr_size, restore_type;
u64 size, start, comp_start, end;
char uuid[16];
GF_Err e;
GF_BitStream *uncomp_bs = NULL;
u8 *uncomp_data = NULL;
u32 compressed_size=0;
GF_Box *newBox;
Bool skip_logs = (gf_bs_get_cookie(bs) & GF_ISOM_BS_COOKIE_NO_LOGS ) ? GF_TRUE : GF_FALSE;
Bool is_special = GF_TRUE;
if ((bs == NULL) || (outBox == NULL) ) return GF_BAD_PARAM;
*outBox = NULL;
if (gf_bs_available(bs) < 8) {
return GF_ISOM_INCOMPLETE_FILE;
}
comp_start = start = gf_bs_get_position(bs);
uuid_type = 0;
size = (u64) gf_bs_read_u32(bs);
hdr_size = 4;
if ((size >= 2) && (size <= 4)) {
size = 4;
type = GF_ISOM_BOX_TYPE_VOID;
} else {
type = gf_bs_read_u32(bs);
hdr_size += 4;
if (type == GF_ISOM_BOX_TYPE_TOTL)
size = 12;
if (!size) {
if (is_root_box) {
if (!skip_logs) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Warning Read Box type %s (0x%08X) size 0 reading till the end of file\n", gf_4cc_to_str(type), type));
}
size = gf_bs_available(bs) + 8;
} else {
if (!skip_logs) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Read Box type %s (0x%08X) at position "LLU" has size 0 but is not at root/file level. Forbidden, skipping end of parent box !\n", gf_4cc_to_str(type), type, start));
return GF_SKIP_BOX;
}
return GF_OK;
}
}
if (is_root_box && (size>=8)) {
Bool do_uncompress = GF_FALSE;
u8 *compb = NULL;
u32 osize = 0;
u32 otype = type;
if (type==GF_4CC('!', 'm', 'o', 'f')) {
do_uncompress = GF_TRUE;
type = GF_ISOM_BOX_TYPE_MOOF;
}
else if (type==GF_4CC('!', 'm', 'o', 'v')) {
do_uncompress = GF_TRUE;
type = GF_ISOM_BOX_TYPE_MOOV;
}
else if (type==GF_4CC('!', 's', 'i', 'x')) {
do_uncompress = GF_TRUE;
type = GF_ISOM_BOX_TYPE_SIDX;
}
else if (type==GF_4CC('!', 's', 's', 'x')) {
do_uncompress = GF_TRUE;
type = GF_ISOM_BOX_TYPE_SSIX;
}
if (do_uncompress) {
compb = gf_malloc((u32) (size-8));
compressed_size = (u32) (size - 8);
gf_bs_read_data(bs, compb, compressed_size);
e = gf_gz_decompress_payload(compb, compressed_size, &uncomp_data, &osize);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Failed to uncompress payload for box type %s (0x%08X)\n", gf_4cc_to_str(otype), otype));
return e;
}
size = osize + 8;
uncomp_bs = gf_bs_new(uncomp_data, osize, GF_BITSTREAM_READ);
bs = uncomp_bs;
start = 0;
gf_free(compb);
}
}
}
memset(uuid, 0, 16);
if (type == GF_ISOM_BOX_TYPE_UUID ) {
if (gf_bs_available(bs) < 16) {
return GF_ISOM_INCOMPLETE_FILE;
}
gf_bs_read_data(bs, uuid, 16);
hdr_size += 16;
uuid_type = gf_isom_solve_uuid_box(uuid);
}
if (size == 1) {
if (gf_bs_available(bs) < 8) {
return GF_ISOM_INCOMPLETE_FILE;
}
size = gf_bs_read_u64(bs);
hdr_size += 8;
}
if (!skip_logs)
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Read Box type %s size "LLD" start "LLD"\n", gf_4cc_to_str(type), size, start));
if ( size < hdr_size ) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Box %s size "LLD" less than box header size %d\n", gf_4cc_to_str(type), size, hdr_size));
return GF_ISOM_INVALID_FILE;
}
if (parent_size && (parent_size<size)) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Box %s size "LLU" is larger than remaining parent size "LLU"\n", gf_4cc_to_str(type), size, parent_size ));
return GF_ISOM_INVALID_FILE;
}
restore_type = 0;
if ((parent_type==GF_ISOM_BOX_TYPE_STSD) && (type==GF_QT_SUBTYPE_RAW) ) {
u64 cookie = gf_bs_get_cookie(bs);
restore_type = type;
if (cookie & GF_ISOM_BS_COOKIE_VISUAL_TRACK)
type = GF_QT_SUBTYPE_RAW_VID;
else
type = GF_QT_SUBTYPE_RAW_AUD;
}
if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_TREF)) {
newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_REFT);
if (!newBox) return GF_OUT_OF_MEM;
((GF_TrackReferenceTypeBox*)newBox)->reference_type = type;
} else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_IREF)) {
newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_REFI);
if (!newBox) return GF_OUT_OF_MEM;
((GF_ItemReferenceTypeBox*)newBox)->reference_type = type;
} else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_TRGR)) {
newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_TRGT);
if (!newBox) return GF_OUT_OF_MEM;
((GF_TrackGroupTypeBox*)newBox)->group_type = type;
} else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_GRPL)) {
newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_GRPT);
if (!newBox) return GF_OUT_OF_MEM;
((GF_EntityToGroupTypeBox*)newBox)->grouping_type = type;
} else {
is_special = GF_FALSE;
newBox = gf_isom_box_new_ex(uuid_type ? uuid_type : type, parent_type, skip_logs, is_root_box);
if (!newBox) return GF_OUT_OF_MEM;
}
if (type==GF_ISOM_BOX_TYPE_UUID && !is_special) {
memcpy(((GF_UUIDBox *)newBox)->uuid, uuid, 16);
((GF_UUIDBox *)newBox)->internal_4cc = uuid_type;
}
if (!newBox->type) newBox->type = type;
if (restore_type)
newBox->type = restore_type;
end = gf_bs_available(bs);
if (size - hdr_size > end ) {
newBox->size = size - hdr_size - end;
*outBox = newBox;
return GF_ISOM_INCOMPLETE_FILE;
}
newBox->size = size - hdr_size;
e = gf_isom_full_box_read(newBox, bs);
if (!e) e = gf_isom_box_read(newBox, bs);
if (e) {
if (gf_opts_get_bool("core", "no-check"))
e = GF_OK;
}
newBox->size = size;
end = gf_bs_get_position(bs);
if (uncomp_bs) {
gf_free(uncomp_data);
gf_bs_del(uncomp_bs);
if (e) {
gf_isom_box_del(newBox);
*outBox = NULL;
return e;
}
size -= 8;
if (type==GF_ISOM_BOX_TYPE_MOOF) {
((GF_MovieFragmentBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size;
}
else if (type==GF_ISOM_BOX_TYPE_MOOV) {
((GF_MovieBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size;
((GF_MovieBox *)newBox)->file_offset = comp_start;
}
else if (type==GF_ISOM_BOX_TYPE_SIDX) {
((GF_SegmentIndexBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size;
}
else if (type==GF_ISOM_BOX_TYPE_SSIX) {
((GF_SubsegmentIndexBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size;
}
newBox->internal_flags = GF_ISOM_BOX_COMPRESSED;
}
if (e && (e != GF_ISOM_INCOMPLETE_FILE)) {
gf_isom_box_del(newBox);
*outBox = NULL;
if (!skip_logs) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Read Box \"%s\" (start "LLU") failed (%s) - skipping\n", gf_4cc_to_str(type), start, gf_error_to_string(e)));
}
return e;
}
if (end-start > size) {
if (!skip_logs) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Box \"%s\" size "LLU" (start "LLU") invalid (read "LLU")\n", gf_4cc_to_str(type), size, start, (end-start) ));
}
gf_bs_seek(bs, start+size);
} else if (end-start < size) {
u32 to_skip = (u32) (size-(end-start));
if (!skip_logs) {
if ((to_skip!=4) || gf_bs_peek_bits(bs, 32, 0)) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Box \"%s\" (start "LLU") has %u extra bytes\n", gf_4cc_to_str(type), start, to_skip));
unused_bytes += to_skip;
}
}
gf_bs_skip_bytes(bs, to_skip);
}
*outBox = newBox;
return e;
}
| 1
|
186
| -1
|
https://github.com/gpac/gpac/commit/37592ad86c6ca934d34740012213e467acc4a3b0
| 0CCPP
|
rfbClientIteratorNext(rfbClientIteratorPtr i)
{
if(i->next == 0) {
LOCK(rfbClientListMutex);
i->next = i->screen->clientHead;
UNLOCK(rfbClientListMutex);
} else {
rfbClientPtr cl = i->next;
i->next = i->next->next;
rfbDecrClientRef(cl);
}
#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
if(!i->closedToo)
while(i->next && i->next->sock<0)
i->next = i->next->next;
if(i->next)
rfbIncrClientRef(i->next);
#endif
return i->next;
}
| 1
| null | -1
|
https://github.com/LibVNC/libvncserver/commit/38e98ee61d74f5f5ab4aa4c77146faad1962d6d0
| 0CCPP
|
function mxShapeInfographicShadedPyramid(a,d,e,b){mxShape.call(this);this.bounds=a;this.fill=d;this.stroke=e;this.strokewidth=null!=b?b:1}mxUtils.extend(mxShapeInfographicShadedPyramid,mxActor);mxShapeInfographicShadedPyramid.prototype.cst={SHADED_PYRAMID:"mxgraph.infographic.shadedPyramid"};
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
| 3JavaScript
|
static int bp_interception(struct vcpu_svm *svm)
{
struct kvm_run *kvm_run = svm->vcpu.run;
kvm_run->exit_reason = KVM_EXIT_DEBUG;
kvm_run->debug.arch.pc = svm->vmcb->save.cs.base + svm->vmcb->save.rip;
kvm_run->debug.arch.exception = BP_VECTOR;
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/54a20552e1eae07aa240fa370a0293e006b5faed
| 0CCPP
|
bos_print(netdissect_options *ndo,
register const u_char *bp, int length)
{
int bos_op;
if (length <= (int)sizeof(struct rx_header))
return;
if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%d", bos_op)));
bp += sizeof(struct rx_header) + 4;
switch (bos_op) {
case 80:
ND_PRINT((ndo, " type"));
STROUT(BOSNAMEMAX);
ND_PRINT((ndo, " instance"));
STROUT(BOSNAMEMAX);
break;
case 81:
case 83:
case 85:
case 87:
case 88:
case 93:
case 96:
case 97:
case 104:
case 106:
case 108:
case 112:
case 114:
STROUT(BOSNAMEMAX);
break;
case 82:
case 98:
STROUT(BOSNAMEMAX);
ND_PRINT((ndo, " status"));
INTOUT();
break;
case 86:
STROUT(BOSNAMEMAX);
ND_PRINT((ndo, " num"));
INTOUT();
break;
case 84:
case 89:
case 90:
case 91:
case 92:
case 95:
INTOUT();
break;
case 105:
STROUT(BOSNAMEMAX);
ND_PRINT((ndo, " size"));
INTOUT();
ND_PRINT((ndo, " flags"));
INTOUT();
ND_PRINT((ndo, " date"));
INTOUT();
break;
default:
;
}
return;
trunc:
ND_PRINT((ndo, " [|bos]"));
}
| 0
| null | -1
|
https://github.com/the-tcpdump-group/tcpdump/commit/aa0858100096a3490edf93034a80e66a4d61aad5
| 0CCPP
|
fill_headers(agooReq r, VALUE hash) {
char *h = r->header.start;
char *end = h + r->header.len + 1;
char *key = h;
char *kend = key;
char *val = NULL;
char *vend;
int klen;
bool upgrade = false;
bool ws = false;
if (NULL == r) {
rb_raise(rb_eArgError, "Request is no longer valid.");
}
for (; h < end; h++) {
switch (*h) {
case ':':
if (NULL == val) {
kend = h;
val = h + 1;
}
break;
case '\r':
if (NULL != val) {
for (; ' ' == *val; val++) {
}
vend = h;
}
if (NULL != key) {
for (; ' ' == *key; key++) {
}
}
if ('\n' == *(h + 1)) {
h++;
}
klen = (int)(kend - key);
add_header_value(hash, key, klen, val, (int)(vend - val));
if (sizeof(upgrade_key) - 1 == klen && 0 == strncasecmp(key, upgrade_key, sizeof(upgrade_key) - 1)) {
if (sizeof(websocket_val) - 1 == vend - val &&
0 == strncasecmp(val, websocket_val, sizeof(websocket_val) - 1)) {
ws = true;
}
} else if (sizeof(connection_key) - 1 == klen && 0 == strncasecmp(key, connection_key, sizeof(connection_key) - 1)) {
char buf[1024];
strncpy(buf, val, vend - val);
buf[sizeof(buf)-1] = '\0';
if (NULL != strstr(buf, upgrade_key)) {
upgrade = true;
}
} else if (sizeof(accept_key) - 1 == klen && 0 == strncasecmp(key, accept_key, sizeof(accept_key) - 1)) {
if (sizeof(event_stream_val) - 1 == vend - val &&
0 == strncasecmp(val, event_stream_val, sizeof(event_stream_val) - 1)) {
r->upgrade = AGOO_UP_SSE;
}
}
key = h + 1;
kend = NULL;
val = NULL;
vend = NULL;
break;
default:
break;
}
}
if (upgrade && ws) {
r->upgrade = AGOO_UP_WS;
}
}
| 0
| null | -1
|
https://github.com/ohler55/agoo/commit/23d03535cf7b50d679a60a953a0cae9519a4a130
| 0CCPP
|
SPL_METHOD(RecursiveDirectoryIterator, getChildren)
{
zval *zpath, *zflags;
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
spl_filesystem_object *subdir;
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
MAKE_STD_ZVAL(zflags);
MAKE_STD_ZVAL(zpath);
ZVAL_LONG(zflags, intern->flags);
ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1);
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC);
zval_ptr_dtor(&zpath);
zval_ptr_dtor(&zflags);
subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
if (subdir) {
if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) {
subdir->u.dir.sub_path_len = spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name);
} else {
subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name);
subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len);
}
subdir->info_class = intern->info_class;
subdir->file_class = intern->file_class;
subdir->oth = intern->oth;
}
}
| 0
| null | -1
|
https://github.com/php/php-src/commit/7245bff300d3fa8bacbef7897ff080a6f1c23eba
| 0CCPP
|
void AnnotateEnableRaceDetection(const char *file, int line, int enable){}
| 1
|
0
| -1
|
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
| 0CCPP
|
def get_scss(website_theme):
apps_to_ignore = tuple((d.app + "/") for d in website_theme.ignored_apps)
available_imports = get_scss_paths()
imports_to_include = [
d for d in available_imports if not d.startswith(apps_to_ignore)
]
context = website_theme.as_dict()
context["website_theme_scss"] = imports_to_include
return frappe.render_template(
"frappe/website/doctype/website_theme/website_theme_template.scss", context
)
| 0
| null | -1
|
https://github.com/frappe/frappe.git/commit/497ea861f481c6a3c52fe2aed9d0df1b6c99e9d7
| 4Python
|
static ssize_t o2nm_cluster_idle_timeout_ms_show(struct config_item *item,
char *page)
{
return sprintf(page, "%u\n", to_o2nm_cluster(item)->cl_idle_timeout_ms);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/853bc26a7ea39e354b9f8889ae7ad1492ffa28d2
| 0CCPP
|
bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port)
{
char *url_begin, *url_end, *ipv6_begin, *ipv6_end, *port_start = NULL;
char url_address[256], port[6];
int url_len, port_len = 0;
*sockaddr_url = url;
url_begin = strstr(url, "//");
if (!url_begin)
url_begin = url;
else
url_begin += 2;
ipv6_begin = strstr(url_begin, "[");
ipv6_end = strstr(url_begin, "]");
if (ipv6_begin && ipv6_end && ipv6_end > ipv6_begin)
url_end = strstr(ipv6_end, ":");
else
url_end = strstr(url_begin, ":");
if (url_end) {
url_len = url_end - url_begin;
port_len = strlen(url_begin) - url_len - 1;
if (port_len < 1)
return false;
port_start = url_end + 1;
} else
url_len = strlen(url_begin);
if (url_len < 1)
return false;
sprintf(url_address, "%.*s", url_len, url_begin);
if (port_len) {
char *slash;
snprintf(port, 6, "%.*s", port_len, port_start);
slash = strchr(port, '/');
if (slash)
*slash = '\0';
} else
strcpy(port, "80");
*sockaddr_port = strdup(port);
*sockaddr_url = strdup(url_address);
return true;
}
| 1
| null | -1
|
https://github.com/sgminer-dev/sgminer/commit/b65574bef233474e915fdf18614aa211e31cc6c2
| 0CCPP
|
static int mov_seek_auxiliary_info(MOVContext *c, MOVStreamContext *sc, int64_t index)
{
size_t auxiliary_info_seek_offset = 0;
int i;
if (sc->cenc.auxiliary_info_default_size) {
auxiliary_info_seek_offset = (size_t)sc->cenc.auxiliary_info_default_size * index;
} else if (sc->cenc.auxiliary_info_sizes) {
if (index > sc->cenc.auxiliary_info_sizes_count) {
av_log(c, AV_LOG_ERROR, "current sample %"PRId64" greater than the number of auxiliary info sample sizes %"SIZE_SPECIFIER"\n",
index, sc->cenc.auxiliary_info_sizes_count);
return AVERROR_INVALIDDATA;
}
for (i = 0; i < index; i++) {
auxiliary_info_seek_offset += sc->cenc.auxiliary_info_sizes[i];
}
}
if (auxiliary_info_seek_offset > sc->cenc.auxiliary_info_end - sc->cenc.auxiliary_info) {
av_log(c, AV_LOG_ERROR, "auxiliary info offset %"SIZE_SPECIFIER" greater than auxiliary info size %"SIZE_SPECIFIER"\n",
auxiliary_info_seek_offset, (size_t)(sc->cenc.auxiliary_info_end - sc->cenc.auxiliary_info));
return AVERROR_INVALIDDATA;
}
sc->cenc.auxiliary_info_pos = sc->cenc.auxiliary_info + auxiliary_info_seek_offset;
sc->cenc.auxiliary_info_index = index;
return 0;
}
| 0
| null | -1
|
https://github.com/FFmpeg/FFmpeg/commit/9cb4eb772839c5e1de2855d126bf74ff16d13382
| 0CCPP
|
public virtual Subscription PreviewChange(ChangeTimeframe timeframe)
{
if (!_saved)
{
throw new Recurly.RecurlyException("Must have an existing subscription to preview changes.");
}
Client.WriteXmlDelegate writeXmlDelegate;
if (ChangeTimeframe.Renewal == timeframe)
writeXmlDelegate = WriteChangeSubscriptionAtRenewalXml;
else
writeXmlDelegate = WriteChangeSubscriptionNowXml;
var previewSubscription = new Subscription();
var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Post,
UrlPrefix + Uri.EscapeUriString(Uuid) + "/preview",
writeXmlDelegate,
previewSubscription.ReadPreviewXml);
return statusCode == HttpStatusCode.NotFound ? null : previewSubscription;
}
| 1
|
13
| -1
|
https://github.com/recurly/recurly-client-dotnet/commit/9eef460c0084afd5c24d66220c8b7a381cf9a1f1
| 1CS
|
queryin(char *buf)
{
QPRS_STATE state;
int32 i;
ltxtquery *query;
int32 commonlen;
ITEM *ptr;
NODE *tmp;
int32 pos = 0;
#ifdef BS_DEBUG
char pbuf[16384],
*cur;
#endif
state.buf = buf;
state.state = WAITOPERAND;
state.count = 0;
state.num = 0;
state.str = NULL;
state.sumlen = 0;
state.lenop = 64;
state.curop = state.op = (char *) palloc(state.lenop);
*(state.curop) = '\0';
makepol(&state);
if (!state.num)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error"),
errdetail("Empty query.")));
/* make finish struct */
commonlen = COMPUTESIZE(state.num, state.sumlen);
query = (ltxtquery *) palloc(commonlen);
SET_VARSIZE(query, commonlen);
query->size = state.num;
ptr = GETQUERY(query);
for (i = 0; i < state.num; i++)
{
ptr[i].type = state.str->type;
ptr[i].val = state.str->val;
ptr[i].distance = state.str->distance;
ptr[i].length = state.str->length;
ptr[i].flag = state.str->flag;
tmp = state.str->next;
pfree(state.str);
state.str = tmp;
}
memcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);
pfree(state.op);
pos = 0;
findoprnd(ptr, &pos);
return query;
}
| 1
|
28
| -1
|
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
| 0CCPP
|
void rose_start_heartbeat(struct sock *sk)
{
del_timer(&sk->sk_timer);
sk->sk_timer.function = rose_heartbeat_expiry;
sk->sk_timer.expires = jiffies + 5 * HZ;
add_timer(&sk->sk_timer);
}
| 1
|
2,5
| -1
|
https://github.com/torvalds/linux/commit/9cc02ede696272c5271a401e4f27c262359bc2f6
| 0CCPP
|
static int fit_image_uncipher(const void *fit, int image_noffset,
void **data, size_t *size)
{
int cipher_noffset, ret;
void *dst;
size_t size_dst;
cipher_noffset = fdt_subnode_offset(fit, image_noffset,
FIT_CIPHER_NODENAME);
if (cipher_noffset < 0)
return 0;
ret = fit_image_decrypt_data(fit, image_noffset, cipher_noffset,
*data, *size, &dst, &size_dst);
if (ret)
goto out;
*data = dst;
*size = size_dst;
out:
return ret;
}
| 0
| null | -1
|
https://github.com/u-boot/u-boot/commit/6f3c2d8aa5e6cbd80b5e869bbbddecb66c329d01
| 0CCPP
|
static inline ut16 r_read_at_le16(const void *src, size_t offset) {
const ut8 *s = (const ut8*)src + offset;
return r_read_le16 (s);
}
| 1
| null | -1
|
https://github.com/radareorg/radare2/commit/1ea23bd6040441a21fbcfba69dce9a01af03f989
| 0CCPP
|
makedfa(nfagrammar *gr, nfa *nf, dfa *d)
{
int nbits = nf->nf_nstates;
bitset ss;
int xx_nstates;
ss_state *xx_state, *yy;
ss_arc *zz;
int istate, jstate, iarc, jarc, ibit;
nfastate *st;
nfaarc *ar;
ss = newbitset(nbits);
addclosure(ss, nf, nf->nf_start);
xx_state = (ss_state *)PyObject_MALLOC(sizeof(ss_state));
if (xx_state == NULL)
Py_FatalError("no mem for xx_state in makedfa");
xx_nstates = 1;
yy = &xx_state[0];
yy->ss_ss = ss;
yy->ss_narcs = 0;
yy->ss_arc = NULL;
yy->ss_deleted = 0;
yy->ss_finish = testbit(ss, nf->nf_finish);
if (yy->ss_finish)
printf("Error: nonterminal '%s' may produce empty.\n",
nf->nf_name);
/* This algorithm is from a book written before
the invention of structured programming... */
/* For each unmarked state... */
for (istate = 0; istate < xx_nstates; ++istate) {
size_t size;
yy = &xx_state[istate];
ss = yy->ss_ss;
/* For all its states... */
for (ibit = 0; ibit < nf->nf_nstates; ++ibit) {
if (!testbit(ss, ibit))
continue;
st = &nf->nf_state[ibit];
/* For all non-empty arcs from this state... */
for (iarc = 0; iarc < st->st_narcs; iarc++) {
ar = &st->st_arc[iarc];
if (ar->ar_label == EMPTY)
continue;
/* Look up in list of arcs from this state */
for (jarc = 0; jarc < yy->ss_narcs; ++jarc) {
zz = &yy->ss_arc[jarc];
if (ar->ar_label == zz->sa_label)
goto found;
}
/* Add new arc for this state */
size = sizeof(ss_arc) * (yy->ss_narcs + 1);
yy->ss_arc = (ss_arc *)PyObject_REALLOC(
yy->ss_arc, size);
if (yy->ss_arc == NULL)
Py_FatalError("out of mem");
zz = &yy->ss_arc[yy->ss_narcs++];
zz->sa_label = ar->ar_label;
zz->sa_bitset = newbitset(nbits);
zz->sa_arrow = -1;
found: ;
/* Add destination */
addclosure(zz->sa_bitset, nf, ar->ar_arrow);
}
}
/* Now look up all the arrow states */
for (jarc = 0; jarc < xx_state[istate].ss_narcs; jarc++) {
zz = &xx_state[istate].ss_arc[jarc];
for (jstate = 0; jstate < xx_nstates; jstate++) {
if (samebitset(zz->sa_bitset,
xx_state[jstate].ss_ss, nbits)) {
zz->sa_arrow = jstate;
goto done;
}
}
size = sizeof(ss_state) * (xx_nstates + 1);
xx_state = (ss_state *)PyObject_REALLOC(xx_state,
size);
if (xx_state == NULL)
Py_FatalError("out of mem");
zz->sa_arrow = xx_nstates;
yy = &xx_state[xx_nstates++];
yy->ss_ss = zz->sa_bitset;
yy->ss_narcs = 0;
yy->ss_arc = NULL;
yy->ss_deleted = 0;
yy->ss_finish = testbit(yy->ss_ss, nf->nf_finish);
done: ;
}
}
if (Py_DebugFlag)
printssdfa(xx_nstates, xx_state, nbits, &gr->gr_ll,
"before minimizing");
simplify(xx_nstates, xx_state);
if (Py_DebugFlag)
printssdfa(xx_nstates, xx_state, nbits, &gr->gr_ll,
"after minimizing");
convert(d, xx_nstates, xx_state);
for (int i = 0; i < xx_nstates; i++) {
for (int j = 0; j < xx_state[i].ss_narcs; j++)
delbitset(xx_state[i].ss_arc[j].sa_bitset);
PyObject_FREE(xx_state[i].ss_arc);
}
PyObject_FREE(xx_state);
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102
| -1
|
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
| 0CCPP
|
header_put_be_short (SF_PRIVATE *psf, int x)
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 2)
{ psf->header [psf->headindex++] = (x >> 8) ;
psf->header [psf->headindex++] = x ;
} ;
}
| 1
|
1,2,3,4
| -1
|
https://github.com/libsndfile/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074
| 0CCPP
|
bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite)
{
m_pFile = fopen(fileSystemRepresentation(sFileName), bRewrite ? "rb+" : "rb");
if (NULL == m_pFile) {
#if DEBUG
#endif
return false;
}
fseek(m_pFile, 0, SEEK_END);
m_lFileSize = ftell(m_pFile);
fseek(m_pFile, 0, SEEK_SET);
m_lFilePosition = 0;
if (0 < sFileName.length())
{
if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1])
m_lFileSize = 0x7FFFFFFF;
}
unsigned int err = 0x7FFFFFFF;
unsigned int cur = (unsigned int)m_lFileSize;
if (err == cur)
{
CloseFile();
return false;
}
return true;
}
| 0
| null | -1
|
https://github.com/ONLYOFFICE/core/commit/88cf60a3ed4a2b40d71a1c2ced72fa3902a30967
| 0CCPP
|
static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
{
struct cgroup_subsys_state *css;
if (!id)
return NULL;
css = css_lookup(&mem_cgroup_subsys, id);
if (!css)
return NULL;
return container_of(css, struct mem_cgroup, css);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/371528caec553785c37f73fa3926ea0de84f986f
| 0CCPP
|
null,null,null,10,null,null,!1,null,0<c.length?c:null)}catch(k){this.handleError(k)}};EditorUi.prototype.writeImageToClipboard=function(c,e,g,k){var m=this.base64ToBlob(c.substring(c.indexOf(",")+1),"image/png");c=new ClipboardItem({"image/png":m,"text/html":new Blob(['<img src="'+c+'" width="'+e+'" height="'+g+'">'],{type:"text/html"})});navigator.clipboard.write([c])["catch"](k)};EditorUi.prototype.copyCells=function(c,e){var g=this.editor.graph;if(g.isSelectionEmpty())c.innerHTML="";else{var k=
mxUtils.sortCells(g.model.getTopmostCells(g.getSelectionCells())),m=mxUtils.getXml(g.encodeCells(k));mxUtils.setTextContent(c,encodeURIComponent(m));e?(g.removeCells(k,!1),g.lastPasteXml=null):(g.lastPasteXml=m,g.pasteCounter=0);c.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.copyXml=function(){var c=null;if(Editor.enableNativeCipboard){var e=this.editor.graph;e.isSelectionEmpty()||(c=mxUtils.sortCells(e.getExportableCells(e.model.getTopmostCells(e.getSelectionCells()))),
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
def get_field_options(self, field):
options = {}
options["label"] = field.label
options["help_text"] = field.help_text
options["required"] = field.required
options["initial"] = field.default_value
return options
| 1
|
3
| -1
|
https://github.com/wagtail/wagtail.git/commit/d9a41e7f24d08c024acc9a3094940199df94db34
| 4Python
|
static void ssl_write_supported_point_formats_ext( mbedtls_ssl_context *ssl,
unsigned char *buf,
size_t *olen )
{
unsigned char *p = buf;
((void) ssl);
if( ( ssl->handshake->cli_exts &
MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT ) == 0 )
{
*olen = 0;
return;
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, supported_point_formats extension" ) );
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS ) & 0xFF );
*p++ = 0x00;
*p++ = 2;
*p++ = 1;
*p++ = MBEDTLS_ECP_PF_UNCOMPRESSED;
*olen = 6;
}
| 0
| null | -1
|
https://github.com/Mbed-TLS/mbedtls/commit/83c9f495ffe70c7dd280b41fdfd4881485a3bc28
| 0CCPP
|
static struct netdev_queue *dev_pick_tx(struct net_device *dev,
struct sk_buff *skb)
{
u16 queue_index;
struct sock *sk = skb->sk;
if (sk_tx_queue_recorded(sk)) {
queue_index = sk_tx_queue_get(sk);
} else {
const struct net_device_ops *ops = dev->netdev_ops;
if (ops->ndo_select_queue) {
queue_index = ops->ndo_select_queue(dev, skb);
queue_index = dev_cap_txqueue(dev, queue_index);
} else {
queue_index = 0;
if (dev->real_num_tx_queues > 1)
queue_index = skb_tx_hash(dev, skb);
if (sk) {
struct dst_entry *dst = rcu_dereference_bh(sk->sk_dst_cache);
if (dst && skb_dst(skb) == dst)
sk_tx_queue_set(sk, queue_index);
}
}
}
skb_set_queue_mapping(skb, queue_index);
return netdev_get_tx_queue(dev, queue_index);
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/6ec82562ffc6f297d0de36d65776cff8e5704867
| 0CCPP
|
void _recalloc(void **ptr, size_t old, size_t new, const char *file, const char *func, const int line)
{
if (new == old)
return;
*ptr = realloc(*ptr, new);
if (unlikely(!*ptr))
quitfrom(1, file, func, line, "Failed to realloc");
if (new > old)
memset(*ptr + old, 0, new - old);
}
| 0
| null | -1
|
https://github.com/ckolivas/cgminer/commit/e1c5050734123973b99d181c45e74b2cbb00272e
| 0CCPP
|
MagickExport const char *GetMagickCopyright(void)
{
return(MagickCopyright);
}
| 0
| null | -1
|
https://github.com/ImageMagick/ImageMagick/commit/0f6fc2d5bf8f500820c3dbcf0d23ee14f2d9f734
| 0CCPP
|
PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
{
int len; /*
#ifdef HAVE_SNPRINTF
#define _PyOS_vsnprintf_EXTRA_SPACE 1
#else
#define _PyOS_vsnprintf_EXTRA_SPACE 512
char *buffer;
#endif
assert(str != NULL);
assert(size > 0);
assert(format != NULL);
/* We take a size_t as input but return an int. Sanity check
* our input so that it won't cause an overflow in the
* vsnprintf return value or the buffer malloc size. */
if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) {
len = -666;
goto Done;
}
#ifdef HAVE_SNPRINTF
len = vsnprintf(str, size, format, va);
#else
/* Emulate it. */
buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE);
if (buffer == NULL) {
len = -666;
goto Done;
}
len = vsprintf(buffer, format, va);
if (len < 0)
/* ignore the error */;
else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE)
Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf");
else {
const size_t to_copy = (size_t)len < size ?
(size_t)len : size - 1;
assert(to_copy < size);
memcpy(str, buffer, to_copy);
str[to_copy] = '\0';
}
PyMem_FREE(buffer);
#endif
Done:
if (size > 0)
str[size-1] = '\0';
return len;
#undef _PyOS_vsnprintf_EXTRA_SPACE
}
| 1
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
| -1
|
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
| 0CCPP
|
bool Messageheader::Parser::state_cr(char ch)
{
if (ch != '\n')
{
log_warn("invalid character " << chartoprint(ch) << " in state-cr");
failedFlag = true;
}
return true;
}
| 0
| null | -1
|
https://github.com/maekitalo/tntnet/commit/9bd3b14042e12d84f39ea9f55731705ba516f525
| 0CCPP
|
static void nfs_set_open_stateid(struct nfs4_state *state, nfs4_stateid *stateid, int open_flags)
{
write_seqlock(&state->seqlock);
nfs_set_open_stateid_locked(state, stateid, open_flags);
write_sequnlock(&state->seqlock);
}
| 1
|
0,3
| -1
|
https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
| 0CCPP
|
function addComment(comment, parentArr, parent, level, showResolved)
{
if (!showResolved && comment.isResolved)
{
return;
}
noComments.style.display = 'none';
var cdiv = document.createElement('div');
cdiv.className = 'geCommentContainer';
cdiv.setAttribute('data-commentId', comment.id);
cdiv.style.marginLeft = (level * 20 + 5) + 'px';
if (comment.isResolved && !Editor.isDarkMode())
{
cdiv.style.backgroundColor = 'ghostWhite';
}
var headerDiv = document.createElement('div');
headerDiv.className = 'geCommentHeader';
var userImg = document.createElement('img');
userImg.className = 'geCommentUserImg';
userImg.src = comment.user.pictureUrl || Editor.userImage;
headerDiv.appendChild(userImg);
var headerTxt = document.createElement('div');
headerTxt.className = 'geCommentHeaderTxt';
headerDiv.appendChild(headerTxt);
var usernameDiv = document.createElement('div');
usernameDiv.className = 'geCommentUsername';
mxUtils.write(usernameDiv, comment.user.displayName || '');
headerTxt.appendChild(usernameDiv);
var dateDiv = document.createElement('div');
dateDiv.className = 'geCommentDate';
dateDiv.setAttribute('data-commentId', comment.id);
writeCommentDate(comment, dateDiv);
headerTxt.appendChild(dateDiv);
cdiv.appendChild(headerDiv);
var commentTxtDiv = document.createElement('div');
commentTxtDiv.className = 'geCommentTxt';
mxUtils.write(commentTxtDiv, comment.content || '');
cdiv.appendChild(commentTxtDiv);
if (comment.isLocked)
{
cdiv.style.opacity = '0.5';
}
var actionsDiv = document.createElement('div');
actionsDiv.className = 'geCommentActions';
var actionsList = document.createElement('ul');
actionsList.className = 'geCommentActionsList';
actionsDiv.appendChild(actionsList);
function addAction(name, evtHandler, hide)
{
var action = document.createElement('li');
action.className = 'geCommentAction';
var actionLnk = document.createElement('a');
actionLnk.className = 'geCommentActionLnk';
mxUtils.write(actionLnk, name);
action.appendChild(actionLnk);
mxEvent.addListener(actionLnk, 'click', function(evt)
{
evtHandler(evt, comment);
evt.preventDefault();
mxEvent.consume(evt);
});
actionsList.appendChild(action);
if (hide) action.style.display = 'none';
};
function collectReplies()
{
var replies = [];
var pdiv = cdiv;
function collectReplies(comment)
{
replies.push(pdiv);
if (comment.replies != null)
{
for (var i = 0; i < comment.replies.length; i++)
{
pdiv = pdiv.nextSibling;
collectReplies(comment.replies[i]);
}
}
}
collectReplies(comment);
return {pdiv: pdiv, replies: replies};
};
function addReply(initContent, editIt, saveCallback, doResolve, doReopen)
{
var pdiv = collectReplies().pdiv;
var newReply = editorUi.newComment(initContent, editorUi.getCurrentUser());
newReply.pCommentId = comment.id;
if (comment.replies == null) comment.replies = [];
var replyComment = addComment(newReply, comment.replies, pdiv, level + 1);
function doAddReply()
{
showBusy(replyComment);
comment.addReply(newReply, function(id)
{
newReply.id = id;
comment.replies.push(newReply);
showDone(replyComment);
if (saveCallback) saveCallback();
}, function(err)
{
doEdit();
showError(replyComment);
editorUi.handleError(err, null, null, null,
mxUtils.htmlEntities(mxResources.get('objectNotFound')));
}, doResolve, doReopen);
};
function doEdit()
{
editComment(newReply, replyComment, function(newReply)
{
doAddReply();
}, true);
};
if (editIt)
{
doEdit();
}
else
{
doAddReply();
}
};
if (!readOnly && !comment.isLocked && (level == 0 || canReplyToReplies))
{
addAction(mxResources.get('reply'), function()
{
addReply('', true);
}, comment.isResolved);
}
var user = editorUi.getCurrentUser();
if (user != null && user.id == comment.user.id && !readOnly && !comment.isLocked)
{
addAction(mxResources.get('edit'), function()
{
function doEditComment()
{
editComment(comment, cdiv, function()
{
showBusy(cdiv);
comment.editComment(comment.content, function()
{
showDone(cdiv);
}, function(err)
{
showError(cdiv);
doEditComment();
editorUi.handleError(err, null, null, null,
mxUtils.htmlEntities(mxResources.get('objectNotFound')));
});
});
};
doEditComment();
}, comment.isResolved);
addAction(mxResources.get('delete'), function()
{
editorUi.confirm(mxResources.get('areYouSure'), function()
{
showBusy(cdiv);
comment.deleteComment(function(markedOnly)
{
if (markedOnly === true)
{
var commentTxt = cdiv.querySelector('.geCommentTxt');
commentTxt.innerHTML = '';
mxUtils.write(commentTxt, mxResources.get('msgDeleted'));
var actions = cdiv.querySelectorAll('.geCommentAction');
for (var i = 0; i < actions.length; i++)
{
actions[i].parentNode.removeChild(actions[i]);
}
showDone(cdiv);
cdiv.style.opacity = '0.5';
}
else
{
var replies = collectReplies(comment).replies;
for (var i = 0; i < replies.length; i++)
{
listDiv.removeChild(replies[i]);
}
for (var i = 0; i < parentArr.length; i++)
{
if (parentArr[i] == comment)
{
parentArr.splice(i, 1);
break;
}
}
noComments.style.display = (listDiv.getElementsByTagName('div').length == 0) ? 'block' : 'none';
}
}, function(err)
{
showError(cdiv);
editorUi.handleError(err, null, null, null,
mxUtils.htmlEntities(mxResources.get('objectNotFound')));
});
});
}, comment.isResolved);
}
if (!readOnly && !comment.isLocked && level == 0)
{
function toggleResolve(evt)
{
function doToggle()
{
var resolveActionLnk = evt.target;
resolveActionLnk.innerHTML = '';
comment.isResolved = !comment.isResolved;
mxUtils.write(resolveActionLnk, comment.isResolved? mxResources.get('reopen') : mxResources.get('resolve'));
var actionsDisplay = comment.isResolved? 'none' : '';
var replies = collectReplies(comment).replies;
var color = (Editor.isDarkMode()) ? 'transparent' : (comment.isResolved? 'ghostWhite' : 'white');
for (var i = 0; i < replies.length; i++)
{
replies[i].style.backgroundColor = color;
var forOpenActions = replies[i].querySelectorAll('.geCommentAction');
for (var j = 0; j < forOpenActions.length; j ++)
{
if (forOpenActions[j] == resolveActionLnk.parentNode) continue;
forOpenActions[j].style.display = actionsDisplay;
}
if (!resolvedChecked)
{
replies[i].style.display = 'none';
}
}
updateNoComments();
};
if (comment.isResolved)
{
addReply(mxResources.get('reOpened') + ': ', true, doToggle, false, true);
}
else
{
addReply(mxResources.get('markedAsResolved'), false, doToggle, true);
}
};
addAction(comment.isResolved? mxResources.get('reopen') : mxResources.get('resolve'), toggleResolve);
}
cdiv.appendChild(actionsDiv);
if (parent != null)
{
listDiv.insertBefore(cdiv, parent.nextSibling);
}
else
{
listDiv.appendChild(cdiv);
}
for (var i = 0; comment.replies != null && i < comment.replies.length; i++)
{
var reply = comment.replies[i];
reply.isResolved = comment.isResolved;
addComment(reply, comment.replies, null, level + 1, showResolved);
}
if (curEdited != null)
{
if (curEdited.comment.id == comment.id)
{
var origContent = comment.content;
comment.content = curEdited.comment.content;
editComment(comment, cdiv, curEdited.saveCallback, curEdited.deleteOnCancel);
comment.content = origContent;
}
else if (curEdited.comment.id == null && curEdited.comment.pCommentId == comment.id)
{
listDiv.appendChild(curEdited.div);
editComment(curEdited.comment, curEdited.div, curEdited.saveCallback, curEdited.deleteOnCancel);
}
}
return cdiv;
};
| 1
|
164,207
| -1
|
https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825
| 3JavaScript
|
def side_effect(old_cmd, command):
with tarfile.TarFile(_tar_file(old_cmd.script_parts)[0]) as archive:
for file in archive.getnames():
try:
os.remove(file)
except OSError:
pass
| 1
| null | -1
|
https://github.com/nvbn/thefuck.git/commit/e343c577cd7da4d304b837d4a07ab4df1e023092
| 4Python
|
void cil_destroy_typeattribute(struct cil_typeattribute *attr)
{
if (attr == NULL) {
return;
}
cil_symtab_datum_destroy(&attr->datum);
if (attr->expr_list != NULL) {
struct cil_list_item *expr = attr->expr_list->head;
while (expr != NULL) {
struct cil_list_item *next = expr->next;
cil_list_item_destroy(&expr, CIL_FALSE);
expr = next;
}
free(attr->expr_list);
attr->expr_list = NULL;
}
ebitmap_destroy(attr->types);
free(attr->types);
free(attr);
}
| 0
| null | -1
|
https://github.com/SELinuxProject/selinux/commit/340f0eb7f3673e8aacaf0a96cbfcd4d12a405521
| 0CCPP
|
def __init__(self):
super(Manager, self).__init__(CONF.catalog.driver)
| 1
| null | -1
|
https://github.com/openstack/keystone.git/commit/1d146f5c32e58a73a677d308370f147a3271c2cb
| 4Python
|
static int suspend_set_state(struct regulator_dev *rdev,
struct regulator_state *rstate)
{
int ret = 0;
if (!rstate->enabled && !rstate->disabled) {
if (rdev->desc->ops->set_suspend_voltage ||
rdev->desc->ops->set_suspend_mode)
rdev_warn(rdev, "No configuration\n");
return 0;
}
if (rstate->enabled && rstate->disabled) {
rdev_err(rdev, "invalid configuration\n");
return -EINVAL;
}
if (rstate->enabled && rdev->desc->ops->set_suspend_enable)
ret = rdev->desc->ops->set_suspend_enable(rdev);
else if (rstate->disabled && rdev->desc->ops->set_suspend_disable)
ret = rdev->desc->ops->set_suspend_disable(rdev);
else
ret = 0;
if (ret < 0) {
rdev_err(rdev, "failed to enabled/disable\n");
return ret;
}
if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) {
ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV);
if (ret < 0) {
rdev_err(rdev, "failed to set voltage\n");
return ret;
}
}
if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) {
ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode);
if (ret < 0) {
rdev_err(rdev, "failed to set mode\n");
return ret;
}
}
return ret;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/60a2362f769cf549dc466134efe71c8bf9fbaaba
| 0CCPP
|
b.setAttribute("pageHeight",this.graph.pageFormat.height);null!=this.graph.background&&b.setAttribute("background",this.graph.background);return b};Editor.prototype.updateGraphComponents=function(){var b=this.graph;null!=b.container&&(b.view.validateBackground(),b.container.style.overflow=b.scrollbars?"auto":this.defaultGraphOverflow,this.fireEvent(new mxEventObject("updateGraphComponents")))};Editor.prototype.setModified=function(b){this.modified=b};
| 0
| null | -1
|
https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf
| 3JavaScript
|
static ssize_t _hostfs_write(oe_fd_t* desc, const void* buf, size_t count)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
/* Check parameters. */
if (!file || (count && !buf))
OE_RAISE_ERRNO(OE_EINVAL);
if (oe_syscall_write_ocall(&ret, file->host_fd, buf, count) != OE_OK)
OE_RAISE_ERRNO(OE_EINVAL);
done:
return ret;
}
| 1
|
4,5
| -1
|
https://github.com/openenclave/openenclave/commit/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
| 0CCPP
|
function generate(target, hierarchies, forceOverride) {
let current = target;
hierarchies.forEach(info => {
const descriptor = normalizeDescriptor(info);
const { value, type, create, override, created, skipped, got } = descriptor;
const name = getNonEmptyPropName(current, descriptor);
if (forceOverride || override || !current[name] || typeof current[name] !== 'object') {
const obj = value ? value :
type ? new type() :
create ? create.call(current, current, name) :
{};
current[name] = obj;
if (created) {
created.call(current, current, name, obj);
}
}
else {
if (skipped) {
skipped.call(current, current, name, current[name]);
}
}
const parent = current;
current = current[name];
if (got) {
got.call(parent, parent, name, current);
}
});
return current;
}
| 1
|
6
| -1
|
https://github.com/mjpclab/object-hierarchy-access/commit/7b1aa134a8bc4a376296bcfac5c3463aef2b7572
| 3JavaScript
|
void FS_NewDir_f( void ) {
char *filter;
char **dirnames;
int ndirs;
int i;
if ( Cmd_Argc() < 2 ) {
Com_Printf( "usage: fdir <filter>\n" );
Com_Printf( "example: fdir *q3dm*.bsp\n" );
return;
}
filter = Cmd_Argv( 1 );
Com_Printf( "---------------\n" );
dirnames = FS_ListFilteredFiles( "", "", filter, &ndirs, qfalse );
FS_SortFileList( dirnames, ndirs );
for ( i = 0; i < ndirs; i++ ) {
FS_ConvertPath( dirnames[i] );
Com_Printf( "%s\n", dirnames[i] );
}
Com_Printf( "%d files listed\n", ndirs );
FS_FreeFileList( dirnames );
}
| 0
| null | -1
|
https://github.com/iortcw/iortcw/commit/b6ff2bcb1e4e6976d61e316175c6d7c99860fe20
| 0CCPP
|
K&&(K=b.shapeForegroundColor);return K};this.createStyle=function(K){var F=";fillColor=none;";O&&(F=";lineShape=1;");return mxConstants.STYLE_SHAPE+"="+K+F};this.stopDrawing=function(){if(0<m.length){if(O){for(var K=[],F=0;F<v.length;F++)null!=v[F]&&K.push([v[F].x,v[F].y]);K=PerfectFreehand.getStroke(K,I);v=[];for(F=0;F<K.length;F++)v.push({x:K[F][0],y:K[F][1]});v.push(null)}K=v[0].x;var H=v[0].x,S=v[0].y,V=v[0].y;for(F=1;F<v.length;F++)null!=v[F]&&(K=Math.max(K,v[F].x),H=Math.min(H,v[F].x),S=Math.max(S,
| 1
|
0
| -1
|
https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687
| 3JavaScript
|
char *path_name(struct strbuf *path, const char *name)
{
struct strbuf ret = STRBUF_INIT;
if (path)
strbuf_addbuf(&ret, path);
strbuf_addstr(&ret, name);
return strbuf_detach(&ret, NULL);
}
| 1
|
0,2,3,4,5,6,7
| -1
|
https://github.com/git/git/commit/de1e67d0703894cb6ea782e36abb63976ab07e60
| 0CCPP
|
static int xudc_stop(struct usb_gadget *gadget)
{
struct xusb_udc *udc = to_udc(gadget);
unsigned long flags;
spin_lock_irqsave(&udc->lock, flags);
udc->gadget.speed = USB_SPEED_UNKNOWN;
udc->driver = NULL;
udc->write_fn(udc->addr, XUSB_ADDRESS_OFFSET, 0);
udc->remote_wkp = 0;
xudc_stop_activity(udc);
spin_unlock_irqrestore(&udc->lock, flags);
return 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/7f14c7227f342d9932f9b918893c8814f86d2a0d
| 0CCPP
|
module.exports.createTransport = function(transporter, defaults) {
let urlConfig;
let options;
let mailer;
if (
(typeof transporter === 'object' && typeof transporter.send !== 'function') ||
(typeof transporter === 'string' && /^(smtps?|direct):/i.test(transporter))
) {
if ((urlConfig = typeof transporter === 'string' ? transporter : transporter.url)) {
options = shared.parseConnectionUrl(urlConfig);
} else {
options = transporter;
}
if (options.pool) {
transporter = new SMTPPool(options);
} else if (options.sendmail) {
transporter = new SendmailTransport(options);
} else if (options.streamTransport) {
transporter = new StreamTransport(options);
} else if (options.jsonTransport) {
transporter = new JSONTransport(options);
} else if (options.SES) {
transporter = new SESTransport(options);
} else {
transporter = new SMTPTransport(options);
}
}
mailer = new Mailer(transporter, options, defaults);
return mailer;
};
| 1
|
0
| -1
|
https://github.com/nodemailer/nodemailer/commit/ba31c64c910d884579875c52d57ac45acc47aa54
| 3JavaScript
|
SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
siginfo_t __user *, uinfo)
{
siginfo_t info;
if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
return -EFAULT;
if (info.si_code >= 0)
return -EPERM;
info.si_signo = sig;
return kill_proc_info(sig, &info, pid);
}
| 1
|
6
| -1
|
https://github.com/torvalds/linux/commit/da48524eb20662618854bb3df2db01fc65f3070c
| 0CCPP
|
def _get_subelements(self, node):
items = node.find("rdf:Alt", self.NS)
if items is not None:
try:
return items[0].text
except IndexError:
return ""
for xmlcontainer, container, insertfn in XMP_CONTAINERS:
items = node.find(f"rdf:{xmlcontainer}", self.NS)
if items is None:
continue
result = container()
for item in items:
insertfn(result, item.text)
return result
return ""
| 0
| null | -1
|
https://github.com/pikepdf/pikepdf.git/commit/3f38f73218e5e782fe411ccbb3b44a793c0b343a
| 4Python
|
PHP_FUNCTION(locale_lookup)
{
char* fallback_loc = NULL;
int fallback_loc_len = 0;
const char* loc_range = NULL;
int loc_range_len = 0;
zval* arr = NULL;
HashTable* hash_arr = NULL;
zend_bool boolCanonical = 0;
char* result =NULL;
intl_error_reset( NULL TSRMLS_CC );
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "as|bs", &arr, &loc_range, &loc_range_len,
&boolCanonical, &fallback_loc, &fallback_loc_len) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 TSRMLS_CC );
RETURN_FALSE;
}
if(loc_range_len == 0) {
loc_range = intl_locale_get_default(TSRMLS_C);
}
hash_arr = HASH_OF(arr);
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
RETURN_EMPTY_STRING();
}
result = lookup_loc_range(loc_range, hash_arr, boolCanonical TSRMLS_CC);
if(result == NULL || result[0] == '\0') {
if( fallback_loc ) {
result = estrndup(fallback_loc, fallback_loc_len);
} else {
RETURN_EMPTY_STRING();
}
}
RETVAL_STRINGL(result, strlen(result), 0);
}
| 1
|
22
| -1
|
https://github.com/php/php-src/commit/97eff7eb57fc2320c267a949cffd622c38712484
| 0CCPP
|
public Response replyToPost(@PathParam("messageKey") Long messageKey, @QueryParam("title") @Parameter(description = "The title for the first post in the thread") String title,
@QueryParam("body") @Parameter(description = "The body for the first post in the thread") String body, @QueryParam("authorKey") @Parameter(description = "The author user key (optional)") Long authorKey,
@Context HttpServletRequest httpRequest, @Context UriInfo uriInfo) {
ServletUtil.printOutRequestHeaders(httpRequest);
return replyToPost(messageKey, new ReplyVO(title, body), authorKey, httpRequest, uriInfo);
}
| 0
| null | -1
|
https://github.com/OpenOLAT/OpenOLAT/commit/c450df7d7ffe6afde39ebca6da9136f1caa16ec4
| 2Java
|
def feed_ratingindex():
off = request.args.get("offset") or 0
entries = calibre_db.session.query(db.Ratings, func.count('books_ratings_link.book').label('count'),
(db.Ratings.rating / 2).label('name')) \
.join(db.books_ratings_link)\
.join(db.Books)\
.filter(calibre_db.common_filters()) \
.group_by(text('books_ratings_link.rating'))\
.order_by(db.Ratings.rating).all()
pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,
len(entries))
element = list()
for entry in entries:
element.append(FeedObject(entry[0].id, _("{} Stars").format(entry.name)))
return render_xml_template('feed.xml', listelements=element, folder='opds.feed_ratings', pagination=pagination)
| 1
|
3
| -1
|
https://github.com/janeczku/calibre-web.git/commit/4545f4a20d9ff90b99bbd4e3e34b6de4441d6367
| 4Python
|
static bool tsk_unreturnable(struct tipc_sock *tsk)
{
return msg_dest_droppable(&tsk->phdr) != 0;
}
| 0
| null | -1
|
https://github.com/torvalds/linux/commit/45e093ae2830cd1264677d47ff9a95a71f5d9f9c
| 0CCPP
|
ParseNameValue(const char * buffer, int bufsize,
struct NameValueParserData * data)
{
struct xmlparser parser;
data->l_head = NULL;
data->portListing = NULL;
data->portListingLength = 0;
parser.xmlstart = buffer;
parser.xmlsize = bufsize;
parser.data = data;
parser.starteltfunc = NameValueParserStartElt;
parser.endeltfunc = NameValueParserEndElt;
parser.datafunc = NameValueParserGetData;
parser.attfunc = 0;
parsexml(&parser);
}
| 1
|
4,5,6
| -1
|
https://github.com/miniupnp/miniupnp/commit/7aeb624b44f86d335841242ff427433190e7168a
| 0CCPP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.