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 |
|---|---|---|---|---|---|---|
DownloadFile_SetDirty(const CPartFile *file)
#endif
{
for(std::map<CECServerSocket *, ECUpdateMsgSource **>::iterator i = m_msg_source.begin();
// ADUNANZA BEGIN
// backport
#if 0
i != m_msg_source.end(); i++) {
#else
i != m_msg_source.end(); ++i) {
#endif
// ADUNANZA END
CECServerSocket *sock = i->first;
if (... | false | false | false | false | false | 0 |
itoa_to_buf(int n, char *buf, unsigned buflen)
{
if (!buflen)
return buf;
if (n < 0) {
n = -n;
*buf++ = '-';
buflen--;
}
return utoa_to_buf((unsigned)n, buf, buflen);
} | false | false | false | false | false | 0 |
_install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
{
glusterd_conf_t *priv = THIS->private;
char *label = NULL;
gf_boolean_t georep = _gf_false;
gf_boolean_t ghadoop = _gf_false;
char *pdesc ... | false | false | false | false | false | 0 |
juman_run(argc, argv)
int argc;
char **argv;
{
int ret;
if (!option_proc_for_server(argc, argv)) {
skip_until_EOf(client_ifp);
fputs("500 Option Error\n", client_ofp);
fflush(client_ofp);
return 1;
}
fputs("200 OK\n", client_ofp);
fflush(client_ofp);
ret = do_juman();
fpr... | false | false | false | false | false | 0 |
special_function_p (const_tree decl)
{
/* Rather than doing all this stuff with magic names, we should
probably have a field of type `special_function_kind' in
DECL_LANG_SPECIFIC. */
if (DECL_INHERITED_CTOR_BASE (decl))
return sfk_inheriting_constructor;
if (DECL_COPY_CONSTRUCTOR_P (decl))
retu... | false | false | false | false | false | 0 |
make_result(NumericVar *var)
{
Numeric result;
NumericDigit *digits = var->digits;
int weight = var->weight;
int sign = var->sign;
int n;
Size len;
if (sign == NUMERIC_NAN)
{
result = (Numeric) palloc(NUMERIC_HDRSZ_SHORT);
SET_VARSIZE(result, NUMERIC_HDRSZ_SHORT);
result->choice.n_header = NUMER... | false | false | false | false | false | 0 |
find(int x, int y)
{
int i;
gControl *ch;
for (i = 0; i < childCount(); i++)
{
ch = child(i);
if (x >= ch->left() && y >= ch->top() && x < (ch->left() + ch->width()) && y < (ch->top() + ch->height()))
return ch;
}
return NULL;
} | false | false | false | false | false | 0 |
irmo_interface_unref(IrmoInterface *iface)
{
irmo_return_if_fail(iface != NULL);
--iface->refcount;
if (iface->refcount <= 0) {
_irmo_interface_free(iface);
}
} | false | false | false | false | false | 0 |
gst_matroska_parse_parse_contents_seekentry (GstMatroskaParse * parse,
GstEbmlRead * ebml)
{
GstFlowReturn ret;
guint64 seek_pos = (guint64) - 1;
guint32 seek_id = 0;
guint32 id;
DEBUG_ELEMENT_START (parse, ebml, "Seek");
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
DEBUG_ELEMENT... | false | false | false | false | false | 0 |
resize(void *orgPtr, unsigned memSize, const char* fileName, int fileLine)
{
err_when( memSize > 1000000 ); //**BUGHERE, for temporary debugging only
if( orgPtr == NULL )
return add( memSize, fileName, fileLine);
//-------------------------------------------//
char *newPtr;
int i;
for( i=ptr... | false | false | false | true | false | 1 |
check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
COND_EQUAL *cond_equal, List<Item>* eq_list)
{
uint n= left_row->cols();
for (uint i= 0 ; i < n; i++)
{
bool is_converted;
Item *left_item= left_row->element_index(i);
Item *right_item= right_row->element... | false | false | false | false | false | 0 |
addArrowMesh(const io::path& name,
video::SColor vtxColor0, video::SColor vtxColor1,
u32 tesselationCylinder, u32 tesselationCone, f32 height,
f32 cylinderHeight, f32 width0,f32 width1)
{
if (MeshCache->isMeshLoaded(name))
return MeshCache->getMeshByName(name);
IMesh* mesh = GeometryCreator->createAr... | false | false | false | false | false | 0 |
view_history_get_revisions_cb (GiggleGit *git,
GiggleJob *job,
GError *error,
gpointer user_data)
{
GiggleViewHistory *view;
GiggleViewHistoryPriv *priv;
GtkListStore *store;
GtkTreeIter iter;
GList *revisions;
view = GIGGLE_V... | false | false | false | false | false | 0 |
user_confirmation_required() const
{
CYG_REPORT_FUNCNAMETYPE("CdlTransaction::user_confirmation_required", "result %d");
CYG_REPORT_FUNCARG1XV(this);
CYG_PRECONDITION_THISC();
CYG_PRECONDITION_CLASSC(this->parent);
bool result = false;
std::map<CdlValuable, CdlValue>::const_iterator val_i;
... | false | false | false | false | false | 0 |
reg_r(struct gspca_dev *gspca_dev,
u8 req,
u16 index,
u16 len)
{
int ret;
if (len > USB_BUF_SZ) {
PERR("reg_r: buffer overflow\n");
return;
}
if (gspca_dev->usb_err < 0)
return;
ret = usb_control_msg(gspca_dev->dev,
usb_rcvctrlpipe(gspca_dev->dev, 0),
req,
USB_DIR_IN | USB_TYPE_VENDOR |... | false | false | false | false | false | 0 |
get_splitting_entry(ir_variable *var)
{
assert(var);
foreach_list(n, this->variable_list) {
variable_entry *entry = (variable_entry *) n;
if (entry->var == var) {
return entry;
}
}
return NULL;
} | false | false | false | false | false | 0 |
SiftUp(void) /* not const */
{
int i, parent;
#ifdef DEBUG
(void)fprintf(logFile, "support.cc/void Population::SiftUp(void)\n");
#endif /* DEBUG */
i = lhb-1;
while (((parent=(i+size+1)/2)<size)&&(heap[parent].value(Normal_Eval)>heap[i].value(Normal_Eval))) {
swap(heap[parent], heap[i]);
i =... | false | false | false | false | false | 0 |
gamgi_global_selection_list (gamgi_enum class)
{
switch (class)
{
case GAMGI_ENGINE_TEXT:
return gamgi->texts;
case GAMGI_ENGINE_ORBITAL:
return gamgi->orbitals;
case GAMGI_ENGINE_BOND:
return gamgi->bonds;
case GAMGI_ENGINE_ATOM:
return gamgi->atoms;
case GAMGI_ENGINE_DIRECTION:
return gamgi-... | false | false | false | false | false | 0 |
getOffsetOfExpr(const StructType *STy,
unsigned FieldNo) {
// If we have TargetData, we can bypass creating a target-independent
// constant expression and then folding it back into a ConstantInt.
// This is just a compile-time optimization.
if (TD)
return getCon... | false | false | false | false | false | 0 |
au_vdir_free(struct au_vdir *vdir)
{
unsigned char **deblk;
deblk = vdir->vd_deblk;
while (vdir->vd_nblk--)
kfree(*deblk++);
kfree(vdir->vd_deblk);
au_cache_free_vdir(vdir);
} | false | false | false | false | false | 0 |
parse_page_end_page_cb (CRDocHandler * a_this,
CRString * a_name,
CRString * a_pseudo_page)
{
enum CRStatus status = CR_OK;
CRStatement *stmt = NULL;
CRStatement **stmtptr = NULL;
stmtptr = &stmt;
status = cr_doc_handler_get_ctxt (a_this... | false | false | false | false | false | 0 |
set_tty_settings()
{
struct termios new_settings;
static struct termios old_settings;
if (tcgetattr(0, &old_settings) == -1)
{
perror(APPNAME);
return NULL;
}
new_settings = old_settings;
/* Disable echoing */
new_settings.c_lflag &= (~ECHO);
/* Disable canonical input, and set input buffer to 1 byte (1... | false | false | false | false | false | 0 |
WriteEdict (FILE *f, edict_t *ent)
{
field_t *field;
edict_t temp;
size_t size;
// all of the ints, floats, and vectors stay as they are
temp = *ent;
// change the pointers to lengths or indexes
for (field=fields ; field->name ; field++)
{
WriteField1 (f, field, (byte *)&temp);
}
// write the block
s... | false | false | false | false | false | 0 |
show_color_attr(int fg, int bg, int tx)
{
if (use_colors) {
printw(" Colors (fg %d, bg %d", fg, bg);
if (tx >= 0)
printw(", text %d", tx);
printw("),");
}
} | false | false | false | false | false | 0 |
kgdb_arch_pc(int exception, struct pt_regs *regs)
{
if (exception == 3)
return instruction_pointer(regs) - 1;
return instruction_pointer(regs);
} | false | false | false | false | false | 0 |
ginHeapTupleBulkInsert(GinBuildState *buildstate, Datum value, ItemPointer heapptr)
{
Datum *entries;
int32 nentries;
MemoryContext oldCtx;
oldCtx = MemoryContextSwitchTo(buildstate->funcCtx);
entries = extractEntriesSU(buildstate->accum.ginstate, value, &nentries);
MemoryContextSwitchTo(oldCtx);
if (nentr... | false | false | false | false | false | 0 |
facet_general_value(f_info)
struct qinfo *f_info;
{ int m,k;
REAL value = 0.0;
REAL z[2*MAXCOORD+1]; /* pointers to coord and tangent */
REAL sign = (get_fattr(f_info->id) & NEGBOUNDARY) ? -1.0 : 1.0;
REAL *normal = z+SDIM;
if ( web.modeltype == LAGRANGE )
return facet_general_value_lagr(f_info);
... | false | false | false | false | false | 0 |
__db_SHA1Update(context, data, len)
SHA1_CTX *context;
unsigned char *data;
size_t len;
{
u_int32_t i, j; /* JHB */
#ifdef VERBOSE
__db_SHAPrintContext(context, DB_STR_P("before"));
#endif
j = (context->count[0] >> 3) & 63;
if ((context->count[0] += (u_int32_t)len << 3) < (len << 3))
context->count... | false | false | false | false | false | 0 |
GetClientCoordinates(ccw)
ConversionControlWidget ccw;
{
Display *dpy = XtDisplay(ccw);
Window root = RootWindowOfScreen(XtScreen(ccw));
Window win = ccw->ccontrol.clientwindow;
Window junk;
int rootx, rooty;
if (!XTranslateCoordinates(dpy, win, root, 0, 0, &rootx, &rooty, &junk)) {
WidgetWarn... | false | false | false | false | false | 0 |
EffectActivateRune(SpellEffectIndex eff_idx)
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* plr = (Player*)m_caster;
if (plr->getClass() != CLASS_DEATH_KNIGHT)
return;
int32 count = damage; // max amount of reset runes
if (plr->Acti... | false | false | false | false | false | 0 |
rx_timestamp_work(struct work_struct *work)
{
struct dp83640_private *dp83640 =
container_of(work, struct dp83640_private, ts_work.work);
struct sk_buff *skb;
/* Deliver expired packets. */
while ((skb = skb_dequeue(&dp83640->rx_queue))) {
struct dp83640_skb_info *skb_info;
skb_info = (struct dp83640_skb_in... | false | false | false | false | false | 0 |
check_location_for_unix_socket(const or_options_t *options, const char *path)
{
int r = -1;
char *p = tor_strdup(path);
cpd_check_t flags = CPD_CHECK_MODE_ONLY;
if (get_parent_directory(p)<0)
goto done;
if (options->ControlSocketsGroupWritable)
flags |= CPD_GROUP_OK;
if (check_private_dir(p, flags... | false | false | false | false | false | 0 |
parent_signal_callback(void *arg)
{
struct crut_pipes *pipes = arg;
int rc;
printf("002 callback running in parent\n");
fflush(stdout);
crut_pipes_putchar(pipes, PARENT_PRE);
crut_pipes_expect(pipes, CHILD_PRE);
printf("004 callback recv PRE ack from child\n");
fflush(stdout);
rc =... | false | false | false | false | false | 0 |
OnEditHighlightMode(wxCommandEvent& event)
// ----------------------------------------------------------------------------
{
ScbEditor* ed = GetEditorManager()->GetBuiltinActiveEditor();
if (ed)
{
SEditorColourSet* theme = GetEditorManager()->GetColourSet();
if (theme)
{
... | false | false | false | false | false | 0 |
CreateTetra(OTPoint *p, OTFace *face)
{
OTTetra *tetra = new(this->Heap) OTTetra;
this->Tetras.push_front(tetra);
tetra->Radius2 = vtkTetra::Circumsphere(p->P,
face->Points[0]->P,
face->Points[1]->P,
... | false | false | false | false | false | 0 |
e_xsettings_init(void)
{
_atom_manager = ecore_x_atom_get("MANAGER");
_atom_xsettings = ecore_x_atom_get("_XSETTINGS_SETTINGS");
_atom_gtk_iconthemes = ecore_x_atom_get("_GTK_LOAD_ICONTHEMES");
_atom_gtk_rcfiles = ecore_x_atom_get("_GTK_READ_RCFILES");
if (e_config->xsettings.enabled)
_e_xsettings_... | false | false | false | false | false | 0 |
doshrink(smthopt *s, double *out, double *in, double shrink) {
double rad, len, p2[3];
cvect((void *)s, p2, in); /* Get shrink direction */
/* Conservative radius of point */
rad = sqrt(in[1] * in[1] + in[2] * in[2]);
len = shrink;
if (rad < (2.0 * shrink))
len = rad * 0.5;
icmNormalize33(out, p2, in... | false | false | false | false | false | 0 |
new_timer_process_list(unsigned int flags)
{
struct sr_timer_process *tpl;
struct sr_timer_process *tpl_it;
tpl = pkg_malloc( sizeof(struct sr_timer_process) );
if (tpl==NULL) {
LM_ERR("no more pkg memory\n");
return 0;
}
memset( tpl, 0, sizeof(struct sr_timer_process));
tpl->flags = flags;
if (timer_proc... | false | false | false | false | false | 0 |
_PageWrite(struct rtw_adapter *padapter, u32 page, void *buffer, u32 size)
{
u8 value8;
u8 u8Page = (u8) (page & 0x07);
if (size > MAX_PAGE_SIZE)
return _FAIL;
value8 = (rtl8723au_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page;
rtl8723au_write8(padapter, REG_MCUFWDL + 2, value8);
return rtl8723au_writeN(p... | false | false | false | false | false | 0 |
ompcbe_write_thread_wrapper(csbe_context *cx,
Module_table *module_main,
int npes)
{
int i;
Operand *op;
for (i = 1; i < npes; i++) {
csbe_printf(cx, "void * main_pe%d_wrapper(void *args)\n{\n", i);
if (module_main->arg_head != NULL) {
csbe_printf(cx, "THREAD_ARGS *thread_args;\... | false | false | false | false | false | 0 |
i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,
struct drm_i915_gem_execbuffer2 *args,
struct list_head *vmas)
{
struct drm_device *dev = params->dev;
struct intel_engine_cs *ring = params->ring;
struct drm_i915_private *dev_priv = dev->dev_private;
u64 exec_start, exec_len... | false | false | false | false | false | 0 |
aa_free_profile(struct aa_profile *profile)
{
struct rhashtable *rht;
AA_DEBUG("%s(%p)\n", __func__, profile);
if (!profile)
return;
/* free children profiles */
aa_policy_destroy(&profile->base);
aa_put_profile(rcu_access_pointer(profile->parent));
aa_put_ns(profile->ns);
kzfree(profile->rename);
aa_fr... | false | true | false | false | false | 1 |
setAddress(const void* raw, int version)
{
// this always succeeds
// except if version is invalid
if (version != 4 && version != 6)
return false;
m_version = version;
if (raw != 0L)
memcpy(m_data, raw, version == 4 ? 4 : 16);
else
memset(m_data, 0, 16);
return true;
} | false | false | false | false | false | 0 |
sort_parents (Sym * child)
{
Arc *arc, *detached, sorted, *prev;
/* Unlink parents from child, then insertion sort back on to
sorted's parents.
*arc the arc you have detached and are inserting.
*detached the rest of the arcs to be sorted.
sorted arc list onto which you insertion sort.
... | false | false | false | false | false | 0 |
xdl_cha_alloc(chastore_t *cha) {
chanode_t *ancur;
void *data;
if (!(ancur = cha->ancur) || ancur->icurr == cha->nsize) {
if (!(ancur = (chanode_t *) xdl_malloc(sizeof(chanode_t) + cha->nsize))) {
return NULL;
}
ancur->icurr = 0;
ancur->next = NULL;
if (cha->tail)
cha->tail->next = ancur;
if (!ch... | false | false | false | false | false | 0 |
NotifyFileOpened(const char* pszFilename,
VSILFILE* fp)
{
if (strcmp(pszFilename, pszName) == 0)
{
fpMainFile = fp;
}
} | false | false | false | false | false | 0 |
drain_pages(unsigned int cpu)
{
struct zone *zone;
for_each_populated_zone(zone) {
drain_pages_zone(cpu, zone);
}
} | false | false | false | false | false | 0 |
parse_IFD_entry_formatted_one_value(
bool is_big,
ushort format,
size_t component_size,
const uchar *value) {
switch(format) {
case 1: // unsigned byte
return new VInt((uchar)value[0]);
case 3: // unsigned short
return new VInt(endian_to_ushort(is_big, va... | false | false | false | false | false | 0 |
GetDateAsLocale(const char *iso, char *locale)
{
int year, month, day;
if( vtkMedicalImageProperties::GetDateAsFields(iso, year, month, day) )
{
if (year < 1900 || month < 1 || month > 12 || day < 1 || day > 31)
{
*locale = '\0';
}
else
{
struct tm date;
memset(&date,... | false | false | false | false | false | 0 |
ggep_stream_append(ggep_stream_t *gs, const void *data, size_t len)
{
g_assert(ggep_stream_is_valid(gs));
if (len > ggep_stream_avail(gs)) {
ggep_errno = GGEP_E_SPACE;
return FALSE;
}
gs->o = mempcpy(gs->o, data, len);
return TRUE;
} | false | false | false | false | false | 0 |
setupVPSC() {
Constraint **cs;
//assert(lcs.size()==0);
for(DummyVars::iterator dit=dummy_vars.begin();
dit!=dummy_vars.end(); ++dit) {
(*dit)->setupVPSC(vars,lcs);
}
Variable** vs = new Variable*[vars.size()];
for(unsigned i=0;i<vars.size();i++) {
vs[i]=vars[i];... | false | false | false | false | false | 0 |
clear_req_option_list (ReqOption **r_p)
{
if (*r_p == NULL)
return;
clear_req_or_option_list (&(*r_p)->or_option_terms);
clear_req_option_list (&(*r_p)->next);
*r_p = NULL;
} | false | false | false | false | false | 0 |
_prof_get_total_utime(prof_level level, bool with_sub, dstring *error)
{
pthread_t thread_id = pthread_self();
int thread_num;
clock_t clock = 0;
thread_num = get_prof_info_thread_id(thread_id);
clock = theInfo[thread_num][level].total_utime;
if (!with_sub) {
clock -= theInfo[thread_num][leve... | false | false | false | false | false | 0 |
OnLeftButtonDown()
{
if (!this->Interactor)
{
return;
}
this->Moving = 1;
vtkRenderWindow *renWin = this->Interactor->GetRenderWindow();
this->StartPosition[0] = this->Interactor->GetEventPosition()[0];
this->StartPosition[1] = this->Interactor->GetEventPosition()[1];
this->EndPosition[0] ... | false | false | false | false | false | 0 |
LUKS_open_key_with_hdr(const char *device,
int keyIndex,
const char *password,
size_t passwordLen,
struct luks_phdr *hdr,
struct luks_masterkey **mk,
struct crypt_device *ctx)
{
unsigned int i;
int r;
*mk = LUKS_alloc_masterkey(hdr->keyBytes, NULL);
if (keyIndex >= 0)
return ... | false | false | false | false | false | 0 |
DeallocateMemory()
{
if (N > 0)
{
delete[] a11_re;
delete[] a11_im;
delete[] a12_re;
delete[] a12_im;
delete[] a21_re;
delete[] a21_im;
delete[] L11_re;
delete[] L11_im;
delete[] L12_re;
delete[] L12_im;
delete[] L21_re;
delete[] L21_im;
delete[] L22_re;
delete[] L22_im;
delete[] R11_re;
delete[... | false | false | false | false | false | 0 |
handle_get_screensaver_tasks(GUI_RPC_CONN& grc) {
unsigned int i;
ACTIVE_TASK* atp;
grc.mfout.printf(
"<handle_get_screensaver_tasks>\n"
" <suspend_reason>%d</suspend_reason>\n",
gstate.suspend_reason
);
for (i=0; i<gstate.active_tasks.active_tasks.size(); i++) {
a... | false | false | false | false | false | 0 |
InitList()
{
size_t i, off_set = 0;
const size_t sz = sizeof(BufferNode) + granularity_;
for (i = 0; i < size_; ++i)
{
off_set = i * sz;
freeList_[i] = (BufferNode*)(rawBuff_ + off_set);
}
for (i = 0; i < size_ - 1; ++i)
{
freeList_[i]->next_.vals[0] = (void*)(i + 1... | false | false | false | false | false | 0 |
Unpronouncable(Translator *tr, char *word, int posn)
{//=====================================================
/* Determines whether a word in 'unpronouncable', i.e. whether it should
be spoken as individual letters.
This function may be language specific. This is a generic version.
*/
int c;
int c1=0;
int vow... | false | false | false | false | false | 0 |
linda_ib_epb_release ( struct linda *linda ) {
struct QIB_7220_ibsd_epb_access_ctrl access;
memset ( &access, 0, sizeof ( access ) );
BIT_FILL_1 ( &access, sw_ib_epb_req, 0 );
linda_writeq ( linda, &access, QIB_7220_ibsd_epb_access_ctrl_offset );
} | false | false | false | false | false | 0 |
stripwhite (char *string)
{
register char *s, *t;
for (s = string; isspace (*s); s++)
;
if (*s == 0)
return (s);
t = s + strlen (s) - 1;
while (t > s && isspace (*t))
t--;
*++t = '\0';
return s;
} | false | false | false | false | false | 0 |
really_check_referer( httpd_conn* hc )
{
httpd_server* hs;
char* cp1;
char* cp2;
char* cp3;
static char* refhost = (char*) 0;
static size_t refhost_size = 0;
char *lp;
hs = hc->hs;
/* Check for an empty referer. */
if ( hc->referer == (char*) 0 || hc->referer[0] == '\0' ||
... | false | false | false | false | false | 0 |
copy (const xdrIOBuffer& rhs_)
{
trace_with_mask("xdrIOBuffer::copy", XDRBUFTRACE);
m_sz = rhs_.m_sz;
m_buf = new char[m_sz];
memcpy (m_buf, rhs_.m_buf, m_sz);
m_ptr = m_buf + (rhs_.size ());
m_state = rhs_.m_state;
} | false | false | false | false | false | 0 |
cp2112_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
struct cp2112_device *dev = container_of(chip, struct cp2112_device,
gc);
struct hid_device *hdev = dev->hdev;
u8 buf[5];
int ret;
ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
sizeof(buf), HID_FEAT... | false | false | false | false | false | 0 |
phy_pm_runtime_get_sync(struct phy *phy)
{
int ret;
if (!pm_runtime_enabled(&phy->dev))
return -ENOTSUPP;
ret = pm_runtime_get_sync(&phy->dev);
if (ret < 0)
pm_runtime_put_sync(&phy->dev);
return ret;
} | false | false | false | false | false | 0 |
_getHash(const std::string& url) const {
// get the hash of the url
std::string hash = FileCacheHash::getHash(url);
int index = 0;
for (int level = 0; level < CACHE_DIR_LEVELS; level ++) {
hash.insert(index + CACHE_DIR_LENGTH, "/");
// go to next slash position, add one since we just inser... | false | false | false | false | false | 0 |
concatPaths(_TCHAR** strs, _TCHAR separator) {
_TCHAR separatorString[] = { separator, 0 };
_TCHAR * result;
int i = -1;
size_t length = 0;
/* first count how large a buffer we need */
while (strs[++i] != NULL) {
length += _tcslen(strs[i]) + (separator != 0 ? 1 : 0);
}
result = malloc((length + 1) * sizeof(_... | false | true | false | false | false | 1 |
mthca_get_rate(struct mthca_dev *dev, int static_rate, u8 port)
{
u8 rate;
if (!static_rate || ib_rate_to_mult(static_rate) >= dev->rate[port - 1])
return 0;
if (mthca_is_memfree(dev))
rate = ib_rate_to_memfree(ib_rate_to_mult(static_rate),
dev->rate[port - 1]);
else
rate = ib_rate_to_tavor(static_ra... | false | false | false | false | false | 0 |
safe_move(int move, int color)
{
int safe = 0;
static int initialized = 0;
int ko_move;
if (!initialized) {
clear_safe_move_cache();
initialized = 1;
}
/* If we have this position cached, use the previous value.
* Only use cached values when stackp is 0 and reading is not being done
* at a... | false | false | false | false | false | 0 |
strip_nonspace(const char *buf, int *ip)
{
int i = *ip;
while(!isspace((unsigned char) buf[i])) i++;
*ip = i;
} | false | false | false | false | false | 0 |
find_best_route(const unsigned char *prefix, unsigned char plen, int feasible,
struct neighbour *exclude)
{
struct babel_route *route, *r;
int i = find_route_slot(prefix, plen, NULL);
if(i < 0)
return NULL;
route = routes[i];
while(route && !route_acceptable(route, feasible... | false | false | false | false | false | 0 |
validate(std::string& err) {
if (enumerate.mode == enum_bt && enumerate.restartOnModel) {
err = "Options 'restart-on-model' and 'enum-mode=bt' are mutually exclusive!";
return false;
}
for (uint32 i = 0; i != numSolvers(); ++i) {
if (!validate(*getSolver(i), err)) { return false; }
}
return true;
} | false | false | false | false | false | 0 |
SendMessage(const Socket* conn,
const v8::Handle<v8::String> request) {
static const int kBufferSize = 80;
char buffer[kBufferSize]; // Sending buffer both for header and body.
// Convert the request to UTF-8 encoding.
v8::String::Utf8Value utf8_request(request);
// Send... | false | false | false | false | false | 0 |
GAResetRNG(unsigned int s) {
if(s != 0) {
seed = s;
_GA_RND_SEED (seed);
bitseed(seed);
}
} | false | false | false | false | false | 0 |
mem_realloc(void *p, size_t len)
{
void *mem;
/* Fail gracefully */
if (!p || len == 0) return (NULL);
if (realloc_aux) mem = (*realloc_aux)(p, len);
else mem = realloc(p, len);
/* Handle OOM */
if (!mem) quit("Out of Memory!");
return mem;
} | false | false | false | false | false | 0 |
nextLine(const QString &line)
{
if (line.contains(QLatin1String( "edit_ownertrust.value" ))) {
write(QByteArray::number(m_trust));
setSuccess(TS_OK);
} else {
return KGpgEditKeyTransaction::nextLine(line);
}
return false;
} | false | false | false | false | false | 0 |
init(void)
{
tdialogbox::init();
xsize = 570;
ysize = 320;
x1 = ( 640 -xsize ) / 2;
y1 = ( 480 -ysize ) / 2;
sy = 45;
sx = 20;
title = "Text-Box";
windowstyle = windowstyle ^ dlg_in3d;
lnshown = 10;
ey = ysize - 50;
ex = xsize - 30;
setup();
if (startpos >= numberoflines ) ... | false | false | false | false | false | 0 |
xfs_filestream_peek_ag(
xfs_mount_t *mp,
xfs_agnumber_t agno)
{
struct xfs_perag *pag;
int ret;
pag = xfs_perag_get(mp, agno);
ret = atomic_read(&pag->pagf_fstrms);
xfs_perag_put(pag);
return ret;
} | false | false | false | false | false | 0 |
totem_pl_parser_is_opml (const char *data, gsize len)
{
if (len == 0)
return FALSE;
if (len > MIME_READ_CHUNK_SIZE)
len = MIME_READ_CHUNK_SIZE;
if (g_strstr_len (data, len, OPML_NEEDLE) != NULL)
return OPML_MIME_TYPE;
return NULL;
} | false | false | false | false | false | 0 |
receive_dmsg(struct hfc_pci *hc)
{
struct dchannel *dch = &hc->dch;
int maxlen;
int rcnt, total;
int count = 5;
u_char *ptr, *ptr1;
struct dfifo *df;
struct zt *zp;
df = &((union fifo_area *)(hc->hw.fifos))->d_chan.d_rx;
while (((df->f1 & D_FREG_MASK) != (df->f2 & D_FREG_MASK)) && count--) {
zp = &df->z... | false | false | false | false | false | 0 |
dataBaseOutput(ofstream & output,bool header) const {
if(header) output << "update decayers set parameters=\"";
Baryon1MesonDecayerBase::dataBaseOutput(output,false);
for(unsigned int ix=0;ix<_incoming.size();++ix) {
if(ix<_initsize) {
output << "newdef " << name() << ":M1Coupling "
<< ix << " " ... | false | false | false | false | false | 0 |
connect_widget_signals (GtkWidget *proxy, EggEditableToolbar *etoolbar)
{
if (GTK_IS_CONTAINER (proxy))
{
gtk_container_forall (GTK_CONTAINER (proxy),
(GtkCallback) connect_widget_signals,
(gpointer) etoolbar);
}
if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (prox... | false | false | false | false | false | 0 |
FindSubstitutionSlots(int irit,
std::vector<bool> & vfInput, std::vector<bool> & vfOutput)
{
if (!m_psymOutput)
{
return; // no output, therefore no substitution (if another item does a substitution
// based on the input, that item will set the flag)
}
if (m_psymOutput->FitsSymbolType(ksymtClass))
{
if (... | false | false | false | false | false | 0 |
gf_isom_get_fragments_count(GF_ISOFile *movie, Bool segments_only)
{
u32 i=0;
u32 nb_frags = 0;
GF_Box *b;
while ((b=gf_list_enum(movie->TopBoxes, &i))) {
if (segments_only) {
if (b->type==GF_ISOM_BOX_TYPE_SIDX)
nb_frags++;
} else {
if (b->type==GF_ISOM_BOX_TYPE_MOOF)
nb_frags++;
}
}
return ... | false | false | false | false | false | 0 |
IsPointerOffset(Value *Ptr1, Value *Ptr2, int64_t &Offset,
const DataLayout &DL) {
Ptr1 = Ptr1->stripPointerCasts();
Ptr2 = Ptr2->stripPointerCasts();
// Handle the trivial case first.
if (Ptr1 == Ptr2) {
Offset = 0;
return true;
}
GEPOperator *GEP1 = dyn_cast<GEPOperat... | false | false | false | false | false | 0 |
rad_packet_add_int(struct rad_packet_t *pack, const char *vendor_name, const char *name, int val)
{
struct rad_attr_t *ra;
struct rad_dict_attr_t *attr;
struct rad_dict_vendor_t *vendor;
if (pack->len + (vendor_name ? 8 : 2) + 4 >= REQ_LENGTH_MAX)
return -1;
if (vendor_name) {
vendor = rad_dict_find_vendor_n... | false | false | false | false | false | 0 |
configuration_save_session_files(GKeyFile *config)
{
gint npage;
gchar *tmp;
gchar entry[16];
guint i = 0, j = 0, max;
GeanyDocument *doc;
npage = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
g_key_file_set_integer(config, "files", "current_page", npage);
/* store the filenames in the n... | false | false | false | false | false | 0 |
mpd_qlogb(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
uint32_t *status)
{
if (mpd_isspecial(a)) {
if (mpd_qcheck_nan(result, a, ctx, status)) {
return;
}
mpd_setspecial(result, MPD_POS, MPD_INF);
}
else if (mpd_iszerocoeff(a)) {
mpd_setspeci... | false | false | false | false | false | 0 |
glade_fixed_child_event (GladeWidget *gwidget,
GdkEvent *event,
GladeFixed *fixed)
{
GtkWidget *event_widget;
/* Get the basic event info... */
gdk_window_get_user_data (((GdkEventAny *)event)->window, (gpointer)&event_widget);
/* Skip all this choosyness if we're already in a drag/resize
*/
if (f... | false | false | false | false | false | 0 |
__open_sfil(void)
{
again:
/* if not first time, close previous file */
if (__visp->vi_s != NULL)
{ __my_fclose(__visp->vi_s); __visp->vi_s = NULL; }
__cur_fnam = __in_fils[__cur_infi];
if ((__in_s = __tilde_fopen(__cur_fnam, "r")) == NULL)
{
__pv_err(700, "cannot open Verilog input file %s - skipped", __cur... | false | false | false | false | false | 0 |
loop_step() {
char string[65536];
// read a line
get(string,65536);
// parse
if (false) {
} else if (string_start_with(string,"debug ")) {
// dummy
} else if (string_start_with(string,"go ")) {
if (!Searching && !Delay) {
init();
parse_go(string);
} else... | false | false | false | false | false | 0 |
GetFactsArgument(
void *theEnv,
int whichOne,
int argumentCount)
{
long int factIndex;
DATA_OBJECT theValue;
if (whichOne > argumentCount) return(UNSPECIFIED);
if (EnvArgTypeCheck(theEnv,"facts",whichOne,INTEGER,&theValue) == FALSE) return(INVALID);
factIndex = DOToLong(theValue);
if (fact... | false | false | false | false | false | 0 |
sq_puthere(squeue_t *sq, gnet_search_t sh, pmsg_t *mb, query_hashvec_t *qhv)
{
smsg_t *sb;
g_assert(sq);
g_assert(mb);
if (sqh_exists(sq, sh)) {
pmsg_free(mb);
if (qhv)
qhvec_free(qhv);
return; /* Search already in queue */
}
sb = smsg_alloc(sh, mb, qhv);
sqh_put(sq, sh);
sq->searches = g_list... | false | false | false | false | false | 0 |
VasySimulateIntegerSimul( SimulExpr )
vasysimul *SimulExpr;
{
char *SimulValue;
int Width;
int Position;
long Value;
if ( IsVasyDebugLevel2() )
{
VasyPrintf( stdout, " --> VasySimulateIntegerSimul\n" );
VasySimulateViewSimul( SimulExpr );
}
SimulValue = SimulExpr->VALUE;
Width ... | false | false | false | false | false | 0 |
setup_formatted_log_time(void)
{
struct timeval tv;
pg_time_t stamp_time;
pg_tz *tz;
char msbuf[8];
gettimeofday(&tv, NULL);
stamp_time = (pg_time_t) tv.tv_sec;
/*
* Normally we print log timestamps in log_timezone, but during startup we
* could get here before that's set. If so, fall back to gmt_timez... | false | false | false | false | false | 0 |
arglex_compare(const char *formal, const char *actual)
{
char fc;
char ac;
int result;
for (;;)
{
ac = *actual++;
if (isupper((unsigned char)ac))
ac = tolower((unsigned char)ac);
fc = *formal++;
switch (fc)
{
... | false | false | false | false | false | 0 |
gres_plugin_step_state_unpack(List *gres_list, Buf buffer,
uint32_t job_id, uint32_t step_id,
uint16_t protocol_version)
{
int i, rc;
uint32_t magic, plugin_id;
uint16_t rec_cnt;
uint8_t has_file;
gres_state_t *gres_ptr;
gres_step_state_t *gres_step_ptr = NULL;
safe_unpack16(&rec_cnt, buffer);
if (... | false | false | false | true | false | 1 |
delete_speller(Speller * m)
{
SpellerLtHandle h = ((Speller *)(m))->lt_handle();
delete m;
if (h != 0) free_lt_handle(h);
}
} | false | false | false | false | false | 0 |
matchtoken(int token)
{
cell val;
char *str;
int tok;
tok = lex(&val, &str);
if (tok == token || (token == tTERM && (tok == ';' || tok == tENDEXPR)))
{
return 1;
}
else if (!sc_needsemicolon && token == tTERM && (_lexnewline || !freading))
... | false | false | false | false | false | 0 |
as3935_read(struct as3935_state *st, unsigned int reg, int *val)
{
u8 cmd;
int ret;
cmd = (AS3935_READ_DATA | AS3935_ADDRESS(reg)) >> 8;
ret = spi_w8r8(st->spi, cmd);
if (ret < 0)
return ret;
*val = ret;
return 0;
} | 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.