• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pcsl_string_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pcsl_string_free函数的典型用法代码示例。如果您正苦于以下问题:C++ pcsl_string_free函数的具体用法?C++ pcsl_string_free怎么用?C++ pcsl_string_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pcsl_string_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_cleanup

/**
 * The recursive helper function. It deletes all files inside specified
 * directory and calls itself to delete subdirectories.
 *
 * @param pDirName the directory to delete
 * @param pSep system-dependent file separator
 */
void do_cleanup(const pcsl_string* pDirName, const pcsl_string* pSep)
{
    void* fileList = NULL;
    pcsl_string fileName = PCSL_STRING_NULL;
    pcsl_string dirName  = PCSL_STRING_NULL;

    // add tailing file separator to directory name
    if (pcsl_string_cat(pDirName, pSep, &dirName) != PCSL_STRING_OK) {
        return;
    }

    fileList = pcsl_file_openfilelist(&dirName);
    if (fileList == NULL) {
        pcsl_string_free(&dirName);
        return;
    }

    // iterate over the directory's content
    while (!pcsl_file_getnextentry(fileList, &dirName, &fileName)) {
        int isDir = pcsl_file_is_directory(&fileName);
        if (isDir == 1) {
            // make recursion
            do_cleanup(&fileName, pSep);
        } else {
            // remove file
            pcsl_file_unlink(&fileName);
        }
        pcsl_string_free(&fileName);
    };

    pcsl_string_free(&dirName);
    pcsl_file_closefilelist(fileList);
    // remove empty directory
    pcsl_file_rmdir(pDirName);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:42,代码来源:fcCleanup.c


示例2: Java_com_sun_midp_content_RegistryStore_getHandler0

 /**
  * java call:
  * private native String getHandler0(String callerId, String id, int mode);
  */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_getHandler0(void) {
    int mode;
    pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
    pcsl_string id = PCSL_STRING_NULL_INITIALIZER;
    JSR211_RESULT_CH handler = _JSR211_RESULT_INITIALIZER_;
    
    KNI_StartHandles(2);
    KNI_DeclareHandle(callerObj);
    KNI_DeclareHandle(handlerObj);

    do {
        KNI_GetParameterAsObject(1, callerObj);
        KNI_GetParameterAsObject(2, handlerObj);
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(handlerObj, &id)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                   "RegistryStore_getHandler0 no memory for string arguments");
            break;
        }
        mode = KNI_GetParameterAsInt(3);

        jsr211_get_handler(&callerId, &id, mode, &handler);
    } while (0);

    pcsl_string_free(&callerId);
    pcsl_string_free(&id);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&handler, handlerObj);

    KNI_EndHandlesAndReturnObject(handlerObj);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:35,代码来源:regstore.c


示例3: Java_com_sun_midp_content_RegistryStore_findHandler0

/**
 * java call:
 *   private native String findHandler0(String callerId, int searchBy, 
 *                                      String value);
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_findHandler0(void) {
    pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
    jsr211_field searchBy;
    pcsl_string value = PCSL_STRING_NULL_INITIALIZER;
    JSR211_RESULT_CHARRAY result = _JSR211_RESULT_INITIALIZER_;

    KNI_StartHandles(2);
    KNI_DeclareHandle(callerObj);
    KNI_DeclareHandle(valueObj);

    do {
        KNI_GetParameterAsObject(1, callerObj);
        KNI_GetParameterAsObject(3, valueObj);
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(valueObj, &value)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                   "RegistryStore_register0 no memory for string arguments");
            break;
        }

        searchBy = (jsr211_field) KNI_GetParameterAsInt(2);
        jsr211_find_handler(&callerId, searchBy, &value, &result);

    } while (0);

    pcsl_string_free(&value);
    pcsl_string_free(&callerId);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, valueObj);

    KNI_EndHandlesAndReturnObject(valueObj);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:37,代码来源:regstore.c


示例4: Java_com_sun_midp_content_RegistryStore_getByURL0

/**
 * java call:
 *  private native String getByURL0(String callerId, String url, String action);
 */
