CVS update: php3/functions

From: Date: Thu, 25 Mar 1999 06:27:48 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4756@lists.php.net to get a copy of this message
Date: Thursday March 25, 1999 @ 1:27 Author: steinm Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv10870/functions Modified Files: hw.c pdf.c Log Message: - bugfix in Hyperwave module, code clean ups Index: php3/functions/hw.c diff -c php3/functions/hw.c:1.24 php3/functions/hw.c:1.25 *** php3/functions/hw.c:1.24 Thu Mar 11 12:25:23 1999 --- php3/functions/hw.c Thu Mar 25 01:27:48 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.24 1999/03/11 17:25:23 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.25 1999/03/25 06:27:48 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif *************** *** 1409,1414 **** --- 1409,1415 ---- int collIDcount, docIDcount, i, *docIDs, *collIDs; TLS_VARS; + fprintf(stderr, "Copy/Move %d\n", mvcp); switch(mvcp) { case MOVE: /* Move also has fromID */ if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) *************** *** 1480,1486 **** } } efree(objvIDs); - if (0 != (ptr->lasterror = send_mvcpdocscoll(ptr->socket, docIDs, docIDcount, from, dest, mvcp))) { efree(collIDs); efree(docIDs); --- 1481,1486 ---- *************** *** 1739,1753 **** if (0 != (ptr->lasterror = send_getremotechildren(ptr->socket, objrec, &remainder, &offsets, &count))) RETURN_FALSE; if(strncmp(remainder, "ObjectID=0 ", 10)) { hw_document *doc; ! remainder[offsets[0]-18] = '\0'; ! /*php3_printf("offset = %d, remainder = %s---", offsets[0], remainder);*/ doc = malloc(sizeof(hw_document)); ! doc->data = strdup(remainder); doc->attributes = strdup(objrec); doc->bodytag = NULL; ! doc->size = offsets[0]-18; return_value->value.lval = php3_list_insert(doc,php3_hw_module.le_document); return_value->type = IS_LONG; } else { --- 1739,1797 ---- if (0 != (ptr->lasterror = send_getremotechildren(ptr->socket, objrec, &remainder, &offsets, &count))) RETURN_FALSE; + /* + for(i=0;i<count;i++) + php3_printf("offset[%d] = %d--\n", i, offsets[i]); + php3_printf("count = %d, remainder = <HR>%s---<HR>", count, remainder); + */ + /* The remainder depends on the number of returned objects and + whether the MimeType of the object to retrieve is set. If + the MimeType is set the result will start with the + HTTP header 'Content-type: mimetype', otherwise it will be + a list of object records and therefore starts with + 'ObjectID=0'. In the first case the offset and count are somewhat + strange. Quite often count had a value of 6 which appears to be + meaningless, but if you sum up the offsets you get the length + of the remainder which is the lenght of the document. + The document must have been chopped up into 6 pieces, each ending + with 'ServerId=0xYYYYYYYY'. + In the second case the offset contains the lenght of + each object record; count contains the number of object records. + Even if a remote object has children + (several sql statements) but the MimeType is set, it will + return a document in the format of MimeType. On the other + hand a remote object does not have any children but just + returns a docuement will not be shown unless the MimeType + is set. It returns the pure object record of the object without + the SQLStatement attribute. Quite senseless. + */ if(strncmp(remainder, "ObjectID=0 ", 10)) { hw_document *doc; ! char *ptr; ! int i, j, len; ! /* For some reason there is always the string ! 'SeverId=0xYYYYYYYY' at the end, so we cut it off. ! The document may as well be divided into several pieces ! and each of them has the ServerId at the end. ! The following will put the pieces back together and ! strip the ServerId. count contains the number of pieces. ! */ ! for(i=0, len=0; i<count; i++) ! len += offsets[i]-18; ! /*fprintf(stderr,"len = %d\n", len); */ doc = malloc(sizeof(hw_document)); ! doc->data = malloc(len+1); ! ptr = doc->data; ! for(i=0, j=0; i<count; i++) { ! memcpy((char *)ptr, (char *)&remainder[j], offsets[i]-18); ! /*fprintf(stderr,"rem = %s\n", &remainder[j]); */ ! j += offsets[i]; ! ptr += offsets[i] - 18; ! } ! *ptr = '\0'; doc->attributes = strdup(objrec); doc->bodytag = NULL; ! doc->size = strlen(doc->data); return_value->value.lval = php3_list_insert(doc,php3_hw_module.le_document); return_value->type = IS_LONG; } else { Index: php3/functions/pdf.c diff -c php3/functions/pdf.c:1.25 php3/functions/pdf.c:1.26 *** php3/functions/pdf.c:1.25 Sun Feb 28 18:03:51 1999 --- php3/functions/pdf.c Thu Mar 25 01:27:48 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: pdf.c,v 1.25 1999/02/28 23:03:51 steffann Exp $ */ /* pdflib 0.6 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: pdf.c,v 1.26 1999/03/25 06:27:48 steinm Exp $ */ /* pdflib 0.6 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ *************** *** 192,202 **** /* {{{ proto int pdf_get_info(void) Returns a default info structure for a pdf document */ void php3_pdf_get_info(INTERNAL_FUNCTION_PARAMETERS) { ! PDF_info *pdf_info; int id; PDF_TLS_VARS; pdf_info = PDF_get_info(); if(!pdf_info) { php3_error(E_WARNING, "Could not get PDF info"); --- 192,210 ---- /* {{{ proto int pdf_get_info(void) Returns a default info structure for a pdf document */ void php3_pdf_get_info(INTERNAL_FUNCTION_PARAMETERS) { ! PDF_info *pdf_info=NULL; int id; PDF_TLS_VARS; pdf_info = PDF_get_info(); + + /* PDF_get_info() will never fail and return NULL thought + it does a malloc. Anyway, once proper error checking is + introduced in PDF_get_info() this will be needed. + The author of pdflib is informed. + */ + if(pdf_info == NULL) + RETURN_FALSE; if(!pdf_info) { php3_error(E_WARNING, "Could not get PDF info"); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4756) next »