Browse Source

Changed AppendUTF 0x0D 0x0A to Append \n

rsredsq 10 years ago
parent
commit
96f43ede73
2 changed files with 3 additions and 9 deletions
  1. 1 3
      Source/AtomicJS/Javascript/JSRequire.cpp
  2. 2 6
      Source/AtomicJS/Javascript/JSVM.cpp

+ 1 - 3
Source/AtomicJS/Javascript/JSRequire.cpp

@@ -133,9 +133,7 @@ namespace Atomic
             vm->SetLastModuleSearchFile(jsfile->GetFullPath());
             vm->SetLastModuleSearchFile(jsfile->GetFullPath());
             String source;
             String source;
             jsfile->ReadText(source);
             jsfile->ReadText(source);
-            //Appending a new line at the end of a script
-            source.AppendUTF8(0x0D);
-            source.AppendUTF8(0x0A);
+            source.Append('\n');
             duk_push_string(ctx, source.CString());
             duk_push_string(ctx, source.CString());
             return 1;
             return 1;
         }
         }

+ 2 - 6
Source/AtomicJS/Javascript/JSVM.cpp

@@ -310,9 +310,7 @@ bool JSVM::ExecuteScript(const String& scriptPath)
     String source;
     String source;
 
 
     file->ReadText(source);
     file->ReadText(source);
-    //Appending a new line at the end of a script
-    source.AppendUTF8(0x0D);
-    source.AppendUTF8(0x0A);
+    source.Append('\n');
 
 
     duk_push_string(ctx_, file->GetFullPath().CString());
     duk_push_string(ctx_, file->GetFullPath().CString());
     if (duk_eval_raw(ctx_, source.CString(), 0,
     if (duk_eval_raw(ctx_, source.CString(), 0,
@@ -338,9 +336,7 @@ bool JSVM::ExecuteFile(File *file)
     String source;
     String source;
 
 
     file->ReadText(source);
     file->ReadText(source);
-    //Appending a new line at the end of a script
-    source.AppendUTF8(0x0D);
-    source.AppendUTF8(0x0A);
+    source.Append('\n');
 
 
     duk_push_string(ctx_, file->GetFullPath().CString());
     duk_push_string(ctx_, file->GetFullPath().CString());
     if (duk_eval_raw(ctx_, source.CString(), 0,
     if (duk_eval_raw(ctx_, source.CString(), 0,