1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/chromium/base/format_macros.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 1.4 +// Copyright (c) 2009 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef BASE_FORMAT_MACROS_H_ 1.9 +#define BASE_FORMAT_MACROS_H_ 1.10 + 1.11 +// This file defines the format macros for some integer types. 1.12 + 1.13 +// To print a 64-bit value in a portable way: 1.14 +// int64_t value; 1.15 +// printf("xyz:%" PRId64, value); 1.16 +// The "d" in the macro corresponds to %d; you can also use PRIu64 etc. 1.17 +// 1.18 +// For wide strings, prepend "Wide" to the macro: 1.19 +// int64_t value; 1.20 +// StringPrintf(L"xyz: %" WidePRId64, value); 1.21 +// 1.22 +// To print a size_t value in a portable way: 1.23 +// size_t size; 1.24 +// printf("xyz: %" PRIuS, size); 1.25 +// The "u" in the macro corresponds to %u, and S is for "size". 1.26 + 1.27 +#include "build/build_config.h" 1.28 + 1.29 +#if defined(OS_POSIX) 1.30 + 1.31 +#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64) 1.32 +#error "inttypes.h has already been included before this header file, but " 1.33 +#error "without __STDC_FORMAT_MACROS defined." 1.34 +#endif 1.35 + 1.36 +#if !defined(__STDC_FORMAT_MACROS) 1.37 +#define __STDC_FORMAT_MACROS 1.38 +#endif 1.39 + 1.40 +#include <inttypes.h> 1.41 + 1.42 +// GCC will concatenate wide and narrow strings correctly, so nothing needs to 1.43 +// be done here. 1.44 +#define WidePRId64 PRId64 1.45 +#define WidePRIu64 PRIu64 1.46 +#define WidePRIx64 PRIx64 1.47 + 1.48 +#if !defined(PRIuS) 1.49 +#define PRIuS "zu" 1.50 +#endif 1.51 + 1.52 +#else // OS_WIN 1.53 + 1.54 +#if !defined(PRId64) 1.55 +#define PRId64 "I64d" 1.56 +#endif 1.57 + 1.58 +#if !defined(PRIu64) 1.59 +#define PRIu64 "I64u" 1.60 +#endif 1.61 + 1.62 +#if !defined(PRIx64) 1.63 +#define PRIx64 "I64x" 1.64 +#endif 1.65 + 1.66 +#define WidePRId64 L"I64d" 1.67 +#define WidePRIu64 L"I64u" 1.68 +#define WidePRIx64 L"I64x" 1.69 + 1.70 +#if !defined(PRIuS) 1.71 +#define PRIuS "Iu" 1.72 +#endif 1.73 + 1.74 +#endif 1.75 + 1.76 +#endif // BASE_FORMAT_MACROS_H_