[master] Store user's user_png_ver in new png_ptr->user_png_ver element.

Revised iTXt support. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from versions prior to 1.2.41beta11 whenever there is a
library mismatch.
diff --git a/ANNOUNCE b/ANNOUNCE
index 144e831..50efaa2 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.2.41beta11 - November 1, 2009
+Libpng 1.2.41beta11 - November 2, 2009
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
@@ -99,11 +99,12 @@
     longer necessary to gain iTXt support), as a signal that the user has
     been building previous versions with PNG_iTXt_SUPPORTED as well.
 
-version 1.2.41beta11 [November 1, 2009]
+version 1.2.41beta11 [November 2, 2009]
+  Store user's user_png_ver in new png_ptr->user_png_ver element.
   Revised iTXt support. To ensure binary compatibility with
     previous versions, the "lang" and "lang_key" members will be assumed
-    to be omitted from previous versions whenever there is a library
-    mismatch.
+    to be omitted from versions prior to 1.2.41beta11 whenever there is a
+    library mismatch.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 
diff --git a/CHANGES b/CHANGES
index 6704fe5..8eb79ec 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2466,7 +2466,7 @@
 version 1.2.40rc01 [September 2, 2009]
   Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
 
-version 1.2.40 and 1.0.49 [November 1, 2009]
+version 1.2.40 and 1.0.49 [November 2, 2009]
   No changes.
 
 version 1.0.50 [September 10, 2009]
@@ -2529,11 +2529,12 @@
     longer necessary to gain iTXt support), as a signal that the user has
     been building previous versions with PNG_iTXt_SUPPORTED as well.
 
-version 1.2.41beta11 [November 1, 2009]
+version 1.2.41beta11 [November 2, 2009]
+  Store user's user_png_ver in new png_ptr->user_png_ver element.
   Revised iTXt support. To ensure binary compatibility with
     previous versions, the "lang" and "lang_key" members will be assumed
-    to be omitted from previous versions whenever there is a library
-    mismatch.
+    to be omitted from versions prior to 1.2.41beta11 whenever there is a
+    library mismatch.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/png.c b/png.c
index 71ef0b6..e3e3d43 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * Last changed in libpng 1.2.41 [November 1, 2009]
+ * Last changed in libpng 1.2.41 [November 2, 2009]
  * Copyright (c) 1998-2009 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -722,13 +722,13 @@
 #else
 #ifdef __STDC__
    return ((png_charp) PNG_STRING_NEWLINE \
-     "libpng version x 1.2.41beta11 - November 1, 2009" PNG_STRING_NEWLINE \
+     "libpng version 1.2.41beta11 - November 2, 2009" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
      "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
      "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
      PNG_STRING_NEWLINE);
 #else
-      return ((png_charp) "libpng version 1.2.41beta11 - November 1, 2009\
+      return ((png_charp) "libpng version 1.2.41beta11 - November 2, 2009\
       Copyright (c) 1998-2009 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
diff --git a/pngset.c b/pngset.c
index c3725d1..6298c95 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * Last changed in libpng 1.2.41 [November 1, 2009]
+ * Last changed in libpng 1.2.41 [November 2, 2009]
  * Copyright (c) 1998-2009 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -653,7 +653,9 @@
                int num_text)
 {
    int i;
+#ifdef PNG_iTXt_SUPPORTED
    int caller_no_itxt = 0;
+#endif
 
    png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
       png_ptr->chunk_name[0] == '\0') ?
@@ -662,6 +664,7 @@
    if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
       return(0);
 
+#ifdef PNG_iTXt_SUPPORTED
    /* If an earlier version of the library was used to build the
     * application, it might be using a png_textp structure that
     * does not contain the lang or lang_key elements. Even if you build
@@ -670,12 +673,35 @@
     * defined, the complete png_textp structure probably has not existed
     * all along and it's not safe to access them, due to a bug in
     * pngconf.h from version 1.2.9 to 1.2.40.
-    *
-    * To do: accept mismatched libraries when both are version 1.2.41
-    * or later.
     */
    if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
-      caller_no_itxt = 1;
+   {
+      int j;
+      png_byte c[12];
+
+      j = 0;
+      for (j = 0; j < 12; j++)
+         c[j] = 0;
+
+      for (j = 0; c[j] && j < 12; j++)
+         c[j] = png_ptr->user_png_ver[j];
+
+      if ((c[5] == '\0')   /* 1.2.N */         ||
+          (c[5] == 'b')    /* 1.2.NbetaNN */   ||
+          (c[5] == 'r')    /* 1.2.NrcNN   */   ||
+          (c[4] == '1')    /* 1.2.1x */        ||
+          (c[4] == '2')    /* 1.2.2x */        ||
+          (c[4] == '3')    /* 1.2.3x */        ||
+          ((c[4] == '4')   /* 1.2.4x */        &&
+          (((c[5] == '0')) /* 1.2.40 */        ||
+          ((c[5] == '1')   /* 1.2.41x */       &&
+          (((c[6] == 'b')  /* 1.2.41betax */   &&
+          ((c[10] == '0'))) /* 1.2.41beta0x */ ||
+          ((c[10] == '1')   /* 1.2.41beta1x */ &&
+          (c[11] == '0'))))))) /* 1.2.41beta10 */
+         caller_no_itxt = 1;
+   }
+#endif /* PNG_iTXt_SUPPORTED */
 
    /* Make sure we have enough space in the "text" array in info_struct
     * to hold all of the incoming text_ptr objects.