start hacking
This commit is contained in:
parent
039c716f63
commit
1cc7dd6af7
@ -877,13 +877,10 @@ vips_exif_from_s( ExifData *ed, ExifEntry *entry, const char *value )
|
|||||||
unsigned long i;
|
unsigned long i;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
if( entry->format != EXIF_FORMAT_SHORT &&
|
if( entry->format == EXIF_FORMAT_SHORT ||
|
||||||
entry->format != EXIF_FORMAT_SSHORT &&
|
entry->format == EXIF_FORMAT_SSHORT ||
|
||||||
entry->format != EXIF_FORMAT_LONG &&
|
entry->format == EXIF_FORMAT_LONG ||
|
||||||
entry->format != EXIF_FORMAT_SLONG &&
|
entry->format == EXIF_FORMAT_SLONG ) {
|
||||||
entry->format != EXIF_FORMAT_RATIONAL &&
|
|
||||||
entry->format != EXIF_FORMAT_SRATIONAL )
|
|
||||||
return;
|
|
||||||
if( entry->components >= 10 )
|
if( entry->components >= 10 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -894,20 +891,12 @@ vips_exif_from_s( ExifData *ed, ExifEntry *entry, const char *value )
|
|||||||
p += 1;
|
p += 1;
|
||||||
|
|
||||||
for( i = 0; i < entry->components; i++ ) {
|
for( i = 0; i < entry->components; i++ ) {
|
||||||
if( entry->format == EXIF_FORMAT_SHORT ||
|
|
||||||
entry->format == EXIF_FORMAT_SSHORT ||
|
|
||||||
entry->format == EXIF_FORMAT_LONG ||
|
|
||||||
entry->format == EXIF_FORMAT_SLONG ) {
|
|
||||||
int value = atof( p );
|
int value = atof( p );
|
||||||
|
|
||||||
vips_exif_set_int( ed, entry, i, &value );
|
vips_exif_set_int( ed, entry, i, &value );
|
||||||
}
|
|
||||||
else if( entry->format == EXIF_FORMAT_RATIONAL ||
|
|
||||||
entry->format == EXIF_FORMAT_SRATIONAL )
|
|
||||||
vips_exif_set_rational( ed, entry, i, (void *) p );
|
|
||||||
|
|
||||||
/* Skip to the next set of spaces, then to the beginning of
|
/* Skip to the next set of spaces, then to the
|
||||||
* the next item.
|
* beginning of the next item.
|
||||||
*/
|
*/
|
||||||
while( *p && *p != ' ' )
|
while( *p && *p != ' ' )
|
||||||
p += 1;
|
p += 1;
|
||||||
@ -916,6 +905,64 @@ vips_exif_from_s( ExifData *ed, ExifEntry *entry, const char *value )
|
|||||||
if( !*p )
|
if( !*p )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if( entry->format == EXIF_FORMAT_RATIONAL ||
|
||||||
|
entry->format == EXIF_FORMAT_SRATIONAL ) {
|
||||||
|
if( entry->components >= 10 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Skip any leading spaces.
|
||||||
|
*/
|
||||||
|
p = value;
|
||||||
|
while( *p == ' ' )
|
||||||
|
p += 1;
|
||||||
|
|
||||||
|
for( i = 0; i < entry->components; i++ ) {
|
||||||
|
vips_exif_set_rational( ed, entry, i, (void *) p );
|
||||||
|
|
||||||
|
/* Skip to the next set of spaces, then to the
|
||||||
|
* beginning of the next item.
|
||||||
|
*/
|
||||||
|
while( *p && *p != ' ' )
|
||||||
|
p += 1;
|
||||||
|
while( *p == ' ' )
|
||||||
|
p += 1;
|
||||||
|
if( !*p )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( entry->format == EXIF_FORMAT_ASCII ) {
|
||||||
|
int len;
|
||||||
|
char *q;
|
||||||
|
|
||||||
|
/* A copy of value which we may have to free.
|
||||||
|
*/
|
||||||
|
q = NULL;
|
||||||
|
|
||||||
|
/* The final " (xx, ASCII, yy, zz)" part of the string was
|
||||||
|
* added by us in _to_s(), we must remove it before setting
|
||||||
|
* the string back again.
|
||||||
|
*
|
||||||
|
* It may not be there if the user has changed the string.
|
||||||
|
*
|
||||||
|
* Leave p as poointing to the trimmed string.
|
||||||
|
*/
|
||||||
|
len = strlen( value );
|
||||||
|
if( len > 0 &&
|
||||||
|
value[len - 1] == ')' &&
|
||||||
|
(p = strrchr( value, '(' )) &&
|
||||||
|
p - value > 0 &&
|
||||||
|
p[-1] == ' ' ) {
|
||||||
|
q = g_strdup( value );
|
||||||
|
q[p - value - 1] = '\0';
|
||||||
|
p = q;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p = value;
|
||||||
|
|
||||||
|
for( p = value + strlen( value ) - 1; p >= value; p-- )
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user