]> git.gag.com Git - fw/sdcc/commitdiff
* support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(),
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 17 May 2006 16:23:27 +0000 (16:23 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 17 May 2006 16:23:27 +0000 (16:23 +0000)
  thanks Stas Sergeev

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4176 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
support/Util/dbuf.c

index 6608f8000663c7501e7d402e1eddb91277e8f0a8..35c6bea1dd562c971a8e8ba8aaf7b8c97a2cb63e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-17 Borut Razem <borut.razem AT siol.net>
+
+       * support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(),
+         thanks Stas Sergeev
+
 2006-05-15 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/include/mcs51/P89c51RD2.h,
        * 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 <borut.razem AT siol.net>
+
+       * *.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 <sourceforge.brock AT dse.nl>
 
        * doc/sdccman.lyx: documented numeric ranges, WEBDOC #1442369
index 68966f763ae746a392bceb6e9877783c5c43143e..da52a61e2370d2184d447fd9910acd4424ee9ba1 100644 (file)
@@ -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';
   }