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 |
|---|---|---|---|---|---|---|
workq_init(workq_t *wq, int threads, void (*engine)(void *arg))
{
int status;
status = pthread_attr_init(&wq->attr);
if ( status != 0 ) return(status);
status = pthread_attr_setdetachstate(&wq->attr, PTHREAD_CREATE_DETACHED);
if ( status != 0 ) {
pthread_attr_destroy(&wq->attr);
return(status);
}
#if !defined(__FreeBSD__)
status = pthread_attr_setscope(&wq->attr, PTHREAD_SCOPE_SYSTEM);
if ( status != 0 ) {
pthread_attr_destroy(&wq->attr);
return(status);
}
#endif
status = pthread_mutex_init(&wq->mutex, NULL);
if ( status != 0 ) {
pthread_attr_destroy(&wq->attr);
return(status);
}
status = pthread_cond_init(&wq->cv, NULL);
if ( status != 0 ) {
pthread_attr_destroy(&wq->attr);
pthread_mutex_destroy(&wq->mutex);
return(status);
}
wq->quit = 0;
wq->first = wq->last = NULL;
wq->parallelism = threads;
wq->counter = 0;
wq->idle = 0;
wq->engine = engine;
wq->valid = WORKQ_VALID;
return(0);
} | false | false | false | false | false | 0 |
createOrDie(const std::vector<std::string> &Paths) {
std::string Error;
if (auto SCL = create(Paths, Error))
return SCL;
report_fatal_error(Error);
} | false | false | false | false | false | 0 |
ftpListDir(FtpStateData * ftpState)
{
if (ftpState->flags.dir_slash) {
debug(9, 3) ("Directory path did not end in /\n");
strCat(ftpState->title_url, "/");
ftpState->flags.isdir = 1;
}
ftpSendPasv(ftpState);
} | false | false | false | false | false | 0 |
print_CRT_primes (const int verbosity, const char *prefix,
const mpzspm_t ntt_context)
{
double modbits = 0.;
unsigned int i;
if (test_verbose (verbosity))
{
outputf (verbosity, "%s%lu", prefix, ntt_context->spm[0]->sp);
modbits += log ((double) ntt_context->spm[0]->sp);
for (i = 1; i < ntt_context->sp_num; i++)
{
outputf (verbosity, " * %lu", ntt_context->spm[i]->sp);
modbits += log ((double) ntt_context->spm[i]->sp);
}
outputf (verbosity, ", has %d primes, %f bits\n",
ntt_context->sp_num, modbits / log (2.));
}
} | false | false | false | false | false | 0 |
zd_usb_iowrite16v_async_start(struct zd_usb *usb)
{
ZD_ASSERT(usb_anchor_empty(&usb->submitted_cmds));
ZD_ASSERT(usb->urb_async_waiting == NULL);
ZD_ASSERT(!usb->in_async);
ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex));
usb->in_async = 1;
usb->cmd_error = 0;
usb->urb_async_waiting = NULL;
} | false | false | false | false | false | 0 |
event(QEvent* e)
{
if (e->type() == QEvent::ToolTip) {
QPoint pos = ((QHelpEvent*) e)->pos();
e->setAccepted(maybeTip(pos));
return true;
}
return Q3ListView::event(e);
} | false | false | false | false | false | 0 |
fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
char *s;
if((s = ldif_put(LDIF_PUT_VALUE, name, val, len)) == NULL)
return(-1);
fputs(s, f);
ber_memfree(s);
return(0);
} | false | false | false | false | false | 0 |
add_next_index_long(zval *arg, long n) /* {{{ */
{
zval *tmp;
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, n);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
} | false | false | false | false | false | 0 |
window_menu_size_allocate (PanelApplet *applet,
GtkAllocation *allocation,
WindowMenu *window_menu)
{
PanelAppletOrient orient;
GList *children;
GtkWidget *child;
orient = panel_applet_get_orient (applet);
children = gtk_container_get_children (GTK_CONTAINER (window_menu->selector));
child = GTK_WIDGET (children->data);
g_list_free (children);
if (orient == PANEL_APPLET_ORIENT_LEFT ||
orient == PANEL_APPLET_ORIENT_RIGHT) {
if (window_menu->size == allocation->width &&
orient == window_menu->orient)
return;
window_menu->size = allocation->width;
gtk_widget_set_size_request (child, window_menu->size, -1);
} else {
if (window_menu->size == allocation->height &&
orient == window_menu->orient)
return;
window_menu->size = allocation->height;
gtk_widget_set_size_request (child, -1, window_menu->size);
}
window_menu->orient = orient;
} | false | false | false | false | false | 0 |
sge_error_to_answer_list(sge_error_class_t *eh, lList **alpp, bool clear_errors) {
sge_error_iterator_class_t *iter = NULL;
if (eh == NULL || alpp == NULL) {
return;
}
iter = eh->iterator(eh);
while (iter && iter->next(iter)) {
answer_list_add(alpp,
iter->get_message(iter),
iter->get_type(iter),
(answer_quality_t)iter->get_quality(iter));
}
if (clear_errors) {
sge_error_class_clear(eh);
}
sge_error_iterator_class_destroy(&iter);
} | false | false | false | false | false | 0 |
fiL2FloatDist(float *u0, float *u1, int i0, int j0, int i1, int j1,
int xradius, int yradius, int width0, int width1)
{
float dist = 0.0f;
for(int s = -yradius; s <= yradius; s++) {
int l = (j0 + s) * width0 + (i0 - xradius);
float *ptr0 = &u0[l];
l = (j1 + s) * width1 + (i1 - xradius);
float *ptr1 = &u1[l];
for(int r = -xradius; r <= xradius; r++, ptr0++, ptr1++) {
float dif = (*ptr0 - *ptr1);
dist += (dif * dif);
}
}
return dist;
} | false | false | false | false | false | 0 |
L5()
{register object *base=vs_base;
register object *sup=base+VM5; VC5
vs_check;
bds_check;
bds_bind(((object)VV[3]),base[0]);
vs_top=sup;
goto TTL;
TTL:;
if(!(immnum_plusp((((object)VV[3])->s.s_dbind)))){
goto T9;}{object V5;
V5= (((object)VV[3])->s.s_dbind);
V6= immnum_plus((((object)VV[4])->s.s_dbind),small_fixnum(1));
if(!(immnum_lt(V5,/* INLINE-ARGS */V6))){
goto T9;}}
{object V7;
V8= immnum_minus((((object)VV[3])->s.s_dbind),small_fixnum(1));
V7= (*(LnkLI72))(/* INLINE-ARGS */V8,(((object)VV[5])->s.s_dbind));
base[1]= (V7);
vs_top=(vs_base=base+1)+1;
(void) (*Lnk73)();
bds_unwind1;
return;}
goto T9;
T9:;
base[1]= Ct;
base[2]= ((object)VV[6]);
vs_top=(vs_base=base+1)+2;
Lformat();
bds_unwind1;
return;
} | false | false | false | false | false | 0 |
threadpool_jobs_dec (MonoObject *obj)
{
MonoDomain *domain;
int remaining_jobs;
if (obj == NULL)
return FALSE;
domain = obj->vtable->domain;
remaining_jobs = InterlockedDecrement (&domain->threadpool_jobs);
if (remaining_jobs == 0 && domain->cleanup_semaphore) {
ReleaseSemaphore (domain->cleanup_semaphore, 1, NULL);
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
foo_scroll_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
GdkRectangle new_viewport;
GdkRectangle old_viewport;
cairo_region_t *old_allocation;
cairo_region_t *invalid;
GtkAllocation widget_allocation;
get_viewport (scroll_area, &old_viewport);
gtk_widget_get_allocation (widget, &widget_allocation);
old_allocation = cairo_region_create_rectangle (&widget_allocation);
cairo_region_translate (old_allocation,
-widget_allocation.x, -widget_allocation.y);
invalid = cairo_region_create_rectangle (allocation);
cairo_region_translate (invalid, -allocation->x, -allocation->y);
_cairo_region_xor (invalid, old_allocation);
allocation_to_canvas_region (scroll_area, invalid);
foo_scroll_area_invalidate_region (scroll_area, invalid);
cairo_region_destroy (old_allocation);
cairo_region_destroy (invalid);
gtk_widget_set_allocation (widget, allocation);
if (scroll_area->priv->input_window)
{
cairo_surface_t *new_surface;
gdk_window_move_resize (scroll_area->priv->input_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
new_surface = create_new_surface (widget, scroll_area->priv->surface);
cairo_surface_destroy (scroll_area->priv->surface);
scroll_area->priv->surface = new_surface;
}
get_viewport (scroll_area, &new_viewport);
emit_viewport_changed (scroll_area, &new_viewport, &old_viewport);
} | false | false | false | false | false | 0 |
imFileOpen(const char* file_name, int *error)
{
assert(file_name);
imFileFormatBase* ifileformat = imFileFormatBaseOpen(file_name, error);
if (!ifileformat)
return NULL;
imFileClear(ifileformat);
ifileformat->attrib_table = new imAttribTable(599);
imFileSetBaseAttributes(ifileformat);
ifileformat->counter = imCounterBegin(file_name);
return ifileformat;
} | false | false | false | false | false | 0 |
get_line( FILE* param_file )
{
char line[255];
f_line* formated_line = new f_line();
bool found_interpretable_line = false;
while ( !feof( param_file ) && !found_interpretable_line )
{
if ( !fgets( line, 255, param_file ) )
{
delete formated_line;
return NULL;
}
format_line( formated_line, line, &found_interpretable_line );
}
if ( found_interpretable_line )
{
return formated_line;
}
else
{
delete formated_line;
return NULL;
}
} | false | false | false | false | false | 0 |
player_display_padlock_view()
{
int padlock_view_index=0;
if ( Viewer_mode & VM_PADLOCK_UP ) {
padlock_view_index = 0;
} else if ( Viewer_mode & VM_PADLOCK_REAR ) {
padlock_view_index = 1;
} else if ( Viewer_mode & VM_PADLOCK_LEFT ) {
padlock_view_index = 2;
} else if ( Viewer_mode & VM_PADLOCK_RIGHT ) {
padlock_view_index = 3;
} else {
Int3();
return;
}
char str[128];
if ( !(Viewer_mode & (VM_CHASE|VM_EXTERNAL)) ) {
switch (padlock_view_index) {
case 0:
strcpy_s(str, XSTR( "top view", 101)); break;
case 1:
strcpy_s(str, XSTR( "rear view", 102)); break;
case 2:
strcpy_s(str, XSTR( "left view", 103)); break;
case 3:
strcpy_s(str, XSTR( "right view", 104)); break;
}
color col;
gr_init_color(&col, 0, 255, 0);
HUD_fixed_printf(0.01f, col, str);
}
} | false | false | false | false | false | 0 |
OnKochConf()
{
Datafile cfg = get_configuration();
sec_it this_sec = cfg.section("Koch");
cin.ignore();
update_option(this_sec->option("Chars"), insert_chars);
update_option(this_sec->option("StringsNumber"), insert_strnum);
update_option(this_sec->option("StringLength"), insert_strlen);
update_option(this_sec->option("StartSpeed"), insert_wpm);
update_option(this_sec->option("Skill"), insert_pos);
update_option(this_sec->option("Difficulty"), insert_pos);
} | false | false | false | false | false | 0 |
dbus_server_setup_with_g_main (DBusServer *server,
GMainContext *context)
{
ConnectionSetup *old_setup;
ConnectionSetup *cs;
/* FIXME we never free the slot, so its refcount just keeps growing,
* which is kind of broken.
*/
dbus_server_allocate_data_slot (&server_slot);
if (server_slot < 0)
goto nomem;
if (context == NULL)
context = g_main_context_default ();
cs = NULL;
old_setup = dbus_server_get_data (server, server_slot);
if (old_setup != NULL)
{
if (old_setup->context == context)
return; /* nothing to do */
cs = connection_setup_new_from_old (context, old_setup);
/* Nuke the old setup */
if (!dbus_server_set_data (server, server_slot, NULL, NULL))
goto nomem;
old_setup = NULL;
}
if (cs == NULL)
cs = connection_setup_new (context, NULL);
if (!dbus_server_set_data (server, server_slot, cs,
(DBusFreeFunction)connection_setup_free))
goto nomem;
if (!dbus_server_set_watch_functions (server,
add_watch,
remove_watch,
watch_toggled,
cs, NULL))
goto nomem;
if (!dbus_server_set_timeout_functions (server,
add_timeout,
remove_timeout,
timeout_toggled,
cs, NULL))
goto nomem;
return;
nomem:
g_error ("Not enough memory to set up DBusServer for use with GLib");
} | false | false | false | false | false | 0 |
getResult(int target, Route *result) {
int lTarget = target;
int allocSize = 10;
int *route = malloc(sizeof(int)*allocSize);
int i = 0;
int count = 0;
// Node is not part of the graph
if(target >= result->countNodes) {
printf("ERROR!. The target does not exist.\n");
} else {
int success = 1;
// Traverse through predecessor array
while(lTarget != 0) {
// Add new stop on the route
route[count] = lTarget;
count++;
// Get more memory
if(count == allocSize){
allocSize = allocSize*2;
route = realloc(route, sizeof(int)*allocSize);
}
lTarget = result->predec[lTarget];
if(lTarget == -1){
lTarget = 0;
success = 0;
}
}
if (success) {
route[count] = 0;
printf("The distance from the start node to node %d is: %d\n", target, result->distance[target]);
printf("The best route: ");
// Print route backwards
for (i = count; i >= 0; i--) {
if (i == 0) {
printf("%d", route[i]);
} else {
printf("%d >> ", route[i]);
}
}
} else {
printf("There does not exist any way from the start node to node %d.", target);
}
printf("\n");
free(route);
}
} | false | false | false | false | false | 0 |
getProperty(const char *key, const char *dflt) const
{
map<string, string>::const_iterator i;
i = property_map.find(key);
return i == property_map.end() ? dflt : (*i).second.c_str();
} | false | false | false | false | false | 0 |
addGlobalVariable(DIGlobalVariable DIG) {
if (!DIDescriptor(DIG).isGlobalVariable())
return false;
if (!NodesSeen.insert(DIG))
return false;
GVs.push_back(DIG);
return true;
} | false | false | false | false | false | 0 |
parport_cs_release(struct pcmcia_device *link)
{
parport_info_t *info = link->priv;
dev_dbg(&link->dev, "parport_release\n");
if (info->ndev) {
struct parport *p = info->port;
parport_pc_unregister_port(p);
}
info->ndev = 0;
pcmcia_disable_device(link);
} | false | false | false | false | false | 0 |
SetClockAlarm(unset)
bool unset; /* unset alarm if none needed */
{
if (TimeDisplayed && UpdFreq != 0)
(void) alarm((unsigned) (UpdFreq - (time((time_t *)NULL) % UpdFreq)));
else if (unset)
alarm((unsigned)0);
} | false | false | false | false | false | 0 |
uninstall_style_scheme (const gchar *id)
{
GtkSourceStyleSchemeManager *manager;
GtkSourceStyleScheme *scheme;
const gchar *filename;
g_return_val_if_fail (id != NULL, FALSE);
manager = gtk_source_style_scheme_manager_get_default ();
scheme = gtk_source_style_scheme_manager_get_scheme (manager, id);
if (scheme == NULL)
return FALSE;
filename = gtk_source_style_scheme_get_filename (scheme);
if (filename == NULL)
return FALSE;
if (g_unlink (filename) == -1)
return FALSE;
/* Reload the available style schemes */
gtk_source_style_scheme_manager_force_rescan (manager);
return TRUE;
} | false | false | false | false | false | 0 |
FAMClose(FAMConnection* fc)
{
delete (Client *)fc->client;
return(0);
} | false | false | false | false | false | 0 |
assemoutWriteNextSam(AjPOutfile outfile, const AjPAssem assem)
{
AjPFile outf = ajOutfileGetFile(outfile);
AjPAssemContig c = NULL;
AjPAssemRead r = NULL;
AjPAssemTag t = NULL;
AjPAssemContig* contigs = NULL;
AjIList j = NULL;
AjPStr argstr = NULL;
const AjPStr headertext = NULL;
ajint n = 0;
ajulong i = 0UL;
AjBool ret = ajTrue;
if(!outf || !assem)
return ajFalse;
ajDebug("assemoutWriteSam: # of contigs = %d\n", n);
if(!assem->Hasdata)
{
ajFmtPrintF(outf, "@HD\tVN:1.3\tSO:%s\n", ajAssemGetSortorderC(assem));
/* Program record */
argstr = ajStrNewS(ajUtilGetCmdline());
ajStrExchangeKK(&argstr, '\n', ' ');
ajFmtPrintF(outf, "@PG\tID:%S\tVN:%S\tCL:%S\n",
ajUtilGetProgram(), ajNamValueVersion(), argstr);
ajStrDel(&argstr);
if(ajListGetLength(assem->ContigsOrder))
ajListToarray(assem->ContigsOrder, (void***)&contigs);
else
ajTableToarrayValues(assem->Contigs, (void***)&contigs);
while (contigs[i]) /* contigs */
{
c = contigs[i++];
if(!ajStrMatchC(c->Name, "*"))
{
ajFmtPrintF(outf, "@SQ\tSN:%S\tLN:%d", c->Name, c->Length);
if(c->URI)
ajFmtPrintF(outf, "\tUR:%S", c->URI);
if(c->MD5)
ajFmtPrintF(outf, "\tM5:%S", c->MD5);
if(c->Species)
ajFmtPrintF(outf, "\tSP:%S", c->Species);
ajFmtPrintF(outf, "\n");
j = ajListIterNewread(c->Tags);
while (!ajListIterDone(j))
{
t = ajListIterGet(j);
ajFmtPrintF(outf, "@CO\t%S %u %u %S\n",
t->Name, t->x1, t->y1,
t->Comment);
}
ajListIterDel(&j);
}
}
headertext = assemSAMGetReadgroupHeaderlines(assem);
if(headertext)
ajFmtPrintF(outf,"%S", headertext);
AJFREE(contigs);
if(!assem->BamHeader)
return ajTrue;
}
/* data */
j = ajListIterNewread(assem->Reads);
if(ajListGetLength(assem->ContigsOrder))
i = ajListToarray(assem->ContigsOrder, (void***)&contigs);
else
i = ajTableToarrayValues(assem->Contigs, (void***)&contigs);
while (!ajListIterDone(j)) /* reads */
{
r = ajListIterGet(j);
assemoutWriteSamAlignment(outf, r, contigs, (ajuint) i);
}
ajListIterDel(&j);
AJFREE(contigs);
return ret;
} | false | false | false | false | false | 0 |
uvd_v4_2_set_dcm(struct amdgpu_device *adev,
bool sw_mode)
{
u32 tmp, tmp2;
tmp = RREG32(mmUVD_CGC_CTRL);
tmp &= ~(UVD_CGC_CTRL__CLK_OFF_DELAY_MASK | UVD_CGC_CTRL__CLK_GATE_DLY_TIMER_MASK);
tmp |= UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK |
(1 << UVD_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT) |
(4 << UVD_CGC_CTRL__CLK_OFF_DELAY__SHIFT);
if (sw_mode) {
tmp &= ~0x7ffff800;
tmp2 = UVD_CGC_CTRL2__DYN_OCLK_RAMP_EN_MASK |
UVD_CGC_CTRL2__DYN_RCLK_RAMP_EN_MASK |
(7 << UVD_CGC_CTRL2__GATER_DIV_ID__SHIFT);
} else {
tmp |= 0x7ffff800;
tmp2 = 0;
}
WREG32(mmUVD_CGC_CTRL, tmp);
WREG32_UVD_CTX(ixUVD_CGC_CTRL2, tmp2);
} | false | false | false | false | false | 0 |
php_network_connect_socket(php_socket_t sockfd,
const struct sockaddr *addr,
socklen_t addrlen,
int asynchronous,
struct timeval *timeout,
char **error_string,
int *error_code)
{
#if HAVE_NON_BLOCKING_CONNECT
php_non_blocking_flags_t orig_flags;
int n;
int error = 0;
socklen_t len;
int ret = 0;
SET_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
if ((n = connect(sockfd, addr, addrlen)) != 0) {
error = php_socket_errno();
if (error_code) {
*error_code = error;
}
if (error != EINPROGRESS) {
if (error_string) {
*error_string = php_socket_strerror(error, NULL, 0);
}
return -1;
}
if (asynchronous && error == EINPROGRESS) {
/* this is fine by us */
return 0;
}
}
if (n == 0) {
goto ok;
}
if ((n = php_pollfd_for(sockfd, PHP_POLLREADABLE|POLLOUT, timeout)) == 0) {
error = PHP_TIMEOUT_ERROR_VALUE;
}
if (n > 0) {
len = sizeof(error);
/*
BSD-derived systems set errno correctly
Solaris returns -1 from getsockopt in case of error
*/
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) != 0) {
ret = -1;
}
} else {
/* whoops: sockfd has disappeared */
ret = -1;
}
ok:
if (!asynchronous) {
/* back to blocking mode */
RESTORE_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
}
if (error_code) {
*error_code = error;
}
if (error && error_string) {
*error_string = php_socket_strerror(error, NULL, 0);
ret = -1;
}
return ret;
#else
if (asynchronous) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Asynchronous connect() not supported on this platform");
}
return (connect(sockfd, addr, addrlen) == 0) ? 0 : -1;
#endif
} | false | false | false | false | false | 0 |
assert_comments_equal (GDataComment *new_comment, GDataPicasaWebComment *original_comment)
{
GList *authors;
GDataAuthor *author;
g_assert (GDATA_IS_PICASAWEB_COMMENT (new_comment));
g_assert (GDATA_IS_PICASAWEB_COMMENT (original_comment));
g_assert (GDATA_PICASAWEB_COMMENT (new_comment) != original_comment);
g_assert_cmpstr (gdata_entry_get_content (GDATA_ENTRY (new_comment)), ==, gdata_entry_get_content (GDATA_ENTRY (original_comment)));
/* Check the author of the new comment. */
authors = gdata_entry_get_authors (GDATA_ENTRY (new_comment));
g_assert_cmpuint (g_list_length (authors), ==, 1);
author = GDATA_AUTHOR (authors->data);
g_assert_cmpstr (gdata_author_get_name (author), ==, "libgdata.picasaweb");
g_assert_cmpstr (gdata_author_get_uri (author), ==, "https://picasaweb.google.com/libgdata.picasaweb");
} | false | false | false | false | false | 0 |
set_changed(bool changed) {
if (!changed) {
for (pref_map_t::iterator it = _pref_map_old.begin();it != _pref_map_old.end();) {
ProfileValue *value = _pref_map_old[(*it).first];
// Need to increment it before actually erasing the value from the map
// but pass the old value to the erase call!
_pref_map_old.erase(it++);
if (value != NULL) {
delete value;
}
}
}
_changed = changed;
} | false | false | false | false | false | 0 |
sec_pkcs12_set_nickname_for_cert(sec_PKCS12SafeBag *cert,
sec_PKCS12SafeBag *key,
SECItem *nickname)
{
if(!nickname || !cert) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
if(sec_pkcs12_set_nickname(cert, nickname) != SECSuccess) {
return SECFailure;
}
if(key) {
if(sec_pkcs12_set_nickname(key, nickname) != SECSuccess) {
cert->problem = PR_TRUE;
cert->error = key->error;
return SECFailure;
}
}
return SECSuccess;
} | false | false | false | false | false | 0 |
init_tmds_chip_info(void)
{
viafb_tmds_trasmitter_identify();
if (INTERFACE_NONE == viaparinfo->chip_info->tmds_chip_info.
output_interface) {
switch (viaparinfo->chip_info->gfx_chip_name) {
case UNICHROME_CX700:
{
/* we should check support by hardware layout.*/
if ((viafb_display_hardware_layout ==
HW_LAYOUT_DVI_ONLY)
|| (viafb_display_hardware_layout ==
HW_LAYOUT_LCD_DVI)) {
viaparinfo->chip_info->tmds_chip_info.
output_interface = INTERFACE_TMDS;
} else {
viaparinfo->chip_info->tmds_chip_info.
output_interface =
INTERFACE_NONE;
}
break;
}
case UNICHROME_K8M890:
case UNICHROME_P4M900:
case UNICHROME_P4M890:
/* TMDS on PCIE, we set DFPLOW as default. */
viaparinfo->chip_info->tmds_chip_info.output_interface =
INTERFACE_DFP_LOW;
break;
default:
{
/* set DVP1 default for DVI */
viaparinfo->chip_info->tmds_chip_info
.output_interface = INTERFACE_DVP1;
}
}
}
DEBUG_MSG(KERN_INFO "TMDS Chip = %d\n",
viaparinfo->chip_info->tmds_chip_info.tmds_chip_name);
viafb_init_dvi_size(&viaparinfo->shared->chip_info.tmds_chip_info,
&viaparinfo->shared->tmds_setting_info);
} | false | false | false | false | false | 0 |
sourcerc(int *argc_ptr, char ***argv_ptr)
{
char *env;
int xargc = 1;
char **xargv;
xargv = xmalloc(2*sizeof *xargv);
xargv[0] = **argv_ptr;
xargv[1] = NULL;
env = getenv("CFLOW_OPTIONS");
if (env) {
int argc;
char **argv;
argcv_get(env, "", "#", &argc, &argv);
expand_argcv(&xargc, &xargv, argc, argv);
free(argv);
}
env = getenv("CFLOWRC");
if (env)
parse_rc(&xargc, &xargv, env);
else {
char *home = getenv("HOME");
if (home) {
int len = strlen(home);
char *buf = malloc(len + sizeof(LOCAL_RC)
+ (home[len-1] != '/') );
if (!buf)
return;
strcpy(buf, home);
if (home[len-1] != '/')
buf[len++] = '/';
strcpy(buf+len, LOCAL_RC);
parse_rc(&xargc, &xargv, buf);
free(buf);
}
}
if (xargc > 1) {
expand_argcv(&xargc, &xargv, *argc_ptr-1, *argv_ptr+1);
*argc_ptr = xargc;
*argv_ptr = xargv;
}
} | false | false | false | false | false | 0 |
create_auto_update (GtkWidget *vbox)
{
GtkWidget *label;
GtkWidget *box;
guint i;
/* auto update */
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), _("<b>Auto-Update:</b>"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
/* frequency */
freq = gtk_combo_box_new_text ();
for (i = 0; i < TLE_AUTO_UPDATE_NUM; i++) {
gtk_combo_box_append_text (GTK_COMBO_BOX (freq),
tle_update_freq_to_str (i));
}
gtk_combo_box_set_active (GTK_COMBO_BOX (freq),
sat_cfg_get_int (SAT_CFG_INT_TLE_AUTO_UPD_FREQ));
g_signal_connect (freq, "changed", G_CALLBACK (value_changed_cb), NULL);
label = gtk_label_new (_("Check the age of TLE data:"));
box = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), freq, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE, 0);
/* radio buttons selecting action */
label = gtk_label_new (_("If TLEs are too old:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
warn = gtk_radio_button_new_with_label (NULL,
_("Notify me"));
gtk_box_pack_start (GTK_BOX (vbox), warn, FALSE, TRUE, 0);
autom = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (warn),
_("Perform automatic update in the background"));
gtk_box_pack_start (GTK_BOX (vbox), autom, FALSE, TRUE, 0);
/* warn is selected automatically by default */
if (sat_cfg_get_int (SAT_CFG_INT_TLE_AUTO_UPD_ACTION) == TLE_AUTO_UPDATE_GOAHEAD) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autom), TRUE);
}
g_signal_connect (warn, "toggled", G_CALLBACK (value_changed_cb), NULL);
g_signal_connect (autom, "toggled", G_CALLBACK (value_changed_cb), NULL);
} | false | false | false | false | false | 0 |
afr_sh_entry_impunge_parent_setattr_cbk (call_frame_t *setattr_frame,
void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *preop, struct iatt *postop)
{
loc_t *parent_loc = cookie;
if (op_ret != 0) {
gf_log (this->name, GF_LOG_INFO,
"setattr on parent directory (%s) failed: %s",
parent_loc->path, strerror (op_errno));
}
loc_wipe (parent_loc);
GF_FREE (parent_loc);
AFR_STACK_DESTROY (setattr_frame);
return 0;
} | false | false | false | false | false | 0 |
compare_face(const New_Face *a, const New_Face *b) {
if (strcmp(a->name, "bug.111") == 0) {
if (strcmp(b->name, "bug.111") == 0)
return 0;
return -1;
} else if (strcmp(b->name, "bug.111") == 0)
return 1;
return strcmp(a->name, b->name);
} | false | false | false | false | false | 0 |
determineRelativePath( const QString & path )
{
// now let's make it relative
d->m_sRelativePath = KGlobal::dirs()->relativeLocation("apps", path);
if (d->m_sRelativePath.startsWith('/'))
{
d->m_sRelativePath =KGlobal::dirs()->relativeLocation("xdgdata-apps", path);
if (d->m_sRelativePath.startsWith('/'))
d->m_sRelativePath.clear();
else
d->m_sRelativePath = path;
}
} | false | false | false | false | false | 0 |
getValue(unsigned int i) const
{
Node const *child = _view->stochasticChildren()[i];
double y = child->value(_chain)[0];
if (_family[i] == GLM_BINOMIAL) {
double N = child->parents()[1]->value(_chain)[0];
y /= N;
}
if (_link[i] == 0) {
return y;
}
else {
double mu = _link[i]->value(_chain)[0];
double eta = _link[i]->eta(_chain);
double grad = _link[i]->grad(_chain);
return eta + (y - mu) / grad;
}
} | false | false | false | false | false | 0 |
nes_store_ee_cmd(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
u32 val;
u32 i = 0;
struct nes_device *nesdev;
if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
val = simple_strtoul(p, &p, 16);
list_for_each_entry(nesdev, &nes_dev_list, list) {
if (i == ee_flsh_adapter) {
nes_write32(nesdev->regs + NES_EEPROM_COMMAND, val);
break;
}
i++;
}
}
return strnlen(buf, count);
} | false | false | false | false | false | 0 |
rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
{ /* exclude ICV */
unsigned char crc[4];
struct arc4context mycontext;
int curfragnum, length;
u32 keylength;
u8 *pframe, *payload, *iv; /* wepkey */
u8 wepkey[16];
u8 hw_hdr_offset = 0;
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
return;
hw_hdr_offset = TXDESC_SIZE +
(((struct xmit_frame *)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ);
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
/* start to encrypt each fragment */
if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) {
keylength = psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex];
for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
iv = pframe+pattrib->hdrlen;
memcpy(&wepkey[0], iv, 3);
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0], keylength);
payload = pframe+pattrib->iv_len+pattrib->hdrlen;
if ((curfragnum+1) == pattrib->nr_frags) { /* the last fragment */
length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
*((__le32 *)crc) = getcrc32(payload, length);
arcfour_init(&mycontext, wepkey, 3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4);
} else {
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
*((__le32 *)crc) = getcrc32(payload, length);
arcfour_init(&mycontext, wepkey, 3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4);
pframe += pxmitpriv->frag_len;
pframe = (u8 *)round_up((size_t)(pframe), 4);
}
}
}
} | false | false | false | false | false | 0 |
commit(bool flush) {
std::string p = filenamePath(filename);
if (! fileExists(p, false)) {
createDirectory(p);
}
FILE* f = fopen(filename.c_str(), "wb");
debugAssertM(f, "Could not open \"" + filename + "\"");
fwrite(data.getCArray(), 1, data.size(), f);
if (flush) {
fflush(f);
}
fclose(f);
} | false | false | false | false | true | 1 |
add_ip_list_range(char* range, ip_range_list_t * list)
{
char* separator = strchr(range, '-');
if (separator) {
*separator = '\0';
}
ioa_addr min, max;
if (make_ioa_addr((const u08bits*) range, 0, &min) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong address format: %s\n", range);
return -1;
}
if (separator) {
if (make_ioa_addr((const u08bits*) separator + 1, 0, &max) < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong address format: %s\n", separator + 1);
return -1;
}
} else {
// Doesn't have a '-' character in it, so assume that this is a single address
addr_cpy(&max, &min);
}
if (separator)
*separator = '-';
++(list->ranges_number);
list->ranges = (char**) turn_realloc(list->ranges, 0, sizeof(char*) * list->ranges_number);
list->ranges[list->ranges_number - 1] = turn_strdup(range);
list->encaddrsranges = (ioa_addr_range**) turn_realloc(list->encaddrsranges, 0, sizeof(ioa_addr_range*) * list->ranges_number);
list->encaddrsranges[list->ranges_number - 1] = (ioa_addr_range*) turn_malloc(sizeof(ioa_addr_range));
ioa_addr_range_set(list->encaddrsranges[list->ranges_number - 1], &min, &max);
return 0;
} | false | false | false | false | false | 0 |
read_buffer(SAMPLE_BUFFER* sbuf)
{
/* write to sbuf->buffer[ch], similarly as the LADSPA
* chainops */
sbuf->number_of_channels(channels());
/* set the length according to our buffersize */
if ((ECA_AUDIO_POSITION::length_set() == true) &&
((position_in_samples() + buffersize())
>= ECA_AUDIO_POSITION::length_in_samples())) {
/* over requested duration, adjust buffersize */
SAMPLE_BUFFER::buf_size_t partialbuflen =
ECA_AUDIO_POSITION::length_in_samples()
- position_in_samples();
if (partialbuflen < 0)
partialbuflen = 0;
DBC_CHECK(partialbuflen <= buffersize());
sbuf->length_in_samples(partialbuflen);
sbuf->event_tag_set(SAMPLE_BUFFER::tag_end_of_stream);
finished_rep = true;
}
else
sbuf->length_in_samples(buffersize());
i.init(sbuf);
i.begin();
while(!i.end()) {
for(int n = 0; n < channels(); n++) {
if (i.end())
break;
*(i.current(n))
= g_pfSineTable[m_lPhase >> SINE_TABLE_SHIFT];
}
m_lPhase += m_lPhaseStep;
i.next();
}
change_position_in_samples(sbuf->length_in_samples());
DBC_ENSURE(sbuf->number_of_channels() == channels());
} | false | false | false | false | false | 0 |
db_open_database(JCR *jcr)
{
bool retval = false;
char *db_path;
int len;
struct stat statbuf;
int ret;
int errstat;
int retry = 0;
P(mutex);
if (m_connected) {
retval = true;
goto bail_out;
}
if ((errstat=rwl_init(&m_lock)) != 0) {
berrno be;
Mmsg1(&errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
be.bstrerror(errstat));
goto bail_out;
}
/*
* Open the database
*/
len = strlen(working_directory) + strlen(m_db_name) + 5;
db_path = (char *)malloc(len);
strcpy(db_path, working_directory);
strcat(db_path, "/");
strcat(db_path, m_db_name);
strcat(db_path, ".db");
if (stat(db_path, &statbuf) != 0) {
Mmsg1(&errmsg, _("Database %s does not exist, please create it.\n"),
db_path);
free(db_path);
goto bail_out;
}
for (m_db_handle = NULL; !m_db_handle && retry++ < 10; ) {
ret = sqlite3_open(db_path, &m_db_handle);
if (ret != SQLITE_OK) {
m_sqlite_errmsg = (char *)sqlite3_errmsg(m_db_handle);
sqlite3_close(m_db_handle);
m_db_handle = NULL;
} else {
m_sqlite_errmsg = NULL;
}
Dmsg0(300, "sqlite_open\n");
if (!m_db_handle) {
bmicrosleep(1, 0);
}
}
if (m_db_handle == NULL) {
Mmsg2(&errmsg, _("Unable to open Database=%s. ERR=%s\n"),
db_path, m_sqlite_errmsg ? m_sqlite_errmsg : _("unknown"));
free(db_path);
goto bail_out;
}
m_connected = true;
free(db_path);
/*
* Set busy handler to wait when we use mult_db_connections = true
*/
sqlite3_busy_handler(m_db_handle, sqlite_busy_handler, NULL);
#if defined(SQLITE3_INIT_QUERY)
sql_query(SQLITE3_INIT_QUERY);
#endif
if (!check_tables_version(jcr, this)) {
goto bail_out;
}
retval = true;
bail_out:
V(mutex);
return retval;
} | false | false | false | false | false | 0 |
gck_builder_add_exceptv (GckBuilder *builder,
GckAttributes *attrs,
const gulong *except_types,
guint n_except_types)
{
gulong i;
guint j;
g_return_if_fail (builder != NULL);
g_return_if_fail (attrs != NULL);
for (i = 0; i < attrs->count; i++) {
for (j = 0; j < n_except_types; j++) {
if (attrs->data[i].type == except_types[j])
break;
}
if (j == n_except_types)
builder_copy (builder, &attrs->data[i], FALSE);
}
} | false | false | false | false | false | 0 |
hdb_lock(int fd, int operation)
{
int i, code = 0;
for(i = 0; i < 3; i++){
code = flock(fd, (operation == HDB_RLOCK ? LOCK_SH : LOCK_EX) | LOCK_NB);
if(code == 0 || errno != EWOULDBLOCK)
break;
sleep(1);
}
if(code == 0)
return 0;
if(errno == EWOULDBLOCK)
return HDB_ERR_DB_INUSE;
return HDB_ERR_CANT_LOCK_DB;
} | false | false | false | false | false | 0 |
sort_descending(GeneralMatrix& GM)
{
REPORT
Tracer et("sort_descending");
Real* data = GM.Store(); int max = GM.Storage();
if (max > DoSimpleSort) MyQuickSortDescending(data, data + max - 1, 0);
InsertionSortDescending(data, max, DoSimpleSort);
} | false | false | false | false | false | 0 |
build_tree (const char* constraints)
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
guard,
ETCL_Interpreter::parserMutex__,
-1);
Lex_String_Input::reset ((char*)constraints);
yyval.constraint = 0;
int return_value = ::yyparse ();
if (return_value == 0 && yyval.constraint != 0)
{
this->root_ = yyval.constraint;
}
else
{
this->root_ = 0;
}
return return_value;
} | false | false | false | false | false | 0 |
recvv (iovec iov[],
int iovcnt,
const ACE_Time_Value *timeout)
{
ssize_t result = 0;
if (this->pre_recv() == -1)
return -1;
if (this->leftovers_.length())
{
int ndx = 0;
iovec *iov2 = new iovec[iovcnt];
ACE_Auto_Array_Ptr<iovec> guard (iov2);
for (int i = 0; i < iovcnt; i++)
{
size_t n = ACE_MIN ((size_t) iov[i].iov_len ,
(size_t) this->leftovers_.length());
if (n > 0)
{
ACE_OS::memcpy (iov[i].iov_base,this->leftovers_.rd_ptr(), n);
this->leftovers_.rd_ptr(n);
result += n;
}
if (n < (size_t) iov[i].iov_len)
{
iov2[ndx].iov_len = iov[i].iov_len - n;
iov2[ndx].iov_base = (char *)iov[i].iov_base + n;
ndx++;
}
}
if (ndx > 0)
result += this->ace_stream_.recvv(iov2,ndx,timeout);
}
else
result = this->ace_stream_.recvv(iov,iovcnt,timeout);
if (result > 0)
this->data_consumed((size_t)result);
return result;
} | false | false | false | false | false | 0 |
setInMotion(bool value)
{
if (m_inMotion == value)
return;
m_inMotion = value;
if (m_inMotion) { // record the above widget and put itself in the stack top
QWidget *parent = parentWidget();
m_aboveWidget = 0;
for (int index = parent->children().indexOf(this) + 1; index < parent->children().count(); index++) {
QWidget *widget = qobject_cast<QWidget*>(parent->children()[index]);
if (widget) {
m_aboveWidget = widget;
break;
}
}
raise();
} else { // restore the widget in the stack
if (m_aboveWidget)
stackUnder(m_aboveWidget);
}
} | false | false | false | false | false | 0 |
set_ref_in_item(tv, copyID)
typval_T *tv;
int copyID;
{
dict_T *dd;
list_T *ll;
switch (tv->v_type)
{
case VAR_DICT:
dd = tv->vval.v_dict;
if (dd != NULL && dd->dv_copyID != copyID)
{
/* Didn't see this dict yet. */
dd->dv_copyID = copyID;
set_ref_in_ht(&dd->dv_hashtab, copyID);
}
break;
case VAR_LIST:
ll = tv->vval.v_list;
if (ll != NULL && ll->lv_copyID != copyID)
{
/* Didn't see this list yet. */
ll->lv_copyID = copyID;
set_ref_in_list(ll, copyID);
}
break;
}
return;
} | false | false | false | false | false | 0 |
stencil(
const Bitmap* mask, const Color* color, Coord x, Coord y
) {
PrinterRep* p = rep_;
ostream& out = *p->out_;
flush();
PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1);
if (info.color_ != color) {
do_color(out, color);
info.color_ = color;
}
unsigned long width = mask->pwidth();
unsigned long height = mask->pheight();
unsigned long bytes = (width-1)/8 + 1;
Coord left = x - mask->left_bearing();
Coord right = x + mask->right_bearing();
Coord bottom = y - mask->descent();
Coord top = y + mask->ascent();
out << "gsave\n";
out << "/picstr " << bytes << " string def\n";
out << (double)left << " " << (double)bottom << " translate\n";
out << (double)right - left << " " << (double)top - bottom << " scale\n";
out << (double)width << " " << (double)height << " true\n";
out << "[" << (double)width << " 0 0 " << (double)height << " 0 0]\n";
out << "{currentfile picstr readhexstring pop} imagemask\n";
#ifndef __GNUC__
int old_width = out.width(1);
out << hex;
#endif
for (int iy = 0; iy < height; ++iy) {
for (int ix = 0; ix < bytes; ++ix) {
int byte = 0;
for (int bit = 0; bit < 8; ++bit) {
if (mask->peek(ix*8 + bit, iy)) {
byte |= 0x80 >> bit;
}
}
#ifdef __GNUC__
out_form(out, "%02x", byte);
#else
out << ((byte>>4) & 0x0f) << (byte & 0x0f);
#endif
}
out << "\n";
}
#ifndef __GNUC__
out << dec;
out.width(old_width);
#endif
out << "grestore\n";
} | false | false | false | false | false | 0 |
halfacceptor_dinucleotide (char *acceptor2, char *acceptor1, Substring_T acceptor) {
bool sensep;
char *genomic;
int substring_start, substring_length;
sensep = Substring_chimera_sensep(acceptor);
substring_start = Substring_querystart(acceptor);
genomic = Substring_genomic_refdiff(acceptor);
if (sensep == true) {
*acceptor2 = toupper(genomic[substring_start-2]);
*acceptor1 = toupper(genomic[substring_start-1]);
} else { /* sensep == false */
substring_length = Substring_match_length(acceptor);
*acceptor1 = toupper(complCode[(int) genomic[substring_start+substring_length]]);
*acceptor2 = toupper(complCode[(int) genomic[substring_start+substring_length+1]]);
}
return;
} | false | false | false | false | false | 0 |
find_insn_decl (const char *name)
{
void *entry;
work_insn_decl.mode = dm_insn_reserv;
DECL_INSN_RESERV (&work_insn_decl)->name = name;
entry = htab_find (insn_decl_table, &work_insn_decl);
return (decl_t) entry;
} | false | false | false | false | false | 0 |
fireArray( const int size, double* vect)
{
for( double* v = vect; v != vect + size; ++v )
*v = fire();
} | false | false | false | false | false | 0 |
foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
unsigned int end, int pass)
{
struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct buffer_head *bh;
struct gfs2_log_descriptor *ld;
int error = 0;
u32 length;
__be64 *ptr;
unsigned int offset = sizeof(struct gfs2_log_descriptor);
offset += sizeof(__be64) - 1;
offset &= ~(sizeof(__be64) - 1);
while (start != end) {
error = gfs2_replay_read_block(jd, start, &bh);
if (error)
return error;
if (gfs2_meta_check(sdp, bh)) {
brelse(bh);
return -EIO;
}
ld = (struct gfs2_log_descriptor *)bh->b_data;
length = be32_to_cpu(ld->ld_length);
if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) {
struct gfs2_log_header_host lh;
error = get_log_header(jd, start, &lh);
if (!error) {
gfs2_replay_incr_blk(sdp, &start);
brelse(bh);
continue;
}
if (error == 1) {
gfs2_consist_inode(GFS2_I(jd->jd_inode));
error = -EIO;
}
brelse(bh);
return error;
} else if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_LD)) {
brelse(bh);
return -EIO;
}
ptr = (__be64 *)(bh->b_data + offset);
error = lops_scan_elements(jd, start, ld, ptr, pass);
if (error) {
brelse(bh);
return error;
}
while (length--)
gfs2_replay_incr_blk(sdp, &start);
brelse(bh);
}
return 0;
} | false | false | false | false | false | 0 |
cut(UT_uint32 /*offset*/, UT_uint32 /*iLen*/, bool /*bReverse*/)
{
if(s_pOwnerUTF8 == this)
s_pOwnerUTF8 = NULL;
if(s_pOwnerLogAttrs == this)
s_pOwnerLogAttrs = NULL;
delete [] m_pLogOffsets; m_pLogOffsets = NULL;
// will be set when shaping
m_iCharCount = 0;
return false;
} | false | false | false | false | false | 0 |
get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
const char *caller)
{
char **labelPtr = NULL;
switch (identifier) {
case GL_BUFFER:
{
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
if (bufObj)
labelPtr = &bufObj->Label;
}
break;
case GL_SHADER:
{
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
if (shader)
labelPtr = &shader->Label;
}
break;
case GL_PROGRAM:
{
struct gl_shader_program *program =
_mesa_lookup_shader_program(ctx, name);
if (program)
labelPtr = &program->Label;
}
break;
case GL_VERTEX_ARRAY:
{
struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, name);
if (obj)
labelPtr = &obj->Label;
}
break;
case GL_QUERY:
{
struct gl_query_object *query = _mesa_lookup_query_object(ctx, name);
if (query)
labelPtr = &query->Label;
}
break;
case GL_TRANSFORM_FEEDBACK:
{
struct gl_transform_feedback_object *tfo =
_mesa_lookup_transform_feedback_object(ctx, name);
if (tfo)
labelPtr = &tfo->Label;
}
break;
case GL_SAMPLER:
{
struct gl_sampler_object *so = _mesa_lookup_samplerobj(ctx, name);
if (so)
labelPtr = &so->Label;
}
break;
case GL_TEXTURE:
{
struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
if (texObj)
labelPtr = &texObj->Label;
}
break;
case GL_RENDERBUFFER:
{
struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
if (rb)
labelPtr = &rb->Label;
}
break;
case GL_FRAMEBUFFER:
{
struct gl_framebuffer *rb = _mesa_lookup_framebuffer(ctx, name);
if (rb)
labelPtr = &rb->Label;
}
break;
case GL_DISPLAY_LIST:
if (ctx->API == API_OPENGL_COMPAT) {
struct gl_display_list *list = _mesa_lookup_list(ctx, name);
if (list)
labelPtr = &list->Label;
}
else {
goto invalid_enum;
}
break;
case GL_PROGRAM_PIPELINE:
/* requires GL 4.2 */
goto invalid_enum;
default:
goto invalid_enum;
}
if (NULL == labelPtr) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(name = %u)", caller, name);
}
return labelPtr;
invalid_enum:
_mesa_error(ctx, GL_INVALID_ENUM, "%s(identifier = %s)",
caller, _mesa_lookup_enum_by_nr(identifier));
return NULL;
} | false | false | false | false | false | 0 |
put_checksum(u8 *check_string, int length)
{
dprintk(verbose, DST_CA_DEBUG, 1, " Computing string checksum.");
dprintk(verbose, DST_CA_DEBUG, 1, " -> string length : 0x%02x", length);
check_string[length] = dst_check_sum (check_string, length);
dprintk(verbose, DST_CA_DEBUG, 1, " -> checksum : 0x%02x", check_string[length]);
} | false | false | false | false | false | 0 |
write() {
if (!filename_) // RUNTIME preferences
return -1;
fl_make_path_for_file(filename_);
FILE *f = fl_fopen( filename_, "wb" );
if ( !f )
return -1;
fprintf( f, "; FLTK preferences file format 1.0\n" );
fprintf( f, "; vendor: %s\n", vendor_ );
fprintf( f, "; application: %s\n", application_ );
prefs_->node->write( f );
fclose( f );
#if !(defined(__APPLE__) || defined(WIN32))
// unix: make sure that system prefs are user-readable
if (strncmp(filename_, "/etc/fltk/", 10) == 0) {
char *p;
p = filename_ + 9;
do { // for each directory to the pref file
*p = 0;
fl_chmod(filename_, 0755); // rwxr-xr-x
*p = '/';
p = strchr(p+1, '/');
} while (p);
fl_chmod(filename_, 0644); // rw-r--r--
}
#endif
return 0;
} | false | false | false | false | false | 0 |
free_texmat_data( struct tnl_pipeline_stage *stage )
{
struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
GLuint i;
if (store) {
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
if (store->texcoord[i].data)
_mesa_vector4f_free( &store->texcoord[i] );
free( store );
stage->privatePtr = NULL;
}
} | false | false | false | false | false | 0 |
archive_match_path_excluded(struct archive *_a,
struct archive_entry *entry)
{
struct archive_match *a;
archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
ARCHIVE_STATE_NEW, "archive_match_path_excluded");
a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
return (ARCHIVE_FAILED);
}
/* If we don't have exclusion/inclusion pattern set at all,
* the entry is always not excluded. */
if ((a->setflag & PATTERN_IS_SET) == 0)
return (0);
#if defined(_WIN32) && !defined(__CYGWIN__)
return (path_excluded(a, 0, archive_entry_pathname_w(entry)));
#else
return (path_excluded(a, 1, archive_entry_pathname(entry)));
#endif
} | false | false | false | false | false | 0 |
gst_type_find_element_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstTypeFindElement *typefind;
typefind = GST_TYPE_FIND_ELEMENT (object);
switch (prop_id) {
case PROP_CAPS:
GST_OBJECT_LOCK (typefind);
g_value_set_boxed (value, typefind->caps);
GST_OBJECT_UNLOCK (typefind);
break;
case PROP_MINIMUM:
g_value_set_uint (value, typefind->min_probability);
break;
case PROP_MAXIMUM:
g_value_set_uint (value, typefind->max_probability);
break;
case PROP_FORCE_CAPS:
GST_OBJECT_LOCK (typefind);
g_value_set_boxed (value, typefind->force_caps);
GST_OBJECT_UNLOCK (typefind);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} | false | false | false | false | false | 0 |
amitk_volumes_get_enclosing_corners(const GList * objects,
const AmitkSpace * space,
AmitkCorners return_corners) {
AmitkCorners temp_corners;
gboolean valid=FALSE;
while (objects != NULL) {
if (AMITK_IS_VOLUME(objects->data)) {
if (AMITK_VOLUME_VALID(objects->data)) {
amitk_volume_get_enclosing_corners(AMITK_VOLUME(objects->data),space,temp_corners);
if (!valid) {
valid = TRUE;
return_corners[0] = temp_corners[0];
return_corners[1] = temp_corners[1];
} else {
return_corners[0].x = (return_corners[0].x < temp_corners[0].x) ? return_corners[0].x : temp_corners[0].x;
return_corners[0].y = (return_corners[0].y < temp_corners[0].y) ? return_corners[0].y : temp_corners[0].y;
return_corners[0].z = (return_corners[0].z < temp_corners[0].z) ? return_corners[0].z : temp_corners[0].z;
return_corners[1].x = (return_corners[1].x > temp_corners[1].x) ? return_corners[1].x : temp_corners[1].x;
return_corners[1].y = (return_corners[1].y > temp_corners[1].y) ? return_corners[1].y : temp_corners[1].y;
return_corners[1].z = (return_corners[1].z > temp_corners[1].z) ? return_corners[1].z : temp_corners[1].z;
}
}
}
objects = objects->next;
}
if (!valid)
return_corners[0] = return_corners[1] = zero_point;
return valid;
} | false | false | false | false | false | 0 |
hotkey_radio_sw_notify_change(void)
{
if (tp_features.hotkey_wlsw)
sysfs_notify(&tpacpi_pdev->dev.kobj, NULL,
"hotkey_radio_sw");
} | false | false | false | false | false | 0 |
renew (int argc, char **argv, OtpAlgorithm *alg, char *inuser)
{
OtpContext newctx, *ctx;
char prompt[128];
char pw[64];
void *dbm;
int ret;
newctx.alg = alg;
newctx.user = inuser;
newctx.n = atoi (argv[0]);
strlcpy (newctx.seed, argv[1], sizeof(newctx.seed));
strlwr(newctx.seed);
snprintf (prompt, sizeof(prompt),
"[ otp-%s %u %s ]",
newctx.alg->name,
newctx.n,
newctx.seed);
if (UI_UTIL_read_pw_string (pw, sizeof(pw), prompt, 0) == 0 &&
otp_parse (newctx.key, pw, alg) == 0) {
ctx = &newctx;
ret = 0;
} else
return 1;
dbm = otp_db_open ();
if (dbm == NULL) {
warnx ("otp_db_open failed");
return 1;
}
otp_put (dbm, ctx);
otp_db_close (dbm);
return ret;
} | false | false | false | false | false | 0 |
add_abstract_origin_attribute (dw_die_ref die, tree origin)
{
dw_die_ref origin_die = NULL;
if (TREE_CODE (origin) != FUNCTION_DECL)
{
/* We may have gotten separated from the block for the inlined
function, if we're in an exception handler or some such; make
sure that the abstract function has been written out.
Doing this for nested functions is wrong, however; functions are
distinct units, and our context might not even be inline. */
tree fn = origin;
if (TYPE_P (fn))
fn = TYPE_STUB_DECL (fn);
fn = decl_function_context (fn);
if (fn)
dwarf2out_abstract_function (fn);
}
if (DECL_P (origin))
origin_die = lookup_decl_die (origin);
else if (TYPE_P (origin))
origin_die = lookup_type_die (origin);
/* XXX: Functions that are never lowered don't always have correct block
trees (in the case of java, they simply have no block tree, in some other
languages). For these functions, there is nothing we can really do to
output correct debug info for inlined functions in all cases. Rather
than die, we'll just produce deficient debug info now, in that we will
have variables without a proper abstract origin. In the future, when all
functions are lowered, we should re-add a gcc_assert (origin_die)
here. */
if (origin_die)
add_AT_die_ref (die, DW_AT_abstract_origin, origin_die);
return origin_die;
} | false | false | false | false | false | 0 |
handle_mpath_set(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv)
{
unsigned char dst[ETH_ALEN];
unsigned char next_hop[ETH_ALEN];
if (argc < 3)
return 1;
if (mac_addr_a2n(dst, argv[0])) {
fprintf(stderr, "invalid destination mac address\n");
return 2;
}
argc--;
argv++;
if (strcmp("next_hop", argv[0]) != 0)
return 1;
argc--;
argv++;
if (mac_addr_a2n(next_hop, argv[0])) {
fprintf(stderr, "invalid next hop mac address\n");
return 2;
}
argc--;
argv++;
if (argc)
return 1;
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst);
NLA_PUT(msg, NL80211_ATTR_MPATH_NEXT_HOP, ETH_ALEN, next_hop);
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_mpath_handler, NULL);
return 0;
nla_put_failure:
return -ENOBUFS;
} | false | false | false | false | false | 0 |
create_mg_merge_tagged_fields(AW_root *aw_root)
{
static AW_window_simple *aws = 0;
if (aws) return aws;
GB_transaction dummy(GLOBAL_gb_merge);
aw_root->awar_string( AWAR_FIELD1,"full_name");
aw_root->awar_string( AWAR_FIELD2,"full_name");
aw_root->awar_string( AWAR_TAG1,"S");
aw_root->awar_string( AWAR_TAG2,"D");
aw_root->awar_string( AWAR_TAG_DEL1,"S*");
aws = new AW_window_simple;
aws->init( aw_root, "MERGE_TAGGED_FIELDS", "MERGE TAGGED FIELDS");
aws->load_xfig("merge/mg_mergetaggedfield.fig");
aws->button_length(13);
aws->callback( AW_POPDOWN);
aws->at("close");
aws->create_button("CLOSE","CLOSE","C");
aws->at("go");
aws->callback(MG_merge_tagged_field_cb);
aws->create_button("GO","GO");
aws->at("help");
aws->callback(AW_POPUP_HELP,(AW_CL)"mergetaggedfield.hlp");
aws->create_button("HELP","HELP");
aws->at("tag1"); aws->create_input_field(AWAR_TAG1,5);
aws->at("tag2"); aws->create_input_field(AWAR_TAG2,5);
aws->at("del1"); aws->create_input_field(AWAR_TAG_DEL1,5);
awt_create_selection_list_on_scandb(GLOBAL_gb_merge, (AW_window*)aws,AWAR_FIELD1,AWT_NDS_FILTER,"fields1",0, &AWT_species_selector, 20, 10);
awt_create_selection_list_on_scandb(GLOBAL_gb_dest, (AW_window*)aws,AWAR_FIELD2,AWT_NDS_FILTER,"fields2",0, &AWT_species_selector, 20, 10);
return (AW_window*)aws;
} | false | false | false | false | false | 0 |
glade_design_layout_add (GtkContainer *container, GtkWidget *widget)
{
GladeDesignLayout *layout = GLADE_DESIGN_LAYOUT (container);
GladeDesignLayoutPrivate *priv = layout->priv;
priv->child_rect.width = 0;
priv->child_rect.height = 0;
gtk_widget_set_parent_window (widget, priv->offscreen_window);
GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->add (container,
widget);
if (!priv->gchild &&
(priv->gchild = glade_widget_get_from_gobject (G_OBJECT (widget))))
{
update_widget_name (layout, priv->gchild);
g_signal_connect (priv->gchild, "notify::name",
G_CALLBACK (on_glade_widget_name_notify),
layout);
}
gtk_widget_queue_draw (GTK_WIDGET (container));
} | false | false | false | false | false | 0 |
mshiftleft (header *hd)
{ header *st=hd,*result;
double *m,*mr,*mr1;
int i,j,c,r;
hd=getvalue(hd); if (error) return;
if (hd->type==s_real || hd->type==s_complex || hd->type==s_interval)
{ moveresult(st,hd); return;
}
else if (hd->type==s_matrix)
{ getmatrix(hd,&r,&c,&m);
result=new_matrix(r,c,""); if (error) return;
mr=matrixof(result);
for (i=0; i<r; i++)
{ mr1=m+1;
for (j=0; j<c-1; j++) *mr++=*mr1++;
*mr++=0;
m+=c;
}
}
else if (hd->type==s_cmatrix)
{ getmatrix(hd,&r,&c,&m);
result=new_cmatrix(r,c,""); if (error) return;
mr=matrixof(result);
for (i=0; i<r; i++)
{ mr1=m+2l;
for (j=0; j<c-1; j++)
{ *mr++=*mr1++; *mr++=*mr1++;
}
*mr++=0; *mr++=0;
m+=2l*c;
}
}
else if (hd->type==s_imatrix)
{ getmatrix(hd,&r,&c,&m);
result=new_imatrix(r,c,""); if (error) return;
mr=matrixof(result);
for (i=0; i<r; i++)
{ mr1=m+2l;
for (j=0; j<c-1; j++)
{ *mr++=*mr1++; *mr++=*mr1++;
}
*mr++=0; *mr++=0;
m+=2l*c;
}
}
else wrong_arg_in("flipx");
moveresult(st,result);
} | false | false | false | false | false | 0 |
StringToValue( wxVariant& variant, const wxString& text, int ) const
{
wxArrayString arr;
int userStringMode = GetAttributeAsLong(wxT("UserStringMode"), 0);
WX_PG_TOKENIZER2_BEGIN(text,wxT('"'))
if ( userStringMode > 0 || (m_choices.IsOk() && m_choices.Index( token ) != wxNOT_FOUND) )
arr.Add(token);
WX_PG_TOKENIZER2_END()
wxVariant v(arr);
variant = v;
return true;
} | false | false | false | false | false | 0 |
set_REVERS_IDENT(AN_revers *THIS,aisc_string x){
if(THIS->mh.ident) free(THIS->mh.ident);
THIS->mh.ident = x;} | false | false | false | false | false | 0 |
__init(void)
{
#ifndef __WINNT__
struct sigaction sa;
if (sigemptyset(&sa.sa_mask))
exit(1);
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = __term_handler;
/* SIGPIPE, SIGABRT and friends are considered as bugs. no cleanup
* in these cases, fix the program or replace defective
* hardware :) */
if (sigaction(SIGHUP, &sa, 0))
exit(1);
if (sigaction(SIGINT, &sa, 0))
exit(1);
if (sigaction(SIGQUIT, &sa, 0))
exit(1);
if (sigaction(SIGTERM, &sa, 0))
exit(1);
#else
atexit(__cleanup);
oldicp = GetConsoleCP();
oldocp = GetConsoleOutputCP();
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
#endif
} | false | false | false | false | false | 0 |
ib_dealloc_device(struct ib_device *device)
{
WARN_ON(device->reg_state != IB_DEV_UNREGISTERED &&
device->reg_state != IB_DEV_UNINITIALIZED);
kobject_put(&device->dev.kobj);
} | false | false | false | false | false | 0 |
delete_qr(Quadruple *qr)
{
if (qr->prev != NULL)
qr->prev->next = qr->next;
else
qr->stm->qr_head = qr->next;
if (qr->next != NULL)
qr->next->prev = qr->prev;
free(qr);
} | false | false | false | false | false | 0 |
rewriteAppendOnlyFileBackground(void) {
pid_t childpid;
long long start;
if (server.bgrewritechildpid != -1) return REDIS_ERR;
if (server.ds_enabled != 0) {
redisLog(REDIS_WARNING,"BGREWRITEAOF called with diskstore enabled: AOF is not supported when diskstore is enabled. Operation not performed.");
return REDIS_ERR;
}
start = ustime();
if ((childpid = fork()) == 0) {
char tmpfile[256];
/* Child */
if (server.ipfd > 0) close(server.ipfd);
if (server.sofd > 0) close(server.sofd);
snprintf(tmpfile,256,"temp-rewriteaof-bg-%d.aof", (int) getpid());
if (rewriteAppendOnlyFile(tmpfile) == REDIS_OK) {
_exit(0);
} else {
_exit(1);
}
} else {
/* Parent */
server.stat_fork_time = ustime()-start;
if (childpid == -1) {
redisLog(REDIS_WARNING,
"Can't rewrite append only file in background: fork: %s",
strerror(errno));
return REDIS_ERR;
}
redisLog(REDIS_NOTICE,
"Background append only file rewriting started by pid %d",childpid);
server.bgrewritechildpid = childpid;
updateDictResizePolicy();
/* We set appendseldb to -1 in order to force the next call to the
* feedAppendOnlyFile() to issue a SELECT command, so the differences
* accumulated by the parent into server.bgrewritebuf will start
* with a SELECT statement and it will be safe to merge. */
server.appendseldb = -1;
return REDIS_OK;
}
return REDIS_OK; /* unreached */
} | false | false | false | false | false | 0 |
process(LEGlyphStorage &glyphStorage) const
{
SubtableProcessor *processor = NULL;
switch (SWAPW(coverage) & scfTypeMask)
{
case mstIndicRearrangement:
processor = new IndicRearrangementProcessor(this);
break;
case mstContextualGlyphSubstitution:
processor = new ContextualGlyphSubstitutionProcessor(this);
break;
case mstLigatureSubstitution:
processor = new LigatureSubstitutionProcessor(this);
break;
case mstReservedUnused:
break;
case mstNonContextualGlyphSubstitution:
processor = NonContextualGlyphSubstitutionProcessor::createInstance(this);
break;
/*
case mstContextualGlyphInsertion:
processor = new ContextualGlyphInsertionProcessor(this);
break;
*/
default:
break;
}
if (processor != NULL) {
processor->process(glyphStorage);
delete processor;
}
} | false | false | false | false | false | 0 |
choose_mc_patterns(char *name)
{
int k;
for (k = 0; mc_pattern_databases[k].name; k++) {
if (!name || strcmp(name, mc_pattern_databases[k].name) == 0) {
mc_init_patterns(mc_pattern_databases[k].values);
return 1;
}
}
return 0;
} | false | false | false | false | false | 0 |
randomize_string (char tmp[9])
{
int i;
const char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for (i = 0; i < 8; i++)
tmp[i] = chars[g_random_int_range (0, strlen(chars))];
tmp[8] = '\0';
} | true | true | false | false | true | 1 |
kill_session()
{
const gchar *session_manager = g_getenv("SESSION_MANAGER");
if(session_manager) {
gchar **splited = g_strsplit(session_manager, "/", 0);
if(splited != NULL) {
guint length = g_strv_length(splited);
if(length > 0) {
pid_t pid = atoi(splited[length - 1]);
if(pid != 0)
kill(pid, SIGQUIT);
}
g_strfreev(splited);
}
}
} | false | false | false | false | false | 0 |
setChallenge(const QByteArray &c, const KUrl &resource,
const QByteArray &httpMethod)
{
QString oldUsername;
QString oldPassword;
if (valueForKey(m_challenge, "stale").toLower() == "true") {
// stale nonce: the auth failure that triggered this round of authentication is an artifact
// of digest authentication. the credentials are probably still good, so keep them.
oldUsername = m_username;
oldPassword = m_password;
}
KAbstractHttpAuthentication::setChallenge(c, resource, httpMethod);
if (!oldUsername.isEmpty() && !oldPassword.isEmpty()) {
// keep credentials *and* don't ask for new ones
m_needCredentials = false;
m_username = oldUsername;
m_password = oldPassword;
}
} | false | false | false | false | false | 0 |
compat_socket_selfpipe_discard_data( compat_socket_selfpipe_t *self )
{
char bitbucket;
ssize_t bytes_read;
do {
bytes_read = read( self->read_fd, &bitbucket, 1 );
if( bytes_read == -1 && errno != EINTR ) {
ui_error( UI_ERROR_ERROR,
"%s: %d: unexpected error %d (%s) reading from pipe", __FILE__,
__LINE__, errno, strerror(errno) );
}
} while( bytes_read < 0 );
} | false | true | false | false | true | 1 |
check_signature(struct signature *sig) {
u8 ret = 0;
if (sig->severity < 0 || sig->severity > 4) {
WARN("Signature %d has an invalid severity: %d\n", sig->id, sig->severity);
ret = 1;
}
if (!sig->content_cnt && !sig->mime) {
WARN("Signature %d has no \"content\" nor \"mime\" string\n", sig->id);
ret = 1;
}
if (!sig->memo) {
WARN("Signature %d has no memo string\n", sig->id);
ret = 1;
}
return ret;
} | false | false | false | false | false | 0 |
u_freeentries(buf, uhp, uhpp)
buf_T *buf;
u_header_T *uhp;
u_header_T **uhpp; /* if not NULL reset when freeing this header */
{
u_entry_T *uep, *nuep;
/* Check for pointers to the header that become invalid now. */
if (buf->b_u_curhead == uhp)
buf->b_u_curhead = NULL;
if (buf->b_u_newhead == uhp)
buf->b_u_newhead = NULL; /* freeing the newest entry */
if (uhpp != NULL && uhp == *uhpp)
*uhpp = NULL;
for (uep = uhp->uh_entry; uep != NULL; uep = nuep)
{
nuep = uep->ue_next;
u_freeentry(uep, uep->ue_size);
}
#ifdef U_DEBUG
uhp->uh_magic = 0;
#endif
vim_free((char_u *)uhp);
--buf->b_u_numhead;
} | false | false | false | false | false | 0 |
nlRowColumnAppend(NLRowColumn* c, NLint index, NLdouble value) {
if(c->size == c->capacity) {
nlRowColumnGrow(c) ;
}
c->coeff[c->size].index = index ;
c->coeff[c->size].value = value ;
c->size++ ;
} | false | false | false | false | false | 0 |
stream_write(STREAM *stream, char *buffer, int len)
{
if ((stream->common.mode & ST_WRITE) == 0)
THROW(E_ACCESS);
CHECK_enter();
if (sigsetjmp(CHECK_jump, TRUE) == 0)
memmove(stream->memory.addr + stream->memory.pos, buffer, len);
CHECK_leave();
if (CHECK_got_error())
{
errno = EIO;
return TRUE;
}
else
{
stream->memory.pos += len;
return FALSE;
}
} | false | false | false | false | false | 0 |
AddToLiveIns(unsigned Reg) {
const std::vector<MachineBasicBlock*> Blocks = CurLoop->getBlocks();
for (unsigned i = 0, e = Blocks.size(); i != e; ++i) {
MachineBasicBlock *BB = Blocks[i];
if (!BB->isLiveIn(Reg))
BB->addLiveIn(Reg);
for (MachineBasicBlock::iterator
MII = BB->begin(), E = BB->end(); MII != E; ++MII) {
MachineInstr *MI = &*MII;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (!MO.isReg() || !MO.getReg() || MO.isDef()) continue;
if (MO.getReg() == Reg || TRI->isSuperRegister(Reg, MO.getReg()))
MO.setIsKill(false);
}
}
}
} | false | false | false | false | false | 0 |
convert_frame_new_preroll_callback (GstElement * sink,
GstVideoConvertSampleContext * context)
{
GstSample *sample = NULL;
GError *error = NULL;
g_mutex_lock (&context->mutex);
if (context->finished)
goto done;
g_signal_emit_by_name (sink, "pull-preroll", &sample);
if (!sample) {
error = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
"Could not get converted video sample");
}
convert_frame_finish (context, sample, error);
g_signal_handlers_disconnect_by_func (sink, convert_frame_need_data_callback,
context);
done:
g_mutex_unlock (&context->mutex);
return GST_FLOW_OK;
} | false | false | false | false | false | 0 |
isl_basic_map_solve_lp(struct isl_basic_map *bmap, int max,
isl_int *f, isl_int d, isl_int *opt,
isl_int *opt_denom,
struct isl_vec **sol)
{
if (sol)
*sol = NULL;
if (!bmap)
return isl_lp_error;
switch (bmap->ctx->opt->lp_solver) {
case ISL_LP_PIP:
return isl_pip_solve_lp(bmap, max, f, d, opt, opt_denom, sol);
case ISL_LP_TAB:
return isl_tab_solve_lp(bmap, max, f, d, opt, opt_denom, sol);
default:
return isl_lp_error;
}
} | false | false | false | false | false | 0 |
d_exprlist (struct d_info *di, char terminator)
{
struct demangle_component *list = NULL;
struct demangle_component **p = &list;
if (d_peek_char (di) == terminator)
{
d_advance (di, 1);
return d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, NULL, NULL);
}
while (1)
{
struct demangle_component *arg = d_expression (di);
if (arg == NULL)
return NULL;
*p = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, arg, NULL);
if (*p == NULL)
return NULL;
p = &d_right (*p);
if (d_peek_char (di) == terminator)
{
d_advance (di, 1);
break;
}
}
return list;
} | false | false | false | false | false | 0 |
unique_input_switch_drop( UniqueInputSwitch *input_switch,
UniqueInputChannel *channel )
{
int i;
UniqueContext *context;
D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_drop( %p, %p )\n", input_switch, channel );
D_MAGIC_ASSERT( input_switch, UniqueInputSwitch );
D_MAGIC_ASSERT( channel, UniqueInputChannel );
context = input_switch->context;
D_MAGIC_ASSERT( context, UniqueContext );
for (i=0; i<_UDCI_NUM; i++) {
DirectLink *n;
UniqueInputFilter *filter;
UniqueInputTarget *target = &input_switch->targets[i];
if (target->normal == channel)
target->normal = NULL;
if (target->fixed == channel)
target->fixed = NULL;
if (target->implicit == channel)
target->implicit = NULL;
if (target->current == channel)
target->current = NULL;
D_DEBUG_AT( UniQuE_InpSw, " -> index %d, filters %p\n", i, target->filters );
direct_list_foreach_safe (filter, n, target->filters) {
D_MAGIC_ASSERT( filter, UniqueInputFilter );
D_MAGIC_ASSERT( filter->channel, UniqueInputChannel );
D_DEBUG_AT( UniQuE_InpSw,
" -> filter %p, channel %p\n", filter, filter->channel );
D_ASSUME( filter->channel != channel );
if (filter->channel == channel) {
direct_list_remove( &target->filters, &filter->link );
D_MAGIC_CLEAR( filter );
SHFREE( context->shmpool, filter );
}
}
}
if (!input_switch->targets[UDCI_POINTER].fixed)
update_targets( input_switch );
return DFB_OK;
} | false | false | false | false | false | 0 |
policy_view_show_policy_line(policy_view_t * view, unsigned long line)
{
GtkTextTagTable *table = NULL;
GtkTextIter iter, end_iter;
GtkTextMark *mark = NULL;
GString *string = g_string_new("");
gtk_notebook_set_current_page(view->notebook, 1);
/* when moving the buffer we must use marks to scroll because
* goto_line if called before the line height has been
* calculated can produce undesired results, in our case we
* get no scrolling at all */
table = gtk_text_buffer_get_tag_table(view->source);
gtk_text_buffer_get_start_iter(view->source, &iter);
gtk_text_iter_set_line(&iter, line);
gtk_text_buffer_get_start_iter(view->source, &end_iter);
gtk_text_iter_set_line(&end_iter, line);
while (!gtk_text_iter_ends_line(&end_iter)) {
gtk_text_iter_forward_char(&end_iter);
}
mark = gtk_text_buffer_create_mark(view->source, "line-position", &iter, TRUE);
assert(mark);
gtk_text_view_scroll_to_mark(view->source_view, mark, 0.0, TRUE, 0.0, 0.5);
/* destroying the mark and recreating is faster than doing a
* move on a mark that still exists, so we always destroy it
* once we're done */
gtk_text_buffer_delete_mark(view->source, mark);
gtk_text_view_set_cursor_visible(view->source_view, TRUE);
gtk_text_buffer_place_cursor(view->source, &iter);
gtk_text_buffer_select_range(view->source, &iter, &end_iter);
gtk_container_set_focus_child(GTK_CONTAINER(view->notebook), GTK_WIDGET(view->source_view));
g_string_printf(string, "Line: %d", gtk_text_iter_get_line(&iter) + 1);
gtk_label_set_text(view->line_number, string->str);
g_string_free(string, TRUE);
} | false | false | false | false | false | 0 |
rocker_port_fwd_enable(struct rocker_port *rocker_port,
struct switchdev_trans *trans, int flags)
{
if (rocker_port_is_bridged(rocker_port))
/* bridge STP will enable port */
return 0;
/* port is not bridged, so simulate going to FORWARDING state */
return rocker_port_stp_update(rocker_port, trans, flags,
BR_STATE_FORWARDING);
} | false | false | false | false | false | 0 |
mouseMoveEvent(QMouseEvent *ev)
{
if (sizeDrag) {
emit sizeDragged(ev->pos());
ev->accept();
}
else
ev->ignore();
} | false | false | false | false | false | 0 |
__do_request(struct ceph_mds_client *mdsc,
struct ceph_mds_request *req)
{
struct ceph_mds_session *session = NULL;
int mds = -1;
int err = 0;
if (req->r_err || req->r_got_result) {
if (req->r_aborted)
__unregister_request(mdsc, req);
goto out;
}
if (req->r_timeout &&
time_after_eq(jiffies, req->r_started + req->r_timeout)) {
dout("do_request timed out\n");
err = -EIO;
goto finish;
}
if (ACCESS_ONCE(mdsc->fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) {
dout("do_request forced umount\n");
err = -EIO;
goto finish;
}
put_request_session(req);
mds = __choose_mds(mdsc, req);
if (mds < 0 ||
ceph_mdsmap_get_state(mdsc->mdsmap, mds) < CEPH_MDS_STATE_ACTIVE) {
dout("do_request no mds or not active, waiting for map\n");
list_add(&req->r_wait, &mdsc->waiting_for_map);
goto out;
}
/* get, open session */
session = __ceph_lookup_mds_session(mdsc, mds);
if (!session) {
session = register_session(mdsc, mds);
if (IS_ERR(session)) {
err = PTR_ERR(session);
goto finish;
}
}
req->r_session = get_session(session);
dout("do_request mds%d session %p state %s\n", mds, session,
ceph_session_state_name(session->s_state));
if (session->s_state != CEPH_MDS_SESSION_OPEN &&
session->s_state != CEPH_MDS_SESSION_HUNG) {
if (session->s_state == CEPH_MDS_SESSION_NEW ||
session->s_state == CEPH_MDS_SESSION_CLOSING)
__open_session(mdsc, session);
list_add(&req->r_wait, &session->s_waiting);
goto out_session;
}
/* send request */
req->r_resend_mds = -1; /* forget any previous mds hint */
if (req->r_request_started == 0) /* note request start time */
req->r_request_started = jiffies;
err = __prepare_send_request(mdsc, req, mds, false);
if (!err) {
ceph_msg_get(req->r_request);
ceph_con_send(&session->s_con, req->r_request);
}
out_session:
ceph_put_mds_session(session);
finish:
if (err) {
dout("__do_request early error %d\n", err);
req->r_err = err;
complete_request(mdsc, req);
__unregister_request(mdsc, req);
}
out:
return err;
} | false | false | false | false | false | 0 |
f_subphylumofoperator(ID o, INT i)
{{
INT kc_selvar_0_1 = phylum_cast<INT>(i);
if ((kc_selvar_0_1->prod_sel() == sel_Int)) {
const integer ii = phylum_cast<const impl_INT_Int*>(kc_selvar_0_1)->integer_1;
if (ii->value == 0) {
return f_phylumofoperator( o );
} else {
return f_subphylum( f_argumentsofoperator( o ), i );
}
} else
{ kc_no_default_in_with( "f_subphylumofoperator", __LINE__, __FILE__ );
return static_cast<ID>(0); }
}
} | false | false | false | false | false | 0 |
dc1394_format7_set_value_setting(dc1394camera_t *camera, dc1394video_mode_t video_mode)
{
int err;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_set_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_VALUE_SETTING, (uint32_t)0x40000000UL);
DC1394_ERR_RTN(err, "Could not set value setting");
return err;
} | false | false | false | false | false | 0 |
set_properties()
{
// begin wxGlade: SearchInPanel::set_properties
m_pChkSearchOpenFiles->SetToolTip(wxT("Search in open files"));
m_pChkSearchOpenFiles->SetValue(1);
//-m_pChkSearchProjectFiles->SetToolTip(wxT("Search in project files"));
m_pChkSearchSnippetFiles->SetToolTip(wxT("Search in Snippets Tree"));
m_pChkSearchSnippetFiles->SetValue(1);
//-m_pChkSearchWorkspaceFiles->SetToolTip(wxT("Search in workspace files"));
m_pChkSearchDir->SetToolTip(wxT("Search in directory files"));
// end wxGlade
} | 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.