mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Rewrote usages of define(_MSC_VER) to ifdef _MSC_VER
This commit is contained in:
parent
5cdc6e150e
commit
a105ea9d80
6 changed files with 17 additions and 19 deletions
18
src/Flare.cc
18
src/Flare.cc
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "zeek/Reporter.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
|
@ -31,10 +31,8 @@ namespace zeek::detail
|
|||
{
|
||||
|
||||
Flare::Flare()
|
||||
#if ! defined(_MSC_VER)
|
||||
: pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK)
|
||||
{
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
: pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK){}
|
||||
#else
|
||||
{
|
||||
WSADATA wsaData;
|
||||
|
@ -64,7 +62,7 @@ Flare::Flare()
|
|||
}
|
||||
#endif
|
||||
|
||||
[[noreturn]] static void bad_pipe_op(const char* which, bool signal_safe)
|
||||
[[noreturn]] static void bad_pipe_op(const char* which, bool signal_safe)
|
||||
{
|
||||
if ( signal_safe )
|
||||
abort();
|
||||
|
@ -87,7 +85,7 @@ void Flare::Fire(bool signal_safe)
|
|||
|
||||
for ( ;; )
|
||||
{
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
int n = write(pipe.WriteFD(), &tmp, 1);
|
||||
|
||||
#else
|
||||
|
@ -99,7 +97,7 @@ void Flare::Fire(bool signal_safe)
|
|||
|
||||
if ( n < 0 )
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
errno = WSAGetLastError();
|
||||
bad_pipe_op("send", signal_safe);
|
||||
#endif
|
||||
|
@ -125,7 +123,7 @@ int Flare::Extinguish(bool signal_safe)
|
|||
|
||||
for ( ;; )
|
||||
{
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
int n = read(pipe.ReadFD(), &tmp, sizeof(tmp));
|
||||
#else
|
||||
int n = recv(recvfd, tmp, sizeof(tmp), 0);
|
||||
|
@ -136,7 +134,7 @@ int Flare::Extinguish(bool signal_safe)
|
|||
// Pipe may not be empty yet: try again.
|
||||
continue;
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
if ( WSAGetLastError() == WSAEWOULDBLOCK )
|
||||
break;
|
||||
errno = WSAGetLastError();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
#include "Pipe.h"
|
||||
#endif
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
* Fire()'d and not yet Extinguished()'d.
|
||||
*/
|
||||
int FD() const
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
{
|
||||
return pipe.ReadFD();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
int Extinguish(bool signal_safe = false);
|
||||
|
||||
private:
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
Pipe pipe;
|
||||
#else
|
||||
int sendfd, recvfd;
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
#include "zeek/supervisor/Supervisor.h"
|
||||
#include "zeek/zeek-setup.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
#include <fcntl.h> // For _O_BINARY.
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
_setmode(_fileno(stderr), _O_BINARY);
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "zeek/plugin/Manager.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#if ! defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
#include <dlfcn.h>
|
||||
#include <glob.h>
|
||||
#endif
|
||||
|
@ -163,7 +163,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
|
|||
std::vector<std::string>* errors)
|
||||
{
|
||||
// Loading dynamic plugins is not currently supported on Windows platform.
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
return false;
|
||||
#else
|
||||
errors->clear(); // caller should pass it in empty, but just to be sure
|
||||
|
|
|
@ -25,7 +25,7 @@ struct Field;
|
|||
namespace zeek
|
||||
{
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
#undef VOID
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2539,7 +2539,7 @@ static void strerror_r_helper(int result, char* buf, size_t buflen)
|
|||
|
||||
void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
auto str = "Error number: " + std::to_string(zeek_errno);
|
||||
auto res = str.data();
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue