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
__pyx_f_7dumbnet_3tun_2fd___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; Py_INCREF(__pyx_v_self); __pyx_1 = PyInt_FromLong(tun_fileno(((struct __pyx_obj_7dumbnet_tun *)__pyx_v_self)->tun)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; goto __pyx_L1;} __pyx_r = __pyx_1; __pyx_1 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("dumbnet.tun.fd.__get__"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; }
false
false
false
false
false
0
gda_sql_case_copy (GdaSqlCase *sc) { GdaSqlCase *copy; GSList *list; if (!sc) return NULL; copy = gda_sql_case_new (NULL); copy->base_expr = gda_sql_expr_copy (sc->base_expr); gda_sql_any_part_set_parent (copy->base_expr, copy); copy->else_expr = gda_sql_expr_copy (sc->else_expr); gda_sql_any_part_set_parent (copy->else_expr, copy); for (list = sc->when_expr_list; list; list = list->next) { copy->when_expr_list = g_slist_prepend (copy->when_expr_list, gda_sql_expr_copy ((GdaSqlExpr*) list->data)); gda_sql_any_part_set_parent (copy->when_expr_list->data, copy); } copy->when_expr_list = g_slist_reverse (copy->when_expr_list); for (list = sc->then_expr_list; list; list = list->next) { copy->then_expr_list = g_slist_prepend (copy->then_expr_list, gda_sql_expr_copy ((GdaSqlExpr*) list->data)); gda_sql_any_part_set_parent (copy->then_expr_list->data, copy); } copy->then_expr_list = g_slist_reverse (copy->then_expr_list); return copy; }
false
false
false
false
false
0
handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc = finalizers->gc.gc_next; if (garbage == NULL) { garbage = PyList_New(0); if (garbage == NULL) Py_FatalError("gc couldn't create gc.garbage list"); } for (; gc != finalizers; gc = gc->gc.gc_next) { PyObject *op = FROM_GC(gc); if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { if (PyList_Append(garbage, op) < 0) return -1; } } gc_list_merge(finalizers, old); return 0; }
false
false
false
false
false
0
ad7192_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad7192_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); int ret; bool val; ret = strtobool(buf, &val); if (ret < 0) return ret; mutex_lock(&indio_dev->mlock); if (iio_buffer_enabled(indio_dev)) { mutex_unlock(&indio_dev->mlock); return -EBUSY; } switch ((u32)this_attr->address) { case AD7192_REG_GPOCON: if (val) st->gpocon |= AD7192_GPOCON_BPDSW; else st->gpocon &= ~AD7192_GPOCON_BPDSW; ad_sd_write_reg(&st->sd, AD7192_REG_GPOCON, 1, st->gpocon); break; case AD7192_REG_MODE: if (val) st->mode |= AD7192_MODE_ACX; else st->mode &= ~AD7192_MODE_ACX; ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); break; default: ret = -EINVAL; } mutex_unlock(&indio_dev->mlock); return ret ? ret : len; }
false
false
false
false
false
0
do_jump_by_parts_equality (tree exp, rtx if_false_label, rtx if_true_label) { rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0); rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD); int i; rtx drop_through_label = 0; if (! if_false_label) drop_through_label = if_false_label = gen_label_rtx (); for (i = 0; i < nwords; i++) do_compare_rtx_and_jump (operand_subword_force (op0, i, mode), operand_subword_force (op1, i, mode), EQ, TREE_UNSIGNED (TREE_TYPE (exp)), word_mode, NULL_RTX, if_false_label, NULL_RTX); if (if_true_label) emit_jump (if_true_label); if (drop_through_label) emit_label (drop_through_label); }
false
false
false
false
false
0
md_stripname(char *mdfullpath) { int i; static char *plainname=NULL; if (plainname!=NULL) free(plainname),plainname=NULL; if ((plainname=malloc(strlen(mdfullpath)+1))==NULL) error(1,ERR_MEM,"md_stripname()"); for (i=strlen(mdfullpath)-1;i>0;i--) { if (mdfullpath[i]=='/') { i++; break; } } strcpy(plainname,mdfullpath+i); return plainname; }
false
false
false
false
false
0
initTape (Tape nt) { value *peerVal = findPeer (nt->peerName) ; scope *s = (peerVal == NULL ? NULL : peerVal->v.scope_val) ; nt->inFp = NULL ; nt->outFp = NULL ; nt->lastRotated = 0 ; nt->checkNew = false ; #if 0 nt->head = NULL ; nt->tail = NULL ; nt->qLength = 0 ; #endif nt->scribbled = false ; nt->tellpos = 0 ; nt->changed = false ; nt->outputSize = 0 ; nt->lossage = 0 ; nt->noBacklog = false ; nt->outputLowLimit = BLOGLIMIT; nt->outputHighLimit = BLOGLIMIT_HIGH; nt->backlogFactor = LIMIT_FUDGE; if (!talkToSelf) { int bval ; if (getBool (s, "no-backlog", &bval, INHERIT)) nt->noBacklog = (bval ? true : false); else nt->noBacklog = TAPE_DISABLE; if (getInteger (s,"backlog-limit",&nt->outputLowLimit,INHERIT)) { if (!getReal (s,"backlog-factor",&nt->backlogFactor,INHERIT)) { if (!getInteger (s,"backlog-limit-highwater", &nt->outputHighLimit,INHERIT)) { warn ("%s no backlog-factor or backlog-limit-highwater", nt->peerName) ; nt->outputLowLimit = BLOGLIMIT; nt->outputHighLimit = BLOGLIMIT_HIGH; nt->backlogFactor = LIMIT_FUDGE; } } else nt->outputHighLimit = (long)(nt->outputLowLimit * nt->backlogFactor); } else warn ("ME config: no definition for required key backlog-limit") ; } d_printf (1, "%s spooling: %s\n", nt->peerName, nt->noBacklog ? "disabled" : "enabled"); d_printf (1,"%s tape backlog limit: [%ld %ld]\n",nt->peerName, nt->outputLowLimit, nt->outputHighLimit) ; prepareFiles (nt) ; }
false
false
false
false
false
0
AVCHD_SetXMPShotName ( SXMPMeta& xmpObj, const AVCHD_blkPlayListMarkExt& markExt, const std::string& strClipName ) { if ( markExt.mPresent ) { const std::string shotName = AVCHD_StringFieldToXMP ( markExt.mMarkNameLength, markExt.mMarkCharacterSet, markExt.mMarkName, 24 ); if ( ! shotName.empty() ) xmpObj.SetProperty ( kXMP_NS_DC, "shotName", shotName.c_str(), kXMP_DeleteExisting ); } }
false
false
false
false
false
0
restore_segments(const Segment_states* segment_states) { // Go through the segment list and remove any segment added in the // relaxation loop. this->tls_segment_ = NULL; this->relro_segment_ = NULL; Segment_list::iterator list_iter = this->segment_list_.begin(); while (list_iter != this->segment_list_.end()) { Output_segment* segment = *list_iter; Segment_states::const_iterator states_iter = segment_states->find(segment); if (states_iter != segment_states->end()) { const Output_segment* copy = states_iter->second; // Shallow copy to restore states. *segment = *copy; // Also fix up TLS and RELRO segment pointers as appropriate. if (segment->type() == elfcpp::PT_TLS) this->tls_segment_ = segment; else if (segment->type() == elfcpp::PT_GNU_RELRO) this->relro_segment_ = segment; ++list_iter; } else { list_iter = this->segment_list_.erase(list_iter); // This is a segment created during section layout. It should be // safe to remove it since we should have removed all pointers to it. delete segment; } } }
false
false
false
false
false
0
diffProgram(const Module *Program, const std::string &BitcodeFile, const std::string &SharedObject, bool RemoveBitcode, std::string *ErrMsg) const { // Execute the program, generating an output file... std::string Output( executeProgram(Program, "", BitcodeFile, SharedObject, nullptr, ErrMsg)); if (!ErrMsg->empty()) return false; std::string Error; bool FilesDifferent = false; if (int Diff = DiffFilesWithTolerance(ReferenceOutputFile, Output, AbsTolerance, RelTolerance, &Error)) { if (Diff == 2) { errs() << "While diffing output: " << Error << '\n'; exit(1); } FilesDifferent = true; } else { // Remove the generated output if there are no differences. sys::fs::remove(Output); } // Remove the bitcode file if we are supposed to. if (RemoveBitcode) sys::fs::remove(BitcodeFile); return FilesDifferent; }
false
false
false
false
false
0
ConstantPropUsersOf(Value *V, const DataLayout &DL, TargetLibraryInfo *TLI) { for (Value::user_iterator UI = V->user_begin(), E = V->user_end(); UI != E; ) if (Instruction *I = dyn_cast<Instruction>(*UI++)) if (Constant *NewC = ConstantFoldInstruction(I, DL, TLI)) { I->replaceAllUsesWith(NewC); // Advance UI to the next non-I use to avoid invalidating it! // Instructions could multiply use V. while (UI != E && *UI == I) ++UI; I->eraseFromParent(); } }
false
false
false
false
false
0
is_distinct(ScmObj x, ScmObj y) { ScmObj carx; if (SCM_PAIRP(x)) { carx = SCM_CAR(x); if (SCM_EQ(carx, SCM_SYM_COMP)) { SCM_ASSERT(SCM_CHAR_SET_P(SCM_CDR(x))); if (SCM_CHARP(y) || SCM_CHAR_SET_P(y)) { return !is_distinct(SCM_CDR(x), y); } return FALSE; } if (SCM_INTP(carx)) { if (SCM_PAIRP(SCM_CDDR(x))) { return is_distinct(SCM_CAR(SCM_CDDR(x)), y); } } if (SCM_EQ(carx, SCM_SYM_SEQ_UNCASE) || SCM_EQ(carx, SCM_SYM_SEQ_CASE)) { if (SCM_PAIRP(SCM_CDR(x))) { return is_distinct(SCM_CADR(x), y); } } return FALSE; } if (SCM_CHARP(x)) { if (SCM_CHARP(y)) return !SCM_EQ(x, y); return is_distinct(y, x); } if (SCM_CHAR_SET_P(x)) { if (SCM_CHARP(y)) { return !Scm_CharSetContains(SCM_CHAR_SET(x), SCM_CHAR_VALUE(y)); } if (SCM_CHAR_SET_P(y)) { ScmObj ccs = Scm_CharSetCopy(SCM_CHAR_SET(y)); ccs = Scm_CharSetComplement(SCM_CHAR_SET(ccs)); return Scm_CharSetLE(SCM_CHAR_SET(x), SCM_CHAR_SET(ccs)); } return is_distinct(y, x); } return FALSE; }
false
false
false
false
false
0
check_delay() { struct delay_mode *d = NULL, *prev = NULL, *dnext = NULL; for (d = delay_head; d; d = dnext) { dnext = d->next; if (d->seconds <= now) { add_mode(d->chan, d->plsmns, d->mode, d->mask); if (prev) prev->next = d->next; else delay_head = d->next; if (delay_tail == d) delay_tail = prev; if (d->mask) nfree(d->mask); nfree(d); } else { prev = d; } } }
false
false
false
false
false
0
contains_newline(Blob *p){ const char *z = blob_str(p); while( *z ){ if( *z=='\n' ) return 1; z++; } return 0; }
false
false
false
false
false
0
find_attribute_string (GckAttribute *attrs, gsize n_attrs, gulong attr_type, gchar **value) { GckAttribute *attr; gchar *string; attr = find_attribute (attrs, n_attrs, attr_type); if (!attr || gck_attribute_is_invalid (attr)) return FALSE; string = gck_attribute_get_string (attr); if (string == NULL) return FALSE; *value = string; return TRUE; }
false
false
false
false
false
0
oldPositionIDFromKey(const oldpositionkey * pkey) { unsigned char const *puch = pkey->auch; static char szID[L_POSITIONID + 1]; char *pch = szID; static char aszBase64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int i; for (i = 0; i < 3; i++) { *pch++ = aszBase64[puch[0] >> 2]; *pch++ = aszBase64[((puch[0] & 0x03) << 4) | (puch[1] >> 4)]; *pch++ = aszBase64[((puch[1] & 0x0F) << 2) | (puch[2] >> 6)]; *pch++ = aszBase64[puch[2] & 0x3F]; puch += 3; } *pch++ = aszBase64[*puch >> 2]; *pch++ = aszBase64[(*puch & 0x03) << 4]; *pch = 0; return szID; }
false
false
false
false
false
0
replace_shrink_var_operand(Shrink_args *sa, Operand *op) { int nth_set; for (nth_set = 0; nth_set < sa->max_set; nth_set++) { if (op->kind != sa->formal_keep[nth_set]->kind) continue; if (in_IntSet(sa->arg_entry_set[nth_set], op->entry)) { op->entry = sa->formal_keep[nth_set]->entry; } } }
false
false
false
false
false
0
getDemandedBits(Instruction *I) { performAnalysis(); const DataLayout &DL = I->getParent()->getModule()->getDataLayout(); if (AliveBits.count(I)) return AliveBits[I]; return APInt::getAllOnesValue(DL.getTypeSizeInBits(I->getType())); }
false
false
false
false
false
0
BitPack(unsigned char *Dest, int CurrentBit, unsigned char *Source, int Bits) { int i; for (i=0; i<Bits; i++) if (gn_ringtone_get_bit(Source, i)) gn_ringtone_set_bit(Dest, CurrentBit+i); else gn_ringtone_clear_bit(Dest, CurrentBit+i); return CurrentBit+Bits; }
false
false
false
false
false
0
__ecereInstMeth___ecereNameSpace__ecere__gui__controls__ListBox_NotifyChanged__00000011(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Instance * listBox, struct __ecereNameSpace__ecere__com__Instance * row) { struct __ecereNameSpace__ecere__gui__controls__DataBox * __ecerePointer___ecereNameSpace__ecere__gui__controls__DataBox = (struct __ecereNameSpace__ecere__gui__controls__DataBox *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gui__controls__DataBox->offset) : 0); struct __ecereNameSpace__ecere__com__Class * type = __ecereNameSpace__ecere__com__eClass_GetProperty(((struct __ecereNameSpace__ecere__com__Class *)__ecerePointer___ecereNameSpace__ecere__gui__controls__DataBox->type), "dataType"); if(type->type == 0 && !strcmp(type->dataTypeString, "char *")) { char * string = (char *)__ecereMethod___ecereNameSpace__ecere__gui__controls__DataRow_GetData(row, (((void *)0))); if(!string || !string[0]) { } else { if(row == __ecereProp___ecereNameSpace__ecere__gui__controls__ListBox_Get_lastRow(listBox)) { } else { row = __ecereProp___ecereNameSpace__ecere__gui__controls__DataRow_Get_next(row); } __ecereMethod___ecereNameSpace__ecere__gui__controls__ListBox_SelectRow(listBox, row); } } return 0x1; }
false
false
false
false
false
0
PatchLUT(cmsStage* CLUT, cmsUInt16Number At[], cmsUInt16Number Value[], int nChannelsOut, int nChannelsIn) { _cmsStageCLutData* Grid = (_cmsStageCLutData*) CLUT ->Data; cmsInterpParams* p16 = Grid ->Params; cmsFloat64Number px, py, pz, pw; int x0, y0, z0, w0; int i, index; if (CLUT -> Type != cmsSigCLutElemType) { cmsSignalError(CLUT->ContextID, cmsERROR_INTERNAL, "(internal) Attempt to PatchLUT on non-lut MPE"); return FALSE; } px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0; py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0; pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0; pw = ((cmsFloat64Number) At[3] * (p16->Domain[3])) / 65535.0; x0 = (int) floor(px); y0 = (int) floor(py); z0 = (int) floor(pz); w0 = (int) floor(pw); if (nChannelsIn == 4) { if (((px - x0) != 0) || ((py - y0) != 0) || ((pz - z0) != 0) || ((pw - w0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[3] * x0 + p16 -> opta[2] * y0 + p16 -> opta[1] * z0 + p16 -> opta[0] * w0; } else if (nChannelsIn == 3) { if (((px - x0) != 0) || ((py - y0) != 0) || ((pz - z0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[2] * x0 + p16 -> opta[1] * y0 + p16 -> opta[0] * z0; } else if (nChannelsIn == 1) { if (((px - x0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[0] * x0; } else { cmsSignalError(CLUT->ContextID, cmsERROR_INTERNAL, "(internal) %d Channels are not supported on PatchLUT", nChannelsIn); return FALSE; } for (i=0; i < nChannelsOut; i++) Grid -> Tab.T[index + i] = Value[i]; return TRUE; }
false
false
false
false
false
0
killcmd(int argc, char **argv) { int i = 1; if (argv[1] && strcmp(argv[1], "-l") != 0) { do { if (argv[i][0] == '%') { struct job *jp = getjob(argv[i], 0); unsigned pid = jp->ps[0].ps_pid; /* Enough space for ' -NNN<nul>' */ argv[i] = alloca(sizeof(int)*3 + 3); /* kill_main has matching code to expect * leading space. Needed to not confuse * negative pids with "kill -SIGNAL_NO" syntax */ sprintf(argv[i], " -%u", pid); } } while (argv[++i]); } return kill_main(argc, argv); }
false
false
false
false
false
0
SDLVid_Flush(GF_VideoOutput *dr, GF_Window *dest) { SDL_Rect rc; SDLVID(); /*if resizing don't process otherwise we may deadlock*/ if (!ctx->screen) return GF_OK; if (ctx->output_3d_type==1) { SDL_GL_SwapBuffers(); return GF_OK; } if (!ctx->back_buffer) return GF_BAD_PARAM; if ((dest->w != (u32) ctx->back_buffer->w) || (dest->h != (u32) ctx->back_buffer->h)) { GF_VideoSurface src, dst; SDL_LockSurface(ctx->back_buffer); SDL_LockSurface(ctx->screen); src.height = ctx->back_buffer->h; src.width = ctx->back_buffer->w; src.pitch_x = 0; src.pitch_y = ctx->back_buffer->pitch; src.pixel_format = SDLVid_MapPixelFormat(ctx->back_buffer->format, ctx->force_alpha); src.video_buffer = ctx->back_buffer->pixels; dst.height = ctx->screen->h; dst.width = ctx->screen->w; dst.pitch_x = 0; dst.pitch_y = ctx->screen->pitch; dst.pixel_format = SDLVid_MapPixelFormat(ctx->screen->format, 0); dst.video_buffer = ctx->screen->pixels; gf_stretch_bits(&dst, &src, dest, NULL, 0xFF, 0, NULL, NULL); SDL_UnlockSurface(ctx->back_buffer); SDL_UnlockSurface(ctx->screen); } else { rc.x = dest->x; rc.y = dest->y; rc.w = dest->w; rc.h = dest->h; SDL_BlitSurface(ctx->back_buffer, NULL, ctx->screen, &rc); } SDL_Flip(ctx->screen); return GF_OK; }
false
false
false
false
false
0
dwarf_get_DS_name (unsigned int val,const char ** s_out) { switch (val) { case DW_DS_unsigned: *s_out = "DW_DS_unsigned"; return DW_DLV_OK; case DW_DS_leading_overpunch: *s_out = "DW_DS_leading_overpunch"; return DW_DLV_OK; case DW_DS_trailing_overpunch: *s_out = "DW_DS_trailing_overpunch"; return DW_DLV_OK; case DW_DS_leading_separate: *s_out = "DW_DS_leading_separate"; return DW_DLV_OK; case DW_DS_trailing_separate: *s_out = "DW_DS_trailing_separate"; return DW_DLV_OK; } return DW_DLV_NO_ENTRY; }
false
false
false
false
false
0
newsnntp_mode_reader(newsnntp * f) { char command[NNTP_STRING_SIZE]; char * response; int r; snprintf(command, NNTP_STRING_SIZE, "MODE READER\r\n"); r = send_command(f, command); if (r == -1) return NEWSNNTP_ERROR_STREAM; response = read_line(f); if (response == NULL) return NEWSNNTP_ERROR_STREAM; r = parse_response(f, response); switch (r) { case 480: return NEWSNNTP_ERROR_REQUEST_AUTHORIZATION_USERNAME; case 381: return NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD; case 200: case 201: return NEWSNNTP_NO_ERROR; default: return NEWSNNTP_ERROR_UNEXPECTED_RESPONSE; } }
true
true
false
false
false
1
get_ident (struct linereader *lr) { char *buf; size_t bufact; size_t bufmax = 56; const struct keyword_t *kw; int ch; buf = xmalloc (bufmax); bufact = 0; ADDC (lr->buf[lr->idx - 1]); while (!isspace ((ch = lr_getc (lr))) && ch != '"' && ch != ';' && ch != '<' && ch != ',' && ch != EOF) { if (ch == lr->escape_char) { ch = lr_getc (lr); if (ch == '\n' || ch == EOF) { lr_error (lr, _("invalid escape sequence")); break; } } ADDC (ch); } lr_ungetc (lr, ch); kw = lr->hash_fct (buf, bufact); if (kw != NULL && kw->symname_or_ident == 0) { lr->token.tok = kw->token; free (buf); } else { lr->token.tok = tok_ident; buf = xrealloc (buf, bufact + 1); buf[bufact] = '\0'; lr->token.val.str.startmb = buf; lr->token.val.str.lenmb = bufact; } return &lr->token; }
false
false
false
false
false
0
stripoff_last_component(char *path) { char *p = path ? strrchr(path, '/') : NULL; if (!p) return NULL; *p = '\0'; return ++p; }
false
false
false
false
false
0
builtin_split_by_characters( FRAME * frame, int flags ) { LIST * l1 = lol_get( frame->args, 0 ); LIST * l2 = lol_get( frame->args, 1 ); LIST * result = L0; string buf[ 1 ]; const char * delimiters = object_str( list_front( l2 ) ); char * t; string_copy( buf, object_str( list_front( l1 ) ) ); t = strtok( buf->value, delimiters) ; while ( t ) { result = list_push_back( result, object_new( t ) ); t = strtok( NULL, delimiters ); } string_free( buf ); return result; }
false
false
false
false
false
0
CaptureMouse(int grab) { if (MouseCapture == 0) { if (!grab) return 0; MouseCapture = View; } else { if (grab || MouseCapture != View) return 0; MouseCapture = 0; } return 1; }
false
false
false
false
false
0
netsys_reshape(value bv) { struct caml_bigarray *b; struct caml_bigarray *mem; uintnat size; int i,k; CAMLparam1(bv); CAMLlocal2(memv,dimv); b = Bigarray_val(bv); /* We dont't have access to caml_ba_update_proxy. The workaround is to call caml_ba_reshape, and to fix the returned bigarray descriptor afterward. */ dimv = alloc(b->num_dims,0); for (k=0; k < b->num_dims; k++) { Store_field(dimv, k, Val_long(b->dim[k])); }; memv = caml_ba_reshape(bv, dimv); mem = Bigarray_val(memv); /* Compute the size of the data area: */ size = caml_ba_element_size[b->flags & CAML_BA_KIND_MASK]; for (i = 0; i < b->num_dims; i++) size *= b->dim[i]; mem->num_dims = 1; mem->flags = (mem->flags & ~CAML_BA_KIND_MASK) | CAML_BA_UINT8; mem->flags = (mem->flags & ~CAML_BA_LAYOUT_MASK) | CAML_BA_C_LAYOUT; mem->dim[0] = size; CAMLreturn(memv); }
false
false
false
false
true
1
connection_setup_add_watch (ConnectionSetup *cs, DBusWatch *watch) { guint flags; GIOCondition condition; GIOChannel *channel; IOHandler *handler; if (!dbus_watch_get_enabled (watch)) return; flags = dbus_watch_get_flags (watch); condition = G_IO_ERR | G_IO_HUP; if (flags & DBUS_WATCH_READABLE) condition |= G_IO_IN; if (flags & DBUS_WATCH_WRITABLE) condition |= G_IO_OUT; handler = g_new0 (IOHandler, 1); handler->cs = cs; handler->watch = watch; channel = g_io_channel_unix_new (dbus_watch_get_unix_fd (watch)); handler->source = g_io_create_watch (channel, condition); g_source_set_callback (handler->source, (GSourceFunc) io_handler_dispatch, handler, io_handler_source_finalized); g_source_attach (handler->source, cs->context); cs->ios = g_slist_prepend (cs->ios, handler); dbus_watch_set_data (watch, handler, io_handler_watch_freed); g_io_channel_unref (channel); }
false
false
false
false
false
0
H5P_init_interface(void) { size_t tot_init; /* Total # of classes initialized */ size_t pass_init; /* # of classes initialized in each pass */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* * Initialize the Generic Property class & object groups. */ if(H5I_register_type(H5I_GENPROPCLS_CLS) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") if(H5I_register_type(H5I_GENPROPLST_CLS) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Repeatedly pass over the list of property list classes for the library, * initializing each class if it's parent class is initialized, until no * more progress is made. */ tot_init = 0; do { size_t u; /* Local index variable */ /* Reset pass initialization counter */ pass_init = 0; /* Make a pass over all the library's property list classes */ for(u = 0; u < NELMTS(init_class); u++) { H5P_libclass_t const *lib_class = init_class[u]; /* Current class to operate on */ /* Check if the current class hasn't been initialized and can be now */ HDassert(lib_class->class_id); if(*lib_class->class_id == (-1) && (lib_class->par_class_id == NULL || *lib_class->par_class_id > 0)) { H5P_genclass_t *par_pclass = NULL; /* Parent class of new class */ H5P_genclass_t *new_pclass; /* New property list class created */ /* Sanity check - only the root class is not allowed to have a parent class */ HDassert(lib_class->par_class_id || lib_class == H5P_CLS_ROOT); /* Check for parent class */ if(lib_class->par_class_id) { /* Get the pointer to the parent class */ if(NULL == (par_pclass = (H5P_genclass_t *)H5I_object(*lib_class->par_class_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") } /* end if */ /* Allocate the new class */ if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") /* Call routine to register properties for class */ if(lib_class->reg_prop_func && (*lib_class->reg_prop_func)(new_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register properties") /* Register the new class */ if((*lib_class->class_id = H5I_register(H5I_GENPROP_CLS, new_pclass, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") /* Only register the default property list if it hasn't been created yet */ if(lib_class->def_plist_id && *lib_class->def_plist_id == (-1)) { /* Register the default property list for the new class*/ if((*lib_class->def_plist_id = H5P_create_id(new_pclass, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list for class") } /* end if */ /* Increment class initialization counters */ pass_init++; tot_init++; } /* end if */ } /* end for */ } while(pass_init > 0); /* Verify that all classes were initialized */ HDassert(tot_init == NELMTS(init_class)); done: FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
request(const Jid &to, const QString &sid) { d->mode = ModeRequest; QDomElement iq; d->to = to; iq = createIQ(doc(), "set", to.full(), id()); QDomElement query = doc()->createElement("open"); //genUniqueKey query.setAttribute("xmlns", IBB_NS); query.setAttribute("sid", sid); query.setAttribute("block-size", IBB_PACKET_SIZE); query.setAttribute("stanza", "iq"); iq.appendChild(query); d->iq = iq; }
false
false
false
false
false
0
memberof_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { PRThread *thread = NULL; int rv = SLAPI_DSE_CALLBACK_OK; task_data *mytaskdata = NULL; Slapi_Task *task = NULL; char *bind_dn; const char *filter; const char *dn = 0; *returncode = LDAP_SUCCESS; /* make sure the plugin was not stopped from a shutdown */ if (!g_plugin_started) { *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } /* get arg(s) */ if ((dn = fetch_attr(e, "basedn", 0)) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } if ((filter = fetch_attr(e, "filter", "(|(objectclass=inetuser)(objectclass=inetadmin))")) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } /* setup our task data */ slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &bind_dn); mytaskdata = (task_data*)slapi_ch_malloc(sizeof(task_data)); if (mytaskdata == NULL) { *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } mytaskdata->dn = slapi_ch_strdup(dn); mytaskdata->filter_str = slapi_ch_strdup(filter); mytaskdata->bind_dn = slapi_ch_strdup(bind_dn); /* allocate new task now */ task = slapi_new_task(slapi_entry_get_ndn(e)); /* register our destructor for cleaning up our private data */ slapi_task_set_destructor_fn(task, memberof_task_destructor); /* Stash a pointer to our data in the task */ slapi_task_set_data(task, mytaskdata); /* start the sample task as a separate thread */ thread = PR_CreateThread(PR_USER_THREAD, memberof_fixup_task_thread, (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE); if (thread == NULL) { slapi_log_error( SLAPI_LOG_FATAL, MEMBEROF_PLUGIN_SUBSYSTEM, "unable to create task thread!\n"); *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; slapi_task_finish(task, *returncode); } else { rv = SLAPI_DSE_CALLBACK_OK; } out: return rv; }
false
false
false
false
false
0
transport_lun_remove_cmd(struct se_cmd *cmd) { struct se_lun *lun = cmd->se_lun; if (!lun) return; if (cmpxchg(&cmd->lun_ref_active, true, false)) percpu_ref_put(&lun->lun_ref); }
false
false
false
false
false
0
phi12(PROJ *P, double *del, double *sig) { int err = 0; if (!proj_param(P->params, "tlat_1").i || !proj_param(P->params, "tlat_2").i) { err = -41; } else { P->phi_1 = proj_param(P->params, "rlat_1").f; P->phi_2 = proj_param(P->params, "rlat_2").f; *del = 0.5 * (P->phi_2 - P->phi_1); *sig = 0.5 * (P->phi_2 + P->phi_1); err = (fabs(*del) < EPS || fabs(*sig) < EPS) ? -42 : 0; } return err; }
false
false
false
false
false
0
amdmsDestroyStatisticsAlgo(amdmsALGO_STAT_ENV **env) { amdmsALGO_STAT_ENV *henv = NULL; amdmsALGO_ENV *hhenv = NULL; if (env == NULL) { return amdmsFAILURE; } if (*env == NULL) { return amdmsSUCCESS; } henv = *env; if (henv->histoData != NULL) { free(henv->histoData); henv->histoData = NULL; } amdmsFreeData(&(henv->meanPixels)); amdmsFreeData(&(henv->varPixels)); amdmsFreeParticleEventSetup(&(henv->events)); hhenv = &(henv->env); amdmsDestroyAlgo(&hhenv); if (henv->allocated) { henv->allocated = amdmsFALSE; free(henv); *env = NULL; } return amdmsSUCCESS; }
false
false
false
false
false
0
toc_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque) { if (content && content->size) bufput(ob, content->data, content->size); return 1; }
false
false
false
false
false
0
__lambda7_ (AbracaMainWindow* self, GtkAction* action) { g_return_if_fail (action != NULL); abraca_configurable_save (); gtk_main_quit (); }
false
false
false
false
false
0
nfs_inode_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, fop_rmdir_cbk_t cbk, void *local) { struct nfs_fop_local *nfl = NULL; int ret = -EFAULT; if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) return ret; nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err); nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL, pathloc->name, NULL); ret = nfs_fop_rmdir (nfsx, xl, nfu, pathloc, nfs_inode_rmdir_cbk, nfl); err: if (ret < 0) nfs_fop_local_wipe (xl, nfl); return ret; }
false
false
false
false
false
0
ConstrainBackbone(OBMol &mol, Template *templ, int tmax) { static OBAtom *neighbour[6]; Template *pep; OBAtom *na,*nb,*nc,*nd; OBAtom *atom, *nbr; bool change, result; int i, count; unsigned int idx; vector<OBAtom *>::iterator a; vector<OBBond *>::iterator b; /* First Pass */ for (atom = mol.BeginAtom(a) ; atom ; atom = mol.NextAtom(a)) { idx = atom->GetIdx() - 1; bitmasks[idx] = 0; for ( i = 0 ; i < tmax ; i++ ) if ( (static_cast<unsigned int>(templ[i].elem) == atom->GetAtomicNum()) && (static_cast<unsigned int>(templ[i].count) == atom->GetHvyValence())) bitmasks[idx] |= templ[i].flag; } /* Second Pass */ do { change = false; for (atom = mol.BeginAtom(a) ; atom ; atom = mol.NextAtom(a)) { idx = atom->GetIdx() - 1; if (bitmasks[idx]) // Determine Neighbours { count = 0; for (nbr = atom->BeginNbrAtom(b) ; nbr ; nbr = atom->NextNbrAtom(b)) if (!nbr->IsHydrogen()) neighbour[count++] = nbr; if (count >= 1) na = neighbour[0]; if (count >= 2) nb = neighbour[1]; if (count >= 3) nc = neighbour[2]; if (count >= 4) nd = neighbour[3]; for ( i = 0 ; i < tmax ; i++ ) if ( templ[i].flag & bitmasks[idx] ) { pep = &templ[i]; result = true; if (count == 4) result = Match4Constraints(pep,na,nb,nc,nd); else if (count == 3) result = Match3Constraints(pep,na,nb,nc); else if (count == 2) result = Match2Constraints(pep,na,nb); else if (count == 1) result = MatchConstraint(na,pep->n1); if(result == false) { bitmasks[idx] &= ~pep->flag; change = true; } } } } } while( change ); }
false
false
false
false
false
0
GetPredictionCostCrossColorRed( const uint32_t* argb, int stride, int tile_width, int tile_height, VP8LMultipliers prev_x, VP8LMultipliers prev_y, int green_to_red, const int accumulated_red_histo[256]) { int histo[256] = { 0 }; float cur_diff; VP8LCollectColorRedTransforms(argb, stride, tile_width, tile_height, green_to_red, histo); cur_diff = PredictionCostCrossColor(accumulated_red_histo, histo); if ((uint8_t)green_to_red == prev_x.green_to_red_) { cur_diff -= 3; // favor keeping the areas locally similar } if ((uint8_t)green_to_red == prev_y.green_to_red_) { cur_diff -= 3; // favor keeping the areas locally similar } if (green_to_red == 0) { cur_diff -= 3; } return cur_diff; }
false
false
false
false
false
0
border_width_inherit (ccss_style_t const *container_style, ccss_style_t *style) { ccss_property_t const *property; bool ret; if (ccss_style_get_property (container_style, "border-width", &property)) { if (PROPERTY_SET (property)) { ccss_style_set_property (style, "border-width", property); ret = true; } } if (ccss_style_get_property (container_style, "border-left-width", &property)) { if (PROPERTY_SET (property)) { ccss_style_set_property (style, "border-left-width", property); } else if (PROPERTY_INHERIT (property)) { /* Need to resolve further. */ ret = false; } } if (ccss_style_get_property (container_style, "border-top-width", &property)) { if (PROPERTY_SET (property)) { ccss_style_set_property (style, "border-top-width", property); } else if (PROPERTY_INHERIT (property)) { /* Need to resolve further. */ ret = false; } } if (ccss_style_get_property (container_style, "border-right-width", &property)) { if (PROPERTY_SET (property)) { ccss_style_set_property (style, "border-right-width", property); } else if (PROPERTY_INHERIT (property)) { /* Need to resolve further. */ ret = false; } } if (ccss_style_get_property (container_style, "border-bottom-width", &property)) { if (PROPERTY_SET (property)) { ccss_style_set_property (style, "border-bottom-width", property); } else if (PROPERTY_INHERIT (property)) { /* Need to resolve further. */ ret = false; } } return ret; }
false
false
false
false
false
0
release(MsgPacket* p) { std::set<DiskNode*>::iterator i = m_used.begin(); while(i != m_used.end()) { if((*i)->packet() == p) { (*i)->release(); m_used.erase(i); return; } } }
false
false
false
false
false
0
ldns_dane_get_nth_cert_from_validation_chain( X509** cert, STACK_OF(X509)* chain, int n, bool ca) { if (n >= sk_X509_num(chain) || n < 0) { return LDNS_STATUS_DANE_OFFSET_OUT_OF_RANGE; } *cert = sk_X509_pop(chain); while (n-- > 0) { X509_free(*cert); *cert = sk_X509_pop(chain); } if (ca && ! X509_check_ca(*cert)) { return LDNS_STATUS_DANE_NON_CA_CERTIFICATE; } return LDNS_STATUS_OK; }
false
false
false
false
false
0
socket_evt_clear(struct gnutella_socket *s) { socket_check(s); if (s->gdk_tag) { if (GNET_PROPERTY(tls_debug) > 4) { int fd = socket_evt_fd(s); g_debug("socket_evt_clear: fd=%d, cond=%s", fd, inputevt_cond_to_string(s->tls.cb_cond)); } s->tls.cb_cond = 0; s->tls.cb_handler = NULL; s->tls.cb_data = NULL; inputevt_remove(&s->gdk_tag); } }
false
false
false
false
false
0
m6800_reset(void *param) { SEI; /* IRQ disabled */ PCD = RM16( 0xfffe ); CHANGE_PC(); m6800.wai_state = 0; m6800.nmi_state = 0; m6800.irq_state[M6800_IRQ_LINE] = 0; m6800.irq_state[M6800_TIN_LINE] = 0; m6800.ic_eddge = 0; m6800.port1_ddr = 0x00; m6800.port2_ddr = 0x00; /* TODO: on reset port 2 should be read to determine the operating mode (bits 0-2) */ m6800.tcsr = 0x00; m6800.pending_tcsr = 0x00; m6800.irq2 = 0; CTD = 0x0000; OCD = 0xffff; TOD = 0xffff; m6800.ram_ctrl |= 0x40; }
false
false
false
false
false
0
viewphfig(pt_fig) phfig_list *pt_fig; { phcon_list *pt_con = NULL; phins_list *pt_ins = NULL; chain_list *pt_chain = NULL; phseg_list *pt_seg = NULL; phvia_list *pt_via = NULL; phref_list *pt_ref = NULL; if (!pt_fig) return; if (pt_fig->NAME == NULL) (void)printf("!!! figure without name !!!\n"); else (void)printf("\nfigure : %-20s mode : %c\n", pt_fig->NAME, pt_fig->MODE); (void)printf(" |---abutment box : %ld %ld %ld %ld\n", pt_fig->XAB1, pt_fig->YAB1, pt_fig->XAB2, pt_fig->YAB2); if (pt_fig->MODELCHAIN == NULL) (void)printf(" |---empty list of instance names\n"); else { (void)printf(" |---models \n"); for (pt_chain = pt_fig->MODELCHAIN; pt_chain != NULL; pt_chain = pt_chain->NEXT) (void)printf(" | |---%s \n", (char *)pt_chain->DATA); } if (pt_fig->PHCON == NULL) (void)printf(" |---empty list of connectors\n"); else for (pt_con = pt_fig->PHCON; pt_con != NULL; pt_con = pt_con->NEXT) viewphcon(pt_con); if (pt_fig->PHINS == NULL) (void)printf(" |---empty list of instances\n"); else for (pt_ins = pt_fig->PHINS; pt_ins != NULL; pt_ins = pt_ins->NEXT) viewphins(pt_ins); if (pt_fig->PHSEG == NULL) (void)printf(" |---empty list of segments\n"); else for (pt_seg = pt_fig->PHSEG; pt_seg != NULL; pt_seg = pt_seg->NEXT) viewphseg(pt_seg); if (pt_fig->PHVIA == NULL) (void)printf(" |---empty list of vias\n"); else for (pt_via = pt_fig->PHVIA; pt_via != NULL; pt_via = pt_via->NEXT) viewphvia(pt_via); if (pt_fig->PHREF == NULL) (void)printf(" |---empty list of references\n"); else for (pt_ref = pt_fig->PHREF; pt_ref != NULL; pt_ref = pt_ref->NEXT) viewphref(pt_ref); if (pt_fig->USER != NULL) (void)printf(" |--- non empty USER field\n"); (void)printf(" | \n"); }
false
false
false
false
false
0
timerEvent(QTimerEvent * event) { if (event->timerId() == m_timer.timerId()) { m_timer.stop(); setStage(m_stage + 1); m_timer.start(TEST_STEP_INTERVAL, this); } }
false
false
false
false
false
0
es_read_fbf (estream_t ES__RESTRICT stream, unsigned char *ES__RESTRICT buffer, size_t bytes_to_read, size_t *ES__RESTRICT bytes_read) { size_t data_available; size_t data_to_read; size_t data_read; int err; data_read = 0; err = 0; while ((bytes_to_read - data_read) && (! err)) { if (stream->data_offset == stream->data_len) { /* Nothing more to read in current container, try to fill container with new data. */ err = es_fill (stream); if (! err) if (! stream->data_len) /* Filling did not result in any data read. */ break; } if (! err) { /* Filling resulted in some new data. */ data_to_read = bytes_to_read - data_read; data_available = stream->data_len - stream->data_offset; if (data_to_read > data_available) data_to_read = data_available; memcpy (buffer + data_read, stream->buffer + stream->data_offset, data_to_read); stream->data_offset += data_to_read; data_read += data_to_read; } } *bytes_read = data_read; return err; }
false
false
false
false
false
0
calculateMotionPercentInCell (int p_row, int p_col, double *p_cellarea, double *p_motionarea) { double cntpixelsnum = 0; double cntmotionpixelnum = 0; int ybegin = floor ((double) p_row * m_cellheight); int yend = floor ((double) (p_row + 1) * m_cellheight); int xbegin = floor ((double) (p_col) * m_cellwidth); int xend = floor ((double) (p_col + 1) * m_cellwidth); int cellw = xend - xbegin; int cellh = yend - ybegin; int cellarea = cellw * cellh; *p_cellarea = cellarea; int thresholdmotionpixelnum = floor ((double) cellarea * m_sensitivity); for (int i = ybegin; i < yend; i++) { for (int j = xbegin; j < xend; j++) { cntpixelsnum++; if ((((uchar *) (m_pbwImage->imageData + m_pbwImage->widthStep * i))[j]) > 0) { cntmotionpixelnum++; if (cntmotionpixelnum >= thresholdmotionpixelnum) { //we dont needs calculate anymore *p_motionarea = cntmotionpixelnum; return (cntmotionpixelnum / cntpixelsnum); } } int remainingpixelsnum = cellarea - cntpixelsnum; if ((cntmotionpixelnum + remainingpixelsnum) < thresholdmotionpixelnum) { //moving pixels number will be less than threshold *p_motionarea = 0; return 0; } } } return (cntmotionpixelnum / cntpixelsnum); }
false
false
false
false
false
0
print_union_pw_multi_aff_isl( __isl_take isl_printer *p, __isl_keep isl_union_pw_multi_aff *upma) { struct isl_union_print_data data = { p, 1 }; struct isl_print_space_data space_data = { 0 }; isl_space *space; space = isl_union_pw_multi_aff_get_space(upma); if (isl_space_dim(space, isl_dim_param) > 0) { p = print_tuple(space, p, isl_dim_param, &space_data); p = isl_printer_print_str(p, s_to[0]); } isl_space_free(space); p = isl_printer_print_str(p, s_open_set[0]); isl_union_pw_multi_aff_foreach_pw_multi_aff(upma, &print_pw_multi_aff_body_wrap, &data); p = data.p; p = isl_printer_print_str(p, s_close_set[0]); return p; }
false
false
false
false
false
0
ldns_radix_last_in_subtree_incl_self(ldns_radix_node_t* node) { ldns_radix_node_t* last = ldns_radix_last_in_subtree(node); if (last) { return last; } else if (node->data) { return node; } return NULL; }
false
false
false
false
false
0
Write( const int8 * buf, int len, const sockaddr * addr, int addrlen ) const { tASSERT( IsOpen() ); #ifdef DEBUG if ( sn_ResetSocket ) { sn_ResetSocket = false; Reset(); } #endif int ret = 0; // check if return value was archived static char const * section = "SEND"; if ( !tRecorder::Playback( section, ret ) ) { static tReproducibleRandomizer randomizer; #ifdef DEBUG // pretend send was successful in packet loss simulation if ( sn_simulateSendPacketLoss > randomizer.Get() ) ret = len; else #endif { // don't send if a playback is running if ( !tRecorder::IsPlayingBack() ) ret = sendto (socket_, buf, len, 0, addr, addrlen ); } } if ( ret < 0 ) { // log error tRecorder::Record( section, ret ); // handle error switch ( ANET_Error() ) { case nSocketError_Reset: { Reset(); return -1; } break; case nSocketError_Ignore: return -1; break; } } return ret; }
false
false
false
false
false
0
Expire_Pilots() { vCFP *pvlist = &vPilots; size_t max, ii, xcnt, nxcnt; PCF_Pilot pp; time_t curr = time(0); // get current epoch seconds time_t diff; int idiff, iExp; iExp = (int)m_PlayerExpires; char *tb = GetNxtBuf(); max = pvlist->size(); xcnt = 0; nxcnt = 0; for (ii = 0; ii < max; ii++) { pp = &pvlist->at(ii); if ( pp->expired ) { xcnt++; } else { // diff = curr - pp->curr_time; diff = curr - pp->last_seen; // 20121222 - Use LAST SEEN for expiry idiff = (int)diff; //if ((pp->curr_time + m_PlayerExpires) > curr) { if (idiff > iExp) { pp->expired = true; pp->exp_time = curr; // time expired - epoch secs sprintf(tb,"EXPIRED %d",idiff); //print_pilot(pp,"EXPIRED"); print_pilot(pp, tb, pt_Expired); //Pilot_Tracker_Disconnect(pp); nxcnt++; } } } m_ExpiredCnt = (xcnt + nxcnt); #ifdef ADD_VECTOR_ERASE if (m_MaxExpired && (m_ExpiredCnt > m_MaxExpired)) { // time to clean up vector memory vSZT vst; for (ii = 0; ii < max; ii++) { pp = &pvlist->at(ii); if ( pp->expired ) { vst.push_back(ii); } } while (!vst.empty()) { ii = vst.back(); vst.pop_back(); pvlist->erase(pvlist->begin() + ii); } ii = pvlist->size(); SPRTF("%s: Removed %d expired pilots from vector. Was %d, now %d\n", mod_name, (int) m_ExpiredCnt, (int) max, (int) ii ); m_ExpiredCnt = 0; } #endif // #ifdef ADD_VECTOR_ERASE }
false
false
false
false
false
0
ast_device_state_engine_init(void) { ast_cond_init(&change_pending, NULL); if (ast_pthread_create_background(&change_thread, NULL, do_devstate_changes, NULL) < 0) { ast_log(LOG_ERROR, "Unable to start device state change thread.\n"); return -1; } return 0; }
false
false
false
false
false
0
onKeyRelease(FXObject*,FXSelector,void* ptr){ FXEvent* event=(FXEvent*)ptr; if(isEnabled()){ if(target && target->tryHandle(this,FXSEL(SEL_KEYRELEASE,message),ptr)) return 1; switch(event->code){ case KEY_Shift_L: case KEY_Shift_R: // We do not switch modes unless something was going on already if(mode!=HOVERING){ if((event->state&MIDDLEBUTTONMASK) || ((event->state&LEFTBUTTONMASK) && (event->state&RIGHTBUTTONMASK))){ setOp(ZOOMING); } else if(event->state&RIGHTBUTTONMASK){ setOp(TRANSLATING); } } return 1; case KEY_Control_L: case KEY_Control_R: // We do not switch modes unless something was going on already if(mode!=HOVERING){ if(event->state&RIGHTBUTTONMASK){ setOp(TRANSLATING); } } return 1; } } return 0; }
false
false
false
false
false
0
_ml_P_IO_readbuf (ml_state_t *msp, ml_val_t arg) { int fd = REC_SELINT(arg, 0); ml_val_t buf = REC_SEL(arg, 1); int nbytes = REC_SELINT(arg, 2); char *start = STR_MLtoC(buf) + REC_SELINT(arg, 3); int n; n = read (fd, start, nbytes); CHK_RETURN (msp, n) }
false
true
false
false
true
1
ipath_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult) { return (rcv_mult > snd_mult) ? (plen * (rcv_mult - snd_mult) + 1) >> 1 : 0; }
false
false
false
false
false
0
setPointer(IntervalGroup *p) { //TODO: add check if it is right type. FWReference::setPointer(p); }
false
false
false
false
false
0
ttyname (int fd) { static size_t buflen; char procname[30]; struct stat64 st, st1; int dostat = 0; char *name; int save = errno; struct termios term; /* isatty check, tcgetattr is used because it sets the correct errno (EBADF resp. ENOTTY) on error. */ if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0)) return NULL; if (__fxstat64 (_STAT_VER, fd, &st) < 0) return NULL; /* We try using the /proc filesystem. */ *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0'; if (buflen == 0) { buflen = 4095; ttyname_buf = (char *) malloc (buflen + 1); if (ttyname_buf == NULL) { buflen = 0; return NULL; } } ssize_t len = __readlink (procname, ttyname_buf, buflen); if (__builtin_expect (len != -1, 1)) { if ((size_t) len >= buflen) return NULL; #define UNREACHABLE_LEN strlen ("(unreachable)") if (len > UNREACHABLE_LEN && memcmp (ttyname_buf, "(unreachable)", UNREACHABLE_LEN) == 0) { memmove (ttyname_buf, ttyname_buf + UNREACHABLE_LEN, len - UNREACHABLE_LEN); len -= UNREACHABLE_LEN; } /* readlink need not terminate the string. */ ttyname_buf[len] = '\0'; /* Verify readlink result, fall back on iterating through devices. */ if (ttyname_buf[0] == '/' && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0 #ifdef _STATBUF_ST_RDEV && S_ISCHR (st1.st_mode) && st1.st_rdev == st.st_rdev #else && st1.st_ino == st.st_ino && st1.st_dev == st.st_dev #endif ) return ttyname_buf; } if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode)) { #ifdef _STATBUF_ST_RDEV name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat); #else name = getttyname ("/dev/pts", st.st_dev, st.st_ino, save, &dostat); #endif } else { __set_errno (save); name = NULL; } if (!name && dostat != -1) { #ifdef _STATBUF_ST_RDEV name = getttyname ("/dev", st.st_rdev, st.st_ino, save, &dostat); #else name = getttyname ("/dev", st.st_dev, st.st_ino, save, &dostat); #endif } if (!name && dostat != -1) { dostat = 1; #ifdef _STATBUF_ST_RDEV name = getttyname ("/dev", st.st_rdev, st.st_ino, save, &dostat); #else name = getttyname ("/dev", st.st_dev, st.st_ino, save, &dostat); #endif } return name; }
false
false
false
false
false
0
XzCheck_Init(CXzCheck *p, int mode) { p->mode = mode; switch (mode) { case XZ_CHECK_CRC32: p->crc = CRC_INIT_VAL; break; case XZ_CHECK_CRC64: p->crc64 = CRC64_INIT_VAL; break; case XZ_CHECK_SHA256: p->sha = cl_hash_init("sha256"); break; } }
false
false
false
false
false
0
mov_pload_callback (GtkWidget *widget, gpointer data) { GtkWidget *filesel; t_mov_gui_stuff *mgp = data; if(mgp->filesel != NULL) { gtk_window_present(GTK_WINDOW(mgp->filesel)); return; /* filesel is already open */ } filesel = gtk_file_selection_new ( _("Load Path Points from File")); mgp->filesel = filesel; gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE); g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filesel)->ok_button), "clicked", G_CALLBACK (p_points_load_from_file), mgp); g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button), "clicked", G_CALLBACK (p_filesel_close_cb), mgp); gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), mgp->pointfile_name); gtk_widget_show (filesel); /* "destroy" has to be the last signal, * (otherwise the other callbacks are never called) */ g_signal_connect (G_OBJECT (filesel), "destroy", G_CALLBACK (p_filesel_close_cb), mgp); }
false
false
false
false
false
0
gst_base_sink_flush_stop (GstBaseSink * basesink, GstPad * pad) { /* unset flushing so we can accept new data, this also flushes out any EOS * event. */ gst_base_sink_set_flushing (basesink, pad, FALSE); /* for position reporting */ GST_OBJECT_LOCK (basesink); basesink->priv->current_sstart = GST_CLOCK_TIME_NONE; basesink->priv->current_sstop = GST_CLOCK_TIME_NONE; basesink->priv->eos_rtime = GST_CLOCK_TIME_NONE; basesink->priv->call_preroll = TRUE; basesink->priv->current_step.valid = FALSE; basesink->priv->pending_step.valid = FALSE; if (basesink->pad_mode == GST_ACTIVATE_PUSH) { /* we need new segment info after the flush. */ basesink->have_newsegment = FALSE; gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED); gst_segment_init (basesink->abidata.ABI.clip_segment, GST_FORMAT_UNDEFINED); } GST_OBJECT_UNLOCK (basesink); }
false
false
false
false
false
0
strdup_convert ( const gchar * str, const gchar * enc_to, const gchar * enc_from ) { gchar * conv; gsize b_read, b_written; conv = g_convert (str, -1, enc_to, enc_from, &b_read, &b_written, NULL); if (!conv) { printf(_("Unable to convert from %s charset; perhaps encoded differently?"), enc_from); return g_strdup(str); } return conv; }
false
false
false
false
false
0
compose_multiple_compounds (GdaSqlStatementCompoundType ctype, GdaSqlStatement *left, GdaSqlStatement *right) { GdaSqlStatement *ret = NULL; GdaSqlStatementCompound *lc = (GdaSqlStatementCompound*) left->contents; if (lc->compound_type == ctype) { GdaSqlStatementCompound *rc = (GdaSqlStatementCompound*) right->contents; if (!rc->stmt_list->next || rc->compound_type == ctype) { GSList *list; for (list = rc->stmt_list; list; list = list->next) GDA_SQL_ANY_PART (((GdaSqlStatement*)list->data)->contents)->parent = GDA_SQL_ANY_PART (lc); ret = left; lc->stmt_list = g_slist_concat (lc->stmt_list, rc->stmt_list); rc->stmt_list = NULL; gda_sql_statement_free (right); } } else { ret = gda_sql_statement_new (GDA_SQL_STATEMENT_COMPOUND); gda_sql_statement_compound_set_type (ret, ctype); gda_sql_statement_compound_take_stmt (ret, left); gda_sql_statement_compound_take_stmt (ret, right); } return ret; }
false
false
false
false
false
0
visitICmpInst(ICmpInst &I) { // We must cast the results of icmp which might be promoted. bool needsCast = false; // Write out the cast of the instruction's value back to the proper type // if necessary. bool NeedsClosingParens = writeInstructionCast(I); // Certain icmp predicate require the operand to be forced to a specific type // so we use writeOperandWithCast here instead of writeOperand. Similarly // below for operand 1 writeOperandWithCast(I.getOperand(0), I); switch (I.getPredicate()) { case ICmpInst::ICMP_EQ: Out << " == "; break; case ICmpInst::ICMP_NE: Out << " != "; break; case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_SLE: Out << " <= "; break; case ICmpInst::ICMP_UGE: case ICmpInst::ICMP_SGE: Out << " >= "; break; case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_SLT: Out << " < "; break; case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_SGT: Out << " > "; break; default: #ifndef NDEBUG errs() << "Invalid icmp predicate!" << I; #endif llvm_unreachable(0); } writeOperandWithCast(I.getOperand(1), I); if (NeedsClosingParens) Out << "))"; if (needsCast) { Out << "))"; } }
false
false
false
false
false
0
path_node_delete_chain(path_node * head) { while ( head != NULL ) { path_node * prev = head; head = head->next; delete[] prev->element; delete prev; } }
false
false
false
false
false
0
addrconf6_start (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; gboolean success; const guint8 *hwaddr; guint hwaddr_len = 0; connection = nm_device_get_connection (self); g_assert (connection); g_warn_if_fail (priv->ac_ip6_config == NULL); if (priv->ac_ip6_config) { g_object_unref (priv->ac_ip6_config); priv->ac_ip6_config = NULL; } if (!priv->ip6_manager) { priv->ip6_manager = nm_ip6_manager_get (); priv->ip6_addrconf_sigid = g_signal_connect (priv->ip6_manager, "addrconf-complete", G_CALLBACK (ip6_addrconf_complete), self); priv->ip6_config_changed_sigid = g_signal_connect (priv->ip6_manager, "config-changed", G_CALLBACK (ip6_config_changed), self); } hwaddr = nm_device_get_hw_address (self, &hwaddr_len); g_warn_if_fail (hwaddr != NULL); success = nm_ip6_manager_prepare_interface (priv->ip6_manager, nm_device_get_ip_ifindex (self), hwaddr, hwaddr_len, nm_connection_get_setting_ip6_config (connection), priv->ip6_accept_ra_path); if (success) { priv->ip6_waiting_for_config = TRUE; nm_ip6_manager_begin_addrconf (priv->ip6_manager, nm_device_get_ip_ifindex (self)); } return success; }
false
false
false
false
false
0
Next(const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval) { SQObjectPtr oval; SQInteger idx = _members->Next(false,refpos,outkey,oval); if(idx != -1) { if(_ismethod(oval)) { outval = _methods[_member_idx(oval)].val; } else { SQObjectPtr &o = _defaultvalues[_member_idx(oval)].val; outval = _realval(o); } } return idx; }
false
false
false
false
false
0
EffectHealMaxHealth(SpellEffectIndex /*eff_idx*/) { if (!unitTarget) { return; } if (!unitTarget->IsAlive()) { return; } uint32 heal = m_caster->GetMaxHealth(); m_healing += heal; }
false
false
false
false
false
0