functionSource stringlengths 20 97.4k | CWE-119 bool 2
classes | CWE-120 bool 2
classes | CWE-469 bool 2
classes | CWE-476 bool 2
classes | CWE-other bool 2
classes | combine int64 0 1 |
|---|---|---|---|---|---|---|
Is_Printable_String(const char *s)
{
int result = TRUE;
#if USE_WIDEC_SUPPORT
int count = mbstowcs(0, s, 0);
wchar_t *temp = 0;
assert(s);
if (count > 0
&& (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != 0)
{
int n;
mbstowcs(temp, s, (unsigned)count);
for (n = 0; n < cou... | false | true | false | false | false | 1 |
extract_nobj(struct obj *obj, struct obj **head_ptr)
{
struct obj *curr, *prev;
curr = *head_ptr;
for (prev = (struct obj *) 0; curr; prev = curr, curr = curr->nobj) {
if (curr == obj) {
if (prev)
prev->nobj = curr->nobj;
else
*head_pt... | false | false | false | false | false | 0 |
lua_load (lua_State *L, lua_Reader reader, void *data,
const char *chunkname) {
ZIO z;
int status;
lua_lock(L);
if (!chunkname) chunkname = "?";
luaZ_init(L, &z, reader, data);
status = luaD_protectedparser(L, &z, chunkname);
lua_unlock(L);
return status;
} | false | false | false | false | false | 0 |
thrmgr_dispatch_internal(threadpool_t *threadpool, void *user_data, int bulk)
{
int ret = TRUE;
pthread_t thr_id;
if (!threadpool) {
return FALSE;
}
/* Lock the threadpool */
if (pthread_mutex_lock(&(threadpool->pool_mutex)) != 0) {
logg("!Mutex lock failed\n");
return FALSE;
}
do {
work_queue_t *... | false | false | false | false | false | 0 |
HandleChDir(char *value)
{
if (!IsAbsoluteFileName(value))
{
yyerror("chdir is not an absolute directory name");
}
strcpy(CHDIR,value);
} | false | false | false | false | false | 0 |
__eft_release ( CMPIEnumeration * enumeration )
{
struct native_enum * e = (struct native_enum *) enumeration;
CMPIStatus st= { CMPI_RC_OK, NULL };
if (e) {
if (e->data)
st = CMRelease(e->data);
free ( enumeration );
return st;
}
CMReturn ( CMPI_RC_ERR_FAILED );
} | false | false | false | false | false | 0 |
format(int64_t number,
const UnicodeString& ruleSetName,
UnicodeString& toAppendTo,
FieldPosition& /* pos */,
UErrorCode& status) const
{
if (U_SUCCESS(status)) {
if (ruleSetName.indexOf(g... | false | false | false | false | false | 0 |
setCurrentOption ( const std::string value )
{
int action = parameterOption(value);
if (action >= 0)
currentKeyWord_ = action;
} | false | false | false | false | false | 0 |
NewStream(NPMIMEType /*type*/, NPStream* stream,
NPBool /*seekable*/, uint16_t* /*stype*/)
{
// gnash::log_debug("%s: %x", __PRETTY_FUNCTION__, (void *)this);
if (_childpid) {
// Apparently the child process has already been started for this
// plugin instance. It is... | false | false | false | false | false | 0 |
mei_cl_bus_dev_setup(struct mei_device *bus,
struct mei_cl_device *cldev)
{
cldev->do_match = 1;
mei_cl_bus_dev_fixup(cldev);
/* the device name can change during fix up */
if (cldev->do_match)
mei_cl_bus_set_name(cldev);
return cldev->do_match == 1;
} | false | false | false | false | false | 0 |
move_thread(int new_thread_id)
{
if (likely(_thread != 0)) {
RouterThread *new_thread = master()->thread(new_thread_id);
// (new_thread->thread_id() might != new_thread_id)
_status.home_thread_id = new_thread->thread_id();
if (_status.home_thread_id != _thread->thread_id())
move_thread_second_half();
}... | false | false | false | false | false | 0 |
xmms_html_browse (xmms_xform_t *xform, const gchar *url,
xmms_error_t *error)
{
gchar buffer[XMMS_XFORM_MAX_LINE_SIZE];
const gchar *plsurl;
gchar *tagbeg, *aurl, *full;
xmms_error_reset (error);
plsurl = xmms_xform_get_url (xform);
while (xmms_xform_read_line (xform, buffer, error)) {
tagbe... | false | false | false | false | false | 0 |
bnx2x_get_credit_vlan(struct bnx2x_vlan_mac_obj *o)
{
struct bnx2x_credit_pool_obj *vp = o->vlans_pool;
WARN_ON(!vp);
return vp->get(vp, 1);
} | false | false | false | false | false | 0 |
send_notify_response(private_task_manager_t *this,
message_t *request, notify_type_t type,
chunk_t data)
{
message_t *response;
packet_t *packet;
host_t *me, *other;
response = message_create(IKEV2_MAJOR_VERSION, IKEV2_MINOR_VERSION);
response->set_exchange_type(response, request->get_exchange_t... | false | false | false | false | false | 0 |
glp_netgen_prob(int nprob, int parm[1+15])
{ int k;
if (!(101 <= nprob && nprob <= 150))
xerror("glp_netgen_prob: nprob = %d; invalid problem instance "
"number\n", nprob);
for (k = 1; k <= 15; k++)
parm[k] = data[nprob-101][k];
return;
} | false | false | false | false | false | 0 |
kirk_CMD4(u8* outbuff, u8* inbuff, int size)
{
KIRK_AES128CBC_HEADER *header = (KIRK_AES128CBC_HEADER*)inbuff;
u8* key;
AES_ctx aesKey;
if (is_kirk_initialized == 0) return KIRK_NOT_INITIALIZED;
if (header->mode != KIRK_MODE_ENCRYPT_CBC) return KIRK_INVALID_MODE;
if (header->data_size == 0) return KIRK_DATA_SIZE... | false | false | false | false | false | 0 |
mode_for_size (unsigned int size, enum mode_class mclass, int limit)
{
enum machine_mode mode;
if (limit && size > MAX_FIXED_MODE_SIZE)
return BLKmode;
/* Get the first mode which has this size, in the specified class. */
for (mode = GET_CLASS_NARROWEST_MODE (mclass); mode != VOIDmode;
mode = GET_... | false | false | false | false | false | 0 |
_file_selector_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Eina_Bool allow_multiple __UNUSED__, Eina_List *accept_types __UNUSED__, Eina_List **selected_files, Eina_Bool *response)
{
*selected_files = eina_list_append(NULL,
strdup("/path/to/non_existing_file"));
... | false | false | false | false | false | 0 |
devicedef_revuser_agent(const void* item) {
devicedef_t* device = (devicedef_t*)item;
char* revuser_agent = NULL;
if(device->user_agent!=NULL) {
char* reverse_ua = malloc(sizeof(char) * (strlen(device->user_agent) + 1));
if(!reverse_ua) {
error(1, errno, "error allocating memory for reverse user-agent");
... | false | false | false | false | false | 0 |
cxd2841er_chip_id(struct cxd2841er_priv *priv)
{
u8 chip_id;
dev_dbg(&priv->i2c->dev, "%s()\n", __func__);
cxd2841er_write_reg(priv, I2C_SLVT, 0, 0);
cxd2841er_read_reg(priv, I2C_SLVT, 0xfd, &chip_id);
return chip_id;
} | false | false | false | false | false | 0 |
value_added_current_editor (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
GObject *editor;
editor = g_value_get_object (value);
if (!IANJUTA_IS_EDITOR(editor))
return;
BasicAutotoolsPlugin *ba_plugin = ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin);
ba_plugin->current_editor = ... | false | false | false | false | false | 0 |
recv_response(struct ipmi_intf * intf, unsigned char *data, int len)
{
char hex_rs[IPMI_SERIAL_MAX_RESPONSE * 3];
int i, j, resp_len = 0;
unsigned long rv;
char *p, *pp;
char ch, str_hex[3];
p = hex_rs;
while (1) {
if ((rv = serial_read_line(intf, p, sizeof(hex_rs) - resp_len)) < 0) {
/* error */
return... | true | true | false | false | false | 1 |
img_copy_merge(img, img_dest, dx, dy, sx, sy, w, h, pct)
VALUE img, img_dest, dx, dy, sx, sy, w, h, pct;
{
gdImagePtr im, im_dest;
Data_Get_Struct(img, gdImage, im);
image_req(img_dest);
Data_Get_Struct(img_dest, gdImage, im_dest);
#ifdef ENABLE_GD_2_0
if (is_truecolor(im) && (!is_truecolo... | false | false | false | false | false | 0 |
value_to_symstr(ulong value, char *buf, ulong radix)
{
struct syment *sp;
ulong offset;
char *p1, locbuf[BUFSIZE];
struct load_module *lm;
sp = NULL;
offset = 0;
buf[0] = NULLCHAR;
if (!radix)
radix = *gdb_output_radix;
if ((radix != 10) && (radix != 16))
radix = 16;
if ((sp = valu... | false | false | false | false | false | 0 |
ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
struct buffer_head *ref_root_bh,
struct ocfs2_extent_block *eb,
struct ocfs2_extent_list *el,
int index, u32 *cpos_end)
{
int ret, i, subtree_root;
u32 cpos;
u64 blkno;
struct super_block *sb = ocfs2_metadata_cac... | false | false | false | false | false | 0 |
bpcharle(PG_FUNCTION_ARGS)
{
BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
int len1,
len2;
int cmp;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
cmp = varstr_cmp(VARDATA_ANY(arg1), len1, VARDATA_ANY(arg2), len2);
PG_FREE_IF_COPY(arg1, 0);
PG_FREE_IF_COPY(arg2... | false | false | false | false | false | 0 |
setProperty(QWidget *w, const QVariant &v)
{
/* QButtonGroup *bg = qobject_cast<QButtonGroup *>(w);
if (bg)
{
QAbstractButton *b = bg->button(v.toInt());
if (b)
b->setDown(true);
return;
}*/
QByteArray userproperty = getCustomProperty(w);
if (userproperty.isEmpty()) {
userpro... | false | false | false | false | false | 0 |
tar_extract_glob(TAR *t, char *globname, char *prefix)
{
char *filename;
char buf[TAR_MAXPATHLEN];
int i;
char *pathname;
while ((i = th_read(t)) == 0)
{
pathname = th_get_pathname(t);
filename = pathname;
if (fnmatch(globname, filename, FNM_PATHNAME | FNM_PERIOD))
{
if (pathname)
... | true | true | false | false | false | 1 |
safe_getenv(const struct tls_info *info, const char *n)
{
const char *v=(*info->getconfigvar)(n, info->app_data);
if (!v) v="";
return (v);
} | false | false | false | false | false | 0 |
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
"function's dictionary may not be deleted");
return -1;
}
if (!PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
... | false | false | false | false | false | 0 |
krb5_pac_get_types(krb5_context context,
krb5_pac pac,
size_t *len,
krb5_ui_4 **types)
{
size_t i;
*types = (krb5_ui_4 *)malloc(pac->pac->cBuffers * sizeof(krb5_ui_4));
if (*types == NULL)
return ENOMEM;
*len = pac->pac->cBuffers;
f... | false | true | false | false | false | 1 |
get()
{
RegisterValue rv = m_cpu->registers[m_addr]->getRV();
rv.data = (rv.data+2) & 0xffff;
m_cpu->registers[m_addr]->putRV(rv);
RegisterValue retRV = rv.init ? m_unknown : m_cpu->registers[rv.data]->getRV();
return retRV;
} | false | false | false | false | false | 0 |
detect_stride(__isl_take isl_constraint *c, void *user)
{
struct isl_detect_stride_data *data = user;
int i, n_div;
isl_ctx *ctx;
isl_val *v, *stride, *m;
if (!isl_constraint_is_equality(c) ||
!isl_constraint_involves_dims(c, isl_dim_set, data->pos, 1)) {
isl_constraint_free(c);
return 0;
}
ctx = isl_... | false | false | false | false | false | 0 |
SetFeatureDefn(OGRFeatureDefn *poFeatureDefn,
TABFieldType *paeMapInfoNativeFieldTypes /* =NULL */)
{
if (m_poRelation)
return m_poRelation->SetFeatureDefn(poFeatureDefn);
return -1;
} | false | false | false | false | false | 0 |
pollForModemLock(Modem& modem)
{
if (modem.lock->lock()) {
modem.release();
traceModem(modem, "READY (end polling)");
pokeScheduler();
} else
modem.startLockPolling(pollLockWait);
} | false | false | false | false | false | 0 |
can_blnd(magr, mdef, aatyp, obj)
struct monst *magr; /* NULL == no specific aggressor */
struct monst *mdef;
uchar aatyp;
struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */
{
boolean is_you = (mdef == &youmonst);
boolean check_visor = FALSE;
struct obj *o;
const char *s;
/* no eyes protect against all attacks for... | false | false | false | false | false | 0 |
min_range(int* A, int l, int r){
if(r>l)return 0;
printf("[l, r] = [%d, %d]\n", l, r);
int min = INT_MAX;
int i;
for(i=l; i<=l; i++)
min = (A[i]<min?A[i]:min);
printf("min = %d\n", min);
return min;
} | false | false | false | false | false | 0 |
check_and_set_new_selection (GthImageSelector *self,
cairo_rectangle_int_t new_selection)
{
new_selection.width = MAX (0, new_selection.width);
new_selection.height = MAX (0, new_selection.height);
if (self->priv->bind_dimensions && (self->priv->bind_factor > 1)) {
new_selection.width = bind_dimensi... | false | false | false | false | false | 0 |
jfs_ioc_trim(struct inode *ip, struct fstrim_range *range)
{
struct inode *ipbmap = JFS_SBI(ip->i_sb)->ipbmap;
struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap;
struct super_block *sb = ipbmap->i_sb;
int agno, agno_end;
u64 start, end, minlen;
u64 trimmed = 0;
/**
* convert byte values to block size of filesystem:
... | false | false | false | false | false | 0 |
setData(const QModelIndex &index, const QVariant &value, int role)
{
Q_UNUSED(value);
if( ! index.isValid() /*|| ! (d->mode & UserCheckable)*/ )
return false;
Action *act = action( index );
if ( act ) {
switch( role ) {
//case Qt::EditRole: act->setText( value.toString()... | false | false | false | false | false | 0 |
OnMenuWatchDereference(cb_unused wxCommandEvent& event)
{
cbWatchesDlg *watches = Manager::Get()->GetDebuggerManager()->GetWatchesDialog();
if (!watches)
return;
watches->RenameWatch(m_watchToDereferenceProperty, wxT("*") + m_watchToDereferenceSymbol);
m_watchToDereferenceProperty = NULL;
m... | false | false | false | false | false | 0 |
kwbimage_check_params(struct image_tool_params *params)
{
if (!strlen(params->imagename)) {
fprintf(stderr, "Error:%s - Configuration file not specified, "
"it is needed for kwbimage generation\n",
params->cmdname);
return CFG_INVALID;
}
return (params->dflag && (params->fflag || params->lflag)) ||
(par... | false | false | false | false | false | 0 |
qSafeXDestroyImage( XImage *x )
{
if ( x->data ) {
free( x->data );
x->data = 0;
}
XDestroyImage( x );
} | false | false | false | false | false | 0 |
px_put_a(stream * s, px_attribute_t a)
{
sputc(s, pxt_attr_ubyte);
sputc(s, (byte)a);
} | false | false | false | false | false | 0 |
store( QDomNode & node, QDomDocument & document ) const
{
// store base annotation properties
storeBaseAnnotationProperties( node, document );
// create [line] element
QDomElement lineElement = document.createElement( "line" );
node.appendChild( lineElement );
// store the attributes
if ( ... | false | false | false | false | false | 0 |
trydecpoint (LexState *ls, TValue *o) {
char old = ls->decpoint;
ls->decpoint = l_getlocaledecpoint();
buffreplace(ls, old, ls->decpoint); /* try new decimal separator */
if (!buff2num(ls->buff, o)) {
/* format error with correct decimal point: no more options */
buffreplace(ls, ls->decpoint, '.'); /*... | false | false | false | false | false | 0 |
enchant_get_registry_value (const char * const prefix, const char * const key)
{
char *val;
g_return_val_if_fail (prefix, NULL);
g_return_val_if_fail (key, NULL);
val = enchant_get_registry_value_ex(1, prefix, key);
if(val == NULL) {
val = enchant_get_registry_value_ex (0, prefix, key);
}
return val;
} | false | false | false | false | false | 0 |
ResetSequenceProgress(Sequence NewSeq) {
DEBUG(dbgs() << " Resetting sequence progress.\n");
SetSeq(NewSeq);
Partial = false;
RRI.clear();
} | false | false | false | false | false | 0 |
set_nonzero_bits_and_sign_copies (x, set, data)
rtx x;
rtx set;
void *data ATTRIBUTE_UNUSED;
{
unsigned int num;
if (GET_CODE (x) == REG
&& REGNO (x) >= FIRST_PSEUDO_REGISTER
/* If this register is undefined at the start of the file, we can't
say what its contents were. */
&& ! ... | false | false | false | false | false | 0 |
plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
{
bfd *abfd;
bfd_use_reserved_id = 1;
abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
srctemplate);
if (abfd != NULL)
{
abfd->flags |= BFD_LINKER_CREATED | BFD_PLUGIN;
bfd_set_arch_info (abfd, bfd_get_arch... | false | false | false | false | false | 0 |
build_hint_from_stack (MonoDomain *domain, void **stack, gint stack_entries)
{
gchar *hint;
MonoMethod *method, *selectedMethod;
MonoAssembly *assembly;
MonoImage *image;
MonoDebugSourceLocation *location;
MonoStackBacktraceInfo *info;
gboolean use_full_trace;
char *methodName;
gint i, native_offset, firstAvai... | false | false | false | false | false | 0 |
ldapu_propval_alloc (const char *prop, const char *val,
LDAPUPropVal_t **propval)
{
*propval = (LDAPUPropVal_t *)malloc(sizeof(LDAPUPropVal_t));
if (!*propval) return LDAPU_ERR_OUT_OF_MEMORY;
(*propval)->prop = prop ? strdup(prop) : 0;
(*propval)->val = val ? strdup(val) : 0;
if ((!prop... | false | false | false | false | false | 0 |
add_handlers()
{
add_read_handler("config", read_handler, h_config);
add_data_handlers("src", Handler::h_read | Handler::h_write, reinterpret_cast<EtherAddress *>(&_ethh.ether_shost));
add_data_handlers("dst", Handler::h_read | Handler::h_write, reinterpret_cast<EtherAddress *>(&_ethh.ether_dhost));
add... | false | false | false | false | false | 0 |
isl_tab_save_samples(struct isl_tab *tab)
{
union isl_tab_undo_val u;
if (!tab)
return -1;
u.n = tab->n_sample;
return push_union(tab, isl_tab_undo_saved_samples, u);
} | false | false | false | false | false | 0 |
initProc() {
// Properties specific to Higgs state.
if (higgsType == 0) {
nameSave = "f_1 f_2 -> H0 f_3 f_4 (W+ W- fusion) (SM)";
codeSave = 907;
idRes = 25;
coup2W = 1.;
}
else if (higgsType == 1) {
nameSave = "f_1 f_2 -> h0(H1) f_3 f_4 (W+ W- fusion)";
codeSave = 1007;
idRes ... | false | false | false | false | false | 0 |
Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
{
*r = 0;
if (x == 0)
return 0;
#ifdef ST_APPEND
if ((x & ST_APPEND) == ST_APPEND)
*r |= Mono_Posix_MountFlags_ST_APPEND;
#endif /* ndef ST_APPEND */
#ifdef ST_BIND
if ((x & ST_BIND) == ST_BIND)
*r |= Mono_Posix_MountFlags_ST_BIND;
#endif /* ndef ST_BIND */
#ifd... | false | false | false | false | false | 0 |
nscBlit(void *drv, void *dev, DFBRectangle * rect, int dx, int dy)
{
NSCDeviceData *nscdev = (NSCDeviceData *) dev;
unsigned long soffset = (rect->x * nscdev->src_pitch) + (rect->y * 2);
unsigned long doffset = (dy * nscdev->dst_pitch) + (dx * 2);
Gal_set_solid_pattern(nscdev->Color);
if (nscdev->v_srcC... | false | false | false | false | false | 0 |
register_isdn(isdn_if *i)
{
isdn_driver_t *d;
int j;
ulong flags;
int drvidx;
if (dev->drivers >= ISDN_MAX_DRIVERS) {
printk(KERN_WARNING "register_isdn: Max. %d drivers supported\n",
ISDN_MAX_DRIVERS);
return 0;
}
if (!i->writebuf_skb) {
printk(KERN_WARNING "register_isdn: No write routine given... | true | true | false | false | false | 1 |
dragMoveEvent(QDragMoveEvent* event)
{
QRect rect = event->answerRect();
if (isAboveArrow(rect.center().x())) {
m_hoverArrow = true;
update();
if (m_subDirsMenu == 0) {
requestSubDirs();
} else if (m_subDirsMenu->parent() != this) {
m_subDirsMenu->close()... | false | false | false | false | false | 0 |
modem_check_result(char *have, char *need)
{
char line[MODEM_BUFFER_LEN + 1];
char *word;
char *more;
int nr;
log_line(L_DEBUG, "Waiting for \"");
log_code(L_DEBUG, need);
log_text(L_DEBUG, "\"... ");
xstrncpy(line, need, MODEM_BUFFER_LEN);
more = strchr(line, '|');
word = strtok(line, "|");
nr = 0;
wh... | true | true | false | false | false | 1 |
substExprQuant(const ExprHashMap<Expr>& oldToNew) const
{
ExprHashMap<Expr> visited(oldToNew);
return recursiveQuantSubst(oldToNew,visited);
} | false | false | false | false | false | 0 |
rl_vi_bword (count, ignore)
int count, ignore;
{
while (count-- && rl_point > 0)
{
int last_is_ident;
/* If we are at the start of a word, move back to whitespace
so we will go back to the start of the previous word. */
if (!whitespace (rl_line_buffer[rl_point]) &&
whitespace (rl_line... | false | false | false | false | false | 0 |
count_fields (tree fields)
{
tree x;
int n_fields = 0;
for (x = fields; x; x = DECL_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
n_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));
else
n_fields += 1;
}
return n_fields;
} | false | false | false | false | false | 0 |
fsl_asrc_dai_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_asrc_pair *pair = runtime->private_data;
if (pair)
fsl_asrc_release_pair(pair);
return 0;
} | false | false | false | false | false | 0 |
ConstantFoldSelectInstruction(Constant *Cond,
Constant *V1, Constant *V2) {
if (ConstantInt *CB = dyn_cast<ConstantInt>(Cond))
return CB->getZExtValue() ? V1 : V2;
if (isa<UndefValue>(V1)) return V2;
if (isa<UndefValue>(V2)) return V1;
if (isa<UndefValue>(Cond)... | false | false | false | false | false | 0 |
sha1_array_append(struct sha1_array *array, const unsigned char *sha1)
{
ALLOC_GROW(array->sha1, array->nr + 1, array->alloc);
hashcpy(array->sha1[array->nr++], sha1);
array->sorted = 0;
} | false | false | false | false | false | 0 |
port_parser(struct nv_pair *nv, int line, plugin_conf_t * c)
{
const char *ptr = nv->value;
unsigned long i;
/* check that all chars are numbers */
for (i = 0; ptr[i]; i++) {
if (!isdigit(ptr[i])) {
log_err("Value %s should only be numbers - line ... | false | false | false | false | false | 0 |
PolygonArea_old(int np, double *xp, double *yp)
{
int i, j;
double area = 0;
for ( i = 0; i < np; i++ )
{
j = (i + 1) % np;
area += xp[i] * yp[j];
area -= yp[i] * xp[j];
}
area /= 2;
/* return(area < 0 ? -area : area); */
return (area);
} | false | false | false | false | false | 0 |
rewriteAppendOnlyFileBackground(void) {
pid_t childpid;
long long start;
if (server.aof_child_pid != -1) return REDIS_ERR;
start = ustime();
if ((childpid = fork()) == 0) {
char tmpfile[256];
/* Child */
if (server.ipfd > 0) close(server.ipfd);
if (server.sofd > 0) ... | false | false | false | false | false | 0 |
put ( std::ostream & os ) const {
int pr=os.precision(20);
std::vector<unsigned long> t(2);
os << " " << name() << "\n";
os << "Uvec" << "\n";
os << randomInt << " " << firstUnusedBit << "\n";
t = DoubConv::dto2longs(defaultWidth);
os << defaultWidth << " " << t[0] << " " << t[1] << "\n";
t = DoubConv::... | false | false | false | false | false | 0 |
free_isakmp_payload(struct isakmp_payload *p)
{
struct isakmp_payload *nxt;
if (p == NULL)
return;
switch (p->type) {
case ISAKMP_PAYLOAD_SA:
free_isakmp_payload(p->u.sa.proposals);
break;
case ISAKMP_PAYLOAD_P:
free(p->u.p.spi);
free_isakmp_payload(p->u.p.transforms);
break;
case ISAKMP_PAYLOAD_T:
... | false | false | false | false | false | 0 |
ValidateDate(const byte* date, byte format, int dateType)
{
time_t ltime;
struct tm certTime;
struct tm* localTime;
int i = 0;
ltime = XTIME(0);
XMEMSET(&certTime, 0, sizeof(certTime));
if (format == ASN_UTC_TIME) {
if (btoi(date[0]) >= 5)
certTime.tm_year = 1900;
... | false | false | false | false | false | 0 |
gwy_combo_box_metric_unit_make_enum(gint from,
gint to,
GwySIUnit *unit,
gint *nentries)
{
GwyEnum *entries;
GwySIValueFormat *format = NULL;
gint i, n;
from = from/3;
to = (to + 2)/3;
if... | false | false | false | false | false | 0 |
write_attr_value (struct attr_desc *attr, rtx value)
{
int op;
switch (GET_CODE (value))
{
case CONST_STRING:
write_attr_valueq (attr, XSTR (value, 0));
break;
case CONST_INT:
printf (HOST_WIDE_INT_PRINT_DEC, INTVAL (value));
break;
case SYMBOL_REF:
fputs (XSTR (valu... | false | false | false | false | false | 0 |
xhci_calculate_u2_timeout(struct xhci_hcd *xhci,
struct usb_device *udev,
struct usb_endpoint_descriptor *desc)
{
unsigned long long timeout_ns;
if (xhci->quirks & XHCI_INTEL_HOST)
timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
else
timeout_ns = udev->u2_params.sel;
/* The U2 timeout is encoded... | false | false | false | false | false | 0 |
unpack16_array(uint16_t ** valp, uint32_t * size_val, Buf buffer)
{
uint32_t i = 0;
if (unpack32(size_val, buffer))
return SLURM_ERROR;
if (*size_val > 4000000) abort();
*valp = xmalloc((*size_val) * sizeof(uint16_t));
for (i = 0; i < *size_val; i++) {
if (unpack16((*valp) + i, buffer))
return SLURM_ERROR;
... | false | false | false | false | false | 0 |
mono_profiler_iomap (char *report, const char *pathname, const char *new_pathname)
{
ProfilerDesc *prof;
for (prof = prof_list; prof; prof = prof->next) {
if ((prof->events & MONO_PROFILE_IOMAP_EVENTS) && prof->iomap_cb)
prof->iomap_cb (prof->profiler, report, pathname, new_pathname);
}
} | false | false | false | false | false | 0 |
optional_string_either(char *str1, char *str2)
{
ignore_white_space();
if ( !strnicmp(str1, Mp, strlen(str1)) ) {
Mp += strlen(str1);
return 0;
} else if ( !strnicmp(str2, Mp, strlen(str2)) ) {
Mp += strlen(str2);
return 1;
}
return -1;
} | false | false | false | false | false | 0 |
randomize(VMG_ uint argc)
{
int i;
long seed;
/* check arguments */
check_argc(vmg_ argc, 0);
/* seed the generator */
os_rand(&seed);
/*
* Fill in rsl[] with the seed. It doesn't do a lot of good to call
* os_rand() repeatedly, since this function might si... | false | false | false | false | false | 0 |
bus_add_match(DBusConnection *conn, char *match)
{
dbus_bus_add_match(conn, match, err);
dbus_connection_flush(conn);
if (dbus_error_is_set(err))
{
printf("Match error: %s\n", err->message);
return -1;
}
return 0;
} | false | false | false | false | false | 0 |
ec_GFp_mont_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
if (group->field_data1 == NULL)
{
ECerr(EC_F_EC_GFP_MONT_FIELD_MUL, EC_R_NOT_INITIALIZED);
return 0;
}
return BN_mod_mul_montgomery(r, a, b, group->field_data1, ctx);
} | false | false | false | false | false | 0 |
Write_half3(std::ostream & os, const float * v3, GpuLanguage lang)
{
if(lang == GPU_LANGUAGE_CG)
{
os << "half3(";
for(int i=0; i<3; i++)
{
if(i!=0) os << ", ";
os << ClampToNormHalf(v3[i]);
}
os << ")";
... | false | false | false | false | false | 0 |
get_ethernet_iface_by_name (const gchar *name)
{
OobsIfacesConfig *config;
OobsList *list;
OobsListIter iter;
OobsIface *iface;
gboolean valid;
config = OOBS_IFACES_CONFIG (oobs_ifaces_config_get ());
list = oobs_ifaces_config_get_ifaces (config, OOBS_IFACE_TYPE_ETHERNET);
valid = oobs_list_get_iter_fi... | false | false | false | false | false | 0 |
snp_new(const char *p)
{
snp_t *snp = alloc(sizeof(snp_t));
p = match_literal(p, "PBRSNP,");
p = match_string_until(p, ',', 1, &snp->instrument_id);
p = match_string_until(p, ',', 1, &snp->pilot_name);
p = match_unsigned(p, &snp->serial_number);
p = match_char(p, ',');
p = match_string_until... | false | false | false | false | false | 0 |
ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) {
int l;
TCell Cell(' ', Fill);
DrawCursor(0);
if (Way == csUp) {
DebugShowArea(X, (Y + Count), W, (H - Count), 14);
XCopyArea(display, win, win, colorXGC->GetGC(0),
X * FontCX, (Y + Count) * FontCY... | false | false | false | false | false | 0 |
Problem_7_test(){
int rowOne[] = {0,1,0,0};
int rowTwo[] = {1,0,1,1};
int rowThree[] = {1,0,0,0};
int rowFour[] = {0,1,1,1};
vector<vector<int> > screen;
screen.push_back(vector<int>(rowOne, rowOne+4));
screen.push_back(vector<int>(rowTwo, rowTwo+4));
screen.push_back(vector<int>(rowThre... | false | false | false | false | false | 0 |
slapi_build_control( char *oid, BerElement *ber,
char iscritical, LDAPControl **ctrlp )
{
int rc = 0;
int return_value = LDAP_SUCCESS;
struct berval *bvp = NULL;
PR_ASSERT( NULL != oid && NULL != ctrlp );
if ( NULL == ber ) {
bvp = NULL;
} else {
/* allocate struct berval with contents of the BER encoding ... | false | false | false | false | false | 0 |
param_extract(Table *tb, char *line)
{
//tb->theta0 = 180.0; <- equilibrium angles not supported
tb->ninput = 0;
tb->f_unspecified = false; //default
tb->use_degrees = true; //default
char *word = strtok(line," \t\n\r\f");
while (word) {
if (strcmp(word,"N") == 0) {
word = strtok(NULL," \t\n\r... | false | false | false | false | false | 0 |
toStr() const
{
return QwtMmlNode::toStr() + QString( " form=%1" ).arg( ( int )form() );
} | false | false | false | false | false | 0 |
nv10_emit_light_enable(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
uint32_t en_lights = 0;
int i;
if (nctx->fallback != HWTNL) {
BEGIN_NV04(push, NV10_3D(LIGHTING_ENABLE), 1);
PUSH_DATA (push, 0);
return;
}
... | false | false | false | false | false | 0 |
unix_time(int64_t date) {
if (date<=0) return -1;
static const int days[12]={0,31,59,90,120,151,181,212,243,273,304,334};
const int year=date/10000000000LL%10000;
const int month=(date/100000000%100-1)%12;
const int day=date/1000000%100;
const int hour=date/10000%100;
const int min=date/100%100;
const i... | false | false | false | false | false | 0 |
gst_flac_calculate_crc16 (const guint8 * data, guint length)
{
guint16 crc = 0;
while (length--) {
crc = ((crc << 8) ^ crc16_table[(crc >> 8) ^ *data]) & 0xffff;
data++;
}
return crc;
} | false | false | false | false | false | 0 |
current_setting( calib_yyparse_private_t *priv )
{
int retval;
while( priv->cal_index >= priv->parsed_file->num_settings )
{
retval = add_calibration_setting( priv->parsed_file );
if( retval < 0 ) return NULL;
}
return &priv->parsed_file->settings[ priv->cal_index ];
} | false | false | false | false | false | 0 |
ar5008_hw_attach_phy_ops(struct ath_hw *ah)
{
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
static const u32 ar5416_cca_regs[6] = {
AR_PHY_CCA,
AR_PHY_CH1_CCA,
AR_PHY_CH2_CCA,
AR_PHY_EXT_CCA,
AR_PHY_CH1_EXT_CCA,
AR_PHY_CH2_EXT_CCA
};
priv_ops->rf_set_freq = ar5008_hw_set_channel;
pri... | false | false | false | false | false | 0 |
map_get_key(struct battery_property_map *map, int value,
const char *def_key)
{
while (map->key) {
if (map->value == value)
return map->key;
map++;
}
return def_key;
} | false | false | false | false | false | 0 |
sx9500_read_samp_freq(struct sx9500_data *data,
int *val, int *val2)
{
int ret;
unsigned int regval;
mutex_lock(&data->mutex);
ret = regmap_read(data->regmap, SX9500_REG_PROX_CTRL0, ®val);
mutex_unlock(&data->mutex);
if (ret < 0)
return ret;
regval = (regval & SX9500_SCAN_PERIOD_MASK) >> SX9500_SCAN... | false | false | false | false | false | 0 |
CopyInformationFromPipeline(vtkInformation* request)
{
// Let the superclass copy whatever it wants.
this->Superclass::CopyInformationFromPipeline(request);
// Copy pipeline information to data information before the producer
// executes.
if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
{
th... | false | false | false | false | false | 0 |
upd_signal_handler(int sig)
{
if(sigupd) sigupd->flags |= B_ABORT;
} | false | false | false | false | false | 0 |
Write(std::ostream &os) const
{
assert( (size_t)ItemLength + 4 == Size() );
os.write( (char*)&ItemType, sizeof(ItemType) );
os.write( (char*)&Reserved2, sizeof(Reserved2) );
uint16_t copy = ItemLength;
SwapperDoOp::SwapArray(©,1);
os.write( (char*)©, sizeof(ItemLength) );
os.write( (char*)&ID, si... | false | false | false | false | false | 0 |
walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
pud_t *pud;
unsigned long next;
int err = 0;
pud = pud_offset(pgd, addr);
do {
next = pud_addr_end(addr, end);
if (pud_none_or_clear_bad(pud)) {
if (walk->pte_hole)
err = walk->pte_hole(addr, next, walk);
... | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.