From 191f652fc3b8aca020d105900cc9437735f5d022 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 22 Jan 2024 17:05:50 +0100 Subject: [PATCH] fix incorrect formatting #1288 --- core/src/utils/proto/http.cpp | 1 + .../spectran_http_source/src/spectran_http_client.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/utils/proto/http.cpp b/core/src/utils/proto/http.cpp index 8821f976..8e6119a7 100644 --- a/core/src/utils/proto/http.cpp +++ b/core/src/utils/proto/http.cpp @@ -63,6 +63,7 @@ namespace net::http { std::string MessageHeader::getField(const std::string name) { // TODO: Check if exists + // TODO: Maybe declare the set/get field functions to do type conversions automatically? return fields[name]; } diff --git a/source_modules/spectran_http_source/src/spectran_http_client.cpp b/source_modules/spectran_http_source/src/spectran_http_client.cpp index 77a19328..5b6fe142 100644 --- a/source_modules/spectran_http_source/src/spectran_http_client.cpp +++ b/source_modules/spectran_http_source/src/spectran_http_client.cpp @@ -1,5 +1,6 @@ #include "spectran_http_client.h" #include +#include SpectranHTTPClient::SpectranHTTPClient(std::string host, int port, dsp::stream* stream) { this->stream = stream; @@ -50,10 +51,10 @@ void SpectranHTTPClient::setCenterFrequency(uint64_t freq) { // Make request net::http::RequestHeader rqhdr(net::http::METHOD_PUT, "/control", host); char buf[1024]; - sprintf(buf, "{\"frequencyCenter\":%d,\"frequencySpan\":%d,\"type\":\"capture\"}", freq, _samplerate); + sprintf(buf, "{\"frequencyCenter\":%" PRIu64 ",\"frequencySpan\":%" PRIu64 ",\"type\":\"capture\"}", freq, _samplerate); std::string data = buf; char lenBuf[16]; - sprintf(lenBuf, "%d", data.size()); + sprintf(lenBuf, "%" PRIu64, data.size()); rqhdr.setField("Content-Length", lenBuf); controlHttp.sendRequestHeader(rqhdr); controlSock->sendstr(data);