Back to index

enigmail  1.4.3
StandardInteger.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim: set ts=8 sw=4 et tw=99 ft=cpp:
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at:
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is Mozilla Code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  *   The Mozilla Foundation
00021  * Portions created by the Initial Developer are Copyright (C) 2011
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Jeff Walden <jwalden+code@mit.edu> (original author)
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 /* Implements the C99 <stdint.h> interface for C and C++ code. */
00042 
00043 #ifndef mozilla_StandardInteger_h_
00044 #define mozilla_StandardInteger_h_
00045 
00046 /*
00047  * The C99 standard header <stdint.h> exposes typedefs for common fixed-width
00048  * integer types.  It would be feasible to simply #include <stdint.h>, but
00049  * MSVC++ versions prior to 2010 don't provide <stdint.h>.  We could solve this
00050  * by reimplementing <stdint.h> for MSVC++ 2008 and earlier.  But then we reach
00051  * a second problem: our custom <stdint.h> might conflict with a <stdint.h>
00052  * defined by an embedder already looking to work around the MSVC++ <stdint.h>
00053  * absence.
00054  *
00055  * We address these issues in this manner:
00056  *
00057  *   1. If the preprocessor macro MOZ_CUSTOM_STDINT_H is defined to a path to a
00058  *      custom <stdint.h> implementation, we will #include it.  Embedders using
00059  *      a custom <stdint.h> must define this macro to an implementation that
00060  *      will work with their embedding.
00061  *   2. Otherwise, if we are compiling with a an MSVC++ version without
00062  *      <stdint.h>, #include our custom <stdint.h> reimplementation.
00063  *   3. Otherwise, #include the standard <stdint.h> provided by the compiler.
00064  *
00065  * Note that we can't call this file "stdint.h" or something case-insensitively
00066  * equal to "stdint.h" because then MSVC (and other compilers on
00067  * case-insensitive file systems) will include this file, rather than the system
00068  * stdint.h, when we ask for <stdint.h> below.
00069  */
00070 #if defined(MOZ_CUSTOM_STDINT_H)
00071 #  include MOZ_CUSTOM_STDINT_H
00072 #elif defined(_MSC_VER) && _MSC_VER < 1600
00073 #  include "mozilla/MSStdInt.h"
00074 #else
00075 #  include <stdint.h>
00076 #endif
00077 
00078 #endif  /* mozilla_StandardInteger_h_ */