Skip to content

Commit d8b8902

Browse files
committed
Merge pull request #1423 from CapitalID/winx64_fixes
Fixing current build issues on Windows 64 bits with MSVC 12/2013
2 parents d85ce29 + 423e252 commit d8b8902

File tree

10 files changed

+43
-29
lines changed

10 files changed

+43
-29
lines changed

include/sass.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55

66
#ifdef _MSC_VER
77
#pragma warning(disable : 4503)
8+
9+
#ifndef _SCL_SECURE_NO_WARNINGS
810
#define _SCL_SECURE_NO_WARNINGS
11+
#endif
12+
13+
#ifndef _CRT_SECURE_NO_WARNINGS
914
#define _CRT_SECURE_NO_WARNINGS
15+
#endif
16+
17+
#ifndef _CRT_NONSTDC_NO_DEPRECATE
1018
#define _CRT_NONSTDC_NO_DEPRECATE
1119
#endif
1220

21+
#endif
22+
1323
#include <stddef.h>
1424
#include <stdbool.h>
1525

src/ast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ namespace Sass {
18281828
{
18291829
// do we have have too much precision?
18301830
if (pos_fract < precision + pos_point)
1831-
{ precision = pos_fract - pos_point; }
1831+
{ precision = (int)(pos_fract - pos_point); }
18321832
// round value again
18331833
ss.precision(precision);
18341834
ss << fixed << value_;

src/cencode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
4040
{
4141
state_in->result = result;
4242
state_in->step = step_A;
43-
return codechar - code_out;
43+
return (int)(codechar - code_out);
4444
}
4545
fragment = *plainchar++;
4646
result = (fragment & 0x0fc) >> 2;
@@ -51,7 +51,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
5151
{
5252
state_in->result = result;
5353
state_in->step = step_B;
54-
return codechar - code_out;
54+
return (int)(codechar - code_out);
5555
}
5656
fragment = *plainchar++;
5757
result |= (fragment & 0x0f0) >> 4;
@@ -62,7 +62,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
6262
{
6363
state_in->result = result;
6464
state_in->step = step_C;
65-
return codechar - code_out;
65+
return (int)(codechar - code_out);
6666
}
6767
fragment = *plainchar++;
6868
result |= (fragment & 0x0c0) >> 6;
@@ -74,7 +74,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
7474
}
7575
}
7676
/* control should not reach here */
77-
return codechar - code_out;
77+
return (int)(codechar - code_out);
7878
}
7979

8080
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
@@ -97,6 +97,6 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
9797
}
9898
*codechar++ = '\n';
9999

100-
return codechar - code_out;
100+
return (int)(codechar - code_out);
101101
}
102102

