summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-06-03 02:35:52 (GMT)
committerMinje ahn <minje.ahn@samsung.com>2015-06-03 07:24:56 (GMT)
commitc896230ef091a244204b17bc9ab0ffa974ce2031 (patch)
tree97e54161e040dbc59c0945184ed3a0abc1f3cc02 /src/codec
parent6ece5e54778f9a8bea3f23f3a932a884be3c9f87 (diff)
downloadlibmedia-thumbnail-c896230ef091a244204b17bc9ab0ffa974ce2031.zip
libmedia-thumbnail-c896230ef091a244204b17bc9ab0ffa974ce2031.tar.gz
libmedia-thumbnail-c896230ef091a244204b17bc9ab0ffa974ce2031.tar.bz2
Modify error typerefs/changes/56/40356/2
Change-Id: Ie19c9bb70115a9097d45e8a18f52ad72cf7beeb2 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/IfegDecodeAGIF.c6
-rw-r--r--src/codec/img-codec-osal.c2
-rw-r--r--src/codec/img-codec-parser.c117
3 files changed, 47 insertions, 78 deletions
diff --git a/src/codec/IfegDecodeAGIF.c b/src/codec/IfegDecodeAGIF.c
index dad124b..e1e5a11 100644
--- a/src/codec/IfegDecodeAGIF.c
+++ b/src/codec/IfegDecodeAGIF.c
@@ -47,7 +47,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
int inputPos = 0;
int inputPos_temp = 0;
- AGifFrameInfo *pFrameData;
+ AGifFrameInfo *pFrameData;
if (0 == (pFrameData = IfegMemAlloc(sizeof(AGifFrameInfo)))) {
return 0;
}
@@ -126,7 +126,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
backcolor_parsing = (unsigned short)((pEncodedData[inputPos+backcolor_index*3] >> 3)<<11) | ((pEncodedData[inputPos+backcolor_index*3+1] >> 2)<<5) | (pEncodedData[inputPos+backcolor_index*3+2] >> 3);
}
- /* graphic extension block */
+ /* graphic extension block */
if (pEncodedData[14+header_temp] == 0xF9 || pEncodedData[14+19+header_temp] == 0xF9) {
if (transparent == 1 && backcolor_index == transIndex) {
@@ -690,7 +690,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
if (pFrameData->nLoopCount == -1) {
break;
} else if (pFrameData->bLoop || (pFrameData->nRepeatCount <= pFrameData->nLoopCount) || (pFrameData->nLoopCount == 0)) {
- /* Background Color */
+ /* Background Color */
pImage16 = (unsigned short *)pFrameData->pPrevImg;
for (i = 0; i < expected_width * expected_height; i++) {
diff --git a/src/codec/img-codec-osal.c b/src/codec/img-codec-osal.c
index 46eb130..47062bc 100644
--- a/src/codec/img-codec-osal.c
+++ b/src/codec/img-codec-osal.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
+#include <errno.h>
//#include <drm-service.h>
#include <drm_client.h>
diff --git a/src/codec/img-codec-parser.c b/src/codec/img-codec-parser.c
index 26027b9..dd04455 100644
--- a/src/codec/img-codec-parser.c
+++ b/src/codec/img-codec-parser.c
@@ -28,6 +28,7 @@
#include <sys/time.h>
#endif
+#include <media-util-err.h>
#include "media-thumb-debug.h"
#include "img-codec-common.h"
#include "img-codec-parser.h"
@@ -423,7 +424,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
unsigned char tmp;
if (DrmReadFile(hFile, EncodedDataBuffer, 32, &fileread) ==
- FALSE) {
+ FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
}
@@ -445,7 +446,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
tmp = *(EncodedDataBuffer + 20);
/* If image is interlaced then multiple should be 2 */
if (tmp) {
- thumb_dbg("Interlaced PNG Image.\n");
+ thumb_dbg("Interlaced PNG Image.");
}
thumb_dbg("IMG_CODEC_PNG\n");
return IMG_CODEC_PNG;
@@ -469,23 +470,22 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
}
if (pWidth) {
*pWidth =
- EncodedDataBuffer[18] | (EncodedDataBuffer[19] << 8)
- | (EncodedDataBuffer[20] << 16) |
- (EncodedDataBuffer[21] << 24);
+ EncodedDataBuffer[18] | (EncodedDataBuffer[19] << 8)
+ | (EncodedDataBuffer[20] << 16) |
+ (EncodedDataBuffer[21] << 24);
}
if (pHeight) {
*pHeight =
- EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8)
- | (EncodedDataBuffer[24] << 16) |
- (EncodedDataBuffer[25] << 24);
+ EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8)
+ | (EncodedDataBuffer[24] << 16) |
+ (EncodedDataBuffer[25] << 24);
}
thumb_dbg("IMG_CODEC_BMP");
return IMG_CODEC_BMP;
}
/*********************** GIF *************************/
- else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH)
- == 0) {
+ else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH) == 0) {
unsigned int tablelength = 0;
unsigned int imagecount = 0;
int finished = 0;
@@ -498,8 +498,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- if (DrmReadFile(hFile, &EncodedDataBuffer[8], 5, &fileread) ==
- FALSE) {
+ if (DrmReadFile(hFile, &EncodedDataBuffer[8], 5, &fileread) == FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
@@ -510,10 +509,10 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
}
if (EncodedDataBuffer[0] != 'G' || EncodedDataBuffer[1] != 'I'
- || EncodedDataBuffer[2] != 'F' || EncodedDataBuffer[3] < '0'
- || EncodedDataBuffer[3] > '9' || EncodedDataBuffer[4] < '0'
- || EncodedDataBuffer[4] > '9' || EncodedDataBuffer[5] < 'A'
- || EncodedDataBuffer[5] > 'z') {
+ || EncodedDataBuffer[2] != 'F' || EncodedDataBuffer[3] < '0'
+ || EncodedDataBuffer[3] > '9' || EncodedDataBuffer[4] < '0'
+ || EncodedDataBuffer[4] > '9' || EncodedDataBuffer[5] < 'A'
+ || EncodedDataBuffer[5] > 'z') {
thumb_warn("IMG_CODEC_UNKNOWN_TYPE in GIF");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -527,17 +526,14 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
EncodedDataBuffer[8] | (EncodedDataBuffer[9] << 8);
}
- thumb_dbg("Logical width : %d, Height : %d", *pWidth,
- *pHeight);
+ thumb_dbg("Logical width : %d, Height : %d", *pWidth, *pHeight);
if ((EncodedDataBuffer[10] & 0x80) != 0) { /* Global color table */
temp = (EncodedDataBuffer[10] & 0x7) + 1;
tablelength = (1 << temp) * 3;
- if ((tablelength * sizeof(char)) >
- sizeof(EncodedDataBuffer)) {
- thumb_warn
- ("_ImgGetInfoStreaming :table length is more than buffer length");
+ if ((tablelength * sizeof(char)) > sizeof(EncodedDataBuffer)) {
+ thumb_warn("_ImgGetInfoStreaming :table length is more than buffer length");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -546,9 +542,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
/* coverity[ -tainted_data_argument : EncodedDataBuffer ] */
- if (DrmReadFile
- (hFile, EncodedDataBuffer, tablelength,
- &fileread) == FALSE) {
+ if (DrmReadFile(hFile, EncodedDataBuffer, tablelength, &fileread) == FALSE) {
thumb_err("DrmReadFile was failed");
return IMG_CODEC_NONE;
@@ -588,14 +582,11 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- switch (EncodedDataBuffer
- [ifegstreamctrl.buffpos++]) {
+ switch (EncodedDataBuffer[ifegstreamctrl.buffpos++]) {
case 0xf9: /* Graphic control extension block */
- if (_CheckBuffer(&ifegstreamctrl, 6) ==
- 0) {
- thumb_warn
- ("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 6) == 0) {
+ thumb_warn("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
@@ -609,28 +600,20 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
case 0x01: /* Plain Text block */
case 0xfe: /* Comment Extension block */
case 0xff: /* Appliation Extension block */
- if (_CheckBuffer(&ifegstreamctrl, 1) ==
- 0) {
- thumb_warn
- ("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 1) == 0) {
+ thumb_warn("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
- if (ifegstreamctrl.buffpos >
- sizeof(EncodedDataBuffer)) {
- thumb_warn
- ("buffer position exceeds buffer max length ");
+ if (ifegstreamctrl.buffpos > sizeof(EncodedDataBuffer)) {
+ thumb_warn("buffer position exceeds buffer max length ");
return IMG_CODEC_UNKNOWN_TYPE;
}
while ((ifegstreamctrl.buffpos < sizeof(EncodedDataBuffer)) && ((length = EncodedDataBuffer[ifegstreamctrl.buffpos++]) > 0)) { /* get the data length */
- if (_CheckBuffer
- (&ifegstreamctrl,
- length) == 0) {
- thumb_warn
- ("_CheckBuffer was failed");
- return
- IMG_CODEC_UNKNOWN_TYPE;
+ if (_CheckBuffer(&ifegstreamctrl, length) == 0) {
+ thumb_warn("_CheckBuffer was failed");
+ return IMG_CODEC_UNKNOWN_TYPE;
}
/* Check integer overflow */
@@ -639,8 +622,7 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- ifegstreamctrl.buffpos +=
- (length);
+ ifegstreamctrl.buffpos += (length);
/* File End Check */
}
break;
@@ -721,51 +703,38 @@ ImgCodecType _ImgGetInfoStreaming(HFile hFile, unsigned long fileSize,
return IMG_CODEC_UNKNOWN_TYPE;
}
- temp =
- EncodedDataBuffer[ifegstreamctrl.buffpos++];
+ temp = EncodedDataBuffer[ifegstreamctrl.buffpos++];
if (temp < 2 || 9 < temp) {
return IMG_CODEC_UNKNOWN_TYPE;
}
do {
- if (_CheckBuffer(&ifegstreamctrl, 1) ==
- 0) {
- thumb_warn
- ("_CheckBuffer was failed");
+ if (_CheckBuffer(&ifegstreamctrl, 1) == 0) {
+ thumb_warn("_CheckBuffer was failed");
return IMG_CODEC_UNKNOWN_TYPE;
}
- length =
- EncodedDataBuffer[ifegstreamctrl.
- buffpos++];
+ length =EncodedDataBuffer[ifegstreamctrl.buffpos++];
if ((length + ifegstreamctrl.buffpos) > ifegstreamctrl.buffend) {
length =
- length +
- ifegstreamctrl.buffpos -
- ifegstreamctrl.buffend;
- if (DrmSeekFile
- (ifegstreamctrl.fd,
- SEEK_CUR,
- length) == FALSE) {
+ length +
+ ifegstreamctrl.buffpos -
+ ifegstreamctrl.buffend;
+ if (DrmSeekFile(ifegstreamctrl.fd, SEEK_CUR, length) == FALSE) {
if (imagecount) {
if (pNumberOfFrames)
*pNumberOfFrames
= 2;
- thumb_dbg
- ("IMG_CODEC_AGIF");
- return
- IMG_CODEC_AGIF;
+ thumb_dbg("IMG_CODEC_AGIF");
+ return IMG_CODEC_AGIF;
}
- return
- IMG_CODEC_UNKNOWN_TYPE;
+ return IMG_CODEC_UNKNOWN_TYPE;
}
- ifegstreamctrl.filepos +=
- length;
+ ifegstreamctrl.filepos += length;
ifegstreamctrl.buffpos = 0;
ifegstreamctrl.buffend = 0;
} else {
- ifegstreamctrl.buffpos +=
- length;
+ ifegstreamctrl.buffpos +=length;
}
/* File End Check */