Browse Source

HPCC-11846 Fix various clang warnings

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 years ago
parent
commit
cf16c4d138

+ 1 - 1
cmake_modules/commonSetup.cmake

@@ -233,7 +233,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     if (CMAKE_COMPILER_IS_CLANGXX)
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses -Werror=bool-conversions -Werror=return-type -Werror=comment")
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Werror=bitwise-op-parentheses -Werror=tautological-compare")
-      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Wno-switch-enum -Wno-format-zero-length")
+      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Wno-switch-enum -Wno-format-zero-length -Wno-switch")
     endif()
     # All of these are defined in platform.h too, but need to be defned before any system header is included
     ADD_DEFINITIONS (-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64=1 -D__USE_FILE_OFFSET64=1)

+ 2 - 0
common/remote/rmtsmtp.cpp

@@ -268,10 +268,12 @@ private:
             ++finger;
         }
         if(charcount == 0)
+        {
             if(subcount == 0)
                 fail("empty domain");
             else
                 fail("illegal . at end of domain");
+        }
         ++subcount;
         if(subcount < 2)
             fail("domain has only 1 subdomain");

+ 2 - 1
common/workunit/workunit.cpp

@@ -9667,7 +9667,8 @@ extern WORKUNIT_API void extractToken(const char *token, const char *wuid, IStri
             if(finger1)
             {
                 user.setLen(finger, (size32_t)(finger1-finger));
-                password.setLen(++finger1, (size32_t)(wu.str() + wu.length() - finger1));
+                finger1++;
+                password.setLen(finger1, (size32_t)(wu.str() + wu.length() - finger1));
                 return;
             }
         }

+ 3 - 1
dali/base/dadfs.cpp

@@ -2387,7 +2387,7 @@ class CDistributedFileIterator: public CDistributedFileIteratorBase<IDistributed
     bool set()
     {
         while (isValid()) {
-            cur.setown(parent->lookup(queryName(),udesc,false,NULL));
+            cur.setown(parent->lookup(queryName(),udesc));
             if (cur)
                 return true;
             index++;
@@ -9377,10 +9377,12 @@ public:
                 const char *name = grp.queryProp("@name");
                 bool iscluster = NotFound != clusternames.find(name);
                 if (iscluster!=grp.getPropBool("@cluster"))
+                {
                     if (iscluster)
                         grp.setPropBool("@cluster", true);
                     else
                         grp.removeProp("@cluster");
+                }
             }
         }
     }

+ 2 - 0
dali/daliadmin/daliadmin.cpp

