OSDN Git Service

*** empty log message ***
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 5 Jun 2006 22:04:33 +0000 (22:04 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 5 Jun 2006 22:04:33 +0000 (22:04 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@230 1a406e8e-add9-4483-a2c8-d8cac5b7c224

src/mod_chxj.c
src/qs_parse_string.c

index a1fe21e..658350f 100644 (file)
@@ -101,7 +101,8 @@ chxj_exchange(request_rec *r, const char** src, apr_size_t* len)
   ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, 
           "content type is %s", r->content_type);
 
-  if (strncmp(r->content_type, "text/html",   9) != 0) {
+  if (*(char*)r->content_type == 't' 
+  && strncmp(r->content_type, "text/html",   9) != 0) {
     ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 
       0, r, "content type is %s", r->content_type);
     return (char*)*src;
@@ -328,12 +329,14 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
       /*----------------------------------------------------------------------*/
       if (f->ctx) {
         ctx = (mod_chxj_ctx_t*)f->ctx;
-        if (strncmp(r->content_type, "text/html",   9) == 0) {
+        if (*(char*)r->content_type == 't' 
+        && strncmp(r->content_type, "text/html",   9) == 0) {
           if (ctx->len) {
             char* tmp = apr_palloc(r->pool, ctx->len + 1);
             memset(tmp, 0, ctx->len + 1);
             memcpy(tmp, ctx->buffer, ctx->len);
-            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "input data=[%s]", tmp);
+            ap_log_rerror(
+              APLOG_MARK, APLOG_DEBUG, 0, r, "input data=[%s]", tmp);
             ctx->buffer = chxj_exchange(r, (const char**)&tmp, (apr_size_t*)&ctx->len);
             ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "output data=[%.*s]", ctx->len,ctx->buffer);
           }
index f746287..8e9b292 100644 (file)
@@ -48,8 +48,9 @@ qs_parse_string(Doc* doc, const char* src, int srclen)
       if (node->name[0] == '/' ) {
 
         if ((doc->parse_mode == PARSE_MODE_CHTML && has_child(&(node->name[1])))
-        ||  (doc->parse_mode == PARSE_MODE_NO_PARSE && strcasecmp(&node->name[1], "chxj:if") == 0)) 
-        {
+        ||  (doc->parse_mode == PARSE_MODE_NO_PARSE 
+        &&  (node->name[1] == 'c' || node->name[1] == 'C')
+        &&  strcasecmp(&node->name[1], "chxj:if") == 0)) {
           if (doc->now_parent_node->parent != NULL) {
             doc->now_parent_node = doc->now_parent_node->parent;
             doc->parse_mode = PARSE_MODE_CHTML;
@@ -59,7 +60,7 @@ qs_parse_string(Doc* doc, const char* src, int srclen)
         if (doc->parse_mode != PARSE_MODE_NO_PARSE)
           continue;
       }
-      if (strncmp(node->name, "!--", 3) == 0) {
+      if (*node->name == '!' && strncmp(node->name, "!--", 3) == 0) {
         /* comment tag */
         continue;
       }
@@ -72,14 +73,20 @@ qs_parse_string(Doc* doc, const char* src, int srclen)
 #ifdef DEBUG
   QX_LOGGER_DEBUG("return from qs_add_child_node()");
 #endif
-      if (doc->parse_mode == PARSE_MODE_CHTML && strcasecmp(node->name, "chxj:if") == 0) {
+      if (doc->parse_mode == PARSE_MODE_CHTML && 
+      (*node->name == 'c' || *node->name == 'C') &&
+      strcasecmp(node->name, "chxj:if") == 0) {
         Attr* parse_attr;
 
         doc->parse_mode = PARSE_MODE_NO_PARSE;
         doc->now_parent_node = node;
-        for(parse_attr = node->attr; parse_attr; parse_attr = parse_attr->next) {
-          if (strcasecmp(parse_attr->name, "parse") == 0) {
-            if (strcasecmp(parse_attr->value, "true") == 0) {
+        for(parse_attr = node->attr;
+            parse_attr; 
+            parse_attr = parse_attr->next) {
+          if ((*parse_attr->name == 'p' || *parse_attr->name == 'P') 
+          &&   strcasecmp(parse_attr->name, "parse") == 0) {
+            if ((*parse_attr->value == 't' || *parse_attr->value == 'T')
+            &&   strcasecmp(parse_attr->value, "true") == 0) {
               doc->parse_mode = PARSE_MODE_CHTML;
             }
           }