code stringlengths 31 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
roleId: new ObjectId(input.roleId)
}
}
);
await updateSessionUser(ctx, `${membership.userId}`);
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "update",
data: {
id: input.id,
userId: `${membership.userId}`,
roleId: `${... | Base | 1 |
roleId: new ObjectId(input.roleId)
}
}
);
await updateSessionUser(ctx, `${membership.userId}`);
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "update",
data: {
id: input.id,
userId: `${membership.userId}`,
roleId: `${... | Base | 1 |
wrappers: (workspaceSettings.wrappers || []).map((item, index) => {
if (index === sameKeyWrapperIndex) {
return {
...item,
...input,
...(extensionId && { extension: item.extension || true })
};
... | Class | 2 |
wrappers: (workspaceSettings.wrappers || []).map((item, index) => {
if (index === sameKeyWrapperIndex) {
return {
...item,
...input,
...(extensionId && { extension: item.extension || true })
};
... | Base | 1 |
wrappers: (workspaceSettings.wrappers || []).map((item, index) => {
if (index === sameKeyWrapperIndex) {
return {
...item,
...input,
...(extensionId && { extension: item.extension || true })
};
... | Base | 1 |
...(extensionId && { extension: item.extension || true })
};
}
return item;
}) | Class | 2 |
...(extensionId && { extension: item.extension || true })
};
}
return item;
}) | Base | 1 |
...(extensionId && { extension: item.extension || true })
};
}
return item;
}) | Base | 1 |
schema: zodToJsonSchema(envSchema.extend(envSchemaExtension || {}))
}) | Class | 2 |
schema: zodToJsonSchema(envSchema.extend(envSchemaExtension || {}))
}) | Base | 1 |
schema: zodToJsonSchema(envSchema.extend(envSchemaExtension || {}))
}) | Base | 1 |
renderHTML({ node, HTMLAttributes }) {
return [
"pre",
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
[
"code",
{
class: node.attrs.lang ? `language-${node.attrs.lang}` : null
},
0
]
];
}, | Class | 2 |
renderHTML({ node, HTMLAttributes }) {
return [
"pre",
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
[
"code",
{
class: node.attrs.lang ? `language-${node.attrs.lang}` : null
},
0
]
];
}, | Base | 1 |
renderHTML({ node, HTMLAttributes }) {
return [
"pre",
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
[
"code",
{
class: node.attrs.lang ? `language-${node.attrs.lang}` : null
},
0
]
];
}, | Base | 1 |
void context.ready.then(async () => {
const file = context.model;
const workspace = file.toJSON() as unknown as Workspace.IWorkspace;
const path = context.path;
const id = workspace.metadata.id;
// Save the file contents as a workspace.
await this._workspaces.save(... | Class | 2 |
void context.ready.then(async () => {
const file = context.model;
const workspace = file.toJSON() as unknown as Workspace.IWorkspace;
const path = context.path;
const id = workspace.metadata.id;
// Save the file contents as a workspace.
await this._workspaces.save(... | Base | 1 |
export function getSessionUrl(baseUrl: string, id: string): string {
return URLExt.join(baseUrl, SESSION_SERVICE_URL, id);
} | Class | 2 |
export function getSessionUrl(baseUrl: string, id: string): string {
return URLExt.join(baseUrl, SESSION_SERVICE_URL, id);
} | Base | 1 |
export async function requestTranslationsAPI<T>(
translationsUrl: string = '',
locale = '',
init: RequestInit = {},
serverSettings: ServerConnection.ISettings | undefined = undefined
): Promise<T> {
// Make request to Jupyter API
const settings = serverSettings ?? ServerConnection.makeSettings();
translat... | Class | 2 |
export async function requestTranslationsAPI<T>(
translationsUrl: string = '',
locale = '',
init: RequestInit = {},
serverSettings: ServerConnection.ISettings | undefined = undefined
): Promise<T> {
// Make request to Jupyter API
const settings = serverSettings ?? ServerConnection.makeSettings();
translat... | Base | 1 |
headers: baseHeaders(),
})
.then((res) => res.json())
.then((res) => res)
.catch((e) => {
console.error(e);
return { filename: null, error: e.message };
});
}, | Class | 2 |
exportImport: () => {
return "/settings/export-import";
}, | Class | 2 |
exports: () => {
return `${API_BASE.replace("/api", "")}/system/data-exports`;
}, | Class | 2 |
get url() {
return `http://${this[incomingKey].headers.host}${this[incomingKey].url}`
}, | Base | 1 |
msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u *buf = NULL;
char_u *p = s;
#ifdef MSWIN
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); // handle CR and NL correctly
#endif
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
if (!(silent_mode && ... | Variant | 0 |
get_register(
int name,
int copy) // make a copy, if FALSE make register empty.
{
yankreg_T *reg;
int i;
#ifdef FEAT_CLIPBOARD
// When Visual area changed, may have to update selection. Obtain the
// selection too.
if (name == '*' && clip_star.available)
{
if (clip_isautosel_star()... | Base | 1 |
regtilde(char_u *source, int magic)
{
char_u *newsub = source;
char_u *tmpsub;
char_u *p;
int len;
int prevlen;
for (p = newsub; *p; ++p)
{
if ((*p == '~' && magic) || (*p == '\\' && *(p + 1) == '~' && !magic))
{
if (reg_prev_sub != NULL)
{
// length = len(newsub) - 1 + len(... | Base | 1 |
is_qf_win(win_T *win, qf_info_T *qi)
{
// A window displaying the quickfix buffer will have the w_llist_ref field
// set to NULL.
// A window displaying a location list buffer will have the w_llist_ref
// pointing to the location list.
if (bt_quickfix(win->w_buffer))
if ((IS_QF_STACK(qi) && win->w_... | Variant | 0 |
ex_history(exarg_T *eap)
{
histentry_T *hist;
int histype1 = HIST_CMD;
int histype2 = HIST_CMD;
int hisidx1 = 1;
int hisidx2 = -1;
int idx;
int i, j, k;
char_u *end;
char_u *arg = eap->arg;
if (hislen == 0)
{
msg(_("'history' option is zero"));
return;
}
if ... | Base | 1 |
ex_history(exarg_T *eap)
{
histentry_T *hist;
int histype1 = HIST_CMD;
int histype2 = HIST_CMD;
int hisidx1 = 1;
int hisidx2 = -1;
int idx;
int i, j, k;
char_u *end;
char_u *arg = eap->arg;
if (hislen == 0)
{
msg(_("'history' option is zero"));
return;
}
if ... | Variant | 0 |
get_list_range(char_u **str, int *num1, int *num2)
{
int len;
int first = FALSE;
varnumber_T num;
*str = skipwhite(*str);
if (**str == '-' || vim_isdigit(**str)) // parse "from" part of range
{
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL);
*str += len;
*num1 = (int)num;
fi... | Base | 1 |
get_list_range(char_u **str, int *num1, int *num2)
{
int len;
int first = FALSE;
varnumber_T num;
*str = skipwhite(*str);
if (**str == '-' || vim_isdigit(**str)) // parse "from" part of range
{
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL);
*str += len;
*num1 = (int)num;
fi... | Variant | 0 |
shift_line(
int left,
int round,
int amount,
int call_changed_bytes) // call changed_bytes()
{
int count;
int i, j;
int sw_val = (int)get_sw_value_indent(curbuf);
count = get_indent(); // get current indent
if (round) // round off indent
{
i = count / sw_val; // number of... | Base | 1 |
static bool meta_set(RAnal *a, RAnalMetaType type, int subtype, ut64 from, ut64 to, const char *str) {
if (to < from) {
return false;
}
RSpace *space = r_spaces_current (&a->meta_spaces);
RIntervalNode *node = find_node_at (a, type, space, from);
RAnalMetaItem *item = node ? node->data : R_NEW0 (RAnalMetaItem);
... | Class | 2 |
R_API size_t r_str_ansi_strip(char *str) {
size_t i = 0;
while (str[i]) {
size_t chlen = __str_ansi_length (str + i);
if (chlen > 1) {
r_str_cpy (str + i + 1, str + i + chlen);
}
i++;
}
return i;
} | Class | 2 |
static RList *patch_relocs(RBin *b) {
r_return_val_if_fail (b && b->iob.io && b->iob.io->desc, NULL);
RBinObject *bo = r_bin_cur_object (b);
RIO *io = b->iob.io;
if (!bo || !bo->bin_obj) {
return NULL;
}
struct r_bin_coff_obj *bin = (struct r_bin_coff_obj*)bo->bin_obj;
if (bin->hdr.f_flags & COFF_FLAGS_TI_F_EX... | Class | 2 |
static int getid(char ch) {
const char *keys = "[]<>+-,.";
const char *cidx = strchr (keys, ch);
return cidx? cidx - keys + 1: 0;
} | Base | 1 |
static void process_constructors(RKernelCacheObj *obj, struct MACH0_(obj_t) *mach0, RList *ret, ut64 paddr, bool is_first, int mode, const char *prefix) {
const RVector *sections = MACH0_(load_sections) (mach0);
if (!sections) {
return;
}
int type;
struct section_t *section;
r_vector_foreach (sections, section)... | Base | 1 |
Bool gf_sg_proto_field_is_sftime_offset(GF_Node *node, GF_FieldInfo *field)
{
u32 i;
GF_Route *r;
GF_ProtoInstance *inst;
GF_FieldInfo inf;
if (node->sgprivate->tag != TAG_ProtoNode) return 0;
if (field->fieldType != GF_SG_VRML_SFTIME) return 0;
inst = (GF_ProtoInstance *) node;
/*check in interface if this is... | Variant | 0 |
static s32 svc_parse_slice(GF_BitStream *bs, AVCState *avc, AVCSliceInfo *si)
{
s32 pps_id;
/*s->current_picture.reference= h->nal_ref_idc != 0;*/
gf_bs_read_ue_log(bs, "first_mb_in_slice");
si->slice_type = gf_bs_read_ue_log(bs, "slice_type");
if (si->slice_type > 9) return -1;
pps_id = gf_bs_read_ue_log(bs, "... | Base | 1 |
GF_Err Q_DecCoordOnUnitSphere(GF_BifsDecoder *codec, GF_BitStream *bs, u32 NbBits, u32 NbComp, Fixed *m_ft)
{
u32 i, orient, sign;
s32 value;
Fixed tang[4], delta;
s32 dir;
if (NbComp != 2 && NbComp != 3) return GF_BAD_PARAM;
//only 2 or 3 comp in the quantized version
dir = 1;
if(NbComp == 2) dir -= 2 * gf_b... | Base | 1 |
GF_Err dac3_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_AC3ConfigBox *ptr = (GF_AC3ConfigBox *)s;
if (ptr->cfg.is_ec3) s->type = GF_ISOM_BOX_TYPE_DEC3;
e = gf_isom_box_write_header(s, bs);
if (ptr->cfg.is_ec3) s->type = GF_ISOM_BOX_TYPE_DAC3;
if (e) return e;
e = gf_odf_ac3_cfg_write_bs(&ptr->cfg, b... | Variant | 0 |
GF_Err video_sample_entry_box_size(GF_Box *s)
{
GF_Box *b;
u32 pos=0;
GF_MPEGVisualSampleEntryBox *ptr = (GF_MPEGVisualSampleEntryBox *)s;
gf_isom_video_sample_entry_size((GF_VisualSampleEntryBox *)s);
/*make sure we write the config box first, we don't care about the rest*/
/*mp4v*/
gf_isom_check_position(s, ... | Variant | 0 |
void gf_isom_check_position(GF_Box *s, GF_Box *child, u32 *pos)
{
if (!s || !s->child_boxes || !child || !pos) return;
if (s->internal_flags & GF_ISOM_ORDER_FREEZE)
return;
s32 cur_pos = gf_list_find(s->child_boxes, child);
//happens when partially cloning boxes
if (cur_pos < 0) return;
if (cur_pos != (s32... | Variant | 0 |
GF_EXPORT
GF_Err gf_isom_box_write(GF_Box *a, GF_BitStream *bs)
{
GF_Err e;
u64 pos = gf_bs_get_position(bs);
if (!a) return GF_BAD_PARAM;
//box has been disabled, do not write
if (!a->size) return GF_OK;
if (a->registry->disabled) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Box %s disabled registry... | Variant | 0 |
const u32 *gf_isom_get_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber, u32 group_index, u32 *switchGroupID, u32 *criteriaListSize)
{
GF_TrackBox *trak;
GF_UserDataMap *map;
GF_TrackSelectionBox *tsel;
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!group_index || !trak || !trak->udta) retu... | Variant | 0 |
char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32... | Base | 1 |
void gf_filter_pid_inst_del(GF_FilterPidInst *pidinst)
{
assert(pidinst);
gf_filter_pid_inst_reset(pidinst);
gf_fq_del(pidinst->packets, (gf_destruct_fun) pcki_del);
gf_mx_del(pidinst->pck_mx);
gf_list_del(pidinst->pck_reassembly);
if (pidinst->props) {
assert(pidinst->props->reference_count);
if (safe_int_... | Class | 2 |
static GF_Err xml_sax_append_string(GF_SAXParser *parser, char *string)
{
u32 size = parser->line_size;
u32 nl_size = (u32) strlen(string);
if (!nl_size) return GF_OK;
if ( (parser->alloc_size < size+nl_size+1)
/* || (parser->alloc_size / 2 ) > size+nl_size+1 */
)
{
parser->alloc_size = size+nl_s... | Base | 1 |
int AVI_read_audio(avi_t *AVI, u8 *audbuf, int bytes, int *continuous)
{
int nr, todo;
s64 pos;
if(AVI->mode==AVI_MODE_WRITE) {
AVI_errno = AVI_ERR_NOT_PERM;
return -1;
}
if(!AVI->track[AVI->aptr].audio_index) {
AVI_errno = AVI_ERR_NO_IDX;
return -1;
}
nr = 0; /* total number of bytes read */
... | Variant | 0 |
int AVI_read_frame(avi_t *AVI, u8 *vidbuf, int *keyframe)
{
int n;
if(AVI->mode==AVI_MODE_WRITE) {
AVI_errno = AVI_ERR_NOT_PERM;
return -1;
}
if(!AVI->video_index) {
AVI_errno = AVI_ERR_NO_IDX;
return -1;
}
if(AVI->video_pos < 0 || AVI->video_pos >= AVI->video_frames) return -1;
n = (u32) AVI->... | Variant | 0 |
static void get_info_for_all_streams (mpeg2ps_t *ps)
{
u8 stream_ix, max_ix, av;
mpeg2ps_stream_t *sptr;
u8 *buffer;
u32 buflen;
file_seek_to(ps->fd, 0);
// av will be 0 for video streams, 1 for audio streams
// av is just so I don't have to dup a lot of code that does the
// same thing.
for (av = 0; av < 2;... | Base | 1 |
static u32 swf_get_32(SWFReader *read)
{
u32 val, res;
val = swf_read_int(read, 32);
res = (val&0xFF);
res <<=8;
res |= ((val>>8)&0xFF);
res<<=8;
res |= ((val>>16)&0xFF);
res<<=8;
res|= ((val>>24)&0xFF);
return res;
} | Variant | 0 |
static s16 swf_get_s16(SWFReader *read)
{
s16 val;
u8 v1;
v1 = swf_read_int(read, 8);
val = swf_read_sint(read, 8);
val = (val<<8)&0xFF00;
val |= (v1&0xFF);
return val;
} | Variant | 0 |
static u16 swf_get_16(SWFReader *read)
{
u16 val, res;
val = swf_read_int(read, 16);
res = (val&0xFF);
res <<=8;
res |= ((val>>8)&0xFF);
return res;
} | Variant | 0 |
char *gf_bt_get_next(GF_BTParser *parser, Bool point_break)
{
u32 has_quote;
Bool go = 1;
s32 i;
gf_bt_check_line(parser);
i=0;
has_quote = 0;
while (go) {
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
if (parser-... | Base | 1 |
GF_Err chnl_box_size(GF_Box *s)
{
GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s;
s->size += 1;
if (ptr->layout.stream_structure & 1) {
s->size += 1;
if (ptr->layout.definedLayout==0) {
u32 i;
for (i=0; i<ptr->layout.channels_count; i++) {
s->size+=1;
if (ptr->layout.layouts[i].position==126)... | Base | 1 |
GF_Err chnl_box_read(GF_Box *s,GF_BitStream *bs)
{
GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s;
ISOM_DECREASE_SIZE(s, 1)
ptr->layout.stream_structure = gf_bs_read_u8(bs);
if (ptr->layout.stream_structure & 1) {
ISOM_DECREASE_SIZE(s, 1)
ptr->layout.definedLayout = gf_bs_read_u8(bs);
if (ptr->layout.d... | Base | 1 |
GF_Err chnl_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u8(bs, ptr->layout.stream_structure);
if (ptr->layout.stream_structure & 1) {
gf_bs_write_u8(bs, ptr->layout.definedLayout);
if... | Base | 1 |
GF_Err gf_isom_use_compact_size(GF_ISOFile *movie, u32 trackNumber, Bool CompactionOn)
{
GF_TrackBox *trak;
u32 i, size;
GF_SampleSizeBox *stsz;
GF_Err e;
e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE);
if (e) return e;
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak) return GF_BAD_PARAM;
i... | Base | 1 |
static GF_Err gf_isom_set_root_iod(GF_ISOFile *movie)
{
GF_IsomInitialObjectDescriptor *iod;
GF_IsomObjectDescriptor *od;
GF_Err e;
e = gf_isom_insert_moov(movie);
if (e) return e;
if (!movie->moov->iods) {
AddMovieIOD(movie->moov, 1);
return GF_OK;
}
//if OD, switch to IOD
if (movie->moov->iods->descrip... | Base | 1 |
GF_Err gf_isom_update_sample_description_from_template(GF_ISOFile *file, u32 track, u32 sampleDescriptionIndex, u8 *data, u32 size)
{
GF_BitStream *bs;
GF_TrackBox *trak;
GF_Box *ent, *tpl_ent;
GF_Err e;
/*get orig sample desc and clone it*/
trak = gf_isom_get_track_from_file(file, track);
if (!trak || !sampleDe... | Base | 1 |
static GF_SampleGroupDescriptionBox *get_sgdp(GF_SampleTableBox *stbl, void *traf, u32 grouping_type, Bool *is_traf_sgdp)
#endif /* GPAC_DISABLE_ISOM_FRAGMENTS */
{
GF_List *groupList=NULL;
GF_List **parent=NULL;
GF_SampleGroupDescriptionBox *sgdesc=NULL;
u32 count, i;
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
if (!stb... | Base | 1 |
update_job_run (updateJobPtr job)
{
/* Here we decide on the source type and the proper execution
methods which then do anything they want with the job and
pass the processed job to update_process_finished_job()
for result dequeuing */
/* everything starting with '|' is a local command */
if (*(job->req... | Base | 1 |
p_ntp_time(netdissect_options *ndo,
const struct l_fixedpt *lfp)
{
uint32_t i;
uint32_t uf;
uint32_t f;
double ff;
i = GET_BE_U_4(lfp->int_part);
uf = GET_BE_U_4(lfp->fraction);
ff = uf;
if (ff < 0.0) /* some compilers are buggy */
ff += FMAXINT;
ff = ff / FMAXINT; /* shift radix point by 32 bits */
... | Base | 1 |
ahcp_time_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
time_t t;
struct tm *tm;
char buf[BUFSIZE];
if (len != 4)
goto invalid;
t = GET_BE_U_4(cp);
if (NULL == (tm = gmtime(&t)))
ND_PRINT(": gmtime() error");
else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm)... | Base | 1 |
arista_print_date_hms_time(netdissect_options *ndo, uint32_t seconds,
uint32_t nanoseconds)
{
time_t ts;
struct tm *tm;
char buf[BUFSIZE];
ts = seconds + (nanoseconds / 1000000000);
nanoseconds %= 1000000000;
if (NULL == (tm = gmtime(&ts)))
ND_PRINT("gmtime() error");
else if (0 == strftime(buf, sizeof(buf)... | Base | 1 |
static void zep_print_ts(netdissect_options *ndo, const u_char *p)
{
int32_t i;
uint32_t uf;
uint32_t f;
float ff;
i = GET_BE_U_4(p);
uf = GET_BE_U_4(p + 4);
ff = (float) uf;
if (ff < 0.0) /* some compilers are buggy */
ff += FMAXINT;
ff = (float) (ff / FMAXINT); /* shift radix point by 32 bits */... | Base | 1 |
MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
{
char *filename = malloc(PATH_MAX + 1);
if (filename == NULL)
error("%s: malloc", __func__);
/* Process with strftime if Gflag is set. */
if (Gflag != 0) {
struct tm *local_tm;
/* Conve... | Base | 1 |
ts_date_hmsfrac_print(netdissect_options *ndo, long sec, long usec,
enum date_flag date_flag, enum time_flag time_flag)
{
time_t Time = sec;
struct tm *tm;
char timestr[32];
if ((unsigned)sec & 0x80000000) {
ND_PRINT("[Error converting time]");
return;
}
if (time_flag == LOCAL_TIME)
tm = localtime... | Base | 1 |
void hrandfieldCommand(client *c) {
long l;
int withvalues = 0;
robj *hash;
listpackEntry ele;
if (c->argc >= 3) {
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
if (c->argc > 4 || (c->argc == 4 && strcasecmp(c->argv[3]->ptr,"withvalues"))) {
addRepl... | Base | 1 |
void zrandmemberCommand(client *c) {
long l;
int withscores = 0;
robj *zset;
listpackEntry ele;
if (c->argc >= 3) {
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
if (c->argc > 4 || (c->argc == 4 && strcasecmp(c->argv[3]->ptr,"withscores"))) {
addRep... | Base | 1 |
void msetGenericCommand(client *c, int nx) {
int j;
int setkey_flags = 0;
if ((c->argc % 2) == 0) {
addReplyErrorArity(c);
return;
}
/* Handle the NX flag. The MSETNX semantic is to return zero and don't
* set anything if at least one key already exists. */
if (nx) {
... | Class | 2 |
static int _anetTcpServer(char *err, int port, char *bindaddr, int af, int backlog)
{
int s = -1, rv;
char _port[6]; /* strlen("65535") */
struct addrinfo hints, *servinfo, *p;
snprintf(_port,6,"%d",port);
memset(&hints,0,sizeof(hints));
hints.ai_family = af;
hints.ai_socktype = SOCK_STREA... | Class | 2 |
int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
{
int s;
struct sockaddr_un sa;
if (strlen(path) > sizeof(sa.sun_path)-1) {
anetSetError(err,"unix socket path too long (%zu), must be under %zu", strlen(path), sizeof(sa.sun_path));
return ANET_ERR;
}
if ((s = anet... | Class | 2 |
static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len, int backlog) {
if (bind(s,sa,len) == -1) {
anetSetError(err, "bind: %s", strerror(errno));
close(s);
return ANET_ERR;
}
if (listen(s, backlog) == -1) {
anetSetError(err, "listen: %s", strerror(errno)... | Class | 2 |
Tss2_RC_Decode(TSS2_RC rc)
{
static __thread char buf[TSS2_ERR_LAYER_NAME_MAX + TSS2_ERR_LAYER_ERROR_STR_MAX + 1];
clearbuf(buf);
UINT8 layer = tss2_rc_layer_number_get(rc);
TSS2_RC_HANDLER handler = layer_handler[layer].handler;
const char *lname = layer_handler[layer].name;
if (lname[0]) {... | Base | 1 |
unknown_layer_handler(TSS2_RC rc)
{
static __thread char buf[32];
clearbuf(buf);
catbuf(buf, "0x%X", tpm2_error_get(rc));
return buf;
} | Base | 1 |
test_custom_handler(void **state)
{
(void) state;
/*
* Test registering a custom handler
*/
TSS2_RC_HANDLER old = Tss2_RC_SetHandler(1, "cstm", custom_err_handler);
assert_null(old);
/*
* Test getting error strings
*/
unsigned i;
for (i = 1; i < 4; i++) {
// Mak... | Base | 1 |
sigterm_handler(int sig) // I - Signal number (unused)
{
(void)sig;
fprintf(stderr,
"DEBUG: beh: Job canceled.\n");
if (job_canceled)
_exit(CUPS_BACKEND_OK);
else
job_canceled = 1;
} | Base | 1 |
call_backend(char *uri, // I - URI of final destination
int argc, // I - Number of command line
// arguments
char **argv, // I - Command-line arguments
char *filename) // I - File name of input data
{
const char *cups_... | Base | 1 |
_pdfioDictSetValue(
pdfio_dict_t *dict, // I - Dictionary
const char *key, // I - Key
_pdfio_value_t *value) // I - Value
{
_pdfio_pair_t *pair; // Current pair
PDFIO_DEBUG("_pdfioDictSetValue(dict=%p, key=\"%s\", value=%p)\n", dict, key, (void *)value);
// See if the key is already set.... | Base | 1 |
_pdfioTokenGet(_pdfio_token_t *tb, // I - Token buffer/stack
char *buffer, // I - String buffer
size_t bufsize) // I - Size of string buffer
{
// See if we have a token waiting on the stack...
if (tb->num_tokens > 0)
{
// Yes, return it...
tb->num_tokens --;
strncpy(b... | Base | 1 |
static void _clean_slate_datagram(gnrc_sixlowpan_frag_fb_t *fbuf)
{
clist_node_t new_queue = { .next = NULL };
fbuf->sfr.arq_timeout_event.msg.content.ptr = NULL;
/* remove potentially scheduled timers for this datagram */
evtimer_del((evtimer_t *)(&_arq_timer),
&fbuf->sfr.arq_timeout_e... | Class | 2 |
static void _sched_arq_timeout(gnrc_sixlowpan_frag_fb_t *fbuf, uint32_t offset)
{
if (IS_ACTIVE(CONFIG_GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER)) {
/* mock does not need to be scheduled */
return;
}
if (fbuf->sfr.arq_timeout_event.msg.content.ptr != NULL) {
DEBUG("6lo sfr: ARQ timeout for d... | Class | 2 |
compat_cipher_proposal(struct ssh *ssh, char *cipher_prop)
{
if (!(ssh->compat & SSH_BUG_BIGENDIANAES))
return cipher_prop;
debug2_f("original cipher proposal: %s", cipher_prop);
if ((cipher_prop = match_filter_denylist(cipher_prop, "aes*")) == NULL)
fatal("match_filter_denylist failed");
debug2_f("compat ciphe... | Variant | 0 |
compat_kex_proposal(struct ssh *ssh, char *p)
{
if ((ssh->compat & (SSH_BUG_CURVE25519PAD|SSH_OLD_DHGEX)) == 0)
return p;
debug2_f("original KEX proposal: %s", p);
if ((ssh->compat & SSH_BUG_CURVE25519PAD) != 0)
if ((p = match_filter_denylist(p,
"curve25519-sha256@libssh.org")) == NULL)
fatal("match_fil... | Variant | 0 |
compat_pkalg_proposal(struct ssh *ssh, char *pkalg_prop)
{
if (!(ssh->compat & SSH_BUG_RSASIGMD5))
return pkalg_prop;
debug2_f("original public key proposal: %s", pkalg_prop);
if ((pkalg_prop = match_filter_denylist(pkalg_prop, "ssh-rsa")) == NULL)
fatal("match_filter_denylist failed");
debug2_f("compat public ... | Variant | 0 |
static int ntlm_decode_u16l_str_hdr(struct ntlm_ctx *ctx,
struct wire_field_hdr *str_hdr,
struct ntlm_buffer *buffer,
size_t payload_offs, char **str)
{
char *in, *out = NULL;
uint16_t str_len;
uint32... | Base | 1 |
void SetClipboardText(const char *text)
{
#if defined(PLATFORM_DESKTOP)
glfwSetClipboardString(CORE.Window.handle, text);
#endif
#if defined(PLATFORM_WEB)
emscripten_run_script(TextFormat("navigator.clipboard.writeText('%s')", text));
#endif
} | Base | 1 |
const char *GetClipboardText(void)
{
#if defined(PLATFORM_DESKTOP)
return glfwGetClipboardString(CORE.Window.handle);
#endif
#if defined(PLATFORM_WEB)
// Accessing clipboard data from browser is tricky due to security reasons
// The method to use is navigator.clipboard.readText() but this is an asynchronous... | Base | 1 |
static memcached_return_t _read_one_response(memcached_instance_st *instance, char *buffer,
const size_t buffer_length,
memcached_result_st *result) {
memcached_server_response_decrement(instance);
if (result == NULL) {
M... | Class | 2 |
sshsk_open(const char *path)
{
struct sshsk_provider *ret = NULL;
uint32_t version;
if (path == NULL || *path == '\0') {
error("No FIDO SecurityKeyProvider specified");
return NULL;
}
if ((ret = calloc(1, sizeof(*ret))) == NULL) {
error_f("calloc failed");
return NULL;
}
if ((ret->path = strdup(path)) =... | Base | 1 |
wsemul_sun_output_control(struct wsemul_sun_emuldata *edp,
struct wsemul_inputstate *instate)
{
int oargs;
int rc;
switch (instate->inchar) {
case '0': case '1': case '2': case '3': case '4': /* argument digit */
case '5': case '6': case '7': case '8': case '9':
/*
* If we receive more arguments than we ... | Class | 2 |
wsemul_vt100_output_csi(struct wsemul_vt100_emuldata *edp,
struct wsemul_inputstate *instate)
{
u_int newstate = VT100_EMUL_STATE_CSI;
int oargs;
int rc = 0;
switch (instate->inchar) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/* argument digit */
... | Class | 2 |
wsemul_vt100_output_dcs(struct wsemul_vt100_emuldata *edp,
struct wsemul_inputstate *instate)
{
u_int newstate = VT100_EMUL_STATE_DCS;
switch (instate->inchar) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/* argument digit */
if (edp->nargs > VT100_E... | Class | 2 |
static pj_status_t transport_destroy (pjmedia_transport *tp)
{
struct tp_adapter *adapter = (struct tp_adapter*)tp;
/* Close the slave transport */
if (adapter->del_base) {
pjmedia_transport_close(adapter->slave_tp);
}
/* Self destruct.. */
pj_pool_release(adapter->pool);
return ... | Variant | 0 |
static pj_status_t transport_destroy(pjmedia_transport *tp)
{
struct transport_loop *loop = (struct transport_loop*) tp;
/* Sanity check */
PJ_ASSERT_RETURN(tp, PJ_EINVAL);
pj_pool_release(loop->pool);
return PJ_SUCCESS;
} | Variant | 0 |
static pj_status_t transport_destroy (pjmedia_transport *tp)
{
transport_srtp *srtp = (transport_srtp *) tp;
pj_status_t status;
unsigned i;
PJ_ASSERT_RETURN(tp, PJ_EINVAL);
/* Close all keying. Note that any keying should not be destroyed before
* SRTP transport is destroyed as re-INVITE ma... | Variant | 0 |
static void clock_cb(const pj_timestamp *ts, void *user_data)
{
dtls_srtp_channel *ds_ch = (dtls_srtp_channel*)user_data;
dtls_srtp *ds = ds_ch->dtls_srtp;
unsigned idx = ds_ch->channel;
PJ_UNUSED_ARG(ts);
pj_lock_acquire(ds->ossl_lock);
if (!ds->ossl_ssl[idx]) {
pj_lock_release(ds->o... | Variant | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.