project_files/hwc/rtl/misc.h
changeset 14180 0aeea29ef890
parent 10131 4b4a043111f4
child 15376 5c0479d0ed5b
--- a/project_files/hwc/rtl/misc.h	Wed Nov 07 17:45:20 2018 +0100
+++ b/project_files/hwc/rtl/misc.h	Wed Nov 07 19:43:17 2018 +0100
@@ -20,7 +20,8 @@
 
 //#define     FPCRTL_DEBUG
 
-#define     FIX_STRING(s)                           (s.str[s.len == 255 ? 254 : s.len] = 0)
+#define     FIX_STRING(s)                           do { s.str[s.len == 255 ? 254 : s.len] = 0; } while (0)
+#define     FIX_STRINGA(s)                          do { s.str[s.len == MAX_ANSISTRING_LENGTH ? MAX_ANSISTRING_LENGTH - 1 : s.len] = 0; } while (0)
 //#define fpcrtl_check_string(s)     do{ if(strlen((s).str) != (s).len){ \
 //                                        printf("String %s internal inconsistency error. Length should be %d but actually is %d.\n", (s).str, strlen((s).str), (s).len); \
 //                                        assert(0);\