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
dj_free_sfx(unsigned char sfx_num) { if (main_info.no_sound) return; free(sounds[sfx_num].buf); memset(&sounds[sfx_num], 0, sizeof(sfx_data)); }
false
false
false
false
false
0
dbus_init( ) { char * request_ret = NULL; unsigned int result; GError * error = NULL; /* Initialize the GType/GObject system */ g_type_init(); g_print(":main Connecting to the Session D-Bus.\n"); bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if ( error != NULL ) { fprintf(stderr,"Couldn't connect to session bus: %s\n",error->message); exit (EXIT_FAILURE); } printf(":main Regiresting the well-known name (%s)\n", M_DBUS_KBDD_SERVICE); /** * In order to register a well-known name, we need to use the * "RequestMethod" of the /org/freedesktop/DBus interface. Each * bus provides an object that will implement this interface * */ proxy = dbus_g_proxy_new_for_name(bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if ( proxy == NULL) { fprintf(stderr,"Failed to get a proxy for D-Bus\n"); } //if (! org_freedesktop_DBus_request_name( proxy, M_DBUS_KBDD_SERVICE, // DBUS_NAME_FLAG_DO_NOT_QUEUE, &request_ret, &error) ) if (! dbus_g_proxy_call( proxy, "RequestName", &error, G_TYPE_STRING, M_DBUS_KBDD_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &result, G_TYPE_INVALID)) { fprintf(stderr, "Unable to register service: %s", error->message); exit (EXIT_FAILURE); } printf(":main RequestName returned %s.\n", request_ret); if ( result != 1 ) { fprintf(stderr,"Failed to get the primary well-known name.\n"); exit (EXIT_FAILURE); } printf(":main Creating one MKbddService Object\n"); service = g_object_new(M_TYPE_KBDD_SERVICE, NULL); if (service == NULL) { fprintf(stderr,"Failed to create one KbddService instance\n"); exit (EXIT_FAILURE); } g_print(":main Registering project to D-Bus.\n"); dbus_g_object_type_install_info (M_TYPE_KBDD_SERVICE, &dbus_glib_m_kbdd_service_object_info); dbus_g_connection_register_g_object(bus, M_DBUS_KBDD_SERVICE_PATH, G_OBJECT(service)); g_print("Ready to serve requests\n"); return 1; }
false
false
false
false
false
0
secu_PrintECPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level) { SECItem curveOID = { siBuffer, NULL, 0}; SECU_Indent(out, level); fprintf(out, "%s:\n", m); SECU_PrintInteger(out, &pk->u.ec.publicValue, "PublicValue", level+1); /* For named curves, the DEREncodedParams field contains an * ASN Object ID (0x06 is SEC_ASN1_OBJECT_ID). */ if ((pk->u.ec.DEREncodedParams.len > 2) && (pk->u.ec.DEREncodedParams.data[0] == 0x06)) { curveOID.len = pk->u.ec.DEREncodedParams.data[1]; curveOID.data = pk->u.ec.DEREncodedParams.data + 2; SECU_PrintObjectID(out, &curveOID, "Curve", level +1); } }
false
false
false
false
false
0
slice_add(int id, Tcl_Interp * interp, int argc, char *argv[]) { if (GVL_slice_add(id) == -1) { Tcl_SetResult(interp, "Error: unable to add slice", TCL_VOLATILE); return (TCL_ERROR); } return (TCL_OK); }
false
false
false
false
false
0
r_jacobi(){ //Equation (18) AG2012 double rj = 0; if (galaxy.type == 1) rj = pow((N*mm.nbody)/(3.0*galaxy.M.nbody),(1.0/3.0))*galaxy.R.nbody; else if (galaxy.type == 2) rj = pow((N*mm.nbody)/(2.0*galaxy.M.nbody),(1.0/3.0))*galaxy.R.nbody; return rj; }
false
false
false
false
false
0
rnd_pos(const void *pos) { PFS_mutex *mutex; PFS_rwlock *rwlock; PFS_cond *cond; PFS_file *file; set_position(pos); switch (m_pos.m_index_1) { case pos_all_instr::VIEW_MUTEX: DBUG_ASSERT(m_pos.m_index_2 < mutex_max); mutex= &mutex_array[m_pos.m_index_2]; if (mutex->m_lock.is_populated()) { make_mutex_row(mutex); return 0; } break; case pos_all_instr::VIEW_RWLOCK: DBUG_ASSERT(m_pos.m_index_2 < rwlock_max); rwlock= &rwlock_array[m_pos.m_index_2]; if (rwlock->m_lock.is_populated()) { make_rwlock_row(rwlock); return 0; } break; case pos_all_instr::VIEW_COND: DBUG_ASSERT(m_pos.m_index_2 < cond_max); cond= &cond_array[m_pos.m_index_2]; if (cond->m_lock.is_populated()) { make_cond_row(cond); return 0; } break; case pos_all_instr::VIEW_FILE: DBUG_ASSERT(m_pos.m_index_2 < file_max); file= &file_array[m_pos.m_index_2]; if (file->m_lock.is_populated()) { make_file_row(file); return 0; } break; } return HA_ERR_RECORD_DELETED; }
false
false
false
false
false
0
tcm_qla2xxx_shutdown_session(struct se_session *se_sess) { struct qla_tgt_sess *sess = se_sess->fabric_sess_ptr; struct scsi_qla_host *vha; unsigned long flags; BUG_ON(!sess); vha = sess->vha; spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); target_sess_cmd_list_set_waiting(se_sess); spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); return 1; }
false
false
false
false
false
0
gst_video_encoder_decide_allocation_default (GstVideoEncoder * encoder, GstQuery * query) { GstAllocator *allocator = NULL; GstAllocationParams params; gboolean update_allocator; /* we got configuration from our peer or the decide_allocation method, * parse them */ if (gst_query_get_n_allocation_params (query) > 0) { /* try the allocator */ gst_query_parse_nth_allocation_param (query, 0, &allocator, &params); update_allocator = TRUE; } else { allocator = NULL; gst_allocation_params_init (&params); update_allocator = FALSE; } if (update_allocator) gst_query_set_nth_allocation_param (query, 0, allocator, &params); else gst_query_add_allocation_param (query, allocator, &params); if (allocator) gst_object_unref (allocator); return TRUE; }
false
false
false
false
false
0
parse_command(int argc, char *argv[], struct GParams *params) { params->mode_all = G_define_flag(); params->mode_all->key = 'a'; params->mode_all->description = _("Use draw mode for all loaded surfaces"); params->mode_all->guisection = _("Surfaces"); /*** surface attributes ***/ args_surface(params); /*** vector lines ***/ args_vline(params); /*** vector points ***/ args_vpoint(params); /*** volumes ***/ args_volume(params); /*** misc ***/ /* background color */ params->bgcolor = G_define_standard_option(G_OPT_C_BG); /*** viewpoint ***/ args_viewpoint(params); /*** lighting ***/ args_lighting(params); /*** fringe ***/ args_fringe(params); /*** cutting plane ***/ args_cplane(params); /*** north arrow ***/ args_arrow(params); /*** output image ***/ /* output */ params->output = G_define_standard_option(G_OPT_F_OUTPUT); params->output->description = _("Name for output image file (without extension)"); params->output->guisection = _("Image"); /* format */ params->format = G_define_option(); params->format->key = "format"; params->format->type = TYPE_STRING; #ifdef HAVE_TIFFIO_H params->format->options = "ppm,tif"; /* TODO: png */ #else params->format->options = "ppm"; #endif params->format->answer = "ppm"; params->format->description = _("Graphics file format"); params->format->required = YES; params->format->guisection = _("Image"); /* size */ params->size = G_define_option(); params->size->key = "size"; params->size->type = TYPE_INTEGER; params->size->key_desc = "width,height"; params->size->answer = "640,480"; params->size->description = _("Size (width, height) of output image"); params->size->required = YES; params->size->guisection = _("Image"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); return; }
false
false
false
false
false
0
update_read_polygon_sc_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_SC_ORDER* polygon_sc) { if (orderInfo->fieldFlags & ORDER_FIELD_01) update_read_coord(s, &polygon_sc->xStart, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_02) update_read_coord(s, &polygon_sc->yStart, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_03) stream_read_uint8(s, polygon_sc->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_04) stream_read_uint8(s, polygon_sc->fillMode); if (orderInfo->fieldFlags & ORDER_FIELD_05) update_read_color(s, &polygon_sc->brushColor); if (orderInfo->fieldFlags & ORDER_FIELD_06) stream_read_uint8(s, polygon_sc->nDeltaEntries); if (orderInfo->fieldFlags & ORDER_FIELD_07) { stream_read_uint8(s, polygon_sc->cbData); stream_seek(s, polygon_sc->cbData); } }
false
false
false
false
false
0
e1000_get_bus_info_82542(struct e1000_hw *hw) { DEBUGFUNC("e1000_get_bus_info_82542"); hw->bus.type = e1000_bus_type_pci; hw->bus.speed = e1000_bus_speed_unknown; hw->bus.width = e1000_bus_width_unknown; return E1000_SUCCESS; }
false
false
false
false
false
0
parseOperand(OperandVector &Operands, StringRef Mnemonic) { OperandMatchResultTy ResTy = MatchOperandParserImpl(Operands, Mnemonic); // If there wasn't a custom match, try the generic matcher below. Otherwise, // there was a match, but an error occurred, in which case, just return that // the operand parsing failed. if (ResTy == MatchOperand_Success || ResTy == MatchOperand_ParseFail) return ResTy; if (getLexer().is(AsmToken::LBrac)) { // Memory operand Operands.push_back(SparcOperand::CreateToken("[", Parser.getTok().getLoc())); Parser.Lex(); // Eat the [ if (Mnemonic == "cas" || Mnemonic == "casx") { SMLoc S = Parser.getTok().getLoc(); if (getLexer().getKind() != AsmToken::Percent) return MatchOperand_NoMatch; Parser.Lex(); // eat % unsigned RegNo, RegKind; if (!matchRegisterName(Parser.getTok(), RegNo, RegKind)) return MatchOperand_NoMatch; Parser.Lex(); // Eat the identifier token. SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer()-1); Operands.push_back(SparcOperand::CreateReg(RegNo, RegKind, S, E)); ResTy = MatchOperand_Success; } else { ResTy = parseMEMOperand(Operands); } if (ResTy != MatchOperand_Success) return ResTy; if (!getLexer().is(AsmToken::RBrac)) return MatchOperand_ParseFail; Operands.push_back(SparcOperand::CreateToken("]", Parser.getTok().getLoc())); Parser.Lex(); // Eat the ] // Parse an optional address-space identifier after the address. if (getLexer().is(AsmToken::Integer)) { std::unique_ptr<SparcOperand> Op; ResTy = parseSparcAsmOperand(Op, false); if (ResTy != MatchOperand_Success || !Op) return MatchOperand_ParseFail; Operands.push_back(std::move(Op)); } return MatchOperand_Success; } std::unique_ptr<SparcOperand> Op; ResTy = parseSparcAsmOperand(Op, (Mnemonic == "call")); if (ResTy != MatchOperand_Success || !Op) return MatchOperand_ParseFail; // Push the parsed operand into the list of operands Operands.push_back(std::move(Op)); return MatchOperand_Success; }
false
false
false
false
false
0
nfsd4_get_session_locked(struct nfsd4_session *ses) { __be32 status; if (is_session_dead(ses)) return nfserr_badsession; status = get_client_locked(ses->se_client); if (status) return status; atomic_inc(&ses->se_ref); return nfs_ok; }
false
false
false
false
false
0
text_editor_replace_selection (TextEditor * te, const gchar* r_str) { if (!te) return; scintilla_send_message (SCINTILLA(te->scintilla), SCI_REPLACESEL, 0, (long)r_str); }
false
false
false
false
false
0
asn1_get_int(const uint8_t *buf, int *offset, uint8_t **object) { int len; if ((len = asn1_next_obj(buf, offset, ASN1_INTEGER)) < 0) goto end_int_array; if (len > 1 && buf[*offset] == 0x00) /* ignore the negative byte */ { len--; (*offset)++; } *object = (uint8_t *)malloc(len); memcpy(*object, &buf[*offset], len); *offset += len; end_int_array: return len; }
false
true
false
false
false
1
HmacFile(const char *hexKey, const char *file) { member_ptr<MessageAuthenticationCode> mac; if (strcmp(hexKey, "selftest") == 0) { cerr << "Computing HMAC/SHA1 value for self test.\n"; mac.reset(NewIntegrityCheckingMAC()); } else { std::string decodedKey; StringSource(hexKey, true, new HexDecoder(new StringSink(decodedKey))); mac.reset(new HMAC<SHA1>((const byte *)decodedKey.data(), decodedKey.size())); } FileSource(file, true, new HashFilter(*mac, new HexEncoder(new FileSink(cout)))); }
false
false
false
false
false
0
GetNeutralBrush() { QRadialGradient rgrad(20, 20, 40, 5, 5); rgrad.setColorAt(0.0, QColor(0xff, 0xff, 0xff, 0xff)); rgrad.setColorAt(1.0, QColor(0x80, 0x80, 0x80, 0xff)); return QBrush(rgrad); }
false
false
false
false
false
0
_set_upload_headers (YoutubeProxy *self, SoupMessageHeaders *headers, const gchar *filename) { YoutubeProxyPrivate *priv = self->priv; gchar *user_auth_header; gchar *devkey_header; gchar *basename; const gchar *user_agent; /* Set the user agent, if one was set in the proxy */ user_agent = rest_proxy_get_user_agent (REST_PROXY (self)); if (user_agent) soup_message_headers_append (headers, "User-Agent", user_agent); g_print ("%s\n", priv->user_auth); user_auth_header = g_strdup_printf ("GoogleLogin auth=%s", priv->user_auth); soup_message_headers_append (headers, "Authorization", user_auth_header); devkey_header = g_strdup_printf ("key=%s", priv->developer_key); soup_message_headers_append (headers, "X-GData-Key", devkey_header); basename = g_path_get_basename (filename); soup_message_headers_append (headers, "Slug", basename); g_free (user_auth_header); g_free (devkey_header); }
false
false
false
false
false
0
http_read(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int len; /* read bytes from input buffer first */ len = s->buf_end - s->buf_ptr; if (len > 0) { if (len > size) len = size; memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; } else { len = url_read(s->hd, buf, size); } if (len > 0) s->off += len; return len; }
false
true
false
false
false
1
menu_handle_mouse(menu_type *menu, const ui_event_data *in, ui_event_data *out) { int new_cursor; if (!region_inside(&menu->active, in)) { /* A click to the left of the active region is 'back' */ if (region_inside(&menu->boundary, in) && in->mousex < menu->active.col) out->type = EVT_ESCAPE; } else { new_cursor = menu->skin->get_cursor(in->mousey, in->mousex, menu->filter_count, menu->top, &menu->active); if (is_valid_row(menu, new_cursor)) { if (new_cursor == menu->cursor || !(menu->flags & MN_DBL_TAP)) out->type = EVT_SELECT; else out->type = EVT_MOVE; menu->cursor = new_cursor; } } return out->type != EVT_NONE; }
false
false
false
false
false
0
setFromString(const char *color_string, int screen) { if (color_string == 0) { free(); return false; } string color_string_tmp = color_string; StringUtil::removeFirstWhitespace(color_string_tmp); StringUtil::removeTrailingWhitespace(color_string_tmp); Display *disp = App::instance()->display(); Colormap colm = DefaultColormap(disp, screen); XColor color; if (! XParseColor(disp, colm, color_string_tmp.c_str(), &color)) return false; else if (! XAllocColor(disp, colm, &color)) return false; setPixel(color.pixel); setRGB(color.red / 256, color.green / 256, color.blue / 256); setAllocated(true); m_screen = screen; return true; }
false
false
false
false
false
0
unblock_children (GnlComposition * comp) { GstIterator *children; children = gst_bin_iterate_elements (GST_BIN (comp)); retry: if (G_UNLIKELY (gst_iterator_fold (children, (GstIteratorFoldFunction) unblock_child_pads, NULL, comp) == GST_ITERATOR_RESYNC)) { gst_iterator_resync (children); goto retry; } gst_iterator_free (children); }
false
false
false
false
false
0
velocity_get_pci_info(struct velocity_info *vptr, struct pci_device *pdev) { if (pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0) { printf("DEBUG: pci_read_config_byte failed\n"); return -1; } adjust_pci_device(pdev); vptr->ioaddr = pci_bar_start(pdev, PCI_BASE_ADDRESS_0); vptr->memaddr = pci_bar_start(pdev, PCI_BASE_ADDRESS_1); printf("Looking for I/O Resource - Found:"); if (! (pci_resource_flags(pdev, PCI_BASE_ADDRESS_0) & IORESOURCE_IO)) { printf ("DEBUG: region #0 is not an I/O resource, aborting.\n"); return -1; } printf("Looking for Memory Resource - Found:"); if ((pci_resource_flags(pdev, PCI_BASE_ADDRESS_1) & IORESOURCE_IO)) { printf("DEBUG: region #1 is an I/O resource, aborting.\n"); return -1; } if (pci_bar_size(pdev, PCI_BASE_ADDRESS_1) < 256) { printf("DEBUG: region #1 is too small.\n"); return -1; } vptr->pdev = pdev; return 0; }
false
false
false
false
false
0
find_previous_pathsep(path, psep) char_u *path; char_u **psep; { /* skip the current separator */ if (*psep > path && vim_ispathsep(**psep)) --*psep; /* find the previous separator */ while (*psep > path) { if (vim_ispathsep(**psep)) return OK; mb_ptr_back(path, *psep); } return FAIL; }
false
false
false
false
false
0
list_dir_status_header(UAContext *ua) { char dt[MAX_TIME_LENGTH]; char b1[35], b2[35], b3[35], b4[35], b5[35]; ua->send_msg(_("%s Version: %s (%s) %s %s %s\n"), my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER); bstrftime_nc(dt, sizeof(dt), daemon_start_time); ua->send_msg(_("Daemon started %s. Jobs: run=%d, running=%d " "mode=%d,%d\n"), dt, num_jobs_run, job_count(), (int)DEVELOPER_MODE, (int)BEEF); ua->send_msg(_(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1), edit_uint64_with_commas(sm_bytes, b2), edit_uint64_with_commas(sm_max_bytes, b3), edit_uint64_with_commas(sm_buffers, b4), edit_uint64_with_commas(sm_max_buffers, b5)); /* TODO: use this function once for all daemons */ if (debug_level > 0 && bplugin_list->size() > 0) { int len; Plugin *plugin; POOL_MEM msg(PM_FNAME); pm_strcpy(msg, " Plugin: "); foreach_alist(plugin, bplugin_list) { len = pm_strcat(msg, plugin->file); if (len > 80) { pm_strcat(msg, "\n "); } else { pm_strcat(msg, " "); } } ua->send_msg("%s\n", msg.c_str()); } }
false
false
false
false
false
0
sisfb_detect_lcd_type(struct sis_video_info *ivideo) { u8 reg; int i; reg = SiS_GetReg(SISCR, 0x36); reg &= 0x0f; if(ivideo->sisvga_engine == SIS_300_VGA) { ivideo->CRT2LCDType = sis300paneltype[reg]; } else if(ivideo->chip >= SIS_661) { ivideo->CRT2LCDType = sis661paneltype[reg]; } else { ivideo->CRT2LCDType = sis310paneltype[reg]; if((ivideo->chip == SIS_550) && (sisfb_fstn)) { if((ivideo->CRT2LCDType != LCD_320x240_2) && (ivideo->CRT2LCDType != LCD_320x240_3)) { ivideo->CRT2LCDType = LCD_320x240; } } } if(ivideo->CRT2LCDType == LCD_UNKNOWN) { /* For broken BIOSes: Assume 1024x768, RGB18 */ ivideo->CRT2LCDType = LCD_1024x768; SiS_SetRegANDOR(SISCR, 0x36, 0xf0, 0x02); SiS_SetRegANDOR(SISCR, 0x37, 0xee, 0x01); printk(KERN_DEBUG "sisfb: Invalid panel ID (%02x), assuming 1024x768, RGB18\n", reg); } for(i = 0; i < SIS_LCD_NUMBER; i++) { if(ivideo->CRT2LCDType == sis_lcd_data[i].lcdtype) { ivideo->lcdxres = sis_lcd_data[i].xres; ivideo->lcdyres = sis_lcd_data[i].yres; ivideo->lcddefmodeidx = sis_lcd_data[i].default_mode_idx; break; } } #ifdef CONFIG_FB_SIS_300 if(ivideo->SiS_Pr.SiS_CustomT == CUT_BARCO1366) { ivideo->lcdxres = 1360; ivideo->lcdyres = 1024; ivideo->lcddefmodeidx = DEFAULT_MODE_1360; } else if(ivideo->SiS_Pr.SiS_CustomT == CUT_PANEL848) { ivideo->lcdxres = 848; ivideo->lcdyres = 480; ivideo->lcddefmodeidx = DEFAULT_MODE_848; } else if(ivideo->SiS_Pr.SiS_CustomT == CUT_PANEL856) { ivideo->lcdxres = 856; ivideo->lcdyres = 480; ivideo->lcddefmodeidx = DEFAULT_MODE_856; } #endif printk(KERN_DEBUG "sisfb: Detected %dx%d flat panel\n", ivideo->lcdxres, ivideo->lcdyres); }
false
false
false
false
false
0
__s5k6a3_get_format( struct s5k6a3 *sensor, struct v4l2_subdev_pad_config *cfg, u32 pad, enum v4l2_subdev_format_whence which) { if (which == V4L2_SUBDEV_FORMAT_TRY) return cfg ? v4l2_subdev_get_try_format(&sensor->subdev, cfg, pad) : NULL; return &sensor->format; }
false
false
false
false
false
0
create_segment_event (GstRDTDepay * depay, gboolean update, GstClockTime position) { GstSegment segment; gst_segment_init (&segment, GST_FORMAT_TIME); segment.rate = depay->play_speed; segment.applied_rate = depay->play_scale; segment.start = position; if (depay->npt_stop != -1) segment.stop = depay->npt_stop - depay->npt_start; else segment.stop = -1; segment.time = position + depay->npt_start; return gst_event_new_segment (&segment); }
false
false
false
false
false
0
getRealDevStress(const Tensor &stressTensor) const { StressTensor::ComplexVector eigenvals = stressTensor.getEigenvalues(); double devStress = 0.0; if (is3d()) { std::sort(eigenvals.begin(), eigenvals.end(), RealImagComparer()); devStress = (eigenvals[2].real() - eigenvals[0].real()); } else { // // In 2d, make sure we only ever subtract \sigma_1 and \sigma_2, // so we sort by absolute value. This ensures that the zero-eigenvalue // (corresponding to the z-dimension) will be sorted into the // eigenvals[0] element. // std::sort(eigenvals.begin(), eigenvals.end(), AbsRealImagComparer()); devStress = fabs(eigenvals[2].real() - eigenvals[1].real()); } return devStress; }
false
false
false
false
false
0
pricedb_book_end (QofBook *book) { GNCPriceDB *db; QofCollection *col; if (!book) return; col = qof_book_get_collection(book, GNC_ID_PRICEDB); db = qof_collection_get_data(col); qof_collection_set_data(col, NULL); gnc_pricedb_destroy(db); }
false
false
false
false
false
0
screen_end(int need_redraw) { Screen *screen = display_screen; int oldmore = more; hide_screen(screen); if (screen->nback_filtered) { screen->nback_filtered = screen->nback = 0; screen->nnew_filtered = screen->nnew = 0; special_var[VAR_more].val.u.ival = 0; /* XXX optimize if (jump < screenful) (but what about tmp lines?) */ need_redraw = 1; screen->maxbot = screen->bot = screen->pline.tail; screen_refilter(screen); special_var[VAR_more].val.u.ival = oldmore; } screen->paused = 0; reset_outcount(screen); if (need_redraw) { redraw_window(screen, 0); if (visual) { update_status_field(NULL, STAT_MORE); } else { prompt = fgprompt(); } } return 1; }
false
false
false
false
false
0
downloads_directory_monitor_real_start (DataProvider* base) { DownloadsDirectoryMonitor * self; const gchar* _tmp0_ = NULL; self = (DownloadsDirectoryMonitor*) base; _tmp0_ = self->priv->downloads_path; if (_tmp0_ != NULL) { DataHub* _tmp1_ = NULL; DataHub* _tmp2_ = NULL; gint _tmp3_ = 0; gchar** _tmp4_ = NULL; GFileMonitor* _tmp5_ = NULL; _tmp1_ = data_provider_get_datahub ((DataProvider*) self); _tmp2_ = _tmp1_; _tmp4_ = data_hub_get_data_source_actors (_tmp2_, TRUE, &_tmp3_); self->priv->ignored_actors = (_vala_array_free (self->priv->ignored_actors, self->priv->ignored_actors_length1, (GDestroyNotify) g_free), NULL); self->priv->ignored_actors = _tmp4_; self->priv->ignored_actors_length1 = _tmp3_; self->priv->_ignored_actors_size_ = self->priv->ignored_actors_length1; _tmp5_ = self->priv->monitor; g_signal_connect_object (_tmp5_, "changed", (GCallback) _downloads_directory_monitor_process_event_g_file_monitor_changed, self, 0); } }
false
false
false
false
false
0
champlain_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { ChamplainLabel *label = CHAMPLAIN_LABEL (object); switch (prop_id) { case PROP_TEXT: champlain_label_set_text (label, g_value_get_string (value)); break; case PROP_IMAGE: champlain_label_set_image (label, g_value_get_object (value)); break; case PROP_USE_MARKUP: champlain_label_set_use_markup (label, g_value_get_boolean (value)); break; case PROP_ALIGNMENT: champlain_label_set_alignment (label, g_value_get_enum (value)); break; case PROP_COLOR: champlain_label_set_color (label, clutter_value_get_color (value)); break; case PROP_TEXT_COLOR: champlain_label_set_text_color (label, clutter_value_get_color (value)); break; case PROP_FONT_NAME: champlain_label_set_font_name (label, g_value_get_string (value)); break; case PROP_WRAP: champlain_label_set_wrap (label, g_value_get_boolean (value)); break; case PROP_WRAP_MODE: champlain_label_set_wrap_mode (label, g_value_get_enum (value)); break; case PROP_ELLIPSIZE: champlain_label_set_ellipsize (label, g_value_get_enum (value)); break; case PROP_DRAW_BACKGROUND: champlain_label_set_draw_background (label, g_value_get_boolean (value)); break; case PROP_SINGLE_LINE_MODE: champlain_label_set_single_line_mode (label, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
false
false
false
false
false
0
xmlSchematronFreePatterns(xmlSchematronPatternPtr patterns) { xmlSchematronPatternPtr next; while (patterns != NULL) { next = patterns->next; if (patterns->name != NULL) xmlFree(patterns->name); xmlFree(patterns); patterns = next; } }
false
false
false
false
false
0
is_jpg( const char* url, int n ) { // .jpg if( *( url + n -4 ) == '.' && *( url + n -3 ) == 'j' && *( url + n -2 ) == 'p' && *( url + n -1 ) == 'g' ) return true; if( *( url + n -4 ) == '.' && *( url + n -3 ) == 'J' && *( url + n -2 ) == 'P' && *( url + n -1 ) == 'G' ) return true; // .jpeg if( *( url + n -5 ) == '.' && *( url + n -4 ) == 'j' && *( url + n -3 ) == 'p' && *( url + n -2 ) == 'e' && *( url + n -1 ) == 'g' ) return true; if( *( url + n -5 ) == '.' && *( url + n -4 ) == 'J' && *( url + n -3 ) == 'P' && *( url + n -2 ) == 'E' && *( url + n -1 ) == 'G' ) return true; return false; }
false
false
false
false
false
0
INT2tLdd(size_t nrCells, void *Buf) { size_t i; INT2 *inBuf = (INT2 *)Buf; UINT1 *outBuf = (UINT1 *)Buf; for(i=0; i < (size_t)nrCells; i++) if (inBuf[i] != MV_INT2) { outBuf[i] = (UINT1)(ABS(inBuf[i]) % 10); if (outBuf[i] == 0) outBuf[i] = MV_UINT1; } else outBuf[i] = MV_UINT1; }
false
false
false
false
false
0
kmo_duplicate_unused_ifus(cpl_array **unused) { cpl_array **ret = NULL; KMO_TRY { KMO_TRY_ASSURE(unused != NULL, CPL_ERROR_NULL_INPUT, "Not all input data is provided!"); KMO_TRY_EXIT_IF_NULL( ret = (cpl_array**)cpl_calloc(KMOS_NR_DETECTORS, sizeof(cpl_array*))); int i = 0; for (i = 0; i < KMOS_NR_DETECTORS; i++) { ret[i] = cpl_array_duplicate(unused[i]); } } KMO_CATCH { KMO_CATCH_MSG(); kmo_free_unused_ifus(ret); ret = NULL; } return ret; }
false
false
false
false
false
0
isEphemeralValueOf(Instruction *I, const Value *E) { SmallVector<const Value *, 16> WorkSet(1, I); SmallPtrSet<const Value *, 32> Visited; SmallPtrSet<const Value *, 16> EphValues; // The instruction defining an assumption's condition itself is always // considered ephemeral to that assumption (even if it has other // non-ephemeral users). See r246696's test case for an example. if (std::find(I->op_begin(), I->op_end(), E) != I->op_end()) return true; while (!WorkSet.empty()) { const Value *V = WorkSet.pop_back_val(); if (!Visited.insert(V).second) continue; // If all uses of this value are ephemeral, then so is this value. if (std::all_of(V->user_begin(), V->user_end(), [&](const User *U) { return EphValues.count(U); })) { if (V == E) return true; EphValues.insert(V); if (const User *U = dyn_cast<User>(V)) for (User::const_op_iterator J = U->op_begin(), JE = U->op_end(); J != JE; ++J) { if (isSafeToSpeculativelyExecute(*J)) WorkSet.push_back(*J); } } } return false; }
false
false
false
false
false
0
df_bb_du_chain_create (df, bb, ru) struct df *df; basic_block bb; bitmap ru; { struct bb_info *bb_info = DF_BB_INFO (df, bb); rtx insn; bitmap_copy (ru, bb_info->ru_out); /* For each def in BB create a linked list (chain) of uses reached from the def. */ for (insn = bb->end; insn && insn != PREV_INSN (bb->head); insn = PREV_INSN (insn)) { struct df_link *def_link; struct df_link *use_link; unsigned int uid = INSN_UID (insn); if (! INSN_P (insn)) continue; /* For each def in insn... */ for (def_link = df->insns[uid].defs; def_link; def_link = def_link->next) { struct ref *def = def_link->ref; unsigned int dregno = DF_REF_REGNO (def); DF_REF_CHAIN (def) = 0; /* While the reg-use chains are not essential, it is _much_ faster to search these short lists rather than all the reaching uses, especially for large functions. */ for (use_link = df->regs[dregno].uses; use_link; use_link = use_link->next) { struct ref *use = use_link->ref; if (bitmap_bit_p (ru, DF_REF_ID (use))) { DF_REF_CHAIN (def) = df_link_create (use, DF_REF_CHAIN (def)); bitmap_clear_bit (ru, DF_REF_ID (use)); } } } /* For each use in insn... */ for (use_link = df->insns[uid].uses; use_link; use_link = use_link->next) { struct ref *use = use_link->ref; bitmap_set_bit (ru, DF_REF_ID (use)); } } }
false
false
false
false
false
0
SkipMultiLineComment() { ASSERT(c0_ == '*'); Advance(); while (c0_ >= 0) { uc32 ch = c0_; Advance(); if (unicode_cache_->IsLineTerminator(ch)) { // Following ECMA-262, section 7.4, a comment containing // a newline will make the comment count as a line-terminator. has_multiline_comment_before_next_ = true; } // If we have reached the end of the multi-line comment, we // consume the '/' and insert a whitespace. This way all // multi-line comments are treated as whitespace. if (ch == '*' && c0_ == '/') { c0_ = ' '; return Token::WHITESPACE; } } // Unterminated multi-line comment. return Token::ILLEGAL; }
false
false
false
false
false
0
httpGetHeader(HttpConn *conn, cchar *key) { if (conn->rx == 0) { mprAssert(conn->rx); return 0; } return mprLookupKey(conn->rx->headers, slower(key)); }
false
false
false
false
false
0
clear_line_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) { RevLookupData *data = user_data; GtkListStore *store = GTK_LIST_STORE(model); gpointer ab_acc; g_return_val_if_fail(data && store, FALSE); gtk_tree_model_get(model, iter, ACCOUNT_LIST_COL_AB_ACCT, &ab_acc, -1); if (ab_acc == data->ab_acc) { gtk_list_store_set(store, iter, ACCOUNT_LIST_COL_GNC_NAME, "", ACCOUNT_LIST_COL_CHECKED, TRUE, -1); return TRUE; } return FALSE; }
false
false
false
false
false
0
cmd_addhistory() { userrec *u; if(!cmdinfo.istok2) { say("Usage: addhistory <nick> <entry...>"); sayf(2,0,"Use this command to add an entry to a user's account history. Useful for making notes to yourself, or other masters."); return; } u = User_user(cmdinfo.tok1); if(!u->registered) { sayf(0,0,"The nick \"%s\" is not registered.", cmdinfo.tok1); return; } if(u->history == NULL) { internal("cmd: in showhistory(), history is NULL."); return; } split(NULL, cmdinfo.param); User_addhistory(u, cmdinfo.user->acctname, time(NULL), cmdinfo.param); say("Added history entry."); }
false
false
false
false
false
0
read_pbm_raw(ByteStream &bs) { unsigned char *row = bytes_data + border; row += (nrows-1) * bytes_per_row; for (int n = nrows-1; n>=0; n--) { unsigned char acc = 0; unsigned char mask = 0; for (int c = 0; c<ncolumns; c++) { if (!mask) { bs.read(&acc, 1); mask = (unsigned char)0x80; } if (acc & mask) row[c] = 1; else row[c] = 0; mask >>= 1; } row -= bytes_per_row; } }
false
false
false
false
false
0
client_timeout(gpointer user_data) { struct tcp_partial_client_data *client = user_data; int sock; sock = g_io_channel_unix_get_fd(client->channel); DBG("client %d timeout pending %d bytes", sock, client->buf_end); g_hash_table_remove(partial_tcp_req_table, GINT_TO_POINTER(sock)); return FALSE; }
false
false
false
false
false
0
initfilterplugin(struct filterplugininfo &filterplugininfo, class Options &options, bool debugmode) { std::string aclfilename = options["acl_filename"]; if (aclfilename.empty()) return false; localdebugmode = debugmode; filterplugininfo.pluginname = PLUGIN_NAME; if (!(parseacl(acl, aclfilename))) return false; debugprint(localdebugmode, PLUGIN_SHORT_NAME ": List %s size: %d", aclfilename.c_str(), acl.size()); debugacl(acl); return true; }
false
false
false
false
false
0
goo_canvas_table_set_common_property (GObject *object, GooCanvasTableData *table_data, guint prop_id, const GValue *value, GParamSpec *pspec) { gboolean recompute_bounds = TRUE; switch (prop_id) { case PROP_X: table_data->layout_data->x = g_value_get_double (value); break; case PROP_Y: table_data->layout_data->y = g_value_get_double (value); break; case PROP_WIDTH: table_data->width = g_value_get_double (value); break; case PROP_HEIGHT: table_data->height = g_value_get_double (value); break; case PROP_ROW_SPACING: table_data->dimensions[VERT].default_spacing = g_value_get_double (value); break; case PROP_COLUMN_SPACING: table_data->dimensions[HORZ].default_spacing = g_value_get_double (value); break; case PROP_HOMOGENEOUS_ROWS: table_data->dimensions[VERT].homogeneous = g_value_get_boolean (value); break; case PROP_HOMOGENEOUS_COLUMNS: table_data->dimensions[HORZ].homogeneous = g_value_get_boolean (value); break; case PROP_X_BORDER_SPACING: table_data->layout_data->border_spacing[HORZ] = g_value_get_double (value); break; case PROP_Y_BORDER_SPACING: table_data->layout_data->border_spacing[VERT] = g_value_get_double (value); break; case PROP_HORZ_GRID_LINE_WIDTH: table_data->layout_data->prop_grid_line_width[HORZ] = g_value_get_double (value); break; case PROP_VERT_GRID_LINE_WIDTH: table_data->layout_data->prop_grid_line_width[VERT] = g_value_get_double (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } return recompute_bounds; }
false
false
false
false
false
0
_mouse_down_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; ELM_PHOTOCAM_DATA_GET(data, sd); if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE; else sd->on_hold = EINA_FALSE; if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL); else evas_object_smart_callback_call(data, SIG_PRESS, NULL); sd->longpressed = EINA_FALSE; if (sd->long_timer) ecore_timer_del(sd->long_timer); sd->long_timer = ecore_timer_add (_elm_config->longpress_timeout, _long_press_cb, data); }
false
false
false
false
false
0
rtl_start_rx(struct r8152 *tp) { int i, ret = 0; INIT_LIST_HEAD(&tp->rx_done); for (i = 0; i < RTL8152_MAX_RX; i++) { INIT_LIST_HEAD(&tp->rx_info[i].list); ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); if (ret) break; } if (ret && ++i < RTL8152_MAX_RX) { struct list_head rx_queue; unsigned long flags; INIT_LIST_HEAD(&rx_queue); do { struct rx_agg *agg = &tp->rx_info[i++]; struct urb *urb = agg->urb; urb->actual_length = 0; list_add_tail(&agg->list, &rx_queue); } while (i < RTL8152_MAX_RX); spin_lock_irqsave(&tp->rx_lock, flags); list_splice_tail(&rx_queue, &tp->rx_done); spin_unlock_irqrestore(&tp->rx_lock, flags); } return ret; }
false
false
false
false
false
0
tick_in( SAMPLE * sample, DWORD__ n ) { if( !prepare_tick_in() ) return FALSE; if( !n ) n = Digitalio::m_num_channels_in; while( n-- ) *sample++ = *m_data_ptr_in++; return TRUE; }
false
false
false
false
false
0
constructVertex(tSubProPtr sub) { // extract the particles in the hard process ParticleVector hard; hard.push_back(sub->incoming().first);hard.push_back(sub->incoming().second); hard.push_back(sub->outgoing()[0]); if(hard[0]->id()<hard[1]->id()) swap(hard[0],hard[1]); vector<SpinorWaveFunction> fin; vector<SpinorBarWaveFunction> ain; vector<VectorWaveFunction> vout; SpinorWaveFunction( fin ,hard[0],incoming,false,true); SpinorBarWaveFunction(ain ,hard[1],incoming,false,true); VectorWaveFunction(vout ,hard[2],outgoing,true,false,true); double dummy; ProductionMatrixElement prodme=HelicityME(fin,ain,vout,dummy); // construct the vertex HardVertexPtr hardvertex=new_ptr(HardVertex()); // set the matrix element for the vertex hardvertex->ME(prodme); // set the pointers and to and from the vertex for(unsigned int ix=0;ix<3;++ix) { (hard[ix]->spinInfo())->productionVertex(hardvertex); } }
false
false
false
false
false
0
setDetailAccessConstraints(QContactDetail *detail, QContactDetail::AccessConstraints constraints) { if (detail) { QContactDetailPrivate::setAccessConstraints(detail, constraints); } }
false
false
false
false
false
0
sony_nc_battery_care_limit_store(struct device *dev, struct device_attribute *attr, const char *buffer, size_t count) { unsigned int result, cmd; unsigned long value; if (count > 31) return -EINVAL; if (kstrtoul(buffer, 10, &value)) return -EINVAL; /* limit values (2 bits): * 00 - none * 01 - 80% * 10 - 50% * 11 - 100% * * bit 0: 0 disable BCL, 1 enable BCL * bit 1: 1 tell to store the battery limit (see bits 6,7) too * bits 2,3: reserved * bits 4,5: store the limit into the EC * bits 6,7: store the limit into the battery */ cmd = 0; if (value > 0) { if (value <= 50) cmd = 0x20; else if (value <= 80) cmd = 0x10; else if (value <= 100) cmd = 0x30; else return -EINVAL; /* * handle 0x0115 should allow storing on battery too; * handle 0x0136 same as 0x0115 + health status; * handle 0x013f, same as 0x0136 but no storing on the battery */ if (bcare_ctl->handle != 0x013f) cmd = cmd | (cmd << 2); cmd = (cmd | 0x1) << 0x10; } if (sony_call_snc_handle(bcare_ctl->handle, cmd | 0x0100, &result)) return -EIO; return count; }
false
false
false
false
false
0
gimple_type_hash_1 (const void *p, enum gtc_mode mode) { const_tree t = (const_tree) p; VEC(tree, heap) *sccstack = NULL; struct pointer_map_t *sccstate; struct obstack sccstate_obstack; hashval_t val; void **slot; struct tree_int_map m; if (mode == GTC_MERGE && type_hash_cache == NULL) type_hash_cache = htab_create_ggc (512, tree_int_map_hash, tree_int_map_eq, NULL); else if (mode == GTC_DIAG && canonical_type_hash_cache == NULL) canonical_type_hash_cache = htab_create_ggc (512, tree_int_map_hash, tree_int_map_eq, NULL); m.base.from = CONST_CAST_TREE (t); if ((slot = htab_find_slot (mode == GTC_MERGE ? type_hash_cache : canonical_type_hash_cache, &m, NO_INSERT)) && *slot) return iterative_hash_hashval_t (((struct tree_int_map *) *slot)->to, 0); /* Perform a DFS walk and pre-hash all reachable types. */ next_dfs_num = 1; sccstate = pointer_map_create (); gcc_obstack_init (&sccstate_obstack); val = iterative_hash_gimple_type (CONST_CAST_TREE (t), 0, &sccstack, sccstate, &sccstate_obstack, mode); VEC_free (tree, heap, sccstack); pointer_map_destroy (sccstate); obstack_free (&sccstate_obstack, NULL); return val; }
false
false
false
false
false
0
make_bad_inode_v1(void) { struct minix_inode * inode = &Inode[MINIX_BAD_INO]; int i,j,zone; int ind=0,dind=0; unsigned short ind_block[MINIX_BLOCK_SIZE>>1]; unsigned short dind_block[MINIX_BLOCK_SIZE>>1]; #define NEXT_BAD (zone = next(zone)) if (!badblocks) return; mark_inode(MINIX_BAD_INO); inode->i_nlinks = 1; inode->i_time = time(NULL); inode->i_mode = S_IFREG + 0000; inode->i_size = badblocks*MINIX_BLOCK_SIZE; zone = next(0); for (i=0 ; i<7 ; i++) { inode->i_zone[i] = zone; if (!NEXT_BAD) goto end_bad; } inode->i_zone[7] = ind = get_free_block(); memset(ind_block,0,MINIX_BLOCK_SIZE); for (i=0 ; i<512 ; i++) { ind_block[i] = zone; if (!NEXT_BAD) goto end_bad; } inode->i_zone[8] = dind = get_free_block(); memset(dind_block,0,MINIX_BLOCK_SIZE); for (i=0 ; i<512 ; i++) { write_block(ind,(char *) ind_block); dind_block[i] = ind = get_free_block(); memset(ind_block,0,MINIX_BLOCK_SIZE); for (j=0 ; j<512 ; j++) { ind_block[j] = zone; if (!NEXT_BAD) goto end_bad; } } errx(MKFS_ERROR, _("%s: too many bad blocks"), device_name); end_bad: if (ind) write_block(ind, (char *) ind_block); if (dind) write_block(dind, (char *) dind_block); }
false
false
false
false
false
0
ocfs2_hamming_encode(u32 parity, void *data, unsigned int d, unsigned int nr) { unsigned int i, b, p = 0; BUG_ON(!d); /* * b is the hamming code bit number. Hamming code specifies a * 1-based array, but C uses 0-based. So 'i' is for C, and 'b' is * for the algorithm. * * The i++ in the for loop is so that the start offset passed * to ocfs2_find_next_bit_set() is one greater than the previously * found bit. */ for (i = 0; (i = ocfs2_find_next_bit(data, d, i)) < d; i++) { /* * i is the offset in this hunk, nr + i is the total bit * offset. */ b = calc_code_bit(nr + i, &p); /* * Data bits in the resultant code are checked by * parity bits that are part of the bit number * representation. Huh? * * <wikipedia href="http://en.wikipedia.org/wiki/Hamming_code"> * In other words, the parity bit at position 2^k * checks bits in positions having bit k set in * their binary representation. Conversely, for * instance, bit 13, i.e. 1101(2), is checked by * bits 1000(2) = 8, 0100(2)=4 and 0001(2) = 1. * </wikipedia> * * Note that 'k' is the _code_ bit number. 'b' in * our loop. */ parity ^= b; } /* While the data buffer was treated as little endian, the * return value is in host endian. */ return parity; }
false
false
false
false
false
0
gwy_combo_box_metric_unit_new(GCallback callback, gpointer cbdata, gint from, gint to, GwySIUnit *unit, gint active) { GtkWidget *combo; GwyEnum *entries; gint n; g_return_val_if_fail(GWY_IS_SI_UNIT(unit), NULL); if (!enum_quark) enum_quark = g_quark_from_static_string ("gwy-metric-unit-combo-box-enum"); entries = gwy_combo_box_metric_unit_make_enum(from, to, unit, &n); combo = gwy_enum_combo_box_new(entries, n, callback, cbdata, active, FALSE); g_object_set_qdata(G_OBJECT(combo), enum_quark, entries); g_signal_connect(combo, "destroy", G_CALLBACK(gwy_enum_combo_box_set_model), NULL); return combo; }
false
false
false
false
false
0
remove_obsolete_buildings(struct player *pplayer) { city_list_iterate(pplayer->cities, pcity) { remove_obsolete_buildings_city(pcity, FALSE); } city_list_iterate_end; }
false
false
false
false
false
0
_pack_update_resv_msg(resv_desc_msg_t * msg, Buf buffer, uint16_t protocol_version) { uint32_t array_len; xassert(msg != NULL); if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { packstr(msg->name, buffer); pack_time(msg->start_time, buffer); pack_time(msg->end_time, buffer); pack32(msg->duration, buffer); pack16(msg->flags, buffer); if (msg->node_cnt) { for (array_len = 0; msg->node_cnt[array_len]; array_len++) { /* determine array length */ } array_len++; /* Include trailing zero */ } else array_len = 0; pack32_array(msg->node_cnt, array_len, buffer); pack32(msg->core_cnt, buffer); packstr(msg->node_list, buffer); packstr(msg->features, buffer); packstr(msg->licenses, buffer); packstr(msg->partition, buffer); packstr(msg->users, buffer); packstr(msg->accounts, buffer); } else if (protocol_version >= SLURM_2_4_PROTOCOL_VERSION) { packstr(msg->name, buffer); pack_time(msg->start_time, buffer); pack_time(msg->end_time, buffer); pack32(msg->duration, buffer); pack16(msg->flags, buffer); if (msg->node_cnt) { for (array_len = 0; msg->node_cnt[array_len]; array_len++) { /* determine array length */ } array_len++; /* Include trailing zero */ } else array_len = 0; pack32_array(msg->node_cnt, array_len, buffer); pack32(msg->core_cnt, buffer); packstr(msg->node_list, buffer); packstr(msg->features, buffer); packstr(msg->licenses, buffer); packstr(msg->partition, buffer); packstr(msg->users, buffer); packstr(msg->accounts, buffer); } else if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) { packstr(msg->name, buffer); pack_time(msg->start_time, buffer); pack_time(msg->end_time, buffer); pack32(msg->duration, buffer); pack16(msg->flags, buffer); if (msg->node_cnt) pack32(msg->node_cnt[0], buffer); else pack32(NO_VAL, buffer); packstr(msg->node_list, buffer); packstr(msg->features, buffer); packstr(msg->licenses, buffer); packstr(msg->partition, buffer); packstr(msg->users, buffer); packstr(msg->accounts, buffer); } else { error("_pack_update_resv_msg: protocol_version " "%hu not supported", protocol_version); } }
false
false
false
false
false
0
queuepath(hfsvol *vol, char *path, darray *dirs, darray *files, int flags) { queueent ent; darray *array; if (hfs_stat(vol, path, &ent.dirent) == -1) { hfsutil_perrorp(path); return (errno == ENOENT) ? 0 : -1; } ent.path = path; ent.free = 0; array = ((ent.dirent.flags & HFS_ISDIR) && ! (flags & HLS_IMMEDIATE_DIRS)) ? dirs : files; if (darr_append(array, &ent) == 0) { fprintf(stderr, "%s: not enough memory\n", argv0); return -1; } return 0; }
false
false
false
false
false
0
F_switch_on_structure(ArgVal arg[]) { SwtTbl *t; SwtElt *elem; DEF_STR(str); DEF_INTEGER(arity); DEF_INTEGER(label); Args1(INTEGER(nb_elem)); t = Create_Switch_Table(TBL_STC, nb_elem); for (elem = t->elem; nb_elem--; elem++) { LOAD_STR(str); LOAD_INTEGER(arity); LOAD_INTEGER(label); elem->atom = BT_String_Add(&bt_atom, str); elem->n = arity; elem->label = label; } Inst_Printf("call_c", FAST "Switch_On_Structure(st(%d),%d)", nb_swt_tbl - 1, t->nb_elem); Inst_Printf("jump_ret", ""); }
false
false
false
false
false
0
Insert( const wxPlotData &source, int index ) const { wxCHECK_MSG( Ok() && source.Ok(), wxPlotData(), wxT("Invalid wxPlotData") ); wxPCHECK_MINMAX_MSG(index, 0, M_PLOTDATA->m_count, wxPlotData(), wxT("invalid index")); int count = M_PLOTDATA->m_count; int src_count = source.GetCount(); wxPlotData newCurve(count + src_count, false); if (!newCurve.Ok()) return newCurve; double *src_x_data = source.GetXData(); double *src_y_data = source.GetYData(); double *src_yi_data = source.GetYiData(); double *x_data = M_PLOTDATA->m_Xdata; double *y_data = M_PLOTDATA->m_Ydata; double *yi_data = M_PLOTDATA->m_Yidata; bool has_yi = false; if (yi_data && src_yi_data) { has_yi = true; double *yi = (double*)malloc((count+src_count)*sizeof(double)); if (!yi) { newCurve.Destroy(); return newCurve; } newCurve.SetYiData(yi); } double *new_Xdata = newCurve.GetXData(); double *new_Ydata = newCurve.GetYData(); double *new_Yidata = newCurve.GetYiData(); if (index > 0) { memcpy(new_Xdata, x_data, index*sizeof(double)); memcpy(new_Ydata, y_data, index*sizeof(double)); if (has_yi) memcpy(new_Yidata, yi_data, index*sizeof(double)); } memcpy(new_Xdata+index, src_x_data, src_count*sizeof(double)); memcpy(new_Ydata+index, src_y_data, src_count*sizeof(double)); if (has_yi) memcpy(new_Yidata+index, src_yi_data, src_count*sizeof(double)); memcpy(new_Xdata+index+src_count, x_data+index, (count-index)*sizeof(double)); memcpy(new_Ydata+index+src_count, y_data+index, (count-index)*sizeof(double)); if (has_yi) memcpy(new_Yidata+index+src_count, yi_data+index, (count-index)*sizeof(double)); newCurve.CalcBoundingRect(); newCurve.CopyExtra( *this ); return newCurve; }
false
false
false
false
false
0
bq2415x_get_vender_code(struct bq2415x_device *bq) { int ret; ret = bq2415x_exec_command(bq, BQ2415X_VENDER_CODE); if (ret < 0) return 0; /* convert to binary */ return (ret & 0x1) + ((ret >> 1) & 0x1) * 10 + ((ret >> 2) & 0x1) * 100; }
false
false
false
false
false
0
strcasecmp_internal(char * input1, char * input2) { if ( (input1==0) || (input2==0) ) { fprintf(stderr,"Error , calling strcasecmp_internal with null parameters \n"); return 1; } unsigned int len1 = strlen(input1); unsigned int len2 = strlen(input2); if (len1!=len2) { //mismatched lengths of strings , they can't be equal..! return 1; } char A; //<- character buffer for input1 char B; //<- character buffer for input2 int i=0; while (i<len1) //len1 and len2 are equal { A = toupper(input1[i]); B = toupper(input2[i]); if (A!=B) { return 1; } ++i; } //if we reached this point , there where no reasons //why input1 and input2 could not be equal.. return 0; }
false
false
false
false
false
0
fsl_spi_grlib_probe(struct device *dev) { struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct spi_master *master = dev_get_drvdata(dev); struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); struct fsl_spi_reg *reg_base = mpc8xxx_spi->reg_base; int mbits; u32 capabilities; capabilities = mpc8xxx_spi_read_reg(&reg_base->cap); mpc8xxx_spi->set_shifts = fsl_spi_grlib_set_shifts; mbits = SPCAP_MAXWLEN(capabilities); if (mbits) mpc8xxx_spi->max_bits_per_word = mbits + 1; mpc8xxx_spi->native_chipselects = 0; if (SPCAP_SSEN(capabilities)) { mpc8xxx_spi->native_chipselects = SPCAP_SSSZ(capabilities); mpc8xxx_spi_write_reg(&reg_base->slvsel, 0xffffffff); } master->num_chipselect = mpc8xxx_spi->native_chipselects; pdata->cs_control = fsl_spi_grlib_cs_control; }
false
false
false
false
false
0
scan_and_match(char *string, const char *pattern, unsigned flags) { char *loc; char *end; unsigned len = strlen(string); int early_exit; /* We can stop the scan early only if the string part * we are matching against is shrinking, and the pattern has * an unquoted "star" at the corresponding end. There are two cases. * Case 1: * "qwerty" does not match against pattern "*zy", * no point in trying to match "werty", "erty" etc: */ early_exit = (flags == (SCAN_MOVE_FROM_LEFT + SCAN_MATCH_RIGHT_HALF) && pattern[0] == '*'); if (flags & SCAN_MOVE_FROM_LEFT) { loc = string; end = string + len + 1; } else { loc = string + len; end = string - 1; if (flags == (SCAN_MOVE_FROM_RIGHT + SCAN_MATCH_LEFT_HALF)) { /* Case 2: * "qwerty" does not match against pattern "qz*", * no point in trying to match "qwert", "qwer" etc: */ const char *p = pattern + strlen(pattern); if (--p >= pattern && *p == '*') { early_exit = 1; while (--p >= pattern && *p == '\\') early_exit ^= 1; } } } while (loc != end) { char c; int r; c = *loc; if (flags & SCAN_MATCH_LEFT_HALF) { *loc = '\0'; r = fnmatch(pattern, string, 0); *loc = c; } else { r = fnmatch(pattern, loc, 0); } if (r == 0) /* match found */ return loc; if (early_exit) { #ifdef STANDALONE printf("(early exit) "); #endif break; } if (flags & SCAN_MOVE_FROM_LEFT) { loc++; } else { loc--; } } return NULL; }
false
false
false
false
false
0
mono_bitset_find_start (const MonoBitSet *set) { int i; for (i = 0; i < set->size / BITS_PER_CHUNK; ++i) { if (set->data [i]) return my_g_bit_nth_lsf_nomask (set->data [i]) + i * BITS_PER_CHUNK; } return -1; }
false
false
false
false
false
0
decide_unroll_constant_iterations (struct loop *loop, int flags) { unsigned nunroll, nunroll_by_av, best_copies, best_unroll = 0, n_copies, i; struct niter_desc *desc; double_int iterations; if (!(flags & UAP_UNROLL)) { /* We were not asked to, just return back silently. */ return; } if (dump_file) fprintf (dump_file, "\n;; Considering unrolling loop with constant " "number of iterations\n"); /* nunroll = total number of copies of the original loop body in unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */ nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / loop->ninsns; nunroll_by_av = PARAM_VALUE (PARAM_MAX_AVERAGE_UNROLLED_INSNS) / loop->av_ninsns; if (nunroll > nunroll_by_av) nunroll = nunroll_by_av; if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES)) nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES); /* Skip big loops. */ if (nunroll <= 1) { if (dump_file) fprintf (dump_file, ";; Not considering loop, is too big\n"); return; } /* Check for simple loops. */ desc = get_simple_loop_desc (loop); /* Check number of iterations. */ if (!desc->simple_p || !desc->const_iter || desc->assumptions) { if (dump_file) fprintf (dump_file, ";; Unable to prove that the loop iterates constant times\n"); return; } /* Check whether the loop rolls enough to consider. Consult also loop bounds and profile; in the case the loop has more than one exit it may well loop less than determined maximal number of iterations. */ if (desc->niter < 2 * nunroll || ((estimated_loop_iterations (loop, &iterations) || max_loop_iterations (loop, &iterations)) && iterations.ult (double_int::from_shwi (2 * nunroll)))) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); return; } /* Success; now compute number of iterations to unroll. We alter nunroll so that as few as possible copies of loop body are necessary, while still not decreasing the number of unrollings too much (at most by 1). */ best_copies = 2 * nunroll + 10; i = 2 * nunroll + 2; if (i - 1 >= desc->niter) i = desc->niter - 2; for (; i >= nunroll - 1; i--) { unsigned exit_mod = desc->niter % (i + 1); if (!loop_exit_at_end_p (loop)) n_copies = exit_mod + i + 1; else if (exit_mod != (unsigned) i || desc->noloop_assumptions != NULL_RTX) n_copies = exit_mod + i + 2; else n_copies = i + 1; if (n_copies < best_copies) { best_copies = n_copies; best_unroll = i; } } loop->lpt_decision.decision = LPT_UNROLL_CONSTANT; loop->lpt_decision.times = best_unroll; }
false
false
false
false
false
0
get_suitable_record_to_view_details(const Gnome::Gda::Value& primary_key_value, Glib::ustring& table_name, Gnome::Gda::Value& table_primary_key_value) const { //Initialize output parameters: table_name = Glib::ustring(); table_primary_key_value = Gnome::Gda::Value(); if(!m_portal) return; const Document* document = get_document(); if(!document) return; Glib::ustring navigation_table_name; sharedptr<const UsesRelationship> navigation_relationship; m_portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, document); //if(navigation_relationship && navigation_relationship->get_relationship()) // std::cout << "debug: navigation_relationship=" << navigation_relationship->get_relationship()->get_name() << std::endl; //if(navigation_relationship && navigation_relationship->get_related_relationship()) // std::cout << "debug: navigation_related_relationship=" << navigation_relationship->get_related_relationship()->get_name() << std::endl; if(navigation_table_name.empty()) return; //Get the primary key of that table: sharedptr<Field> navigation_table_primary_key = get_field_primary_key_for_table(navigation_table_name); //Build a layout item to get the field's value: sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create(); layout_item->set_full_field_details(navigation_table_primary_key); if(navigation_relationship) { layout_item->set_relationship( navigation_relationship->get_relationship() ); //std::cout << "debug: navigation_relationship->get_relationship()= " << navigation_relationship->get_relationship()->get_name() << std::endl; layout_item->set_related_relationship( navigation_relationship->get_related_relationship() ); } //Get the value of the navigation related primary key: type_vecLayoutFields fieldsToGet; fieldsToGet.push_back(layout_item); //For instance "invoice_line_id" if this is a portal to an "invoice_lines" table: const Glib::ustring related_table = m_portal->get_table_used(Glib::ustring() /* not relevant */); sharedptr<const Field> key_field = get_field_primary_key_for_table(related_table); //std::cout << "DEBUG: related table=" << related_table << ", whose primary_key=" << key_field->get_name() << ", with value=" << primary_key_value.to_string() << "getting value for: " << layout_item->get_layout_display_name() << std::endl; Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(related_table, fieldsToGet, key_field, primary_key_value); Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(query); bool value_found = true; if(data_model && data_model->get_n_rows() && data_model->get_n_columns()) { //Set the output parameters: table_name = navigation_table_name; table_primary_key_value = data_model->get_value_at(0, 0); //std::cout << "debug: " << G_STRFUNC << ": table_primary_key_value=" << table_primary_key_value.to_string() << std::endl; //The value is empty when there there is no record to match the key in the related table: //For instance, if an invoice lines record mentions a product id, but the product does not exist in the products table. if(Conversions::value_is_empty(table_primary_key_value)) { value_found = false; std::cout << "debug: " << G_STRFUNC << ": SQL query returned empty primary key." << std::endl; } } else { value_found = false; std::cout << "DEBUG: Box_Data_Portal::get_suitable_record_to_view_details(): SQL query returned no suitable primary key. table=" << related_table << ", field=" << layout_item->get_layout_display_name() << ", key_field=" << key_field->get_name() << ", primary_key_value=" << primary_key_value.to_string() << std::endl; std::cout << " DEBUG: SQL was: " << query << std::endl; } if(!value_found) { //Clear the output parameters: table_name = Glib::ustring(); table_primary_key_value = Gnome::Gda::Value(); Gtk::Window* window = const_cast<Gtk::Window*>(get_app_window()); if(window) Frame_Glom::show_ok_dialog(_("No Corresponding Record Exists"), _("No record with this value exists. Therefore navigation to the related record is not possible."), *window, Gtk::MESSAGE_WARNING); //TODO: Make it more clear to the user exactly what record, what field, and what value, we are talking about. } }
false
false
false
false
false
0
_gtk_marshal_VOID__BOXED_BOXEDv (GClosure *closure, GValue *return_value, gpointer instance, va_list args, gpointer marshal_data, int n_params, GType *param_types) { typedef void (*GMarshalFunc_VOID__BOXED_BOXED) (gpointer instance, gpointer arg_0, gpointer arg_1, gpointer data); GCClosure *cc = (GCClosure*) closure; gpointer data1, data2; GMarshalFunc_VOID__BOXED_BOXED callback; gpointer arg0; gpointer arg1; va_list args_copy; G_VA_COPY (args_copy, args); arg0 = (gpointer) va_arg (args_copy, gpointer); if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) arg0 = g_boxed_copy (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg0); arg1 = (gpointer) va_arg (args_copy, gpointer); if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) arg1 = g_boxed_copy (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); va_end (args_copy); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = instance; } else { data1 = instance; data2 = closure->data; } callback = (GMarshalFunc_VOID__BOXED_BOXED) (marshal_data ? marshal_data : cc->callback); callback (data1, arg0, arg1, data2); if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) g_boxed_free (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg0); if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) g_boxed_free (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); }
false
false
false
false
false
0
clearDiagnosticText() { QMutexLocker locker(&logMutex); dtext = QString(); }
false
false
false
false
false
0
LI32__MATCH_DIMENSIONS__predlib(V293,V294) object V293;register object V294; { VMB32 VMS32 VMV32 goto TTL; TTL:; if(((V293))!=Cnil){ goto T1348;} {object V295 = (((V294))==Cnil?Ct:Cnil); VMR32(V295)} goto T1348; T1348:; if(!((car((V294)))==(((object)VV[19])))){ goto T1352;} goto T1350; goto T1352; T1352:; if(eql(car((V293)),car((V294)))){ goto T1350;} {object V296 = Cnil; VMR32(V296)} goto T1350; T1350:; V293= cdr((V293)); V294= cdr((V294)); goto TTL; return Cnil; }
false
false
false
false
false
0
rgbFromWaveLength(const double wave) { double r = 0.0; double g = 0.0; double b = 0.0; if (wave >= 380.0 && wave <= 440.0) { r = -1.0 * (wave - 440.0) / (440.0 - 380.0); b = 1.0; } else if (wave >= 440.0 && wave <= 490.0) { g = (wave - 440.0) / (490.0 - 440.0); b = 1.0; } else if (wave >= 490.0 && wave <= 510.0) { g = 1.0; b = -1.0 * (wave - 510.0) / (510.0 - 490.0); } else if (wave >= 510.0 && wave <= 580.0) { r = (wave - 510.0) / (580.0 - 510.0); g = 1.0; } else if (wave >= 580.0 && wave <= 645.0) { r = 1.0; g = -1.0 * (wave - 645.0) / (645.0 - 580.0); } else if (wave >= 645.0 && wave <= 780.0) { r = 1.0; } double s = 1.0; if (wave > 700.0) { s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0); } else if (wave < 420.0) { s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0); } r = pow(r * s, 0.8); g = pow(g * s, 0.8); b = pow(b * s, 0.8); return qRgb(int(r * 255), int(g * 255), int(b * 255)); }
false
false
false
false
false
0
sys_msgrcv(struct tcb *tcp) { if (entering(tcp)) { tprintf("%d, ", (int) tcp->u_arg[0]); } else { if (indirect_ipccall(tcp)) { struct ipc_wrapper { struct msgbuf *msgp; long msgtyp; } tmp; if (umove(tcp, tcp->u_arg[3], &tmp) < 0) { tprintf("%#lx, %lu, ", tcp->u_arg[3], tcp->u_arg[1]); } else { tprint_msgrcv(tcp, (long) tmp.msgp, tcp->u_arg[1], tmp.msgtyp); } printflags(msg_flags, tcp->u_arg[2], "MSG_???"); } else { tprint_msgrcv(tcp, tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); printflags(msg_flags, tcp->u_arg[4], "MSG_???"); } } return 0; }
false
false
false
false
false
0
PQconnectStartParams(const char *const * keywords, const char *const * values, int expand_dbname) { PGconn *conn; PQconninfoOption *connOptions; /* * Allocate memory for the conn structure */ conn = makeEmptyPGconn(); if (conn == NULL) return NULL; /* * Parse the conninfo arrays */ connOptions = conninfo_array_parse(keywords, values, &conn->errorMessage, true, expand_dbname); if (connOptions == NULL) { conn->status = CONNECTION_BAD; /* errorMessage is already set */ return conn; } /* * Move option values into conn structure */ if (!fillPGconn(conn, connOptions)) { PQconninfoFree(connOptions); return conn; } /* * Free the option info - all is in conn now */ PQconninfoFree(connOptions); /* * Compute derived options */ if (!connectOptions2(conn)) return conn; /* * Connect to the database */ if (!connectDBStart(conn)) { /* Just in case we failed to set it in connectDBStart */ conn->status = CONNECTION_BAD; } return conn; }
false
false
false
false
false
0
gnc_tree_model_account_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter) { GncTreeModelAccount *model; gint num; g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (tree_model), FALSE); ENTER("model %p, iter %s", tree_model, iter_to_string(iter)); model = GNC_TREE_MODEL_ACCOUNT (tree_model); if (iter == NULL) { /* How many children does the invisible root node * have. One! Its the real root account node. */ LEAVE("count is 1"); return 1; } gnc_leave_return_val_if_fail (iter != NULL, FALSE); gnc_leave_return_val_if_fail (iter->user_data != NULL, FALSE); gnc_leave_return_val_if_fail (iter->stamp == model->stamp, FALSE); num = gnc_account_n_children(iter->user_data); LEAVE("count is %d", num); return num; }
false
false
false
false
false
0
Trspi_Encrypt_ECB(UINT16 alg, BYTE *key, BYTE *in, UINT32 in_len, BYTE *out, UINT32 *out_len) { TSS_RESULT result = TSS_SUCCESS; EVP_CIPHER_CTX ctx; UINT32 tmp; switch (alg) { case TSS_ALG_AES: break; default: result = TSPERR(TSS_E_INTERNAL_ERROR); goto done; break; } EVP_CIPHER_CTX_init(&ctx); if (!EVP_EncryptInit(&ctx, EVP_aes_256_ecb(), key, NULL)) { result = TSPERR(TSS_E_INTERNAL_ERROR); DEBUG_print_openssl_errors(); goto done; } if (*out_len < in_len + EVP_CIPHER_CTX_block_size(&ctx) - 1) { result = TSPERR(TSS_E_INTERNAL_ERROR); goto done; } if (!EVP_EncryptUpdate(&ctx, out, (int *)out_len, in, in_len)) { result = TSPERR(TSS_E_INTERNAL_ERROR); DEBUG_print_openssl_errors(); goto done; } if (!EVP_EncryptFinal(&ctx, out + *out_len, (int *)&tmp)) { result = TSPERR(TSS_E_INTERNAL_ERROR); DEBUG_print_openssl_errors(); goto done; } *out_len += tmp; done: EVP_CIPHER_CTX_cleanup(&ctx); return result; }
false
false
false
false
false
0
nClusterings() { if (!mother) return 0; int w = mother->nClusterings(); w += 1; return w; }
false
false
false
false
false
0
startElement_HOSTS(void *data, const char *el, const char **attr) { xmldata_t *xmldata = (xmldata_t *)data; int i; struct xml_tag *xt; /* In non-scalable mode, we do not process summary data. */ if (!gmetad_config.scalable_mode) return 0; /* Add up/down hosts to this grid summary */ for(i = 0; attr[i]; i+=2) { xt = in_xml_list (attr[i], strlen(attr[i])); if (!xt) continue; switch( xt->tag ) { case UP_TAG: xmldata->source.hosts_up += strtoul(attr[i+1], (char **) NULL, 10); break; case DOWN_TAG: xmldata->source.hosts_down += strtoul(attr[i+1], (char **) NULL, 10); break; default: break; } } return 0; }
false
false
false
false
false
0
abi_widget_save ( AbiWidget * w, const char * fname, const char * extension_or_mimetype, const char * exp_props) { UT_return_val_if_fail ( w != NULL, FALSE ); UT_return_val_if_fail ( IS_ABI_WIDGET(w), FALSE ); UT_return_val_if_fail ( w->priv->m_pDoc, FALSE ); UT_return_val_if_fail ( fname != NULL, FALSE ); IEFileType ieft = s_abi_widget_get_file_type(extension_or_mimetype, NULL, 0, false); return static_cast<AD_Document*>(w->priv->m_pDoc)->saveAs ( fname, ieft, false, (!exp_props || *exp_props == '\0' ? NULL : exp_props) ) == UT_OK ? TRUE : FALSE; }
false
false
false
false
false
0
free_element(EL *el, MESH *mesh) { free_dof_ptrs(el->dof, mesh); if(mesh->dim > 1 && el->new_coord) { free_real_d(mesh, el->new_coord); el->new_coord = nil; } if (el->child[1]) AI_free_leaf_data((void *) el->child[1], mesh); freeMemory(el, ((MESH_MEM_INFO*)(mesh->mem_info))->element); }
false
false
false
false
false
0
uncompress_recover(unsigned char *dest, ulong destlen, unsigned char *source, ulong sourcelen) { int byte, bit; ulong retlen = destlen; int good_decomp = 0, good_rv = -1; /* Generate all single bit errors */ if (sourcelen > 16384) { lkcd_print("uncompress_recover: sourcelen %ld too long\n", sourcelen); return(-1); } for (byte = 0; byte < sourcelen; byte++) { for (bit = 0; bit < 8; bit++) { source[byte] ^= (1 << bit); if (uncompress(dest, &retlen, source, sourcelen) == Z_OK && retlen == destlen) { good_decomp++; lkcd_print("good for flipping byte %d bit %d\n", byte, bit); good_rv = bit + byte * 8; } /* Put it back */ source[byte] ^= (1 << bit); } } if (good_decomp == 0) { lkcd_print("Could not correct gzip errors.\n"); return -2; } else if (good_decomp > 1) { lkcd_print("Too many valid gzip decompressions: %d.\n", good_decomp); return -3; } else { source[good_rv >> 8] ^= 1 << (good_rv % 8); uncompress(dest, &retlen, source, sourcelen); source[good_rv >> 8] ^= 1 << (good_rv % 8); return good_rv; } }
false
false
false
false
false
0
DivExactD1(unsigned long * c, long n) { unsigned long t = 0; long i; for (i = 0; i < n; i++) { t ^= (c[i] >> 1) | ((i + 1 < n) ? (c[i + 1] << (GF2X_WORDSIZE - 1)) : 0); t ^= t << 3 ^ t << 6; t ^= t << 9 ^ t << 18; t ^= t << 27 #if (GF2X_WORDSIZE == 64) ^ t << 54 #elif (GF2X_WORDSIZE != 32) #error "GF2X_WORDSIZE should be 32 or 64" #endif ; c[i] = t; t >>= (GF2X_WORDSIZE - 3); } return t; }
false
false
false
false
false
0
UpdateCRC(unsigned long crc, const unsigned char *buf, size_t len) { unsigned long c = crc ^ 0xffffffffL; unsigned n; if (!crc_table_computed) MakeCRCTable(); for (n = 0; n < len; n++) { c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8); } return c ^ 0xffffffffL; }
false
false
false
false
false
0
slotTextChanged(const QString &/*string*/) { element()->m_value = KUrl( widget()->url() ).pathOrUrl(); }
false
false
false
false
false
0
unpack16(uint16_t * valp, Buf buffer) { uint16_t ns; if (remaining_buf(buffer) < sizeof(ns)) return SLURM_ERROR; memcpy(&ns, &buffer->head[buffer->processed], sizeof(ns)); *valp = ntohs(ns); buffer->processed += sizeof(ns); return SLURM_SUCCESS; }
false
false
false
false
false
0
miner_finalize (GObject *object) { TrackerMiner *miner = TRACKER_MINER (object); if (miner->priv->update_id != 0) { g_source_remove (miner->priv->update_id); } if (miner->priv->watch_name_id != 0) { g_bus_unwatch_name (miner->priv->watch_name_id); } if (miner->priv->registration_id != 0) { g_dbus_connection_unregister_object (miner->priv->d_connection, miner->priv->registration_id); } if (miner->priv->introspection_data) { g_dbus_node_info_unref (miner->priv->introspection_data); } if (miner->priv->d_connection) { g_object_unref (miner->priv->d_connection); } g_free (miner->priv->status); g_free (miner->priv->name); g_free (miner->priv->full_name); g_free (miner->priv->full_path); if (miner->priv->connection) { g_object_unref (miner->priv->connection); } if (miner->priv->pauses) { g_hash_table_unref (miner->priv->pauses); } G_OBJECT_CLASS (tracker_miner_parent_class)->finalize (object); }
false
false
false
false
false
0
show(AW_device *device) { if (gen_root) { #if defined(DEBUG) && 0 fprintf(stderr, "GEN_graphic::show\n"); #endif // DEBUG gen_root->paint(device); } else { device->line(GEN_GC_DEFAULT, -100,-100,100,100); device->line(GEN_GC_DEFAULT, -100,100,100,-100); } }
false
false
false
false
false
0
ecm_alloc_inst(void) { struct f_ecm_opts *opts; opts = kzalloc(sizeof(*opts), GFP_KERNEL); if (!opts) return ERR_PTR(-ENOMEM); mutex_init(&opts->lock); opts->func_inst.free_func_inst = ecm_free_inst; opts->net = gether_setup_default(); if (IS_ERR(opts->net)) { struct net_device *net = opts->net; kfree(opts); return ERR_CAST(net); } config_group_init_type_name(&opts->func_inst.group, "", &ecm_func_type); return &opts->func_inst; }
false
false
false
false
false
0
allocation_grow(struct allocation **alloc, unsigned int *size) { void *ptr = realloc(*alloc, (*size * 2 + 1) * sizeof(**alloc)); if (ptr) { *alloc = ptr; *size = *size * 2 + 1; return 1; } else { return 0; } }
false
false
false
false
false
0
cb_alert_config_button(GtkWidget *button, NetMon *net) { gboolean read, write; read = GTK_TOGGLE_BUTTON(net->alert_config_rx_button)->active; write = GTK_TOGGLE_BUTTON(net->alert_config_tx_button)->active; if (!read && !write) { gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(net->alert_config_rx_button), TRUE); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(net->alert_config_tx_button), TRUE); } }
false
true
false
false
true
1
iconSizes() const { if( p->icon_sizes == NULL ) { p->icon_sizes = new int[ p->icon_count * 2 + 2 ]; for( int i = 0; i < p->icon_count; ++i ) { p->icon_sizes[ i * 2 ] = p->icons[ i ].size.width; p->icon_sizes[ i * 2 + 1 ] = p->icons[ i ].size.height; } p->icon_sizes[ p->icon_count * 2 ] = 0; // terminator p->icon_sizes[ p->icon_count * 2 + 1 ] = 0; } return p->icon_sizes; }
false
false
false
false
false
0
FindObject_with_Path(HIDDesc_t *pDesc, HIDPath_t *Path, uint8_t Type) { int i; for (i = 0; i < pDesc->nitems; i++) { HIDData_t *pData = &pDesc->item[i]; if (pData->Type != Type) { continue; } if (memcmp(pData->Path.Node, Path->Node, (Path->Size) * sizeof(HIDNode_t))) { continue; } return pData; } return NULL; }
false
false
false
false
false
0
L12() {register object *base=vs_base; register object *sup=base+VM12; VC12 vs_check; {object V77; object V78; object V79; object V80; object V81; V77=(base[0]); V78=(base[1]); V79=(base[2]); V80=(base[3]); V81=(base[4]); vs_top=sup; goto TTL; TTL:; {object V82; V82= ((V81))->v.v_self[(long)33]; base[5]= CMPcar((V82)); base[6]= (V77); {object V83; V83= ((V81))->v.v_self[(long)9]; base[8]= CMPcar((V83)); base[9]= (V78); base[10]= CMPcdr((V83)); vs_top=(vs_base=base+9)+2; super_funcall_no_event(base[8]); vs_top=sup; base[7]= vs_base[0];} base[8]= (V79); base[9]= (V80); base[10]= CMPcdr((V82)); vs_top=(vs_base=base+6)+5; super_funcall_no_event(base[5]); return;} } }
false
false
false
false
false
0
AcpiTbResizeRootTableList ( void) { ACPI_TABLE_DESC *Tables; UINT32 TableCount; ACPI_FUNCTION_TRACE (TbResizeRootTableList); /* AllowResize flag is a parameter to AcpiInitializeTables */ if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE)) { ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed")); return_ACPI_STATUS (AE_SUPPORT); } /* Increase the Table Array size */ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) { TableCount = AcpiGbl_RootTableList.MaxTableCount; } else { TableCount = AcpiGbl_RootTableList.CurrentTableCount; } Tables = ACPI_ALLOCATE_ZEROED ( ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) * sizeof (ACPI_TABLE_DESC)); if (!Tables) { ACPI_ERROR ((AE_INFO, "Could not allocate new root table array")); return_ACPI_STATUS (AE_NO_MEMORY); } /* Copy and free the previous table array */ if (AcpiGbl_RootTableList.Tables) { ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) { ACPI_FREE (AcpiGbl_RootTableList.Tables); } } AcpiGbl_RootTableList.Tables = Tables; AcpiGbl_RootTableList.MaxTableCount = TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; return_ACPI_STATUS (AE_OK); }
false
false
false
false
false
0
readFromDAQ( std::vector<mrpt::obs::CObservationRawDAQPtr> &outObservations, bool &hardwareError ) { hardwareError = false; outObservations.clear(); if ( !checkDAQIsWorking() ) { hardwareError = true; return; } // Read from the pipe: m_state = ssWorking; for (list<TInfoPerTask>::iterator it=m_running_tasks.begin();it!=m_running_tasks.end();++it) { CObservationRawDAQ tmp_obs; try { if (it->new_obs_available!=0) { it->read_pipe->ReadObject(&tmp_obs); --(it->new_obs_available); // Yes, valid block of samples was adquired: outObservations.push_back(CObservationRawDAQPtr(new CObservationRawDAQ(tmp_obs))); } } catch (...) { // Timeout... } } }
false
false
false
false
false
0
FileSSLAccept(CONSFILE *cfp) #else FileSSLAccept(cfp) CONSFILE *cfp; #endif { int retval; if (cfp->waitForWrite == FLAGTRUE) { cfp->waitForWrite = FLAGFALSE; if (cfp->wbuf->used <= 1) FD_CLR(cfp->fd, &winit); } cfp->waitForRead = FLAGFALSE; CONDDEBUG((1, "FileSSLAccept(): about to SSL_accept() for fd %d", cfp->fd)); retval = SSL_accept(cfp->ssl); switch (SSL_get_error(cfp->ssl, retval)) { case SSL_ERROR_NONE: break; case SSL_ERROR_WANT_READ: cfp->waitForRead = FLAGTRUE; return 0; case SSL_ERROR_WANT_WRITE: cfp->waitForWrite = FLAGTRUE; FD_SET(cfp->fd, &winit); return 0; default: Error("FileSSLAccept(): SSL error on fd %d", cfp->fd); /* fall through */ case SSL_ERROR_ZERO_RETURN: SSL_free(cfp->ssl); cfp->ssl = (SSL *)0; cfp->ftype = simpleSocket; return -1; } cfp->ftype = SSLSocket; CONDDEBUG((1, "FileSSLAccept(): SSL Connection: %s :: %s", SSL_get_cipher_version(cfp->ssl), SSL_get_cipher_name(cfp->ssl))); return 1; }
false
false
false
false
false
0
seckeys_free(struct seckeys *sk) { int i; g_assert(sk); for (i = 0; i < sk->scnt; i++) { kuid_t *id = sk->skeys[i]; kuid_atom_free(id); } knode_free(sk->kn); WFREE_ARRAY(sk->skeys, sk->scnt); WFREE(sk); }
false
false
false
false
false
0
finish_create_config_async_sucess (GObject *source_object, GAsyncResult *res, gpointer user_data) { GMainLoop *loop = (GMainLoop *)user_data; GError *error = NULL; IBusConfig *config = ibus_config_new_async_finish (res, &error); g_assert (IBUS_IS_CONFIG (config)); /* Since we reuse single D-Bus connection, we need to remove the default match rule for the next ibus_config_new() call. */ ibus_config_unwatch (config, NULL, NULL); g_object_unref (config); if (--create_config_count == 0) g_main_loop_quit (loop); }
false
false
false
false
false
0
congen_s_fetch(register congen_susp_type susp, snd_list_type snd_list) { int cnt = 0; /* how many samples computed */ int togo; int n; sample_block_type out; register sample_block_values_type out_ptr; register sample_block_values_type out_ptr_reg; register double value_reg; register double rise_factor_reg; register double fall_factor_reg; register sample_type sndin_scale_reg = susp->sndin->scale; register sample_block_values_type sndin_ptr_reg; falloc_sample_block(out, "congen_s_fetch"); out_ptr = out->samples; snd_list->block = out; while (cnt < max_sample_block_len) { /* outer loop */ /* first compute how many samples to generate in inner loop: */ /* don't overflow the output sample block: */ togo = max_sample_block_len - cnt; /* don't run past the sndin input sample block: */ susp_check_term_samples(sndin, sndin_ptr, sndin_cnt); togo = min(togo, susp->sndin_cnt); /* don't run past terminate time */ if (susp->terminate_cnt != UNKNOWN && susp->terminate_cnt <= susp->susp.current + cnt + togo) { togo = susp->terminate_cnt - (susp->susp.current + cnt); if (togo == 0) break; } n = togo; value_reg = susp->value; rise_factor_reg = susp->rise_factor; fall_factor_reg = susp->fall_factor; sndin_ptr_reg = susp->sndin_ptr; out_ptr_reg = out_ptr; if (n) do { /* the inner sample computation loop */ sample_type current = (sndin_scale_reg * *sndin_ptr_reg++); if (current > value_reg) { value_reg = current - (current - value_reg) * rise_factor_reg; } else { value_reg = current - (current - value_reg) * fall_factor_reg; } *out_ptr_reg++ = (sample_type) value_reg;; } while (--n); /* inner loop */ susp->value = value_reg; /* using sndin_ptr_reg is a bad idea on RS/6000: */ susp->sndin_ptr += togo; out_ptr += togo; susp_took(sndin_cnt, togo); cnt += togo; } /* outer loop */ /* test for termination */ if (togo == 0 && cnt == 0) { snd_list_terminate(snd_list); } else { snd_list->block_len = cnt; susp->susp.current += cnt; } }
false
false
false
false
false
0