Hi,
 
data_handler.c has been modified, inorder to improve the efficiency of reading binay files. Please see the attached diff file.
 
Thank You
 
Kapila

 
On 5/7/06, Kapila Dissanayake <[EMAIL PROTECTED]> wrote:
Hi,
 
I modified data_handler.c to improve the efficieny of reading binary attachments.

Attachment: data_handler_diff.txt

Diff for files in modules/xml/attachments: data_handler_diff.txt

 

Thank You

Kapila

 



Index: modules/xml/attachments/data_handler.c
===================================================================
--- modules/xml/attachments/data_handler.c      (revision 398104)
+++ modules/xml/attachments/data_handler.c      (working copy)
@@ -16,6 +16,7 @@
  
 #include <axis2_data_handler.h>
 #include <stdio.h>
+#include <sys/stat.h>
 
 typedef struct axis2_data_handler_impl
 {
@@ -185,7 +186,12 @@
             return AXIS2_FAILURE;
         
         do {
-            read_stream_size = 1024;
+            struct stat stat_p;
+            if ( -1 ==  stat (data_handler_impl->file_name, &stat_p))
+            {
+                return AXIS2_FAILURE;
+            }
+            read_stream_size = stat_p.st_size;
             read_stream = AXIS2_MALLOC((*env)->allocator, (read_stream_size) * 
sizeof(axis2_byte_t));
             if (!read_stream)
             {
@@ -197,7 +203,7 @@
                 }
                 return AXIS2_FAILURE;
             }
-            count = fread(read_stream, 1, 1024, f);
+            count = fread(read_stream, 1, read_stream_size, f);
             if (ferror(f) != 0)
             {
                 /*TODO : need to set the correct error code */
@@ -354,3 +360,4 @@
     return AXIS2_SUCCESS;
 }
 
+
Index: build.sh
===================================================================
--- build.sh    (revision 398104)
+++ build.sh    (working copy)
@@ -2,7 +2,7 @@
 ./autogen.sh
 AXIS2C_HOME=`pwd`/deploy
 export AXIS2C_HOME
-./configure --prefix=${AXIS2C_HOME} --enable-tests=yes --enable-trace=yes  
--with-apache2=/usr/include/apache2 --with-apr=/usr/include/apr-0 
--enable-diclient=no --enable-static=no
+./configure --prefix=${AXIS2C_HOME} --enable-tests=yes --enable-trace=yes 
--enable-diclient=no --enable-static=no
 make
 make install
 cd samples

Reply via email to