]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Migrate Windows conditional code to _WIN32 define.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 10 Oct 2018 04:18:00 +0000 (00:18 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 10 Oct 2018 04:18:00 +0000 (00:18 -0400)
12 files changed:
backend/lpd.c
backend/socket.c
backend/test1284.c
backend/usb.c
cgi-bin/cgi.h
ppdc/ppdc-source.cxx
scheduler/cupsd.h
scheduler/type.c
systemv/cupstestppd.c
test/ippfind.c
test/ippserver.c
test/ipptool.c

index 0fbe38c443811d5304634f86b2cbf06f2628983f..e705ed406fe2fd6dea226b9d88f1d16923dd6d59 100644 (file)
 #include <sys/stat.h>
 #include <stdio.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <winsock.h>
 #else
 #  include <sys/socket.h>
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
 #  include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #ifdef __APPLE__
 #  include <CoreFoundation/CFNumber.h>
 #  include <CoreFoundation/CFPreferences.h>
@@ -618,11 +618,11 @@ cups_rresvport(int *port,         /* IO - Port number to bind to */
   * -1...
   */
 
-#ifdef WIN32
+#ifdef _WIN32
   closesocket(fd);
 #else
   close(fd);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
   return (-1);
 }
@@ -730,11 +730,11 @@ lpd_queue(const char      *hostname,      /* I - Host to connect to */
   ssize_t              nbytes;         /* Number of bytes written */
   off_t                        tbytes;         /* Total bytes written */
   char                 buffer[32768];  /* Output buffer */
-#ifdef WIN32
+#ifdef _WIN32
   DWORD                        tv;             /* Timeout in milliseconds */
 #else
   struct timeval       tv;             /* Timeout in secs and usecs */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
  /*
@@ -917,7 +917,7 @@ lpd_queue(const char      *hostname,        /* I - Host to connect to */
     * Set the timeout...
     */
 
-#ifdef WIN32
+#ifdef _WIN32
     tv = (DWORD)(timeout * 1000);
 
     setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
@@ -928,7 +928,7 @@ lpd_queue(const char      *hostname,        /* I - Host to connect to */
 
     setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
     setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
     fputs("STATE: -connecting-to-device\n", stderr);
     _cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
index 0a94f08b8474358fb64371d88e45621b847b4627..675061dd9a3fd8c50eb724284c0b0eea9fe00c6a 100644 (file)
@@ -18,7 +18,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <winsock.h>
 #else
 #  include <unistd.h>
@@ -27,7 +27,7 @@
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
 #  include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 /*
index 97825f5839aa4ed341cd4bac2ce8870124a43f83..2da1086500ae5a8164f1f8348cf87f802bd69639 100644 (file)
  */
 
 #include <cups/string-private.h>
-#ifdef WIN32
+#ifdef _WIN32
 #  include <io.h>
 #else
 #  include <unistd.h>
 #  include <fcntl.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include "ieee1284.c"
 
index a870a6b6de6f24fe04dc349088291459697312ac..e1b2c03dc9af22f27e0013d779b4728e1a2468b3 100644 (file)
 
 #include "backend-private.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <io.h>
 #else
 #  include <unistd.h>
 #  include <fcntl.h>
 #  include <termios.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 /*
index 70a0edca5323c92ccc1ba5f38390b351189984f5..c7e221b28c54306f0713ed6133dfcd671b95478c 100644 (file)
 #  include <time.h>
 #  include <sys/stat.h>
 
-#  ifdef WIN32
+#  ifdef _WIN32
 #    include <direct.h>
 #    include <io.h>
 #  else
 #    include <unistd.h>
-#  endif /* WIN32 */
+#  endif /* _WIN32 */
 
 #  include <cups/cups.h>
 #  include <cups/array.h>
index 4e8cba7bb3472dab415f0e0548a2d67dcbeba8ae..c25d49668e4a883a94ee26fc2cfdf3e70e0ee979 100644 (file)
@@ -20,9 +20,9 @@
 #include "data/epson.h"
 #include "data/hp.h"
 #include "data/label.h"
-#ifndef WIN32
+#ifndef _WIN32
 #  include <sys/utsname.h>
-#endif // !WIN32
+#endif // !_WIN32
 
 
 //
@@ -70,7 +70,7 @@ ppdcSource::ppdcSource(const char  *f,        // I - File to read
   vars->add(new ppdcVariable("CUPS_VERSION_MINOR", MAKE_STRING(CUPS_VERSION_MINOR)));
   vars->add(new ppdcVariable("CUPS_VERSION_PATCH", MAKE_STRING(CUPS_VERSION_PATCH)));
 
-#ifdef WIN32
+#ifdef _WIN32
   vars->add(new ppdcVariable("PLATFORM_NAME", "Windows"));
   vars->add(new ppdcVariable("PLATFORM_ARCH", "X86"));
 
@@ -87,7 +87,7 @@ ppdcSource::ppdcSource(const char  *f,        // I - File to read
     vars->add(new ppdcVariable("PLATFORM_NAME", "unknown"));
     vars->add(new ppdcVariable("PLATFORM_ARCH", "unknown"));
   }
-#endif // WIN32
+#endif // _WIN32
 
   if (f)
     read_file(f, ffp);
index c0174fae7152fb800719d3909e81be94f3697764..bc1350e7e7640376469a6744a0b6fd875cea1dcf 100644 (file)
 #include <sys/stat.h>
 #include <sys/wait.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <direct.h>
 #else
 #  include <unistd.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include "mime.h"
 
index 1954374142a62ca3b3b224e72ca99002119f4c39..719afb7df99952ef569656f5b5838165cbda9f90 100644 (file)
@@ -1083,7 +1083,7 @@ mime_check_rules(
          break;
 
       case MIME_MAGIC_LOCALE :
-#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__EMX__) || defined(__APPLE__)
           result = !strcmp(rules->value.localev, setlocale(LC_ALL, ""));
 #else
           result = !strcmp(rules->value.localev, setlocale(LC_MESSAGES, ""));
index 1880a2dfab318a4dab9d3f0c194cdf84f341b1ba..8e498a59628a790102436f3c5d39f5fce4e7336f 100644 (file)
@@ -18,9 +18,9 @@
 #include <cups/ppd-private.h>
 #include <cups/raster.h>
 #include <math.h>
-#ifdef WIN32
+#ifdef _WIN32
 #  define X_OK 0
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 
 /*
index 2993ea7f8d0a73f0d5ea0f103da984081134911b..0a698d0700067d8a35ca2ce4fcebb72636c9b301 100644 (file)
 
 #define _CUPS_NO_DEPRECATED
 #include <cups/cups-private.h>
-#ifdef WIN32
+#ifdef _WIN32
 #  include <process.h>
 #  include <sys/timeb.h>
 #else
 #  include <sys/wait.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #include <regex.h>
 #ifdef HAVE_DNSSD
 #  include <dns_sd.h>
@@ -34,9 +34,9 @@
 #  define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
 #endif /* HAVE_DNSSD */
 
-#ifndef WIN32
+#ifndef _WIN32
 extern char **environ;                 /* Process environment variables */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
 
 /*
@@ -1733,10 +1733,10 @@ dnssd_error_string(int error)           /* I - Error number */
     case kDNSServiceErr_PollingMode :
         return ("Service polling mode error.");
 
-#ifndef WIN32
+#ifndef _WIN32
     case kDNSServiceErr_Timeout :
         return ("Service timeout.");
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
   }
 
 #  elif defined(HAVE_AVAHI)
@@ -1887,10 +1887,10 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
   int          i,                      /* Looping var */
                myenvc,                 /* Number of environment variables */
                status;                 /* Exit status of program */
-#ifndef WIN32
+#ifndef _WIN32
   char         program[1024];          /* Program to execute */
   int          pid;                    /* Process ID */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
 
  /*
@@ -2025,7 +2025,7 @@ exec_program(ippfind_srv_t *service,      /* I - Service */
       myargv[i] = strdup(args[i]);
   }
 
-#ifdef WIN32
+#ifdef _WIN32
   if (getenv("IPPFIND_DEBUG"))
   {
     printf("\nProgram:\n    %s\n", args[0]);
@@ -2088,7 +2088,7 @@ exec_program(ippfind_srv_t *service,      /* I - Service */
     while (wait(&status) != pid)
       ;
   }
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
  /*
   * Free memory...
@@ -2106,14 +2106,14 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
 
   if (getenv("IPPFIND_DEBUG"))
   {
-#ifdef WIN32
+#ifdef _WIN32
     printf("Exit Status: %d\n", status);
 #else
     if (WIFEXITED(status))
       printf("Exit Status: %d\n", WEXITSTATUS(status));
     else
       printf("Terminating Signal: %d\n", WTERMSIG(status));
-#endif /* WIN32 */
+#endif /* _WIN32 */
   }
 
   return (status == 0);
@@ -2187,7 +2187,7 @@ get_service(cups_array_t *services,       /* I - Service array */
 static double
 get_time(void)
 {
-#ifdef WIN32
+#ifdef _WIN32
   struct _timeb curtime;               /* Current Windows time */
 
   _ftime(&curtime);
@@ -2201,7 +2201,7 @@ get_time(void)
     return (0.0);
   else
     return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 }
 
 
index 8769094e8f206179db7821d069e76a2e18c67e81..f291b389ccdc4c30cde8d907741d8688eed6d892 100644 (file)
@@ -31,7 +31,7 @@
 #include <limits.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #  include <fcntl.h>
 #  include <io.h>
 #  include <process.h>
@@ -45,7 +45,7 @@ extern char **environ;
 #  include <sys/fcntl.h>
 #  include <sys/wait.h>
 #  include <poll.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #ifdef HAVE_DNSSD
 #  include <dns_sd.h>
@@ -662,7 +662,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
   if (!port)
   {
-#ifdef WIN32
+#ifdef _WIN32
    /*
     * Windows is almost always used as a single user system, so use a default
     * port number of 8631.
@@ -676,7 +676,7 @@ main(int  argc,                             /* I - Number of command-line args */
     */
 
     port = 8000 + ((int)getuid() % 1000);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
     fprintf(stderr, "Listening on port %d.\n", port);
   }
@@ -685,7 +685,7 @@ main(int  argc,                             /* I - Number of command-line args */
   {
     const char *tmpdir;                        /* Temporary directory */
 
-#ifdef WIN32
+#ifdef _WIN32
     if ((tmpdir = getenv("TEMP")) == NULL)
       tmpdir = "C:/TEMP";
 #elif defined(__APPLE__) && !TARGET_OS_IOS
@@ -694,7 +694,7 @@ main(int  argc,                             /* I - Number of command-line args */
 #else
     if ((tmpdir = getenv("TMPDIR")) == NULL)
       tmpdir = "/tmp";
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
     snprintf(directory, sizeof(directory), "%s/ippserver.%d", tmpdir, (int)getpid());
 
@@ -1290,9 +1290,9 @@ create_printer(const char *servername,    /* I - Server hostname (NULL for default)
 {
   int                  i, j;           /* Looping vars */
   _ipp_printer_t       *printer;       /* Printer */
-#ifndef WIN32
+#ifndef _WIN32
   char                 path[1024];     /* Full path to command */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
   char                 uri[1024],      /* Printer URI */
 #ifdef HAVE_SSL
                        securi[1024],   /* Secure printer URI */
@@ -1495,7 +1495,7 @@ create_printer(const char *servername,    /* I - Server hostname (NULL for default)
   };
 
 
-#ifndef WIN32
+#ifndef _WIN32
  /*
   * If a command was specified, make sure it exists and is executable...
   */
@@ -1521,7 +1521,7 @@ create_printer(const char *servername,    /* I - Server hostname (NULL for default)
       command = path;
     }
   }
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
  /*
   * Allocate memory for the printer...
@@ -2497,9 +2497,9 @@ filter_cb(_ipp_filter_t   *filter,        /* I - Filter parameters */
   * Filter attributes as needed...
   */
 
-#ifndef WIN32 /* Avoid MS compiler bug */
+#ifndef _WIN32 /* Avoid MS compiler bug */
   (void)dst;
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
   ipp_tag_t group = ippGetGroupTag(attr);
   const char *name = ippGetName(attr);
@@ -6057,13 +6057,13 @@ process_job(_ipp_job_t *job)            /* I - Job */
     ipp_attribute_t *attr;             /* Job attribute */
     char       val[1280],              /* IPP_NAME=value */
                *valptr;                /* Pointer into string */
-#ifndef WIN32
+#ifndef _WIN32
     int                mypipe[2];              /* Pipe for stderr */
     char       line[2048],             /* Line from stderr */
                *ptr,                   /* Pointer into line */
                *endptr;                /* End of line */
     ssize_t    bytes;                  /* Bytes read */
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
     fprintf(stderr, "Running command \"%s %s\".\n", job->printer->command,
             job->filename);
@@ -6121,7 +6121,7 @@ process_job(_ipp_job_t *job)              /* I - Job */
     * Now run the program...
     */
 
-#ifdef WIN32
+#ifdef _WIN32
     status = _spawnvpe(_P_WAIT, job->printer->command, myargv, myenvp);
 
 #else
@@ -6231,20 +6231,20 @@ process_job(_ipp_job_t *job)            /* I - Job */
       while (wait(&status) < 0);
 #  endif /* HAVE_WAITPID */
     }
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
     if (status)
     {
-#ifndef WIN32
+#ifndef _WIN32
       if (WIFEXITED(status))
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
        fprintf(stderr, "Command \"%s\" exited with status %d.\n",
                job->printer->command, WEXITSTATUS(status));
-#ifndef WIN32
+#ifndef _WIN32
       else
        fprintf(stderr, "Command \"%s\" terminated with signal %d.\n",
                job->printer->command, WTERMSIG(status));
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
       job->state = IPP_JSTATE_ABORTED;
     }
     else if (status < 0)
index 9b5bc6395c2e8c7f0522cfc56cdf7c73cfa3d676..8d7630df2ac206fa6660af64b543307387fdd9c5 100644 (file)
@@ -16,7 +16,7 @@
 #include <cups/file-private.h>
 #include <regex.h>
 #include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
 #  include <windows.h>
 #  ifndef R_OK
 #    define R_OK 0
@@ -24,7 +24,7 @@
 #else
 #  include <signal.h>
 #  include <termios.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #ifndef O_BINARY
 #  define O_BINARY 0
 #endif /* !O_BINARY */
@@ -186,9 +186,9 @@ static void print_line(_cups_testdata_t *data, ipp_t *ipp, ipp_attribute_t *attr
 static void    print_xml_header(_cups_testdata_t *data);
 static void    print_xml_string(cups_file_t *outfile, const char *element, const char *s);
 static void    print_xml_trailer(_cups_testdata_t *data, int success, const char *message);
-#ifndef WIN32
+#ifndef _WIN32
 static void    sigterm_handler(int sig);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 static int     timeout_cb(http_t *http, void *user_data);
 static int     token_cb(_ipp_file_t *f, _ipp_vars_t *vars, _cups_testdata_t *data, const char *token);
 static void    usage(void) _CUPS_NORETURN;
@@ -222,14 +222,14 @@ main(int  argc,                           /* I - Number of command-line args */
                                        /* Global data */
 
 
-#ifndef WIN32
+#ifndef _WIN32
  /*
   * Catch SIGINT and SIGTERM...
   */
 
   signal(SIGINT, sigterm_handler);
   signal(SIGTERM, sigterm_handler);
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
  /*
   * Initialize the locale and variables...
@@ -464,9 +464,9 @@ main(int  argc,                             /* I - Number of command-line args */
 
                snprintf(filename, sizeof(filename), "%s.gz", argv[i]);
                 if (access(filename, 0) && filename[0] != '/'
-#ifdef WIN32
+#ifdef _WIN32
                     && (!isalpha(filename[0] & 255) || filename[1] != ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
                     )
                {
                  snprintf(filename, sizeof(filename), "%s/ipptool/%s", cg->cups_datadir, argv[i]);
@@ -651,9 +651,9 @@ main(int  argc,                             /* I - Number of command-line args */
       }
 
       if (access(argv[i], 0) && argv[i][0] != '/'
-#ifdef WIN32
+#ifdef _WIN32
           && (!isalpha(argv[i][0] & 255) || argv[i][1] != ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
           )
       {
         snprintf(testname, sizeof(testname), "%s/ipptool/%s", cg->cups_datadir, argv[i]);
@@ -1094,11 +1094,11 @@ do_test(_ipp_file_t      *f,            /* I - IPP data file */
        }
 
        if (!Cancel && status == HTTP_STATUS_ERROR && httpError(data->http) != EINVAL &&
-#ifdef WIN32
+#ifdef _WIN32
            httpError(data->http) != WSAETIMEDOUT)
 #else
            httpError(data->http) != ETIMEDOUT)
-#endif /* WIN32 */
+#endif /* _WIN32 */
        {
          if (httpReconnect2(data->http, 30000, NULL))
            data->prev_pass = 0;
@@ -1121,11 +1121,11 @@ do_test(_ipp_file_t      *f,            /* I - IPP data file */
     }
 
     if (!Cancel && status == HTTP_STATUS_ERROR && httpError(data->http) != EINVAL &&
-#ifdef WIN32
+#ifdef _WIN32
        httpError(data->http) != WSAETIMEDOUT)
 #else
        httpError(data->http) != ETIMEDOUT)
-#endif /* WIN32 */
+#endif /* _WIN32 */
     {
       if (httpReconnect2(data->http, 30000, NULL))
        data->prev_pass = 0;
@@ -2022,9 +2022,9 @@ get_filename(const char *testfile,        /* I - Current test file */
       *dstptr = '\0';
   }
   else if (!access(src, R_OK) || *src == '/'
-#ifdef WIN32
+#ifdef _WIN32
            || (isalpha(*src & 255) && src[1] == ':')
-#endif /* WIN32 */
+#endif /* _WIN32 */
            )
   {
    /*
@@ -2183,7 +2183,7 @@ iso_date(const ipp_uchar_t *date) /* I - IPP (RFC 1903) date/time value */
 static void
 pause_message(const char *message)     /* I - Message */
 {
-#ifdef WIN32
+#ifdef _WIN32
   HANDLE       tty;                    /* Console handle */
   DWORD                mode;                   /* Console mode */
   char         key;                    /* Key press */
@@ -2231,7 +2231,7 @@ pause_message(const char *message)        /* I - Message */
     close(tty);
     return;
   }
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
  /*
   * Display the prompt...
@@ -2239,7 +2239,7 @@ pause_message(const char *message)        /* I - Message */
 
   cupsFilePrintf(cupsFileStdout(), "%s\n---- PRESS ANY KEY ----", message);
 
-#ifdef WIN32
+#ifdef _WIN32
  /*
   * Read a key...
   */
@@ -2265,7 +2265,7 @@ pause_message(const char *message)        /* I - Message */
 
   tcsetattr(tty, TCSAFLUSH, &original);
   close(tty);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
  /*
   * Erase the "press any key" prompt...
@@ -2928,7 +2928,7 @@ print_xml_trailer(
 }
 
 
-#ifndef WIN32
+#ifndef _WIN32
 /*
  * 'sigterm_handler()' - Handle SIGINT and SIGTERM.
  */
@@ -2943,7 +2943,7 @@ sigterm_handler(int sig)          /* I - Signal number (unused) */
   signal(SIGINT, SIG_DFL);
   signal(SIGTERM, SIG_DFL);
 }
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
 
 /*