unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
144,767 | 0 | std::unique_ptr<KeyedService> BuildMockDataStoreForContext(
content::BrowserContext* browser_context) {
return std::make_unique<MockDataStore>();
}
| 17,000 |
81,169 | 0 | static int hash(struct signal_struct *sig, unsigned int nr)
{
return hash_32(hash32_ptr(sig) ^ nr, HASH_BITS(posix_timers_hashtable));
}
| 17,001 |
121,979 | 0 | static AppListController* GetInstance() {
return Singleton<AppListController,
LeakySingletonTraits<AppListController> >::get();
}
| 17,002 |
13,741 | 0 | ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */
{
zval *tmp;
MAKE_STD_ZVAL(tmp);
ZVAL_DOUBLE(tmp, d);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
}
/* }}} */
| 17,003 |
55,711 | 0 | archive_read_support_format_zip_streamable(struct archive *_a)
{
struct archive_read *a = (struct archive_read *)_a;
struct zip *zip;
int r;
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
ARCHIVE_STATE_NEW, "archive_read_support_format_zip");
zip = (struct zip *)calloc(1, sizeof(*zip));
if (zip == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate zip data");
return (ARCHIVE_FATAL);
}
/* Streamable reader doesn't support mac extensions. */
zip->process_mac_extensions = 0;
/*
* Until enough data has been read, we cannot tell about
* any encrypted entries yet.
*/
zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
zip->crc32func = real_crc32;
r = __archive_read_register_format(a,
zip,
"zip",
archive_read_format_zip_streamable_bid,
archive_read_format_zip_options,
archive_read_format_zip_streamable_read_header,
archive_read_format_zip_read_data,
archive_read_format_zip_read_data_skip_streamable,
NULL,
archive_read_format_zip_cleanup,
archive_read_support_format_zip_capabilities_streamable,
archive_read_format_zip_has_encrypted_entries);
if (r != ARCHIVE_OK)
free(zip);
return (ARCHIVE_OK);
}
| 17,004 |
114,124 | 0 | on_javascript_confirm(Ewk_View_Smart_Data *smartData, const char *message)
{
Browser_Window *window = browser_view_find(smartData->self);
Eina_Bool ok = EINA_FALSE;
Evas_Object *confirm_popup = elm_popup_add(window->window);
evas_object_size_hint_weight_set(confirm_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(confirm_popup, message);
elm_object_part_text_set(confirm_popup, "title,text", "Confirmation");
/* Popup buttons */
Evas_Object *cancel_button = elm_button_add(confirm_popup);
elm_object_text_set(cancel_button, "Cancel");
elm_object_part_content_set(confirm_popup, "button1", cancel_button);
evas_object_smart_callback_add(cancel_button, "clicked", quit_event_loop, NULL);
Evas_Object *ok_button = elm_button_add(confirm_popup);
elm_object_text_set(ok_button, "OK");
elm_object_part_content_set(confirm_popup, "button2", ok_button);
evas_object_smart_callback_add(ok_button, "clicked", on_ok_clicked, &ok);
elm_object_focus_set(ok_button, EINA_TRUE);
evas_object_show(confirm_popup);
/* Make modal */
ecore_main_loop_begin();
evas_object_del(confirm_popup);
return ok;
}
| 17,005 |
81,671 | 0 | get_http_method_info(const char *method)
{
/* Check if the method is known to the server. The list of all known
* HTTP methods can be found here at
* http://www.iana.org/assignments/http-methods/http-methods.xhtml
*/
const struct mg_http_method_info *m = http_methods;
while (m->name) {
if (!strcmp(m->name, method)) {
return m;
}
m++;
}
return NULL;
}
| 17,006 |
79,952 | 0 | xfs_iflag_for_tag(
int tag)
{
switch (tag) {
case XFS_ICI_EOFBLOCKS_TAG:
return XFS_IEOFBLOCKS;
case XFS_ICI_COWBLOCKS_TAG:
return XFS_ICOWBLOCKS;
default:
ASSERT(0);
return 0;
}
}
| 17,007 |
133,148 | 0 | void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
if (ignore_window_pos_changes_) {
if (!(window_pos->flags & ((IsVisible() ? SWP_HIDEWINDOW : SWP_SHOWWINDOW) |
SWP_FRAMECHANGED)) &&
(window_pos->flags & (SWP_NOZORDER | SWP_NOACTIVATE))) {
window_pos->flags |= SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW;
window_pos->flags &= ~(SWP_SHOWWINDOW | SWP_HIDEWINDOW);
}
} else if (!GetParent(hwnd())) {
CRect window_rect;
HMONITOR monitor;
gfx::Rect monitor_rect, work_area;
if (GetWindowRect(hwnd(), &window_rect) &&
GetMonitorAndRects(window_rect, &monitor, &monitor_rect, &work_area)) {
bool work_area_changed = (monitor_rect == last_monitor_rect_) &&
(work_area != last_work_area_);
if (monitor && (monitor == last_monitor_) &&
((fullscreen_handler_->fullscreen() &&
!fullscreen_handler_->metro_snap()) ||
work_area_changed)) {
gfx::Rect new_window_rect;
if (fullscreen_handler_->fullscreen()) {
new_window_rect = monitor_rect;
} else if (IsMaximized()) {
new_window_rect = work_area;
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
new_window_rect.Inset(-border_thickness, -border_thickness);
} else {
new_window_rect = gfx::Rect(window_rect);
new_window_rect.AdjustToFit(work_area);
}
window_pos->x = new_window_rect.x();
window_pos->y = new_window_rect.y();
window_pos->cx = new_window_rect.width();
window_pos->cy = new_window_rect.height();
window_pos->flags &= ~(SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW);
window_pos->flags |= SWP_NOCOPYBITS;
ignore_window_pos_changes_ = true;
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&HWNDMessageHandler::StopIgnoringPosChanges,
weak_factory_.GetWeakPtr()));
}
last_monitor_ = monitor;
last_monitor_rect_ = monitor_rect;
last_work_area_ = work_area;
}
}
if (ScopedFullscreenVisibility::IsHiddenForFullscreen(hwnd())) {
window_pos->flags &= ~SWP_SHOWWINDOW;
}
if (window_pos->flags & SWP_SHOWWINDOW)
delegate_->HandleVisibilityChanging(true);
else if (window_pos->flags & SWP_HIDEWINDOW)
delegate_->HandleVisibilityChanging(false);
SetMsgHandled(FALSE);
}
| 17,008 |
159,347 | 0 | ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
content::BrowserContext* context) const {
return base::MakeUnique<ChromeGuestViewManagerDelegate>(context);
}
| 17,009 |
77,126 | 0 | OVS_EXCLUDED(ofproto_mutex)
{
enum ofperr error = ofproto_flow_mod_learn_refresh(ofm);
struct rule *rule = ofm->temp_rule;
/* Do we need to insert the rule? */
if (!error && rule->state == RULE_INITIALIZED) {
ovs_mutex_lock(&ofproto_mutex);
ofm->version = rule->ofproto->tables_version + 1;
error = ofproto_flow_mod_learn_start(ofm);
if (!error) {
ofproto_flow_mod_learn_finish(ofm, NULL);
}
ovs_mutex_unlock(&ofproto_mutex);
}
if (!keep_ref) {
ofproto_rule_unref(rule);
ofm->temp_rule = NULL;
}
return error;
}
| 17,010 |
98,676 | 0 | void BuildCharEvent(const WebInputEvent* event, NPPepperEvent* npevent) {
const WebKeyboardEvent* key_event =
reinterpret_cast<const WebKeyboardEvent*>(event);
npevent->u.character.modifier = key_event->modifiers;
DCHECK(sizeof(npevent->u.character.text) == sizeof(key_event->text));
DCHECK(sizeof(npevent->u.character.unmodifiedText) ==
sizeof(key_event->unmodifiedText));
for (size_t i = 0; i < WebKeyboardEvent::textLengthCap; ++i) {
npevent->u.character.text[i] = key_event->text[i];
npevent->u.character.unmodifiedText[i] = key_event->unmodifiedText[i];
}
}
| 17,011 |
113,054 | 0 | DownloadItem::SafetyState DownloadItemImpl::GetSafetyState() const {
return safety_state_;
}
| 17,012 |
87,900 | 0 | static int pam_vprompt(pam_handle_t *pamh, int style, char **response,
const char *fmt, va_list args)
{
int r = PAM_CRED_INSUFFICIENT;
const struct pam_conv *conv;
struct pam_message msg;
struct pam_response *resp = NULL;
struct pam_message *(msgp[1]);
char text[128];
vsnprintf(text, sizeof text, fmt, args);
msgp[0] = &msg;
msg.msg_style = style;
msg.msg = text;
if (PAM_SUCCESS != pam_get_item(pamh, PAM_CONV, (const void **) &conv)
|| NULL == conv || NULL == conv->conv
|| conv->conv(1, (const struct pam_message **) msgp, &resp, conv->appdata_ptr)
|| NULL == resp) {
goto err;
}
if (NULL != response) {
if (resp[0].resp) {
*response = strdup(resp[0].resp);
if (NULL == *response) {
pam_syslog(pamh, LOG_CRIT, "strdup() failed: %s",
strerror(errno));
goto err;
}
} else {
*response = NULL;
}
}
r = PAM_SUCCESS;
err:
if (resp) {
OPENSSL_cleanse(&resp[0].resp, sizeof resp[0].resp);
free(&resp[0]);
}
return r;
}
| 17,013 |
20,961 | 0 | static inline int get_and_reset_irq(int irqnumber)
{
int bit;
unsigned long flags;
int ret = 0;
if (invalid_vm86_irq(irqnumber)) return 0;
if (vm86_irqs[irqnumber].tsk != current) return 0;
spin_lock_irqsave(&irqbits_lock, flags);
bit = irqbits & (1 << irqnumber);
irqbits &= ~bit;
if (bit) {
enable_irq(irqnumber);
ret = 1;
}
spin_unlock_irqrestore(&irqbits_lock, flags);
return ret;
}
| 17,014 |
39,273 | 0 | int security_get_bool_value(int bool)
{
int rc;
int len;
read_lock(&policy_rwlock);
rc = -EFAULT;
len = policydb.p_bools.nprim;
if (bool >= len)
goto out;
rc = policydb.bool_val_to_struct[bool]->state;
out:
read_unlock(&policy_rwlock);
return rc;
}
| 17,015 |
107,792 | 0 | FindBarController* Browser::GetFindBarController() {
if (!find_bar_controller_.get()) {
FindBar* find_bar = BrowserWindow::CreateFindBar(this);
find_bar_controller_.reset(new FindBarController(find_bar));
find_bar->SetFindBarController(find_bar_controller_.get());
find_bar_controller_->ChangeTabContents(GetSelectedTabContents());
find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
}
return find_bar_controller_.get();
}
| 17,016 |
186,250 | 1 | void ExtensionOptionsGuest::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (attached()) {
auto guest_zoom_controller =
ui_zoom::ZoomController::FromWebContents(web_contents());
guest_zoom_controller->SetZoomMode(
ui_zoom::ZoomController::ZOOM_MODE_ISOLATED);
SetGuestZoomLevelToMatchEmbedder();
if (params.url.GetOrigin() != options_page_.GetOrigin()) {
bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(),
bad_message::EOG_BAD_ORIGIN);
}
}
}
| 17,017 |
79,478 | 0 | static int fetch_uidl(char *line, void *data)
{
int i, index;
struct Context *ctx = (struct Context *) data;
struct PopData *pop_data = (struct PopData *) ctx->data;
char *endp = NULL;
errno = 0;
index = strtol(line, &endp, 10);
if (errno)
return -1;
while (*endp == ' ')
endp++;
memmove(line, endp, strlen(endp) + 1);
for (i = 0; i < ctx->msgcount; i++)
if (mutt_str_strcmp(line, ctx->hdrs[i]->data) == 0)
break;
if (i == ctx->msgcount)
{
mutt_debug(1, "new header %d %s\n", index, line);
if (i >= ctx->hdrmax)
mx_alloc_memory(ctx);
ctx->msgcount++;
ctx->hdrs[i] = mutt_header_new();
ctx->hdrs[i]->data = mutt_str_strdup(line);
}
else if (ctx->hdrs[i]->index != index - 1)
pop_data->clear_cache = true;
ctx->hdrs[i]->refno = index;
ctx->hdrs[i]->index = index - 1;
return 0;
}
| 17,018 |
60,097 | 0 | static void list_xtr_archs(RBin *bin, int mode) {
RBinFile *binfile = r_bin_cur (bin);
if (binfile->xtr_data) {
RListIter *iter_xtr;
RBinXtrData *xtr_data;
int bits, i = 0;
char *arch, *machine;
r_list_foreach (binfile->xtr_data, iter_xtr, xtr_data) {
if (!xtr_data || !xtr_data->metadata ||
!xtr_data->metadata->arch) {
continue;
}
arch = xtr_data->metadata->arch;
machine = xtr_data->metadata->machine;
bits = xtr_data->metadata->bits;
switch (mode) {
case 'q':
bin->cb_printf ("%s\n", arch);
break;
case 'j':
bin->cb_printf (
"%s{\"arch\":\"%s\",\"bits\":%d,"
"\"offset\":%" PFMT64d
",\"size\":\"%" PFMT64d
",\"machine\":\"%s\"}",
i++ ? "," : "", arch, bits,
xtr_data->offset, xtr_data->size,
machine);
break;
default:
bin->cb_printf ("%03i 0x%08" PFMT64x
" %" PFMT64d " %s_%i %s\n",
i++, xtr_data->offset,
xtr_data->size, arch, bits,
machine);
break;
}
}
}
}
| 17,019 |
73,635 | 0 | MagickExport const IndexPacket *GetVirtualIndexesFromNexus(const Cache cache,
NexusInfo *nexus_info)
{
CacheInfo
*restrict cache_info;
assert(cache != (Cache) NULL);
cache_info=(CacheInfo *) cache;
assert(cache_info->signature == MagickSignature);
if (cache_info->storage_class == UndefinedClass)
return((IndexPacket *) NULL);
return(nexus_info->indexes);
}
| 17,020 |
77,878 | 0 | test_bson_append_decimal128 (void)
{
bson_t *b;
bson_t *b2;
bson_decimal128_t value;
value.high = 0;
value.low = 1;
b = bson_new ();
BSON_ASSERT (bson_append_decimal128 (b, "a", -1, &value));
b2 = get_bson ("test58.bson");
BSON_ASSERT_BSON_EQUAL (b, b2);
bson_destroy (b);
bson_destroy (b2);
}
| 17,021 |
31,149 | 0 | static int fb_seq_show(struct seq_file *m, void *v)
{
int i = *(loff_t *)v;
struct fb_info *fi = registered_fb[i];
if (fi)
seq_printf(m, "%d %s\n", fi->node, fi->fix.id);
return 0;
}
| 17,022 |
77,792 | 0 | static bool extract_if_dead(struct connectdata *conn,
struct Curl_easy *data)
{
size_t pipeLen = conn->send_pipe.size + conn->recv_pipe.size;
if(!pipeLen && !CONN_INUSE(conn)) {
/* The check for a dead socket makes sense only if there are no
handles in pipeline and the connection isn't already marked in
use */
bool dead;
conn->data = data;
if(conn->handler->connection_check) {
/* The protocol has a special method for checking the state of the
connection. Use it to check if the connection is dead. */
unsigned int state;
state = conn->handler->connection_check(conn, CONNCHECK_ISDEAD);
dead = (state & CONNRESULT_DEAD);
}
else {
/* Use the general method for determining the death of a connection */
dead = SocketIsDead(conn->sock[FIRSTSOCKET]);
}
if(dead) {
infof(data, "Connection %ld seems to be dead!\n", conn->connection_id);
Curl_conncache_remove_conn(conn, FALSE);
conn->data = NULL; /* detach */
return TRUE;
}
}
return FALSE;
}
| 17,023 |
74,457 | 0 | static struct regulator *_regulator_get(struct device *dev, const char *id,
bool exclusive, bool allow_dummy)
{
struct regulator_dev *rdev;
struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
const char *devname = NULL;
int ret;
if (id == NULL) {
pr_err("get() with no identifier\n");
return ERR_PTR(-EINVAL);
}
if (dev)
devname = dev_name(dev);
if (have_full_constraints())
ret = -ENODEV;
else
ret = -EPROBE_DEFER;
mutex_lock(®ulator_list_mutex);
rdev = regulator_dev_lookup(dev, id, &ret);
if (rdev)
goto found;
regulator = ERR_PTR(ret);
/*
* If we have return value from dev_lookup fail, we do not expect to
* succeed, so, quit with appropriate error value
*/
if (ret && ret != -ENODEV)
goto out;
if (!devname)
devname = "deviceless";
/*
* Assume that a regulator is physically present and enabled
* even if it isn't hooked up and just provide a dummy.
*/
if (have_full_constraints() && allow_dummy) {
pr_warn("%s supply %s not found, using dummy regulator\n",
devname, id);
rdev = dummy_regulator_rdev;
goto found;
/* Don't log an error when called from regulator_get_optional() */
} else if (!have_full_constraints() || exclusive) {
dev_warn(dev, "dummy supplies not allowed\n");
}
mutex_unlock(®ulator_list_mutex);
return regulator;
found:
if (rdev->exclusive) {
regulator = ERR_PTR(-EPERM);
goto out;
}
if (exclusive && rdev->open_count) {
regulator = ERR_PTR(-EBUSY);
goto out;
}
if (!try_module_get(rdev->owner))
goto out;
regulator = create_regulator(rdev, dev, id);
if (regulator == NULL) {
regulator = ERR_PTR(-ENOMEM);
module_put(rdev->owner);
goto out;
}
rdev->open_count++;
if (exclusive) {
rdev->exclusive = 1;
ret = _regulator_is_enabled(rdev);
if (ret > 0)
rdev->use_count = 1;
else
rdev->use_count = 0;
}
out:
mutex_unlock(®ulator_list_mutex);
return regulator;
}
| 17,024 |
73,969 | 0 | int cput(int fd, char c) { return write(fd, &c, 1); }
| 17,025 |
74,721 | 0 | void __attribute__ ((weak)) WatchdogHandler(struct pt_regs *regs)
{
/* Generic WatchdogHandler, implement your own */
mtspr(SPRN_TCR, mfspr(SPRN_TCR)&(~TCR_WIE));
return;
}
| 17,026 |
76,880 | 0 | encode_PUSH_VLAN(const struct ofpact_null *null OVS_UNUSED,
enum ofp_version ofp_version, struct ofpbuf *out)
{
if (ofp_version == OFP10_VERSION) {
/* PUSH is a side effect of a SET_VLAN_VID/PCP, which should
* follow this action. */
} else {
/* XXX ETH_TYPE_VLAN_8021AD case */
put_OFPAT11_PUSH_VLAN(out, htons(ETH_TYPE_VLAN_8021Q));
}
}
| 17,027 |
110,605 | 0 | error::Error GLES2DecoderImpl::HandleTexSubImage2D(
uint32 immediate_data_size, const gles2::TexSubImage2D& c) {
TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D");
GLboolean internal = static_cast<GLboolean>(c.internal);
if (internal == GL_TRUE && tex_image_2d_failed_)
return error::kNoError;
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
GLint xoffset = static_cast<GLint>(c.xoffset);
GLint yoffset = static_cast<GLint>(c.yoffset);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
uint32 data_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) {
return error::kOutOfBounds;
}
const void* pixels = GetSharedMemoryAs<const void*>(
c.pixels_shm_id, c.pixels_shm_offset, data_size);
if (!validators_->texture_target.IsValid(target)) {
SetGLErrorInvalidEnum("glTexSubImage2D", target, "target");
return error::kNoError;
}
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0");
return error::kNoError;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0");
return error::kNoError;
}
if (!validators_->texture_format.IsValid(format)) {
SetGLErrorInvalidEnum("glTexSubImage2D", format, "format");
return error::kNoError;
}
if (!validators_->pixel_type.IsValid(type)) {
SetGLErrorInvalidEnum("glTexSubImage2D", type, "type");
return error::kNoError;
}
if (pixels == NULL) {
return error::kOutOfBounds;
}
DoTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, pixels);
return error::kNoError;
}
| 17,028 |
50,006 | 0 | _archive_read_close(struct archive *_a)
{
struct archive_read *a = (struct archive_read *)_a;
int r = ARCHIVE_OK, r1 = ARCHIVE_OK;
archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC,
ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_read_close");
if (a->archive.state == ARCHIVE_STATE_CLOSED)
return (ARCHIVE_OK);
archive_clear_error(&a->archive);
a->archive.state = ARCHIVE_STATE_CLOSED;
/* TODO: Clean up the formatters. */
/* Release the filter objects. */
r1 = __archive_read_close_filters(a);
if (r1 < r)
r = r1;
return (r);
}
| 17,029 |
184,062 | 1 | static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod6(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
DOMStringList* listArg(toDOMStringList(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl->overloadedMethod(listArg);
return JSValue::encode(jsUndefined());
}
| 17,030 |
149,215 | 0 | const views::ProgressBar* MediaControlsProgressView::progress_bar_for_testing()
const {
return progress_bar_;
}
| 17,031 |
139,623 | 0 | size_t AudioContext::cachedSampleFrame() const
{
ASSERT(isMainThread());
return m_cachedSampleFrame;
}
| 17,032 |
135,831 | 0 | const SelectionInDOMTree& SelectionEditor::GetSelectionInDOMTree() const {
AssertSelectionValid();
return selection_;
}
| 17,033 |
94,928 | 0 | static void wait_skb_queue_empty(struct sk_buff_head *q)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
while (!skb_queue_empty(q)) {
spin_unlock_irqrestore(&q->lock, flags);
schedule_timeout(msecs_to_jiffies(UNLINK_TIMEOUT_MS));
set_current_state(TASK_UNINTERRUPTIBLE);
spin_lock_irqsave(&q->lock, flags);
}
spin_unlock_irqrestore(&q->lock, flags);
}
| 17,034 |
3,983 | 0 | GBool FlateStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
| 17,035 |
47,505 | 0 | static int hw_crypt_noxts(struct cryp_ctx *ctx,
struct cryp_device_data *device_data)
{
int ret = 0;
const u8 *indata = ctx->indata;
u8 *outdata = ctx->outdata;
u32 datalen = ctx->datalen;
u32 outlen = datalen;
pr_debug(DEV_DBG_NAME " [%s]", __func__);
ctx->outlen = ctx->datalen;
if (unlikely(!IS_ALIGNED((u32)indata, 4))) {
pr_debug(DEV_DBG_NAME " [%s]: Data isn't aligned! Addr: "
"0x%08x", __func__, (u32)indata);
return -EINVAL;
}
ret = cryp_setup_context(ctx, device_data);
if (ret)
goto out;
if (cryp_mode == CRYP_MODE_INTERRUPT) {
cryp_enable_irq_src(device_data, CRYP_IRQ_SRC_INPUT_FIFO |
CRYP_IRQ_SRC_OUTPUT_FIFO);
/*
* ctx->outlen is decremented in the cryp_interrupt_handler
* function. We had to add cpu_relax() (barrier) to make sure
* that gcc didn't optimze away this variable.
*/
while (ctx->outlen > 0)
cpu_relax();
} else if (cryp_mode == CRYP_MODE_POLLING ||
cryp_mode == CRYP_MODE_DMA) {
/*
* The reason for having DMA in this if case is that if we are
* running cryp_mode = 2, then we separate DMA routines for
* handling cipher/plaintext > blocksize, except when
* running the normal CRYPTO_ALG_TYPE_CIPHER, then we still use
* the polling mode. Overhead of doing DMA setup eats up the
* benefits using it.
*/
cryp_polling_mode(ctx, device_data);
} else {
dev_err(ctx->device->dev, "[%s]: Invalid operation mode!",
__func__);
ret = -EPERM;
goto out;
}
cryp_save_device_context(device_data, &ctx->dev_ctx, cryp_mode);
ctx->updated = 1;
out:
ctx->indata = indata;
ctx->outdata = outdata;
ctx->datalen = datalen;
ctx->outlen = outlen;
return ret;
}
| 17,036 |
160,843 | 0 | void WebViewTestClient::PrintPage(blink::WebLocalFrame* frame) {
blink::WebSize page_size_in_pixels = frame->View()->Size();
if (page_size_in_pixels.IsEmpty())
return;
blink::WebPrintParams printParams(page_size_in_pixels);
frame->PrintBegin(printParams);
frame->PrintEnd();
}
| 17,037 |
109,073 | 0 | WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace(
unsigned quota) {
CHECK(session_storage_namespace_id_ !=
dom_storage::kInvalidSessionStorageNamespaceId);
return new WebStorageNamespaceImpl(session_storage_namespace_id_);
}
| 17,038 |
51,069 | 0 | static int ovl_rmdir(struct inode *dir, struct dentry *dentry)
{
return ovl_do_remove(dentry, true);
}
| 17,039 |
166,851 | 0 | ~ExpectNoWriteBarrierFires() {
EXPECT_TRUE(marking_worklist_->IsGlobalEmpty());
for (const auto& pair : headers_) {
EXPECT_EQ(pair.second, pair.first->IsMarked());
pair.first->Unmark();
}
}
| 17,040 |
164,065 | 0 | void DownloadManagerImpl::SetNextId(uint32_t next_id) {
if (next_id > next_download_id_)
next_download_id_ = next_id;
if (!IsNextIdInitialized())
return;
for (auto& callback : id_callbacks_)
std::move(*callback).Run(next_download_id_++);
id_callbacks_.clear();
}
| 17,041 |
7,236 | 0 | static inline void php_rinit_session_globals(TSRMLS_D) /* {{{ */
{
PS(mod_data) = NULL;
PS(mod_user_is_open) = 0;
/* Do NOT init PS(mod_user_names) here! */
PS(http_session_vars) = NULL;
}
/* }}} */
| 17,042 |
92,941 | 0 | lspci_send(const char *output)
{
STREAM s;
size_t len;
len = strlen(output);
s = channel_init(lspci_channel, len);
out_uint8p(s, output, len) s_mark_end(s);
channel_send(s, lspci_channel);
}
| 17,043 |
114,163 | 0 | bool VolumeSupportsACLs(const wchar_t* any_path) {
wchar_t expand[MAX_PATH +1];
DWORD len =::ExpandEnvironmentStringsW(any_path, expand, _countof(expand));
if (0 == len) return false;
if (len > _countof(expand)) return false;
if (!::PathStripToRootW(expand)) return false;
DWORD fs_flags = 0;
if (!::GetVolumeInformationW(expand, NULL, 0, 0, NULL, &fs_flags, NULL, 0))
return false;
if (fs_flags & FILE_PERSISTENT_ACLS) return true;
return false;
}
| 17,044 |
162,942 | 0 | ResourceCoordinatorService::~ResourceCoordinatorService() {
ref_factory_.reset();
}
| 17,045 |
132,877 | 0 | void SetContentsScaleOnBothLayers(float contents_scale,
float device_scale_factor,
float page_scale_factor,
float maximum_animation_contents_scale,
bool animating_transform) {
SetupDrawPropertiesAndUpdateTiles(pending_layer_,
contents_scale,
device_scale_factor,
page_scale_factor,
maximum_animation_contents_scale,
animating_transform);
SetupDrawPropertiesAndUpdateTiles(active_layer_,
contents_scale,
device_scale_factor,
page_scale_factor,
maximum_animation_contents_scale,
animating_transform);
}
| 17,046 |
62,369 | 0 | wb_drawop(netdissect_options *ndo,
const struct pkt_dop *dop, u_int len)
{
ND_PRINT((ndo, " wb-dop:"));
if (len < sizeof(*dop) || !ND_TTEST(*dop))
return (-1);
len -= sizeof(*dop);
ND_PRINT((ndo, " %s:%u<%u:%u>",
ipaddr_string(ndo, &dop->pd_page.p_sid),
EXTRACT_32BITS(&dop->pd_page.p_uid),
EXTRACT_32BITS(&dop->pd_sseq),
EXTRACT_32BITS(&dop->pd_eseq)));
if (ndo->ndo_vflag)
return (wb_dops(ndo, dop,
EXTRACT_32BITS(&dop->pd_sseq),
EXTRACT_32BITS(&dop->pd_eseq)));
return (0);
}
| 17,047 |
145,194 | 0 | void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
extensions::ResourceBundleSourceMap* source_map) {
source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
source_map->RegisterSource("browserAction",
IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("certificateProvider",
IDR_CERTIFICATE_PROVIDER_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("declarativeContent",
IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("desktopCapture",
IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("developerPrivate",
IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("downloads", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("enterprise.platformKeys",
IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("enterprise.platformKeys.internalAPI",
IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS);
source_map->RegisterSource("enterprise.platformKeys.KeyPair",
IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS);
source_map->RegisterSource("enterprise.platformKeys.SubtleCrypto",
IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS);
source_map->RegisterSource("enterprise.platformKeys.Token",
IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS);
source_map->RegisterSource("feedbackPrivate",
IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("fileBrowserHandler",
IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("fileManagerPrivate",
IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("fileSystem", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("fileSystemProvider",
IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("gcm", IDR_GCM_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("identity", IDR_IDENTITY_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("imageWriterPrivate",
IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("logPrivate", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("mediaGalleries",
IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("notifications",
IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("pageCapture",
IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("platformKeys",
IDR_PLATFORM_KEYS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("platformKeys.getPublicKey",
IDR_PLATFORM_KEYS_GET_PUBLIC_KEY_JS);
source_map->RegisterSource("platformKeys.internalAPI",
IDR_PLATFORM_KEYS_INTERNAL_API_JS);
source_map->RegisterSource("platformKeys.Key", IDR_PLATFORM_KEYS_KEY_JS);
source_map->RegisterSource("platformKeys.SubtleCrypto",
IDR_PLATFORM_KEYS_SUBTLE_CRYPTO_JS);
source_map->RegisterSource("platformKeys.utils", IDR_PLATFORM_KEYS_UTILS_JS);
source_map->RegisterSource("syncFileSystem",
IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("systemIndicator",
IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("terminalPrivate",
IDR_TERMINAL_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS);
#if defined(ENABLE_WEBRTC)
source_map->RegisterSource("cast.streaming.rtpStream",
IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("cast.streaming.session",
IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource(
"cast.streaming.udpTransport",
IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS);
source_map->RegisterSource(
"cast.streaming.receiverSession",
IDR_CAST_STREAMING_RECEIVER_SESSION_CUSTOM_BINDINGS_JS);
#endif
source_map->RegisterSource(
"webrtcDesktopCapturePrivate",
IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS);
source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS);
source_map->RegisterSource("ChromeDirectSetting",
IDR_CHROME_DIRECT_SETTING_JS);
source_map->RegisterSource("fileEntryBindingUtil",
IDR_FILE_ENTRY_BINDING_UTIL_JS);
source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS);
source_map->RegisterSource("chromeWebViewInternal",
IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS);
}
| 17,048 |
9,213 | 0 | hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n)
{
return vdev->vq[n].vring.avail;
}
| 17,049 |
57,880 | 0 | static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
unsigned long addr, int page_nid,
int *flags)
{
get_page(page);
count_vm_numa_event(NUMA_HINT_FAULTS);
if (page_nid == numa_node_id()) {
count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
*flags |= TNF_FAULT_LOCAL;
}
return mpol_misplaced(page, vma, addr);
}
| 17,050 |
74,358 | 0 | InitializeMAC(PPARANDIS_ADAPTER pContext, PUCHAR pCurrentMAC)
{
pContext->bCfgMACAddrSupported = AckFeature(pContext, VIRTIO_NET_F_MAC);
pContext->bCtrlMACAddrSupported = AckFeature(pContext, VIRTIO_NET_F_CTRL_MAC_ADDR);
if (pContext->bCfgMACAddrSupported)
{
VirtIODeviceGet(pContext->IODevice, 0, &pContext->PermanentMacAddress, ETH_LENGTH_OF_ADDRESS);
if (!ParaNdis_ValidateMacAddress(pContext->PermanentMacAddress, FALSE))
{
DumpMac(0, "Invalid device MAC ignored", pContext->PermanentMacAddress);
NdisZeroMemory(pContext->PermanentMacAddress, sizeof(pContext->PermanentMacAddress));
}
}
if (ETH_IS_EMPTY(pContext->PermanentMacAddress))
{
pContext->PermanentMacAddress[0] = 0x02;
pContext->PermanentMacAddress[1] = 0x50;
pContext->PermanentMacAddress[2] = 0xF2;
pContext->PermanentMacAddress[3] = 0x00;
pContext->PermanentMacAddress[4] = 0x01;
pContext->PermanentMacAddress[5] = 0x80 | (UCHAR)(pContext->ulUniqueID & 0xFF);
DumpMac(0, "No device MAC present, use default", pContext->PermanentMacAddress);
}
DumpMac(0, "Permanent device MAC", pContext->PermanentMacAddress);
if (ParaNdis_ValidateMacAddress(pCurrentMAC, TRUE))
{
DPrintf(0, ("[%s] MAC address from configuration used\n", __FUNCTION__));
ETH_COPY_NETWORK_ADDRESS(pContext->CurrentMacAddress, pCurrentMAC);
}
else
{
DPrintf(0, ("No valid MAC configured\n", __FUNCTION__));
ETH_COPY_NETWORK_ADDRESS(pContext->CurrentMacAddress, pContext->PermanentMacAddress);
}
SetDeviceMAC(pContext, pContext->CurrentMacAddress);
DumpMac(0, "Actual MAC", pContext->CurrentMacAddress);
}
| 17,051 |
30,200 | 0 | static int ftrace_process_regex(struct ftrace_hash *hash,
char *buff, int len, int enable)
{
char *func, *command, *next = buff;
struct ftrace_func_command *p;
int ret = -EINVAL;
func = strsep(&next, ":");
if (!next) {
ret = ftrace_match_records(hash, func, len);
if (!ret)
ret = -EINVAL;
if (ret < 0)
return ret;
return 0;
}
/* command found */
command = strsep(&next, ":");
mutex_lock(&ftrace_cmd_mutex);
list_for_each_entry(p, &ftrace_commands, list) {
if (strcmp(p->name, command) == 0) {
ret = p->func(hash, func, command, next, enable);
goto out_unlock;
}
}
out_unlock:
mutex_unlock(&ftrace_cmd_mutex);
return ret;
}
| 17,052 |
45,155 | 0 | static req_table_t* req_subprocess_env(request_rec *r)
{
req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t));
t->r = r;
t->t = r->subprocess_env;
t->n = "subprocess_env";
return t;
}
| 17,053 |
26,824 | 0 | static unsigned mounts_poll(struct file *file, poll_table *wait)
{
struct proc_mounts *p = file->private_data;
unsigned res = POLLIN | POLLRDNORM;
poll_wait(file, &p->ns->poll, wait);
if (mnt_had_events(p))
res |= POLLERR | POLLPRI;
return res;
}
| 17,054 |
133,156 | 0 | void HWNDMessageHandler::Restore() {
ExecuteSystemMenuCommand(SC_RESTORE);
}
| 17,055 |
101,017 | 0 | void QuotaManager::GetCachedOrigins(
StorageType type, std::set<GURL>* origins) {
DCHECK(origins);
LazyInitialize();
switch (type) {
case kStorageTypeTemporary:
DCHECK(temporary_usage_tracker_.get());
temporary_usage_tracker_->GetCachedOrigins(origins);
return;
case kStorageTypePersistent:
DCHECK(persistent_usage_tracker_.get());
persistent_usage_tracker_->GetCachedOrigins(origins);
return;
default:
NOTREACHED();
}
}
| 17,056 |
28,855 | 0 | int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
{
int r;
struct msr_data msr;
r = vcpu_load(vcpu);
if (r)
return r;
msr.data = 0x0;
msr.index = MSR_IA32_TSC;
msr.host_initiated = true;
kvm_write_tsc(vcpu, &msr);
vcpu_put(vcpu);
return r;
}
| 17,057 |
138,100 | 0 | static LayoutBlockFlow* nonInlineBlockFlow(LayoutObject* object) {
LayoutObject* current = object;
while (current) {
if (current->isLayoutBlockFlow()) {
LayoutBlockFlow* blockFlow = toLayoutBlockFlow(current);
if (!blockFlow->inlineBoxWrapper())
return blockFlow;
}
current = current->parent();
}
ASSERT_NOT_REACHED();
return nullptr;
}
| 17,058 |
60,083 | 0 | static int read_reloc(ELFOBJ *bin, RBinElfReloc *r, int is_rela, ut64 offset) {
ut8 *buf = bin->b->buf;
int j = 0;
if (offset + sizeof (Elf_ (Rela)) >
bin->size || offset + sizeof (Elf_(Rela)) < offset) {
return -1;
}
if (is_rela == DT_RELA) {
Elf_(Rela) rela;
#if R_BIN_ELF64
rela.r_offset = READ64 (buf + offset, j)
rela.r_info = READ64 (buf + offset, j)
rela.r_addend = READ64 (buf + offset, j)
#else
rela.r_offset = READ32 (buf + offset, j)
rela.r_info = READ32 (buf + offset, j)
rela.r_addend = READ32 (buf + offset, j)
#endif
r->is_rela = is_rela;
r->offset = rela.r_offset;
r->type = ELF_R_TYPE (rela.r_info);
r->sym = ELF_R_SYM (rela.r_info);
r->last = 0;
r->addend = rela.r_addend;
return sizeof (Elf_(Rela));
} else {
Elf_(Rel) rel;
#if R_BIN_ELF64
rel.r_offset = READ64 (buf + offset, j)
rel.r_info = READ64 (buf + offset, j)
#else
rel.r_offset = READ32 (buf + offset, j)
rel.r_info = READ32 (buf + offset, j)
#endif
r->is_rela = is_rela;
r->offset = rel.r_offset;
r->type = ELF_R_TYPE (rel.r_info);
r->sym = ELF_R_SYM (rel.r_info);
r->last = 0;
return sizeof (Elf_(Rel));
}
}
| 17,059 |
161,688 | 0 | VaapiPicture* VaapiVideoDecodeAccelerator::PictureById(
int32_t picture_buffer_id) {
Pictures::iterator it = pictures_.find(picture_buffer_id);
if (it == pictures_.end()) {
VLOGF(4) << "Picture id " << picture_buffer_id << " does not exist";
return NULL;
}
return it->second.get();
}
| 17,060 |
141,341 | 0 | const AtomicString& Document::linkColor() const {
return BodyAttributeValue(kLinkAttr);
}
| 17,061 |
27,840 | 0 | static int __init default_policy_setup(char *str)
{
ima_use_tcb = 1;
return 1;
}
| 17,062 |
4,924 | 0 | SProcXSendExtensionEvent(ClientPtr client)
{
CARD32 *p;
int i;
xEvent eventT = { .u.u.type = 0 };
xEvent *eventP;
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination);
swaps(&stuff->count);
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
return BadLength;
eventP = (xEvent *) &stuff[1];
for (i = 0; i < stuff->num_events; i++, eventP++) {
proc = EventSwapVector[eventP->u.u.type & 0177];
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
return BadValue;
(*proc) (eventP, &eventT);
*eventP = eventT;
}
p = (CARD32 *) (((xEvent *) &stuff[1]) + stuff->num_events);
SwapLongs(p, stuff->count);
return (ProcXSendExtensionEvent(client));
}
| 17,063 |
12,455 | 0 | BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BIGNUM *N)
{
BIGNUM *tmp = NULL, *S = NULL;
BN_CTX *bn_ctx;
if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
return NULL;
if ((bn_ctx = BN_CTX_new()) == NULL ||
(tmp = BN_new()) == NULL ||
(S = BN_new()) == NULL )
goto err;
/* S = (A*v**u) ** b */
if (!BN_mod_exp(tmp,v,u,N,bn_ctx))
goto err;
if (!BN_mod_mul(tmp,A,tmp,N,bn_ctx))
goto err;
if (!BN_mod_exp(S,tmp,b,N,bn_ctx))
goto err;
err:
BN_CTX_free(bn_ctx);
BN_clear_free(tmp);
return S;
}
| 17,064 |
168,751 | 0 | mojom::WidgetInputHandler* RenderWidgetHostImpl::GetWidgetInputHandler() {
if (associated_widget_input_handler_)
return associated_widget_input_handler_.get();
if (widget_input_handler_)
return widget_input_handler_.get();
return legacy_widget_input_handler_.get();
}
| 17,065 |
81,842 | 0 | static int find_hole(void)
{
unsigned x;
int y, z;
for (z = -1, y = INT_MAX, x = 0; x < FP_ENTRIES; x++) {
if (fp_cache[x].lru_count < y && fp_cache[x].lock == 0) {
z = x;
y = fp_cache[x].lru_count;
}
}
/* decrease all */
for (x = 0; x < FP_ENTRIES; x++) {
if (fp_cache[x].lru_count > 3) {
--(fp_cache[x].lru_count);
}
}
/* free entry z */
if (z >= 0 && fp_cache[z].g) {
mp_clear(&fp_cache[z].mu);
wc_ecc_del_point(fp_cache[z].g);
fp_cache[z].g = NULL;
for (x = 0; x < (1U<<FP_LUT); x++) {
wc_ecc_del_point(fp_cache[z].LUT[x]);
fp_cache[z].LUT[x] = NULL;
}
fp_cache[z].lru_count = 0;
}
return z;
}
| 17,066 |
93,679 | 0 | static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
size_t len, u_char *buf)
{
int ret;
ret = cqspi_set_protocol(nor, 1);
if (ret)
return ret;
ret = cqspi_indirect_read_setup(nor, from);
if (ret)
return ret;
ret = cqspi_indirect_read_execute(nor, buf, len);
if (ret)
return ret;
return (ret < 0) ? ret : len;
}
| 17,067 |
113,757 | 0 | void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) {
StopWorker(document_cookie);
}
| 17,068 |
136,809 | 0 | int LocalDOMWindow::innerWidth() const {
if (!GetFrame())
return 0;
return AdjustForAbsoluteZoom::AdjustInt(GetViewportSize().Width(),
GetFrame()->PageZoomFactor());
}
| 17,069 |
107,315 | 0 | TabContents* Browser::OpenApplicationTab(Profile* profile,
const Extension* extension,
TabContents* existing_tab) {
Browser* browser =
BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL, false);
TabContents* contents = NULL;
if (!browser)
return contents;
ExtensionService* extensions_service = profile->GetExtensionService();
DCHECK(extensions_service);
ExtensionPrefs::LaunchType launch_type =
extensions_service->extension_prefs()->GetLaunchType(
extension->id(), ExtensionPrefs::LAUNCH_DEFAULT);
UMA_HISTOGRAM_ENUMERATION("Extensions.AppTabLaunchType", launch_type, 100);
int add_type = TabStripModel::ADD_SELECTED;
if (launch_type == ExtensionPrefs::LAUNCH_PINNED)
add_type |= TabStripModel::ADD_PINNED;
GURL extension_url = extension->GetFullLaunchURL();
if (!extension_url.is_valid()) {
extension_url = extension->options_url();
if (!extension_url.is_valid())
extension_url = GURL(chrome::kChromeUIExtensionsURL);
}
browser::NavigateParams params(browser, extension_url,
PageTransition::START_PAGE);
params.tabstrip_add_types = add_type;
if (existing_tab) {
TabStripModel* model = browser->tabstrip_model();
int tab_index = model->GetWrapperIndex(existing_tab);
existing_tab->OpenURL(extension->GetFullLaunchURL(), existing_tab->GetURL(),
CURRENT_TAB, PageTransition::LINK);
if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
model->SetTabPinned(tab_index, true);
tab_index = model->GetWrapperIndex(existing_tab);
}
if (params.tabstrip_add_types & TabStripModel::ADD_SELECTED)
model->SelectTabContentsAt(tab_index, true);
contents = existing_tab;
} else {
params.disposition = NEW_FOREGROUND_TAB;
browser::Navigate(¶ms);
contents = params.target_contents->tab_contents();
}
if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN &&
!browser->window()->IsFullscreen())
browser->ToggleFullscreenMode();
return contents;
}
| 17,070 |
118,657 | 0 | void UserCloudPolicyManagerChromeOS::StartRefreshSchedulerIfReady() {
if (core()->refresh_scheduler())
return; // Already started.
if (wait_for_policy_fetch_)
return; // Still waiting for the initial, blocking fetch.
if (!service() || !local_state_)
return; // Not connected.
if (component_policy_service() &&
!component_policy_service()->is_initialized()) {
return;
}
core()->StartRefreshScheduler();
core()->TrackRefreshDelayPref(local_state_,
policy_prefs::kUserPolicyRefreshRate);
}
| 17,071 |
7,915 | 0 | static void cstmlist(JF, js_Ast *list)
{
while (list) {
cstm(J, F, list->a);
list = list->b;
}
}
| 17,072 |
84,279 | 0 | static int unqueue_me(struct futex_q *q)
{
spinlock_t *lock_ptr;
int ret = 0;
/* In the common case we don't take the spinlock, which is nice. */
retry:
/*
* q->lock_ptr can change between this read and the following spin_lock.
* Use READ_ONCE to forbid the compiler from reloading q->lock_ptr and
* optimizing lock_ptr out of the logic below.
*/
lock_ptr = READ_ONCE(q->lock_ptr);
if (lock_ptr != NULL) {
spin_lock(lock_ptr);
/*
* q->lock_ptr can change between reading it and
* spin_lock(), causing us to take the wrong lock. This
* corrects the race condition.
*
* Reasoning goes like this: if we have the wrong lock,
* q->lock_ptr must have changed (maybe several times)
* between reading it and the spin_lock(). It can
* change again after the spin_lock() but only if it was
* already changed before the spin_lock(). It cannot,
* however, change back to the original value. Therefore
* we can detect whether we acquired the correct lock.
*/
if (unlikely(lock_ptr != q->lock_ptr)) {
spin_unlock(lock_ptr);
goto retry;
}
__unqueue_futex(q);
BUG_ON(q->pi_state);
spin_unlock(lock_ptr);
ret = 1;
}
drop_futex_key_refs(&q->key);
return ret;
}
| 17,073 |
93,986 | 0 | static size_t check_sep(php_http_params_state_t *state, php_http_params_token_t **separators)
{
php_http_params_token_t **sep = separators;
if (state->quotes || state->escape) {
return 0;
}
if (sep) while (*sep) {
if (check_str(state->input.str, state->input.len, (*sep)->str, (*sep)->len)) {
return (*sep)->len;
}
++sep;
}
return 0;
}
| 17,074 |
14,116 | 0 | SProcRenderReferenceGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderReferenceGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->gsid, n);
swapl(&stuff->existing, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| 17,075 |
52,540 | 0 | static void close_connection_now(h2o_http2_conn_t *conn)
{
h2o_http2_stream_t *stream;
assert(!h2o_timeout_is_linked(&conn->_write.timeout_entry));
kh_foreach_value(conn->streams, stream, { h2o_http2_stream_close(conn, stream); });
assert(conn->num_streams.pull.open == 0);
assert(conn->num_streams.pull.half_closed == 0);
assert(conn->num_streams.pull.send_body == 0);
assert(conn->num_streams.push.half_closed == 0);
assert(conn->num_streams.push.send_body == 0);
assert(conn->num_streams.priority.open == 0);
kh_destroy(h2o_http2_stream_t, conn->streams);
assert(conn->_http1_req_input == NULL);
h2o_hpack_dispose_header_table(&conn->_input_header_table);
h2o_hpack_dispose_header_table(&conn->_output_header_table);
assert(h2o_linklist_is_empty(&conn->_pending_reqs));
h2o_timeout_unlink(&conn->_timeout_entry);
h2o_buffer_dispose(&conn->_write.buf);
if (conn->_write.buf_in_flight != NULL)
h2o_buffer_dispose(&conn->_write.buf_in_flight);
h2o_http2_scheduler_dispose(&conn->scheduler);
assert(h2o_linklist_is_empty(&conn->_write.streams_to_proceed));
assert(!h2o_timeout_is_linked(&conn->_write.timeout_entry));
if (conn->_headers_unparsed != NULL)
h2o_buffer_dispose(&conn->_headers_unparsed);
if (conn->casper != NULL)
h2o_http2_casper_destroy(conn->casper);
h2o_linklist_unlink(&conn->_conns);
if (conn->sock != NULL)
h2o_socket_close(conn->sock);
free(conn);
}
| 17,076 |
106,245 | 0 | void setJSTestObjWithScriptExecutionContextAttributeRaises(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return;
impl->setWithScriptExecutionContextAttributeRaises(scriptContext, toTestObj(value), ec);
setDOMException(exec, ec);
}
| 17,077 |
146,676 | 0 | void PageInfoBubbleView::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) {
if (render_frame_host == web_contents()->GetMainFrame()) {
GetWidget()->Close();
}
}
| 17,078 |
179,451 | 1 | static inline int mk_vhost_fdt_open(int id, unsigned int hash,
struct session_request *sr)
{
int i;
int fd;
struct vhost_fdt_hash_table *ht = NULL;
struct vhost_fdt_hash_chain *hc;
if (config->fdt == MK_FALSE) {
return open(sr->real_path.data, sr->file_info.flags_read_only);
}
ht = mk_vhost_fdt_table_lookup(id, sr->host_conf);
if (mk_unlikely(!ht)) {
return open(sr->real_path.data, sr->file_info.flags_read_only);
}
/* We got the hash table, now look around the chains array */
hc = mk_vhost_fdt_chain_lookup(hash, ht);
if (hc) {
/* Increment the readers and return the shared FD */
hc->readers++;
return hc->fd;
}
/*
* Get here means that no entry exists in the hash table for the
* requested file descriptor and hash, we must try to open the file
* and register the entry in the table.
*/
fd = open(sr->real_path.data, sr->file_info.flags_read_only);
if (fd == -1) {
return -1;
}
/* If chains are full, just return the new FD, bad luck... */
if (ht->av_slots <= 0) {
return fd;
}
/* Register the new entry in an available slot */
for (i = 0; i < VHOST_FDT_HASHTABLE_CHAINS; i++) {
hc = &ht->chain[i];
if (hc->fd == -1) {
hc->fd = fd;
hc->hash = hash;
hc->readers++;
ht->av_slots--;
sr->vhost_fdt_id = id;
sr->vhost_fdt_hash = hash;
return fd;
}
}
return -1;
}
| 17,079 |
12,845 | 0 | static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
const ASN1_TEMPLATE *tt, int tag, int iclass)
{
int i, ret, flags, ttag, tclass, ndef;
flags = tt->flags;
/*
* Work out tag and class to use: tagging may come either from the
* template or the arguments, not both because this would create
* ambiguity. Additionally the iclass argument may contain some
* additional flags which should be noted and passed down to other
* levels.
*/
if (flags & ASN1_TFLG_TAG_MASK) {
/* Error if argument and template tagging */
if (tag != -1)
/* FIXME: error code here */
return -1;
/* Get tagging from template */
ttag = tt->tag;
tclass = flags & ASN1_TFLG_TAG_CLASS;
} else if (tag != -1) {
/* No template tagging, get from arguments */
ttag = tag;
tclass = iclass & ASN1_TFLG_TAG_CLASS;
} else {
ttag = -1;
tclass = 0;
}
/*
* Remove any class mask from iflag.
*/
iclass &= ~ASN1_TFLG_TAG_CLASS;
/*
* At this point 'ttag' contains the outer tag to use, 'tclass' is the
* class and iclass is any flags passed to this function.
*/
/* if template and arguments require ndef, use it */
if ((flags & ASN1_TFLG_NDEF) && (iclass & ASN1_TFLG_NDEF))
ndef = 2;
else
ndef = 1;
if (flags & ASN1_TFLG_SK_MASK) {
/* SET OF, SEQUENCE OF */
STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
int isset, sktag, skaclass;
int skcontlen, sklen;
ASN1_VALUE *skitem;
if (!*pval)
return 0;
if (flags & ASN1_TFLG_SET_OF) {
isset = 1;
/* 2 means we reorder */
if (flags & ASN1_TFLG_SEQUENCE_OF)
isset = 2;
} else
isset = 0;
/*
* Work out inner tag value: if EXPLICIT or no tagging use underlying
* type.
*/
if ((ttag != -1) && !(flags & ASN1_TFLG_EXPTAG)) {
sktag = ttag;
skaclass = tclass;
} else {
skaclass = V_ASN1_UNIVERSAL;
if (isset)
sktag = V_ASN1_SET;
else
sktag = V_ASN1_SEQUENCE;
}
/* Determine total length of items */
skcontlen = 0;
for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
skitem = sk_ASN1_VALUE_value(sk, i);
skcontlen += ASN1_item_ex_i2d(&skitem, NULL,
ASN1_ITEM_ptr(tt->item),
-1, iclass);
}
sklen = ASN1_object_size(ndef, skcontlen, sktag);
/* If EXPLICIT need length of surrounding tag */
if (flags & ASN1_TFLG_EXPTAG)
ret = ASN1_object_size(ndef, sklen, ttag);
else
ret = sklen;
if (!out)
return ret;
/* Now encode this lot... */
/* EXPLICIT tag */
if (flags & ASN1_TFLG_EXPTAG)
ASN1_put_object(out, ndef, sklen, ttag, tclass);
/* SET or SEQUENCE and IMPLICIT tag */
ASN1_put_object(out, ndef, skcontlen, sktag, skaclass);
/* And the stuff itself */
asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item),
isset, iclass);
if (ndef == 2) {
ASN1_put_eoc(out);
if (flags & ASN1_TFLG_EXPTAG)
ASN1_put_eoc(out);
}
return ret;
}
if (flags & ASN1_TFLG_EXPTAG) {
/* EXPLICIT tagging */
/* Find length of tagged item */
i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, iclass);
if (!i)
return 0;
/* Find length of EXPLICIT tag */
ret = ASN1_object_size(ndef, i, ttag);
if (out) {
/* Output tag and item */
ASN1_put_object(out, ndef, i, ttag, tclass);
ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, iclass);
if (ndef == 2)
ASN1_put_eoc(out);
}
return ret;
}
/* Either normal or IMPLICIT tagging: combine class and flags */
return ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item),
ttag, tclass | iclass);
}
| 17,080 |
47,359 | 0 | static int sha224_init(struct shash_desc *desc)
{
struct sha256_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA224_H0;
sctx->state[1] = SHA224_H1;
sctx->state[2] = SHA224_H2;
sctx->state[3] = SHA224_H3;
sctx->state[4] = SHA224_H4;
sctx->state[5] = SHA224_H5;
sctx->state[6] = SHA224_H6;
sctx->state[7] = SHA224_H7;
sctx->count = 0;
return 0;
}
| 17,081 |
59,641 | 0 | uriCommonTest(const char *filename,
const char *result,
const char *err,
const char *base) {
char *temp;
FILE *o, *f;
char str[1024];
int res = 0, i, ret;
temp = resultFilename(filename, "", ".res");
if (temp == NULL) {
fprintf(stderr, "Out of memory\n");
fatalError();
}
o = fopen(temp, "wb");
if (o == NULL) {
fprintf(stderr, "failed to open output file %s\n", temp);
free(temp);
return(-1);
}
f = fopen(filename, "rb");
if (f == NULL) {
fprintf(stderr, "failed to open input file %s\n", filename);
fclose(o);
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(-1);
}
while (1) {
/*
* read one line in string buffer.
*/
if (fgets (&str[0], sizeof (str) - 1, f) == NULL)
break;
/*
* remove the ending spaces
*/
i = strlen(str);
while ((i > 0) &&
((str[i - 1] == '\n') || (str[i - 1] == '\r') ||
(str[i - 1] == ' ') || (str[i - 1] == '\t'))) {
i--;
str[i] = 0;
}
nb_tests++;
handleURI(str, base, o);
}
fclose(f);
fclose(o);
if (result != NULL) {
ret = compareFiles(temp, result);
if (ret) {
fprintf(stderr, "Result for %s failed in %s\n", filename, result);
res = 1;
}
}
if (err != NULL) {
ret = compareFileMem(err, testErrors, testErrorsSize);
if (ret != 0) {
fprintf(stderr, "Error for %s failed\n", filename);
res = 1;
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(res);
}
| 17,082 |
131,615 | 0 | static void raisesExceptionLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 17,083 |
23,662 | 0 | isdn_net_reset(struct net_device *dev)
{
#ifdef CONFIG_ISDN_X25
struct concap_device_ops * dops =
((isdn_net_local *) netdev_priv(dev))->dops;
struct concap_proto * cprot =
((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
#endif
#ifdef CONFIG_ISDN_X25
if( cprot && cprot -> pops && dops )
cprot -> pops -> restart ( cprot, dev, dops );
#endif
}
| 17,084 |
65,329 | 0 | nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_getattr *getattr)
{
__be32 status;
status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
if (status)
return status;
if (getattr->ga_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)
return nfserr_inval;
getattr->ga_bmval[0] &= nfsd_suppattrs[cstate->minorversion][0];
getattr->ga_bmval[1] &= nfsd_suppattrs[cstate->minorversion][1];
getattr->ga_bmval[2] &= nfsd_suppattrs[cstate->minorversion][2];
getattr->ga_fhp = &cstate->current_fh;
return nfs_ok;
}
| 17,085 |
126,984 | 0 | void AudioRendererHost::OnCreated(media::AudioOutputController* controller) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(
&AudioRendererHost::DoCompleteCreation,
this,
make_scoped_refptr(controller)));
}
| 17,086 |
91,410 | 0 | static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn)
{
struct bpf_reg_state *regs = cur_regs(env);
u8 mode = BPF_MODE(insn->code);
int i, err;
if (!may_access_skb(env->prog->type)) {
verbose(env, "BPF_LD_[ABS|IND] instructions not allowed for this program type\n");
return -EINVAL;
}
if (!env->ops->gen_ld_abs) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
if (env->subprog_cnt > 1) {
/* when program has LD_ABS insn JITs and interpreter assume
* that r1 == ctx == skb which is not the case for callees
* that can have arbitrary arguments. It's problematic
* for main prog as well since JITs would need to analyze
* all functions in order to make proper register save/restore
* decisions in the main prog. Hence disallow LD_ABS with calls
*/
verbose(env, "BPF_LD_[ABS|IND] instructions cannot be mixed with bpf-to-bpf calls\n");
return -EINVAL;
}
if (insn->dst_reg != BPF_REG_0 || insn->off != 0 ||
BPF_SIZE(insn->code) == BPF_DW ||
(mode == BPF_ABS && insn->src_reg != BPF_REG_0)) {
verbose(env, "BPF_LD_[ABS|IND] uses reserved fields\n");
return -EINVAL;
}
/* check whether implicit source operand (register R6) is readable */
err = check_reg_arg(env, BPF_REG_6, SRC_OP);
if (err)
return err;
/* Disallow usage of BPF_LD_[ABS|IND] with reference tracking, as
* gen_ld_abs() may terminate the program at runtime, leading to
* reference leak.
*/
err = check_reference_leak(env);
if (err) {
verbose(env, "BPF_LD_[ABS|IND] cannot be mixed with socket references\n");
return err;
}
if (regs[BPF_REG_6].type != PTR_TO_CTX) {
verbose(env,
"at the time of BPF_LD_ABS|IND R6 != pointer to skb\n");
return -EINVAL;
}
if (mode == BPF_IND) {
/* check explicit source operand */
err = check_reg_arg(env, insn->src_reg, SRC_OP);
if (err)
return err;
}
/* reset caller saved regs to unreadable */
for (i = 0; i < CALLER_SAVED_REGS; i++) {
mark_reg_not_init(env, regs, caller_saved[i]);
check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK);
}
/* mark destination R0 register as readable, since it contains
* the value fetched from the packet.
* Already marked as written above.
*/
mark_reg_unknown(env, regs, BPF_REG_0);
return 0;
}
| 17,087 |
65,093 | 0 | static inline size_t ColorTo565(const DDSVector3 point)
{
size_t r = ClampToLimit(31.0f*point.x,31);
size_t g = ClampToLimit(63.0f*point.y,63);
size_t b = ClampToLimit(31.0f*point.z,31);
return (r << 11) | (g << 5) | b;
}
| 17,088 |
9,501 | 0 | root_distance(peer_t *p)
{
/* The root synchronization distance is the maximum error due to
* all causes of the local clock relative to the primary server.
* It is defined as half the total delay plus total dispersion
* plus peer jitter.
*/
return MAXD(MINDISP, p->lastpkt_rootdelay + p->lastpkt_delay) / 2
+ p->lastpkt_rootdisp
+ p->filter_dispersion
+ FREQ_TOLERANCE * (G.cur_time - p->lastpkt_recv_time)
+ p->filter_jitter;
}
| 17,089 |
173,139 | 0 | main(void)
{
fprintf(stderr,
" test ignored: no support to find out about unknown chunks\n");
/* So the test is skipped: */
return 77;
}
| 17,090 |
109,382 | 0 | void InspectorResourceAgent::frameScheduledNavigation(Frame* frame, double)
{
RefPtr<TypeBuilder::Network::Initiator> initiator = buildInitiatorObject(frame->document(), FetchInitiatorInfo());
m_frameNavigationInitiatorMap.set(m_pageAgent->frameId(frame), initiator);
}
| 17,091 |
146,726 | 0 | void Document::DecrementPasswordCount() {
DCHECK_GT(password_count_, 0u);
--password_count_;
if (IsSecureContext() || password_count_ > 0)
return;
SendSensitiveInputVisibility();
}
| 17,092 |
169,353 | 0 | void TitleWatcher::TestTitle() {
const base::string16& current_title = web_contents()->GetTitle();
if (base::ContainsValue(expected_titles_, current_title)) {
observed_title_ = current_title;
run_loop_.Quit();
}
}
| 17,093 |
58,104 | 0 | int snd_compress_new(struct snd_card *card, int device,
int dirn, struct snd_compr *compr)
{
static struct snd_device_ops ops = {
.dev_free = NULL,
.dev_register = snd_compress_dev_register,
.dev_disconnect = snd_compress_dev_disconnect,
};
compr->card = card;
compr->device = device;
compr->direction = dirn;
return snd_device_new(card, SNDRV_DEV_COMPRESS, compr, &ops);
}
| 17,094 |
86,610 | 0 | void fpm_children_bury() /* {{{ */
{
int status;
pid_t pid;
struct fpm_child_s *child;
while ( (pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) {
char buf[128];
int severity = ZLOG_NOTICE;
int restart_child = 1;
child = fpm_child_find(pid);
if (WIFEXITED(status)) {
snprintf(buf, sizeof(buf), "with code %d", WEXITSTATUS(status));
/* if it's been killed because of dynamic process management
* don't restart it automaticaly
*/
if (child && child->idle_kill) {
restart_child = 0;
}
if (WEXITSTATUS(status) != FPM_EXIT_OK) {
severity = ZLOG_WARNING;
}
} else if (WIFSIGNALED(status)) {
const char *signame = fpm_signal_names[WTERMSIG(status)];
const char *have_core = WCOREDUMP(status) ? " - core dumped" : "";
if (signame == NULL) {
signame = "";
}
snprintf(buf, sizeof(buf), "on signal %d (%s%s)", WTERMSIG(status), signame, have_core);
/* if it's been killed because of dynamic process management
* don't restart it automaticaly
*/
if (child && child->idle_kill && WTERMSIG(status) == SIGQUIT) {
restart_child = 0;
}
if (WTERMSIG(status) != SIGQUIT) { /* possible request loss */
severity = ZLOG_WARNING;
}
} else if (WIFSTOPPED(status)) {
zlog(ZLOG_NOTICE, "child %d stopped for tracing", (int) pid);
if (child && child->tracer) {
child->tracer(child);
}
continue;
}
if (child) {
struct fpm_worker_pool_s *wp = child->wp;
struct timeval tv1, tv2;
fpm_child_unlink(child);
fpm_scoreboard_proc_free(wp->scoreboard, child->scoreboard_i);
fpm_clock_get(&tv1);
timersub(&tv1, &child->started, &tv2);
if (restart_child) {
if (!fpm_pctl_can_spawn_children()) {
severity = ZLOG_DEBUG;
}
zlog(severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", child->wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec);
} else {
zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process management after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec);
}
fpm_child_close(child, 1 /* in event_loop */);
fpm_pctl_child_exited();
if (last_faults && (WTERMSIG(status) == SIGSEGV || WTERMSIG(status) == SIGBUS)) {
time_t now = tv1.tv_sec;
int restart_condition = 1;
int i;
last_faults[fault++] = now;
if (fault == fpm_global_config.emergency_restart_threshold) {
fault = 0;
}
for (i = 0; i < fpm_global_config.emergency_restart_threshold; i++) {
if (now - last_faults[i] > fpm_global_config.emergency_restart_interval) {
restart_condition = 0;
break;
}
}
if (restart_condition) {
zlog(ZLOG_WARNING, "failed processes threshold (%d in %d sec) is reached, initiating reload", fpm_global_config.emergency_restart_threshold, fpm_global_config.emergency_restart_interval);
fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET);
}
}
if (restart_child) {
fpm_children_make(wp, 1 /* in event loop */, 1, 0);
if (fpm_globals.is_child) {
break;
}
}
} else {
zlog(ZLOG_ALERT, "oops, unknown child (%d) exited %s. Please open a bug report (https://bugs.php.net).", pid, buf);
}
}
}
/* }}} */
| 17,095 |
116,090 | 0 | bool InitialSyncEndedForTypes(syncable::ModelTypeSet types,
sync_api::UserShare* share) {
syncable::ScopedDirLookup lookup(share->dir_manager.get(),
share->name);
if (!lookup.good()) {
DCHECK(false) << "ScopedDirLookup failed when checking initial sync";
return false;
}
for (syncable::ModelTypeSet::Iterator i = types.First();
i.Good(); i.Inc()) {
if (!lookup->initial_sync_ended_for_type(i.Get()))
return false;
}
return true;
}
| 17,096 |
1,222 | 0 | GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
int rotateA, GBool useMediaBox, GBool crop,
int sliceX, int sliceY,
int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData) {
#if HAVE_SPLASH
PreScanOutputDev *scan;
GBool rasterize;
SplashOutputDev *splashOut;
SplashColor paperColor;
PDFRectangle box;
GfxState *state;
SplashBitmap *bitmap;
Stream *str0, *str;
Object obj;
Guchar *p;
Guchar col[4];
double m0, m1, m2, m3, m4, m5;
int c, w, h, x, y, comp, i;
if (!forceRasterize) {
scan = new PreScanOutputDev();
page->displaySlice(scan, 72, 72, rotateA, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog, abortCheckCbk, abortCheckCbkData);
rasterize = scan->usesTransparency();
delete scan;
} else {
rasterize = gTrue;
}
if (!rasterize) {
return gTrue;
}
if (level == psLevel1) {
paperColor[0] = 0xff;
splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse,
paperColor, gTrue, gFalse);
#if SPLASH_CMYK
} else if (level == psLevel1Sep) {
paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0;
splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse,
paperColor, gTrue, gFalse);
#endif
} else {
paperColor[0] = paperColor[1] = paperColor[2] = 0xff;
splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse,
paperColor, gTrue, gFalse);
}
splashOut->startDoc(xref);
page->displaySlice(splashOut, splashDPI, splashDPI, rotateA,
useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog, abortCheckCbk, abortCheckCbkData);
page->makeBox(splashDPI, splashDPI, rotateA, useMediaBox, gFalse,
sliceX, sliceY, sliceW, sliceH, &box, &crop);
rotateA += page->getRotate();
if (rotateA >= 360) {
rotateA -= 360;
} else if (rotateA < 0) {
rotateA += 360;
}
state = new GfxState(splashDPI, splashDPI, &box, rotateA, gFalse);
startPage(page->getNum(), state);
delete state;
switch (rotateA) {
case 0:
default: // this should never happen
m0 = box.x2 - box.x1;
m1 = 0;
m2 = 0;
m3 = box.y2 - box.y1;
m4 = box.x1;
m5 = box.y1;
break;
case 90:
m0 = 0;
m1 = box.y2 - box.y1;
m2 = -(box.x2 - box.x1);
m3 = 0;
m4 = box.x2;
m5 = box.y1;
break;
case 180:
m0 = -(box.x2 - box.x1);
m1 = 0;
m2 = 0;
m3 = -(box.y2 - box.y1);
m4 = box.x2;
m5 = box.y2;
break;
case 270:
m0 = 0;
m1 = -(box.y2 - box.y1);
m2 = box.x2 - box.x1;
m3 = 0;
m4 = box.x1;
m5 = box.y2;
break;
}
bitmap = splashOut->getBitmap();
w = bitmap->getWidth();
h = bitmap->getHeight();
writePS("gsave\n");
writePSFmt("[{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] concat\n",
m0, m1, m2, m3, m4, m5);
switch (level) {
case psLevel1:
writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1\n",
w, h, w, -h, h);
p = bitmap->getDataPtr();
i = 0;
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
writePSFmt("{0:02x}", *p++);
if (++i == 32) {
writePSChar('\n');
i = 0;
}
}
}
if (i != 0) {
writePSChar('\n');
}
break;
case psLevel1Sep:
writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1Sep\n",
w, h, w, -h, h);
p = bitmap->getDataPtr();
i = 0;
col[0] = col[1] = col[2] = col[3] = 0;
for (y = 0; y < h; ++y) {
for (comp = 0; comp < 4; ++comp) {
for (x = 0; x < w; ++x) {
writePSFmt("{0:02x}", p[4*x + comp]);
col[comp] |= p[4*x + comp];
if (++i == 32) {
writePSChar('\n');
i = 0;
}
}
}
p += bitmap->getRowSize();
}
if (i != 0) {
writePSChar('\n');
}
if (col[0]) {
processColors |= psProcessCyan;
}
if (col[1]) {
processColors |= psProcessMagenta;
}
if (col[2]) {
processColors |= psProcessYellow;
}
if (col[3]) {
processColors |= psProcessBlack;
}
break;
case psLevel2:
case psLevel2Sep:
case psLevel3:
case psLevel3Sep:
writePS("/DeviceRGB setcolorspace\n");
writePS("<<\n /ImageType 1\n");
writePSFmt(" /Width {0:d}\n", bitmap->getWidth());
writePSFmt(" /Height {0:d}\n", bitmap->getHeight());
writePSFmt(" /ImageMatrix [{0:d} 0 0 {1:d} 0 {2:d}]\n", w, -h, h);
writePS(" /BitsPerComponent 8\n");
writePS(" /Decode [0 1 0 1 0 1]\n");
writePS(" /DataSource currentfile\n");
if (globalParams->getPSASCIIHex()) {
writePS(" /ASCIIHexDecode filter\n");
} else {
writePS(" /ASCII85Decode filter\n");
}
writePS(" /RunLengthDecode filter\n");
writePS(">>\n");
writePS("image\n");
obj.initNull();
str0 = new MemStream((char *)bitmap->getDataPtr(), 0, w * h * 3, &obj);
str = new RunLengthEncoder(str0);
if (globalParams->getPSASCIIHex()) {
str = new ASCIIHexEncoder(str);
} else {
str = new ASCII85Encoder(str);
}
str->reset();
while ((c = str->getChar()) != EOF) {
writePSChar(c);
}
str->close();
delete str;
delete str0;
processColors |= psProcessCMYK;
break;
}
delete splashOut;
writePS("grestore\n");
endPage();
return gFalse;
#else
return gTrue;
#endif
}
| 17,097 |
10,434 | 0 | static void megasas_encode_lba(uint8_t *cdb, uint64_t lba,
uint32_t len, bool is_write)
{
memset(cdb, 0x0, 16);
if (is_write) {
cdb[0] = WRITE_16;
} else {
cdb[0] = READ_16;
}
cdb[2] = (lba >> 56) & 0xff;
cdb[3] = (lba >> 48) & 0xff;
cdb[4] = (lba >> 40) & 0xff;
cdb[5] = (lba >> 32) & 0xff;
cdb[6] = (lba >> 24) & 0xff;
cdb[7] = (lba >> 16) & 0xff;
cdb[8] = (lba >> 8) & 0xff;
cdb[9] = (lba) & 0xff;
cdb[10] = (len >> 24) & 0xff;
cdb[11] = (len >> 16) & 0xff;
cdb[12] = (len >> 8) & 0xff;
cdb[13] = (len) & 0xff;
}
| 17,098 |
42,788 | 0 | static void add_widget_to_warning_area(GtkWidget *widget)
{
g_warning_issued = true;
gtk_box_pack_start(g_box_warning_labels, widget, false, false, 0);
gtk_widget_show_all(widget);
}
| 17,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.