idx
int64
func
string
target
int64
314,983
poppler_page_get_form_field_mapping (PopplerPage *page) { GList *map_list = NULL; FormPageWidgets *forms; gint i; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); forms = page->page->getPageWidgets (); if (forms == NULL) return NULL; for (i = 0; i < forms->getNumWidgets (); i++) { PopplerFormFieldMapping *mapping; FormWidget *field; mapping = poppler_form_field_mapping_new (); field = forms->getWidget (i); mapping->field = _poppler_form_field_new (page->document, field); field->getRect (&(mapping->area.x1), &(mapping->area.y1), &(mapping->area.x2), &(mapping->area.y2)); mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } return map_list; }
0
270,767
int cil_resolve_classmapping(struct cil_tree_node *current, void *extra_args) { int rc = SEPOL_ERR; struct cil_classmapping *mapping = current->data; struct cil_class *map = NULL; struct cil_perm *mp = NULL; struct cil_symtab_datum *datum = NULL; struct cil_list_item *curr; rc = cil_resolve_name(current, mapping->map_class_str, CIL_SYM_CLASSES, extra_args, &datum); if (rc != SEPOL_OK) { goto exit; } map = (struct cil_class*)datum; rc = cil_symtab_get_datum(&map->perms, mapping->map_perm_str, &datum); if (rc != SEPOL_OK) { goto exit; } mp = (struct cil_perm*)datum; rc = cil_resolve_classperms_list(current, mapping->classperms, extra_args); if (rc != SEPOL_OK) { goto exit; } if (mp->classperms == NULL) { cil_list_init(&mp->classperms, CIL_CLASSPERMS); } cil_list_for_each(curr, mapping->classperms) { cil_list_append(mp->classperms, curr->flavor, curr->data); } return SEPOL_OK; exit: return rc; }
0
267,992
SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size) { int err; struct kernel_clone_args kargs; pid_t set_tid[MAX_PID_NS_LEVEL]; kargs.set_tid = set_tid; err = copy_clone_args_from_user(&kargs, uargs, size); if (err) return err; if (!clone3_args_valid(&kargs)) return -EINVAL; return kernel_clone(&kargs); }
0
195,511
static void ipa_device_begin(wmfAPI * API) { char comment[MaxTextExtent]; wmf_magick_t *ddata = WMF_MAGICK_GetData(API); /* Make SVG output happy */ (void) PushDrawingWand(WmfDrawingWand); DrawSetViewbox(WmfDrawingWand, 0, 0, ddata->image->columns, ddata->image->rows ); (void) FormatLocaleString(comment,MaxTextExtent,"Created by ImageMagick %s", GetMagickVersion((size_t *) NULL)); DrawComment(WmfDrawingWand,comment); /* Scale width and height to image */ DrawScale(WmfDrawingWand, ddata->scale_x, ddata->scale_y); /* Translate to TL corner of bounding box */ DrawTranslate(WmfDrawingWand, ddata->translate_x, ddata->translate_y); /* Apply rotation */ DrawRotate(WmfDrawingWand, ddata->rotate); if (ddata->image_info->texture == NULL) { PixelWand *background_color; /* Draw rectangle in background color */ background_color=NewPixelWand(); PixelSetQuantumColor(background_color,&ddata->image->background_color); DrawSetFillColor(WmfDrawingWand,background_color); background_color=DestroyPixelWand(background_color); DrawRectangle(WmfDrawingWand, XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y), XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y)); } else { /* Draw rectangle with texture image the SVG way */ Image *image; ImageInfo *image_info; ExceptionInfo *exception; exception=AcquireExceptionInfo(); image_info = CloneImageInfo((ImageInfo *) 0); (void) CopyMagickString(image_info->filename,ddata->image_info->texture, MaxTextExtent); if ( ddata->image_info->size ) CloneString(&image_info->size,ddata->image_info->size); image = ReadImage(image_info,exception); image_info=DestroyImageInfo(image_info); if (image) { char pattern_id[30]; MagickWand *magick_wand; (void) CopyMagickString(image->magick,"MIFF",MaxTextExtent); DrawPushDefs(WmfDrawingWand); draw_pattern_push(API,ddata->pattern_id,image->columns,image->rows); magick_wand=NewMagickWandFromImage(image); (void) DrawComposite(WmfDrawingWand,CopyCompositeOp,0,0, image->columns,image->rows,magick_wand); magick_wand=DestroyMagickWand(magick_wand); (void) DrawPopPattern(WmfDrawingWand); DrawPopDefs(WmfDrawingWand); (void) FormatLocaleString(pattern_id,MaxTextExtent,"#brush_%lu", ddata->pattern_id); (void) DrawSetFillPatternURL(WmfDrawingWand,pattern_id); ++ddata->pattern_id; DrawRectangle(WmfDrawingWand, XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y), XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y)); image=DestroyImageList(image); } else { LogMagickEvent(CoderEvent,GetMagickModule(), "reading texture image failed!"); InheritException(&ddata->image->exception,exception); } (void) DestroyExceptionInfo(exception); } DrawSetClipRule(WmfDrawingWand,EvenOddRule); /* Default for WMF is ALTERNATE polygon fill mode */ draw_fill_color_string(WmfDrawingWand,"none"); /* Default brush is WHITE_BRUSH */ draw_stroke_color_string(WmfDrawingWand,"none"); /* Default pen is BLACK_PEN */ DrawSetStrokeLineCap(WmfDrawingWand,ButtCap); /* Default linecap is PS_ENDCAP_FLAT */ DrawSetStrokeLineJoin(WmfDrawingWand,MiterJoin); /* Default linejoin is PS_JOIN_MITER */ draw_under_color_string(WmfDrawingWand,"white"); /* Default text box is white */ }
0
5,583
static int amd_gpio_remove(struct platform_device *pdev) { struct amd_gpio *gpio_dev; gpio_dev = platform_get_drvdata(pdev); gpiochip_remove(&gpio_dev->gc); pinctrl_unregister(gpio_dev->pctrl); return 0; }
1
264,665
void bpf_register_map_type(struct bpf_map_type_list *tl) { list_add(&tl->list_node, &bpf_map_types); }
0
5,351
static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev) { struct rtnl_link_ifmap map = { .mem_start = dev->mem_start, .mem_end = dev->mem_end, .base_addr = dev->base_addr, .irq = dev->irq, .dma = dev->dma, .port = dev->if_port, }; if (nla_put(skb, IFLA_MAP, sizeof(map), &map)) return -EMSGSIZE; return 0; }
1
94,499
static BOOL rdp_write_desktop_composition_capability_set(wStream* s, const rdpSettings* settings) { size_t header; UINT16 compDeskSupportLevel; if (!Stream_EnsureRemainingCapacity(s, 32)) return FALSE; header = rdp_capability_set_start(s); compDeskSupportLevel = (settings->AllowDesktopComposition) ? COMPDESK_SUPPORTED : COMPDESK_NOT_SUPPORTED; Stream_Write_UINT16(s, compDeskSupportLevel); /* compDeskSupportLevel (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_COMP_DESK); return TRUE; }
0
12,720
GURL GetFileManagerBaseUrl() { return GetFileManagerUrl("/"); }
1
491,234
TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; UINT32 i; if (rc == TPM_RC_SUCCESS) { rc = UINT32_Unmarshal(&target->count, buffer, size); } if (rc == TPM_RC_SUCCESS) { if (target->count > MAX_CAP_CC) { rc = TPM_RC_SIZE; target->count = 0; // libtpms added } } for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) { rc = TPM_CC_Unmarshal(&target->commandCodes[i], buffer, size); } return rc; }
0
10,150
std::unique_ptr<SymmetricKey> CopyDefaultPaddingKey() { return SymmetricKey::Import(kPaddingKeyAlgorithm, (*GetPaddingKey())->key()); }
1
420,078
check_and_set_stop_copy(struct nfsd4_copy *copy) { bool value; spin_lock(&copy->cp_clp->async_lock); value = copy->stopped; if (!copy->stopped) copy->stopped = true; spin_unlock(&copy->cp_clp->async_lock); return value; }
0
144,965
static int aac_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) { struct Scsi_Host *host = cmd->device->host; struct aac_dev *dev = (struct aac_dev *)host->hostdata; u32 count = 0; cmd->scsi_done = done; for (; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { struct fib * fib = &dev->fibs[count]; struct scsi_cmnd * command; if (fib->hw_fib_va->header.XferState && ((command = fib->callback_data)) && (command == cmd) && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) return 0; /* Already owned by Adapter */ } cmd->SCp.phase = AAC_OWNER_LOWLEVEL; return (aac_scsi_cmd(cmd) ? FAILED : 0); }
0
49,357
void Parser::TrackAssignment(ParseNodePtr pnodeT, IdentToken* pToken) { if (buildAST) { Assert(pnodeT != nullptr); if (pnodeT->nop == knopName) { PidRefStack *ref = pnodeT->sxPid.pid->GetTopRef(); Assert(ref); ref->isAsg = true; } } else { Assert(pToken != nullptr); if (pToken->tk == tkID) { PidRefStack *ref = pToken->pid->GetTopRef(); Assert(ref); ref->isAsg = true; } } }
0
132,876
Pl_AES_PDF::useStaticIV() { use_static_iv = true; }
0
166,422
e1000e_is_tcp_ack(E1000ECore *core, struct NetRxPkt *rx_pkt) { if (!net_rx_pkt_is_tcp_ack(rx_pkt)) { return false; } if (core->mac[RFCTL] & E1000_RFCTL_ACK_DATA_DIS) { return !net_rx_pkt_has_tcp_data(rx_pkt); } return true; }
0
193,549
bool RenderThreadImpl::IsElasticOverscrollEnabled() { return is_elastic_overscroll_enabled_; }
0
123,442
void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *to ) { int i, lc; int bits; netField_t *field; int numFields; int startBit, endBit; int print; int *fromF, *toF; int trunc; playerState_t dummy; if ( !from ) { from = &dummy; Com_Memset( &dummy, 0, sizeof( dummy ) ); } *to = *from; if ( msg->bit == 0 ) { startBit = msg->readcount * 8 - GENTITYNUM_BITS; } else { startBit = ( msg->readcount - 1 ) * 8 + msg->bit - GENTITYNUM_BITS; } // shownet 2/3 will interleave with other printed info, -2 will // just print the delta records if ( cl_shownet && ( cl_shownet->integer >= 2 || cl_shownet->integer == -2 ) ) { print = 1; Com_Printf( "%3i: playerstate ", msg->readcount ); } else { print = 0; } numFields = ARRAY_LEN( playerStateFields ); lc = MSG_ReadByte(msg); if ( lc > numFields || lc < 0 ) { Com_Error( ERR_DROP, "invalid playerState field count" ); } for ( i = 0, field = playerStateFields ; i < lc ; i++, field++ ) { fromF = (int *)( (byte *)from + field->offset ); toF = (int *)( (byte *)to + field->offset ); if ( ! MSG_ReadBits( msg, 1 ) ) { // no change *toF = *fromF; } else { if ( field->bits == 0 ) { // float if ( MSG_ReadBits( msg, 1 ) == 0 ) { // integral float trunc = MSG_ReadBits( msg, FLOAT_INT_BITS ); // bias to allow equal parts positive and negative trunc -= FLOAT_INT_BIAS; *(float *)toF = trunc; if ( print ) { Com_Printf( "%s:%i ", field->name, trunc ); } } else { // full floating point value *toF = MSG_ReadBits( msg, 32 ); if ( print ) { Com_Printf( "%s:%f ", field->name, *(float *)toF ); } } } else { // integer *toF = MSG_ReadBits( msg, field->bits ); if ( print ) { Com_Printf( "%s:%i ", field->name, *toF ); } } } } for ( i=lc,field = &playerStateFields[lc];i<numFields; i++, field++) { fromF = (int *)( (byte *)from + field->offset ); toF = (int *)( (byte *)to + field->offset ); // no change *toF = *fromF; } // read the arrays if (MSG_ReadBits( msg, 1 ) ) { // parse stats if ( MSG_ReadBits( msg, 1 ) ) { LOG("PS_STATS"); bits = MSG_ReadBits (msg, MAX_STATS); for (i=0 ; i<MAX_STATS ; i++) { if (bits & (1<<i) ) { to->stats[i] = MSG_ReadShort(msg); } } } // parse persistant stats if ( MSG_ReadBits( msg, 1 ) ) { LOG("PS_PERSISTANT"); bits = MSG_ReadBits (msg, MAX_PERSISTANT); for (i=0 ; i<MAX_PERSISTANT ; i++) { if (bits & (1<<i) ) { to->persistant[i] = MSG_ReadShort(msg); } } } // parse ammo if ( MSG_ReadBits( msg, 1 ) ) { LOG("PS_AMMO"); bits = MSG_ReadBits (msg, MAX_WEAPONS); for (i=0 ; i<MAX_WEAPONS ; i++) { if (bits & (1<<i) ) { to->ammo[i] = MSG_ReadShort(msg); } } } // parse powerups if ( MSG_ReadBits( msg, 1 ) ) { LOG("PS_POWERUPS"); bits = MSG_ReadBits (msg, MAX_POWERUPS); for (i=0 ; i<MAX_POWERUPS ; i++) { if (bits & (1<<i) ) { to->powerups[i] = MSG_ReadLong(msg); } } } } if ( print ) { if ( msg->bit == 0 ) { endBit = msg->readcount * 8 - GENTITYNUM_BITS; } else { endBit = ( msg->readcount - 1 ) * 8 + msg->bit - GENTITYNUM_BITS; } Com_Printf( " (%i bits)\n", endBit - startBit ); } }
0
54,545
set_alignment(struct readbuffer *obuf, struct parsed_tag *tag) { long flag = -1; int align; if (parsedtag_get_value(tag, ATTR_ALIGN, &align)) { switch (align) { case ALIGN_CENTER: flag = RB_CENTER; break; case ALIGN_RIGHT: flag = RB_RIGHT; break; case ALIGN_LEFT: flag = RB_LEFT; } } RB_SAVE_FLAG(obuf); if (flag != -1) { RB_SET_ALIGN(obuf, flag); } }
0
164,497
LayerTreeHostTestSetNeedsRedrawRect() : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
0
401,836
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV) { USE_OPLINE zend_free_op free_op1, free_op2; zval *container; SAVE_OPLINE(); container = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW); zend_fetch_dimension_address_RW(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC); FREE_OP2(); if (OP1_TYPE == IS_VAR) { zval *result = EX_VAR(opline->result.var); FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result); } ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); }
0
521,404
bool sys_var_pluginvar::session_update(THD *thd, set_var *var) { DBUG_ASSERT(!is_readonly()); DBUG_ASSERT(plugin_var->flags & PLUGIN_VAR_THDLOCAL); DBUG_ASSERT(thd == current_thd); mysql_mutex_lock(&LOCK_global_system_variables); void *tgt= real_value_ptr(thd, OPT_SESSION); const void *src= var->value ? (void*)&var->save_result : (void*)real_value_ptr(thd, OPT_GLOBAL); mysql_mutex_unlock(&LOCK_global_system_variables); plugin_var->update(thd, plugin_var, tgt, src); return false; }
0
110,519
static inline __be16 pppoe_proto(const struct sk_buff *skb) { return *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + sizeof(struct pppoe_hdr))); }
0
426,141
qb_ipcc_us_disconnect(struct qb_ipcc_connection *c) { munmap(c->request.u.us.shared_data, SHM_CONTROL_SIZE); unlink(c->request.u.us.shared_file_name); if (use_filesystem_sockets()) { struct sockaddr_un un_addr; socklen_t un_addr_len = sizeof(struct sockaddr_un); char *base_name; char sock_name[PATH_MAX]; size_t length; if (getsockname(c->response.u.us.sock, (struct sockaddr *)&un_addr, &un_addr_len) == 0) { length = strlen(un_addr.sun_path); base_name = strndup(un_addr.sun_path, length - /* strlen("-response") */ 9); qb_util_log(LOG_DEBUG, "unlinking socket bound files with base_name=%s length=%d",base_name,length); snprintf(sock_name,PATH_MAX,"%s-%s",base_name,"request"); qb_util_log(LOG_DEBUG, "unlink sock_name=%s",sock_name); unlink(sock_name); snprintf(sock_name,PATH_MAX,"%s-%s",base_name,"event"); qb_util_log(LOG_DEBUG, "unlink sock_name=%s",sock_name); unlink(sock_name); snprintf(sock_name,PATH_MAX,"%s-%s",base_name,"event-tx"); qb_util_log(LOG_DEBUG, "unlink sock_name=%s",sock_name); unlink(sock_name); snprintf(sock_name,PATH_MAX,"%s-%s",base_name,"response"); qb_util_log(LOG_DEBUG, "unlink sock_name=%s",sock_name); unlink(sock_name); free(base_name); } } qb_ipcc_us_sock_close(c->event.u.us.sock); qb_ipcc_us_sock_close(c->request.u.us.sock); qb_ipcc_us_sock_close(c->setup.u.us.sock); }
0
523,271
bool LEX::sp_for_loop_cursor_declarations(THD *thd, Lex_for_loop_st *loop, const LEX_CSTRING *index, const Lex_for_loop_bounds_st &bounds) { Item *item= bounds.m_index->get_item(); Item_splocal *item_splocal; Item_field *item_field; Item_func_sp *item_func_sp= NULL; LEX_CSTRING name; uint coffs, param_count= 0; const sp_pcursor *pcursor; DBUG_ENTER("LEX::sp_for_loop_cursor_declarations"); if ((item_splocal= item->get_item_splocal())) name= item_splocal->m_name; else if ((item_field= item->type() == Item::FIELD_ITEM ? static_cast<Item_field *>(item) : NULL) && item_field->table_name == NULL) name= item_field->field_name; else if (item->type() == Item::FUNC_ITEM && static_cast<Item_func*>(item)->functype() == Item_func::FUNC_SP && !static_cast<Item_func_sp*>(item)->get_sp_name()->m_explicit_name) { /* When a FOR LOOP for a cursor with parameters is parsed: FOR index IN cursor(1,2,3) LOOP statements; END LOOP; the parser scans "cursor(1,2,3)" using the "expr" rule, so it thinks that cursor(1,2,3) is a stored function call. It's not easy to implement this without using "expr" because of grammar conflicts. As a side effect, the Item_func_sp and its arguments in the parentheses belong to the same LEX. This is different from an explicit "OPEN cursor(1,2,3)" where every expression belongs to a separate LEX. */ item_func_sp= static_cast<Item_func_sp*>(item); name= item_func_sp->get_sp_name()->m_name; param_count= item_func_sp->argument_count(); } else { thd->parse_error(); DBUG_RETURN(true); } if (unlikely(!(pcursor= spcont->find_cursor_with_error(&name, &coffs, false)) || pcursor->check_param_count_with_error(param_count))) DBUG_RETURN(true); if (!(loop->m_index= sp_add_for_loop_cursor_variable(thd, index, pcursor, coffs, bounds.m_index, item_func_sp))) DBUG_RETURN(true); loop->m_target_bound= NULL; loop->m_direction= bounds.m_direction; loop->m_cursor_offset= coffs; loop->m_implicit_cursor= bounds.m_implicit_cursor; DBUG_RETURN(false); }
0
276,634
bool IsAppLauncherEnabledAtLevel(InstallationLevel level) { string16 uninstall_arguments; if (GetClientStateValue(level, kAppHostAppId, kUninstallArgumentsField, &uninstall_arguments)) { return CommandLine::FromString(L"dummy.exe " + uninstall_arguments) .HasSwitch(kChromeAppLauncher) && !GetAppHostPathForInstallationLevel(level).empty(); } return false; }
0
346,504
static int startApp(QCommandLineParser& p) { // Stop daemon and exit? if (p.isSet("s")) { KDEsuClient client; if (client.ping() == -1) { qCCritical(category) << "Daemon not running -- nothing to stop\n"; p.showHelp(1); } if (client.stopServer() != -1) { qCDebug(category) << "Daemon stopped\n"; exit(0); } qCCritical(category) << "Could not stop daemon\n"; p.showHelp(1); } QString icon; if ( p.isSet("i")) icon = p.value("i"); bool prompt = true; if ( p.isSet("d")) prompt = false; // Get target uid QByteArray user = p.value("u").toLocal8Bit(); QByteArray auth_user = user; struct passwd *pw = getpwnam(user); if (pw == 0L) { qCCritical(category) << "User " << user << " does not exist\n"; p.showHelp(1); } bool other_uid = (getuid() != pw->pw_uid); bool change_uid = other_uid; if (!change_uid) { char *cur_user = getenv("USER"); if (!cur_user) cur_user = getenv("LOGNAME"); change_uid = (!cur_user || user != cur_user); } // If file is writeable, do not change uid QString file = p.value("f"); if (other_uid && !file.isEmpty()) { if (file.startsWith('/')) { file = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, file); if (file.isEmpty()) { qCCritical(category) << "Config file not found: " << file; p.showHelp(1); } } QFileInfo fi(file); if (!fi.exists()) { qCCritical(category) << "File does not exist: " << file; p.showHelp(1); } change_uid = !fi.isWritable(); } // Get priority/scheduler QString tmp = p.value("p"); bool ok; int priority = tmp.toInt(&ok); if (!ok || (priority < 0) || (priority > 100)) { qCCritical(category) << i18n("Illegal priority: %1", tmp); p.showHelp(1); } int scheduler = SuProcess::SchedNormal; if (p.isSet("r")) scheduler = SuProcess::SchedRealtime; if ((priority > 50) || (scheduler != SuProcess::SchedNormal)) { change_uid = true; auth_user = "root"; } // Get command if (p.isSet("c")) { command = p.value("c").toLocal8Bit(); // Accepting additional arguments here is somewhat weird, // but one can conceive use cases: have a complex command with // redirections and additional file names which need to be quoted // safely. } else { if( p.positionalArguments().count() == 0 ) { qCCritical(category) << i18n("No command specified."); p.showHelp(1); } } foreach(const QString& arg, p.positionalArguments()) { command += ' '; command += QFile::encodeName(KShell::quoteArg(arg)); } // Don't change uid if we're don't need to. if (!change_uid) { int result = system(command); result = WEXITSTATUS(result); return result; } // Check for daemon and start if necessary bool just_started = false; bool have_daemon = true; KDEsuClient client; if (!client.isServerSGID()) { qCWarning(category) << "Daemon not safe (not sgid), not using it.\n"; have_daemon = false; } else if (client.ping() == -1) { if (client.startServer() == -1) { qCWarning(category) << "Could not start daemon, reduced functionality.\n"; have_daemon = false; } just_started = true; } // Try to exec the command with kdesud. bool keep = !p.isSet("n") && have_daemon; bool terminal = p.isSet("t"); bool withIgnoreButton = !p.isSet("noignorebutton"); int winid = -1; bool attach = p.isSet("attach"); if(attach) { winid = p.value("attach").toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used. if(!attach) qCWarning(category) << "Specified winid to attach to is not a valid number"; } else if(p.isSet("embed")) { /* KDialog originally used --embed for attaching the dialog box. However this is misleading and so we changed to --attach. * For consistancy, we silently map --embed to --attach */ attach = true; winid = p.value("embed").toInt(&attach, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used. if(!attach) qCWarning(category) << "Specified winid to attach to is not a valid number"; } QList<QByteArray> env; QByteArray options; env << ( "DESKTOP_STARTUP_ID=" + KStartupInfo::startupId()); // TODO: Maybe should port this to XDG_*, somehow? // if (pw->pw_uid) // { // // Only propagate KDEHOME for non-root users, // // root uses KDEROOTHOME // // // Translate the KDEHOME of this user to the new user. // QString kdeHome = KGlobal::dirs()->relativeLocation("home", KGlobal::dirs()->localkdedir()); // if (kdeHome[0] != '/') // kdeHome.prepend("~/"); // else // kdeHome.clear(); // Use default // // env << ("KDEHOME="+ QFile::encodeName(kdeHome)); // } KUser u; env << (QByteArray) ("KDESU_USER=" + u.loginName().toLocal8Bit()); if (keep && !terminal && !just_started) { client.setPriority(priority); client.setScheduler(scheduler); int result = client.exec(command, user, options, env); if (result == 0) { result = client.exitCode(); return result; } } // Set core dump size to 0 because we will have // root's password in memory. struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim)) { qCCritical(category) << "rlimit(): " << ERR; p.showHelp(1); } // Read configuration KConfigGroup config(KSharedConfig::openConfig(), "Passwords"); int timeout = config.readEntry("Timeout", defTimeout); // Check if we need a password SuProcess proc; proc.setUser(auth_user); int needpw = proc.checkNeedPassword(); if (needpw < 0) { QString err = i18n("Su returned with an error.\n"); KMessageBox::error(0L, err); p.showHelp(1); } if (needpw == 0) { keep = 0; qDebug() << "Don't need password!!\n"; } // Start the dialog QString password; if (needpw) { #ifdef HAVE_X11 KStartupInfoId id; id.initId(); KStartupInfoData data; data.setSilent( KStartupInfoData::Yes ); KStartupInfo::sendChange( id, data ); #endif KDEsuDialog dlg(user, auth_user, keep && !terminal, icon, withIgnoreButton); if (prompt) dlg.addCommentLine(i18n("Command:"), QFile::decodeName(command)); if (defKeep) dlg.setKeepPassword(true); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); if (prompt) dlg.addCommentLine(i18n("Priority:"), prio); } //Attach dialog #ifdef HAVE_X11 if(attach) KWindowSystem::setMainWindow(&dlg, (WId)winid); #endif int ret = dlg.exec(); if (ret == KDEsuDialog::Rejected) { #ifdef HAVE_X11 KStartupInfo::sendFinish( id ); #endif p.showHelp(1); } if (ret == KDEsuDialog::AsUser) change_uid = false; password = dlg.password(); keep = dlg.keepPassword(); #ifdef HAVE_X11 data.setSilent( KStartupInfoData::No ); KStartupInfo::sendChange( id, data ); #endif } // Some events may need to be handled (like a button animation) qApp->processEvents(); // Run command if (!change_uid) { int result = system(command); result = WEXITSTATUS(result); return result; } else if (keep && have_daemon) { client.setPass(password.toLocal8Bit(), timeout); client.setPriority(priority); client.setScheduler(scheduler); int result = client.exec(command, user, options, env); if (result == 0) { result = client.exitCode(); return result; } } else { SuProcess proc; proc.setTerminal(terminal); proc.setErase(true); proc.setUser(user); proc.setEnvironment(env); proc.setPriority(priority); proc.setScheduler(scheduler); proc.setCommand(command); int result = proc.exec(password.toLocal8Bit()); return result; } return -1; }
1
435,695
set_optimize_exact(regex_t* reg, OptExact* e) { int r; if (e->len == 0) return 0; if (e->ignore_case) { reg->exact = (UChar* )xmalloc(e->len); CHECK_NULL_RETURN_MEMERR(reg->exact); xmemcpy(reg->exact, e->s, e->len); reg->exact_end = reg->exact + e->len; reg->optimize = OPTIMIZE_STR_IC; } else { int allow_reverse; reg->exact = onigenc_strdup(reg->enc, e->s, e->s + e->len); CHECK_NULL_RETURN_MEMERR(reg->exact); reg->exact_end = reg->exact + e->len; allow_reverse = ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end); if (e->len >= 3 || (e->len >= 2 && allow_reverse)) { #ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM r = set_sunday_quick_search_skip_table(reg->exact, reg->exact_end, reg->enc, reg->map, &(reg->map_offset)); #else r = set_bmh_search_skip_table(reg->exact, reg->exact_end, reg->enc, reg->map); #endif if (r != 0) return r; reg->optimize = (allow_reverse != 0 ? OPTIMIZE_STR_FAST : OPTIMIZE_STR_FAST_STEP_FORWARD); } else { reg->optimize = OPTIMIZE_STR; } } reg->dmin = e->mmd.min; reg->dmax = e->mmd.max; if (reg->dmin != INFINITE_LEN) { reg->threshold_len = reg->dmin + (int )(reg->exact_end - reg->exact); } return 0; }
0
214,942
void GLES2DecoderImpl::OnOutOfMemoryError() { if (lose_context_when_out_of_memory_) { group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); } }
0
281,867
MagickExport ssize_t WriteBlobSignedLong(Image *image,const signed int value) { union { unsigned int unsigned_value; signed int signed_value; } quantum; unsigned char buffer[4]; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); quantum.signed_value=value; if (image->endian == LSBEndian) { buffer[0]=(unsigned char) quantum.unsigned_value; buffer[1]=(unsigned char) (quantum.unsigned_value >> 8); buffer[2]=(unsigned char) (quantum.unsigned_value >> 16); buffer[3]=(unsigned char) (quantum.unsigned_value >> 24); return(WriteBlobStream(image,4,buffer)); } buffer[0]=(unsigned char) (quantum.unsigned_value >> 24); buffer[1]=(unsigned char) (quantum.unsigned_value >> 16); buffer[2]=(unsigned char) (quantum.unsigned_value >> 8); buffer[3]=(unsigned char) quantum.unsigned_value; return(WriteBlobStream(image,4,buffer)); }
0
511,755
rl_on_new_line_with_prompt () { int prompt_size, i, l, real_screenwidth, newlines; char *prompt_last_line, *lprompt; /* Initialize visible_line and invisible_line to ensure that they can hold the already-displayed prompt. */ prompt_size = strlen (rl_prompt) + 1; init_line_structures (prompt_size); /* Make sure the line structures hold the already-displayed prompt for redisplay. */ lprompt = local_prompt ? local_prompt : rl_prompt; strcpy (visible_line, lprompt); strcpy (invisible_line, lprompt); /* If the prompt contains newlines, take the last tail. */ prompt_last_line = strrchr (rl_prompt, '\n'); if (!prompt_last_line) prompt_last_line = rl_prompt; l = strlen (prompt_last_line); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) _rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l, 1); /* XXX */ else _rl_last_c_pos = l; /* Dissect prompt_last_line into screen lines. Note that here we have to use the real screenwidth. Readline's notion of screenwidth might be one less, see terminal.c. */ real_screenwidth = _rl_screenwidth + (_rl_term_autowrap ? 0 : 1); _rl_last_v_pos = l / real_screenwidth; /* If the prompt length is a multiple of real_screenwidth, we don't know whether the cursor is at the end of the last line, or already at the beginning of the next line. Output a newline just to be safe. */ if (l > 0 && (l % real_screenwidth) == 0) _rl_output_some_chars ("\n", 1); last_lmargin = 0; newlines = 0; i = 0; while (i <= l) { _rl_vis_botlin = newlines; vis_lbreaks[newlines++] = i; i += real_screenwidth; } vis_lbreaks[newlines] = l; visible_wrap_offset = 0; rl_display_prompt = rl_prompt; /* XXX - make sure it's set */ return 0; }
0
422,247
ews_store_ensure_unique_path (CamelEwsStore *ews_store, gchar **ppath) { gboolean done; guint counter = 0; gchar *base_path = NULL; g_return_if_fail (ews_store != NULL); g_return_if_fail (ews_store->summary != NULL); g_return_if_fail (ppath != NULL); g_return_if_fail (*ppath != NULL); done = FALSE; while (!done) { gchar *fid; done = TRUE; fid = camel_ews_store_summary_get_folder_id_from_name (ews_store->summary, *ppath); if (fid) { g_free (fid); done = FALSE; counter++; if (!counter) { g_debug ("%s: Counter overflow", G_STRFUNC); break; } if (!base_path) base_path = *ppath; else g_free (*ppath); *ppath = g_strdup_printf ("%s_%u", base_path, counter); } } g_free (base_path); }
0
292,895
static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){ Vdbe *v = 0; int iLimit = 0; int iOffset; int n; Expr *pLimit = p->pLimit; if( p->iLimit ) return; /* ** "LIMIT -1" always shows all rows. There is some ** controversy about what the correct behavior should be. ** The current implementation interprets "LIMIT 0" to mean ** no rows. */ if( pLimit ){ assert( pLimit->op==TK_LIMIT ); assert( pLimit->pLeft!=0 ); p->iLimit = iLimit = ++pParse->nMem; v = sqlite3GetVdbe(pParse); assert( v!=0 ); if( sqlite3ExprIsInteger(pLimit->pLeft, &n) ){ sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit); VdbeComment((v, "LIMIT counter")); if( n==0 ){ sqlite3VdbeGoto(v, iBreak); }else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){ p->nSelectRow = sqlite3LogEst((u64)n); p->selFlags |= SF_FixedLimit; } }else{ sqlite3ExprCode(pParse, pLimit->pLeft, iLimit); sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v); VdbeComment((v, "LIMIT counter")); sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v); } if( pLimit->pRight ){ p->iOffset = iOffset = ++pParse->nMem; pParse->nMem++; /* Allocate an extra register for limit+offset */ sqlite3ExprCode(pParse, pLimit->pRight, iOffset); sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v); VdbeComment((v, "OFFSET counter")); sqlite3VdbeAddOp3(v, OP_OffsetLimit, iLimit, iOffset+1, iOffset); VdbeComment((v, "LIMIT+OFFSET")); } } }
0
434,008
static void vrend_renderer_use_threaded_sync(void) { }
0
24,113
static int32_t offsetTOCPrefixBinarySearch ( const char * s , const char * names , const UDataOffsetTOCEntry * toc , int32_t count ) { int32_t start = 0 ; int32_t limit = count ; int32_t startPrefixLength = 0 ; int32_t limitPrefixLength = 0 ; if ( count == 0 ) { return - 1 ; } if ( 0 == strcmpAfterPrefix ( s , names + toc [ 0 ] . nameOffset , & startPrefixLength ) ) { return 0 ; } ++ start ; -- limit ; if ( 0 == strcmpAfterPrefix ( s , names + toc [ limit ] . nameOffset , & limitPrefixLength ) ) { return limit ; } while ( start < limit ) { int32_t i = ( start + limit ) / 2 ; int32_t prefixLength = MIN ( startPrefixLength , limitPrefixLength ) ; int32_t cmp = strcmpAfterPrefix ( s , names + toc [ i ] . nameOffset , & prefixLength ) ; if ( cmp < 0 ) { limit = i ; limitPrefixLength = prefixLength ; } else if ( cmp == 0 ) { return i ; } else { start = i + 1 ; startPrefixLength = prefixLength ; } } return - 1 ; }
0
167,464
static inline float fung(float x) { if (x >= 6.0f / 29.0f) return x * x * x; return (108.0f / 841.0f) * (x - (4.0f / 29.0f)); }
0
407,544
ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit) { int c, lc; int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ int com, quoted; char *t; size_t i; const char *d; const char *del; /* standard delimiters */ if (!delim) { /* from isspace(3) */ del = LDNS_PARSE_NORMAL; } else { del = delim; } p = 0; i = 0; com = 0; quoted = 0; t = token; lc = 0; if (del[0] == '"') { quoted = 1; } while ((c = ldns_bgetc(b)) != EOF) { if (c == '\r') /* carriage return */ c = ' '; if (c == '(' && lc != '\\' && !quoted) { /* this only counts for non-comments */ if (com == 0) { p++; } lc = c; continue; } if (c == ')' && lc != '\\' && !quoted) { /* this only counts for non-comments */ if (com == 0) { p--; } lc = c; continue; } if (p < 0) { /* more ) then ( */ *t = '\0'; return 0; } /* do something with comments ; */ if (c == ';' && quoted == 0) { if (lc != '\\') { com = 1; } } if (c == '"' && com == 0 && lc != '\\') { quoted = 1 - quoted; } if (c == '\n' && com != 0) { /* comments */ com = 0; *t = ' '; lc = c; continue; } if (com == 1) { *t = ' '; lc = c; continue; } if (c == '\n' && p != 0) { /* in parentheses */ *t++ = ' '; lc = c; continue; } /* check if we hit the delim */ for (d = del; *d; d++) { if (c == *d && lc != '\\' && p == 0) { goto tokenread; } } i++; if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { *t = '\0'; return -1; } *t++ = c; if (c == '\\' && lc == '\\') { lc = 0; } else { lc = c; } } *t = '\0'; if (i == 0) { /* nothing read */ return -1; } if (p != 0) { return -1; } return (ssize_t)i; tokenread: if(*del == '"') /* do not skip over quotes, they are significant */ ldns_bskipcs(b, del+1); else ldns_bskipcs(b, del); *t = '\0'; if (p != 0) { return -1; } return (ssize_t)i; }
0
447,632
UINT rdpgfx_write_color32(wStream* s, const RDPGFX_COLOR32* color32) { Stream_Write_UINT8(s, color32->B); /* B (1 byte) */ Stream_Write_UINT8(s, color32->G); /* G (1 byte) */ Stream_Write_UINT8(s, color32->R); /* R (1 byte) */ Stream_Write_UINT8(s, color32->XA); /* XA (1 byte) */ return CHANNEL_RC_OK; }
0
97,926
error_t socketBind(Socket *socket, const IpAddr *localIpAddr, uint16_t localPort) { //Check input parameters if(!socket || !localIpAddr) return ERROR_INVALID_PARAMETER; //Make sure the socket type is correct if(socket->type != SOCKET_TYPE_STREAM && socket->type != SOCKET_TYPE_DGRAM) return ERROR_INVALID_SOCKET; //Associate the specified IP address and port number socket->localIpAddr = *localIpAddr; socket->localPort = localPort; //No error to report return NO_ERROR; }
0
53,229
static int lookup_fast(struct nameidata *nd, struct path *path, struct inode **inode, unsigned *seqp) { struct vfsmount *mnt = nd->path.mnt; struct dentry *dentry, *parent = nd->path.dentry; int status = 1; int err; /* * Rename seqlock is not required here because in the off chance * of a false negative due to a concurrent rename, the caller is * going to fall back to non-racy lookup. */ if (nd->flags & LOOKUP_RCU) { unsigned seq; bool negative; dentry = __d_lookup_rcu(parent, &nd->last, &seq); if (unlikely(!dentry)) { if (unlazy_walk(nd)) return -ECHILD; return 0; } /* * This sequence count validates that the inode matches * the dentry name information from lookup. */ *inode = d_backing_inode(dentry); negative = d_is_negative(dentry); if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) return -ECHILD; /* * This sequence count validates that the parent had no * changes while we did the lookup of the dentry above. * * The memory barrier in read_seqcount_begin of child is * enough, we can use __read_seqcount_retry here. */ if (unlikely(__read_seqcount_retry(&parent->d_seq, nd->seq))) return -ECHILD; *seqp = seq; status = d_revalidate(dentry, nd->flags); if (likely(status > 0)) { /* * Note: do negative dentry check after revalidation in * case that drops it. */ if (unlikely(negative)) return -ENOENT; path->mnt = mnt; path->dentry = dentry; if (likely(__follow_mount_rcu(nd, path, inode, seqp))) return 1; } if (unlazy_child(nd, dentry, seq)) return -ECHILD; if (unlikely(status == -ECHILD)) /* we'd been told to redo it in non-rcu mode */ status = d_revalidate(dentry, nd->flags); } else { dentry = __d_lookup(parent, &nd->last); if (unlikely(!dentry)) return 0; status = d_revalidate(dentry, nd->flags); } if (unlikely(status <= 0)) { if (!status) d_invalidate(dentry); dput(dentry); return status; } path->mnt = mnt; path->dentry = dentry; err = follow_managed(path, nd); if (likely(err > 0)) *inode = d_backing_inode(path->dentry); return err; }
0
355
void xps_begin_opacity ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , char * opacity_att , fz_xml * opacity_mask_tag ) { float opacity ; if ( ! opacity_att && ! opacity_mask_tag ) return ; opacity = 1 ; if ( opacity_att ) opacity = fz_atof ( opacity_att ) ; if ( opacity_mask_tag && ! strcmp ( fz_xml_tag ( opacity_mask_tag ) , "SolidColorBrush" ) ) { char * scb_opacity_att = fz_xml_att ( opacity_mask_tag , "Opacity" ) ; char * scb_color_att = fz_xml_att ( opacity_mask_tag , "Color" ) ; if ( scb_opacity_att ) opacity = opacity * fz_atof ( scb_opacity_att ) ; if ( scb_color_att ) { fz_colorspace * colorspace ; float samples [ 32 ] ; xps_parse_color ( doc , base_uri , scb_color_att , & colorspace , samples ) ; opacity = opacity * samples [ 0 ] ; } opacity_mask_tag = NULL ; } if ( doc -> opacity_top + 1 < nelem ( doc -> opacity ) ) { doc -> opacity [ doc -> opacity_top + 1 ] = doc -> opacity [ doc -> opacity_top ] * opacity ; doc -> opacity_top ++ ; } if ( opacity_mask_tag ) { fz_begin_mask ( doc -> dev , area , 0 , NULL , NULL ) ; xps_parse_brush ( doc , ctm , area , base_uri , dict , opacity_mask_tag ) ; fz_end_mask ( doc -> dev ) ; } }
1
261,791
i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf) { struct i40e_aqc_configure_partition_bw_data bw_data; i40e_status status; /* Set the valid bit for this PF */ bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id)); bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK; bw_data.min_bw[pf->hw.pf_id] = pf->min_bw & I40E_ALT_BW_VALUE_MASK; /* Set the new bandwidths */ status = i40e_aq_configure_partition_bw(&pf->hw, &bw_data, NULL); return status; }
0
515,613
int setup_tests(void) { ADD_TEST(test_x509_cmp_time_current); ADD_ALL_TESTS(test_x509_cmp_time, OSSL_NELEM(x509_cmp_tests)); ADD_ALL_TESTS(test_x509_time, OSSL_NELEM(x509_format_tests)); ADD_ALL_TESTS(test_days, OSSL_NELEM(day_of_week_tests)); ADD_ALL_TESTS(test_x509_time_print, OSSL_NELEM(x509_print_tests)); return 1; }
0
500,907
void dvcC_box_del(GF_Box *s) { GF_DOVIConfigurationBox *ptr = (GF_DOVIConfigurationBox*)s; gf_free(ptr); }
0
106,179
unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable) { struct kvm_memory_slot *slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn); return gfn_to_hva_memslot_prot(slot, gfn, writable); }
0
186,949
zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) { BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; OPENSSL_PKEY_SET_BN(data, n); OPENSSL_PKEY_SET_BN(data, e); OPENSSL_PKEY_SET_BN(data, d); if (!n || !d || !RSA_set0_key(rsa, n, e, d)) { return 0; } OPENSSL_PKEY_SET_BN(data, p); OPENSSL_PKEY_SET_BN(data, q); if ((p || q) && !RSA_set0_factors(rsa, p, q)) { return 0; } OPENSSL_PKEY_SET_BN(data, dmp1); OPENSSL_PKEY_SET_BN(data, dmq1); OPENSSL_PKEY_SET_BN(data, iqmp); if ((dmp1 || dmq1 || iqmp) && !RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp)) { return 0; } if (!EVP_PKEY_assign_RSA(pkey, rsa)) { return 0; } return 1; }
0
233,482
Document* Document::ParentDocument() const { if (!frame_) return nullptr; Frame* parent = frame_->Tree().Parent(); if (!parent || !parent->IsLocalFrame()) return nullptr; return ToLocalFrame(parent)->GetDocument(); }
0
431,853
int kvm_coalesced_mmio_init(struct kvm *kvm) { struct page *page; int ret; ret = -ENOMEM; page = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!page) goto out_err; ret = 0; kvm->coalesced_mmio_ring = page_address(page); /* * We're using this spinlock to sync access to the coalesced ring. * The list doesn't need it's own lock since device registration and * unregistration should only happen when kvm->slots_lock is held. */ spin_lock_init(&kvm->ring_lock); INIT_LIST_HEAD(&kvm->coalesced_zones); out_err: return ret; }
0
342,370
int ff_snow_frame_start(SnowContext *s){ AVFrame tmp; int i, ret; int w= s->avctx->width; //FIXME round up to x16 ? int h= s->avctx->height; if (s->current_picture.data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) { s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w , h , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); } ff_snow_release_buffer(s->avctx); av_frame_move_ref(&tmp, &s->last_picture[s->max_ref_frames-1]); for(i=s->max_ref_frames-1; i>0; i--) av_frame_move_ref(&s->last_picture[i], &s->last_picture[i-1]); memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4); if(USE_HALFPEL_PLANE && s->current_picture.data[0]) halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture); av_frame_move_ref(&s->last_picture[0], &s->current_picture); av_frame_move_ref(&s->current_picture, &tmp); if(s->keyframe){ s->ref_frames= 0; }else{ int i; for(i=0; i<s->max_ref_frames && s->last_picture[i].data[0]; i++) if(i && s->last_picture[i-1].key_frame) break; s->ref_frames= i; if(s->ref_frames==0){ av_log(s->avctx,AV_LOG_ERROR, "No reference frames\n"); return -1; } } if ((ret = ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; s->current_picture.key_frame= s->keyframe; return 0; }
1
477,398
static void apic_sync_pv_eoi_from_guest(struct kvm_vcpu *vcpu, struct kvm_lapic *apic) { int vector; /* * PV EOI state is derived from KVM_APIC_PV_EOI_PENDING in host * and KVM_PV_EOI_ENABLED in guest memory as follows: * * KVM_APIC_PV_EOI_PENDING is unset: * -> host disabled PV EOI. * KVM_APIC_PV_EOI_PENDING is set, KVM_PV_EOI_ENABLED is set: * -> host enabled PV EOI, guest did not execute EOI yet. * KVM_APIC_PV_EOI_PENDING is set, KVM_PV_EOI_ENABLED is unset: * -> host enabled PV EOI, guest executed EOI. */ BUG_ON(!pv_eoi_enabled(vcpu)); if (pv_eoi_test_and_clr_pending(vcpu)) return; vector = apic_set_eoi(apic); trace_kvm_pv_eoi(apic, vector); }
0
165,720
GBool DCTStream::readBaselineSOF() { int length; int prec; int i; int c; length = read16(); prec = str->getChar(); height = read16(); width = read16(); numComps = str->getChar(); if (numComps <= 0 || numComps > 4) { error(errSyntaxError, getPos(), "Bad number of components in DCT stream"); numComps = 0; return gFalse; } if (prec != 8) { error(errSyntaxError, getPos(), "Bad DCT precision {0:d}", prec); return gFalse; } for (i = 0; i < numComps; ++i) { compInfo[i].id = str->getChar(); c = str->getChar(); compInfo[i].hSample = (c >> 4) & 0x0f; compInfo[i].vSample = c & 0x0f; compInfo[i].quantTable = str->getChar(); if (compInfo[i].hSample < 1 || compInfo[i].hSample > 4 || compInfo[i].vSample < 1 || compInfo[i].vSample > 4) { error(errSyntaxError, getPos(), "Bad DCT sampling factor"); return gFalse; } if (compInfo[i].quantTable < 0 || compInfo[i].quantTable > 3) { error(errSyntaxError, getPos(), "Bad DCT quant table selector"); return gFalse; } } progressive = gFalse; return gTrue; }
0
339,777
const char *qemu_opt_get(QemuOpts *opts, const char *name) { QemuOpt *opt = qemu_opt_find(opts, name); if (!opt) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { return desc->def_value_str; } } return opt ? opt->str : NULL; }
0
404,926
static void l2cap_pass_to_tx_fbit(struct l2cap_chan *chan, struct l2cap_ctrl *control) { BT_DBG("chan %p, control %p", chan, control); l2cap_tx(chan, control, NULL, L2CAP_EV_RECV_FBIT); }
0
492,682
static int check_return_code(struct bpf_verifier_env *env) { struct tnum enforce_attach_type_range = tnum_unknown; const struct bpf_prog *prog = env->prog; struct bpf_reg_state *reg; struct tnum range = tnum_range(0, 1); int err; /* The struct_ops func-ptr's return type could be "void" */ if (env->prog->type == BPF_PROG_TYPE_STRUCT_OPS && !prog->aux->attach_func_proto->type) return 0; /* eBPF calling convetion is such that R0 is used * to return the value from eBPF program. * Make sure that it's readable at this time * of bpf_exit, which means that program wrote * something into it earlier */ err = check_reg_arg(env, BPF_REG_0, SRC_OP); if (err) return err; if (is_pointer_value(env, BPF_REG_0)) { verbose(env, "R0 leaks addr as return value\n"); return -EACCES; } switch (env->prog->type) { case BPF_PROG_TYPE_CGROUP_SOCK_ADDR: if (env->prog->expected_attach_type == BPF_CGROUP_UDP4_RECVMSG || env->prog->expected_attach_type == BPF_CGROUP_UDP6_RECVMSG) range = tnum_range(1, 1); break; case BPF_PROG_TYPE_CGROUP_SKB: if (env->prog->expected_attach_type == BPF_CGROUP_INET_EGRESS) { range = tnum_range(0, 3); enforce_attach_type_range = tnum_range(2, 3); } break; case BPF_PROG_TYPE_CGROUP_SOCK: case BPF_PROG_TYPE_SOCK_OPS: case BPF_PROG_TYPE_CGROUP_DEVICE: case BPF_PROG_TYPE_CGROUP_SYSCTL: case BPF_PROG_TYPE_CGROUP_SOCKOPT: break; case BPF_PROG_TYPE_RAW_TRACEPOINT: if (!env->prog->aux->attach_btf_id) return 0; range = tnum_const(0); break; default: return 0; } reg = cur_regs(env) + BPF_REG_0; if (reg->type != SCALAR_VALUE) { verbose(env, "At program exit the register R0 is not a known value (%s)\n", reg_type_str[reg->type]); return -EINVAL; } if (!tnum_in(range, reg->var_off)) { char tn_buf[48]; verbose(env, "At program exit the register R0 "); if (!tnum_is_unknown(reg->var_off)) { tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, "has value %s", tn_buf); } else { verbose(env, "has unknown scalar value"); } tnum_strn(tn_buf, sizeof(tn_buf), range); verbose(env, " should have been in %s\n", tn_buf); return -EINVAL; } if (!tnum_is_unknown(enforce_attach_type_range) && tnum_in(enforce_attach_type_range, reg->var_off)) env->prog->enforce_expected_attach_type = 1; return 0; }
0
291,046
TEST(HostsPerLocalityImpl, Empty) { EXPECT_FALSE(HostsPerLocalityImpl::empty()->hasLocalLocality()); EXPECT_EQ(0, HostsPerLocalityImpl::empty()->get().size()); }
0
258,338
static void lance_init ( NICInfo * nd , hwaddr leaddr , void * dma_opaque , qemu_irq irq ) { DeviceState * dev ; SysBusDevice * s ; qemu_irq reset ; qemu_check_nic_model ( & nd_table [ 0 ] , "lance" ) ; dev = qdev_create ( NULL , "lance" ) ; qdev_set_nic_properties ( dev , nd ) ; qdev_prop_set_ptr ( dev , "dma" , dma_opaque ) ; qdev_init_nofail ( dev ) ; s = SYS_BUS_DEVICE ( dev ) ; sysbus_mmio_map ( s , 0 , leaddr ) ; sysbus_connect_irq ( s , 0 , irq ) ; reset = qdev_get_gpio_in ( dev , 0 ) ; qdev_connect_gpio_out ( dma_opaque , 0 , reset ) ; }
0
60,165
void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f) { if (!f) return; /* If the filter was never added to firmware then we can just delete it * directly and we don't want to set the status to remove or else an * admin queue command will unnecessarily fire. */ if ((f->state == I40E_FILTER_FAILED) || (f->state == I40E_FILTER_NEW)) { hash_del(&f->hlist); kfree(f); } else { f->state = I40E_FILTER_REMOVE; } vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED; set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state); }
0
452,174
tcpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { conv_hash_t *hash = (conv_hash_t*) pct; const struct tcpheader *tcphdr=(const struct tcpheader *)vip; add_conversation_table_data_with_conv_id(hash, &tcphdr->ip_src, &tcphdr->ip_dst, tcphdr->th_sport, tcphdr->th_dport, (conv_id_t) tcphdr->th_stream, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, &tcp_ct_dissector_info, ENDPOINT_TCP); return TAP_PACKET_REDRAW; }
0
419,555
void copy_structures(struct activity *act[], unsigned int id_seq[], struct record_header record_hdr[], int dest, int src) { int i, p; memcpy(&record_hdr[dest], &record_hdr[src], RECORD_HEADER_SIZE); for (i = 0; i < NR_ACT; i++) { if (!id_seq[i]) continue; p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND); memcpy(act[p]->buf[dest], act[p]->buf[src], (size_t) act[p]->msize * (size_t) act[p]->nr[src] * (size_t) act[p]->nr2); act[p]->nr[dest] = act[p]->nr[src]; } }
0
412,887
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC) { size_t idex; void *vptr; image_info_value *info_value; image_info_data *info_data; image_info_data *list; if (length < 0) { return; } list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); image_info->info_list[section_index].list = list; info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; memset(info_data, 0, sizeof(image_info_data)); info_data->tag = tag; info_data->format = format; info_data->length = length; info_data->name = estrdup(name); info_value = &info_data->value; switch (format) { case TAG_FMT_STRING: if (value) { length = php_strnlen(value, length); info_value->s = estrndup(value, length); info_data->length = length; } else { info_data->length = 0; info_value->s = estrdup(""); } break; default: /* Standard says more types possible but skip them... * but allow users to handle data if they know how to * So not return but use type UNDEFINED * return; */ info_data->tag = TAG_FMT_UNDEFINED;/* otherwise not freed from memory */ case TAG_FMT_SBYTE: case TAG_FMT_BYTE: /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */ if (!length) break; case TAG_FMT_UNDEFINED: if (value) { if (tag == TAG_MAKER_NOTE) { length = (int) php_strnlen(value, length); } /* do not recompute length here */ info_value->s = estrndup(value, length); info_data->length = length; } else { info_data->length = 0; info_value->s = estrdup(""); } break; case TAG_FMT_USHORT: case TAG_FMT_ULONG: case TAG_FMT_URATIONAL: case TAG_FMT_SSHORT: case TAG_FMT_SLONG: case TAG_FMT_SRATIONAL: case TAG_FMT_SINGLE: case TAG_FMT_DOUBLE: if (length==0) { break; } else if (length>1) { info_value->list = safe_emalloc(length, sizeof(image_info_value), 0); } else { info_value = &info_data->value; } for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) { if (length>1) { info_value = &info_data->value.list[idex]; } switch (format) { case TAG_FMT_USHORT: info_value->u = php_ifd_get16u(vptr, motorola_intel); break; case TAG_FMT_ULONG: info_value->u = php_ifd_get32u(vptr, motorola_intel); break; case TAG_FMT_URATIONAL: info_value->ur.num = php_ifd_get32u(vptr, motorola_intel); info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SSHORT: info_value->i = php_ifd_get16s(vptr, motorola_intel); break; case TAG_FMT_SLONG: info_value->i = php_ifd_get32s(vptr, motorola_intel); break; case TAG_FMT_SRATIONAL: info_value->sr.num = php_ifd_get32u(vptr, motorola_intel); info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type single"); #endif info_value->f = *(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type double"); #endif info_value->d = *(double *)value; break; } } } image_info->sections_found |= 1<<section_index; image_info->info_list[section_index].count++; }
0
354,131
find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *first_table, TABLE_LIST *last_table, Item **ref, find_item_error_report_type report_error, bool check_privileges, bool register_tree_change) { Field *found=0; const char *db= item->db_name; const char *table_name= item->table_name; const char *name= item->field_name; uint length=(uint) strlen(name); char name_buff[SAFE_NAME_LEN+1]; TABLE_LIST *cur_table= first_table; TABLE_LIST *actual_table; bool allow_rowid; if (!table_name || !table_name[0]) { table_name= 0; // For easier test db= 0; } allow_rowid= table_name || (cur_table && !cur_table->next_local); if (item->cached_table) { DBUG_PRINT("info", ("using cached table")); /* This shortcut is used by prepared statements. We assume that TABLE_LIST *first_table is not changed during query execution (which is true for all queries except RENAME but luckily RENAME doesn't use fields...) so we can rely on reusing pointer to its member. With this optimization we also miss case when addition of one more field makes some prepared query ambiguous and so erroneous, but we accept this trade off. */ TABLE_LIST *table_ref= item->cached_table; /* The condition (table_ref->view == NULL) ensures that we will call find_field_in_table even in the case of information schema tables when table_ref->field_translation != NULL. */ if (table_ref->table && !table_ref->view && (!table_ref->is_merged_derived() || (!table_ref->is_multitable() && table_ref->merged_for_insert))) { found= find_field_in_table(thd, table_ref->table, name, length, TRUE, &(item->cached_field_index)); #ifndef NO_EMBEDDED_ACCESS_CHECKS /* Check if there are sufficient access rights to the found field. */ if (found && check_privileges && !is_temporary_table(table_ref) && check_column_grant_in_table_ref(thd, table_ref, name, length)) found= WRONG_GRANT; #endif } else found= find_field_in_table_ref(thd, table_ref, name, length, item->name, NULL, NULL, ref, check_privileges, TRUE, &(item->cached_field_index), register_tree_change, &actual_table); if (found) { if (found == WRONG_GRANT) return (Field*) 0; /* Only views fields should be marked as dependent, not an underlying fields. */ if (!table_ref->belong_to_view && !table_ref->belong_to_derived) { SELECT_LEX *current_sel= item->context->select_lex; SELECT_LEX *last_select= table_ref->select_lex; bool all_merged= TRUE; for (SELECT_LEX *sl= current_sel; sl && sl!=last_select; sl=sl->outer_select()) { Item *subs= sl->master_unit()->item; if (subs->type() == Item::SUBSELECT_ITEM && ((Item_subselect*)subs)->substype() == Item_subselect::IN_SUBS && ((Item_in_subselect*)subs)->test_strategy(SUBS_SEMI_JOIN)) { continue; } all_merged= FALSE; break; } /* If the field was an outer referencee, mark all selects using this sub query as dependent on the outer query */ if (!all_merged && current_sel != last_select) { mark_select_range_as_dependent(thd, last_select, current_sel, found, *ref, item, true); } } return found; } } else item->can_be_depended= TRUE; if (db && lower_case_table_names) { /* convert database to lower case for comparison. We can't do this in Item_field as this would change the 'name' of the item which may be used in the select list */ strmake_buf(name_buff, db); my_casedn_str(files_charset_info, name_buff); db= name_buff; } if (last_table) last_table= last_table->next_name_resolution_table; for (; cur_table != last_table ; cur_table= cur_table->next_name_resolution_table) { Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length, item->name, db, table_name, ref, (thd->lex->sql_command == SQLCOM_SHOW_FIELDS) ? false : check_privileges, allow_rowid, &(item->cached_field_index), register_tree_change, &actual_table); if (cur_field) { if (cur_field == WRONG_GRANT) { if (thd->lex->sql_command != SQLCOM_SHOW_FIELDS) return (Field*) 0; thd->clear_error(); cur_field= find_field_in_table_ref(thd, cur_table, name, length, item->name, db, table_name, ref, false, allow_rowid, &(item->cached_field_index), register_tree_change, &actual_table); if (cur_field) { Field *nf=new Field_null(NULL,0,Field::NONE, cur_field->field_name, &my_charset_bin); nf->init(cur_table->table); cur_field= nf; } } /* Store the original table of the field, which may be different from cur_table in the case of NATURAL/USING join. */ item->cached_table= (!actual_table->cacheable_table || found) ? 0 : actual_table; DBUG_ASSERT(thd->where); /* If we found a fully qualified field we return it directly as it can't have duplicates. */ if (db) return cur_field; if (found) { if (report_error == REPORT_ALL_ERRORS || report_error == IGNORE_EXCEPT_NON_UNIQUE) my_error(ER_NON_UNIQ_ERROR, MYF(0), table_name ? item->full_name() : name, thd->where); return (Field*) 0; } found= cur_field; } } if (found) return found; /* If the field was qualified and there were no tables to search, issue an error that an unknown table was given. The situation is detected as follows: if there were no tables we wouldn't go through the loop and cur_table wouldn't be updated by the loop increment part, so it will be equal to the first table. */ if (table_name && (cur_table == first_table) && (report_error == REPORT_ALL_ERRORS || report_error == REPORT_EXCEPT_NON_UNIQUE)) { char buff[SAFE_NAME_LEN*2 + 2]; if (db && db[0]) { strxnmov(buff,sizeof(buff)-1,db,".",table_name,NullS); table_name=buff; } my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, thd->where); } else { if (report_error == REPORT_ALL_ERRORS || report_error == REPORT_EXCEPT_NON_UNIQUE) my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(), thd->where); else found= not_found_field; } return found; }
1
392,486
static inline void Process_ipfix_template_withdraw(exporter_ipfix_domain_t *exporter, void *DataPtr, uint32_t size_left, FlowSource_t *fs) { ipfix_template_record_t *ipfix_template_record; // a template flowset can contain multiple records ( templates ) while ( size_left ) { uint32_t id, count; // map next record. ipfix_template_record = (ipfix_template_record_t *)DataPtr; size_left -= 4; id = ntohs(ipfix_template_record->TemplateID); count = ntohs(ipfix_template_record->FieldCount); if ( id == IPFIX_TEMPLATE_FLOWSET_ID ) { // withdraw all templates remove_all_translation_tables(exporter); ReInitExtensionMapList(fs); } else { remove_translation_table(fs, exporter, id); } DataPtr = DataPtr + 4; if ( size_left < 4 ) { // pading dbg_printf("Skip %u bytes padding\n", size_left); size_left = 0; } } } // End of Process_ipfix_template_withdraw
0
153,220
static Jsi_OpCodes *code_jtrue_np(int off) { JSI_NEW_CODES(0,OP_JTRUE_NP, off); }
0
414,862
MagickExport MagickBooleanType AnimateImages(const ImageInfo *image_info, Image *images) { char *argv[1]; Display *display; MagickStatusType status; XrmDatabase resource_database; XResourceInfo resource_info; assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename); display=XOpenDisplay(image_info->server_name); if (display == (Display *) NULL) { (void) ThrowMagickException(&images->exception,GetMagickModule(), XServerError,"UnableToOpenXServer","`%s'",XDisplayName( image_info->server_name)); return(MagickFalse); } if (images->exception.severity != UndefinedException) CatchException(&images->exception); (void) XSetErrorHandler(XError); resource_database=XGetResourceDatabase(display,GetClientName()); (void) memset(&resource_info,0,sizeof(XResourceInfo)); XGetResourceInfo(image_info,resource_database,GetClientName(),&resource_info); if (image_info->page != (char *) NULL) resource_info.image_geometry=AcquireString(image_info->page); resource_info.immutable=MagickTrue; argv[0]=AcquireString(GetClientName()); (void) XAnimateImages(display,&resource_info,argv,1,images); (void) SetErrorHandler((ErrorHandler) NULL); (void) SetWarningHandler((WarningHandler) NULL); argv[0]=DestroyString(argv[0]); (void) XCloseDisplay(display); XDestroyResourceInfo(&resource_info); status=images->exception.severity == UndefinedException ? MagickTrue : MagickFalse; return(status != 0 ? MagickTrue : MagickFalse); }
0
275,117
render_state_set_size( RenderState state, float char_size ) { state->char_size = char_size; state->need_rescale = 1; }
0
153,532
static int megasas_reset_bus_host(struct scsi_cmnd *scmd) { int ret; struct megasas_instance *instance; instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd, "Controller reset is requested due to IO timeout\n" "SCSI command pointer: (%p)\t SCSI host state: %d\t" " SCSI host busy: %d\t FW outstanding: %d\n", scmd, scmd->device->host->shost_state, scsi_host_busy(scmd->device->host), atomic_read(&instance->fw_outstanding)); /* * First wait for all commands to complete */ if (instance->adapter_type == MFI_SERIES) { ret = megasas_generic_reset(scmd); } else { struct megasas_cmd_fusion *cmd; cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; if (cmd) megasas_dump_frame(cmd->io_request, MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); ret = megasas_reset_fusion(scmd->device->host, SCSIIO_TIMEOUT_OCR); } return ret; }
0
94,289
static int decode_modrm(struct x86_emulate_ctxt *ctxt, struct operand *op) { u8 sib; int index_reg = 0, base_reg = 0, scale; int rc = X86EMUL_CONTINUE; ulong modrm_ea = 0; if (ctxt->rex_prefix) { ctxt->modrm_reg = (ctxt->rex_prefix & 4) << 1; /* REX.R */ index_reg = (ctxt->rex_prefix & 2) << 2; /* REX.X */ ctxt->modrm_rm = base_reg = (ctxt->rex_prefix & 1) << 3; /* REG.B */ } ctxt->modrm = insn_fetch(u8, ctxt); ctxt->modrm_mod |= (ctxt->modrm & 0xc0) >> 6; ctxt->modrm_reg |= (ctxt->modrm & 0x38) >> 3; ctxt->modrm_rm |= (ctxt->modrm & 0x07); ctxt->modrm_seg = VCPU_SREG_DS; if (ctxt->modrm_mod == 3) { op->type = OP_REG; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; op->addr.reg = decode_register(ctxt->modrm_rm, ctxt->regs, ctxt->d & ByteOp); if (ctxt->d & Sse) { op->type = OP_XMM; op->bytes = 16; op->addr.xmm = ctxt->modrm_rm; read_sse_reg(ctxt, &op->vec_val, ctxt->modrm_rm); return rc; } fetch_register_operand(op); return rc; } op->type = OP_MEM; if (ctxt->ad_bytes == 2) { unsigned bx = ctxt->regs[VCPU_REGS_RBX]; unsigned bp = ctxt->regs[VCPU_REGS_RBP]; unsigned si = ctxt->regs[VCPU_REGS_RSI]; unsigned di = ctxt->regs[VCPU_REGS_RDI]; /* 16-bit ModR/M decode. */ switch (ctxt->modrm_mod) { case 0: if (ctxt->modrm_rm == 6) modrm_ea += insn_fetch(u16, ctxt); break; case 1: modrm_ea += insn_fetch(s8, ctxt); break; case 2: modrm_ea += insn_fetch(u16, ctxt); break; } switch (ctxt->modrm_rm) { case 0: modrm_ea += bx + si; break; case 1: modrm_ea += bx + di; break; case 2: modrm_ea += bp + si; break; case 3: modrm_ea += bp + di; break; case 4: modrm_ea += si; break; case 5: modrm_ea += di; break; case 6: if (ctxt->modrm_mod != 0) modrm_ea += bp; break; case 7: modrm_ea += bx; break; } if (ctxt->modrm_rm == 2 || ctxt->modrm_rm == 3 || (ctxt->modrm_rm == 6 && ctxt->modrm_mod != 0)) ctxt->modrm_seg = VCPU_SREG_SS; modrm_ea = (u16)modrm_ea; } else { /* 32/64-bit ModR/M decode. */ if ((ctxt->modrm_rm & 7) == 4) { sib = insn_fetch(u8, ctxt); index_reg |= (sib >> 3) & 7; base_reg |= sib & 7; scale = sib >> 6; if ((base_reg & 7) == 5 && ctxt->modrm_mod == 0) modrm_ea += insn_fetch(s32, ctxt); else modrm_ea += ctxt->regs[base_reg]; if (index_reg != 4) modrm_ea += ctxt->regs[index_reg] << scale; } else if ((ctxt->modrm_rm & 7) == 5 && ctxt->modrm_mod == 0) { if (ctxt->mode == X86EMUL_MODE_PROT64) ctxt->rip_relative = 1; } else modrm_ea += ctxt->regs[ctxt->modrm_rm]; switch (ctxt->modrm_mod) { case 0: if (ctxt->modrm_rm == 5) modrm_ea += insn_fetch(s32, ctxt); break; case 1: modrm_ea += insn_fetch(s8, ctxt); break; case 2: modrm_ea += insn_fetch(s32, ctxt); break; } } op->addr.mem.ea = modrm_ea; done: return rc; }
0
468,499
testcase_resetsolverflags(Solver *solv) { int i; for (i = 0; solverflags2str[i].str; i++) solver_set_flag(solv, solverflags2str[i].flag, solverflags2str[i].def); }
0
272,926
static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception) { int x, y, i; unsigned char bbuf, *BImgBuff, RunCount; ssize_t ldblk; x=0; y=0; ldblk=(ssize_t) ((bpp*image->columns+7)/8); BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk, 8*sizeof(*BImgBuff)); if(BImgBuff==NULL) return(-2); while(y<(ssize_t) image->rows) { int c; c=ReadBlobByte(image); if (c == EOF) break; bbuf=(unsigned char) c; RunCount=bbuf & 0x7F; if(bbuf & 0x80) { if(RunCount) /* repeat next byte runcount * */ { bbuf=ReadBlobByte(image); for(i=0;i<(int) RunCount;i++) InsertByte(bbuf); } else { /* read next byte as RunCount; repeat 0xFF runcount* */ c=ReadBlobByte(image); if (c < 0) break; RunCount=(unsigned char) c; for(i=0;i<(int) RunCount;i++) InsertByte(0xFF); } } else { if(RunCount) /* next runcount byte are readed directly */ { for(i=0;i < (int) RunCount;i++) { bbuf=ReadBlobByte(image); InsertByte(bbuf); } } else { /* repeat previous line runcount* */ c=ReadBlobByte(image); if (c < 0) break; RunCount=(unsigned char) c; if(x) { /* attempt to duplicate row from x position: */ /* I do not know what to do here */ BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); return(-3); } for(i=0;i < (int) RunCount;i++) { x=0; y++; /* Here I need to duplicate previous row RUNCOUNT* */ if(y<2) continue; if(y>(ssize_t) image->rows) { BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); return(-4); } InsertRow(image,BImgBuff,y-1,bpp,exception); } } } } BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); return(y <(ssize_t) image->rows ? -5 : 0); }
0
47,583
destroy_string_fifo( string_fifo * fifo ) { string_node * sn; if (fifo != NULL) { do { UNLINK_FIFO(sn, *fifo, link); if (sn != NULL) { if (sn->s != NULL) free(sn->s); free(sn); } } while (sn != NULL); free(fifo); } }
0
249,372
void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( ProfileSyncService* pss) { if (!command_line_->HasSwitch(switches::kDisableSyncApps)) { pss->RegisterDataTypeController( new ExtensionDataTypeController(syncer::APPS, this, profile_, pss)); } if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) { pss->RegisterDataTypeController( new ExtensionDataTypeController(syncer::EXTENSIONS, this, profile_, pss)); } if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { pss->RegisterDataTypeController( new UIDataTypeController(syncer::PREFERENCES, this, profile_, pss)); } #if defined(ENABLE_THEMES) if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) { pss->RegisterDataTypeController( new ThemeDataTypeController(this, profile_, pss)); } #endif if (!command_line_->HasSwitch(switches::kDisableSyncSearchEngines)) { pss->RegisterDataTypeController( new SearchEngineDataTypeController(this, profile_, pss)); } if (!command_line_->HasSwitch(switches::kDisableSyncExtensionSettings)) { pss->RegisterDataTypeController( new ExtensionSettingDataTypeController( syncer::EXTENSION_SETTINGS, this, profile_, pss)); } if (!command_line_->HasSwitch(switches::kDisableSyncAppSettings)) { pss->RegisterDataTypeController( new ExtensionSettingDataTypeController( syncer::APP_SETTINGS, this, profile_, pss)); } chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); if (!command_line_->HasSwitch(switches::kDisableSyncSyncedNotifications)) { if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN || channel == chrome::VersionInfo::CHANNEL_CANARY || channel == chrome::VersionInfo::CHANNEL_DEV) { pss->RegisterDataTypeController( new UIDataTypeController( syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); } } #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { pss->RegisterDataTypeController( new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); } #endif }
0
480,308
static inline void req_set_fail(struct io_kiocb *req) { req->flags |= REQ_F_FAIL; }
0
6,866
rename_principal_2_svc(rprinc_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg1, *prime_arg2; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; restriction_t *rp; const char *errmsg = NULL; size_t tlen1, tlen2, clen, slen; char *tdots1, *tdots2, *cdots, *sdots; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->src, &prime_arg1) || krb5_unparse_name(handle->context, arg->dest, &prime_arg2)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } tlen1 = strlen(prime_arg1); trunc_name(&tlen1, &tdots1); tlen2 = strlen(prime_arg2); trunc_name(&tlen2, &tdots2); clen = client_name.length; trunc_name(&clen, &cdots); slen = service_name.length; trunc_name(&slen, &sdots); ret.code = KADM5_OK; if (! CHANGEPW_SERVICE(rqstp)) { if (!kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_DELETE, arg->src, NULL)) ret.code = KADM5_AUTH_DELETE; /* any restrictions at all on the ADD kills the RENAME */ if (!kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_ADD, arg->dest, &rp) || rp) { if (ret.code == KADM5_AUTH_DELETE) ret.code = KADM5_AUTH_INSUFFICIENT; else ret.code = KADM5_AUTH_ADD; } } else ret.code = KADM5_AUTH_INSUFFICIENT; if (ret.code != KADM5_OK) { /* okay to cast lengths to int because trunc_name limits max value */ krb5_klog_syslog(LOG_NOTICE, _("Unauthorized request: kadm5_rename_principal, " "%.*s%s to %.*s%s, " "client=%.*s%s, service=%.*s%s, addr=%s"), (int)tlen1, prime_arg1, tdots1, (int)tlen2, prime_arg2, tdots2, (int)clen, (char *)client_name.value, cdots, (int)slen, (char *)service_name.value, sdots, client_addr(rqstp->rq_xprt)); } else { ret.code = kadm5_rename_principal((void *)handle, arg->src, arg->dest); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); /* okay to cast lengths to int because trunc_name limits max value */ krb5_klog_syslog(LOG_NOTICE, _("Request: kadm5_rename_principal, " "%.*s%s to %.*s%s, %s, " "client=%.*s%s, service=%.*s%s, addr=%s"), (int)tlen1, prime_arg1, tdots1, (int)tlen2, prime_arg2, tdots2, errmsg ? errmsg : _("success"), (int)clen, (char *)client_name.value, cdots, (int)slen, (char *)service_name.value, sdots, client_addr(rqstp->rq_xprt)); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg1); free(prime_arg2); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
1
317,469
_dbus_header_cache_check (DBusHeader *header, int field) { _dbus_assert (field <= DBUS_HEADER_FIELD_LAST); if (header->fields[field].value_pos == _DBUS_HEADER_FIELD_VALUE_UNKNOWN) _dbus_header_cache_revalidate (header); if (header->fields[field].value_pos == _DBUS_HEADER_FIELD_VALUE_NONEXISTENT) return FALSE; return TRUE; }
0
427,593
void __init old_map_region(efi_memory_desc_t *md) { u64 start_pfn, end_pfn, end; unsigned long size; void *va; start_pfn = PFN_DOWN(md->phys_addr); size = md->num_pages << PAGE_SHIFT; end = md->phys_addr + size; end_pfn = PFN_UP(end); if (pfn_range_is_mapped(start_pfn, end_pfn)) { va = __va(md->phys_addr); if (!(md->attribute & EFI_MEMORY_WB)) efi_memory_uc((u64)(unsigned long)va, size); } else va = efi_ioremap(md->phys_addr, size, md->type, md->attribute); md->virt_addr = (u64) (unsigned long) va; if (!va) pr_err("ioremap of 0x%llX failed!\n", (unsigned long long)md->phys_addr); }
0
240,139
static bool need_wrongsec_check(struct svc_rqst *rqstp) { struct nfsd4_compoundres *resp = rqstp->rq_resp; struct nfsd4_compoundargs *argp = rqstp->rq_argp; struct nfsd4_op *this = &argp->ops[resp->opcnt - 1]; struct nfsd4_op *next = &argp->ops[resp->opcnt]; struct nfsd4_operation *thisd; struct nfsd4_operation *nextd; thisd = OPDESC(this); /* * Most ops check wronsec on our own; only the putfh-like ops * have special rules. */ if (!(thisd->op_flags & OP_IS_PUTFH_LIKE)) return false; /* * rfc 5661 2.6.3.1.1.6: don't bother erroring out a * put-filehandle operation if we're not going to use the * result: */ if (argp->opcnt == resp->opcnt) return false; if (next->opnum == OP_ILLEGAL) return false; nextd = OPDESC(next); /* * Rest of 2.6.3.1.1: certain operations will return WRONGSEC * errors themselves as necessary; others should check for them * now: */ return !(nextd->op_flags & OP_HANDLES_WRONGSEC); }
0
438,444
void SegmentInfo::set_writing_app(const char* app) { if (app) { const size_t length = strlen(app) + 1; char* temp_str = new (std::nothrow) char[length]; // NOLINT if (!temp_str) return; #ifdef _MSC_VER strcpy_s(temp_str, length, app); #else strcpy(temp_str, app); #endif delete[] writing_app_; writing_app_ = temp_str; } }
0
39,876
got_buffer_from_bus (FlatpakProxyClient *client, ProxySide *side, Buffer *buffer) { if (client->authenticated && client->proxy->filter) { g_autoptr(Header) header = NULL;; GDBusMessage *rewritten; FlatpakPolicy policy; ExpectedReplyType expected_reply; /* Filter and rewrite incoming messages as needed */ header = parse_header (buffer, 0, client->serial_offset, client->hello_serial); if (header == NULL) { g_warning ("Invalid message header format"); buffer_unref (buffer); side_closed (side); return; } if (!update_socket_messages (side, buffer, header)) return; if (client->proxy->log_messages) print_incoming_header (header); if (header->has_reply_serial) { expected_reply = steal_expected_reply (get_other_side (side), header->reply_serial); /* We only allow replies we expect */ if (expected_reply == EXPECTED_REPLY_NONE) { if (client->proxy->log_messages) g_print ("*Unexpected reply*\n"); buffer_unref (buffer); return; } switch (expected_reply) { case EXPECTED_REPLY_HELLO: /* When we get the initial reply to Hello, allow all further communications to our own unique id. */ if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN) { g_autofree char *my_id = get_arg0_string (buffer); flatpak_proxy_client_update_unique_id_policy (client, my_id, FLATPAK_POLICY_TALK); break; } case EXPECTED_REPLY_REWRITE: /* Replace a roundtrip ping with the rewritten message */ rewritten = g_hash_table_lookup (client->rewrite_reply, GINT_TO_POINTER (header->reply_serial)); if (client->proxy->log_messages) g_print ("*REWRITTEN*\n"); g_dbus_message_set_serial (rewritten, header->serial); g_clear_pointer (&buffer, buffer_unref); buffer = message_to_buffer (rewritten); g_hash_table_remove (client->rewrite_reply, GINT_TO_POINTER (header->reply_serial)); break; case EXPECTED_REPLY_FAKE_LIST_NAMES: /* This is a reply from the bus to a fake ListNames request, request ownership of any name matching a wildcard policy */ queue_wildcard_initial_name_ops (client, header, buffer); /* Don't forward fake replies to the app */ if (client->proxy->log_messages) g_print ("*SKIPPED*\n"); g_clear_pointer (&buffer, buffer_unref); /* Start reading the clients requests now that we are done with the names */ start_reading (&client->client_side); break; case EXPECTED_REPLY_FAKE_GET_NAME_OWNER: /* This is a reply from the bus to a fake GetNameOwner request, update the policy for this unique name based on the policy */ { char *requested_name = g_hash_table_lookup (client->get_owner_reply, GINT_TO_POINTER (header->reply_serial)); if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN) { g_autofree char *owner = get_arg0_string (buffer); flatpak_proxy_client_update_unique_id_policy_from_name (client, owner, requested_name); } g_hash_table_remove (client->get_owner_reply, GINT_TO_POINTER (header->reply_serial)); /* Don't forward fake replies to the app */ if (client->proxy->log_messages) g_print ("*SKIPPED*\n"); g_clear_pointer (&buffer, buffer_unref); break; } case EXPECTED_REPLY_FILTER: if (client->proxy->log_messages) g_print ("*SKIPPED*\n"); g_clear_pointer (&buffer, buffer_unref); break; case EXPECTED_REPLY_LIST_NAMES: /* This is a reply from the bus to a ListNames request, filter it according to the policy */ if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN) { Buffer *filtered_buffer; filtered_buffer = filter_names_list (client, buffer); g_clear_pointer (&buffer, buffer_unref); buffer = filtered_buffer; } break; case EXPECTED_REPLY_NORMAL: break; default: g_warning ("Unexpected expected reply type %d", expected_reply); } } else /* Not reply */ { /* Don't allow reply types with no reply_serial */ if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN || header->type == G_DBUS_MESSAGE_TYPE_ERROR) { if (client->proxy->log_messages) g_print ("*Invalid reply*\n"); g_clear_pointer (&buffer, buffer_unref); } /* We filter all NameOwnerChanged signal according to the policy */ if (message_is_name_owner_changed (client, header)) { if (should_filter_name_owner_changed (client, buffer)) g_clear_pointer (&buffer, buffer_unref); } } /* All incoming broadcast signals are filtered according to policy */ if (header->type == G_DBUS_MESSAGE_TYPE_SIGNAL && header->destination == NULL) { policy = flatpak_proxy_client_get_policy (client, header->sender); if (policy < FLATPAK_POLICY_TALK) { if (client->proxy->log_messages) g_print ("*FILTERED IN*\n"); g_clear_pointer (&buffer, buffer_unref); } } /* We received and forwarded a message from a trusted peer. Make the policy for this unique id SEE so that the client can track its lifetime. */ if (buffer && header->sender && header->sender[0] == ':') flatpak_proxy_client_update_unique_id_policy (client, header->sender, FLATPAK_POLICY_SEE); if (buffer && client_message_generates_reply (header)) queue_expected_reply (side, header->serial, EXPECTED_REPLY_NORMAL); } if (buffer) queue_outgoing_buffer (&client->client_side, buffer); }
0
157,045
DECLAREContigPutFunc(put4bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 2; for( ; h > 0; --h) { uint32* bw; UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } }
0
482,071
private void restore_cont(struct magic_set *ms, struct cont *c) { efree(ms->c.li);
0
25,047
static gcry_module_t gcry_pk_lookup_name ( const char * name ) { gcry_module_t pubkey ; pubkey = _gcry_module_lookup ( pubkeys_registered , ( void * ) name , gcry_pk_lookup_func_name ) ; return pubkey ; }
0
296,592
void i40e_vsi_remove_pvid(struct i40e_vsi *vsi) { vsi->info.pvid = 0; i40e_vlan_stripping_disable(vsi); }
0
300,106
static int fastrpc_map_find(struct fastrpc_user *fl, int fd, struct fastrpc_map **ppmap) { struct fastrpc_map *map = NULL; mutex_lock(&fl->mutex); list_for_each_entry(map, &fl->maps, node) { if (map->fd == fd) { fastrpc_map_get(map); *ppmap = map; mutex_unlock(&fl->mutex); return 0; } } mutex_unlock(&fl->mutex); return -ENOENT; }
0
145,885
bool CudnnSupport::DoXYPad(Stream* stream, const dnn::BatchDescriptor& dimensions, const DeviceMemory<float>& input_data, int64 left_pad, int64 right_pad, int64 top_pad, int64 bottom_pad, DeviceMemory<float>* output_data) { LOG(FATAL) << "not yet implemented"; // TODO(leary) return false; }
0
106,460
PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2( pj_pool_t *pool, pjmedia_sdp_neg *neg, unsigned flags, const pjmedia_sdp_session *local) { pjmedia_sdp_session *new_offer; pjmedia_sdp_session *old_offer; unsigned oi; /* old offer media index */ pj_status_t status; /* Check arguments are valid. */ PJ_ASSERT_RETURN(pool && neg && local, PJ_EINVAL); /* Can only do this in STATE_DONE. */ PJ_ASSERT_RETURN(neg->state == PJMEDIA_SDP_NEG_STATE_DONE, PJMEDIA_SDPNEG_EINSTATE); /* Validate the new offer */ status = pjmedia_sdp_validate(local); if (status != PJ_SUCCESS) return status; /* Change state to STATE_LOCAL_OFFER */ neg->state = PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER; /* When there is no active local SDP in state PJMEDIA_SDP_NEG_STATE_DONE, * it means that the previous initial SDP nego must have been failed, * so we'll just set the local SDP offer here. */ if (!neg->active_local_sdp) { neg->initial_sdp_tmp = NULL; neg->initial_sdp = pjmedia_sdp_session_clone(pool, local); neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local); return PJ_SUCCESS; } /* Init vars */ old_offer = neg->active_local_sdp; new_offer = pjmedia_sdp_session_clone(pool, local); /* RFC 3264 Section 8: When issuing an offer that modifies the session, * the "o=" line of the new SDP MUST be identical to that in the * previous SDP, except that the version in the origin field MUST * increment by one from the previous SDP. */ pj_strdup(pool, &new_offer->origin.user, &old_offer->origin.user); new_offer->origin.id = old_offer->origin.id; pj_strdup(pool, &new_offer->origin.net_type, &old_offer->origin.net_type); pj_strdup(pool, &new_offer->origin.addr_type,&old_offer->origin.addr_type); pj_strdup(pool, &new_offer->origin.addr, &old_offer->origin.addr); if ((flags & PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE) == 0) { /* Generating the new offer, in the case media lines doesn't match the * active SDP (e.g. current/active SDP's have m=audio and m=video lines, * and the new offer only has m=audio line), the negotiator will fix * the new offer by reordering and adding the missing media line with * port number set to zero. */ for (oi = 0; oi < old_offer->media_count; ++oi) { pjmedia_sdp_media *om; pjmedia_sdp_media *nm; unsigned ni; /* new offer media index */ pj_bool_t found = PJ_FALSE; om = old_offer->media[oi]; for (ni = oi; ni < new_offer->media_count; ++ni) { nm = new_offer->media[ni]; if (pj_strcmp(&nm->desc.media, &om->desc.media) == 0) { if (ni != oi) { /* The same media found but the position unmatched to * the old offer, so let's put this media in the right * place, and keep the order of the rest. */ pj_array_insert( new_offer->media, /* array */ sizeof(new_offer->media[0]), /* elmt size*/ ni, /* count */ oi, /* pos */ &nm); /* new elmt */ } found = PJ_TRUE; break; } } if (!found) { pjmedia_sdp_media *m; m = sdp_media_clone_deactivate(pool, om, om, local); pj_array_insert(new_offer->media, sizeof(new_offer->media[0]), new_offer->media_count++, oi, &m); } } } else { /* If media type change is allowed, the negotiator only needs to fix * the new offer by adding the missing media line(s) with port number * set to zero. */ for (oi = new_offer->media_count; oi < old_offer->media_count; ++oi) { pjmedia_sdp_media *m; m = sdp_media_clone_deactivate(pool, old_offer->media[oi], old_offer->media[oi], local); pj_array_insert(new_offer->media, sizeof(new_offer->media[0]), new_offer->media_count++, oi, &m); } } /* New_offer fixed */ #if PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION new_offer->origin.version = old_offer->origin.version; if (pjmedia_sdp_session_cmp(new_offer, neg->initial_sdp, 0) != PJ_SUCCESS) { ++new_offer->origin.version; } #else new_offer->origin.version = old_offer->origin.version + 1; #endif neg->initial_sdp_tmp = neg->initial_sdp; neg->initial_sdp = new_offer; neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, new_offer); return PJ_SUCCESS; }
0
367,043
int security_inode_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { if (unlikely(IS_PRIVATE(dentry->d_inode))) return 0; return security_ops->inode_setxattr(dentry, name, value, size, flags); }
0
412,567
pk_transaction_get_packages (PkTransaction *transaction, GVariant *params, GDBusMethodInvocation *context) { PkBitfield filter; g_autoptr(GError) error = NULL; g_return_if_fail (PK_IS_TRANSACTION (transaction)); g_return_if_fail (transaction->priv->tid != NULL); g_variant_get (params, "(t)", &filter); g_debug ("GetPackages method called: %" G_GUINT64_FORMAT, filter); /* not implemented yet */ if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_PACKAGES)) { g_set_error (&error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED, "GetPackages not supported by backend"); pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR); goto out; } /* save so we can run later */ transaction->priv->cached_filters = filter; pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_PACKAGES); pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_READY); out: pk_transaction_dbus_return (context, error); }
0
477,579
static int sixpack_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct sixpack *sp = sp_get(tty); struct net_device *dev; unsigned int tmp, err; if (!sp) return -ENXIO; dev = sp->dev; switch(cmd) { case SIOCGIFNAME: err = copy_to_user((void __user *) arg, dev->name, strlen(dev->name) + 1) ? -EFAULT : 0; break; case SIOCGIFENCAP: err = put_user(0, (int __user *) arg); break; case SIOCSIFENCAP: if (get_user(tmp, (int __user *) arg)) { err = -EFAULT; break; } sp->mode = tmp; dev->addr_len = AX25_ADDR_LEN; dev->hard_header_len = AX25_KISS_HEADER_LEN + AX25_MAX_HEADER_LEN + 3; dev->type = ARPHRD_AX25; err = 0; break; case SIOCSIFHWADDR: { char addr[AX25_ADDR_LEN]; if (copy_from_user(&addr, (void __user *)arg, AX25_ADDR_LEN)) { err = -EFAULT; break; } netif_tx_lock_bh(dev); __dev_addr_set(dev, &addr, AX25_ADDR_LEN); netif_tx_unlock_bh(dev); err = 0; break; } default: err = tty_mode_ioctl(tty, cmd, arg); } sp_put(sp); return err; }
0
490,168
pgp_get_data(sc_card_t *card, unsigned int tag, u8 *buf, size_t buf_len) { sc_apdu_t apdu; int r; LOG_FUNC_CALLED(card->ctx); sc_format_apdu(card, &apdu, SC_APDU_CASE_2, 0xCA, tag >> 8, tag); apdu.le = ((buf_len >= 256) && !(card->caps & SC_CARD_CAP_APDU_EXT)) ? 256 : buf_len; apdu.resp = buf; apdu.resplen = buf_len; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); /* For Gnuk card, if there is no certificate, it returns error instead of empty data. * So, for this case, we ignore error and consider success */ if (r == SC_ERROR_DATA_OBJECT_NOT_FOUND && card->type == SC_CARD_TYPE_OPENPGP_GNUK && (tag == DO_CERT || tag == DO_PRIV1 || tag == DO_PRIV2 || tag == DO_PRIV3 || tag == DO_PRIV4)) { r = SC_SUCCESS; apdu.resplen = 0; } LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, (int)apdu.resplen); }
0
294,094
static inline bool tcp_too_many_orphans(struct sock *sk, int shift) { struct percpu_counter *ocp = sk->sk_prot->orphan_count; int orphans = percpu_counter_read_positive(ocp); if (orphans << shift > sysctl_tcp_max_orphans) { orphans = percpu_counter_sum_positive(ocp); if (orphans << shift > sysctl_tcp_max_orphans) return true; } return false; }
0
159,205
const char * CLASS foveon_camf_param (const char *block, const char *param) { unsigned idx, num; char *pos, *cp, *dp; for (idx=0; idx < meta_length; idx += sget4(pos+8)) { pos = meta_data + idx; if (strncmp (pos, "CMb", 3)) break; if (pos[3] != 'P') continue; if (strcmp (block, pos+sget4(pos+12))) continue; cp = pos + sget4(pos+16); num = sget4(cp); dp = pos + sget4(cp+4); while (num--) { cp += 8; if (!strcmp (param, dp+sget4(cp))) return dp+sget4(cp+4); } } return 0; }
0
29,829
static int dissect_h245_T_controlFieldOctets ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 323 "../../asn1/h245/h245.cnf" guint32 value ; offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 2U , & value , FALSE ) ; if ( h223_lc_params_temp && h223_lc_params_temp -> al_params ) ( ( h223_al3_params * ) h223_lc_params_temp -> al_params ) -> control_field_octets = value & 3 ; return offset ; }
0
423,461
dns_zone_getclass(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->rdclass); }
0
456,210
get_root_window (xcb_connection_t *connection, int screen_number) { xcb_screen_t *screen = NULL; xcb_screen_iterator_t iter; iter = xcb_setup_roots_iterator (xcb_get_setup (connection)); while (iter.rem) { if (screen_number == 0) screen = iter.data; screen_number--; xcb_screen_next (&iter); } if (screen != NULL) { return screen->root; } return XCB_WINDOW_NONE; }
0
153,108
const FunctionDefLibrary* library() const override { return &graph_def_.library(); }
0
27,748
static int decode_bmv_frame ( const uint8_t * source , int src_len , uint8_t * frame , int frame_off ) { unsigned val , saved_val = 0 ; int tmplen = src_len ; const uint8_t * src , * source_end = source + src_len ; uint8_t * frame_end = frame + SCREEN_WIDE * SCREEN_HIGH ; uint8_t * dst , * dst_end ; int len , mask ; int forward = ( frame_off <= - SCREEN_WIDE ) || ( frame_off >= 0 ) ; int read_two_nibbles , flag ; int advance_mode ; int mode = 0 ; int i ; if ( src_len <= 0 ) return AVERROR_INVALIDDATA ; if ( forward ) { src = source ; dst = frame ; dst_end = frame_end ; } else { src = source + src_len - 1 ; dst = frame_end - 1 ; dst_end = frame - 1 ; } for ( ; ; ) { int shift = 0 ; flag = 0 ; if ( ! mode || ( tmplen == 4 ) ) { if ( src < source || src >= source_end ) return AVERROR_INVALIDDATA ; val = * src ; read_two_nibbles = 1 ; } else { val = saved_val ; read_two_nibbles = 0 ; } if ( ! ( val & 0xC ) ) { for ( ; ; ) { if ( ! read_two_nibbles ) { if ( src < source || src >= source_end ) return AVERROR_INVALIDDATA ; shift += 2 ; val |= * src << shift ; if ( * src & 0xC ) break ; } read_two_nibbles = 0 ; shift += 2 ; mask = ( 1 << shift ) - 1 ; val = ( ( val >> 2 ) & ~ mask ) | ( val & mask ) ; NEXT_BYTE ( src ) ; if ( ( val & ( 0xC << shift ) ) ) { flag = 1 ; break ; } } } else if ( mode ) { flag = tmplen != 4 ; } if ( flag ) { tmplen = 4 ; } else { saved_val = val >> ( 4 + shift ) ; tmplen = 0 ; val &= ( 1 << ( shift + 4 ) ) - 1 ; NEXT_BYTE ( src ) ; } advance_mode = val & 1 ; len = ( val >> 1 ) - 1 ; mode += 1 + advance_mode ; if ( mode >= 4 ) mode -= 3 ; if ( FFABS ( dst_end - dst ) < len ) return AVERROR_INVALIDDATA ; switch ( mode ) { case 1 : if ( forward ) { if ( dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len ) return AVERROR_INVALIDDATA ; for ( i = 0 ; i < len ; i ++ ) dst [ i ] = dst [ frame_off + i ] ; dst += len ; } else { dst -= len ; if ( dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len ) return AVERROR_INVALIDDATA ; for ( i = len - 1 ; i >= 0 ; i -- ) dst [ i ] = dst [ frame_off + i ] ; } break ; case 2 : if ( forward ) { if ( source + src_len - src < len ) return AVERROR_INVALIDDATA ; memcpy ( dst , src , len ) ; dst += len ; src += len ; } else { if ( src - source < len ) return AVERROR_INVALIDDATA ; dst -= len ; src -= len ; memcpy ( dst , src , len ) ; } break ; case 3 : val = forward ? dst [ - 1 ] : dst [ 1 ] ; if ( forward ) { memset ( dst , val , len ) ; dst += len ; } else { dst -= len ; memset ( dst , val , len ) ; } break ; default : break ; } if ( dst == dst_end ) return 0 ; } return 0 ; }
0
232,652
void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* data, GLuint client_id) { TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM", "context", logger_.GetLogPrefix(), "mailbox[0]", static_cast<unsigned char>(data[0])); const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " "passed a mailbox that was not " "generated by GenMailboxCHROMIUM."; TextureRef* texture_ref = GetTexture(client_id); if (texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); return; } Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); if (!texture) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); return; } if (texture->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glCreateAndConsumeTextureCHROMIUM", "invalid target"); return; } texture_ref = texture_manager()->Consume(client_id, texture); }
0
231,280
void BaseAudioContext::ScheduleMainThreadCleanup() { if (has_posted_cleanup_task_) return; PostCrossThreadTask( *task_runner_, FROM_HERE, CrossThreadBind(&BaseAudioContext::PerformCleanupOnMainThread, WrapCrossThreadPersistent(this))); has_posted_cleanup_task_ = true; }
0
56,766
static void scalar_min_max_mul(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { s64 smin_val = src_reg->smin_value; u64 umin_val = src_reg->umin_value; u64 umax_val = src_reg->umax_value; if (smin_val < 0 || dst_reg->smin_value < 0) { /* Ain't nobody got time to multiply that sign */ __mark_reg64_unbounded(dst_reg); return; } /* Both values are positive, so we can work with unsigned and * copy the result to signed (unless it exceeds S64_MAX). */ if (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) { /* Potential overflow, we know nothing */ __mark_reg64_unbounded(dst_reg); return; } dst_reg->umin_value *= umin_val; dst_reg->umax_value *= umax_val; if (dst_reg->umax_value > S64_MAX) { /* Overflow possible, we know nothing */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } }
0
85,387
PHP_FUNCTION(imagedestroy) { zval *IM; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) { return; } if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) { RETURN_FALSE; } zend_list_close(Z_RES_P(IM)); RETURN_TRUE; }
0