MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / looksBinary

Function looksBinary

app/src/AI/FileSandbox.cpp:281–289  ·  view source on GitHub ↗

* @brief Returns true when a byte sample looks like binary (NUL byte or invalid UTF-8). */

Source from the content-addressed store, hash-verified

279 * @brief Returns true when a byte sample looks like binary (NUL byte or invalid UTF-8).
280 */
281static bool looksBinary(const QByteArray& sample)
282{
283 if (sample.contains('\0'))
284 return true;
285
286 auto decoder = QStringDecoder(QStringDecoder::Utf8);
287 (void)QString(decoder.decode(sample));
288 return decoder.hasError();
289}
290
291//--------------------------------------------------------------------------------------------------
292// Drop allow-list

Callers 2

readMethod · 0.85
searchFileFunction · 0.85

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected