unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
146,674 | 0 | void PageInfoBubbleView::OnWidgetDestroying(views::Widget* widget) {
g_shown_bubble_type = BUBBLE_NONE;
g_page_info_bubble = nullptr;
presenter_->OnUIClosing();
}
| 17,600 |
51,737 | 0 | dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len, guint32 *n_mac_flags, guint32 *ampdu_id, struct ieee_802_11_phdr *phdr)
{
proto_tree *ftree;
proto_item *ti;
ptvcursor_t *csr;
guint8 mcs;
guint8 ness;
guint16 ext_frequency;
gchar *chan_str;
ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_dot11n_mac_phy, NULL, "802.11n MAC+PHY");
add_ppi_field_header(tvb, ftree, &offset);
data_len -= 4; /* Subtract field header length */
if (data_len != PPI_80211N_MAC_PHY_LEN) {
proto_tree_add_expert_format(ftree, pinfo, &ei_ppi_invalid_length, tvb, offset, data_len, "Invalid length: %u", data_len);
THROW(ReportedBoundsError);
}
dissect_80211n_mac(tvb, pinfo, ftree, offset, PPI_80211N_MAC_LEN,
FALSE, n_mac_flags, ampdu_id, phdr);
offset += PPI_80211N_MAC_PHY_OFF;
csr = ptvcursor_new(ftree, tvb, offset);
mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
if (mcs != 255) {
phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
phdr->phy_info.info_11n.mcs_index = mcs;
}
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_mcs, 1, 255);
ness = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS;
phdr->phy_info.info_11n.ness = ness;
ti = ptvcursor_add(csr, hf_80211n_mac_phy_num_streams, 1, ENC_LITTLE_ENDIAN);
if (tvb_get_guint8(tvb, ptvcursor_current_offset(csr) - 1) == 0)
proto_item_append_text(ti, " (unknown)");
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_combined, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant0_ctl, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant1_ctl, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant2_ctl, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant3_ctl, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant0_ext, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant1_ext, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant2_ext, 1, 255);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant3_ext, 1, 255);
ext_frequency = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
chan_str = ieee80211_mhz_to_str(ext_frequency);
proto_tree_add_uint_format(ptvcursor_tree(csr), hf_80211n_mac_phy_ext_chan_freq, ptvcursor_tvbuff(csr),
ptvcursor_current_offset(csr), 2, ext_frequency, "Ext. Channel frequency: %s", chan_str);
g_free(chan_str);
ptvcursor_advance(csr, 2);
ptvcursor_add_with_subtree(csr, hf_80211n_mac_phy_ext_chan_flags, 2, ENC_LITTLE_ENDIAN,
ett_dot11n_mac_phy_ext_channel_flags);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_turbo, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_cck, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_ofdm, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_2ghz, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_5ghz, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_passive, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_dynamic, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add(csr, hf_80211n_mac_phy_ext_chan_flags_gfsk, 2, ENC_LITTLE_ENDIAN);
ptvcursor_pop_subtree(csr);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant0signal, 1, 0x80); /* -128 */
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant0noise, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant1signal, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant1noise, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant2signal, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant2noise, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant3signal, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant3noise, 1, 0x80);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm0, 4, 0);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm1, 4, 0);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm2, 4, 0);
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm3, 4, 0);
ptvcursor_free(csr);
}
| 17,601 |
73,537 | 0 | MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
const void *datum,const size_t length,
const MagickBooleanType magick_unused(clone))
{
#define ProfileImageTag "Profile/Image"
#define ThrowProfileException(severity,tag,context) \
{ \
if (source_profile != (cmsHPROFILE) NULL) \
(void) cmsCloseProfile(source_profile); \
if (target_profile != (cmsHPROFILE) NULL) \
(void) cmsCloseProfile(target_profile); \
ThrowBinaryException(severity,tag,context); \
}
MagickBooleanType
status;
StringInfo
*profile;
magick_unreferenced(clone);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(name != (const char *) NULL);
if ((datum == (const void *) NULL) || (length == 0))
{
char
*next;
/*
Delete image profile(s).
*/
ResetImageProfileIterator(image);
for (next=GetNextImageProfile(image); next != (const char *) NULL; )
{
if (IsOptionMember(next,name) != MagickFalse)
{
(void) DeleteImageProfile(image,next);
ResetImageProfileIterator(image);
}
next=GetNextImageProfile(image);
}
return(MagickTrue);
}
/*
Add a ICC, IPTC, or generic profile to the image.
*/
status=MagickTrue;
profile=AcquireStringInfo((size_t) length);
SetStringInfoDatum(profile,(unsigned char *) datum);
if ((LocaleCompare(name,"icc") != 0) && (LocaleCompare(name,"icm") != 0))
status=SetImageProfile(image,name,profile);
else
{
const StringInfo
*icc_profile;
icc_profile=GetImageProfile(image,"icc");
if ((icc_profile != (const StringInfo *) NULL) &&
(CompareStringInfo(icc_profile,profile) == 0))
{
const char
*value;
value=GetImageProperty(image,"exif:ColorSpace");
(void) value;
if (LocaleCompare(value,"1") != 0)
(void) SetsRGBImageProfile(image);
value=GetImageProperty(image,"exif:InteroperabilityIndex");
if (LocaleCompare(value,"R98.") != 0)
(void) SetsRGBImageProfile(image);
/* Future.
value=GetImageProperty(image,"exif:InteroperabilityIndex");
if (LocaleCompare(value,"R03.") != 0)
(void) SetAdobeRGB1998ImageProfile(image);
*/
icc_profile=GetImageProfile(image,"icc");
}
if ((icc_profile != (const StringInfo *) NULL) &&
(CompareStringInfo(icc_profile,profile) == 0))
{
profile=DestroyStringInfo(profile);
return(MagickTrue);
}
#if !defined(MAGICKCORE_LCMS_DELEGATE)
(void) ThrowMagickException(&image->exception,GetMagickModule(),
MissingDelegateWarning,"DelegateLibrarySupportNotBuiltIn","`%s' (LCMS)",
image->filename);
#else
{
cmsHPROFILE
source_profile;
/*
Transform pixel colors as defined by the color profiles.
*/
cmsSetLogErrorHandler(LCMSExceptionHandler);
source_profile=cmsOpenProfileFromMemTHR((cmsContext) image,
GetStringInfoDatum(profile),(cmsUInt32Number)
GetStringInfoLength(profile));
if (source_profile == (cmsHPROFILE) NULL)
ThrowBinaryException(ResourceLimitError,
"ColorspaceColorProfileMismatch",name);
if ((cmsGetDeviceClass(source_profile) != cmsSigLinkClass) &&
(icc_profile == (StringInfo *) NULL))
status=SetImageProfile(image,name,profile);
else
{
CacheView
*image_view;
ColorspaceType
source_colorspace,
target_colorspace;
cmsColorSpaceSignature
signature;
cmsHPROFILE
target_profile;
cmsHTRANSFORM
*magick_restrict transform;
cmsUInt32Number
flags,
source_type,
target_type;
ExceptionInfo
*exception;
int
intent;
MagickBooleanType
status;
MagickOffsetType
progress;
size_t
source_channels,
target_channels;
ssize_t
y;
unsigned short
**magick_restrict source_pixels,
**magick_restrict target_pixels;
exception=(&image->exception);
target_profile=(cmsHPROFILE) NULL;
if (icc_profile != (StringInfo *) NULL)
{
target_profile=source_profile;
source_profile=cmsOpenProfileFromMemTHR((cmsContext) image,
GetStringInfoDatum(icc_profile),(cmsUInt32Number)
GetStringInfoLength(icc_profile));
if (source_profile == (cmsHPROFILE) NULL)
ThrowProfileException(ResourceLimitError,
"ColorspaceColorProfileMismatch",name);
}
switch (cmsGetColorSpace(source_profile))
{
case cmsSigCmykData:
{
source_colorspace=CMYKColorspace;
source_type=(cmsUInt32Number) TYPE_CMYK_16;
source_channels=4;
break;
}
case cmsSigGrayData:
{
source_colorspace=GRAYColorspace;
source_type=(cmsUInt32Number) TYPE_GRAY_16;
source_channels=1;
break;
}
case cmsSigLabData:
{
source_colorspace=LabColorspace;
source_type=(cmsUInt32Number) TYPE_Lab_16;
source_channels=3;
break;
}
case cmsSigLuvData:
{
source_colorspace=YUVColorspace;
source_type=(cmsUInt32Number) TYPE_YUV_16;
source_channels=3;
break;
}
case cmsSigRgbData:
{
source_colorspace=sRGBColorspace;
source_type=(cmsUInt32Number) TYPE_RGB_16;
source_channels=3;
break;
}
case cmsSigXYZData:
{
source_colorspace=XYZColorspace;
source_type=(cmsUInt32Number) TYPE_XYZ_16;
source_channels=3;
break;
}
case cmsSigYCbCrData:
{
source_colorspace=YCbCrColorspace;
source_type=(cmsUInt32Number) TYPE_YCbCr_16;
source_channels=3;
break;
}
default:
{
source_colorspace=UndefinedColorspace;
source_type=(cmsUInt32Number) TYPE_RGB_16;
source_channels=3;
break;
}
}
signature=cmsGetPCS(source_profile);
if (target_profile != (cmsHPROFILE) NULL)
signature=cmsGetColorSpace(target_profile);
switch (signature)
{
case cmsSigCmykData:
{
target_colorspace=CMYKColorspace;
target_type=(cmsUInt32Number) TYPE_CMYK_16;
target_channels=4;
break;
}
case cmsSigLabData:
{
target_colorspace=LabColorspace;
target_type=(cmsUInt32Number) TYPE_Lab_16;
target_channels=3;
break;
}
case cmsSigGrayData:
{
target_colorspace=GRAYColorspace;
target_type=(cmsUInt32Number) TYPE_GRAY_16;
target_channels=1;
break;
}
case cmsSigLuvData:
{
target_colorspace=YUVColorspace;
target_type=(cmsUInt32Number) TYPE_YUV_16;
target_channels=3;
break;
}
case cmsSigRgbData:
{
target_colorspace=sRGBColorspace;
target_type=(cmsUInt32Number) TYPE_RGB_16;
target_channels=3;
break;
}
case cmsSigXYZData:
{
target_colorspace=XYZColorspace;
target_type=(cmsUInt32Number) TYPE_XYZ_16;
target_channels=3;
break;
}
case cmsSigYCbCrData:
{
target_colorspace=YCbCrColorspace;
target_type=(cmsUInt32Number) TYPE_YCbCr_16;
target_channels=3;
break;
}
default:
{
target_colorspace=UndefinedColorspace;
target_type=(cmsUInt32Number) TYPE_RGB_16;
target_channels=3;
break;
}
}
if ((source_colorspace == UndefinedColorspace) ||
(target_colorspace == UndefinedColorspace))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
if ((source_colorspace == GRAYColorspace) &&
(SetImageGray(image,exception) == MagickFalse))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
if ((source_colorspace == CMYKColorspace) &&
(image->colorspace != CMYKColorspace))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
if ((source_colorspace == XYZColorspace) &&
(image->colorspace != XYZColorspace))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
if ((source_colorspace == YCbCrColorspace) &&
(image->colorspace != YCbCrColorspace))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
if ((source_colorspace != CMYKColorspace) &&
(source_colorspace != GRAYColorspace) &&
(source_colorspace != LabColorspace) &&
(source_colorspace != XYZColorspace) &&
(source_colorspace != YCbCrColorspace) &&
(IssRGBCompatibleColorspace(image->colorspace) == MagickFalse))
ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
name);
switch (image->rendering_intent)
{
case AbsoluteIntent: intent=INTENT_ABSOLUTE_COLORIMETRIC; break;
case PerceptualIntent: intent=INTENT_PERCEPTUAL; break;
case RelativeIntent: intent=INTENT_RELATIVE_COLORIMETRIC; break;
case SaturationIntent: intent=INTENT_SATURATION; break;
default: intent=INTENT_PERCEPTUAL; break;
}
flags=cmsFLAGS_HIGHRESPRECALC;
#if defined(cmsFLAGS_BLACKPOINTCOMPENSATION)
if (image->black_point_compensation != MagickFalse)
flags|=cmsFLAGS_BLACKPOINTCOMPENSATION;
#endif
transform=AcquireTransformThreadSet(image,source_profile,
source_type,target_profile,target_type,intent,flags);
if (transform == (cmsHTRANSFORM *) NULL)
ThrowProfileException(ImageError,"UnableToCreateColorTransform",
name);
/*
Transform image as dictated by the source & target image profiles.
*/
source_pixels=AcquirePixelThreadSet(image->columns,source_channels);
target_pixels=AcquirePixelThreadSet(image->columns,target_channels);
if ((source_pixels == (unsigned short **) NULL) ||
(target_pixels == (unsigned short **) NULL))
{
transform=DestroyTransformThreadSet(transform);
ThrowProfileException(ResourceLimitError,
"MemoryAllocationFailed",image->filename);
}
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
{
target_pixels=DestroyPixelThreadSet(target_pixels);
source_pixels=DestroyPixelThreadSet(source_pixels);
transform=DestroyTransformThreadSet(transform);
if (source_profile != (cmsHPROFILE) NULL)
(void) cmsCloseProfile(source_profile);
if (target_profile != (cmsHPROFILE) NULL)
(void) cmsCloseProfile(target_profile);
return(MagickFalse);
}
if (target_colorspace == CMYKColorspace)
(void) SetImageColorspace(image,target_colorspace);
status=MagickTrue;
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
const int
id = GetOpenMPThreadId();
MagickBooleanType
sync;
register IndexPacket
*magick_restrict indexes;
register ssize_t
x;
register PixelPacket
*magick_restrict q;
register unsigned short
*p;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
p=source_pixels[id];
for (x=0; x < (ssize_t) image->columns; x++)
{
*p++=ScaleQuantumToShort(GetPixelRed(q));
if (source_channels > 1)
{
*p++=ScaleQuantumToShort(GetPixelGreen(q));
*p++=ScaleQuantumToShort(GetPixelBlue(q));
}
if (source_channels > 3)
*p++=ScaleQuantumToShort(GetPixelIndex(indexes+x));
q++;
}
cmsDoTransform(transform[id],source_pixels[id],target_pixels[id],
(unsigned int) image->columns);
p=target_pixels[id];
q-=image->columns;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ScaleShortToQuantum(*p));
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
p++;
if (target_channels > 1)
{
SetPixelGreen(q,ScaleShortToQuantum(*p));
p++;
SetPixelBlue(q,ScaleShortToQuantum(*p));
p++;
}
if (target_channels > 3)
{
SetPixelIndex(indexes+x,ScaleShortToQuantum(*p));
p++;
}
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
if (sync == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_ProfileImage)
#endif
proceed=SetImageProgress(image,ProfileImageTag,progress++,
image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
(void) SetImageColorspace(image,target_colorspace);
switch (signature)
{
case cmsSigRgbData:
{
image->type=image->matte == MagickFalse ? TrueColorType :
TrueColorMatteType;
break;
}
case cmsSigCmykData:
{
image->type=image->matte == MagickFalse ? ColorSeparationType :
ColorSeparationMatteType;
break;
}
case cmsSigGrayData:
{
image->type=image->matte == MagickFalse ? GrayscaleType :
GrayscaleMatteType;
break;
}
default:
break;
}
target_pixels=DestroyPixelThreadSet(target_pixels);
source_pixels=DestroyPixelThreadSet(source_pixels);
transform=DestroyTransformThreadSet(transform);
if (cmsGetDeviceClass(source_profile) != cmsSigLinkClass)
status=SetImageProfile(image,name,profile);
if (target_profile != (cmsHPROFILE) NULL)
(void) cmsCloseProfile(target_profile);
}
(void) cmsCloseProfile(source_profile);
}
#endif
}
profile=DestroyStringInfo(profile);
return(status);
}
| 17,602 |
168,918 | 0 | std::string DevToolsAgentHostImpl::GetDescription() {
return std::string();
}
| 17,603 |
80,941 | 0 | static inline void evmcs_write32(unsigned long field, u32 value) {}
| 17,604 |
120,629 | 0 | void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec)
{
QualifiedName parsedName = anyName;
if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, ec))
return;
setAttribute(parsedName, value);
}
| 17,605 |
72,596 | 0 | ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
ret = local_read(&cpu_buffer->dropped_events);
return ret;
}
| 17,606 |
121,891 | 0 | ChromeNetworkDataSavingMetricsTest() {}
| 17,607 |
124,819 | 0 | void RenderBox::clearOverrideLogicalContentHeight()
{
if (m_rareData)
m_rareData->m_overrideLogicalContentHeight = -1;
}
| 17,608 |
148,759 | 0 | void InterstitialPageImpl::CreateNewFullscreenWidget(int32_t render_process_id,
int32_t route_id) {
NOTREACHED()
<< "InterstitialPage does not support showing full screen popups.";
}
| 17,609 |
78,153 | 0 | static int asepcos_build_pin_apdu(sc_card_t *card, sc_apdu_t *apdu,
struct sc_pin_cmd_data *data, u8 *buf, size_t buf_len,
unsigned int cmd, int is_puk)
{
int r, fileid;
u8 *p = buf;
sc_cardctl_asepcos_akn2fileid_t st;
switch (cmd) {
case SC_PIN_CMD_VERIFY:
st.akn = data->pin_reference;
r = asepcos_akn_to_fileid(card, &st);
if (r != SC_SUCCESS)
return r;
fileid = st.fileid;
/* the fileid of the puk is the fileid of the pin + 1 */
if (is_puk != 0)
fileid++;
sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x20, 0x02, 0x80);
*p++ = (fileid >> 24) & 0xff;
*p++ = (fileid >> 16) & 0xff;
*p++ = (fileid >> 8 ) & 0xff;
*p++ = fileid & 0xff;
memcpy(p, data->pin1.data, data->pin1.len);
p += data->pin1.len;
apdu->lc = p - buf;
apdu->datalen = p - buf;
apdu->data = buf;
break;
case SC_PIN_CMD_CHANGE:
/* build the CHANGE KEY apdu. Note: the PIN file is implicitly
* selected by its SFID */
*p++ = 0x81;
*p++ = data->pin2.len & 0xff;
memcpy(p, data->pin2.data, data->pin2.len);
p += data->pin2.len;
st.akn = data->pin_reference;
r = asepcos_akn_to_fileid(card, &st);
if (r != SC_SUCCESS)
return r;
fileid = 0x80 | (st.fileid & 0x1f);
sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x24, 0x01, fileid);
apdu->lc = p - buf;
apdu->datalen = p - buf;
apdu->data = buf;
break;
case SC_PIN_CMD_UNBLOCK:
/* build the UNBLOCK KEY apdu. The PIN file is implicitly
* selected by its SFID. The new PIN is provided in the
* data field of the UNBLOCK KEY command. */
*p++ = 0x81;
*p++ = data->pin2.len & 0xff;
memcpy(p, data->pin2.data, data->pin2.len);
p += data->pin2.len;
st.akn = data->pin_reference;
r = asepcos_akn_to_fileid(card, &st);
if (r != SC_SUCCESS)
return r;
fileid = 0x80 | (st.fileid & 0x1f);
sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x2C, 0x02, fileid);
apdu->lc = p - buf;
apdu->datalen = p - buf;
apdu->data = buf;
break;
default:
return SC_ERROR_NOT_SUPPORTED;
}
return SC_SUCCESS;
}
| 17,610 |
149,003 | 0 | static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
BtShared *const pBt = pPage->pBt; /* B-Tree Database */
MemPage *pNew; /* Newly allocated page */
int rc; /* Return Code */
Pgno pgnoNew; /* Page number of pNew */
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
assert( pPage->nOverflow==1 );
/* This error condition is now caught prior to reaching this function */
if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;
/* Allocate a new page. This page will become the right-sibling of
** pPage. Make the parent page writable, so that the new divider cell
** may be inserted. If both these operations are successful, proceed.
*/
rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
if( rc==SQLITE_OK ){
u8 *pOut = &pSpace[4];
u8 *pCell = pPage->apOvfl[0];
u16 szCell = pPage->xCellSize(pPage, pCell);
u8 *pStop;
assert( sqlite3PagerIswriteable(pNew->pDbPage) );
assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
rc = rebuildPage(pNew, 1, &pCell, &szCell);
if( NEVER(rc) ) return rc;
pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
/* If this is an auto-vacuum database, update the pointer map
** with entries for the new page, and any pointer from the
** cell on the page to an overflow page. If either of these
** operations fails, the return code is set, but the contents
** of the parent page are still manipulated by thh code below.
** That is Ok, at this point the parent page is guaranteed to
** be marked as dirty. Returning an error code will cause a
** rollback, undoing any changes made to the parent page.
*/
if( ISAUTOVACUUM ){
ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);
if( szCell>pNew->minLocal ){
ptrmapPutOvflPtr(pNew, pCell, &rc);
}
}
/* Create a divider cell to insert into pParent. The divider cell
** consists of a 4-byte page number (the page number of pPage) and
** a variable length key value (which must be the same value as the
** largest key on pPage).
**
** To find the largest key value on pPage, first find the right-most
** cell on pPage. The first two fields of this cell are the
** record-length (a variable length integer at most 32-bits in size)
** and the key value (a variable length integer, may have any value).
** The first of the while(...) loops below skips over the record-length
** field. The second while(...) loop copies the key value from the
** cell on pPage into the pSpace buffer.
*/
pCell = findCell(pPage, pPage->nCell-1);
pStop = &pCell[9];
while( (*(pCell++)&0x80) && pCell<pStop );
pStop = &pCell[9];
while( ((*(pOut++) = *(pCell++))&0x80) && pCell<pStop );
/* Insert the new divider cell into pParent. */
if( rc==SQLITE_OK ){
insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace),
0, pPage->pgno, &rc);
}
/* Set the right-child pointer of pParent to point to the new page. */
put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew);
/* Release the reference to the new page. */
releasePage(pNew);
}
return rc;
}
| 17,611 |
41,186 | 0 | static void tcp_ratehalving_spur_to_response(struct sock *sk)
{
tcp_enter_cwr(sk, 0);
}
| 17,612 |
71,372 | 0 | static int network_packetsize(size_t received, void *payload)
{
struct network_packetsize_payload *npp = (struct network_packetsize_payload*)payload;
/* Accumulate bytes */
npp->stats->received_bytes += received;
/* Fire notification if the threshold is reached */
if ((npp->stats->received_bytes - npp->last_fired_bytes) > NETWORK_XFER_THRESHOLD) {
npp->last_fired_bytes = npp->stats->received_bytes;
if (npp->callback(npp->stats, npp->payload))
return GIT_EUSER;
}
return 0;
}
| 17,613 |
99,261 | 0 | ContextMenuMessageDispatcher(
int render_process_id,
const ViewHostMsg_ContextMenu& context_menu_message)
: render_process_id_(render_process_id),
context_menu_message_(context_menu_message) {
}
| 17,614 |
150,385 | 0 | explicit ScopedSetBoundsLocally(ClientControlledShellSurface* shell_surface)
: state_(shell_surface->client_controlled_state_) {
state_->set_bounds_locally(true);
}
| 17,615 |
58,714 | 0 | static void io_destroy(struct kioctx *ioctx)
{
struct mm_struct *mm = current->mm;
int was_dead;
/* delete the entry from the list is someone else hasn't already */
spin_lock(&mm->ioctx_lock);
was_dead = ioctx->dead;
ioctx->dead = 1;
hlist_del_rcu(&ioctx->list);
spin_unlock(&mm->ioctx_lock);
dprintk("aio_release(%p)\n", ioctx);
if (likely(!was_dead))
put_ioctx(ioctx); /* twice for the list */
kill_ctx(ioctx);
/*
* Wake up any waiters. The setting of ctx->dead must be seen
* by other CPUs at this point. Right now, we rely on the
* locking done by the above calls to ensure this consistency.
*/
wake_up_all(&ioctx->wait);
}
| 17,616 |
155,072 | 0 | static jboolean JNI_SendTabToSelfAndroidBridge_IsFeatureAvailable(
JNIEnv* env,
const JavaParamRef<jobject>& j_web_contents) {
content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(j_web_contents);
return ShouldOfferFeature(web_contents);
}
| 17,617 |
181,950 | 1 | Init_ossl_cipher(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL");
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
#endif
/* Document-class: OpenSSL::Cipher
*
* Provides symmetric algorithms for encryption and decryption. The
* algorithms that are available depend on the particular version
* of OpenSSL that is installed.
*
* === Listing all supported algorithms
*
* A list of supported algorithms can be obtained by
*
* puts OpenSSL::Cipher.ciphers
*
* === Instantiating a Cipher
*
* There are several ways to create a Cipher instance. Generally, a
* Cipher algorithm is categorized by its name, the key length in bits
* and the cipher mode to be used. The most generic way to create a
* Cipher is the following
*
* cipher = OpenSSL::Cipher.new('<name>-<key length>-<mode>')
*
* That is, a string consisting of the hyphenated concatenation of the
* individual components name, key length and mode. Either all uppercase
* or all lowercase strings may be used, for example:
*
* cipher = OpenSSL::Cipher.new('AES-128-CBC')
*
* For each algorithm supported, there is a class defined under the
* Cipher class that goes by the name of the cipher, e.g. to obtain an
* instance of AES, you could also use
*
* # these are equivalent
* cipher = OpenSSL::Cipher::AES.new(128, :CBC)
* cipher = OpenSSL::Cipher::AES.new(128, 'CBC')
* cipher = OpenSSL::Cipher::AES.new('128-CBC')
*
* Finally, due to its wide-spread use, there are also extra classes
* defined for the different key sizes of AES
*
* cipher = OpenSSL::Cipher::AES128.new(:CBC)
* cipher = OpenSSL::Cipher::AES192.new(:CBC)
* cipher = OpenSSL::Cipher::AES256.new(:CBC)
*
* === Choosing either encryption or decryption mode
*
* Encryption and decryption are often very similar operations for
* symmetric algorithms, this is reflected by not having to choose
* different classes for either operation, both can be done using the
* same class. Still, after obtaining a Cipher instance, we need to
* tell the instance what it is that we intend to do with it, so we
* need to call either
*
* cipher.encrypt
*
* or
*
* cipher.decrypt
*
* on the Cipher instance. This should be the first call after creating
* the instance, otherwise configuration that has already been set could
* get lost in the process.
*
* === Choosing a key
*
* Symmetric encryption requires a key that is the same for the encrypting
* and for the decrypting party and after initial key establishment should
* be kept as private information. There are a lot of ways to create
* insecure keys, the most notable is to simply take a password as the key
* without processing the password further. A simple and secure way to
* create a key for a particular Cipher is
*
* cipher = OpenSSL::AES256.new(:CFB)
* cipher.encrypt
* key = cipher.random_key # also sets the generated key on the Cipher
*
* If you absolutely need to use passwords as encryption keys, you
* should use Password-Based Key Derivation Function 2 (PBKDF2) by
* generating the key with the help of the functionality provided by
* OpenSSL::PKCS5.pbkdf2_hmac_sha1 or OpenSSL::PKCS5.pbkdf2_hmac.
*
* Although there is Cipher#pkcs5_keyivgen, its use is deprecated and
* it should only be used in legacy applications because it does not use
* the newer PKCS#5 v2 algorithms.
*
* === Choosing an IV
*
* The cipher modes CBC, CFB, OFB and CTR all need an "initialization
* vector", or short, IV. ECB mode is the only mode that does not require
* an IV, but there is almost no legitimate use case for this mode
* because of the fact that it does not sufficiently hide plaintext
* patterns. Therefore
*
* <b>You should never use ECB mode unless you are absolutely sure that
* you absolutely need it</b>
*
* Because of this, you will end up with a mode that explicitly requires
* an IV in any case. Note that for backwards compatibility reasons,
* setting an IV is not explicitly mandated by the Cipher API. If not
* set, OpenSSL itself defaults to an all-zeroes IV ("\\0", not the
* character). Although the IV can be seen as public information, i.e.
* it may be transmitted in public once generated, it should still stay
* unpredictable to prevent certain kinds of attacks. Therefore, ideally
*
* <b>Always create a secure random IV for every encryption of your
* Cipher</b>
*
* A new, random IV should be created for every encryption of data. Think
* of the IV as a nonce (number used once) - it's public but random and
* unpredictable. A secure random IV can be created as follows
*
* cipher = ...
* cipher.encrypt
* key = cipher.random_key
* iv = cipher.random_iv # also sets the generated IV on the Cipher
*
* Although the key is generally a random value, too, it is a bad choice
* as an IV. There are elaborate ways how an attacker can take advantage
* of such an IV. As a general rule of thumb, exposing the key directly
* or indirectly should be avoided at all cost and exceptions only be
* made with good reason.
*
* === Calling Cipher#final
*
* ECB (which should not be used) and CBC are both block-based modes.
* This means that unlike for the other streaming-based modes, they
* operate on fixed-size blocks of data, and therefore they require a
* "finalization" step to produce or correctly decrypt the last block of
* data by appropriately handling some form of padding. Therefore it is
* essential to add the output of OpenSSL::Cipher#final to your
* encryption/decryption buffer or you will end up with decryption errors
* or truncated data.
*
* Although this is not really necessary for streaming-mode ciphers, it is
* still recommended to apply the same pattern of adding the output of
* Cipher#final there as well - it also enables you to switch between
* modes more easily in the future.
*
* === Encrypting and decrypting some data
*
* data = "Very, very confidential data"
*
* cipher = OpenSSL::Cipher::AES.new(128, :CBC)
* cipher.encrypt
* key = cipher.random_key
* iv = cipher.random_iv
*
* encrypted = cipher.update(data) + cipher.final
* ...
* decipher = OpenSSL::Cipher::AES.new(128, :CBC)
* decipher.decrypt
* decipher.key = key
* decipher.iv = iv
*
* plain = decipher.update(encrypted) + decipher.final
*
* puts data == plain #=> true
*
* === Authenticated Encryption and Associated Data (AEAD)
*
* If the OpenSSL version used supports it, an Authenticated Encryption
* mode (such as GCM or CCM) should always be preferred over any
* unauthenticated mode. Currently, OpenSSL supports AE only in combination
* with Associated Data (AEAD) where additional associated data is included
* in the encryption process to compute a tag at the end of the encryption.
* This tag will also be used in the decryption process and by verifying
* its validity, the authenticity of a given ciphertext is established.
*
* This is superior to unauthenticated modes in that it allows to detect
* if somebody effectively changed the ciphertext after it had been
* encrypted. This prevents malicious modifications of the ciphertext that
* could otherwise be exploited to modify ciphertexts in ways beneficial to
* potential attackers.
*
* An associated data is used where there is additional information, such as
* headers or some metadata, that must be also authenticated but not
* necessarily need to be encrypted. If no associated data is needed for
* encryption and later decryption, the OpenSSL library still requires a
* value to be set - "" may be used in case none is available.
*
* An example using the GCM (Galois/Counter Mode). You have 16 bytes +key+,
* 12 bytes (96 bits) +nonce+ and the associated data +auth_data+. Be sure
* not to reuse the +key+ and +nonce+ pair. Reusing an nonce ruins the
* security gurantees of GCM mode.
*
* cipher = OpenSSL::Cipher::AES.new(128, :GCM).encrypt
* cipher.key = key
* cipher.iv = nonce
* cipher.auth_data = auth_data
*
* encrypted = cipher.update(data) + cipher.final
* tag = cipher.auth_tag # produces 16 bytes tag by default
*
* Now you are the receiver. You know the +key+ and have received +nonce+,
* +auth_data+, +encrypted+ and +tag+ through an untrusted network. Note
* that GCM accepts an arbitrary length tag between 1 and 16 bytes. You may
* additionally need to check that the received tag has the correct length,
* or you allow attackers to forge a valid single byte tag for the tampered
* ciphertext with a probability of 1/256.
*
* raise "tag is truncated!" unless tag.bytesize == 16
* decipher = OpenSSL::Cipher::AES.new(128, :GCM).decrypt
* decipher.key = key
* decipher.iv = nonce
* decipher.auth_tag = tag
* decipher.auth_data = auth_data
*
* decrypted = decipher.update(encrypted) + decipher.final
*
* puts data == decrypted #=> true
*/
cCipher = rb_define_class_under(mOSSL, "Cipher", rb_cObject);
eCipherError = rb_define_class_under(cCipher, "CipherError", eOSSLError);
rb_define_alloc_func(cCipher, ossl_cipher_alloc);
rb_define_copy_func(cCipher, ossl_cipher_copy);
rb_define_module_function(cCipher, "ciphers", ossl_s_ciphers, 0);
rb_define_method(cCipher, "initialize", ossl_cipher_initialize, 1);
rb_define_method(cCipher, "reset", ossl_cipher_reset, 0);
rb_define_method(cCipher, "encrypt", ossl_cipher_encrypt, -1);
rb_define_method(cCipher, "decrypt", ossl_cipher_decrypt, -1);
rb_define_method(cCipher, "pkcs5_keyivgen", ossl_cipher_pkcs5_keyivgen, -1);
rb_define_method(cCipher, "update", ossl_cipher_update, -1);
rb_define_method(cCipher, "final", ossl_cipher_final, 0);
rb_define_method(cCipher, "name", ossl_cipher_name, 0);
rb_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
rb_define_method(cCipher, "auth_data=", ossl_cipher_set_auth_data, 1);
rb_define_method(cCipher, "auth_tag=", ossl_cipher_set_auth_tag, 1);
rb_define_method(cCipher, "auth_tag", ossl_cipher_get_auth_tag, -1);
rb_define_method(cCipher, "auth_tag_len=", ossl_cipher_set_auth_tag_len, 1);
rb_define_method(cCipher, "authenticated?", ossl_cipher_is_authenticated, 0);
rb_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
rb_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
rb_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
rb_define_method(cCipher, "iv_len=", ossl_cipher_set_iv_length, 1);
rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
id_auth_tag_len = rb_intern_const("auth_tag_len");
}
| 17,618 |
156,417 | 0 | void PageHandler::ScreencastFrameEncoded(
std::unique_ptr<Page::ScreencastFrameMetadata> page_metadata,
const std::string& data) {
if (data.empty()) {
--frames_in_flight_;
return; // Encode failed.
}
frontend_->ScreencastFrame(data, std::move(page_metadata), session_id_);
}
| 17,619 |
24,439 | 0 | static void proc_skip_char(char **buf, size_t *size, const char v)
{
while (*size) {
if (**buf != v)
break;
(*size)--;
(*buf)++;
}
}
| 17,620 |
3,290 | 0 | stack_param_list_write(stack_param_list * plist, ref_stack_t * pstack,
const ref * pwanted, gs_ref_memory_t *imem)
{
plist->u.w.write = stack_param_write;
ref_param_write_init((iparam_list *) plist, pwanted, imem);
plist->enumerate = stack_param_enumerate;
plist->pstack = pstack;
plist->skip = 0;
plist->count = 0;
return 0;
}
| 17,621 |
36,534 | 0 | static unsigned int snd_disconnect_poll(struct file * file, poll_table * wait)
{
return POLLERR | POLLNVAL;
}
| 17,622 |
121,240 | 0 | int HTMLInputElement::selectionStartForBinding(ExceptionCode& ec) const
{
if (!canHaveSelection()) {
ec = INVALID_STATE_ERR;
return 0;
}
return HTMLTextFormControlElement::selectionStart();
}
| 17,623 |
19,318 | 0 | static int unix_release_sock(struct sock *sk, int embrion)
{
struct unix_sock *u = unix_sk(sk);
struct path path;
struct sock *skpair;
struct sk_buff *skb;
int state;
unix_remove_socket(sk);
/* Clear state */
unix_state_lock(sk);
sock_orphan(sk);
sk->sk_shutdown = SHUTDOWN_MASK;
path = u->path;
u->path.dentry = NULL;
u->path.mnt = NULL;
state = sk->sk_state;
sk->sk_state = TCP_CLOSE;
unix_state_unlock(sk);
wake_up_interruptible_all(&u->peer_wait);
skpair = unix_peer(sk);
if (skpair != NULL) {
if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
unix_state_lock(skpair);
/* No more writes */
skpair->sk_shutdown = SHUTDOWN_MASK;
if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
skpair->sk_err = ECONNRESET;
unix_state_unlock(skpair);
skpair->sk_state_change(skpair);
sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
}
sock_put(skpair); /* It may now die */
unix_peer(sk) = NULL;
}
/* Try to flush out this socket. Throw out buffers at least */
while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
if (state == TCP_LISTEN)
unix_release_sock(skb->sk, 1);
/* passed fds are erased in the kfree_skb hook */
kfree_skb(skb);
}
if (path.dentry)
path_put(&path);
sock_put(sk);
/* ---- Socket is dead now and most probably destroyed ---- */
/*
* Fixme: BSD difference: In BSD all sockets connected to use get
* ECONNRESET and we die on the spot. In Linux we behave
* like files and pipes do and wait for the last
* dereference.
*
* Can't we simply set sock->err?
*
* What the above comment does talk about? --ANK(980817)
*/
if (unix_tot_inflight)
unix_gc(); /* Garbage collect fds */
return 0;
}
| 17,624 |
73,060 | 0 | BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
gdImagePtr src,
double dstX, double dstY,
int srcX, int srcY,
int srcWidth, int srcHeight, int angle)
{
double dx, dy;
double radius = sqrt (srcWidth * srcWidth + srcHeight * srcHeight);
double aCos = cos (angle * .0174532925);
double aSin = sin (angle * .0174532925);
double scX = srcX + ((double) srcWidth) / 2;
double scY = srcY + ((double) srcHeight) / 2;
int cmap[gdMaxColors];
int i;
/*
2.0.34: transparency preservation. The transparentness of
the transparent color is more important than its hue.
*/
if (src->transparent != -1) {
if (dst->transparent == -1) {
dst->transparent = src->transparent;
}
}
for (i = 0; (i < gdMaxColors); i++) {
cmap[i] = (-1);
}
for (dy = dstY - radius; (dy <= dstY + radius); dy++) {
for (dx = dstX - radius; (dx <= dstX + radius); dx++) {
double sxd = (dx - dstX) * aCos - (dy - dstY) * aSin;
double syd = (dy - dstY) * aCos + (dx - dstX) * aSin;
int sx = sxd + scX;
int sy = syd + scY;
if ((sx >= srcX) && (sx < srcX + srcWidth) &&
(sy >= srcY) && (sy < srcY + srcHeight)) {
int c = gdImageGetPixel (src, sx, sy);
/* 2.0.34: transparency wins */
if (c == src->transparent) {
gdImageSetPixel (dst, dx, dy, dst->transparent);
} else if (!src->trueColor) {
/* Use a table to avoid an expensive
lookup on every single pixel */
if (cmap[c] == -1) {
cmap[c] = gdImageColorResolveAlpha (dst,
gdImageRed (src, c),
gdImageGreen (src,
c),
gdImageBlue (src,
c),
gdImageAlpha (src,
c));
}
gdImageSetPixel (dst, dx, dy, cmap[c]);
} else {
gdImageSetPixel (dst,
dx, dy,
gdImageColorResolveAlpha (dst,
gdImageRed (src,
c),
gdImageGreen
(src, c),
gdImageBlue (src,
c),
gdImageAlpha
(src, c)));
}
}
}
}
}
| 17,625 |
111,907 | 0 | void ProfileSyncService::OnClearServerDataFailed() {
clear_server_data_timer_.Stop();
if (clear_server_data_state_ != CLEAR_SUCCEEDED &&
clear_server_data_state_ != CLEAR_FAILED) {
clear_server_data_state_ = CLEAR_FAILED;
NotifyObservers();
}
}
| 17,626 |
32,350 | 0 | void drop_collected_mounts(struct vfsmount *mnt)
{
LIST_HEAD(umount_list);
down_write(&namespace_sem);
br_write_lock(&vfsmount_lock);
umount_tree(real_mount(mnt), 0, &umount_list);
br_write_unlock(&vfsmount_lock);
up_write(&namespace_sem);
release_mounts(&umount_list);
}
| 17,627 |
2,171 | 0 | void red_channel_push(RedChannel *channel)
{
RingItem *link;
RingItem *next;
RedChannelClient *rcc;
if (!channel) {
return;
}
RING_FOREACH_SAFE(link, next, &channel->clients) {
rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
red_channel_client_push(rcc);
}
}
| 17,628 |
8,952 | 0 | void net_tx_pkt_build_vheader(struct NetTxPkt *pkt, bool tso_enable,
bool csum_enable, uint32_t gso_size)
{
struct tcp_hdr l4hdr;
assert(pkt);
/* csum has to be enabled if tso is. */
assert(csum_enable || !tso_enable);
pkt->virt_hdr.gso_type = net_tx_pkt_get_gso_type(pkt, tso_enable);
switch (pkt->virt_hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
case VIRTIO_NET_HDR_GSO_NONE:
pkt->virt_hdr.hdr_len = 0;
pkt->virt_hdr.gso_size = 0;
break;
case VIRTIO_NET_HDR_GSO_UDP:
pkt->virt_hdr.gso_size = gso_size;
pkt->virt_hdr.hdr_len = pkt->hdr_len + sizeof(struct udp_header);
break;
case VIRTIO_NET_HDR_GSO_TCPV4:
case VIRTIO_NET_HDR_GSO_TCPV6:
iov_to_buf(&pkt->vec[NET_TX_PKT_PL_START_FRAG], pkt->payload_frags,
0, &l4hdr, sizeof(l4hdr));
pkt->virt_hdr.hdr_len = pkt->hdr_len + l4hdr.th_off * sizeof(uint32_t);
pkt->virt_hdr.gso_size = gso_size;
break;
default:
g_assert_not_reached();
}
if (csum_enable) {
switch (pkt->l4proto) {
case IP_PROTO_TCP:
pkt->virt_hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
pkt->virt_hdr.csum_start = pkt->hdr_len;
pkt->virt_hdr.csum_offset = offsetof(struct tcp_hdr, th_sum);
break;
case IP_PROTO_UDP:
pkt->virt_hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
pkt->virt_hdr.csum_start = pkt->hdr_len;
pkt->virt_hdr.csum_offset = offsetof(struct udp_hdr, uh_sum);
break;
default:
break;
}
}
}
| 17,629 |
108,966 | 0 | void RenderViewImpl::OnSelectPopupMenuItems(
bool canceled,
const std::vector<int>& selected_indices) {
if (!external_popup_menu_.get())
return;
external_popup_menu_->DidSelectItems(canceled, selected_indices);
external_popup_menu_.reset();
}
| 17,630 |
145,668 | 0 | GuestViewBase* ExtensionViewGuest::Create(WebContents* owner_web_contents) {
return new ExtensionViewGuest(owner_web_contents);
}
| 17,631 |
68,536 | 0 | gst_asf_demux_descramble_buffer (GstASFDemux * demux, AsfStream * stream,
GstBuffer ** p_buffer)
{
GstBuffer *descrambled_buffer;
GstBuffer *scrambled_buffer;
GstBuffer *sub_buffer;
guint offset;
guint off;
guint row;
guint col;
guint idx;
/* descrambled_buffer is initialised in the first iteration */
descrambled_buffer = NULL;
scrambled_buffer = *p_buffer;
if (gst_buffer_get_size (scrambled_buffer) <
stream->ds_packet_size * stream->span)
return;
for (offset = 0; offset < gst_buffer_get_size (scrambled_buffer);
offset += stream->ds_chunk_size) {
off = offset / stream->ds_chunk_size;
row = off / stream->span;
col = off % stream->span;
idx = row + col * stream->ds_packet_size / stream->ds_chunk_size;
GST_DEBUG ("idx=%u, row=%u, col=%u, off=%u, ds_chunk_size=%u", idx, row,
col, off, stream->ds_chunk_size);
GST_DEBUG ("scrambled buffer size=%" G_GSIZE_FORMAT
", span=%u, packet_size=%u", gst_buffer_get_size (scrambled_buffer),
stream->span, stream->ds_packet_size);
GST_DEBUG ("gst_buffer_get_size (scrambled_buffer) = %" G_GSIZE_FORMAT,
gst_buffer_get_size (scrambled_buffer));
sub_buffer =
gst_buffer_copy_region (scrambled_buffer, GST_BUFFER_COPY_MEMORY,
idx * stream->ds_chunk_size, stream->ds_chunk_size);
if (!offset) {
descrambled_buffer = sub_buffer;
} else {
descrambled_buffer = gst_buffer_append (descrambled_buffer, sub_buffer);
}
}
GST_BUFFER_TIMESTAMP (descrambled_buffer) =
GST_BUFFER_TIMESTAMP (scrambled_buffer);
GST_BUFFER_DURATION (descrambled_buffer) =
GST_BUFFER_DURATION (scrambled_buffer);
GST_BUFFER_OFFSET (descrambled_buffer) = GST_BUFFER_OFFSET (scrambled_buffer);
GST_BUFFER_OFFSET_END (descrambled_buffer) =
GST_BUFFER_OFFSET_END (scrambled_buffer);
/* FIXME/CHECK: do we need to transfer buffer flags here too? */
gst_buffer_unref (scrambled_buffer);
*p_buffer = descrambled_buffer;
}
| 17,632 |
148,827 | 0 | bool GetInputText(std::string* input_text) {
return ExecuteScriptAndExtractString(interstitial_->GetMainFrame(),
"get_input_text()", input_text);
}
| 17,633 |
82,951 | 0 | static int bin_dwarf(RCore *core, int mode) {
RBinDwarfRow *row;
RListIter *iter;
RList *list = NULL;
if (!r_config_get_i (core->config, "bin.dbginfo")) {
return false;
}
RBinFile *binfile = r_core_bin_cur (core);
RBinPlugin * plugin = r_bin_file_cur_plugin (binfile);
if (!binfile) {
return false;
}
if (plugin && plugin->lines) {
list = plugin->lines (binfile);
} else if (core->bin) {
RBinDwarfDebugAbbrev *da = NULL;
da = r_bin_dwarf_parse_abbrev (core->bin, mode);
r_bin_dwarf_parse_info (da, core->bin, mode);
r_bin_dwarf_parse_aranges (core->bin, mode);
list = r_bin_dwarf_parse_line (core->bin, mode);
r_bin_dwarf_free_debug_abbrev (da);
free (da);
}
if (!list) {
return false;
}
r_cons_break_push (NULL, NULL);
/* cache file:line contents */
const char *lastFile = NULL;
int *lastFileLines = NULL;
char *lastFileContents = NULL;
int lastFileLinesCount = 0;
/* ugly dupe for speedup */
const char *lastFile2 = NULL;
int *lastFileLines2 = NULL;
char *lastFileContents2 = NULL;
int lastFileLinesCount2 = 0;
const char *lf = NULL;
int *lfl = NULL;
char *lfc = NULL;
int lflc = 0;
r_list_foreach (list, iter, row) {
if (r_cons_is_breaked ()) {
break;
}
if (mode) {
const char *path = row->file;
if (!lastFile || strcmp (path, lastFile)) {
if (lastFile && lastFile2 && !strcmp (path, lastFile2)) {
lf = lastFile;
lfl = lastFileLines;
lfc = lastFileContents;
lflc = lastFileLinesCount;
lastFile = lastFile2;
lastFileLines = lastFileLines2;
lastFileContents = lastFileContents2;
lastFileLinesCount = lastFileLinesCount2;
lastFile2 = lf;
lastFileLines2 = lfl;
lastFileContents2 = lfc;
lastFileLinesCount2 = lflc;
} else {
lastFile2 = lastFile;
lastFileLines2 = lastFileLines;
lastFileContents2 = lastFileContents;
lastFileLinesCount2 = lastFileLinesCount;
lastFile = path;
lastFileContents = r_file_slurp (path, NULL);
if (lastFileContents) {
lastFileLines = r_str_split_lines (lastFileContents, &lastFileLinesCount);
}
}
}
char *line = NULL;
if (lastFileLines && lastFileContents) {
int nl = row->line - 1;
if (nl >= 0 && nl < lastFileLinesCount) {
line = strdup (lastFileContents + lastFileLines[nl]);
}
} else {
line = NULL;
}
if (line) {
r_str_filter (line, strlen (line));
line = r_str_replace (line, "\"", "\\\"", 1);
line = r_str_replace (line, "\\\\", "\\", 1);
}
bool chopPath = !r_config_get_i (core->config, "dir.dwarf.abspath");
char *file = strdup (row->file);
if (chopPath) {
const char *slash = r_str_lchr (file, '/');
if (slash) {
memmove (file, slash + 1, strlen (slash));
}
}
if ((mode & R_CORE_BIN_SET)) {
#if 0
char *cmt = r_str_newf ("%s:%d %s", file, (int)row->line, line? line: "");
r_meta_set_string (core->anal, R_META_TYPE_COMMENT, row->address, cmt);
free (cmt);
#endif
} else {
r_cons_printf ("CL %s:%d 0x%08" PFMT64x "\n",
file, (int)row->line,
row->address);
r_cons_printf ("\"CC %s:%d %s\"@0x%" PFMT64x
"\n",
file, row->line,
line ? line : "", row->address);
}
free (file);
free (line);
} else {
r_cons_printf ("0x%08" PFMT64x "\t%s\t%d\n",
row->address, row->file, row->line);
}
}
r_cons_break_pop ();
R_FREE (lastFileContents);
R_FREE (lastFileContents2);
free (lastFileLines);
return true;
}
| 17,634 |
128,128 | 0 | views::View* TrayCast::CreateDefaultView(user::LoginStatus status) {
CHECK(default_ == nullptr);
default_ = new tray::CastDuplexView(this, cast_config_delegate_,
status != user::LOGGED_IN_LOCKED);
UpdatePrimaryView();
return default_;
}
| 17,635 |
126,735 | 0 | void BrowserView::DestroyBrowser() {
GetWidget()->RemoveObserver(this);
frame_->CloseNow();
}
| 17,636 |
127,906 | 0 | bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url) const
{
if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
return true;
return m_sameOriginRequest && getSecurityOrigin()->canRequest(url);
}
| 17,637 |
71,735 | 0 | static void SVGProcessingInstructions(void *context,const xmlChar *target,
const xmlChar *data)
{
SVGInfo
*svg_info;
/*
A processing instruction has been parsed.
*/
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.processingInstruction(%s, %s)",target,data);
svg_info=(SVGInfo *) context;
(void) svg_info;
}
| 17,638 |
28,400 | 0 | void fib6_clean_all_ro(struct net *net, int (*func)(struct rt6_info *, void *arg),
int prune, void *arg)
{
struct fib6_table *table;
struct hlist_head *head;
unsigned int h;
rcu_read_lock();
for (h = 0; h < FIB6_TABLE_HASHSZ; h++) {
head = &net->ipv6.fib_table_hash[h];
hlist_for_each_entry_rcu(table, head, tb6_hlist) {
read_lock_bh(&table->tb6_lock);
fib6_clean_tree(net, &table->tb6_root,
func, prune, arg);
read_unlock_bh(&table->tb6_lock);
}
}
rcu_read_unlock();
}
| 17,639 |
122,132 | 0 | static IntPoint computeOffsetFromAbsolute(RenderLayer* layer)
{
TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
layer->renderer()->mapLocalToContainer(0, transformState, ApplyContainerFlip);
transformState.flatten();
return roundedIntPoint(transformState.lastPlanarPoint());
}
| 17,640 |
151,257 | 0 | String ScheduledNavigationReasonToProtocol(ScheduledNavigation::Reason reason) {
using ReasonEnum =
protocol::Page::FrameScheduledNavigationNotification::ReasonEnum;
switch (reason) {
case ScheduledNavigation::Reason::kFormSubmissionGet:
return ReasonEnum::FormSubmissionGet;
case ScheduledNavigation::Reason::kFormSubmissionPost:
return ReasonEnum::FormSubmissionPost;
case ScheduledNavigation::Reason::kHttpHeaderRefresh:
return ReasonEnum::HttpHeaderRefresh;
case ScheduledNavigation::Reason::kFrameNavigation:
return ReasonEnum::ScriptInitiated;
case ScheduledNavigation::Reason::kMetaTagRefresh:
return ReasonEnum::MetaTagRefresh;
case ScheduledNavigation::Reason::kPageBlock:
return ReasonEnum::PageBlockInterstitial;
case ScheduledNavigation::Reason::kReload:
return ReasonEnum::Reload;
default:
NOTREACHED();
}
return ReasonEnum::Reload;
}
| 17,641 |
46,428 | 0 | static ssize_t ubifs_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
int err = update_mctime(file_inode(iocb->ki_filp));
if (err)
return err;
return generic_file_write_iter(iocb, from);
}
| 17,642 |
101,237 | 0 | bool SyncerProtoUtil::PostAndProcessHeaders(ServerConnectionManager* scm,
sessions::SyncSession* session,
const ClientToServerMessage& msg,
ClientToServerResponse* response) {
ServerConnectionManager::PostBufferParams params;
msg.SerializeToString(¶ms.buffer_in);
ScopedServerStatusWatcher server_status_watcher(scm, ¶ms.response);
if (!scm->PostBufferWithCachedAuth(¶ms, &server_status_watcher)) {
LOG(WARNING) << "Error posting from syncer:" << params.response;
return false;
}
std::string new_token = params.response.update_client_auth_header;
if (!new_token.empty()) {
SyncEngineEvent event(SyncEngineEvent::UPDATED_TOKEN);
event.updated_token = new_token;
session->context()->NotifyListeners(event);
}
if (response->ParseFromString(params.buffer_out)) {
switch (response->error_code()) {
case ClientToServerResponse::ACCESS_DENIED:
case ClientToServerResponse::AUTH_INVALID:
case ClientToServerResponse::USER_NOT_ACTIVATED:
params.response.server_status = HttpResponse::SYNC_AUTH_ERROR;
return false;
default:
return true;
}
}
return false;
}
| 17,643 |
95,059 | 0 | gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor)
{
const float _angle = (float)((- degrees / 180.0f) * M_PI);
const int src_w = gdImageSX(src);
const int src_h = gdImageSY(src);
const unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f));
const unsigned int new_height = abs((int)(src_w*sin(_angle))) + abs((int)(src_h*cos(_angle) + 0.5f));
const gdFixed f_0_5 = gd_ftofx(0.5f);
const gdFixed f_H = gd_itofx(src_h/2);
const gdFixed f_W = gd_itofx(src_w/2);
const gdFixed f_cos = gd_ftofx(cos(-_angle));
const gdFixed f_sin = gd_ftofx(sin(-_angle));
const gdFixed f_1 = gd_itofx(1);
const gdFixed f_2 = gd_itofx(2);
const gdFixed f_4 = gd_itofx(4);
const gdFixed f_6 = gd_itofx(6);
const gdFixed f_gama = gd_ftofx(1.04f);
unsigned int dst_offset_x;
unsigned int dst_offset_y = 0;
unsigned int i;
gdImagePtr dst;
dst = gdImageCreateTrueColor(new_width, new_height);
if (dst == NULL) {
return NULL;
}
dst->saveAlphaFlag = 1;
for (i=0; i < new_height; i++) {
unsigned int j;
dst_offset_x = 0;
for (j=0; j < new_width; j++) {
const gdFixed f_i = gd_itofx((int)i - (int)new_height/2);
const gdFixed f_j = gd_itofx((int)j - (int)new_width/2);
const gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
const int m = gd_fxtoi(f_m);
const int n = gd_fxtoi(f_n);
if ((m > 0) && (m < src_h - 1) && (n > 0) && (n < src_w-1)) {
const gdFixed f_f = f_m - gd_itofx(m);
const gdFixed f_g = f_n - gd_itofx(n);
unsigned int src_offset_x[16], src_offset_y[16];
unsigned char red, green, blue, alpha;
gdFixed f_red=0, f_green=0, f_blue=0, f_alpha=0;
int k;
if ((m < 1) || (n < 1)) {
src_offset_x[0] = n;
src_offset_y[0] = m;
} else {
src_offset_x[0] = n - 1;
src_offset_y[0] = m;
}
if (m < 1) {
src_offset_x[1] = n;
src_offset_y[1] = m;
} else {
src_offset_x[1] = n;
src_offset_y[1] = m ;
}
if ((m < 1) || (n >= src_w-1)) {
src_offset_x[2] = - 1;
src_offset_y[2] = - 1;
} else {
src_offset_x[2] = n + 1;
src_offset_y[2] = m ;
}
if ((m < 1) || (n >= src_w-2)) {
src_offset_x[3] = - 1;
src_offset_y[3] = - 1;
} else {
src_offset_x[3] = n + 1 + 1;
src_offset_y[3] = m ;
}
if (n < 1) {
src_offset_x[4] = - 1;
src_offset_y[4] = - 1;
} else {
src_offset_x[4] = n - 1;
src_offset_y[4] = m;
}
src_offset_x[5] = n;
src_offset_y[5] = m;
if (n >= src_w-1) {
src_offset_x[6] = - 1;
src_offset_y[6] = - 1;
} else {
src_offset_x[6] = n + 1;
src_offset_y[6] = m;
}
if (n >= src_w-2) {
src_offset_x[7] = - 1;
src_offset_y[7] = - 1;
} else {
src_offset_x[7] = n + 1 + 1;
src_offset_y[7] = m;
}
if ((m >= src_h-1) || (n < 1)) {
src_offset_x[8] = - 1;
src_offset_y[8] = - 1;
} else {
src_offset_x[8] = n - 1;
src_offset_y[8] = m;
}
if (m >= src_h-1) {
src_offset_x[8] = - 1;
src_offset_y[8] = - 1;
} else {
src_offset_x[9] = n;
src_offset_y[9] = m;
}
if ((m >= src_h-1) || (n >= src_w-1)) {
src_offset_x[10] = - 1;
src_offset_y[10] = - 1;
} else {
src_offset_x[10] = n + 1;
src_offset_y[10] = m;
}
if ((m >= src_h-1) || (n >= src_w-2)) {
src_offset_x[11] = - 1;
src_offset_y[11] = - 1;
} else {
src_offset_x[11] = n + 1 + 1;
src_offset_y[11] = m;
}
if ((m >= src_h-2) || (n < 1)) {
src_offset_x[12] = - 1;
src_offset_y[12] = - 1;
} else {
src_offset_x[12] = n - 1;
src_offset_y[12] = m;
}
if (m >= src_h-2) {
src_offset_x[13] = - 1;
src_offset_y[13] = - 1;
} else {
src_offset_x[13] = n;
src_offset_y[13] = m;
}
if ((m >= src_h-2) || (n >= src_w - 1)) {
src_offset_x[14] = - 1;
src_offset_y[14] = - 1;
} else {
src_offset_x[14] = n + 1;
src_offset_y[14] = m;
}
if ((m >= src_h-2) || (n >= src_w-2)) {
src_offset_x[15] = - 1;
src_offset_y[15] = - 1;
} else {
src_offset_x[15] = n + 1 + 1;
src_offset_y[15] = m;
}
for (k=-1; k<3; k++) {
const gdFixed f = gd_itofx(k)-f_f;
const gdFixed f_fm1 = f - f_1;
const gdFixed f_fp1 = f + f_1;
const gdFixed f_fp2 = f + f_2;
gdFixed f_a = 0, f_b = 0,f_c = 0, f_d = 0;
gdFixed f_RY;
int l;
if (f_fp2 > 0) {
f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2));
}
if (f_fp1 > 0) {
f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1));
}
if (f > 0) {
f_c = gd_mulfx(f,gd_mulfx(f,f));
}
if (f_fm1 > 0) {
f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1));
}
f_RY = gd_divfx((f_a-gd_mulfx(f_4,f_b)+gd_mulfx(f_6,f_c)-gd_mulfx(f_4,f_d)),f_6);
for (l=-1; l< 3; l++) {
const gdFixed f = gd_itofx(l) - f_g;
const gdFixed f_fm1 = f - f_1;
const gdFixed f_fp1 = f + f_1;
const gdFixed f_fp2 = f + f_2;
gdFixed f_a = 0, f_b = 0, f_c = 0, f_d = 0;
gdFixed f_RX, f_R;
const int _k = ((k + 1) * 4) + (l + 1);
register gdFixed f_rs, f_gs, f_bs, f_as;
register int c;
if (f_fp2 > 0) {
f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2));
}
if (f_fp1 > 0) {
f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1));
}
if (f > 0) {
f_c = gd_mulfx(f,gd_mulfx(f,f));
}
if (f_fm1 > 0) {
f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1));
}
f_RX = gd_divfx((f_a - gd_mulfx(f_4, f_b) + gd_mulfx(f_6, f_c) - gd_mulfx(f_4, f_d)), f_6);
f_R = gd_mulfx(f_RY, f_RX);
if ((src_offset_x[_k] <= 0) || (src_offset_y[_k] <= 0) || (src_offset_y[_k] >= src_h) || (src_offset_x[_k] >= src_w)) {
c = bgColor;
} else if ((src_offset_x[_k] <= 1) || (src_offset_y[_k] <= 1) || (src_offset_y[_k] >= (int)src_h - 1) || (src_offset_x[_k] >= (int)src_w - 1)) {
gdFixed f_127 = gd_itofx(127);
c = src->tpixels[src_offset_y[_k]][src_offset_x[_k]];
c = c | (( (int) (gd_fxtof(gd_mulfx(f_R, f_127)) + 50.5f)) << 24);
c = _color_blend(bgColor, c);
} else {
c = src->tpixels[src_offset_y[_k]][src_offset_x[_k]];
}
f_rs = gd_itofx(gdTrueColorGetRed(c));
f_gs = gd_itofx(gdTrueColorGetGreen(c));
f_bs = gd_itofx(gdTrueColorGetBlue(c));
f_as = gd_itofx(gdTrueColorGetAlpha(c));
f_red += gd_mulfx(f_rs, f_R);
f_green += gd_mulfx(f_gs, f_R);
f_blue += gd_mulfx(f_bs, f_R);
f_alpha += gd_mulfx(f_as, f_R);
}
}
red = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_red, f_gama)), 0, 255);
green = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_green, f_gama)), 0, 255);
blue = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_blue, f_gama)), 0, 255);
alpha = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_alpha, f_gama)), 0, 127);
dst->tpixels[dst_offset_y][dst_offset_x] = gdTrueColorAlpha(red, green, blue, alpha);
} else {
dst->tpixels[dst_offset_y][dst_offset_x] = bgColor;
}
dst_offset_x++;
}
dst_offset_y++;
}
return dst;
}
| 17,644 |
117,601 | 0 | void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) {
int current_version =
local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
if ((current_version & WINDOWS_PREFS) == 0) {
local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1);
if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) {
user_prefs->SetInteger(prefs::kDevToolsSplitLocation,
local_state->GetInteger(prefs::kDevToolsSplitLocation));
}
local_state->ClearPref(prefs::kDevToolsSplitLocation);
local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement);
if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) {
const PrefService::Preference* pref =
local_state->FindPreference(prefs::kBrowserWindowPlacement);
DCHECK(pref);
user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue()));
}
local_state->ClearPref(prefs::kBrowserWindowPlacement);
local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
current_version | WINDOWS_PREFS);
}
}
| 17,645 |
167,009 | 0 | NavigationControllerImpl::GetDefaultSessionStorageNamespace() {
return GetSessionStorageNamespace(nullptr);
}
| 17,646 |
148,227 | 0 | void IndexedDBCursor::PrefetchContinue(
int number_to_fetch,
scoped_refptr<IndexedDBCallbacks> callbacks) {
IDB_TRACE("IndexedDBCursor::PrefetchContinue");
if (closed_) {
callbacks->OnError(CreateCursorClosedError());
return;
}
transaction_->ScheduleTask(
task_type_,
BindWeakOperation(&IndexedDBCursor::CursorPrefetchIterationOperation,
ptr_factory_.GetWeakPtr(), number_to_fetch, callbacks));
}
| 17,647 |
84,589 | 0 | form_write_from_file(FILE * f, char *boundary, char *name, char *filename,
char *file)
{
FILE *fd;
struct stat st;
int c;
char *type;
fprintf(f, "--%s\r\n", boundary);
fprintf(f,
"Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n",
name, mybasename(filename));
type = guessContentType(file);
fprintf(f, "Content-Type: %s\r\n\r\n",
type ? type : "application/octet-stream");
if (lstat(file, &st) < 0)
goto write_end;
if (S_ISDIR(st.st_mode))
goto write_end;
fd = fopen(file, "r");
if (fd != NULL) {
while ((c = fgetc(fd)) != EOF)
fputc(c, f);
fclose(fd);
}
write_end:
fprintf(f, "\r\n");
}
| 17,648 |
36,139 | 0 | kadm5_chpass_principal_3(void *server_handle,
krb5_principal principal, krb5_boolean keepold,
int n_ks_tuple, krb5_key_salt_tuple *ks_tuple,
char *password)
{
krb5_int32 now;
kadm5_policy_ent_rec pol;
osa_princ_ent_rec adb;
krb5_db_entry *kdb;
int ret, ret2, last_pwd, hist_added;
krb5_boolean have_pol = FALSE;
kadm5_server_handle_t handle = server_handle;
osa_pw_hist_ent hist;
krb5_keyblock *act_mkey, *hist_keyblocks = NULL;
krb5_kvno act_kvno, hist_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);
hist_added = 0;
memset(&hist, 0, sizeof(hist));
if (principal == NULL || password == NULL)
return EINVAL;
if ((krb5_principal_compare(handle->context,
principal, hist_princ)) == TRUE)
return KADM5_PROTECT_PRINCIPAL;
if ((ret = kdb_get_entry(handle, principal, &kdb, &adb)))
return(ret);
ret = apply_keysalt_policy(handle, adb.policy, n_ks_tuple, ks_tuple,
&new_n_ks_tuple, &new_ks_tuple);
if (ret)
goto done;
if ((adb.aux_attributes & KADM5_POLICY)) {
ret = get_policy(handle, adb.policy, &pol, &have_pol);
if (ret)
goto done;
}
if (have_pol) {
/* Create a password history entry before we change kdb's key_data. */
ret = kdb_get_hist_key(handle, &hist_keyblocks, &hist_kvno);
if (ret)
goto done;
ret = create_history_entry(handle->context, &hist_keyblocks[0],
kdb->n_key_data, kdb->key_data, &hist);
if (ret)
goto done;
}
if ((ret = passwd_check(handle, password, have_pol ? &pol : NULL,
principal)))
goto done;
ret = kdb_get_active_mkey(handle, &act_kvno, &act_mkey);
if (ret)
goto done;
ret = krb5_dbe_cpw(handle->context, act_mkey, new_ks_tuple, new_n_ks_tuple,
password, 0 /* increment kvno */,
keepold, kdb);
if (ret)
goto done;
ret = krb5_dbe_update_mkvno(handle->context, kdb, act_kvno);
if (ret)
goto done;
kdb->attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE;
ret = krb5_timeofday(handle->context, &now);
if (ret)
goto done;
if ((adb.aux_attributes & KADM5_POLICY)) {
/* the policy was loaded before */
ret = krb5_dbe_lookup_last_pwd_change(handle->context, kdb, &last_pwd);
if (ret)
goto done;
#if 0
/*
* The spec says this check is overridden if the caller has
* modify privilege. The admin server therefore makes this
* check itself (in chpass_principal_wrapper, misc.c). A
* local caller implicitly has all authorization bits.
*/
if ((now - last_pwd) < pol.pw_min_life &&
!(kdb->attributes & KRB5_KDB_REQUIRES_PWCHANGE)) {
ret = KADM5_PASS_TOOSOON;
goto done;
}
#endif
ret = check_pw_reuse(handle->context, hist_keyblocks,
kdb->n_key_data, kdb->key_data,
1, &hist);
if (ret)
goto done;
if (pol.pw_history_num > 1) {
/* If hist_kvno has changed since the last password change, we
* can't check the history. */
if (adb.admin_history_kvno == hist_kvno) {
ret = check_pw_reuse(handle->context, hist_keyblocks,
kdb->n_key_data, kdb->key_data,
adb.old_key_len, adb.old_keys);
if (ret)
goto done;
}
ret = add_to_history(handle->context, hist_kvno, &adb, &pol,
&hist);
if (ret)
goto done;
hist_added = 1;
}
if (pol.pw_max_life)
kdb->pw_expiration = now + pol.pw_max_life;
else
kdb->pw_expiration = 0;
} else {
kdb->pw_expiration = 0;
}
#ifdef USE_PASSWORD_SERVER
if (kadm5_use_password_server () &&
(krb5_princ_size (handle->context, principal) == 1)) {
krb5_data *princ = krb5_princ_component (handle->context, principal, 0);
const char *path = "/usr/sbin/mkpassdb";
char *argv[] = { "mkpassdb", "-setpassword", NULL, NULL };
char *pstring = NULL;
if (!ret) {
pstring = malloc ((princ->length + 1) * sizeof (char));
if (pstring == NULL) { ret = ENOMEM; }
}
if (!ret) {
memcpy (pstring, princ->data, princ->length);
pstring [princ->length] = '\0';
argv[2] = pstring;
ret = kadm5_launch_task (handle->context, path, argv, password);
}
if (pstring != NULL)
free (pstring);
if (ret)
goto done;
}
#endif
ret = krb5_dbe_update_last_pwd_change(handle->context, kdb, now);
if (ret)
goto done;
/* unlock principal on this KDC */
kdb->fail_auth_count = 0;
/* key data and attributes changed, let the database provider know */
kdb->mask = KADM5_KEY_DATA | KADM5_ATTRIBUTES |
KADM5_FAIL_AUTH_COUNT;
/* | KADM5_CPW_FUNCTION */
ret = k5_kadm5_hook_chpass(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_PRECOMMIT, principal, keepold,
new_n_ks_tuple, new_ks_tuple, password);
if (ret)
goto done;
if ((ret = kdb_put_entry(handle, kdb, &adb)))
goto done;
(void) k5_kadm5_hook_chpass(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_POSTCOMMIT, principal,
keepold, new_n_ks_tuple, new_ks_tuple, password);
ret = KADM5_OK;
done:
free(new_ks_tuple);
if (!hist_added && hist.key_data)
free_history_entry(handle->context, &hist);
kdb_free_entry(handle, kdb, &adb);
kdb_free_keyblocks(handle, hist_keyblocks);
if (have_pol && (ret2 = kadm5_free_policy_ent(handle->lhandle, &pol))
&& !ret)
ret = ret2;
return ret;
}
| 17,649 |
66,224 | 0 | int mailimf_quoted_string_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
size_t cur_token;
MMAPString * gstr;
char ch;
char * str;
int r;
int res;
cur_token = * indx;
r = mailimf_cfws_parse(message, length, &cur_token);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;
goto err;
}
r = mailimf_dquote_parse(message, length, &cur_token);
if (r != MAILIMF_NO_ERROR) {
res = r;
goto err;
}
gstr = mmap_string_new("");
if (gstr == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto err;
}
#if 0
if (mmap_string_append_c(gstr, '\"') == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_gstr;
}
#endif
while (1) {
r = mailimf_fws_parse(message, length, &cur_token);
if (r == MAILIMF_NO_ERROR) {
if (mmap_string_append_c(gstr, ' ') == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_gstr;
}
}
else if (r != MAILIMF_ERROR_PARSE) {
res = r;
goto free_gstr;
}
r = mailimf_qcontent_parse(message, length, &cur_token, &ch);
if (r == MAILIMF_NO_ERROR) {
if (mmap_string_append_c(gstr, ch) == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_gstr;
}
}
else if (r == MAILIMF_ERROR_PARSE)
break;
else {
res = r;
goto free_gstr;
}
}
r = mailimf_dquote_parse(message, length, &cur_token);
if (r != MAILIMF_NO_ERROR) {
res = r;
goto free_gstr;
}
#if 0
if (mmap_string_append_c(gstr, '\"') == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_gstr;
}
#endif
str = strdup(gstr->str);
if (str == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_gstr;
}
mmap_string_free(gstr);
* indx = cur_token;
* result = str;
return MAILIMF_NO_ERROR;
free_gstr:
mmap_string_free(gstr);
err:
return res;
}
| 17,650 |
132,409 | 0 | bool IsInputViewEnabled() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableInputView))
return true;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableInputView))
return false;
return true;
}
| 17,651 |
175,096 | 0 | void SoundChannel::setVolume_l(float leftVolume, float rightVolume)
{
mLeftVolume = leftVolume;
mRightVolume = rightVolume;
if (mAudioTrack != NULL)
mAudioTrack->setVolume(leftVolume, rightVolume);
}
| 17,652 |
66,018 | 0 | static int nsv_probe(AVProbeData *p)
{
int i;
int score;
int vsize, asize, auxcount;
score = 0;
av_log(NULL, AV_LOG_TRACE, "nsv_probe(), buf_size %d\n", p->buf_size);
/* check file header */
/* streamed files might not have any header */
if (p->buf[0] == 'N' && p->buf[1] == 'S' &&
p->buf[2] == 'V' && (p->buf[3] == 'f' || p->buf[3] == 's'))
return AVPROBE_SCORE_MAX;
/* XXX: do streamed files always start at chunk boundary ?? */
/* or do we need to search NSVs in the byte stream ? */
/* seems the servers don't bother starting clean chunks... */
/* sometimes even the first header is at 9KB or something :^) */
for (i = 1; i < p->buf_size - 3; i++) {
if (p->buf[i+0] == 'N' && p->buf[i+1] == 'S' &&
p->buf[i+2] == 'V' && p->buf[i+3] == 's') {
score = AVPROBE_SCORE_MAX/5;
/* Get the chunk size and check if at the end we are getting 0xBEEF */
auxcount = p->buf[i+19];
vsize = p->buf[i+20] | p->buf[i+21] << 8;
asize = p->buf[i+22] | p->buf[i+23] << 8;
vsize = (vsize << 4) | (auxcount >> 4);
if ((asize + vsize + i + 23) < p->buf_size - 2) {
if (p->buf[i+23+asize+vsize+1] == 0xEF &&
p->buf[i+23+asize+vsize+2] == 0xBE)
return AVPROBE_SCORE_MAX-20;
}
}
}
/* so we'll have more luck on extension... */
if (av_match_ext(p->filename, "nsv"))
return AVPROBE_SCORE_EXTENSION;
/* FIXME: add mime-type check */
return score;
}
| 17,653 |
176,738 | 0 | status_t Parcel::readByteVector(std::vector<uint8_t>* val) const {
return readByteVectorInternal(this, val);
}
| 17,654 |
62,566 | 0 | frf15_print(netdissect_options *ndo,
const u_char *p, u_int length)
{
uint16_t sequence_num, flags;
if (length < 2)
goto trunc;
ND_TCHECK2(*p, 2);
flags = p[0]&MFR_BEC_MASK;
sequence_num = (p[0]&0x1e)<<7 | p[1];
ND_PRINT((ndo, "FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
sequence_num,
bittok2str(frf_flag_values,"none",flags),
p[0]&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
length));
/* TODO:
* depending on all permutations of the B, E and C bit
* dig as deep as we can - e.g. on the first (B) fragment
* there is enough payload to print the IP header
* on non (B) fragments it depends if the fragmentation
* model is end-to-end or interface based wether we want to print
* another Q.922 header
*/
return;
trunc:
ND_PRINT((ndo, "[|frf.15]"));
}
| 17,655 |
131,548 | 0 | static void overloadedMethodG2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (UNLIKELY(info.Length() < 1)) {
throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodG", "TestObjectPython", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
return;
}
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strictTypeCheckingStringArg, info[0]);
imp->overloadedMethodG(strictTypeCheckingStringArg);
}
| 17,656 |
16,473 | 0 | is_myproxy_file( const char *name )
{
int cluster, proc;
int rc = sscanf( name, "mpp.%d.%d", &cluster, &proc );
if ( rc != 2 ) {
return FALSE;
}
return proc_exists( cluster, proc );
}
| 17,657 |
182,292 | 1 | static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data)
{
struct Context *ctx = (struct Context *) data;
if (!ctx)
return -1;
struct PopData *pop_data = (struct PopData *) ctx->data;
if (!pop_data)
return -1;
#ifdef USE_HCACHE
/* keep hcache file if hcache == bcache */
if (strcmp(HC_FNAME "." HC_FEXT, id) == 0)
return 0;
#endif
for (int i = 0; i < ctx->msgcount; i++)
{
/* if the id we get is known for a header: done (i.e. keep in cache) */
if (ctx->hdrs[i]->data && (mutt_str_strcmp(ctx->hdrs[i]->data, id) == 0))
return 0;
}
/* message not found in context -> remove it from cache
* return the result of bcache, so we stop upon its first error
*/
return mutt_bcache_del(bcache, id);
}
| 17,658 |
22,508 | 0 | asmlinkage void __sched notrace preempt_schedule(void)
{
struct thread_info *ti = current_thread_info();
/*
* If there is a non-zero preempt_count or interrupts are disabled,
* we do not want to preempt the current task. Just return..
*/
if (likely(ti->preempt_count || irqs_disabled()))
return;
do {
add_preempt_count_notrace(PREEMPT_ACTIVE);
schedule();
sub_preempt_count_notrace(PREEMPT_ACTIVE);
/*
* Check again in case we missed a preemption opportunity
* between schedule and now.
*/
barrier();
} while (need_resched());
}
| 17,659 |
16,176 | 0 | int GahpClient::ec2_vm_start( const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * ami_id,
const char * keypair,
const char * user_data,
const char * user_data_file,
const char * instance_type,
const char * availability_zone,
const char * vpc_subnet,
const char * vpc_ip,
StringList & groupnames,
char * &instance_id,
char * &error_code)
{
static const char* command = "EC2_VM_START";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (ami_id == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !keypair ) keypair = NULLSTRING;
if ( !user_data ) user_data = NULLSTRING;
if ( !user_data_file ) user_data_file = NULLSTRING;
if ( !instance_type ) instance_type = NULLSTRING;
if ( !availability_zone || 0==strlen(availability_zone) ) availability_zone = NULLSTRING;
if ( !vpc_subnet || 0==strlen(vpc_subnet) ) vpc_subnet = NULLSTRING;
if ( !vpc_ip || 0==strlen(vpc_ip) ) vpc_ip = NULLSTRING;
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(ami_id) );
char* esc5 = strdup( escapeGahpString(keypair) );
char* esc6 = strdup( escapeGahpString(user_data) );
char* esc7 = strdup( escapeGahpString(user_data_file) );
char* esc8 = strdup( escapeGahpString(instance_type) );
char* esc9 = strdup( escapeGahpString(availability_zone) );
char* esc10 = strdup( escapeGahpString(vpc_subnet) );
char* esc11 = strdup( escapeGahpString(vpc_ip) );
int x = sprintf(reqline, "%s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
free( esc7 );
free( esc8 );
free( esc9 );
free( esc10 );
free( esc11 );
ASSERT( x > 0 );
const char * group_name;
int cnt = 0;
char * esc_groupname;
groupnames.rewind();
if ( groupnames.number() > 0 ) {
while ( (group_name = groupnames.next()) ) {
esc_groupname = strdup( escapeGahpString(group_name) );
sprintf_cat(reqline, " %s", esc_groupname);
cnt++;
free( esc_groupname );
}
}
ASSERT( cnt == groupnames.number() );
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 rc = 0;
if ( result->argc == 2 ) {
rc = atoi(result->argv[1]);
if ( rc == 0 ) {
EXCEPT( "Bad %s result", command );
rc = 1;
} else {
error_string = "";
}
} else if ( result->argc == 3 ) {
rc = atoi(result->argv[1]);
instance_id = strdup(result->argv[2]);
} else if ( result->argc == 4 ) {
rc = atoi( result->argv[1] );
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| 17,660 |
1,178 | 0 | int getDataSize() { return h * line; }
| 17,661 |
161,216 | 0 | static bool SniffForInvalidOfficeDocs(const char* content,
size_t size,
const GURL& url,
std::string* result) {
if (!TruncateSize(kBytesRequiredForOfficeMagic, &size))
return false;
std::string office_version;
if (!CheckForMagicNumbers(content, size, kOfficeMagicNumbers,
arraysize(kOfficeMagicNumbers), &office_version)) {
*result = "application/octet-stream";
}
return true;
}
| 17,662 |
65,492 | 0 | static bool is_session_dead(struct nfsd4_session *ses)
{
return ses->se_flags & NFS4_SESSION_DEAD;
}
| 17,663 |
23,320 | 0 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res)
{
int status;
status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE);
if (status != -EIO)
nfs_increment_open_seqid(status, res->seqid);
if (!status)
status = decode_stateid(xdr, &res->stateid);
return status;
}
| 17,664 |
158,411 | 0 | size_t GetAndResetProcessedTouchEventCount() {
size_t count = processed_touch_event_count_;
processed_touch_event_count_ = 0;
return count;
}
| 17,665 |
58,693 | 0 | static ssize_t snd_compr_read(struct file *f, char __user *buf,
size_t count, loff_t *offset)
{
return -ENXIO;
}
| 17,666 |
15,669 | 0 | static void IRQ_check(OpenPICState *opp, IRQQueue *q)
{
int irq = -1;
int next = -1;
int priority = -1;
for (;;) {
irq = find_next_bit(q->queue, opp->max_irq, irq + 1);
if (irq == opp->max_irq) {
break;
}
DPRINTF("IRQ_check: irq %d set ivpr_pr=%d pr=%d\n",
irq, IVPR_PRIORITY(opp->src[irq].ivpr), priority);
if (IVPR_PRIORITY(opp->src[irq].ivpr) > priority) {
next = irq;
priority = IVPR_PRIORITY(opp->src[irq].ivpr);
}
}
q->next = next;
q->priority = priority;
}
| 17,667 |
186,120 | 1 | FrameImpl::FrameImpl(std::unique_ptr<content::WebContents> web_contents,
chromium::web::FrameObserverPtr observer)
: web_contents_(std::move(web_contents)), observer_(std::move(observer)) {
Observe(web_contents.get());
}
| 17,668 |
95 | 0 | int ssl3_renegotiate(SSL *s)
{
if (s->handshake_func == NULL)
return(1);
if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
return(0);
s->s3->renegotiate=1;
return(1);
}
| 17,669 |
71,139 | 0 | int readlink_malloc(const char *p, char **ret) {
return readlinkat_malloc(AT_FDCWD, p, ret);
}
| 17,670 |
15,182 | 0 | PHP_RSHUTDOWN_FUNCTION(gd)
{
#if HAVE_GD_FONTCACHESHUTDOWN
gdFontCacheShutdown();
#else
gdFreeFontCache();
#endif
return SUCCESS;
}
| 17,671 |
40,149 | 0 | static inline int ieee802154_match_sock(u8 *hw_addr, u16 pan_id,
u16 short_addr, struct dgram_sock *ro)
{
if (!ro->bound)
return 1;
if (ro->src_addr.addr_type == IEEE802154_ADDR_LONG &&
!memcmp(ro->src_addr.hwaddr, hw_addr, IEEE802154_ADDR_LEN))
return 1;
if (ro->src_addr.addr_type == IEEE802154_ADDR_SHORT &&
pan_id == ro->src_addr.pan_id &&
short_addr == ro->src_addr.short_addr)
return 1;
return 0;
}
| 17,672 |
144,744 | 0 | SiteFeatureUsage LocalSiteCharacteristicsDataImpl::UsesAudioInBackground()
const {
return GetFeatureUsage(
site_characteristics_.uses_audio_in_background(),
GetSiteCharacteristicsDatabaseParams().audio_usage_observation_window);
}
| 17,673 |
55,826 | 0 | static int show_tid_smap(struct seq_file *m, void *v)
{
return show_smap(m, v, 0);
}
| 17,674 |
115,382 | 0 | uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didExceedDatabaseQuota(origin, databaseName, databaseDisplayName, currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes);
}
| 17,675 |
51,345 | 0 | static void spl_filesystem_file_free_line(spl_filesystem_object *intern TSRMLS_DC) /* {{{ */
{
if (intern->u.file.current_line) {
efree(intern->u.file.current_line);
intern->u.file.current_line = NULL;
}
if (intern->u.file.current_zval) {
zval_ptr_dtor(&intern->u.file.current_zval);
intern->u.file.current_zval = NULL;
}
} /* }}} */
| 17,676 |
46,476 | 0 | gss_krb5int_free_lucid_sec_context(
OM_uint32 *minor_status,
const gss_OID desired_mech,
const gss_OID desired_object,
gss_buffer_t value)
{
OM_uint32 retval;
krb5_error_code kret = 0;
int version;
void *kctx;
/* Assume failure */
retval = GSS_S_FAILURE;
*minor_status = 0;
kctx = value->value;
if (!kctx) {
kret = EINVAL;
goto error_out;
}
/* Determine version and call correct free routine */
version = ((gss_krb5_lucid_context_version_t *)kctx)->version;
switch (version) {
case 1:
free_external_lucid_ctx_v1((gss_krb5_lucid_context_v1_t*) kctx);
break;
default:
kret = EINVAL;
break;
}
if (kret)
goto error_out;
/* Success! */
*minor_status = 0;
retval = GSS_S_COMPLETE;
return (retval);
error_out:
if (*minor_status == 0)
*minor_status = (OM_uint32) kret;
return(retval);
}
| 17,677 |
167,511 | 0 | bool WebMediaPlayerImpl::CopyVideoTextureToPlatformTexture(
gpu::gles2::GLES2Interface* gl,
unsigned int target,
unsigned int texture,
unsigned internal_format,
unsigned format,
unsigned type,
int level,
bool premultiply_alpha,
bool flip_y,
int already_uploaded_id,
VideoFrameUploadMetadata* out_metadata) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
if (cdm_context_ref_)
return false;
scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
if (!video_frame.get() || !video_frame->HasTextures()) {
return false;
}
if (out_metadata) {
ComputeFrameUploadMetadata(video_frame.get(), already_uploaded_id,
out_metadata);
if (out_metadata->skipped) {
return true;
}
}
Context3D context_3d;
if (context_provider_) {
context_3d = Context3D(context_provider_->ContextGL(),
context_provider_->GrContext());
}
return video_renderer_.CopyVideoFrameTexturesToGLTexture(
context_3d, gl, video_frame.get(), target, texture, internal_format,
format, type, level, premultiply_alpha, flip_y);
}
| 17,678 |
25,942 | 0 | static bool low_pfn(unsigned long pfn)
{
return pfn < max_low_pfn;
}
| 17,679 |
10,849 | 0 | void DeviceServiceAction::setService(const KServiceAction& service)
{
DeviceAction::setIconName(service.icon());
DeviceAction::setLabel(service.text());
m_service = service;
}
| 17,680 |
177,131 | 0 | void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
IV_STATUS_T status;
WORD32 timeDelay, timeTaken;
UNUSED(portIndex);
if (mCodecCtx == NULL) {
if (OMX_ErrorNone != initEncoder()) {
ALOGE("Failed to initialize encoder");
notify(OMX_EventError, OMX_ErrorUndefined, 0 /* arg2 */, NULL /* data */);
return;
}
}
if (mSignalledError) {
return;
}
List<BufferInfo *> &inQueue = getPortQueue(0);
List<BufferInfo *> &outQueue = getPortQueue(1);
while (!mSawOutputEOS && !outQueue.empty()) {
OMX_ERRORTYPE error;
ive_video_encode_ip_t s_encode_ip;
ive_video_encode_op_t s_encode_op;
BufferInfo *outputBufferInfo = *outQueue.begin();
OMX_BUFFERHEADERTYPE *outputBufferHeader = outputBufferInfo->mHeader;
BufferInfo *inputBufferInfo;
OMX_BUFFERHEADERTYPE *inputBufferHeader;
if (mSawInputEOS) {
inputBufferHeader = NULL;
inputBufferInfo = NULL;
} else if (!inQueue.empty()) {
inputBufferInfo = *inQueue.begin();
inputBufferHeader = inputBufferInfo->mHeader;
} else {
return;
}
outputBufferHeader->nTimeStamp = 0;
outputBufferHeader->nFlags = 0;
outputBufferHeader->nOffset = 0;
outputBufferHeader->nFilledLen = 0;
outputBufferHeader->nOffset = 0;
if (inputBufferHeader != NULL) {
outputBufferHeader->nFlags = inputBufferHeader->nFlags;
}
uint8_t *outPtr = (uint8_t *)outputBufferHeader->pBuffer;
if (!mSpsPpsHeaderReceived) {
error = setEncodeArgs(&s_encode_ip, &s_encode_op, NULL, outputBufferHeader);
if (error != OMX_ErrorNone) {
mSignalledError = true;
notify(OMX_EventError, OMX_ErrorUndefined, 0, 0);
return;
}
status = ive_api_function(mCodecCtx, &s_encode_ip, &s_encode_op);
if (IV_SUCCESS != status) {
ALOGE("Encode Frame failed = 0x%x\n",
s_encode_op.u4_error_code);
} else {
ALOGV("Bytes Generated in header %d\n",
s_encode_op.s_out_buf.u4_bytes);
}
mSpsPpsHeaderReceived = true;
outputBufferHeader->nFlags = OMX_BUFFERFLAG_CODECCONFIG;
outputBufferHeader->nFilledLen = s_encode_op.s_out_buf.u4_bytes;
if (inputBufferHeader != NULL) {
outputBufferHeader->nTimeStamp = inputBufferHeader->nTimeStamp;
}
outQueue.erase(outQueue.begin());
outputBufferInfo->mOwnedByUs = false;
DUMP_TO_FILE(
mOutFile, outputBufferHeader->pBuffer,
outputBufferHeader->nFilledLen);
notifyFillBufferDone(outputBufferHeader);
setEncMode(IVE_ENC_MODE_PICTURE);
return;
}
if (mBitrateUpdated) {
setBitRate();
}
if (mKeyFrameRequested) {
setFrameType(IV_IDR_FRAME);
}
if ((inputBufferHeader != NULL)
&& (inputBufferHeader->nFlags & OMX_BUFFERFLAG_EOS)) {
mSawInputEOS = true;
}
/* In normal mode, store inputBufferInfo and this will be returned
when encoder consumes this input */
if (!mInputDataIsMeta && (inputBufferInfo != NULL)) {
for (size_t i = 0; i < MAX_INPUT_BUFFER_HEADERS; i++) {
if (NULL == mInputBufferInfo[i]) {
mInputBufferInfo[i] = inputBufferInfo;
break;
}
}
}
error = setEncodeArgs(
&s_encode_ip, &s_encode_op, inputBufferHeader, outputBufferHeader);
if (error != OMX_ErrorNone) {
mSignalledError = true;
notify(OMX_EventError, OMX_ErrorUndefined, 0, 0);
return;
}
DUMP_TO_FILE(
mInFile, s_encode_ip.s_inp_buf.apv_bufs[0],
(mHeight * mStride * 3 / 2));
GETTIME(&mTimeStart, NULL);
/* Compute time elapsed between end of previous decode()
* to start of current decode() */
TIME_DIFF(mTimeEnd, mTimeStart, timeDelay);
status = ive_api_function(mCodecCtx, &s_encode_ip, &s_encode_op);
if (IV_SUCCESS != status) {
ALOGE("Encode Frame failed = 0x%x\n",
s_encode_op.u4_error_code);
mSignalledError = true;
notify(OMX_EventError, OMX_ErrorUndefined, 0, 0);
return;
}
GETTIME(&mTimeEnd, NULL);
/* Compute time taken for decode() */
TIME_DIFF(mTimeStart, mTimeEnd, timeTaken);
ALOGV("timeTaken=%6d delay=%6d numBytes=%6d", timeTaken, timeDelay,
s_encode_op.s_out_buf.u4_bytes);
/* In encoder frees up an input buffer, mark it as free */
if (s_encode_op.s_inp_buf.apv_bufs[0] != NULL) {
if (mInputDataIsMeta) {
for (size_t i = 0; i < MAX_CONVERSION_BUFFERS; i++) {
if (mConversionBuffers[i] == s_encode_op.s_inp_buf.apv_bufs[0]) {
mConversionBuffersFree[i] = 1;
break;
}
}
} else {
/* In normal mode, call EBD on inBuffeHeader that is freed by the codec */
for (size_t i = 0; i < MAX_INPUT_BUFFER_HEADERS; i++) {
uint8_t *buf = NULL;
OMX_BUFFERHEADERTYPE *bufHdr = NULL;
if (mInputBufferInfo[i] != NULL) {
bufHdr = mInputBufferInfo[i]->mHeader;
buf = bufHdr->pBuffer + bufHdr->nOffset;
}
if (s_encode_op.s_inp_buf.apv_bufs[0] == buf) {
mInputBufferInfo[i]->mOwnedByUs = false;
notifyEmptyBufferDone(bufHdr);
mInputBufferInfo[i] = NULL;
break;
}
}
}
}
outputBufferHeader->nFilledLen = s_encode_op.s_out_buf.u4_bytes;
if (IV_IDR_FRAME == s_encode_op.u4_encoded_frame_type) {
outputBufferHeader->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
}
if (inputBufferHeader != NULL) {
inQueue.erase(inQueue.begin());
/* If in meta data, call EBD on input */
/* In case of normal mode, EBD will be done once encoder
releases the input buffer */
if (mInputDataIsMeta) {
inputBufferInfo->mOwnedByUs = false;
notifyEmptyBufferDone(inputBufferHeader);
}
}
if (s_encode_op.u4_is_last) {
outputBufferHeader->nFlags |= OMX_BUFFERFLAG_EOS;
mSawOutputEOS = true;
} else {
outputBufferHeader->nFlags &= ~OMX_BUFFERFLAG_EOS;
}
if (outputBufferHeader->nFilledLen || s_encode_op.u4_is_last) {
outputBufferHeader->nTimeStamp = s_encode_op.u4_timestamp_high;
outputBufferHeader->nTimeStamp <<= 32;
outputBufferHeader->nTimeStamp |= s_encode_op.u4_timestamp_low;
outputBufferInfo->mOwnedByUs = false;
outQueue.erase(outQueue.begin());
DUMP_TO_FILE(mOutFile, outputBufferHeader->pBuffer,
outputBufferHeader->nFilledLen);
notifyFillBufferDone(outputBufferHeader);
}
if (s_encode_op.u4_is_last == 1) {
return;
}
}
return;
}
| 17,681 |
134,827 | 0 | explicit CompositingRenderWidgetHostViewBrowserTest()
: compositing_mode_(GetParam()) {}
| 17,682 |
1,607 | 0 | aspath_str2aspath (const char *str)
{
enum as_token token = as_token_unknown;
u_short as_type;
u_long asno = 0;
struct aspath *aspath;
int needtype;
aspath = aspath_new ();
/* We start default type as AS_SEQUENCE. */
as_type = AS_SEQUENCE;
needtype = 1;
while ((str = aspath_gettoken (str, &token, &asno)) != NULL)
{
switch (token)
{
case as_token_asval:
if (needtype)
{
aspath_segment_add (aspath, as_type);
needtype = 0;
}
aspath_as_add (aspath, asno);
break;
case as_token_set_start:
as_type = AS_SET;
aspath_segment_add (aspath, as_type);
needtype = 0;
break;
case as_token_set_end:
as_type = AS_SEQUENCE;
needtype = 1;
break;
case as_token_confed_seq_start:
as_type = AS_CONFED_SEQUENCE;
aspath_segment_add (aspath, as_type);
needtype = 0;
break;
case as_token_confed_seq_end:
as_type = AS_SEQUENCE;
needtype = 1;
break;
case as_token_confed_set_start:
as_type = AS_CONFED_SET;
aspath_segment_add (aspath, as_type);
needtype = 0;
break;
case as_token_confed_set_end:
as_type = AS_SEQUENCE;
needtype = 1;
break;
case as_token_unknown:
default:
aspath_free (aspath);
return NULL;
}
}
aspath_make_str_count (aspath);
return aspath;
}
| 17,683 |
30,010 | 0 | void br_multicast_disable_port(struct net_bridge_port *port)
{
struct net_bridge *br = port->br;
struct net_bridge_port_group *pg;
struct hlist_node *n;
spin_lock(&br->multicast_lock);
hlist_for_each_entry_safe(pg, n, &port->mglist, mglist)
br_multicast_del_pg(br, pg);
if (!hlist_unhashed(&port->rlist))
hlist_del_init_rcu(&port->rlist);
del_timer(&port->multicast_router_timer);
del_timer(&port->multicast_query_timer);
spin_unlock(&br->multicast_lock);
}
| 17,684 |
170,159 | 0 | bool PasswordAutofillAgent::PreviewSuggestion(
const blink::WebFormControlElement& control_element,
const blink::WebString& username,
const blink::WebString& password) {
const blink::WebInputElement* element = toWebInputElement(&control_element);
if (!element)
return false;
blink::WebInputElement username_element;
blink::WebInputElement password_element;
PasswordInfo* password_info;
if (!FindPasswordInfoForElement(*element, &username_element,
&password_element, &password_info) ||
(!username_element.isNull() &&
!IsElementAutocompletable(username_element)) ||
!IsElementAutocompletable(password_element)) {
return false;
}
if (!element->isPasswordField() && !username_element.isNull()) {
if (username_query_prefix_.empty())
username_query_prefix_ = username_element.value();
was_username_autofilled_ = username_element.isAutofilled();
username_element.setSuggestedValue(username);
username_element.setAutofilled(true);
form_util::PreviewSuggestion(username_element.suggestedValue(),
username_query_prefix_, &username_element);
}
was_password_autofilled_ = password_element.isAutofilled();
password_element.setSuggestedValue(password);
password_element.setAutofilled(true);
return true;
}
| 17,685 |
188,228 | 1 | OMX_ERRORTYPE SoftG711::internalSetParameter(
OMX_INDEXTYPE index, const OMX_PTR params) {
switch (index) {
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
(OMX_AUDIO_PARAM_PCMMODETYPE *)params;
if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {
return OMX_ErrorUndefined;
}
if (pcmParams->nChannels < 1 || pcmParams->nChannels > 2) {
return OMX_ErrorUndefined;
}
if(pcmParams->nPortIndex == 0) {
mNumChannels = pcmParams->nChannels;
}
mSamplingRate = pcmParams->nSamplingRate;
return OMX_ErrorNone;
}
case OMX_IndexParamStandardComponentRole:
{
const OMX_PARAM_COMPONENTROLETYPE *roleParams =
(const OMX_PARAM_COMPONENTROLETYPE *)params;
if (mIsMLaw) {
if (strncmp((const char *)roleParams->cRole,
"audio_decoder.g711mlaw",
OMX_MAX_STRINGNAME_SIZE - 1)) {
return OMX_ErrorUndefined;
}
} else {
if (strncmp((const char *)roleParams->cRole,
"audio_decoder.g711alaw",
OMX_MAX_STRINGNAME_SIZE - 1)) {
return OMX_ErrorUndefined;
}
}
return OMX_ErrorNone;
}
default:
return SimpleSoftOMXComponent::internalSetParameter(index, params);
}
}
| 17,686 |
91,314 | 0 | static void redo_bmc_reg(struct work_struct *work)
{
struct ipmi_smi *intf = container_of(work, struct ipmi_smi,
bmc_reg_work);
if (!intf->in_shutdown)
bmc_get_device_id(intf, NULL, NULL, NULL, NULL);
kref_put(&intf->refcount, intf_free);
}
| 17,687 |
120,744 | 0 | void BaseMultipleFieldsDateAndTimeInputType::stepAttributeChanged()
{
updateInnerTextValue();
}
| 17,688 |
115,966 | 0 | Eina_Bool ewk_frame_text_search(const Evas_Object* ewkFrame, const char* text, Eina_Bool caseSensitive, Eina_Bool forward, Eina_Bool wrap)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
return smartData->frame->editor()->findString(WTF::String::fromUTF8(text), forward, caseSensitive, wrap, true);
}
| 17,689 |
144,711 | 0 | WebContentsImpl::WebContentsTreeNode::WebContentsTreeNode()
: outer_web_contents_(nullptr),
outer_contents_frame_tree_node_id_(
FrameTreeNode::kFrameTreeNodeInvalidId) {
}
| 17,690 |
91,173 | 0 | static int stringnicmp(const char *p,const char *q,size_t n)
{
register ssize_t
i,
j;
if (p == q)
return(0);
if (p == (char *) NULL)
return(-1);
if (q == (char *) NULL)
return(1);
while ((*p != '\0') && (*q != '\0'))
{
if ((*p == '\0') || (*q == '\0'))
break;
i=(*p);
if (islower(i))
i=toupper(i);
j=(*q);
if (islower(j))
j=toupper(j);
if (i != j)
break;
n--;
if (n == 0)
break;
p++;
q++;
}
return(toupper((int) *p)-toupper((int) *q));
}
| 17,691 |
56,653 | 0 | static int ext4_check_descriptors(struct super_block *sb,
ext4_group_t *first_not_zeroed)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
ext4_fsblk_t last_block;
ext4_fsblk_t block_bitmap;
ext4_fsblk_t inode_bitmap;
ext4_fsblk_t inode_table;
int flexbg_flag = 0;
ext4_group_t i, grp = sbi->s_groups_count;
if (ext4_has_feature_flex_bg(sb))
flexbg_flag = 1;
ext4_debug("Checking group descriptors");
for (i = 0; i < sbi->s_groups_count; i++) {
struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL);
if (i == sbi->s_groups_count - 1 || flexbg_flag)
last_block = ext4_blocks_count(sbi->s_es) - 1;
else
last_block = first_block +
(EXT4_BLOCKS_PER_GROUP(sb) - 1);
if ((grp == sbi->s_groups_count) &&
!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)))
grp = i;
block_bitmap = ext4_block_bitmap(sb, gdp);
if (block_bitmap < first_block || block_bitmap > last_block) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Block bitmap for group %u not in group "
"(block %llu)!", i, block_bitmap);
return 0;
}
inode_bitmap = ext4_inode_bitmap(sb, gdp);
if (inode_bitmap < first_block || inode_bitmap > last_block) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Inode bitmap for group %u not in group "
"(block %llu)!", i, inode_bitmap);
return 0;
}
inode_table = ext4_inode_table(sb, gdp);
if (inode_table < first_block ||
inode_table + sbi->s_itb_per_group - 1 > last_block) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Inode table for group %u not in group "
"(block %llu)!", i, inode_table);
return 0;
}
ext4_lock_group(sb, i);
if (!ext4_group_desc_csum_verify(sb, i, gdp)) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Checksum for group %u failed (%u!=%u)",
i, le16_to_cpu(ext4_group_desc_csum(sb, i,
gdp)), le16_to_cpu(gdp->bg_checksum));
if (!(sb->s_flags & MS_RDONLY)) {
ext4_unlock_group(sb, i);
return 0;
}
}
ext4_unlock_group(sb, i);
if (!flexbg_flag)
first_block += EXT4_BLOCKS_PER_GROUP(sb);
}
if (NULL != first_not_zeroed)
*first_not_zeroed = grp;
return 1;
}
| 17,692 |
39,243 | 0 | void php_gd_error_method(int type, const char *format, va_list args)
{
TSRMLS_FETCH();
php_verror(NULL, "", type, format, args TSRMLS_CC);
}
| 17,693 |
87,976 | 0 | static int pcd_probe(struct pcd_unit *cd, int ms, char *id)
{
if (ms == -1) {
for (cd->drive = 0; cd->drive <= 1; cd->drive++)
if (!pcd_reset(cd) && !pcd_identify(cd, id))
return 0;
} else {
cd->drive = ms;
if (!pcd_reset(cd) && !pcd_identify(cd, id))
return 0;
}
return -1;
}
| 17,694 |
73,147 | 0 | buf_free(buf_t *buf)
{
if (!buf)
return;
buf_clear(buf);
buf->magic = 0xdeadbeef;
tor_free(buf);
}
| 17,695 |
124,828 | 0 | LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const
{
if (height.isIntrinsic()) {
if (intrinsicContentHeight == -1)
return -1; // Intrinsic height isn't available.
return computeIntrinsicLogicalContentHeightUsing(height, intrinsicContentHeight, borderAndPaddingLogicalHeight());
}
if (height.isFixed())
return height.value();
if (height.isPercent())
return computePercentageLogicalHeight(height);
return -1;
}
| 17,696 |
61,029 | 0 | create_task_done (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
CreateJob *job;
job = user_data;
if (job->done_callback)
{
job->done_callback (job->created_file,
!job_aborted ((CommonJob *) job),
job->done_callback_data);
}
g_object_unref (job->dest_dir);
if (job->src)
{
g_object_unref (job->src);
}
g_free (job->src_data);
g_free (job->filename);
if (job->created_file)
{
g_object_unref (job->created_file);
}
finalize_common ((CommonJob *) job);
nautilus_file_changes_consume_changes (TRUE);
}
| 17,697 |
22,320 | 0 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, void *key)
{
unsigned long flags;
int wake_flags = WF_SYNC;
if (unlikely(!q))
return;
if (unlikely(!nr_exclusive))
wake_flags = 0;
spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive, wake_flags, key);
spin_unlock_irqrestore(&q->lock, flags);
}
| 17,698 |
54,015 | 0 | static void ims_pcu_irq(struct urb *urb)
{
struct ims_pcu *pcu = urb->context;
int retval, status;
status = urb->status;
switch (status) {
case 0:
/* success */
break;
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dev_dbg(pcu->dev, "%s - urb shutting down with status: %d\n",
__func__, status);
return;
default:
dev_dbg(pcu->dev, "%s - nonzero urb status received: %d\n",
__func__, status);
goto exit;
}
dev_dbg(pcu->dev, "%s: received %d: %*ph\n", __func__,
urb->actual_length, urb->actual_length, pcu->urb_in_buf);
if (urb == pcu->urb_in)
ims_pcu_process_data(pcu, urb);
exit:
retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval && retval != -ENODEV)
dev_err(pcu->dev, "%s - usb_submit_urb failed with result %d\n",
__func__, retval);
}
| 17,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.