New upstream version 19.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2017-06-29 21:01:10 +02:00
parent 3708b8e092
commit 1f1bbb3518
534 changed files with 13862 additions and 2459 deletions

View file

@ -580,6 +580,27 @@ static bool NonCorePackageInstalled(const char *name)
return false;
}
static inline bool is_64bit_windows(void)
{
#ifdef _WIN64
return true;
#else
BOOL x86 = false;
bool success = !!IsWow64Process(GetCurrentProcess(), &x86);
return success && !!x86;
#endif
}
static inline bool is_64bit_file(const char *file)
{
if (!file)
return false;
return strstr(file, "64bit") != nullptr ||
strstr(file, "64.dll") != nullptr ||
strstr(file, "64.exe") != nullptr;
}
#define UTF8ToWideBuf(wide, utf8) UTF8ToWide(wide, _countof(wide), utf8)
#define WideToUTF8Buf(utf8, wide) WideToUTF8(utf8, _countof(utf8), wide)
@ -592,6 +613,8 @@ static bool AddPackageUpdateFiles(json_t *root, size_t idx,
json_t *name = json_object_get(package, "name");
json_t *files = json_object_get(package, "files");
bool isWin64 = is_64bit_windows();
if (!json_is_array(files))
return true;
if (!json_is_string(name))
@ -628,6 +651,9 @@ static bool AddPackageUpdateFiles(json_t *root, size_t idx,
if (strlen(hashUTF8) != BLAKE2_HASH_LENGTH * 2)
continue;
if (!isWin64 && is_64bit_file(fileUTF8))
continue;
/* convert strings to wide */
wchar_t sourceURL[1024];
@ -972,10 +998,11 @@ static bool Update(wchar_t *cmdLine)
}
StringCbCopy(lpAppDataPath, sizeof(lpAppDataPath), pOut);
StringCbCat(lpAppDataPath, sizeof(lpAppDataPath),
L"\\obs-studio");
}
StringCbCat(lpAppDataPath, sizeof(lpAppDataPath),
L"\\obs-studio");
/* ------------------------------------- *
* Get download path */
@ -987,18 +1014,18 @@ static bool Update(wchar_t *cmdLine)
StringCbPrintf(manifestPath, sizeof(manifestPath),
L"%s\\updates\\manifest.json", lpAppDataPath);
if (!GetTempPathW(_countof(tempPath), tempPath)) {
if (!GetTempPathW(_countof(tempDirName), tempDirName)) {
Status(L"Update failed: Failed to get temp path: %ld",
GetLastError());
return false;
}
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempDirName)) {
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempPath)) {
Status(L"Update failed: Failed to create temp dir name: %ld",
GetLastError());
return false;
}
StringCbCat(tempPath, sizeof(tempPath), tempDirName);
DeleteFile(tempPath);
CreateDirectory(tempPath, nullptr);
/* ------------------------------------- *
@ -1086,7 +1113,8 @@ static bool Update(wchar_t *cmdLine)
* Send file hashes */
string newManifest;
{
if (json_array_size(files) > 0) {
char *post_body = json_dumps(files, JSON_COMPACT);
int responseCode;
@ -1117,6 +1145,8 @@ static bool Update(wchar_t *cmdLine)
responseCode);
return false;
}
} else {
newManifest = "[]";
}
/* ------------------------------------- *