]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
*** empty log message ***
authorDarren Nickerson <darren.nickerson@ifax.com>
Mon, 3 Apr 2006 04:28:39 +0000 (04:28 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Mon, 3 Apr 2006 04:28:39 +0000 (04:28 +0000)
CHANGES
faxd/MemoryDecoder.c++

diff --git a/CHANGES b/CHANGES
index e7957a5cc08976cc93b91d9b56354085e51ab2a7..48b634d45d3a3672956d61144bac7e12d35b40c0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog
 
+* Correctly remove EOFB at the end of MMR images (02 Apr 2006)
 * set minimum of 4800 for V.34 primary rate renegotiations (02 Apr 2006)
 * improve handling of V.34 control channel retrain (02 Apr 2006)
 * Add isdn4linux modem config prototype (02 Apr 2006)
index a2c6cd0878a698a1bda6116c7eaee176f9f7b000..9306e0d9b742b44f2796f326b22a2fcb037d9c73 100644 (file)
@@ -296,8 +296,28 @@ u_char* MemoryDecoder::cutExtraEOFB()
            rows++;
         }
     }
-    if (seenRTC() && *(endOfData - 1) == 0x00)
-       endOfData--;    // step back over the first byte of EOFB, lastbyte must be non-zero!
+    /*
+     * The loop above will leave the endOfData pointer somewhere inside of EOFB.
+     * Make sure that endOfData points to the last byte containing real image data.
+     * So trim any whole bytes containing EOFB data.
+     */
+    if (seenRTC()) {
+       bool trimmed;
+       u_int searcharea;
+       u_short i;
+       do {
+           searcharea =  (*(endOfData) << 16) | (*(endOfData - 1) << 8) | *(endOfData - 2);
+           trimmed = false;
+           for (i = 0; i < 13; i++) {
+               if (((searcharea >> i) & 0xFFF) == 0x800) {
+                   endOfData--;
+                   if (*endOfData == 0x00) endOfData--;
+                   trimmed = true;
+                   break;
+               }
+           }
+       } while (trimmed);
+    }
     return endOfData;
 }