dso/dso_win32.c: fix compiler warning.
authorAndy Polyakov <appro@openssl.org>
Tue, 18 Dec 2012 18:19:54 +0000 (18:19 +0000)
committerAndy Polyakov <appro@openssl.org>
Sat, 1 Feb 2014 22:32:19 +0000 (23:32 +0100)
(cherry picked from commit 0a2d5003df1a9ecf801ac3b4a5cb7dda85449315)

crypto/dso/dso_win32.c

index 6fb6c54181c1cabb3663810aea3a47f6ccdf4a0f..1cab3142c6167a3478ee7f8aba6b59b11bcc5388 100644 (file)
@@ -689,7 +689,6 @@ static int win32_pathbyaddr(void *addr,char *path,int sz)
        CREATETOOLHELP32SNAPSHOT create_snap;
        CLOSETOOLHELP32SNAPSHOT  close_snap;
        MODULE32 module_first, module_next;
-       int len;
  
        if (addr == NULL)
                {
@@ -752,21 +751,25 @@ static int win32_pathbyaddr(void *addr,char *path,int sz)
                        return WideCharToMultiByte(CP_ACP,0,me32.szExePath,-1,
                                                        path,sz,NULL,NULL);
 # else
-                       len = (int)wcslen(me32.szExePath);
+                       {
+                       int i,len = (int)wcslen(me32.szExePath);
                        if (sz <= 0) return len+1;
                        if (len >= sz) len=sz-1;
                        for(i=0;i<len;i++)
                                path[i] = (char)me32.szExePath[i];
                        path[len++] = 0;
                        return len;
+                       }
 # endif
 #else
-                       len = (int)strlen(me32.szExePath);
+                       {
+                       int len = (int)strlen(me32.szExePath);
                        if (sz <= 0) return len+1;
                        if (len >= sz) len=sz-1;
                        memcpy(path,me32.szExePath,len);
                        path[len++] = 0;
                        return len;
+                       }
 #endif
                        } 
                } while((*module_next)(hModuleSnap, &me32));