[spring] 09/10: Remove ConvertUTF functions. They are probably not needed at all.
Markus Koschany
apo at moszumanska.debian.org
Sat Jan 7 11:12:54 UTC 2017
This is an automated email from the git hooks/post-receive script.
apo pushed a commit to branch master
in repository spring.
commit b349ad8ac0e56fba3a48853882aad23f0a6a2444
Author: Markus Koschany <apo at debian.org>
Date: Fri Jan 6 19:52:19 2017 +0100
Remove ConvertUTF functions. They are probably not needed at all.
---
debian/patches/remove-ConvertUTF.patch | 176 ++++++++++++++++++++++++++++++++-
1 file changed, 174 insertions(+), 2 deletions(-)
diff --git a/debian/patches/remove-ConvertUTF.patch b/debian/patches/remove-ConvertUTF.patch
index 1c3b04f..d78963d 100644
--- a/debian/patches/remove-ConvertUTF.patch
+++ b/debian/patches/remove-ConvertUTF.patch
@@ -2,10 +2,146 @@ From: Markus Koschany <apo at debian.org>
Date: Fri, 6 Jan 2017 19:43:56 +0100
Subject: remove ConvertUTF
+The ConvertUTF* program is, according to Lintian, non-free. Hence we remove all
+code that relies on it.
+
+Forwarded: no
---
- rts/lib/assimp/code/CMakeLists.txt | 8 --------
- 1 file changed, 8 deletions(-)
+ rts/lib/assimp/code/BaseImporter.cpp | 95 -----------------------------------
+ rts/lib/assimp/code/BaseImporter.h | 3 --
+ rts/lib/assimp/code/CMakeLists.txt | 8 ---
+ rts/lib/assimp/code/OgreMaterial.cpp | 1 -
+ rts/lib/assimp/code/XFileImporter.cpp | 1 -
+ rts/lib/assimp/code/irrXMLWrapper.h | 1 -
+ 6 files changed, 109 deletions(-)
+diff --git a/rts/lib/assimp/code/BaseImporter.cpp b/rts/lib/assimp/code/BaseImporter.cpp
+index 3c6bdb5..0de7e14 100644
+--- a/rts/lib/assimp/code/BaseImporter.cpp
++++ b/rts/lib/assimp/code/BaseImporter.cpp
+@@ -262,100 +262,6 @@ void BaseImporter::SetupProperties(const Importer* /*pImp*/)
+ return false;
+ }
+
+-#include "../contrib/ConvertUTF/ConvertUTF.h"
+-
+-// ------------------------------------------------------------------------------------------------
+-void ReportResult(ConversionResult res)
+-{
+- if(res == sourceExhausted) {
+- DefaultLogger::get()->error("Source ends with incomplete character sequence, transformation to UTF-8 fails");
+- }
+- else if(res == sourceIllegal) {
+- DefaultLogger::get()->error("Source contains illegal character sequence, transformation to UTF-8 fails");
+- }
+-}
+-
+-// ------------------------------------------------------------------------------------------------
+-// Convert to UTF8 data
+-void BaseImporter::ConvertToUTF8(std::vector<char>& data)
+-{
+- ConversionResult result;
+- if(data.size() < 8) {
+- throw DeadlyImportError("File is too small");
+- }
+-
+- // UTF 8 with BOM
+- if((uint8_t)data[0] == 0xEF && (uint8_t)data[1] == 0xBB && (uint8_t)data[2] == 0xBF) {
+- DefaultLogger::get()->debug("Found UTF-8 BOM ...");
+-
+- std::copy(data.begin()+3,data.end(),data.begin());
+- data.resize(data.size()-3);
+- return;
+- }
+-
+- // UTF 32 BE with BOM
+- if(*((uint32_t*)&data.front()) == 0xFFFE0000) {
+-
+- // swap the endianess ..
+- for(uint32_t* p = (uint32_t*)&data.front(), *end = (uint32_t*)&data.back(); p <= end; ++p) {
+- AI_SWAP4P(p);
+- }
+- }
+-
+- // UTF 32 LE with BOM
+- if(*((uint32_t*)&data.front()) == 0x0000FFFE) {
+- DefaultLogger::get()->debug("Found UTF-32 BOM ...");
+-
+- const uint32_t* sstart = (uint32_t*)&data.front()+1, *send = (uint32_t*)&data.back()+1;
+- char* dstart,*dend;
+- std::vector<char> output;
+- do {
+- output.resize(output.size()?output.size()*3/2:data.size()/2);
+- dstart = &output.front(),dend = &output.back()+1;
+-
+- result = ConvertUTF32toUTF8((const UTF32**)&sstart,(const UTF32*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion);
+- } while(result == targetExhausted);
+-
+- ReportResult(result);
+-
+- // copy to output buffer.
+- const size_t outlen = (size_t)(dstart-&output.front());
+- data.assign(output.begin(),output.begin()+outlen);
+- return;
+- }
+-
+- // UTF 16 BE with BOM
+- if(*((uint16_t*)&data.front()) == 0xFFFE) {
+-
+- // swap the endianess ..
+- for(uint16_t* p = (uint16_t*)&data.front(), *end = (uint16_t*)&data.back(); p <= end; ++p) {
+- ByteSwap::Swap2(p);
+- }
+- }
+-
+- // UTF 16 LE with BOM
+- if(*((uint16_t*)&data.front()) == 0xFEFF) {
+- DefaultLogger::get()->debug("Found UTF-16 BOM ...");
+-
+- const uint16_t* sstart = (uint16_t*)&data.front()+1, *send = (uint16_t*)(&data.back()+1);
+- char* dstart,*dend;
+- std::vector<char> output;
+- do {
+- output.resize(output.size()?output.size()*3/2:data.size()*3/4);
+- dstart = &output.front(),dend = &output.back()+1;
+-
+- result = ConvertUTF16toUTF8((const UTF16**)&sstart,(const UTF16*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion);
+- } while(result == targetExhausted);
+-
+- ReportResult(result);
+-
+- // copy to output buffer.
+- const size_t outlen = (size_t)(dstart-&output.front());
+- data.assign(output.begin(),output.begin()+outlen);
+- return;
+- }
+-}
+-
+ // ------------------------------------------------------------------------------------------------
+ void BaseImporter::TextFileToBuffer(IOStream* stream,
+ std::vector<char>& data)
+@@ -373,7 +279,6 @@ void BaseImporter::TextFileToBuffer(IOStream* stream,
+ throw DeadlyImportError("File read error");
+ }
+
+- ConvertToUTF8(data);
+
+ // append a binary zero to simplify string parsing
+ data.push_back(0);
+diff --git a/rts/lib/assimp/code/BaseImporter.h b/rts/lib/assimp/code/BaseImporter.h
+index e701bca..a5dd838 100644
+--- a/rts/lib/assimp/code/BaseImporter.h
++++ b/rts/lib/assimp/code/BaseImporter.h
+@@ -324,9 +324,6 @@ public: // static utilities
+ *
+ * @param data File buffer to be converted to UTF8 data. The buffer
+ * is resized as appropriate. */
+- static void ConvertToUTF8(
+- std::vector<char>& data);
+-
+ // -------------------------------------------------------------------
+ /** Utility for text file loaders which copies the contents of the
+ * file into a memory buffer and converts it to our UTF8
diff --git a/rts/lib/assimp/code/CMakeLists.txt b/rts/lib/assimp/code/CMakeLists.txt
index 72e1fc1..dc4739e 100644
--- a/rts/lib/assimp/code/CMakeLists.txt
@@ -39,3 +175,39 @@ index 72e1fc1..dc4739e 100644
${unzip_compile_SRCS}
${Poly2Tri_SRCS}
${Clipper_SRCS}
+diff --git a/rts/lib/assimp/code/OgreMaterial.cpp b/rts/lib/assimp/code/OgreMaterial.cpp
+index 177c8ea..c105425 100644
+--- a/rts/lib/assimp/code/OgreMaterial.cpp
++++ b/rts/lib/assimp/code/OgreMaterial.cpp
+@@ -155,7 +155,6 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const
+ boost::scoped_ptr<IOStream> MaterialFile(MatFilePtr);
+ vector<char> FileData(MaterialFile->FileSize());
+ MaterialFile->Read(&FileData[0], MaterialFile->FileSize(), 1);
+- BaseImporter::ConvertToUTF8(FileData);
+
+ ss << &FileData[0];
+ }
+diff --git a/rts/lib/assimp/code/XFileImporter.cpp b/rts/lib/assimp/code/XFileImporter.cpp
+index 26c42ba..42867b5 100644
+--- a/rts/lib/assimp/code/XFileImporter.cpp
++++ b/rts/lib/assimp/code/XFileImporter.cpp
+@@ -103,7 +103,6 @@ void XFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene, I
+ // in the hope that binary files will never start with a BOM ...
+ mBuffer.resize( fileSize + 1);
+ file->Read( &mBuffer.front(), 1, fileSize);
+- ConvertToUTF8(mBuffer);
+
+ // parse the file into a temporary representation
+ XFileParser parser( mBuffer);
+diff --git a/rts/lib/assimp/code/irrXMLWrapper.h b/rts/lib/assimp/code/irrXMLWrapper.h
+index f5e9c30..efc4070 100644
+--- a/rts/lib/assimp/code/irrXMLWrapper.h
++++ b/rts/lib/assimp/code/irrXMLWrapper.h
+@@ -87,7 +87,6 @@ public:
+ data.resize(stream->FileSize());
+ stream->Read(&data[0],data.size(),1);
+
+- BaseImporter::ConvertToUTF8(data);
+ }
+
+ // ----------------------------------------------------------------------------------
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/spring.git
More information about the Pkg-games-commits
mailing list