Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_nlp_eleves
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ParPIng
tp_nlp_eleves
Commits
0705ddc0
Commit
0705ddc0
authored
1 year ago
by
MERLINI Adrien
Browse files
Options
Downloads
Patches
Plain Diff
Fix handling of non ascii chars
parent
e83bb0aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main_2.cpp
+11
-3
11 additions, 3 deletions
main_2.cpp
with
11 additions
and
3 deletions
main_2.cpp
+
11
−
3
View file @
0705ddc0
...
...
@@ -10,6 +10,7 @@
#include
<mpi.h>
#include
<openssl/sha.h>
#define FIXED_WORD_SIZE 1
const
constexpr
size_t
word_buffer_length
=
8
+
1
;
bool
is_same_hash
(
const
unsigned
char
*
hash_1
,
const
unsigned
char
*
hash_2
)
...
...
@@ -50,20 +51,27 @@ std::vector<std::string> read_dict(const std::filesystem::path& path, size_t wor
{
std
::
ifstream
if_dict
(
path
);
std
::
vector
<
std
::
string
>
words
(
words_to_read
);
size_t
w
;
size_t
w
=
0
;
for
(
w
=
0
;
w
<
words_to_read
;
++
w
)
{
if
(
!
if_dict
.
good
())
{
--
w
;
break
;
}
std
::
getline
(
if_dict
,
words
[
w
]);
#if FIXED_WORD_SIZE
if
((
words
[
w
].
size
()
+
1
)
!=
word_buffer_length
)
--
w
;
#endif
}
if
(
w
<
words_to_read
)
{
words
.
resize
(
w
-
1
);
words
.
resize
(
w
+
1
);
std
::
cerr
<<
"The dictionary contained less words than requested."
<<
std
::
endl
;
}
std
::
cout
<<
"Loaded "
<<
w
<<
" words."
<<
std
::
endl
;
std
::
cout
<<
"Loaded "
<<
w
ords
.
size
()
<<
" words."
<<
std
::
endl
;
return
words
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment