}
public byte[] get(String type) {
- SWIGTYPE_p_int length = null;
- return yaz4jlib.ZOOM_record_get_bytes(record, type, length);
+ return yaz4jlib.ZOOM_record_get_bytes(record, type);
}
public String render() {
#include "zoom-extra.h"
#include <string.h>
-struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type, int *len)
+struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type)
{
struct CharStarByteArray node;
- const char* pageData = ZOOM_record_get(rec, type, len);
- node.length = strlen(pageData);
- node.data = (char*) malloc(node.length+1);
- strcpy(node.data, pageData);
+ node.data = ZOOM_record_get(rec, type, &node.length);
return node;
}
#include <yaz/zoom.h>
struct CharStarByteArray
{
- char* data;
- long length;
+ const char* data;
+ int length;
};
-struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type, int *len);
+struct CharStarByteArray ZOOM_record_get_bytes(ZOOM_record rec, const char *type);
#endif
%typemap(jstype) CharStarByteArray "byte[]"
%typemap(out) CharStarByteArray {
$result = SWIG_JavaArrayOutSchar(jenv, (signed char*) $1.data, $1.length);
- free((void*)$1.data);
}
%typemap(javaout) CharStarByteArray { return $jnicall; }
%define YAZ_BEGIN_CDECL %enddef