idx
int64
func
string
target
int64
251,939
void MessageService::PendingOpenChannel(scoped_ptr<OpenChannelParams> params, int source_process_id, ExtensionHost* host) { if (!host) return; // TODO(mpcomplete): notify source of disconnect? content::RenderProcessHost* source = content::RenderProcessHost::FromID(source_process_id); if (!source) return; params->source = source; params->receiver.reset(new ExtensionMessagePort(host->render_process_host(), MSG_ROUTING_CONTROL, params->target_extension_id)); OpenChannelImpl(params.Pass()); }
0
411,016
static struct sctp_chunk *sctp_make_reconf(const struct sctp_association *asoc, int length) { struct sctp_reconf_chunk *reconf; struct sctp_chunk *retval; retval = sctp_make_control(asoc, SCTP_CID_RECONF, 0, length, GFP_ATOMIC); if (!retval) return NULL; reconf = (struct sctp_reconf_chunk *)retval->chunk_hdr; retval->param_hdr.v = reconf->params; return retval; }
0
386,707
static guint parse_rle_data_grayscale(TGAContext *ctx) { TGAColor tone; guint rle_num, raw_num; guchar *s, tag; guint n; g_return_val_if_fail(ctx->in->size > 0, 0); s = ctx->in->data; for (n = 0; n < ctx->in->size; ) { tag = *s; s++, n++; if (tag & 0x80) { if (n + (ctx->pbuf->n_channels == 4 ? 2 : 1) >= ctx->in->size) { return --n; } else { rle_num = (tag & 0x7f) + 1; tone.r = tone.g = tone.b = *s; s++, n++; if (ctx->pbuf->n_channels == 4) { tone.a = *s++; n++; } write_rle_data(ctx, &tone, &rle_num); if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) { ctx->done = TRUE; return n; } } } else { raw_num = tag + 1; if (n + raw_num * (ctx->pbuf->n_channels == 4 ? 2 : 1) >= ctx->in->size) { return --n; } else { for (; raw_num; raw_num--) { ctx->pptr[0] = ctx->pptr[1] = ctx->pptr[2] = *s; s++, n++; if (ctx->pbuf->n_channels == 4) { ctx->pptr[3] = *s++; n++; } ctx->pptr += ctx->pbuf->n_channels; ctx->pbuf_bytes_done += ctx->pbuf->n_channels; if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) { ctx->done = TRUE; return n; } } } } } if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) ctx->done = TRUE; return n; }
0
377,500
get_hostfile_hostname_ipaddr(char *hostname, struct sockaddr *hostaddr, u_short port, char **hostfile_hostname, char **hostfile_ipaddr) { char ntop[NI_MAXHOST]; socklen_t addrlen; switch (hostaddr == NULL ? -1 : hostaddr->sa_family) { case -1: addrlen = 0; break; case AF_INET: addrlen = sizeof(struct sockaddr_in); break; case AF_INET6: addrlen = sizeof(struct sockaddr_in6); break; default: addrlen = sizeof(struct sockaddr); break; } /* * We don't have the remote ip-address for connections * using a proxy command */ if (hostfile_ipaddr != NULL) { if (options.proxy_command == NULL) { if (getnameinfo(hostaddr, addrlen, ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0) fatal("check_host_key: getnameinfo failed"); *hostfile_ipaddr = put_host_port(ntop, port); } else { *hostfile_ipaddr = xstrdup("<no hostip for proxy " "command>"); } } /* * Allow the user to record the key under a different name or * differentiate a non-standard port. This is useful for ssh * tunneling over forwarded connections or if you run multiple * sshd's on different ports on the same machine. */ if (hostfile_hostname != NULL) { if (options.host_key_alias != NULL) { *hostfile_hostname = xstrdup(options.host_key_alias); debug("using hostkeyalias: %s", *hostfile_hostname); } else { *hostfile_hostname = put_host_port(hostname, port); } } }
0
315,116
void Document::setDir(const AtomicString& value) { Element* rootElement = documentElement(); if (isHTMLHtmlElement(rootElement)) toHTMLHtmlElement(rootElement)->setDir(value); }
0
136,536
AP4_SubtitleSampleEntry::ReadFields(AP4_ByteStream& stream) { // sample entry AP4_Result result = AP4_SampleEntry::ReadFields(stream); if (result < 0) return result; // read fields from this class result = stream.ReadNullTerminatedString(m_Namespace); if (AP4_FAILED(result)) return result; result = stream.ReadNullTerminatedString(m_SchemaLocation); if (AP4_FAILED(result)) return result; result = stream.ReadNullTerminatedString(m_ImageMimeType); if (AP4_FAILED(result)) return result; return AP4_SUCCESS; }
0
509,969
JPEGVGetField(TIFF* tif, uint32 tag, va_list ap) { JPEGState* sp = JState(tif); assert(sp != NULL); switch (tag) { case TIFFTAG_JPEGTABLES: *va_arg(ap, uint32*) = sp->jpegtables_length; *va_arg(ap, void**) = sp->jpegtables; break; case TIFFTAG_JPEGQUALITY: *va_arg(ap, int*) = sp->jpegquality; break; case TIFFTAG_JPEGCOLORMODE: *va_arg(ap, int*) = sp->jpegcolormode; break; case TIFFTAG_JPEGTABLESMODE: *va_arg(ap, int*) = sp->jpegtablesmode; break; default: return (*sp->vgetparent)(tif, tag, ap); } return (1); }
0
446,861
int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *oldreq, struct ldb_request *newreq) { if (newreq == NULL) return LDB_ERR_OPERATIONS_ERROR; if (oldreq == NULL) { return ldb_set_timeout(ldb, newreq, 0); } newreq->starttime = oldreq->starttime; newreq->timeout = oldreq->timeout; return LDB_SUCCESS; }
0
517,947
void Item_ref::cleanup() { DBUG_ENTER("Item_ref::cleanup"); Item_ident::cleanup(); if (reference_trough_name) { /* We have to reset the reference as it may been freed */ ref= 0; } DBUG_VOID_RETURN; }
0
21,471
static Datum ExecEvalWholeRowFast ( WholeRowVarExprState * wrvstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { Var * variable = ( Var * ) wrvstate -> xprstate . expr ; TupleTableSlot * slot ; HeapTupleHeader dtuple ; if ( isDone ) * isDone = ExprSingleResult ; * isNull = false ; switch ( variable -> varno ) { case INNER_VAR : slot = econtext -> ecxt_innertuple ; break ; case OUTER_VAR : slot = econtext -> ecxt_outertuple ; break ; default : slot = econtext -> ecxt_scantuple ; break ; } if ( wrvstate -> wrv_junkFilter != NULL ) slot = ExecFilterJunk ( wrvstate -> wrv_junkFilter , slot ) ; dtuple = DatumGetHeapTupleHeader ( ExecFetchSlotTupleDatum ( slot ) ) ; HeapTupleHeaderSetTypeId ( dtuple , wrvstate -> wrv_tupdesc -> tdtypeid ) ; HeapTupleHeaderSetTypMod ( dtuple , wrvstate -> wrv_tupdesc -> tdtypmod ) ; return PointerGetDatum ( dtuple ) ; }
0
135,195
static void parse_new_blob(void) { read_next_command(); parse_mark(); parse_and_store_blob(&last_blob, NULL, next_mark); }
0
414,233
GuestUserList *qmp_guest_get_users(Error **errp) { error_setg(errp, QERR_UNSUPPORTED); return NULL; }
0
15,471
static UHashTok _uhash_setElement ( UHashtable * hash , UHashElement * e , int32_t hashcode , UHashTok key , UHashTok value , int8_t hint ) { UHashTok oldValue = e -> value ; if ( hash -> keyDeleter != NULL && e -> key . pointer != NULL && e -> key . pointer != key . pointer ) { ( * hash -> keyDeleter ) ( e -> key . pointer ) ; } if ( hash -> valueDeleter != NULL ) { if ( oldValue . pointer != NULL && oldValue . pointer != value . pointer ) { ( * hash -> valueDeleter ) ( oldValue . pointer ) ; } oldValue . pointer = NULL ; } if ( hint & HINT_KEY_POINTER ) { e -> key . pointer = key . pointer ; } else { e -> key = key ; } if ( hint & HINT_VALUE_POINTER ) { e -> value . pointer = value . pointer ; } else { e -> value = value ; } e -> hashcode = hashcode ; return oldValue ; }
0
214,967
GDataEntry::GDataEntry(GDataDirectory* parent, GDataEntry::GDataEntry(GDataDirectoryService* directory_service) : parent_(NULL), directory_service_(directory_service), deleted_(false) { }
0
518,576
int Field_time::store(double nr) { MYSQL_TIME ltime; ErrConvDouble str(nr); int was_cut; bool neg= nr < 0; if (neg) nr= -nr; int have_smth_to_conv= !number_to_time(neg, (ulonglong) nr, (ulong)((nr - floor(nr)) * TIME_SECOND_PART_FACTOR), &ltime, &was_cut); return store_TIME_with_warning(&ltime, &str, was_cut, have_smth_to_conv); }
0
131,211
static void reallymarkobject (global_State *g, GCObject *o) { white2gray(o); switch (o->tt) { case LUA_VSHRSTR: case LUA_VLNGSTR: { gray2black(o); break; } case LUA_VUPVAL: { UpVal *uv = gco2upv(o); if (!upisopen(uv)) /* open upvalues are kept gray */ gray2black(o); markvalue(g, uv->v); /* mark its content */ break; } case LUA_VUSERDATA: { Udata *u = gco2u(o); if (u->nuvalue == 0) { /* no user values? */ markobjectN(g, u->metatable); /* mark its metatable */ gray2black(o); /* nothing else to mark */ break; } /* else... */ } /* FALLTHROUGH */ case LUA_VLCL: case LUA_VCCL: case LUA_VTABLE: case LUA_VTHREAD: case LUA_VPROTO: { linkobjgclist(o, g->gray); break; } default: lua_assert(0); break; } }
0
57,273
static void tcp_incr_quickack(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); unsigned int quickacks = tcp_sk(sk)->rcv_wnd / (2 * icsk->icsk_ack.rcv_mss); if (quickacks == 0) quickacks = 2; if (quickacks > icsk->icsk_ack.quick) icsk->icsk_ack.quick = min(quickacks, TCP_MAX_QUICKACKS); }
0
63,037
WriteCompressedType(mat_t *mat,matvar_t *matvar,z_streamp z) { int err; mat_uint32_t comp_buf[512]; mat_uint32_t uncomp_buf[512] = {0,}; size_t byteswritten = 0, nelems = 1; if ( MAT_C_EMPTY == matvar->class_type ) { /* exit early if this is an empty data */ return byteswritten; } err = SafeMulDims(matvar, &nelems); if ( err ) { Mat_Critical("Integer multiplication overflow"); return byteswritten; } switch ( matvar->class_type ) { case MAT_C_DOUBLE: case MAT_C_SINGLE: case MAT_C_INT64: case MAT_C_UINT64: case MAT_C_INT32: case MAT_C_UINT32: case MAT_C_INT16: case MAT_C_UINT16: case MAT_C_INT8: case MAT_C_UINT8: { /* WriteCompressedData makes sure uncompressed data is aligned * on an 8-byte boundary */ if ( matvar->isComplex ) { mat_complex_split_t *complex_data = (mat_complex_split_t*)matvar->data; if ( NULL == matvar->data ) complex_data = &null_complex_data; byteswritten += WriteCompressedData(mat,z, complex_data->Re,nelems,matvar->data_type); byteswritten += WriteCompressedData(mat,z, complex_data->Im,nelems,matvar->data_type); } else { byteswritten += WriteCompressedData(mat,z, matvar->data,nelems,matvar->data_type); } break; } case MAT_C_CHAR: { byteswritten += WriteCompressedCharData(mat,z,matvar->data, nelems,matvar->data_type); break; } case MAT_C_CELL: { size_t i; matvar_t **cells = (matvar_t **)matvar->data; /* Check for an empty cell array */ if ( matvar->nbytes == 0 || matvar->data_size == 0 || matvar->data == NULL ) break; nelems = matvar->nbytes / matvar->data_size; for ( i = 0; i < nelems; i++ ) WriteCompressedCellArrayField(mat,cells[i],z); break; } case MAT_C_STRUCT: { int buf_size = 512; mat_int16_t fieldname_type = MAT_T_INT32; mat_int16_t fieldname_data_size = 4; unsigned char *padzero; int fieldname_size; size_t maxlen = 0, nfields, i, nelems_x_nfields; mat_int32_t array_name_type = MAT_T_INT8; matvar_t **fields = (matvar_t **)matvar->data; nfields = matvar->internal->num_fields; /* Check for a structure with no fields */ if ( nfields < 1 ) { fieldname_size = 1; uncomp_buf[0] = (fieldname_data_size << 16) | fieldname_type; uncomp_buf[1] = fieldname_size; uncomp_buf[2] = array_name_type; uncomp_buf[3] = 0; z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = 16; do { z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size*sizeof(*comp_buf); deflate(z,Z_NO_FLUSH); byteswritten += fwrite(comp_buf,1,buf_size* sizeof(*comp_buf)-z->avail_out,(FILE*)mat->fp); } while ( z->avail_out == 0 ); break; } for ( i = 0; i < nfields; i++ ) { size_t len = strlen(matvar->internal->fieldnames[i]); if ( len > maxlen ) maxlen = len; } maxlen++; fieldname_size = maxlen; while ( nfields*fieldname_size % 8 != 0 ) fieldname_size++; uncomp_buf[0] = (fieldname_data_size << 16) | fieldname_type; uncomp_buf[1] = fieldname_size; uncomp_buf[2] = array_name_type; uncomp_buf[3] = nfields*fieldname_size; padzero = (unsigned char*)calloc(fieldname_size,1); z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = 16; do { z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size*sizeof(*comp_buf); deflate(z,Z_NO_FLUSH); byteswritten += fwrite(comp_buf,1, buf_size*sizeof(*comp_buf)-z->avail_out,(FILE*)mat->fp); } while ( z->avail_out == 0 ); for ( i = 0; i < nfields; i++ ) { size_t len = strlen(matvar->internal->fieldnames[i]); memset(padzero,'\0',fieldname_size); memcpy(padzero,matvar->internal->fieldnames[i],len); z->next_in = ZLIB_BYTE_PTR(padzero); z->avail_in = fieldname_size; do { z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size*sizeof(*comp_buf); deflate(z,Z_NO_FLUSH); byteswritten += fwrite(comp_buf,1, buf_size*sizeof(*comp_buf)-z->avail_out,(FILE*)mat->fp); } while ( z->avail_out == 0 ); } free(padzero); err = SafeMul(&nelems_x_nfields, nelems, nfields); if ( err ) { Mat_Critical("Integer multiplication overflow"); return byteswritten; } for ( i = 0; i < nelems_x_nfields; i++ ) byteswritten += WriteCompressedStructField(mat,fields[i],z); break; } case MAT_C_SPARSE: { mat_sparse_t *sparse = (mat_sparse_t*)matvar->data; byteswritten += WriteCompressedData(mat,z,sparse->ir, sparse->nir,MAT_T_INT32); byteswritten += WriteCompressedData(mat,z,sparse->jc, sparse->njc,MAT_T_INT32); if ( matvar->isComplex ) { mat_complex_split_t *complex_data = (mat_complex_split_t*)sparse->data; byteswritten += WriteCompressedData(mat,z, complex_data->Re,sparse->ndata,matvar->data_type); byteswritten += WriteCompressedData(mat,z, complex_data->Im,sparse->ndata,matvar->data_type); } else { byteswritten += WriteCompressedData(mat,z, sparse->data,sparse->ndata,matvar->data_type); } break; } case MAT_C_FUNCTION: case MAT_C_OBJECT: case MAT_C_EMPTY: case MAT_C_OPAQUE: break; } return byteswritten; }
0
187,541
void FrameLoader::load(DocumentLoader* newDocumentLoader) { ResourceRequest& r = newDocumentLoader->request(); addExtraFieldsToMainResourceRequest(r); FrameLoadType type; if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) { r.setCachePolicy(ReloadIgnoringCacheData); type = FrameLoadTypeSame; } else type = FrameLoadTypeStandard; if (m_documentLoader) newDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEncoding()); if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) { ASSERT(type == FrameLoadTypeStandard); type = FrameLoadTypeReload; } loadWithDocumentLoader(newDocumentLoader, type, 0); }
0
194,939
int tls1_ec_curve_id2nid(int curve_id) { /* ECC curves from RFC 4492 and RFC 7027 */ if ((curve_id < 1) || ((unsigned int)curve_id > sizeof(nid_list) / sizeof(nid_list[0]))) return 0; return nid_list[curve_id - 1]; }
0
17,646
static void omap_lpg_tick(void *opaque) { struct omap_lpg_s *s = opaque; if (s->cycle) timer_mod(s->tm, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + s->period - s->on); else timer_mod(s->tm, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + s->on); s->cycle = !s->cycle; printf("%s: LED is %s\n", __FUNCTION__, s->cycle ? "on" : "off"); }
0
78,346
struct usb_device *usb_get_dev(struct usb_device *dev) { if (dev) get_device(&dev->dev); return dev; }
0
387,359
sys_info( sockaddr_u *srcadr, endpt *inter, struct req_pkt *inpkt ) { register struct info_sys *is; is = (struct info_sys *)prepare_pkt(srcadr, inter, inpkt, v6sizeof(struct info_sys)); if (sys_peer) { if (IS_IPV4(&sys_peer->srcadr)) { is->peer = NSRCADR(&sys_peer->srcadr); if (client_v6_capable) is->v6_flag = 0; } else if (client_v6_capable) { is->peer6 = SOCK_ADDR6(&sys_peer->srcadr); is->v6_flag = 1; } is->peer_mode = sys_peer->hmode; } else { is->peer = 0; if (client_v6_capable) { is->v6_flag = 0; } is->peer_mode = 0; } is->leap = sys_leap; is->stratum = sys_stratum; is->precision = sys_precision; is->rootdelay = htonl(DTOFP(sys_rootdelay)); is->rootdispersion = htonl(DTOUFP(sys_rootdisp)); is->frequency = htonl(DTOFP(sys_jitter)); is->stability = htonl(DTOUFP(clock_stability * 1e6)); is->refid = sys_refid; HTONL_FP(&sys_reftime, &is->reftime); is->poll = sys_poll; is->flags = 0; if (sys_authenticate) is->flags |= INFO_FLAG_AUTHENTICATE; if (sys_bclient) is->flags |= INFO_FLAG_BCLIENT; #ifdef REFCLOCK if (cal_enable) is->flags |= INFO_FLAG_CAL; #endif /* REFCLOCK */ if (kern_enable) is->flags |= INFO_FLAG_KERNEL; if (mon_enabled != MON_OFF) is->flags |= INFO_FLAG_MONITOR; if (ntp_enable) is->flags |= INFO_FLAG_NTP; if (hardpps_enable) is->flags |= INFO_FLAG_PPS_SYNC; if (stats_control) is->flags |= INFO_FLAG_FILEGEN; is->bdelay = HTONS_FP(DTOFP(sys_bdelay)); HTONL_UF(sys_authdelay.l_uf, &is->authdelay); (void) more_pkt(); flush_pkt(); }
0
326,364
static void breakpoint_invalidate(CPUState *env, target_ulong pc) { target_ulong phys_addr; phys_addr = cpu_get_phys_page_debug(env, pc); tb_invalidate_phys_page_range(phys_addr, phys_addr + 1, 0); }
0
60,432
set_param_option(char *option) { Str tmp = Strnew(); char *p = option, *q; while (*p && !IS_SPACE(*p) && *p != '=') Strcat_char(tmp, *p++); while (*p && IS_SPACE(*p)) p++; if (*p == '=') { p++; while (*p && IS_SPACE(*p)) p++; } Strlower(tmp); if (set_param(tmp->ptr, p)) goto option_assigned; q = tmp->ptr; if (!strncmp(q, "no", 2)) { /* -o noxxx, -o no-xxx, -o no_xxx */ q += 2; if (*q == '-' || *q == '_') q++; } else if (tmp->ptr[0] == '-') /* -o -xxx */ q++; else return 0; if (set_param(q, "0")) goto option_assigned; return 0; option_assigned: return 1; }
0
189,571
static AUDIO_OBJECT_TYPE getAOTFromProfile(OMX_U32 profile) { if (profile == OMX_AUDIO_AACObjectLC) { return AOT_AAC_LC; } else if (profile == OMX_AUDIO_AACObjectHE) { return AOT_SBR; } else if (profile == OMX_AUDIO_AACObjectHE_PS) { return AOT_PS; } else if (profile == OMX_AUDIO_AACObjectLD) { return AOT_ER_AAC_LD; } else if (profile == OMX_AUDIO_AACObjectELD) { return AOT_ER_AAC_ELD; } else { ALOGW("Unsupported AAC profile - defaulting to AAC-LC"); return AOT_AAC_LC; } }
0
322,948
static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, Error **errp) { struct omap_lcd_panel_s *omap_lcd = opaque; DisplaySurface *surface = qemu_console_surface(omap_lcd->con); omap_update_display(opaque); if (omap_lcd && surface_data(surface)) omap_ppm_save(filename, surface_data(surface), omap_lcd->width, omap_lcd->height, surface_stride(surface), errp); }
0
217,201
virtual ~LoggingNetworkChangeObserver() { net::NetworkChangeNotifier::RemoveIPAddressObserver(this); net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); }
0
223,724
bool AXObject::lastKnownIsIgnoredValue() { if (m_lastKnownIsIgnoredValue == DefaultBehavior) m_lastKnownIsIgnoredValue = accessibilityIsIgnored() ? IgnoreObject : IncludeObject; return m_lastKnownIsIgnoredValue == IgnoreObject; }
0
369,901
xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, xmlEntityPtr ent, size_t replacement) { size_t consumed = 0; if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE)) return (0); if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) return (1); if (replacement != 0) { if (replacement < XML_MAX_TEXT_LENGTH) return(0); /* * If the volume of entity copy reaches 10 times the * amount of parsed data and over the large text threshold * then that's very likely to be an abuse. */ if (ctxt->input != NULL) { consumed = ctxt->input->consumed + (ctxt->input->cur - ctxt->input->base); } consumed += ctxt->sizeentities; if (replacement < XML_PARSER_NON_LINEAR * consumed) return(0); } else if (size != 0) { /* * Do the check based on the replacement size of the entity */ if (size < XML_PARSER_BIG_ENTITY) return(0); /* * A limit on the amount of text data reasonably used */ if (ctxt->input != NULL) { consumed = ctxt->input->consumed + (ctxt->input->cur - ctxt->input->base); } consumed += ctxt->sizeentities; if ((size < XML_PARSER_NON_LINEAR * consumed) && (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed)) return (0); } else if (ent != NULL) { /* * use the number of parsed entities in the replacement */ size = ent->checked; /* * The amount of data parsed counting entities size only once */ if (ctxt->input != NULL) { consumed = ctxt->input->consumed + (ctxt->input->cur - ctxt->input->base); } consumed += ctxt->sizeentities; /* * Check the density of entities for the amount of data * knowing an entity reference will take at least 3 bytes */ if (size * 3 < consumed * XML_PARSER_NON_LINEAR) return (0); } else { /* * strange we got no data for checking just return */ return (0); } xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return (1); }
0
23,215
static PyObject * string_rsplit ( PyStringObject * self , PyObject * args ) { Py_ssize_t len = PyString_GET_SIZE ( self ) , n ; Py_ssize_t maxsplit = - 1 ; const char * s = PyString_AS_STRING ( self ) , * sub ; PyObject * subobj = Py_None ; if ( ! PyArg_ParseTuple ( args , "|On:rsplit" , & subobj , & maxsplit ) ) return NULL ; if ( maxsplit < 0 ) maxsplit = PY_SSIZE_T_MAX ; if ( subobj == Py_None ) return stringlib_rsplit_whitespace ( ( PyObject * ) self , s , len , maxsplit ) ; if ( PyString_Check ( subobj ) ) { sub = PyString_AS_STRING ( subobj ) ; n = PyString_GET_SIZE ( subobj ) ; } # ifdef Py_USING_UNICODE else if ( PyUnicode_Check ( subobj ) ) return PyUnicode_RSplit ( ( PyObject * ) self , subobj , maxsplit ) ; # endif else if ( PyObject_AsCharBuffer ( subobj , & sub , & n ) ) return NULL ; return stringlib_rsplit ( ( PyObject * ) self , s , len , sub , n , maxsplit ) ; }
0
36,690
const QLoggingCategory &Helper::loggerCategory() { return lcDeepinGhost(); }
0
413,036
static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { seq_printf(m, "%d\n", task->patch_state); return 0; }
0
389,803
static MemTxResult watch_mem_read(void *opaque, hwaddr addr, uint64_t *pdata, unsigned size, MemTxAttrs attrs) { MemTxResult res; uint64_t data; check_watchpoint(addr & ~TARGET_PAGE_MASK, size, attrs, BP_MEM_READ); switch (size) { case 1: data = address_space_ldub(&address_space_memory, addr, attrs, &res); break; case 2: data = address_space_lduw(&address_space_memory, addr, attrs, &res); break; case 4: data = address_space_ldl(&address_space_memory, addr, attrs, &res); break; default: abort(); } *pdata = data; return res; }
0
475,651
static void nft_commit_notify(struct net *net, u32 portid) { struct nftables_pernet *nft_net = nft_pernet(net); struct sk_buff *batch_skb = NULL, *nskb, *skb; unsigned char *data; int len; list_for_each_entry_safe(skb, nskb, &nft_net->notify_list, list) { if (!batch_skb) { new_batch: batch_skb = skb; len = NLMSG_GOODSIZE - skb->len; list_del(&skb->list); continue; } len -= skb->len; if (len > 0 && NFT_CB(skb).report == NFT_CB(batch_skb).report) { data = skb_put(batch_skb, skb->len); memcpy(data, skb->data, skb->len); list_del(&skb->list); kfree_skb(skb); continue; } nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES, NFT_CB(batch_skb).report, GFP_KERNEL); goto new_batch; } if (batch_skb) { nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES, NFT_CB(batch_skb).report, GFP_KERNEL); } WARN_ON_ONCE(!list_empty(&nft_net->notify_list)); }
0
394,797
CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ { cwd_state new_state; char cwd[MAXPATHLEN]; /* realpath("") returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); if (new_state.cwd == NULL) { return NULL; } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { path = cwd; } } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && VCWD_GETCWD(cwd, MAXPATHLEN)) { new_state.cwd = strdup(cwd); new_state.cwd_length = strlen(cwd); } else { new_state.cwd = (char*)malloc(1); if (new_state.cwd == NULL) { return NULL; } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { free(new_state.cwd); return NULL; } if (real_path) { int copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length; memcpy(real_path, new_state.cwd, copy_len); real_path[copy_len] = '\0'; free(new_state.cwd); return real_path; } else { return new_state.cwd; } }
0
173,434
cmd_http_sendhex(CMD_ARGS) { struct http *hp; char buf[3], *q; uint8_t *p; int i, j, l; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); l = strlen(av[1]) / 2; p = malloc(l); AN(p); q = av[1]; for (i = 0; i < l; i++) { while (vct_issp(*q)) q++; if (*q == '\0') break; memcpy(buf, q, 2); q += 2; buf[2] = '\0'; if (!vct_ishex(buf[0]) || !vct_ishex(buf[1])) vtc_log(hp->vl, 0, "Illegal Hex char \"%c%c\"", buf[0], buf[1]); p[i] = (uint8_t)strtoul(buf, NULL, 16); } vtc_hexdump(hp->vl, 4, "sendhex", (void*)p, i); j = write(hp->fd, p, i); assert(j == i); free(p); }
0
258,282
static int get_dimension ( GetBitContext * gb , const int * dim ) { int t = get_bits ( gb , 3 ) ; int val = dim [ t ] ; if ( val < 0 ) val = dim [ get_bits1 ( gb ) - val ] ; if ( ! val ) { do { t = get_bits ( gb , 8 ) ; val += t << 2 ; } while ( t == 0xFF ) ; } return val ; }
0
73,339
hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref) { int i, j; struct hid_report *report; struct hid_report_enum *report_enum; struct hid_field *field; if (uref->report_type < HID_REPORT_TYPE_MIN || uref->report_type > HID_REPORT_TYPE_MAX) return NULL; report_enum = hid->report_enum + (uref->report_type - HID_REPORT_TYPE_MIN); list_for_each_entry(report, &report_enum->report_list, list) { for (i = 0; i < report->maxfield; i++) { field = report->field[i]; for (j = 0; j < field->maxusage; j++) { if (field->usage[j].hid == uref->usage_code) { uref->report_id = report->id; uref->field_index = i; uref->usage_index = j; return field; } } } } return NULL; }
0
65,244
MagickExport ModuleInfo *GetModuleInfo(const char *tag,ExceptionInfo *exception) { ModuleInfo *module_info; if (IsModuleTreeInstantiated() == MagickFalse) return((ModuleInfo *) NULL); LockSemaphoreInfo(module_semaphore); ResetSplayTreeIterator(module_list); if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0)) { #if defined(MAGICKCORE_MODULES_SUPPORT) if (LocaleCompare(tag,"*") == 0) (void) OpenModules(exception); #endif module_info=(ModuleInfo *) GetNextValueInSplayTree(module_list); UnlockSemaphoreInfo(module_semaphore); return(module_info); } module_info=(ModuleInfo *) GetValueFromSplayTree(module_list,tag); UnlockSemaphoreInfo(module_semaphore); return(module_info); }
0
237,390
void EventBindings::AttachEvent(const std::string& event_name) { if (!context()->HasAccessOrThrowError(event_name)) return; attached_event_names_.insert(event_name); const std::string& extension_id = context()->GetExtensionID(); if (IncrementEventListenerCount(context(), event_name) == 1) { content::RenderThread::Get()->Send(new ExtensionHostMsg_AddListener( extension_id, context()->url(), event_name)); } if (ExtensionFrameHelper::IsContextForEventPage(context())) { content::RenderThread::Get()->Send( new ExtensionHostMsg_AddLazyListener(extension_id, event_name)); } }
0
239,174
static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) { return !fc->initialized || (for_background && fc->blocked); }
0
490,274
char *_q_strcpy(char *dst, size_t size, const char *src) { if (dst == NULL || size == 0 || src == NULL) return dst; size_t copylen = strlen(src); if (copylen >= size) copylen = size - 1; memmove((void *)dst, (void *)src, copylen); dst[copylen] = '\0'; return dst; }
0
506,359
static int tls1_set_shared_sigalgs(SSL *s) { const unsigned char *pref, *allow, *conf; size_t preflen, allowlen, conflen; size_t nmatch; TLS_SIGALGS *salgs = NULL; CERT *c = s->cert; unsigned int is_suiteb = tls1_suiteb(s); if (c->shared_sigalgs) { OPENSSL_free(c->shared_sigalgs); c->shared_sigalgs = NULL; } /* If client use client signature algorithms if not NULL */ if (!s->server && c->client_sigalgs && !is_suiteb) { conf = c->client_sigalgs; conflen = c->client_sigalgslen; } else if (c->conf_sigalgs && !is_suiteb) { conf = c->conf_sigalgs; conflen = c->conf_sigalgslen; } else conflen = tls12_get_psigalgs(s, &conf); if(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || is_suiteb) { pref = conf; preflen = conflen; allow = c->peer_sigalgs; allowlen = c->peer_sigalgslen; } else { allow = conf; allowlen = conflen; pref = c->peer_sigalgs; preflen = c->peer_sigalgslen; } nmatch = tls12_shared_sigalgs(s, NULL, pref, preflen, allow, allowlen); if (!nmatch) return 1; salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS)); if (!salgs) return 0; nmatch = tls12_shared_sigalgs(s, salgs, pref, preflen, allow, allowlen); c->shared_sigalgs = salgs; c->shared_sigalgslen = nmatch; return 1; }
0
506,156
int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key) { if (cert == NULL) return 1; if (SSL_CTX_use_certificate(ctx,cert) <= 0) { BIO_printf(bio_err,"error setting certificate\n"); ERR_print_errors(bio_err); return 0; } if (SSL_CTX_use_PrivateKey(ctx,key) <= 0) { BIO_printf(bio_err,"error setting private key\n"); ERR_print_errors(bio_err); return 0; } /* Now we know that a key and cert have been set against * the SSL context */ if (!SSL_CTX_check_private_key(ctx)) { BIO_printf(bio_err,"Private key does not match the certificate public key\n"); return 0; } return 1; }
0
478,332
T& atNXY(const int pos, const int x, const int y, const int z=0, const int c=0) { if (is_empty()) throw CImgInstanceException(_cimglist_instance "atNXY(): Empty instance.", cimglist_instance); return _atNXY(pos,x,y,z,c); }
0
497,128
static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb) { int aot = ac->oc[1].m4ac.object_type; if (aot != AOT_ER_AAC_ELD) { if (get_bits1(gb)) { av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n"); return AVERROR_INVALIDDATA; } ics->window_sequence[1] = ics->window_sequence[0]; ics->window_sequence[0] = get_bits(gb, 2); if (aot == AOT_ER_AAC_LD && ics->window_sequence[0] != ONLY_LONG_SEQUENCE) { av_log(ac->avctx, AV_LOG_ERROR, "AAC LD is only defined for ONLY_LONG_SEQUENCE but " "window sequence %d found.\n", ics->window_sequence[0]); ics->window_sequence[0] = ONLY_LONG_SEQUENCE; return AVERROR_INVALIDDATA; } ics->use_kb_window[1] = ics->use_kb_window[0]; ics->use_kb_window[0] = get_bits1(gb); } ics->num_window_groups = 1; ics->group_len[0] = 1; if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { int i; ics->max_sfb = get_bits(gb, 4); for (i = 0; i < 7; i++) { if (get_bits1(gb)) { ics->group_len[ics->num_window_groups - 1]++; } else { ics->num_window_groups++; ics->group_len[ics->num_window_groups - 1] = 1; } } ics->num_windows = 8; ics->swb_offset = ff_swb_offset_128[ac->oc[1].m4ac.sampling_index]; ics->num_swb = ff_aac_num_swb_128[ac->oc[1].m4ac.sampling_index]; ics->tns_max_bands = ff_tns_max_bands_128[ac->oc[1].m4ac.sampling_index]; ics->predictor_present = 0; } else { ics->max_sfb = get_bits(gb, 6); ics->num_windows = 1; if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD) { ics->swb_offset = ff_swb_offset_512[ac->oc[1].m4ac.sampling_index]; ics->num_swb = ff_aac_num_swb_512[ac->oc[1].m4ac.sampling_index]; ics->tns_max_bands = ff_tns_max_bands_512[ac->oc[1].m4ac.sampling_index]; if (!ics->num_swb || !ics->swb_offset) return AVERROR_BUG; } else { ics->swb_offset = ff_swb_offset_1024[ac->oc[1].m4ac.sampling_index]; ics->num_swb = ff_aac_num_swb_1024[ac->oc[1].m4ac.sampling_index]; ics->tns_max_bands = ff_tns_max_bands_1024[ac->oc[1].m4ac.sampling_index]; } if (aot != AOT_ER_AAC_ELD) { ics->predictor_present = get_bits1(gb); ics->predictor_reset_group = 0; } if (ics->predictor_present) { if (aot == AOT_AAC_MAIN) { if (decode_prediction(ac, ics, gb)) { goto fail; } } else if (aot == AOT_AAC_LC || aot == AOT_ER_AAC_LC) { av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n"); goto fail; } else { if (aot == AOT_ER_AAC_LD) { av_log(ac->avctx, AV_LOG_ERROR, "LTP in ER AAC LD not yet implemented.\n"); return AVERROR_PATCHWELCOME; } if ((ics->ltp.present = get_bits(gb, 1))) decode_ltp(&ics->ltp, gb, ics->max_sfb); } } } if (ics->max_sfb > ics->num_swb) { av_log(ac->avctx, AV_LOG_ERROR, "Number of scalefactor bands in group (%d) " "exceeds limit (%d).\n", ics->max_sfb, ics->num_swb); goto fail; } return 0; fail: ics->max_sfb = 0; return AVERROR_INVALIDDATA; }
0
117,013
void CLASS phase_one_load_raw_c() { static const int length[] = {8, 7, 6, 9, 11, 10, 5, 12, 14, 13}; int *offset, len[2], pred[2], row, col, i, j; ushort *pixel; short(*c_black)[2], (*r_black)[2]; #ifdef LIBRAW_LIBRARY_BUILD if (ph1.format == 6) throw LIBRAW_EXCEPTION_IO_CORRUPT; #endif pixel = (ushort *)calloc(raw_width * 3 + raw_height * 4, 2); merror(pixel, "phase_one_load_raw_c()"); offset = (int *)(pixel + raw_width); fseek(ifp, strip_offset, SEEK_SET); for (row = 0; row < raw_height; row++) offset[row] = get4(); c_black = (short(*)[2])(offset + raw_height); fseek(ifp, ph1.black_col, SEEK_SET); if (ph1.black_col) read_shorts((ushort *)c_black[0], raw_height * 2); r_black = c_black + raw_height; fseek(ifp, ph1.black_row, SEEK_SET); if (ph1.black_row) read_shorts((ushort *)r_black[0], raw_width * 2); #ifdef LIBRAW_LIBRARY_BUILD // Copy data to internal copy (ever if not read) if (ph1.black_col || ph1.black_row) { imgdata.rawdata.ph1_cblack = (short(*)[2])calloc(raw_height * 2, sizeof(ushort)); merror(imgdata.rawdata.ph1_cblack, "phase_one_load_raw_c()"); memmove(imgdata.rawdata.ph1_cblack, (ushort *)c_black[0], raw_height * 2 * sizeof(ushort)); imgdata.rawdata.ph1_rblack = (short(*)[2])calloc(raw_width * 2, sizeof(ushort)); merror(imgdata.rawdata.ph1_rblack, "phase_one_load_raw_c()"); memmove(imgdata.rawdata.ph1_rblack, (ushort *)r_black[0], raw_width * 2 * sizeof(ushort)); } #endif for (i = 0; i < 256; i++) curve[i] = i * i / 3.969 + 0.5; #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (row = 0; row < raw_height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif fseek(ifp, data_offset + offset[row], SEEK_SET); ph1_bits(-1); pred[0] = pred[1] = 0; for (col = 0; col < raw_width; col++) { if (col >= (raw_width & -8)) len[0] = len[1] = 14; else if ((col & 7) == 0) for (i = 0; i < 2; i++) { for (j = 0; j < 5 && !ph1_bits(1); j++) ; if (j--) len[i] = length[j * 2 + ph1_bits(1)]; } if ((i = len[col & 1]) == 14) pixel[col] = pred[col & 1] = ph1_bits(16); else pixel[col] = pred[col & 1] += ph1_bits(i) + 1 - (1 << (i - 1)); if (pred[col & 1] >> 16) derror(); if (ph1.format == 5 && pixel[col] < 256) pixel[col] = curve[pixel[col]]; } #ifndef LIBRAW_LIBRARY_BUILD for (col = 0; col < raw_width; col++) { int shift = ph1.format == 8 ? 0 : 2; i = (pixel[col] << shift) - ph1.t_black + c_black[row][col >= ph1.split_col] + r_black[col][row >= ph1.split_row]; if (i > 0) RAW(row, col) = i; } #else if (ph1.format == 8) memmove(&RAW(row, 0), &pixel[0], raw_width * 2); else for (col = 0; col < raw_width; col++) RAW(row, col) = pixel[col] << 2; #endif } #ifdef LIBRAW_LIBRARY_BUILD } catch (...) { free(pixel); throw; } #endif free(pixel); maximum = 0xfffc - ph1.t_black; }
0
197,748
void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, const gfx::Size& desired_size) { if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue()) return; if (webwidget_->size().isEmpty() || desired_size.IsEmpty()) { Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, dib_handle, desired_size)); return; } scoped_ptr<TransportDIB> paint_at_scale_buffer(TransportDIB::Map(dib_handle)); DCHECK(paint_at_scale_buffer.get()); if (!paint_at_scale_buffer.get()) return; webwidget_->layout(); gfx::Size canvas_size = webwidget_->size(); float x_scale = static_cast<float>(desired_size.width()) / static_cast<float>(canvas_size.width()); float y_scale = static_cast<float>(desired_size.height()) / static_cast<float>(canvas_size.height()); gfx::Rect orig_bounds(canvas_size); canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); gfx::Rect bounds(canvas_size); scoped_ptr<skia::PlatformCanvas> canvas( paint_at_scale_buffer->GetPlatformCanvas(canvas_size.width(), canvas_size.height())); if (!canvas.get()) { NOTREACHED(); return; } DCHECK_EQ(bounds.width(), canvas->getDevice()->width()); DCHECK_EQ(bounds.height(), canvas->getDevice()->height()); bounds.set_width(canvas->getDevice()->width()); bounds.set_height(canvas->getDevice()->height()); canvas->save(); canvas->scale(SkFloatToScalar(x_scale), SkFloatToScalar(y_scale)); PaintRect(orig_bounds, orig_bounds.origin(), canvas.get()); canvas->restore(); Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, dib_handle, bounds.size())); }
0
458,732
dp_packet_l4_checksum_bad(struct dp_packet *p) { return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) == PKT_RX_L4_CKSUM_BAD; }
0
193,244
static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) { u32 *bmap = op->u.getattr.ga_bmval; u32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2]; u32 ret = 0; if (bmap0 & FATTR4_WORD0_ACL) return svc_max_payload(rqstp); if (bmap0 & FATTR4_WORD0_FS_LOCATIONS) return svc_max_payload(rqstp); if (bmap1 & FATTR4_WORD1_OWNER) { ret += IDMAP_NAMESZ + 4; bmap1 &= ~FATTR4_WORD1_OWNER; } if (bmap1 & FATTR4_WORD1_OWNER_GROUP) { ret += IDMAP_NAMESZ + 4; bmap1 &= ~FATTR4_WORD1_OWNER_GROUP; } if (bmap0 & FATTR4_WORD0_FILEHANDLE) { ret += NFS4_FHSIZE + 4; bmap0 &= ~FATTR4_WORD0_FILEHANDLE; } if (bmap2 & FATTR4_WORD2_SECURITY_LABEL) { ret += NFS4_MAXLABELLEN + 12; bmap2 &= ~FATTR4_WORD2_SECURITY_LABEL; } /* * Largest of remaining attributes are 16 bytes (e.g., * supported_attributes) */ ret += 16 * (hweight32(bmap0) + hweight32(bmap1) + hweight32(bmap2)); /* bitmask, length */ ret += 20; return ret; }
0
35,503
static int tiocsetd(struct tty_struct *tty, int __user *p) { int ldisc; int ret; if (get_user(ldisc, p)) return -EFAULT; ret = tty_set_ldisc(tty, ldisc); return ret; }
0
199,876
static int cac_decipher(sc_card_t *card, const u8 * data, size_t datalen, u8 * out, size_t outlen) { SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, cac_rsa_op(card, data, datalen, out, outlen)); }
0
158,762
static constexpr bool kSortKeys() { return false; }
0
229,094
void linuxMemoryWarnings(void) { if (linuxOvercommitMemoryValue() == 0) { serverLog(LL_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect."); } if (THPIsEnabled()) { serverLog(LL_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled."); } }
0
325,653
int coroutine_fn bdrv_co_flush(BlockDriverState *bs) { int ret; BdrvTrackedRequest req; if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) || bdrv_is_sg(bs)) { return 0; } tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH); int current_gen = bs->write_gen; /* Wait until any previous flushes are completed */ while (bs->flush_started_gen != bs->flushed_gen) { qemu_co_queue_wait(&bs->flush_queue); } bs->flush_started_gen = current_gen; /* Write back all layers by calling one driver function */ if (bs->drv->bdrv_co_flush) { ret = bs->drv->bdrv_co_flush(bs); goto out; } /* Write back cached data to the OS even with cache=unsafe */ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { goto out; } } /* But don't actually force it to the disk with cache=unsafe */ if (bs->open_flags & BDRV_O_NO_FLUSH) { goto flush_parent; } /* Check if we really need to flush anything */ if (bs->flushed_gen == current_gen) { goto flush_parent; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } } else { /* * Some block drivers always operate in either writethrough or unsafe * mode and don't support bdrv_flush therefore. Usually qemu doesn't * know how the server works (because the behaviour is hardcoded or * depends on server-side configuration), so we can't ensure that * everything is safe on disk. Returning an error doesn't work because * that would break guests even if the server operates in writethrough * mode. * * Let's hope the user knows what he's doing. */ ret = 0; } if (ret < 0) { goto out; } /* Now flush the underlying protocol. It will also have BDRV_O_NO_FLUSH * in the case of cache=unsafe, so there are no useless flushes. */ flush_parent: ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0; out: /* Notify any pending flushes that we have completed */ bs->flushed_gen = current_gen; qemu_co_queue_restart_all(&bs->flush_queue); tracked_request_end(&req); return ret; }
1
13,025
static int cac_get_serial_nr_from_CUID(sc_card_t* card, sc_serial_number_t* serial) { cac_private_data_t * priv = CAC_DATA(card); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL); if (card->serialnr.len) { *serial = card->serialnr; SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS); } if (priv->cac_id_len) { serial->len = MIN(priv->cac_id_len, SC_MAX_SERIALNR); memcpy(serial->value, priv->cac_id, priv->cac_id_len); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS); } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_FILE_NOT_FOUND); }
1
8,020
static int xar_get_toc_data_values(xmlTextReaderPtr reader, long *length, long *offset, long *size, int *encoding, unsigned char ** a_cksum, int * a_hash, unsigned char ** e_cksum, int * e_hash) { const xmlChar *name; int indata = 0, inea = 0; int rc, gotoffset=0, gotlength=0, gotsize=0; *a_cksum = NULL; *a_hash = XAR_CKSUM_NONE; *e_cksum = NULL; *e_hash = XAR_CKSUM_NONE; *encoding = CL_TYPE_ANY; rc = xmlTextReaderRead(reader); while (rc == 1) { name = xmlTextReaderConstLocalName(reader); if (indata || inea) { /* cli_dbgmsg("cli_scanxar: xmlTextReaderRead read %s\n", name); */ if (xmlStrEqual(name, (const xmlChar *)"offset") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, offset)) gotoffset=1; } else if (xmlStrEqual(name, (const xmlChar *)"length") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, length)) gotlength=1; } else if (xmlStrEqual(name, (const xmlChar *)"size") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, size)) gotsize=1; } else if (xmlStrEqual(name, (const xmlChar *)"archived-checksum") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { cli_dbgmsg("cli_scanxar: <archived-checksum>:\n"); xar_get_checksum_values(reader, a_cksum, a_hash); } else if ((xmlStrEqual(name, (const xmlChar *)"extracted-checksum") || xmlStrEqual(name, (const xmlChar *)"unarchived-checksum")) && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { cli_dbgmsg("cli_scanxar: <extracted-checksum>:\n"); xar_get_checksum_values(reader, e_cksum, e_hash); } else if (xmlStrEqual(name, (const xmlChar *)"encoding") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { xmlChar * style = xmlTextReaderGetAttribute(reader, (const xmlChar *)"style"); if (style == NULL) { cli_dbgmsg("cli_scaxar: xmlTextReaderGetAttribute no style attribute " "for encoding element\n"); *encoding = CL_TYPE_ANY; } else if (xmlStrEqual(style, (const xmlChar *)"application/x-gzip")) { cli_dbgmsg("cli_scanxar: encoding = application/x-gzip.\n"); *encoding = CL_TYPE_GZ; } else if (xmlStrEqual(style, (const xmlChar *)"application/octet-stream")) { cli_dbgmsg("cli_scanxar: encoding = application/octet-stream.\n"); *encoding = CL_TYPE_ANY; } else if (xmlStrEqual(style, (const xmlChar *)"application/x-bzip2")) { cli_dbgmsg("cli_scanxar: encoding = application/x-bzip2.\n"); *encoding = CL_TYPE_BZ; } else if (xmlStrEqual(style, (const xmlChar *)"application/x-lzma")) { cli_dbgmsg("cli_scanxar: encoding = application/x-lzma.\n"); *encoding = CL_TYPE_7Z; } else if (xmlStrEqual(style, (const xmlChar *)"application/x-xz")) { cli_dbgmsg("cli_scanxar: encoding = application/x-xz.\n"); *encoding = CL_TYPE_XZ; } else { cli_dbgmsg("cli_scaxar: unknown style value=%s for encoding element\n", style); *encoding = CL_TYPE_ANY; } if (style != NULL) xmlFree(style); } else if (indata && xmlStrEqual(name, (const xmlChar *)"data") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { break; } else if (inea && xmlStrEqual(name, (const xmlChar *)"ea") && xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { break; } } else { if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) { if (xmlStrEqual(name, (const xmlChar *)"data")) { cli_dbgmsg("cli_scanxar: xmlTextReaderRead read <data>\n"); indata = 1; } else if (xmlStrEqual(name, (const xmlChar *)"ea")) { cli_dbgmsg("cli_scanxar: xmlTextReaderRead read <ea>\n"); inea = 1; } } else if ((xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) && xmlStrEqual(name, (const xmlChar *)"xar")) { cli_dbgmsg("cli_scanxar: finished parsing xar TOC.\n"); break; } } rc = xmlTextReaderRead(reader); } if (gotoffset && gotlength && gotsize) { rc = CL_SUCCESS; } else if (0 == gotoffset + gotlength + gotsize) rc = CL_BREAK; else rc = CL_EFORMAT; return rc; }
1
162,455
void WebGLRenderingContextBase::TexImageHelperHTMLVideoElement( const SecurityOrigin* security_origin, TexImageFunctionID function_id, GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLVideoElement* video, const IntRect& source_image_rect, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { const char* func_name = GetTexImageFunctionName(function_id); if (isContextLost()) return; if (!ValidateHTMLVideoElement(security_origin, func_name, video, exception_state)) return; WebGLTexture* texture = ValidateTexImageBinding(func_name, function_id, target); if (!texture) return; TexImageFunctionType function_type; if (function_id == kTexImage2D || function_id == kTexImage3D) function_type = kTexImage; else function_type = kTexSubImage; if (!ValidateTexFunc(func_name, function_type, kSourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 1, 0, format, type, xoffset, yoffset, zoffset)) return; WebMediaPlayer::VideoFrameUploadMetadata frame_metadata = {}; int already_uploaded_id = -1; WebMediaPlayer::VideoFrameUploadMetadata* frame_metadata_ptr = nullptr; if (RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled()) { already_uploaded_id = texture->GetLastUploadedVideoFrameId(); frame_metadata_ptr = &frame_metadata; } if (!source_image_rect.IsValid()) { SynthesizeGLError(GL_INVALID_OPERATION, func_name, "source sub-rectangle specified via pixel unpack " "parameters is invalid"); return; } bool source_image_rect_is_default = source_image_rect == SentinelEmptyRect() || source_image_rect == IntRect(0, 0, video->videoWidth(), video->videoHeight()); const bool use_copyTextureCHROMIUM = function_id == kTexImage2D && source_image_rect_is_default && depth == 1 && GL_TEXTURE_2D == target && CanUseTexImageByGPU(format, type); if (use_copyTextureCHROMIUM) { DCHECK_EQ(xoffset, 0); DCHECK_EQ(yoffset, 0); DCHECK_EQ(zoffset, 0); if (video->CopyVideoTextureToPlatformTexture( ContextGL(), target, texture->Object(), internalformat, format, type, level, unpack_premultiply_alpha_, unpack_flip_y_, already_uploaded_id, frame_metadata_ptr)) { texture->UpdateLastUploadedFrame(frame_metadata); return; } } if (source_image_rect_is_default) { ScopedUnpackParametersResetRestore( this, unpack_flip_y_ || unpack_premultiply_alpha_); if (video->TexImageImpl( static_cast<WebMediaPlayer::TexImageFunctionID>(function_id), target, ContextGL(), texture->Object(), level, ConvertTexInternalFormat(internalformat, type), format, type, xoffset, yoffset, zoffset, unpack_flip_y_, unpack_premultiply_alpha_ && unpack_colorspace_conversion_ == GL_NONE)) { texture->ClearLastUploadedFrame(); return; } } if (use_copyTextureCHROMIUM) { std::unique_ptr<ImageBufferSurface> surface = WTF::WrapUnique(new AcceleratedImageBufferSurface( IntSize(video->videoWidth(), video->videoHeight()))); if (surface->IsValid()) { std::unique_ptr<ImageBuffer> image_buffer( ImageBuffer::Create(std::move(surface))); if (image_buffer) { video->PaintCurrentFrame( image_buffer->Canvas(), IntRect(0, 0, video->videoWidth(), video->videoHeight()), nullptr, already_uploaded_id, frame_metadata_ptr); TexImage2DBase(target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, nullptr); if (image_buffer->CopyToPlatformTexture( FunctionIDToSnapshotReason(function_id), ContextGL(), target, texture->Object(), unpack_premultiply_alpha_, unpack_flip_y_, IntPoint(0, 0), IntRect(0, 0, video->videoWidth(), video->videoHeight()))) { texture->UpdateLastUploadedFrame(frame_metadata); return; } } } } scoped_refptr<Image> image = VideoFrameToImage(video, already_uploaded_id, frame_metadata_ptr); if (!image) return; TexImageImpl(function_id, target, level, internalformat, xoffset, yoffset, zoffset, format, type, image.get(), WebGLImageConversion::kHtmlDomVideo, unpack_flip_y_, unpack_premultiply_alpha_, source_image_rect, depth, unpack_image_height); texture->UpdateLastUploadedFrame(frame_metadata); }
0
518,483
Item* Item_ref::build_clone(THD *thd) { Item_ref *copy= (Item_ref *) get_copy(thd); if (unlikely(!copy) || unlikely(!(copy->ref= (Item**) alloc_root(thd->mem_root, sizeof(Item*)))) || unlikely(!(*copy->ref= (* ref)->build_clone(thd)))) return 0; return copy; }
0
98,429
void* CurvesDup(cmsContext ContextID, const void* ptr) { Curves16Data* Data = _cmsDupMem(ContextID, ptr, sizeof(Curves16Data)); int i; if (Data == NULL) return NULL; Data ->Curves = _cmsDupMem(ContextID, Data ->Curves, Data ->nCurves * sizeof(cmsUInt16Number*)); for (i=0; i < Data -> nCurves; i++) { Data ->Curves[i] = _cmsDupMem(ContextID, Data ->Curves[i], Data -> nElements * sizeof(cmsUInt16Number)); } return (void*) Data; }
0
8,364
reg_match_visual(void) { pos_T top, bot; linenr_T lnum; colnr_T col; win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win; int mode; colnr_T start, end; colnr_T start2, end2; colnr_T cols; colnr_T curswant; // Check if the buffer is the current buffer. if (rex.reg_buf != curbuf || VIsual.lnum == 0) return FALSE; if (VIsual_active) { if (LT_POS(VIsual, wp->w_cursor)) { top = VIsual; bot = wp->w_cursor; } else { top = wp->w_cursor; bot = VIsual; } mode = VIsual_mode; curswant = wp->w_curswant; } else { if (LT_POS(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end)) { top = curbuf->b_visual.vi_start; bot = curbuf->b_visual.vi_end; } else { top = curbuf->b_visual.vi_end; bot = curbuf->b_visual.vi_start; } mode = curbuf->b_visual.vi_mode; curswant = curbuf->b_visual.vi_curswant; } lnum = rex.lnum + rex.reg_firstlnum; if (lnum < top.lnum || lnum > bot.lnum) return FALSE; if (mode == 'v') { col = (colnr_T)(rex.input - rex.line); if ((lnum == top.lnum && col < top.col) || (lnum == bot.lnum && col >= bot.col + (*p_sel != 'e'))) return FALSE; } else if (mode == Ctrl_V) { getvvcol(wp, &top, &start, NULL, &end); getvvcol(wp, &bot, &start2, NULL, &end2); if (start2 < start) start = start2; if (end2 > end) end = end2; if (top.col == MAXCOL || bot.col == MAXCOL || curswant == MAXCOL) end = MAXCOL; cols = win_linetabsize(wp, rex.line, (colnr_T)(rex.input - rex.line)); if (cols < start || cols > end - (*p_sel == 'e')) return FALSE; } return TRUE; }
1
32,311
Perl_ckwarn(pTHX_ U32 w) { /* If lexical warnings have not been set, use $^W. */ if (isLEXWARN_off) return PL_dowarn & G_WARN_ON; return ckwarn_common(w); }
0
141,117
PLT_HttpServer::Stop() { // we can't restart an aborted server if (m_Aborted || !m_Running) NPT_CHECK_WARNING(NPT_ERROR_INVALID_STATE); // stop all other pending tasks m_TaskManager->Abort(); m_Running = false; m_Aborted = true; return NPT_SUCCESS; }
0
211,524
void BrowserMainParts::PreMainMessageLoopRun() { device::GeolocationProvider::SetGeolocationDelegate( new GeolocationDelegate()); media::AudioManager::SetGlobalAppName( BrowserPlatformIntegration::GetInstance()->GetApplicationName()); if (CanUseSharedGLContext()) { scoped_refptr<GLContextDependent> share_context = BrowserPlatformIntegration::GetInstance()->GetGLShareContext(); if (share_context) { gl_share_context_ = GLContextDependent::CloneFrom(share_context.get()); gpu::oxide_shim::SetGLShareGroup(gl_share_context_->share_group()); } } #if defined(ENABLE_HYBRIS_CAMERA) VideoCaptureDeviceHybris::Initialize(); #endif gpu::GPUInfo gpu_info; gpu::CollectInfoResult rv = gpu::CollectContextGraphicsInfo(&gpu_info); switch (rv) { case gpu::kCollectInfoFatalFailure: LOG(ERROR) << "gpu::CollectContextGraphicsInfo failed"; break; case gpu::kCollectInfoNone: NOTREACHED(); break; default: break; } content::GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); CompositorUtils::GetInstance()->Initialize(gl_share_context_.get()); net::NetModule::SetResourceProvider(NetResourceProvider); lifecycle_observer_.reset(new LifecycleObserver()); render_process_initializer_.reset(new RenderProcessInitializer()); }
0
370,573
htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options) { xmlParserInputBufferPtr input; xmlParserInputPtr stream; if (fd < 0) return (NULL); if (ctxt == NULL) return (NULL); htmlCtxtReset(ctxt); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (stream == NULL) { xmlFreeParserInputBuffer(input); return (NULL); } inputPush(ctxt, stream); return (htmlDoRead(ctxt, URL, encoding, options, 1)); }
0
279,144
bool VaapiWrapper::IsEntrypointSupported_Locked(VAProfile va_profile, VAEntrypoint entrypoint) { va_lock_->AssertAcquired(); int max_entrypoints = vaMaxNumEntrypoints(va_display_); std::vector<VAEntrypoint> supported_entrypoints( base::checked_cast<size_t>(max_entrypoints)); int num_supported_entrypoints; VAStatus va_res = vaQueryConfigEntrypoints(va_display_, va_profile, &supported_entrypoints[0], &num_supported_entrypoints); VA_SUCCESS_OR_RETURN(va_res, "vaQueryConfigEntrypoints failed", false); if (num_supported_entrypoints < 0 || num_supported_entrypoints > max_entrypoints) { LOG(ERROR) << "vaQueryConfigEntrypoints returned: " << num_supported_entrypoints; return false; } if (std::find(supported_entrypoints.begin(), supported_entrypoints.end(), entrypoint) == supported_entrypoints.end()) { DVLOG(1) << "Unsupported entrypoint"; return false; } return true; }
0
341,562
static void vmmouse_reset(DeviceState *d) { VMMouseState *s = container_of(d, VMMouseState, dev.qdev); s->status = 0xffff; s->queue_size = VMMOUSE_QUEUE_SIZE; }
1
25,309
static void insert_to_graph_t38 ( voip_calls_tapinfo_t * tapinfo _U_ , packet_info * pinfo , const gchar * frame_label , const gchar * comment , guint16 call_num , address * src_addr , address * dst_addr , guint16 line_style , guint32 frame_num ) { seq_analysis_item_t * gai , * new_gai ; GList * list ; guint item_num ; gboolean inserted ; gchar time_str [ COL_MAX_LEN ] ; new_gai = ( seq_analysis_item_t * ) g_malloc ( sizeof ( seq_analysis_item_t ) ) ; new_gai -> fd = packet_list_get_row_data ( frame_num ) ; COPY_ADDRESS ( & ( new_gai -> src_addr ) , src_addr ) ; COPY_ADDRESS ( & ( new_gai -> dst_addr ) , dst_addr ) ; new_gai -> port_src = pinfo -> srcport ; new_gai -> port_dst = pinfo -> destport ; if ( frame_label != NULL ) new_gai -> frame_label = g_strdup ( frame_label ) ; else new_gai -> frame_label = g_strdup ( "" ) ; if ( comment != NULL ) new_gai -> comment = g_strdup ( comment ) ; else new_gai -> comment = g_strdup ( "" ) ; new_gai -> conv_num = call_num ; new_gai -> line_style = line_style ; set_fd_time ( cfile . epan , new_gai -> fd , time_str ) ; new_gai -> time_str = g_strdup ( time_str ) ; new_gai -> display = FALSE ; item_num = 0 ; inserted = FALSE ; list = g_list_first ( tapinfo -> graph_analysis -> list ) ; while ( list ) { gai = ( seq_analysis_item_t * ) list -> data ; if ( gai -> fd -> num > frame_num ) { the_tapinfo_struct . graph_analysis -> list = g_list_insert ( the_tapinfo_struct . graph_analysis -> list , new_gai , item_num ) ; g_hash_table_insert ( tapinfo -> graph_analysis -> ht , & new_gai -> fd -> num , new_gai ) ; inserted = TRUE ; break ; } list = g_list_next ( list ) ; item_num ++ ; } if ( ! inserted ) { tapinfo -> graph_analysis -> list = g_list_prepend ( tapinfo -> graph_analysis -> list , new_gai ) ; g_hash_table_insert ( tapinfo -> graph_analysis -> ht , & new_gai -> fd -> num , new_gai ) ; } }
0
224,172
void CL_ReloadTranslation( void ) { char **fileList; int numFiles, i; char fileName[MAX_QPATH]; for ( i = 0; i < FILE_HASH_SIZE; i++ ) { if ( transTable[i] ) { free( transTable[i] ); } } memset( transTable, 0, sizeof( trans_t* ) * FILE_HASH_SIZE ); CL_LoadTransTable( "scripts/translation.cfg" ); fileList = FS_ListFiles( "translations", ".cfg", &numFiles ); for ( i = 0; i < numFiles; i++ ) { Com_sprintf( fileName, sizeof (fileName), "translations/%s", fileList[i] ); CL_LoadTransTable( fileName ); } }
0
127,381
static int gif_read_close(AVFormatContext *s1) { GifState *s = s1->priv_data; av_free(s->image_buf); return 0; }
1
360,774
static USBHostDevice *hostdev_find(int bus_num, int addr) { USBHostDevice *s = hostdev_list; while (s) { if (s->bus_num == bus_num && s->addr == addr) return s; s = s->next; } return NULL; }
0
83,949
iasecc_logout(struct sc_card *card) { struct sc_context *ctx = card->ctx; struct sc_path path; int rv; LOG_FUNC_CALLED(ctx); if (!card->ef_atr || !card->ef_atr->aid.len) return SC_SUCCESS; memset(&path, 0, sizeof(struct sc_path)); path.type = SC_PATH_TYPE_DF_NAME; memcpy(path.value, card->ef_atr->aid.value, card->ef_atr->aid.len); path.len = card->ef_atr->aid.len; rv = iasecc_select_file(card, &path, NULL); sc_log(ctx, "Select ECC ROOT with the AID from EF.ATR: rv %i", rv); LOG_FUNC_RETURN(ctx, rv); }
0
68,297
R_API char *r_bin_java_print_null_cp_stringify(RBinJavaCPTypeObj *obj) { ut32 size = 255, consumed = 0; char *value = malloc (size); if (value) { memset (value, 0, size); consumed = snprintf (value, size, "%d.0x%04"PFMT64x ".%s", obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name); if (consumed >= size - 1) { free (value); size += size >> 1; value = malloc (size); if (value) { memset (value, 0, size); (void)snprintf (value, size, "%d.0x%04"PFMT64x ".%s", obj->metas->ord, obj->file_offset, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name); } } } return value; }
0
59,201
MONGO_EXPORT bson_err_handler set_bson_err_handler( bson_err_handler func ) { bson_err_handler old = err_handler; err_handler = func; return old; }
0
212,903
error::Error GLES2DecoderPassthroughImpl::DoGetInteger64v(GLenum pname, GLsizei bufsize, GLsizei* length, GLint64* params) { return GetNumericHelper( pname, bufsize, length, params, [this](GLenum pname, GLsizei bufsize, GLsizei* length, GLint64* params) { api()->glGetInteger64vRobustANGLEFn(pname, bufsize, length, params); }); }
0
234,474
PHP_FUNCTION(openssl_encrypt) { zend_bool raw_output = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0, max_iv_len; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX cipher_ctx; int i = 0, outlen, keylen; unsigned char *outbuf, *key; zend_bool free_iv; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|bs", &data, &data_len, &method, &method_len, &password, &password_len, &raw_output, &iv, &iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); memset(key, 0, keylen); memcpy(key, password, password_len); } else { key = (unsigned char*)password; } max_iv_len = EVP_CIPHER_iv_length(cipher_type); if (iv_len <= 0 && max_iv_len > 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Using an empty Initialization Vector (iv) is potentially insecure and not recommended"); } free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); } EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (data_len > 0) { EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); } outlen = i; if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { outlen += i; if (raw_output) { outbuf[outlen] = '\0'; RETVAL_STRINGL((char *)outbuf, outlen, 0); } else { int base64_str_len; char *base64_str; base64_str = (char*)php_base64_encode(outbuf, outlen, &base64_str_len); efree(outbuf); RETVAL_STRINGL(base64_str, base64_str_len, 0); } } else { efree(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { efree(key); } if (free_iv) { efree(iv); } EVP_CIPHER_CTX_cleanup(&cipher_ctx); }
0
54,808
cmd_str_r(const notify_script_t *script, char *buf, size_t len) { char *str_p; int i; size_t str_len; str_p = buf; for (i = 0; i < script->num_args; i++) { /* Check there is enough room for the next word */ str_len = strlen(script->args[i]); if (str_p + str_len + 2 + (i ? 1 : 0) >= buf + len) return NULL; if (i) *str_p++ = ' '; *str_p++ = '\''; strcpy(str_p, script->args[i]); str_p += str_len; *str_p++ = '\''; } *str_p = '\0'; return buf; }
0
126,083
flatpak_transaction_operation_get_decomposed (FlatpakTransactionOperation *self) { return self->ref; }
0
362,267
form_auth_data_free (EphyEmbedSingleFormAuthData *data) { g_free (data->form_username); g_free (data->form_password); g_free (data->username); g_slice_free (EphyEmbedSingleFormAuthData, data); }
0
414,710
static inline bool ext4_has_compat_features(struct super_block *sb) { return (EXT4_SB(sb)->s_es->s_feature_compat != 0);
0
347,396
int parse_arguments(int *argc_p, const char ***argv_p) { static poptContext pc; char *ref = lp_refuse_options(module_id); const char *arg, **argv = *argv_p; int argc = *argc_p; int opt; if (ref && *ref) set_refuse_options(ref); if (am_daemon) { set_refuse_options("log-file*"); #ifdef ICONV_OPTION if (!*lp_charset(module_id)) set_refuse_options("iconv"); #endif } #ifdef ICONV_OPTION if (!am_daemon && protect_args <= 0 && (arg = getenv("RSYNC_ICONV")) != NULL && *arg) iconv_opt = strdup(arg); #endif /* TODO: Call poptReadDefaultConfig; handle errors. */ /* The context leaks in case of an error, but if there's a * problem we always exit anyhow. */ if (pc) poptFreeContext(pc); pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0); if (!am_server) { poptReadDefaultConfig(pc, 0); popt_unalias(pc, "--daemon"); popt_unalias(pc, "--server"); } while ((opt = poptGetNextOpt(pc)) != -1) { /* most options are handled automatically by popt; * only special cases are returned and listed here. */ switch (opt) { case OPT_VERSION: print_rsync_version(FINFO); exit_cleanup(0); case OPT_SERVER: if (!am_server) { /* Disable popt aliases on the server side and * then start parsing the options again. */ poptFreeContext(pc); pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0); am_server = 1; } #ifdef ICONV_OPTION iconv_opt = NULL; #endif break; case OPT_SENDER: if (!am_server) { usage(FERROR); exit_cleanup(RERR_SYNTAX); } am_sender = 1; break; case OPT_DAEMON: if (am_daemon) { strlcpy(err_buf, "Attempt to hack rsync thwarted!\n", sizeof err_buf); return 0; } #ifdef ICONV_OPTION iconv_opt = NULL; #endif protect_args = 0; poptFreeContext(pc); pc = poptGetContext(RSYNC_NAME, argc, argv, long_daemon_options, 0); while ((opt = poptGetNextOpt(pc)) != -1) { char **cpp; switch (opt) { case 'h': daemon_usage(FINFO); exit_cleanup(0); case 'M': arg = poptGetOptArg(pc); if (!strchr(arg, '=')) { rprintf(FERROR, "--dparam value is missing an '=': %s\n", arg); goto daemon_error; } cpp = EXPAND_ITEM_LIST(&dparam_list, char *, 4); *cpp = strdup(arg); break; case 'v': verbose++; break; default: rprintf(FERROR, "rsync: %s: %s (in daemon mode)\n", poptBadOption(pc, POPT_BADOPTION_NOALIAS), poptStrerror(opt)); goto daemon_error; } } if (dparam_list.count && !set_dparams(1)) exit_cleanup(RERR_SYNTAX); if (tmpdir && strlen(tmpdir) >= MAXPATHLEN - 10) { snprintf(err_buf, sizeof err_buf, "the --temp-dir path is WAY too long.\n"); return 0; } if (!daemon_opt) { rprintf(FERROR, "Daemon option(s) used without --daemon.\n"); daemon_error: rprintf(FERROR, "(Type \"rsync --daemon --help\" for assistance with daemon mode.)\n"); exit_cleanup(RERR_SYNTAX); } *argv_p = argv = poptGetArgs(pc); *argc_p = argc = count_args(argv); am_starting_up = 0; daemon_opt = 0; am_daemon = 1; return 1; case OPT_MODIFY_WINDOW: /* The value has already been set by popt, but * we need to remember that we're using a * non-default setting. */ modify_window_set = 1; break; case OPT_FILTER: parse_filter_str(&filter_list, poptGetOptArg(pc), rule_template(0), 0); break; case OPT_EXCLUDE: parse_filter_str(&filter_list, poptGetOptArg(pc), rule_template(0), XFLG_OLD_PREFIXES); break; case OPT_INCLUDE: parse_filter_str(&filter_list, poptGetOptArg(pc), rule_template(FILTRULE_INCLUDE), XFLG_OLD_PREFIXES); break; case OPT_EXCLUDE_FROM: case OPT_INCLUDE_FROM: arg = poptGetOptArg(pc); if (sanitize_paths) arg = sanitize_path(NULL, arg, NULL, 0, SP_DEFAULT); if (daemon_filter_list.head) { int rej; char *cp = strdup(arg); if (!cp) out_of_memory("parse_arguments"); if (!*cp) rej = 1; else { char *dir = cp + (*cp == '/' ? module_dirlen : 0); clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS); rej = check_filter(&daemon_filter_list, FLOG, dir, 0) < 0; } free(cp); if (rej) goto options_rejected; } parse_filter_file(&filter_list, arg, rule_template(opt == OPT_INCLUDE_FROM ? FILTRULE_INCLUDE : 0), XFLG_FATAL_ERRORS | XFLG_OLD_PREFIXES); break; case 'a': if (refused_archive_part) { create_refuse_error(refused_archive_part); return 0; } if (!recurse) /* preserve recurse == 2 */ recurse = 1; #ifdef SUPPORT_LINKS preserve_links = 1; #endif preserve_perms = 1; preserve_times = 1; preserve_gid = 1; preserve_uid = 1; preserve_devices = 1; preserve_specials = 1; break; case 'D': preserve_devices = preserve_specials = 1; break; case OPT_NO_D: preserve_devices = preserve_specials = 0; break; case 'h': human_readable++; break; case 'H': preserve_hard_links++; break; case 'i': itemize_changes++; break; case 'v': verbose++; break; case 'y': fuzzy_basis++; break; case 'q': quiet++; break; case 'x': one_file_system++; break; case 'F': switch (++F_option_cnt) { case 1: parse_filter_str(&filter_list,": /.rsync-filter",rule_template(0),0); break; case 2: parse_filter_str(&filter_list,"- .rsync-filter",rule_template(0),0); break; } break; case 'P': if (refused_partial || refused_progress) { create_refuse_error(refused_partial ? refused_partial : refused_progress); return 0; } do_progress = 1; keep_partial = 1; break; case 'z': do_compression++; break; case 'M': arg = poptGetOptArg(pc); if (*arg != '-') { snprintf(err_buf, sizeof err_buf, "Remote option must start with a dash: %s\n", arg); return 0; } if (remote_option_cnt+2 >= remote_option_alloc) { remote_option_alloc += 16; remote_options = realloc_array(remote_options, const char *, remote_option_alloc); if (!remote_options) out_of_memory("parse_arguments"); if (!remote_option_cnt) remote_options[0] = "ARG0"; } remote_options[++remote_option_cnt] = arg; remote_options[remote_option_cnt+1] = NULL; break; case OPT_WRITE_BATCH: /* batch_name is already set */ write_batch = 1; break; case OPT_ONLY_WRITE_BATCH: /* batch_name is already set */ write_batch = -1; break; case OPT_READ_BATCH: /* batch_name is already set */ read_batch = 1; break; case OPT_NO_ICONV: #ifdef ICONV_OPTION iconv_opt = NULL; #endif break; case OPT_MAX_SIZE: if ((max_size = parse_size_arg(&max_size_arg, 'b')) < 0) { snprintf(err_buf, sizeof err_buf, "--max-size value is invalid: %s\n", max_size_arg); return 0; } break; case OPT_MIN_SIZE: if ((min_size = parse_size_arg(&min_size_arg, 'b')) < 0) { snprintf(err_buf, sizeof err_buf, "--min-size value is invalid: %s\n", min_size_arg); return 0; } break; case OPT_BWLIMIT: { OFF_T limit = parse_size_arg(&bwlimit_arg, 'K'); if (limit < 0) { snprintf(err_buf, sizeof err_buf, "--bwlimit value is invalid: %s\n", bwlimit_arg); return 0; } bwlimit = (limit + 512) / 1024; if (limit && !bwlimit) { snprintf(err_buf, sizeof err_buf, "--bwlimit value is too small: %s\n", bwlimit_arg); return 0; } } break; case OPT_APPEND: if (am_server) append_mode++; else append_mode = 1; break; case OPT_LINK_DEST: #ifdef SUPPORT_HARD_LINKS link_dest = 1; dest_option = "--link-dest"; goto set_dest_dir; #else snprintf(err_buf, sizeof err_buf, "hard links are not supported on this %s\n", am_server ? "server" : "client"); return 0; #endif case OPT_COPY_DEST: copy_dest = 1; dest_option = "--copy-dest"; goto set_dest_dir; case OPT_COMPARE_DEST: compare_dest = 1; dest_option = "--compare-dest"; set_dest_dir: if (basis_dir_cnt >= MAX_BASIS_DIRS) { snprintf(err_buf, sizeof err_buf, "ERROR: at most %d %s args may be specified\n", MAX_BASIS_DIRS, dest_option); return 0; } /* We defer sanitizing this arg until we know what * our destination directory is going to be. */ basis_dir[basis_dir_cnt++] = (char *)poptGetOptArg(pc); break; case OPT_CHMOD: arg = poptGetOptArg(pc); if (!parse_chmod(arg, &chmod_modes)) { snprintf(err_buf, sizeof err_buf, "Invalid argument passed to --chmod (%s)\n", arg); return 0; } break; case OPT_INFO: arg = poptGetOptArg(pc); parse_output_words(info_words, info_levels, arg, USER_PRIORITY); break; case OPT_DEBUG: arg = poptGetOptArg(pc); parse_output_words(debug_words, debug_levels, arg, USER_PRIORITY); break; case OPT_USERMAP: if (usermap) { if (usermap_via_chown) { snprintf(err_buf, sizeof err_buf, "--usermap conflicts with prior --chown.\n"); return 0; } snprintf(err_buf, sizeof err_buf, "You can only specify --usermap once.\n"); return 0; } usermap = (char *)poptGetOptArg(pc); usermap_via_chown = False; break; case OPT_GROUPMAP: if (groupmap) { if (groupmap_via_chown) { snprintf(err_buf, sizeof err_buf, "--groupmap conflicts with prior --chown.\n"); return 0; } snprintf(err_buf, sizeof err_buf, "You can only specify --groupmap once.\n"); return 0; } groupmap = (char *)poptGetOptArg(pc); groupmap_via_chown = False; break; case OPT_CHOWN: { const char *chown = poptGetOptArg(pc); int len; if ((arg = strchr(chown, ':')) != NULL) len = arg++ - chown; else len = strlen(chown); if (len) { if (usermap) { if (!usermap_via_chown) { snprintf(err_buf, sizeof err_buf, "--chown conflicts with prior --usermap.\n"); return 0; } snprintf(err_buf, sizeof err_buf, "You can only specify a user-affecting --chown once.\n"); return 0; } if (asprintf(&usermap, "*:%.*s", len, chown) < 0) out_of_memory("parse_arguments"); usermap_via_chown = True; } if (arg && *arg) { if (groupmap) { if (!groupmap_via_chown) { snprintf(err_buf, sizeof err_buf, "--chown conflicts with prior --groupmap.\n"); return 0; } snprintf(err_buf, sizeof err_buf, "You can only specify a group-affecting --chown once.\n"); return 0; } if (asprintf(&groupmap, "*:%s", arg) < 0) out_of_memory("parse_arguments"); groupmap_via_chown = True; } break; } case OPT_HELP: usage(FINFO); exit_cleanup(0); case 'A': #ifdef SUPPORT_ACLS preserve_acls = 1; preserve_perms = 1; break; #else /* FIXME: this should probably be ignored with a * warning and then countermeasures taken to * restrict group and other access in the presence * of any more restrictive ACLs, but this is safe * for now */ snprintf(err_buf,sizeof(err_buf), "ACLs are not supported on this %s\n", am_server ? "server" : "client"); return 0; #endif case 'X': #ifdef SUPPORT_XATTRS preserve_xattrs++; break; #else snprintf(err_buf,sizeof(err_buf), "extended attributes are not supported on this %s\n", am_server ? "server" : "client"); return 0; #endif default: /* A large opt value means that set_refuse_options() * turned this option off. */ if (opt >= OPT_REFUSED_BASE) { create_refuse_error(opt); return 0; } snprintf(err_buf, sizeof err_buf, "%s%s: %s\n", am_server ? "on remote machine: " : "", poptBadOption(pc, POPT_BADOPTION_NOALIAS), poptStrerror(opt)); return 0; } } if (protect_args < 0) { if (am_server) protect_args = 0; else if ((arg = getenv("RSYNC_PROTECT_ARGS")) != NULL && *arg) protect_args = atoi(arg) ? 1 : 0; else { #ifdef RSYNC_USE_PROTECTED_ARGS protect_args = 1; #else protect_args = 0; #endif } } if (checksum_choice && strcmp(checksum_choice, "auto") != 0 && strcmp(checksum_choice, "auto,auto") != 0) { /* Call this early to verify the args and figure out if we need to force * --whole-file. Note that the parse function will get called again later, * just in case an "auto" choice needs to know the protocol_version. */ if (parse_checksum_choice()) whole_file = 1; } else checksum_choice = NULL; if (human_readable > 1 && argc == 2 && !am_server) { /* Allow the old meaning of 'h' (--help) on its own. */ usage(FINFO); exit_cleanup(0); } if (do_compression || def_compress_level != NOT_SPECIFIED) { if (def_compress_level == NOT_SPECIFIED) def_compress_level = Z_DEFAULT_COMPRESSION; else if (def_compress_level < Z_DEFAULT_COMPRESSION || def_compress_level > Z_BEST_COMPRESSION) { snprintf(err_buf, sizeof err_buf, "--compress-level value is invalid: %d\n", def_compress_level); return 0; } else if (def_compress_level == Z_NO_COMPRESSION) do_compression = 0; else if (!do_compression) do_compression = 1; if (do_compression && refused_compress) { create_refuse_error(refused_compress); return 0; } #ifdef EXTERNAL_ZLIB if (do_compression == 1) { snprintf(err_buf, sizeof err_buf, "This rsync lacks old-style --compress due to its external zlib. Try -zz.\n"); if (am_server) return 0; fprintf(stderr, "%s" "Continuing without compression.\n\n", err_buf); do_compression = 0; } #endif } #ifdef HAVE_SETVBUF if (outbuf_mode && !am_server) { int mode = *(uchar *)outbuf_mode; if (islower(mode)) mode = toupper(mode); fflush(stdout); /* Just in case... */ switch (mode) { case 'N': /* None */ case 'U': /* Unbuffered */ mode = _IONBF; break; case 'L': /* Line */ mode = _IOLBF; break; case 'B': /* Block */ case 'F': /* Full */ mode = _IOFBF; break; default: snprintf(err_buf, sizeof err_buf, "Invalid --outbuf setting -- specify N, L, or B.\n"); return 0; } setvbuf(stdout, (char *)NULL, mode, 0); } if (msgs2stderr) { /* Make stderr line buffered for better sharing of the stream. */ fflush(stderr); /* Just in case... */ setvbuf(stderr, (char *)NULL, _IOLBF, 0); } #endif set_output_verbosity(verbose, DEFAULT_PRIORITY); if (do_stats) { parse_output_words(info_words, info_levels, verbose > 1 ? "stats3" : "stats2", DEFAULT_PRIORITY); } #ifdef ICONV_OPTION if (iconv_opt && protect_args != 2) { if (!am_server && strcmp(iconv_opt, "-") == 0) iconv_opt = NULL; else need_unsorted_flist = 1; } if (refused_no_iconv && !iconv_opt) { create_refuse_error(refused_no_iconv); return 0; } #endif if (fuzzy_basis > 1) fuzzy_basis = basis_dir_cnt + 1; if (protect_args == 1 && am_server) return 1; *argv_p = argv = poptGetArgs(pc); *argc_p = argc = count_args(argv); #ifndef SUPPORT_LINKS if (preserve_links && !am_sender) { snprintf(err_buf, sizeof err_buf, "symlinks are not supported on this %s\n", am_server ? "server" : "client"); return 0; } #endif #ifndef SUPPORT_HARD_LINKS if (preserve_hard_links) { snprintf(err_buf, sizeof err_buf, "hard links are not supported on this %s\n", am_server ? "server" : "client"); return 0; } #endif #ifdef SUPPORT_XATTRS if (am_root < 0 && preserve_xattrs > 1) { snprintf(err_buf, sizeof err_buf, "--fake-super conflicts with -XX\n"); return 0; } #else if (am_root < 0) { snprintf(err_buf, sizeof err_buf, "--fake-super requires an rsync with extended attributes enabled\n"); return 0; } #endif if (block_size > MAX_BLOCK_SIZE) { snprintf(err_buf, sizeof err_buf, "--block-size=%lu is too large (max: %u)\n", block_size, MAX_BLOCK_SIZE); return 0; } if (write_batch && read_batch) { snprintf(err_buf, sizeof err_buf, "--write-batch and --read-batch can not be used together\n"); return 0; } if (write_batch > 0 || read_batch) { if (am_server) { rprintf(FINFO, "ignoring --%s-batch option sent to server\n", write_batch ? "write" : "read"); /* We don't actually exit_cleanup(), so that we can * still service older version clients that still send * batch args to server. */ read_batch = write_batch = 0; batch_name = NULL; } else if (dry_run) write_batch = 0; } else if (write_batch < 0 && dry_run) write_batch = 0; if (read_batch && files_from) { snprintf(err_buf, sizeof err_buf, "--read-batch cannot be used with --files-from\n"); return 0; } if (read_batch && remove_source_files) { snprintf(err_buf, sizeof err_buf, "--read-batch cannot be used with --remove-%s-files\n", remove_source_files == 1 ? "source" : "sent"); return 0; } if (batch_name && strlen(batch_name) > MAX_BATCH_NAME_LEN) { snprintf(err_buf, sizeof err_buf, "the batch-file name must be %d characters or less.\n", MAX_BATCH_NAME_LEN); return 0; } if (tmpdir && strlen(tmpdir) >= MAXPATHLEN - 10) { snprintf(err_buf, sizeof err_buf, "the --temp-dir path is WAY too long.\n"); return 0; } if (max_delete < 0 && max_delete != INT_MIN) { /* Negative numbers are treated as "no deletions". */ max_delete = 0; } if (compare_dest + copy_dest + link_dest > 1) { snprintf(err_buf, sizeof err_buf, "You may not mix --compare-dest, --copy-dest, and --link-dest.\n"); return 0; } if (files_from) { if (recurse == 1) /* preserve recurse == 2 */ recurse = 0; if (xfer_dirs < 0) xfer_dirs = 1; } if (argc < 2 && !read_batch && !am_server) list_only |= 1; if (xfer_dirs >= 4) { parse_filter_str(&filter_list, "- /*/*", rule_template(0), 0); recurse = xfer_dirs = 1; } else if (recurse) xfer_dirs = 1; else if (xfer_dirs < 0) xfer_dirs = list_only ? 1 : 0; if (relative_paths < 0) relative_paths = files_from? 1 : 0; if (!relative_paths) implied_dirs = 0; if (delete_before + !!delete_during + delete_after > 1) { snprintf(err_buf, sizeof err_buf, "You may not combine multiple --delete-WHEN options.\n"); return 0; } if (delete_before || delete_during || delete_after) delete_mode = 1; else if (delete_mode || delete_excluded) { /* Only choose now between before & during if one is refused. */ if (refused_delete_before) { if (!refused_delete_during) delete_during = 1; else { create_refuse_error(refused_delete_before); return 0; } } else if (refused_delete_during) delete_before = 1; delete_mode = 1; } if (!xfer_dirs && delete_mode) { snprintf(err_buf, sizeof err_buf, "--delete does not work without --recursive (-r) or --dirs (-d).\n"); return 0; } if (missing_args == 3) /* simplify if both options were specified */ missing_args = 2; if (refused_delete && (delete_mode || missing_args == 2)) { create_refuse_error(refused_delete); return 0; } if (remove_source_files) { /* We only want to infer this refusal of --remove-source-files * via the refusal of "delete", not any of the "delete-FOO" * options. */ if (refused_delete && am_sender) { create_refuse_error(refused_delete); return 0; } need_messages_from_generator = 1; } if (munge_symlinks && !am_daemon) { STRUCT_STAT st; char prefix[SYMLINK_PREFIX_LEN]; /* NOT +1 ! */ strlcpy(prefix, SYMLINK_PREFIX, sizeof prefix); /* trim the trailing slash */ if (do_stat(prefix, &st) == 0 && S_ISDIR(st.st_mode)) { rprintf(FERROR, "Symlink munging is unsafe when a %s directory exists.\n", prefix); exit_cleanup(RERR_UNSUPPORTED); } } if (sanitize_paths) { int i; for (i = argc; i-- > 0; ) argv[i] = sanitize_path(NULL, argv[i], "", 0, SP_KEEP_DOT_DIRS); if (tmpdir) tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT); if (backup_dir) backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT); } if (daemon_filter_list.head && !am_sender) { filter_rule_list *elp = &daemon_filter_list; if (tmpdir) { char *dir; if (!*tmpdir) goto options_rejected; dir = tmpdir + (*tmpdir == '/' ? module_dirlen : 0); clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS); if (check_filter(elp, FLOG, dir, 1) < 0) goto options_rejected; } if (backup_dir) { char *dir; if (!*backup_dir) goto options_rejected; dir = backup_dir + (*backup_dir == '/' ? module_dirlen : 0); clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS); if (check_filter(elp, FLOG, dir, 1) < 0) goto options_rejected; } } if (!backup_suffix) backup_suffix = backup_dir ? "" : BACKUP_SUFFIX; backup_suffix_len = strlen(backup_suffix); if (strchr(backup_suffix, '/') != NULL) { snprintf(err_buf, sizeof err_buf, "--suffix cannot contain slashes: %s\n", backup_suffix); return 0; } if (backup_dir) { size_t len; while (*backup_dir == '.' && backup_dir[1] == '/') backup_dir += 2; if (*backup_dir == '.' && backup_dir[1] == '\0') backup_dir++; len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf); if (len > sizeof backup_dir_buf - 128) { snprintf(err_buf, sizeof err_buf, "the --backup-dir path is WAY too long.\n"); return 0; } backup_dir_len = (int)len; if (!backup_dir_len) { backup_dir_len = -1; backup_dir = NULL; } else if (backup_dir_buf[backup_dir_len - 1] != '/') { backup_dir_buf[backup_dir_len++] = '/'; backup_dir_buf[backup_dir_len] = '\0'; } backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len; } if (backup_dir) { /* No need for a suffix or a protect rule. */ } else if (!backup_suffix_len && (!am_server || !am_sender)) { snprintf(err_buf, sizeof err_buf, "--suffix cannot be empty %s\n", backup_dir_len < 0 ? "when --backup-dir is the same as the dest dir" : "without a --backup-dir"); return 0; } else if (make_backups && delete_mode && !delete_excluded && !am_server) { snprintf(backup_dir_buf, sizeof backup_dir_buf, "P *%s", backup_suffix); parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0); } if (preserve_times) { preserve_times = PRESERVE_FILE_TIMES; if (!omit_dir_times) preserve_times |= PRESERVE_DIR_TIMES; #ifdef CAN_SET_SYMLINK_TIMES if (!omit_link_times) preserve_times |= PRESERVE_LINK_TIMES; #endif } if (make_backups && !backup_dir) { omit_dir_times = 0; /* Implied, so avoid -O to sender. */ preserve_times &= ~PRESERVE_DIR_TIMES; } if (stdout_format) { if (am_server && log_format_has(stdout_format, 'I')) stdout_format_has_i = 2; else if (log_format_has(stdout_format, 'i')) stdout_format_has_i = itemize_changes | 1; if (!log_format_has(stdout_format, 'b') && !log_format_has(stdout_format, 'c') && !log_format_has(stdout_format, 'C')) log_before_transfer = !am_server; } else if (itemize_changes) { stdout_format = "%i %n%L"; stdout_format_has_i = itemize_changes; log_before_transfer = !am_server; } if (do_progress && !am_server) { if (!log_before_transfer && INFO_EQ(NAME, 0)) parse_output_words(info_words, info_levels, "name", DEFAULT_PRIORITY); parse_output_words(info_words, info_levels, "flist2,progress", DEFAULT_PRIORITY); } if (dry_run) do_xfers = 0; set_io_timeout(io_timeout); if (INFO_GTE(NAME, 1) && !stdout_format) { stdout_format = "%n%L"; log_before_transfer = !am_server; } if (stdout_format_has_i || log_format_has(stdout_format, 'o')) stdout_format_has_o_or_i = 1; if (logfile_name && !am_daemon) { if (!logfile_format) { logfile_format = "%i %n%L"; logfile_format_has_i = logfile_format_has_o_or_i = 1; } else { if (log_format_has(logfile_format, 'i')) logfile_format_has_i = 1; if (logfile_format_has_i || log_format_has(logfile_format, 'o')) logfile_format_has_o_or_i = 1; } log_init(0); } else if (!am_daemon) logfile_format = NULL; if (daemon_bwlimit && (!bwlimit || bwlimit > daemon_bwlimit)) bwlimit = daemon_bwlimit; if (bwlimit) { bwlimit_writemax = (size_t)bwlimit * 128; if (bwlimit_writemax < 512) bwlimit_writemax = 512; } if (append_mode) { if (whole_file > 0) { snprintf(err_buf, sizeof err_buf, "--append cannot be used with --whole-file\n"); return 0; } if (refused_inplace) { create_refuse_error(refused_inplace); return 0; } inplace = 1; } if (delay_updates && !partial_dir) partial_dir = tmp_partialdir; if (inplace) { #ifdef HAVE_FTRUNCATE if (partial_dir) { snprintf(err_buf, sizeof err_buf, "--%s cannot be used with --%s\n", append_mode ? "append" : "inplace", delay_updates ? "delay-updates" : "partial-dir"); return 0; } /* --inplace implies --partial for refusal purposes, but we * clear the keep_partial flag for internal logic purposes. */ if (refused_partial) { create_refuse_error(refused_partial); return 0; } keep_partial = 0; #else snprintf(err_buf, sizeof err_buf, "--%s is not supported on this %s\n", append_mode ? "append" : "inplace", am_server ? "server" : "client"); return 0; #endif } else { if (keep_partial && !partial_dir && !am_server) { if ((arg = getenv("RSYNC_PARTIAL_DIR")) != NULL && *arg) partial_dir = strdup(arg); } if (partial_dir) { if (*partial_dir) clean_fname(partial_dir, CFN_COLLAPSE_DOT_DOT_DIRS); if (!*partial_dir || strcmp(partial_dir, ".") == 0) partial_dir = NULL; if (!partial_dir && refused_partial) { create_refuse_error(refused_partial); return 0; } keep_partial = 1; } } if (files_from) { char *h, *p; int q; if (argc > 2 || (!am_daemon && !am_server && argc == 1)) { usage(FERROR); exit_cleanup(RERR_SYNTAX); } if (strcmp(files_from, "-") == 0) { filesfrom_fd = 0; if (am_server) filesfrom_host = ""; /* reading from socket */ } else if ((p = check_for_hostspec(files_from, &h, &q)) != 0) { if (am_server) { snprintf(err_buf, sizeof err_buf, "The --files-from sent to the server cannot specify a host.\n"); return 0; } files_from = p; filesfrom_host = h; if (strcmp(files_from, "-") == 0) { snprintf(err_buf, sizeof err_buf, "Invalid --files-from remote filename\n"); return 0; } } else { if (sanitize_paths) files_from = sanitize_path(NULL, files_from, NULL, 0, SP_DEFAULT); if (daemon_filter_list.head) { char *dir; if (!*files_from) goto options_rejected; dir = files_from + (*files_from == '/' ? module_dirlen : 0); clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS); if (check_filter(&daemon_filter_list, FLOG, dir, 0) < 0) goto options_rejected; } filesfrom_fd = open(files_from, O_RDONLY|O_BINARY); if (filesfrom_fd < 0) { snprintf(err_buf, sizeof err_buf, "failed to open files-from file %s: %s\n", files_from, strerror(errno)); return 0; } } } am_starting_up = 0; return 1; options_rejected: snprintf(err_buf, sizeof err_buf, "Your options have been rejected by the server.\n"); return 0; }
1
241,369
long Tracks::Parse()
0
331,893
static inline uint64_t tcg_opc_movi_a(int qp, TCGReg dst, int64_t src) { assert(src == sextract64(src, 0, 22)); return tcg_opc_a5(qp, OPC_ADDL_A5, dst, src, TCG_REG_R0); }
0
395,608
static void xilinx_ethlite_register_types(void) { type_register_static(&xilinx_ethlite_info); }
0
407,936
int canonical_checksum(int csum_type) { return csum_type >= CSUM_MD4 ? 1 : 0; }
0
320,805
static uint32_t qvirtio_pci_get_features(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES); }
1
388,617
const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle, const char *filename) { VFS_FIND(connectpath); return handle->fns->connectpath_fn(handle, filename); }
0
171,193
void WebLocalFrameImpl::ReportContentSecurityPolicyViolation( const blink::WebContentSecurityPolicyViolation& violation) { AddMessageToConsole(blink::WebConsoleMessage( WebConsoleMessage::kLevelError, violation.console_message, violation.source_location.url, violation.source_location.line_number, violation.source_location.column_number)); std::unique_ptr<SourceLocation> source_location = SourceLocation::Create( violation.source_location.url, violation.source_location.line_number, violation.source_location.column_number, nullptr); DCHECK(GetFrame() && GetFrame()->GetDocument()); Document* document = GetFrame()->GetDocument(); Vector<String> report_endpoints; for (const WebString& end_point : violation.report_endpoints) report_endpoints.push_back(end_point); document->GetContentSecurityPolicy()->ReportViolation( violation.directive, /* directiveText */ ContentSecurityPolicy::GetDirectiveType( violation.effective_directive), /* effectiveType */ violation.console_message, /* consoleMessage */ violation.blocked_url, /* blockedUrl */ report_endpoints, /* reportEndpoints */ false, /* don't use the reporting api yet*/ violation.header, /* header */ static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), ContentSecurityPolicy::ViolationType::kURLViolation, /* ViolationType */ std::move(source_location), nullptr, /* LocalFrame */ violation.after_redirect ? RedirectStatus::kFollowedRedirect : RedirectStatus::kNoRedirect, nullptr); /* Element */ }
0
188,204
xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_ARITY(0); valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 0)); }
0
220,608
WebMediaPlayer::Preload HTMLMediaElement::EffectivePreloadType() const { if (Autoplay() && !autoplay_policy_->IsGestureNeededForPlayback()) return WebMediaPlayer::kPreloadAuto; WebMediaPlayer::Preload preload = PreloadType(); if (ignore_preload_none_ && preload == WebMediaPlayer::kPreloadNone) return WebMediaPlayer::kPreloadMetaData; return preload; }
0
219,024
WebURLResponseExtraDataImpl* GetExtraDataFromResponse( const WebURLResponse& response) { return static_cast<WebURLResponseExtraDataImpl*>(response.GetExtraData()); }
0
137,250
static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, struct kvm_vcpu_events *events) { process_nmi(vcpu); events->exception.injected = vcpu->arch.exception.pending && !kvm_exception_is_soft(vcpu->arch.exception.nr); events->exception.nr = vcpu->arch.exception.nr; events->exception.has_error_code = vcpu->arch.exception.has_error_code; events->exception.pad = 0; events->exception.error_code = vcpu->arch.exception.error_code; events->interrupt.injected = vcpu->arch.interrupt.pending && !vcpu->arch.interrupt.soft; events->interrupt.nr = vcpu->arch.interrupt.nr; events->interrupt.soft = 0; events->interrupt.shadow = kvm_x86_ops->get_interrupt_shadow(vcpu, KVM_X86_SHADOW_INT_MOV_SS | KVM_X86_SHADOW_INT_STI); events->nmi.injected = vcpu->arch.nmi_injected; events->nmi.pending = vcpu->arch.nmi_pending != 0; events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); events->nmi.pad = 0; events->sipi_vector = 0; /* never valid when reporting to user space */ events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SHADOW); memset(&events->reserved, 0, sizeof(events->reserved)); }
0
192,084
const AccessorySheetData& Build() { return accessory_sheet_data_; }
0
209,494
window_change_handler(int sig) { received_window_change_signal = 1; signal(SIGWINCH, window_change_handler); }
0
77,219
inline int ArgMaxVector(const int8_t* input_data, int size) { int32_t max_index = 0; int8_t max_value = input_data[0]; int32_t i = 0; #ifdef USE_NEON constexpr int VECTOR_SIZE = 16; if (size >= VECTOR_SIZE) { int8x16_t max_value_s8x16; for (; i <= size - VECTOR_SIZE; i += VECTOR_SIZE) { max_value_s8x16 = vld1q_s8(input_data + i); int8_t max_from_vec; #ifdef __aarch64__ max_from_vec = vmaxvq_s8(max_value_s8x16); #else // 32 bit int8x8_t max_val_s8x8 = vpmax_s8(vget_low_s8(max_value_s8x16), vget_high_s8(max_value_s8x16)); max_val_s8x8 = vpmax_s8(max_val_s8x8, max_val_s8x8); max_val_s8x8 = vpmax_s8(max_val_s8x8, max_val_s8x8); max_val_s8x8 = vpmax_s8(max_val_s8x8, max_val_s8x8); max_from_vec = vget_lane_s8(max_val_s8x8, 0); #endif // __aarch64__ if (max_from_vec > max_value) { max_value = max_from_vec; max_index = i; } } } for (int start_idx = max_index; start_idx < max_index + VECTOR_SIZE; start_idx++) { if (input_data[start_idx] == max_value) { max_index = start_idx; break; } } #endif // USE_NEON // Leftover loop. for (; i < size; ++i) { const int8_t curr_value = input_data[i]; if (curr_value > max_value) { max_value = curr_value; max_index = i; } } return max_index; }
0
99,726
const char *arch_vma_name(struct vm_area_struct *vma) { if (vma->vm_flags & VM_MPX) return "[mpx]"; return NULL; }
0
250,346
void ExtensionPrefs::SetDidExtensionEscalatePermissions( const Extension* extension, bool did_escalate) { UpdateExtensionPref(extension->id(), kExtensionDidEscalatePermissions, Value::CreateBooleanValue(did_escalate)); }
0
235,868
virtual ~FwdTrans8x8HT() {}
0
20,270
int ffv1_allocate_initial_states ( FFV1Context * f ) { int i ; for ( i = 0 ; i < f -> quant_table_count ; i ++ ) { f -> initial_states [ i ] = av_malloc ( f -> context_count [ i ] * sizeof ( * f -> initial_states [ i ] ) ) ; if ( ! f -> initial_states [ i ] ) return AVERROR ( ENOMEM ) ; memset ( f -> initial_states [ i ] , 128 , f -> context_count [ i ] * sizeof ( * f -> initial_states [ i ] ) ) ; } return 0 ; }
0