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 |
|---|---|---|---|---|---|---|
__ast_change_name_nolink(struct ast_channel *chan, const char *newname)
{
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when the name of a channel is changed.</synopsis>
</managerEventInstance>
***/
ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n... | false | false | false | false | false | 0 |
load(const std::string &name) {
//Note: assumes screen 0 for now, changes on draw if needed
Display *disp = App::instance()->display();
XftFont *newxftfont = XftFontOpenXlfd(disp, 0, name.c_str());
if (newxftfont == 0) {
newxftfont = XftFontOpenName(disp, 0, name.c_str());
if (newxftfo... | false | false | false | false | false | 0 |
getTemplateDeclarations(Token *tokens, bool &codeWithTemplates)
{
std::list<Token *> templates;
for (Token *tok = tokens; tok; tok = tok->next()) {
// TODO: handle namespaces. Right now we don't instantiate templates that are defined in namespaces.
if (Token::Match(tok, "namespace %type% {"))
... | false | false | false | false | false | 0 |
i40e_pf_get_default_tc(struct i40e_pf *pf)
{
u8 enabled_tc = pf->hw.func_caps.enabled_tcmap;
u8 i = 0;
if (!enabled_tc)
return 0x1; /* TC0 */
/* Find the first enabled TC */
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
if (enabled_tc & BIT(i))
break;
}
return BIT(i);
} | false | false | false | false | false | 0 |
calcHash(wchar_t *name)
{
unsigned long hash;
int i;
wchar_t c;
hash = 0;
i = 0;
while(*name) {
/* rotate it */
hash = rol(hash,5); /* a shift of 5 makes sure we spread quickly
* over the whole width, moreover, 5 is
* prime with 32, which makes sure that
* successive letters cannot... | false | false | false | false | false | 0 |
rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
{
struct drvextra_cmd_parm *pdrvextra_cmd;
if (!pbuf)
return H2C_PARAMETERS_ERROR;
pdrvextra_cmd = (struct drvextra_cmd_parm *)pbuf;
switch (pdrvextra_cmd->ec_id) {
case DYNAMIC_CHK_WK_CID:
dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, ... | false | false | false | false | false | 0 |
getSonarRange(int num) const
{
std::map<int, ArSensorReading *>::const_iterator it;
if ((it = mySonars.find(num)) != mySonars.end())
return (*it).second->getRange();
else
return -1;
} | false | false | false | false | false | 0 |
Java_ncsa_hdf_hdf5lib_H5_H5Fget_1mdc_1size
(JNIEnv *env, jclass cls, jint file_id, jlongArray metadata_cache)
{
herr_t ret_val = -1;
jint size = 0;
jlong *metadata_cache_ptr;
size_t max_size=0, min_clean_size=0, cur_size=0;
int cur_num_entries=0;
jboolean isCopy;
if ( metadata_cache == NU... | false | false | false | false | false | 0 |
test(char *URL)
{
CURLcode res;
CURL *curl;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
if ((curl = curl_easy_init()) == NULL) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
retu... | false | false | false | false | false | 0 |
set_files(
int argc,
char ** argv,
char ** in_pp,
char ** out_pp
)
/*
* Set input and/or output files.
*/
{
char * cp;
if (*in_pp == NULL) { /* Input file */
cp = argv[ mcpp_optind++];
#if SYS_FAMILY == SYS_WIN
cp = bsl2sl( cp);
#endif
... | false | false | false | false | false | 0 |
r_exception1(struct SN_env * z) {
int among_var;
z->bra = z->c; /* [, line 170 */
if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((42750482 >> (z->p[z->c + 2] & 0x1f)) & 1)) return 0;
among_var = find_among(z, a_10, 18); /* substring, line 170 */
if (!(among_var)) return 0;
z->ket = z->c; ... | false | false | false | false | false | 0 |
save_image_pointer(vm_obj_id_t obj_id, const char *ptr,
size_t siz)
{
vm_image_ptr *slot;
/* allocate a new page if we're out of slots on the current page */
if (image_ptr_head_ == 0)
{
/* no pages yet - allocate the first page */
image_... | false | false | false | true | false | 1 |
entryOffset(const QString& mimeTypeName)
{
if (!sycocaDict())
return -1; // Error!
assert (!KSycoca::self()->isBuilding());
const int offset = sycocaDict()->find_string(mimeTypeName);
return offset;
} | false | false | false | false | false | 0 |
ComputeInteractionState(int vtkNotUsed(X), int vtkNotUsed(Y), int vtkNotUsed(modify))
{
if (this->Point1Representation == NULL || this->Point2Representation == NULL)
{
this->InteractionState = vtkDistanceRepresentation::Outside;
return this->InteractionState;
}
int h1State = this->Point1Representat... | false | false | false | false | false | 0 |
addSymbol(Attribute name, const Symbol &symbol)
{
assert(name.isSymbolic());
iSymbols[name.index()] = symbol;
} | false | false | false | false | false | 0 |
FlocaleGetFullNameOfFontStruct(Display *dpy, XFontStruct *font)
{
char *full_name = NULL;
unsigned long value;
if (XGetFontProperty(font, XA_FONT, &value))
{
full_name = XGetAtomName(dpy, value);
}
return full_name;
} | false | false | false | false | false | 0 |
get_session_marker( size_t *rlen )
{
static byte marker[SIZEOF_UNSIGNED_LONG*2];
static int initialized;
if ( !initialized ) {
volatile ulong aa, bb; /* we really want the uninitialized value */
ulong a, b;
initialized = 1;
/* also this marker is guessable it is not easy to... | false | false | false | false | false | 0 |
add_capabilities(struct tdb_context *tdb, size_t num, char *summary)
{
tdb_off_t off, next;
const struct tdb_capability *cap;
size_t count = 0;
/* Append to summary. */
summary += strlen(summary);
off = tdb_read_off(tdb, offsetof(struct tdb_header, capabilities));
if (TDB_OFF_IS_ERR(off))
return;
/* Walk c... | false | false | false | false | true | 1 |
IsBetterFallthrough(MachineBasicBlock *MBB1,
MachineBasicBlock *MBB2) {
// Right now, we use a simple heuristic. If MBB2 ends with a call, and
// MBB1 doesn't, we prefer to fall through into MBB1. This allows us to
// optimize branches that branch to either a return block or an a... | false | false | false | false | false | 0 |
tps_init(void)
{
u32 tries = 3;
int status = -ENODEV;
printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
/* some boards have startup glitches */
while (tries--) {
status = i2c_add_driver(&tps65010_driver);
if (the_tps)
break;
i2c_del_driver(&tps65010_driver);
if (!tries) {
printk(KE... | false | false | false | false | false | 0 |
matchInetAddrRHS(const InetAddr *inet_addr_obj,
const InetAddr *rhs_obj_addr)
{
if ((*inet_addr_obj) == (*rhs_obj_addr)) return 0;
if ((*inet_addr_obj) < (*rhs_obj_addr)) return -1;
return 1;
} | false | false | false | false | false | 0 |
SendNextPendingRequest(void)
{
// Send a pending request
pendingRequestsMutex.Lock();
if (pendingRequests.Size()>0)
{
Request *pendingRequest = pendingRequests.Peek();
pendingRequestsMutex.Unlock();
if (pendingRequest->ipVersion!=6)
{
tcpInterface->Connect(pendingRequest->host.C_String(), pen... | false | false | false | false | false | 0 |
curl_multi_assign(CURLM *multi_handle,
curl_socket_t s, void *hashp)
{
struct Curl_sh_entry *there = NULL;
struct Curl_multi *multi = (struct Curl_multi *)multi_handle;
if(s != CURL_SOCKET_BAD)
there = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(curl_socket_t));
if(!ther... | false | false | false | false | false | 0 |
free_lpd(struct log_file_pd_t *lpd)
{
struct log_msg_t *msg;
spin_lock(&lpd->lf.lock);
list_del(&lpd->pd.entry);
lpd->lf.need_free = 1;
if (lpd->lf.queued)
spin_unlock(&lpd->lf.lock);
else {
while (!list_empty(&lpd->lf.msgs)) {
msg = list_entry(lpd->lf.msgs.next, typeof(*msg), entry);
list_del(&msg->en... | false | false | false | false | false | 0 |
PutEvent ( const MIDIDeltaTimedBigMessage &msg )
{
const MIDIBigMessage msg2( msg );
MIDITimedBigMessage m = msg2;
MIDIClockTime t = msg.GetDeltaTime() + GetLastEventTime();
m.SetTime( t );
return PutEvent( m );
} | false | false | false | false | false | 0 |
tb_free_invalid_tunnels(struct tb *tb)
{
struct tb_pci_tunnel *tunnel;
struct tb_pci_tunnel *n;
list_for_each_entry_safe(tunnel, n, &tb->tunnel_list, list)
{
if (tb_pci_is_invalid(tunnel)) {
tb_pci_deactivate(tunnel);
tb_pci_free(tunnel);
}
}
} | false | false | false | false | false | 0 |
icalrecur_iterator_sizeof_byarray(short* byarray)
{
int array_itr;
for(array_itr = 0;
byarray[array_itr] != ICAL_RECURRENCE_ARRAY_MAX;
array_itr++){
}
return array_itr;
} | false | false | false | false | false | 0 |
save_image(struct swap_map_handle *handle,
struct snapshot_handle *snapshot,
unsigned int nr_to_write)
{
unsigned int m;
int ret;
int nr_pages;
int err2;
struct hib_bio_batch hb;
ktime_t start;
ktime_t stop;
hib_init_batch(&hb);
printk(KERN_INFO "PM: Saving image d... | true | true | false | false | false | 1 |
cmdline_help(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--help")) {
printf( "\n"
"%s floorplan\n"
"\n"
"Usage: %s [--part=xc6slx9]\n"
" %*s [--package=tqg144|ftg256]\n"
" %*s [--help]\n",
*argv, *argv, (int) strlen(*argv), "",
(int) ... | false | false | false | false | false | 0 |
elm_map_overlays_show(Eina_List *overlays)
{
#ifdef HAVE_ELEMENTARY_ECORE_CON
Delayed_Data *data;
Elm_Map_Overlay *overlay;
EINA_SAFETY_ON_NULL_RETURN(overlays);
EINA_SAFETY_ON_FALSE_RETURN(eina_list_count(overlays));
overlay = eina_list_data_get(overlays);
data = ELM_NEW(Delayed_Data);
data->fu... | false | false | false | false | false | 0 |
find_resource(const void *story_file, int32 story_len,
const char *resname, resinfo *info)
{
/* if there's no file, there's no resource */
if (story_file == 0)
return FALSE;
/* check for tads 2 */
if (tads_match_sig(story_file, story_len, T2_SIGNATURE))
{
... | false | false | false | false | false | 0 |
stmt_fun_arg_cmp(const Lsymtab *symt, const Token *d_arg, const Token *a_arg)
#else /* K&R style */
stmt_fun_arg_cmp(symt,d_arg,a_arg)
Lsymtab *symt;
Token *d_arg,*a_arg;
#endif /* HAVE_STDC */
{
int d_class = class_VAR,
a_class = storage_class_of(a_arg->TOK_type),
d_type = datatype_of(d_arg->TO... | false | false | false | false | false | 0 |
xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
unsigned int slot_id, unsigned int ep_index,
unsigned int stream_id, struct xhci_td *cur_td,
struct xhci_dequeue_state *state)
{
struct xhci_virt_device *dev = xhci->devs[slot_id];
struct xhci_virt_ep *ep = &dev->eps[ep_index];
struct xhci_ring *ep_ring;
stru... | false | false | false | false | false | 0 |
on_configure_button_clicked (GtkButton *button, gpointer data)
{
GString *command_line;
GtkComboBox *combo;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *dialog;
Netinfo *info;
GError *error;
gchar *nic;
g_return_if_fail (data != NULL);
info = (Netinfo *) data;
combo = GTK_COMBO_BOX (info->combo);
mod... | false | false | false | false | false | 0 |
CreateIconStyle(double scale) {
KmlFactory* kml_factory = KmlFactory::GetFactory();
IconStyleIconPtr icon = kml_factory->CreateIconStyleIcon();
icon->set_href(kDotIcon);
IconStylePtr icon_style = kml_factory->CreateIconStyle();
icon_style->set_icon(icon);
icon_style->set_scale(scale);
return icon_style;
} | false | false | false | false | false | 0 |
ei_encode_ulonglong(char *buf, int *index, EI_ULONGLONG p)
{
char *s = buf + *index;
char *s0 = s;
if (p < 256) {
if (!buf) s += 2;
else {
put8(s,ERL_SMALL_INTEGER_EXT);
put8(s,(p & 0xff));
}
} else if (p <= ERL_MAX) {
if (!buf) s += 5;
else {
put8(s,ERL_INTEGER_EXT);
put32be(s... | false | false | false | false | false | 0 |
remapPlatformDependentCodepage(const char *locale, const char *name) {
if (locale != NULL && *locale == 0) {
/* Make sure that an empty locale is handled the same way. */
locale = NULL;
}
if (name == NULL) {
return NULL;
}
#if defined(U_AIX)
if (uprv_strcmp(name, "IBM-943") =... | false | false | false | false | false | 0 |
publish_store_expired(cqueue_t *unused_cq, void *obj)
{
publish_t *pb = obj;
(void) unused_cq;
publish_check(pb);
pb->expire_ev = NULL;
if (GNET_PROPERTY(dht_publish_debug))
g_debug("DHT PUBLISH[%s] %s publish of %s expired: "
"published to %d/%d root%s",
nid_to_string(&pb->pid), publish_type_to_string(... | false | false | false | false | false | 0 |
_lgl_db_register_template_internal (const lglTemplate *template)
{
lglTemplate *template_copy;
if (!lgl_db_does_template_exist (template->brand, template->part))
{
template_copy = lgl_template_dup (template);
model->templates = g_list_append (model->templates, ... | false | false | false | false | false | 0 |
can_move_to(game *g, int x, int y)
{
if ((g->m.move_cost(x, y) > 0 || g->m.has_flag(bashable, x, y)) &&
rl_dist(posx, posy, x, y) <= 1)
return true;
return false;
} | false | false | false | false | false | 0 |
evas_textblock_cursor_pos_set(Evas_Textblock_Cursor *cur, int _pos)
{
Evas_Object_Textblock *o;
Evas_Object_Textblock_Node_Text *n;
size_t pos;
if (!cur) return;
o = (Evas_Object_Textblock *)(cur->obj->object_data);
if (_pos < 0)
{
pos = 0;
}
else
{
pos = (size_t) _... | false | false | false | false | false | 0 |
start()
{
if (m_pool_size == 0) {
LOG_ERROR("pool size must be set!");
return -1;
}
if (m_pool_state == STARTED) {
return 0;
}
m_pool_state = STARTED;
int ret = -1;
for (int i = 0; i < m_pool_size; i++) {
pthread_t tid;
ret = pthread_create(&tid, NULL,... | false | false | false | false | false | 0 |
nexus_drive_is_strength_aware(ivl_nexus_ptr_t nptr)
{
ivl_net_logic_t logic;
if (ivl_nexus_ptr_drive0(nptr) != IVL_DR_STRONG)
return 1;
if (ivl_nexus_ptr_drive1(nptr) != IVL_DR_STRONG)
return 1;
logic = ivl_nexus_ptr_log(nptr);
if (logic != 0) {
/* These logic gates are ... | false | false | false | false | false | 0 |
BitMapEditor( BitType& value, const ASCString& title, const vector<ASCString>& names ) : ASC_PG_Dialog(NULL, PG_Rect(-1,-1,300,500), title ), reference(value)
{
propertyEditor = new ASC_PropertyEditor( this, PG_Rect( 10, GetTitlebarHeight(), Width() - 20, Height() - GetTitlebarHeight() - 50 ), "PropertyEditor", 70 )... | false | false | false | false | false | 0 |
case_diffs(register const char *s,register const char *t)
{
register unsigned char x;
register unsigned char y;
for (;;) {
x = *s++ - 'A';
if (x <= 'Z' - 'A') x += 'a'; else x += 'A';
y = *t++ - 'A';
if (y <= 'Z' - 'A') y += 'a'; else y += 'A';
if (x != y) break;
if (!x) break;
}
retu... | false | false | false | false | false | 0 |
kone_get_weight(struct usb_device *usb_dev, int *result)
{
int retval;
uint8_t data;
retval = kone_receive(usb_dev, kone_command_weight, &data, 1);
if (retval)
return retval;
*result = (int)data;
return 0;
} | false | false | false | false | false | 0 |
dummy_init_module(void)
{
int i, err = 0;
rtnl_lock();
err = __rtnl_link_register(&dummy_link_ops);
if (err < 0)
goto out;
for (i = 0; i < numdummies && !err; i++) {
err = dummy_init_one();
cond_resched();
}
if (err < 0)
__rtnl_link_unregister(&dummy_link_ops);
out:
rtnl_unlock();
return err;
} | false | false | false | false | false | 0 |
convert_option_specifier(struct option_specifier_s * n) {
struct filter * res = NULL;
eprint("converting option specifier\n");
switch (n->type) {
case TOK_LOCAL:
res = new_filter_rtype(LOCALONLY);
break;
case TOK_FORWARD:
res = new_filter_rtype(ROUTEDONLY);
break;
case TOK_ONEWAY:
... | false | false | false | false | false | 0 |
free_data_buffs(dataset * ds, int typ)
{
int nsiz = 1, i, siz, freed = 0;
for (i = 0; i < ds->ndims; i++) {
nsiz *= ds->dims[i];
}
if (typ & ATTY_NULL) {
if (ds->databuff.nm) {
siz = BM_get_map_size(ds->databuff.nm);
BM_destroy(ds->databuff.nm);
ds->databuff.nm = NULL;
freed += s... | false | false | false | false | false | 0 |
__ecereMethod___ecereNameSpace__ecere__com__BuiltInContainer_RemoveAll(struct __ecereNameSpace__ecere__com__BuiltInContainer * this)
{
struct __ecereNameSpace__ecere__com__IteratorPointer * i;
for(i = ((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__BuiltInContainer *))... | false | false | false | false | false | 0 |
dw2_output_call_site_table (int cs_format, int section)
{
int n = vec_safe_length (crtl->eh.call_site_record_v[section]);
int i;
const char *begin;
if (section == 0)
begin = current_function_func_begin_label;
else if (first_function_block_is_cold)
begin = crtl->subsections.hot_section_label;
else
... | false | false | false | false | false | 0 |
paint (TestState *state)
{
CoglColor bg;
int i;
cogl_set_source_color4ub (255, 255, 255, 255);
/* We push the third framebuffer first so that later we can switch
back to it by popping to test that that works */
cogl_push_framebuffer (state->fbo[2]);
cogl_push_framebuffer (state->fbo[0]);
cogl_rect... | false | false | false | false | false | 0 |
nautilus_bookmark_list_can_bookmark_location (NautilusBookmarkList *list,
GFile *location)
{
NautilusBookmark *bookmark;
gboolean is_builtin;
if (nautilus_bookmark_list_item_with_location (list, location, NULL)) {
return FALSE;
}
if (nautilus_is_home_directory (location)) {
return F... | false | false | false | false | false | 0 |
open_dll (const ACE_TCHAR *dll_name,
int open_mode,
ACE_SHLIB_HANDLE handle)
{
ACE_TRACE ("ACE_DLL_Manager::open_dll");
ACE_DLL_Handle *temp_handle = 0;
ACE_DLL_Handle *dll_handle = 0;
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, ... | false | false | false | false | false | 0 |
err (int errnum, int level, Tobj co, int ci) {
char *s;
int si, i;
if (level > Eerrlevel || !errdo)
return;
s = "";
fprintf (stderr, "runtime error: %s\n", errnam[errnum]);
if (!co)
return;
if (Estackdepth < 1)
return;
if (!sinfop[(si = sinfoi - 1)].fco && si > 0... | false | false | false | false | false | 0 |
operator/ (float fScalar) const {
Vector4 kQuot;
if ( fScalar != 0.0 ) {
float fInvScalar = 1.0f / fScalar;
kQuot.x = fInvScalar * x;
kQuot.y = fInvScalar * y;
kQuot.z = fInvScalar * z;
kQuot.w = fInvScalar * w;
return kQuot;
} else {
return Vector4::inf();... | false | false | false | false | false | 0 |
rd_quests(u32b version)
{
int i;
u16b tmp16u;
/* Load the Quests */
rd_u16b(&tmp16u);
/* Incompatible save files */
if (tmp16u > MAX_Q_IDX)
{
note(format("Too many (%u) quests!", tmp16u));
return (-1);
}
/* Load the Quests */
for (i = 0; i < tmp16u; i++)
{
byte tmp8u;
rd_byte(&tmp8u);
q_li... | false | false | false | false | false | 0 |
fetch_tuples( HV * ret, struct tp * rep ) {
AV * tuples = newAV();
hv_store( ret, "tuples", 6, newRV_noinc( ( SV * ) tuples ), 0 );
int code;
while ( (code = tp_next(rep)) ) {
if (code < 0)
return code;
AV * t = newAV();
av_push( tuples, newRV_noinc( ( SV * ) t ) );
while((code = tp_nextfield(rep))) ... | false | false | false | false | false | 0 |
GetSeriesHelper(void)
{
itkLegacyBodyMacro(GDCMSeriesFileNames::GetSeriesHelper, 4.9);
return m_SerieHelper;
} | false | false | false | false | false | 0 |
direct_log_destroy( DirectLog *log )
{
D_MAGIC_ASSERT( log, DirectLog );
D_ASSERT( &fallback_log != log );
if (log == default_log)
default_log = NULL;
close( log->fd );
D_MAGIC_CLEAR( log );
D_FREE( log );
return DR_OK;
} | false | false | false | false | false | 0 |
sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
{
struct ata_port *ap = link->ap;
void __iomem *base = ap->ioaddr.scr_addr + link->pmp * 0x10;
if (sc_reg > SCR_CONTROL)
return -EINVAL;
if (ap->flags & SIS_FLAG_CFGSCR)
return sis_scr_cfg_read(link, sc_reg, val);
*val = ioread32(base + sc_r... | false | false | false | false | false | 0 |
index_buffer_terminate(void *h)
{
index_buffer_handle *handle = (index_buffer_handle *) h;
index_buffer_bin *bin = NULL;
size_t i = 0;
PR_ASSERT(h);
/* Free all the buffers */
/* First walk down the bins, freeing the IDLs and the bins they're in */
for (i = 0; i < handle->buffer_size; i++) {
bin = &(handle->b... | false | false | false | false | false | 0 |
seqGcgMsfReadseq(const AjPStr rdline, const AjPTable msftable)
{
SeqPMsfItem msfitem;
AjPStr token = NULL;
AjPStr seqstr = NULL;
AjBool status;
status = ajStrExtractWord(rdline, &seqstr, &token);
if(!status)
{
ajStrDel(&token);
ajStrDel(&seqstr);
return ajFa... | false | false | false | false | false | 0 |
_nss_files_setaliasent (void)
{
enum nss_status status;
__libc_lock_lock (lock);
status = internal_setent (&stream);
__libc_lock_unlock (lock);
return status;
} | false | false | false | false | true | 1 |
dithermap(int levels, double gamma, int rgbmap[][3])
{
double N;
int i;
int levelsq, levelsc;
int gammamap[256];
for ( i = 0; i < 256; i++ )
gammamap[i] = (int)(0.5 + 255 * pow( i / 255.0, 1.0/gamma ));
levelsq = levels*levels; /* squared */
levelsc = levels*levelsq; /* and cubed */
... | false | false | false | false | false | 0 |
statAfterCompact(int myGeneration) {
int i;
for(i = 0;i<=myGeneration;i++){
stats[i] -= myAllocators[i]->getFreeSize();
if(stats[i] != 0){
fprintf(stderr,"ERROR(Line %d):compact incosistency %d bytes for gen %d\n",
gLineInTrace, stats[i],i);
}
}
} | false | false | false | false | true | 1 |
thread_setup() {
pd_locks = new omni_tracedmutex[CRYPTO_num_locks()];
openssl_locks = pd_locks;
CRYPTO_set_locking_callback(sslContext_locking_callback);
#ifndef __WIN32__
CRYPTO_set_id_callback(sslContext_thread_id);
#endif
} | false | false | false | false | false | 0 |
cond_evaluate_expr(struct policydb *p, struct cond_expr *expr)
{
struct cond_expr *cur;
int s[COND_EXPR_MAXDEPTH];
int sp = -1;
for (cur = expr; cur; cur = cur->next) {
switch (cur->expr_type) {
case COND_BOOL:
if (sp == (COND_EXPR_MAXDEPTH - 1))
return -1;
sp++;
s[sp] = p->bool_val_to_struct[cur... | false | false | false | false | true | 1 |
xgetpass(int pfd, const char *prompt) {
char *pass;
int buflen, i;
if (pfd < 0) /* terminal */
return getpass(prompt);
pass = NULL;
buflen = 0;
for (i=0; ; i++) {
if (i >= buflen-1) {
/* we're running out of space in the buffer.
* Make it bigger: */
char *tmppass = pass;
buflen += 128;... | false | false | false | false | false | 0 |
SetItem( wxListItem &item )
{
long id = item.m_itemId;
wxCHECK_RET( id >= 0 && (size_t)id < GetItemCount(),
_T("invalid item index in SetItem") );
if ( !IsVirtual() )
{
wxListLineData *line = GetLine((size_t)id);
line->SetItem( item.m_col, item );
// Set item s... | false | false | false | false | false | 0 |
git_futils_mkpath2file(const char *file_path)
{
const int mode = 0755; /* or 0777 ? */
int error = GIT_SUCCESS;
char target_folder_path[GIT_PATH_MAX];
error = git_path_dirname_r(target_folder_path, sizeof(target_folder_path), file_path);
if (error < GIT_SUCCESS)
return git__throw(GIT_EINVALIDPATH, "Failed to re... | false | false | false | false | false | 0 |
SkipToChar(const wxChar& ch)
{
// skip everything until we find ch
while (CurrentChar() != ch && MoveToNextChar()) // don't check EOF when MoveToNextChar already does
;
return NotEOF();
} | false | false | false | false | false | 0 |
mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
{
int64_t duration = av_rescale_rnd(track->trackDuration, globalTimescale, track->timescale, AV_ROUND_UP);
int version = duration < INT32_MAX ? 0 : 1;
(version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */
put_tag(pb, "tkhd... | false | false | false | false | false | 0 |
theft_bloom_mark(struct theft_bloom *b, uint8_t *data, size_t data_size) {
uint64_t hash = theft_hash_onepass(data, data_size);
uint8_t bc = b->bit_count;
uint64_t mask = (1 << bc) - 1;
/* Use HASH_COUNT distinct slices of MASK bits as hashes for the bloom filter. */
int bit_inc = (64 - bc) / HASH_... | false | false | false | false | false | 0 |
drawImage(QScriptContext *ctx, QScriptEngine *eng)
{
DECLARE_SELF(QPainter, drawImage);
if (ctx->argumentCount() == 2) {
// target, image
QScriptValue arg0 = ctx->argument(0);
QImage image = qscriptvalue_cast<QImage>(ctx->argument(1));
if (arg0.property("width").isValid()) {
... | false | false | false | false | false | 0 |
g_string_append_encoded (GString *string,
const char *encoded,
const char *encoded_end,
const char *reserved_chars_allowed)
{
char c;
static const gchar hex[16] = "0123456789ABCDEF";
if (encoded_end == NULL)
encoded_end = encoded + strlen (encoded);
while (encoded < encoded_end)
{
... | false | false | false | false | false | 0 |
camel_service_connect (CamelService *service,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
ConnectionOp *op;
CamelServiceClass *class;
GSimpleAsyncResult *simple;
g_return... | false | false | false | true | false | 1 |
zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
{
int node_id;
int ret;
/*
* Zone reclaim reclaims unmapped file backed pages and
* slab pages if we are over the defined limits.
*
* A small portion of unmapped file backed pages is needed for
* file I/O otherwise pages read by file I/O ... | false | false | false | false | false | 0 |
cy_unthrottle(struct tty_struct *tty)
{
struct cyclades_port *info = tty->driver_data;
struct cyclades_card *card;
unsigned long flags;
#ifdef CY_DEBUG_THROTTLE
printk(KERN_DEBUG "cyc:unthrottle %s: %ld...ttyC%d\n",
tty_name(tty), tty_chars_in_buffer(tty), info->line);
#endif
if (serial_paranoia_check(info, tt... | false | false | false | false | false | 0 |
selCreateFromColorPix(PIX *pixs,
char *selname)
{
PIXCMAP *cmap;
SEL *sel;
l_int32 hascolor, hasorigin, nohits;
l_int32 w, h, d, i, j, red, green, blue;
l_uint32 pixval;
PROCNAME("selCreateFromColorPix");
if (!pixs)
return (SEL *)ERROR_PTR("pixs not defined", procNa... | false | false | false | false | false | 0 |
list_rules()
{
int i;
if (!(replace->flags & LIST_X))
printf("Bridge table: %s\n", table->name);
if (replace->selected_chain != -1)
list_em(ebt_to_chain(replace));
else {
/* Create new chains and rename standard chains when necessary */
if (replace->flags & LIST_X && replace->num_chains > NF_BR_NUMHOOKS) {... | false | false | false | false | false | 0 |
slurmdb_unpack_account_cond(void **object, uint16_t rpc_version,
Buf buffer)
{
uint32_t uint32_tmp;
int i;
uint32_t count;
slurmdb_account_cond_t *object_ptr =
xmalloc(sizeof(slurmdb_account_cond_t));
char *tmp_info = NULL;
*object = object_ptr;
if (rpc_version >= 3) {
if(slurmdb_unpack_associat... | false | false | false | false | false | 0 |
gt_custom_track_get_title(GtCustomTrack *ctrack)
{
gt_assert(ctrack && ctrack->c_class);
return ctrack->c_class->get_title(ctrack);
} | false | false | false | false | false | 0 |
bcm5600_insert_arl_entry(struct nm_16esw_data *d)
{
struct bcm5600_table *table = d->t_arl;
m_uint32_t *entry,mask;
int i,index;
mask = BCM5600_ARL_VLAN_TAG_MASK | BCM5600_ARL_MAC_MSB_MASK;
for(i=0;i<d->arl_cnt[0]-1;i++) {
entry = bcm5600_table_get_entry(d,table,i);
/* If entry already ... | false | false | false | false | false | 0 |
ncdimdef(cdfid, name, size)
int cdfid ;
const char *name ;
long size ;
{
NC *handle ;
NC_dim *dim[1] ;
NC_dim **dp ;
unsigned ii ;
size_t len ;
cdf_routine_name = "ncdimdef" ;
if( !NC_indefine(cdfid,TRUE) )
return(-1) ;
handle = NC_check_id(cdfid) ;
if(handle == NULL)
return(-1) ;
if(size < 0) /* NC_U... | false | false | false | false | false | 0 |
prt_add_resource(resource)
struct prt_ps_resource_S *resource;
{
FILE* fd_resource;
char_u resource_buffer[512];
size_t bytes_read;
fd_resource = mch_fopen((char *)resource->filename, READBIN);
if (fd_resource == NULL)
{
EMSG2(_("E456: Can't open file \"%s\""), resource->filename);
return... | false | false | false | false | false | 0 |
micro_hash_remove (MicroHash *hash_table, gpointer key)
{
int N = hash_table->num_elements;
guint bucket;
if (N == 0)
return;
if (N == 1) {
if (hash_table->u.one != key)
return;
hash_table->u.one = NULL;
hash_table->num_elements--;
return;
}
if (N <= MICRO_HASH_FEW) {
int i;
for (i = 0; i < N... | false | false | false | false | false | 0 |
gregorio_add_character (gregorio_character ** current_character,
grewchar wcharacter)
{
gregorio_character *element =
(gregorio_character *) malloc (sizeof (gregorio_character));
if (!element)
{
gregorio_message (_("error in memory allocation"),
"gregorio_add_character", FATAL_ERROR, 0);
... | false | false | false | false | false | 0 |
gs_imager_state_initialize(gs_imager_state * pis, gs_memory_t * mem)
{
int i;
pis->memory = mem;
pis->client_data = 0;
pis->trans_device = 0;
/* Color rendering state */
pis->halftone = 0;
{
int i;
for (i = 0; i < gs_color_select_count; ++i)
pis->screen_phase[i].... | false | false | false | false | false | 0 |
search_illegal(char *str)
{
int i;
if (str != NULL) {
for (i = 0; i < strlen(str); i++)
if (str[i] == '@')
return U_FORWARD;
else if (!isalpha(str[i]) && !isdigit(str[i]) && (str[i] != '.') &&
(str[i] != '_') && (str[i] != '-') && (str[i] != ',') &&
(str[i] != '?') && (str[i] != '*') && (str[i... | false | false | false | false | false | 0 |
got_auth (RestXmlNode *node, BishoPaneFlickr *pane)
{
RestXmlNode *user;
const char *name;
user = rest_xml_node_find (node, "user");
name = rest_xml_node_get_attr (user, "fullname");
if (name == NULL || name[0] == '\0')
name = rest_xml_node_get_attr (user, "username");
g_free (pane->priv->user_name);
... | false | false | false | false | false | 0 |
test_winsync_plugin_start(Slapi_PBlock *pb)
{
slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
"--> test_winsync_plugin_start -- begin\n");
if( slapi_apib_register(WINSYNC_v3_0_GUID, test_winsync_api_v3) ) {
slapi_log_error( SLAPI_LOG_FATAL, test_winsync_plugin_name,
... | false | false | false | false | false | 0 |
gnc_date_picker_key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
GNCDatePicker *date_picker = GNC_DATE_PICKER (data);
switch (event->keyval)
{
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
g_signal_emit (date_picker, gnc_date_picker_signals[DATE_PICKED], 0);
g_signal_... | false | false | false | false | false | 0 |
draw_box(AVPicture *picture, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_color[3])
{
int i, j;
for (j = 0; (j < height); j++)
for (i = 0; (i < width); i++)
{
SET_PIXEL(picture, yuv_color, (i+x), (y+j));
}
} | false | false | false | false | false | 0 |
btsnoop_write(struct timeval *tv, uint16_t index, uint32_t flags,
const void *data, uint16_t size)
{
struct btsnoop_hdr hdr;
struct btsnoop_pkt pkt;
uint64_t ts;
ssize_t written;
if (!tv)
return;
if (btsnoop_fd < 0)
return;
if (btsnoop_index == 0xffff) {
memcpy(hdr.id, btsnoop_id, sizeof(btsnoop_id... | false | true | false | false | false | 1 |
rrpc_gc_queue(struct work_struct *work)
{
struct rrpc_block_gc *gcb = container_of(work, struct rrpc_block_gc,
ws_gc);
struct rrpc *rrpc = gcb->rrpc;
struct rrpc_block *rblk = gcb->rblk;
struct nvm_lun *lun = rblk->parent->lun;
struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset];
spin_lock(&... | false | false | false | false | false | 0 |
DGNGetLineStyleName(DGNInfo *psDGN, DGNElemMultiPoint *psLine,
char szLineStyle[65] )
{
if (psLine->core.attr_bytes > 0 &&
psLine->core.attr_data[1] == 0x10 &&
psLine->core.attr_data[2] == 0xf9 &&
psLine->core.attr_data[3] == 0x79)
{
#ifdef notdef
for (int... | false | false | false | false | false | 0 |
passiveCmd(void)
{
if (tokenBody[0] == 'E') {
pasv_addr = ctrl_addr;
logDebug("Extended passive requested for family %d", Socket::family(pasv_addr));
pdata = socket(Socket::family(pasv_addr), SOCK_STREAM, 0);
if (pdata >= 0) {
Socket::port(pasv_addr) = 0;
if (!setupPassiveDataSocket(pdata, pasv_addr))... | false | false | false | false | false | 0 |
FixFeatureTestsInRules(GrcFont * pfont)
{
GdlRuleItem::FixFeatureTestsInRules(pfont);
for (size_t iavs = 0; iavs < this->m_vpavs.size(); iavs++)
m_vpavs[iavs]->FixFeatureTestsInRules(pfont);
} | false | false | false | false | false | 0 |
release_socket()
{
// put socket back in the pool
SocketPool &pool = PoolManager::get_pool(m_host, m_port); // TODO: remove the singleton
pool.put(m_fd);
} | 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.