From 8dc12fcd98d2957904bc9b215775328b7d5c0202 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 17 Jun 2009 23:22:48 +0000 Subject: [PATCH] Corrected a minor issue in the bacapp.c file on the PC side when printing strings with garbage characters with the 8th bit set. The code passed a signed char to the isprint() function which gets sign extended to an int and then caused an assert in the Microsoft library code (Visual C++ Express 2008). Thank you, Peter! --- bacnet-stack/src/bacapp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bacnet-stack/src/bacapp.c b/bacnet-stack/src/bacapp.c index 9b6ce5ad..227e97e2 100644 --- a/bacnet-stack/src/bacapp.c +++ b/bacnet-stack/src/bacapp.c @@ -744,10 +744,11 @@ bool bacapp_print_value( characterstring_value(&value->type.Character_String); fprintf(stream, "\""); for (i = 0; i < len; i++) { - if (isprint(*char_str)) + if (isprint(*((unsigned char *)char_str))) { fprintf(stream, "%c", *char_str); - else + } else { fprintf(stream, "."); + } char_str++; } fprintf(stream, "\"");