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
encode_DigestREQ(unsigned char *p HEIMDAL_UNUSED_ATTRIBUTE, size_t len HEIMDAL_UNUSED_ATTRIBUTE, const DigestREQ *data, size_t *size) { size_t ret HEIMDAL_UNUSED_ATTRIBUTE = 0; size_t l HEIMDAL_UNUSED_ATTRIBUTE; int i HEIMDAL_UNUSED_ATTRIBUTE, e HEIMDAL_UNUSED_ATTRIBUTE; /* innerReq */ { size_t Top_tag_tag_oldret HEIMDAL_UNUSED_ATTRIBUTE = ret; ret = 0; e = encode_EncryptedData(p, len, &(data)->innerReq, &l); if (e) return e; p -= l; len -= l; ret += l; e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 1, &l); if (e) return e; p -= l; len -= l; ret += l; ret += Top_tag_tag_oldret; } /* apReq */ { size_t Top_tag_tag_oldret HEIMDAL_UNUSED_ATTRIBUTE = ret; ret = 0; e = der_put_octet_string(p, len, &(data)->apReq, &l); if (e) return e; p -= l; len -= l; ret += l; e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, PRIM, UT_OctetString, &l); if (e) return e; p -= l; len -= l; ret += l; e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 0, &l); if (e) return e; p -= l; len -= l; ret += l; ret += Top_tag_tag_oldret; } e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l); if (e) return e; p -= l; len -= l; ret += l; e = der_put_length_and_tag (p, len, ret, ASN1_C_APPL, CONS, 128, &l); if (e) return e; p -= l; len -= l; ret += l; *size = ret; return 0; }
false
false
false
false
false
0
doc_attr(VALUE vself, VALUE vname){ VALUE vdoc; ESTDOC *doc; const char *value; vdoc = rb_iv_get(vself, VNDATA); Data_Get_Struct(vdoc, ESTDOC, doc); Check_Type(vname, T_STRING); value = est_doc_attr(doc, StringValuePtr(vname)); return value ? rb_str_new2(value) : Qnil; }
false
false
false
false
false
0
o_complex_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object) { g_assert( (object->type == OBJ_COMPLEX || object->type == OBJ_PLACEHOLDER) ); o_glist_draw_place (w_current, dx, dy, object->complex->prim_objs); }
false
false
false
false
false
0
vma_resv_map(struct vm_area_struct *vma) { VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); if (vma->vm_flags & VM_MAYSHARE) { struct address_space *mapping = vma->vm_file->f_mapping; struct inode *inode = mapping->host; return inode_resv_map(inode); } else { return (struct resv_map *)(get_vma_private_data(vma) & ~HPAGE_RESV_MASK); } }
false
false
false
false
false
0
evalAttrs(Env & env, Expr * e, Value & v) { eval(env, e, v); if (v.type != tAttrs) throwTypeError("value is %1% while an attribute set was expected", showType(v)); }
false
false
false
false
false
0
gl841_set_buffer_address_gamma (Genesys_Device * dev, uint32_t addr) { SANE_Status status; DBG (DBG_io, "gl841_set_buffer_address_gamma: setting address to 0x%05x\n", addr & 0xfffffff0); addr = addr >> 4; status = sanei_genesys_write_register (dev, 0x5c, (addr & 0xff)); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, "gl841_set_buffer_address_gamma: failed while writing low byte: %s\n", sane_strstatus (status)); return status; } addr = addr >> 8; status = sanei_genesys_write_register (dev, 0x5b, (addr & 0xff)); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, "gl841_set_buffer_address_gamma: failed while writing high byte: %s\n", sane_strstatus (status)); return status; } DBG (DBG_io, "gl841_set_buffer_address_gamma: completed\n"); return status; }
false
false
false
false
false
0
handle_two_side_options () { if (rotate_even_pages) /* Rotate page 180 degrees. */ OUTPUT ((cofp, "180 rotate\n%d %d translate\n", -media->w, -media->h)); if (swap_even_page_margins) OUTPUT ((cofp, "%d 0 translate\n", -(media->llx - (media->w - media->urx)))); }
false
false
false
false
false
0
getbit(FILE * f, h_val bitnum) { long int bytenum = 0L; short int bit_in_byte = 0; unsigned char read_byte = 0x00; unsigned char test_byte = 0x01; int i = 0; bit_in_byte = bitnum % 8; bytenum = APGBFHDRSIZE + (bitnum/8); if (fseek (f, bytenum, SEEK_SET) == -1) return(-1); if (fread ((void*)&read_byte,1,1,f) < 1) if (ferror(f) != 0) return (-1); for (i=0;i < bit_in_byte;i++) test_byte = test_byte*2; if ((read_byte & test_byte) > 0) return (1); else return (0); }
false
false
false
false
false
0
do_setxattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) { struct fuse_setxattr_in *arg = (struct fuse_setxattr_in *) inarg; char *name = PARAM(arg); char *value = name + strlen(name) + 1; if (req->f->op.setxattr) req->f->op.setxattr(req, nodeid, name, value, arg->size, arg->flags); else fuse_reply_err(req, ENOSYS); }
false
false
false
false
false
0
atusb_start(struct ieee802154_hw *hw) { struct atusb *atusb = hw->priv; struct usb_device *usb_dev = atusb->usb_dev; int ret; dev_dbg(&usb_dev->dev, "atusb_start\n"); schedule_delayed_work(&atusb->work, 0); atusb_command(atusb, ATUSB_RX_MODE, 1); ret = atusb_get_and_clear_error(atusb); if (ret < 0) usb_kill_anchored_urbs(&atusb->idle_urbs); return ret; }
false
false
false
false
false
0
QPSolver_verbosity(lua_State *L) { SVQP2 *qp = (SVQP2*)luaT_checkudata(L, 1, QPSolver_id); int verbosity = (int)luaL_checknumber(L, 2); luaL_argcheck(L, verbosity >= 0 && verbosity <= 3, 2, "integer between 0 and 3 expected"); qp->verbosity = verbosity; return 0; }
false
false
false
false
false
0
StrHasPrefix( const char* string, const char* prefix ) { if ( prefix == NULL ) { return 1; } if ( string == NULL ) { return 0; } return strncasecmp( string, prefix, strlen(prefix) ) == 0; }
false
false
false
false
false
0
HPDF_MarkupAnnot_SetRectDiff (HPDF_Annotation annot, HPDF_Rect rect) /* RD entry : this is the difference between Rect and the text annotation rectangle */ { HPDF_Array array; HPDF_STATUS ret = HPDF_OK; HPDF_REAL tmp; HPDF_PTRACE((" HPDF_MarkupAnnot_SetRectDiff\n")); array = HPDF_Array_New ( annot->mmgr); if ( !array) return HPDF_Error_GetCode ( annot->error); if ((ret = HPDF_Dict_Add ( annot, "RD", array)) != HPDF_OK) return ret; if (rect.top < rect.bottom) { tmp = rect.top; rect.top = rect.bottom; rect.bottom = tmp; } ret += HPDF_Array_AddReal (array, rect.left); ret += HPDF_Array_AddReal (array, rect.bottom); ret += HPDF_Array_AddReal (array, rect.right); ret += HPDF_Array_AddReal (array, rect.top); if (ret != HPDF_OK) return HPDF_Error_GetCode (array->error); return HPDF_OK; }
false
false
false
false
false
0
free_query_list(const void *key, void *value, void *unused_udata) { GSList *sl, *list = value; int count = g_slist_length(list); (void) unused_udata; g_warning("remained %d un-freed dynamic quer%s for node #%u", count, count == 1 ? "y" : "ies", GPOINTER_TO_UINT(key)); GM_SLIST_FOREACH(list, sl) { dquery_t *dq = sl->data; dquery_check(dq); /* Don't remove query from the table we're traversing in dq_free() */ dq->flags |= DQ_F_ID_CLEANING; dq_free(dq); } g_slist_free(list); }
false
false
false
false
false
0
CollectDispersion( AllData& alldata ) { bool error= false; /* start runtime measurement for collecting dispersion information */ StartMeasurement( alldata, 1, true, "collect dispersion information" ); /* open OTF file manager and reader */ OTF_FileManager* manager= OTF_FileManager_open( alldata.params.max_file_handles ); assert( manager ); OTF_Reader* reader= OTF_Reader_open( alldata.params.input_file_prefix.c_str(), manager ); assert( reader ); do { #ifdef OTFPROFILE_MPI /* share definitions needed for reading events to workers */ if ( 1 < alldata.numRanks ) { share_profiledata( alldata ); } #endif /* OTFPROFILE_MPI */ /* read data from events */ if ( !alldata.params.read_from_stats ) { VerbosePrint( alldata, 1, true, "reading events for dispersion\n" ); error= !read_events( alldata, reader ); } /* finish progress */ if ( alldata.params.progress ) { finish_progress( alldata ); } #ifdef OTFPROFILE_MPI /* synchronize error indicator with workers */ SyncError( alldata, error ); #endif /* OTFPROFILE_MPI */ } while( false ); /* close OTF file manager and reader */ OTF_Reader_close( reader ); OTF_FileManager_close( manager ); if ( !error ) { /* stop runtime measurement for collecting data */ StopMeasurement( alldata, true, "collect dispersion information" ); } return !error; }
false
false
false
false
false
0
find_a_file (struct path_prefix *pprefix, const char *name, int mode) { char *temp; struct prefix_list *pl; int len = pprefix->max_len + strlen (name) + 1; if (debug) fprintf (stderr, "Looking for '%s'\n", name); #ifdef HOST_EXECUTABLE_SUFFIX len += strlen (HOST_EXECUTABLE_SUFFIX); #endif temp = XNEWVEC (char, len); /* Determine the filename to execute (special case for absolute paths). */ if (IS_ABSOLUTE_PATH (name)) { if (access (name, mode) == 0) { strcpy (temp, name); if (debug) fprintf (stderr, " - found: absolute path\n"); return temp; } #ifdef HOST_EXECUTABLE_SUFFIX /* Some systems have a suffix for executable files. So try appending that. */ strcpy (temp, name); strcat (temp, HOST_EXECUTABLE_SUFFIX); if (access (temp, mode) == 0) return temp; #endif if (debug) fprintf (stderr, " - failed to locate using absolute path\n"); } else for (pl = pprefix->plist; pl; pl = pl->next) { struct stat st; strcpy (temp, pl->prefix); strcat (temp, name); if (stat (temp, &st) >= 0 && ! S_ISDIR (st.st_mode) && access (temp, mode) == 0) return temp; #ifdef HOST_EXECUTABLE_SUFFIX /* Some systems have a suffix for executable files. So try appending that. */ strcat (temp, HOST_EXECUTABLE_SUFFIX); if (stat (temp, &st) >= 0 && ! S_ISDIR (st.st_mode) && access (temp, mode) == 0) return temp; #endif } if (debug && pprefix->plist == NULL) fprintf (stderr, " - failed: no entries in prefix list\n"); free (temp); return 0; }
false
false
false
false
false
0
photo(screen& scr, const Camera& mycam, const pen_data& line, const pen_data& under) const { arrow_data tmp_data(*this); if (mycam.needs_clip()) tmp_data.clip_to(mycam.clip_plane()); std::list<edge2d> edges; for (std::list<edge3d>::const_iterator p=tmp_data.m_shaft.begin(); p != tmp_data.m_shaft.end(); ++p) { edge2d tmp(mycam((*p).tail()), mycam((*p).head()), (*p).is_seen()); if (!tmp.is_null()) // endpoints not equal edges.push_back(tmp); } // draw shaft scr.m_screen->add_tile(pen_line(line.seen_through(mycam), under.seen_through(mycam), edges)); // and arrowhead if (m_head_seen) { const P dir(m_tip-m_base); const P to_cam(mycam.viewpt()-m_base); const double sin_th(norm(dir*to_cam)/(norm(dir)*norm(to_cam))); scr.m_screen->add_tile(pen_arrow(mycam(m_base), mycam(m_tip), line.seen_through(mycam), under.seen_through(mycam), m_scale, sin_th, m_head_seen)); } }
false
false
false
false
false
0
drawString(const char *str) { glPushMatrix(); glPushMatrix(); while(*str != '\0') { if(*str == '\n') { glPopMatrix(); glTranslatef(0.0, 1.0, 0.0); glPushMatrix(); } else { drawChar(*str); glTranslatef(1.0, 0.0, 0.0); } str++; } glPopMatrix(); glPopMatrix(); }
false
false
false
false
false
0
ExCopyright (int p) { if (p) { write (fileno (stdout), DXD_COPYRIGHT_STRING, strlen (DXD_COPYRIGHT_STRING)); write (fileno (stdout), "\n", 1); } }
false
false
false
false
false
0
create_client (void) { int32_t id; for (id = 0; id < vis->clientc; ++id) { if (!vis->clientv[id]) { break; } } if (id == vis->clientc) { vis->clientc++; } vis->clientv = g_renew (xmms_vis_client_t*, vis->clientv, vis->clientc); if (!vis->clientv || (!(vis->clientv[id] = g_new (xmms_vis_client_t, 1)))) { vis->clientc = 0; id = -1; } xmms_log_info ("Attached visualization client %d", id); return id; }
false
false
false
false
false
0
ixgb_get_bus_info(struct ixgb_hw *hw) { u32 status_reg; status_reg = IXGB_READ_REG(hw, STATUS); hw->bus.type = (status_reg & IXGB_STATUS_PCIX_MODE) ? ixgb_bus_type_pcix : ixgb_bus_type_pci; if (hw->bus.type == ixgb_bus_type_pci) { hw->bus.speed = (status_reg & IXGB_STATUS_PCI_SPD) ? ixgb_bus_speed_66 : ixgb_bus_speed_33; } else { switch (status_reg & IXGB_STATUS_PCIX_SPD_MASK) { case IXGB_STATUS_PCIX_SPD_66: hw->bus.speed = ixgb_bus_speed_66; break; case IXGB_STATUS_PCIX_SPD_100: hw->bus.speed = ixgb_bus_speed_100; break; case IXGB_STATUS_PCIX_SPD_133: hw->bus.speed = ixgb_bus_speed_133; break; default: hw->bus.speed = ixgb_bus_speed_reserved; break; } } hw->bus.width = (status_reg & IXGB_STATUS_BUS64) ? ixgb_bus_width_64 : ixgb_bus_width_32; }
false
false
false
false
false
0
gda_sql_operation_copy (GdaSqlOperation *operation) { GdaSqlOperation *copy; GSList *list; if (!operation) return NULL; copy = gda_sql_operation_new (NULL); copy->operator_type = operation->operator_type; for (list = operation->operands; list; list = list->next) { copy->operands = g_slist_prepend (copy->operands, gda_sql_expr_copy ((GdaSqlExpr*) list->data)); gda_sql_any_part_set_parent (copy->operands->data, copy); } copy->operands = g_slist_reverse (copy->operands); return copy; }
false
false
false
false
false
0
setStyle(RenderStyle *_style) { RenderBox::setStyle(_style); const QFontMetrics &fm = style()->fontMetrics(); QRect xSize= fm.boundingRect('x'); m_height = xSize.height(); m_width = xSize.width(); switch(m_type) { // Glyphs: case LDISC: case LCIRCLE: case LSQUARE: case LBOX: case LDIAMOND: case LNONE: break; default: // not a glyph ! assert(false); break; } }
false
false
false
false
false
0
lad_sm_change_array_inner_operand(Operand *ope, int dim, SemTree *new_sem) { Operand *new_op, *prev_op, *next_op; new_op = get_new_op_var(semtree_to_scalar(new_sem)); if (dim != 0) { prev_op = lad_sm_get_dim_array_operand(ope, dim-1); next_op = lad_sm_get_dim_array_operand(ope, dim+1); prev_op->next = new_op; new_op->next = next_op; } else { next_op = lad_sm_get_dim_array_operand(ope, dim+1); ope->inner = new_op; new_op->next = next_op; } return ; }
false
false
false
false
false
0
get_dominated_to_depth (enum cdi_direction dir, basic_block bb, int depth) { vec<basic_block> bbs = vNULL; unsigned i; unsigned next_level_start; i = 0; bbs.safe_push (bb); next_level_start = 1; /* = bbs.length (); */ do { basic_block son; bb = bbs[i++]; for (son = first_dom_son (dir, bb); son; son = next_dom_son (dir, son)) bbs.safe_push (son); if (i == next_level_start && --depth) next_level_start = bbs.length (); } while (i < next_level_start); return bbs; }
false
false
false
false
false
0
scanIdent(Accessor &styler, int pos, WordList &keywords) { char buf[100]; /* copy to lowercase and ignore underscores */ int i = 0; for (;;) { char ch = styler.SafeGetCharAt(pos, '\0'); if (!IsAWordChar(ch)) break; if (ch != '_' && i < ((int)sizeof(buf))-1) { buf[i] = static_cast<char>(tolower(ch)); i++; } pos++; } buf[i] = '\0'; /* look for keyword */ if (keywords.InList(buf)) { styler.ColourTo(pos-1, SCE_P_WORD); } else { styler.ColourTo(pos-1, SCE_P_IDENTIFIER); } return pos; }
false
false
false
false
false
0
mptspi_initTarget(MPT_SCSI_HOST *hd, VirtTarget *vtarget, struct scsi_device *sdev) { /* Is LUN supported? If so, upper 2 bits will be 0 * in first byte of inquiry data. */ if (sdev->inq_periph_qual != 0) return; if (vtarget == NULL) return; vtarget->type = sdev->type; if ((sdev->type == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) { /* Treat all Processors as SAF-TE if * command line option is set */ vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); }else if ((sdev->type == TYPE_PROCESSOR) && !(vtarget->tflags & MPT_TARGET_FLAGS_SAF_TE_ISSUED )) { if (sdev->inquiry_len > 49 ) { if (sdev->inquiry[44] == 'S' && sdev->inquiry[45] == 'A' && sdev->inquiry[46] == 'F' && sdev->inquiry[47] == '-' && sdev->inquiry[48] == 'T' && sdev->inquiry[49] == 'E' ) { vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); } } } mptspi_setTargetNegoParms(hd, vtarget, sdev); }
false
false
false
false
false
0
flush () { if (good () && rdbuf ()) { if (rdbuf ()->pubsync () == EOF) { setstate (badbit); } } return (*this); }
false
false
false
false
false
0
splash_create (gchar* filename, int duration) { GtkWidget *vbox; GdkPixbuf *pixbuf = NULL; // GdkAtom atom; win_initstatus = gtk_window_new (GTK_WINDOW_TOPLEVEL); #if 0 /* Not needed in these WMs: enlightenment, sawfish, metacity, fvwm2, wmaker */ gtk_window_set_type_hint (GTK_WINDOW (win_initstatus), GDK_WINDOW_TYPE_HINT_DIALOG); #endif gtk_window_set_title (GTK_WINDOW (win_initstatus), filename); gtk_window_set_wmclass (GTK_WINDOW (win_initstatus), "hotkeys_splash", "Hotkeys"); gtk_window_set_position (GTK_WINDOW (win_initstatus), GTK_WIN_POS_CENTER); gtk_window_set_resizable (GTK_WINDOW (win_initstatus), FALSE); gtk_window_set_modal (GTK_WINDOW (win_initstatus), TRUE); gtk_window_set_policy(GTK_WINDOW(win_initstatus), FALSE, FALSE, TRUE); gtk_widget_realize(win_initstatus); gdk_window_set_decorations(win_initstatus->window, 0); #if 0 /* Not needed in these WMs: enlightenment, sawfish, metacity, fvwm2, wmaker */ atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_SPLASH", FALSE); gdk_property_change (win_initstatus->window, gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE), (GdkAtom)XA_ATOM, 32, GDK_PROP_MODE_REPLACE, (unsigned char *)&atom, 1); #endif g_signal_connect (G_OBJECT (win_initstatus), "delete_event", G_CALLBACK (gtk_true), NULL); vbox = gtk_vbox_new (FALSE, 4); gtk_container_add (GTK_CONTAINER (win_initstatus), vbox); gtk_widget_show (vbox); pixbuf = gdk_pixbuf_new_from_file (filename, NULL); if (pixbuf) { GtkWidget *align; GtkWidget *image; image = gtk_image_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, TRUE, 0); gtk_widget_show (align); gtk_container_add (GTK_CONTAINER (align), image); gtk_widget_show (image); } else { g_message("Cannot open image"); return; } /* label1 = gtk_label_new (""); gtk_box_pack_start_defaults (GTK_BOX (vbox), label1); gtk_widget_show (label1); label2 = gtk_label_new (""); gtk_box_pack_start_defaults (GTK_BOX (vbox), label2); gtk_widget_show (label2); progress = gtk_progress_bar_new (); gtk_box_pack_start_defaults (GTK_BOX (vbox), progress); gtk_widget_show (progress); */ gtk_widget_show (win_initstatus); gtk_timeout_add( duration, splash_destroy, NULL); }
false
false
false
false
false
0
cmp (double_int b, bool uns) const { if (uns) return this->ucmp (b); else return this->scmp (b); }
false
false
false
false
false
0
input_dev_uevent(struct device *device, struct kobj_uevent_env *env) { struct input_dev *dev = to_input_dev(device); INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); if (dev->name) INPUT_ADD_HOTPLUG_VAR("NAME=\"%s\"", dev->name); if (dev->phys) INPUT_ADD_HOTPLUG_VAR("PHYS=\"%s\"", dev->phys); if (dev->uniq) INPUT_ADD_HOTPLUG_VAR("UNIQ=\"%s\"", dev->uniq); INPUT_ADD_HOTPLUG_BM_VAR("PROP=", dev->propbit, INPUT_PROP_MAX); INPUT_ADD_HOTPLUG_BM_VAR("EV=", dev->evbit, EV_MAX); if (test_bit(EV_KEY, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("KEY=", dev->keybit, KEY_MAX); if (test_bit(EV_REL, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("REL=", dev->relbit, REL_MAX); if (test_bit(EV_ABS, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("ABS=", dev->absbit, ABS_MAX); if (test_bit(EV_MSC, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("MSC=", dev->mscbit, MSC_MAX); if (test_bit(EV_LED, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("LED=", dev->ledbit, LED_MAX); if (test_bit(EV_SND, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("SND=", dev->sndbit, SND_MAX); if (test_bit(EV_FF, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("FF=", dev->ffbit, FF_MAX); if (test_bit(EV_SW, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev); return 0; }
false
false
false
false
false
0
RefreshPortMappings() { for ( PortMappingMap::iterator it = m_ActivePortMappingsMap.begin(); it != m_ActivePortMappingsMap.end(); ++it) { PrivateAddPortMapping(it->second); } // For testing m_WanService->GetStateVariable("PortMappingNumberOfEntries"); }
false
false
false
false
false
0
strbuf_free(strbuf_t *s) { debug_stats(s); if (s->buf) { free(s->buf); s->buf = NULL; } if (s->dynamic) free(s); }
false
false
false
false
false
0
st_seek (SCM port, off_t offset, int whence) { scm_t_port *pt = SCM_PTAB_ENTRY (port); off_t target; if (pt->rw_active == SCM_PORT_READ && offset == 0 && whence == SEEK_CUR) /* special case to avoid disturbing the unread-char buffer. */ { if (pt->read_buf == pt->putback_buf) { target = pt->saved_read_pos - pt->saved_read_buf - (pt->read_end - pt->read_pos); } else { target = pt->read_pos - pt->read_buf; } } else /* all other cases. */ { if (pt->rw_active == SCM_PORT_WRITE) st_flush (port); if (pt->rw_active == SCM_PORT_READ) scm_end_input (port); switch (whence) { case SEEK_CUR: target = pt->read_pos - pt->read_buf + offset; break; case SEEK_END: target = pt->read_end - pt->read_buf + offset; break; default: /* SEEK_SET */ target = offset; break; } if (target < 0) scm_misc_error ("st_seek", "negative offset", SCM_EOL); if (target >= pt->write_buf_size) { if (!(SCM_CELL_WORD_0 (port) & SCM_WRTNG)) { if (target > pt->write_buf_size) { scm_misc_error ("st_seek", "seek past end of read-only strport", SCM_EOL); } } else { st_resize_port (pt, target + (target == pt->write_buf_size ? SCM_WRITE_BLOCK : 0)); } } pt->read_pos = pt->write_pos = pt->read_buf + target; if (pt->read_pos > pt->read_end) { pt->read_end = (unsigned char *) pt->read_pos; pt->read_buf_size = pt->read_end - pt->read_buf; } } return target; }
false
false
false
false
false
0
start ( int x, int y ) { if ( scope == 3 ) { got = need; if ( got > actmap->bi_resource[player].resource( resourcetype ) ) got = actmap->bi_resource[player].resource( resourcetype ); if ( !queryonly ) actmap->bi_resource[player].resource( resourcetype ) -= got; if ( resourcetype == 0 ) searchAllVehiclesNextToBuildings ( player ); } else MapNetwork :: start ( x, y ); }
false
false
false
false
false
0
orte_info_do_params(bool want_all_in, bool want_internal) { int count; char *type, *component, *str; bool found; int i; bool want_all = false; orte_info_components_open(); if (want_all_in) { want_all = true; } else { /* See if the special param "all" was givin to --param; that * superceeds any individual type */ count = opal_cmd_line_get_ninsts(orte_info_cmd_line, "param"); for (i = 0; i < count; ++i) { type = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 0); if (0 == strcmp(orte_info_type_all, type)) { want_all = true; break; } } } /* Show the params */ if (want_all) { for (i = 0; i < mca_types.size; ++i) { if (NULL == (type = (char *)opal_pointer_array_get_item(&mca_types, i))) { continue; } orte_info_show_mca_params(type, orte_info_component_all, want_internal); } } else { for (i = 0; i < count; ++i) { type = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 0); component = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 1); for (found = false, i = 0; i < mca_types.size; ++i) { if (NULL == (str = (char *)opal_pointer_array_get_item(&mca_types, i))) { continue; } if (0 == strcmp(str, type)) { found = true; break; } } if (!found) { char *usage = opal_cmd_line_get_usage_msg(orte_info_cmd_line); orte_show_help("help-orte-info.txt", "not-found", true, type); free(usage); exit(1); } orte_info_show_mca_params(type, component, want_internal); } } }
false
false
false
false
false
0
ganv_box_point(GanvItem* item, double x, double y, int cx, int cy, GanvItem** actual_item) { GanvBox* box = GANV_BOX(item); GanvBoxImpl* impl = box->impl; *actual_item = NULL; double x1, y1, x2, y2; ganv_box_bounds_item(&impl->coords, &x1, &y1, &x2, &y2); // Point is inside the box (distance 0) if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) { *actual_item = item; return 0.0; } // Point is outside the box double dx = 0.0; double dy = 0.0; // Find horizontal distance to nearest edge if (x < x1) { dx = x1 - x; } else if (x > x2) { dx = x - x2; } // Find vertical distance to nearest edge if (y < y1) { dy = y1 - y; } else if (y > y2) { dy = y - y2; } return sqrt((dx * dx) + (dy * dy)); }
false
false
false
false
false
0
k5_asn1_encode_bytestring(asn1buf *buf, unsigned char *const *val, size_t len, size_t *len_out) { if (len > 0 && val == NULL) return ASN1_MISSING_FIELD; *len_out = len; return asn1buf_insert_octetstring(buf, len, *val); }
false
false
false
false
false
0
cma_save_req_info(const struct ib_cm_event *ib_event, struct cma_req_info *req) { const struct ib_cm_req_event_param *req_param = &ib_event->param.req_rcvd; const struct ib_cm_sidr_req_event_param *sidr_param = &ib_event->param.sidr_req_rcvd; switch (ib_event->event) { case IB_CM_REQ_RECEIVED: req->device = req_param->listen_id->device; req->port = req_param->port; memcpy(&req->local_gid, &req_param->primary_path->sgid, sizeof(req->local_gid)); req->has_gid = true; req->service_id = req_param->primary_path->service_id; req->pkey = be16_to_cpu(req_param->primary_path->pkey); break; case IB_CM_SIDR_REQ_RECEIVED: req->device = sidr_param->listen_id->device; req->port = sidr_param->port; req->has_gid = false; req->service_id = sidr_param->service_id; req->pkey = sidr_param->pkey; break; default: return -EINVAL; } return 0; }
false
false
false
false
false
0
startBlockingModDir(request_rec *r) { RequestNote *note = getRequestNote(r); if (note != 0 && hasModDir()) { note->oldFileType = r->finfo.filetype; r->finfo.filetype = APR_NOFILE; } return DECLINED; }
false
false
false
false
false
0
_get_max_gsync_slave_num (dict_t *this, char *key, data_t *value, void *data) { int tmp_slvnum = 0; int *slvnum = (int *)data; sscanf (key, "slave%d", &tmp_slvnum); if (tmp_slvnum > *slvnum) *slvnum = tmp_slvnum; }
false
false
false
false
false
0
execute() { Threadlist::desc("Web interface"); // Create the server socket, or retry infinitely. // This is maybe a too big precaution - previous xr's are responsible // for killing off their web interfaces. But we don't want a new xr // start to croak and cause downtime just because the web interface, // so we just retry for a bit. while (true) { try { msg ("Starting web interface\n"); sfd = serversocket (config.webinterfaceip(), config.webinterfaceport(), "web interface", Servertype::t_tcp); } catch (Error const &e) { cerr << e.what() << "(webinterface, retrying in a sec)\n"; sleep (1); continue; } break; } msg ((Mstr("Web interface started on socket ") + sfd) + "\n"); while (!balancer.terminate()) { try { Fdset fdset(0); fdset.add (sfd); fdset.wait_r(); if (fdset.readable(sfd)) { int size; struct sockaddr_in clname; if ( (cfd = accept (sfd, (struct sockaddr *) &clname, (socklen_t *)&size)) < 0 ) warnmsg(Mstr("Web interface: failed to accept " "network connection: ") + Mstr(strerror(errno)) + "\n"); else { serve (); socketclose(cfd); } } } catch (Error const &e) { cerr << e.what() << " (webinterface)\n"; ostringstream m; m << "<h1>Web interface error</h1>\n" "XR's web interface could not handle your request.<p/>\n" "<i>" << e.what() << "</i>\n"; ostringstream o; o << "HTTP/1.0 500 Server Error\r\n" "X-Reason: " << e.what() << "\r\n" "Content-Length: " << m.str().length() << "\r\n" "\r\n" << m.str(); Netbuffer buf(o.str()); buf.netwrite(cfd, config.client_write_timeout()); socketclose(cfd); } } msg ("Web interface stopping.\n"); socketclose(sfd); }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__gui__controls__EditBox_SelectAll(struct __ecereNameSpace__ecere__com__Instance * this) { struct __ecereNameSpace__ecere__gui__controls__EditBox * __ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox = (struct __ecereNameSpace__ecere__gui__controls__EditBox *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gui__controls__EditBox->offset) : 0); __ecereMethod___ecereNameSpace__ecere__gui__controls__EditBox_Select(this, __ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->lines.first, 0, 0, __ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->lines.last, __ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->lines.count - 1, strlen(((struct __ecereNameSpace__ecere__gui__controls__EditLine *)__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->lines.last)->buffer)); }
false
false
false
true
false
1
ast_duplicate_ha(struct ast_ha *original) { struct ast_ha *new_ha; if ((new_ha = ast_calloc(1, sizeof(*new_ha)))) { /* Copy from original to new object */ ast_copy_ha(original, new_ha); } return new_ha; }
false
false
false
false
false
0
irecv_send_command_raw(irecv_client_t client, char* command) { unsigned int length = (unsigned int) strlen(command); if (length >= 0x100) { length = 0xFF; } if (length > 0) { int ret = irecv_control_transfer(client, 0x40, 0, 0, 0, (unsigned char*) command, length + 1, 1000); ret = IRECV_E_SUCCESS; // ignored } return IRECV_E_SUCCESS; }
false
false
false
false
false
0
ctm_mult_by_limited(uint64_t *result, int64_t *input) { int i; for (i = 0; i < 9; i++) result[i] = 0; for (i = 0; i < 3; i++) { int64_t user_coeff = input[i * 3 + i]; uint64_t limited_coeff = CTM_COEFF_LIMITED_RANGE >> 2; uint64_t abs_coeff = clamp_val(CTM_COEFF_ABS(user_coeff), 0, CTM_COEFF_4_0 - 1) >> 2; result[i * 3 + i] = (limited_coeff * abs_coeff) >> 27; if (CTM_COEFF_NEGATIVE(user_coeff)) result[i * 3 + i] |= CTM_COEFF_SIGN; } }
false
false
false
false
false
0
open_sock() { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s == -1) g_error("Unable to create socket"); struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(DEFAULT_PORT); addr.sin_addr.s_addr = INADDR_ANY; if (bind(s, (struct sockaddr*)&addr, sizeof(addr)) == -1) g_error("bind failed"); return s; }
false
false
false
false
false
0
netsnmp_find_table_array_handler(netsnmp_handler_registration *reginfo) { netsnmp_mib_handler *mh; if (!reginfo) return NULL; mh = reginfo->handler; while (mh) { if (mh->access_method == netsnmp_table_array_helper_handler) break; mh = mh->next; } return mh; }
false
false
false
false
false
0
gtkon_token_xmlfilteredchar (GtkonToken* self, guchar ch) { gchar* result = NULL; guchar _tmp0_; guchar _tmp4_; gchar* _tmp5_ = NULL; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = ch; switch (_tmp0_) { case '<': { gchar* _tmp1_; _tmp1_ = g_strdup ("&lt;"); result = _tmp1_; return result; } case '>': { gchar* _tmp2_; _tmp2_ = g_strdup ("&gt;"); result = _tmp2_; return result; } case '&': { gchar* _tmp3_; _tmp3_ = g_strdup ("&amp;"); result = _tmp3_; return result; } default: break; } _tmp4_ = ch; _tmp5_ = g_strdup_printf ("%c", (gint) _tmp4_); result = _tmp5_; return result; }
false
false
false
false
false
0
aspect_to_info(MpegEncContext * s, AVRational aspect){ int i; if(aspect.num==0) aspect= (AVRational){1,1}; for(i=1; i<6; i++){ if(av_cmp_q(pixel_aspect[i], aspect) == 0){ s->aspect_ratio_info=i; return; } } s->aspect_ratio_info= FF_ASPECT_EXTENDED; }
false
false
false
false
false
0
name_and_src_coords_attributes (decl) tree decl; { tree decl_name = DECL_NAME (decl); if (decl_name && IDENTIFIER_POINTER (decl_name)) { name_attribute (IDENTIFIER_POINTER (decl_name)); #ifdef DWARF_DECL_COORDINATES { register unsigned file_index; /* This is annoying, but we have to pop out of the .debug section for a moment while we call `lookup_filename' because calling it may cause a temporary switch into the .debug_sfnames section and most svr4 assemblers are not smart enough to be able to nest section switches to any depth greater than one. Note that we also can't skirt this issue by delaying all output to the .debug_sfnames section unit the end of compilation because that would cause us to have inter-section forward references and Fred Fish sez that m68k/svr4 assemblers botch those. */ ASM_OUTPUT_POP_SECTION (asm_out_file); file_index = lookup_filename (DECL_SOURCE_FILE (decl)); ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION); src_coords_attribute (file_index, DECL_SOURCE_LINE (decl)); } #endif /* defined(DWARF_DECL_COORDINATES) */ } }
false
false
false
false
false
0
zx_hexdec(char* dst, char* src, int src_len, const unsigned char* trans) { const unsigned char* hi; const unsigned char* lo; for (; src_len>1; src_len-=2, ++dst, src+=2) { hi = (const unsigned char*)strchr((char*)trans, src[0]); if (!hi) { ERR("Bad hi character(%x) in hex string using trans(%s) len left=%d src(%.*s)", src[0], trans, src_len, src_len, src); hi = trans; } lo = (const unsigned char*)strchr((char*)trans, src[1]); if (!lo) { ERR("Bad lo character(%x) in hex string using trans(%s) len left=%d src(%.*s)", src[1], trans, src_len, src_len, src); lo = trans; } *dst = ((hi-trans) << 4) | (lo-trans); } return dst; }
false
false
false
false
false
0
fstate_src_architecture_times_clone(fstate_src_architecture_times_ty *this_thing) { if (!this_thing) return 0; trace(("fstate_src_architecture_times_clone()\n{\n")); fstate_src_architecture_times_ty *result = (fstate_src_architecture_times_ty *)fstate_src_architecture_times_alloc(); result->variant = str_copy(this_thing->variant); result->test_time = this_thing->test_time; result->test_baseline_time = this_thing->test_baseline_time; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; }
false
false
false
false
false
0
notify(const QByteArray& statusLine) { bool ret = true; if (statusLine.startsWith("MIPS=")) { double d = atof(statusLine.data()+5); if (d > mMipsHWM) { mMipsHWM = d; std::stringstream ss; ss << "High Water Mark:" << d; mMips->setToolTip(ss.str().c_str()); } mMips->display(d); } //3.07 :STATUS=CPU0000 PSW=00000000 00000000 0000000000000000 M....... instcount=0 else ret = false; return ret; }
false
false
false
false
false
0
FL_think (edict_t * self) { vec3_t start, end, endp, offset; vec3_t forward, right, up; vec3_t angles; trace_t tr; int height = 0; /*vec3_t start,end,endp,offset; vec3_t forward,right,up; trace_t tr; */ //AngleVectors (self->owner->client->v_angle, forward, right, up); VectorAdd (self->owner->client->v_angle, self->owner->client->kick_angles, angles); AngleVectors ( /*self->owner->client->v_angle */ angles, forward, right, up); /* VectorSet(offset,24 , 6, self->owner->viewheight-7); G_ProjectSource (self->owner->s.origin, offset, forward, right, start); VectorMA(start,8192,forward,end); tr = gi.trace (start,NULL,NULL, end,self->owner,CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_DEADMONSTER); if (tr.fraction != 1) { VectorMA(tr.endpos,-4,forward,endp); VectorCopy(endp,tr.endpos); } if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client)) { if ((tr.ent->takedamage) && (tr.ent != self->owner)) { self->s.skinnum = 1; } } else self->s.skinnum = 0; vectoangles(tr.plane.normal,self->s.angles); VectorCopy(tr.endpos,self->s.origin); gi.linkentity (self); self->nextthink = level.time + 0.1; */ if (self->owner->client->pers.firing_style == ACTION_FIRING_CLASSIC) height = 8; VectorSet (offset, 24, 8, self->owner->viewheight - height); P_ProjectSource (self->owner->client, self->owner->s.origin, offset, forward, right, start); VectorMA (start, 8192, forward, end); PRETRACE (); tr = gi.trace (start, NULL, NULL, end, self->owner, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); POSTTRACE (); if (tr.fraction != 1) { VectorMA (tr.endpos, -4, forward, endp); VectorCopy (endp, tr.endpos); } vectoangles (tr.plane.normal, self->s.angles); VectorCopy (tr.endpos, self->s.origin); gi.linkentity (self); self->nextthink = level.time + 0.1; }
false
false
false
false
false
0
cache_evict_entries(git_cache *cache) { uint32_t seed = rand(); size_t evict_count = 8; ssize_t evicted_memory = 0; /* do not infinite loop if there's not enough entries to evict */ if (evict_count > kh_size(cache->map)) { clear_cache(cache); return; } while (evict_count > 0) { khiter_t pos = seed++ % kh_end(cache->map); if (kh_exist(cache->map, pos)) { git_cached_obj *evict = kh_val(cache->map, pos); evict_count--; evicted_memory += evict->size; git_cached_obj_decref(evict); kh_del(oid, cache->map, pos); } } cache->used_memory -= evicted_memory; git_atomic_ssize_add(&git_cache__current_storage, -evicted_memory); }
false
false
false
false
false
0
source_registry_call_authenticate_for_source (ESourceRegistry *registry, ESourceAuthenticator *auth, ESource *source, gchar **out_object_path, GCancellable *cancellable, GError **error) { ESource *collection; const gchar *uid; gchar *prompt_title = NULL; gchar *prompt_message = NULL; gchar *prompt_description = NULL; GError *local_error = NULL; g_object_ref (source); /* If the source is a member of a collection, we want to store * the password under the UID of the "collection" source so it * will apply to the entire collection. * * XXX This assumes all sources in a collection share a single * password. If that turns out not to be true in all cases * we could maybe add a "SharedPassword: true/false" key to * [Collection] and apply it here. * * Addendum: Assumption proven wrong. GOA's generic IMAP/SMTP * provider uses a plain ECollectionBackend (backend * name "none") with separately stored passwords for * IMAP vs SMTP. Just handle this case directly for * now, but don't rule out the "SharedPassword" idea. */ collection = e_source_registry_find_extension ( registry, source, E_SOURCE_EXTENSION_COLLECTION); if (collection != NULL) { ESourceBackend *extension; gchar *backend_name; extension = e_source_get_extension ( collection, E_SOURCE_EXTENSION_COLLECTION); backend_name = e_source_backend_dup_backend_name (extension); if (g_strcmp0 (backend_name, "none") != 0) { g_object_unref (source); source = g_object_ref (collection); } g_free (backend_name); g_object_unref (collection); } uid = e_source_get_uid (source); e_source_authenticator_get_prompt_strings ( auth, source, &prompt_title, &prompt_message, &prompt_description); e_dbus_source_manager_call_authenticate_sync ( registry->priv->dbus_source_manager, uid, prompt_title, prompt_message, prompt_description, out_object_path, cancellable, &local_error); g_free (prompt_title); g_free (prompt_message); g_free (prompt_description); g_object_unref (source); if (local_error != NULL) { g_dbus_error_strip_remote_error (local_error); g_propagate_error (error, local_error); return FALSE; } return TRUE; }
false
false
false
false
false
0
readSWFMatrix(SWFStream& in) { in.align(); in.ensureBits(1); const bool has_scale = in.read_bit(); boost::int32_t sx = 65536; boost::int32_t sy = 65536; if (has_scale) { in.ensureBits(5); const boost::uint8_t scale_nbits = in.read_uint(5); in.ensureBits(scale_nbits * 2); sx = in.read_sint(scale_nbits); sy = in.read_sint(scale_nbits); } in.ensureBits(1); const bool has_rotate = in.read_bit(); boost::int32_t shx = 0; boost::int32_t shy = 0; if (has_rotate) { in.ensureBits(5); int rotate_nbits = in.read_uint(5); in.ensureBits(rotate_nbits * 2); shx = in.read_sint(rotate_nbits); shy = in.read_sint(rotate_nbits); } in.ensureBits(5); const boost::uint8_t translate_nbits = in.read_uint(5); boost::int32_t tx = 0; boost::int32_t ty = 0; if (translate_nbits) { in.ensureBits(translate_nbits * 2); tx = in.read_sint(translate_nbits); ty = in.read_sint(translate_nbits); } return SWFMatrix(sx, shx, shy, sy, tx, ty); }
false
false
false
false
false
0
eps_dbg_show(struct seq_file *s, void *p) { struct pxa_udc *udc = s->private; struct pxa_ep *ep; int i; u32 tmp; if (!udc->driver) return -ENODEV; ep = &udc->pxa_ep[0]; tmp = udc_ep_readl(ep, UDCCSR); seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n", tmp, (tmp & UDCCSR0_SA) ? " sa" : "", (tmp & UDCCSR0_RNE) ? " rne" : "", (tmp & UDCCSR0_FST) ? " fst" : "", (tmp & UDCCSR0_SST) ? " sst" : "", (tmp & UDCCSR0_DME) ? " dme" : "", (tmp & UDCCSR0_IPR) ? " ipr" : "", (tmp & UDCCSR0_OPC) ? " opc" : ""); for (i = 0; i < NR_PXA_ENDPOINTS; i++) { ep = &udc->pxa_ep[i]; tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); seq_printf(s, "%-12s: IN %lu(%lu reqs), OUT %lu(%lu reqs), irqs=%lu, udccr=0x%08x, udccsr=0x%03x, udcbcr=%d\n", EPNAME(ep), ep->stats.in_bytes, ep->stats.in_ops, ep->stats.out_bytes, ep->stats.out_ops, ep->stats.irqs, tmp, udc_ep_readl(ep, UDCCSR), udc_ep_readl(ep, UDCBCR)); } return 0; }
false
false
false
false
false
0
AssumeRepresentation(Representation r) { if (CheckFlag(kFlexibleRepresentation)) { ChangeRepresentation(r); // The representation of the value is dictated by type feedback and // will not be changed later. ClearFlag(kFlexibleRepresentation); } }
false
false
false
false
false
0
render() { const StateImagery* imagery; // get WidgetLookFeel for the assigned look. const WidgetLookFeel& wlf = getLookNFeel(); // try and get imagery for our current state imagery = &wlf.getStateImagery(d_window->isDisabled() ? "Disabled" : "Enabled"); // peform the rendering operation. imagery->render(*d_window); }
false
false
false
false
false
0
aarch64_get_condition_code (rtx x) { enum machine_mode mode = GET_MODE (XEXP (x, 0)); enum rtx_code comp_code = GET_CODE (x); if (GET_MODE_CLASS (mode) != MODE_CC) mode = SELECT_CC_MODE (comp_code, XEXP (x, 0), XEXP (x, 1)); switch (mode) { case CCFPmode: case CCFPEmode: switch (comp_code) { case GE: return AARCH64_GE; case GT: return AARCH64_GT; case LE: return AARCH64_LS; case LT: return AARCH64_MI; case NE: return AARCH64_NE; case EQ: return AARCH64_EQ; case ORDERED: return AARCH64_VC; case UNORDERED: return AARCH64_VS; case UNLT: return AARCH64_LT; case UNLE: return AARCH64_LE; case UNGT: return AARCH64_HI; case UNGE: return AARCH64_PL; default: gcc_unreachable (); } break; case CCmode: switch (comp_code) { case NE: return AARCH64_NE; case EQ: return AARCH64_EQ; case GE: return AARCH64_GE; case GT: return AARCH64_GT; case LE: return AARCH64_LE; case LT: return AARCH64_LT; case GEU: return AARCH64_CS; case GTU: return AARCH64_HI; case LEU: return AARCH64_LS; case LTU: return AARCH64_CC; default: gcc_unreachable (); } break; case CC_SWPmode: case CC_ZESWPmode: case CC_SESWPmode: switch (comp_code) { case NE: return AARCH64_NE; case EQ: return AARCH64_EQ; case GE: return AARCH64_LE; case GT: return AARCH64_LT; case LE: return AARCH64_GE; case LT: return AARCH64_GT; case GEU: return AARCH64_LS; case GTU: return AARCH64_CC; case LEU: return AARCH64_CS; case LTU: return AARCH64_HI; default: gcc_unreachable (); } break; case CC_NZmode: switch (comp_code) { case NE: return AARCH64_NE; case EQ: return AARCH64_EQ; case GE: return AARCH64_PL; case LT: return AARCH64_MI; default: gcc_unreachable (); } break; case CC_Zmode: switch (comp_code) { case NE: return AARCH64_NE; case EQ: return AARCH64_EQ; default: gcc_unreachable (); } break; default: gcc_unreachable (); break; } }
false
false
false
false
false
0
hibit(unsigned int x) { unsigned int res = 0; while (x > 0xff) { x >>= 8; res += 8; } while (x) { x >>= 1; res += 1; } return res; }
false
false
false
false
false
0
test_equal () { MetaRectangle a = {10, 12, 4, 18}; MetaRectangle b = a; MetaRectangle c = {10, 12, 4, 19}; MetaRectangle d = {10, 12, 7, 18}; MetaRectangle e = {10, 62, 4, 18}; MetaRectangle f = {27, 12, 4, 18}; g_assert ( meta_rectangle_equal (&a, &b)); g_assert (!meta_rectangle_equal (&a, &c)); g_assert (!meta_rectangle_equal (&a, &d)); g_assert (!meta_rectangle_equal (&a, &e)); g_assert (!meta_rectangle_equal (&a, &f)); printf ("%s passed.\n", G_STRFUNC); }
false
false
false
false
false
0
AddIncludeFlags(std::string& flags, const char* lang) { std::string responseVar = "CMAKE_"; responseVar += lang; responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES"; bool useResponseFile = this->Makefile->IsOn(responseVar.c_str()); std::vector<std::string> includes; const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, lang, config); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, lang, useResponseFile); if(includeFlags.empty()) { return; } if(useResponseFile) { std::string name = "includes_"; name += lang; name += ".rsp"; std::string arg = "@" + this->CreateResponseFile(name.c_str(), includeFlags, this->FlagFileDepends[lang]); this->LocalGenerator->AppendFlags(flags, arg.c_str()); } else { this->LocalGenerator->AppendFlags(flags, includeFlags.c_str()); } }
false
false
false
false
false
0
connect ( const struct sockaddr *addr, socklen_t addrlen, int port ) { struct sockaddr_storage addrbuf; memset ( &addrbuf,0,sizeof ( addrbuf ) ); JASSERT ( addrlen <= sizeof ( addrbuf ) ) ( addrlen ) ( sizeof ( addrbuf ) ); memcpy ( &addrbuf,addr,addrlen ); JWARNING ( addrlen == sizeof ( sockaddr_in ) ) ( addrlen ) ( sizeof ( sockaddr_in ) ).Text ( "may not be correct socket type" ); ( (sockaddr_in*)&addrbuf )->sin_port = htons ( port ); return jalib::connect( _sockfd, (sockaddr*)&addrbuf, addrlen ) == 0; }
false
false
false
false
true
1
operator<(const ELFSymbolData &RHS) const { unsigned LHSType = Symbol->getType(); unsigned RHSType = RHS.Symbol->getType(); if (LHSType == ELF::STT_SECTION && RHSType != ELF::STT_SECTION) return false; if (LHSType != ELF::STT_SECTION && RHSType == ELF::STT_SECTION) return true; if (LHSType == ELF::STT_SECTION && RHSType == ELF::STT_SECTION) return SectionIndex < RHS.SectionIndex; return Name < RHS.Name; }
false
false
false
false
false
0
num_sel_recompute (struct Bond *list) { int n = 0; struct Bond * current = list; if (list == NULL) return 0; do if (current->selected & SEL_YES) n++; while ((current = current->next) != NULL); return n; }
false
false
false
false
false
0
radeon_atombios_set_dac_info(struct radeon_encoder *radeon_encoder) { struct drm_device *dev = radeon_encoder->base.dev; struct radeon_device *rdev = dev->dev_private; struct radeon_encoder_atom_dac *dac = kzalloc(sizeof(struct radeon_encoder_atom_dac), GFP_KERNEL); if (!dac) return NULL; dac->tv_std = radeon_atombios_get_tv_info(rdev); return dac; }
false
false
false
false
false
0
issame(const char *str) { char first = *str; while (*(++str)) { if (*str && *str != first) return FALSE; } return TRUE; }
false
false
false
false
false
0
display(void) { time_t curtime; char buf[255]; static time_t fpstime = 0; static int fpscount = 0; static int fps = 0; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, (GLdouble)winwidth/winheight, 0.01, 100); agvViewTransform(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if (Rebuild) { Create(fractal); Rebuild = 0; } glCallList(fractal); if (DrawAxes) glCallList(AXES); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, winwidth, 0.0, winheight); sprintf(buf, "FPS=%d", fps); glColor3f(1.0f, 1.0f, 1.0f); gl_font(FL_HELVETICA, 12); gl_draw(buf, 10, 10); // // Use glFinish() instead of glFlush() to avoid getting many frames // ahead of the display (problem with some Linux OpenGL implementations...) // glFinish(); // Update frames-per-second fpscount ++; curtime = time(NULL); if ((curtime - fpstime) >= 2) { fps = (fps + fpscount / (curtime - fpstime)) / 2; fpstime = curtime; fpscount = 0; } }
false
false
false
false
false
0
CKYAPDUFactory_ReadObject(CKYAPDU *apdu, unsigned long objectID, CKYOffset offset, CKYByte size) { CKYBuffer buf; CKYStatus ret; CKYAPDU_SetCLA(apdu, CKY_CLASS_COOLKEY); CKYAPDU_SetINS(apdu, CKY_INS_READ_OBJ); CKYAPDU_SetP1(apdu, 0x00); CKYAPDU_SetP2(apdu, 0x00); CKYBuffer_InitEmpty(&buf); /* optimization, do a single malloc for the whole block */ ret = CKYBuffer_Reserve(&buf,0x09); if (ret != CKYSUCCESS) { goto fail; } ret = CKYBuffer_AppendLong(&buf,objectID); if (ret != CKYSUCCESS) { goto fail; } ret = CKYBuffer_AppendLong(&buf,offset); if (ret != CKYSUCCESS) { goto fail; } ret = CKYBuffer_AppendChar(&buf, size); if (ret != CKYSUCCESS) { goto fail; } ret = CKYAPDU_SetSendDataBuffer(apdu, &buf); fail: CKYBuffer_FreeData(&buf); return ret; }
false
false
false
false
false
0
CFontz633_set_char (Driver *drvthis, int n, unsigned char *dat) { PrivateData *p = drvthis->private_data; unsigned char out[9]; unsigned char mask = (1 << p->cellwidth) - 1; int row; if ((n < 0) || (n >= NUM_CCs)) return; if (!dat) return; out[0] = n; /* Custom char to define. xxx */ for (row = 0; row < p->cellheight; row++) { out[row+1] = dat[row] & mask; } send_bytes_message(p->fd, CF633_Set_LCD_Special_Character_Data, 9, out); }
true
true
false
false
false
1
lp8788_setup_adc_channel(struct device *dev, struct lp8788_charger *pchg) { struct lp8788_charger_platform_data *pdata = pchg->pdata; struct iio_channel *chan; if (!pdata) return; /* ADC channel for battery voltage */ chan = iio_channel_get(dev, pdata->adc_vbatt); pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan; /* ADC channel for battery temperature */ chan = iio_channel_get(dev, pdata->adc_batt_temp); pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan; }
false
false
false
false
false
0
getParameterizedColor(double colorinterp, SplashColorMode mode, SplashColorPtr dest) { GfxColor src; GfxColorSpace* srcColorSpace = shading->getColorSpace(); int colorComps = 3; #if SPLASH_CMYK if (mode == splashModeCMYK8) colorComps=4; #endif shading->getParameterizedColor(colorinterp, &src); if (bDirectColorTranslation) { for (int m = 0; m < colorComps; ++m) dest[m] = colToByte(src.c[m]); } else { convertGfxColor(dest, mode, srcColorSpace, &src); } }
false
false
false
false
false
0
parsestruct(xmlrpc_env * const env, xmlrpc_value * const strct, const char ** const format, char const delimiter, va_list * args) { xmlrpc_value *key, *value; char *keystr; size_t keylen; /* Set up error handling preconditions. */ key = NULL; /* Build the members of our struct. */ while (**format != '*' && **format != delimiter && **format != '\0') { /* Get our key, and skip over the ':' character. Notice the ** sudden call to getValue--we're going in the opposite direction. */ getValue(env, format, args, &key); XMLRPC_FAIL_IF_FAULT(env); XMLRPC_ASSERT(**format == ':'); (*format)++; /* Look up the value for our key. */ xmlrpc_parse_value(env, key, "s#", &keystr, &keylen); XMLRPC_FAIL_IF_FAULT(env); value = xmlrpc_struct_get_value_n(env, strct, keystr, keylen); XMLRPC_FAIL_IF_FAULT(env); /* Get our value, and skip over the ',' character (if present). */ parsevalue(env, value, format, args); XMLRPC_FAIL_IF_FAULT(env); XMLRPC_ASSERT(**format == ',' || **format == delimiter); if (**format == ',') (*format)++; /* Release our reference, and restore our invariant. */ xmlrpc_DECREF(key); key = NULL; } if (**format == '*') { (*format)++; if (**format != delimiter && **format != '\0') XMLRPC_FAIL(env, XMLRPC_INTERNAL_ERROR, "* can appear only at the end " "of a structure format specifier"); } else { /* Here we're supposed to fail if he didn't extract all the members. But we don't know how to determine whether he specified all the members, so we always fail. */ XMLRPC_FAIL(env, XMLRPC_INTERNAL_ERROR, "You must specify '*' as the " "last member of a structure in a format specifier " "used for parsing an xmlrpc_value"); } XMLRPC_ASSERT(**format == delimiter || **format == '\0'); cleanup: if (key) xmlrpc_DECREF(key); }
false
false
false
false
false
0
AVCBinReadNextTableRec(AVCBinFile *psFile) { if (psFile->eCoverType != AVCCoverPC && psFile->eCoverType != AVCCoverPC2 && psFile->eFileType == AVCFileTABLE && psFile->hdr.psTableDef->numRecords > 0 && ! AVCRawBinEOF(psFile->psRawBinFile) && _AVCBinReadNextTableRec(psFile->psRawBinFile, psFile->hdr.psTableDef->numFields, psFile->hdr.psTableDef->pasFieldDef, psFile->cur.pasFields, psFile->hdr.psTableDef->nRecSize) == 0 ) { return psFile->cur.pasFields; } else if ((psFile->eCoverType == AVCCoverPC || psFile->eCoverType == AVCCoverPC2 ) && psFile->eFileType == AVCFileTABLE && psFile->hdr.psTableDef->numRecords > 0 && _AVCBinReadNextDBFTableRec(psFile->hDBFFile, &(psFile->nCurDBFRecord), psFile->hdr.psTableDef->numFields, psFile->hdr.psTableDef->pasFieldDef, psFile->cur.pasFields) == 0) { return psFile->cur.pasFields; } return NULL; }
false
false
false
false
false
0
Initialize() { this->Superclass::Initialize(); delete this->Internal; this->Internal = new vtkSelectionInternals; }
false
false
false
false
false
0
SendPostmasterSignal(PMSignalReason reason) { /* If called in a standalone backend, do nothing */ if (!IsUnderPostmaster) return; /* Atomically set the proper flag */ PMSignalState->PMSignalFlags[reason] = true; /* Send signal to postmaster */ kill(PostmasterPid, SIGUSR1); }
false
false
false
false
false
0
hdb_sqlite_prepare_stmt(krb5_context context, sqlite3 *db, sqlite3_stmt **statement, const char *str) { int ret, tries = 0; ret = sqlite3_prepare_v2(db, str, -1, statement, NULL); while((tries++ < MAX_RETRIES) && ((ret == SQLITE_BUSY) || (ret == SQLITE_IOERR_BLOCKED) || (ret == SQLITE_LOCKED))) { krb5_warnx(context, "hdb-sqlite: prepare busy"); sleep(1); ret = sqlite3_prepare_v2(db, str, -1, statement, NULL); } if (ret != SQLITE_OK) { krb5_set_error_message(context, EINVAL, "Failed to prepare stmt %s: %s", str, sqlite3_errmsg(db)); return EINVAL; } return 0; }
false
false
false
false
false
0
smi_dma_xfer(unsigned long data) { struct smi_port *port = (struct smi_port *) data; struct smi_dev *dev = port->dev; u32 intr_status, finishedData, dmaManagement; u8 dmaChan0State, dmaChan1State; intr_status = port->_int_status; dmaManagement = smi_read(port->DMA_MANAGEMENT); dmaChan0State = (u8)((dmaManagement & 0x00000030) >> 4); dmaChan1State = (u8)((dmaManagement & 0x00300000) >> 20); /* CH-0 DMA interrupt.*/ if ((intr_status & port->_dmaInterruptCH0) && (dmaChan0State == 0x01)) { dev_dbg(&dev->pci_dev->dev, "Port[%d]-DMA CH0 engine complete successful !\n", port->idx); finishedData = smi_read(port->DMA_CHAN0_TRANS_STATE); finishedData &= 0x003FFFFF; /* value of DMA_PORT0_CHAN0_TRANS_STATE register [21:0] * indicate dma total transfer length and * zero of [21:0] indicate dma total transfer length * equal to 0x400000 (4MB)*/ if (finishedData == 0) finishedData = 0x00400000; if (finishedData != SMI_TS_DMA_BUF_SIZE) { dev_dbg(&dev->pci_dev->dev, "DMA CH0 engine complete length mismatched, finish data=%d !\n", finishedData); } dvb_dmx_swfilter_packets(&port->demux, port->cpu_addr[0], (finishedData / 188)); /*dvb_dmx_swfilter(&port->demux, port->cpu_addr[0], finishedData);*/ } /* CH-1 DMA interrupt.*/ if ((intr_status & port->_dmaInterruptCH1) && (dmaChan1State == 0x01)) { dev_dbg(&dev->pci_dev->dev, "Port[%d]-DMA CH1 engine complete successful !\n", port->idx); finishedData = smi_read(port->DMA_CHAN1_TRANS_STATE); finishedData &= 0x003FFFFF; /* value of DMA_PORT0_CHAN0_TRANS_STATE register [21:0] * indicate dma total transfer length and * zero of [21:0] indicate dma total transfer length * equal to 0x400000 (4MB)*/ if (finishedData == 0) finishedData = 0x00400000; if (finishedData != SMI_TS_DMA_BUF_SIZE) { dev_dbg(&dev->pci_dev->dev, "DMA CH1 engine complete length mismatched, finish data=%d !\n", finishedData); } dvb_dmx_swfilter_packets(&port->demux, port->cpu_addr[1], (finishedData / 188)); /*dvb_dmx_swfilter(&port->demux, port->cpu_addr[1], finishedData);*/ } /* restart DMA.*/ if (intr_status & port->_dmaInterruptCH0) dmaManagement |= 0x00000002; if (intr_status & port->_dmaInterruptCH1) dmaManagement |= 0x00020000; smi_write(port->DMA_MANAGEMENT, dmaManagement); /* Re-enable interrupts */ smi_port_enableInterrupt(port); }
false
false
false
false
false
0
create(KConfigBase *master, const QByteArray &name, bool isImmutable, bool isConst) { QExplicitlySharedDataPointer<KConfigGroupPrivate> data; if (dynamic_cast<KConfigGroup*>(master)) data = new KConfigGroupPrivate(dynamic_cast<KConfigGroup*>(master), isImmutable, isConst, name); else data = new KConfigGroupPrivate(dynamic_cast<KConfig*>(master), isImmutable, isConst, name); return data; }
false
false
false
false
false
0
irc_del_person(session_t *s, irc_private_t *j, char *nick, char *wholenick, char *reason, int doprint) { people_t *person; channel_t *chan; people_chan_t *pech; window_t *w; list_t tmp; int ret; char *longnick; if (!(person = irc_find_person(j->people, nick))) return -1; /* if person doesn't have any channels, we shouldn't get here */ if (! (tmp = person->channels) ) { debug_error("logic error in call to irc_del_person!, %s doesn't have any channels\n", nick); /* I'm not adding memory freeing here, since we shouldn't get here by any chance, */ return -1; } /* * GiM: removing from priv_data->people is in * irc_del_person_channel_int * * tmp is set, we can run the loop */ while (1) { if (!(tmp && (pech = tmp->data))) break; if (doprint) print_info(pech->chanp->name, s, "irc_quit", session_name(s), nick, wholenick, reason); /* if this call returns !0 it means * person has been deleted, so let's break * the loop */ chan = pech->chanp; ret = irc_del_person_channel_int(s, j, person, pech->chanp); if (xstrlen(nick) == chan->longest_nick) update_longest_nick(chan); if (ret) break; tmp = person->channels; } longnick = irc_uid(nick); w = window_find_s(s, longnick); if (w) { if (session_int_get(s, "close_windows") > 0) { debug("[irc] del_person() window_kill(w, 1); %s\n", w->target); window_kill(w); } if (doprint) print_info(longnick,s, "irc_quit", session_name(s), nick, wholenick, reason); } xfree(longnick); query_emit_id(NULL, USERLIST_REFRESH); return 0; }
false
false
false
false
false
0
gst_inter_video_src_get_times (GstBaseSrc * src, GstBuffer * buffer, GstClockTime * start, GstClockTime * end) { GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src); GST_DEBUG_OBJECT (intervideosrc, "get_times"); /* for live sources, sync on the timestamp of the buffer */ if (gst_base_src_is_live (src)) { GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer); if (GST_CLOCK_TIME_IS_VALID (timestamp)) { /* get duration to calculate end time */ GstClockTime duration = GST_BUFFER_DURATION (buffer); if (GST_CLOCK_TIME_IS_VALID (duration)) { *end = timestamp + duration; } *start = timestamp; } } else { *start = -1; *end = -1; } }
false
false
false
false
false
0
copyToEnd(std::ostream &out) { int startLevel = blockLevel++ ; std::istream &in = currentContext->getStream() ; readLine(false) ; while (!in.eof()) { char *s = line ; while (*s != 0) { if (*s == '{') { blockLevel++ ; } else if (*s == '}') { if (--blockLevel == startLevel) { resetInput() ; return ; } } out.put (*s++) ; } out.put ('\n') ; readLine (false) ; } }
false
false
false
false
false
0
nrrdBoundarySpecCheck(const NrrdBoundarySpec *bspec) { static const char me[]="nrrdBoundarySpecCheck"; if (!bspec) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (airEnumValCheck(nrrdBoundary, bspec->boundary)) { biffAddf(NRRD, "%s: %d is not a valid %s value", me, bspec->boundary, nrrdBoundary->name); return 1; } if (nrrdBoundaryPad == bspec->boundary) { if (!AIR_EXISTS(bspec->padValue)) { biffAddf(NRRD, "%s: need existing pad value (not %g) with %s %s", me, bspec->padValue, nrrdBoundary->name, airEnumStr(nrrdBoundary, nrrdBoundaryPad)); return 1; } } return 0; }
false
false
false
false
false
0
cdbus_method_return_verify(DBusMessage * msg, const char ** str) { if (!msg || dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_ERROR) return true; const char *ptr; if (!dbus_message_get_args(msg, &cdbus_g_dbus_error, DBUS_TYPE_STRING, &ptr, DBUS_TYPE_INVALID)) { log_error("Cannot read description from D-Bus error message: %s ", cdbus_g_dbus_error.message); dbus_error_free(&cdbus_g_dbus_error); ptr = NULL; } if (str) *str = ptr; return false; }
false
false
false
false
false
0
fhexdump8x32 (FILE * file, char *prefix, void *data, int len) { unsigned char *ptr = (unsigned char *) data; int i, j; fprintf (file, "%s:%s", prefix, len >= 16 ? "\n" : strlen (prefix) >= 8 ? "\t" : "\t\t"); for (i = 0; i < len; i++) { if (i % 32 == 0) printf ("\t"); fprintf (file, "%02x", ptr[i]); if (i % 32 == 31) { fprintf (file, " ["); for (j = i - 31; j <= i; j++) fprintf (file, "%c", isprint (ptr[j]) ? ptr[j] : '?'); fprintf (file, "]\n"); } else if (i % 8 == 7) fprintf (file, " "); } if (i % 32) { for (j = i; j % 32; j++) fprintf (file, " %s", j % 8 == 7 ? " " : ""); fprintf (file, "%s[", j % 8 == 7 ? " " : ""); for (j = i - i % 32; j < i; j++) fprintf (file, "%c", isprint (ptr[j]) ? ptr[j] : '?'); fprintf (file, "]\n"); } if (!len) fprintf (file, "<zero length input>\n"); }
false
false
false
false
false
0
set_visible (GtkSourceGutterRenderer *renderer, gboolean visible) { visible = visible != FALSE; if (renderer->priv->visible != visible) { renderer->priv->visible = visible; g_object_notify (G_OBJECT (renderer), "visible"); gtk_source_gutter_renderer_queue_draw (renderer); } }
false
false
false
false
false
0
noise_word(word w) { if (w==ext_code[wthe] || w==ext_code[wa] || w==ext_code[wan]) return 1; if (w==ext_code[wmy]) return 1; if (aver>=AGT18 && aver<=AGT18MAX && w==ext_code[wis]) return 1; return 0; }
false
false
false
false
false
0
Account (boost::shared_ptr<Ekiga::PersonalDetails> details_, boost::shared_ptr<Dialect> dialect_, boost::shared_ptr<Cluster> cluster_, const std::string name, const std::string user, const std::string server, int port, const std::string resource, const std::string password, bool enable_on_startup): details(details_), dialect(dialect_), cluster(cluster_) { status = _("inactive"); node = xmlNewNode (NULL, BAD_CAST "entry"); xmlSetProp (node, BAD_CAST "name", BAD_CAST name.c_str ()); xmlSetProp (node, BAD_CAST "user", BAD_CAST user.c_str ()); xmlSetProp (node, BAD_CAST "server", BAD_CAST server.c_str ()); { std::stringstream sstream; sstream << port; xmlSetProp (node, BAD_CAST "port", BAD_CAST sstream.str ().c_str ()); } xmlSetProp (node, BAD_CAST "resource", BAD_CAST resource.c_str ()); xmlSetProp (node, BAD_CAST "password", BAD_CAST password.c_str ()); if (enable_on_startup) { xmlSetProp (node, BAD_CAST "startup", BAD_CAST "true"); } else { xmlSetProp (node, BAD_CAST "startup", BAD_CAST "false"); } connection = lm_connection_new (NULL); lm_connection_set_disconnect_function (connection, (LmDisconnectFunction)on_disconnected_c, this, NULL); if (enable_on_startup) { enable (); } }
false
false
false
false
false
0
remove_redundant_lower_bounds( __isl_take isl_pw_aff_list *list, __isl_keep isl_ast_build *build) { int i, j, n; isl_set *domain; list = isl_pw_aff_list_sort(list, &reduce_list_cmp, NULL); if (!list) return NULL; n = isl_pw_aff_list_n_pw_aff(list); if (n <= 1) return list; domain = isl_ast_build_get_domain(build); for (i = n - 1; i >= 0; --i) { isl_pw_aff *pa_i; isl_set *domain_i; int empty; domain_i = isl_set_copy(domain); pa_i = isl_pw_aff_list_get_pw_aff(list, i); for (j = 0; j < n; ++j) { isl_pw_aff *pa_j; isl_set *better; if (j == i) continue; pa_j = isl_pw_aff_list_get_pw_aff(list, j); better = isl_pw_aff_gt_set(isl_pw_aff_copy(pa_i), pa_j); domain_i = isl_set_intersect(domain_i, better); } empty = isl_set_is_empty(domain_i); isl_set_free(domain_i); isl_pw_aff_free(pa_i); if (empty < 0) goto error; if (!empty) continue; list = isl_pw_aff_list_drop(list, i, 1); n--; } isl_set_free(domain); return list; error: isl_set_free(domain); return isl_pw_aff_list_free(list); }
false
false
false
false
false
0
set_iact_dmpvmod_nd_nchgstore(struct mod_t *mdp) { register int32 ni; register struct net_t *np; register struct task_t *tskp; for (ni = 0, np = &(mdp->mnets[0]); ni < mdp->mnnum; ni++, np++) { /* can never dumpvar arrays */ if (!np->n_isarr) { np->dmpv_in_src = TRUE; np->nchg_nd_chgstore = TRUE; } } for (tskp = mdp->mtasks; tskp != NULL; tskp = tskp->tsknxt) { for (ni = 0, np = &(tskp->tsk_regs[0]); ni < tskp->trnum; ni++, np++) { if (!np->n_isarr) { np->dmpv_in_src = TRUE; np->nchg_nd_chgstore = TRUE; } } } }
false
false
false
false
false
0
tcsd_threads_final() { int rc; UINT32 i; MUTEX_LOCK(tm->lock); tm->shutdown = 1; MUTEX_UNLOCK(tm->lock); /* wait for all currently running threads to exit */ for (i = 0; i < tm->max_threads; i++) { if (tm->thread_data[i].thread_id != THREAD_NULL) { if ((rc = THREAD_JOIN(*(tm->thread_data[i].thread_id), NULL))) { LogError("Thread join failed: error: %d", rc); } } } free(tm->thread_data); free(tm); return TSS_SUCCESS; }
false
false
false
false
false
0
afr_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, int32_t flags) { afr_private_t *priv = NULL; afr_local_t *local = NULL; call_frame_t *transaction_frame = NULL; int ret = -1; int op_errno = EINVAL; data_pair_t *trav = NULL; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); VALIDATE_OR_GOTO (this->private, out); GF_IF_INTERNAL_XATTR_GOTO ("trusted.afr.*", dict, trav, op_errno, out); GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.afr.*", dict, trav, op_errno, out); if (ret) goto out; priv = this->private; QUORUM_CHECK(fsetxattr,out); ALLOC_OR_GOTO (local, afr_local_t, out); ret = afr_local_init (local, priv, &op_errno); if (ret < 0) goto out; transaction_frame = copy_frame (frame); if (!transaction_frame) { goto out; } transaction_frame->local = local; local->op_ret = -1; local->cont.fsetxattr.dict = dict_ref (dict); local->cont.fsetxattr.flags = flags; local->transaction.fop = afr_fsetxattr_wind; local->transaction.done = afr_fsetxattr_done; local->transaction.unwind = afr_fsetxattr_unwind; local->fd = fd_ref (fd); local->transaction.main_frame = frame; local->transaction.start = LLONG_MAX - 1; local->transaction.len = 0; afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION); ret = 0; out: if (ret < 0) { if (transaction_frame) AFR_STACK_DESTROY (transaction_frame); AFR_STACK_UNWIND (fsetxattr, frame, -1, op_errno); } return 0; }
false
false
false
false
false
0
save( const Meta::TrackList &tracks, const QString& name ) { DEBUG_BLOCK debug() << "saving " << tracks.count() << " tracks to device with name" << name; // NOTE: the playlist constructor tells the handler to make the playlist, save to db etc. Playlists::MediaDevicePlaylistPtr pl = Playlists::MediaDevicePlaylistPtr( new Playlists::MediaDevicePlaylist( name, tracks ) ); //pl = 0; emit playlistSaved( pl, name ); // inform handler of new playlist addMediaDevicePlaylist( pl ); return Playlists::PlaylistPtr::dynamicCast( pl ); }
false
false
false
false
false
0
ssh_srv_pki_do_sign_sessionid(ssh_session session, const ssh_key privkey) { struct ssh_crypto_struct *crypto; unsigned char hash[SHA_DIGEST_LEN] = {0}; ssh_signature sig; ssh_string sig_blob; SHACTX ctx; int rc; if (session == NULL || privkey == NULL || !ssh_key_is_private(privkey)) { return NULL; } crypto = session->next_crypto ? session->next_crypto : session->current_crypto; ctx = sha1_init(); if (ctx == NULL) { return NULL; } if (crypto->secret_hash == NULL){ ssh_set_error(session,SSH_FATAL,"Missing secret_hash"); return NULL; } sha1_update(ctx, crypto->secret_hash, crypto->digest_len); sha1_final(hash, ctx); #ifdef DEBUG_CRYPTO ssh_print_hexa("Hash being signed", hash, SHA_DIGEST_LEN); #endif sig = pki_do_sign_sessionid(privkey, hash, SHA_DIGEST_LEN); if (sig == NULL) { return NULL; } rc = ssh_pki_export_signature_blob(sig, &sig_blob); ssh_signature_free(sig); if (rc < 0) { return NULL; } return sig_blob; }
true
true
false
false
false
1
Sacc_toK_Aop_rgb24( GenefxState *gfxs ) { int w = gfxs->length; GenefxAccumulator *S = gfxs->Sacc; u8 *D = gfxs->Aop[0]; u8 r = (gfxs->Dkey >> 16); u8 g = (gfxs->Dkey >> 8) & 0xff; u8 b = (gfxs->Dkey ) & 0xff; while (w--) { if (!(S->RGB.a & 0xF000) && D[0] == b && D[1] == g && D[2] == r) { *D++ = (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b; *D++ = (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g; *D++ = (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r; } else D += 3; S++; } }
false
false
false
false
false
0
invalidate_cache (int fd, off_t len) { int adv_ret = -1; /* Minimize syscalls. */ off_t clen = cache_round (fd, len); if (len && !clen) return true; /* Don't advise this time. */ if (!len && !clen && max_records) return true; /* Nothing pending. */ off_t pending = len ? cache_round (fd, 0) : 0; if (fd == STDIN_FILENO) { if (input_seekable) { /* Note we're being careful here to only invalidate what we've read, so as not to dump any read ahead cache. */ #if HAVE_POSIX_FADVISE adv_ret = posix_fadvise (fd, input_offset - clen - pending, clen, POSIX_FADV_DONTNEED); #else errno = ENOTSUP; #endif } else errno = ESPIPE; } else if (fd == STDOUT_FILENO) { static off_t output_offset = -2; if (output_offset != -1) { if (0 > output_offset) { output_offset = lseek (fd, 0, SEEK_CUR); output_offset -= clen + pending; } if (0 <= output_offset) { #if HAVE_POSIX_FADVISE adv_ret = posix_fadvise (fd, output_offset, clen, POSIX_FADV_DONTNEED); #else errno = ENOTSUP; #endif output_offset += clen + pending; } } } return adv_ret != -1 ? true : false; }
false
false
false
false
false
0
DvechEigVecVec(void* AA, double v[], int n, double *vv){ dvechmat* A=(dvechmat*)AA; int i,rank,neigs; double *an,dd,ddd=0,*eigval; if (A->Eig.neigs>=0){ an=A->Eig.an; neigs=A->Eig.neigs; eigval=A->Eig.eigval; for (rank=0;rank<neigs;rank++){ for (dd=0,i=0;i<n;i++){ dd+=v[i]*an[i]; } an+=n; ddd+=dd*dd*eigval[rank]; } *vv=ddd*A->alpha; } else { DSDPSETERR(1,"Vech Matrix not factored yet\n"); } return 0; }
false
false
false
false
false
0