| ... | ... |
@@ -488,9 +488,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 488 | 488 |
if (level <= 10 && xSF->GetTagExists("_lib"))
|
| 489 | 489 |
{
|
| 490 | 490 |
#ifdef _WIN32 |
| 491 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 4, 8));
|
|
| 491 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 4, 8));
|
|
| 492 | 492 |
#else |
| 493 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 4, 8));
|
|
| 493 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 4, 8));
|
|
| 494 | 494 |
#endif |
| 495 | 495 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 496 | 496 |
return false; |
| ... | ... |
@@ -509,9 +509,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 509 | 509 |
{
|
| 510 | 510 |
found = true; |
| 511 | 511 |
#ifdef _WIN32 |
| 512 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 4, 8)); |
|
| 512 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 4, 8)); |
|
| 513 | 513 |
#else |
| 514 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 4, 8)); |
|
| 514 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 4, 8)); |
|
| 515 | 515 |
#endif |
| 516 | 516 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 517 | 517 |
return false; |
| ... | ... |
@@ -149,9 +149,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 149 | 149 |
if (level <= 10 && xSF->GetTagExists("_lib"))
|
| 150 | 150 |
{
|
| 151 | 151 |
#ifdef _WIN32 |
| 152 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 8, 12));
|
|
| 152 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 8, 12));
|
|
| 153 | 153 |
#else |
| 154 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 8, 12));
|
|
| 154 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 8, 12));
|
|
| 155 | 155 |
#endif |
| 156 | 156 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 157 | 157 |
return false; |
| ... | ... |
@@ -170,9 +170,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 170 | 170 |
{
|
| 171 | 171 |
found = true; |
| 172 | 172 |
#ifdef _WIN32 |
| 173 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 8, 12)); |
|
| 173 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 8, 12)); |
|
| 174 | 174 |
#else |
| 175 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 8, 12)); |
|
| 175 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 8, 12)); |
|
| 176 | 176 |
#endif |
| 177 | 177 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 178 | 178 |
return false; |
| ... | ... |
@@ -18,9 +18,9 @@ |
| 18 | 18 |
|
| 19 | 19 |
struct SDAT |
| 20 | 20 |
{
|
| 21 |
- std::auto_ptr<SSEQ> sseq; |
|
| 22 |
- std::auto_ptr<SBNK> sbnk; |
|
| 23 |
- std::auto_ptr<SWAR> swar[4]; |
|
| 21 |
+ std::unique_ptr<SSEQ> sseq; |
|
| 22 |
+ std::unique_ptr<SBNK> sbnk; |
|
| 23 |
+ std::unique_ptr<SWAR> swar[4]; |
|
| 24 | 24 |
|
| 25 | 25 |
SDAT(PseudoFile &file, uint32_t sseqToLoad); |
| 26 | 26 |
private: |
| ... | ... |
@@ -61,9 +61,9 @@ bool XSFPlayer_NCSF::RecursiveLoadNCSF(XSFFile *xSFToLoad, int level) |
| 61 | 61 |
if (level <= 10 && xSFToLoad->GetTagExists("_lib"))
|
| 62 | 62 |
{
|
| 63 | 63 |
#ifdef _WIN32 |
| 64 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetWStr()) + xSFToLoad->GetTagValue("_lib").GetWStr(), 8, 12));
|
|
| 64 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetWStr()) + xSFToLoad->GetTagValue("_lib").GetWStr(), 8, 12));
|
|
| 65 | 65 |
#else |
| 66 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetAnsi()) + xSFToLoad->GetTagValue("_lib").GetAnsi(), 8, 12));
|
|
| 66 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetAnsi()) + xSFToLoad->GetTagValue("_lib").GetAnsi(), 8, 12));
|
|
| 67 | 67 |
#endif |
| 68 | 68 |
if (!this->RecursiveLoadNCSF(libxSF.get(), level + 1)) |
| 69 | 69 |
return false; |
| ... | ... |
@@ -82,9 +82,9 @@ bool XSFPlayer_NCSF::RecursiveLoadNCSF(XSFFile *xSFToLoad, int level) |
| 82 | 82 |
{
|
| 83 | 83 |
found = true; |
| 84 | 84 |
#ifdef _WIN32 |
| 85 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetWStr()) + xSFToLoad->GetTagValue(libTag).GetWStr(), 8, 12)); |
|
| 85 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetWStr()) + xSFToLoad->GetTagValue(libTag).GetWStr(), 8, 12)); |
|
| 86 | 86 |
#else |
| 87 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetAnsi()) + xSFToLoad->GetTagValue(libTag).GetAnsi(), 8, 12)); |
|
| 87 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSFToLoad->GetFilename().GetAnsi()) + xSFToLoad->GetTagValue(libTag).GetAnsi(), 8, 12)); |
|
| 88 | 88 |
#endif |
| 89 | 89 |
if (!this->RecursiveLoadNCSF(libxSF.get(), level + 1)) |
| 90 | 90 |
return false; |
| ... | ... |
@@ -22,7 +22,7 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 22 | 22 |
{
|
| 23 | 23 |
uint32_t sseq; |
| 24 | 24 |
std::vector<uint8_t> sdatData; |
| 25 |
- std::auto_ptr<SDAT> sdat; |
|
| 25 |
+ std::unique_ptr<SDAT> sdat; |
|
| 26 | 26 |
Player player; |
| 27 | 27 |
double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock; |
| 28 | 28 |
std::bitset<16> mutes; |
| ... | ... |
@@ -160,9 +160,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 160 | 160 |
if (level <= 10 && xSF->GetTagExists("_lib"))
|
| 161 | 161 |
{
|
| 162 | 162 |
#ifdef _WIN32 |
| 163 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 4, 8));
|
|
| 163 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue("_lib").GetWStr(), 4, 8));
|
|
| 164 | 164 |
#else |
| 165 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 4, 8));
|
|
| 165 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue("_lib").GetAnsi(), 4, 8));
|
|
| 166 | 166 |
#endif |
| 167 | 167 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 168 | 168 |
return false; |
| ... | ... |
@@ -181,9 +181,9 @@ static bool RecursiveLoad2SF(XSFFile *xSF, int level) |
| 181 | 181 |
{
|
| 182 | 182 |
found = true; |
| 183 | 183 |
#ifdef _WIN32 |
| 184 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 4, 8)); |
|
| 184 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetWStr()) + xSF->GetTagValue(libTag).GetWStr(), 4, 8)); |
|
| 185 | 185 |
#else |
| 186 |
- auto libxSF = std::auto_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 4, 8)); |
|
| 186 |
+ auto libxSF = std::unique_ptr<XSFFile>(new XSFFile(ExtractDirectoryFromPath(xSF->GetFilename().GetAnsi()) + xSF->GetTagValue(libTag).GetAnsi(), 4, 8)); |
|
| 187 | 187 |
#endif |
| 188 | 188 |
if (!RecursiveLoad2SF(libxSF.get(), level + 1)) |
| 189 | 189 |
return false; |
| ... | ... |
@@ -21,7 +21,7 @@ void DialogTemplate::DialogGroup::CalculatePositions(bool doRightAndBottom) |
| 21 | 21 |
short x = 0, num = this->controls.empty() ? 0 : this->controls.size(); |
| 22 | 22 |
for (; x < num; ++x) |
| 23 | 23 |
{
|
| 24 |
- DialogControl *control = this->controls[x]; |
|
| 24 |
+ auto &control = this->controls[x]; |
|
| 25 | 25 |
if (control->relativePosition.get()) |
| 26 | 26 |
{
|
| 27 | 27 |
bool valid = true; |
| ... | ... |
@@ -58,10 +58,8 @@ void DialogTemplate::DialogGroup::CalculatePositions(bool doRightAndBottom) |
| 58 | 58 |
void DialogTemplate::DialogGroup::CalculateSize() |
| 59 | 59 |
{
|
| 60 | 60 |
short maxX = 0, maxY = 0, maxOtherWidth = 0, maxOtherHeight = 0; |
| 61 |
- for (DialogTemplate::Controls::const_iterator curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 61 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) |
|
| 62 | 62 |
{
|
| 63 |
- DialogControl *control = *curr; |
|
| 64 |
- |
|
| 65 | 63 |
bool usePosition = true; |
| 66 | 64 |
if (control->relativePosition.get()) |
| 67 | 65 |
{
|
| ... | ... |
@@ -92,7 +90,7 @@ void DialogTemplate::DialogGroup::CalculateSize() |
| 92 | 90 |
if (control->rect.position.y + control->GetControlHeight() > maxY) |
| 93 | 91 |
maxY = control->rect.position.y + control->GetControlHeight(); |
| 94 | 92 |
} |
| 95 |
- } |
|
| 93 |
+ }); |
|
| 96 | 94 |
this->rect.size.width = (maxX - this->rect.position.x) + maxOtherWidth + 4; |
| 97 | 95 |
this->rect.size.height = (maxY - this->rect.position.y) + maxOtherHeight + 7; |
| 98 | 96 |
} |
| ... | ... |
@@ -100,8 +98,7 @@ void DialogTemplate::DialogGroup::CalculateSize() |
| 100 | 98 |
uint16_t DialogTemplate::DialogGroup::GetControlCount() const |
| 101 | 99 |
{
|
| 102 | 100 |
uint16_t count = 1; |
| 103 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 104 |
- count += (*curr)->GetControlCount(); |
|
| 101 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) { count += control->GetControlCount(); });
|
|
| 105 | 102 |
return count; |
| 106 | 103 |
} |
| 107 | 104 |
|
| ... | ... |
@@ -120,11 +117,11 @@ std::vector<uint8_t> DialogTemplate::DialogGroup::GenerateControlTemplate() cons |
| 120 | 117 |
*reinterpret_cast<uint16_t *>(&data[20]) = 0x0080; |
| 121 | 118 |
memcpy(reinterpret_cast<wchar_t *>(&data[22]), this->groupName.c_str(), this->groupName.length() * sizeof(wchar_t)); |
| 122 | 119 |
|
| 123 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 120 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) |
|
| 124 | 121 |
{
|
| 125 |
- auto controlData = (*curr)->GenerateControlTemplate(); |
|
| 122 |
+ auto controlData = control->GenerateControlTemplate(); |
|
| 126 | 123 |
data.insert(data.end(), controlData.begin(), controlData.end()); |
| 127 |
- } |
|
| 124 |
+ }); |
|
| 128 | 125 |
|
| 129 | 126 |
return data; |
| 130 | 127 |
} |
| ... | ... |
@@ -165,53 +162,52 @@ std::vector<uint8_t> DialogTemplate::DialogControlWithLabel::GenerateControlTemp |
| 165 | 162 |
uint16_t DialogTemplate::GetTotalControlCount() const |
| 166 | 163 |
{
|
| 167 | 164 |
uint16_t count = 0; |
| 168 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 169 |
- count += (*curr)->GetControlCount(); |
|
| 165 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) { count += control->GetControlCount(); });
|
|
| 170 | 166 |
return count; |
| 171 | 167 |
} |
| 172 | 168 |
|
| 173 | 169 |
void DialogTemplate::AddGroupControl(const DialogControlBuilder<DialogGroupBuilder> &builder) |
| 174 | 170 |
{
|
| 175 |
- DialogGroup *newGroup = DialogGroup::CreateControl(builder); |
|
| 171 |
+ std::unique_ptr<DialogControl> newGroup = DialogGroup::CreateControl(builder); |
|
| 176 | 172 |
if (builder.index == -1) |
| 177 |
- this->controls.push_back(newGroup); |
|
| 173 |
+ this->controls.push_back(std::move(newGroup)); |
|
| 178 | 174 |
else |
| 179 |
- this->controls.insert(this->controls.begin() + builder.index, newGroup); |
|
| 175 |
+ this->controls.insert(this->controls.begin() + builder.index, std::move(newGroup)); |
|
| 180 | 176 |
} |
| 181 | 177 |
|
| 182 | 178 |
void DialogTemplate::AddEditBoxControl(const DialogControlBuilder<DialogEditBoxBuilder> &builder) |
| 183 | 179 |
{
|
| 184 |
- this->AddControlToGroup(DialogEditBox::CreateControl(builder), builder); |
|
| 180 |
+ this->AddControlToGroup(std::move(DialogEditBox::CreateControl(builder)), builder); |
|
| 185 | 181 |
} |
| 186 | 182 |
|
| 187 | 183 |
void DialogTemplate::AddLabelControl(const DialogControlBuilder<DialogLabelBuilder> &builder) |
| 188 | 184 |
{
|
| 189 |
- this->AddControlToGroup(DialogLabel::CreateControl(builder), builder); |
|
| 185 |
+ this->AddControlToGroup(std::move(DialogLabel::CreateControl(builder)), builder); |
|
| 190 | 186 |
} |
| 191 | 187 |
|
| 192 | 188 |
void DialogTemplate::AddCheckBoxControl(const DialogControlBuilder<DialogCheckBoxBuilder> &builder) |
| 193 | 189 |
{
|
| 194 |
- this->AddControlToGroup(DialogButton::CreateControl(builder), builder); |
|
| 190 |
+ this->AddControlToGroup(std::move(DialogButton::CreateControl(builder)), builder); |
|
| 195 | 191 |
} |
| 196 | 192 |
|
| 197 | 193 |
void DialogTemplate::AddButtonControl(const DialogControlBuilder<DialogButtonBuilder> &builder) |
| 198 | 194 |
{
|
| 199 |
- this->AddControlToGroup(DialogButton::CreateControl(builder), builder); |
|
| 195 |
+ this->AddControlToGroup(std::move(DialogButton::CreateControl(builder)), builder); |
|
| 200 | 196 |
} |
| 201 | 197 |
|
| 202 | 198 |
void DialogTemplate::AddListBoxControl(const DialogControlBuilder<DialogListBoxBuilder> &builder) |
| 203 | 199 |
{
|
| 204 |
- this->AddControlToGroup(DialogListBox::CreateControl(builder), builder); |
|
| 200 |
+ this->AddControlToGroup(std::move(DialogListBox::CreateControl(builder)), builder); |
|
| 205 | 201 |
} |
| 206 | 202 |
|
| 207 | 203 |
void DialogTemplate::AddComboBoxControl(const DialogControlBuilder<DialogComboBoxBuilder> &builder) |
| 208 | 204 |
{
|
| 209 |
- this->AddControlToGroup(DialogComboBox::CreateControl(builder), builder); |
|
| 205 |
+ this->AddControlToGroup(std::move(DialogComboBox::CreateControl(builder)), builder); |
|
| 210 | 206 |
} |
| 211 | 207 |
|
| 212 | 208 |
bool DialogTemplate::CalculateControlPosition(short index, bool doRightAndBottom) |
| 213 | 209 |
{
|
| 214 |
- DialogControl *control = this->controls[index]; |
|
| 210 |
+ auto &control = this->controls[index]; |
|
| 215 | 211 |
bool valid = true; |
| 216 | 212 |
if (control->relativePosition.get()) |
| 217 | 213 |
{
|
| ... | ... |
@@ -248,10 +244,8 @@ bool DialogTemplate::CalculateControlPosition(short index, bool doRightAndBottom |
| 248 | 244 |
void DialogTemplate::CalculateSize() |
| 249 | 245 |
{
|
| 250 | 246 |
short maxX = 0, maxY = 0, maxOtherWidth = 0, maxOtherHeight = 0; |
| 251 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 247 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) |
|
| 252 | 248 |
{
|
| 253 |
- DialogControl *control = *curr; |
|
| 254 |
- |
|
| 255 | 249 |
bool usePosition = true; |
| 256 | 250 |
if (control->relativePosition.get()) |
| 257 | 251 |
{
|
| ... | ... |
@@ -282,7 +276,7 @@ void DialogTemplate::CalculateSize() |
| 282 | 276 |
if (control->rect.position.y + control->GetControlHeight() > maxY) |
| 283 | 277 |
maxY = control->rect.position.y + control->GetControlHeight(); |
| 284 | 278 |
} |
| 285 |
- } |
|
| 279 |
+ }); |
|
| 286 | 280 |
this->size.width = maxX + maxOtherWidth + 7; |
| 287 | 281 |
this->size.height = maxY + maxOtherHeight + 7; |
| 288 | 282 |
} |
| ... | ... |
@@ -293,13 +287,13 @@ void DialogTemplate::AutoSize() |
| 293 | 287 |
short x = 0, num = this->controls.empty() ? 0 : this->controls.size(), maxGroupWidth = 0; |
| 294 | 288 |
for (; x < num; ++x) |
| 295 | 289 |
{
|
| 296 |
- DialogControl *control = this->controls[x]; |
|
| 290 |
+ auto &control = this->controls[x]; |
|
| 297 | 291 |
bool valid = this->CalculateControlPosition(x, false); |
| 298 | 292 |
if (valid && control->controlType == GROUP_CONTROL) |
| 299 | 293 |
{
|
| 300 |
- dynamic_cast<DialogGroup *>(control)->CalculatePositions(false); |
|
| 294 |
+ dynamic_cast<DialogGroup *>(control.get())->CalculatePositions(false); |
|
| 301 | 295 |
// Techically step 2, but calculate the size of the group |
| 302 |
- dynamic_cast<DialogGroup *>(control)->CalculateSize(); |
|
| 296 |
+ dynamic_cast<DialogGroup *>(control.get())->CalculateSize(); |
|
| 303 | 297 |
if (control->rect.size.width > maxGroupWidth) |
| 304 | 298 |
maxGroupWidth = control->rect.size.width; |
| 305 | 299 |
} |
| ... | ... |
@@ -307,11 +301,11 @@ void DialogTemplate::AutoSize() |
| 307 | 301 |
// Step 2: Resize all group controls to be the same width, and then within the group, recalculate positions for all controls |
| 308 | 302 |
for (x = 0; x < num; ++x) |
| 309 | 303 |
{
|
| 310 |
- DialogControl *control = this->controls[x]; |
|
| 304 |
+ auto &control = this->controls[x]; |
|
| 311 | 305 |
if (control->controlType != GROUP_CONTROL) |
| 312 | 306 |
continue; |
| 313 | 307 |
control->rect.size.width = maxGroupWidth; |
| 314 |
- dynamic_cast<DialogGroup *>(control)->CalculatePositions(true); |
|
| 308 |
+ dynamic_cast<DialogGroup *>(control.get())->CalculatePositions(true); |
|
| 315 | 309 |
} |
| 316 | 310 |
// Step 3: Resize the dialog box itself |
| 317 | 311 |
this->CalculateSize(); |
| ... | ... |
@@ -337,11 +331,11 @@ const DLGTEMPLATE *DialogTemplate::GenerateTemplate() |
| 337 | 331 |
memcpy(reinterpret_cast<wchar_t *>(&this->templateData[24 + sizeof(wchar_t) * (this->title.length() + 1)]), this->fontName.c_str(), this->fontName.length() * sizeof(wchar_t)); |
| 338 | 332 |
} |
| 339 | 333 |
|
| 340 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 334 |
+ std::for_each(this->controls.begin(), this->controls.end(), [&](const std::unique_ptr<DialogControl> &control) |
|
| 341 | 335 |
{
|
| 342 |
- auto controlData = (*curr)->GenerateControlTemplate(); |
|
| 336 |
+ auto controlData = control->GenerateControlTemplate(); |
|
| 343 | 337 |
this->templateData.insert(this->templateData.end(), controlData.begin(), controlData.end()); |
| 344 |
- } |
|
| 338 |
+ }); |
|
| 345 | 339 |
|
| 346 | 340 |
return reinterpret_cast<const DLGTEMPLATE *>(&this->templateData[0]); |
| 347 | 341 |
} |
| ... | ... |
@@ -10,6 +10,7 @@ |
| 10 | 10 |
#include <string> |
| 11 | 11 |
#include <memory> |
| 12 | 12 |
#include <vector> |
| 13 |
+#include <algorithm> |
|
| 13 | 14 |
#include <stdexcept> |
| 14 | 15 |
#include "pstdint.h" |
| 15 | 16 |
#include "windowsh_wrapper.h" |
| ... | ... |
@@ -162,7 +163,7 @@ protected: |
| 162 | 163 |
Rect<short> rect; |
| 163 | 164 |
short id; |
| 164 | 165 |
int index; |
| 165 |
- std::auto_ptr<RelativePosition> relativePosition; |
|
| 166 |
+ std::unique_ptr<RelativePosition> relativePosition; |
|
| 166 | 167 |
|
| 167 | 168 |
T &me() { return dynamic_cast<T &>(*this); }
|
| 168 | 169 |
public: |
| ... | ... |
@@ -385,7 +386,7 @@ class DialogTemplate |
| 385 | 386 |
{
|
| 386 | 387 |
class DialogControl; |
| 387 | 388 |
|
| 388 |
- typedef std::vector<DialogControl *> Controls; |
|
| 389 |
+ typedef std::vector<std::unique_ptr<DialogControl>> Controls; |
|
| 389 | 390 |
|
| 390 | 391 |
class DialogControl |
| 391 | 392 |
{
|
| ... | ... |
@@ -394,7 +395,7 @@ class DialogTemplate |
| 394 | 395 |
uint32_t style, exstyle; |
| 395 | 396 |
Rect<short> rect; |
| 396 | 397 |
short id; |
| 397 |
- std::auto_ptr<RelativePosition> relativePosition; |
|
| 398 |
+ std::unique_ptr<RelativePosition> relativePosition; |
|
| 398 | 399 |
|
| 399 | 400 |
friend class DialogTemplate; |
| 400 | 401 |
DialogControl() : controlType(NO_CONTROL), style(0), exstyle(0), rect(), id(-1), relativePosition() { }
|
| ... | ... |
@@ -416,9 +417,9 @@ class DialogTemplate |
| 416 | 417 |
} |
| 417 | 418 |
public: |
| 418 | 419 |
virtual ~DialogControl() { }
|
| 419 |
- template<typename Control, typename Builder> static Control *CreateControl(const DialogControlBuilder<Builder> &builder) |
|
| 420 |
+ template<typename Control, typename Builder> static std::unique_ptr<Control> CreateControl(const DialogControlBuilder<Builder> &builder) |
|
| 420 | 421 |
{
|
| 421 |
- Control *control = new Control(); |
|
| 422 |
+ auto control = std::unique_ptr<Control>(new Control()); |
|
| 422 | 423 |
|
| 423 | 424 |
control->controlType = builder.controlType; |
| 424 | 425 |
control->style = builder.style; |
| ... | ... |
@@ -447,30 +448,23 @@ class DialogTemplate |
| 447 | 448 |
DialogGroup() : DialogControl(), controls(), groupName(L"") { }
|
| 448 | 449 |
DialogGroup(const DialogGroup &control) : DialogControl(control), controls(), groupName(control.groupName) |
| 449 | 450 |
{
|
| 450 |
- for (auto curr = control.controls.begin(), end = control.controls.end(); curr != end; ++curr) |
|
| 451 |
- this->controls.push_back((*curr)->Clone()); |
|
| 451 |
+ std::for_each(control.controls.begin(), control.controls.end(), [&](const std::unique_ptr<DialogControl> &control) { this->controls.push_back(std::unique_ptr<DialogControl>(control->Clone())); });
|
|
| 452 | 452 |
} |
| 453 | 453 |
DialogGroup &operator=(const DialogGroup &control) |
| 454 | 454 |
{
|
| 455 | 455 |
DialogControl::operator=(control); |
| 456 | 456 |
|
| 457 |
- if (!this->controls.empty()) |
|
| 458 |
- this->ClearControls(); |
|
| 459 |
- for (auto curr = control.controls.begin(), end = control.controls.end(); curr != end; ++curr) |
|
| 460 |
- this->controls.push_back((*curr)->Clone()); |
|
| 457 |
+ this->controls.clear(); |
|
| 458 |
+ std::for_each(control.controls.begin(), control.controls.end(), [&](const std::unique_ptr<DialogControl> &control) { this->controls.push_back(std::unique_ptr<DialogControl>(control->Clone())); });
|
|
| 459 |
+ |
|
| 460 |
+ this->groupName = control.groupName; |
|
| 461 | 461 |
|
| 462 | 462 |
return *this; |
| 463 | 463 |
} |
| 464 |
- void ClearControls() |
|
| 465 |
- {
|
|
| 466 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 467 |
- delete *curr; |
|
| 468 |
- } |
|
| 469 | 464 |
public: |
| 470 |
- ~DialogGroup() { this->ClearControls(); }
|
|
| 471 |
- static DialogGroup *CreateControl(const DialogControlBuilder<DialogGroupBuilder> &builder) |
|
| 465 |
+ static std::unique_ptr<DialogGroup> CreateControl(const DialogControlBuilder<DialogGroupBuilder> &builder) |
|
| 472 | 466 |
{
|
| 473 |
- DialogGroup *control = DialogControl::CreateControl<DialogGroup>(builder); |
|
| 467 |
+ auto control = DialogControl::CreateControl<DialogGroup>(builder); |
|
| 474 | 468 |
|
| 475 | 469 |
control->groupName = dynamic_cast<const DialogGroupBuilder &>(builder).groupName; |
| 476 | 470 |
|
| ... | ... |
@@ -501,9 +495,9 @@ class DialogTemplate |
| 501 | 495 |
return *this; |
| 502 | 496 |
} |
| 503 | 497 |
public: |
| 504 |
- template<typename Control, typename Builder> static Control *CreateControl(const DialogControlBuilder<Builder> &builder, uint16_t Type) |
|
| 498 |
+ template<typename Control, typename Builder> static std::unique_ptr<Control> CreateControl(const DialogControlBuilder<Builder> &builder, uint16_t Type) |
|
| 505 | 499 |
{
|
| 506 |
- Control *control = DialogControl::CreateControl<Control>(builder); |
|
| 500 |
+ auto control = DialogControl::CreateControl<Control>(builder); |
|
| 507 | 501 |
|
| 508 | 502 |
control->type = Type; |
| 509 | 503 |
|
| ... | ... |
@@ -533,9 +527,9 @@ class DialogTemplate |
| 533 | 527 |
return *this; |
| 534 | 528 |
} |
| 535 | 529 |
public: |
| 536 |
- template<typename Control, typename Builder> static Control *CreateControl(const DialogControlBuilder<Builder> &builder, uint16_t Type) |
|
| 530 |
+ template<typename Control, typename Builder> static std::unique_ptr<Control> CreateControl(const DialogControlBuilder<Builder> &builder, uint16_t Type) |
|
| 537 | 531 |
{
|
| 538 |
- Control *control = DialogControl::CreateControl<Control>(builder); |
|
| 532 |
+ auto control = DialogControl::CreateControl<Control>(builder); |
|
| 539 | 533 |
|
| 540 | 534 |
control->type = Type; |
| 541 | 535 |
control->label = dynamic_cast<const DialogControlWithLabelBuilder<Builder> &>(builder).label; |
| ... | ... |
@@ -553,7 +547,7 @@ class DialogTemplate |
| 553 | 547 |
friend class DialogControl; |
| 554 | 548 |
DialogEditBox() : DialogControlWithoutLabel() { }
|
| 555 | 549 |
public: |
| 556 |
- static DialogEditBox *CreateControl(const DialogControlBuilder<DialogEditBoxBuilder> &builder) |
|
| 550 |
+ static std::unique_ptr<DialogEditBox> CreateControl(const DialogControlBuilder<DialogEditBoxBuilder> &builder) |
|
| 557 | 551 |
{
|
| 558 | 552 |
return DialogControlWithoutLabel::CreateControl<DialogEditBox>(builder, 0x0081); |
| 559 | 553 |
} |
| ... | ... |
@@ -566,7 +560,7 @@ class DialogTemplate |
| 566 | 560 |
friend class DialogControl; |
| 567 | 561 |
DialogLabel() : DialogControlWithLabel() { }
|
| 568 | 562 |
public: |
| 569 |
- static DialogLabel *CreateControl(const DialogControlBuilder<DialogLabelBuilder> &builder) |
|
| 563 |
+ static std::unique_ptr<DialogLabel> CreateControl(const DialogControlBuilder<DialogLabelBuilder> &builder) |
|
| 570 | 564 |
{
|
| 571 | 565 |
return DialogControlWithLabel::CreateControl<DialogLabel>(builder, 0x0082); |
| 572 | 566 |
} |
| ... | ... |
@@ -579,7 +573,7 @@ class DialogTemplate |
| 579 | 573 |
friend class DialogControl; |
| 580 | 574 |
DialogButton() : DialogControlWithLabel() { }
|
| 581 | 575 |
public: |
| 582 |
- template<typename Builder> static DialogButton *CreateControl(const DialogControlBuilder<Builder> &builder) |
|
| 576 |
+ template<typename Builder> static std::unique_ptr<DialogButton> CreateControl(const DialogControlBuilder<Builder> &builder) |
|
| 583 | 577 |
{
|
| 584 | 578 |
return DialogControlWithLabel::CreateControl<DialogButton>(builder, 0x0080); |
| 585 | 579 |
} |
| ... | ... |
@@ -592,7 +586,7 @@ class DialogTemplate |
| 592 | 586 |
friend class DialogControl; |
| 593 | 587 |
DialogListBox() : DialogControlWithoutLabel() { }
|
| 594 | 588 |
public: |
| 595 |
- static DialogListBox *CreateControl(const DialogControlBuilder<DialogListBoxBuilder> &builder) |
|
| 589 |
+ static std::unique_ptr<DialogListBox> CreateControl(const DialogControlBuilder<DialogListBoxBuilder> &builder) |
|
| 596 | 590 |
{
|
| 597 | 591 |
return DialogControlWithoutLabel::CreateControl<DialogListBox>(builder, 0x0083); |
| 598 | 592 |
} |
| ... | ... |
@@ -605,7 +599,7 @@ class DialogTemplate |
| 605 | 599 |
friend class DialogControl; |
| 606 | 600 |
DialogComboBox() : DialogControlWithoutLabel() { }
|
| 607 | 601 |
public: |
| 608 |
- static DialogComboBox *CreateControl(const DialogControlBuilder<DialogComboBoxBuilder> &builder) |
|
| 602 |
+ static std::unique_ptr<DialogComboBox> CreateControl(const DialogControlBuilder<DialogComboBoxBuilder> &builder) |
|
| 609 | 603 |
{
|
| 610 | 604 |
return DialogControlWithoutLabel::CreateControl<DialogComboBox>(builder, 0x0085); |
| 611 | 605 |
} |
| ... | ... |
@@ -617,32 +611,32 @@ class DialogTemplate |
| 617 | 611 |
std::wstring fontName; |
| 618 | 612 |
uint16_t fontSizeInPts; |
| 619 | 613 |
Size<short> size; |
| 620 |
- Controls controls; |
|
| 614 |
+ DialogTemplate::Controls controls; |
|
| 621 | 615 |
std::vector<uint8_t> templateData; |
| 622 | 616 |
|
| 623 |
- template<typename Builder> void AddControlToGroup(DialogControl *control, const DialogControlBuilder<Builder> &builder) |
|
| 617 |
+ template<typename Builder> void AddControlToGroup(std::unique_ptr<DialogControl> &&control, const DialogControlBuilder<Builder> &builder) |
|
| 624 | 618 |
{
|
| 625 | 619 |
const DialogInGroupBuilder<Builder> &groupBuilder = dynamic_cast<const DialogInGroupBuilder<Builder> &>(builder); |
| 626 | 620 |
if (groupBuilder.groupName.empty()) |
| 627 | 621 |
{
|
| 628 | 622 |
if (builder.index == -1) |
| 629 |
- this->controls.push_back(control); |
|
| 623 |
+ this->controls.push_back(std::move(control)); |
|
| 630 | 624 |
else |
| 631 |
- this->controls.insert(this->controls.begin() + builder.index, control); |
|
| 625 |
+ this->controls.insert(this->controls.begin() + builder.index, std::move(control)); |
|
| 632 | 626 |
} |
| 633 | 627 |
else |
| 634 | 628 |
{
|
| 635 |
- for (DialogTemplate::Controls::iterator curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 629 |
+ for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 636 | 630 |
{
|
| 637 | 631 |
if ((*curr)->controlType != GROUP_CONTROL) |
| 638 | 632 |
continue; |
| 639 |
- DialogGroup *group = dynamic_cast<DialogGroup *>(*curr); |
|
| 633 |
+ DialogGroup *group = dynamic_cast<DialogGroup *>(curr->get()); |
|
| 640 | 634 |
if (group->groupName == groupBuilder.groupName) |
| 641 | 635 |
{
|
| 642 | 636 |
if (builder.index == -1) |
| 643 |
- group->controls.push_back(control); |
|
| 637 |
+ group->controls.push_back(std::move(control)); |
|
| 644 | 638 |
else |
| 645 |
- group->controls.insert(group->controls.begin() + builder.index, control); |
|
| 639 |
+ group->controls.insert(group->controls.begin() + builder.index, std::move(control)); |
|
| 646 | 640 |
return; |
| 647 | 641 |
} |
| 648 | 642 |
} |
| ... | ... |
@@ -652,11 +646,6 @@ class DialogTemplate |
| 652 | 646 |
uint16_t GetTotalControlCount() const; |
| 653 | 647 |
bool CalculateControlPosition(short index, bool doRightAndBottom = false); |
| 654 | 648 |
void CalculateSize(); |
| 655 |
- void ClearControls() |
|
| 656 |
- {
|
|
| 657 |
- for (auto curr = this->controls.begin(), end = this->controls.end(); curr != end; ++curr) |
|
| 658 |
- delete *curr; |
|
| 659 |
- } |
|
| 660 | 649 |
public: |
| 661 | 650 |
DialogTemplate() : title(L""), style(0), exstyle(0), fontName(L""), fontSizeInPts(0), size(), controls(), templateData() { }
|
| 662 | 651 |
DialogTemplate(const DialogBuilder &builder) : title(builder.title), style(builder.style), exstyle(builder.exstyle), fontName(builder.fontName), fontSizeInPts(builder.fontSizeInPts), |
| ... | ... |
@@ -664,8 +653,7 @@ public: |
| 664 | 653 |
DialogTemplate(const DialogTemplate &dlg) : title(dlg.title), style(dlg.style), exstyle(dlg.style), fontName(dlg.fontName), fontSizeInPts(dlg.fontSizeInPts), size(dlg.size), |
| 665 | 654 |
controls(), templateData() |
| 666 | 655 |
{
|
| 667 |
- for (auto curr = dlg.controls.begin(), end = dlg.controls.end(); curr != end; ++curr) |
|
| 668 |
- this->controls.push_back((*curr)->Clone()); |
|
| 656 |
+ std::for_each(dlg.controls.begin(), dlg.controls.end(), [&](const std::unique_ptr<DialogControl> &control) { this->controls.push_back(std::unique_ptr<DialogControl>(control->Clone())); });
|
|
| 669 | 657 |
} |
| 670 | 658 |
DialogTemplate &operator=(const DialogBuilder &builder) |
| 671 | 659 |
{
|
| ... | ... |
@@ -675,8 +663,8 @@ public: |
| 675 | 663 |
this->fontName = builder.fontName; |
| 676 | 664 |
this->fontSizeInPts = builder.fontSizeInPts; |
| 677 | 665 |
this->size = builder.size; |
| 678 |
- if (builder.resetControls && !this->controls.empty()) |
|
| 679 |
- this->ClearControls(); |
|
| 666 |
+ if (builder.resetControls) |
|
| 667 |
+ this->controls.clear(); |
|
| 680 | 668 |
|
| 681 | 669 |
return *this; |
| 682 | 670 |
} |
| ... | ... |
@@ -688,14 +676,11 @@ public: |
| 688 | 676 |
this->fontName = dlg.fontName; |
| 689 | 677 |
this->fontSizeInPts = dlg.fontSizeInPts; |
| 690 | 678 |
this->size = dlg.size; |
| 691 |
- if (!this->controls.empty()) |
|
| 692 |
- this->ClearControls(); |
|
| 693 |
- for (auto curr = dlg.controls.begin(), end = dlg.controls.end(); curr != end; ++curr) |
|
| 694 |
- this->controls.push_back((*curr)->Clone()); |
|
| 679 |
+ this->controls.clear(); |
|
| 680 |
+ std::for_each(dlg.controls.begin(), dlg.controls.end(), [&](const std::unique_ptr<DialogControl> &control) { this->controls.push_back(std::unique_ptr<DialogControl>(control->Clone())); });
|
|
| 695 | 681 |
|
| 696 | 682 |
return *this; |
| 697 | 683 |
} |
| 698 |
- ~DialogTemplate() { this->ClearControls(); }
|
|
| 699 | 684 |
void AddGroupControl(const DialogControlBuilder<DialogGroupBuilder> &builder); |
| 700 | 685 |
void AddEditBoxControl(const DialogControlBuilder<DialogEditBoxBuilder> &builder); |
| 701 | 686 |
void AddLabelControl(const DialogControlBuilder<DialogLabelBuilder> &builder); |
| ... | ... |
@@ -45,7 +45,7 @@ protected: |
| 45 | 45 |
std::wstring titleFormat; |
| 46 | 46 |
DialogTemplate configDialog, configDialogProperty, infoDialog; |
| 47 | 47 |
std::vector<unsigned> supportedSampleRates; |
| 48 |
- std::auto_ptr<XSFConfigIO> configIO; |
|
| 48 |
+ std::unique_ptr<XSFConfigIO> configIO; |
|
| 49 | 49 |
|
| 50 | 50 |
XSFConfig(); |
| 51 | 51 |
std::wstring GetTextFromWindow(HWND hwnd); |
| ... | ... |
@@ -466,10 +466,10 @@ void XSFFile::SaveFile() const |
| 466 | 466 |
if (!allTags.empty()) |
| 467 | 467 |
{
|
| 468 | 468 |
xSF.write("[TAG]", 5);
|
| 469 |
- for (auto curr = allTags.begin(), end = allTags.end(); curr != end; ++curr) |
|
| 469 |
+ std::for_each(allTags.begin(), allTags.end(), [&](const std::string &tag) |
|
| 470 | 470 |
{
|
| 471 |
- xSF.write(curr->c_str(), curr->length()); |
|
| 471 |
+ xSF.write(tag.c_str(), tag.length()); |
|
| 472 | 472 |
xSF.write("\n", 1);
|
| 473 |
- } |
|
| 473 |
+ }); |
|
| 474 | 474 |
} |
| 475 | 475 |
} |
| ... | ... |
@@ -71,7 +71,7 @@ private: |
| 71 | 71 |
auto inputChars = std::vector<char>(input.begin(), input.end()); |
| 72 | 72 |
size_t length = inputChars.size(); |
| 73 | 73 |
auto masks = std::vector<std::ctype<char>::mask>(length); |
| 74 |
- std::use_facet<std::ctype<char> >(loc).is(&inputChars[0], &inputChars[length], &masks[0]); |
|
| 74 |
+ std::use_facet<std::ctype<char>>(loc).is(&inputChars[0], &inputChars[length], &masks[0]); |
|
| 75 | 75 |
for (size_t x = 0; x < length; ++x) |
| 76 | 76 |
if (inputChars[x] != '.' && !(masks[x] & std::ctype<char>::digit)) |
| 77 | 77 |
return false; |
| ... | ... |
@@ -31,7 +31,7 @@ struct eq_str : std::binary_function<std::string, std::string, bool> |
| 31 | 31 |
{
|
| 32 | 32 |
for (int i = CHAR_MIN; i <= CHAR_MAX; ++i) |
| 33 | 33 |
this->tab[i - CHAR_MIN] = static_cast<char>(i); |
| 34 |
- std::use_facet<std::ctype<char> >(L).toupper(this->tab, this->tab + (CHAR_MAX - CHAR_MIN + 1)); |
|
| 34 |
+ std::use_facet<std::ctype<char>>(L).toupper(this->tab, this->tab + (CHAR_MAX - CHAR_MIN + 1)); |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
bool operator()(const std::string &x, const std::string &y) const |
| ... | ... |
@@ -117,13 +117,20 @@ void getFileInfo(const in_char *file, in_char *title, int *length_in_ms) |
| 117 | 117 |
|
| 118 | 118 |
int infoBox(const in_char *file, HWND hwndParent) |
| 119 | 119 |
{
|
| 120 |
- auto xSF = std::auto_ptr<XSFFile>(new XSFFile()); |
|
| 120 |
+ auto xSF = std::unique_ptr<XSFFile>(new XSFFile()); |
|
| 121 | 121 |
if (!file || !*file) |
| 122 | 122 |
*xSF = *xSFFile; |
| 123 | 123 |
else |
| 124 | 124 |
{
|
| 125 |
- auto tmpxSF = std::auto_ptr<XSFFile>(new XSFFile(file)); |
|
| 126 |
- *xSF = *tmpxSF; |
|
| 125 |
+ try |
|
| 126 |
+ {
|
|
| 127 |
+ auto tmpxSF = std::unique_ptr<XSFFile>(new XSFFile(file)); |
|
| 128 |
+ *xSF = *tmpxSF; |
|
| 129 |
+ } |
|
| 130 |
+ catch (const std::exception &) |
|
| 131 |
+ {
|
|
| 132 |
+ return INFOBOX_UNCHANGED; |
|
| 133 |
+ } |
|
| 127 | 134 |
} |
| 128 | 135 |
// TODO: Eventually make a dialog box for editing the info |
| 129 | 136 |
/*xSFFileInInfo = xSF.get(); |
| ... | ... |
@@ -151,7 +158,7 @@ int play(const in_char *fn) |
| 151 | 158 |
{
|
| 152 | 159 |
try |
| 153 | 160 |
{
|
| 154 |
- auto tmpxSFPlayer = std::auto_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 161 |
+ auto tmpxSFPlayer = std::unique_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 155 | 162 |
xSFConfig->CopyConfigToMemory(tmpxSFPlayer.get(), true); |
| 156 | 163 |
if (!tmpxSFPlayer->Load()) |
| 157 | 164 |
return 1; |
| ... | ... |
@@ -356,7 +363,7 @@ extern "C" __declspec(dllexport) int winampGetExtendedFileInfoW(const wchar_t *f |
| 356 | 363 |
} |
| 357 | 364 |
} |
| 358 | 365 |
|
| 359 |
-std::auto_ptr<XSFFile> extendedXSFFile; |
|
| 366 |
+std::unique_ptr<XSFFile> extendedXSFFile; |
|
| 360 | 367 |
|
| 361 | 368 |
int wrapperWinampSetExtendedFileInfo(const char *data, const wchar_t *val) |
| 362 | 369 |
{
|
| ... | ... |
@@ -391,7 +398,7 @@ extern "C" __declspec(dllexport) int winampClearExtendedFileInfoW(const wchar_t |
| 391 | 398 |
return 0; |
| 392 | 399 |
} |
| 393 | 400 |
|
| 394 |
-intptr_t wrapperWinampGetExtendedRead_open(std::auto_ptr<XSFPlayer> tmpxSFPlayer, int *size, int *bps, int *nch, int *srate) |
|
| 401 |
+intptr_t wrapperWinampGetExtendedRead_open(std::unique_ptr<XSFPlayer> tmpxSFPlayer, int *size, int *bps, int *nch, int *srate) |
|
| 395 | 402 |
{
|
| 396 | 403 |
xSFConfig->CopyConfigToMemory(tmpxSFPlayer.get(), true); |
| 397 | 404 |
if (!tmpxSFPlayer->Load()) |
| ... | ... |
@@ -411,14 +418,14 @@ intptr_t wrapperWinampGetExtendedRead_open(std::auto_ptr<XSFPlayer> tmpxSFPlayer |
| 411 | 418 |
|
| 412 | 419 |
extern "C" __declspec(dllexport) intptr_t winampGetExtendedRead_open(const char *fn, int *size, int *bps, int *nch, int *srate) |
| 413 | 420 |
{
|
| 414 |
- auto tmpxSFPlayer = std::auto_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 415 |
- return wrapperWinampGetExtendedRead_open(tmpxSFPlayer, size, bps, nch, srate); |
|
| 421 |
+ auto tmpxSFPlayer = std::unique_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 422 |
+ return wrapperWinampGetExtendedRead_open(std::move(tmpxSFPlayer), size, bps, nch, srate); |
|
| 416 | 423 |
} |
| 417 | 424 |
|
| 418 | 425 |
extern "C" __declspec(dllexport) intptr_t winampGetExtendedRead_openW(const wchar_t *fn, int *size, int *bps, int *nch, int *srate) |
| 419 | 426 |
{
|
| 420 |
- auto tmpxSFPlayer = std::auto_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 421 |
- return wrapperWinampGetExtendedRead_open(tmpxSFPlayer, size, bps, nch, srate); |
|
| 427 |
+ auto tmpxSFPlayer = std::unique_ptr<XSFPlayer>(XSFPlayer::Create(fn)); |
|
| 428 |
+ return wrapperWinampGetExtendedRead_open(std::move(tmpxSFPlayer), size, bps, nch, srate); |
|
| 422 | 429 |
} |
| 423 | 430 |
|
| 424 | 431 |
int extendedSeekNeeded = -1; |
| ... | ... |
@@ -31,7 +31,7 @@ struct lt_str : std::binary_function<std::string, std::string, bool> |
| 31 | 31 |
{
|
| 32 | 32 |
for (int i = CHAR_MIN; i <= CHAR_MAX; ++i) |
| 33 | 33 |
this->tab[i - CHAR_MIN] = static_cast<char>(i); |
| 34 |
- std::use_facet<std::ctype<char> >(L).toupper(this->tab, this->tab + (CHAR_MAX - CHAR_MIN + 1)); |
|
| 34 |
+ std::use_facet<std::ctype<char>>(L).toupper(this->tab, this->tab + (CHAR_MAX - CHAR_MIN + 1)); |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
bool operator()(const std::string &x, const std::string &y) const |