From 45b377040f162d80697008f8669a17b50db5f3a5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 7 Oct 2009 23:51:02 -0600 Subject: [PATCH] IGN: Use #pragma once rather than include guards in all c/C++ header files --- src/calibre/ebooks/pdf/fonts.h | 5 +---- src/calibre/ebooks/pdf/images.h | 4 +--- src/calibre/ebooks/pdf/links.h | 5 +---- src/calibre/ebooks/pdf/reflow.h | 4 +--- src/calibre/ebooks/pdf/utils.h | 5 +---- src/calibre/gui2/pictureflow/pictureflow.h | 4 +--- src/calibre/utils/lzx/lzc.h | 3 +++ src/calibre/utils/lzx/lzxc.h | 2 ++ src/calibre/utils/lzx/lzxd.h | 5 ++--- src/calibre/utils/lzx/lzxmodule.h | 5 +---- src/calibre/utils/lzx/mspack.h | 4 +--- src/calibre/utils/lzx/msstdint.h | 11 ++--------- src/calibre/utils/lzx/system.h | 5 +---- src/calibre/utils/msdes/d3des.h | 2 ++ src/calibre/utils/msdes/spr.h | 2 ++ 15 files changed, 22 insertions(+), 44 deletions(-) diff --git a/src/calibre/ebooks/pdf/fonts.h b/src/calibre/ebooks/pdf/fonts.h index c285b1dacc..55202c9573 100644 --- a/src/calibre/ebooks/pdf/fonts.h +++ b/src/calibre/ebooks/pdf/fonts.h @@ -4,9 +4,7 @@ */ - -#ifndef CALIBRE_REFLOW_FONTS -#define CALIBRE_REFLOW_FONTS +#pragma once #include #include @@ -102,4 +100,3 @@ class Fonts : public vector { } -#endif diff --git a/src/calibre/ebooks/pdf/images.h b/src/calibre/ebooks/pdf/images.h index 2bdbc09d8d..7d6f143147 100644 --- a/src/calibre/ebooks/pdf/images.h +++ b/src/calibre/ebooks/pdf/images.h @@ -1,5 +1,4 @@ -#ifndef _CALIBRE_REFLOW_IMAGES -#define _CALIBRE_REFLOW_IMAGES +#pragma once #include #include @@ -127,4 +126,3 @@ namespace calibre_reflow { }; */ } -#endif diff --git a/src/calibre/ebooks/pdf/links.h b/src/calibre/ebooks/pdf/links.h index a84693ed0e..a8a3127a77 100644 --- a/src/calibre/ebooks/pdf/links.h +++ b/src/calibre/ebooks/pdf/links.h @@ -5,9 +5,7 @@ -#ifndef _CALIBRE_XML_LINKS -#define _CALIBRE_XML_LINKS - +#pragma once #include #include @@ -65,5 +63,4 @@ class XMLLinks : public vector { } -#endif diff --git a/src/calibre/ebooks/pdf/reflow.h b/src/calibre/ebooks/pdf/reflow.h index fd629602b2..deb1dec326 100644 --- a/src/calibre/ebooks/pdf/reflow.h +++ b/src/calibre/ebooks/pdf/reflow.h @@ -4,8 +4,7 @@ * Based on pdftohtml from the poppler project. */ -#ifndef CALIBRE_REFLOW -#define CALIBRE_REFLOW +#pragma once #define UNICODE #ifdef _WIN32 @@ -248,4 +247,3 @@ class XMLOutputDev : public OutputDev { void process_link(Link* link); }; } -#endif diff --git a/src/calibre/ebooks/pdf/utils.h b/src/calibre/ebooks/pdf/utils.h index ae342d09da..43f435b1e3 100644 --- a/src/calibre/ebooks/pdf/utils.h +++ b/src/calibre/ebooks/pdf/utils.h @@ -4,9 +4,7 @@ */ -#ifndef _CALIBRE_REFLOW_UTILS -#define _CALIBRE_REFLOW_UTILS - +#pragma once #include #include @@ -45,4 +43,3 @@ inline string encode_for_xml(const string &sSrc ) } -#endif diff --git a/src/calibre/gui2/pictureflow/pictureflow.h b/src/calibre/gui2/pictureflow/pictureflow.h index 7431dee634..3e0b606d8a 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.h +++ b/src/calibre/gui2/pictureflow/pictureflow.h @@ -55,8 +55,7 @@ THE SOFTWARE. */ -#ifndef PICTUREFLOW_H -#define PICTUREFLOW_H +#pragma once #include @@ -202,4 +201,3 @@ private: PictureFlowPrivate* d; }; -#endif // PICTUREFLOW_H diff --git a/src/calibre/utils/lzx/lzc.h b/src/calibre/utils/lzx/lzc.h index 8a24f2c090..e817a7eb43 100644 --- a/src/calibre/utils/lzx/lzc.h +++ b/src/calibre/utils/lzx/lzc.h @@ -15,6 +15,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#pragma once + typedef struct lz_info lz_info; typedef int (*get_chars_t)(lz_info *lzi, int n, unsigned char *buf); typedef int (*output_match_t)(lz_info *lzi, int match_pos, int match_len); diff --git a/src/calibre/utils/lzx/lzxc.h b/src/calibre/utils/lzx/lzxc.h index 30da460a81..367094b817 100644 --- a/src/calibre/utils/lzx/lzxc.h +++ b/src/calibre/utils/lzx/lzxc.h @@ -16,6 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#pragma once + #ifdef _MSC_VER #include "msstdint.h" #endif diff --git a/src/calibre/utils/lzx/lzxd.h b/src/calibre/utils/lzx/lzxd.h index 15ae17c0aa..ed9ea73273 100644 --- a/src/calibre/utils/lzx/lzxd.h +++ b/src/calibre/utils/lzx/lzxd.h @@ -10,10 +10,10 @@ * For further details, see the file COPYING.LIB distributed with libmspack */ +#pragma once + #include -#ifndef MSPACK_LZX_H -#define MSPACK_LZX_H 1 /* LZX compression / decompression definitions */ @@ -166,4 +166,3 @@ extern int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes); */ void lzxd_free(struct lzxd_stream *lzx); -#endif diff --git a/src/calibre/utils/lzx/lzxmodule.h b/src/calibre/utils/lzx/lzxmodule.h index d146694fd7..05159deb3b 100644 --- a/src/calibre/utils/lzx/lzxmodule.h +++ b/src/calibre/utils/lzx/lzxmodule.h @@ -3,13 +3,10 @@ * * Common declarations for Python module C glue code. */ +#pragma once #include -#ifndef LZXMODULE_H -#define LZXMODULE_H - extern PyObject *LZXError; extern PyTypeObject CompressorType; -#endif /* LZXMODULE_H */ diff --git a/src/calibre/utils/lzx/mspack.h b/src/calibre/utils/lzx/mspack.h index b48623fed0..e9d8a875a0 100644 --- a/src/calibre/utils/lzx/mspack.h +++ b/src/calibre/utils/lzx/mspack.h @@ -115,8 +115,7 @@ * - #MSPACK_ERR_DECRUNCH indicates an error occured during decompression. */ -#ifndef LIB_MSPACK_H -#define LIB_MSPACK_H 1 +#pragma once #ifdef __cplusplus extern "C" { @@ -1479,4 +1478,3 @@ struct mskwaj_decompressor { }; #endif -#endif diff --git a/src/calibre/utils/lzx/msstdint.h b/src/calibre/utils/lzx/msstdint.h index e032ff1605..51190b4fa5 100644 --- a/src/calibre/utils/lzx/msstdint.h +++ b/src/calibre/utils/lzx/msstdint.h @@ -29,17 +29,12 @@ // /////////////////////////////////////////////////////////////////////////////// +#pragma once + #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" #endif // _MSC_VER ] -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - #include // For Visual Studio 6 in C++ mode wrap include with 'extern "C++" {}' @@ -228,5 +223,3 @@ typedef uint64_t uintmax_t; #endif // __STDC_CONSTANT_MACROS ] - -#endif // _MSC_STDINT_H_ ] diff --git a/src/calibre/utils/lzx/system.h b/src/calibre/utils/lzx/system.h index acc7d23f56..f586bbb495 100644 --- a/src/calibre/utils/lzx/system.h +++ b/src/calibre/utils/lzx/system.h @@ -7,8 +7,7 @@ * For further details, see the file COPYING.LIB distributed with libmspack */ -#ifndef MSPACK_SYSTEM_H -#define MSPACK_SYSTEM_H 1 +#pragma once #ifdef _MSC_VER #define inline @@ -62,5 +61,3 @@ static inline size_t strlen(const char *s) { return e - s; } #endif - -#endif diff --git a/src/calibre/utils/msdes/d3des.h b/src/calibre/utils/msdes/d3des.h index 08ce78656a..0b654b8337 100644 --- a/src/calibre/utils/msdes/d3des.h +++ b/src/calibre/utils/msdes/d3des.h @@ -10,6 +10,8 @@ * (GEnie : OUTER; CIS : [71755,204]) */ +#pragma once + #undef D2_DES #undef D3_DES diff --git a/src/calibre/utils/msdes/spr.h b/src/calibre/utils/msdes/spr.h index 1579892575..d61d5d332f 100644 --- a/src/calibre/utils/msdes/spr.h +++ b/src/calibre/utils/msdes/spr.h @@ -21,6 +21,8 @@ | URL: http://www.gnu.org/licenses/gpl.html */ +#pragma once + static unsigned long SP1[64] = { 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, 0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L,