aboutsummaryrefslogtreecommitdiffstats
path: root/xmlwf/readfilemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'xmlwf/readfilemap.c')
-rw-r--r--xmlwf/readfilemap.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/xmlwf/readfilemap.c b/xmlwf/readfilemap.c
index 4c4780bde0e3..d5b84f995ad4 100644
--- a/xmlwf/readfilemap.c
+++ b/xmlwf/readfilemap.c
@@ -37,40 +37,40 @@
#include <stdio.h>
/* Functions close(2) and read(2) */
-#if !defined(_WIN32) && !defined(_WIN64)
-# include <unistd.h>
+#if ! defined(_WIN32) && ! defined(_WIN64)
+# include <unistd.h>
#endif
/* Function "read": */
#if defined(_MSC_VER)
-# include <io.h>
- /* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
-# define _EXPAT_read _read
-# define _EXPAT_read_count_t int
-# define _EXPAT_read_req_t unsigned int
-#else /* POSIX */
- /* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
-# define _EXPAT_read read
-# define _EXPAT_read_count_t ssize_t
-# define _EXPAT_read_req_t size_t
+# include <io.h>
+/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
+# define _EXPAT_read _read
+# define _EXPAT_read_count_t int
+# define _EXPAT_read_req_t unsigned int
+#else /* POSIX */
+/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
+# define _EXPAT_read read
+# define _EXPAT_read_count_t ssize_t
+# define _EXPAT_read_req_t size_t
#endif
#ifndef S_ISREG
-# ifndef S_IFREG
-# define S_IFREG _S_IFREG
-# endif
-# ifndef S_IFMT
-# define S_IFMT _S_IFMT
-# endif
-# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# ifndef S_IFREG
+# define S_IFREG _S_IFREG
+# endif
+# ifndef S_IFMT
+# define S_IFMT _S_IFMT
+# endif
+# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#endif /* not S_ISREG */
#ifndef O_BINARY
-# ifdef _O_BINARY
-# define O_BINARY _O_BINARY
-# else
-# define O_BINARY 0
-# endif
+# ifdef _O_BINARY
+# define O_BINARY _O_BINARY
+# else
+# define O_BINARY 0
+# endif
#endif
#include "xmltchar.h"
@@ -79,15 +79,14 @@
int
filemap(const tchar *name,
void (*processor)(const void *, size_t, const tchar *, void *arg),
- void *arg)
-{
+ void *arg) {
size_t nbytes;
int fd;
_EXPAT_read_count_t n;
struct stat sb;
void *p;
- fd = topen(name, O_RDONLY|O_BINARY);
+ fd = topen(name, O_RDONLY | O_BINARY);
if (fd < 0) {
tperror(name);
return 0;
@@ -97,14 +96,14 @@ filemap(const tchar *name,
close(fd);
return 0;
}
- if (!S_ISREG(sb.st_mode)) {
+ if (! S_ISREG(sb.st_mode)) {
ftprintf(stderr, T("%s: not a regular file\n"), name);
close(fd);
return 0;
}
if (sb.st_size > XML_MAX_CHUNK_LEN) {
close(fd);
- return 2; /* Cannot be passed to XML_Parse in one go */
+ return 2; /* Cannot be passed to XML_Parse in one go */
}
nbytes = sb.st_size;
@@ -116,7 +115,7 @@ filemap(const tchar *name,
return 1;
}
p = malloc(nbytes);
- if (!p) {
+ if (! p) {
ftprintf(stderr, T("%s: out of memory\n"), name);
close(fd);
return 0;