Ejemplo n.º 1
0
/**
 * Flush the cache and stop current file caching.
 * Seek cached position for the case the file won't be closed after
 * flushing (it's possible if a few files are openned simultaneously).
 */
static void midp_file_cache_finalize(char **ppszError, int stayOpen) {
    *ppszError = NULL;

    if (mFileCache != NULL) {
        midp_file_cache_flush(ppszError, mFileCache->handle);
        /* Do no seek for the file that is either damaged or to be closed */
        if (*ppszError == NULL && stayOpen) {
            storagePosition(ppszError, mFileCache->handle,
                            mFileCache->cachedPosition);
        }
        /* If read is cached, free all read blocks here */
        midpFree(mFileCache);
        mFileCache = NULL;
    }
}
Ejemplo n.º 2
0
/**
 * Commit pending writes
 *
 * If not successful *ppszError will set to point to an error string,
 * on success it will be set to NULL.
 *
 * @param ppszError where to put an I/O error
 * @param handle handle to record store storage
 */
void
recordStoreCommitWrite(char** ppszError, int handle) {
    midp_file_cache_flush(ppszError, handle);
}