~ubuntu-branches/ubuntu/hardy/eog/hardy-updates

« back to all changes in this revision

Viewing changes to src/eog-metadata-reader.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-09-18 10:45:35 UTC
  • mfrom: (1.1.34 upstream)
  • Revision ID: james.westby@ubuntu.com-20070918104535-3w6ucfpgd93mqygk
Tags: 2.20.0-0ubuntu1
* New upstream version
  New features:
  - Complete rewrite of application core which means more stable, 
    maintanable, faster image viewer for GNOME 
  - New plugin system which allows developers to extend EOG's UI
    and behavior. Python support is available.
  - Editable application toolbar
  - New image collection pane with on-demand thumbnail loading, 
    polished look, and continuous scrolling side buttons.
  - Side Pane to be extended by plugins
  - New image properties dialog which replaces the image info sidepane
  - Single instance D-Bus-based activation support
  - Revamped error/warning UI 
  - "Open with" support to quickly open images on other applications
  - Mouse scrollwheel improvements: HIG compliancy and zoom factor setting
  - General UI polishing 
  - Command line options for fullscreen, slideshow and image collection
    disabling
  - Display EXIF MakerNotes
  - XMP Support 
  Misc improvements/fixes:
  - Small refactorings in metadata readers
  Bug fixes:
  - #354352, Show incomplete images
  - #394803, Fails to load .svgz 
  - #440254, Eog crashes when opening an image with invalid unicode 
    as filename (LP: #126974)
  - #447063, eog hangs when opening SVG files that include external images
    (LP: #119603)
  - #459665, opened images should take as much screen space as possible
  - #465583, thumbnails badly rotated (autorotation enabled)
  - #470521, some image is rendered with a wrong rotation
  - #471530, Confusing PyGtk configure failure message
  - #474642, ./configure is semi-broken
  - #474710, eog crashes when you try to open this .jpg file 
    (it works fine on Vista/XP) (LP: #138730)
  - #474931, factore out some code in the metadata consumer
  New and updated translation
  New and updated manual translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        return EJA_OTHER;
170
170
}
171
171
 
 
172
static void
 
173
eog_metadata_reader_get_next_block (EogMetadataReaderPrivate* priv,
 
174
                                    guchar *chunk,
 
175
                                    int* i,
 
176
                                    guchar *buf,
 
177
                                    int len,
 
178
                                    EogMetadataReaderState state)
 
179
{
 
180
        if (*i + priv->size < len) {
 
181
                /* read data in one block */
 
182
                memcpy ((guchar*) (chunk) + priv->bytes_read, &buf[*i], priv->size);
 
183
                priv->state = EMR_READ;
 
184
                *i = *i + priv->size - 1; /* the for-loop consumes the other byte */
 
185
        } else {
 
186
                int chunk_len = len - *i;
 
187
                memcpy ((guchar*) (chunk) + priv->bytes_read, &buf[*i], chunk_len);
 
188
                priv->bytes_read += chunk_len; /* bytes already read */
 
189
                priv->size = (*i + priv->size) - len; /* remaining data to read */
 
190
                *i = len - 1;
 
191
                priv->state = state;
 
192
        }
 
193
}
172
194
 
173
195
void
174
196
eog_metadata_reader_consume (EogMetadataReader *emr, guchar *buf, guint len)
318
340
                case EMR_READ_EXIF:                     
319
341
                        eog_debug_message (DEBUG_IMAGE_DATA, "Read continuation of EXIF data, length: %i", priv->size);
320
342
                        {
321
 
                                int chunk_len = len - i;
322
 
                                memcpy ((guchar*) (priv->exif_chunk) + priv->bytes_read, &buf[i], chunk_len);
323
 
                                priv->bytes_read += chunk_len; /* bytes already read */
324
 
                                priv->size = (i + priv->size) - len; /* remaining data to read */
325
 
                                i = len - 1;
326
 
                                priv->state = EMR_READ_EXIF;
 
343
                                eog_metadata_reader_get_next_block (priv, priv->exif_chunk,
 
344
                                                                    &i, buf, len, EMR_READ_EXIF);
327
345
                        }
328
346
                        if (IS_FINISHED(priv))
329
347
                                priv->state = EMR_FINISHED;
332
350
                case EMR_READ_XMP:
333
351
                        eog_debug_message (DEBUG_IMAGE_DATA, "Read continuation of XMP data, length: %i", priv->size);
334
352
                        {
335
 
                                int chunk_len = len - i;
336
 
                                memcpy ((guchar*) (priv->xmp_chunk) + priv->bytes_read, &buf[i], chunk_len);
337
 
                                priv->bytes_read += chunk_len; /* bytes already read */
338
 
                                priv->size = (i + priv->size) - len; /* remaining data to read */
339
 
                                i = len - 1;
340
 
                                priv->state = EMR_READ_XMP;
 
353
                                eog_metadata_reader_get_next_block (priv, priv->xmp_chunk,
 
354
                                                                    &i, buf, len, EMR_READ_XMP);
341
355
                        }
342
356
                        if (IS_FINISHED (priv))
343
357
                                priv->state = EMR_FINISHED;
352
366
                                priv->bytes_read = 0;
353
367
                        }
354
368
 
355
 
                        if (i + priv->size < len) {
356
 
                                /* read data in one block */
357
 
                                memcpy ((guchar*) (priv->icc_chunk) + priv->bytes_read, &buf[i], priv->size); 
358
 
                                priv->state = EMR_READ;
359
 
                                i = i + priv->size - 1; /* the for-loop consumes the other byte */
360
 
                        } else {
361
 
                                int chunk_len = len - i;
362
 
                                memcpy ((guchar*) (priv->icc_chunk) + priv->bytes_read, &buf[i], chunk_len);
363
 
                                priv->bytes_read += chunk_len; /* bytes already read */
364
 
                                priv->size = (i + priv->size) - len; /* remaining data to read */
365
 
                                i = len - 1;
366
 
                                priv->state = EMR_READ_ICC;
367
 
                        }
 
369
                        eog_metadata_reader_get_next_block (priv, priv->icc_chunk,
 
370
                                                            &i, buf, len, EMR_READ_ICC);
368
371
                        
369
372
                        if (IS_FINISHED(priv))
370
373
                                priv->state = EMR_FINISHED;