Changeset 138
- Timestamp:
- 04/21/06 00:01:54 (3 years ago)
- Files:
-
- branches/6620-branch/libsyncml/parser/sml_xml_assm.c (modified) (1 diff)
- branches/6620-branch/libsyncml/sml_elements.c (modified) (2 diffs)
- branches/6620-branch/libsyncml/sml_parse.c (modified) (4 diffs)
- branches/6620-branch/libsyncml/sml_parse.h (modified) (1 diff)
- branches/6620-branch/libsyncml/sml_session.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/6620-branch/libsyncml/parser/sml_xml_assm.c
r136 r138 1462 1462 1463 1463 buffersize += xmlBufferLength(status->buffer) - 1; 1464 if (maxsize && buffersize > maxsize)1465 break;1464 //if (maxsize && buffersize > maxsize) 1465 // break; 1466 1466 xmlTextWriterWriteRawLen(assm->writer, xmlBufferContent(status->buffer), xmlBufferLength(status->buffer) - 1); 1467 1467 } branches/6620-branch/libsyncml/sml_elements.c
r127 r138 316 316 } 317 317 318 /* If data is NULL, this call is the same if smlItemNew */ 318 319 SmlItem *smlItemNewForData(const char *data, unsigned int size, SmlError **error) 319 320 { … … 323 324 if (!item) 324 325 goto error; 325 326 if (!smlItemAddData(item, data, size, error)) 327 goto error_free_item; 326 327 if (data) { 328 if (!smlItemAddData(item, data, size, error)) 329 goto error_free_item; 330 } 328 331 329 332 smlTrace(TRACE_EXIT, "%s: %p", __func__, item); branches/6620-branch/libsyncml/sml_parse.c
r127 r138 721 721 * @param assm The assembler 722 722 * @param status The command to add 723 * @param force If set to TRUE, libsyncml will ignore if the outgoing limit has been reached 723 724 * @param error A pointer to an error struct 724 725 * @returns SML_ASSEMBLER_RESULT_OK if the status was added ok, SML_ASSEMBLER_RESULT_MISMATCH … … 726 727 * 727 728 */ 728 SmlAssemblerResult smlAssemblerAddStatus (SmlAssembler *assm, SmlStatus *status, SmlError **error)729 { 730 smlTrace(TRACE_ENTRY, "%s(%p, %p, % p)", __func__, assm, status, error);729 SmlAssemblerResult smlAssemblerAddStatusFull(SmlAssembler *assm, SmlStatus *status, SmlBool force, SmlError **error) 730 { 731 smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %p)", __func__, assm, status, force, error); 731 732 smlAssert(assm); 732 733 smlAssert(status); … … 738 739 goto error; 739 740 740 741 /* Lets see if the new buffer is small enough */ 742 int limit = smlAssemblerGetLimit(assm); 743 if (limit) { 744 /* Now check the size */ 745 unsigned int size = 0; 746 if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) 747 goto error; 748 749 if (size > limit) { 750 /* The status does not fit. Remove it again */ 751 if (!assm->functions.rem_status(assm->assm_userdata, error)) 741 if (!force) { 742 /* Lets see if the new buffer is small enough */ 743 int limit = smlAssemblerGetLimit(assm); 744 if (limit) { 745 /* Now check the size */ 746 unsigned int size = 0; 747 if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) 752 748 goto error; 753 749 754 smlTrace(TRACE_EXIT, "%s: Mismatch", __func__); 755 return SML_ASSEMBLER_RESULT_MISMATCH; 750 if (size > limit) { 751 /* The status does not fit. Remove it again */ 752 if (!assm->functions.rem_status(assm->assm_userdata, error)) 753 goto error; 754 755 smlTrace(TRACE_EXIT, "%s: Mismatch", __func__); 756 return SML_ASSEMBLER_RESULT_MISMATCH; 757 } 756 758 } 757 759 } … … 766 768 smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); 767 769 return SML_ASSEMBLER_RESULT_ERROR; 770 } 771 772 SmlAssemblerResult smlAssemblerAddStatus(SmlAssembler *assm, SmlStatus *status, SmlError **error) 773 { 774 return smlAssemblerAddStatusFull(assm, status, FALSE, error); 768 775 } 769 776 branches/6620-branch/libsyncml/sml_parse.h
r127 r138 101 101 SmlBool smlAssemblerRun(SmlAssembler *assm, char **data, unsigned int *size, SmlBool *end, SmlBool final, SmlError **error); 102 102 SmlAssemblerResult smlAssemblerAddStatus(SmlAssembler *assm, SmlStatus *status, SmlError **error); 103 SmlAssemblerResult smlAssemblerAddStatusFull(SmlAssembler *assm, SmlStatus *status, SmlBool force, SmlError **error); 103 104 SmlAssemblerResult smlAssemblerReserveStatus(SmlAssembler *assm, unsigned int cmdRef, unsigned int msgRef, unsigned int cmdID, SmlError **error); 104 105 SmlBool smlAssemblerAddHeader(SmlAssembler *assm, SmlSession *session, SmlError **error); branches/6620-branch/libsyncml/sml_session.c
r127 r138 543 543 } 544 544 545 /* We ignore if the added status violates the size limitation if 546 * a incoming buffer for a large object is open. the problem is that 547 * the status for the chunk has to go into the next message AND the status 548 * MUST be in the same order as the original commands. so the only solution is 549 * to send all statuses and ignore the size. */ 550 545 551 /* Now we can try to add the status to the assembler */ 546 switch (smlAssemblerAddStatus (session->assembler, status, &error)) {552 switch (smlAssemblerAddStatusFull(session->assembler, status, session->incomingBuffer ? TRUE : FALSE, &error)) { 547 553 case SML_ASSEMBLER_RESULT_OK: 548 554 /* We successfully added the status */ … … 925 931 if (final) { 926 932 if (session->pendingReplies) { 927 smlErrorSet(error, SML_ERROR_GENERIC, "Didnt receive a reply for a pending status"); 933 SmlPendingStatus *pending = (SmlPendingStatus *)session->pendingReplies->data; 934 smlErrorSet(error, SML_ERROR_GENERIC, "Didnt receive a reply for pending status (cmdID %i, msgID %i)", pending->cmdID, pending->msgID); 928 935 _smlSessionFreePendingReplies(session); 929 936 goto error;
