Examples of errors detected by the V766 diagnostic.


V766. An item with the same key has already been added.


Chromium

V766 An item with the same key '"colorSectionBorder"' has already been added. ntp_resource_cache.cc 581


void NTPResourceCache::CreateNewTabCSS()
{
  ....
  // Colors.
  substitutions["colorBackground"] =
    SkColorToRGBAString(color_background);
  substitutions["backgroundBarDetached"] =
    GetNewTabBackgroundCSS(tp, false);
  substitutions["backgroundBarAttached"] =
    GetNewTabBackgroundCSS(tp, true);
  substitutions["backgroundTiling"] =
    GetNewTabBackgroundTilingCSS(tp);
  substitutions["colorTextRgba"] =
    SkColorToRGBAString(color_text);
  substitutions["colorSectionBorder"] =
      SkColorToRGBAString(color_section_border); // <=
  substitutions["colorTextLight"] =
    SkColorToRGBAString(color_text_light);
  substitutions["colorSectionBorder"] =
      SkColorToRGBComponents(color_section_border); // <=
  substitutions["colorText"] =
    SkColorToRGBComponents(color_text);
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;