media/libvpx/vpx_ports/mem.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /*
     2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     3  *
     4  *  Use of this source code is governed by a BSD-style license
     5  *  that can be found in the LICENSE file in the root of the source
     6  *  tree. An additional intellectual property rights grant can be found
     7  *  in the file PATENTS.  All contributing project authors may
     8  *  be found in the AUTHORS file in the root of the source tree.
     9  */
    12 #ifndef VPX_PORTS_MEM_H
    13 #define VPX_PORTS_MEM_H
    15 #include "vpx_config.h"
    16 #include "vpx/vpx_integer.h"
    18 #if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
    19 #define DECLARE_ALIGNED(n,typ,val)  typ val __attribute__ ((aligned (n)))
    20 #elif defined(_MSC_VER)
    21 #define DECLARE_ALIGNED(n,typ,val)  __declspec(align(n)) typ val
    22 #else
    23 #warning No alignment directives known for this compiler.
    24 #define DECLARE_ALIGNED(n,typ,val)  typ val
    25 #endif
    26 #endif
    29 /* Declare an aligned array on the stack, for situations where the stack
    30  * pointer may not have the alignment we expect. Creates an array with a
    31  * modified name, then defines val to be a pointer, and aligns that pointer
    32  * within the array.
    33  */
    34 #define DECLARE_ALIGNED_ARRAY(a,typ,val,n)\
    35   typ val##_[(n)+(a)/sizeof(typ)+1];\
    36   typ *val = (typ*)((((intptr_t)val##_)+(a)-1)&((intptr_t)-(a)))
    39 /* Indicates that the usage of the specified variable has been audited to assure
    40  * that it's safe to use uninitialized. Silences 'may be used uninitialized'
    41  * warnings on gcc.
    42  */
    43 #if defined(__GNUC__) && __GNUC__
    44 #define UNINITIALIZED_IS_SAFE(x) x=x
    45 #else
    46 #define UNINITIALIZED_IS_SAFE(x) x
    47 #endif

mercurial