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);
  ....
}

MuseScore

V766 An item with the same key '"mrcs"' has already been added. importgtp-gp6.cpp 100


const static std::map<QString, QString> instrumentMapping = {
  ....
  {"e-piano-gs", "electric-piano"},
  {"e-piano-ss", "electric-piano"},
  {"hrpch-gs", "harpsichord"},
  {"hrpch-ss", "harpsichord"},
  {"mrcs", "maracas"},                // <=
  {"mrcs", "oboe"},                   // <=
  {"mrcs", "oboe"},                   // <= using of Copy-Paste
  ....
};

Android

V766 CWE-462 An item with the same key '"oem_lpass_cfg"' has already been added. bootstat.cpp 264


const std::map<std::string, int32_t> kBootReasonMap = {
    ....
    {"watchdog_sdi_apps_reset", 106},
    {"smpl", 107},
    {"oem_modem_failed_to_powerup", 108},
    {"reboot_normal", 109},
    {"oem_lpass_cfg", 110},                           // <=
    {"oem_xpu_ns_error", 111},                        // <=
    {"power_key_press", 112},
    {"hardware_reset", 113},
    {"reboot_by_powerkey", 114},
    {"reboot_verity", 115},
    {"oem_rpm_undef_error", 116},
    {"oem_crash_on_the_lk", 117},
    {"oem_rpm_reset", 118},
    {"oem_lpass_cfg", 119},                           // <=
    {"oem_xpu_ns_error", 120},                        // <=
    {"factory_cable", 121},
    {"oem_ar6320_failed_to_powerup", 122},
    {"watchdog_rpm_bite", 123},
    {"power_on_cable", 124},
    {"reboot_unknown", 125},
    ....
};

Similar errors can be found in some other places:

  • V766 CWE-462 An item with the same key '"oem_xpu_ns_error"' has already been added. bootstat.cpp 265

NCBI Genome Workbench

V766 An item with the same key 'kArgRemote' has already been added. blast_args.cpp 3262


void
CBlastAppArgs::x_IssueWarningsForIgnoredOptions(const CArgs& args)
{
  set<string> can_override;
  ....
  can_override.insert(kArgOutputFormat);
  can_override.insert(kArgNumDescriptions);
  can_override.insert(kArgNumAlignments);
  can_override.insert(kArgMaxTargetSequences);
  can_override.insert(kArgRemote);               // <=
  can_override.insert(kArgNumThreads);
  can_override.insert(kArgInputSearchStrategy);
  can_override.insert(kArgRemote);               // <=
  can_override.insert("remote_verbose");
  can_override.insert("verbose");
  ....
}


Bugs Found

Checked Projects
334
Collected Errors
12 668