cvs: php4 /ext/yaz php_yaz.c
| From: | Adam Dickmeiss | Date: | Tue, 13 May 2003 10:31:45 +0000 |
| Subject: | cvs: php4 /ext/yaz php_yaz.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20856@lists.php.net to get a copy of this message | ||
dickmeiss Tue May 13 06:31:45 2003 EDT
Modified files:
/php4/ext/yaz php_yaz.c
Log:
Fix problem with yaz_record in array mode, when record is unavailable.
Index: php4/ext/yaz/php_yaz.c
diff -u php4/ext/yaz/php_yaz.c:1.69 php4/ext/yaz/php_yaz.c:1.70
--- php4/ext/yaz/php_yaz.c:1.69 Mon Apr 28 16:47:26 2003
+++ php4/ext/yaz/php_yaz.c Tue May 13 06:31:45 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_yaz.c,v 1.69 2003/04/28 20:47:26 sniper Exp $ */
+/* $Id: php_yaz.c,v 1.70 2003/05/13 10:31:45 dickmeiss Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -939,16 +939,17 @@
if (r) {
if (!strcmp(type, "array")) {
Z_External *ext = (Z_External *) ZOOM_record_get(r, "ext", 0);
- oident *ent = oid_getentbyoid(ext->direct_reference);
-
- if (ext->which == Z_External_grs1 && ent->value == VAL_GRS1) {
- retval_grs1(return_value, ext->u.grs1);
- } else if (ext->which == Z_External_octet) {
- char *buf = (char *) (ext->u.octet_aligned->buf);
- ODR odr = odr_createmem(ODR_DECODE);
- Z_GenericRecord *rec = 0;
-
- switch (ent->value) {
+ if (ext) {
+ oident *ent = oid_getentbyoid(ext->direct_reference);
+
+ if (ext->which == Z_External_grs1 && ent->value == VAL_GRS1) {
+ retval_grs1(return_value, ext->u.grs1);
+ } else if (ext->which == Z_External_octet) {
+ char *buf = (char *) (ext->u.octet_aligned->buf);
+ ODR odr = odr_createmem(ODR_DECODE);
+ Z_GenericRecord *rec = 0;
+
+ switch (ent->value) {
case VAL_SOIF:
case VAL_HTML:
break;
@@ -958,11 +959,12 @@
break;
default:
rec = marc_to_grs1(buf, odr);
+ }
+ if (rec) {
+ retval_grs1(return_value, rec);
+ }
+ odr_destroy(odr);
}
- if (rec) {
- retval_grs1(return_value, rec);
- }
- odr_destroy(odr);
}
} else {
int rlen;