Silence new compiler warnings.
[bertos.git] / bertos / net / nmeap / src / nmeap01.c
index d0e0fcd2ce83b92b50ad3b4de940dcc69ac70c15..e09edc96f25b456bdf1ab754b9155c4eb16b4b9b 100644 (file)
@@ -26,29 +26,27 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * see the file COPYING for terms of the licnese
 */
 
-#include <string.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <cfg/debug.h>
+#include <string.h>
 #include <ctype.h>
 
 #include "../inc/nmeap.h"
 
+#include <cfg/debug.h>
+
 #define assert(x)    ASSERT(x)
 
-/*
- * Removed to compile in BeRTOS environment.
- *
- * #include <stdio.h>
- * #include <stdlib.h>
- * #include <string.h>
- * #include <cfg/debug.h>
- * #include <assert.h>
- * #include <ctype.h>
- *
- * #include "nmeap.h"
- *
- */
+#include "cfg/cfg_nmea.h"
+
+#define LOG_LEVEL  NMEA_LOG_LEVEL
+#define LOG_FORMAT NMEA_LOG_FORMAT
+#include <cfg/log.h>
 
+#ifdef _DEBUG
+       #undef NDEBUG
+       #define printf(str,...)  LOG_INFO(str, ## __VA_ARGS__)
+#endif
 
 /* this only works if you are sure you have an upper case hex digit */
 #define HEXTOBIN(ch) ((ch <= '9') ? ch - '0' : ch - ('A' - 10))
@@ -297,7 +295,7 @@ int nmeap_tokenize(nmeap_context_t *context)
  */
 int nmeap_process(nmeap_context_t *context)
 {
-    int id;
+    int id = 0;
     int i;
     nmeap_sentence_t *s;
 
@@ -391,7 +389,7 @@ int nmeap_parse(nmeap_context_t *context,char ch)
     case 1:
         /* allow numbers even though it isn't usually done */
         /* a proprietary id might have a numeral */
-        if (isalnum(ch)) {
+        if (isalnum((unsigned char)ch)) {
             /* store name separately */
             context->input_name[context->input_count - 2] = ch;
             /* checksum */
@@ -430,7 +428,7 @@ int nmeap_parse(nmeap_context_t *context,char ch)
     /* LOOKING FOR FIRST CHECKSUM CHARACTER */
     case 3:
         /* must be upper case hex digit */
-        if (isxdigit(ch) && (ch <= 'F')) {
+        if (isxdigit((unsigned char)ch) && (ch <= 'F')) {
             /* got first checksum byte */
             context->input_state = 4;
             context->icks = HEXTOBIN(ch) << 4;
@@ -445,7 +443,7 @@ int nmeap_parse(nmeap_context_t *context,char ch)
         /* LOOKING FOR SECOND CHECKSUM CHARACTER */
     case 4:
         /* must be upper case hex digit */
-        if (isxdigit(ch) && (ch <= 'F')) {
+        if (isxdigit((unsigned char)ch) && (ch <= 'F')) {
             /* got second checksum byte */
             context->input_state = 5;
             context->icks += HEXTOBIN(ch);