OSDN Git Service

Merge branch 'branch_0.12.0' into sandbox
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sun, 20 Jul 2008 16:41:13 +0000 (16:41 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sun, 20 Jul 2008 16:41:13 +0000 (16:41 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@3023 1a406e8e-add9-4483-a2c8-d8cac5b7c224

ChangeLog
configure
configure.ac
debian-sarge/changelog
debian/changelog
include/config.h
src/chxj_img_conv_format.c

index 6ef5639..f1565df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+libapache2-mod-chxj (0.12.9-1) unstable; urgency=low
+
+  * Changed Specification.
+    - When the size after it reduces becomes 0, it compels it to 1.
+      (Reported by someone. thanks!)
+  * Emergency measure
+    - MagickQuantizeImage function doesn't return.
+      (Reported by someone. thanks!)
+
+ -- Atsushi Konno <konn@users.sourceforge.jp>  Sun, 20 Jul 2008 23:28:36 +0900
+
 libapache2-mod-chxj (0.12.8-1) unstable; urgency=low
 
   * Added function.
index 0ac9905..ed4595a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for mod_chxj 0.12.8-1.
+# Generated by GNU Autoconf 2.61 for mod_chxj 0.12.9-1.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='mod_chxj'
 PACKAGE_TARNAME='mod_chxj'
-PACKAGE_VERSION='0.12.8-1'
-PACKAGE_STRING='mod_chxj 0.12.8-1'
+PACKAGE_VERSION='0.12.9-1'
+PACKAGE_STRING='mod_chxj 0.12.9-1'
 PACKAGE_BUGREPORT=''
 
 ac_unique_file="src/mod_chxj.c"
@@ -1405,7 +1405,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mod_chxj 0.12.8-1 to adapt to many kinds of systems.
+\`configure' configures mod_chxj 0.12.9-1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1476,7 +1476,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mod_chxj 0.12.8-1:";;
+     short | recursive ) echo "Configuration of mod_chxj 0.12.9-1:";;
    esac
   cat <<\_ACEOF
 
@@ -1592,7 +1592,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mod_chxj configure 0.12.8-1
+mod_chxj configure 0.12.9-1
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1606,7 +1606,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mod_chxj $as_me 0.12.8-1, which was
+It was created by mod_chxj $as_me 0.12.9-1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2424,7 +2424,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=mod_chxj
- VERSION=0.12.8-1
+ VERSION=0.12.9-1
 
 
 cat >>confdefs.h <<_ACEOF
@@ -21970,7 +21970,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mod_chxj $as_me 0.12.8-1, which was
+This file was extended by mod_chxj $as_me 0.12.9-1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22023,7 +22023,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-mod_chxj config.status 0.12.8-1
+mod_chxj config.status 0.12.9-1
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
index 7c29aaf..e946a21 100644 (file)
@@ -1,6 +1,6 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
-AC_INIT([mod_chxj],[0.12.8-1])
+AC_INIT([mod_chxj],[0.12.9-1])
 AC_PREREQ(2.59)
 AC_CONFIG_SRCDIR([src/mod_chxj.c])
 AC_CANONICAL_TARGET
index 8ef0b28..4cfdb52 100644 (file)
@@ -1,3 +1,14 @@
+libapache2-mod-chxj (0.12.9-1) unstable; urgency=low
+
+  * Changed Specification.
+    - When the size after it reduces becomes 0, it compels it to 1.
+      (Reported by someone. thanks!)
+  * Emergency measure
+    - MagickQuantizeImage function doesn't return.
+      (Reported by someone. thanks!)
+
+ -- Atsushi Konno <konn@users.sourceforge.jp>  Sun, 20 Jul 2008 23:28:36 +0900
+
 libapache2-mod-chxj (0.12.8-1) unstable; urgency=low
 
   * Added function.
index b1baf48..b4fc33f 100644 (file)
@@ -1,3 +1,14 @@
+libapache2-mod-chxj (0.12.9-1) unstable; urgency=low
+
+  * Changed Specification.
+    - When the size after it reduces becomes 0, it compels it to 1.
+      (Reported by someone. thanks!)
+  * Emergency measure
+    - MagickQuantizeImage function doesn't return.
+      (Reported by someone. thanks!)
+
+ -- Atsushi Konno <konn@users.sourceforge.jp>  Sun, 20 Jul 2008 23:28:36 +0900
+
 libapache2-mod-chxj (0.12.8-1) unstable; urgency=low
 
   * Added function.
index 0cf1365..47187ef 100644 (file)
 #define PACKAGE_NAME "mod_chxj"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "mod_chxj 0.12.8-1"
+#define PACKAGE_STRING "mod_chxj 0.12.9-1"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "mod_chxj"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.12.8-1"
+#define PACKAGE_VERSION "0.12.9-1"
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 
 /* Version number of package */
-#define VERSION "0.12.8-1"
+#define VERSION "0.12.9-1"
 
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
index 47f7f72..d8e2a1d 100644 (file)
@@ -516,16 +516,28 @@ s_create_cache_file(request_rec          *r,
     EXIT_MAGICK_ERROR();
     return HTTP_NOT_FOUND;
   }
+  if (MagickStripImage(magick_wand) == MagickFalse) {
+    ERR(r, "mod_chxj: strip image failure.");
+    EXIT_MAGICK_ERROR();
+    return HTTP_NOT_FOUND;
+  }
 
   if (spec->html_spec_type != CHXJ_SPEC_UNKNOWN) {
-    /*
-     * The size of the image is changed.
-     */
-    DBG(r,"call s_fixup_size()");
-  
-    if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) 
-      return HTTP_NOT_FOUND;
+    int oldw = MagickGetImageWidth(magick_wand);
+    int oldh = MagickGetImageHeight(magick_wand);
+    int done_fixup_size = 0;
+    if ((qsp->mode == IMG_CONV_MODE_WALLPAPER && spec->wp_width < oldw && spec->wp_heigh < oldh)
+      || (qsp->mode != IMG_CONV_MODE_WALLPAPER && spec->width < oldw && spec->heigh < oldh)) {
+      /*
+       * The size of the image is changed.
+       */
+      DBG(r,"call s_fixup_size()");
   
+      if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) 
+        return HTTP_NOT_FOUND;
+
+      done_fixup_size = 1;
+    }
     /*
      * The colors of the image is changed.
      */
@@ -543,7 +555,15 @@ s_create_cache_file(request_rec          *r,
       return HTTP_NOT_FOUND;
   
   
-  
+    if (! done_fixup_size) {
+      /*
+       * The size of the image is changed.
+       */
+      DBG(r,"call s_fixup_size()");
+      if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) 
+        return HTTP_NOT_FOUND;
+    }
+
     DBG(r,"start convert and compression");
   
     if (spec->available_jpeg) {
@@ -843,31 +863,62 @@ s_create_blob_data(request_rec          *r,
     return NULL;
   }
 
-  /*
-   * The size of the image is changed.
-   */
-  DBG(r, "call s_fixup_size()");
-
-  if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL)
+  if (MagickStripImage(magick_wand) == MagickFalse) {
+    ERR(r, "mod_chxj: strip image failure.");
+    EXIT_MAGICK_ERROR();
     return NULL;
+  }
 
-  /*
-   * The colors of the image is changed.
-   */
-  DBG(r, "call s_fixup_color()");
+  {
+    int oldw = MagickGetImageWidth(magick_wand);
+    int oldh = MagickGetImageHeight(magick_wand);
+    int done_fixup_size = 0;
+    if ((qsp->mode == IMG_CONV_MODE_WALLPAPER && spec->wp_width < oldw && spec->wp_heigh < oldh)
+      || (qsp->mode != IMG_CONV_MODE_WALLPAPER && spec->width < oldw && spec->heigh < oldh)) {
+      /*
+       * The size of the image is changed.
+       */
+      DBG(r,"call s_fixup_size()");
 
-  if ((magick_wand = s_fixup_color(magick_wand, r,spec, mode)) == NULL)
-    return NULL;
+      if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) {
+        EXIT_MAGICK_ERROR();
+        return NULL;
+      }
 
-  /*
-   * DEPTH of the image is changed.
-   */
+      done_fixup_size = 1;
+    }
+    /*
+     * The colors of the image is changed.
+     */
+    DBG(r,"call s_fixup_color()");
 
-  DBG(r,"call s_fixup_depth()");
+    if ((magick_wand = s_fixup_color(magick_wand, r,spec, mode)) == NULL) {
+      EXIT_MAGICK_ERROR();
+      return NULL;
+    }
 
-  if ((magick_wand = s_fixup_depth(magick_wand, r, spec)) == NULL)
-    return NULL;
+    /*
+     * DEPTH of the image is changed.
+     */
+    DBG(r,"call s_fixup_depth()");
 
+    if ((magick_wand = s_fixup_depth(magick_wand, r, spec)) == NULL) {
+      EXIT_MAGICK_ERROR();
+      return NULL;
+    }
+
+
+    if (! done_fixup_size) {
+      /*
+       * The size of the image is changed.
+       */
+      DBG(r,"call s_fixup_size()");
+      if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) {
+        EXIT_MAGICK_ERROR();
+        return NULL;
+      }
+    }
+  }
 
 
   DBG(r,"start convert and compression");
@@ -1092,6 +1143,9 @@ s_fixup_size(MagickWand           *magick_wand,
     break;
   }
 
+  if (neww == 0) neww = 1;
+  if (newh == 0) newh = 1;
+
   if (spec->html_spec_type != CHXJ_SPEC_UNKNOWN) {
     DBG(r,"convert width=[%d --> %d]", oldw, neww);
     DBG(r,"convert heigh=[%d --> %d]", oldh, newh);
@@ -1170,6 +1224,13 @@ s_fixup_color(MagickWand *magick_wand, request_rec *r, device_table *spec, img_c
     return magick_wand;
   }
 
+  unsigned long colors = MagickGetImageColors(magick_wand);
+  DBG(r, "now color:[%ld] spec->color:[%ld]", colors, (unsigned long)spec->color);
+  if (colors < (unsigned long)spec->color) {
+    DBG(r, "Pass s_fixup_color proc. color:[%ld] spec->color:[%d]", colors, spec->color);
+    return magick_wand;
+  }
+
   if (spec->color >= 256) {
 
     DBG(r,"call MagickQuantizeImage() spec->color=[%d]",spec->color);