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
elm_drop_target_del(Evas_Object *obj) { if (!_elm_cnp_init_count) _elm_cnp_init(); #ifdef HAVE_ELEMENTARY_X if (_x11_elm_widget_xwin_get(obj)) return _x11_elm_drop_target_del(obj); #endif return _local_elm_drop_target_del(obj); }
false
false
false
false
false
0
destroy() { if (FunctionMap.empty()) return; // Reset all node's use counts to zero before deleting them to prevent an // assertion from firing. #ifndef NDEBUG for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); I != E; ++I) I->second->allReferencesDropped(); #endif for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); I != E; ++I) delete I->second; FunctionMap.clear(); }
false
false
false
false
false
0
make_acpi_ec(void) { struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); if (!ec) return NULL; ec->flags = 1 << EC_FLAGS_QUERY_PENDING; mutex_init(&ec->mutex); init_waitqueue_head(&ec->wait); INIT_LIST_HEAD(&ec->list); spin_lock_init(&ec->lock); INIT_WORK(&ec->work, acpi_ec_event_handler); ec->timestamp = jiffies; return ec; }
false
false
false
false
false
0
which_pixbuf(int lp, enum what_display what) { GdkPixbuf **pb ; g_assert(lp>0 && lp < MAX_WINS+2); switch( what) { case PIXLOADED: pb=&sp->im_loaded_pixbuf[lp]; break; case PIXSUBIMAGE: pb=&sp->im_subimage_pixbuf[lp]; break; case PIXWARPED: pb=&sp->im_warped_pixbuf[lp]; break; default: abort(); } return pb; }
false
false
false
false
false
0
suspend_task(package p) { vm the_vm = new_vm(current_task_id, var_ref(current_local), top_activ_stack + 1); int i; enum error e; the_vm->max_stack_size = max_stack_size; the_vm->top_activ_stack = top_activ_stack; the_vm->root_activ_vector = root_activ_vector; the_vm->func_id = 0; /* shouldn't need func_id; */ for (i = 0; i <= top_activ_stack; i++) the_vm->activ_stack[i] = activ_stack[i]; e = (*p.u.susp.proc) (the_vm, p.u.susp.data); if (e != E_NONE) free_vm(the_vm, 0); return e; }
false
false
false
false
false
0
file_cache_get(const char *path) { struct file_info *f, *r = NULL; pthread_mutex_lock(&files_mutex); for (f = files; f; f = f->next) { pthread_mutex_lock(&f->mutex); if (!f->dead && f->filename && !strcmp(path, f->filename)) { f->ref++; r = f; } pthread_mutex_unlock(&f->mutex); if (r) break; } pthread_mutex_unlock(&files_mutex); return f; }
false
false
false
false
false
0
isReadable() const { return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly); }
false
false
false
false
false
0
pg_encoding_mbcliplen(int encoding, const char *mbstr, int len, int limit) { mblen_converter mblen_fn; int clen = 0; int l; /* optimization for single byte encoding */ if (pg_encoding_max_length(encoding) == 1) return cliplen(mbstr, len, limit); mblen_fn = pg_wchar_table[encoding].mblen; while (len > 0 && *mbstr) { l = (*mblen_fn) ((const unsigned char *) mbstr); if ((clen + l) > limit) break; clen += l; if (clen == limit) break; len -= l; mbstr += l; } return clen; }
false
false
false
false
false
0
uniform_vector_p (tree vec) { tree first, t; unsigned i; if (vec == NULL_TREE) return NULL_TREE; if (TREE_CODE (vec) == VECTOR_CST) { first = VECTOR_CST_ELT (vec, 0); for (i = 1; i < VECTOR_CST_NELTS (vec); ++i) if (!operand_equal_p (first, VECTOR_CST_ELT (vec, i), 0)) return NULL_TREE; return first; } else if (TREE_CODE (vec) == CONSTRUCTOR) { first = error_mark_node; FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (vec), i, t) { if (i == 0) { first = t; continue; } if (!operand_equal_p (first, t, 0)) return NULL_TREE; } if (i != TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec))) return NULL_TREE; return first; } return NULL_TREE; }
false
false
false
false
false
0
ddjvu_document_search_pageno(ddjvu_document_t *document, const char *name) { G_TRY { DjVuDocument *doc = document->doc; if (! (doc && doc->is_init_ok())) return -1; GP<DjVmDir> dir = doc->get_djvm_dir(); if (! dir) return 0; GP<DjVmDir::File> file; if (! (file = dir->id_to_file(GUTF8String(name)))) if (! (file = dir->name_to_file(GUTF8String(name)))) if (! (file = dir->title_to_file(GUTF8String(name)))) { char *edata=0; long int p = strtol(name, &edata, 10); if (edata!=name && !*edata && p>=1) file = dir->page_to_file(p-1); } if (file) { int pageno = -1; int fileno = dir->get_file_pos(file); if (dir->pos_to_file(fileno, &pageno)) return pageno; } } G_CATCH(ex) { ERROR1(document,ex); } G_ENDCATCH; return -1; }
false
false
false
false
false
0
AssignFile(const std::string& filename) { olock_.lock(); if(!filename_.empty()) ::unlink(filename_.c_str()); if(handle_ != -1) ::close(handle_); filename_ = filename; handle_ = -1; if(!filename_.empty()) { handle_ = ::open(filename_.c_str(),O_RDONLY); if(parse_xml_) { lock_.lock(); doc_.ReadFromFile(filename_); lock_.unlock(); Arc::InformationContainer::Assign(doc_,false); }; }; olock_.unlock(); }
false
false
false
false
false
0
gdict_window_cmd_file_close_window (GSimpleAction *action, GVariant *parameter, gpointer user_data) { GdictWindow *window = user_data; g_assert (GDICT_IS_WINDOW (window)); gdict_window_store_state (window); /* if this was called from the uimanager, destroy the widget; * otherwise, if it was called from the delete_event, the widget * will destroy itself. */ if (action) gtk_widget_destroy (GTK_WIDGET (window)); }
false
false
false
false
false
0
nextid(const char *sname) { if (!active) return DB_UNEXPECTED_RESULT; int id; result_set res; char sqlcmd[512]; sprintf(sqlcmd, "select nextid from %s where seq_name = '%s'", sequence_table.c_str(), sname); res.conn = getHandle(); //NG if ((last_err = my_sqlite3_exec(getHandle(), sqlcmd, &callback, &res, NULL)) != SQLITE_OK) { return DB_UNEXPECTED_RESULT; } if (res.records.size() == 0) { id = 1; sprintf(sqlcmd, "insert into %s (nextid,seq_name) values (%d,'%s')", sequence_table.c_str(), id, sname); if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT; return id; } else { id = res.records[0][0].get_asInteger() + 1; sprintf(sqlcmd, "update %s set nextid=%d where seq_name = '%s'", sequence_table.c_str(), id, sname); if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT; return id; } }
false
false
false
false
false
0
main(int argc, char *argv[]) { int c; int fn = NO_STATUS; char *ptr; int iterative = 0; int pid = 0; unsigned short port = 0; #if defined(_WIN32) /*[*/ if (sockstart() < 0) exit(1); #endif /*]*/ /* Identify yourself. */ if ((me = strrchr(argv[0], '/')) != (char *)NULL) me++; else me = argv[0]; /* Parse options. */ while ((c = getopt(argc, argv, "ip:s:St:v")) != -1) { switch (c) { #if !defined(_WIN32) /*[*/ case 'i': if (fn >= 0) usage(); iterative++; break; case 'p': pid = (int)strtoul(optarg, &ptr, 0); if (ptr == optarg || *ptr != '\0' || pid <= 0) { (void) fprintf(stderr, "%s: Invalid process ID: '%s'\n", me, optarg); usage(); } break; #endif /*]*/ case 's': if (fn >= 0 || iterative) usage(); fn = (int)strtol(optarg, &ptr, 0); if (ptr == optarg || *ptr != '\0' || fn < 0) { (void) fprintf(stderr, "%s: Invalid field number: '%s'\n", me, optarg); usage(); } break; case 'S': if (fn >= 0 || iterative) usage(); fn = ALL_FIELDS; break; case 't': port = (unsigned short)strtoul(optarg, &ptr, 0); if (ptr == optarg || *ptr != '\0' || port <= 0) { (void) fprintf(stderr, "%s: Invalid port: '%s'\n", me, optarg); usage(); } break; case 'v': verbose++; break; default: usage(); break; } } /* Validate positional arguments. */ if (optind == argc) { /* No positional arguments. */ if (fn == NO_STATUS && !iterative) usage(); } else { /* Got positional arguments. */ if (iterative) usage(); } if (pid && port) usage(); #if !defined(_WIN32) /*[*/ /* Ignore broken pipes. */ (void) signal(SIGPIPE, SIG_IGN); #endif /*]*/ /* Do the I/O. */ #if !defined(_WIN32) /*[*/ if (iterative) iterative_io(pid); else #endif /*]*/ single_io(pid, port, fn, argv[optind]); return 0; }
false
false
false
false
false
0
product(vector<unsigned int> const &x) { if (x.empty()) return 0; unsigned int y = x[0]; for (unsigned int i = 1; i < x.size(); ++i) { y *= x[i]; } return y; }
false
false
false
false
false
0
ConstructNullFunctionData(struct rtw_adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, u8 bQoS, u8 AC, u8 bEosp, u8 bForcePowerSave) { struct ieee80211_hdr *pwlanhdr; u32 pktlen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; pwlanhdr = (struct ieee80211_hdr *)pframe; pwlanhdr->frame_control = 0; pwlanhdr->seq_ctrl = 0; if (bForcePowerSave) pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); switch (cur_network->network.ifmode) { case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_STATION: pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_TODS); memcpy(pwlanhdr->addr1, get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); break; case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_AP: pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_FROMDS); memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr2, get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN); memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv), ETH_ALEN); break; case NL80211_IFTYPE_ADHOC: default: memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); memcpy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN); break; } if (bQoS == true) { struct ieee80211_qos_hdr *qoshdr; qoshdr = (struct ieee80211_qos_hdr *)pframe; qoshdr->frame_control |= cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); qoshdr->qos_ctrl = cpu_to_le16(AC & IEEE80211_QOS_CTL_TID_MASK); if (bEosp) qoshdr->qos_ctrl |= cpu_to_le16(IEEE80211_QOS_CTL_EOSP); pktlen = sizeof(struct ieee80211_qos_hdr); } else { pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); pktlen = sizeof(struct ieee80211_hdr_3addr); } *pLength = pktlen; }
false
true
false
false
false
1
tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, double *pmat, int paintType, int tilingType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { PDFRectangle box; Gfx *gfx; // define a Type 3 font writePS("8 dict begin\n"); writePS("/FontType 3 def\n"); writePS("/FontMatrix [1 0 0 1 0 0] def\n"); writePSFmt("/FontBBox [{0:.6g} {1:.6g} {2:.6g} {3:.6g}] def\n", bbox[0], bbox[1], bbox[2], bbox[3]); writePS("/Encoding 256 array def\n"); writePS(" 0 1 255 { Encoding exch /.notdef put } for\n"); writePS(" Encoding 120 /x put\n"); writePS("/BuildGlyph {\n"); writePS(" exch /CharProcs get exch\n"); writePS(" 2 copy known not { pop /.notdef } if\n"); writePS(" get exec\n"); writePS("} bind def\n"); writePS("/BuildChar {\n"); writePS(" 1 index /Encoding get exch get\n"); writePS(" 1 index /BuildGlyph get exec\n"); writePS("} bind def\n"); writePS("/CharProcs 1 dict def\n"); writePS("CharProcs begin\n"); box.x1 = bbox[0]; box.y1 = bbox[1]; box.x2 = bbox[2]; box.y2 = bbox[3]; gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL); writePS("/x {\n"); if (paintType == 2) { writePSFmt("{0:.6g} 0 {1:.6g} {2:.6g} {3:.6g} {4:.6g} setcachedevice\n", xStep, bbox[0], bbox[1], bbox[2], bbox[3]); } else { if (x1 - 1 <= x0) { writePS("1 0 setcharwidth\n"); } else { writePSFmt("{0:.6g} 0 setcharwidth\n", xStep); } } inType3Char = gTrue; if (paintType == 2) { inUncoloredPattern = gTrue; // ensure any PS procedures that contain sCol or fCol do not change the color writePS("/pdfLastFill true def\n"); writePS("/pdfLastStroke true def\n"); } ++numTilingPatterns; gfx->display(str); --numTilingPatterns; if (paintType == 2) { inUncoloredPattern = gFalse; // ensure the next PS procedures that uses sCol or fCol will update the color writePS("/pdfLastFill false def\n"); writePS("/pdfLastStroke false def\n"); } inType3Char = gFalse; writePS("} def\n"); delete gfx; writePS("end\n"); writePS("currentdict end\n"); writePSFmt("/xpdfTile{0:d} exch definefont pop\n", numTilingPatterns); // draw the tiles writePSFmt("/xpdfTile{0:d} findfont setfont\n", numTilingPatterns); writePSFmt("gsave [{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] concat\n", mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]); writePSFmt("{0:d} 1 {1:d} {{ {2:.6g} exch {3:.6g} mul m {4:d} 1 {5:d} {{ pop (x) show }} for }} for\n", y0, y1 - 1, x0 * xStep, yStep, x0, x1 - 1); writePS("grestore\n"); return gTrue; }
false
false
false
false
false
0
sprite_load_food() { for (int f = 0; f < SPRITE_NUM_FOOD; f++) { sprites[SPRITE_FOOD + f] = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCALPHA, 16, 16, 32,0xFF000000,0x00FF0000,0x0000FF00,0x000000FF); SDL_Rect srcrect = { f * 16, 256, 16, 16 }; SDL_BlitSurface(gfx, &srcrect, sprites[SPRITE_FOOD + f], NULL); } for (int f = 0; f < SPRITE_NUM_SNOW_FOOD; f++) { sprites[SPRITE_SNOW_FOOD + f] = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCALPHA, 16, 16, 32,0xFF000000,0x00FF0000,0x0000FF00,0x000000FF); SDL_Rect srcrect = { f * 16, 256 + 16, 16, 16 }; SDL_BlitSurface(gfx, &srcrect, sprites[SPRITE_SNOW_FOOD + f], NULL); } }
false
false
false
false
false
0
__ecereMethod_BuildTab_FindUniqueConfigName(struct __ecereNameSpace__ecere__com__Instance * this, char * baseName, unsigned int startWithNumber, char * output) { struct BuildTab * __ecerePointer_BuildTab = (struct BuildTab *)(this ? (((char *)this) + __ecereClass_BuildTab->offset) : 0); int num = 0; char tmp[1025]; if(startWithNumber) sprintf(tmp, "%s%d", baseName, num); else strcpy(tmp, baseName); while(0x1) { struct ProjectConfig * config = (((void *)0)); { struct __ecereNameSpace__ecere__com__Iterator c = { __ecereProp_ProjectNode_Get_configurations(project->topNode), 0 }; while(__ecereMethod___ecereNameSpace__ecere__com__Iterator_Next(&c)) { if(((struct ProjectConfig *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&c))->name && !strcmp(((struct ProjectConfig *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&c))->name, tmp)) { config = ((struct ProjectConfig *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&c)); break; } } } if(config) { num++; sprintf(tmp, "%s%d", baseName, num); } else break; } strcpy(output, tmp); }
false
false
false
false
false
0
set_inner(Widget gw, XEvent *event, String *params, Cardinal *no_params) { ArtTreeWidget w = (ArtTreeWidget)gw; int x, y; ART_TREE_NODE *node; if (!w->arttree.active || !get_event_xy(event, &x, &y)) return; node = find_node_by_coordinates(w, w->arttree.root, x, y); if (node) { XtCallbackList c_list = w->arttree.inner_callback; ArtTreeNodeSetInner((Widget)w, node, True); if (c_list) XtCallCallbackList((Widget)w, c_list, (XtPointer)node); } }
false
false
false
false
false
0
utest_Get(ESL_BUFFER *bf, int nlines_expected) { const char msg[] = "utest_Get() failed"; char *p = NULL; esl_pos_t n = 0; int nlines = 0; char line[8192]; int lpos = 0; esl_pos_t i; int status; while ( (status = esl_buffer_Get(bf, &p, &n)) == eslOK) { for (i = 0; i < n; i++) { if (p[i] == '\n') { nlines++; if (lpos && line[lpos-1] == '\r') lpos--; utest_compare_line(line, lpos, nlines); lpos = 0; i++; break; } else line[lpos++] = p[i]; } esl_buffer_Set(bf, p, i); } if (lpos) { nlines++; utest_compare_line(line, lpos, nlines); } if (status != eslEOF) esl_fatal(msg); if (nlines != nlines_expected) esl_fatal(msg); }
true
true
false
false
false
1
soundcore_open(struct inode *inode, struct file *file) { int chain; int unit = iminor(inode); struct sound_unit *s; const struct file_operations *new_fops = NULL; chain=unit&0x0F; if(chain==4 || chain==5) /* dsp/audio/dsp16 */ { unit&=0xF0; unit|=3; chain=3; } spin_lock(&sound_loader_lock); s = __look_for_unit(chain, unit); if (s) new_fops = fops_get(s->unit_fops); if (preclaim_oss && !new_fops) { spin_unlock(&sound_loader_lock); /* * Please, don't change this order or code. * For ALSA slot means soundcard and OSS emulation code * comes as add-on modules which aren't depend on * ALSA toplevel modules for soundcards, thus we need * load them at first. [Jaroslav Kysela <perex@jcu.cz>] */ request_module("sound-slot-%i", unit>>4); request_module("sound-service-%i-%i", unit>>4, chain); /* * sound-slot/service-* module aliases are scheduled * for removal in favor of the standard char-major-* * module aliases. For the time being, generate both * the legacy and standard module aliases to ease * transition. */ if (request_module("char-major-%d-%d", SOUND_MAJOR, unit) > 0) request_module("char-major-%d", SOUND_MAJOR); spin_lock(&sound_loader_lock); s = __look_for_unit(chain, unit); if (s) new_fops = fops_get(s->unit_fops); } spin_unlock(&sound_loader_lock); if (new_fops) { /* * We rely upon the fact that we can't be unloaded while the * subdriver is there. */ int err = 0; replace_fops(file, new_fops); if (file->f_op->open) err = file->f_op->open(inode,file); return err; } return -ENODEV; }
false
false
false
false
true
1
get_header(FILE *file,mp3header *header) { unsigned char buffer[FRAME_HEADER_SIZE]; int fl; if(fread(&buffer,FRAME_HEADER_SIZE,1,file)<1) { header->sync=0; return 0; } header->sync=(((int)buffer[0]<<4) | ((int)(buffer[1]&0xE0)>>4)); if(buffer[1] & 0x10) header->version=(buffer[1] >> 3) & 1; else header->version=2; header->layer=(buffer[1] >> 1) & 3; if((header->sync != 0xFFE) || (header->layer != 1)) { header->sync=0; return 0; } header->crc=buffer[1] & 1; header->bitrate=(buffer[2] >> 4) & 0x0F; header->freq=(buffer[2] >> 2) & 0x3; header->padding=(buffer[2] >>1) & 0x1; return ((fl=frame_length(header)) >= MIN_FRAME_SIZE ? fl : 0); }
true
true
false
false
false
1
aer_recover_work_func(struct work_struct *work) { struct aer_recover_entry entry; struct pci_dev *pdev; while (kfifo_get(&aer_recover_ring, &entry)) { pdev = pci_get_domain_bus_and_slot(entry.domain, entry.bus, entry.devfn); if (!pdev) { pr_err("AER recover: Can not find pci_dev for %04x:%02x:%02x:%x\n", entry.domain, entry.bus, PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); continue; } cper_print_aer(pdev, entry.severity, entry.regs); do_recovery(pdev, entry.severity); pci_dev_put(pdev); } }
false
false
false
false
false
0
curses_print_status(void) { struct pool *pool = current_pool(); int linewidth = opt_widescreen ? 100 : 80; wattron(statuswin, A_BOLD); cg_mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp); wattroff(statuswin, A_BOLD); mvwhline(statuswin, 1, 0, '-', linewidth); cg_mvwprintw(statuswin, 2, 0, " %s", statusline); wclrtoeol(statuswin); if (opt_widescreen) { cg_mvwprintw(statuswin, 3, 0, " A:%.0f R:%.0f HW:%d WU:%.1f/m |" " ST: %d SS: %"PRId64" NB: %d LW: %d GF: %d RF: %d", total_diff_accepted, total_diff_rejected, hw_errors, total_diff1 / total_secs * 60, total_staged(), total_stale, new_blocks, local_work, total_go, total_ro); } else if (alt_status) { cg_mvwprintw(statuswin, 3, 0, " ST: %d SS: %"PRId64" NB: %d LW: %d GF: %d RF: %d", total_staged(), total_stale, new_blocks, local_work, total_go, total_ro); } else { cg_mvwprintw(statuswin, 3, 0, " A:%.0f R:%.0f HW:%d WU:%.1f/m", total_diff_accepted, total_diff_rejected, hw_errors, total_diff1 / total_secs * 60); } wclrtoeol(statuswin); if (shared_strategy() && total_pools > 1) { cg_mvwprintw(statuswin, 4, 0, " Connected to multiple pools with%s block change notify", have_longpoll ? "": "out"); } else if (pool->has_stratum) { cg_mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with stratum as user %s", pool->sockaddr_url, pool->diff, pool->rpc_user); } else { cg_mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with%s %s as user %s", pool->sockaddr_url, pool->diff, have_longpoll ? "": "out", pool->has_gbt ? "GBT" : "LP", pool->rpc_user); } wclrtoeol(statuswin); cg_mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ", prev_block, block_diff, blocktime, best_share); mvwhline(statuswin, 6, 0, '-', linewidth); mvwhline(statuswin, statusy - 1, 0, '-', linewidth); #ifdef USE_USBUTILS cg_mvwprintw(statuswin, devcursor - 1, 1, "[U]SB management [P]ool management [S]ettings [D]isplay options [Q]uit"); #else cg_mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management [S]ettings [D]isplay options [Q]uit"); #endif }
false
false
false
false
false
0
xsh_table_resample_table(cpl_table* tinp,const char* cwinp, const char* cfinp, cpl_table* tref,const char* cwref, const char* cfref) { cpl_table* tres=NULL; double* pwinp=NULL; double* pwref=NULL; double* pfinp=NULL; double* pfres=NULL; int size_inp=0; int size_ref=0; double wmin=0; double wmax=0; int i=0; check(size_inp=cpl_table_get_nrow(tinp)); check(size_ref=cpl_table_get_nrow(tref)); //xsh_msg("cwinp=%s",cwinp); check(wmin=cpl_table_get_column_min(tinp,cwinp)); check(wmax=cpl_table_get_column_max(tinp,cwinp)); //xsh_msg("wmin=% vag wmax=%g",wmin,wmax); /* we first duplicate ref to resampled table to have the same wavelength sampling and then we take care of computing the flux */ tres=cpl_table_duplicate(tref); check(pwinp=cpl_table_get_data_double(tinp,cwinp)); check(pwref=cpl_table_get_data_double(tref,cwref)); check(pfinp=cpl_table_get_data_double(tinp,cfinp)); check(pfres=cpl_table_get_data_double(tres,cfref)); for(i=0;i<size_ref;i++) { pfres[i]=xsh_resample_double(pwref[i],pwinp,pfinp,wmin,wmax,size_inp); } cleanup: return tres; }
false
false
false
false
false
0
s_zlibE_process(stream_state * st, stream_cursor_read * pr, stream_cursor_write * pw, bool last) { stream_zlib_state *const ss = (stream_zlib_state *)st; z_stream *zs = &ss->dynamic->zstate; const byte *p = pr->ptr; int status; /* Detect no input or full output so that we don't get */ /* a Z_BUF_ERROR return. */ if (pw->ptr == pw->limit) return 1; if (p == pr->limit && !last) return 0; zs->next_in = (Bytef *)p + 1; zs->avail_in = pr->limit - p; zs->next_out = pw->ptr + 1; zs->avail_out = pw->limit - pw->ptr; status = deflate(zs, (last ? Z_FINISH : Z_NO_FLUSH)); pr->ptr = zs->next_in - 1; pw->ptr = zs->next_out - 1; switch (status) { case Z_OK: return (pw->ptr == pw->limit ? 1 : pr->ptr > p && !last ? 0 : 1); case Z_STREAM_END: return (last && pr->ptr == pr->limit ? 0 : ERRC); default: return ERRC; } }
false
false
false
false
false
0
add_roots(void * start, void * end) { void *tmp; if (start > end) { tmp = start; start = end; end = tmp; } root_ranges[root_ranges_used].start = start; root_ranges[root_ranges_used].end = end; root_ranges_used++; if (root_ranges_used >= ROOT_RANGES_LIMIT) { fputs("Root OverFlow", stderr); abort(); } }
false
false
false
false
false
0
rcu_cleanup_dead_rnp(struct rcu_node *rnp_leaf) { long mask; struct rcu_node *rnp = rnp_leaf; if (!IS_ENABLED(CONFIG_HOTPLUG_CPU) || rnp->qsmaskinit || rcu_preempt_has_tasks(rnp)) return; for (;;) { mask = rnp->grpmask; rnp = rnp->parent; if (!rnp) break; raw_spin_lock(&rnp->lock); /* irqs already disabled. */ smp_mb__after_unlock_lock(); /* GP memory ordering. */ rnp->qsmaskinit &= ~mask; rnp->qsmask &= ~mask; if (rnp->qsmaskinit) { raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ return; } raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ } }
false
false
false
false
false
0
draw_objects_line(GtkWidget *widget, GabeditXYPlot *xyplot) { gint i; for (i=0; i < xyplot->nObjectsLine; i++) { /* if ( !( (xyplot->objectsLine[i].x1i > xyplot->plotting_rect.x) && (xyplot->objectsLine[i].x1i < (xyplot->plotting_rect.x + xyplot->plotting_rect.width)) && (xyplot->objectsLine[i].y1i > xyplot->plotting_rect.y) && (xyplot->objectsLine[i].y1i < (xyplot->plotting_rect.y + xyplot->plotting_rect.height)) ) ) continue; if ( !( (xyplot->objectsLine[i].x2i > xyplot->plotting_rect.x) && (xyplot->objectsLine[i].x2i < (xyplot->plotting_rect.x + xyplot->plotting_rect.width)) && (xyplot->objectsLine[i].y2i > xyplot->plotting_rect.y) && (xyplot->objectsLine[i].y2i < (xyplot->plotting_rect.y + xyplot->plotting_rect.height)) ) ) continue; */ /* HERE change gc vlaues */ gdouble x1, x2, y1, y2; gdk_gc_set_rgb_fg_color (xyplot->lines_gc, &xyplot->objectsLine[i].color); gdk_gc_set_line_attributes (xyplot->lines_gc, xyplot->objectsLine[i].width, xyplot->objectsLine[i].style, GDK_CAP_ROUND, GDK_JOIN_MITER); xyplot_cairo_line(xyplot, xyplot->cairo_widget, widget, xyplot->lines_gc, xyplot->objectsLine[i].x1i, xyplot->objectsLine[i].y1i, xyplot->objectsLine[i].x2i, xyplot->objectsLine[i].y2i); if(xyplot->objectsLine[i].arrow_size<1) continue; calc_arrow_vertexes(30.0, xyplot->objectsLine[i].arrow_size*5.0, (gdouble)xyplot->objectsLine[i].x1i, (gdouble)xyplot->objectsLine[i].y1i, (gdouble)xyplot->objectsLine[i].x2i, (gdouble)xyplot->objectsLine[i].y2i, &x1, &y1, &x2, &y2 ); xyplot_cairo_line(xyplot, xyplot->cairo_widget, widget, xyplot->lines_gc, (gint)x1, (gint)y1, xyplot->objectsLine[i].x2i, xyplot->objectsLine[i].y2i); xyplot_cairo_line(xyplot, xyplot->cairo_widget, widget, xyplot->lines_gc, (gint)x2, (gint)y2, xyplot->objectsLine[i].x2i, xyplot->objectsLine[i].y2i); } }
false
false
false
false
false
0
modehdlc(struct bchannel *bch, int protocol) { struct fritzcard *fc = bch->hw; struct hdlc_hw *hdlc; u8 mode; hdlc = &fc->hdlc[(bch->nr - 1) & 1]; pr_debug("%s: hdlc %c protocol %x-->%x ch %d\n", fc->name, '@' + bch->nr, bch->state, protocol, bch->nr); hdlc->ctrl.ctrl = 0; mode = (fc->type == AVM_FRITZ_PCIV2) ? HDLC_FIFO_SIZE_128 : 0; switch (protocol) { case -1: /* used for init */ bch->state = -1; case ISDN_P_NONE: if (bch->state == ISDN_P_NONE) break; hdlc->ctrl.sr.cmd = HDLC_CMD_XRS | HDLC_CMD_RRS; hdlc->ctrl.sr.mode = mode | HDLC_MODE_TRANS; write_ctrl(bch, 5); bch->state = ISDN_P_NONE; test_and_clear_bit(FLG_HDLC, &bch->Flags); test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags); break; case ISDN_P_B_RAW: bch->state = protocol; hdlc->ctrl.sr.cmd = HDLC_CMD_XRS | HDLC_CMD_RRS; hdlc->ctrl.sr.mode = mode | HDLC_MODE_TRANS; write_ctrl(bch, 5); hdlc->ctrl.sr.cmd = HDLC_CMD_XRS; write_ctrl(bch, 1); hdlc->ctrl.sr.cmd = 0; test_and_set_bit(FLG_TRANSPARENT, &bch->Flags); break; case ISDN_P_B_HDLC: bch->state = protocol; hdlc->ctrl.sr.cmd = HDLC_CMD_XRS | HDLC_CMD_RRS; hdlc->ctrl.sr.mode = mode | HDLC_MODE_ITF_FLG; write_ctrl(bch, 5); hdlc->ctrl.sr.cmd = HDLC_CMD_XRS; write_ctrl(bch, 1); hdlc->ctrl.sr.cmd = 0; test_and_set_bit(FLG_HDLC, &bch->Flags); break; default: pr_info("%s: protocol not known %x\n", fc->name, protocol); return -ENOPROTOOPT; } return 0; }
false
false
false
false
false
0
packet_writeXX(packet_t *packet, const void *data, int len) { if (sizeof(packet->data) - packet->offset <= len) { fprintf(stderr, "packet too full\n"); return 0; } memcpy(&packet->data[packet->offset], data, len); packet->offset += len; return 1; }
false
true
false
false
false
1
IsValid(const char *uid_) { /* 9.1 UID ENCODING RULES The DICOM UID encoding rules are defined as follows: - Each component of a UID is a number and shall consist of one or more digits. The first digit of each component shall not be zero unless the component is a single digit. Note: Registration authorities may distribute components with non-significant leading zeroes. The leading zeroes should be ignored when being encoded (ie. 00029 would be encoded 29). - Each component numeric value shall be encoded using the characters 0-9 of the Basic G0 Set of the International Reference Version of ISO 646:1990 (the DICOM default character repertoire). - Components shall be separated by the character "." (2EH). - If ending on an odd byte boundary, except when used for network negotiation (See PS 3.8), one trailing NULL (00H), as a padding character, shall follow the last component in order to align the UID on an even byte boundary. - UID's, shall not exceed 64 total characters, including the digits of each component, separators between components, and the NULL (00H) padding character if needed. */ /* * FIXME: This is not clear in the standard, but I believe a trailing '.' is not allowed since * this is considered as a separator for components */ std::string uid = uid_; if( uid.size() > 64 || uid.empty() ) { return false; } if( uid[0] == '.' || uid[uid.size()-1] == '.' ) // important to do that first { return false; } std::string::size_type i = 0; for(; i < uid.size(); ++i) { if( uid[i] == '.' ) // if test is true we are garantee that next char is valid (see previous check) { // check that next character is neither '0' (except single number) not '.' if( uid[i+1] == '.' ) { return false; } else if( uid[i+1] == '0' ) // character is garantee to exist since '.' is not last char { // Need to check first if we are not at the end of string if( i+2 != uid.size() && uid[i+2] != '.' ) { return false; } } } else if ( !isdigit( (unsigned char)uid[i] ) ) { return false; } } // no error found ! return true; }
false
false
false
false
false
0
SetRenderer(RenderSystem *r) { mRenderer = r; // Destroy each widget of GUI of previously selected renderer for(std::list<Widget>::iterator i=mRenderOptionWidgets.begin(); i!=mRenderOptionWidgets.end(); i++) XtDestroyWidget(*i); mRenderOptionWidgets.clear(); mConfigCallbackData.back(); // Create option GUI int cury = ystart + 1*rowh + 10; ConfigOptionMap options = mRenderer->getConfigOptions(); // Process each option and create an optionmenu widget for it for (ConfigOptionMap::iterator it = options.begin(); it != options.end(); it++) { // if the config option does not have any possible value, then skip it. // if we create a popup with zero entries, it will crash when you click // on it. if (it->second.possibleValues.empty()) continue; Widget lb1 = XtVaCreateManagedWidget("topLabel", labelWidgetClass, box, XtNlabel, it->second.name.c_str(), XtNborderWidth, 0, XtNwidth, col1w, // Fixed width XtNheight, 18, XtNleft, XawChainLeft, XtNtop, XawChainTop, XtNright, XawChainLeft, XtNbottom, XawChainTop, XtNhorizDistance, col1x, XtNvertDistance, cury, XtNjustify, XtJustifyLeft, NULL); mRenderOptionWidgets.push_back(lb1); Widget mb1 = XtVaCreateManagedWidget("Menu", menuButtonWidgetClass, box, XtNlabel, it->second.currentValue.c_str(), XtNresize, false, XtNresizable, false, XtNwidth, col2w, // Fixed width XtNheight, 18, XtNleft, XawChainLeft, XtNtop, XawChainTop, XtNright, XawChainLeft, XtNbottom, XawChainTop, XtNhorizDistance, col2x, XtNvertDistance, cury, NULL); mRenderOptionWidgets.push_back(mb1); Widget menu = XtVaCreatePopupShell("menu", simpleMenuWidgetClass, mb1, 0, NULL); // Process each choice StringVector::iterator opt_it; for (opt_it = it->second.possibleValues.begin(); opt_it != it->second.possibleValues.end(); opt_it++) { // Create callback data mConfigCallbackData.push_back(ConfigCallbackData(this, it->second.name, *opt_it, mb1)); Widget entry = XtVaCreateManagedWidget("menuentry", smeBSBObjectClass, menu, XtNlabel, (*opt_it).c_str(), 0, NULL); XtAddCallback(entry, XtNcallback, (XtCallbackProc)&GLXConfigurator::configOptionHandler, &mConfigCallbackData.back()); } cury += rowh; } }
false
false
false
false
false
0
gkm_secret_object_mark_created (GkmSecretObject *self) { GTimeVal tv; g_return_if_fail (GKM_IS_SECRET_OBJECT (self)); g_get_current_time (&tv); gkm_secret_object_set_created (self, tv.tv_sec); }
false
false
false
false
false
0
strop_find(PyObject *self, PyObject *args) { char *s, *sub; Py_ssize_t len, n, i = 0, last = PY_SSIZE_T_MAX; WARN; if (!PyArg_ParseTuple(args, "t#t#|nn:find", &s, &len, &sub, &n, &i, &last)) return NULL; if (last > len) last = len; if (last < 0) last += len; if (last < 0) last = 0; if (i < 0) i += len; if (i < 0) i = 0; if (n == 0 && i <= last) return PyInt_FromLong((long)i); last -= n; for (; i <= last; ++i) if (s[i] == sub[0] && (n == 1 || memcmp(&s[i+1], &sub[1], n-1) == 0)) return PyInt_FromLong((long)i); return PyInt_FromLong(-1L); }
false
false
false
false
false
0
uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, int flags, uv_fs_cb cb) { INIT(SYMLINK); PATH2; req->flags = flags; POST; }
false
false
false
false
false
0
operator<<(STD_OSTREAM& stream, const UnicodeString& str) { if(str.length() > 0) { char buffer[200]; UConverter *converter; UErrorCode errorCode = U_ZERO_ERROR; // use the default converter to convert chunks of text converter = u_getDefaultConverter(&errorCode); if(U_SUCCESS(errorCode)) { const UChar *us = str.getBuffer(); const UChar *uLimit = us + str.length(); char *s, *sLimit = buffer + (sizeof(buffer) - 1); do { errorCode = U_ZERO_ERROR; s = buffer; ucnv_fromUnicode(converter, &s, sLimit, &us, uLimit, 0, FALSE, &errorCode); *s = 0; // write this chunk if(s > buffer) { stream << buffer; } } while(errorCode == U_BUFFER_OVERFLOW_ERROR); u_releaseDefaultConverter(converter); } } /* stream.flush();*/ return stream; }
false
false
false
false
false
0
watpos(Screen *t,int x,int y) { W *w=t->topwin; do if(w->y>=0 && w->y<=y && w->y+w->h>y && w->x<=x && w->x+w->w>x) return w; while(w=w->link.next, w!=t->topwin); return 0; }
false
false
false
false
false
0
psw_get_params(gx_device * dev, gs_param_list * plist) { gx_device_pswrite *const pdev = (gx_device_pswrite *)dev; int code = gdev_psdf_get_params(dev, plist); int ecode; if (code < 0) return code; if ((ecode = param_write_float(plist, "LanguageLevel", &pdev->pswrite_common.LanguageLevel)) < 0) return ecode; return code; }
false
false
false
false
false
0
copy_file(const char *orig, const char *bkup) { char buf[buf_size]; int orig_fd; int bkup_fd; int flags = 0; ssize_t count_write; ssize_t count_read; #ifdef G_OS_WIN32 flags = O_BINARY; #endif orig_fd = g_open(orig, O_RDONLY | flags, 0); if (orig_fd == -1) { return FALSE; } bkup_fd = g_open(bkup, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | flags, 0600); if (bkup_fd == -1) { close(orig_fd); return FALSE; } do { count_read = read(orig_fd, buf, buf_size); if (count_read == -1 && errno != EINTR) { close(orig_fd); close(bkup_fd); return FALSE; } if (count_read > 0) { count_write = write(bkup_fd, buf, count_read); if (count_write == -1) { close(orig_fd); close(bkup_fd); return FALSE; } } } while (count_read > 0); close(orig_fd); close(bkup_fd); return TRUE; }
false
false
false
false
false
0
_opt_verify(void) { bool verified = true; if (opt.quiet && opt.verbose) { error ("don't specify both --verbose (-v) and --quiet (-Q)"); verified = false; } /* * set up standard IO filters */ if ((opt.input_filter_set || opt.output_filter_set || opt.error_filter_set) && opt.pty) { error("don't specifiy both --pty and I/O filtering"); verified = false; } if (opt.input_filter_set) opt.fds.in.taskid = opt.input_filter; if (opt.output_filter_set) opt.fds.out.taskid = opt.output_filter; if (opt.error_filter_set) { opt.fds.err.taskid = opt.error_filter; } else if (opt.output_filter_set) { opt.fds.err.taskid = opt.output_filter; } return verified; }
false
false
false
false
false
0
RequestDataObject(vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) { vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); if (!inInfo) { return 0; } vtkDataSet *input = vtkDataSet::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT())); if (input) { vtkInformation* info = outputVector->GetInformationObject(0); vtkDataSet *output = vtkDataSet::SafeDownCast( info->Get(vtkDataObject::DATA_OBJECT())); if (!output || !output->IsA(input->GetClassName())) { output = input->NewInstance(); output->SetPipelineInformation(info); output->Delete(); } return 1; } return 0; }
false
false
false
false
false
0
blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent, const struct blkid_idinfo *id) { blkid_probe prc; int rc = 1; blkid_partlist ls; blkid_loff_t sz, off; DBG(DEBUG_LOWPROBE, printf( "parts: ----> %s subprobe requested (parent=%p)\n", id->name, parent)); if (!pr || !parent || !parent->size) return -1; /* range defined by parent */ sz = ((blkid_loff_t) parent->size) << 9; off = ((blkid_loff_t) parent->start) << 9; if (off < pr->off || pr->off + pr->size < off + sz) { DBG(DEBUG_LOWPROBE, printf( "ERROR: parts: <---- '%s' subprobe: overflow detected.\n", id->name)); return -1; } /* create private prober */ prc = blkid_clone_probe(pr); if (!prc) return -1; blkid_probe_set_dimension(prc, off, sz); /* clone is always with reseted chain, fix it */ prc->cur_chain = blkid_probe_get_chain(pr); /* * Set 'parent' to the current list of the partitions and use the list * in cloned prober (so the cloned prober will extend the current list * of partitions rather than create a new). */ ls = blkid_probe_get_partlist(pr); blkid_partlist_set_parent(ls, parent); blkid_probe_set_partlist(prc, ls); rc = idinfo_probe(prc, id); blkid_probe_set_partlist(prc, NULL); blkid_partlist_set_parent(ls, NULL); blkid_free_probe(prc); /* free cloned prober */ DBG(DEBUG_LOWPROBE, printf( "parts: <---- %s subprobe done (parent=%p, rc=%d)\n", id->name, parent, rc)); return rc; }
false
false
false
false
false
0
ata_sff_set_devctl(struct ata_port *ap, u8 ctl) { if (ap->ops->sff_set_devctl) ap->ops->sff_set_devctl(ap, ctl); else iowrite8(ctl, ap->ioaddr.ctl_addr); }
false
false
false
false
false
0
tp_debug_message_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { TpDebugMessage *self = TP_DEBUG_MESSAGE (object); switch (property_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; case PROP_TIME: g_value_set_boxed (value, self->priv->time); break; case PROP_DOMAIN: g_value_set_string (value, self->priv->domain); break; case PROP_CATEGORY: g_value_set_string (value, self->priv->category); break; case PROP_LEVEL: g_value_set_uint (value, self->priv->level); break; case PROP_MESSAGE: g_value_set_string (value, self->priv->message); break; } }
false
false
false
false
false
0
LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, LZ_UInt32 symbol, LZ_UInt32 matchByte) { LZ_UInt32 offs = 0x100; symbol |= 0x100; do { matchByte <<= 1; RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); symbol <<= 1; offs &= ~(matchByte ^ symbol); } while (symbol < 0x10000); }
false
false
false
false
false
0
WriteJobIDsToFile(const std::list<Job>& jobs, const std::string& filename, unsigned nTries, unsigned tryInterval) { if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) return false; FileLock lock(filename); for (int tries = (int)nTries; tries > 0; --tries) { if (lock.acquire()) { std::ofstream os(filename.c_str(), std::ios::app); if (!os.good()) { os.close(); lock.release(); return false; } for (std::list<Job>::const_iterator it = jobs.begin(); it != jobs.end(); ++it) { os << it->JobID << std::endl; } bool good = os.good(); os.close(); lock.release(); return good; } if (tries == 6) { logger.msg(WARNING, "Waiting for lock on file %s", filename); } Glib::usleep(tryInterval); } return false; } }
false
false
false
false
false
0
write_to_stream(FILE *stream, chunk_t data) { size_t len, total = 0; while (total < data.len) { len = fwrite(data.ptr + total, 1, data.len - total, stream); if (len <= 0) { return FALSE; } total += len; } return TRUE; }
false
false
false
false
false
0
pxa2xx_spi_dma_transfer_complete(struct driver_data *drv_data, bool error) { struct spi_message *msg = drv_data->cur_msg; /* * It is possible that one CPU is handling ROR interrupt and other * just gets DMA completion. Calling pump_transfers() twice for the * same transfer leads to problems thus we prevent concurrent calls * by using ->dma_running. */ if (atomic_dec_and_test(&drv_data->dma_running)) { /* * If the other CPU is still handling the ROR interrupt we * might not know about the error yet. So we re-check the * ROR bit here before we clear the status register. */ if (!error) { u32 status = pxa2xx_spi_read(drv_data, SSSR) & drv_data->mask_sr; error = status & SSSR_ROR; } /* Clear status & disable interrupts */ pxa2xx_spi_write(drv_data, SSCR1, pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->dma_cr1); write_SSSR_CS(drv_data, drv_data->clear_sr); if (!pxa25x_ssp_comp(drv_data)) pxa2xx_spi_write(drv_data, SSTO, 0); if (!error) { pxa2xx_spi_unmap_dma_buffers(drv_data); drv_data->tx += drv_data->tx_map_len; drv_data->rx += drv_data->rx_map_len; msg->actual_length += drv_data->len; msg->state = pxa2xx_spi_next_transfer(drv_data); } else { /* In case we got an error we disable the SSP now */ pxa2xx_spi_write(drv_data, SSCR0, pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE); msg->state = ERROR_STATE; } tasklet_schedule(&drv_data->pump_transfers); } }
false
false
false
false
false
0
sa_setup_expirations(struct sa *sa) { struct timeval expiration; u_int64_t seconds = sa->seconds; /* * Set the soft timeout to a random percentage between 85 & 95 of * the negotiated lifetime to break strictly synchronized * renegotiations. This works better when the randomization is on the * order of processing plus network-roundtrip times, or larger. * I.e. it depends on configuration and negotiated lifetimes. * It is not good to do the decrease on the hard timeout, because then * we may drop our SA before our peer. * XXX Better scheme to come? */ if (!sa->soft_death) { gettimeofday(&expiration, 0); /* * XXX This should probably be configuration controlled * somehow. */ seconds = sa->seconds * (850 + sysdep_random() % 100) / 1000; LOG_DBG((LOG_TIMER, 95, "sa_setup_expirations: SA %p soft timeout in %llu seconds", sa, seconds)); expiration.tv_sec += seconds; sa->soft_death = timer_add_event("sa_soft_expire", sa_soft_expire, sa, &expiration); if (!sa->soft_death) { /* If we don't give up we might start leaking... */ sa_delete(sa, 1); return -1; } sa_reference(sa); } if (!sa->death) { gettimeofday(&expiration, 0); LOG_DBG((LOG_TIMER, 95, "sa_setup_expirations: SA %p hard timeout in %llu seconds", sa, sa->seconds)); expiration.tv_sec += sa->seconds; sa->death = timer_add_event("sa_hard_expire", sa_hard_expire, sa, &expiration); if (!sa->death) { /* If we don't give up we might start leaking... */ sa_delete(sa, 1); return -1; } sa_reference(sa); } return 0; }
false
false
false
false
false
0
_icon_duplicate(Evas_Object *icon) { Evas_Object *ic; const char *file; const char *group; if (!icon) return NULL; elm_image_file_get(icon, &file, &group); ic = elm_icon_add(icon); elm_image_file_set(ic, file, group); elm_image_resizable_set(ic, 1, 1); return ic; }
false
false
false
false
false
0
explain_buffer_errno_readv_explanation(explain_string_buffer_t *sb, int errnum, const char *syscall_name, int fildes, const struct iovec *data, int data_size) { void *data2; size_t data2_size; int j; /* * http://www.opengroup.org/onlinepubs/009695399/functions/readv.html */ switch (errnum) { case EFAULT: if (explain_is_efault_pointer(data, data_size * sizeof(*data))) { explain_buffer_efault(sb, "data"); return; } for (j = 0; j < data_size; ++j) { const struct iovec *p = data + j; if (explain_is_efault_pointer(p->iov_base, p->iov_len)) { char buffer[60]; snprintf(buffer, sizeof(buffer), "data[%d].iov_base", j); explain_buffer_efault(sb, buffer); return; } } return; case EINTR: explain_buffer_eintr(sb, syscall_name); return; case EINVAL: if (data_size < 0) { explain_buffer_einval_too_small(sb, "data_size", data_size); return; } /* * Linux readv(2) says * "POSIX.1-2001 allows an implementation to place a limit * on the number of items that can be passed in data. An * implementation can advertise its limit by defining IOV_MAX * in <limits.h> or at run time via the return value from * sysconf(_SC_IOV_MAX). * * "On Linux, the limit advertised by these mechanisms is 1024, * which is the true kernel limit. However, the glibc wrapper * functions do some extra work [to hide it]." */ { long iov_max; iov_max = -1; #ifdef _SC_IOV_MAX iov_max = sysconf(_SC_IOV_MAX); #endif #if IOV_MAX > 0 if (iov_max <= 0) iov_max = IOV_MAX; #endif if (iov_max > 0 && data_size > iov_max) { explain_buffer_einval_too_large2(sb, "data_size", iov_max); return; } } /* * The total size must fit into a ssize_t return value. */ { ssize_t max = (~(size_t)0) >> 1; long long total = 0; for (j = 0; j < data_size; ++j) total += data[j].iov_len; if (total > max) { explain_buffer_einval_too_large(sb, "data[*].iov_len"); if (explain_option_dialect_specific()) { explain_string_buffer_puts(sb, " ("); explain_buffer_long_long(sb, total); explain_string_buffer_puts(sb, " > "); explain_buffer_ssize_t(sb, max); explain_string_buffer_putc(sb, ')'); } return; } } break; case ENOSYS: #if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOSYS case EOPNOTSUPP: #endif explain_buffer_enosys_vague(sb, syscall_name); return; default: break; } /* * We know the size fits, because we would otherwise get an EINVAL * error, and that would have been handled already. */ data2 = (data_size > 0 ? data[0].iov_base : 0); data2_size = 0; for (j = 0; j < data_size; ++j) data2_size += data[j].iov_len; explain_buffer_errno_read_explanation ( sb, errnum, syscall_name, fildes, data2, data2_size ); }
false
false
false
false
false
0
fnic_cleanup_io(struct fnic *fnic, int exclude_id) { int i; struct fnic_io_req *io_req; unsigned long flags = 0; struct scsi_cmnd *sc; spinlock_t *io_lock; unsigned long start_time = 0; struct fnic_stats *fnic_stats = &fnic->fnic_stats; for (i = 0; i < fnic->fnic_max_tag_id; i++) { if (i == exclude_id) continue; io_lock = fnic_io_lock_tag(fnic, i); spin_lock_irqsave(io_lock, flags); sc = scsi_host_find_tag(fnic->lport->host, i); if (!sc) { spin_unlock_irqrestore(io_lock, flags); continue; } io_req = (struct fnic_io_req *)CMD_SP(sc); if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && !(CMD_FLAGS(sc) & FNIC_DEV_RST_DONE)) { /* * We will be here only when FW completes reset * without sending completions for outstanding ios. */ CMD_FLAGS(sc) |= FNIC_DEV_RST_DONE; if (io_req && io_req->dr_done) complete(io_req->dr_done); else if (io_req && io_req->abts_done) complete(io_req->abts_done); spin_unlock_irqrestore(io_lock, flags); continue; } else if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { spin_unlock_irqrestore(io_lock, flags); continue; } if (!io_req) { spin_unlock_irqrestore(io_lock, flags); goto cleanup_scsi_cmd; } CMD_SP(sc) = NULL; spin_unlock_irqrestore(io_lock, flags); /* * If there is a scsi_cmnd associated with this io_req, then * free the corresponding state */ start_time = io_req->start_time; fnic_release_ioreq_buf(fnic, io_req, sc); mempool_free(io_req, fnic->io_req_pool); cleanup_scsi_cmd: sc->result = DID_TRANSPORT_DISRUPTED << 16; FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "%s: sc duration = %lu DID_TRANSPORT_DISRUPTED\n", __func__, (jiffies - start_time)); if (atomic64_read(&fnic->io_cmpl_skip)) atomic64_dec(&fnic->io_cmpl_skip); else atomic64_inc(&fnic_stats->io_stats.io_completions); /* Complete the command to SCSI */ if (sc->scsi_done) { FNIC_TRACE(fnic_cleanup_io, sc->device->host->host_no, i, sc, jiffies_to_msecs(jiffies - start_time), 0, ((u64)sc->cmnd[0] << 32 | (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 | (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); sc->scsi_done(sc); } } }
false
false
false
false
false
0
diff_filespec_load_driver(struct diff_filespec *one) { /* Use already-loaded driver */ if (one->driver) return; if (S_ISREG(one->mode)) one->driver = userdiff_find_by_path(one->path); /* Fallback to default settings */ if (!one->driver) one->driver = userdiff_find_by_name("default"); }
false
false
false
false
false
0
CleanEdge(vtkIdType Edge) { if (this->CleanEdges==0) return; if (this->Poly1->GetValue(Edge)==-1) { this->DeleteEdge(Edge); } }
false
false
false
false
false
0
all_sky_zz_median(GList *ofrs) { GList *sl; struct o_frame *ofr; int n = 0; double * a; double me; sl = ofrs; while(sl != NULL) { ofr = O_FRAME(sl->data); sl = g_list_next(sl); if (ofr->nweight <= 0.0) continue; n++; } a = malloc(n * sizeof(double)); n = 0; sl = ofrs; while(sl != NULL) { ofr = O_FRAME(sl->data); sl = g_list_next(sl); if (ofr->nweight <= 0.0) continue; a[n] = ofr->zpoint; n++; } me = dmedian(a, n); free(a); return me; }
false
false
false
false
true
1
real_update_location_menu_volumes (NautilusView *view) { GtkAction *action; NautilusFile *file; gboolean show_mount; gboolean show_unmount; gboolean show_eject; gboolean show_start; gboolean show_stop; gboolean show_poll; GDriveStartStopType start_stop_type; g_assert (NAUTILUS_IS_VIEW (view)); g_assert (NAUTILUS_IS_FILE (view->details->location_popup_directory_as_file)); file = NAUTILUS_FILE (view->details->location_popup_directory_as_file); file_should_show_foreach (file, &show_mount, &show_unmount, &show_eject, &show_start, &show_stop, &show_poll, &start_stop_type); action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_MOUNT_VOLUME); gtk_action_set_visible (action, show_mount); action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_UNMOUNT_VOLUME); gtk_action_set_visible (action, show_unmount); action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_EJECT_VOLUME); gtk_action_set_visible (action, show_eject); action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_START_VOLUME); gtk_action_set_visible (action, show_start); if (show_start) { switch (start_stop_type) { default: case G_DRIVE_START_STOP_TYPE_UNKNOWN: gtk_action_set_label (action, _("_Start")); gtk_action_set_tooltip (action, _("Start the selected drive")); break; case G_DRIVE_START_STOP_TYPE_SHUTDOWN: gtk_action_set_label (action, _("_Start")); gtk_action_set_tooltip (action, _("Start the selected drive")); break; case G_DRIVE_START_STOP_TYPE_NETWORK: gtk_action_set_label (action, _("_Connect")); gtk_action_set_tooltip (action, _("Connect to the selected drive")); break; case G_DRIVE_START_STOP_TYPE_MULTIDISK: gtk_action_set_label (action, _("_Start Multi-disk Drive")); gtk_action_set_tooltip (action, _("Start the selected multi-disk drive")); break; case G_DRIVE_START_STOP_TYPE_PASSWORD: gtk_action_set_label (action, _("_Unlock Drive")); gtk_action_set_tooltip (action, _("Unlock the selected drive")); break; } } action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_STOP_VOLUME); gtk_action_set_visible (action, show_stop); if (show_stop) { switch (start_stop_type) { default: case G_DRIVE_START_STOP_TYPE_UNKNOWN: gtk_action_set_label (action, _("_Stop")); gtk_action_set_tooltip (action, _("Stop the selected volume")); break; case G_DRIVE_START_STOP_TYPE_SHUTDOWN: gtk_action_set_label (action, _("_Safely Remove Drive")); gtk_action_set_tooltip (action, _("Safely remove the selected drive")); break; case G_DRIVE_START_STOP_TYPE_NETWORK: gtk_action_set_label (action, _("_Disconnect")); gtk_action_set_tooltip (action, _("Disconnect the selected drive")); break; case G_DRIVE_START_STOP_TYPE_MULTIDISK: gtk_action_set_label (action, _("_Stop Multi-disk Drive")); gtk_action_set_tooltip (action, _("Stop the selected multi-disk drive")); break; case G_DRIVE_START_STOP_TYPE_PASSWORD: gtk_action_set_label (action, _("_Lock Drive")); gtk_action_set_tooltip (action, _("Lock the selected drive")); break; } } action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_LOCATION_POLL); gtk_action_set_visible (action, show_poll); }
false
false
false
false
false
0
fc_ns_query_step ( struct fc_ns_query *query ) { struct xfer_metadata meta; struct fc_ns_gid_pn_request gid_pn; int xchg_id; int rc; /* Create exchange */ if ( ( xchg_id = fc_xchg_originate ( &query->xchg, query->port, &fc_gs_port_id, FC_TYPE_CT ) ) < 0 ) { rc = xchg_id; DBGC ( query, "FCNS %p could not create exchange: %s\n", query, strerror ( rc ) ); fc_ns_query_close ( query, rc ); return; } /* Construct query request */ memset ( &gid_pn, 0, sizeof ( gid_pn ) ); gid_pn.ct.revision = FC_CT_REVISION; gid_pn.ct.type = FC_GS_TYPE_DS; gid_pn.ct.subtype = FC_DS_SUBTYPE_NAME; gid_pn.ct.code = htons ( FC_NS_GET ( FC_NS_PORT_NAME, FC_NS_PORT_ID )); memcpy ( &gid_pn.port_wwn, &query->peer->port_wwn, sizeof ( gid_pn.port_wwn ) ); memset ( &meta, 0, sizeof ( meta ) ); meta.flags = XFER_FL_OVER; /* Send query */ if ( ( rc = xfer_deliver_raw_meta ( &query->xchg, &gid_pn, sizeof ( gid_pn ), &meta ) ) != 0){ DBGC ( query, "FCNS %p could not deliver query: %s\n", query, strerror ( rc ) ); fc_ns_query_close ( query, rc ); return; } }
false
true
false
false
false
1
mid3(double a, double b, double c) { if ((a < b && a > c) || (a < c && a > b)) return a; if ((b < a && b > c) || (b < c && b > a)) return b; return c; }
false
false
false
false
false
0
inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, struct inotify_inode_mark *i_mark) { int ret; idr_preload(GFP_KERNEL); spin_lock(idr_lock); ret = idr_alloc_cyclic(idr, i_mark, 1, 0, GFP_NOWAIT); if (ret >= 0) { /* we added the mark to the idr, take a reference */ i_mark->wd = ret; fsnotify_get_mark(&i_mark->fsn_mark); } spin_unlock(idr_lock); idr_preload_end(); return ret < 0 ? ret : 0; }
false
false
false
false
false
0
gwy_graph_model_curve_notify(GwyGraphCurveModel *cmodel, GParamSpec *pspec, GwyGraphModel *gmodel) { gint i; /* FIXME: This scales bad although for a reasonable number of curves it's * quite fast. */ i = gwy_graph_model_get_curve_index(gmodel, cmodel); g_return_if_fail(i > -1); g_signal_emit(gmodel, graph_model_signals[CURVE_NOTIFY], 0, i, pspec); }
false
false
false
false
false
0
iscsi_tx_step ( struct process *process ) { struct iscsi_session *iscsi = container_of ( process, struct iscsi_session, process ); struct iscsi_bhs_common *common = &iscsi->tx_bhs.common; int ( * tx ) ( struct iscsi_session *iscsi ); enum iscsi_tx_state next_state; size_t tx_len; int rc; /* Select fragment to transmit */ while ( 1 ) { switch ( iscsi->tx_state ) { case ISCSI_TX_IDLE: /* Stop processing */ return; case ISCSI_TX_BHS: tx = iscsi_tx_bhs; tx_len = sizeof ( iscsi->tx_bhs ); next_state = ISCSI_TX_AHS; break; case ISCSI_TX_AHS: tx = iscsi_tx_nothing; tx_len = 0; next_state = ISCSI_TX_DATA; break; case ISCSI_TX_DATA: tx = iscsi_tx_data; tx_len = ISCSI_DATA_LEN ( common->lengths ); next_state = ISCSI_TX_DATA_PADDING; break; case ISCSI_TX_DATA_PADDING: tx = iscsi_tx_data_padding; tx_len = ISCSI_DATA_PAD_LEN ( common->lengths ); next_state = ISCSI_TX_IDLE; break; default: assert ( 0 ); return; } /* Check for window availability, if needed */ if ( tx_len && ( xfer_window ( &iscsi->socket ) == 0 ) ) { /* Cannot transmit at this point; stop processing */ return; } /* Transmit data */ if ( ( rc = tx ( iscsi ) ) != 0 ) { DBGC ( iscsi, "iSCSI %p could not transmit: %s\n", iscsi, strerror ( rc ) ); return; } /* Move to next state */ iscsi->tx_state = next_state; if ( next_state == ISCSI_TX_IDLE ) iscsi_tx_done ( iscsi ); } }
false
false
false
false
false
0
verify_correct_nesting(struct inlining_context *ctx) { struct subroutine *this; int *coverage; coverage = zalloc(ctx->code.code_length * sizeof(int)); if (!coverage) return warn("out of memory"), -ENOMEM; list_for_each_entry(this, &ctx->subroutine_list, subroutine_list_node) { int color = coverage[this->start_pc]; for (unsigned long i = this->start_pc; i < this->end_pc; i++) { if (coverage[i] != color) { free(coverage); return warn("overlaping subroutines"), -EINVAL; } coverage[i]++; } } free(coverage); return 0; }
false
false
false
false
false
0
git_diff__from_iterators( git_diff **diff_ptr, git_repository *repo, git_iterator *old_iter, git_iterator *new_iter, const git_diff_options *opts) { int error = 0; diff_in_progress info; git_diff *diff; *diff_ptr = NULL; diff = diff_list_alloc(repo, old_iter, new_iter); GITERR_CHECK_ALLOC(diff); info.repo = repo; info.old_iter = old_iter; info.new_iter = new_iter; /* make iterators have matching icase behavior */ if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_IGNORE_CASE)) { if ((error = git_iterator_set_ignore_case(old_iter, true)) < 0 || (error = git_iterator_set_ignore_case(new_iter, true)) < 0) goto cleanup; } /* finish initialization */ if ((error = diff_list_apply_options(diff, opts)) < 0) goto cleanup; if ((error = git_iterator_current(&info.oitem, old_iter)) < 0 && error != GIT_ITEROVER) goto cleanup; if ((error = git_iterator_current(&info.nitem, new_iter)) < 0 && error != GIT_ITEROVER) goto cleanup; error = 0; /* run iterators building diffs */ while (!error && (info.oitem || info.nitem)) { int cmp = info.oitem ? (info.nitem ? diff->entrycomp(info.oitem, info.nitem) : -1) : 1; /* create DELETED records for old items not matched in new */ if (cmp < 0) error = handle_unmatched_old_item(diff, &info); /* create ADDED, TRACKED, or IGNORED records for new items not * matched in old (and/or descend into directories as needed) */ else if (cmp > 0) error = handle_unmatched_new_item(diff, &info); /* otherwise item paths match, so create MODIFIED record * (or ADDED and DELETED pair if type changed) */ else error = handle_matched_item(diff, &info); /* because we are iterating over two lists, ignore ITEROVER */ if (error == GIT_ITEROVER) error = 0; } diff->perf.stat_calls += old_iter->stat_calls + new_iter->stat_calls; cleanup: if (!error) *diff_ptr = diff; else git_diff_free(diff); return error; }
false
false
false
false
false
0
gee_tree_map_value_collection_real_contains (GeeAbstractCollection* base, gconstpointer key) { GeeTreeMapValueCollection * self; gboolean result = FALSE; GeeIterator* it = NULL; GeeIterator* _tmp0_ = NULL; self = (GeeTreeMapValueCollection*) base; _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); it = _tmp0_; while (TRUE) { GeeIterator* _tmp1_ = NULL; gboolean _tmp2_ = FALSE; GeeTreeMap* _tmp3_ = NULL; GEqualFunc _tmp4_ = NULL; GEqualFunc _tmp5_ = NULL; gconstpointer _tmp6_ = NULL; GeeIterator* _tmp7_ = NULL; gpointer _tmp8_ = NULL; gpointer _tmp9_ = NULL; gboolean _tmp10_ = FALSE; gboolean _tmp11_ = FALSE; _tmp1_ = it; _tmp2_ = gee_iterator_next (_tmp1_); if (!_tmp2_) { break; } _tmp3_ = self->priv->_map; _tmp4_ = gee_tree_map_get_value_equal_func (_tmp3_); _tmp5_ = _tmp4_; _tmp6_ = key; _tmp7_ = it; _tmp8_ = gee_iterator_get (_tmp7_); _tmp9_ = _tmp8_; _tmp10_ = _tmp5_ (_tmp6_, _tmp9_); _tmp11_ = _tmp10_; ((_tmp9_ == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp9_ = (self->priv->v_destroy_func (_tmp9_), NULL)); if (_tmp11_) { result = TRUE; _g_object_unref0 (it); return result; } } result = FALSE; _g_object_unref0 (it); return result; }
false
false
false
false
false
0
mission_goal_fail_incomplete() { int i; for (i = 0; i < Num_goals; i++ ) { if ( Mission_goals[i].satisfied == GOAL_INCOMPLETE ) { Mission_goals[i].satisfied = GOAL_FAILED; mission_log_add_entry( LOG_GOAL_FAILED, Mission_goals[i].name, NULL, i ); } } // now for the events. Must set the formula to -1 and the result to 0 to be a failed // event. for ( i = 0; i < Num_mission_events; i++ ) { if ( Mission_events[i].formula != -1 ) { Mission_events[i].formula = -1; Mission_events[i].result = 0; } } }
false
false
false
false
false
0
RequestData( vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) { vtkInformation *outInfo = outputVector->GetInformationObject(0); // Return all data in the first piece ... if(outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) > 0) { return 1; } vtkDebugMacro(<<"Reading vtk table..."); if(!this->OpenVTKFile() || !this->ReadHeader()) { return 1; } // Read table-specific stuff char line[256]; if(!this->ReadString(line)) { vtkErrorMacro(<<"Data file ends prematurely!"); this->CloseVTKFile(); return 1; } if(strncmp(this->LowerCase(line),"dataset", (unsigned long)7)) { vtkErrorMacro(<< "Unrecognized keyword: " << line); this->CloseVTKFile(); return 1; } if(!this->ReadString(line)) { vtkErrorMacro(<<"Data file ends prematurely!"); this->CloseVTKFile (); return 1; } if(strncmp(this->LowerCase(line),"table", 5)) { vtkErrorMacro(<< "Cannot read dataset type: " << line); this->CloseVTKFile(); return 1; } vtkTable* const output = vtkTable::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT())); int done = 0; while(!done) { if(!this->ReadString(line)) { break; } if(!strncmp(this->LowerCase(line), "field", 5)) { vtkFieldData* const field_data = this->ReadFieldData(); output->SetFieldData(field_data); field_data->Delete(); continue; } if(!strncmp(this->LowerCase(line), "row_data", 8)) { int row_count = 0; if(!this->Read(&row_count)) { vtkErrorMacro(<<"Cannot read number of rows!"); this->CloseVTKFile(); return 1; } this->ReadRowData(output, row_count); continue; } vtkErrorMacro(<< "Unrecognized keyword: " << line); } vtkDebugMacro(<< "Read " << output->GetNumberOfRows() <<" rows in " << output->GetNumberOfColumns() <<" columns.\n"); this->CloseVTKFile (); return 1; }
false
false
false
false
false
0
availableRenderBackends() { QSet<Document::RenderBackend> ret; #if defined(HAVE_SPLASH) ret << Document::SplashBackend; #endif ret << Document::ArthurBackend; return ret; }
false
false
false
false
false
0
e_cal_backend_sync_get_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error) { ECalBackendSyncClass *class; g_return_if_fail (E_IS_CAL_BACKEND_SYNC (backend)); class = E_CAL_BACKEND_SYNC_GET_CLASS (backend); if (class->get_timezone_sync != NULL) { class->get_timezone_sync ( backend, cal, cancellable, tzid, tzobject, error); } if (tzobject && !*tzobject) { icaltimezone *zone = NULL; zone = e_timezone_cache_get_timezone ( E_TIMEZONE_CACHE (backend), tzid); if (!zone) { g_propagate_error (error, e_data_cal_create_error (ObjectNotFound, NULL)); } else { icalcomponent *icalcomp; icalcomp = icaltimezone_get_component (zone); if (!icalcomp) { g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL)); } else { *tzobject = icalcomponent_as_ical_string_r (icalcomp); } } } }
false
false
false
true
false
1
HandleCancelAuraOpcode(WorldPacket& recvPacket) { uint32 spellId; recvPacket >> spellId; SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return; if (spellInfo->HasAttribute(SPELL_ATTR_CANT_CANCEL)) return; if (IsPassiveSpell(spellInfo)) return; if (!IsPositiveSpell(spellId)) { // ignore for remote control state if (!_player->IsSelfMover()) { // except own aura spells bool allow = false; for (int k = 0; k < MAX_EFFECT_INDEX; ++k) { if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS || spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET) { allow = true; break; } } // this also include case when aura not found if (!allow) return; } else return; } // channeled spell case (it currently casted then) if (IsChanneledSpell(spellInfo)) { if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) if (curSpell->m_spellInfo->Id == spellId) _player->InterruptSpell(CURRENT_CHANNELED_SPELL); return; } SpellAuraHolder* holder = _player->GetSpellAuraHolder(spellId); // not own area auras can't be cancelled (note: maybe need to check for aura on holder and not general on spell) if (holder && holder->GetCasterGuid() != _player->GetObjectGuid() && HasAreaAuraEffect(holder->GetSpellProto())) return; // non channeled case _player->RemoveAurasDueToSpellByCancel(spellId); }
false
false
false
false
false
0
wnck_window_timeout_cb (WnckWindow *window) { const gchar *game; gint x, y; gint width, height; gchar *sql; GError *error = NULL; if (wnck_window_is_fullscreen (window)) goto exit; game = wnck_window_get_game (window); wnck_window_get_geometry (window, &x, &y, &width, &height); if (wnck_window_is_maximized (window)) sql = g_strdup_printf ( "UPDATE window SET maximized = 1 " "WHERE name = '%s'", game); else sql = g_strdup_printf ( "UPDATE window SET x = %d, y = %d, width = %d, " "height = %d, maximized = 0 WHERE name = '%s'", x, y, width, height, game); gva_db_execute (sql, &error); gva_error_handle (&error); g_free (sql); exit: g_object_set_data (G_OBJECT (window), TIMEOUT_SOURCE_ID_KEY, NULL); return FALSE; }
false
false
false
false
false
0
supportedSOPClassUIDs(OFList<OFString>& suppSOPs) { suppSOPs.push_back(UID_MultiframeSingleBitSecondaryCaptureImageStorage); suppSOPs.push_back(UID_MultiframeGrayscaleByteSecondaryCaptureImageStorage); suppSOPs.push_back(UID_MultiframeGrayscaleWordSecondaryCaptureImageStorage); suppSOPs.push_back(UID_MultiframeTrueColorSecondaryCaptureImageStorage); }
false
false
false
false
false
0
releaseMemory() { // Iterate through all the SCEVUnknown instances and call their // destructors, so that they release their references to their values. for (SCEVUnknown *U = FirstUnknown; U; U = U->Next) U->~SCEVUnknown(); FirstUnknown = 0; ValueExprMap.clear(); // Free any extra memory created for ExitNotTakenInfo in the unlikely event // that a loop had multiple computable exits. for (DenseMap<const Loop*, BackedgeTakenInfo>::iterator I = BackedgeTakenCounts.begin(), E = BackedgeTakenCounts.end(); I != E; ++I) { I->second.clear(); } BackedgeTakenCounts.clear(); ConstantEvolutionLoopExitValue.clear(); ValuesAtScopes.clear(); LoopDispositions.clear(); BlockDispositions.clear(); UnsignedRanges.clear(); SignedRanges.clear(); UniqueSCEVs.clear(); SCEVAllocator.Reset(); }
false
false
false
false
false
0
getCountUnlocked(network_address_type_t type) { RoutingMap::iterator it = routes_[type].begin(); uint16_t routes=0; for(; it!=routes_[type].end(); ++it) { routes++; } return routes; }
false
false
false
false
false
0
exelif(expptr p) #endif { if (ctlstack->ctltype == CTLIF || ctlstack->ctltype == CTLIFX) putif(p, 1); /* 1 ==> elseif */ else execerr("elseif out of place", CNULL); }
false
false
false
false
false
0
usart_send_address(Usart *p_usart, uint32_t ul_addr) { if ((p_usart->US_MR & US_MR_PAR_MULTIDROP) != US_MR_PAR_MULTIDROP) { return 1; } p_usart->US_CR = US_CR_SENDA; if (usart_write(p_usart, ul_addr)) { return 1; } else { return 0; } }
false
false
false
false
false
0
pTnext( Event& event, double pTbegAll, double pTendAll) { // Begin loop over all possible radiating dipole ends. dipSel = 0; iDipSel = -1; double pT2sel = pTendAll * pTendAll; for (int iDip = 0; iDip < int(dipEnd.size()); ++iDip) { TimeDipoleEnd& dip = dipEnd[iDip]; // Check if global recoil should be used. useLocalRecoilNow = !(globalRecoil && dip.system == 0 && partonSystemsPtr->sizeOut(0) <= nMaxGlobalRecoil); // Dipole properties; normal local recoil. dip.mRad = event[dip.iRadiator].m(); if (useLocalRecoilNow) { dip.mRec = event[dip.iRecoiler].m(); dip.mDip = m( event[dip.iRadiator], event[dip.iRecoiler] ); // Dipole properties, alternative global recoil. Squares. } else { Vec4 pSumGlobal; for (int i = 0; i < partonSystemsPtr->sizeOut( dip.system); ++i) { int ii = partonSystemsPtr->getOut( dip.system, i); if (ii != dip.iRadiator) pSumGlobal += event[ii].p(); } dip.mRec = pSumGlobal.mCalc(); dip.mDip = m( event[dip.iRadiator].p(), pSumGlobal); } dip.m2Rad = pow2(dip.mRad); dip.m2Rec = pow2(dip.mRec); dip.m2Dip = pow2(dip.mDip); // Find maximum evolution scale for dipole. dip.m2DipCorr = pow2(dip.mDip - dip.mRec) - dip.m2Rad; double pTbegDip = min( pTbegAll, dip.pTmax ); double pT2begDip = min( pow2(pTbegDip), 0.25 * dip.m2DipCorr); // Do QCD, QED or HV evolution if it makes sense. dip.pT2 = 0.; if (pT2begDip > pT2sel) { if (dip.colType != 0) pT2nextQCD(pT2begDip, pT2sel, dip, event); else if (dip.chgType != 0 || dip.gamType != 0) pT2nextQED(pT2begDip, pT2sel, dip, event); else if (dip.colvType != 0) pT2nextHV(pT2begDip, pT2sel, dip, event); // Update if found larger pT than current maximum. if (dip.pT2 > pT2sel) { pT2sel = dip.pT2; dipSel = &dip; iDipSel = iDip; } } } // Return nonvanishing value if found pT bigger than already found. return (dipSel == 0) ? 0. : sqrt(pT2sel); }
false
false
false
false
false
0
isert_create_qp(struct isert_conn *isert_conn, struct isert_comp *comp, struct rdma_cm_id *cma_id) { struct isert_device *device = isert_conn->device; struct ib_qp_init_attr attr; int ret; memset(&attr, 0, sizeof(struct ib_qp_init_attr)); attr.event_handler = isert_qp_event_callback; attr.qp_context = isert_conn; attr.send_cq = comp->cq; attr.recv_cq = comp->cq; attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; attr.cap.max_send_sge = device->dev_attr.max_sge; isert_conn->max_sge = min(device->dev_attr.max_sge, device->dev_attr.max_sge_rd); attr.cap.max_recv_sge = 1; attr.sq_sig_type = IB_SIGNAL_REQ_WR; attr.qp_type = IB_QPT_RC; if (device->pi_capable) attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN; ret = rdma_create_qp(cma_id, device->pd, &attr); if (ret) { isert_err("rdma_create_qp failed for cma_id %d\n", ret); return ERR_PTR(ret); } return cma_id->qp; }
false
false
false
false
false
0
cancel() { for (QuerySet::iterator Q=m_activeQueries.begin(); Q!=m_activeQueries.end();++Q) delete *Q; m_activeQueries.clear(); disconnect(); // revert to the last valid list if possible if (!m_lastValidList.empty()) { m_gameServers = m_lastValidList; m_status = VALID; } else { m_status = INVALID; m_gameServers.clear(); } m_nextQuery = m_gameServers.size(); }
false
false
false
false
false
0
imx6ul_tsc_init(struct imx6ul_tsc *tsc) { int err; err = imx6ul_adc_init(tsc); if (err) return err; imx6ul_tsc_channel_config(tsc); imx6ul_tsc_set(tsc); return 0; }
false
false
false
false
false
0
zd_mac_preinit_hw(struct ieee80211_hw *hw) { int r; u8 addr[ETH_ALEN]; struct zd_mac *mac = zd_hw_mac(hw); r = zd_chip_read_mac_addr_fw(&mac->chip, addr); if (r) return r; SET_IEEE80211_PERM_ADDR(hw, addr); return 0; }
false
false
false
false
false
0
lpt_suspend_hw(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; if (HAS_PCH_LPT_LP(dev)) { uint32_t val = I915_READ(SOUTH_DSPCLK_GATE_D); val &= ~PCH_LP_PARTITION_LEVEL_DISABLE; I915_WRITE(SOUTH_DSPCLK_GATE_D, val); } }
false
false
false
false
false
0
popupAtPosition( QPointF position ) const { foreach ( QGraphicsItem * item, items( position ) ) { if ( dynamic_cast<KGamePopupItem *>( item ) != 0 ) return true; } return false; }
false
false
false
false
false
0
_mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count, const GLcharARB * const * string, const GLint * length) { GET_CURRENT_CONTEXT(ctx); GLint *offsets; GLsizei i, totalLength; GLcharARB *source; GLuint checksum; if (!shaderObj || string == NULL) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); return; } /* * This array holds offsets of where the appropriate string ends, thus the * last element will be set to the total length of the source code. */ offsets = malloc(count * sizeof(GLint)); if (offsets == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; } for (i = 0; i < count; i++) { if (string[i] == NULL) { free((GLvoid *) offsets); _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)"); return; } if (length == NULL || length[i] < 0) offsets[i] = strlen(string[i]); else offsets[i] = length[i]; /* accumulate string lengths */ if (i > 0) offsets[i] += offsets[i - 1]; } /* Total length of source string is sum off all strings plus two. * One extra byte for terminating zero, another extra byte to silence * valgrind warnings in the parser/grammer code. */ totalLength = offsets[count - 1] + 2; source = malloc(totalLength * sizeof(GLcharARB)); if (source == NULL) { free((GLvoid *) offsets); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; } for (i = 0; i < count; i++) { GLint start = (i > 0) ? offsets[i - 1] : 0; memcpy(source + start, string[i], (offsets[i] - start) * sizeof(GLcharARB)); } source[totalLength - 1] = '\0'; source[totalLength - 2] = '\0'; if (SHADER_SUBST) { /* Compute the shader's source code checksum then try to open a file * named newshader_<CHECKSUM>. If it exists, use it in place of the * original shader source code. For debugging. */ char filename[100]; GLcharARB *newSource; checksum = _mesa_str_checksum(source); _mesa_snprintf(filename, sizeof(filename), "newshader_%d", checksum); newSource = read_shader(filename); if (newSource) { fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n", shaderObj, checksum, filename); free(source); source = newSource; } } shader_source(ctx, shaderObj, source); if (SHADER_SUBST) { struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj); if (sh) sh->SourceChecksum = checksum; /* save original checksum */ } free(offsets); }
false
true
false
false
true
1
pch_uart_hal_set_break(struct eg20t_port *priv, int on) { unsigned int lcr; lcr = ioread8(priv->membase + UART_LCR); if (on) lcr |= PCH_UART_LCR_SB; else lcr &= ~PCH_UART_LCR_SB; iowrite8(lcr, priv->membase + UART_LCR); }
false
false
false
false
false
0
RenderTranslucentPolygonalGeometry(vtkViewport *viewport) { int renderedSomething=0; this->BuildAxis(viewport, false); // Everything is built, just have to render if (!this->AxisHasZeroLength) { if(this->DrawGridpolys) { renderedSomething += this->GridpolysActor->RenderTranslucentPolygonalGeometry(viewport); } } return renderedSomething; }
false
false
false
false
false
0
gth_backtrace_path_referencecutoff_end(const GthBacktracePath *bt) { gt_assert(bt); return bt->cutoffs.end.referencecutoff; }
false
false
false
false
false
0
result_timed_out( TRANSITIONER_ITEM res_item, TRANSITIONER_ITEM& wu_item ) { DB_HOST_APP_VERSION hav; char query[512], clause[512]; int gavid = generalized_app_version_id( res_item.res_app_version_id, wu_item.appid ); int retval = hav_lookup(hav, res_item.res_hostid, gavid); if (retval) { log_messages.printf(MSG_NORMAL, "result_timed_out(): hav_lookup failed: %s\n", boincerror(retval) ); return retval; } hav.turnaround.update_var( (double)wu_item.delay_bound, HAV_AVG_THRESH, HAV_AVG_WEIGHT, HAV_AVG_LIMIT ); int n = hav.max_jobs_per_day; if (n == 0) { n = config.daily_result_quota; } if (n > config.daily_result_quota) { n = config.daily_result_quota; } n -= 1; if (n < 1) { n = 1; } if (config.debug_quota) { log_messages.printf(MSG_NORMAL, "[quota] max_jobs_per_day for %d; %d->%d\n", gavid, hav.max_jobs_per_day, n ); } hav.max_jobs_per_day = n; hav.consecutive_valid = 0; sprintf(query, "turnaround_n=%.15e, turnaround_avg=%.15e, turnaround_var=%.15e, turnaround_q=%.15e, max_jobs_per_day=%d, consecutive_valid=%d", hav.turnaround.n, hav.turnaround.avg, hav.turnaround.var, hav.turnaround.q, hav.max_jobs_per_day, hav.consecutive_valid ); sprintf(clause, "host_id=%d and app_version_id=%d", hav.host_id, hav.app_version_id ); retval = hav.update_fields_noid(query, clause); if (retval) { log_messages.printf(MSG_CRITICAL, "CRITICAL result_timed_out(): hav updated failed: %s\n", boincerror(retval) ); } return 0; }
false
false
false
false
false
0
mic_dp_show(struct seq_file *s, void *pos) { struct mic_device *mdev = s->private; struct mic_device_desc *d; struct mic_device_ctrl *dc; struct mic_vqconfig *vqconfig; __u32 *features; __u8 *config; struct mic_bootparam *bootparam = mdev->dp; int i, j; seq_printf(s, "Bootparam: magic 0x%x\n", bootparam->magic); seq_printf(s, "Bootparam: h2c_config_db %d\n", bootparam->h2c_config_db); seq_printf(s, "Bootparam: node_id %d\n", bootparam->node_id); seq_printf(s, "Bootparam: c2h_scif_db %d\n", bootparam->c2h_scif_db); seq_printf(s, "Bootparam: h2c_scif_db %d\n", bootparam->h2c_scif_db); seq_printf(s, "Bootparam: scif_host_dma_addr 0x%llx\n", bootparam->scif_host_dma_addr); seq_printf(s, "Bootparam: scif_card_dma_addr 0x%llx\n", bootparam->scif_card_dma_addr); for (i = sizeof(*bootparam); i < MIC_DP_SIZE; i += mic_total_desc_size(d)) { d = mdev->dp + i; dc = (void *)d + mic_aligned_desc_size(d); /* end of list */ if (d->type == 0) break; if (d->type == -1) continue; seq_printf(s, "Type %d ", d->type); seq_printf(s, "Num VQ %d ", d->num_vq); seq_printf(s, "Feature Len %d\n", d->feature_len); seq_printf(s, "Config Len %d ", d->config_len); seq_printf(s, "Shutdown Status %d\n", d->status); for (j = 0; j < d->num_vq; j++) { vqconfig = mic_vq_config(d) + j; seq_printf(s, "vqconfig[%d]: ", j); seq_printf(s, "address 0x%llx ", vqconfig->address); seq_printf(s, "num %d ", vqconfig->num); seq_printf(s, "used address 0x%llx\n", vqconfig->used_address); } features = (__u32 *)mic_vq_features(d); seq_printf(s, "Features: Host 0x%x ", features[0]); seq_printf(s, "Guest 0x%x\n", features[1]); config = mic_vq_configspace(d); for (j = 0; j < d->config_len; j++) seq_printf(s, "config[%d]=%d\n", j, config[j]); seq_puts(s, "Device control:\n"); seq_printf(s, "Config Change %d ", dc->config_change); seq_printf(s, "Vdev reset %d\n", dc->vdev_reset); seq_printf(s, "Guest Ack %d ", dc->guest_ack); seq_printf(s, "Host ack %d\n", dc->host_ack); seq_printf(s, "Used address updated %d ", dc->used_address_updated); seq_printf(s, "Vdev 0x%llx\n", dc->vdev); seq_printf(s, "c2h doorbell %d ", dc->c2h_vdev_db); seq_printf(s, "h2c doorbell %d\n", dc->h2c_vdev_db); } return 0; }
false
false
false
false
false
0
H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) { H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5MF_alloc, HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ HDassert(f); HDassert(f->shared); HDassert(f->shared->lf); HDassert(size > 0); /* Get free space type from allocation type */ fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); /* Check if we are using the free space manager for this file */ if(H5F_HAVE_FREE_SPACE_MANAGER(f)) { /* Check if the free space manager for the file has been initialized */ if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space") /* Search for large enough space in the free space manager */ if(f->shared->fs_man[fs_type]) { H5MF_free_section_t *node; /* Free space section pointer */ htri_t node_found = FALSE; /* Whether an existing free list node was found */ /* Try to get a section from the free space manager */ if((node_found = H5FS_sect_find(f, dxpl_id, f->shared->fs_man[fs_type], size, (H5FS_section_info_t **)&node)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating free space in file") #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.5, node_found = %t\n", FUNC, node_found); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Check for actually finding section */ if(node_found) { /* Sanity check */ HDassert(node); /* Retrieve return value */ ret_value = node->sect_info.addr; /* Check for eliminating the section */ if(node->sect_info.size == size) { #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.6, freeing node\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free simple section node") } /* end if */ else { H5MF_sect_ud_t udata; /* User data for callback */ /* Adjust information for section */ node->sect_info.addr += size; node->sect_info.size -= size; /* Construct user data for callbacks */ udata.f = f; udata.dxpl_id = dxpl_id; udata.alloc_type = alloc_type; udata.allow_sect_absorb = TRUE; #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.7, re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Re-insert section node into file's free space */ if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't re-add section to file free space") } /* end else */ /* Leave now */ HGOTO_DONE(ret_value) } /* end if */ } /* end if */ #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 2.0\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ /* Allocate from the metadata aggregator (or the VFD) */ if(HADDR_UNDEF == (ret_value = H5MF_aggr_vfd_alloc(f, alloc_type, dxpl_id, size))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") done: #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF_sects_dump(f, dxpl_id, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) { int xy, wrap, pred, a, b, c; xy = s->block_index[n]; wrap = s->b8_stride; /* B C * A X */ a = s->coded_block[xy - 1 ]; b = s->coded_block[xy - 1 - wrap]; c = s->coded_block[xy - wrap]; if (b == c) { pred = a; } else { pred = c; } /* store value */ *coded_block_ptr = &s->coded_block[xy]; return pred; }
false
false
false
false
false
0
isAssociativeAndCommutative(const MachineInstr &Inst) const { switch (Inst.getOpcode()) { case X86::AND8rr: case X86::AND16rr: case X86::AND32rr: case X86::AND64rr: case X86::OR8rr: case X86::OR16rr: case X86::OR32rr: case X86::OR64rr: case X86::XOR8rr: case X86::XOR16rr: case X86::XOR32rr: case X86::XOR64rr: case X86::IMUL16rr: case X86::IMUL32rr: case X86::IMUL64rr: case X86::PANDrr: case X86::PORrr: case X86::PXORrr: case X86::VPANDrr: case X86::VPANDYrr: case X86::VPORrr: case X86::VPORYrr: case X86::VPXORrr: case X86::VPXORYrr: // Normal min/max instructions are not commutative because of NaN and signed // zero semantics, but these are. Thus, there's no need to check for global // relaxed math; the instructions themselves have the properties we need. case X86::MAXCPDrr: case X86::MAXCPSrr: case X86::MAXCSDrr: case X86::MAXCSSrr: case X86::MINCPDrr: case X86::MINCPSrr: case X86::MINCSDrr: case X86::MINCSSrr: case X86::VMAXCPDrr: case X86::VMAXCPSrr: case X86::VMAXCPDYrr: case X86::VMAXCPSYrr: case X86::VMAXCSDrr: case X86::VMAXCSSrr: case X86::VMINCPDrr: case X86::VMINCPSrr: case X86::VMINCPDYrr: case X86::VMINCPSYrr: case X86::VMINCSDrr: case X86::VMINCSSrr: return true; case X86::ADDPDrr: case X86::ADDPSrr: case X86::ADDSDrr: case X86::ADDSSrr: case X86::MULPDrr: case X86::MULPSrr: case X86::MULSDrr: case X86::MULSSrr: case X86::VADDPDrr: case X86::VADDPSrr: case X86::VADDPDYrr: case X86::VADDPSYrr: case X86::VADDSDrr: case X86::VADDSSrr: case X86::VMULPDrr: case X86::VMULPSrr: case X86::VMULPDYrr: case X86::VMULPSYrr: case X86::VMULSDrr: case X86::VMULSSrr: return Inst.getParent()->getParent()->getTarget().Options.UnsafeFPMath; default: return false; } }
false
false
false
false
false
0
PrepareBufferedEvent(jack_nframes_t time) { bool result = ! unbuffered_bytes; if (! result) { HandleBufferFailure(unbuffered_bytes, total_bytes); } else { PrepareEvent(time, total_bytes, input_buffer); } Clear(); if (status_byte >= 0xf0) { expected_bytes = 0; status_byte = 0; } return result; }
false
false
false
false
false
0
on_activated() { if(!m_note) { return; } NotebookManager::obj().move_note_to_notebook(m_note, m_notebook); }
false
false
false
false
false
0
torch_MemoryFile_storage(lua_State *L) { MemoryFile *file = luaT_checkudata(L, 1, torch_MemoryFile_id); if(!file->storage) luaL_error(L, "attempt to use a closed file"); THCharStorage_resize(file->storage, file->size+1, 1); file->storage->refcount++; luaT_pushudata(L, file->storage, torch_CharStorage_id); return 1; }
false
false
false
false
false
0
mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac) { struct mwifiex_sta_node *sta_ptr; sta_ptr = mwifiex_get_sta_entry(priv, mac); if (sta_ptr) return sta_ptr->tdls_status; return TDLS_NOT_SETUP; }
false
false
false
false
false
0
SFGuessScriptList(SplineFont1 *sf) { uint32 scripts[32], script; int i, scnt=0, j; for ( i=0; i<sf->sf.glyphcnt; ++i ) if ( sf->sf.glyphs[i]!=NULL ) { script = SCScriptFromUnicode(sf->sf.glyphs[i]); if ( script!=0 && script!=DEFAULT_SCRIPT ) { for ( j=scnt-1; j>=0 ; --j ) if ( scripts[j]==script ) break; if ( j<0 ) { scripts[scnt++] = script; if ( scnt>=32 ) break; } } } if ( scnt==0 ) scripts[scnt++] = CHR('l','a','t','n'); /* order scripts */ for ( i=0; i<scnt-1; ++i ) for ( j=i+1; j<scnt; ++j ) { if ( scripts[i]>scripts[j] ) { script = scripts[i]; scripts[i] = scripts[j]; scripts[j] = script; } } if ( sf->sf.cidmaster ) sf = (SplineFont1 *) sf->sf.cidmaster; else if ( sf->sf.mm!=NULL ) sf=(SplineFont1 *) sf->sf.mm->normal; if ( sf->script_lang!=NULL ) return; sf->script_lang = gcalloc(2,sizeof(struct script_record *)); sf->script_lang[0] = gcalloc(scnt+1,sizeof(struct script_record)); sf->sli_cnt = 1; for ( j=0; j<scnt; ++j ) { sf->script_lang[0][j].script = scripts[j]; sf->script_lang[0][j].langs = galloc(2*sizeof(uint32)); sf->script_lang[0][j].langs[0] = DEFAULT_LANG; sf->script_lang[0][j].langs[1] = 0; } sf->script_lang[1] = NULL; }
false
false
false
false
false
0
drms_uA_update(struct regulator_dev *rdev) { struct regulator *sibling; int current_uA = 0, output_uV, input_uV, err; unsigned int mode; lockdep_assert_held_once(&rdev->mutex); /* * first check to see if we can set modes at all, otherwise just * tell the consumer everything is OK. */ err = regulator_check_drms(rdev); if (err < 0) return 0; if (!rdev->desc->ops->get_optimum_mode && !rdev->desc->ops->set_load) return 0; if (!rdev->desc->ops->set_mode && !rdev->desc->ops->set_load) return -EINVAL; /* get output voltage */ output_uV = _regulator_get_voltage(rdev); if (output_uV <= 0) { rdev_err(rdev, "invalid output voltage found\n"); return -EINVAL; } /* get input voltage */ input_uV = 0; if (rdev->supply) input_uV = regulator_get_voltage(rdev->supply); if (input_uV <= 0) input_uV = rdev->constraints->input_uV; if (input_uV <= 0) { rdev_err(rdev, "invalid input voltage found\n"); return -EINVAL; } /* calc total requested load */ list_for_each_entry(sibling, &rdev->consumer_list, list) current_uA += sibling->uA_load; current_uA += rdev->constraints->system_load; if (rdev->desc->ops->set_load) { /* set the optimum mode for our new total regulator load */ err = rdev->desc->ops->set_load(rdev, current_uA); if (err < 0) rdev_err(rdev, "failed to set load %d\n", current_uA); } else { /* now get the optimum mode for our new total regulator load */ mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV, output_uV, current_uA); /* check the new mode is allowed */ err = regulator_mode_constrain(rdev, &mode); if (err < 0) { rdev_err(rdev, "failed to get optimum mode @ %d uA %d -> %d uV\n", current_uA, input_uV, output_uV); return err; } err = rdev->desc->ops->set_mode(rdev, mode); if (err < 0) rdev_err(rdev, "failed to set optimum mode %x\n", mode); } return err; }
false
false
false
false
false
0
sort_order_cmp(const void *p1, const void *p2) { HeapTuple v1 = *((const HeapTuple *) p1); HeapTuple v2 = *((const HeapTuple *) p2); Form_pg_enum en1 = (Form_pg_enum) GETSTRUCT(v1); Form_pg_enum en2 = (Form_pg_enum) GETSTRUCT(v2); if (en1->enumsortorder < en2->enumsortorder) return -1; else if (en1->enumsortorder > en2->enumsortorder) return 1; else return 0; }
false
false
false
false
false
0