| 124 | } |
| 125 | |
| 126 | void vtkWriter::EncodeWriteString(ostream* out, const char* name) |
| 127 | { |
| 128 | if (!name) |
| 129 | { |
| 130 | return; |
| 131 | } |
| 132 | int cc = 0; |
| 133 | |
| 134 | char buffer[10]; |
| 135 | |
| 136 | while (name[cc]) |
| 137 | { |
| 138 | // Encode spaces and %'s (and most non-printable ascii characters) |
| 139 | // The reader does not support spaces in strings. |
| 140 | if (name[cc] < 33 || name[cc] > 126 || name[cc] == '\"' || name[cc] == '%') |
| 141 | { |
| 142 | auto result = |
| 143 | vtk::format_to_n(buffer, sizeof(buffer), "{:02X}", static_cast<unsigned char>(name[cc])); |
| 144 | *result.out = '\0'; |
| 145 | *out << "%" << buffer; |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | *out << name[cc]; |
| 150 | } |
| 151 | cc++; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void vtkWriter::EncodeWriteString(ostream* out, const char* name, bool doublePercent) |
| 156 | { |
no test coverage detected