Fix an issue that resulted in an error ("Invalid SOS parameters for sequential JPEG.  Didn't expect more than one scan.") when decoding progressive+arithmetic JPEGs generated by libjpeg-turbo.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@1081 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/jcmarker.c b/jcmarker.c
index 06fe623..e5b627f 100644
--- a/jcmarker.c
+++ b/jcmarker.c
@@ -3,6 +3,7 @@
  *
  * This file was part of the Independent JPEG Group's software:
  * Copyright (C) 1991-1998, Thomas G. Lane.
+ * Modified 2003-2010 by Guido Vollbeding.
  * Modifications:
  * Copyright (C) 2010, D. R. Commander.
  * For conditions of distribution and use, see the accompanying README file.
@@ -532,7 +533,10 @@
 
   /* Emit the proper SOF marker */
   if (cinfo->arith_code) {
-    emit_sof(cinfo, M_SOF9);	/* SOF code for arithmetic coding */
+    if (cinfo->progressive_mode)
+      emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
+    else
+      emit_sof(cinfo, M_SOF9);  /* SOF code for sequential arithmetic */
   } else {
     if (cinfo->progressive_mode)
       emit_sof(cinfo, M_SOF2);	/* SOF code for progressive Huffman */