OSDN Git Service

* Fixed bug.
authorAtsushi Konno <konn@users.sourceforge.jp>
Fri, 4 Mar 2011 09:44:20 +0000 (18:44 +0900)
committerAtsushi Konno <konn@users.sourceforge.jp>
Fri, 4 Mar 2011 09:44:20 +0000 (18:44 +0900)
    - use recount value because table_count is invalid.
    - SEGV if r->content_type is NULL

src/chxj_load_device_data.c
src/chxj_specified_device.c
src/mod_chxj.c

index 2b493e0..0114fbe 100755 (executable)
@@ -482,8 +482,8 @@ s_set_device_data(Doc *doc, apr_pool_t *p, device_table_list *dtl, Node *node)
       dtl->tail->next = dt;
       dtl->tail = dt;
     }
+    dtl->table_count++;
   }
-  dtl->table_count++;
 }
 
 
@@ -506,6 +506,7 @@ s_sort_table_compare(const void *a, const void *b)
 {
   device_table *aa = *(device_table **)a;
   device_table *bb = *(device_table **)b;
+
   /* 
    * do not use strcasecmp for LOAD!!
    */
index a82a447..48f6b46 100755 (executable)
@@ -183,15 +183,16 @@ s_specified_device_from_xml(request_rec *r, mod_chxj_config * conf, const char *
           if (conf->detect_device_type > CHXJ_ADD_DETECT_DEVICE_TYPE_NONE ){
             dt->device_id = device_id;
           }
-          returnType = dt;
+          DBG(r,"REQ[%X] end %s (Not Found) use [%s]", TO_ADDR(r), __func__, dt->device_id);
+          return dt;
         }
       }
-      DBG(r,"REQ[%X] end chxj_specified_device()", TO_ADDR(r));
-      return returnType;
+      DBG(r,"REQ[%X] end %s (Found) use [%s]", TO_ADDR(r), __func__, dt->device_id);
+      return dt;
     }
   }
 
-  DBG(r,"REQ[%X] end s_specified_device()", TO_ADDR(r));
+  DBG(r,"REQ[%X] end %s()", TO_ADDR(r), __func__);
 
   return returnType;
 }
index 99b4af0..0c6a216 100755 (executable)
@@ -325,7 +325,7 @@ chxj_headers_fixup(request_rec *r)
     }
   }
   else{
-    if(strncmp(r->content_type,"image/",6) == 0){
+    if(r->content_type && strncmp(r->content_type,"image/",6) == 0){
       if (dconf->image_rewrite == CHXJ_IMG_REWRITE_ON && !apr_table_get(r->headers_in, CHXJ_IMG_X_HTTP_IMAGE_FILENAME)){
         if(dconf->image_rewrite_mode == CHXJ_IMG_REWRITE_MODE_ALL){
           // all image