From: Kidong L. <bri...@us...> - 2004-04-07 07:04:07
|
Update of /cvsroot/syncml-ctoolkit/toolkit/src/xpt/bindings/obex/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17505/src/xpt/bindings/obex/win Modified Files: obexbinding.c obexbinding.h Log Message: Added -Wall to CFLAGS, Removed unused variables and functions Index: obexbinding.h =================================================================== RCS file: /cvsroot/syncml-ctoolkit/toolkit/src/xpt/bindings/obex/win/obexbinding.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obexbinding.h 2 May 2003 22:05:10 -0000 1.2 --- obexbinding.h 7 Apr 2004 06:51:09 -0000 1.3 *************** *** 488,496 **** /* - ** Flow obex request - */ - static Ret_t obxFlowObexRequest( ObxConnectionBlock *cblock, ObxObject *obj ); - - /* ** Flow obex handshaking for client mode */ --- 488,491 ---- *************** *** 498,506 **** /* - ** Flow obex handshaking for shutting down client mode - */ - static void obxTerminateForClientMode( ObxConnectionBlock *cblock ); - - /* ** Flow obex handshaking for server mode */ --- 493,496 ---- *************** *** 508,528 **** /* - ** Flow obex handshaking for shutting down server mode - */ - static void obxTerminateForServerMode( ObxConnectionBlock *cblock ); - - /* - ** When we're in server mode, this call blocks on an accept... returns - ** after a 'client' has attached to us. - ** On return, success: OBX_RC_OK - */ - static Ret_t obxAccept( ObxConnectionBlock *connection ); - - /* - ** Client becomes server, Server becomes client. - */ - static Ret_t obxModeSwap( ObxConnectionBlock *connection ); - - /* ** Queue the inbound buffer for a later send. */ --- 498,501 ---- *************** *** 535,544 **** /* - ** Takes an ObxList returned from ObxGetHeaderList and returns a - ** pointer to the specified header or NULL if header does not exist. - */ - static ObxHeader *obxGetHeader( ObxList *headers, unsigned char type ); - - /* ** Register the underlying OBEX transporta */ --- 508,511 ---- *************** *** 552,557 **** static Ret_t obxSendObexConnect( ObxConnectionBlock *ocb ); - static Ret_t obxSendDocinfo( ObxConnectionBlock *ocb); - static Ret_t obxSendObexDisconnect( ObxConnectionBlock *ocb ); --- 519,522 ---- *************** *** 559,564 **** static ObxObject *obxWaitForObexResponse( ObxConnectionBlock *ocb ); - static Ret_t obxProcessObexObject( ObxConnectionBlock *ocb, ObxObject *response ); - /* ** Record errors with xpt layer --- 524,527 ---- *************** *** 569,573 **** * Parse the value string of the header field XSyncmlHmac */ ! unsigned char *splitParmValue (unsigned char *pszLine, // i: line unsigned char **ppszParm, // o: ptr to extracted parameter unsigned char **ppszValue); // o: ptr to extracted parameter value --- 532,536 ---- * Parse the value string of the header field XSyncmlHmac */ ! static unsigned char *splitParmValue (unsigned char *pszLine, // i: line unsigned char **ppszParm, // o: ptr to extracted parameter unsigned char **ppszValue); // o: ptr to extracted parameter value Index: obexbinding.c =================================================================== RCS file: /cvsroot/syncml-ctoolkit/toolkit/src/xpt/bindings/obex/win/obexbinding.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** obexbinding.c 3 Apr 2004 12:05:11 -0000 1.4 --- obexbinding.c 7 Apr 2004 06:51:09 -0000 1.5 *************** *** 619,631 **** Ret_t rc = OBX_RC_OK; ! int len = 0, length = 0; - ObxHeader *body = NULL; - ObxBuffer *bodyBuf = NULL; ObxObject *response = NULL; ! ObxObject *request = NULL, *result=NULL; ! ObxHeader *hName = NULL, *hLength = NULL; ! ObxBuffer *bName = NULL; ObxIterator *iterator; ObxHeader *header; --- 619,627 ---- Ret_t rc = OBX_RC_OK; ! int length = 0; ObxObject *response = NULL; ! ObxObject *request = NULL; ObxIterator *iterator; ObxHeader *header; *************** *** 1047,1058 **** ObxConnectionBlock *ocb = (ObxConnectionBlock *)privateConnectionInfo; - - Ret_t rc = OBX_RC_OK; int length = 0; - ObxObject *response = NULL; - ObxHeader *body = NULL; - ObxBuffer *bodyBuf = NULL; - XPTDEBUG(("OBX obxReceiveData()\n")); --- 1043,1048 ---- *************** *** 1234,1239 **** Ret_t rc = OBX_RC_OK; - unsigned int creatorId = OBX_DEFAULT_CREATORID; - ObxConnectionBlock *ocb = (ObxConnectionBlock *)privateConnectionInfo; --- 1224,1227 ---- *************** *** 1903,1907 **** */ static Ret_t obxInitializeForClientMode( ObxConnectionBlock *ocb ) { - Ret_t rc = OBX_RC_OK; XPTDEBUG(("OBX obxInitializeForClientMode()\n")); --- 1891,1894 ---- *************** *** 1926,1936 **** /* - ** Flow obex handshaking for shutting down client mode - */ - static void obxTerminateForClientMode( ObxConnectionBlock *ocb ) { - XPTDEBUG(("OBX obxTerminateForClientMode()\n")); - } - - /* ** Flow obex handshaking for server mode ** Really this means we put up an accept and block. --- 1913,1916 ---- *************** *** 1963,2023 **** /* - ** Flow obex handshaking for shutting down server mode - */ - static void obxTerminateForServerMode( ObxConnectionBlock *ocb ) { - XPTDEBUG(("OBX obxTerminateForServerMode()\n")); - } - - /* - ** Client becomes server, Server becomes client.... mostly. - */ - static Ret_t obxModeSwap( ObxConnectionBlock *connection ) { - Ret_t rc = OBX_RC_OK; - - XPTDEBUG(("OBX obxModeSwap call ignored -> no longer needed\n")); - return OBX_RC_OK; - - switch ( connection->currentRole ) { - // Current role UNSPECIFIED - case OBX_REQUEST_ROLE_UNSPECIFIED: - XPTDEBUG(("OBX obxModeSwap(): Role is UNSPECIFIED")); - // How was connection orginally opened? - switch ( connection->role ) { - case XPT_REQUEST_RECEIVER: - connection->currentRole = OBX_REQUEST_ROLE_RECEIVER; - XPTDEBUG((" switching to RECEIVER\n")); - rc = obxInitializeForServerMode( connection ); // accept() - break; - case XPT_REQUEST_SENDER: - connection->currentRole = OBX_REQUEST_ROLE_SENDER; - XPTDEBUG((" switching to SENDER\n")); - rc = obxInitializeForClientMode( connection ); // connect() to peer - break; - } - break; - - // Current role RECEIVER - case OBX_REQUEST_ROLE_RECEIVER: - XPTDEBUG(("OBX obxModeSwap(): Role is RECEIVER switching to SENDER\n")); - - oSleep( 2 ); // let Palm get his 'accept()' up - - connection->currentRole = OBX_REQUEST_ROLE_SENDER; - obxTerminateForServerMode( connection ); - rc = obxInitializeForClientMode( connection ); // connect() to peer - break; - - // Current role SENDER - case OBX_REQUEST_ROLE_SENDER: - XPTDEBUG(("OBX obxModeSwap(): Role is SENDER switching to RECEIVER\n")); - connection->currentRole = OBX_REQUEST_ROLE_RECEIVER; - obxTerminateForClientMode( connection ); - rc = obxInitializeForServerMode( connection ); // accept() - break; - } - return rc; - } - - /* ** Queue the inbound buffer for a later send. */ --- 1943,1946 ---- *************** *** 2080,2084 **** static int obxGetBufferForSend( ObxConnectionBlock *connection, ObxBuffer **body ) { - ObxBuf *oBuf = NULL; ObxBuffer *buffer = NULL; ObxSequenceNode *cursor = NULL; --- 2003,2006 ---- *************** *** 2118,2148 **** - /* - ** Takes an ObxList returned from ObxGetHeaderList and returns a - ** pointer to the specified header or NULL if header does not exist. - */ - static ObxHeader *obxGetHeader( ObxList *headers, unsigned char type ) { - - ObxIterator *iterator = NULL; - ObxHeader *header = NULL; - int found = 0; - - XPTDEBUG(("OBX obxGetHeader(), header = %02X\n",type)); - - if ( headers != NULL ) { - iterator = ObxListGetIterator( headers ); - while ( ObxIteratorHasNext( iterator ) && !found ) { - header = (ObxHeader *)ObxIteratorNext( iterator ); - if ( header->identifier == type ) { - found = 1; - } // end if - } // end while - ObxIteratorFree( iterator ); - } // end if - - return ( found ? header : NULL ); - - } // obxGetHeader() - static Ret_t obxSendObexConnect( ObxConnectionBlock *ocb ) { ObxObject *request; --- 2040,2043 ---- *************** *** 2321,2425 **** } // obxWaitForObexResponse() - - static Ret_t obxProcessObexObject( ObxConnectionBlock *ocb, ObxObject *response ) { - - int length; - - unsigned char *buffer; - - ObxHeader *header = NULL; - ObxBuffer *headerBuf = NULL; - ObxList *headerList = NULL; - - XPTDEBUG(("OBX obxProcessObexObject()\n")); - - CHECK_PARM( ocb, "obxProcessObexObject()", "ocb" ); - CHECK_PARM( response, "obxProcessObexObject()", "response" ); - - headerList = ObxGetHeaderList( ocb->obxHandle, response ); - if ( headerList == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - - if ( ocb->docInfo == NULL ) { - ocb->docInfo = (XptCommunicationInfo_t *)ALLOC_MEM( sizeof( XptCommunicationInfo_t ) ); - if ( ocb->docInfo == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - } // end if - - // Populate the docInfo structure - header = obxGetHeader( headerList, OBEX_HEADER_NAME ); - if ( header == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - length = ObxBufSize( header->value.unicodeValue ); - buffer = (unsigned char *)malloc( length ); - ObxBufRead( header->value.unicodeValue, buffer, length ); - headerBuf = ObxUnicodeToUTF8( buffer, length ); - ObxBufRead( headerBuf, ocb->docInfo->docName, ObxBufSize( headerBuf ) ); - ObxBufFree( headerBuf ); - free( buffer ); - headerBuf = NULL; - buffer = NULL; - - // Since the Palm does NOT set the mimeType, use description, if present. - header = obxGetHeader( headerList, OBEX_HEADER_DESCRIPTION ); - if ( header == NULL ) { - header = obxGetHeader( headerList, OBEX_HEADER_TYPE ); - if ( header == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - ObxBufRead( header->value.byteSequenceValue, ocb->docInfo->mimeType, ObxBufSize( header->value.byteSequenceValue ) ); - } // end if - else { - length = ObxBufSize( header->value.unicodeValue ); - buffer = (unsigned char *)malloc( length ); - ObxBufRead( header->value.unicodeValue, buffer, length ); - headerBuf = ObxUnicodeToUTF8( buffer, length ); - ObxBufRead( headerBuf, ocb->docInfo->mimeType, ObxBufSize( headerBuf ) ); - ObxBufFree( headerBuf ); - free( buffer ); - headerBuf = NULL; - buffer = NULL; - } // end else - - // Get the LENGTH header - header = obxGetHeader( headerList, OBEX_HEADER_LENGTH ); - if ( header == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - ocb->docInfo->cbLength = header->value.fourBytevalue; - - if ( ocb->dataToRead == NULL ) { - ocb->dataToRead = (ObxBuf *)ALLOC_MEM( sizeof( ObxBuf ) ); - if ( ocb->dataToRead == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - } // end if - - // Populate the dataToRead structure - header = obxGetHeader( headerList, OBEX_HEADER_BODY ); - if ( header == NULL ) { - ocb->dataToRead->buf = NULL; - ocb->dataToRead->cursor = NULL; - ocb->dataToRead->length = 0; - return OBX_RC_GENERAL_ERROR; - } // end if - else { - headerBuf = header->value.byteSequenceValue; - ocb->dataToRead->buf = (unsigned char *)ALLOC_MEM( ObxBufSize( headerBuf ) ); - if ( ocb->dataToRead->buf == NULL ) { - return OBX_RC_GENERAL_ERROR; - } // end if - ocb->dataToRead->cursor = ocb->dataToRead->buf; - ocb->dataToRead->length = ObxBufSize( headerBuf ); - ObxBufRead( headerBuf, ocb->dataToRead->buf, ocb->dataToRead->length ); - } // end else - - return OBX_RC_OK; - - } // obxProcessObexObject() - /* ** Record any errors. --- 2216,2219 ---- |