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 |
|---|---|---|---|---|---|---|
ensure_cache_filled (CtplInputStream *stream,
GError **error)
{
gboolean success = TRUE;
if (stream->buf_pos >= stream->buf_size) {
gssize read_size;
read_size = g_input_stream_read (stream->stream, stream->buffer,
stream->buf_size, NULL, error);
if (read_size < 0) {
success = FALSE;
} else {
stream->buf_size = (gsize)read_size;
stream->buf_pos = 0U;
}
}
return success;
} | false | false | false | false | false | 0 |
cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
u8 len, u8 request, u8 direction)
{
int status = 0;
struct VENDOR_REQUEST_IN ven_req;
/* Set wValue */
ven_req.wValue = (u16) (gpio_bit >> 16 & 0xffff);
/* set request */
if (!request) {
if (direction)
ven_req.bRequest = VRT_GET_GPIO; /* 0x8 gpio */
else
ven_req.bRequest = VRT_SET_GPIO; /* 0x9 gpio */
} else {
if (direction)
ven_req.bRequest = VRT_GET_GPIE; /* 0xa gpie */
else
ven_req.bRequest = VRT_SET_GPIE; /* 0xb gpie */
}
/* set index value */
ven_req.wIndex = (u16) (gpio_bit & 0xffff);
/* set wLength value */
ven_req.wLength = len;
/* set bData value */
ven_req.bData = 0;
/* set the buffer for read / write */
ven_req.pBuff = gpio_val;
/* set the direction */
if (direction) {
ven_req.direction = USB_DIR_IN;
memset(ven_req.pBuff, 0x00, ven_req.wLength);
} else
ven_req.direction = USB_DIR_OUT;
/* call common vendor command request */
status = cx231xx_send_vendor_cmd(dev, &ven_req);
if (status < 0) {
dev_err(dev->dev, "%s: failed with status -%d\n",
__func__, status);
}
return status;
} | false | false | false | false | false | 0 |
AddPoint(double p[3])
{
int i;
for (i = 0; i < 3; i++)
{
if (p[i] < this->MinPnt[i])
{
this->MinPnt[i] = p[i];
}
if (p[i] > this->MaxPnt[i])
{
this->MaxPnt[i] = p[i];
}
}
} | false | false | false | false | false | 0 |
bzfile_geterrstr( bzFile *obj ) {
#else
const char *bzfile_geterrstr( obj ) bzFile *obj; {
#endif
int error_num = obj==NULL ? global_bzip_errno : obj->bzip_errno;
char *errstr = error_num * -1 < 0 || error_num * -1 > 9 ? "Unknown" : (char *) bzerrorstrings[ error_num * -1 ];
return errstr;
} | false | false | false | false | false | 0 |
send_log_after(const char* filename, double t, MIOFILE& mf) {
char buf[256];
double x;
FILE* f = fopen(filename, "r");
if (!f) return;
while (fgets(buf, 256, f)) {
int n = sscanf(buf, "%lf", &x);
if (n != 1) continue;
if (x < t) continue;
mf.printf("%s", buf);
}
fclose(f);
} | false | false | false | false | false | 0 |
list_deiconify(unsigned long *body)
{
PagerWindow *t;
Window target_w;
target_w = body[0];
t = Start;
while((t!= NULL)&&(t->w != target_w))
{
t = t->next;
}
if(t== NULL)
{
return;
}
else
{
t->flags &= ~ICONIFIED;
t->x = t->frame_x;
t->y = t->frame_y;
t->width = t->frame_width;
t->height = t->frame_height;
MoveResizePagerView(t);
if(FocusWin == t)
Hilight(t,ON);
else
Hilight(t,OFF);
}
} | false | false | false | false | false | 0 |
generic_sendstat (mpg123_handle *fr)
{
off_t current_frame, frames_left;
double current_seconds, seconds_left;
if(!mpg123_position(fr, 0, xfermem_get_usedspace(buffermem), ¤t_frame, &frames_left, ¤t_seconds, &seconds_left))
generic_sendmsg("F %"OFF_P" %"OFF_P" %3.2f %3.2f", (off_p)current_frame, (off_p)frames_left, current_seconds, seconds_left);
} | false | false | false | false | false | 0 |
PrintCode(TProtoFunc* tf)
{
Byte* code=tf->code;
Byte* p=code;
int line=0;
while (1)
{
Opcode OP;
int n=INFO(tf,p,&OP);
int op=OP.op;
int i=OP.arg;
printf("%6d ",(int)(p-code));
{
Byte* q=p;
int j=n;
while (j--) printf("%02X",*q++);
}
printf("%*s%-13s",2*(5-n),"",OP.name);
if (n!=1 || op<0) printf("\t%d",i); else if (i>=0) printf("\t");
switch (OP.class)
{
case ENDCODE:
printf("\n");
return;
case CLOSURE:
printf(" %d",OP.arg2);
case PUSHCONSTANT:
case GETDOTTED:
case PUSHSELF:
printf("\t; ");
PrintConstant(tf,i);
break;
case PUSHLOCAL:
case SETLOCAL:
{
char* s=luaF_getlocalname(tf,i+1,line);
if (s) printf("\t; %s",s);
break;
}
case GETGLOBAL:
case SETGLOBAL:
printf("\t; %s",VarStr(i));
break;
case SETLIST:
case CALLFUNC:
if (n>=3) printf(" %d",OP.arg2);
break;
case SETLINE:
printf("\t; \"%s\":%d",fileName(tf),line=i);
break;
/* suggested by Norman Ramsey <nr@cs.virginia.edu> */
case IFTUPJMP:
case IFFUPJMP:
i=-i;
case ONTJMP:
case ONFJMP:
case JMP:
case IFFJMP:
printf("\t; to %d",(int)(p-code)+i+n);
break;
}
printf("\n");
p+=n;
}
} | false | false | false | false | false | 0 |
closeDevice()
{
if (ownIodev)
{
iodev->close();
delete iodev;
iodev = 0;
}
} | false | false | false | false | false | 0 |
get_ack(int fd, unsigned char *result_sha1)
{
static char line[1000];
int len = packet_read_line(fd, line, sizeof(line));
if (!len)
die("git fetch-pack: expected ACK/NAK, got EOF");
if (line[len-1] == '\n')
line[--len] = 0;
if (!strcmp(line, "NAK"))
return NAK;
if (!prefixcmp(line, "ACK ")) {
if (!get_sha1_hex(line+4, result_sha1)) {
if (strstr(line+45, "continue"))
return ACK_continue;
if (strstr(line+45, "common"))
return ACK_common;
if (strstr(line+45, "ready"))
return ACK_ready;
return ACK;
}
}
die("git fetch_pack: expected ACK/NAK, got '%s'", line);
} | false | false | false | false | false | 0 |
sig_print_text(void)
{
GSList *tmp;
time_t t;
struct tm *tm;
t = time(NULL);
tm = localtime(&t);
if (tm->tm_hour != 0 || tm->tm_min != 0)
return;
daycheck = 2;
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
/* day changed, print notice about it to every window */
for (tmp = windows; tmp != NULL; tmp = tmp->next)
window_print_daychange(tmp->data, tm);
} | false | false | false | false | false | 0 |
s_minilogv(GLogLevelFlags level, bool copy, const char *fmt, va_list args)
{
char data[LOG_MSG_MAXLEN];
DECLARE_STR(11);
char time_buf[18];
const char *prefix;
unsigned stid;
int saved_errno;
if G_UNLIKELY(logfile[LOG_STDERR].disabled)
return;
/*
* Force emisison on stdout as well for fatal messages.
*/
if G_UNLIKELY(level & G_LOG_FLAG_FATAL)
copy = TRUE;
/*
* When ``copy'' is set, always emit message.
*/
if (!copy && !log_printable(LOG_STDERR))
return;
saved_errno = errno;
prefix = log_prefix(level);
stid = thread_small_id();
/*
* Because str_vncatf() is recursion-safe, we know we can't return
* to here through it.
*/
str_vbprintf(data, sizeof data, fmt, args); /* Uses str_vncatf() */
crash_time(time_buf, sizeof time_buf);
print_str(time_buf); /* 0 */
print_str(" ("); /* 1 */
print_str(prefix); /* 2 */
if (stid != 0) {
char stid_buf[ULONG_DEC_BUFLEN];
const char *stid_str = print_number(stid_buf, sizeof stid_buf, stid);
print_str("-"); /* 3 */
print_str(stid_str); /* 4 */
}
print_str(")"); /* 5 */
if G_UNLIKELY(level & G_LOG_FLAG_RECURSION)
print_str(" [RECURSIVE]"); /* 6 */
if G_UNLIKELY(level & G_LOG_FLAG_FATAL)
print_str(" [FATAL]"); /* 7 */
print_str(": "); /* 8 */
print_str(data); /* 9 */
print_str("\n"); /* 10 */
log_flush_err();
if (copy && log_stdout_is_distinct())
log_flush_out();
errno = saved_errno;
} | true | true | false | false | false | 1 |
handle_special_request (FileteaNode *self,
EvdHttpConnection *conn,
EvdHttpRequest *request,
SoupURI *uri,
gchar **tokens)
{
const gchar *id;
const gchar *action;
id = tokens[1];
action = tokens[2];
if (g_strcmp0 (evd_http_request_get_method (request), "PUT") == 0)
{
FileTransfer *transfer;
transfer = g_hash_table_lookup (self->priv->transfers_by_id, id);
if (transfer != NULL)
{
JsonNode *node;
JsonArray *args;
/* check if file size has changed */
check_file_size_changed (self, transfer, request);
file_transfer_set_source_conn (transfer, conn);
file_transfer_start (transfer);
if (transfer->target_peer &&
! evd_peer_is_closed (transfer->target_peer))
{
bind_transfer_to_peer (self, transfer->target_peer, transfer);
node = json_node_new (JSON_NODE_ARRAY);
args = json_array_new ();
json_node_set_array (node, args);
json_array_add_string_element (args, transfer->id);
json_array_add_string_element (args, transfer->source->file_name);
json_array_add_int_element (args, transfer->source->file_size);
json_array_add_boolean_element (args, TRUE);
/* notify target */
if (! evd_jsonrpc_send_notification (self->priv->rpc,
"transfer-started",
node,
transfer->target_peer,
NULL))
{
g_warning ("Failed to send 'transfer-started' notification to peer");
}
json_array_unref (args);
json_node_free (node);
}
return TRUE;
}
}
else
{
FileSource *source;
source = g_hash_table_lookup (self->priv->sources_by_id, id);
if (source != NULL)
{
SoupMessageHeaders *headers;
const gchar *user_agent;
headers = evd_http_message_get_headers (EVD_HTTP_MESSAGE (request));
user_agent = soup_message_headers_get_one (headers, "user-agent");
if ((action == NULL || (strlen (action) == 0)) &&
user_agent_is_browser (user_agent))
{
gchar *new_path;
gchar *static_content_path;
GError *error = NULL;
static_content_path = get_static_content_path (self, request);
new_path = g_strdup_printf ("%s/#%s", static_content_path, id);
g_free (static_content_path);
if (! evd_http_connection_redirect (conn, new_path, FALSE, &error))
{
/* @TODO: do proper error logging */
g_debug ("ERROR sending response to source: %s", error->message);
g_error_free (error);
}
g_free (new_path);
return TRUE;
}
else
{
gboolean download;
FileTransfer *transfer;
download = g_strcmp0 (action, PATH_ACTION_VIEW) != 0;
transfer = setup_new_transfer (self, source, conn, download);
if (uri->query != NULL)
{
EvdPeer *peer;
peer = evd_transport_lookup_peer (EVD_TRANSPORT (self->priv->transport),
uri->query);
if (peer != NULL)
file_transfer_set_target_peer (transfer, peer);
}
return TRUE;
}
}
}
return FALSE;
} | false | false | false | false | false | 0 |
_torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
char *f, struct task_struct **tp)
{
int ret = 0;
VERBOSE_TOROUT_STRING(m);
*tp = kthread_run(fn, arg, "%s", s);
if (IS_ERR(*tp)) {
ret = PTR_ERR(*tp);
VERBOSE_TOROUT_ERRSTRING(f);
*tp = NULL;
}
torture_shuffle_task_register(*tp);
return ret;
} | false | false | false | false | false | 0 |
ipw_rf_kill(void *adapter)
{
struct ipw_priv *priv = adapter;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
if (rf_kill_active(priv)) {
IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
schedule_delayed_work(&priv->rf_kill, 2 * HZ);
goto exit_unlock;
}
/* RF Kill is now disabled, so bring the device back up */
if (!(priv->status & STATUS_RF_KILL_MASK)) {
IPW_DEBUG_RF_KILL("HW RF Kill no longer active, restarting "
"device\n");
/* we can not do an adapter restart while inside an irq lock */
schedule_work(&priv->adapter_restart);
} else
IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still "
"enabled\n");
exit_unlock:
spin_unlock_irqrestore(&priv->lock, flags);
} | false | false | false | false | false | 0 |
prop_parse_boolean(const char *name,
const char *str, const char **endptr, gpointer vec, size_t i)
{
static const struct {
const char *s;
const gboolean v;
} tab[] = {
{ "0", FALSE },
{ "1", TRUE },
{ "FALSE", FALSE },
{ "TRUE", TRUE },
};
gboolean b = FALSE;
const char *p = NULL;
guint j;
int error = 0;
g_assert(name);
g_assert(str);
for (j = 0; j < G_N_ELEMENTS(tab); j++) {
if (NULL != (p = is_strcaseprefix(str, tab[j].s))) {
b = tab[j].v;
break;
}
}
if (!p) {
p = str;
error = EINVAL;
}
if (error) {
g_warning("Not a boolean value (prop=\"%s\"): \"%s\"", name, str);
} else if (vec) {
((gboolean *) vec)[i] = b;
}
if (endptr)
*endptr = p;
return error;
} | false | false | false | false | false | 0 |
getInfoName(int infoType)
{
std::map<int, std::string>::iterator iter = myInfoTypeToNameMap.find(infoType);
if (iter != myInfoTypeToNameMap.end()) {
const std::string &name = iter->second;
return name.c_str();
}
return NULL;
} | false | false | false | false | false | 0 |
gx_flattened_iterator__prev(gx_flattened_iterator *self)
{
bool last; /* i.e. the first one in the forth order. */
if (self->i >= 1 << self->k)
return_error(gs_error_unregistered); /* Must not happen. */
self->lx1 = self->lx0;
self->ly1 = self->ly0;
if (self->k <= 1) {
/* If k==0, we have a single segment, return it.
If k==1 && i < 2, return the last segment.
Otherwise must not pass here.
We caould allow to pass here with self->i == 1 << self->k,
but we want to check the assertion about the last segment below.
*/
self->i++;
self->lx0 = self->x0;
self->ly0 = self->y0;
vd_bar(self->lx0, self->ly0, self->lx1, self->ly1, 1, RGB(0, 0, 255));
return false;
}
gx_flattened_iterator__unaccum(self);
self->i++;
# if defined(DEBUG) && !defined(GS_THREADSAFE)
if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
(((self->x ^ self->lx1) | (self->y ^ self->ly1)) & float2fixed(-0.5) ?
"add" : "skip"),
fixed2float(self->x), fixed2float(self->y), self->x, self->y);
gx_flattened_iterator__print_state(self);
# endif
last = (self->i == (1 << self->k) - 1);
self->lx0 = self->x;
self->ly0 = self->y;
vd_bar(self->lx0, self->ly0, self->lx1, self->ly1, 1, RGB(0, 0, 255));
if (last)
if (self->lx0 != self->x0 || self->ly0 != self->y0)
return_error(gs_error_unregistered); /* Must not happen. */
return !last;
} | false | false | false | false | false | 0 |
vs_scanline_resample_nearest_AYUV64 (uint8_t * dest8, uint8_t * src8,
int src_width, int n, int *accumulator, int increment)
{
guint16 *dest = (guint16 *) dest8;
guint16 *src = (guint16 *) src8;
int acc = *accumulator;
int i, j;
for (i = 0; i < n; i++) {
j = (acc + 0x8000) >> 16;
dest[i * 4 + 0] = src[j * 4 + 0];
dest[i * 4 + 1] = src[j * 4 + 1];
dest[i * 4 + 2] = src[j * 4 + 2];
dest[i * 4 + 3] = src[j * 4 + 3];
acc += increment;
}
*accumulator = acc;
} | false | false | false | false | false | 0 |
last_active_insn (bb, skip_use_p)
basic_block bb;
int skip_use_p;
{
rtx insn = bb->end;
rtx head = bb->head;
while (GET_CODE (insn) == NOTE
|| GET_CODE (insn) == JUMP_INSN
|| (skip_use_p
&& GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == USE))
{
if (insn == head)
return NULL_RTX;
insn = PREV_INSN (insn);
}
if (GET_CODE (insn) == CODE_LABEL)
return NULL_RTX;
return insn;
} | false | false | false | false | false | 0 |
cb_insert_cell_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
InsertCellState *state)
{
WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
GtkWidget *radio_0;
int cols, rows;
int i;
radio_0 = go_gtk_builder_get_widget (state->gui, "radio_0");
g_return_if_fail (radio_0 != NULL);
i = gnm_gtk_radio_group_get_selected
(gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_0)));
cols = state->sel->end.col - state->sel->start.col + 1;
rows = state->sel->end.row - state->sel->start.row + 1;
switch (i) {
case 0 :
cmd_shift_rows (wbc, state->sheet,
state->sel->start.col,
state->sel->start.row,
state->sel->end.row, cols);
break;
case 1 :
cmd_shift_cols (wbc, state->sheet,
state->sel->start.col,
state->sel->end.col,
state->sel->start.row, rows);
break;
case 2 :
cmd_insert_rows (wbc, state->sheet,
state->sel->start.row, rows);
break;
default :
cmd_insert_cols (wbc, state->sheet,
state->sel->start.col, cols);
break;
}
gtk_widget_destroy (state->dialog);
} | false | false | false | false | false | 0 |
WriteArray(vtkKdNode *kd, int loc)
{
int nextloc = loc + 1;
int dim = kd->GetDim(); // 0 (X), 1 (Y), 2 (Z)
this->Npoints[loc] = kd->GetNumberOfPoints();
if (kd->GetLeft())
{
this->Dim[loc] = dim;
vtkKdNode *left = kd->GetLeft();
vtkKdNode *right = kd->GetRight();
this->Coord[loc] = left->GetMaxBounds()[dim];
this->LowerDataCoord[loc] = left->GetMaxDataBounds()[dim];
this->UpperDataCoord[loc] = right->GetMinDataBounds()[dim];
int locleft = loc + 1;
int locright = this->WriteArray(left, locleft);
nextloc = this->WriteArray(right, locright);
this->Lower[loc] = locleft;
this->Upper[loc] = locright;
}
else
{
this->Dim[loc] = -1;
this->Coord[loc] = 0.0;
this->LowerDataCoord[loc] = 0.0;
this->UpperDataCoord[loc] = 0.0;
this->Lower[loc] = kd->GetID() * -1; // partition ID
this->Upper[loc] = kd->GetID() * -1;
}
return nextloc; // next available array location
} | false | false | false | false | false | 0 |
map_edge(edge_t * e)
{
int j, k;
bezier bz;
if (ED_spl(e) == NULL) {
if ((Concentrate == FALSE) && (ED_edge_type(e) != IGNORED))
agerr(AGERR, "lost %s %s edge\n", agnameof(agtail(e)),
agnameof(aghead(e)));
return;
}
for (j = 0; j < ED_spl(e)->size; j++) {
bz = ED_spl(e)->list[j];
for (k = 0; k < bz.size; k++)
bz.list[k] = map_point(bz.list[k]);
if (bz.sflag)
ED_spl(e)->list[j].sp = map_point(ED_spl(e)->list[j].sp);
if (bz.eflag)
ED_spl(e)->list[j].ep = map_point(ED_spl(e)->list[j].ep);
}
if (ED_label(e))
ED_label(e)->pos = map_point(ED_label(e)->pos);
if (ED_xlabel(e))
ED_xlabel(e)->pos = map_point(ED_xlabel(e)->pos);
/* vladimir */
if (ED_head_label(e))
ED_head_label(e)->pos = map_point(ED_head_label(e)->pos);
if (ED_tail_label(e))
ED_tail_label(e)->pos = map_point(ED_tail_label(e)->pos);
} | false | false | false | false | false | 0 |
iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no,
int *nr_found,
iscsi_sysfs_iface_op_fn *fn)
{
struct dirent **namelist;
int rc = 0, i, n;
struct iface_rec iface;
char devpath[PATH_SIZE];
char sysfs_path[PATH_SIZE];
char id[NAME_SIZE];
snprintf(id, sizeof(id), "host%u", host_no);
if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath),
SCSI_SUBSYS, id)) {
log_error("Could not look up host's ifaces via scsi bus.");
return ISCSI_ERR_SYSFS_LOOKUP;
}
sprintf(sysfs_path, "/sys");
strlcat(sysfs_path, devpath, sizeof(sysfs_path));
strlcat(sysfs_path, "/iscsi_iface", sizeof(sysfs_path));
n = scandir(sysfs_path, &namelist, trans_filter, alphasort);
if (n <= 0)
/* older kernels or some drivers will not have ifaces */
return 0;
for (i = 0; i < n; i++) {
memset(&iface, 0, sizeof(iface));
iscsi_sysfs_read_iface(&iface, host_no, NULL,
namelist[i]->d_name);
rc = fn(data, &iface);
if (rc != 0)
break;
(*nr_found)++;
}
for (i = 0; i < n; i++)
free(namelist[i]);
free(namelist);
return rc;
} | false | false | false | false | false | 0 |
gf_seng_encode_from_file(GF_SceneEngine *seng, u16 ESID, Bool disable_aggregation, char *auFile, gf_seng_callback callback)
{
GF_Err e;
GF_StreamContext *sc;
u32 i;
Bool dims = 0;
seng->loader.fileName = auFile;
seng->loader.ctx = seng->ctx;
seng->loader.force_es_id = ESID;
sc = NULL;
i=0;
while ((sc = (GF_StreamContext*)gf_list_enum(seng->ctx->streams, &i))) {
sc->current_au_count = gf_list_count(sc->AUs);
sc->disable_aggregation = disable_aggregation;
}
/* We need to create an empty AU for the parser to correctly parse a LASeR Command without SceneUnit */
sc = gf_list_get(seng->ctx->streams, 0);
if (sc->objectType == GPAC_OTI_SCENE_DIMS) {
dims = 1;
gf_seng_create_new_au(sc, 0);
}
seng->loader.flags |= GF_SM_LOAD_CONTEXT_READY;
if (dims) {
seng->loader.type |= GF_SM_LOAD_DIMS;
} else {
seng->loader.flags |= GF_SM_LOAD_MPEG4_STRICT;
}
e = gf_sm_load_run(&seng->loader);
if (e<0) {
GF_LOG(GF_LOG_ERROR, GF_LOG_SCENE, ("[SceneEngine] cannot load AU File %s (error %s)\n", auFile, gf_error_to_string(e)));
goto exit;
}
i = 0;
while ((sc = (GF_StreamContext*)gf_list_enum(seng->ctx->streams, &i))) {
sc->disable_aggregation = 0;
}
e = gf_sm_live_encode_scene_au(seng, callback, 0);
if (e) goto exit;
exit:
return e;
} | false | false | false | false | false | 0 |
UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
return;
}
// Shadow Flame Timer
if (m_uiShadowFlameTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_SHADOW_FLAME) == CAST_OK)
{
m_uiShadowFlameTimer = urand(12000, 15000);
}
}
else
{ m_uiShadowFlameTimer -= uiDiff; }
// Wing Buffet Timer
if (m_uiWingBuffetTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_WING_BUFFET) == CAST_OK)
{
m_uiWingBuffetTimer = 25000;
}
}
else
{ m_uiWingBuffetTimer -= uiDiff; }
// Shadow of Ebonroc Timer
if (m_uiShadowOfEbonrocTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_OF_EBONROC) == CAST_OK)
{
m_uiShadowOfEbonrocTimer = urand(25000, 35000);
}
}
else
{ m_uiShadowOfEbonrocTimer -= uiDiff; }
// Thrash Timer
if (m_uiTrashTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_THRASH) == CAST_OK)
{ m_uiTrashTimer = 20000; }
}
else
{ m_uiTrashTimer -= uiDiff; }
DoMeleeAttackIfReady();
} | false | false | false | false | false | 0 |
dispatch(Interface* obj1, void* _obj2)
{
FWObject *obj2 = (FWObject*)(_obj2);
if (obj1->getParent()->getId() == obj2->getId()) return obj1;
if (!obj1->isRegular()) return NULL;
if ((obj1->getByType(IPv4::TYPENAME)).size()>1) return NULL;
if ((obj1->getByType(IPv6::TYPENAME)).size()>1) return NULL;
return (checkComplexMatchForSingleAddress(obj1, obj2)) ? obj1 : NULL;
} | false | false | false | false | false | 0 |
Accept(double Temperature, double DeltaCost)
{
if ((DeltaCost <= 0.0) || ((Temperature != 0.0) && (exp(-DeltaCost / Temperature) > DoubleRand())))
return true;
else
return false;
} | false | false | false | false | false | 0 |
mxf_write_essence_container_refs(AVFormatContext *s)
{
MXFContext *c = s->priv_data;
ByteIOContext *pb = s->pb;
int i;
mxf_write_refs_count(pb, c->essence_container_count);
av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count);
for (i = 0; i < c->essence_container_count; i++) {
MXFStreamContext *sc = s->streams[i]->priv_data;
put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
}
} | false | false | false | false | false | 0 |
st_table_child_get_x_expand (StTable *table,
ClutterActor *child)
{
StTableChild *meta;
g_return_val_if_fail (ST_IS_TABLE (table), 0);
g_return_val_if_fail (CLUTTER_IS_ACTOR (child), 0);
meta = get_child_meta (table, child);
return meta->x_expand;
} | false | false | false | false | false | 0 |
_dbus_message_iter_init_common (DBusMessage *message,
DBusMessageRealIter *real,
int iter_type)
{
_dbus_assert (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter));
/* Since the iterator will read or write who-knows-what from the
* message, we need to get in the right byte order
*/
ensure_byte_order (message);
real->message = message;
real->changed_stamp = message->changed_stamp;
real->iter_type = iter_type;
real->sig_refcount = 0;
} | false | false | false | false | false | 0 |
printLogo(void)
{
uint32_t versionMajor, versionMinor, versionPatch;
MDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);
const char *buildDate, *buildTime, *buildCompiler, *buildArch; bool buildDebug;
MDynamicAudioNormalizer::getBuildInfo(&buildDate, &buildTime, &buildCompiler, &buildArch, buildDebug);
PRINT(TXT("---------------------------------------------------------------------------\n"));
PRINT(TXT("Dynamic Audio Normalizer, Version %u.%02u-%u, %s\n"), versionMajor, versionMinor, versionPatch, LINKAGE);
PRINT(TXT("Copyright (c) 2015 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n"));
PRINT(TXT("Built on ") FMT_CHAR TXT(" at ") FMT_CHAR TXT(" with ") FMT_CHAR TXT(" for ") OS_TYPE TXT("-") FMT_CHAR TXT(".\n\n"), buildDate, buildTime, buildCompiler, buildArch);
PRINT(TXT("This program is free software: you can redistribute it and/or modify\n"));
PRINT(TXT("it under the terms of the GNU General Public License <http://www.gnu.org/>.\n"));
PRINT(TXT("Note that this program is distributed with ABSOLUTELY NO WARRANTY.\n"));
if(DYNAUDNORM_DEBUG)
{
PRINT(TXT("\n!!! DEBUG BUILD !!! DEBUG BUILD !!! DEBUG BUILD !!! DEBUG BUILD !!!\n"));
}
PRINT(TXT("---------------------------------------------------------------------------\n\n"));
if((DYNAUDNORM_DEBUG) != buildDebug)
{
PRINT_ERR(TXT("Trying to use DEBUG library with RELEASE binary or vice versa!\n"));
exit(EXIT_FAILURE);
}
} | false | false | false | false | false | 0 |
cddb_direct_mc_alloc (struct disc_mc_data *data, int tracks)
{
int index, deindex;
data->data_total_tracks = tracks;
data->data_title_len = -1;
data->data_title = NULL;
data->data_artist_len = -1;
data->data_artist = NULL;
data->data_extended_len = -1;
data->data_extended = NULL;
if ((data->data_track =
calloc (tracks + 1, sizeof (struct track_mc_data))) == NULL)
return -1;
for (index = 0; index < tracks; index++)
{
if((data->data_track[index] =
malloc(sizeof(struct track_mc_data)))
== NULL)
{
for (deindex = 0; deindex < index; deindex++)
free (data->data_track[deindex]);
free (data->data_track);
return -1;
}
data->data_track[index]->track_name_len = -1;
data->data_track[index]->track_name = NULL;
data->data_track[index]->track_artist_len = -1;
data->data_track[index]->track_artist = NULL;
data->data_track[index]->track_extended_len = -1;
data->data_track[index]->track_extended = NULL;
}
data->data_track[index + 1] = NULL;
return 0;
} | false | false | false | false | true | 1 |
cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
{
struct hdlc_header *data = (struct hdlc_header*)skb->data;
if (skb->len < sizeof(struct hdlc_header))
return cpu_to_be16(ETH_P_HDLC);
if (data->address != CISCO_MULTICAST &&
data->address != CISCO_UNICAST)
return cpu_to_be16(ETH_P_HDLC);
switch (data->protocol) {
case cpu_to_be16(ETH_P_IP):
case cpu_to_be16(ETH_P_IPX):
case cpu_to_be16(ETH_P_IPV6):
skb_pull(skb, sizeof(struct hdlc_header));
return data->protocol;
default:
return cpu_to_be16(ETH_P_HDLC);
}
} | false | false | false | false | false | 0 |
accel_edited (GtkCellRendererAccel * accel,
gchar * path_string,
guint accel_key,
GdkModifierType accel_mods,
guint hardware_keycode, GladeEPropAccel * eprop_accel)
{
gboolean key_was_set;
GtkTreeIter iter, parent_iter, new_iter;
gchar *accel_text;
GladePropertyClass *pclass;
GladeWidgetAdaptor *adaptor;
gboolean is_action;
pclass = glade_editor_property_get_pclass (GLADE_EDITOR_PROPERTY (eprop_accel));
adaptor = glade_property_class_get_adaptor (pclass);
if (!gtk_tree_model_get_iter_from_string (eprop_accel->model,
&iter, path_string))
return;
is_action = (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION ||
g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION));
gtk_tree_model_get (eprop_accel->model, &iter,
ACCEL_COLUMN_KEY_ENTERED, &key_was_set, -1);
accel_text = gtk_accelerator_name (accel_key, accel_mods);
gtk_tree_store_set
(GTK_TREE_STORE (eprop_accel->model), &iter,
ACCEL_COLUMN_KEY_ENTERED, TRUE,
ACCEL_COLUMN_STYLE, PANGO_STYLE_NORMAL,
ACCEL_COLUMN_FOREGROUND, "Black",
ACCEL_COLUMN_TEXT, accel_text,
ACCEL_COLUMN_KEYCODE, accel_key, ACCEL_COLUMN_MODIFIERS, accel_mods, -1);
g_free (accel_text);
/* Append a new one if needed
*/
if (is_action == FALSE && key_was_set == FALSE &&
gtk_tree_model_iter_parent (eprop_accel->model, &parent_iter, &iter))
{
gchar *signal, *real_signal;
gtk_tree_model_get (eprop_accel->model, &iter,
ACCEL_COLUMN_SIGNAL, &signal,
ACCEL_COLUMN_REAL_SIGNAL, &real_signal, -1);
/* Append a new empty slot at the end */
gtk_tree_store_insert_after (GTK_TREE_STORE (eprop_accel->model),
&new_iter, &parent_iter, &iter);
gtk_tree_store_set (GTK_TREE_STORE (eprop_accel->model), &new_iter,
ACCEL_COLUMN_SIGNAL, signal,
ACCEL_COLUMN_REAL_SIGNAL, real_signal,
ACCEL_COLUMN_TEXT, _("<choose a key>"),
ACCEL_COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
ACCEL_COLUMN_STYLE, PANGO_STYLE_ITALIC,
ACCEL_COLUMN_FOREGROUND, "Grey",
ACCEL_COLUMN_VISIBLE, TRUE,
ACCEL_COLUMN_KEYCODE, 0,
ACCEL_COLUMN_MODIFIERS, 0,
ACCEL_COLUMN_KEY_ENTERED, FALSE, -1);
g_free (signal);
g_free (real_signal);
}
} | false | false | false | false | false | 0 |
main(int argc, char **argv)
{
int c;
progname = argv[0];
output_file = stdout;
while ((c = getopt(argc, argv, "o:V")) != -1)
switch (c) {
case 'o':
if (output_file != stdout)
fclose(output_file);
if ((output_file = fopen(optarg, "w")) == NULL)
err(1, "%s", optarg);
break;
case 'V':
fprintf(stderr, "%s\n", HP48CC_VERSION);
exit(0);
case '?':
default:
usage();
/* NOTREACHED */
}
argc -= optind;
argv += optind;
if (argc < 1)
process_file(NULL);
else
while (*argv)
process_file(*argv++);
return 0;
} | false | true | true | false | true | 1 |
strntoumax(const char *nptr, char **endptr, int base, size_t n)
{
int minus = 0;
uintmax_t v = 0;
int d;
while (n && isspace((unsigned char)*nptr)) {
nptr++;
n--;
}
/* Single optional + or - */
if (n && *nptr == '-') {
minus = 1;
nptr++;
n--;
} else if (n && *nptr == '+') {
nptr++;
}
if (base == 0) {
if (n >= 2 && nptr[0] == '0' && (nptr[1] == 'x' || nptr[1] == 'X')) {
n -= 2;
nptr += 2;
base = 16;
} else if (n >= 1 && nptr[0] == '0') {
n--;
nptr++;
base = 8;
} else {
base = 10;
}
} else if (base == 16) {
if (n >= 2 && nptr[0] == '0' && (nptr[1] == 'x' || nptr[1] == 'X')) {
n -= 2;
nptr += 2;
}
}
while (n && (d = digitval(*nptr)) >= 0 && d < base) {
v = v * base + d;
n--;
nptr++;
}
if (endptr)
*endptr = (char *)nptr;
return minus ? -v : v;
} | false | false | false | false | false | 0 |
getline_UYVP (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
int j)
{
int i;
const guint8 *srcline = GET_LINE (src, 0, j)
+ xoff * 3;
for (i = 0; i < src->width; i += 2) {
guint16 y0, y1;
guint16 u0;
guint16 v0;
u0 = (srcline[(i / 2) * 5 + 0] << 2) | (srcline[(i / 2) * 5 + 1] >> 6);
y0 = ((srcline[(i / 2) * 5 + 1] & 0x3f) << 4) |
(srcline[(i / 2) * 5 + 2] >> 4);
v0 = ((srcline[(i / 2) * 5 + 2] & 0x0f) << 6) |
(srcline[(i / 2) * 5 + 3] >> 2);
y1 = ((srcline[(i / 2) * 5 + 3] & 0x03) << 8) | srcline[(i / 2) * 5 + 4];
dest[i * 4 + 0] = 0xff;
dest[i * 4 + 1] = y0 >> 2;
dest[i * 4 + 2] = u0 >> 2;
dest[i * 4 + 3] = v0 >> 2;
dest[i * 4 + 4] = 0xff;
dest[i * 4 + 5] = y1 >> 2;
dest[i * 4 + 6] = u0 >> 2;
dest[i * 4 + 7] = v0 >> 2;
}
} | false | false | false | false | false | 0 |
imgl_dialog_event(zdialog *zd, cchar *event)
{
GtkTextBuffer *textBuff;
GtkTextIter iter1, iter2;
char *ftemp;
static char *imagefile = 0;
int line, posn;
if (strEqu(event,"delete")) // delete file at cursor position
{
if (imagefile) zfree(imagefile);
imagefile = 0;
textBuff = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imgl_files));
line = imgl_cursorpos;
gtk_text_buffer_get_iter_at_line(textBuff,&iter1,line); // iter at line start
iter2 = iter1;
gtk_text_iter_forward_to_line_end(&iter2); // iter at line end
ftemp = gtk_text_buffer_get_text(textBuff,&iter1,&iter2,0); // get selected file
if (! ftemp || *ftemp != '/') {
if (ftemp) free(ftemp);
return 0;
}
imagefile = strdupz(ftemp,0,"imgl.getfiles"); // save deleted file for poss. insert
free(ftemp);
gtk_text_buffer_delete(textBuff,&iter1,&iter2); // delete file text
gtk_text_buffer_get_iter_at_line(textBuff,&iter2,line+1);
gtk_text_buffer_delete(textBuff,&iter1,&iter2); // delete empty line (\n)
imgl_showthumb(); // thumbnail = next file
}
if (strEqu(event,"insert")) // insert last deleted file
{ // at current cursor position
if (! imagefile) return 0;
imgl_insert_file(imagefile);
zfree(imagefile);
imagefile = 0;
}
if (strEqu(event,"addall")) // insert all files in image gallery
{
textBuff = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imgl_files));
posn = 0;
while (true)
{
imagefile = image_gallery(0,"find",posn); // get first or next file
if (! imagefile) break;
posn++;
gtk_text_buffer_get_iter_at_line(textBuff,&iter1,imgl_cursorpos);
gtk_text_buffer_insert(textBuff,&iter1,"\n",1); // insert new blank line
gtk_text_buffer_get_iter_at_line(textBuff,&iter1,imgl_cursorpos);
gtk_text_buffer_insert(textBuff,&iter1,imagefile,-1); // insert image file
zfree(imagefile);
imgl_cursorpos++; // advance cursor position
}
}
return 0;
} | false | false | false | false | false | 0 |
set_paradoxical_subreg (rtx *subreg, void *pdx_subregs)
{
rtx reg;
if ((*subreg) == NULL_RTX)
return 1;
if (GET_CODE (*subreg) != SUBREG)
return 0;
reg = SUBREG_REG (*subreg);
if (!REG_P (reg))
return 0;
if (paradoxical_subreg_p (*subreg))
((bool *)pdx_subregs)[REGNO (reg)] = true;
return 0;
} | false | false | false | false | false | 0 |
btmrvl_sdio_get_rx_unit(struct btmrvl_sdio_card *card)
{
u8 reg;
int ret;
reg = sdio_readb(card->func, card->reg->card_rx_unit, &ret);
if (!ret)
card->rx_unit = reg;
return ret;
} | false | false | false | false | false | 0 |
fpDiff(TIFF* tif, tidata_t cp0, tsize_t cc)
{
tsize_t stride = PredictorState(tif)->stride;
uint32 bps = tif->tif_dir.td_bitspersample / 8;
tsize_t wc = cc / bps;
tsize_t count;
uint8 *cp = (uint8 *) cp0;
uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
return;
_TIFFmemcpy(tmp, cp0, cc);
for (count = 0; count < wc; count++) {
uint32 byte;
for (byte = 0; byte < bps; byte++) {
#if WORDS_BIGENDIAN
cp[byte * wc + count] = tmp[bps * count + byte];
#else
cp[(bps - byte - 1) * wc + count] =
tmp[bps * count + byte];
#endif
}
}
_TIFFfree(tmp);
cp = (uint8 *) cp0;
cp += cc - stride - 1;
for (count = cc; count > stride; count -= stride)
REPEAT4(stride, cp[stride] -= cp[0]; cp--)
} | false | false | false | false | false | 0 |
_k_view_list_do_postdraw(state_t *s, gfxw_list_t *list)
{
gfxw_dyn_view_t *widget = (gfxw_dyn_view_t *) list->contents;
while (widget) {
reg_t obj = make_reg(widget->ID, widget->subID);
if (widget->type == GFXW_SORTED_LIST)
_k_view_list_do_postdraw(s, GFXWC(widget));
if (widget->type != GFXW_DYN_VIEW) {
widget = (gfxw_dyn_view_t *) widget->next;
continue;
}
/*
* this fixes a few problems, but doesn't match SSCI's logic.
* The semantics of the private flag need to be verified before this can be uncommented.
* Fixes bug #326 (CB1, ego falls down stairs)
* if ((widget->signal & (_K_VIEW_SIG_FLAG_FREESCI_PRIVATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == _K_VIEW_SIG_FLAG_FREESCI_PRIVATE) {
*/
if ((widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == 0) {
int has_nsrect = lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL) == SELECTOR_VARIABLE;
if (has_nsrect) {
int temp;
temp = GET_SEL32V(obj, nsLeft);
PUT_SEL32V(obj, lsLeft, temp);
temp = GET_SEL32V(obj, nsRight);
PUT_SEL32V(obj, lsRight, temp);
temp = GET_SEL32V(obj, nsTop);
PUT_SEL32V(obj, lsTop, temp);
temp = GET_SEL32V(obj, nsBottom);
PUT_SEL32V(obj, lsBottom, temp);
#ifdef DEBUG_LSRECT
fprintf(stderr, "lsRected "PREG"\n", PRINT_REG(obj));
#endif
}
#ifdef DEBUG_LSRECT
else fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj),
lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
#endif
if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN)
widget->signal |= _K_VIEW_SIG_FLAG_REMOVE;
}
#ifdef DEBUG_LSRECT
fprintf(stderr, "obj "PREG" has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
#endif
if (widget->signalp) {
*((reg_t *)(widget->signalp)) = make_reg(0, widget->signal & 0xffff); /* Write back signal */
}
widget = (gfxw_dyn_view_t *) widget->next;
}
} | false | false | false | false | false | 0 |
crypto_cert_select_default(krb5_context context,
pkinit_plg_crypto_context plg_cryptoctx,
pkinit_req_crypto_context req_cryptoctx,
pkinit_identity_crypto_context id_cryptoctx)
{
krb5_error_code retval;
int cert_count = 0;
retval = crypto_cert_get_count(context, plg_cryptoctx, req_cryptoctx,
id_cryptoctx, &cert_count);
if (retval) {
pkiDebug("%s: crypto_cert_get_count error %d, %s\n",
__FUNCTION__, retval, error_message(retval));
goto errout;
}
if (cert_count != 1) {
pkiDebug("%s: ERROR: There are %d certs to choose from, "
"but there must be exactly one.\n",
__FUNCTION__, cert_count);
retval = EINVAL;
goto errout;
}
/* copy the selected cert into our id_cryptoctx */
if (id_cryptoctx->my_certs != NULL) {
sk_X509_pop_free(id_cryptoctx->my_certs, X509_free);
}
id_cryptoctx->my_certs = sk_X509_new_null();
sk_X509_push(id_cryptoctx->my_certs, id_cryptoctx->creds[0]->cert);
id_cryptoctx->creds[0]->cert = NULL; /* Don't free it twice */
id_cryptoctx->cert_index = 0;
/* hang on to the selected credential name */
if (id_cryptoctx->creds[0]->name != NULL)
id_cryptoctx->identity = strdup(id_cryptoctx->creds[0]->name);
else
id_cryptoctx->identity = NULL;
if (id_cryptoctx->pkcs11_method != 1) {
id_cryptoctx->my_key = id_cryptoctx->creds[0]->key;
id_cryptoctx->creds[0]->key = NULL; /* Don't free it twice */
}
#ifndef WITHOUT_PKCS11
else {
id_cryptoctx->cert_id = id_cryptoctx->creds[0]->cert_id;
id_cryptoctx->creds[0]->cert_id = NULL; /* Don't free it twice */
id_cryptoctx->cert_id_len = id_cryptoctx->creds[0]->cert_id_len;
}
#endif
retval = 0;
errout:
return retval;
} | false | false | false | false | false | 0 |
write_uninitialized_csrs_and_memories(struct hfi1_devdata *dd)
{
int i, j;
/* CceIntMap */
for (i = 0; i < CCE_NUM_INT_MAP_CSRS; i++)
write_csr(dd, CCE_INT_MAP+(8*i), 0);
/* SendCtxtCreditReturnAddr */
for (i = 0; i < dd->chip_send_contexts; i++)
write_kctxt_csr(dd, i, SEND_CTXT_CREDIT_RETURN_ADDR, 0);
/* PIO Send buffers */
/* SDMA Send buffers */
/* These are not normally read, and (presently) have no method
to be read, so are not pre-initialized */
/* RcvHdrAddr */
/* RcvHdrTailAddr */
/* RcvTidFlowTable */
for (i = 0; i < dd->chip_rcv_contexts; i++) {
write_kctxt_csr(dd, i, RCV_HDR_ADDR, 0);
write_kctxt_csr(dd, i, RCV_HDR_TAIL_ADDR, 0);
for (j = 0; j < RXE_NUM_TID_FLOWS; j++)
write_uctxt_csr(dd, i, RCV_TID_FLOW_TABLE+(8*j), 0);
}
/* RcvArray */
for (i = 0; i < dd->chip_rcv_array_count; i++)
write_csr(dd, RCV_ARRAY + (8*i),
RCV_ARRAY_RT_WRITE_ENABLE_SMASK);
/* RcvQPMapTable */
for (i = 0; i < 32; i++)
write_csr(dd, RCV_QP_MAP_TABLE + (8 * i), 0);
} | false | false | false | false | false | 0 |
initialize( Chuck_VM_Code * c,
t_CKUINT mem_stack_size,
t_CKUINT reg_stack_size )
{
// allocate mem and reg
if( !mem->initialize( mem_stack_size ) ) return FALSE;
if( !reg->initialize( reg_stack_size ) ) return FALSE;
// program counter
pc = 0;
next_pc = 1;
// code pointer
code_orig = code = c;
// add reference
code_orig->add_ref();
// shred done
is_done = FALSE;
// shred running
is_running = FALSE;
// set the instr
instr = c->instr;
// zero out the id
xid = 0;
// initialize
initialize_object( this, &t_shred );
return TRUE;
} | false | false | false | false | false | 0 |
expand_string_for_rhs (string, quoted, dollar_at_p, has_dollar_at)
char *string;
int quoted, *dollar_at_p, *has_dollar_at;
{
WORD_DESC td;
WORD_LIST *tresult;
if (string == 0 || *string == '\0')
return (WORD_LIST *)NULL;
td.flags = 0;
td.word = string;
tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
return (tresult);
} | false | false | false | false | false | 0 |
nm_setting_vpn_add_data_item (NMSettingVPN *setting,
const char *key,
const char *item)
{
g_return_if_fail (NM_IS_SETTING_VPN (setting));
g_return_if_fail (key != NULL);
g_return_if_fail (strlen (key) > 0);
g_return_if_fail (item != NULL);
g_return_if_fail (strlen (item) > 0);
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
g_strdup (key), g_strdup (item));
} | false | false | false | false | false | 0 |
variable_add(plugin_t *plugin, const char *name, int type, int display, void *ptr, variable_notify_func_t *notify, variable_map_t *map, variable_display_func_t *dyndisplay) {
variable_t *v;
char *__name;
if (!name)
return NULL;
if (plugin && !xstrchr(name, ':'))
__name = saprintf("%s:%s", plugin->name, name);
else
__name = xstrdup(name);
v = xmalloc(sizeof(variable_t));
v->name = __name;
v->name_hash = variable_hash(__name);
v->type = type;
v->display = display;
v->ptr = ptr;
v->notify = notify;
v->map = map;
v->dyndisplay = dyndisplay;
v->plugin = plugin;
variables_add(v);
return v;
} | false | false | false | false | false | 0 |
extractMemberName( const QMetaMethod &member )
{
QString sig = member.signature();
return sig.left( sig.indexOf('(') ).toLatin1();
} | false | false | false | false | false | 0 |
set_hash(struct hashtable *h, char *key, char *value)
{
int i,j;
if (h->nent*5 > h->size*4)
rehash(h, h->nval*3);
j=-1;
i=crc(key)%h->size;
while (h->tab[i].left)
{
if (h->tab[i].left==DELETED_HASHENTRY)
if (j==-1)
j=i;
if (!strcmp(h->tab[i].left, key))
{
SFREE(h->tab[i].right);
h->tab[i].right=mystrdup(value);
return;
}
if (!i)
i=h->size;
i--;
}
if (j!=-1)
i=j;
else
h->nent++;
h->tab[i].left = mystrdup(key);
h->tab[i].right= mystrdup(value);
h->nval++;
} | false | false | false | false | false | 0 |
ProcessData(char* p, int len)
{
int res;
enum Command commandId = GetCurrentCommandId();
switch (commandId)
{
case cmd_transfer:
res = FileTransferParseResponse(p, len);
break;
default:
LogMessage(Debug_Warning, _T("No action for parsing data for command %d"), (int)commandId);
ResetOperation(FZ_REPLY_INTERNALERROR);
res = FZ_REPLY_ERROR;
break;
}
wxASSERT(p || !m_pCurOpData);
return res;
} | false | false | false | false | false | 0 |
kobj_to_hstate(struct kobject *kobj, int *nidp)
{
int i;
for (i = 0; i < HUGE_MAX_HSTATE; i++)
if (hstate_kobjs[i] == kobj) {
if (nidp)
*nidp = NUMA_NO_NODE;
return &hstates[i];
}
return kobj_to_node_hstate(kobj, nidp);
} | false | false | false | false | false | 0 |
skip_ascii(FILE *fp, int num)
{
int c,prev,curr,found;
c = getc(fp);
if (c == ' ' || c == '\n' || c == '\t'){
prev = 0;
found = 0;
}
else {
prev = 1;
found = 1;
}
while (1) {
c = getc(fp);
if (c == ' ' || c == '\n' || c == '\t') curr = 0;
else curr = 1;
if (prev != curr) found++;
if (found == 2*num) break;
prev=curr;
}
/* put back last whitespace */
ungetc(c,fp);
return OK;
} | false | true | false | false | true | 1 |
qpol_role_get_type_iter(const qpol_policy_t * policy, const qpol_role_t * datum, qpol_iterator_t ** types)
{
role_datum_t *internal_datum = NULL;
policydb_t *db = NULL;
ebitmap_t *expanded_set = NULL;
int error;
ebitmap_state_t *es = NULL;
if (policy == NULL || datum == NULL || types == NULL) {
if (types != NULL)
*types = NULL;
ERR(policy, "%s", strerror(EINVAL));
errno = EINVAL;
return STATUS_ERR;
}
internal_datum = (role_datum_t *) datum;
db = &policy->p->p;
if (!(expanded_set = calloc(1, sizeof(ebitmap_t)))) {
error = errno;
ERR(policy, "%s", "unable to create bitmap");
errno = error;
return STATUS_ERR;
}
if (type_set_expand(&internal_datum->types, expanded_set, db, 1)) {
ebitmap_destroy(expanded_set);
free(expanded_set);
ERR(policy, "error reading type set for role %s", db->p_role_val_to_name[internal_datum->s.value - 1]);
errno = EIO;
return STATUS_ERR;
}
if (!(es = calloc(1, sizeof(ebitmap_state_t)))) {
error = errno;
ERR(policy, "%s", "unable to create iterator state object");
ebitmap_destroy(expanded_set);
free(expanded_set);
errno = error;
return STATUS_ERR;
}
es->bmap = expanded_set;
es->cur = es->bmap->node ? es->bmap->node->startbit : 0;
if (qpol_iterator_create(policy, (void *)es, ebitmap_state_get_cur_type,
ebitmap_state_next, ebitmap_state_end, ebitmap_state_size, ebitmap_state_destroy, types)) {
error = errno;
ebitmap_state_destroy(es);
errno = error;
return STATUS_ERR;
}
if (es->bmap->node && !ebitmap_get_bit(es->bmap, es->cur))
ebitmap_state_next(*types);
return STATUS_SUCCESS;
} | false | false | false | false | false | 0 |
do_newobj (VerifyContext *ctx, int token)
{
ILStackDesc *value;
int i;
MonoMethodSignature *sig;
MonoMethod *method;
gboolean is_delegate = FALSE;
if (!(method = verifier_load_method (ctx, token, "newobj")))
return;
if (!mono_method_is_constructor (method)) {
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Method from token 0x%08x not a constructor at 0x%04x", token, ctx->ip_offset));
return;
}
if (method->klass->flags & (TYPE_ATTRIBUTE_ABSTRACT | TYPE_ATTRIBUTE_INTERFACE))
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Trying to instantiate an abstract or interface type at 0x%04x", ctx->ip_offset));
if (!IS_SKIP_VISIBILITY (ctx) && !mono_method_can_access_method_full (ctx->method, method, NULL)) {
char *from = mono_method_full_name (ctx->method, TRUE);
char *to = mono_method_full_name (method, TRUE);
CODE_NOT_VERIFIABLE2 (ctx, g_strdup_printf ("Constructor %s not visible from %s at 0x%04x", to, from, ctx->ip_offset), MONO_EXCEPTION_METHOD_ACCESS);
g_free (from);
g_free (to);
}
//FIXME use mono_method_get_signature_full
sig = mono_method_signature (method);
if (!sig) {
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid constructor signature to newobj at 0x%04x", ctx->ip_offset));
return;
}
if (!sig->hasthis) {
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid constructor signature missing hasthis at 0x%04x", ctx->ip_offset));
return;
}
if (!check_underflow (ctx, sig->param_count))
return;
is_delegate = method->klass->parent == mono_defaults.multicastdelegate_class;
if (is_delegate) {
ILStackDesc *funptr;
//first arg is object, second arg is fun ptr
if (sig->param_count != 2) {
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid delegate constructor at 0x%04x", ctx->ip_offset));
return;
}
funptr = stack_pop (ctx);
value = stack_pop (ctx);
verify_delegate_compatibility (ctx, method->klass, value, funptr);
} else {
for (i = sig->param_count - 1; i >= 0; --i) {
VERIFIER_DEBUG ( printf ("verifying constructor argument %d\n", i); );
value = stack_pop (ctx);
if (!verify_stack_type_compatibility (ctx, sig->params [i], value)) {
char *stack_name = stack_slot_full_name (value);
char *sig_name = mono_type_full_name (sig->params [i]);
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible parameter value with constructor signature: %s X %s at 0x%04x", sig_name, stack_name, ctx->ip_offset));
g_free (stack_name);
g_free (sig_name);
}
if (stack_slot_is_managed_mutability_pointer (value))
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use a readonly pointer as argument of newobj at 0x%04x", ctx->ip_offset));
}
}
if (check_overflow (ctx))
set_stack_value (ctx, stack_push (ctx), &method->klass->byval_arg, FALSE);
} | false | false | false | false | false | 0 |
ooTimerNextTimeout (DList *pList, struct timeval* ptimeout)
{
OOTimer* ptimer;
struct timeval tvstr;
if (pList->count == 0) return 0;
ptimer = (OOTimer*) pList->head->data;
ooGetTimeOfDay (&tvstr, 0);
ptimeout->tv_sec =
OOMAX ((int) 0, (int) (ptimer->expireTime.tv_sec - tvstr.tv_sec));
ptimeout->tv_usec = ptimer->expireTime.tv_usec - tvstr.tv_usec;
while (ptimeout->tv_usec < 0) {
ptimeout->tv_sec--;
ptimeout->tv_usec += USECS_IN_SECS;
}
if (ptimeout->tv_sec < 0)
ptimeout->tv_sec = ptimeout->tv_usec = 0;
return (ptimeout);
} | false | false | false | false | false | 0 |
hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg,
struct page *page)
{
unsigned int nr_pages;
struct page_counter *counter;
struct hugetlb_cgroup *page_hcg;
struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg);
page_hcg = hugetlb_cgroup_from_page(page);
/*
* We can have pages in active list without any cgroup
* ie, hugepage with less than 3 pages. We can safely
* ignore those pages.
*/
if (!page_hcg || page_hcg != h_cg)
goto out;
nr_pages = 1 << compound_order(page);
if (!parent) {
parent = root_h_cgroup;
/* root has no limit */
page_counter_charge(&parent->hugepage[idx], nr_pages);
}
counter = &h_cg->hugepage[idx];
/* Take the pages off the local counter */
page_counter_cancel(counter, nr_pages);
set_hugetlb_cgroup(page, parent);
out:
return;
} | false | false | false | false | false | 0 |
symsize(unsigned sym, const struct huftrees *trees)
{
unsigned basesym = sym &~ SYMPFX_MASK;
switch (sym & SYMPFX_MASK) {
case SYMPFX_LITLEN:
return trees->len_litlen[basesym];
case SYMPFX_DIST:
return trees->len_dist[basesym];
case SYMPFX_CODELEN:
return trees->len_codelen[basesym];
default /*case SYMPFX_EXTRABITS*/:
return basesym >> SYM_EXTRABITS_SHIFT;
}
} | false | false | false | false | false | 0 |
xlsx_write_autofilters (XLSXWriteState *state, GsfXMLOut *xml)
{
GnmFilter const *filter;
GnmFilterCondition const *cond;
unsigned i;
if (NULL == state->sheet->filters)
return;
filter = state->sheet->filters->data;
gsf_xml_out_start_element (xml, "autoFilter");
xlsx_add_range (xml, "ref", &filter->r);
for (i = 0; i < filter->fields->len ; i++) {
/* filter unused or bucket filters in excel5 */
if (NULL == (cond = gnm_filter_get_condition (filter, i)) ||
cond->op[0] == GNM_FILTER_UNUSED)
continue;
gsf_xml_out_start_element (xml, "filterColumn");
gsf_xml_out_add_int (xml, "colId", i);
switch (cond->op[0]) {
case GNM_FILTER_OP_EQUAL :
case GNM_FILTER_OP_GT :
case GNM_FILTER_OP_LT :
case GNM_FILTER_OP_GTE :
case GNM_FILTER_OP_LTE :
case GNM_FILTER_OP_NOT_EQUAL :
break;
case GNM_FILTER_OP_BLANKS :
case GNM_FILTER_OP_NON_BLANKS :
break;
case GNM_FILTER_OP_TOP_N :
case GNM_FILTER_OP_BOTTOM_N :
case GNM_FILTER_OP_TOP_N_PERCENT :
case GNM_FILTER_OP_BOTTOM_N_PERCENT :
gsf_xml_out_start_element (xml, "top10");
gsf_xml_out_add_float (xml, "val", cond->count, -1);
if (cond->op[0] & GNM_FILTER_OP_BOTTOM_MASK)
gsf_xml_out_add_cstr_unchecked (xml, "top", "0");
if (cond->op[0] & GNM_FILTER_OP_PERCENT_MASK)
gsf_xml_out_add_cstr_unchecked (xml, "percent", "1");
gsf_xml_out_end_element (xml); /* </top10> */
break;
default :
continue;
}
gsf_xml_out_end_element (xml); /* </filterColumn> */
}
gsf_xml_out_end_element (xml); /* </autoFilter> */
} | false | false | false | false | false | 0 |
bson_oid_from_string( bson_oid_t *oid, const char *str ) {
int i;
for ( i=0; i<12; i++ ) {
oid->bytes[i] = ( hexbyte( str[2*i] ) << 4 ) | hexbyte( str[2*i + 1] );
}
} | false | false | false | false | false | 0 |
GetOverview(int nLevel)
{
if (nZoomLevel != 0)
return NULL;
OZIDataset *poGDS = (OZIDataset *) poDS;
if (nLevel < 0 || nLevel >= poGDS->nZoomLevelCount - 1)
return NULL;
return poGDS->papoOvrBands[nLevel + 1];
} | false | false | false | false | false | 0 |
get_key_buffer(WINDOW *win)
{
int input;
size_t errcount;
/* If the keystroke buffer isn't empty, get out. */
if (key_buffer != NULL)
return;
/* Read in the first character using blocking input. */
#ifndef NANO_TINY
allow_pending_sigwinch(TRUE);
#endif
/* Just before reading in the first character, display any pending
* screen updates. */
doupdate();
errcount = 0;
if (nodelay_mode) {
if ((input = wgetch(win)) == ERR)
return;
} else
while ((input = wgetch(win)) == ERR) {
errcount++;
/* If we've failed to get a character MAX_BUF_SIZE times in a
* row, assume that the input source we were using is gone and
* die gracefully. We could check if errno is set to EIO
* ("Input/output error") and die gracefully in that case, but
* it's not always set properly. Argh. */
if (errcount == MAX_BUF_SIZE)
handle_hupterm(0);
}
#ifndef NANO_TINY
allow_pending_sigwinch(FALSE);
#endif
/* Increment the length of the keystroke buffer, and save the value
* of the keystroke at the end of it. */
key_buffer_len++;
key_buffer = (int *)nmalloc(sizeof(int));
key_buffer[0] = input;
/* Read in the remaining characters using non-blocking input. */
nodelay(win, TRUE);
while (TRUE) {
#ifndef NANO_TINY
allow_pending_sigwinch(TRUE);
#endif
input = wgetch(win);
/* If there aren't any more characters, stop reading. */
if (input == ERR)
break;
/* Otherwise, increment the length of the keystroke buffer, and
* save the value of the keystroke at the end of it. */
key_buffer_len++;
key_buffer = (int *)nrealloc(key_buffer, key_buffer_len *
sizeof(int));
key_buffer[key_buffer_len - 1] = input;
#ifndef NANO_TINY
allow_pending_sigwinch(FALSE);
#endif
}
/* Switch back to non-blocking input. */
nodelay(win, FALSE);
#ifdef DEBUG
fprintf(stderr, "get_key_buffer(): key_buffer_len = %lu\n", (unsigned long)key_buffer_len);
#endif
} | false | false | false | false | false | 0 |
flickr_service_add_signature (FlickrService *self,
const char *method,
const char *url,
GHashTable *parameters)
{
if (self->priv->server->new_authentication)
oauth_service_add_signature (OAUTH_SERVICE (self), method, url, parameters);
else
flickr_service_old_auth_add_api_sig (self, parameters);
} | false | false | false | false | false | 0 |
on_radiobutton17_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
gboolean success = FALSE;
GError **error = NULL;
global_alt_unit = (gtk_toggle_button_get_active(togglebutton)) ? 0 : global_alt_unit;
success = gconf_client_set_int(
global_gconfclient,
GCONF"/alt_unit",
global_alt_unit,
error);
} | false | false | false | false | false | 0 |
loadingScreen() {
if(!gGourceDrawBackground) return;
display.mode2D();
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glColor4f(1.0, 1.0, 1.0, 1.0);
const char* progress = "";
switch(int(runtime*3.0f)%4) {
case 0:
progress = "";
break;
case 1:
progress = ".";
break;
case 2:
progress = "..";
break;
case 3:
progress = "...";
break;
}
const char* action = !shutdown ? "Reading Log" : "Aborting";
int width = font.getWidth(action);
font.setColour(vec4(1.0f));
font.print(display.width/2 - width/2, display.height/2 - 10, "%s%s", action, progress);
} | false | false | false | false | false | 0 |
operator* (const cl_RA& r, const cl_RA& s)
{
// Methode (vgl. [Buchberger, Collins, Loos: Computer Algebra, S.201])
// r,s beide Integers -> klar.
// r=a/b, s=c ->
// Bei c=0 Ergebnis 0.
// g:=ggT(b,c).
// Falls g=1: Ergebnis (a*c)/b (mit b>1, ggT(a*c,b)=1).
// Sonst: b':=b/g, c':=c/g, Ergebnis (a*c')/b' (mit ggT(a*c',b')=1).
// r=a, s=c/d analog.
// r=a/b, s=c/d ->
// g:=ggT(a,d), h:=ggT(b,c).
// a':=a/g, d':=d/g (nur bei g>1 bedeutet das Rechnung).
// b':=b/h, c':=c/h (nur bei h>1 bedeutet das Rechnung).
// Ergebnis ist = (a'*c')/(b'*d').
if (integerp(s)) {
// s Integer
DeclareType(cl_I,s);
if (integerp(r)) {
// beides Integer
DeclareType(cl_I,r);
return r*s;
} else {
DeclareType(cl_RT,r);
var const cl_I& a = numerator(r);
var const cl_I& b = denominator(r);
var const cl_I& c = s;
// r=a/b, s=c, bilde a/b * c.
if (zerop(c))
{ return 0; } // c=0 -> Ergebnis 0
var cl_I g = gcd(b,c);
if (eq(g,1))
// g=1
return I_I_to_RT(a*c,b); // (a*c)/b
else
// g>1
return I_I_to_RA(a*exquo(c,g),exquopos(b,g)); // (a*(c/g))/(b/g)
}
} else {
// s ist Ratio
DeclareType(cl_RT,s);
if (integerp(r)) {
// r Integer
DeclareType(cl_I,r);
var const cl_I& a = r;
var const cl_I& b = numerator(s);
var const cl_I& c = denominator(s);
// r=a, s=b/c, bilde a * b/c.
if (zerop(a))
{ return 0; } // a=0 -> Ergebnis 0
var cl_I g = gcd(a,c);
if (eq(g,1))
// g=1
return I_I_to_RT(a*b,c); // (a*b)/c
else
// g>1
return I_I_to_RA(exquo(a,g)*b,exquopos(c,g)); // ((a/g)*b)/(c/g)
} else {
// r,s beide Ratios
DeclareType(cl_RT,r);
var const cl_I& a = numerator(r);
var const cl_I& b = denominator(r);
var const cl_I& c = numerator(s);
var const cl_I& d = denominator(s);
var cl_I ap, dp;
{
var cl_I g = gcd(a,d);
if (eq(g,1))
{ ap = a; dp = d; }
else
{ ap = exquo(a,g); dp = exquopos(d,g); }
}
var cl_I cp, bp;
{
var cl_I h = gcd(b,c);
if (eq(h,1))
{ cp = c; bp = b; }
else
{ cp = exquo(c,h); bp = exquopos(b,h); }
}
return I_I_to_RA(ap*cp,bp*dp); // (a'*c')/(b'*d')
}
}
} | false | false | false | false | false | 0 |
pci_common_swizzle(struct pci_dev *dev, u8 *pinp)
{
u8 pin = *pinp;
while (!pci_is_root_bus(dev->bus)) {
pin = pci_swizzle_interrupt_pin(dev, pin);
dev = dev->bus->self;
}
*pinp = pin;
return PCI_SLOT(dev->devfn);
} | false | false | false | false | false | 0 |
compute_bb_for_insn (void)
{
basic_block bb;
FOR_EACH_BB (bb)
{
rtx end = BB_END (bb);
rtx insn;
for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
{
BLOCK_FOR_INSN (insn) = bb;
if (insn == end)
break;
}
}
} | false | false | false | false | false | 0 |
load_revtype_data(void) {
int i;
/* load combs data */
num_combs = 2 * curr->num_combs;
for (i = 0; i < curr->num_combs; i++) {
combs[2*i].buflen = curr->combs_data[3*i] * sample_rate / 1000.0f;
combs[2*i].feedback = curr->combs_data[3*i+1];
combs[2*i].freq_resp = LIMIT(curr->combs_data[3*i+2]
* powf(sample_rate / 44100.0f, 0.8f),
0.0f, 1.0f);
combs[2*i+1].buflen = combs[2*i].buflen;
combs[2*i+1].feedback = combs[2*i].feedback;
combs[2*i+1].freq_resp = combs[2*i].freq_resp;
lp_set_params(&(combs[2*i].filter),
2000.0f + 13000.0f * (1 - curr->combs_data[3*i+2])
* sample_rate / 44100.0f,
BANDPASS_BWIDTH, sample_rate);
lp_set_params(&(combs[2*i+1].filter),
2000.0f + 13000.0f * (1 - curr->combs_data[3*i+2])
* sample_rate / 44100.0f,
BANDPASS_BWIDTH, sample_rate);
}
/* load allps data */
num_allps = 2 * curr->num_allps;
for (i = 0; i < curr->num_allps; i++) {
allps[2*i].buflen = curr->allps_data[2*i] * sample_rate / 1000.0f;
allps[2*i].feedback = curr->allps_data[2*i+1];
allps[2*i+1].buflen = allps[2*i].buflen;
allps[2*i+1].feedback = allps[2*i].feedback;
}
/* init bandpass filters */
lp_set_params(&(low_pass[0]), curr->bandps_hi, BANDPASS_BWIDTH, sample_rate);
hp_set_params(&(high_pass[0]), curr->bandps_lo, BANDPASS_BWIDTH, sample_rate);
lp_set_params(&(low_pass[1]), curr->bandps_hi, BANDPASS_BWIDTH, sample_rate);
hp_set_params(&(high_pass[1]), curr->bandps_lo, BANDPASS_BWIDTH, sample_rate);
} | false | false | false | false | false | 0 |
free_field_buffers_larger_than(TABLE *table, uint32 size)
{
uint *ptr, *end;
for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
ptr != end ;
ptr++)
{
Field_blob *blob= (Field_blob*) table->field[*ptr];
if (blob->get_field_buffer_size() > size)
blob->free();
}
} | false | false | false | false | false | 0 |
lad_sm_make_offset(Module_table *module,
Loop *sm_loop,
StripMining *sm,
Array_table *ldm,
int dim)
{
StripMiningInnerLoop *smil;
Block *block;
List *li;
SemTree *vss, *vss_prev, *vss_max, *vss_max_prev, *max_access_sem, *min_access_sem;
Operand *min_access_op, *max_access_op;
vss = NULL;
vss_prev = NULL;
vss_max = NULL;
vss_max_prev = NULL;
for (li = sm->loops; li != NULL; li = li->next) {
smil = SMIL(li->data);
block = smil->block;
if (lad_sm_check_maymod_mayuse(block, ldm->entry)){
lad_sm_make_min_access_search_block(sm,
smil,
block,
ldm,
&vss,
&vss_prev,
dim);
lad_sm_make_max_access_search_block(smil,
block,
ldm,
&vss_max,
&vss_max_prev,
dim,
2);
}
}
min_access_sem = make_semtree_scalar(module,
create_lm_var(module, TYPE_INT, NULL, 1));
min_access_op = get_new_op_var(semtree_to_scalar(min_access_sem));
bb_add_assign_stm(sm_loop->block->inner,
min_access_sem,
vss,
module);
lad_sm_add_lower_strip_mining_cmp(sm->cmp_head,
ldm->entry,
min_access_op->tbl.v);
if (vss_max != NULL) {
max_access_sem = make_semtree_scalar(module,
create_lm_var(module,
TYPE_INT, NULL, 1));
max_access_op = get_new_op_var(semtree_to_scalar(max_access_sem));
if(opt_lad_sm_cmp_debug)
printf("max_access_var : %d\n", max_access_op->entry);
lad_sm_add_upper_strip_mining_cmp(sm->cmp_head,
ldm->entry,
max_access_op->tbl.v);
bb_add_assign_stm(sm_loop->block->inner,
max_access_sem,
vss_max,
module);
}
} | false | false | false | false | false | 0 |
gitg_commit_refresh (GitgCommit *commit)
{
g_return_if_fail (GITG_IS_COMMIT (commit));
shell_cancel (commit);
g_hash_table_foreach (commit->priv->files, (GHFunc)set_can_delete, commit);
/* Read other files */
if (commit->priv->repository)
{
update_index (commit);
}
else
{
refresh_done (commit->priv->shell, FALSE, commit);
}
} | false | false | false | false | false | 0 |
SECOID_Init(void)
{
PLHashEntry *entry;
const SECOidData *oid;
int i;
char * envVal;
volatile char c; /* force a reference that won't get optimized away */
c = __nss_util_rcsid[0] + __nss_util_sccsid[0];
if (oidhash) {
return SECSuccess; /* already initialized */
}
if (!PR_GetEnv("NSS_ALLOW_WEAK_SIGNATURE_ALG")) {
/* initialize any policy flags that are disabled by default */
xOids[SEC_OID_MD2 ].notPolicyFlags = ~0;
xOids[SEC_OID_MD4 ].notPolicyFlags = ~0;
xOids[SEC_OID_MD5 ].notPolicyFlags = ~0;
xOids[SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION ].notPolicyFlags = ~0;
xOids[SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION ].notPolicyFlags = ~0;
xOids[SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION ].notPolicyFlags = ~0;
xOids[SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC].notPolicyFlags = ~0;
xOids[SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC].notPolicyFlags = ~0;
}
envVal = PR_GetEnv("NSS_HASH_ALG_SUPPORT");
if (envVal)
handleHashAlgSupport(envVal);
if (secoid_InitDynOidData() != SECSuccess) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0); /* this function should never fail */
return SECFailure;
}
oidhash = PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare,
PL_CompareValues, NULL, NULL);
oidmechhash = PL_NewHashTable(0, secoid_HashNumber, PL_CompareValues,
PL_CompareValues, NULL, NULL);
if ( !oidhash || !oidmechhash) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0); /*This function should never fail. */
return(SECFailure);
}
for ( i = 0; i < SEC_OID_TOTAL; i++ ) {
oid = &oids[i];
PORT_Assert ( oid->offset == i );
entry = PL_HashTableAdd( oidhash, &oid->oid, (void *)oid );
if ( entry == NULL ) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0); /*This function should never fail. */
return(SECFailure);
}
if ( oid->mechanism != CKM_INVALID_MECHANISM ) {
entry = PL_HashTableAdd( oidmechhash,
(void *)oid->mechanism, (void *)oid );
if ( entry == NULL ) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0); /* This function should never fail. */
return(SECFailure);
}
}
}
PORT_Assert (i == SEC_OID_TOTAL);
return(SECSuccess);
} | false | false | false | false | false | 0 |
pushCommand(const UndoCommand& cmd)
{
m_commands.append(cmd);
emit q->undoAvailable(true);
emit q->undoTextChanged(q->undoText());
} | false | false | false | false | false | 0 |
find_symbol( const char * name )
{
size_t i;
for ( i = 0; i < nsymbols; i++ )
if ( ! strcmp( symbols[ i ].name, name ) )
break;
return i < nsymbols ? symbols + i : NULL;
} | false | false | false | false | false | 0 |
lutil_passwd(
const struct berval *passwd, /* stored passwd */
const struct berval *cred, /* user cred */
const char **schemes,
const char **text )
{
struct pw_slist *pws;
if ( text ) *text = NULL;
if (cred == NULL || cred->bv_len == 0 ||
passwd == NULL || passwd->bv_len == 0 )
{
return -1;
}
if (!pw_inited) lutil_passwd_init();
for( pws=pw_schemes; pws; pws=pws->next ) {
if( pws->s.chk_fn ) {
struct berval x;
struct berval *p = passwd_scheme( &(pws->s),
passwd, &x, schemes );
if( p != NULL ) {
return (pws->s.chk_fn)( &(pws->s.name), p, cred, text );
}
}
}
#ifdef SLAPD_CLEARTEXT
/* Do we think there is a scheme specifier here that we
* didn't recognize? Assume a scheme name is at least 1 character.
*/
if (( passwd->bv_val[0] == '{' ) &&
( ber_bvchr( passwd, '}' ) > passwd->bv_val+1 ))
{
return 1;
}
if( is_allowed_scheme("{CLEARTEXT}", schemes ) ) {
return ( passwd->bv_len == cred->bv_len ) ?
memcmp( passwd->bv_val, cred->bv_val, passwd->bv_len )
: 1;
}
#endif
return 1;
} | false | false | false | false | false | 0 |
midgard_storage_exists (MidgardConnection *mgd, const gchar *name)
{
g_return_val_if_fail (mgd != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
MidgardDBObjectClass *klass = g_type_class_peek (g_type_from_name (name));
if (!MIDGARD_IS_DBOBJECT_CLASS (klass)) {
g_warning ("Expected DBObject derived instance. '%s' given", name);
return FALSE;
}
if (klass->dbpriv->storage_exists == NULL)
return FALSE;
return klass->dbpriv->storage_exists(mgd, klass);
} | false | false | false | false | false | 0 |
LaunchScript (int *NbArg,long *TabArg)
{
char *arg,*execstr,*str,*scriptarg,*scriptname;
unsigned long leng;
int i;
Atom MyAtom;
/* Lecture des arguments */
(*NbArg)++;
arg = CalcArg(TabArg,NbArg);
str = (char*)safecalloc(100,sizeof(char));
/* Calcul du nom du script fils */
x11base->TabScriptId[x11base->NbChild+2] =
(char*)safecalloc(strlen(x11base->TabScriptId[1])+4,sizeof(char));
if (x11base->NbChild<98)
{
i=16;
do
{
sprintf(x11base->TabScriptId[x11base->NbChild + 2],"%s%x",
x11base->TabScriptId[1],i);
MyAtom = XInternAtom(dpy,x11base->TabScriptId[x11base->NbChild + 2],False);
i++;
}
while (XGetSelectionOwner(dpy,MyAtom)!=None);
}
else
{
fprintf(stderr,"[%s][LaunchScript]: Too many launched script\n", ScriptName);
sprintf(str,"-1");
return str;
}
/* Construction de la commande */
execstr = (char*)safecalloc(strlen(module->name) + strlen(arg) +
strlen(x11base->TabScriptId[x11base->NbChild + 2]) + 5,sizeof(char));
scriptname = (char*)safecalloc(sizeof(char),100);
sscanf(arg,"%s",scriptname);
scriptarg = (char*)safecalloc(sizeof(char),strlen(arg));
scriptarg = (char*)strncpy(scriptarg, &arg[strlen(scriptname)],
strlen(arg) - strlen(scriptname));
sprintf(execstr,"%s %s %s %s",module->name,scriptname,
x11base->TabScriptId[x11base->NbChild + 2],scriptarg);
free(scriptname);
free(scriptarg);
free(arg);
/* Envoi de la commande */
write(fd[0], &ref, sizeof(Window));
leng = strlen(execstr);
write(fd[0], &leng, sizeof(unsigned long));
write(fd[0], execstr, leng);
leng = 1;
write(fd[0], &leng, sizeof(unsigned long));
free(execstr);
/* Retourne l'id du fils */
sprintf(str,"%d",x11base->NbChild+2);
x11base->NbChild++;
return str;
} | false | false | false | false | false | 0 |
UpdateExtraTable(TXT_UNCAST_ARG(widget),
TXT_UNCAST_ARG(extra_table))
{
TXT_CAST_ARG(txt_table_t, extra_table);
// Rebuild the GUS table. Start by emptying it, then only add the
// GUS control widget if we are in GUS music mode.
TXT_ClearTable(extra_table);
if (snd_musicmode == MUSICMODE_GUS)
{
TXT_AddWidgets(extra_table,
TXT_NewLabel("GUS patch path:"),
TXT_NewFileSelector(&gus_patch_path, 30,
"Select path to GUS patches",
TXT_DIRECTORY),
NULL);
}
if (snd_musicmode == MUSICMODE_NATIVE)
{
TXT_AddWidgets(extra_table,
TXT_NewLabel("Timidity configuration file:"),
TXT_NewFileSelector(&timidity_cfg_path, 30,
"Select Timidity config file",
cfg_extension),
NULL);
}
} | false | false | false | false | false | 0 |
cp_set_mac_address(struct net_device *dev, void *p)
{
struct cp_private *cp = netdev_priv(dev);
struct sockaddr *addr = p;
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
spin_lock_irq(&cp->lock);
cpw8_f(Cfg9346, Cfg9346_Unlock);
cpw32_f(MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
cpw32_f(MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
cpw8_f(Cfg9346, Cfg9346_Lock);
spin_unlock_irq(&cp->lock);
return 0;
} | false | true | false | false | false | 1 |
AcpiOsReleaseObject (
ACPI_MEMORY_LIST *Cache,
void *Object)
{
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
if (!Cache || !Object)
{
return (AE_BAD_PARAMETER);
}
/* If cache is full, just free this object */
if (Cache->CurrentDepth >= Cache->MaxDepth)
{
ACPI_FREE (Object);
ACPI_MEM_TRACKING (Cache->TotalFreed++);
}
/* Otherwise put this object back into the cache */
else
{
Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Mark the object as cached */
ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead);
Cache->ListHead = Object;
Cache->CurrentDepth++;
(void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
}
return (AE_OK);
} | false | false | false | false | false | 0 |
parse_options(int argc, char ** argv)
{
int c;
for (c=getopt(argc, argv, OPTIONS_LIST);
c!=-1;
c=getopt(argc, argv, OPTIONS_LIST))
{
switch(c)
{
case 'h':
usage();
exit(0);
case '?':
break;
default:
fprintf (stderr, "?? getopt returned character code 0%o ??\n", c);
}
}
if (argc-optind<1 || argc-optind>2)
{
usage();
exit(EXIT_FAILURE);
}
input_file=argv[optind];
if (argc-optind==2) output_file=argv[optind+1];
} | false | false | false | false | false | 0 |
asd_com_sas_isr(struct asd_ha_struct *asd_ha)
{
u32 comstat = asd_read_reg_dword(asd_ha, COMSTAT);
/* clear COMSTAT int */
asd_write_reg_dword(asd_ha, COMSTAT, 0xFFFFFFFF);
if (comstat & CSBUFPERR) {
asd_printk("%s: command/status buffer dma parity error\n",
pci_name(asd_ha->pcidev));
} else if (comstat & CSERR) {
int i;
u32 dmaerr = asd_read_reg_dword(asd_ha, DMAERR);
dmaerr &= 0xFF;
asd_printk("%s: command/status dma error, DMAERR: 0x%02x, "
"CSDMAADR: 0x%04x, CSDMAADR+4: 0x%04x\n",
pci_name(asd_ha->pcidev),
dmaerr,
asd_read_reg_dword(asd_ha, CSDMAADR),
asd_read_reg_dword(asd_ha, CSDMAADR+4));
asd_printk("CSBUFFER:\n");
for (i = 0; i < 8; i++) {
asd_printk("%08x %08x %08x %08x\n",
asd_read_reg_dword(asd_ha, CSBUFFER),
asd_read_reg_dword(asd_ha, CSBUFFER+4),
asd_read_reg_dword(asd_ha, CSBUFFER+8),
asd_read_reg_dword(asd_ha, CSBUFFER+12));
}
asd_dump_seq_state(asd_ha, 0);
} else if (comstat & OVLYERR) {
u32 dmaerr = asd_read_reg_dword(asd_ha, DMAERR);
dmaerr = (dmaerr >> 8) & 0xFF;
asd_printk("%s: overlay dma error:0x%x\n",
pci_name(asd_ha->pcidev),
dmaerr);
}
asd_chip_reset(asd_ha);
} | false | false | false | false | false | 0 |
getForeignDataWrappers(int *numForeignDataWrappers)
{
PGresult *res;
int ntups;
int i;
PQExpBuffer query = createPQExpBuffer();
FdwInfo *fdwinfo;
int i_tableoid;
int i_oid;
int i_fdwname;
int i_rolname;
int i_fdwvalidator;
int i_fdwacl;
int i_fdwoptions;
/* Before 8.4, there are no foreign-data wrappers */
if (g_fout->remoteVersion < 80400)
{
*numForeignDataWrappers = 0;
return NULL;
}
/* Make sure we are in proper schema */
selectSourceSchema("pg_catalog");
appendPQExpBuffer(query, "SELECT tableoid, oid, fdwname, "
"(%s fdwowner) AS rolname, fdwvalidator::pg_catalog.regproc, fdwacl,"
"array_to_string(ARRAY("
" SELECT option_name || ' ' || quote_literal(option_value) "
" FROM pg_options_to_table(fdwoptions)), ', ') AS fdwoptions "
"FROM pg_foreign_data_wrapper",
username_subquery);
res = PQexec(g_conn, query->data);
check_sql_result(res, g_conn, query->data, PGRES_TUPLES_OK);
ntups = PQntuples(res);
*numForeignDataWrappers = ntups;
fdwinfo = (FdwInfo *) malloc(ntups * sizeof(FdwInfo));
i_tableoid = PQfnumber(res, "tableoid");
i_oid = PQfnumber(res, "oid");
i_fdwname = PQfnumber(res, "fdwname");
i_rolname = PQfnumber(res, "rolname");
i_fdwvalidator = PQfnumber(res, "fdwvalidator");
i_fdwacl = PQfnumber(res, "fdwacl");
i_fdwoptions = PQfnumber(res, "fdwoptions");
for (i = 0; i < ntups; i++)
{
fdwinfo[i].dobj.objType = DO_FDW;
fdwinfo[i].dobj.catId.tableoid = atooid(PQgetvalue(res, i, i_tableoid));
fdwinfo[i].dobj.catId.oid = atooid(PQgetvalue(res, i, i_oid));
AssignDumpId(&fdwinfo[i].dobj);
fdwinfo[i].dobj.name = strdup(PQgetvalue(res, i, i_fdwname));
fdwinfo[i].dobj.namespace = NULL;
fdwinfo[i].rolname = strdup(PQgetvalue(res, i, i_rolname));
fdwinfo[i].fdwvalidator = strdup(PQgetvalue(res, i, i_fdwvalidator));
fdwinfo[i].fdwoptions = strdup(PQgetvalue(res, i, i_fdwoptions));
fdwinfo[i].fdwacl = strdup(PQgetvalue(res, i, i_fdwacl));
/* Decide whether we want to dump it */
selectDumpableObject(&(fdwinfo[i].dobj));
}
PQclear(res);
destroyPQExpBuffer(query);
return fdwinfo;
} | false | true | false | false | false | 1 |
sche_task_array_set_order(Sche_task ****array, int pc_num, int acc_num)
{
Sche_task ***array_cpu = array[PROC_CPU];
Sche_task ***array_acc = array[PROC_ACC];
Sche_task *task;
int pc_no;
int pred = 0;
int *cntr = alloc_int_vector(pc_num + acc_num);
for (pc_no = 0; pc_no < pc_num; pc_no++) {
if (array_cpu[pc_no][0] == NULL)
cntr[pc_no] = -1;
}
for (pc_no = 0; pc_no < acc_num; pc_no++) {
if (array_acc[pc_no][0] == NULL)
cntr[pc_no + pc_num] = -1;
}
for (; !same_value_int_vector(cntr, pc_num + acc_num, -1); ) {
for (pc_no = 0; pc_no < pc_num + acc_num; pc_no++) {
List *li;
if (cntr[pc_no] == -1)
continue;
if (pc_no < pc_num) {
task = array_cpu[pc_no][cntr[pc_no]];
} else {
task = array_acc[pc_no - pc_num][cntr[pc_no]];
}
for (li = task->recv_list; li != NULL; li = li->next) {
Sche_task *t = list_first_data(li);
if (t->order == -1 || t->order == pred+1)
break;
}
if (li == NULL) {
task->order = pred + 1;
if (task->is_last_in_pc)
cntr[pc_no] = -1;
else
cntr[pc_no]++;
}
}
pred++;
}
} | false | false | false | false | false | 0 |
progressBar(QWidget *w)
{
if (!d->m_ProgressBar)
d->m_ProgressBar = new QProgressBar(w);
return d->m_ProgressBar;
} | false | false | false | false | false | 0 |
WriteToAsWrappedType( const WrappedType & W )
{
wxASSERT( W.eWrappedType == eWrappedType );
switch( eWrappedType )
{
case eWrappedString:
*mpStr = *W.mpStr;
break;
case eWrappedInt:
*mpInt = *W.mpInt;
break;
case eWrappedDouble:
*mpDouble = *W.mpDouble;
break;
case eWrappedBool:
*mpBool = *W.mpBool;
break;
case eWrappedEnum:
wxASSERT( false );
break;
default:
wxASSERT( false );
break;
}
} | false | false | false | false | false | 0 |
GetEvents(alist<astring> &events)
{
lock();
if (m_socket == -1 && !open()) {
unlock();
return false;
}
if (net_send(m_socket, "events", 6) != 6) {
close();
unlock();
return false;
}
events.clear();
char temp[1024];
int len;
while ((len = net_recv(m_socket, temp, sizeof(temp)-1)) > 0)
{
temp[len] = '\0';
rtrim(temp);
events.append(temp);
}
if (len == -1)
close();
unlock();
return true;
} | false | false | false | false | false | 0 |
adis16203_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2,
long mask)
{
struct adis *st = iio_priv(indio_dev);
int ret;
int bits;
u8 addr;
s16 val16;
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
ADIS16203_ERROR_ACTIVE, val);
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_VOLTAGE:
if (chan->channel == 0) {
*val = 1;
*val2 = 220000; /* 1.22 mV */
} else {
*val = 0;
*val2 = 610000; /* 0.61 mV */
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
*val = -470; /* -0.47 C */
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_INCLI:
*val = 0;
*val2 = 25000; /* 0.025 degree */
return IIO_VAL_INT_PLUS_MICRO;
default:
return -EINVAL;
}
case IIO_CHAN_INFO_OFFSET:
*val = 25000 / -470 - 1278; /* 25 C = 1278 */
return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS:
bits = 14;
mutex_lock(&indio_dev->mlock);
addr = adis16203_addresses[chan->scan_index];
ret = adis_read_reg_16(st, addr, &val16);
if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret;
}
val16 &= (1 << bits) - 1;
val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
*val = val16;
mutex_unlock(&indio_dev->mlock);
return IIO_VAL_INT;
default:
return -EINVAL;
}
} | false | false | false | false | false | 0 |
frontlocate(struct mesh *m, struct splaynode *splayroot,
struct otri *bottommost, vertex searchvertex,
struct otri *searchtri, int *farright)
#else /* not ANSI_DECLARATORS */
struct splaynode *frontlocate(m, splayroot, bottommost, searchvertex,
searchtri, farright)
struct mesh *m;
struct splaynode *splayroot;
struct otri *bottommost;
vertex searchvertex;
struct otri *searchtri;
int *farright;
#endif /* not ANSI_DECLARATORS */
{
int farrightflag;
triangle ptr; /* Temporary variable used by onext(). */
otricopy(*bottommost, *searchtri);
splayroot = splay(m, splayroot, searchvertex, searchtri);
farrightflag = 0;
while (!farrightflag && rightofhyperbola(m, searchtri, searchvertex)) {
onextself(*searchtri);
farrightflag = otriequal(*searchtri, *bottommost);
}
*farright = farrightflag;
return splayroot;
} | false | false | false | false | false | 0 |
locate(pattern,linep)
/* locate: find a character in a closure */
char *pattern;
register char *linep;
{
register char *p = 1+pattern;
register int count;
if ((count = (*p++)&0xff) == 0)
return FALSE;
while (count--)
if (*p++ == *linep)
return TRUE;
return FALSE;
} | false | false | false | false | false | 0 |
ajGraphicsDrawposBox(PLFLT x, PLFLT y,PLFLT size)
{
PLFLT xa[5];
PLFLT ya[5];
if(graphData)
{
ajFmtPrintF(graphData->File,"Rectangle x1 %f y1 %f x2 %f"
" y2 %f colour %d\n",
x, y, x+size, y+size, currentfgcolour);
graphData->Lines++;
}
else
{
xa[0] = x;
ya[0] = y;
xa[1] = x;
ya[1] = y + size;
xa[2] = x + size;
ya[2] = y + size;
xa[3] = x + size;
ya[3] = y;
xa[4] = x;
ya[4] = y;
GraphArray(5, xa, ya);
}
return;
} | false | false | false | false | false | 0 |
remparty(char *bot, int sock)
{
int i;
for (i = 0; i < parties; i++)
if ((!egg_strcasecmp(party[i].bot, bot)) && (party[i].sock == sock)) {
parties--;
if (party[i].from)
nfree(party[i].from);
if (party[i].away)
nfree(party[i].away);
if (i < parties) {
strcpy(party[i].bot, party[parties].bot);
strcpy(party[i].nick, party[parties].nick);
party[i].chan = party[parties].chan;
party[i].sock = party[parties].sock;
party[i].flag = party[parties].flag;
party[i].status = party[parties].status;
party[i].timer = party[parties].timer;
party[i].from = party[parties].from;
party[i].away = party[parties].away;
}
}
} | false | false | false | false | false | 0 |
chk_filter_chain(ap_filter_t *f)
{
ap_filter_t *curf;
charset_filter_ctx_t *curctx, *last_xlate_ctx = NULL,
*ctx = f->ctx;
int output = !strcasecmp(f->frec->name, XLATEOUT_FILTER_NAME);
if (ctx->noop) {
return;
}
/* walk the filter chain; see if it makes sense for our filter to
* do any translation
*/
curf = output ? f->r->output_filters : f->r->input_filters;
while (curf) {
if (!strcasecmp(curf->frec->name, f->frec->name) &&
curf->ctx) {
curctx = (charset_filter_ctx_t *)curf->ctx;
if (!last_xlate_ctx) {
last_xlate_ctx = curctx;
}
else {
if (strcmp(last_xlate_ctx->dc->charset_default,
curctx->dc->charset_source)) {
/* incompatible translation
* if our filter instance is incompatible with an instance
* already in place, noop our instance
* Notes:
* . We are only willing to noop our own instance.
* . It is possible to noop another instance which has not
* yet run, but this is not currently implemented.
* Hopefully it will not be needed.
* . It is not possible to noop an instance which has
* already run.
*/
if (last_xlate_ctx == f->ctx) {
last_xlate_ctx->noop = 1;
if (APLOGrtrace1(f->r)) {
const char *symbol = output ? "->" : "<-";
ap_log_rerror(APLOG_MARK, APLOG_DEBUG,
0, f->r, APLOGNO(01451)
"%s %s - disabling "
"translation %s%s%s; existing "
"translation %s%s%s",
f->r->uri ? "uri" : "file",
f->r->uri ? f->r->uri : f->r->filename,
last_xlate_ctx->dc->charset_source,
symbol,
last_xlate_ctx->dc->charset_default,
curctx->dc->charset_source,
symbol,
curctx->dc->charset_default);
}
}
else {
const char *symbol = output ? "->" : "<-";
ap_log_rerror(APLOG_MARK, APLOG_ERR,
0, f->r, APLOGNO(01452)
"chk_filter_chain() - can't disable "
"translation %s%s%s; existing "
"translation %s%s%s",
last_xlate_ctx->dc->charset_source,
symbol,
last_xlate_ctx->dc->charset_default,
curctx->dc->charset_source,
symbol,
curctx->dc->charset_default);
}
break;
}
}
}
curf = curf->next;
}
} | false | false | false | false | false | 0 |
_node(struct dm_pool *mem, int type,
struct rx_node *l, struct rx_node *r)
{
struct rx_node *n = dm_pool_zalloc(mem, sizeof(*n));
if (n) {
if (type == CHARSET && !(n->charset = dm_bitset_create(mem, 256))) {
dm_pool_free(mem, n);
return NULL;
}
n->type = type;
n->left = l;
n->right = r;
}
return n;
} | false | false | false | false | false | 0 |
trace_ok_for_array(struct tracer *t, struct trace_array *tr)
{
return (tr->flags & TRACE_ARRAY_FL_GLOBAL) || t->allow_instances;
} | false | false | false | false | false | 0 |
mono_ssa_deadce (MonoCompile *cfg)
{
int i;
GList *work_list;
g_assert (cfg->comp_done & MONO_COMP_SSA);
//printf ("DEADCE %s\n", mono_method_full_name (cfg->method, TRUE));
if (!(cfg->comp_done & MONO_COMP_SSA_DEF_USE))
mono_ssa_create_def_use (cfg);
mono_ssa_copyprop (cfg);
work_list = NULL;
for (i = 0; i < cfg->num_varinfo; i++) {
MonoMethodVar *info = MONO_VARINFO (cfg, i);
work_list = g_list_prepend_mempool (cfg->mempool, work_list, info);
}
while (work_list) {
MonoMethodVar *info = (MonoMethodVar *)work_list->data;
work_list = g_list_remove_link (work_list, work_list);
/*
* The second part of the condition happens often when PHI nodes have their dreg
* as one of their arguments due to the fact that we use the original vars.
*/
if (info->def && (!info->uses || ((info->uses->next == NULL) && (((MonoVarUsageInfo*)info->uses->data)->inst == info->def)))) {
MonoInst *def = info->def;
/* Eliminating FMOVE could screw up the fp stack */
if (MONO_IS_MOVE (def) && (!MONO_ARCH_USE_FPSTACK || (def->opcode != OP_FMOVE))) {
MonoInst *src_var = get_vreg_to_inst (cfg, def->sreg1);
if (src_var && !(src_var->flags & (MONO_INST_VOLATILE|MONO_INST_INDIRECT)))
add_to_dce_worklist (cfg, info, MONO_VARINFO (cfg, src_var->inst_c0), &work_list);
NULLIFY_INS (def);
info->reg = -1;
} else if ((def->opcode == OP_ICONST) || (def->opcode == OP_I8CONST) || MONO_IS_ZERO (def)) {
NULLIFY_INS (def);
info->reg = -1;
} else if (MONO_IS_PHI (def)) {
int j;
for (j = def->inst_phi_args [0]; j > 0; j--) {
MonoMethodVar *u = MONO_VARINFO (cfg, get_vreg_to_inst (cfg, def->inst_phi_args [j])->inst_c0);
add_to_dce_worklist (cfg, info, u, &work_list);
}
NULLIFY_INS (def);
info->reg = -1;
}
else if (def->opcode == OP_NOP) {
}
//else
//mono_print_ins (def);
}
}
} | false | false | false | false | false | 0 |
bdc_gadget_ep_queue(struct usb_ep *_ep,
struct usb_request *_req, gfp_t gfp_flags)
{
struct bdc_req *req;
unsigned long flags;
struct bdc_ep *ep;
struct bdc *bdc;
int ret;
if (!_ep || !_ep->desc)
return -ESHUTDOWN;
if (!_req || !_req->complete || !_req->buf)
return -EINVAL;
ep = to_bdc_ep(_ep);
req = to_bdc_req(_req);
bdc = ep->bdc;
dev_dbg(bdc->dev, "%s ep:%p req:%p\n", __func__, ep, req);
dev_dbg(bdc->dev, "queuing request %p to %s length %d zero:%d\n",
_req, ep->name, _req->length, _req->zero);
if (!ep->usb_ep.desc) {
dev_warn(bdc->dev,
"trying to queue req %p to disabled %s\n",
_req, ep->name);
return -ESHUTDOWN;
}
if (_req->length > MAX_XFR_LEN) {
dev_warn(bdc->dev,
"req length > supported MAX:%d requested:%d\n",
MAX_XFR_LEN, _req->length);
return -EOPNOTSUPP;
}
spin_lock_irqsave(&bdc->lock, flags);
if (ep == bdc->bdc_ep_array[1])
ret = ep0_queue(ep, req);
else
ret = ep_queue(ep, req);
spin_unlock_irqrestore(&bdc->lock, flags);
return ret;
} | false | false | false | false | false | 0 |
insertBetween(AVLTree *l, AVLTree *r)
{
if (l)
l->elem[RIGHT] = this;
if (r)
r->elem[LEFT] = this;
elem[LEFT] = l;
elem[RIGHT] = r;
} | 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.