Changeset 36 for ImageMagick/trunk/magick/cache.c
- Timestamp:
- 09/10/09 16:10:14 (6 months ago)
- Files:
-
- 1 modified
-
ImageMagick/trunk/magick/cache.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/magick/cache.c
r32 r36 1472 1472 type; 1473 1473 1474 MapMode 1475 mode; 1476 1474 1477 assert(cache != (Cache) NULL); 1475 1478 cache_info=(CacheInfo *) cache; … … 1489 1492 (void) DeleteNodeByValueFromSplayTree(cache_resources,cache_info); 1490 1493 type=cache_info->type; 1494 mode=cache_info->mode; 1491 1495 RelinquishPixelCachePixels(cache_info); 1492 if (( type == MapCache) || (type == DiskCache))1496 if ((mode != ReadMode) && ((type == MapCache) || (type == DiskCache))) 1493 1497 (void) RelinquishUniqueFileResource(cache_info->cache_filename); 1494 1498 *cache_info->cache_filename='\0'; … … 2100 2104 destroy=MagickFalse; 2101 2105 (void) LockSemaphoreInfo(cache_info->semaphore); 2102 if ( cache_info->reference_count > 1)2106 if ((cache_info->reference_count > 1) || (cache_info->mode == ReadMode)) 2103 2107 { 2104 2108 Image … … 4099 4103 % o filename: the persistent pixel cache filename. 4100 4104 % 4105 % o attach: A value other than zero initializes the persistent pixel 4106 % cache. 4107 % 4101 4108 % o initialize: A value other than zero initializes the persistent pixel 4102 4109 % cache. … … 4144 4151 { 4145 4152 /* 4146 Attach persistent pixel cache.4153 Attach existing persistent pixel cache. 4147 4154 */ 4148 4155 if (image->debug != MagickFalse) … … 4155 4162 if (OpenPixelCache(image,ReadMode,exception) == MagickFalse) 4156 4163 return(MagickFalse); 4157 cache_info=(CacheInfo *) ReferencePixelCache(cache_info);4158 4164 *offset+=cache_info->length+pagesize-(cache_info->length % pagesize); 4159 4165 return(MagickTrue); 4160 4166 } 4161 if ((cache_info->type != MemoryCache) && (cache_info->reference_count == 1)) 4167 if ((cache_info->mode != ReadMode) && (cache_info->type != MemoryCache) && 4168 (cache_info->reference_count == 1)) 4162 4169 { 4163 4170 (void) LockSemaphoreInfo(cache_info->semaphore); 4164 if ((cache_info-> type != MemoryCache) &&4171 if ((cache_info->mode != ReadMode) && (cache_info->type != MemoryCache) && 4165 4172 (cache_info->reference_count == 1)) 4166 4173 { … … 4169 4176 4170 4177 /* 4171 Usurp residentpersistent pixel cache.4178 Usurp existing persistent pixel cache. 4172 4179 */ 4173 4180 status=rename(cache_info->cache_filename,filename); … … 4189 4196 } 4190 4197 /* 4191 Attachpersistent pixel cache.4198 Clone persistent pixel cache. 4192 4199 */ 4193 4200 clone_image=(*image);
