File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -141,14 +141,14 @@ GglError ggl_str_to_int64(GglBuffer str, int64_t value[static 1]) {
141141
142142static GglError buf_write (void * ctx , GglBuffer buf ) {
143143 GglBuffer * target = ctx ;
144+ GglBuffer target_copy = * target ;
144145
145- GglError ret = ggl_buf_copy (buf , target );
146+ GglError ret = ggl_buf_copy (buf , & target_copy );
146147 if (ret != GGL_ERR_OK ) {
147148 return ret ;
148149 }
149150
150151 * target = ggl_buffer_substr (* target , buf .len , SIZE_MAX );
151-
152152 return GGL_ERR_OK ;
153153}
154154
@@ -159,13 +159,15 @@ GglWriter ggl_buf_writer(GglBuffer *buf) {
159159GglError ggl_buf_copy (GglBuffer source , GglBuffer * target ) {
160160 if (source .len == 0 ) {
161161 target -> len = 0 ;
162- GGL_LOGD ("Source has zero length buffer" );
162+ GGL_LOGT ("Source has zero length buffer" );
163163 return GGL_ERR_OK ;
164164 }
165165 if (target -> len < source .len ) {
166166 GGL_LOGT ("Failed to copy buffer due to insufficient space." );
167167 return GGL_ERR_NOMEM ;
168168 }
169169 memcpy (target -> data , source .data , source .len );
170+ target -> len = source .len ;
171+
170172 return GGL_ERR_OK ;
171173}
You can’t perform that action at this time.
0 commit comments