[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nsis-commits
Subject:    [NSIS-commits] SF.net SVN: nsis:[6603] NSIS/trunk
From:       anders_k () users ! sourceforge ! net
Date:       2015-09-06 20:15:56
Message-ID: E1ZYgM4-0008Ik-7C () sfs-ml-3 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 6603
          http://sourceforge.net/p/nsis/code/6603
Author:   anders_k
Date:     2015-09-06 20:15:56 +0000 (Sun, 06 Sep 2015)
Log Message:
-----------
CResourceDirectoryEntry::GetName() does not need to duplicate the string

Modified Paths:
--------------
    NSIS/trunk/Contrib/ExDLL/exdll.c
    NSIS/trunk/Source/ResourceEditor.cpp

Modified: NSIS/trunk/Contrib/ExDLL/exdll.c
===================================================================
--- NSIS/trunk/Contrib/ExDLL/exdll.c	2015-09-06 20:03:10 UTC (rev 6602)
+++ NSIS/trunk/Contrib/ExDLL/exdll.c	2015-09-06 20:15:56 UTC (rev 6603)
@@ -24,7 +24,7 @@
 
   // do your stuff here
   {
-    LPTSTR msgbuf = GlobalAlloc(GPTR, (3 + string_size + 1) * sizeof(*msgbuf));
+    LPTSTR msgbuf = (LPTSTR) GlobalAlloc(GPTR, (3 + string_size + 1) * \
sizeof(*msgbuf));  if (msgbuf)
     {
       wsprintf(msgbuf, TEXT("$0=%s"), getuservariable(INST_0));

Modified: NSIS/trunk/Source/ResourceEditor.cpp
===================================================================
--- NSIS/trunk/Source/ResourceEditor.cpp	2015-09-06 20:03:10 UTC (rev 6602)
+++ NSIS/trunk/Source/ResourceEditor.cpp	2015-09-06 20:15:56 UTC (rev 6603)
@@ -719,8 +719,6 @@
 
     seeker += RALIGN(iLen * sizeof(WINWCHAR) + sizeof(WORD), 4);
 
-    free(szName);
-
     qStrings.pop();
   }
 
@@ -823,15 +821,11 @@
     for (i = 0; i < m_rdDir.NumberOfNamedEntries; i++) {
       WINWCHAR* szName = m_vEntries[i]->GetName();
       int cmp = WinWStrCmp(szName, szEntName);
-      free(szName);
-      if (cmp == 0) {
-        free(szEntName);
+      if (cmp == 0)
         return false;
-      }
       if (cmp > 0)
         break;
     }
-    free(szEntName);
     m_rdDir.NumberOfNamedEntries++;
   }
   else {
@@ -874,8 +868,6 @@
 
     WINWCHAR* szEntName = m_vEntries[i]->GetName();
     int cmp = WinWStrCmp(szName, szEntName);
-    free(szEntName);
-
     if (!cmp)
       return i;
   }
@@ -963,7 +955,7 @@
 }
 
 CResourceDirectoryEntry::~CResourceDirectoryEntry() {
-  if (m_szName && m_bHasName)
+  if (m_bHasName)
     free(m_szName);
 }
 
@@ -977,7 +969,7 @@
 
 // Don't forget to free the memory used by the string after usage!
 WINWCHAR* CResourceDirectoryEntry::GetName() {
-  return m_bHasName ? WinWStrDupFromWinWStr(m_szName) : 0;
+  return m_bHasName ? m_szName : 0;
 }
 
 int CResourceDirectoryEntry::GetNameLength() {

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
NSIS-commits mailing list
NSIS-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nsis-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic