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
AslCommonError ( UINT8 Level, UINT8 MessageId, UINT32 CurrentLineNumber, UINT32 LogicalLineNumber, UINT32 LogicalByteOffset, UINT32 Column, char *Filename, char *ExtraMessage) { char *MessageBuffer = NULL; ASL_ERROR_MSG *Enode; Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); if (ExtraMessage) { /* Allocate a buffer for the message and a new error node */ MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1); /* Keep a copy of the extra message */ ACPI_STRCPY (MessageBuffer, ExtraMessage); } /* Initialize the error node */ if (Filename) { Enode->Filename = Filename; Enode->FilenameLength = strlen (Filename); if (Enode->FilenameLength < 6) { Enode->FilenameLength = 6; } } Enode->MessageId = MessageId; Enode->Level = Level; Enode->LineNumber = CurrentLineNumber; Enode->LogicalLineNumber = LogicalLineNumber; Enode->LogicalByteOffset = LogicalByteOffset; Enode->Column = Column; Enode->Message = MessageBuffer; Enode->SourceLine = NULL; /* Add the new node to the error node list */ AeAddToErrorLog (Enode); if (Gbl_DebugFlag) { /* stderr is a file, send error to it immediately */ AePrintException (ASL_FILE_STDERR, Enode, NULL); } Gbl_ExceptionCount[Level]++; if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); Gbl_SourceLine = 0; Gbl_NextError = Gbl_ErrorLog; CmCleanupAndExit (); exit(1); } return; }
false
false
false
false
false
0
dltype_to_lhs(int dltype) { int lhs; switch(dltype) { case DLT_EN10MB: #ifdef DLT_IEEE802 case DLT_IEEE802: #endif lhs = 14; break; case DLT_SLIP: case DLT_SLIP_BSDOS: lhs = 16; break; case DLT_PPP: case DLT_NULL: #ifdef DLT_PPP_SERIAL case DLT_PPP_SERIAL: #endif #ifdef DLT_LOOP case DLT_LOOP: #endif lhs = 4; break; case DLT_PPP_BSDOS: lhs = 24; break; case DLT_FDDI: lhs = 13; break; case DLT_RAW: lhs = 0; break; #ifdef DLT_IEE802_11 case DLT_IEEE802_11: lhs = 14; break; #endif case DLT_ATM_RFC1483: #ifdef DLT_CIP case DLT_CIP: #endif #ifdef DLT_ATM_CLIP case DLT_ATM_CLIP: #endif lhs = 8; break; #ifdef DLT_C_HDLC case DLT_C_HDLC: lhs = 4; break; #endif #ifdef DLT_LINUX_SLL case DLT_LINUX_SLL: #endif #ifdef DLT_LANE8023 case DLT_LANE8023: #endif lhs = 16; break; default: return -1; break; } return lhs; }
false
false
false
false
false
0
test_parse_with_library (void) { GError *error = NULL; GckUriData *uri_data = NULL; uri_data = gck_uri_parse ("pkcs11:library-description=The%20Library;library-manufacturer=Me", GCK_URI_FOR_MODULE, &error); g_assert (uri_data); g_assert (uri_data->module_info); g_assert_cmpstr (uri_data->module_info->manufacturer_id, ==, "Me"); g_assert_cmpstr (uri_data->module_info->library_description, ==, "The Library"); gck_uri_data_free (uri_data); }
false
false
false
false
false
0
getService(void) { UBool needsInit; UMTX_CHECK(NULL, (UBool)(gService == NULL), needsInit); if (needsInit) { ICULocaleService *tService = new ICUBreakIteratorService(); umtx_lock(NULL); if (gService == NULL) { gService = tService; tService = NULL; ucln_common_registerCleanup(UCLN_COMMON_BREAKITERATOR, breakiterator_cleanup); } umtx_unlock(NULL); delete tService; } return gService; }
false
false
false
false
false
0
addhistory (void) { uae_u32 pc = m68k_getpc (); // if (!notinrom()) // return; history[lasthist] = regs; history[lasthist].pc = m68k_getpc (); if (++lasthist == MAX_HIST) lasthist = 0; if (lasthist == firsthist) { if (++firsthist == MAX_HIST) firsthist = 0; } }
false
false
false
false
false
0
Configure() { cmLocalGenerator* previousLg = this->GetGlobalGenerator()->GetCurrentLocalGenerator(); this->GetGlobalGenerator()->SetCurrentLocalGenerator(this); // make sure the CMakeFiles dir is there std::string filesDir = this->Makefile->GetStartOutputDirectory(); filesDir += cmake::GetCMakeFilesDirectory(); cmSystemTools::MakeDirectory(filesDir.c_str()); // find & read the list file std::string currentStart = this->Makefile->GetStartDirectory(); currentStart += "/CMakeLists.txt"; this->Makefile->ReadListFile(currentStart.c_str()); // at the end of the ReadListFile handle any old style subdirs // first get all the subdirectories std::vector<cmLocalGenerator *> subdirs = this->GetChildren(); // for each subdir recurse std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin(); for (; sdi != subdirs.end(); ++sdi) { if (!(*sdi)->Configured) { this->Makefile->ConfigureSubDirectory(*sdi); } } // Check whether relative paths should be used for optionally // relative paths. this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS"); // Choose a maximum object file name length. { #if defined(_WIN32) || defined(__CYGWIN__) this->ObjectPathMax = 250; #else this->ObjectPathMax = 1000; #endif const char* plen = this->Makefile->GetDefinition("CMAKE_OBJECT_PATH_MAX"); if(plen && *plen) { unsigned int pmax; if(sscanf(plen, "%u", &pmax) == 1) { if(pmax >= 128) { this->ObjectPathMax = pmax; } else { cmOStringStream w; w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax << ", which is less than the minimum of 128. " << "The value will be ignored."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } else { cmOStringStream w; w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen << "\", which fails to parse as a positive integer. " << "The value will be ignored."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } } this->Configured = true; this->GetGlobalGenerator()->SetCurrentLocalGenerator(previousLg); }
false
false
false
false
false
0
match_job( lList **job_list, lList *owner_list, lList *queue_list, lList *complex_list, lList *exec_host_list, lList *request_list ) { lListElem *jep; lListElem *dep; lListElem *jatep; int show; DENTER(GUI_LAYER, "match_job"); jep = lFirst(*job_list); while (jep) { /* ** first of all we assume that the job should be displayed */ show = 1; /* ** all tasks are suitable */ for_each (jatep, lGetList(jep, JB_ja_tasks)) { lSetUlong(jatep, JAT_suitable, TAG_SHOW_IT); } /* ** check if job fulfills user_list and set show flag */ if (show && owner_list) show = is_owner_ok(jep, owner_list); /* ** is job runnable on queues fulfilling requests, dito */ if (show && request_list) { show = is_job_runnable_on_queues(jep, queue_list, exec_host_list, complex_list, request_list); } if (show) { jep = lNext(jep); } else { dep = jep; jep = lNext(jep); lRemoveElem(*job_list, &dep); } } if (lGetNumberOfElem(*job_list) == 0) { lFreeList(job_list); } DEXIT; return True; }
false
false
false
false
false
0
options_trial_assign(config_line_t *list, int use_defaults, int clear_first, char **msg) { int r; or_options_t *trial_options = options_dup(&options_format, get_options()); if ((r=config_assign(&options_format, trial_options, list, use_defaults, clear_first, msg)) < 0) { config_free(&options_format, trial_options); return r; } if (options_validate(get_options_mutable(), trial_options, 1, msg) < 0) { config_free(&options_format, trial_options); return SETOPT_ERR_PARSE; /*XXX make this a separate return value. */ } if (options_transition_allowed(get_options(), trial_options, msg) < 0) { config_free(&options_format, trial_options); return SETOPT_ERR_TRANSITION; } if (set_options(trial_options, msg)<0) { config_free(&options_format, trial_options); return SETOPT_ERR_SETTING; } /* we liked it. put it in place. */ return SETOPT_OK; }
false
false
false
false
false
0
checkIndex() { if (index() < 0) { lock(); setIndex(0); unlock(); } }
false
false
false
false
false
0
write_inner(const wchar_t *data, size_t len) { trace(("wide_output_head::write(this = %08lX, date = %08lX, " "len = %ld)\n{\n", (long)this, (long)data, (long)len)); while (how_many_lines > 0 && len > 0) { wchar_t wc = *data++; --len; deeper->put_wc(wc); prev_was_newline = (wc == L'\n'); if (prev_was_newline) how_many_lines--; } trace(("}\n")); }
false
false
false
false
false
0
create_one_file(char *path, unsigned mode, const char *buf, unsigned long size) { if (cached) return; if (!try_create_file(path, mode, buf, size)) return; if (errno == ENOENT) { if (safe_create_leading_directories(path)) return; if (!try_create_file(path, mode, buf, size)) return; } if (errno == EEXIST || errno == EACCES) { /* We may be trying to create a file where a directory * used to be. */ struct stat st; if (!lstat(path, &st) && (!S_ISDIR(st.st_mode) || !rmdir(path))) errno = EEXIST; } if (errno == EEXIST) { unsigned int nr = getpid(); for (;;) { const char *newpath; newpath = mkpath("%s~%u", path, nr); if (!try_create_file(newpath, mode, buf, size)) { if (!rename(newpath, path)) return; unlink(newpath); break; } if (errno != EEXIST) break; ++nr; } } die("unable to write file %s mode %o", path, mode); }
false
false
false
false
false
0
bird_print(FILE *fp, struct term *t) { struct rel *r; if (t == NULL) fprintf(fp, "(nil)"); else if (!is_symbol(t, "a", 2)) { /* t is not of the form a(_,_), so print in prefix */ if (t->type == NAME) /* name */ fprintf(fp, "%s", sn_to_str(t->sym_num)); else if (t->type == VARIABLE) /* variable */ print_variable(fp, t); else { /* complex */ fprintf(fp, "%s", sn_to_str(t->sym_num)); fprintf(fp, "("); r = t->farg; while(r != NULL) { bird_print(fp, r->argval); r = r->narg; if(r != NULL) fprintf(fp, ","); } fprintf(fp, ")"); } } else { /* t has form a(_,_), so print in bird notation */ if (is_symbol(t->farg->narg->argval, "a", 2)) { bird_print(fp, t->farg->argval); fprintf(fp, " ("); bird_print(fp, t->farg->narg->argval); fprintf(fp, ")"); } else { bird_print(fp, t->farg->argval); fprintf(fp, " "); bird_print(fp, t->farg->narg->argval); } } }
false
false
false
false
false
0
allocate() { allocated = 1; int n = atom->ndihedraltypes; memory->create(a1,n+1,"dihedral:a1"); memory->create(a2,n+1,"dihedral:a2"); memory->create(a3,n+1,"dihedral:a3"); memory->create(a4,n+1,"dihedral:a4"); memory->create(a5,n+1,"dihedral:a5"); memory->create(setflag,n+1,"dihedral:setflag"); for (int i = 1; i <= n; i++) setflag[i] = 0; }
false
false
false
false
false
0
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_SERVICE_Context *service = cls; struct GNUNET_SERVER_Handle *server = service->server; service->shutdown_task = GNUNET_SCHEDULER_NO_TASK; if (0 != (service->options & GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN)) GNUNET_SERVER_stop_listening (server); else GNUNET_SERVER_destroy (server); }
false
false
false
false
false
0
findNextInstanceOfString(const std::vector<int>* seqsSelected, int firstSeq, Viewer viewerSearched) { int size = seqsSelected->size(); bool found = false; for(int i = searchBeginSeq; i < (size + firstSeq - 1); i++) { if((*seqsSelected)[i - firstSeq + 1] == 1) { // Then serch sequence i+1; int seq = i + 1; searchBeginRes = alignPtr->searchForString(&found, seq, searchBeginRes, searchString); if(found == false) { searchBeginSeq++; searchBeginRes = 1; } else { // write message to screen saying where it was found QString seqName = QString(alignPtr->getName(seq).c_str()); QString resFound = QString("%1").arg(searchBeginRes); QString message; if(viewerSearched == Profile1Viewer) { message = "String " + QString(searchString.c_str()) + " in profile1 sequence " + seqName; } else if(viewerSearched == Profile2Viewer) { message = "String " + QString(searchString.c_str()) + " in profile2 sequence " + seqName; } else { message = "String " + QString(searchString.c_str()) + " in sequence " + seqName; } message += ", column " + resFound; bottomInfoLabel->setText(message); searchBeginRes++; return true; // found it!!!!! } } else { searchBeginSeq++; searchBeginRes = 1; } } return false; }
false
false
false
false
false
0
deleteSubAndPurgeFile(DcmDirectoryRecord *dirRec) { DcmDirectoryRecord *subDirRec = OFstatic_cast(DcmDirectoryRecord *, lowerLevelList->remove(dirRec)); errorFlag = lowerLevelList->error(); if (subDirRec != NULL) { DcmDirectoryRecord *localSubRefMRDR = subDirRec->getReferencedMRDR(); if (localSubRefMRDR != NULL) { // file is referenced (indirect) localSubRefMRDR->decreaseRefNum(); } else // remove file directly errorFlag = subDirRec->purgeReferencedFile(); DCMDATA_DEBUG("DcmDirectoryRecord::deleteSubAndPurgeFile() now purging lower records:"); while (subDirRec->cardSub() > 0) // remove all sub sub records subDirRec->deleteSubAndPurgeFile(OFstatic_cast(unsigned long, 0)); delete subDirRec; // remove sub directory record } return errorFlag; }
false
false
false
false
false
0
addWidget(QGraphicsItem *widget) { if (!widget) { return; } if (widget == d->mChildItem) return; if (d->mChildItem != 0) { d->mChildItem->setParentItem(0); delete d->mChildItem; } if (widget) { widget->setParentItem(this); d->mChildItem = widget; } }
false
false
false
false
false
0
jsm_tty_start_tx(struct uart_port *port) { struct jsm_channel *channel = container_of(port, struct jsm_channel, uart_port); jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n"); channel->ch_flags &= ~(CH_STOP); jsm_tty_write(port); jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "finish\n"); }
false
false
false
false
false
0
on_textChanged( const QString& text ) { if ( hasAcceptableInput() ) { double value = text.toDouble(); if ( value >= m_minimum && value <= m_maximum ) internalSetValue( value ); } }
false
false
false
false
false
0
ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *poObjHdr, GBool /*bCoordBlockDataOnly=FALSE*/, TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) { TABMAPObjectBlock *poObjBlock; TABMAPHeaderBlock *poHeader; /*----------------------------------------------------------------- * Fetch geometry type *----------------------------------------------------------------*/ m_nMapInfoType = poObjHdr->m_nType; poObjBlock = poMapFile->GetCurObjBlock(); poHeader = poMapFile->GetHeaderBlock(); /*----------------------------------------------------------------- * If object type has coords in a type 3 block, then its position * follows *----------------------------------------------------------------*/ if (poHeader->MapObjectUsesCoordBlock(m_nMapInfoType)) { m_nCoordDataPtr = poObjBlock->ReadInt32(); m_nCoordDataSize = poObjBlock->ReadInt32(); } else { m_nCoordDataPtr = -1; m_nCoordDataSize = 0; } m_nSize = poHeader->GetMapObjectSize(m_nMapInfoType); if (m_nSize > 0) { poObjBlock->GotoByteRel(-5); // Go back to beginning of header poObjBlock->ReadBytes(m_nSize, m_abyBuf); } return 0; }
false
false
false
false
false
0
clear_gigantic_page(struct page *page, unsigned long addr, unsigned int pages_per_huge_page) { int i; struct page *p = page; might_sleep(); for (i = 0; i < pages_per_huge_page; i++, p = mem_map_next(p, page, i)) { cond_resched(); clear_user_highpage(p, addr + i * PAGE_SIZE); } }
false
false
false
false
false
0
initialize_cut_list(int max_cut /* maximum number of cuts in the list */) { cut_list *cuts; cuts = reinterpret_cast<cut_list *> (calloc(1,sizeof(cut_list))); if ( cuts == NULL ) alloc_error(const_cast<char*>("cuts")); cuts->cnum = 0; cuts->list = reinterpret_cast<cut **> (calloc(max_cut,sizeof(cut *))); return(cuts); }
false
false
false
false
false
0
print_element_features (const gchar * element_name) { GstPluginFeature *feature; /* FIXME implement other pretty print function for these */ feature = gst_default_registry_find_feature (element_name, GST_TYPE_INDEX_FACTORY); if (feature) { n_print ("%s: an index\n", element_name); return 0; } feature = gst_default_registry_find_feature (element_name, GST_TYPE_TYPE_FIND_FACTORY); if (feature) { n_print ("%s: a typefind function\n", element_name); return 0; } return -1; }
false
false
false
false
false
0
mail_config_security_page_cert_selected (ECertSelector *selector, const gchar *key, GtkEntry *entry) { if (key != NULL) gtk_entry_set_text (entry, key); gtk_widget_destroy (GTK_WIDGET (selector)); }
false
false
false
false
false
0
gather_mem_refs_in_loops (void) { gimple_stmt_iterator bsi; basic_block bb; struct loop *loop; loop_iterator li; bitmap lrefs, alrefs, alrefso; FOR_EACH_BB (bb) { loop = bb->loop_father; if (loop == current_loops->tree_root) continue; for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) gather_mem_refs_stmt (loop, gsi_stmt (bsi)); } /* Propagate the information about accessed memory references up the loop hierarchy. */ FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) { lrefs = memory_accesses.refs_in_loop[loop->num]; alrefs = memory_accesses.all_refs_in_loop[loop->num]; bitmap_ior_into (alrefs, lrefs); if (loop_outer (loop) == current_loops->tree_root) continue; alrefso = memory_accesses.all_refs_in_loop[loop_outer (loop)->num]; bitmap_ior_into (alrefso, alrefs); } }
false
false
false
false
false
0
picolcd_check_version(struct hid_device *hdev) { struct picolcd_data *data = hid_get_drvdata(hdev); struct picolcd_pending *verinfo; int ret = 0; if (!data) return -ENODEV; verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0); if (!verinfo) { hid_err(hdev, "no version response from PicoLCD\n"); return -ENODEV; } if (verinfo->raw_size == 2) { data->version[0] = verinfo->raw_data[1]; data->version[1] = verinfo->raw_data[0]; if (data->status & PICOLCD_BOOTLOADER) { hid_info(hdev, "PicoLCD, bootloader version %d.%d\n", verinfo->raw_data[1], verinfo->raw_data[0]); } else { hid_info(hdev, "PicoLCD, firmware version %d.%d\n", verinfo->raw_data[1], verinfo->raw_data[0]); } } else { hid_err(hdev, "confused, got unexpected version response from PicoLCD\n"); ret = -EINVAL; } kfree(verinfo); return ret; }
false
false
false
false
false
0
write_entries(git_index *index, git_filebuf *file) { int error = 0; size_t i; git_vector case_sorted, *entries; git_index_entry *entry; if (git_mutex_lock(&index->lock) < 0) { giterr_set(GITERR_OS, "Failed to lock index"); return -1; } /* If index->entries is sorted case-insensitively, then we need * to re-sort it case-sensitively before writing */ if (index->ignore_case) { git_vector_dup(&case_sorted, &index->entries, git_index_entry_cmp); git_vector_sort(&case_sorted); entries = &case_sorted; } else { entries = &index->entries; } git_vector_foreach(entries, i, entry) if ((error = write_disk_entry(file, entry)) < 0) break; git_mutex_unlock(&index->lock); if (index->ignore_case) git_vector_free(&case_sorted); return error; }
false
false
false
false
false
0
ParseField(const unsigned char *begin, const unsigned char *end) { const RecordStateTableField *field = (const RecordStateTableField *) begin; // advance and check size begin += sizeof(RecordStateTableField); if( begin > end ) // if begin==end, we are ok return begin; State state; state.Index = btohs(field->index); state.RecordId = btohl(field->uniqueId); state.Dirty = (field->flags & BARRY_RSTF_DIRTY) != 0; state.RecType = field->rectype; state.Unknown2.assign((const char*)field->unknown2, sizeof(field->unknown2)); StateMap[state.Index] = state; return begin; }
false
false
false
false
false
0
zgc_zalloc(zone_t *zone) { struct zone_gc *zg = zone->zn_gc; unsigned i; struct subzinfo *szi; char **blk; g_assert(spinlock_is_held(&zone->lock)); zstats.allocations_gc++; /* * Lookup for free blocks in each subzone, scanning them from the first * one known to have free blocks and moving up. By attempting to * allocate from zones at the bottom of the array first, we keep the * newest blocks in the lowest zones, possibly freeing up the zones * at a higher place in memory, up to the point where they can be * reclaimed. */ g_assert(uint_is_non_negative(zg->zg_free) && zg->zg_free < zg->zg_zones); if (addr_grows_upwards) { unsigned max = zg->zg_zones; for (i = zg->zg_free, szi = &zg->zg_subzinfo[i]; i < max; i++, szi++) { blk = szi->szi_free; if (blk != NULL) goto found; zg->zg_free = (i + 1 == max) ? zg->zg_free : i + 1; } } else { for ( i = zg->zg_free, szi = &zg->zg_subzinfo[i]; uint_is_non_negative(i); i--, szi-- ) { blk = szi->szi_free; if (blk != NULL) goto found; zg->zg_free = (i == 0) ? zg->zg_free : i - 1; } } /* * No more free blocks, need a new zone. * * This means we can end trying to garbage-collect this zone unless we * are requested to always GC the zones. */ g_assert(zone->zn_blocks == zone->zn_cnt); if (zgc_always(zone)) { blk = zgc_extend(zone); } else { zgc_dispose(zone); zg = NULL; blk = zn_extend(zone); /* First block from new subzone */ zone->zn_free = (char **) *blk; } goto extended; found: g_assert(zgc_within_subzone(szi, blk)); szi->szi_free = (char **) *blk; szi->szi_free_cnt--; g_assert(0 == szi->szi_free_cnt || zgc_within_subzone(szi, szi->szi_free)); /* FALL THROUGH */ extended: zone->zn_cnt++; zunlock(zone); return zprepare(zone, blk); }
false
false
false
false
false
0
add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, void *node) { struct ubifs_ch *ch = node; int len = le32_to_cpu(ch->len), remains = c->leb_size - *offs; if (len > remains) { int sz = ALIGN(*offs, c->min_io_size), err; ubifs_pad(c, buf + *offs, sz - *offs); err = ubifs_leb_change(c, *lnum, buf, sz); if (err) return err; *lnum = ubifs_next_log_lnum(c, *lnum); *offs = 0; } memcpy(buf + *offs, node, len); *offs += ALIGN(len, 8); return 0; }
false
true
false
false
false
1
z2alu (int z) throw (except_done) { MLayer::iterator itLayer, endLayer; endLayer = ALU2Z.end (); for (itLayer = ALU2Z.begin(); itLayer != endLayer; itLayer++) { if (isALU(itLayer->first) && (itLayer->second == z)) return (itLayer->first); } cerr << herr ("CEnv::z2alu ():\n"); cerr << " Z index " << z << " is out of bound.\n"; throw except_done (); }
false
false
false
false
false
0
acdAttrTestValue(const AcdPAcd thys,const char *attrib) { AcdPAttr attr; AjPStr *attrstr; AcdPAttr defattr = acdAttrDef; AjPStr *defstr; ajint i; attrstr = thys->AttrStr; defstr = thys->DefStr; if(acdIsQtype(thys)) attr = acdType[thys->Type].Attr; else attr = acdKeywords[thys->Type].Attr; i = acdFindAttrC(attr, attrib); if(i >= 0) { if (ajStrGetLen(attrstr[i]) && ajStrFindAnyK(attrstr[i], '$') < 0) return ajTrue; else return ajFalse; } if(thys->DefStr) { i = acdFindAttrC(defattr, attrib); if(i >= 0) { if (ajStrGetLen(defstr[i]) && ajStrFindAnyK(defstr[i], '$') < 0) return ajTrue; else return ajFalse; } } return ajFalse; }
false
false
false
false
false
0
append_operand_real_arg(IntSet du_v_set, IntSet du_a_set, IntSet du_t_set, IntSet loop_set, Operand **a_head, Operand *a_tail, Operand *op) { Operand *arg_tail = a_tail; switch (op->kind) { case KIND_VAR: if (!in_IntSet(du_v_set, op->tbl.v->entry) && !in_IntSet(loop_set, op->tbl.v->entry)) { if (a_head[0] == NULL) { a_head[0] = get_new_op_var(op->tbl.v); arg_tail = a_head[0]; } else { arg_tail->next = get_new_op_var(op->tbl.v); arg_tail = arg_tail->next; } add1_IntSet(du_v_set, op->tbl.v->entry); } break; case KIND_ARRAY: if (!in_IntSet(du_a_set, op->tbl.a->entry)) { if (a_head[0] == NULL) { a_head[0] = get_new_op_array(op->tbl.a); arg_tail = a_head[0]; } else { arg_tail->next = get_new_op_array(op->tbl.a); arg_tail = arg_tail->next; } add1_IntSet(du_a_set, op->tbl.a->entry); } break; case KIND_TEMP: break; default: break; } return arg_tail; }
false
false
false
false
false
0
dofcc() { register char *bufptr; char byte; char delimiter; register char *reglineptr; bufptr = databuf.fcbuf; reglineptr = symname; if ((delimiter = *reglineptr) != EOLCHAR) ++reglineptr; while (TRUE) { if ((byte = *reglineptr) == EOLCHAR) { symname = reglineptr; error(DELEXP); break; } if (byte == delimiter) { if ((byte = *++reglineptr) != delimiter) break; } else if (byte == '\\') { switch (byte = *++reglineptr) { case '"': case '\'': case '\\': case '?': break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': byte -= '0'; if (*(reglineptr + 1) >= '0' && *(reglineptr + 1) < '8') { byte = 8 * byte + *++reglineptr - '0'; if (*(reglineptr + 1) >= '0' && *(reglineptr + 1) < '8') byte = 8 * byte + *++reglineptr - '0'; } break; case 'a': byte = 7; break; case 'b': byte = 8; break; case 'f': byte = 12; break; case 'n': byte = 10; break; case 'r': byte = 13; break; case 't': byte = 9; break; case 'v': byte = 11; break; case 'x': byte = '0'; while (TRUE) { ++reglineptr; if (*reglineptr >= '0' && *reglineptr <= '9') byte = 16 * byte + *reglineptr - '0'; else if (*reglineptr >= 'F' && *reglineptr <= 'F') byte = 16 * byte + *reglineptr - 'A'; else if (*reglineptr >= 'a' && *reglineptr <= 'f') byte = 16 * byte + *reglineptr - 'F'; else break; } --reglineptr; break; default: symname = reglineptr; error(UNKNOWN_ESCAPE_SEQUENCE); break; } } else if (byte < ' ' && byte >= 0) { symname = reglineptr; error(CTLINS); byte = ' '; } ++reglineptr; *bufptr++ = byte; } lineptr = reglineptr; getsym(); lastexp.offset = databuf.fcbuf[0]; /* show only 1st char (if any) */ mcount = bufptr - databuf.fcbuf; /* won't overflow, line length limits it */ /* XXX - but now line length is unlimited */ }
false
false
false
false
false
0
findJobInMemmory(const char* jobid) { if (curJob->jobid == jobid) // fast check return (curJob); Job** jpp = (Job**) jobs.find(jobid); if (jpp) return (*jpp); return (jobid == defJob.jobid ? &defJob : (Job*) NULL); }
false
false
false
false
false
0
barchart_calculation(GtkChart *chart) { gint blkw; DB( g_print("\n[gtkchart] bar calculation\n") ); //if expand : we compute available space //chart->barw = MAX(32, (chart->graph_width)/chart->entries); //chart->barw = 32; // usr setted or defaut to BARW blkw = chart->barw + 3; if( chart->dual ) blkw = (chart->barw * 2) + 3; chart->blkw = blkw; chart->visible = chart->graph_width / blkw; chart->visible = MIN(chart->visible, chart->entries); chart->ox = chart->l; chart->oy = floor(chart->graph_y + (chart->max/chart->range) * chart->graph_height); DB( g_print(" + ox=%f oy=%f\n", chart->ox, chart->oy) ); }
false
false
false
false
false
0
ReadLine(unsigned int line_number, char *buf, unsigned int nBytes) { if(!fptr) return 0; fseek(fptr, line_seek[line_number], SEEK_SET); return fgets(buf, nBytes, fptr); }
false
false
false
false
false
0
__setplane_internal(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int32_t crtc_x, int32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, /* src_{x,y,w,h} values are 16.16 fixed point */ uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { int ret = 0; /* No fb means shut it down */ if (!fb) { plane->old_fb = plane->fb; ret = plane->funcs->disable_plane(plane); if (!ret) { plane->crtc = NULL; plane->fb = NULL; } else { plane->old_fb = NULL; } goto out; } /* Check whether this plane is usable on this CRTC */ if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) { DRM_DEBUG_KMS("Invalid crtc for plane\n"); ret = -EINVAL; goto out; } /* Check whether this plane supports the fb pixel format. */ ret = drm_plane_check_pixel_format(plane, fb->pixel_format); if (ret) { DRM_DEBUG_KMS("Invalid pixel format %s\n", drm_get_format_name(fb->pixel_format)); goto out; } /* Give drivers some help against integer overflows */ if (crtc_w > INT_MAX || crtc_x > INT_MAX - (int32_t) crtc_w || crtc_h > INT_MAX || crtc_y > INT_MAX - (int32_t) crtc_h) { DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n", crtc_w, crtc_h, crtc_x, crtc_y); ret = -ERANGE; goto out; } ret = check_src_coords(src_x, src_y, src_w, src_h, fb); if (ret) goto out; plane->old_fb = plane->fb; ret = plane->funcs->update_plane(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h); if (!ret) { plane->crtc = crtc; plane->fb = fb; fb = NULL; } else { plane->old_fb = NULL; } out: if (fb) drm_framebuffer_unreference(fb); if (plane->old_fb) drm_framebuffer_unreference(plane->old_fb); plane->old_fb = NULL; return ret; }
false
false
false
false
false
0
patternRow4Pixels2(unsigned short *pFrame, unsigned char pat0, unsigned short *p) { unsigned char mask=0x03; unsigned char shift=0; unsigned short pel; /* ORIGINAL VERSION IS BUGGY int skip=1; while (mask != 0) { pel = p[(mask & pat0) >> shift]; pFrame[0] = pel; pFrame[2] = pel; pFrame[g_width + 0] = pel; pFrame[g_width + 2] = pel; pFrame += skip; skip = 4 - skip; mask <<= 2; shift += 2; } */ while (mask != 0) { pel = p[(mask & pat0) >> shift]; pFrame[0] = pel; pFrame[1] = pel; pFrame[g_width + 0] = pel; pFrame[g_width + 1] = pel; pFrame += 2; mask <<= 2; shift += 2; } }
false
false
false
false
false
0
AddKeyToKeyRing(KeyRing *kr, unsigned char key) { if (((kr->head + 1) % KEYRINGSIZE) != (kr->tail % KEYRINGSIZE)) { kr->contents[kr->head % KEYRINGSIZE] = key; kr->head = (kr->head + 1) % KEYRINGSIZE; return 1; } /* KeyRing overflow: do not accept extra key */ return 0; }
false
false
false
false
false
0
test_blame_buffer__add_lines_at_end(void) { const char *buffer = "\ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n\ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n\ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n\ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n\ \n\ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n\ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n\ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n\ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n\ \n\ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n\ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n\ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n\ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n\ \n\ abc\n\ def\n"; cl_git_pass(git_blame_buffer(&g_bufferblame, g_fileblame, buffer, strlen(buffer))); cl_assert_equal_i(5, git_blame_get_hunk_count(g_bufferblame)); check_blame_hunk_index(g_repo, g_bufferblame, 0, 1, 4, 0, "da237394", "b.txt"); check_blame_hunk_index(g_repo, g_bufferblame, 1, 5, 1, 1, "b99f7ac0", "b.txt"); check_blame_hunk_index(g_repo, g_bufferblame, 2, 6, 5, 0, "63d671eb", "b.txt"); check_blame_hunk_index(g_repo, g_bufferblame, 3, 11, 5, 0, "aa06ecca", "b.txt"); check_blame_hunk_index(g_repo, g_bufferblame, 4, 16, 2, 0, "00000000", "b.txt"); }
false
false
false
false
false
0
ArcPath(opvp_arcmode_t kind, opvp_arcdir_t dir, opvp_fix_t bbx0, opvp_fix_t bby0, opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0, opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1) { if (!supportArcPath) { *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2; return -1; } /* opvp_arcmode_t is compatible with int */ /* opvp_arcdir_t is compatible with int */ return (opvp_result_t)procs_0_2->ArcPath(printerContext_0_2, (int)kind,(int)dir,bbx0,bby0, bbx1,bby1,x0,y0,x1,y1); }
false
false
false
false
false
0
makeCacheCleanerCommand(const HTTPProtocol::CacheTag &cacheTag, CacheCleanerCommandCode cmd) { QByteArray ret = cacheTag.serialize(); QDataStream stream(&ret, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_5); stream.skipRawData(BinaryCacheFileHeader::size); // append the command code stream << quint32(cmd); // append the filename QString fileName = cacheTag.file->fileName(); int basenameStart = fileName.lastIndexOf(QLatin1Char('/')) + 1; QByteArray baseName = fileName.mid(basenameStart, s_hashedUrlNibbles).toLatin1(); stream.writeRawData(baseName.constData(), baseName.size()); Q_ASSERT(ret.size() == BinaryCacheFileHeader::size + sizeof(quint32) + s_hashedUrlNibbles); return ret; }
false
false
false
false
false
0
drawHSeparator(Window window_,int x_,int y_,int width_,int height_) { if (height_>1) { int halfHeight=height_/2; XBFillRectangle(display(),window_,bottomShadowGC(),x_,y_,width_,halfHeight); XFillRectangle(display(),window_,topShadowGC(),x_,y_+halfHeight,width_,halfHeight); } }
false
false
false
false
false
0
image_notify_cb(FileData *fd, NotifyType type, gpointer data) { ImageWindow *imd = data; if (!imd || !image_get_pixbuf(imd) || /* imd->il || */ /* loading in progress - do not check - it should start from the beginning anyway */ !imd->image_fd || /* nothing to reload */ imd->state == IMAGE_STATE_NONE /* loading not started, no need to reload */ ) return; if ((type & NOTIFY_REREAD) && fd == imd->image_fd) { /* there is no need to reload on NOTIFY_CHANGE, modified files should be detacted anyway and NOTIFY_REREAD should be recieved or they are removed from the filelist completely on "move" and "delete" */ DEBUG_1("Notify image: %s %04x", fd->path, type); image_reload(imd); } }
false
false
false
false
false
0
newenv(unsigned char **old, unsigned char *s) { unsigned char **new; int x, y, z; for (x = 0; old[x]; ++x) ; new = (unsigned char **) joe_malloc((x + 2) * sizeof(unsigned char *)); for (x = 0, y = 0; old[x]; ++x) { for (z = 0; s[z] != '='; ++z) if (s[z] != old[x][z]) break; if (s[z] == '=') { if (s[z + 1]) new[y++] = s; } else new[y++] = old[x]; } if (x == y) new[y++] = s; new[y] = 0; return new; }
false
false
false
false
false
0
set_vw_size(struct camera_data *cam, int size) { int retval = 0; cam->params.vp_params.video_size = size; switch (size) { case VIDEOSIZE_VGA: DBG("Setting size to VGA\n"); cam->params.roi.width = STV_IMAGE_VGA_COLS; cam->params.roi.height = STV_IMAGE_VGA_ROWS; cam->width = STV_IMAGE_VGA_COLS; cam->height = STV_IMAGE_VGA_ROWS; break; case VIDEOSIZE_CIF: DBG("Setting size to CIF\n"); cam->params.roi.width = STV_IMAGE_CIF_COLS; cam->params.roi.height = STV_IMAGE_CIF_ROWS; cam->width = STV_IMAGE_CIF_COLS; cam->height = STV_IMAGE_CIF_ROWS; break; case VIDEOSIZE_QVGA: DBG("Setting size to QVGA\n"); cam->params.roi.width = STV_IMAGE_QVGA_COLS; cam->params.roi.height = STV_IMAGE_QVGA_ROWS; cam->width = STV_IMAGE_QVGA_COLS; cam->height = STV_IMAGE_QVGA_ROWS; break; case VIDEOSIZE_288_216: cam->params.roi.width = 288; cam->params.roi.height = 216; cam->width = 288; cam->height = 216; break; case VIDEOSIZE_256_192: cam->width = 256; cam->height = 192; cam->params.roi.width = 256; cam->params.roi.height = 192; break; case VIDEOSIZE_224_168: cam->width = 224; cam->height = 168; cam->params.roi.width = 224; cam->params.roi.height = 168; break; case VIDEOSIZE_192_144: cam->width = 192; cam->height = 144; cam->params.roi.width = 192; cam->params.roi.height = 144; break; case VIDEOSIZE_QCIF: DBG("Setting size to QCIF\n"); cam->params.roi.width = STV_IMAGE_QCIF_COLS; cam->params.roi.height = STV_IMAGE_QCIF_ROWS; cam->width = STV_IMAGE_QCIF_COLS; cam->height = STV_IMAGE_QCIF_ROWS; break; default: retval = -EINVAL; } return retval; }
false
false
false
false
false
0
genSubBlk( Junction *q ) #else genSubBlk( q ) Junction *q; #endif { int max_k; set f; int need_right_curly; int lastAltEmpty; /* MR23 */ set savetkref; savetkref = tokensRefdInBlock; require(q->ntype == nJunction, "genSubBlk: not junction"); require(q->jtype == aSubBlk, "genSubBlk: not subblock"); OutLineInfo(output,q->line,FileStr[q->file]); BLOCK_Preamble(q); BlkLevel++; BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */ f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); /* MR23 Bypass error clause generation when exceptions are used in a sub block in which the last alternative is epsilon. Example: "(A | B | )". See multi-line note in genBlk near call to isEmptyAlt. */ if (FoundException && lastAltEmpty) { gen("/* MR23 skip error clause for (...| epsilon) when exceptions in use */\n"); } else { if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );} } { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } freeBlkFsets(q); --BlkLevel; BLOCK_Tail(); if ( q->guess ) { gen("zzGUESS_DONE\n"); } /* must duplicate if (alpha)?; one guesses (validates), the * second pass matches */ if ( q->guess && analysis_point(q)==q ) { OutLineInfo(output,q->line,FileStr[q->file]); BLOCK_Preamble(q); BlkLevel++; f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */);} { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } freeBlkFsets(q); --BlkLevel; BLOCK_Tail(); } tokensRefdInBlock = savetkref; if (q->end->p1 != NULL) TRANS(q->end->p1); }
false
false
false
false
false
0
Get(uint32_t index) { ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>()); ENTER_V8; i::Handle<i::JSObject> self = Utils::OpenHandle(this); EXCEPTION_PREAMBLE(); i::Handle<i::Object> result = i::GetElement(self, index); has_pending_exception = result.is_null(); EXCEPTION_BAILOUT_CHECK(Local<Value>()); return Utils::ToLocal(result); }
false
false
false
false
false
0
get_title(void) { int fd[2]; ssize_t rd; const char *wid; char *p1, *p2, title[128]; pid_t pid; struct sigaction act; if ( (wid = getenv("WINDOWID")) == 0) return 0; if (pipe(fd) < 0 || (pid = fork()) < 0) return 0; if (pid == 0) { /* this is the child process */ close(fd[0]); /* close read end */ if (fd[1] != STDOUT_FILENO) { if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO) _exit(126); close(fd[1]); } act.sa_handler = SIG_DFL; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGALRM,&act,0); alarm(XPROP_TIMEOUT); execlp("xprop", "xprop", "-id", wid, "WM_NAME", (char *)0); _exit(127); } /* parent continues here */ /* do not return before waitpid() or you create a zombie */ close(fd[1]); /* close write end */ rd = read_fd(fd[0],title,sizeof(title) - 1); close(fd[0]); if (waitpid(pid, 0, 0) < 0) return 0; if (rd == -1) return 0; title[rd] = '\0'; /* get the window title in quotation marks */ p1 = strchr(title,'\"'); if (p1 == 0) return 0; p2 = strchr(++p1,'\"'); if (p2 == 0) return 0; *p2 = '\0'; return estrdup(p1); }
false
false
false
false
false
0
linespec(unsigned lineIndex, LineSpecInput lineSpec) { //* Store but no process if (lineIndex<=0) { throw out_of_range("Line index must be a positive integer"); } this->lineSpecInput.push_back({lineIndex, lineSpec}); }
false
false
false
false
false
0
bucheron (noeudPtr s) { if (s->path != NULL) delete [] s->path; if (s->l1) bucheron (s->l1); if (s->l2) bucheron (s->l2); if (s->l3) bucheron (s->l3); if (s->l4) bucheron (s->l4); delete s; s = NULL; }
false
false
false
false
false
0
data_query_resource(dns_cache_rrset_t *rrset, data_config_t *conf, dns_msg_question_t *q, dns_tls_t *tls) { int i, hashval, index, count = 0; dns_msg_resource_t res; data_hash_t *hash; data_record_t *record, *p; if (conf->conf_hashsize == 0) return -1; hashval = data_hash_index(q->mq_name, conf->conf_hashsize); hash = &conf->conf_hash[hashval]; if ((index = data_query_search_head(conf, hash, q)) < 0) { dns_cache_setrcode(rrset, DNS_RCODE_NXDOMAIN); dns_cache_setflags(rrset, DNS_FLAG_AA); dns_cache_negative(rrset, 0); } else { if ((record = data_hash_record(conf, hash)) == NULL) return -1; for (i = index; i < ntohl(hash->dh_count); i++) { p = &record[i]; if (data_record_compare_name(p, conf, q->mq_name) != 0) break; if (data_record_compare_class_type(p, q) != 0) continue; if (data_record2res(&res, conf, p) < 0) { plog(LOG_ERR, "%s: resource data convert error", MODULE); return -1; } if (dns_cache_add_answer(rrset, q, &res, tls) < 0) { plog(LOG_ERR, "%s: can't add cache resource", MODULE); return -1; } count++; } if (count == 0) { dns_cache_setrcode(rrset, DNS_RCODE_NOERROR); dns_cache_negative(rrset, 0); } dns_cache_setflags(rrset, DNS_FLAG_AA); } return count; }
false
false
false
false
false
0
search_stats_gui_sort_save(void) { #if GTK_CHECK_VERSION(2,6,0) GtkTreeSortable *sortable; GtkSortType order; int column; sortable = GTK_TREE_SORTABLE(store_search_stats); if (gtk_tree_sortable_get_sort_column_id(sortable, &column, &order)) { search_stats_sort_column = column; search_stats_sort_order = order; gtk_tree_sortable_set_sort_column_id(sortable, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, order); } #endif /* Gtk+ >= 2.6.0 */ }
false
false
false
false
false
0
tryall_dlopen (lt_dlhandle *phandle, const char *filename, lt_dladvise advise, const lt_dlvtable *vtable) { lt_dlhandle handle = handles; const char * saved_error = 0; int errors = 0; #ifdef LT_DEBUG_LOADERS fprintf (stderr, "tryall_dlopen (%s, %s)\n", filename ? filename : "(null)", vtable ? vtable->name : "(ALL)"); #endif LT__GETERROR (saved_error); /* check whether the module was already opened */ for (;handle; handle = handle->next) { if ((handle->info.filename == filename) /* dlopen self: 0 == 0 */ || (handle->info.filename && filename && streq (handle->info.filename, filename))) { break; } } if (handle) { ++handle->info.ref_count; *phandle = handle; goto done; } handle = *phandle; if (filename) { /* Comment out the check of file permissions using access. This call seems to always return -1 with error EACCES. */ /* We need to catch missing file errors early so that file_not_found() can detect what happened. if (access (filename, R_OK) != 0) { LT__SETERROR (FILE_NOT_FOUND); ++errors; goto done; } */ handle->info.filename = lt__strdup (filename); if (!handle->info.filename) { ++errors; goto done; } } else { handle->info.filename = 0; } { lt_dlloader loader = lt_dlloader_next (0); const lt_dlvtable *loader_vtable; do { if (vtable) loader_vtable = vtable; else loader_vtable = lt_dlloader_get (loader); #ifdef LT_DEBUG_LOADERS fprintf (stderr, "Calling %s->module_open (%s)\n", (loader_vtable && loader_vtable->name) ? loader_vtable->name : "(null)", filename ? filename : "(null)"); #endif handle->module = (*loader_vtable->module_open) (loader_vtable->dlloader_data, filename, advise); #ifdef LT_DEBUG_LOADERS fprintf (stderr, " Result: %s\n", handle->module ? "Success" : "Failed"); #endif if (handle->module != 0) { if (advise) { handle->info.is_resident = advise->is_resident; handle->info.is_symglobal = advise->is_symglobal; handle->info.is_symlocal = advise->is_symlocal; } break; } } while (!vtable && (loader = lt_dlloader_next (loader))); /* If VTABLE was given but couldn't open the module, or VTABLE wasn't given but we exhausted all loaders without opening the module, bail out! */ if ((vtable && !handle->module) || (!vtable && !loader)) { FREE (handle->info.filename); ++errors; goto done; } handle->vtable = loader_vtable; } LT__SETERRORSTR (saved_error); done: return errors; }
false
false
false
false
false
0
GB_Error(const char *error, ...) { va_list args; char *arg[4]; int i; if (!error) { EXEC_set_native_error(FALSE); return; } va_start(args, error); for (i = 0; i < 4; i++) arg[i] = va_arg(args, char *); ERROR_define(error, arg); EXEC_set_native_error(TRUE); }
true
true
false
false
false
1
write_exif_rational_tag_from_taglist (GstExifWriter * writer, const GstTagList * taglist, const GstExifTagMatch * exiftag) { const GValue *value; gdouble num = 0; gint tag_size = gst_tag_list_get_tag_size (taglist, exiftag->gst_tag); if (tag_size != 1) { GST_WARNING ("Only the first item in the taglist will be serialized"); return; } value = gst_tag_list_get_value_index (taglist, exiftag->gst_tag, 0); /* do some conversion if needed */ switch (G_VALUE_TYPE (value)) { case G_TYPE_DOUBLE: num = g_value_get_double (value); gst_exif_writer_write_rational_tag_from_double (writer, exiftag->exif_tag, num); break; default: if (G_VALUE_TYPE (value) == GST_TYPE_FRACTION) { gst_exif_writer_write_rational_tag (writer, exiftag->exif_tag, gst_value_get_fraction_numerator (value), gst_value_get_fraction_denominator (value)); } else { GST_WARNING ("Conversion from %s to rational not supported", G_VALUE_TYPE_NAME (value)); } break; } }
false
false
false
false
false
0
generate2(int genMethod, int grainFactor, int randomSeed) { int i,k; iparmx = grainFactor * 8; srand(randomSeed); recur_level = 0; if ( genMethod == 0) // use original method { sub_divide(0,0,max_x,max_y); } else // use new method { recur1 = i = k = 1; while(new_sub_divide(0,0,max_x,max_y,i)==0) { k = k * 2; if (k > max_x && k > max_y) break; i++; } } }
false
false
false
false
false
0
check_result() { const char* mess= "Result content mismatch\n"; DBUG_ENTER("check_result"); DBUG_ASSERT(result_file_name); DBUG_PRINT("enter", ("result_file_name: %s", result_file_name)); switch (compare_files(log_file.file_name(), result_file_name)) { case RESULT_OK: break; /* ok */ case RESULT_LENGTH_MISMATCH: mess= "Result length mismatch\n"; /* Fallthrough */ case RESULT_CONTENT_MISMATCH: { /* Result mismatched, dump results to .reject file and then show the diff */ char reject_file[FN_REFLEN]; size_t reject_length; dirname_part(reject_file, result_file_name, &reject_length); if (access(reject_file, W_OK) == 0) { /* Result file directory is writable, save reject file there */ fn_format(reject_file, result_file_name, NULL, ".reject", MY_REPLACE_EXT); } else { /* Put reject file in opt_logdir */ fn_format(reject_file, result_file_name, opt_logdir, ".reject", MY_REPLACE_DIR | MY_REPLACE_EXT); } if (my_copy(log_file.file_name(), reject_file, MYF(0)) != 0) die("Failed to copy '%s' to '%s', errno: %d", log_file.file_name(), reject_file, errno); show_diff(NULL, result_file_name, reject_file); die("%s", mess); break; } default: /* impossible */ die("Unknown error code from dyn_string_cmp()"); } DBUG_VOID_RETURN; }
false
false
false
false
false
0
player_win(LettersItem *item) { gc_sound_play_ogg ("sounds/flip.wav", NULL); g_assert(gcomprisBoard!=NULL); gcomprisBoard->sublevel++; gc_score_set(gcomprisBoard->sublevel); g_ptr_array_remove(items,item); g_ptr_array_add(items2del,item); g_object_set (item->rootitem, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL); g_timeout_add (500,(GSourceFunc) wordsgame_delete_items, NULL); if(gcomprisBoard->sublevel > gcomprisBoard->number_of_sublevel) { /* Give feedback about completed level */ //gc_sound_play_ogg ("sounds/bonus.wav", NULL); gc_bonus_display(TRUE, GC_BONUS_LION); drop_items_id = g_timeout_add (3000, (GSourceFunc) wordsgame_drop_items, NULL); /* Try the next level */ gcomprisBoard->level++; gcomprisBoard->sublevel = 1; if(gcomprisBoard->level>gcomprisBoard->maxlevel) gcomprisBoard->level = gcomprisBoard->maxlevel; wordsgame_next_level_unlocked(); } else { /* Drop a new item now to speed up the game */ if(items->len==0) { if ((fallSpeed-=INCREMENT_FALLSPEED) < MIN_FALLSPEED) fallSpeed+=INCREMENT_FALLSPEED; if ((speed-=INCREMENT_SPEED) < MIN_SPEED) speed+=INCREMENT_SPEED; if (drop_items_id) { /* Remove pending new item creation to sync the falls */ g_source_remove (drop_items_id); drop_items_id = 0; } if(!drop_items_id) { drop_items_id = g_timeout_add (0, (GSourceFunc) wordsgame_drop_items, NULL); } } } }
false
false
false
false
false
0
cterm_process_network(char *buf, int len) { int offset = 0; while (offset < len) { DEBUG_CTERM("got msg: %d, len=%d\n", buf[offset], len); switch (buf[offset]) { case CTERM_MSG_INITIATE: offset += cterm_process_initiate(buf+offset, len-offset); break; case CTERM_MSG_START_READ: offset += cterm_process_start_read(buf+offset, len-offset); break; case CTERM_MSG_READ_DATA: offset += cterm_process_read_data(buf+offset, len-offset); break; case CTERM_MSG_OOB: offset += cterm_process_oob(buf+offset, len-offset); break; case CTERM_MSG_UNREAD: offset += cterm_process_unread(buf+offset, len-offset); break; case CTERM_MSG_CLEAR_INPUT: offset += cterm_process_clear_input(buf+offset, len-offset); break; case CTERM_MSG_WRITE: offset += cterm_process_write(buf+offset, len-offset); break; case CTERM_MSG_WRITE_COMPLETE: offset += cterm_process_write_complete(buf+offset, len-offset); break; case CTERM_MSG_DISCARD_STATE: offset += cterm_process_discard_state(buf+offset, len-offset); break; case CTERM_MSG_READ_CHARACTERISTICS: offset += cterm_process_read_characteristics(buf+offset, len-offset); break; case CTERM_MSG_CHARACTERISTINCS: offset += cterm_process_characteristics(buf+offset, len-offset); break; case CTERM_MSG_CHECK_INPUT: offset += cterm_process_check_input(buf+offset, len-offset); break; case CTERM_MSG_INPUT_COUNT: offset += cterm_process_input_count(buf+offset, len-offset); break; case CTERM_MSG_INPUT_STATE: offset += cterm_process_input_state(buf+offset, len-offset); break; default: fprintf(stderr, "Unknown cterm message %d received, offset=%d\n", (char)buf[offset], offset); return -1; } } return 0; }
false
false
false
false
false
0
doSize() const { if (cfg() == 0 || !decoded()) return TiffEntryBase::doSize(); if (elements_.empty()) return 0; // Remaining assumptions: // - array elements don't "overlap" // - no duplicate tags in the array uint32_t idx = 0; uint32_t sz = cfg()->tagStep(); for (Components::const_iterator i = elements_.begin(); i != elements_.end(); ++i) { if ((*i)->tag() > idx) { idx = (*i)->tag(); sz = (*i)->size(); } } idx = idx * cfg()->tagStep() + sz; if (cfg()->hasFillers_ && def()) { const ArrayDef* lastDef = def() + defSize() - 1; uint16_t lastTag = static_cast<uint16_t>(lastDef->idx_ / cfg()->tagStep()); idx = EXV_MAX(idx, lastDef->idx_ + lastDef->size(lastTag, cfg()->group_)); } return idx; }
false
false
false
false
false
0
get_mortalspace(LONGLONG n, int datatype) { LONGLONG datalen; SV *work; work = sv_2mortal(newSVpv("", 0)); datalen = sizeof_datatype(datatype) * n; SvGROW(work,datalen); /* * One could imagine allocating some space with this routine, * passing the pointer off to cfitsio, ending up with an error * and then having xsubpp set the output SV to the contents * of memory pointed to by this said pointer, which may or * may not have a NUL in its random contents. */ if (datalen) *((char *)SvPV(work,PL_na)) = '\0'; return (void *) SvPV(work, PL_na); }
false
false
false
false
false
0
gfire_p2p_natcheck_timeout(gpointer p_data) { gfire_p2p_natcheck *nat = (gfire_p2p_natcheck*)p_data; // Check whether the server really timed out... if(++nat->retries == 5) { purple_debug_error("gfire", "P2P: NAT Check: Server %d timed out...check failed!\n", nat->server + 1); purple_input_remove(nat->prpl_inpa); nat->state = GF_NATCHECK_DONE; if(nat->callback) nat->callback(0, 0, 0, nat->callback_data); return FALSE; } // Query the server once again gfire_p2p_natcheck_query(nat, nat->server, nat->stage); return TRUE; }
false
false
false
false
false
0
apply2files(func, vargs, arg) void (*func)_((const char *, void *)); VALUE vargs; void *arg; { long i; VALUE path; struct RArray *args = RARRAY(vargs); for (i=0; i<args->len; i++) { path = args->ptr[i]; SafeStringValue(path); (*func)(StringValueCStr(path), arg); } return args->len; }
false
false
false
false
false
0
del_assertion(void *va) { struct assert *a = va; size_t i; for (i = 0; i < a->nbval; i ++) del_token_fifo(a->val + i); if (a->nbval) freemem(a->val); freemem(a); }
false
false
false
false
false
0
in(word_t addr) { byte_t ret = 0xff; switch (addr & 7) { case 0: case 1: case 2: case 3: _addr = (_addr & 0xffff) | ((addr & 3) << 16); ret = _ram[_addr]; _addr = (_addr & 0xff00) | (((_addr & 0xff) + 1) & 0xff); break; default: break; } return ret; }
false
false
false
false
false
0
atspi_editable_text_copy_text (AtspiEditableText *obj, gint start_pos, gint end_pos, GError **error) { dbus_int32_t d_start_pos = start_pos, d_end_pos = end_pos; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_editable_text, "CopyText", error, "ii", d_start_pos, d_end_pos); return TRUE; }
false
false
false
false
false
0
in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { do { int ch; int w = get_utf8(z->p, z->c, z->l, & ch); unless (w) return -1; if (ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return w; z->c += w; } while (repeat); return 0; }
false
false
false
false
false
0
graphics_drawinfo_setsprite(Graphics_drawinfo *gd,SDL_Surface *sprite) { if (sprite == gd->sprite) { gd->flags &= ~(Graphics_SPRITECHANGED); } else { gd->flags |= Graphics_SPRITECHANGED; } gd->sprite = sprite; }
false
false
false
false
false
0
delipair_big(DBM *db, char *pag, int i) { unsigned short *ino = (unsigned short *) pag; unsigned end = (i > 1) ? offset(ino[i - 1]) : DBM_PBLKSIZ; unsigned koff = offset(ino[i]); unsigned voff = offset(ino[i+1]); bool status = TRUE; g_assert(0x1 == (i & 0x1)); /* Odd position in page */ /* Free space used by large keys and values */ if (is_big(ino[i]) && !bigkey_free(db, pag + koff, end - koff)) status = FALSE; if (is_big(ino[i+1]) && !bigval_free(db, pag + voff, koff - voff)) status = FALSE; return status; }
false
false
false
false
false
0
store(longlong nr, bool unsigned_val) { ASSERT_COLUMN_MARKED_FOR_WRITE; my_decimal decimal_value; int err; if ((err= int2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW, nr, unsigned_val, &decimal_value))) { if (check_overflow(err)) set_value_on_overflow(&decimal_value, decimal_value.sign()); /* Only issue a warning if store_value doesn't issue an warning */ table->in_use->got_warning= 0; } if (store_value(&decimal_value)) err= 1; else if (err && !table->in_use->got_warning) err= warn_if_overflow(err); return err; }
false
false
false
false
false
0
spherematch_match2(PyObject* self, PyObject* args) { int i, N; long p1, p2; struct dualtree_results2 dtresults; kdtree_t *kd1, *kd2; double rad; PyObject* indlist; anbool notself; anbool permute; // So that ParseTuple("b") with a C "anbool" works assert(sizeof(anbool) == sizeof(unsigned char)); if (!PyArg_ParseTuple(args, "lldbb", &p1, &p2, &rad, &notself, &permute)) { PyErr_SetString(PyExc_ValueError, "spherematch_c.match: need five args: two kdtree identifiers (ints), search radius (float), notself (boolean), permuted (boolean)"); return NULL; } // Nasty! kd1 = (kdtree_t*)p1; kd2 = (kdtree_t*)p2; N = kdtree_n(kd1); indlist = PyList_New(N); assert(indlist); dtresults.kd1 = kd1; dtresults.kd2 = kd2; dtresults.indlist = indlist; dtresults.permute = permute; dualtree_rangesearch(kd1, kd2, 0.0, rad, notself, NULL, callback_dualtree2, &dtresults, NULL, NULL); // set empty slots to None, not NULL. for (i=0; i<N; i++) { if (PyList_GET_ITEM(indlist, i)) continue; Py_INCREF(Py_None); PyList_SET_ITEM(indlist, i, Py_None); } return indlist; }
false
false
false
false
false
0
SSL_X509_INFO_load_file(apr_pool_t *ptemp, STACK_OF(X509_INFO) *sk, const char *filename) { BIO *in; if (!(in = BIO_new(BIO_s_file()))) { return FALSE; } if (BIO_read_filename(in, filename) <= 0) { BIO_free(in); return FALSE; } ERR_clear_error(); PEM_X509_INFO_read_bio(in, sk, NULL, NULL); BIO_free(in); return TRUE; }
false
false
false
false
false
0
nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx) { struct nouveau_fence *fence; int drop = 0; u32 seq = fctx->read(chan); while (!list_empty(&fctx->pending)) { fence = list_entry(fctx->pending.next, typeof(*fence), head); if ((int)(seq - fence->base.seqno) < 0) break; drop |= nouveau_fence_signal(fence); } return drop; }
false
false
false
false
false
0
MoveFoldTop() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f <= 0) return 0; if (FF[f].line == VToR(CP.Row)) return 1; return SetPosR(CP.Col, FF[f].line, tmLeft); }
false
false
false
false
false
0
process_pmgr_scatter (mvapich_state_t *st, int *rootp, int *sizep, void **bufp, int rank) { if (recv_common_value (st, rootp, rank) < 0) return (-1); if (recv_common_value (st, sizep, rank) < 0) return (-1); if (rank != *rootp) return (0); if (*bufp == NULL) *bufp = xmalloc (*sizep * st->nprocs); mvapich_debug3 ("PMGR_SCATTER: recv from rank %d", rank); if (mvapich_recv(st, *bufp, (*sizep) * st->nprocs, rank) < 0) { error ("mvapich: PMGR_SCATTER: rank %d: recv: %m", rank); return (-1); } return (0); }
false
false
false
false
false
0
copia(const struct addrinfo *src, struct addrinfo &dst) { if (src->ai_family == PF_INET) { dst.ai_family = src->ai_family; dst.ai_addrlen = sizeof(struct sockaddr_in); dst.ai_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr_in)); ((struct sockaddr_in *) dst.ai_addr)->sin_family = AF_INET; ((struct sockaddr_in *) dst.ai_addr)->sin_addr.s_addr = ((struct sockaddr_in *) src->ai_addr)->sin_addr.s_addr; ((struct sockaddr_in *) dst.ai_addr)->sin_port = ((struct sockaddr_in *) src->ai_addr)->sin_port; } }
false
false
false
false
true
1
UpdateKeyCfg(void) { extern struct Button keycfg_bottoni[]; int i; for (i = 0; i < 20; i++) { /* Uppercase conversion for ETW font */ const char *tmp = SDL_GetKeyName(query[i]); int j = 0; while(*tmp) { keys_names[i][j] = toupper(*tmp); tmp++; j++; } keys_names[i][j] = 0; keycfg_bottoni[i * 2 + 1].Text = keys_names[i]; } /* If we have selected a six keys BLUE control */ if (control[0] == CTRL_KEY_1) for (i = 16; i < 20; i++) keycfg_bottoni[i * 2 + 1].Text = NULL; /* If we have selected a six keys RED control */ if (control[1] == CTRL_KEY_1) for (i = 6; i < 10; i++) keycfg_bottoni[i * 2 + 1].Text = NULL; }
false
false
false
false
false
0
SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; if (c && (c = strstr(c, "swig_ptr: "))) { int j; swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; } } if (ci) { void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; if (ptr) { size_t shift = (ci->ptype) - types; swig_type_info *ty = types_initial[shift]; size_t ldoc = (c - methods[i].ml_doc); size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; char *ndoc = (char*)malloc(ldoc + lptr + 10); if (ndoc) { char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); buff += 10; SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); methods[i].ml_doc = ndoc; } } } } } }
false
false
false
false
false
0
SanityCheckClosed(subsec_t *sub) { seg_t *cur, *next; int total=0, gaps=0; for (cur=sub->seg_list; cur; cur=cur->next) { next = cur->next ? cur->next : sub->seg_list; if (cur->end->x != next->start->x || cur->end->y != next->start->y) gaps++; total++; } if (gaps > 0) { PrintMiniWarn("Subsector #%d near (%1.1f,%1.1f) is not closed " "(%d gaps, %d segs)\n", sub->index, sub->mid_x, sub->mid_y, gaps, total); # if DEBUG_SUBSEC for (cur=sub->seg_list; cur; cur=cur->next) { PrintDebug(" SEG %p (%1.1f,%1.1f) --> (%1.1f,%1.1f)\n", cur, cur->start->x, cur->start->y, cur->end->x, cur->end->y); } # endif } }
false
false
false
false
false
0
hsw_pte_encode(dma_addr_t addr, enum i915_cache_level level, bool valid, u32 unused) { gen6_pte_t pte = valid ? GEN6_PTE_VALID : 0; pte |= HSW_PTE_ADDR_ENCODE(addr); if (level != I915_CACHE_NONE) pte |= HSW_WB_LLC_AGE3; return pte; }
false
false
false
false
false
0
find_method_in_class (MonoClass *klass, const char *name, const char *qname, const char *fqname, MonoMethodSignature *sig, MonoClass *from_class, MonoError *error) { int i; /* Search directly in the metadata to avoid calling setup_methods () */ mono_error_init (error); /* FIXME: !from_class->generic_class condition causes test failures. */ if (klass->type_token && !image_is_dynamic (klass->image) && !klass->methods && !klass->rank && klass == from_class && !from_class->generic_class) { for (i = 0; i < klass->method.count; ++i) { guint32 cols [MONO_METHOD_SIZE]; MonoMethod *method; const char *m_name; MonoMethodSignature *other_sig; mono_metadata_decode_table_row (klass->image, MONO_TABLE_METHOD, klass->method.first + i, cols, MONO_METHOD_SIZE); m_name = mono_metadata_string_heap (klass->image, cols [MONO_METHOD_NAME]); if (!((fqname && !strcmp (m_name, fqname)) || (qname && !strcmp (m_name, qname)) || (name && !strcmp (m_name, name)))) continue; method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (klass->method.first + i + 1), klass, NULL, error); if (!mono_error_ok (error)) //bail out if we hit a loader error return NULL; if (method) { other_sig = mono_method_signature_checked (method, error); if (!mono_error_ok (error)) //bail out if we hit a loader error return NULL; if (other_sig && (sig->call_convention != MONO_CALL_VARARG) && mono_metadata_signature_equal (sig, other_sig)) return method; } } } mono_class_setup_methods (klass); /* FIXME don't swallow the error here. */ /* We can't fail lookup of methods otherwise the runtime will fail with MissingMethodException instead of TypeLoadException. See mono/tests/generic-type-load-exception.2.il FIXME we should better report this error to the caller */ if (!klass->methods || klass->exception_type) { mono_error_set_type_load_class (error, klass, "Could not find method due to a type load error"); //FIXME get the error from the class return NULL; } for (i = 0; i < klass->method.count; ++i) { MonoMethod *m = klass->methods [i]; MonoMethodSignature *msig; /* We must cope with failing to load some of the types. */ if (!m) continue; if (!((fqname && !strcmp (m->name, fqname)) || (qname && !strcmp (m->name, qname)) || (name && !strcmp (m->name, name)))) continue; msig = mono_method_signature_checked (m, error); if (!mono_error_ok (error)) //bail out if we hit a loader error return NULL; if (!msig) continue; if (sig->call_convention == MONO_CALL_VARARG) { if (mono_metadata_signature_vararg_match (sig, msig)) break; } else { if (mono_metadata_signature_equal (sig, msig)) break; } } if (i < klass->method.count) return mono_class_get_method_by_index (from_class, i); return NULL; }
false
false
false
false
false
0
btrfs_bio_counter_sub(struct btrfs_fs_info *fs_info, s64 amount) { percpu_counter_sub(&fs_info->bio_counter, amount); if (waitqueue_active(&fs_info->replace_wait)) wake_up(&fs_info->replace_wait); }
false
false
false
false
false
0
vrrp_complete_init(void) { list l; element e; vrrp_t *vrrp; vrrp_sgroup_t *sgroup; /* Complete VRRP instance initialization */ l = vrrp_data->vrrp; for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) { vrrp = ELEMENT_DATA(e); if (!vrrp_complete_instance(vrrp)) return 0; } /* Build synchronization group index */ l = vrrp_data->vrrp_sync_group; for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) { sgroup = ELEMENT_DATA(e); vrrp_sync_set_group(sgroup); } return 1; }
false
false
false
false
false
0
G_SetClientFrame (edict_t *ent) { gclient_t *client; qboolean duck, run; if (ent->s.modelindex != 255) return; // not in the player model client = ent->client; if (client->ps.pmove.pm_flags & PMF_DUCKED) duck = true; else duck = false; if (xyspeed) run = true; else run = false; // check for stand/duck and stop/go transitions if (duck != client->anim_duck && client->anim_priority < ANIM_DEATH) goto newanim; if (run != client->anim_run && client->anim_priority == ANIM_BASIC) goto newanim; if (!ent->groundentity && client->anim_priority <= ANIM_WAVE) goto newanim; if(client->anim_priority == ANIM_REVERSE) { if(ent->s.frame > client->anim_end) { ent->s.frame--; return; } } else if (ent->s.frame < client->anim_end) { // continue an animation ent->s.frame++; return; } if (client->anim_priority == ANIM_DEATH) return; // stay there if (client->anim_priority == ANIM_JUMP) { if (!ent->groundentity) return; // stay there ent->client->anim_priority = ANIM_WAVE; ent->s.frame = FRAME_jump3; ent->client->anim_end = FRAME_jump6; return; } newanim: // return to either a running or standing frame client->anim_priority = ANIM_BASIC; client->anim_duck = duck; client->anim_run = run; if (!ent->groundentity) { client->anim_priority = ANIM_JUMP; if (ent->s.frame != FRAME_jump2) ent->s.frame = FRAME_jump1; client->anim_end = FRAME_jump2; } else if (run) { // running if (duck) { ent->s.frame = FRAME_crwalk1; client->anim_end = FRAME_crwalk6; } else { ent->s.frame = FRAME_run1; client->anim_end = FRAME_run6; } } else { // standing if (duck) { ent->s.frame = FRAME_crstnd01; client->anim_end = FRAME_crstnd19; } else { ent->s.frame = FRAME_stand01; client->anim_end = FRAME_stand40; } } }
false
false
false
false
false
0
load_option_file(const char *path) { struct io io = {}; /* It's OK that the file doesn't exist. */ if (!io_open(&io, "%s", path)) return; config_lineno = 0; config_errors = FALSE; if (io_load(&io, " \t", read_option) == ERR || config_errors == TRUE) warn("Errors while loading %s.", path); }
false
false
false
false
false
0
sim_ctl_get_portinfo(Client * cl, struct sim_ctl * ctl) { Port *p; uint8_t port_num = ctl->data[0]; if (port_num == 0 || port_num > cl->port->node->numports) p = cl->port; else if (cl->port->node->type == SWITCH_NODE) p = node_get_port(cl->port->node, port_num); else p = node_get_port(cl->port->node, port_num - 1); update_portinfo(p); memcpy(ctl->data, p->portinfo, sizeof(ctl->data)); return 0; }
false
false
false
false
false
0
hdp_free_application(struct hdp_application *app) { if (app->dbus_watcher > 0) g_dbus_remove_watch(app->conn, app->dbus_watcher); if (app->conn != NULL) dbus_connection_unref(app->conn); g_free(app->oname); g_free(app->description); g_free(app->path); g_free(app); }
false
false
false
false
false
0
extractChildren(tPPtr p, set<PPtr> & all) { if (p->children().empty()) return; for (PVector::const_iterator child = p->children().begin(); child != p->children().end(); ++child) { all.insert(*child); extractChildren(*child, all); } } }
false
false
false
false
false
0
GetOffersFor(PluginType type) { PluginsArray arr; // special case for MIME plugins // we 'll add the default MIME handler, last in the returned array cbPlugin* dflt = nullptr; for (unsigned int i = 0; i < m_Plugins.GetCount(); ++i) { cbPlugin* plug = m_Plugins[i]->plugin; if (plug && plug->IsAttached() && plug->GetType() == type) { if (type == ptMime) { // default MIME handler? if (((cbMimePlugin*)plug)->HandlesEverything()) dflt = plug; else arr.Add(plug); } else arr.Add(plug); } } // add default MIME handler last if (dflt) arr.Add(dflt); return arr; }
false
false
false
false
false
0
sparseset_equal_p (sparseset a, sparseset b) { SPARSESET_ELT_TYPE e; if (a == b) return true; if (sparseset_cardinality (a) != sparseset_cardinality (b)) return false; EXECUTE_IF_SET_IN_SPARSESET (a, e) if (!sparseset_bit_p (b, e)) return false; return true; }
false
false
false
false
false
0
ehset_probe(struct usb_interface *intf, const struct usb_device_id *id) { int ret = -EINVAL; struct usb_device *dev = interface_to_usbdev(intf); struct usb_device *hub_udev = dev->parent; struct usb_device_descriptor *buf; u8 portnum = dev->portnum; u16 test_pid = le16_to_cpu(dev->descriptor.idProduct); switch (test_pid) { case TEST_SE0_NAK_PID: ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST, (TEST_SE0_NAK << 8) | portnum, NULL, 0, 1000); break; case TEST_J_PID: ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST, (TEST_J << 8) | portnum, NULL, 0, 1000); break; case TEST_K_PID: ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST, (TEST_K << 8) | portnum, NULL, 0, 1000); break; case TEST_PACKET_PID: ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST, (TEST_PACKET << 8) | portnum, NULL, 0, 1000); break; case TEST_HS_HOST_PORT_SUSPEND_RESUME: /* Test: wait for 15secs -> suspend -> 15secs delay -> resume */ msleep(15 * 1000); ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_SUSPEND, portnum, NULL, 0, 1000); if (ret < 0) break; msleep(15 * 1000); ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_CLEAR_FEATURE, USB_RT_PORT, USB_PORT_FEAT_SUSPEND, portnum, NULL, 0, 1000); break; case TEST_SINGLE_STEP_GET_DEV_DESC: /* Test: wait for 15secs -> GetDescriptor request */ msleep(15 * 1000); buf = kmalloc(USB_DT_DEVICE_SIZE, GFP_KERNEL); if (!buf) return -ENOMEM; ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, USB_DT_DEVICE << 8, 0, buf, USB_DT_DEVICE_SIZE, USB_CTRL_GET_TIMEOUT); kfree(buf); break; case TEST_SINGLE_STEP_SET_FEATURE: /* * GetDescriptor SETUP request -> 15secs delay -> IN & STATUS * * Note, this test is only supported on root hubs since the * SetPortFeature handling can only be done inside the HCD's * hub_control callback function. */ if (hub_udev != dev->bus->root_hub) { dev_err(&intf->dev, "SINGLE_STEP_SET_FEATURE test only supported on root hub\n"); break; } ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST, (6 << 8) | portnum, NULL, 0, 60 * 1000); break; default: dev_err(&intf->dev, "%s: unsupported PID: 0x%x\n", __func__, test_pid); } return (ret < 0) ? ret : 0; }
false
false
false
false
false
0
simple_operation2(struct double_stack *stack, char op) { int ret; double operand1, operand2, result; ret = double_stack_pop(stack, &operand2); if (ret < 0) { error_msg("double_stack_pop"); return ret; } ret = double_stack_pop(stack, &operand1); if (ret < 0) { error_msg("double_stack_pop"); return ret; } switch (op) { case '+': result = operand1 + operand2; break; case '-': result = operand1 - operand2; break; case '*': result = operand1 * operand2; break; case '/': result = operand1 / operand2; break; default: error_msg("unknown operator '%c'", op); return -EINVAL; } return double_stack_push(stack, result); }
false
false
false
false
false
0
count_2352_bytes(cdrom_drive *d){ long i; for(i=2351;i>=0;i--) if(d->private_data->sg_buffer[i]!=(unsigned char)'\177') return(((i+3)>>2)<<2); return(0); }
false
false
false
false
false
0
gs_make_null_device(gx_device_null *dev_null, gx_device *dev, gs_memory_t * mem) { gx_device_init((gx_device *)dev_null, (const gx_device *)&gs_null_device, mem, true); gx_device_set_target((gx_device_forward *)dev_null, dev); if (dev) { /* The gx_device_copy_color_params() call below should probably copy over these new-style color mapping procs, as well as the old-style (map_rgb_color and friends). However, the change was made here instead, to minimize the potential impact of the patch. */ gx_device *dn = (gx_device *)dev_null; set_dev_proc(dn, get_color_mapping_procs, gx_forward_get_color_mapping_procs); set_dev_proc(dn, get_color_comp_index, gx_forward_get_color_comp_index); set_dev_proc(dn, encode_color, gx_forward_encode_color); set_dev_proc(dn, decode_color, gx_forward_decode_color); set_dev_proc(dn, get_profile, gx_forward_get_profile); set_dev_proc(dn, set_graphics_type_tag, gx_forward_set_graphics_type_tag); dn->graphics_type_tag = dev->graphics_type_tag; /* initialize to same as target */ gx_device_copy_color_params(dn, dev); } }
false
false
false
false
false
0
atStart() const { if (m_current.isEmpty()) return true; return m_current.offset() == 0 && m_current.node()->previousLeafNode() == 0; }
false
false
false
false
false
0
nxt_stop_sound(nxt_t *nxt) { nxt_pack_start(nxt,0x0C); test(nxt_con_send(nxt)); test(nxt_con_recv(nxt,3)); test(nxt_unpack_start(nxt,0x0C)); return nxt_unpack_error(nxt)==0?NXT_SUCC:NXT_FAIL; }
false
false
false
false
false
0
_rl_internal_char_cleanup () { #if defined (VI_MODE) /* In vi mode, when you exit insert mode, the cursor moves back over the previous character. We explicitly check for that here. */ if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap) rl_vi_check (); #endif /* VI_MODE */ if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read) { (*rl_redisplay_function) (); _rl_want_redisplay = 0; rl_newline (1, '\n'); } if (rl_done == 0) { (*rl_redisplay_function) (); _rl_want_redisplay = 0; } /* If the application writer has told us to erase the entire line if the only character typed was something bound to rl_newline, do so. */ if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline && rl_point == 0 && rl_end == 0) _rl_erase_entire_line (); }
false
false
false
false
false
0
type_passed_as (Parameter *arg) { tree arg_type = arg->type->toCtype(); if (arg_reference_p (arg)) arg_type = build_reference_type (arg_type); else if (arg->storageClass & STClazy) { TypeFunction *tf = new TypeFunction (NULL, arg->type, false, LINKd); TypeDelegate *t = new TypeDelegate (tf); arg_type = t->merge()->toCtype(); } return arg_type; }
false
false
false
false
false
0