mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Cleanup wposix header and source
Remove stale NAN and INFINITY, both have equivalents since C++11 and cleanup headers in wposix source file. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
62fcb7e042
commit
6fc47e2997
3 changed files with 12 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
|
@ -25,21 +25,25 @@
|
|||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "lib/sysdep/os/win/wposix/wposix.h"
|
||||
|
||||
#include "lib/sysdep/os/win/wposix/wposix_internal.h"
|
||||
#include "lib/bits.h"
|
||||
#include "wposix.h"
|
||||
|
||||
#include "lib/sysdep/os/win/win.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
int setenv(const char* envname, const char* envval, int overwrite)
|
||||
{
|
||||
if(!envname || envname[0] == '\0' || strchr(envname, '='))
|
||||
if(!envname || envname[0] == '\0' || std::strchr(envname, '='))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(overwrite || !getenv(envname))
|
||||
if(overwrite || !std::getenv(envname))
|
||||
SetEnvironmentVariableA(envname, envval);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -54,17 +54,4 @@
|
|||
|
||||
int setenv(const char* envname, const char* envval, int overwrite);
|
||||
|
||||
|
||||
//
|
||||
// <math.h>
|
||||
//
|
||||
|
||||
// (missing on MSVC)
|
||||
#ifndef INFINITY
|
||||
#define INFINITY (std::numeric_limits<float>::infinity())
|
||||
#endif
|
||||
#ifndef NAN
|
||||
#define NAN (std::numeric_limits<float>::quiet_NaN())
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_WPOSIX
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -213,7 +213,7 @@ public:
|
|||
|
||||
float f = 0;
|
||||
JS::RootedValue testNANVal(rq.cx);
|
||||
Script::ToJSVal(rq, &testNANVal, NAN);
|
||||
Script::ToJSVal(rq, &testNANVal, std::numeric_limits<float>::quiet_NaN());
|
||||
TS_ASSERT(Script::FromJSVal(rq, testNANVal, f));
|
||||
TS_ASSERT(std::isnan(f));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue