You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ma...@apache.org on 2008/05/26 10:28:14 UTC

svn commit: r660121 - /webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c

Author: manjula
Date: Mon May 26 01:28:13 2008
New Revision: 660121

URL: http://svn.apache.org/viewvc?rev=660121&view=rev
Log:
Adding some comments to the code.

Modified:
    webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c

Modified: webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c?rev=660121&r1=660120&r2=660121&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c Mon May 26 01:28:13 2008
@@ -32,24 +32,35 @@
 
 struct axiom_search_info
 {
+    /*String need to be searched*/
     const axis2_char_t *search_str;
+
+    /*The buffers and the lengths need to be searched*/
     axis2_char_t *buffer1;
     int len1;
     axis2_char_t *buffer2;
     int len2;
+
+    /*Flag to keep what type of search is this buffer has done*/
     axis2_bool_t primary_search;
+
+    /*The offset where we found the pattern entirely in one buffer*/
     int match_len1;
+
+    /*when pattern contains in two buffers the length of partial pattern
+    in buffer2 */
     int match_len2;
+
+    /*Whether we need caching or not*/
     axis2_bool_t cached;
-    /*FILE *fp;*/
+
+    /*A pointer to a user provided storage to which we cache the attachment*/
     void *handler;
 };
 
 typedef struct axiom_search_info axiom_search_info_t;
 
 
-/*#define AXIOM_MIME_PARSER_BUFFER_SIZE (2 * 1024 * 1024)*/
-
 #define AXIOM_MIME_PARSER_CONTENT_ID "content-id"
 #define AXIOM_MIME_PARSER_CONTENT_TYPE "content-type"
 
@@ -477,7 +488,7 @@
             return NULL;
         }
         
-        /*The patteren contains in one buffer*/
+        /*The pattern contains in one buffer*/
         if(search_info->match_len2 == 0)
         {
             /*We found it . so lets seperates the details of this binary into 
@@ -516,6 +527,9 @@
                 return NULL;
             }
         }    
+
+        /*pattern is divided among the two buffers*/
+
         else if(search_info->match_len2 > 0)
         {
             mime_headers_len = axiom_mime_parser_calculate_part_len (
@@ -757,6 +771,10 @@
         search_info->len1 = len_array[*buf_num];
         found = axiom_mime_parser_search_string(search_info, env);
     }
+
+    /*If the incoming buffer is NULL then we need to fill one and 
+      set it as the new buffer*/
+
     else
     {
         *buf_num = *buf_num + 1;
@@ -895,7 +913,7 @@
 /*The caching is done in this function. Caching happens when we did not 
   find the mime_boundary in initial two buffers. So the maximum size
   that we are keeping in memory is 2 * size. This size can be configurable from
-  the aixs.xml. The caching may starts the search failed with the
+  the aixs.xml. The caching may starts when the search failed with the
   second buffer.  */
 
 static axis2_char_t *axiom_mime_parser_search_for_attachment(
@@ -926,12 +944,16 @@
     search_info->cached = AXIS2_FALSE;
     search_info->handler = NULL;
 
+    /*First search in the incoming buffer*/
+
     if(buf_array[*buf_num])
     {
         search_info->buffer1 = buf_array[*buf_num];
         search_info->len1 = len_array[*buf_num];
         found = axiom_mime_parser_search_string(search_info, env);
     }
+
+    /*If it is NULL then we need to create a new one fill and search*/
     else
     {
         *buf_num = *buf_num + 1;
@@ -962,8 +984,8 @@
                 }
             }
 
-            /*We always cache the buffer which is done with full and
-             buffer boudary searched.*/
+            /*So lets cache the previous buffer which has underdone the
+              full search and the partial search.  */
 
             status = axis2_caching_callback(env, buf_array[*buf_num - 1],
                 len_array[*buf_num - 1], search_info->handler);
@@ -988,6 +1010,8 @@
                 printf("read length: %d\n", len);
             }
         }
+
+        /*Caching is not started yet do we will create a new buffer and fill*/
         else
         {
             *buf_num = *buf_num + 1;
@@ -1001,6 +1025,8 @@
             }
         }
         
+        /*Doing  a complete search in newly cretaed buffer*/       
+ 
         if(len > 0)
         {
             len_array[*buf_num] = len;