tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mozilla.patch (20171B)


      1 Legacy steps to update the library:
      2 
      3 - Update the "strtools_public.h" and "strtools_public.cpp" files, commenting out
      4  the "Uint64ToString", "wcsncpy_s", and "strncpy_s" functions.
      5  The "Uint64ToString" function name conflicts with another used in Gecko and
      6  the "errno_t" return type returned by the other functions is not defined in
      7  Mozilla's macOS continuous integration build environments.  Fortunately, the
      8  OpenVR SDK does not use these functions.
      9 
     10 - Replace the #define VR_INTERFACE in openvr.h to avoid extern'ing the functions.
     11  Unlike the usual OpenVR API builds, we are not building a separate dll.
     12 
     13 - Add explicit in CVRSettingHelper constructor.
     14 
     15 - In strtools_public.cpp/.h, ensure that UTF16to8 and UTF8to16 are only
     16  compiled under
     17      #if defined( _WIN32 )
     18  and redefine those functions to use ::WideCharToMultiByte and
     19  MultiByteToWideChar, respectively. These are modified because the original
     20  implementations contain unsupported try-catch.
     21 
     22 - In strtools_public.cpp, remove the definition of convert_type.
     23 
     24 - In strtools_public.cpp, remove the include of <codecvt>, as this causes
     25  problems in compiling on Linux.
     26 
     27 - In strtools_public.cpp, remove the include of <iostream>, as it implies a
     28  global constructor.
     29 
     30 - In pathtools_public.cpp/.h, comment out Path_UrlToFilePath and
     31  Path_FilePathToUrl to avoid a compile error because 'alloca' isn't defined.
     32 
     33 - In vrpathregistry_public.cpp, CVRPathRegistry_Public::BLoadFromFile contains
     34  a try-catch, which is not permitted. This code is simply commented out, but
     35      Bug 1640068 - OpenVR code can fail JSON parsing and raise exceptions
     36  is filed to address a safe fallback in the error condition.
     37 
     38 diff --git a/headers/openvr.h b/headers/openvr.h
     39 index ec26ef41564b9..b95fb1db7e0fe 100644
     40 --- a/headers/openvr.h
     41 +++ b/headers/openvr.h
     42 @@ -1932,30 +1932,33 @@ struct ImuSample_t
     43 
     44 #pragma pack( pop )
     45 
     46 +#define VR_INTERFACE
     47 +
     48 +// Mozilla: see mozilla.patch for more details
     49 // figure out how to import from the VR API dll
     50 -#if defined(_WIN32)
     51 -
     52 -  #if !defined(OPENVR_BUILD_STATIC)
     53 -    #ifdef VR_API_EXPORT
     54 -      #define VR_INTERFACE extern "C" __declspec( dllexport )
     55 -    #else
     56 -      #define VR_INTERFACE extern "C" __declspec( dllimport )
     57 -    #endif
     58 -  #else
     59 -    #define VR_INTERFACE extern "C"
     60 -  #endif
     61 -
     62 -#elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__)
     63 -
     64 -#ifdef VR_API_EXPORT
     65 -  #define VR_INTERFACE extern "C" __attribute__((visibility("default")))
     66 -#else
     67 -  #define VR_INTERFACE extern "C" 
     68 -#endif
     69 +// #if defined(_WIN32)
     70 
     71 -#else
     72 -  #error "Unsupported Platform."
     73 -#endif
     74 +//   #if !defined(OPENVR_BUILD_STATIC)
     75 +//     #ifdef VR_API_EXPORT
     76 +//       #define VR_INTERFACE extern "C" __declspec( dllexport )
     77 +//     #else
     78 +//       #define VR_INTERFACE extern "C" __declspec( dllimport )
     79 +//     #endif
     80 +//   #else
     81 +//     #define VR_INTERFACE extern "C"
     82 +//   #endif
     83 +
     84 +// #elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__)
     85 +
     86 +// #ifdef VR_API_EXPORT
     87 +//   #define VR_INTERFACE extern "C" __attribute__((visibility("default")))
     88 +// #else
     89 +//   #define VR_INTERFACE extern "C" 
     90 +// #endif
     91 +
     92 +// #else
     93 +//   #error "Unsupported Platform."
     94 +// #endif
     95 
     96 
     97 #if defined( _WIN32 )
     98 @@ -2557,7 +2560,8 @@ namespace vr
     99 	{
    100 		IVRSettings *m_pSettings;
    101 	public:
    102 -		CVRSettingHelper( IVRSettings *pSettings ) 
    103 +	  // Mozilla: see mozilla.patch for more details
    104 +		explicit CVRSettingHelper( IVRSettings *pSettings ) 
    105 		{ 
    106 			m_pSettings = pSettings; 
    107 		}
    108 diff --git a/src/pathtools_public.cpp b/src/pathtools_public.cpp
    109 index eb1373a57b1a5..e7f6d6ca1bf45 100644
    110 --- a/src/pathtools_public.cpp
    111 +++ b/src/pathtools_public.cpp
    112 @@ -798,52 +798,54 @@ bool Path_WriteStringToTextFileAtomic( const std::string &strFilename, const cha
    113 #define FILE_URL_PREFIX "file://"
    114 #endif
    115 
    116 +// Mozilla: see mozilla.patch for more details
    117 // ----------------------------------------------------------------------------------------------------------------------------
    118 // Purpose: Turns a path to a file on disk into a URL (or just returns the value if it's already a URL)
    119 // ----------------------------------------------------------------------------------------------------------------------------
    120 -std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath )
    121 -{
    122 -	if ( StringHasPrefix( sRelativePath, "http://" )
    123 -		|| StringHasPrefix( sRelativePath, "https://" )
    124 -		|| StringHasPrefix( sRelativePath, "vr-input-workshop://" )
    125 -		|| StringHasPrefix( sRelativePath, "file://" )
    126 -	   )
    127 -	{
    128 -		return sRelativePath;
    129 -	}
    130 -	else
    131 -	{
    132 -		std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath );
    133 -		if ( sAbsolute.empty() )
    134 -			return sAbsolute;
    135 -		sAbsolute = Path_FixSlashes( sAbsolute, '/' );
    136 -
    137 -		size_t unBufferSize = sAbsolute.length() * 3;
    138 -		char *pchBuffer = (char *)alloca( unBufferSize );
    139 -		V_URLEncodeFullPath( pchBuffer, (int)unBufferSize, sAbsolute.c_str(), (int)sAbsolute.length() );
    140 -
    141 -		return std::string( FILE_URL_PREFIX ) + pchBuffer;
    142 -	}
    143 -}
    144 -
    145 +// std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath )
    146 +// {
    147 +// 	if ( StringHasPrefix( sRelativePath, "http://" )
    148 +// 		|| StringHasPrefix( sRelativePath, "https://" )
    149 +// 		|| StringHasPrefix( sRelativePath, "vr-input-workshop://" )
    150 +// 		|| StringHasPrefix( sRelativePath, "file://" )
    151 +// 	   )
    152 +// 	{
    153 +// 		return sRelativePath;
    154 +// 	}
    155 +// 	else
    156 +// 	{
    157 +// 		std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath );
    158 +// 		if ( sAbsolute.empty() )
    159 +// 			return sAbsolute;
    160 +// 		sAbsolute = Path_FixSlashes( sAbsolute, '/' );
    161 +
    162 +// 		size_t unBufferSize = sAbsolute.length() * 3;
    163 +// 		char *pchBuffer = (char *)alloca( unBufferSize );
    164 +// 		V_URLEncodeFullPath( pchBuffer, (int)unBufferSize, sAbsolute.c_str(), (int)sAbsolute.length() );
    165 +
    166 +// 		return std::string( FILE_URL_PREFIX ) + pchBuffer;
    167 +// 	}
    168 +// }
    169 +
    170 +// Mozilla: see mozilla.patch for more details
    171 // -----------------------------------------------------------------------------------------------------
    172 // Purpose: Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned
    173 // -----------------------------------------------------------------------------------------------------
    174 -std::string Path_UrlToFilePath( const std::string & sFileUrl )
    175 -{
    176 -	if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) )
    177 -	{
    178 -		char *pchBuffer = (char *)alloca( sFileUrl.length() );
    179 -		V_URLDecodeNoPlusForSpace( pchBuffer, (int)sFileUrl.length(), 
    180 -			sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) );
    181 -
    182 -		return Path_FixSlashes( pchBuffer );
    183 -	}
    184 -	else
    185 -	{
    186 -		return "";
    187 -	}
    188 -}
    189 +// std::string Path_UrlToFilePath( const std::string & sFileUrl )
    190 +// {
    191 +// 	if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) )
    192 +// 	{
    193 +// 		char *pchBuffer = (char *)alloca( sFileUrl.length() );
    194 +// 		V_URLDecodeNoPlusForSpace( pchBuffer, (int)sFileUrl.length(), 
    195 +// 			sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) );
    196 +
    197 +// 		return Path_FixSlashes( pchBuffer );
    198 +// 	}
    199 +// 	else
    200 +// 	{
    201 +// 		return "";
    202 +// 	}
    203 +// }
    204 
    205 
    206 // -----------------------------------------------------------------------------------------------------
    207 diff --git a/src/pathtools_public.h b/src/pathtools_public.h
    208 index 9a120f43d6a57..33688fba2f4ad 100644
    209 --- a/src/pathtools_public.h
    210 +++ b/src/pathtools_public.h
    211 @@ -98,8 +98,9 @@ std::string Path_ReadTextFile( const std::string &strFilename );
    212 bool Path_WriteStringToTextFile( const std::string &strFilename, const char *pchData );
    213 bool Path_WriteStringToTextFileAtomic( const std::string &strFilename, const char *pchData );
    214 
    215 +// Mozilla: see mozilla.patch for more details
    216 /** Returns a file:// url for paths, or an http or https url if that's what was provided */
    217 -std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath );
    218 +// std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath );
    219 
    220 /** Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned */
    221 std::string Path_UrlToFilePath( const std::string & sFileUrl );
    222 diff --git a/src/strtools_public.cpp b/src/strtools_public.cpp
    223 index f9ce0fd5ea799..f52f8e9004982 100644
    224 --- a/src/strtools_public.cpp
    225 +++ b/src/strtools_public.cpp
    226 @@ -4,11 +4,12 @@
    227 #include <stdio.h>
    228 #include <stdlib.h>
    229 #include <sstream>
    230 -#include <codecvt>
    231 -#include <iostream>
    232 +// Mozilla: see mozilla.patch for more details
    233 +// #include <codecvt>
    234 +// #include <iostream>
    235 #include <functional>
    236 #include <locale>
    237 -#include <codecvt>
    238 +// #include <codecvt>
    239 
    240 #if defined( _WIN32 )
    241 #include <windows.h>
    242 @@ -57,40 +58,74 @@ bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string
    243 //-----------------------------------------------------------------------------
    244 // Purpose:
    245 //-----------------------------------------------------------------------------
    246 -typedef std::codecvt_utf8< wchar_t > convert_type;
    247 +// Mozilla: see mozilla.patch for more details
    248 +//typedef std::codecvt_utf8< wchar_t > convert_type;
    249 
    250 +// Mozilla: see mozilla.patch for more details
    251 +#if defined( _WIN32 )
    252 std::string UTF16to8(const wchar_t * in)
    253 {
    254 -	static std::wstring_convert< convert_type, wchar_t > s_converter;  // construction of this can be expensive (or even serialized) depending on locale
    255 -
    256 -	try
    257 -	{
    258 -		return s_converter.to_bytes( in );
    259 -	}
    260 -	catch ( ... )
    261 +	int retLength = ::WideCharToMultiByte(CP_UTF8, 0, in, -1, nullptr, 0, nullptr, nullptr);
    262 +	if (retLength == 0)
    263 	{
    264 		return std::string();
    265 	}
    266 +
    267 +	char* retString = new char[retLength];
    268 +	::WideCharToMultiByte(CP_UTF8, 0, in, -1, retString, retLength, nullptr, nullptr);
    269 +
    270 +	std::string retStringValue(retString);
    271 +
    272 +	delete[] retString;
    273 +
    274 +	return retStringValue;
    275 +
    276 +	// static std::wstring_convert< convert_type, wchar_t > s_converter;  // construction of this can be expensive (or even serialized) depending on locale
    277 +
    278 +	// try
    279 +	// {
    280 +	// 	return s_converter.to_bytes( in );
    281 +	// }
    282 +	// catch ( ... )
    283 +	// {
    284 +	// 	return std::string();
    285 +	// }
    286 }
    287 
    288 std::string UTF16to8( const std::wstring & in ) { return UTF16to8( in.c_str() ); }
    289 
    290 -
    291 +// Mozilla: see mozilla.patch for more details
    292 std::wstring UTF8to16(const char * in)
    293 {
    294 -	static std::wstring_convert< convert_type, wchar_t > s_converter;  // construction of this can be expensive (or even serialized) depending on locale
    295 -
    296 -	try
    297 -	{
    298 -		return s_converter.from_bytes( in );
    299 -	}
    300 -	catch ( ... )
    301 +	int retLength = ::MultiByteToWideChar(CP_UTF8, 0, in, -1, nullptr, 0);
    302 +	if (retLength == 0)
    303 	{
    304 		return std::wstring();
    305 	}
    306 +
    307 +	wchar_t* retString = new wchar_t[retLength];
    308 +	::MultiByteToWideChar(CP_UTF8, 0, in, -1, retString, retLength);
    309 +
    310 +	std::wstring retStringValue(retString);
    311 +
    312 +	delete[] retString;
    313 +
    314 +	return retStringValue;
    315 +
    316 +	//static std::wstring_convert< convert_type, wchar_t > s_converter;  // construction of this can be expensive (or even serialized) depending on locale
    317 +
    318 +	//try
    319 +	//{
    320 +	//	return s_converter.from_bytes( in );
    321 +	//}
    322 +	//catch ( ... )
    323 +	//{
    324 +	//	return std::wstring();
    325 +	//}
    326 }
    327 
    328 std::wstring UTF8to16( const std::string & in ) { return UTF8to16( in.c_str() ); }
    329 +#endif
    330 
    331 
    332 #if defined( _WIN32 )
    333 @@ -173,16 +208,17 @@ uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t
    334 
    335 
    336 /** Returns a std::string from a uint64_t */
    337 -std::string Uint64ToString( uint64_t ulValue )
    338 -{
    339 -	char buf[ 22 ];
    340 -#if defined( _WIN32 )
    341 -	sprintf_s( buf, "%llu", ulValue );
    342 -#else
    343 -    snprintf( buf, sizeof( buf ), "%llu", (long long unsigned int ) ulValue );
    344 -#endif
    345 -	return buf;
    346 -}
    347 +// Mozilla: see mozilla.patch for more details
    348 +// std::string Uint64ToString( uint64_t ulValue )
    349 +// {
    350 +// 	char buf[ 22 ];
    351 +// #if defined( _WIN32 )
    352 +// 	sprintf_s( buf, "%llu", ulValue );
    353 +// #else
    354 +//     snprintf( buf, sizeof( buf ), "%llu", (long long unsigned int ) ulValue );
    355 +// #endif
    356 +// 	return buf;
    357 +// }
    358 
    359 
    360 /** returns a uint64_t from a string */
    361 @@ -451,84 +487,85 @@ std::vector<std::string> TokenizeString( const std::string & sString, char cToke
    362 	return vecStrings;
    363 }
    364 
    365 +// Mozilla: see mozilla.patch for more details
    366 //-----------------------------------------------------------------------------
    367 // Purpose: Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere
    368 //-----------------------------------------------------------------------------
    369 -bool RepairUTF8( const char *pbegin, const char *pend, std::string & sOutputUtf8 )
    370 -{
    371 -	typedef std::codecvt_utf8<char32_t> facet_type;
    372 -	facet_type myfacet;
    373 -
    374 -	std::mbstate_t mystate = std::mbstate_t();
    375 -
    376 -	sOutputUtf8.clear();
    377 -	sOutputUtf8.reserve( pend - pbegin );
    378 -	bool bSqueakyClean = true;
    379 -
    380 -	const char *pmid = pbegin;
    381 -	while ( pmid != pend )
    382 -	{
    383 -		bool bHasError = false;
    384 -		bool bHasValidData = false;
    385 -
    386 -		char32_t out = 0xdeadbeef, *pout;
    387 -		pbegin = pmid;
    388 -		switch ( myfacet.in( mystate, pbegin, pend, pmid, &out, &out + 1, pout ) )
    389 -		{
    390 -		case facet_type::ok:
    391 -			bHasValidData = true;
    392 -			break;
    393 -
    394 -		case facet_type::noconv:
    395 -			// unexpected! always converting type
    396 -			bSqueakyClean = false;
    397 -			break;
    398 -
    399 -		case facet_type::partial:
    400 -			bHasError = pbegin == pmid;
    401 -			if ( bHasError )
    402 -			{
    403 -				bSqueakyClean = false;
    404 -			}
    405 -			else
    406 -			{
    407 -				bHasValidData = true;
    408 -			}
    409 -			break;
    410 -
    411 -		case facet_type::error:
    412 -			bHasError = true;
    413 -			bSqueakyClean = false;
    414 -			break;
    415 -		}
    416 -
    417 -		if ( bHasValidData )
    418 -		{
    419 -			// could convert back, but no need
    420 -			for ( const char *p = pbegin; p != pmid; ++p )
    421 -			{
    422 -				sOutputUtf8 += *p;
    423 -			}
    424 -		}
    425 -
    426 -		if ( bHasError )
    427 -		{
    428 -			sOutputUtf8 += '?';
    429 -		}
    430 -
    431 -		if ( pmid == pbegin )
    432 -		{
    433 -			pmid++;
    434 -		}
    435 -	}
    436 -
    437 -	return bSqueakyClean;
    438 -}
    439 -
    440 -//-----------------------------------------------------------------------------
    441 -// Purpose: Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere
    442 -//-----------------------------------------------------------------------------
    443 -bool RepairUTF8( const std::string & sInputUtf8, std::string & sOutputUtf8 )
    444 -{
    445 -	return RepairUTF8( sInputUtf8.data(), sInputUtf8.data() + sInputUtf8.size(), sOutputUtf8 );
    446 -}
    447 +// bool RepairUTF8( const char *pbegin, const char *pend, std::string & sOutputUtf8 )
    448 +// {
    449 +// 	typedef std::codecvt_utf8<char32_t> facet_type;
    450 +// 	facet_type myfacet;
    451 +
    452 +// 	std::mbstate_t mystate = std::mbstate_t();
    453 +
    454 +// 	sOutputUtf8.clear();
    455 +// 	sOutputUtf8.reserve( pend - pbegin );
    456 +// 	bool bSqueakyClean = true;
    457 +
    458 +// 	const char *pmid = pbegin;
    459 +// 	while ( pmid != pend )
    460 +// 	{
    461 +// 		bool bHasError = false;
    462 +// 		bool bHasValidData = false;
    463 +
    464 +// 		char32_t out = 0xdeadbeef, *pout;
    465 +// 		pbegin = pmid;
    466 +// 		switch ( myfacet.in( mystate, pbegin, pend, pmid, &out, &out + 1, pout ) )
    467 +// 		{
    468 +// 		case facet_type::ok:
    469 +// 			bHasValidData = true;
    470 +// 			break;
    471 +
    472 +// 		case facet_type::noconv:
    473 +// 			// unexpected! always converting type
    474 +// 			bSqueakyClean = false;
    475 +// 			break;
    476 +
    477 +// 		case facet_type::partial:
    478 +// 			bHasError = pbegin == pmid;
    479 +// 			if ( bHasError )
    480 +// 			{
    481 +// 				bSqueakyClean = false;
    482 +// 			}
    483 +// 			else
    484 +// 			{
    485 +// 				bHasValidData = true;
    486 +// 			}
    487 +// 			break;
    488 +
    489 +// 		case facet_type::error:
    490 +// 			bHasError = true;
    491 +// 			bSqueakyClean = false;
    492 +// 			break;
    493 +// 		}
    494 +
    495 +// 		if ( bHasValidData )
    496 +// 		{
    497 +// 			// could convert back, but no need
    498 +// 			for ( const char *p = pbegin; p != pmid; ++p )
    499 +// 			{
    500 +// 				sOutputUtf8 += *p;
    501 +// 			}
    502 +// 		}
    503 +
    504 +// 		if ( bHasError )
    505 +// 		{
    506 +// 			sOutputUtf8 += '?';
    507 +// 		}
    508 +
    509 +// 		if ( pmid == pbegin )
    510 +// 		{
    511 +// 			pmid++;
    512 +// 		}
    513 +// 	}
    514 +
    515 +// 	return bSqueakyClean;
    516 +// }
    517 +
    518 +// //-----------------------------------------------------------------------------
    519 +// // Purpose: Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere
    520 +// //-----------------------------------------------------------------------------
    521 +// bool RepairUTF8( const std::string & sInputUtf8, std::string & sOutputUtf8 )
    522 +// {
    523 +// 	return RepairUTF8( sInputUtf8.data(), sInputUtf8.data() + sInputUtf8.size(), sOutputUtf8 );
    524 +// }
    525 diff --git a/src/strtools_public.h b/src/strtools_public.h
    526 index 349b5b38fd387..067bbe1b1b074 100644
    527 --- a/src/strtools_public.h
    528 +++ b/src/strtools_public.h
    529 @@ -14,6 +14,8 @@ bool StringHasPrefixCaseSensitive( const std::string & sString, const std::strin
    530 bool StringHasSuffix( const std::string &sString, const std::string &sSuffix );
    531 bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string &sSuffix );
    532 
    533 +// Mozilla: see mozilla.patch for more details
    534 +#if defined( _WIN32 )
    535 /** converts a UTF-16 string to a UTF-8 string */
    536 std::string UTF16to8( const wchar_t * in );
    537 std::string UTF16to8( const std::wstring & in );
    538 @@ -22,6 +24,7 @@ std::string UTF16to8( const std::wstring & in );
    539 std::wstring UTF8to16(const char * in);
    540 std::wstring UTF8to16( const std::string & in );
    541 #define Utf16FromUtf8 UTF8to16
    542 +#endif
    543 
    544 #if defined( _WIN32 )
    545 std::string DefaultACPtoUTF8( const char *pszStr );
    546 @@ -69,15 +72,15 @@ inline int strnicmp( const char *pStr1, const char *pStr2, size_t unBufferLen )
    547 #if defined( OSX )
    548 // behaviors ensure NULL-termination at least as well as _TRUNCATE does, but
    549 // wcsncpy_s/strncpy_s can non-NULL-terminate, wcslcpy/strlcpy can not.
    550 -inline errno_t wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
    551 -{
    552 -	return wcslcpy(strDest, strSource, numberOfElements);
    553 -}
    554 +// inline errno_t wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
    555 +// {
    556 +// 	return wcslcpy(strDest, strSource, numberOfElements);
    557 +// }
    558 
    559 -inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
    560 -{
    561 -	return strlcpy(strDest, strSource, numberOfElements);
    562 -}
    563 +// inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
    564 +// {
    565 +// 	return strlcpy(strDest, strSource, numberOfElements);
    566 +// }
    567 
    568 #endif
    569 
    570 @@ -108,7 +111,8 @@ inline uint64_t strtoull(const char *str, char **endptr, int base) { return _str
    571 uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen );
    572 
    573 /** Returns a std::string from a uint64_t */
    574 -std::string Uint64ToString( uint64_t ulValue );
    575 +// Mozilla: see mozilla.patch for more details
    576 +//std::string Uint64ToString( uint64_t ulValue );
    577 
    578 /** returns a uint64_t from a string */
    579 uint64_t StringToUint64( const std::string & sValue );
    580 diff --git a/src/vrpathregistry_public.cpp b/src/vrpathregistry_public.cpp
    581 index 6a7f457bbacf3..f40fc1cda1acd 100644
    582 --- a/src/vrpathregistry_public.cpp
    583 +++ b/src/vrpathregistry_public.cpp
    584 @@ -208,7 +208,7 @@ bool CVRPathRegistry_Public::ToJsonString( std::string &sJsonString )
    585 	return true;
    586 }
    587 
    588 -
    589 +// Mozilla: see mozilla.patch for more details
    590 // ---------------------------------------------------------------------------
    591 // Purpose: Loads the config file from its well known location
    592 // ---------------------------------------------------------------------------
    593 @@ -239,7 +239,8 @@ bool CVRPathRegistry_Public::BLoadFromFile( std::string *psLoadError )
    594 	std::istringstream istream( sRegistryContents );
    595 	std::string sErrors;
    596 
    597 -	try {
    598 +// try
    599 +	{
    600 		if ( !parseFromStream( builder, istream, &root, &sErrors ) )
    601 		{
    602 			if ( psLoadError )
    603 @@ -257,14 +258,14 @@ bool CVRPathRegistry_Public::BLoadFromFile( std::string *psLoadError )
    604 			ParseStringListFromJson( &m_vecExternalDrivers, root, "external_drivers" );
    605 		}
    606 	}
    607 -	catch ( ... )
    608 -	{
    609 -		if ( psLoadError )
    610 -		{
    611 -			*psLoadError = "Unable to parse " + sRegPath + ": exception thrown in JSON library";
    612 -		}
    613 -		return false;
    614 -	}
    615 +// catch ( ... )
    616 +// {
    617 +// 	if ( psLoadError )
    618 +// 	{
    619 +// 		*psLoadError = "Unable to parse " + sRegPath + ": exception thrown in JSON library";
    620 +// 	}
    621 +// 	return false;
    622 +// }
    623 
    624 	return true;
    625 }