From 9b638e7c053f9ab8917ee047dffedfcdca5bbe29 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 3 Jul 2018 22:55:59 +0800 Subject: [PATCH] apps/netbiosns: Convert to use lwip_isupper instead of open-coded Also remove additonal (cname == '\0' || cname == '.') check because it's covered by !lwip_isupper(cname) test. Signed-off-by: Axel Lin --- src/apps/netbiosns/netbiosns.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/apps/netbiosns/netbiosns.c b/src/apps/netbiosns/netbiosns.c index e1dd3157..beaf8a7c 100644 --- a/src/apps/netbiosns/netbiosns.c +++ b/src/apps/netbiosns/netbiosns.c @@ -245,7 +245,7 @@ netbiosns_name_decode(char *name_enc, char *name_dec, int name_dec_len) if (cname == '.') { break; /* scope ID follows */ } - if (cname < 'A' || cname > 'Z') { + if (!lwip_isupper(cname)) { /* Not legal. */ return -1; } @@ -254,12 +254,7 @@ netbiosns_name_decode(char *name_enc, char *name_dec, int name_dec_len) pname++; cname = *pname; - if (cname == '\0' || cname == '.') { - /* No more characters in the name - but we're in - * the middle of a pair. Not legal. */ - return -1; - } - if (cname < 'A' || cname > 'Z') { + if (!lwip_isupper(cname)) { /* Not legal. */ return -1; }