KNIEXPORT KNI_RETURNTYPE_OBJECT
Java_com_sun_midp_content_RegistryStore_getByURL0(void) {
    pcsl_string callerId = PCSL_STRING_NULL_INITIALIZER;
    pcsl_string url = PCSL_STRING_NULL_INITIALIZER;
    pcsl_string action = PCSL_STRING_NULL_INITIALIZER;
    JSR211_RESULT_CH result = _JSR211_RESULT_INITIALIZER_;

    KNI_StartHandles(4);
    KNI_DeclareHandle(callerObj);
    KNI_DeclareHandle(urlObj);
    KNI_DeclareHandle(actionObj);
    KNI_DeclareHandle(resultObj);

    do {
        KNI_GetParameterAsObject(1, callerObj);
        KNI_GetParameterAsObject(2, urlObj);
        KNI_GetParameterAsObject(3, actionObj);
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(callerObj, &callerId) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(urlObj, &url) ||
            PCSL_STRING_OK != midp_jstring_to_pcsl_string(actionObj, &action)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                   "RegistryStore_getByURL0 no memory for string arguments");
            break;
        }

        jsr211_handler_by_URL(&callerId, &url, &action, &result);
    } while (0);

    pcsl_string_free(&action);
    pcsl_string_free(&url);
    pcsl_string_free(&callerId);
    result2string((_JSR211_INTERNAL_RESULT_BUFFER_*)&result, resultObj);

    KNI_EndHandlesAndReturnObject(resultObj);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:39,代码来源:regstore.c


示例5: jsr211_cleanHandlerData

/**
 * Cleans up all data memebers of given data structure,
 * <br>but <code>handler</code> itself is not cleared.
 * @param handler pointer on data structure 
 * <code>JSR211_content_handler</code> to be cleared.
 */
