Skip to content

Commit 50803da

Browse files
author
Cristy
committed
...
1 parent c838279 commit 50803da

2 files changed

Lines changed: 41 additions & 33 deletions

File tree

MagickCache/magick-cache.c

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ MagickExport MagickCache *AcquireMagickCache(const char *path,
314314
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315315
%
316316
% AcquireMagickCacheResource() allocates the MagickCacheResource structure.
317-
% It is required before you can get and put metadata associated with resource
317+
% It is required before you can get or put metadata associated with resource
318318
% content.
319319
%
320320
% The format of the AcquireMagickCacheResource method is:
@@ -329,8 +329,8 @@ MagickExport MagickCache *AcquireMagickCache(const char *path,
329329
% o iri: the IRI.
330330
%
331331
*/
332-
MagickExport MagickCacheResource *AcquireMagickCacheResource(
333-
MagickCache *cache,const char *iri)
332+
MagickExport MagickCacheResource *AcquireMagickCacheResource(MagickCache *cache,
333+
const char *iri)
334334
{
335335
MagickCacheResource
336336
*resource;
@@ -493,6 +493,9 @@ static StringInfo *SetMagickCacheSentinel(const char *path,
493493
unsigned int
494494
signature;
495495

496+
/*
497+
Create a MagickCache sentiinel.
498+
*/
496499
sentinel=AcquireStringInfo(MagickPathExtent);
497500
random_info=AcquireRandomInfo();
498501
key_info=GetRandomKey(random_info,MagickCacheNonceExtent);
@@ -753,6 +756,9 @@ static void DestroyMagickCacheResourceBlob(MagickCacheResource *resource)
753756
MagickExport MagickCacheResource *DestroyMagickCacheResource(
754757
MagickCacheResource *resource)
755758
{
759+
/*
760+
Deallocate memory associated with a resource.
761+
*/
756762
assert(resource != (MagickCacheResource *) NULL);
757763
assert(resource->signature == MagickCoreSignature);
758764
if (resource->blob != NULL)
@@ -872,6 +878,9 @@ static void GetMagickCacheResourceSentinel(MagickCacheResource *resource,
872878
unsigned int
873879
signature;
874880

881+
/*
882+
Get the MagickCache resource sentinel.
883+
*/
875884
p=sentinel;
876885
p+=sizeof(signature);
877886
(void) memcpy(GetStringInfoDatum(resource->nonce),p,
@@ -897,6 +906,9 @@ static void SetMagickCacheResourceID(MagickCache *cache,
897906
StringInfo
898907
*signature;
899908

909+
/*
910+
Set a MagickCache resource ID.
911+
*/
900912
signature=StringToStringInfo(resource->iri);
901913
ConcatenateStringInfo(signature,resource->nonce);
902914
ConcatenateStringInfo(signature,cache->passkey);
@@ -999,7 +1011,7 @@ MagickExport MagickBooleanType GetMagickCacheResource(MagickCache *cache,
9991011
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10001012
%
10011013
% GetMagickCacheResourceBlob() gets a blob associated with a resource
1002-
% identified by its IRI./
1014+
% identified by its IRI.
10031015
%
10041016
% The format of the GetMagickCacheResourceBlob method is:
10051017
%
@@ -1089,6 +1101,9 @@ static MagickBooleanType ResourceToBlob(MagickCacheResource *resource,
10891101
struct stat
10901102
attributes;
10911103

1104+
/*
1105+
Convert the resource identified by its IRI to a blob.
1106+
*/
10921107
if (GetPathAttributes(path,&attributes) == MagickFalse)
10931108
{
10941109
(void) ThrowMagickException(resource->exception,GetMagickModule(),
@@ -1204,6 +1219,9 @@ MagickExport char *GetMagickCacheResourceException(
12041219
char
12051220
*description;
12061221

1222+
/*
1223+
Get a MagickCache resource exception.
1224+
*/
12071225
assert(resource != (const MagickCacheResource *) NULL);
12081226
assert(resource->signature == MagickCacheSignature);
12091227
if (resource->debug != MagickFalse)
@@ -1261,19 +1279,6 @@ MagickExport char *GetMagickCacheResourceException(
12611279
% o id: a buffer that is at least `length` bytes long.
12621280
%
12631281
*/
1264-
1265-
static inline MagickBooleanType IsUTFValid(int code)
1266-
{
1267-
int
1268-
mask;
1269-
1270-
mask=(int) 0x7fffffff;
1271-
if (((code & ~mask) != 0) && ((code < 0xd800) || (code > 0xdfff)) &&
1272-
(code != 0xfffe) && (code != 0xffff))
1273-
return(MagickFalse);
1274-
return(MagickTrue);
1275-
}
1276-
12771282
MagickExport MagickBooleanType GetMagickCacheResourceID(MagickCache *cache,
12781283
const size_t length,char *id)
12791284
{
@@ -1287,6 +1292,9 @@ MagickExport MagickBooleanType GetMagickCacheResourceID(MagickCache *cache,
12871292
unsigned char
12881293
*code;
12891294

1295+
/*
1296+
Get the MagickCache resource ID.
1297+
*/
12901298
assert(cache != (const MagickCache *) NULL);
12911299
assert(cache->signature == MagickCacheSignature);
12921300
for (j=0; j < (ssize_t) length; j++)
@@ -1320,11 +1328,11 @@ MagickExport MagickBooleanType GetMagickCacheResourceID(MagickCache *cache,
13201328
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13211329
%
13221330
% GetMagickCacheResourceImage() gets an image associated with a resource
1323-
% identified by its IRI in the cache repository. To retrieve the entire image,
1324-
% set the extract parameter to NULL. Otherwise specify the size and offset of
1325-
% a portion of the image, e.g. 100x100+0+1. If you do not specify the offset,
1326-
% the image is instead resized, e.g. 100x100 returns the image resized while
1327-
% still retaining the original aspect ratio.
1331+
% identified by its IRI from the cache repository. To retrieve the entire
1332+
% image, set the extract parameter to NULL. Otherwise specify the size and
1333+
% offset of a portion of the image, e.g. 100x100+0+1. If you do not specify
1334+
% the offset, the image is instead resized, e.g. 100x100 returns the image
1335+
% resized while still retaining the original aspect ratio.
13281336
%
13291337
% The format of the GetMagickCacheResourceImage method is:
13301338
%
@@ -1356,7 +1364,7 @@ MagickExport const Image *GetMagickCacheResourceImage(MagickCache *cache,
13561364
status;
13571365

13581366
/*
1359-
Get the image associated with a resource identified by its IRI.
1367+
Return the resource identified by its IRI as an image.
13601368
*/
13611369
assert(cache != (MagickCache *) NULL);
13621370
assert(cache->signature == MagickCacheSignature);
@@ -1395,9 +1403,9 @@ MagickExport const Image *GetMagickCacheResourceImage(MagickCache *cache,
13951403
CacheError,"cannot get resource","`%s'",resource->iri);
13961404
else
13971405
{
1398-
const Image *image=(const Image *) resource->blob;
1399-
resource->columns=image->columns;
1400-
resource->rows=image->rows;
1406+
const Image *image=(const Image *) resource->blob;
1407+
resource->columns=image->columns;
1408+
resource->rows=image->rows;
14011409
}
14021410
path=DestroyString(path);
14031411
image_info=DestroyImageInfo(image_info);
@@ -1470,7 +1478,7 @@ MagickExport const char *GetMagickCacheResourceMeta(MagickCache *cache,
14701478
status;
14711479

14721480
/*
1473-
Get the metadata associated with a resource identified by its IRI.
1481+
Return the resource identified by its IRI as metadata.
14741482
*/
14751483
assert(cache != (MagickCache *) NULL);
14761484
assert(cache->signature == MagickCacheSignature);
@@ -1508,8 +1516,8 @@ MagickExport const char *GetMagickCacheResourceMeta(MagickCache *cache,
15081516
% %
15091517
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15101518
%
1511-
% GetMagickCacheResourceSize() returns the size of the image associated
1512-
% with the resource in the cache repository.
1519+
% GetMagickCacheResourceSize() returns the size of the image associated with
1520+
% the resource in the cache repository.
15131521
%
15141522
% The format of the GetMagickCacheResourceSize method is:
15151523
%
@@ -1994,7 +2002,7 @@ static StringInfo *SetMagickCacheResourceSentinel(
19942002
signature;
19952003

19962004
/*
1997-
Create the MagickCache resource sentinel.
2005+
Set the MagickCache resource sentinel.
19982006
*/
19992007
meta=AcquireStringInfo(MagickPathExtent);
20002008
p=GetStringInfoDatum(meta);

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ MAGICKCACHE_MICRO_VERSION = 2
245245
MAGICKCACHE_MINOR_VERSION = 9
246246
MAGICKCACHE_PATCHLEVEL_VERSION = 1
247247
MAGICKCACHE_VERSION = 0.9.2-1
248-
MAGICKCORE_CFLAGS =
249-
MAGICKCORE_LIBS =
248+
MAGICKCORE_CFLAGS = -I/usr/local/include/ImageMagick-7 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
249+
MAGICKCORE_LIBS = -L/usr/local/lib -lMagickCore-7.Q16HDRI
250250
MAGICKPP_LIB_VERSION_TEXT = 0.9.2
251251
MAKEINFO = ${SHELL} /home/cristy/MagickCache-0.9.2/missing makeinfo
252252
MKDIR_P = /usr/bin/mkdir -p
@@ -267,7 +267,7 @@ PACKAGE_VERSION_ADDENDUM = -1
267267
PATH_SEPARATOR = :
268268
PKG_CONFIG = /usr/bin/pkg-config
269269
PKG_CONFIG_LIBDIR =
270-
PKG_CONFIG_PATH =
270+
PKG_CONFIG_PATH = /usr/local//lib/pkgconfig
271271
RANLIB = ranlib
272272
SET_MAKE =
273273
SHELL = /bin/sh

0 commit comments

Comments
 (0)