@@ -105,7 +105,7 @@ static bool findzipdirectory(FILE *f, zipdirectoryheader &hdr)
105105 uchar *search = &buf[next-1 ];
106106 for (; search >= buf; search--)
107107 {
108- if (*( uint *) search == signature)
108+ if (*reinterpret_cast < uint *>( search) == signature)
109109 {
110110 break ;
111111 }
@@ -120,14 +120,14 @@ static bool findzipdirectory(FILE *f, zipdirectoryheader &hdr)
120120 {
121121 return false ;
122122 }
123- hdr.signature = *( uint *) src; src += 4 ; // src is incremented by the size of the field (int is 4 bytes)
124- hdr.disknumber = *( ushort *) src; src += 2 ;
125- hdr.directorydisk = *( ushort *) src; src += 2 ;
126- hdr.diskentries = *( ushort *) src; src += 2 ;
127- hdr.entries = *( ushort *) src; src += 2 ;
128- hdr.size = *( uint *) src; src += 4 ;
129- hdr.offset = *( uint *) src; src += 4 ;
130- hdr.commentlength = *( ushort *) src; src += 2 ;
123+ hdr.signature = *reinterpret_cast < uint *>( src) ; src += 4 ; // src is incremented by the size of the field (int is 4 bytes)
124+ hdr.disknumber = *reinterpret_cast < ushort *>( src) ; src += 2 ;
125+ hdr.directorydisk = *reinterpret_cast < ushort *>( src) ; src += 2 ;
126+ hdr.diskentries = *reinterpret_cast < ushort *>( src) ; src += 2 ;
127+ hdr.entries = *reinterpret_cast < ushort *>( src) ; src += 2 ;
128+ hdr.size = *reinterpret_cast < uint *>( src) ; src += 4 ;
129+ hdr.offset = *reinterpret_cast < uint *>( src) ; src += 4 ;
130+ hdr.commentlength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
131131 if (hdr.signature != Zip_DirectorySignature || hdr.disknumber != hdr.directorydisk || hdr.diskentries != hdr.entries )
132132 {
133133 return false ;
@@ -153,23 +153,23 @@ static bool readzipdirectory(const char *archname, FILE *f, int entries, int off
153153 break ;
154154 }
155155 zipfileheader hdr;
156- hdr.signature = *( uint *) src; src += 4 ; // src is incremented by the size of the field (int is 4 bytes)
157- hdr.version = *( ushort *) src; src += 2 ;
158- hdr.needversion = *( ushort *) src; src += 2 ;
159- hdr.flags = *( ushort *) src; src += 2 ;
160- hdr.compression = *( ushort *) src; src += 2 ;
161- hdr.modtime = *( ushort *) src; src += 2 ;
162- hdr.moddate = *( ushort *) src; src += 2 ;
163- hdr.crc32 = *( uint *) src; src += 4 ;
164- hdr.compressedsize = *( uint *) src; src += 4 ;
165- hdr.uncompressedsize = *( uint *) src; src += 4 ;
166- hdr.namelength = *( ushort *) src; src += 2 ;
167- hdr.extralength = *( ushort *) src; src += 2 ;
168- hdr.commentlength = *( ushort *) src; src += 2 ;
169- hdr.disknumber = *( ushort *) src; src += 2 ;
170- hdr.internalattribs = *( ushort *) src; src += 2 ;
171- hdr.externalattribs = *( uint *) src; src += 4 ;
172- hdr.offset = *( uint *) src; src += 4 ;
156+ hdr.signature = *reinterpret_cast < uint *>( src) ; src += 4 ; // src is incremented by the size of the field (int is 4 bytes)
157+ hdr.version = *reinterpret_cast < ushort *>( src) ; src += 2 ;
158+ hdr.needversion = *reinterpret_cast < ushort *>( src) ; src += 2 ;
159+ hdr.flags = *reinterpret_cast < ushort *>( src) ; src += 2 ;
160+ hdr.compression = *reinterpret_cast < ushort *>( src) ; src += 2 ;
161+ hdr.modtime = *reinterpret_cast < ushort *>( src) ; src += 2 ;
162+ hdr.moddate = *reinterpret_cast < ushort *>( src) ; src += 2 ;
163+ hdr.crc32 = *reinterpret_cast < uint *>( src) ; src += 4 ;
164+ hdr.compressedsize = *reinterpret_cast < uint *>( src) ; src += 4 ;
165+ hdr.uncompressedsize = *reinterpret_cast < uint *>( src) ; src += 4 ;
166+ hdr.namelength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
167+ hdr.extralength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
168+ hdr.commentlength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
169+ hdr.disknumber = *reinterpret_cast < ushort *>( src) ; src += 2 ;
170+ hdr.internalattribs = *reinterpret_cast < ushort *>( src) ; src += 2 ;
171+ hdr.externalattribs = *reinterpret_cast < uint *>( src) ; src += 4 ;
172+ hdr.offset = *reinterpret_cast < uint *>( src) ; src += 4 ;
173173 if (hdr.signature != Zip_FileSignature)
174174 {
175175 break ;
@@ -213,17 +213,17 @@ static bool readlocalfileheader(FILE *f, ziplocalfileheader &h, uint offset)
213213 return false ;
214214 }
215215 uchar *src = buf;
216- h.signature = *( uint *) src; src += 4 ; // src is incremented by the size of the field (int is 4 bytes e.g)
217- h.version = *( ushort *) src; src += 2 ;
218- h.flags = *( ushort *) src; src += 2 ;
219- h.compression = *( ushort *) src; src += 2 ;
220- h.modtime = *( ushort *) src; src += 2 ;
221- h.moddate = *( ushort *) src; src += 2 ;
222- h.crc32 = *( uint *) src; src += 4 ;
223- h.compressedsize = *( uint *) src; src += 4 ;
224- h.uncompressedsize = *( uint *) src; src += 4 ;
225- h.namelength = *( ushort *) src; src += 2 ;
226- h.extralength = *( ushort *) src; src += 2 ;
216+ h.signature = *reinterpret_cast < uint *>( src) ; src += 4 ; // src is incremented by the size of the field (int is 4 bytes e.g)
217+ h.version = *reinterpret_cast < ushort *>( src) ; src += 2 ;
218+ h.flags = *reinterpret_cast < ushort *>( src) ; src += 2 ;
219+ h.compression = *reinterpret_cast < ushort *>( src) ; src += 2 ;
220+ h.modtime = *reinterpret_cast < ushort *>( src) ; src += 2 ;
221+ h.moddate = *reinterpret_cast < ushort *>( src) ; src += 2 ;
222+ h.crc32 = *reinterpret_cast < uint *>( src) ; src += 4 ;
223+ h.compressedsize = *reinterpret_cast < uint *>( src) ; src += 4 ;
224+ h.uncompressedsize = *reinterpret_cast < uint *>( src) ; src += 4 ;
225+ h.namelength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
226+ h.extralength = *reinterpret_cast < ushort *>( src) ; src += 2 ;
227227 if (h.signature != Zip_LocalFileSignature)
228228 {
229229 return false ;
@@ -369,7 +369,7 @@ bool removezip(const char *name)
369369 string pname;
370370 copystring (pname, name);
371371 path (pname);
372- int plen = ( int ) std::strlen (pname);
372+ int plen = static_cast < int >( std::strlen (pname) );
373373 if (plen < 4 || !std::strchr (&pname[plen-4 ], ' .' ))
374374 {
375375 concatstring (pname, " .zip" );
@@ -414,7 +414,7 @@ class zipstream final : public stream
414414 {
415415 if (!zfile.avail_in )
416416 {
417- zfile.next_in = ( Bytef *) buf;
417+ zfile.next_in = static_cast < Bytef *>( buf) ;
418418 }
419419 size = std::min (size, static_cast <uint>(&buf[Buffer_Size] - &zfile.next_in [zfile.avail_in ]));
420420 if (arch->owner != this )
@@ -642,7 +642,7 @@ class zipstream final : public stream
642642 }
643643 return n;
644644 }
645- zfile.next_out = ( Bytef *) buf;
645+ zfile.next_out = static_cast < Bytef *>( buf) ;
646646 zfile.avail_out = len;
647647 while (zfile.avail_out > 0 )
648648 {
0 commit comments