l10ntools: replace boost::crc with rtl_crc32

Tested with output of "make translations", it apparently computes the
same CRC function, despite the documentation specifying different
polynomials, but maybe that is just different notations...

Change-Id: Ia28a881f5cdf54326fe5051527acd445e7a5771c
This commit is contained in:
Michael Stahl
2016-05-25 13:37:34 +02:00
parent da732faa82
commit 96fb3c52f5
2 changed files with 4 additions and 23 deletions

View File

@@ -22,14 +22,7 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
#ifdef _MSC_VER #include <rtl/crc.h>
#pragma warning (push, 1)
#pragma warning (disable: 4245)
#endif
#include <boost/crc.hpp>
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#include "gL10nMem.hxx" #include "gL10nMem.hxx"
#include "gConvPo.hxx" #include "gConvPo.hxx"
@@ -250,7 +243,6 @@ void convert_po::endSave()
string convert_po::genKeyId(const string& text) string convert_po::genKeyId(const string& text)
{ {
string newText(text); string newText(text);
boost::crc_32_type aCRC32;
int i; int i;
for (i = 0; (i = newText.find("\\\\", 0)) != (int)string::npos;) { for (i = 0; (i = newText.find("\\\\", 0)) != (int)string::npos;) {
@@ -263,8 +255,7 @@ string convert_po::genKeyId(const string& text)
newText.erase(i, 1); newText.erase(i, 1);
newText[i] = 0x0A; newText[i] = 0x0A;
} }
aCRC32.process_bytes(newText.c_str(), newText.length()); sal_uInt32 const nCRC = rtl_crc32(0, newText.c_str(), newText.length());
unsigned int nCRC = aCRC32.checksum();
string key; string key;
// Use simple ASCII characters, exclude I, l, 1 and O, 0 to avoid confusing IDs // Use simple ASCII characters, exclude I, l, 1 and O, 0 to avoid confusing IDs

View File

@@ -8,6 +8,7 @@
*/ */
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/crc.h>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
@@ -16,15 +17,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#ifdef _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4245)
#endif
#include <boost/crc.hpp>
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#include "po.hxx" #include "po.hxx"
#include "helper.hxx" #include "helper.hxx"
@@ -376,9 +368,7 @@ bool PoEntry::IsInSameComp(const PoEntry& rPo1,const PoEntry& rPo2)
OString PoEntry::genKeyId(const OString& rGenerator) OString PoEntry::genKeyId(const OString& rGenerator)
{ {
boost::crc_32_type aCRC32; sal_uInt32 nCRC = rtl_crc32(0, rGenerator.getStr(), rGenerator.getLength());
aCRC32.process_bytes(rGenerator.getStr(), rGenerator.getLength());
sal_uInt32 nCRC = aCRC32.checksum();
// Use simple ASCII characters, exclude I, l, 1 and O, 0 to avoid confusing IDs // Use simple ASCII characters, exclude I, l, 1 and O, 0 to avoid confusing IDs
static const char sSymbols[] = static const char sSymbols[] =
"ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789"; "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789";