ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
quazipfileinfo.cpp File Reference
#include "quazipfileinfo.h"
+ Include dependency graph for quazipfileinfo.cpp:

Go to the source code of this file.

Functions

static QFile::Permissions permissionsFromExternalAttr (quint32 externalAttr)
 
static QDateTime getNTFSTime (const QByteArray &extra, int position, int *fineTicks)
 

Function Documentation

static QDateTime getNTFSTime ( const QByteArray &  extra,
int  position,
int *  fineTicks 
)
static

Definition at line 92 of file quazipfileinfo.cpp.

References QUAZIP_EXTRA_NTFS_MAGIC, and QUAZIP_EXTRA_NTFS_TIME_MAGIC.

Referenced by QuaZipFileInfo64::getNTFSaTime(), QuaZipFileInfo64::getNTFScTime(), and QuaZipFileInfo64::getNTFSmTime().

94 {
95  QDateTime dateTime;
96  for (int i = 0; i <= extra.size() - 4; ) {
97  unsigned type = static_cast<unsigned>(static_cast<unsigned char>(
98  extra.at(i)))
99  | (static_cast<unsigned>(static_cast<unsigned char>(
100  extra.at(i + 1))) << 8);
101  i += 2;
102  unsigned length = static_cast<unsigned>(static_cast<unsigned char>(
103  extra.at(i)))
104  | (static_cast<unsigned>(static_cast<unsigned char>(
105  extra.at(i + 1))) << 8);
106  i += 2;
107  if (type == QUAZIP_EXTRA_NTFS_MAGIC && length >= 32) {
108  i += 4; // reserved
109  while (i <= extra.size() - 4) {
110  unsigned tag = static_cast<unsigned>(
111  static_cast<unsigned char>(extra.at(i)))
112  | (static_cast<unsigned>(
113  static_cast<unsigned char>(extra.at(i + 1)))
114  << 8);
115  i += 2;
116  int tagsize = static_cast<unsigned>(
117  static_cast<unsigned char>(extra.at(i)))
118  | (static_cast<unsigned>(
119  static_cast<unsigned char>(extra.at(i + 1)))
120  << 8);
121  i += 2;
123  && tagsize >= position + 8) {
124  i += position;
125  quint64 mtime = static_cast<quint64>(
126  static_cast<unsigned char>(extra.at(i)))
127  | (static_cast<quint64>(static_cast<unsigned char>(
128  extra.at(i + 1))) << 8)
129  | (static_cast<quint64>(static_cast<unsigned char>(
130  extra.at(i + 2))) << 16)
131  | (static_cast<quint64>(static_cast<unsigned char>(
132  extra.at(i + 3))) << 24)
133  | (static_cast<quint64>(static_cast<unsigned char>(
134  extra.at(i + 4))) << 32)
135  | (static_cast<quint64>(static_cast<unsigned char>(
136  extra.at(i + 5))) << 40)
137  | (static_cast<quint64>(static_cast<unsigned char>(
138  extra.at(i + 6))) << 48)
139  | (static_cast<quint64>(static_cast<unsigned char>(
140  extra.at(i + 7))) << 56);
141  // the NTFS time is measured from 1601 for whatever reason
142  QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC);
143  dateTime = base.addMSecs(mtime / 10000);
144  if (fineTicks != NULL) {
145  *fineTicks = static_cast<int>(mtime % 10000);
146  }
147  i += tagsize - position;
148  } else {
149  i += tagsize;
150  }
151 
152  }
153  } else {
154  i += length;
155  }
156  }
157  if (fineTicks != NULL && dateTime.isNull()) {
158  *fineTicks = 0;
159  }
160  return dateTime;
161 }
#define QUAZIP_EXTRA_NTFS_MAGIC
Definition: quazip_global.h:56
#define QUAZIP_EXTRA_NTFS_TIME_MAGIC
Definition: quazip_global.h:57

+ Here is the caller graph for this function:

static QFile::Permissions permissionsFromExternalAttr ( quint32  externalAttr)
static

Definition at line 27 of file quazipfileinfo.cpp.

Referenced by QuaZipFileInfo::getPermissions(), and QuaZipFileInfo64::getPermissions().

27  {
28  quint32 uPerm = (externalAttr & 0xFFFF0000u) >> 16;
29  QFile::Permissions perm = 0;
30  if ((uPerm & 0400) != 0)
31  perm |= QFile::ReadOwner;
32  if ((uPerm & 0200) != 0)
33  perm |= QFile::WriteOwner;
34  if ((uPerm & 0100) != 0)
35  perm |= QFile::ExeOwner;
36  if ((uPerm & 0040) != 0)
37  perm |= QFile::ReadGroup;
38  if ((uPerm & 0020) != 0)
39  perm |= QFile::WriteGroup;
40  if ((uPerm & 0010) != 0)
41  perm |= QFile::ExeGroup;
42  if ((uPerm & 0004) != 0)
43  perm |= QFile::ReadOther;
44  if ((uPerm & 0002) != 0)
45  perm |= QFile::WriteOther;
46  if ((uPerm & 0001) != 0)
47  perm |= QFile::ExeOther;
48  return perm;
49 
50 }

+ Here is the caller graph for this function: