unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
23,977 | 0 | static void airo_networks_free(struct airo_info *ai)
{
kfree(ai->networks);
ai->networks = NULL;
}
| 18,300 |
179,515 | 1 | static int load_state_from_tss32(struct x86_emulate_ctxt *ctxt,
struct tss_segment_32 *tss)
{
int ret;
u8 cpl;
if (ctxt->ops->set_cr(ctxt, 3, tss->cr3))
return emulate_gp(ctxt, 0);
ctxt->_eip = tss->eip;
ctxt->eflags = tss->eflags | 2;
/* General purpose registers */
*reg_write(ctxt, VCPU_REGS_RAX) = tss->eax;
*reg_write(ctxt, VCPU_REGS_RCX) = tss->ecx;
*reg_write(ctxt, VCPU_REGS_RDX) = tss->edx;
*reg_write(ctxt, VCPU_REGS_RBX) = tss->ebx;
*reg_write(ctxt, VCPU_REGS_RSP) = tss->esp;
*reg_write(ctxt, VCPU_REGS_RBP) = tss->ebp;
*reg_write(ctxt, VCPU_REGS_RSI) = tss->esi;
*reg_write(ctxt, VCPU_REGS_RDI) = tss->edi;
/*
* SDM says that segment selectors are loaded before segment
* descriptors. This is important because CPL checks will
* use CS.RPL.
*/
set_segment_selector(ctxt, tss->ldt_selector, VCPU_SREG_LDTR);
set_segment_selector(ctxt, tss->es, VCPU_SREG_ES);
set_segment_selector(ctxt, tss->cs, VCPU_SREG_CS);
set_segment_selector(ctxt, tss->ss, VCPU_SREG_SS);
set_segment_selector(ctxt, tss->ds, VCPU_SREG_DS);
set_segment_selector(ctxt, tss->fs, VCPU_SREG_FS);
set_segment_selector(ctxt, tss->gs, VCPU_SREG_GS);
/*
* If we're switching between Protected Mode and VM86, we need to make
* sure to update the mode before loading the segment descriptors so
* that the selectors are interpreted correctly.
*/
if (ctxt->eflags & X86_EFLAGS_VM) {
ctxt->mode = X86EMUL_MODE_VM86;
cpl = 3;
} else {
ctxt->mode = X86EMUL_MODE_PROT32;
cpl = tss->cs & 3;
}
/*
* Now load segment descriptors. If fault happenes at this stage
* it is handled in a context of new task
*/
ret = __load_segment_descriptor(ctxt, tss->ldt_selector, VCPU_SREG_LDTR, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->es, VCPU_SREG_ES, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->cs, VCPU_SREG_CS, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->ss, VCPU_SREG_SS, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->ds, VCPU_SREG_DS, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->fs, VCPU_SREG_FS, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = __load_segment_descriptor(ctxt, tss->gs, VCPU_SREG_GS, cpl, true);
if (ret != X86EMUL_CONTINUE)
return ret;
return X86EMUL_CONTINUE;
}
| 18,301 |
126,074 | 0 | AutomationProviderHistoryObserver::~AutomationProviderHistoryObserver() {}
| 18,302 |
24,463 | 0 | void unregister_sysctl_table(struct ctl_table_header * table)
{
}
| 18,303 |
99,870 | 0 | void WebPluginDelegatePepper::Paint(WebKit::WebCanvas* canvas,
const gfx::Rect& rect) {
#if defined(OS_WIN) || defined(OS_LINUX)
if (nested_delegate_) {
} else {
if (!committed_bitmap_.isNull()) {
gfx::Point origin(window_rect_.origin().x(), window_rect_.origin().y());
canvas->drawBitmap(committed_bitmap_,
SkIntToScalar(window_rect_.origin().x()),
SkIntToScalar(window_rect_.origin().y()));
}
}
#endif
}
| 18,304 |
2,080 | 0 | void red_channel_client_begin_send_message(RedChannelClient *rcc)
{
SpiceMarshaller *m = rcc->send_data.marshaller;
if (rcc->send_data.header.get_msg_type(&rcc->send_data.header) == 0) {
spice_printerr("BUG: header->type == 0");
return;
}
/* canceling the latency test timer till the nework is idle */
red_channel_client_cancel_ping_timer(rcc);
spice_marshaller_flush(m);
rcc->send_data.size = spice_marshaller_get_total_size(m);
rcc->send_data.header.set_msg_size(&rcc->send_data.header,
rcc->send_data.size - rcc->send_data.header.header_size);
rcc->ack_data.messages_window++;
rcc->send_data.last_sent_serial = rcc->send_data.serial;
rcc->send_data.header.data = NULL; /* avoid writing to this until we have a new message */
red_channel_client_send(rcc);
}
| 18,305 |
90,212 | 0 | static u8 current_global_enables(struct smi_info *smi_info, u8 base,
bool *irq_on)
{
u8 enables = 0;
if (smi_info->supports_event_msg_buff)
enables |= IPMI_BMC_EVT_MSG_BUFF;
if (((smi_info->io.irq && !smi_info->interrupt_disabled) ||
smi_info->cannot_disable_irq) &&
!smi_info->irq_enable_broken)
enables |= IPMI_BMC_RCV_MSG_INTR;
if (smi_info->supports_event_msg_buff &&
smi_info->io.irq && !smi_info->interrupt_disabled &&
!smi_info->irq_enable_broken)
enables |= IPMI_BMC_EVT_MSG_INTR;
*irq_on = enables & (IPMI_BMC_EVT_MSG_INTR | IPMI_BMC_RCV_MSG_INTR);
return enables;
}
| 18,306 |
156,320 | 0 | const AtomicString& MediaRecorder::InterfaceName() const {
return event_target_names::kMediaRecorder;
}
| 18,307 |
169,780 | 0 | exsltDateFormatDate (const exsltDateValDatePtr dt)
{
xmlChar buf[100], *cur = buf;
if ((dt == NULL) || !VALID_DATETIME(dt))
return NULL;
FORMAT_DATE(dt, cur);
if (dt->tz_flag || (dt->tzo != 0)) {
FORMAT_TZ(dt->tzo, cur);
}
*cur = 0;
return xmlStrdup(buf);
}
| 18,308 |
68,340 | 0 | static void perf_cgroup_attach(struct cgroup_taskset *tset)
{
struct task_struct *task;
struct cgroup_subsys_state *css;
cgroup_taskset_for_each(task, css, tset)
task_function_call(task, __perf_cgroup_move, task);
}
| 18,309 |
110,370 | 0 | uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance(
instance_id);
}
| 18,310 |
26,620 | 0 | static inline int ip6_forward_finish(struct sk_buff *skb)
{
return dst_output(skb);
}
| 18,311 |
166,903 | 0 | void Performance::UnregisterPerformanceObserver(
PerformanceObserver& old_observer) {
observers_.erase(&old_observer);
UpdatePerformanceObserverFilterOptions();
UpdateLongTaskInstrumentation();
}
| 18,312 |
49,968 | 0 | ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC)
{
zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC);
if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->write_property) {
Z_OBJ_HT_P(probj->object)->write_property(probj->object, probj->property, value, 0 TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
}
}
| 18,313 |
110,542 | 0 | GLenum GLES2DecoderImpl::GetBoundReadFrameBufferInternalFormat() {
FramebufferManager::FramebufferInfo* framebuffer =
GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
if (framebuffer != NULL) {
return framebuffer->GetColorAttachmentFormat();
} else if (offscreen_target_frame_buffer_.get()) {
return offscreen_target_color_format_;
} else {
return back_buffer_color_format_;
}
}
| 18,314 |
71,581 | 0 | static MagickBooleanType WriteJBIGImage(const ImageInfo *image_info,
Image *image)
{
double
version;
MagickBooleanType
status;
MagickOffsetType
scene;
MemoryInfo
*pixel_info;
register const PixelPacket
*p;
register ssize_t
x;
register unsigned char
*q;
size_t
number_packets;
ssize_t
y;
struct jbg_enc_state
jbig_info;
unsigned char
bit,
byte,
*pixels;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
version=StringToDouble(JBG_VERSION,(char **) NULL);
scene=0;
do
{
/*
Allocate pixel data.
*/
(void) TransformImageColorspace(image,sRGBColorspace);
number_packets=(image->columns+7)/8;
pixel_info=AcquireVirtualMemory(number_packets,image->rows*sizeof(*pixels));
if (pixel_info == (MemoryInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
/*
Convert pixels to a bitmap.
*/
(void) SetImageType(image,BilevelType);
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
bit=0;
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x01;
bit++;
if (bit == 8)
{
*q++=byte;
bit=0;
byte=0;
}
p++;
}
if (bit != 0)
*q++=byte << (8-bit);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
/*
Initialize JBIG info structure.
*/
jbg_enc_init(&jbig_info,(unsigned long) image->columns,(unsigned long)
image->rows,1,&pixels,(void (*)(unsigned char *,size_t,void *))
JBIGEncode,image);
if (image_info->scene != 0)
jbg_enc_layers(&jbig_info,(int) image_info->scene);
else
{
size_t
x_resolution,
y_resolution;
x_resolution=640;
y_resolution=480;
if (image_info->density != (char *) NULL)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(image_info->density,&geometry_info);
x_resolution=geometry_info.rho;
y_resolution=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
y_resolution=x_resolution;
}
if (image->units == PixelsPerCentimeterResolution)
{
x_resolution=(size_t) (100.0*2.54*x_resolution+0.5)/100.0;
y_resolution=(size_t) (100.0*2.54*y_resolution+0.5)/100.0;
}
(void) jbg_enc_lrlmax(&jbig_info,(unsigned long) x_resolution,
(unsigned long) y_resolution);
}
(void) jbg_enc_lrange(&jbig_info,-1,-1);
jbg_enc_options(&jbig_info,JBG_ILEAVE | JBG_SMID,JBG_TPDON | JBG_TPBON |
JBG_DPON,version < 1.6 ? -1 : 0,-1,-1);
/*
Write JBIG image.
*/
jbg_enc_out(&jbig_info);
jbg_enc_free(&jbig_info);
pixel_info=RelinquishVirtualMemory(pixel_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
| 18,315 |
183,063 | 1 | static int sd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct gendisk *disk = bdev->bd_disk;
struct scsi_disk *sdkp = scsi_disk(disk);
struct scsi_device *sdp = sdkp->device;
void __user *p = (void __user *)arg;
int error;
SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, "
"cmd=0x%x\n", disk->disk_name, cmd));
/*
* If we are in the middle of error recovery, don't let anyone
* else try and use this device. Also, if error recovery fails, it
* may try and take the device offline, in which case all further
* access to the device is prohibited.
*/
error = scsi_nonblockable_ioctl(sdp, cmd, p,
(mode & FMODE_NDELAY) != 0);
if (!scsi_block_when_processing_errors(sdp) || !error)
goto out;
/*
* Send SCSI addressing ioctls directly to mid level, send other
* ioctls to block level and then onto mid level if they can't be
* resolved.
*/
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
case SCSI_IOCTL_GET_BUS_NUMBER:
error = scsi_ioctl(sdp, cmd, p);
break;
default:
error = scsi_cmd_blk_ioctl(bdev, mode, cmd, p);
if (error != -ENOTTY)
break;
error = scsi_ioctl(sdp, cmd, p);
break;
}
out:
return error;
}
| 18,316 |
72,748 | 0 | static jas_seqent_t bitstoint(uint_fast32_t v, int prec, bool sgnd)
{
jas_seqent_t ret;
v &= JAS_ONES(prec);
ret = (sgnd && (v & (1 << (prec - 1)))) ? (v - (1 << prec)) : v;
return ret;
}
| 18,317 |
134,395 | 0 | bool TabStrip::OnMousePressed(const ui::MouseEvent& event) {
UpdateLayoutTypeFromMouseEvent(this, event);
return false;
}
| 18,318 |
186,550 | 1 | void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened(
const ClientOAuthResult& result,
Profile* profile,
Profile::CreateStatus status) {
if (is_force_sign_in_with_usermanager_)
UnlockProfileAndHideLoginUI(profile_->GetPath(), handler_.get());
Browser* browser = NULL;
if (handler_) {
browser = handler_->GetDesktopBrowser();
}
AboutSigninInternals* about_signin_internals =
AboutSigninInternalsFactory::GetForProfile(profile_);
about_signin_internals->OnRefreshTokenReceived("Successful");
// Prime the account tracker with this combination of gaia id/display email.
std::string account_id =
AccountTrackerServiceFactory::GetForProfile(profile_)
->SeedAccountInfo(gaia_id_, email_);
signin_metrics::AccessPoint access_point =
signin::GetAccessPointForPromoURL(current_url_);
signin_metrics::Reason reason =
signin::GetSigninReasonForPromoURL(current_url_);
SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_);
std::string primary_email =
signin_manager->GetAuthenticatedAccountInfo().email;
if (gaia::AreEmailsSame(email_, primary_email) &&
(reason == signin_metrics::Reason::REASON_REAUTHENTICATION ||
reason == signin_metrics::Reason::REASON_UNLOCK) &&
!password_.empty() && profiles::IsLockAvailable(profile_)) {
LocalAuth::SetLocalAuthCredentials(profile_, password_);
}
#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
if (!password_.empty()) {
scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile_,
ServiceAccessType::EXPLICIT_ACCESS);
if (password_store && !primary_email.empty()) {
password_store->SaveGaiaPasswordHash(
primary_email, base::UTF8ToUTF16(password_),
password_manager::metrics_util::SyncPasswordHashChange::
SAVED_ON_CHROME_SIGNIN);
}
}
#endif
if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION ||
reason == signin_metrics::Reason::REASON_UNLOCK ||
reason == signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
UpdateCredentials(account_id, result.refresh_token);
if (signin::IsAutoCloseEnabledInURL(current_url_)) {
// Close the gaia sign in tab via a task to make sure we aren't in the
// middle of any webui handler code.
bool show_account_management = ShouldShowAccountManagement(
current_url_,
AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile_));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&InlineLoginHandlerImpl::CloseTab, handler_,
show_account_management));
}
if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION ||
reason == signin_metrics::Reason::REASON_UNLOCK) {
signin_manager->MergeSigninCredentialIntoCookieJar();
}
LogSigninReason(reason);
} else {
browser_sync::ProfileSyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile_);
SigninErrorController* error_controller =
SigninErrorControllerFactory::GetForProfile(profile_);
OneClickSigninSyncStarter::StartSyncMode start_mode =
OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST;
if (access_point == signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS ||
choose_what_to_sync_) {
bool show_settings_without_configure =
error_controller->HasError() && sync_service &&
sync_service->IsFirstSetupComplete();
if (!show_settings_without_configure)
start_mode = OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST;
}
OneClickSigninSyncStarter::ConfirmationRequired confirmation_required =
confirm_untrusted_signin_ ?
OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN :
OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
bool start_signin = !HandleCrossAccountError(
result.refresh_token, confirmation_required, start_mode);
if (start_signin) {
CreateSyncStarter(browser, current_url_, result.refresh_token,
OneClickSigninSyncStarter::CURRENT_PROFILE, start_mode,
confirmation_required);
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
}
}
}
| 18,319 |
44,005 | 0 | add_xml_comment(xmlNode * parent, xmlNode * target, xmlNode * update)
{
CRM_CHECK(update != NULL, return 0);
CRM_CHECK(update->type == XML_COMMENT_NODE, return 0);
if (target == NULL) {
target = find_xml_comment(parent, update);
}
if (target == NULL) {
add_node_copy(parent, update);
/* We wont reach here currently */
} else if (safe_str_neq((const char *)target->content, (const char *)update->content)) {
xmlFree(target->content);
target->content = xmlStrdup(update->content);
}
return 0;
}
| 18,320 |
126,374 | 0 | bool BrowserWindowGtk::IsBookmarkBarAnimating() const {
if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating())
return true;
return false;
}
| 18,321 |
178,184 | 1 | uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
{
uint32_t old_val;
trace_esp_mem_readb(saddr, s->rregs[saddr]);
switch (saddr) {
case ESP_FIFO:
if (s->ti_size > 0) {
s->ti_size--;
if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {
/* Data out. *
qemu_log_mask(LOG_UNIMP,
"esp: PIO data read not implemented\n");
s->rregs[ESP_FIFO] = 0;
} else {
s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++];
}
esp_raise_irq(s);
}
if (s->ti_size == 0) {
s->ti_rptr = 0;
s->ti_wptr = 0;
}
s->ti_wptr = 0;
}
break;
case ESP_RINTR:
/* Clear sequence step, interrupt register and all status bits
except TC */
old_val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;
s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_lower_irq(s);
return old_val;
case ESP_TCHI:
/* Return the unique id if the value has never been written */
if (!s->tchi_written) {
return s->chip_id;
}
default:
break;
}
| 18,322 |
13,518 | 0 | flx_set_color (FlxColorSpaceConverter * flxpal, guint colr, guint red,
guint green, guint blue, gint scale)
{
g_return_if_fail (flxpal != NULL);
g_return_if_fail (colr < 0x100);
flxpal->palvec[(colr * 3)] = red << scale;
flxpal->palvec[(colr * 3) + 1] = green << scale;
flxpal->palvec[(colr * 3) + 2] = blue << scale;
}
| 18,323 |
158,926 | 0 | void PDFiumEngine::Form_EmailTo(FPDF_FORMFILLINFO* param,
FPDF_FILEHANDLER* file_handler,
FPDF_WIDESTRING to,
FPDF_WIDESTRING subject,
FPDF_WIDESTRING cc,
FPDF_WIDESTRING bcc,
FPDF_WIDESTRING message) {
std::string to_str = WideStringToString(to);
std::string subject_str = WideStringToString(subject);
std::string cc_str = WideStringToString(cc);
std::string bcc_str = WideStringToString(bcc);
std::string message_str = WideStringToString(message);
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
engine->client_->Email(to_str, cc_str, bcc_str, subject_str, message_str);
}
| 18,324 |
56,207 | 0 | static void armv8pmu_enable_event(struct hw_perf_event *hwc, int idx)
{
unsigned long flags;
struct pmu_hw_events *events = cpu_pmu->get_hw_events();
/*
* Enable counter and interrupt, and set the counter to count
* the event that we're interested in.
*/
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/*
* Disable counter
*/
armv8pmu_disable_counter(idx);
/*
* Set event (if destined for PMNx counters).
*/
armv8pmu_write_evtype(idx, hwc->config_base);
/*
* Enable interrupt for this counter
*/
armv8pmu_enable_intens(idx);
/*
* Enable counter
*/
armv8pmu_enable_counter(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
| 18,325 |
39,343 | 0 | static inline bool drive_no_geom(int drive)
{
return !current_type[drive] && !ITYPE(UDRS->fd_device);
}
| 18,326 |
63,962 | 0 | av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
{
return vp78_decode_init(avctx, IS_VP8);
}
| 18,327 |
16,172 | 0 | int GahpClient::ec2_associate_address(const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * instance_id,
const char * elastic_ip,
StringList & returnStatus,
char* & error_code )
{
static const char* command = "EC2_VM_ASSOCIATE_ADDRESS";
int rc=0;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) || (elastic_ip == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(elastic_ip) );
int x = sprintf(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int return_code = atoi(result->argv[1]);
if (return_code == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // return_code == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
}
return rc;
}
| 18,328 |
30,515 | 0 | static void *nr_info_start(struct seq_file *seq, loff_t *pos)
{
spin_lock_bh(&nr_list_lock);
return seq_hlist_start_head(&nr_list, *pos);
}
| 18,329 |
145,110 | 0 | void testEmptyPicture()
{
m_testSurface->initializeCurrentFrame();
RefPtr<SkPicture> picture = m_testSurface->getPicture();
EXPECT_TRUE((bool)picture.get());
EXPECT_EQ(1, m_fakeImageBufferClient->frameCount());
expectDisplayListEnabled(true);
}
| 18,330 |
161,941 | 0 | bool PDFShouldDisableScaling(blink::WebLocalFrame* frame,
const blink::WebNode& node,
const PrintMsg_Print_Params& params,
bool ignore_page_size) {
const bool kDefaultPDFShouldDisableScalingSetting = true;
blink::WebPrintPresetOptions preset_options;
if (!frame->GetPrintPresetOptionsForPlugin(node, &preset_options))
return kDefaultPDFShouldDisableScalingSetting;
return PDFShouldDisableScalingBasedOnPreset(preset_options, params,
ignore_page_size);
}
| 18,331 |
169,349 | 0 | SynchronizeVisualPropertiesMessageFilter()
: content::BrowserMessageFilter(kMessageClassesToFilter,
arraysize(kMessageClassesToFilter)),
screen_space_rect_run_loop_(std::make_unique<base::RunLoop>()),
screen_space_rect_received_(false) {}
| 18,332 |
122,328 | 0 | bool HTMLInputElement::isInteractiveContent() const
{
return m_inputType->isInteractiveContent();
}
| 18,333 |
148,848 | 0 | void RenderFrameHostManager::ActiveFrameCountIsZero(
SiteInstanceImpl* site_instance) {
RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(site_instance);
CHECK(proxy);
DeleteRenderFrameProxyHost(site_instance);
}
| 18,334 |
187,712 | 1 | safecat_color_encoding(char *buffer, size_t bufsize, size_t pos,
PNG_CONST color_encoding *e, double encoding_gamma)
{
if (e != 0)
{
if (encoding_gamma != 0)
pos = safecat(buffer, bufsize, pos, "(");
pos = safecat(buffer, bufsize, pos, "R(");
pos = safecatd(buffer, bufsize, pos, e->red.X, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->red.Y, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->red.Z, 4);
pos = safecat(buffer, bufsize, pos, "),G(");
pos = safecatd(buffer, bufsize, pos, e->green.X, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->green.Y, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->green.Z, 4);
pos = safecat(buffer, bufsize, pos, "),B(");
pos = safecatd(buffer, bufsize, pos, e->blue.X, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->blue.Y, 4);
pos = safecat(buffer, bufsize, pos, ",");
pos = safecatd(buffer, bufsize, pos, e->blue.Z, 4);
pos = safecat(buffer, bufsize, pos, ")");
if (encoding_gamma != 0)
pos = safecat(buffer, bufsize, pos, ")");
}
if (encoding_gamma != 0)
{
pos = safecat(buffer, bufsize, pos, "^");
pos = safecatd(buffer, bufsize, pos, encoding_gamma, 5);
}
return pos;
}
| 18,335 |
145,688 | 0 | void ImageInputType::handleDOMActivateEvent(Event* event)
{
RefPtrWillBeRawPtr<HTMLInputElement> element(this->element());
if (element->isDisabledFormControl() || !element->form())
return;
element->setActivatedSubmit(true);
m_clickLocation = extractClickLocation(event);
element->form()->prepareForSubmission(event); // Event handlers can run.
element->setActivatedSubmit(false);
event->setDefaultHandled();
}
| 18,336 |
112,868 | 0 | void GDataCache::Destroy() {
AssertOnSequencedWorkerPool();
delete this;
}
| 18,337 |
121,604 | 0 | void TextIterator::handleTextBox()
{
RenderText* renderer = m_firstLetterText ? m_firstLetterText : toRenderText(m_node->renderer());
if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) {
m_textBox = 0;
return;
}
String str = renderer->text();
unsigned start = m_offset;
unsigned end = (m_node == m_endContainer) ? static_cast<unsigned>(m_endOffset) : UINT_MAX;
while (m_textBox) {
unsigned textBoxStart = m_textBox->start();
unsigned runStart = max(textBoxStart, start);
InlineTextBox* firstTextBox = renderer->containsReversedText() ? (m_sortedTextBoxes.isEmpty() ? 0 : m_sortedTextBoxes[0]) : renderer->firstTextBox();
bool needSpace = m_lastTextNodeEndedWithCollapsedSpace
|| (m_textBox == firstTextBox && textBoxStart == runStart && runStart > 0);
if (needSpace && !isCollapsibleWhitespace(m_lastCharacter) && m_lastCharacter) {
if (m_lastTextNode == m_node && runStart > 0 && str[runStart - 1] == ' ') {
unsigned spaceRunStart = runStart - 1;
while (spaceRunStart > 0 && str[spaceRunStart - 1] == ' ')
--spaceRunStart;
emitText(m_node, renderer, spaceRunStart, spaceRunStart + 1);
} else
emitCharacter(' ', m_node, 0, runStart, runStart);
return;
}
unsigned textBoxEnd = textBoxStart + m_textBox->len();
unsigned runEnd = min(textBoxEnd, end);
InlineTextBox* nextTextBox = 0;
if (renderer->containsReversedText()) {
if (m_sortedTextBoxesPosition + 1 < m_sortedTextBoxes.size())
nextTextBox = m_sortedTextBoxes[m_sortedTextBoxesPosition + 1];
} else
nextTextBox = m_textBox->nextTextBox();
ASSERT(!nextTextBox || nextTextBox->renderer() == renderer);
if (runStart < runEnd) {
if (str[runStart] == '\n') {
emitCharacter(' ', m_node, 0, runStart, runStart + 1);
m_offset = runStart + 1;
} else {
size_t subrunEnd = str.find('\n', runStart);
if (subrunEnd == notFound || subrunEnd > runEnd)
subrunEnd = runEnd;
m_offset = subrunEnd;
emitText(m_node, renderer, runStart, subrunEnd);
}
if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd)
return;
unsigned nextRunStart = nextTextBox ? nextTextBox->start() : str.length();
if (nextRunStart > runEnd)
m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
m_textBox = nextTextBox;
if (renderer->containsReversedText())
++m_sortedTextBoxesPosition;
return;
}
m_textBox = nextTextBox;
if (renderer->containsReversedText())
++m_sortedTextBoxesPosition;
}
if (!m_textBox && m_remainingTextBox) {
m_textBox = m_remainingTextBox;
m_remainingTextBox = 0;
m_firstLetterText = 0;
m_offset = 0;
handleTextBox();
}
}
| 18,338 |
119,713 | 0 | void ResetScreenHandler::PrepareToShow() {
}
| 18,339 |
28,406 | 0 | static void fib6_dump_end(struct netlink_callback *cb)
{
struct fib6_walker_t *w = (void*)cb->args[2];
if (w) {
if (cb->args[4]) {
cb->args[4] = 0;
fib6_walker_unlink(w);
}
cb->args[2] = 0;
kfree(w);
}
cb->done = (void*)cb->args[3];
cb->args[1] = 3;
}
| 18,340 |
176,243 | 0 | static void DeleteImpl(Handle<JSObject> holder, uint32_t entry) {
uint32_t length = static_cast<uint32_t>(GetString(*holder)->length());
if (entry < length) {
return; // String contents can't be deleted.
}
BackingStoreAccessor::DeleteImpl(holder, entry - length);
}
| 18,341 |
134,402 | 0 | void TabStrip::PrepareForAnimation() {
if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) {
for (int i = 0; i < tab_count(); ++i)
tab_at(i)->set_dragging(false);
}
}
| 18,342 |
29,428 | 0 | static void multi_pm(struct sb_uart_port *port, unsigned int state, unsigned int oldstate)
{
struct mp_port *mtpt = (struct mp_port *)port;
if (state) {
if (mtpt->capabilities & UART_STARTECH) {
serial_outp(mtpt, UART_LCR, 0xBF);
serial_outp(mtpt, UART_EFR, UART_EFR_ECB);
serial_outp(mtpt, UART_LCR, 0);
serial_outp(mtpt, UART_IER, UART_IERX_SLEEP);
serial_outp(mtpt, UART_LCR, 0xBF);
serial_outp(mtpt, UART_EFR, 0);
serial_outp(mtpt, UART_LCR, 0);
}
if (mtpt->pm)
mtpt->pm(port, state, oldstate);
}
else
{
if (mtpt->capabilities & UART_STARTECH) {
serial_outp(mtpt, UART_LCR, 0xBF);
serial_outp(mtpt, UART_EFR, UART_EFR_ECB);
serial_outp(mtpt, UART_LCR, 0);
serial_outp(mtpt, UART_IER, 0);
serial_outp(mtpt, UART_LCR, 0xBF);
serial_outp(mtpt, UART_EFR, 0);
serial_outp(mtpt, UART_LCR, 0);
}
if (mtpt->pm)
mtpt->pm(port, state, oldstate);
}
}
| 18,343 |
137,356 | 0 | void SendAlternateCut() {
if (TestingNativeMac())
SendKeyEvent(ui::VKEY_X, false, true);
else
SendKeyEvent(ui::VKEY_DELETE, true, false);
}
| 18,344 |
120,007 | 0 | void DelegatedFrameHost::UnlockResources() {
DCHECK(frame_provider_ || !surface_id_.is_null());
delegated_frame_evictor_->UnlockFrame();
}
| 18,345 |
7,715 | 0 | static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
V9fsFidState *fidp,
uint32_t max_count)
{
V9fsPath path;
V9fsStat v9stat;
int len, err = 0;
int32_t count = 0;
struct stat stbuf;
off_t saved_dir_pos;
struct dirent *dent;
/* save the directory position */
saved_dir_pos = v9fs_co_telldir(pdu, fidp);
if (saved_dir_pos < 0) {
return saved_dir_pos;
}
while (1) {
v9fs_path_init(&path);
v9fs_readdir_lock(&fidp->fs.dir);
err = v9fs_co_readdir(pdu, fidp, &dent);
if (err || !dent) {
break;
}
err = v9fs_co_name_to_path(pdu, &fidp->path, dent->d_name, &path);
if (err < 0) {
break;
}
err = v9fs_co_lstat(pdu, &path, &stbuf);
if (err < 0) {
break;
}
err = stat_to_v9stat(pdu, &path, &stbuf, &v9stat);
if (err < 0) {
break;
}
/* 11 = 7 + 4 (7 = start offset, 4 = space for storing count) */
len = pdu_marshal(pdu, 11 + count, "S", &v9stat);
v9fs_readdir_unlock(&fidp->fs.dir);
if ((len != (v9stat.size + 2)) || ((count + len) > max_count)) {
/* Ran out of buffer. Set dir back to old position and return */
v9fs_co_seekdir(pdu, fidp, saved_dir_pos);
v9fs_stat_free(&v9stat);
v9fs_path_free(&path);
return count;
}
count += len;
v9fs_stat_free(&v9stat);
v9fs_path_free(&path);
saved_dir_pos = dent->d_off;
}
v9fs_readdir_unlock(&fidp->fs.dir);
v9fs_path_free(&path);
if (err < 0) {
return err;
}
return count;
}
| 18,346 |
148,281 | 0 | void PrintJobWorker::StopSoon() {
thread_.StopSoon();
}
| 18,347 |
168,162 | 0 | void Browser::AddNewContents(WebContents* source,
std::unique_ptr<WebContents> new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition))
PopupTracker::CreateForWebContents(new_contents.get(), source);
chrome::AddWebContents(this, source, std::move(new_contents), disposition,
initial_rect);
}
| 18,348 |
169,282 | 0 | bool ContextMenuFilter::OnMessageReceived(const IPC::Message& message) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (message.type() == FrameHostMsg_ContextMenu::ID) {
FrameHostMsg_ContextMenu::Param params;
FrameHostMsg_ContextMenu::Read(&message, ¶ms);
content::ContextMenuParams menu_params = std::get<0>(params);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(&ContextMenuFilter::OnContextMenu, this, menu_params));
}
return false;
}
| 18,349 |
174,151 | 0 | status_t OMX::getGraphicBufferUsage(
node_id node, OMX_U32 port_index, OMX_U32* usage) {
return findInstance(node)->getGraphicBufferUsage(port_index, usage);
}
| 18,350 |
122,560 | 0 | static void ensureClientMessageLoopCreated(WebDevToolsAgentClient* client)
{
if (s_instance)
return;
OwnPtr<ClientMessageLoopAdapter> instance = adoptPtr(new ClientMessageLoopAdapter(adoptPtr(client->createClientMessageLoop())));
s_instance = instance.get();
PageScriptDebugServer::shared().setClientMessageLoop(instance.release());
}
| 18,351 |
167,550 | 0 | WebContents* FindFirstDevToolsContents() {
std::unique_ptr<content::RenderWidgetHostIterator> widgets(
RenderWidgetHost::GetRenderWidgetHosts());
while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
if (!widget->GetProcess()->IsInitializedAndNotDead())
continue;
RenderViewHost* view_host = RenderViewHost::From(widget);
if (!view_host)
continue;
WebContents* contents = WebContents::FromRenderViewHost(view_host);
GURL url = contents->GetURL();
if (url.SchemeIs(content::kChromeDevToolsScheme))
return contents;
}
return NULL;
}
| 18,352 |
146,110 | 0 | Vector<GLuint> WebGL2RenderingContextBase::getUniformIndices(
WebGLProgram* program,
const Vector<String>& uniform_names) {
Vector<GLuint> result;
if (isContextLost() || !ValidateWebGLObject("getUniformIndices", program))
return result;
Vector<CString> keep_alive; // Must keep these instances alive while looking
Vector<const char*> uniform_strings;
for (size_t i = 0; i < uniform_names.size(); ++i) {
keep_alive.push_back(uniform_names[i].Ascii());
uniform_strings.push_back(keep_alive.back().data());
}
result.resize(uniform_names.size());
ContextGL()->GetUniformIndices(ObjectOrZero(program), uniform_strings.size(),
uniform_strings.data(), result.data());
return result;
}
| 18,353 |
19,555 | 0 | static int ep_alloc(struct eventpoll **pep)
{
int error;
struct user_struct *user;
struct eventpoll *ep;
user = get_current_user();
error = -ENOMEM;
ep = kzalloc(sizeof(*ep), GFP_KERNEL);
if (unlikely(!ep))
goto free_uid;
spin_lock_init(&ep->lock);
mutex_init(&ep->mtx);
init_waitqueue_head(&ep->wq);
init_waitqueue_head(&ep->poll_wait);
INIT_LIST_HEAD(&ep->rdllist);
ep->rbr = RB_ROOT;
ep->ovflist = EP_UNACTIVE_PTR;
ep->user = user;
*pep = ep;
return 0;
free_uid:
free_uid(user);
return error;
}
| 18,354 |
149,772 | 0 | void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
std::unique_ptr<MutatorEvents> events = mutator_host_->CreateEvents();
if (mutator_host_->TickAnimations(monotonic_time))
mutator_host_->UpdateAnimationState(true, events.get());
if (!events->IsEmpty())
property_trees_.needs_rebuild = true;
}
| 18,355 |
135,926 | 0 | bool ContainerNode::checkAcceptChild(const Node* newChild, const Node* oldChild, ExceptionState& exceptionState) const
{
if (!newChild) {
exceptionState.throwDOMException(NotFoundError, "The new child element is null.");
return false;
}
if ((newChild->isElementNode() || newChild->isTextNode()) && isElementNode()) {
ASSERT(isChildTypeAllowed(*newChild));
if (containsConsideringHostElements(*newChild)) {
exceptionState.throwDOMException(HierarchyRequestError, "The new child element contains the parent.");
return false;
}
return true;
}
ASSERT(!newChild->isPseudoElement());
if (newChild->isPseudoElement()) {
exceptionState.throwDOMException(HierarchyRequestError, "The new child element is a pseudo-element.");
return false;
}
return checkAcceptChildGuaranteedNodeTypes(*newChild, oldChild, exceptionState);
}
| 18,356 |
148,939 | 0 | static void SortByDistance(
int *aIdx,
int nIdx,
RtreeDValue *aDistance,
int *aSpare
){
if( nIdx>1 ){
int iLeft = 0;
int iRight = 0;
int nLeft = nIdx/2;
int nRight = nIdx-nLeft;
int *aLeft = aIdx;
int *aRight = &aIdx[nLeft];
SortByDistance(aLeft, nLeft, aDistance, aSpare);
SortByDistance(aRight, nRight, aDistance, aSpare);
memcpy(aSpare, aLeft, sizeof(int)*nLeft);
aLeft = aSpare;
while( iLeft<nLeft || iRight<nRight ){
if( iLeft==nLeft ){
aIdx[iLeft+iRight] = aRight[iRight];
iRight++;
}else if( iRight==nRight ){
aIdx[iLeft+iRight] = aLeft[iLeft];
iLeft++;
}else{
RtreeDValue fLeft = aDistance[aLeft[iLeft]];
RtreeDValue fRight = aDistance[aRight[iRight]];
if( fLeft<fRight ){
aIdx[iLeft+iRight] = aLeft[iLeft];
iLeft++;
}else{
aIdx[iLeft+iRight] = aRight[iRight];
iRight++;
}
}
}
#if 0
/* Check that the sort worked */
{
int jj;
for(jj=1; jj<nIdx; jj++){
RtreeDValue left = aDistance[aIdx[jj-1]];
RtreeDValue right = aDistance[aIdx[jj]];
assert( left<=right );
}
}
#endif
}
}
| 18,357 |
27,507 | 0 | static void ipgre_tunnel_uninit(struct net_device *dev)
{
struct net *net = dev_net(dev);
struct ipgre_net *ign = net_generic(net, ipgre_net_id);
ipgre_tunnel_unlink(ign, netdev_priv(dev));
dev_put(dev);
}
| 18,358 |
3,992 | 0 | int DCTStream::lookChar() {
if (y >= height) {
return EOF;
}
if (progressive || !interleaved) {
return frameBuf[comp][y * bufWidth + x];
} else {
if (dy >= mcuHeight) {
if (!readMCURow()) {
y = height;
return EOF;
}
comp = 0;
x = 0;
dy = 0;
}
return rowBuf[comp][dy][x];
}
}
| 18,359 |
117,542 | 0 | void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
if (!parameters().ui_task) {
bool use_stub = parameters().command_line.HasSwitch(switches::kStubCros);
chromeos::CrosLibrary::Initialize(use_stub);
}
net::NetworkChangeNotifier::SetFactory(
new chromeos::CrosNetworkChangeNotifierFactory());
ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
}
| 18,360 |
109,458 | 0 | void RawData::detachFromCurrentThread()
{
}
| 18,361 |
167,678 | 0 | void WebRuntimeFeatures::EnableAccelerated2dCanvas(bool enable) {
RuntimeEnabledFeatures::SetAccelerated2dCanvasEnabled(enable);
}
| 18,362 |
49,834 | 0 | static void arcmsr_unmap_pciregion(struct AdapterControlBlock *acb)
{
switch (acb->adapter_type) {
case ACB_ADAPTER_TYPE_A:{
iounmap(acb->pmuA);
}
break;
case ACB_ADAPTER_TYPE_B:{
iounmap(acb->mem_base0);
iounmap(acb->mem_base1);
}
break;
case ACB_ADAPTER_TYPE_C:{
iounmap(acb->pmuC);
}
break;
case ACB_ADAPTER_TYPE_D:
iounmap(acb->mem_base0);
break;
}
}
| 18,363 |
36,203 | 0 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp)
{
if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER)
return -EINVAL;
if (S_ISDIR(mp->m_dentry->d_inode->i_mode) !=
S_ISDIR(mnt->mnt.mnt_root->d_inode->i_mode))
return -ENOTDIR;
return attach_recursive_mnt(mnt, p, mp, NULL);
}
| 18,364 |
137,577 | 0 | void PrintWebViewHelper::ShowScriptedPrintPreview() {
if (is_scripted_preview_delayed_) {
is_scripted_preview_delayed_ = false;
Send(new PrintHostMsg_ShowScriptedPrintPreview(
routing_id(), print_preview_context_.IsModifiable()));
}
}
| 18,365 |
114,070 | 0 | TaskManagerView::TaskManagerView(bool highlight_background_resources)
: purge_memory_button_(NULL),
task_manager_(TaskManager::GetInstance()),
model_(TaskManager::GetInstance()->model()),
is_always_on_top_(false),
highlight_background_resources_(highlight_background_resources) {
Init();
}
| 18,366 |
37,539 | 0 | static int mmu_spte_clear_track_bits(u64 *sptep)
{
pfn_t pfn;
u64 old_spte = *sptep;
if (!spte_has_volatile_bits(old_spte))
__update_clear_spte_fast(sptep, 0ull);
else
old_spte = __update_clear_spte_slow(sptep, 0ull);
if (!is_rmap_spte(old_spte))
return 0;
pfn = spte_to_pfn(old_spte);
/*
* KVM does not hold the refcount of the page used by
* kvm mmu, before reclaiming the page, we should
* unmap it from mmu first.
*/
WARN_ON(!kvm_is_mmio_pfn(pfn) && !page_count(pfn_to_page(pfn)));
if (!shadow_accessed_mask || old_spte & shadow_accessed_mask)
kvm_set_pfn_accessed(pfn);
if (!shadow_dirty_mask || (old_spte & shadow_dirty_mask))
kvm_set_pfn_dirty(pfn);
return 1;
}
| 18,367 |
114,438 | 0 | DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo(
int32 buffer_id, IDirect3DSurface9* surface)
: input_buffer_id(buffer_id),
dest_surface(surface) {
}
| 18,368 |
17,349 | 0 | maybe_make_export_env ()
{
register char **temp_array;
int new_size;
VAR_CONTEXT *tcxt;
if (array_needs_making)
{
if (export_env)
strvec_flush (export_env);
/* Make a guess based on how many shell variables and functions we
have. Since there will always be array variables, and array
variables are not (yet) exported, this will always be big enough
for the exported variables and functions. */
new_size = n_shell_variables () + HASH_ENTRIES (shell_functions) + 1 +
HASH_ENTRIES (temporary_env);
if (new_size > export_env_size)
{
export_env_size = new_size;
export_env = strvec_resize (export_env, export_env_size);
environ = export_env;
}
export_env[export_env_index = 0] = (char *)NULL;
/* Make a dummy variable context from the temporary_env, stick it on
the front of shell_variables, call make_var_export_array on the
whole thing to flatten it, and convert the list of SHELL_VAR *s
to the form needed by the environment. */
if (temporary_env)
{
tcxt = new_var_context ((char *)NULL, 0);
tcxt->table = temporary_env;
tcxt->down = shell_variables;
}
else
tcxt = shell_variables;
temp_array = make_var_export_array (tcxt);
if (temp_array)
add_temp_array_to_env (temp_array, 0, 0);
if (tcxt != shell_variables)
free (tcxt);
#if defined (RESTRICTED_SHELL)
/* Restricted shells may not export shell functions. */
temp_array = restricted ? (char **)0 : make_func_export_array ();
#else
temp_array = make_func_export_array ();
#endif
if (temp_array)
add_temp_array_to_env (temp_array, 0, 0);
array_needs_making = 0;
}
}
| 18,369 |
147,053 | 0 | void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue(
const WebScriptSource& source,
bool user_gesture,
WebScriptExecutionCallback* callback) {
DCHECK(GetFrame());
RefPtr<DOMWrapperWorld> main_world = &DOMWrapperWorld::MainWorld();
SuspendableScriptExecutor* executor = SuspendableScriptExecutor::Create(
GetFrame(), std::move(main_world), CreateSourcesVector(&source, 1),
user_gesture, callback);
executor->Run();
}
| 18,370 |
77,874 | 0 | test_bson_append_bool (void)
{
bson_t *b;
bson_t *b2;
b = bson_new ();
BSON_ASSERT (bson_append_bool (b, "bool", -1, true));
b2 = get_bson ("test19.bson");
BSON_ASSERT_BSON_EQUAL (b, b2);
bson_destroy (b);
bson_destroy (b2);
}
| 18,371 |
77,827 | 0 | bson_iter_dbpointer (const bson_iter_t *iter, /* IN */
uint32_t *collection_len, /* OUT */
const char **collection, /* OUT */
const bson_oid_t **oid) /* OUT */
{
BSON_ASSERT (iter);
if (collection) {
*collection = NULL;
}
if (oid) {
*oid = NULL;
}
if (ITER_TYPE (iter) == BSON_TYPE_DBPOINTER) {
if (collection_len) {
memcpy (
collection_len, (iter->raw + iter->d1), sizeof (*collection_len));
*collection_len = BSON_UINT32_FROM_LE (*collection_len);
if ((*collection_len) > 0) {
(*collection_len)--;
}
}
if (collection) {
*collection = (const char *) (iter->raw + iter->d2);
}
if (oid) {
*oid = (const bson_oid_t *) (iter->raw + iter->d3);
}
}
}
| 18,372 |
41,412 | 0 | static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data)
{
switch (msr) {
case HV_X64_MSR_APIC_ASSIST_PAGE: {
unsigned long addr;
if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) {
vcpu->arch.hv_vapic = data;
break;
}
addr = gfn_to_hva(vcpu->kvm, data >>
HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT);
if (kvm_is_error_hva(addr))
return 1;
if (clear_user((void __user *)addr, PAGE_SIZE))
return 1;
vcpu->arch.hv_vapic = data;
break;
}
case HV_X64_MSR_EOI:
return kvm_hv_vapic_msr_write(vcpu, APIC_EOI, data);
case HV_X64_MSR_ICR:
return kvm_hv_vapic_msr_write(vcpu, APIC_ICR, data);
case HV_X64_MSR_TPR:
return kvm_hv_vapic_msr_write(vcpu, APIC_TASKPRI, data);
default:
pr_unimpl(vcpu, "HYPER-V unimplemented wrmsr: 0x%x "
"data 0x%llx\n", msr, data);
return 1;
}
return 0;
}
| 18,373 |
5,916 | 0 | static uint32_t ohci_get_frame_remaining(OHCIState *ohci)
{
uint16_t fr;
int64_t tks;
if ((ohci->ctl & OHCI_CTL_HCFS) != OHCI_USB_OPERATIONAL)
return (ohci->frt << 31);
/* Being in USB operational state guarnatees sof_time was
* set already.
*/
tks = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ohci->sof_time;
/* avoid muldiv if possible */
if (tks >= usb_frame_time)
return (ohci->frt << 31);
tks = tks / usb_bit_time;
fr = (uint16_t)(ohci->fi - tks);
return (ohci->frt << 31) | fr;
}
| 18,374 |
57,673 | 0 | static int emulator_get_msr(struct x86_emulate_ctxt *ctxt,
u32 msr_index, u64 *pdata)
{
struct msr_data msr;
int r;
msr.index = msr_index;
msr.host_initiated = false;
r = kvm_get_msr(emul_to_vcpu(ctxt), &msr);
if (r)
return r;
*pdata = msr.data;
return 0;
}
| 18,375 |
83,197 | 0 | stack_init(mrb_state *mrb)
{
struct mrb_context *c = mrb->c;
/* mrb_assert(mrb->stack == NULL); */
c->stbase = (mrb_value *)mrb_calloc(mrb, STACK_INIT_SIZE, sizeof(mrb_value));
c->stend = c->stbase + STACK_INIT_SIZE;
c->stack = c->stbase;
/* mrb_assert(ci == NULL); */
c->cibase = (mrb_callinfo *)mrb_calloc(mrb, CALLINFO_INIT_SIZE, sizeof(mrb_callinfo));
c->ciend = c->cibase + CALLINFO_INIT_SIZE;
c->ci = c->cibase;
c->ci->target_class = mrb->object_class;
c->ci->stackent = c->stack;
}
| 18,376 |
38,411 | 0 | static void cm_recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_recv_wc *mad_recv_wc)
{
struct cm_port *port = mad_agent->context;
struct cm_work *work;
enum ib_cm_event_type event;
u16 attr_id;
int paths = 0;
switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) {
case CM_REQ_ATTR_ID:
paths = 1 + (((struct cm_req_msg *) mad_recv_wc->recv_buf.mad)->
alt_local_lid != 0);
event = IB_CM_REQ_RECEIVED;
break;
case CM_MRA_ATTR_ID:
event = IB_CM_MRA_RECEIVED;
break;
case CM_REJ_ATTR_ID:
event = IB_CM_REJ_RECEIVED;
break;
case CM_REP_ATTR_ID:
event = IB_CM_REP_RECEIVED;
break;
case CM_RTU_ATTR_ID:
event = IB_CM_RTU_RECEIVED;
break;
case CM_DREQ_ATTR_ID:
event = IB_CM_DREQ_RECEIVED;
break;
case CM_DREP_ATTR_ID:
event = IB_CM_DREP_RECEIVED;
break;
case CM_SIDR_REQ_ATTR_ID:
event = IB_CM_SIDR_REQ_RECEIVED;
break;
case CM_SIDR_REP_ATTR_ID:
event = IB_CM_SIDR_REP_RECEIVED;
break;
case CM_LAP_ATTR_ID:
paths = 1;
event = IB_CM_LAP_RECEIVED;
break;
case CM_APR_ATTR_ID:
event = IB_CM_APR_RECEIVED;
break;
default:
ib_free_recv_mad(mad_recv_wc);
return;
}
attr_id = be16_to_cpu(mad_recv_wc->recv_buf.mad->mad_hdr.attr_id);
atomic_long_inc(&port->counter_group[CM_RECV].
counter[attr_id - CM_ATTR_ID_OFFSET]);
work = kmalloc(sizeof *work + sizeof(struct ib_sa_path_rec) * paths,
GFP_KERNEL);
if (!work) {
ib_free_recv_mad(mad_recv_wc);
return;
}
INIT_DELAYED_WORK(&work->work, cm_work_handler);
work->cm_event.event = event;
work->mad_recv_wc = mad_recv_wc;
work->port = port;
queue_delayed_work(cm.wq, &work->work, 0);
}
| 18,377 |
160,817 | 0 | void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) {
webkit_preferences_ = prefs;
ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_);
}
| 18,378 |
82,450 | 0 | void jsvInit() {
#ifdef RESIZABLE_JSVARS
jsVarsSize = JSVAR_BLOCK_SIZE;
jsVarBlocks = malloc(sizeof(JsVar*)); // just 1
jsVarBlocks[0] = malloc(sizeof(JsVar) * JSVAR_BLOCK_SIZE);
#endif
jsVarFirstEmpty = jsvInitJsVars(1/*first*/, jsVarsSize);
jsvSoftInit();
}
| 18,379 |
163,102 | 0 | void BlobStorageContext::IncrementBlobRefCount(const std::string& uuid) {
BlobEntry* entry = registry_.GetEntry(uuid);
DCHECK(entry);
entry->IncrementRefCount();
}
| 18,380 |
169,129 | 0 | bool AreAllFramesInTab() {
std::set<content::RenderFrameHost*> current_frames;
web_contents()->ForEachFrame(
base::BindRepeating(&AddFrameToSet, base::Unretained(¤t_frames)));
for (content::RenderFrameHost* frame : frames_) {
if (!base::ContainsKey(current_frames, frame))
return false;
}
return true;
}
| 18,381 |
45,533 | 0 | static int crypto_authenc_verify(struct aead_request *req,
authenc_ahash_t authenc_ahash_fn)
{
struct crypto_aead *authenc = crypto_aead_reqtfm(req);
struct authenc_request_ctx *areq_ctx = aead_request_ctx(req);
u8 *ohash;
u8 *ihash;
unsigned int authsize;
areq_ctx->complete = authenc_verify_ahash_done;
areq_ctx->update_complete = authenc_verify_ahash_update_done;
ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP);
if (IS_ERR(ohash))
return PTR_ERR(ohash);
authsize = crypto_aead_authsize(authenc);
ihash = ohash + authsize;
scatterwalk_map_and_copy(ihash, areq_ctx->sg, areq_ctx->cryptlen,
authsize, 0);
return crypto_memneq(ihash, ohash, authsize) ? -EBADMSG : 0;
}
| 18,382 |
178,252 | 1 | __imlib_MergeUpdate(ImlibUpdate * u, int w, int h, int hgapmax)
{
ImlibUpdate *nu = NULL, *uu;
struct _tile *t;
int tw, th, x, y, i;
int *gaps = NULL;
/* if theres no rects to process.. return NULL */
if (!u)
return NULL;
tw = w >> TB;
if (w & TM)
tw++;
th = h >> TB;
if (h & TM)
th++;
t = malloc(tw * th * sizeof(struct _tile));
/* fill in tiles to be all not used */
for (i = 0, y = 0; y < th; y++)
{
for (x = 0; x < tw; x++)
t[i++].used = T_UNUSED;
}
/* fill in all tiles */
for (uu = u; uu; uu = uu->next)
{
CLIP(uu->x, uu->y, uu->w, uu->h, 0, 0, w, h);
for (y = uu->y >> TB; y <= ((uu->y + uu->h - 1) >> TB); y++)
{
for (x = uu->x >> TB; x <= ((uu->x + uu->w - 1) >> TB); x++)
T(x, y).used = T_USED;
}
}
/* scan each line - if > hgapmax gaps between tiles, then fill smallest */
gaps = malloc(tw * sizeof(int));
for (y = 0; y < th; y++)
{
int hgaps = 0, start = -1, min;
char have = 1, gap = 0;
for (x = 0; x < tw; x++)
gaps[x] = 0;
for (x = 0; x < tw; x++)
{
if ((have) && (T(x, y).used == T_UNUSED))
{
start = x;
gap = 1;
have = 0;
}
else if ((!have) && (gap) && (T(x, y).used & T_USED))
{
gap = 0;
hgaps++;
have = 1;
gaps[start] = x - start;
}
else if (T(x, y).used & T_USED)
have = 1;
}
while (hgaps > hgapmax)
{
start = -1;
min = tw;
for (x = 0; x < tw; x++)
{
if ((gaps[x] > 0) && (gaps[x] < min))
{
start = x;
min = gaps[x];
}
}
if (start >= 0)
{
gaps[start] = 0;
for (x = start;
T(x, y).used == T_UNUSED; T(x++, y).used = T_USED);
hgaps--;
}
}
}
free(gaps);
/* coalesce tiles into larger blocks and make new rect list */
for (y = 0; y < th; y++)
{
for (x = 0; x < tw; x++)
{
if (T(x, y).used & T_USED)
{
int xx, yy, ww, hh, ok, xww;
for (xx = x + 1, ww = 1;
(T(xx, y).used & T_USED) && (xx < tw); xx++, ww++);
xww = x + ww;
for (yy = y + 1, hh = 1, ok = 1;
(yy < th) && (ok); yy++, hh++)
{
for (xx = x; xx < xww; xx++)
{
if (!(T(xx, yy).used & T_USED))
{
ok = 0;
hh--;
break;
}
}
}
for (yy = y; yy < (y + hh); yy++)
{
for (xx = x; xx < xww; xx++)
T(xx, yy).used = T_UNUSED;
}
nu = __imlib_AddUpdate(nu, (x << TB), (y << TB),
(ww << TB), (hh << TB));
}
}
}
free(t);
__imlib_FreeUpdates(u);
return nu;
}
| 18,383 |
4,959 | 0 | next_entry_size (GstQTDemux * demux)
{
QtDemuxStream *stream;
int i;
int smallidx = -1;
guint64 smalloffs = (guint64) - 1;
GST_LOG_OBJECT (demux, "Finding entry at offset %lld", demux->offset);
for (i = 0; i < demux->n_streams; i++) {
stream = demux->streams[i];
if (stream->sample_index == -1)
stream->sample_index = 0;
GST_LOG_OBJECT (demux,
"Checking Stream %d (sample_index:%d / offset:%lld / size:%d / chunk:%d)",
i, stream->sample_index, stream->samples[stream->sample_index].offset,
stream->samples[stream->sample_index].size,
stream->samples[stream->sample_index].chunk);
if (((smalloffs == -1)
|| (stream->samples[stream->sample_index].offset < smalloffs))
&& (stream->samples[stream->sample_index].size)) {
smallidx = i;
smalloffs = stream->samples[stream->sample_index].offset;
}
}
GST_LOG_OBJECT (demux, "stream %d offset %lld demux->offset :%lld",
smallidx, smalloffs, demux->offset);
if (smallidx == -1)
return -1;
stream = demux->streams[smallidx];
if (stream->samples[stream->sample_index].offset >= demux->offset) {
demux->todrop =
stream->samples[stream->sample_index].offset - demux->offset;
return stream->samples[stream->sample_index].size + demux->todrop;
}
GST_DEBUG_OBJECT (demux, "There wasn't any entry at offset %lld",
demux->offset);
return -1;
}
| 18,384 |
79,316 | 0 | static int mov_get_mpeg2_xdcam_codec_tag(AVFormatContext *s, MOVTrack *track)
{
int tag = track->par->codec_tag;
int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE;
AVStream *st = track->st;
int rate = defined_frame_rate(s, st);
if (!tag)
tag = MKTAG('m', '2', 'v', '1'); //fallback tag
if (track->par->format == AV_PIX_FMT_YUV420P) {
if (track->par->width == 1280 && track->par->height == 720) {
if (!interlaced) {
if (rate == 24) tag = MKTAG('x','d','v','4');
else if (rate == 25) tag = MKTAG('x','d','v','5');
else if (rate == 30) tag = MKTAG('x','d','v','1');
else if (rate == 50) tag = MKTAG('x','d','v','a');
else if (rate == 60) tag = MKTAG('x','d','v','9');
}
} else if (track->par->width == 1440 && track->par->height == 1080) {
if (!interlaced) {
if (rate == 24) tag = MKTAG('x','d','v','6');
else if (rate == 25) tag = MKTAG('x','d','v','7');
else if (rate == 30) tag = MKTAG('x','d','v','8');
} else {
if (rate == 25) tag = MKTAG('x','d','v','3');
else if (rate == 30) tag = MKTAG('x','d','v','2');
}
} else if (track->par->width == 1920 && track->par->height == 1080) {
if (!interlaced) {
if (rate == 24) tag = MKTAG('x','d','v','d');
else if (rate == 25) tag = MKTAG('x','d','v','e');
else if (rate == 30) tag = MKTAG('x','d','v','f');
} else {
if (rate == 25) tag = MKTAG('x','d','v','c');
else if (rate == 30) tag = MKTAG('x','d','v','b');
}
}
} else if (track->par->format == AV_PIX_FMT_YUV422P) {
if (track->par->width == 1280 && track->par->height == 720) {
if (!interlaced) {
if (rate == 24) tag = MKTAG('x','d','5','4');
else if (rate == 25) tag = MKTAG('x','d','5','5');
else if (rate == 30) tag = MKTAG('x','d','5','1');
else if (rate == 50) tag = MKTAG('x','d','5','a');
else if (rate == 60) tag = MKTAG('x','d','5','9');
}
} else if (track->par->width == 1920 && track->par->height == 1080) {
if (!interlaced) {
if (rate == 24) tag = MKTAG('x','d','5','d');
else if (rate == 25) tag = MKTAG('x','d','5','e');
else if (rate == 30) tag = MKTAG('x','d','5','f');
} else {
if (rate == 25) tag = MKTAG('x','d','5','c');
else if (rate == 30) tag = MKTAG('x','d','5','b');
}
}
}
return tag;
}
| 18,385 |
23,787 | 0 | static int __init ifb_init_one(int index)
{
struct net_device *dev_ifb;
int err;
dev_ifb = alloc_netdev(sizeof(struct ifb_private),
"ifb%d", ifb_setup);
if (!dev_ifb)
return -ENOMEM;
dev_ifb->rtnl_link_ops = &ifb_link_ops;
err = register_netdevice(dev_ifb);
if (err < 0)
goto err;
return 0;
err:
free_netdev(dev_ifb);
return err;
}
| 18,386 |
103,092 | 0 | void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
if (!profile() || profile()->IsOffTheRecord() ||
!profile()->GetTabRestoreService()) {
return;
}
if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
profile()->GetTabRestoreService()->CreateHistoricalTab(
&contents->controller(),
tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents));
}
}
| 18,387 |
10,632 | 0 | Ins_MPS( TT_ExecContext exc,
FT_Long* args )
{
if ( NO_SUBPIXEL_HINTING )
{
/* Microsoft's GDI bytecode interpreter always returns value 12; */
/* we return the current PPEM value instead. */
args[0] = exc->func_cur_ppem( exc );
}
else
{
/* A possible practical application of the MPS instruction is to */
/* implement optical scaling and similar features, which should be */
/* based on perceptual attributes, thus independent of the */
/* resolution. */
args[0] = exc->pointSize;
}
}
| 18,388 |
135,503 | 0 | bool DownloadUIAdapterDelegate::IsTemporarilyHiddenInUI(
const ClientId& client_id) {
return false;
}
| 18,389 |
23,070 | 0 | static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args)
{
__be32 *p;
RESERVE_SPACE(52);
WRITE32(OP_LOCKT);
WRITE32(nfs4_lock_type(args->fl, 0));
WRITE64(args->fl->fl_start);
WRITE64(nfs4_lock_length(args->fl));
WRITE64(args->lock_owner.clientid);
WRITE32(16);
WRITEMEM("lock id:", 8);
WRITE64(args->lock_owner.id);
return 0;
}
| 18,390 |
81,444 | 0 | int tracepoint_printk_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
int save_tracepoint_printk;
int ret;
mutex_lock(&tracepoint_printk_mutex);
save_tracepoint_printk = tracepoint_printk;
ret = proc_dointvec(table, write, buffer, lenp, ppos);
/*
* This will force exiting early, as tracepoint_printk
* is always zero when tracepoint_printk_iter is not allocated
*/
if (!tracepoint_print_iter)
tracepoint_printk = 0;
if (save_tracepoint_printk == tracepoint_printk)
goto out;
if (tracepoint_printk)
static_key_enable(&tracepoint_printk_key.key);
else
static_key_disable(&tracepoint_printk_key.key);
out:
mutex_unlock(&tracepoint_printk_mutex);
return ret;
}
| 18,391 |
124,865 | 0 | LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) const
{
LayoutUnit marginStart = 0;
LayoutUnit marginEnd = 0;
return fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd);
}
| 18,392 |
122,460 | 0 | void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection)
{
if (!restorePreviousSelection || !hasCachedSelection()) {
setSelectionRange(0, 0);
} else
restoreCachedSelection();
if (document().frame())
document().frame()->selection().revealSelection();
}
| 18,393 |
92,823 | 0 | int main(int argc, char** argv)
{
return mp4client_main(argc, argv);
}
| 18,394 |
176,368 | 0 | static Handle<JSArray> SpliceImpl(Handle<JSArray> receiver,
uint32_t start, uint32_t delete_count,
Arguments* args, uint32_t add_count) {
Isolate* isolate = receiver->GetIsolate();
Heap* heap = isolate->heap();
uint32_t length = Smi::cast(receiver->length())->value();
uint32_t new_length = length - delete_count + add_count;
ElementsKind kind = KindTraits::Kind;
if (new_length <= static_cast<uint32_t>(receiver->elements()->length()) &&
IsFastSmiOrObjectElementsKind(kind)) {
HandleScope scope(isolate);
JSObject::EnsureWritableFastElements(receiver);
}
Handle<FixedArrayBase> backing_store(receiver->elements(), isolate);
if (new_length == 0) {
receiver->set_elements(heap->empty_fixed_array());
receiver->set_length(Smi::kZero);
return isolate->factory()->NewJSArrayWithElements(
backing_store, KindTraits::Kind, delete_count);
}
Handle<JSArray> deleted_elements = isolate->factory()->NewJSArray(
KindTraits::Kind, delete_count, delete_count);
if (delete_count > 0) {
DisallowHeapAllocation no_gc;
Subclass::CopyElementsImpl(*backing_store, start,
deleted_elements->elements(), KindTraits::Kind,
0, kPackedSizeNotKnown, delete_count);
}
if (add_count < delete_count) {
Subclass::SpliceShrinkStep(isolate, receiver, backing_store, start,
delete_count, add_count, length, new_length);
} else if (add_count > delete_count) {
backing_store =
Subclass::SpliceGrowStep(isolate, receiver, backing_store, start,
delete_count, add_count, length, new_length);
}
Subclass::CopyArguments(args, backing_store, add_count, 3, start);
receiver->set_length(Smi::FromInt(new_length));
Subclass::TryTransitionResultArrayToPacked(deleted_elements);
return deleted_elements;
}
| 18,395 |
25,611 | 0 | static void fpu_init(struct sh_fpu_soft_struct *fpu)
{
int i;
fpu->fpscr = FPSCR_INIT;
fpu->fpul = 0;
for (i = 0; i < 16; i++) {
fpu->fp_regs[i] = 0;
fpu->xfp_regs[i]= 0;
}
}
| 18,396 |
96,089 | 0 | void notify_other(int fd) {
FILE* stream;
int newfd = dup(fd);
if (newfd == -1)
errExit("dup");
stream = fdopen(newfd, "w");
fprintf(stream, "arg_noroot=%d\n", arg_noroot);
fflush(stream);
fclose(stream);
}
| 18,397 |
37,343 | 0 | sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type, void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *asconf_ack = arg;
struct sctp_chunk *last_asconf = asoc->addip_last_asconf;
struct sctp_chunk *abort;
struct sctp_paramhdr *err_param = NULL;
sctp_addiphdr_t *addip_hdr;
__u32 sent_serial, rcvd_serial;
if (!sctp_vtag_verify(asconf_ack, asoc)) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
SCTP_NULL());
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}
/* ADD-IP, Section 4.1.2:
* This chunk MUST be sent in an authenticated way by using
* the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk
* is received unauthenticated it MUST be silently discarded as
* described in [I-D.ietf-tsvwg-sctp-auth].
*/
if (!net->sctp.addip_noauth && !asconf_ack->auth)
return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
/* Make sure that the ADDIP chunk has a valid length. */
if (!sctp_chunk_length_valid(asconf_ack, sizeof(sctp_addip_chunk_t)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands);
addip_hdr = (sctp_addiphdr_t *)asconf_ack->skb->data;
rcvd_serial = ntohl(addip_hdr->serial);
/* Verify the ASCONF-ACK chunk before processing it. */
if (!sctp_verify_asconf(asoc, asconf_ack, false, &err_param))
return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
(void *)err_param, commands);
if (last_asconf) {
addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr;
sent_serial = ntohl(addip_hdr->serial);
} else {
sent_serial = asoc->addip_serial - 1;
}
/* D0) If an endpoint receives an ASCONF-ACK that is greater than or
* equal to the next serial number to be used but no ASCONF chunk is
* outstanding the endpoint MUST ABORT the association. Note that a
* sequence number is greater than if it is no more than 2^^31-1
* larger than the current sequence number (using serial arithmetic).
*/
if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) &&
!(asoc->addip_last_asconf)) {
abort = sctp_make_abort(asoc, asconf_ack,
sizeof(sctp_errhdr_t));
if (abort) {
sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0);
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
SCTP_CHUNK(abort));
}
/* We are going to ABORT, so we might as well stop
* processing the rest of the chunks in the packet.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
SCTP_ERROR(ECONNABORTED));
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
SCTP_PERR(SCTP_ERROR_ASCONF_ACK));
SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS);
SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB);
return SCTP_DISPOSITION_ABORT;
}
if ((rcvd_serial == sent_serial) && asoc->addip_last_asconf) {
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
if (!sctp_process_asconf_ack((struct sctp_association *)asoc,
asconf_ack)) {
/* Successfully processed ASCONF_ACK. We can
* release the next asconf if we have one.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF,
SCTP_NULL());
return SCTP_DISPOSITION_CONSUME;
}
abort = sctp_make_abort(asoc, asconf_ack,
sizeof(sctp_errhdr_t));
if (abort) {
sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0);
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
SCTP_CHUNK(abort));
}
/* We are going to ABORT, so we might as well stop
* processing the rest of the chunks in the packet.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
SCTP_ERROR(ECONNABORTED));
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
SCTP_PERR(SCTP_ERROR_ASCONF_ACK));
SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS);
SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB);
return SCTP_DISPOSITION_ABORT;
}
return SCTP_DISPOSITION_DISCARD;
}
| 18,398 |
60,640 | 0 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg)
{
struct crypto_report_rng rrng;
strncpy(rrng.type, "rng", sizeof(rrng.type));
rrng.seedsize = seedsize(alg);
if (nla_put(skb, CRYPTOCFGA_REPORT_RNG,
sizeof(struct crypto_report_rng), &rrng))
goto nla_put_failure;
return 0;
nla_put_failure:
return -EMSGSIZE;
}
| 18,399 |
Subsets and Splits