* Merged twisti branch to default. This merge introduces C++ wrapper
[cacao.git] / src / vmcore / suck.c
index 933ceab0074736a8990945aaebec65e7aaf63436..b3c05cfe497614d6634e8479dfdb12e329822b4d 100644 (file)
 #include "toolbox/logging.h"
 #include "toolbox/util.h"
 
-#include "vm/exceptions.h"
+#include "vm/exceptions.hpp"
 #include "vm/properties.h"
-#include "vm/vm.h"
+#include "vm/vm.hpp"
 
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
 #include "vmcore/suck.h"
-#include "vmcore/system.h"
+#include "vmcore/os.hpp"
 #include "vmcore/zip.h"
 
 
@@ -81,11 +81,7 @@ bool suck_init(void)
 
 *******************************************************************************/
 
-#if defined(__LINUX__)
 static int scandir_filter(const struct dirent *a)
-#else
-static int scandir_filter(struct dirent *a)
-#endif
 {
        s4 namlen;
 
@@ -230,11 +226,11 @@ void suck_add(char *classpath)
 
 *******************************************************************************/
 
-void suck_add_from_property(char *key)
+void suck_add_from_property(const char *key)
 {
-       char           *value;
-       char           *start;
-       char           *end;
+       const char     *value;
+       const char     *start;
+       const char     *end;
        char           *path;
        s4              pathlen;
        struct dirent **namelist;
@@ -279,7 +275,7 @@ void suck_add_from_property(char *key)
 
                        /* scan the directory found for zip/jar files */
 
-                       n = system_scandir(path, &namelist, scandir_filter, alphasort);
+                       n = os_scandir(path, &namelist, scandir_filter, alphasort);
 
                        /* On error, just continue, this should be ok. */
 
@@ -293,7 +289,8 @@ void suck_add_from_property(char *key)
 
                                        /* Allocate memory for bootclasspath. */
 
-                                       boot_class_path = properties_get("sun.boot.class.path");
+                                       // FIXME Make boot_class_path const char*.
+                                       boot_class_path = (char*) properties_get("sun.boot.class.path");
 
                                        p = MNEW(char,
                                                         pathlen + strlen("/") + namlen +
@@ -555,10 +552,10 @@ classbuffer *suck_start(classinfo *c)
                        strcpy(path, lce->path);
                        strcat(path, filename);
 
-                       classfile = system_fopen(path, "r");
+                       classfile = os_fopen(path, "r");
 
                        if (classfile) {                                   /* file exists */
-                               if (!system_stat(path, &buffer)) {     /* read classfile data */
+                               if (!os_stat(path, &buffer)) {     /* read classfile data */
                                        cb = NEW(classbuffer);
                                        cb->clazz = c;
                                        cb->size  = buffer.st_size;
@@ -568,7 +565,7 @@ classbuffer *suck_start(classinfo *c)
 
                                        /* read class data */
 
-                                       len = system_fread((void *) cb->data, 1, cb->size,
+                                       len = os_fread((void *) cb->data, 1, cb->size,
                                                                           classfile);
 
                                        if (len != buffer.st_size) {
@@ -579,7 +576,7 @@ classbuffer *suck_start(classinfo *c)
 
                                        /* close the class file */
 
-                                       system_fclose(classfile);
+                                       os_fclose(classfile);
                                }
                        }