1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
From: Markus Koschany <apo@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/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
+++ b/rts/lib/assimp/code/CMakeLists.txt
@@ -530,12 +530,6 @@ SET( IrrXML_SRCS
)
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
-SET( ConvertUTF_SRCS
- ../contrib/ConvertUTF/ConvertUTF.h
- ../contrib/ConvertUTF/ConvertUTF.c
-)
-SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS})
-
SET( Clipper_SRCS
../contrib/clipper/clipper.hpp
../contrib/clipper/clipper.cpp
@@ -638,7 +632,6 @@ ADD_LIBRARY( assimp STATIC
# Third-party libraries
${IrrXML_SRCS}
- ${ConvertUTF_SRCS}
${unzip_compile_SRCS}
${Poly2Tri_SRCS}
${Clipper_SRCS}
@@ -699,7 +692,6 @@ ADD_LIBRARY( assimp SHARED
# Third-party libraries
${IrrXML_SRCS}
- ${ConvertUTF_SRCS}
${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);
}
// ----------------------------------------------------------------------------------
|