~ fixed clang-tidy magic-number errors

This commit is contained in:
Julian Hinxlage 2019-11-12 15:03:17 +01:00
parent eb3c521038
commit a1f9f62f51
2 changed files with 19 additions and 18 deletions

View File

@ -52,17 +52,19 @@ void logTime(){
struct tm *timeinfo;
timeinfo = localtime(&rawtime);
if (timeinfo->tm_hour < 10) {
constexpr int decimalBase = 10;
if (timeinfo->tm_hour < decimalBase) {
std::cout << "0";
}
std::cout << timeinfo->tm_hour;
std::cout << ":";
if (timeinfo->tm_min < 10) {
if (timeinfo->tm_min < decimalBase) {
std::cout << "0";
}
std::cout << timeinfo->tm_min;
std::cout << ":";
if (timeinfo->tm_sec < 10) {
if (timeinfo->tm_sec < decimalBase) {
std::cout << "0";
}
std::cout << timeinfo->tm_sec;

View File

@ -5,26 +5,25 @@
#include <csignal>
#include <unistd.h>
// NOLINT
void initialize(int pid) {
impl.sharedMemoryPid = pid;
const int sharedMemoryKey = 12345;
impl.sharedMemoryKey = sharedMemoryKey;
impl.sharedMemoryKey = 12345;// NOLINT
const int sharedMemorySize = 8000;
impl.sharedMemorySize = sharedMemorySize;
impl.sharedMemorySize = 8000;// NOLINT
//set default values
setCharactersPerRow(60);
setCharactersPerColumn(20);
setHeight(600);
setWidth(800);
setMousePosition(42,42);
setBackgroundColor(Color(200,50,20));
setForegroundColor(Color(20,200,50));
setMode(GraphicMode::TrueColor);
setRedrawInterval(20);
setTimerInterruptInterval(10);
setCharactersPerRow(60);// NOLINT
setCharactersPerColumn(20);// NOLINT
setHeight(600);// NOLINT
setWidth(800);// NOLINT
setMousePosition(42,42);// NOLINT
setBackgroundColor(Color(200,50,20));// NOLINT
setForegroundColor(Color(20,200,50));// NOLINT
setMode(GraphicMode::TrueColor);// NOLINT
setRedrawInterval(20);// NOLINT
setTimerInterruptInterval(10);// NOLINT
}
bool registerEvent(EventType type, const std::function<void()> &handler) {
@ -68,7 +67,7 @@ Color getPixel(int x, int y) {
bool setText(std::string text) {
lockSharedMemory();
char *ptr = getTextArea();
for(int i = 0; i < text.size();i++){
for(int i = 0; i < static_cast<int>(text.size());i++){
if(i >= getCharactersPerColumn() * getCharactersPerRow()){
break;
}