Diffstat (limited to 'noncore/apps/opie-reader/Bkmks.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp index 998601a..a8bee13 100644 --- a/noncore/apps/opie-reader/Bkmks.cpp +++ b/noncore/apps/opie-reader/Bkmks.cpp | |||
@@ -119,65 +119,65 @@ void Bkmk::setAnno(unsigned char* t, unsigned short len) | |||
119 | memcpy(m_anno, t, m_annolen); | 119 | memcpy(m_anno, t, m_annolen); |
120 | } | 120 | } |
121 | else | 121 | else |
122 | { | 122 | { |
123 | m_annolen = sizeof(tchar); | 123 | m_annolen = sizeof(tchar); |
124 | m_anno = new unsigned char[m_annolen]; | 124 | m_anno = new unsigned char[m_annolen]; |
125 | *((tchar*)m_anno) = 0; | 125 | *((tchar*)m_anno) = 0; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | void Bkmk::setAnno(tchar* t) | 129 | void Bkmk::setAnno(tchar* t) |
130 | { | 130 | { |
131 | if (m_anno != NULL) | 131 | if (m_anno != NULL) |
132 | { | 132 | { |
133 | delete [] m_anno; | 133 | delete [] m_anno; |
134 | m_anno = NULL; | 134 | m_anno = NULL; |
135 | } | 135 | } |
136 | if (t != NULL) | 136 | if (t != NULL) |
137 | { | 137 | { |
138 | unsigned short len = ustrlen(t)+1; | 138 | unsigned short len = ustrlen(t)+1; |
139 | m_annolen = sizeof(tchar)*len; | 139 | m_annolen = sizeof(tchar)*len; |
140 | m_anno = new unsigned char[m_annolen]; | 140 | m_anno = new unsigned char[m_annolen]; |
141 | memcpy(m_anno, t, m_annolen); | 141 | memcpy(m_anno, t, m_annolen); |
142 | } | 142 | } |
143 | else | 143 | else |
144 | { | 144 | { |
145 | m_annolen = sizeof(tchar); | 145 | m_annolen = sizeof(tchar); |
146 | m_anno = new unsigned char[m_annolen]; | 146 | m_anno = new unsigned char[m_annolen]; |
147 | *((tchar*)m_anno) = 0; | 147 | *((tchar*)m_anno) = 0; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | BkmkFile::BkmkFile(const char *fnm, bool w = false) | 151 | BkmkFile::BkmkFile(const char *fnm, bool w) |
152 | : | 152 | : |
153 | wt(w), isUpgraded(false) | 153 | wt(w), isUpgraded(false) |
154 | { | 154 | { |
155 | if (w) | 155 | if (w) |
156 | { | 156 | { |
157 | f = fopen(fnm, "wb"); | 157 | f = fopen(fnm, "wb"); |
158 | } | 158 | } |
159 | else | 159 | else |
160 | { | 160 | { |
161 | f = fopen(fnm, "rb"); | 161 | f = fopen(fnm, "rb"); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | BkmkFile::~BkmkFile() | 165 | BkmkFile::~BkmkFile() |
166 | { | 166 | { |
167 | if (f != NULL) fclose(f); | 167 | if (f != NULL) fclose(f); |
168 | } | 168 | } |
169 | 169 | ||
170 | void BkmkFile::write(const Bkmk& b) | 170 | void BkmkFile::write(const Bkmk& b) |
171 | { | 171 | { |
172 | if (f != NULL) | 172 | if (f != NULL) |
173 | { | 173 | { |
174 | fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f); | 174 | fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f); |
175 | fwrite(b.m_name,1,b.m_namelen,f); | 175 | fwrite(b.m_name,1,b.m_namelen,f); |
176 | fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f); | 176 | fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f); |
177 | fwrite(b.m_anno,1,b.m_annolen,f); | 177 | fwrite(b.m_anno,1,b.m_annolen,f); |
178 | fwrite(&b.m_position,sizeof(b.m_position),1,f); | 178 | fwrite(&b.m_position,sizeof(b.m_position),1,f); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | void BkmkFile::write(CList<Bkmk>& bl) | 182 | void BkmkFile::write(CList<Bkmk>& bl) |
183 | { | 183 | { |