-rw-r--r-- | library/backend/vobject.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp index 4c8de70..9263c3a 100644 --- a/library/backend/vobject.cpp +++ b/library/backend/vobject.cpp | |||
@@ -1,95 +1,93 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International | 2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International |
3 | Business Machines Corporation and Siemens Rolm Communications Inc. | 3 | Business Machines Corporation and Siemens Rolm Communications Inc. |
4 | 4 | ||
5 | For purposes of this license notice, the term Licensors shall mean, | 5 | For purposes of this license notice, the term Licensors shall mean, |
6 | collectively, Apple Computer, Inc., AT&T Corp., International | 6 | collectively, Apple Computer, Inc., AT&T Corp., International |
7 | Business Machines Corporation and Siemens Rolm Communications Inc. | 7 | Business Machines Corporation and Siemens Rolm Communications Inc. |
8 | The term Licensor shall mean any of the Licensors. | 8 | The term Licensor shall mean any of the Licensors. |
9 | 9 | ||
10 | Subject to acceptance of the following conditions, permission is hereby | 10 | Subject to acceptance of the following conditions, permission is hereby |
11 | granted by Licensors without the need for written agreement and without | 11 | granted by Licensors without the need for written agreement and without |
12 | license or royalty fees, to use, copy, modify and distribute this | 12 | license or royalty fees, to use, copy, modify and distribute this |
13 | software for any purpose. | 13 | software for any purpose. |
14 | 14 | ||
15 | The above copyright notice and the following four paragraphs must be | 15 | The above copyright notice and the following four paragraphs must be |
16 | reproduced in all copies of this software and any software including | 16 | reproduced in all copies of this software and any software including |
17 | this software. | 17 | this software. |
18 | 18 | ||
19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE | 19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE |
20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR | 20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR |
21 | MODIFICATIONS. | 21 | MODIFICATIONS. |
22 | 22 | ||
23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, | 23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, |
24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT | 24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT |
25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
26 | DAMAGE. | 26 | DAMAGE. |
27 | 27 | ||
28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, | 28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, |
29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE | 29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE |
30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
31 | PURPOSE. | 31 | PURPOSE. |
32 | 32 | ||
33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or | 33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or |
34 | disclosure by the government are subject to restrictions set forth in | 34 | disclosure by the government are subject to restrictions set forth in |
35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | 35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. |
36 | 36 | ||
37 | ***************************************************************************/ | 37 | ***************************************************************************/ |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * src: vobject.c | 40 | * src: vobject.c |
41 | * doc: vobject and APIs to construct vobject, APIs pretty print | 41 | * doc: vobject and APIs to construct vobject, APIs pretty print |
42 | * vobject, and convert a vobject into its textual representation. | 42 | * vobject, and convert a vobject into its textual representation. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #ifndef MWERKS | 45 | #include <stdlib.h> |
46 | #include <malloc.h> | ||
47 | #endif | ||
48 | 46 | ||
49 | #include <qtopia/config.h> | 47 | #include <qtopia/config.h> |
50 | #include "vobject_p.h" | 48 | #include "vobject_p.h" |
51 | #include "qfiledirect_p.h" | 49 | #include "qfiledirect_p.h" |
52 | #include <string.h> | 50 | #include <string.h> |
53 | #include <stdio.h> | 51 | #include <stdio.h> |
54 | #include <fcntl.h> | 52 | #include <fcntl.h> |
55 | //#include <io.h> | 53 | //#include <io.h> |
56 | 54 | ||
57 | 55 | ||
58 | #define NAME_OF(o) o->id | 56 | #define NAME_OF(o) o->id |
59 | #define VALUE_TYPE(o) o->valType | 57 | #define VALUE_TYPE(o) o->valType |
60 | #define STRINGZ_VALUE_OF(o) o->val.strs | 58 | #define STRINGZ_VALUE_OF(o) o->val.strs |
61 | #define INTEGER_VALUE_OF(o) o->val.i | 59 | #define INTEGER_VALUE_OF(o) o->val.i |
62 | #define LONG_VALUE_OF(o) o->val.l | 60 | #define LONG_VALUE_OF(o) o->val.l |
63 | #define ANY_VALUE_OF(o) o->val.any | 61 | #define ANY_VALUE_OF(o) o->val.any |
64 | #define VOBJECT_VALUE_OF(o) o->val.vobj | 62 | #define VOBJECT_VALUE_OF(o) o->val.vobj |
65 | 63 | ||
66 | static char vobj_cs[10]; | 64 | static char vobj_cs[10]; |
67 | static enum { EightBit, QuotedPrintable, Base64 } vobj_enc=EightBit; | 65 | static enum { EightBit, QuotedPrintable, Base64 } vobj_enc=EightBit; |
68 | static const char *vobj_enc_s=0; | 66 | static const char *vobj_enc_s=0; |
69 | 67 | ||
70 | typedef union ValueItem { | 68 | typedef union ValueItem { |
71 | const char *strs; | 69 | const char *strs; |
72 | unsigned int i; | 70 | unsigned int i; |
73 | unsigned long l; | 71 | unsigned long l; |
74 | void *any; | 72 | void *any; |
75 | VObject *vobj; | 73 | VObject *vobj; |
76 | } ValueItem; | 74 | } ValueItem; |
77 | 75 | ||
78 | struct VObject { | 76 | struct VObject { |
79 | VObject *next; | 77 | VObject *next; |
80 | const char *id; | 78 | const char *id; |
81 | VObject *prop; | 79 | VObject *prop; |
82 | unsigned short valType; | 80 | unsigned short valType; |
83 | ValueItem val; | 81 | ValueItem val; |
84 | }; | 82 | }; |
85 | 83 | ||
86 | typedef struct StrItem StrItem; | 84 | typedef struct StrItem StrItem; |
87 | 85 | ||
88 | struct StrItem { | 86 | struct StrItem { |
89 | StrItem *next; | 87 | StrItem *next; |
90 | const char *s; | 88 | const char *s; |
91 | unsigned int refCnt; | 89 | unsigned int refCnt; |
92 | }; | 90 | }; |
93 | 91 | ||
94 | DLLEXPORT(const char**) fieldedProp; | 92 | DLLEXPORT(const char**) fieldedProp; |
95 | 93 | ||
@@ -712,97 +710,96 @@ static struct PreDefProp propNames[] = { | |||
712 | { VCJPEGProp, 0, 0, 0 }, | 710 | { VCJPEGProp, 0, 0, 0 }, |
713 | { VCLanguageProp, 0, 0, 0 }, | 711 | { VCLanguageProp, 0, 0, 0 }, |
714 | { VCLastModifiedProp, 0, 0, 0 }, | 712 | { VCLastModifiedProp, 0, 0, 0 }, |
715 | { VCLastRevisedProp, 0, 0, 0 }, | 713 | { VCLastRevisedProp, 0, 0, 0 }, |
716 | { VCLocationProp, 0, 0, 0 }, | 714 | { VCLocationProp, 0, 0, 0 }, |
717 | { VCLogoProp, 0, 0, 0 }, | 715 | { VCLogoProp, 0, 0, 0 }, |
718 | { VCMailerProp, 0, 0, 0 }, | 716 | { VCMailerProp, 0, 0, 0 }, |
719 | { VCMAlarmProp, 0, MAlarmFields, 0 }, | 717 | { VCMAlarmProp, 0, MAlarmFields, 0 }, |
720 | { VCMCIMailProp, 0, 0, 0 }, | 718 | { VCMCIMailProp, 0, 0, 0 }, |
721 | { VCMessageProp, 0, 0, 0 }, | 719 | { VCMessageProp, 0, 0, 0 }, |
722 | { VCMETProp, 0, 0, 0 }, | 720 | { VCMETProp, 0, 0, 0 }, |
723 | { VCModemProp, 0, 0, 0 }, | 721 | { VCModemProp, 0, 0, 0 }, |
724 | { VCMPEG2Prop, 0, 0, 0 }, | 722 | { VCMPEG2Prop, 0, 0, 0 }, |
725 | { VCMPEGProp, 0, 0, 0 }, | 723 | { VCMPEGProp, 0, 0, 0 }, |
726 | { VCMSNProp, 0, 0, 0 }, | 724 | { VCMSNProp, 0, 0, 0 }, |
727 | { VCNamePrefixesProp, 0, 0, 0 }, | 725 | { VCNamePrefixesProp, 0, 0, 0 }, |
728 | { VCNameProp, 0, nameFields, 0 }, | 726 | { VCNameProp, 0, nameFields, 0 }, |
729 | { VCNameSuffixesProp, 0, 0, 0 }, | 727 | { VCNameSuffixesProp, 0, 0, 0 }, |
730 | { VCNoteProp, 0, 0, 0 }, | 728 | { VCNoteProp, 0, 0, 0 }, |
731 | { VCOrgNameProp, 0, 0, 0 }, | 729 | { VCOrgNameProp, 0, 0, 0 }, |
732 | { VCOrgProp, 0, orgFields, 0 }, | 730 | { VCOrgProp, 0, orgFields, 0 }, |
733 | { VCOrgUnit2Prop, 0, 0, 0 }, | 731 | { VCOrgUnit2Prop, 0, 0, 0 }, |
734 | { VCOrgUnit3Prop, 0, 0, 0 }, | 732 | { VCOrgUnit3Prop, 0, 0, 0 }, |
735 | { VCOrgUnit4Prop, 0, 0, 0 }, | 733 | { VCOrgUnit4Prop, 0, 0, 0 }, |
736 | { VCOrgUnitProp, 0, 0, 0 }, | 734 | { VCOrgUnitProp, 0, 0, 0 }, |
737 | { VCPagerProp, 0, 0, 0 }, | 735 | { VCPagerProp, 0, 0, 0 }, |
738 | { VCPAlarmProp, 0, PAlarmFields, 0 }, | 736 | { VCPAlarmProp, 0, PAlarmFields, 0 }, |
739 | { VCParcelProp, 0, 0, 0 }, | 737 | { VCParcelProp, 0, 0, 0 }, |
740 | { VCPartProp, 0, 0, 0 }, | 738 | { VCPartProp, 0, 0, 0 }, |
741 | { VCPCMProp, 0, 0, 0 }, | 739 | { VCPCMProp, 0, 0, 0 }, |
742 | { VCPDFProp, 0, 0, 0 }, | 740 | { VCPDFProp, 0, 0, 0 }, |
743 | { VCPGPProp, 0, 0, 0 }, | 741 | { VCPGPProp, 0, 0, 0 }, |
744 | { VCPhotoProp, 0, 0, 0 }, | 742 | { VCPhotoProp, 0, 0, 0 }, |
745 | { VCPICTProp, 0, 0, 0 }, | 743 | { VCPICTProp, 0, 0, 0 }, |
746 | { VCPMBProp, 0, 0, 0 }, | 744 | { VCPMBProp, 0, 0, 0 }, |
747 | { VCPostalBoxProp, 0, 0, 0 }, | 745 | { VCPostalBoxProp, 0, 0, 0 }, |
748 | { VCPostalCodeProp, 0, 0, 0 }, | 746 | { VCPostalCodeProp, 0, 0, 0 }, |
749 | { VCPostalProp, 0, 0, 0 }, | 747 | { VCPostalProp, 0, 0, 0 }, |
750 | { VCPowerShareProp, 0, 0, 0 }, | 748 | { VCPowerShareProp, 0, 0, 0 }, |
751 | { VCPreferredProp, 0, 0, 0 }, | 749 | { VCPreferredProp, 0, 0, 0 }, |
752 | { VCPriorityProp, 0, 0, 0 }, | 750 | { VCPriorityProp, 0, 0, 0 }, |
753 | { VCProcedureNameProp, 0, 0, 0 }, | 751 | { VCProcedureNameProp, 0, 0, 0 }, |
754 | { VCProdIdProp, 0, 0, 0 }, | 752 | { VCProdIdProp, 0, 0, 0 }, |
755 | { VCProdigyProp, 0, 0, 0 }, | 753 | { VCProdigyProp, 0, 0, 0 }, |
756 | { VCPronunciationProp, 0, 0, 0 }, | 754 | { VCPronunciationProp, 0, 0, 0 }, |
757 | { VCPSProp, 0, 0, 0 }, | 755 | { VCPSProp, 0, 0, 0 }, |
758 | { VCPublicKeyProp, 0, 0, 0 }, | 756 | { VCPublicKeyProp, 0, 0, 0 }, |
759 | { VCQPProp, VCQuotedPrintableProp, 0, 0 }, | 757 | { VCQPProp, VCQuotedPrintableProp, 0, 0 }, |
760 | { VCQPProp, VCBase64Prop, 0, 0 }, | ||
761 | { VCQuickTimeProp, 0, 0, 0 }, | 758 | { VCQuickTimeProp, 0, 0, 0 }, |
762 | { VCQuotedPrintableProp, 0, 0, 0 }, | 759 | { VCQuotedPrintableProp, 0, 0, 0 }, |
763 | { VCRDateProp, 0, 0, 0 }, | 760 | { VCRDateProp, 0, 0, 0 }, |
764 | { VCRegionProp, 0, 0, 0 }, | 761 | { VCRegionProp, 0, 0, 0 }, |
765 | { VCRelatedToProp, 0, 0, 0 }, | 762 | { VCRelatedToProp, 0, 0, 0 }, |
766 | { VCRepeatCountProp, 0, 0, 0 }, | 763 | { VCRepeatCountProp, 0, 0, 0 }, |
767 | { VCResourcesProp, 0, 0, 0 }, | 764 | { VCResourcesProp, 0, 0, 0 }, |
768 | { VCRNumProp, 0, 0, 0 }, | 765 | { VCRNumProp, 0, 0, 0 }, |
769 | { VCRoleProp, 0, 0, 0 }, | 766 | { VCRoleProp, 0, 0, 0 }, |
770 | { VCRRuleProp, 0, 0, 0 }, | 767 | { VCRRuleProp, 0, 0, 0 }, |
771 | { VCRSVPProp, 0, 0, 0 }, | 768 | { VCRSVPProp, 0, 0, 0 }, |
772 | { VCRunTimeProp, 0, 0, 0 }, | 769 | { VCRunTimeProp, 0, 0, 0 }, |
773 | { VCSequenceProp, 0, 0, 0 }, | 770 | { VCSequenceProp, 0, 0, 0 }, |
774 | { VCSnoozeTimeProp, 0, 0, 0 }, | 771 | { VCSnoozeTimeProp, 0, 0, 0 }, |
775 | { VCStartProp, 0, 0, 0 }, | 772 | { VCStartProp, 0, 0, 0 }, |
776 | { VCStatusProp, 0, 0, 0 }, | 773 | { VCStatusProp, 0, 0, 0 }, |
777 | { VCStreetAddressProp, 0, 0, 0 }, | 774 | { VCStreetAddressProp, 0, 0, 0 }, |
778 | { VCSubTypeProp, 0, 0, 0 }, | 775 | { VCSubTypeProp, 0, 0, 0 }, |
779 | { VCSummaryProp, 0, 0, 0 }, | 776 | { VCSummaryProp, 0, 0, 0 }, |
780 | { VCTelephoneProp, 0, 0, 0 }, | 777 | { VCTelephoneProp, 0, 0, 0 }, |
781 | { VCTIFFProp, 0, 0, 0 }, | 778 | { VCTIFFProp, 0, 0, 0 }, |
782 | { VCTimeZoneProp, 0, 0, 0 }, | 779 | { VCTimeZoneProp, 0, 0, 0 }, |
783 | { VCTitleProp, 0, 0, 0 }, | 780 | { VCTitleProp, 0, 0, 0 }, |
784 | { VCTLXProp, 0, 0, 0 }, | 781 | { VCTLXProp, 0, 0, 0 }, |
785 | { VCTodoProp, 0, 0, PD_BEGIN }, | 782 | { VCTodoProp, 0, 0, PD_BEGIN }, |
786 | { VCTranspProp, 0, 0, 0 }, | 783 | { VCTranspProp, 0, 0, 0 }, |
787 | { VCUniqueStringProp, 0, 0, 0 }, | 784 | { VCUniqueStringProp, 0, 0, 0 }, |
788 | { VCURLProp, 0, 0, 0 }, | 785 | { VCURLProp, 0, 0, 0 }, |
789 | { VCURLValueProp, 0, 0, 0 }, | 786 | { VCURLValueProp, 0, 0, 0 }, |
790 | { VCValueProp, 0, 0, 0 }, | 787 | { VCValueProp, 0, 0, 0 }, |
791 | { VCVersionProp, 0, 0, 0 }, | 788 | { VCVersionProp, 0, 0, 0 }, |
792 | { VCVideoProp, 0, 0, 0 }, | 789 | { VCVideoProp, 0, 0, 0 }, |
793 | { VCVoiceProp, 0, 0, 0 }, | 790 | { VCVoiceProp, 0, 0, 0 }, |
794 | { VCWAVEProp, 0, 0, 0 }, | 791 | { VCWAVEProp, 0, 0, 0 }, |
795 | { VCWMFProp, 0, 0, 0 }, | 792 | { VCWMFProp, 0, 0, 0 }, |
796 | { VCWorkProp, 0, 0, 0 }, | 793 | { VCWorkProp, 0, 0, 0 }, |
797 | { VCX400Prop, 0, 0, 0 }, | 794 | { VCX400Prop, 0, 0, 0 }, |
798 | { VCX509Prop, 0, 0, 0 }, | 795 | { VCX509Prop, 0, 0, 0 }, |
799 | { VCXRuleProp, 0, 0, 0 }, | 796 | { VCXRuleProp, 0, 0, 0 }, |
800 | { 0,0,0,0 } | 797 | { 0,0,0,0 } |
801 | }; | 798 | }; |
802 | 799 | ||
803 | 800 | ||
804 | static struct PreDefProp* lookupPropInfo(const char* str) | 801 | static struct PreDefProp* lookupPropInfo(const char* str) |
805 | { | 802 | { |
806 | /* brute force for now, could use a hash table here. */ | 803 | /* brute force for now, could use a hash table here. */ |
807 | int i; | 804 | int i; |
808 | 805 | ||