Update of /cvsroot/ufraw/ufraw
In directory vz-cvs-2.sog:/tmp/cvs-serv19544

Modified Files:
        dcraw.cc dcraw.h 
Log Message:
Limit the number of dcraw IO errors to 10, fixing bug #3024370.


Index: dcraw.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw.cc,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- dcraw.cc    20 Feb 2011 06:00:08 -0000      1.239
+++ dcraw.cc    1 Mar 2011 03:38:35 -0000       1.240
@@ -143,6 +143,7 @@
 ifpReadCount = 0;
 ifpSize = 0;
 ifpStepProgress = 0;
+eofCount = 0;
 }
 
 CLASS ~DCRaw()
@@ -168,10 +169,16 @@
 
 size_t CLASS fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
     size_t num = ::fread(ptr, size, nmemb, stream);
-    if ( num != nmemb )
-//     Maybe this should be a DCRAW_WARNING
-        dcraw_message(DCRAW_VERBOSE, "%s: fread %d != %d\n",
-                ifname_display, num, nmemb);
+    if ( num != nmemb ) {
+        if (eofCount < 10)
+            // Maybe this should be a DCRAW_WARNING
+            dcraw_message(DCRAW_VERBOSE, "%s: fread %d != %d\n",
+                    ifname_display, num, nmemb);
+        if (eofCount == 10)
+            dcraw_message(DCRAW_VERBOSE, "%s: fread eof reached 10 times\n",
+                    ifname_display);
+        eofCount++;
+    }
     if (stream==ifp) ifpProgress(size*nmemb);
     return num;
 }
@@ -186,10 +193,16 @@
 
 char *CLASS fgets(char *s, int size, FILE *stream) {
     char *str = ::fgets(s, size, stream);
-    if ( str==NULL )
-//     Maybe this should be a DCRAW_WARNING
-        dcraw_message(DCRAW_VERBOSE, "%s: fgets returned NULL\n",
-                ifname_display);
+    if (str == NULL) {
+        if (eofCount < 10)
+            // Maybe this should be a DCRAW_WARNING
+            dcraw_message(DCRAW_VERBOSE, "%s: fgets returned NULL\n",
+                    ifname_display);
+        if (eofCount == 10)
+            dcraw_message(DCRAW_VERBOSE, "%s: fgets eof reached 10 times\n",
+                    ifname_display);
+        eofCount++;
+    }
     if (stream==ifp) ifpProgress(strlen(s));
     return str;
 }

Index: dcraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- dcraw.h     20 Feb 2011 06:15:20 -0000      1.68
+++ dcraw.h     1 Mar 2011 03:38:35 -0000       1.69
@@ -94,6 +94,7 @@
     unsigned ifpReadCount;
     unsigned ifpSize;
     unsigned ifpStepProgress;
+    int eofCount;
 #define STEPS 50
     void ifpProgress(unsigned readCount);
 // Override standard io function for integrity checks and progress report


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
ufraw-cvs mailing list
ufraw-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to