void jsr211_cleanHandlerData(JSR211_content_handler *handler) {
    // clean up handler structure 
    if (pcsl_string_is_null(&(handler->id)) == PCSL_FALSE) {
        pcsl_string_free(&(handler->id));
    }
    if (pcsl_string_is_null(&(handler->class_name)) == PCSL_FALSE) {
        pcsl_string_free(&(handler->class_name));
    }
    if (handler->type_num > 0 && handler->types != NULL) {
        free_pcsl_string_list(handler->types, handler->type_num);
    }
    if (handler->suff_num > 0 && handler->suffixes != NULL) {
        free_pcsl_string_list(handler->suffixes, handler->suff_num);
    }
    if (handler->act_num > 0 && handler->actions != NULL) {
        free_pcsl_string_list(handler->actions, handler->act_num);
    }
    if (handler->locale_num > 0 && handler->locales != NULL) {
        free_pcsl_string_list(handler->locales, handler->locale_num);
    }
    if (handler->act_num > 0 && handler->locale_num > 0 && handler->action_map != NULL) {
        free_pcsl_string_list(handler->action_map, handler->act_num * handler->locale_num);
    }
    if (handler->access_num > 0 && handler->accesses != NULL) {
        free_pcsl_string_list(handler->accesses, handler->access_num);
    }
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:33,代码来源:regstore.c


示例6: OsFile_rename

bool OsFile_rename(const JvmPathChar *from, const JvmPathChar *to) {
  const int from_name_len = fn_strlen(from);
  const int to_name_len = fn_strlen(to);
  pcsl_string pcsl_filename_from = PCSL_STRING_NULL;
  pcsl_string pcsl_filename_to = PCSL_STRING_NULL;

  GUARANTEE(sizeof(jchar) == sizeof(JvmPathChar), "Types must match");

  if (pcsl_string_convert_from_utf16(from, 
                                     from_name_len, 
                                     &pcsl_filename_from) != PCSL_STRING_OK) {
    return -1;
  }

  if (pcsl_string_convert_from_utf16(to, 
                                     to_name_len, 
                                     &pcsl_filename_to) != PCSL_STRING_OK) {
    return -1;
  }

  int result = pcsl_file_rename(&pcsl_filename_from, &pcsl_filename_to);

  pcsl_string_free(&pcsl_filename_from);
  pcsl_string_free(&pcsl_filename_to);

  return (result == 0) ? true : false;
}
开发者ID:jiangxilong,项目名称:yari,代码行数:27,代码来源:OsFile.cpp


示例7: Java_javax_microedition_lcdui_ImageItemLFImpl_createNativeResource0

/**
 * KNI function that creates new native resource for the current ImageItem.
 *
 * Class: javax.microedition.lcdui.ImageItemLFImpl
 * Java prototype:
 * private native int createNativeResource0(int ownerId, String label,
 *                                          int layout,
 *                                          Image img, String altText,
 *                                          int appearanceMode)
 *
 * INTERFACE (operand stack manipulation):
 *   parameters:  ownerId            pointer to the owner's native resource
 *                label              ImageItem's label
 *                layout             ImageItem's layout
 *                img                ImageItem's image
 *                altText            ImageItem's attText
 *                appearanceMode     the appearanceMode of ImageItem
 *   return pointer to the created native resource
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_lcdui_ImageItemLFImpl_createNativeResource0() {
  MidpError err = KNI_OK;
  MidpDisplayable  *ownerPtr;
  MidpItem *itemPtr = NULL;
  pcsl_string label, altText;
  pcsl_string_status rc1,rc2;
  unsigned char* imgPtr = NULL;
  int appearanceMode, layout;

  KNI_StartHandles(3);
  
  KNI_DeclareHandle(labelJString);
  KNI_DeclareHandle(image);
  KNI_DeclareHandle(altTextJString);

  ownerPtr = (MidpDisplayable *)KNI_GetParameterAsInt(1);
  KNI_GetParameterAsObject(2, labelJString);
  layout = KNI_GetParameterAsInt(3);
  KNI_GetParameterAsObject(4, image);
  KNI_GetParameterAsObject(5, altTextJString);

  if (KNI_IsNullHandle(image) != KNI_TRUE) {
    imgPtr = gxp_get_imagedata(image);
  }

  appearanceMode = KNI_GetParameterAsInt(6);

  rc1 = midp_jstring_to_pcsl_string(labelJString, &label);
  rc2 = midp_jstring_to_pcsl_string(altTextJString, &altText);

  KNI_EndHandles();

  /* NULL and empty strings are acceptable. */
  if (PCSL_STRING_OK != rc1 || PCSL_STRING_OK != rc2 ) {
    err = KNI_ENOMEM;
    goto cleanup;
  }

  itemPtr = MidpNewItem(ownerPtr, MIDP_PLAIN_IMAGE_ITEM_TYPE+appearanceMode);
  if (itemPtr == NULL) {
    err = KNI_ENOMEM;
    goto cleanup;
  }

  err = lfpport_imageitem_create(itemPtr, ownerPtr, &label, layout,
				 imgPtr, &altText, appearanceMode);

cleanup:
  pcsl_string_free(&altText);
  pcsl_string_free(&label);

  if (err != KNI_OK) {
    MidpDeleteItem(itemPtr);
    KNI_ThrowNew(midpOutOfMemoryError, NULL);
  }

  KNI_ReturnInt(itemPtr);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:78,代码来源:lfp_imageitem.c


示例8: storageFinalize

/*
 * Finalize the storage subsystem.
 */
void
storageFinalize() {
    int i;
    for (i = 0; i < MAX_STORAGE_NUM; i++) {
        pcsl_string_free(&sRoot[i]);
        pcsl_string_free(&configRoot[i]);
    }
    storageInitDone = 0;
    pcsl_file_finalize();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:13,代码来源:midpStorage.c


示例9: midp_suite_read_secure_resource

/**
 * Reads named secure resource of the suite with specified suiteId
 * from secure persistent storage.
 *
 * Note that when porting memory for the in/out parameter
 * returnValue MUST be allocated using pcsl_mem_malloc().
 * The caller is responsible for freeing it.
 *
 * @param suiteId           The suite id used to identify the MIDlet suite
 * @param resourceName      The name of secure resource to read from storage
 * @param returnValue       The in/out parameter that will return the
 *                          value part of the requested secure resource
 *                          (NULL is a valid return value)
 * @param valueSize         The length of the secure resource value
 *
 * @return one of the error codes:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
 */
MIDPError
midp_suite_read_secure_resource(SuiteIdType suiteId,
                                const pcsl_string* resourceName,
                                jbyte **returnValue,
                                jint *valueSize) {
    pcsl_string filename = PCSL_STRING_NULL;
    char *pszError = NULL;
    MIDPError errorCode;
    int bytesRead;
    int handle;

    *returnValue = NULL;
    *valueSize = 0;

    errorCode = get_secure_resource_file(suiteId, resourceName, &filename);
    if (errorCode != ALL_OK) {
        pcsl_string_free(&filename);
        return errorCode;
    }

    handle = storage_open(&pszError, &filename, OPEN_READ);
    pcsl_string_free(&filename);
    if (pszError != NULL) {
        storageFreeError(pszError);
        return SUITE_CORRUPTED_ERROR;
    }

    do {
        bytesRead = storageRead(&pszError, handle,
            (char*)valueSize, sizeof (int));
        if (bytesRead != sizeof (int) || *valueSize == 0)
            break;

        *returnValue = (jbyte*)pcsl_mem_malloc(*valueSize * sizeof (jbyte));
        if (*returnValue == NULL) {
            errorCode = OUT_OF_MEMORY;
            break;
        }

        bytesRead = storageRead(&pszError, handle, (char*)(*returnValue),
            *valueSize * sizeof (jbyte));

        if (pszError != NULL || bytesRead != *valueSize) {
            errorCode = SUITE_CORRUPTED_ERROR;
            pcsl_mem_free(*returnValue);
            *returnValue = NULL;
            break;
        }
    } while (0);

    storageClose(&pszError, handle);
    storageFreeError(pszError);

    return errorCode;
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:76,代码来源:suitestore_secure.c


示例10: check_for_corrupted_suite

/**
 * Check if the suite is corrupted
 * @param suiteId ID of a suite
 *
 * @return ALL_OK if the suite is not corrupted,
 *         SUITE_CORRUPTED_ERROR is suite is corrupted,
 *         OUT_OF_MEMORY if out of memory,
 *         IO_ERROR if I/O error
 */
MIDPError
check_for_corrupted_suite(SuiteIdType suiteId) {
    pcsl_string filename[NUM_SUITE_FILES];
    int arc[NUM_SUITE_FILES];
    int i;
    StorageIdType storageId;
    MIDPError status = ALL_OK; /* Default to no error */
    MidletSuiteData *pData = get_suite_data(suiteId);

    if (!pData) {
        return SUITE_CORRUPTED_ERROR;
    }

    /* if this suite was already checked, just return "OK" status */
    if (pData->isChecked) {
        return status;
    }

    /* get an id of the storage where the suite is located */
    status = midp_suite_get_suite_storage(suiteId, &storageId);
    if (status != ALL_OK) {
        return status;
    }

    arc[0] = get_suite_filename(suiteId, &INSTALL_INFO_FILENAME, &filename[0]);
    arc[1] = get_suite_filename(suiteId, &SETTINGS_FILENAME, &filename[1]);
    arc[2] = midp_suite_get_class_path(suiteId, storageId,
                                       KNI_FALSE, &filename[2]);
    arc[3] = get_property_file(suiteId, KNI_FALSE, &filename[3]);

    for (i = 0; i < NUM_SUITE_FILES; i++) {
        if (arc[i] != ALL_OK) {
            status = (MIDPError)arc[i];
            break;
        }

        if (!storage_file_exists(&filename[i])) {
            /* File does not exist; suite must be corrupted */
            status = SUITE_CORRUPTED_ERROR;
            break;
        }
    }

    if (status == ALL_OK) {
        /* if the suite is not currupted, mark it as "checked" */
        pData->isChecked = 1;
    }

    pcsl_string_free(&filename[0]);
    pcsl_string_free(&filename[1]);
    pcsl_string_free(&filename[2]);
    pcsl_string_free(&filename[3]);

    return status;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:64,代码来源:suitestore_intern.c


示例11: buildSuiteFilename

static MIDPError buildSuiteFilename(pcsl_string* filenameBase, 
                                    const pcsl_string* name, jint extension, 
                                    pcsl_string* pFileName) {

    pcsl_string returnPath = PCSL_STRING_NULL;
    pcsl_string rmsFileName = PCSL_STRING_NULL;

    jsize filenameBaseLen = pcsl_string_length(filenameBase);
    jsize nameLen = pcsl_string_length(name);

    *pFileName = PCSL_STRING_NULL;

    if (nameLen > 0) {
        const pcsl_string* ext;
        jsize extLen;
        int fileNameLen;

        if (MIDP_RMS_IDX_EXT == extension) {
            ext = &IDX_EXTENSION;
            extLen = pcsl_string_length(&IDX_EXTENSION);
        } else if (MIDP_RMS_DB_EXT == extension) {
            ext = &DB_EXTENSION;
            extLen = pcsl_string_length(&DB_EXTENSION);
        } else {
            return BAD_PARAMS;
        }

        /* performance hint: predict buffer capacity */
        fileNameLen = PCSL_STRING_ESCAPED_BUFFER_SIZE(nameLen + extLen);
        pcsl_string_predict_size(&rmsFileName, fileNameLen);

        if (pcsl_esc_attach_string(name, &rmsFileName) !=
                PCSL_STRING_OK ||
                    pcsl_string_append(&rmsFileName, ext) != PCSL_STRING_OK) {
            pcsl_string_free(&rmsFileName);
            return OUT_OF_MEMORY;
        }
    }

    /* performance hint: predict buffer capacity */
    pcsl_string_predict_size(&returnPath, filenameBaseLen + 
                             pcsl_string_length(&rmsFileName));

    if (PCSL_STRING_OK != pcsl_string_append(&returnPath, filenameBase) ||
            PCSL_STRING_OK != pcsl_string_append(&returnPath, &rmsFileName)) {
        pcsl_string_free(&rmsFileName);
        pcsl_string_free(&returnPath);
        return OUT_OF_MEMORY;
    }

    pcsl_string_free(&rmsFileName);
   *pFileName = returnPath;

    return ALL_OK;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:55,代码来源:rms.c


示例12: write_file

/**
 * Writes the contents of the given buffer into the given file.
 *
 * Note that if the length of the input buffer is zero or less,
 * the file will be truncated.
 *
 * @param ppszError pointer to character string pointer to accept an error
 * @param pFileName file to write
 * @param inBuffer buffer with data that will be stored
 * @param inBufferLen length of the inBuffer
 *
 * @return status code (ALL_OK if there was no errors)
 */
MIDPError
write_file(char** ppszError, const pcsl_string* pFileName,
           char* inBuffer, long inBufferLen) {
    int handle, status = ALL_OK;
    char* pszTemp;
    pcsl_string tmpFileName;
    pcsl_string_status rc;

    *ppszError = NULL;

    /* get the name of the temporary file */
    rc = pcsl_string_cat(pFileName, &TMP_FILE_EXTENSION, &tmpFileName);
    if (rc != PCSL_STRING_OK) {
        return OUT_OF_MEMORY;
    }

    /* open the file */
    handle = storage_open(ppszError, &tmpFileName, OPEN_READ_WRITE_TRUNCATE);
    if (*ppszError != NULL) {
        pcsl_string_free(&tmpFileName);
        return IO_ERROR;
    }

    /* write the whole buffer */
    if (inBufferLen > 0) {
        storageWrite(ppszError, handle, inBuffer, inBufferLen);
    }

    if (*ppszError != NULL) {
        status = IO_ERROR;
    }

    /* close the file */
    storageClose(&pszTemp, handle);
    storageFreeError(pszTemp);

    if (status == ALL_OK) {
        /* rename the temporary file */
        storage_rename_file(ppszError, &tmpFileName, pFileName);
        if (*ppszError != NULL) {
            status = IO_ERROR;
            storage_delete_file(&pszTemp, &tmpFileName);
            storageFreeError(pszTemp);
        }
    } else {
        storage_delete_file(&pszTemp, &tmpFileName);
        storageFreeError(pszTemp);
    }

    pcsl_string_free(&tmpFileName);

    return (MIDPError)status;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:66,代码来源:suitestore_intern.c


示例13: get_class_path_impl

/**
 * Gets the classpath for the specified MIDlet suite id.
 *
 * Note that memory for the in/out parameter classPath is
 * allocated by the callee. The caller is responsible for
 * freeing it using pcsl_mem_free().
 *
 * @param suiteId   The suite id used to identify the MIDlet suite
 * @param storageId storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param classPath The in/out parameter that contains returned class path
 * @param extension Extension of the file (
 *
 * @return one of the error codes:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY
 * </pre>
 */
static MIDPError
get_class_path_impl(ComponentType type,
                    SuiteIdType suiteId,
                    ComponentIdType componentId,
                    jint storageId,
                    pcsl_string * pClassPath,
                    const pcsl_string * pExtension) {
    const pcsl_string* root = storage_get_root(storageId);
    pcsl_string path = PCSL_STRING_NULL;
    jint suiteIdLen = GET_SUITE_ID_LEN(suiteId);
    jint componentIdLen = 0;

#if ENABLE_DYNAMIC_COMPONENTS
    if (type == COMPONENT_DYNAMIC) {
        componentIdLen = GET_COMPONENT_ID_LEN(componentId);
    }
#else
    (void)type;
    (void)componentId;
#endif

    *pClassPath = PCSL_STRING_NULL;

    /* performance hint: predict buffer capacity */
    pcsl_string_predict_size(&path, pcsl_string_length(root)
                                    + suiteIdLen + componentIdLen +
                                    + pcsl_string_length(pExtension));
    if (PCSL_STRING_OK != pcsl_string_append(&path, root) ||
            PCSL_STRING_OK != pcsl_string_append(&path,
                midp_suiteid2pcsl_string(suiteId))) {
        pcsl_string_free(&path);
        return OUT_OF_MEMORY;
    }

#if ENABLE_DYNAMIC_COMPONENTS
    if (type == COMPONENT_DYNAMIC) {
        if (PCSL_STRING_OK != pcsl_string_append(&path,
                midp_componentid2pcsl_string(componentId))) {
            pcsl_string_free(&path);
            return OUT_OF_MEMORY;
        }
    }
#endif

    if (PCSL_STRING_OK != pcsl_string_append(&path, pExtension)) {
        pcsl_string_free(&path);
        return OUT_OF_MEMORY;
    }

    *pClassPath = path;

    return ALL_OK;
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:70,代码来源:suitestore_common.c


示例14: midpIterateJarEntries

int 
midpIterateJarEntries(void *handle, filterFuncT *filter, actionFuncT *action) {

    MidpJarInfo *pJarInfo = (MidpJarInfo*)handle;
    JarEntryInfo entryInfo;
    pcsl_string entryName;
    unsigned char *nameBuf;
    int status = 1;
    pcsl_string_status res;

    entryInfo = getFirstJarEntryInfo(&pJarInfo->fileObj, &pJarInfo->jarInfo);

    while (entryInfo.status == 0) {
        
        nameBuf =  (unsigned char*) midpMalloc(entryInfo.nameLen);
        if (nameBuf == NULL) {
            status = MIDP_JAR_OUT_OF_MEM_ERROR;
            break;
        }
        
        entryInfo.status = getJarEntryName(&pJarInfo->fileObj, &entryInfo, nameBuf);
        if (entryInfo.status != 0) {
            status = MIDP_JAR_CORRUPT_ERROR;
            midpFree(nameBuf);
            break;
        }

        res = pcsl_string_convert_from_utf8((jbyte*)nameBuf, entryInfo.nameLen,
                                            &entryName);
        midpFree(nameBuf);
        if (PCSL_STRING_OK != res) {
            status = MIDP_JAR_OUT_OF_MEM_ERROR;
            break;
        }
       
        if ((*filter)(&entryName)) {
            /* name match: call action */   
            if (!(*action)(&entryName)) {
                status = 0;
                pcsl_string_free(&entryName);
                break;
            }
        }
        
        pcsl_string_free(&entryName);
        
        entryInfo = getNextJarEntryInfo(&pJarInfo->fileObj, &pJarInfo->jarInfo, 
                                        &entryInfo);
        
    }
       
    return status;
}
开发者ID:jiangxilong,项目名称:yari,代码行数:53,代码来源:midpJar.c


示例15: midp_suite_get_cached_resource_filename

/**
 * Gets location of the cached resource with specified name
 * for the suite with the specified suiteId.
 *
 * Note that when porting memory for the in/out parameter
 * filename MUST be allocated  using pcsl_mem_malloc().
 * The caller is responsible for freeing the memory associated
 * with filename parameter.
 *
 * @param suiteId       The application suite ID
 * @param storageId     storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param pResourceName Name of the cached resource
 * @param pFileName     The in/out parameter that contains returned filename
 * @return error code that should be one of the following:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
 */
MIDPError
midp_suite_get_cached_resource_filename(SuiteIdType suiteId,
                                        StorageIdType storageId,
                                        const pcsl_string * pResourceName,
                                        pcsl_string * pFileName) {
    const pcsl_string* root = storage_get_root(storageId);
    pcsl_string returnPath = PCSL_STRING_NULL;
    pcsl_string resourceFileName = PCSL_STRING_NULL;
    jint suiteIdLen = GET_SUITE_ID_LEN(suiteId);
    jsize resourceNameLen = pcsl_string_length(pResourceName);

    *pFileName = PCSL_STRING_NULL;

    if (resourceNameLen > 0) {
        /* performance hint: predict buffer capacity */
        int fileNameLen = PCSL_STRING_ESCAPED_BUFFER_SIZE(
            resourceNameLen + pcsl_string_length(&TMP_EXT));
        pcsl_string_predict_size(&resourceFileName, fileNameLen);

        if ( /* Convert any slashes */
            pcsl_esc_attach_string(pResourceName,
                &resourceFileName) != PCSL_STRING_OK ||
            /* Add the extension */
            pcsl_string_append(&resourceFileName, &TMP_EXT) !=
                PCSL_STRING_OK) {
            pcsl_string_free(&resourceFileName);
            return OUT_OF_MEMORY;
        }
    }

    /* performance hint: predict buffer capacity */
    pcsl_string_predict_size(&returnPath, pcsl_string_length(root) +
        suiteIdLen + pcsl_string_length(&resourceFileName));

    if (PCSL_STRING_OK != pcsl_string_append(&returnPath, root) ||
            PCSL_STRING_OK != pcsl_string_append(&returnPath,
                midp_suiteid2pcsl_string(suiteId)) ||
            PCSL_STRING_OK != pcsl_string_append(&returnPath,
                &resourceFileName)) {
        pcsl_string_free(&resourceFileName);
        pcsl_string_free(&returnPath);
        return OUT_OF_MEMORY;
    }

    pcsl_string_free(&resourceFileName);

    *pFileName = returnPath;

    return ALL_OK;
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:69,代码来源:suitestore_common.c


示例16: delete_components_files

/**
 * Removes the files belonging to the specified component, or to all
 * components owned by the given suite.
 *
 * @param suiteId ID of the suite whose components are being removed
 * @param componentId ID of the component to remove or UNUSED_COMPONENT_ID
 *                    if all components of the suite are being removed 
 *
 * @return status code, ALL_OK if no errors
 */
static MIDPError
delete_components_files(SuiteIdType suiteId, ComponentIdType componentId) {
    pcsl_string componentFileName;
    char* pszError;
    int suiteFound = 0;
    MIDPError status = ALL_OK;
    MidletSuiteData* pData = g_pSuitesData;

    /* handle the list entries having the given suiteId */
    while (pData != NULL) {
        if (pData->suiteId == suiteId) {
            suiteFound = 1;
            
            if (pData->type == COMPONENT_DYNAMIC &&
                    (componentId == UNUSED_COMPONENT_ID ||
                        pData->componentId == componentId)) {
                /* remove the file holding the component */
                status = get_jar_path(COMPONENT_DYNAMIC,
                    (jint)pData->componentId, &componentFileName);
                if (status != ALL_OK) {
                    break;
                }

                storage_delete_file(&pszError, &componentFileName);

                if (pszError != NULL) {
                    storageFreeError(pszError);
                    /* it's an error only if the file exists */
                    if (storage_file_exists(&componentFileName)) {
                        status = IO_ERROR;
                        pcsl_string_free(&componentFileName);
                        break;
                    }
                }

                pcsl_string_free(&componentFileName);
            }
        }

        pData = pData->nextEntry;
    }

    if (status == ALL_OK && suiteFound == 0) {
        /* suite doesn't exist */
        status = NOT_FOUND;
    }

    return status;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:59,代码来源:components_storage_kni.c


示例17: get_suite_storage_root

/**
 * Gets the storage root for a MIDlet suite by ID.
 * Free the data of the string returned with pcsl_string_free().
 *
 * @param suiteId suite ID
 * @param sRoot receives storage root (gets set to NULL in the case of an error)
 *
 * @return status: ALL_OK if success,
 * OUT_OF_MEMORY if out-of-memory
 */
MIDPError
get_suite_storage_root(SuiteIdType suiteId, pcsl_string* sRoot) {
    StorageIdType storageId;
    const pcsl_string* root;
    MIDPError status;

    *sRoot = PCSL_STRING_EMPTY;

    /* get an id of the storage where the suite is located */
    status = midp_suite_get_suite_storage(suiteId, &storageId);
    if (status != ALL_OK) {
        return status;
    }

    root = storage_get_root(storageId);

    pcsl_string_predict_size(sRoot,
        pcsl_string_length(root) + GET_SUITE_ID_LEN(suiteId));

    if (PCSL_STRING_OK == pcsl_string_append(sRoot, root) &&
            PCSL_STRING_OK == pcsl_string_append(sRoot,
                midp_suiteid2pcsl_string(suiteId))) {
        return ALL_OK;
    }

    pcsl_string_free(sRoot);
    *sRoot = PCSL_STRING_NULL;

    return OUT_OF_MEMORY;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:40,代码来源:suitestore_intern.c


示例18: repair_suite_db

/**
 * Tries to repair the suite database.
 *
 * @return ALL_OK if succeeded, other value if failed
 */
MIDPError repair_suite_db() {
    /* IMPL_NOTE: should be replaced with more sophisticated routine. */
    MIDPError status = ALL_OK;
    pcsl_string_status rc;
    pcsl_string suitesDataFile;
    char* pszTemp = NULL;

    /* get a full path to the _suites.dat */
    rc = pcsl_string_cat(storage_get_root(INTERNAL_STORAGE_ID),
                         &SUITE_DATA_FILENAME, &suitesDataFile);
    if (rc != PCSL_STRING_OK) {
        return OUT_OF_MEMORY;
    }

    storage_delete_file(&pszTemp, &suitesDataFile);
    pcsl_string_free(&suitesDataFile);
    if (pszTemp != NULL) {
        storageFreeError(pszTemp);
        status = IO_ERROR;
    }

    if (g_isSuitesDataLoaded) {
        free_suites_data();
        g_isSuitesDataLoaded = 0;
    }

    return status;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:33,代码来源:suitestore_intern.c


示例19: finish_transaction

/**
 * Finishes the previously started transaction.
 *
 * @return ALL_OK if the transaction was successfully finished,
 *         NOT_FOUND if the transaction has not been started,
 *         IO_ERROR if I/O error
 */
MIDPError finish_transaction() {
    pcsl_string_status rc;
    pcsl_string transDataFile;
    char* pszTemp = NULL;
    MIDPError status = ALL_OK;

    if (!g_transactionStarted) {
        return NOT_FOUND;
    }

    /* transaction is finished, removed the transaction file */

    /* get a full path to the transaction data file */
    rc = pcsl_string_cat(storage_get_root(INTERNAL_STORAGE_ID),
                         &TRANSACTION_DATA_FILENAME, &transDataFile);
    if (rc != PCSL_STRING_OK) {
        return OUT_OF_MEMORY;
    }

    storage_delete_file(&pszTemp, &transDataFile);
    pcsl_string_free(&transDataFile);
    if (pszTemp != NULL) {
        storageFreeError(pszTemp);
        status = IO_ERROR;
    }

    g_transactionStarted = 0;

    return status;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:37,代码来源:suitestore_intern.c


示例20: Java_com_sun_midp_content_RegistryStore_unregister0

/**
 * java call:
 *  private native boolean unregister(String handlerId);
 */
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_sun_midp_content_RegistryStore_unregister0(void) {
    int ret = KNI_FALSE;
    pcsl_string id = PCSL_STRING_NULL_INITIALIZER;

    KNI_StartHandles(1);
    KNI_DeclareHandle(idStr);   // content handler ID
    KNI_GetParameterAsObject(1, idStr);

    do {
        if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(idStr, &id)) {
            KNI_ThrowNew(midpOutOfMemoryError, 
                            "RegistryStore_unregister0 no memory for ID");
            break;
        }
        
        if (JSR211_OK != jsr211_unregister_handler(&id)) {
            break;
        }
        
        ret = KNI_TRUE;
    } while (0);

    pcsl_string_free(&id);
    KNI_EndHandles();

    KNI_ReturnBoolean(ret);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:32,代码来源:regstore.c



注:本文中的pcsl_string_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pcu_check_true函数代码示例发布时间:2022-05-30
下一篇:
C++ pcsl_mem_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap