Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue fix for spdlog #595. Conversion warning.
See: #595 On line 85 in file sinks/wincolor_sink.h: back_color &= ~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); 'back_color' is of type 'WORD' (unsigned short) whereas a bitwise complement/NOT returns an int. This results in a conversion warning with -Wconversion enabled. 85:20: warning: conversion to 'WORD {aka short unsigned int}' from 'int' may alter its value [-Wconversion] back_color &= ~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); Possible solution: We know that the result of ~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY) is always within the limits of an unsigned short so a simple cast should suffice (correct me if I'm wrong): back_color &= static_cast<unsigned short>(~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY));
- Loading branch information