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 |
|---|---|---|---|---|---|---|
fs_rtp_bitrate_adapter_query (GstPad *pad, GstObject *parent, GstQuery *query)
{
FsRtpBitrateAdapter *self = FS_RTP_BITRATE_ADAPTER (parent);
gboolean res;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
{
GstCaps *caps, *filter;
gst_query_parse_caps (query, &filter);
caps = fs_rtp_bitrate_adapter_getcaps (self, pad, filter);
gst_query_set_caps_result (query, caps);
gst_caps_unref (caps);
res = TRUE;
break;
}
default:
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
} | false | false | false | false | false | 0 |
inf_text_default_buffer_buffer_insert_text(InfTextBuffer* buffer,
guint pos,
InfTextChunk* chunk,
InfUser* user)
{
InfTextDefaultBufferPrivate* priv;
priv = INF_TEXT_DEFAULT_BUFFER_PRIVATE(buffer);
inf_text_chunk_insert_chunk(priv->chunk, pos, chunk);
inf_text_buffer_text_inserted(buffer, pos, chunk, user);
if(priv->modified == FALSE)
{
priv->modified = TRUE;
g_object_notify(G_OBJECT(buffer), "modified");
}
} | false | false | false | false | false | 0 |
Devices_UpdateHATABSEntry(char device, UWORD entry_address,
UWORD table_address)
{
UWORD address;
if (entry_address != 0 && MEMORY_dGetByte(entry_address) == device)
return entry_address;
if (MEMORY_dGetByte(HATABS) != 'P' || MEMORY_dGetByte(HATABS + 3) != 'C'
|| MEMORY_dGetByte(HATABS + 6) != 'E' || MEMORY_dGetByte(HATABS + 9) != 'S'
|| MEMORY_dGetByte(HATABS + 12) != 'K')
return entry_address;
for (address = HATABS + 15; address < HATABS + 33; address += 3) {
if (MEMORY_dGetByte(address) == device)
return address;
if (MEMORY_dGetByte(address) == 0) {
MEMORY_dPutByte(address, device);
MEMORY_dPutWord(address + 1, table_address);
return address;
}
}
/* HATABS full */
return entry_address;
} | false | false | false | false | false | 0 |
Ns_IndexFindMultiple(Ns_Index *indexPtr, void *key)
{
void **firstPtrPtr;
void **retPtrPtr;
int i;
int n;
/*
* Find a place in the array that matches the key
*/
firstPtrPtr = (void **) bsearch(key, indexPtr->el, (size_t)indexPtr->n,
sizeof(void *), indexPtr->CmpKeyWithEl);
if (firstPtrPtr == NULL) {
return NULL;
} else {
/*
* Search linearly back to make sure we've got the first one
*/
while (firstPtrPtr != indexPtr->el
&& indexPtr->CmpKeyWithEl(key, firstPtrPtr - 1) == 0) {
firstPtrPtr--;
}
/*
* Search linearly forward to find out how many there are
*/
n = indexPtr->n - (firstPtrPtr - indexPtr->el);
for (i = 1; i < n &&
indexPtr->CmpKeyWithEl(key, firstPtrPtr + i) == 0; i++)
;
/*
* Build array of values to return
*/
retPtrPtr = ns_malloc((i + 1) * sizeof(void *));
memcpy(retPtrPtr, firstPtrPtr, i * sizeof(void *));
retPtrPtr[i] = NULL;
return retPtrPtr;
}
} | false | true | false | false | true | 1 |
showRoutes(const QList<GpxRoute> &routes)
{
QStringList scriptStr;
int i=0;
foreach(const GpxRoute &rt, routes) {
scriptStr << QString("rtes[%1].%2();").arg(i).arg(rt.getVisible()?"show":"hide");
i++;
}
evaluateJS(scriptStr);
} | false | false | false | false | false | 0 |
createProfile( const gchar *pnName, const gchar *pnFile ) {
struct sProfile *psProfile;
psProfile = g_malloc0( sizeof( struct sProfile ) );
if ( psProfile != NULL ) {
psProfile -> pnName = g_strdup( pnName );
if ( pnFile == NULL ) {
gchar *pnTmp = g_strdup_printf( "%s/%s", getProfilesDir(), pnName );
g_mkdir( pnTmp, 0755 );
pnFile = g_build_filename( getProfilesDir(), pnName, "profile.xml", NULL );
g_free( pnTmp );
}
psProfile -> pnFile = g_strdup( pnFile );
LoadPreferences( psProfile );
Debug( KERN_DEBUG, "Adding '%s'\n", pnName );
psProfileList = g_list_prepend( psProfileList, psProfile );
} else {
Debug( KERN_WARNING, "Could not add '%s'\n", pnName );
}
return psProfile;
} | false | false | false | false | false | 0 |
dvdread(unsigned long sector,unsigned char *buf,int N)
{
int x;
if (!map->get(sector))
return 0;
if (dvd->seek(SECTOFS(sector)) != SECTOFS(sector))
return 0;
for (x=1;x < N && map->get(sector+x);) x++;
N = dvd->read(buf,x * 2048) >> 11;
if (N < 0) N = 0;
return N;
} | false | false | false | false | false | 0 |
restore_parse_state(struct parse *cfile) {
struct parse *saved_state;
if (cfile->saved_state == NULL) {
return DHCP_R_NOTYET;
}
saved_state = cfile->saved_state;
memcpy(cfile, saved_state, sizeof(*cfile));
cfile->saved_state = saved_state;
return ISC_R_SUCCESS;
} | false | false | false | false | false | 0 |
sort_string(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
{
gchar *name1, *name2;
gint ret = 0;
gint colnum = GPOINTER_TO_INT(userdata);
gtk_tree_model_get(model, a, colnum, &name1, -1);
gtk_tree_model_get(model, b, colnum, &name2, -1);
if (!name1 || !name2) {
if (!name1 && !name2)
return 0;
if (!name1) {
g_free(name2);
return -1;
}
else {
g_free(name1);
return 1;
}
}
ret = g_utf8_collate(name1, name2);
g_free(name1);
g_free(name2);
return ret;
} | false | false | false | false | false | 0 |
vb2_dc_vaddr(void *buf_priv)
{
struct vb2_dc_buf *buf = buf_priv;
if (!buf->vaddr && buf->db_attach)
buf->vaddr = dma_buf_vmap(buf->db_attach->dmabuf);
return buf->vaddr;
} | false | false | false | false | false | 0 |
operator()(int m, int n)
{
REPORT
int w = lower_val+1; int i = lower_val+n-m;
if (m<=0 || m>nrows_val || n<=0 || n>ncols_val || i<0 || i>=w)
Throw(IndexException(m,n,*this));
return store[w*(m-1)+i];
} | false | false | false | false | false | 0 |
test_core_env__cleanup(void)
{
int i;
char **val;
for (i = 0; i < NUM_VARS; ++i) {
cl_setenv(env_vars[i], env_save[i]);
git__free(env_save[i]);
env_save[i] = NULL;
}
/* these will probably have already been cleaned up, but if a test
* fails, then it's probably good to try and clear out these dirs
*/
for (val = home_values; *val != NULL; val++) {
if (**val != '\0')
(void)p_rmdir(*val);
}
/* reset search paths to default */
reset_global_search_path();
reset_system_search_path();
} | false | false | false | false | false | 0 |
WebPCleanupTransparentArea(WebPPicture* pic) {
int x, y, w, h;
if (pic == NULL) return;
w = pic->width / SIZE;
h = pic->height / SIZE;
// note: we ignore the left-overs on right/bottom
if (pic->use_argb) {
uint32_t argb_value = 0;
for (y = 0; y < h; ++y) {
int need_reset = 1;
for (x = 0; x < w; ++x) {
const int off = (y * pic->argb_stride + x) * SIZE;
if (is_transparent_argb_area(pic->argb + off, pic->argb_stride, SIZE)) {
if (need_reset) {
argb_value = pic->argb[off];
need_reset = 0;
}
flatten_argb(pic->argb + off, argb_value, pic->argb_stride, SIZE);
} else {
need_reset = 1;
}
}
}
} else {
const uint8_t* const a_ptr = pic->a;
int values[3] = { 0 };
if (a_ptr == NULL) return; // nothing to do
for (y = 0; y < h; ++y) {
int need_reset = 1;
for (x = 0; x < w; ++x) {
const int off_a = (y * pic->a_stride + x) * SIZE;
const int off_y = (y * pic->y_stride + x) * SIZE;
const int off_uv = (y * pic->uv_stride + x) * SIZE2;
if (is_transparent_area(a_ptr + off_a, pic->a_stride, SIZE)) {
if (need_reset) {
values[0] = pic->y[off_y];
values[1] = pic->u[off_uv];
values[2] = pic->v[off_uv];
need_reset = 0;
}
flatten(pic->y + off_y, values[0], pic->y_stride, SIZE);
flatten(pic->u + off_uv, values[1], pic->uv_stride, SIZE2);
flatten(pic->v + off_uv, values[2], pic->uv_stride, SIZE2);
} else {
need_reset = 1;
}
}
}
}
} | false | false | false | false | false | 0 |
removeWindow(FluxboxWindow *w, bool still_alive) {
if (w == 0)
return -1;
// if w is focused and alive, remove the focus ... except if it
// is a transient window. removing the focus from such a window
// leads in a wild race between BScreen::reassociateWindow(),
// BScreen::changeWorkspaceID(), FluxboxWindow::focus() etc. which
// finally leads to crash.
if (w->isFocused() && !w->isTransient() && still_alive)
FocusControl::unfocusWindow(w->winClient(), true, true);
m_windowlist.remove(w);
m_clientlist_sig.emit();
return m_windowlist.size();
} | false | false | false | false | false | 0 |
trinity_dpm_display_configuration_changed(struct radeon_device *rdev)
{
struct trinity_power_info *pi = trinity_get_pi(rdev);
if (pi->voltage_drop_in_dce)
trinity_dce_enable_voltage_adjustment(rdev, true);
trinity_add_dccac_value(rdev);
} | false | false | false | false | false | 0 |
do_tag_checks(HSCPRC *hp, HSCATTR *dest, STRPTR str) {
/*
* checks performed only for tags,
* but are skipped for macros
*/
if (!(dest->varflag & VF_MACRO)) {
/*
* parse uri (convert abs.uris, check existence)
*/
if (dest->vartype == VT_URI) {
EXPSTR *dest_uri = init_estr(32);
parse_uri(hp, dest_uri, str);
set_vartext(dest, estr2str(dest_uri));
del_estr(dest_uri);
}
}
} | false | false | false | false | false | 0 |
test_object_tree_write__from_memory(void)
{
// write a tree from a memory
git_treebuilder *builder;
git_tree *tree;
git_oid id, bid, rid, id2;
git_oid_fromstr(&id, first_tree);
git_oid_fromstr(&id2, second_tree);
git_oid_fromstr(&bid, blob_oid);
//create a second tree from first tree using `git_treebuilder_insert` on REPOSITORY_FOLDER.
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_treebuilder_create(&builder, tree));
cl_git_fail(git_treebuilder_insert(NULL, builder, "",
&bid, GIT_FILEMODE_BLOB));
cl_git_fail(git_treebuilder_insert(NULL, builder, "/",
&bid, GIT_FILEMODE_BLOB));
cl_git_fail(git_treebuilder_insert(NULL, builder, "folder/new.txt",
&bid, GIT_FILEMODE_BLOB));
cl_git_pass(git_treebuilder_insert(
NULL, builder, "new.txt", &bid, GIT_FILEMODE_BLOB));
cl_git_pass(git_treebuilder_write(&rid, g_repo, builder));
cl_assert(git_oid_cmp(&rid, &id2) == 0);
git_treebuilder_free(builder);
git_tree_free(tree);
} | false | false | false | false | false | 0 |
parse_time(const Glib::ustring& text, const std::locale& locale, bool& success)
{
//std::cout << "debug: " << G_STRFUNC << ": text=" << text << std::endl;
//The sequence of statements here seems to be very fragile. If you move things then it stops working.
//return parse_tm(text, locale, 'X' /* time */);
//This is based on docs found here:
//http://www.roguewave.com/support/docs/sourcepro/stdlibref/time-get.html
//Format it into this stream:
typedef std::stringstream type_stream;
//tm the_c_time = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/* This seems to be necessary - when I do this, as found here ( http://www.tacc.utexas.edu/services/userguides/pgi/pgC++_lib/stdlibcr/tim_0622.htm ) then the time is correctly parsed (it is changed).
* When not, I get just zeros.
*/
//tm the_c_time = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
tm the_c_time;
memset(&the_c_time, 0, sizeof(the_c_time));
std::ios_base::iostate err = std::ios_base::goodbit; //The initialization is essential because time_get seems to a) not initialize this output argument and b) check its value.
type_stream the_stream;
the_stream.imbue(locale); //Make it format things for this locale. (Actually, I don't know if this is necessary, because we mention the locale in the time_put<> constructor.
the_stream << text;
// Get a time_get facet:
typedef std::istreambuf_iterator<char, std::char_traits<char> > type_iterator;
typedef std::time_get<char, type_iterator> type_time_get;
const type_time_get& tg = std::use_facet<type_time_get>(locale);
type_iterator the_begin(the_stream);
type_iterator the_end;
tg.get_time(the_begin, the_end, the_stream, err, &the_c_time);
if(err != std::ios_base::failbit)
{
success = true;
return the_c_time;
}
#ifdef HAVE_STRPTIME
//Fall back to strptime():
//This fallback will be used in most cases. TODO: Remove the useless? time_get<> code then?
//It seems to be well known that time_get<> can parse much less than what time_put<> can generate:
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2070.html
//
//Try various formats:
memset(&the_c_time, 0, sizeof(the_c_time));
char* lastchar = strptime(text.c_str(), "%r" /* 12-hour clock time using the AM/PM notation */, &the_c_time);
if(lastchar)
{
success = true;
return the_c_time;
}
memset(&the_c_time, 0, sizeof(the_c_time));
lastchar = strptime(text.c_str(), "%X" /* The time, using the locale's time format. */, &the_c_time);
if(lastchar)
{
//std::cout << "debug: " << G_STRFUNC << ": %X: text=" << text << " was parsed as: hour=" << the_c_time.tm_hour << ", min=" << the_c_time.tm_min << ", sec=" << the_c_time.tm_sec << std::endl;
success = true;
return the_c_time;
}
//Note: strptime() with "%OI" parses "01:00 PM" incorrectly as 01:00, though it claims to parse successfully.
memset(&the_c_time, 0, sizeof(the_c_time));
lastchar = strptime(text.c_str(), "%c" /* alternative 12-hour clock */, &the_c_time);
if(lastchar)
{
//std::cout << "debug: " << G_STRFUNC << ": %c: text=" << text << " was parsed as: hour=" << the_c_time.tm_hour << ", min=" << the_c_time.tm_min << ", sec=" << the_c_time.tm_sec << std::endl;
success = true;
return the_c_time;
}
//This seems to be the only one that can parse "01:00 PM":
memset(&the_c_time, 0, sizeof(the_c_time));
lastchar = strptime(text.c_str(), "%I : %M %p" /* 12 hours clock with AM/PM, without seconds. */, &the_c_time);
if(lastchar)
{
//std::cout << "debug: " << G_STRFUNC << ": %I : %M %p: text=" << text << " was parsed as: hour=" << the_c_time.tm_hour << ", min=" << the_c_time.tm_min << ", sec=" << the_c_time.tm_sec << std::endl;
success = true;
return the_c_time;
}
//std::cout << " DEBUG: strptime(%c) failed on text=" << text << std::endl;
#endif // HAVE_STRPTIME
//Nothing worked:
//tm blank_time = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
tm blank_time ;
memset(&blank_time , 0, sizeof(blank_time ));
success = false;
return blank_time;
} | false | false | false | false | false | 0 |
libshut_get_interrupt(int upsfd, unsigned char *buf,
int bufsize, int timeout)
{
int ret;
if (upsfd < 1) {
return -1;
}
/* FIXME: hardcoded interrupt EP => need to get EP descr for IF descr */
ret = shut_interrupt_read(upsfd, 0x81, buf, bufsize, timeout);
if (ret > 0)
upsdebugx(6, " ok");
else
upsdebugx(6, " none (%i)", ret);
return ret;
} | false | false | false | false | false | 0 |
MainLibLookup (MainLib ml, char *xclass, char *name)
#else
MainLibEntry MainLibLookup(ml, xclass, name)
MainLib ml;
char *xclass;
char *name;
#endif
{
MainLibEntry cur;
if( !ml || (!xclass && !name) ) return NULL;
for(cur=ml->head; cur!=NULL; cur=cur->next){
if( (!xclass || !strcmp(xclass, cur->xclass)) &&
(!name || !strcmp(name, cur->name)) ){
return cur;
}
}
return NULL;
} | false | false | false | false | false | 0 |
numaSort(NUMA *naout,
NUMA *nain,
l_int32 sortorder)
{
l_int32 i, n, gap, j;
l_float32 tmp;
l_float32 *array;
PROCNAME("numaSort");
if (!nain)
return (NUMA *)ERROR_PTR("nain not defined", procName, NULL);
/* Make naout if necessary; otherwise do in-place */
if (!naout)
naout = numaCopy(nain);
else if (nain != naout)
return (NUMA *)ERROR_PTR("invalid: not in-place", procName, NULL);
array = naout->array; /* operate directly on the array */
n = numaGetCount(naout);
/* Shell sort */
for (gap = n/2; gap > 0; gap = gap / 2) {
for (i = gap; i < n; i++) {
for (j = i - gap; j >= 0; j -= gap) {
if ((sortorder == L_SORT_INCREASING &&
array[j] > array[j + gap]) ||
(sortorder == L_SORT_DECREASING &&
array[j] < array[j + gap]))
{
tmp = array[j];
array[j] = array[j + gap];
array[j + gap] = tmp;
}
}
}
}
return naout;
} | false | false | false | false | false | 0 |
FilterFrame( uint8_t *io, int width, int height, double position, double frame_delta )
{
show_every = (int) gtk_range_get_value( GTK_RANGE( glade_xml_get_widget( kinoplus_glade, "hscale_slow_mo" ) ) );
if ( current ++ % show_every == 0 )
memcpy( tempframe, io, width * height * 3 );
else
memcpy( io, tempframe, width * height * 3 );
} | false | false | false | false | false | 0 |
printMessage(char* str, int maxlen) const
{
int remain = maxlen;
if (source != NULL) {
remain = source->printMessage(str, maxlen);
}
char aux[100];
sprintf(aux, "From %s:%d\n", file, line);
int newremain = remain - strlen(aux);
if (newremain < 0) {
aux[remain] = '\0';
newremain = 0;
}
strcat(str, aux);
return newremain;
} | false | false | false | false | true | 1 |
size() const
{
if (this->name() == NULL)
return 0;
size_t data_size = 0;
for (int i = 4; i < NUM_KNOWN_ATTRIBUTES; ++i)
data_size += this->known_attributes_[i].size(i);
for (Other_attributes::const_iterator p = this->other_attributes_.begin();
p != this->other_attributes_.end();
++p)
data_size += p->second->size(p->first);
// <size> <vendor_name> NUL 0x1 <size>
return ((data_size != 0
|| this->vendor_ == Object_attribute::OBJ_ATTR_PROC)
? data_size + strlen(this->name()) + 2 + 2 * 4
: 0);
} | false | false | false | false | false | 0 |
cpr_get_utf8( const char *keyword, const char *prompt )
{
char *p;
p = cpr_get( keyword, prompt );
if( p ) {
char *utf8 = native_to_utf8( p );
xfree( p );
p = utf8;
}
return p;
} | false | false | false | false | false | 0 |
dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff)
{
struct dib8000_state *state = fe->demodulator_priv;
u16 reg_1287;
switch (onoff) {
case 0: /* only use the internal way - not the diversity input */
dprintk("%s mode OFF : by default Enable Mpeg INPUT",
__func__);
/* outputRate = 8 */
dib8096p_cfg_DibRx(state, 8, 5, 0, 0, 0, 8, 0);
/* Do not divide the serial clock of MPEG MUX in
SERIAL MODE in case input mode MPEG is used */
reg_1287 = dib8000_read_word(state, 1287);
/* enSerialClkDiv2 == 1 ? */
if ((reg_1287 & 0x1) == 1) {
/* force enSerialClkDiv2 = 0 */
reg_1287 &= ~0x1;
dib8000_write_word(state, 1287, reg_1287);
}
state->input_mode_mpeg = 1;
break;
case 1: /* both ways */
case 2: /* only the diversity input */
dprintk("%s ON : Enable diversity INPUT", __func__);
dib8096p_cfg_DibRx(state, 5, 5, 0, 0, 0, 0, 0);
state->input_mode_mpeg = 0;
break;
}
dib8000_set_diversity_in(state->fe[0], onoff);
return 0;
} | false | false | false | false | false | 0 |
delete_one_address_conf(const char *address, struct ConfItem *aconf)
{
int masktype, bits;
unsigned long hv;
struct AddressRec *arec, *arecl = NULL;
struct rb_sockaddr_storage addr;
masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
#ifdef RB_IPV6
if(masktype == HM_IPV6)
{
/* We have to do this, since we do not re-hash for every bit -A1kmm. */
bits -= bits % 16;
hv = hash_ipv6((struct sockaddr *)&addr, bits);
}
else
#endif
if(masktype == HM_IPV4)
{
/* We have to do this, since we do not re-hash for every bit -A1kmm. */
bits -= bits % 8;
hv = hash_ipv4((struct sockaddr *)&addr, bits);
}
else
hv = get_mask_hash(address);
for (arec = atable[hv]; arec; arec = arec->next)
{
if(arec->aconf == aconf)
{
if(arecl)
arecl->next = arec->next;
else
atable[hv] = arec->next;
aconf->status |= CONF_ILLEGAL;
if(!aconf->clients)
free_conf(aconf);
rb_free(arec);
return;
}
arecl = arec;
}
} | false | false | false | false | false | 0 |
jl_array_grow_beg(jl_array_t *a, size_t inc)
{
// designed to handle the case of growing and shrinking at both ends
if (inc == 0)
return;
size_t es = a->elsize;
size_t nb = inc*es;
if (a->offset >= inc) {
a->data = (char*)a->data - nb;
a->offset -= inc;
}
else {
size_t alen = a->length;
size_t anb = alen*es;
char *newdata;
if (inc > (a->maxsize-alen)/2 - (a->maxsize-alen)/20) {
size_t newlen = a->maxsize==0 ? 2*inc : a->maxsize*2;
while (alen+2*inc > newlen-a->offset)
newlen *= 2;
newdata = array_new_buffer(a, newlen);
size_t center = (newlen - (alen + inc))/2;
newdata += (center*es);
a->maxsize = newlen;
a->offset = center;
}
else {
size_t center = (a->maxsize - (alen + inc))/2;
newdata = (char*)a->data - es*a->offset + es*center;
a->offset = center;
}
memmove(&newdata[nb], a->data, anb);
a->data = newdata;
}
a->length += inc; a->nrows += inc;
} | false | false | false | false | false | 0 |
goo_canvas_line_dash_new (gint num_dashes,
...)
{
GooCanvasLineDash *dash;
va_list var_args;
gint i;
dash = g_new (GooCanvasLineDash, 1);
dash->ref_count = 1;
dash->num_dashes = num_dashes;
dash->dashes = g_new (double, num_dashes);
dash->dash_offset = 0.0;
va_start (var_args, num_dashes);
for (i = 0; i < num_dashes; i++)
{
dash->dashes[i] = va_arg (var_args, double);
}
va_end (var_args);
return dash;
} | false | false | false | false | false | 0 |
egl_st_create_api(enum st_api_type api)
{
struct st_api *stapi = NULL;
switch (api) {
case ST_API_OPENGL:
#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
#if _EGL_EXTERNAL_GL
stapi = egl_st_load_gl();
#else
stapi = st_gl_api_create();
#endif
#endif
break;
case ST_API_OPENVG:
#if FEATURE_VG
stapi = (struct st_api *) vg_api_get();
#endif
break;
default:
assert(!"Unknown API Type\n");
break;
}
return stapi;
} | false | false | false | false | false | 0 |
_print_nodes_t(sinfo_data_t * sinfo_data, int width,
bool right_justify, char *suffix)
{
char id[FORMAT_STRING_SIZE];
char tmp[8];
if (sinfo_data) {
if (params.cluster_flags & CLUSTER_FLAG_BG)
convert_num_unit((float)sinfo_data->nodes_total,
tmp, sizeof(tmp), UNIT_NONE);
else
snprintf(tmp, sizeof(tmp), "%d",
sinfo_data->nodes_total);
snprintf(id, FORMAT_STRING_SIZE, "%s", tmp);
_print_str(id, width, right_justify, true);
} else
_print_str("NODES", width, right_justify, true);
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
} | false | false | false | false | false | 0 |
remove_address_replacements (rtx in_rtx)
{
int i, j;
char reload_flags[MAX_RELOADS];
int something_changed = 0;
memset (reload_flags, 0, sizeof reload_flags);
for (i = 0, j = 0; i < n_replacements; i++)
{
if (loc_mentioned_in_p (replacements[i].where, in_rtx))
reload_flags[replacements[i].what] |= 1;
else
{
replacements[j++] = replacements[i];
reload_flags[replacements[i].what] |= 2;
}
}
/* Note that the following store must be done before the recursive calls. */
n_replacements = j;
for (i = n_reloads - 1; i >= 0; i--)
{
if (reload_flags[i] == 1)
{
deallocate_reload_reg (i);
remove_address_replacements (rld[i].in);
rld[i].in = 0;
something_changed = 1;
}
}
return something_changed;
} | false | false | false | false | false | 0 |
read_line (int fd,
char *buf,
size_t maxlen)
{
size_t bytes = 0;
ReadStatus retval;
memset (buf, '\0', maxlen);
maxlen -= 1; /* ensure nul term */
retval = READ_STATUS_OK;
while (TRUE)
{
ssize_t chunk;
size_t to_read;
again:
to_read = maxlen - bytes;
if (to_read == 0)
break;
chunk = read (fd,
buf + bytes,
to_read);
if (chunk < 0 && errno == EINTR)
goto again;
if (chunk < 0)
{
retval = READ_STATUS_ERROR;
break;
}
else if (chunk == 0)
{
retval = READ_STATUS_EOF;
break; /* EOF */
}
else /* chunk > 0 */
bytes += chunk;
}
if (retval == READ_STATUS_EOF &&
bytes > 0)
retval = READ_STATUS_OK;
/* whack newline */
if (retval != READ_STATUS_ERROR &&
bytes > 0 &&
buf[bytes-1] == '\n')
buf[bytes-1] = '\0';
return retval;
} | false | false | false | false | false | 0 |
callbackEvent(void *NotUsed, int argc, char **argv, char **azColName)
{
int i;
int c;
for (i = 0; i < argc; i++) {
if (strcmp(azColName[i], "event_id") == 0) {
snprintf(event_id, sizeof(event_id), "%s", argv[i] ? argv[i] : "NULL");
} else if (strcmp(azColName[i], "event_type") == 0) {
c = *argv[i] & 0x0F;
if (c < MAX_IDS_TYPE)
snprintf(event_type, sizeof(event_type), "%s", IDS_TYPE[c]);
} else if (strcmp(azColName[i], "event_date") == 0) {
snprintf(event_date, sizeof(event_date), "%s", argv[i] ? argv[i]
: "NULL");
} else if (strcmp(azColName[i], "event_time") == 0) {
snprintf(event_time, sizeof(event_time), "%s", argv[i] ? argv[i]
: "NULL");
} else if (strcmp(azColName[i], "event_user") == 0) {
snprintf(event_user, sizeof(event_user), "%s", argv[i] ? argv[i]
: "NULL");
} else if (strcmp(azColName[i], "event_ip") == 0) {
snprintf(event_ip, sizeof(event_ip), "%s", argv[i] ? argv[i] : "NULL");
} else if (strcmp(azColName[i], "event_comp") == 0) {
snprintf(event_comp, sizeof(event_comp), "%s", argv[i] ? argv[i]
: "NULL");
} else if (strcmp(azColName[i], "event_desc") == 0) {
snprintf(event_desc, sizeof(event_desc), "%s", argv[i] ? argv[i]
: "NULL");
}
}
return 0;
} | false | false | false | false | false | 0 |
control_config_button_pressed(int n)
{
switch (n) {
case TARGET_TAB:
case SHIP_TAB:
case WEAPON_TAB:
case COMPUTER_TAB:
Tab = n;
Scroll_offset = Selected_line = 0;
control_config_list_prepare();
gamesnd_play_iface(SND_SCREEN_MODE_PRESSED);
break;
case BIND_BUTTON:
control_config_do_bind();
break;
case SEARCH_MODE:
control_config_do_search();
break;
case SHIFT_TOGGLE:
control_config_toggle_modifier(KEY_SHIFTED);
gamesnd_play_iface(SND_USER_SELECT);
break;
case ALT_TOGGLE:
control_config_toggle_modifier(KEY_ALTED);
gamesnd_play_iface(SND_USER_SELECT);
break;
case INVERT_AXIS:
control_config_toggle_invert();
gamesnd_play_iface(SND_USER_SELECT);
break;
case SCROLL_UP_BUTTON:
control_config_scroll_screen_up();
break;
case SCROLL_DOWN_BUTTON:
control_config_scroll_screen_down();
break;
case ACCEPT_BUTTON:
control_config_accept();
break;
case CLEAR_BUTTON:
control_config_remove_binding();
break;
case HELP_BUTTON:
launch_context_help();
gamesnd_play_iface(SND_HELP_PRESSED);
break;
case RESET_BUTTON:
control_config_do_reset();
break;
case UNDO_BUTTON:
control_config_undo_last();
break;
case CANCEL_BUTTON:
control_config_do_cancel();
break;
case CLEAR_OTHER_BUTTON:
control_config_clear_other();
break;
case CLEAR_ALL_BUTTON:
control_config_clear_all();
break;
}
} | false | false | false | false | false | 0 |
IsAnimated(size_t index) const
{
size_t animatedCount = animateds.size();
if (index == ~(size_t)0)
{
for (size_t i = 0; i < animatedCount; ++i)
{
if (animateds[i]->HasCurve()) return true;
}
return false;
}
else
{
size_t i = BinarySearch(index);
return i < animatedCount && animateds[i]->GetArrayElement() == (int32) index && animateds[i]->HasCurve();
}
} | false | false | false | false | false | 0 |
cciss_allocate_sg_chain_blocks(
ctlr_info_t *h, int chainsize, int nr_cmds)
{
int j;
SGDescriptor_struct **cmd_sg_list;
if (chainsize <= 0)
return NULL;
cmd_sg_list = kmalloc(sizeof(*cmd_sg_list) * nr_cmds, GFP_KERNEL);
if (!cmd_sg_list)
return NULL;
/* Build up chain blocks for each command */
for (j = 0; j < nr_cmds; j++) {
/* Need a block of chainsized s/g elements. */
cmd_sg_list[j] = kmalloc((chainsize *
sizeof(*cmd_sg_list[j])), GFP_KERNEL);
if (!cmd_sg_list[j]) {
dev_err(&h->pdev->dev, "Cannot get memory "
"for s/g chains.\n");
goto clean;
}
}
return cmd_sg_list;
clean:
cciss_free_sg_chain_blocks(cmd_sg_list, nr_cmds);
return NULL;
} | false | false | false | false | false | 0 |
ParseQueryNoAction(
void *theEnv,
EXPRESSION *top,
char *readSource)
{
EXPRESSION *insQuerySetVars;
struct token queryInputToken;
insQuerySetVars = ParseQueryRestrictions(theEnv,top,readSource,&queryInputToken);
if (insQuerySetVars == NULL)
return(NULL);
IncrementIndentDepth(theEnv,3);
PPCRAndIndent(theEnv);
if (ParseQueryTestExpression(theEnv,top,readSource) == FALSE)
{
DecrementIndentDepth(theEnv,3);
ReturnExpression(theEnv,insQuerySetVars);
return(NULL);
}
DecrementIndentDepth(theEnv,3);
GetToken(theEnv,readSource,&queryInputToken);
if (GetType(queryInputToken) != RPAREN)
{
SyntaxErrorMessage(theEnv,"instance-set query function");
ReturnExpression(theEnv,top);
ReturnExpression(theEnv,insQuerySetVars);
return(NULL);
}
ReplaceInstanceVariables(theEnv,insQuerySetVars,top->argList,TRUE,0);
ReturnExpression(theEnv,insQuerySetVars);
return(top);
} | false | false | false | false | false | 0 |
ad_conn_set_method(ad_conn_t *conn, char *method) {
char *prev = conn->method;
if (conn->method) {
free(conn->method);
}
conn->method = strdup(method);
return prev;
} | false | false | false | false | true | 1 |
_g_settings_set_string_list (GSettings *settings,
const char *key,
GList *list)
{
int len;
char **strv;
int i;
GList *scan;
len = g_list_length (list);
strv = g_new (char *, len + 1);
for (i = 0, scan = list; scan; scan = scan->next)
strv[i++] = scan->data;
strv[i] = NULL;
g_settings_set_strv (settings, key, (const char *const *) strv);
g_free (strv);
} | false | false | false | false | false | 0 |
qla2x00_unmap_iobases(struct qla_hw_data *ha)
{
if (IS_QLA82XX(ha)) {
iounmap((device_reg_t *)ha->nx_pcibase);
if (!ql2xdbwr)
iounmap((device_reg_t *)ha->nxdb_wr_ptr);
} else {
if (ha->iobase)
iounmap(ha->iobase);
if (ha->cregbase)
iounmap(ha->cregbase);
if (ha->mqiobase)
iounmap(ha->mqiobase);
if ((IS_QLA83XX(ha) || IS_QLA27XX(ha)) && ha->msixbase)
iounmap(ha->msixbase);
}
} | false | false | false | false | false | 0 |
addModSrcFile( const std::string& file )
{
int mod_action_flags = 0;
// perform OPARI instrumentation?
//
if( uses_openmp && !isFileExcluded( opari_excl_files, file ) )
mod_action_flags |= ModFileS::MOD_ACTION_FLAG_OPARI;
// perform TAU instrumentation?
//
if( Config.inst_type == INST_TYPE_TAUINST )
{
// skip CUDA (*.cu) source files for now
//
if( isCuFile( file ) )
{
std::cerr << "Warning: Skip " << file << " for instrumenting with "
<< "PDT/TAU - not yet supported." << std::endl;
}
else
{
mod_action_flags |= ModFileS::MOD_ACTION_FLAG_TAUINST;
}
}
// add unmodified source file name to compiler arguments, if there
// is nothing to do for OPARI and TAU
//
if( !mod_action_flags )
{
addCompilerArg( file );
}
// otherwise, register source file for processing by OPARI and/or TAU
//
else
{
std::string file_base;
std::string file_obj;
std::string::size_type si;
// get base name of source file
//
file_base = file;
si = file.rfind( '/' );
if( si != std::string::npos )
file_base = file.substr( si+1 );
// create object file name of source file
//
si = file_base.rfind( '.' );
vt_assert( si != std::string::npos );
file_obj = file_base.substr( 0, si ) + ".o";
// store source/object file and modification action flags
mod_files.push_back( ModFileS( file, file_obj, mod_action_flags ) );
// add modified source file name to compiler arguments
//
si = file.rfind( '.' );
vt_assert( si != std::string::npos );
std::string base = file.substr( 0, si );
std::string suffix = file.substr( si );
std::string mod_file = base;
if( preprocess )
mod_file += ".cpp";
if( ( mod_action_flags & ModFileS::MOD_ACTION_FLAG_OPARI ) != 0 )
mod_file += ".pomp";
if( ( mod_action_flags & ModFileS::MOD_ACTION_FLAG_TAUINST ) != 0 )
mod_file += ".tau";
// convert Fortran source file suffix to upper case, in order to
// invoke the C preprocessor before compiling
if( fortran() && suffix.compare( 0, 2, ".f" ) == 0 )
suffix.replace( 0, 2, ".F" );
mod_file += suffix;
addCompilerArg( mod_file );
}
} | false | false | false | false | false | 0 |
get_tool_mode_pixbuf(enum editor_tool_mode etm)
{
struct sprite *sprite = NULL;
GdkPixbuf *pixbuf = NULL;
sprite = editor_get_mode_sprite(etm);
if (sprite) {
pixbuf = sprite_get_pixbuf(sprite);
/*
if (pixbuf) {
g_object_ref(pixbuf);
}
*/
}
return pixbuf;
} | false | false | false | false | false | 0 |
intf_close ( struct interface *intf, int rc ) {
struct interface *dest;
intf_close_TYPE ( void * ) *op =
intf_get_dest_op ( intf, intf_close, &dest );
void *object = intf_object ( dest );
DBGC ( INTF_COL ( intf ), "INTF " INTF_INTF_FMT " close (%s)\n",
INTF_INTF_DBG ( intf, dest ), strerror ( rc ) );
if ( op ) {
op ( object, rc );
} else {
/* Default is to restart the interface */
intf_restart ( dest, rc );
}
intf_put ( dest );
} | false | false | false | false | false | 0 |
to_printer_callback() {
_to_printer = !_to_printer;
if (!_to_printer) {
if (strcmp(editor_->text()->string(), command(format()))==0)
editor_->field( "./" );
} else {
if (strcmp(editor_->text()->string(), "./")==0)
editor_->field(command(format()));
}
} | false | false | false | false | false | 0 |
gst_queue2_chain_buffer_or_buffer_list (GstQueue2 * queue,
GstMiniObject * item, GstQueue2ItemType item_type)
{
/* we have to lock the queue since we span threads */
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
/* when we received EOS, we refuse more data */
if (queue->is_eos)
goto out_eos;
/* when we received unexpected from downstream, refuse more buffers */
if (queue->unexpected)
goto out_unexpected;
if (!gst_queue2_wait_free_space (queue))
goto out_flushing;
/* put buffer in queue now */
gst_queue2_locked_enqueue (queue, item, item_type);
GST_QUEUE2_MUTEX_UNLOCK (queue);
return GST_FLOW_OK;
/* special conditions */
out_flushing:
{
GstFlowReturn ret = queue->sinkresult;
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"exit because task paused, reason: %s", gst_flow_get_name (ret));
GST_QUEUE2_MUTEX_UNLOCK (queue);
gst_mini_object_unref (item);
return ret;
}
out_eos:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS");
GST_QUEUE2_MUTEX_UNLOCK (queue);
gst_mini_object_unref (item);
return GST_FLOW_UNEXPECTED;
}
out_unexpected:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"exit because we received UNEXPECTED");
GST_QUEUE2_MUTEX_UNLOCK (queue);
gst_mini_object_unref (item);
return GST_FLOW_UNEXPECTED;
}
} | false | false | false | false | false | 0 |
lj_cf_package_loader_preload(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
lua_getfield(L, LUA_ENVIRONINDEX, "preload");
if (!lua_istable(L, -1))
luaL_error(L, LUA_QL("package.preload") " must be a table");
lua_getfield(L, -1, name);
if (lua_isnil(L, -1)) { /* Not found? */
const char *bcname = mksymname(L, name, SYMPREFIX_BC);
const char *bcdata = ll_bcsym(NULL, bcname);
if (bcdata == NULL || luaL_loadbuffer(L, bcdata, ~(size_t)0, name) != 0)
lua_pushfstring(L, "\n\tno field package.preload['%s']", name);
}
return 1;
} | false | false | false | false | false | 0 |
_e_screensaver_handler_screensaver_off_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
// e_screensaver_force_update();
// e_dpms_force_update();
_e_screensaver_on = EINA_FALSE;
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
{
double current = ecore_loop_time_get();
if ((last_start + e_config->screensaver_ask_presentation_timeout)
>= current)
_e_screensaver_ask_presentation_mode();
last_start = 0.0;
}
else if (_e_screensaver_ask_presentation_count)
_e_screensaver_ask_presentation_count = 0;
return ECORE_CALLBACK_PASS_ON;
} | false | false | false | false | false | 0 |
ep_ExportAObject(aobj, tr, for_a)
A aobj;
A tr;
I for_a;
{
char *trp;
A z; /* the object that is returned */
A cc; /* the integer scalar completion code */
A cv; /* A object of export vector */
I cvlen; /* length of character vector result */
cc = gi(1);
z = gv(Et, (I)2);
z->p[0] = (I)cc;
z->n = z->d[0] = 1;
if ((tr!=(A)0) && tr->n != 0) {
if ((tr->t != Ct) || (tr->r != 1) || (tr->n != 256)) return(z);
trp = (char *)(tr->p);
} else trp = (char *)(0);
if (NULL==(cv=AExportAObject(aobj, trp, for_a, &cvlen))) cc->p[0]=cvlen;
else {
z->n=z->d[0]=2;
cc->p[0]=0;
z->p[1]=(I)cv;
}
return(z);
} | false | false | false | false | true | 1 |
test_scenario_1_test4 (InterestTestFixture *fixture, gconstpointer user_data)
{
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 7);
unity_webapps_interest_manager_set_interest_is_active (fixture->interest_manager,
fixture->id2, TRUE);
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 2);
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 3);
unity_webapps_interest_manager_set_interest_is_active (fixture->interest_manager,
fixture->id3, TRUE);
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 2);
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 1);
unity_webapps_window_tracker_mock_set_active_window (UNITY_WEBAPPS_WINDOW_TRACKER_MOCK (fixture->window_tracker), 2);
ASSERTMR(fixture->id2);
} | false | false | false | false | false | 0 |
il_ht_conf(struct il_priv *il, struct ieee80211_vif *vif)
{
struct il_ht_config *ht_conf = &il->current_ht_config;
struct ieee80211_sta *sta;
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
D_ASSOC("enter:\n");
if (!il->ht.enabled)
return;
il->ht.protection =
bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION;
il->ht.non_gf_sta_present =
!!(bss_conf->
ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
ht_conf->single_chain_sufficient = false;
switch (vif->type) {
case NL80211_IFTYPE_STATION:
rcu_read_lock();
sta = ieee80211_find_sta(vif, bss_conf->bssid);
if (sta) {
struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
int maxstreams;
maxstreams =
(ht_cap->mcs.
tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
>> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT;
maxstreams += 1;
if (ht_cap->mcs.rx_mask[1] == 0 &&
ht_cap->mcs.rx_mask[2] == 0)
ht_conf->single_chain_sufficient = true;
if (maxstreams <= 1)
ht_conf->single_chain_sufficient = true;
} else {
/*
* If at all, this can only happen through a race
* when the AP disconnects us while we're still
* setting up the connection, in that case mac80211
* will soon tell us about that.
*/
ht_conf->single_chain_sufficient = true;
}
rcu_read_unlock();
break;
case NL80211_IFTYPE_ADHOC:
ht_conf->single_chain_sufficient = true;
break;
default:
break;
}
D_ASSOC("leave\n");
} | false | false | false | false | false | 0 |
pr_equivalence_table(FILE *fp, Common_table *equiv_head_p)
{
Common_table *eqpt;
eqpt = equiv_head_p;
if (equiv_head_p != NULL) {
fputs("%% *** Equivalence Set Table ***\n", fp);
fputs("equivalence {\n", fp);
}
while (eqpt != NULL) {
switch (eqpt->mem_type) {
case COMMON_NUMERIC:
fputs(" numeric ", fp);
break;
case COMMON_CHARACTER:
fputs(" character ", fp);
break;
}
fprintf(fp, "??EQ%d(%d);\n", eqpt->region->entry, eqpt->region->size);
eqpt = eqpt->next;
}
if (equiv_head_p != NULL)
fputs("} %% equivalence\n\n", fp);
} | false | false | false | false | false | 0 |
vlv_power_sequencer_pipe(struct intel_dp *intel_dp)
{
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_device *dev = intel_dig_port->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_encoder *encoder;
unsigned int pipes = (1 << PIPE_A) | (1 << PIPE_B);
enum pipe pipe;
lockdep_assert_held(&dev_priv->pps_mutex);
/* We should never land here with regular DP ports */
WARN_ON(!is_edp(intel_dp));
if (intel_dp->pps_pipe != INVALID_PIPE)
return intel_dp->pps_pipe;
/*
* We don't have power sequencer currently.
* Pick one that's not used by other ports.
*/
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
base.head) {
struct intel_dp *tmp;
if (encoder->type != INTEL_OUTPUT_EDP)
continue;
tmp = enc_to_intel_dp(&encoder->base);
if (tmp->pps_pipe != INVALID_PIPE)
pipes &= ~(1 << tmp->pps_pipe);
}
/*
* Didn't find one. This should not happen since there
* are two power sequencers and up to two eDP ports.
*/
if (WARN_ON(pipes == 0))
pipe = PIPE_A;
else
pipe = ffs(pipes) - 1;
vlv_steal_power_sequencer(dev, pipe);
intel_dp->pps_pipe = pipe;
DRM_DEBUG_KMS("picked pipe %c power sequencer for port %c\n",
pipe_name(intel_dp->pps_pipe),
port_name(intel_dig_port->port));
/* init power sequencer on this pipe and port */
intel_dp_init_panel_power_sequencer(dev, intel_dp);
intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
/*
* Even vdd force doesn't work until we've made
* the power sequencer lock in on the port.
*/
vlv_power_sequencer_kick(intel_dp);
return intel_dp->pps_pipe;
} | false | false | false | false | false | 0 |
numInterpreters()
{
size_t count = 0;
if (Interpreter::s_hook) {
Interpreter* scr = Interpreter::s_hook;
do {
++count;
scr = scr->next;
} while (scr != Interpreter::s_hook);
}
return count;
} | false | false | false | false | false | 0 |
ErrMsg( int nErrorCode )
{
const char *p;
static char szErrMsg[64];
switch( nErrorCode ) {
case 0: p = ""; break;
case CT_OVERFLOW: p = "ARRAY OVERFLOW"; break;
case CT_LEN_MISMATCH: p = "LENGTH_MISMATCH"; break;
case CT_OUT_OF_RAM: p = "Out of RAM"; break;
case CT_RANKING_ERR: p = "RANKING_ERR"; break;
case CT_ISOCOUNT_ERR: p = "ISOCOUNT_ERR"; break;
case CT_TAUCOUNT_ERR: p = "TAUCOUNT_ERR"; break;
case CT_ISOTAUCOUNT_ERR: p = "ISOTAUCOUNT_ERR"; break;
case CT_MAPCOUNT_ERR: p = "MAPCOUNT_ERR"; break;
case CT_TIMEOUT_ERR: p = "Time limit exceeded"; break;
case CT_ISO_H_ERR: p = "ISO_H_ERR"; break;
case CT_STEREOCOUNT_ERR: p = "STEREOCOUNT_ERR"; break;
case CT_ATOMCOUNT_ERR: p = "ATOMCOUNT_ERR"; break;
case CT_STEREOBOND_ERROR: p = "STEREOBOND_ERR"; break;
case CT_USER_QUIT_ERR: p = "User requested termination"; break;
case CT_REMOVE_STEREO_ERR: p = "REMOVE_STEREO_ERR"; break;
case CT_CALC_STEREO_ERR: p = "CALC_STEREO_ERR"; break;
case CT_STEREO_CANON_ERR: p = "STEREO_CANON_ERR"; break;
case CT_CANON_ERR: p = "CANON_ERR"; break;
case CT_WRONG_FORMULA: p = "Wrong or missing chemical formula"; break;
/*case CT_CANON_ERR2: p = "CT_CANON_ERR2"; break;*/
case CT_UNKNOWN_ERR: p = "UNKNOWN_ERR"; break;
case BNS_RADICAL_ERR: p = "Cannot process free radical center"; break;
case BNS_ALTBOND_ERR: p = "Cannot process aromatic bonds"; break;
default:
if ( nErrorCode > CT_UNKNOWN_ERR ) {
sprintf( szErrMsg, "No description(%d)", nErrorCode );
p = szErrMsg;
} else {
sprintf( szErrMsg, "UNKNOWN_ERR(%d)", CT_UNKNOWN_ERR - nErrorCode );
p = szErrMsg;
}
break;
}
return p;
} | false | false | false | false | false | 0 |
sr_commit_i(IndexReader *ir)
{
SegmentInfo *si = SR(ir)->si;
char *segment = SR(ir)->si->name;
char tmp_file_name[SEGMENT_NAME_MAX_LENGTH];
if (SR(ir)->undelete_all || SR(ir)->deleted_docs_dirty) {
if (si->del_gen >= 0) {
fn_for_generation(tmp_file_name, segment, "del", si->del_gen);
deleter_queue_file(ir->deleter, tmp_file_name);
}
if (SR(ir)->undelete_all) {
si->del_gen = -1;
SR(ir)->undelete_all = false;
}
else {
/* (SR(ir)->deleted_docs_dirty) re-write deleted */
si->del_gen++;
fn_for_generation(tmp_file_name, segment, "del", si->del_gen);
bv_write(SR(ir)->deleted_docs, ir->store, tmp_file_name);
SR(ir)->deleted_docs_dirty = false;
}
}
if (SR(ir)->norms_dirty) { /* re-write norms */
int i;
const int field_cnt = ir->fis->size;
FieldInfo *fi;
for (i = field_cnt - 1; i >= 0; i--) {
fi = ir->fis->fields[i];
if (fi_is_indexed(fi)) {
Norm *norm = (Norm *)h_get_int(SR(ir)->norms, fi->number);
if (norm && norm->is_dirty) {
norm_rewrite(norm, ir->store, ir->deleter, SR(ir)->si,
SR_SIZE(ir));
}
}
}
SR(ir)->norms_dirty = false;
}
} | false | false | false | false | false | 0 |
getColor(void)
{
float color;
switch(cl_disbeamclr->integer) {
case 0:
default:
color = 0xd6; //bright green
break;
case 1:
color = 0x74; //blue
break;
case 2:
color = 0x40; //red
break;
case 3:
color = 0xe0; //yellow
break;
case 4:
color = 0xff; //purple
break;
}
return color;
} | false | false | false | false | false | 0 |
Do( const Audio& in, DataArray& A, DataArray& K, TData& E )
{
if ( !AbleToExecute() )
return false;
DataArray R; // autocorrelation coefficients
R.Resize( mCurrentConfig.GetOrder() );
R.SetSize( mCurrentConfig.GetOrder() );
ComputeAutocorrelation( in.GetBuffer(), R );
if ( fabs( R[0] ) <= 1e-6 )
{
/** Special K!*/
DataArray R2( R.GetPtr()+1, R.Size()-1 );
SolveSystemByLevinsonDurbin( R2, A, K, E );
}
else
SolveSystemByLevinsonDurbin( R, A, K, E );
return true;
} | false | false | false | false | false | 0 |
binary_hash_1(void *binary)
{
if (((ARCH_WORD *)binary)[2] == ~(ARCH_WORD)0)
return *(ARCH_WORD *)binary & 0xFF;
return DES_STD_HASH_1(((ARCH_WORD *)binary)[2]);
} | false | false | false | false | false | 0 |
findMeter(char *s)
{
int i = 1;
while (strcmp(meters[i], " "))
if (!strcasecmp(s, (char *) meters[i]))
return(i);
else
i++;
return LX_ERROR_BYTE;
} | false | false | false | false | true | 1 |
johansen_test_complete (GRETL_VAR *jvar, const DATASET *dset,
gretlopt opt, PRN *prn)
{
void *handle = NULL;
int (*jfun) (GRETL_VAR *, const DATASET *, gretlopt, PRN *);
int err = 0;
gretl_error_clear();
jfun = get_plugin_function("johansen_coint_test", &handle);
if (jfun == NULL) {
err = 1;
} else {
err = (* jfun) (jvar, dset, opt, prn);
close_plugin(handle);
}
return err;
} | false | false | false | false | false | 0 |
solicitRequest(SPtr<TSrvOptIA_PD> queryOpt, SPtr<TSrvCfgIface> ptrIface, bool fake) {
// --- Is this PD without IAPREFIX options? ---
SPtr<TIPv6Addr> hint = 0;
if (!queryOpt->countPrefixes()) {
Log(Notice) << "PD option (with IAPREFIX suboptions missing) received. " << LogEnd;
hint = new TIPv6Addr(); /* :: - any address */
this->Prefered = DHCPV6_INFINITY;
this->Valid = DHCPV6_INFINITY;
} else {
SPtr<TSrvOptIAPrefix> hintPrefix = (Ptr*) queryOpt->getOption(OPTION_IAPREFIX);
hint = hintPrefix->getPrefix();
Log(Info) << "PD: PD option with " << hint->getPlain() << " as a hint received." << LogEnd;
this->Prefered = hintPrefix->getPref();
this->Valid = hintPrefix->getValid();
}
int status;
if (existingLease()) {
// re-issue existing leases
status = STATUSCODE_SUCCESS;
} else {
// assign new prefixes
status = assignPrefix(hint, fake);
}
// include status code
SPtr<TSrvOptStatusCode> ptrStatus;
if (status==STATUSCODE_SUCCESS) {
ostringstream tmp;
tmp << countPrefixes() << " prefix(es) granted.";
ptrStatus = new TSrvOptStatusCode(STATUSCODE_SUCCESS, tmp.str(), this->Parent);
} else {
ptrStatus = new TSrvOptStatusCode(status,
"Unable to provide any prefixes. Sorry.", this->Parent);
}
this->SubOptions.append((Ptr*)ptrStatus);
return;
} | false | false | false | false | false | 0 |
test_init (void)
{
int i;
for (i = 0; i < pixels * 4; i++)
test [i] = (double) random () / RAND_MAX;
} | false | false | false | false | true | 1 |
sleep_millisecs_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
unsigned long msecs;
int err;
err = kstrtoul(buf, 10, &msecs);
if (err || msecs > UINT_MAX)
return -EINVAL;
ksm_thread_sleep_millisecs = msecs;
return count;
} | false | false | false | false | false | 0 |
copy_file(char *src, char* dst){
FILE *fpin, *fpout;
char buf[512];
int n;
fpin = fopen(src,"r");
fpout = fopen(dst,"w");
if ( fpin == NULL || fpout == NULL) {
fprintf(stderr,"Unable to open %s or %s\n",src,dst);
return;
}
for(;;){
n = fread(buf, 1, 512, fpin);
if(n == 0)
break;
fwrite(buf, 1, n, fpout);
}
fclose(fpin);
fclose(fpout);
} | false | false | true | false | true | 1 |
free_call_data (gpointer _data)
{
CallData *data = _data;
g_object_unref (data->self);
g_free (data->buf);
if (data->json_result != NULL)
json_node_free (data->json_result);
if (data->json_error != NULL)
json_node_free (data->json_error);
g_slice_free (CallData, data);
} | false | false | false | false | false | 0 |
wasp_copy_vector( wasp_vector vo, wasp_integer ln ){
wasp_vector vn = wasp_make_vector( ln );
while( ln-- ){
wasp_vector_put( vn, ln, wasp_vector_get( vo, ln ) );
}
return vn;
} | false | false | false | false | false | 0 |
handle_go_direction (NautilusWindowSlot *slot,
GFile *location,
gboolean forward)
{
GList **list_ptr, **other_list_ptr;
GList *list, *other_list, *link;
NautilusBookmark *bookmark;
gint i;
list_ptr = (forward) ? (&slot->details->forward_list) : (&slot->details->back_list);
other_list_ptr = (forward) ? (&slot->details->back_list) : (&slot->details->forward_list);
list = *list_ptr;
other_list = *other_list_ptr;
/* Move items from the list to the other list. */
g_assert (g_list_length (list) > slot->details->location_change_distance);
check_bookmark_location_matches (g_list_nth_data (list, slot->details->location_change_distance),
location);
g_assert (nautilus_window_slot_get_location (slot) != NULL);
/* Move current location to list */
check_last_bookmark_location_matches_slot (slot);
/* Use the first bookmark in the history list rather than creating a new one. */
other_list = g_list_prepend (other_list, slot->details->last_location_bookmark);
g_object_ref (other_list->data);
/* Move extra links from the list to the other list */
for (i = 0; i < slot->details->location_change_distance; ++i) {
bookmark = NAUTILUS_BOOKMARK (list->data);
list = g_list_remove (list, bookmark);
other_list = g_list_prepend (other_list, bookmark);
}
/* One bookmark falls out of back/forward lists and becomes viewed location */
link = list;
list = g_list_remove_link (list, link);
g_object_unref (link->data);
g_list_free_1 (link);
*list_ptr = list;
*other_list_ptr = other_list;
} | false | false | false | false | false | 0 |
write_to_temp(const char *zText, char *zFile, size_t nLen){
FILE *f;
int fd;
char *zTmp = getenv("TMPDIR"); /* most Unices */
if( zTmp==0 ) zTmp = getenv("TEMP"); /* Windows/Cygwin */
if( zTmp==0 ) zTmp = "/tmp";
bprintf(zFile,nLen,"%s/cvstrac_XXXXXX", zTmp);
fd = mkstemp(zFile);
if( fd<0 || 0==(f = fdopen(fd, "w+")) ){
if( fd>=0 ){
unlink(zFile);
close(fd);
}
zFile[0] = 0;
return 1;
}
fwrite(zText, 1, strlen(zText), f);
fprintf(f, "\n");
fclose(f);
return 0;
} | false | false | false | false | false | 0 |
sqlite_db_collation_needed_dispatcher(
void *dbh,
sqlite3* db, /* unused */
int eTextRep, /* unused */
const char* collation_name
)
{
dTHX;
dSP;
D_imp_dbh(dbh);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs( dbh );
XPUSHs( sv_2mortal( newSVpv( collation_name, 0) ) );
PUTBACK;
call_sv( imp_dbh->collation_needed_callback, G_VOID );
SPAGAIN;
PUTBACK;
FREETMPS;
LEAVE;
} | false | false | false | false | false | 0 |
price() const
{
if (commodity_ && commodity_->annotated) {
amount_t temp(((annotated_commodity_t *)commodity_)->price);
temp *= *this;
DEBUG_PRINT("amounts.commodities",
"Returning price of " << *this << " = " << temp);
return temp;
}
return *this;
} | false | false | false | false | false | 0 |
wi_thread_block_signals(int signal, ...) {
sigset_t signals;
va_list ap;
va_start(ap, signal);
sigemptyset(&signals);
sigaddset(&signals, signal);
while((signal = va_arg(ap, int)))
sigaddset(&signals, signal);
va_end(ap);
#ifdef WI_PTHREADS
pthread_sigmask(SIG_SETMASK, &signals, NULL);
#else
sigprocmask(SIG_SETMASK, &signals, NULL);
#endif
} | false | false | false | false | false | 0 |
iscsit_start_kthreads(struct iscsi_conn *conn)
{
int ret = 0;
spin_lock(&iscsit_global->ts_bitmap_lock);
conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
ISCSIT_BITMAP_BITS, get_order(1));
spin_unlock(&iscsit_global->ts_bitmap_lock);
if (conn->bitmap_id < 0) {
pr_err("bitmap_find_free_region() failed for"
" iscsit_start_kthreads()\n");
return -ENOMEM;
}
conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
"%s", ISCSI_TX_THREAD_NAME);
if (IS_ERR(conn->tx_thread)) {
pr_err("Unable to start iscsi_target_tx_thread\n");
ret = PTR_ERR(conn->tx_thread);
goto out_bitmap;
}
conn->tx_thread_active = true;
conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
"%s", ISCSI_RX_THREAD_NAME);
if (IS_ERR(conn->rx_thread)) {
pr_err("Unable to start iscsi_target_rx_thread\n");
ret = PTR_ERR(conn->rx_thread);
goto out_tx;
}
conn->rx_thread_active = true;
return 0;
out_tx:
send_sig(SIGINT, conn->tx_thread, 1);
kthread_stop(conn->tx_thread);
conn->tx_thread_active = false;
out_bitmap:
spin_lock(&iscsit_global->ts_bitmap_lock);
bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
get_order(1));
spin_unlock(&iscsit_global->ts_bitmap_lock);
return ret;
} | false | false | false | false | false | 0 |
Cbuf_Execute (void)
{
int i;
char *text;
char line[1024];
int quotes;
alias_count = 0; // don't allow infinite alias loops
while (cmd_text.cursize)
{
// find a \n or ; line break
text = (char *)cmd_text.data;
quotes = 0;
for (i=0 ; i< cmd_text.cursize ; i++)
{
if (text[i] == '"')
quotes++;
if ( !(quotes&1) && text[i] == ';')
break; // don't break if inside a quoted string
if (text[i] == '\n')
break;
}
// sku - removed potentional buffer overflow vulnerability
if( i > sizeof( line ) - 1 ) {
i = sizeof( line ) - 1;
}
memcpy (line, text, i);
line[i] = 0;
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the
// beginning of the text buffer
if (i == cmd_text.cursize)
cmd_text.cursize = 0;
else
{
i++;
cmd_text.cursize -= i;
memmove (text, text+i, cmd_text.cursize);
}
// execute the command line
Cmd_ExecuteString (line);
if (cmd_wait)
{
// skip out while text still remains in buffer, leaving it
// for next frame
cmd_wait = false;
break;
}
}
} | true | true | false | false | false | 1 |
find_free_superio(void)
{
int i;
for (i = 0; i < NR_SUPERIOS; i++)
if (superios[i].io == 0)
return &superios[i];
return NULL;
} | false | false | false | false | false | 0 |
_gsskrb5_compare_name
(OM_uint32 * minor_status,
gss_const_name_t name1,
gss_const_name_t name2,
int * name_equal
)
{
krb5_const_principal princ1 = (krb5_const_principal)name1;
krb5_const_principal princ2 = (krb5_const_principal)name2;
krb5_context context;
GSSAPI_KRB5_INIT(&context);
*name_equal = krb5_principal_compare (context,
princ1, princ2);
*minor_status = 0;
return GSS_S_COMPLETE;
} | false | false | false | false | false | 0 |
READUINTPAIR(BIO * fd,
unsigned int * val1,
unsigned int * val2) {
unsigned char c;
signed char d;
unsigned char v[4];
if (-1 == READALL(fd, &c, sizeof(unsigned char)))
return -1;
if ( ((c & 15) > 4) || ( (c>>4) > 4) ) {
fd->log(fd->context,
DOODLE_LOG_CRITICAL,
_("Assertion failed at %s:%d.\nDatabase format error!\n"),
__FILE__, __LINE__);
return -1;
}
*val1 = 0;
*val2 = 0;
if (-1 == READALL(fd, &v[0], (unsigned char) c & 15))
return -1;
for (d=(c&15)-1;d>=0;d--)
(*val2) += (v[(unsigned char)d] << (8*d));
if (-1 == READALL(fd, &v[0], (unsigned char) c >> 4))
return -1;
for (d=(c>>4)-1;d>=0;d--)
(*val1) += (v[(unsigned char)d] << (8*d));
return 0;
} | true | true | false | false | false | 1 |
var_ns_delete(Var_ns **root, char *name)
{
Var_ns *v;
if ((v = lookup(*root, name)) == NULL)
return(-1);
do_delete(root, v);
return(0);
} | false | false | false | false | false | 0 |
rtl8169_irq_mask_and_ack(void *ioaddr)
{
DBGP ( "rtl8169_irq_mask_and_ack\n" );
RTL_W16(IntrMask, 0x0000);
RTL_W16(IntrStatus, 0xffff);
} | false | false | false | false | false | 0 |
iio_dummy_init(void)
{
int i, ret;
if (instances > 10) {
instances = 1;
return -EINVAL;
}
/* Fake a bus */
iio_dummy_devs = kcalloc(instances, sizeof(*iio_dummy_devs),
GFP_KERNEL);
/* Here we have no actual device so call probe */
for (i = 0; i < instances; i++) {
ret = iio_dummy_probe(i);
if (ret < 0)
goto error_remove_devs;
}
return 0;
error_remove_devs:
while (i--)
iio_dummy_remove(i);
kfree(iio_dummy_devs);
return ret;
} | false | false | false | false | false | 0 |
ddIsIthAddVarPair(
DdManager * dd,
DdNode * f,
DdNode * g,
unsigned int i)
{
return(f->index == i && g->index == i &&
cuddT(f) == DD_ONE(dd) && cuddE(f) == DD_ZERO(dd) &&
cuddT(g) == DD_ZERO(dd) && cuddE(g) == DD_ONE(dd));
} | false | false | false | false | false | 0 |
my_string_empty(const char string[]) {
return string == NULL || string[0] == '\0';
} | false | false | false | false | false | 0 |
_tourneyparseerror (parse_t parse, char *msg, char *atoken)
{
char buf[512];
if (atoken)
Com_sprintf (buf, sizeof(buf), msg, atoken);
else
Q_strncpyz (buf, msg, sizeof(buf));
gi.dprintf ("Error in " TOURNEYINI " at line %i: %s.\n", parse.lnumber, buf);
} | false | false | false | false | false | 0 |
option_set_toggle_button(GtkBuilder *builder, const gchar *name, gboolean dflt) {
gboolean active;
GtkWidget *button;
g_return_if_fail (builder && name);
if (!prefs_get_int_value(name, &active))
active = dflt;
button = GTK_WIDGET(gtk_builder_get_object(builder, name));
if (button)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
} | false | false | false | false | false | 0 |
hashrescan(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
ScanKey scankey = (ScanKey) PG_GETARG_POINTER(1);
HashScanOpaque so = (HashScanOpaque) scan->opaque;
Relation rel = scan->indexRelation;
/* if we are called from beginscan, so is still NULL */
if (so)
{
/* release any pin we still hold */
if (BufferIsValid(so->hashso_curbuf))
_hash_dropbuf(rel, so->hashso_curbuf);
so->hashso_curbuf = InvalidBuffer;
/* release lock on bucket, too */
if (so->hashso_bucket_blkno)
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
so->hashso_bucket_blkno = 0;
/* set position invalid (this will cause _hash_first call) */
ItemPointerSetInvalid(&(so->hashso_curpos));
ItemPointerSetInvalid(&(so->hashso_heappos));
}
/* Update scan key, if a new one is given */
if (scankey && scan->numberOfKeys > 0)
{
memmove(scan->keyData,
scankey,
scan->numberOfKeys * sizeof(ScanKeyData));
if (so)
so->hashso_bucket_valid = false;
}
PG_RETURN_VOID();
} | false | false | false | false | false | 0 |
po_message_set_msgctxt (po_message_t message, const char *msgctxt)
{
message_ty *mp = (message_ty *) message;
if (msgctxt != mp->msgctxt)
{
char *old_msgctxt = (char *) mp->msgctxt;
mp->msgctxt = (msgctxt != NULL ? xstrdup (msgctxt) : NULL);
if (old_msgctxt != NULL)
free (old_msgctxt);
}
} | false | false | false | false | false | 0 |
tty_print_glyph(window, x, y, glyph)
winid window;
xchar x, y;
int glyph;
{
int ch;
boolean reverse_on = FALSE;
int color;
unsigned special;
#ifdef CLIPPING
if(clipping) {
if(x <= clipx || y < clipy || x >= clipxmax || y >= clipymax)
return;
}
#endif
/* map glyph to character and color */
mapglyph(glyph, &ch, &color, &special, x, y);
/* Move the cursor. */
tty_curs(window, x,y);
#ifndef NO_TERMS
if (ul_hack && ch == '_') { /* non-destructive underscore */
(void) putchar((char) ' ');
backsp();
}
#endif
#ifdef TEXTCOLOR
if (color != ttyDisplay->color) {
if(ttyDisplay->color != NO_COLOR)
term_end_color();
ttyDisplay->color = color;
if(color != NO_COLOR)
term_start_color(color);
}
#endif /* TEXTCOLOR */
/* must be after color check; term_end_color may turn off inverse too */
if (((special & MG_PET) && iflags.hilite_pet) ||
((special & MG_DETECT) && iflags.use_inverse)) {
term_start_attr(ATR_INVERSE);
reverse_on = TRUE;
}
#if defined(USE_TILES) && defined(MSDOS)
if (iflags.grmode && iflags.tile_view)
xputg(glyph,ch,special);
else
#endif
g_putch(ch); /* print the character */
if (reverse_on) {
term_end_attr(ATR_INVERSE);
#ifdef TEXTCOLOR
/* turn off color as well, ATR_INVERSE may have done this already */
if(ttyDisplay->color != NO_COLOR) {
term_end_color();
ttyDisplay->color = NO_COLOR;
}
#endif
}
wins[window]->curx++; /* one character over */
ttyDisplay->curx++; /* the real cursor moved too */
} | false | false | false | false | false | 0 |
kgd2kfd_probe(struct kgd_dev *kgd,
struct pci_dev *pdev, const struct kfd2kgd_calls *f2g)
{
struct kfd_dev *kfd;
const struct kfd_device_info *device_info =
lookup_device_info(pdev->device);
if (!device_info)
return NULL;
kfd = kzalloc(sizeof(*kfd), GFP_KERNEL);
if (!kfd)
return NULL;
kfd->kgd = kgd;
kfd->device_info = device_info;
kfd->pdev = pdev;
kfd->init_complete = false;
kfd->kfd2kgd = f2g;
mutex_init(&kfd->doorbell_mutex);
memset(&kfd->doorbell_available_index, 0,
sizeof(kfd->doorbell_available_index));
return kfd;
} | false | false | false | false | false | 0 |
dsc_add_page(CDSC *dsc, int ordinal, char *label)
{
dsc->page[dsc->page_count].ordinal = ordinal;
dsc->page[dsc->page_count].label =
dsc_alloc_string(dsc, label, (int)strlen(label)+1);
dsc->page[dsc->page_count].begin = 0;
dsc->page[dsc->page_count].end = 0;
dsc->page[dsc->page_count].orientation = CDSC_ORIENT_UNKNOWN;
dsc->page[dsc->page_count].media = NULL;
dsc->page[dsc->page_count].bbox = NULL;
dsc->page[dsc->page_count].viewing_orientation = NULL;
dsc->page[dsc->page_count].crop_box = NULL;
dsc->page_count++;
if (dsc->page_count >= dsc->page_chunk_length) {
CDSCPAGE *new_page = (CDSCPAGE *)dsc_memalloc(dsc,
(CDSC_PAGE_CHUNK+dsc->page_count) * sizeof(CDSCPAGE));
if (new_page == NULL)
return CDSC_ERROR; /* out of memory */
memcpy(new_page, dsc->page,
dsc->page_count * sizeof(CDSCPAGE));
dsc_memfree(dsc, dsc->page);
dsc->page= new_page;
dsc->page_chunk_length = CDSC_PAGE_CHUNK+dsc->page_count;
}
return CDSC_OK;
} | false | true | false | false | false | 1 |
vxlan_get_rx_port(struct net_device *dev)
{
struct vxlan_sock *vs;
struct net *net = dev_net(dev);
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
sa_family_t sa_family;
__be16 port;
unsigned int i;
spin_lock(&vn->sock_lock);
for (i = 0; i < PORT_HASH_SIZE; ++i) {
hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {
port = inet_sk(vs->sock->sk)->inet_sport;
sa_family = vxlan_get_sk_family(vs);
dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
port);
}
}
spin_unlock(&vn->sock_lock);
} | false | false | false | false | false | 0 |
symbol_handler(eval_scalar *result, char *name)
{
if (strcmp(name, "$") == 0) {
FileOfs ofs;
if (!pos_to_offset(*(viewer_pos*)&cursor, &ofs)) return 0;
scalar_create_int_q(result, ofs);
return true;
}
return ht_uformat_viewer::symbol_handler(result, name);
} | false | false | false | false | false | 0 |
var_print(ptr) VARIABLE *ptr;
{
double maxp, minp, maxx;
int i, j, k;
char fmt[80];
if (ptr == (VARIABLE *)NULL) return;
if (TYPE(ptr) == TYPE_STRING)
{
if (var_pinp)
PrintOut( "%d %d %% \"",NROW(ptr),NCOL(ptr) );
for(i = 0; i < NROW(ptr); i++)
{
for(j = 0; j < NCOL(ptr); j++)
PrintOut( "%c", (char)M(ptr,i,j));
if (var_pinp)
{
if (i < NROW(ptr)-1)
PrintOut("\"\\");
else
PrintOut("\"");
}
PrintOut( "\n");
}
return;
}
k = 0;
do
{
if (var_pinp)
PrintOut("%d %d %% ", NROW(ptr), NCOL(ptr));
else if (NCOL(ptr) > 8 && !var_rowintime )
PrintOut( "\nColumns %d trough %d\n\n",
k, min(NCOL(ptr) - 1, k + 7));
if (var_pinp || var_rowintime )
sprintf(fmt, "%%.%dg",var_pprec );
else
sprintf(fmt, "%% %d.%dg",var_pprec+7,var_pprec);
for(i = 0; i < NROW(ptr); i++)
{
if ( var_rowintime ) {
for( j=0; j<NCOL(ptr); j++ ) {
if ( j>0 ) PrintOut(" ");
PrintOut( fmt, M(ptr,i,j));
}
} else {
for(j = 0; j < 80/(var_pprec+7) && k + j < NCOL(ptr); j++)
PrintOut( fmt, M(ptr,i,j+k));
if (var_pinp)
if (i < NROW(ptr)-1) PrintOut("\\");
}
PrintOut("\n");
}
k += j;
} while(k < NCOL(ptr));
} | false | false | false | false | true | 1 |
pcm_init()
{
int n;
if (!sound)
{
pcm.hz = 11025;
pcm.len = 4096;
pcm.buf = malloc(pcm.len);
pcm.pos = 0;
dsp = -1;
return;
}
if (!dsp_device) dsp_device = strdup(DSP_DEVICE);
dsp = open(dsp_device, O_WRONLY);
n = 0x80009;
ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &n);
n = AFMT_U8;
ioctl(dsp, SNDCTL_DSP_SETFMT, &n);
n = stereo;
ioctl(dsp, SNDCTL_DSP_STEREO, &n);
pcm.stereo = n;
n = samplerate;
ioctl(dsp, SNDCTL_DSP_SPEED, &n);
pcm.hz = n;
pcm.len = n / 60;
pcm.buf = malloc(pcm.len);
} | false | false | false | false | true | 1 |
_nm_object_set_property (NMObject *object,
const char *interface,
const char *prop_name,
GValue *value)
{
g_return_if_fail (NM_IS_OBJECT (object));
g_return_if_fail (interface != NULL);
g_return_if_fail (prop_name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!dbus_g_proxy_call_with_timeout (NM_OBJECT_GET_PRIVATE (object)->properties_proxy,
"Set", 2000, NULL,
G_TYPE_STRING, interface,
G_TYPE_STRING, prop_name,
G_TYPE_VALUE, value,
G_TYPE_INVALID)) {
/* Ignore errors. dbus_g_proxy_call_with_timeout() is called instead of
* dbus_g_proxy_call_no_reply() to give NM chance to authenticate the caller.
*/
}
} | false | false | false | false | false | 0 |
gretl_lower (char *str)
{
char *p = str;
while (*p) {
if (isupper((unsigned char) *p)) {
*p = tolower(*p);
}
p++;
}
return str;
} | false | false | false | false | false | 0 |
printableHtml(bool withValues) const
{
Q_UNUSED(withValues);
if (m_FormItem->getOptions().contains(Constants::NOT_PRINTABLE))
return QString();
return QString("<table width=100% border=0 cellpadding=0 cellspacing=0 style=\"margin: 0px\">"
"<tbody>"
"<tr>"
"<td style=\"vertical-align: top; padding-left:2em; padding-top:5px; padding-bottom: 5px; padding-right:2em\">"
"%2"
"</td>"
"</tr>"
"</tbody>"
"</table>")
.arg(m_FormItem->spec()->label());
} | false | false | false | false | false | 0 |
comm_open(fde_t *F, int family, int sock_type, int proto, const char *note)
{
int fd;
/* First, make sure we aren't going to run out of file descriptors */
if (number_fd >= hard_fdlimit)
{
errno = ENFILE;
return -1;
}
/*
* Next, we try to open the socket. We *should* drop the reserved FD
* limit if/when we get an error, but we can deal with that later.
* XXX !!! -- adrian
*/
fd = socket(family, sock_type, proto);
if (fd < 0)
return -1; /* errno will be passed through, yay.. */
execute_callback(setup_socket_cb, fd);
/* update things in our fd tracking */
fd_open(F, fd, 1, note);
return 0;
} | false | false | false | false | false | 0 |
go_style_set_marker (GOStyle *style, GOMarker *marker)
{
g_return_if_fail (GO_IS_STYLE (style));
g_return_if_fail (GO_IS_MARKER (marker));
if (style->marker.mark != marker) {
if (style->marker.mark != NULL)
g_object_unref (style->marker.mark);
style->marker.mark = marker;
}
} | false | false | false | false | false | 0 |
aes_cipher_free(aes_cnt_cipher_t *cipher)
{
if (!cipher)
return;
if (cipher->using_evp) {
EVP_CIPHER_CTX_cleanup(&cipher->key.evp);
}
memset(cipher, 0, sizeof(aes_cnt_cipher_t));
tor_free(cipher);
} | false | false | false | false | false | 0 |
VItoLine(VIewobj *vi, char *tmpstr)
{
char *cp;
tmpstr[0] = ' ';
tmpstr[1] = '\0';
strcat(tmpstr, VIgetType(vi));
cp = VIgetLang(vi);
if (cp != NULL && *cp != '\0') {
strcat(tmpstr, " ");
strcat(tmpstr, cp);
}
/** Size **/
cp = VIgetSize(vi);
if (cp != NULL && *cp != '\0') {
strcat(tmpstr, ": <");
strcat(tmpstr, VIgetSize(vi));
strcat(tmpstr, ">");
} else {
strcat(tmpstr, ": ");
}
/** Comments **/
cp = VIgetComments(vi);
if (cp != NULL && *cp != '\0') {
strcat(tmpstr, " ");
strcat(tmpstr, cp);
}
} | 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.