From da6ed07422f63ca57369c75ea9cd15b8a708ac86 Mon Sep 17 00:00:00 2001
From: Cinder <cinder@sdf.org>
Date: Mon, 9 Sep 2019 14:21:04 -0500
Subject: [PATCH] Use C++ includes for C headers

---
 indra/llcommon/StackWalker.cpp              | 14 +++++++-------
 indra/llcommon/linden_common.h              |  2 +-
 indra/llcommon/llapp.cpp                    |  2 +-
 indra/llcommon/llapp.h                      |  2 +-
 indra/llcommon/lldate.cpp                   |  4 ++--
 indra/llcommon/llfile.cpp                   |  4 ++--
 indra/llcommon/llfindlocale.cpp             |  8 ++++----
 indra/llcommon/llheartbeat.cpp              |  4 ++--
 indra/llcommon/llmemory.h                   |  2 +-
 indra/llcommon/llprocess.cpp                |  4 ++--
 indra/llcommon/llstring.h                   |  6 +++---
 indra/llcommon/llsys.cpp                    | 16 ++++++++--------
 indra/llcommon/lltimer.cpp                  |  2 +-
 indra/llcommon/lltimer.h                    |  2 +-
 indra/llcommon/lluuid.cpp                   |  2 +-
 indra/llcrashlogger/llcrashlock.cpp         |  2 +-
 indra/llcrashlogger/llcrashlock.h           |  2 +-
 indra/llinventory/lllandmark.cpp            |  2 +-
 indra/llinventory/llparcel.h                |  2 +-
 indra/llmath/llsimdmath.h                   |  2 +-
 indra/llmath/llvector4a.h                   |  2 +-
 indra/llmath/llvolume.cpp                   |  2 +-
 indra/llmath/llvolume.h                     |  2 ++
 indra/llmath/v3color.h                      |  2 +-
 indra/llmessage/llxfer_file.cpp             |  2 +-
 indra/llmessage/net.cpp                     |  2 +-
 indra/llplugin/llpluginsharedmemory.cpp     |  2 +-
 indra/llplugin/slplugin/slplugin.cpp        |  2 +-
 indra/llvfs/lldir.cpp                       |  2 +-
 indra/llvfs/lldir_win32.cpp                 |  2 +-
 indra/newview/llfilepicker.cpp              |  2 +-
 indra/newview/llfloaterland.cpp             |  2 +-
 indra/newview/lllocalbitmaps.cpp            |  2 +-
 indra/newview/llviewerwindow.cpp            |  2 +-
 indra/newview/llvoavatar.cpp                |  4 ++--
 indra/win_crash_logger/win_crash_logger.cpp |  2 +-
 36 files changed, 60 insertions(+), 58 deletions(-)

diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp
index 35604f2492..3611dea1f6 100644
--- a/indra/llcommon/StackWalker.cpp
+++ b/indra/llcommon/StackWalker.cpp
@@ -87,8 +87,8 @@
 
 #include <windows.h>
 #include <tchar.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
 #pragma comment(lib, "version.lib")  // for "VerQueryValue"
 
 #include "StackWalker.h"
@@ -1361,9 +1361,9 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
     }
   }
 #else
-#if LL_WINDOWS
-#pragma warning (push)
-#pragma warning (disable : 4996) // supress deprecated
+#if LL_WINDOWS
+#pragma warning (push)
+#pragma warning (disable : 4996) // supress deprecated
 #endif
   OSVERSIONINFOEXA ver;
   ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
@@ -1378,8 +1378,8 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
         OnOutput(buffer);
     }
   }
-#if LL_WINDOWS
-#pragma warning (pop)
+#if LL_WINDOWS
+#pragma warning (pop)
 #endif
 #endif
 }
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index 17fdd25bb3..a2a119a707 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -34,7 +34,7 @@
 
 #if defined(LL_WINDOWS) && defined(_DEBUG)
 #  define _CRTDBG_MAP_ALLOC
-#  include <stdlib.h>
+#  include <cstdlib>
 #  include <crtdbg.h>
 #endif
 
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index bc3d909904..a22285ec0c 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -57,7 +57,7 @@
 LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop);
 BOOL ConsoleCtrlHandler(DWORD fdwCtrlType);
 #else
-# include <signal.h>
+# include <csignal>
 # include <unistd.h> // for fork()
 void setup_signals();
 void default_unix_signal_handler(int signum, siginfo_t *info, void *);
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index 74c40ff195..3d2d464e85 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -34,7 +34,7 @@
 #include <atomic>
 
 #if LL_LINUX || LL_DARWIN
