From 8d8532f045507837b1c8db2dc1e0cd1b7dd67a54 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 12 Nov 2012 20:51:56 -0500 Subject: [PATCH] Fix encryption ASSumption Now we test the file we're trying to write to. We still support legacy xTEA BriceIsSmart/whatdoyousee files, but we will always make new files unencrypted. --- .../Plasma/PubUtilLib/plFile/plEncryptedStream.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp index f95530c6..0ea7c9da 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp @@ -562,8 +562,7 @@ hsStream* plEncryptedStream::OpenEncryptedFile(const wchar_t* fileName, uint32_t else s = new hsUNIXStream; - if (s) - s->Open(fileName, L"rb"); + s->Open(fileName, L"rb"); return s; } @@ -578,11 +577,10 @@ hsStream* plEncryptedStream::OpenEncryptedFileWrite(const char* fileName, uint32 hsStream* plEncryptedStream::OpenEncryptedFileWrite(const wchar_t* fileName, uint32_t* cryptKey) { hsStream* s = nil; -#ifdef PLASMA_EXTERNAL_RELEASE - s = new plEncryptedStream(cryptKey); -#else - s = new hsUNIXStream; -#endif + if (IsEncryptedFile(fileName)) + s = new plEncryptedStream(cryptKey); + else + s = new hsUNIXStream; s->Open(fileName, L"wb"); return s;