From 4ee503b1accf3a344b3a27353cb038acdf46c159 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 25 Apr 2014 12:29:06 +0200 Subject: Use limits instead of stdint.h C++, sometimes you bother me --- src/StatsServer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/StatsServer.cpp b/src/StatsServer.cpp index ffe8623..c7cbc9d 100644 --- a/src/StatsServer.cpp +++ b/src/StatsServer.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "StatsServer.h" #include "Log.h" @@ -275,9 +276,11 @@ std::string InputStat::encodeJSON() { std::ostringstream ss; + const int16_t int16_max = std::numeric_limits::max(); + /* convert to dB */ - int dB_l = peak_left ? round(20*log10((double)peak_left / INT16_MAX)) : -90; - int dB_r = peak_right ? round(20*log10((double)peak_right / INT16_MAX)) : -90; + int dB_l = peak_left ? round(20*log10((double)peak_left / int16_max)) : -90; + int dB_r = peak_right ? round(20*log10((double)peak_right / int16_max)) : -90; ss << "{ \"inputstat\" : {" -- cgit v1.2.3