-#include <signal.h>
+#include <csignal>
 #endif
 
 class LLErrorThread;
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp
index e361672caf..6a3cb744fa 100644
--- a/indra/llcommon/lldate.cpp
+++ b/indra/llcommon/lldate.cpp
@@ -29,8 +29,8 @@
 #include "linden_common.h"
 #include "lldate.h"
 
-#include <time.h>
-#include <locale.h>
+#include <ctime>
+#include <clocale>
 #include <string>
 #include <iomanip>
 #include <iostream>
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index a5bb80e2e7..269ead229a 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -29,10 +29,10 @@
 
 #if LL_WINDOWS
 #include "llwin32headerslean.h"
-#include <stdlib.h>                 // Windows errno
+#include <cstdlib>                 // Windows errno
 #include <vector>
 #else
-#include <errno.h>
+#include <cerrno>
 #include <sys/file.h>
 #endif
 
diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp
index 3be3d4a0c0..fc44ea73ee 100644
--- a/indra/llcommon/llfindlocale.cpp
+++ b/indra/llcommon/llfindlocale.cpp
@@ -28,9 +28,9 @@
 
 #include "linden_common.h"
 
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
+#include <cstdlib>
+#include <cstring>
+#include <cctype>
 
 #ifdef WIN32
 #include "llwin32headers.h"
@@ -188,7 +188,7 @@ canonise_fl(FL_Locale *l) {
 
 
 #ifdef WIN32
-#include <stdio.h>
+#include <cstdio>
 #define ML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##pn##_##sn)
 #define MLN(pn) MAKELANGID(LANG_##pn, SUBLANG_DEFAULT)
 #define RML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##sn)
diff --git a/indra/llcommon/llheartbeat.cpp b/indra/llcommon/llheartbeat.cpp
index 19b7452748..68bb49548d 100644
--- a/indra/llcommon/llheartbeat.cpp
+++ b/indra/llcommon/llheartbeat.cpp
@@ -24,8 +24,8 @@
  * $/LicenseInfo$
  */
 
-#include <errno.h>
-#include <signal.h>
+#include <cerrno>
+#include <csignal>
 
 #include "linden_common.h"
 #include "llapp.h"
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 8fe553c9b7..53147a3838 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -30,7 +30,7 @@
 #include "llunits.h"
 #include "stdtypes.h"
 #if !LL_WINDOWS
-#include <stdint.h>
+#include <cstdint>
 #endif
 
 class LLMutex ;
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index 4702b5d931..1549e2fb77 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -1210,9 +1210,9 @@ static std::string WindowsErrorString(const std::string& operation)
 *****************************************************************************/
 #else // Mac and linux
 
-#include <signal.h>
+#include <csignal>
 #include <fcntl.h>
-#include <errno.h>
+#include <cerrno>
 #include <sys/wait.h>
 
 void LLProcess::autokill()
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 01b1d4e949..702c43f29c 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -40,11 +40,11 @@
 #include "llformat.h"
 
 #if LL_LINUX
-#include <wctype.h>
-#include <wchar.h>
+#include <cwctype>
+#include <cwchar>
 #endif
 
-#include <string.h>
+#include <cstring>
 #include <boost/scoped_ptr.hpp>
 
 const char LL_UNKNOWN_CHAR = '?';
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index e597d7c958..913b48afb2 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -54,10 +54,10 @@ using namespace llsd;
 #	include <VersionHelpers.h>
 #elif LL_DARWIN
 #   include "llsys_objc.h"
-#	include <errno.h>
+#	include <cerrno>
 #	include <sys/sysctl.h>
 #	include <sys/utsname.h>
-#	include <stdint.h>
+#	include <cstdint>
 #	include <CoreServices/CoreServices.h>
 #   include <stdexcept>
 #	include <mach/host_info.h>
@@ -65,7 +65,7 @@ using namespace llsd;
 #	include <mach/task.h>
 #	include <mach/task_info.h>
 #elif LL_LINUX
-#	include <errno.h>
+#	include <cerrno>
 #	include <sys/utsname.h>
 #	include <unistd.h>
 #	include <sys/sysinfo.h>
@@ -201,9 +201,9 @@ LLOSInfo::LLOSInfo() :
 		mOSStringSimple += "32-bit ";
 	}
 
