Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
87486f87
Unverified
Commit
87486f87
authored
Jul 12, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert loading compressed dictionaries
parent
80e7da0f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
6 deletions
+40
-6
src/CifValidator.cpp
+40
-6
No files found.
src/CifValidator.cpp
View file @
87486f87
...
@@ -386,16 +386,50 @@ const Validator &ValidatorFactory::operator[](std::string_view dictionary)
...
@@ -386,16 +386,50 @@ const Validator &ValidatorFactory::operator[](std::string_view dictionary)
if
(
not
data
and
dict_name
.
extension
().
string
()
!=
".dic"
)
if
(
not
data
and
dict_name
.
extension
().
string
()
!=
".dic"
)
data
=
loadResource
(
dict_name
.
parent_path
()
/
(
dict_name
.
filename
().
string
()
+
".dic"
));
data
=
loadResource
(
dict_name
.
parent_path
()
/
(
dict_name
.
filename
().
string
()
+
".dic"
));
if
(
not
data
)
if
(
data
)
data
=
loadResource
(
dict_name
.
parent_path
()
/
(
dict_name
.
filename
().
string
()
+
".gz"
));
mValidators
.
emplace_back
(
dictionary
,
*
data
);
else
{
std
::
error_code
ec
;
if
(
not
data
and
dict_name
.
extension
().
string
()
!=
".dic"
)
// might be a compressed dictionary on disk
data
=
loadResource
(
dict_name
.
parent_path
()
/
(
dict_name
.
filename
().
string
()
+
".dic.gz"
));
fs
::
path
p
=
dict_name
;
if
(
p
.
extension
()
==
".dic"
)
p
=
p
.
parent_path
()
/
(
p
.
filename
().
string
()
+
".gz"
);
else
p
=
p
.
parent_path
()
/
(
p
.
filename
().
string
()
+
".dic.gz"
);
#if defined(CACHE_DIR) and defined(DATA_DIR)
if
(
not
fs
::
exists
(
p
,
ec
)
or
ec
)
{
for
(
const
char
*
dir
:
{
CACHE_DIR
,
DATA_DIR
})
{
auto
p2
=
fs
::
path
(
dir
)
/
p
;
if
(
fs
::
exists
(
p2
,
ec
)
and
not
ec
)
{
swap
(
p
,
p2
);
break
;
}
}
}
#endif
if
(
fs
::
exists
(
p
,
ec
)
and
not
ec
)
{
std
::
ifstream
file
(
p
,
std
::
ios
::
binary
);
if
(
not
file
.
is_open
())
throw
std
::
runtime_error
(
"Could not open dictionary ("
+
p
.
string
()
+
")"
);
if
(
not
data
)
io
::
filtering_stream
<
io
::
input
>
in
;
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
file
);
mValidators
.
emplace_back
(
dictionary
,
in
);
}
else
throw
std
::
runtime_error
(
"Dictionary not found or defined ("
+
dict_name
.
string
()
+
")"
);
throw
std
::
runtime_error
(
"Dictionary not found or defined ("
+
dict_name
.
string
()
+
")"
);
}
mValidators
.
emplace_back
(
dictionary
,
*
data
);
assert
(
iequals
(
mValidators
.
back
().
mName
,
dictionary
));
assert
(
iequals
(
mValidators
.
back
().
mName
,
dictionary
));
return
mValidators
.
back
();
return
mValidators
.
back
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment