make UA_readNumber an internal function

This commit is contained in:
Julius Pfrommer
2017-02-08 20:18:47 +01:00
parent 8cd826c478
commit c256b78abc
4 changed files with 13 additions and 10 deletions
-6
View File
@@ -125,12 +125,6 @@ UA_StatusCode UA_EXPORT
UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
UA_UInt16 * port, const char ** path);
/* Convert given byte string to a positive number. Returns the number of valid
* digits. Stops if a non-digit char is found and returns the number of digits
* up to that point. */
size_t UA_EXPORT
UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number);
#ifdef __cplusplus
} // extern "C"
#endif
+3 -3
View File
@@ -313,14 +313,14 @@ UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
}
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
if (!buf)
return 0;
UA_assert(buf);
UA_assert(number);
UA_UInt32 n = 0;
size_t progress = 0;
/* read numbers until the end or a non-number character appears */
while(progress < buflen) {
UA_Byte c = buf[progress];
if('0' > c || '9' < c)
if(c < '0' || c > '9')
break;
n = (n*10) + (UA_UInt32)(c-'0');
++progress;
+9 -1
View File
@@ -5,7 +5,7 @@
#ifndef UA_UTIL_H_
#define UA_UTIL_H_
#include "ua_config.h"
#include "ua_types.h"
#ifdef __cplusplus
extern "C" {
@@ -106,6 +106,14 @@ UA_atomic_add(volatile uint32_t *addr, uint32_t increase) {
#endif
}
/* Utility Functions
* ----------------- */
/* Convert given byte string to a positive number. Returns the number of valid
* digits. Stops if a non-digit char is found and returns the number of digits
* up to that point. */
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number);
#ifdef __cplusplus
} // extern "C"
#endif
+1
View File
@@ -6,6 +6,7 @@
#include "ua_types.h"
#include "ua_client.h"
#include "ua_util.h"
#include "check.h"
START_TEST(EndpointUrl_split) {