Update change log and spec for wrt-plugins-tizen_0.4.49
[framework/web/wrt-plugins-tizen.git] / src / Common / StandaloneConsole / StandaloneConsole.cpp
index c7720d8..3aba307 100755 (executable)
@@ -26,6 +26,7 @@
 #include <vector>
 #include <iostream>
 #include <termios.h>
+#include <JSUtil.h>
 
 #undef LOG_TAG
 #define LOG_TAG "TIZEN_DEVICEAPI"
@@ -291,6 +292,10 @@ JSContextRef StandaloneConsole::getGlobalContext(){
 
 JSValueRef StandaloneConsole::RunLineEx(const char* line, JSValueRef *exception){
     JSStringRef jsScript = JSStringCreateWithUTF8CString(line);
+    int size = strlen(line);
+    if( size != static_cast <int>(JSStringGetLength(jsScript))){
+        cout <<"error - fail to converting JSStringRef"<<endl;
+    }
     JSValueRef ret = JSEvaluateScript(mGlobalContext, jsScript, NULL, NULL, 0, exception);
     JSStringRelease(jsScript);
     return ret;
@@ -309,8 +314,8 @@ JSValueRef StandaloneConsole::RunScriptEx(const char* path, JSValueRef *exceptio
 
     if( length > 0 )
     {
-        char buff[length];
-        memset(buff, 0, length);
+        char buff[length+1];
+        memset(buff, 0, length+1);
         int r = fread(buff, 1, length, f);
         fclose(f);
 
@@ -404,8 +409,8 @@ class LineBuffer{
     vector<string> mHistory;
     string mLine;
     int mHistoryIndex;
-    int mCurrentPos;
-    int mCurrentPosTmp;
+    unsigned int mCurrentPos;
+    unsigned int mCurrentPosTmp;
     int mLineLength;
 public:
     LineBuffer():mHistoryIndex(0), mCurrentPos(0){
@@ -503,10 +508,10 @@ public:
                 case 49:
                     //home
                     mCurrentPos = 0;
-                    getch();
+                    a = getch();
                     break;
                 default:
-                    getch();
+                    a = getch();
             }
 
             return true;