Răsfoiți Sursa

UI: Fix warning in VisualStudio 2017

When building with VS2017 the compiler shows some warnings which is
undesirable.

The compiler rightly complains about declarations which hide older ones
which are trivially fixed.

Finally only POD types should be passed to variadic functions which is
why the String should be converted to c_str().
Relying on the current undefined behavior is a bad idea as it can change
with compilers and compiler versions.

Closes jp9000/obs-studio#902
e00E 8 ani în urmă
părinte
comite
26c28b4502
1 a modificat fișierele cu 8 adăugiri și 8 ștergeri
  1. 8 8
      UI/win-update/win-update.cpp

+ 8 - 8
UI/win-update/win-update.cpp

@@ -490,20 +490,20 @@ void AutoUpdateThread::info(const QString &title, const QString &text)
 			Q_ARG(QString, text));
 			Q_ARG(QString, text));
 }
 }
 
 
-int AutoUpdateThread::queryUpdateSlot(bool manualUpdate, const QString &text)
+int AutoUpdateThread::queryUpdateSlot(bool localManualUpdate, const QString &text)
 {
 {
-	OBSUpdate updateDlg(App()->GetMainWindow(), manualUpdate, text);
+	OBSUpdate updateDlg(App()->GetMainWindow(), localManualUpdate, text);
 	return updateDlg.exec();
 	return updateDlg.exec();
 }
 }
 
 
-int AutoUpdateThread::queryUpdate(bool manualUpdate, const char *text_utf8)
+int AutoUpdateThread::queryUpdate(bool localManualUpdate, const char *text_utf8)
 {
 {
 	int ret = OBSUpdate::No;
 	int ret = OBSUpdate::No;
 	QString text = text_utf8;
 	QString text = text_utf8;
 	QMetaObject::invokeMethod(this, "queryUpdateSlot",
 	QMetaObject::invokeMethod(this, "queryUpdateSlot",
 			Qt::BlockingQueuedConnection,
 			Qt::BlockingQueuedConnection,
 			Q_RETURN_ARG(int, ret),
 			Q_RETURN_ARG(int, ret),
-			Q_ARG(bool, manualUpdate),
+			Q_ARG(bool, localManualUpdate),
 			Q_ARG(QString, text));
 			Q_ARG(QString, text));
 	return ret;
 	return ret;
 }
 }
@@ -536,7 +536,7 @@ try {
 	string         text;
 	string         text;
 	string         error;
 	string         error;
 	string         signature;
 	string         signature;
-	CryptProvider  provider;
+	CryptProvider  localProvider;
 	BYTE           manifestHash[BLAKE2_HASH_LENGTH];
 	BYTE           manifestHash[BLAKE2_HASH_LENGTH];
 	bool           updatesAvailable = false;
 	bool           updatesAvailable = false;
 	bool           success;
 	bool           success;
@@ -579,7 +579,7 @@ try {
 	/* ----------------------------------- *
 	/* ----------------------------------- *
 	 * create signature provider           */
 	 * create signature provider           */
 
 
-	if (!CryptAcquireContext(&provider,
+	if (!CryptAcquireContext(&localProvider,
 	                         nullptr,
 	                         nullptr,
 	                         MS_ENH_RSA_AES_PROV,
 	                         MS_ENH_RSA_AES_PROV,
 	                         PROV_RSA_AES,
 	                         PROV_RSA_AES,
@@ -587,7 +587,7 @@ try {
 		throw strprintf("CryptAcquireContext failed: %lu",
 		throw strprintf("CryptAcquireContext failed: %lu",
 				GetLastError());
 				GetLastError());
 
 
-	::provider = provider;
+	provider = localProvider;
 
 
 	/* ----------------------------------- *
 	/* ----------------------------------- *
 	 * avoid downloading manifest again    */
 	 * avoid downloading manifest again    */
@@ -638,7 +638,7 @@ try {
 		if (responseCode == 404)
 		if (responseCode == 404)
 			return;
 			return;
 
 
-		throw strprintf("Failed to fetch manifest file: %s", error);   
+		throw strprintf("Failed to fetch manifest file: %s", error.c_str());
 	}
 	}
 
 
 	/* ----------------------------------- *
 	/* ----------------------------------- *