Author: cazfi
Date: Sat Jan 24 11:06:56 2015
New Revision: 27790

URL: http://svn.gna.org/viewcvs/freeciv?rev=27790&view=rev
Log:
Detect ending of last line correctly in create_new_line_utf8strs()

See patch #5725

Modified:
    trunk/client/gui-sdl2/utf8string.c

Modified: trunk/client/gui-sdl2/utf8string.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/utf8string.c?rev=27790&r1=27789&r2=27790&view=diff
==============================================================================
--- trunk/client/gui-sdl2/utf8string.c  (original)
+++ trunk/client/gui-sdl2/utf8string.c  Sat Jan 24 11:06:56 2015
@@ -54,7 +54,7 @@
 }
 
 /**************************************************************************
-  Don't free return array, only arrays members. This is not re-entrant.
+  Don't free return array, only array's members. This is not re-entrant.
 **************************************************************************/
 char **create_new_line_utf8strs(const char *pstr)
 {
@@ -63,7 +63,7 @@
   size_t len = 0, count = 0;
 
   while (*start != '\0') {
-    if (*pstr == '\n') { /* find a new line char */
+    if (*pstr == '\n' || *pstr == '\0') { /* find a new line char */
       if (len) {
         buf[count] = fc_calloc(len + 1, 1);
         memcpy(buf[count], start, len);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to