Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/helpers/text_file_loader_v2.cpp @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #include "StdAfx.h" | |
| 2 #include "text_file_loader_v2.h" | |
| 3 #include "text_file_loader.h" | |
| 4 | |
| 5 void text_file_loader_v2::load(file::ptr f, abort_callback & abort) { | |
| 6 m_lines.clear(); | |
| 7 bool dummy; | |
| 8 text_file_loader::read_v2(f, abort, m_data, dummy, m_forceUTF8); | |
| 9 | |
| 10 m_lines.reserve(128); | |
| 11 | |
| 12 char * p = const_cast<char*>(m_data.get_ptr()); | |
| 13 bool line = false; | |
| 14 const size_t len = m_data.length(); | |
| 15 for (size_t walk = 0; walk < len; ++walk) { | |
| 16 char & c = p[walk]; | |
| 17 if (c == '\n' || c == '\r') { | |
| 18 c = 0; | |
| 19 line = false; | |
| 20 } else if (!line) { | |
| 21 m_lines.push_back(&c); | |
| 22 line = true; | |
| 23 } | |
| 24 } | |
| 25 } |
