#define FALSE 0
#endif
-#ifndef MB_CUR_MAX
- #define MB_CUR_MAX 8
- /* Should be a library constant */
-#endif
-
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
}
/* }}} */
-#ifdef EXIF_DEBUG
/* {{{ exif_process_string_raw
* Copy a string in Exif header to a character string returns length of allocated buffer if any. */
static int exif_process_string_raw(char **result,char *value,size_t byte_count) {
return 0;
}
/* }}} */
-#endif
/* {{{ exif_process_string
* Copy a string in Exif header to a character string returns length of allocated buffer if any. */
* Process UserComment in IFD. */
static int exif_process_user_comment(char **pszInfoPtr,char *szEncoding,char *szValuePtr,int ByteCount)
{
- int a,l;
- char mbBuffer[MB_CUR_MAX];
+ int a;
*szEncoding = '\0';
/* Copy the comment */
strcpy( szEncoding, szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
- l = 0;
- a = 0;
- while(((wchar_t*)szValuePtr)[a]) {
- l += (int)wctomb( mbBuffer, *((wchar_t*)szValuePtr));
- if (sizeof(wchar_t)*a++ >= ByteCount) break; /* avoiding problems with corrupt headers */
- }
- if (l>1) {
- *pszInfoPtr = emalloc(l+1);
- wcstombs(*pszInfoPtr, (wchar_t*)(szValuePtr), l+1);
- (*pszInfoPtr)[l] = '\0';
- return l+1;
- }
- return 0;
+ return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
if ( !memcmp(szValuePtr, "ASCII\0\0\0", 8)) {
strcpy( szEncoding, szValuePtr);
if (a) for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) (szValuePtr)[a] = '\0';
/* normal text without encoding */
- return exif_process_string(pszInfoPtr,szValuePtr,ByteCount);
+ return exif_process_string(pszInfoPtr, szValuePtr, ByteCount);
}
/* }}} */