src/eval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ namespace Sass {
514514
Expression::Concrete_Type l_type = lhs->concrete_type();
515515
Expression::Concrete_Type r_type = rhs->concrete_type();
516516

517-
int precision = ctx.precision;
517+
int precision = (int)ctx.precision;
518518
bool compressed = ctx.output_style == COMPRESSED;
519519
if (l_type == Expression::NUMBER && r_type == Expression::NUMBER) {
520520
const Number* l_n = dynamic_cast<const Number*>(lhs);

src/functions.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ namespace Sass {
864864
// other errors will be re-thrown
865865
catch (...) { handle_utf8_error(pstate, backtrace); }
866866
// return something even if we had an error (-1)
867-
return new (ctx.mem) Number(pstate, len);
867+
return new (ctx.mem) Number(pstate, (double)len);
868868
}
869869

870870
Signature str_insert_sig = "str-insert($string, $insert, $index)";
@@ -935,7 +935,7 @@ namespace Sass {
935935
// other errors will be re-thrown
936936
catch (...) { handle_utf8_error(pstate, backtrace); }
937937
// return something even if we had an error (-1)
938-
return new (ctx.mem) Number(pstate, index);
938+
return new (ctx.mem) Number(pstate, (double)index);
939939
}
940940

941941
Signature str_slice_sig = "str-slice($string, $start-at, $end-at:-1)";
@@ -952,7 +952,7 @@ namespace Sass {
952952
size_t size = utf8::distance(str.begin(), str.end());
953953
if (end_at <= size * -1.0) { end_at += size; }
954954
if (end_at < 0) { end_at += size + 1; }
955-
if (end_at > size) { end_at = size; }
955+
if (end_at > size) { end_at = (double)size; }
956956
if (start_at < 0) { start_at += size + 1; }
957957
else if (start_at == 0) { ++ start_at; }
958958

@@ -1126,21 +1126,21 @@ namespace Sass {
11261126
if (v->concrete_type() == Expression::MAP) {
11271127
Map* map = dynamic_cast<Map*>(env["$list"]);
11281128
return new (ctx.mem) Number(pstate,
1129-
map ? map->length() : 1);
1129+
(double)(map ? map->length() : 1));
11301130
}
11311131
if (v->concrete_type() == Expression::SELECTOR) {
11321132
if (Compound_Selector* h = dynamic_cast<Compound_Selector*>(v)) {
1133-
return new (ctx.mem) Number(pstate, h->length());
1133+
return new (ctx.mem) Number(pstate, (double)h->length());
11341134
} else if (Selector_List* ls = dynamic_cast<Selector_List*>(v)) {
1135-
return new (ctx.mem) Number(pstate, ls->length());
1135+
return new (ctx.mem) Number(pstate, (double)ls->length());
11361136
} else {
11371137
return new (ctx.mem) Number(pstate, 1);
11381138
}
11391139
}
11401140

11411141
List* list = dynamic_cast<List*>(env["$list"]);
11421142
return new (ctx.mem) Number(pstate,
1143-
list ? list->size() : 1);
1143+
(double)(list ? list->size() : 1));
11441144
}
11451145

11461146
Signature nth_sig = "nth($list, $n)";
@@ -1202,7 +1202,7 @@ namespace Sass {
12021202
*l << ARG("$list", Expression);
12031203
}
12041204
for (size_t i = 0, L = l->length(); i < L; ++i) {
1205-
if (Eval::eq(l->value_at_index(i), v)) return new (ctx.mem) Number(pstate, i+1);
1205+
if (Eval::eq(l->value_at_index(i), v)) return new (ctx.mem) Number(pstate, (double)(i+1));
12061206
}
12071207
return new (ctx.mem) Null(pstate);
12081208
}

