Skip to content

Commit

Permalink
fix incorrect formatting #1288
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreRouma committed Jan 22, 2024
1 parent e208511 commit 191f652
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/src/utils/proto/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "spectran_http_client.h"
#include <utils/flog.h>
#include <inttypes.h>

SpectranHTTPClient::SpectranHTTPClient(std::string host, int port, dsp::stream<dsp::complex_t>* stream) {
this->stream = stream;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 191f652

Please sign in to comment.