}
/* }}} */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int sub_section_index);
+static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int sub_section_index TSRMLS_DC);
/* {{{ exif_get_markername
Get name of marker */
/* {{{ exif_process_IFD_TAG
* Process one of the nested IFDs directories. */
-static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, int section_index, int ReadNextIFD)
+static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, int section_index, int ReadNextIFD TSRMLS_DC)
{
int l;
int tag, format, components;
char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
size_t byte_count, offset_val, fpos, fgot;
- TSRMLS_FETCH();
tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
php_error(E_WARNING, "Illegal IFD Pointer");
return FALSE;
}
- exif_process_IFD_in_JPEG(ImageInfo, SubdirStart, offset_base, IFDlength, sub_section_index);
+ exif_process_IFD_in_JPEG(ImageInfo, SubdirStart, offset_base, IFDlength, sub_section_index TSRMLS_CC);
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"subsection %s done", exif_get_sectionname(sub_section_index));
#endif
/* {{{ exif_process_IFD_in_JPEG
* Process one of the nested IFDs directories. */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int section_index)
+static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int section_index TSRMLS_DC)
{
int de;
int NumDirEntries;
}
for (de=0;de<NumDirEntries;de++) {
- if ( !exif_process_IFD_TAG(ImageInfo,DirStart+2+12*de,OffsetBase,IFDlength,section_index,1)) {
+ if (!exif_process_IFD_TAG(ImageInfo, DirStart + 2 + 12 * de,
+ OffsetBase, IFDlength, section_index, 1 TSRMLS_CC)) {
return FALSE;
}
}
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"expect next IFD to be thumbnail");
#endif
- if (exif_process_IFD_in_JPEG(ImageInfo, OffsetBase + NextDirOffset, OffsetBase, IFDlength, SECTION_THUMBNAIL))
+ if (exif_process_IFD_in_JPEG(ImageInfo, OffsetBase + NextDirOffset, OffsetBase, IFDlength, SECTION_THUMBNAIL TSRMLS_CC))
{
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"thumbnail size: 0x%04X", ImageInfo->Thumbnail.size);
/* {{{ exif_process_TIFF_in_JPEG
Process a TIFF header in a JPEG file
*/
-static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, unsigned int length)
+static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, unsigned int length TSRMLS_DC)
{
/* set the thumbnail stuff to nothing so we can test to see if they get set up */
if (memcmp(CharBuf, "II", 2) == 0) {
ImageInfo->sections_found |= FOUND_IFD0;
/* First directory starts at offset 8. Offsets starts at 0. */
- exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, SECTION_IFD0);
+ exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, SECTION_IFD0 TSRMLS_CC);
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"exif_process_TIFF_in_JPEG, done");
Process an JPEG APP1 block marker
Describes all the drivel that most digital cameras include...
*/
-static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, unsigned int length)
+static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, unsigned int length TSRMLS_DC)
{
/* Check the APP1 for Exif Identifier Code */
static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
php_error(E_WARNING, "Incorrect APP1 Exif Identifier Code");
return;
}
- exif_process_TIFF_in_JPEG(ImageInfo,CharBuf+8,length-8);
+ exif_process_TIFF_in_JPEG(ImageInfo,CharBuf + 8, length - 8 TSRMLS_CC);
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"process Exif done");
#endif
/* {{{ exif_scan_JPEG_header
* Parse the marker stream until SOS or EOI is seen; */
-static int exif_scan_JPEG_header(image_info_type *ImageInfo)
+static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
{
int section, sn;
int marker = 0, last_marker = M_PSEUDO, comment_correction;
uchar *Data;
size_t fpos, size, got, itemlen;
jpeg_sof_info sof_info;
- TSRMLS_FETCH();
for(section=0;;section++)
{
/*ImageInfo->sections_found |= FOUND_EXIF;*/
/* Seen files from some 'U-lead' software with Vivitar scanner
that uses marker 31 later in the file (no clue what for!) */
- exif_process_APP1(ImageInfo, (char *)Data, itemlen);
+ exif_process_APP1(ImageInfo, (char *)Data, itemlen TSRMLS_CC);
}
break;
last_marker = marker;
}
#ifdef EXIF_DEBUG
- php_error(E_NOTICE,"exif_scan_JPEG_header, done");
+ php_error(E_NOTICE, "exif_scan_JPEG_header, done");
#endif
return TRUE;
}
/* {{{ exif_process_IFD_in_TIFF
* Parse the TIFF header; */
-static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
+static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index TSRMLS_DC)
{
int i, sn, num_entries, sub_section_index;
unsigned char *dir_entry;
size_t ifd_size, dir_size, entry_offset, next_offset, entry_length, entry_value, fgot;
int entry_tag , entry_type;
- TSRMLS_FETCH();
if ( ImageInfo->FileSize >= dir_offset+2) {
if ( (sn=exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL))==-1) {
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"Next IFD %s at x%04X", exif_get_sectionname(sub_section_index), entry_offset);
#endif
- exif_process_IFD_in_TIFF(ImageInfo,entry_offset,sub_section_index);
+ exif_process_IFD_in_TIFF(ImageInfo, entry_offset,sub_section_index TSRMLS_CC);
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"Next IFD %s done", exif_get_sectionname(sub_section_index));
#endif
} else {
- if ( !exif_process_IFD_TAG(ImageInfo,dir_entry,ImageInfo->file.list[sn].data-dir_offset,ifd_size,section_index,0)) {
+ if (!exif_process_IFD_TAG(ImageInfo, dir_entry,
+ ImageInfo->file.list[sn].data-dir_offset,
+ ifd_size,section_index, 0 TSRMLS_CC)) {
return FALSE;
}
}
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"Read next IFD (THUMBNAIL) at x%04X", next_offset);
#endif
- exif_process_IFD_in_TIFF(ImageInfo,next_offset,SECTION_THUMBNAIL);
+ exif_process_IFD_in_TIFF(ImageInfo, next_offset,SECTION_THUMBNAIL TSRMLS_CC);
#ifdef EXIF_DEBUG
php_error(E_NOTICE,"Read THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
#endif
/* {{{ exif_scan_FILE_header
* Parse the marker stream until SOS or EOI is seen; */
-static int exif_scan_FILE_header (image_info_type *ImageInfo)
+static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
{
unsigned char file_header[8];
int ret = FALSE;
- TSRMLS_FETCH();
ImageInfo->FileType = IMAGE_FILETYPE_UNKNOWN;
php_stream_read(ImageInfo->infile, file_header, 2);
if ( (file_header[0]==0xff) && (file_header[1]==M_SOI)) {
ImageInfo->FileType = IMAGE_FILETYPE_JPEG;
- if (exif_scan_JPEG_header(ImageInfo)) {
+ if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) {
ret = TRUE;
} else {
php_error(E_WARNING, "Invalid JPEG file: '%s'", ImageInfo->FileName);
php_error(E_NOTICE,"File(%s) has TIFF/II format", ImageInfo->FileName);
#endif
ImageInfo->sections_found |= FOUND_IFD0;
- if (exif_process_IFD_in_TIFF(ImageInfo,php_ifd_get32u(file_header+4,ImageInfo->motorola_intel),SECTION_IFD0)) {
+ if (exif_process_IFD_in_TIFF(ImageInfo,
+ php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
+ SECTION_IFD0 TSRMLS_CC)) {
ret = TRUE;
} else {
php_error(E_WARNING, "Invalid TIFF file: '%s'", ImageInfo->FileName);
php_error(E_NOTICE,"File(%s) has TIFF/MM format", ImageInfo->FileName);
#endif
ImageInfo->sections_found |= FOUND_IFD0;
- if (exif_process_IFD_in_TIFF(ImageInfo,php_ifd_get32u(file_header+4,ImageInfo->motorola_intel),SECTION_IFD0)) {
+ if (exif_process_IFD_in_TIFF(ImageInfo,
+ php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
+ SECTION_IFD0 TSRMLS_CC)) {
ret = TRUE;
} else {
php_error(E_WARNING, "Invalid TIFF file: '%s'", ImageInfo->FileName);
}
/* Scan the JPEG headers. */
- ret = exif_scan_FILE_header(ImageInfo);
+ ret = exif_scan_FILE_header(ImageInfo TSRMLS_CC);
php_stream_close(ImageInfo->infile);
return ret;