src/inspect.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ namespace Sass {
461461
{
462462
// use values to_string facility
463463
bool compressed = ctx->output_style == COMPRESSED;
464-
string res = n->to_string(compressed, ctx->precision);
464+
string res = n->to_string(compressed, (int)ctx->precision);
465465
// output the final token
466466
append_token(res, n);
467467
}
@@ -470,7 +470,7 @@ namespace Sass {
470470
{
471471
// use values to_string facility
472472
bool compressed = ctx->output_style == COMPRESSED;
473-
string res = c->to_string(compressed, ctx->precision);
473+
string res = c->to_string(compressed, (int)ctx->precision);
474474
// output the final token
475475
append_token(res, c);
476476
}
@@ -479,7 +479,7 @@ namespace Sass {
479479
{
480480
// use values to_string facility
481481
bool compressed = ctx->output_style == COMPRESSED;
482-
string res = b->to_string(compressed, ctx->precision);
482+
string res = b->to_string(compressed, (int)ctx->precision);
483483
// output the final token
484484
append_token(res, b);
485485
}
@@ -498,7 +498,7 @@ namespace Sass {
498498
void Inspect::operator()(String_Constant* s)
499499
{
500500
// get options from optional? context
501-
int precision = ctx ? ctx->precision : 5;
501+
int precision = ctx ? (int)ctx->precision : 5;
502502
bool compressed = ctx ? ctx->output_style == COMPRESSED : false;
503503
// use values to_string facility
504504
string res(s->to_string(compressed, precision));
@@ -509,7 +509,7 @@ namespace Sass {
509509
void Inspect::operator()(String_Quoted* s)
510510
{
511511
// get options from optional? context
512-
int precision = ctx ? ctx->precision : 5;
512+
int precision = ctx ? (int)ctx->precision : 5;
513513
bool compressed = ctx ? ctx->output_style == COMPRESSED : false;
514514
// use values to_string facility
515515
string res(s->to_string(compressed, precision));
@@ -614,7 +614,7 @@ namespace Sass {
614614
{
615615
// use values to_string facility
616616
bool compressed = ctx->output_style == COMPRESSED;
617-
string res = n->to_string(compressed, ctx->precision);
617+
string res = n->to_string(compressed, (int)ctx->precision);
618618
// output the final token
619619
append_token(res, n);
620620
}

src/json.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static void sb_put(SB *sb, const char *bytes, int count)
134134

135135
static void sb_puts(SB *sb, const char *str)
136136
{
137-
sb_put(sb, str, strlen(str));
137+
sb_put(sb, str, (int)strlen(str));
138138
}
139139

140140
static char *sb_finish(SB *sb)
@@ -684,7 +684,7 @@ static bool parse_value(const char **sp, JsonNode **out)
684684
return false;
685685

686686
case '"': {
687-
char *str;
687+
char *str = NULL;
688688
if (parse_string(&s, out ? &str : NULL)) {
689689
if (out)
690690
*out = mkstring(str);
@@ -725,7 +725,7 @@ static bool parse_array(const char **sp, JsonNode **out)
725725
{
726726
const char *s = *sp;
727727
JsonNode *ret = out ? json_mkarray() : NULL;
728-
JsonNode *element;
728+
JsonNode *element = NULL;
729729

730730
if (*s++ != '[')
731731
goto failure;
@@ -769,8 +769,8 @@ static bool parse_object(const char **sp, JsonNode **out)
769769
{
770770
const char *s = *sp;
771771
JsonNode *ret = out ? json_mkobject() : NULL;
772-
char *key;
773-
JsonNode *value;
772+
char *key = NULL;
773+
JsonNode *value = NULL;
774774

775775
if (*s++ != '{')
776776
goto failure;

src/sass_context.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define LFEED "\n"
77
#endif
88

9+
#include "sass.h"
10+
911
#include <cstring>
1012
#include <stdexcept>
1113
#include "file.hpp"
@@ -227,8 +229,8 @@ extern "C" {
227229
JsonNode* json_err = json_mkobject();
228230
json_append_member(json_err, "status", json_mknumber(1));
229231
json_append_member(json_err, "file", json_mkstring(e.pstate.path));
230-
json_append_member(json_err, "line", json_mknumber(e.pstate.line+1));
231-
json_append_member(json_err, "column", json_mknumber(e.pstate.column+1));
232+
json_append_member(json_err, "line", json_mknumber((double)(e.pstate.line+1)));
233+
json_append_member(json_err, "column", json_mknumber((double)(e.pstate.column+1)));
232234
json_append_member(json_err, "message", json_mkstring(e.message.c_str()));
233235
string rel_path(Sass::File::resolve_relative_path(e.pstate.path, cwd, cwd));
234236

src/sass_interface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define LFEED "\n"
77
#endif
88

9+
#include "sass.h"
10+
911
#include <string>
1012
#include <cstdlib>
1113
#include <cstring>

src/sass_util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ namespace Sass {
233233
KeyType key = keyFunc(e);
234234

235235
if (grouped.find(key) == grouped.end()) {
236-
order.insert(make_pair(order.size(), key));
236+
order.insert(make_pair((unsigned int)order.size(), key));
237237

238238
vector<EnumType> newCollection;
239239
newCollection.push_back(e);

0 commit comments

Comments
 (0)