@@ -1168,10 +1168,12 @@ static void checksuperfile(const char *lfn,bool fix=false)
             if (pn>subnum) {
                 ERRLOG("SuperFile %s: corrupt, subfile file part %d spurious",lname.get(),pn);
                 if (fixstate==0)
+                {
                     if (fix&&doFix())
                         fixstate = 1;
                     else
                         fixstate = 2;
+                }
                 if (fixstate==1) {
                     root->removeTree(sub);
                     fixed = true;

+ 2 - 0
dali/sasha/sacmd.cpp

@@ -234,10 +234,12 @@ public:
     void addDT(CDateTime &dt)
     {
         if ((numdts+16)/16!=(numdts+15)/16)
+        {
             if (dts)
                 dts = (CDateTime *)realloc(dts,(numdts+16)*sizeof(CDateTime));
             else
                 dts = (CDateTime *)malloc((numdts+16)*sizeof(CDateTime));
+        }
         memset(dts+numdts,0,sizeof(CDateTime));
         dts[numdts++].set(dt);
     }

+ 8 - 2
deployment/deployutils/deployutils.cpp

@@ -2916,7 +2916,9 @@ IPropertyTree* getNewRange(const IPropertyTree* pEnv, const char* prefix, const
    end.getNetAddress(sizeof(e),&e);
    if( s > e)
    {
-     s^=e^=s^=e;
+     s^=e;
+     e^=s;
+     s^=e;
      const char* temp = startIP;
      startIP = endIP;
      endIP= temp;
@@ -3311,7 +3313,11 @@ void formIPList(const char* ip, StringArray& formattedIpList)
                      unsigned startAddr = atoi(commIPPart.item(3));
                      comip.clear().append(commIPPart.item(0)).append(".").append(commIPPart.item(1)).append(".").append(commIPPart.item(2)).append(".");
                      if( startAddr > endAddr)
-                        startAddr^=endAddr^=startAddr^=endAddr;
+                     {
+                       startAddr^=endAddr;
+                       endAddr^=startAddr;
+                       startAddr^=endAddr;
+                     }
                      
                      while(startAddr <= endAddr)
                      {

+ 4 - 0
esp/services/ws_topology/ws_topologyService.cpp

@@ -1432,24 +1432,28 @@ bool CWsTopologyEx::onTpGetComponentFile(IEspContext &context,
             {
                 const unsigned int len = strlen(compType);
                 if (len>4)
+                {
                     if (!strnicmp(compType, "Roxie", 5))
                         compType = "RoxieCluster", fileName = "RoxieTopology.xml", bCluster = true;
                     else if (!strnicmp(compType, "Thor", 4))
                         compType = "ThorCluster", fileName = "thor.xml", bCluster = true;
                     else if (!strnicmp(compType, "Hole", 4))
                         compType = "HoleCluster", fileName = "edata.ini", bCluster = true;
+                }
             }
         }
         else
         {
             fileName = "";
             if (strlen(compType)>4)
+            {
                 if (!strnicmp(compType, "Roxie", 5))
                     compType = "RoxieCluster", bCluster = true;
                 else if (!strnicmp(compType, "Thor", 4))
                     compType = "ThorCluster", bCluster = true;
                 else if (!strnicmp(compType, "Hole", 4))
                     compType = "HoleCluster", bCluster = true;
+            }
         }
 
         if (!fileName)

+ 2 - 0
esp/smc/SMCLib/TpWrapper.cpp

@@ -1174,12 +1174,14 @@ void CTpWrapper::getClusterProcessList(const char* ClusterType, IArrayOf<IEspTpC
                     unsigned int clusterTypeLen = strlen(ClusterType);
                     const char* childType = NULL;
                     if (clusterTypeLen > 4)
+                    {
                         if (!strnicmp(ClusterType, "roxie", 4))
                             childType = "RoxieServerProcess[1]";
                         else if (!strnicmp(ClusterType, "thor", 4))
                             childType = "ThorMasterProcess";
                         else
                             childType = "HoleControlProcess";
+                    }
                     if (childType)
                     {
                         IPropertyTree* pChild = cluster.queryPropTree(childType);

+ 1 - 1
roxie/roxiemem/roxiemem.cpp

@@ -2241,7 +2241,7 @@ class BufferedRowCallbackManager
         : Thread("ReleaseBufferThread"), owner(_owner), abort(false)
         {
             args.critical = false;
-            args.result = NULL;
+            args.result = false;
         }
 
         virtual int run()

+ 4 - 0
system/jhtree/keydiff.cpp

@@ -1341,6 +1341,7 @@ public:
         }
         verifyCRCs();
         if(newOutput->queryCount())
+        {
             if(tlkGen)
             {
                 bool wait = tlkGen->addNode(newprev.getNodeInfo(newOutput->queryCount()-1));
@@ -1352,6 +1353,7 @@ public:
                 Owned<CNodeInfo> ni(newprev.getNodeInfo(newOutput->queryCount()-1));
                 tlkSender->send(*ni);
             }
+        }
     }
 
     virtual void getHeaderVersionInfo(unsigned short & versionMajor, unsigned short & versionMinor, unsigned short & minPatchVersionMajor, unsigned short & minPatchVersionMinor)
@@ -1399,10 +1401,12 @@ private:
         if(tlkGen)
         {
             if(!newTLK.get())
+            {
                 if(keydiff.queryHeader().hasTLKInfo())
                     newTLK.set(keydiff.queryHeader().queryNewTLK());
                 else
                     throw MakeStringException(0, "Trying to generate TLK using filename from patch, but patch does not include TLK header information");
+            }
         }
         else if(keydiff.queryHeader().hasTLKInfo() && !ignoreTLK)
             throw MakeStringException(0, "Patch includes TLK header information, but TLK generation not enabled --- aborting, invoke with warning suppressed to go ahead");

+ 40 - 0
system/jlib/jlog.cpp

@@ -126,10 +126,12 @@ StringBuffer & LogMsg::toStringPlain(StringBuffer & out, unsigned fields) const
     if(fields & MSGFIELD_thread)
         out.appendf("tid=%d ",sysInfo.queryThreadID());
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             out.append("sid=unknown ");
         else
             out.appendf("sid=%"I64F"u ", sysInfo.querySessionID());
+    }
     if(fields & MSGFIELD_node)
     {
         size32_t len = out.length();
@@ -137,15 +139,19 @@ StringBuffer & LogMsg::toStringPlain(StringBuffer & out, unsigned fields) const
         out.append(" ");
     }
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             out.append("job=unknown ");
         else
             out.appendf("job=%"I64F"u ", jobInfo.queryJobID());
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             out.append("usr=unknown ");
         else
             out.appendf("usr=%"I64F"u ", jobInfo.queryUserID());
+    }
     if(fields & MSGFIELD_component)
         out.appendf("cmp=%u ", component);
     if (fields & MSGFIELD_quote)
@@ -206,10 +212,12 @@ StringBuffer & LogMsg::toStringXML(StringBuffer & out, unsigned fields) const
     if(fields & MSGFIELD_thread)
         out.append("TID=\"").append(sysInfo.queryThreadID()).append("\" ");
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             out.append("SessionID=\"unknown\" ");
         else
             out.append("SessionID=\"").append(sysInfo.querySessionID()).append("\" ");
+    }
     if(fields & MSGFIELD_node)
     {
         out.append("Node=\"");
@@ -220,15 +228,19 @@ StringBuffer & LogMsg::toStringXML(StringBuffer & out, unsigned fields) const
     if(fields & MSGFIELD_allSysInfo) out.append("\n     ");
 #endif
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             out.append("JobID=\"unknown\" ");
         else
             out.append("JobID=\"").append(jobInfo.queryJobID()).append("\" ");
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             out.append("UserID=\"unknown\" ");
         else
             out.append("UserID=\"").append(jobInfo.queryUserID()).append("\" ");
+    }
 #ifdef LOG_MSG_NEWLINE
     if(fields & MSGFIELD_allJobInfo) out.append("\n     ");
 #endif
@@ -280,10 +292,12 @@ StringBuffer & LogMsg::toStringTable(StringBuffer & out, unsigned fields) const
     if(fields & MSGFIELD_thread)
         out.appendf("%5d ",sysInfo.queryThreadID());
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             out.append("      unknown        ");
         else
             out.appendf("%20"I64F"u ", sysInfo.querySessionID());
+    }
     if(fields & MSGFIELD_node)
     {
         size32_t len = out.length();
@@ -291,15 +305,19 @@ StringBuffer & LogMsg::toStringTable(StringBuffer & out, unsigned fields) const
         out.appendN(20 + len - out.length(), ' ');
     }
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             out.append("unknown ");
         else
             out.appendf("%7"I64F"u ", jobInfo.queryJobID());
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             out.append("unknown ");
         else
             out.appendf("%7"I64F"u ", jobInfo.queryUserID());
+    }
     if(fields & MSGFIELD_component)
         out.appendf("%6u ", component);
     if (fields & MSGFIELD_quote)
