unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
119,169
| 0
|
void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
{
if (!m_upload)
return;
if (m_uploadEventsAllowed)
m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, bytesSent, totalBytesToBeSent));
if (bytesSent == totalBytesToBeSent && !m_uploadComplete) {
m_uploadComplete = true;
if (m_uploadEventsAllowed)
m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
}
}
| 12,200
|
157,221
| 0
|
bool WebMediaPlayerImpl::HasAudio() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
return pipeline_metadata_.has_audio;
}
| 12,201
|
130,958
| 0
|
static void perWorldAttributeAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObject* imp = V8TestObject::toNative(info.Holder());
v8SetReturnValueForMainWorld(info, WTF::getPtr(imp->perWorldAttribute()));
}
| 12,202
|
48,217
| 0
|
pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
{
uint16 shortv;
uint32 w, l, tw, tl;
int bychunk;
(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
fprintf(stderr,
"%s: Cannot handle different planar configuration w/ bits/sample != 8\n",
TIFFFileName(in));
return (NULL);
}
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
if (!(TIFFIsTiled(out) || TIFFIsTiled(in))) {
uint32 irps = (uint32) -1L;
TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
/* if biased, force decoded copying to allow image subtraction */
bychunk = !bias && (rowsperstrip == irps);
}else{ /* either in or out is tiled */
if (bias) {
fprintf(stderr,
"%s: Cannot handle tiled configuration w/bias image\n",
TIFFFileName(in));
return (NULL);
}
if (TIFFIsTiled(out)) {
if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
tw = w;
if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
tl = l;
bychunk = (tw == tilewidth && tl == tilelength);
} else { /* out's not, so in must be tiled */
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
bychunk = (tw == w && tl == rowsperstrip);
}
}
#define T 1
#define F 0
#define pack(a,b,c,d,e) ((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
/* Strips -> Tiles */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,T):
return cpContigStrips2ContigTiles;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,T):
return cpContigStrips2SeparateTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,T):
return cpSeparateStrips2ContigTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
return cpSeparateStrips2SeparateTiles;
/* Tiles -> Tiles */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,T):
return cpContigTiles2ContigTiles;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,T):
return cpContigTiles2SeparateTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,T):
return cpSeparateTiles2ContigTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
return cpSeparateTiles2SeparateTiles;
/* Tiles -> Strips */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,T):
return cpContigTiles2ContigStrips;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,T):
return cpContigTiles2SeparateStrips;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,T):
return cpSeparateTiles2ContigStrips;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
return cpSeparateTiles2SeparateStrips;
/* Strips -> Strips */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,F):
return bias ? cpBiasedContig2Contig : cpContig2ContigByRow;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,T):
return cpDecodedStrips;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,T):
return cpContig2SeparateByRow;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,T):
return cpSeparate2ContigByRow;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
return cpSeparate2SeparateByRow;
}
#undef pack
#undef F
#undef T
fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
TIFFFileName(in));
return (NULL);
}
| 12,203
|
127,545
| 0
|
LayerWebKitThread::~LayerWebKitThread()
{
if (m_tiler)
m_tiler->layerWebKitThreadDestroyed();
ASSERT(!superlayer());
removeAll(m_sublayers);
removeAll(m_overlays);
}
| 12,204
|
183,734
| 1
|
void EnterpriseEnrollmentScreen::OnPolicyStateChanged(
policy::CloudPolicySubsystem::PolicySubsystemState state,
policy::CloudPolicySubsystem::ErrorDetails error_details) {
if (is_showing_) {
switch (state) {
case policy::CloudPolicySubsystem::UNENROLLED:
// Still working...
return;
case policy::CloudPolicySubsystem::BAD_GAIA_TOKEN:
case policy::CloudPolicySubsystem::LOCAL_ERROR:
actor_->ShowFatalEnrollmentError();
break;
case policy::CloudPolicySubsystem::UNMANAGED:
actor_->ShowAccountError();
break;
case policy::CloudPolicySubsystem::NETWORK_ERROR:
actor_->ShowNetworkEnrollmentError();
break;
case policy::CloudPolicySubsystem::TOKEN_FETCHED:
WriteInstallAttributesData();
return;
case policy::CloudPolicySubsystem::SUCCESS:
// Success!
registrar_.reset();
UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
policy::kMetricEnrollmentOK,
policy::kMetricEnrollmentSize);
actor_->ShowConfirmationScreen();
return;
}
// We have an error.
if (state == policy::CloudPolicySubsystem::UNMANAGED) {
UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
policy::kMetricEnrollmentNotSupported,
policy::kMetricEnrollmentSize);
} else {
UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
policy::kMetricEnrollmentPolicyFailed,
policy::kMetricEnrollmentSize);
}
LOG(WARNING) << "Policy subsystem error during enrollment: " << state
<< " details: " << error_details;
}
// Stop the policy infrastructure.
registrar_.reset();
g_browser_process->browser_policy_connector()->DeviceStopAutoRetry();
}
| 12,205
|
73,962
| 0
|
rtadv_terminate (struct zebra_vrf *zvrf)
{
/* Empty.*/;
}
| 12,206
|
162,373
| 0
|
void MojoVideoEncodeAcceleratorService::RequestEncodingParametersChange(
uint32_t bitrate,
uint32_t framerate) {
DVLOG(2) << __func__ << " bitrate=" << bitrate << " framerate=" << framerate;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!encoder_)
return;
encoder_->RequestEncodingParametersChange(bitrate, framerate);
}
| 12,207
|
181,241
| 1
|
static int cdxl_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *pkt)
{
CDXLVideoContext *c = avctx->priv_data;
AVFrame * const p = data;
int ret, w, h, encoding, aligned_width, buf_size = pkt->size;
const uint8_t *buf = pkt->data;
if (buf_size < 32)
return AVERROR_INVALIDDATA;
encoding = buf[1] & 7;
c->format = buf[1] & 0xE0;
w = AV_RB16(&buf[14]);
h = AV_RB16(&buf[16]);
c->bpp = buf[19];
c->palette_size = AV_RB16(&buf[20]);
c->palette = buf + 32;
c->video = c->palette + c->palette_size;
c->video_size = buf_size - c->palette_size - 32;
if (c->palette_size > 512)
return AVERROR_INVALIDDATA;
if (buf_size < c->palette_size + 32)
return AVERROR_INVALIDDATA;
if (c->bpp < 1)
return AVERROR_INVALIDDATA;
if (c->format != BIT_PLANAR && c->format != BIT_LINE && c->format != CHUNKY) {
avpriv_request_sample(avctx, "Pixel format 0x%0x", c->format);
return AVERROR_PATCHWELCOME;
}
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
return ret;
if (c->format == CHUNKY)
aligned_width = avctx->width;
else
aligned_width = FFALIGN(c->avctx->width, 16);
c->padded_bits = aligned_width - c->avctx->width;
if (c->video_size < aligned_width * avctx->height * (int64_t)c->bpp / 8)
return AVERROR_INVALIDDATA;
if (!encoding && c->palette_size && c->bpp <= 8 && c->format != CHUNKY) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (encoding == 1 && (c->bpp == 6 || c->bpp == 8)) {
if (c->palette_size != (1 << (c->bpp - 1)))
return AVERROR_INVALIDDATA;
avctx->pix_fmt = AV_PIX_FMT_BGR24;
} else if (!encoding && c->bpp == 24 && c->format == CHUNKY &&
!c->palette_size) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
avpriv_request_sample(avctx, "Encoding %d, bpp %d and format 0x%x",
encoding, c->bpp, c->format);
return AVERROR_PATCHWELCOME;
}
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
if (encoding) {
av_fast_padded_malloc(&c->new_video, &c->new_video_size,
h * w + AV_INPUT_BUFFER_PADDING_SIZE);
if (!c->new_video)
return AVERROR(ENOMEM);
if (c->bpp == 8)
cdxl_decode_ham8(c, p);
else
cdxl_decode_ham6(c, p);
} else if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
cdxl_decode_rgb(c, p);
} else {
cdxl_decode_raw(c, p);
}
*got_frame = 1;
return buf_size;
}
| 12,208
|
120,435
| 0
|
ElementData::ElementData(const ElementData& other, bool isUnique)
: m_isUnique(isUnique)
, m_arraySize(isUnique ? 0 : other.length())
, m_presentationAttributeStyleIsDirty(other.m_presentationAttributeStyleIsDirty)
, m_styleAttributeIsDirty(other.m_styleAttributeIsDirty)
, m_animatedSVGAttributesAreDirty(other.m_animatedSVGAttributesAreDirty)
, m_classNames(other.m_classNames)
, m_idForStyleResolution(other.m_idForStyleResolution)
{
}
| 12,209
|
19,081
| 0
|
void udp_flush_pending_frames(struct sock *sk)
{
struct udp_sock *up = udp_sk(sk);
if (up->pending) {
up->len = 0;
up->pending = 0;
ip_flush_pending_frames(sk);
}
}
| 12,210
|
170,089
| 0
|
xsltParseContentError(xsltStylesheetPtr style,
xmlNodePtr node)
{
if ((style == NULL) || (node == NULL))
return;
if (IS_XSLT_ELEM(node))
xsltTransformError(NULL, style, node,
"The XSLT-element '%s' is not allowed at this position.\n",
node->name);
else
xsltTransformError(NULL, style, node,
"The element '%s' is not allowed at this position.\n",
node->name);
style->errors++;
}
| 12,211
|
160,190
| 0
|
void MemBackendImpl::OnEntryInserted(MemEntryImpl* entry) {
lru_list_.Append(entry);
}
| 12,212
|
69,627
| 0
|
rend_service_parse_intro_for_v0_or_v1(
rend_intro_cell_t *intro,
const uint8_t *buf,
size_t plaintext_len,
char **err_msg_out)
{
const char *rp_nickname, *endptr;
size_t nickname_field_len, ver_specific_len;
if (intro->version == 1) {
ver_specific_len = MAX_HEX_NICKNAME_LEN + 2;
rp_nickname = ((const char *)buf) + 1;
nickname_field_len = MAX_HEX_NICKNAME_LEN + 1;
} else if (intro->version == 0) {
ver_specific_len = MAX_NICKNAME_LEN + 1;
rp_nickname = (const char *)buf;
nickname_field_len = MAX_NICKNAME_LEN + 1;
} else {
if (err_msg_out)
tor_asprintf(err_msg_out,
"rend_service_parse_intro_for_v0_or_v1() called with "
"bad version %d on INTRODUCE%d cell (this is a bug)",
intro->version,
(int)(intro->type));
goto err;
}
if (plaintext_len < ver_specific_len) {
if (err_msg_out)
tor_asprintf(err_msg_out,
"short plaintext of encrypted part in v1 INTRODUCE%d "
"cell (%lu bytes, needed %lu)",
(int)(intro->type),
(unsigned long)plaintext_len,
(unsigned long)ver_specific_len);
goto err;
}
endptr = memchr(rp_nickname, 0, nickname_field_len);
if (!endptr || endptr == rp_nickname) {
if (err_msg_out) {
tor_asprintf(err_msg_out,
"couldn't find a nul-padded nickname in "
"INTRODUCE%d cell",
(int)(intro->type));
}
goto err;
}
if ((intro->version == 0 &&
!is_legal_nickname(rp_nickname)) ||
(intro->version == 1 &&
!is_legal_nickname_or_hexdigest(rp_nickname))) {
if (err_msg_out) {
tor_asprintf(err_msg_out,
"bad nickname in INTRODUCE%d cell",
(int)(intro->type));
}
goto err;
}
memcpy(intro->u.v0_v1.rp, rp_nickname, endptr - rp_nickname + 1);
return ver_specific_len;
err:
return -1;
}
| 12,213
|
52,069
| 0
|
static struct sk_buff *tipc_get_err_tlv(char *str)
{
int str_len = strlen(str) + 1;
struct sk_buff *buf;
buf = tipc_tlv_alloc(TLV_SPACE(str_len));
if (buf)
tipc_add_tlv(buf, TIPC_TLV_ERROR_STRING, str, str_len);
return buf;
}
| 12,214
|
41,757
| 0
|
static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
{
unsigned long rand_num;
struct inet6_dev *idev = ifp->idev;
if (ifp->flags & IFA_F_OPTIMISTIC)
rand_num = 0;
else
rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
ifp->dad_probes = idev->cnf.dad_transmits;
addrconf_mod_dad_work(ifp, rand_num);
}
| 12,215
|
5,382
| 0
|
static void Ins_FLIPOFF( INS_ARG )
{ (void)args;
CUR.GS.auto_flip = FALSE;
}
| 12,216
|
151,172
| 0
|
void InspectorNetworkAgent::DidReceiveWebSocketFrameError(
unsigned long identifier,
const String& error_message) {
GetFrontend()->webSocketFrameError(IdentifiersFactory::RequestId(identifier),
MonotonicallyIncreasingTime(),
error_message);
}
| 12,217
|
185,732
| 1
|
Document* LocalDOMWindow::InstallNewDocument(const String& mime_type,
const DocumentInit& init,
bool force_xhtml) {
DCHECK_EQ(init.GetFrame(), GetFrame());
ClearDocument();
document_ = CreateDocument(mime_type, init, force_xhtml);
event_queue_ = DOMWindowEventQueue::Create(document_.Get());
document_->Initialize();
if (!GetFrame())
return document_;
GetFrame()->GetScriptController().UpdateDocument();
document_->UpdateViewportDescription();
if (GetFrame()->GetPage() && GetFrame()->View()) {
GetFrame()->GetPage()->GetChromeClient().InstallSupplements(*GetFrame());
if (ScrollingCoordinator* scrolling_coordinator =
GetFrame()->GetPage()->GetScrollingCoordinator()) {
scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange(
GetFrame()->View(), kHorizontalScrollbar);
scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange(
GetFrame()->View(), kVerticalScrollbar);
scrolling_coordinator->ScrollableAreaScrollLayerDidChange(
GetFrame()->View());
}
}
GetFrame()->Selection().UpdateSecureKeyboardEntryIfActive();
if (GetFrame()->IsCrossOriginSubframe())
document_->RecordDeferredLoadReason(WouldLoadReason::kCreated);
return document_;
}
| 12,218
|
150,421
| 0
|
int GetShadowElevation(aura::Window* window) {
return window->GetProperty(wm::kShadowElevationKey);
}
| 12,219
|
161,055
| 0
|
bool IDNSpoofChecker::SimilarToTopDomains(base::StringPiece16 hostname) {
size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0);
icu::UnicodeString ustr_host(FALSE, hostname.data(), hostname_length);
if (lgc_letters_n_ascii_.span(ustr_host, 0, USET_SPAN_CONTAINED) ==
ustr_host.length())
diacritic_remover_.get()->transliterate(ustr_host);
extra_confusable_mapper_.get()->transliterate(ustr_host);
UErrorCode status = U_ZERO_ERROR;
icu::UnicodeString ustr_skeleton;
uspoof_getSkeletonUnicodeString(checker_, 0, ustr_host, ustr_skeleton,
&status);
if (U_FAILURE(status))
return false;
std::string skeleton;
return LookupMatchInTopDomains(ustr_skeleton.toUTF8String(skeleton));
}
| 12,220
|
130,421
| 0
|
bool WatchDogThread::PostTask(const tracked_objects::Location& from_here,
const base::Closure& task) {
return PostTaskHelper(from_here, task, base::TimeDelta());
}
| 12,221
|
131,701
| 0
|
static void sequenceTestInterfaceEmptyMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectPythonV8Internal::sequenceTestInterfaceEmptyMethodMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 12,222
|
78,798
| 0
|
sc_pkcs15emu_add_object(sc_pkcs15_card_t *p15card, int type,
const char *label, void *data,
const sc_pkcs15_id_t *auth_id, int obj_flags)
{
sc_pkcs15_object_t *obj;
int df_type;
obj = calloc(1, sizeof(*obj));
obj->type = type;
obj->data = data;
if (label)
strncpy(obj->label, label, sizeof(obj->label)-1);
obj->flags = obj_flags;
if (auth_id)
obj->auth_id = *auth_id;
switch (type & SC_PKCS15_TYPE_CLASS_MASK) {
case SC_PKCS15_TYPE_AUTH:
df_type = SC_PKCS15_AODF;
break;
case SC_PKCS15_TYPE_PRKEY:
df_type = SC_PKCS15_PRKDF;
break;
case SC_PKCS15_TYPE_PUBKEY:
df_type = SC_PKCS15_PUKDF;
break;
case SC_PKCS15_TYPE_CERT:
df_type = SC_PKCS15_CDF;
break;
default:
sc_log(p15card->card->ctx, "Unknown PKCS15 object type %d", type);
free(obj);
return SC_ERROR_INVALID_ARGUMENTS;
}
obj->df = sc_pkcs15emu_get_df(p15card, df_type);
sc_pkcs15_add_object(p15card, obj);
return 0;
}
| 12,223
|
146,903
| 0
|
void Document::open(Document* entered_document,
ExceptionState& exception_state) {
if (ImportLoader()) {
exception_state.ThrowDOMException(
kInvalidStateError, "Imported document doesn't support open().");
return;
}
if (!IsHTMLDocument()) {
exception_state.ThrowDOMException(kInvalidStateError,
"Only HTML documents support open().");
return;
}
if (throw_on_dynamic_markup_insertion_count_) {
exception_state.ThrowDOMException(
kInvalidStateError,
"Custom Element constructor should not use open().");
return;
}
if (entered_document) {
if (!GetSecurityOrigin()->IsSameSchemeHostPortAndSuborigin(
entered_document->GetSecurityOrigin())) {
exception_state.ThrowSecurityError(
"Can only call open() on same-origin documents.");
return;
}
SetSecurityOrigin(entered_document->GetSecurityOrigin());
if (this != entered_document) {
KURL new_url = entered_document->Url();
new_url.SetFragmentIdentifier(String());
SetURL(new_url);
}
cookie_url_ = entered_document->CookieURL();
}
open();
}
| 12,224
|
44,769
| 0
|
int lxclock(struct lxc_lock *l, int timeout)
{
int ret = -1, saved_errno = errno;
struct flock lk;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (!timeout) {
ret = sem_wait(l->u.sem);
if (ret == -1)
saved_errno = errno;
} else {
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
ret = -2;
goto out;
}
ts.tv_sec += timeout;
ret = sem_timedwait(l->u.sem, &ts);
if (ret == -1)
saved_errno = errno;
}
break;
case LXC_LOCK_FLOCK:
ret = -2;
if (timeout) {
ERROR("Error: timeout not supported with flock");
ret = -2;
goto out;
}
if (!l->u.f.fname) {
ERROR("Error: filename not set for flock");
ret = -2;
goto out;
}
if (l->u.f.fd == -1) {
l->u.f.fd = open(l->u.f.fname, O_RDWR|O_CREAT,
S_IWUSR | S_IRUSR);
if (l->u.f.fd == -1) {
ERROR("Error opening %s", l->u.f.fname);
goto out;
}
}
lk.l_type = F_WRLCK;
lk.l_whence = SEEK_SET;
lk.l_start = 0;
lk.l_len = 0;
ret = fcntl(l->u.f.fd, F_SETLKW, &lk);
if (ret == -1)
saved_errno = errno;
break;
}
out:
errno = saved_errno;
return ret;
}
| 12,225
|
38,825
| 0
|
box_overright(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
PG_RETURN_BOOL(FPge(box1->low.x, box2->low.x));
}
| 12,226
|
134,913
| 0
|
void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
TPMTokenLoader::Get()->SetCryptoTaskRunner(
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::IO));
system_token_certdb_initializer_ =
std::make_unique<internal::SystemTokenCertDBInitializer>();
system_token_certdb_initializer_->Initialize();
CrasAudioHandler::Initialize(
new AudioDevicesPrefHandlerImpl(g_browser_process->local_state()));
content::MediaCaptureDevices::GetInstance()->AddVideoCaptureObserver(
CrasAudioHandler::Get());
quirks::QuirksManager::Initialize(
std::unique_ptr<quirks::QuirksManager::Delegate>(
new quirks::QuirksManagerDelegateImpl()),
g_browser_process->local_state(),
g_browser_process->system_request_context());
bool load_oem_statistics = !StartupUtils::IsOobeCompleted();
system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics(
load_oem_statistics);
base::FilePath downloads_directory;
CHECK(base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
&downloads_directory));
DeviceOAuth2TokenServiceFactory::Initialize();
wake_on_wifi_manager_.reset(new WakeOnWifiManager());
network_throttling_observer_.reset(
new NetworkThrottlingObserver(g_browser_process->local_state()));
arc_service_launcher_ = std::make_unique<arc::ArcServiceLauncher>();
arc_voice_interaction_controller_client_ =
std::make_unique<arc::VoiceInteractionControllerClient>();
chromeos::ResourceReporter::GetInstance()->StartMonitoring(
task_manager::TaskManagerInterface::GetTaskManager());
ChromeBrowserMainPartsLinux::PreMainMessageLoopRun();
}
| 12,227
|
61,533
| 0
|
static inline ssize_t WritePSDOffset(const PSDInfo *psd_info,Image *image,
const MagickSizeType size,const MagickSizeType offset)
{
MagickSizeType
current_offset;
ssize_t
result;
current_offset=TellBlob(image);
SeekBlob(image,offset,SEEK_SET);
if (psd_info->version == 1)
result=WriteBlobMSBShort(image,(unsigned short) size);
else
result=(WriteBlobMSBLong(image,(unsigned short) size));
SeekBlob(image,current_offset,SEEK_SET);
return(result);
}
| 12,228
|
72,356
| 0
|
process_request_identities(SocketEntry *e, int version)
{
Idtab *tab = idtab_lookup(version);
Identity *id;
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((r = sshbuf_put_u8(msg, (version == 1) ?
SSH_AGENT_RSA_IDENTITIES_ANSWER :
SSH2_AGENT_IDENTITIES_ANSWER)) != 0 ||
(r = sshbuf_put_u32(msg, tab->nentries)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
TAILQ_FOREACH(id, &tab->idlist, next) {
if (id->key->type == KEY_RSA1) {
#ifdef WITH_SSH1
if ((r = sshbuf_put_u32(msg,
BN_num_bits(id->key->rsa->n))) != 0 ||
(r = sshbuf_put_bignum1(msg,
id->key->rsa->e)) != 0 ||
(r = sshbuf_put_bignum1(msg,
id->key->rsa->n)) != 0)
fatal("%s: buffer error: %s",
__func__, ssh_err(r));
#endif
} else {
u_char *blob;
size_t blen;
if ((r = sshkey_to_blob(id->key, &blob, &blen)) != 0) {
error("%s: sshkey_to_blob: %s", __func__,
ssh_err(r));
continue;
}
if ((r = sshbuf_put_string(msg, blob, blen)) != 0)
fatal("%s: buffer error: %s",
__func__, ssh_err(r));
free(blob);
}
if ((r = sshbuf_put_cstring(msg, id->comment)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
}
if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
sshbuf_free(msg);
}
| 12,229
|
74,345
| 0
|
static char* get_rootdir(pid_t pid)
{
char buf[sizeof("/proc/%lu/root") + sizeof(long)*3];
sprintf(buf, "/proc/%lu/root", (long)pid);
return malloc_readlink(buf);
}
| 12,230
|
83,135
| 0
|
mrb_fd_cloexec(mrb_state *mrb, int fd)
{
#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
int flags, flags2;
flags = fcntl(fd, F_GETFD);
if (flags == -1) {
mrb_bug(mrb, "mrb_fd_cloexec: fcntl(%S, F_GETFD) failed: %S",
mrb_fixnum_value(fd), mrb_fixnum_value(errno));
}
if (fd <= 2) {
flags2 = flags & ~FD_CLOEXEC; /* Clear CLOEXEC for standard file descriptors: 0, 1, 2. */
}
else {
flags2 = flags | FD_CLOEXEC; /* Set CLOEXEC for non-standard file descriptors: 3, 4, 5, ... */
}
if (flags != flags2) {
if (fcntl(fd, F_SETFD, flags2) == -1) {
mrb_bug(mrb, "mrb_fd_cloexec: fcntl(%S, F_SETFD, %S) failed: %S",
mrb_fixnum_value(fd), mrb_fixnum_value(flags2), mrb_fixnum_value(errno));
}
}
#endif
}
| 12,231
|
114,010
| 0
|
int handle_brightness_down_count() const {
return handle_brightness_down_count_;
}
| 12,232
|
111,598
| 0
|
void TestGetCacheState(const std::string& resource_id, const std::string& md5,
base::PlatformFileError expected_error,
int expected_cache_state, GDataFile* expected_file) {
expected_error_ = expected_error;
expected_cache_state_ = expected_cache_state;
file_system_->GetCacheState(resource_id, md5,
base::Bind(&GDataFileSystemTest::VerifyGetCacheState,
base::Unretained(this)));
RunAllPendingForIO();
}
| 12,233
|
12,486
| 0
|
static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp)
{
int j;
const ASN1_OBJECT *a= *ap;
const ASN1_OBJECT *b= &nid_objs[*bp];
j=(a->length - b->length);
if (j) return(j);
return(memcmp(a->data,b->data,a->length));
}
| 12,234
|
92,861
| 0
|
static void FFD_SetupObjects(FFDemux *ffd)
{
GF_ESD *esd;
GF_ObjectDescriptor *od;
u32 audio_esid = 0;
if ((ffd->audio_st>=0) && (ffd->service_type != 1)) {
od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
esd = FFD_GetESDescriptor(ffd, GF_TRUE);
od->objectDescriptorID = esd->ESID;
audio_esid = esd->ESID;
gf_list_add(od->ESDescriptors, esd);
gf_service_declare_media(ffd->service, (GF_Descriptor*)od, (ffd->video_st>=0) ? GF_TRUE : GF_FALSE);
}
if ((ffd->video_st>=0) && (ffd->service_type != 2)) {
od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
esd = FFD_GetESDescriptor(ffd, GF_FALSE);
od->objectDescriptorID = esd->ESID;
esd->OCRESID = audio_esid;
gf_list_add(od->ESDescriptors, esd);
gf_service_declare_media(ffd->service, (GF_Descriptor*)od, GF_FALSE);
}
}
| 12,235
|
126,586
| 0
|
TabAnimation(TabStripGtk* tabstrip, Type type)
: tabstrip_(tabstrip),
animation_(this),
start_selected_width_(0),
start_unselected_width_(0),
end_selected_width_(0),
end_unselected_width_(0),
layout_on_completion_(false),
type_(type) {
}
| 12,236
|
3,183
| 0
|
zsetcmykcolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp; /* required by "push" macro */
int code, i;
float values[4];
/* Gather numeric operand value(s) (also checks type) */
code = float_params(op, 4, (float *)&values);
if (code < 0)
return code;
/* Clamp numeric operand range(s) */
for (i = 0;i < 4; i++) {
if (values[i] < 0)
values[i] = 0;
else if (values[i] > 1)
values[i] = 1;
}
code = make_floats(&op[-3], (const float *)&values, 4);
if (code < 0)
return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(5);
push_mark_estack(es_other, colour_cleanup);
esp++;
/* variable to hold base type (2 = CMYK) */
make_int(esp, 2);
esp++;
/* Store the 'stage' of processing (initially 0) */
make_int(esp, 0);
/* Finally, the actual continuation routine */
push_op_estack(setdevicecolor_cont);
return o_push_estack;
}
| 12,237
|
95,764
| 0
|
qboolean FS_CompareZipChecksum(const char *zipfile)
{
pack_t *thepak;
int index, checksum;
thepak = FS_LoadZipFile(zipfile, "");
if(!thepak)
return qfalse;
checksum = thepak->checksum;
FS_FreePak(thepak);
for(index = 0; index < fs_numServerReferencedPaks; index++)
{
if(checksum == fs_serverReferencedPaks[index])
return qtrue;
}
return qfalse;
}
| 12,238
|
43,123
| 0
|
static int vhost_scsi_queue_status(struct se_cmd *se_cmd)
{
struct vhost_scsi_cmd *cmd = container_of(se_cmd,
struct vhost_scsi_cmd, tvc_se_cmd);
vhost_scsi_complete_cmd(cmd);
return 0;
}
| 12,239
|
179,588
| 1
|
txid_snapshot_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
TxidSnapshot *snap;
txid last = 0;
int nxip;
int i;
int avail;
int expect;
txid xmin,
xmax;
/*
* load nxip and check for nonsense.
*
* (nxip > avail) check is against int overflows in 'expect'.
*
nxip = pq_getmsgint(buf, 4);
avail = buf->len - buf->cursor;
expect = 8 + 8 + nxip * 8;
if (nxip < 0 || nxip > avail || expect > avail)
goto bad_format;
xmin = pq_getmsgint64(buf);
xmax = pq_getmsgint64(buf);
if (xmin == 0 || xmax == 0 || xmin > xmax || xmax > MAX_TXID)
goto bad_format;
snap = palloc(TXID_SNAPSHOT_SIZE(nxip));
snap->xmin = xmin;
snap->xmax = xmax;
snap->nxip = nxip;
SET_VARSIZE(snap, TXID_SNAPSHOT_SIZE(nxip));
for (i = 0; i < nxip; i++)
{
txid cur = pq_getmsgint64(buf);
if (cur <= last || cur < xmin || cur >= xmax)
goto bad_format;
snap->xip[i] = cur;
last = cur;
}
PG_RETURN_POINTER(snap);
bad_format:
elog(ERROR, "invalid snapshot data");
return (Datum) NULL;
}
| 12,240
|
80,412
| 0
|
void sidx_del(GF_Box *s)
{
GF_SegmentIndexBox *ptr = (GF_SegmentIndexBox *) s;
if (ptr == NULL) return;
if (ptr->refs) gf_free(ptr->refs);
gf_free(ptr);
}
| 12,241
|
66,563
| 0
|
static void rx_fixup(unsigned long data)
{
pegasus_t *pegasus;
int status;
pegasus = (pegasus_t *) data;
if (pegasus->flags & PEGASUS_UNPLUG)
return;
if (pegasus->flags & PEGASUS_RX_URB_FAIL)
if (pegasus->rx_skb)
goto try_again;
if (pegasus->rx_skb == NULL)
pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net,
PEGASUS_MTU,
GFP_ATOMIC);
if (pegasus->rx_skb == NULL) {
netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n");
tasklet_schedule(&pegasus->rx_tl);
return;
}
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU,
read_bulk_callback, pegasus);
try_again:
status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
if (status == -ENODEV)
netif_device_detach(pegasus->net);
else if (status) {
pegasus->flags |= PEGASUS_RX_URB_FAIL;
tasklet_schedule(&pegasus->rx_tl);
} else {
pegasus->flags &= ~PEGASUS_RX_URB_FAIL;
}
}
| 12,242
|
83,283
| 0
|
uint32 CSoundFile::CalculateXParam(PATTERNINDEX pat, ROWINDEX row, CHANNELINDEX chn, bool *isExtended) const
{
if(isExtended != nullptr) *isExtended = false;
ROWINDEX maxCommands = 4;
const ModCommand *m = Patterns[pat].GetpModCommand(row, chn);
uint32 val = m->param;
switch(m->command)
{
case CMD_OFFSET:
maxCommands = 2;
break;
case CMD_TEMPO:
case CMD_PATTERNBREAK:
case CMD_POSITIONJUMP:
maxCommands = 1;
break;
default:
return val;
}
const bool xmTempoFix = m->command == CMD_TEMPO && GetType() == MOD_TYPE_XM;
ROWINDEX numRows = std::min(Patterns[pat].GetNumRows() - row - 1, maxCommands);
while(numRows > 0)
{
m += Patterns[pat].GetNumChannels();
if(m->command != CMD_XPARAM)
{
break;
}
if(xmTempoFix && val < 256)
{
val -= 0x20;
}
val = (val << 8) | m->param;
numRows--;
if(isExtended != nullptr) *isExtended = true;
}
return val;
}
| 12,243
|
19,811
| 0
|
static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
struct nfs_fattr *fattr, struct iattr *sattr,
struct nfs4_state *state)
{
struct nfs_server *server = NFS_SERVER(inode);
struct nfs_setattrargs arg = {
.fh = NFS_FH(inode),
.iap = sattr,
.server = server,
.bitmask = server->attr_bitmask,
};
struct nfs_setattrres res = {
.fattr = fattr,
.server = server,
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETATTR],
.rpc_argp = &arg,
.rpc_resp = &res,
.rpc_cred = cred,
};
unsigned long timestamp = jiffies;
int status;
nfs_fattr_init(fattr);
if (state != NULL) {
nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE,
current->files, current->tgid);
} else if (nfs4_copy_delegation_stateid(&arg.stateid, inode,
FMODE_WRITE)) {
/* Use that stateid */
} else
nfs4_stateid_copy(&arg.stateid, &zero_stateid);
status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
if (status == 0 && state != NULL)
renew_lease(server, timestamp);
return status;
}
| 12,244
|
120,320
| 0
|
void OnSignalConnected(const std::string& interface,
const std::string& signal,
bool succeeded) {
LOG_IF(ERROR, !succeeded) << "Connect to " << interface << " " <<
signal << " failed.";
}
| 12,245
|
101,656
| 0
|
int Browser::GetContentRestrictionsForSelectedTab() {
int content_restrictions = 0;
TabContents* current_tab = GetSelectedTabContents();
if (current_tab) {
content_restrictions = current_tab->content_restrictions();
NavigationEntry* active_entry = current_tab->controller().GetActiveEntry();
if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()))
content_restrictions |= CONTENT_RESTRICTION_SAVE;
}
return content_restrictions;
}
| 12,246
|
70,096
| 0
|
static opj_pi_iterator_t * opj_pi_create(const opj_image_t *image,
const opj_cp_t *cp,
OPJ_UINT32 tileno)
{
/* loop*/
OPJ_UINT32 pino, compno;
/* number of poc in the p_pi*/
OPJ_UINT32 l_poc_bound;
/* pointers to tile coding parameters and components.*/
opj_pi_iterator_t *l_pi = 00;
opj_tcp_t *tcp = 00;
const opj_tccp_t *tccp = 00;
/* current packet iterator being allocated*/
opj_pi_iterator_t *l_current_pi = 00;
/* preconditions in debug*/
assert(cp != 00);
assert(image != 00);
assert(tileno < cp->tw * cp->th);
/* initializations*/
tcp = &cp->tcps[tileno];
l_poc_bound = tcp->numpocs + 1;
/* memory allocations*/
l_pi = (opj_pi_iterator_t*) opj_calloc((l_poc_bound),
sizeof(opj_pi_iterator_t));
if (!l_pi) {
return NULL;
}
l_current_pi = l_pi;
for (pino = 0; pino < l_poc_bound ; ++pino) {
l_current_pi->comps = (opj_pi_comp_t*) opj_calloc(image->numcomps,
sizeof(opj_pi_comp_t));
if (! l_current_pi->comps) {
opj_pi_destroy(l_pi, l_poc_bound);
return NULL;
}
l_current_pi->numcomps = image->numcomps;
for (compno = 0; compno < image->numcomps; ++compno) {
opj_pi_comp_t *comp = &l_current_pi->comps[compno];
tccp = &tcp->tccps[compno];
comp->resolutions = (opj_pi_resolution_t*) opj_calloc(tccp->numresolutions,
sizeof(opj_pi_resolution_t));
if (!comp->resolutions) {
opj_pi_destroy(l_pi, l_poc_bound);
return 00;
}
comp->numresolutions = tccp->numresolutions;
}
++l_current_pi;
}
return l_pi;
}
| 12,247
|
8,302
| 0
|
XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src)
{
XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
xXFixesCopyRegionReq *req;
XFixesSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (XFixesCopyRegion, req);
req->reqType = info->codes->major_opcode;
req->xfixesReqType = X_XFixesCopyRegion;
req->source = src;
req->destination = dst;
UnlockDisplay (dpy);
SyncHandle();
}
| 12,248
|
104,857
| 0
|
Extension::PermissionMessages Extension::GetPermissionMessages() const {
PermissionMessages messages;
if (!plugins().empty()) {
messages.push_back(PermissionMessage::CreateFromMessageId(
PermissionMessage::ID_FULL_ACCESS));
return messages;
}
if (HasEffectiveAccessToAllHosts()) {
messages.push_back(PermissionMessage::CreateFromMessageId(
PermissionMessage::ID_HOSTS_ALL));
} else {
std::vector<std::string> hosts = GetDistinctHostsForDisplay(
GetEffectiveHostPermissions().patterns());
if (!hosts.empty())
messages.push_back(PermissionMessage::CreateFromHostList(hosts));
}
std::set<PermissionMessage> simple_msgs = GetSimplePermissionMessages();
messages.insert(messages.end(), simple_msgs.begin(), simple_msgs.end());
return messages;
}
| 12,249
|
47,678
| 0
|
static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info)
{
/* icmpv6_notify checks 8 bytes can be pulled, icmp6hdr is 8 bytes */
struct icmp6hdr *icmp6 = (struct icmp6hdr *) (skb->data + offset);
struct net *net = dev_net(skb->dev);
if (type == ICMPV6_PKT_TOOBIG)
ip6_update_pmtu(skb, net, info, 0, 0);
else if (type == NDISC_REDIRECT)
ip6_redirect(skb, net, skb->dev->ifindex, 0);
if (!(type & ICMPV6_INFOMSG_MASK))
if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)
ping_err(skb, offset, ntohl(info));
}
| 12,250
|
71,824
| 0
|
static void ipa_draw_line(wmfAPI * API, wmfDrawLine_t * draw_line)
{
/* Save graphic wand */
(void) PushDrawingWand(WmfDrawingWand);
if (TO_DRAW(draw_line))
{
util_set_pen(API, draw_line->dc);
DrawLine(WmfDrawingWand,
XC(draw_line->from.x), YC(draw_line->from.y),
XC(draw_line->to.x), YC(draw_line->to.y));
}
/* Restore graphic wand */
(void) PopDrawingWand(WmfDrawingWand);
}
| 12,251
|
48,083
| 0
|
static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
u32 exit_intr_info,
unsigned long exit_qualification)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
u32 vm_inst_error = 0;
/* trying to cancel vmlaunch/vmresume is a bug */
WARN_ON_ONCE(vmx->nested.nested_run_pending);
leave_guest_mode(vcpu);
prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
exit_qualification);
if (nested_vmx_store_msr(vcpu, vmcs12->vm_exit_msr_store_addr,
vmcs12->vm_exit_msr_store_count))
nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL);
if (unlikely(vmx->fail))
vm_inst_error = vmcs_read32(VM_INSTRUCTION_ERROR);
vmx_load_vmcs01(vcpu);
if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
&& nested_exit_intr_ack_set(vcpu)) {
int irq = kvm_cpu_get_interrupt(vcpu);
WARN_ON(irq < 0);
vmcs12->vm_exit_intr_info = irq |
INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR;
}
trace_kvm_nested_vmexit_inject(vmcs12->vm_exit_reason,
vmcs12->exit_qualification,
vmcs12->idt_vectoring_info_field,
vmcs12->vm_exit_intr_info,
vmcs12->vm_exit_intr_error_code,
KVM_ISA_VMX);
vm_entry_controls_reset_shadow(vmx);
vm_exit_controls_reset_shadow(vmx);
vmx_segment_cache_clear(vmx);
/* if no vmcs02 cache requested, remove the one we used */
if (VMCS02_POOL_SIZE == 0)
nested_free_vmcs02(vmx, vmx->nested.current_vmptr);
load_vmcs12_host_state(vcpu, vmcs12);
/* Update any VMCS fields that might have changed while L2 ran */
vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.nr);
vmcs_write64(TSC_OFFSET, vcpu->arch.tsc_offset);
if (vmx->hv_deadline_tsc == -1)
vmcs_clear_bits(PIN_BASED_VM_EXEC_CONTROL,
PIN_BASED_VMX_PREEMPTION_TIMER);
else
vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
PIN_BASED_VMX_PREEMPTION_TIMER);
if (kvm_has_tsc_control)
decache_tsc_multiplier(vmx);
if (vmx->nested.change_vmcs01_virtual_x2apic_mode) {
vmx->nested.change_vmcs01_virtual_x2apic_mode = false;
vmx_set_virtual_x2apic_mode(vcpu,
vcpu->arch.apic_base & X2APIC_ENABLE);
}
/* This is needed for same reason as it was needed in prepare_vmcs02 */
vmx->host_rsp = 0;
/* Unpin physical memory we referred to in vmcs02 */
if (vmx->nested.apic_access_page) {
nested_release_page(vmx->nested.apic_access_page);
vmx->nested.apic_access_page = NULL;
}
if (vmx->nested.virtual_apic_page) {
nested_release_page(vmx->nested.virtual_apic_page);
vmx->nested.virtual_apic_page = NULL;
}
if (vmx->nested.pi_desc_page) {
kunmap(vmx->nested.pi_desc_page);
nested_release_page(vmx->nested.pi_desc_page);
vmx->nested.pi_desc_page = NULL;
vmx->nested.pi_desc = NULL;
}
/*
* We are now running in L2, mmu_notifier will force to reload the
* page's hpa for L2 vmcs. Need to reload it for L1 before entering L1.
*/
kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
/*
* Exiting from L2 to L1, we're now back to L1 which thinks it just
* finished a VMLAUNCH or VMRESUME instruction, so we need to set the
* success or failure flag accordingly.
*/
if (unlikely(vmx->fail)) {
vmx->fail = 0;
nested_vmx_failValid(vcpu, vm_inst_error);
} else
nested_vmx_succeed(vcpu);
if (enable_shadow_vmcs)
vmx->nested.sync_shadow_vmcs = true;
/* in case we halted in L2 */
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
}
| 12,252
|
104,005
| 0
|
error::Error GLES2DecoderImpl::DoCommand(
unsigned int command,
unsigned int arg_count,
const void* cmd_data) {
error::Error result = error::kNoError;
if (debug()) {
DLOG(INFO) << "[" << this << "]" << "cmd: " << GetCommandName(command);
}
unsigned int command_index = command - kStartPoint - 1;
if (command_index < arraysize(g_command_info)) {
const CommandInfo& info = g_command_info[command_index];
unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) ||
(info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) {
uint32 immediate_data_size =
(arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT
switch (command) {
#define GLES2_CMD_OP(name) \
case name::kCmdId: \
result = Handle ## name( \
immediate_data_size, \
*static_cast<const name*>(cmd_data)); \
break; \
GLES2_COMMAND_LIST(GLES2_CMD_OP)
#undef GLES2_CMD_OP
}
if (debug()) {
GLenum error;
while ((error = glGetError()) != GL_NO_ERROR) {
SetGLError(error, NULL);
DLOG(INFO) << "[" << this << "]"
<< "GL ERROR: " << error << " : " << GetCommandName(command);
}
}
} else {
result = error::kInvalidArguments;
}
} else {
result = DoCommonCommand(command, arg_count, cmd_data);
}
if (result == error::kNoError && current_decoder_error_ != error::kNoError) {
result = current_decoder_error_;
current_decoder_error_ = error::kNoError;
}
return result;
}
| 12,253
|
32,794
| 0
|
static void tg3_tx_skb_unmap(struct tg3_napi *tnapi, u32 entry, int last)
{
int i;
struct sk_buff *skb;
struct tg3_tx_ring_info *txb = &tnapi->tx_buffers[entry];
skb = txb->skb;
txb->skb = NULL;
pci_unmap_single(tnapi->tp->pdev,
dma_unmap_addr(txb, mapping),
skb_headlen(skb),
PCI_DMA_TODEVICE);
while (txb->fragmented) {
txb->fragmented = false;
entry = NEXT_TX(entry);
txb = &tnapi->tx_buffers[entry];
}
for (i = 0; i <= last; i++) {
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
entry = NEXT_TX(entry);
txb = &tnapi->tx_buffers[entry];
pci_unmap_page(tnapi->tp->pdev,
dma_unmap_addr(txb, mapping),
skb_frag_size(frag), PCI_DMA_TODEVICE);
while (txb->fragmented) {
txb->fragmented = false;
entry = NEXT_TX(entry);
txb = &tnapi->tx_buffers[entry];
}
}
}
| 12,254
|
133,071
| 0
|
LRESULT HWNDMessageHandler::DefWindowProcWithRedrawLock(UINT message,
WPARAM w_param,
LPARAM l_param) {
ScopedRedrawLock lock(this);
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
LRESULT result = DefWindowProc(hwnd(), message, w_param, l_param);
if (!ref)
lock.CancelUnlockOperation();
return result;
}
| 12,255
|
31,812
| 0
|
void task_clear_jobctl_trapping(struct task_struct *task)
{
if (unlikely(task->jobctl & JOBCTL_TRAPPING)) {
task->jobctl &= ~JOBCTL_TRAPPING;
wake_up_bit(&task->jobctl, JOBCTL_TRAPPING_BIT);
}
}
| 12,256
|
160,884
| 0
|
void SetSize(const WebSize& new_size) { size_ = new_size; }
| 12,257
|
87,111
| 0
|
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw)
{
cJSON *item = cJSON_New_Item(&global_hooks);
if(item)
{
item->type = cJSON_Raw;
item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks);
if(!item->valuestring)
{
cJSON_Delete(item);
return NULL;
}
}
return item;
}
| 12,258
|
42,612
| 0
|
struct sock *__udp6_lib_lookup(struct net *net,
const struct in6_addr *saddr, __be16 sport,
const struct in6_addr *daddr, __be16 dport,
int dif, struct udp_table *udptable)
{
struct sock *sk, *result;
struct hlist_nulls_node *node;
unsigned short hnum = ntohs(dport);
unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask);
struct udp_hslot *hslot2, *hslot = &udptable->hash[slot];
int score, badness, matches = 0, reuseport = 0;
u32 hash = 0;
rcu_read_lock();
if (hslot->count > 10) {
hash2 = udp6_portaddr_hash(net, daddr, hnum);
slot2 = hash2 & udptable->mask;
hslot2 = &udptable->hash2[slot2];
if (hslot->count < hslot2->count)
goto begin;
result = udp6_lib_lookup2(net, saddr, sport,
daddr, hnum, dif,
hslot2, slot2);
if (!result) {
hash2 = udp6_portaddr_hash(net, &in6addr_any, hnum);
slot2 = hash2 & udptable->mask;
hslot2 = &udptable->hash2[slot2];
if (hslot->count < hslot2->count)
goto begin;
result = udp6_lib_lookup2(net, saddr, sport,
&in6addr_any, hnum, dif,
hslot2, slot2);
}
rcu_read_unlock();
return result;
}
begin:
result = NULL;
badness = -1;
sk_nulls_for_each_rcu(sk, node, &hslot->head) {
score = compute_score(sk, net, hnum, saddr, sport, daddr, dport, dif);
if (score > badness) {
result = sk;
badness = score;
reuseport = sk->sk_reuseport;
if (reuseport) {
hash = udp6_ehashfn(net, daddr, hnum,
saddr, sport);
matches = 1;
}
} else if (score == badness && reuseport) {
matches++;
if (reciprocal_scale(hash, matches) == 0)
result = sk;
hash = next_pseudo_random32(hash);
}
}
/*
* if the nulls value we got at the end of this lookup is
* not the expected one, we must restart lookup.
* We probably met an item that was moved to another chain.
*/
if (get_nulls_value(node) != slot)
goto begin;
if (result) {
if (unlikely(!atomic_inc_not_zero_hint(&result->sk_refcnt, 2)))
result = NULL;
else if (unlikely(compute_score(result, net, hnum, saddr, sport,
daddr, dport, dif) < badness)) {
sock_put(result);
goto begin;
}
}
rcu_read_unlock();
return result;
}
| 12,259
|
96,617
| 0
|
static int bin_trycatch(RCore *core, int mode) {
RBinFile *bf = r_bin_cur (core->bin);
RListIter *iter;
RBinTrycatch *tc;
RList *trycatch = r_bin_file_get_trycatch (bf);
int idx = 0;
r_list_foreach (trycatch, iter, tc) {
r_cons_printf ("f try.%d.%"PFMT64x".from=0x%08"PFMT64x"\n", idx, tc->source, tc->from);
r_cons_printf ("f try.%d.%"PFMT64x".to=0x%08"PFMT64x"\n", idx, tc->source, tc->to);
r_cons_printf ("f try.%d.%"PFMT64x".catch=0x%08"PFMT64x"\n", idx, tc->source, tc->handler);
idx++;
}
return true;
}
| 12,260
|
21,406
| 0
|
void swap_free(swp_entry_t entry)
{
struct swap_info_struct *p;
p = swap_info_get(entry);
if (p) {
swap_entry_free(p, entry, 1);
spin_unlock(&swap_lock);
}
}
| 12,261
|
142,048
| 0
|
HRESULT CGaiaCredentialBase::CreateGaiaLogonToken(
base::win::ScopedHandle* token,
PSID* sid) {
DCHECK(token);
DCHECK(sid);
auto policy = ScopedLsaPolicy::Create(POLICY_ALL_ACCESS);
if (!policy) {
LOGFN(ERROR) << "LsaOpenPolicy failed";
return E_UNEXPECTED;
}
wchar_t gaia_username[kWindowsUsernameBufferLength];
HRESULT hr = policy->RetrievePrivateData(kLsaKeyGaiaUsername, gaia_username,
base::size(gaia_username));
if (FAILED(hr)) {
LOGFN(ERROR) << "Retrieve gaia username hr=" << putHR(hr);
return hr;
}
wchar_t password[32];
hr = policy->RetrievePrivateData(kLsaKeyGaiaPassword, password,
base::size(password));
if (FAILED(hr)) {
LOGFN(ERROR) << "Retrieve password for gaia user '" << gaia_username
<< "' hr=" << putHR(hr);
return hr;
}
base::string16 local_domain = OSUserManager::GetLocalDomain();
hr = OSUserManager::Get()->CreateLogonToken(local_domain.c_str(),
gaia_username, password,
/*interactive=*/false, token);
if (FAILED(hr)) {
LOGFN(ERROR) << "CreateLogonToken hr=" << putHR(hr);
return hr;
}
hr = OSProcessManager::Get()->GetTokenLogonSID(*token, sid);
if (FAILED(hr)) {
LOGFN(ERROR) << "GetTokenLogonSID hr=" << putHR(hr);
token->Close();
return hr;
}
wchar_t* sid_string;
if (::ConvertSidToStringSid(*sid, &sid_string)) {
LOGFN(INFO) << "logon-sid=" << sid_string;
LocalFree(sid_string);
} else {
LOGFN(ERROR) << "logon-sid=<can't get string>";
}
return S_OK;
}
| 12,262
|
36,564
| 0
|
void cgsem_reset(cgsem_t *cgsem)
{
int ret;
do {
ret = sem_trywait(cgsem);
if (unlikely(ret < 0 && interrupted()))
ret = 0;
} while (!ret);
}
| 12,263
|
112,305
| 0
|
content::RenderView* view() { return view_; }
| 12,264
|
172,601
| 0
|
status_t AudioFlinger::EffectModule::configure()
{
status_t status;
sp<ThreadBase> thread;
uint32_t size;
audio_channel_mask_t channelMask;
if (mEffectInterface == NULL) {
status = NO_INIT;
goto exit;
}
thread = mThread.promote();
if (thread == 0) {
status = DEAD_OBJECT;
goto exit;
}
channelMask = thread->channelMask();
mConfig.outputCfg.channels = channelMask;
if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_MONO;
} else {
mConfig.inputCfg.channels = channelMask;
if (channelMask == AUDIO_CHANNEL_OUT_MONO) {
mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
mConfig.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
ALOGV("Overriding effect input and output as STEREO");
}
}
mConfig.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
mConfig.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
mConfig.inputCfg.samplingRate = thread->sampleRate();
mConfig.outputCfg.samplingRate = mConfig.inputCfg.samplingRate;
mConfig.inputCfg.bufferProvider.cookie = NULL;
mConfig.inputCfg.bufferProvider.getBuffer = NULL;
mConfig.inputCfg.bufferProvider.releaseBuffer = NULL;
mConfig.outputCfg.bufferProvider.cookie = NULL;
mConfig.outputCfg.bufferProvider.getBuffer = NULL;
mConfig.outputCfg.bufferProvider.releaseBuffer = NULL;
mConfig.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
if (mConfig.inputCfg.buffer.raw != mConfig.outputCfg.buffer.raw) {
mConfig.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
} else {
mConfig.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_WRITE;
}
mConfig.inputCfg.mask = EFFECT_CONFIG_ALL;
mConfig.outputCfg.mask = EFFECT_CONFIG_ALL;
mConfig.inputCfg.buffer.frameCount = thread->frameCount();
mConfig.outputCfg.buffer.frameCount = mConfig.inputCfg.buffer.frameCount;
ALOGV("configure() %p thread %p buffer %p framecount %d",
this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);
status_t cmdStatus;
size = sizeof(int);
status = (*mEffectInterface)->command(mEffectInterface,
EFFECT_CMD_SET_CONFIG,
sizeof(effect_config_t),
&mConfig,
&size,
&cmdStatus);
if (status == 0) {
status = cmdStatus;
}
if (status == 0 &&
(memcmp(&mDescriptor.type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0)) {
uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
effect_param_t *p = (effect_param_t *)buf32;
p->psize = sizeof(uint32_t);
p->vsize = sizeof(uint32_t);
size = sizeof(int);
*(int32_t *)p->data = VISUALIZER_PARAM_LATENCY;
uint32_t latency = 0;
PlaybackThread *pbt = thread->mAudioFlinger->checkPlaybackThread_l(thread->mId);
if (pbt != NULL) {
latency = pbt->latency_l();
}
*((int32_t *)p->data + 1)= latency;
(*mEffectInterface)->command(mEffectInterface,
EFFECT_CMD_SET_PARAM,
sizeof(effect_param_t) + 8,
&buf32,
&size,
&cmdStatus);
}
mMaxDisableWaitCnt = (MAX_DISABLE_TIME_MS * mConfig.outputCfg.samplingRate) /
(1000 * mConfig.outputCfg.buffer.frameCount);
exit:
mStatus = status;
return status;
}
| 12,265
|
71,189
| 0
|
static bool hva_to_pfn_fast(unsigned long addr, bool atomic, bool *async,
bool write_fault, bool *writable, kvm_pfn_t *pfn)
{
struct page *page[1];
int npages;
if (!(async || atomic))
return false;
/*
* Fast pin a writable pfn only if it is a write fault request
* or the caller allows to map a writable pfn for a read fault
* request.
*/
if (!(write_fault || writable))
return false;
npages = __get_user_pages_fast(addr, 1, 1, page);
if (npages == 1) {
*pfn = page_to_pfn(page[0]);
if (writable)
*writable = true;
return true;
}
return false;
}
| 12,266
|
12,755
| 0
|
static int tls_process_cke_rsa(SSL *s, PACKET *pkt, int *al)
{
#ifndef OPENSSL_NO_RSA
unsigned char rand_premaster_secret[SSL_MAX_MASTER_KEY_LENGTH];
int decrypt_len;
unsigned char decrypt_good, version_good;
size_t j, padding_len;
PACKET enc_premaster;
RSA *rsa = NULL;
unsigned char *rsa_decrypt = NULL;
int ret = 0;
rsa = EVP_PKEY_get0_RSA(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey);
if (rsa == NULL) {
*al = SSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, SSL_R_MISSING_RSA_CERTIFICATE);
return 0;
}
/* SSLv3 and pre-standard DTLS omit the length bytes. */
if (s->version == SSL3_VERSION || s->version == DTLS1_BAD_VER) {
enc_premaster = *pkt;
} else {
if (!PACKET_get_length_prefixed_2(pkt, &enc_premaster)
|| PACKET_remaining(pkt) != 0) {
*al = SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, SSL_R_LENGTH_MISMATCH);
return 0;
}
}
/*
* We want to be sure that the plaintext buffer size makes it safe to
* iterate over the entire size of a premaster secret
* (SSL_MAX_MASTER_KEY_LENGTH). Reject overly short RSA keys because
* their ciphertext cannot accommodate a premaster secret anyway.
*/
if (RSA_size(rsa) < SSL_MAX_MASTER_KEY_LENGTH) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, RSA_R_KEY_SIZE_TOO_SMALL);
return 0;
}
rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
if (rsa_decrypt == NULL) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, ERR_R_MALLOC_FAILURE);
return 0;
}
/*
* We must not leak whether a decryption failure occurs because of
* Bleichenbacher's attack on PKCS #1 v1.5 RSA padding (see RFC 2246,
* section 7.4.7.1). The code follows that advice of the TLS RFC and
* generates a random premaster secret for the case that the decrypt
* fails. See https://tools.ietf.org/html/rfc5246#section-7.4.7.1
*/
if (RAND_bytes(rand_premaster_secret, sizeof(rand_premaster_secret)) <= 0)
goto err;
/*
* Decrypt with no padding. PKCS#1 padding will be removed as part of
* the timing-sensitive code below.
*/
decrypt_len = RSA_private_decrypt(PACKET_remaining(&enc_premaster),
PACKET_data(&enc_premaster),
rsa_decrypt, rsa, RSA_NO_PADDING);
if (decrypt_len < 0)
goto err;
/* Check the padding. See RFC 3447, section 7.2.2. */
/*
* The smallest padded premaster is 11 bytes of overhead. Small keys
* are publicly invalid, so this may return immediately. This ensures
* PS is at least 8 bytes.
*/
if (decrypt_len < 11 + SSL_MAX_MASTER_KEY_LENGTH) {
*al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, SSL_R_DECRYPTION_FAILED);
goto err;
}
padding_len = decrypt_len - SSL_MAX_MASTER_KEY_LENGTH;
decrypt_good = constant_time_eq_int_8(rsa_decrypt[0], 0) &
constant_time_eq_int_8(rsa_decrypt[1], 2);
for (j = 2; j < padding_len - 1; j++) {
decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]);
}
decrypt_good &= constant_time_is_zero_8(rsa_decrypt[padding_len - 1]);
/*
* If the version in the decrypted pre-master secret is correct then
* version_good will be 0xff, otherwise it'll be zero. The
* Klima-Pokorny-Rosa extension of Bleichenbacher's attack
* (http://eprint.iacr.org/2003/052/) exploits the version number
* check as a "bad version oracle". Thus version checks are done in
* constant time and are treated like any other decryption error.
*/
version_good =
constant_time_eq_8(rsa_decrypt[padding_len],
(unsigned)(s->client_version >> 8));
version_good &=
constant_time_eq_8(rsa_decrypt[padding_len + 1],
(unsigned)(s->client_version & 0xff));
/*
* The premaster secret must contain the same version number as the
* ClientHello to detect version rollback attacks (strangely, the
* protocol does not offer such protection for DH ciphersuites).
* However, buggy clients exist that send the negotiated protocol
* version instead if the server does not support the requested
* protocol version. If SSL_OP_TLS_ROLLBACK_BUG is set, tolerate such
* clients.
*/
if (s->options & SSL_OP_TLS_ROLLBACK_BUG) {
unsigned char workaround_good;
workaround_good = constant_time_eq_8(rsa_decrypt[padding_len],
(unsigned)(s->version >> 8));
workaround_good &=
constant_time_eq_8(rsa_decrypt[padding_len + 1],
(unsigned)(s->version & 0xff));
version_good |= workaround_good;
}
/*
* Both decryption and version must be good for decrypt_good to
* remain non-zero (0xff).
*/
decrypt_good &= version_good;
/*
* Now copy rand_premaster_secret over from p using
* decrypt_good_mask. If decryption failed, then p does not
* contain valid plaintext, however, a check above guarantees
* it is still sufficiently large to read from.
*/
for (j = 0; j < sizeof(rand_premaster_secret); j++) {
rsa_decrypt[padding_len + j] =
constant_time_select_8(decrypt_good,
rsa_decrypt[padding_len + j],
rand_premaster_secret[j]);
}
if (!ssl_generate_master_secret(s, rsa_decrypt + padding_len,
sizeof(rand_premaster_secret), 0)) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, ERR_R_INTERNAL_ERROR);
goto err;
}
ret = 1;
err:
OPENSSL_free(rsa_decrypt);
return ret;
#else
/* Should never happen */
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CKE_RSA, ERR_R_INTERNAL_ERROR);
return 0;
#endif
}
| 12,267
|
90,445
| 0
|
static void __exit ib_uverbs_cleanup(void)
{
ib_unregister_client(&uverbs_client);
class_destroy(uverbs_class);
unregister_chrdev_region(IB_UVERBS_BASE_DEV,
IB_UVERBS_NUM_FIXED_MINOR);
unregister_chrdev_region(dynamic_uverbs_dev,
IB_UVERBS_NUM_DYNAMIC_MINOR);
}
| 12,268
|
77,299
| 0
|
ofproto_class_find__(const char *type)
{
size_t i;
for (i = 0; i < n_ofproto_classes; i++) {
const struct ofproto_class *class = ofproto_classes[i];
struct sset types;
bool found;
sset_init(&types);
class->enumerate_types(&types);
found = sset_contains(&types, type);
sset_destroy(&types);
if (found) {
return class;
}
}
VLOG_WARN("unknown datapath type %s", type);
return NULL;
}
| 12,269
|
35,575
| 0
|
static int flush_pending_x87_faults(struct x86_emulate_ctxt *ctxt)
{
bool fault = false;
ctxt->ops->get_fpu(ctxt);
asm volatile("1: fwait \n\t"
"2: \n\t"
".pushsection .fixup,\"ax\" \n\t"
"3: \n\t"
"movb $1, %[fault] \n\t"
"jmp 2b \n\t"
".popsection \n\t"
_ASM_EXTABLE(1b, 3b)
: [fault]"+qm"(fault));
ctxt->ops->put_fpu(ctxt);
if (unlikely(fault))
return emulate_exception(ctxt, MF_VECTOR, 0, false);
return X86EMUL_CONTINUE;
}
| 12,270
|
104,786
| 0
|
static void WindowOpenHelper(Browser* browser, const GURL& start_url,
const std::string& newtab_url,
TabContents** newtab_result) {
ui_test_utils::NavigateToURL(browser, start_url);
ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(
browser->GetSelectedTabContents()->render_view_host(), L"",
L"window.open('" + UTF8ToWide(newtab_url) + L"');"));
Browser* last_active_browser = BrowserList::GetLastActive();
EXPECT_TRUE(last_active_browser);
TabContents* newtab = last_active_browser->GetSelectedTabContents();
EXPECT_TRUE(newtab);
GURL expected_url = start_url.Resolve(newtab_url);
if (!newtab->controller().GetLastCommittedEntry() ||
newtab->controller().GetLastCommittedEntry()->url() != expected_url)
ui_test_utils::WaitForNavigation(&newtab->controller());
EXPECT_EQ(expected_url,
newtab->controller().GetLastCommittedEntry()->url());
if (newtab_result)
*newtab_result = newtab;
}
| 12,271
|
7,124
| 0
|
T42_GlyphSlot_Load( FT_GlyphSlot glyph,
FT_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags )
{
FT_Error error;
T42_GlyphSlot t42slot = (T42_GlyphSlot)glyph;
T42_Size t42size = (T42_Size)size;
FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;
FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index ));
t42_glyphslot_clear( t42slot->ttslot );
error = ttclazz->load_glyph( t42slot->ttslot,
t42size->ttsize,
glyph_index,
load_flags | FT_LOAD_NO_BITMAP );
if ( !error )
{
glyph->metrics = t42slot->ttslot->metrics;
glyph->linearHoriAdvance = t42slot->ttslot->linearHoriAdvance;
glyph->linearVertAdvance = t42slot->ttslot->linearVertAdvance;
glyph->format = t42slot->ttslot->format;
glyph->outline = t42slot->ttslot->outline;
glyph->bitmap = t42slot->ttslot->bitmap;
glyph->bitmap_left = t42slot->ttslot->bitmap_left;
glyph->bitmap_top = t42slot->ttslot->bitmap_top;
glyph->num_subglyphs = t42slot->ttslot->num_subglyphs;
glyph->subglyphs = t42slot->ttslot->subglyphs;
glyph->control_data = t42slot->ttslot->control_data;
glyph->control_len = t42slot->ttslot->control_len;
}
return error;
}
| 12,272
|
104,787
| 0
|
void ExtensionService::AddExtension(const Extension* extension) {
scoped_refptr<const Extension> scoped_extension(extension);
if (!extensions_enabled() &&
!extension->is_theme() &&
extension->location() != Extension::COMPONENT &&
!Extension::IsExternalLocation(extension->location()))
return;
SetBeingUpgraded(extension, false);
unloaded_extension_paths_.erase(extension->id());
UntrackTerminatedExtension(extension->id());
if (disabled_extension_paths_.erase(extension->id()) > 0)
EnableExtension(extension->id());
DisableIfPrivilegeIncrease(extension);
Extension::State state = extension_prefs_->GetExtensionState(extension->id());
if (state == Extension::DISABLED) {
disabled_extensions_.push_back(scoped_extension);
NotificationService::current()->Notify(
NotificationType::EXTENSION_UPDATE_DISABLED,
Source<Profile>(profile_),
Details<const Extension>(extension));
return;
}
CHECK(state == Extension::ENABLED);
extensions_.push_back(scoped_extension);
NotifyExtensionLoaded(extension);
}
| 12,273
|
155,509
| 0
|
void DataReductionProxySettings::RecordDataReductionInit() const {
DCHECK(thread_checker_.CalledOnValidThread());
RecordStartupState(IsDataReductionProxyEnabled() ? PROXY_ENABLED
: PROXY_DISABLED);
RecordStartupSavings();
}
| 12,274
|
3,067
| 0
|
static int devicendomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
{
int i, limit, code;
ref namesarray;
code = array_get(imemory, space, 1, &namesarray);
if (code < 0)
return code;
limit = r_size(&namesarray) * 2;
for (i = 0;i < limit;i+=2) {
ptr[i] = 0;
ptr[i+1] = 1;
}
return 0;
}
| 12,275
|
66,575
| 0
|
static int add_port(struct ports_device *portdev, u32 id)
{
char debugfs_name[16];
struct port *port;
struct port_buffer *buf;
dev_t devt;
unsigned int nr_added_bufs;
int err;
port = kmalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
err = -ENOMEM;
goto fail;
}
kref_init(&port->kref);
port->portdev = portdev;
port->id = id;
port->name = NULL;
port->inbuf = NULL;
port->cons.hvc = NULL;
port->async_queue = NULL;
port->cons.ws.ws_row = port->cons.ws.ws_col = 0;
port->host_connected = port->guest_connected = false;
port->stats = (struct port_stats) { 0 };
port->outvq_full = false;
port->in_vq = portdev->in_vqs[port->id];
port->out_vq = portdev->out_vqs[port->id];
port->cdev = cdev_alloc();
if (!port->cdev) {
dev_err(&port->portdev->vdev->dev, "Error allocating cdev\n");
err = -ENOMEM;
goto free_port;
}
port->cdev->ops = &port_fops;
devt = MKDEV(portdev->chr_major, id);
err = cdev_add(port->cdev, devt, 1);
if (err < 0) {
dev_err(&port->portdev->vdev->dev,
"Error %d adding cdev for port %u\n", err, id);
goto free_cdev;
}
port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev,
devt, port, "vport%up%u",
port->portdev->vdev->index, id);
if (IS_ERR(port->dev)) {
err = PTR_ERR(port->dev);
dev_err(&port->portdev->vdev->dev,
"Error %d creating device for port %u\n",
err, id);
goto free_cdev;
}
spin_lock_init(&port->inbuf_lock);
spin_lock_init(&port->outvq_lock);
init_waitqueue_head(&port->waitqueue);
/* Fill the in_vq with buffers so the host can send us data. */
nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock);
if (!nr_added_bufs) {
dev_err(port->dev, "Error allocating inbufs\n");
err = -ENOMEM;
goto free_device;
}
if (is_rproc_serial(port->portdev->vdev))
/*
* For rproc_serial assume remote processor is connected.
* rproc_serial does not want the console port, only
* the generic port implementation.
*/
port->host_connected = true;
else if (!use_multiport(port->portdev)) {
/*
* If we're not using multiport support,
* this has to be a console port.
*/
err = init_port_console(port);
if (err)
goto free_inbufs;
}
spin_lock_irq(&portdev->ports_lock);
list_add_tail(&port->list, &port->portdev->ports);
spin_unlock_irq(&portdev->ports_lock);
/*
* Tell the Host we're set so that it can send us various
* configuration parameters for this port (eg, port name,
* caching, whether this is a console port, etc.)
*/
send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
if (pdrvdata.debugfs_dir) {
/*
* Finally, create the debugfs file that we can use to
* inspect a port's state at any time
*/
snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u",
port->portdev->vdev->index, id);
port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
pdrvdata.debugfs_dir,
port,
&port_debugfs_ops);
}
return 0;
free_inbufs:
while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
free_buf(buf, true);
free_device:
device_destroy(pdrvdata.class, port->dev->devt);
free_cdev:
cdev_del(port->cdev);
free_port:
kfree(port);
fail:
/* The host might want to notify management sw about port add failure */
__send_control_msg(portdev, id, VIRTIO_CONSOLE_PORT_READY, 0);
return err;
}
| 12,276
|
159,342
| 0
|
ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {}
| 12,277
|
96,178
| 0
|
MagickExport MagickBooleanType SetQuantumPad(const Image *image,
QuantumInfo *quantum_info,const size_t pad)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(quantum_info != (QuantumInfo *) NULL);
assert(quantum_info->signature == MagickSignature);
quantum_info->pad=pad;
return(SetQuantumDepth(image,quantum_info,quantum_info->depth));
}
| 12,278
|
169,977
| 0
|
xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlNodePtr inst) {
xmlNodePtr child;
int ret = 0;
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) ||
(inst->children == NULL))
return(0);
child = inst->children;
while (child != NULL) {
if ((IS_XSLT_ELEM(child)) &&
(xmlStrEqual(child->name, BAD_CAST "fallback"))) {
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
"applying xsl:fallback\n");
#endif
ret++;
xsltApplySequenceConstructor(ctxt, node, child->children,
NULL);
}
child = child->next;
}
return(ret);
}
| 12,279
|
108,066
| 0
|
void GLES2DecoderImpl::DoCopyTexImage2D(
GLenum target,
GLint level,
GLenum internal_format,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLint border) {
TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
if (!info) {
SetGLError(GL_INVALID_OPERATION,
"glCopyTexImage2D: unknown texture for target");
return;
}
if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
border != 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D: dimensions out of range");
return;
}
CopyRealGLErrorsToWrapper();
glCopyTexImage2D(target, level, internal_format, x, y, width, height, border);
GLenum error = glGetError();
if (error == GL_NO_ERROR) {
texture_manager()->SetLevelInfo(
info, target, level, internal_format, width, height, 1, border,
internal_format, GL_UNSIGNED_BYTE);
}
}
| 12,280
|
164,510
| 0
|
static int cellInfoEqual(CellInfo *a, CellInfo *b){
if( a->nKey!=b->nKey ) return 0;
if( a->pPayload!=b->pPayload ) return 0;
if( a->nPayload!=b->nPayload ) return 0;
if( a->nLocal!=b->nLocal ) return 0;
if( a->nSize!=b->nSize ) return 0;
return 1;
}
| 12,281
|
89,256
| 0
|
static MagickBooleanType InvokePostscriptDelegate(
const MagickBooleanType verbose,const char *command,char *message,
ExceptionInfo *exception)
{
int
status;
#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
#define SetArgsStart(command,args_start) \
if (args_start == (const char *) NULL) \
{ \
if (*command != '"') \
args_start=strchr(command,' '); \
else \
{ \
args_start=strchr(command+1,'"'); \
if (args_start != (const char *) NULL) \
args_start++; \
} \
}
#define ExecuteGhostscriptCommand(command,status) \
{ \
status=ExternalDelegateCommand(MagickFalse,verbose,command,message, \
exception); \
if (status == 0) \
return(MagickTrue); \
if (status < 0) \
return(MagickFalse); \
(void) ThrowMagickException(exception,GetMagickModule(),DelegateError, \
"FailedToExecuteCommand","`%s' (%d)",command,status); \
return(MagickFalse); \
}
char
**argv,
*errors;
const char
*args_start = (const char *) NULL;
const GhostInfo
*ghost_info;
gs_main_instance
*interpreter;
gsapi_revision_t
revision;
int
argc,
code;
register ssize_t
i;
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
ghost_info=NTGhostscriptDLLVectors();
#else
GhostInfo
ghost_info_struct;
ghost_info=(&ghost_info_struct);
(void) memset(&ghost_info_struct,0,sizeof(ghost_info_struct));
ghost_info_struct.delete_instance=(void (*)(gs_main_instance *))
gsapi_delete_instance;
ghost_info_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
ghost_info_struct.new_instance=(int (*)(gs_main_instance **,void *))
gsapi_new_instance;
ghost_info_struct.init_with_args=(int (*)(gs_main_instance *,int,char **))
gsapi_init_with_args;
ghost_info_struct.run_string=(int (*)(gs_main_instance *,const char *,int,
int *)) gsapi_run_string;
ghost_info_struct.set_stdio=(int (*)(gs_main_instance *,int (*)(void *,char *,
int),int (*)(void *,const char *,int),int (*)(void *, const char *, int)))
gsapi_set_stdio;
ghost_info_struct.revision=(int (*)(gsapi_revision_t *,int)) gsapi_revision;
#endif
if (ghost_info == (GhostInfo *) NULL)
ExecuteGhostscriptCommand(command,status);
if ((ghost_info->revision)(&revision,sizeof(revision)) != 0)
revision.revision=0;
if (verbose != MagickFalse)
{
(void) fprintf(stdout,"[ghostscript library %.2f]",(double)
revision.revision/100.0);
SetArgsStart(command,args_start);
(void) fputs(args_start,stdout);
}
interpreter=(gs_main_instance *) NULL;
errors=(char *) NULL;
status=(ghost_info->new_instance)(&interpreter,(void *) &errors);
if (status < 0)
ExecuteGhostscriptCommand(command,status);
code=0;
argv=StringToArgv(command,&argc);
if (argv == (char **) NULL)
{
(ghost_info->delete_instance)(interpreter);
return(MagickFalse);
}
(void) (ghost_info->set_stdio)(interpreter,(int (MagickDLLCall *)(void *,
char *,int)) NULL,PostscriptDelegateMessage,PostscriptDelegateMessage);
status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1);
if (status == 0)
status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n",
0,&code);
(ghost_info->exit)(interpreter);
(ghost_info->delete_instance)(interpreter);
for (i=0; i < (ssize_t) argc; i++)
argv[i]=DestroyString(argv[i]);
argv=(char **) RelinquishMagickMemory(argv);
if (status != 0)
{
SetArgsStart(command,args_start);
if (status == -101) /* quit */
(void) FormatLocaleString(message,MaxTextExtent,
"[ghostscript library %.2f]%s: %s",(double) revision.revision/100.0,
args_start,errors);
else
{
(void) ThrowMagickException(exception,GetMagickModule(),
DelegateError,"PostscriptDelegateFailed",
"`[ghostscript library %.2f]%s': %s",(double) revision.revision/
100.0,args_start,errors);
if (errors != (char *) NULL)
errors=DestroyString(errors);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Ghostscript returns status %d, exit code %d",status,code);
return(MagickFalse);
}
}
if (errors != (char *) NULL)
errors=DestroyString(errors);
return(MagickTrue);
#else
status=ExternalDelegateCommand(MagickFalse,verbose,command,(char *) NULL,
exception);
return(status == 0 ? MagickTrue : MagickFalse);
#endif
}
| 12,282
|
124,199
| 0
|
base::FilePath ContentBrowserClient::GetHyphenDictionaryDirectory() {
return base::FilePath();
}
| 12,283
|
95,944
| 0
|
void CL_CheckTimeout( void ) {
if ( ( !CL_CheckPaused() || !sv_paused->integer )
&& clc.state >= CA_CONNECTED && clc.state != CA_CINEMATIC
&& cls.realtime - clc.lastPacketTime > cl_timeout->value*1000) {
if (++cl.timeoutcount > 5) { // timeoutcount saves debugger
Com_Printf ("\nServer connection timed out.\n");
CL_Disconnect( qtrue );
return;
}
} else {
cl.timeoutcount = 0;
}
}
| 12,284
|
61,764
| 0
|
static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
int *copied, size_t size)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_sock *inet = inet_sk(sk);
int err, flags;
if (!(sysctl_tcp_fastopen & TFO_CLIENT_ENABLE))
return -EOPNOTSUPP;
if (tp->fastopen_req)
return -EALREADY; /* Another Fast Open is in progress */
tp->fastopen_req = kzalloc(sizeof(struct tcp_fastopen_request),
sk->sk_allocation);
if (unlikely(!tp->fastopen_req))
return -ENOBUFS;
tp->fastopen_req->data = msg;
tp->fastopen_req->size = size;
if (inet->defer_connect) {
err = tcp_connect(sk);
/* Same failure procedure as in tcp_v4/6_connect */
if (err) {
tcp_set_state(sk, TCP_CLOSE);
inet->inet_dport = 0;
sk->sk_route_caps = 0;
}
}
flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0;
err = __inet_stream_connect(sk->sk_socket, msg->msg_name,
msg->msg_namelen, flags, 1);
/* fastopen_req could already be freed in __inet_stream_connect
* if the connection times out or gets rst
*/
if (tp->fastopen_req) {
*copied = tp->fastopen_req->copied;
tcp_free_fastopen_req(tp);
inet->defer_connect = 0;
}
return err;
}
| 12,285
|
166,057
| 0
|
void FileSystemManagerImpl::Create(const GURL& path,
bool exclusive,
bool is_directory,
bool recursive,
CreateCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
base::Optional<base::File::Error> opt_error = ValidateFileSystemURL(url);
if (opt_error) {
std::move(callback).Run(opt_error.value());
return;
}
if (!security_policy_->CanCreateFileSystemFile(process_id_, url)) {
std::move(callback).Run(base::File::FILE_ERROR_SECURITY);
return;
}
if (is_directory) {
operation_runner()->CreateDirectory(
url, exclusive, recursive,
base::BindRepeating(&FileSystemManagerImpl::DidFinish, GetWeakPtr(),
base::Passed(&callback)));
} else {
operation_runner()->CreateFile(
url, exclusive,
base::BindRepeating(&FileSystemManagerImpl::DidFinish, GetWeakPtr(),
base::Passed(&callback)));
}
}
| 12,286
|
42,224
| 0
|
static void vhost_init_is_le(struct vhost_virtqueue *vq)
{
if (vhost_has_feature(vq, VIRTIO_F_VERSION_1))
vq->is_le = true;
}
| 12,287
|
119,436
| 0
|
void RenderThreadImpl::SetGamepadListener(blink::WebGamepadListener* listener) {
gamepad_shared_memory_reader_->SetGamepadListener(listener);
}
| 12,288
|
98,288
| 0
|
void FrameLoaderClient::didChangeTitle(WebCore::DocumentLoader *l)
{
setTitle(l->title(), l->url());
}
| 12,289
|
5,863
| 0
|
static void ahci_init_d2h(AHCIDevice *ad)
{
IDEState *ide_state = &ad->port.ifs[0];
AHCIPortRegs *pr = &ad->port_regs;
if (ad->init_d2h_sent) {
return;
}
if (ahci_write_fis_d2h(ad)) {
ad->init_d2h_sent = true;
/* We're emulating receiving the first Reg H2D Fis from the device;
* Update the SIG register, but otherwise proceed as normal. */
pr->sig = ((uint32_t)ide_state->hcyl << 24) |
(ide_state->lcyl << 16) |
(ide_state->sector << 8) |
(ide_state->nsector & 0xFF);
}
}
| 12,290
|
134,851
| 0
|
virtual GURL TestUrl() {
return GURL(kAboutBlankURL);
}
| 12,291
|
135,005
| 0
|
void AppCacheUpdateJob::HandleManifestRefetchCompleted(
URLFetcher* fetcher) {
DCHECK(internal_state_ == REFETCH_MANIFEST);
DCHECK(manifest_fetcher_ == fetcher);
manifest_fetcher_ = NULL;
net::URLRequest* request = fetcher->request();
int response_code = request->status().is_success()
? request->GetResponseCode() : -1;
if (response_code == 304 || manifest_data_ == fetcher->manifest_data()) {
AppCacheEntry* entry = inprogress_cache_->GetEntry(manifest_url_);
if (entry) {
entry->add_types(AppCacheEntry::MANIFEST);
StoreGroupAndCache();
} else {
manifest_response_writer_.reset(CreateResponseWriter());
scoped_refptr<HttpResponseInfoIOBuffer> io_buffer(
new HttpResponseInfoIOBuffer(manifest_response_info_.release()));
manifest_response_writer_->WriteInfo(
io_buffer.get(),
base::Bind(&AppCacheUpdateJob::OnManifestInfoWriteComplete,
base::Unretained(this)));
}
} else {
VLOG(1) << "Request status: " << request->status().status()
<< " error: " << request->status().error()
<< " response code: " << response_code;
ScheduleUpdateRetry(kRerunDelayMs);
if (response_code == 200) {
HandleCacheFailure(AppCacheErrorDetails("Manifest changed during update",
APPCACHE_CHANGED_ERROR,
GURL(),
0,
false /*is_cross_origin*/),
MANIFEST_ERROR,
GURL());
} else {
const char* kFormatString = "Manifest re-fetch failed (%d) %s";
std::string message = FormatUrlErrorMessage(
kFormatString, manifest_url_, fetcher->result(), response_code);
HandleCacheFailure(AppCacheErrorDetails(message,
APPCACHE_MANIFEST_ERROR,
GURL(),
response_code,
false /*is_cross_origin*/),
fetcher->result(),
GURL());
}
}
}
| 12,292
|
139,569
| 0
|
static String ValueFontName(const EditorInternalCommand&,
LocalFrame& frame,
Event*) {
return ValueStyle(frame, CSSPropertyFontFamily);
}
| 12,293
|
21,116
| 0
|
bool mem_cgroup_reclaimable(struct mem_cgroup *memcg, bool noswap)
{
return test_mem_cgroup_node_reclaimable(memcg, 0, noswap);
}
| 12,294
|
160,809
| 0
|
void RenderViewImpl::OnSelectWordAroundCaret() {
bool did_select = false;
int start_adjust = 0;
int end_adjust = 0;
if (webview()) {
WebLocalFrame* focused_frame = GetWebView()->FocusedFrame();
if (focused_frame) {
input_handler_->set_handling_input_event(true);
blink::WebRange initial_range = focused_frame->SelectionRange();
if (!initial_range.IsNull())
did_select = focused_frame->SelectWordAroundCaret();
if (did_select) {
blink::WebRange adjusted_range = focused_frame->SelectionRange();
start_adjust =
adjusted_range.StartOffset() - initial_range.StartOffset();
end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset();
}
input_handler_->set_handling_input_event(false);
}
}
Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select,
start_adjust, end_adjust));
}
| 12,295
|
95,291
| 0
|
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_FUNCTION_TRACE (NsGetType);
if (!Node)
{
ACPI_WARNING ((AE_INFO, "Null Node parameter"));
return_UINT8 (ACPI_TYPE_ANY);
}
return_UINT8 (Node->Type);
}
| 12,296
|
54,151
| 0
|
void nf_nat_masquerade_ipv4_register_notifier(void)
{
/* check if the notifier was already set */
if (atomic_inc_return(&masquerade_notifier_refcount) > 1)
return;
/* Register for device down reports */
register_netdevice_notifier(&masq_dev_notifier);
/* Register IP address change reports */
register_inetaddr_notifier(&masq_inet_notifier);
}
| 12,297
|
36,141
| 0
|
kadm5_create_principal_3(void *server_handle,
kadm5_principal_ent_t entry, long mask,
int n_ks_tuple, krb5_key_salt_tuple *ks_tuple,
char *password)
{
krb5_db_entry *kdb;
osa_princ_ent_rec adb;
kadm5_policy_ent_rec polent;
krb5_boolean have_polent = FALSE;
krb5_int32 now;
krb5_tl_data *tl_data_tail;
unsigned int ret;
kadm5_server_handle_t handle = server_handle;
krb5_keyblock *act_mkey;
krb5_kvno act_kvno;
int new_n_ks_tuple = 0;
krb5_key_salt_tuple *new_ks_tuple = NULL;
CHECK_HANDLE(server_handle);
krb5_clear_error_message(handle->context);
check_1_6_dummy(entry, mask, n_ks_tuple, ks_tuple, &password);
/*
* Argument sanity checking, and opening up the DB
*/
if(!(mask & KADM5_PRINCIPAL) || (mask & KADM5_MOD_NAME) ||
(mask & KADM5_MOD_TIME) || (mask & KADM5_LAST_PWD_CHANGE) ||
(mask & KADM5_MKVNO) || (mask & KADM5_AUX_ATTRIBUTES) ||
(mask & KADM5_LAST_SUCCESS) || (mask & KADM5_LAST_FAILED) ||
(mask & KADM5_FAIL_AUTH_COUNT))
return KADM5_BAD_MASK;
if ((mask & KADM5_KEY_DATA) && entry->n_key_data != 0)
return KADM5_BAD_MASK;
if((mask & KADM5_POLICY) && (mask & KADM5_POLICY_CLR))
return KADM5_BAD_MASK;
if((mask & ~ALL_PRINC_MASK))
return KADM5_BAD_MASK;
if (entry == NULL)
return EINVAL;
/*
* Check to see if the principal exists
*/
ret = kdb_get_entry(handle, entry->principal, &kdb, &adb);
switch(ret) {
case KADM5_UNK_PRINC:
break;
case 0:
kdb_free_entry(handle, kdb, &adb);
return KADM5_DUP;
default:
return ret;
}
kdb = krb5_db_alloc(handle->context, NULL, sizeof(*kdb));
if (kdb == NULL)
return ENOMEM;
memset(kdb, 0, sizeof(*kdb));
memset(&adb, 0, sizeof(osa_princ_ent_rec));
/*
* If a policy was specified, load it.
* If we can not find the one specified return an error
*/
if ((mask & KADM5_POLICY)) {
ret = get_policy(handle, entry->policy, &polent, &have_polent);
if (ret)
goto cleanup;
}
if (password) {
ret = passwd_check(handle, password, have_polent ? &polent : NULL,
entry->principal);
if (ret)
goto cleanup;
}
/*
* Start populating the various DB fields, using the
* "defaults" for fields that were not specified by the
* mask.
*/
if ((ret = krb5_timeofday(handle->context, &now)))
goto cleanup;
kdb->magic = KRB5_KDB_MAGIC_NUMBER;
kdb->len = KRB5_KDB_V1_BASE_LENGTH; /* gag me with a chainsaw */
if ((mask & KADM5_ATTRIBUTES))
kdb->attributes = entry->attributes;
else
kdb->attributes = handle->params.flags;
if ((mask & KADM5_MAX_LIFE))
kdb->max_life = entry->max_life;
else
kdb->max_life = handle->params.max_life;
if (mask & KADM5_MAX_RLIFE)
kdb->max_renewable_life = entry->max_renewable_life;
else
kdb->max_renewable_life = handle->params.max_rlife;
if ((mask & KADM5_PRINC_EXPIRE_TIME))
kdb->expiration = entry->princ_expire_time;
else
kdb->expiration = handle->params.expiration;
kdb->pw_expiration = 0;
if (have_polent) {
if(polent.pw_max_life)
kdb->pw_expiration = now + polent.pw_max_life;
else
kdb->pw_expiration = 0;
}
if ((mask & KADM5_PW_EXPIRATION))
kdb->pw_expiration = entry->pw_expiration;
kdb->last_success = 0;
kdb->last_failed = 0;
kdb->fail_auth_count = 0;
/* this is kind of gross, but in order to free the tl data, I need
to free the entire kdb entry, and that will try to free the
principal. */
if ((ret = kadm5_copy_principal(handle->context,
entry->principal, &(kdb->princ))))
goto cleanup;
if ((ret = krb5_dbe_update_last_pwd_change(handle->context, kdb, now)))
goto cleanup;
if (mask & KADM5_TL_DATA) {
/* splice entry->tl_data onto the front of kdb->tl_data */
for (tl_data_tail = entry->tl_data; tl_data_tail;
tl_data_tail = tl_data_tail->tl_data_next)
{
ret = krb5_dbe_update_tl_data(handle->context, kdb, tl_data_tail);
if( ret )
goto cleanup;
}
}
/*
* We need to have setup the TL data, so we have strings, so we can
* check enctype policy, which is why we check/initialize ks_tuple
* this late.
*/
ret = apply_keysalt_policy(handle, entry->policy, n_ks_tuple, ks_tuple,
&new_n_ks_tuple, &new_ks_tuple);
if (ret)
goto cleanup;
/* initialize the keys */
ret = kdb_get_active_mkey(handle, &act_kvno, &act_mkey);
if (ret)
goto cleanup;
if (mask & KADM5_KEY_DATA) {
/* The client requested no keys for this principal. */
assert(entry->n_key_data == 0);
} else if (password) {
ret = krb5_dbe_cpw(handle->context, act_mkey, new_ks_tuple,
new_n_ks_tuple, password,
(mask & KADM5_KVNO)?entry->kvno:1,
FALSE, kdb);
} else {
/* Null password means create with random key (new in 1.8). */
ret = krb5_dbe_crk(handle->context, &master_keyblock,
new_ks_tuple, new_n_ks_tuple, FALSE, kdb);
}
if (ret)
goto cleanup;
/* Record the master key VNO used to encrypt this entry's keys */
ret = krb5_dbe_update_mkvno(handle->context, kdb, act_kvno);
if (ret)
goto cleanup;
ret = k5_kadm5_hook_create(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_PRECOMMIT, entry, mask,
new_n_ks_tuple, new_ks_tuple, password);
if (ret)
goto cleanup;
/* populate the admin-server-specific fields. In the OV server,
this used to be in a separate database. Since there's already
marshalling code for the admin fields, to keep things simple,
I'm going to keep it, and make all the admin stuff occupy a
single tl_data record, */
adb.admin_history_kvno = INITIAL_HIST_KVNO;
if (mask & KADM5_POLICY) {
adb.aux_attributes = KADM5_POLICY;
/* this does *not* need to be strdup'ed, because adb is xdr */
/* encoded in osa_adb_create_princ, and not ever freed */
adb.policy = entry->policy;
}
/* In all cases key and the principal data is set, let the database provider know */
kdb->mask = mask | KADM5_KEY_DATA | KADM5_PRINCIPAL ;
/* store the new db entry */
ret = kdb_put_entry(handle, kdb, &adb);
(void) k5_kadm5_hook_create(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_POSTCOMMIT, entry, mask,
new_n_ks_tuple, new_ks_tuple, password);
cleanup:
free(new_ks_tuple);
krb5_db_free_principal(handle->context, kdb);
if (have_polent)
(void) kadm5_free_policy_ent(handle->lhandle, &polent);
return ret;
}
| 12,298
|
10,198
| 0
|
Move_CVT_Stretched( EXEC_OP_ FT_ULong idx,
FT_F26Dot6 value )
{
CUR.cvt[idx] += FT_DivFix( value, CURRENT_Ratio() );
}
| 12,299
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.