Bug 835381 - Unit tests for the MediaSniffer to make sure Matroska files are not...
[gecko.git] / mfbt / StandardInteger.h
blob8e4c8578f17c0ec0ca80faa7b14a1b692fc7b06b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* Implements the C99 <stdint.h> interface for C and C++ code. */
8 #ifndef mozilla_StandardInteger_h_
9 #define mozilla_StandardInteger_h_
12 * The C99 standard header <stdint.h> exposes typedefs for common fixed-width
13 * integer types. It would be feasible to simply #include <stdint.h>, but
14 * MSVC++ versions prior to 2010 don't provide <stdint.h>. We could solve this
15 * by reimplementing <stdint.h> for MSVC++ 2008 and earlier. But then we reach
16 * a second problem: our custom <stdint.h> might conflict with a <stdint.h>
17 * defined by an embedder already looking to work around the MSVC++ <stdint.h>
18 * absence.
20 * We address these issues in this manner:
22 * 1. If the preprocessor macro MOZ_CUSTOM_STDINT_H is defined to a path to a
23 * custom <stdint.h> implementation, we will #include it. Embedders using
24 * a custom <stdint.h> must define this macro to an implementation that
25 * will work with their embedding.
26 * 2. Otherwise, if we are compiling with a an MSVC++ version without
27 * <stdint.h>, #include our custom <stdint.h> reimplementation.
28 * 3. Otherwise, #include the standard <stdint.h> provided by the compiler.
30 * Note that we can't call this file "stdint.h" or something case-insensitively
31 * equal to "stdint.h" because then MSVC (and other compilers on
32 * case-insensitive file systems) will include this file, rather than the system
33 * stdint.h, when we ask for <stdint.h> below.
35 #if defined(MOZ_CUSTOM_STDINT_H)
36 # include MOZ_CUSTOM_STDINT_H
37 #elif defined(_MSC_VER) && _MSC_VER < 1600
38 # include "mozilla/MSStdInt.h"
39 #else
40 # include <stdint.h>
41 #endif
43 #endif /* mozilla_StandardInteger_h_ */