@@ -388,10 +406,12 @@ void LogMsg::fprintPlain(FILE * handle, unsigned fields) const
     if(fields & MSGFIELD_thread)
         fprintf(handle, "tid=%d ",sysInfo.queryThreadID());
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             fprintf(handle, "sid=unknown ");
         else
             fprintf(handle, "sid=%"I64F"u ", sysInfo.querySessionID());
+    }
     if(fields & MSGFIELD_node)
     {
         StringBuffer buff;
@@ -399,15 +419,19 @@ void LogMsg::fprintPlain(FILE * handle, unsigned fields) const
         fprintf(handle, "%s ", buff.str());
     }
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             fprintf(handle, "job=unknown ");
         else
             fprintf(handle, "job=%"I64F"u ", jobInfo.queryJobID());
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             fprintf(handle, "usr=unknown ");
         else
             fprintf(handle, "usr=%"I64F"u ", jobInfo.queryUserID());
+    }
     if(fields & MSGFIELD_component)
         fprintf(handle, "cmp=%u ", component);
     
@@ -463,10 +487,12 @@ void LogMsg::fprintXML(FILE * handle, unsigned fields) const
     if(fields & MSGFIELD_thread)
         fprintf(handle, "TID=\"%d\" ", sysInfo.queryThreadID());
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             fprintf(handle, "SessionID=\"unknown\" ");
         else
             fprintf(handle, "SessionID=\"%"I64F"u\" ", sysInfo.querySessionID());
+    }
     if(fields & MSGFIELD_node)
     {
         StringBuffer buff;
@@ -477,15 +503,19 @@ void LogMsg::fprintXML(FILE * handle, unsigned fields) const
     if(fields & MSGFIELD_allSysInfo) fprintf(handle, "\n     ");
 #endif
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             fprintf(handle, "JobID=\"unknown\" ");
         else
             fprintf(handle, "JobID=\"%"I64F"u\" ", jobInfo.queryJobID());
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             fprintf(handle, "UserID=\"unknown\" ");
         else
             fprintf(handle, "UserID=\"%"I64F"u\" ", jobInfo.queryUserID());
+    }
     if(fields & MSGFIELD_component)
         fprintf(handle, "Component=\"%6u\" ", component);
 #ifdef LOG_MSG_NEWLINE
