axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r446533 - in /webservices/axis2/trunk/c/util: include/axis2_stream.h src/file_diff.c src/stream.c
Date Fri, 15 Sep 2006 06:58:50 GMT
Author: samisa
Date: Thu Sep 14 23:58:50 2006
New Revision: 446533

URL: http://svn.apache.org/viewvc?view=rev&rev=446533
Log:
Removed unwanted api calls unget get_type and get_char

Modified:
    webservices/axis2/trunk/c/util/include/axis2_stream.h
    webservices/axis2/trunk/c/util/src/file_diff.c
    webservices/axis2/trunk/c/util/src/stream.c

Modified: webservices/axis2/trunk/c/util/include/axis2_stream.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_stream.h?view=diff&rev=446533&r1=446532&r2=446533
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_stream.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_stream.h Thu Sep 14 23:58:50 2006
@@ -107,26 +107,6 @@
          int count);
                   
    /**
-    * Reads  the next character from stream and returns it as an unsigned char 
-    * cast to an int, or EOF on end of file or error.
-    * @return next character in the stream
-    */
-   int (AXIS2_CALL *
-   get_char) (axis2_stream_t *stream, 
-              const axis2_env_t *env);
-   
-   /**
-    * Pushes a character back to stream, cast to unsigned char, where it is 
-    * available for subsequent read operations
-    * @param charachter to be pushed
-    * @return the pushed character or EOF if an error
-    */
-   int (AXIS2_CALL *
-   unget_char) (axis2_stream_t *stream, 
-             const axis2_env_t *env, 
-             int ch);
-
-   /**
     * Returns the length of the stream (applicable only to basic stream)
     * @return Length of the buffer if its type is basic, else -1
     * (we can't define a length of a stream unless it is just a buffer)
@@ -134,15 +114,6 @@
    int (AXIS2_CALL *
    get_len) (axis2_stream_t *stream, 
              const axis2_env_t *env);
-   
-   /**
-    * Returns the type of the stream as axis2_stream_type_t
-    * @return Type of the stream
-    */
-   axis2_stream_type_t (AXIS2_CALL *
-   get_type) (axis2_stream_t *stream, 
-            const axis2_env_t *env); 
-   
 };
 
 /** 
@@ -200,17 +171,9 @@
 #define AXIS2_STREAM_SKIP(stream, env, count) \
       ((stream)->ops->write(stream, env, count))
       
-#define AXIS2_STREAM_GET_CHAR(stream, env) \
-      ((stream)->ops->get_char(stream, env))
-      
-#define AXIS2_STREAM_UNGET_CHAR(stream, env, ch) \
-      ((stream)->ops->unget_char(stream, env, ch))
-
 #define AXIS2_STREAM_BASIC_GET_LEN(stream, env) \
       ((stream)->ops->get_len(stream, env))
       
-#define AXIS2_STREAM_GET_TYPE(stream, env)\
-        ((stream)->ops->get_type(stream, env))
 /** @} */
     
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/util/src/file_diff.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/file_diff.c?view=diff&rev=446533&r1=446532&r2=446533
==============================================================================
--- webservices/axis2/trunk/c/util/src/file_diff.c (original)
+++ webservices/axis2/trunk/c/util/src/file_diff.c Thu Sep 14 23:58:50 2006
@@ -76,7 +76,10 @@
             flag1 = 0;
             flag2 = 0;
         }