-#if LL_WINDOWS
-#pragma warning (push)
-#pragma warning (disable : 4996) // compiler thinks might use uninitialized var, but no
+#if LL_WINDOWS
+#pragma warning (push)
+#pragma warning (disable : 4996) // compiler thinks might use uninitialized var, but no
 #endif
 	OSVERSIONINFOEX osvi;
 	BOOL bOsVersionInfoEx;
@@ -216,8 +216,8 @@ LLOSInfo::LLOSInfo() :
 		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 		bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi);
 	}
-#if LL_WINDOWS
-#pragma warning (pop)
+#if LL_WINDOWS
+#pragma warning (pop)
 #endif
 	
 	std::string tmpstr;
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 2103d0a43e..d40eaa2150 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -31,7 +31,7 @@
 #if LL_WINDOWS
 #	include "llwin32headerslean.h"
 #elif LL_LINUX || LL_DARWIN
-#   include <errno.h>
+#   include <cerrno>
 #	include <sys/time.h>
 #else 
 #	error "architecture not supported"
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index 010f290b24..f3e39dca0c 100644
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -30,7 +30,7 @@
 #if LL_LINUX || LL_DARWIN
 #include <sys/time.h>
 #endif
-#include <limits.h>
+#include <climits>
 
 #include "stdtypes.h"
 
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index dce597cef8..862157ef4d 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -613,7 +613,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id)
  */
 #include <unistd.h>
 #include <fcntl.h>
-#include <errno.h>
+#include <cerrno>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
diff --git a/indra/llcrashlogger/llcrashlock.cpp b/indra/llcrashlogger/llcrashlock.cpp
index a86e809aab..a4764b8067 100644
--- a/indra/llcrashlogger/llcrashlock.cpp
+++ b/indra/llcrashlogger/llcrashlock.cpp
@@ -38,7 +38,7 @@
 #include <boost/filesystem.hpp>  
 #include <string>
 #include <iostream>
-#include <stdio.h>
+#include <cstdio>
 
 
 #if LL_WINDOWS   //For windows platform.
diff --git a/indra/llcrashlogger/llcrashlock.h b/indra/llcrashlogger/llcrashlock.h
index 60b060b736..0edc99f0b7 100644
--- a/indra/llcrashlogger/llcrashlock.h
+++ b/indra/llcrashlogger/llcrashlock.h
@@ -32,7 +32,7 @@
 class LLSD;
 
 #if !LL_WINDOWS	//For non-windows platforms.
-#include <signal.h>
+#include <csignal>
 #endif
 
 //Crash reporter will now be kicked off by the viewer but otherwise
diff --git a/indra/llinventory/lllandmark.cpp b/indra/llinventory/lllandmark.cpp
index 2e68f902c4..194e5ab02f 100644
--- a/indra/llinventory/lllandmark.cpp
+++ b/indra/llinventory/lllandmark.cpp
@@ -27,7 +27,7 @@
 #include "linden_common.h"
 #include "lllandmark.h"
 
-#include <errno.h>
+#include <cerrno>
 
 #include "message.h"
 #include "llregionhandle.h"
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 135d0ca7b9..b154799ce0 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -26,7 +26,7 @@
 #ifndef LL_LLPARCEL_H
 #define LL_LLPARCEL_H
 
-#include <time.h>
+#include <ctime>
 #include <iostream>
 
 #include "lluuid.h"
diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h
index ec0116b9d2..1aab225934 100644
--- a/indra/llmath/llsimdmath.h
+++ b/indra/llmath/llsimdmath.h
@@ -36,7 +36,7 @@
 #endif
 
 #if !LL_WINDOWS
-#include <stdint.h>
+#include <cstdint>
 #endif
 
 #include <immintrin.h>
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index 2030e733db..c2d19507f6 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -30,7 +30,7 @@
 
 class LLRotation;
 
-#include <assert.h>
+#include <cassert>
 #include "llpreprocessor.h"
 #include "llmemory.h"
 
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index b53f187a1f..f257103264 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -29,7 +29,7 @@
 
 #include <set>
 #if !LL_WINDOWS
