From 41bbe30c698854444f151d7c87b4c54e6400bd1b Mon Sep 17 00:00:00 2001 From: borutr Date: Wed, 17 May 2006 16:23:27 +0000 Subject: [PATCH] * support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(), thanks Stas Sergeev git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4176 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 11 +++++++++++ support/Util/dbuf.c | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6608f800..35c6bea1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-17 Borut Razem + + * support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(), + thanks Stas Sergeev + 2006-05-15 Maarten Brock * device/include/mcs51/P89c51RD2.h, @@ -27,6 +32,12 @@ * src/z80/gen.c (aopop): fix for bug #1479882; use new, exclusive asmop if size of operand is smaller than spill location +2006-05-12 Borut Razem + + * *.dsw, *.dsp: changed property svn:eol-style to CRLF since they + have to have CR/LF line endings even if they are checked out on *nix + or on WIN32 in cygwin binmode + 2006-05-12 Maarten Brock * doc/sdccman.lyx: documented numeric ranges, WEBDOC #1442369 diff --git a/support/Util/dbuf.c b/support/Util/dbuf.c index 68966f76..da52a61e 100644 --- a/support/Util/dbuf.c +++ b/support/Util/dbuf.c @@ -1,8 +1,8 @@ /* dbuf.c - Dynamic buffer implementation - version 1.1.1, April 11th, 2003 + version 1.1.2, May 17th, 2006 - Copyright (c) 2002-2003 Borut Razem + Copyright (c) 2002-2006 Borut Razem This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -146,7 +146,8 @@ const char *dbuf_c_str(struct dbuf_s *dbuf) assert(dbuf->buf != NULL); /* only if not already null terminated */ - if (((char *)dbuf->buf)[dbuf->len] != '\0') { + if (dbuf->len == dbuf->alloc || + ((char *)dbuf->buf)[dbuf->len] != '\0') { dbuf_expand(dbuf, 1); ((char *)dbuf->buf)[dbuf->len] = '\0'; } -- 2.30.2