예제 #1
0
/**
 * Unit test framework entry point for this set of unit tests.
 */
void testDir_win32_runTests() {

    int status;

    pcsl_mem_initialize(NULL, 0);

    pcsl_string_initialize();

    status = init();
    assertTrue("init failed", status == 0);

    /* Tests for additional API needed for JSR-75 */
    testDirectories();

    // Temporarily disabled for POSIX
    //testSizes();

    // Temporarily disabled for POSIX
    //testAttributes();

    // Temporarily disabled for POSIX
    //testTimes();

    tearDown();

    pcsl_string_finalize();

    pcsl_mem_finalize();

}
예제 #2
0
파일: midpStorage.c 프로젝트: sfsy1989/j2me
/*
 * Prefixing the system directory for storage, APP_DIR, with midp_home.
 *
 * @param midp_home file system path to where MIDP is installed
 *
 * @return 0 for success, non-zero for out of memory
 */
int
storageInitialize(char *midp_home) {
    jchar fsep = storageGetFileSeparator();

    if (storageInitDone) {
        /* Already initialized */
        return 0;
    }

    if (PCSL_STRING_OK != pcsl_string_initialize()) {
        REPORT_ERROR(LC_CORE, "Error: cannot initialize string library.\n");
        return -1;
    }

    if(pcsl_file_init() < 0)  {
        REPORT_ERROR(LC_CORE, "Error: out of memory.\n");
        return -1;
    }

    /* set up a path to the internal storage */
    if (PCSL_STRING_OK != pcsl_string_from_chars(midp_home, &sRoot[0])) {
        REPORT_ERROR(LC_CORE, "Error: out of memory.\n");
        storageFinalize();
        return -1;
    }

    /* performance hint: predict buffer capacity */
    pcsl_string_predict_size(&sRoot[0], pcsl_string_length(&sRoot[0]) + 2
                                    + PCSL_STRING_LITERAL_LENGTH(APP_DIR));
    if (PCSL_STRING_OK != pcsl_string_append_char(&sRoot[0], fsep)
     || PCSL_STRING_OK != pcsl_string_append(&sRoot[0], &APP_DIR)
     || PCSL_STRING_OK != pcsl_string_append_char(&sRoot[0], fsep)) {
        REPORT_ERROR(LC_CORE, "Error: out of memory.\n");
        storageFinalize();
        return -1;
    }

    if (0 != initializeConfigRoot(midp_home)) {
        storageFinalize();
        return -1;
    }

    storageInitDone = 1;
    return 0;
}