Skip to content

Commit 647dc12

Browse files
authored
Merge pull request #909 from openzim/windows_fixes
2 parents dc7b398 + bc65f30 commit 647dc12

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ else
3030
private_conf.set('ENABLE_USE_MMAP', get_option('USE_MMAP'))
3131
endif
3232
private_conf.set('ENABLE_USE_BUFFER_HEADER', get_option('USE_BUFFER_HEADER'))
33+
private_conf.set('ENABLE_XAPIAN_FULLER', get_option('with_xapian_fuller'))
3334

3435
static_linkage = get_option('static-linkage')
3536
static_linkage = static_linkage or get_option('default_library')=='static'

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ option('tests', type : 'boolean', value : true,
2222
description : 'Build the tests.')
2323
option('with_xapian', type : 'boolean', value: true,
2424
description: 'Build libzim with xapian support')
25+
option('with_xapian_fuller', type: 'boolean', value: true,
26+
description: 'Create xapian archive using "FULLER" compaction.\nThis is a workaround for a compilation issue on Windows. This will be removed soon')
2527
option('test_data_dir', type : 'string', value: '',
2628
description: 'Where the test data are. If not set, meson will use a internal directory in the build dir. If you want to download the data in the specified directory you can use `meson download_test_data`. As a special value, you can pass `none` to deactivate test using external test data.')

src/config.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#mesondefine ENABLE_XAPIAN
2121

22+
#mesondefine ENABLE_XAPIAN_FULLER
23+
2224
#mesondefine ENABLE_USE_MMAP
2325

2426
#mesondefine ENABLE_USE_BUFFER_HEADER

src/tools.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ uint32_t zim::countWords(const std::string& text)
6767
unsigned int i = 0;
6868

6969
// Find first word
70-
while ( i < length && std::isspace(text[i]) ) i++;
70+
while ( i < length && std::isspace(static_cast<unsigned char>(text[i])) ) i++;
7171

7272
while ( i < length ) {
7373
// Find end of word
74-
while ( i < length && !std::isspace(text[i]) ) i++;
74+
while ( i < length && !std::isspace(static_cast<unsigned char>(text[i])) ) i++;
7575
numWords++;
7676
// Find start of next word
77-
while ( i < length && std::isspace(text[i]) ) i++;
77+
while ( i < length && std::isspace(static_cast<unsigned char>(text[i])) ) i++;
7878
}
7979
return numWords;
8080
}

src/writer/xapianIndexer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,12 @@ void XapianIndexer::indexTitle(const std::string& path, const std::string& title
174174
void XapianIndexer::indexingPostlude()
175175
{
176176
this->writableDatabase.commit();
177-
this->writableDatabase.compact(indexPath, Xapian::DBCOMPACT_SINGLE_FILE|Xapian::Compactor::FULLER);
177+
#if defined ENABLE_XAPIAN_FULLER
178+
auto flags = Xapian::DBCOMPACT_SINGLE_FILE|Xapian::Compactor::FULLER;
179+
#else
180+
auto flags = Xapian::DBCOMPACT_SINGLE_FILE;
181+
#endif
182+
this->writableDatabase.compact(indexPath, flags);
178183
this->writableDatabase.close();
179184
}
180185

test/tooltesting.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ namespace {
8383
auto accentedString(ss.str());
8484
// Check our input data (that we have a char in the middle of a batch boundary)
8585
// Indexing is made on u16
86-
icu::UnicodeString ustring(accentedString.c_str());
86+
// `zim::removeAccents` calls `ucnv_setDefaultName` before creating the UnicodeString
87+
// so it will be converted using the right encoding ("utf8").
88+
// But we don't so we need to be explicit on the encoding here.
89+
icu::UnicodeString ustring(accentedString.c_str(), "utf8");
8790

8891
// Test input data.
8992
// "bépo" is 4 chars

0 commit comments

Comments
 (0)