CVS update: php3/functions

From: Date: Thu, 08 Apr 1999 15:08:13 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4985@lists.php.net to get a copy of this message
Date: Thursday April 8, 1999 @ 11:08 Author: steinm Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv15399/functions Modified Files: hg_comm.c hw.c hw.h Log Message: - some code cleanups - new function hw_document_setcontent() - fixed bug fix which cause segm fault in hw_edittext() Index: php3/functions/hg_comm.c diff -c php3/functions/hg_comm.c:1.15 php3/functions/hg_comm.c:1.16 *** php3/functions/hg_comm.c:1.15 Tue Mar 30 01:23:42 1999 --- php3/functions/hg_comm.c Thu Apr 8 11:08:13 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.15 1999/03/30 06:23:42 steinm Exp $ */ /* #define HW_DEBUG */ --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.16 1999/04/08 15:08:13 steinm Exp $ */ /* #define HW_DEBUG */ *************** *** 1861,1877 **** char *tmp, *path, *objid; hw_objectID objectID; ! objid = fnAttributeValue(objattr, "ObjectID="); if(objid == NULL) return(-1); if(!sscanf(objid, "0x%x", &objectID)) return(-1); ! path = fnAttributeValue(objattr, "Path="); if(path == NULL) return(-1); - length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(path) + 1 + 1 + strlen(text) + 1; build_msg_header(&msg, length, msgid++, EDITTEXT_MESSAGE); if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { --- 1861,1877 ---- char *tmp, *path, *objid; hw_objectID objectID; ! objid = fnAttributeValue(objattr, "ObjectID"); if(objid == NULL) return(-1); if(!sscanf(objid, "0x%x", &objectID)) return(-1); ! path = fnAttributeValue(objattr, "Path"); if(path == NULL) return(-1); + length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(path) + 1 + 1 + strlen(text) + 1; build_msg_header(&msg, length, msgid++, EDITTEXT_MESSAGE); if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { *************** *** 1901,1908 **** ptr = (int *) retmsg->buf; error = *ptr; - efree(retmsg); efree(retmsg->buf); return(error); } --- 1901,1908 ---- ptr = (int *) retmsg->buf; error = *ptr; efree(retmsg->buf); + efree(retmsg); return(error); } Index: php3/functions/hw.c diff -c php3/functions/hw.c:1.26 php3/functions/hw.c:1.27 *** php3/functions/hw.c:1.26 Tue Mar 30 01:23:43 1999 --- php3/functions/hw.c Thu Apr 8 11:08:13 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.26 1999/03/30 06:23:43 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.27 1999/04/08 15:08:13 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif *************** *** 106,111 **** --- 106,113 ---- {"hw_document_bodytag", php3_hw_document_bodytag, NULL}, {"hw_documentbodytag", php3_hw_document_bodytag, NULL}, {"hw_document_content", php3_hw_document_content, NULL}, + {"hw_documentcontent", php3_hw_document_content, NULL}, + {"hw_documentsetcontent", php3_hw_document_setcontent, NULL}, {"hw_objrec2array", php3_hw_objrec2array, NULL}, {"hw_array2objrec", php3_hw_array2objrec, NULL}, {"hw_incollections", php3_hw_incollections, NULL}, *************** *** 1570,1576 **** Modifies text document */ void php3_hw_edittext(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; ! int link, id, doc, type; hw_connection *ptr; hw_document *docptr; TLS_VARS; --- 1572,1578 ---- Modifies text document */ void php3_hw_edittext(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; ! int link, doc, type; hw_connection *ptr; hw_document *docptr; TLS_VARS; *************** *** 1583,1600 **** link=arg1->value.lval; ptr = php3_list_find(link,&type); - /* FIXME id is not set anywhere */ if(!ptr || (type!=php3_hw_module.le_socketp && type!=php3_hw_module.le_psocketp)) { ! php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } doc=arg2->value.lval; docptr = php3_list_find(doc,&type); - /* FIXME id is not set anywhere */ if(!docptr || (type!=php3_hw_module.le_document)) { ! php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } --- 1585,1600 ---- link=arg1->value.lval; ptr = php3_list_find(link,&type); if(!ptr || (type!=php3_hw_module.le_socketp && type!=php3_hw_module.le_psocketp)) { ! php3_error(E_WARNING,"Unable to find socket identifier %d",link); RETURN_FALSE; } doc=arg2->value.lval; docptr = php3_list_find(doc,&type); if(!docptr || (type!=php3_hw_module.le_document)) { ! php3_error(E_WARNING,"Unable to find document identifier %d", doc); RETURN_FALSE; } *************** *** 2182,2187 **** --- 2182,2224 ---- } /* }}} */ + /* {{{ proto int hw_document_setcontent(hwdoc doc, string content) + Sets/replaces content of document */ + void php3_hw_document_setcontent(INTERNAL_FUNCTION_PARAMETERS) { + pval *argv[2]; + int id, type, argc; + hw_document *ptr; + char *str; + TLS_VARS; + + argc = ARG_COUNT(ht); + if(argc != 2) + WRONG_PARAM_COUNT; + + if (getParametersArray(ht, argc, argv) == FAILURE) + RETURN_FALSE; + + convert_to_long(argv[0]); + convert_to_string(argv[1]); + id=argv[0]->value.lval; + ptr = php3_list_find(id,&type); + if(!ptr || (type!=php3_hw_module.le_document)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + str = ptr->data; + if(NULL != (ptr->data = strdup(argv[1]->value.str.val))) { + ptr->size = strlen(ptr->data); + free(str); + RETURN_TRUE; + } else { + ptr->data = str; + RETURN_FALSE; + } + } + /* }}} */ + /* {{{ proto int hw_documentsize(hwdoc doc) An alias for hw_document_size */ /* }}} */ *************** *** 3083,3089 **** } /* }}} */ ! /* {{{ proto void hw_insdoc(int link, int parentid, array objarr [, string text]) Inserts document */ void php3_hw_insdoc(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[4]; --- 3120,3126 ---- } /* }}} */ ! /* {{{ proto void hw_insdoc(int link, int parentid, string objrec [, string text]) Inserts document */ void php3_hw_insdoc(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[4]; Index: php3/functions/hw.h diff -c php3/functions/hw.h:1.5 php3/functions/hw.h:1.6 *** php3/functions/hw.h:1.5 Tue Jan 12 12:36:18 1999 --- php3/functions/hw.h Thu Apr 8 11:08:13 1999 *************** *** 23,29 **** */ ! /* $Id: hw.h,v 1.5 1999/01/12 17:36:18 steinm Exp $ */ #ifndef _HW_H #define _HW_H --- 23,29 ---- */ ! /* $Id: hw.h,v 1.6 1999/04/08 15:08:13 steinm Exp $ */ #ifndef _HW_H #define _HW_H *************** *** 107,112 **** --- 107,113 ---- extern void php3_hw_document_attributes(INTERNAL_FUNCTION_PARAMETERS); extern void php3_hw_document_bodytag(INTERNAL_FUNCTION_PARAMETERS); extern void php3_hw_document_content(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_hw_document_setcontent(INTERNAL_FUNCTION_PARAMETERS); extern void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS); extern void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS); extern void php3_hw_connection_info(INTERNAL_FUNCTION_PARAMETERS); -- 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 (#4985) next »