From: cristy Date: Sun, 30 Mar 2014 23:27:24 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2524 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10c210ee820e9e576c18736dbca28eb38d1ba789;p=imagemagick --- diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c index 5efe945ed..fbb7ecb91 100644 --- a/MagickCore/matrix.c +++ b/MagickCore/matrix.c @@ -144,8 +144,12 @@ static inline MagickOffsetType WriteMatrixElements( count; #if !defined(MAGICKCORE_HAVE_PWRITE) + LockSemaphoreInfo(matrix_info->semaphore); if (lseek(matrix_info->file,offset,SEEK_SET) < 0) - return((MagickOffsetType) -1); + { + UnlockSemaphoreInfo(matrix_info->semaphore); + return((MagickOffsetType) -1); + } #endif count=0; for (i=0; i < (MagickOffsetType) length; i+=count) @@ -164,6 +168,9 @@ static inline MagickOffsetType WriteMatrixElements( break; } } +#if !defined(MAGICKCORE_HAVE_PWRITE) + UnlockSemaphoreInfo(matrix_info->semaphore); +#endif return(i); } @@ -680,8 +687,12 @@ static inline MagickOffsetType ReadMatrixElements( count; #if !defined(MAGICKCORE_HAVE_PREAD) + LockSemaphoreInfo(matrix_info->semaphore); if (lseek(matrix_info->file,offset,SEEK_SET) < 0) - return((MagickOffsetType) -1); + { + UnlockSemaphoreInfo(matrix_info->semaphore); + return((MagickOffsetType) -1); + } #endif count=0; for (i=0; i < (MagickOffsetType) length; i+=count) @@ -700,6 +711,9 @@ static inline MagickOffsetType ReadMatrixElements( break; } } +#if !defined(MAGICKCORE_HAVE_PREAD) + UnlockSemaphoreInfo(matrix_info->semaphore); +#endif return(i); } @@ -720,10 +734,8 @@ MagickExport MagickBooleanType GetMatrixElement(const MatrixInfo *matrix_info, matrix_info->stride,matrix_info->stride); return(MagickTrue); } - LockSemaphoreInfo(matrix_info->semaphore); count=ReadMatrixElements(matrix_info,i*matrix_info->stride, matrix_info->stride,value); - UnlockSemaphoreInfo(matrix_info->semaphore); if (count != (MagickOffsetType) matrix_info->stride) return(MagickFalse); return(MagickTrue); @@ -995,10 +1007,8 @@ MagickExport MagickBooleanType SetMatrixElement(const MatrixInfo *matrix_info, matrix_info->stride,value,matrix_info->stride); return(MagickTrue); } - LockSemaphoreInfo(matrix_info->semaphore); count=WriteMatrixElements(matrix_info,i*matrix_info->stride, matrix_info->stride,value); - UnlockSemaphoreInfo(matrix_info->semaphore); if (count != (MagickOffsetType) matrix_info->stride) return(MagickFalse); return(MagickTrue);