unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
187,788 | 1 | status_t SampleIterator::seekTo(uint32_t sampleIndex) {
ALOGV("seekTo(%d)", sampleIndex);
if (sampleIndex >= mTable->mNumSampleSizes) {
return ERROR_END_OF_STREAM;
}
if (mTable->mSampleToChunkOffset < 0
|| mTable->mChunkOffsetOffset < 0
|| mTable->mSampleSizeOffset < 0
|| mTable->mTimeToSampleCount == 0) {
return ERROR_MALFORMED;
}
if (mInitialized && mCurrentSampleIndex == sampleIndex) {
return OK;
}
if (!mInitialized || sampleIndex < mFirstChunkSampleIndex) {
reset();
}
if (sampleIndex >= mStopChunkSampleIndex) {
status_t err;
if ((err = findChunkRange(sampleIndex)) != OK) {
ALOGE("findChunkRange failed");
return err;
}
}
CHECK(sampleIndex < mStopChunkSampleIndex);
uint32_t chunk =
(sampleIndex - mFirstChunkSampleIndex) / mSamplesPerChunk
+ mFirstChunk;
if (!mInitialized || chunk != mCurrentChunkIndex) {
mCurrentChunkIndex = chunk;
status_t err;
if ((err = getChunkOffset(chunk, &mCurrentChunkOffset)) != OK) {
ALOGE("getChunkOffset return error");
return err;
}
mCurrentChunkSampleSizes.clear();
uint32_t firstChunkSampleIndex =
mFirstChunkSampleIndex
+ mSamplesPerChunk * (mCurrentChunkIndex - mFirstChunk);
for (uint32_t i = 0; i < mSamplesPerChunk; ++i) {
size_t sampleSize;
if ((err = getSampleSizeDirect(
firstChunkSampleIndex + i, &sampleSize)) != OK) {
ALOGE("getSampleSizeDirect return error");
return err;
}
mCurrentChunkSampleSizes.push(sampleSize);
}
}
uint32_t chunkRelativeSampleIndex =
(sampleIndex - mFirstChunkSampleIndex) % mSamplesPerChunk;
mCurrentSampleOffset = mCurrentChunkOffset;
for (uint32_t i = 0; i < chunkRelativeSampleIndex; ++i) {
mCurrentSampleOffset += mCurrentChunkSampleSizes[i];
}
mCurrentSampleSize = mCurrentChunkSampleSizes[chunkRelativeSampleIndex];
if (sampleIndex < mTTSSampleIndex) {
mTimeToSampleIndex = 0;
mTTSSampleIndex = 0;
mTTSSampleTime = 0;
mTTSCount = 0;
mTTSDuration = 0;
}
status_t err;
if ((err = findSampleTimeAndDuration(
sampleIndex, &mCurrentSampleTime, &mCurrentSampleDuration)) != OK) {
ALOGE("findSampleTime return error");
return err;
}
mCurrentSampleIndex = sampleIndex;
mInitialized = true;
return OK;
}
| 6,800 |
143,753 | 0 | void RunTests(const std::string& extension_dirname) {
ExtensionTestMessageListener listener("PASS", true);
LaunchTestingApp(extension_dirname);
EXPECT_TRUE(listener.WaitUntilSatisfied());
}
| 6,801 |
74,790 | 0 | static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
{
MpegEncContext *s = &ctx->m;
int width, height;
int bits_per_raw_sample;
skip_bits(gb, 4); /* video_object_layer_verid */
ctx->shape = get_bits(gb, 2); /* video_object_layer_shape */
skip_bits(gb, 4); /* video_object_layer_shape_extension */
skip_bits1(gb); /* progressive_sequence */
if (ctx->shape != BIN_ONLY_SHAPE) {
ctx->rgb = get_bits1(gb); /* rgb_components */
s->chroma_format = get_bits(gb, 2); /* chroma_format */
if (!s->chroma_format) {
av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n");
return AVERROR_INVALIDDATA;
}
bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */
if (bits_per_raw_sample == 10) {
if (ctx->rgb) {
s->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
}
else {
s->avctx->pix_fmt = s->chroma_format == CHROMA_422 ? AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV444P10;
}
}
else {
avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", bits_per_raw_sample);
return AVERROR_PATCHWELCOME;
}
s->avctx->bits_per_raw_sample = bits_per_raw_sample;
}
if (ctx->shape == RECT_SHAPE) {
check_marker(s->avctx, gb, "before video_object_layer_width");
width = get_bits(gb, 14); /* video_object_layer_width */
check_marker(s->avctx, gb, "before video_object_layer_height");
height = get_bits(gb, 14); /* video_object_layer_height */
check_marker(s->avctx, gb, "after video_object_layer_height");
/* Do the same check as non-studio profile */
if (width && height) {
if (s->width && s->height &&
(s->width != width || s->height != height))
s->context_reinit = 1;
s->width = width;
s->height = height;
}
}
s->aspect_ratio_info = get_bits(gb, 4);
if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
s->avctx->sample_aspect_ratio.num = get_bits(gb, 8); // par_width
s->avctx->sample_aspect_ratio.den = get_bits(gb, 8); // par_height
} else {
s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[s->aspect_ratio_info];
}
skip_bits(gb, 4); /* frame_rate_code */
skip_bits(gb, 15); /* first_half_bit_rate */
check_marker(s->avctx, gb, "after first_half_bit_rate");
skip_bits(gb, 15); /* latter_half_bit_rate */
check_marker(s->avctx, gb, "after latter_half_bit_rate");
skip_bits(gb, 15); /* first_half_vbv_buffer_size */
check_marker(s->avctx, gb, "after first_half_vbv_buffer_size");
skip_bits(gb, 3); /* latter_half_vbv_buffer_size */
skip_bits(gb, 11); /* first_half_vbv_buffer_size */
check_marker(s->avctx, gb, "after first_half_vbv_buffer_size");
skip_bits(gb, 15); /* latter_half_vbv_occupancy */
check_marker(s->avctx, gb, "after latter_half_vbv_occupancy");
s->low_delay = get_bits1(gb);
s->mpeg_quant = get_bits1(gb); /* mpeg2_stream */
next_start_code_studio(gb);
extension_and_user_data(s, gb, 2);
return 0;
}
| 6,802 |
115,781 | 0 | virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) {
if (badurls[gurl.spec()] == SAFE)
return true;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&FakeSafeBrowsingService::OnCheckBrowseURLDone,
this, gurl, client));
return false;
}
| 6,803 |
57,656 | 0 | store_tabletStylusLower(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct aiptek *aiptek = dev_get_drvdata(dev);
int new_button = map_str_to_val(stylus_button_map, buf, count);
if (new_button == AIPTEK_INVALID_VALUE)
return -EINVAL;
aiptek->newSetting.stylusButtonLower = new_button;
return count;
}
| 6,804 |
120,341 | 0 | explicit ScopedGestureRecognizerSetter(ui::GestureRecognizer* new_gr)
: new_gr_(new_gr) {
original_gr_ = ui::GestureRecognizer::Get();
ui::SetGestureRecognizerForTesting(new_gr_.get());
}
| 6,805 |
120,340 | 0 | void Reset() {
touch_released_count_ = 0;
touch_pressed_count_ = 0;
touch_moved_count_ = 0;
touch_cancelled_count_ = 0;
}
| 6,806 |
42,499 | 0 | min_sync_store(struct mddev *mddev, const char *buf, size_t len)
{
unsigned long long min;
int err;
if (kstrtoull(buf, 10, &min))
return -EINVAL;
spin_lock(&mddev->lock);
err = -EINVAL;
if (min > mddev->resync_max)
goto out_unlock;
err = -EBUSY;
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
goto out_unlock;
/* Round down to multiple of 4K for safety */
mddev->resync_min = round_down(min, 8);
err = 0;
out_unlock:
spin_unlock(&mddev->lock);
return err ?: len;
}
| 6,807 |
172,351 | 0 | OMX_ERRORTYPE omx_video::get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_STRING paramName,
OMX_OUT OMX_INDEXTYPE* indexType)
{
(void)hComp;
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("ERROR: Get Extension Index in Invalid State");
return OMX_ErrorInvalidState;
}
#ifdef MAX_RES_1080P
if (!strncmp(paramName, "OMX.QCOM.index.param.SliceDeliveryMode",
sizeof("OMX.QCOM.index.param.SliceDeliveryMode") - 1)) {
*indexType = (OMX_INDEXTYPE)OMX_QcomIndexEnableSliceDeliveryMode;
return OMX_ErrorNone;
}
#endif
#ifdef _ANDROID_ICS_
if (!strncmp(paramName, "OMX.google.android.index.storeMetaDataInBuffers",
sizeof("OMX.google.android.index.storeMetaDataInBuffers") - 1)) {
*indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoMetaBufferMode;
return OMX_ErrorNone;
}
#endif
if (!strncmp(paramName, "OMX.google.android.index.prependSPSPPSToIDRFrames",
sizeof("OMX.google.android.index.prependSPSPPSToIDRFrames") - 1)) {
*indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamSequenceHeaderWithIDR;
return OMX_ErrorNone;
}
return OMX_ErrorNotImplemented;
}
| 6,808 |
179,612 | 1 | BOOL license_read_scope_list(wStream* s, SCOPE_LIST* scopeList)
{
UINT32 i;
UINT32 scopeCount;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT32(s, scopeCount); /* ScopeCount (4 bytes) */
scopeList->count = scopeCount;
scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount);
/* ScopeArray */
for (i = 0; i < scopeCount; i++)
{
scopeList->array[i].type = BB_SCOPE_BLOB;
if (!license_read_binary_blob(s, &scopeList->array[i]))
return FALSE;
}
return TRUE;
}
| 6,809 |
162,414 | 0 | MojoResult MojoPlatformHandleToScopedPlatformHandle(
const MojoPlatformHandle* platform_handle,
ScopedPlatformHandle* out_handle) {
if (platform_handle->struct_size != sizeof(MojoPlatformHandle))
return MOJO_RESULT_INVALID_ARGUMENT;
if (platform_handle->type == MOJO_PLATFORM_HANDLE_TYPE_INVALID) {
out_handle->reset();
return MOJO_RESULT_OK;
}
PlatformHandle handle;
switch (platform_handle->type) {
#if defined(OS_FUCHSIA)
case MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE:
handle = PlatformHandle::ForHandle(platform_handle->value);
break;
case MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR:
handle = PlatformHandle::ForFd(platform_handle->value);
break;
#elif defined(OS_POSIX)
case MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR:
handle.handle = static_cast<int>(platform_handle->value);
break;
#endif
#if defined(OS_MACOSX) && !defined(OS_IOS)
case MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT:
handle.type = PlatformHandle::Type::MACH;
handle.port = static_cast<mach_port_t>(platform_handle->value);
break;
#endif
#if defined(OS_WIN)
case MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE:
handle.handle = reinterpret_cast<HANDLE>(platform_handle->value);
break;
#endif
default:
return MOJO_RESULT_INVALID_ARGUMENT;
}
out_handle->reset(handle);
return MOJO_RESULT_OK;
}
| 6,810 |
92,430 | 0 | static int sas_expander_discover(struct domain_device *dev)
{
struct expander_device *ex = &dev->ex_dev;
int res = -ENOMEM;
ex->ex_phy = kcalloc(ex->num_phys, sizeof(*ex->ex_phy), GFP_KERNEL);
if (!ex->ex_phy)
return -ENOMEM;
res = sas_ex_phy_discover(dev, -1);
if (res)
goto out_err;
return 0;
out_err:
kfree(ex->ex_phy);
ex->ex_phy = NULL;
return res;
}
| 6,811 |
28,537 | 0 | static inline int qeth_create_skb_frag(struct qeth_qdio_buffer *qethbuffer,
struct qdio_buffer_element *element,
struct sk_buff **pskb, int offset, int *pfrag, int data_len)
{
struct page *page = virt_to_page(element->addr);
if (*pskb == NULL) {
if (qethbuffer->rx_skb) {
/* only if qeth_card.options.cq == QETH_CQ_ENABLED */
*pskb = qethbuffer->rx_skb;
qethbuffer->rx_skb = NULL;
} else {
*pskb = dev_alloc_skb(QETH_RX_PULL_LEN + ETH_HLEN);
if (!(*pskb))
return -ENOMEM;
}
skb_reserve(*pskb, ETH_HLEN);
if (data_len <= QETH_RX_PULL_LEN) {
memcpy(skb_put(*pskb, data_len), element->addr + offset,
data_len);
} else {
get_page(page);
memcpy(skb_put(*pskb, QETH_RX_PULL_LEN),
element->addr + offset, QETH_RX_PULL_LEN);
skb_fill_page_desc(*pskb, *pfrag, page,
offset + QETH_RX_PULL_LEN,
data_len - QETH_RX_PULL_LEN);
(*pskb)->data_len += data_len - QETH_RX_PULL_LEN;
(*pskb)->len += data_len - QETH_RX_PULL_LEN;
(*pskb)->truesize += data_len - QETH_RX_PULL_LEN;
(*pfrag)++;
}
} else {
get_page(page);
skb_fill_page_desc(*pskb, *pfrag, page, offset, data_len);
(*pskb)->data_len += data_len;
(*pskb)->len += data_len;
(*pskb)->truesize += data_len;
(*pfrag)++;
}
return 0;
}
| 6,812 |
161,579 | 0 | void AddInternetStrings(content::WebUIDataSource* html_source) {
LocalizedString localized_strings[] = {
{"internetAddConnection", IDS_SETTINGS_INTERNET_ADD_CONNECTION},
{"internetAddConnectionExpandA11yLabel",
IDS_SETTINGS_INTERNET_ADD_CONNECTION_EXPAND_ACCESSIBILITY_LABEL},
{"internetAddConnectionNotAllowed",
IDS_SETTINGS_INTERNET_ADD_CONNECTION_NOT_ALLOWED},
{"internetAddThirdPartyVPN", IDS_SETTINGS_INTERNET_ADD_THIRD_PARTY_VPN},
{"internetAddVPN", IDS_SETTINGS_INTERNET_ADD_VPN},
{"internetAddArcVPN", IDS_SETTINGS_INTERNET_ADD_ARC_VPN},
{"internetAddArcVPNProvider", IDS_SETTINGS_INTERNET_ADD_ARC_VPN_PROVIDER},
{"internetAddWiFi", IDS_SETTINGS_INTERNET_ADD_WIFI},
{"internetConfigName", IDS_SETTINGS_INTERNET_CONFIG_NAME},
{"internetDetailPageTitle", IDS_SETTINGS_INTERNET_DETAIL},
{"internetDeviceEnabling", IDS_SETTINGS_INTERNET_DEVICE_ENABLING},
{"internetDeviceInitializing", IDS_SETTINGS_INTERNET_DEVICE_INITIALIZING},
{"internetJoinType", IDS_SETTINGS_INTERNET_JOIN_TYPE},
{"internetKnownNetworksPageTitle", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS},
{"internetMobileSearching", IDS_SETTINGS_INTERNET_MOBILE_SEARCH},
{"internetNoNetworks", IDS_SETTINGS_INTERNET_NO_NETWORKS},
{"internetPageTitle", IDS_SETTINGS_INTERNET},
{"internetToggleMobileA11yLabel",
IDS_SETTINGS_INTERNET_TOGGLE_MOBILE_ACCESSIBILITY_LABEL},
{"internetToggleTetherLabel", IDS_SETTINGS_INTERNET_TOGGLE_TETHER_LABEL},
{"internetToggleTetherSubtext",
IDS_SETTINGS_INTERNET_TOGGLE_TETHER_SUBTEXT},
{"internetToggleWiFiA11yLabel",
IDS_SETTINGS_INTERNET_TOGGLE_WIFI_ACCESSIBILITY_LABEL},
{"internetToggleWiMAXA11yLabel",
IDS_SETTINGS_INTERNET_TOGGLE_WIMAX_ACCESSIBILITY_LABEL},
{"knownNetworksAll", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_ALL},
{"knownNetworksButton", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_BUTTON},
{"knownNetworksMessage", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_MESSAGE},
{"knownNetworksPreferred",
IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_PREFFERED},
{"knownNetworksMenuAddPreferred",
IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_MENU_ADD_PREFERRED},
{"knownNetworksMenuRemovePreferred",
IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_MENU_REMOVE_PREFERRED},
{"knownNetworksMenuForget",
IDS_SETTINGS_INTERNET_KNOWN_NETWORKS_MENU_FORGET},
{"networkAllowDataRoaming",
IDS_SETTINGS_SETTINGS_NETWORK_ALLOW_DATA_ROAMING},
{"networkAutoConnect", IDS_SETTINGS_INTERNET_NETWORK_AUTO_CONNECT},
{"networkButtonActivate", IDS_SETTINGS_INTERNET_BUTTON_ACTIVATE},
{"networkButtonConfigure", IDS_SETTINGS_INTERNET_BUTTON_CONFIGURE},
{"networkButtonConnect", IDS_SETTINGS_INTERNET_BUTTON_CONNECT},
{"networkButtonDisconnect", IDS_SETTINGS_INTERNET_BUTTON_DISCONNECT},
{"networkButtonForget", IDS_SETTINGS_INTERNET_BUTTON_FORGET},
{"networkButtonViewAccount", IDS_SETTINGS_INTERNET_BUTTON_VIEW_ACCOUNT},
{"networkConnectNotAllowed", IDS_SETTINGS_INTERNET_CONNECT_NOT_ALLOWED},
{"networkIPAddress", IDS_SETTINGS_INTERNET_NETWORK_IP_ADDRESS},
{"networkIPConfigAuto", IDS_SETTINGS_INTERNET_NETWORK_IP_CONFIG_AUTO},
{"networkNameserversLearnMore", IDS_LEARN_MORE},
{"networkPrefer", IDS_SETTINGS_INTERNET_NETWORK_PREFER},
{"networkPrimaryUserControlled",
IDS_SETTINGS_INTERNET_NETWORK_PRIMARY_USER_CONTROLLED},
{"networkSectionAdvanced",
IDS_SETTINGS_INTERNET_NETWORK_SECTION_ADVANCED},
{"networkSectionAdvancedA11yLabel",
IDS_SETTINGS_INTERNET_NETWORK_SECTION_ADVANCED_ACCESSIBILITY_LABEL},
{"networkSectionNetwork", IDS_SETTINGS_INTERNET_NETWORK_SECTION_NETWORK},
{"networkSectionNetworkExpandA11yLabel",
IDS_SETTINGS_INTERNET_NETWORK_SECTION_NETWORK_ACCESSIBILITY_LABEL},
{"networkSectionProxy", IDS_SETTINGS_INTERNET_NETWORK_SECTION_PROXY},
{"networkSectionProxyExpandA11yLabel",
IDS_SETTINGS_INTERNET_NETWORK_SECTION_PROXY_ACCESSIBILITY_LABEL},
{"networkShared", IDS_SETTINGS_INTERNET_NETWORK_SHARED},
{"networkVpnBuiltin", IDS_NETWORK_TYPE_VPN_BUILTIN},
{"networkOutOfRange", IDS_SETTINGS_INTERNET_WIFI_NETWORK_OUT_OF_RANGE},
{"tetherPhoneOutOfRange",
IDS_SETTINGS_INTERNET_TETHER_PHONE_OUT_OF_RANGE},
{"gmscoreNotificationsTitle",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TITLE},
{"gmscoreNotificationsOneDeviceSubtitle",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_ONE_DEVICE_SUBTITLE},
{"gmscoreNotificationsTwoDevicesSubtitle",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TWO_DEVICES_SUBTITLE},
{"gmscoreNotificationsManyDevicesSubtitle",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_MANY_DEVICES_SUBTITLE},
{"gmscoreNotificationsFirstStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FIRST_STEP},
{"gmscoreNotificationsSecondStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_SECOND_STEP},
{"gmscoreNotificationsThirdStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_THIRD_STEP},
{"gmscoreNotificationsFourthStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FOURTH_STEP},
{"tetherConnectionDialogTitle",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DIALOG_TITLE},
{"tetherConnectionAvailableDeviceTitle",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_AVAILABLE_DEVICE_TITLE},
{"tetherConnectionBatteryPercentage",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_BATTERY_PERCENTAGE},
{"tetherConnectionExplanation",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_EXPLANATION},
{"tetherConnectionCarrierWarning",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_CARRIER_WARNING},
{"tetherConnectionDescriptionTitle",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DESCRIPTION_TITLE},
{"tetherConnectionDescriptionMobileData",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DESCRIPTION_MOBILE_DATA},
{"tetherConnectionDescriptionBattery",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DESCRIPTION_BATTERY},
{"tetherConnectionDescriptionWiFi",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DESCRIPTION_WIFI},
{"tetherConnectionNotNowButton",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_NOT_NOW_BUTTON},
{"tetherConnectionConnectButton",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_CONNECT_BUTTON},
{"tetherEnableBluetooth", IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
html_source->AddBoolean("networkSettingsConfig",
chromeos::switches::IsNetworkSettingsConfigEnabled());
html_source->AddString("networkGoogleNameserversLearnMoreUrl",
chrome::kGoogleNameserversLearnMoreURL);
html_source->AddString(
"internetNoNetworksMobileData",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_INTERNET_NO_NETWORKS_MOBILE_DATA,
GetHelpUrlWithBoard(chrome::kInstantTetheringLearnMoreURL)));
}
| 6,813 |
42,232 | 0 | void vhost_poll_stop(struct vhost_poll *poll)
{
if (poll->wqh) {
remove_wait_queue(poll->wqh, &poll->wait);
poll->wqh = NULL;
}
}
| 6,814 |
81,281 | 0 | static inline void ftrace_exports_enable(void)
{
static_branch_enable(&ftrace_exports_enabled);
}
| 6,815 |
121,609 | 0 | inline bool SearchBuffer::isBadMatch(const UChar* match, size_t matchLength) const
{
if (!m_targetRequiresKanaWorkaround)
return false;
normalizeCharacters(match, matchLength, m_normalizedMatch);
const UChar* a = m_normalizedTarget.begin();
const UChar* aEnd = m_normalizedTarget.end();
const UChar* b = m_normalizedMatch.begin();
const UChar* bEnd = m_normalizedMatch.end();
while (true) {
while (a != aEnd && !isKanaLetter(*a))
++a;
while (b != bEnd && !isKanaLetter(*b))
++b;
if (a == aEnd || b == bEnd) {
ASSERT(a == aEnd);
ASSERT(b == bEnd);
return false;
}
if (isSmallKanaLetter(*a) != isSmallKanaLetter(*b))
return true;
if (composedVoicedSoundMark(*a) != composedVoicedSoundMark(*b))
return true;
++a;
++b;
while (1) {
if (!(a != aEnd && isCombiningVoicedSoundMark(*a))) {
if (b != bEnd && isCombiningVoicedSoundMark(*b))
return true;
break;
}
if (!(b != bEnd && isCombiningVoicedSoundMark(*b)))
return true;
if (*a != *b)
return true;
++a;
++b;
}
}
}
| 6,816 |
85,443 | 0 | static void sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func)
{
struct domain_device *dev, *n;
list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) {
if (!dev_is_sata(dev))
continue;
sas_ata_wait_eh(dev);
/* if libata failed to power manage the device, tear it down */
if (ata_dev_disabled(sas_to_ata_dev(dev)))
sas_fail_probe(dev, func, -ENODEV);
}
}
| 6,817 |
66,063 | 0 | static void omninet_write_bulk_callback(struct urb *urb)
{
/* struct omninet_header *header = (struct omninet_header *)
urb->transfer_buffer; */
struct usb_serial_port *port = urb->context;
int status = urb->status;
set_bit(0, &port->write_urbs_free);
if (status) {
dev_dbg(&port->dev, "%s - nonzero write bulk status received: %d\n",
__func__, status);
return;
}
usb_serial_port_softint(port);
}
| 6,818 |
18,497 | 0 | static void generic_online_page(struct page *page)
{
__online_page_set_limits(page);
__online_page_increment_counters(page);
__online_page_free(page);
}
| 6,819 |
99,192 | 0 | v8::Handle<v8::Context> V8DOMWrapper::getWrapperContext(Frame* frame)
{
v8::Handle<v8::Context> context = V8Proxy::context(frame);
if (context.IsEmpty())
return v8::Handle<v8::Context>();
if (V8IsolatedWorld* world = V8IsolatedWorld::getEntered()) {
context = world->context();
if (frame != V8Proxy::retrieveFrame(context))
return v8::Handle<v8::Context>();
}
return context;
}
| 6,820 |
119,286 | 0 | void ConvolverNode::setBuffer(AudioBuffer* buffer)
{
ASSERT(isMainThread());
if (!buffer)
return;
unsigned numberOfChannels = buffer->numberOfChannels();
size_t bufferLength = buffer->length();
bool isBufferGood = numberOfChannels > 0 && numberOfChannels <= 4 && bufferLength;
ASSERT(isBufferGood);
if (!isBufferGood)
return;
RefPtr<AudioBus> bufferBus = AudioBus::create(numberOfChannels, bufferLength, false);
for (unsigned i = 0; i < numberOfChannels; ++i)
bufferBus->setChannelMemory(i, buffer->getChannelData(i)->data(), bufferLength);
bufferBus->setSampleRate(buffer->sampleRate());
bool useBackgroundThreads = !context()->isOfflineContext();
OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize));
{
MutexLocker locker(m_processLock);
m_reverb = reverb.release();
m_buffer = buffer;
}
}
| 6,821 |
62,033 | 0 | static uint32_t deserialize_gw_speed(uint8_t value) {
uint32_t speed;
uint32_t exp;
if (!value) {
return 0;
}
if (value == UINT8_MAX) {
/* maximum value: also return maximum value */
return MAX_SMARTGW_SPEED;
}
speed = (value >> 3) + 1;
exp = value & 7;
while (exp-- > 0) {
speed *= 10;
}
return speed;
}
| 6,822 |
25,995 | 0 | event_filter_match(struct perf_event *event)
{
return (event->cpu == -1 || event->cpu == smp_processor_id())
&& perf_cgroup_match(event);
}
| 6,823 |
149,387 | 0 | bool CheckClientDownloadRequest::ShouldUploadBinary(
DownloadCheckResultReason reason) {
bool upload_for_dlp = ShouldUploadForDlpScan();
bool upload_for_malware = ShouldUploadForMalwareScan(reason);
if (!upload_for_dlp && !upload_for_malware)
return false;
return !!Profile::FromBrowserContext(GetBrowserContext());
}
| 6,824 |
154,062 | 0 | void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM(
GLsizei count,
const volatile GLuint* textures) {
std::vector<gl::GLSurface::CALayerInUseQuery> queries;
queries.reserve(count);
for (GLsizei i = 0; i < count; ++i) {
gl::GLImage* image = nullptr;
GLuint texture_id = textures[i];
if (texture_id) {
TextureRef* ref = texture_manager()->GetTexture(texture_id);
if (!ref) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
"glScheduleCALayerInUseQueryCHROMIUM",
"unknown texture");
return;
}
Texture::ImageState image_state;
image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
&image_state);
}
gl::GLSurface::CALayerInUseQuery query;
query.image = image;
query.texture = texture_id;
queries.push_back(query);
}
surface_->ScheduleCALayerInUseQuery(std::move(queries));
}
| 6,825 |
135,909 | 0 | void TextTrackCueList::Clear() {
list_.clear();
}
| 6,826 |
65,111 | 0 | static MagickBooleanType SkipRGBMipmaps(Image *image,DDSInfo *dds_info,
int pixel_size,ExceptionInfo *exception)
{
MagickOffsetType
offset;
register ssize_t
i;
size_t
h,
w;
/*
Only skip mipmaps for textures and cube maps
*/
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
return(MagickFalse);
}
if (dds_info->ddscaps1 & DDSCAPS_MIPMAP
&& (dds_info->ddscaps1 & DDSCAPS_TEXTURE
|| dds_info->ddscaps2 & DDSCAPS2_CUBEMAP))
{
w = DIV2(dds_info->width);
h = DIV2(dds_info->height);
/*
Mipmapcount includes the main image, so start from one
*/
for (i=1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
{
offset = (MagickOffsetType) w * h * pixel_size;
if (SeekBlob(image,offset,SEEK_CUR) < 0)
break;
w = DIV2(w);
h = DIV2(h);
}
}
return(MagickTrue);
}
| 6,827 |
159,290 | 0 | WebGLRenderingContextBase::CreateContextProviderInternal(
CanvasRenderingContextHost* host,
const CanvasContextCreationAttributes& attributes,
unsigned web_gl_version,
bool* using_gpu_compositing) {
DCHECK(host);
ExecutionContext* execution_context = host->GetTopExecutionContext();
DCHECK(execution_context);
Platform::ContextAttributes context_attributes = ToPlatformContextAttributes(
attributes, web_gl_version,
SupportOwnOffscreenSurface(execution_context));
Platform::GraphicsInfo gl_info;
std::unique_ptr<WebGraphicsContext3DProvider> context_provider;
const auto& url = execution_context->Url();
if (IsMainThread()) {
*using_gpu_compositing = !Platform::Current()->IsGpuCompositingDisabled();
context_provider =
Platform::Current()->CreateOffscreenGraphicsContext3DProvider(
context_attributes, url, nullptr, &gl_info);
} else {
context_provider = CreateContextProviderOnWorkerThread(
context_attributes, &gl_info, using_gpu_compositing, url);
}
if (context_provider && !context_provider->BindToCurrentThread()) {
context_provider = nullptr;
gl_info.error_message =
String("bindToCurrentThread failed: " + String(gl_info.error_message));
}
if (!context_provider || g_should_fail_context_creation_for_testing) {
g_should_fail_context_creation_for_testing = false;
host->HostDispatchEvent(WebGLContextEvent::Create(
EventTypeNames::webglcontextcreationerror, false, true,
ExtractWebGLContextCreationError(gl_info)));
return nullptr;
}
gpu::gles2::GLES2Interface* gl = context_provider->ContextGL();
if (!String(gl->GetString(GL_EXTENSIONS))
.Contains("GL_OES_packed_depth_stencil")) {
host->HostDispatchEvent(WebGLContextEvent::Create(
EventTypeNames::webglcontextcreationerror, false, true,
"OES_packed_depth_stencil support is required."));
return nullptr;
}
return context_provider;
}
| 6,828 |
57,566 | 0 | static int ext4_fill_flex_info(struct super_block *sb)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_group_desc *gdp = NULL;
ext4_group_t flex_group_count;
ext4_group_t flex_group;
int groups_per_flex = 0;
size_t size;
int i;
sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
groups_per_flex = 1 << sbi->s_log_groups_per_flex;
if (groups_per_flex < 2) {
sbi->s_log_groups_per_flex = 0;
return 1;
}
/* We allocate both existing and potentially added groups */
flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
size = flex_group_count * sizeof(struct flex_groups);
sbi->s_flex_groups = kzalloc(size, GFP_KERNEL);
if (sbi->s_flex_groups == NULL) {
sbi->s_flex_groups = vmalloc(size);
if (sbi->s_flex_groups)
memset(sbi->s_flex_groups, 0, size);
}
if (sbi->s_flex_groups == NULL) {
ext4_msg(sb, KERN_ERR, "not enough memory for "
"%u flex groups", flex_group_count);
goto failed;
}
for (i = 0; i < sbi->s_groups_count; i++) {
gdp = ext4_get_group_desc(sb, i, NULL);
flex_group = ext4_flex_group(sbi, i);
atomic_add(ext4_free_inodes_count(sb, gdp),
&sbi->s_flex_groups[flex_group].free_inodes);
atomic_add(ext4_free_blks_count(sb, gdp),
&sbi->s_flex_groups[flex_group].free_blocks);
atomic_add(ext4_used_dirs_count(sb, gdp),
&sbi->s_flex_groups[flex_group].used_dirs);
}
return 1;
failed:
return 0;
}
| 6,829 |
29,939 | 0 | void udp_destroy_sock(struct sock *sk)
{
struct udp_sock *up = udp_sk(sk);
bool slow = lock_sock_fast(sk);
udp_flush_pending_frames(sk);
unlock_sock_fast(sk, slow);
if (static_key_false(&udp_encap_needed) && up->encap_type) {
void (*encap_destroy)(struct sock *sk);
encap_destroy = ACCESS_ONCE(up->encap_destroy);
if (encap_destroy)
encap_destroy(sk);
}
}
| 6,830 |
85,363 | 0 | static int build_curseg(struct f2fs_sb_info *sbi)
{
struct curseg_info *array;
int i;
array = kcalloc(NR_CURSEG_TYPE, sizeof(*array), GFP_KERNEL);
if (!array)
return -ENOMEM;
SM_I(sbi)->curseg_array = array;
for (i = 0; i < NR_CURSEG_TYPE; i++) {
mutex_init(&array[i].curseg_mutex);
array[i].sum_blk = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!array[i].sum_blk)
return -ENOMEM;
init_rwsem(&array[i].journal_rwsem);
array[i].journal = kzalloc(sizeof(struct f2fs_journal),
GFP_KERNEL);
if (!array[i].journal)
return -ENOMEM;
array[i].segno = NULL_SEGNO;
array[i].next_blkoff = 0;
}
return restore_curseg_summaries(sbi);
}
| 6,831 |
45,563 | 0 | static void crypto_cbc_exit_tfm(struct crypto_tfm *tfm)
{
struct crypto_cbc_ctx *ctx = crypto_tfm_ctx(tfm);
crypto_free_cipher(ctx->child);
}
| 6,832 |
92,521 | 0 | dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
{
/*
* Update run-time statistics of the 'current'.
*/
update_curr(cfs_rq);
/*
* When dequeuing a sched_entity, we must:
* - Update loads to have both entity and cfs_rq synced with now.
* - Subtract its load from the cfs_rq->runnable_avg.
* - Subtract its previous weight from cfs_rq->load.weight.
* - For group entity, update its weight to reflect the new share
* of its group cfs_rq.
*/
update_load_avg(cfs_rq, se, UPDATE_TG);
dequeue_runnable_load_avg(cfs_rq, se);
update_stats_dequeue(cfs_rq, se, flags);
clear_buddies(cfs_rq, se);
if (se != cfs_rq->curr)
__dequeue_entity(cfs_rq, se);
se->on_rq = 0;
account_entity_dequeue(cfs_rq, se);
/*
* Normalize after update_curr(); which will also have moved
* min_vruntime if @se is the one holding it back. But before doing
* update_min_vruntime() again, which will discount @se's position and
* can move min_vruntime forward still more.
*/
if (!(flags & DEQUEUE_SLEEP))
se->vruntime -= cfs_rq->min_vruntime;
/* return excess runtime on last dequeue */
return_cfs_rq_runtime(cfs_rq);
update_cfs_group(se);
/*
* Now advance min_vruntime if @se was the entity holding it back,
* except when: DEQUEUE_SAVE && !DEQUEUE_MOVE, in this case we'll be
* put back on, and if we advance min_vruntime, we'll be placed back
* further than we started -- ie. we'll be penalized.
*/
if ((flags & (DEQUEUE_SAVE | DEQUEUE_MOVE)) != DEQUEUE_SAVE)
update_min_vruntime(cfs_rq);
}
| 6,833 |
39,261 | 0 | int security_bounded_transition(u32 old_sid, u32 new_sid)
{
struct context *old_context, *new_context;
struct type_datum *type;
int index;
int rc;
read_lock(&policy_rwlock);
rc = -EINVAL;
old_context = sidtab_search(&sidtab, old_sid);
if (!old_context) {
printk(KERN_ERR "SELinux: %s: unrecognized SID %u\n",
__func__, old_sid);
goto out;
}
rc = -EINVAL;
new_context = sidtab_search(&sidtab, new_sid);
if (!new_context) {
printk(KERN_ERR "SELinux: %s: unrecognized SID %u\n",
__func__, new_sid);
goto out;
}
rc = 0;
/* type/domain unchanged */
if (old_context->type == new_context->type)
goto out;
index = new_context->type;
while (true) {
type = flex_array_get_ptr(policydb.type_val_to_struct_array,
index - 1);
BUG_ON(!type);
/* not bounded anymore */
rc = -EPERM;
if (!type->bounds)
break;
/* @newsid is bounded by @oldsid */
rc = 0;
if (type->bounds == old_context->type)
break;
index = type->bounds;
}
if (rc) {
char *old_name = NULL;
char *new_name = NULL;
u32 length;
if (!context_struct_to_string(old_context,
&old_name, &length) &&
!context_struct_to_string(new_context,
&new_name, &length)) {
audit_log(current->audit_context,
GFP_ATOMIC, AUDIT_SELINUX_ERR,
"op=security_bounded_transition "
"result=denied "
"oldcontext=%s newcontext=%s",
old_name, new_name);
}
kfree(new_name);
kfree(old_name);
}
out:
read_unlock(&policy_rwlock);
return rc;
}
| 6,834 |
135,798 | 0 | void SelectionController::SelectClosestMisspellingFromMouseEvent(
const MouseEventWithHitTestResults& result) {
if (!mouse_down_may_start_select_)
return;
SelectClosestMisspellingFromHitTestResult(
result.GetHitTestResult(),
(result.Event().click_count == 2 &&
frame_->GetEditor().IsSelectTrailingWhitespaceEnabled())
? AppendTrailingWhitespace::kShouldAppend
: AppendTrailingWhitespace::kDontAppend);
}
| 6,835 |
14,845 | 0 | static int calc_dimension_12(const char* str)
{
int i = 0, flag = 0;
while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) {
str++;
}
if (*str == '*') {
i++;
str++;
}
while (*str != '\0') {
if (*str >= '0' && *str <= '9') {
if (flag == 0) {
i++;
flag = 1;
}
} else if (*str == '*') {
soap_error0(E_ERROR, "Encoding: '*' may only be first arraySize value in list");
} else {
flag = 0;
}
str++;
}
return i;
}
| 6,836 |
25,131 | 0 | struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
{
struct rtable *rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, 0, 0);
struct rtable *ort = (struct rtable *) dst_orig;
if (rt) {
struct dst_entry *new = &rt->dst;
new->__use = 1;
new->input = dst_discard;
new->output = dst_discard;
dst_copy_metrics(new, &ort->dst);
new->dev = ort->dst.dev;
if (new->dev)
dev_hold(new->dev);
rt->rt_key_dst = ort->rt_key_dst;
rt->rt_key_src = ort->rt_key_src;
rt->rt_key_tos = ort->rt_key_tos;
rt->rt_route_iif = ort->rt_route_iif;
rt->rt_iif = ort->rt_iif;
rt->rt_oif = ort->rt_oif;
rt->rt_mark = ort->rt_mark;
rt->rt_genid = rt_genid(net);
rt->rt_flags = ort->rt_flags;
rt->rt_type = ort->rt_type;
rt->rt_dst = ort->rt_dst;
rt->rt_src = ort->rt_src;
rt->rt_gateway = ort->rt_gateway;
rt->rt_spec_dst = ort->rt_spec_dst;
rt->peer = ort->peer;
if (rt->peer)
atomic_inc(&rt->peer->refcnt);
rt->fi = ort->fi;
if (rt->fi)
atomic_inc(&rt->fi->fib_clntref);
dst_free(new);
}
dst_release(dst_orig);
return rt ? &rt->dst : ERR_PTR(-ENOMEM);
}
| 6,837 |
115,631 | 0 | void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorSpace)
{
if (paintingDisabled())
return;
platformContext()->setFillColor(color.rgb());
}
| 6,838 |
139,236 | 0 | ~ConnectionFilterController() {}
| 6,839 |
148,053 | 0 | void V8TestObject::VoidMethodDefaultDoubleOrStringArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodDefaultDoubleOrStringArgs");
test_object_v8_internal::VoidMethodDefaultDoubleOrStringArgsMethod(info);
}
| 6,840 |
112,701 | 0 | void DocumentLoader::setRequest(const ResourceRequest& req)
{
bool handlingUnreachableURL = false;
handlingUnreachableURL = m_substituteData.isValid() && !m_substituteData.failingURL().isEmpty();
if (handlingUnreachableURL)
m_committed = false;
ASSERT(!m_committed);
m_request = req;
}
| 6,841 |
68,688 | 0 | vc4_gem_destroy(struct drm_device *dev)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
/* Waiting for exec to finish would need to be done before
* unregistering V3D.
*/
WARN_ON(vc4->emit_seqno != vc4->finished_seqno);
/* V3D should already have disabled its interrupt and cleared
* the overflow allocation registers. Now free the object.
*/
if (vc4->overflow_mem) {
drm_gem_object_unreference_unlocked(&vc4->overflow_mem->base.base);
vc4->overflow_mem = NULL;
}
if (vc4->hang_state)
vc4_free_hang_state(dev, vc4->hang_state);
vc4_bo_cache_destroy(dev);
}
| 6,842 |
89,038 | 0 | WandPrivate void CLISettingOptionInfo(MagickCLI *cli_wand,
const char *option,const char *arg1n, const char *arg2n)
{
ssize_t
parse; /* option argument parsing (string to value table lookup) */
const char /* percent escaped versions of the args */
*arg1,
*arg2;
#define _image_info (cli_wand->wand.image_info)
#define _image (cli_wand->wand.images)
#define _exception (cli_wand->wand.exception)
#define _draw_info (cli_wand->draw_info)
#define _quantize_info (cli_wand->quantize_info)
#define IfSetOption (*option=='-')
#define ArgBoolean IfSetOption ? MagickTrue : MagickFalse
#define ArgBooleanNot IfSetOption ? MagickFalse : MagickTrue
#define ArgBooleanString (IfSetOption?"true":"false")
#define ArgOption(def) (IfSetOption?arg1:(const char *)(def))
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
assert(cli_wand->wand.signature == MagickWandSignature);
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"- Setting Option: %s \"%s\" \"%s\"", option,arg1n,arg2n);
arg1 = arg1n,
arg2 = arg2n;
#if 1
#define _process_flags (cli_wand->process_flags)
#define _option_type ((CommandOptionFlags) cli_wand->command->flags)
/* Interpret Percent Escapes in Arguments - using first image */
if ( (((_process_flags & ProcessInterpretProperities) != 0 )
|| ((_option_type & AlwaysInterpretArgsFlag) != 0)
) && ((_option_type & NeverInterpretArgsFlag) == 0) ) {
/* Interpret Percent escapes in argument 1 */
if (arg1n != (char *) NULL) {
arg1=InterpretImageProperties(_image_info,_image,arg1n,_exception);
if (arg1 == (char *) NULL) {
CLIWandException(OptionWarning,"InterpretPropertyFailure",option);
arg1=arg1n; /* use the given argument as is */
}
}
if (arg2n != (char *) NULL) {
arg2=InterpretImageProperties(_image_info,_image,arg2n,_exception);
if (arg2 == (char *) NULL) {
CLIWandException(OptionWarning,"InterpretPropertyFailure",option);
arg2=arg2n; /* use the given argument as is */
}
}
}
#undef _process_flags
#undef _option_type
#endif
switch (*(option+1))
{
case 'a':
{
if (LocaleCompare("adjoin",option+1) == 0)
{
_image_info->adjoin = ArgBoolean;
break;
}
if (LocaleCompare("affine",option+1) == 0)
{
CLIWandWarnReplaced("-draw 'affine ...'");
if (IfSetOption)
(void) ParseAffineGeometry(arg1,&_draw_info->affine,_exception);
else
GetAffineMatrix(&_draw_info->affine);
break;
}
if (LocaleCompare("antialias",option+1) == 0)
{
_image_info->antialias =
_draw_info->stroke_antialias =
_draw_info->text_antialias = ArgBoolean;
break;
}
if (LocaleCompare("attenuate",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption("1.0"));
break;
}
if (LocaleCompare("authenticate",option+1) == 0)
{
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'b':
{
if (LocaleCompare("background",option+1) == 0)
{
/* FUTURE: both _image_info attribute & ImageOption in use!
_image_info only used directly for generating new images.
SyncImageSettings() used to set per-image attribute.
FUTURE: if _image_info->background_color is not set then
we should fall back to per-image background_color
At this time -background will 'wipe out' the per-image
background color!
Better error handling of QueryColorCompliance() needed.
*/
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
(void) QueryColorCompliance(ArgOption(MogrifyBackgroundColor),AllCompliance,
&_image_info->background_color,_exception);
break;
}
if (LocaleCompare("bias",option+1) == 0)
{
/* FUTURE: bias OBSOLETED, replaced by Artifact "convolve:bias"
as it is actually rarely used except in direct convolve operations
Usage outside a direct convolve operation is actally non-sensible!
SyncImageSettings() used to set per-image attribute.
*/
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,"convolve:bias",ArgOption(NULL));
break;
}
if (LocaleCompare("black-point-compensation",option+1) == 0)
{
/* Used as a image chromaticity setting
SyncImageSettings() used to set per-image attribute.
*/
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
break;
}
if (LocaleCompare("blue-primary",option+1) == 0)
{
/* Image chromaticity X,Y NB: Y=X if Y not defined
Used by many coders including PNG
SyncImageSettings() used to set per-image attribute.
*/
arg1=ArgOption("0.0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("bordercolor",option+1) == 0)
{
/* FUTURE: both _image_info attribute & ImageOption in use!
SyncImageSettings() used to set per-image attribute.
Better error checking of QueryColorCompliance().
*/
if (IfSetOption)
{
(void) SetImageOption(_image_info,option+1,arg1);
(void) QueryColorCompliance(arg1,AllCompliance,
&_image_info->border_color,_exception);
(void) QueryColorCompliance(arg1,AllCompliance,
&_draw_info->border_color,_exception);
break;
}
(void) DeleteImageOption(_image_info,option+1);
(void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&_image_info->border_color,_exception);
(void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&_draw_info->border_color,_exception);
break;
}
if (LocaleCompare("box",option+1) == 0)
{
CLIWandWarnReplaced("-undercolor");
CLISettingOptionInfo(cli_wand,"-undercolor",arg1, arg2);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'c':
{
if (LocaleCompare("cache",option+1) == 0)
{
MagickSizeType
limit;
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
limit=MagickResourceInfinity;
if (LocaleCompare("unlimited",arg1) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(arg1,100.0);
(void) SetMagickResourceLimit(MemoryResource,limit);
(void) SetMagickResourceLimit(MapResource,2*limit);
break;
}
if (LocaleCompare("caption",option+1) == 0)
{
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("colorspace",option+1) == 0)
{
/* Setting used for new images via AquireImage()
But also used as a SimpleImageOperator
Undefined colorspace means don't modify images on
read or as a operation */
parse=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedColorspace",option,
arg1);
_image_info->colorspace=(ColorspaceType) parse;
break;
}
if (LocaleCompare("comment",option+1) == 0)
{
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("compose",option+1) == 0)
{
/* FUTURE: _image_info should be used,
SyncImageSettings() used to set per-image attribute. - REMOVE
This setting should NOT be used to set image 'compose'
"-layer" operators shoud use _image_info if defined otherwise
they should use a per-image compose setting.
*/
parse = ParseCommandOption(MagickComposeOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedComposeOperator",
option,arg1);
_image_info->compose=(CompositeOperator) parse;
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("compress",option+1) == 0)
{
/* FUTURE: What should be used? _image_info or ImageOption ???
The former is more efficent, but Crisy prefers the latter!
SyncImageSettings() used to set per-image attribute.
The coders appears to use _image_info, not Image_Option
however the image attribute (for save) is set from the
ImageOption!
Note that "undefined" is a different setting to "none".
*/
parse = ParseCommandOption(MagickCompressOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedImageCompression",
option,arg1);
_image_info->compression=(CompressionType) parse;
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'd':
{
if (LocaleCompare("debug",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
arg1=ArgOption("none");
parse = ParseCommandOption(MagickLogEventOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedEventType",
option,arg1);
(void) SetLogEventMask(arg1);
_image_info->debug=IsEventLogging(); /* extract logging*/
cli_wand->wand.debug=IsEventLogging();
break;
}
if (LocaleCompare("define",option+1) == 0)
{
if (LocaleNCompare(arg1,"registry:",9) == 0)
{
if (IfSetOption)
(void) DefineImageRegistry(StringRegistryType,arg1+9,_exception);
else
(void) DeleteImageRegistry(arg1+9);
break;
}
/* DefineImageOption() equals SetImageOption() but with '=' */
if (IfSetOption)
(void) DefineImageOption(_image_info,arg1);
else if (DeleteImageOption(_image_info,arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"NoSuchOption",option,arg1);
break;
}
if (LocaleCompare("delay",option+1) == 0)
{
/* Only used for new images via AcquireImage()
FUTURE: Option should also be used for "-morph" (color morphing)
*/
arg1=ArgOption("0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("density",option+1) == 0)
{
/* FUTURE: strings used in _image_info attr and _draw_info!
Basically as density can be in a XxY form!
SyncImageSettings() used to set per-image attribute.
*/
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
(void) CloneString(&_image_info->density,ArgOption(NULL));
(void) CloneString(&_draw_info->density,_image_info->density);
break;
}
if (LocaleCompare("depth",option+1) == 0)
{
/* This is also a SimpleImageOperator! for 8->16 vaule trunc !!!!
SyncImageSettings() used to set per-image attribute.
*/
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
_image_info->depth=IfSetOption?StringToUnsignedLong(arg1)
:MAGICKCORE_QUANTUM_DEPTH;
break;
}
if (LocaleCompare("direction",option+1) == 0)
{
/* Image Option is only used to set _draw_info */
arg1=ArgOption("undefined");
parse = ParseCommandOption(MagickDirectionOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedDirectionType",
option,arg1);
_draw_info->direction=(DirectionType) parse;
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("display",option+1) == 0)
{
(void) CloneString(&_image_info->server_name,ArgOption(NULL));
(void) CloneString(&_draw_info->server_name,_image_info->server_name);
break;
}
if (LocaleCompare("dispose",option+1) == 0)
{
/* only used in setting new images */
arg1=ArgOption("undefined");
parse = ParseCommandOption(MagickDisposeOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedDisposeMethod",
option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption("undefined"));
break;
}
if (LocaleCompare("dissimilarity-threshold",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
only by the "compare" CLI program at this time. */
arg1=ArgOption(DEFAULT_DISSIMILARITY_THRESHOLD);
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("dither",option+1) == 0)
{
/* _image_info attr (on/off), _quantize_info attr (on/off)
but also ImageInfo and _quantize_info method!
FUTURE: merge the duality of the dithering options
*/
_image_info->dither = ArgBoolean;
(void) SetImageOption(_image_info,option+1,ArgOption("none"));
_quantize_info->dither_method=(DitherMethod) ParseCommandOption(
MagickDitherOptions,MagickFalse,ArgOption("none"));
if (_quantize_info->dither_method == NoDitherMethod)
_image_info->dither = MagickFalse;
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'e':
{
if (LocaleCompare("encoding",option+1) == 0)
{
(void) CloneString(&_draw_info->encoding,ArgOption("undefined"));
(void) SetImageOption(_image_info,option+1,_draw_info->encoding);
break;
}
if (LocaleCompare("endian",option+1) == 0)
{
/* Both _image_info attr and ImageInfo */
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickEndianOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedEndianType",
option,arg1);
/* FUTURE: check alloc/free of endian string! - remove? */
_image_info->endian=(EndianType) (*arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("extract",option+1) == 0)
{
(void) CloneString(&_image_info->extract,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'f':
{
if (LocaleCompare("family",option+1) == 0)
{
(void) CloneString(&_draw_info->family,ArgOption(NULL));
break;
}
if (LocaleCompare("features",option+1) == 0)
{
(void) SetImageOption(_image_info,"identify:features",
ArgBooleanString);
if (IfSetOption)
(void) SetImageArtifact(_image,"verbose","true");
break;
}
if (LocaleCompare("fill",option+1) == 0)
{
/* Set "fill" OR "fill-pattern" in _draw_info
The original fill color is preserved if a fill-pattern is given.
That way it does not effect other operations that directly using
the fill color and, can be retored using "+tile".
*/
MagickBooleanType
status;
ExceptionInfo
*sans;
PixelInfo
color;
arg1 = ArgOption("none"); /* +fill turns it off! */
(void) SetImageOption(_image_info,option+1,arg1);
if (_draw_info->fill_pattern != (Image *) NULL)
_draw_info->fill_pattern=DestroyImage(_draw_info->fill_pattern);
/* is it a color or a image? -- ignore exceptions */
sans=AcquireExceptionInfo();
status=QueryColorCompliance(arg1,AllCompliance,&color,sans);
sans=DestroyExceptionInfo(sans);
if (status == MagickFalse)
_draw_info->fill_pattern=GetImageCache(_image_info,arg1,_exception);
else
_draw_info->fill=color;
break;
}
if (LocaleCompare("filter",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickFilterOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedImageFilter",
option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("font",option+1) == 0)
{
(void) CloneString(&_draw_info->font,ArgOption(NULL));
(void) CloneString(&_image_info->font,_draw_info->font);
break;
}
if (LocaleCompare("format",option+1) == 0)
{
/* FUTURE: why the ping test, you could set ping after this! */
/*
register const char
*q;
for (q=strchr(arg1,'%'); q != (char *) NULL; q=strchr(q+1,'%'))
if (strchr("Agkrz@[#",*(q+1)) != (char *) NULL)
_image_info->ping=MagickFalse;
*/
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("fuzz",option+1) == 0)
{
/* Option used to set image fuzz! unless blank canvas (from color)
Image attribute used for color compare operations
SyncImageSettings() used to set per-image attribute.
FUTURE: Can't find anything else using _image_info->fuzz directly!
convert structure attribute to 'option' string
*/
arg1=ArgOption("0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
_image_info->fuzz=StringToDoubleInterval(arg1,(double)
QuantumRange+1.0);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'g':
{
if (LocaleCompare("gravity",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
arg1 = ArgOption("none");
parse = ParseCommandOption(MagickGravityOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedGravityType",
option,arg1);
_draw_info->gravity=(GravityType) parse;
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("green-primary",option+1) == 0)
{
/* Image chromaticity X,Y NB: Y=X if Y not defined
SyncImageSettings() used to set per-image attribute.
Used directly by many coders
*/
arg1=ArgOption("0.0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'h':
{
if (LocaleCompare("highlight-color",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
only by the "compare" CLI program at this time. */
(void) SetImageOption(_image_info,"compare:highlight-color",
ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'i':
{
if (LocaleCompare("intensity",option+1) == 0)
{
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedIntensityType",
option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("intent",option+1) == 0)
{
/* Only used by coders: MIFF, MPC, BMP, PNG
and for image profile call to AcquireTransformThreadSet()
SyncImageSettings() used to set per-image attribute.
*/
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickIntentOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedIntentType",
option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("interlace",option+1) == 0)
{
/* _image_info is directly used by coders (so why an image setting?)
SyncImageSettings() used to set per-image attribute.
*/
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickInterlaceOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedInterlaceType",
option,arg1);
_image_info->interlace=(InterlaceType) parse;
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("interline-spacing",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1, ArgOption(NULL));
_draw_info->interline_spacing=StringToDouble(ArgOption("0"),
(char **) NULL);
break;
}
if (LocaleCompare("interpolate",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
arg1 = ArgOption("undefined");
parse = ParseCommandOption(MagickInterpolateOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedInterpolateMethod",
option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("interword-spacing",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1, ArgOption(NULL));
_draw_info->interword_spacing=StringToDouble(ArgOption("0"),(char **) NULL);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'k':
{
if (LocaleCompare("kerning",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_draw_info->kerning=StringToDouble(ArgOption("0"),(char **) NULL);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'l':
{
if (LocaleCompare("label",option+1) == 0)
{
/* only used for new images - not in SyncImageOptions() */
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("limit",option+1) == 0)
{
MagickSizeType
limit;
limit=MagickResourceInfinity;
parse= ParseCommandOption(MagickResourceOptions,MagickFalse,arg1);
if ( parse < 0 )
CLIWandExceptArgBreak(OptionError,"UnrecognizedResourceType",
option,arg1);
if (LocaleCompare("unlimited",arg2) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(arg2,100.0);
(void) SetMagickResourceLimit((ResourceType)parse,limit);
break;
}
if (LocaleCompare("log",option+1) == 0)
{
if (IfSetOption) {
if ((strchr(arg1,'%') == (char *) NULL))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetLogFormat(arg1);
}
break;
}
if (LocaleCompare("lowlight-color",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
only by the "compare" CLI program at this time. */
(void) SetImageOption(_image_info,"compare:lowlight-color",
ArgOption(NULL));
break;
}
if (LocaleCompare("loop",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
arg1=ArgOption("0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'm':
{
if (LocaleCompare("mattecolor",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
(void) QueryColorCompliance(ArgOption(MogrifyAlphaColor),
AllCompliance,&_image_info->matte_color,_exception);
break;
}
if (LocaleCompare("metric",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
only by the "compare" CLI program at this time. */
parse=ParseCommandOption(MagickMetricOptions,MagickFalse,arg1);
if ( parse < 0 )
CLIWandExceptArgBreak(OptionError,"UnrecognizedMetricType",
option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
if (LocaleCompare("moments",option+1) == 0)
{
(void) SetImageOption(_image_info,"identify:moments",
ArgBooleanString);
if (IfSetOption)
(void) SetImageArtifact(_image,"verbose","true");
break;
}
if (LocaleCompare("monitor",option+1) == 0)
{
(void) SetImageInfoProgressMonitor(_image_info, IfSetOption?
MonitorProgress: (MagickProgressMonitor) NULL, (void *) NULL);
break;
}
if (LocaleCompare("monochrome",option+1) == 0)
{
/* Setting (used by some input coders!) -- why?
Warning: This is also Special '-type' SimpleOperator
*/
_image_info->monochrome= ArgBoolean;
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'o':
{
if (LocaleCompare("orient",option+1) == 0)
{
/* Is not used when defining for new images.
This makes it more of a 'operation' than a setting
FUTURE: make set meta-data operator instead.
SyncImageSettings() used to set per-image attribute.
*/
parse=ParseCommandOption(MagickOrientationOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedImageOrientation",
option,arg1);
_image_info->orientation=(OrientationType)parse;
(void) SetImageOption(_image_info,option+1, ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'p':
{
if (LocaleCompare("page",option+1) == 0)
{
/* Only used for new images and image generators.
SyncImageSettings() used to set per-image attribute. ?????
That last is WRONG!!!!
FUTURE: adjust named 'page' sizes according density
*/
char
*canonical_page,
page[MagickPathExtent];
const char
*image_option;
MagickStatusType
flags;
RectangleInfo
geometry;
if (!IfSetOption)
{
(void) DeleteImageOption(_image_info,option+1);
(void) CloneString(&_image_info->page,(char *) NULL);
break;
}
(void) memset(&geometry,0,sizeof(geometry));
image_option=GetImageOption(_image_info,"page");
if (image_option != (const char *) NULL)
flags=ParseAbsoluteGeometry(image_option,&geometry);
canonical_page=GetPageGeometry(arg1);
flags=ParseAbsoluteGeometry(canonical_page,&geometry);
canonical_page=DestroyString(canonical_page);
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu",
(unsigned long) geometry.width,(unsigned long) geometry.height);
if (((flags & XValue) != 0) || ((flags & YValue) != 0))
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu%+ld%+ld",
(unsigned long) geometry.width,(unsigned long) geometry.height,
(long) geometry.x,(long) geometry.y);
(void) SetImageOption(_image_info,option+1,page);
(void) CloneString(&_image_info->page,page);
break;
}
if (LocaleCompare("ping",option+1) == 0)
{
_image_info->ping = ArgBoolean;
break;
}
if (LocaleCompare("pointsize",option+1) == 0)
{
if (IfSetOption) {
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
_image_info->pointsize =
_draw_info->pointsize =
StringToDouble(arg1,(char **) NULL);
}
else {
_image_info->pointsize=0.0; /* unset pointsize */
_draw_info->pointsize=12.0;
}
break;
}
if (LocaleCompare("precision",option+1) == 0)
{
arg1=ArgOption("-1");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetMagickPrecision(StringToInteger(arg1));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'q':
{
if (LocaleCompare("quality",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
_image_info->quality= IfSetOption ? StringToUnsignedLong(arg1)
: UNDEFINED_COMPRESSION_QUALITY;
(void) SetImageOption(_image_info,option+1,ArgOption("0"));
break;
}
if (LocaleCompare("quantize",option+1) == 0)
{
/* Just a set direct in _quantize_info */
arg1=ArgOption("undefined");
parse=ParseCommandOption(MagickColorspaceOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedColorspace",
option,arg1);
_quantize_info->colorspace=(ColorspaceType)parse;
break;
}
if (LocaleCompare("quiet",option+1) == 0)
{
/* FUTURE: if two -quiet is performed you can not do +quiet!
This needs to be checked over thoughly.
*/
static WarningHandler
warning_handler = (WarningHandler) NULL;
WarningHandler
tmp = SetWarningHandler((WarningHandler) NULL);
if ( tmp != (WarningHandler) NULL)
warning_handler = tmp; /* remember the old handler */
if (!IfSetOption) /* set the old handler */
warning_handler=SetWarningHandler(warning_handler);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'r':
{
if (LocaleCompare("red-primary",option+1) == 0)
{
/* Image chromaticity X,Y NB: Y=X if Y not defined
Used by many coders
SyncImageSettings() used to set per-image attribute.
*/
arg1=ArgOption("0.0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("regard-warnings",option+1) == 0)
/* FUTURE: to be replaced by a 'fatal-level' type setting */
break;
if (LocaleCompare("render",option+1) == 0)
{
/* _draw_info only setting */
_draw_info->render= ArgBooleanNot;
break;
}
if (LocaleCompare("respect-parenthesis",option+1) == 0)
{
/* link image and setting stacks - option is itself saved on stack! */
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 's':
{
if (LocaleCompare("sampling-factor",option+1) == 0)
{
/* FUTURE: should be converted to jpeg:sampling_factor */
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) CloneString(&_image_info->sampling_factor,ArgOption(NULL));
break;
}
if (LocaleCompare("scene",option+1) == 0)
{
/* SyncImageSettings() used to set this as a per-image attribute.
What ??? Why ????
*/
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_image_info->scene=StringToUnsignedLong(ArgOption("0"));
break;
}
if (LocaleCompare("seed",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
SetRandomSecretKey(
IfSetOption ? (unsigned long) StringToUnsignedLong(arg1)
: (unsigned long) time((time_t *) NULL));
break;
}
if (LocaleCompare("size",option+1) == 0)
{
/* FUTURE: string in _image_info -- convert to Option ???
Look at the special handling for "size" in SetImageOption()
*/
(void) CloneString(&_image_info->size,ArgOption(NULL));
break;
}
if (LocaleCompare("stretch",option+1) == 0)
{
arg1=ArgOption("undefined");
parse = ParseCommandOption(MagickStretchOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedStretchType",
option,arg1);
_draw_info->stretch=(StretchType) parse;
break;
}
if (LocaleCompare("stroke",option+1) == 0)
{
/* set stroke color OR stroke-pattern
UPDATE: ensure stroke color is not destroyed is a pattern
is given. Just in case the color is also used for other purposes.
*/
MagickBooleanType
status;
ExceptionInfo
*sans;
PixelInfo
color;
arg1 = ArgOption("none"); /* +fill turns it off! */
(void) SetImageOption(_image_info,option+1,arg1);
if (_draw_info->stroke_pattern != (Image *) NULL)
_draw_info->stroke_pattern=DestroyImage(_draw_info->stroke_pattern);
/* is it a color or a image? -- ignore exceptions */
sans=AcquireExceptionInfo();
status=QueryColorCompliance(arg1,AllCompliance,&color,sans);
sans=DestroyExceptionInfo(sans);
if (status == MagickFalse)
_draw_info->stroke_pattern=GetImageCache(_image_info,arg1,_exception);
else
_draw_info->stroke=color;
break;
}
if (LocaleCompare("strokewidth",option+1) == 0)
{
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_draw_info->stroke_width=StringToDouble(ArgOption("1.0"),
(char **) NULL);
break;
}
if (LocaleCompare("style",option+1) == 0)
{
arg1=ArgOption("undefined");
parse = ParseCommandOption(MagickStyleOptions,MagickFalse,arg1);
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedStyleType",
option,arg1);
_draw_info->style=(StyleType) parse;
break;
}
#if 0
if (LocaleCompare("subimage-search",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
only by the "compare" CLI program at this time. */
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
break;
}
#endif
if (LocaleCompare("synchronize",option+1) == 0)
{
/* FUTURE: syncronize to storage - but what does that mean? */
_image_info->synchronize = ArgBoolean;
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 't':
{
if (LocaleCompare("taint",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
break;
}
if (LocaleCompare("texture",option+1) == 0)
{
/* Note: arguments do not have percent escapes expanded */
/* FUTURE: move _image_info string to option splay-tree
Other than "montage" what uses "texture" ????
*/
(void) CloneString(&_image_info->texture,ArgOption(NULL));
break;
}
if (LocaleCompare("tile",option+1) == 0)
{
/* Note: arguments do not have percent escapes expanded */
_draw_info->fill_pattern=IfSetOption
?GetImageCache(_image_info,arg1,_exception)
:DestroyImage(_draw_info->fill_pattern);
break;
}
if (LocaleCompare("tile-offset",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. ??? */
arg1=ArgOption("0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("transparent-color",option+1) == 0)
{
/* FUTURE: both _image_info attribute & ImageOption in use!
_image_info only used for generating new images.
SyncImageSettings() used to set per-image attribute.
Note that +transparent-color, means fall-back to image
attribute so ImageOption is deleted, not set to a default.
*/
if (IfSetOption && (IsGeometry(arg1) == MagickFalse))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
(void) QueryColorCompliance(ArgOption("none"),AllCompliance,
&_image_info->transparent_color,_exception);
break;
}
if (LocaleCompare("treedepth",option+1) == 0)
{
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_quantize_info->tree_depth=StringToUnsignedLong(ArgOption("0"));
break;
}
if (LocaleCompare("type",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute. */
parse=ParseCommandOption(MagickTypeOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedImageType",
option,arg1);
_image_info->type=(ImageType) parse;
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'u':
{
if (LocaleCompare("undercolor",option+1) == 0)
{
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
(void) QueryColorCompliance(ArgOption("none"),AllCompliance,
&_draw_info->undercolor,_exception);
break;
}
if (LocaleCompare("units",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute.
Should this effect _draw_info X and Y resolution?
FUTURE: this probably should be part of the density setting
*/
parse=ParseCommandOption(MagickResolutionOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedUnitsType",
option,arg1);
_image_info->units=(ResolutionType) parse;
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'v':
{
if (LocaleCompare("verbose",option+1) == 0)
{
/* FUTURE: Remember all options become image artifacts
_image_info->verbose is only used by coders.
*/
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
_image_info->verbose= ArgBoolean;
_image_info->ping=MagickFalse; /* verbose can't be a ping */
break;
}
if (LocaleCompare("virtual-pixel",option+1) == 0)
{
/* SyncImageSettings() used to set per-image attribute.
This is VERY deep in the image caching structure.
*/
parse=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
ArgOption("undefined"));
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedVirtualPixelMethod",
option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 'w':
{
if (LocaleCompare("weight",option+1) == 0)
{
ssize_t
weight;
weight=ParseCommandOption(MagickWeightOptions,MagickFalse,arg1);
if (weight == -1)
weight=(ssize_t) StringToUnsignedLong(arg1);
_draw_info->weight=(size_t) weight;
break;
}
if (LocaleCompare("white-point",option+1) == 0)
{
/* Used as a image chromaticity setting
SyncImageSettings() used to set per-image attribute.
*/
arg1=ArgOption("0.0");
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
default:
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
/* clean up percent escape interpreted strings */
if ((arg1 && arg1n) && (arg1 != arg1n ))
arg1=DestroyString((char *) arg1);
if ((arg2 && arg2n) && (arg2 != arg2n ))
arg2=DestroyString((char *) arg2);
#undef _image_info
#undef _exception
#undef _draw_info
#undef _quantize_info
#undef IfSetOption
#undef ArgBoolean
#undef ArgBooleanNot
#undef ArgBooleanString
#undef ArgOption
return;
}
| 6,843 |
93,539 | 0 | static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)
{
struct mr6_table *mrt;
unsigned int i;
mrt = ip6mr_get_table(net, id);
if (mrt)
return mrt;
mrt = kzalloc(sizeof(*mrt), GFP_KERNEL);
if (!mrt)
return NULL;
mrt->id = id;
write_pnet(&mrt->net, net);
/* Forwarding cache */
for (i = 0; i < MFC6_LINES; i++)
INIT_LIST_HEAD(&mrt->mfc6_cache_array[i]);
INIT_LIST_HEAD(&mrt->mfc6_unres_queue);
setup_timer(&mrt->ipmr_expire_timer, ipmr_expire_process,
(unsigned long)mrt);
#ifdef CONFIG_IPV6_PIMSM_V2
mrt->mroute_reg_vif_num = -1;
#endif
#ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
list_add_tail_rcu(&mrt->list, &net->ipv6.mr6_tables);
#endif
return mrt;
}
| 6,844 |
47,976 | 0 | static void string_registers_quirk(struct x86_emulate_ctxt *ctxt)
{
/*
* Intel CPUs mask the counter and pointers in quite strange
* manner when ECX is zero due to REP-string optimizations.
*/
#ifdef CONFIG_X86_64
if (ctxt->ad_bytes != 4 || !vendor_intel(ctxt))
return;
*reg_write(ctxt, VCPU_REGS_RCX) = 0;
switch (ctxt->b) {
case 0xa4: /* movsb */
case 0xa5: /* movsd/w */
*reg_rmw(ctxt, VCPU_REGS_RSI) &= (u32)-1;
/* fall through */
case 0xaa: /* stosb */
case 0xab: /* stosd/w */
*reg_rmw(ctxt, VCPU_REGS_RDI) &= (u32)-1;
}
#endif
}
| 6,845 |
144,532 | 0 | int32_t WebContentsImpl::GetMaxPageID() {
return GetMaxPageIDForSiteInstance(GetSiteInstance());
}
| 6,846 |
63,344 | 0 | gss_sign (minor_status,
context_handle,
qop_req,
message_buffer,
msg_token)
OM_uint32 * minor_status;
gss_ctx_id_t context_handle;
int qop_req;
gss_buffer_t message_buffer;
gss_buffer_t msg_token;
{
return (gss_get_mic(minor_status, context_handle, (gss_qop_t) qop_req,
message_buffer, msg_token));
}
| 6,847 |
135,027 | 0 | void AppCacheUpdateJob::OnResponseInfoLoaded(
AppCacheResponseInfo* response_info, int64 response_id) {
const net::HttpResponseInfo* http_info = response_info ?
response_info->http_response_info() : NULL;
if (internal_state_ == FETCH_MANIFEST) {
if (http_info)
manifest_fetcher_->set_existing_response_headers(
http_info->headers.get());
manifest_fetcher_->Start();
return;
}
LoadingResponses::iterator found = loading_responses_.find(response_id);
DCHECK(found != loading_responses_.end());
const GURL& url = found->second;
if (!http_info) {
LoadFromNewestCacheFailed(url, NULL); // no response found
} else {
const std::string name = "vary";
std::string value;
void* iter = NULL;
if (!http_info->headers.get() ||
http_info->headers->RequiresValidation(http_info->request_time,
http_info->response_time,
base::Time::Now()) ||
http_info->headers->EnumerateHeader(&iter, name, &value)) {
LoadFromNewestCacheFailed(url, response_info);
} else {
DCHECK(group_->newest_complete_cache());
AppCacheEntry* copy_me = group_->newest_complete_cache()->GetEntry(url);
DCHECK(copy_me);
DCHECK(copy_me->response_id() == response_id);
AppCache::EntryMap::iterator it = url_file_list_.find(url);
DCHECK(it != url_file_list_.end());
AppCacheEntry& entry = it->second;
entry.set_response_id(response_id);
entry.set_response_size(copy_me->response_size());
inprogress_cache_->AddOrModifyEntry(url, entry);
NotifyAllProgress(url);
++url_fetches_completed_;
}
}
loading_responses_.erase(found);
MaybeCompleteUpdate();
}
| 6,848 |
119,785 | 0 | void NavigationControllerImpl::GoForward() {
if (!CanGoForward()) {
NOTREACHED();
return;
}
bool transient = (transient_entry_index_ != -1);
int current_index = GetCurrentEntryIndex();
DiscardNonCommittedEntries();
pending_entry_index_ = current_index;
if (!transient)
pending_entry_index_++;
entries_[pending_entry_index_]->SetTransitionType(
PageTransitionFromInt(
entries_[pending_entry_index_]->GetTransitionType() |
PAGE_TRANSITION_FORWARD_BACK));
NavigateToPendingEntry(NO_RELOAD);
}
| 6,849 |
67,522 | 0 | static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
ssize_t size, void *private)
{
ext4_io_end_t *io_end = private;
/* if not async direct IO just return */
if (!io_end)
return 0;
ext_debug("ext4_end_io_dio(): io_end 0x%p "
"for inode %lu, iocb 0x%p, offset %llu, size %zd\n",
io_end, io_end->inode->i_ino, iocb, offset, size);
/*
* Error during AIO DIO. We cannot convert unwritten extents as the
* data was not written. Just clear the unwritten flag and drop io_end.
*/
if (size <= 0) {
ext4_clear_io_unwritten_flag(io_end);
size = 0;
}
io_end->offset = offset;
io_end->size = size;
ext4_put_io_end(io_end);
return 0;
}
| 6,850 |
68,750 | 0 | static size_t pipe_zero(size_t bytes, struct iov_iter *i)
{
struct pipe_inode_info *pipe = i->pipe;
size_t n, off;
int idx;
if (!sanity(i))
return 0;
bytes = n = push_pipe(i, bytes, &idx, &off);
if (unlikely(!n))
return 0;
for ( ; n; idx = next_idx(idx, pipe), off = 0) {
size_t chunk = min_t(size_t, n, PAGE_SIZE - off);
memzero_page(pipe->bufs[idx].page, off, chunk);
i->idx = idx;
i->iov_offset = off + chunk;
n -= chunk;
}
i->count -= bytes;
return bytes;
}
| 6,851 |
19,419 | 0 | static void efx_remove_eventq(struct efx_channel *channel)
{
netif_dbg(channel->efx, drv, channel->efx->net_dev,
"chan %d remove event queue\n", channel->channel);
efx_nic_remove_eventq(channel);
}
| 6,852 |
168,031 | 0 | void AutofillManager::DisambiguateAddressUploadTypes(FormStructure* form,
size_t current_index) {
ServerFieldTypeSet matching_types;
size_t next_index = current_index + 1;
if (next_index < form->field_count() &&
form->field(next_index)->Type().GetStorableType() == ADDRESS_HOME_LINE2 &&
form->field(next_index)->possible_types().count(EMPTY_TYPE)) {
matching_types.insert(ADDRESS_HOME_LINE1);
} else {
matching_types.insert(ADDRESS_HOME_STREET_ADDRESS);
}
AutofillField* field = form->field(current_index);
field->set_possible_types(matching_types);
}
| 6,853 |
169,613 | 0 | int32_t TestURLLoader::OpenWithPrefetchBufferThreshold(int32_t lower,
int32_t upper) {
pp::URLRequestInfo request(instance_);
request.SetURL("test_url_loader_data/hello.txt");
request.SetPrefetchBufferLowerThreshold(lower);
request.SetPrefetchBufferUpperThreshold(upper);
return OpenUntrusted(request, NULL);
}
| 6,854 |
160,014 | 0 | int BackendImpl::CreateEntry(const std::string& key, Entry** entry,
const CompletionCallback& callback) {
DCHECK(!callback.is_null());
background_queue_.CreateEntry(key, entry, callback);
return net::ERR_IO_PENDING;
}
| 6,855 |
73,741 | 0 | static tsize_t tiff_writeproc(thandle_t clientdata, tdata_t data, tsize_t size)
{
tiff_handle *th = (tiff_handle *)clientdata;
gdIOCtx *ctx = th->ctx;
size = (ctx->putBuf)(ctx, data, size);
if(size + th->pos>th->size) {
th->size = size + th->pos;
th->pos += size;
}
return size;
}
| 6,856 |
128,855 | 0 | void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* referencedElement)
{
ASSERT(referencedElement);
HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elementDependencies.find(referencedElement);
if (it == m_elementDependencies.end())
return;
ASSERT(it->key == referencedElement);
m_elementDependencies.remove(it);
}
| 6,857 |
130,066 | 0 | void VariationsService::StartGoogleUpdateRegistrySync() {
DCHECK(thread_checker_.CalledOnValidThread());
registry_syncer_.RequestRegistrySync();
}
| 6,858 |
118,429 | 0 | void RenderFrameImpl::OnChildFrameProcessGone() {
if (compositing_helper_)
compositing_helper_->ChildFrameGone();
}
| 6,859 |
138,297 | 0 | void AXTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) {
if (!m_layoutObject || !m_layoutObject->isTableCell())
return;
LayoutTableCell* cell = toLayoutTableCell(m_layoutObject);
columnRange.first = cell->table()->absoluteColumnToEffectiveColumn(
cell->absoluteColumnIndex());
columnRange.second = cell->table()->absoluteColumnToEffectiveColumn(
cell->absoluteColumnIndex() + cell->colSpan()) -
columnRange.first;
}
| 6,860 |
181,443 | 1 | static int ext4_write_end(struct file *file,
struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata)
{
handle_t *handle = ext4_journal_current_handle();
struct inode *inode = mapping->host;
loff_t old_size = inode->i_size;
int ret = 0, ret2;
int i_size_changed = 0;
trace_ext4_write_end(inode, pos, len, copied);
if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) {
ret = ext4_jbd2_file_inode(handle, inode);
if (ret) {
unlock_page(page);
put_page(page);
goto errout;
}
}
if (ext4_has_inline_data(inode)) {
ret = ext4_write_inline_data_end(inode, pos, len,
copied, page);
if (ret < 0)
goto errout;
copied = ret;
} else
copied = block_write_end(file, mapping, pos,
len, copied, page, fsdata);
/*
* it's important to update i_size while still holding page lock:
* page writeout could otherwise come in and zero beyond i_size.
*/
i_size_changed = ext4_update_inode_size(inode, pos + copied);
unlock_page(page);
put_page(page);
if (old_size < pos)
pagecache_isize_extended(inode, old_size, pos);
/*
* Don't mark the inode dirty under page lock. First, it unnecessarily
* makes the holding time of page lock longer. Second, it forces lock
* ordering of page lock and transaction start for journaling
* filesystems.
*/
if (i_size_changed)
ext4_mark_inode_dirty(handle, inode);
if (pos + len > inode->i_size && ext4_can_truncate(inode))
/* if we have allocated more blocks and copied
* less. We will have blocks allocated outside
* inode->i_size. So truncate them
*/
ext4_orphan_add(handle, inode);
errout:
ret2 = ext4_journal_stop(handle);
if (!ret)
ret = ret2;
if (pos + len > inode->i_size) {
ext4_truncate_failed_write(inode);
/*
* If truncate failed early the inode might still be
* on the orphan list; we need to make sure the inode
* is removed from the orphan list in that case.
*/
if (inode->i_nlink)
ext4_orphan_del(NULL, inode);
}
return ret ? ret : copied;
}
| 6,861 |
123,452 | 0 | void ImageBitmapFactories::addLoader(PassRefPtr<ImageBitmapLoader> loader)
{
m_pendingLoaders.add(loader);
}
| 6,862 |
36,030 | 0 | static int ceph_x_should_authenticate(struct ceph_auth_client *ac)
{
struct ceph_x_info *xi = ac->private;
int need;
ceph_x_validate_tickets(ac, &need);
dout("ceph_x_should_authenticate want=%d need=%d have=%d\n",
ac->want_keys, need, xi->have_keys);
return need != 0;
}
| 6,863 |
180,688 | 1 | get_princs_2_svc(gprincs_arg *arg, struct svc_req *rqstp)
{
static gprincs_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
const char *errmsg = NULL;
xdr_free(xdr_gprincs_ret, &ret);
if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))
goto exit_func;
if ((ret.code = check_handle((void *)handle)))
goto exit_func;
ret.api_version = handle->api_version;
if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {
ret.code = KADM5_FAILURE;
goto exit_func;
}
prime_arg = arg->exp;
if (prime_arg == NULL)
prime_arg = "*";
if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context,
rqst2name(rqstp),
ACL_LIST,
NULL,
NULL)) {
ret.code = KADM5_AUTH_LIST;
log_unauth("kadm5_get_principals", prime_arg,
&client_name, &service_name, rqstp);
} else {
ret.code = kadm5_get_principals((void *)handle,
arg->exp, &ret.princs,
&ret.count);
if( ret.code != 0 )
errmsg = krb5_get_error_message(handle->context, ret.code);
log_done("kadm5_get_principals", prime_arg, errmsg,
&client_name, &service_name, rqstp);
if (errmsg != NULL)
krb5_free_error_message(handle->context, errmsg);
}
gss_release_buffer(&minor_stat, &client_name);
gss_release_buffer(&minor_stat, &service_name);
exit_func:
free_server_handle(handle);
return &ret;
}
| 6,864 |
132,310 | 0 | void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) {
TRACE_EVENT1("navigation", "RenderFrameImpl::didFinishLoad",
"id", routing_id_);
DCHECK(!frame_ || frame_ == frame);
WebDataSource* ds = frame->dataSource();
DocumentState* document_state = DocumentState::FromDataSource(ds);
if (document_state->finish_load_time().is_null()) {
if (!frame->parent()) {
TRACE_EVENT_INSTANT0("WebCore", "LoadFinished",
TRACE_EVENT_SCOPE_PROCESS);
}
document_state->set_finish_load_time(Time::Now());
}
FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
DidFinishLoad(frame));
FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad());
if (is_swapped_out())
return;
Send(new FrameHostMsg_DidFinishLoad(routing_id_,
ds->request().url()));
}
| 6,865 |
83,985 | 0 | GF_HEVCConfig *HEVC_DuplicateConfig(GF_HEVCConfig *cfg)
{
char *data;
u32 data_size;
GF_HEVCConfig *new_cfg;
GF_BitStream *bs;
if (!cfg) return NULL;
bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
gf_odf_hevc_cfg_write_bs(cfg, bs);
gf_bs_get_content(bs, &data, &data_size);
gf_bs_del(bs);
bs = gf_bs_new(data, data_size, GF_BITSTREAM_READ);
new_cfg = gf_odf_hevc_cfg_read_bs(bs, cfg->is_lhvc);
new_cfg->is_lhvc = cfg->is_lhvc;
gf_bs_del(bs);
gf_free(data);
return new_cfg;
}
| 6,866 |
119,159 | 0 | void XMLHttpRequest::clearRequest()
{
m_requestHeaders.clear();
m_requestEntityBody = 0;
}
| 6,867 |
126,804 | 0 | bool BrowserView::IsBookmarkBarVisible() const {
return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) &&
active_bookmark_bar_ &&
(active_bookmark_bar_->GetPreferredSize().height() != 0);
}
| 6,868 |
174,990 | 0 | status_t CameraDeviceClient::getRotationTransformLocked(int32_t* transform) {
ALOGV("%s: begin", __FUNCTION__);
if (transform == NULL) {
ALOGW("%s: null transform", __FUNCTION__);
return BAD_VALUE;
}
*transform = 0;
const CameraMetadata& staticInfo = mDevice->info();
camera_metadata_ro_entry_t entry = staticInfo.find(ANDROID_SENSOR_ORIENTATION);
if (entry.count == 0) {
ALOGE("%s: Camera %d: Can't find android.sensor.orientation in "
"static metadata!", __FUNCTION__, mCameraId);
return INVALID_OPERATION;
}
int32_t& flags = *transform;
int orientation = entry.data.i32[0];
switch (orientation) {
case 0:
flags = 0;
break;
case 90:
flags = NATIVE_WINDOW_TRANSFORM_ROT_90;
break;
case 180:
flags = NATIVE_WINDOW_TRANSFORM_ROT_180;
break;
case 270:
flags = NATIVE_WINDOW_TRANSFORM_ROT_270;
break;
default:
ALOGE("%s: Invalid HAL android.sensor.orientation value: %d",
__FUNCTION__, orientation);
return INVALID_OPERATION;
}
/**
* This magic flag makes surfaceflinger un-rotate the buffers
* to counter the extra global device UI rotation whenever the user
* physically rotates the device.
*
* By doing this, the camera buffer always ends up aligned
* with the physical camera for a "see through" effect.
*
* In essence, the buffer only gets rotated during preview use-cases.
* The user is still responsible to re-create streams of the proper
* aspect ratio, or the preview will end up looking non-uniformly
* stretched.
*/
flags |= NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
ALOGV("%s: final transform = 0x%x", __FUNCTION__, flags);
return OK;
}
| 6,869 |
75,164 | 0 | conn *conn_new(const int sfd, enum conn_states init_state,
const int event_flags,
const int read_buffer_size, enum network_transport transport,
struct event_base *base) {
conn *c;
assert(sfd >= 0 && sfd < max_fds);
c = conns[sfd];
if (NULL == c) {
if (!(c = (conn *)calloc(1, sizeof(conn)))) {
STATS_LOCK();
stats.malloc_fails++;
STATS_UNLOCK();
fprintf(stderr, "Failed to allocate connection object\n");
return NULL;
}
MEMCACHED_CONN_CREATE(c);
c->rbuf = c->wbuf = 0;
c->ilist = 0;
c->suffixlist = 0;
c->iov = 0;
c->msglist = 0;
c->hdrbuf = 0;
c->rsize = read_buffer_size;
c->wsize = DATA_BUFFER_SIZE;
c->isize = ITEM_LIST_INITIAL;
c->suffixsize = SUFFIX_LIST_INITIAL;
c->iovsize = IOV_LIST_INITIAL;
c->msgsize = MSG_LIST_INITIAL;
c->hdrsize = 0;
c->rbuf = (char *)malloc((size_t)c->rsize);
c->wbuf = (char *)malloc((size_t)c->wsize);
c->ilist = (item **)malloc(sizeof(item *) * c->isize);
c->suffixlist = (char **)malloc(sizeof(char *) * c->suffixsize);
c->iov = (struct iovec *)malloc(sizeof(struct iovec) * c->iovsize);
c->msglist = (struct msghdr *)malloc(sizeof(struct msghdr) * c->msgsize);
if (c->rbuf == 0 || c->wbuf == 0 || c->ilist == 0 || c->iov == 0 ||
c->msglist == 0 || c->suffixlist == 0) {
conn_free(c);
STATS_LOCK();
stats.malloc_fails++;
STATS_UNLOCK();
fprintf(stderr, "Failed to allocate buffers for connection\n");
return NULL;
}
STATS_LOCK();
stats_state.conn_structs++;
STATS_UNLOCK();
c->sfd = sfd;
conns[sfd] = c;
}
c->transport = transport;
c->protocol = settings.binding_protocol;
/* unix socket mode doesn't need this, so zeroed out. but why
* is this done for every command? presumably for UDP
* mode. */
if (!settings.socketpath) {
c->request_addr_size = sizeof(c->request_addr);
} else {
c->request_addr_size = 0;
}
if (transport == tcp_transport && init_state == conn_new_cmd) {
if (getpeername(sfd, (struct sockaddr *) &c->request_addr,
&c->request_addr_size)) {
perror("getpeername");
memset(&c->request_addr, 0, sizeof(c->request_addr));
}
}
if (settings.verbose > 1) {
if (init_state == conn_listening) {
fprintf(stderr, "<%d server listening (%s)\n", sfd,
prot_text(c->protocol));
} else if (IS_UDP(transport)) {
fprintf(stderr, "<%d server listening (udp)\n", sfd);
} else if (c->protocol == negotiating_prot) {
fprintf(stderr, "<%d new auto-negotiating client connection\n",
sfd);
} else if (c->protocol == ascii_prot) {
fprintf(stderr, "<%d new ascii client connection.\n", sfd);
} else if (c->protocol == binary_prot) {
fprintf(stderr, "<%d new binary client connection.\n", sfd);
} else {
fprintf(stderr, "<%d new unknown (%d) client connection\n",
sfd, c->protocol);
assert(false);
}
}
c->state = init_state;
c->rlbytes = 0;
c->cmd = -1;
c->rbytes = c->wbytes = 0;
c->wcurr = c->wbuf;
c->rcurr = c->rbuf;
c->ritem = 0;
c->icurr = c->ilist;
c->suffixcurr = c->suffixlist;
c->ileft = 0;
c->suffixleft = 0;
c->iovused = 0;
c->msgcurr = 0;
c->msgused = 0;
c->authenticated = false;
c->last_cmd_time = current_time; /* initialize for idle kicker */
c->write_and_go = init_state;
c->write_and_free = 0;
c->item = 0;
c->noreply = false;
event_set(&c->event, sfd, event_flags, event_handler, (void *)c);
event_base_set(base, &c->event);
c->ev_flags = event_flags;
if (event_add(&c->event, 0) == -1) {
perror("event_add");
return NULL;
}
STATS_LOCK();
stats_state.curr_conns++;
stats.total_conns++;
STATS_UNLOCK();
MEMCACHED_CONN_ALLOCATE(c->sfd);
return c;
}
| 6,870 |
112,433 | 0 | void Document::decrementActiveParserCount()
{
--m_activeParserCount;
if (!frame())
return;
#if ENABLE(THREADED_HTML_PARSER)
loader()->checkLoadComplete();
#endif
frame()->loader()->checkLoadComplete();
}
| 6,871 |
185,383 | 1 | bool IsTraceEventArgsWhitelisted(const char* category_group_name,
const char* event_name) {
if (base::MatchPattern(category_group_name, "toplevel") &&
base::MatchPattern(event_name, "*")) {
return true;
}
return false;
}
| 6,872 |
38,150 | 0 | static int magicmouse_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
__u8 feature[] = { 0xd7, 0x01 };
struct magicmouse_sc *msc;
struct hid_report *report;
int ret;
msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
if (msc == NULL) {
hid_err(hdev, "can't alloc magicmouse descriptor\n");
return -ENOMEM;
}
msc->scroll_accel = SCROLL_ACCEL_DEFAULT;
msc->quirks = id->driver_data;
hid_set_drvdata(hdev, msc);
ret = hid_parse(hdev);
if (ret) {
hid_err(hdev, "magicmouse hid parse failed\n");
return ret;
}
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
if (ret) {
hid_err(hdev, "magicmouse hw start failed\n");
return ret;
}
if (!msc->input) {
hid_err(hdev, "magicmouse input not registered\n");
ret = -ENOMEM;
goto err_stop_hw;
}
if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
report = hid_register_report(hdev, HID_INPUT_REPORT,
MOUSE_REPORT_ID);
else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
report = hid_register_report(hdev, HID_INPUT_REPORT,
TRACKPAD_REPORT_ID);
report = hid_register_report(hdev, HID_INPUT_REPORT,
DOUBLE_REPORT_ID);
}
if (!report) {
hid_err(hdev, "unable to register touch report\n");
ret = -ENOMEM;
goto err_stop_hw;
}
report->size = 6;
/*
* Some devices repond with 'invalid report id' when feature
* report switching it into multitouch mode is sent to it.
*
* This results in -EIO from the _raw low-level transport callback,
* but there seems to be no other way of switching the mode.
* Thus the super-ugly hacky success check below.
*/
ret = hid_hw_raw_request(hdev, feature[0], feature, sizeof(feature),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
if (ret != -EIO && ret != sizeof(feature)) {
hid_err(hdev, "unable to request touch data (%d)\n", ret);
goto err_stop_hw;
}
return 0;
err_stop_hw:
hid_hw_stop(hdev);
return ret;
}
| 6,873 |
126,366 | 0 | void BrowserWindowGtk::HideUnsupportedWindowFeatures() {
if (!IsTabStripSupported())
tabstrip_->Hide();
if (!IsToolbarSupported())
toolbar_->Hide();
}
| 6,874 |
87,879 | 0 | bitset_set_range(ScanEnv *env, BitSetRef bs, int from, int to)
{
int i;
for (i = from; i <= to && i < SINGLE_BYTE_SIZE; i++) {
BITSET_SET_BIT_CHKDUP(bs, i);
}
}
| 6,875 |
270 | 0 | bgp_mp_unreach_parse (struct bgp_attr_parser_args *args,
struct bgp_nlri *mp_withdraw)
{
struct stream *s;
afi_t afi;
safi_t safi;
u_int16_t withdraw_len;
int ret;
struct peer *const peer = args->peer;
const bgp_size_t length = args->length;
s = peer->ibuf;
#define BGP_MP_UNREACH_MIN_SIZE 3
if ((length > STREAM_READABLE(s)) || (length < BGP_MP_UNREACH_MIN_SIZE))
return BGP_ATTR_PARSE_ERROR;
afi = stream_getw (s);
safi = stream_getc (s);
withdraw_len = length - BGP_MP_UNREACH_MIN_SIZE;
if (safi != SAFI_MPLS_LABELED_VPN)
{
ret = bgp_nlri_sanity_check (peer, afi, stream_pnt (s), withdraw_len);
if (ret < 0)
return BGP_ATTR_PARSE_ERROR;
}
mp_withdraw->afi = afi;
mp_withdraw->safi = safi;
mp_withdraw->nlri = stream_pnt (s);
mp_withdraw->length = withdraw_len;
stream_forward_getp (s, withdraw_len);
return BGP_ATTR_PARSE_PROCEED;
}
| 6,876 |
20,431 | 0 | static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
gfp_t wait)
{
journal_t *journal = EXT4_SB(sb)->s_journal;
WARN_ON(PageChecked(page));
if (!page_has_buffers(page))
return 0;
if (journal)
return jbd2_journal_try_to_free_buffers(journal, page,
wait & ~__GFP_WAIT);
return try_to_free_buffers(page);
}
| 6,877 |
96,490 | 0 | int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
uint8_t ipproto,
const char *alproto_name,
AppProto alproto,
uint16_t min_depth, uint16_t max_depth,
ProbingParserFPtr ProbingParserTs,
ProbingParserFPtr ProbingParserTc)
{
SCEnter();
char param[100];
int r;
ConfNode *node;
ConfNode *port_node = NULL;
int config = 0;
r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.",
alproto_name, ".detection-ports");
if (r < 0) {
SCLogError(SC_ERR_FATAL, "snprintf failure.");
exit(EXIT_FAILURE);
} else if (r > (int)sizeof(param)) {
SCLogError(SC_ERR_FATAL, "buffer not big enough to write param.");
exit(EXIT_FAILURE);
}
node = ConfGetNode(param);
if (node == NULL) {
SCLogDebug("Entry for %s not found.", param);
r = snprintf(param, sizeof(param), "%s%s%s%s%s", "app-layer.protocols.",
alproto_name, ".", ipproto_name, ".detection-ports");
if (r < 0) {
SCLogError(SC_ERR_FATAL, "snprintf failure.");
exit(EXIT_FAILURE);
} else if (r > (int)sizeof(param)) {
SCLogError(SC_ERR_FATAL, "buffer not big enough to write param.");
exit(EXIT_FAILURE);
}
node = ConfGetNode(param);
if (node == NULL)
goto end;
}
/* detect by destination port of the flow (e.g. port 53 for DNS) */
port_node = ConfNodeLookupChild(node, "dp");
if (port_node == NULL)
port_node = ConfNodeLookupChild(node, "toserver");
if (port_node != NULL && port_node->val != NULL) {
AppLayerProtoDetectPPRegister(ipproto,
port_node->val,
alproto,
min_depth, max_depth,
STREAM_TOSERVER, /* to indicate dp */
ProbingParserTs, ProbingParserTc);
}
/* detect by source port of flow */
port_node = ConfNodeLookupChild(node, "sp");
if (port_node == NULL)
port_node = ConfNodeLookupChild(node, "toclient");
if (port_node != NULL && port_node->val != NULL) {
AppLayerProtoDetectPPRegister(ipproto,
port_node->val,
alproto,
min_depth, max_depth,
STREAM_TOCLIENT, /* to indicate sp */
ProbingParserTc, ProbingParserTs);
}
config = 1;
end:
SCReturnInt(config);
}
| 6,878 |
84,025 | 0 | u32 gf_isom_oinf_size_entry(void *entry)
{
GF_OperatingPointsInformation* ptr = (GF_OperatingPointsInformation *)entry;
u32 size = 0, i ,j, count;
if (!ptr) return 0;
size += 3; //scalability_mask + reserved + num_profile_tier_level
count=gf_list_count(ptr->profile_tier_levels);
size += count * 12; //general_profile_space + general_tier_flag + general_profile_idc + general_profile_compatibility_flags + general_constraint_indicator_flags + general_level_idc
size += 2;//num_operating_points
count=gf_list_count(ptr->operating_points);
for (i = 0; i < count; i++) {
LHEVC_OperatingPoint *op = (LHEVC_OperatingPoint *)gf_list_get(ptr->operating_points, i);;
size += 2/*output_layer_set_idx*/ + 1/*max_temporal_id*/ + 1/*layer_count*/;
size += op->layer_count * 2;
size += 9;
if (op->frame_rate_info_flag) {
size += 3;
}
if (op->bit_rate_info_flag) {
size += 8;
}
}
size += 1;//max_layer_count
count=gf_list_count(ptr->dependency_layers);
for (i = 0; i < count; i++) {
LHEVC_DependentLayer *dep = (LHEVC_DependentLayer *)gf_list_get(ptr->dependency_layers, i);
size += 1/*dependent_layerID*/ + 1/*num_layers_dependent_on*/;
size += dep->num_layers_dependent_on * 1;//dependent_on_layerID
for (j = 0; j < 16; j++) {
if (ptr->scalability_mask & (1 << j))
size += 1;//dimension_identifier
}
}
return size;
}
| 6,879 |
110,599 | 0 | error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM(
uint32 immediate_data_size, const gles2::RequestExtensionCHROMIUM& c) {
Bucket* bucket = GetBucket(c.bucket_id);
if (!bucket || bucket->size() == 0) {
return error::kInvalidArguments;
}
std::string feature_str;
if (!bucket->GetAsString(&feature_str)) {
return error::kInvalidArguments;
}
bool std_derivatives_enabled =
feature_info_->feature_flags().oes_standard_derivatives;
bool webglsl_enabled =
feature_info_->feature_flags().chromium_webglsl;
feature_info_->AddFeatures(feature_str.c_str());
bool initialization_required = false;
if (force_webgl_glsl_validation_ && !derivatives_explicitly_enabled_) {
size_t derivatives_offset = feature_str.find(kOESDerivativeExtension);
if (std::string::npos != derivatives_offset) {
derivatives_explicitly_enabled_ = true;
initialization_required = true;
}
}
if (std_derivatives_enabled !=
feature_info_->feature_flags().oes_standard_derivatives ||
webglsl_enabled !=
feature_info_->feature_flags().chromium_webglsl ||
initialization_required) {
InitializeShaderTranslator();
}
UpdateCapabilities();
return error::kNoError;
}
| 6,880 |
146,280 | 0 | void WebGLRenderingContextBase::DrawingBufferClientRestoreMaskAndClearValues() {
if (!ContextGL())
return;
bool color_mask_alpha =
color_mask_[3] && active_scoped_rgb_emulation_color_masks_ == 0;
ContextGL()->ColorMask(color_mask_[0], color_mask_[1], color_mask_[2],
color_mask_alpha);
ContextGL()->DepthMask(depth_mask_);
ContextGL()->StencilMaskSeparate(GL_FRONT, stencil_mask_);
ContextGL()->ClearColor(clear_color_[0], clear_color_[1], clear_color_[2],
clear_color_[3]);
ContextGL()->ClearDepthf(clear_depth_);
ContextGL()->ClearStencil(clear_stencil_);
}
| 6,881 |
108,821 | 0 | bool CompareTrees(base::DictionaryValue* first, base::DictionaryValue* second) {
string16 name1;
string16 name2;
if (!first->GetString(content::kFrameTreeNodeNameKey, &name1) ||
!second->GetString(content::kFrameTreeNodeNameKey, &name2))
return false;
if (name1 != name2)
return false;
int id1 = 0;
int id2 = 0;
if (!first->GetInteger(content::kFrameTreeNodeIdKey, &id1) ||
!second->GetInteger(content::kFrameTreeNodeIdKey, &id2)) {
return false;
}
if (id1 != id2)
return false;
ListValue* subtree1 = NULL;
ListValue* subtree2 = NULL;
bool result1 = first->GetList(content::kFrameTreeNodeSubtreeKey, &subtree1);
bool result2 = second->GetList(content::kFrameTreeNodeSubtreeKey, &subtree2);
if (!result1 && !result2)
return true;
if (!result1 || !result2)
return false;
if (subtree1->GetSize() != subtree2->GetSize())
return false;
base::DictionaryValue* child1 = NULL;
base::DictionaryValue* child2 = NULL;
for (size_t i = 0; i < subtree1->GetSize(); ++i) {
if (!subtree1->GetDictionary(i, &child1) ||
!subtree2->GetDictionary(i, &child2)) {
return false;
}
if (!CompareTrees(child1, child2))
return false;
}
return true;
}
| 6,882 |
172,255 | 0 | static jobject android_net_wifi_get_ring_buffer_status (JNIEnv *env, jclass cls, jint iface) {
JNIHelper helper(env);
wifi_interface_handle handle = getIfaceHandle(helper, cls, iface);
ALOGD("android_net_wifi_get_ring_buffer_status = %p", handle);
if (handle == 0) {
return NULL;
}
u32 num_rings = 10;
wifi_ring_buffer_status *status =
(wifi_ring_buffer_status *)malloc(sizeof(wifi_ring_buffer_status) * num_rings);
if (!status) return NULL;
memset(status, 0, sizeof(wifi_ring_buffer_status) * num_rings);
wifi_error result = hal_fn.wifi_get_ring_buffers_status(handle, &num_rings, status);
if (result == WIFI_SUCCESS) {
ALOGD("status is %p, number is %d", status, num_rings);
JNIObject<jobjectArray> ringBuffersStatus = helper.newObjectArray(
num_rings, "com/android/server/wifi/WifiNative$RingBufferStatus", NULL);
wifi_ring_buffer_status *tmp = status;
for(u32 i = 0; i < num_rings; i++, tmp++) {
JNIObject<jobject> ringStatus = helper.createObject(
"com/android/server/wifi/WifiNative$RingBufferStatus");
if (ringStatus == NULL) {
ALOGE("Error in creating ringBufferStatus");
free(status);
return NULL;
}
char name[32];
for(int j = 0; j < 32; j++) {
name[j] = tmp->name[j];
}
helper.setStringField(ringStatus, "name", name);
helper.setIntField(ringStatus, "flag", tmp->flags);
helper.setIntField(ringStatus, "ringBufferId", tmp->ring_id);
helper.setIntField(ringStatus, "ringBufferByteSize", tmp->ring_buffer_byte_size);
helper.setIntField(ringStatus, "verboseLevel", tmp->verbose_level);
helper.setIntField(ringStatus, "writtenBytes", tmp->written_bytes);
helper.setIntField(ringStatus, "readBytes", tmp->read_bytes);
helper.setIntField(ringStatus, "writtenRecords", tmp->written_records);
helper.setObjectArrayElement(ringBuffersStatus, i, ringStatus);
}
free(status);
return ringBuffersStatus.detach();
} else {
free(status);
return NULL;
}
}
| 6,883 |
29,648 | 0 | void sctp_v6_pf_init(void)
{
/* Register the SCTP specific PF_INET6 functions. */
sctp_register_pf(&sctp_pf_inet6, PF_INET6);
/* Register the SCTP specific AF_INET6 functions. */
sctp_register_af(&sctp_af_inet6);
}
| 6,884 |
174,186 | 0 | OMX_ERRORTYPE SoftVPXEncoder::internalSetVp8Params(
const OMX_VIDEO_PARAM_VP8TYPE* vp8Params) {
if (vp8Params->nPortIndex != kOutputPortIndex) {
return OMX_ErrorUnsupportedIndex;
}
if (vp8Params->eProfile != OMX_VIDEO_VP8ProfileMain) {
return OMX_ErrorBadParameter;
}
if (vp8Params->eLevel == OMX_VIDEO_VP8Level_Version0 ||
vp8Params->eLevel == OMX_VIDEO_VP8Level_Version1 ||
vp8Params->eLevel == OMX_VIDEO_VP8Level_Version2 ||
vp8Params->eLevel == OMX_VIDEO_VP8Level_Version3) {
mLevel = vp8Params->eLevel;
} else {
return OMX_ErrorBadParameter;
}
if (vp8Params->nDCTPartitions <= kMaxDCTPartitions) {
mDCTPartitions = vp8Params->nDCTPartitions;
} else {
return OMX_ErrorBadParameter;
}
mErrorResilience = vp8Params->bErrorResilientMode;
return OMX_ErrorNone;
}
| 6,885 |
30,926 | 0 | int setup_arg_pages(struct linux_binprm *bprm,
unsigned long stack_top,
int executable_stack)
{
unsigned long ret;
unsigned long stack_shift;
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma = bprm->vma;
struct vm_area_struct *prev = NULL;
unsigned long vm_flags;
unsigned long stack_base;
unsigned long stack_size;
unsigned long stack_expand;
unsigned long rlim_stack;
#ifdef CONFIG_STACK_GROWSUP
/* Limit stack size to 1GB */
stack_base = rlimit_max(RLIMIT_STACK);
if (stack_base > (1 << 30))
stack_base = 1 << 30;
/* Make sure we didn't let the argument array grow too large. */
if (vma->vm_end - vma->vm_start > stack_base)
return -ENOMEM;
stack_base = PAGE_ALIGN(stack_top - stack_base);
stack_shift = vma->vm_start - stack_base;
mm->arg_start = bprm->p - stack_shift;
bprm->p = vma->vm_end - stack_shift;
#else
stack_top = arch_align_stack(stack_top);
stack_top = PAGE_ALIGN(stack_top);
if (unlikely(stack_top < mmap_min_addr) ||
unlikely(vma->vm_end - vma->vm_start >= stack_top - mmap_min_addr))
return -ENOMEM;
stack_shift = vma->vm_end - stack_top;
bprm->p -= stack_shift;
mm->arg_start = bprm->p;
#endif
if (bprm->loader)
bprm->loader -= stack_shift;
bprm->exec -= stack_shift;
down_write(&mm->mmap_sem);
vm_flags = VM_STACK_FLAGS;
/*
* Adjust stack execute permissions; explicitly enable for
* EXSTACK_ENABLE_X, disable for EXSTACK_DISABLE_X and leave alone
* (arch default) otherwise.
*/
if (unlikely(executable_stack == EXSTACK_ENABLE_X))
vm_flags |= VM_EXEC;
else if (executable_stack == EXSTACK_DISABLE_X)
vm_flags &= ~VM_EXEC;
vm_flags |= mm->def_flags;
vm_flags |= VM_STACK_INCOMPLETE_SETUP;
ret = mprotect_fixup(vma, &prev, vma->vm_start, vma->vm_end,
vm_flags);
if (ret)
goto out_unlock;
BUG_ON(prev != vma);
/* Move stack pages down in memory. */
if (stack_shift) {
ret = shift_arg_pages(vma, stack_shift);
if (ret)
goto out_unlock;
}
/* mprotect_fixup is overkill to remove the temporary stack flags */
vma->vm_flags &= ~VM_STACK_INCOMPLETE_SETUP;
stack_expand = 131072UL; /* randomly 32*4k (or 2*64k) pages */
stack_size = vma->vm_end - vma->vm_start;
/*
* Align this down to a page boundary as expand_stack
* will align it up.
*/
rlim_stack = rlimit(RLIMIT_STACK) & PAGE_MASK;
#ifdef CONFIG_STACK_GROWSUP
if (stack_size + stack_expand > rlim_stack)
stack_base = vma->vm_start + rlim_stack;
else
stack_base = vma->vm_end + stack_expand;
#else
if (stack_size + stack_expand > rlim_stack)
stack_base = vma->vm_end - rlim_stack;
else
stack_base = vma->vm_start - stack_expand;
#endif
current->mm->start_stack = bprm->p;
ret = expand_stack(vma, stack_base);
if (ret)
ret = -EFAULT;
out_unlock:
up_write(&mm->mmap_sem);
return ret;
}
| 6,886 |
78,236 | 0 | static int cac_get_challenge(sc_card_t *card, u8 *rnd, size_t len)
{
/* CAC requires 8 byte response */
u8 rbuf[8];
u8 *rbufp = &rbuf[0];
size_t out_len = sizeof rbuf;
int r;
LOG_FUNC_CALLED(card->ctx);
r = cac_apdu_io(card, 0x84, 0x00, 0x00, NULL, 0, &rbufp, &out_len);
LOG_TEST_RET(card->ctx, r, "Could not get challenge");
if (len < out_len) {
out_len = len;
}
memcpy(rnd, rbuf, out_len);
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, (int) out_len);
}
| 6,887 |
146,819 | 0 | int Document::RequestIdleCallback(IdleRequestCallback* callback,
const IdleRequestOptions& options) {
return EnsureScriptedIdleTaskController().RegisterCallback(callback, options);
}
| 6,888 |
130,668 | 0 | static void callbackFunctionAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectV8Internal::callbackFunctionAttributeAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 6,889 |
5,007 | 0 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
{
ctx->cert = x;
}
| 6,890 |
94,533 | 0 | static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
struct bt_security sec;
struct bt_power pwr;
struct l2cap_conn *conn;
int len, err = 0;
u32 opt;
BT_DBG("sk %p", sk);
if (level == SOL_L2CAP)
return l2cap_sock_setsockopt_old(sock, optname, optval, optlen);
if (level != SOL_BLUETOOTH)
return -ENOPROTOOPT;
lock_sock(sk);
switch (optname) {
case BT_SECURITY:
if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
chan->chan_type != L2CAP_CHAN_RAW) {
err = -EINVAL;
break;
}
sec.level = BT_SECURITY_LOW;
len = min_t(unsigned int, sizeof(sec), optlen);
if (copy_from_user((char *) &sec, optval, len)) {
err = -EFAULT;
break;
}
if (sec.level < BT_SECURITY_LOW ||
sec.level > BT_SECURITY_HIGH) {
err = -EINVAL;
break;
}
chan->sec_level = sec.level;
if (!chan->conn)
break;
conn = chan->conn;
/*change security for LE channels */
if (chan->scid == L2CAP_CID_LE_DATA) {
if (!conn->hcon->out) {
err = -EINVAL;
break;
}
if (smp_conn_security(conn, sec.level))
break;
sk->sk_state = BT_CONFIG;
chan->state = BT_CONFIG;
/* or for ACL link */
} else if ((sk->sk_state == BT_CONNECT2 &&
test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) ||
sk->sk_state == BT_CONNECTED) {
if (!l2cap_chan_check_security(chan))
set_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags);
else
sk->sk_state_change(sk);
} else {
err = -EINVAL;
}
break;
case BT_DEFER_SETUP:
if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
err = -EINVAL;
break;
}
if (get_user(opt, (u32 __user *) optval)) {
err = -EFAULT;
break;
}
if (opt)
set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
else
clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
break;
case BT_FLUSHABLE:
if (get_user(opt, (u32 __user *) optval)) {
err = -EFAULT;
break;
}
if (opt > BT_FLUSHABLE_ON) {
err = -EINVAL;
break;
}
if (opt == BT_FLUSHABLE_OFF) {
struct l2cap_conn *conn = chan->conn;
/* proceed further only when we have l2cap_conn and
No Flush support in the LM */
if (!conn || !lmp_no_flush_capable(conn->hcon->hdev)) {
err = -EINVAL;
break;
}
}
if (opt)
set_bit(FLAG_FLUSHABLE, &chan->flags);
else
clear_bit(FLAG_FLUSHABLE, &chan->flags);
break;
case BT_POWER:
if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
chan->chan_type != L2CAP_CHAN_RAW) {
err = -EINVAL;
break;
}
pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
len = min_t(unsigned int, sizeof(pwr), optlen);
if (copy_from_user((char *) &pwr, optval, len)) {
err = -EFAULT;
break;
}
if (pwr.force_active)
set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
else
clear_bit(FLAG_FORCE_ACTIVE, &chan->flags);
break;
case BT_CHANNEL_POLICY:
if (!enable_hs) {
err = -ENOPROTOOPT;
break;
}
if (get_user(opt, (u32 __user *) optval)) {
err = -EFAULT;
break;
}
if (opt > BT_CHANNEL_POLICY_AMP_PREFERRED) {
err = -EINVAL;
break;
}
if (chan->mode != L2CAP_MODE_ERTM &&
chan->mode != L2CAP_MODE_STREAMING) {
err = -EOPNOTSUPP;
break;
}
chan->chan_policy = (u8) opt;
break;
default:
err = -ENOPROTOOPT;
break;
}
release_sock(sk);
return err;
}
| 6,891 |
84,024 | 0 | GF_OperatingPointsInformation *gf_isom_oinf_new_entry()
{
GF_OperatingPointsInformation* ptr;
GF_SAFEALLOC(ptr, GF_OperatingPointsInformation);
if (ptr) {
ptr->profile_tier_levels = gf_list_new();
ptr->operating_points = gf_list_new();
ptr->dependency_layers = gf_list_new();
}
return ptr;
}
| 6,892 |
124,675 | 0 | LayoutUnit RenderBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const
{
LayoutUnit right = offsetFromFloats;
if (applyTextIndent && !style()->isLeftToRightDirection())
right -= textIndentOffset();
return right;
}
| 6,893 |
177,556 | 0 | virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
file_size_ += pkt->data.frame.sz;
}
| 6,894 |
54,068 | 0 | static void in_dev_rcu_put(struct rcu_head *head)
{
struct in_device *idev = container_of(head, struct in_device, rcu_head);
in_dev_put(idev);
}
| 6,895 |
59,320 | 0 | static int walk_pgd_range(unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
pgd_t *pgd;
unsigned long next;
int err = 0;
pgd = pgd_offset(walk->mm, addr);
do {
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd)) {
if (walk->pte_hole)
err = walk->pte_hole(addr, next, walk);
if (err)
break;
continue;
}
if (walk->pmd_entry || walk->pte_entry)
err = walk_p4d_range(pgd, addr, next, walk);
if (err)
break;
} while (pgd++, addr = next, addr != end);
return err;
}
| 6,896 |
185,610 | 1 | void AppCacheUpdateJob::StartUpdate(AppCacheHost* host,
const GURL& new_master_resource) {
DCHECK(group_->update_job() == this);
DCHECK(!group_->is_obsolete());
bool is_new_pending_master_entry = false;
if (!new_master_resource.is_empty()) {
DCHECK(new_master_resource == host->pending_master_entry_url());
DCHECK(!new_master_resource.has_ref());
DCHECK(new_master_resource.GetOrigin() == manifest_url_.GetOrigin());
if (IsTerminating()) {
group_->QueueUpdate(host, new_master_resource);
return;
}
std::pair<PendingMasters::iterator, bool> ret =
pending_master_entries_.insert(
PendingMasters::value_type(new_master_resource, PendingHosts()));
is_new_pending_master_entry = ret.second;
ret.first->second.push_back(host);
host->AddObserver(this);
}
AppCacheGroup::UpdateAppCacheStatus update_status = group_->update_status();
if (update_status == AppCacheGroup::CHECKING ||
update_status == AppCacheGroup::DOWNLOADING) {
if (host) {
NotifySingleHost(host, APPCACHE_CHECKING_EVENT);
if (update_status == AppCacheGroup::DOWNLOADING)
NotifySingleHost(host, APPCACHE_DOWNLOADING_EVENT);
if (!new_master_resource.is_empty()) {
AddMasterEntryToFetchList(host, new_master_resource,
is_new_pending_master_entry);
}
}
return;
}
MadeProgress();
group_->SetUpdateAppCacheStatus(AppCacheGroup::CHECKING);
if (group_->HasCache()) {
base::TimeDelta kFullUpdateInterval = base::TimeDelta::FromHours(24);
update_type_ = UPGRADE_ATTEMPT;
base::TimeDelta time_since_last_check =
base::Time::Now() - group_->last_full_update_check_time();
doing_full_update_check_ = time_since_last_check > kFullUpdateInterval;
NotifyAllAssociatedHosts(APPCACHE_CHECKING_EVENT);
} else {
update_type_ = CACHE_ATTEMPT;
doing_full_update_check_ = true;
DCHECK(host);
NotifySingleHost(host, APPCACHE_CHECKING_EVENT);
}
if (!new_master_resource.is_empty()) {
AddMasterEntryToFetchList(host, new_master_resource,
is_new_pending_master_entry);
}
BrowserThread::PostAfterStartupTask(
FROM_HERE, base::ThreadTaskRunnerHandle::Get(),
base::Bind(&AppCacheUpdateJob::FetchManifest, weak_factory_.GetWeakPtr(),
true));
}
| 6,897 |
114,217 | 0 | bool CommandBufferProxyImpl::EnsureBackbuffer() {
if (last_state_.error != gpu::error::kNoError)
return false;
return Send(new GpuCommandBufferMsg_EnsureBackbuffer(route_id_));
}
| 6,898 |
214 | 0 | ftp_do_pasv (int csock, ip_address *addr, int *port)
{
if (!opt.server_response)
logputs (LOG_VERBOSE, "==> PASV ... ");
return ftp_pasv (csock, addr, port);
}
| 6,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.