133 int ntfsPos = -1, timesPos = -1;
134 unsigned ntfsLength = 0, ntfsTimesLength = 0;
135 for (
int i = 0; i <= extra.size() - 4; ) {
136 unsigned type =
static_cast<unsigned>(
static_cast<unsigned char>(
138 | (
static_cast<unsigned>(
static_cast<unsigned char>(
139 extra.at(i + 1))) << 8);
141 unsigned length =
static_cast<unsigned>(
static_cast<unsigned char>(
143 | (
static_cast<unsigned>(
static_cast<unsigned char>(
144 extra.at(i + 1))) << 8);
153 while (i <= extra.size() - 4) {
154 unsigned tag =
static_cast<unsigned>(
155 static_cast<unsigned char>(extra.at(i)))
156 | (
static_cast<unsigned>(
157 static_cast<unsigned char>(extra.at(i + 1)))
160 unsigned tagsize =
static_cast<unsigned>(
161 static_cast<unsigned char>(extra.at(i)))
162 | (
static_cast<unsigned>(
163 static_cast<unsigned char>(extra.at(i + 1)))
168 ntfsTimesLength = tagsize;
181 ntfsPos = extra.size();
183 extra.resize(extra.size() + 4 + ntfsLength);
187 extra[ntfsPos + 2] = 32;
188 extra[ntfsPos + 3] = 0;
190 memset(extra.data() + ntfsPos + 4, 0, 32);
191 timesPos = ntfsPos + 8;
197 extra[timesPos + 2] = 24;
198 extra[timesPos + 3] = 0;
199 ntfsTimesLength = 24;
201 if (timesPos == -1) {
203 timesPos = ntfsPos + 4 + ntfsLength;
204 extra.resize(extra.size() + 28);
209 memmove(extra.data() + timesPos + 28, extra.data() + timesPos,
210 extra.size() - 28 - timesPos);
217 extra[timesPos + 2] = 24;
218 extra[timesPos + 3] = 0;
220 memset(extra.data() + timesPos + 4, 0, 24);
221 ntfsTimesLength = 24;
223 if (ntfsTimesLength < 24) {
225 size_t timesEnd = timesPos + 4 + ntfsTimesLength;
226 extra.resize(extra.size() + (24 - ntfsTimesLength));
230 memmove(extra.data() + timesEnd + (24 - ntfsTimesLength),
231 extra.data() + timesEnd,
232 extra.size() - (24 - ntfsTimesLength) - timesEnd);
234 ntfsLength += (24 - ntfsTimesLength);
235 ntfsTimesLength = 24;
236 extra[ntfsPos + 2] =
static_cast<char>(ntfsLength);
237 extra[ntfsPos + 3] =
static_cast<char>(ntfsLength >> 8);
238 extra[timesPos + 2] =
static_cast<char>(ntfsTimesLength);
239 extra[timesPos + 3] =
static_cast<char>(ntfsTimesLength >> 8);
241 QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC);
242 #if (QT_VERSION >= 0x040700)
243 quint64 ticks = base.msecsTo(time) * 10000 + fineTicks;
245 QDateTime utc = time.toUTC();
246 quint64 ticks = (
static_cast<qint64
>(base.date().daysTo(utc.date()))
247 * Q_INT64_C(86400000)
248 +
static_cast<qint64
>(base.time().msecsTo(utc.time())))
249 * Q_INT64_C(10000) + fineTicks;
251 extra[timesPos + 4 + position] =
static_cast<char>(ticks);
252 extra[timesPos + 5 + position] =
static_cast<char>(ticks >> 8);
253 extra[timesPos + 6 + position] =
static_cast<char>(ticks >> 16);
254 extra[timesPos + 7 + position] =
static_cast<char>(ticks >> 24);
255 extra[timesPos + 8 + position] =
static_cast<char>(ticks >> 32);
256 extra[timesPos + 9 + position] =
static_cast<char>(ticks >> 40);
257 extra[timesPos + 10 + position] =
static_cast<char>(ticks >> 48);
258 extra[timesPos + 11 + position] =
static_cast<char>(ticks >> 56);
#define QUAZIP_EXTRA_NTFS_MAGIC
#define QUAZIP_EXTRA_NTFS_TIME_MAGIC