-#include <stdint.h>
+#include <cstdint>
 #endif
 
 #include "llerror.h"
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index f5e2186aca..43d46bf242 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -891,6 +891,8 @@ public:
 	class VertexMapData : public LLVolumeFace::VertexData
 	{
 	public:
+        VertexMapData() : mIndex(0) { }
+
 		U16 mIndex;
 
 		bool operator==(const LLVolumeFace::VertexData& rhs) const;
diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h
index ad8bab6ee9..3f6139b545 100644
--- a/indra/llmath/v3color.h
+++ b/indra/llmath/v3color.h
@@ -33,7 +33,7 @@ class LLVector4;
 #include "llerror.h"
 #include "llmath.h"
 #include "llsd.h"
-#include <string.h>
+#include <cstring>
 
 //  LLColor3 = |r g b|
 
diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp
index 50f5e90b6e..5581b3da6d 100644
--- a/indra/llmessage/llxfer_file.cpp
+++ b/indra/llmessage/llxfer_file.cpp
@@ -27,7 +27,7 @@
 #include "linden_common.h"
 
 #if !LL_WINDOWS
-#include <errno.h>
+#include <cerrno>
 #include <unistd.h>
 #endif
 
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index a76cf31301..76b90859f1 100644
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -39,7 +39,7 @@
 	#include <netinet/in.h>
 	#include <arpa/inet.h>
 	#include <fcntl.h>
-	#include <errno.h>
+	#include <cerrno>
 #endif
 
 // linden library includes
diff --git a/indra/llplugin/llpluginsharedmemory.cpp b/indra/llplugin/llpluginsharedmemory.cpp
index 9cd14eda66..c3f17d9529 100644
--- a/indra/llplugin/llpluginsharedmemory.cpp
+++ b/indra/llplugin/llpluginsharedmemory.cpp
@@ -67,7 +67,7 @@
 #elif USE_SHM_OPEN_SHARED_MEMORY
 	#include <sys/fcntl.h>
 	#include <sys/mman.h>
-	#include <errno.h>
+	#include <cerrno>
 #elif USE_WIN32_SHARED_MEMORY
 #include "llwin32headerslean.h"
 #endif // USE_APR_SHARED_MEMORY
diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp
index 198494e8f3..75776ab693 100644
--- a/indra/llplugin/slplugin/slplugin.cpp
+++ b/indra/llplugin/slplugin/slplugin.cpp
@@ -45,7 +45,7 @@
 #endif
 
 #if LL_DARWIN || LL_LINUX
-	#include <signal.h>
+	#include <csignal>
 #endif
 
 #if LL_DARWIN || LL_LINUX
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index b4483bc812..c43076c85e 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -29,7 +29,7 @@
 #if !LL_WINDOWS
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <errno.h>
+#include <cerrno>
 #else
 #include <direct.h>
 #endif
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index 040fae664b..f08f7083fe 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -37,7 +37,7 @@
 #include <fstream>
 
 #include <direct.h>
-#include <errno.h>
+#include <cerrno>
 #include <sys/types.h>
 #include <sys/stat.h>
 
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 6dbceaf1ff..77c4b1621e 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -47,7 +47,7 @@ extern "C" {
 #include <gdk/gdkx.h>
 #endif
 }
-#include <locale.h>
+#include <clocale>
 #endif // LL_GTK
 
 #endif // LL_SDL
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 6e2cc2b507..90cf9ee67c 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -27,7 +27,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include <sstream>
-#include <time.h>
+#include <ctime>
 
 #include "llfloaterland.h"
 
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 6e90708f13..2a385058b7 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -42,7 +42,7 @@
 #include "llimagepng.h"
 
 /* time headers */
-#include <time.h>
+#include <ctime>
 #include <ctime>
 
 /* misc headers */
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 3f3289c379..070eb78a33 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -29,7 +29,7 @@
 
 
 // system library includes
-#include <stdio.h>
+#include <cstdio>
 #include <iostream>
 #include <fstream>
 #include <algorithm>
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 13d939c8ad..694c7ba4b8 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -28,8 +28,8 @@
 
 #include "llvoavatar.h"
 
-#include <stdio.h>
-#include <ctype.h>
+#include <cstdio>
+#include <cctype>
 #include <sstream>
 #include <glm/vec3.hpp>
 #include <glm/mat4x4.hpp>
diff --git a/indra/win_crash_logger/win_crash_logger.cpp b/indra/win_crash_logger/win_crash_logger.cpp
index 58746eba02..ff58ea0cca 100644
--- a/indra/win_crash_logger/win_crash_logger.cpp
+++ b/indra/win_crash_logger/win_crash_logger.cpp
@@ -26,7 +26,7 @@
 
 #include "linden_common.h"
 #include "stdafx.h"
-#include <stdlib.h>
+#include <cstdlib>
 #include "llcrashloggerwindows.h"
 
 #ifdef _UNICODE
-- 
GitLab