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
indent_lines (GtkSourceView *view, GtkTextIter *start, GtkTextIter *end) { GtkTextBuffer *buf; gint start_line, end_line; gchar *tab_buffer = NULL; guint tabs = 0; guint spaces = 0; gint i; buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); start_line = gtk_text_iter_get_line (start); end_line = gtk_text_iter_get_line (end); if ((gtk_text_iter_get_visible_line_offset (end) == 0) && (end_line > start_line)) { end_line--; } if (view->priv->insert_spaces) { spaces = get_real_indent_width (view); tab_buffer = g_strnfill (spaces, ' '); } else if (view->priv->indent_width > 0) { guint indent_width; indent_width = get_real_indent_width (view); spaces = indent_width % view->priv->tab_width; tabs = indent_width / view->priv->tab_width; tab_buffer = get_indent_string (tabs, spaces); } else { tabs = 1; tab_buffer = g_strdup ("\t"); } gtk_text_buffer_begin_user_action (buf); for (i = start_line; i <= end_line; i++) { GtkTextIter iter; GtkTextIter iter2; guint replaced_spaces = 0; gtk_text_buffer_get_iter_at_line (buf, &iter, i); /* add spaces always after tabs, to avoid the case * where "\t" becomes " \t" with no visual difference */ while (gtk_text_iter_get_char (&iter) == '\t') { gtk_text_iter_forward_char (&iter); } /* don't add indentation on empty lines */ if (gtk_text_iter_ends_line (&iter)) continue; /* if tabs are allowed try to merge the spaces * with the tab we are going to insert (if any) */ iter2 = iter; while (!view->priv->insert_spaces && (gtk_text_iter_get_char (&iter2) == ' ') && replaced_spaces < view->priv->tab_width) { ++replaced_spaces; gtk_text_iter_forward_char (&iter2); } if (replaced_spaces > 0) { gchar *indent_buf; guint t, s; t = tabs + (spaces + replaced_spaces) / view->priv->tab_width; s = (spaces + replaced_spaces) % view->priv->tab_width; indent_buf = get_indent_string (t, s); gtk_text_buffer_delete (buf, &iter, &iter2); gtk_text_buffer_insert (buf, &iter, indent_buf, -1); g_free (indent_buf); } else { gtk_text_buffer_insert (buf, &iter, tab_buffer, -1); } } gtk_text_buffer_end_user_action (buf); g_free (tab_buffer); gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buf)); }
false
false
false
false
false
0
JNI_IsSameObject(JNIEnv *env, jobject ref1, jobject ref2) { enter_vm_from_jni(); if (ref1 == ref2) return JNI_TRUE; return JNI_FALSE; }
false
false
false
false
false
0
parseIf() { Node *node ; Node *ifpart ; if (properties & ALLOW_OMITTED_PARENS) { node = single_expression() ; } else { needbrack (LBRACK) ; node = single_expression() ; needbrack (RBRACK) ; } if (node->op == ASSIGN) { warning ("Assignment used as condition") ; } ifpart = parseStatement() ; if (match (ELSE)) { // else part? Node *elsepart = parseStatement() ; Node *oldif = ifpart ; ifpart = new Node (this,ELSE, ifpart, elsepart) ; if (elsepart != NULL) { ifpart->scope = elsepart->scope ; } else { if (oldif != NULL) { ifpart->scope = oldif->scope ; } } } else if (match (ELIF)) { // elif part? Node *elif = parseIf() ; Node *oldif = ifpart ; ifpart = new Node (this, ELSE, ifpart, elif) ; if (elif != NULL) { ifpart->scope = elif->scope ; } else { if (oldif != NULL) { ifpart->scope = oldif->scope ; } } } node = new Node (this,IF, node, ifpart) ; if (ifpart != NULL) { node->scope = ifpart->scope ; } return node ; }
false
false
false
false
false
0
interact(void) { /* In case we got here because a command output, stop the pager. */ stop_pager(); trace_event("Interacting.\n"); if (appres.secure || appres.no_prompt) { char s[10]; printf("[Press <Enter>] "); fflush(stdout); if (fgets(s, sizeof(s), stdin) == NULL) x3270_exit(1); return; } #if !defined(_WIN32) /*[*/ /* Handle SIGTSTP differently at the prompt. */ signal(SIGTSTP, SIG_DFL); #endif /*]*/ /* * Ignore SIGINT at the prompt. * I'm sure there's more we could do. */ signal(SIGINT, SIG_IGN); for (;;) { int sl; char *s; #if defined(HAVE_LIBREADLINE) /*[*/ char *rl_s; #else /*][*/ char buf[1024]; #endif /*]*/ dont_return = False; /* Process a pending stop now. */ if (stop_pending) { stop_pending = False; #if !defined(_WIN32) /*[*/ signal(SIGTSTP, SIG_DFL); kill(getpid(), SIGTSTP); #endif /*]*/ continue; } #if !defined(_WIN32) /*[*/ /* Process SIGTSTPs immediately. */ signal(SIGTSTP, prompt_sigtstp_handler); #endif /*]*/ /* Display the prompt. */ if (CONNECTED) (void) printf("Press <Enter> to resume session.\n"); #if defined(HAVE_LIBREADLINE) /*[*/ s = rl_s = readline("c3270> "); if (s == CN) { printf("\n"); exit(0); } #else /*][*/ (void) printf(PROGRAM_NAME "> "); (void) fflush(stdout); /* Get the command, and trim white space. */ if (fgets(buf, sizeof(buf), stdin) == CN) { printf("\n"); #if defined(_WIN32) /*[*/ continue; #else /*][*/ x3270_exit(0); #endif /*]*/ } s = buf; #endif /*]*/ #if !defined(_WIN32) /*[*/ /* Defer SIGTSTP until the next prompt display. */ signal(SIGTSTP, running_sigtstp_handler); #endif /*]*/ while (isspace(*s)) s++; sl = strlen(s); while (sl && isspace(s[sl-1])) s[--sl] = '\0'; /* A null command means go back. */ if (!sl) { if (CONNECTED && !dont_return) break; else continue; } #if defined(HAVE_LIBREADLINE) /*[*/ /* Save this command in the history buffer. */ add_history(s); #endif /*]*/ /* "?" is an alias for "Help". */ if (!strcmp(s, "?")) s = "Help"; /* * Process the command like a macro, and spin until it * completes. */ push_command(s); while (sms_active()) { (void) process_events(True); } /* Close the pager. */ stop_pager(); #if defined(HAVE_LIBREADLINE) /*[*/ /* Give back readline's buffer. */ free(rl_s); #endif /*]*/ /* If it succeeded, return to the session. */ if (!macro_output && CONNECTED) break; } /* Ignore SIGTSTP again. */ stop_pending = False; #if !defined(_WIN32) /*[*/ signal(SIGTSTP, SIG_IGN); #endif /*]*/ #if defined(_WIN32) /*[*/ signal(SIGINT, SIG_DFL); #endif /*]*/ }
false
false
false
false
false
0
parse_gnucash_value(char * value, char * result) { int i,state=0,ctr=0,zeroes=0; char numerator[128]; for (i = 0; i < strlen(value); i++) { if (value[i]=='/') { /* terminate the numerator string */ numerator[ctr]=0; state++; ctr = 0; } else { if (state==0) { /* update the numerator */ numerator[ctr++] = value[i]; } else { /* a simple hack is to count the zeros */ if (value[i]=='0') zeroes++; } } } /* if no denominator was found */ if (state==0) { sprintf(result,"%s",value); return; } /* copy the numerator to the result, inserting the decimal point */ ctr=0; for (i = 0; i < strlen(numerator); i++) { result[ctr++] = numerator[i]; /* insert the decimal at the appropriate place */ if (i==strlen(numerator)-zeroes-1) { result[ctr++]='.'; } } result[ctr]=0; }
false
false
false
false
false
0
internal_ok( const char *file, int line, int test, const char * test_txt, const char *fmt, ...) { va_list ap; ++test_run; if ( test ) { ++test_ok; printf( "ok %d ", test_run); va_start( ap, fmt ); vprintf( fmt, ap ); va_end( ap ); printf("\n"); } else { printf( "not ok %d ", test_run); va_start( ap, fmt ); vprintf( fmt, ap ); va_end( ap ); printf( "\n# %s failed in %s:%d\n", test_txt, file, line ); } }
false
false
false
false
false
0
ocfs2_prepare_downconvert(struct ocfs2_lock_res *lockres, int new_level) { assert_spin_locked(&lockres->l_lock); BUG_ON(lockres->l_blocking <= DLM_LOCK_NL); if (lockres->l_level <= new_level) { mlog(ML_ERROR, "lockres %s, lvl %d <= %d, blcklst %d, mask %d, " "type %d, flags 0x%lx, hold %d %d, act %d %d, req %d, " "block %d, pgen %d\n", lockres->l_name, lockres->l_level, new_level, list_empty(&lockres->l_blocked_list), list_empty(&lockres->l_mask_waiters), lockres->l_type, lockres->l_flags, lockres->l_ro_holders, lockres->l_ex_holders, lockres->l_action, lockres->l_unlock_action, lockres->l_requested, lockres->l_blocking, lockres->l_pending_gen); BUG(); } mlog(ML_BASTS, "lockres %s, level %d => %d, blocking %d\n", lockres->l_name, lockres->l_level, new_level, lockres->l_blocking); lockres->l_action = OCFS2_AST_DOWNCONVERT; lockres->l_requested = new_level; lockres_or_flags(lockres, OCFS2_LOCK_BUSY); return lockres_set_pending(lockres); }
false
false
false
false
false
0
mopacInputFileWindow(gboolean newInputFile) { GtkWidget *button; GtkWidget *hbox = NULL; GtkWidget *hboxChargeMultiplicity = NULL; GtkWidget* comboJobType = NULL; GtkWidget *table = gtk_table_new(4,3,FALSE); newFile = newInputFile; initMopacMolecule(); setMopacMolecule(); if(mopacMolecule.numberOfAtoms <1) { Message( _( "You must initially define your geometry.\n\n" "From the principal Menu select : Geometry/Draw\n" "and draw (or read) your molecule."), "Error",TRUE); return; } if(Wins) destroy_children(Wins); Wins= gtk_dialog_new (); gtk_window_set_position(GTK_WINDOW(Wins),GTK_WIN_POS_CENTER); gtk_window_set_transient_for(GTK_WINDOW(Wins),GTK_WINDOW(Fenetre)); gtk_window_set_title(&GTK_DIALOG(Wins)->window,_("Mopac input")); gtk_window_set_modal (GTK_WINDOW (Wins), TRUE); init_child(Wins, destroyWinsMopac,_(" Mopac input ")); g_signal_connect(G_OBJECT(Wins),"delete_event",(GCallback)destroy_children,NULL); gtk_widget_realize(Wins); button = create_button(Wins,_("Cancel")); gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->action_area), button, FALSE, TRUE, 5); g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK( toCancelWin),GTK_OBJECT(Wins)); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show (button); button = create_button(Wins,_("OK")); gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->vbox), table, FALSE, TRUE, 5); hbox =addHboxToTable(table, 0, 0, 1, 1); hboxChargeMultiplicity = hbox; hbox =addHboxToTable(table, 1, 0, 1, 2); createMopacRemFrame(Wins, hbox); createMopacChargeMultiplicityFrame(hboxChargeMultiplicity); hbox =addHboxToTable(table, 2, 0, 1, 2); createReactionPathFrame(hbox); comboJobType = g_object_get_data(G_OBJECT (Wins), "ComboJobType"); if(comboJobType) g_object_set_data(G_OBJECT (comboJobType), "HboxReactionPath", hbox); gtk_widget_set_sensitive(hbox, FALSE); gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->action_area), button, FALSE, TRUE, 5); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_grab_default(button); gtk_widget_show (button); g_signal_connect_swapped(G_OBJECT(button), "clicked",G_CALLBACK(putInfoInTextEditor),GTK_OBJECT(Wins)); g_signal_connect_swapped(G_OBJECT(button), "clicked",G_CALLBACK(destroy_children),GTK_OBJECT(Wins)); gtk_widget_show_all(Wins); mopacWin = Wins; }
false
false
false
false
false
0
setBlankMailboxes(const fxStr& s) { for (u_int i = 0, n = jobs->length(); i < n; i++) { SendFaxJob& job = (*jobs)[i]; if (job.getMailbox() == "") job.setMailbox(s); } }
false
false
false
false
false
0
printMULTI(uchar *serialized) { LWGEOM_INSPECTED *inspected = lwgeom_inspect(serialized); LWLINE *line; LWPOINT *point; LWPOLY *poly; int t; lwnotice("MULTI* geometry (type = %i), with %i sub-geoms",lwgeom_getType((uchar)serialized[0]), inspected->ngeometries); for (t=0;t<inspected->ngeometries;t++) { lwnotice(" sub-geometry %i:", t); line = NULL; point = NULL; poly = NULL; line = lwgeom_getline_inspected(inspected,t); if (line !=NULL) { printLWLINE(line); } poly = lwgeom_getpoly_inspected(inspected,t); if (poly !=NULL) { printLWPOLY(poly); } point = lwgeom_getpoint_inspected(inspected,t); if (point !=NULL) { printPA(point->point); } } lwnotice("end multi*"); lwinspected_release(inspected); }
false
false
false
false
false
0
gck_builder_init_full (GckBuilder *builder, GckBuilderFlags flags) { GckRealBuilder *real = (GckRealBuilder *)builder; g_return_if_fail (builder != NULL); memset (builder, 0, sizeof (GckBuilder)); real->secure = flags & GCK_BUILDER_SECURE_MEMORY; }
false
false
false
false
false
0
compute_laterin (struct edge_list *edge_list, sbitmap *earliest, sbitmap *antloc, sbitmap *later, sbitmap *laterin) { int num_edges, i; edge e; basic_block *worklist, *qin, *qout, *qend, bb; unsigned int qlen; edge_iterator ei; num_edges = NUM_EDGES (edge_list); /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks. */ qin = qout = worklist = XNEWVEC (basic_block, n_basic_blocks); /* Initialize a mapping from each edge to its index. */ for (i = 0; i < num_edges; i++) INDEX_EDGE (edge_list, i)->aux = (void *) (size_t) i; /* We want a maximal solution, so initially consider LATER true for all edges. This allows propagation through a loop since the incoming loop edge will have LATER set, so if all the other incoming edges to the loop are set, then LATERIN will be set for the head of the loop. If the optimistic setting of LATER on that edge was incorrect (for example the expression is ANTLOC in a block within the loop) then this algorithm will detect it when we process the block at the head of the optimistic edge. That will requeue the affected blocks. */ bitmap_vector_ones (later, num_edges); /* Note that even though we want an optimistic setting of LATER, we do not want to be overly optimistic. Consider an outgoing edge from the entry block. That edge should always have a LATER value the same as EARLIEST for that edge. */ FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) bitmap_copy (later[(size_t) e->aux], earliest[(size_t) e->aux]); /* Add all the blocks to the worklist. This prevents an early exit from the loop given our optimistic initialization of LATER above. */ FOR_EACH_BB (bb) { *qin++ = bb; bb->aux = bb; } /* Note that we do not use the last allocated element for our queue, as EXIT_BLOCK is never inserted into it. */ qin = worklist; qend = &worklist[n_basic_blocks - NUM_FIXED_BLOCKS]; qlen = n_basic_blocks - NUM_FIXED_BLOCKS; /* Iterate until the worklist is empty. */ while (qlen) { /* Take the first entry off the worklist. */ bb = *qout++; bb->aux = NULL; qlen--; if (qout >= qend) qout = worklist; /* Compute the intersection of LATERIN for each incoming edge to B. */ bitmap_ones (laterin[bb->index]); FOR_EACH_EDGE (e, ei, bb->preds) bitmap_and (laterin[bb->index], laterin[bb->index], later[(size_t)e->aux]); /* Calculate LATER for all outgoing edges. */ FOR_EACH_EDGE (e, ei, bb->succs) if (bitmap_ior_and_compl (later[(size_t) e->aux], earliest[(size_t) e->aux], laterin[e->src->index], antloc[e->src->index]) /* If LATER for an outgoing edge was changed, then we need to add the target of the outgoing edge to the worklist. */ && e->dest != EXIT_BLOCK_PTR && e->dest->aux == 0) { *qin++ = e->dest; e->dest->aux = e; qlen++; if (qin >= qend) qin = worklist; } } /* Computation of insertion and deletion points requires computing LATERIN for the EXIT block. We allocated an extra entry in the LATERIN array for just this purpose. */ bitmap_ones (laterin[last_basic_block]); FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds) bitmap_and (laterin[last_basic_block], laterin[last_basic_block], later[(size_t) e->aux]); clear_aux_for_edges (); free (worklist); }
false
false
false
false
false
0
replaceITE(const Expr& e) { TRACE("replaceITE","replaceITE(", e, ") { "); Theorem res; CDMap<Expr,Theorem>::iterator i=d_replaceITECache.find(e), iend=d_replaceITECache.end(); if(i!=iend) { TRACE("replaceITE", "replaceITE[cached] => ", (*i).second, " }"); return (*i).second; } if(e.isAbsLiteral()) res = d_core->rewriteLiteral(e); else res = d_commonRules->reflexivityRule(e); // If 'res' is e<=>phi, and the resulting formula phi is not a // literal, introduce a new variable x, enqueue phi<=>x, and return // e<=>x. if(!res.getRHS().isPropLiteral()) { Theorem varThm(findInCNFCache(res.getRHS())); if(varThm.isNull()) { varThm = d_commonRules->varIntroSkolem(res.getRHS()); Theorem var; if(res.isRewrite()) var = d_commonRules->transitivityRule(res,varThm); else var = d_commonRules->iffMP(res,varThm); //d_cnfVars[var.getExpr()] = true; //addCNFFact(var); addToCNFCache(varThm); } applyCNFRules(varThm); //enqueueCNFrec(varThm); res = d_commonRules->transitivityRule(res, varThm); } d_replaceITECache[e] = res; TRACE("replaceITE", "replaceITE => ", res, " }"); return res; }
false
false
false
false
false
0
Bop_rgb18_toK_Aop( GenefxState *gfxs ) { int w = gfxs->length; u8 *D = gfxs->Aop[0]; u8 *S = gfxs->Bop[0]; u32 Dkey = gfxs->Dkey; while (w--) { if (Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) { D[0] = S[0]; D[1] = S[1]; D[2] = S[2]; } S += 3; D += 3; } }
false
false
false
false
false
0
open() { QByteArray _mountpath = QFile::encodeName( m_mountPath ); //must be on stack during use const char* mountpath = _mountpath.data(); m_itdb = itdb_new(); itdb_set_mountpoint( m_itdb, mountpath ); m_mpl = itdb_playlist_new( "iPod", false ); itdb_playlist_set_mpl( m_mpl ); GError* err = 0; m_itdb = itdb_parse( mountpath, &err ); if ( err ) throw tr( "The iPod database could not be opened." ); if ( m_uid.isEmpty() ) { //QFileInfo f( m_mountPath + "/iPod_Control/Device" ); //m_uid = f.created().toString( "yyMMdd_hhmmss" ); m_uid = itdb_device_get_sysinfo( m_itdb->device, "FirewireGuid" ); qDebug() << "uid" << m_uid; } }
false
false
false
false
false
0
pipe_wait( DirectStream *stream, unsigned int length, struct timeval *tv ) { fd_set s; if (stream->cache_size >= length) return DR_OK; FD_ZERO( &s ); FD_SET( stream->fd, &s ); switch (select( stream->fd+1, &s, NULL, NULL, tv )) { case 0: if (!tv && !stream->cache_size) return DR_EOF; return DR_TIMEOUT; case -1: return errno2result( errno ); } return DR_OK; }
false
false
false
false
false
0
multi_pxo_chat_is_private(char *txt) { char save; // quick check if( strlen(txt) > strlen( PMSG_FROM ) ){ // otherwise do a comparison save = txt[strlen( PMSG_FROM )]; txt[strlen( PMSG_FROM )] = '\0'; if(!stricmp( txt, PMSG_FROM )){ txt[strlen( PMSG_FROM )] = save; return &txt[strlen( PMSG_FROM )]; } txt[strlen( PMSG_FROM )] = save; } // quick check if(strlen(txt) > strlen( PMSG_TO )){ // otherwise do a comparison save = txt[strlen(PMSG_TO)]; txt[strlen(PMSG_TO)] = '\0'; if(!stricmp(txt,PMSG_TO)){ txt[strlen(PMSG_TO)] = save; return &txt[strlen(PMSG_TO)]; } txt[strlen(PMSG_TO)] = save; } return NULL; }
false
false
false
false
false
0
XMapSubwindows(Display *display, Window w) { static int (*fptr)() = 0; int value; if (fptr == 0) { DPRINTF ((stderr, "liballtraynomap: set error handler\n")); void *dlh_xerr = NULL; int (*fptr_xerr)() = 0; dlh_xerr = dlopen ("libX11.so", RTLD_GLOBAL | RTLD_NOW); if (dlh_xerr == NULL) dlh_xerr = dlopen ("libX11.so.6", RTLD_GLOBAL | RTLD_NOW); if (dlh_xerr != NULL) { dlclose (dlh_xerr); fptr_xerr = (int (*)())dlsym (dlh_xerr, "XSetErrorHandler"); if (fptr_xerr != NULL) { DPRINTF ((stderr, "liballtraynomap: set error handler\n")); (*fptr_xerr) (error_handler); } } #ifdef RTLD_NEXT fptr = (int (*)())dlsym (RTLD_NEXT, "XMapSubwindows"); #else DPRINTF ((stderr, "liballtraynomap: no RTLD_NEXT\n")); void *dlh = NULL; dlh = dlopen ("libX11.so", RTLD_GLOBAL | RTLD_NOW); if (dlh == NULL) dlh = dlopen ("libX11.so.6", RTLD_GLOBAL | RTLD_NOW); if (dlh == NULL) fprintf (stderr, "liballtraynomap: %s\n", dlerror ()); if (dlh != NULL) { fptr = (int (*)())dlsym (dlh, "XMapSubwindows"); dlclose (dlh); } DPRINTF ((stderr, "liballtraynomap: XMapSubwindows is at %p\n", fptr)); #endif if (fptr == NULL) { fprintf (stderr, "liballtraynomap: dlsym: %s\n", dlerror()); return 0; } } if (do_nothing) return (*fptr)(display, w); DPRINTF ((stderr, "liballtraynomap: XMapSubwindows %d\n", w)); if (iconic (display,w)) { value=(*fptr)(display, w); XWithdrawWindow (display, w,0); sent_found_window_to_parent (display, w); do_nothing=1; } else { value=(*fptr)(display, w); } return value; }
false
false
false
false
false
0
adjustFile(FILE *fp, int curSize) { struct stat statBuf; int fd = fileno(fp); if ( fstat(fd, &statBuf) == -1 ) return(-1); if ( statBuf.st_size < curSize ) /* file has shrunk! */ { if ( fseek(fp, 0L, 0) == -1 ) /* get back to the beginning */ return(-1); } curSize = (int) statBuf.st_size; if ( !curSize ) curSize = 1; return(curSize); }
false
false
false
false
false
0
ath_isr(int irq, void *dev) { #define SCHED_INTR ( \ ATH9K_INT_FATAL | \ ATH9K_INT_BB_WATCHDOG | \ ATH9K_INT_RXORN | \ ATH9K_INT_RXEOL | \ ATH9K_INT_RX | \ ATH9K_INT_RXLP | \ ATH9K_INT_RXHP | \ ATH9K_INT_TX | \ ATH9K_INT_BMISS | \ ATH9K_INT_CST | \ ATH9K_INT_GTT | \ ATH9K_INT_TSFOOR | \ ATH9K_INT_GENTIMER | \ ATH9K_INT_MCI) struct ath_softc *sc = dev; struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); enum ath9k_int status; u32 sync_cause = 0; bool sched = false; /* * The hardware is not ready/present, don't * touch anything. Note this can happen early * on if the IRQ is shared. */ if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) return IRQ_NONE; /* shared irq, not for us */ if (!ath9k_hw_intrpend(ah)) return IRQ_NONE; /* * Figure out the reason(s) for the interrupt. Note * that the hal returns a pseudo-ISR that may include * bits we haven't explicitly enabled so we mask the * value to insure we only process bits we requested. */ ath9k_hw_getisr(ah, &status, &sync_cause); /* NB: clears ISR too */ ath9k_debug_sync_cause(sc, sync_cause); status &= ah->imask; /* discard unasked-for bits */ if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) return IRQ_HANDLED; /* * If there are no status bits set, then this interrupt was not * for me (should have been caught above). */ if (!status) return IRQ_NONE; /* Cache the status */ spin_lock(&sc->intr_lock); sc->intrstatus |= status; spin_unlock(&sc->intr_lock); if (status & SCHED_INTR) sched = true; /* * If a FATAL interrupt is received, we have to reset the chip * immediately. */ if (status & ATH9K_INT_FATAL) goto chip_reset; if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) && (status & ATH9K_INT_BB_WATCHDOG)) goto chip_reset; if (status & ATH9K_INT_SWBA) tasklet_schedule(&sc->bcon_tasklet); if (status & ATH9K_INT_TXURN) ath9k_hw_updatetxtriglevel(ah, true); if (status & ATH9K_INT_RXEOL) { ah->imask &= ~(ATH9K_INT_RXEOL | ATH9K_INT_RXORN); ath9k_hw_set_interrupts(ah); } if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) if (status & ATH9K_INT_TIM_TIMER) { if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) goto chip_reset; /* Clear RxAbort bit so that we can * receive frames */ ath9k_setpower(sc, ATH9K_PM_AWAKE); spin_lock(&sc->sc_pm_lock); ath9k_hw_setrxabort(sc->sc_ah, 0); sc->ps_flags |= PS_WAIT_FOR_BEACON; spin_unlock(&sc->sc_pm_lock); } chip_reset: ath_debug_stat_interrupt(sc, status); if (sched) { /* turn off every interrupt */ ath9k_hw_kill_interrupts(ah); tasklet_schedule(&sc->intr_tq); } return IRQ_HANDLED; #undef SCHED_INTR }
false
false
false
false
false
0
auto_filler_arithmetic (gboolean singleton) { AutoFillerArithmetic *res = g_new (AutoFillerArithmetic, 1); res->filler.status = AFS_INCOMPLETE; res->filler.priority = 100; res->filler.finalize = afa_finalize; res->filler.teach_cell = afa_teach_cell; res->filler.set_cell = afa_set_cell; res->filler.hint = afa_hint; res->format = NULL; res->dateconv = NULL; res->singleton = singleton; return &res->filler; }
false
false
false
false
false
0
marker(UnpicklerObject *self) { PickleState *st = _Pickle_GetGlobalState(); if (self->num_marks < 1) { PyErr_SetString(st->UnpicklingError, "could not find MARK"); return -1; } return self->marks[--self->num_marks]; }
false
false
false
false
false
0
derefSize(QSize size) { assert(original); if (size == this->size() || this->size().isEmpty()) return; QPair<int, int> key = trSize(size); PixmapPlane* plane = scaled.value(key); --plane->refCount; if (plane->refCount == 0) { delete plane; scaled.remove(key); } }
false
false
false
false
false
0
v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_v4l2_buffer *vbuf) { struct v4l2_m2m_buffer *b = container_of(vbuf, struct v4l2_m2m_buffer, vb); struct v4l2_m2m_queue_ctx *q_ctx; unsigned long flags; q_ctx = get_queue_ctx(m2m_ctx, vbuf->vb2_buf.vb2_queue->type); if (!q_ctx) return; spin_lock_irqsave(&q_ctx->rdy_spinlock, flags); list_add_tail(&b->list, &q_ctx->rdy_queue); q_ctx->num_rdy++; spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); }
false
false
false
false
false
0
git_get_colorbool_config(const char *var, const char *value, void *cb) { if (!strcmp(var, get_colorbool_slot)) { get_colorbool_found = git_config_colorbool(var, value, stdout_is_tty); } if (!strcmp(var, "diff.color")) { get_diff_color_found = git_config_colorbool(var, value, stdout_is_tty); } if (!strcmp(var, "color.ui")) { git_use_color_default = git_config_colorbool(var, value, stdout_is_tty); return 0; } return 0; }
false
false
false
false
false
0
gearman_task_error(const gearman_task_st *task) { if (task == NULL) { return NULL; } if (task->result_rc == GEARMAN_UNKNOWN_STATE or task->result_rc == GEARMAN_SUCCESS) { return NULL; } return gearman_strerror(task->result_rc); }
false
false
false
false
false
0
inclinenumber(LexState *ls) { int old = ls->current; lua_assert(currIsNewline(ls)); next(ls); /* skip `\n' or `\r' */ if (currIsNewline(ls) && ls->current != old) next(ls); /* skip `\n\r' or `\r\n' */ if (++ls->linenumber >= LJ_MAX_LINE) lj_lex_error(ls, ls->token, LJ_ERR_XLINES); }
false
false
false
false
false
0
ClipboardCopy() {//=========================== int ix; int nframes; int count=0; nframes = CountSelected(); if(nframes == 0) return; if(clipboard_spect != NULL) delete clipboard_spect; if((clipboard_spect = new SpectSeq(nframes))==NULL) return; for(ix=0; ix<numframes; ix++) { if(frames[ix]->selected) { if((clipboard_spect->frames[count] = new SpectFrame(frames[ix])) == NULL) break; count++; } } }
false
false
false
false
false
0
destroy_rtp(struct skinny_subchannel *sub) { if (sub->rtp) { SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying RTP\n", sub->callid); ast_rtp_instance_stop(sub->rtp); ast_rtp_instance_destroy(sub->rtp); sub->rtp = NULL; } if (sub->vrtp) { SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying VRTP\n", sub->callid); ast_rtp_instance_stop(sub->vrtp); ast_rtp_instance_destroy(sub->vrtp); sub->vrtp = NULL; } }
false
false
false
false
false
0
graph_pallet(struct graph* g, int idx, unsigned int c) { if (g == NULL || c >= 256) return; if (g->pallet_count <= idx) { memset(g->png_data + 0x29 + 3 * g->pallet_count,0,(idx - g->pallet_count) * 3); g->pallet_count = idx + 1; } g->png_data[0x29 + idx * 3 ] = (unsigned char)((c >> 16) & 0xFF); // R g->png_data[0x29 + idx * 3 + 1] = (unsigned char)((c >> 8) & 0xFF); // G g->png_data[0x29 + idx * 3 + 2] = (unsigned char)( c & 0xFF); // B graph_write_dword(g->png_data + 0x21,g->pallet_count * 3); graph_write_dword( g->png_data + 0x29 + g->pallet_count * 3, grfio_crc32(g->png_data + 0x25,g->pallet_count * 3 + 4) ); g->png_dirty = 1; return; }
false
false
false
false
false
0
connect_node_to_common_table (Module_table *current_mpt, Common_table *new_cmt) { Var_table *vpt; Array_table *apt; Common_node *last = NULL; int offset = 0; for (vpt = current_mpt->var_head; vpt; vpt = vpt->next) { if (vpt->node == NULL || vpt->node->id != new_cmt->region->entry) continue; if (new_cmt->node_head == NULL) { new_cmt->node_head = vpt->node; } vpt->node->parent = new_cmt; vpt->node->region = new_cmt->region; vpt->node->offset = offset; offset += vpt->node->size; if (last == NULL) { last = vpt->node; } else { last->next = vpt->node; last = last->next; } } for (apt = current_mpt->array_head; apt; apt = apt->next) { if (apt->node == NULL || apt->node->id != new_cmt->region->entry) continue; if (new_cmt->node_head == NULL) { new_cmt->node_head = apt->node; } apt->node->parent = new_cmt; apt->node->region = new_cmt->region; apt->node->offset = offset; offset += apt->node->size; if (last == NULL) { last = apt->node; } else { last->next = apt->node; last = last->next; } } }
false
false
false
false
false
0
GetEncodedRMWOperation(AtomicRMWInst::BinOp Op) { switch (Op) { default: llvm_unreachable("Unknown RMW operation!"); case AtomicRMWInst::Xchg: return bitc::RMW_XCHG; case AtomicRMWInst::Add: return bitc::RMW_ADD; case AtomicRMWInst::Sub: return bitc::RMW_SUB; case AtomicRMWInst::And: return bitc::RMW_AND; case AtomicRMWInst::Nand: return bitc::RMW_NAND; case AtomicRMWInst::Or: return bitc::RMW_OR; case AtomicRMWInst::Xor: return bitc::RMW_XOR; case AtomicRMWInst::Max: return bitc::RMW_MAX; case AtomicRMWInst::Min: return bitc::RMW_MIN; case AtomicRMWInst::UMax: return bitc::RMW_UMAX; case AtomicRMWInst::UMin: return bitc::RMW_UMIN; } }
false
false
false
false
false
0
glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success); if (LE_FAILURE(success)) { return 0; } if (fGSUBTable.isValid()) { if (fScriptTagV2 != nullScriptTag && fGSUBTable->coversScriptAndLanguage(fGSUBTable, fScriptTagV2, fLangSysTag, success)) { count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTagV2, fLangSysTag, fGDEFTable, fSubstitutionFilter, fFeatureMap, fFeatureMapCount, fFeatureOrder, success); } else { count = fGSUBTable->process(fGSUBTable, glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, fFeatureMap, fFeatureMapCount, fFeatureOrder, success); } } return count; }
false
false
false
false
false
0
transpose(void) const { matrix3x3 returnValue; for(unsigned int i=0; i<3; i++) for(unsigned int j=0; j<3; j++) returnValue.ele[i][j] = ele[j][i]; return(returnValue); }
false
false
false
false
false
0
drmaa_get_next_attr_value(drmaa_attr_values_t* values, char *value, size_t value_len) { dstring val; if (value != NULL) { sge_dstring_init(&val, value, value_len+1); } return japi_string_vector_get_next(values, value?&val:NULL); }
false
false
false
false
false
0
table_NAN (struct GMTMATH_INFO *info, double **stack[], GMT_LONG *constant, double *factor, GMT_LONG last, GMT_LONG col, GMT_LONG n_row) /*OPERATOR: NAN 2 1 NaN if A == B, else A. */ { GMT_LONG i, prev; double a = 0.0, b = 0.0; prev = last - 1; if (constant[prev]) a = factor[prev]; if (constant[last]) b = factor[last]; for (i = 0; i < n_row; i++) { if (!constant[prev]) a = stack[prev][col][i]; if (!constant[last]) b = stack[last][col][i]; stack[prev][col][i] = ((a == b) ? GMT_d_NaN : a); } }
false
false
false
false
false
0
read_nres_amino(ESL_SQFILE *sqfp, ESL_SQ *sq, int len, uint64_t *nres) { int inx; int off; int size; char *ptr; ESL_SQNCBI_DATA *ncbi = &sqfp->data.ncbi; if (ncbi->index >= ncbi->num_seq) return eslEOF; /* if we don't know the sequence length, figure it out */ if (ncbi->seq_L == -1) ncbi->seq_L = sq->eoff - sq->doff - 1; /* check if we are at the end */ if (sq->start + sq->n > ncbi->seq_L) { if (nres != NULL) *nres = 0; sq->L = ncbi->seq_L; return eslEOD; } /* figure out if the sequence is in digital mode or not */ ptr = (sq->dsq != NULL) ? (char *)sq->dsq + 1 : sq->seq; ptr += sq->n; /* calculate where to start reading from */ off = sq->doff + sq->start + sq->n - 1; /* calculate the size to read */ size = ncbi->seq_L - (sq->start + sq->n - 1); size = (size > len) ? len : size; /* seek to the windows location and read into the buffer */ if (fseek(ncbi->fppsq, off, SEEK_SET) != 0) return eslESYS; if (fread(ptr, sizeof(char), size, ncbi->fppsq) != size) return eslEFORMAT; /* figure out if the sequence is in digital mode or not */ for (inx = 0; inx < size; ++inx) { *ptr = sqfp->inmap[(int) *ptr]; if (sq->dsq == NULL) *ptr = ncbi->alphasym[(int) *ptr]; ++ptr; } *ptr = (sq->dsq == NULL) ? '\0' : eslDSQ_SENTINEL; sq->n = sq->n + size; if (nres != NULL) *nres = size; return eslOK; }
false
false
false
false
false
0
Bitstream_read ( Int bits ) { Uint32_t ret; ret = dword; if ( (pos += bits) < BITS ) { ret >>= BITS - pos; } else { pos -= BITS; dword = InputBuff [InputCnt = (InputCnt+1) & IBUFMASK]; if ( pos > 0 ) { ret <<= pos; ret |= dword >> (BITS - pos); } } ret &= mask [bits]; return ret; }
false
false
false
false
false
0
makeurl(const char * fmt, ...) { static char url[512]; const char * src = fmt; char * ptr = NULL; unsigned pos = 0; va_list argv; va_start(argv, fmt); memset(url, 0, sizeof(url)); while(* src && pos < sizeof(url) - 1) { if(* src != '%') url[pos++] = * (src++); else if(* (src + 1)) { switch(* (++src)) { case '%': url[pos] = '%'; break; case 's': encode(va_arg(argv, char *), & ptr); pos += snprintf(& url[pos], sizeof(url) - pos, "%s", ptr); free(ptr); ptr = NULL; break; case 'i': pos += sprintf(& url[pos], "%d", va_arg(argv, int)); break; case 'u': pos += sprintf(& url[pos], "%u", va_arg(argv, unsigned)); break; } ++src; } } return url; }
false
false
false
false
false
0
gnet_stats_count_dropped_nosize( const gnutella_node_t *n, msg_drop_reason_t reason) { uint type; gnet_stats_t *stats; g_assert(UNSIGNED(reason) < MSG_DROP_REASON_COUNT); type = stats_lut[gnutella_header_get_function(&n->header)]; stats = NODE_USES_UDP(n) ? &gnet_udp_stats : &gnet_tcp_stats; /* Data part of message not read */ DROP_STATS(stats, type, sizeof(n->header)); if (GNET_PROPERTY(log_dropped_gnutella)) gmsg_log_split_dropped(&n->header, n->data, 0, "from %s: %s", node_infostr(n), gnet_stats_drop_reason_to_string(reason)); }
false
false
false
false
false
0
qcsequenceadaptorFetchAllbyStatement( EnsPBaseadaptor ba, const AjPStr statement, EnsPAssemblymapper am, EnsPSlice slice, AjPList qcss) { ajuint identifier = 0U; ajuint databaseid = 0U; ajuint version = 0U; ajuint length = 0U; ajuint cdsstart = 0U; ajuint cdsend = 0U; ajint cdsstrand = 0; ajuint polya = 0U; AjPSqlstatement sqls = NULL; AjISqlrow sqli = NULL; AjPSqlrow sqlr = NULL; AjPStr name = NULL; AjPStr accession = NULL; AjPStr type = NULL; AjPStr description = NULL; EnsPDatabaseadaptor dba = NULL; EnsPQcsequence qcs = NULL; EnsPQcsequenceadaptor qcsa = NULL; EnsPQcdatabase qcdb = NULL; EnsPQcdatabaseadaptor qcdba = NULL; if (ajDebugTest("qcsequenceadaptorFetchAllbyStatement")) ajDebug("qcsequenceadaptorFetchAllbyStatement\n" " ba %p\n" " statement %p\n" " am %p\n" " slice %p\n" " qcss %p\n", ba, statement, am, slice, qcss); if (!ba) return ajFalse; if (!statement) return ajFalse; if (!qcss) return ajFalse; dba = ensBaseadaptorGetDatabaseadaptor(ba); qcdba = ensRegistryGetQcdatabaseadaptor(dba); qcsa = ensRegistryGetQcsequenceadaptor(dba); sqls = ensDatabaseadaptorSqlstatementNew(dba, statement); sqli = ajSqlrowiterNew(sqls); while (!ajSqlrowiterDone(sqli)) { identifier = 0; databaseid = 0; name = ajStrNew(); accession = ajStrNew(); version = 0; type = ajStrNew(); length = 0; cdsstart = 0; cdsend = 0; cdsstrand = 0; polya = 0; description = ajStrNew(); sqlr = ajSqlrowiterGet(sqli); ajSqlcolumnToUint(sqlr, &identifier); ajSqlcolumnToUint(sqlr, &databaseid); ajSqlcolumnToStr(sqlr, &name); ajSqlcolumnToStr(sqlr, &accession); ajSqlcolumnToUint(sqlr, &version); ajSqlcolumnToStr(sqlr, &type); ajSqlcolumnToUint(sqlr, &length); ajSqlcolumnToUint(sqlr, &cdsstart); ajSqlcolumnToUint(sqlr, &cdsend); ajSqlcolumnToInt(sqlr, &cdsstrand); ajSqlcolumnToUint(sqlr, &polya); ajSqlcolumnToStr(sqlr, &description); ensQcdatabaseadaptorFetchByIdentifier(qcdba, databaseid, &qcdb); qcs = ensQcsequenceNewIni(qcsa, identifier, qcdb, name, accession, version, type, length, cdsstart, cdsend, cdsstrand, polya, description); ajListPushAppend(qcss, (void *) qcs); ensQcdatabaseDel(&qcdb); ajStrDel(&name); ajStrDel(&accession); ajStrDel(&type); ajStrDel(&description); } ajSqlrowiterDel(&sqli); ensDatabaseadaptorSqlstatementDel(dba, &sqls); return ajTrue; }
false
false
false
false
false
0
is_solution(int move, const board_t * board, const char bm[], const char am[]) { char move_string[256]; bool correct; ASSERT(move!=MoveNone); ASSERT(bm!=NULL); ASSERT(am!=NULL); if (!move_is_legal(move,board)) { board_disp(board); move_disp(move,board); printf("\n\n"); } ASSERT(move_is_legal(move,board)); if (!move_to_san(move,board,move_string,256)) ASSERT(false); correct = false; if (!my_string_empty(bm)) { correct = string_contain(bm,move_string); } else if (!my_string_empty(am)) { correct = !string_contain(am,move_string); } else { ASSERT(false); } return correct; }
false
false
false
false
false
0
zcurrentdash(i_ctx_t *i_ctx_p) { os_ptr op = osp; push(2); ref_assign(op - 1, &istate->dash_pattern_array); make_real(op, gs_currentdash_offset(igs)); return 0; }
false
false
false
false
false
0
nego_attempt_tls(rdpNego* nego) { uint8 code; nego->requested_protocols = PROTOCOL_TLS; DEBUG_NEGO("Attempting TLS security"); nego_tcp_connect(nego); nego_send_negotiation_request(nego); nego_recv_response(nego); if (nego->state != NEGO_STATE_FINAL) { nego_tcp_disconnect(nego); if (nego->enabled_protocols[PROTOCOL_RDP] > 0) nego->state = NEGO_STATE_RDP; else nego->state = NEGO_STATE_FAIL; } }
false
false
false
false
false
0
main( int argc, char * argv[] ) { int port = 1770, maxThreads = 10; const char * serverType = "lf"; extern char *optarg ; int c ; while( ( c = getopt ( argc, argv, "p:t:s:v" )) != EOF ) { switch ( c ) { case 'p' : port = atoi( optarg ); break; case 't': maxThreads = atoi( optarg ); break; case 's': serverType = optarg; break; case '?' : case 'v' : printf( "Usage: %s [-p <port>] [-t <threads>] [-s <hahs|lf>]\n", argv[0] ); exit( 0 ); } } openlog( "testunp", LOG_CONS | LOG_PID | LOG_PERROR, LOG_USER ); setlogmask( LOG_UPTO( LOG_WARNING ) ); if( 0 == strcasecmp( serverType, "hahs" ) ) { SP_Server server( "", port, new SP_UnpHandlerFactory() ); server.setTimeout( 60 ); server.setMaxThreads( maxThreads ); server.setReqQueueSize( 100, "Sorry, server is busy now!\r\n" ); server.runForever(); } else { SP_LFServer server( "", port, new SP_UnpHandlerFactory() ); server.setTimeout( 60 ); server.setMaxThreads( maxThreads ); server.setReqQueueSize( 100, "Sorry, server is busy now!\r\n" ); server.runForever(); } closelog(); return 0; }
false
false
false
false
false
0
returnValueData(ParserControl *parm, parseUnion *stateUnion) { parseUnion lvalp ={0}; ct = localLex((parseUnion*)&stateUnion->xtokReturnValueData, parm); if(ct == XTOK_VALUE) { dontLex = 1; value(parm, (parseUnion*)&stateUnion->xtokReturnValueData.value); } else if(ct == XTOK_VALUEREFERENCE) { dontLex = 1; valueReference(parm, (parseUnion*)&stateUnion->xtokReturnValueData.ref); stateUnion->xtokReturnValueData.type = CMPI_ref; } else { parseError("XTOK_VALUE or XTOK_VALUEREFERENCE", ct, parm); } }
false
false
false
false
false
0
drm_kms_helper_poll_enable_locked(struct drm_device *dev) { bool poll = false; struct drm_connector *connector; WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) return; drm_for_each_connector(connector, dev) { if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT)) poll = true; } if (poll) schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); }
false
false
false
false
false
0
preserveOptionsEdit() { // If the user has chosen an item from the option combo list, don't overwrite the current text // Therefore preserving the text in the edit as soon the user highlights an entry in the combo list TempOptions = ComboBoxOptions->currentText(); }
false
false
false
false
false
0
put(const Str &key, const Str &value) { while (failing) /* do nothing */; q_[0].run_replace(tree->table(), key, value, *ti_); if (ti_->logger()) // NB may block ti_->logger()->record(logcmd_replace, q_[0].query_times(), key, value); }
false
false
false
false
false
0
changeEvent( QEvent *event ) { switch( event->type() ) { case QEvent::StyleChange: case QEvent::FontChange: layoutKnob( true ); break; default: break; } }
false
false
false
false
false
0
__bam_set_flags(dbp, flagsp) DB *dbp; u_int32_t *flagsp; { BTREE *t; u_int32_t flags; t = dbp->bt_internal; flags = *flagsp; if (LF_ISSET(DB_DUP | DB_DUPSORT | DB_RECNUM | DB_REVSPLITOFF)) DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_flags"); /* * The DB_DUP and DB_DUPSORT flags are shared by the Hash * and Btree access methods. */ if (LF_ISSET(DB_DUP | DB_DUPSORT)) DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE | DB_OK_HASH); if (LF_ISSET(DB_RECNUM | DB_REVSPLITOFF)) DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE | DB_OK_HASH); /* DB_DUP/DB_DUPSORT is incompatible with DB_RECNUM. */ if (LF_ISSET(DB_DUP | DB_DUPSORT) && F_ISSET(dbp, DB_AM_RECNUM)) goto incompat; /* DB_RECNUM is incompatible with DB_DUP/DB_DUPSORT. */ if (LF_ISSET(DB_RECNUM) && F_ISSET(dbp, DB_AM_DUP)) goto incompat; /* DB_RECNUM is incompatible with DB_DUP/DB_DUPSORT. */ if (LF_ISSET(DB_RECNUM) && LF_ISSET(DB_DUP | DB_DUPSORT)) goto incompat; #ifdef HAVE_COMPRESSION /* DB_RECNUM is incompatible with compression */ if (LF_ISSET(DB_RECNUM) && DB_IS_COMPRESSED(dbp)) { __db_errx(dbp->env, DB_STR("1024", "DB_RECNUM cannot be used with compression")); return (EINVAL); } /* DB_DUP without DB_DUPSORT is incompatible with compression */ if (LF_ISSET(DB_DUP) && !LF_ISSET(DB_DUPSORT) && !F_ISSET(dbp, DB_AM_DUPSORT) && DB_IS_COMPRESSED(dbp)) { __db_errx(dbp->env, DB_STR("1025", "DB_DUP cannot be used with compression without DB_DUPSORT")); return (EINVAL); } #endif if (LF_ISSET(DB_DUPSORT) && dbp->dup_compare == NULL) { #ifdef HAVE_COMPRESSION if (DB_IS_COMPRESSED(dbp)) { dbp->dup_compare = __bam_compress_dupcmp; t->compress_dup_compare = __bam_defcmp; } else #endif dbp->dup_compare = __bam_defcmp; } __bam_map_flags(dbp, flagsp, &dbp->flags); return (0); incompat: return (__db_ferr(dbp->env, "DB->set_flags", 1)); }
false
false
false
false
false
0
Cudd_bddIsVarHardGroup( DdManager *dd, int index) { if (index >= dd->size || index < 0) return(-1); if (dd->subtables[dd->perm[index]].varToBeGrouped == CUDD_LAZY_HARD_GROUP) return(1); return(0); }
false
false
false
false
false
0
cz_init_uvd_limit(struct amdgpu_device *adev) { struct cz_power_info *pi = cz_get_pi(adev); struct amdgpu_uvd_clock_voltage_dependency_table *table = &adev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table; uint32_t clock = 0, level; if (!table || !table->count) { DRM_ERROR("Invalid Voltage Dependency table.\n"); return; } pi->uvd_dpm.soft_min_clk = 0; pi->uvd_dpm.hard_min_clk = 0; cz_send_msg_to_smc(adev, PPSMC_MSG_GetMaxUvdLevel); level = cz_get_argument(adev); if (level < table->count) clock = table->entries[level].vclk; else { DRM_ERROR("Invalid UVD Voltage Dependency table entry.\n"); clock = table->entries[table->count - 1].vclk; } pi->uvd_dpm.soft_max_clk = clock; pi->uvd_dpm.hard_max_clk = clock; }
false
false
false
false
false
0
OnSetPriorityAuto( wxCommandEvent& WXUNUSED(event) ) { long index = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); while( index != -1 ) { // ADUNANZA BEGIN // Back #if 0 CKnownFile* file = (CKnownFile*)GetItemData( index ); #else CKnownFile* file = reinterpret_cast<CKnownFile*>(GetItemData(index)); #endif // ADUNANZA END CoreNotify_KnownFile_Up_Prio_Auto(file); RefreshItem( index ); index = GetNextItem( index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); } }
false
false
false
false
false
0
vp_request_intx(struct virtio_device *vdev) { int err; struct virtio_pci_device *vp_dev = to_vp_device(vdev); err = request_irq(vp_dev->pci_dev->irq, vp_interrupt, IRQF_SHARED, dev_name(&vdev->dev), vp_dev); if (!err) vp_dev->intx_enabled = 1; return err; }
false
false
false
false
false
0
build_curseg(struct f2fs_sb_info *sbi) { struct curseg_info *array; int i; array = malloc(sizeof(*array) * NR_CURSEG_TYPE); SM_I(sbi)->curseg_array = array; for (i = 0; i < NR_CURSEG_TYPE; i++) { array[i].sum_blk = malloc(PAGE_CACHE_SIZE); if (!array[i].sum_blk) return -ENOMEM; array[i].segno = NULL_SEGNO; array[i].next_blkoff = 0; } return restore_curseg_summaries(sbi); }
false
false
false
false
false
0
modeNumber(bool & cc,tcPDPtr parent, const tPDVector & children) const { if(children.size()!=3) return -1; int id(parent->id()); // check the pions tPDVector::const_iterator pit = children.begin(); tPDVector::const_iterator pend = children.end(); int idtemp,npi0(0),npiplus(0),npiminus(0); for( ; pit!=pend;++pit) { idtemp=(**pit).id(); if(idtemp==ParticleID::piplus) ++npiplus; else if(idtemp==ParticleID::piminus) ++npiminus; else if(idtemp==ParticleID::pi0) ++npi0; } int imode(-1); // a_1+ decay modes if(id==ParticleID::a_1plus) { cc=false; if(npiplus==1&&npi0==2) imode=0; else if(npiplus==2&&npiminus==1) imode=2; } // a_1- modes else if(id==ParticleID::a_1minus) { cc=true; if(npiminus==1&&npi0==2) imode=0; else if(npiminus==2&&npiplus==1) imode=2; } // a_0 modes else if(id==ParticleID::a_10) { cc=false; if(npiminus==1&&npiplus==1&&npi0==1) imode=1; } return imode; }
false
false
false
false
false
0
str_find (void) { char *s = luaL_check_string(1); char *p = luaL_check_string(2); long init = (long)luaL_opt_number(3, 1) - 1; luaL_arg_check(0 <= init && init <= strlen(s), 3, "out of range"); if (lua_getparam(4) != LUA_NOOBJECT || strpbrk(p, SPECIALS) == NULL) { /* no special caracters? */ char *s2 = strstr(s+init, p); if (s2) { lua_pushnumber(s2-s+1); lua_pushnumber(s2-s+strlen(p)); } } else { int anchor = (*p == '^') ? (p++, 1) : 0; char *s1=s+init; do { char *res; if ((res=match(s1, p, 0)) != NULL) { lua_pushnumber(s1-s+1); /* start */ lua_pushnumber(res-s); /* end */ push_captures(); return; } } while (*s1++ && !anchor); } }
false
false
false
false
false
0
crc32_update(unsigned long crcword, const void *buf, size_t len) { const unsigned char *p = (const unsigned char *) buf; while (len--) { unsigned long newbyte = *p++; newbyte ^= crcword & 0xFFL; crcword = (crcword >> 8) ^ crc32_table[newbyte]; } return crcword; }
false
false
false
false
false
0
python_connection(conn_rec *con) { PyObject *resultobject = NULL; interpreterdata *idata; connobject *conn_obj; py_config * conf; int result; const char *interp_name = NULL; hl_entry *hle = NULL; /* get configuration */ conf = (py_config *) ap_get_module_config(con->base_server->module_config, &python_module); /* is there a handler? */ hle = (hl_entry *)apr_hash_get(conf->hlists, "PythonConnectionHandler", APR_HASH_KEY_STRING); if (! hle) { /* nothing to do here */ return DECLINED; } /* determine interpreter to use */ interp_name = select_interp_name(NULL, con, conf, hle, NULL); /* get/create interpreter */ idata = get_interpreter(interp_name); if (!idata) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, con->base_server, "python_connection: Can't get/create interpreter."); return HTTP_INTERNAL_SERVER_ERROR; } /* create connection object */ conn_obj = (connobject*) MpConn_FromConn(con); /* create a handler list object */ conn_obj->hlo = (hlistobject *)MpHList_FromHLEntry(hle); /* * Here is where we call into Python! * This is the C equivalent of * >>> resultobject = obCallBack.Dispatch(request_object, phase) */ resultobject = PyObject_CallMethod(idata->obcallback, "ConnectionDispatch", "O", conn_obj); /* release the lock and destroy tstate*/ release_interpreter(); if (! resultobject) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, con->base_server, "python_connection: ConnectionDispatch() returned nothing."); return HTTP_INTERNAL_SERVER_ERROR; } else { /* Attempt to analyze the result as a string indicating which result to return */ if (! PyInt_Check(resultobject)) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, con->base_server, "python_connection: ConnectionDispatch() returned non-integer."); return HTTP_INTERNAL_SERVER_ERROR; } else result = PyInt_AsLong(resultobject); } /* clean up */ Py_XDECREF(resultobject); /* return the translated result (or default result) to the Server. */ return result; }
false
false
false
false
false
0
ath10k_pci_claim(struct ath10k *ar) { struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); struct pci_dev *pdev = ar_pci->pdev; int ret; pci_set_drvdata(pdev, ar); ret = pci_enable_device(pdev); if (ret) { ath10k_err(ar, "failed to enable pci device: %d\n", ret); return ret; } ret = pci_request_region(pdev, BAR_NUM, "ath"); if (ret) { ath10k_err(ar, "failed to request region BAR%d: %d\n", BAR_NUM, ret); goto err_device; } /* Target expects 32 bit DMA. Enforce it. */ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { ath10k_err(ar, "failed to set dma mask to 32-bit: %d\n", ret); goto err_region; } ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { ath10k_err(ar, "failed to set consistent dma mask to 32-bit: %d\n", ret); goto err_region; } pci_set_master(pdev); /* Arrange for access to Target SoC registers. */ ar_pci->mem_len = pci_resource_len(pdev, BAR_NUM); ar_pci->mem = pci_iomap(pdev, BAR_NUM, 0); if (!ar_pci->mem) { ath10k_err(ar, "failed to iomap BAR%d\n", BAR_NUM); ret = -EIO; goto err_master; } ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot pci_mem 0x%p\n", ar_pci->mem); return 0; err_master: pci_clear_master(pdev); err_region: pci_release_region(pdev, BAR_NUM); err_device: pci_disable_device(pdev); return ret; }
false
false
false
false
false
0
AlterTypeOwner(List *names, Oid newOwnerId) { TypeName *typename; Oid typeOid; Relation rel; HeapTuple tup; HeapTuple newtup; Form_pg_type typTup; AclResult aclresult; rel = heap_open(TypeRelationId, RowExclusiveLock); /* Make a TypeName so we can use standard type lookup machinery */ typename = makeTypeNameFromNameList(names); /* Use LookupTypeName here so that shell types can be processed */ tup = LookupTypeName(NULL, typename, NULL); if (tup == NULL) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("type \"%s\" does not exist", TypeNameToString(typename)))); typeOid = typeTypeId(tup); /* Copy the syscache entry so we can scribble on it below */ newtup = heap_copytuple(tup); ReleaseSysCache(tup); tup = newtup; typTup = (Form_pg_type) GETSTRUCT(tup); /* * If it's a composite type, we need to check that it really is a * free-standing composite type, and not a table's rowtype. We want people * to use ALTER TABLE not ALTER TYPE for that case. */ if (typTup->typtype == TYPTYPE_COMPOSITE && get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("%s is a table's row type", format_type_be(typeOid)), errhint("Use ALTER TABLE instead."))); /* don't allow direct alteration of array types, either */ if (OidIsValid(typTup->typelem) && get_array_type(typTup->typelem) == typeOid) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot alter array type %s", format_type_be(typeOid)), errhint("You can alter type %s, which will alter the array type as well.", format_type_be(typTup->typelem)))); /* * If the new owner is the same as the existing owner, consider the * command to have succeeded. This is for dump restoration purposes. */ if (typTup->typowner != newOwnerId) { /* Superusers can always do it */ if (!superuser()) { /* Otherwise, must be owner of the existing object */ if (!pg_type_ownercheck(HeapTupleGetOid(tup), GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TYPE, TypeNameToString(typename)); /* Must be able to become new owner */ check_is_member_of_role(GetUserId(), newOwnerId); /* New owner must have CREATE privilege on namespace */ aclresult = pg_namespace_aclcheck(typTup->typnamespace, newOwnerId, ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(typTup->typnamespace)); } /* * If it's a composite type, invoke ATExecChangeOwner so that we fix * up the pg_class entry properly. That will call back to * AlterTypeOwnerInternal to take care of the pg_type entry(s). */ if (typTup->typtype == TYPTYPE_COMPOSITE) ATExecChangeOwner(typTup->typrelid, newOwnerId, true); else { /* * We can just apply the modification directly. * * okay to scribble on typTup because it's a copy */ typTup->typowner = newOwnerId; simple_heap_update(rel, &tup->t_self, tup); CatalogUpdateIndexes(rel, tup); /* Update owner dependency reference */ changeDependencyOnOwner(TypeRelationId, typeOid, newOwnerId); /* If it has an array type, update that too */ if (OidIsValid(typTup->typarray)) AlterTypeOwnerInternal(typTup->typarray, newOwnerId, false); } } /* Clean up */ heap_close(rel, RowExclusiveLock); }
false
false
false
false
false
0
str_only_space(const string& str) { unsigned int len = str.length(); for (unsigned int i = 0; i < len; i++) { if (str[i] != ' ') return false; } return true; }
false
false
false
false
false
0
xfs_highbit32(xfs_uint32_t v) { int i; if (--v) { for (i = 0; i < 31; i++, v >>= 1) { if (v == 0) return i; } } return 0; }
false
false
false
false
false
0
Submit(const std::list<JobDescription>& jobdescs, const ExecutionTarget& et, EntityConsumer<Job>& jc, std::list<const JobDescription*>& notSubmitted) { // TODO: this is multi step process. So having retries would be nice. // Submission to EMI ES involves delegation. Delegation may happen through // separate service. Currently existing framework does not provide possibility // to collect this information. So service is re-queried again here. URL iurl; iurl = et.ComputingService->InformationOriginEndpoint.URLString; URL durl; for (std::list< CountedPointer<ComputingEndpointAttributes> >::const_iterator it = et.OtherEndpoints.begin(); it != et.OtherEndpoints.end(); it++) { if ((*it)->InterfaceName == "org.ogf.glue.emies.delegation") { durl = URL((*it)->URLString); } } URL url(et.ComputingEndpoint->URLString); SubmissionStatus retval; for (std::list<JobDescription>::const_iterator it = jobdescs.begin(); it != jobdescs.end(); ++it) { JobDescription preparedjobdesc(*it); if (!preparedjobdesc.Prepare(et)) { logger.msg(INFO, "Failed preparing job description to target resources"); notSubmitted.push_back(&*it); retval |= SubmissionStatus::DESCRIPTION_NOT_SUBMITTED; continue; } EMIESJob jobid; if(!SubmitterPluginEMIES::submit(preparedjobdesc,url,iurl,durl,jobid)) { notSubmitted.push_back(&*it); retval |= SubmissionStatus::DESCRIPTION_NOT_SUBMITTED; retval |= SubmissionStatus::ERROR_FROM_ENDPOINT; continue; } Job j; jobid.toJob(j); AddJobDetails(preparedjobdesc, j); jc.addEntity(j); } return retval; }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__ToolTip_Find(struct __ecereNameSpace__ecere__com__Instance * window) { struct __ecereNameSpace__ecere__com__Instance * w; for(w = __ecereProp___ecereNameSpace__ecere__gui__Window_Get_firstSlave(window); w; w = __ecereProp___ecereNameSpace__ecere__gui__Window_Get_nextSlave(w)) { if(__ecereNameSpace__ecere__com__eClass_IsDerived(((struct __ecereNameSpace__ecere__com__Instance *)(char *)w)->_class, __ecereClass___ecereNameSpace__ecere__ToolTip)) break; } return (struct __ecereNameSpace__ecere__com__Instance *)w; }
false
false
false
false
false
0
rd_copy(rd_t* dest, int dest_offset, const rd_t* src, int src_offset, int N) { int i; for (i=0; i<N; i++) { dest->ra [i + dest_offset] = src->ra [i + src_offset]; dest->dec[i + dest_offset] = src->dec[i + src_offset]; } }
false
false
false
false
false
0
wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; int reg = mc->reg; int ret; u16 val; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; /* now hit the volume update bits (always bit 8) */ val = snd_soc_read(codec, reg); return snd_soc_write(codec, reg, val | 0x0100); }
false
false
false
false
false
0
fors_header_write_int(cpl_propertylist *header, int value, const char *name, const char *unit, const char *comment) { char *header_name; int i; char *allComment; allComment = cpl_malloc(81 * sizeof(char *)); if (unit) snprintf(allComment, 80, "%s [%s]", comment, unit); else snprintf(allComment, 80, "%s", comment); header_name = cpl_malloc((strlen(name) + 6) * sizeof(char *)); strcpy(header_name, "ESO "); strcat(header_name, name); for (i = 0; header_name[i] != '\0'; i++) if (header_name[i] == '.') header_name[i] = ' '; if (cpl_propertylist_update_int(header, header_name, value)) { cpl_free(header_name); cpl_error_set_where(cpl_func); return cpl_error_get_code(); } cpl_propertylist_set_comment(header, header_name, allComment); cpl_free(header_name); cpl_free(allComment); return CPL_ERROR_NONE; }
false
false
false
false
false
0
sprint_char(char *buf, const u_char ch) { if (isprint(ch) || isspace(ch)) { sprintf(buf, "%c", (int) ch); } else { sprintf(buf, "."); } }
false
false
false
false
false
0
FindMaxRatioTag(double max_ratio_sum, rapidxml::xml_document<> *doc, rapidxml::xml_node<> *node) { if (doc == NULL || node == NULL) { return false; } double ratio_sum = StrToDouble(node->last_attribute(kRatioSum)->value()); std::string str_mark = node->last_attribute(kMark)->value(); double tmp = max_ratio_sum / ratio_sum; if (1.0 - DBL_EPSILON <= tmp && tmp <= 1.0 + DBL_EPSILON) { if (str_mark != "1") { SetMarkAttribute(1, doc, node); for (rapidxml::xml_node<> *parent = node->parent(); parent != doc->first_node(); parent = parent->parent()) { SetAttribute(kMark, 2, doc, parent); } } return true; } else { rapidxml::xml_node<> *child = node->first_node(); for (; child; child = child->next_sibling()) { if (FindMaxRatioTag(max_ratio_sum, doc, child)) { return true; } } } return false; }
false
false
false
false
false
0
gdata_gd_organization_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GDataGDOrganizationPrivate *priv = GDATA_GD_ORGANIZATION (object)->priv; switch (property_id) { case PROP_NAME: g_value_set_string (value, priv->name); break; case PROP_TITLE: g_value_set_string (value, priv->title); break; case PROP_RELATION_TYPE: g_value_set_string (value, priv->relation_type); break; case PROP_LABEL: g_value_set_string (value, priv->label); break; case PROP_IS_PRIMARY: g_value_set_boolean (value, priv->is_primary); break; case PROP_DEPARTMENT: g_value_set_string (value, priv->department); break; case PROP_JOB_DESCRIPTION: g_value_set_string (value, priv->job_description); break; case PROP_SYMBOL: g_value_set_string (value, priv->symbol); break; case PROP_LOCATION: g_value_set_object (value, priv->location); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
false
false
false
false
false
0
vtkMINCImageWriterConvertVTKTypeToMINCType( int dataType, int &mincsigned) { nc_type minctype = NC_BYTE; // Get the vtk type of the data. switch (dataType) { case VTK_CHAR: case VTK_SIGNED_CHAR: minctype = NC_BYTE; mincsigned = 1; break; case VTK_UNSIGNED_CHAR: minctype = NC_BYTE; mincsigned = 0; break; case VTK_SHORT: minctype = NC_SHORT; mincsigned = 1; break; case VTK_UNSIGNED_SHORT: minctype = NC_SHORT; mincsigned = 0; break; case VTK_INT: minctype = NC_INT; mincsigned = 1; break; case VTK_UNSIGNED_INT: minctype = NC_INT; mincsigned = 0; break; case VTK_FLOAT: minctype = NC_FLOAT; mincsigned = 1; break; case VTK_DOUBLE: minctype = NC_DOUBLE; mincsigned = 1; break; default: break; } return minctype; }
false
false
false
false
false
0
Roll() const { if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked { float Roll = rand_chance_f(); for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) // check each explicitly chanced entry in the template and modify its chance based on quality. { if (ExplicitlyChanced[i].chance >= 100.0f) { return &ExplicitlyChanced[i]; } Roll -= ExplicitlyChanced[i].chance; if (Roll < 0) { return &ExplicitlyChanced[i]; } } } if (!EqualChanced.empty()) // If nothing selected yet - an item is taken from equal-chanced part { return &EqualChanced[irand(0, EqualChanced.size() - 1)]; } return NULL; // Empty drop from the group }
false
false
false
false
false
0
enableLanguages (const boolean state) { unsigned int i; for (i = 0 ; i < LanguageCount ; ++i) LanguageTable [i]->enabled = state; }
false
false
false
false
false
0
oc_enc_frag_sub_mmx(ogg_int16_t _residue[64], const unsigned char *_src,const unsigned char *_ref,int _ystride){ int i; __asm__ __volatile__("pxor %%mm7,%%mm7\n\t"::); for(i=4;i-->0;){ __asm__ __volatile__( /*mm0=[src]*/ "movq (%[src]),%%mm0\n\t" /*mm1=[ref]*/ "movq (%[ref]),%%mm1\n\t" /*mm4=[src+ystride]*/ "movq (%[src],%[ystride]),%%mm4\n\t" /*mm5=[ref+ystride]*/ "movq (%[ref],%[ystride]),%%mm5\n\t" /*Compute [src]-[ref].*/ "movq %%mm0,%%mm2\n\t" "punpcklbw %%mm7,%%mm0\n\t" "movq %%mm1,%%mm3\n\t" "punpckhbw %%mm7,%%mm2\n\t" "punpcklbw %%mm7,%%mm1\n\t" "punpckhbw %%mm7,%%mm3\n\t" "psubw %%mm1,%%mm0\n\t" "psubw %%mm3,%%mm2\n\t" /*Compute [src+ystride]-[ref+ystride].*/ "movq %%mm4,%%mm1\n\t" "punpcklbw %%mm7,%%mm4\n\t" "movq %%mm5,%%mm3\n\t" "punpckhbw %%mm7,%%mm1\n\t" "lea (%[src],%[ystride],2),%[src]\n\t" "punpcklbw %%mm7,%%mm5\n\t" "lea (%[ref],%[ystride],2),%[ref]\n\t" "punpckhbw %%mm7,%%mm3\n\t" "psubw %%mm5,%%mm4\n\t" "psubw %%mm3,%%mm1\n\t" /*Write the answer out.*/ "movq %%mm0,0x00(%[residue])\n\t" "movq %%mm2,0x08(%[residue])\n\t" "movq %%mm4,0x10(%[residue])\n\t" "movq %%mm1,0x18(%[residue])\n\t" "lea 0x20(%[residue]),%[residue]\n\t" :[residue]"+r"(_residue),[src]"+r"(_src),[ref]"+r"(_ref) :[ystride]"r"((ptrdiff_t)_ystride) :"memory" ); } }
false
false
false
false
false
0
do_vlan(int argc, char **argv) { ll_init_map(&rth); if (argc > 0) { if (matches(*argv, "add") == 0) return vlan_modify(RTM_SETLINK, argc-1, argv+1); if (matches(*argv, "delete") == 0) return vlan_modify(RTM_DELLINK, argc-1, argv+1); if (matches(*argv, "show") == 0 || matches(*argv, "lst") == 0 || matches(*argv, "list") == 0) return vlan_show(argc-1, argv+1); if (matches(*argv, "help") == 0) usage(); } else return vlan_show(0, NULL); fprintf(stderr, "Command \"%s\" is unknown, try \"bridge fdb help\".\n", *argv); exit(-1); }
false
false
false
false
false
0
save_files_dirs(const unsigned char *sha1, const char *base, int baselen, const char *path, unsigned int mode, int stage) { int len = strlen(path); char *newpath = xmalloc(baselen + len + 1); memcpy(newpath, base, baselen); memcpy(newpath + baselen, path, len); newpath[baselen + len] = '\0'; if (S_ISDIR(mode)) path_list_insert(newpath, &current_directory_set); else path_list_insert(newpath, &current_file_set); free(newpath); return READ_TREE_RECURSIVE; }
false
false
false
false
false
0
pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type) { const char *p = pp_last_position_in_text (pp); bool previous = false; if (!qualifiers) return; /* The C programming language does not have references, but it is much simpler to handle those here rather than going through the same logic in the C++ pretty-printer. */ if (p != NULL && (*p == '*' || *p == '&')) pp_c_whitespace (pp); if (qualifiers & TYPE_QUAL_CONST) { pp_c_ws_string (pp, func_type ? "__attribute__((const))" : "const"); previous = true; } if (qualifiers & TYPE_QUAL_VOLATILE) { if (previous) pp_c_whitespace (pp); pp_c_ws_string (pp, func_type ? "__attribute__((noreturn))" : "volatile"); previous = true; } if (qualifiers & TYPE_QUAL_RESTRICT) { if (previous) pp_c_whitespace (pp); pp_c_ws_string (pp, (flag_isoc99 && !c_dialect_cxx () ? "restrict" : "__restrict__")); } }
false
false
false
false
false
0
make_log_entry( httpd_conn* hc, struct timeval* nowP ) { char* ru; char url[305]; char bytes[40]; if ( hc->hs->no_log ) return; /* This is straight CERN Combined Log Format - the only tweak ** being that if we're using syslog() we leave out the date, because ** syslogd puts it in. The included syslogtocern script turns the ** results into true CERN format. */ /* Format remote user. */ if ( hc->remoteuser[0] != '\0' ) ru = hc->remoteuser; else ru = "-"; /* If we're vhosting, prepend the hostname to the url. This is ** a little weird, perhaps writing separate log files for ** each vhost would make more sense. */ if ( hc->hs->vhost && ! hc->tildemapped ) (void) my_snprintf( url, sizeof(url), "/%.100s%.200s", hc->hostname == (char*) 0 ? hc->hs->server_hostname : hc->hostname, hc->encodedurl ); else (void) my_snprintf( url, sizeof(url), "%.200s", hc->encodedurl ); /* Format the bytes. */ if ( hc->bytes_sent >= 0 ) (void) my_snprintf( bytes, sizeof(bytes), "%lld", (int64_t) hc->bytes_sent ); else (void) strcpy( bytes, "-" ); /* Logfile or syslog? */ if ( hc->hs->logfp != (FILE*) 0 ) { time_t now; struct tm* t; const char* cernfmt_nozone = "%d/%b/%Y:%H:%M:%S"; char date_nozone[100]; int zone; char sign; char date[100]; /* Get the current time, if necessary. */ if ( nowP != (struct timeval*) 0 ) now = nowP->tv_sec; else now = time( (time_t*) 0 ); /* Format the time, forcing a numeric timezone (some log analyzers ** are stoooopid about this). */ t = localtime( &now ); (void) strftime( date_nozone, sizeof(date_nozone), cernfmt_nozone, t ); #ifdef HAVE_TM_GMTOFF zone = t->tm_gmtoff / 60L; #else zone = -timezone / 60L; /* Probably have to add something about daylight time here. */ #endif if ( zone >= 0 ) sign = '+'; else { sign = '-'; zone = -zone; } zone = ( zone / 60 ) * 100 + zone % 60; (void) my_snprintf( date, sizeof(date), "%s %c%04d", date_nozone, sign, zone ); /* And write the log entry. */ (void) fprintf( hc->hs->logfp, "%.80s - %.80s [%s] \"%.80s %.300s %.80s\" %d %s \"%.200s\" \"%.200s\"\n", httpd_ntoa( &hc->client_addr ), ru, date, httpd_method_str( hc->method ), url, hc->protocol, hc->status, bytes, hc->referer, hc->useragent ); #ifdef FLUSH_LOG_EVERY_TIME (void) fflush( hc->hs->logfp ); #endif } else syslog( LOG_INFO, "%.80s - %.80s \"%.80s %.200s %.80s\" %d %s \"%.200s\" \"%.200s\"", httpd_ntoa( &hc->client_addr ), ru, httpd_method_str( hc->method ), url, hc->protocol, hc->status, bytes, hc->referer, hc->useragent ); }
true
true
false
false
false
1
mpz_trailing_zeroes (gcry_mpi_t n) { unsigned int idx, cnt; cnt = gcry_mpi_get_nbits (n); for (idx = 0; idx < cnt; idx++) { if (gcry_mpi_test_bit (n, idx) == 0) return idx; } return ULONG_MAX; }
false
false
false
false
false
0
ext2_app_device_list_dir_handler(struct ext2_dir_entry_2 *entry, void *data) { print_ntext(entry->name, entry->name_len); if (entry->file_type == EXT2_FT_DIR) { print_char('/'); } print_char('\n'); }
false
false
false
false
false
0
adjustNetVec(HttpQueue *q, ssize written) { MprIOVec *iovec; ssize len; int i, j; /* Cleanup the IO vector */ if (written == q->ioCount) { /* Entire vector written. Just reset. */ q->ioIndex = 0; q->ioCount = 0; } else { /* Partial write of an vector entry. Need to copy down the unwritten vector entries. */ q->ioCount -= written; mprAssert(q->ioCount >= 0); iovec = q->iovec; for (i = 0; i < q->ioIndex; i++) { len = iovec[i].len; if (written < len) { iovec[i].start += written; iovec[i].len -= written; break; } else { written -= len; } } /* Compact */ for (j = 0; i < q->ioIndex; ) { iovec[j++] = iovec[i++]; } q->ioIndex = j; } }
false
false
false
false
false
0
ScheduleEditOperation(char *filename,struct Attributes a,struct Promise *pp) { struct Bundle *bp; void *vp; struct FnCall *fp; char *edit_bundle_name = NULL,lockname[CF_BUFSIZE]; struct Rlist *params; int retval = false; struct CfLock thislock; snprintf(lockname,CF_BUFSIZE-1,"fileedit-%s",pp->promiser); thislock = AcquireLock(lockname,VUQNAME,CFSTARTTIME,a,pp,false); if (thislock.lock == NULL) { return false; } pp->edcontext = NewEditContext(filename,a,pp); if (pp->edcontext == NULL) { cfPS(cf_error,CF_FAIL,"",pp,a,"File %s was marked for editing but could not be opened\n",filename); FinishEditContext(pp->edcontext,a,pp); YieldCurrentLock(thislock); return false; } if (a.haveeditline) { if ((vp = GetConstraint("edit_line",pp,CF_FNCALL))) { fp = (struct FnCall *)vp; edit_bundle_name = fp->name; params = fp->args; } else if ((vp = GetConstraint("edit_line",pp,CF_SCALAR))) { edit_bundle_name = (char *)vp; params = NULL; } else { FinishEditContext(pp->edcontext,a,pp); YieldCurrentLock(thislock); return false; } CfOut(cf_verbose,""," -> Handling file edits in edit_line bundle %s\n",edit_bundle_name); // add current filename to context - already there? if ((bp = GetBundle(edit_bundle_name,"edit_line"))) { BannerSubBundle(bp,params); DeleteScope(bp->name); NewScope(bp->name); HashVariables(bp->name); AugmentScope(bp->name,bp->args,params); PushPrivateClassContext(); retval = ScheduleEditLineOperations(filename,bp,a,pp); PopPrivateClassContext(); DeleteScope(bp->name); } } FinishEditContext(pp->edcontext,a,pp); YieldCurrentLock(thislock); return retval; }
false
false
false
false
false
0
run(raw_ostream &OS) { emitSourceFileHeader("DAG Instruction Selector for the " + CGP.getTargetInfo().getName() + " target", OS); OS << "// *** NOTE: This file is #included into the middle of the target\n" << "// *** instruction selector class. These functions are really " << "methods.\n\n"; DEBUG(errs() << "\n\nALL PATTERNS TO MATCH:\n\n"; for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end(); I != E; ++I) { errs() << "PATTERN: "; I->getSrcPattern()->dump(); errs() << "\nRESULT: "; I->getDstPattern()->dump(); errs() << "\n"; }); // Add all the patterns to a temporary list so we can sort them. std::vector<const PatternToMatch*> Patterns; for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end(); I != E; ++I) Patterns.push_back(&*I); // We want to process the matches in order of minimal cost. Sort the patterns // so the least cost one is at the start. std::sort(Patterns.begin(), Patterns.end(), PatternSortingPredicate(CGP)); // Convert each variant of each pattern into a Matcher. std::vector<Matcher*> PatternMatchers; for (unsigned i = 0, e = Patterns.size(); i != e; ++i) { for (unsigned Variant = 0; ; ++Variant) { if (Matcher *M = ConvertPatternToMatcher(*Patterns[i], Variant, CGP)) PatternMatchers.push_back(M); else break; } } std::unique_ptr<Matcher> TheMatcher = llvm::make_unique<ScopeMatcher>(PatternMatchers); OptimizeMatcher(TheMatcher, CGP); //Matcher->dump(); EmitMatcherTable(TheMatcher.get(), CGP, OS); }
false
false
false
false
false
0
isLUKS(const char *type) { return (type && !strcmp(CRYPT_LUKS1, type)); }
false
false
false
false
false
0
ya_search_template(const Module_table *module, const Array_table *atbl, const int *dim_size, const int total_size, const int level) { List *li; for (li = _template_head; li != NULL; li = li->next) { if (ya_use_same_template(li->data, module, atbl, dim_size, total_size, level)) { return li->data; } } return NULL; }
false
false
false
false
false
0
GdipGetHemfFromMetafile (GpMetafile *metafile, HENHMETAFILE *hEmf) { if (!metafile || !hEmf) return InvalidParameter; *hEmf = (HENHMETAFILE)metafile; return Ok; }
false
false
false
false
false
0
get_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) { u64 data; u64 mcg_cap = vcpu->arch.mcg_cap; unsigned bank_num = mcg_cap & 0xff; switch (msr) { case MSR_IA32_P5_MC_ADDR: case MSR_IA32_P5_MC_TYPE: data = 0; break; case MSR_IA32_MCG_CAP: data = vcpu->arch.mcg_cap; break; case MSR_IA32_MCG_CTL: if (!(mcg_cap & MCG_CTL_P)) return 1; data = vcpu->arch.mcg_ctl; break; case MSR_IA32_MCG_STATUS: data = vcpu->arch.mcg_status; break; default: if (msr >= MSR_IA32_MC0_CTL && msr < MSR_IA32_MCx_CTL(bank_num)) { u32 offset = msr - MSR_IA32_MC0_CTL; data = vcpu->arch.mce_banks[offset]; break; } return 1; } *pdata = data; return 0; }
false
false
false
false
false
0
myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp) { struct myri10ge_cmd cmd; int status; /* probe for IPv6 TSO support */ mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO; status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE, &cmd, 0); if (status == 0) { mgp->max_tso6 = cmd.data0; mgp->features |= NETIF_F_TSO6; } status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); if (status != 0) { dev_err(&mgp->pdev->dev, "failed MXGEFW_CMD_GET_RX_RING_SIZE\n"); return -ENXIO; } mgp->max_intr_slots = 2 * (cmd.data0 / sizeof(struct mcp_dma_addr)); return 0; }
false
false
false
false
false
0
PieceSprite(const QString &id, ThemeManager* theme, int no, QGraphicsScene* canvas) : Themeable(id, theme), PixmapSprite(no, canvas) { mMovementState = Idle; mNotify = new SpriteNotify(this); if (theme) theme->updateTheme(this); }
false
false
false
false
false
0
GetImage( unsigned short type ) const { short rc = -1; if ( uset ) { const UnitType *ut = uset->GetUnitInfo(type % uset->NumTiles()); if ( ut ) { if ( type < uset->NumTiles() ) rc = ut->Image(); else rc = ut->Image() + 9; /* player 2, facing southwards */ } } return rc; }
false
false
false
false
false
0
pstadium_gfxflag_w(int data) { static int pstadium_flipscreen_old = -1; pstadium_flipx = (data & 0x01) ? 1 : 0; pstadium_flipy = (data & 0x02) ? 1 : 0; pstadium_flipscreen = (data & 0x04) ? 0 : 1; pstadium_dispflag = (data & 0x10) ? 0 : 1; if (pstadium_flipscreen != pstadium_flipscreen_old) { pstadium_vramflip(); pstadium_screen_refresh = 1; pstadium_flipscreen_old = pstadium_flipscreen; } }
false
false
false
false
false
0
afr_examine_dir_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { afr_private_t * priv = NULL; afr_local_t * local = NULL; afr_self_heal_t * sh = NULL; gf_dirent_t * entry = NULL; gf_dirent_t * tmp = NULL; char *reason = NULL; int child_index = 0; uint32_t entry_cksum = 0; int call_count = 0; off_t last_offset = 0; inode_t *inode = NULL; priv = this->private; local = frame->local; sh = &local->self_heal; inode = local->fd->inode; child_index = (long) cookie; if (op_ret == -1) { gf_log (this->name, GF_LOG_INFO, "%s: failed to do opendir on %s", local->loc.path, priv->children[child_index]->name); local->op_ret = -1; local->op_ret = op_errno; goto out; } if (op_ret == 0) { gf_log (this->name, GF_LOG_DEBUG, "%s: no entries found in %s", local->loc.path, priv->children[child_index]->name); goto out; } list_for_each_entry_safe (entry, tmp, &entries->list, list) { entry_cksum = gf_rsync_weak_checksum ((unsigned char *)entry->d_name, strlen (entry->d_name)); local->cont.opendir.checksum[child_index] ^= entry_cksum; } list_for_each_entry (entry, &entries->list, list) { last_offset = entry->d_off; } /* read more entries */ STACK_WIND_COOKIE (frame, afr_examine_dir_readdir_cbk, (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->readdir, local->fd, 131072, last_offset, NULL); return 0; out: call_count = afr_frame_return (frame); if (call_count == 0) { if (__checksums_differ (local->cont.opendir.checksum, priv->child_count, local->child_up)) { sh->do_entry_self_heal = _gf_true; sh->forced_merge = _gf_true; reason = "checksums of directory differ"; afr_launch_self_heal (frame, this, inode, _gf_false, inode->ia_type, reason, NULL, afr_examine_dir_sh_unwind); } else { afr_set_opendir_done (this, inode); AFR_STACK_UNWIND (opendir, frame, local->op_ret, local->op_errno, local->fd, NULL); } } return 0; }
false
false
false
false
false
0
smem_write(int driverhandle, void *buffer, long nbytes) { if (NULL == buffer) return(SHARED_NULPTR); if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); if (-1 != shared_lt[driverhandle].lkcnt) return(SHARED_INVALID); /* are we locked RW ? */ if (nbytes < 0) return(SHARED_BADARG); if ((unsigned long)(shared_lt[driverhandle].seekpos + nbytes) > (unsigned long)(shared_gt[driverhandle].size - sizeof(DAL_SHM_SEGHEAD))) { /* need to realloc shmem */ if (NULL == shared_realloc(driverhandle, shared_lt[driverhandle].seekpos + nbytes + sizeof(DAL_SHM_SEGHEAD))) return(SHARED_NOMEM); } memcpy(((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[driverhandle].p + 1)) + 1)) + shared_lt[driverhandle].seekpos, buffer, nbytes); shared_lt[driverhandle].seekpos += nbytes; return(0); }
true
true
false
false
false
1
snd_at73c213_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_at73c213 *chip = snd_pcm_substream_chip(substream); int retval = 0; spin_lock(&chip->lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: ssc_writel(chip->ssc->regs, IER, SSC_BIT(IER_ENDTX)); ssc_writel(chip->ssc->regs, PDC_PTCR, SSC_BIT(PDC_PTCR_TXTEN)); break; case SNDRV_PCM_TRIGGER_STOP: ssc_writel(chip->ssc->regs, PDC_PTCR, SSC_BIT(PDC_PTCR_TXTDIS)); ssc_writel(chip->ssc->regs, IDR, SSC_BIT(IDR_ENDTX)); break; default: dev_dbg(&chip->spi->dev, "spurious command %x\n", cmd); retval = -EINVAL; break; } spin_unlock(&chip->lock); return retval; }
false
false
false
false
false
0
stream_skip_bytes(mpg123_handle *fr,off_t len) { if(fr->rdat.flags & READER_SEEKABLE) { off_t ret = stream_lseek(fr, len, SEEK_CUR); return (ret < 0) ? READER_ERROR : ret; } else if(len >= 0) { unsigned char buf[1024]; /* ThOr: Compaq cxx complained and it makes sense to me... or should one do a cast? What for? */ ssize_t ret; while (len > 0) { ssize_t num = len < (off_t)sizeof(buf) ? (ssize_t)len : (ssize_t)sizeof(buf); ret = fr->rd->fullread(fr, buf, num); if (ret < 0) return ret; else if(ret == 0) break; /* EOF... an error? interface defined to tell the actual position... */ len -= ret; } return fr->rd->tell(fr); } else if(fr->rdat.flags & READER_BUFFERED) { /* Perhaps we _can_ go a bit back. */ if(fr->rdat.buffer.pos >= -len) { fr->rdat.buffer.pos += len; return fr->rd->tell(fr); } else { fr->err = MPG123_NO_SEEK; return READER_ERROR; } } else { fr->err = MPG123_NO_SEEK; return READER_ERROR; } }
false
false
false
false
false
0
AllocateGraphics() { if (!pixmapLine) pixmapLine = Surface::Allocate(technology); if (!pixmapSelMargin) pixmapSelMargin = Surface::Allocate(technology); if (!pixmapSelPattern) pixmapSelPattern = Surface::Allocate(technology); if (!pixmapSelPatternOffset1) pixmapSelPatternOffset1 = Surface::Allocate(technology); if (!pixmapIndentGuide) pixmapIndentGuide = Surface::Allocate(technology); if (!pixmapIndentGuideHighlight) pixmapIndentGuideHighlight = Surface::Allocate(technology); }
false
false
false
false
false
0
addr_policy_permits_tor_addr(const tor_addr_t *addr, uint16_t port, smartlist_t *policy) { addr_policy_result_t p; p = compare_tor_addr_to_addr_policy(addr, port, policy); switch (p) { case ADDR_POLICY_PROBABLY_ACCEPTED: case ADDR_POLICY_ACCEPTED: return 1; case ADDR_POLICY_PROBABLY_REJECTED: case ADDR_POLICY_REJECTED: return 0; default: log_warn(LD_BUG, "Unexpected result: %d", (int)p); return 0; } }
false
false
false
false
false
0
File_Prop_Date_2(WamWord date_time_word, WamWord path_name_word) { char *path_name; struct stat file_info; time_t *t; path_name = Get_Path_Name(path_name_word); Os_Test_Error(stat(path_name, &file_info)); switch (sys_var[0]) { case 0: t = &(file_info.st_ctime); break; case 1: t = &(file_info.st_atime); break; default: t = &(file_info.st_mtime); break; } return Date_Time_To_Prolog(t, date_time_word); }
false
false
false
false
false
0