-            
+        
+        /*
+        unget_char is removed from stream, find alternatived to implement this logic.
+        (best is to use peek)
         if(flag1 == 1 && flag2 == 0)
         {
             AXIS2_STREAM_UNGET_CHAR(actual_file_stream, env, ch2);
@@ -89,6 +92,7 @@
             k++;
             buffer2[k] = ch2;
         }
+        */
         if(flag1 == 0 && flag2 == 0)
         {
             if(ch1 != ch2)

Modified: webservices/axis2/trunk/c/util/src/stream.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/stream.c?view=diff&rev=446533&r1=446532&r2=446533
==============================================================================
--- webservices/axis2/trunk/c/util/src/stream.c (original)
+++ webservices/axis2/trunk/c/util/src/stream.c Thu Sep 14 23:58:50 2006
@@ -48,9 +48,6 @@
 axis2_stream_free_void_arg (void *stream,
                             const axis2_env_t *env);
 
-axis2_stream_type_t AXIS2_CALL 
-axis2_stream_get_type (axis2_stream_t *stream, const axis2_env_t *env);
-
 /** basic stream operatons **/
 int AXIS2_CALL
 axis2_stream_write_basic(axis2_stream_t *stream, const axis2_env_t *env, 
@@ -64,13 +61,6 @@
 int AXIS2_CALL 
 axis2_stream_skip_basic (axis2_stream_t *stream, const axis2_env_t *env, int count);
 
-int AXIS2_CALL 
-axis2_stream_get_char_basic (axis2_stream_t *stream, const axis2_env_t *env);
-
-int AXIS2_CALL 
-axis2_stream_unget_char_basic (axis2_stream_t *stream, const axis2_env_t *env, 
-                  int ch);
-
 /** file stream operations **/
 int AXIS2_CALL
 axis2_stream_write_file(axis2_stream_t *stream, const axis2_env_t *env, 
@@ -84,12 +74,6 @@
 int AXIS2_CALL 
 axis2_stream_skip_file (axis2_stream_t *stream, const axis2_env_t *env, int count);
 
-int AXIS2_CALL 
-axis2_stream_get_char_file (axis2_stream_t *stream, const axis2_env_t *env);
-
-int AXIS2_CALL 
-axis2_stream_unget_char_file (axis2_stream_t *stream, const axis2_env_t *env, 
-                  int ch);
 /** socket stream operations **/
 int AXIS2_CALL
 axis2_stream_write_socket(axis2_stream_t *stream, const axis2_env_t *env, 
@@ -103,12 +87,6 @@
 int AXIS2_CALL 
 axis2_stream_skip_socket (axis2_stream_t *stream, const axis2_env_t *env, int count);
 
-int AXIS2_CALL 
-axis2_stream_get_char_socket (axis2_stream_t *stream, const axis2_env_t *env);
-
-int AXIS2_CALL 
-axis2_stream_unget_char_socket (axis2_stream_t *stream, const axis2_env_t *env, 
-                     int ch);
 /************************* End of function headers ****************************/
 /*
  * Internal function. Not exposed to outside
@@ -141,7 +119,6 @@
     stream_impl->stream.axis2_eof = EOF;
    
    stream_impl->stream.ops->free_fn = axis2_stream_free;
-    stream_impl->stream.ops->get_type = axis2_stream_get_type;
    stream_impl->stream.ops->free_void_arg = axis2_stream_free_void_arg; 
    return &(stream_impl->stream);
 }
@@ -206,13 +183,6 @@
     return axis2_stream_free(stream_l, env);
 }
 
-axis2_stream_type_t AXIS2_CALL 
-axis2_stream_get_type (axis2_stream_t *stream, const axis2_env_t *env)
-{
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   return AXIS2_INTF_TO_IMPL(stream)->stream_type;
-}
-
 /************************ Basic Stream Operations *****************************/
 AXIS2_EXTERN axis2_stream_t * AXIS2_CALL
 axis2_stream_create_basic (const axis2_env_t *env)
@@ -236,8 +206,6 @@
    stream_impl->stream.ops->write = axis2_stream_write_basic;
    stream_impl->stream.ops->get_len = axis2_stream_get_len_basic;
    stream_impl->stream.ops->skip = axis2_stream_skip_basic;
-   stream_impl->stream.ops->get_char = axis2_stream_get_char_basic;
-   stream_impl->stream.ops->unget_char = axis2_stream_unget_char_basic;
    stream_impl->buffer = (axis2_char_t*)AXIS2_MALLOC(env->allocator, 
                   AXIS2_STREAM_DEFAULT_BUF_SIZE*sizeof(axis2_char_t));
    stream_impl->len = 0;
@@ -364,60 +332,7 @@
    return -1;
 }
 
-int AXIS2_CALL 
-axis2_stream_get_char_basic (axis2_stream_t *stream, const axis2_env_t *env)
-{
-   axis2_char_t *buf = NULL;
-   int ret = -1;
-   
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   buf = AXIS2_INTF_TO_IMPL(stream)->buffer;
-   if(AXIS2_INTF_TO_IMPL(stream)->len <= 0)
-   {
-      return -1;
-   }
-   ret = buf[0];
-   AXIS2_INTF_TO_IMPL(stream)->len--;
-   memmove(buf, buf + sizeof(axis2_char_t), 
-                  AXIS2_INTF_TO_IMPL(stream)->len * sizeof(axis2_char_t));
-   return ret;
-}
 
-int AXIS2_CALL 
-axis2_stream_unget_char_basic (axis2_stream_t *stream, const axis2_env_t *env, 
-                  int ch)
-{
-   axis2_stream_impl_t *stream_impl = NULL;
-   int new_len = 0;
-   axis2_char_t *tmp = NULL;
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   
-   stream_impl = AXIS2_INTF_TO_IMPL(stream);
-   new_len = stream_impl->len + 1;
-   if(new_len > stream_impl->max_len)
-   {
-      tmp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
-                  sizeof(axis2_char_t)*(new_len + 
-                  AXIS2_STREAM_DEFAULT_BUF_SIZE));
-      if(NULL == tmp)
-      {
-         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
-                  AXIS2_FAILURE);
-         return -1;
-      }
-      /* 
-       * pre allocation: extra AXIS2_STREAM_DEFAULT_BUF_SIZE more bytes 
-       * allocated 
-       */
-      stream_impl->max_len = new_len + AXIS2_STREAM_DEFAULT_BUF_SIZE;
-      memcpy(tmp + 1, stream_impl->buffer, 
-                  sizeof(axis2_char_t)*stream_impl->len);
-      AXIS2_FREE(env->allocator, stream_impl->buffer);
-      stream_impl->buffer = tmp;
-   }
-   tmp[0] = ch;
-    return ch;
-}
 /********************* End of Basic Stream Operations *************************/
 
 /************************** File Stream Operations ****************************/
@@ -445,8 +360,6 @@
    stream_impl->stream.ops->write = axis2_stream_write_file;
    stream_impl->stream.ops->get_len = axis2_stream_get_len_file;
    stream_impl->stream.ops->skip = axis2_stream_skip_file;
-   stream_impl->stream.ops->get_char = axis2_stream_get_char_file;
-   stream_impl->stream.ops->unget_char = axis2_stream_unget_char_file;
    
    return def_stream;
 }
