Skip to content

Commit

Permalink
Clean up private header.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Oct 2, 2023
1 parent a83f7f5 commit 87ca4db
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions pdfio-private.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Private header file for PDFio.
//
// Copyright © 2021-2022 by Michael R Sweet.
// Copyright © 2021-2023 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
Expand All @@ -10,18 +10,12 @@
#ifndef PDFIO_PRIVATE_H
# define PDFIO_PRIVATE_H

//
// Include necessary headers...
//

# ifdef _WIN32
/*
* Disable bogus VS warnings/errors...
*/

# define _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS // Disable bogus VS warnings/errors...
# endif // _WIN32


# include "pdfio.h"
# include <stdarg.h>
# include <stdint.h>
Expand All @@ -32,18 +26,7 @@
# ifdef _WIN32
# include <io.h>
# include <direct.h>

/*
* Microsoft renames the POSIX functions to _name, and introduces
* a broken compatibility layer using the original names. As a result,
* random crashes can occur when, for example, strdup() allocates memory
* from a different heap than used by malloc() and free().
*
* To avoid moronic problems like this, we #define the POSIX function
* names to the corresponding non-standard Microsoft names.
*/

# define access _access
# define access _access // Map standard POSIX/C99 names
# define close _close
# define fileno _fileno
# define lseek _lseek
Expand All @@ -56,12 +39,7 @@
# define unlink _unlink
# define vsnprintf _vsnprintf
# define write _write

/*
* Map various parameters for POSIX...
*/

# define F_OK 00
# define F_OK 00 // POSIX parameters/flags
# define W_OK 02
# define R_OK 04
# define O_RDONLY _O_RDONLY
Expand All @@ -71,7 +49,7 @@
# define O_BINARY _O_BINARY
# else // !_WIN32
# include <unistd.h>
# define O_BINARY 0
# define O_BINARY 0 // Used on Windows for binary files...
# endif // _WIN32
# include <string.h>
# include <ctype.h>
Expand Down Expand Up @@ -411,4 +389,5 @@ extern void _pdfioValueDelete(_pdfio_value_t *v) _PDFIO_INTERNAL;
extern _pdfio_value_t *_pdfioValueRead(pdfio_file_t *pdf, pdfio_obj_t *obj, _pdfio_token_t *ts, _pdfio_value_t *v, size_t depth) _PDFIO_INTERNAL;
extern bool _pdfioValueWrite(pdfio_file_t *pdf, pdfio_obj_t *obj, _pdfio_value_t *v, off_t *length) _PDFIO_INTERNAL;


#endif // !PDFIO_PRIVATE_H

0 comments on commit 87ca4db

Please sign in to comment.