summaryrefslogtreecommitdiff
path: root/scan.h
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2020-04-01 17:10:26 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2020-04-01 17:10:26 +0000
commita9b2cc59aa34b13337de20824cebafa57c7e9e2e (patch)
tree5e137c8b081ed0d72b44c8482169b6789519074b /scan.h
parent7208ff99c20dcd8633c572ec2ac899b010a30703 (diff)
downloadlibowfat-master.tar.gz
libowfat-master.zip
support gcc 10's access attribute when compiling with dietlibcHEADmaster
Diffstat (limited to 'scan.h')
-rw-r--r--scan.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/scan.h b/scan.h
index bcd4365..2458bfb 100644
--- a/scan.h
+++ b/scan.h
@@ -15,10 +15,16 @@
extern "C" {
#endif
+/* dietlibc defines these in sys/cdefs.h, which is included from stddef.h */
#ifndef __pure__
#define __pure__
#endif
+#ifndef __writememsz__
+#define __writememsz__(a,b)
+#define __readmemsz__(a,b)
+#endif
+
/* This file declared functions used to decode / scan / unmarshal
* integer or string values from a buffer.
* The first argument is always the source buffer, the second argument
@@ -39,24 +45,28 @@ extern "C" {
* values, i.e. on a 32-bit system:
* scan_ulong("4294967296",&i" -> i=429496729, return 9 */
size_t scan_ulong(const char *src,unsigned long *dest);
+__readmemsz__(1,2)
size_t scan_ulongn(const char* src,size_t n,unsigned long* dest);
/* Interpret src as ASCII hexadecimal number, write number to dest and
* return the number of bytes that were parsed.
* Note: leading '+' or '-' not accepted! */
size_t scan_xlong(const char *src,unsigned long *dest);
+__readmemsz__(1,2)
size_t scan_xlongn(const char *src,size_t n,unsigned long *dest);
/* interpret src as ASCII octal number, write number to dest and
* return the number of bytes that were parsed.
* Note: leading '+' or '-' not accepted! */
size_t scan_8long(const char *src,unsigned long *dest);
+__readmemsz__(1,2)
size_t scan_8longn(const char *src,size_t n,unsigned long *dest);
/* interpret src as signed ASCII decimal number, write number to dest
* and return the number of bytes that were parsed.
* Note: leading spaces not accepted! */
size_t scan_long(const char *src,signed long *dest);
+__readmemsz__(1,2)
size_t scan_longn(const char *src,size_t n,signed long *dest);
size_t scan_longlong(const char *src,signed long long *dest);
@@ -84,17 +94,21 @@ size_t scan_double(const char *in, double *dest);
size_t scan_plusminus(const char *src,signed int *dest);
/* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */
+__readmemsz__(1,2)
size_t scan_whitenskip(const char *in,size_t limit) __pure__;
/* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */
+__readmemsz__(1,2)
size_t scan_nonwhitenskip(const char *in,size_t limit) __pure__;
/* return the highest integer n<=limit so that in[i] is element of
* charset (ASCIIZ string) for all 0<=i<=n */
+__readmemsz__(1,3)
size_t scan_charsetnskip(const char *in,const char *charset,size_t limit) __pure__;
/* return the highest integer n<=limit so that in[i] is not element of
* charset (ASCIIZ string) for all 0<=i<=n */
+__readmemsz__(1,3)
size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __pure__;
/* try to parse ASCII GMT date; does not understand time zones. */
@@ -153,6 +167,7 @@ size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __pure__;
* return 0
* Note: *dest will point inside the input buffer!
*/
+__readmemsz__(1,2)
size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) __pure__;
/* internal function that might be useful independently */