Skip to content

Commit

Permalink
clang dislikes sizeof a non-static member from an external scope?
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbradsmith committed Apr 26, 2024
1 parent 3b3ea96 commit c759a51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ typedef struct NSFCore_
mutable const char* error_last;
mutable sint32 error_last_code;
mutable char error_last_buffer[256]; // error_last may point to this for formatted errors
mutable char temp_text[1024]; // used for returned text information
static const int TEMP_TEXT_SIZE = 1024;
mutable char temp_text[TEMP_TEXT_SIZE]; // used for returned text information
mutable const uint8* active_prop_lines;
mutable uint32 active_prop_lines_len;

Expand Down
6 changes: 2 additions & 4 deletions core/nsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,6 @@ const char* NSFCore::prop_str(sint32 prop, sint32 song) const
return MISSING_STR;
}

const uint32 MAX_PROP_LINE_WIDTH = (sizeof(NSFCore::temp_text)/sizeof(NSFCore::temp_text[0])) - 1;

sint32 NSFCore::prop_lines(sint32 prop, sint32 song) const
{
PROPSETUP();
Expand Down Expand Up @@ -674,7 +672,7 @@ sint32 NSFCore::prop_lines(sint32 prop, sint32 song) const
else
{
++line_width;
if (line_width >= MAX_PROP_LINE_WIDTH) // break lines too long for temp_text
if (line_width >= (TEMP_TEXT_SIZE-1)) // break lines too long for temp_text
{
++lines;
line_width = 0;
Expand Down Expand Up @@ -712,7 +710,7 @@ const char* NSFCore::prop_line() const
{
temp_text[line_width] = c;
++line_width;
if (line_width >= MAX_PROP_LINE_WIDTH) break;
if (line_width >= (TEMP_TEXT_SIZE-1)) break;
}
}
temp_text[line_width] = 0;
Expand Down

0 comments on commit c759a51

Please sign in to comment.