unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
74,233
| 0
|
write_stats(void)
{
FILE *fp;
#ifdef DOSYNCTODR
struct timeval tv;
#if !defined(VMS)
int prio_set;
#endif
#ifdef HAVE_GETCLOCK
struct timespec ts;
#endif
int o_prio;
/*
* Sometimes having a Sun can be a drag.
*
* The kernel variable dosynctodr controls whether the system's
* soft clock is kept in sync with the battery clock. If it
* is zero, then the soft clock is not synced, and the battery
* clock is simply left to rot. That means that when the system
* reboots, the battery clock (which has probably gone wacky)
* sets the soft clock. That means ntpd starts off with a very
* confused idea of what time it is. It then takes a large
* amount of time to figure out just how wacky the battery clock
* has made things drift, etc, etc. The solution is to make the
* battery clock sync up to system time. The way to do THAT is
* to simply set the time of day to the current time of day, but
* as quickly as possible. This may, or may not be a sensible
* thing to do.
*
* CAVEAT: settimeofday() steps the sun clock by about 800 us,
* so setting DOSYNCTODR seems a bad idea in the
* case of us resolution
*/
#if !defined(VMS)
/*
* (prr) getpriority returns -1 on error, but -1 is also a valid
* return value (!), so instead we have to zero errno before the
* call and check it for non-zero afterwards.
*/
errno = 0;
prio_set = 0;
o_prio = getpriority(PRIO_PROCESS,0); /* Save setting */
/*
* (prr) if getpriority succeeded, call setpriority to raise
* scheduling priority as high as possible. If that succeeds
* as well, set the prio_set flag so we remember to reset
* priority to its previous value below. Note that on Solaris
* 2.6 (and beyond?), both getpriority and setpriority will fail
* with ESRCH, because sched_setscheduler (called from main) put
* us in the real-time scheduling class which setpriority
* doesn't know about. Being in the real-time class is better
* than anything setpriority can do, anyhow, so this error is
* silently ignored.
*/
if ((errno == 0) && (setpriority(PRIO_PROCESS,0,-20) == 0))
prio_set = 1; /* overdrive */
#endif /* VMS */
#ifdef HAVE_GETCLOCK
(void) getclock(TIMEOFDAY, &ts);
tv.tv_sec = ts.tv_sec;
tv.tv_usec = ts.tv_nsec / 1000;
#else /* not HAVE_GETCLOCK */
GETTIMEOFDAY(&tv,(struct timezone *)NULL);
#endif /* not HAVE_GETCLOCK */
if (ntp_set_tod(&tv,(struct timezone *)NULL) != 0)
msyslog(LOG_ERR, "can't sync battery time: %m");
#if !defined(VMS)
if (prio_set)
setpriority(PRIO_PROCESS, 0, o_prio); /* downshift */
#endif /* VMS */
#endif /* DOSYNCTODR */
record_sys_stats();
if (stats_drift_file != 0) {
/*
* When the frequency file is written, initialize the
* prev_drift_comp and wander_resid. Thereafter,
* reduce the wander_resid by half each hour. When
* the difference between the prev_drift_comp and
* drift_comp is less than the wander_resid, update
* the frequncy file. This minimizes the file writes to
* nonvolaile storage.
*/
#ifdef DEBUG
if (debug)
printf("write_stats: frequency %.6lf thresh %.6lf, freq %.6lf\n",
(prev_drift_comp - drift_comp) * 1e6, wander_resid *
1e6, drift_comp * 1e6);
#endif
if (fabs(prev_drift_comp - drift_comp) < wander_resid) {
wander_resid *= 0.5;
return;
}
prev_drift_comp = drift_comp;
wander_resid = wander_threshold;
if ((fp = fopen(stats_temp_file, "w")) == NULL) {
msyslog(LOG_ERR, "frequency file %s: %m",
stats_temp_file);
return;
}
fprintf(fp, "%.3f\n", drift_comp * 1e6);
(void)fclose(fp);
/* atomic */
#ifdef SYS_WINNT
if (_unlink(stats_drift_file)) /* rename semantics differ under NT */
msyslog(LOG_WARNING,
"Unable to remove prior drift file %s, %m",
stats_drift_file);
#endif /* SYS_WINNT */
#ifndef NO_RENAME
if (rename(stats_temp_file, stats_drift_file))
msyslog(LOG_WARNING,
"Unable to rename temp drift file %s to %s, %m",
stats_temp_file, stats_drift_file);
#else
/* we have no rename NFS of ftp in use */
if ((fp = fopen(stats_drift_file, "w")) ==
NULL) {
msyslog(LOG_ERR,
"frequency file %s: %m",
stats_drift_file);
return;
}
#endif
#if defined(VMS)
/* PURGE */
{
$DESCRIPTOR(oldvers,";-1");
struct dsc$descriptor driftdsc = {
strlen(stats_drift_file), 0, 0,
stats_drift_file };
while(lib$delete_file(&oldvers,
&driftdsc) & 1);
}
#endif
}
}
| 11,400
|
87,432
| 0
|
static void LodePNGIText_init(LodePNGInfo* info)
{
info->itext_num = 0;
info->itext_keys = NULL;
info->itext_langtags = NULL;
info->itext_transkeys = NULL;
info->itext_strings = NULL;
}
| 11,401
|
82,761
| 0
|
INST_HANDLER (sleep) { // SLEEP
ESIL_A ("BREAK");
}
| 11,402
|
24,255
| 0
|
is_xioctl_allowed(u8 mode, int cmd)
{
if(sizeof(xioctl_filter)-1 < cmd) {
A_PRINTF("Filter for this cmd=%d not defined\n",cmd);
return 0;
}
if(xioctl_filter[cmd] == 0xFF) return 0;
if(xioctl_filter[cmd] & mode) return 0;
return A_ERROR;
}
| 11,403
|
27,043
| 0
|
g_NPN_GetStringIdentifier(const NPUTF8 *name)
{
if (!thread_check()) {
npw_printf("WARNING: NPN_GetStringIdentifier not called from the main thread\n");
return NULL;
}
if (name == NULL)
return NULL;
D(bugiI("NPN_GetStringIdentifier name='%s'\n", name));
NPIdentifier ret = cached_NPN_GetStringIdentifier(name);
D(bugiD("NPN_GetStringIdentifier return: %p\n", ret));
return ret;
}
| 11,404
|
140,396
| 0
|
void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity,
bool killRing,
EditingState* editingState) {
LocalFrame* frame = document().frame();
if (!frame)
return;
frame->spellChecker().updateMarkersForWordsAffectedByEditing(false);
VisibleSelection selectionToDelete;
VisibleSelection selectionAfterUndo;
switch (endingSelection().getSelectionType()) {
case RangeSelection:
selectionToDelete = endingSelection();
selectionAfterUndo = selectionToDelete;
break;
case CaretSelection: {
m_smartDelete = false;
document().updateStyleAndLayoutIgnorePendingStylesheets();
SelectionModifier selectionModifier(*frame, endingSelection());
selectionModifier.modify(FrameSelection::AlterationExtend,
DirectionForward, granularity);
if (killRing && selectionModifier.selection().isCaret() &&
granularity != CharacterGranularity)
selectionModifier.modify(FrameSelection::AlterationExtend,
DirectionForward, CharacterGranularity);
Position downstreamEnd =
mostForwardCaretPosition(endingSelection().end());
VisiblePosition visibleEnd = endingSelection().visibleEnd();
Node* enclosingTableCell =
enclosingNodeOfType(visibleEnd.deepEquivalent(), &isTableCell);
if (enclosingTableCell &&
visibleEnd.deepEquivalent() ==
VisiblePosition::lastPositionInNode(enclosingTableCell)
.deepEquivalent())
return;
if (visibleEnd.deepEquivalent() ==
endOfParagraph(visibleEnd).deepEquivalent())
downstreamEnd = mostForwardCaretPosition(
nextPositionOf(visibleEnd, CannotCrossEditingBoundary)
.deepEquivalent());
if (isDisplayInsideTable(downstreamEnd.computeContainerNode()) &&
downstreamEnd.computeOffsetInContainerNode() <=
caretMinOffset(downstreamEnd.computeContainerNode())) {
setEndingSelection(
SelectionInDOMTree::Builder()
.setBaseAndExtentDeprecated(
endingSelection().end(),
Position::afterNode(downstreamEnd.computeContainerNode()))
.setIsDirectional(endingSelection().isDirectional())
.build());
typingAddedToOpenCommand(ForwardDeleteKey);
return;
}
if (granularity == ParagraphBoundary &&
selectionModifier.selection().isCaret() &&
isEndOfParagraph(selectionModifier.selection().visibleEnd()))
selectionModifier.modify(FrameSelection::AlterationExtend,
DirectionForward, CharacterGranularity);
selectionToDelete = selectionModifier.selection();
if (!startingSelection().isRange() ||
selectionToDelete.base() != startingSelection().start()) {
selectionAfterUndo = selectionToDelete;
} else {
Position extent = startingSelection().end();
if (extent.computeContainerNode() !=
selectionToDelete.end().computeContainerNode()) {
extent = selectionToDelete.extent();
} else {
int extraCharacters;
if (selectionToDelete.start().computeContainerNode() ==
selectionToDelete.end().computeContainerNode())
extraCharacters =
selectionToDelete.end().computeOffsetInContainerNode() -
selectionToDelete.start().computeOffsetInContainerNode();
else
extraCharacters =
selectionToDelete.end().computeOffsetInContainerNode();
extent =
Position(extent.computeContainerNode(),
extent.computeOffsetInContainerNode() + extraCharacters);
}
selectionAfterUndo.setWithoutValidation(startingSelection().start(),
extent);
}
break;
}
case NoSelection:
NOTREACHED();
break;
}
DCHECK(!selectionToDelete.isNone());
if (selectionToDelete.isNone())
return;
if (selectionToDelete.isCaret())
return;
if (killRing)
frame->editor().addToKillRing(
selectionToDelete.toNormalizedEphemeralRange());
if (frame->editor().behavior().shouldUndoOfDeleteSelectText())
setStartingSelection(selectionAfterUndo);
deleteSelectionIfRange(selectionToDelete, editingState, m_smartDelete);
if (editingState->isAborted())
return;
setSmartDelete(false);
typingAddedToOpenCommand(ForwardDeleteKey);
}
| 11,405
|
39,686
| 0
|
force_reval_path(struct path *path, struct nameidata *nd)
{
int status;
struct dentry *dentry = path->dentry;
/*
* only check on filesystems where it's possible for the dentry to
* become stale. It's assumed that if this flag is set then the
* d_revalidate op will also be defined.
*/
if (!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT))
return 0;
status = dentry->d_op->d_revalidate(dentry, nd);
if (status > 0)
return 0;
if (!status) {
d_invalidate(dentry);
status = -ESTALE;
}
return status;
}
| 11,406
|
17,799
| 0
|
static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
{
int scanlinepad, format, depth, bitsPerPixel, j, k;
dixInitScreenSpecificPrivates(pScreen);
if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
return -1;
}
pScreen->myNum = i;
if (gpu) {
pScreen->myNum += GPU_SCREEN_OFFSET;
pScreen->isGPU = TRUE;
}
pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
xorg_list_init(&pScreen->pixmap_dirty_list);
xorg_list_init(&pScreen->slave_list);
/*
* This loop gets run once for every Screen that gets added,
* but thats ok. If the ddx layer initializes the formats
* one at a time calling AddScreen() after each, then each
* iteration will make it a little more accurate. Worst case
* we do this loop N * numPixmapFormats where N is # of screens.
* Anyway, this must be called after InitOutput and before the
* screen init routine is called.
*/
for (format = 0; format < screenInfo.numPixmapFormats; format++) {
depth = screenInfo.formats[format].depth;
bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
scanlinepad = screenInfo.formats[format].scanlinePad;
j = indexForBitsPerPixel[bitsPerPixel];
k = indexForScanlinePad[scanlinepad];
PixmapWidthPaddingInfo[depth].padPixelsLog2 = answer[j][k];
PixmapWidthPaddingInfo[depth].padRoundUp =
(scanlinepad / bitsPerPixel) - 1;
j = indexForBitsPerPixel[8]; /* bits per byte */
PixmapWidthPaddingInfo[depth].padBytesLog2 = answer[j][k];
PixmapWidthPaddingInfo[depth].bitsPerPixel = bitsPerPixel;
if (answerBytesPerPixel[bitsPerPixel]) {
PixmapWidthPaddingInfo[depth].notPower2 = 1;
PixmapWidthPaddingInfo[depth].bytesPerPixel =
answerBytesPerPixel[bitsPerPixel];
}
else {
PixmapWidthPaddingInfo[depth].notPower2 = 0;
}
}
return 0;
}
| 11,407
|
65,988
| 0
|
static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *serv,
struct net *net,
struct sockaddr *sa, int salen,
int flags)
{
struct svcxprt_rdma *cma_xprt;
struct svc_xprt *xprt;
cma_xprt = rdma_create_xprt(serv, 0);
if (!cma_xprt)
return ERR_PTR(-ENOMEM);
xprt = &cma_xprt->sc_xprt;
svc_xprt_init(net, &svc_rdma_bc_class, xprt, serv);
set_bit(XPT_CONG_CTRL, &xprt->xpt_flags);
serv->sv_bc_xprt = xprt;
dprintk("svcrdma: %s(%p)\n", __func__, xprt);
return xprt;
}
| 11,408
|
49,499
| 0
|
static const struct hid_device_id *hid_match_device(struct hid_device *hdev,
struct hid_driver *hdrv)
{
struct hid_dynid *dynid;
spin_lock(&hdrv->dyn_lock);
list_for_each_entry(dynid, &hdrv->dyn_list, list) {
if (hid_match_one_id(hdev, &dynid->id)) {
spin_unlock(&hdrv->dyn_lock);
return &dynid->id;
}
}
spin_unlock(&hdrv->dyn_lock);
return hid_match_id(hdev, hdrv->id_table);
}
| 11,409
|
163,533
| 0
|
void PushMessagingServiceImpl::UnsubscribeInternal(
content::mojom::PushUnregistrationReason reason,
const GURL& origin,
int64_t service_worker_registration_id,
const std::string& app_id,
const std::string& sender_id,
const UnregisterCallback& callback) {
DCHECK(!app_id.empty() || (!origin.is_empty() &&
service_worker_registration_id !=
-1 /* kInvalidServiceWorkerRegistrationId */))
<< "Need an app_id and/or origin+service_worker_registration_id";
RecordUnsubscribeReason(reason);
if (origin.is_empty() ||
service_worker_registration_id ==
-1 /* kInvalidServiceWorkerRegistrationId */) {
DidClearPushSubscriptionId(reason, app_id, sender_id, callback);
return;
}
ClearPushSubscriptionId(
profile_, origin, service_worker_registration_id,
base::Bind(&PushMessagingServiceImpl::DidClearPushSubscriptionId,
weak_factory_.GetWeakPtr(), reason, app_id, sender_id,
callback));
}
| 11,410
|
43,472
| 0
|
static void aesni_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
{
glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(aesni_enc));
}
| 11,411
|
41,284
| 0
|
static int __init comedi_init(void)
{
int i;
int retval;
printk(KERN_INFO "comedi: version " COMEDI_RELEASE
" - http://www.comedi.org\n");
if (comedi_num_legacy_minors < 0 ||
comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) {
printk(KERN_ERR "comedi: error: invalid value for module "
"parameter \"comedi_num_legacy_minors\". Valid values "
"are 0 through %i.\n", COMEDI_NUM_BOARD_MINORS);
return -EINVAL;
}
/*
* comedi is unusable if both comedi_autoconfig and
* comedi_num_legacy_minors are zero, so we might as well adjust the
* defaults in that case
*/
if (comedi_autoconfig == 0 && comedi_num_legacy_minors == 0)
comedi_num_legacy_minors = 16;
memset(comedi_file_info_table, 0,
sizeof(struct comedi_device_file_info *) * COMEDI_NUM_MINORS);
retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS, "comedi");
if (retval)
return -EIO;
cdev_init(&comedi_cdev, &comedi_fops);
comedi_cdev.owner = THIS_MODULE;
kobject_set_name(&comedi_cdev.kobj, "comedi");
if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS);
return -EIO;
}
comedi_class = class_create(THIS_MODULE, "comedi");
if (IS_ERR(comedi_class)) {
printk(KERN_ERR "comedi: failed to create class");
cdev_del(&comedi_cdev);
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS);
return PTR_ERR(comedi_class);
}
/* XXX requires /proc interface */
comedi_proc_init();
/* create devices files for legacy/manual use */
for (i = 0; i < comedi_num_legacy_minors; i++) {
int minor;
minor = comedi_alloc_board_minor(NULL);
if (minor < 0) {
comedi_cleanup_legacy_minors();
cdev_del(&comedi_cdev);
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS);
return minor;
}
}
return 0;
}
| 11,412
|
113,645
| 0
|
JSRetainPtr<JSStringRef> AccessibilityUIElement::url()
{
return JSStringCreateWithCharacters(0, 0);
}
| 11,413
|
159,186
| 0
|
DownloadItemImpl::RequestInfo::RequestInfo(
const std::vector<GURL>& url_chain,
const GURL& referrer_url,
const GURL& site_url,
const GURL& tab_url,
const GURL& tab_referrer_url,
const std::string& suggested_filename,
const base::FilePath& forced_file_path,
ui::PageTransition transition_type,
bool has_user_gesture,
const std::string& remote_address,
base::Time start_time)
: url_chain(url_chain),
referrer_url(referrer_url),
site_url(site_url),
tab_url(tab_url),
tab_referrer_url(tab_referrer_url),
suggested_filename(suggested_filename),
forced_file_path(forced_file_path),
transition_type(transition_type),
has_user_gesture(has_user_gesture),
remote_address(remote_address),
start_time(start_time) {}
| 11,414
|
112,220
| 0
|
QuotaThreadTask::QuotaThreadTask(
QuotaTaskObserver* observer,
TaskRunner* target_task_runner)
: QuotaTask(observer),
target_task_runner_(target_task_runner) {
}
| 11,415
|
33,986
| 0
|
static void netbk_fatal_tx_err(struct xenvif *vif)
{
netdev_err(vif->dev, "fatal error; disabling device\n");
xenvif_carrier_off(vif);
xenvif_put(vif);
}
| 11,416
|
91,826
| 0
|
inline void comps_rtree_pair_destroy_v(void * pair) {
free(((COMPS_RTreePair *)pair)->key);
free(pair);
}
| 11,417
|
43,264
| 0
|
int CLASS foveon_apply_curve (short *curve, int i)
{
if (abs(i) >= curve[0]) return 0;
return i < 0 ? -curve[1-i] : curve[1+i];
}
| 11,418
|
129,059
| 0
|
void AttachedClientHosts::Add(ExtensionDevToolsClientHost* client_host) {
client_hosts_.insert(client_host);
}
| 11,419
|
34,026
| 0
|
void xenvif_get(struct xenvif *vif)
{
atomic_inc(&vif->refcnt);
}
| 11,420
|
133,090
| 0
|
void HWNDMessageHandler::GetWindowPlacement(
gfx::Rect* bounds,
ui::WindowShowState* show_state) const {
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
const bool succeeded = !!::GetWindowPlacement(hwnd(), &wp);
DCHECK(succeeded);
if (bounds != NULL) {
if (wp.showCmd == SW_SHOWNORMAL) {
const bool succeeded = GetWindowRect(hwnd(), &wp.rcNormalPosition) != 0;
DCHECK(succeeded);
*bounds = gfx::Rect(wp.rcNormalPosition);
} else {
MONITORINFO mi;
mi.cbSize = sizeof(mi);
const bool succeeded = base::win::GetMonitorInfoWrapper(
MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST), &mi) != 0;
DCHECK(succeeded);
*bounds = gfx::Rect(wp.rcNormalPosition);
bounds->Offset(mi.rcWork.left - mi.rcMonitor.left,
mi.rcWork.top - mi.rcMonitor.top);
}
}
if (show_state) {
if (wp.showCmd == SW_SHOWMAXIMIZED)
*show_state = ui::SHOW_STATE_MAXIMIZED;
else if (wp.showCmd == SW_SHOWMINIMIZED)
*show_state = ui::SHOW_STATE_MINIMIZED;
else
*show_state = ui::SHOW_STATE_NORMAL;
}
}
| 11,421
|
11,084
| 0
|
static void smbd_sig_hup_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
int count,
void *siginfo,
void *private_data)
{
change_to_root_user();
DEBUG(1,("Reloading services after SIGHUP\n"));
reload_services(False);
}
| 11,422
|
171,659
| 0
|
static size_t out_get_buffer_size(const struct audio_stream *stream)
{
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
DEBUG("buffer_size : %zu", out->common.buffer_sz);
return out->common.buffer_sz;
}
| 11,423
|
10,717
| 0
|
TT_DotFix14_long_long( FT_Int32 ax,
FT_Int32 ay,
FT_Int bx,
FT_Int by )
{
/* Temporarily disable the warning that C90 doesn't support */
/* `long long'. */
long long temp1 = (long long)ax * bx;
long long temp2 = (long long)ay * by;
temp1 += temp2;
temp2 = temp1 >> 63;
temp1 += 0x2000 + temp2;
return (FT_Int32)( temp1 >> 14 );
}
| 11,424
|
168,130
| 0
|
int MakeFrontendID(const std::string& cc_sid,
const std::string& profile_sid) const {
return autofill_manager_->MakeFrontendID(cc_sid, profile_sid);
}
| 11,425
|
144,080
| 0
|
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen)
{
png_charp new_iccp_name;
png_charp new_iccp_profile;
png_uint_32 length;
png_debug1(1, "in %s storage function", "iCCP");
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return;
length = png_strlen(name)+1;
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
if (new_iccp_name == NULL)
{
png_warning(png_ptr, "Insufficient memory to process iCCP chunk.");
return;
}
png_memcpy(new_iccp_name, name, length);
new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
if (new_iccp_profile == NULL)
{
png_free (png_ptr, new_iccp_name);
png_warning(png_ptr,
"Insufficient memory to process iCCP profile.");
return;
}
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
info_ptr->iccp_proflen = proflen;
info_ptr->iccp_name = new_iccp_name;
info_ptr->iccp_profile = new_iccp_profile;
/* Compression is always zero but is here so the API and info structure
* does not have to change if we introduce multiple compression types
*/
info_ptr->iccp_compression = (png_byte)compression_type;
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_ICCP;
#endif
info_ptr->valid |= PNG_INFO_iCCP;
}
| 11,426
|
129,705
| 0
|
ResourcePtr<RawResource> ResourceFetcher::fetchMainResource(FetchRequest& request, const SubstituteData& substituteData)
{
if (substituteData.isValid())
preCacheSubstituteDataForMainResource(request, substituteData);
return toRawResource(requestResource(Resource::MainResource, request));
}
| 11,427
|
187,023
| 1
|
ProcessIdToFilterMap* GetProcessIdToFilterMap() {
static base::NoDestructor<ProcessIdToFilterMap> instance;
return instance.get();
}
| 11,428
|
19,858
| 0
|
static int nfs41_proc_reclaim_complete(struct nfs_client *clp)
{
struct nfs4_reclaim_complete_data *calldata;
struct rpc_task *task;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RECLAIM_COMPLETE],
};
struct rpc_task_setup task_setup_data = {
.rpc_client = clp->cl_rpcclient,
.rpc_message = &msg,
.callback_ops = &nfs4_reclaim_complete_call_ops,
.flags = RPC_TASK_ASYNC,
};
int status = -ENOMEM;
dprintk("--> %s\n", __func__);
calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
if (calldata == NULL)
goto out;
calldata->clp = clp;
calldata->arg.one_fs = 0;
nfs41_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 0);
msg.rpc_argp = &calldata->arg;
msg.rpc_resp = &calldata->res;
task_setup_data.callback_data = calldata;
task = rpc_run_task(&task_setup_data);
if (IS_ERR(task)) {
status = PTR_ERR(task);
goto out;
}
status = nfs4_wait_for_completion_rpc_task(task);
if (status == 0)
status = task->tk_status;
rpc_put_task(task);
return 0;
out:
dprintk("<-- %s status=%d\n", __func__, status);
return status;
}
| 11,429
|
3,790
| 0
|
_dbus_get_autolaunch_shm (DBusString *address, DBusString *shm_name)
{
HANDLE sharedMem;
char *shared_addr;
int i;
for(i=0;i<20;++i) {
sharedMem = OpenFileMappingA( FILE_MAP_READ, FALSE, _dbus_string_get_const_data(shm_name));
if( sharedMem == 0 )
Sleep( 100 );
if ( sharedMem != 0)
break;
}
if( sharedMem == 0 )
return FALSE;
shared_addr = MapViewOfFile( sharedMem, FILE_MAP_READ, 0, 0, 0 );
if( !shared_addr )
return FALSE;
_dbus_string_init( address );
_dbus_string_append( address, shared_addr );
UnmapViewOfFile( shared_addr );
CloseHandle( sharedMem );
return TRUE;
}
| 11,430
|
183,964
| 1
|
virtual void SetImePropertyActivated(const std::string& key,
bool activated) {
if (!initialized_successfully_)
return;
DCHECK(!key.empty());
chromeos::SetImePropertyActivated(
input_method_status_connection_, key.c_str(), activated);
}
| 11,431
|
72,866
| 0
|
static int jpc_ppt_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_ppt_t *ppt = &ms->parms.ppt;
fprintf(out, "ind=%d; len = %"PRIuFAST32";\n", ppt->ind, ppt->len);
if (ppt->len > 0) {
fprintf(out, "data =\n");
jas_memdump(out, ppt->data, ppt->len);
}
return 0;
}
| 11,432
|
1,968
| 0
|
SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* dest,
int port, int secure_port,
const char* cert_subject)
{
spice_info(NULL);
spice_assert(!migration_interface);
spice_assert(reds == s);
if (!reds_set_migration_dest_info(dest, port, secure_port, cert_subject)) {
return -1;
}
return 0;
}
| 11,433
|
37,741
| 0
|
static inline void clr_exception_intercept(struct vcpu_svm *svm, int bit)
{
struct vmcb *vmcb = get_host_vmcb(svm);
vmcb->control.intercept_exceptions &= ~(1U << bit);
recalc_intercepts(svm);
}
| 11,434
|
183,268
| 1
|
static void copy_asoundrc(void) {
// copy XAUTHORITY_FILE in the new home directory
char *src = RUN_ASOUNDRC_FILE ;
char *dest;
if (asprintf(&dest, "%s/.asoundrc", cfg.homedir) == -1)
errExit("asprintf");
// if destination is a symbolic link, exit the sandbox!!!
if (is_link(dest)) {
fprintf(stderr, "Error: %s is a symbolic link\n", dest);
exit(1);
}
pid_t child = fork();
if (child < 0)
errExit("fork");
if (child == 0) {
// drop privileges
drop_privs(0);
// copy, set permissions and ownership
int rv = copy_file(src, dest);
if (rv)
fprintf(stderr, "Warning: cannot transfer .asoundrc in private home directory\n");
else {
fs_logger2("clone", dest);
}
_exit(0);
}
// wait for the child to finish
waitpid(child, NULL, 0);
// set permissions and ownership
if (chown(dest, getuid(), getgid()) < 0)
errExit("chown");
if (chmod(dest, S_IRUSR | S_IWUSR) < 0)
errExit("chmod");
// delete the temporary file
unlink(src);
}
| 11,435
|
136,843
| 0
|
void LocalDOMWindow::setStatus(const String& string) {
status_ = string;
}
| 11,436
|
42,187
| 0
|
static int sane_signal_32_frame(unsigned int sp)
{
struct signal_frame_32 __user *sf;
unsigned int regs;
sf = (struct signal_frame_32 __user *) (unsigned long) sp;
if (read_user_stack_32((unsigned int __user *) &sf->sctx.regs, ®s))
return 0;
return regs == (unsigned long) &sf->mctx;
}
| 11,437
|
180,842
| 1
|
static const ut8 *r_bin_dwarf_parse_comp_unit(Sdb *s, const ut8 *obuf,
RBinDwarfCompUnit *cu, const RBinDwarfDebugAbbrev *da,
size_t offset, const ut8 *debug_str, size_t debug_str_len) {
const ut8 *buf = obuf, *buf_end = obuf + (cu->hdr.length - 7);
ut64 abbr_code;
size_t i;
if (cu->hdr.length > debug_str_len) {
//avoid oob read
return NULL;
}
while (buf && buf < buf_end && buf >= obuf) {
if (cu->length && cu->capacity == cu->length) {
r_bin_dwarf_expand_cu (cu);
}
buf = r_uleb128 (buf, buf_end - buf, &abbr_code);
if (abbr_code > da->length || !buf) {
return NULL;
}
r_bin_dwarf_init_die (&cu->dies[cu->length]);
if (!abbr_code) {
cu->dies[cu->length].abbrev_code = 0;
cu->length++;
buf++;
continue;
}
cu->dies[cu->length].abbrev_code = abbr_code;
cu->dies[cu->length].tag = da->decls[abbr_code - 1].tag;
abbr_code += offset;
if (da->capacity < abbr_code) {
return NULL;
}
for (i = 0; i < da->decls[abbr_code - 1].length; i++) {
if (cu->dies[cu->length].length == cu->dies[cu->length].capacity) {
r_bin_dwarf_expand_die (&cu->dies[cu->length]);
}
if (i >= cu->dies[cu->length].capacity || i >= da->decls[abbr_code - 1].capacity) {
eprintf ("Warning: malformed dwarf attribute capacity doesn't match length\n");
break;
}
memset (&cu->dies[cu->length].attr_values[i], 0, sizeof
(cu->dies[cu->length].attr_values[i]));
buf = r_bin_dwarf_parse_attr_value (buf, buf_end - buf,
&da->decls[abbr_code - 1].specs[i],
&cu->dies[cu->length].attr_values[i],
&cu->hdr, debug_str, debug_str_len);
if (cu->dies[cu->length].attr_values[i].name == DW_AT_comp_dir) {
const char *name = cu->dies[cu->length].attr_values[i].encoding.str_struct.string;
sdb_set (s, "DW_AT_comp_dir", name, 0);
}
cu->dies[cu->length].length++;
}
cu->length++;
}
return buf;
}
| 11,438
|
159,358
| 0
|
MetricsPrivateDelegate* ChromeExtensionsAPIClient::GetMetricsPrivateDelegate() {
if (!metrics_private_delegate_)
metrics_private_delegate_.reset(new ChromeMetricsPrivateDelegate());
return metrics_private_delegate_.get();
}
| 11,439
|
116,503
| 0
|
bool SendCommandDebuggerFunction::RunImpl() {
if (!InitClientHost())
return false;
std::string method;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &method));
Value *params;
if (!args_->Get(2, ¶ms))
params = NULL;
client_host_->SendMessageToBackend(this, method, params);
return true;
}
| 11,440
|
42,282
| 0
|
static int sg_proc_open_debug(struct inode *inode, struct file *file)
{
return seq_open(file, &debug_seq_ops);
}
| 11,441
|
170,620
| 0
|
void Reverb_getConfig(ReverbContext *pContext, effect_config_t *pConfig)
{
*pConfig = pContext->config;
} /* end Reverb_getConfig */
| 11,442
|
161,823
| 0
|
void PlatformSensorProviderWin::StopSensorThread() {
if (sensor_thread_ && sensor_thread_->IsRunning())
sensor_thread_->Stop();
}
| 11,443
|
140,919
| 0
|
bool PresentationConnection::matches(const String& id, const KURL& url) const {
return m_url == url && m_id == id;
}
| 11,444
|
180,983
| 1
|
static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
logging,
status;
MngInfo
*mng_info;
char
magic_number[MaxTextExtent];
size_t
count;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadJNGImage()");
image=AcquireImage(image_info);
mng_info=(MngInfo *) NULL;
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
if (LocaleCompare(image_info->magick,"JNG") != 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/* Verify JNG signature. */
count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);
if (count < 8 || memcmp(magic_number,"\213JNG\r\n\032\n",8) != 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/* Allocate a MngInfo structure. */
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(*mng_info));
if (mng_info == (MngInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
/* Initialize members of the MngInfo structure. */
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
image=ReadOneJNGImage(mng_info,image_info,exception);
mng_info=MngInfoFreeStruct(mng_info);
if (image == (Image *) NULL)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"exit ReadJNGImage() with error");
return((Image *) NULL);
}
(void) CloseBlob(image);
if (image->columns == 0 || image->rows == 0)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"exit ReadJNGImage() with error");
ThrowReaderException(CorruptImageError,"CorruptImage");
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit ReadJNGImage()");
return(image);
}
| 11,445
|
21,686
| 0
|
static inline void init_timeout(struct aio_timeout *to)
{
setup_timer_on_stack(&to->timer, timeout_func, (unsigned long) to);
to->timed_out = 0;
to->p = current;
}
| 11,446
|
45,609
| 0
|
static void chainiv_free(struct crypto_instance *inst)
{
skcipher_geniv_free(inst);
crypto_put_default_rng();
}
| 11,447
|
77,964
| 0
|
ModuleExport size_t RegisterCALSImage(void)
{
#define CALSDescription "Continuous Acquisition and Life-cycle Support Type 1"
#define CALSNote "Specified in MIL-R-28002 and MIL-PRF-28002"
MagickInfo
*entry;
entry=AcquireMagickInfo("CALS","CAL",CALSDescription);
entry->decoder=(DecodeImageHandler *) ReadCALSImage;
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->encoder=(EncodeImageHandler *) WriteCALSImage;
#endif
entry->flags^=CoderAdjoinFlag;
entry->magick=(IsImageFormatHandler *) IsCALS;
entry->note=ConstantString(CALSNote);
(void) RegisterMagickInfo(entry);
entry=AcquireMagickInfo("CALS","CALS",CALSDescription);
entry->decoder=(DecodeImageHandler *) ReadCALSImage;
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->encoder=(EncodeImageHandler *) WriteCALSImage;
#endif
entry->flags^=CoderAdjoinFlag;
entry->magick=(IsImageFormatHandler *) IsCALS;
entry->note=ConstantString(CALSNote);
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 11,448
|
26,377
| 0
|
static unsigned long get_sample_period(void)
{
/*
* convert watchdog_thresh from seconds to ns
* the divide by 5 is to give hrtimer 5 chances to
* increment before the hardlockup detector generates
* a warning
*/
return get_softlockup_thresh() * (NSEC_PER_SEC / 5);
}
| 11,449
|
47,418
| 0
|
static int zlib_decompress_setup(struct crypto_pcomp *tfm, void *params,
unsigned int len)
{
struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
struct z_stream_s *stream = &ctx->decomp_stream;
struct nlattr *tb[ZLIB_DECOMP_MAX + 1];
int ret = 0;
ret = nla_parse(tb, ZLIB_DECOMP_MAX, params, len, NULL);
if (ret)
return ret;
zlib_decomp_exit(ctx);
ctx->decomp_windowBits = tb[ZLIB_DECOMP_WINDOWBITS]
? nla_get_u32(tb[ZLIB_DECOMP_WINDOWBITS])
: DEF_WBITS;
stream->workspace = vzalloc(zlib_inflate_workspacesize());
if (!stream->workspace)
return -ENOMEM;
ret = zlib_inflateInit2(stream, ctx->decomp_windowBits);
if (ret != Z_OK) {
vfree(stream->workspace);
stream->workspace = NULL;
return -EINVAL;
}
return 0;
}
| 11,450
|
34,378
| 0
|
static void fill_inode_item(struct btrfs_trans_handle *trans,
struct extent_buffer *leaf,
struct btrfs_inode_item *item,
struct inode *inode)
{
btrfs_set_inode_uid(leaf, item, i_uid_read(inode));
btrfs_set_inode_gid(leaf, item, i_gid_read(inode));
btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size);
btrfs_set_inode_mode(leaf, item, inode->i_mode);
btrfs_set_inode_nlink(leaf, item, inode->i_nlink);
btrfs_set_timespec_sec(leaf, btrfs_inode_atime(item),
inode->i_atime.tv_sec);
btrfs_set_timespec_nsec(leaf, btrfs_inode_atime(item),
inode->i_atime.tv_nsec);
btrfs_set_timespec_sec(leaf, btrfs_inode_mtime(item),
inode->i_mtime.tv_sec);
btrfs_set_timespec_nsec(leaf, btrfs_inode_mtime(item),
inode->i_mtime.tv_nsec);
btrfs_set_timespec_sec(leaf, btrfs_inode_ctime(item),
inode->i_ctime.tv_sec);
btrfs_set_timespec_nsec(leaf, btrfs_inode_ctime(item),
inode->i_ctime.tv_nsec);
btrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode));
btrfs_set_inode_generation(leaf, item, BTRFS_I(inode)->generation);
btrfs_set_inode_sequence(leaf, item, inode->i_version);
btrfs_set_inode_transid(leaf, item, trans->transid);
btrfs_set_inode_rdev(leaf, item, inode->i_rdev);
btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags);
btrfs_set_inode_block_group(leaf, item, 0);
}
| 11,451
|
119,369
| 0
|
void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id,
IPC::Listener* listener) {
AddRoute(routing_id, listener);
if (devtools_agent_message_filter_.get()) {
devtools_agent_message_filter_->AddEmbeddedWorkerRouteOnMainThread(
routing_id);
}
}
| 11,452
|
151,366
| 0
|
InspectorStyleInvalidatorInvalidateEvent::SelectorPart(
Element& element,
const char* reason,
const InvalidationSet& invalidation_set,
const String& selector_part) {
std::unique_ptr<TracedValue> value = FillCommonPart(element, reason);
value->BeginArray("invalidationList");
invalidation_set.ToTracedValue(value.get());
value->EndArray();
value->SetString("selectorPart", selector_part);
return value;
}
| 11,453
|
102,376
| 0
|
void AppendFormattedComponent(const std::string& spec,
const url_parse::Component& original_component,
const std::vector<size_t>& original_offsets,
const AppendComponentTransform& transform,
string16* output,
url_parse::Component* output_component,
std::vector<size_t>* offsets_for_adjustment) {
DCHECK(output);
if (original_component.is_nonempty()) {
size_t original_component_begin =
static_cast<size_t>(original_component.begin);
size_t output_component_begin = output->length();
if (output_component)
output_component->begin = static_cast<int>(output_component_begin);
std::vector<size_t> offsets_into_component =
OffsetsIntoComponent(original_offsets, original_component_begin);
output->append(transform.Execute(std::string(spec, original_component_begin,
static_cast<size_t>(original_component.len)), &offsets_into_component));
if (output_component) {
output_component->len =
static_cast<int>(output->length() - output_component_begin);
}
AdjustForComponentTransform(original_offsets, original_component_begin,
static_cast<size_t>(original_component.end()),
offsets_into_component, output_component_begin,
offsets_for_adjustment);
} else if (output_component) {
output_component->reset();
}
}
| 11,454
|
26,323
| 0
|
void sched_destroy_group(struct task_group *tg)
{
unsigned long flags;
int i;
/* end participation in shares distribution */
for_each_possible_cpu(i)
unregister_fair_sched_group(tg, i);
spin_lock_irqsave(&task_group_lock, flags);
list_del_rcu(&tg->list);
list_del_rcu(&tg->siblings);
spin_unlock_irqrestore(&task_group_lock, flags);
/* wait for possible concurrent references to cfs_rqs complete */
call_rcu(&tg->rcu, free_sched_group_rcu);
}
| 11,455
|
122,469
| 0
|
void InspectorController::didCommitLoadForMainFrame()
{
Vector<InspectorAgent*> agents = m_moduleAgents;
for (size_t i = 0; i < agents.size(); i++)
agents[i]->didCommitLoadForMainFrame();
}
| 11,456
|
175,031
| 0
|
sp<MediaSource> MPEG4Extractor::getTrack(size_t index) {
status_t err;
if ((err = readMetaData()) != OK) {
return NULL;
}
Track *track = mFirstTrack;
while (index > 0) {
if (track == NULL) {
return NULL;
}
track = track->next;
--index;
}
if (track == NULL) {
return NULL;
}
ALOGV("getTrack called, pssh: %d", mPssh.size());
return new MPEG4Source(
track->meta, mDataSource, track->timescale, track->sampleTable,
mSidxEntries, mMoofOffset);
}
| 11,457
|
150,890
| 0
|
BluetoothAdapter::~BluetoothAdapter() {
if (set_powered_callbacks_)
set_powered_callbacks_->error_callback.Run();
}
| 11,458
|
188,183
| 1
|
static jboolean enableNative(JNIEnv* env, jobject obj) {
ALOGV("%s:",__FUNCTION__);
jboolean result = JNI_FALSE;
if (!sBluetoothInterface) return result;
int ret = sBluetoothInterface->enable();
result = (ret == BT_STATUS_SUCCESS || ret == BT_STATUS_DONE) ? JNI_TRUE : JNI_FALSE;
return result;
}
| 11,459
|
36,515
| 0
|
int snd_card_file_add(struct snd_card *card, struct file *file)
{
struct snd_monitor_file *mfile;
mfile = kmalloc(sizeof(*mfile), GFP_KERNEL);
if (mfile == NULL)
return -ENOMEM;
mfile->file = file;
mfile->disconnected_f_op = NULL;
INIT_LIST_HEAD(&mfile->shutdown_list);
spin_lock(&card->files_lock);
if (card->shutdown) {
spin_unlock(&card->files_lock);
kfree(mfile);
return -ENODEV;
}
list_add(&mfile->list, &card->files_list);
get_device(&card->card_dev);
spin_unlock(&card->files_lock);
return 0;
}
| 11,460
|
53,312
| 0
|
static int handle_exception(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct kvm_run *kvm_run = vcpu->run;
u32 intr_info, ex_no, error_code;
unsigned long cr2, rip, dr6;
u32 vect_info;
enum emulation_result er;
vect_info = vmx->idt_vectoring_info;
intr_info = vmx->exit_intr_info;
if (is_machine_check(intr_info))
return handle_machine_check(vcpu);
if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
return 1; /* already handled by vmx_vcpu_run() */
if (is_no_device(intr_info)) {
vmx_fpu_activate(vcpu);
return 1;
}
if (is_invalid_opcode(intr_info)) {
if (is_guest_mode(vcpu)) {
kvm_queue_exception(vcpu, UD_VECTOR);
return 1;
}
er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);
if (er != EMULATE_DONE)
kvm_queue_exception(vcpu, UD_VECTOR);
return 1;
}
error_code = 0;
if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
/*
* The #PF with PFEC.RSVD = 1 indicates the guest is accessing
* MMIO, it is better to report an internal error.
* See the comments in vmx_handle_exit.
*/
if ((vect_info & VECTORING_INFO_VALID_MASK) &&
!(is_page_fault(intr_info) && !(error_code & PFERR_RSVD_MASK))) {
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
vcpu->run->internal.ndata = 3;
vcpu->run->internal.data[0] = vect_info;
vcpu->run->internal.data[1] = intr_info;
vcpu->run->internal.data[2] = error_code;
return 0;
}
if (is_page_fault(intr_info)) {
/* EPT won't cause page fault directly */
BUG_ON(enable_ept);
cr2 = vmcs_readl(EXIT_QUALIFICATION);
trace_kvm_page_fault(cr2, error_code);
if (kvm_event_needs_reinjection(vcpu))
kvm_mmu_unprotect_page_virt(vcpu, cr2);
return kvm_mmu_page_fault(vcpu, cr2, error_code, NULL, 0);
}
ex_no = intr_info & INTR_INFO_VECTOR_MASK;
if (vmx->rmode.vm86_active && rmode_exception(vcpu, ex_no))
return handle_rmode_exception(vcpu, ex_no, error_code);
switch (ex_no) {
case AC_VECTOR:
kvm_queue_exception_e(vcpu, AC_VECTOR, error_code);
return 1;
case DB_VECTOR:
dr6 = vmcs_readl(EXIT_QUALIFICATION);
if (!(vcpu->guest_debug &
(KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
vcpu->arch.dr6 &= ~15;
vcpu->arch.dr6 |= dr6 | DR6_RTM;
if (!(dr6 & ~DR6_RESERVED)) /* icebp */
skip_emulated_instruction(vcpu);
kvm_queue_exception(vcpu, DB_VECTOR);
return 1;
}
kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1;
kvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);
/* fall through */
case BP_VECTOR:
/*
* Update instruction length as we may reinject #BP from
* user space while in guest debugging mode. Reading it for
* #DB as well causes no harm, it is not used in that case.
*/
vmx->vcpu.arch.event_exit_inst_len =
vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
kvm_run->exit_reason = KVM_EXIT_DEBUG;
rip = kvm_rip_read(vcpu);
kvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip;
kvm_run->debug.arch.exception = ex_no;
break;
default:
kvm_run->exit_reason = KVM_EXIT_EXCEPTION;
kvm_run->ex.exception = ex_no;
kvm_run->ex.error_code = error_code;
break;
}
return 0;
}
| 11,461
|
111,736
| 0
|
void EditorClientBlackBerry::willSetInputMethodState()
{
notImplemented();
}
| 11,462
|
74,256
| 0
|
struct pathnames *add_subdir(struct pathnames *paths, struct pathname *path)
{
if(paths->count % PATHS_ALLOC_SIZE == 0) {
paths = realloc(paths, sizeof(struct pathnames *) +
(paths->count + PATHS_ALLOC_SIZE) *
sizeof(struct pathname *));
if(paths == NULL)
EXIT_UNSQUASH("Out of memory in add_subdir\n");
}
paths->path[paths->count++] = path;
return paths;
}
| 11,463
|
166,795
| 0
|
BackingVisitor(ThreadState* state, std::vector<void*>* objects)
: Visitor(state), objects_(objects) {}
| 11,464
|
9,322
| 0
|
static void handle_s_without_atn(ESPState *s)
{
uint8_t buf[32];
int len;
if (s->dma && !s->dma_enabled) {
s->dma_cb = handle_s_without_atn;
return;
}
len = get_cmd(s, buf, sizeof(buf));
if (len) {
do_busid_cmd(s, buf, 0);
}
}
| 11,465
|
165,684
| 0
|
bool ProcessNeedsProfileDir(const std::string& process_type) {
return ProcessNeedsProfileDir(GetProcessType(UTF8ToUTF16(process_type)));
}
| 11,466
|
136,051
| 0
|
const Extension* ExtensionWebContentsObserver::GetExtensionFromFrame(
content::RenderFrameHost* render_frame_host) const {
return ExtensionRegistry::Get(
render_frame_host->GetProcess()->GetBrowserContext())
->enabled_extensions()
.GetByID(GetExtensionIdFromFrame(render_frame_host));
}
| 11,467
|
146,432
| 0
|
WebGLTexture* WebGLRenderingContextBase::ValidateTextureBinding(
const char* function_name,
GLenum target) {
WebGLTexture* tex = nullptr;
switch (target) {
case GL_TEXTURE_2D:
tex = texture_units_[active_texture_unit_].texture2d_binding_.Get();
break;
case GL_TEXTURE_CUBE_MAP:
tex =
texture_units_[active_texture_unit_].texture_cube_map_binding_.Get();
break;
case GL_TEXTURE_3D:
if (!IsWebGL2OrHigher()) {
SynthesizeGLError(GL_INVALID_ENUM, function_name,
"invalid texture target");
return nullptr;
}
tex = texture_units_[active_texture_unit_].texture3d_binding_.Get();
break;
case GL_TEXTURE_2D_ARRAY:
if (!IsWebGL2OrHigher()) {
SynthesizeGLError(GL_INVALID_ENUM, function_name,
"invalid texture target");
return nullptr;
}
tex = texture_units_[active_texture_unit_].texture2d_array_binding_.Get();
break;
default:
SynthesizeGLError(GL_INVALID_ENUM, function_name,
"invalid texture target");
return nullptr;
}
if (!tex)
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"no texture bound to target");
return tex;
}
| 11,468
|
134,805
| 0
|
int TouchEventConverterEvdev::GetTouchPoints() const {
return touch_points_;
}
| 11,469
|
104,257
| 0
|
RTCSessionDescriptionRequestImpl::~RTCSessionDescriptionRequestImpl()
{
}
| 11,470
|
59,807
| 0
|
static void hid_irq_out(struct urb *urb)
{
struct hid_device *hid = urb->context;
struct usbhid_device *usbhid = hid->driver_data;
unsigned long flags;
int unplug = 0;
switch (urb->status) {
case 0: /* success */
break;
case -ESHUTDOWN: /* unplug */
unplug = 1;
case -EILSEQ: /* protocol error or unplug */
case -EPROTO: /* protocol error or unplug */
case -ECONNRESET: /* unlink */
case -ENOENT:
break;
default: /* error */
hid_warn(urb->dev, "output irq status %d received\n",
urb->status);
}
spin_lock_irqsave(&usbhid->lock, flags);
if (unplug) {
usbhid->outtail = usbhid->outhead;
} else {
usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
if (usbhid->outhead != usbhid->outtail &&
hid_submit_out(hid) == 0) {
/* Successfully submitted next urb in queue */
spin_unlock_irqrestore(&usbhid->lock, flags);
return;
}
}
clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
spin_unlock_irqrestore(&usbhid->lock, flags);
usb_autopm_put_interface_async(usbhid->intf);
wake_up(&usbhid->wait);
}
| 11,471
|
104,916
| 0
|
PP_Bool Paint(PP_Resource resource,
const PP_Rect* rect,
PP_Resource image_id) {
scoped_refptr<PPB_Widget_Impl> widget(
Resource::GetAs<PPB_Widget_Impl>(resource));
if (!widget)
return PP_FALSE;
scoped_refptr<PPB_ImageData_Impl> image(
Resource::GetAs<PPB_ImageData_Impl>(image_id));
if (!image)
return PP_FALSE;
return BoolToPPBool(widget->Paint(rect, image));
}
| 11,472
|
39,298
| 0
|
int security_sid_to_context_force(u32 sid, char **scontext, u32 *scontext_len)
{
return security_sid_to_context_core(sid, scontext, scontext_len, 1);
}
| 11,473
|
41,755
| 0
|
static int addrconf_dad_end(struct inet6_ifaddr *ifp)
{
int err = -ENOENT;
spin_lock_bh(&ifp->state_lock);
if (ifp->state == INET6_IFADDR_STATE_DAD) {
ifp->state = INET6_IFADDR_STATE_POSTDAD;
err = 0;
}
spin_unlock_bh(&ifp->state_lock);
return err;
}
| 11,474
|
38,360
| 0
|
static int cm_dreq_handler(struct cm_work *work)
{
struct cm_id_private *cm_id_priv;
struct cm_dreq_msg *dreq_msg;
struct ib_mad_send_buf *msg = NULL;
int ret;
dreq_msg = (struct cm_dreq_msg *)work->mad_recv_wc->recv_buf.mad;
cm_id_priv = cm_acquire_id(dreq_msg->remote_comm_id,
dreq_msg->local_comm_id);
if (!cm_id_priv) {
atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
counter[CM_DREQ_COUNTER]);
cm_issue_drep(work->port, work->mad_recv_wc);
return -EINVAL;
}
work->cm_event.private_data = &dreq_msg->private_data;
spin_lock_irq(&cm_id_priv->lock);
if (cm_id_priv->local_qpn != cm_dreq_get_remote_qpn(dreq_msg))
goto unlock;
switch (cm_id_priv->id.state) {
case IB_CM_REP_SENT:
case IB_CM_DREQ_SENT:
ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
break;
case IB_CM_ESTABLISHED:
if (cm_id_priv->id.lap_state == IB_CM_LAP_SENT ||
cm_id_priv->id.lap_state == IB_CM_MRA_LAP_RCVD)
ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
break;
case IB_CM_MRA_REP_RCVD:
break;
case IB_CM_TIMEWAIT:
atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
counter[CM_DREQ_COUNTER]);
if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))
goto unlock;
cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv,
cm_id_priv->private_data,
cm_id_priv->private_data_len);
spin_unlock_irq(&cm_id_priv->lock);
if (ib_post_send_mad(msg, NULL))
cm_free_msg(msg);
goto deref;
case IB_CM_DREQ_RCVD:
atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
counter[CM_DREQ_COUNTER]);
goto unlock;
default:
goto unlock;
}
cm_id_priv->id.state = IB_CM_DREQ_RCVD;
cm_id_priv->tid = dreq_msg->hdr.tid;
ret = atomic_inc_and_test(&cm_id_priv->work_count);
if (!ret)
list_add_tail(&work->list, &cm_id_priv->work_list);
spin_unlock_irq(&cm_id_priv->lock);
if (ret)
cm_process_work(cm_id_priv, work);
else
cm_deref_id(cm_id_priv);
return 0;
unlock: spin_unlock_irq(&cm_id_priv->lock);
deref: cm_deref_id(cm_id_priv);
return -EINVAL;
}
| 11,475
|
114,921
| 0
|
void TestingAutomationProvider::GetInitialLoadTimes(
Browser*,
DictionaryValue*,
IPC::Message* reply_message) {
scoped_ptr<DictionaryValue> return_value(
initial_load_observer_->GetTimingInformation());
std::string json_return;
base::JSONWriter::Write(return_value.get(), false, &json_return);
AutomationMsg_SendJSONRequest::WriteReplyParams(
reply_message, json_return, true);
Send(reply_message);
}
| 11,476
|
28,770
| 0
|
int kvm_hv_vapic_msr_read(struct kvm_vcpu *vcpu, u32 reg, u64 *data)
{
struct kvm_lapic *apic = vcpu->arch.apic;
u32 low, high = 0;
if (!kvm_vcpu_has_lapic(vcpu))
return 1;
if (apic_reg_read(apic, reg, 4, &low))
return 1;
if (reg == APIC_ICR)
apic_reg_read(apic, APIC_ICR2, 4, &high);
*data = (((u64)high) << 32) | low;
return 0;
}
| 11,477
|
154,319
| 0
|
void GLES2DecoderImpl::OnOutOfMemoryError() {
if (lose_context_when_out_of_memory_ && !WasContextLost()) {
error::ContextLostReason other = error::kOutOfMemory;
if (CheckResetStatus()) {
other = error::kUnknown;
} else {
MarkContextLost(error::kOutOfMemory);
}
group_->LoseContexts(other);
}
}
| 11,478
|
147,062
| 0
|
int WebLocalFrameImpl::SelectNearestFindMatch(const WebFloatPoint& point,
WebRect* selection_rect) {
return EnsureTextFinder().SelectNearestFindMatch(point, selection_rect);
}
| 11,479
|
66,497
| 0
|
static void free_skb_pool(rtl8150_t *dev)
{
int i;
for (i = 0; i < RX_SKB_POOL_SIZE; i++)
if (dev->rx_skb_pool[i])
dev_kfree_skb(dev->rx_skb_pool[i]);
}
| 11,480
|
12,969
| 0
|
ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
{
if (ssh->state->interactive_mode)
return sshbuf_len(ssh->state->output) < 16384;
else
return sshbuf_len(ssh->state->output) < 128 * 1024;
}
| 11,481
|
34,236
| 0
|
static void ip_vs_trash_cleanup(struct net *net)
{
struct ip_vs_dest *dest, *nxt;
struct netns_ipvs *ipvs = net_ipvs(net);
list_for_each_entry_safe(dest, nxt, &ipvs->dest_trash, n_list) {
list_del(&dest->n_list);
ip_vs_dst_reset(dest);
__ip_vs_unbind_svc(dest);
free_percpu(dest->stats.cpustats);
kfree(dest);
}
}
| 11,482
|
123,595
| 0
|
void InspectorPageAgent::applyEmulatedMedia(String* media)
{
String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
if (!emulatedMedia.isEmpty())
*media = emulatedMedia;
}
| 11,483
|
69,836
| 0
|
cell_queue_append(cell_queue_t *queue, packed_cell_t *cell)
{
if (queue->tail) {
tor_assert(!queue->tail->next);
queue->tail->next = cell;
} else {
queue->head = cell;
}
queue->tail = cell;
cell->next = NULL;
++queue->n;
}
| 11,484
|
80
| 0
|
long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
{
int ret=0;
#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
if (
#ifndef OPENSSL_NO_RSA
cmd == SSL_CTRL_SET_TMP_RSA ||
cmd == SSL_CTRL_SET_TMP_RSA_CB ||
#endif
#ifndef OPENSSL_NO_DSA
cmd == SSL_CTRL_SET_TMP_DH ||
cmd == SSL_CTRL_SET_TMP_DH_CB ||
#endif
0)
{
if (!ssl_cert_inst(&s->cert))
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_MALLOC_FAILURE);
return(0);
}
}
#endif
switch (cmd)
{
case SSL_CTRL_GET_SESSION_REUSED:
ret=s->hit;
break;
case SSL_CTRL_GET_CLIENT_CERT_REQUEST:
break;
case SSL_CTRL_GET_NUM_RENEGOTIATIONS:
ret=s->s3->num_renegotiations;
break;
case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS:
ret=s->s3->num_renegotiations;
s->s3->num_renegotiations=0;
break;
case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS:
ret=s->s3->total_renegotiations;
break;
case SSL_CTRL_GET_FLAGS:
ret=(int)(s->s3->flags);
break;
#ifndef OPENSSL_NO_RSA
case SSL_CTRL_NEED_TMP_RSA:
if ((s->cert != NULL) && (s->cert->rsa_tmp == NULL) &&
((s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL) ||
(EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey) > (512/8))))
ret = 1;
break;
case SSL_CTRL_SET_TMP_RSA:
{
RSA *rsa = (RSA *)parg;
if (rsa == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
return(ret);
}
if ((rsa = RSAPrivateKey_dup(rsa)) == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_RSA_LIB);
return(ret);
}
if (s->cert->rsa_tmp != NULL)
RSA_free(s->cert->rsa_tmp);
s->cert->rsa_tmp = rsa;
ret = 1;
}
break;
case SSL_CTRL_SET_TMP_RSA_CB:
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return(ret);
}
break;
#endif
#ifndef OPENSSL_NO_DH
case SSL_CTRL_SET_TMP_DH:
{
DH *dh = (DH *)parg;
if (dh == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
return(ret);
}
if ((dh = DHparams_dup(dh)) == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
return(ret);
}
if (!(s->options & SSL_OP_SINGLE_DH_USE))
{
if (!DH_generate_key(dh))
{
DH_free(dh);
SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
return(ret);
}
}
if (s->cert->dh_tmp != NULL)
DH_free(s->cert->dh_tmp);
s->cert->dh_tmp = dh;
ret = 1;
}
break;
case SSL_CTRL_SET_TMP_DH_CB:
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return(ret);
}
break;
#endif
#ifndef OPENSSL_NO_ECDH
case SSL_CTRL_SET_TMP_ECDH:
{
EC_KEY *ecdh = NULL;
if (parg == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
return(ret);
}
if (!EC_KEY_up_ref((EC_KEY *)parg))
{
SSLerr(SSL_F_SSL3_CTRL,ERR_R_ECDH_LIB);
return(ret);
}
ecdh = (EC_KEY *)parg;
if (!(s->options & SSL_OP_SINGLE_ECDH_USE))
{
if (!EC_KEY_generate_key(ecdh))
{
EC_KEY_free(ecdh);
SSLerr(SSL_F_SSL3_CTRL,ERR_R_ECDH_LIB);
return(ret);
}
}
if (s->cert->ecdh_tmp != NULL)
EC_KEY_free(s->cert->ecdh_tmp);
s->cert->ecdh_tmp = ecdh;
ret = 1;
}
break;
case SSL_CTRL_SET_TMP_ECDH_CB:
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return(ret);
}
break;
#endif /* !OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_TLSEXT
case SSL_CTRL_SET_TLSEXT_HOSTNAME:
if (larg == TLSEXT_NAMETYPE_host_name)
{
if (s->tlsext_hostname != NULL)
OPENSSL_free(s->tlsext_hostname);
s->tlsext_hostname = NULL;
ret = 1;
if (parg == NULL)
break;
if (strlen((char *)parg) > TLSEXT_MAXLEN_host_name)
{
SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
return 0;
}
if ((s->tlsext_hostname = BUF_strdup((char *)parg)) == NULL)
{
SSLerr(SSL_F_SSL3_CTRL, ERR_R_INTERNAL_ERROR);
return 0;
}
}
else
{
SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE);
return 0;
}
break;
case SSL_CTRL_SET_TLSEXT_DEBUG_ARG:
s->tlsext_debug_arg=parg;
ret = 1;
break;
#ifdef TLSEXT_TYPE_opaque_prf_input
case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT:
if (larg > 12288) /* actual internal limit is 2^16 for the complete hello message
* (including the cert chain and everything) */
{
SSLerr(SSL_F_SSL3_CTRL, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG);
break;
}
if (s->tlsext_opaque_prf_input != NULL)
OPENSSL_free(s->tlsext_opaque_prf_input);
if ((size_t)larg == 0)
s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
else
s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg);
if (s->tlsext_opaque_prf_input != NULL)
{
s->tlsext_opaque_prf_input_len = (size_t)larg;
ret = 1;
}
else
s->tlsext_opaque_prf_input_len = 0;
break;
#endif
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
s->tlsext_status_type=larg;
ret = 1;
break;
case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS:
*(STACK_OF(X509_EXTENSION) **)parg = s->tlsext_ocsp_exts;
ret = 1;
break;
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS:
s->tlsext_ocsp_exts = parg;
ret = 1;
break;
case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS:
*(STACK_OF(OCSP_RESPID) **)parg = s->tlsext_ocsp_ids;
ret = 1;
break;
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS:
s->tlsext_ocsp_ids = parg;
ret = 1;
break;
case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP:
*(unsigned char **)parg = s->tlsext_ocsp_resp;
return s->tlsext_ocsp_resplen;
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
if (s->tlsext_ocsp_resp)
OPENSSL_free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = parg;
s->tlsext_ocsp_resplen = larg;
ret = 1;
break;
#ifndef OPENSSL_NO_HEARTBEATS
case SSL_CTRL_TLS_EXT_SEND_HEARTBEAT:
if (SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER)
ret = dtls1_heartbeat(s);
else
ret = tls1_heartbeat(s);
break;
case SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING:
ret = s->tlsext_hb_pending;
break;
case SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS:
if (larg)
s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
else
s->tlsext_heartbeat &= ~SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
ret = 1;
break;
#endif
#endif /* !OPENSSL_NO_TLSEXT */
default:
break;
}
return(ret);
}
| 11,485
|
21,991
| 0
|
raptor_option_get_option_area_for_domain(raptor_domain domain)
{
raptor_option_area area = RAPTOR_OPTION_AREA_NONE;
if(domain == RAPTOR_DOMAIN_PARSER)
area = RAPTOR_OPTION_AREA_PARSER;
else if(domain == RAPTOR_DOMAIN_SERIALIZER)
area = RAPTOR_OPTION_AREA_SERIALIZER;
else if(domain == RAPTOR_DOMAIN_SAX2)
area = RAPTOR_OPTION_AREA_SAX2;
else if(domain == RAPTOR_DOMAIN_XML_WRITER)
area = RAPTOR_OPTION_AREA_XML_WRITER;
else if(domain == RAPTOR_DOMAIN_TURTLE_WRITER)
area = RAPTOR_OPTION_AREA_TURTLE_WRITER;
return area;
}
| 11,486
|
89,138
| 0
|
compile_string_raw_node(StrNode* sn, regex_t* reg)
{
if (sn->end <= sn->s)
return 0;
return add_compile_string(sn->s, 1 /* sb */, (int )(sn->end - sn->s), reg, 0);
}
| 11,487
|
172,076
| 0
|
static inline int create_server_socket(const char* name)
{
int s = socket(AF_LOCAL, SOCK_STREAM, 0);
if(s < 0)
return -1;
APPL_TRACE_DEBUG("covert name to android abstract name:%s", name);
if(socket_local_server_bind(s, name, ANDROID_SOCKET_NAMESPACE_ABSTRACT) >= 0)
{
if(listen(s, 5) == 0)
{
APPL_TRACE_DEBUG("listen to local socket:%s, fd:%d", name, s);
return s;
}
else APPL_TRACE_ERROR("listen to local socket:%s, fd:%d failed, errno:%d", name, s, errno);
}
else APPL_TRACE_ERROR("create local socket:%s fd:%d, failed, errno:%d", name, s, errno);
close(s);
return -1;
}
| 11,488
|
66,889
| 0
|
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
u64 from = ((u64)pfn) << PAGE_SHIFT;
u64 to = from + size;
u64 cursor = from;
while (cursor < to) {
if (!devmem_is_allowed(pfn))
return 0;
cursor += PAGE_SIZE;
pfn++;
}
return 1;
}
| 11,489
|
80,353
| 0
|
GF_Box *rssr_New()
{
ISOM_DECL_BOX_ALLOC(GF_ReceivedSsrcBox, GF_ISOM_BOX_TYPE_RSSR);
return (GF_Box *)tmp;
}
| 11,490
|
104,663
| 0
|
ExtensionManifestTest() : enable_apps_(true) {}
| 11,491
|
18,056
| 0
|
jbig2_image_clear(Jbig2Ctx *ctx, Jbig2Image *image, int value)
{
const uint8_t fill = value ? 0xFF : 0x00;
memset(image->data, fill, image->stride * image->height);
}
| 11,492
|
62,793
| 0
|
static void MSLStartElement(void *context,const xmlChar *tag,
const xmlChar **attributes)
{
AffineMatrix
affine,
current;
ChannelType
channel;
ChannelType
channel_mask;
char
*attribute,
key[MagickPathExtent],
*value;
const char
*keyword;
double
angle;
DrawInfo
*draw_info;
ExceptionInfo
*exception;
GeometryInfo
geometry_info;
Image
*image;
int
flags;
ssize_t
option,
j,
n,
x,
y;
MSLInfo
*msl_info;
RectangleInfo
geometry;
register ssize_t
i;
size_t
height,
width;
/*
Called when an opening tag has been processed.
*/
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.startElement(%s",tag);
exception=AcquireExceptionInfo();
msl_info=(MSLInfo *) context;
n=msl_info->n;
keyword=(const char *) NULL;
value=(char *) NULL;
SetGeometryInfo(&geometry_info);
(void) ResetMagickMemory(&geometry,0,sizeof(geometry));
channel=DefaultChannels;
switch (*tag)
{
case 'A':
case 'a':
{
if (LocaleCompare((const char *) tag,"add-noise") == 0)
{
Image
*noise_image;
NoiseType
noise;
/*
Add noise image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
noise=UniformNoise;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'N':
case 'n':
{
if (LocaleCompare(keyword,"noise") == 0)
{
option=ParseCommandOption(MagickNoiseOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedNoiseType",
value);
noise=(NoiseType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
channel_mask=SetImageChannelMask(msl_info->image[n],channel);
noise_image=AddNoiseImage(msl_info->image[n],noise,1.0,
msl_info->exception);
(void) SetPixelChannelMask(msl_info->image[n],channel_mask);
if (noise_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=noise_image;
break;
}
if (LocaleCompare((const char *) tag,"annotate") == 0)
{
char
text[MagickPathExtent];
/*
Annotate image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
angle=0.0;
current=draw_info->affine;
GetAffineMatrix(&affine);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"affine") == 0)
{
char
*p;
p=value;
draw_info->affine.sx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.rx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ry=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.sy=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.tx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ty=StringToDouble(p,&p);
break;
}
if (LocaleCompare(keyword,"align") == 0)
{
option=ParseCommandOption(MagickAlignOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedAlignType",
value);
draw_info->align=(AlignType) option;
break;
}
if (LocaleCompare(keyword,"antialias") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
draw_info->stroke_antialias=(MagickBooleanType) option;
draw_info->text_antialias=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"density") == 0)
{
CloneString(&draw_info->density,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'E':
case 'e':
{
if (LocaleCompare(keyword,"encoding") == 0)
{
CloneString(&draw_info->encoding,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->fill,exception);
break;
}
if (LocaleCompare(keyword,"family") == 0)
{
CloneString(&draw_info->family,value);
break;
}
if (LocaleCompare(keyword,"font") == 0)
{
CloneString(&draw_info->font,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGravityGeometry(msl_info->image[n],value,
&geometry,exception);
break;
}
if (LocaleCompare(keyword,"gravity") == 0)
{
option=ParseCommandOption(MagickGravityOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedGravityType",
value);
draw_info->gravity=(GravityType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'P':
case 'p':
{
if (LocaleCompare(keyword,"pointsize") == 0)
{
draw_info->pointsize=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"scale") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.sx=geometry_info.rho;
affine.sy=geometry_info.sigma;
break;
}
if (LocaleCompare(keyword,"skewX") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.ry=tan(DegreesToRadians(fmod((double) angle,
360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.rx=tan(DegreesToRadians(fmod((double) angle,
360.0)));
break;
}
if (LocaleCompare(keyword,"stretch") == 0)
{
option=ParseCommandOption(MagickStretchOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStretchType",
value);
draw_info->stretch=(StretchType) option;
break;
}
if (LocaleCompare(keyword, "stroke") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->stroke,exception);
break;
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
option=ParseCommandOption(MagickStyleOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStyleType",
value);
draw_info->style=(StyleType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"text") == 0)
{
CloneString(&draw_info->text,value);
break;
}
if (LocaleCompare(keyword,"translate") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.tx=geometry_info.rho;
affine.ty=geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'U':
case 'u':
{
if (LocaleCompare(keyword, "undercolor") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->undercolor,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"weight") == 0)
{
draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) FormatLocaleString(text,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
affine.tx;
draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
affine.ty;
(void) AnnotateImage(msl_info->image[n],draw_info,
msl_info->exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
if (LocaleCompare((const char *) tag,"append") == 0)
{
Image
*append_image;
MagickBooleanType
stack;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
stack=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'S':
case 's':
{
if (LocaleCompare(keyword,"stack") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
stack=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
append_image=AppendImages(msl_info->image[n],stack,
msl_info->exception);
if (append_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=append_image;
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
break;
}
case 'B':
case 'b':
{
if (LocaleCompare((const char *) tag,"blur") == 0)
{
Image
*blur_image;
/*
Blur image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sigma") == 0)
{
geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
channel_mask=SetImageChannelMask(msl_info->image[n],channel);
blur_image=BlurImage(msl_info->image[n],geometry_info.rho,
geometry_info.sigma,msl_info->exception);
(void) SetPixelChannelMask(msl_info->image[n],channel_mask);
if (blur_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=blur_image;
break;
}
if (LocaleCompare((const char *) tag,"border") == 0)
{
Image
*border_image;
/*
Border image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"compose") == 0)
{
option=ParseCommandOption(MagickComposeOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedComposeType",
value);
msl_info->image[n]->compose=(CompositeOperator) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&msl_info->image[n]->border_color,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
border_image=BorderImage(msl_info->image[n],&geometry,
msl_info->image[n]->compose,msl_info->exception);
if (border_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=border_image;
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'C':
case 'c':
{
if (LocaleCompare((const char *) tag,"colorize") == 0)
{
char
blend[MagickPathExtent];
Image
*colorize_image;
PixelInfo
target;
/*
Add noise image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
GetPixelInfo(msl_info->image[n],&target);
(void) CopyMagickString(blend,"100",MagickPathExtent);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"blend") == 0)
{
(void) CopyMagickString(blend,value,MagickPathExtent);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&target,msl_info->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
colorize_image=ColorizeImage(msl_info->image[n],blend,&target,
msl_info->exception);
if (colorize_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=colorize_image;
break;
}
if (LocaleCompare((const char *) tag, "charcoal") == 0)
{
double
radius = 0.0,
sigma = 1.0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
/*
NOTE: charcoal can have no attributes, since we use all the defaults!
*/
if (attributes != (const xmlChar **) NULL)
{
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
radius=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sigma") == 0)
{
sigma = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
}
/*
charcoal image.
*/
{
Image
*newImage;
newImage=CharcoalImage(msl_info->image[n],radius,sigma,
msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
}
}
if (LocaleCompare((const char *) tag,"chop") == 0)
{
Image
*chop_image;
/*
Chop image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
chop_image=ChopImage(msl_info->image[n],&geometry,
msl_info->exception);
if (chop_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=chop_image;
break;
}
if (LocaleCompare((const char *) tag,"color-floodfill") == 0)
{
PaintMethod
paint_method;
PixelInfo
target;
/*
Color floodfill image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
SetGeometry(msl_info->image[n],&geometry);
paint_method=FloodfillMethod;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"bordercolor") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&target,exception);
paint_method=FillToBorderMethod;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->fill,exception);
break;
}
if (LocaleCompare(keyword,"fuzz") == 0)
{
msl_info->image[n]->fuzz=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) FloodfillPaintImage(msl_info->image[n],draw_info,&target,
geometry.x,geometry.y,paint_method == FloodfillMethod ?
MagickFalse : MagickTrue,msl_info->exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
if (LocaleCompare((const char *) tag,"comment") == 0)
break;
if (LocaleCompare((const char *) tag,"composite") == 0)
{
char
composite_geometry[MagickPathExtent];
CompositeOperator
compose;
Image
*composite_image,
*rotate_image;
/*
Composite image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
composite_image=NewImageList();
compose=OverCompositeOp;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"compose") == 0)
{
option=ParseCommandOption(MagickComposeOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedComposeType",
value);
compose=(CompositeOperator) option;
break;
}
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
for (j=0; j < msl_info->n; j++)
{
const char
*attribute;
attribute=GetImageProperty(msl_info->attributes[j],"id",
exception);
if ((attribute != (const char *) NULL) &&
(LocaleCompare(attribute,value) == 0))
{
composite_image=CloneImage(msl_info->image[j],0,0,
MagickFalse,exception);
break;
}
}
break;
}
default:
break;
}
}
if (composite_image == (Image *) NULL)
break;
rotate_image=NewImageList();
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"blend") == 0)
{
(void) SetImageArtifact(composite_image,
"compose:args",value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
if (LocaleCompare(keyword, "color") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&composite_image->background_color,exception);
break;
}
if (LocaleCompare(keyword,"compose") == 0)
break;
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
if (LocaleCompare(keyword,"gravity") == 0)
{
option=ParseCommandOption(MagickGravityOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedGravityType",
value);
msl_info->image[n]->gravity=(GravityType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
break;
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'M':
case 'm':
{
if (LocaleCompare(keyword,"mask") == 0)
for (j=0; j < msl_info->n; j++)
{
const char
*attribute;
attribute=GetImageProperty(msl_info->attributes[j],"id",
exception);
if ((attribute != (const char *) NULL) &&
(LocaleCompare(value,value) == 0))
{
SetImageType(composite_image,TrueColorAlphaType,
exception);
(void) CompositeImage(composite_image,
msl_info->image[j],CopyAlphaCompositeOp,MagickTrue,
0,0,exception);
break;
}
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"opacity") == 0)
{
ssize_t
opacity,
y;
register ssize_t
x;
register Quantum
*q;
CacheView
*composite_view;
opacity=StringToLong(value);
if (compose != DissolveCompositeOp)
{
(void) SetImageAlpha(composite_image,(Quantum)
opacity,exception);
break;
}
(void) SetImageArtifact(msl_info->image[n],
"compose:args",value);
if (composite_image->alpha_trait == UndefinedPixelTrait)
(void) SetImageAlpha(composite_image,OpaqueAlpha,
exception);
composite_view=AcquireAuthenticCacheView(composite_image,exception);
for (y=0; y < (ssize_t) composite_image->rows ; y++)
{
q=GetCacheViewAuthenticPixels(composite_view,0,y,
(ssize_t) composite_image->columns,1,exception);
for (x=0; x < (ssize_t) composite_image->columns; x++)
{
if (GetPixelAlpha(composite_image,q) == OpaqueAlpha)
SetPixelAlpha(composite_image,
ClampToQuantum(opacity),q);
q+=GetPixelChannels(composite_image);
}
if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
break;
}
composite_view=DestroyCacheView(composite_view);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
rotate_image=RotateImage(composite_image,
StringToDouble(value,(char **) NULL),exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"tile") == 0)
{
MagickBooleanType
tile;
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
tile=(MagickBooleanType) option;
(void) tile;
if (rotate_image != (Image *) NULL)
(void) SetImageArtifact(rotate_image,
"compose:outside-overlay","false");
else
(void) SetImageArtifact(composite_image,
"compose:outside-overlay","false");
image=msl_info->image[n];
height=composite_image->rows;
width=composite_image->columns;
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) height)
for (x=0; x < (ssize_t) image->columns; x+=(ssize_t) width)
{
if (rotate_image != (Image *) NULL)
(void) CompositeImage(image,rotate_image,compose,
MagickTrue,x,y,exception);
else
(void) CompositeImage(image,composite_image,
compose,MagickTrue,x,y,exception);
}
if (rotate_image != (Image *) NULL)
rotate_image=DestroyImage(rotate_image);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
image=msl_info->image[n];
(void) FormatLocaleString(composite_geometry,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,
(double) composite_image->rows,(double) geometry.x,(double)
geometry.y);
flags=ParseGravityGeometry(image,composite_geometry,&geometry,
exception);
channel_mask=SetImageChannelMask(image,channel);
if (rotate_image == (Image *) NULL)
CompositeImage(image,composite_image,compose,MagickTrue,geometry.x,
geometry.y,exception);
else
{
/*
Rotate image.
*/
geometry.x-=(ssize_t) (rotate_image->columns-
composite_image->columns)/2;
geometry.y-=(ssize_t) (rotate_image->rows-
composite_image->rows)/2;
CompositeImage(image,rotate_image,compose,MagickTrue,geometry.x,
geometry.y,exception);
rotate_image=DestroyImage(rotate_image);
}
(void) SetImageChannelMask(image,channel_mask);
composite_image=DestroyImage(composite_image);
break;
}
if (LocaleCompare((const char *) tag,"contrast") == 0)
{
MagickBooleanType
sharpen;
/*
Contrast image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
sharpen=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sharpen") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
sharpen=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) ContrastImage(msl_info->image[n],sharpen,
msl_info->exception);
break;
}
if (LocaleCompare((const char *) tag,"crop") == 0)
{
Image
*crop_image;
/*
Crop image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGravityGeometry(msl_info->image[n],value,
&geometry,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
crop_image=CropImage(msl_info->image[n],&geometry,
msl_info->exception);
if (crop_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=crop_image;
break;
}
if (LocaleCompare((const char *) tag,"cycle-colormap") == 0)
{
ssize_t
display;
/*
Cycle-colormap image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
display=0;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"display") == 0)
{
display=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) CycleColormapImage(msl_info->image[n],display,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'D':
case 'd':
{
if (LocaleCompare((const char *) tag,"despeckle") == 0)
{
Image
*despeckle_image;
/*
Despeckle image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
despeckle_image=DespeckleImage(msl_info->image[n],
msl_info->exception);
if (despeckle_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=despeckle_image;
break;
}
if (LocaleCompare((const char *) tag,"display") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) DisplayImages(msl_info->image_info[n],msl_info->image[n],
msl_info->exception);
break;
}
if (LocaleCompare((const char *) tag,"draw") == 0)
{
char
text[MagickPathExtent];
/*
Annotate image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
angle=0.0;
current=draw_info->affine;
GetAffineMatrix(&affine);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"affine") == 0)
{
char
*p;
p=value;
draw_info->affine.sx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.rx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ry=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.sy=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.tx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ty=StringToDouble(p,&p);
break;
}
if (LocaleCompare(keyword,"align") == 0)
{
option=ParseCommandOption(MagickAlignOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedAlignType",
value);
draw_info->align=(AlignType) option;
break;
}
if (LocaleCompare(keyword,"antialias") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
draw_info->stroke_antialias=(MagickBooleanType) option;
draw_info->text_antialias=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"density") == 0)
{
CloneString(&draw_info->density,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'E':
case 'e':
{
if (LocaleCompare(keyword,"encoding") == 0)
{
CloneString(&draw_info->encoding,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->fill,exception);
break;
}
if (LocaleCompare(keyword,"family") == 0)
{
CloneString(&draw_info->family,value);
break;
}
if (LocaleCompare(keyword,"font") == 0)
{
CloneString(&draw_info->font,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
if (LocaleCompare(keyword,"gravity") == 0)
{
option=ParseCommandOption(MagickGravityOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedGravityType",
value);
draw_info->gravity=(GravityType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'P':
case 'p':
{
if (LocaleCompare(keyword,"points") == 0)
{
if (LocaleCompare(draw_info->primitive,"path") == 0)
{
(void) ConcatenateString(&draw_info->primitive," '");
ConcatenateString(&draw_info->primitive,value);
(void) ConcatenateString(&draw_info->primitive,"'");
}
else
{
(void) ConcatenateString(&draw_info->primitive," ");
ConcatenateString(&draw_info->primitive,value);
}
break;
}
if (LocaleCompare(keyword,"pointsize") == 0)
{
draw_info->pointsize=StringToDouble(value,
(char **) NULL);
break;
}
if (LocaleCompare(keyword,"primitive") == 0)
{
CloneString(&draw_info->primitive,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"scale") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.sx=geometry_info.rho;
affine.sy=geometry_info.sigma;
break;
}
if (LocaleCompare(keyword,"skewX") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.ry=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.rx=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"stretch") == 0)
{
option=ParseCommandOption(MagickStretchOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStretchType",
value);
draw_info->stretch=(StretchType) option;
break;
}
if (LocaleCompare(keyword, "stroke") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->stroke,exception);
break;
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
option=ParseCommandOption(MagickStyleOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStyleType",
value);
draw_info->style=(StyleType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"text") == 0)
{
(void) ConcatenateString(&draw_info->primitive," '");
(void) ConcatenateString(&draw_info->primitive,value);
(void) ConcatenateString(&draw_info->primitive,"'");
break;
}
if (LocaleCompare(keyword,"translate") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.tx=geometry_info.rho;
affine.ty=geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'U':
case 'u':
{
if (LocaleCompare(keyword, "undercolor") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->undercolor,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"weight") == 0)
{
draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) FormatLocaleString(text,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
affine.tx;
draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
affine.ty;
(void) DrawImage(msl_info->image[n],draw_info,exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'E':
case 'e':
{
if (LocaleCompare((const char *) tag,"edge") == 0)
{
Image
*edge_image;
/*
Edge image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
edge_image=EdgeImage(msl_info->image[n],geometry_info.rho,
msl_info->exception);
if (edge_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=edge_image;
break;
}
if (LocaleCompare((const char *) tag,"emboss") == 0)
{
Image
*emboss_image;
/*
Emboss image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sigma") == 0)
{
geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
emboss_image=EmbossImage(msl_info->image[n],geometry_info.rho,
geometry_info.sigma,msl_info->exception);
if (emboss_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=emboss_image;
break;
}
if (LocaleCompare((const char *) tag,"enhance") == 0)
{
Image
*enhance_image;
/*
Enhance image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
enhance_image=EnhanceImage(msl_info->image[n],
msl_info->exception);
if (enhance_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=enhance_image;
break;
}
if (LocaleCompare((const char *) tag,"equalize") == 0)
{
/*
Equalize image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) EqualizeImage(msl_info->image[n],
msl_info->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'F':
case 'f':
{
if (LocaleCompare((const char *) tag, "flatten") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
/* no attributes here */
/* process the image */
{
Image
*newImage;
newImage=MergeImageLayers(msl_info->image[n],FlattenLayer,
msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
}
}
if (LocaleCompare((const char *) tag,"flip") == 0)
{
Image
*flip_image;
/*
Flip image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
flip_image=FlipImage(msl_info->image[n],
msl_info->exception);
if (flip_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=flip_image;
break;
}
if (LocaleCompare((const char *) tag,"flop") == 0)
{
Image
*flop_image;
/*
Flop image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
flop_image=FlopImage(msl_info->image[n],
msl_info->exception);
if (flop_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=flop_image;
break;
}
if (LocaleCompare((const char *) tag,"frame") == 0)
{
FrameInfo
frame_info;
Image
*frame_image;
/*
Frame image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
(void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"compose") == 0)
{
option=ParseCommandOption(MagickComposeOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedComposeType",
value);
msl_info->image[n]->compose=(CompositeOperator) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&msl_info->image[n]->matte_color,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
frame_info.width=geometry.width;
frame_info.height=geometry.height;
frame_info.outer_bevel=geometry.x;
frame_info.inner_bevel=geometry.y;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
frame_info.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"inner") == 0)
{
frame_info.inner_bevel=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"outer") == 0)
{
frame_info.outer_bevel=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
frame_info.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
frame_info.x=(ssize_t) frame_info.width;
frame_info.y=(ssize_t) frame_info.height;
frame_info.width=msl_info->image[n]->columns+2*frame_info.x;
frame_info.height=msl_info->image[n]->rows+2*frame_info.y;
frame_image=FrameImage(msl_info->image[n],&frame_info,
msl_info->image[n]->compose,msl_info->exception);
if (frame_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=frame_image;
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'G':
case 'g':
{
if (LocaleCompare((const char *) tag,"gamma") == 0)
{
char
gamma[MagickPathExtent];
PixelInfo
pixel;
/*
Gamma image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
channel=UndefinedChannel;
pixel.red=0.0;
pixel.green=0.0;
pixel.blue=0.0;
*gamma='\0';
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"blue") == 0)
{
pixel.blue=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"gamma") == 0)
{
(void) CopyMagickString(gamma,value,MagickPathExtent);
break;
}
if (LocaleCompare(keyword,"green") == 0)
{
pixel.green=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"red") == 0)
{
pixel.red=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
if (*gamma == '\0')
(void) FormatLocaleString(gamma,MagickPathExtent,"%g,%g,%g",
(double) pixel.red,(double) pixel.green,(double) pixel.blue);
(void) GammaImage(msl_info->image[n],strtod(gamma,(char **) NULL),
msl_info->exception);
break;
}
else if (LocaleCompare((const char *) tag,"get") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
CloneString(&value,(const char *) attributes[i]);
(void) CopyMagickString(key,value,MagickPathExtent);
switch (*keyword)
{
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
(void) FormatLocaleString(value,MagickPathExtent,"%.20g",
(double) msl_info->image[n]->rows);
(void) SetImageProperty(msl_info->attributes[n],key,value,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
(void) FormatLocaleString(value,MagickPathExtent,"%.20g",
(double) msl_info->image[n]->columns);
(void) SetImageProperty(msl_info->attributes[n],key,value,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
break;
}
else if (LocaleCompare((const char *) tag, "group") == 0)
{
msl_info->number_groups++;
msl_info->group_info=(MSLGroupInfo *) ResizeQuantumMemory(
msl_info->group_info,msl_info->number_groups+1UL,
sizeof(*msl_info->group_info));
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'I':
case 'i':
{
if (LocaleCompare((const char *) tag,"image") == 0)
{
MSLPushImage(msl_info,(Image *) NULL);
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"color") == 0)
{
Image
*next_image;
(void) CopyMagickString(msl_info->image_info[n]->filename,
"xc:",MagickPathExtent);
(void) ConcatenateMagickString(msl_info->image_info[n]->
filename,value,MagickPathExtent);
next_image=ReadImage(msl_info->image_info[n],exception);
CatchException(exception);
if (next_image == (Image *) NULL)
continue;
if (msl_info->image[n] == (Image *) NULL)
msl_info->image[n]=next_image;
else
{
register Image
*p;
/*
Link image into image list.
*/
p=msl_info->image[n];
while (p->next != (Image *) NULL)
p=GetNextImageInList(p);
next_image->previous=p;
p->next=next_image;
}
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
break;
}
default:
{
(void) SetMSLAttributes(msl_info,keyword,value);
break;
}
}
}
break;
}
if (LocaleCompare((const char *) tag,"implode") == 0)
{
Image
*implode_image;
/*
Implode image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"amount") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
implode_image=ImplodeImage(msl_info->image[n],geometry_info.rho,
msl_info->image[n]->interpolate,msl_info->exception);
if (implode_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=implode_image;
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'L':
case 'l':
{
if (LocaleCompare((const char *) tag,"label") == 0)
break;
if (LocaleCompare((const char *) tag, "level") == 0)
{
double
levelBlack = 0, levelGamma = 1, levelWhite = QuantumRange;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
CloneString(&value,(const char *) attributes[i]);
(void) CopyMagickString(key,value,MagickPathExtent);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"black") == 0)
{
levelBlack = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"gamma") == 0)
{
levelGamma = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"white") == 0)
{
levelWhite = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/* process image */
LevelImage(msl_info->image[n],levelBlack,levelWhite,levelGamma,
msl_info->exception);
break;
}
}
case 'M':
case 'm':
{
if (LocaleCompare((const char *) tag,"magnify") == 0)
{
Image
*magnify_image;
/*
Magnify image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
magnify_image=MagnifyImage(msl_info->image[n],
msl_info->exception);
if (magnify_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=magnify_image;
break;
}
if (LocaleCompare((const char *) tag,"map") == 0)
{
Image
*affinity_image;
MagickBooleanType
dither;
QuantizeInfo
*quantize_info;
/*
Map image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
affinity_image=NewImageList();
dither=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"dither") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
dither=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
for (j=0; j < msl_info->n; j++)
{
const char
*attribute;
attribute=GetImageProperty(msl_info->attributes[j],"id",
exception);
if ((attribute != (const char *) NULL) &&
(LocaleCompare(attribute,value) == 0))
{
affinity_image=CloneImage(msl_info->image[j],0,0,
MagickFalse,exception);
break;
}
}
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
quantize_info=AcquireQuantizeInfo(msl_info->image_info[n]);
quantize_info->dither_method=dither != MagickFalse ?
RiemersmaDitherMethod : NoDitherMethod;
(void) RemapImages(quantize_info,msl_info->image[n],
affinity_image,exception);
quantize_info=DestroyQuantizeInfo(quantize_info);
affinity_image=DestroyImage(affinity_image);
break;
}
if (LocaleCompare((const char *) tag,"matte-floodfill") == 0)
{
double
opacity;
PixelInfo
target;
PaintMethod
paint_method;
/*
Matte floodfill image.
*/
opacity=0.0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
SetGeometry(msl_info->image[n],&geometry);
paint_method=FloodfillMethod;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"bordercolor") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&target,exception);
paint_method=FillToBorderMethod;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fuzz") == 0)
{
msl_info->image[n]->fuzz=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"opacity") == 0)
{
opacity=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
(void) GetOneVirtualPixelInfo(msl_info->image[n],
TileVirtualPixelMethod,geometry.x,geometry.y,&target,
exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
draw_info->fill.alpha=ClampToQuantum(opacity);
channel_mask=SetImageChannelMask(msl_info->image[n],AlphaChannel);
(void) FloodfillPaintImage(msl_info->image[n],draw_info,&target,
geometry.x,geometry.y,paint_method == FloodfillMethod ?
MagickFalse : MagickTrue,msl_info->exception);
(void) SetPixelChannelMask(msl_info->image[n],channel_mask);
draw_info=DestroyDrawInfo(draw_info);
break;
}
if (LocaleCompare((const char *) tag,"median-filter") == 0)
{
Image
*median_image;
/*
Median-filter image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
median_image=StatisticImage(msl_info->image[n],MedianStatistic,
(size_t) geometry_info.rho,(size_t) geometry_info.sigma,
msl_info->exception);
if (median_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=median_image;
break;
}
if (LocaleCompare((const char *) tag,"minify") == 0)
{
Image
*minify_image;
/*
Minify image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
minify_image=MinifyImage(msl_info->image[n],
msl_info->exception);
if (minify_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=minify_image;
break;
}
if (LocaleCompare((const char *) tag,"msl") == 0 )
break;
if (LocaleCompare((const char *) tag,"modulate") == 0)
{
char
modulate[MagickPathExtent];
/*
Modulate image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
geometry_info.rho=100.0;
geometry_info.sigma=100.0;
geometry_info.xi=100.0;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'B':
case 'b':
{
if (LocaleCompare(keyword,"blackness") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
if (LocaleCompare(keyword,"brightness") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"factor") == 0)
{
flags=ParseGeometry(value,&geometry_info);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"hue") == 0)
{
geometry_info.xi=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'L':
case 'l':
{
if (LocaleCompare(keyword,"lightness") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"saturation") == 0)
{
geometry_info.sigma=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"whiteness") == 0)
{
geometry_info.sigma=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
geometry_info.rho,geometry_info.sigma,geometry_info.xi);
(void) ModulateImage(msl_info->image[n],modulate,
msl_info->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'N':
case 'n':
{
if (LocaleCompare((const char *) tag,"negate") == 0)
{
MagickBooleanType
gray;
/*
Negate image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
gray=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"gray") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
gray=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
channel_mask=SetImageChannelMask(msl_info->image[n],channel);
(void) NegateImage(msl_info->image[n],gray,
msl_info->exception);
(void) SetPixelChannelMask(msl_info->image[n],channel_mask);
break;
}
if (LocaleCompare((const char *) tag,"normalize") == 0)
{
/*
Normalize image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) NormalizeImage(msl_info->image[n],
msl_info->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'O':
case 'o':
{
if (LocaleCompare((const char *) tag,"oil-paint") == 0)
{
Image
*paint_image;
/*
Oil-paint image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
paint_image=OilPaintImage(msl_info->image[n],geometry_info.rho,
geometry_info.sigma,msl_info->exception);
if (paint_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=paint_image;
break;
}
if (LocaleCompare((const char *) tag,"opaque") == 0)
{
PixelInfo
fill_color,
target;
/*
Opaque image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
(void) QueryColorCompliance("none",AllCompliance,&target,
exception);
(void) QueryColorCompliance("none",AllCompliance,&fill_color,
exception);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"channel") == 0)
{
option=ParseChannelOption(value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedChannelType",
value);
channel=(ChannelType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&fill_color,exception);
break;
}
if (LocaleCompare(keyword,"fuzz") == 0)
{
msl_info->image[n]->fuzz=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
channel_mask=SetImageChannelMask(msl_info->image[n],channel);
(void) OpaquePaintImage(msl_info->image[n],&target,&fill_color,
MagickFalse,msl_info->exception);
(void) SetPixelChannelMask(msl_info->image[n],channel_mask);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'P':
case 'p':
{
if (LocaleCompare((const char *) tag,"print") == 0)
{
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"output") == 0)
{
(void) FormatLocaleFile(stdout,"%s",value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
break;
}
if (LocaleCompare((const char *) tag, "profile") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
const char
*name;
const StringInfo
*profile;
Image
*profile_image;
ImageInfo
*profile_info;
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
if (*keyword == '!')
{
/*
Remove a profile from the image.
*/
(void) ProfileImage(msl_info->image[n],keyword,
(const unsigned char *) NULL,0,exception);
continue;
}
/*
Associate a profile with the image.
*/
profile_info=CloneImageInfo(msl_info->image_info[n]);
profile=GetImageProfile(msl_info->image[n],"iptc");
if (profile != (StringInfo *) NULL)
profile_info->profile=(void *) CloneStringInfo(profile);
profile_image=GetImageCache(profile_info,keyword,exception);
profile_info=DestroyImageInfo(profile_info);
if (profile_image == (Image *) NULL)
{
char
name[MagickPathExtent],
filename[MagickPathExtent];
register char
*p;
StringInfo
*profile;
(void) CopyMagickString(filename,keyword,MagickPathExtent);
(void) CopyMagickString(name,keyword,MagickPathExtent);
for (p=filename; *p != '\0'; p++)
if ((*p == ':') && (IsPathDirectory(keyword) < 0) &&
(IsPathAccessible(keyword) == MagickFalse))
{
register char
*q;
/*
Look for profile name (e.g. name:profile).
*/
(void) CopyMagickString(name,filename,(size_t)
(p-filename+1));
for (q=filename; *q != '\0'; q++)
*q=(*++p);
break;
}
profile=FileToStringInfo(filename,~0UL,exception);
if (profile != (StringInfo *) NULL)
{
(void) ProfileImage(msl_info->image[n],name,
GetStringInfoDatum(profile),(size_t)
GetStringInfoLength(profile),exception);
profile=DestroyStringInfo(profile);
}
continue;
}
ResetImageProfileIterator(profile_image);
name=GetNextImageProfile(profile_image);
while (name != (const char *) NULL)
{
profile=GetImageProfile(profile_image,name);
if (profile != (StringInfo *) NULL)
(void) ProfileImage(msl_info->image[n],name,
GetStringInfoDatum(profile),(size_t)
GetStringInfoLength(profile),exception);
name=GetNextImageProfile(profile_image);
}
profile_image=DestroyImage(profile_image);
}
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'Q':
case 'q':
{
if (LocaleCompare((const char *) tag,"quantize") == 0)
{
QuantizeInfo
quantize_info;
/*
Quantize image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
GetQuantizeInfo(&quantize_info);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"colors") == 0)
{
quantize_info.number_colors=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
option=ParseCommandOption(MagickColorspaceOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,
"UnrecognizedColorspaceType",value);
quantize_info.colorspace=(ColorspaceType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"dither") == 0)
{
option=ParseCommandOption(MagickDitherOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
quantize_info.dither_method=(DitherMethod) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'M':
case 'm':
{
if (LocaleCompare(keyword,"measure") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
quantize_info.measure_error=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"treedepth") == 0)
{
quantize_info.tree_depth=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) QuantizeImage(&quantize_info,msl_info->image[n],exception);
break;
}
if (LocaleCompare((const char *) tag,"query-font-metrics") == 0)
{
char
text[MagickPathExtent];
MagickBooleanType
status;
TypeMetric
metrics;
/*
Query font metrics.
*/
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
angle=0.0;
current=draw_info->affine;
GetAffineMatrix(&affine);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"affine") == 0)
{
char
*p;
p=value;
draw_info->affine.sx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.rx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ry=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.sy=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.tx=StringToDouble(p,&p);
if (*p ==',')
p++;
draw_info->affine.ty=StringToDouble(p,&p);
break;
}
if (LocaleCompare(keyword,"align") == 0)
{
option=ParseCommandOption(MagickAlignOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedAlignType",
value);
draw_info->align=(AlignType) option;
break;
}
if (LocaleCompare(keyword,"antialias") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedBooleanType",
value);
draw_info->stroke_antialias=(MagickBooleanType) option;
draw_info->text_antialias=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"density") == 0)
{
CloneString(&draw_info->density,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'E':
case 'e':
{
if (LocaleCompare(keyword,"encoding") == 0)
{
CloneString(&draw_info->encoding,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->fill,exception);
break;
}
if (LocaleCompare(keyword,"family") == 0)
{
CloneString(&draw_info->family,value);
break;
}
if (LocaleCompare(keyword,"font") == 0)
{
CloneString(&draw_info->font,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
if (LocaleCompare(keyword,"gravity") == 0)
{
option=ParseCommandOption(MagickGravityOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedGravityType",
value);
draw_info->gravity=(GravityType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'P':
case 'p':
{
if (LocaleCompare(keyword,"pointsize") == 0)
{
draw_info->pointsize=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"scale") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.sx=geometry_info.rho;
affine.sy=geometry_info.sigma;
break;
}
if (LocaleCompare(keyword,"skewX") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.ry=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
angle=StringToDouble(value,(char **) NULL);
affine.rx=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"stretch") == 0)
{
option=ParseCommandOption(MagickStretchOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStretchType",
value);
draw_info->stretch=(StretchType) option;
break;
}
if (LocaleCompare(keyword, "stroke") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->stroke,exception);
break;
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
option=ParseCommandOption(MagickStyleOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedStyleType",
value);
draw_info->style=(StyleType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"text") == 0)
{
CloneString(&draw_info->text,value);
break;
}
if (LocaleCompare(keyword,"translate") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
affine.tx=geometry_info.rho;
affine.ty=geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'U':
case 'u':
{
if (LocaleCompare(keyword, "undercolor") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&draw_info->undercolor,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"weight") == 0)
{
draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) FormatLocaleString(text,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
affine.tx;
draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
affine.ty;
status=GetTypeMetrics(msl_info->attributes[n],draw_info,&metrics,
msl_info->exception);
if (status != MagickFalse)
{
Image
*image;
image=msl_info->attributes[n];
FormatImageProperty(image,"msl:font-metrics.pixels_per_em.x",
"%g",metrics.pixels_per_em.x);
FormatImageProperty(image,"msl:font-metrics.pixels_per_em.y",
"%g",metrics.pixels_per_em.y);
FormatImageProperty(image,"msl:font-metrics.ascent","%g",
metrics.ascent);
FormatImageProperty(image,"msl:font-metrics.descent","%g",
metrics.descent);
FormatImageProperty(image,"msl:font-metrics.width","%g",
metrics.width);
FormatImageProperty(image,"msl:font-metrics.height","%g",
metrics.height);
FormatImageProperty(image,"msl:font-metrics.max_advance","%g",
metrics.max_advance);
FormatImageProperty(image,"msl:font-metrics.bounds.x1","%g",
metrics.bounds.x1);
FormatImageProperty(image,"msl:font-metrics.bounds.y1","%g",
metrics.bounds.y1);
FormatImageProperty(image,"msl:font-metrics.bounds.x2","%g",
metrics.bounds.x2);
FormatImageProperty(image,"msl:font-metrics.bounds.y2","%g",
metrics.bounds.y2);
FormatImageProperty(image,"msl:font-metrics.origin.x","%g",
metrics.origin.x);
FormatImageProperty(image,"msl:font-metrics.origin.y","%g",
metrics.origin.y);
}
draw_info=DestroyDrawInfo(draw_info);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'R':
case 'r':
{
if (LocaleCompare((const char *) tag,"raise") == 0)
{
MagickBooleanType
raise;
/*
Raise image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
raise=MagickFalse;
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"raise") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedNoiseType",
value);
raise=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) RaiseImage(msl_info->image[n],&geometry,raise,
msl_info->exception);
break;
}
if (LocaleCompare((const char *) tag,"read") == 0)
{
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"filename") == 0)
{
Image
*image;
if (value == (char *) NULL)
break;
(void) CopyMagickString(msl_info->image_info[n]->filename,
value,MagickPathExtent);
image=ReadImage(msl_info->image_info[n],exception);
CatchException(exception);
if (image == (Image *) NULL)
continue;
AppendImageToList(&msl_info->image[n],image);
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
break;
}
default:
{
(void) SetMSLAttributes(msl_info,keyword,value);
break;
}
}
}
break;
}
if (LocaleCompare((const char *) tag,"reduce-noise") == 0)
{
Image
*paint_image;
/*
Reduce-noise image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
paint_image=StatisticImage(msl_info->image[n],NonpeakStatistic,
(size_t) geometry_info.rho,(size_t) geometry_info.sigma,
msl_info->exception);
if (paint_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=paint_image;
break;
}
else if (LocaleCompare((const char *) tag,"repage") == 0)
{
/* init the values */
width=msl_info->image[n]->page.width;
height=msl_info->image[n]->page.height;
x=msl_info->image[n]->page.x;
y=msl_info->image[n]->page.y;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
int
flags;
RectangleInfo
geometry;
flags=ParseAbsoluteGeometry(value,&geometry);
if ((flags & WidthValue) != 0)
{
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
width=geometry.width;
height=geometry.height;
}
if ((flags & AspectValue) != 0)
{
if ((flags & XValue) != 0)
x+=geometry.x;
if ((flags & YValue) != 0)
y+=geometry.y;
}
else
{
if ((flags & XValue) != 0)
{
x=geometry.x;
if ((width == 0) && (geometry.x > 0))
width=msl_info->image[n]->columns+geometry.x;
}
if ((flags & YValue) != 0)
{
y=geometry.y;
if ((height == 0) && (geometry.y > 0))
height=msl_info->image[n]->rows+geometry.y;
}
}
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
height = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
width = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
x = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
y = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
msl_info->image[n]->page.width=width;
msl_info->image[n]->page.height=height;
msl_info->image[n]->page.x=x;
msl_info->image[n]->page.y=y;
break;
}
else if (LocaleCompare((const char *) tag,"resample") == 0)
{
double
x_resolution,
y_resolution;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
x_resolution=DefaultResolution;
y_resolution=DefaultResolution;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
ssize_t
flags;
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma*=geometry_info.rho;
x_resolution=geometry_info.rho;
y_resolution=geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x-resolution") == 0)
{
x_resolution=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y-resolution") == 0)
{
y_resolution=StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
Resample image.
*/
{
double
factor;
Image
*resample_image;
factor=1.0;
if (msl_info->image[n]->units == PixelsPerCentimeterResolution)
factor=2.54;
width=(size_t) (x_resolution*msl_info->image[n]->columns/
(factor*(msl_info->image[n]->resolution.x == 0.0 ? DefaultResolution :
msl_info->image[n]->resolution.x))+0.5);
height=(size_t) (y_resolution*msl_info->image[n]->rows/
(factor*(msl_info->image[n]->resolution.y == 0.0 ? DefaultResolution :
msl_info->image[n]->resolution.y))+0.5);
resample_image=ResizeImage(msl_info->image[n],width,height,
msl_info->image[n]->filter,msl_info->exception);
if (resample_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=resample_image;
}
break;
}
if (LocaleCompare((const char *) tag,"resize") == 0)
{
FilterType
filter;
Image
*resize_image;
/*
Resize image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
filter=UndefinedFilter;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"filter") == 0)
{
option=ParseCommandOption(MagickFilterOptions,MagickFalse,
value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedNoiseType",
value);
filter=(FilterType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseRegionGeometry(msl_info->image[n],value,
&geometry,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
resize_image=ResizeImage(msl_info->image[n],geometry.width,
geometry.height,filter,msl_info->exception);
if (resize_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=resize_image;
break;
}
if (LocaleCompare((const char *) tag,"roll") == 0)
{
Image
*roll_image;
/*
Roll image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
SetGeometry(msl_info->image[n],&geometry);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,exception);
if ((flags & HeightValue) == 0)
geometry.height=geometry.width;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
roll_image=RollImage(msl_info->image[n],geometry.x,geometry.y,
msl_info->exception);
if (roll_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=roll_image;
break;
}
else if (LocaleCompare((const char *) tag,"roll") == 0)
{
/* init the values */
width=msl_info->image[n]->columns;
height=msl_info->image[n]->rows;
x = y = 0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
(void) ParseMetaGeometry(value,&x,&y,&width,&height);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
x = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
y = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
{
Image
*newImage;
newImage=RollImage(msl_info->image[n], x, y, msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
}
break;
}
if (LocaleCompare((const char *) tag,"rotate") == 0)
{
Image
*rotate_image;
/*
Rotate image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"degrees") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
rotate_image=RotateImage(msl_info->image[n],geometry_info.rho,
msl_info->exception);
if (rotate_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=rotate_image;
break;
}
else if (LocaleCompare((const char *) tag,"rotate") == 0)
{
/* init the values */
double degrees = 0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"degrees") == 0)
{
degrees = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
{
Image
*newImage;
newImage=RotateImage(msl_info->image[n], degrees, msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
}
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'S':
case 's':
{
if (LocaleCompare((const char *) tag,"sample") == 0)
{
Image
*sample_image;
/*
Sample image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseRegionGeometry(msl_info->image[n],value,
&geometry,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
sample_image=SampleImage(msl_info->image[n],geometry.width,
geometry.height,msl_info->exception);
if (sample_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=sample_image;
break;
}
if (LocaleCompare((const char *) tag,"scale") == 0)
{
Image
*scale_image;
/*
Scale image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseRegionGeometry(msl_info->image[n],value,
&geometry,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
scale_image=ScaleImage(msl_info->image[n],geometry.width,
geometry.height,msl_info->exception);
if (scale_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=scale_image;
break;
}
if (LocaleCompare((const char *) tag,"segment") == 0)
{
ColorspaceType
colorspace;
MagickBooleanType
verbose;
/*
Segment image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
geometry_info.rho=1.0;
geometry_info.sigma=1.5;
colorspace=sRGBColorspace;
verbose=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"cluster-threshold") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
option=ParseCommandOption(MagickColorspaceOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,
"UnrecognizedColorspaceType",value);
colorspace=(ColorspaceType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.5;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"smoothing-threshold") == 0)
{
geometry_info.sigma=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) SegmentImage(msl_info->image[n],colorspace,verbose,
geometry_info.rho,geometry_info.sigma,exception);
break;
}
else if (LocaleCompare((const char *) tag, "set") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"clip-mask") == 0)
{
for (j=0; j < msl_info->n; j++)
{
const char
*property;
property=GetImageProperty(msl_info->attributes[j],"id",
exception);
if (LocaleCompare(property,value) == 0)
{
SetImageMask(msl_info->image[n],ReadPixelMask,
msl_info->image[j],exception);
break;
}
}
break;
}
if (LocaleCompare(keyword,"clip-path") == 0)
{
for (j=0; j < msl_info->n; j++)
{
const char
*property;
property=GetImageProperty(msl_info->attributes[j],"id",
exception);
if (LocaleCompare(property,value) == 0)
{
SetImageMask(msl_info->image[n],ReadPixelMask,
msl_info->image[j],exception);
break;
}
}
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
ssize_t
colorspace;
colorspace=(ColorspaceType) ParseCommandOption(
MagickColorspaceOptions,MagickFalse,value);
if (colorspace < 0)
ThrowMSLException(OptionError,"UnrecognizedColorspace",
value);
(void) TransformImageColorspace(msl_info->image[n],
(ColorspaceType) colorspace,exception);
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
(void) SetImageProperty(msl_info->image[n],keyword,value,
exception);
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"density") == 0)
{
flags=ParseGeometry(value,&geometry_info);
msl_info->image[n]->resolution.x=geometry_info.rho;
msl_info->image[n]->resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
msl_info->image[n]->resolution.y=
msl_info->image[n]->resolution.x;
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
(void) SetImageProperty(msl_info->image[n],keyword,value,
exception);
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword, "opacity") == 0)
{
ssize_t opac = OpaqueAlpha,
len = (ssize_t) strlen( value );
if (value[len-1] == '%') {
char tmp[100];
(void) CopyMagickString(tmp,value,len);
opac = StringToLong( tmp );
opac = (int)(QuantumRange * ((float)opac/100));
} else
opac = StringToLong( value );
(void) SetImageAlpha( msl_info->image[n], (Quantum) opac,
exception);
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
(void) SetImageProperty(msl_info->image[n],keyword,value,
msl_info->exception);
break;
}
case 'P':
case 'p':
{
if (LocaleCompare(keyword, "page") == 0)
{
char
page[MagickPathExtent];
const char
*image_option;
MagickStatusType
flags;
RectangleInfo
geometry;
(void) ResetMagickMemory(&geometry,0,sizeof(geometry));
image_option=GetImageArtifact(msl_info->image[n],"page");
if (image_option != (const char *) NULL)
flags=ParseAbsoluteGeometry(image_option,&geometry);
flags=ParseAbsoluteGeometry(value,&geometry);
(void) FormatLocaleString(page,MagickPathExtent,"%.20gx%.20g",
(double) geometry.width,(double) geometry.height);
if (((flags & XValue) != 0) || ((flags & YValue) != 0))
(void) FormatLocaleString(page,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) geometry.width,
(double) geometry.height,(double) geometry.x,(double)
geometry.y);
(void) SetImageOption(msl_info->image_info[n],keyword,page);
msl_info->image_info[n]->page=GetPageGeometry(page);
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
(void) SetImageProperty(msl_info->image[n],keyword,value,
msl_info->exception);
break;
}
default:
{
(void) SetMSLAttributes(msl_info,keyword,value);
(void) SetImageProperty(msl_info->image[n],keyword,value,
msl_info->exception);
break;
}
}
}
break;
}
if (LocaleCompare((const char *) tag,"shade") == 0)
{
Image
*shade_image;
MagickBooleanType
gray;
/*
Shade image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
gray=MagickFalse;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"azimuth") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'E':
case 'e':
{
if (LocaleCompare(keyword,"elevation") == 0)
{
geometry_info.sigma=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
if (LocaleCompare(keyword,"gray") == 0)
{
option=ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
if (option < 0)
ThrowMSLException(OptionError,"UnrecognizedNoiseType",
value);
gray=(MagickBooleanType) option;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
shade_image=ShadeImage(msl_info->image[n],gray,geometry_info.rho,
geometry_info.sigma,msl_info->exception);
if (shade_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=shade_image;
break;
}
if (LocaleCompare((const char *) tag,"shadow") == 0)
{
Image
*shadow_image;
/*
Shear image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"opacity") == 0)
{
geometry_info.rho=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sigma") == 0)
{
geometry_info.sigma=StringToLong(value);
break;
}
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry_info.xi=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry_info.psi=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
shadow_image=ShadowImage(msl_info->image[n],geometry_info.rho,
geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5),
(ssize_t) ceil(geometry_info.psi-0.5),msl_info->exception);
if (shadow_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=shadow_image;
break;
}
if (LocaleCompare((const char *) tag,"sharpen") == 0)
{
double
radius = 0.0,
sigma = 1.0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
/*
NOTE: sharpen can have no attributes, since we use all the defaults!
*/
if (attributes != (const xmlChar **) NULL)
{
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'R':
case 'r':
{
if (LocaleCompare(keyword, "radius") == 0)
{
radius = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"sigma") == 0)
{
sigma = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
}
/*
sharpen image.
*/
{
Image
*newImage;
newImage=SharpenImage(msl_info->image[n],radius,sigma,
msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
}
}
else if (LocaleCompare((const char *) tag,"shave") == 0)
{
/* init the values */
width = height = 0;
x = y = 0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
(void) ParseMetaGeometry(value,&x,&y,&width,&height);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
height = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
width = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
{
Image
*newImage;
RectangleInfo
rectInfo;
rectInfo.height = height;
rectInfo.width = width;
rectInfo.x = x;
rectInfo.y = y;
newImage=ShaveImage(msl_info->image[n], &rectInfo,
msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
}
break;
}
if (LocaleCompare((const char *) tag,"shear") == 0)
{
Image
*shear_image;
/*
Shear image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'F':
case 'f':
{
if (LocaleCompare(keyword, "fill") == 0)
{
(void) QueryColorCompliance(value,AllCompliance,
&msl_info->image[n]->background_color,exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
shear_image=ShearImage(msl_info->image[n],geometry_info.rho,
geometry_info.sigma,msl_info->exception);
if (shear_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=shear_image;
break;
}
if (LocaleCompare((const char *) tag,"signature") == 0)
{
/*
Signature image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) SignatureImage(msl_info->image[n],exception);
break;
}
if (LocaleCompare((const char *) tag,"solarize") == 0)
{
/*
Solarize image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
geometry_info.rho=QuantumRange/2.0;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"threshold") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) SolarizeImage(msl_info->image[n],geometry_info.rho,
msl_info->exception);
break;
}
if (LocaleCompare((const char *) tag,"spread") == 0)
{
Image
*spread_image;
/*
Spread image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"radius") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
spread_image=SpreadImage(msl_info->image[n],
msl_info->image[n]->interpolate,geometry_info.rho,
msl_info->exception);
if (spread_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=spread_image;
break;
}
else if (LocaleCompare((const char *) tag,"stegano") == 0)
{
Image *
watermark = (Image*) NULL;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
{
for (j=0; j<msl_info->n;j++)
{
const char *
theAttr = GetImageProperty(msl_info->attributes[j], "id",
exception);
if (theAttr && LocaleCompare(theAttr, value) == 0)
{
watermark = msl_info->image[j];
break;
}
}
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
if ( watermark != (Image*) NULL )
{
Image
*newImage;
newImage=SteganoImage(msl_info->image[n], watermark, msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
} else
ThrowMSLException(OptionError,"MissingWatermarkImage",keyword);
}
else if (LocaleCompare((const char *) tag,"stereo") == 0)
{
Image *
stereoImage = (Image*) NULL;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
{
for (j=0; j<msl_info->n;j++)
{
const char *
theAttr = GetImageProperty(msl_info->attributes[j], "id",
exception);
if (theAttr && LocaleCompare(theAttr, value) == 0)
{
stereoImage = msl_info->image[j];
break;
}
}
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
if ( stereoImage != (Image*) NULL )
{
Image
*newImage;
newImage=StereoImage(msl_info->image[n], stereoImage, msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
} else
ThrowMSLException(OptionError,"Missing stereo image",keyword);
}
if (LocaleCompare((const char *) tag,"strip") == 0)
{
/*
Strip image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
(void) StripImage(msl_info->image[n],msl_info->exception);
break;
}
if (LocaleCompare((const char *) tag,"swap") == 0)
{
Image
*p,
*q,
*swap;
ssize_t
index,
swap_index;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
index=(-1);
swap_index=(-2);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"indexes") == 0)
{
flags=ParseGeometry(value,&geometry_info);
index=(ssize_t) geometry_info.rho;
if ((flags & SigmaValue) == 0)
swap_index=(ssize_t) geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
/*
Swap images.
*/
p=GetImageFromList(msl_info->image[n],index);
q=GetImageFromList(msl_info->image[n],swap_index);
if ((p == (Image *) NULL) || (q == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoSuchImage",(const char *) tag);
break;
}
swap=CloneImage(p,0,0,MagickTrue,msl_info->exception);
ReplaceImageInList(&p,CloneImage(q,0,0,MagickTrue,
msl_info->exception));
ReplaceImageInList(&q,swap);
msl_info->image[n]=GetFirstImageInList(q);
break;
}
if (LocaleCompare((const char *) tag,"swirl") == 0)
{
Image
*swirl_image;
/*
Swirl image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"degrees") == 0)
{
geometry_info.rho=StringToDouble(value,
(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"geometry") == 0)
{
flags=ParseGeometry(value,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
swirl_image=SwirlImage(msl_info->image[n],geometry_info.rho,
msl_info->image[n]->interpolate,msl_info->exception);
if (swirl_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=swirl_image;
break;
}
if (LocaleCompare((const char *) tag,"sync") == 0)
{
/*
Sync image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) SyncImage(msl_info->image[n],exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'T':
case 't':
{
if (LocaleCompare((const char *) tag,"map") == 0)
{
Image
*texture_image;
/*
Texture image.
*/
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
texture_image=NewImageList();
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],
exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"image") == 0)
for (j=0; j < msl_info->n; j++)
{
const char
*attribute;
attribute=GetImageProperty(msl_info->attributes[j],"id",
exception);
if ((attribute != (const char *) NULL) &&
(LocaleCompare(attribute,value) == 0))
{
texture_image=CloneImage(msl_info->image[j],0,0,
MagickFalse,exception);
break;
}
}
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
}
}
(void) TextureImage(msl_info->image[n],texture_image,exception);
texture_image=DestroyImage(texture_image);
break;
}
else if (LocaleCompare((const char *) tag,"threshold") == 0)
{
/* init the values */
double threshold = 0;
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'T':
case 't':
{
if (LocaleCompare(keyword,"threshold") == 0)
{
threshold = StringToDouble(value,(char **) NULL);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
/*
process image.
*/
{
BilevelImage(msl_info->image[n],threshold,exception);
break;
}
}
else if (LocaleCompare((const char *) tag, "transparent") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"color") == 0)
{
PixelInfo
target;
(void) QueryColorCompliance(value,AllCompliance,&target,
exception);
(void) TransparentPaintImage(msl_info->image[n],&target,
TransparentAlpha,MagickFalse,msl_info->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
}
}
break;
}
else if (LocaleCompare((const char *) tag, "trim") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
}
/* no attributes here */
/* process the image */
{
Image
*newImage;
RectangleInfo
rectInfo;
/* all zeros on a crop == trim edges! */
rectInfo.height = rectInfo.width = 0;
rectInfo.x = rectInfo.y = 0;
newImage=CropImage(msl_info->image[n],&rectInfo, msl_info->exception);
if (newImage == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
msl_info->image[n]=newImage;
break;
}
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
case 'W':
case 'w':
{
if (LocaleCompare((const char *) tag,"write") == 0)
{
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
break;
}
if (attributes == (const xmlChar **) NULL)
break;
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i],exception);
CloneString(&value,attribute);
attribute=DestroyString(attribute);
switch (*keyword)
{
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"filename") == 0)
{
(void) CopyMagickString(msl_info->image[n]->filename,value,
MagickPathExtent);
break;
}
(void) SetMSLAttributes(msl_info,keyword,value);
}
default:
{
(void) SetMSLAttributes(msl_info,keyword,value);
break;
}
}
}
/* process */
{
*msl_info->image_info[n]->magick='\0';
(void) WriteImage(msl_info->image_info[n], msl_info->image[n],
msl_info->exception);
break;
}
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
}
default:
{
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
break;
}
}
if (value != (char *) NULL)
value=DestroyString(value);
(void) DestroyExceptionInfo(exception);
(void) LogMagickEvent(CoderEvent,GetMagickModule()," )");
}
| 11,493
|
166,400
| 0
|
bool GLES2Util::IsFloatFormat(uint32_t internal_format) {
switch (internal_format) {
case GL_R16F:
case GL_R32F:
case GL_RG16F:
case GL_RG32F:
case GL_R11F_G11F_B10F:
case GL_RGB16F:
case GL_RGB32F:
case GL_RGBA16F:
case GL_RGBA32F:
return true;
default:
return false;
}
}
| 11,494
|
65,858
| 0
|
nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
return xdr_argsize_check(rqstp, p);
}
| 11,495
|
9,593
| 0
|
static PHP_FUNCTION(session_write_close)
{
php_session_flush(TSRMLS_C);
}
| 11,496
|
87,983
| 0
|
static void pcd_request(void)
{
struct pcd_unit *cd;
if (pcd_busy)
return;
if (!pcd_req && !set_next_request())
return;
cd = pcd_req->rq_disk->private_data;
if (cd != pcd_current)
pcd_bufblk = -1;
pcd_current = cd;
pcd_sector = blk_rq_pos(pcd_req);
pcd_count = blk_rq_cur_sectors(pcd_req);
pcd_buf = bio_data(pcd_req->bio);
pcd_busy = 1;
ps_set_intr(do_pcd_read, NULL, 0, nice);
}
| 11,497
|
28,104
| 0
|
static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
int i,j;
for (i=0; i < height; i++) {
for (j=0; j < width; j++) {
dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
}
src += stride;
dst += stride;
}
}
| 11,498
|
12,717
| 0
|
int ssl_cert_type(const X509 *x, const EVP_PKEY *pk)
{
if (pk == NULL && (pk = X509_get0_pubkey(x)) == NULL)
return -1;
switch (EVP_PKEY_id(pk)) {
default:
return -1;
case EVP_PKEY_RSA:
return SSL_PKEY_RSA_ENC;
case EVP_PKEY_DSA:
return SSL_PKEY_DSA_SIGN;
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC:
return SSL_PKEY_ECC;
#endif
#ifndef OPENSSL_NO_GOST
case NID_id_GostR3410_2001:
return SSL_PKEY_GOST01;
case NID_id_GostR3410_2012_256:
return SSL_PKEY_GOST12_256;
case NID_id_GostR3410_2012_512:
return SSL_PKEY_GOST12_512;
#endif
}
}
| 11,499
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.