From 10d639464118d562338f15a414aafa62f31929b4 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 10 Sep 2006 18:53:03 +0000 Subject: [PATCH] use tmp buffer to avoid copying one byte at a time. --- common/memstream.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/common/memstream.c b/common/memstream.c index 7f93195cb..7b87eed52 100644 --- a/common/memstream.c +++ b/common/memstream.c @@ -285,9 +285,15 @@ static void mem_stream_copyFromStream( XWStreamCtxt* p_sctx, XWStreamCtxt* src, XP_U16 nBytes ) { - while ( nBytes-- ) { - XP_U8 byt = stream_getU8( src ); - stream_putU8( p_sctx, byt ); + while ( nBytes > 0 ) { + XP_U8 buf[256]; + XP_U16 len = sizeof(buf); + if ( nBytes < len ) { + len = nBytes; + } + stream_getBytes( src, buf, len ); + stream_putBytes( p_sctx, buf, len ); + nBytes -= len; } } /* mem_stream_copyFromStream */