From db3ed3b57a6dadc8cd5345cd4e23f0f0c346459c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 5 Oct 2015 23:05:30 -0500 Subject: [PATCH 1/4] this is the only difference between the swg libs and oci libs for 12.1 --- external/3rd/library/OCI/include/oratypes.h | 418 +++++++++----------- 1 file changed, 196 insertions(+), 222 deletions(-) diff --git a/external/3rd/library/OCI/include/oratypes.h b/external/3rd/library/OCI/include/oratypes.h index c2ef243b..37803bcb 100644 --- a/external/3rd/library/OCI/include/oratypes.h +++ b/external/3rd/library/OCI/include/oratypes.h @@ -1,19 +1,13 @@ -/* - Copyright (c) 1982, 2012, Oracle and/or its affiliates. All rights reserved. -*/ - -/* - * $Header: oracore3/public/oratypes.h /nt/22 2012/03/30 05:32:52 vtalluru Exp $ - */ - - +/* $RCSfile: oratypes.h $ $Date: 20-jul-00.13:44:19 + ---------------------------------------------------------------------- + Copyright (c) 1982, 2008, Oracle and/or its affiliates. All rights reserved. + ---------------------------------------------------------------------- */ #ifndef ORATYPES # define ORATYPES # define SX_ORACLE # define SX3_ORACLE - #ifndef ORASTDDEF # include # define ORASTDDEF @@ -24,299 +18,279 @@ # define ORALIMITS #endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif +/* --- Signed/Unsigned one-byte scalar (sb1/ub1) --- */ -#ifndef lint -typedef unsigned char ub1; -typedef signed char sb1; +#ifndef lint + typedef unsigned char ub1; + typedef signed char sb1; + typedef char eb1; #else -#define ub1 unsigned char -#define sb1 signed char -#endif - -#define UB1MAXVAL ((ub1)UCHAR_MAX) -#define UB1MINVAL ((ub1) 0) -#define SB1MAXVAL ((sb1)SCHAR_MAX) -#define SB1MINVAL ((sb1)SCHAR_MIN) -#define MINUB1MAXVAL ((ub1) 255) -#define MAXUB1MINVAL ((ub1) 0) -#define MINSB1MAXVAL ((sb1) 127) -#define MAXSB1MINVAL ((sb1) -127) - - - - -#ifndef lint -typedef unsigned short ub2; -typedef signed short sb2; -#else -#define ub2 unsigned short -#define sb2 signed short +# define ub1 unsigned char +# define sb1 signed char +# define eb1 char #endif -#define UB2MAXVAL ((ub2)USHRT_MAX) -#define UB2MINVAL ((ub2) 0) -#define SB2MAXVAL ((sb2) SHRT_MAX) -#define SB2MINVAL ((sb2) SHRT_MIN) -#define MINUB2MAXVAL ((ub2) 65535) -#define MAXUB2MINVAL ((ub2) 0) -#define MINSB2MAXVAL ((sb2) 32767) -#define MAXSB2MINVAL ((sb2)-32767) - +#define UB1MAXVAL ((ub1)UCHAR_MAX) +#define UB1MINVAL ((ub1) 0) +#define SB1MAXVAL ((sb1)SCHAR_MAX) +#define SB1MINVAL ((sb1)SCHAR_MIN) +#define MINUB1MAXVAL ((ub1) 255) +#define MAXUB1MINVAL ((ub1) 0) +#define MINSB1MAXVAL ((sb1) 127) +#define MAXSB1MINVAL ((sb1) -127) +#define EB1MAXVAL ((eb1)SCHAR_MAX) +#define EB1MINVAL ((eb1) 0) + +#define MINEB1MAXVAL ((eb1) 127) +#define MAXEB1MINVAL ((eb1) 0) + +#define UB1BITS CHAR_BIT +#define UB1MASK ((1 << ((uword)CHAR_BIT)) - 1) + +/* backwards compatibility */ + +#ifndef lint + typedef sb1 b1; +#else +# define b1 sb1 +#endif + +#define B1MAXVAL SB1MAXVAL +#define B1MINVAL SB1MINVAL + +/* --- Signed/Unsigned two-byte scalar (sb2/ub2) --- */ #ifndef lint -typedef unsigned int ub4; -typedef signed int sb4; -#else -#define eb4 int -#define ub4 unsigned int -#define sb4 signed int -#endif - -#define UB4MAXVAL ((ub4)UINT_MAX) -#define UB4MINVAL ((ub4) 0) -#define SB4MAXVAL ((sb4) INT_MAX) -#define SB4MINVAL ((sb4) INT_MIN) -#define MINUB4MAXVAL ((ub4) 4294967295) -#define MAXUB4MINVAL ((ub4) 0) -#define MINSB4MAXVAL ((sb4) 2147483647) -#define MAXSB4MINVAL ((sb4)-2147483647) + typedef unsigned short ub2; + typedef signed short sb2; + typedef short eb2; +#else +# define ub2 unsigned short +# define sb2 signed short +# define eb2 short +#endif +#define UB2MAXVAL ((ub2)USHRT_MAX) +#define UB2MINVAL ((ub2) 0) +#define SB2MAXVAL ((sb2) SHRT_MAX) +#define SB2MINVAL ((sb2) SHRT_MIN) + +#define MINUB2MAXVAL ((ub2) 65535) +#define MAXUB2MINVAL ((ub2) 0) +#define MINSB2MAXVAL ((sb2) 32767) +#define MAXSB2MINVAL ((sb2)-32767) + +#define EB2MAXVAL ((eb2) SHRT_MAX) +#define EB2MINVAL ((eb2) 0) + +#define MINEB2MAXVAL ((eb2) 32767) +#define MAXEB2MINVAL ((eb2) 0) + +/* backwards compatibility */ + +#ifndef lint + typedef sb2 b2; +#else +# define b2 sb2 +#endif + +#define B2MAXVAL SB2MAXVAL +#define B2MINVAL SB2MINVAL + +/* --- Signed/Unsigned four-byte scalar (sb4/ub4) --- */ + +#ifndef lint + typedef unsigned int ub4; + typedef signed int sb4; + typedef int eb4; +#else +# define ub4 unsigned int +# define sb4 signed int +# define eb4 int +#endif + +#define UB4MAXVAL ((ub4)UINT_MAX) +#define UB4MINVAL ((ub4) 0) +#define SB4MAXVAL ((sb4) INT_MAX) +#define SB4MINVAL ((sb4) INT_MIN) + +#define MINUB4MAXVAL ((ub4) 4294967295) +#define MAXUB4MINVAL ((ub4) 0) +#define MINSB4MAXVAL ((sb4) 2147483647) +#define MAXSB4MINVAL ((sb4)-2147483647) + +#define EB4MAXVAL ((eb4) INT_MAX) +#define EB4MINVAL ((eb4) 0) + +#define MINEB4MAXVAL ((eb4) 2147483647) +#define MAXEB4MINVAL ((eb4) 0) /* --- Signed/Unsigned eight-byte scalar (orasb8/oraub8) --- */ -#define ORAXB8_DEFINED +# define ORAXB8_DEFINED +# ifndef lint +# ifdef __LP64__ + typedef unsigned long oraub8; + typedef signed long orasb8; +# else + typedef unsigned long long oraub8; + typedef signed long long orasb8; +# endif /* __LP64__ */ + typedef oraub8 ub8; + typedef orasb8 sb8; +# else +# define ub8 oraub8 +# define sb8 orasb8 +# ifdef __LP64__ +# define oraub8 unsigned long +# define orasb8 signed long +# else +# define oraub8 unsigned long long +# define orasb8 signed long long +# endif /* __LP64__ */ +# endif /* !lint */ + +# define ORAUB8MINVAL ((oraub8)0) +# define ORAUB8MAXVAL ((oraub8)18446744073709551615) +# define ORASB8MINVAL ((orasb8)-9223372036854775808) +# define ORASB8MAXVAL ((orasb8) 9223372036854775807) + +# define MAXORAUB8MINVAL ((oraub8)0) +# define MINORAUB8MAXVAL ((oraub8)18446744073709551615) +# define MAXORASB8MINVAL ((orasb8)-9223372036854775807) +# define MINORASB8MAXVAL ((orasb8) 9223372036854775807) + +/* backwards compatibility */ + #ifndef lint -#ifndef __GNUC__ -#ifdef __BORLANDC__ - typedef unsigned __int64 oraub8; - typedef signed __int64 orasb8; + typedef sb4 b4; #else - typedef unsigned _int64 oraub8; - typedef signed _int64 orasb8; -#endif /* __BORLANDC__ */ -#else - typedef unsigned long long oraub8; - typedef signed long long orasb8; +# define b4 sb4 #endif - typedef oraub8 ub8; - typedef orasb8 sb8; -#else -# define ub8 oraub8 -# define sb8 orasb8 -# define oraub8 unsigned _int64 -# define orasb8 signed _int64 -#endif /* !lint */ -#define ORAUB8MINVAL ((oraub8)0) -#define ORAUB8MAXVAL ((oraub8)18446744073709551615) -#define ORASB8MINVAL ((orasb8)-9223372036854775808) -#define ORASB8MAXVAL ((orasb8) 9223372036854775807) - -#define MAXORAUB8MINVAL ((oraub8)0) -#define MINORAUB8MAXVAL ((oraub8)18446744073709551615) -#define MAXORASB8MINVAL ((orasb8)-9223372036854775807) -#define MINORASB8MAXVAL ((orasb8) 9223372036854775807) - - -#define UB1BITS CHAR_BIT -#define UB1MASK ((1 << ((uword)CHAR_BIT)) - 1) +#define B4MAXVAL SB4MAXVAL +#define B4MINVAL SB4MINVAL +/* --- Character pointer --- */ #ifdef lint # define oratext unsigned char #else - typedef unsigned char oratext; + typedef unsigned char oratext; #endif - -#ifndef lint -typedef char eb1; -typedef short eb2; -typedef int eb4; -#else -# define eb1 char -# define eb2 short -# define eb4 int -#endif - -#define EB1MAXVAL ((eb1)SCHAR_MAX) -#define EB1MINVAL ((eb1) 0) -#define MINEB1MAXVAL ((eb1) 127) -#define MAXEB1MINVAL ((eb1) 0) -#define EB2MAXVAL ((eb2) SHRT_MAX) -#define EB2MINVAL ((eb2) 0) -#define MINEB2MAXVAL ((eb2) 32767) -#define MAXEB2MINVAL ((eb2) 0) -#define EB4MAXVAL ((eb4) INT_MAX) -#define EB4MINVAL ((eb4) 0) -#define MINEB4MAXVAL ((eb4) 2147483647) -#define MAXEB4MINVAL ((eb4) 0) - - - - -#ifndef lint -typedef sb1 b1; -#else -#define b1 sb1 -#endif -#define B1MAXVAL SB1MAXVAL -#define B1MINVAL SB1MINVAL - -#ifndef lint -typedef sb2 b2; -#else -#define b2 sb2 -#endif -#define B2MAXVAL SB2MAXVAL -#define B2MINVAL SB2MINVAL - -#ifndef lint -typedef sb4 b4; -#else -#define b4 sb4 -#endif -# define B4MAXVAL SB4MAXVAL -# define B4MINVAL SB4MINVAL - - #if !defined(LUSEMFC) # ifdef lint -# define text unsigned char +# define text unsigned char +# define OraText oratext # else typedef oratext text; + typedef oratext OraText; # endif #endif -#ifdef lint -# define OraText unsigned char -#else - typedef oratext OraText; -#endif +#if !defined(MOTIF) && !defined(LISPL) && !defined(__cplusplus) && \ + !defined(LUSEMFC) + typedef OraText *string; +#endif #ifndef lint -typedef int eword; -typedef unsigned int uword; -typedef signed int sword; + typedef unsigned short utext; #else -#define eword int -#define uword unsigned int -#define sword signed int +# define utext unsigned short +#endif + +/* --- Boolean --- */ + +#ifndef boolean +# ifndef lint + typedef int boolean; +# else +# define boolean int +# endif +#endif + +/* --- Other data types --- */ + +#ifndef lint + typedef int eword; + typedef unsigned int uword; + typedef signed int sword; +#else +# define eword int +# define uword unsigned int +# define sword signed int #endif #define EWORDMAXVAL ((eword) INT_MAX) #define EWORDMINVAL ((eword) 0) + #define UWORDMAXVAL ((uword)UINT_MAX) #define UWORDMINVAL ((uword) 0) + #define SWORDMAXVAL ((sword) INT_MAX) #define SWORDMINVAL ((sword) INT_MIN) + #define MINEWORDMAXVAL ((eword) 2147483647) -#define MAXEWORDMINVAL ((eword) 0) +#define MAXEWORDMINVAL ((eword) 0) + #define MINUWORDMAXVAL ((uword) 4294967295) #define MAXUWORDMINVAL ((uword) 0) + #define MINSWORDMAXVAL ((sword) 2147483647) #define MAXSWORDMINVAL ((sword) -2147483647) - -#ifdef _WIN64 - #ifndef lint -#if defined(__BORLANDC__) || defined(__MINGW64__) -typedef unsigned __int64 ubig_ora; -typedef signed __int64 sbig_ora; + typedef unsigned long ubig_ora; + typedef signed long sbig_ora; #else -typedef unsigned _int64 ubig_ora; -typedef signed _int64 sbig_ora; -#endif /* End of __BORLANDC__ */ -#else -#define ubig_ora unsigned _int64 -#define sbig_ora signed _int64 -#endif /* End of lint */ - -#define UBIG_ORAMAXVAL ((ubig_ora)_UI64_MAX) -#define UBIG_ORAMINVAL ((ubig_ora) 0) -#define SBIG_ORAMAXVAL ((sbig_ora) _I64_MAX) -#define SBIG_ORAMINVAL ((sbig_ora) _I64_MIN) -#define MINUBIG_ORAMAXVAL ((ubig_ora) 4294967295) -#define MAXUBIG_ORAMINVAL ((ubig_ora) 0) -#define MINSBIG_ORAMAXVAL ((sbig_ora) 2147483647) -#define MAXSBIG_ORAMINVAL ((sbig_ora)-2147483647) - -#else - -#ifndef lint -typedef unsigned long ubig_ora; -typedef signed long sbig_ora; -#else -#define ubig_ora unsigned long -#define sbig_ora signed long +# define ubig_ora unsigned long +# define sbig_ora signed long #endif #define UBIG_ORAMAXVAL ((ubig_ora)ULONG_MAX) #define UBIG_ORAMINVAL ((ubig_ora) 0) + #define SBIG_ORAMAXVAL ((sbig_ora) LONG_MAX) #define SBIG_ORAMINVAL ((sbig_ora) LONG_MIN) + #define MINUBIG_ORAMAXVAL ((ubig_ora) 4294967295) #define MAXUBIG_ORAMINVAL ((ubig_ora) 0) + #define MINSBIG_ORAMAXVAL ((sbig_ora) 2147483647) #define MAXSBIG_ORAMINVAL ((sbig_ora)-2147483647) -#endif /* _WIN64 */ - #define UBIGORABITS (UB1BITS * sizeof(ubig_ora)) +/* --- Const --- */ #undef CONST #define CONST const +/* --- Misc --- */ #define dvoid void - typedef void (*lgenfp_t)( void ); - - #ifndef ORASYS_TYPES # include # define ORASYS_TYPES #endif - - -#ifndef boolean -# define boolean int -#endif - - - -#ifdef sparc -# define SIZE_TMAXVAL SB4MAXVAL -#else -# define SIZE_TMAXVAL UB4MAXVAL -#endif - -#define MINSIZE_TMAXVAL (size_t)4294967295 - - -#if !defined(MOTIF) && !defined(LISPL) && !defined(__cplusplus) && !defined(LUSEMFC) -typedef oratext *string; -#endif - -#ifndef lint -typedef unsigned short utext; -#else -#define utext unsigned short +#ifndef SIZE_TMAXVAL +# define SIZE_TMAXVAL UBIG_ORAMAXVAL #endif - -#endif +#ifndef MINSIZE_TMAXVAL +# define MINSIZE_TMAXVAL (size_t)4294967295 +#endif +#endif /* ORATYPES */ From 7b1f5a9991929554b84e6bc1d11fea10e7c3d681 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 6 Oct 2015 01:40:57 -0500 Subject: [PATCH 2/4] fix race condition when persisting large numbers of items --- .../src/shared/object/IntangibleObject.cpp | 14 ++++++++++---- .../src/shared/object/IntangibleObject.h | 2 +- .../serverGame/src/shared/object/ServerObject.cpp | 10 +++++++--- .../serverGame/src/shared/object/ServerObject.h | 2 +- .../src/shared/ScriptMethodsObjectCreate.cpp | 7 +++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp index 0f21840a..6d7b57c4 100644 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp @@ -404,7 +404,7 @@ void IntangibleObject::onPermanentlyDestroyed() * Persists this object in the database. Will also persist all the objects it * is keeping track of. */ -void IntangibleObject::persist() +bool IntangibleObject::persist() { if (isAuthoritative() && isTheater()) { @@ -412,11 +412,11 @@ void IntangibleObject::persist() { // we are not finished creating our objects, prevent persistance WARNING(true, ("IntangibleObject::persist called before all objects created")); - return; + return false; } if (isPersisted()) - return; + return true; ServerObject::persist(); @@ -470,9 +470,15 @@ void IntangibleObject::persist() } } + return true; + } - else + else { ServerObject::persist(); + return true; + } + + return false; } // IntangibleObject::persist //------------------------------------------------------------------------------------------ diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.h b/engine/server/library/serverGame/src/shared/object/IntangibleObject.h index 1d5a0b85..fc2d4cd4 100644 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.h +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.h @@ -44,7 +44,7 @@ public: virtual float alter(float time); virtual void onPermanentlyDestroyed(); - virtual void persist(); + virtual bool persist(); virtual bool isVisibleOnClient (const Client & client) const; virtual void getAttributes (stdvector >::fwd &data) const; virtual bool onContainerAboutToTransfer(ServerObject * destination, ServerObject* transferer); diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index c2856c47..c830ff31 100644 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -3214,11 +3214,11 @@ void ServerObject::onRemovedFromTriggerVolume(TriggerVolume & triggerVolume) * After this function is called, changes to this object will be sent to the database. */ -void ServerObject::persist() +bool ServerObject::persist() { // Do not persist buildout objects (buildout objects have negative networkIds) if (getNetworkId() < NetworkId::cms_invalid) - return; + return false; if (isAuthoritative()) { @@ -3232,7 +3232,7 @@ void ServerObject::persist() if (!contained && !isPlayerControlled() && getPosition_p() != Vector::zero) { WARNING_STRICT_FATAL(true, ("Tried to persist non-player object %s in a space scene away from the origin (not persisting).", getDebugInformation().c_str())); - return; + return false; } } else @@ -3257,11 +3257,15 @@ void ServerObject::persist() PositionUpdateTracker::sendPositionUpdate(*this); } + + return true; } else { sendControllerMessageToAuthServer(CM_persistObject, 0); } + + return false; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index e20e0e8e..32192ce3 100644 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -297,7 +297,7 @@ public: bool isInEndBaselines() const; bool isNeedingPobFixup() const; bool permanentlyDestroy (DeleteReasons::Enumerator reason); - virtual void persist (); + virtual bool persist (); virtual void onRemovingFromWorld (); virtual void unload (); void moveToPlayerAndUnload (const NetworkId &player); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp index ea707e31..37ab2bac 100644 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp @@ -1123,8 +1123,11 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env, ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - object->persist(); - return JNI_TRUE; + if (object->persist()) { + return JNI_TRUE; + } else { + return JNI_FALSE; + } } // JavaLibrary::persistObject /** From d74a55018ab4968a1e5baad98dc26fd93f324062 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 6 Oct 2015 14:07:52 -0500 Subject: [PATCH 3/4] for now use the old, eventually deprecated ABI of C++ until we fix it --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d5ba548..8c78cbb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,7 @@ elseif(UNIX) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -Wno-unknown-pragmas -Wno-reorder -O0") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 -s") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) endif() From 283792720c70d9b84601548d8cf727e793f893a7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 6 Oct 2015 16:35:46 -0500 Subject: [PATCH 4/4] add some hard coded paths --- cmake/linux/FindOracle.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/linux/FindOracle.cmake b/cmake/linux/FindOracle.cmake index 2d7427d7..1fe3dc03 100644 --- a/cmake/linux/FindOracle.cmake +++ b/cmake/linux/FindOracle.cmake @@ -34,6 +34,12 @@ if(DEFINED ENV{ORACLE_HOME}) find_path(ORACLE_INCLUDE_DIR NAMES oci.h PATHS + /usr/include/oracle/12.1/client64 + /usr/include/oracle/12.1/client + /usr/lib/oracle/12.1/client64 + /usr/share/oracle/12.1/client64 + /usr/lib/oracle/12.1/client + /usr/share/oracle/12.1/client ${ORACLE_HOME}/rdbms/public ${ORACLE_HOME}/include ${ORACLE_HOME}/sdk/include # Oracle SDK