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 |
|---|---|---|---|---|---|---|
map_init_vi(EditLine *el)
{
int i;
el_action_t *key = el->el_map.key;
el_action_t *alt = el->el_map.alt;
const el_action_t *vii = el->el_map.vii;
const el_action_t *vic = el->el_map.vic;
el->el_map.type = MAP_VI;
el->el_map.current = el->el_map.key;
keymacro_reset(el);
for (i = 0; i < N_KEYS; i++) {
key[i] = vii[i];
alt[i] = vic[i];
}
map_init_meta(el);
map_init_nls(el);
tty_bind_char(el, 1);
terminal_bind_arrow(el);
} | false | false | false | false | false | 0 |
ferode_1_42(l_uint32 *datad,
l_int32 w,
l_int32 h,
l_int32 wpld,
l_uint32 *datas,
l_int32 wpls)
{
l_int32 i;
register l_int32 j, pwpls;
register l_uint32 *sptr, *dptr;
l_int32 wpls2, wpls3, wpls4;
l_int32 wpls5, wpls6, wpls7, wpls8;
l_int32 wpls9, wpls10, wpls11, wpls12;
l_int32 wpls13, wpls14, wpls15;
wpls2 = 2 * wpls;
wpls3 = 3 * wpls;
wpls4 = 4 * wpls;
wpls5 = 5 * wpls;
wpls6 = 6 * wpls;
wpls7 = 7 * wpls;
wpls8 = 8 * wpls;
wpls9 = 9 * wpls;
wpls10 = 10 * wpls;
wpls11 = 11 * wpls;
wpls12 = 12 * wpls;
wpls13 = 13 * wpls;
wpls14 = 14 * wpls;
wpls15 = 15 * wpls;
pwpls = (l_uint32)(w + 31) / 32; /* proper wpl of src */
for (i = 0; i < h; i++) {
sptr = datas + i * wpls;
dptr = datad + i * wpld;
for (j = 0; j < pwpls; j++, sptr++, dptr++) {
*dptr = (*(sptr - wpls15)) &
(*(sptr - wpls14)) &
(*(sptr - wpls13)) &
(*(sptr - wpls12)) &
(*(sptr - wpls11)) &
(*(sptr - wpls10)) &
(*(sptr - wpls9)) &
(*(sptr - wpls8)) &
(*(sptr - wpls7)) &
(*(sptr - wpls6)) &
(*(sptr - wpls5)) &
(*(sptr - wpls4)) &
(*(sptr - wpls3)) &
(*(sptr - wpls2)) &
(*(sptr - wpls)) &
(*sptr) &
(*(sptr + wpls)) &
(*(sptr + wpls2)) &
(*(sptr + wpls3)) &
(*(sptr + wpls4)) &
(*(sptr + wpls5)) &
(*(sptr + wpls6)) &
(*(sptr + wpls7)) &
(*(sptr + wpls8)) &
(*(sptr + wpls9)) &
(*(sptr + wpls10)) &
(*(sptr + wpls11)) &
(*(sptr + wpls12)) &
(*(sptr + wpls13)) &
(*(sptr + wpls14));
}
}
} | false | false | false | false | false | 0 |
get_default(intptr_t val)
{
STREAM *stream;
switch(val)
{
case 0:
if (_default_in)
stream = CSTREAM_stream(((CSTREAM_NODE *)_default_in)->stream);
else
stream = CSTREAM_stream(CFILE_in);
break;
case 1:
if (_default_out)
stream = CSTREAM_stream(((CSTREAM_NODE *)_default_out)->stream);
else
stream = CSTREAM_stream(CFILE_out);
break;
case 2:
if (_default_err)
stream = CSTREAM_stream(((CSTREAM_NODE *)_default_err)->stream);
else
stream = CSTREAM_stream(CFILE_err);
break;
default:
stream = NULL;
}
return stream;
} | false | false | false | false | false | 0 |
AddFriend(CFriend* toadd, bool notify)
{
m_FriendList.push_back(toadd);
SaveList();
if (notify) {
Notify_ChatUpdateFriend(toadd);
}
} | false | false | false | false | false | 0 |
event_enable_trigger_free(struct event_trigger_ops *ops,
struct event_trigger_data *data)
{
struct enable_trigger_data *enable_data = data->private_data;
if (WARN_ON_ONCE(data->ref <= 0))
return;
data->ref--;
if (!data->ref) {
/* Remove the SOFT_MODE flag */
trace_event_enable_disable(enable_data->file, 0, 1);
module_put(enable_data->file->event_call->mod);
trigger_data_free(data);
kfree(enable_data);
}
} | false | false | false | false | false | 0 |
create_missing_directories( const char* dir /*= "."*/ ) const
{
char cur_dir_name[255];
int status;
// Experimental setup
sprintf( cur_dir_name, "%s/"EXP_S_DIR, dir );
status = mkdir( cur_dir_name, 0755 );
if ( (status == -1) && (errno != EEXIST) )
{
err( EXIT_FAILURE, cur_dir_name, errno );
}
// Output profile
sprintf( cur_dir_name, "%s/"OUT_P_DIR, dir );
status = mkdir( cur_dir_name, 0755 );
if ( (status == -1) && (errno != EEXIST) )
{
err( EXIT_FAILURE, cur_dir_name, errno );
}
// Environment
sprintf( cur_dir_name, "%s/"ENV_DIR, dir );
status = mkdir( cur_dir_name, 0755 );
if ( (status == -1) && (errno != EEXIST) )
{
err( EXIT_FAILURE, cur_dir_name, errno );
}
// Population
sprintf( cur_dir_name, "%s/"POP_DIR, dir );
status = mkdir( cur_dir_name, 0755 );
if ( (status == -1) && (errno != EEXIST) )
{
err( EXIT_FAILURE, cur_dir_name, errno );
}
// Spatial structure
if ( is_spatially_structured() )
{
sprintf( cur_dir_name, "%s/"SP_STRUCT_DIR, dir );
status = mkdir( cur_dir_name, 0755 );
if ( status == -1 && errno != EEXIST )
{
err( EXIT_FAILURE, cur_dir_name, errno );
}
}
} | false | false | false | false | false | 0 |
hcwd_umounted(int vol)
{
mountent *entry;
int i;
if (vol < 0)
vol = curvol;
if (vol < 0 || vol >= nmounts)
return -1;
entry = &mounts[vol];
if (entry->path)
free(entry->path);
if (entry->cwd)
free(entry->cwd);
for (i = vol + 1; i < nmounts; ++i)
mounts[i - 1] = mounts[i];
--nmounts;
if (curvol > vol)
--curvol;
else if (curvol == vol)
curvol = -1;
return 0;
} | false | false | false | false | false | 0 |
manager_iax2_show_peer_list(struct mansession *s, const struct message *m)
{
struct iax2_peer *peer = NULL;
int peer_count = 0;
char nm[20];
char status[20];
const char *id = astman_get_header(m,"ActionID");
char idtext[256] = "";
struct ast_str *encmethods = ast_str_alloca(256);
struct ao2_iterator i;
if (!ast_strlen_zero(id))
snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
astman_append(s, "Response: Success\r\n%sMessage: IAX Peer status list will follow\r\n\r\n", idtext);
i = ao2_iterator_init(peers, 0);
for (; (peer = ao2_iterator_next(&i)); peer_unref(peer)) {
encmethods_to_str(peer->encmethods, &encmethods);
astman_append(s, "Event: PeerEntry\r\n%sChanneltype: IAX\r\n", idtext);
if (!ast_strlen_zero(peer->username)) {
astman_append(s, "ObjectName: %s\r\nObjectUsername: %s\r\n", peer->name, peer->username);
} else {
astman_append(s, "ObjectName: %s\r\n", peer->name);
}
astman_append(s, "ChanObjectType: peer\r\n");
astman_append(s, "IPaddress: %s\r\n", ast_sockaddr_stringify_addr(&peer->addr));
ast_copy_string(nm, ast_inet_ntoa(peer->mask), sizeof(nm));
astman_append(s, "Mask: %s\r\n", nm);
astman_append(s, "Port: %d\r\n", ast_sockaddr_port(&peer->addr));
astman_append(s, "Dynamic: %s\r\n", ast_test_flag64(peer, IAX_DYNAMIC) ? "Yes" : "No");
astman_append(s, "Trunk: %s\r\n", ast_test_flag64(peer, IAX_TRUNK) ? "Yes" : "No");
astman_append(s, "Encryption: %s\r\n", peer->encmethods ? ast_str_buffer(encmethods) : "No");
peer_status(peer, status, sizeof(status));
astman_append(s, "Status: %s\r\n\r\n", status);
peer_count++;
}
ao2_iterator_destroy(&i);
astman_append(s, "Event: PeerlistComplete\r\n%sListItems: %d\r\n\r\n", idtext, peer_count);
return RESULT_SUCCESS;
} | true | true | false | false | false | 1 |
tuplesort_begin_index_hash(Relation indexRel,
uint32 hash_mask,
int workMem, bool randomAccess)
{
Tuplesortstate *state = tuplesort_begin_common(workMem, randomAccess);
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(state->sortcontext);
#ifdef TRACE_SORT
if (trace_sort)
elog(LOG,
"begin index sort: hash_mask = 0x%x, workMem = %d, randomAccess = %c",
hash_mask,
workMem, randomAccess ? 't' : 'f');
#endif
state->nKeys = 1; /* Only one sort column, the hash code */
state->comparetup = comparetup_index_hash;
state->copytup = copytup_index;
state->writetup = writetup_index;
state->readtup = readtup_index;
state->reversedirection = reversedirection_index_hash;
state->indexRel = indexRel;
state->hash_mask = hash_mask;
MemoryContextSwitchTo(oldcontext);
return state;
} | false | false | false | false | false | 0 |
gfs_hydrostatic_pressure (GfsDomain * domain,
GfsVariable * p,
GfsVariable * rho,
gdouble g)
{
gpointer data[3];
g_return_if_fail (domain != NULL);
g_return_if_fail (p != NULL);
g_return_if_fail (rho != NULL);
g_return_if_fail (g >= 0.);
g /= GFS_OCEAN (domain)->layer->len;
data[0] = p;
data[1] = rho;
data[2] = &g;
gfs_domain_cell_traverse_boundary (domain, FTT_FRONT,
FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
(FttCellTraverseFunc) hydrostatic_pressure, data);
} | false | false | false | false | false | 0 |
JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms) {
TRACE("JVM_MonitorWait(env=%p, handle=%p, ms=%ld)", env, handle, ms);
if(ms < 0) {
signalException(java_lang_IllegalArgumentException,
"argument out of range");
return;
}
objectWait(handle, ms, 0, TRUE);
} | false | false | false | false | false | 0 |
downloadGroups( uint id, ushort sequence, const ByteArray& key, int pos )
{
ByteArray text(10);
text += '\1';
text += '\2' ;
text += (int) 0;
text += htonl(pos);
return Packet::create(id, Command::DownloadGroups, sequence, key, text );
} | false | false | false | false | false | 0 |
control_proxy_on_daemon_appeared(void)
{
if (get_studio_state() == STUDIO_STATE_NA || get_studio_state() == STUDIO_STATE_SICK)
{
log_info("ladishd appeared");
g_source_remove(g_ladishd_poll_source_tag);
}
set_studio_state(STUDIO_STATE_UNLOADED);
studio_state_changed(NULL);
} | false | false | false | false | false | 0 |
z_pop_stack (void)
{
if (zargc == 2) { /* it's a user stack */
zword size;
zword addr = zargs[1];
LOW_WORD (addr, size)
size += zargs[0];
storew (addr, size);
} else sp += zargs[0]; /* it's the game stack */
} | false | false | false | false | false | 0 |
agent_recv(Agent *agent, int sockfd, agent_reaction_t *reaction, void *arg)
{
int ret, err;
if (!agent || sockfd < 0 || !reaction)
return set_errno(EINVAL);
if ((err = agent_wrlock(agent)))
return set_errno(err);
ret = agent_recv_unlocked(agent, sockfd, reaction, arg);
if ((err = agent_unlock(agent)))
return set_errno(err);
return ret;
} | false | false | false | false | false | 0 |
sichtbaresUpdaten() {
for (int i = mAnimZeigVon; i < mAnimZeigBis; i++)
mEintraege[i]->setUpdateFlag();
mRaenderUpdaten = true;
mInfozeileUpdaten = true;
} | false | false | false | false | false | 0 |
ast_context_add_include(const char *context, const char *include, const char *registrar)
{
int ret = -1;
struct ast_context *c;
c = find_context_locked(context);
if (c) {
ret = ast_context_add_include2(c, include, registrar);
ast_unlock_contexts();
}
return ret;
} | false | false | false | false | false | 0 |
FindProteinAtoms(PDBFile *file)
{
// Start statistics
RNTime start_time;
start_time.Read();
// Get model from PDB file
if (file->NModels() == 0) return 0;
PDBModel *model = file->Model(0);
// Allocate array of atoms
RNArray<PDBAtom *> *protein_atoms = new RNArray<PDBAtom *>();
if (!protein_atoms) {
fprintf(stderr, "Unable to allocate array of protein atoms.\n");
return NULL;
}
// Add all hetatoms to array
for (int i = 0; i < model->NResidues(); i++) {
PDBResidue *residue = model->Residue(i);
PDBAminoAcid *aminoacid = residue->AminoAcid();
if (!aminoacid) continue;
for (int j = 0; j < residue->NAtoms(); j++) {
PDBAtom *atom = residue->Atom(j);
if (atom->IsHetAtom()) continue;
protein_atoms->Insert(atom);
}
}
// Print statistics
if (print_verbose) {
printf("Found protein atoms ...\n");
printf(" Time = %.2f seconds\n", start_time.Elapsed());
printf(" # Atoms = %d\n", protein_atoms->NEntries());
printf(" Volume = %g\n", Volume(*protein_atoms));
fflush(stdout);
}
// Return protein atoms
return protein_atoms;
} | false | false | false | false | false | 0 |
timelib_get_nr(char **ptr, int max_length)
{
char *begin, *end, *str;
timelib_sll tmp_nr = TIMELIB_UNSET;
int len = 0;
while ((**ptr < '0') || (**ptr > '9')) {
if (**ptr == '\0') {
return TIMELIB_UNSET;
}
++*ptr;
}
begin = *ptr;
while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
++*ptr;
++len;
}
end = *ptr;
str = calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
tmp_nr = strtoll(str, NULL, 10);
free(str);
return tmp_nr;
} | false | true | false | false | true | 1 |
pch_spi_request_dma(struct pch_spi_data *data, int bpw)
{
dma_cap_mask_t mask;
struct dma_chan *chan;
struct pci_dev *dma_dev;
struct pch_dma_slave *param;
struct pch_spi_dma_ctrl *dma;
unsigned int width;
if (bpw == 8)
width = PCH_DMA_WIDTH_1_BYTE;
else
width = PCH_DMA_WIDTH_2_BYTES;
dma = &data->dma;
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
/* Get DMA's dev information */
dma_dev = pci_get_slot(data->board_dat->pdev->bus,
PCI_DEVFN(PCI_SLOT(data->board_dat->pdev->devfn), 0));
/* Set Tx DMA */
param = &dma->param_tx;
param->dma_dev = &dma_dev->dev;
param->chan_id = data->ch * 2; /* Tx = 0, 2 */;
param->tx_reg = data->io_base_addr + PCH_SPDWR;
param->width = width;
chan = dma_request_channel(mask, pch_spi_filter, param);
if (!chan) {
dev_err(&data->master->dev,
"ERROR: dma_request_channel FAILS(Tx)\n");
data->use_dma = 0;
return;
}
dma->chan_tx = chan;
/* Set Rx DMA */
param = &dma->param_rx;
param->dma_dev = &dma_dev->dev;
param->chan_id = data->ch * 2 + 1; /* Rx = Tx + 1 */;
param->rx_reg = data->io_base_addr + PCH_SPDRR;
param->width = width;
chan = dma_request_channel(mask, pch_spi_filter, param);
if (!chan) {
dev_err(&data->master->dev,
"ERROR: dma_request_channel FAILS(Rx)\n");
dma_release_channel(dma->chan_tx);
dma->chan_tx = NULL;
data->use_dma = 0;
return;
}
dma->chan_rx = chan;
} | false | false | false | false | false | 0 |
ASSERT_typing(CTX ctx, kStmtExpr *stmt)
{
TYPING_Condition(ctx, stmt, 0);
if(Tn_isTRUE(stmt, 0)) {
return knh_Stmt_done(ctx, stmt);
}
if(Tn_isFALSE(stmt, 0)) {
WarningAlwaysFalseAssertion(ctx);
}
return Stmt_typed(ctx, stmt, TYPE_void);
} | false | false | false | false | false | 0 |
load_tile(Image *image,Image *tile_image,
XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length)
{
ExceptionInfo
*exception;
ssize_t
y;
register ssize_t
x;
register PixelPacket
*q;
ssize_t
count;
unsigned char
*graydata;
XCFPixelPacket
*xcfdata,
*xcfodata;
xcfdata=(XCFPixelPacket *) AcquireQuantumMemory(MagickMax(data_length,
tile_image->columns*tile_image->rows),sizeof(*xcfdata));
if (xcfdata == (XCFPixelPacket *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
xcfodata=xcfdata;
graydata=(unsigned char *) xcfdata; /* used by gray and indexed */
count=ReadBlob(image,data_length,(unsigned char *) xcfdata);
if (count != (ssize_t) data_length)
ThrowBinaryException(CorruptImageError,"NotEnoughPixelData",
image->filename);
exception=(&image->exception);
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
if (inDocInfo->image_type == GIMP_GRAY)
{
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
SetPixelRed(q,ScaleCharToQuantum(*graydata));
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
SetPixelAlpha(q,ScaleCharToQuantum((unsigned char)
inLayerInfo->alpha));
graydata++;
q++;
}
}
else
if (inDocInfo->image_type == GIMP_RGB)
{
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
SetPixelRed(q,ScaleCharToQuantum(xcfdata->red));
SetPixelGreen(q,ScaleCharToQuantum(xcfdata->green));
SetPixelBlue(q,ScaleCharToQuantum(xcfdata->blue));
SetPixelAlpha(q,xcfdata->alpha == 255U ? TransparentOpacity :
ScaleCharToQuantum((unsigned char) inLayerInfo->alpha));
xcfdata++;
q++;
}
}
if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)
break;
}
xcfodata=(XCFPixelPacket *) RelinquishMagickMemory(xcfodata);
return MagickTrue;
} | false | false | false | false | false | 0 |
PrintFunctions(TProtoFunc* Main)
{
Byte* code=Main->code;
Byte* p=code;
while (1)
{
Opcode OP;
int n=INFO(Main,p,&OP);
if (OP.class==ENDCODE) break;
if (OP.class==PUSHCONSTANT || OP.class==CLOSURE)
{
int i=OP.arg;
TObject* o=Main->consts+i;
if (ttype(o)==LUA_T_PROTO) PrintFunction(tfvalue(o),Main,(int)(p-code));
}
p+=n;
}
} | false | false | false | false | false | 0 |
klotski_window_state_event_cb (Klotski* self, GdkEventWindowState* event) {
gboolean result = FALSE;
GdkEventWindowState _tmp0_;
GdkWindowState _tmp1_;
GdkEventWindowState _tmp4_;
GdkWindowState _tmp5_;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
_tmp0_ = *event;
_tmp1_ = _tmp0_.changed_mask;
if ((_tmp1_ & GDK_WINDOW_STATE_MAXIMIZED) != 0) {
GdkEventWindowState _tmp2_;
GdkWindowState _tmp3_;
_tmp2_ = *event;
_tmp3_ = _tmp2_.new_window_state;
self->priv->is_maximized = (_tmp3_ & GDK_WINDOW_STATE_MAXIMIZED) != 0;
}
_tmp4_ = *event;
_tmp5_ = _tmp4_.changed_mask;
if ((_tmp5_ & GDK_WINDOW_STATE_FULLSCREEN) != 0) {
GdkEventWindowState _tmp6_;
GdkWindowState _tmp7_;
gboolean _tmp8_;
_tmp6_ = *event;
_tmp7_ = _tmp6_.new_window_state;
self->priv->is_fullscreen = (_tmp7_ & GDK_WINDOW_STATE_FULLSCREEN) != 0;
_tmp8_ = self->priv->is_fullscreen;
if (_tmp8_) {
GtkToolButton* _tmp9_;
const gchar* _tmp10_ = NULL;
GtkToolButton* _tmp11_;
_tmp9_ = self->priv->fullscreen_button;
_tmp10_ = _ ("_Leave Fullscreen");
gtk_tool_button_set_label (_tmp9_, _tmp10_);
_tmp11_ = self->priv->fullscreen_button;
gtk_tool_button_set_icon_name (_tmp11_, "view-restore");
} else {
GtkToolButton* _tmp12_;
const gchar* _tmp13_ = NULL;
GtkToolButton* _tmp14_;
_tmp12_ = self->priv->fullscreen_button;
_tmp13_ = _ ("_Fullscreen");
gtk_tool_button_set_label (_tmp12_, _tmp13_);
_tmp14_ = self->priv->fullscreen_button;
gtk_tool_button_set_icon_name (_tmp14_, "view-fullscreen");
}
}
result = FALSE;
return result;
} | false | false | false | false | false | 0 |
get_wrap(int argc, char **argv)
{
struct get_options opt;
int ret;
int optidx = 0;
struct getargs args[] = {
{ "long", 'l', arg_flag, NULL, "long format", NULL },
{ "short", 's', arg_flag, NULL, "short format", NULL },
{ "terse", 't', arg_flag, NULL, "terse format", NULL },
{ "column-info", 'o', arg_string, NULL, "columns to print for short output", NULL },
{ "help", 'h', arg_flag, NULL, NULL, NULL }
};
int help_flag = 0;
opt.long_flag = -1;
opt.short_flag = 0;
opt.terse_flag = 0;
opt.column_info_string = NULL;
args[0].value = &opt.long_flag;
args[1].value = &opt.short_flag;
args[2].value = &opt.terse_flag;
args[3].value = &opt.column_info_string;
args[4].value = &help_flag;
if(getarg(args, 5, argc, argv, &optidx))
goto usage;
if(argc - optidx < 1) {
fprintf(stderr, "Arguments given (%u) are less than expected (1).\n\n", argc - optidx);
goto usage;
}
if(help_flag)
goto usage;
ret = get_entry(&opt, argc - optidx, argv + optidx);
return ret;
usage:
arg_printusage (args, 5, "get", "principal...");
return 0;
} | false | false | false | false | false | 0 |
InitHarmonicTracks(SpectralPeakArray& peaks, TData funFreq)
{
DataArray& freqBuffer=peaks.GetFreqBuffer();
DataArray& magBuffer=peaks.GetMagBuffer();
int i;
TData currentFreq=funFreq;
for(i=0;i<mnMaxSines;i++)
{
freqBuffer[i]=currentFreq;
magBuffer[i]=-99;
currentFreq+=funFreq;
}
}
} | false | false | false | false | false | 0 |
f_filbuf(fp)
File *fp;
{
if (fp->f_flags & (F_EOF|F_ERR))
return EOF;
fp->f_ptr = fp->f_base;
#ifndef MSDOS
do {
#endif /* MSDOS */
fp->f_cnt = read(fp->f_fd, (UnivPtr) fp->f_base, (size_t) fp->f_bufsize);
#ifndef MSDOS
} while (fp->f_cnt == -1 && errno == EINTR);
#endif /* MSDOS */
if (fp->f_cnt == -1) {
/* I/O error -- treat as EOF */
writef("[Read error: %s]", strerror(errno));
fp->f_flags |= F_ERR | F_EOF;
return EOF;
}
if (fp->f_cnt == 0) {
fp->f_flags |= F_EOF;
return EOF;
}
io_chars += fp->f_cnt;
return f_getc(fp);
} | false | false | false | false | false | 0 |
dialog_formula_guru_update_parent (GtkTreeIter *child, FormulaGuruState *state,
GtkTreePath *origin, gint sel_start, gint sel_length)
{
GtkTreeIter iter;
if (gtk_tree_model_iter_parent (GTK_TREE_MODEL (state->model), &iter,
child)) {
dialog_formula_guru_update_this_parent (&iter, state, origin, sel_start,
sel_length);
} else
gtk_tree_path_free (origin);
} | false | false | false | false | false | 0 |
execute(SceneManager *sm, RenderSystem *rs)
{
Ogre::Camera* cam = mViewport->getCamera();
mAmbientLight->updateFromCamera(cam);
Technique* tech = mAmbientLight->getMaterial()->getBestTechnique();
injectTechnique(sm, tech, mAmbientLight, 0);
const LightList& lightList = sm->_getLightsAffectingFrustum();
for (LightList::const_iterator it = lightList.begin(); it != lightList.end(); it++)
{
Light* light = *it;
Ogre::LightList ll;
ll.push_back(light);
//if (++i != 2) continue;
//if (light->getType() != Light::LT_DIRECTIONAL) continue;
//if (light->getDiffuseColour() != ColourValue::Red) continue;
LightsMap::iterator dLightIt = mLights.find(light);
DLight* dLight = 0;
if (dLightIt == mLights.end())
{
dLight = createDLight(light);
}
else
{
dLight = dLightIt->second;
dLight->updateFromParent();
}
dLight->updateFromCamera(cam);
tech = dLight->getMaterial()->getBestTechnique();
//Update shadow texture
if (dLight->getCastChadows())
{
SceneManager::RenderContext* context = sm->_pauseRendering();
sm->prepareShadowTextures(cam, mViewport, &ll);
sm->_resumeRendering(context);
Pass* pass = tech->getPass(0);
TextureUnitState* tus = pass->getTextureUnitState("ShadowMap");
assert(tus);
const TexturePtr& shadowTex = sm->getShadowTexture(0);
if (tus->_getTexturePtr() != shadowTex)
{
tus->_setTexturePtr(shadowTex);
}
}
injectTechnique(sm, tech, dLight, &ll);
}
} | false | false | false | false | false | 0 |
ComputeViewPlaneNormal()
{
if (this->ViewShear[0] != 0.0 || this->ViewShear[1] != 0.0)
{
// set the VPN in camera coordinates
this->ViewPlaneNormal[0] = this->ViewShear[0];
this->ViewPlaneNormal[1] = this->ViewShear[1];
this->ViewPlaneNormal[2] = 1.0;
// transform the VPN to world coordinates using inverse of view transform
this->ViewTransform->GetLinearInverse()->TransformNormal(
this->ViewPlaneNormal,
this->ViewPlaneNormal);
}
else
{
// VPN is -DOP
this->ViewPlaneNormal[0] = -this->DirectionOfProjection[0];
this->ViewPlaneNormal[1] = -this->DirectionOfProjection[1];
this->ViewPlaneNormal[2] = -this->DirectionOfProjection[2];
}
} | false | false | false | false | false | 0 |
_ml_Sock_sendbufto (ml_state_t *msp, ml_val_t arg)
{
int sock = REC_SELINT(arg, 0);
ml_val_t buf = REC_SEL(arg, 1);
int nbytes = REC_SELINT(arg, 3);
char *data = STR_MLtoC(buf) + REC_SELINT(arg, 2);
ml_val_t addr = REC_SEL(arg, 6);
int flgs, n;
/* initialize the flags. */
flgs = 0;
if (REC_SEL(arg, 4) == ML_true) flgs |= MSG_OOB;
if (REC_SEL(arg, 5) == ML_true) flgs |= MSG_DONTROUTE;
n = sendto (
sock, data, nbytes, flgs,
GET_SEQ_DATAPTR(struct sockaddr, addr), GET_SEQ_LEN(addr));
CHK_RETURN (msp, n);
} | false | false | false | false | false | 0 |
ssd_block_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
struct ssd_device *dev;
if (!bdev) {
return -EINVAL;
}
dev = bdev->bd_disk->private_data;
if (!dev) {
return -EINVAL;
}
geo->heads = 4;
geo->sectors = 16;
geo->cylinders = (dev->hw_info.size & ~0x3f) >> 6;
return 0;
} | false | false | false | false | false | 0 |
rosenbrock_init (GnmNlsolve *nl)
{
const int n = nl->vars->len;
int i, j;
nl->xi = g_new (gnm_float *, n);
for (i = 0; i < n; i++) {
nl->xi[i] = g_new (gnm_float, n);
for (j = 0; j < n; j++)
nl->xi[i][j] = (i == j);
}
nl->smallsteps = 0;
nl->tentative = 0;
nl->tentative_xk = NULL;
} | false | false | false | false | false | 0 |
IPrcWrite(pfPrcHelper* prc) {
plBitmap::IPrcWrite(prc);
prc->startTag("Metrics");
prc->writeParam("Width", fWidth);
prc->writeParam("Height", fHeight);
prc->writeParam("Stride", fStride);
prc->writeParam("TotalSize", (unsigned int)fTotalSize);
prc->writeParam("MipLevels", (unsigned int)fLevelData.getSize());
prc->endTag(true);
if (fCompressionType == kJPEGCompression) {
prc->startTag("JPEG");
prc->writeParam("ImageRLE", !isImageJPEG());
prc->writeParam("AlphaRLE", !isAlphaJPEG());
prc->endTag();
prc->writeSimpleTag("ImageData");
if (!prc->isExcluded(pfPrcHelper::kExcludeTextureData)) {
prc->writeHexStream(fTotalSize, fImageData);
} else {
prc->writeComment("Texture data excluded");
}
prc->closeTag(); // Image
if (isImageJPEG()) {
prc->writeSimpleTag("JpegData");
if (!prc->isExcluded(pfPrcHelper::kExcludeTextureData))
prc->writeHexStream(fJPEGSize, fJPEGData);
else
prc->writeComment("Texture data excluded");
prc->closeTag(); // JpegData
}
if (isAlphaJPEG()) {
prc->writeSimpleTag("AlphaData");
if (!prc->isExcluded(pfPrcHelper::kExcludeTextureData))
prc->writeHexStream(fJAlphaSize, fJAlphaData);
else
prc->writeComment("Texture data excluded");
prc->closeTag(); // AlphaData
}
prc->closeTag(); // JPEG
} else {
prc->writeSimpleTag("DDS");
prc->writeHexStream(fTotalSize, fImageData);
prc->closeTag();
}
} | false | false | false | false | false | 0 |
exegen(voccxdef *ctx, objnum obj, prpnum genprop,
prpnum verprop, prpnum actprop)
{
int hasgen; /* has xobjGen property */
objnum genobj; /* object with xobjGen property */
int hasver; /* has verXoVerb property */
objnum verobj; /* object with verXoVerb property */
int hasact; /* has xoVerb property */
objnum actobj; /* object with xoVerb property */
/* ignore it if there's no object here */
if (obj == MCMONINV) return(FALSE);
/* look up the xobjGen property, and ignore if not present */
hasgen = objgetap(ctx->voccxmem, obj, genprop, &genobj, FALSE);
if (!hasgen) return(FALSE);
/* look up the verXoVerb and xoVerb properties */
hasver = objgetap(ctx->voccxmem, obj, verprop, &verobj, FALSE);
hasact = objgetap(ctx->voccxmem, obj, actprop, &actobj, FALSE);
/* ignore if verXoVerb or xoVerb "overrides" xobjGen */
if ((hasver && !bifinh(ctx, vocinh(ctx, genobj), verobj))
|| (hasact && !bifinh(ctx, vocinh(ctx, genobj), actobj)))
return FALSE;
/* all conditions are met - execute dobjGen */
return TRUE;
} | false | false | false | false | false | 0 |
main (int argc, char** argv)
{
gchar *service, *path;
GeocluePosition *pos = NULL;
GeocluePositionFields fields;
int timestamp;
double lat, lon;
GeoclueAccuracy *accuracy = NULL;
GMainLoop *mainloop;
GError *error = NULL;
g_type_init();
if (argc < 2 || argc % 2 != 0) {
g_printerr ("Usage:\n position-example <provider_name> [option value]\n");
return 1;
}
g_print ("Using provider '%s'\n", argv[1]);
service = g_strdup_printf ("org.freedesktop.Geoclue.Providers.%s", argv[1]);
path = g_strdup_printf ("/org/freedesktop/Geoclue/Providers/%s", argv[1]);
mainloop = g_main_loop_new (NULL, FALSE);
/* Create new GeocluePosition */
pos = geoclue_position_new (service, path);
if (pos == NULL) {
g_printerr ("Error while creating GeocluePosition object.\n");
return 1;
}
g_free (service);
g_free (path);
if (argc > 2) {
GHashTable *options;
options = parse_options (argc, argv);
if (!geoclue_provider_set_options (GEOCLUE_PROVIDER (pos), options, &error)) {
g_printerr ("Error setting options: %s\n",
error->message);
g_error_free (error);
error = NULL;
}
g_hash_table_destroy (options);
}
/* Query current position. We're not interested in altitude
this time, so leave it NULL. Same can be done with all other
arguments that aren't interesting to the client */
fields = geoclue_position_get_position (pos, ×tamp,
&lat, &lon, NULL,
&accuracy, &error);
if (error) {
g_printerr ("Error getting position: %s\n", error->message);
g_error_free (error);
g_object_unref (pos);
return 1;
}
/* Print out coordinates if they are valid */
if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
GeoclueAccuracyLevel level;
double horiz_acc;
geoclue_accuracy_get_details (accuracy, &level, &horiz_acc, NULL);
g_print ("Current position:\n");
g_print ("\t%f, %f\n", lat, lon);
g_print ("\tAccuracy level %d (%.0f meters)\n", level, horiz_acc);
} else {
g_print ("Latitude and longitude not available.\n");
}
geoclue_accuracy_free (accuracy);
g_signal_connect (G_OBJECT (pos), "position-changed",
G_CALLBACK (position_changed_cb), NULL);
g_main_loop_run (mainloop);
return 0;
} | false | false | false | false | false | 0 |
set_random_seed_file( const char *name )
{
if( seed_file_name )
BUG();
seed_file_name = xstrdup( name );
} | false | false | false | false | false | 0 |
getModRefBehavior(const Function *F) {
// If the function declares it doesn't access memory, we can't do better.
if (F->doesNotAccessMemory())
return FMRB_DoesNotAccessMemory;
FunctionModRefBehavior Min = FMRB_UnknownModRefBehavior;
// If the function declares it only reads memory, go with that.
if (F->onlyReadsMemory())
Min = FMRB_OnlyReadsMemory;
if (F->onlyAccessesArgMemory())
Min = FunctionModRefBehavior(Min & FMRB_OnlyAccessesArgumentPointees);
if (isMemsetPattern16(F, TLI))
Min = FMRB_OnlyAccessesArgumentPointees;
// Otherwise be conservative.
return FunctionModRefBehavior(AAResultBase::getModRefBehavior(F) & Min);
} | false | false | false | false | false | 0 |
addSticker (FaceColor color, Axis axis, int location, int sign)
{
// The cubie will get a sticker only if it is on the required face.
if (originalCentre [axis] != (location - sign)) {
return;
}
// Create a sticker.
Sticker * s = new Sticker;
s->color = color;
s->blinking = false;
LOOP (n, nAxes) {
// The co-ordinates not on "axis" are the same as at the cubie's centre.
s->originalFaceCentre [n] = originalCentre [n];
s->currentFaceCentre [n] = originalCentre [n];
}
// The co-ordinate on "axis" is offset by -1 or +1 from the cubie's centre.
s->originalFaceCentre [axis] = location;
s->currentFaceCentre [axis] = location;
// Put the sticker on the cubie.
stickers.append (s);
} | false | false | false | false | false | 0 |
lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
{
struct dvb_usb_device *d = adap_to_d(adap);
struct lme2510_state *st = adap_to_priv(adap);
static u8 clear_pid_reg[] = LME_ALL_PIDS;
static u8 rbuf[1];
int ret = 0;
deb_info(1, "PID Clearing Filter");
mutex_lock(&d->i2c_mutex);
if (!onoff) {
ret |= lme2510_usb_talk(d, clear_pid_reg,
sizeof(clear_pid_reg), rbuf, sizeof(rbuf));
st->pid_off = true;
} else
st->pid_off = false;
st->pid_size = 0;
mutex_unlock(&d->i2c_mutex);
return 0;
} | false | false | false | false | false | 0 |
filter_declare(cmd_parms *cmd, void *CFG, const char *fname,
const char *place)
{
mod_filter_cfg *cfg = (mod_filter_cfg *)CFG;
ap_filter_rec_t *filter;
filter = apr_pcalloc(cmd->pool, sizeof(ap_filter_rec_t));
apr_hash_set(cfg->live_filters, fname, APR_HASH_KEY_STRING, filter);
filter->name = fname;
filter->filter_init_func = filter_init;
filter->filter_func.out_func = filter_harness;
filter->ftype = AP_FTYPE_RESOURCE;
filter->next = NULL;
if (place) {
if (!strcasecmp(place, "CONTENT_SET")) {
filter->ftype = AP_FTYPE_CONTENT_SET;
}
else if (!strcasecmp(place, "PROTOCOL")) {
filter->ftype = AP_FTYPE_PROTOCOL;
}
else if (!strcasecmp(place, "CONNECTION")) {
filter->ftype = AP_FTYPE_CONNECTION;
}
else if (!strcasecmp(place, "NETWORK")) {
filter->ftype = AP_FTYPE_NETWORK;
}
}
return NULL;
} | false | false | false | false | false | 0 |
ncp_get_volume_info_with_number(struct ncp_server* server,
int n, struct ncp_volume_info* target) {
int result;
int len;
ncp_init_request_s(server, 44);
ncp_add_byte(server, n);
if ((result = ncp_request(server, 22)) != 0) {
goto out;
}
target->total_blocks = ncp_reply_dword_lh(server, 0);
target->free_blocks = ncp_reply_dword_lh(server, 4);
target->purgeable_blocks = ncp_reply_dword_lh(server, 8);
target->not_yet_purgeable_blocks = ncp_reply_dword_lh(server, 12);
target->total_dir_entries = ncp_reply_dword_lh(server, 16);
target->available_dir_entries = ncp_reply_dword_lh(server, 20);
target->sectors_per_block = ncp_reply_byte(server, 28);
memset(&(target->volume_name), 0, sizeof(target->volume_name));
result = -EIO;
len = ncp_reply_byte(server, 29);
if (len > NCP_VOLNAME_LEN) {
ncp_dbg(1, "volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
result = 0;
out:
ncp_unlock_server(server);
return result;
} | false | true | false | false | false | 1 |
totem_object_local_command_line (GApplication *application,
gchar ***arguments,
int *exit_status)
{
GOptionContext *context;
GError *error = NULL;
char **argv;
int argc;
/* Dupe so that the remote arguments are listed, but
* not removed from the list */
argv = g_strdupv (*arguments);
argc = g_strv_length (argv);
context = totem_options_get_context ();
if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
error->message, argv[0]);
g_error_free (error);
*exit_status = 1;
goto bail;
}
/* Replace relative paths with absolute URIs */
if (optionstate.filenames != NULL) {
guint n_files;
int i, n_args;
n_args = g_strv_length (*arguments);
n_files = g_strv_length (optionstate.filenames);
i = n_args - n_files;
for ( ; i < n_args; i++) {
char *new_path;
new_path = totem_create_full_path ((*arguments)[i]);
if (new_path == NULL)
continue;
g_free ((*arguments)[i]);
(*arguments)[i] = new_path;
}
}
g_strfreev (optionstate.filenames);
optionstate.filenames = NULL;
*exit_status = 0;
bail:
g_option_context_free (context);
g_strfreev (argv);
return FALSE;
} | false | false | false | false | false | 0 |
evhttp_request_new(void (*cb)(struct evhttp_request *, void *), void *arg)
{
struct evhttp_request *req = NULL;
/* Allocate request structure */
if ((req = calloc(1, sizeof(struct evhttp_request))) == NULL) {
event_warn("%s: calloc", __func__);
goto error;
}
req->kind = EVHTTP_RESPONSE;
req->input_headers = calloc(1, sizeof(struct evkeyvalq));
if (req->input_headers == NULL) {
event_warn("%s: calloc", __func__);
goto error;
}
TAILQ_INIT(req->input_headers);
req->output_headers = calloc(1, sizeof(struct evkeyvalq));
if (req->output_headers == NULL) {
event_warn("%s: calloc", __func__);
goto error;
}
TAILQ_INIT(req->output_headers);
if ((req->input_buffer = evbuffer_new()) == NULL) {
event_warn("%s: evbuffer_new", __func__);
goto error;
}
if ((req->output_buffer = evbuffer_new()) == NULL) {
event_warn("%s: evbuffer_new", __func__);
goto error;
}
req->cb = cb;
req->cb_arg = arg;
return (req);
error:
if (req != NULL)
evhttp_request_free(req);
return (NULL);
} | false | false | false | false | false | 0 |
flatten_clauses(struct list *l)
{
struct clause *c;
struct list *nl = get_list();
for (c = l->first_cl; c; c = c->next_cl) {
struct clause *d = cl_copy(c);
d->id = c->id; /* This is questionable. */
check_for_bad_things(d);
flatten_clause(d);
if (renumber_vars(d) == 0)
MACE_abend("dp_trans, too many variables");
append_cl(nl, d);
}
return nl;
} | false | false | false | false | false | 0 |
qib_sd7220_init(struct qib_devdata *dd)
{
const struct firmware *fw;
int ret = 1; /* default to failure */
int first_reset, was_reset;
/* SERDES MPU reset recorded in D0 */
was_reset = (qib_read_kreg64(dd, kr_ibserdesctrl) & 1);
if (!was_reset) {
/* entered with reset not asserted, we need to do it */
qib_ibsd_reset(dd, 1);
qib_sd_trimdone_monitor(dd, "Driver-reload");
}
ret = request_firmware(&fw, SD7220_FW_NAME, &dd->pcidev->dev);
if (ret) {
qib_dev_err(dd, "Failed to load IB SERDES image\n");
goto done;
}
/* Substitute our deduced value for was_reset */
ret = qib_ibsd_ucode_loaded(dd->pport, fw);
if (ret < 0)
goto bail;
first_reset = !ret; /* First reset if IBSD uCode not yet loaded */
/*
* Alter some regs per vendor latest doc, reset-defaults
* are not right for IB.
*/
ret = qib_sd_early(dd);
if (ret < 0) {
qib_dev_err(dd, "Failed to set IB SERDES early defaults\n");
goto bail;
}
/*
* Set DAC manual trim IB.
* We only do this once after chip has been reset (usually
* same as once per system boot).
*/
if (first_reset) {
ret = qib_sd_dactrim(dd);
if (ret < 0) {
qib_dev_err(dd, "Failed IB SERDES DAC trim\n");
goto bail;
}
}
/*
* Set various registers (DDS and RXEQ) that will be
* controlled by IBC (in 1.2 mode) to reasonable preset values
* Calling the "internal" version avoids the "check for needed"
* and "trimdone monitor" that might be counter-productive.
*/
ret = qib_internal_presets(dd);
if (ret < 0) {
qib_dev_err(dd, "Failed to set IB SERDES presets\n");
goto bail;
}
ret = qib_sd_trimself(dd, 0x80);
if (ret < 0) {
qib_dev_err(dd, "Failed to set IB SERDES TRIMSELF\n");
goto bail;
}
/* Load image, then try to verify */
ret = 0; /* Assume success */
if (first_reset) {
int vfy;
int trim_done;
ret = qib_sd7220_ib_load(dd, fw);
if (ret < 0) {
qib_dev_err(dd, "Failed to load IB SERDES image\n");
goto bail;
} else {
/* Loaded image, try to verify */
vfy = qib_sd7220_ib_vfy(dd, fw);
if (vfy != ret) {
qib_dev_err(dd, "SERDES PRAM VFY failed\n");
goto bail;
} /* end if verified */
} /* end if loaded */
/*
* Loaded and verified. Almost good...
* hold "success" in ret
*/
ret = 0;
/*
* Prev steps all worked, continue bringup
* De-assert RESET to uC, only in first reset, to allow
* trimming.
*
* Since our default setup sets START_EQ1 to
* PRESET, we need to clear that for this very first run.
*/
ret = ibsd_mod_allchnls(dd, START_EQ1(0), 0, 0x38);
if (ret < 0) {
qib_dev_err(dd, "Failed clearing START_EQ1\n");
goto bail;
}
qib_ibsd_reset(dd, 0);
/*
* If this is not the first reset, trimdone should be set
* already. We may need to check about this.
*/
trim_done = qib_sd_trimdone_poll(dd);
/*
* Whether or not trimdone succeeded, we need to put the
* uC back into reset to avoid a possible fight with the
* IBC state-machine.
*/
qib_ibsd_reset(dd, 1);
if (!trim_done) {
qib_dev_err(dd, "No TRIMDONE seen\n");
goto bail;
}
/*
* DEBUG: check each time we reset if trimdone bits have
* gotten cleared, and re-set them.
*/
qib_sd_trimdone_monitor(dd, "First-reset");
/* Remember so we do not re-do the load, dactrim, etc. */
dd->cspec->serdes_first_init_done = 1;
}
/*
* setup for channel training and load values for
* RxEq and DDS in tables used by IBC in IB1.2 mode
*/
ret = 0;
if (qib_sd_setvals(dd) >= 0)
goto done;
bail:
ret = 1;
done:
/* start relock timer regardless, but start at 1 second */
set_7220_relock_poll(dd, -1);
release_firmware(fw);
return ret;
} | false | false | false | false | false | 0 |
find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv)
{
PlaceHolderInfo *phinfo;
ListCell *lc;
/* if this ever isn't true, we'd need to be able to look in parent lists */
Assert(phv->phlevelsup == 0);
foreach(lc, root->placeholder_list)
{
phinfo = (PlaceHolderInfo *) lfirst(lc);
if (phinfo->phid == phv->phid)
return phinfo;
}
/* Not found, so create it */
phinfo = makeNode(PlaceHolderInfo);
phinfo->phid = phv->phid;
phinfo->ph_var = copyObject(phv);
phinfo->ph_eval_at = pull_varnos((Node *) phv);
/* ph_eval_at may change later, see update_placeholder_eval_levels */
phinfo->ph_needed = NULL; /* initially it's unused */
phinfo->ph_may_need = NULL;
/* for the moment, estimate width using just the datatype info */
phinfo->ph_width = get_typavgwidth(exprType((Node *) phv->phexpr),
exprTypmod((Node *) phv->phexpr));
root->placeholder_list = lappend(root->placeholder_list, phinfo);
return phinfo;
} | false | false | false | false | false | 0 |
spool_berkeleydb_checkpoint(lList **answer_list, bdb_info info)
{
bool ret = true;
DENTER(BDB_LAYER, "spool_berkeleydb_checkpoint");
/* only necessary for local spooling */
if (bdb_get_server(info) == NULL) {
DB_ENV *env;
env = bdb_get_env(info);
if (env == NULL) {
dstring dbname_dstring = DSTRING_INIT;
const char *dbname;
dbname = bdb_get_dbname(info, &dbname_dstring);
answer_list_add_sprintf(answer_list, STATUS_EUNKNOWN,
ANSWER_QUALITY_ERROR,
MSG_BERKELEY_NOCONNECTIONOPEN_S,
dbname);
sge_dstring_free(&dbname_dstring);
ret = false;
}
if (ret) {
int dbret;
PROF_START_MEASUREMENT(SGE_PROF_SPOOLINGIO);
dbret = env->txn_checkpoint(env, 0, 0, 0);
PROF_STOP_MEASUREMENT(SGE_PROF_SPOOLINGIO);
if (dbret != 0) {
spool_berkeleydb_handle_bdb_error(answer_list, info, dbret);
answer_list_add_sprintf(answer_list, STATUS_EUNKNOWN,
ANSWER_QUALITY_ERROR,
MSG_BERKELEY_CANNOTCHECKPOINT_IS,
dbret, db_strerror(dbret));
ret = false;
}
}
}
DEXIT;
return ret;
} | false | false | false | false | false | 0 |
sfip_set_raw(sfip_t *dst, void *src, int family) {
ARG_CHECK3(dst, src, dst->ip32, SFIP_ARG_ERR);
dst->family = family;
if(family == AF_INET) {
dst->ip32[0] = *(uint32_t*)src;
memset(&dst->ip32[1], 0, 12);
dst->bits = 32;
} else if(family == AF_INET6) {
memcpy(dst->ip8, src, 16);
dst->bits = 128;
} else {
return SFIP_ARG_ERR;
}
return SFIP_SUCCESS;
} | false | true | false | false | false | 1 |
net_listen(const char *host, int port )
{
int listenfd, n;
const int on = 1;
struct addrinfo hints, *res, *ressave;
char serv[30];
snprintf(serv,sizeof(serv)-1,"%d",(unsigned int) port );
serv[sizeof(serv)-1]=0;
bzero(&hints, sizeof(struct addrinfo));
hints.ai_flags = AI_PASSIVE;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0) {
fprintf(stderr,"net_listen error for %s, %s: %s", host, serv, gai_strerror(n));
return -1;
}
ressave = res;
do {
listenfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (listenfd < 0)
continue; /* error, try next one */
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
if (bind(listenfd, res->ai_addr, res->ai_addrlen) == 0)
break; /* success */
close(listenfd); /* bind error, close and try next one */
} while ( (res = res->ai_next) != NULL);
if (res == NULL) {
perror("net_listen:");
freeaddrinfo(ressave);
return -1;
}
listen(listenfd, 50);
freeaddrinfo(ressave);
return(listenfd);
} | true | true | false | false | false | 1 |
VisitAdd(UnaryOperation* expr) {
CHECK_ALIVE(VisitForValue(expr->expression()));
HValue* value = Pop();
HValue* context = environment()->LookupContext();
HInstruction* instr =
new(zone()) HMul(context, value, graph_->GetConstant1());
return ast_context()->ReturnInstruction(instr, expr->id());
} | false | false | false | false | false | 0 |
egg_list_box_real_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
EggListBox *list_box = EGG_LIST_BOX (widget);
EggListBoxPrivate *priv = list_box->priv;
GtkAllocation child_allocation;
GtkAllocation separator_allocation;
EggListBoxChildInfo *child_info;
GdkWindow *window;
GtkWidget *child;
GSequenceIter *iter;
GtkStyleContext *context;
gint focus_width;
gint focus_pad;
int child_min;
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = 0;
child_allocation.height = 0;
separator_allocation.x = 0;
separator_allocation.y = 0;
separator_allocation.width = 0;
separator_allocation.height = 0;
gtk_widget_set_allocation (GTK_WIDGET (list_box), allocation);
window = gtk_widget_get_window (GTK_WIDGET (list_box));
if (window != NULL)
gdk_window_move_resize (window,
allocation->x, allocation->y,
allocation->width, allocation->height);
context = gtk_widget_get_style_context (GTK_WIDGET (list_box));
gtk_style_context_get_style (context,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
child_allocation.x = 0 + focus_width + focus_pad;
child_allocation.y = 0;
child_allocation.width = allocation->width - 2 * (focus_width + focus_pad);
separator_allocation.x = 0;
separator_allocation.width = allocation->width;
for (iter = g_sequence_get_begin_iter (priv->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
child_info = g_sequence_get (iter);
child = child_info->widget;
if (!child_is_visible (child))
{
child_info->y = child_allocation.y;
child_info->height = 0;
continue;
}
if (child_info->separator != NULL)
{
gtk_widget_get_preferred_height_for_width (child_info->separator,
allocation->width, &child_min, NULL);
separator_allocation.height = child_min;
separator_allocation.y = child_allocation.y;
gtk_widget_size_allocate (child_info->separator,
&separator_allocation);
child_allocation.y += child_min;
}
child_info->y = child_allocation.y;
child_allocation.y += focus_width + focus_pad;
gtk_widget_get_preferred_height_for_width (child, child_allocation.width, &child_min, NULL);
child_allocation.height = child_min;
child_info->height = child_allocation.height + 2 * (focus_width + focus_pad);
gtk_widget_size_allocate (child, &child_allocation);
child_allocation.y += child_min + focus_width + focus_pad;
}
} | false | false | false | false | false | 0 |
get_app_version_anonymous(
APP& app, bool need_64b, bool reliable_only
) {
unsigned int i;
CLIENT_APP_VERSION* best = NULL;
bool found = false;
char message[256];
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] get_app_version_anonymous: app %s%s\n",
app.name, reliable_only?" (reliable only)":""
);
}
for (i=0; i<g_request->client_app_versions.size(); i++) {
CLIENT_APP_VERSION& cav = g_request->client_app_versions[i];
if (!cav.app) continue;
if (cav.app->id != app.id) {
continue;
}
if (need_64b && !is_64b_platform(cav.platform)) {
continue;
}
int gavid = host_usage_to_gavid(cav.host_usage, app);
if (reliable_only && !app_version_is_reliable(gavid)) {
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] %d %s not reliable\n",
cav.version_num, cav.plan_class
);
}
continue;
}
if (daily_quota_exceeded(gavid, cav.host_usage)) {
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] %d %s daily quota exceeded\n",
cav.version_num, cav.plan_class
);
}
continue;
}
if (cav.version_num < app.min_version) {
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] %d %s version < min version\n",
cav.version_num, cav.plan_class
);
}
continue;
}
found = true;
if (!need_this_resource(cav.host_usage, NULL, &cav)) {
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] %d %s don't need resource\n",
cav.version_num, cav.plan_class
);
}
continue;
}
if (best) {
if (cav.host_usage.projected_flops > best->host_usage.projected_flops) {
best = &cav;
}
} else {
best = &cav;
}
}
if (!best) {
if (config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] Didn't find anonymous platform app for %s\n",
app.name
);
}
}
if (!found) {
sprintf(message,
"%s %s.",
_("Your app_info.xml file doesn't have a usable version of"),
app.user_friendly_name
);
add_no_work_message(message);
}
return best;
} | false | false | false | false | false | 0 |
CmdSymbol(int code)
{
char c, *s, *t;
int n, base;
if (code == 0) {
char num[4];
int i;
c = getNonSpace();
base = identifyBase(c);
if (base == 0) {
diagnostics(1,"malformed \\char construction");
fprintRTF("%c",c);
return;
}
if (base == -1) {
c = getTexChar(); /* \char`b case */
CmdChar((int) c);
return;
}
if (base == 10)
ungetTexChar(c);
/* read sequence of digits */
for (i=0; i<4; i++) {
num[i] = getTexChar();
if (base == 10 && ! isdigit(num[i]) ) break;
if (base == 8 && ! isOctal(num[i]) ) break;
if (base == 16 && ! isHex (num[i]) ) break;
}
ungetTexChar(num[i]);
num[i] = '\0';
n = (int) strtol(num,&s,base);
CmdChar(n);
} else {
s = getBraceParam();
t = strdup_noendblanks(s);
free(s);
base = identifyBase(*t);
if (base == 0)
return;
if (base == -1) {
CmdChar((int) *(t+1)); /* \char`b case */
return;
}
n = (int) strtol(t+1,&s,base);
CmdChar(n);
free(t);
}
} | false | false | false | false | false | 0 |
validatePage()
{
if (!serverWidget->connectionSucceeded())
return false;
// Test server identifiants
settings()->setValue(Core::Constants::S_LASTLOGIN, QString());
settings()->setValue(Core::Constants::S_LASTPASSWORD, QString());
// try to connect the MySQL server and test existence of a FreeMedForms configuration
QSqlDatabase mysql = QSqlDatabase::addDatabase("QMYSQL", "__CHECK__CONFIG__");
Utils::DatabaseConnector c = settings()->databaseConnector();
// test fmf_admin user
mysql.setHostName(c.host());
mysql.setPort(c.port());
mysql.setUserName(c.clearLog());
mysql.setPassword(c.clearPass());
if (!mysql.open()) {
Q_EMIT completeChanged();
return false;
}
// Test server configuration
// all freemedforms databases are prefixed with fmf_
// test the fmf_* databases existence
QSqlQuery query(mysql);
int n = 0;
if (!query.exec("show databases;")) {
LOG_QUERY_ERROR(query);
Q_EMIT completeChanged();
return false;
} else {
while (query.next())
if (query.value(0).toString().startsWith("fmf_"))
++n;
}
if (n<5) {
Utils::warningMessageBox(tr("No FreeMedForms server configuration detected"),
tr("You are trying to configure a network client of FreeMedForms. "
"It is manadatory to connect to a FreeMedForms network server.\n"
"While the host connection is valid, no FreeMedForms configuration was "
"found on this host.\n\n"
"Please check that this host contains a FreeMedForms server configuration."));
LOG_ERROR("No FreeMedForms configuration detected on the server");
Q_EMIT completeChanged();
return false;
}
// Connect databases
QProgressDialog dlg(tr("Connecting databases"), tr("Please wait"), 0, 0);
dlg.setWindowModality(Qt::WindowModal);
dlg.setMinimumDuration(1000);
dlg.show();
dlg.setFocus();
dlg.setValue(0);
Core::ICore::instance()->requestFirstRunDatabaseCreation();
return true;
} | false | false | false | false | false | 0 |
store_plugin_name(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
{
int token;
INCEXE *incexe;
if (exclude) {
scan_err0(lc, _("Plugin directive not permitted in Exclude\n"));
/* NOT REACHED */
}
token = lex_get_token(lc, T_SKIP_EOL);
if (pass == 1) {
/* Pickup Filename string
*/
switch (token) {
case T_IDENTIFIER:
case T_UNQUOTED_STRING:
if (strchr(lc->str, '\\')) {
scan_err1(lc, _("Backslash found. Use forward slashes or quote the string.: %s\n"), lc->str);
/* NOT REACHED */
}
case T_QUOTED_STRING:
if (res_all.res_fs.have_MD5) {
MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
}
incexe = &res_incexe;
if (incexe->plugin_list.size() == 0) {
incexe->plugin_list.init(10, true);
}
incexe->plugin_list.append(bstrdup(lc->str));
Dmsg1(900, "Add to plugin_list %s\n", lc->str);
break;
default:
scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
/* NOT REACHED */
}
}
scan_to_eol(lc);
} | false | false | false | false | false | 0 |
Ntr_TestMinimization(
DdManager * dd,
BnetNetwork * net1,
BnetNetwork * net2,
NtrOptions * option)
{
DdNode *f;
DdNode *c = NULL;
char *cname = NULL;
BnetNode *node;
int i;
int result;
int nsize, csize;
if (option->second == FALSE) return(1);
(void) printf("Testing BDD minimization algorithms\n");
/* Use largest output of second network as constraint. */
csize = -1;
for (i = 0; i < net2->noutputs; i++) {
if (!st_lookup(net2->hash,net2->outputs[i],&node)) {
return(0);
}
nsize = Cudd_DagSize(node->dd);
if (nsize > csize) {
c = node->dd;
cname = node->name;
csize = nsize;
}
}
if (c == NULL || cname == NULL) return(0);
(void) printf("TEST-MINI: Constrain (%s) %d nodes\n",
cname, Cudd_DagSize(c));
if (option->node == NULL) {
for (i = 0; i < net1->noutputs; i++) {
if (!st_lookup(net1->hash,net1->outputs[i],&node)) {
return(0);
}
f = node->dd;
if (f == NULL) return(0);
result = ntrTestMinimizationAux(dd,net1,f,node->name,c,cname,
option);
if (result == 0) return(0);
}
} else {
if (!st_lookup(net1->hash,option->node,&node)) {
return(0);
}
f = node->dd;
if (f == NULL) return(0);
result = ntrTestMinimizationAux(dd,net1,f,option->node,c,cname,option);
if (result == 0) return(0);
}
return(1);
} | false | false | false | false | false | 0 |
scif_unmap_window(struct scif_dev *remote_dev, struct scif_window *window)
{
int j;
if (scif_is_iommu_enabled() && !scifdev_self(remote_dev)) {
if (window->st) {
dma_unmap_sg(&remote_dev->sdev->dev,
window->st->sgl, window->st->nents,
DMA_BIDIRECTIONAL);
sg_free_table(window->st);
kfree(window->st);
window->st = NULL;
}
} else {
for (j = 0; j < window->nr_contig_chunks; j++) {
if (window->dma_addr[j]) {
scif_unmap_single(window->dma_addr[j],
remote_dev,
window->num_pages[j] <<
PAGE_SHIFT);
window->dma_addr[j] = 0x0;
}
}
}
} | false | false | false | false | false | 0 |
opw()
{
if (iArgs.size() != 1 || !iArgs[0]->number())
return;
iLineWid = iArgs[0]->number()->value();
} | false | false | false | false | false | 0 |
stick_arrow(object *op, object *tmp) {
/* If the missile hit a player, we insert it in their inventory.
* However, if the missile is heavy, we don't do so (assume it falls
* to the ground after a hit). What a good value for this is up to
* debate - 5000 is 5 kg, so arrows, knives, and other light weapons
* stick around.
*/
if (op->weight <= 5000 && tmp->stats.hp >= 0) {
object_remove(op);
op = object_insert_in_ob(op, HEAD(tmp));
return 1;
} else
return 0;
} | false | false | false | false | false | 0 |
iSizePutc(ILubyte Char)
{
CurPos++;
if (CurPos > MaxPos)
MaxPos = CurPos;
return Char;
} | false | false | false | false | false | 0 |
psys_fprint(FILE *fout,psys sys){
int i,pct=0,mct=0;
Blk_curr(sys)=1;
do {
Eqn_curr(sys)=Blk_start(sys,Blk_curr(sys));
do {
if (pct++==0)
#ifdef LOG_PRINT
fprintf(fout,"< ")
#endif
;
else
#ifdef LOG_PRINT
fprintf(fout,",\n ")
#endif
;
Mon_curr(sys)=Eqn_start(sys,Eqn_curr(sys));
mct=0;
do {
if (mct++!=0)
#ifdef LOG_PRINT
fprintf(fout," + ")
#endif
; if (Mon_coefR(sys,Mon_curr(sys))!=0||
Mon_coefI(sys,Mon_curr(sys))!=0){
if (Mon_coefI(sys,Mon_curr(sys)) != 0.0)
fprintf(fout,"(");
fprintf(fout,"%g", Mon_coefR(sys,Mon_curr(sys)));
if (Mon_coefI(sys,Mon_curr(sys)) != 0.0) {
if (Mon_coefI(sys,Mon_curr(sys))>=0.0)fprintf(fout," + ");
fprintf(fout,"%g*I)", Mon_coefI(sys,Mon_curr(sys)));
}
for(i=1;i<=Sys_N(sys);i++){
if (Mon_exp(sys,Mon_curr(sys),i)!=0){
fprintf(fout," %s^%d",ring_var(Def_Ring,i-1),
Mon_exp(sys,Mon_curr(sys),i));
}
}
if (Mon_defv(sys,Mon_curr(sys))!=0){
fprintf(fout," %s^%d",ring_def(Def_Ring),
Mon_defv(sys,Mon_curr(sys)));
}
/* fprintf(fout,"\n"); */
}
}
while((Mon_curr(sys)=Mon_next(sys,Mon_curr(sys)))!=0);
}
while(++Eqn_curr(sys)<Blk_start(sys,Blk_curr(sys)+1));
}
while((++Blk_curr(sys))<=Sys_R(sys));
fprintf(fout," >\n");
return sys;
} | false | false | false | false | false | 0 |
consume_line (hb_buffer_t *buffer,
const char *text,
unsigned int text_len,
const char *text_before,
const char *text_after)
{
hb_set_clear (glyphs);
shaper.shape_closure (text, text_len, font, buffer, glyphs);
if (hb_set_is_empty (glyphs))
return;
/* Print it out! */
bool first = true;
for (hb_codepoint_t i = -1; hb_set_next (glyphs, &i);)
{
if (first)
first = false;
else
printf (" ");
if (show_glyph_names)
{
char glyph_name[64];
hb_font_glyph_to_string (font, i, glyph_name, sizeof (glyph_name));
printf ("%s", glyph_name);
} else
printf ("%u", i);
}
} | false | false | false | false | false | 0 |
doDuties()
{
if (RC!=MRC)
send();
else
IsDone=true;
return;
} | false | false | false | false | false | 0 |
searchc(c, k, dir, type, count)
int k;
#endif
int c;
register int dir;
int type;
long count;
{
static int lastc = NUL; /* last character searched for */
#ifdef KANJI
static int lastk = NUL;
#endif
static int lastcdir; /* last direction of character search */
static int lastctype; /* last type of search ("find" or "to") */
register int col;
char_u *p;
int len;
if (c != NUL) /* normal search: remember args for repeat */
{
lastc = c;
#ifdef KANJI
lastk = k;
#endif
lastcdir = dir;
lastctype = type;
}
else /* repeat previous search */
{
if (lastc == NUL)
return FALSE;
if (dir) /* repeat in opposite direction */
dir = -lastcdir;
else
dir = lastcdir;
}
p = ml_get(curwin->w_cursor.lnum);
col = curwin->w_cursor.col;
len = STRLEN(p);
/*
* On 'to' searches, skip one to start with so we can repeat searches in
* the same direction and have it work right.
* REMOVED to get vi compatibility
* if (lastctype)
* col += dir;
*/
while (count--)
{
for (;;)
{
#ifdef KANJI
if (dir > 0 && ISkanji(p[col])) col ++;
col += dir;
if (dir < 0 && ISkanjiPosition(p, col + 1) == 2) col --;
if (col < 0 || col >= len)
return FALSE;
if (ISkanji(p[col]))
{
if (p[col] == lastc && p[col + 1] == lastk)
break;
}
else if (p[col] == lastc)
break;
#else
if ((col += dir) < 0 || col >= len)
return FALSE;
if (p[col] == lastc)
break;
#endif
}
}
if (lastctype)
#ifdef KANJI
{
if (dir < 0 && ISkanji(p[col]))
col ++;
col -= dir;
if (dir > 0 && ISkanjiPosition(p, col + 1) == 2)
col --;
}
#else
col -= dir;
#endif
curwin->w_cursor.col = col;
return TRUE;
} | false | false | false | false | false | 0 |
ecc_free(ecc_key *key)
{
LTC_ARGCHKVD(key != NULL);
mp_clear_multi(key->pubkey.x, key->pubkey.y, key->pubkey.z, key->k, NULL);
} | false | false | false | true | false | 1 |
domain_norm_reduce (GfsDomain * domain, GfsNorm * n)
{
if (domain->pid >= 0) {
double in[5];
double out[5] = { 0., 0., 0., - G_MAXDOUBLE, 0. };
MPI_Op op;
MPI_Op_create (norm_reduce, TRUE, &op);
in[0] = n->bias; in[1] = n->first; in[2] = n->second; in[3] = n->infty;
in[4] = n->w;
MPI_Allreduce (in, out, 5, MPI_DOUBLE, op, MPI_COMM_WORLD);
MPI_Op_free (&op);
n->bias = out[0]; n->first = out[1]; n->second = out[2]; n->infty = out[3];
n->w = out[4];
}
} | false | false | false | false | false | 0 |
operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
switch (Data) {
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Unknown, "unknown", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Local, "local", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticLocal, "static local", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Param, "param", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, ObjectPtr, "this ptr", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, FileStatic, "static global", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Global, "global", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Member, "member", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticMember, "static member", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Constant, "const", OS)
}
return OS;
} | false | false | false | false | false | 0 |
check_pinpad_request (app_t app, pininfo_t *pininfo, int admin_pin)
{
if (app->app_local->pinpad.specified == 0) /* No preference on card. */
{
if (pininfo->fixedlen == 0) /* Reader has varlen capability. */
return 0; /* Then, use pinpad. */
else
/*
* Reader has limited capability, and it may not match PIN of
* the card.
*/
return 1;
}
if (admin_pin)
pininfo->fixedlen = app->app_local->pinpad.fixedlen_admin;
else
pininfo->fixedlen = app->app_local->pinpad.fixedlen_user;
if (pininfo->fixedlen == 0 /* User requests disable pinpad. */
|| pininfo->fixedlen < pininfo->minlen
|| pininfo->fixedlen > pininfo->maxlen
/* Reader doesn't have the capability to input a PIN which
* length is FIXEDLEN. */)
return 1;
return 0;
} | false | false | false | false | false | 0 |
delete_syn(const std::string& name)
{
unsigned stackLen = synonymStack.size();
for (int i = stackLen - 1; i >= 0; i--) {
if (name == synonymStack[i].get_name()) {
if (((unsigned) superuser()) & FLAG_SYN) printf("DEBUG %s:%d DELETING syn %d named <%s>\n",__FILE__,__LINE__,i,name.c_str());
for (unsigned j = i; j < stackLen - 1; j++)
synonymStack[j] = synonymStack[j + 1];
synonymStack.pop_back();
if (((unsigned) superuser()) & FLAG_SYN) printf("DEBUG %s:%d after handling 'delete syn', the list is...\n",__FILE__,__LINE__);
return true;
}
}
return false;
} | false | false | false | false | false | 0 |
_mosquitto_calloc(size_t nmemb, size_t size)
{
void *mem = calloc(nmemb, size);
#ifdef REAL_WITH_MEMORY_TRACKING
memcount += malloc_usable_size(mem);
if(memcount > max_memcount){
max_memcount = memcount;
}
#endif
return mem;
} | false | false | false | false | false | 0 |
mbox_fetch_header(mailmessage * msg_info,
char ** result,
size_t * result_len)
{
struct generic_message_t * msg;
int r;
char * msg_content;
size_t msg_length;
msg = msg_info->msg_data;
if (msg->msg_message != NULL) {
return mailmessage_generic_fetch_header(msg_info, result, result_len);
}
else {
r = mboxdriver_fetch_header(get_ancestor_session(msg_info),
msg_info->msg_index,
&msg_content, &msg_length);
if (r != MAIL_NO_ERROR)
return r;
* result = msg_content;
* result_len = msg_length;
return MAIL_NO_ERROR;
}
} | false | false | false | false | false | 0 |
valid_disp_area(int fitInBox)
{
//------- valid display area first ---------//
if( top_x_loc < 0 )
top_x_loc = 0;
if( top_y_loc < 0 )
top_y_loc = 0;
if( top_x_loc + disp_x_loc > max_x_loc )
top_x_loc = max_x_loc - disp_x_loc;
if( top_y_loc + disp_y_loc > max_y_loc )
top_y_loc = max_y_loc - disp_y_loc;
//--- if the current highlighted location is outside the display area, then reposition it ----//
if( fitInBox )
{
if( cur_x_loc < top_x_loc )
cur_x_loc = top_x_loc;
if( cur_x_loc >= top_x_loc + disp_x_loc )
cur_x_loc = top_x_loc + disp_x_loc - 1;
if( cur_y_loc < top_y_loc )
cur_y_loc = top_y_loc;
if( cur_y_loc >= top_y_loc + disp_y_loc )
cur_y_loc = top_y_loc + disp_y_loc - 1;
}
} | false | false | false | false | false | 0 |
qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QThread::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QVariant*>(_v) = GetResult(); break;
case 1: *reinterpret_cast< QVariant*>(_v) = GetData(); break;
case 2: *reinterpret_cast< quint64*>(_v) = GetThreadId(); break;
case 3: *reinterpret_cast< bool*>(_v) = AutoDestroy(); break;
}
_id -= 4;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 1: SetData(*reinterpret_cast< QVariant*>(_v)); break;
case 3: SetAutoDestroy(*reinterpret_cast< bool*>(_v)); break;
}
_id -= 4;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
} | false | false | false | false | false | 0 |
archive_string_conversion_free(struct archive *a)
{
struct archive_string_conv *sc;
struct archive_string_conv *sc_next;
for (sc = a->sconv; sc != NULL; sc = sc_next) {
sc_next = sc->next;
free_sconv_object(sc);
}
a->sconv = NULL;
free(a->current_code);
a->current_code = NULL;
} | false | false | false | false | false | 0 |
SetDataForCommandInTable(ChatCommand* commandTable, const char* text, uint32 security, std::string const& help)
{
std::string fullcommand = text; // original `text` can't be used. It content destroyed in command code processing.
ChatCommand* command = NULL;
std::string cmdName;
ChatCommandSearchResult res = FindCommand(commandTable, text, command, NULL, &cmdName, true, true);
switch (res)
{
case CHAT_COMMAND_OK:
{
if (command->SecurityLevel != security)
DETAIL_LOG("Table `command` overwrite for command '%s' default security (%u) by %u",
fullcommand.c_str(), command->SecurityLevel, security);
command->SecurityLevel = security;
command->Help = help;
return true;
}
case CHAT_COMMAND_UNKNOWN_SUBCOMMAND:
{
// command have subcommands, but not '' subcommand and then any data in `command` useless for it.
if (cmdName.empty())
{ sLog.outErrorDb("Table `command` have command '%s' that only used with some subcommand selection, it can't have help or overwritten access level, skip.", cmdName.c_str()); }
else
{ sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", cmdName.c_str(), fullcommand.c_str()); }
return false;
}
case CHAT_COMMAND_UNKNOWN:
{
sLog.outErrorDb("Table `command` have nonexistent command '%s', skip.", cmdName.c_str());
return false;
}
}
return false;
} | false | false | false | false | false | 0 |
virtual_popen(const char *command, const char *type TSRMLS_DC) /* {{{ */
{
int command_length;
int dir_length, extra = 0;
char *command_line;
char *ptr, *dir;
FILE *retval;
command_length = strlen(command);
dir_length = CWDG(cwd).cwd_length;
dir = CWDG(cwd).cwd;
while (dir_length > 0) {
if (*dir == '\'') extra+=3;
dir++;
dir_length--;
}
dir_length = CWDG(cwd).cwd_length;
dir = CWDG(cwd).cwd;
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1);
if (!command_line) {
return NULL;
}
memcpy(ptr, "cd ", sizeof("cd ")-1);
ptr += sizeof("cd ")-1;
if (CWDG(cwd).cwd_length == 0) {
*ptr++ = DEFAULT_SLASH;
} else {
*ptr++ = '\'';
while (dir_length > 0) {
switch (*dir) {
case '\'':
*ptr++ = '\'';
*ptr++ = '\\';
*ptr++ = '\'';
/* fall-through */
default:
*ptr++ = *dir;
}
dir++;
dir_length--;
}
*ptr++ = '\'';
}
*ptr++ = ' ';
*ptr++ = ';';
*ptr++ = ' ';
memcpy(ptr, command, command_length+1);
retval = popen(command_line, type);
free(command_line);
return retval;
} | false | false | false | false | false | 0 |
evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
{
if (im->content_hint == hint) return;
im->content_hint = hint;
if (!im->gc) return;
if (!im->gc->shared->info.sec_image_map) return;
if (!im->gc->shared->info.bgra) return;
// does not handle yuv yet.
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return;
if (im->content_hint == EVAS_IMAGE_CONTENT_HINT_DYNAMIC)
{
if (im->cs.data)
{
if (!im->cs.no_free) free(im->cs.data);
im->cs.data = NULL;
}
im->cs.no_free = 0;
if (im->cached)
{
if (im->references == 0)
im->gc->shared->images_size -= im->csize;
im->gc->shared->images = eina_list_remove(im->gc->shared->images, im);
im->cached = 0;
}
if (im->im)
{
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
{
evas_gl_common_texture_free(im->tex);
im->tex = NULL;
}
im->tex = evas_gl_common_texture_dynamic_new(im->gc, im);
im->tex_only = 1;
}
else
{
if (im->im)
{
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL;
}
if (im->tex)
{
evas_gl_common_texture_free(im->tex);
im->tex = NULL;
}
im->tex_only = 0;
im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->im->cache_entry.flags.alpha = im->alpha;
im->cs.space = EVAS_COLORSPACE_ARGB8888;
evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space);
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h);
if (!im->tex)
im->tex = evas_gl_common_texture_new(im->gc, im->im);
}
} | false | false | false | false | false | 0 |
vivid_sdr_s_tuner(struct file *file, void *fh, const struct v4l2_tuner *vt)
{
if (vt->index > 1)
return -EINVAL;
return 0;
} | false | false | false | false | false | 0 |
dump_regs(struct csis_state *state, const char *label)
{
struct {
u32 offset;
const char * const name;
} registers[] = {
{ 0x00, "CTRL" },
{ 0x04, "DPHYCTRL" },
{ 0x08, "CONFIG" },
{ 0x0c, "DPHYSTS" },
{ 0x10, "INTMSK" },
{ 0x2c, "RESOL" },
{ 0x38, "SDW_CONFIG" },
};
u32 i;
v4l2_info(&state->sd, "--- %s ---\n", label);
for (i = 0; i < ARRAY_SIZE(registers); i++) {
u32 cfg = s5pcsis_read(state, registers[i].offset);
v4l2_info(&state->sd, "%10s: 0x%08x\n", registers[i].name, cfg);
}
} | false | false | false | false | false | 0 |
reg_addrange(regex_t *preg, int lower, int upper)
{
if (lower > upper) {
reg_addrange(preg, upper, lower);
}
regc(preg, upper - lower + 1);
regc(preg, lower);
} | false | false | false | false | false | 0 |
rebuildRec(const Expr& e) {
DebugAssert(d_inRebuild, "ExprManager::rebuildRec("+e.toString()+")");
// Check cache
ExprHashMap<Expr>::iterator j=d_rebuildCache.find(e),
jend=d_rebuildCache.end();
if(j!=jend) return (*j).second;
ExprValue* ev = e.d_expr->rebuild(this);
// Uniquify the pointer
ExprValueSet::iterator i(d_exprSet.find(ev)), iend(d_exprSet.end());
if(i != iend) {
MemoryManager* mm = getMM(ev->getMMIndex());
delete ev;
mm->deleteData(ev);
ev = *i;
} else {
ev->setIndex(nextIndex());
d_exprSet.insert(ev);
}
// Use non-uniquifying Expr() constructor
Expr res(ev);
// Cache the result
d_rebuildCache[e] = res;
// Rebuild the type too
Type t;
if (!e.d_expr->d_type.isNull()) {
t = Type(rebuildRec(e.d_expr->d_type.getExpr()));
if (ev->d_type.isNull()) ev->d_type = t;
if (ev->d_type != t) {
throw Exception("Types don't match in rebuildRec");
}
}
return res;
} | false | false | false | false | false | 0 |
remap_block (tree *block, copy_body_data *id)
{
tree old_block;
tree new_block;
/* Make the new block. */
old_block = *block;
new_block = make_node (BLOCK);
TREE_USED (new_block) = TREE_USED (old_block);
BLOCK_ABSTRACT_ORIGIN (new_block) = old_block;
BLOCK_SOURCE_LOCATION (new_block) = BLOCK_SOURCE_LOCATION (old_block);
BLOCK_NONLOCALIZED_VARS (new_block)
= vec_safe_copy (BLOCK_NONLOCALIZED_VARS (old_block));
*block = new_block;
/* Remap its variables. */
BLOCK_VARS (new_block) = remap_decls (BLOCK_VARS (old_block),
&BLOCK_NONLOCALIZED_VARS (new_block),
id);
if (id->transform_lang_insert_block)
id->transform_lang_insert_block (new_block);
/* Remember the remapped block. */
insert_decl_map (id, old_block, new_block);
} | false | false | false | false | false | 0 |
brcmf_usb_ctl_complete(struct brcmf_usbdev_info *devinfo, int type, int status)
{
brcmf_dbg(USB, "Enter, status=%d\n", status);
if (unlikely(devinfo == NULL))
return;
if (type == BRCMF_USB_CBCTL_READ) {
if (status == 0)
devinfo->bus_pub.stats.rx_ctlpkts++;
else
devinfo->bus_pub.stats.rx_ctlerrs++;
} else if (type == BRCMF_USB_CBCTL_WRITE) {
if (status == 0)
devinfo->bus_pub.stats.tx_ctlpkts++;
else
devinfo->bus_pub.stats.tx_ctlerrs++;
}
devinfo->ctl_urb_status = status;
devinfo->ctl_completed = true;
brcmf_usb_ioctl_resp_wake(devinfo);
} | false | false | false | false | false | 0 |
unmarshalArguments(cdrStream& _n)
{
(CosCompoundLifeCycle::Operation&)arg_0 <<= _n;
arg_1_ = new CosCompoundLifeCycle::RelationshipHandle;
(CosCompoundLifeCycle::RelationshipHandle&)arg_1_ <<= _n;
arg_1 = &arg_1_.in();
arg_2_ = _n.unmarshalString(0);
arg_2 = arg_2_.in();
} | false | false | false | false | false | 0 |
gab_split(gchar *str)
{
gchar** strsplit= g_malloc(sizeof(gchar*));
gint n=0;
gchar* t=str;
gchar p[BBSIZE];
while(*t!='\n' && *t !='\0')
{
if(*t!=' ')
{
n++;
strsplit= g_realloc(strsplit,(n+1)*sizeof(gchar*));
sscanf(t,"%s",p);
strsplit[n-1]= g_strdup(p);
while(*t!=' ')
{
t++;
if(*t =='\n' || *t =='\0')
break;
}
}
else
{
while(*t ==' ' )
{
t++;
if(*t =='\n' || *t =='\0')
break;
}
}
}
strsplit[n]= NULL;
return strsplit;
} | false | false | false | false | false | 0 |
xmlRelaxNGCheckGroupAttrs(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr def)
{
xmlRelaxNGDefinePtr **list;
xmlRelaxNGDefinePtr cur;
int nbchild = 0, i, j, ret;
if ((def == NULL) ||
((def->type != XML_RELAXNG_GROUP) &&
(def->type != XML_RELAXNG_ELEMENT)))
return;
if (def->dflags & IS_PROCESSED)
return;
/*
* Don't run that check in case of error. Infinite recursion
* becomes possible.
*/
if (ctxt->nbErrors != 0)
return;
cur = def->attrs;
while (cur != NULL) {
nbchild++;
cur = cur->next;
}
cur = def->content;
while (cur != NULL) {
nbchild++;
cur = cur->next;
}
list = (xmlRelaxNGDefinePtr **) xmlMalloc(nbchild *
sizeof(xmlRelaxNGDefinePtr
*));
if (list == NULL) {
xmlRngPErrMemory(ctxt, "building group\n");
return;
}
i = 0;
cur = def->attrs;
while (cur != NULL) {
list[i] = xmlRelaxNGGetElements(ctxt, cur, 1);
i++;
cur = cur->next;
}
cur = def->content;
while (cur != NULL) {
list[i] = xmlRelaxNGGetElements(ctxt, cur, 1);
i++;
cur = cur->next;
}
for (i = 0; i < nbchild; i++) {
if (list[i] == NULL)
continue;
for (j = 0; j < i; j++) {
if (list[j] == NULL)
continue;
ret = xmlRelaxNGCompareElemDefLists(ctxt, list[i], list[j]);
if (ret == 0) {
xmlRngPErr(ctxt, def->node, XML_RNGP_GROUP_ATTR_CONFLICT,
"Attributes conflicts in group\n", NULL, NULL);
}
}
}
for (i = 0; i < nbchild; i++) {
if (list[i] != NULL)
xmlFree(list[i]);
}
xmlFree(list);
def->dflags |= IS_PROCESSED;
} | false | false | false | false | false | 0 |
ca_deg(gdouble *angle)
{
gint m;
m = *angle/360.0;
*angle -= (gdouble) m*360.0;
if (*angle < 0.0)
*angle += 360.0;
} | false | false | false | false | false | 0 |
sharedsv_elem_mg_DELETE(pTHX_ SV *sv, MAGIC *mg)
{
dTHXc;
MAGIC *shmg;
SV *saggregate = SHAREDSV_FROM_OBJ(mg->mg_obj);
/* Object may not exist during global destruction */
if (! saggregate) {
return (0);
}
ENTER_LOCK;
sharedsv_elem_mg_FETCH(aTHX_ sv, mg);
if ((shmg = mg_find(sv, PERL_MAGIC_shared_scalar)))
sharedsv_scalar_mg_get(aTHX_ sv, shmg);
if (SvTYPE(saggregate) == SVt_PVAV) {
SHARED_CONTEXT;
av_delete((AV*) saggregate, mg->mg_len, G_DISCARD);
} else {
char *key = mg->mg_ptr;
I32 len = mg->mg_len;
assert ( mg->mg_ptr != 0 );
if (mg->mg_len == HEf_SVKEY) {
STRLEN slen;
key = SvPV((SV *)mg->mg_ptr, slen);
len = slen;
if (SvUTF8((SV *)mg->mg_ptr)) {
len = -len;
}
}
SHARED_CONTEXT;
(void) hv_delete((HV*) saggregate, key, len, G_DISCARD);
}
CALLER_CONTEXT;
LEAVE_LOCK;
return (0);
} | false | false | false | false | false | 0 |
CPLGetDirname( const char *pszFilename )
{
int iFileStart = CPLFindFilenameStart(pszFilename);
char *pszStaticResult = CPLGetStaticResult();
if( iFileStart >= CPL_PATH_BUF_SIZE )
return CPLStaticBufferTooSmall(pszStaticResult);
CPLAssert( ! (pszFilename >= pszStaticResult && pszFilename < pszStaticResult + CPL_PATH_BUF_SIZE) );
if( iFileStart == 0 )
{
strcpy( pszStaticResult, "." );
return pszStaticResult;
}
CPLStrlcpy( pszStaticResult, pszFilename, iFileStart+1 );
if( iFileStart > 1
&& (pszStaticResult[iFileStart-1] == '/'
|| pszStaticResult[iFileStart-1] == '\\') )
pszStaticResult[iFileStart-1] = '\0';
return pszStaticResult;
} | false | false | false | false | false | 0 |
ompi_io_ompio_register_print_entry (int queue_type,
print_entry x){
int ret = OMPI_SUCCESS;
print_queue *q=NULL;
ret = ompi_io_ompio_set_print_queue(&q, queue_type);
if (ret != OMPI_ERROR){
if (q->count >= QUEUESIZE){
return OMPI_ERROR;
}
else{
q->last = (q->last + 1) % QUEUESIZE;
q->entry[q->last] = x;
q->count = q->count + 1;
}
}
return ret;
} | false | false | false | true | false | 1 |
BroadcastPacket(WorldPacket* packet)
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player* player = sObjectMgr.GetPlayer(itr->guid);
if (player)
player->GetSession()->SendPacket(packet);
}
} | false | false | false | false | false | 0 |
add_wildcarded_test_address(const char *address)
{
int n, n_test_addrs;
if (!dns_wildcarded_test_address_list)
dns_wildcarded_test_address_list = smartlist_new();
if (smartlist_string_isin_case(dns_wildcarded_test_address_list, address))
return;
n_test_addrs = get_options()->ServerDNSTestAddresses ?
smartlist_len(get_options()->ServerDNSTestAddresses) : 0;
smartlist_add(dns_wildcarded_test_address_list, tor_strdup(address));
n = smartlist_len(dns_wildcarded_test_address_list);
if (n > n_test_addrs/2) {
log(dns_wildcarded_test_address_notice_given ? LOG_INFO : LOG_NOTICE,
LD_EXIT, "Your DNS provider tried to redirect \"%s\" to a junk "
"address. It has done this with %d test addresses so far. I'm "
"going to stop being an exit node for now, since our DNS seems so "
"broken.", address, n);
if (!dns_is_completely_invalid) {
dns_is_completely_invalid = 1;
mark_my_descriptor_dirty("dns hijacking confirmed");
}
if (!dns_wildcarded_test_address_notice_given)
control_event_server_status(LOG_WARN, "DNS_USELESS");
dns_wildcarded_test_address_notice_given = 1;
}
} | false | false | false | false | false | 0 |
invokeCallbacks(poptContext con, const struct poptOption * table,
int post) {
const struct poptOption * opt = table;
poptCallbackType cb;
while (opt->longName || opt->shortName || opt->arg) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
invokeCallbacks(con, opt->arg, post);
} else if (((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) &&
((!post && (opt->argInfo & POPT_CBFLAG_PRE)) ||
( post && (opt->argInfo & POPT_CBFLAG_POST)))) {
cb = opt->arg;
cb(con, post ? POPT_CALLBACK_REASON_POST : POPT_CALLBACK_REASON_PRE,
NULL, NULL, opt->descrip);
}
opt++;
}
} | false | false | false | false | false | 0 |
set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)
{
struct SetChannelPlan_param *setChannelPlan_param;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
if (!pbuf)
return H2C_PARAMETERS_ERROR;
setChannelPlan_param = (struct SetChannelPlan_param *)pbuf;
pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set);
init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list);
return H2C_SUCCESS;
} | false | false | false | false | false | 0 |
hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
int err;
if (topology->pid) {
errno = ENOSYS;
return -1;
}
if (!pthread_self) {
/* ?! Application uses set_thread_cpubind, but doesn't link against libpthread ?! */
errno = ENOSYS;
return -1;
}
if (tid == pthread_self())
return hwloc_linux_get_tid_cpubind(topology, 0, hwloc_set);
if (!pthread_getaffinity_np) {
errno = ENOSYS;
return -1;
}
/* TODO Kerrighed */
#if defined(HWLOC_HAVE_CPU_SET_S) && !defined(HWLOC_HAVE_OLD_SCHED_SETAFFINITY)
/* Use a separate block so that we can define specific variable
types here */
{
cpu_set_t *plinux_set;
unsigned cpu;
int last;
size_t setsize;
last = hwloc_bitmap_last(topology->levels[0][0]->complete_cpuset);
assert (last != -1);
setsize = CPU_ALLOC_SIZE(last+1);
plinux_set = CPU_ALLOC(last+1);
err = pthread_getaffinity_np(tid, setsize, plinux_set);
if (err) {
CPU_FREE(plinux_set);
errno = err;
return -1;
}
hwloc_bitmap_zero(hwloc_set);
for(cpu=0; cpu<=(unsigned) last; cpu++)
if (CPU_ISSET_S(cpu, setsize, plinux_set))
hwloc_bitmap_set(hwloc_set, cpu);
CPU_FREE(plinux_set);
}
#elif defined(HWLOC_HAVE_CPU_SET)
/* Use a separate block so that we can define specific variable
types here */
{
cpu_set_t linux_set;
unsigned cpu;
#ifdef HWLOC_HAVE_OLD_SCHED_SETAFFINITY
err = pthread_getaffinity_np(tid, &linux_set);
#else /* HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
err = pthread_getaffinity_np(tid, sizeof(linux_set), &linux_set);
#endif /* HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
if (err) {
errno = err;
return -1;
}
hwloc_bitmap_zero(hwloc_set);
for(cpu=0; cpu<CPU_SETSIZE; cpu++)
if (CPU_ISSET(cpu, &linux_set))
hwloc_bitmap_set(hwloc_set, cpu);
}
#else /* CPU_SET */
/* Use a separate block so that we can define specific variable
types here */
{
unsigned long mask;
#ifdef HWLOC_HAVE_OLD_SCHED_SETAFFINITY
err = pthread_getaffinity_np(tid, (void*) &mask);
#else /* HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
err = pthread_getaffinity_np(tid, sizeof(mask), (void*) &mask);
#endif /* HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
if (err) {
errno = err;
return -1;
}
hwloc_bitmap_from_ulong(hwloc_set, mask);
}
#endif /* CPU_SET */
return 0;
} | false | false | false | false | false | 0 |
nfs_direct_write_scan_commit_list(struct inode *inode,
struct list_head *list,
struct nfs_commit_info *cinfo)
{
spin_lock(cinfo->lock);
#ifdef CONFIG_NFS_V4_1
if (cinfo->ds != NULL && cinfo->ds->nwritten != 0)
NFS_SERVER(inode)->pnfs_curr_ld->recover_commit_reqs(list, cinfo);
#endif
nfs_scan_commit_list(&cinfo->mds->list, list, cinfo, 0);
spin_unlock(cinfo->lock);
} | false | false | false | false | false | 0 |
gatherforms(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
pdf_obj *xobjdict;
pdf_obj *type;
pdf_obj *subtype;
pdf_obj *group;
pdf_obj *groupsubtype;
pdf_obj *reference;
int k;
xobjdict = pdf_dict_get_val(dict, i);
if (!pdf_is_dict(xobjdict))
{
fz_warn(ctx, "not a xobject dict (%d %d R)", pdf_to_num(xobjdict), pdf_to_gen(xobjdict));
continue;
}
type = pdf_dict_gets(xobjdict, "Subtype");
if (strcmp(pdf_to_name(type), "Form"))
continue;
subtype = pdf_dict_gets(xobjdict, "Subtype2");
if (!strcmp(pdf_to_name(subtype), "PS"))
continue;
group = pdf_dict_gets(xobjdict, "Group");
groupsubtype = pdf_dict_gets(group, "S");
reference = pdf_dict_gets(xobjdict, "Ref");
for (k = 0; k < forms; k++)
if (!pdf_objcmp(form[k].u.form.obj, xobjdict))
break;
if (k < forms)
continue;
form = fz_resize_array(ctx, form, forms+1, sizeof(struct info));
forms++;
form[forms - 1].page = page;
form[forms - 1].pageref = pageref;
form[forms - 1].pageobj = pageobj;
form[forms - 1].u.form.obj = xobjdict;
form[forms - 1].u.form.groupsubtype = groupsubtype;
form[forms - 1].u.form.reference = reference;
}
} | false | false | false | false | false | 0 |
establish_fs_workspace()
{
int efsw_rc = FSCK_OK;
uint32_t mapsize_bytes;
uint32_t buffer_size;
int aggregate_inode, which_ait = 0;
uint32_t inoidx;
struct dinode *inoptr;
int I_am_logredo = 0;
struct IAG_tbl_t *IAGtbl;
struct inode_ext_tbl_t *inoexttbl;
struct inode_tbl_t *inotbl;
/*
* allocate a buffer in which path names can be constructed
*/
buffer_size = (JFS_PATH_MAX + 2) * sizeof (char);
efsw_rc = alloc_wrksp(buffer_size, dynstg_fsit_map,
I_am_logredo,
(void **) &(agg_recptr->path_buffer));
if (efsw_rc == FSCK_OK) {
/* got it */
agg_recptr->path_buffer_length = buffer_size;
/*
* Figure out how many IAGs have been allocated for the fileset.
* (Note that in release 1 there is always exactly 1 fileset in the
* aggregate)
*
* At this point the aggregate inode describing the fileset has been
* validated. The data described by that inode is 1 page of control
* information plus some number of IAGs. di_size is the number of
* bytes allocated for that data.
*/
if (agg_recptr->primary_ait_4part2) {
which_ait = fsck_primary;
efsw_rc = ait_special_read_ext1(fsck_primary);
if (efsw_rc != FSCK_OK) {
/* read failed */
report_readait_error(efsw_rc,
FSCK_FAILED_CANTREADAITEXTC,
fsck_primary);
efsw_rc = FSCK_FAILED_CANTREADAITEXTC;
}
} else {
which_ait = fsck_secondary;
efsw_rc = ait_special_read_ext1(fsck_secondary);
if (efsw_rc != FSCK_OK) {
/* read failed */
report_readait_error(efsw_rc,
FSCK_FAILED_CANTREADAITEXTD,
fsck_secondary);
efsw_rc = FSCK_FAILED_CANTREADAITEXTD;
}
}
}
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* got the first AIT extent */
aggregate_inode = -1;
inoidx = FILESYSTEM_I;
efsw_rc = inode_get(aggregate_inode, which_ait, inoidx, &inoptr);
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* got the fileset IT inode */
agg_recptr->fset_imap.num_iags =
(inoptr->di_size / SIZE_OF_MAP_PAGE) - 1;
/*
* a high estimate of the inodes
* allocated for the fileset
*/
agg_recptr->fset_inode_count =
agg_recptr->fset_imap.num_iags * INOSPERIAG;
/*
* now establish the fsck fileset imap workspace
*/
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* inode map established */
mapsize_bytes = agg_recptr->fset_imap.num_iags *
sizeof (struct fsck_iag_record);
efsw_rc = alloc_wrksp(mapsize_bytes, dynstg_agg_iagtbl, I_am_logredo,
(void **) &(agg_recptr->fset_imap.iag_tbl));
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* inode map workspace allocated */
/*
* now establish the fsck fileset imap workspace
*
* We start out knowing that IAG 0, extent 0 is allocated and
* has an inode in use. We'll allocate enough to cover that.
*/
mapsize_bytes = 8 + agg_recptr->fset_imap.num_iags *
sizeof (struct inode_ext_tbl_t *);
efsw_rc = alloc_wrksp(mapsize_bytes, dynstg_fsit_iagtbl,
I_am_logredo, (void **) &IAGtbl);
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* we got the IAG table */
memcpy((void *)&(IAGtbl->eyecatcher), (void *) "FSAITIAG", 8);
agg_recptr->FSIT_IAG_tbl = IAGtbl;
efsw_rc = alloc_wrksp(inode_ext_tbl_length, dynstg_fsit_inoexttbl,
I_am_logredo, (void **) &inoexttbl);
if (efsw_rc != FSCK_OK)
goto efsw_exit;
/* we got the inode extent table */
memcpy((void *)&(inoexttbl->eyecatcher), (void *)"FSAITEXT", 8);
IAGtbl->inoext_tbl[0] = inoexttbl;
efsw_rc = alloc_wrksp(inode_tbl_length, dynstg_fsit_inotbl,
I_am_logredo, (void **) &inotbl);
if (efsw_rc == FSCK_OK) {
/* we got the inode table */
memcpy((void *)&(inotbl->eyecatcher), (void *)"FSAITINO", 8);
inoexttbl->inotbl[0] = inotbl;
}
efsw_exit:
return (efsw_rc);
} | false | false | false | false | false | 0 |
setContact(UserListItem *u)
{
int oldStatus = d->status;
QString oldName = text(0);
bool wasAgent = d->isAgent;
//QString newName = JIDUtil::nickOrJid(u->name(),u->jid().full());
d->u = u;
cacheValues();
bool needUpdate = false;
if(d->status != oldStatus || d->isAgent != wasAgent || !u->presenceError().isEmpty()) {
resetStatus();
needUpdate = true;
}
// Hack, but that's the safest way.
resetName();
QString newName = text(0);
if(newName != oldName) {
needUpdate = true;
}
if(needUpdate)
updatePosition();
repaint();
setup();
} | 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.