Skip to content

Commit

Permalink
Fix a clang warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Oct 29, 2024
1 parent e9fac59 commit 0961978
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions CesiumGltfReader/src/GltfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,23 +504,35 @@ void CesiumGltfReader::GltfReader::postprocessGltf(
resolvedBuffers.push_back(
pAssetAccessor
->get(asyncSystem, Uri::resolve(baseUrl, *buffer.uri), tHeaders)
.thenInWorkerThread(
[pBuffer =
&buffer](std::shared_ptr<IAssetRequest>&& pRequest) {
const IAssetResponse* pResponse = pRequest->response();

std::string bufferUri = *pBuffer->uri;

if (pResponse) {
pBuffer->uri = std::nullopt;
pBuffer->cesium.data = std::vector<std::byte>(
pResponse->data().begin(),
pResponse->data().end());
return ExternalBufferLoadResult{true, bufferUri};
}

return ExternalBufferLoadResult{false, bufferUri};
}));
.thenInWorkerThread([pBuffer =
&buffer](std::shared_ptr<IAssetRequest>&&
pRequest) {
std::string bufferUri = *pBuffer->uri;

const IAssetResponse* pResponse = pRequest->response();
if (!pResponse) {
return ExternalBufferLoadResult{
false,
bufferUri,
ErrorList::error("Request failed.")};
}

uint16_t statusCode = pResponse->statusCode();
if (statusCode != 0 &&
(statusCode < 200 || statusCode >= 300)) {
return ExternalBufferLoadResult{
false,
bufferUri,
ErrorList::error(
fmt::format("Received status code {}.", statusCode))};
}

pBuffer->uri = std::nullopt;
pBuffer->cesium.data = std::vector<std::byte>(
pResponse->data().begin(),
pResponse->data().end());
return ExternalBufferLoadResult{true, bufferUri, ErrorList()};
}));
}
}

Expand Down

0 comments on commit 0961978

Please sign in to comment.