unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
80,145
| 0
|
GF_Box *gnra_New()
{
ISOM_DECL_BOX_ALLOC(GF_GenericAudioSampleEntryBox, GF_ISOM_BOX_TYPE_GNRA);
gf_isom_audio_sample_entry_init((GF_AudioSampleEntryBox*) tmp);
return (GF_Box *)tmp;
}
| 12,800
|
148,475
| 0
|
void WebContentsImpl::OnDomOperationResponse(RenderFrameHostImpl* source,
const std::string& json_string) {
std::string json = json_string;
NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE,
Source<WebContents>(this),
Details<std::string>(&json));
}
| 12,801
|
118,966
| 0
|
void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* rvh) {
NotifySwapped(rvh);
if (delegate_)
view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
view_->RenderViewSwappedIn(render_manager_.current_host());
FrameTreeNode* root = NULL;
RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>(
render_manager_.current_host());
if (new_rvh->main_frame_id() != -1)
root = new FrameTreeNode(new_rvh->main_frame_id(), std::string());
frame_tree_root_.reset(root);
}
| 12,802
|
59,943
| 0
|
static void queue_autoload_drivers(void)
{
schedule_work(&autoload_work);
}
| 12,803
|
18,865
| 0
|
static void icmp_unreach(struct sk_buff *skb)
{
const struct iphdr *iph;
struct icmphdr *icmph;
int hash, protocol;
const struct net_protocol *ipprot;
u32 info = 0;
struct net *net;
net = dev_net(skb_dst(skb)->dev);
/*
* Incomplete header ?
* Only checks for the IP header, there should be an
* additional check for longer headers in upper levels.
*/
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto out_err;
icmph = icmp_hdr(skb);
iph = (const struct iphdr *)skb->data;
if (iph->ihl < 5) /* Mangled header, drop. */
goto out_err;
if (icmph->type == ICMP_DEST_UNREACH) {
switch (icmph->code & 15) {
case ICMP_NET_UNREACH:
case ICMP_HOST_UNREACH:
case ICMP_PROT_UNREACH:
case ICMP_PORT_UNREACH:
break;
case ICMP_FRAG_NEEDED:
if (ipv4_config.no_pmtu_disc) {
LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: fragmentation needed and DF set.\n",
&iph->daddr);
} else {
info = ip_rt_frag_needed(net, iph,
ntohs(icmph->un.frag.mtu),
skb->dev);
if (!info)
goto out;
}
break;
case ICMP_SR_FAILED:
LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: Source Route Failed.\n",
&iph->daddr);
break;
default:
break;
}
if (icmph->code > NR_ICMP_UNREACH)
goto out;
} else if (icmph->type == ICMP_PARAMETERPROB)
info = ntohl(icmph->un.gateway) >> 24;
/*
* Throw it at our lower layers
*
* RFC 1122: 3.2.2 MUST extract the protocol ID from the passed
* header.
* RFC 1122: 3.2.2.1 MUST pass ICMP unreach messages to the
* transport layer.
* RFC 1122: 3.2.2.2 MUST pass ICMP time expired messages to
* transport layer.
*/
/*
* Check the other end isn't violating RFC 1122. Some routers send
* bogus responses to broadcast frames. If you see this message
* first check your netmask matches at both ends, if it does then
* get the other vendor to fix their kit.
*/
if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses &&
inet_addr_type(net, iph->daddr) == RTN_BROADCAST) {
if (net_ratelimit())
printk(KERN_WARNING "%pI4 sent an invalid ICMP "
"type %u, code %u "
"error to a broadcast: %pI4 on %s\n",
&ip_hdr(skb)->saddr,
icmph->type, icmph->code,
&iph->daddr,
skb->dev->name);
goto out;
}
/* Checkin full IP header plus 8 bytes of protocol to
* avoid additional coding at protocol handlers.
*/
if (!pskb_may_pull(skb, iph->ihl * 4 + 8))
goto out;
iph = (const struct iphdr *)skb->data;
protocol = iph->protocol;
/*
* Deliver ICMP message to raw sockets. Pretty useless feature?
*/
raw_icmp_error(skb, protocol, info);
hash = protocol & (MAX_INET_PROTOS - 1);
rcu_read_lock();
ipprot = rcu_dereference(inet_protos[hash]);
if (ipprot && ipprot->err_handler)
ipprot->err_handler(skb, info);
rcu_read_unlock();
out:
return;
out_err:
ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
goto out;
}
| 12,804
|
63,905
| 0
|
SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
const struct itimerspec __user *, utmr,
struct itimerspec __user *, otmr)
{
struct itimerspec new, old;
int ret;
if (copy_from_user(&new, utmr, sizeof(new)))
return -EFAULT;
ret = do_timerfd_settime(ufd, flags, &new, &old);
if (ret)
return ret;
if (otmr && copy_to_user(otmr, &old, sizeof(old)))
return -EFAULT;
return ret;
}
| 12,805
|
168,187
| 0
|
UsbTabHelper::~UsbTabHelper() {}
| 12,806
|
142,483
| 0
|
bool ShelfLayoutManager::ShouldChangeVisibilityAfterDrag(
const ui::GestureEvent& gesture_in_screen) {
if (visibility_state() == SHELF_VISIBLE)
return false;
if (gesture_in_screen.type() == ui::ET_GESTURE_SCROLL_END) {
const float kDragHideThreshold = 0.4f;
const gfx::Rect bounds = GetIdealBounds();
const float drag_ratio =
fabs(gesture_drag_amount_) /
(shelf_->IsHorizontalAlignment() ? bounds.height() : bounds.width());
return IsSwipingCorrectDirection() && drag_ratio > kDragHideThreshold;
}
if (gesture_in_screen.type() == ui::ET_SCROLL_FLING_START)
return IsSwipingCorrectDirection();
return false;
}
| 12,807
|
143,558
| 0
|
GLSurfaceEGLSurfaceControl::SurfaceState::SurfaceState(
const SurfaceControl::Surface& parent)
: surface(new SurfaceControl::Surface(parent, kChildSurfaceName)) {}
| 12,808
|
145,152
| 0
|
GpuProcessHost* GpuProcessHost::FromID(int host_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) {
GpuProcessHost* host = g_gpu_process_hosts[i];
if (host && host->host_id_ == host_id && ValidateHost(host))
return host;
}
return nullptr;
}
| 12,809
|
3,974
| 0
|
Guint EmbedStream::getStart() {
error(errInternal, -1, "Internal: called getStart() on EmbedStream");
return 0;
}
| 12,810
|
141,647
| 0
|
AXTree::~AXTree() {
if (root_)
DestroyNodeAndSubtree(root_, nullptr);
for (auto& entry : table_info_map_)
delete entry.second;
table_info_map_.clear();
}
| 12,811
|
4,160
| 0
|
Function::Function(const Function *func) {
m = func->m;
n = func->n;
memcpy(domain, func->domain, funcMaxInputs * 2 * sizeof(double));
memcpy(range, func->range, funcMaxOutputs * 2 * sizeof(double));
hasRange = func->hasRange;
}
| 12,812
|
134,229
| 0
|
BrowserRootView::BrowserRootView(BrowserView* browser_view,
views::Widget* widget)
: views::internal::RootView(widget),
browser_view_(browser_view),
forwarding_to_tab_strip_(false) { }
| 12,813
|
47,077
| 0
|
static void twofish_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
twofish_dec_blk(crypto_tfm_ctx(tfm), dst, src);
}
| 12,814
|
184,102
| 1
|
UpdateLibrary* CrosLibrary::GetUpdateLibrary() {
return update_lib_.GetDefaultImpl(use_stub_impl_);
}
| 12,815
|
113,655
| 0
|
int32_t PPB_URLLoader_Impl::Open(PP_Resource request_id,
scoped_refptr<TrackedCallback> callback) {
if (main_document_loader_)
return PP_ERROR_INPROGRESS;
EnterResourceNoLock<PPB_URLRequestInfo_API> enter_request(request_id, true);
if (enter_request.failed()) {
Log(PP_LOGLEVEL_ERROR,
"PPB_URLLoader.Open: invalid request resource ID. (Hint to C++ wrapper"
" users: use the ResourceRequest constructor that takes an instance or"
" else the request will be null.)");
return PP_ERROR_BADARGUMENT;
}
PPB_URLRequestInfo_Impl* request = static_cast<PPB_URLRequestInfo_Impl*>(
enter_request.object());
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
if (request->RequiresUniversalAccess() && !has_universal_access_) {
Log(PP_LOGLEVEL_ERROR, "PPB_URLLoader.Open: The URL you're requesting is "
" on a different security origin than your plugin. To request "
" cross-origin resources, see "
" PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS.");
return PP_ERROR_NOACCESS;
}
if (loader_.get())
return PP_ERROR_INPROGRESS;
WebFrame* frame = GetFrameForResource(this);
if (!frame)
return PP_ERROR_FAILED;
WebURLRequest web_request;
if (!request->ToWebURLRequest(frame, &web_request))
return PP_ERROR_FAILED;
request_data_ = request->GetData();
WebURLLoaderOptions options;
if (has_universal_access_) {
options.allowCredentials = true;
options.crossOriginRequestPolicy =
WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
} else {
options.untrustedHTTP = true;
if (request_data_.allow_cross_origin_requests) {
options.allowCredentials = request_data_.allow_credentials;
options.crossOriginRequestPolicy =
WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
} else {
options.allowCredentials = true;
}
}
is_asynchronous_load_suspended_ = false;
loader_.reset(frame->createAssociatedURLLoader(options));
if (!loader_.get())
return PP_ERROR_FAILED;
loader_->loadAsynchronously(web_request, this);
RegisterCallback(callback);
return PP_OK_COMPLETIONPENDING;
}
| 12,816
|
124,676
| 0
|
void RenderBlockFlow::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
{
bool isHorizontal = isHorizontalWritingMode();
bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHorizontal);
LayoutUnit logicalTop = logicalHeight();
updateStaticInlinePositionForChild(child, logicalTop);
if (!marginInfo.canCollapseWithMarginBefore()) {
LayoutUnit collapsedBeforePos = marginInfo.positiveMargin();
LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin();
logicalTop += collapsedBeforePos - collapsedBeforeNeg;
}
RenderLayer* childLayer = child->layer();
if (childLayer->staticBlockPosition() != logicalTop) {
childLayer->setStaticBlockPosition(logicalTop);
if (hasStaticBlockPosition)
child->setChildNeedsLayout(MarkOnlyThis);
}
}
| 12,817
|
169,856
| 0
|
xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED,
const xmlChar * URI, void *data)
{
if (testStyleData == NULL) {
xsltGenericError(xsltGenericErrorContext,
"xsltExtShutdownTest: not initialized\n");
return;
}
if (data != testStyleData) {
xsltTransformError(NULL, NULL, NULL,
"xsltExtShutdownTest: wrong data\n");
}
testStyleData = NULL;
xsltGenericDebug(xsltGenericDebugContext,
"Unregistered test module : %s\n", URI);
}
| 12,818
|
75,979
| 0
|
kernel_rx_buf_size_handler(vector_t *strvec)
{
vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
unsigned rx_buf_size;
if (vector_size(strvec) == 2 &&
read_unsigned_strvec(strvec, 1, &rx_buf_size, 0, UINT_MAX, false)) {
vrrp->kernel_rx_buf_size = rx_buf_size;
return;
}
report_config_error(CONFIG_GENERAL_ERROR, "(%s) invalid kernel_rx_buf_size specified", vrrp->iname);
}
| 12,819
|
39,120
| 0
|
static int dccp_timeout_nlattr_to_obj(struct nlattr *tb[],
struct net *net, void *data)
{
struct dccp_net *dn = dccp_pernet(net);
unsigned int *timeouts = data;
int i;
/* set default DCCP timeouts. */
for (i=0; i<CT_DCCP_MAX; i++)
timeouts[i] = dn->dccp_timeout[i];
/* there's a 1:1 mapping between attributes and protocol states. */
for (i=CTA_TIMEOUT_DCCP_UNSPEC+1; i<CTA_TIMEOUT_DCCP_MAX+1; i++) {
if (tb[i]) {
timeouts[i] = ntohl(nla_get_be32(tb[i])) * HZ;
}
}
return 0;
}
| 12,820
|
48,317
| 0
|
horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,
unsigned char *ToLinear8)
{
register unsigned int cr, cg, cb, ca, mask;
register unsigned char t0, t1, t2, t3;
if (n >= stride) {
mask = CODE_MASK;
if (stride == 3) {
op[0] = 0;
t1 = ToLinear8[cb = (wp[2] & mask)];
t2 = ToLinear8[cg = (wp[1] & mask)];
t3 = ToLinear8[cr = (wp[0] & mask)];
op[1] = t1;
op[2] = t2;
op[3] = t3;
n -= 3;
while (n > 0) {
n -= 3;
wp += 3;
op += 4;
op[0] = 0;
t1 = ToLinear8[(cb += wp[2]) & mask];
t2 = ToLinear8[(cg += wp[1]) & mask];
t3 = ToLinear8[(cr += wp[0]) & mask];
op[1] = t1;
op[2] = t2;
op[3] = t3;
}
} else if (stride == 4) {
t0 = ToLinear8[ca = (wp[3] & mask)];
t1 = ToLinear8[cb = (wp[2] & mask)];
t2 = ToLinear8[cg = (wp[1] & mask)];
t3 = ToLinear8[cr = (wp[0] & mask)];
op[0] = t0;
op[1] = t1;
op[2] = t2;
op[3] = t3;
n -= 4;
while (n > 0) {
n -= 4;
wp += 4;
op += 4;
t0 = ToLinear8[(ca += wp[3]) & mask];
t1 = ToLinear8[(cb += wp[2]) & mask];
t2 = ToLinear8[(cg += wp[1]) & mask];
t3 = ToLinear8[(cr += wp[0]) & mask];
op[0] = t0;
op[1] = t1;
op[2] = t2;
op[3] = t3;
}
} else {
REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
n -= stride;
while (n > 0) {
REPEAT(stride,
wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
n -= stride;
}
}
}
}
| 12,821
|
122,449
| 0
|
void HTMLTextAreaElement::setNonDirtyValue(const String& value)
{
setValueCommon(value);
m_isDirty = false;
setNeedsValidityCheck();
}
| 12,822
|
81,947
| 0
|
static int cliSelect(void) {
redisReply *reply;
if (config.dbnum == 0) return REDIS_OK;
reply = redisCommand(context,"SELECT %d",config.dbnum);
if (reply != NULL) {
int result = REDIS_OK;
if (reply->type == REDIS_REPLY_ERROR) result = REDIS_ERR;
freeReplyObject(reply);
return result;
}
return REDIS_ERR;
}
| 12,823
|
135,583
| 0
|
void Editor::RemoveFormattingAndStyle() {
DCHECK(GetFrame().GetDocument());
RemoveFormatCommand::Create(*GetFrame().GetDocument())->Apply();
}
| 12,824
|
79,688
| 0
|
R_API char *r_bin_java_build_obj_key(RBinJavaObj *bin) {
char *jvcname = NULL;
char *cname = r_bin_java_get_this_class_name (bin);
ut32 class_name_len = cname ? strlen (cname) : strlen ("_unknown_");
jvcname = malloc (class_name_len + 8 + 30);
if (cname) {
snprintf (jvcname, class_name_len + 30, "%d.%s.class", bin->id, cname);
free (cname);
} else {
snprintf (jvcname, class_name_len + 30, "%d._unknown_.class", bin->id);
}
return jvcname;
}
| 12,825
|
151,971
| 0
|
mojom::FrameNavigationControl* RenderFrameHostImpl::GetNavigationControl() {
if (!navigation_control_)
GetRemoteAssociatedInterfaces()->GetInterface(&navigation_control_);
return navigation_control_.get();
}
| 12,826
|
116,317
| 0
|
void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor)
{
webPageProxy->setPageZoomFactor(factor);
}
| 12,827
|
97,863
| 0
|
void RenderView::AcceleratedSurfaceSetTransportDIB(
gfx::PluginWindowHandle window,
int32 width,
int32 height,
TransportDIB::Handle transport_dib) {
Send(new ViewHostMsg_AcceleratedSurfaceSetTransportDIB(
routing_id(), window, width, height, transport_dib));
}
| 12,828
|
81,960
| 0
|
static void getKeyFreqs(redisReply *keys, unsigned long long *freqs) {
redisReply *reply;
unsigned int i;
/* Pipeline OBJECT freq commands */
for(i=0;i<keys->elements;i++) {
redisAppendCommand(context, "OBJECT freq %s", keys->element[i]->str);
}
/* Retrieve freqs */
for(i=0;i<keys->elements;i++) {
if(redisGetReply(context, (void**)&reply)!=REDIS_OK) {
fprintf(stderr, "Error getting freq for key '%s' (%d: %s)\n",
keys->element[i]->str, context->err, context->errstr);
exit(1);
} else if(reply->type != REDIS_REPLY_INTEGER) {
if(reply->type == REDIS_REPLY_ERROR) {
fprintf(stderr, "Error: %s\n", reply->str);
exit(1);
} else {
fprintf(stderr, "Warning: OBJECT freq on '%s' failed (may have been deleted)\n", keys->element[i]->str);
freqs[i] = 0;
}
} else {
freqs[i] = reply->integer;
}
freeReplyObject(reply);
}
}
| 12,829
|
41,556
| 0
|
void inet6_destroy_sock(struct sock *sk)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct sk_buff *skb;
struct ipv6_txoptions *opt;
/* Release rx options */
skb = xchg(&np->pktoptions, NULL);
if (skb)
kfree_skb(skb);
skb = xchg(&np->rxpmtu, NULL);
if (skb)
kfree_skb(skb);
/* Free flowlabels */
fl6_free_socklist(sk);
/* Free tx options */
opt = xchg((__force struct ipv6_txoptions **)&np->opt, NULL);
if (opt) {
atomic_sub(opt->tot_len, &sk->sk_omem_alloc);
txopt_put(opt);
}
}
| 12,830
|
137,926
| 0
|
AXObject* AXLayoutObject::computeParentIfExists() const {
if (!m_layoutObject)
return 0;
if (ariaRoleAttribute() == MenuBarRole)
return axObjectCache().get(m_layoutObject->parent());
if (ariaRoleAttribute() == MenuRole) {
AXObject* parent = menuButtonForMenu();
if (parent)
return parent;
}
LayoutObject* parentObj = layoutParentObject();
if (parentObj)
return axObjectCache().get(parentObj);
if (isWebArea()) {
LocalFrame* frame = m_layoutObject->frame();
return axObjectCache().get(frame->pagePopupOwner());
}
return 0;
}
| 12,831
|
15,008
| 0
|
ProcQueryColors(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
REQUEST(xQueryColorsReq);
REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixReadAccess);
if (rc == Success) {
int count;
xrgb *prgbs;
xQueryColorsReply qcr;
count =
bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
prgbs = calloc(1, count * sizeof(xrgb));
if (!prgbs && count)
return BadAlloc;
if ((rc =
QueryColors(pcmp, count, (Pixel *) &stuff[1], prgbs, client))) {
free(prgbs);
return rc;
}
qcr = (xQueryColorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(count * sizeof(xrgb)),
.nColors = count
};
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
free(prgbs);
return Success;
}
else {
client->errorValue = stuff->cmap;
return rc;
}
}
| 12,832
|
179,679
| 1
|
static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len,
int flags)
{
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct scm_cookie scm;
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
int noblock = flags&MSG_DONTWAIT;
size_t copied;
struct sk_buff *skb, *data_skb;
int err, ret;
if (flags&MSG_OOB)
return -EOPNOTSUPP;
copied = 0;
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (skb == NULL)
goto out;
data_skb = skb;
#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
if (unlikely(skb_shinfo(skb)->frag_list)) {
/*
* If this skb has a frag_list, then here that means that we
* will have to use the frag_list skb's data for compat tasks
* and the regular skb's data for normal (non-compat) tasks.
*
* If we need to send the compat skb, assign it to the
* 'data_skb' variable so that it will be used below for data
* copying. We keep 'skb' for everything else, including
* freeing both later.
*/
if (flags & MSG_CMSG_COMPAT)
data_skb = skb_shinfo(skb)->frag_list;
}
#endif
msg->msg_namelen = 0;
copied = data_skb->len;
if (len < copied) {
msg->msg_flags |= MSG_TRUNC;
copied = len;
}
skb_reset_transport_header(data_skb);
err = skb_copy_datagram_iovec(data_skb, 0, msg->msg_iov, copied);
if (msg->msg_name) {
struct sockaddr_nl *addr = (struct sockaddr_nl *)msg->msg_name;
addr->nl_family = AF_NETLINK;
addr->nl_pad = 0;
addr->nl_pid = NETLINK_CB(skb).portid;
addr->nl_groups = netlink_group_mask(NETLINK_CB(skb).dst_group);
msg->msg_namelen = sizeof(*addr);
}
if (nlk->flags & NETLINK_RECV_PKTINFO)
netlink_cmsg_recv_pktinfo(msg, skb);
if (NULL == siocb->scm) {
memset(&scm, 0, sizeof(scm));
siocb->scm = &scm;
}
siocb->scm->creds = *NETLINK_CREDS(skb);
if (flags & MSG_TRUNC)
copied = data_skb->len;
skb_free_datagram(sk, skb);
if (nlk->cb_running &&
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
ret = netlink_dump(sk);
if (ret) {
sk->sk_err = ret;
sk->sk_error_report(sk);
}
}
scm_recv(sock, msg, siocb->scm, flags);
out:
netlink_rcv_wake(sk);
return err ? : copied;
}
| 12,833
|
182,398
| 1
|
struct symbol_t* MACH0_(get_symbols)(struct MACH0_(obj_t)* bin) {
const char *symstr;
struct symbol_t *symbols;
int from, to, i, j, s, stridx, symbols_size, symbols_count;
SdbHash *hash;
//ut64 text_base = get_text_base (bin);
if (!bin || !bin->symtab || !bin->symstr) {
return NULL;
}
/* parse symbol table */
/* parse dynamic symbol table */
symbols_count = (bin->dysymtab.nextdefsym + \
bin->dysymtab.nlocalsym + \
bin->dysymtab.nundefsym );
symbols_count += bin->nsymtab;
//symbols_count = bin->nsymtab;
symbols_size = (symbols_count + 1) * 2 * sizeof (struct symbol_t);
if (symbols_size < 1) {
return NULL;
}
if (!(symbols = calloc (1, symbols_size))) {
return NULL;
}
hash = sdb_ht_new ();
j = 0; // symbol_idx
for (s = 0; s < 2; s++) {
switch (s) {
case 0:
from = bin->dysymtab.iextdefsym;
to = from + bin->dysymtab.nextdefsym;
break;
case 1:
from = bin->dysymtab.ilocalsym;
to = from + bin->dysymtab.nlocalsym;
break;
#if NOT_USED
case 2:
from = bin->dysymtab.iundefsym;
to = from + bin->dysymtab.nundefsym;
break;
#endif
}
if (from == to) {
continue;
}
#define OLD 1
#if OLD
from = R_MIN (R_MAX (0, from), symbols_size / sizeof (struct symbol_t));
to = R_MIN (to , symbols_size / sizeof (struct symbol_t));
to = R_MIN (to, bin->nsymtab);
#else
from = R_MIN (R_MAX (0, from), symbols_size/sizeof (struct symbol_t));
to = symbols_count; //symbols_size/sizeof(struct symbol_t);
#endif
int maxsymbols = symbols_size / sizeof (struct symbol_t);
if (to > 0x500000) {
bprintf ("WARNING: corrupted mach0 header: symbol table is too big %d\n", to);
free (symbols);
sdb_ht_free (hash);
return NULL;
}
if (symbols_count >= maxsymbols) {
symbols_count = maxsymbols - 1;
}
for (i = from; i < to && j < symbols_count; i++, j++) {
symbols[j].offset = addr_to_offset (bin, bin->symtab[i].n_value);
symbols[j].addr = bin->symtab[i].n_value;
symbols[j].size = 0; /* TODO: Is it anywhere? */
if (bin->symtab[i].n_type & N_EXT) {
symbols[j].type = R_BIN_MACH0_SYMBOL_TYPE_EXT;
} else {
symbols[j].type = R_BIN_MACH0_SYMBOL_TYPE_LOCAL;
}
stridx = bin->symtab[i].n_strx;
if (stridx >= 0 && stridx < bin->symstrlen) {
symstr = (char*)bin->symstr + stridx;
} else {
symstr = "???";
}
{
int i = 0;
int len = 0;
len = bin->symstrlen - stridx;
if (len > 0) {
for (i = 0; i < len; i++) {
if ((ut8)(symstr[i] & 0xff) == 0xff || !symstr[i]) {
len = i;
break;
}
}
char *symstr_dup = NULL;
if (len > 0) {
symstr_dup = r_str_ndup (symstr, len);
}
if (!symstr_dup) {
symbols[j].name[0] = 0;
} else {
r_str_ncpy (symbols[j].name, symstr_dup, R_BIN_MACH0_STRING_LENGTH);
r_str_filter (symbols[j].name, -1);
symbols[j].name[R_BIN_MACH0_STRING_LENGTH - 2] = 0;
}
free (symstr_dup);
} else {
symbols[j].name[0] = 0;
}
symbols[j].last = 0;
}
if (inSymtab (hash, symbols, symbols[j].name, symbols[j].addr)) {
symbols[j].name[0] = 0;
j--;
}
}
}
to = R_MIN (bin->nsymtab, bin->dysymtab.iundefsym + bin->dysymtab.nundefsym);
for (i = bin->dysymtab.iundefsym; i < to; i++) {
if (j > symbols_count) {
bprintf ("mach0-get-symbols: error\n");
break;
}
if (parse_import_stub(bin, &symbols[j], i))
symbols[j++].last = 0;
}
#if 1
// symtab is wrongly parsed and produces dupped syms with incorrect vaddr */
for (i = 0; i < bin->nsymtab; i++) {
struct MACH0_(nlist) *st = &bin->symtab[i];
#if 0
bprintf ("stridx %d -> section %d type %d value = %d\n",
st->n_strx, st->n_sect, st->n_type, st->n_value);
#endif
stridx = st->n_strx;
if (stridx >= 0 && stridx < bin->symstrlen) {
symstr = (char*)bin->symstr + stridx;
} else {
symstr = "???";
}
// 0 is for imports
// 1 is for symbols
// 2 is for func.eh (exception handlers?)
int section = st->n_sect;
if (section == 1 && j < symbols_count) { // text ??st->n_type == 1)
/* is symbol */
symbols[j].addr = st->n_value; // + text_base;
symbols[j].offset = addr_to_offset (bin, symbols[j].addr);
symbols[j].size = 0; /* find next symbol and crop */
if (st->n_type & N_EXT) {
symbols[j].type = R_BIN_MACH0_SYMBOL_TYPE_EXT;
} else {
symbols[j].type = R_BIN_MACH0_SYMBOL_TYPE_LOCAL;
}
strncpy (symbols[j].name, symstr, R_BIN_MACH0_STRING_LENGTH);
symbols[j].name[R_BIN_MACH0_STRING_LENGTH - 1] = 0;
symbols[j].last = 0;
if (inSymtab (hash, symbols, symbols[j].name, symbols[j].addr)) {
symbols[j].name[0] = 0;
} else {
j++;
}
}
}
#endif
sdb_ht_free (hash);
symbols[j].last = 1;
return symbols;
}
| 12,834
|
115,016
| 0
|
void TestingAutomationProvider::SaveTabContents(
Browser* browser,
DictionaryValue* args,
IPC::Message* reply_message) {
int tab_index = 0;
FilePath::StringType filename;
FilePath::StringType parent_directory;
WebContents* web_contents = NULL;
if (!args->GetInteger("tab_index", &tab_index) ||
!args->GetString("filename", &filename)) {
AutomationJSONReply(this, reply_message)
.SendError("tab_index or filename param missing");
return;
} else {
web_contents = browser->GetWebContentsAt(tab_index);
if (!web_contents) {
AutomationJSONReply(this, reply_message).SendError("no tab at tab_index");
return;
}
}
parent_directory = FilePath(filename).DirName().value();
if (!web_contents->SavePage(
FilePath(filename),
FilePath(parent_directory),
SavePackage::SAVE_AS_ONLY_HTML)) {
AutomationJSONReply(this, reply_message).SendError(
"Could not initiate SavePage");
return;
}
new SavePackageNotificationObserver(
DownloadServiceFactory::GetForProfile(
browser->profile())->GetDownloadManager(),
this, reply_message);
}
| 12,835
|
121,759
| 0
|
int UDPSocketLibevent::LeaveGroup(const IPAddressNumber& group_address) const {
DCHECK(CalledOnValidThread());
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
switch (group_address.size()) {
case kIPv4AddressSize: {
if (addr_family_ != AF_INET)
return ERR_ADDRESS_INVALID;
ip_mreq mreq;
mreq.imr_interface.s_addr = INADDR_ANY;
memcpy(&mreq.imr_multiaddr, &group_address[0], kIPv4AddressSize);
int rv = setsockopt(socket_, IPPROTO_IP, IP_DROP_MEMBERSHIP,
&mreq, sizeof(mreq));
if (rv < 0)
return MapSystemError(errno);
return OK;
}
case kIPv6AddressSize: {
if (addr_family_ != AF_INET6)
return ERR_ADDRESS_INVALID;
ipv6_mreq mreq;
mreq.ipv6mr_interface = 0; // 0 indicates default multicast interface.
memcpy(&mreq.ipv6mr_multiaddr, &group_address[0], kIPv6AddressSize);
int rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
&mreq, sizeof(mreq));
if (rv < 0)
return MapSystemError(errno);
return OK;
}
default:
NOTREACHED() << "Invalid address family";
return ERR_ADDRESS_INVALID;
}
}
| 12,836
|
187,989
| 1
|
static uint32_t readU32(const uint8_t* data, size_t offset) {
return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
}
| 12,837
|
108,609
| 0
|
BlockingNetworkDelegateWithManualCallback()
: block_on_(0),
state_(NOT_BLOCKED) {
}
| 12,838
|
15,728
| 0
|
static void put_unused_buffer(QEMUFile *f, void *pv, size_t size)
{
static const uint8_t buf[1024];
int block_len;
while (size > 0) {
block_len = MIN(sizeof(buf), size);
size -= block_len;
qemu_put_buffer(f, buf, block_len);
}
}
| 12,839
|
79,619
| 0
|
void imap_disallow_reopen(struct Context *ctx)
{
struct ImapData *idata = NULL;
if (!ctx || !ctx->data || ctx->magic != MUTT_IMAP)
return;
idata = ctx->data;
if (idata->ctx == ctx)
idata->reopen &= ~IMAP_REOPEN_ALLOW;
}
| 12,840
|
80,901
| 0
|
GF_Err txtc_dump(GF_Box *a, FILE * trace)
{
GF_TextConfigBox *ptr = (GF_TextConfigBox*)a;
const char *name = "TextConfigBox";
gf_isom_box_dump_start(a, name, trace);
fprintf(trace, ">\n");
if (ptr->config) fprintf(trace, "<![CDATA[%s]]>", ptr->config);
gf_isom_box_dump_done(name, a, trace);
return GF_OK;
}
| 12,841
|
80,545
| 0
|
GF_Box *tmin_New()
{
ISOM_DECL_BOX_ALLOC(GF_TMINBox, GF_ISOM_BOX_TYPE_TMIN);
return (GF_Box *)tmp;
}
| 12,842
|
102,117
| 0
|
void SyncManager::SyncInternal::BootstrapEncryption(
const std::string& restored_key_for_bootstrapping) {
ReadTransaction trans(FROM_HERE, GetUserShare());
Cryptographer* cryptographer = trans.GetCryptographer();
cryptographer->Bootstrap(restored_key_for_bootstrapping);
}
| 12,843
|
104,561
| 0
|
ExtensionsQuotaServiceTest()
: extension_a_("a"),
extension_b_("b"),
extension_c_("c"),
loop_(),
ui_thread_(BrowserThread::UI, &loop_) {
}
| 12,844
|
188,529
| 1
|
static void TearDownTestCase() {
vpx_free(input_ - 1);
input_ = NULL;
vpx_free(output_);
output_ = NULL;
}
| 12,845
|
51,857
| 0
|
dissect_dch_radio_interface_parameter_update(proto_tree *tree, packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
int n;
guint8 value;
/* Show defined flags in these 2 bytes */
for (n=4; n >= 0; n--) {
proto_tree_add_item(tree, hf_fp_radio_interface_parameter_update_flag[n], tvb, offset, 2, ENC_BIG_ENDIAN);
}
offset += 2;
/* CFN */
tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_fp_cfn, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* DPC mode */
proto_tree_add_item(tree, hf_fp_dpc_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
/* TPC PO */
proto_tree_add_item(tree, hf_fp_tpc_po, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Multiple RL sets indicator */
proto_tree_add_item(tree, hf_fp_multiple_rl_set_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 2;
/* MAX_UE_TX_POW */
value = (tvb_get_guint8(tvb, offset) & 0x7f);
proto_tree_add_int(tree, hf_fp_max_ue_tx_pow, tvb, offset, 1, -55 + value);
offset++;
return offset;
}
| 12,846
|
181,028
| 1
|
pimv1_print(netdissect_options *ndo,
register const u_char *bp, register u_int len)
{
register const u_char *ep;
register u_char type;
ep = (const u_char *)ndo->ndo_snapend;
if (bp >= ep)
return;
ND_TCHECK(bp[1]);
type = bp[1];
ND_PRINT((ndo, " %s", tok2str(pimv1_type_str, "[type %u]", type)));
switch (type) {
case PIMV1_TYPE_QUERY:
if (ND_TTEST(bp[8])) {
switch (bp[8] >> 4) {
case 0:
ND_PRINT((ndo, " Dense-mode"));
break;
case 1:
ND_PRINT((ndo, " Sparse-mode"));
break;
case 2:
ND_PRINT((ndo, " Sparse-Dense-mode"));
break;
default:
ND_PRINT((ndo, " mode-%d", bp[8] >> 4));
break;
}
}
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[10],2);
ND_PRINT((ndo, " (Hold-time "));
unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[10]));
ND_PRINT((ndo, ")"));
}
break;
case PIMV1_TYPE_REGISTER:
ND_TCHECK2(bp[8], 20); /* ip header */
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[20]),
ipaddr_string(ndo, &bp[24])));
break;
case PIMV1_TYPE_REGISTER_STOP:
ND_TCHECK2(bp[12], sizeof(struct in_addr));
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[8]),
ipaddr_string(ndo, &bp[12])));
break;
case PIMV1_TYPE_RP_REACHABILITY:
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[22], 2);
ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[22]));
}
break;
case PIMV1_TYPE_ASSERT:
ND_TCHECK2(bp[16], sizeof(struct in_addr));
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
ipaddr_string(ndo, &bp[8])));
if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_TCHECK2(bp[24], 4);
ND_PRINT((ndo, " %s pref %d metric %d",
(bp[20] & 0x80) ? "RP-tree" : "SPT",
EXTRACT_32BITS(&bp[20]) & 0x7fffffff,
EXTRACT_32BITS(&bp[24])));
break;
case PIMV1_TYPE_JOIN_PRUNE:
case PIMV1_TYPE_GRAFT:
case PIMV1_TYPE_GRAFT_ACK:
if (ndo->ndo_vflag)
pimv1_join_prune_print(ndo, &bp[8], len - 8);
break;
}
ND_TCHECK(bp[4]);
if ((bp[4] >> 4) != 1)
ND_PRINT((ndo, " [v%d]", bp[4] >> 4));
return;
trunc:
ND_PRINT((ndo, "[|pim]"));
return;
}
| 12,847
|
46,419
| 0
|
int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{
struct inode *inode = file->f_mapping->host;
struct ubifs_info *c = inode->i_sb->s_fs_info;
int err;
dbg_gen("syncing inode %lu", inode->i_ino);
if (c->ro_mount)
/*
* For some really strange reasons VFS does not filter out
* 'fsync()' for R/O mounted file-systems as per 2.6.39.
*/
return 0;
err = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (err)
return err;
mutex_lock(&inode->i_mutex);
/* Synchronize the inode unless this is a 'datasync()' call. */
if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) {
err = inode->i_sb->s_op->write_inode(inode, NULL);
if (err)
goto out;
}
/*
* Nodes related to this inode may still sit in a write-buffer. Flush
* them.
*/
err = ubifs_sync_wbufs_by_inode(c, inode);
out:
mutex_unlock(&inode->i_mutex);
return err;
}
| 12,848
|
88,929
| 0
|
MagickExport ChannelMoments *GetImageChannelMoments(const Image *image,
ExceptionInfo *exception)
{
#define MaxNumberImageMoments 8
ChannelMoments
*channel_moments;
double
M00[CompositeChannels+1],
M01[CompositeChannels+1],
M02[CompositeChannels+1],
M03[CompositeChannels+1],
M10[CompositeChannels+1],
M11[CompositeChannels+1],
M12[CompositeChannels+1],
M20[CompositeChannels+1],
M21[CompositeChannels+1],
M22[CompositeChannels+1],
M30[CompositeChannels+1];
MagickPixelPacket
pixel;
PointInfo
centroid[CompositeChannels+1];
ssize_t
channel,
channels,
y;
size_t
length;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
length=CompositeChannels+1UL;
channel_moments=(ChannelMoments *) AcquireQuantumMemory(length,
sizeof(*channel_moments));
if (channel_moments == (ChannelMoments *) NULL)
return(channel_moments);
(void) memset(channel_moments,0,length*sizeof(*channel_moments));
(void) memset(centroid,0,sizeof(centroid));
(void) memset(M00,0,sizeof(M00));
(void) memset(M01,0,sizeof(M01));
(void) memset(M02,0,sizeof(M02));
(void) memset(M03,0,sizeof(M03));
(void) memset(M10,0,sizeof(M10));
(void) memset(M11,0,sizeof(M11));
(void) memset(M12,0,sizeof(M12));
(void) memset(M20,0,sizeof(M20));
(void) memset(M21,0,sizeof(M21));
(void) memset(M22,0,sizeof(M22));
(void) memset(M30,0,sizeof(M30));
GetMagickPixelPacket(image,&pixel);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
*magick_restrict indexes;
register const PixelPacket
*magick_restrict p;
register ssize_t
x;
/*
Compute center of mass (centroid).
*/
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetMagickPixelPacket(image,p,indexes+x,&pixel);
M00[RedChannel]+=QuantumScale*pixel.red;
M10[RedChannel]+=x*QuantumScale*pixel.red;
M01[RedChannel]+=y*QuantumScale*pixel.red;
M00[GreenChannel]+=QuantumScale*pixel.green;
M10[GreenChannel]+=x*QuantumScale*pixel.green;
M01[GreenChannel]+=y*QuantumScale*pixel.green;
M00[BlueChannel]+=QuantumScale*pixel.blue;
M10[BlueChannel]+=x*QuantumScale*pixel.blue;
M01[BlueChannel]+=y*QuantumScale*pixel.blue;
if (image->matte != MagickFalse)
{
M00[OpacityChannel]+=QuantumScale*pixel.opacity;
M10[OpacityChannel]+=x*QuantumScale*pixel.opacity;
M01[OpacityChannel]+=y*QuantumScale*pixel.opacity;
}
if (image->colorspace == CMYKColorspace)
{
M00[IndexChannel]+=QuantumScale*pixel.index;
M10[IndexChannel]+=x*QuantumScale*pixel.index;
M01[IndexChannel]+=y*QuantumScale*pixel.index;
}
p++;
}
}
for (channel=0; channel <= CompositeChannels; channel++)
{
/*
Compute center of mass (centroid).
*/
if (M00[channel] < MagickEpsilon)
{
M00[channel]+=MagickEpsilon;
centroid[channel].x=(double) image->columns/2.0;
centroid[channel].y=(double) image->rows/2.0;
continue;
}
M00[channel]+=MagickEpsilon;
centroid[channel].x=M10[channel]/M00[channel];
centroid[channel].y=M01[channel]/M00[channel];
}
for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
*magick_restrict indexes;
register const PixelPacket
*magick_restrict p;
register ssize_t
x;
/*
Compute the image moments.
*/
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetMagickPixelPacket(image,p,indexes+x,&pixel);
M11[RedChannel]+=(x-centroid[RedChannel].x)*(y-
centroid[RedChannel].y)*QuantumScale*pixel.red;
M20[RedChannel]+=(x-centroid[RedChannel].x)*(x-
centroid[RedChannel].x)*QuantumScale*pixel.red;
M02[RedChannel]+=(y-centroid[RedChannel].y)*(y-
centroid[RedChannel].y)*QuantumScale*pixel.red;
M21[RedChannel]+=(x-centroid[RedChannel].x)*(x-
centroid[RedChannel].x)*(y-centroid[RedChannel].y)*QuantumScale*
pixel.red;
M12[RedChannel]+=(x-centroid[RedChannel].x)*(y-
centroid[RedChannel].y)*(y-centroid[RedChannel].y)*QuantumScale*
pixel.red;
M22[RedChannel]+=(x-centroid[RedChannel].x)*(x-
centroid[RedChannel].x)*(y-centroid[RedChannel].y)*(y-
centroid[RedChannel].y)*QuantumScale*pixel.red;
M30[RedChannel]+=(x-centroid[RedChannel].x)*(x-
centroid[RedChannel].x)*(x-centroid[RedChannel].x)*QuantumScale*
pixel.red;
M03[RedChannel]+=(y-centroid[RedChannel].y)*(y-
centroid[RedChannel].y)*(y-centroid[RedChannel].y)*QuantumScale*
pixel.red;
M11[GreenChannel]+=(x-centroid[GreenChannel].x)*(y-
centroid[GreenChannel].y)*QuantumScale*pixel.green;
M20[GreenChannel]+=(x-centroid[GreenChannel].x)*(x-
centroid[GreenChannel].x)*QuantumScale*pixel.green;
M02[GreenChannel]+=(y-centroid[GreenChannel].y)*(y-
centroid[GreenChannel].y)*QuantumScale*pixel.green;
M21[GreenChannel]+=(x-centroid[GreenChannel].x)*(x-
centroid[GreenChannel].x)*(y-centroid[GreenChannel].y)*QuantumScale*
pixel.green;
M12[GreenChannel]+=(x-centroid[GreenChannel].x)*(y-
centroid[GreenChannel].y)*(y-centroid[GreenChannel].y)*QuantumScale*
pixel.green;
M22[GreenChannel]+=(x-centroid[GreenChannel].x)*(x-
centroid[GreenChannel].x)*(y-centroid[GreenChannel].y)*(y-
centroid[GreenChannel].y)*QuantumScale*pixel.green;
M30[GreenChannel]+=(x-centroid[GreenChannel].x)*(x-
centroid[GreenChannel].x)*(x-centroid[GreenChannel].x)*QuantumScale*
pixel.green;
M03[GreenChannel]+=(y-centroid[GreenChannel].y)*(y-
centroid[GreenChannel].y)*(y-centroid[GreenChannel].y)*QuantumScale*
pixel.green;
M11[BlueChannel]+=(x-centroid[BlueChannel].x)*(y-
centroid[BlueChannel].y)*QuantumScale*pixel.blue;
M20[BlueChannel]+=(x-centroid[BlueChannel].x)*(x-
centroid[BlueChannel].x)*QuantumScale*pixel.blue;
M02[BlueChannel]+=(y-centroid[BlueChannel].y)*(y-
centroid[BlueChannel].y)*QuantumScale*pixel.blue;
M21[BlueChannel]+=(x-centroid[BlueChannel].x)*(x-
centroid[BlueChannel].x)*(y-centroid[BlueChannel].y)*QuantumScale*
pixel.blue;
M12[BlueChannel]+=(x-centroid[BlueChannel].x)*(y-
centroid[BlueChannel].y)*(y-centroid[BlueChannel].y)*QuantumScale*
pixel.blue;
M22[BlueChannel]+=(x-centroid[BlueChannel].x)*(x-
centroid[BlueChannel].x)*(y-centroid[BlueChannel].y)*(y-
centroid[BlueChannel].y)*QuantumScale*pixel.blue;
M30[BlueChannel]+=(x-centroid[BlueChannel].x)*(x-
centroid[BlueChannel].x)*(x-centroid[BlueChannel].x)*QuantumScale*
pixel.blue;
M03[BlueChannel]+=(y-centroid[BlueChannel].y)*(y-
centroid[BlueChannel].y)*(y-centroid[BlueChannel].y)*QuantumScale*
pixel.blue;
if (image->matte != MagickFalse)
{
M11[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(y-
centroid[OpacityChannel].y)*QuantumScale*pixel.opacity;
M20[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(x-
centroid[OpacityChannel].x)*QuantumScale*pixel.opacity;
M02[OpacityChannel]+=(y-centroid[OpacityChannel].y)*(y-
centroid[OpacityChannel].y)*QuantumScale*pixel.opacity;
M21[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(x-
centroid[OpacityChannel].x)*(y-centroid[OpacityChannel].y)*
QuantumScale*pixel.opacity;
M12[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(y-
centroid[OpacityChannel].y)*(y-centroid[OpacityChannel].y)*
QuantumScale*pixel.opacity;
M22[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(x-
centroid[OpacityChannel].x)*(y-centroid[OpacityChannel].y)*(y-
centroid[OpacityChannel].y)*QuantumScale*pixel.opacity;
M30[OpacityChannel]+=(x-centroid[OpacityChannel].x)*(x-
centroid[OpacityChannel].x)*(x-centroid[OpacityChannel].x)*
QuantumScale*pixel.opacity;
M03[OpacityChannel]+=(y-centroid[OpacityChannel].y)*(y-
centroid[OpacityChannel].y)*(y-centroid[OpacityChannel].y)*
QuantumScale*pixel.opacity;
}
if (image->colorspace == CMYKColorspace)
{
M11[IndexChannel]+=(x-centroid[IndexChannel].x)*(y-
centroid[IndexChannel].y)*QuantumScale*pixel.index;
M20[IndexChannel]+=(x-centroid[IndexChannel].x)*(x-
centroid[IndexChannel].x)*QuantumScale*pixel.index;
M02[IndexChannel]+=(y-centroid[IndexChannel].y)*(y-
centroid[IndexChannel].y)*QuantumScale*pixel.index;
M21[IndexChannel]+=(x-centroid[IndexChannel].x)*(x-
centroid[IndexChannel].x)*(y-centroid[IndexChannel].y)*
QuantumScale*pixel.index;
M12[IndexChannel]+=(x-centroid[IndexChannel].x)*(y-
centroid[IndexChannel].y)*(y-centroid[IndexChannel].y)*
QuantumScale*pixel.index;
M22[IndexChannel]+=(x-centroid[IndexChannel].x)*(x-
centroid[IndexChannel].x)*(y-centroid[IndexChannel].y)*(y-
centroid[IndexChannel].y)*QuantumScale*pixel.index;
M30[IndexChannel]+=(x-centroid[IndexChannel].x)*(x-
centroid[IndexChannel].x)*(x-centroid[IndexChannel].x)*
QuantumScale*pixel.index;
M03[IndexChannel]+=(y-centroid[IndexChannel].y)*(y-
centroid[IndexChannel].y)*(y-centroid[IndexChannel].y)*
QuantumScale*pixel.index;
}
p++;
}
}
channels=3;
M00[CompositeChannels]+=(M00[RedChannel]+M00[GreenChannel]+M00[BlueChannel]);
M01[CompositeChannels]+=(M01[RedChannel]+M01[GreenChannel]+M01[BlueChannel]);
M02[CompositeChannels]+=(M02[RedChannel]+M02[GreenChannel]+M02[BlueChannel]);
M03[CompositeChannels]+=(M03[RedChannel]+M03[GreenChannel]+M03[BlueChannel]);
M10[CompositeChannels]+=(M10[RedChannel]+M10[GreenChannel]+M10[BlueChannel]);
M11[CompositeChannels]+=(M11[RedChannel]+M11[GreenChannel]+M11[BlueChannel]);
M12[CompositeChannels]+=(M12[RedChannel]+M12[GreenChannel]+M12[BlueChannel]);
M20[CompositeChannels]+=(M20[RedChannel]+M20[GreenChannel]+M20[BlueChannel]);
M21[CompositeChannels]+=(M21[RedChannel]+M21[GreenChannel]+M21[BlueChannel]);
M22[CompositeChannels]+=(M22[RedChannel]+M22[GreenChannel]+M22[BlueChannel]);
M30[CompositeChannels]+=(M30[RedChannel]+M30[GreenChannel]+M30[BlueChannel]);
if (image->matte != MagickFalse)
{
channels+=1;
M00[CompositeChannels]+=M00[OpacityChannel];
M01[CompositeChannels]+=M01[OpacityChannel];
M02[CompositeChannels]+=M02[OpacityChannel];
M03[CompositeChannels]+=M03[OpacityChannel];
M10[CompositeChannels]+=M10[OpacityChannel];
M11[CompositeChannels]+=M11[OpacityChannel];
M12[CompositeChannels]+=M12[OpacityChannel];
M20[CompositeChannels]+=M20[OpacityChannel];
M21[CompositeChannels]+=M21[OpacityChannel];
M22[CompositeChannels]+=M22[OpacityChannel];
M30[CompositeChannels]+=M30[OpacityChannel];
}
if (image->colorspace == CMYKColorspace)
{
channels+=1;
M00[CompositeChannels]+=M00[IndexChannel];
M01[CompositeChannels]+=M01[IndexChannel];
M02[CompositeChannels]+=M02[IndexChannel];
M03[CompositeChannels]+=M03[IndexChannel];
M10[CompositeChannels]+=M10[IndexChannel];
M11[CompositeChannels]+=M11[IndexChannel];
M12[CompositeChannels]+=M12[IndexChannel];
M20[CompositeChannels]+=M20[IndexChannel];
M21[CompositeChannels]+=M21[IndexChannel];
M22[CompositeChannels]+=M22[IndexChannel];
M30[CompositeChannels]+=M30[IndexChannel];
}
M00[CompositeChannels]/=(double) channels;
M01[CompositeChannels]/=(double) channels;
M02[CompositeChannels]/=(double) channels;
M03[CompositeChannels]/=(double) channels;
M10[CompositeChannels]/=(double) channels;
M11[CompositeChannels]/=(double) channels;
M12[CompositeChannels]/=(double) channels;
M20[CompositeChannels]/=(double) channels;
M21[CompositeChannels]/=(double) channels;
M22[CompositeChannels]/=(double) channels;
M30[CompositeChannels]/=(double) channels;
for (channel=0; channel <= CompositeChannels; channel++)
{
/*
Compute elliptical angle, major and minor axes, eccentricity, & intensity.
*/
channel_moments[channel].centroid=centroid[channel];
channel_moments[channel].ellipse_axis.x=sqrt((2.0/M00[channel])*
((M20[channel]+M02[channel])+sqrt(4.0*M11[channel]*M11[channel]+
(M20[channel]-M02[channel])*(M20[channel]-M02[channel]))));
channel_moments[channel].ellipse_axis.y=sqrt((2.0/M00[channel])*
((M20[channel]+M02[channel])-sqrt(4.0*M11[channel]*M11[channel]+
(M20[channel]-M02[channel])*(M20[channel]-M02[channel]))));
channel_moments[channel].ellipse_angle=RadiansToDegrees(0.5*atan(2.0*
M11[channel]/(M20[channel]-M02[channel]+MagickEpsilon)));
if (fabs(M11[channel]) < MagickEpsilon)
{
if (fabs(M20[channel]-M02[channel]) < MagickEpsilon)
channel_moments[channel].ellipse_angle+=0.0;
else
if ((M20[channel]-M02[channel]) < 0.0)
channel_moments[channel].ellipse_angle+=90.0;
else
channel_moments[channel].ellipse_angle+=0.0;
}
else
if (M11[channel] < 0.0)
{
if (fabs(M20[channel]-M02[channel]) < MagickEpsilon)
channel_moments[channel].ellipse_angle+=0.0;
else
if ((M20[channel]-M02[channel]) < 0.0)
channel_moments[channel].ellipse_angle+=90.0;
else
channel_moments[channel].ellipse_angle+=180.0;
}
else
{
if (fabs(M20[channel]-M02[channel]) < MagickEpsilon)
channel_moments[channel].ellipse_angle+=0.0;
else
if ((M20[channel]-M02[channel]) < 0.0)
channel_moments[channel].ellipse_angle+=90.0;
else
channel_moments[channel].ellipse_angle+=0.0;
}
channel_moments[channel].ellipse_eccentricity=sqrt(1.0-(
channel_moments[channel].ellipse_axis.y/
(channel_moments[channel].ellipse_axis.x+MagickEpsilon)));
channel_moments[channel].ellipse_intensity=M00[channel]/
(MagickPI*channel_moments[channel].ellipse_axis.x*
channel_moments[channel].ellipse_axis.y+MagickEpsilon);
}
for (channel=0; channel <= CompositeChannels; channel++)
{
/*
Normalize image moments.
*/
M10[channel]=0.0;
M01[channel]=0.0;
M11[channel]/=pow(M00[channel],1.0+(1.0+1.0)/2.0);
M20[channel]/=pow(M00[channel],1.0+(2.0+0.0)/2.0);
M02[channel]/=pow(M00[channel],1.0+(0.0+2.0)/2.0);
M21[channel]/=pow(M00[channel],1.0+(2.0+1.0)/2.0);
M12[channel]/=pow(M00[channel],1.0+(1.0+2.0)/2.0);
M22[channel]/=pow(M00[channel],1.0+(2.0+2.0)/2.0);
M30[channel]/=pow(M00[channel],1.0+(3.0+0.0)/2.0);
M03[channel]/=pow(M00[channel],1.0+(0.0+3.0)/2.0);
M00[channel]=1.0;
}
for (channel=0; channel <= CompositeChannels; channel++)
{
/*
Compute Hu invariant moments.
*/
channel_moments[channel].I[0]=M20[channel]+M02[channel];
channel_moments[channel].I[1]=(M20[channel]-M02[channel])*
(M20[channel]-M02[channel])+4.0*M11[channel]*M11[channel];
channel_moments[channel].I[2]=(M30[channel]-3.0*M12[channel])*
(M30[channel]-3.0*M12[channel])+(3.0*M21[channel]-M03[channel])*
(3.0*M21[channel]-M03[channel]);
channel_moments[channel].I[3]=(M30[channel]+M12[channel])*
(M30[channel]+M12[channel])+(M21[channel]+M03[channel])*
(M21[channel]+M03[channel]);
channel_moments[channel].I[4]=(M30[channel]-3.0*M12[channel])*
(M30[channel]+M12[channel])*((M30[channel]+M12[channel])*
(M30[channel]+M12[channel])-3.0*(M21[channel]+M03[channel])*
(M21[channel]+M03[channel]))+(3.0*M21[channel]-M03[channel])*
(M21[channel]+M03[channel])*(3.0*(M30[channel]+M12[channel])*
(M30[channel]+M12[channel])-(M21[channel]+M03[channel])*
(M21[channel]+M03[channel]));
channel_moments[channel].I[5]=(M20[channel]-M02[channel])*
((M30[channel]+M12[channel])*(M30[channel]+M12[channel])-
(M21[channel]+M03[channel])*(M21[channel]+M03[channel]))+
4.0*M11[channel]*(M30[channel]+M12[channel])*(M21[channel]+M03[channel]);
channel_moments[channel].I[6]=(3.0*M21[channel]-M03[channel])*
(M30[channel]+M12[channel])*((M30[channel]+M12[channel])*
(M30[channel]+M12[channel])-3.0*(M21[channel]+M03[channel])*
(M21[channel]+M03[channel]))-(M30[channel]-3*M12[channel])*
(M21[channel]+M03[channel])*(3.0*(M30[channel]+M12[channel])*
(M30[channel]+M12[channel])-(M21[channel]+M03[channel])*
(M21[channel]+M03[channel]));
channel_moments[channel].I[7]=M11[channel]*((M30[channel]+M12[channel])*
(M30[channel]+M12[channel])-(M03[channel]+M21[channel])*
(M03[channel]+M21[channel]))-(M20[channel]-M02[channel])*
(M30[channel]+M12[channel])*(M03[channel]+M21[channel]);
}
if (y < (ssize_t) image->rows)
channel_moments=(ChannelMoments *) RelinquishMagickMemory(channel_moments);
return(channel_moments);
}
| 12,849
|
104,820
| 0
|
void ExtensionService::SetIsIncognitoEnabled(
const std::string& extension_id, bool enabled) {
const Extension* extension = GetInstalledExtension(extension_id);
if (extension && extension->location() == Extension::COMPONENT) {
NOTREACHED();
return;
}
bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id);
if (enabled == old_enabled)
return;
extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled);
const Extension* enabled_extension = GetExtensionById(extension_id, false);
if (enabled_extension) {
NotifyExtensionUnloaded(enabled_extension, UnloadedExtensionInfo::DISABLE);
NotifyExtensionLoaded(enabled_extension);
}
}
| 12,850
|
1,322
| 0
|
EntityDescriptor* DynamicMetadataProvider::resolve(const Criteria& criteria) const
{
string name;
if (criteria.entityID_ascii) {
name = criteria.entityID_ascii;
}
else if (criteria.entityID_unicode) {
auto_ptr_char temp(criteria.entityID_unicode);
name = temp.get();
}
else if (criteria.artifact) {
throw MetadataException("Unable to resolve metadata dynamically from an artifact.");
}
try {
DOMDocument* doc=nullptr;
auto_ptr_XMLCh widenit(name.c_str());
URLInputSource src(widenit.get());
Wrapper4InputSource dsrc(&src,false);
if (m_validate)
doc=XMLToolingConfig::getConfig().getValidatingParser().parse(dsrc);
else
doc=XMLToolingConfig::getConfig().getParser().parse(dsrc);
XercesJanitor<DOMDocument> docjanitor(doc);
auto_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
docjanitor.release();
EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(xmlObject.get());
if (!entity) {
throw MetadataException(
"Root of metadata instance not recognized: $1", params(1,xmlObject->getElementQName().toString().c_str())
);
}
xmlObject.release();
return entity;
}
catch (XMLException& e) {
auto_ptr_char msg(e.getMessage());
Category::getInstance(SAML_LOGCAT ".MetadataProvider.Dynamic").error(
"Xerces error while resolving entityID (%s): %s", name.c_str(), msg.get()
);
throw MetadataException(msg.get());
}
}
| 12,851
|
165,779
| 0
|
CSSPropertyID SVGElement::CssPropertyIdForSVGAttributeName(
const QualifiedName& attr_name) {
if (!attr_name.NamespaceURI().IsNull())
return CSSPropertyInvalid;
static HashMap<StringImpl*, CSSPropertyID>* property_name_to_id_map = nullptr;
if (!property_name_to_id_map) {
property_name_to_id_map = new HashMap<StringImpl*, CSSPropertyID>;
const QualifiedName* const attr_names[] = {
&kAlignmentBaselineAttr,
&kBaselineShiftAttr,
&kBufferedRenderingAttr,
&kClipAttr,
&kClipPathAttr,
&kClipRuleAttr,
&svg_names::kColorAttr,
&kColorInterpolationAttr,
&kColorInterpolationFiltersAttr,
&kColorRenderingAttr,
&kCursorAttr,
&svg_names::kDirectionAttr,
&kDisplayAttr,
&kDominantBaselineAttr,
&kFillAttr,
&kFillOpacityAttr,
&kFillRuleAttr,
&kFilterAttr,
&kFloodColorAttr,
&kFloodOpacityAttr,
&kFontFamilyAttr,
&kFontSizeAttr,
&kFontStretchAttr,
&kFontStyleAttr,
&kFontVariantAttr,
&kFontWeightAttr,
&kImageRenderingAttr,
&kLetterSpacingAttr,
&kLightingColorAttr,
&kMarkerEndAttr,
&kMarkerMidAttr,
&kMarkerStartAttr,
&kMaskAttr,
&kMaskTypeAttr,
&kOpacityAttr,
&kOverflowAttr,
&kPaintOrderAttr,
&kPointerEventsAttr,
&kShapeRenderingAttr,
&kStopColorAttr,
&kStopOpacityAttr,
&kStrokeAttr,
&kStrokeDasharrayAttr,
&kStrokeDashoffsetAttr,
&kStrokeLinecapAttr,
&kStrokeLinejoinAttr,
&kStrokeMiterlimitAttr,
&kStrokeOpacityAttr,
&kStrokeWidthAttr,
&kTextAnchorAttr,
&kTextDecorationAttr,
&kTextRenderingAttr,
&kTransformOriginAttr,
&kUnicodeBidiAttr,
&kVectorEffectAttr,
&kVisibilityAttr,
&kWordSpacingAttr,
&kWritingModeAttr,
};
for (size_t i = 0; i < arraysize(attr_names); i++) {
CSSPropertyID property_id = cssPropertyID(attr_names[i]->LocalName());
DCHECK_GT(property_id, 0);
property_name_to_id_map->Set(attr_names[i]->LocalName().Impl(),
property_id);
}
}
return property_name_to_id_map->at(attr_name.LocalName().Impl());
}
| 12,852
|
29,374
| 0
|
static int get_device_type(int arg)
{
int ret;
ret = inb(mp_devs[arg].option_reg_addr+MP_OPTR_DIR0);
ret = (ret & 0xf0) >> 4;
switch (ret)
{
case DIR_UART_16C550:
return PORT_16C55X;
case DIR_UART_16C1050:
return PORT_16C105X;
case DIR_UART_16C1050A:
/*
if (mtpt->port.line < 2)
{
return PORT_16C105XA;
}
else
{
if (mtpt->device->device_id & 0x50)
{
return PORT_16C55X;
}
else
{
return PORT_16C105X;
}
}*/
return PORT_16C105XA;
default:
return PORT_UNKNOWN;
}
}
| 12,853
|
146,265
| 0
|
PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::CreateDrawingBuffer(
std::unique_ptr<WebGraphicsContext3DProvider> context_provider) {
bool premultiplied_alpha = CreationAttributes().premultipliedAlpha();
bool want_alpha_channel = CreationAttributes().alpha();
bool want_depth_buffer = CreationAttributes().depth();
bool want_stencil_buffer = CreationAttributes().stencil();
bool want_antialiasing = CreationAttributes().antialias();
DrawingBuffer::PreserveDrawingBuffer preserve =
CreationAttributes().preserveDrawingBuffer() ? DrawingBuffer::kPreserve
: DrawingBuffer::kDiscard;
DrawingBuffer::WebGLVersion web_gl_version = DrawingBuffer::kWebGL1;
if (Version() == 1) {
web_gl_version = DrawingBuffer::kWebGL1;
} else if (Version() == 2) {
web_gl_version = DrawingBuffer::kWebGL2;
} else {
NOTREACHED();
}
DrawingBuffer::ChromiumImageUsage chromium_image_usage =
host()->IsOffscreenCanvas() ? DrawingBuffer::kDisallowChromiumImage
: DrawingBuffer::kAllowChromiumImage;
return DrawingBuffer::Create(
std::move(context_provider), this, ClampedCanvasSize(),
premultiplied_alpha, want_alpha_channel, want_depth_buffer,
want_stencil_buffer, want_antialiasing, preserve, web_gl_version,
chromium_image_usage, color_params());
}
| 12,854
|
123,267
| 0
|
virtual ~WindowObserver() {}
| 12,855
|
11,364
| 0
|
fbCombineDisjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine)
{
int i;
for (i = 0; i < width; ++i) {
CARD32 s = READ(src + i);
CARD32 d = READ(dest + i);
CARD32 m,n,o,p;
CARD16 Fa, Fb, t, u, v;
CARD8 sa = s >> 24;
CARD8 da = d >> 24;
switch (combine & CombineA) {
default:
Fa = 0;
break;
case CombineAOut:
Fa = fbCombineDisjointOutPart (sa, da);
break;
case CombineAIn:
Fa = fbCombineDisjointInPart (sa, da);
break;
case CombineA:
Fa = 0xff;
break;
}
switch (combine & CombineB) {
default:
Fb = 0;
break;
case CombineBOut:
Fb = fbCombineDisjointOutPart (da, sa);
break;
case CombineBIn:
Fb = fbCombineDisjointInPart (da, sa);
break;
case CombineB:
Fb = 0xff;
break;
}
m = FbGen (s,d,0,Fa,Fb,t, u, v);
n = FbGen (s,d,8,Fa,Fb,t, u, v);
o = FbGen (s,d,16,Fa,Fb,t, u, v);
p = FbGen (s,d,24,Fa,Fb,t, u, v);
s = m|n|o|p;
WRITE(dest + i, s);
}
}
| 12,856
|
34,916
| 0
|
struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data)
{
struct rpc_task *task;
task = rpc_new_task(task_setup_data);
if (IS_ERR(task))
goto out;
rpc_task_set_client(task, task_setup_data->rpc_client);
rpc_task_set_rpc_message(task, task_setup_data->rpc_message);
if (task->tk_action == NULL)
rpc_call_start(task);
atomic_inc(&task->tk_count);
rpc_execute(task);
out:
return task;
}
| 12,857
|
49,771
| 0
|
static uint8_t arcmsr_hbaB_abort_allcmd(struct AdapterControlBlock *acb)
{
struct MessageUnit_B *reg = acb->pmuB;
writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell);
if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
printk(KERN_NOTICE
"arcmsr%d: wait 'abort all outstanding command' timeout\n"
, acb->host->host_no);
return false;
}
return true;
}
| 12,858
|
100,202
| 0
|
PluginHelper::~PluginHelper() {
DCHECK(CalledOnValidThread());
}
| 12,859
|
118,148
| 0
|
void JavaScriptResultCallback(const ScopedJavaGlobalRef<jobject>& callback,
const base::Value* result) {
JNIEnv* env = base::android::AttachCurrentThread();
std::string json;
base::JSONWriter::Write(result, &json);
ScopedJavaLocalRef<jstring> j_json = ConvertUTF8ToJavaString(env, json);
content::Java_WebContentsImpl_onEvaluateJavaScriptResult(
env, j_json.obj(), callback.obj());
}
| 12,860
|
2,405
| 0
|
void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
struct smb_trans_enc_state *es)
{
/* Replace the old state, if any. */
if (conn->smb1.trans_enc) {
TALLOC_FREE(conn->smb1.trans_enc);
}
conn->smb1.trans_enc = es;
}
| 12,861
|
123,849
| 0
|
void RenderViewImpl::DidFlushPaint() {
pepper_helper_->ViewFlushedPaint();
if (!webview())
return;
WebFrame* main_frame = webview()->mainFrame();
if (!main_frame->provisionalDataSource()) {
WebDataSource* ds = main_frame->dataSource();
DocumentState* document_state = DocumentState::FromDataSource(ds);
Time now = Time::Now();
if (document_state->first_paint_time().is_null()) {
document_state->set_first_paint_time(now);
}
if (document_state->first_paint_after_load_time().is_null() &&
!document_state->finish_load_time().is_null()) {
document_state->set_first_paint_after_load_time(now);
}
}
}
| 12,862
|
98,679
| 0
|
void BuildMouseWheelEvent(const WebInputEvent* event, NPPepperEvent* npevent) {
const WebMouseWheelEvent* mouse_wheel_event =
reinterpret_cast<const WebMouseWheelEvent*>(event);
npevent->u.wheel.modifier = mouse_wheel_event->modifiers;
npevent->u.wheel.deltaX = mouse_wheel_event->deltaX;
npevent->u.wheel.deltaY = mouse_wheel_event->deltaY;
npevent->u.wheel.wheelTicksX = mouse_wheel_event->wheelTicksX;
npevent->u.wheel.wheelTicksY = mouse_wheel_event->wheelTicksY;
npevent->u.wheel.scrollByPage = mouse_wheel_event->scrollByPage;
}
| 12,863
|
51,317
| 0
|
FileFunction(fstat)
/* }}} */
/* {{{ proto bool SplFileObject::ftruncate(int size)
| 12,864
|
119,240
| 0
|
PassRefPtr<HTMLCollection> HTMLFormElement::elements()
{
return ensureCachedHTMLCollection(FormControls);
}
| 12,865
|
121,036
| 0
|
int HttpStreamParser::DoSendBody(int result) {
request_body_send_buf_->DidConsume(result);
if (request_body_send_buf_->BytesRemaining() > 0) {
return connection_->socket()->Write(
request_body_send_buf_,
request_body_send_buf_->BytesRemaining(),
io_callback_);
}
if (request_->upload_data_stream->is_chunked() && sent_last_chunk_) {
io_state_ = STATE_REQUEST_SENT;
return OK;
}
request_body_read_buf_->Clear();
io_state_ = STATE_SEND_REQUEST_READING_BODY;
return request_->upload_data_stream->Read(request_body_read_buf_,
request_body_read_buf_->capacity(),
io_callback_);
}
| 12,866
|
59,919
| 0
|
static int uas_wait_for_pending_cmnds(struct uas_dev_info *devinfo)
{
unsigned long start_time;
int r;
start_time = jiffies;
do {
flush_work(&devinfo->work);
r = usb_wait_anchor_empty_timeout(&devinfo->sense_urbs, 5000);
if (r == 0)
return -ETIME;
r = usb_wait_anchor_empty_timeout(&devinfo->data_urbs, 500);
if (r == 0)
return -ETIME;
if (time_after(jiffies, start_time + 5 * HZ))
return -ETIME;
} while (!uas_cmnd_list_empty(devinfo));
return 0;
}
| 12,867
|
101,468
| 0
|
bool DirectoryBackingStore::MigrateVersion74To75() {
if (SQLITE_DONE != ExecQuery(load_dbhandle_,
"ALTER TABLE models RENAME TO temp_models")) {
return false;
}
if (!CreateModelsTable())
return false;
sqlite_utils::SQLStatement query;
query.prepare(load_dbhandle_,
"SELECT model_id, last_download_timestamp, initial_sync_ended "
"FROM temp_models");
while (SQLITE_ROW == query.step()) {
ModelType type = ModelIdToModelTypeEnum(query.column_blob(0),
query.column_bytes(0));
if (type != UNSPECIFIED) {
sync_pb::DataTypeProgressMarker progress_marker;
progress_marker.set_data_type_id(
GetExtensionFieldNumberFromModelType(type));
progress_marker.set_timestamp_token_for_migration(query.column_int64(1));
std::string progress_blob;
progress_marker.SerializeToString(&progress_blob);
sqlite_utils::SQLStatement update;
update.prepare(load_dbhandle_, "INSERT INTO models (model_id, "
"progress_marker, initial_sync_ended) VALUES (?, ?, ?)");
update.bind_blob(0, query.column_blob(0), query.column_bytes(0));
update.bind_blob(1, progress_blob.data(), progress_blob.length());
update.bind_bool(2, query.column_bool(2));
if (SQLITE_DONE != update.step())
return false;
}
}
SafeDropTable("temp_models");
SetVersion(75);
return true;
}
| 12,868
|
35,291
| 0
|
int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
{
int rc;
if (rxq < 1 || rxq > dev->num_rx_queues)
return -EINVAL;
if (dev->reg_state == NETREG_REGISTERED) {
ASSERT_RTNL();
rc = net_rx_queue_update_kobjects(dev, dev->real_num_rx_queues,
rxq);
if (rc)
return rc;
}
dev->real_num_rx_queues = rxq;
return 0;
}
| 12,869
|
12,640
| 0
|
chash_start(int type, void *base)
{
if (type == HMAC_MD5)
md5_start((md5 *)base);
else
sha1_start((sha1 *)base);
}
| 12,870
|
94,107
| 0
|
static u8 iwlagn_key_sta_id(struct iwl_priv *priv,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
u8 sta_id = IWL_INVALID_STATION;
if (sta)
sta_id = iwl_sta_id(sta);
/*
* The device expects GTKs for station interfaces to be
* installed as GTKs for the AP station. If we have no
* station ID, then use the ap_sta_id in that case.
*/
if (!sta && vif && vif_priv->ctx) {
switch (vif->type) {
case NL80211_IFTYPE_STATION:
sta_id = vif_priv->ctx->ap_sta_id;
break;
default:
/*
* In all other cases, the key will be
* used either for TX only or is bound
* to a station already.
*/
break;
}
}
return sta_id;
}
| 12,871
|
37,144
| 0
|
static void nested_release_page(struct page *page)
{
kvm_release_page_dirty(page);
}
| 12,872
|
168,936
| 0
|
void DevToolsAgentHostImpl::NotifyCreated() {
DCHECK(g_devtools_instances.Get().find(id_) ==
g_devtools_instances.Get().end());
g_devtools_instances.Get()[id_] = this;
for (auto& observer : g_devtools_observers.Get())
observer.DevToolsAgentHostCreated(this);
}
| 12,873
|
86,694
| 0
|
static void blk_mq_exit_hw_queues(struct request_queue *q,
struct blk_mq_tag_set *set, int nr_queue)
{
struct blk_mq_hw_ctx *hctx;
unsigned int i;
queue_for_each_hw_ctx(q, hctx, i) {
if (i == nr_queue)
break;
blk_mq_exit_hctx(q, set, hctx, i);
}
}
| 12,874
|
8,142
| 0
|
void Gfx::opSetFillCMYKColor(Object args[], int numArgs) {
GfxColor color;
int i;
if (textHaveCSPattern && drawText) {
GBool needFill = out->deviceHasTextClip(state);
out->endTextObject(state);
if (needFill) {
doPatternFill(gTrue);
}
out->restoreState(state);
}
state->setFillPattern(NULL);
state->setFillColorSpace(new GfxDeviceCMYKColorSpace());
out->updateFillColorSpace(state);
for (i = 0; i < 4; ++i) {
color.c[i] = dblToCol(args[i].getNum());
}
state->setFillColor(&color);
out->updateFillColor(state);
if (textHaveCSPattern) {
out->beginTextObject(state);
out->updateRender(state);
out->updateTextMat(state);
out->updateTextPos(state);
textHaveCSPattern = gFalse;
}
}
| 12,875
|
63,895
| 0
|
static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi,
struct buffer_head *bh)
{
struct f2fs_super_block *raw_super = (struct f2fs_super_block *)
(bh->b_data + F2FS_SUPER_OFFSET);
struct super_block *sb = sbi->sb;
u32 segment0_blkaddr = le32_to_cpu(raw_super->segment0_blkaddr);
u32 cp_blkaddr = le32_to_cpu(raw_super->cp_blkaddr);
u32 sit_blkaddr = le32_to_cpu(raw_super->sit_blkaddr);
u32 nat_blkaddr = le32_to_cpu(raw_super->nat_blkaddr);
u32 ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr);
u32 main_blkaddr = le32_to_cpu(raw_super->main_blkaddr);
u32 segment_count_ckpt = le32_to_cpu(raw_super->segment_count_ckpt);
u32 segment_count_sit = le32_to_cpu(raw_super->segment_count_sit);
u32 segment_count_nat = le32_to_cpu(raw_super->segment_count_nat);
u32 segment_count_ssa = le32_to_cpu(raw_super->segment_count_ssa);
u32 segment_count_main = le32_to_cpu(raw_super->segment_count_main);
u32 segment_count = le32_to_cpu(raw_super->segment_count);
u32 log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg);
u64 main_end_blkaddr = main_blkaddr +
(segment_count_main << log_blocks_per_seg);
u64 seg_end_blkaddr = segment0_blkaddr +
(segment_count << log_blocks_per_seg);
if (segment0_blkaddr != cp_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Mismatch start address, segment0(%u) cp_blkaddr(%u)",
segment0_blkaddr, cp_blkaddr);
return true;
}
if (cp_blkaddr + (segment_count_ckpt << log_blocks_per_seg) !=
sit_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Wrong CP boundary, start(%u) end(%u) blocks(%u)",
cp_blkaddr, sit_blkaddr,
segment_count_ckpt << log_blocks_per_seg);
return true;
}
if (sit_blkaddr + (segment_count_sit << log_blocks_per_seg) !=
nat_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Wrong SIT boundary, start(%u) end(%u) blocks(%u)",
sit_blkaddr, nat_blkaddr,
segment_count_sit << log_blocks_per_seg);
return true;
}
if (nat_blkaddr + (segment_count_nat << log_blocks_per_seg) !=
ssa_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Wrong NAT boundary, start(%u) end(%u) blocks(%u)",
nat_blkaddr, ssa_blkaddr,
segment_count_nat << log_blocks_per_seg);
return true;
}
if (ssa_blkaddr + (segment_count_ssa << log_blocks_per_seg) !=
main_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Wrong SSA boundary, start(%u) end(%u) blocks(%u)",
ssa_blkaddr, main_blkaddr,
segment_count_ssa << log_blocks_per_seg);
return true;
}
if (main_end_blkaddr > seg_end_blkaddr) {
f2fs_msg(sb, KERN_INFO,
"Wrong MAIN_AREA boundary, start(%u) end(%u) block(%u)",
main_blkaddr,
segment0_blkaddr +
(segment_count << log_blocks_per_seg),
segment_count_main << log_blocks_per_seg);
return true;
} else if (main_end_blkaddr < seg_end_blkaddr) {
int err = 0;
char *res;
/* fix in-memory information all the time */
raw_super->segment_count = cpu_to_le32((main_end_blkaddr -
segment0_blkaddr) >> log_blocks_per_seg);
if (f2fs_readonly(sb) || bdev_read_only(sb->s_bdev)) {
set_sbi_flag(sbi, SBI_NEED_SB_WRITE);
res = "internally";
} else {
err = __f2fs_commit_super(bh, NULL);
res = err ? "failed" : "done";
}
f2fs_msg(sb, KERN_INFO,
"Fix alignment : %s, start(%u) end(%u) block(%u)",
res, main_blkaddr,
segment0_blkaddr +
(segment_count << log_blocks_per_seg),
segment_count_main << log_blocks_per_seg);
if (err)
return true;
}
return false;
}
| 12,876
|
138,296
| 0
|
unsigned AXTableCell::ariaRowIndex() const {
const AtomicString& rowIndex = getAttribute(aria_rowindexAttr);
if (rowIndex.toInt() >= 1)
return rowIndex.toInt();
AXObject* parent = parentObjectUnignored();
if (!parent || !parent->isTableRow())
return 0;
return toAXTableRow(parent)->ariaRowIndex();
}
| 12,877
|
65,683
| 0
|
put_clnt_odstate(struct nfs4_clnt_odstate *co)
{
struct nfs4_file *fp;
if (!co)
return;
fp = co->co_file;
if (atomic_dec_and_lock(&co->co_odcount, &fp->fi_lock)) {
list_del(&co->co_perfile);
spin_unlock(&fp->fi_lock);
nfsd4_return_all_file_layouts(co->co_client, fp);
kmem_cache_free(odstate_slab, co);
}
}
| 12,878
|
42,404
| 0
|
static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared)
{
int err = 0;
struct block_device *bdev;
char b[BDEVNAME_SIZE];
bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
shared ? (struct md_rdev *)lock_rdev : rdev);
if (IS_ERR(bdev)) {
printk(KERN_ERR "md: could not open %s.\n",
__bdevname(dev, b));
return PTR_ERR(bdev);
}
rdev->bdev = bdev;
return err;
}
| 12,879
|
4,526
| 0
|
PHP_FUNCTION(openssl_encrypt)
{
zend_long options = 0;
char *data, *method, *password, *iv = "";
size_t 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, keylen;
size_t outlen;
zend_string *outbuf;
unsigned char *key;
zend_bool free_iv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) {
return;
}
cipher_type = EVP_get_cipherbyname(method);
if (!cipher_type) {
php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm");
RETURN_FALSE;
}
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data);
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(password_len, password);
cipher_ctx = EVP_CIPHER_CTX_new();
if (!cipher_ctx) {
php_error_docref(NULL, E_WARNING, "Failed to create cipher context");
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, 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);
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
outbuf = zend_string_alloc(outlen, 0);
EVP_EncryptInit(cipher_ctx, cipher_type, NULL, NULL);
if (password_len > keylen) {
EVP_CIPHER_CTX_set_key_length(cipher_ctx, (int)password_len);
}
EVP_EncryptInit_ex(cipher_ctx, NULL, NULL, key, (unsigned char *)iv);
if (options & OPENSSL_ZERO_PADDING) {
EVP_CIPHER_CTX_set_padding(cipher_ctx, 0);
}
if (data_len > 0) {
EVP_EncryptUpdate(cipher_ctx, (unsigned char*)ZSTR_VAL(outbuf), &i, (unsigned char *)data, (int)data_len);
}
outlen = i;
if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) {
outlen += i;
if (options & OPENSSL_RAW_DATA) {
ZSTR_VAL(outbuf)[outlen] = '\0';
ZSTR_LEN(outbuf) = outlen;
RETVAL_STR(outbuf);
} else {
zend_string *base64_str;
base64_str = php_base64_encode((unsigned char*)ZSTR_VAL(outbuf), outlen);
zend_string_release(outbuf);
RETVAL_STR(base64_str);
}
} else {
zend_string_release(outbuf);
RETVAL_FALSE;
}
if (key != (unsigned char*)password) {
efree(key);
}
if (free_iv) {
efree(iv);
}
EVP_CIPHER_CTX_free(cipher_ctx);
}
| 12,880
|
65,156
| 0
|
static int sctp_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
int rc;
rc = inet6_getname(sock, uaddr, uaddr_len, peer);
if (rc != 0)
return rc;
*uaddr_len = sctp_v6_addr_to_user(sctp_sk(sock->sk),
(union sctp_addr *)uaddr);
return rc;
}
| 12,881
|
8,288
| 0
|
XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes)
{
XRRScreenConfiguration *config;
XExtDisplayInfo *info = XRRFindDisplay(dpy);
XRRScreenSize *sizes;
LockDisplay(dpy);
if ((config = _XRRValidateCache(dpy, info, screen))) {
*nsizes = config->nsizes;
sizes = config->sizes;
UnlockDisplay(dpy);
return sizes;
}
else {
UnlockDisplay(dpy);
*nsizes = 0;
return NULL;
}
}
| 12,882
|
149,021
| 0
|
static int btreeInitPage(MemPage *pPage){
assert( pPage->pBt!=0 );
assert( pPage->pBt->db!=0 );
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
if( !pPage->isInit ){
int pc; /* Address of a freeblock within pPage->aData[] */
u8 hdr; /* Offset to beginning of page header */
u8 *data; /* Equal to pPage->aData */
BtShared *pBt; /* The main btree structure */
int usableSize; /* Amount of usable space on each page */
u16 cellOffset; /* Offset from start of page to first cell pointer */
int nFree; /* Number of unused bytes on the page */
int top; /* First byte of the cell content area */
int iCellFirst; /* First allowable cell or freeblock offset */
int iCellLast; /* Last possible cell or freeblock offset */
pBt = pPage->pBt;
hdr = pPage->hdrOffset;
data = pPage->aData;
/* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
** the b-tree page type. */
if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
pPage->maskPage = (u16)(pBt->pageSize - 1);
pPage->nOverflow = 0;
usableSize = pBt->usableSize;
pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
pPage->aDataEnd = &data[usableSize];
pPage->aCellIdx = &data[cellOffset];
pPage->aDataOfst = &data[pPage->childPtrSize];
/* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
** the start of the cell content area. A zero value for this integer is
** interpreted as 65536. */
top = get2byteNotZero(&data[hdr+5]);
/* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
** number of cells on the page. */
pPage->nCell = get2byte(&data[hdr+3]);
if( pPage->nCell>MX_CELL(pBt) ){
/* To many cells for a single page. The page must be corrupt */
return SQLITE_CORRUPT_BKPT;
}
testcase( pPage->nCell==MX_CELL(pBt) );
/* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
** possible for a root page of a table that contains no rows) then the
** offset to the cell content area will equal the page size minus the
** bytes of reserved space. */
assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
/* A malformed database page might cause us to read past the end
** of page when parsing a cell.
**
** The following block of code checks early to see if a cell extends
** past the end of a page boundary and causes SQLITE_CORRUPT to be
** returned if it does.
*/
iCellFirst = cellOffset + 2*pPage->nCell;
iCellLast = usableSize - 4;
if( pBt->db->flags & SQLITE_CellSizeCk ){
int i; /* Index into the cell pointer array */
int sz; /* Size of a cell */
if( !pPage->leaf ) iCellLast--;
for(i=0; i<pPage->nCell; i++){
pc = get2byteAligned(&data[cellOffset+i*2]);
testcase( pc==iCellFirst );
testcase( pc==iCellLast );
if( pc<iCellFirst || pc>iCellLast ){
return SQLITE_CORRUPT_BKPT;
}
sz = pPage->xCellSize(pPage, &data[pc]);
testcase( pc+sz==usableSize );
if( pc+sz>usableSize ){
return SQLITE_CORRUPT_BKPT;
}
}
if( !pPage->leaf ) iCellLast++;
}
/* Compute the total free space on the page
** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
** start of the first freeblock on the page, or is zero if there are no
** freeblocks. */
pc = get2byte(&data[hdr+1]);
nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
if( pc>0 ){
u32 next, size;
if( pc<iCellFirst ){
/* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
** always be at least one cell before the first freeblock.
*/
return SQLITE_CORRUPT_BKPT;
}
while( 1 ){
if( pc>iCellLast ){
return SQLITE_CORRUPT_BKPT; /* Freeblock off the end of the page */
}
next = get2byte(&data[pc]);
size = get2byte(&data[pc+2]);
nFree = nFree + size;
if( next<=pc+size+3 ) break;
pc = next;
}
if( next>0 ){
return SQLITE_CORRUPT_BKPT; /* Freeblock not in ascending order */
}
if( pc+size>(unsigned int)usableSize ){
return SQLITE_CORRUPT_BKPT; /* Last freeblock extends past page end */
}
}
/* At this point, nFree contains the sum of the offset to the start
** of the cell-content area plus the number of free bytes within
** the cell-content area. If this is greater than the usable-size
** of the page, then the page must be corrupted. This check also
** serves to verify that the offset to the start of the cell-content
** area, according to the page header, lies within the page.
*/
if( nFree>usableSize ){
return SQLITE_CORRUPT_BKPT;
}
pPage->nFree = (u16)(nFree - iCellFirst);
pPage->isInit = 1;
}
return SQLITE_OK;
}
| 12,883
|
155,242
| 0
|
void HTMLFormElement::reset() {
LocalFrame* frame = document().frame();
if (m_isInResetFunction || !frame)
return;
m_isInResetFunction = true;
if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset)) !=
DispatchEventResult::NotCanceled) {
m_isInResetFunction = false;
return;
}
const FormAssociatedElement::List& elements = associatedElements();
for (unsigned i = 0; i < elements.size(); ++i) {
if (elements[i]->isFormControlElement())
toHTMLFormControlElement(elements[i])->reset();
}
m_isInResetFunction = false;
}
| 12,884
|
61,104
| 0
|
nautilus_file_operations_copy_move (const GList *item_uris,
GArray *relative_item_points,
const char *target_dir,
GdkDragAction copy_action,
GtkWidget *parent_view,
NautilusCopyCallback done_callback,
gpointer done_callback_data)
{
GList *locations;
GList *p;
GFile *dest, *src_dir;
GtkWindow *parent_window;
gboolean target_is_mapping;
gboolean have_nonmapping_source;
dest = NULL;
target_is_mapping = FALSE;
have_nonmapping_source = FALSE;
if (target_dir)
{
dest = g_file_new_for_uri (target_dir);
if (g_file_has_uri_scheme (dest, "burn"))
{
target_is_mapping = TRUE;
}
}
locations = location_list_from_uri_list (item_uris);
for (p = locations; p != NULL; p = p->next)
{
if (!g_file_has_uri_scheme ((GFile * ) p->data, "burn"))
{
have_nonmapping_source = TRUE;
}
}
if (target_is_mapping && have_nonmapping_source && copy_action == GDK_ACTION_MOVE)
{
/* never move to "burn:///", but fall back to copy.
* This is a workaround, because otherwise the source files would be removed.
*/
copy_action = GDK_ACTION_COPY;
}
parent_window = NULL;
if (parent_view)
{
parent_window = (GtkWindow *) gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
if (copy_action == GDK_ACTION_COPY)
{
src_dir = g_file_get_parent (locations->data);
if (target_dir == NULL ||
(src_dir != NULL &&
g_file_equal (src_dir, dest)))
{
nautilus_file_operations_duplicate (locations,
relative_item_points,
parent_window,
done_callback, done_callback_data);
}
else
{
nautilus_file_operations_copy (locations,
relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
}
if (src_dir)
{
g_object_unref (src_dir);
}
}
else if (copy_action == GDK_ACTION_MOVE)
{
if (g_file_has_uri_scheme (dest, "trash"))
{
MoveTrashCBData *cb_data;
cb_data = g_slice_new0 (MoveTrashCBData);
cb_data->real_callback = done_callback;
cb_data->real_data = done_callback_data;
nautilus_file_operations_trash_or_delete (locations,
parent_window,
(NautilusDeleteCallback) callback_for_move_to_trash,
cb_data);
}
else
{
nautilus_file_operations_move (locations,
relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
}
}
else
{
nautilus_file_operations_link (locations,
relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
}
g_list_free_full (locations, g_object_unref);
if (dest)
{
g_object_unref (dest);
}
}
| 12,885
|
87,295
| 0
|
static MagickBooleanType TraceRoundRectangle(MVGInfo *mvg_info,
const PointInfo start,const PointInfo end,PointInfo arc)
{
PointInfo
degrees,
point,
segment;
PrimitiveInfo
*primitive_info;
register PrimitiveInfo
*p;
register ssize_t
i;
ssize_t
offset;
offset=mvg_info->offset;
segment.x=fabs(end.x-start.x);
segment.y=fabs(end.y-start.y);
if ((segment.x < MagickEpsilon) || (segment.y < MagickEpsilon))
{
(*mvg_info->primitive_info+mvg_info->offset)->coordinates=0;
return(MagickTrue);
}
if (arc.x > (0.5*segment.x))
arc.x=0.5*segment.x;
if (arc.y > (0.5*segment.y))
arc.y=0.5*segment.y;
point.x=start.x+segment.x-arc.x;
point.y=start.y+arc.y;
degrees.x=270.0;
degrees.y=360.0;
if (TraceEllipse(mvg_info,point,arc,degrees) == MagickFalse)
return(MagickFalse);
p=(*mvg_info->primitive_info)+mvg_info->offset;
mvg_info->offset+=p->coordinates;
point.x=start.x+segment.x-arc.x;
point.y=start.y+segment.y-arc.y;
degrees.x=0.0;
degrees.y=90.0;
if (TraceEllipse(mvg_info,point,arc,degrees) == MagickFalse)
return(MagickFalse);
p=(*mvg_info->primitive_info)+mvg_info->offset;
mvg_info->offset+=p->coordinates;
point.x=start.x+arc.x;
point.y=start.y+segment.y-arc.y;
degrees.x=90.0;
degrees.y=180.0;
if (TraceEllipse(mvg_info,point,arc,degrees) == MagickFalse)
return(MagickFalse);
p=(*mvg_info->primitive_info)+mvg_info->offset;
mvg_info->offset+=p->coordinates;
point.x=start.x+arc.x;
point.y=start.y+arc.y;
degrees.x=180.0;
degrees.y=270.0;
if (TraceEllipse(mvg_info,point,arc,degrees) == MagickFalse)
return(MagickFalse);
p=(*mvg_info->primitive_info)+mvg_info->offset;
mvg_info->offset+=p->coordinates;
if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)
return(MagickFalse);
p=(*mvg_info->primitive_info)+mvg_info->offset;
if (TracePoint(p,(*mvg_info->primitive_info+offset)->point) == MagickFalse)
return(MagickFalse);
p+=p->coordinates;
mvg_info->offset=offset;
primitive_info=(*mvg_info->primitive_info)+offset;
primitive_info->coordinates=(size_t) (p-primitive_info);
primitive_info->closed_subpath=MagickTrue;
for (i=0; i < (ssize_t) primitive_info->coordinates; i++)
{
p->primitive=primitive_info->primitive;
p--;
}
return(MagickTrue);
}
| 12,886
|
73,988
| 0
|
show_status (int dtr_up)
{
int baud, bits;
enum flowcntrl_e flow;
enum parity_e parity;
term_refresh(tty_fd);
baud = term_get_baudrate(tty_fd, NULL);
flow = term_get_flowcntrl(tty_fd);
parity = term_get_parity(tty_fd);
bits = term_get_databits(tty_fd);
fd_printf(STO, "\r\n");
if ( baud != opts.baud ) {
fd_printf(STO, "*** baud: %d (%d)\r\n", opts.baud, baud);
} else {
fd_printf(STO, "*** baud: %d\r\n", opts.baud);
}
if ( flow != opts.flow ) {
fd_printf(STO, "*** flow: %s (%s)\r\n",
flow_str[opts.flow], flow_str[flow]);
} else {
fd_printf(STO, "*** flow: %s\r\n", flow_str[opts.flow]);
}
if ( parity != opts.parity ) {
fd_printf(STO, "*** parity: %s (%s)\r\n",
parity_str[opts.parity], parity_str[parity]);
} else {
fd_printf(STO, "*** parity: %s\r\n", parity_str[opts.parity]);
}
if ( bits != opts.databits ) {
fd_printf(STO, "*** databits: %d (%d)\r\n", opts.databits, bits);
} else {
fd_printf(STO, "*** databits: %d\r\n", opts.databits);
}
fd_printf(STO, "*** dtr: %s\r\n", dtr_up ? "up" : "down");
}
| 12,887
|
162,308
| 0
|
SharedMemoryHandleProvider::Handle::Handle(SharedMemoryHandleProvider* owner)
: owner_(owner) {}
| 12,888
|
115,060
| 0
|
void TestingAutomationProvider::WaitForNotificationCount(
Browser* browser,
DictionaryValue* args,
IPC::Message* reply_message) {
int count;
if (!args->GetInteger("count", &count)) {
AutomationJSONReply(this, reply_message)
.SendError("'count' missing or invalid.");
return;
}
new OnNotificationBalloonCountObserver(this, reply_message, count);
}
| 12,889
|
95,758
| 0
|
qboolean FS_CheckDirTraversal(const char *checkdir)
{
if(strstr(checkdir, "../") || strstr(checkdir, "..\\"))
return qtrue;
return qfalse;
}
| 12,890
|
181,559
| 1
|
void iov_iter_pipe(struct iov_iter *i, int direction,
struct pipe_inode_info *pipe,
size_t count)
{
BUG_ON(direction != ITER_PIPE);
i->type = direction;
i->pipe = pipe;
i->idx = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1);
i->iov_offset = 0;
i->count = count;
}
| 12,891
|
47,480
| 0
|
static int ablk_dma_crypt(struct ablkcipher_request *areq)
{
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
struct cryp_ctx *ctx = crypto_ablkcipher_ctx(cipher);
struct cryp_device_data *device_data;
int bytes_written = 0;
int bytes_read = 0;
int ret;
pr_debug(DEV_DBG_NAME " [%s]", __func__);
ctx->datalen = areq->nbytes;
ctx->outlen = areq->nbytes;
ret = cryp_get_device_data(ctx, &device_data);
if (ret)
return ret;
ret = cryp_setup_context(ctx, device_data);
if (ret)
goto out;
/* We have the device now, so store the nents in the dma struct. */
ctx->device->dma.nents_src = get_nents(areq->src, ctx->datalen);
ctx->device->dma.nents_dst = get_nents(areq->dst, ctx->outlen);
/* Enable DMA in- and output. */
cryp_configure_for_dma(device_data, CRYP_DMA_ENABLE_BOTH_DIRECTIONS);
bytes_written = cryp_dma_write(ctx, areq->src, ctx->datalen);
bytes_read = cryp_dma_read(ctx, areq->dst, bytes_written);
wait_for_completion(&ctx->device->dma.cryp_dma_complete);
cryp_dma_done(ctx);
cryp_save_device_context(device_data, &ctx->dev_ctx, cryp_mode);
ctx->updated = 1;
out:
spin_lock(&device_data->ctx_lock);
device_data->current_ctx = NULL;
ctx->device = NULL;
spin_unlock(&device_data->ctx_lock);
/*
* The down_interruptible part for this semaphore is called in
* cryp_get_device_data.
*/
up(&driver_data.device_allocation);
if (unlikely(bytes_written != bytes_read))
return -EPERM;
return 0;
}
| 12,892
|
5,024
| 0
|
ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
int offset_day, long offset_sec, time_t *in_tm)
{
time_t t;
if (in_tm)
t = *in_tm;
else
time(&t);
if (s && !(s->flags & ASN1_STRING_FLAG_MSTRING)) {
if (s->type == V_ASN1_UTCTIME)
return ASN1_UTCTIME_adj(s, t, offset_day, offset_sec);
if (s->type == V_ASN1_GENERALIZEDTIME)
return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, offset_sec);
}
return ASN1_TIME_adj(s, t, offset_day, offset_sec);
}
| 12,893
|
175,956
| 0
|
void smp_send_pair_fail(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
p_cb->status = p_data->status;
p_cb->failure = p_data->status;
SMP_TRACE_DEBUG("%s: status=%d failure=%d ", __func__, p_cb->status,
p_cb->failure);
if (p_cb->status <= SMP_MAX_FAIL_RSN_PER_SPEC &&
p_cb->status != SMP_SUCCESS) {
smp_send_cmd(SMP_OPCODE_PAIRING_FAILED, p_cb);
p_cb->wait_for_authorization_complete = true;
}
}
| 12,894
|
51,921
| 0
|
get_key_string(decryption_key_t* dk)
{
gchar* output_string = NULL;
if(dk == NULL || dk->key == NULL)
return NULL;
switch(dk->type) {
case AIRPDCAP_KEY_TYPE_WEP:
output_string = g_strdup(dk->key->str);
break;
case AIRPDCAP_KEY_TYPE_WPA_PWD:
if(dk->ssid == NULL)
output_string = g_strdup(dk->key->str);
else
output_string = g_strdup_printf("%s:%s",
dk->key->str, format_uri(dk->ssid, ":"));
break;
case AIRPDCAP_KEY_TYPE_WPA_PMK:
output_string = g_strdup(dk->key->str);
break;
default:
return NULL;
}
return output_string;
}
| 12,895
|
114,266
| 0
|
GpuListenerInfo::~GpuListenerInfo() {
}
| 12,896
|
2,735
| 0
|
copy_attr_free (struct error_context *ctx, char const *str)
{
}
| 12,897
|
188,212
| 1
|
OMX_ERRORTYPE SoftAACEncoder2::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
case OMX_IndexParamAudioPortFormat:
{
OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
(OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
if (formatParams->nPortIndex > 1) {
return OMX_ErrorUndefined;
}
if (formatParams->nIndex > 0) {
return OMX_ErrorNoMore;
}
formatParams->eEncoding =
(formatParams->nPortIndex == 0)
? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingAAC;
return OMX_ErrorNone;
}
case OMX_IndexParamAudioAac:
{
OMX_AUDIO_PARAM_AACPROFILETYPE *aacParams =
(OMX_AUDIO_PARAM_AACPROFILETYPE *)params;
if (aacParams->nPortIndex != 1) {
return OMX_ErrorUndefined;
}
aacParams->nBitRate = mBitRate;
aacParams->nAudioBandWidth = 0;
aacParams->nAACtools = 0;
aacParams->nAACERtools = 0;
aacParams->eAACProfile = (OMX_AUDIO_AACPROFILETYPE) mAACProfile;
aacParams->eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;
aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo;
aacParams->nChannels = mNumChannels;
aacParams->nSampleRate = mSampleRate;
aacParams->nFrameLength = 0;
switch (mSBRMode) {
case 1: // sbr on
switch (mSBRRatio) {
case 0:
aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;
aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;
break;
case 1:
aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;
aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;
break;
case 2:
aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;
aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;
break;
default:
ALOGE("invalid SBR ratio %d", mSBRRatio);
TRESPASS();
}
break;
case 0: // sbr off
case -1: // sbr undefined
aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;
aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;
break;
default:
ALOGE("invalid SBR mode %d", mSBRMode);
TRESPASS();
}
return OMX_ErrorNone;
}
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
(OMX_AUDIO_PARAM_PCMMODETYPE *)params;
if (pcmParams->nPortIndex != 0) {
return OMX_ErrorUndefined;
}
pcmParams->eNumData = OMX_NumericalDataSigned;
pcmParams->eEndian = OMX_EndianBig;
pcmParams->bInterleaved = OMX_TRUE;
pcmParams->nBitPerSample = 16;
pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;
pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF;
pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF;
pcmParams->nChannels = mNumChannels;
pcmParams->nSamplingRate = mSampleRate;
return OMX_ErrorNone;
}
default:
return SimpleSoftOMXComponent::internalGetParameter(index, params);
}
}
| 12,898
|
19,532
| 0
|
static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
{
struct primaryVolDesc *pvoldesc;
struct ustr *instr, *outstr;
struct buffer_head *bh;
uint16_t ident;
int ret = 1;
instr = kmalloc(sizeof(struct ustr), GFP_NOFS);
if (!instr)
return 1;
outstr = kmalloc(sizeof(struct ustr), GFP_NOFS);
if (!outstr)
goto out1;
bh = udf_read_tagged(sb, block, block, &ident);
if (!bh)
goto out2;
BUG_ON(ident != TAG_IDENT_PVD);
pvoldesc = (struct primaryVolDesc *)bh->b_data;
if (udf_disk_stamp_to_time(&UDF_SB(sb)->s_record_time,
pvoldesc->recordingDateAndTime)) {
#ifdef UDFFS_DEBUG
struct timestamp *ts = &pvoldesc->recordingDateAndTime;
udf_debug("recording time %04u/%02u/%02u %02u:%02u (%x)\n",
le16_to_cpu(ts->year), ts->month, ts->day, ts->hour,
ts->minute, le16_to_cpu(ts->typeAndTimezone));
#endif
}
if (!udf_build_ustr(instr, pvoldesc->volIdent, 32))
if (udf_CS0toUTF8(outstr, instr)) {
strncpy(UDF_SB(sb)->s_volume_ident, outstr->u_name,
outstr->u_len > 31 ? 31 : outstr->u_len);
udf_debug("volIdent[] = '%s'\n",
UDF_SB(sb)->s_volume_ident);
}
if (!udf_build_ustr(instr, pvoldesc->volSetIdent, 128))
if (udf_CS0toUTF8(outstr, instr))
udf_debug("volSetIdent[] = '%s'\n", outstr->u_name);
brelse(bh);
ret = 0;
out2:
kfree(outstr);
out1:
kfree(instr);
return ret;
}
| 12,899
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.