[Kde-imaging] extragear/libs/libkexif

Angelo Naselli anaselli at linux.it
Sat Oct 21 23:13:38 CEST 2006


SVN commit 597861 by anaselli:

Applied patch provided by Marc Espie, who discovered a loss of data in OpenBSD.
Although it's hard to get in linux it can be happen.  
CCMAIL: kde-imaging at kde.org,  espie at nerim.net

 M  +8 -0      kexifutils.cpp  


--- trunk/extragear/libs/libkexif/kexifutils.cpp #597860:597861
@@ -38,6 +38,11 @@
 #include "kexifutils.h"
 #include "kexifdata.h"
 
+static void streamsync(QDataStream &s)
+{
+       s.device()->at(s.device()->at());
+}
+
 bool KExifUtils::writeOrientation(const QString& filename, KExifData::ImageOrientation orientation)
 {
    QString str = "";
@@ -217,6 +222,7 @@
           position++;
        }
 
+       streamsync(stream);
        // write character code ASCII into offset position
        stream << 0x49435341;
        stream << 0x00000049;
@@ -260,6 +266,7 @@
               if(i > 8  && buf[i]==0x01 && buf[i-1]==0x00 && buf[i-2]==0x00 && buf[i-3]==0x00 
                       && buf[i-4]==0x03 && buf[i-5]==0x00 && buf[i-6]==0x12 && buf[i-7]==0x01)
               {
+                 streamsync(stream);
                   stream << (Q_UINT8)0x00;
                   stream << (Q_UINT8)orientation;
 
@@ -270,6 +277,7 @@
               if(i > 8 && buf[i]==0x00 && buf[i-1]==0x00 && buf[i-2]==0x00 && buf[i-3]==0x01 
                      && buf[i-4]==0x00 && buf[i-5]==0x03 && buf[i-6]==0x01 && buf[i-7]==0x12)
               {
+                 streamsync(stream);
                   stream << (Q_UINT8)orientation;
                   stream << (Q_UINT8)0x00;
 


More information about the Kde-imaging mailing list