Commit f9964c87 by Aaron Leung

All warnings gone!

parent 2730e08a
...@@ -32,11 +32,15 @@ namespace Sass { ...@@ -32,11 +32,15 @@ namespace Sass {
f = std::fopen(path.c_str(), "rb"); f = std::fopen(path.c_str(), "rb");
if (!f) throw path; if (!f) throw path;
if (std::fseek(f, 0, SEEK_END)) throw path; if (std::fseek(f, 0, SEEK_END)) throw path;
int len = std::ftell(f); int status = std::ftell(f);
if (len < 0) throw path; if (status < 0) throw path;
size_t len = status;
std::rewind(f); std::rewind(f);
char* source = new char[len + 1]; char* source = new char[len + 1];
std::fread(source, sizeof(char), len, f); size_t bytes_read = std::fread(source, sizeof(char), len, f);
if (bytes_read != len) {
std::cerr << "Warning: possible error reading from " << path << std::endl;
}
if (std::ferror(f)) throw path; if (std::ferror(f)) throw path;
source[len] = '\0'; source[len] = '\0';
char* end = source + len; char* end = source + len;
......
...@@ -472,7 +472,7 @@ namespace Sass { ...@@ -472,7 +472,7 @@ namespace Sass {
if (l1.type() != Node::nil) size += l1.size(); if (l1.type() != Node::nil) size += l1.size();
if (l2.type() != Node::nil) size += l2.size(); if (l2.type() != Node::nil) size += l2.size();
// figure out the result type in advance // figure out the result type in advance
Node::Type rtype; Node::Type rtype = Node::space_list;
if (has_sep) { if (has_sep) {
string sep(bindings[parameters[2]].token().unquote()); string sep(bindings[parameters[2]].token().unquote());
if (sep == "comma") rtype = Node::comma_list; if (sep == "comma") rtype = Node::comma_list;
......
...@@ -90,8 +90,8 @@ namespace Sass { ...@@ -90,8 +90,8 @@ namespace Sass {
Type lhs_type = type(); Type lhs_type = type();
Type rhs_type = rhs.type(); Type rhs_type = rhs.type();
if (lhs_type == number && rhs_type == number || if ((lhs_type == number && rhs_type == number) ||
lhs_type == numeric_percentage && rhs_type == numeric_percentage) { (lhs_type == numeric_percentage && rhs_type == numeric_percentage)) {
return numeric_value() < rhs.numeric_value(); return numeric_value() < rhs.numeric_value();
} }
else if (lhs_type == numeric_dimension && rhs_type == numeric_dimension) { else if (lhs_type == numeric_dimension && rhs_type == numeric_dimension) {
...@@ -243,6 +243,8 @@ namespace Sass { ...@@ -243,6 +243,8 @@ namespace Sass {
break; break;
// throw an exception? // throw an exception?
} }
// if you reach this point, you've got a logic error somewhere
return 0;
} }
extern const char percent_str[] = "%"; extern const char percent_str[] = "%";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment