mirror of https://github.com/axmolengine/axmol.git
Remove commented code
This commit is contained in:
parent
51911d066d
commit
3c11684bf7
|
@ -221,87 +221,6 @@ void ScriptingCore::createGlobalContext() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
static unsigned long
|
||||
fileutils_read_into_new_memory(const char* relativepath,
|
||||
unsigned char** content) {
|
||||
*content = NULL;
|
||||
|
||||
AAssetManager* assetmanager =
|
||||
JniHelper::getAssetManager();
|
||||
if (NULL == assetmanager) {
|
||||
LOGD("assetmanager : is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// read asset data
|
||||
AAsset* asset =
|
||||
AAssetManager_open(assetmanager,
|
||||
relativepath,
|
||||
AASSET_MODE_UNKNOWN);
|
||||
if (NULL == asset) {
|
||||
LOGD("asset : is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t size = AAsset_getLength(asset);
|
||||
LOGD("size = %d ", size);
|
||||
|
||||
unsigned char* buf =
|
||||
(unsigned char*) malloc((sizeof(unsigned char)) * (size+1));
|
||||
if (NULL == buf) {
|
||||
LOGD("memory allocation failed");
|
||||
AAsset_close(asset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bytesread = AAsset_read(asset, buf, size);
|
||||
LOGD("bytesread = %d ", bytesread);
|
||||
buf[bytesread] = '\0';
|
||||
|
||||
AAsset_close(asset);
|
||||
|
||||
*content = (unsigned char*) buf;
|
||||
return bytesread;
|
||||
}
|
||||
|
||||
JSBool ScriptingCore::runScript(const char *path)
|
||||
{
|
||||
LOGD("ScriptingCore::runScript(%s)", path);
|
||||
|
||||
if (NULL == path) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
unsigned char* content = NULL;
|
||||
unsigned long contentsize = 0;
|
||||
|
||||
contentsize = fileutils_read_into_new_memory(path, &content);
|
||||
|
||||
if (NULL == content) {
|
||||
LOGD("(NULL == content)");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (contentsize <= 0) {
|
||||
LOGD("(contentsize <= 0)");
|
||||
free(content);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
jsval rval;
|
||||
JSBool ret = this->evalString((const char *)content, &rval, path);
|
||||
free(content);
|
||||
|
||||
LOGD("... ScriptingCore::runScript(%s) done successfully.", path);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static size_t readFileInMemory(const char *path, unsigned char **buff) {
|
||||
struct stat buf;
|
||||
int file = open(path, O_RDONLY);
|
||||
|
@ -348,8 +267,6 @@ JSBool ScriptingCore::runScript(const char *path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ScriptingCore::~ScriptingCore()
|
||||
{
|
||||
JS_DestroyContext(cx);
|
||||
|
|
Loading…
Reference in New Issue