@@ -536,10 +566,12 @@ void LogMsg::fprintTable(FILE * handle, unsigned fields) const
     if(fields & MSGFIELD_thread)
         fprintf(handle, "%5d ",sysInfo.queryThreadID());
     if(fields & MSGFIELD_session)
+    {
         if(sysInfo.querySessionID() == UnknownSession)
             fprintf(handle, "       unknown       ");
         else
             fprintf(handle, "%20"I64F"u ", sysInfo.querySessionID());
+    }
     if(fields & MSGFIELD_node)
     {
         StringBuffer buff;
@@ -548,15 +580,19 @@ void LogMsg::fprintTable(FILE * handle, unsigned fields) const
         fprintf(handle, "%s%s", buff.str(), (buff.length()<=20) ? twenty_spaces+buff.length() : "");
     }
     if(fields & MSGFIELD_job)
+    {
         if(jobInfo.queryJobID() == UnknownJob)
             fprintf(handle, "unknown ");
         else
             fprintf(handle, "%7"I64F"u ", jobInfo.queryJobID());
+    }
     if(fields & MSGFIELD_user)
+    {
         if(jobInfo.queryUserID() == UnknownUser)
             fprintf(handle, "unknown ");
         else
             fprintf(handle, "%7"I64F"u ", jobInfo.queryUserID());
+    }
     if(fields & MSGFIELD_component)
         fprintf(handle, "%6u ", component);
     const char * quote = (fields & MSGFIELD_quote) ? "\"" : "";
@@ -1918,10 +1954,12 @@ ILogMsgFilter * queryPassNoneLogMsgFilter()
 ILogMsgFilter * getCategoryLogMsgFilter(unsigned audiences, unsigned classes, LogMsgDetail maxDetail, bool local)
 {
     if((audiences==MSGAUD_all) && (classes==MSGCLS_all) && (maxDetail==TopDetail))
+    {
         if(local)
             return LINK(thePassLocalFilter);
         else
             return LINK(thePassAllFilter);
+    }
     return new CategoryLogMsgFilter(audiences, classes, maxDetail, local);
 }
 
@@ -2073,10 +2111,12 @@ ILogMsgHandler * getLogMsgHandlerFromPTree(IPropertyTree * tree)
     unsigned fields = MSGFIELD_all;
     char const * fstr = tree->queryProp("@fields");
     if(fstr)
+    {
         if(isdigit(fstr[0]))
             fields = atoi(fstr);
         else
             fields = LogMsgFieldsFromAbbrevs(fstr);
+    }
     if(strcmp(type.str(), "stderr")==0)
         return getHandleLogMsgHandler(stderr, fields, tree->hasProp("@writeXML"));
     else if(strcmp(type.str(), "file")==0)

+ 2 - 0
system/jlib/jlog.hpp

@@ -322,10 +322,12 @@ inline unsigned LogMsgFieldsFromAbbrevs(char const * abbrevs)
         if(strlen(abbrevs)<3) break;
         unsigned field = LogMsgFieldFromAbbrev(abbrevs);
         if(field)
+        {
             if(negate)
                 fields &= ~field;
             else
                 fields |= field;
+        }
         switch(abbrevs[3])
         {
         case '+':

+ 2 - 0
system/jlib/jlzw.cpp

@@ -2004,10 +2004,12 @@ public:
             compblklen = 0;
             if (trailer.recordSize==0) {
                 if (!compressor)
+                {
                     if (fast)
                         compressor.setown(createFastLZCompressor());
                     else
                         compressor.setown(createLZWCompressor(true));
+                }
                 compressor->open(compblkptr, trailer.blockSize);
             }
         }

+ 1 - 1
system/jlib/jmemleak.h

@@ -17,7 +17,7 @@
 
 
 #ifndef JMEMLEAK_H
-#define JMEMLEAH_H
+#define JMEMLEAK_H
 
 
 #if (defined WIN32) || (defined _WIN32) || (defined __WIN32__) || (defined WIN64) || (defined _WIN64) || (defined __WIN64__)

+ 1 - 1
system/jlib/jptree.cpp

@@ -3270,7 +3270,7 @@ bool PTIdMatchIterator::match()
 
 ////////////////////////////
 
