OSDN Git Service

*** empty log message ***
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 6 Feb 2008 05:39:33 +0000 (05:39 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 6 Feb 2008 05:39:33 +0000 (05:39 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1830 1a406e8e-add9-4483-a2c8-d8cac5b7c224

configure
configure.ac
include/chxj_img_conv_format.h
include/mod_chxj.h
src/Makefile.am
src/Makefile.in
src/chxj_encoding.c
src/chxj_img_conv_format.c
src/chxj_load_emoji_data.c
src/qs_parse_string.c

index 9ba6c9e..700b6b1 100755 (executable)
--- a/configure
+++ b/configure
@@ -20107,15 +20107,7 @@ if test "${with_apache_header+set}" = set; then
 fi
 
 #[, ACTION-IF-GIVEN[, ACTION-IF-NOT-GIVEN]])
-if test "x$with_apache_header" = "x"; then
-    { { echo "$as_me:$LINENO: error:
-Please specify the --with-apache-header option.
-" >&5
-echo "$as_me: error:
-Please specify the --with-apache-header option.
-" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+
 if test "x$with_apache_header" = "xyes"; then
     { { echo "$as_me:$LINENO: error:
 Please specify the --with-apache-header option. And, please specify the place of the header file.
@@ -20600,53 +20592,10 @@ if test "x$with_apu_config" != "x" ; then
   APU_CONFIG=$with_apu_config
 fi
 
+if test "x$with_apache_header" = "x" ; then
+  with_apache_header=`${APXS} -q includedir`
 
-#AC_ARG_WITH(iconv, [  --with-iconv=ARG  specify the place of the libiconv directory.])
-#AC_ARG_WITH(iconv_hook, [  --with-iconv_hook=ARG  specify the place of the libiconv_hook directory.])
-#if test "x$with_iconv" = "x" -a "x$with_iconv_hook" = "x" ; then
-#  AC_CHECK_LIB([iconv_hook], [iconv_open], [
-#      with_iconv="ok"
-#      AC_DEFINE([HAVE_LIBICONV_HOOK], [], [Define to 1 if you have the iconv library file.])
-#      LIBS="${LIBS} -liconv_hook"
-#  ],[
-#    AC_CHECK_LIB([iconv], [iconv_open], [
-#      with_iconv="ok"
-#      AC_DEFINE([HAVE_LIBICONV], [], [Define to 1 if you have the iconv library file.])
-#      LIBS="${LIBS} -liconv"
-#  ], [
-#      witn_iconv=""
-#  ],[])
-#  ],[])
-#fi
-#
-#if test "x$with_iconv" != "xok" ; then
-#  if test "x$with_iconv" = "xyes" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv option. And, please specify the place of the libiconv program.
-#  ])
-#  fi
-#  if test "x$with_iconv" != "x" ; then
-#    LIBS="${LIBS} -L$with_iconv -liconv "
-#    AC_DEFINE([HAVE_LIBICONV], [], [Define to 1 if you have the iconv library file.])
-#  fi
-#fi
-#if test "x$with_iconv" = "x" ; then
-#  if test "x$with_iconv_hook" = "xyes" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv-hook option. And, please specify the place of the libiconv_hook program.
-#  ])
-#  fi
-#  if test "x$with_iconv_hook" != "x" ; then
-#    LIBS="${LIBS} -L${with_iconv_hook} -liconv_hook "
-#    AC_DEFINE([HAVE_LIBICONV_HOOK], [], [Define to 1 if you have the iconv_hook library file.])
-#  fi
-#  if test "x$with_iconv_hook" = "x" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv-hook option. And, please specify the place of the libiconv_hook program.
-#  ])
-#  fi
-#fi
-
+fi
 
 case $host_os in
   freebsd*)
@@ -20661,7 +20610,9 @@ LIBS="${LIBS} `${APU_CONFIG} --ldflags` `${APU_CONFIG} --libs` "
 CFLAGS="${CFLAGS} `${WAND_CONFIG} --cppflags` `${WAND_CONFIG} --cflags`"
 CFLAGS="${CFLAGS} `${APR_CONFIG} --includes` `${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags`"
 CFLAGS="${CFLAGS} `${APU_CONFIG} --includes`"
-CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` -I${with_apache_header}"
+CFLAGS="${CFLAGS} -I${with_apache_header}"
+CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` "
+CPPFLAGS="${CPPFLAGS} -I${with_apache_header}"
 
 
 
index 46fb087..c98ed4a 100644 (file)
@@ -21,11 +21,7 @@ AC_CHECK_LIB([apr-1],  [main])
 
 AC_ARG_WITH(apache-header, [  --with-apache-header=ARG The directory with the header file of apache2.x is specified. ]) 
 #[, ACTION-IF-GIVEN[, ACTION-IF-NOT-GIVEN]])
-if test "x$with_apache_header" = "x"; then
-    AC_MSG_ERROR([
-Please specify the --with-apache-header option.
-])
-fi
+
 if test "x$with_apache_header" = "xyes"; then
     AC_MSG_ERROR([
 Please specify the --with-apache-header option. And, please specify the place of the header file. 
@@ -137,53 +133,10 @@ if test "x$with_apu_config" != "x" ; then
   APU_CONFIG=$with_apu_config
 fi
 
-
-#AC_ARG_WITH(iconv, [  --with-iconv=ARG  specify the place of the libiconv directory.])
-#AC_ARG_WITH(iconv_hook, [  --with-iconv_hook=ARG  specify the place of the libiconv_hook directory.])
-#if test "x$with_iconv" = "x" -a "x$with_iconv_hook" = "x" ; then
-#  AC_CHECK_LIB([iconv_hook], [iconv_open], [
-#      with_iconv="ok"
-#      AC_DEFINE([HAVE_LIBICONV_HOOK], [], [Define to 1 if you have the iconv library file.])
-#      LIBS="${LIBS} -liconv_hook"
-#  ],[
-#    AC_CHECK_LIB([iconv], [iconv_open], [
-#      with_iconv="ok"
-#      AC_DEFINE([HAVE_LIBICONV], [], [Define to 1 if you have the iconv library file.])
-#      LIBS="${LIBS} -liconv"
-#  ], [
-#      witn_iconv=""
-#  ],[])
-#  ],[])
-#fi
-#
-#if test "x$with_iconv" != "xok" ; then
-#  if test "x$with_iconv" = "xyes" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv option. And, please specify the place of the libiconv program. 
-#  ])
-#  fi
-#  if test "x$with_iconv" != "x" ; then
-#    LIBS="${LIBS} -L$with_iconv -liconv "
-#    AC_DEFINE([HAVE_LIBICONV], [], [Define to 1 if you have the iconv library file.])
-#  fi
-#fi
-#if test "x$with_iconv" = "x" ; then
-#  if test "x$with_iconv_hook" = "xyes" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv-hook option. And, please specify the place of the libiconv_hook program. 
-#  ])
-#  fi
-#  if test "x$with_iconv_hook" != "x" ; then
-#    LIBS="${LIBS} -L${with_iconv_hook} -liconv_hook "
-#    AC_DEFINE([HAVE_LIBICONV_HOOK], [], [Define to 1 if you have the iconv_hook library file.])
-#  fi
-#  if test "x$with_iconv_hook" = "x" ; then
-#      AC_MSG_ERROR([
-#  Please specify the --with-iconv-hook option. And, please specify the place of the libiconv_hook program. 
-#  ])
-#  fi
-#fi
-
+if test "x$with_apache_header" = "x" ; then
+  with_apache_header=`${APXS} -q includedir`
+  AC_SUBST(with_apache_header)
+fi
 
 case $host_os in
   freebsd*)
@@ -198,7 +151,9 @@ LIBS="${LIBS} `${APU_CONFIG} --ldflags` `${APU_CONFIG} --libs` "
 CFLAGS="${CFLAGS} `${WAND_CONFIG} --cppflags` `${WAND_CONFIG} --cflags`"
 CFLAGS="${CFLAGS} `${APR_CONFIG} --includes` `${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags`"
 CFLAGS="${CFLAGS} `${APU_CONFIG} --includes`"
-CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` -I${with_apache_header}"
+CFLAGS="${CFLAGS} -I${with_apache_header}"
+CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` "
+CPPFLAGS="${CPPFLAGS} -I${with_apache_header}"
 AC_SUBST(with_apache_header)
 AC_SUBST(CC)
 AC_SUBST(QDEFS)
index d680158..b65611b 100644 (file)
@@ -36,6 +36,12 @@ extern int chxj_trans_name(
   request_rec*         r);
 
 
+/* micro second */
+#define CACHE_RECHECK_WAIT        (200000)
+
+/* retry count of creating cache file */
+#define CACHE_RETRY_COUNT         (5)
+
 #endif
 /*
  * vim:ts=4 et
index d89048f..764a850 100644 (file)
@@ -384,6 +384,8 @@ module AP_MODULE_DECLARE_DATA chxj_module;
   ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(request_rec*)(rec),(format), ##args)
 #define SERR(rec,format, args...) \
   ap_log_error(APLOG_MARK,APLOG_ERR,0,(rec),(format), ##args)
+#define WRN(rec,format, args...)  \
+  ap_log_rerror(APLOG_MARK,APLOG_WARNING,0,(rec),(format), ##args)
 
 extern tag_handlers chxj_tag_handlers[];
 extern tag_handler  chtml10_handler[];
index a889b72..8c33dca 100644 (file)
@@ -32,8 +32,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_emoji.c
 
 
-libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
-AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@
+libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include 
+AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include 
 
 lib_LTLIBRARIES = libmod_chxj.la
 
index e60e9ae..4998cc7 100644 (file)
@@ -241,8 +241,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_cookie.c \
     chxj_emoji.c
 
-libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
-AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@
+libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include 
+AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include 
 lib_LTLIBRARIES = libmod_chxj.la
 all: all-am
 
index d6dc03e..6b5ed01 100644 (file)
 #include "chxj_apply_convrule.h"
 #include "chxj_url_encode.h"
 
-#if 0
-#if defined(HAVE_LIBICONV_HOOK)
-#  include "iconv_hook/iconv.h"
-#else
-#  if defined(HAVE_LIBICONV)
-#    include "iconv.h"
-#  else
-#    error "Please install libiconv or libiconv_hook. and Please set LD_LIBRARY_PATH."
-#  endif
-#endif
-#endif
-
 #include <iconv.h>
 
 static char *
index cd90ba6..79402f0 100644 (file)
@@ -377,6 +377,7 @@ s_img_conv_format_from_file(
   apr_finfo_t    st;
   apr_finfo_t    cache_st;
   char           *tmpfile;
+  int            try_count;
 
   if (spec->html_spec_type == CHXJ_SPEC_UNKNOWN) {
     /*
@@ -395,37 +396,42 @@ s_img_conv_format_from_file(
   if (rv != APR_SUCCESS)
     return HTTP_NOT_FOUND;
 
+  try_count = CACHE_RETRY_COUNT;
+  do {
+    rv = apr_stat(&cache_st, tmpfile, APR_FINFO_MIN, r->pool);
 
-  DBG(r,"found [%s]", r->filename);
-  rv = apr_stat(&cache_st, tmpfile, APR_FINFO_MIN, r->pool);
-  DBG(r,"found [%s]", r->filename);
-
-  if (rv != APR_SUCCESS || cache_st.ctime < st.mtime) {
-    /*------------------------------------------------------------------------*/
-    /* It tries to make the cash file when it doesn't exist or there is       */
-    /* change time later since the making time of the cash file.              */
-    /*------------------------------------------------------------------------*/
-    rv = s_create_cache_file(r,tmpfile, spec, &st, qsp, conf);
-    if (rv != OK)
-      return rv;
-  }
+    if (rv != APR_SUCCESS || cache_st.ctime < st.mtime) {
+      /*------------------------------------------------------------------------*/
+      /* It tries to make the cash file when it doesn't exist or there is       */
+      /* change time later since the making time of the cash file.              */
+      /*------------------------------------------------------------------------*/
+      rv = s_create_cache_file(r,tmpfile, spec, &st, qsp, conf);
+      if (rv != OK)
+        return rv;
+    }
 
-  DBG(r,"color=[%d]", spec->color);
-  if (! r->header_only)  {
-    rv = s_send_cache_file(spec, qsp,r, tmpfile);
-    if (rv != OK) 
-      return rv;
-  }
-  else {
-    rv = s_header_only_cache_file(spec, qsp, r, tmpfile);
-    if (rv != OK) 
-      return rv;
+    DBG(r,"color=[%d]", spec->color);
+    if (! r->header_only)  {
+      rv = s_send_cache_file(spec, qsp,r, tmpfile);
+    }
+    else {
+      rv = s_header_only_cache_file(spec, qsp, r, tmpfile);
+    }
+    if (rv == OK) break;
+    if (rv == HTTP_NOT_FOUND) {
+      DBG(r, "recheck wait... try_count[%d]", try_count);
+      apr_sleep(CACHE_RECHECK_WAIT);
+    }
+  } while (try_count--);
+  if (try_count <= 0) {
+    WRN(r, "cache retry failure....");
+    WRN(r, "cache file was deleted...");
   }
   apr_table_setn(r->headers_in, "CHXJ_IMG_CONV", "done");
 
   DBG(r,"end chxj_img_conv_format");
 
-  return OK;
+  return rv;
 }
 
 
index d36abde..25c9172 100644 (file)
@@ -186,6 +186,8 @@ s_set_emoji_data(
 {
   Node *child;
   char *rtn;
+  int has_ezweb2imode_tag = 0;
+  int has_softbank2imode_tag = 0;
 
   for (child = qs_get_child_node(doc,node);
        child;
@@ -200,13 +202,18 @@ s_set_emoji_data(
       if ((rtn = s_load_ezweb2imode_tag(doc, p, conf, child))) {
         return rtn;
       }
+      has_ezweb2imode_tag = 1;
     }
     else if (STRCASEEQ('s','S',"softbank2imode", name)) {
       if ((rtn = s_load_softbank2imode_tag(doc, p, conf, child))) {
         return rtn;
       }
+      has_softbank2imode_tag = 1;
     }
   }
+  if (!has_ezweb2imode_tag || !has_softbank2imode_tag) {
+    return apr_pstrdup(p,"``emoji.xml'' is too old(not 0.9.0 nor later). Please setup emoji.xml for a new definition(0.9.0 or later). ");
+  }
   return NULL;
 }
 
index b535f4e..828dacc 100644 (file)
 
 #include "mod_chxj.h"
 
-#if 0
-#if defined(HAVE_LIBICONV_HOOK)
-#  include "iconv_hook/iconv.h"
-#else
-#  if defined(HAVE_LIBICONV)
-#    include "iconv.h"
-#  else
-#    error "Please install libiconv or libiconv_hook. and Please set LD_LIBRARY_PATH."
-#  endif
-#endif
-#endif
-
 #include <iconv.h>
 
 static int s_cut_tag (const char *s, int len);