Changeset 14316


Ignore:
Timestamp:
Jul 4, 2014, 12:00:07 AM (7 years ago)
Author:
livings124
Message:

Use built-in _WIN32 macro instead of WIN32

Location:
trunk
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r14077 r14316  
    320320
    321321  signal (SIGINT, sigHandler);
    322 #ifndef WIN32
     322#ifndef _WIN32
    323323  signal (SIGHUP, sigHandler);
    324324#endif
     
    490490        break;
    491491
    492 #ifndef WIN32
     492#ifndef _WIN32
    493493      case SIGHUP:
    494494        manualUpdate = true;
  • trunk/configure.ac

    r14310 r14316  
    449449     have_msw="yes"
    450450     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
    451      CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
     451     CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN"
    452452     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
    453453     transmissionlocaledir="locale"
     
    508508      exit 1
    509509    fi
    510 fi
    511 if test "x$have_msw" = "xyes"; then
    512     AC_DEFINE([HAVE_MSW], 1)
    513510fi
    514511AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
  • trunk/daemon/daemon.c

    r14270 r14316  
    190190}
    191191
    192 #if defined (WIN32)
     192#if defined (_WIN32)
    193193 #define USE_NO_DAEMON
    194194#elif !defined (HAVE_DAEMON) || defined (__UCLIBC__)
     
    400400    signal (SIGINT, gotsig);
    401401    signal (SIGTERM, gotsig);
    402 #ifndef WIN32
     402#ifndef _WIN32
    403403    signal (SIGHUP, gotsig);
    404404#endif
  • trunk/daemon/remote.c

    r14263 r14316  
    1616#include <string.h> /* strcmp */
    1717
    18 #ifdef WIN32
     18#ifdef _WIN32
    1919 #include <direct.h> /* getcwd */
    2020#else
     
    501501  char buf[2048];
    502502
    503 #ifdef WIN32
     503#ifdef _WIN32
    504504  result = _getcwd (buf, sizeof (buf));
    505505#else
  • trunk/libtransmission/blocklist.c

    r14241 r14316  
    1616#include <unistd.h> /* close () */
    1717
    18 #ifdef WIN32
     18#ifdef _WIN32
    1919 #include <w32api.h>
    2020 #define WINVER  WindowsXP
     
    2424#endif
    2525
    26 #ifndef WIN32
     26#ifndef _WIN32
    2727 #include <sys/mman.h>
    2828#endif
  • trunk/libtransmission/fdlimit.c

    r14310 r14316  
    9999  bool success = 0;
    100100
    101 #ifdef WIN32
     101#ifdef _WIN32
    102102
    103103  HANDLE hFile = CreateFile (filename, GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
     
    173173tr_fsync (int fd)
    174174{
    175 #ifdef WIN32
     175#ifdef _WIN32
    176176  return _commit (fd);
    177177#else
  • trunk/libtransmission/libtransmission-test.c

    r14291 r14316  
    136136  char buf[2048];
    137137
    138 #ifdef WIN32
     138#ifdef _WIN32
    139139  result = _getcwd (buf, sizeof (buf));
    140140#else
  • trunk/libtransmission/log.c

    r14267 r14316  
    2727static int            myQueueLength = 0;
    2828
    29 #ifndef WIN32
     29#ifndef _WIN32
    3030  /* make null versions of these win32 functions */
    3131  static inline int IsDebuggerPresent (void) { return false; }
  • trunk/libtransmission/metainfo.c

    r14293 r14316  
    3232
    3333
    34 #ifdef WIN32
     34#ifdef _WIN32
    3535  #define PATH_DELIMITER_CHARS "/\\"
    3636#else
  • trunk/libtransmission/net.c

    r14266 r14316  
    3030#include <sys/types.h>
    3131
    32 #ifdef WIN32
     32#ifdef _WIN32
    3333 #define _WIN32_WINNT   0x0501
    3434 #include <ws2tcpip.h>
     
    6464    if (!initialized)
    6565    {
    66 #ifdef WIN32
     66#ifdef _WIN32
    6767        WSADATA wsaData;
    6868        WSAStartup (MAKEWORD (2, 2), &wsaData);
     
    7676{
    7777    *buf = '\0';
    78 #ifdef WIN32
     78#ifdef _WIN32
    7979    FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buf, buflen, NULL);
    8080#else
     
    275275    if ((connect (s, (struct sockaddr *) &sock,
    276276                  addrlen) < 0)
    277 #ifdef WIN32
     277#ifdef _WIN32
    278278      && (sockerrno != WSAEWOULDBLOCK)
    279279#endif
  • trunk/libtransmission/net.h

    r13625 r14316  
    3030#define _TR_NET_H_
    3131
    32 #ifdef WIN32
     32#ifdef _WIN32
    3333 #include <inttypes.h>
    3434 #include <ws2tcpip.h>
     
    3838#endif
    3939
    40 #ifdef WIN32
     40#ifdef _WIN32
    4141 #define EADDRINUSE              WSAEADDRINUSE
    4242 #define ECONNREFUSED            WSAECONNREFUSED
     
    155155const unsigned char *tr_globalIPv6 (void);
    156156
    157 #if defined (WIN32) && !defined (QT_DLL)
     157#if defined (_WIN32) && !defined (QT_DLL)
    158158/* The QT exclusion is because something clashes whith the next include */
    159159#include <ws2tcpip.h>           /* socklen_t */
  • trunk/libtransmission/peer-common.h

    r14241 r14316  
    174174
    175175
    176 #ifdef WIN32
     176#ifdef _WIN32
    177177 #define EMSGSIZE WSAEMSGSIZE
    178178#endif
  • trunk/libtransmission/peer-io.c

    r14241 r14316  
    3131
    3232
    33 #ifdef WIN32
     33#ifdef _WIN32
    3434 #define EAGAIN       WSAEWOULDBLOCK
    3535 #define EINTR        WSAEINTR
  • trunk/libtransmission/peer-mgr.h

    r14241 r14316  
    1717#include <inttypes.h> /* uint16_t */
    1818
    19 #ifdef WIN32
     19#ifdef _WIN32
    2020 #include <winsock2.h> /* struct in_addr */
    2121#endif
  • trunk/libtransmission/platform-quota.c

    r14310 r14316  
    1414#include <event2/util.h> /* evutil_ascii_strcasecmp () */
    1515
    16 #ifndef WIN32
     16#ifndef _WIN32
    1717 #include <sys/types.h> /* types needed by quota.h */
    1818 #if defined(__FreeBSD__) || defined(__OpenBSD__)
     
    7070***/
    7171
    72 #ifndef WIN32
     72#ifndef _WIN32
    7373static const char *
    7474getdev (const char * path)
     
    338338}
    339339#endif /* HAVE_XQM */
    340 #endif /* WIN32 */
     340#endif /* _WIN32 */
    341341
    342342static int64_t
     
    345345  int64_t ret = -1;
    346346
    347 #ifndef WIN32
     347#ifndef _WIN32
    348348
    349349  if (info->fstype && !evutil_ascii_strcasecmp(info->fstype, "xfs"))
     
    357357      ret = getquota (info->device);
    358358    }
    359 #endif /* WIN32 */
     359#endif /* _WIN32 */
    360360
    361361  return ret;
     
    365365tr_getDiskFreeSpace (const char * path)
    366366{
    367 #ifdef WIN32
     367#ifdef _WIN32
    368368
    369369  uint64_t freeBytesAvailable = 0;
     
    392392  info = tr_new0 (struct tr_device_info, 1);
    393393  info->path = tr_strdup (path);
    394 #ifndef WIN32
     394#ifndef _WIN32
    395395  info->device = tr_strdup (getblkdev (path));
    396396  info->fstype = tr_strdup (getfstype (path));
  • trunk/libtransmission/platform.c

    r14310 r14316  
    2020#include <sys/stat.h>
    2121
    22 #ifdef WIN32
     22#ifdef _WIN32
    2323 #include <w32api.h>
    2424 #define WINVER  WindowsXP
     
    3535#endif
    3636
    37 #ifdef WIN32
     37#ifdef _WIN32
    3838#include <libgen.h> /* dirname() */
    3939#endif
     
    4949***/
    5050
    51 #ifdef WIN32
     51#ifdef _WIN32
    5252typedef DWORD tr_thread_id;
    5353#else
     
    5858tr_getCurrentThread (void)
    5959{
    60 #ifdef WIN32
     60#ifdef _WIN32
    6161  return GetCurrentThreadId ();
    6262#else
     
    6868tr_areThreadsEqual (tr_thread_id a, tr_thread_id b)
    6969{
    70 #ifdef WIN32
     70#ifdef _WIN32
    7171  return a == b;
    7272#else
     
    8181  void           * arg;
    8282  tr_thread_id     thread;
    83 #ifdef WIN32
     83#ifdef _WIN32
    8484  HANDLE           thread_handle;
    8585#endif
     
    9292}
    9393
    94 #ifdef WIN32
     94#ifdef _WIN32
    9595 #define ThreadFuncReturnType unsigned WINAPI
    9696#else
     
    106106
    107107  tr_free (t);
    108 #ifdef WIN32
     108#ifdef _WIN32
    109109  _endthreadex (0);
    110110  return 0;
     
    120120  t->arg  = arg;
    121121
    122 #ifdef WIN32
     122#ifdef _WIN32
    123123  {
    124124    unsigned int id;
     
    142142{
    143143  int                 depth;
    144 #ifdef WIN32
     144#ifdef _WIN32
    145145  CRITICAL_SECTION    lock;
    146146  DWORD               lockThread;
     
    156156  tr_lock * l = tr_new0 (tr_lock, 1);
    157157
    158 #ifdef WIN32
     158#ifdef _WIN32
    159159  InitializeCriticalSection (&l->lock); /* supports recursion */
    160160#else
     
    171171tr_lockFree (tr_lock * l)
    172172{
    173 #ifdef WIN32
     173#ifdef _WIN32
    174174    DeleteCriticalSection (&l->lock);
    175175#else
     
    182182tr_lockLock (tr_lock * l)
    183183{
    184 #ifdef WIN32
     184#ifdef _WIN32
    185185  EnterCriticalSection (&l->lock);
    186186#else
     
    209209  --l->depth;
    210210  assert (l->depth >= 0);
    211 #ifdef WIN32
     211#ifdef _WIN32
    212212  LeaveCriticalSection (&l->lock);
    213213#else
     
    220220***/
    221221
    222 #ifndef WIN32
     222#ifndef _WIN32
    223223 #include <pwd.h>
    224224#endif
     
    235235      if (!home)
    236236        {
    237 #ifdef WIN32
     237#ifdef _WIN32
    238238          char appdata[MAX_PATH]; /* SHGetFolderPath () requires MAX_PATH */
    239239          *appdata = '\0';
     
    315315#ifdef __APPLE__
    316316          s = tr_buildPath (getHomeDir (), "Library", "Application Support", appname, NULL);
    317 #elif defined (WIN32)
     317#elif defined (_WIN32)
    318318          char appdata[TR_PATH_MAX]; /* SHGetFolderPath () requires MAX_PATH */
    319319          SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, appdata);
     
    459459            }
    460460
    461 #elif defined (WIN32)
     461#elif defined (_WIN32)
    462462
    463463          /* SHGetFolderPath explicitly requires MAX_PATH length */
     
    566566
    567567
    568 #ifdef WIN32
     568#ifdef _WIN32
    569569
    570570/* The following mmap functions are by Joerg Walter, and were taken from
  • trunk/libtransmission/platform.h

    r14241 r14316  
    7878int tr_lockHave (const tr_lock *);
    7979
    80 #ifdef WIN32
     80#ifdef _WIN32
    8181void * mmap (void *ptr, long  size, long  prot, long  type, long  handle, long  arg);
    8282
  • trunk/libtransmission/session.c

    r14266 r14316  
    701701  onNowTimer (0, 0, session);
    702702
    703 #ifndef WIN32
     703#ifndef _WIN32
    704704  /* Don't exit when writing on a broken socket */
    705705  signal (SIGPIPE, SIG_IGN);
  • trunk/libtransmission/torrent.c

    r14310 r14316  
    1111#include <sys/types.h> /* stat */
    1212#include <sys/stat.h> /* stat */
    13 #ifndef WIN32
     13#ifndef _WIN32
    1414 #include <sys/wait.h> /* wait () */
    1515#else
     
    20812081onSigCHLD (int i UNUSED)
    20822082{
    2083 #ifdef WIN32
     2083#ifdef _WIN32
    20842084
    20852085  _cwait (NULL, -1, WAIT_CHILD);
     
    21192119      tr_logAddTorInfo (tor, "Calling script \"%s\"", script);
    21202120
    2121 #ifdef WIN32
     2121#ifdef _WIN32
    21222122      if (_spawnvpe (_P_NOWAIT, script, (const char*)cmd, env) == -1)
    21232123        tr_logAddTorErr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno));
  • trunk/libtransmission/tr-dht.c

    r14268 r14316  
    3434#include <sys/time.h>
    3535#include <unistd.h> /* close () */
    36 #ifdef WIN32
     36#ifdef _WIN32
    3737  #include <inttypes.h>
    3838  #define _WIN32_WINNT  0x0501  /* freeaddrinfo (),getaddrinfo (),getnameinfo () */
  • trunk/libtransmission/tr-lpd.c

    r14192 r14316  
    3131#include <unistd.h> /* close () */
    3232#include <ctype.h> /* toupper () */
    33 #ifdef WIN32
     33#ifdef _WIN32
    3434  #include <w32api.h>
    3535  #define WINDOWS  WindowsXP  /* freeaddrinfo (),getaddrinfo (),getnameinfo () */
  • trunk/libtransmission/transmission.h

    r14290 r14316  
    3030#include <time.h> /* time_t */
    3131
    32 #ifdef WIN32
     32#ifdef _WIN32
    3333 #define __USE_MINGW_ANSI_STDIO 1
    3434 #define __STDC_FORMAT_MACROS 1
     
    4646
    4747#ifndef PRId64
    48  #ifdef WIN32
     48 #ifdef _WIN32
    4949  #define PRId64 "I64"
    5050 #else
     
    5454
    5555#ifndef PRIu64
    56  #ifdef WIN32
     56 #ifdef _WIN32
    5757  #define PRIu64 "I64u"
    5858 #else
     
    6262
    6363#ifndef PRIu32
    64  #ifdef WIN32
     64 #ifdef _WIN32
    6565  #define PRIu32 "u"
    6666 #else
     
    7777#endif
    7878
    79 #if defined (WIN32) && defined (_MSC_VER)
     79#if defined (_WIN32) && defined (_MSC_VER)
    8080 #define inline __inline
    8181#endif
  • trunk/libtransmission/trevent.c

    r14241 r14316  
    2222#include "session.h"
    2323
    24 #ifdef WIN32
     24#ifdef _WIN32
    2525
    2626#include "utils.h"
     
    223223    tr_event_handle * eh = veh;
    224224
    225 #ifndef WIN32
     225#ifndef _WIN32
    226226    /* Don't exit when writing on a broken socket */
    227227    signal (SIGPIPE, SIG_IGN);
  • trunk/libtransmission/utils.c

    r14314 r14316  
    4242#include <event2/event.h>
    4343
    44 #ifdef WIN32
     44#ifdef _WIN32
    4545 #include <w32api.h>
    4646 #define WINVER WindowsXP /* freeaddrinfo (), getaddrinfo (), getnameinfo () */
     
    369369tr_mkdir (const char * path, int permissions UNUSED)
    370370{
    371 #ifdef WIN32
     371#ifdef _WIN32
    372372  if (path && isalpha (path[0]) && path[1] == ':' && !path[2])
    373373    return 0;
     
    731731tr_wait_msec (long int msec)
    732732{
    733 #ifdef WIN32
     733#ifdef _WIN32
    734734  Sleep ((DWORD)msec);
    735735#else
     
    17111711tr_is_same_file (const char * filename1, const char * filename2)
    17121712{
    1713 #ifdef WIN32
     1713#ifdef _WIN32
    17141714
    17151715  bool res;
     
    17881788tr_realpath (const char * path, char * resolved_path)
    17891789{
    1790 #ifdef WIN32
     1790#ifdef _WIN32
    17911791  /* From a message to the Mingw-msys list, Jun 2, 2005 by Mark Junker. */
    17921792  if (GetFullPathNameA (path, TR_PATH_MAX, resolved_path, NULL) == 0)
  • trunk/libtransmission/utils.h

    r14314 r14316  
    8888/* #define DISABLE_GETTEXT */
    8989#ifndef DISABLE_GETTEXT
    90  #if defined (WIN32) || defined (TR_LIGHTWEIGHT)
     90 #if defined (_WIN32) || defined (TR_LIGHTWEIGHT)
    9191   #define DISABLE_GETTEXT
    9292 #endif
     
    452452static inline void tr_timeUpdate (time_t now) { __tr_current_time = now; }
    453453
    454 #ifdef WIN32
     454#ifdef _WIN32
    455455 #include <windef.h> /* MAX_PATH */
    456456 #define TR_PATH_MAX (MAX_PATH + 1)
  • trunk/libtransmission/variant-test.c

    r14304 r14316  
    2222#include "libtransmission-test.h"
    2323
    24 #ifndef WIN32
     24#ifndef _WIN32
    2525#define STACK_SMASH_DEPTH (1 * 1000 * 1000)
    2626#else
  • trunk/libtransmission/variant.c

    r14241 r14316  
    1414#include <string.h>
    1515
    16 #ifdef WIN32 /* tr_mkstemp() */
     16#ifdef _WIN32 /* tr_mkstemp() */
    1717 #include <fcntl.h>
    1818 #include <share.h>
     
    11301130tr_mkstemp (char * template)
    11311131{
    1132 #ifdef WIN32
     1132#ifdef _WIN32
    11331133
    11341134  const int n = strlen (template) + 1;
  • trunk/libtransmission/web.c

    r14241 r14316  
    1212#include <stdlib.h> /* getenv () */
    1313
    14 #ifdef WIN32
     14#ifdef _WIN32
    1515  #include <ws2tcpip.h>
    1616#else
     
    348348           struct timeval  * t)
    349349{
    350 #ifdef WIN32
     350#ifdef _WIN32
    351351  if (!r_fd_set->fd_count && !w_fd_set->fd_count && !c_fd_set->fd_count)
    352352    {
  • trunk/qt/utils.cc

    r14225 r14316  
    1010#include <iostream>
    1111
    12 #ifdef WIN32
     12#ifdef _WIN32
    1313 #include <windows.h>
    1414 #include <shellapi.h>
     
    3535***/
    3636
    37 #if defined(WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     37#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    3838// Should be in QtWinExtras soon, but for now let's import it manually
    3939extern QPixmap qt_pixmapFromWinHICON(HICON icon);
     
    6666}
    6767
    68 #ifdef WIN32
     68#ifdef _WIN32
    6969namespace
    7070{
     
    110110Utils :: guessMimeIcon (const QString& filename)
    111111{
    112 #ifdef WIN32
     112#ifdef _WIN32
    113113  QIcon icon;
    114114
  • trunk/utils/create.c

    r14294 r14316  
    114114  char buf[2048];
    115115
    116 #ifdef WIN32
     116#ifdef _WIN32
    117117  result = _getcwd (buf, sizeof (buf));
    118118#else
Note: See TracChangeset for help on using the changeset viewer.