18
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
// SOFTWARE.
20
20
21
- #include < exception>
22
- #include " native\sass_interface.h"
23
21
#include " native\sass2scss.h"
24
22
#include " StringToANSI.hpp"
25
23
#include " SassInterface.hpp"
26
- #include " native\sass_context.h"
27
-
28
- using namespace std ;
29
24
30
25
namespace LibSassNet
31
26
{
32
27
int SassInterface::Compile (SassContext^ sassContext)
33
28
{
34
29
char * includePaths = MarshalString (sassContext->Options ->IncludePaths );
35
30
char * sourceString = MarshalString (sassContext->SourceString );
31
+ char * lineFeed = MarshalString (sassContext->Options ->LineFeed );
36
32
struct Sass_Data_Context * ctx;
37
33
38
34
try
@@ -45,12 +41,13 @@ namespace LibSassNet
45
41
sass_option_set_output_style (options, GetOutputStyle (sassContext->Options ->OutputStyle ));
46
42
sass_option_set_source_comments (options, sassContext->Options ->IncludeSourceComments );
47
43
sass_option_set_precision (options, sassContext->Options ->Precision );
44
+ sass_option_set_linefeed (options, lineFeed);
48
45
sass_option_set_include_path (options, includePaths);
49
- sass_option_set_omit_source_map_url (options, true );
46
+ sass_option_set_omit_source_map_url (options, sassContext-> Options -> OmitSourceMappingUrl );
50
47
51
48
sass_compile_data_context (ctx);
52
49
53
- sassContext->ErrorStatus = sass_context_get_error_status (ctx_out);
50
+ sassContext->ErrorStatus = !! sass_context_get_error_status (ctx_out);
54
51
sassContext->ErrorMessage = gcnew String (sass_context_get_error_message (ctx_out));
55
52
sassContext->OutputString = gcnew String (sass_context_get_output_string (ctx_out));
56
53
@@ -67,8 +64,6 @@ namespace LibSassNet
67
64
finally
68
65
{
69
66
// Free resources
70
- FreeString (includePaths);
71
- FreeString (sourceString);
72
67
sass_delete_data_context (ctx);
73
68
}
74
69
}
@@ -90,8 +85,9 @@ namespace LibSassNet
90
85
char * includePaths = MarshalString (sassFileContext->Options ->IncludePaths );
91
86
char * mapFile = MarshalString (sassFileContext->OutputSourceMapFile );
92
87
char * inputPath = MarshalString (sassFileContext->InputPath );
93
-
88
+ char * lineFeed = MarshalString (sassFileContext-> Options -> LineFeed );
94
89
struct Sass_File_Context * ctx;
90
+
95
91
try
96
92
{
97
93
ctx = sass_make_file_context (inputPath);
@@ -103,13 +99,14 @@ namespace LibSassNet
103
99
sass_option_set_output_style (options, GetOutputStyle (sassFileContext->Options ->OutputStyle ));
104
100
sass_option_set_source_comments (options, sassFileContext->Options ->IncludeSourceComments );
105
101
sass_option_set_precision (options, sassFileContext->Options ->Precision );
102
+ sass_option_set_linefeed (options, lineFeed);
106
103
sass_option_set_include_path (options, includePaths);
107
- sass_option_set_omit_source_map_url (options, String::IsNullOrEmpty ( sassFileContext->OutputSourceMapFile ) );
104
+ sass_option_set_omit_source_map_url (options, sassFileContext->Options -> OmitSourceMappingUrl );
108
105
sass_option_set_source_map_file (options, mapFile);
109
106
110
107
sass_compile_file_context (ctx);
111
108
112
- sassFileContext->ErrorStatus = sass_context_get_error_status (ctx_out);
109
+ sassFileContext->ErrorStatus = !! sass_context_get_error_status (ctx_out);
113
110
sassFileContext->ErrorMessage = gcnew String (sass_context_get_error_message (ctx_out));
114
111
sassFileContext->OutputString = gcnew String (sass_context_get_output_string (ctx_out));
115
112
sassFileContext->OutputSourceMap = gcnew String (sass_context_get_source_map_string (ctx_out));
@@ -127,9 +124,6 @@ namespace LibSassNet
127
124
finally
128
125
{
129
126
// Free resources
130
- FreeString (includePaths);
131
- FreeString (inputPath);
132
- FreeString (mapFile);
133
127
sass_delete_file_context (ctx);
134
128
}
135
129
}
@@ -156,6 +150,7 @@ namespace LibSassNet
156
150
}
157
151
finally
158
152
{
153
+ // Upstream will not free the memory in case of sass2scss
159
154
FreeString (sourceText);
160
155
}
161
156
}
@@ -205,4 +200,4 @@ namespace LibSassNet
205
200
sass_free_folder_context(ctx);
206
201
}
207
202
}*/
208
- }
203
+ }
0 commit comments