Author: mturk Date: Fri Jan 15 18:56:38 2010 New Revision: 899753 URL: http://svn.apache.org/viewvc?rev=899753&view=rev Log: Add a flush to the sbuf so we can inspect the content without finishing
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_sbuf.h commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_sbuf.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_sbuf.h?rev=899753&r1=899752&r2=899753&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/include/acr_sbuf.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/include/acr_sbuf.h Fri Jan 15 18:56:38 2010 @@ -103,6 +103,7 @@ char *acr_sbuf_trim(acr_sbuf_t *); int acr_sbuf_overflowed(acr_sbuf_t *); void acr_sbuf_finish(acr_sbuf_t *); +void acr_sbuf_flush(acr_sbuf_t *); char *acr_sbuf_data(acr_sbuf_t *); size_t acr_sbuf_len(acr_sbuf_t *); int acr_sbuf_done(acr_sbuf_t *); @@ -125,6 +126,7 @@ wchar_t *acr_wbuf_trim(acr_wbuf_t *); int acr_wbuf_overflowed(acr_wbuf_t *); void acr_wbuf_finish(acr_wbuf_t *); +void acr_wbuf_flush(acr_wbuf_t *); wchar_t *acr_wbuf_data(acr_wbuf_t *); size_t acr_wbuf_len(acr_wbuf_t *); int acr_wbuf_done(acr_wbuf_t *); Modified: commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c?rev=899753&r1=899752&r2=899753&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c Fri Jan 15 18:56:38 2010 @@ -460,6 +460,17 @@ } /* + * Flush off an sbuf by terminating it with zero + */ +void +acr_sbuf_flush(acr_sbuf_t *s) +{ + if (s->s_buf) { + s->s_buf[s->s_len] = '\0'; + } +} + +/* * Return a pointer to the sbuf data. */ char * @@ -819,6 +830,14 @@ SBUF_SETFLAG(s, ACR_SBUF_FINISHED); } +void +acr_wbuf_flush(acr_wbuf_t *s) +{ + if (s->s_buf) { + s->s_buf[s->s_len] = L'\0'; + } +} + /* * Return a pointer to the sbuf data. */