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
get_max_crash_kernel_limit(uint64_t *start, uint64_t *end) { int i, idx = -1; unsigned long sz_max = 0, sz; if (!crash_reserved_mem_nr) return -1; for (i = crash_reserved_mem_nr - 1; i >= 0; i--) { sz = crash_reserved_mem[i].end - crash_reserved_mem[i].start +1; if (sz <= sz_max) continue; sz_max = sz; idx = i; } *start = crash_reserved_mem[idx].start; *end = crash_reserved_mem[idx].end; return 0; }
false
false
false
false
false
0
_pager_update_drop_position(Pager *p, Evas_Coord x, Evas_Coord y) { Pager_Desk *pd; p->dnd_x = x; p->dnd_y = y; pd = _pager_desk_at_coord(p, x, y); if (pd == p->active_drop_pd) return; if (pd) edje_object_signal_emit(pd->o_desk, "e,action,drag,in", "e"); if (p->active_drop_pd) edje_object_signal_emit(p->active_drop_pd->o_desk, "e,action,drag,out", "e"); p->active_drop_pd = pd; }
false
false
false
false
false
0
incrByU32(U64 * pu64, unsigned int u32) { uint32_t tmp; tmp = pu64->low; pu64->low = (uint32_t)(tmp + u32); if (pu64->low < tmp) pu64->high = (uint32_t)(pu64->high + 1); }
false
false
false
false
false
0
test_network_remote_local__shorthand_fetch_refspec1(void) { char *refspec_strings[] = { "master", "hard_tag", }; git_strarray array = { refspec_strings, 2, }; git_reference *ref; connect_to_local_repository(cl_fixture("testrepo.git")); git_remote_clear_refspecs(remote); cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); cl_git_fail(git_reference_lookup(&ref, repo, "refs/tags/hard_tag")); }
false
false
false
false
false
0
test_correctness(int n) { int istride, ostride, howmany; fftw_plan validated_plan_forward, validated_plan_backward; WHEN_VERBOSE(1, printf("Testing correctness for n = %d...", n); fflush(stdout)); /* produce a *good* plan (validated by Ergun's test procedure) */ validated_plan_forward = fftw_create_plan(n, FFTW_FORWARD, measure_flag | wisdom_flag); validated_plan_backward = fftw_create_plan(n, FFTW_BACKWARD, measure_flag | wisdom_flag); CHECK(validated_plan_forward != NULL, "can't create plan"); CHECK(validated_plan_backward != NULL, "can't create plan"); for (istride = 1; istride <= MAX_STRIDE; ++istride) for (ostride = 1; ostride <= MAX_STRIDE; ++ostride) for (howmany = 1; howmany <= MAX_HOWMANY; ++howmany) test_out_of_place_both(n, istride, ostride, howmany, validated_plan_forward, validated_plan_backward); for (istride = 1; istride <= MAX_STRIDE; ++istride) for (howmany = 1; howmany <= MAX_HOWMANY; ++howmany) test_in_place_both(n, istride, howmany, validated_plan_forward, validated_plan_backward); fftw_destroy_plan(validated_plan_forward); fftw_destroy_plan(validated_plan_backward); if (!(wisdom_flag & FFTW_USE_WISDOM) && chk_mem_leak) fftw_check_memory_leaks(); WHEN_VERBOSE(1, printf("OK\n")); }
false
false
false
false
false
0
putString(const char *stringVal, const Uint32 stringLen) { errorFlag = EC_Normal; /* determine VM of the string */ unsigned long vm = DcmElement::determineVM(stringVal, stringLen); if (vm > 0) { const DcmEVR evr = getTag().getEVR(); Uint8 *byteField = NULL; Uint16 *wordField = NULL; /* create new value field */ if (evr == EVR_OW || evr == EVR_lt) wordField = new Uint16[vm]; else byteField = new Uint8[vm]; Uint16 intVal = 0; OFString value; size_t pos = 0; /* retrieve binary data from hexa-decimal string */ for (unsigned long i = 0; (i < vm) && errorFlag.good(); i++) { /* get specified value from multi-valued string */ pos = DcmElement::getValueFromString(stringVal, pos, stringLen, value); if (!value.empty()) { /* integer overflow is currently not checked! */ if (sscanf(value.c_str(), "%hx", &intVal) != 1) errorFlag = EC_CorruptedData; else if (evr == EVR_OW || evr == EVR_lt) wordField[i] = OFstatic_cast(Uint16, intVal); else byteField[i] = OFstatic_cast(Uint8, intVal); } else errorFlag = EC_CorruptedData; } /* set binary data as the element value */ if (errorFlag.good()) { if (evr == EVR_OW || evr == EVR_lt) errorFlag = putUint16Array(wordField, vm); else errorFlag = putUint8Array(byteField, vm); } /* delete temporary buffers */ delete[] byteField; delete[] wordField; } else putValue(NULL, 0); return errorFlag; }
false
false
false
false
false
0
s48_extract_af(s48_call_t call, s48_ref_t sch_af_val) { long af_val = s48_extract_long_2(call, sch_af_val); if (af_val > 100) /* unknown address family */ return af_val - 100; else switch (af_val) { case 0: return AF_INET; case 1: return AF_INET6; case 2: return AF_UNIX; case 3 : return AF_UNSPEC; } }
false
false
false
false
false
0
ungrab_time(void) { Time t = event_time(); if (grab_time == CurrentTime || !(t == CurrentTime || event_time_after(t, grab_time))) /* When the time moves backward on the server, then we can't use the grab time because that will be in the future. So instead we have to use CurrentTime. "XUngrabPointer does not release the pointer if the specified time is earlier than the last-pointer-grab time or is later than the current X server time." */ t = CurrentTime; /*grab_time;*/ return t; }
false
false
false
false
false
0
find_and_add_ghkm_phrase(const vector<pair<int,int> >& regions, int startR, int endR, const string& tag,int predicate_index){ /* * do this iteratively: * 1. Initialize the source side phrase, covering the all the regions * 2. Determine the minimal target side phrase, using the alignment information * 3. Check the target side phrase, if all its alignment falls in the source side phrase, add the newly extracted * 4. Otherwise, add the propose the new phrase boundary, which covers all words the target side aligns to. * 5. If the boundary exceed the adjacent regions, return fasle * 6. Continue to step 2 */ int sbound_l = regions[startR].first, sbound_r = regions[endR].second; int tbound_l, tbound_r, sbound_lm, sbound_rm, sbound_nl, sbound_nr; const Alignment& aln = *align_; sbound_lm = startR == 0 ? 0 : regions[startR - 1].second + 1; // sbound_lm is inclusive and rm is exclusive sbound_rm = endR == ((int)regions.size()) -1 ? (int)sent_->english().length() : regions[endR + 1].first; for(;;){ int l = sent_->french().length(), r = -1; for(int i = sbound_l ; i<=sbound_r; i++){ for(set<int>::iterator it = aln.AlignedToFrench(i).begin(); it != aln.AlignedToFrench(i).end(); it++){ if(*it > r) r = *it; if(*it < l) l = *it; } } if(r<l) return false; // nothing added because not a single alignment is seen tbound_l = l; tbound_r = r; l = sbound_l, r = sbound_r; for (int i = tbound_l; i <= tbound_r; i++) { for (set<int>::iterator it = aln.AlignedToEnglish(i).begin(); it != aln.AlignedToEnglish(i).end(); it++) { if (*it > r) r = *it; if (*it < l) l = *it; } } sbound_nl = l; sbound_nr = r; if(sbound_nl >= sbound_l && sbound_nr <= sbound_r){ // An allowed add_ghkm_phrase(tbound_l, sbound_l,tbound_r,sbound_r,tag, predicate_index); //cerr << "ADDED ONE: " << sbound_l << "," <<tbound_l<< ","<<sbound_r<< ","<<tbound_r<< "," << tag << endl; return true; } // otherwise, check if we can extend? if(sbound_nl < sbound_lm || sbound_nr >= sbound_rm){ // no we cannot return false; } sbound_l = sbound_nl; sbound_r = sbound_nr; } cerr << "You should not be here dude!" << endl ; return false; }
false
false
false
false
false
0
RecordX86Relocation(MachObjectWriter *Writer, const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) { unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind()); unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind()); // If this is a 32-bit TLVP reloc it's handled a bit differently. if (Target.getSymA() && Target.getSymA()->getKind() == MCSymbolRefExpr::VK_TLVP) { RecordTLVPRelocation(Writer, Asm, Layout, Fragment, Fixup, Target, FixedValue); return; } // If this is a difference or a defined symbol plus an offset, then we need a // scattered relocation entry. Differences always require scattered // relocations. if (Target.getSymB()) return RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target, Log2Size, FixedValue); // Get the symbol data, if any. MCSymbolData *SD = 0; if (Target.getSymA()) SD = &Asm.getSymbolData(Target.getSymA()->getSymbol()); // If this is an internal relocation with an offset, it also needs a scattered // relocation entry. uint32_t Offset = Target.getConstant(); if (IsPCRel) Offset += 1 << Log2Size; if (Offset && SD && !Writer->doesSymbolRequireExternRelocation(SD)) return RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target, Log2Size, FixedValue); // See <reloc.h>. uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned Index = 0; unsigned IsExtern = 0; unsigned Type = 0; if (Target.isAbsolute()) { // constant // SymbolNum of 0 indicates the absolute section. // // FIXME: Currently, these are never generated (see code below). I cannot // find a case where they are actually emitted. Type = macho::RIT_Vanilla; } else { // Resolve constant variables. if (SD->getSymbol().isVariable()) { int64_t Res; if (SD->getSymbol().getVariableValue()->EvaluateAsAbsolute( Res, Layout, Writer->getSectionAddressMap())) { FixedValue = Res; return; } } // Check whether we need an external or internal relocation. if (Writer->doesSymbolRequireExternRelocation(SD)) { IsExtern = 1; Index = SD->getIndex(); // For external relocations, make sure to offset the fixup value to // compensate for the addend of the symbol address, if it was // undefined. This occurs with weak definitions, for example. if (!SD->Symbol->isUndefined()) FixedValue -= Layout.getSymbolOffset(SD); } else { // The index is the section ordinal (1-based). const MCSectionData &SymSD = Asm.getSectionData( SD->getSymbol().getSection()); Index = SymSD.getOrdinal() + 1; FixedValue += Writer->getSectionAddress(&SymSD); } if (IsPCRel) FixedValue -= Writer->getSectionAddress(Fragment->getParent()); Type = macho::RIT_Vanilla; } // struct relocation_info (8 bytes) macho::RelocationEntry MRE; MRE.Word0 = FixupOffset; MRE.Word1 = ((Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (IsExtern << 27) | (Type << 28)); Writer->addRelocation(Fragment->getParent(), MRE); }
false
false
false
true
false
1
operator=(const char * position) { if (!sync ()) return; if (static_cast<unsigned>(position- m_utfbuf) > m_strbuf->byteLength ()) { m_utfptr = m_utfbuf + m_strbuf->byteLength (); } else { m_utfptr = position; } }
false
false
false
false
false
0
get_priority(char *path, unsigned int *priority) { char *p; if ((p = strrchr(path, (int) '.')) == NULL) return(-1); if (strnum(p + 1, STRNUM_UI, priority) == -1) return(-1); return(0); }
false
false
false
false
false
0
dc1394_MONO16_to_MONO8(uint8_t *restrict src, uint8_t *restrict dest, uint32_t width, uint32_t height, uint32_t bits) { register int i = ((width*height)<<1)-1; register int j = (width*height)-1; register int y; while (i >= 0) { y = src[i--]; dest[j--] = (y + (src[i--]<<8))>>(bits-8); } return DC1394_SUCCESS; }
false
false
false
false
false
0
s_pack_into(PyObject *self, PyObject *args) { PyStructObject *soself; char *buffer; Py_ssize_t buffer_len, offset; /* Validate arguments. +1 is for the first arg as buffer. */ soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); if (PyTuple_GET_SIZE(args) != (soself->s_len + 2)) { if (PyTuple_GET_SIZE(args) == 0) { PyErr_Format(StructError, "pack_into expected buffer argument"); } else if (PyTuple_GET_SIZE(args) == 1) { PyErr_Format(StructError, "pack_into expected offset argument"); } else { PyErr_Format(StructError, "pack_into expected %zd items for packing (got %zd)", soself->s_len, (PyTuple_GET_SIZE(args) - 2)); } return NULL; } /* Extract a writable memory buffer from the first argument */ if ( PyObject_AsWriteBuffer(PyTuple_GET_ITEM(args, 0), (void**)&buffer, &buffer_len) == -1 ) { return NULL; } assert( buffer_len >= 0 ); /* Extract the offset from the first argument */ offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError); if (offset == -1 && PyErr_Occurred()) return NULL; /* Support negative offsets. */ if (offset < 0) offset += buffer_len; /* Check boundaries */ if (offset < 0 || (buffer_len - offset) < soself->s_size) { PyErr_Format(StructError, "pack_into requires a buffer of at least %zd bytes", soself->s_size); return NULL; } /* Call the guts */ if ( s_pack_internal(soself, args, 2, buffer + offset) != 0 ) { return NULL; } Py_RETURN_NONE; }
false
false
false
false
true
1
efs_readdir(struct file *file, struct dir_context *ctx) { struct inode *inode = file_inode(file); efs_block_t block; int slot; if (inode->i_size & (EFS_DIRBSIZE-1)) pr_warn("%s(): directory size not a multiple of EFS_DIRBSIZE\n", __func__); /* work out where this entry can be found */ block = ctx->pos >> EFS_DIRBSIZE_BITS; /* each block contains at most 256 slots */ slot = ctx->pos & 0xff; /* look at all blocks */ while (block < inode->i_blocks) { struct efs_dir *dirblock; struct buffer_head *bh; /* read the dir block */ bh = sb_bread(inode->i_sb, efs_bmap(inode, block)); if (!bh) { pr_err("%s(): failed to read dir block %d\n", __func__, block); break; } dirblock = (struct efs_dir *) bh->b_data; if (be16_to_cpu(dirblock->magic) != EFS_DIRBLK_MAGIC) { pr_err("%s(): invalid directory block\n", __func__); brelse(bh); break; } for (; slot < dirblock->slots; slot++) { struct efs_dentry *dirslot; efs_ino_t inodenum; const char *nameptr; int namelen; if (dirblock->space[slot] == 0) continue; dirslot = (struct efs_dentry *) (((char *) bh->b_data) + EFS_SLOTAT(dirblock, slot)); inodenum = be32_to_cpu(dirslot->inode); namelen = dirslot->namelen; nameptr = dirslot->name; pr_debug("%s(): block %d slot %d/%d: inode %u, name \"%s\", namelen %u\n", __func__, block, slot, dirblock->slots-1, inodenum, nameptr, namelen); if (!namelen) continue; /* found the next entry */ ctx->pos = (block << EFS_DIRBSIZE_BITS) | slot; /* sanity check */ if (nameptr - (char *) dirblock + namelen > EFS_DIRBSIZE) { pr_warn("directory entry %d exceeds directory block\n", slot); continue; } /* copy filename and data in dirslot */ if (!dir_emit(ctx, nameptr, namelen, inodenum, DT_UNKNOWN)) { brelse(bh); return 0; } } brelse(bh); slot = 0; block++; } ctx->pos = (block << EFS_DIRBSIZE_BITS) | slot; return 0; }
false
false
false
false
false
0
f_sec(int count, VALUE **vals) { VALUE result; VALUE tmp; NUMBER *err; /* initialize VALUEs */ result.v_subtype = V_NOSUBTYPE; tmp.v_subtype = V_NOSUBTYPE; err = conf->epsilon; if (count == 2) { if (vals[1]->v_type != V_NUM || qiszero(vals[1]->v_num)) return error_value(E_SEC1); err = vals[1]->v_num; } switch (vals[0]->v_type) { case V_NUM: result.v_num = qsec(vals[0]->v_num, err); result.v_type = V_NUM; break; case V_COM: tmp.v_type = V_COM; tmp.v_com = c_cos(vals[0]->v_com, err); invertvalue(&tmp, &result); comfree(tmp.v_com); break; default: return error_value(E_SEC2); } return result; }
false
false
false
false
false
0
draw_vline (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint y1, gint y2, gint x) { BluecurveStyle *bluecurve_style = BLUECURVE_STYLE (style); gint thickness_light; gint thickness_dark; g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); thickness_light = style->xthickness / 2; thickness_dark = style->xthickness - thickness_light; if (area) { gdk_gc_set_clip_rectangle (bluecurve_style->gray_gc[2], area); } gdk_draw_line (window, style->dark_gc[state_type], x, y1, x, y2 - 1); if (area) { gdk_gc_set_clip_rectangle (bluecurve_style->gray_gc[2], NULL); } }
false
false
false
false
false
0
readyToRead(int fd) { fd_set readfds; struct timeval zeroTimeout = {0, 0}; /* Zero: will use to poll, not wait.*/ FD_ZERO(&readfds); FD_SET(fd, &readfds); select(fd + 1, &readfds, NULL, NULL, &zeroTimeout); return FD_ISSET(fd, &readfds); }
false
false
false
false
false
0
ftp_lite_get_response( struct ftp_lite_server *s, int accept_note, char *buffer ) { int c; char dash; int result; int response; int fields; int do_message = 0; while(1) { switch(s->authtype) { case PLAIN: result = ftp_lite_get_response_raw(s,buffer); break; case GLOBUS_GSS: /* Depending on the server, some responses are encrypted and some are not, even once the secure channel has been established. */ do { errno = 0; c = fgetc(s->response); } while(c==EOF && errno==EINTR); ungetc(c,s->response); if(!isdigit(c)) { result = 0; errno = ECONNRESET; } else if(c=='6') { result = ftp_lite_get_response_gss(s,buffer); } else { result = ftp_lite_get_response_raw(s,buffer); } break; default: errno = ENOTSUP; return 0; } if(!result) return 0; string_chomp(buffer); debug(D_FTP,"%s %s\n",s->hostname,buffer); if(!isdigit((int)(buffer[0]))) continue; fields = sscanf(buffer,"%d%c",&response,&dash); if(fields!=2) { continue; } else { if( do_message ) { if( (dash==' ') && (response==do_message) ) { do_message = 0; } else { continue; } } else { if( dash=='-' ) { do_message = response; continue; } } if( (response/100)==1 ) { if(accept_note) { return response; } else { continue; } } else { return response; } } } return response; }
false
false
false
false
false
0
textWidth(const char * const text, unsigned int size) const { if (text == 0 || m_fontstruct == 0) return 0; // check rotated font? if (m_rotfont != 0) return rotTextWidth(text, size); return XTextWidth(m_fontstruct, text, size); }
false
false
false
false
false
0
sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host) { struct rtsx_pcr *pcr = host->pcr; int err; u8 stat, mask, val; /* Wait 1.8V output of voltage regulator in card stable */ msleep(50); /* Toggle SD clock again */ err = rtsx_pci_write_register(pcr, SD_BUS_STAT, 0xFF, SD_CLK_TOGGLE_EN); if (err < 0) return err; /* Wait for a period of time so that the card can drive * SD_DAT[3:0] to high at 1.8V */ msleep(20); /* SD_CMD, SD_DAT[3:0] should be pulled high by host */ err = rtsx_pci_read_register(pcr, SD_BUS_STAT, &stat); if (err < 0) return err; mask = SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | SD_DAT1_STATUS | SD_DAT0_STATUS; val = SD_CMD_STATUS | SD_DAT3_STATUS | SD_DAT2_STATUS | SD_DAT1_STATUS | SD_DAT0_STATUS; if ((stat & mask) != val) { dev_dbg(sdmmc_dev(host), "%s: SD_BUS_STAT = 0x%x\n", __func__, stat); rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, 0); rtsx_pci_write_register(pcr, CARD_CLK_EN, 0xFF, 0); return -EINVAL; } return 0; }
false
false
false
false
false
0
free_NCList(void) { if(numfiles > 0) return; /* not empty */ if(nc_filelist != NULL) free(nc_filelist); nc_filelist = NULL; }
false
false
false
false
false
0
add_tunnel(String namein, String nameout) { Hookup hin(get_element(namein, TUNNEL_TYPE), 0); Hookup hout(get_element(nameout, TUNNEL_TYPE), 0); bool ok = true; if (_c->_elements[hin.idx] != TUNNEL_TYPE) { redeclaration_error(_errh, "element", namein, landmark(), _c->_element_landmarks[hin.idx]); ok = false; } if (_c->_elements[hout.idx] != TUNNEL_TYPE) { redeclaration_error(_errh, "element", nameout, landmark(), _c->_element_landmarks[hout.idx]); ok = false; } if (_definputs && _definputs->find(hin)) { redeclaration_error(_errh, "connection tunnel input", namein, landmark(), _c->_element_landmarks[hin.idx]); ok = false; } if (_defoutputs && _defoutputs->find(hout)) { redeclaration_error(_errh, "connection tunnel output", nameout, landmark(), _c->_element_landmarks[hout.idx]); ok = false; } if (ok) { _definputs = new TunnelEnd(hin, false, _definputs); _defoutputs = new TunnelEnd(hout, true, _defoutputs); _definputs->pair_with(_defoutputs); } }
false
false
false
false
false
0
mmc_eject_media( const CdIo_t *p_cdio ) { int i_status = 0; i_status = mmc_prevent_allow_medium_removal(p_cdio, false, false, 0); if (0 != i_status) return i_status; return mmc_start_stop_unit(p_cdio, true, false, 0, 0); }
false
false
false
false
false
0
yytnamerr_ (const char *yystr) { if (*yystr == '"') { std::string yyr = ""; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: yyr += *yyp; break; case '"': return yyr; } do_not_strip_quotes: ; } return yystr; }
false
false
false
false
false
0
find_tree_node(const char *name, int modid) { struct tree *tp, *headtp; int count, *int_p; if (!name || !*name) return (NULL); headtp = tbuckets[NBUCKET(name_hash(name))]; for (tp = headtp; tp; tp = tp->next) { if (tp->label && !label_compare(tp->label, name)) { if (modid == -1) /* Any module */ return (tp); for (int_p = tp->module_list, count = 0; count < tp->number_modules; ++count, ++int_p) if (*int_p == modid) return (tp); } } return (NULL); }
false
false
false
false
false
0
_bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab) { bfd_size_type idx; for (idx = 1; idx < tab->size; ++idx) tab->array[idx]->refcount = 0; }
false
false
false
false
false
0
opt_fn(__isl_take isl_point *pnt, void *user) { struct isl_opt_data *data = (struct isl_opt_data *)user; isl_val *val; val = isl_qpolynomial_eval(isl_qpolynomial_copy(data->qp), pnt); if (data->first) { data->first = 0; data->opt = val; } else if (data->max) { data->opt = isl_val_max(data->opt, val); } else { data->opt = isl_val_min(data->opt, val); } return 0; }
false
false
false
false
false
0
EmitSigned(int64_t Value) { DU.addSInt(DIE, dwarf::DW_FORM_sdata, Value); }
false
false
false
false
false
0
describe_signed_constant (gint64 value) { gchar *desc; if (value == G_MAXINT) desc = g_strdup ("G_MAXINT"); else if (value == G_MININT) desc = g_strdup ("G_MININT"); else if (value == G_MAXUINT) desc = g_strdup ("G_MAXUINT"); else if (value == G_MAXLONG) desc = g_strdup ("G_MAXLONG"); else if (value == G_MINLONG) desc = g_strdup ("G_MINLONG"); else if (value == G_MAXULONG) desc = g_strdup ("G_MAXULONG"); else if (value == G_MAXINT64) desc = g_strdup ("G_MAXINT64"); else if (value == G_MININT64) desc = g_strdup ("G_MININT64"); else desc = g_strdup_printf ("%" G_GINT64_FORMAT, value); return desc; }
false
false
false
false
false
0
case_6_7_helper(struct connection_data *conn, int color) { struct heap_entry *data = conn->heap[0]; int pos = data->coming_from; int apos = data->target; int other = OTHER_COLOR(color); if (ladder_capturable(apos, other)) ENQUEUE(conn, pos, apos, data->distance, FP(0.6), apos, NO_MOVE); else { int this_delta = FP(0.85) + FP(0.05) * gg_min(approxlib(apos, other, 5, NULL), 5); ENQUEUE(conn, pos, apos, data->distance + this_delta - FP(0.6), this_delta, NO_MOVE, NO_MOVE); } }
false
false
false
false
false
0
select_g_ba_get_dims(void) { uint32_t plugin_id; if (slurm_select_init(0) < 0) return NULL; if (working_cluster_rec) plugin_id = working_cluster_rec->plugin_id_select; else plugin_id = select_context_default; return (*(ops[plugin_id].ba_get_dims))(); }
false
false
false
false
false
0
abituguru3_update_device(struct device *dev) { int i; struct abituguru3_data *data = dev_get_drvdata(dev); mutex_lock(&data->update_lock); if (!data->valid || time_after(jiffies, data->last_updated + HZ)) { /* Clear data->valid while updating */ data->valid = 0; /* Read alarms */ if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK, ABIT_UGURU3_ALARMS_START, 1, data->alarms, 48/8) != (48/8)) goto LEAVE_UPDATE; /* Read in and temp sensors (3 byte settings / sensor) */ for (i = 0; i < 32; i++) { if (abituguru3_read(data, ABIT_UGURU3_SENSORS_BANK, ABIT_UGURU3_VALUES_START + i, 1, &data->value[i]) != 1) goto LEAVE_UPDATE; if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK, ABIT_UGURU3_SETTINGS_START + i * 3, 1, data->settings[i], 3) != 3) goto LEAVE_UPDATE; } /* Read temp sensors (2 byte settings / sensor) */ for (i = 0; i < 16; i++) { if (abituguru3_read(data, ABIT_UGURU3_SENSORS_BANK, ABIT_UGURU3_VALUES_START + 32 + i, 1, &data->value[32 + i]) != 1) goto LEAVE_UPDATE; if (abituguru3_read_increment_offset(data, ABIT_UGURU3_SETTINGS_BANK, ABIT_UGURU3_SETTINGS_START + 32 * 3 + i * 2, 1, data->settings[32 + i], 2) != 2) goto LEAVE_UPDATE; } data->last_updated = jiffies; data->valid = 1; } LEAVE_UPDATE: mutex_unlock(&data->update_lock); if (data->valid) return data; else return NULL; }
false
false
false
false
false
0
parse_flav ( char c, enum FLAVOUR * flav ) { switch( c ) { case 'H': case 'P': case 'R': case 's': case 'U': case 'x': case 'X': if ( * flav == SILENT ) * flav = c; return 1; break; default: return 0; } }
false
false
false
false
false
0
file_write(ang_file *f, const char *buf, size_t n) { int fd = fileno(f->fh); #ifndef SET_UID while (n >= WRITE_BUF_SIZE) { if (write(fd, buf, WRITE_BUF_SIZE) != WRITE_BUF_SIZE) return FALSE; buf += WRITE_BUF_SIZE; n -= WRITE_BUF_SIZE; } #endif /* !SET_UID */ if (write(fd, buf, n) != (int)n) return FALSE; return TRUE; }
false
false
false
false
false
0
long_desc_cb(unsigned UNUSED n, const H5E_error2_t *err_desc, void *client_data) { char *real_desc = (char *)client_data; if(err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0) return(0); else return(-1); }
false
false
false
false
false
0
set_section_addresses(Symbol_table*, Layout*, uint64_t* dot_value, uint64_t*, uint64_t* load_address) { typedef std::list<Output_section::Input_section> Input_section_list; bool have_load_address = *load_address != *dot_value; uint64_t address = *dot_value; address = align_address(address, this->os_->addralign()); // If input section sorting is requested via --section-ordering-file or // linker plugins, then do it here. This is important because we want // any sorting specified in the linker scripts, which will be done after // this, to take precedence. The final order of input sections is then // guaranteed to be according to the linker script specification. if (this->os_ != NULL && this->os_->input_section_order_specified()) this->os_->sort_attached_input_sections(); // For a relocatable link, all orphan sections are put at // address 0. In general we expect all sections to be at // address 0 for a relocatable link, but we permit the linker // script to override that for specific output sections. if (parameters->options().relocatable()) { address = 0; *load_address = 0; have_load_address = false; } if ((this->os_->flags() & elfcpp::SHF_ALLOC) != 0) { this->os_->set_address(address); if (have_load_address) this->os_->set_load_address(align_address(*load_address, this->os_->addralign())); } Input_section_list input_sections; address += this->os_->get_input_sections(address, "", &input_sections); for (Input_section_list::iterator p = input_sections.begin(); p != input_sections.end(); ++p) { uint64_t addralign = p->addralign(); if (!p->is_input_section()) p->output_section_data()->finalize_data_size(); uint64_t size = p->data_size(); address = align_address(address, addralign); this->os_->add_script_input_section(*p); address += size; } if (parameters->options().relocatable()) { // For a relocatable link, reset DOT_VALUE to 0. *dot_value = 0; *load_address = 0; } else if (this->os_ == NULL || (this->os_->flags() & elfcpp::SHF_TLS) == 0 || this->os_->type() != elfcpp::SHT_NOBITS) { // An SHF_TLS/SHT_NOBITS section does not take up any address space. if (!have_load_address) *load_address = address; else *load_address += address - *dot_value; *dot_value = address; } }
false
false
false
false
false
0
ensure_polling (UDisksLinuxMDRaid *mdraid, gboolean polling_on) { if (polling_on) { if (mdraid->polling_timeout == 0) { mdraid->polling_timeout = g_timeout_add_seconds (1, on_polling_timout, mdraid); } } else { if (mdraid->polling_timeout != 0) { g_source_remove (mdraid->polling_timeout); mdraid->polling_timeout = 0; } } }
false
false
false
false
false
0
win_alloc_aucmd_win() { aucmd_win = win_alloc(NULL, TRUE); if (aucmd_win != NULL) { win_init_some(aucmd_win, curwin); RESET_BINDING(aucmd_win); new_frame(aucmd_win); } }
false
false
false
false
false
0
FindExtensionByName(const string& key) const { Symbol result = file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); if (!result.IsNull() && result.field_descriptor->is_extension()) { return result.field_descriptor; } else { return NULL; } }
false
false
false
false
false
0
_bt_delitems_vacuum(Relation rel, Buffer buf, OffsetNumber *itemnos, int nitems, BlockNumber lastBlockVacuumed) { Page page = BufferGetPage(buf); BTPageOpaque opaque; /* No ereport(ERROR) until changes are logged */ START_CRIT_SECTION(); /* Fix the page */ if (nitems > 0) PageIndexMultiDelete(page, itemnos, nitems); /* * We can clear the vacuum cycle ID since this page has certainly been * processed by the current vacuum scan. */ opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque->btpo_cycleid = 0; /* * Mark the page as not containing any LP_DEAD items. This is not * certainly true (there might be some that have recently been marked, but * weren't included in our target-item list), but it will almost always be * true and it doesn't seem worth an additional page scan to check it. * Remember that BTP_HAS_GARBAGE is only a hint anyway. */ opaque->btpo_flags &= ~BTP_HAS_GARBAGE; MarkBufferDirty(buf); /* XLOG stuff */ if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; xl_btree_vacuum xlrec_vacuum; xlrec_vacuum.lastBlockVacuumed = lastBlockVacuumed; XLogBeginInsert(); XLogRegisterBuffer(0, buf, REGBUF_STANDARD); XLogRegisterData((char *) &xlrec_vacuum, SizeOfBtreeVacuum); /* * The target-offsets array is not in the buffer, but pretend that it * is. When XLogInsert stores the whole buffer, the offsets array * need not be stored too. */ if (nitems > 0) XLogRegisterBufData(0, (char *) itemnos, nitems * sizeof(OffsetNumber)); recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_VACUUM); PageSetLSN(page, recptr); } END_CRIT_SECTION(); }
false
false
false
false
false
0
read(reg8 offset) { switch (offset) { case 0x19: return potx.readPOT(); case 0x1a: return poty.readPOT(); case 0x1b: return voice[2].wave.readOSC(); case 0x1c: return voice[2].envelope.readENV(); default: return bus_value; } }
false
false
false
false
false
0
usage(int err) /* print syntax & exit */ { FILE* o = stdout; if(err) { o = stderr; fprintf(o, "You made some mistake in program usage... let me briefly remind you:\n\n"); } print_title(o); fprintf(o,"\nusage: %s [option(s)] [file(s) | URL(s) | -]\n", prgName); fprintf(o,"supported options [defaults in brackets]:\n"); fprintf(o," -v increase verbosity level -q quiet (don't print title)\n"); fprintf(o," -t testmode (no output) -s write to stdout\n"); fprintf(o," -w <filename> write Output as WAV file\n"); fprintf(o," -k n skip first n frames [0] -n n decode only n frames [all]\n"); fprintf(o," -c check range violations -y DISABLE resync on errors\n"); fprintf(o," -b n output buffer: n Kbytes [0] -f n change scalefactor [%li]\n", param.outscale); fprintf(o," -r n set/force samplerate [auto]\n"); fprintf(o," -os,-ol,-oh output to built-in speaker,line-out connector,headphones\n"); #ifdef NAS fprintf(o," -a d set NAS server\n"); #elif defined(SGI) fprintf(o," -a [1..4] set RAD device\n"); #else fprintf(o," -a d set audio device\n"); #endif fprintf(o," -2 downsample 1:2 (22 kHz) -4 downsample 1:4 (11 kHz)\n"); fprintf(o," -d n play every n'th frame only -h n play every frame n times\n"); fprintf(o," -0 decode channel 0 (left) only -1 decode channel 1 (right) only\n"); fprintf(o," -m mix both channels (mono) -p p use HTTP proxy p [$HTTP_PROXY]\n"); #ifdef HAVE_SCHED_SETSCHEDULER fprintf(o," -@ f read filenames/URLs from f -T get realtime priority\n"); #else fprintf(o," -@ f read filenames/URLs from f\n"); #endif fprintf(o," -z shuffle play (with wildcards) -Z random play\n"); fprintf(o," -u a HTTP authentication string -E f Equalizer, data from file\n"); fprintf(o," -C enable control keys --no-gapless not skip junk/padding in mp3s\n"); fprintf(o," -? this help --version print name + version\n"); fprintf(o,"See the manpage %s(1) or call %s with --longhelp for more parameters and information.\n", prgName,prgName); safe_exit(err); }
false
false
false
false
false
0
eel_canvas_item_accessible_initialize (AtkObject *obj, gpointer data) { if (ATK_OBJECT_CLASS (accessible_item_parent_class)->initialize != NULL) ATK_OBJECT_CLASS (accessible_item_parent_class)->initialize (obj, data); g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_MDI)); }
false
false
false
false
false
0
gm_world_log_allowed(GmWorld *world, GmLogType type) { GmOptions *options = gm_app_options(gm_app_instance()); if (!gm_options_get_int(options, "logging_enable")) { return FALSE; } if (gm_options_get_int(world->priv->options, "logging_override")) { options = world->priv->options; } switch (type) { case LOG_IN: return gm_options_get_int(options, "logging_in"); break; case LOG_OUT: return gm_options_get_int(options, "logging_out"); break; case LOG_STATUS: return gm_options_get_int(options, "logging_status"); break; case LOG_MCP_IN: return gm_options_get_int(options, "logging_mcp_in"); break; case LOG_MCP_OUT: return gm_options_get_int(options, "logging_mcp_out"); break; case LOG_MCP_STATUS: return gm_options_get_int(options, "logging_mcp_status"); break; default: return FALSE; break; } }
false
false
false
false
false
0
gupnp_context_set_default_language (GUPnPContext *context, const char *language) { g_return_if_fail (GUPNP_IS_CONTEXT (context)); g_return_if_fail (language != NULL); char *old_language = context->priv->default_language; if ((old_language != NULL) && (!strcmp (language, old_language))) return; context->priv->default_language = g_strdup (language); g_list_foreach (context->priv->host_path_datas, (GFunc) host_path_data_set_language, (gpointer) language); if (old_language != NULL) g_free (old_language); }
false
false
false
false
false
0
H1_norm_uh_d(const QUAD *quad, const DOF_REAL_D_VEC *u_h) { FUNCNAME("H1_norm_uh_d"); EVAL_TRAVERSE_DATA td[1] = {{0}}; int deg; if (!(td->uh_d = u_h)) { ERROR("no DOF vector u_h; returning 0.0\n"); return(0.0); } if (!quad) { deg = 2*td->uh_d->fe_space->bas_fcts->degree-2; quad = get_quadrature(td->uh_d->fe_space->mesh->dim, deg); } td->quad_fast = get_quad_fast(td->uh_d->fe_space->bas_fcts, quad, INIT_GRD_PHI); td->get_real_d_vec = td->uh_d->fe_space->bas_fcts->get_real_d_vec; td->norm = 0.0; mesh_traverse(td->uh_d->fe_space->mesh, -1, CALL_LEAF_EL|FILL_COORDS, H1_norm_uh_d_fct, td); return(sqrt(td->norm)); }
false
false
false
false
false
0
Find_filename_match(T_Fileselector *list, char * fname) { short best_match; T_Fileselector_item * current_item; short item_number; byte matching_letters=0; byte counter; best_match=-1; item_number=0; for (current_item=list->First; current_item!=NULL; current_item=current_item->Next) { if ( (!Config.Find_file_fast) || (Config.Find_file_fast==(current_item->Type+1)) ) { // On compare et si c'est mieux, on stocke dans Meilleur_nom for (counter=0; fname[counter]!='\0' && tolower(current_item->Full_name[counter])==tolower(fname[counter]); counter++); if (counter>matching_letters) { matching_letters=counter; best_match=item_number; } } item_number++; } return best_match; }
false
false
false
false
false
0
check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { struct _mesa_prim prim; struct _mesa_index_buffer ib; GLuint min, max; /* Only the X Server needs to do this -- otherwise, accessing outside * array/BO bounds allows application termination. */ if (!ctx->Const.CheckArrayBounds) return GL_TRUE; memset(&prim, 0, sizeof(prim)); prim.count = count; memset(&ib, 0, sizeof(ib)); ib.type = type; ib.ptr = indices; ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1); if ((int)(min + basevertex) < 0 || max + basevertex >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement); return GL_FALSE; } return GL_TRUE; }
false
false
false
false
false
0
cl_commlib_set_global_param(cl_global_settings_params_t parameter, cl_bool_t value) { pthread_mutex_lock(&cl_com_global_settings_mutex); switch(parameter) { case CL_COMMLIB_DELAYED_LISTEN: { cl_com_global_settings.delayed_listen = value; break; } } pthread_mutex_unlock(&cl_com_global_settings_mutex); return CL_RETVAL_OK; }
false
false
false
false
false
0
chd_ph_config_destroy(cmph_config_t *mph) { chd_ph_config_data_t *data = (chd_ph_config_data_t *) mph->data; DEBUGP("Destroying algorithm dependent data\n"); if(data->occup_table) { free(data->occup_table); data->occup_table = NULL; } free(data); }
false
false
false
false
false
0
hpi_outstream_get_info_ex(u32 h_outstream, u16 *pw_state, u32 *pbuffer_size, u32 *pdata_to_play, u32 *psamples_played, u32 *pauxiliary_data_to_play) { struct hpi_message hm; struct hpi_response hr; hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, HPI_OSTREAM_GET_INFO); if (hpi_handle_indexes(h_outstream, &hm.adapter_index, &hm.obj_index)) return HPI_ERROR_INVALID_HANDLE; hpi_send_recv(&hm, &hr); if (pw_state) *pw_state = hr.u.d.u.stream_info.state; if (pbuffer_size) *pbuffer_size = hr.u.d.u.stream_info.buffer_size; if (pdata_to_play) *pdata_to_play = hr.u.d.u.stream_info.data_available; if (psamples_played) *psamples_played = hr.u.d.u.stream_info.samples_transferred; if (pauxiliary_data_to_play) *pauxiliary_data_to_play = hr.u.d.u.stream_info.auxiliary_data_available; return hr.error; }
false
false
false
false
false
0
gl_merge_vcard_get_record (glMerge *merge) { glMergeVCard *merge_vcard; glMergeRecord *record; EContactField field_id; glMergeField *field; char *vcard; EContact *contact; merge_vcard = GL_MERGE_VCARD (merge); vcard = parse_next_vcard(merge_vcard->priv->fp); if (vcard == NULL || vcard[0] == '\0') { return NULL; /* EOF */ } contact = e_contact_new_from_vcard(vcard); if (contact == NULL) { return NULL; /* invalid vcard */ } record = g_new0 (glMergeRecord, 1); record->select_flag = TRUE; /* Take the interesting fields one by one from the contact, and put them * into the glMergeRecord structure. When done, free up the resources for * that contact */ for ( field_id = E_CONTACT_FIELD_FIRST; field_id <= E_CONTACT_LAST_SIMPLE_STRING; field_id++ ) { gchar *value; value = g_strdup (e_contact_get_const (contact, field_id)); if (value) { field = g_new0 (glMergeField, 1); field->key = g_strdup (e_contact_pretty_name (field_id)); field->value = value; record->field_list = g_list_prepend (record->field_list, field); } } record->field_list = g_list_reverse (record->field_list); /* free the contact */ g_object_unref (contact); g_free(vcard); return record; }
false
false
false
false
false
0
ois_read_into_buffer(SMSCenter *smsc, long wait_usec) { int ret; SAY(8, "ois_read_into_buffer"); if (smsc->socket == -1) { if ((smsc->ois_flags & OIS_FLAG_CLOSED) == 0) { debug("bb.sms.ois", 0, "attempting to read from a closed socket"); smsc->ois_flags |= OIS_FLAG_CLOSED; } return 0; } else { smsc->ois_flags &= ~OIS_FLAG_CLOSED; } ret = read_available(smsc->socket, wait_usec); if (ret > 0) { time(&smsc->ois_alive); ret = smscenter_read_into_buffer(smsc); if (ret > 0 || (ret == 0 && smsc->buflen > 0)) { SAY(2, "ois_read_into_buffer got something"); } else if (ret == 0) { if (smsc->buflen > 0) { SAY(2, "ois_read_into_buffer has something"); ret = 1; } SAY(4, "ois_read_into_buffer: ois_disconnect"); ois_disconnect(smsc); } } return ret; }
false
false
false
false
false
0
simple_set_aux_byte(struct dvb_frontend *fe, u8 config, u8 aux) { struct tuner_simple_priv *priv = fe->tuner_priv; int rc; u8 buffer[2]; buffer[0] = (config & ~0x38) | 0x18; buffer[1] = aux; tuner_dbg("setting aux byte: 0x%02x 0x%02x\n", buffer[0], buffer[1]); rc = tuner_i2c_xfer_send(&priv->i2c_props, buffer, 2); if (2 != rc) tuner_warn("i2c i/o error: rc == %d (should be 2)\n", rc); return rc == 2 ? 0 : rc; }
false
false
false
false
false
0
init() { int icompute = modify->find_compute(id_pe); if (icompute < 0) error->all(FLERR,"Potential energy ID for fix neb does not exist"); pe = modify->compute[icompute]; // turn off climbing mode, NEB command turns it on after init() rclimber = -1; // setup xprev and xnext arrays memory->destroy(xprev); memory->destroy(xnext); memory->destroy(tangent); nebatoms = atom->nlocal; memory->create(xprev,nebatoms,3,"neb:xprev"); memory->create(xnext,nebatoms,3,"neb:xnext"); memory->create(tangent,nebatoms,3,"neb:tangent"); }
false
false
false
false
false
0
gst_controller_get_control_source (GstController * self, const gchar * property_name) { GstControlledProperty *prop; GstControlSource *ret = NULL; g_return_val_if_fail (GST_IS_CONTROLLER (self), NULL); g_return_val_if_fail (property_name, NULL); g_mutex_lock (self->lock); if ((prop = gst_controller_find_controlled_property (self, property_name))) { ret = prop->csource; } g_mutex_unlock (self->lock); if (ret) g_object_ref (ret); return ret; }
false
false
false
false
false
0
__asinf (float x) { if (__builtin_expect (isgreater (fabsf (x), 1.0f), 0) && _LIB_VERSION != _IEEE_) { /* asin(|x|>1) */ feraiseexcept (FE_INVALID); return __kernel_standard_f (x, x, 102); } return __ieee754_asinf (x); }
false
false
false
false
false
0
DoTerminalPty(int master) { unsigned char term_buf[1024] = {0,0, }; ssize_t len=read(master, term_buf, sizeof(term_buf)); if(len == -1 && errno == EIO) { // this happens when the child is about to exit, we // give it time to actually exit, otherwise we run // into a race so we sleep for half a second. struct timespec sleepfor = { 0, 500000000 }; nanosleep(&sleepfor, NULL); return; } if(len <= 0) return; FileFd::Write(1, term_buf, len); if(d->term_out) fwrite(term_buf, len, sizeof(char), d->term_out); }
false
false
false
false
false
0
intel_crt_set_dpms(struct intel_encoder *encoder, int mode) { struct drm_device *dev = encoder->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crt *crt = intel_encoder_to_crt(encoder); struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; u32 adpa; if (INTEL_INFO(dev)->gen >= 5) adpa = ADPA_HOTPLUG_BITS; else adpa = 0; if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) adpa |= ADPA_HSYNC_ACTIVE_HIGH; if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) adpa |= ADPA_VSYNC_ACTIVE_HIGH; /* For CPT allow 3 pipe config, for others just use A or B */ if (HAS_PCH_LPT(dev)) ; /* Those bits don't exist here */ else if (HAS_PCH_CPT(dev)) adpa |= PORT_TRANS_SEL_CPT(crtc->pipe); else if (crtc->pipe == 0) adpa |= ADPA_PIPE_A_SELECT; else adpa |= ADPA_PIPE_B_SELECT; if (!HAS_PCH_SPLIT(dev)) I915_WRITE(BCLRPAT(crtc->pipe), 0); switch (mode) { case DRM_MODE_DPMS_ON: adpa |= ADPA_DAC_ENABLE; break; case DRM_MODE_DPMS_STANDBY: adpa |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE; break; case DRM_MODE_DPMS_SUSPEND: adpa |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE; break; case DRM_MODE_DPMS_OFF: adpa |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE; break; } I915_WRITE(crt->adpa_reg, adpa); }
false
false
false
false
false
0
print_whole_buff(void) { int trace; for (trace = 0; trace < buff_pntr; trace++) if (buff[trace] != '\0') myputchar(buff[trace]); fflush(stdout); }
false
false
false
false
false
0
fixrdataset(ns_client_t *client, dns_rdataset_t **rdataset) { if (*rdataset == NULL) *rdataset = query_newrdataset(client); else if (dns_rdataset_isassociated(*rdataset)) dns_rdataset_disassociate(*rdataset); }
false
false
false
false
false
0
ep0_queue(struct bdc_ep *ep, struct bdc_req *req) { struct bdc *bdc; int ret; bdc = ep->bdc; dev_dbg(bdc->dev, "%s()\n", __func__); req->usb_req.actual = 0; req->usb_req.status = -EINPROGRESS; req->epnum = ep->ep_num; if (bdc->delayed_status) { bdc->delayed_status = false; /* if status stage was delayed? */ if (bdc->ep0_state == WAIT_FOR_STATUS_START) { /* Queue a status stage BD */ ep0_queue_status_stage(bdc); bdc->ep0_state = WAIT_FOR_STATUS_XMIT; return 0; } } else { /* * if delayed status is false and 0 length transfer is requested * i.e. for status stage of some setup request, then just * return from here the status stage is queued independently */ if (req->usb_req.length == 0) return 0; } ret = usb_gadget_map_request(&bdc->gadget, &req->usb_req, ep->dir); if (ret) { dev_err(bdc->dev, "dma mapping failed %s\n", ep->name); return ret; } return bdc_queue_xfr(bdc, req); }
false
false
false
false
false
0
open_note(int chan, int pitch) /* When a note for a specific channel is turned on, we save the time when it was switched on. */ { int index; /*printf("%f %d\n",Mf_currtime/(float) division,pitch); */ index = 128 * chan + pitch; if (index < 0 || index > 2047) printf("illegal chan/pitch %d %d\n", chan, pitch); notechan[index] = Mf_currtime; return 0; }
false
false
false
false
false
0
DotSection() { IfTrace0((FontDebug), "DotSection\n"); InDotSection = !InDotSection; return(0); }
false
false
false
false
false
0
getMaterialDesc() { // Each material request a new object. // Sometimes the object is already created (see 'o' tag by example), but it is not initialized ! // So, we create a new object only if the current on is already initialized ! if (m_pModel->m_pCurrent != NULL && ( m_pModel->m_pCurrent->m_Meshes.size() > 1 || (m_pModel->m_pCurrent->m_Meshes.size() == 1 && m_pModel->m_Meshes[m_pModel->m_pCurrent->m_Meshes[0]]->m_Faces.size() != 0) ) ) m_pModel->m_pCurrent = NULL; // Get next data for material data m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd); if (m_DataIt == m_DataItEnd) return; char *pStart = &(*m_DataIt); while ( m_DataIt != m_DataItEnd && !isSeparator(*m_DataIt) ) ++m_DataIt; // Get name std::string strName(pStart, &(*m_DataIt)); if ( strName.empty()) return; // Search for material std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strName ); if ( it == m_pModel->m_MaterialMap.end() ) { // Not found, use default material m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial; DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", skipping"); } else { // Found, using detected material m_pModel->m_pCurrentMaterial = (*it).second; if ( needsNewMesh( strName )) { createMesh(); } m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName ); } // Skip rest of line m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine ); }
false
false
false
false
false
0
Copy () { HSlotComp* copy = new HSlotComp((SlotGraphic*) GetGraphic()->Copy()); copy->_mobility = _mobility; return copy; }
false
false
false
false
false
0
o_bus_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y) { TOPLEVEL *toplevel = w_current->toplevel; OBJECT *new_obj; int color; GList *prev_conn_objects = NULL; g_assert( w_current->inside_action != 0 ); if (toplevel->override_bus_color == -1) { color = BUS_COLOR; } else { color = toplevel->override_bus_color; } /* erase the rubberbus */ /* o_bus_invalidate_rubber (w_current); */ w_current->rubber_visible = 0; /* don't allow zero length bus */ /* this ends the bus drawing behavior we want this? hack */ if ( (w_current->first_wx == w_current->second_wx) && (w_current->first_wy == w_current->second_wy) ) { return FALSE; } new_obj = o_bus_new(toplevel, OBJ_BUS, color, w_current->first_wx, w_current->first_wy, w_current->second_wx, w_current->second_wy, 0); s_page_append (toplevel, toplevel->page_current, new_obj); /* connect the new bus to the other busses */ prev_conn_objects = s_conn_return_others (prev_conn_objects, new_obj); o_invalidate_glist (w_current, prev_conn_objects); g_list_free (prev_conn_objects); /* Call add-objects-hook */ g_run_hook_object (w_current, "%add-objects-hook", new_obj); toplevel->page_current->CHANGED=1; w_current->first_wx = w_current->second_wx; w_current->first_wy = w_current->second_wy; o_undo_savestate(w_current, UNDO_ALL); return TRUE; }
false
false
false
false
false
0
jdns_response_copy(const jdns_response_t *r) { jdns_response_t *c = jdns_response_new(); ARRAY_COPY(jdns_rr_t, r->answerRecords, r->answerCount, c->answerRecords, c->answerCount, jdns_rr_copy); ARRAY_COPY(jdns_rr_t, r->authorityRecords, r->authorityCount, c->authorityRecords, c->authorityCount, jdns_rr_copy); ARRAY_COPY(jdns_rr_t, r->additionalRecords, r->additionalCount, c->additionalRecords, c->additionalCount, jdns_rr_copy); return c; }
false
false
false
false
false
0
gst_mpeg_descriptor_find_all (GstMPEGDescriptor * desc, gint tag) { GArray *all; guint8 length; guint8 *current; guint size; g_return_val_if_fail (desc != NULL, NULL); all = g_array_new (TRUE, TRUE, sizeof (guint8 *)); current = desc->data; length = desc->data_length; while (length > 0) { if (DESC_TAG (current) == tag) g_array_append_val (all, current); size = DESC_LENGTH (current) + 2; current += size; length -= size; } GST_DEBUG ("found tag 0x%02x %d times", tag, all->len); return all; }
false
false
false
false
false
0
xgbe_config_rss(struct xgbe_prv_data *pdata) { int ret; if (!pdata->hw_feat.rss) return; if (pdata->netdev->features & NETIF_F_RXHASH) ret = xgbe_enable_rss(pdata); else ret = xgbe_disable_rss(pdata); if (ret) netdev_err(pdata->netdev, "error configuring RSS, RSS disabled\n"); }
false
false
false
false
false
0
timeout_getretry(p_timeout tm) { if (tm->block < 0.0 && tm->total < 0.0) { return -1; } else if (tm->block < 0.0) { double t = tm->total - timeout_gettime() + tm->start; return MAX(t, 0.0); } else if (tm->total < 0.0) { double t = tm->block - timeout_gettime() + tm->start; return MAX(t, 0.0); } else { double t = tm->total - timeout_gettime() + tm->start; return MIN(tm->block, MAX(t, 0.0)); } }
false
false
false
false
false
0
backsql_delete_attr_f( void *v_at, void *v_bda ) { backsql_at_map_rec *at = (backsql_at_map_rec *)v_at; backsql_delete_attr_t *bda = (backsql_delete_attr_t *)v_bda; int rc; rc = backsql_modify_delete_all_values( bda->op, bda->rs, bda->dbh, bda->e_id, at ); if ( rc != LDAP_SUCCESS ) { return BACKSQL_AVL_STOP; } return BACKSQL_AVL_CONTINUE; }
false
false
false
false
false
0
hybrid_pref_new(const gchar *name) { HybridPref *pref; gchar *config_path; if (!(config_path = hybrid_config_get_path())) { hybrid_debug_error("pref", "get config path error."); return NULL; } pref = g_new0(HybridPref, 1); pref->filename = g_strdup_printf("%s/%s", config_path, name ? name : "pref.xml"); if (!(pref->root = xmlnode_root_from_file(pref->filename))) { if (!(pref->root = xmlnode_root(PREF_INIT_BODY, sizeof(PREF_INIT_BODY) - 1))) { hybrid_pref_destroy(pref); return NULL; } hybrid_pref_save(pref); } return pref; }
false
false
false
false
false
0
data_cal_view_finalize (GObject *object) { EDataCalViewPrivate *priv; priv = E_DATA_CAL_VIEW_GET_PRIVATE (object); g_free (priv->object_path); reset_array (priv->adds); reset_array (priv->changes); reset_array (priv->removes); g_array_free (priv->adds, TRUE); g_array_free (priv->changes, TRUE); g_array_free (priv->removes, TRUE); g_hash_table_destroy (priv->ids); if (priv->fields_of_interest != NULL) g_hash_table_destroy (priv->fields_of_interest); g_mutex_clear (&priv->pending_mutex); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_data_cal_view_parent_class)->finalize (object); }
false
false
false
false
false
0
fixupResponseMimetype() { if (m_mimeType.isEmpty()) return; kDebug(7113) << "before fixup" << m_mimeType; // Convert some common mimetypes to standard mimetypes if (m_mimeType == QLatin1String("application/x-targz")) m_mimeType = QLatin1String("application/x-compressed-tar"); else if (m_mimeType == QLatin1String("image/x-png")) m_mimeType = QLatin1String("image/png"); else if (m_mimeType == QLatin1String("audio/x-mp3") || m_mimeType == QLatin1String("audio/x-mpeg") || m_mimeType == QLatin1String("audio/mp3")) m_mimeType = QLatin1String("audio/mpeg"); else if (m_mimeType == QLatin1String("audio/microsoft-wave")) m_mimeType = QLatin1String("audio/x-wav"); else if (m_mimeType == QLatin1String("image/x-ms-bmp")) m_mimeType = QLatin1String("image/bmp"); // Crypto ones.... else if (m_mimeType == QLatin1String("application/pkix-cert") || m_mimeType == QLatin1String("application/binary-certificate")) { m_mimeType = QLatin1String("application/x-x509-ca-cert"); } // Prefer application/x-compressed-tar or x-gzpostscript over application/x-gzip. else if (m_mimeType == QLatin1String("application/x-gzip")) { if ((m_request.url.path().endsWith(QLatin1String(".tar.gz"))) || (m_request.url.path().endsWith(QLatin1String(".tar")))) m_mimeType = QLatin1String("application/x-compressed-tar"); if ((m_request.url.path().endsWith(QLatin1String(".ps.gz")))) m_mimeType = QLatin1String("application/x-gzpostscript"); } // Prefer application/x-xz-compressed-tar over application/x-xz for LMZA compressed // tar files. Arch Linux AUR servers notoriously send the wrong mimetype for this. else if(m_mimeType == QLatin1String("application/x-xz")) { if (m_request.url.path().endsWith(QLatin1String(".tar.xz")) || m_request.url.path().endsWith(QLatin1String(".txz"))) { m_mimeType = QLatin1String("application/x-xz-compressed-tar"); } } // Some webservers say "text/plain" when they mean "application/x-bzip" else if ((m_mimeType == QLatin1String("text/plain")) || (m_mimeType == QLatin1String("application/octet-stream"))) { const QString ext = QFileInfo(m_request.url.path()).suffix().toUpper(); if (ext == QLatin1String("BZ2")) m_mimeType = QLatin1String("application/x-bzip"); else if (ext == QLatin1String("PEM")) m_mimeType = QLatin1String("application/x-x509-ca-cert"); else if (ext == QLatin1String("SWF")) m_mimeType = QLatin1String("application/x-shockwave-flash"); else if (ext == QLatin1String("PLS")) m_mimeType = QLatin1String("audio/x-scpls"); else if (ext == QLatin1String("WMV")) m_mimeType = QLatin1String("video/x-ms-wmv"); else if (ext == QLatin1String("WEBM")) m_mimeType = QLatin1String("video/webm"); else if (ext == QLatin1String("DEB")) m_mimeType = QLatin1String("application/x-deb"); } kDebug(7113) << "after fixup" << m_mimeType; }
false
false
false
false
false
0
turnOnPower (LCDData *LCDData) { /// MPL the new way if (myTurnOnPowerOutputCB != NULL) { if (myRobot->getRobotParams()->getLCDMTXBoardPowerOutput ( LCDData->myNumber) == NULL || myRobot->getRobotParams()->getLCDMTXBoardPowerOutput ( LCDData->myNumber) [0] == '\0') { ArLog::log (ArLog::Normal, "ArLCDConnector::turnOnPower: LCD %d has no power output set so can't be turned on (things may still work).", LCDData->myNumber); return false; } else { if (myTurnOnPowerOutputCB->invokeR ( myRobot->getRobotParams()->getLCDMTXBoardPowerOutput ( LCDData->myNumber))) { ArLog::log (myInfoLogLevel, "ArLCDConnector::turnOnPower: Turned on power output %s for lcd %d", myRobot->getRobotParams()->getLCDMTXBoardPowerOutput ( LCDData->myNumber), LCDData->myNumber); return true; } else { ArLog::log (ArLog::Normal, "ArLCDConnector::turnOnPower: Could not turn on power output %s for lcd %d (things may still work).", myRobot->getRobotParams()->getLCDMTXBoardPowerOutput ( LCDData->myNumber), LCDData->myNumber); return false; } } } return false; }
false
false
false
false
false
0
rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) { int ret = 0; struct sta_info *psta = NULL; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct sta_priv *pstapriv = &padapter->stapriv; DBG_88E("rtw_get_sta_wpaie, sta_addr: %pM\n", (param->sta_addr)); if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) return -EINVAL; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) return -EINVAL; psta = rtw_get_stainfo(pstapriv, param->sta_addr); if (psta) { if (psta->wpa_ie[0] == WLAN_EID_RSN || psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC) { int wpa_ie_len; int copy_len; wpa_ie_len = psta->wpa_ie[1]; copy_len = min_t(int, wpa_ie_len + 2, sizeof(psta->wpa_ie)); param->u.wpa_ie.len = copy_len; memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); } else { DBG_88E("sta's wpa_ie is NONE\n"); } } else { ret = -1; } return ret; }
false
false
false
false
false
0
get_mp3_info(mp3info *mp3) { int l; int bitrate,lastrate; int counter=0; struct stat filestat; off_t sample_pos; stat(mp3->filename,&filestat); mp3->datasize=filestat.st_size; get_id3(mp3); if(get_first_header(mp3,0L)) { mp3->offset=ftell(mp3->file); lastrate=15-mp3->header.bitrate; while((counter < NUM_SAMPLES) && lastrate) { sample_pos=(counter*(mp3->datasize/NUM_SAMPLES+1))+mp3->offset; if(get_first_header(mp3,sample_pos)) { bitrate=15-mp3->header.bitrate; } else { bitrate=-1; } if(bitrate != lastrate) { mp3->vbr=1; counter=NUM_SAMPLES; } lastrate=bitrate; counter++; } mp3->frames=(mp3->datasize-mp3->offset)/(l=frame_length(&mp3->header)); mp3->ms = (int)(1000*(float)(frame_length(&mp3->header)*mp3->frames)/ (float)(header_bitrate(&mp3->header)*125)+0.5); mp3->vbr_average = header_bitrate(&mp3->header); } return 0; }
false
false
false
false
false
0
ReadValue(XMLReadingMachine& reader, const pugi::xml_node& element) const { std::string text; reader.ReadTextNode(text, element); int number; sscanf(text.c_str(), " %d", &number); return new TreeBool(number ? true : false); }
false
false
false
false
false
0
RevertUniqueIndices(const FCDGeometryPolygonsInput& inPInput, FCDGeometryPolygonsInput& outPInput, const FCDGeometryIndexTranslationMap& translationMap) { FUFail(;) // NOT_TESTED size_t tmSize = translationMap.size(); uint32 largest = 0; for (FCDGeometryIndexTranslationMap::const_iterator it = translationMap.begin(), itEnd = translationMap.end(); it != itEnd; ++it) { const UInt32List& curList = it->second; for (UInt32List::const_iterator uit = curList.begin(); uit != curList.end(); ++uit) { largest = max(largest, *uit); } } uint32 oldBufferLen = largest + 1; const FCDGeometrySource* inSrc = inPInput.GetSource(); FCDGeometrySource* outSrc = outPInput.GetSource(); FUAssert(inSrc->GetValueCount() == oldBufferLen, return); uint32 stride = inSrc->GetStride(); outSrc->SetStride(stride); outSrc->SetValueCount(tmSize); const float* inData = inSrc->GetData(); float* outData = outSrc->GetData(); const uint32* inIndices = inPInput.GetIndices(); FUAssert(inIndices != NULL, return); UInt32List indices(inIndices, inPInput.GetIndexCount()); for (FCDGeometryIndexTranslationMap::const_iterator it = translationMap.begin(), itEnd = translationMap.end(); it != itEnd; ++it) { const UInt32List& curList = it->second; FUAssert(!curList.empty(), continue); for (uint32 s = 0; s < stride; ++s) { //data[stride * (*uit) + s] = oldData[stride * + s]; outData[stride * it->first + s] = inData[stride * curList.front() + s]; } for (UInt32List::const_iterator uit = curList.begin(); uit != curList.end(); ++uit) { indices.replace(*uit, it->first); } } outPInput.SetIndices(indices.begin(), indices.size()); }
false
false
false
false
false
0
ssh_gssapi_free(ssh_session session){ OM_uint32 min; if (session->gssapi == NULL) return; SAFE_FREE(session->gssapi->user); SAFE_FREE(session->gssapi->mech.elements); gss_release_cred(&min,&session->gssapi->server_creds); if (session->gssapi->client.creds != session->gssapi->client.client_deleg_creds) { gss_release_cred(&min, &session->gssapi->client.creds); } SAFE_FREE(session->gssapi); }
false
false
false
false
false
0
beam_get_collision(int objnum, int num, int *collision_objnum, mc_info **cinfo) { // sanity checks if((objnum < 0) || (objnum >= MAX_OBJECTS)){ Int3(); return 0; } if((Objects[objnum].instance < 0) || (Objects[objnum].instance >= MAX_BEAMS)){ Int3(); return 0; } if((Beams[Objects[objnum].instance].objnum != objnum) || (Beams[Objects[objnum].instance].objnum < 0)){ Int3(); return 0; } if(num >= Beams[Objects[objnum].instance].r_collision_count){ Int3(); return 0; } // return - success *cinfo = &Beams[Objects[objnum].instance].r_collisions[num].cinfo; *collision_objnum = Beams[Objects[objnum].instance].r_collisions[num].c_objnum; return 1; }
false
false
false
false
false
0
IntPtrTEvent(const char* name, intptr_t value) { if (FLAG_log) UncheckedIntPtrTEvent(name, value); }
false
false
false
false
false
0
ChangeController( TweenieEntry *entry ) { if ( gui_active ) { frame_type type = FRAME; if ( entry->GetPosition() == 0 ) type = LOCKED_KEY; else if ( entry->IsEditable() ) type = KEY; gui_active = false; bool isPreviewing = GetSelectedFramesForFX().IsPreviewing(); if ( isPreviewing ) gdk_threads_enter(); controller->ShowCurrentStatus( entry->GetPosition(), type, entry->GetPosition() > time_map.GetFirst(), entry->GetPosition() < time_map.GetLast() ); GtkWidget *widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_tweenies_x" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->x ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_tweenies_y" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->y ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_tweenies_w" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->width ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_tweenies_h" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->height ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_angle" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->angle ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_fade" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->fade ); widget = glade_xml_get_widget( kinoplus_glade, "spinbutton_shear" ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), entry->shear ); widget = glade_xml_get_widget( kinoplus_glade, "frame_tweenies_key_input" ); gtk_widget_set_sensitive( widget, entry->IsEditable() ); if ( isPreviewing ) gdk_threads_leave(); gui_active = true; } }
false
false
false
false
false
0
git_signature_now(git_signature **sig_out, const char *name, const char *email) { int error; time_t now; time_t offset; struct tm *utc_tm, *local_tm; git_signature *sig; #ifndef GIT_WIN32 struct tm _utc, _local; #endif *sig_out = NULL; time(&now); /** * On Win32, `gmtime_r` doesn't exist but * `gmtime` is threadsafe, so we can use that */ #ifdef GIT_WIN32 utc_tm = gmtime(&now); local_tm = localtime(&now); #else utc_tm = gmtime_r(&now, &_utc); local_tm = localtime_r(&now, &_local); #endif offset = mktime(local_tm) - mktime(utc_tm); offset /= 60; /* mktime takes care of setting tm_isdst correctly */ if (local_tm->tm_isdst) offset += 60; if ((error = git_signature_new(&sig, name, email, now, (int)offset)) < GIT_SUCCESS) return error; *sig_out = sig; return error; }
false
false
false
false
false
0
gf_isom_new_generic_subtitle_description(GF_ISOFile *movie, u32 trackNumber, char *content_encoding, char *xml_schema_loc, char *mime_type_or_namespace, Bool is_xml, char *URLname, char *URNname, u32 *outDescriptionIndex) { GF_TrackBox *trak; GF_Err e; u32 dataRefIndex; GF_MetaDataSampleEntryBox *metasd; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak || !trak->Media) return GF_BAD_PARAM; switch (trak->Media->handler->handlerType) { case GF_ISOM_MEDIA_SUBM: break; default: return GF_BAD_PARAM; } //get or create the data ref e = Media_FindDataRef(trak->Media->information->dataInformation->dref, URLname, URNname, &dataRefIndex); if (e) return e; if (!dataRefIndex) { e = Media_CreateDataRef(trak->Media->information->dataInformation->dref, URLname, URNname, &dataRefIndex); if (e) return e; } trak->Media->mediaHeader->modificationTime = gf_isom_get_mp4time(); metasd = (GF_MetaDataSampleEntryBox *) gf_isom_box_new((is_xml ? GF_ISOM_BOX_TYPE_METX : GF_ISOM_BOX_TYPE_METT)); metasd->dataReferenceIndex = dataRefIndex; gf_list_add(trak->Media->information->sampleTable->SampleDescription->other_boxes, metasd); if (outDescriptionIndex) *outDescriptionIndex = gf_list_count(trak->Media->information->sampleTable->SampleDescription->other_boxes); metasd->content_encoding = gf_strdup(content_encoding); metasd->xml_schema_loc = gf_strdup(xml_schema_loc); metasd->mime_type_or_namespace = gf_strdup(mime_type_or_namespace); return e; }
false
false
false
false
false
0
nccf_add_history(int ncid, const char *history) { time_t now; char *hist_str; char timestamp[NCCF_MAX_TIMESTAMP_LEN + 1]; struct tm *timptr; int ret; if (!history) return NC_NOERR; /* Get the date and time. */ time(&now); if (!(timptr = localtime(&now))) return CF_ETIME; if (!strftime(timestamp, NCCF_MAX_TIMESTAMP_LEN, "%x %X", timptr)) return CF_ETIME; /* Allocate space for this string, with the time prepended. */ if (!(hist_str = malloc(strlen(history) + strlen(timestamp) + 2))) return CF_ENOMEM; /* Create a string with the time and then the user's history * comment. */ sprintf(hist_str, "%s %s\n", timestamp, history); /* Now append that to the existing history att, or create one. */ ret = nccf_append_att(ncid, CF_HISTORY, hist_str); /* Free our memory. */ free(hist_str); return ret; }
false
false
false
false
false
0
dib8000_reset_pll_common(struct dib8000_state *state, const struct dibx000_bandwidth_config *bw) { dprintk("ifreq: %d %x, inversion: %d", bw->ifreq, bw->ifreq, bw->ifreq >> 25); if (state->revision != 0x8090) { dib8000_write_word(state, 23, (u16) (((bw->internal * 1000) >> 16) & 0xffff)); dib8000_write_word(state, 24, (u16) ((bw->internal * 1000) & 0xffff)); } else { dib8000_write_word(state, 23, (u16) (((bw->internal / 2 * 1000) >> 16) & 0xffff)); dib8000_write_word(state, 24, (u16) ((bw->internal / 2 * 1000) & 0xffff)); } dib8000_write_word(state, 27, (u16) ((bw->ifreq >> 16) & 0x01ff)); dib8000_write_word(state, 28, (u16) (bw->ifreq & 0xffff)); dib8000_write_word(state, 26, (u16) ((bw->ifreq >> 25) & 0x0003)); if (state->revision != 0x8090) dib8000_write_word(state, 922, bw->sad_cfg); }
false
false
false
false
false
0
_gcr_record_set_char (GcrRecord *record, guint column, gchar value) { g_return_if_fail (record != NULL); g_return_if_fail (column < record->n_columns); g_return_if_fail (value != 0); record_take_column (record, column, record_block_new (&value, 1)); }
false
false
false
false
false
0
complex_classic_div(PyObject *v, PyObject *w) { Py_complex quot; Py_complex a, b; TO_COMPLEX(v, a); TO_COMPLEX(w, b); if (Py_DivisionWarningFlag >= 2 && PyErr_Warn(PyExc_DeprecationWarning, "classic complex division") < 0) return NULL; PyFPE_START_PROTECT("complex_classic_div", return 0) errno = 0; quot = c_quot(a, b); PyFPE_END_PROTECT(quot) if (errno == EDOM) { PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero"); return NULL; } return PyComplex_FromCComplex(quot); }
false
false
false
false
false
0
Compress_PKLIB( char * pbOutBuffer, int * pcbOutBuffer, char * pbInBuffer, int cbInBuffer, int * /* pCmpType */, int /* nCmpLevel */) { TDataInfo Info; // Data information char * work_buf = ALLOCMEM(char, CMP_BUFFER_SIZE); // Pklib's work buffer unsigned int dict_size; // Dictionary size unsigned int ctype = CMP_BINARY; // Compression type // Fill data information structure memset(work_buf, 0, CMP_BUFFER_SIZE); Info.pbInBuff = pbInBuffer; Info.pbInBuffEnd = pbInBuffer + cbInBuffer; Info.pbOutBuff = pbOutBuffer; Info.pbOutBuffEnd = pbOutBuffer + *pcbOutBuffer; // Set the compression type and dictionary size if (cbInBuffer < 0x600) dict_size = CMP_IMPLODE_DICT_SIZE1; else if(0x600 <= cbInBuffer && cbInBuffer < 0xC00) dict_size = CMP_IMPLODE_DICT_SIZE2; else dict_size = CMP_IMPLODE_DICT_SIZE3; // Do the compression if(implode(ReadInputData, WriteOutputData, work_buf, &Info, &ctype, &dict_size) == CMP_NO_ERROR) *pcbOutBuffer = (int)(Info.pbOutBuff - pbOutBuffer); FREEMEM(work_buf); }
false
false
false
false
false
0
is_name_unique(struct lib_context *lc, struct raid_set *rs) { char *bn; struct raid_set *rs1, *rs2; list_for_each_entry(rs1, LC_RS(lc), list) { if (rs1->type == t_group) { list_for_each_entry(rs2, &rs1->sets, list) { bn = get_rs_basename(rs2->name); if (!strcmp(bn, rs->name)) goto out_used; } } else { bn = get_rs_basename(rs1->name); if (!strcmp(bn, rs->name)) goto out_used; } } return 1; out_used: log_dbg(lc, "%s is being used", bn); return 0; }
false
false
false
false
false
0
tools_make_date(const string & chemin, infinint access, infinint modif) { struct utimbuf temps; time_t tmp = 0; access.unstack(tmp); temps.actime = tmp; tmp = 0; modif.unstack(tmp); temps.modtime = tmp; if(utime(chemin.c_str() , &temps) < 0) Erange("tools_make_date", string(dar_gettext("Cannot set last access and last modification time: ")) + strerror(errno)); }
false
false
false
false
false
0
copy_signature( PKT_signature *d, PKT_signature *s ) { int n, i; if( !d ) d = xmalloc(sizeof *d); memcpy( d, s, sizeof *d ); n = pubkey_get_nsig( s->pubkey_algo ); if( !n ) d->data[0] = mpi_copy(s->data[0]); else { for(i=0; i < n; i++ ) d->data[i] = mpi_copy( s->data[i] ); } d->pka_info = s->pka_info? cp_pka_info (s->pka_info) : NULL; d->hashed = cp_subpktarea (s->hashed); d->unhashed = cp_subpktarea (s->unhashed); if(s->numrevkeys) { d->revkey=NULL; d->numrevkeys=0; parse_revkeys(d); } return d; }
false
true
false
false
true
1
epr_str_to_data_type_id(const char* str) { assert(str != NULL); if (epr_equal_names(str, "UChar") || epr_equal_names(str, "uchar")) return e_tid_uchar; else if (epr_equal_names(str, "AChar") || epr_equal_names(str, "SChar") || epr_equal_names(str, "char")) return e_tid_char; else if (epr_equal_names(str, "UShort") || epr_equal_names(str, "ushort")) return e_tid_ushort; else if (epr_equal_names(str, "SShort") || epr_equal_names(str, "short")) return e_tid_short; else if (epr_equal_names(str, "UInt") || epr_equal_names(str, "uint")) return e_tid_uint; else if (epr_equal_names(str, "SInt") || epr_equal_names(str, "int")) return e_tid_int; else if (epr_equal_names(str, "ULong") || epr_equal_names(str, "ulong")) return e_tid_uint; else if (epr_equal_names(str, "SLong") || epr_equal_names(str, "long")) return e_tid_int; else if (epr_equal_names(str, "Float") || epr_equal_names(str, "float")) return e_tid_float; else if (epr_equal_names(str, "Double") || epr_equal_names(str, "double")) return e_tid_double; else if (epr_equal_names(str, "@/types/UTC.dd") || epr_equal_names(str, "time")) return e_tid_time; else if (epr_equal_names(str, "String") || epr_equal_names(str, "string")) return e_tid_string; else if (epr_equal_names(str, "Spare") || epr_equal_names(str, "spare")) return e_tid_spare; else return e_tid_unknown; }
false
false
false
false
false
0
writeBounds(char *line, size_t lineLen, const char *logPrefix) const { if ((line == NULL) || (lineLen <= 0) || (logPrefix == NULL)) { ArLog::log(ArLog::Normal, "ArConfigArg::writeBounds() invalid input"); return false; } // KMC 8/3/12 IMPORTANT NOTE: While it would be extremely nice // to prevent buffer overruns by using snprintf instead of sprintf, // it is currently ill-advised. On Linux, the two methods behave // differently when the line buffer is used as both the target buffer // and as formatting input (as in all the prints below). It yields // the desired results with sprintf, but substitutes an empty string // for the formatting input with snprintf. This, in turn, causes // the output config data to be garbage. (On Windows, there is no // problem.) switch (getType()) { case INT: { if (hasMinBound()) { if (hasMaxBound()) { sprintf(line, "%s range [%d, %d], ", line, getMinInt(), getMaxInt()); } else { // no max, just write min sprintf(line, // KMC 7/11/12 Corrected misspelling, will this be a problem? "%s minimum %d, ", line, getMinInt()); } // end else no max, just write min } else if (hasMaxBound()) { sprintf(line, "%s maximum %d, ", line, getMaxInt()); } } break; case DOUBLE: { if (hasMinBound()) { if (hasMaxBound()) { sprintf(line, "%s range [%g, %g], ", line, getMinDouble(), getMaxDouble()); } else { sprintf(line, "%s minimum %g, ", line, getMinDouble()); } } else if (hasMaxBound()) { // KMC 7/11/12 Made case consistent, problem? sprintf(line, "%s maximum %g, ", line, getMaxDouble()); } } break; default: // No other types currently have bounds break; } // end switch line[lineLen - 1] = '\0'; return true; }
false
false
false
false
false
0
egg_buffer_set_allocator (EggBuffer *buffer, EggBufferAllocator allocator) { unsigned char *buf = NULL; if (!allocator) allocator = DEFAULT_ALLOCATOR; if (buffer->allocator == allocator) return 1; if (buffer->allocated_len) { /* Reallocate memory block using new allocator */ buf = (allocator) (NULL, buffer->allocated_len); if (buf == NULL) return 0; /* Copy stuff into new memory */ memcpy (buf, buffer->buf, buffer->allocated_len); } /* If old wasn't static, then free it */ if (buffer->allocator && buffer->buf) (buffer->allocator) (buffer->buf, 0); buffer->buf = buf; buffer->allocator = allocator; return 1; }
false
true
false
false
false
1
cloog_loop_print_structure(FILE * file, CloogLoop * loop, int level) { int i, j, first=1 ; if (loop) { /* Go to the right level. */ for (i=0; i<level; i++) fprintf(file,"|\t") ; fprintf(file,"+-- CloogLoop\n") ; } /* For each loop. */ while (loop) { if (!first) { /* Go to the right level. */ for (i=0; i<level; i++) fprintf(file,"|\t") ; fprintf(file,"| CloogLoop\n") ; } else first = 0 ; /* A blank line. */ for(j=0; j<=level+1; j++) fprintf(file,"|\t") ; fprintf(file,"\n") ; /* Print the domain. */ cloog_domain_print_structure(file, loop->domain, level+1, "CloogDomain"); /* Print the stride. */ for(j=0; j<=level; j++) fprintf(file,"|\t") ; if (loop->stride) { fprintf(file, "Stride: "); cloog_int_print(file, loop->stride->stride); fprintf(file, "\n"); fprintf(file, "Offset: "); cloog_int_print(file, loop->stride->offset); fprintf(file, "\n"); } /* A blank line. */ for(j=0; j<=level+1; j++) fprintf(file,"|\t") ; fprintf(file,"\n") ; /* Print the block. */ cloog_block_print_structure(file,loop->block,level+1) ; /* A blank line. */ for (i=0; i<=level+1; i++) fprintf(file,"|\t") ; fprintf(file,"\n") ; /* Print inner if any. */ if (loop->inner) cloog_loop_print_structure(file,loop->inner,level+1) ; /* And let's go for the next one. */ loop = loop->next ; /* One more time something that is here only for a better look. */ if (!loop) { /* Two blank lines if this is the end of the linked list. */ for (j=0; j<2; j++) { for (i=0; i<=level; i++) fprintf(file,"|\t") ; fprintf(file,"\n") ; } } else { /* A special blank line if the is a next loop. */ for (i=0; i<=level; i++) fprintf(file,"|\t") ; fprintf(file,"V\n") ; } } }
false
false
false
false
false
0
trackLocation( const Meta::TrackPtr &track ) const { KUrl path = track->playableUrl(); if( path.isEmpty() ) return track->uidUrl(); if( !m_relativePaths || m_url.isEmpty() || !path.isLocalFile() || !m_url.isLocalFile() ) return path.toEncoded(); QDir playlistDir( m_url.directory() ); return QUrl::toPercentEncoding( playlistDir.relativeFilePath( path.path() ), "/" ); }
false
false
false
false
false
0