Remove duplicated include
[LibreOffice.git] / external / zxcvbn-c / 0001-There-is-no-std-basic_string-int.patch.1
bloba1fe25bba08e6cffbf4bf6fee30ead80bc4dfd1f
1 From 92c6ea875231876ca264187326ce2d615d5ad543 Mon Sep 17 00:00:00 2001
2 From: Stephan Bergmann <stephan.bergmann@allotropia.de>
3 Date: Tue, 6 Feb 2024 13:14:08 +0100
4 Subject: There is no std::basic_string<int>
6 ...and at least LLVM 19 trunk libc++ complains about it now since
7 <c3668779c13596e223c26fbd49670d18cd638c40> "[libc++] Remove deprecated
8 char_traits base template (#72694)" with
10 > In file included from dict-generate.cpp:25:
11 > In file included from ~/llvm/inst/bin/../include/c++/v1/iostream:43:
12 > In file included from ~/llvm/inst/bin/../include/c++/v1/ios:223:
13 > In file included from ~/llvm/inst/bin/../include/c++/v1/__locale:24:
14 > ~/llvm/inst/bin/../include/c++/v1/string:746:43: error: implicit instantiation of undefined template 'std::char_traits<int>'
15 >   746 |   static_assert((is_same<_CharT, typename traits_type::char_type>::value),
16 >       |                                           ^
17 > dict-generate.cpp:861:18: note: in instantiation of template class 'std::basic_string<int>' requested here
18 >   861 |     StringOfInts Chld;
19 >       |                  ^
20 > ~/llvm/inst/bin/../include/c++/v1/__fwd/string.h:23:29: note: template is declared here
21 >    23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
22 >       |                             ^
24 etc., so use a std::vector<int> instead
25 ---
26  dict-generate.cpp | 12 ++++++------
27  1 file changed, 6 insertions(+), 6 deletions(-)
29 diff --git a/dict-generate.cpp b/dict-generate.cpp
30 index eebcca9..fcfaaea 100644
31 --- a/dict-generate.cpp
32 +++ b/dict-generate.cpp
33 @@ -22,6 +22,7 @@
34   *
35   **********************************************************************************/
37 +#include <algorithm>
38  #include <iostream>
39  #include <string>
40  #include <fstream>
41 @@ -387,7 +388,7 @@ typedef map<string, Entry> EntryMap_t;
42  typedef list<string> StringList_t;
43  typedef list<NodeSPtr> NodeList_t;
44  typedef set<StringInt> StringIntSet_t;
45 -typedef basic_string<int> StringOfInts;
46 +typedef vector<int> StringOfInts;
47  typedef vector<unsigned int> UintVect;
48  typedef vector<uint64_t> Uint64Vect;
49  typedef vector<StringInt *> StrIntPtrVect_t;
50 @@ -864,15 +865,14 @@ void CreateArrays(NodeSPtr Root, StringIntSet_t & StrSet, StringOfInts & ChildAd
51      for(Itc = Root->ChildBegin(); Itc != Root->ChildEnd(); ++Itc)
52      {
53          int i = Itc->second->GetAddr();
54 -        Chld += i;
55 +        Chld.push_back(i);
56      }
57      // Find where in pointer array the child pointer string is
58 -    StringOfInts::size_type x = ChildAddrs.find(Chld);
59 -    if (x == StringOfInts::npos)
60 +    StringOfInts::size_type x = search(ChildAddrs.begin(), ChildAddrs.end(), Chld.begin(), Chld.end()) - ChildAddrs.begin();
61 +    if (x == ChildAddrs.size())
62      {
63          // Not found, add it
64 -        x = ChildAddrs.length();
65 -        ChildAddrs += Chld;
66 +        ChildAddrs.insert(ChildAddrs.end(), Chld.begin(), Chld.end());
67      }
68      // Val will contain the final node data
69      uint64_t Val = Its->i;
70 -- 
71 2.43.0