unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
58,479 | 0 | _SSL_recv (SSL * ssl, char *buf, int len)
{
int num;
num = SSL_read (ssl, buf, len);
switch (SSL_get_error (ssl, num))
{
case SSL_ERROR_SSL:
/* ??? */
__SSL_fill_err_buf ("SSL_read");
fprintf (stderr, "%s\n", err_buf);
break;
case SSL_ERROR_SYSCALL:
/* ??? */
if (!would_block ())
perror ("SSL_read/read");
break;
case SSL_ERROR_ZERO_RETURN:
/* fprintf(stdeerr, "SSL closed on read\n"); */
break;
}
return (num);
}
| 15,500 |
85,312 | 0 | add_printer(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - URI of printer */
{
http_status_t status; /* Policy status */
int i; /* Looping var */
char scheme[HTTP_MAX_URI], /* Method portion of URI */
username[HTTP_MAX_URI], /* Username portion of URI */
host[HTTP_MAX_URI], /* Host portion of URI */
resource[HTTP_MAX_URI]; /* Resource portion of URI */
int port; /* Port portion of URI */
cupsd_printer_t *printer; /* Printer/class */
ipp_attribute_t *attr; /* Printer attribute */
cups_file_t *fp; /* Script/PPD file */
char line[1024]; /* Line from file... */
char srcfile[1024], /* Source Script/PPD file */
dstfile[1024]; /* Destination Script/PPD file */
int modify; /* Non-zero if we are modifying */
int changed_driver, /* Changed the PPD? */
need_restart_job, /* Need to restart job? */
set_device_uri, /* Did we set the device URI? */
set_port_monitor; /* Did we set the port monitor? */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer(%p[%d], %s)", con,
con->number, uri->values[0].string.text);
/*
* Do we have a valid URI?
*/
httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
if (strncmp(resource, "/printers/", 10) || strlen(resource) == 10)
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri must be of the form "
"\"ipp://HOSTNAME/printers/PRINTERNAME\"."));
return;
}
/*
* Do we have a valid printer name?
*/
if (!validate_name(resource + 10))
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri \"%s\" contains invalid characters."),
uri->values[0].string.text);
return;
}
/*
* See if the printer already exists; if not, create a new printer...
*/
if ((printer = cupsdFindPrinter(resource + 10)) == NULL)
{
/*
* Printer doesn't exist; see if we have a class of the same name...
*/
if ((printer = cupsdFindClass(resource + 10)) != NULL)
{
/*
* Yes, return an error...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("A class named \"%s\" already exists."),
resource + 10);
return;
}
/*
* No, check the default policy then add the printer...
*/
if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK)
{
send_http_error(con, status, NULL);
return;
}
printer = cupsdAddPrinter(resource + 10);
modify = 0;
}
else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con,
NULL)) != HTTP_OK)
{
send_http_error(con, status, printer);
return;
}
else
modify = 1;
/*
* Look for attributes and copy them over as needed...
*/
changed_driver = 0;
need_restart_job = 0;
if ((attr = ippFindAttribute(con->request, "printer-is-temporary", IPP_TAG_BOOLEAN)) != NULL)
printer->temporary = ippGetBoolean(attr, 0);
if ((attr = ippFindAttribute(con->request, "printer-location",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-geo-location", IPP_TAG_URI)) != NULL && !strncmp(attr->values[0].string.text, "geo:", 4))
cupsdSetString(&printer->geo_location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organization", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organization, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organizational-unit", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organizational_unit, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-info",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->info, attr->values[0].string.text);
set_device_uri = 0;
if ((attr = ippFindAttribute(con->request, "device-uri",
IPP_TAG_URI)) != NULL)
{
/*
* Do we have a valid device URI?
*/
http_uri_status_t uri_status; /* URI separation status */
char old_device_uri[1024];
/* Old device URI */
need_restart_job = 1;
uri_status = httpSeparateURI(HTTP_URI_CODING_ALL,
attr->values[0].string.text,
scheme, sizeof(scheme),
username, sizeof(username),
host, sizeof(host), &port,
resource, sizeof(resource));
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s device-uri: %s", printer->name, httpURIStatusString(uri_status));
if (uri_status < HTTP_URI_OK)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (!strcmp(scheme, "file"))
{
/*
* See if the administrator has enabled file devices...
*/
if (!FileDevice && strcmp(resource, "/dev/null"))
{
/*
* File devices are disabled and the URL is not file:/dev/null...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("File device URIs have been disabled. "
"To enable, see the FileDevice directive in "
"\"%s/cups-files.conf\"."),
ServerRoot);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
else
{
/*
* See if the backend exists and is executable...
*/
snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin, scheme);
if (access(srcfile, X_OK))
{
/*
* Could not find device in list!
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Bad device-uri scheme \"%s\"."), scheme);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
if (printer->sanitized_device_uri)
strlcpy(old_device_uri, printer->sanitized_device_uri,
sizeof(old_device_uri));
else
old_device_uri[0] = '\0';
cupsdSetDeviceURI(printer, attr->values[0].string.text);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s device-uri to \"%s\" (was \"%s\".)",
printer->name, printer->sanitized_device_uri,
old_device_uri);
set_device_uri = 1;
}
set_port_monitor = 0;
if ((attr = ippFindAttribute(con->request, "port-monitor",
IPP_TAG_NAME)) != NULL)
{
ipp_attribute_t *supported; /* port-monitor-supported attribute */
need_restart_job = 1;
supported = ippFindAttribute(printer->ppd_attrs, "port-monitor-supported",
IPP_TAG_NAME);
if (supported)
{
for (i = 0; i < supported->num_values; i ++)
if (!strcmp(supported->values[i].string.text,
attr->values[0].string.text))
break;
}
if (!supported || i >= supported->num_values)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, attr->values[0].string.text,
printer->port_monitor ? printer->port_monitor : "none");
if (strcmp(attr->values[0].string.text, "none"))
cupsdSetString(&printer->port_monitor, attr->values[0].string.text);
else
cupsdClearString(&printer->port_monitor);
set_port_monitor = 1;
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs",
IPP_TAG_BOOLEAN)) != NULL &&
attr->values[0].boolean != printer->accepting)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-accepting-jobs to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->accepting);
printer->accepting = attr->values[0].boolean;
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"%s accepting jobs.",
printer->accepting ? "Now" : "No longer");
}
if ((attr = ippFindAttribute(con->request, "printer-is-shared", IPP_TAG_BOOLEAN)) != NULL)
{
if (ippGetBoolean(attr, 0) &&
printer->num_auth_info_required == 1 &&
!strcmp(printer->auth_info_required[0], "negotiate"))
{
send_ipp_status(con, IPP_BAD_REQUEST,
_("Cannot share a remote Kerberized printer."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->type & CUPS_PRINTER_REMOTE)
{
/*
* Cannot re-share remote printers.
*/
send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->shared && !ippGetBoolean(attr, 0))
cupsdDeregisterPrinter(printer, 1);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-shared to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->shared);
printer->shared = ippGetBoolean(attr, 0);
if (printer->shared && printer->temporary)
printer->temporary = 0;
}
if ((attr = ippFindAttribute(con->request, "printer-state",
IPP_TAG_ENUM)) != NULL)
{
if (attr->values[0].integer != IPP_PRINTER_IDLE &&
attr->values[0].integer != IPP_PRINTER_STOPPED)
{
send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d."),
attr->values[0].integer);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-state to %d (was %d.)",
printer->name, attr->values[0].integer, printer->state);
if (attr->values[0].integer == IPP_PRINTER_STOPPED)
cupsdStopPrinter(printer, 0);
else
{
need_restart_job = 1;
cupsdSetPrinterState(printer, (ipp_pstate_t)(attr->values[0].integer), 0);
}
}
if ((attr = ippFindAttribute(con->request, "printer-state-message",
IPP_TAG_TEXT)) != NULL)
{
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
printer->state_message);
}
if ((attr = ippFindAttribute(con->request, "printer-state-reasons",
IPP_TAG_KEYWORD)) != NULL)
{
if (attr->num_values >
(int)(sizeof(printer->reasons) / sizeof(printer->reasons[0])))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Too many printer-state-reasons values (%d > %d)."),
attr->num_values,
(int)(sizeof(printer->reasons) /
sizeof(printer->reasons[0])));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
for (i = 0; i < printer->num_reasons; i ++)
_cupsStrFree(printer->reasons[i]);
printer->num_reasons = 0;
for (i = 0; i < attr->num_values; i ++)
{
if (!strcmp(attr->values[i].string.text, "none"))
continue;
printer->reasons[printer->num_reasons] =
_cupsStrRetain(attr->values[i].string.text);
printer->num_reasons ++;
if (!strcmp(attr->values[i].string.text, "paused") &&
printer->state != IPP_PRINTER_STOPPED)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-state to %d (was %d.)",
printer->name, IPP_PRINTER_STOPPED, printer->state);
cupsdStopPrinter(printer, 0);
}
}
if (PrintcapFormat == PRINTCAP_PLIST)
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"Printer \"%s\" state changed.", printer->name);
}
if (!set_printer_defaults(con, printer))
{
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if ((attr = ippFindAttribute(con->request, "auth-info-required",
IPP_TAG_KEYWORD)) != NULL)
cupsdSetAuthInfoRequired(printer, NULL, attr);
/*
* See if we have all required attributes...
*/
if (!printer->device_uri)
cupsdSetString(&printer->device_uri, "file:///dev/null");
/*
* See if we have a PPD file attached to the request...
*/
if (con->filename)
{
need_restart_job = 1;
changed_driver = 1;
strlcpy(srcfile, con->filename, sizeof(srcfile));
if ((fp = cupsFileOpen(srcfile, "rb")))
{
/*
* Yes; get the first line from it...
*/
line[0] = '\0';
cupsFileGets(fp, line, sizeof(line));
cupsFileClose(fp);
/*
* Then see what kind of file it is...
*/
if (strncmp(line, "*PPD-Adobe", 10))
{
send_ipp_status(con, IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED, _("Bad PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
/*
* The new file is a PPD file, so move the file over to the ppd
* directory...
*/
if (copy_file(srcfile, dstfile, ConfigFilePerm))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file - %s"), strerror(errno));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
else if ((attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL)
{
const char *ppd_name = ippGetString(attr, 0, NULL);
/* ppd-name value */
need_restart_job = 1;
changed_driver = 1;
if (!strcmp(ppd_name, "raw"))
{
/*
* Raw driver, remove any existing PPD file.
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
unlink(dstfile);
}
else if (strstr(ppd_name, "../"))
{
send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
else
{
/*
* PPD model file...
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
if (copy_model(con, ppd_name, dstfile))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
if (changed_driver)
{
/*
* If we changed the PPD, then remove the printer's cache file and clear the
* printer-state-reasons...
*/
char cache_name[1024]; /* Cache filename for printer attrs */
snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, printer->name);
unlink(cache_name);
cupsdSetPrinterReasons(printer, "none");
/*
* (Re)register color profiles...
*/
cupsdRegisterColor(printer);
}
/*
* If we set the device URI but not the port monitor, check which port
* monitor to use by default...
*/
if (set_device_uri && !set_port_monitor)
{
ppd_file_t *ppd; /* PPD file */
ppd_attr_t *ppdattr; /* cupsPortMonitor attribute */
httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
snprintf(srcfile, sizeof(srcfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
if ((ppd = _ppdOpenFile(srcfile, _PPD_LOCALIZATION_NONE)) != NULL)
{
for (ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL);
ppdattr;
ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL))
if (!strcmp(scheme, ppdattr->spec))
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, ppdattr->value,
printer->port_monitor ? printer->port_monitor
: "none");
if (strcmp(ppdattr->value, "none"))
cupsdSetString(&printer->port_monitor, ppdattr->value);
else
cupsdClearString(&printer->port_monitor);
break;
}
ppdClose(ppd);
}
}
printer->config_time = time(NULL);
/*
* Update the printer attributes and return...
*/
cupsdSetPrinterAttrs(printer);
if (!printer->temporary)
cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
if (need_restart_job && printer->job)
{
/*
* Restart the current job...
*/
cupsdSetJobState(printer->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
"Job restarted because the printer was modified.");
}
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
if (modify)
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
printer, NULL, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
}
else
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
}
con->response->request.status.status_code = IPP_OK;
}
| 15,501 |
46,457 | 0 | krb5_recvauth_version(krb5_context context,
krb5_auth_context *auth_context,
/* IN */
krb5_pointer fd,
krb5_principal server,
krb5_int32 flags,
krb5_keytab keytab,
/* OUT */
krb5_ticket **ticket,
krb5_data *version)
{
return recvauth_common (context, auth_context, fd, 0,
server, flags, keytab, ticket, version);
}
| 15,502 |
143,240 | 0 | void Document::postInspectorTask(const WebTraceLocation& location, std::unique_ptr<ExecutionContextTask> task)
{
m_taskRunner->postInspectorTask(location, std::move(task));
}
| 15,503 |
122,253 | 0 | void HTMLFormControlElement::ancestorDisabledStateWasChanged()
{
m_ancestorDisabledState = AncestorDisabledStateUnknown;
disabledAttributeChanged();
}
| 15,504 |
107,031 | 0 | void QQuickWebView::mousePressEvent(QMouseEvent* event)
{
Q_D(QQuickWebView);
forceActiveFocus();
d->pageView->eventHandler()->handleMousePressEvent(event);
}
| 15,505 |
30,337 | 0 | static int vsock_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
int err;
struct sock *sk;
struct vsock_sock *vsk;
struct sockaddr_vm *remote_addr;
if (msg->msg_flags & MSG_OOB)
return -EOPNOTSUPP;
/* For now, MSG_DONTWAIT is always assumed... */
err = 0;
sk = sock->sk;
vsk = vsock_sk(sk);
lock_sock(sk);
if (!vsock_addr_bound(&vsk->local_addr)) {
struct sockaddr_vm local_addr;
vsock_addr_init(&local_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY);
err = __vsock_bind(sk, &local_addr);
if (err != 0)
goto out;
}
/* If the provided message contains an address, use that. Otherwise
* fall back on the socket's remote handle (if it has been connected).
*/
if (msg->msg_name &&
vsock_addr_cast(msg->msg_name, msg->msg_namelen,
&remote_addr) == 0) {
/* Ensure this address is of the right type and is a valid
* destination.
*/
if (remote_addr->svm_cid == VMADDR_CID_ANY)
remote_addr->svm_cid = transport->get_local_cid();
if (!vsock_addr_bound(remote_addr)) {
err = -EINVAL;
goto out;
}
} else if (sock->state == SS_CONNECTED) {
remote_addr = &vsk->remote_addr;
if (remote_addr->svm_cid == VMADDR_CID_ANY)
remote_addr->svm_cid = transport->get_local_cid();
/* XXX Should connect() or this function ensure remote_addr is
* bound?
*/
if (!vsock_addr_bound(&vsk->remote_addr)) {
err = -EINVAL;
goto out;
}
} else {
err = -EINVAL;
goto out;
}
if (!transport->dgram_allow(remote_addr->svm_cid,
remote_addr->svm_port)) {
err = -EINVAL;
goto out;
}
err = transport->dgram_enqueue(vsk, remote_addr, msg->msg_iov, len);
out:
release_sock(sk);
return err;
}
| 15,506 |
131,610 | 0 | static void raisesExceptionGetterLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
ExceptionState exceptionState(ExceptionState::GetterContext, "raisesExceptionGetterLongAttribute", "TestObjectPython", info.Holder(), info.GetIsolate());
int jsValue = imp->raisesExceptionGetterLongAttribute(exceptionState);
if (UNLIKELY(exceptionState.throwIfNeeded()))
return;
v8SetReturnValueInt(info, jsValue);
}
| 15,507 |
61,317 | 0 | static void close_input_file(InputFile *ifile)
{
int i;
/* close decoder for each stream */
for (i = 0; i < ifile->nb_streams; i++)
if (ifile->streams[i].st->codecpar->codec_id != AV_CODEC_ID_NONE)
avcodec_free_context(&ifile->streams[i].dec_ctx);
av_freep(&ifile->streams);
ifile->nb_streams = 0;
avformat_close_input(&ifile->fmt_ctx);
}
| 15,508 |
120,463 | 0 | static void checkForEmptyStyleChange(Element* element, RenderStyle* style)
{
if (!style && !element->styleAffectedByEmpty())
return;
if (!style || (element->styleAffectedByEmpty() && (!style->emptyState() || element->hasChildNodes())))
element->setNeedsStyleRecalc();
}
| 15,509 |
27,237 | 0 | arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
unsigned long limit)
{
struct vm_area_struct *vma = find_vma(current->mm, addr);
while (1) {
/* At this point: (!vma || addr < vma->vm_end). */
if (limit - len < addr)
return -ENOMEM;
if (!vma || addr + len <= vma->vm_start)
return addr;
addr = vma->vm_end;
vma = vma->vm_next;
}
}
| 15,510 |
112,160 | 0 | DictionaryValue* AppSpecificsToValue(
const sync_pb::AppSpecifics& proto) {
DictionaryValue* value = new DictionaryValue();
SET(extension, ExtensionSpecificsToValue);
SET(notification_settings, AppSettingsToValue);
SET_STR(app_launch_ordinal);
SET_STR(page_ordinal);
return value;
}
| 15,511 |
111,299 | 0 | void WebPage::removeCompositingThreadOverlay(WebOverlay* overlay)
{
#if USE(ACCELERATED_COMPOSITING)
ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread());
if (d->compositor())
d->compositor()->removeOverlay(overlay->d->layerCompositingThread());
overlay->d->clear();
overlay->d->setPage(0);
#endif
}
| 15,512 |
123,058 | 0 | void RenderWidgetHostImpl::SetInputMethodActive(bool activate) {
Send(new ViewMsg_SetInputMethodActive(GetRoutingID(), activate));
}
| 15,513 |
82,887 | 0 | static int bin_pe_parse_imports(struct PE_(r_bin_pe_obj_t)* bin,
struct r_bin_pe_import_t** importp, int* nimp,
const char* dll_name,
PE_DWord OriginalFirstThunk,
PE_DWord FirstThunk) {
char import_name[PE_NAME_LENGTH + 1];
char name[PE_NAME_LENGTH + 1];
PE_Word import_hint, import_ordinal = 0;
PE_DWord import_table = 0, off = 0;
int i = 0, len;
Sdb* db = NULL;
char* sdb_module = NULL;
char* symname;
char* filename;
char* symdllname = NULL;
if (!dll_name || *dll_name == '0') {
return 0;
}
if (!(off = bin_pe_rva_to_paddr (bin, OriginalFirstThunk)) &&
!(off = bin_pe_rva_to_paddr (bin, FirstThunk))) {
return 0;
}
do {
if (import_ordinal >= UT16_MAX) {
break;
}
if (off + i * sizeof(PE_DWord) > bin->size) {
break;
}
len = r_buf_read_at (bin->b, off + i * sizeof (PE_DWord), (ut8*) &import_table, sizeof (PE_DWord));
if (len != sizeof (PE_DWord)) {
bprintf ("Warning: read (import table)\n");
goto error;
} else if (import_table) {
if (import_table & ILT_MASK1) {
import_ordinal = import_table & ILT_MASK2;
import_hint = 0;
snprintf (import_name, PE_NAME_LENGTH, "%s_Ordinal_%i", dll_name, import_ordinal);
free (symdllname);
strncpy (name, dll_name, sizeof (name) - 1);
name[sizeof(name) - 1] = 0;
symdllname = strdup (name);
size_t len = strlen (symdllname);
r_str_case (symdllname, 0);
len = len < 4? 0: len - 4;
symdllname[len] = 0;
if (!sdb_module || strcmp (symdllname, sdb_module)) {
sdb_free (db);
if (db) {
sdb_free (db);
}
db = NULL;
free (sdb_module);
sdb_module = strdup (symdllname);
filename = sdb_fmt ("%s.sdb", symdllname);
if (r_file_exists (filename)) {
db = sdb_new (NULL, filename, 0);
} else {
#if __WINDOWS__
char invoke_dir[MAX_PATH];
if (r_sys_get_src_dir_w32 (invoke_dir)) {
filename = sdb_fmt ("%s\\share\\radare2\\"R2_VERSION "\\format\\dll\\%s.sdb", invoke_dir, symdllname);
} else {
filename = sdb_fmt ("share/radare2/"R2_VERSION "/format/dll/%s.sdb", symdllname);
}
#else
const char *dirPrefix = r_sys_prefix (NULL);
filename = sdb_fmt ("%s/share/radare2/" R2_VERSION "/format/dll/%s.sdb", dirPrefix, symdllname);
#endif
if (r_file_exists (filename)) {
db = sdb_new (NULL, filename, 0);
}
}
}
if (db) {
symname = resolveModuleOrdinal (db, symdllname, import_ordinal);
if (symname) {
snprintf (import_name, PE_NAME_LENGTH, "%s_%s", dll_name, symname);
R_FREE (symname);
}
} else {
bprintf ("Cannot find %s\n", filename);
}
} else {
import_ordinal++;
const ut64 off = bin_pe_rva_to_paddr (bin, import_table);
if (off > bin->size || (off + sizeof (PE_Word)) > bin->size) {
bprintf ("Warning: off > bin->size\n");
goto error;
}
len = r_buf_read_at (bin->b, off, (ut8*) &import_hint, sizeof (PE_Word));
if (len != sizeof (PE_Word)) {
bprintf ("Warning: read import hint at 0x%08"PFMT64x "\n", off);
goto error;
}
name[0] = '\0';
len = r_buf_read_at (bin->b, off + sizeof(PE_Word), (ut8*) name, PE_NAME_LENGTH);
if (len < 1) {
bprintf ("Warning: read (import name)\n");
goto error;
} else if (!*name) {
break;
}
name[PE_NAME_LENGTH] = '\0';
snprintf (import_name, PE_NAME_LENGTH, "%s_%s", dll_name, name);
}
if (!(*importp = realloc (*importp, (*nimp + 1) * sizeof(struct r_bin_pe_import_t)))) {
r_sys_perror ("realloc (import)");
goto error;
}
memcpy ((*importp)[*nimp].name, import_name, PE_NAME_LENGTH);
(*importp)[*nimp].name[PE_NAME_LENGTH] = '\0';
(*importp)[*nimp].vaddr = bin_pe_rva_to_va (bin, FirstThunk + i * sizeof (PE_DWord));
(*importp)[*nimp].paddr = bin_pe_rva_to_paddr (bin, FirstThunk) + i * sizeof(PE_DWord);
(*importp)[*nimp].hint = import_hint;
(*importp)[*nimp].ordinal = import_ordinal;
(*importp)[*nimp].last = 0;
(*nimp)++;
i++;
}
} while (import_table);
if (db) {
sdb_free (db);
db = NULL;
}
free (symdllname);
free (sdb_module);
return i;
error:
if (db) {
sdb_free (db);
db = NULL;
}
free (symdllname);
free (sdb_module);
return false;
}
| 15,514 |
135,946 | 0 | bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
{
if (!layoutObject())
return false;
LayoutObject* o = layoutObject();
if (!o->isInline() || o->isReplaced()) {
LayoutBox* box = toLayoutBox(o);
point = o->localToAbsolute(FloatPoint(box->size()), UseTransforms);
return true;
}
LayoutObject* startContinuation = nullptr;
while (o) {
if (LayoutObject* oLastChild = o->slowLastChild()) {
o = oLastChild;
} else if (o != layoutObject() && o->previousSibling()) {
o = o->previousSibling();
} else {
LayoutObject* prev = nullptr;
while (!prev) {
if (startContinuation == o) {
startContinuation = nullptr;
} else if (!startContinuation) {
if (LayoutObject* continuation = endOfContinuations(o)) {
startContinuation = o;
prev = continuation;
break;
}
}
if (o == layoutObject()) {
return false;
}
o = o->parent();
if (!o)
return false;
prev = o->previousSibling();
}
o = prev;
}
ASSERT(o);
if (o->isText() || o->isReplaced()) {
point = FloatPoint();
if (o->isText()) {
LayoutText* text = toLayoutText(o);
IntRect linesBox = text->linesBoundingBox();
if (!linesBox.maxX() && !linesBox.maxY())
continue;
point.moveBy(linesBox.maxXMaxYCorner());
point = o->localToAbsolute(point, UseTransforms);
} else {
LayoutBox* box = toLayoutBox(o);
point.moveBy(box->frameRect().maxXMaxYCorner());
point = o->container()->localToAbsolute(point, UseTransforms);
}
return true;
}
}
return true;
}
| 15,515 |
73,876 | 0 | static int __einj_get_available_error_type(u32 *type)
{
struct apei_exec_context ctx;
int rc;
einj_exec_ctx_init(&ctx);
rc = apei_exec_run(&ctx, ACPI_EINJ_GET_ERROR_TYPE);
if (rc)
return rc;
*type = apei_exec_ctx_get_output(&ctx);
return 0;
}
| 15,516 |
128,936 | 0 | void doWriteNumber(double number)
{
append(reinterpret_cast<uint8_t*>(&number), sizeof(number));
}
| 15,517 |
53,756 | 0 | static int fixed_mtrr_seg_unit_range_index(int seg, int unit)
{
struct fixed_mtrr_segment *mtrr_seg = &fixed_seg_table[seg];
WARN_ON(mtrr_seg->start + unit * fixed_mtrr_seg_unit_size(seg)
> mtrr_seg->end);
/* each unit has 8 ranges. */
return mtrr_seg->range_start + 8 * unit;
}
| 15,518 |
69,656 | 0 | choose_guard_selection(const or_options_t *options,
const networkstatus_t *live_ns,
const guard_selection_t *old_selection,
guard_selection_type_t *type_out)
{
tor_assert(options);
tor_assert(type_out);
if (options->UseBridges) {
*type_out = GS_TYPE_BRIDGE;
return "bridges";
}
if (! live_ns) {
/* without a networkstatus, we can't tell any more than that. */
*type_out = GS_TYPE_NORMAL;
return "default";
}
const smartlist_t *nodes = nodelist_get_list();
int n_guards = 0, n_passing_filter = 0;
SMARTLIST_FOREACH_BEGIN(nodes, const node_t *, node) {
if (node_is_possible_guard(node)) {
++n_guards;
if (node_passes_guard_filter(options, node)) {
++n_passing_filter;
}
}
} SMARTLIST_FOREACH_END(node);
/* We use separate 'high' and 'low' thresholds here to prevent flapping
* back and forth */
const int meaningful_threshold_high =
(int)(n_guards * get_meaningful_restriction_threshold() * 1.05);
const int meaningful_threshold_mid =
(int)(n_guards * get_meaningful_restriction_threshold());
const int meaningful_threshold_low =
(int)(n_guards * get_meaningful_restriction_threshold() * .95);
const int extreme_threshold =
(int)(n_guards * get_extreme_restriction_threshold());
/*
If we have no previous selection, then we're "restricted" iff we are
below the meaningful restriction threshold. That's easy enough.
But if we _do_ have a previous selection, we make it a little
"sticky": we only move from "restricted" to "default" when we find
that we're above the threshold plus 5%, and we only move from
"default" to "restricted" when we're below the threshold minus 5%.
That should prevent us from flapping back and forth if we happen to
be hovering very close to the default.
The extreme threshold is for warning only.
*/
static int have_warned_extreme_threshold = 0;
if (n_guards &&
n_passing_filter < extreme_threshold &&
! have_warned_extreme_threshold) {
have_warned_extreme_threshold = 1;
const double exclude_frac =
(n_guards - n_passing_filter) / (double)n_guards;
log_warn(LD_GUARD, "Your configuration excludes %d%% of all possible "
"guards. That's likely to make you stand out from the "
"rest of the world.", (int)(exclude_frac * 100));
}
/* Easy case: no previous selection. Just check if we are in restricted or
normal guard selection. */
if (old_selection == NULL) {
if (n_passing_filter >= meaningful_threshold_mid) {
*type_out = GS_TYPE_NORMAL;
return "default";
} else {
*type_out = GS_TYPE_RESTRICTED;
return "restricted";
}
}
/* Trickier case: we do have a previous guard selection context. */
tor_assert(old_selection);
/* Use high and low thresholds to decide guard selection, and if we fall in
the middle then keep the current guard selection context. */
if (n_passing_filter >= meaningful_threshold_high) {
*type_out = GS_TYPE_NORMAL;
return "default";
} else if (n_passing_filter < meaningful_threshold_low) {
*type_out = GS_TYPE_RESTRICTED;
return "restricted";
} else {
/* we are in the middle: maintain previous guard selection */
*type_out = old_selection->type;
return old_selection->name;
}
}
| 15,519 |
70,178 | 0 | static void TIFFReadDirEntryCheckedSbyte(TIFF* tif, TIFFDirEntry* direntry, int8* value)
{
(void) tif;
*value=*(int8*)(&direntry->tdir_offset);
}
| 15,520 |
17,042 | 0 | void OxideQQuickWebViewPrivate::LoadingChanged() {
Q_Q(OxideQQuickWebView);
emit q->loadingStateChanged();
}
| 15,521 |
84,854 | 0 | static int copy_everything_to_user(struct ebt_table *t, void __user *user,
const int *len, int cmd)
{
struct ebt_replace tmp;
const struct ebt_counter *oldcounters;
unsigned int entries_size, nentries;
int ret;
char *entries;
if (cmd == EBT_SO_GET_ENTRIES) {
entries_size = t->private->entries_size;
nentries = t->private->nentries;
entries = t->private->entries;
oldcounters = t->private->counters;
} else {
entries_size = t->table->entries_size;
nentries = t->table->nentries;
entries = t->table->entries;
oldcounters = t->table->counters;
}
if (copy_from_user(&tmp, user, sizeof(tmp)))
return -EFAULT;
if (*len != sizeof(struct ebt_replace) + entries_size +
(tmp.num_counters ? nentries * sizeof(struct ebt_counter) : 0))
return -EINVAL;
if (tmp.nentries != nentries) {
BUGPRINT("Nentries wrong\n");
return -EINVAL;
}
if (tmp.entries_size != entries_size) {
BUGPRINT("Wrong size\n");
return -EINVAL;
}
ret = copy_counters_to_user(t, oldcounters, tmp.counters,
tmp.num_counters, nentries);
if (ret)
return ret;
/* set the match/watcher/target names right */
return EBT_ENTRY_ITERATE(entries, entries_size,
ebt_entry_to_user, entries, tmp.entries);
}
| 15,522 |
151,191 | 0 | bool LoadsFromCacheOnly(const ResourceRequest& request) {
switch (request.GetCachePolicy()) {
case WebCachePolicy::kUseProtocolCachePolicy:
case WebCachePolicy::kValidatingCacheData:
case WebCachePolicy::kBypassingCache:
case WebCachePolicy::kReturnCacheDataElseLoad:
return false;
case WebCachePolicy::kReturnCacheDataDontLoad:
case WebCachePolicy::kReturnCacheDataIfValid:
case WebCachePolicy::kBypassCacheLoadOnlyFromCache:
return true;
}
NOTREACHED();
return false;
}
| 15,523 |
159,043 | 0 | void ChromeDownloadManagerDelegate::CheckClientDownloadDone(
uint32_t download_id,
safe_browsing::DownloadCheckResult result) {
DownloadItem* item = download_manager_->GetDownload(download_id);
if (!item || (item->GetState() != DownloadItem::IN_PROGRESS))
return;
DVLOG(2) << __func__ << "() download = " << item->DebugString(false)
<< " verdict = " << static_cast<int>(result);
if (item->GetDangerType() == content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS ||
item->GetDangerType() ==
content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT) {
content::DownloadDangerType danger_type =
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS;
switch (result) {
case safe_browsing::DownloadCheckResult::UNKNOWN:
if (DownloadItemModel(item).GetDangerLevel() !=
DownloadFileType::NOT_DANGEROUS) {
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE;
UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason",
SB_RETURNS_UNKOWN,
DANGEROUS_FILE_REASON_MAX);
}
break;
case safe_browsing::DownloadCheckResult::SAFE:
if (DownloadItemModel(item).GetDangerLevel() ==
DownloadFileType::DANGEROUS) {
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE;
UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason",
SB_RETURNS_SAFE, DANGEROUS_FILE_REASON_MAX);
}
break;
case safe_browsing::DownloadCheckResult::DANGEROUS:
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT;
break;
case safe_browsing::DownloadCheckResult::UNCOMMON:
danger_type = content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT;
break;
case safe_browsing::DownloadCheckResult::DANGEROUS_HOST:
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST;
break;
case safe_browsing::DownloadCheckResult::POTENTIALLY_UNWANTED:
danger_type = content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED;
break;
}
DCHECK_NE(danger_type,
content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT);
if (danger_type != content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) {
if (ShouldBlockFile(danger_type)) {
item->OnContentCheckCompleted(
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED);
} else {
item->OnContentCheckCompleted(danger_type,
content::DOWNLOAD_INTERRUPT_REASON_NONE);
}
}
}
SafeBrowsingState* state = static_cast<SafeBrowsingState*>(
item->GetUserData(&kSafeBrowsingUserDataKey));
state->CompleteDownload();
}
| 15,524 |
98,955 | 0 | bool HTMLLinkElement::sheetLoaded()
{
if (!isLoading() && !isDisabled() && !isAlternate()) {
document()->removePendingSheet();
return true;
}
return false;
}
| 15,525 |
161,007 | 0 | void ChromeClientImpl::SetTouchAction(LocalFrame* frame,
TouchAction touch_action) {
DCHECK(frame);
WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame);
WebFrameWidgetBase* widget = web_frame->LocalRoot()->FrameWidget();
if (!widget)
return;
if (WebWidgetClient* client = widget->Client())
client->SetTouchAction(static_cast<TouchAction>(touch_action));
}
| 15,526 |
117,175 | 0 | static gboolean detachCallback(WebKitWebInspector*, InspectorTest* test)
{
return test->detach();
}
| 15,527 |
146,209 | 0 | void WebGL2RenderingContextBase::uniform4ui(
const WebGLUniformLocation* location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3) {
if (isContextLost() || !location)
return;
if (location->Program() != current_program_) {
SynthesizeGLError(GL_INVALID_OPERATION, "uniform4ui",
"location not for current program");
return;
}
ContextGL()->Uniform4ui(location->Location(), v0, v1, v2, v3);
}
| 15,528 |
166,986 | 0 | void CSSStyleSheet::StartLoadingDynamicSheet() {
SetLoadCompleted(false);
owner_node_->StartLoadingDynamicSheet();
}
| 15,529 |
97,826 | 0 | void AutoFillManager::FormsSeen(const std::vector<FormData>& forms) {
if (!IsAutoFillEnabled())
return;
if (personal_data_->profiles().empty() &&
personal_data_->credit_cards().empty())
return;
ParseForms(forms);
}
| 15,530 |
125,607 | 0 | void RenderViewHost::FilterURL(const RenderProcessHost* process,
bool empty_allowed,
GURL* url) {
RenderViewHostImpl::FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(),
process, empty_allowed, url);
}
| 15,531 |
120,120 | 0 | gfx::Vector2d Layer::MaxScrollOffset() const {
if (scroll_clip_layer_id_ == INVALID_ID)
return gfx::Vector2d();
gfx::Size scaled_scroll_bounds(bounds());
Layer const* current_layer = this;
Layer const* page_scale_layer = layer_tree_host()->page_scale_layer();
float scale_factor = 1.f;
do {
if (current_layer == page_scale_layer) {
scale_factor = layer_tree_host()->page_scale_factor();
scaled_scroll_bounds.SetSize(
scale_factor * scaled_scroll_bounds.width(),
scale_factor * scaled_scroll_bounds.height());
}
current_layer = current_layer->parent();
} while (current_layer && current_layer->id() != scroll_clip_layer_id_);
DCHECK(current_layer);
DCHECK(current_layer->id() == scroll_clip_layer_id_);
gfx::Vector2dF max_offset(
scaled_scroll_bounds.width() - current_layer->bounds().width(),
scaled_scroll_bounds.height() - current_layer->bounds().height());
max_offset.Scale(1.f / scale_factor);
max_offset.SetToMax(gfx::Vector2dF());
return gfx::ToFlooredVector2d(max_offset);
}
| 15,532 |
43,791 | 0 | iakerb_gss_wrap_iov_length(OM_uint32 *minor_status,
gss_ctx_id_t context_handle, int conf_req_flag,
gss_qop_t qop_req, int *conf_state,
gss_iov_buffer_desc *iov, int iov_count)
{
iakerb_ctx_id_t ctx = (iakerb_ctx_id_t)context_handle;
if (ctx->gssc == GSS_C_NO_CONTEXT)
return GSS_S_NO_CONTEXT;
return krb5_gss_wrap_iov_length(minor_status, ctx->gssc, conf_req_flag,
qop_req, conf_state, iov, iov_count);
}
| 15,533 |
37,030 | 0 | static void crash_vmclear_local_loaded_vmcss(void)
{
int cpu = raw_smp_processor_id();
struct loaded_vmcs *v;
if (!crash_local_vmclear_enabled(cpu))
return;
list_for_each_entry(v, &per_cpu(loaded_vmcss_on_cpu, cpu),
loaded_vmcss_on_cpu_link)
vmcs_clear(v->vmcs);
}
| 15,534 |
77,531 | 0 | ofputil_decode_port_stats(struct ofputil_port_stats *ps, struct ofpbuf *msg)
{
enum ofperr error;
enum ofpraw raw;
memset(&(ps->stats), 0xFF, sizeof (ps->stats));
error = (msg->header ? ofpraw_decode(&raw, msg->header)
: ofpraw_pull(&raw, msg));
if (error) {
return error;
}
if (!msg->size) {
return EOF;
} else if (raw == OFPRAW_OFPST14_PORT_REPLY) {
return ofputil_pull_ofp14_port_stats(ps, msg);
} else if (raw == OFPRAW_OFPST13_PORT_REPLY) {
const struct ofp13_port_stats *ps13;
ps13 = ofpbuf_try_pull(msg, sizeof *ps13);
if (!ps13) {
goto bad_len;
}
return ofputil_port_stats_from_ofp13(ps, ps13);
} else if (raw == OFPRAW_OFPST11_PORT_REPLY) {
const struct ofp11_port_stats *ps11;
ps11 = ofpbuf_try_pull(msg, sizeof *ps11);
if (!ps11) {
goto bad_len;
}
return ofputil_port_stats_from_ofp11(ps, ps11);
} else if (raw == OFPRAW_OFPST10_PORT_REPLY) {
const struct ofp10_port_stats *ps10;
ps10 = ofpbuf_try_pull(msg, sizeof *ps10);
if (!ps10) {
goto bad_len;
}
return ofputil_port_stats_from_ofp10(ps, ps10);
} else {
OVS_NOT_REACHED();
}
bad_len:
VLOG_WARN_RL(&bad_ofmsg_rl, "OFPST_PORT reply has %"PRIu32" leftover "
"bytes at end", msg->size);
return OFPERR_OFPBRC_BAD_LEN;
}
| 15,535 |
96,131 | 0 | static int timer_serialize(Unit *u, FILE *f, FDSet *fds) {
Timer *t = TIMER(u);
assert(u);
assert(f);
assert(fds);
unit_serialize_item(u, f, "state", timer_state_to_string(t->state));
unit_serialize_item(u, f, "result", timer_result_to_string(t->result));
if (t->last_trigger.realtime > 0)
unit_serialize_item_format(u, f, "last-trigger-realtime", "%" PRIu64, t->last_trigger.realtime);
if (t->last_trigger.monotonic > 0)
unit_serialize_item_format(u, f, "last-trigger-monotonic", "%" PRIu64, t->last_trigger.monotonic);
return 0;
}
| 15,536 |
90,352 | 0 | megasas_get_ld_list(struct megasas_instance *instance)
{
int ret = 0, ld_index = 0, ids = 0;
struct megasas_cmd *cmd;
struct megasas_dcmd_frame *dcmd;
struct MR_LD_LIST *ci;
dma_addr_t ci_h = 0;
u32 ld_count;
ci = instance->ld_list_buf;
ci_h = instance->ld_list_buf_h;
cmd = megasas_get_cmd(instance);
if (!cmd) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_list: Failed to get cmd\n");
return -ENOMEM;
}
dcmd = &cmd->frame->dcmd;
memset(ci, 0, sizeof(*ci));
memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
if (instance->supportmax256vd)
dcmd->mbox.b[0] = 1;
dcmd->cmd = MFI_CMD_DCMD;
dcmd->cmd_status = MFI_STAT_INVALID_STATUS;
dcmd->sge_count = 1;
dcmd->flags = MFI_FRAME_DIR_READ;
dcmd->timeout = 0;
dcmd->data_xfer_len = cpu_to_le32(sizeof(struct MR_LD_LIST));
dcmd->opcode = cpu_to_le32(MR_DCMD_LD_GET_LIST);
dcmd->pad_0 = 0;
megasas_set_dma_settings(instance, dcmd, ci_h,
sizeof(struct MR_LD_LIST));
if ((instance->adapter_type != MFI_SERIES) &&
!instance->mask_interrupts)
ret = megasas_issue_blocked_cmd(instance, cmd,
MFI_IO_TIMEOUT_SECS);
else
ret = megasas_issue_polled(instance, cmd);
ld_count = le32_to_cpu(ci->ldCount);
switch (ret) {
case DCMD_FAILED:
megaraid_sas_kill_hba(instance);
break;
case DCMD_TIMEOUT:
switch (dcmd_timeout_ocr_possible(instance)) {
case INITIATE_OCR:
cmd->flags |= DRV_DCMD_SKIP_REFIRE;
/*
* DCMD failed from AEN path.
* AEN path already hold reset_mutex to avoid PCI access
* while OCR is in progress.
*/
mutex_unlock(&instance->reset_mutex);
megasas_reset_fusion(instance->host,
MFI_IO_TIMEOUT_OCR);
mutex_lock(&instance->reset_mutex);
break;
case KILL_ADAPTER:
megaraid_sas_kill_hba(instance);
break;
case IGNORE_TIMEOUT:
dev_info(&instance->pdev->dev, "Ignore DCMD timeout: %s %d\n",
__func__, __LINE__);
break;
}
break;
case DCMD_SUCCESS:
if (ld_count > instance->fw_supported_vd_count)
break;
memset(instance->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT);
for (ld_index = 0; ld_index < ld_count; ld_index++) {
if (ci->ldList[ld_index].state != 0) {
ids = ci->ldList[ld_index].ref.targetId;
instance->ld_ids[ids] = ci->ldList[ld_index].ref.targetId;
}
}
break;
}
if (ret != DCMD_TIMEOUT)
megasas_return_cmd(instance, cmd);
return ret;
}
| 15,537 |
48,731 | 0 | struct net_device *__dev_get_by_index(struct net *net, int ifindex)
{
struct net_device *dev;
struct hlist_head *head = dev_index_hash(net, ifindex);
hlist_for_each_entry(dev, head, index_hlist)
if (dev->ifindex == ifindex)
return dev;
return NULL;
}
| 15,538 |
19,464 | 0 | static int efx_ethtool_set_coalesce(struct net_device *net_dev,
struct ethtool_coalesce *coalesce)
{
struct efx_nic *efx = netdev_priv(net_dev);
struct efx_channel *channel;
unsigned int tx_usecs, rx_usecs;
bool adaptive, rx_may_override_tx;
int rc;
if (coalesce->use_adaptive_tx_coalesce)
return -EINVAL;
efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive);
if (coalesce->rx_coalesce_usecs != rx_usecs)
rx_usecs = coalesce->rx_coalesce_usecs;
else
rx_usecs = coalesce->rx_coalesce_usecs_irq;
adaptive = coalesce->use_adaptive_rx_coalesce;
/* If channels are shared, TX IRQ moderation can be quietly
* overridden unless it is changed from its old value.
*/
rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs &&
coalesce->tx_coalesce_usecs_irq == tx_usecs);
if (coalesce->tx_coalesce_usecs != tx_usecs)
tx_usecs = coalesce->tx_coalesce_usecs;
else
tx_usecs = coalesce->tx_coalesce_usecs_irq;
rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive,
rx_may_override_tx);
if (rc != 0)
return rc;
efx_for_each_channel(channel, efx)
efx->type->push_irq_moderation(channel);
return 0;
}
| 15,539 |
80,374 | 0 | GF_Err saio_Size(GF_Box *s)
{
GF_SampleAuxiliaryInfoOffsetBox *ptr = (GF_SampleAuxiliaryInfoOffsetBox*)s;
if (ptr->aux_info_type || ptr->aux_info_type_parameter) {
ptr->flags |= 1;
}
if (ptr->offsets_large) {
ptr->version = 1;
}
if (ptr->flags & 1) ptr->size += 8;
ptr->size += 4;
switch (ptr->aux_info_type) {
case GF_ISOM_CENC_SCHEME:
case GF_ISOM_CBC_SCHEME:
case GF_ISOM_CENS_SCHEME:
case GF_ISOM_CBCS_SCHEME:
if (ptr->offsets_large) gf_free(ptr->offsets_large);
if (ptr->offsets) gf_free(ptr->offsets);
ptr->offsets_large = NULL;
ptr->offsets = NULL;
ptr->entry_count = 1;
break;
}
ptr->size += ((ptr->version==1) ? 8 : 4) * ptr->entry_count;
return GF_OK;
}
| 15,540 |
105,179 | 0 | ShadowRoot::~ShadowRoot()
{
ASSERT(!m_prev);
ASSERT(!m_next);
if (hasRareData())
clearRareData();
}
| 15,541 |
87,978 | 0 | static blk_status_t pcd_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd)
{
struct pcd_unit *cd = hctx->queue->queuedata;
if (rq_data_dir(bd->rq) != READ) {
blk_mq_start_request(bd->rq);
return BLK_STS_IOERR;
}
spin_lock_irq(&pcd_lock);
list_add_tail(&bd->rq->queuelist, &cd->rq_list);
pcd_request();
spin_unlock_irq(&pcd_lock);
return BLK_STS_OK;
}
| 15,542 |
42,893 | 0 | static off_t copyfd_sparse(int src_fd, int dst_fd1, int dst_fd2, off_t size2)
{
off_t total = 0;
int last_was_seek = 0;
#if CONFIG_FEATURE_COPYBUF_KB <= 4
char buffer[CONFIG_FEATURE_COPYBUF_KB * 1024];
enum { buffer_size = sizeof(buffer) };
#else
char *buffer;
int buffer_size;
/* We want page-aligned buffer, just in case kernel is clever
* and can do page-aligned io more efficiently */
buffer = mmap(NULL, CONFIG_FEATURE_COPYBUF_KB * 1024,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON,
/* ignored: */ -1, 0);
buffer_size = CONFIG_FEATURE_COPYBUF_KB * 1024;
if (buffer == MAP_FAILED) {
buffer = alloca(4 * 1024);
buffer_size = 4 * 1024;
}
#endif
while (1) {
ssize_t rd = safe_read(src_fd, buffer, buffer_size);
if (!rd) { /* eof */
if (last_was_seek) {
if (lseek(dst_fd1, -1, SEEK_CUR) < 0
|| safe_write(dst_fd1, "", 1) != 1
|| (dst_fd2 >= 0
&& (lseek(dst_fd2, -1, SEEK_CUR) < 0
|| safe_write(dst_fd2, "", 1) != 1
)
)
) {
perror_msg("Write error");
total = -1;
goto out;
}
}
/* all done */
goto out;
}
if (rd < 0) {
perror_msg("Read error");
total = -1;
goto out;
}
/* checking sparseness */
ssize_t cnt = rd;
while (--cnt >= 0) {
if (buffer[cnt] != 0) {
/* not sparse */
errno = 0;
ssize_t wr1 = full_write(dst_fd1, buffer, rd);
ssize_t wr2 = (dst_fd2 >= 0 ? full_write(dst_fd2, buffer, rd) : rd);
if (wr1 < rd || wr2 < rd) {
perror_msg("Write error");
total = -1;
goto out;
}
last_was_seek = 0;
goto adv;
}
}
/* sparse */
xlseek(dst_fd1, rd, SEEK_CUR);
if (dst_fd2 >= 0)
xlseek(dst_fd2, rd, SEEK_CUR);
last_was_seek = 1;
adv:
total += rd;
size2 -= rd;
if (size2 < 0)
dst_fd2 = -1;
}
out:
#if CONFIG_FEATURE_COPYBUF_KB > 4
if (buffer_size != 4 * 1024)
munmap(buffer, buffer_size);
#endif
return total;
}
| 15,543 |
164,127 | 0 | void AppCacheDatabase::ReadNamespaceRecord(
const sql::Statement* statement, NamespaceRecord* record) {
record->cache_id = statement->ColumnInt64(0);
record->origin = url::Origin::Create(GURL(statement->ColumnString(1)));
record->namespace_.type =
static_cast<AppCacheNamespaceType>(statement->ColumnInt(2));
record->namespace_.namespace_url = GURL(statement->ColumnString(3));
record->namespace_.target_url = GURL(statement->ColumnString(4));
record->namespace_.is_pattern = statement->ColumnBool(5);
DCHECK(record->namespace_.type == APPCACHE_FALLBACK_NAMESPACE ||
record->namespace_.type == APPCACHE_INTERCEPT_NAMESPACE);
}
| 15,544 |
186,207 | 1 | void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer, size_t length)
{
}
| 15,545 |
88,632 | 0 | static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
{
u32 reg;
reg = dwc3_readl(dwc->regs, DWC3_DSTS);
return DWC3_DSTS_SOFFN(reg);
}
| 15,546 |
159,280 | 0 | DownloadManagerDelegate::ApplicationClientIdForFileScanning() const {
return std::string();
}
| 15,547 |
67,018 | 0 | int ff_alloc_packet(AVPacket *avpkt, int size)
{
return ff_alloc_packet2(NULL, avpkt, size, 0);
}
| 15,548 |
98,392 | 0 | guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
return core(frame)->domWindow()->pendingUnloadEventListeners();
}
| 15,549 |
144,152 | 0 | png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
int num_trans, int color_type)
{
#ifdef PNG_USE_LOCAL_ARRAYS
PNG_tRNS;
#endif
png_byte buf[6];
png_debug(1, "in png_write_tRNS");
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette)
{
png_warning(png_ptr, "Invalid number of transparent colors specified");
return;
}
/* Write the chunk out as it is */
png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans,
(png_size_t)num_trans);
}
else if (color_type == PNG_COLOR_TYPE_GRAY)
{
/* One 16 bit value */
if (tran->gray >= (1 << png_ptr->bit_depth))
{
png_warning(png_ptr,
"Ignoring attempt to write tRNS chunk out-of-range for bit_depth");
return;
}
png_save_uint_16(buf, tran->gray);
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2);
}
else if (color_type == PNG_COLOR_TYPE_RGB)
{
/* Three 16 bit values */
png_save_uint_16(buf, tran->red);
png_save_uint_16(buf + 2, tran->green);
png_save_uint_16(buf + 4, tran->blue);
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
{
png_warning(png_ptr,
"Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
return;
}
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6);
}
else
{
png_warning(png_ptr, "Can't write tRNS with an alpha channel");
}
}
| 15,550 |
140,283 | 0 | bool GIFImageReader::parse(GIFImageDecoder::GIFParseQuery query)
{
ASSERT(m_bytesRead <= m_data->size());
return parseData(m_bytesRead, m_data->size() - m_bytesRead, query);
}
| 15,551 |
43,681 | 0 | static inline void put_link(struct nameidata *nd)
{
struct saved *last = nd->stack + --nd->depth;
struct inode *inode = last->inode;
if (last->cookie && inode->i_op->put_link)
inode->i_op->put_link(inode, last->cookie);
if (!(nd->flags & LOOKUP_RCU))
path_put(&last->link);
}
| 15,552 |
10,240 | 0 | FT_Get_First_Char( FT_Face face,
FT_UInt *agindex )
{
FT_ULong result = 0;
FT_UInt gindex = 0;
if ( face && face->charmap && face->num_glyphs )
{
gindex = FT_Get_Char_Index( face, 0 );
if ( gindex == 0 || gindex >= (FT_UInt)face->num_glyphs )
result = FT_Get_Next_Char( face, 0, &gindex );
}
if ( agindex )
*agindex = gindex;
return result;
}
| 15,553 |
71,633 | 0 | static MagickBooleanType DecodeImage(Image *image, unsigned char *pixels,
const size_t length)
{
#define RLE_MODE_NONE -1
#define RLE_MODE_COPY 0
#define RLE_MODE_RUN 1
int data = 0, count = 0;
unsigned char *p;
int mode = RLE_MODE_NONE;
for (p = pixels; p < pixels + length; p++) {
if (0 == count) {
data = ReadBlobByte( image );
if (-1 == data) return MagickFalse;
if (data > 128) {
mode = RLE_MODE_RUN;
count = data - 128 + 1;
data = ReadBlobByte( image );
if (-1 == data) return MagickFalse;
} else {
mode = RLE_MODE_COPY;
count = data + 1;
}
}
if (RLE_MODE_COPY == mode) {
data = ReadBlobByte( image );
if (-1 == data) return MagickFalse;
}
*p = (unsigned char)data;
--count;
}
return MagickTrue;
}
| 15,554 |
139,922 | 0 | const AtomicString& VideoKindToString(
WebMediaPlayerClient::VideoTrackKind kind) {
switch (kind) {
case WebMediaPlayerClient::VideoTrackKindNone:
return emptyAtom;
case WebMediaPlayerClient::VideoTrackKindAlternative:
return VideoTrack::alternativeKeyword();
case WebMediaPlayerClient::VideoTrackKindCaptions:
return VideoTrack::captionsKeyword();
case WebMediaPlayerClient::VideoTrackKindMain:
return VideoTrack::mainKeyword();
case WebMediaPlayerClient::VideoTrackKindSign:
return VideoTrack::signKeyword();
case WebMediaPlayerClient::VideoTrackKindSubtitles:
return VideoTrack::subtitlesKeyword();
case WebMediaPlayerClient::VideoTrackKindCommentary:
return VideoTrack::commentaryKeyword();
}
NOTREACHED();
return emptyAtom;
}
| 15,555 |
130,689 | 0 | static void conditionalAttr3AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectV8Internal::conditionalAttr3AttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 15,556 |
142,809 | 0 | bool HTMLMediaElement::HasPendingActivity() const {
if (should_delay_load_event_)
return true;
if (!media_source_ && network_state_ == kNetworkLoading)
return true;
{
base::AutoReset<bool> scope(&official_playback_position_needs_update_,
false);
if (CouldPlayIfEnoughData())
return true;
}
if (seeking_)
return true;
if (async_event_queue_->HasPendingEvents())
return true;
return false;
}
| 15,557 |
143,737 | 0 | void ShellMainDelegate::ZygoteForked() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableCrashReporter)) {
std::string process_type =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType);
breakpad::InitCrashReporter(process_type);
}
}
| 15,558 |
96,484 | 0 | static int AppLayerProtoDetectPMRegisterPattern(uint8_t ipproto, AppProto alproto,
const char *pattern,
uint16_t depth, uint16_t offset,
uint8_t direction,
uint8_t is_cs)
{
SCEnter();
AppLayerProtoDetectCtxIpproto *ctx_ipp = &alpd_ctx.ctx_ipp[FlowGetProtoMapping(ipproto)];
AppLayerProtoDetectPMCtx *ctx_pm = NULL;
DetectContentData *cd;
int ret = 0;
cd = DetectContentParseEncloseQuotes(alpd_ctx.spm_global_thread_ctx,
pattern);
if (cd == NULL)
goto error;
cd->depth = depth;
cd->offset = offset;
if (!is_cs) {
/* Rebuild as nocase */
SpmDestroyCtx(cd->spm_ctx);
cd->spm_ctx = SpmInitCtx(cd->content, cd->content_len, 1,
alpd_ctx.spm_global_thread_ctx);
if (cd->spm_ctx == NULL) {
goto error;
}
cd->flags |= DETECT_CONTENT_NOCASE;
}
if (depth < cd->content_len)
goto error;
if (direction & STREAM_TOSERVER)
ctx_pm = (AppLayerProtoDetectPMCtx *)&ctx_ipp->ctx_pm[0];
else
ctx_pm = (AppLayerProtoDetectPMCtx *)&ctx_ipp->ctx_pm[1];
if (depth > ctx_pm->max_len)
ctx_pm->max_len = depth;
if (depth < ctx_pm->min_len)
ctx_pm->min_len = depth;
/* Finally turn it into a signature and add to the ctx. */
AppLayerProtoDetectPMAddSignature(ctx_pm, cd, alproto);
goto end;
error:
ret = -1;
end:
SCReturnInt(ret);
}
| 15,559 |
177,703 | 0 | virtual void SetUp() {
InitializeConfig();
SetMode(encoding_mode_);
}
| 15,560 |
172,958 | 0 | int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
{
return 1;
}
| 15,561 |
153,098 | 0 | bool PDFiumEngineExports::RenderPDFPageToBitmap(
const void* pdf_buffer,
int pdf_buffer_size,
int page_number,
const RenderingSettings& settings,
void* bitmap_buffer) {
FPDF_DOCUMENT doc =
FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
if (!doc)
return false;
FPDF_PAGE page = FPDF_LoadPage(doc, page_number);
if (!page) {
FPDF_CloseDocument(doc);
return false;
}
pp::Rect dest;
int rotate = CalculatePosition(page, settings, &dest);
FPDF_BITMAP bitmap =
FPDFBitmap_CreateEx(settings.bounds.width(), settings.bounds.height(),
FPDFBitmap_BGRA, bitmap_buffer,
settings.bounds.width() * 4);
FPDFBitmap_FillRect(bitmap, 0, 0, settings.bounds.width(),
settings.bounds.height(), 0xFFFFFFFF);
dest.set_point(dest.point() - settings.bounds.point());
FPDF_RenderPageBitmap(
bitmap, page, dest.x(), dest.y(), dest.width(), dest.height(), rotate,
FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH);
FPDFBitmap_Destroy(bitmap);
FPDF_ClosePage(page);
FPDF_CloseDocument(doc);
return true;
}
| 15,562 |
111,015 | 0 | void FileSystemOperation::DoCreateDirectory(
const StatusCallback& callback,
bool exclusive, bool recursive) {
FileSystemFileUtilProxy::CreateDirectory(
&operation_context_,
src_util_, src_path_, exclusive, recursive,
base::Bind(&FileSystemOperation::DidFinishFileOperation,
base::Owned(this), callback));
}
| 15,563 |
13,511 | 0 | static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
const DVprofile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t* as_pack;
uint8_t *pcm, ipcm;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack) /* No audio ? */
return 0;
smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */
if (quant > 1)
return -1; /* unsupported quantization */
size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
half_ch = sys->difseg_size / 2;
/* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3. */
ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
pcm = ppcm[ipcm++];
/* for each DIF channel */
for (chan = 0; chan < sys->n_difchan; chan++) {
/* for each DIF segment */
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80; /* skip DIF segment header */
if (quant == 1 && i == half_ch) {
/* next stereo channel (12bit mode only) */
pcm = ppcm[ipcm++];
if (!pcm)
break;
}
/* for each AV sequence */
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) { /* 16bit quantization */
of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = frame[d+1]; // FIXME: maybe we have to admit
pcm[of*2+1] = frame[d]; // that DV is a big-endian PCM
if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00)
pcm[of*2+1] = 0;
} else { /* 12bit quantization */
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d+2] >> 4);
rc = ((uint16_t)frame[d+1] << 4) |
((uint16_t)frame[d+2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i%half_ch][j] + (d - 8) / 3 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = lc & 0xff; // FIXME: maybe we have to admit
pcm[of*2+1] = lc >> 8; // that DV is a big-endian PCM
of = sys->audio_shuffle[i%half_ch+half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
pcm[of*2] = rc & 0xff; // FIXME: maybe we have to admit
pcm[of*2+1] = rc >> 8; // that DV is a big-endian PCM
++d;
}
}
frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
}
}
/* next stereo channel (50Mbps and 100Mbps only) */
pcm = ppcm[ipcm++];
if (!pcm)
break;
}
return size;
}
| 15,564 |
39,098 | 0 | bittoint4(PG_FUNCTION_ARGS)
{
VarBit *arg = PG_GETARG_VARBIT_P(0);
uint32 result;
bits8 *r;
/* Check that the bit string is not too long */
if (VARBITLEN(arg) > sizeof(result) * BITS_PER_BYTE)
ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range")));
result = 0;
for (r = VARBITS(arg); r < VARBITEND(arg); r++)
{
result <<= BITS_PER_BYTE;
result |= *r;
}
/* Now shift the result to take account of the padding at the end */
result >>= VARBITPAD(arg);
PG_RETURN_INT32(result);
}
| 15,565 |
81,835 | 0 | static void ecc_ctx_init(ecEncCtx* ctx, int flags)
{
if (ctx) {
XMEMSET(ctx, 0, sizeof(ecEncCtx));
ctx->encAlgo = ecAES_128_CBC;
ctx->kdfAlgo = ecHKDF_SHA256;
ctx->macAlgo = ecHMAC_SHA256;
ctx->protocol = (byte)flags;
if (flags == REQ_RESP_CLIENT)
ctx->cliSt = ecCLI_INIT;
if (flags == REQ_RESP_SERVER)
ctx->srvSt = ecSRV_INIT;
}
}
| 15,566 |
182,980 | 1 | seamless_process(STREAM s)
{
unsigned int pkglen;
char *buf;
pkglen = s->end - s->p;
/* str_handle_lines requires null terminated strings */
buf = xmalloc(pkglen + 1);
STRNCPY(buf, (char *) s->p, pkglen + 1);
str_handle_lines(buf, &seamless_rest, seamless_line_handler, NULL);
xfree(buf);
}
| 15,567 |
148,538 | 0 | void WebContentsImpl::Replace(const base::string16& word) {
RenderFrameHost* focused_frame = GetFocusedFrame();
if (!focused_frame)
return;
focused_frame->GetFrameInputHandler()->Replace(word);
}
| 15,568 |
136,460 | 0 | ConversionContext::~ConversionContext() {
while (state_stack_.size()) {
if (state_stack_.back().type == StateEntry::kEffect)
EndEffect();
else
EndClip();
}
EndTransform();
if (translated_for_layer_offset_)
AppendRestore(1);
}
| 15,569 |
37,163 | 0 | static bool pi_test_and_clear_on(struct pi_desc *pi_desc)
{
return test_and_clear_bit(POSTED_INTR_ON,
(unsigned long *)&pi_desc->control);
}
| 15,570 |
142,567 | 0 | void ShelfWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) {
views::View::ReorderChildLayers(parent_layer);
parent_layer->StackAtBottom(&opaque_background_);
}
| 15,571 |
88,829 | 0 | irqreturn_t floppy_interrupt(int irq, void *dev_id)
{
int do_print;
unsigned long f;
void (*handler)(void) = do_floppy;
lasthandler = handler;
interruptjiffies = jiffies;
f = claim_dma_lock();
fd_disable_dma();
release_dma_lock(f);
do_floppy = NULL;
if (fdc >= N_FDC || FDCS->address == -1) {
/* we don't even know which FDC is the culprit */
pr_info("DOR0=%x\n", fdc_state[0].dor);
pr_info("floppy interrupt on bizarre fdc %d\n", fdc);
pr_info("handler=%ps\n", handler);
is_alive(__func__, "bizarre fdc");
return IRQ_NONE;
}
FDCS->reset = 0;
/* We have to clear the reset flag here, because apparently on boxes
* with level triggered interrupts (PS/2, Sparc, ...), it is needed to
* emit SENSEI's to clear the interrupt line. And FDCS->reset blocks the
* emission of the SENSEI's.
* It is OK to emit floppy commands because we are in an interrupt
* handler here, and thus we have to fear no interference of other
* activity.
*/
do_print = !handler && print_unex && initialized;
inr = result();
if (do_print)
print_result("unexpected interrupt", inr);
if (inr == 0) {
int max_sensei = 4;
do {
output_byte(FD_SENSEI);
inr = result();
if (do_print)
print_result("sensei", inr);
max_sensei--;
} while ((ST0 & 0x83) != UNIT(current_drive) &&
inr == 2 && max_sensei);
}
if (!handler) {
FDCS->reset = 1;
return IRQ_NONE;
}
schedule_bh(handler);
is_alive(__func__, "normal interrupt end");
/* FIXME! Was it really for us? */
return IRQ_HANDLED;
}
| 15,572 |
44,366 | 0 | static inline void rt_free(struct rtable *rt)
{
call_rcu(&rt->dst.rcu_head, dst_rcu_free);
}
| 15,573 |
7,447 | 0 | void zend_ts_hash_display(TsHashTable *ht)
{
begin_read(ht);
zend_hash_display(TS_HASH(ht));
end_read(ht);
}
| 15,574 |
35,129 | 0 | static void release_pte_pages(pte_t *pte, pte_t *_pte)
{
while (--_pte >= pte) {
pte_t pteval = *_pte;
if (!pte_none(pteval))
release_pte_page(pte_page(pteval));
}
}
| 15,575 |
129,117 | 0 | bool PermissionsData::HasAPIPermissionForTab(
int tab_id,
APIPermission::ID permission) const {
if (HasAPIPermission(permission))
return true;
scoped_refptr<const PermissionSet> tab_permissions =
GetTabSpecificPermissions(tab_id);
base::AutoLock auto_lock(runtime_lock_);
return tab_permissions.get() && tab_permissions->HasAPIPermission(permission);
}
| 15,576 |
177,803 | 1 | static void build_l4proto_sctp(const struct nf_conntrack *ct, struct nethdr *n)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, NTA_PORT,
sizeof(struct nfct_attr_grp_port));
if (!nfct_attr_is_set(ct, ATTR_SCTP_STATE))
return;
ct_build_u8(ct, ATTR_SCTP_STATE, n, NTA_SCTP_STATE);
ct_build_u32(ct, ATTR_SCTP_VTAG_ORIG, n, NTA_SCTP_VTAG_ORIG);
ct_build_u32(ct, ATTR_SCTP_VTAG_REPL, n, NTA_SCTP_VTAG_REPL);
}
| 15,577 |
58,260 | 0 | static struct page *__dma_alloc_buffer(struct device *dev, size_t size, gfp_t gfp)
{
unsigned long order = get_order(size);
struct page *page, *p, *e;
page = alloc_pages(gfp, order);
if (!page)
return NULL;
/*
* Now split the huge page and free the excess pages
*/
split_page(page, order);
for (p = page + (size >> PAGE_SHIFT), e = page + (1 << order); p < e; p++)
__free_page(p);
__dma_clear_buffer(page, size);
return page;
}
| 15,578 |
181,941 | 1 | static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)
{
int rlen, remain;
dpIOCtxPtr dctx;
dynamicPtr *dp;
dctx = (dpIOCtxPtr) ctx;
dp = dctx->dp;
remain = dp->logicalSize - dp->pos;
if(remain >= len) {
rlen = len;
} else {
if(remain == 0) {
/* 2.0.34: EOF is incorrect. We use 0 for
* errors and EOF, just like fileGetbuf,
* which is a simple fread() wrapper.
* TBB. Original bug report: Daniel Cowgill. */
return 0; /* NOT EOF */
}
rlen = remain;
}
memcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen);
dp->pos += rlen;
return rlen;
}
| 15,579 |
103,615 | 0 | GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile,
const GURL& url) {
if (!profile || !profile->GetExtensionService())
return url;
const Extension* extension =
profile->GetExtensionService()->GetExtensionByWebExtent(url);
if (!extension)
return url;
return extension->GetResourceURL(url.path());
}
| 15,580 |
156,853 | 0 | const AtomicString& Document::linkColor() const {
return BodyAttributeValue(linkAttr);
}
| 15,581 |
114,685 | 0 | void Navigate(const char* url, int page_id) {
contents()->TestDidNavigate(
contents()->GetRenderViewHost(), page_id, GURL(url),
content::PAGE_TRANSITION_TYPED);
}
| 15,582 |
175,839 | 0 | static THREAD_FUNCTION thread_decoding_proc(void *p_data)
{
int ithread = ((DECODETHREAD_DATA *)p_data)->ithread;
VP8D_COMP *pbi = (VP8D_COMP *)(((DECODETHREAD_DATA *)p_data)->ptr1);
MB_ROW_DEC *mbrd = (MB_ROW_DEC *)(((DECODETHREAD_DATA *)p_data)->ptr2);
ENTROPY_CONTEXT_PLANES mb_row_left_context;
while (1)
{
if (pbi->b_multithreaded_rd == 0)
break;
if (sem_wait(&pbi->h_event_start_decoding[ithread]) == 0)
{
if (pbi->b_multithreaded_rd == 0)
break;
else
{
MACROBLOCKD *xd = &mbrd->mbd;
xd->left_context = &mb_row_left_context;
mt_decode_mb_rows(pbi, xd, ithread+1);
}
}
}
return 0 ;
}
| 15,583 |
87,619 | 0 | static unsigned zlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in,
size_t insize, const LodePNGCompressSettings* settings)
{
if(settings->custom_zlib)
{
return settings->custom_zlib(out, outsize, in, insize, settings);
}
else
{
return lodepng_zlib_compress(out, outsize, in, insize, settings);
}
}
| 15,584 |
143,520 | 0 | void OnSwapBuffersCompleted(std::vector<ui::LatencyInfo> latency_info,
gfx::Size swap_size,
const gpu::SwapBuffersCompleteParams& params) {
client_->DidReceiveSwapBuffersAck();
swap_buffers_callback_.Run(swap_size);
UpdateLatencyInfoOnSwap(params.swap_response, &latency_info);
latency_tracker_.OnGpuSwapBuffersCompleted(latency_info);
}
| 15,585 |
96,671 | 0 | static __poll_t f_hidg_poll(struct file *file, poll_table *wait)
{
struct f_hidg *hidg = file->private_data;
__poll_t ret = 0;
poll_wait(file, &hidg->read_queue, wait);
poll_wait(file, &hidg->write_queue, wait);
if (WRITE_COND)
ret |= EPOLLOUT | EPOLLWRNORM;
if (READ_COND)
ret |= EPOLLIN | EPOLLRDNORM;
return ret;
}
| 15,586 |
157,479 | 0 | void IsPinnedToTaskbarHelper::GetState(
std::unique_ptr<service_manager::Connector> connector,
const ErrorCallback& error_callback,
const ResultCallback& result_callback) {
new IsPinnedToTaskbarHelper(std::move(connector), error_callback,
result_callback);
}
| 15,587 |
58,617 | 0 | SecHandle* sspi_SecureHandleAlloc()
{
SecHandle* handle = (SecHandle*) malloc(sizeof(SecHandle));
sspi_SecureHandleInit(handle);
return handle;
}
| 15,588 |
66,499 | 0 | static inline struct sk_buff *pull_skb(rtl8150_t *dev)
{
struct sk_buff *skb;
int i;
for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
if (dev->rx_skb_pool[i]) {
skb = dev->rx_skb_pool[i];
dev->rx_skb_pool[i] = NULL;
return skb;
}
}
return NULL;
}
| 15,589 |
156,057 | 0 | void OverlayWindowViews::UpdateVideoSize(const gfx::Size& natural_size) {
DCHECK(!natural_size.IsEmpty());
natural_size_ = natural_size;
SetAspectRatio(gfx::SizeF(natural_size_));
SetBounds(CalculateAndUpdateWindowBounds());
}
| 15,590 |
106,651 | 0 | void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect,
const HashMap<UINT, Vector<String> >& dataMap, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
{
COMPtr<WCDataObject> dataObject;
WCDataObject::createInstance(&dataObject, dataMap);
RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly);
if (!memoryBuffer)
return;
RefPtr<WebDragSource> source = WebDragSource::createInstance();
if (!source)
return;
COMPtr<IDragSourceHelper> helper;
if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper))))
return;
BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize);
void* bits;
OwnPtr<HBITMAP> hbmp(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0));
memcpy(bits, memoryBuffer->data(), memoryBuffer->size());
SHDRAGIMAGE sdi;
sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth;
sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight;
sdi.crColorKey = 0xffffffff;
sdi.hbmpDragImage = hbmp.leakPtr();
sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
if (isLinkDrag)
sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y;
helper->InitializeFromBitmap(&sdi, dataObject.get());
DWORD effect = DROPEFFECT_NONE;
DragOperation operation = DragOperationNone;
if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) {
if (effect & DROPEFFECT_COPY)
operation = DragOperationCopy;
else if (effect & DROPEFFECT_LINK)
operation = DragOperationLink;
else if (effect & DROPEFFECT_MOVE)
operation = DragOperationMove;
}
POINT globalPoint;
::GetCursorPos(&globalPoint);
POINT localPoint = globalPoint;
::ScreenToClient(m_pageClient->nativeWindow(), &localPoint);
dragEnded(localPoint, globalPoint, operation);
}
| 15,591 |
118,125 | 0 | void WebContentsAndroid::AddStyleSheetByURL(
JNIEnv* env,
jobject obj,
jstring url) {
web_contents_->GetMainFrame()->Send(new FrameMsg_AddStyleSheetByURL(
web_contents_->GetMainFrame()->GetRoutingID(),
ConvertJavaStringToUTF8(env, url)));
}
| 15,592 |
132,742 | 0 | void ChromotingInstance::OnVideoDecodeError() {
Disconnect();
OnConnectionState(protocol::ConnectionToHost::FAILED,
protocol::INCOMPATIBLE_PROTOCOL);
}
| 15,593 |
186,983 | 1 | WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(
int window_id,
std::string* error) {
Browser* browser = NULL;
if (!GetBrowserFromWindowID(chrome_details_, window_id, &browser, error))
return nullptr;
WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
if (!contents) {
*error = "No active web contents to capture";
return nullptr;
}
if (!extension()->permissions_data()->CanCaptureVisiblePage(
contents->GetLastCommittedURL(),
SessionTabHelper::IdForTab(contents).id(), error)) {
return nullptr;
}
return contents;
}
| 15,594 |
83,859 | 0 | static int mac80211_hwsim_sta_add(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
hwsim_check_magic(vif);
hwsim_set_sta_magic(sta);
return 0;
}
| 15,595 |
179,146 | 1 | static inline void sem_getref_and_unlock(struct sem_array *sma)
{
ipc_rcu_getref(sma);
ipc_unlock(&(sma)->sem_perm);
}
| 15,596 |
46,054 | 0 | xdr_gpol_ret(XDR *xdrs, gpol_ret *objp)
{
if (!xdr_ui_4(xdrs, &objp->api_version)) {
return (FALSE);
}
if (!xdr_kadm5_ret_t(xdrs, &objp->code)) {
return (FALSE);
}
if(objp->code == KADM5_OK) {
if (!_xdr_kadm5_policy_ent_rec(xdrs, &objp->rec,
objp->api_version))
return (FALSE);
}
return (TRUE);
}
| 15,597 |
109,601 | 0 | PassRefPtr<Comment> Document::createComment(const String& data)
{
return Comment::create(*this, data);
}
| 15,598 |
32,212 | 0 | int netif_rx_ni(struct sk_buff *skb)
{
int err;
preempt_disable();
err = netif_rx(skb);
if (local_softirq_pending())
do_softirq();
preempt_enable();
return err;
}
| 15,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.