From e708a71b6482b4baddfa96e3b1ade51f8450e471 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 20 Apr 2017 18:19:29 -0700 Subject: [PATCH] handle 16 byte hash while reading in TextureCache --- .../model-networking/src/model-networking/TextureCache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index 761f55068b..c8765e0a52 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -559,13 +559,16 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() { }); std::string filename; std::string hash; - if (found == keyValues.end() || found->_value.size() != 32) { + if (found == keyValues.end() || found->_value.size() != gpu::SOURCE_HASH_BYTES) { qWarning("Invalid source hash key found, bailing"); _ktxResourceState = FAILED_TO_LOAD; finishedLoading(false); return; } else { - hash = filename = std::string(reinterpret_cast(found->_value.data()), 32); + // at this point the source hash is in binary 16-byte form + // and we need it in a hexadecimal string + auto binaryHash = QByteArray(reinterpret_cast(found->_value.data()), gpu::SOURCE_HASH_BYTES); + hash = filename = binaryHash.toHex().toStdString(); } auto textureCache = DependencyManager::get();