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 |
|---|---|---|---|---|---|---|
test_core_limit(void)
{
#ifdef RLIMIT_CORE
struct rlimit rlim[1];
if (getrlimit(RLIMIT_CORE, rlim) < 0)
error("Unable to get core limit");
else if (rlim->rlim_cur != RLIM_INFINITY) {
rlim->rlim_cur /= 1024; /* bytes to KB */
if (rlim->rlim_cur < 2048) {
verbose("Warning: Core limit is only %ld KB",
(long int) rlim->rlim_cur);
}
}
#endif
return;
} | false | false | false | false | false | 0 |
process_x3f(FILE *inptr,struct fileheader *header,unsigned long fileoffset_base,
struct image_summary *summary_entry,
char *parent_name,int level,int indent)
{
struct x3f_header *x3fheader;
unsigned long max_offset = 0UL;
unsigned short byteorder = 0;
unsigned long directory_pointer = 0UL;
if(inptr)
{
if(header)
{
if(header->x3f_header)
{
x3fheader = header->x3f_header;
/* X3F is always little-endian; nonetheless, pass it */
/* as an argument to lower-level functions. Just set */
/* it here. */
byteorder = TIFF_INTEL;
if(fseek(inptr,-4L,2) == 0)
directory_pointer = ftell(inptr);
if(ferror(inptr) == 0)
{
max_offset = process_x3f_dir(inptr,byteorder,x3fheader,
directory_pointer,summary_entry,
parent_name,level,indent);
if(max_offset > 0L)
max_offset += 4;
}
else
fprintf(stderr,"%s: cannot read directory offset\n",Progname);
}
else
fprintf(stderr,"%s: null x3fheader to process_x3f()\n",Progname);
}
else
fprintf(stderr,"%s: null fileheader to process_x3f()\n",Progname);
}
else
fprintf(stderr,"%s: no open file pointer to read Print Image data\n",
Progname);
return(max_offset);
} | false | false | false | false | false | 0 |
usbvision_init_isoc(struct usb_usbvision *usbvision)
{
struct usb_device *dev = usbvision->dev;
int buf_idx, err_code, reg_value;
int sb_size;
if (!USBVISION_IS_OPERATIONAL(usbvision))
return -EFAULT;
usbvision->cur_frame = NULL;
scratch_reset(usbvision);
/* Alternate interface 1 is is the biggest frame size */
err_code = usbvision_set_alternate(usbvision);
if (err_code < 0) {
usbvision->last_error = err_code;
return -EBUSY;
}
sb_size = USBVISION_URB_FRAMES * usbvision->isoc_packet_size;
reg_value = (16 - usbvision_read_reg(usbvision,
USBVISION_ALTER_REG)) & 0x0F;
usbvision->usb_bandwidth = reg_value >> 1;
PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec",
usbvision->usb_bandwidth);
/* We double buffer the Iso lists */
for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) {
int j, k;
struct urb *urb;
urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
if (urb == NULL) {
dev_err(&usbvision->dev->dev,
"%s: usb_alloc_urb() failed\n", __func__);
return -ENOMEM;
}
usbvision->sbuf[buf_idx].urb = urb;
usbvision->sbuf[buf_idx].data =
usb_alloc_coherent(usbvision->dev,
sb_size,
GFP_KERNEL,
&urb->transfer_dma);
urb->dev = dev;
urb->context = usbvision;
urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
urb->interval = 1;
urb->transfer_buffer = usbvision->sbuf[buf_idx].data;
urb->complete = usbvision_isoc_irq;
urb->number_of_packets = USBVISION_URB_FRAMES;
urb->transfer_buffer_length =
usbvision->isoc_packet_size * USBVISION_URB_FRAMES;
for (j = k = 0; j < USBVISION_URB_FRAMES; j++,
k += usbvision->isoc_packet_size) {
urb->iso_frame_desc[j].offset = k;
urb->iso_frame_desc[j].length =
usbvision->isoc_packet_size;
}
}
/* Submit all URBs */
for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) {
err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb,
GFP_KERNEL);
if (err_code) {
dev_err(&usbvision->dev->dev,
"%s: usb_submit_urb(%d) failed: error %d\n",
__func__, buf_idx, err_code);
}
}
usbvision->streaming = stream_idle;
PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x",
__func__,
usbvision->video_endp);
return 0;
} | false | false | false | false | false | 0 |
bnx2x_dcbx_init(struct bnx2x *bp, bool update_shmem)
{
u32 dcbx_lldp_params_offset = SHMEM_LLDP_DCBX_PARAMS_NONE;
/* only PMF can send ADMIN msg to MFW in old MFW versions */
if ((!bp->port.pmf) && (!(bp->flags & BC_SUPPORTS_DCBX_MSG_NON_PMF)))
return;
if (bp->dcbx_enabled <= 0)
return;
/* validate:
* chip of good for dcbx version,
* dcb is wanted
* shmem2 contains DCBX support fields
*/
DP(BNX2X_MSG_DCB, "dcb_state %d bp->port.pmf %d\n",
bp->dcb_state, bp->port.pmf);
if (bp->dcb_state == BNX2X_DCB_STATE_ON &&
SHMEM2_HAS(bp, dcbx_lldp_params_offset)) {
dcbx_lldp_params_offset =
SHMEM2_RD(bp, dcbx_lldp_params_offset);
DP(BNX2X_MSG_DCB, "dcbx_lldp_params_offset 0x%x\n",
dcbx_lldp_params_offset);
bnx2x_update_drv_flags(bp, 1 << DRV_FLAGS_DCB_CONFIGURED, 0);
if (SHMEM_LLDP_DCBX_PARAMS_NONE != dcbx_lldp_params_offset) {
/* need HW lock to avoid scenario of two drivers
* writing in parallel to shmem
*/
bnx2x_acquire_hw_lock(bp,
HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
if (update_shmem)
bnx2x_dcbx_admin_mib_updated_params(bp,
dcbx_lldp_params_offset);
/* Let HW start negotiation */
bnx2x_fw_command(bp,
DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG, 0);
/* release HW lock only after MFW acks that it finished
* reading values from shmem
*/
bnx2x_release_hw_lock(bp,
HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
}
}
} | false | false | false | false | false | 0 |
cancel_cb (GFileInfo *file_info, RecursiveOperation *operation)
{
GrlFilesystemSource *fs_source;
if (operation->on_file_data) {
GrlSourceSearchSpec *ss =
(GrlSourceSearchSpec *) operation->on_file_data;
fs_source = GRL_FILESYSTEM_SOURCE (ss->source);
g_hash_table_remove (fs_source->priv->cancellables,
GUINT_TO_POINTER (ss->operation_id));
ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, NULL);
}
if (operation->on_dir_data) {
/* Remove all monitors */
fs_source = GRL_FILESYSTEM_SOURCE (operation->on_dir_data);
cancel_monitors (fs_source);
}
return FALSE;
} | false | false | false | false | false | 0 |
intel_pstate_verify_policy(struct cpufreq_policy *policy)
{
cpufreq_verify_within_cpu_limits(policy);
if (policy->policy != CPUFREQ_POLICY_POWERSAVE &&
policy->policy != CPUFREQ_POLICY_PERFORMANCE)
return -EINVAL;
return 0;
} | false | false | false | false | false | 0 |
batch_objects(int print_contents)
{
struct strbuf buf = STRBUF_INIT;
while (strbuf_getline(&buf, stdin, '\n') != EOF) {
int error = batch_one_object(buf.buf, print_contents);
if (error)
return error;
}
return 0;
} | false | false | false | false | false | 0 |
FuncSetOutput (
Obj self,
Obj file,
Obj append )
{
if ( IsStringConv(file) ) {
if ( append != False ) {
if ( ! OpenAppend( CSTR_STRING(file) ) ) {
ErrorQuit( "SetOutput: cannot open '%s' for appending",
(Int)CSTR_STRING(file), 0L );
} else {
return 0;
}
} else {
if ( ! OpenOutput( CSTR_STRING(file) ) ) {
ErrorQuit( "SetOutput: cannot open '%s' for output",
(Int)CSTR_STRING(file), 0L );
} else {
return 0;
}
}
} else { /* an open stream */
if ( append != False ) {
if ( ! OpenAppendStream( file ) ) {
ErrorQuit( "SetOutput: cannot open stream for appending", 0L, 0L );
} else {
return 0;
}
} else {
if ( ! OpenOutputStream( file ) ) {
ErrorQuit( "SetOutput: cannot open stream for output", 0L, 0L );
} else {
return 0;
}
}
}
return 0;
} | false | false | false | false | false | 0 |
ResolvePhis(HBasicBlock* block) {
const ZoneList<HPhi*>* phis = block->phis();
for (int i = 0; i < phis->length(); ++i) {
HPhi* phi = phis->at(i);
LUnallocated* phi_operand = new LUnallocated(LUnallocated::NONE);
phi_operand->set_virtual_register(phi->id());
for (int j = 0; j < phi->OperandCount(); ++j) {
HValue* op = phi->OperandAt(j);
LOperand* operand = NULL;
if (op->IsConstant() && op->EmitAtUses()) {
HConstant* constant = HConstant::cast(op);
operand = chunk_->DefineConstantOperand(constant);
} else {
ASSERT(!op->EmitAtUses());
LUnallocated* unalloc = new LUnallocated(LUnallocated::NONE);
unalloc->set_virtual_register(op->id());
operand = unalloc;
}
HBasicBlock* cur_block = block->predecessors()->at(j);
// The gap move must be added without any special processing as in
// the AddConstraintsGapMove.
chunk_->AddGapMove(cur_block->last_instruction_index() - 1,
operand,
phi_operand);
}
LiveRange* live_range = LiveRangeFor(phi->id());
LLabel* label = chunk_->GetLabel(phi->block()->block_id());
label->GetOrCreateParallelMove(LGap::START)->
AddMove(phi_operand, live_range->GetSpillOperand());
live_range->SetSpillStartIndex(phi->block()->first_instruction_index());
}
} | false | false | false | false | false | 0 |
WXMPUtils_ComposeFieldSelector_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_StringPtr fieldNS,
XMP_StringPtr fieldName,
XMP_StringPtr fieldValue,
void * selPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeFieldSelector_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
if ( fieldValue == 0 ) fieldValue = "";
XMP_VarString localStr;
XMPUtils::ComposeFieldSelector ( schemaNS, arrayName, fieldNS, fieldName, fieldValue, &localStr );
if ( selPath != 0 ) (*SetClientString) ( selPath, localStr.c_str(), localStr.size() );
XMP_EXIT
} | false | false | false | false | false | 0 |
ast_rtp_codecs_get_payload_format(struct ast_rtp_codecs *codecs, int payload)
{
struct ast_rtp_payload_type *type;
struct ast_format *format;
if (payload < 0 || payload >= AST_RTP_MAX_PT) {
return NULL;
}
if (!(type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) {
return NULL;
}
format = type->asterisk_format ? &type->format : NULL;
ao2_ref(type, -1);
return format;
} | false | false | false | false | false | 0 |
worklist_editor_item_callback(struct widget *pWidget)
{
switch(Main.event.button.button) {
case SDL_BUTTON_LEFT:
swap_item_up_from_worklist(pWidget);
break;
case SDL_BUTTON_MIDDLE:
remove_item_from_worklist(pWidget);
break;
case SDL_BUTTON_RIGHT:
swap_item_down_from_worklist(pWidget);
break;
default:
;/* do nothing */
break;
}
return -1;
} | false | false | false | false | false | 0 |
con_set_trans_old(unsigned char __user * arg)
{
int i;
unsigned short *p = translations[USER_MAP];
if (!access_ok(VERIFY_READ, arg, E_TABSZ))
return -EFAULT;
console_lock();
for (i=0; i<E_TABSZ ; i++) {
unsigned char uc;
__get_user(uc, arg+i);
p[i] = UNI_DIRECT_BASE | uc;
}
update_user_maps();
console_unlock();
return 0;
} | false | false | false | false | false | 0 |
DoPara(dir)
int dir;
{
register int num = arg_value();
bool first_time = YES;
if (num < 0) {
num = -num;
dir = -dir;
}
while (--num >= 0) {
tryagain:
find_para(dir); /* find paragraph bounderies */
if (dir == BACKWARD
&& (!first_time || (para_head == curline && bolp())))
{
if (bobp())
complain((char *)NULL);
b_char(1);
first_time = !first_time;
goto tryagain;
}
SetLine((dir == BACKWARD) ? para_head : para_tail);
if (dir == BACKWARD && !firstp(curline)
&& i_blank(curline->l_prev)) {
line_move(BACKWARD, 1, NO);
} else if (dir == FORWARD) {
if (lastp(curline)) {
Eol();
break;
}
/* otherwise */
line_move(FORWARD, 1, NO);
}
}
} | false | false | false | false | false | 0 |
slurm_get_job_stdout(char *buf, int buf_size, job_info_t * job_ptr)
{
if (job_ptr == NULL)
snprintf(buf, buf_size, "%s", "job pointer is NULL");
else if (job_ptr->std_out)
_fname_format(buf, buf_size, job_ptr, job_ptr->std_out);
else if (job_ptr->batch_flag == 0)
snprintf(buf, buf_size, "%s", "");
else if (job_ptr->array_job_id) {
snprintf(buf, buf_size, "%s/slurm-%u_%u.out",
job_ptr->work_dir,
job_ptr->array_job_id, job_ptr->array_task_id);
} else {
snprintf(buf, buf_size, "%s/slurm-%u.out",
job_ptr->work_dir, job_ptr->job_id);
}
} | false | false | false | false | false | 0 |
JVM_FindClassFromClassLoader(JNIEnv *env, const char *name,
jboolean init, jobject loader,
jboolean throw_error) {
Class *class;
TRACE("JVM_FindClassFromClassLoader(env=%p, name=%s, init=%d, loader=%p,"
" throw_error=%d)", env, name, init, loader, throw_error);
class = findClassFromClassLoader((char *)name, loader);
if(class == NULL) {
if(!throw_error) {
Object *excep = exceptionOccurred();
char *dot_name = slash2DotsDup((char*)name);
clearException();
signalChainedException(java_lang_ClassNotFoundException,
dot_name, excep);
sysFree(dot_name);
}
} else if(init)
initClass(class);
return class;
} | false | false | false | false | false | 0 |
chomp(char *string)
{
int length = strlen(string) - 1;
if(length >= 0 && string[length] == '\n')
string[length] = '\0';
return length;
} | false | false | false | false | false | 0 |
node_sendqueue_size_changed(property_t unused_prop)
{
uint32 min = 1.5 * settings_max_msg_size();
(void) unused_prop;
if (GNET_PROPERTY(node_sendqueue_size) < min) {
gnet_prop_set_guint32_val(PROP_NODE_SENDQUEUE_SIZE, min);
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
TS_RESP_get_policy(TS_RESP_CTX *ctx)
{
ASN1_OBJECT *requested = TS_REQ_get_policy_id(ctx->request);
ASN1_OBJECT *policy = NULL;
int i;
if (ctx->default_policy == NULL)
{
TSerr(TS_F_TS_RESP_GET_POLICY, TS_R_INVALID_NULL_POINTER);
return NULL;
}
/* Return the default policy if none is requested or the default is
requested. */
if (!requested || !OBJ_cmp(requested, ctx->default_policy))
policy = ctx->default_policy;
/* Check if the policy is acceptable. */
for (i = 0; !policy && i < sk_ASN1_OBJECT_num(ctx->policies); ++i)
{
ASN1_OBJECT *current = sk_ASN1_OBJECT_value(ctx->policies, i);
if (!OBJ_cmp(requested, current))
policy = current;
}
if (!policy)
{
TSerr(TS_F_TS_RESP_GET_POLICY, TS_R_UNACCEPTABLE_POLICY);
TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
"Requested policy is not "
"supported.");
TS_RESP_CTX_add_failure_info(ctx, TS_INFO_UNACCEPTED_POLICY);
}
return policy;
} | false | false | false | false | false | 0 |
build_chassis(ibnd_node_t * node, ibnd_chassis_t * chassis)
{
int p = 0;
ibnd_node_t *remnode = 0;
ibnd_port_t *port = 0;
/* we get here with node = chassis_spine */
if (insert_spine(node, chassis))
return -1;
/* loop: pass on all ports of node */
for (p = 1; p <= node->numports; p++) {
port = node->ports[p];
if (!port || !port->remoteport)
continue;
/*
* ISR4700 double density fabric board ports 19-36 are
* chassis external ports, so skip them
*/
if (is_spine_4700x2(node) && (port->portnum > 18))
continue;
remnode = port->remoteport->node;
if (!remnode->ch_found)
continue; /* some error - line or router not initialized ? FIXME */
insert_line_router(remnode, chassis);
}
if (pass_on_lines_catch_spines(chassis))
return -1;
/* this pass needed for to catch routers, since routers connected only */
/* to spines in slot 1 or 4 and we could miss them first time */
if (pass_on_spines_catch_lines(chassis))
return -1;
/* additional 2 passes needed for to overcome a problem of pure "in-chassis" */
/* connectivity - extra pass to ensure that all related chips/modules */
/* inserted into the chassis */
if (pass_on_lines_catch_spines(chassis))
return -1;
if (pass_on_spines_catch_lines(chassis))
return -1;
pass_on_spines_interpolate_chguid(chassis);
return 0;
} | false | false | false | false | false | 0 |
get_spec_reg(regname, argp, allocated, errmsg)
int regname;
char_u **argp;
int *allocated; /* return: TRUE when value was allocated */
int errmsg; /* give error message when failing */
{
int cnt;
*argp = NULL;
*allocated = FALSE;
switch (regname)
{
case '%': /* file name */
if (errmsg)
check_fname(); /* will give emsg if not set */
*argp = curbuf->b_fname;
return TRUE;
case '#': /* alternate file name */
*argp = getaltfname(errmsg); /* may give emsg if not set */
return TRUE;
#ifdef FEAT_EVAL
case '=': /* result of expression */
*argp = get_expr_line();
*allocated = TRUE;
return TRUE;
#endif
case ':': /* last command line */
if (last_cmdline == NULL && errmsg)
EMSG(_(e_nolastcmd));
*argp = last_cmdline;
return TRUE;
case '/': /* last search-pattern */
if (last_search_pat() == NULL && errmsg)
EMSG(_(e_noprevre));
*argp = last_search_pat();
return TRUE;
case '.': /* last inserted text */
*argp = get_last_insert_save();
*allocated = TRUE;
if (*argp == NULL && errmsg)
EMSG(_(e_noinstext));
return TRUE;
#ifdef FEAT_SEARCHPATH
case Ctrl_F: /* Filename under cursor */
case Ctrl_P: /* Path under cursor, expand via "path" */
if (!errmsg)
return FALSE;
*argp = file_name_at_cursor(FNAME_MESS | FNAME_HYP
| (regname == Ctrl_P ? FNAME_EXP : 0), 1L, NULL);
*allocated = TRUE;
return TRUE;
#endif
case Ctrl_W: /* word under cursor */
case Ctrl_A: /* WORD (mnemonic All) under cursor */
if (!errmsg)
return FALSE;
cnt = find_ident_under_cursor(argp, regname == Ctrl_W
? (FIND_IDENT|FIND_STRING) : FIND_STRING);
*argp = cnt ? vim_strnsave(*argp, cnt) : NULL;
*allocated = TRUE;
return TRUE;
case '_': /* black hole: always empty */
*argp = (char_u *)"";
return TRUE;
}
return FALSE;
} | false | false | false | false | false | 0 |
ilLoadUtxF(ILHANDLE File)
{
ILuint FirstPos;
ILboolean bRet;
iSetInputFile(File);
FirstPos = itell();
try {
bRet = iLoadUtxInternal();
}
catch (bad_alloc &e) {
e;
ilSetError(IL_OUT_OF_MEMORY);
return IL_FALSE;
}
iseek(FirstPos, IL_SEEK_SET);
return bRet;
} | false | false | false | false | false | 0 |
make_var_volatile (var)
tree var;
{
if (GET_CODE (DECL_RTL (var)) != MEM)
abort ();
MEM_VOLATILE_P (DECL_RTL (var)) = 1;
} | false | false | false | false | false | 0 |
NewDataNode(PCFFOLDER_NODE FolderNode)
/*
* FUNCTION: Creates a new data block node
* ARGUMENTS:
* FolderNode = Pointer to folder node to bind data block to
* RETURNS:
* Pointer to node if there was enough free memory available, otherwise NULL
*/
{
PCFDATA_NODE Node;
Node = (PCFDATA_NODE)AllocateMemory(sizeof(CFDATA_NODE));
if (!Node)
return NULL;
memset(Node, 0, sizeof(CFDATA_NODE));
Node->Prev = FolderNode->DataListTail;
if (FolderNode->DataListTail != NULL)
FolderNode->DataListTail->Next = Node;
else
FolderNode->DataListHead = Node;
FolderNode->DataListTail = Node;
return Node;
} | false | false | false | false | false | 0 |
GetKeyValue2(int iRowIndex) {
CTransfer* transfer;
if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) {
return wxEmptyString;
}
return transfer->m_strProjectURL;
} | false | false | false | false | false | 0 |
yam_cleanup_driver(void)
{
struct yam_mcs *p;
int i;
del_timer_sync(&yam_timer);
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = yam_devs[i];
if (dev) {
unregister_netdev(dev);
free_netdev(dev);
}
}
while (yam_data) {
p = yam_data;
yam_data = yam_data->next;
kfree(p);
}
remove_proc_entry("yam", init_net.proc_net);
} | false | false | false | false | false | 0 |
text_property_to_utf8 (Display *display,
const XTextProperty *prop)
{
GdkDisplay *gdkdisplay;
char **list;
int count;
char *retval;
list = NULL;
gdkdisplay = _wnck_gdk_display_lookup_from_display (display);
if (!gdkdisplay)
return NULL;
count = gdk_text_property_to_utf8_list_for_display (gdkdisplay,
gdk_x11_xatom_to_atom (prop->encoding),
prop->format,
prop->value,
prop->nitems,
&list);
if (count == 0)
retval = NULL;
else
{
retval = list[0];
list[0] = g_strdup (""); /* something to free */
}
g_strfreev (list);
return retval;
} | false | false | false | false | false | 0 |
P_DeathThink (player_t* player)
{
angle_t angle;
angle_t delta;
P_MovePsprites (player);
// fall to the ground
if (player->viewheight > 6*FRACUNIT)
player->viewheight -= FRACUNIT;
if (player->viewheight < 6*FRACUNIT)
player->viewheight = 6*FRACUNIT;
player->deltaviewheight = 0;
onground = (player->mo->z <= player->mo->floorz);
P_CalcHeight (player);
if (player->attacker && player->attacker != player->mo)
{
angle = R_PointToAngle2 (player->mo->x,
player->mo->y,
player->attacker->x,
player->attacker->y);
delta = angle - player->mo->angle;
if (delta < ANG5 || delta > (unsigned)-ANG5)
{
// Looking at killer,
// so fade damage flash down.
player->mo->angle = angle;
if (player->damagecount)
player->damagecount--;
}
else if (delta < ANG180)
player->mo->angle += ANG5;
else
player->mo->angle -= ANG5;
}
else if (player->damagecount)
player->damagecount--;
if (player->cmd.buttons & BT_USE)
player->playerstate = PST_REBORN;
} | false | false | false | false | false | 0 |
client3_1_mkdir (call_frame_t *frame, xlator_t *this,
void *data)
{
clnt_local_t *local = NULL;
clnt_conf_t *conf = NULL;
clnt_args_t *args = NULL;
gfs3_mkdir_req req = {{0,},};
int ret = 0;
int op_errno = ESTALE;
if (!frame || !this || !data)
goto unwind;
args = data;
local = mem_get0 (this->local_pool);
if (!local) {
op_errno = ENOMEM;
goto unwind;
}
if (!(args->loc && args->loc->parent))
goto unwind;
loc_copy (&local->loc, args->loc);
frame->local = local;
if (!uuid_is_null (args->loc->parent->gfid))
memcpy (req.pargfid, args->loc->parent->gfid, 16);
else
memcpy (req.pargfid, args->loc->pargfid, 16);
GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
!uuid_is_null (*((uuid_t*)req.pargfid)),
unwind, op_errno, EINVAL);
req.bname = (char *)args->loc->name;
req.mode = args->mode;
req.umask = args->umask;
conf = this->private;
GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
req.xdata.xdata_len, op_errno, unwind);
ret = client_submit_request (this, &req, frame, conf->fops,
GFS3_OP_MKDIR, client3_1_mkdir_cbk, NULL,
NULL, 0, NULL, 0,
NULL, (xdrproc_t)xdr_gfs3_mkdir_req);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
}
if (req.xdata.xdata_val)
GF_FREE (req.xdata.xdata_val);
return 0;
unwind:
CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL,
NULL, NULL);
if (req.xdata.xdata_val)
GF_FREE (req.xdata.xdata_val);
return 0;
} | false | true | false | true | true | 1 |
brasero_cdrdao_set_argv_common_rec (BraseroCdrdao *cdrdao,
GPtrArray *argv)
{
BraseroBurnFlag flags;
gchar *speed_str;
guint speed;
brasero_job_get_flags (BRASERO_JOB (cdrdao), &flags);
if (flags & BRASERO_BURN_FLAG_DUMMY)
g_ptr_array_add (argv, g_strdup ("--simulate"));
g_ptr_array_add (argv, g_strdup ("--speed"));
brasero_job_get_speed (BRASERO_JOB (cdrdao), &speed);
speed_str = g_strdup_printf ("%d", speed);
g_ptr_array_add (argv, speed_str);
if (flags & BRASERO_BURN_FLAG_OVERBURN)
g_ptr_array_add (argv, g_strdup ("--overburn"));
if (flags & BRASERO_BURN_FLAG_MULTI)
g_ptr_array_add (argv, g_strdup ("--multi"));
} | false | false | false | false | false | 0 |
d_def_17_(
fortint * outputArray,
unsigned char * gribSection1,
fortint * bitPointer) {
/*
// Decodes ECMWF local definition 17 (from byte 41 onwards) from
// gribSection1 into integer array values in outputArray.
//
// inputArray[0] corresponds to KSEC1(37) in the description at
// http://www.ecmwf.int/publications/manuals/libraries/gribex/localDefinition17.html
//
// *bitPointer is updated by the number of bits in local definition 17.
//
// Returns the number of array elements inserted in outputArray
*/
int loop, N, M, byteLength;
fortint date;
fortint * n = outputArray;
unsigned char * p = gribSection1;
decodeMarsPart(n,p);
p += 9;
n += 5;
*n++ = (fortint) 0; p++; /* ZERO1 */
*n++ = (fortint) 0; p++; /* ZERO2 */
date = THREEBYTEINT(p); /* DATEOFSST */
p += 3;
if( (date < 19000000) && (date > 100 ) ) date += 19000000;
*n++ = date;
*n++ = ONEBYTEINT(p);p++; /* TYPEOFSST */
*n++ = ONEBYTEINT(p);p++; /* COUNTOFICE */
N = *(n-1);
for( loop = 0; loop < N; loop++) { /* ICE data */
date = THREEBYTEINT(p); /* Date of ICE field */
p += 3;
if( (date < 19000000) && (date > 100 ) ) date += 19000000;
*n++ = date;
*n++ = ONEBYTEINT(p);p++; /* Satellite number */
}
M = ((N+9)/10)*10;
if( M == 0 ) M = 10;
byteLength = 40 + 16 + M*4;
if( *bitPointer ) *bitPointer += (byteLength-40)*8;
return (fortint) (n - outputArray);
} | false | false | false | false | false | 0 |
find_leader_in_sets (unsigned int val, bitmap_set_t set1, bitmap_set_t set2)
{
pre_expr result;
result = bitmap_find_leader (set1, val, NULL);
if (!result && set2)
result = bitmap_find_leader (set2, val, NULL);
return result;
} | false | false | false | false | false | 0 |
release(){
if(options&BITMAP_OWNED){
options&=~BITMAP_OWNED;
FXFREE(&data);
}
data=NULL;
} | false | false | false | false | false | 0 |
long_label()const
{
//incomplete();
std::string buffer(short_label());
//for (const CKT_BASE* brh = owner(); exists(brh); brh = brh->owner()) {
// buffer += '.' + brh->short_label();
//}
return buffer;
} | false | false | false | false | false | 0 |
GC_try_to_collect_general(GC_stop_func stop_func,
GC_bool force_unmap)
{
GC_bool result;
# ifdef USE_MUNMAP
int old_unmap_threshold;
# endif
IF_CANCEL(int cancel_state;)
DCL_LOCK_STATE;
if (!GC_is_initialized) GC_init();
if (GC_debugging_started) GC_print_all_smashed();
GC_INVOKE_FINALIZERS();
LOCK();
DISABLE_CANCEL(cancel_state);
# ifdef USE_MUNMAP
old_unmap_threshold = GC_unmap_threshold;
if (force_unmap ||
(GC_force_unmap_on_gcollect && old_unmap_threshold > 0))
GC_unmap_threshold = 1; /* unmap as much as possible */
# endif
ENTER_GC();
/* Minimize junk left in my registers */
GC_noop(0,0,0,0,0,0);
result = GC_try_to_collect_inner(stop_func != 0 ? stop_func :
GC_default_stop_func);
EXIT_GC();
# ifdef USE_MUNMAP
GC_unmap_threshold = old_unmap_threshold; /* restore */
# endif
RESTORE_CANCEL(cancel_state);
UNLOCK();
if (result) {
if (GC_debugging_started) GC_print_all_smashed();
GC_INVOKE_FINALIZERS();
}
return(result);
} | false | false | false | false | false | 0 |
Init()
{
m_lastsearchtime = 0;
lastpurgetime = ::GetTickCount();
m_paused = false;
m_stopped = false;
m_insufficient = false;
status = PS_EMPTY;
transferred = 0;
m_iLastPausePurge = time(NULL);
if(thePrefs::GetNewAutoDown()) {
m_iDownPriority = PR_HIGH;
m_bAutoDownPriority = true;
} else {
m_iDownPriority = PR_NORMAL;
m_bAutoDownPriority = false;
}
transferingsrc = 0; // new
kBpsDown = 0.0;
m_hashsetneeded = true;
m_count = 0;
percentcompleted = 0;
completedsize=0;
lastseencomplete = 0;
m_availablePartsCount=0;
m_ClientSrcAnswered = 0;
m_LastNoNeededCheck = 0;
m_iRating = 0;
m_nTotalBufferData = 0;
m_nLastBufferFlushTime = 0;
m_bPercentUpdated = false;
m_iGainDueToCompression = 0;
m_iLostDueToCorruption = 0;
m_iTotalPacketsSavedDueToICH = 0;
m_category = 0;
m_lastRefreshedDLDisplay = 0;
m_nDlActiveTime = 0;
m_tActivated = 0;
m_is_A4AF_auto = false;
m_localSrcReqQueued = false;
m_nCompleteSourcesTime = time(NULL);
m_nCompleteSourcesCount = 0;
m_nCompleteSourcesCountLo = 0;
m_nCompleteSourcesCountHi = 0;
m_validSources = 0;
m_notCurrentSources = 0;
// Kad
m_LastSearchTimeKad = 0;
m_TotalSearchesKad = 0;
#ifndef CLIENT_GUI
m_CorruptionBlackBox = new CCorruptionBlackBox();
#endif
} | false | false | false | false | false | 0 |
max8997_set_voltage_safeout_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
int rid = rdev_get_id(rdev);
int reg, shift = 0, mask, ret;
if (rid != MAX8997_ESAFEOUT1 && rid != MAX8997_ESAFEOUT2)
return -EINVAL;
ret = max8997_get_voltage_register(rdev, ®, &shift, &mask);
if (ret)
return ret;
return max8997_update_reg(i2c, reg, selector << shift, mask << shift);
} | false | false | false | false | false | 0 |
S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth)
{
dVAR;
SV* ret;
PERL_ARGS_ASSERT_MAGIC_METHPACK;
ret = magic_methcall1(sv, mg, meth, 0, 1, NULL);
if (ret)
sv_setsv(sv, ret);
return 0;
} | false | false | false | false | false | 0 |
ext4_invalidatepage(struct page *page, unsigned int offset,
unsigned int length)
{
trace_ext4_invalidatepage(page, offset, length);
/* No journalling happens on data buffers when this function is used */
WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page)));
block_invalidatepage(page, offset, length);
} | false | false | false | false | false | 0 |
isl_set_substitute(__isl_take isl_set *set,
enum isl_dim_type type, unsigned pos, __isl_keep isl_aff *subs)
{
int i;
if (set && isl_set_plain_is_empty(set))
return set;
set = isl_set_cow(set);
if (!set || !subs)
goto error;
for (i = set->n - 1; i >= 0; --i) {
set->p[i] = isl_basic_set_substitute(set->p[i], type, pos, subs);
if (remove_if_empty(set, i) < 0)
goto error;
}
return set;
error:
isl_set_free(set);
return NULL;
} | false | false | false | false | false | 0 |
create(RefToken tok)
{
// cout << "create( tok="<< tok->getType() << ", " << tok->getText() << ")" << nodeFactories.size() << endl;
RefAST t = nodeFactories[tok->getType()]->second();
t->initialize(tok);
return t;
} | false | false | false | false | false | 0 |
HandleXMLChild(const wxChar *tag)
{
if (wxStrcmp(tag, wxT("controlpoint")))
return NULL;
return AddPointAtEnd(0,0);
} | false | false | false | false | false | 0 |
return_handler2(struct kretprobe_instance *ri, struct pt_regs *regs)
{
unsigned long ret = regs_return_value(regs);
if (ret != (rand1 / div_factor) + 1) {
handler_errors++;
pr_err("incorrect value in kretprobe handler2\n");
}
if (krph_val == 0) {
handler_errors++;
pr_err("call to kretprobe entry handler failed\n");
}
krph_val = rand1;
return 0;
} | false | false | false | false | false | 0 |
polkit_backend_interactive_authority_revoke_temporary_authorizations (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitSubject *subject,
GError **error)
{
PolkitBackendInteractiveAuthority *interactive_authority;
PolkitBackendInteractiveAuthorityPrivate *priv;
PolkitSubject *session_for_caller;
gboolean ret;
GList *l;
GList *ll;
guint num_removed;
interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (authority);
priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (interactive_authority);
ret = FALSE;
session_for_caller = NULL;
if (!POLKIT_IS_UNIX_SESSION (subject))
{
g_set_error (error,
POLKIT_ERROR,
POLKIT_ERROR_FAILED,
"Can only handle PolkitUnixSession objects for now.");
goto out;
}
session_for_caller = polkit_backend_session_monitor_get_session_for_subject (priv->session_monitor,
caller,
NULL);
if (session_for_caller == NULL)
{
g_set_error (error,
POLKIT_ERROR,
POLKIT_ERROR_FAILED,
"Cannot determine session the caller is in");
goto out;
}
if (!polkit_subject_equal (session_for_caller, subject))
{
g_set_error (error,
POLKIT_ERROR,
POLKIT_ERROR_FAILED,
"Passed session and the session the caller is in differs. They must be equal for now.");
goto out;
}
num_removed = 0;
for (l = priv->temporary_authorization_store->authorizations; l != NULL; l = ll)
{
TemporaryAuthorization *ta = l->data;
ll = l->next;
if (!polkit_subject_equal (ta->scope, subject))
continue;
priv->temporary_authorization_store->authorizations = g_list_remove (priv->temporary_authorization_store->authorizations, ta);
temporary_authorization_free (ta);
num_removed++;
}
if (num_removed > 0)
g_signal_emit_by_name (authority, "changed");
ret = TRUE;
out:
if (session_for_caller != NULL)
g_object_unref (session_for_caller);
return ret;
} | false | false | false | false | false | 0 |
immnum_signum(object x) {
ufixnum ux=(ufixnum)x,uz=((ufixnum)({register fixnum _q1=(0);register object _q4; _q4=(!(((_q1)+(0x4000000000000000>>1))&-0x4000000000000000)) ? ((object)((_q1)+(0x8000000000000000 +(0x4000000000000000>>1)))) : make_fixnum1(_q1);_q4;}));
return (((ufixnum)(x))>=0x8000000000000000) ? (ux<uz ? ((object)((-1)+(0x8000000000000000 +(0x4000000000000000>>1)))) : (ux==uz ? ((object)((0)+(0x8000000000000000 +(0x4000000000000000>>1)))) : ((object)((1)+(0x8000000000000000 +(0x4000000000000000>>1)))))) : number_signum(x);
} | false | false | false | false | false | 0 |
x509_process_extension(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
struct asymmetric_key_id *kid;
const unsigned char *v = value;
pr_debug("Extension: %u\n", ctx->last_oid);
if (ctx->last_oid == OID_subjectKeyIdentifier) {
/* Get hold of the key fingerprint */
if (ctx->cert->skid || vlen < 3)
return -EBADMSG;
if (v[0] != ASN1_OTS || v[1] != vlen - 2)
return -EBADMSG;
v += 2;
vlen -= 2;
ctx->cert->raw_skid_size = vlen;
ctx->cert->raw_skid = v;
kid = asymmetric_key_generate_id(v, vlen, "", 0);
if (IS_ERR(kid))
return PTR_ERR(kid);
ctx->cert->skid = kid;
pr_debug("subjkeyid %*phN\n", kid->len, kid->data);
return 0;
}
if (ctx->last_oid == OID_authorityKeyIdentifier) {
/* Get hold of the CA key fingerprint */
ctx->raw_akid = v;
ctx->raw_akid_size = vlen;
return 0;
}
return 0;
} | false | false | false | false | false | 0 |
afr_truncate (call_frame_t *frame, xlator_t *this,
loc_t *loc, off_t offset, dict_t *xdata)
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
int ret = -1;
int op_errno = 0;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (this->private, out);
priv = this->private;
QUORUM_CHECK(truncate,out);
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
op_errno = ENOMEM;
goto out;
}
AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out);
local = transaction_frame->local;
ret = afr_local_init (local, priv, &op_errno);
if (ret < 0)
goto out;
local->cont.truncate.offset = offset;
local->transaction.fop = afr_truncate_wind;
local->transaction.done = afr_truncate_done;
local->transaction.unwind = afr_truncate_unwind;
loc_copy (&local->loc, loc);
local->transaction.main_frame = frame;
local->transaction.start = offset;
local->transaction.len = 0;
afr_transaction (transaction_frame, this, AFR_DATA_TRANSACTION);
ret = 0;
out:
if (ret < 0) {
if (transaction_frame)
AFR_STACK_DESTROY (transaction_frame);
AFR_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL);
}
return 0;
} | false | false | false | false | false | 0 |
qla4_82xx_wait_rom_done(struct scsi_qla_host *ha)
{
long timeout = 0;
long done = 0 ;
while (done == 0) {
done = qla4_82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS);
done &= 2;
timeout++;
if (timeout >= rom_max_timeout) {
printk("%s: Timeout reached waiting for rom done",
DRIVER_NAME);
return -1;
}
}
return 0;
} | false | false | false | false | false | 0 |
CDB___log_init(dbenv, dblp)
DB_ENV *dbenv;
DB_LOG *dblp;
{
LOG *region;
int ret;
void *p;
if ((ret = CDB___db_shalloc(dblp->reginfo.addr,
sizeof(*region), 0, &dblp->reginfo.primary)) != 0)
return (ret);
dblp->reginfo.rp->primary =
R_OFFSET(&dblp->reginfo, dblp->reginfo.primary);
region = dblp->reginfo.primary;
memset(region, 0, sizeof(*region));
region->persist.lg_max = dbenv->lg_max;
region->persist.magic = DB_LOGMAGIC;
region->persist.version = DB_LOGVERSION;
region->persist.mode = dbenv->db_mode;
SH_TAILQ_INIT(®ion->fq);
/* Initialize LOG LSNs. */
region->lsn.file = 1;
region->lsn.offset = 0;
/* Initialize the buffer. */
if ((ret =
CDB___db_shalloc(dblp->reginfo.addr, dbenv->lg_bsize, 0, &p)) != 0)
return (ret);
region->buffer_size = dbenv->lg_bsize;
region->buffer_off = R_OFFSET(&dblp->reginfo, p);
/*
* XXX:
* Initialize the log file size. This is a hack to push the log's
* maximum size down into the Windows CDB___os_open routine, because it
* wants to pre-allocate it.
*/
dblp->lfh.log_size = dbenv->lg_max;
/* Try and recover any previous log files before releasing the lock. */
return (CDB___log_recover(dblp));
} | false | false | false | false | false | 0 |
bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
{
struct bnx2x *bp = netdev_priv(dev);
u8 c2s_map[BNX2X_MAX_PRIORITY], c2s_def;
int cos, prio, count, offset;
/* setup tc must be called under rtnl lock */
ASSERT_RTNL();
/* no traffic classes requested. Aborting */
if (!num_tc) {
netdev_reset_tc(dev);
return 0;
}
/* requested to support too many traffic classes */
if (num_tc > bp->max_cos) {
BNX2X_ERR("support for too many traffic classes requested: %d. Max supported is %d\n",
num_tc, bp->max_cos);
return -EINVAL;
}
/* declare amount of supported traffic classes */
if (netdev_set_num_tc(dev, num_tc)) {
BNX2X_ERR("failed to declare %d traffic classes\n", num_tc);
return -EINVAL;
}
bnx2x_get_c2s_mapping(bp, c2s_map, &c2s_def);
/* configure priority to traffic class mapping */
for (prio = 0; prio < BNX2X_MAX_PRIORITY; prio++) {
int outer_prio = c2s_map[prio];
netdev_set_prio_tc_map(dev, prio, bp->prio_to_cos[outer_prio]);
DP(BNX2X_MSG_SP | NETIF_MSG_IFUP,
"mapping priority %d to tc %d\n",
outer_prio, bp->prio_to_cos[outer_prio]);
}
/* Use this configuration to differentiate tc0 from other COSes
This can be used for ets or pfc, and save the effort of setting
up a multio class queue disc or negotiating DCBX with a switch
netdev_set_prio_tc_map(dev, 0, 0);
DP(BNX2X_MSG_SP, "mapping priority %d to tc %d\n", 0, 0);
for (prio = 1; prio < 16; prio++) {
netdev_set_prio_tc_map(dev, prio, 1);
DP(BNX2X_MSG_SP, "mapping priority %d to tc %d\n", prio, 1);
} */
/* configure traffic class to transmission queue mapping */
for (cos = 0; cos < bp->max_cos; cos++) {
count = BNX2X_NUM_ETH_QUEUES(bp);
offset = cos * BNX2X_NUM_NON_CNIC_QUEUES(bp);
netdev_set_tc_queue(dev, cos, count, offset);
DP(BNX2X_MSG_SP | NETIF_MSG_IFUP,
"mapping tc %d to offset %d count %d\n",
cos, offset, count);
}
return 0;
} | false | false | false | false | false | 0 |
ilSaveTargaF(ILHANDLE File)
{
ILuint Pos;
iSetOutputFile(File);
Pos = itellw();
if (iSaveTargaInternal() == IL_FALSE)
return 0; // Error occurred
return itellw() - Pos; // Return the number of bytes written.
} | false | false | false | false | false | 0 |
fs_hash_uri(const char *str)
{
uint64_t top;
if (!str) {
return 0;
}
if (strncmp(str, "bnode:b", 7) == 0) {
fs_rid bnode_id = strtoll(str+7, NULL, 16);
if (!bnode_id) {
return FS_RID_GONE;
}
return FS_NUM_BNODE(bnode_id);
} else if (strncmp(str, "_:b", 3) == 0) {
fs_rid bnode_id = strtoll(str+3, NULL, 16);
if (!bnode_id) {
return FS_RID_GONE;
}
return FS_NUM_BNODE(bnode_id);
} else if (!isalpha(str[0])) {
return FS_RID_GONE;
}
top = umac_wrapper(str, 0);
top |= 0xC000000000000000LL;
return top;
} | false | false | false | false | false | 0 |
rg_analysis_track_result (RgAnalysisCtx * ctx, gdouble * gain, gdouble * peak)
{
gboolean result;
g_return_val_if_fail (ctx != NULL, FALSE);
accumulator_add (&ctx->album, &ctx->track);
result = accumulator_result (&ctx->track, gain, peak);
accumulator_clear (&ctx->track);
reset_filters (ctx);
reset_silence_detection (ctx);
return result;
} | false | false | false | false | false | 0 |
infer_handle_numerical_equal_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, bool goal, int level)
{
CYG_REPORT_FUNCNAMETYPE("infer_handle_numerical_equal_bool", "result %d");
CYG_REPORT_FUNCARG4XV(transaction, expr, lhs, rhs);
CYG_PRECONDITION_CLASSC(transaction);
CYG_PRECONDITION_CLASSC(expr);
CYG_PRECONDITIONC(lhs != rhs);
bool result = false;
if (goal) {
// We need two sub-transactions, The lhs_transaction is for evaluating the lhs
// and trying to update the rhs.
CdlTransaction lhs_transaction = transaction->make(transaction->get_conflict());
bool lhs_result = false;
try {
CdlSimpleValue lhs_value;
CdlEvalContext lhs_context(lhs_transaction);
expr->eval_subexpression(lhs_context, lhs, lhs_value);
if (lhs_value.has_integer_value() || lhs_value.has_double_value()) {
lhs_result = CdlInfer::subexpr_value(lhs_transaction, expr, rhs, lhs_value, level);
if (lhs_result) {
CdlSimpleValue check;
expr->eval_subexpression(lhs_context, lhs, check);
if (lhs_value != check) {
lhs_result = false;
}
}
}
} catch (...) {
lhs_result = false;
}
CdlTransaction rhs_transaction = transaction->make(transaction->get_conflict());
bool rhs_result = false;
try {
CdlSimpleValue rhs_value;
CdlEvalContext rhs_context(rhs_transaction);
expr->eval_subexpression(rhs_context, rhs, rhs_value);
if (rhs_value.has_integer_value() || rhs_value.has_double_value()) {
rhs_result = CdlInfer::subexpr_value(rhs_transaction, expr, lhs, rhs_value, level);
if (rhs_result) {
CdlSimpleValue check;
expr->eval_subexpression(rhs_context, rhs, check);
if (rhs_value != check) {
rhs_result = false;
}
}
}
} catch (...) {
rhs_result = false;
}
result = infer_choose2(lhs_transaction, lhs_result, rhs_transaction, rhs_result);
}
CYG_REPORT_RETVAL(result);
return result;
} | false | false | false | false | false | 0 |
mark_set_regs (struct propagate_block_info *pbi, rtx x, rtx insn)
{
rtx cond = NULL_RTX;
rtx link;
enum rtx_code code;
int flags = pbi->flags;
if (insn)
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
{
if (REG_NOTE_KIND (link) == REG_INC)
mark_set_1 (pbi, SET, XEXP (link, 0),
(GET_CODE (x) == COND_EXEC
? COND_EXEC_TEST (x) : NULL_RTX),
insn, flags);
}
retry:
switch (code = GET_CODE (x))
{
case SET:
if (GET_CODE (XEXP (x, 1)) == ASM_OPERANDS)
flags |= PROP_ASM_SCAN;
/* Fall through */
case CLOBBER:
mark_set_1 (pbi, code, SET_DEST (x), cond, insn, flags);
return;
case COND_EXEC:
cond = COND_EXEC_TEST (x);
x = COND_EXEC_CODE (x);
goto retry;
case PARALLEL:
{
int i;
/* We must scan forwards. If we have an asm, we need to set
the PROP_ASM_SCAN flag before scanning the clobbers. */
for (i = 0; i < XVECLEN (x, 0); i++)
{
rtx sub = XVECEXP (x, 0, i);
switch (code = GET_CODE (sub))
{
case COND_EXEC:
if (cond != NULL_RTX)
abort ();
cond = COND_EXEC_TEST (sub);
sub = COND_EXEC_CODE (sub);
if (GET_CODE (sub) == SET)
goto mark_set;
if (GET_CODE (sub) == CLOBBER)
goto mark_clob;
break;
case SET:
mark_set:
if (GET_CODE (XEXP (sub, 1)) == ASM_OPERANDS)
flags |= PROP_ASM_SCAN;
/* Fall through */
case CLOBBER:
mark_clob:
mark_set_1 (pbi, code, SET_DEST (sub), cond, insn, flags);
break;
case ASM_OPERANDS:
flags |= PROP_ASM_SCAN;
break;
default:
break;
}
}
break;
}
default:
break;
}
} | false | false | false | false | false | 0 |
tms34010_host_r(int cpunum, int reg)
{
unsigned int addr;
int result = 0;
/* swap to the target cpu */
cpuintrf_push_context(cpunum);
switch (reg)
{
/* upper 16 bits of the address */
case TMS34010_HOST_ADDRESS_H:
result = IOREG(REG_HSTADRH);
break;
/* lower 16 bits of the address */
case TMS34010_HOST_ADDRESS_L:
result = IOREG(REG_HSTADRL);
break;
/* actual data */
case TMS34010_HOST_DATA:
/* read from the address */
addr = (IOREG(REG_HSTADRH) << 16) | IOREG(REG_HSTADRL);
result = TMS34010_RDMEM_WORD(TOBYTE(addr & 0xfffffff0));
/* optional postincrement (it says preincrement, but data is preloaded, so it
is effectively a postincrement */
if (IOREG(REG_HSTCTLH) & 0x1000)
{
addr += 0x10;
IOREG(REG_HSTADRH) = addr >> 16;
IOREG(REG_HSTADRL) = (UINT16)addr;
}
break;
/* control register */
case TMS34010_HOST_CONTROL:
result = (IOREG(REG_HSTCTLH) & 0xff00) | (IOREG(REG_HSTCTLL) & 0x00ff);
break;
/* error case */
default:
//logerror("tms34010_host_control_r called on invalid register %d\n", reg);
break;
}
/* swap back */
cpuintrf_pop_context();
activecpu_reset_banking();
return result;
} | false | false | false | false | false | 0 |
WillCreateCycle(SUnit *SU, SUnit *TargetSU) {
if (IsReachable(TargetSU, SU))
return true;
for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I)
if (I->isAssignedRegDep() &&
IsReachable(TargetSU, I->getSUnit()))
return true;
return false;
} | false | false | false | false | false | 0 |
if_sdio_handle_event(struct if_sdio_card *card,
u8 *buffer, unsigned size)
{
int ret;
u32 event;
lbs_deb_enter(LBS_DEB_SDIO);
if (card->model == MODEL_8385) {
event = sdio_readb(card->func, IF_SDIO_EVENT, &ret);
if (ret)
goto out;
/* right shift 3 bits to get the event id */
event >>= 3;
} else {
if (size < 4) {
lbs_deb_sdio("event packet too small (%d bytes)\n",
(int)size);
ret = -EINVAL;
goto out;
}
event = buffer[3] << 24;
event |= buffer[2] << 16;
event |= buffer[1] << 8;
event |= buffer[0] << 0;
}
lbs_queue_event(card->priv, event & 0xFF);
ret = 0;
out:
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
return ret;
} | false | false | false | false | false | 0 |
Distance (double x, double y, Item **item) const
{
list <Point>::const_iterator i = m_Points.begin (), end = m_Points.end ();
if (i == end)
return G_MAXDOUBLE;
double x0 = (*i).x, y0 = (*i).y, x1, y1;
double lw = GetLineWidth () / 2.;
double result = G_MAXDOUBLE, d, dx, dy, dx1, dy1, xx, yy, length;
// we do not take miter limits into account
if (item)
*item = const_cast <PolyLine *> (this);
for (i++; i != end; i++) {
x1 = (*i).x;
y1 = (*i).y;
dx = x1 - x0;
dy = y1 - y0;
dx1 = x - x0;
dy1 = y - y0;
length = sqrt (dx * dx + dy * dy);
if (length == 0.)
d = sqrt (dx1 * dx1 + dy1 * dy1);
else {
xx = (dx1 * dx + dy1 * dy) / length;
yy = (dx1 * dy - dy1 * dx) / length;
if (xx < 0.) {
if (fabs (yy) < lw)
d = fabs (xx);
else {
yy = fabs (yy) - lw;
d = sqrt (xx * xx + yy * yy);
}
} else if (xx > length) {
xx -= length;
if (fabs (yy) < lw)
d = fabs (xx);
else {
yy = fabs (yy) - lw;
d = sqrt (xx * xx + yy * yy);
}
} else {
if (fabs (yy) <= lw)
return 0;
else
d = fabs (yy) - lw;
}
}
if (d < result)
result = d;
x0 = x1;
y0 = y1;
}
return result;
} | false | false | false | false | false | 0 |
Codes_codebyindex(int item)
{
coderec *c;
int i = 0;
if(item > Codes->num_codes)
return NULL;
for(c=Codes->codelist; c!=NULL; c=c->next)
{
i++;
if(i == item)
return c;
}
return NULL;
} | false | false | false | false | false | 0 |
g_select_device(int device) {
g.devtype = device;
if (g.dev != NULL) {
delete g.dev;
g.dev = NULL;
}
switch (device) {
case GLE_DEVICE_PS:
g.dev = new PSGLEDevice(false);
break;
case GLE_DEVICE_EPS:
g.dev = new PSGLEDevice(true);
break;
case GLE_DEVICE_DUMMY:
g.dev = new GLEDummyDevice(false);
break;
#ifdef HAVE_CAIRO
case GLE_DEVICE_CAIRO_PDF:
g.dev = new GLECairoDevicePDF(false);
break;
case GLE_DEVICE_CAIRO_EPS:
g.dev = new GLECairoDeviceEPS(false);
break;
case GLE_DEVICE_CAIRO_SVG:
g.dev = new GLECairoDeviceSVG(false);
break;
#ifdef __WIN32__
case GLE_DEVICE_EMF:
g.dev = new GLECairoDeviceEMF(false);
break;
#endif
#endif
#ifdef HAVE_X11
case GLE_DEVICE_X11:
g.dev = new X11GLEDevice();
break;
#endif
}
return g.dev;
} | false | false | false | false | false | 0 |
gimplify_must_not_throw_expr (tree *expr_p, gimple_seq *pre_p)
{
tree stmt = *expr_p;
tree temp = voidify_wrapper_expr (stmt, NULL);
tree body = TREE_OPERAND (stmt, 0);
gimple_seq try_ = NULL;
gimple_seq catch_ = NULL;
gimple mnt;
gimplify_and_add (body, &try_);
mnt = gimple_build_eh_must_not_throw (terminate_node);
gimple_seq_add_stmt_without_update (&catch_, mnt);
mnt = gimple_build_try (try_, catch_, GIMPLE_TRY_CATCH);
gimple_seq_add_stmt_without_update (pre_p, mnt);
if (temp)
{
*expr_p = temp;
return GS_OK;
}
*expr_p = NULL;
return GS_ALL_DONE;
} | false | false | false | false | false | 0 |
__db_vrfy_inpitem(dbp, h, pgno, i, is_btree, flags, himarkp, offsetp)
DB *dbp;
PAGE *h;
db_pgno_t pgno;
u_int32_t i;
int is_btree;
u_int32_t flags, *himarkp, *offsetp;
{
BKEYDATA *bk;
ENV *env;
db_indx_t *inp, offset, len;
env = dbp->env;
DB_ASSERT(env, himarkp != NULL);
inp = P_INP(dbp, h);
/*
* Check that the inp array, which grows from the beginning of the
* page forward, has not collided with the data, which grow from the
* end of the page backward.
*/
if (inp + i >= (db_indx_t *)((u_int8_t *)h + *himarkp)) {
/* We've collided with the data. We need to bail. */
EPRINT((env, DB_STR_A("0563",
"Page %lu: entries listing %lu overlaps data",
"%lu %lu"), (u_long)pgno, (u_long)i));
return (DB_VERIFY_FATAL);
}
offset = inp[i];
/*
* Check that the item offset is reasonable: it points somewhere
* after the inp array and before the end of the page.
*/
if (offset <= INP_OFFSET(dbp, h, i) || offset >= dbp->pgsize) {
EPRINT((env, DB_STR_A("0564",
"Page %lu: bad offset %lu at page index %lu",
"%lu %lu %lu"), (u_long)pgno, (u_long)offset, (u_long)i));
return (DB_VERIFY_BAD);
}
/* Update the high-water mark (what HOFFSET should be) */
if (offset < *himarkp)
*himarkp = offset;
if (is_btree) {
/*
* Check alignment; if it's unaligned, it's unsafe to
* manipulate this item.
*/
if (offset != DB_ALIGN(offset, sizeof(u_int32_t))) {
EPRINT((env, DB_STR_A("0565",
"Page %lu: unaligned offset %lu at page index %lu",
"%lu %lu %lu"), (u_long)pgno, (u_long)offset,
(u_long)i));
return (DB_VERIFY_BAD);
}
/*
* Check that the item length remains on-page.
*/
bk = GET_BKEYDATA(dbp, h, i);
/*
* We need to verify the type of the item here;
* we can't simply assume that it will be one of the
* expected three. If it's not a recognizable type,
* it can't be considered to have a verifiable
* length, so it's not possible to certify it as safe.
*/
switch (B_TYPE(bk->type)) {
case B_BLOB:
len = bk->len;
if (len != BBLOB_DSIZE) {
EPRINT((env, DB_STR_A("0771",
"Page %lu: item %lu illegal size.",
"%lu %lu"), (u_long)pgno, (u_long)i));
return (DB_VERIFY_BAD);
}
break;
case B_KEYDATA:
len = bk->len;
break;
case B_DUPLICATE:
case B_OVERFLOW:
len = BOVERFLOW_SIZE;
break;
default:
EPRINT((env, DB_STR_A("0566",
"Page %lu: item %lu of unrecognizable type",
"%lu %lu"), (u_long)pgno, (u_long)i));
return (DB_VERIFY_BAD);
}
if ((size_t)(offset + len) > dbp->pgsize) {
EPRINT((env, DB_STR_A("0567",
"Page %lu: item %lu extends past page boundary",
"%lu %lu"), (u_long)pgno, (u_long)i));
return (DB_VERIFY_BAD);
}
}
if (offsetp != NULL)
*offsetp = offset;
return (0);
} | false | false | false | false | false | 0 |
anlist_unparse( AttributeName *an, char *ptr, ber_len_t buflen ) {
int comma = 0;
char *start = ptr;
for (; !BER_BVISNULL( &an->an_name ); an++) {
/* if buflen == 0, assume the buffer size has been
* already checked otherwise */
if ( buflen > 0 && buflen - ( ptr - start ) < comma + an->an_name.bv_len ) return NULL;
if ( comma ) *ptr++ = ',';
ptr = lutil_strcopy( ptr, an->an_name.bv_val );
comma = 1;
}
return ptr;
} | false | false | false | false | false | 0 |
considerHoistingFromTo(BasicBlock &FromBlock,
BasicBlock &ToBlock) {
SmallSet<const Instruction *, 8> NotHoisted;
const auto AllPrecedingUsesFromBlockHoisted = [&NotHoisted](User *U) {
for (Value* V : U->operand_values()) {
if (Instruction *I = dyn_cast<Instruction>(V)) {
if (NotHoisted.count(I) > 0)
return false;
}
}
return true;
};
unsigned TotalSpeculationCost = 0;
for (auto& I : FromBlock) {
const unsigned Cost = ComputeSpeculationCost(&I, *TTI);
if (Cost != UINT_MAX && isSafeToSpeculativelyExecute(&I) &&
AllPrecedingUsesFromBlockHoisted(&I)) {
TotalSpeculationCost += Cost;
if (TotalSpeculationCost > SpecExecMaxSpeculationCost)
return false; // too much to hoist
} else {
NotHoisted.insert(&I);
if (NotHoisted.size() > SpecExecMaxNotHoisted)
return false; // too much left behind
}
}
if (TotalSpeculationCost == 0)
return false; // nothing to hoist
for (auto I = FromBlock.begin(); I != FromBlock.end();) {
// We have to increment I before moving Current as moving Current
// changes the list that I is iterating through.
auto Current = I;
++I;
if (!NotHoisted.count(&*Current)) {
Current->moveBefore(ToBlock.getTerminator());
}
}
return true;
} | false | false | false | false | false | 0 |
mt7601u_mcu_msg_alloc(struct mt7601u_dev *dev, const void *data, int len)
{
struct sk_buff *skb;
WARN_ON(len % 4); /* if length is not divisible by 4 we need to pad */
skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL);
skb_reserve(skb, MT_DMA_HDR_LEN);
memcpy(skb_put(skb, len), data, len);
return skb;
} | false | false | false | false | false | 0 |
Sockname_Cmd(ClientData cdata,
Tcl_Interp *interp,
int objc,
Tcl_Obj * CONST objv[])
{
#ifdef _WIN32
SOCKET sock;
SOCKADDR_IN sockname;
LPSOCKADDR pSockname = (LPSOCKADDR) &sockname;
int size = sizeof(SOCKADDR_IN);
#else
int sock;
struct sockaddr_in sockname;
struct sockaddr * pSockname = (struct sockaddr *) &sockname;
socklen_t size = sizeof(struct sockaddr_in);
#endif
Tcl_Channel *channel = NULL;
char *channelName = NULL;
int mode;
if (objc != 2) {
Tcl_WrongNumArgs (interp, 1, objv, "socket");
return TCL_ERROR;
}
channelName = Tcl_GetString (objv[1]);
channel = Tcl_GetChannel (interp, channelName, &mode);
if (channel == NULL) {
return TCL_ERROR;
}
if (Tcl_GetChannelHandle (channel, mode, &sock) == TCL_OK) {
if (getsockname(sock, pSockname, &size) >= 0) {
Tcl_Obj *result = NULL;
Tcl_Obj *ip = NULL;
Tcl_Obj *port = NULL;
result = Tcl_NewListObj (0, NULL);
ip = Tcl_NewStringObj (inet_ntoa(sockname.sin_addr), -1);
Tcl_ListObjAppendElement(interp, result, ip);
port = Tcl_NewIntObj (ntohs(sockname.sin_port));
Tcl_ListObjAppendElement(interp, result, port);
Tcl_SetObjResult (interp, result);
return TCL_OK;
} else {
Tcl_AppendResult(interp, "can't get sockname: ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
} else {
Tcl_AppendResult (interp, "Could not get channel handle", (char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
} | false | false | false | false | false | 0 |
brd_zero_page(struct brd_device *brd, sector_t sector)
{
struct page *page;
page = brd_lookup_page(brd, sector);
if (page)
clear_highpage(page);
} | false | false | false | false | false | 0 |
debris_init()
{
int i;
if ( !Debris_inited ) {
Debris_inited = 1;
}
Debris_model = -1;
Debris_vaporize_model = -1;
Debris_num_submodels = 0;
// Reset everything between levels
Num_debris_pieces = 0;
for (i=0; i<MAX_DEBRIS_PIECES; i++ ) {
Debris[i].flags = 0;
Debris[i].sound_delay = 0;
}
Num_hull_pieces = 0;
list_init(&Hull_debris_list);
} | false | false | false | false | false | 0 |
DateCalc_Date_to_Days(Z_int year, Z_int month, Z_int day)
{
boolean leap;
if ((year >= 1) and
(month >= 1) and (month <= 12) and
(day >= 1) and
(day <= DateCalc_Days_in_Month_[leap=DateCalc_leap_year(year)][month]))
return( DateCalc_Year_to_Days(--year) +
DateCalc_Days_in_Year_[leap][month] + day );
return(0L);
} | false | false | false | false | false | 0 |
idetape_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
ide_drive_t *drive = tape->drive;
int err;
mutex_lock(&ide_tape_mutex);
err = generic_ide_ioctl(drive, bdev, cmd, arg);
if (err == -EINVAL)
err = idetape_blkdev_ioctl(drive, cmd, arg);
mutex_unlock(&ide_tape_mutex);
return err;
} | false | false | false | false | false | 0 |
dump_stmt(PLpgSQL_stmt *stmt)
{
printf("%3d:", stmt->lineno);
switch (stmt->cmd_type)
{
case PLPGSQL_STMT_BLOCK:
dump_block((PLpgSQL_stmt_block *) stmt);
break;
case PLPGSQL_STMT_ASSIGN:
dump_assign((PLpgSQL_stmt_assign *) stmt);
break;
case PLPGSQL_STMT_IF:
dump_if((PLpgSQL_stmt_if *) stmt);
break;
case PLPGSQL_STMT_LOOP:
dump_loop((PLpgSQL_stmt_loop *) stmt);
break;
case PLPGSQL_STMT_WHILE:
dump_while((PLpgSQL_stmt_while *) stmt);
break;
case PLPGSQL_STMT_FORI:
dump_fori((PLpgSQL_stmt_fori *) stmt);
break;
case PLPGSQL_STMT_FORS:
dump_fors((PLpgSQL_stmt_fors *) stmt);
break;
case PLPGSQL_STMT_EXIT:
dump_exit((PLpgSQL_stmt_exit *) stmt);
break;
case PLPGSQL_STMT_RETURN:
dump_return((PLpgSQL_stmt_return *) stmt);
break;
case PLPGSQL_STMT_RETURN_NEXT:
dump_return_next((PLpgSQL_stmt_return_next *) stmt);
break;
case PLPGSQL_STMT_RETURN_QUERY:
dump_return_query((PLpgSQL_stmt_return_query *) stmt);
break;
case PLPGSQL_STMT_RAISE:
dump_raise((PLpgSQL_stmt_raise *) stmt);
break;
case PLPGSQL_STMT_EXECSQL:
dump_execsql((PLpgSQL_stmt_execsql *) stmt);
break;
case PLPGSQL_STMT_DYNEXECUTE:
dump_dynexecute((PLpgSQL_stmt_dynexecute *) stmt);
break;
case PLPGSQL_STMT_DYNFORS:
dump_dynfors((PLpgSQL_stmt_dynfors *) stmt);
break;
case PLPGSQL_STMT_GETDIAG:
dump_getdiag((PLpgSQL_stmt_getdiag *) stmt);
break;
case PLPGSQL_STMT_OPEN:
dump_open((PLpgSQL_stmt_open *) stmt);
break;
case PLPGSQL_STMT_FETCH:
dump_fetch((PLpgSQL_stmt_fetch *) stmt);
break;
case PLPGSQL_STMT_CLOSE:
dump_close((PLpgSQL_stmt_close *) stmt);
break;
case PLPGSQL_STMT_PERFORM:
dump_perform((PLpgSQL_stmt_perform *) stmt);
break;
default:
elog(ERROR, "unrecognized cmd_type: %d", stmt->cmd_type);
break;
}
} | false | false | false | false | false | 0 |
nrrdIterSetOwnNrrd(NrrdIter *iter, Nrrd *nrrd) {
if (iter && nrrd && nrrd->data) {
if (nrrdTypeBlock == nrrd->type) {
/* we can't deal */
nrrdIterSetValue(iter, AIR_NAN);
return;
}
iter->nrrd = NULL;
iter->ownNrrd = iter->ownNrrd ? nrrdNuke(iter->ownNrrd) : NULL;
iter->ownNrrd = nrrd;
iter->val = AIR_NAN;
iter->size = nrrdTypeSize[nrrd->type];
iter->data = (char *)nrrd->data;
iter->left = nrrdElementNumber(nrrd)-1;
iter->load = nrrdDLoad[nrrd->type];
}
return;
} | false | false | false | false | false | 0 |
gedit_document_get_can_search_again (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
return gtk_source_search_settings_get_search_text (doc->priv->deprecated_search_settings) != NULL;
} | false | false | false | false | false | 0 |
cps1_build_palette(void)
{
int offset;
for (offset = 0; offset < cps1_palette_entries*16; offset++)
{
int palette = cps1_palette[offset];
if (palette != cps1_old_palette[offset])
{
int red, green, blue, bright;
if (cps_version == 2)
{
bright = 0x10 + (palette>>12);
red = ((palette>>8)&0x0f) * bright * 0x11 / 0x1f;
green = ((palette>>4)&0x0f) * bright * 0x11 / 0x1f;
blue = ((palette>>0)&0x0f) * bright * 0x11 / 0x1f;
}
else
{
bright = (palette>>12);
if (bright) bright += 2;
red = ((palette>>8)&0x0f) * bright;
green = ((palette>>4)&0x0f) * bright;
blue = ((palette>>0)&0x0f) * bright;
}
palette_set_color (offset, red, green, blue);
cps1_old_palette[offset] = palette;
}
}
} | false | false | false | false | false | 0 |
createKeyFrameImpl(Real time)
{
switch(mAnimationType)
{
default:
case VAT_MORPH:
return OGRE_NEW VertexMorphKeyFrame(this, time);
case VAT_POSE:
return OGRE_NEW VertexPoseKeyFrame(this, time);
};
} | false | false | false | false | false | 0 |
nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
struct nilfs_root **rootp)
{
struct the_nilfs *nilfs = sb->s_fs_info;
struct nilfs_root *root;
struct nilfs_checkpoint *raw_cp;
struct buffer_head *bh_cp;
int err = -ENOMEM;
root = nilfs_find_or_create_root(
nilfs, curr_mnt ? NILFS_CPTREE_CURRENT_CNO : cno);
if (!root)
return err;
if (root->ifile)
goto reuse; /* already attached checkpoint */
down_read(&nilfs->ns_segctor_sem);
err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
&bh_cp);
up_read(&nilfs->ns_segctor_sem);
if (unlikely(err)) {
if (err == -ENOENT || err == -EINVAL) {
printk(KERN_ERR
"NILFS: Invalid checkpoint "
"(checkpoint number=%llu)\n",
(unsigned long long)cno);
err = -EINVAL;
}
goto failed;
}
err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size,
&raw_cp->cp_ifile_inode, &root->ifile);
if (err)
goto failed_bh;
atomic64_set(&root->inodes_count,
le64_to_cpu(raw_cp->cp_inodes_count));
atomic64_set(&root->blocks_count,
le64_to_cpu(raw_cp->cp_blocks_count));
nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
reuse:
*rootp = root;
return 0;
failed_bh:
nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
failed:
nilfs_put_root(root);
return err;
} | false | false | false | false | false | 0 |
freeEndNode(EndNode *endNode){
EndNode *tmp;
tmp = endNode;
while (tmp != NULL){
EndNode *next;
next = tmp->nextEN;
if (tmp->edit != NULL){
free(tmp->edit);
}
free(tmp);
tmp = next;
}
} | false | false | false | false | false | 0 |
saveGame (bool saveAs)
{
if (saveAs || m_gameURL.isEmpty()) {
int result=0;
KUrl url;
do {
url = KFileDialog::getSaveUrl (m_gameURL.url(), "*.kjc", m_view, 0);
if (url.isEmpty())
return;
// check filename
QRegExp pattern ("*.kjc", Qt::CaseSensitive, QRegExp::Wildcard);
if (! pattern.exactMatch (url.fileName())) {
url.setFileName (url.fileName()+".kjc");
}
if (KIO::NetAccess::exists (url, KIO::NetAccess::DestinationSide,
m_view)) {
QString mes=i18n("The file %1 exists.\n"
"Do you want to overwrite it?", url.url());
result = KMessageBox::warningContinueCancel
(m_view, mes, QString(), KGuiItem(i18n("Overwrite")));
if (result == KMessageBox::Cancel)
return;
}
} while (result == KMessageBox::No);
m_gameURL = url;
}
KTemporaryFile tempFile;
tempFile.open();
KConfig config (tempFile.fileName(), KConfig::SimpleConfig);
KConfigGroup main (&config, "KJumpingCube");
main.writeEntry ("Version", KJC_VERSION);
KConfigGroup game (&config, "Game");
saveProperties (game);
config.sync();
if (KIO::NetAccess::upload (tempFile.fileName(), m_gameURL, m_view)) {
emit statusMessage (i18n("Game saved as %1", m_gameURL.url()), false);
}
else {
KMessageBox::sorry (m_view, i18n("There was an error in saving file\n%1",
m_gameURL.url()));
}
} | false | false | false | false | false | 0 |
no_from_filter_header()
{
const char *p;
static Buffer buf;
from_filter= &no_from_filter_header;
while ((p=NextLine()) && *p && *p != '\n' && isspace((unsigned char)*p))
current_line += p;
buf=current_line;
buf+='\0';
if (!p || *p == '\n')
{
from_filter= &read_blank;
return (buf);
}
current_line=p;
return (buf);
} | false | false | false | false | false | 0 |
GC_suspend_handler_inner(ptr_t sig_arg)
{
int sig = (int)(word)sig_arg;
int dummy;
pthread_t my_thread = pthread_self();
GC_thread me;
# ifdef PARALLEL_MARK
word my_mark_no = GC_mark_no;
/* Marker can't proceed until we acknowledge. Thus this is */
/* guaranteed to be the mark_no correspending to our */
/* suspension, i.e. the marker can't have incremented it yet. */
# endif
word my_stop_count = GC_stop_count;
if (sig != SIG_SUSPEND) ABORT("Bad signal in suspend_handler");
#if DEBUG_THREADS
GC_printf1("Suspending 0x%lx\n", my_thread);
#endif
me = GC_lookup_thread(my_thread);
/* The lookup here is safe, since I'm doing this on behalf */
/* of a thread which holds the allocation lock in order */
/* to stop the world. Thus concurrent modification of the */
/* data structure is impossible. */
if (me -> stop_info.last_stop_count == my_stop_count) {
/* Duplicate signal. OK if we are retrying. */
if (!GC_retry_signals) {
WARN("Duplicate suspend signal in thread %lx\n",
pthread_self());
}
return;
}
# ifdef SPARC
me -> stop_info.stack_ptr = (ptr_t)GC_save_regs_in_stack();
# else
me -> stop_info.stack_ptr = (ptr_t)(&dummy);
# endif
# ifdef IA64
me -> backing_store_ptr = (ptr_t)GC_save_regs_in_stack();
# endif
/* Tell the thread that wants to stop the world that this */
/* thread has been stopped. Note that sem_post() is */
/* the only async-signal-safe primitive in LinuxThreads. */
sem_post(&GC_suspend_ack_sem);
me -> stop_info.last_stop_count = my_stop_count;
/* Wait until that thread tells us to restart by sending */
/* this thread a SIG_THR_RESTART signal. */
/* SIG_THR_RESTART should be masked at this point. Thus there */
/* is no race. */
/* We do not continue until we receive a SIG_THR_RESTART, */
/* but we do not take that as authoritative. (We may be */
/* accidentally restarted by one of the user signals we */
/* don't block.) After we receive the signal, we use a */
/* primitive and expensive mechanism to wait until it's */
/* really safe to proceed. Under normal circumstances, */
/* this code should not be executed. */
sigsuspend(&suspend_handler_mask); /* Wait for signal */
while (GC_world_is_stopped && GC_stop_count == my_stop_count) {
GC_brief_async_signal_safe_sleep();
# if DEBUG_THREADS
GC_err_printf0("Sleeping in signal handler");
# endif
}
/* If the RESTART signal gets lost, we can still lose. That should be */
/* less likely than losing the SUSPEND signal, since we don't do much */
/* between the sem_post and sigsuspend. */
/* We'd need more handshaking to work around that. */
/* Simply dropping the sigsuspend call should be safe, but is unlikely */
/* to be efficient. */
#if DEBUG_THREADS
GC_printf1("Continuing 0x%lx\n", my_thread);
#endif
} | false | false | false | false | false | 0 |
handle_ani_list(riff_tag_t *lst, enum res_e type, int isswapped)
{
riff_tag_t *rtp = lst+1; /* Skip the "LIST" tag */
while((char *)rtp < (char *)lst + lst->size + sizeof(*lst))
{
if(!memcmp(rtp->tag, info, sizeof(info)))
{
rtp = SKIP_TAG(rtp,4);
}
else if(!memcmp(rtp->tag, inam, sizeof(inam)))
{
/* Ignore the icon/cursor name; its a string */
rtp = NEXT_TAG(rtp);
}
else if(!memcmp(rtp->tag, iart, sizeof(iart)))
{
/* Ignore the author's name; it's a string */
rtp = NEXT_TAG(rtp);
}
else if(!memcmp(rtp->tag, fram, sizeof(fram)))
{
/* This should be followed by "icon"s, but we
* simply ignore this because it is pure
* non-information.
*/
rtp = SKIP_TAG(rtp,4);
}
else if(!memcmp(rtp->tag, icon, sizeof(icon)))
{
handle_ani_icon(rtp, type, isswapped);
rtp = NEXT_TAG(rtp);
}
else
internal_error(__FILE__, __LINE__, "Unknown tag \"%c%c%c%c\" in RIFF file\n",
isprint(rtp->tag[0]) ? rtp->tag[0] : '.',
isprint(rtp->tag[1]) ? rtp->tag[1] : '.',
isprint(rtp->tag[2]) ? rtp->tag[2] : '.',
isprint(rtp->tag[3]) ? rtp->tag[3] : '.');
if((UINT_PTR)rtp & 1)
rtp = SKIP_TAG(rtp,1);
}
} | false | false | false | false | false | 0 |
clutter_path_add_curve_to (ClutterPath *path,
gint x_1,
gint y_1,
gint x_2,
gint y_2,
gint x_3,
gint y_3)
{
g_return_if_fail (CLUTTER_IS_PATH (path));
clutter_path_add_node_helper (path, CLUTTER_PATH_CURVE_TO, 3,
x_1, y_1,
x_2, y_2,
x_3, y_3);
} | false | false | false | false | false | 0 |
readFromStream(mrpt::utils::CStream &in,int version)
{
switch(version)
{
case 0:
case 1:
{
readFromStreamRender(in);
CVectorFloat x0,y0,z0,x1,y1,z1;
in>>x0>>y0>>z0>>x1>>y1>>z1;
if (version>=1) in>>mLineWidth;
else mLineWidth=1;
size_t N=x0.size();
mSegments.resize(N);
for (size_t i=0;i<N;i++) {
mSegments[i][0][0]=x0[i];
mSegments[i][0][1]=y0[i];
mSegments[i][0][2]=z0[i];
mSegments[i][1][0]=x1[i];
mSegments[i][1][1]=y1[i];
mSegments[i][1][2]=z1[i];
}
} break;
case 2:
case 3:
{
readFromStreamRender(in);
in>>mSegments;
in>>mLineWidth;
if (version>=3)
in >> m_antiAliasing;
else m_antiAliasing = true;
}
break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
};
CRenderizableDisplayList::notifyChange();
} | false | false | false | false | false | 0 |
fso_gsm_throwAppropriateError (FsoGsmConstantsAtResponse code, const gchar* detail, GError** error) {
GError* _error_ = NULL;
FsoGsmConstantsAtResponse _tmp0_ = 0;
const gchar* _tmp1_ = NULL;
GError* _tmp2_ = NULL;
GError* _tmp3_ = NULL;
GError * _inner_error_ = NULL;
g_return_if_fail (detail != NULL);
_tmp0_ = code;
_tmp1_ = detail;
_tmp2_ = fso_gsm_constants_atResponseCodeToError (_tmp0_, _tmp1_);
_error_ = _tmp2_;
_tmp3_ = _g_error_copy0 (_error_);
_inner_error_ = _tmp3_;
if ((_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
g_propagate_error (error, _inner_error_);
_g_error_free0 (_error_);
return;
} else {
_g_error_free0 (_error_);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return;
}
_g_error_free0 (_error_);
} | false | false | false | false | false | 0 |
Message() const {
ASSERT(isolate_ == i::Isolate::Current());
if (HasCaught() && message_ != i::Smi::FromInt(0)) {
i::Object* message = reinterpret_cast<i::Object*>(message_);
return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_));
} else {
return v8::Local<v8::Message>();
}
} | false | false | false | false | false | 0 |
restore_atime(const string & chemin, const inode * & ptr)
{
const file * ptr_f = dynamic_cast<const file *>(ptr);
if(ptr_f != NULL)
tools_noexcept_make_date(chemin, ptr_f->get_last_access(), ptr_f->get_last_modif());
} | false | false | false | false | false | 0 |
gst_auto_convert_internal_src_query (GstPad * pad, GstQuery * query)
{
GstAutoConvert *autoconvert =
GST_AUTO_CONVERT (g_object_get_qdata (G_OBJECT (pad),
parent_quark));
GstPad *peerpad = gst_pad_get_peer (autoconvert->sinkpad);
gboolean ret = FALSE;
if (peerpad) {
ret = gst_pad_query (peerpad, query);
gst_object_unref (peerpad);
}
return ret;
} | false | false | false | false | false | 0 |
layer_menu_update(ObMenuFrame *frame, gpointer data)
{
ObMenu *menu = frame->menu;
GList *it;
if (frame->client == NULL || !client_normal(frame->client))
return FALSE; /* don't show the menu */
for (it = menu->entries; it; it = g_list_next(it)) {
ObMenuEntry *e = it->data;
gboolean *en = &e->data.normal.enabled; /* save some typing */
ObClient *c = frame->client;
if (e->type == OB_MENU_ENTRY_TYPE_NORMAL) {
switch (e->id) {
case LAYER_TOP:
*en = !c->above && (c->functions & OB_CLIENT_FUNC_ABOVE);
break;
case LAYER_NORMAL:
*en = c->above || c->below;
break;
case LAYER_BOTTOM:
*en = !c->below && (c->functions & OB_CLIENT_FUNC_BELOW);
break;
default:
*en = TRUE;
}
}
}
return TRUE; /* show the menu */
} | false | false | false | false | false | 0 |
SetInputField(const char* name,
const char* fieldLoc)
{
if ( !name || !fieldLoc)
{
return;
}
int numAttr = vtkDataSetAttributes::NUM_ATTRIBUTES;
int numFieldLocs = 3;
int i;
// Convert strings to ints and call the appropriate SetInputField()
int attrType=-1;
for(i=0; i<numAttr; i++)
{
if (!strcmp(name, AttributeNames[i]))
{
attrType = i;
break;
}
}
int loc=-1;
for(i=0; i<numFieldLocs; i++)
{
if (!strcmp(fieldLoc, FieldLocationNames[i]))
{
loc = i;
break;
}
}
if (loc == -1)
{
vtkErrorMacro("Location for the field is invalid.");
return;
}
if (attrType == -1)
{
this->SetInputField(name, loc);
}
else
{
this->SetInputField(attrType, loc);
}
} | false | false | false | false | false | 0 |
clrmade(Node *n)
{
Arc *a;
n->flags &= ~(CANPRETEND|PRETENDING);
if(strchr(n->name, '(') ==0 || n->time)
n->flags |= CANPRETEND;
MADESET(n, NOTMADE);
for(a = n->prereqs; a; a = a->next)
if(a->n)
clrmade(a->n);
} | false | false | false | false | false | 0 |
xgetgrnam(const char *name)
{
int i;
if (!gtable)
create_group_table();
for (i = 0; gtable[i].gr_name; i++) {
if (!strcmp(name, gtable[i].gr_name))
return &(gtable[i]);
}
return NULL;
} | false | false | false | false | false | 0 |
HandleServerPLimitCommand(char* args)
{
if (*args)
{
char* param = ExtractLiteralArg(&args);
if (!param)
{ return false; }
int l = strlen(param);
int val;
if (strncmp(param, "player", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_PLAYER); }
else if (strncmp(param, "moderator", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_MODERATOR); }
else if (strncmp(param, "gamemaster", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_GAMEMASTER); }
else if (strncmp(param, "administrator", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR); }
else if (strncmp(param, "reset", l) == 0)
{ sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT)); }
else if (ExtractInt32(¶m, val))
{
if (val < -SEC_ADMINISTRATOR)
{ val = -SEC_ADMINISTRATOR; }
sWorld.SetPlayerLimit(val);
}
else
{ return false; }
// kick all low security level players
if (sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
{ sWorld.KickAllLess(sWorld.GetPlayerSecurityLimit()); }
}
uint32 pLimit = sWorld.GetPlayerAmountLimit();
AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit();
char const* secName = "";
switch (allowedAccountType)
{
case SEC_PLAYER: secName = "Player"; break;
case SEC_MODERATOR: secName = "Moderator"; break;
case SEC_GAMEMASTER: secName = "Gamemaster"; break;
case SEC_ADMINISTRATOR: secName = "Administrator"; break;
default: secName = "<unknown>"; break;
}
PSendSysMessage("Player limits: amount %u, min. security level %s.", pLimit, secName);
return true;
} | false | false | false | false | false | 0 |
_want_format(struct dmraid_format *fmt, const char *format, enum fmt_type type)
{
return fmt->format != type ||
(format && strncmp(format, fmt->name, strlen(format))) ? 0 : 1;
} | false | true | false | false | true | 1 |
dcookie_exit(void)
{
struct list_head * list;
struct list_head * pos;
struct list_head * pos2;
struct dcookie_struct * dcs;
size_t i;
for (i = 0; i < hash_size; ++i) {
list = dcookie_hashtable + i;
list_for_each_safe(pos, pos2, list) {
dcs = list_entry(pos, struct dcookie_struct, hash_list);
list_del(&dcs->hash_list);
free_dcookie(dcs);
}
}
kfree(dcookie_hashtable);
kmem_cache_destroy(dcookie_cache);
} | false | false | false | false | false | 0 |
vfs_utimens (const gchar *path, const struct timespec tv [2])
{
GFile *file;
GError *error = NULL;
gint result = 0;
debug_print ("vfs_utimens: %s\n", path);
file = file_from_full_path (path);
if (file)
{
guint64 atime;
guint32 atime_usec;
guint64 mtime;
guint32 mtime_usec;
GFileInfo *info;
if (tv)
{
atime = (guint64) tv [0].tv_sec;
atime_usec = (guint32) tv [0].tv_nsec / (guint32) 1000;
mtime = (guint64) tv [1].tv_sec;
mtime_usec = (guint32) tv [1].tv_nsec / (guint32) 1000;
}
else
{
struct timeval tiv;
gettimeofday (&tiv, NULL);
atime = (guint64) tiv.tv_sec;
atime_usec = (guint32) tiv.tv_usec;
mtime = atime;
mtime_usec = atime_usec;
}
info = g_file_info_new ();
g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, mtime);
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, mtime_usec);
g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, atime);
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, atime_usec);
g_file_set_attributes_from_info (file, info, 0, NULL, &error);
if (error)
{
/* As long as not all backends support all attributes we set,
report failure only if neither mtime and atime have been set. */
if (g_file_info_get_attribute_status (info, G_FILE_ATTRIBUTE_TIME_ACCESS) == G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING &&
g_file_info_get_attribute_status (info, G_FILE_ATTRIBUTE_TIME_MODIFIED) == G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING)
{
/* Note: we only get first error from the attributes we try to set, might not be accurate
(a limitation of g_file_set_attributes_from_info()). */
result = -errno_from_error (error);
}
g_error_free (error);
}
g_object_unref (file);
g_object_unref (info);
}
else if (path_is_mount_list (path))
{
/* */
}
else
{
result = -ENOENT;
}
debug_print ("vfs_utimens: -> %s\n", g_strerror (-result));
return result;
} | false | false | false | false | false | 0 |
ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
{
struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
char ahc_info[256];
u_int max_targ;
u_int i;
seq_printf(m, "Adaptec AIC7xxx driver version: %s\n",
AIC7XXX_DRIVER_VERSION);
seq_printf(m, "%s\n", ahc->description);
ahc_controller_info(ahc, ahc_info);
seq_printf(m, "%s\n", ahc_info);
seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n",
ahc->scb_data->numscbs, AHC_NSEG);
if (ahc->seep_config == NULL)
seq_puts(m, "No Serial EEPROM\n");
else {
seq_puts(m, "Serial EEPROM:\n");
for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
if (((i % 8) == 0) && (i != 0)) {
seq_putc(m, '\n');
}
seq_printf(m, "0x%.4x ",
((uint16_t*)ahc->seep_config)[i]);
}
seq_putc(m, '\n');
}
seq_putc(m, '\n');
max_targ = 16;
if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
max_targ = 8;
for (i = 0; i < max_targ; i++) {
u_int our_id;
u_int target_id;
char channel;
channel = 'A';
our_id = ahc->our_id;
target_id = i;
if (i > 7 && (ahc->features & AHC_TWIN) != 0) {
channel = 'B';
our_id = ahc->our_id_b;
target_id = i % 8;
}
ahc_dump_target_state(ahc, m, our_id,
channel, target_id, i);
}
return 0;
} | false | false | false | false | false | 0 |
slotEntriesFailed()
{
EntryLoader *loader = dynamic_cast<EntryLoader*>(sender());
delete loader;
m_activefeeds--;
emit signalEntriesFailed();
} | false | false | false | false | false | 0 |
ajStrIsCharsetCaseS(const AjPStr str, const AjPStr str2)
{
char filter[256] = {'\0'}; /* should make all zero */
const char* cp;
const char* cq;
if(!str)
return ajFalse;
if(!str->Len)
return ajFalse;
if(!str2)
return ajFalse;
cq = str2->Ptr;
while (*cq)
{
filter[tolower((int)*cq)] = 1;
filter[toupper((int)*cq++)] = 1;
}
cp = str->Ptr;
while(*cp)
if(!filter[(int)*cp++])
return ajFalse;
return ajTrue;
} | true | true | false | false | false | 1 |
handle_connected (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
gchar *version;
GString *hint_string;
int timeout;
version = read_string (message, message_length, offset);
hint_string = g_string_new ("");
while (*offset < message_length)
{
gchar *name, *value;
name = read_string (message, message_length, offset);
value = read_string (message, message_length, offset);
g_hash_table_insert (priv->hints, name, value);
g_string_append_printf (hint_string, " %s=%s", name, value);
}
g_debug ("Connected version=%s%s", version, hint_string->str);
g_free (version);
g_string_free (hint_string, TRUE);
/* Set timeout for default login */
timeout = lightdm_greeter_get_autologin_timeout_hint (greeter);
if (timeout)
{
g_debug ("Setting autologin timer for %d seconds", timeout);
priv->autologin_timeout = g_timeout_add (timeout * 1000, timed_login_cb, greeter);
}
} | 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.