@@ -519,30 +432,6 @@
    return count - i;
 }
 
-int AXIS2_CALL 
-axis2_stream_get_char_file (axis2_stream_t *stream, const axis2_env_t *env)
-{
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   if(NULL == AXIS2_INTF_TO_IMPL(stream)->fp)
-   {
-      AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
-      return -1;
-   }
-   return fgetc(AXIS2_INTF_TO_IMPL(stream)->fp);
-}
-
-int AXIS2_CALL 
-axis2_stream_unget_char_file (axis2_stream_t *stream, const axis2_env_t *env, 
-                  int ch)
-{
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   if(NULL == AXIS2_INTF_TO_IMPL(stream)->fp)
-   {
-      AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
-      return -1;
-   }
-   return ungetc(ch, AXIS2_INTF_TO_IMPL(stream)->fp);
-}
 /********************** End of File Stream Operations *************************/
 
 /************************** Socket Stream Operations **************************/
@@ -568,8 +457,6 @@
    stream_impl->stream.ops->write = axis2_stream_write_socket;
    stream_impl->stream.ops->get_len = axis2_stream_get_len_socket;
    stream_impl->stream.ops->skip = axis2_stream_skip_socket;
-   stream_impl->stream.ops->get_char = axis2_stream_get_char_socket;
-   stream_impl->stream.ops->unget_char = axis2_stream_unget_char_socket;
    
    stream_impl->stream_type = AXIS2_STREAM_SOCKET;
    stream_impl->socket = socket;
@@ -689,30 +576,4 @@
    return len;
 }
 
-int AXIS2_CALL 
-axis2_stream_get_char_socket (axis2_stream_t *stream, const axis2_env_t *env)
-{
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   if(-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
-   {
-      AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, 
-                  AXIS2_FAILURE);
-      return -1;
-   }
-   return -1;
-}
-
-int AXIS2_CALL 
-axis2_stream_unget_char_socket (axis2_stream_t *stream, const axis2_env_t *env, 
-                  int ch)
-{
-   AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
-   if(-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
-   {
-      AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, 
-                  AXIS2_FAILURE);
-      return -1;
-   }
-   return -1;
-}
 /********************** End of Socket Stream Operations ***********************/



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message