MCPcopy Create free account
hub / github.com/WinMerge/winmerge / SanityCheckCodepage

Method SanityCheckCodepage

Src/MergeDoc.cpp:2108–2118  ·  view source on GitHub ↗

* @brief Sanity check file's specified codepage. * This function checks if file's specified codepage is valid for WinMerge * editor and if not resets the codepage to default. * @param [in,out] fileinfo Class containing file's codepage. */

Source from the content-addressed store, hash-verified

2106 * @param [in,out] fileinfo Class containing file's codepage.
2107 */
2108void CMergeDoc::SanityCheckCodepage(FileLocation & fileinfo)
2109{
2110 if (fileinfo.encoding.m_unicoding == ucr::NONE
2111 && !IsValidCodepageForMergeEditor(fileinfo.encoding.m_codepage))
2112 {
2113 int cp = ucr::getDefaultCodepage();
2114 if (!IsValidCodepageForMergeEditor(cp))
2115 cp = CP_ACP;
2116 fileinfo.encoding.SetCodepage(cp);
2117 }
2118}
2119
2120/**
2121 * @brief Loads one file from disk and updates file infos.

Callers

nothing calls this directly

Calls 2

getDefaultCodepageFunction · 0.85
SetCodepageMethod · 0.45

Tested by

no test coverage detected