build/stlport/src/_stdio_file.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /*
     2  * Copyright (c) 1999
     3  * Silicon Graphics Computer Systems, Inc.
     4  *
     5  * Copyright (c) 1999
     6  * Boris Fomitchev
     7  *
     8  * This material is provided "as is", with absolutely no warranty expressed
     9  * or implied. Any use is at your own risk.
    10  *
    11  * Permission to use or copy this software for any purpose is hereby granted
    12  * without fee, provided the above notices are retained on all copies.
    13  * Permission to modify the code and to distribute modified code is granted,
    14  * provided the above notices are retained, and a notice that the code was
    15  * modified is included with the above copyright notice.
    16  *
    17  */
    19 #ifndef _STLP_STDIO_FILE_H
    20 #define _STLP_STDIO_FILE_H
    22 /* This file provides a low-level interface between the internal
    23  * representation of struct FILE, from the C stdio library, and
    24  * the C++ I/O library. */
    26 #ifndef _STLP_CSTDIO
    27 #  include <cstdio>
    28 #endif
    29 #ifndef _STLP_CSTDDEF
    30 #  include <cstddef>
    31 #endif
    33 #if defined (__MSL__)
    34 #  include <unix.h>  /* get the definition of fileno */
    35 #endif
    37 _STLP_BEGIN_NAMESPACE
    39 #if defined (_STLP_WCE)
    41 inline int _FILE_fd(const FILE *__f) {
    42   /* Check if FILE is one of the three standard streams
    43      We do this check first, because invoking _fileno() on one of them
    44      causes a terminal window to be created. This also happens if you do
    45      any IO on them, but merely retrieving the filedescriptor shouldn't
    46      already do that.
    48      Obviously this is pretty implementation-specific because it requires
    49      that indeed the first three FDs are always the same, but that is not
    50      only common but almost guaranteed. */
    51   for (int __fd = 0; __fd != 3; ++__fd) {
    52     if (__f == _getstdfilex(__fd))
    53       return __fd;
    54   }
    56   /* Normal files. */
    57   return (int)::_fileno((FILE*)__f); 
    58 }
    60 # elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
    62 inline int _FILE_fd(const FILE *__f) { return __f->__file; }
    64 # elif defined (__sun) && defined (_LP64)
    66 inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; }
    68 #elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \
    69       defined (__MVS__) || \
    70       defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */
    72 inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); }
    74 #elif defined (_STLP_USE_GLIBC)
    76 inline int _FILE_fd(const FILE *__f) { return __f->_fileno; }
    78 #elif defined (__BORLANDC__)
    80 inline int _FILE_fd(const FILE *__f) { return __f->fd; }
    82 #elif defined (__MWERKS__)
    84 /* using MWERKS-specific defines here to detect other OS targets
    85  * dwa: I'm not sure they provide fileno for all OS's, but this should
    86  * work for Win32 and WinCE
    88  * Hmm, at least for Novell NetWare __dest_os == __mac_os true too..
    89  * May be both __dest_os and __mac_os defined and empty?   - ptr */
    90 #  if __dest_os == __mac_os
    91 inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); }
    92 #  else
    93 inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); }
    94 #  endif
    96 #elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__)
    98 inline int _FILE_fd(const FILE *__f) { return __f->_handle; }
   100 #elif defined (__Lynx__)
   102 /* the prototypes are taken from LynxOS patch for STLport 4.0 */
   103 inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
   105 #else  /* The most common access to file descriptor. */
   107 inline int _FILE_fd(const FILE *__f) { return __f->_file; }
   109 #endif
   111 _STLP_END_NAMESPACE
   113 #endif /* _STLP_STDIO_FILE_H */
   115 /* Local Variables:
   116  * mode:C++
   117  * End: */

mercurial