| 790 | } |
| 791 | |
| 792 | static td::Status process_string_hex(Ctx &ctx) { |
| 793 | if (!ctx.is_string()) { |
| 794 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << ctx.path() << " must be a string"); |
| 795 | } |
| 796 | TRY_RESULT(v, ctx.get_string()); |
| 797 | if (v.size() % 2 != 0) { |
| 798 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << ctx.path() << " must be a hex string"); |
| 799 | } |
| 800 | for (auto c : v) { |
| 801 | bool is_hex = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); |
| 802 | if (!is_hex) { |
| 803 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << ctx.path() << " must be a hex string"); |
| 804 | } |
| 805 | } |
| 806 | return td::Status::OK(); |
| 807 | } |
| 808 | |
| 809 | static td::Status process_string_url_or_b64(Ctx &ctx) { |
| 810 | if (!ctx.is_string()) { |
nothing calls this directly
no test coverage detected