-SingleIdIterator::SingleIdIterator(const PTree &_tree, unsigned pos, unsigned _many) : tree(_tree), many(_many), start(pos-1), whichNext(start), count(0), current(NULL)
+SingleIdIterator::SingleIdIterator(const PTree &_tree, unsigned pos, unsigned _many) : tree(_tree), many(_many), start(pos-1), whichNext(pos-1), count(0), current(NULL)
 {
     tree.Link();
 }

+ 3 - 1
system/jlib/jsocket.cpp

@@ -2648,11 +2648,13 @@ const char * GetCachedHostName()
 IpAddress & queryLocalIP()
 {
     CriticalBlock c(hostnamesect);
-    if (localhostip.isNull()) 
+    if (localhostip.isNull())
+    {
         if (IP6preferred)
             localhostip.ipset("::1");   //IPv6 
         else
             localhostip.ipset("127.0.0.1"); //IPv4
+    }
     return localhostip;
 }
 

+ 3 - 1
system/jlib/jsort.cpp

@@ -600,11 +600,13 @@ static inline void swapind(VECTOR a, VECTOR b)  { void ** t = *a;  *a = *b; *b =
 static inline int cmpicindstable(VECTOR a, VECTOR b, const ICompare & compare)
 {
     int ret = compare.docompare(**a,**b);
-    if (ret==0) 
+    if (ret==0)
+    {
         if (*a>*b)
             ret = 1;
         else if (*a<*b)
             ret = -1;
+    }
     return ret;
 }
 

+ 1 - 1
system/jlib/jutil.cpp

@@ -1683,7 +1683,7 @@ void doStackProbe()
 {
     byte local;
     const volatile byte * x = (const byte *)&local;
-    x[-4096];
+    byte forceload = x[-4096];
 }
 
 #ifdef _WIN32

+ 10 - 2
system/security/zcrypt/unzip.c

@@ -608,10 +608,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
 
     /* we check the magic */
     if (err==UNZ_OK)
+    {
         if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
             err=UNZ_ERRNO;
         else if (uMagic!=0x02014b50)
             err=UNZ_BADZIPFILE;
+    }
 
     if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
         err=UNZ_ERRNO;
@@ -688,10 +690,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
             uSizeRead = extraFieldBufferSize;
 
         if (lSeek!=0)
+        {
             if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
                 lSeek=0;
             else
                 err=UNZ_ERRNO;
+        }
         if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
             if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
                 err=UNZ_ERRNO;
@@ -713,10 +717,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
             uSizeRead = commentBufferSize;
 
         if (lSeek!=0)
+        {
             if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
                 lSeek=0;
             else
                 err=UNZ_ERRNO;
+        }
         if ((file_info.size_file_comment>0) && (commentBufferSize>0))
             if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
                 err=UNZ_ERRNO;
@@ -977,10 +983,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
 
 
     if (err==UNZ_OK)
+    {
         if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
             err=UNZ_ERRNO;
         else if (uMagic!=0x04034b50)
             err=UNZ_BADZIPFILE;
+    }
 
     if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
         err=UNZ_ERRNO;
@@ -1167,7 +1175,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
     if (password != NULL)
     {
         int i;
-        s->pcrc_32_tab = get_crc_table();
+        s->pcrc_32_tab = (const unsigned long*)get_crc_table();
         init_keys(password,s->keys,s->pcrc_32_tab);
         if (ZSEEK(s->z_filefunc, s->filestream,
                   s->pfile_in_zip_read->pos_in_zipfile +
@@ -1239,7 +1247,7 @@ extern int ZEXPORT unzReadCurrentFile  (file, buf, len)
         return UNZ_PARAMERROR;
 
 
-    if ((pfile_in_zip_read_info->read_buffer == NULL))
+    if (pfile_in_zip_read_info->read_buffer == NULL)
         return UNZ_END_OF_LIST_OF_FILE;
     if (len==0)
         return 0;

+ 3 - 3
system/security/zcrypt/zip.c

@@ -759,9 +759,9 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
     zi->ci.flag = 0;
     if ((level==8) || (level==9))
       zi->ci.flag |= 2;
-    if ((level==2))
+    if (level==2)
       zi->ci.flag |= 4;
-    if ((level==1))
+    if (level==1)
       zi->ci.flag |= 6;
     if (password != NULL)
       zi->ci.flag |= 1;
@@ -881,7 +881,7 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
         unsigned char bufHead[RAND_HEAD_LEN];
         unsigned int sizeHead;
         zi->ci.encrypt = 1;
-        zi->ci.pcrc_32_tab = get_crc_table();
+        zi->ci.pcrc_32_tab = (const unsigned long*)get_crc_table();
         /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
 
         sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);