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
xgbe_config_dma_bus(struct xgbe_prv_data *pdata) { /* Set enhanced addressing mode */ XGMAC_IOWRITE_BITS(pdata, DMA_SBMR, EAME, 1); /* Set the System Bus mode */ XGMAC_IOWRITE_BITS(pdata, DMA_SBMR, UNDEF, 1); XGMAC_IOWRITE_BITS(pdata, DMA_SBMR, BLEN_256, 1); }
false
false
false
false
false
0
netsys_timer_delete(value timer) { #if defined(HAVE_CLOCK) && defined(HAVE_POSIX_TIMER) timer_t tm; int code; switch (Tag_val(Field(timer, 0))) { case 0: /* POSIX timer */ extract_timer(Field(Field(timer, 0), 0), &tm); code = timer_delete(tm); if (code == -1) uerror("timer_delete", Nothing); break; #ifdef HAVE_TIMERFD case 1: /* TIMERFD */ netsys_destroy_not_event(Field(timer, 1)); break; #endif } return Val_unit; #else invalid_argument("Netsys_posix.timer_delete not available"); #endif }
false
false
false
false
false
0
gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs, tree ref, bool write_p, gimple stmt) { tree base, step; HOST_WIDE_INT delta; struct mem_ref_group *agrp; if (get_base_address (ref) == NULL) return false; if (!analyze_ref (loop, &ref, &base, &step, &delta, stmt)) return false; /* If analyze_ref fails the default is a NULL_TREE. We can stop here. */ if (step == NULL_TREE) return false; /* Stop if the address of BASE could not be taken. */ if (may_be_nonaddressable_p (base)) return false; /* Limit non-constant step prefetching only to the innermost loops and only when the step is loop invariant in the entire loop nest. */ if (!cst_and_fits_in_hwi (step)) { if (loop->inner != NULL) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Memory expression %p\n",(void *) ref ); print_generic_expr (dump_file, ref, TDF_TREE); fprintf (dump_file,":"); dump_mem_details( dump_file, base, step, delta, write_p); fprintf (dump_file, "Ignoring %p, non-constant step prefetching is " "limited to inner most loops \n", (void *) ref); } return false; } else { if (!expr_invariant_in_loop_p (loop_outermost (loop), step)) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Memory expression %p\n",(void *) ref ); print_generic_expr (dump_file, ref, TDF_TREE); fprintf (dump_file,":"); dump_mem_details(dump_file, base, step, delta, write_p); fprintf (dump_file, "Not prefetching, ignoring %p due to " "loop variant step\n", (void *) ref); } return false; } } } /* Now we know that REF = &BASE + STEP * iter + DELTA, where DELTA and STEP are integer constants. */ agrp = find_or_create_group (refs, base, step); record_ref (agrp, stmt, ref, delta, write_p); return true; }
false
false
false
false
false
0
column(double f(double), unsigned int n) const { // must copy data std::vector<double> value(m_data.at(0).size()); unsigned int col(n); if (col < 1 || m_data.size() < col) { if (0 < m_data.size()) { epix_warning("Out of range argument to data_file::column()"); col=1; } else { epix_warning("data_file::column() requested for empty file"); std::vector<double> err_val(1, 0); return err_val; } } for (unsigned int i=0; i<m_data.at(0).size(); ++i) value.at(i) = f(m_data.at(col-1).at(i)); return value; }
false
false
false
false
false
0
startree_check_inverse_perm(startree_t* s) { // ensure that each value appears exactly once. int i, N; uint8_t* counts; N = Ndata(s); counts = calloc(Ndata(s), sizeof(uint8_t)); for (i=0; i<N; i++) { assert(s->inverse_perm[i] >= 0); assert(s->inverse_perm[i] < N); counts[s->inverse_perm[i]]++; } for (i=0; i<N; i++) { assert(counts[i] == 1); } return 0; }
false
false
false
false
false
0
set_scrub_rate(struct mem_ctl_info *mci, u32 bw) { struct amd64_pvt *pvt = mci->pvt_info; u32 min_scrubrate = 0x5; if (pvt->fam == 0xf) min_scrubrate = 0x0; if (pvt->fam == 0x15) { /* Erratum #505 */ if (pvt->model < 0x10) f15h_select_dct(pvt, 0); if (pvt->model == 0x60) min_scrubrate = 0x6; } return __set_scrub_rate(pvt, bw, min_scrubrate); }
false
false
false
false
false
0
notify(SoNotList *list) // //////////////////////////////////////////////////////////////////////// { if (getNumChildren() != nchildren) { nchildren = getNumChildren(); childrenSensor->schedule(); } SoNotRec *rec = list->getFirstRec(); // only interested in a field-to-container notification if (rec->getType() == SoNotRec::CONTAINER && rec->getBase() == this && list->getLastField() == &whichChild) { whichChildSensor->schedule(); } SoSwitch::notify(list); }
false
false
false
false
false
0
stPinchThreadSet_getLabelIntervalsP(stPinchThread *thread, stHash *pinchEndsToLabels, stSortedSet *pinchIntervals) { stPinchSegment *segment = stPinchThread_getFirst(thread); if (segment == NULL) { return; } int64_t start = stPinchSegment_getStart(segment); void *label = NULL; do { stPinchBlock *block; while ((block = stPinchSegment_getBlock(segment)) == NULL) { segment = stPinchSegment_get3Prime(segment); if (segment == NULL) { stPinchThreadSet_getLabelIntervalsP2(thread, pinchIntervals, start, label); return; } } stPinchEnd pinchEnd = stPinchEnd_constructStatic(block, !stPinchSegment_getBlockOrientation(segment)); void *label2 = stHash_search(pinchEndsToLabels, &pinchEnd); assert(label2 != NULL); if (label == NULL) { pinchEnd.orientation = !pinchEnd.orientation; label = stHash_search(pinchEndsToLabels, &pinchEnd); assert(label != NULL); } #ifndef NDEBUG else { pinchEnd.orientation = !pinchEnd.orientation; assert(label == stHash_search(pinchEndsToLabels, &pinchEnd)); } #endif if (label != label2) { int64_t end = stPinchSegment_getStart(segment) + stPinchSegment_getLength(segment) / 2; if (start < end) { stSortedSet_insert(pinchIntervals, stPinchInterval_construct(stPinchThread_getName(thread), start, end - start, label)); } start = end; label = label2; } segment = stPinchSegment_get3Prime(segment); } while (segment != NULL); stPinchThreadSet_getLabelIntervalsP2(thread, pinchIntervals, start, label); }
false
false
false
false
false
0
fish_escape (FishItem *fishitem) { item2del_list = g_list_append (item2del_list, fishitem); gc_sound_play_ogg ("sounds/youcannot.wav", NULL); if (gcomprisBoard->sublevel) { --gcomprisBoard->sublevel; gc_score_set(gcomprisBoard->sublevel); } }
false
false
false
false
false
0
find_right_word_border(int idx) { if (idx == -1) { return -1; } while (idx < corpus_info.array_size - 2) { int val; idx ++; val = ntohl(corpus_info.array[idx * 2]); if (val & ELM_BOS) { return -1; } if (val & ELM_WORD_BORDER) { return idx; } } return -1; }
false
false
false
false
false
0
CuAssertDblEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, double expected, double actual, double delta) { char buf[STRING_MAX]; if (fabs(expected - actual) <= delta) return; sprintf(buf, "expected <%f> but was <%f>", expected, actual); CuFail_Line(tc, file, line, message, buf); }
false
false
false
false
false
0
findFromMode( const QString& path /*only used if is_local_file*/, mode_t mode /*0 if unknown*/, bool is_local_file ) { if ( is_local_file && (mode == 0 || mode == (mode_t)-1) ) { KDE_struct_stat buff; if ( KDE::stat( path, &buff ) != -1 ) mode = buff.st_mode; } if ( S_ISDIR( mode ) ) { // KDE4 TODO: use an overlay instead #if 0 // Special hack for local files. We want to see whether we // are allowed to enter the directory if ( is_local_file ) { if ( KDE::access( path, R_OK ) == -1 ) return KMimeType::mimeType( "inode/directory-locked" ); } #endif return KMimeType::mimeType( QLatin1String("inode/directory") ); } if ( S_ISCHR( mode ) ) return KMimeType::mimeType( QLatin1String("inode/chardevice") ); if ( S_ISBLK( mode ) ) return KMimeType::mimeType( QLatin1String("inode/blockdevice") ); if ( S_ISFIFO( mode ) ) return KMimeType::mimeType( QLatin1String("inode/fifo") ); if ( S_ISSOCK( mode ) ) return KMimeType::mimeType( QLatin1String("inode/socket") ); #ifdef Q_OS_WIN // FIXME: distinguish between mounted & unmounted int size = path.size(); if ( size == 2 || size == 3 ) { //GetDriveTypeW is not defined in wince #ifndef _WIN32_WCE unsigned int type = GetDriveTypeW( (LPCWSTR) path.utf16() ); switch( type ) { case DRIVE_REMOVABLE: return KMimeType::mimeType( QLatin1String("media/floppy_mounted") ); case DRIVE_FIXED: return KMimeType::mimeType( QLatin1String("media/hdd_mounted") ); case DRIVE_REMOTE: return KMimeType::mimeType( QLatin1String("media/smb_mounted") ); case DRIVE_CDROM: return KMimeType::mimeType( QLatin1String("media/cdrom_mounted") ); case DRIVE_RAMDISK: return KMimeType::mimeType( QLatin1String("media/hdd_mounted") ); default: break; }; #else return KMimeType::mimeType( QLatin1String("media/hdd_mounted") ); #endif } #endif // remote executable file? stop here (otherwise findFromContent can do that better for local files) if ( !is_local_file && S_ISREG( mode ) && ( mode & ( S_IXUSR | S_IXGRP | S_IXOTH ) ) ) return KMimeType::mimeType( QLatin1String("application/x-executable") ); return KMimeType::Ptr(); }
false
false
false
false
false
0
mapAllowDenyList( List(TSrvCfgClientClass) clientClassLst) { // Log(Info)<<"Mapping allow, deny list inside interface "<<Name<<LogEnd; SPtr<TSrvCfgAddrClass> ptrClass; this->SrvCfgAddrClassLst.first(); while(ptrClass=SrvCfgAddrClassLst.get()){ ptrClass->mapAllowDenyList(clientClassLst); } // Map the Allow and Deny list to TA c SPtr<TSrvCfgTA> ptrTA; this->SrvCfgTALst.first(); while(ptrTA = SrvCfgTALst.get()){ ptrTA->mapAllowDenyList(clientClassLst); } // Map the Allow and Deny list to prefix SPtr<TSrvCfgPD> ptrPD; this->SrvCfgPDLst.first(); while(ptrPD = SrvCfgPDLst.get()){ ptrPD->mapAllowDenyList(clientClassLst); } }
false
false
false
false
false
0
unlink(void) { if(engine) { if(engine->windows == this) engine->windows = next; if(engine->surface() == surface) surface = NULL; } if(next) next->prev = prev; if(prev) prev->next = next; }
false
false
false
false
false
0
c_tmap_scanline_per_nolight() { ubyte *dest; uint c; int x, index = fx_xleft + (bytes_per_row * fx_y); fix u,v,z,dudx, dvdx, dzdx; u = fx_u; v = fx_v*64; z = fx_z; dudx = fx_du_dx; dvdx = fx_dv_dx*64; dzdx = fx_dz_dx; dest = (ubyte *)(write_buffer + fx_xleft + (bytes_per_row * fx_y) ); if (!Transparency_on) { for (x= fx_xright-fx_xleft+1 ; x > 0; --x ) { if (++index >= SWIDTH*SHEIGHT) return; *dest++ = (uint)pixptr[ ( (v/z)&(64*63) ) + ((u/z)&63) ]; u += dudx; v += dvdx; z += dzdx; } } else { for (x= fx_xright-fx_xleft+1 ; x > 0; --x ) { if (++index >= SWIDTH*SHEIGHT) return; c = (uint)pixptr[ ( (v/z)&(64*63) ) + ((u/z)&63) ]; if ( c!=255) *dest = c; dest++; u += dudx; v += dvdx; z += dzdx; } } }
false
false
false
false
false
0
configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) { if(bheading_auto_calc){ num_heading = (tree_scroll->allocation.height - 12) / (font_height + 10); if(num_heading < 1) num_heading = 1; } else { num_heading = max_heading; } return(FALSE); }
false
false
false
false
false
0
dma_variable_packet_free (DmaVariablePacket* pack) { if (pack->data != NULL) { /* Remove from packet data list */ DmaVariablePacket **find; for (find = &pack->data->packet; *find != NULL; find = &(*find)->next) { if (*find == pack) { *find = pack->next; break; } } } gtk_tree_row_reference_free (pack->reference); g_free (pack); }
false
false
false
false
false
0
elvin_subscription_set_expr (Subscription *subscription, const char *subscription_expr) { alloc_message (sub_mod_rqst); alloc_message (sub_rply); avis_message_init (sub_mod_rqst, MESSAGE_ID_SUB_MOD_RQST, subscription->id, subscription_expr, subscription->security, EMPTY_KEYS, EMPTY_KEYS); if (send_and_receive (subscription->elvin, sub_mod_rqst, sub_rply, MESSAGE_ID_SUB_RPLY)) { free (subscription->subscription_expr); subscription->subscription_expr = estrdup (subscription_expr); /* no free needed for sub_rply */ return true; } else { return false; } }
false
false
false
false
false
0
be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q, u16 len, u16 entry_size) { struct be_dma_mem *mem = &q->dma_mem; memset(q, 0, sizeof(*q)); q->len = len; q->entry_size = entry_size; mem->size = len * entry_size; mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, GFP_KERNEL); if (!mem->va) return -ENOMEM; return 0; }
false
false
false
false
false
0
number_blocks (tree fn) { int i; int n_blocks; tree *block_vector; /* For SDB and XCOFF debugging output, we start numbering the blocks from 1 within each function, rather than keeping a running count. */ #if defined (SDB_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG) next_block_index = 1; #endif block_vector = get_block_vector (DECL_INITIAL (fn), &n_blocks); /* The top-level BLOCK isn't numbered at all. */ for (i = 1; i < n_blocks; ++i) /* We number the blocks from two. */ BLOCK_NUMBER (block_vector[i]) = next_block_index++; free (block_vector); return; }
false
false
false
false
false
0
GetData(void) { TclData *dataPtr; int tid, new; dataPtr = Ns_TlsGet(&tls); if (dataPtr == NULL) { dataPtr = ns_malloc(sizeof(TclData)); dataPtr->cancel = Tcl_AsyncCreate(AsyncCancel, NULL); Tcl_InitHashTable(&dataPtr->interps, TCL_ONE_WORD_KEYS); tid = Ns_ThreadId(); Ns_MutexLock(&tlock); dataPtr->hPtr = Tcl_CreateHashEntry(&threads, (char *) tid, &new); Tcl_SetHashValue(dataPtr->hPtr, dataPtr); Ns_MutexUnlock(&tlock); Ns_TlsSet(&tls, dataPtr); } return dataPtr; }
false
false
false
false
false
0
glfwGetInstanceProcAddress(VkInstance instance, const char* procname) { GLFWvkproc proc; assert(procname != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER)) return NULL; proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname); #if defined(_GLFW_VULKAN_STATIC) if (!proc) { if (strcmp(procname, "vkGetInstanceProcAddr") == 0) return (GLFWvkproc) vkGetInstanceProcAddr; } #else if (!proc) proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname); #endif return proc; }
false
false
false
false
false
0
NITFExtractMetadata( char ***ppapszMetadata, const char *pachHeader, int nStart, int nLength, const char *pszName ) { char szWork[400]; char* pszWork; if (nLength >= sizeof(szWork) - 1) pszWork = (char*)CPLMalloc(nLength + 1); else pszWork = szWork; /* trim white space */ while( nLength > 0 && pachHeader[nStart + nLength - 1] == ' ' ) nLength--; memcpy( pszWork, pachHeader + nStart, nLength ); pszWork[nLength] = '\0'; *ppapszMetadata = CSLSetNameValue( *ppapszMetadata, pszName, pszWork ); if (szWork != pszWork) CPLFree(pszWork); }
true
true
false
false
true
1
sis190_alloc_rx_iob(struct RxDesc *desc) { struct io_buffer *iob; iob = alloc_iob(RX_BUF_SIZE); if (iob) { u32 mapping; mapping = virt_to_bus(iob->data); sis190_map_to_asic(desc, mapping); } else { DBG("sis190: alloc_iob failed\n"); sis190_make_unusable_by_asic(desc); } return iob; }
false
false
false
false
false
0
skipmnemonic (char *rcline) { char *help = rcline; while(*help != '\0') { /* leading spaces */ if (isgap(*help)) help++; else break; } while(*help != '\0') { if (!isspace(OFstatic_cast(unsigned char, *help))) help++; /* Mnemonic */ else break; } while(*help != '\0') { if (isgap(*help)) help++; /* Gap */ else break; } return(help); }
false
false
false
false
false
0
CmdVerbatim(int code) /****************************************************************************** convert characters 1:1 until \end{verbatim} or \end{Verbatim} is reached VERBATIM_1 for \begin{verbatim} ... \end{verbatim} VERBATIM_2 for \begin{Verbatim} ... \end{Verbatim} ******************************************************************************/ { char *verbatim_text, *endtag=NULL; /* int num; */ int true_code = code & ~ON; if (code & ON) { diagnostics(4, "Entering CmdVerbatim"); if (true_code != VERBATIM_4) { PushEnvironment(VERBATIM_MODE); CmdEndParagraph(0); CmdIndent(INDENT_NONE); startParagraph("verbatim", PARAGRAPH_GENERIC); } switch (true_code) { case VERBATIM_1: endtag = strdup("\\end{verbatim}"); break; case VERBATIM_2: endtag = strdup("\\end{Verbatim}"); break; case VERBATIM_3: endtag = strdup("\\end{alltt}"); break; case VERBATIM_4: endtag = strdup("\\end{comment}"); break; } verbatim_text = getTexUntil(endtag, 1); UpdateLineNumber(verbatim_text); if (true_code == VERBATIM_3) /* alltt environment */ ConvertAllttString(verbatim_text); else if (true_code == VERBATIM_1 || true_code == VERBATIM_2) { show_string(5, verbatim_text, "verbatim"); putRtfStrEscaped(verbatim_text); } free(verbatim_text); ConvertString(endtag); free(endtag); } else { diagnostics(4, "Exiting CmdVerbatim"); if (true_code != VERBATIM_4) { PopEnvironment(); CmdEndParagraph(0); CmdVspace(VSPACE_SMALL_SKIP); skipWhiteSpace(); } } }
false
false
false
false
false
0
gcr_trust_add_pinned_certificate_async (GcrCertificate *certificate, const gchar *purpose, const gchar *peer, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult *async; trust_closure *closure; g_return_if_fail (GCR_IS_CERTIFICATE (certificate)); g_return_if_fail (purpose); g_return_if_fail (peer); async = g_simple_async_result_new (NULL, callback, user_data, gcr_trust_add_pinned_certificate_async); closure = g_new0 (trust_closure, 1); closure->attrs = prepare_add_pinned_certificate (certificate, purpose, peer); g_return_if_fail (closure->attrs); g_simple_async_result_set_op_res_gpointer (async, closure, trust_closure_free); g_simple_async_result_run_in_thread (async, thread_add_pinned_certificate, G_PRIORITY_DEFAULT, cancellable); g_object_unref (async); }
false
false
false
false
false
0
notail() const { size_t p = rfind( '/' ); return ( p == String::npos ) ? "" : substr( 0, p ); }
false
false
false
false
false
0
exfat_stat(const struct exfat* ef, const struct exfat_node* node, struct stat* stbuf) { memset(stbuf, 0, sizeof(struct stat)); if (node->flags & EXFAT_ATTRIB_DIR) stbuf->st_mode = S_IFDIR | (0777 & ~ef->dmask); else stbuf->st_mode = S_IFREG | (0777 & ~ef->fmask); stbuf->st_nlink = 1; stbuf->st_uid = ef->uid; stbuf->st_gid = ef->gid; stbuf->st_size = node->size; stbuf->st_blocks = DIV_ROUND_UP(node->size, CLUSTER_SIZE(*ef->sb)) * CLUSTER_SIZE(*ef->sb) / 512; stbuf->st_mtime = node->mtime; stbuf->st_atime = node->atime; /* set ctime to mtime to ensure we don't break programs that rely on ctime (e.g. rsync) */ stbuf->st_ctime = node->mtime; }
false
false
false
false
false
0
smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw) { int cert_peer = (kw[4] == 'c') ? 1 : 0; X509 *crt; int nid; struct connection *conn; if (!l4) return 0; conn = objt_conn(l4->si[0].end); if (!conn || conn->xprt != &ssl_sock) return 0; if (!(conn->flags & CO_FL_CONNECTED)) { smp->flags |= SMP_F_MAY_CHANGE; return 0; } if (cert_peer) crt = SSL_get_peer_certificate(conn->xprt_ctx); else crt = SSL_get_certificate(conn->xprt_ctx); if (!crt) return 0; nid = OBJ_obj2nid((ASN1_OBJECT *)(crt->cert_info->signature->algorithm)); smp->data.str.str = (char *)OBJ_nid2sn(nid); if (!smp->data.str.str) { /* SSL_get_peer_certificate increase X509 * ref count */ if (cert_peer) X509_free(crt); return 0; } smp->type = SMP_T_STR; smp->flags |= SMP_F_CONST; smp->data.str.len = strlen(smp->data.str.str); /* SSL_get_peer_certificate increase X509 * ref count */ if (cert_peer) X509_free(crt); return 1; }
false
false
false
false
false
0
__igb_close(struct net_device *netdev, bool suspending) { struct igb_adapter *adapter = netdev_priv(netdev); struct pci_dev *pdev = adapter->pdev; WARN_ON(test_bit(__IGB_RESETTING, &adapter->state)); if (!suspending) pm_runtime_get_sync(&pdev->dev); igb_down(adapter); igb_free_irq(adapter); igb_free_all_tx_resources(adapter); igb_free_all_rx_resources(adapter); if (!suspending) pm_runtime_put_sync(&pdev->dev); return 0; }
false
false
false
false
false
0
InvalidateTSCacheCallBack(Datum arg, int cacheid, ItemPointer tuplePtr) { HTAB *hash = (HTAB *) DatumGetPointer(arg); HASH_SEQ_STATUS status; TSAnyCacheEntry *entry; hash_seq_init(&status, hash); while ((entry = (TSAnyCacheEntry *) hash_seq_search(&status)) != NULL) entry->isvalid = false; /* Also invalidate the current-config cache if it's pg_ts_config */ if (hash == TSConfigCacheHash) TSCurrentConfigCache = InvalidOid; }
false
false
false
false
false
0
ParsePayloadTypeParameters(const buzz::XmlElement* element, std::map<std::string, std::string>* paramap) { for (const buzz::XmlElement* param = element->FirstNamed(QN_PARAMETER); param != NULL; param = param->NextNamed(QN_PARAMETER)) { std::string name = GetXmlAttr(param, QN_PAYLOADTYPE_PARAMETER_NAME, buzz::STR_EMPTY); std::string value = GetXmlAttr(param, QN_PAYLOADTYPE_PARAMETER_VALUE, buzz::STR_EMPTY); if (!name.empty() && !value.empty()) { paramap->insert(make_pair(name, value)); } } }
false
false
false
false
false
0
gt_strgraph_largest_count(GtStrgraph *strgraph) { GtStrgraphCount count, maxcount; GtStrgraphVnum i; maxcount = 0; for (i = 0; i < (GT_STRGRAPH_NOFVERTICES(strgraph)); i++) { count = GT_STRGRAPH_GET_COUNT(strgraph, i); if (count > maxcount) maxcount = count; } return maxcount; }
false
false
false
false
false
0
xyexponent_changed_cb(GtkWidget *combo, CCViewControls *controls) { CCViewArgs *args = controls->args; if (controls->in_update) return; controls->in_update = TRUE; args->xyexponent = gwy_enum_combo_box_get_active(GTK_COMBO_BOX(combo)); args->xoffset = gtk_adjustment_get_value(GTK_ADJUSTMENT(controls->xoffset)) * pow10(args->xyexponent); args->yoffset = gtk_adjustment_get_value(GTK_ADJUSTMENT(controls->yoffset)) * pow10(args->xyexponent); //simple_dialog_update(controls, args); controls->in_update = FALSE; }
false
false
false
false
false
0
startElement( const QString& /* namespaceURI */, const QString& /* localName */, const QString& qName, const QXmlAttributes& atts ) { int number; bool ret = true; if( qName == "scenario" && _state == StateInit ) { _state = StateDocument; _otherCpt = 0; _desc->clear(); _desc->setNbPlayers( atts.value( "nbPlayer" ).toInt() ); } else if( qName == "attalversion" && _state == StateDocument ) { _state = StateAttalVersion; } else if( qName == "name" && _state == StateDocument ) { _state = StateName; } else if( qName == "description" && _state == StateDocument ) { _state = StateDescription; } else if( qName == "calendar" && _state == StateDocument ) { _state = StateCalendar; } else if( qName == "value" && _state == StateCalendar ) { _state = StateCalendarDate; number = atts.value( "type" ).toInt(); } else if( qName == "startcalendar" && _state == StateCalendar ) { _state = StateCalendarStart; } else if( qName == "value" && _state == StateCalendarStart ) { _state = StateCalendarStartDate; number = atts.value( "type" ).toInt(); } else if( qName == "turn" && _state == StateCalendar ) { _state = StateCalendarTurn; } else if( qName == "map" && _state == StateDocument ) { _state = StateMap; } else if( qName == "width" && _state == StateMap ) { _state = StateWidth; } else if( qName == "height" && _state == StateMap ) { _state = StateHeight; } else if( ( _state == StateDocument ) || ( _state == StateDocumentOther ) ) { _state = StateDocumentOther; _otherCpt++; } else if( ( _state == StateMap ) || ( _state == StateMapOther ) ) { _state = StateMapOther; _otherCpt++; } return ret; }
false
false
false
false
false
0
tick_nohz_update_jiffies(ktime_t now) { unsigned long flags; __this_cpu_write(tick_cpu_sched.idle_waketime, now); local_irq_save(flags); tick_do_update_jiffies64(now); local_irq_restore(flags); touch_softlockup_watchdog(); }
false
false
false
false
false
0
vm_get_game_arg(int argc, const char *const *argv, char *buf, size_t buflen) { int i; const char *restore_file; /* presume we won't find a file to restore */ restore_file = 0; /* * Scan the arguments for the union of the TADS 2 and TADS 3 command * line options. Start at the second element of the argument vector, * since the first element is the executable name. Keep going until * we run out of options, each of which must start with a '-'. * * Note that we don't care about the meanings of the options - we * simply want to skip past them. This is more complicated than * merely looking for the first argument without a '-' prefix, because * some of the options allow arguments, and an option argument can * sometimes - depending on the argument - take the next position in * the argument vector after the option itself. So, we must determine * the meaning of each option well enough that we can tell whether or * not the next argv element after the option is part of the option. */ for (i = 1 ; i < argc && argv[i][0] == '-' ; ++i) { /* * check the first character after the hyphen to determine which * option we have */ switch(argv[i][1]) { case 'b': /* * tads 3 "-banner" (no arguments, so just consume it and * continue) */ break; case 'c': /* * tads 3 "-cs charset" or "-csl charset"; tads 2 "-ctab-" or * "-ctab tab" */ if (strcmp(argv[i], "-ctab") == 0 || strcmp(argv[i], "-cs") == 0 || strcmp(argv[i], "-csl") == 0) { /* there's another argument giving the filename */ ++i; } break; case 'd': /* tads 2 "-double[+-]" (no arguments) */ break; case 'm': /* tads 2 "-msSize", "-mhSize", "-mSize" */ switch(argv[i][2]) { case 's': case 'h': /* * argument required - if nothing follows the second * letter, consume the next vector item as the option * argument */ if (argv[i][3] == '\0') ++i; break; case '\0': /* * argument required, but nothing follows the "-m" - * consume the next vector item */ ++i; break; default: /* argument required and present */ break; } break; case 't': /* tads 2 "-tfFile", "-tsSize", "-tp[+-]", "-t[+0]" */ switch(argv[i][2]) { case 'f': case 's': /* * argument required - consume the next vector item if * nothing is attached to this item */ if (argv[i][3] == '\0') ++i; break; case 'p': /* no arguments */ break; default: /* no arguments */ break; } break; case 'u': /* * tads 2 "-uSize" - argument required, so consume the next * vector item if necessary */ if (argv[i][2] == '\0') ++i; break; case 'n': /* tads 3 "-nobanner" - no arguments */ break; case 's': /* * tads 2/3 "-s#" (#=0,1,2,3,4); in tads 2, the # can be * separated by a space from the -s, so we'll allow it this * way in general */ if (argv[i][2] == '\0') ++i; break; case 'i': /* tads 2/3 "-iFile" - consume an argument */ if (argv[i][2] == '\0') ++i; break; case 'l': /* tads 2/3 "-lFile" - consume an argument */ if (argv[i][2] == '\0') ++i; break; case 'o': /* tads 2/3 "-oFile" - consume an argument */ if (argv[i][2] == '\0') ++i; break; case 'p': /* tads 2/3 "-plain"; tads 2 "-p[+-]" - no arguments */ break; case 'R': /* tads 3 '-Rdir' - consume an argument */ if (argv[i][2] == '\0') ++i; break; case 'r': /* tads 2/3 "-rFile" - consume an argument */ if (argv[i][2] != '\0') { /* the file to be restored is appended to the "-r" */ restore_file = argv[i] + 2; } else { /* the file to be restored is the next argument */ ++i; restore_file = argv[i]; } break; } } /* * We have no more options, so the next argument is the game filename. * If we're out of argv elements, then no game filename was directly * specified, in which case we'll try looking for a file spec in the * restore file, if present. */ if (i < argc) { /* there's a game file argument - copy it to the caller's buffer */ strcpy_limit(buf, argv[i], buflen); /* return success */ return TRUE; } else if (restore_file != 0) { /* * There's no game file argument, but there is a restore file * argument. Try identifying the game file from the original game * file specification stored in the saved state file. */ return vm_get_game_file_from_savefile(restore_file, buf, buflen); } else { /* * there's no game file or restore file argument, so they've given * us nothing to go on - there's no game file */ return FALSE; } }
false
false
false
false
false
0
ShowDialog(const wxString& xrc, const wxString& dlgName, const wxString& callback) { wxString actual = ConfigManager::LocateDataFile(xrc, sdScriptsUser | sdScriptsGlobal); // Manager::Get()->GetLogManager()->DebugLog(F(_T("Original parameter is: ") + xrc)); Manager::Get()->GetLogManager()->DebugLog(_T("Loading XRC: ") + actual); if (wxXmlResource::Get()->Load(actual)) { XrcDialog* old = s_ActiveDialog; try { s_ActiveDialog = new XrcDialog(nullptr, dlgName, callback); int ret = s_ActiveDialog->ShowModal(); delete s_ActiveDialog; s_ActiveDialog = old; #if wxABI_VERSION > 20601 wxXmlResource::Get()->Unload(actual); #endif return ret; } catch (cbException& e) { cbMessageBox(wxString::Format(_("Dialog \"%s\" not found...\n\nActual resource: \"%s\"\nOriginal resource: \"%s\""), dlgName.c_str(), actual.c_str(), xrc.c_str()), _("Error"), wxICON_ERROR); } } return -1; }
false
false
false
false
false
0
suggestions(const QString& word) const { QStringList result; if (!d) { return result; } QString check = word; check.replace(QChar(0x2019), QLatin1Char('\'')); QByteArray word_utf8 = check.toUtf8(); size_t count; char** suggestions = enchant_dict_suggest((*d)->dictionary(), word_utf8.constData(), word_utf8.length(), &count); if (suggestions && count) { for (size_t i = 0; i < count; ++i) { QString word = QString::fromUtf8(suggestions[i]); if (SmartQuotes::isEnabled()) { SmartQuotes::replace(word); } result.append(word); } enchant_dict_free_string_list((*d)->dictionary(), suggestions); } return result; }
false
false
false
false
false
0
ungrab() { if (! --m_server_grabs) XUngrabServer(display()); if (m_server_grabs < 0) m_server_grabs = 0; }
false
false
false
false
false
0
SDL_VIDEO_QuitSDL(void) { #if HAVE_OPENGL if (currently_opengl) SDL_VIDEO_GL_Cleanup(); #endif SDL_VIDEO_screen = NULL; SDL_QuitSubSystem(SDL_INIT_VIDEO); }
false
false
false
false
false
0
is_64bit_pcrel_reloc (unsigned int reloc_type) { switch (elf_header.e_machine) { case EM_ALPHA: return reloc_type == 11; /* R_ALPHA_SREL64 */ case EM_IA_64: return reloc_type == 0x4f; /* R_IA64_PCREL64LSB */ case EM_PARISC: return reloc_type == 72; /* R_PARISC_PCREL64 */ case EM_PPC64: return reloc_type == 44; /* R_PPC64_REL64 */ case EM_SPARC32PLUS: case EM_SPARCV9: case EM_SPARC: return reloc_type == 46; /* R_SPARC_DISP64 */ case EM_X86_64: case EM_L1OM: return reloc_type == 24; /* R_X86_64_PC64 */ case EM_S390_OLD: case EM_S390: return reloc_type == 23; /* R_S390_PC64 */ default: return FALSE; } }
false
false
false
false
false
0
match_pci_dev_by_id(struct device *dev, void *data) { struct pci_dev *pdev = to_pci_dev(dev); struct pci_device_id *id = data; if (pci_match_one_device(id, pdev)) return 1; return 0; }
false
false
false
false
false
0
PostGarbageCollectionProcessing() { // Process weak global handle callbacks. This must be done after the // GC is completely done, because the callbacks may invoke arbitrary // API functions. // At the same time deallocate all DESTROYED nodes. ASSERT(Heap::gc_state() == Heap::NOT_IN_GC); const int initial_post_gc_processing_count = ++post_gc_processing_count; bool next_gc_likely_to_collect_more = false; Node** p = &head_; while (*p != NULL) { if ((*p)->PostGarbageCollectionProcessing()) { if (initial_post_gc_processing_count != post_gc_processing_count) { // Weak callback triggered another GC and another round of // PostGarbageCollection processing. The current node might // have been deleted in that round, so we need to bail out (or // restart the processing). break; } } if ((*p)->state_ == Node::DESTROYED) { // Delete the link. Node* node = *p; *p = node->next(); // Update the link. if (first_deallocated()) { first_deallocated()->set_next(node); } node->set_next_free(first_deallocated()); set_first_deallocated(node); next_gc_likely_to_collect_more = true; } else { p = (*p)->next_addr(); } } set_first_free(NULL); if (first_deallocated()) { first_deallocated()->set_next(head()); } return next_gc_likely_to_collect_more; }
false
false
false
false
false
0
digitv_alps_tded4_tuner_calc_regs(struct dvb_frontend *fe, u8 *pllbuf, int buf_len) { u32 div; struct dtv_frontend_properties *c = &fe->dtv_property_cache; if (buf_len < 5) return -EINVAL; div = (((c->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; pllbuf[0] = 0x61; pllbuf[1] = (div >> 8) & 0x7F; pllbuf[2] = div & 0xFF; pllbuf[3] = 0x85; dprintk("frequency %u, div %u\n", c->frequency, div); if (c->frequency < 470000000) pllbuf[4] = 0x02; else if (c->frequency > 823000000) pllbuf[4] = 0x88; else pllbuf[4] = 0x08; if (c->bandwidth_hz == 8000000) pllbuf[4] |= 0x04; return 5; }
false
false
false
false
false
0
art_search(long *arts, long n_arts, long no) { long i; for (i = 0 ; i < n_arts ; i++) if (arts[i] == no) return i; return -1; }
false
false
false
false
false
0
turret_driver_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { edict_t *ent; // level the gun self->target_ent->move_angles[0] = 0; // remove the driver from the end of them team chain for (ent = self->target_ent->teammaster; ent->teamchain != self; ent = ent->teamchain) ; ent->teamchain = NULL; self->teammaster = NULL; self->flags &= ~FL_TEAMSLAVE; self->target_ent->owner = NULL; self->target_ent->teammaster->owner = NULL; infantry_die (self, inflictor, attacker, damage, point); }
false
false
false
false
false
0
decode_run_2bit(GetBitContext *gb, int *color) { unsigned int v, t; v = 0; for (t = 1; v < t && t <= 0x40; t <<= 2) v = (v << 4) | get_bits(gb, 4); *color = v & 3; if (v < 4) { /* Code for fill rest of line */ return INT_MAX; } return v >> 2; }
false
false
false
false
false
0
stage_revert(struct view *view, struct line *line) { struct line *chunk = NULL; if (!is_initial_commit() && stage_line_type == LINE_STAT_UNSTAGED) chunk = stage_diff_find(view, line, LINE_DIFF_CHUNK); if (chunk) { if (!prompt_yesno("Are you sure you want to revert changes?")) return FALSE; if (!stage_apply_chunk(view, chunk, TRUE)) { report("Failed to revert chunk"); return FALSE; } return TRUE; } else { return status_revert(stage_status.status ? &stage_status : NULL, stage_line_type, FALSE); } }
false
false
false
false
false
0
config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, int apply ) { int retVal = LDAP_SUCCESS; long pagedsizelimit; char *endp = NULL; Slapi_Backend *be; char *cookie; slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); if ( config_value_is_null( attrname, value, errorbuf, 0 )) { return LDAP_OPERATIONS_ERROR; } errno = 0; pagedsizelimit = strtol(value, &endp, 10); if ( *endp != '\0' || errno == ERANGE || pagedsizelimit < -1 ) { PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %lld", attrname, value, (long long int)LONG_MAX ); retVal = LDAP_OPERATIONS_ERROR; return retVal; } if (apply) { CFG_LOCK_WRITE(slapdFrontendConfig); slapdFrontendConfig->pagedsizelimit= pagedsizelimit; cookie = NULL; be = slapi_get_first_backend(&cookie); while (be) { be->be_pagedsizelimit = slapdFrontendConfig->pagedsizelimit; be = slapi_get_next_backend(cookie); } CFG_UNLOCK_WRITE(slapdFrontendConfig); slapi_ch_free ((void **)&cookie); } return retVal; }
false
false
false
false
false
0
GetNext() const { if (CHECK_CLOSINGINPROGRESS()) { // Cancel Event Detected return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else if (GetProjectAttachSucceeded()) { // We were successful in creating or retrieving an account return PAGE_TRANSITION_NEXT(ID_COMPLETIONPAGE); } else if (!GetProjectCommunicationsSucceeded() && GetProjectAccountNotFound()) { // The requested account does not exist or the password is bad return PAGE_TRANSITION_NEXT(ID_ERRNOTFOUNDPAGE); } else { // The project much be down for maintenance return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } return NULL; }
false
false
false
false
false
0
compute_period(size_t count, random_fn_t fn, unsigned mask, unsigned min_period) { size_t n; size_t idx; /* Filling index */ size_t didx = 0; /* Duplicate index */ unsigned *values, *window; unsigned period; XMALLOC_ARRAY(values, count); XMALLOC_ARRAY(window, count); if (min_period < MIN_PERIOD) { warning("Raising minimum period from %u to %u", min_period, MIN_PERIOD); min_period = MIN_PERIOD; } if (min_period > count / 2) { warning("Capping minimum period from %u to %u", min_period, (unsigned) count / 2); min_period = count / 2; } for (n = 0, idx = 0; idx < count; n++, idx++) { unsigned val = (*fn)() & mask; values[idx] = val; if (0 == (n & 0xfff)) { printf("Fill %u\r", (unsigned) n); fflush(stdout); } } if (0 != (period = small_period(values, count, min_period))) goto done; for (; n != 0; n++) { unsigned val = (*fn)() & mask; if G_UNLIKELY(val == values[didx]) { window[didx] = val; if G_UNLIKELY(++didx == count) break; } else if G_UNLIKELY(didx != 0) { size_t i; /* * Did not match window[0..didx] with values[]. * Try with window[1..didx], window[2..didx], etc... to * re-establish a matching start point in `didx'. */ for (i = 1; i < didx; i++) { size_t j = 0; for (j = 0; j < didx - i; j++) { if (window[i + j] != values[j]) goto no_match; } if G_UNLIKELY(val == values[j]) { g_assert(didx - i == j); memmove(window, &window[i], (didx - i) * sizeof window[0]); didx = j + 1; g_assert(didx < count); window[didx] = val; break; } no_match: continue; } } if (0 == (n & 0xfff)) { printf("Period %u\r", (unsigned) n); fflush(stdout); } } period = 0 == n ? (unsigned) -1 : n - count + 1; done: printf("%-20s\n", 0 == n ? "Looped over!" : "Done!"); xfree(values); xfree(window); return period; }
false
false
false
false
false
0
kmc_set_mode_to_DISPLAY(int fd) { int dmode, rmode, smode; dmode = kmc_get_display_mode(fd); rmode = kmc_get_record_ready(fd); smode = kmc_get_setup_mode(fd); if ( kmc_get_setup_mode(fd) == 1) kmc_press_stop_escape_button(fd); if ( kmc_get_record_ready(fd) == 1) kmc_press_record_ready_button(fd); if ( kmc_get_display_mode(fd) == 0) kmc_press_mode_button(fd); if ( kmc_get_mode(fd) != 1 ) { perror("kmc_set_mode_to_DISPLAY: Did not set mode correctly."); exit(0); } }
false
false
false
false
false
0
gf_sg_vrml_mf_reset(void *mf, u32 FieldType) { GenMFField *mffield = (GenMFField *)mf; if (!mffield->array) return GF_OK; //field we can't copy if (gf_sg_vrml_is_sf_field(FieldType)) return GF_BAD_PARAM; if (!gf_sg_vrml_get_sf_size(FieldType)) return GF_BAD_PARAM; switch (FieldType) { case GF_SG_VRML_MFSTRING: gf_sg_mfstring_del( * ((MFString *) mf)); break; case GF_SG_VRML_MFURL: gf_sg_mfurl_del( * ((MFURL *) mf)); break; case GF_SG_VRML_MFSCRIPT: gf_sg_mfscript_del( * ((MFScript *) mf)); break; default: if (mffield->array) gf_free(mffield->array); break; } mffield->array = NULL; mffield->count = 0; return GF_OK; }
false
false
false
false
false
0
SetEnabled(int enabling) { // We defer enabling the handles until the selection process begins if ( enabling ) { if ( ! this->CurrentRenderer ) { int X=this->Interactor->GetEventPosition()[0]; int Y=this->Interactor->GetEventPosition()[1]; this->SetCurrentRenderer(this->Interactor->FindPokedRenderer(X,Y)); if (this->CurrentRenderer == NULL) { return; } } // Don't actually turn these on until cursor is near the end points or the line. this->CreateDefaultRepresentation(); vtkHandleRepresentation * originRep = reinterpret_cast<vtkAxesTransformRepresentation*> (this->WidgetRep)->GetOriginRepresentation(); originRep->SetRenderer(this->CurrentRenderer); this->OriginWidget->SetRepresentation(originRep); this->OriginWidget->SetInteractor(this->Interactor); vtkHandleRepresentation * selectionRep = reinterpret_cast<vtkAxesTransformRepresentation*> (this->WidgetRep)->GetSelectionRepresentation(); selectionRep->SetRenderer(this->CurrentRenderer); this->SelectionWidget->SetRepresentation(selectionRep); this->SelectionWidget->SetInteractor(this->Interactor); // We do this step first because it sets the CurrentRenderer this->Superclass::SetEnabled(enabling); } else { this->OriginWidget->SetEnabled(0); this->SelectionWidget->SetEnabled(0); } }
false
false
false
false
false
0
scsi_inquiry(cdrom_drive *d){ unsigned char sense[SG_MAX_SENSE]; unsigned char cmd[6]={ 0x12,0,0,0,56,0 }; if(handle_scsi_cmd(d,cmd,6, 0, 56,'\377',1,sense)) { cderror(d,"008: Unable to identify CDROM model\n"); return(NULL); } return (d->private_data->sg_buffer); }
false
false
false
false
false
0
APar_ForcePadding(uint32_t padding_amount) { if (tree_display_only || padding_amount == 0) { return; } if (udta_dynamics.free_atom_repository) { parsedAtoms[udta_dynamics.free_atom_repository].AtomicLength = padding_amount; parsedAtoms[udta_dynamics.free_atom_repository].AtomicData = (char*) malloc(sizeof(char) * padding_amount); //allocate memory to write the NULL space out) memset(parsedAtoms[udta_dynamics.free_atom_repository].AtomicData, 0, sizeof(char) * padding_amount); } else if (udta_dynamics.free_atom_secondary_repository) { parsedAtoms[udta_dynamics.free_atom_secondary_repository].AtomicLength = padding_amount; parsedAtoms[udta_dynamics.free_atom_secondary_repository].AtomicData = (char*) malloc(sizeof(char) * padding_amount); memset(parsedAtoms[udta_dynamics.free_atom_secondary_repository].AtomicData, 0, sizeof(char) * padding_amount); } else { APar_InterjectNewAtom("free", CHILD_ATOM, SIMPLE_ATOM, padding_amount, 0, 0, 1, APar_FindLastChild_of_ParentAtom(udta_dynamics.moov_atom)); } new_file_size += padding_amount; return; }
false
true
false
false
false
1
rtw_reordering_ctrl_timeout_handler23a(unsigned long pcontext) { struct recv_reorder_ctrl *preorder_ctrl; struct rtw_adapter *padapter; struct rtw_queue *ppending_recvframe_queue; preorder_ctrl = (struct recv_reorder_ctrl *)pcontext; padapter = preorder_ctrl->padapter; ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { return; } /* DBG_8723A("+rtw_reordering_ctrl_timeout_handler23a() =>\n"); */ spin_lock_bh(&ppending_recvframe_queue->lock); if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true) == true) { mod_timer(&preorder_ctrl->reordering_ctrl_timer, jiffies + msecs_to_jiffies(REORDER_WAIT_TIME)); } spin_unlock_bh(&ppending_recvframe_queue->lock); }
false
false
false
false
false
0
aarch64_regno_ok_for_index_p (int regno, bool strict_p) { if (!HARD_REGISTER_NUM_P (regno)) { if (!strict_p) return true; if (!reg_renumber) return false; regno = reg_renumber[regno]; } return GP_REGNUM_P (regno); }
false
false
false
false
false
0
HPDF_CreateExtGState (HPDF_Doc pdf) { HPDF_ExtGState ext_gstate; if (!HPDF_HasDoc (pdf)) return NULL; pdf->pdf_version = HPDF_VER_14; ext_gstate = HPDF_ExtGState_New (pdf->mmgr, pdf->xref); if (!ext_gstate) HPDF_CheckError (&pdf->error); return ext_gstate; }
false
false
false
false
false
0
test_toplevel_order (gconstpointer userdata) { gchar **data = (gpointer) userdata; gchar *project_path = *data; gchar **names = &data[1]; GladeProject *project; GList *toplevels, *l; gchar *temp_path; const gchar *xml_data; gsize xml_size; GBytes *xml; g_assert (g_close (g_file_open_tmp ("glade-toplevel-order-XXXXXX.glade", &temp_path, NULL), NULL)); /* Dump contents to a temp file */ g_assert ((xml = g_resources_lookup_data (project_path, 0, NULL))); xml_data = g_bytes_get_data (xml, &xml_size); g_assert (g_file_set_contents (temp_path, xml_data, xml_size, NULL)); g_bytes_unref (xml); /* Load project */ g_assert ((project = glade_project_load (temp_path))); /* And save it, order should be the same */ g_assert (glade_project_save (project, temp_path, NULL)); g_object_unref (project); /* Reload saved project */ g_assert ((project = glade_project_load (temp_path))); g_unlink (temp_path); /* And get toplevels to check order */ g_assert ((toplevels = glade_project_toplevels (project))); for (l = toplevels; l && names; l = g_list_next (l), names++) { GladeWidget *toplevel; g_assert ((toplevel = glade_widget_get_from_gobject (l->data))); g_assert_cmpstr (glade_widget_get_name (toplevel), ==, *names); } /* make sure all items where tested */ g_assert (!l && !*names); g_list_free (toplevels); g_object_unref (project); g_free (temp_path); }
false
false
false
false
false
0
expanding_array_clear(ExpandingArray *A) { if (!A) { if (MATR_DEBUG_MODE) { fprintf(stderr, "expanding_array_clear: null array.\n"); } return; } A->last_elt = -1; if (A->first_elt > 0) { A->first_elt = A->length/2; } A->n_elts = 0; }
false
false
false
false
false
0
asLinearRing() const { return parentLine->getFactory()->createLinearRing( getResultCoordinates()); }
false
false
false
false
false
0
from_unicode (CHARSET charset, int u) { short int *p; /* This is really assignment, not comparation */ if ((p=charset[(unsigned)u>>8])) { return p[u & 0xff]; } else { return -1; } }
false
false
false
false
false
0
template_get(const char *name) { struct ra_template *template = templates; struct stat st[1]; while(template) { if(strcmp(template->name, name) == 0) { if(stat(name, st) >= 0 && template->mtime < st->st_mtime) { template_compile(template); } return template; } } if(stat(name, st) < 0) { return NULL; } template = malloc(sizeof(*template)); memset(template, 0, sizeof(*template)); template->name = strdup(name); template_compile(template); template->next = templates; templates = template; return template; }
false
false
false
false
false
0
e1000_setup_fiber_serdes_link(struct e1000_hw *hw) { u32 ctrl; u32 status; u32 txcw = 0; u32 i; u32 signal = 0; s32 ret_val; /* On adapters with a MAC newer than 82544, SWDP 1 will be * set when the optics detect a signal. On older adapters, it will be * cleared when there is a signal. This applies to fiber media only. * If we're on serdes media, adjust the output amplitude to value * set in the EEPROM. */ ctrl = er32(CTRL); if (hw->media_type == e1000_media_type_fiber) signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; ret_val = e1000_adjust_serdes_amplitude(hw); if (ret_val) return ret_val; /* Take the link out of reset */ ctrl &= ~(E1000_CTRL_LRST); /* Adjust VCO speed to improve BER performance */ ret_val = e1000_set_vco_speed(hw); if (ret_val) return ret_val; e1000_config_collision_dist(hw); /* Check for a software override of the flow control settings, and setup * the device accordingly. If auto-negotiation is enabled, then * software will have to set the "PAUSE" bits to the correct value in * the Tranmsit Config Word Register (TXCW) and re-start * auto-negotiation. However, if auto-negotiation is disabled, then * software will have to manually configure the two flow control enable * bits in the CTRL register. * * The possible values of the "fc" parameter are: * 0: Flow control is completely disabled * 1: Rx flow control is enabled (we can receive pause frames, but * not send pause frames). * 2: Tx flow control is enabled (we can send pause frames but we do * not support receiving pause frames). * 3: Both Rx and TX flow control (symmetric) are enabled. */ switch (hw->fc) { case E1000_FC_NONE: /* Flow ctrl is completely disabled by a software over-ride */ txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); break; case E1000_FC_RX_PAUSE: /* Rx Flow control is enabled and Tx Flow control is disabled by * a software over-ride. Since there really isn't a way to * advertise that we are capable of Rx Pause ONLY, we will * advertise that we support both symmetric and asymmetric Rx * PAUSE. Later, we will disable the adapter's ability to send * PAUSE frames. */ txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); break; case E1000_FC_TX_PAUSE: /* Tx Flow control is enabled, and Rx Flow control is disabled, * by a software over-ride. */ txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); break; case E1000_FC_FULL: /* Flow control (both Rx and Tx) is enabled by a software * over-ride. */ txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); break; default: e_dbg("Flow control param set incorrectly\n"); return -E1000_ERR_CONFIG; } /* Since auto-negotiation is enabled, take the link out of reset (the * link will be in reset, because we previously reset the chip). This * will restart auto-negotiation. If auto-negotiation is successful * then the link-up status bit will be set and the flow control enable * bits (RFCE and TFCE) will be set according to their negotiated value. */ e_dbg("Auto-negotiation enabled\n"); ew32(TXCW, txcw); ew32(CTRL, ctrl); E1000_WRITE_FLUSH(); hw->txcw = txcw; msleep(1); /* If we have a signal (the cable is plugged in) then poll for a * "Link-Up" indication in the Device Status Register. Time-out if a * link isn't seen in 500 milliseconds seconds (Auto-negotiation should * complete in less than 500 milliseconds even if the other end is doing * it in SW). For internal serdes, we just assume a signal is present, * then poll. */ if (hw->media_type == e1000_media_type_internal_serdes || (er32(CTRL) & E1000_CTRL_SWDPIN1) == signal) { e_dbg("Looking for Link\n"); for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { msleep(10); status = er32(STATUS); if (status & E1000_STATUS_LU) break; } if (i == (LINK_UP_TIMEOUT / 10)) { e_dbg("Never got a valid link from auto-neg!!!\n"); hw->autoneg_failed = 1; /* AutoNeg failed to achieve a link, so we'll call * e1000_check_for_link. This routine will force the * link up if we detect a signal. This will allow us to * communicate with non-autonegotiating link partners. */ ret_val = e1000_check_for_link(hw); if (ret_val) { e_dbg("Error while checking for link\n"); return ret_val; } hw->autoneg_failed = 0; } else { hw->autoneg_failed = 0; e_dbg("Valid Link Found\n"); } } else { e_dbg("No Signal Detected\n"); } return E1000_SUCCESS; }
false
false
false
false
false
0
matches (CTypeInfo *ctype) const { return ctype->TypeAddress () && base ()->matches (ctype->BaseType ()); }
false
false
false
false
false
0
ximCloseProc(conn, major, minor, arglen) IMConnection *conn; int major; int minor; int arglen; { IMIM *imp; TRACE(("ximCloseProc(#%d)\n", conn->serial)); if ((imp = IMGetIM(conn, arglen)) == NULL) return; if (arglen != 4) { DPRINT(("ximCloseProc: arglen != 4\n")); IMSendBadLength(conn, imp->id, 0); return; } IMPutHeader(conn, XIM_CLOSE_REPLY, 0, 4); IMPutC16(conn, imp->id); IMPutPad(conn); IMSchedule(conn, SCHED_WRITE); IMDestroyIM(imp); }
false
false
false
false
false
0
dlmunmap (void *start, size_t length) { /* We don't bother decreasing execsize or truncating the file, since we can't quite tell whether we're unmapping the end of the file. We don't expect frequent deallocation anyway. If we did, we could locate pages in the file by writing to the pages being deallocated and checking that the file contents change. Yuck. */ msegmentptr seg = segment_holding (gm, start); void *code; #if FFI_CLOSURE_TEST printf ("unmapping %zi\n", length); #endif if (seg && (code = add_segment_exec_offset (start, seg)) != start) { int ret = munmap (code, length); if (ret) return ret; } return munmap (start, length); }
false
false
false
false
false
0
find_dirent_proc (void *callerdat, const char *dir, const char *repository, const char *update_dir, List *entries) { struct find_data *find_data = callerdat; /* This check seems to slowly be creeping throughout CVS (update and send_dirent_proc by CVS 1.5, diff in 31 Oct 1995. My guess is that it (or some variant thereof) should go in all the dirent procs. Unless someone has some better idea... */ if (!isdir (dir)) return R_SKIP_ALL; /* initialize the ignore list for this directory */ find_data->ignlist = getlist (); /* Print the same warm fuzzy as in check_direntproc, since that code will never be run during client/server operation and we want the messages to match. */ if (!quiet) error (0, 0, "Examining %s", update_dir); return R_PROCESS; }
false
false
false
false
false
0
setup(int argc, const char **argv) { char **retval = NULL; const char *val; int opt_quiet = 0; int argi; val = getenv("CRUT_TIMEOUT"); if (val && (atoi(val) > 0)) { test_timeout = atoi(val); } test_path = crut_find_testsdir(argv[0]); argv0 = argv[0]; for (argi = 1; argi < argc; ++argi) { val = argv[argi]; if ((val[0] != '-') || (strlen(val) != 2)) break; switch (val[1]) { case 'k': opt_keep=1; break; case 'v': ++opt_verbose; break; case 'q': opt_quiet = 1; break; case 'F': opt_fake=1; break; case 'd': opt_debug=1; break; default: die("Unknown option '%s'", val); } } if (opt_verbose == 3) { crut_arguments = strdup("-d"); crut_cmd[crut_argc++] = "-d"; putenv("LIBCR_TRACE_MASK=0xffff"); } else if (opt_verbose == 2) { crut_arguments = strdup("-v"); crut_cmd[crut_argc++] = "-v"; } else { crut_arguments = strdup(""); } if (opt_fake) { crut_arguments = crut_sappendf(crut_arguments, " -F"); crut_cmd[crut_argc++] = "-F"; } if (opt_debug) { crut_arguments = crut_sappendf(crut_arguments, " -d"); crut_cmd[crut_argc++] = "-d"; } crut_cmd[crut_argc+1] = NULL; if (crut_argc+1 > 5) die("OOPS"); if (argi < argc) { int len = argc - argi; int i; retval = malloc((1+len) * sizeof(char *)); for (i=0; i<len; ++i) { retval[i] = strdup(argv[argi+i]); } retval[len] = NULL; } else { char *test = crut_basename(argv[0]); char *tmp = strstr(test, ".ct"); if (!tmp) die("'%s' does not have a .ct suffix", argv[0]); *tmp = '\0'; retval = malloc(2 * sizeof(char *)); retval[0] = test; retval[1] = NULL; opt_quiet = 1; } if (opt_quiet && !opt_verbose) opt_verbose = -1; return retval; }
false
false
true
true
false
1
stac_init(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; int i; /* override some hints */ stac_store_hints(codec); /* set up GPIO */ /* turn on EAPD statically when spec->eapd_switch isn't set. * otherwise, unsol event will turn it on/off dynamically */ if (!spec->eapd_switch) spec->gpio_data |= spec->eapd_mask; stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); snd_hda_gen_init(codec); /* sync the power-map */ if (spec->num_pwrs) snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_IDT_SET_POWER_MAP, spec->power_map_bits); /* power down inactive ADCs */ if (spec->powerdown_adcs) { for (i = 0; i < spec->gen.num_all_adcs; i++) { if (spec->active_adcs & (1 << i)) continue; snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D3); } } return 0; }
false
false
false
false
false
0
scontrol_encode_hostlist(char *hostlist, bool sorted) { char *io_buf = NULL, *tmp_list, *ranged_string; int buf_size = 1024 * 1024; hostlist_t hl; if (!hostlist) { fprintf(stderr, "Hostlist is NULL\n"); return SLURM_ERROR; } if (hostlist[0] == '/') { ssize_t buf_read; int fd = open(hostlist, O_RDONLY); if (fd < 0) { fprintf(stderr, "Can not open %s\n", hostlist); return SLURM_ERROR; } io_buf = xmalloc(buf_size); buf_read = read(fd, io_buf, buf_size); close(fd); if (buf_read >= buf_size) { /* If over 1MB, the file is almost certainly invalid */ fprintf(stderr, "File %s is too large\n", hostlist); return SLURM_ERROR; } io_buf[buf_read] = '\0'; _reformat_hostlist(io_buf); tmp_list = io_buf; } else tmp_list = hostlist; hl = hostlist_create(tmp_list); if (hl == NULL) { fprintf(stderr, "Invalid hostlist: %s\n", tmp_list); return SLURM_ERROR; } if (sorted) hostlist_sort(hl); ranged_string = hostlist_ranged_string_xmalloc(hl); printf("%s\n", ranged_string); hostlist_destroy(hl); xfree(ranged_string); xfree(io_buf); return SLURM_SUCCESS; }
false
false
false
false
false
0
allocrest() { long i; x = (vector *)Malloc(spp*sizeof(vector)); for (i = 0; i < spp; i++) x[i] = (vector)Malloc(spp*sizeof(double)); reps = (intvector *)Malloc(spp*sizeof(intvector)); for (i = 0; i < spp; i++) reps[i] = (intvector)Malloc(spp*sizeof(long)); nayme = (naym *)Malloc(spp*sizeof(naym)); enterorder = (long *)Malloc(spp*sizeof(long)); cluster = (node **)Malloc(spp*sizeof(node *)); }
false
false
false
false
false
0
SMprintfiles(FILE *file, TOKEN token, char **xref, int ngroups) { if (method_data[typetoindex[token.type]].initialized == INIT_FAIL) return; if (method_data[typetoindex[token.type]].initialized == INIT_NO && !InitMethod(typetoindex[token.type])) { SMseterror(SMERR_UNINIT, NULL); warn("SM: can't print files for article with uninitialized method"); return; } storage_methods[typetoindex[token.type]].printfiles(file, token, xref, ngroups); }
false
false
false
false
false
0
addChunk(ucvector* out, const char* chunkName, const unsigned char* data, size_t length) { unsigned char* chunk = LodePNG_create_chunk(&out->data, &out->size, (unsigned)length, chunkName, data); if(chunk) out->allocsize = out->size; /*fix the allocsize again*/ return chunk ? 0 : 70; /*if realloc failed, return error 70*/ }
false
false
false
false
false
0
__env_set_timeout(dbenv, timeout, flags) DB_ENV *dbenv; db_timeout_t timeout; u_int32_t flags; { int ret; ret = 0; if (flags == DB_SET_REG_TIMEOUT) dbenv->envreg_timeout = timeout; else ret = __lock_set_env_timeout(dbenv, timeout, flags); return (ret); }
false
false
false
false
false
0
hydra_address2string(char *address) { struct sockaddr_in target; struct sockaddr_in6 target6; if (address[0] == 4) { memcpy(&target.sin_addr.s_addr, &address[1], 4); return inet_ntoa((struct in_addr) target.sin_addr); } else #ifdef AF_INET6 if (address[0] == 16) { memcpy(&target6.sin6_addr, &address[1], 16); inet_ntop(AF_INET6, &target6.sin6_addr, ipstring, sizeof(ipstring)); return ipstring; } else #endif { fprintf(stderr, "[ERROR] unknown address string size!\n"); return NULL; } return NULL; // not reached }
false
false
false
false
false
0
get_color(unsigned i, unsigned j) const { if (i >= h || j >= w) return INVALID_SITE; return tab[i][j].m.color; }
false
false
false
false
false
0
match_uprobe(struct uprobe *l, struct uprobe *r) { if (l->inode < r->inode) return -1; if (l->inode > r->inode) return 1; if (l->offset < r->offset) return -1; if (l->offset > r->offset) return 1; return 0; }
false
false
false
false
false
0
xfs_bmdr_to_bmbt( struct xfs_inode *ip, xfs_bmdr_block_t *dblock, int dblocklen, struct xfs_btree_block *rblock, int rblocklen) { struct xfs_mount *mp = ip->i_mount; int dmxr; xfs_bmbt_key_t *fkp; __be64 *fpp; xfs_bmbt_key_t *tkp; __be64 *tpp; if (xfs_sb_version_hascrc(&mp->m_sb)) xfs_btree_init_block_int(mp, rblock, XFS_BUF_DADDR_NULL, XFS_BMAP_CRC_MAGIC, 0, 0, ip->i_ino, XFS_BTREE_LONG_PTRS | XFS_BTREE_CRC_BLOCKS); else xfs_btree_init_block_int(mp, rblock, XFS_BUF_DADDR_NULL, XFS_BMAP_MAGIC, 0, 0, ip->i_ino, XFS_BTREE_LONG_PTRS); rblock->bb_level = dblock->bb_level; ASSERT(be16_to_cpu(rblock->bb_level) > 0); rblock->bb_numrecs = dblock->bb_numrecs; dmxr = xfs_bmdr_maxrecs(dblocklen, 0); fkp = XFS_BMDR_KEY_ADDR(dblock, 1); tkp = XFS_BMBT_KEY_ADDR(mp, rblock, 1); fpp = XFS_BMDR_PTR_ADDR(dblock, 1, dmxr); tpp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, rblocklen); dmxr = be16_to_cpu(dblock->bb_numrecs); memcpy(tkp, fkp, sizeof(*fkp) * dmxr); memcpy(tpp, fpp, sizeof(*fpp) * dmxr); }
false
true
false
false
false
1
fl_gap() { while (n>gap+2 && p[n-1].x == p[gap].x && p[n-1].y == p[gap].y) n--; if (n > gap+2) { fl_transformed_vertex((COORD_T)p[gap].x, (COORD_T)p[gap].y); #ifdef WIN32 counts[numcount++] = n-gap; #endif gap = n; } else { n = gap; } }
false
false
false
false
false
0
swrun_count_processes( void ) { netsnmp_cache_check_and_reload(swrun_cache); return ( swrun_container ? CONTAINER_SIZE(swrun_container) : 0 ); }
false
false
false
false
false
0
parse_attrs(const char *str, attr_t *attrp, int delimiter) { int color, len; const char *name; char buf[16]; char reject[3] = {',', '\0', '\0'}; reject[1] = delimiter; *attrp = 0; if (!str) return ""; while (*str && *str != delimiter) { ++str; switch(str[-1]) { case ',': /* skip */ break; case 'n': *attrp |= F_NONE; break; case 'x': *attrp |= F_EXCLUSIVE; break; case 'G': *attrp |= F_NOHISTORY; break; case 'L': *attrp |= F_NOLOG; break; case 'A': *attrp |= F_NOACTIVITY;break; case 'g': *attrp |= F_GAG; break; case 'u': *attrp |= F_UNDERLINE; break; case 'r': *attrp |= F_REVERSE; break; case 'f': *attrp |= F_FLASH; break; case 'd': *attrp |= F_DIM; break; case 'B': *attrp |= F_BOLD; break; case 'b': *attrp |= F_BELL; break; case 'h': *attrp |= F_HILITE; break; case 'E': *attrp |= error_attr; break; case 'W': *attrp |= warning_attr; break; case 'I': *attrp |= info_attr; break; case 'C': len = strcspn(str, reject); if (str[len] && len < sizeof(buf)) { name = strncpy(buf, str, len); buf[len] = '\0'; str += len; } else { name = str; while (*str) ++str; } if (strncmp(name, "bg", 2) == 0) { if ((color = enum2int(name+2, 0, enum_color, "bgcolor")) < 0) return NULL; *attrp = adj_attr(*attrp, bgcolor2attr(color)); } else { if ((color = enum2int(name, 0, enum_color, "color")) < 0) return NULL; *attrp = adj_attr(*attrp, fgcolor2attr(color)); } break; default: eprintf("invalid display attribute '%c'", str[-1]); return NULL; } } return str; }
false
false
false
false
false
0
BezierDice(Bezier *bezier, int nu, int nv) { if(nu < 2) nu = BEZ_DEFAULT_MESH_SIZE; if(nv < 2) nv = BEZ_DEFAULT_MESH_SIZE; if(nu != bezier->nu || nv != bezier->nv) { bezier->geomflags |= BEZ_REMESH; bezier->nu = nu; bezier->nv = nv; } return bezier; }
false
false
false
false
false
0
removeElement(Elements* elements, Element* element) { GList* l = NULL;; for( l = elements->listOfElements; l != NULL; l = l->next) { if(l->data && element->equals(element,(Element*) l->data)) { elements->listOfElements = g_list_remove(elements->listOfElements, (gpointer) l->data); elements->nElements--; return; } } }
false
false
false
false
false
0
fn_AdOt_evaluate(const gs_function_t *pfn_common, const float *in0, float *out) { const gs_function_AdOt_t *const pfn = (const gs_function_AdOt_t *)pfn_common; const float *in = in0; #define MAX_ADOT_IN 16 float in_buf[MAX_ADOT_IN]; int i; /* * We have to take special care to handle the case where in and out * overlap. For the moment, handle it only for a limited number of * input values. */ if (in <= out + (pfn->params.n - 1) && out <= in + (pfn->params.m - 1)) { if (pfn->params.m > MAX_ADOT_IN) return_error(gs_error_rangecheck); memcpy(in_buf, in, pfn->params.m * sizeof(*in)); in = in_buf; } for (i = 0; i < pfn->params.n; ++i) { int code = gs_function_evaluate(pfn->params.Functions[i], in, out + i); if (code < 0) return code; } return 0; #undef MAX_ADOT_IN }
false
false
false
false
false
0
_wrap_svm_node_array_set(PyObject *self, PyObject *args) { int argc; PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = args ? (int)PyObject_Length(args) : 0; for (ii = 0; (ii < 4) && (ii < argc); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_svm_node, 0); _v = SWIG_CheckState(res); if (_v) { _v = (argv[1] != 0); if (_v) { _v = (argv[2] != 0); if (_v) { return _wrap_svm_node_array_set__SWIG_1(self, args); } } } } if (argc == 4) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_svm_node, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_int(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_double(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_svm_node_array_set__SWIG_0(self, args); } } } } } fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'svm_node_array_set'.\n" " Possible C/C++ prototypes are:\n" " svm_node_array_set(svm_node *,int,int,double)\n" " svm_node_array_set(svm_node *,PyObject *,PyObject *)\n"); return 0; }
false
false
false
false
false
0
update_store (const gchar *sparql) { GError *error = NULL; /* Run a synchronous update query */ tracker_sparql_connection_update (connection, sparql, G_PRIORITY_DEFAULT, NULL, &error); if (error) { /* Some error happened performing the query, not good */ g_error ("Couldn't update store for '%s': %s", sparql, error ? error->message : "unknown error"); } }
false
false
false
false
false
0
getobjname (lua_State *L, CallInfo *ci, int stackpos, const char **name) { if (isLua(ci)) { /* a Lua function? */ Proto *p = ci_func(ci)->l.p; int pc = currentpc(L, ci); Instruction i; *name = luaF_getlocalname(p, stackpos+1, pc); if (*name) /* is a local? */ return "local"; i = symbexec(p, pc, stackpos); /* try symbolic execution */ lua_assert(pc != -1); switch (GET_OPCODE(i)) { case OP_GETGLOBAL: { int g = GETARG_Bx(i); /* global index */ lua_assert(ttisstring(&p->k[g])); *name = svalue(&p->k[g]); return "global"; } case OP_MOVE: { int a = GETARG_A(i); int b = GETARG_B(i); /* move from `b' to `a' */ if (b < a) return getobjname(L, ci, b, name); /* get name for `b' */ break; } case OP_GETTABLE: { int k = GETARG_C(i); /* key index */ *name = kname(p, k); return "field"; } case OP_GETUPVAL: { int u = GETARG_B(i); /* upvalue index */ *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; return "upvalue"; } case OP_SELF: { int k = GETARG_C(i); /* key index */ *name = kname(p, k); return "method"; } default: break; } } return NULL; /* no useful name found */ }
false
false
false
false
false
0
getCompareAndBranch(unsigned Opcode, const MachineInstr *MI) const { switch (Opcode) { case SystemZ::CR: return SystemZ::CRJ; case SystemZ::CGR: return SystemZ::CGRJ; case SystemZ::CHI: return MI && isInt<8>(MI->getOperand(1).getImm()) ? SystemZ::CIJ : 0; case SystemZ::CGHI: return MI && isInt<8>(MI->getOperand(1).getImm()) ? SystemZ::CGIJ : 0; case SystemZ::CLR: return SystemZ::CLRJ; case SystemZ::CLGR: return SystemZ::CLGRJ; case SystemZ::CLFI: return MI && isUInt<8>(MI->getOperand(1).getImm()) ? SystemZ::CLIJ : 0; case SystemZ::CLGFI: return MI && isUInt<8>(MI->getOperand(1).getImm()) ? SystemZ::CLGIJ : 0; default: return 0; } }
false
false
false
false
false
0
getdoubles2ptf(graph_t * g, char *name, pointf * result) { char *p; int i; double xf, yf; char c = '\0'; boolean rv = FALSE; if ((p = agget(g, name))) { i = sscanf(p, "%lf,%lf%c", &xf, &yf, &c); if ((i > 1) && (xf > 0) && (yf > 0)) { result->x = POINTS(xf); result->y = POINTS(yf); if (c == '!') rv = TRUE; } else { c = '\0'; i = sscanf(p, "%lf%c", &xf, &c); if ((i > 0) && (xf > 0)) { result->y = result->x = POINTS(xf); if (c == '!') rv = TRUE; } } } return rv; }
false
false
false
false
false
0
__lltostr(char *s, int size, unsigned long long i, int base, char UpCase) { char *tmp; unsigned int j=0; s[--size]=0; tmp=s+size; if ((base==0)||(base>36)) base=10; j=0; if (!i) { *(--tmp)='0'; j=1; } while((tmp>s)&&(i)) { tmp--; if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1; i=i/base; j++; } memmove(s,tmp,j+1); return j; }
false
false
false
false
false
0
visualize_missing_recorder_program_dialog (GtkWindow *parent) { GtkWidget *miss_dialog = (GtkWidget *) NULL; miss_dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, gettext ("In order to record with Ardesia you must install the vlc program and add it to the PATH environment variable")); //gtk_window_set_keep_above (GTK_WINDOW (miss_dialog), TRUE); gtk_dialog_run (GTK_DIALOG (miss_dialog)); if (miss_dialog != NULL) { gtk_widget_destroy (miss_dialog); miss_dialog = NULL; } }
false
false
false
false
false
0
NewExecuteContext(void) { execute_context_t *result; result = malloc(sizeof(execute_context_t)); result->response_file = TempFile("chocolat.rsp"); result->stream = fopen(result->response_file, "w"); if (result->stream == NULL) { fprintf(stderr, "Error opening response file\n"); exit(-1); } return result; }
false
false
false
false
false
0
FunctionCall9(FmgrInfo *flinfo, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9) { FunctionCallInfoData fcinfo; Datum result; InitFunctionCallInfoData(fcinfo, flinfo, 9, NULL, NULL); fcinfo.arg[0] = arg1; fcinfo.arg[1] = arg2; fcinfo.arg[2] = arg3; fcinfo.arg[3] = arg4; fcinfo.arg[4] = arg5; fcinfo.arg[5] = arg6; fcinfo.arg[6] = arg7; fcinfo.arg[7] = arg8; fcinfo.arg[8] = arg9; fcinfo.argnull[0] = false; fcinfo.argnull[1] = false; fcinfo.argnull[2] = false; fcinfo.argnull[3] = false; fcinfo.argnull[4] = false; fcinfo.argnull[5] = false; fcinfo.argnull[6] = false; fcinfo.argnull[7] = false; fcinfo.argnull[8] = false; result = FunctionCallInvoke(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) elog(ERROR, "function %u returned NULL", fcinfo.flinfo->fn_oid); return result; }
false
false
false
false
false
0
Sop_argb6666_to_Dacc( GenefxState *gfxs ) { int w = gfxs->length; GenefxAccumulator *D = gfxs->Dacc; u8 *S = gfxs->Sop[0]; while (w--) { u8 b = S[0] & 0x3F; u8 g = ((S[0] & 0xC0) >> 6) | ((S[1] & 0x0F) << 2); u8 r = ((S[1] & 0xF0) >> 4) | ((S[2] & 0x03) << 4); u8 a = (S[2] & 0xFC) >> 2; D->RGB.a = EXPAND_6to8( a ); D->RGB.r = EXPAND_6to8( r ); D->RGB.g = EXPAND_6to8( g ); D->RGB.b = EXPAND_6to8( b ); S +=3; D++; } }
false
false
false
false
false
0
replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn, struct value_data *vd) { rtx new_rtx = find_oldest_value_reg (cl, *loc, vd); if (new_rtx) { if (DEBUG_INSN_P (insn)) { struct queued_debug_insn_change *change; if (dump_file) fprintf (dump_file, "debug_insn %u: queued replacing reg %u with %u\n", INSN_UID (insn), REGNO (*loc), REGNO (new_rtx)); change = (struct queued_debug_insn_change *) pool_alloc (debug_insn_changes_pool); change->next = vd->e[REGNO (new_rtx)].debug_insn_changes; change->insn = insn; change->loc = loc; change->new_rtx = new_rtx; vd->e[REGNO (new_rtx)].debug_insn_changes = change; ++vd->n_debug_insn_changes; return true; } if (dump_file) fprintf (dump_file, "insn %u: replaced reg %u with %u\n", INSN_UID (insn), REGNO (*loc), REGNO (new_rtx)); validate_change (insn, loc, new_rtx, 1); return true; } return false; }
false
false
false
false
false
0
ReadImage (gGraphImagePtr img, xgdIOCtx * fd, unsigned char (*cmap)[256], int interlace, int *ZeroDataBlockP) { unsigned char c; int v; int xpos = 0, ypos = 0, pass = 0; int i; int red[256]; int green[256]; int blue[256]; unsigned char *p_out; int len = img->width; int height = img->height; LZW_STATIC_DATA sd; if (!ReadOK (fd, &c, 1)) { return; } if (c > MAX_LWZ_BITS) { return; } for (i = 0; (i < 256); i++) { red[i] = cmap[CM_RED][i]; green[i] = cmap[CM_GREEN][i]; blue[i] = cmap[CM_BLUE][i]; } if (LWZReadByte (fd, &sd, TRUE, c, ZeroDataBlockP) < 0) { return; } while ((v = LWZReadByte (fd, &sd, FALSE, c, ZeroDataBlockP)) >= 0) { if (v >= 256) { v = 0; } p_out = img->pixels + (ypos * img->scanline_width) + (xpos * img->pixel_size); if (img->pixel_format == GG_PIXEL_PALETTE) { /* the output image is expected to be PALETTE-based */ *p_out++ = v; if ((v + 1) > img->max_palette) img->max_palette = v + 1; img->palette_red[v] = red[v]; img->palette_green[v] = green[v]; img->palette_blue[v] = blue[v]; } ++xpos; if (xpos == len) { xpos = 0; if (interlace) { switch (pass) { case 0: case 1: ypos += 8; break; case 2: ypos += 4; break; case 3: ypos += 2; break; } if (ypos >= height) { ++pass; switch (pass) { case 1: ypos = 4; break; case 2: ypos = 2; break; case 3: ypos = 1; break; default: goto fini; } } } else { ++ypos; } } if (ypos >= height) break; } fini: if (LWZReadByte (fd, &sd, FALSE, c, ZeroDataBlockP) >= 0) { /* Ignore extra */ } }
false
false
false
false
true
1