X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fnmeap%2Fsrc%2Fnmeap01.c;h=e09edc96f25b456bdf1ab754b9155c4eb16b4b9b;hb=9a5ad349a1f6b952ae68f25d8a1d62b7c2633cff;hp=d0e0fcd2ce83b92b50ad3b4de940dcc69ac70c15;hpb=f5c12c6b439cfed37fe916322c430e47bab0b5af;p=bertos.git diff --git a/bertos/net/nmeap/src/nmeap01.c b/bertos/net/nmeap/src/nmeap01.c index d0e0fcd2..e09edc96 100644 --- a/bertos/net/nmeap/src/nmeap01.c +++ b/bertos/net/nmeap/src/nmeap01.c @@ -26,29 +26,27 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * see the file COPYING for terms of the licnese */ -#include +#include #include -#include +#include #include #include "../inc/nmeap.h" +#include + #define assert(x) ASSERT(x) -/* - * Removed to compile in BeRTOS environment. - * - * #include - * #include - * #include - * #include - * #include - * #include - * - * #include "nmeap.h" - * - */ +#include "cfg/cfg_nmea.h" + +#define LOG_LEVEL NMEA_LOG_LEVEL +#define LOG_FORMAT NMEA_LOG_FORMAT +#include +#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);