Skip to content

Narrower data type and sign conversion warnings in qt_sinks.h #3321

Open
@davidebeatrici

Description

@davidebeatrici
include/spdlog/sinks/qt_sinks.h: In instantiation of ‘void spdlog::sinks::qt_color_sink<Mutex>::sink_it_(const spdlog::details::log_msg&) [with Mutex = spdlog::details::null_mutex]’:
include/spdlog/sinks/qt_sinks.h:150:10:   required from here
  150 |     void sink_it_(const details::log_msg &msg) override {
      |          ^~~~~~~~
include/spdlog/sinks/qt_sinks.h:163:71: error: conversion to ‘qsizetype’ {aka ‘long long int’} from ‘size_t’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
  163 |                 color_range_start = QString::fromUtf8(str.data(), msg.color_range_start).size();
      |                                                                   ~~~~^~~~~~~~~~~~~~~~~
include/spdlog/sinks/qt_sinks.h:163:94: error: conversion from ‘qsizetype’ {aka ‘long long int’} to ‘int’ may change value [-Werror=conversion]
  163 |                 color_range_start = QString::fromUtf8(str.data(), msg.color_range_start).size();
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
include/spdlog/sinks/qt_sinks.h:164:69: error: conversion to ‘qsizetype’ {aka ‘long long int’} from ‘size_t’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
  164 |                 color_range_end = QString::fromUtf8(str.data(), msg.color_range_end).size();
      |                                                                 ~~~~^~~~~~~~~~~~~~~
include/spdlog/sinks/qt_sinks.h:164:90: error: conversion from ‘qsizetype’ {aka ‘long long int’} to ‘int’ may change value [-Werror=conversion]
  164 |                 color_range_end = QString::fromUtf8(str.data(), msg.color_range_end).size();
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions