1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0027118: Configuration - do not suppress deprecation warnings when using msvc

Patch removes option -wd4996 from VS project settings (which suppresses old deprecation warnings).
Instead, macros _CRT_SECURE_NO_WARNINGS (suppresses 444 warnings) and _CRT_NONSTDC_NO_DEPRECATE (suppresses 17 warnings) have been added.

Deprecation warning on GetVersionEx() has been suppressed locally in OSD_Host.cxx.
In STEPConstruct_AP203Context.cxx, OSD_Host is used instead of low-level system functions.
This eliminates dependency of TKSTEP on winsock32.lib on Windows.
This commit is contained in:
kgv
2016-01-30 15:51:35 +03:00
committed by abv
parent 8ddd25b887
commit fe9b8ff2f2
12 changed files with 61 additions and 81 deletions

View File

@@ -323,7 +323,7 @@ void OSD_Environment :: Build () {
str = myName + TEXT( "=" ) + myValue;
putenv ( str.ToCString () );
_putenv (str.ToCString());
} // end OSD_Environment :: Build
@@ -333,7 +333,7 @@ void OSD_Environment :: Remove () {
str = myName + TEXT( "=" );
putenv ( str.ToCString () );
_putenv (str.ToCString());
} // end OSD_Environment :: Remove

View File

@@ -216,6 +216,10 @@ OSD_Host :: OSD_Host () {
ZeroMemory (&ms, sizeof(ms));
ZeroMemory ( szHostName, sizeof ( Standard_Character ) * (MAX_COMPUTERNAME_LENGTH + 1) );
#ifdef _MSC_VER
// suppress GetVersionEx() deprecation warning
#pragma warning(disable : 4996)
#endif
if ( !GetVersionEx ( &osVerInfo ) ) {
_osd_wnt_set_error ( myError, OSD_WHost );
@@ -230,6 +234,9 @@ OSD_Host :: OSD_Host () {
GlobalMemoryStatus ( &ms );
} // end else
#ifdef _MSC_VER
#pragma warning(default : 4996)
#endif
if ( !Failed () ) {

View File

@@ -13,6 +13,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#if defined(_MSC_VER)
// supress "std::Equal1" warning suggesting using msvc "Checked Iterators"
#define _SCL_SECURE_NO_WARNINGS
#endif
#include <QANCollection.hxx>
#include <Draw_Interpretor.hxx>

View File

@@ -34,15 +34,7 @@
#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
#include <StepShape_ShapeDefinitionRepresentation.hxx>
#ifndef _WIN32
# include <pwd.h>
# include <netdb.h>
#else
# include <winsock2.h>
#endif
#include <stdio.h>
#include <OSD_Host.hxx>
#include <OSD_Process.hxx>
#include <Quantity_Date.hxx>
@@ -68,6 +60,10 @@
#include <StepAP203_HArray1OfApprovedItem.hxx>
#include <StepBasic_ProductCategory.hxx>
#ifndef _WIN32
# include <pwd.h>
#endif
//=======================================================================
//function : STEPConstruct_AP203Context
//purpose :
@@ -164,25 +160,15 @@ Handle(StepBasic_PersonAndOrganization) STEPConstruct_AP203Context::DefaultPerso
{
if ( defPersonAndOrganization.IsNull() ) {
// get IP address as a unique id of organization
#ifdef _WIN32 // adapted for NT which lacks gethostent()
char hostname[1024];
hostname[0] = '\0';
gethostname ( hostname, 1020 );
hostname[1020] = '\0';
struct hostent *he = gethostbyname ( hostname );
#else // adapted for Sun2.5, which lacks definition of gethostname()
struct hostent *he = gethostent();
while ( he && he->h_name && (unsigned char)he->h_addr_list[0][0] == 127 )
he = gethostent();
#endif
Handle(TCollection_HAsciiString) orgId = new TCollection_HAsciiString ( "" );
if ( he && he->h_addr_list && he->h_length >0 ) {
char str[100];
unsigned i1 = (unsigned char)he->h_addr_list[0][0];
unsigned i2 = (unsigned char)he->h_addr_list[0][1];
unsigned i3 = (unsigned char)he->h_addr_list[0][2];
sprintf ( str, "IP%03u.%03u.%03u.000", i1, i2, i3 );
orgId->AssignCat ( str );
Handle(TCollection_HAsciiString) orgId = new TCollection_HAsciiString ( "IP" );
OSD_Host aHost;
TCollection_AsciiString anIP = aHost.InternetAddress();
// cut off last number
Standard_Integer aLastDotIndex = anIP.SearchFromEnd (".");
if (aLastDotIndex >0)
{
anIP.Trunc (aLastDotIndex - 1);
orgId->AssignCat (anIP.ToCString());
}
// create organization

View File

@@ -11,4 +11,3 @@ TKG3d
TKGeomBase
TKGeomAlgo
TKXSBase
CSF_wsock32