diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-25 15:52:18 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-25 15:52:18 +0000 |
commit | 00c9cb1b22cc17c4db573e0e613a5f116ff0092e (patch) | |
tree | 53178b2c52c6e97c6193f73378f3c5e5a781a914 /src/include | |
parent | 2746b131aa482ac17c94bc6b82e58dbcc1b752cf (diff) | |
download | skalibs-00c9cb1b22cc17c4db573e0e613a5f116ff0092e.tar.xz |
More work on the types. This commit builds but has errors.
Rework src/headers entirely: build skalibs/types.h
Convert skalibs/fmtscan.h types.
Propagate changes until it builds.
There are a lot of incompatible pointer issues remaining, those will be fixed with the buffer overhaul.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/skalibs/djbtime.h | 50 | ||||
-rw-r--r-- | src/include/skalibs/fmtscan.h | 44 | ||||
-rw-r--r-- | src/include/skalibs/netstring.h | 17 | ||||
-rw-r--r-- | src/include/skalibs/stddjb.h | 5 |
4 files changed, 53 insertions, 63 deletions
diff --git a/src/include/skalibs/djbtime.h b/src/include/skalibs/djbtime.h index 229966f..07ad662 100644 --- a/src/include/skalibs/djbtime.h +++ b/src/include/skalibs/djbtime.h @@ -3,8 +3,8 @@ #ifndef DJBTIME_H #define DJBTIME_H +#include <sys/types.h> #include <time.h> -#include <skalibs/config.h> #include <skalibs/uint32.h> #include <skalibs/uint64.h> #include <skalibs/tai.h> @@ -13,18 +13,18 @@ /* UTC <--> TAI conversions */ /* sysclock can be either TAI-10 or UTC */ -extern int utc_from_tai (uint64 *, tai_t const *) ; -extern int tai_from_utc (tai_t *, uint64) ; -extern int utc_from_sysclock (uint64 *) ; -extern int sysclock_from_utc (uint64 *) ; +extern int utc_from_tai (uint64_t *, tai_t const *) ; +extern int tai_from_utc (tai_t *, uint64_t) ; +extern int utc_from_sysclock (uint64_t *) ; +extern int sysclock_from_utc (uint64_t *) ; /* NTP internal format */ #define NTP_OFFSET 2208988800UL -extern int ntp_from_tain (uint64 *, tain_t const *) ; +extern int ntp_from_tain (uint64_t *, tain_t const *) ; #define ntp_from_tain_g(u) ntp_from_tain((u), &STAMP) -extern int tain_from_ntp (tain_t *, uint64) ; +extern int tain_from_ntp (tain_t *, uint64_t) ; /* localtime handling - replaces caltimedate functions */ @@ -36,22 +36,22 @@ typedef struct localtmn_s localtmn_t, *localtmn_t_ref ; struct localtmn_s { struct tm tm ; - uint32 nano ; + uint32_t nano ; } ; -extern int ltm64_from_tai (uint64 *, tai_t const *) ; -extern int tai_from_ltm64 (tai_t *, uint64) ; -extern int ltm64_from_utc (uint64 *) ; -extern int utc_from_ltm64 (uint64 *) ; -extern int ltm64_from_sysclock (uint64 *) ; -extern int sysclock_from_ltm64 (uint64 *) ; - -extern int localtm_from_ltm64 (struct tm *, uint64, int) ; -extern int ltm64_from_localtm (uint64 *, struct tm const *) ; -extern int localtm_from_sysclock (struct tm *, uint64, int) ; -extern int sysclock_from_localtm (uint64 *, struct tm const *) ; -extern int localtm_from_utc (struct tm *, uint64, int) ; -extern int utc_from_localtm (uint64 *, struct tm const *) ; +extern int ltm64_from_tai (uint64_t *, tai_t const *) ; +extern int tai_from_ltm64 (tai_t *, uint64_t) ; +extern int ltm64_from_utc (uint64_t *) ; +extern int utc_from_ltm64 (uint64_t *) ; +extern int ltm64_from_sysclock (uint64_t *) ; +extern int sysclock_from_ltm64 (uint64_t *) ; + +extern int localtm_from_ltm64 (struct tm *, uint64_t, int) ; +extern int ltm64_from_localtm (uint64_t *, struct tm const *) ; +extern int localtm_from_sysclock (struct tm *, uint64_t, int) ; +extern int sysclock_from_localtm (uint64_t *, struct tm const *) ; +extern int localtm_from_utc (struct tm *, uint64_t, int) ; +extern int utc_from_localtm (uint64_t *, struct tm const *) ; extern int localtm_from_tai (struct tm *, tai_t const *, int) ; extern int tai_from_localtm (tai_t *, struct tm const *) ; @@ -62,11 +62,11 @@ extern int localtmn_from_sysclock (localtmn_t *, tain_t const *, int) ; extern int sysclock_from_localtmn (tain_t *, localtmn_t const *) ; #define LOCALTM_FMT 21 -extern unsigned int localtm_fmt (char *, struct tm const *) ; -extern unsigned int localtm_scan (char const *, struct tm *) ; +extern size_t localtm_fmt (char *, struct tm const *) ; +extern size_t localtm_scan (char const *, struct tm *) ; #define LOCALTMN_FMT 31 -extern unsigned int localtmn_fmt (char *, localtmn_t const *) ; -extern unsigned int localtmn_scan (char const *, localtmn_t *) ; +extern size_t localtmn_fmt (char *, localtmn_t const *) ; +extern size_t localtmn_scan (char const *, localtmn_t *) ; #endif diff --git a/src/include/skalibs/fmtscan.h b/src/include/skalibs/fmtscan.h index ccfd160..f820b42 100644 --- a/src/include/skalibs/fmtscan.h +++ b/src/include/skalibs/fmtscan.h @@ -3,31 +3,27 @@ #ifndef FMTSCAN_H #define FMTSCAN_H +#include <sys/types.h> +#include <stdint.h> #include <skalibs/gccattributes.h> -#include <skalibs/uint32.h> /* fmt */ +extern size_t str_fmt (char *, char const *) ; +extern size_t strn_fmt (char *, char const *, size_t) ; extern unsigned char fmtscan_asc (unsigned char) gccattr_const ; -extern unsigned int str_fmt (char *, char const *) ; -extern unsigned int strn_fmt (char *, char const *, unsigned int) ; - #define IP4_FMT 20 -extern unsigned int ip4_fmt (char *, char const *) ; -extern unsigned int ip4_fmtu32 (char *, uint32) ; +extern size_t ip4_fmt (char *, char const *) ; +extern size_t ip4_fmtu32 (char *, uint32_t) ; -extern unsigned int ucharn_fmt (char *, char const *, unsigned int) ; -extern unsigned int ucharn_fmt_little (char *, char const *, unsigned int) ; +extern size_t ucharn_fmt (char *, char const *, size_t) ; +extern size_t ucharn_fmt_little (char *, char const *, size_t) ; #define IP6_FMT 40 -extern unsigned int ip6_fmt (char *, char const *) ; - -#define short_fmt(s, u) long_fmt((s), (long)(u)) -#define int_fmt(s, u) long_fmt((s), (long)(u)) -extern unsigned int long_fmt (char *, long) ; +extern size_t ip6_fmt (char *, char const *) ; /* scan */ @@ -35,19 +31,15 @@ extern unsigned int long_fmt (char *, long) ; extern unsigned char fmtscan_num (unsigned char, unsigned char) gccattr_const ; -extern unsigned int ip4_scan (char const *, char *) ; -extern unsigned int ip4_scanu32 (char const *, uint32 *) ; -extern unsigned int ip4_scanlist_u32 (uint32 *, unsigned int, char const *, unsigned int *) ; -extern unsigned int ip4_scanlist (char *, unsigned int, char const *, unsigned int *) ; -extern unsigned int ip6_scan (char const *, char *) ; -extern unsigned int ip6_scanlist (char *, unsigned int, char const *, unsigned int *) ; - -extern unsigned int ucharn_scan (char const *, char *, unsigned int) ; -extern unsigned int ucharn_scan_little (char const *, char *, unsigned int) ; -extern unsigned int ucharn_findlen (char const *) gccattr_pure ; +extern size_t ip4_scan (char const *, char *) ; +extern size_t ip4_scanu32 (char const *, uint32_t *) ; +extern size_t ip4_scanlist_u32 (uint32_t *, size_t, char const *, size_t *) ; +extern size_t ip4_scanlist (char *, size_t, char const *, size_t *) ; +extern size_t ip6_scan (char const *, char *) ; +extern size_t ip6_scanlist (char *, size_t, char const *, size_t *) ; -extern unsigned int short_scan (char const *, short *) ; -extern unsigned int int_scan (char const *, int *) ; -extern unsigned int long_scan (char const *, long *) ; +extern size_t ucharn_scan (char const *, char *, size_t) ; +extern size_t ucharn_scan_little (char const *, char *, size_t) ; +extern size_t ucharn_findlen (char const *) gccattr_pure ; #endif diff --git a/src/include/skalibs/netstring.h b/src/include/skalibs/netstring.h index ee5cd85..f6663c3 100644 --- a/src/include/skalibs/netstring.h +++ b/src/include/skalibs/netstring.h @@ -3,21 +3,22 @@ #ifndef NETSTRING_H #define NETSTRING_H +#include <sys/types.h> +#include <sys/uio.h> #include <skalibs/buffer.h> -#include <skalibs/siovec.h> #include <skalibs/stralloc.h> -extern int netstring_appendb (stralloc *, char const *, unsigned int) ; +extern int netstring_appendb (stralloc *, char const *, size_t) ; #define netstring_appends(sa, s) netstring_appendb((sa), (s), str_len(s)) #define netstring_append(to, from) netstring_appendb((to), (from)->s, (from)->len) -extern int netstring_appendv (stralloc *, siovec_t const *, unsigned int) ; +extern int netstring_appendv (stralloc *, struct iovec const *, unsigned int) ; -extern int netstring_encode (stralloc *, char const *, unsigned int) ; -extern int netstring_decode (stralloc *, char const *, unsigned int) ; +extern int netstring_encode (stralloc *, char const *, size_t) ; +extern ssize_t netstring_decode (stralloc *, char const *, size_t) ; -extern int netstring_okeof (buffer *, unsigned int) ; -extern int netstring_get (buffer *, stralloc *, unsigned int *) ; -extern int netstring_put (buffer *, char const *, unsigned int, unsigned int *) ; +extern int netstring_okeof (buffer *, size_t) ; +extern ssize_t netstring_get (buffer *, stralloc *, size_t *) ; +extern int netstring_put (buffer *, char const *, size_t, size_t *) ; #define netstring_putba(ba, s, n) netstring_appendb(&(ba)->x, s, n) #define netstring_putbav(ba, v, n) netstring_appendv(&(ba)->x, v, n) diff --git a/src/include/skalibs/stddjb.h b/src/include/skalibs/stddjb.h index 3ebd219..b1f54cb 100644 --- a/src/include/skalibs/stddjb.h +++ b/src/include/skalibs/stddjb.h @@ -7,11 +7,8 @@ #include <skalibs/uint16.h> #include <skalibs/uint32.h> #include <skalibs/uint64.h> -#include <skalibs/ushort.h> -#include <skalibs/uint.h> -#include <skalibs/ulong.h> +#include <skalibs/types.h> #include <skalibs/error.h> -#include <skalibs/gidstuff.h> #include <skalibs/ip46.h> #include <skalibs/setgroups.h> |