Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: enable strict standards conformance with cl (msvc) #1317

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hiro/core/widget/table-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ auto mTableView::sort() -> type& {
}
auto sorted = state.items;
sorted.sort([&](auto& lhs, auto& rhs) {
string x = offset < lhs->cellCount() ? lhs->state.cells[offset]->state.text : "";
string y = offset < rhs->cellCount() ? rhs->state.cells[offset]->state.text : "";
string x = offset < lhs->cellCount() ? lhs->state.cells[offset]->state.text : ""_s;
string y = offset < rhs->cellCount() ? rhs->state.cells[offset]->state.text : ""_s;
if(sorting == Sort::Ascending ) return string::icompare(x, y) < 0;
if(sorting == Sort::Descending) return string::icompare(y, x) < 0;
return false; //unreachable
Expand Down
2 changes: 1 addition & 1 deletion hiro/extension/name-dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ auto NameDialog::show(string mode, string name) -> string {
setTitle(state.title);
if(!state.title && mode == "Create") setTitle("Create");
if(!state.title && mode == "Rename") setTitle({"Rename ", name});
textLabel.setText(state.text ? state.text : "Enter a name:");
textLabel.setText(state.text ? state.text : "Enter a name:"_s);
if(state.icon) {
image icon{state.icon};
icon.scale(16_sx, 16_sy);
Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ auto pFont::family(const string& family) -> string {
if(family == Font::Sans ) return "Tahoma";
if(family == Font::Serif) return "Georgia";
if(family == Font::Mono ) return "Lucida Console";
return family ? family : "Tahoma";
return family ? family : "Tahoma"_s;
}

auto pFont::create(const Font& font) -> HFONT {
Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/status-bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ auto pStatusBar::setFont(const Font&) -> void {
SendMessage(hwnd, WM_SETFONT, (WPARAM)hfont, 0);

auto& text = state().text;
auto height = font.size(text ? text : " ").height();
auto height = font.size(text ? text : " "_s).height();
SendMessage(hwnd, SB_SETMINHEIGHT, (WPARAM)height, 0);

if(auto parent = _parent()) {
Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/tool-tip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ auto pToolTip::show() -> void {
tracking.x = position.x, tracking.y = position.y;

position.y += 18;
auto textSize = pFont::size(Font(), text ? text : " ");
auto textSize = pFont::size(Font(), text ? text : " "_s);
size.cx = 12 + textSize.width();
size.cy = 12 + textSize.height();

Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/widget/check-label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ auto pCheckLabel::destruct() -> void {
}

auto pCheckLabel::minimumSize() const -> Size {
auto size = pFont::size(self().font(true), state().text ? state().text : " ");
auto size = pFont::size(self().font(true), state().text ? state().text : " "_s);
return {size.width() + 20_sx, size.height() + 4_sy};
}

Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/widget/label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ auto pLabel::destruct() -> void {
}

auto pLabel::minimumSize() const -> Size {
auto size = pFont::size(self().font(true), state().text ? state().text : " ");
auto size = pFont::size(self().font(true), state().text ? state().text : " "_s);
return {size.width(), size.height()};
}

Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/widget/line-edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ auto pLineEdit::destruct() -> void {
}

auto pLineEdit::minimumSize() const -> Size {
auto size = pFont::size(hfont, state().text ? state().text : " ");
auto size = pFont::size(hfont, state().text ? state().text : " "_s);
return {size.width() + 12, size.height() + 10};
}

Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/widget/radio-label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ auto pRadioLabel::destruct() -> void {
}

auto pRadioLabel::minimumSize() const -> Size {
auto size = pFont::size(self().font(true), state().text ? state().text : " ");
auto size = pFont::size(self().font(true), state().text ? state().text : " "_s);
return {size.width() + 20_sx, size.height() + 4_sy};
}

Expand Down
2 changes: 1 addition & 1 deletion hiro/windows/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ auto pWindow::_statusHeight() const -> s32 {
if(auto& statusBar = state().statusBar) {
if(statusBar->visible()) {
auto& text = statusBar->state.text;
height = statusBar->font(true).size(text ? text : " ").height();
height = statusBar->font(true).size(text ? text : " "_s).height();
height = max(height, minimumStatusHeight);
}
}
Expand Down
2 changes: 1 addition & 1 deletion mia/medium/super-famicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ auto SuperFamicom::region() const -> string {
if(E == 0x11) region = {"AUS"};
}

return region ? region : "NTSC";
return region ? region : "NTSC"_s;
}

auto SuperFamicom::videoRegion() const -> string {
Expand Down
2 changes: 1 addition & 1 deletion nall/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ endif
ifeq ($(cl),true)
flags.c = -TC -std:c11
flags.cpp = -TP -std:c++17 -EHsc
flags += -nologo -W2 -Fd$(object.path)/
flags += -nologo -permissive- -W2 -Fd$(object.path)/
options += -nologo $(if $(findstring clang,$(compiler)),-fuse-ld=lld) -link
else
flags.c = -x c -std=c11
Expand Down
20 changes: 10 additions & 10 deletions nall/image/multifactor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
namespace nall {

inline multiFactorImage::multiFactorImage(const multiFactorImage& source) {
(*this) = source;
operator=(source);
}

inline multiFactorImage::multiFactorImage(multiFactorImage&& source) {
operator=(std::forward<multiFactorImage>(source));
operator=(std::move(source));
}

inline multiFactorImage::multiFactorImage(const image& lowDPI, const image& highDPI) {
(*(image*)this) = lowDPI;
image::operator=(lowDPI);
_highDPI = highDPI;
}

inline multiFactorImage::multiFactorImage(const image& source) {
(*(image*)this) = source;
image::operator=(source);
}

inline multiFactorImage::multiFactorImage(image&& source) {
operator=(std::forward<multiFactorImage>(source));
image::operator=(std::move(source));
}

inline multiFactorImage::multiFactorImage() {
Expand All @@ -32,7 +32,7 @@ inline multiFactorImage::~multiFactorImage() {
inline auto multiFactorImage::operator=(const multiFactorImage& source) -> multiFactorImage& {
if(this == &source) return *this;

(*(image*)this) = source;
image::operator=(source);
_highDPI = source._highDPI;

return *this;
Expand All @@ -41,15 +41,15 @@ inline auto multiFactorImage::operator=(const multiFactorImage& source) -> multi
inline auto multiFactorImage::operator=(multiFactorImage&& source) -> multiFactorImage& {
if(this == &source) return *this;

(*(image*)this) = source;
_highDPI = source._highDPI;
image::operator=(std::move(source));
_highDPI = std::move(source._highDPI);

return *this;
}

inline auto multiFactorImage::operator==(const multiFactorImage& source) const -> bool {
if((const image&)*this != (const image&)source) return false;
return _highDPI != source._highDPI;
if(image::operator!=(source)) return false;
return _highDPI == source._highDPI;
}

inline auto multiFactorImage::operator!=(const multiFactorImage& source) const -> bool {
Expand Down
2 changes: 1 addition & 1 deletion nall/string/pascal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct string_pascal {

explicit operator bool() const { return _data; }
operator const char*() const { return _data ? _data + sizeof(u32) : nullptr; }
operator string() const { return _data ? string{_data + sizeof(u32)} : ""; }
operator string() const { return _data ? string{_data + sizeof(u32)} : ""_s; }

auto operator=(const string_pascal& source) -> type& {
if(this == &source) return *this;
Expand Down
Loading