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

Function GetTextFileStyle

Src/DiffTextBuffer.cpp:57–76  ·  view source on GitHub ↗

* @brief Get file's EOL type. * @param [in] stats File's text stats. * @return EOL type. */

Source from the content-addressed store, hash-verified

55 * @return EOL type.
56 */
57static CRLFSTYLE GetTextFileStyle(const UniMemFile::txtstats & stats)
58{
59 // Check if file has more than one EOL type.
60 if (!IsTextFileStylePure(stats))
61 return CRLFSTYLE::MIXED;
62 else if (stats.ncrlfs >= stats.nlfs)
63 {
64 if (stats.ncrlfs >= stats.ncrs)
65 return CRLFSTYLE::DOS;
66 else
67 return CRLFSTYLE::MAC;
68 }
69 else
70 {
71 if (stats.nlfs >= stats.ncrs)
72 return CRLFSTYLE::UNIX;
73 else
74 return CRLFSTYLE::MAC;
75 }
76}
77
78/**
79 * @brief Constructor.

Callers 1

LoadFromFileMethod · 0.85

Calls 1

IsTextFileStylePureFunction · 0.85

Tested by

no test coverage detected