libappimage-gcc10.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. diff --git a/src/libappimage/utils/StringSanitizer.cpp b/src/libappimage/utils/StringSanitizer.cpp
  2. index fee9f7d..521d82e 100644
  3. --- a/src/libappimage/utils/StringSanitizer.cpp
  4. +++ b/src/libappimage/utils/StringSanitizer.cpp
  5. @@ -13,6 +13,20 @@ std::string StringSanitizer::sanitizeForPath() {
  6. std::vector<std::string::value_type> buffer{};
  7. buffer.reserve(input_.size());
  8. + // these three lists can be used to compose alphabets for sanitization
  9. + static constexpr std::initializer_list<std::string::value_type> asciiLetters_ = {
  10. + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
  11. + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
  12. + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
  13. + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  14. + };
  15. + static constexpr std::initializer_list<std::string::value_type> asciiDigits_ = {
  16. + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  17. + };
  18. + static constexpr std::initializer_list<std::string::value_type> pathSafeChars_ = {
  19. + '.', '-', '_'
  20. + };
  21. +
  22. // first of all, we compose an alphabet of safe characters
  23. // all characters not contained in this alphabet will be replaced by some safe character, e.g., an underscore (_)
  24. std::vector<std::string::value_type> safeAlphabet{asciiDigits_.size() + asciiLetters_.size() + pathSafeChars_.size()};
  25. diff --git a/src/libappimage/utils/StringSanitizer.h b/src/libappimage/utils/StringSanitizer.h
  26. index 5301ec1..9919ed6 100644
  27. --- a/src/libappimage/utils/StringSanitizer.h
  28. +++ b/src/libappimage/utils/StringSanitizer.h
  29. @@ -10,20 +10,6 @@ class StringSanitizer {
  30. private:
  31. std::string input_;
  32. - // these three lists can be used to compose alphabets for sanitization
  33. - static constexpr std::initializer_list<std::string::value_type> asciiLetters_ = {
  34. - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
  35. - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
  36. - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
  37. - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  38. - };
  39. - static constexpr std::initializer_list<std::string::value_type> asciiDigits_ = {
  40. - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  41. - };
  42. - static constexpr std::initializer_list<std::string::value_type> pathSafeChars_ = {
  43. - '.', '-', '_'
  44. - };
  45. -
  46. public:
  47. /**
  48. * Default constructor.