Better ANSI C portability.

This commit is contained in:
carl 2019-03-24 17:40:27 +08:00
parent 9b6e1774ea
commit 75394c93e1

View file

@ -7,11 +7,14 @@
#ifndef __OBJECT_INCLUDED__ #ifndef __OBJECT_INCLUDED__
#define __OBJECT_INCLUDED__ #define __OBJECT_INCLUDED__
#include <stdio.h>
struct ar_hdr; struct ar_hdr;
struct outhead; struct outhead;
struct outrelo; struct outrelo;
struct outsect; struct outsect;
struct ranlib; struct ranlib;
struct outname;
int wr_open(const char *f); int wr_open(const char *f);
void wr_close(void); void wr_close(void);
@ -23,13 +26,17 @@ void wr_putc(int c);
void wr_relo(const struct outrelo *r, unsigned int c); void wr_relo(const struct outrelo *r, unsigned int c);
void wr_name(const struct outname *n, unsigned int c); void wr_name(const struct outname *n, unsigned int c);
void wr_string(const char *s, long c); void wr_string(const char *s, long c);
void wr_arhdr(int fd, struct ar_hdr *a);
void wr_ranlib(int fd, struct ranlib *r, long cnt);
void wr_int2(int fd, int i); void wr_arhdr(FILE* fd, struct ar_hdr *a);
void wr_long(int fd, long l); void wr_ranlib(FILE* fd, struct ranlib *r, long cnt);
void wr_bytes(int fd, const char *buf, long l); void wr_int2(FILE* fd, int i);
void wr_long(FILE* fd, long l);
void wr_bytes(FILE* fd, const char *buf, long l);
int rd_open(const char *f); int rd_open(const char *f);
int rd_fdopen(int f); int rd_fdopen(FILE* fd);
void rd_close(void); void rd_close(void);
void rd_ohead(struct outhead *h); void rd_ohead(struct outhead *h);
void rd_sect(struct outsect *s, unsigned int c); void rd_sect(struct outsect *s, unsigned int c);
@ -39,11 +46,21 @@ void rd_relo(struct outrelo *r, unsigned int c);
void rd_rew_relos(struct outhead *head); void rd_rew_relos(struct outhead *head);
void rd_name(struct outname *n, unsigned int c); void rd_name(struct outname *n, unsigned int c);
void rd_string(char *s, long c); void rd_string(char *s, long c);
int rd_arhdr(int fd, struct ar_hdr *a);
void rd_ranlib(int fd, struct ranlib *r, long cnt); /** Reads an archive header and returns the filled
int rd_int2(int fd); * up archive header structure. Returns 0 if failure
long rd_long(int fd); * otherwise returns 1.
void rd_bytes(int fd, char *buf, long l); *
int rd_fd(void); * @param[in] fd Opened file descriptor to read from.
* @param[out] a Archive header structure.
*
*/
int rd_arhdr(FILE* fd, struct ar_hdr *a);
void rd_ranlib(FILE* fd, struct ranlib *r, long cnt);
int rd_int2(FILE* fd);
long rd_long(FILE* fd);
unsigned int rd_unsigned2(FILE* fd);
void rd_bytes(FILE* fd, char *buf, long l);
FILE* rd_fd(void);
#endif /* __OBJECT_INCLUDED__ */ #endif /* __OBJECT_INCLUDED__ */