Skip to content

Commit d058fe0

Browse files
committed
Fix a few issues
1 parent 18e402e commit d058fe0

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

include/sass/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ extern "C" {
154154
ADDAPI const struct SassError* ADDCALL sass_compiler_get_error(struct SassCompiler* compiler);
155155

156156
// Returns status code for compiler (0 meaning success, anything else is an error)
157-
ADDAPI const int ADDCALL sass_compiler_get_status(struct SassCompiler* compiler);
157+
ADDAPI int ADDCALL sass_compiler_get_status(struct SassCompiler* compiler);
158158

159159
/////////////////////////////////////////////////////////////////////////
160160
/////////////////////////////////////////////////////////////////////////

src/capi_compiler.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ namespace Sass {
2323
formatted << "Error: ";
2424
// Add message and ensure it is
2525
// added with a final line-feed.
26-
if (what != nullptr) {
27-
formatted << what;
28-
while (*what) {
26+
const char* msg = what;
27+
if (msg != nullptr) {
28+
formatted << msg;
29+
while (*msg) {
2930
has_final_lf =
30-
*what == '\r' ||
31-
*what == '\n';
32-
++what;
31+
*msg == '\r' ||
32+
*msg == '\n';
33+
++msg;
3334
}
3435
if (!has_final_lf) {
3536
formatted << STRMLF;
@@ -563,7 +564,7 @@ extern "C" {
563564
}
564565

565566
// Returns status code for compiler (0 meaning success, anything else is an error)
566-
const int ADDCALL sass_compiler_get_status(struct SassCompiler* compiler)
567+
int ADDCALL sass_compiler_get_status(struct SassCompiler* compiler)
567568
{
568569
return Compiler::unwrap(compiler).error.status;
569570
}

src/logger.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,31 @@ namespace Sass {
1616
columns(columns),
1717
style(style)
1818
{
19-
setLogStyle(style);
19+
setLogStyle(style, columns);
2020
}
2121

22-
void Logger::setLogStyle(enum SassLoggerStyle style)
22+
void Logger::setLogStyle(enum SassLoggerStyle style, size_t columns)
2323
{
2424
// This auto-detection is experimental
2525
// We do our best but hard to make portable
26-
if (this->style == SASS_LOGGER_AUTO) {
26+
if (style == SASS_LOGGER_AUTO) {
2727
auto colors = Terminal::hasColorSupport(true);
2828
bool unicode = Terminal::hasUnicodeSupport(true);
2929
if (colors && unicode) { this->style = SASS_LOGGER_UNICODE_COLOR; }
3030
else if (unicode) { this->style = SASS_LOGGER_UNICODE_MONO; }
3131
else if (colors) { this->style = SASS_LOGGER_ASCII_COLOR; }
3232
else { this->style = SASS_LOGGER_ASCII_MONO; }
3333
}
34+
else {
35+
this->style = style;
36+
}
3437
// Auto-detect available columns
3538
if (columns == NPOS) {
3639
this->columns = Terminal::getColumns(true);
3740
}
41+
else {
42+
this->columns = columns;
43+
}
3844
// Clamp into a sensible range
3945
if (columns > 800) { columns = 800; }
4046
else if (columns < 40) { columns = 40; }

src/logger.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ namespace Sass {
9292
Logger(enum SassLoggerStyle style = SASS_LOGGER_ASCII_MONO,
9393
int precision = SassDefaultPrecision, size_t columns = NPOS);
9494

95-
void setLogPrecision(int precision);
95+
void setLogStyle(enum SassLoggerStyle style, size_t columns = NPOS);
9696

97-
void setLogStyle(enum SassLoggerStyle style);
97+
void setLogPrecision(int precision);
9898

9999
void addWarning(const sass::string& message);
100100

0 commit comments

Comments
 (0)