id stringlengths 19 19 | content stringlengths 22 69.3k | max_stars_repo_path stringlengths 91 133 |
|---|---|---|
d2a_code_data_45954 | static int opt_metadata(const char *opt, const char *arg)
{
char *mid= strchr(arg, '=');
if(!mid){
fprintf(stderr, "Missing =\n");
ffmpeg_exit(1);
}
*mid++= 0;
av_metadata_set2(&metadata, arg, mid, 0);
return 0;
} | https://github.com/libav/libav/blob/771339ca206468636a64a6041852068be2da3dd2/ffmpeg.c/#L2818 |
d2a_code_data_45955 | CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
{
CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->name = OPENSSL_strdup(name);
if (ret->name == NULL) {
CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE);
goto err;
}
ret->public_key = public_key;
if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
goto err;
return ret;
err:
CTLOG_free(ret);
return NULL;
} | https://github.com/openssl/openssl/blob/6025001707fd65679d758c877200469d4e72ea88/crypto/ct/ct_log.c/#L256 |
d2a_code_data_45956 | int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
pkt->written += len;
pkt->curr += len;
return 1;
} | https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25 |
d2a_code_data_45957 | int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
} | https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.