Closed nijel closed 6 years ago
Thanks for info @nijel , can you run t_json test on one of this architecture with this patch?:
diff --git a/src/stardict_lib.cpp b/src/stardict_lib.cpp
index 63e23f5..7f222fd 100644
--- a/src/stardict_lib.cpp
+++ b/src/stardict_lib.cpp
@@ -539,6 +539,7 @@ inline const gchar *OffsetIndex::read_first_on_page_key(glong page_idx)
const size_t nitems = fread(wordentry_buf,
std::min(sizeof(wordentry_buf), static_cast<size_t>(page_size)),
1, idxfile);
+ fprintf(stderr, "%p %lld %llu %zu %p %zu\n", idxfile, (long long)page_idx, (long long unsigned)page_size, nitems, wordentry_buf, sizeof(wordentry_buf));
THROW_IF_ERROR(nitems == 1);
//TODO: check returned values, deal with word entry that strlen>255.
return wordentry_buf;
Probably yes, I will look into this next week.
From the gdb session:
(gdb) print page_idx
$3 = 0
(gdb) print idxfile
$4 = (FILE *) 0x200a5140
(gdb) print page_size
$5 = 385875968
(gdb) print nitems
$6 = 0
(gdb) print wordentry_buf
$7 = "\321\207\320\265\320\273\320\276\320\262\320\265\320\272\000\000\000\000\000\000\000\000\031", '\000' <repeats 240 times>
(gdb) print sizeof(wordentry_buf)
$9 = 264
IMHO it seems that page_size is wrong...
The problem is in cache loading, following workaround works:
diff --git a/src/stardict_lib.cpp b/src/stardict_lib.cpp
index 63e23f5..1c91fe3 100644
--- a/src/stardict_lib.cpp
+++ b/src/stardict_lib.cpp
@@ -561,6 +561,7 @@ inline const gchar *OffsetIndex::get_first_on_page_key(glong page_idx)
bool OffsetIndex::load_cache(const std::string &url)
{
const std::list<std::string> vars = get_cache_variant(url);
+ return false;
for (const std::string &item : vars) {
struct ::stat idxstat, cachestat;
Okay the problem is that the cache loading code doesn't detect as invalid caches created on other architecture and testsuite ships tests/rus-eng-stardict-2.4.2/1.xdxf.idx.oft
created on little endian machine. This leads to loading wrong offsets.
Should be fixed by https://github.com/Dushistov/sdcv/pull/38
Both fail with:
Problematic code:
https://github.com/Dushistov/sdcv/blob/925a4bc163f181c762681c59082de9598a79ddd4/src/stardict_lib.cpp#L535-L545