Skip to content

Commit a99f6a7

Browse files
authored
Merge pull request #87 from guzba/ryan
fix for 32 bit
2 parents 1b02266 + 117b0cf commit a99f6a7

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

src/zippy/internal.nim

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ const
110110
16.uint8, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
111111
]
112112

113-
S_IFDIR* = 0o0040000
114-
TUREAD* = 0o00400 # read by owner */
115-
TUWRITE* = 0o00200 # write by owner */
116-
TUEXEC* = 0o00100 # execute/search by owner */
117-
TGREAD* = 0o00040 # read by group */
118-
TGWRITE* = 0o00020 # write by group */
119-
TGEXEC* = 0o00010 # execute/search by group */
120-
TOREAD* = 0o00004 # read by other */
121-
TOWRITE* = 0o00002 # write by other */
122-
TOEXEC* = 0o00001 # execute/search by other */
113+
S_IFDIR* = 0o0040000'u32
114+
TUREAD* = 0o00400'u32 # read by owner */
115+
TUWRITE* = 0o00200'u32 # write by owner */
116+
TUEXEC* = 0o00100'u32 # execute/search by owner */
117+
TGREAD* = 0o00040'u32 # read by group */
118+
TGWRITE* = 0o00020'u32 # write by group */
119+
TGEXEC* = 0o00010'u32 # execute/search by group */
120+
TOREAD* = 0o00004'u32 # read by other */
121+
TOWRITE* = 0o00002'u32 # write by other */
122+
TOEXEC* = 0o00001'u32 # execute/search by other */
123123

124124
type
125125
CompressionConfig* = object
@@ -272,7 +272,7 @@ proc determineMatchLength*(
272272
proc toUnixPath*(path: string): string =
273273
path.replace('\\', '/')
274274

275-
proc parseFilePermissions*(permissions: int): set[FilePermission] =
275+
proc parseFilePermissions*(permissions: uint32): set[FilePermission] =
276276
if defined(windows) or permissions == 0:
277277
# Ignore file permissions on Windows. If they are absent (.zip made on
278278
# Windows for example), set default permissions.

src/zippy/tarballs.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ proc extractAll*(
102102
dest / path,
103103
uncompressed.toOpenArray(pos, max(pos + size - 1, 0))
104104
)
105-
setFilePermissions(dest / path, parseFilePermissions(mode))
105+
setFilePermissions(
106+
dest / path,
107+
parseFilePermissions(cast[uint32](mode))
108+
)
106109
lastModifiedTimes.add (path, initTime(mtime, 0))
107110
elif typeflag == '5': # Directories
108111
createDir(dest / path)

src/zippy/tarballs_v1.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ proc openStreamImpl(
145145
kind: ekNormalFile,
146146
contents: data[pos ..< pos + fileSize],
147147
lastModified: initTime(lastModified, 0),
148-
permissions: parseFilePermissions(fileMode),
148+
permissions: parseFilePermissions(cast[uint32](fileMode)),
149149
)
150150
elif typeFlag == '5':
151151
tarball.contents[(fileNamePrefix / fileName).toUnixPath()] =

src/zippy/ziparchives.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ proc openZipArchive*(
383383
compressedSize: compressedSize,
384384
uncompressedSize: uncompressedSize,
385385
uncompressedCrc32: uncompressedCrc32,
386-
filePermissions: parseFilePermissions((externalFileAttr.uint shr 16).int)
386+
filePermissions: parseFilePermissions(externalFileAttr shr 16)
387387
)
388388
except IOError as e:
389389
result.close()

zippy.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "0.10.15"
1+
version = "0.10.16"
22
author = "Ryan Oldenburg"
33
description = "Pure Nim implementation of deflate, zlib, gzip and zip."
44
license = "MIT"

0 commit comments

Comments
 (0)