/*
 * IsoVolSet.c
 *
 * Copyright (c) 2007  Vreixo Formoso
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * See COPYING file for details.
 */

#include "org_pykix_libburnia_libisofs_IsoVolSet.h"

#include "libisofs.h"

/*
 * Class:     org_pykix_libburnia_libisofs_IsoVolSet
 * Method:    iso_volset_free
 * Signature: (J)V
 */
JNIEXPORT void JNICALL 
Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1free
(
	JNIEnv *env, jclass cls, jlong volume
)
{
	iso_volset_free( (struct iso_volset *) volume);
}

/*
 * Class:     org_pykix_libburnia_libisofs_IsoVolSet
 * Method:    iso_volset_new
 * Signature: (JLjava/lang/String;)J
 */
JNIEXPORT jlong JNICALL 
Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1new
(
	JNIEnv *env, jclass cls, jlong volume, jstring volsetId
)
{
	const char *volset_id;
	struct iso_volset *volset;
	
	volset_id = (*env)->GetStringUTFChars(env, volsetId, NULL);
	if ( volset_id == NULL ) {
		return (jlong) 0; /* OutOfMemoryError already thrown */
	}

	volset = iso_volset_new( (struct iso_volume *) volume, volset_id);

	(*env)->ReleaseStringUTFChars(env, volsetId, volset_id);

	return (jlong) volset;
}
