diff --git a/Versions/build.txt b/Versions/build.txt
index 7d802a3e7..59c112266 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-1002
+1004
diff --git a/language/np3_af_za/np3_af_za.vcxproj b/language/np3_af_za/np3_af_za.vcxproj
index 01f0ee478..217e49c54 100644
--- a/language/np3_af_za/np3_af_za.vcxproj
+++ b/language/np3_af_za/np3_af_za.vcxproj
@@ -73,25 +73,25 @@
true
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
true
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
diff --git a/language/np3_de_de/np3_de_de.vcxproj b/language/np3_de_de/np3_de_de.vcxproj
index d802c2e29..212172fca 100644
--- a/language/np3_de_de/np3_de_de.vcxproj
+++ b/language/np3_de_de/np3_de_de.vcxproj
@@ -72,25 +72,25 @@
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
diff --git a/language/np3_en_uk/np3_en_uk.vcxproj b/language/np3_en_uk/np3_en_uk.vcxproj
index 09e9614c7..f012b4169 100644
--- a/language/np3_en_uk/np3_en_uk.vcxproj
+++ b/language/np3_en_uk/np3_en_uk.vcxproj
@@ -72,25 +72,25 @@
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
diff --git a/language/np3_en_us/np3_en_us.vcxproj b/language/np3_en_us/np3_en_us.vcxproj
index 6542cc329..98ed04e74 100644
--- a/language/np3_en_us/np3_en_us.vcxproj
+++ b/language/np3_en_us/np3_en_us.vcxproj
@@ -72,25 +72,25 @@
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
diff --git a/language/np3_es_es/np3_es_es.vcxproj b/language/np3_es_es/np3_es_es.vcxproj
index 6367ff10e..567493952 100644
--- a/language/np3_es_es/np3_es_es.vcxproj
+++ b/language/np3_es_es/np3_es_es.vcxproj
@@ -73,25 +73,25 @@
true
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
true
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
diff --git a/language/np3_fr_fr/np3_fr_fr.vcxproj b/language/np3_fr_fr/np3_fr_fr.vcxproj
index b6911b7c6..c53b8b580 100644
--- a/language/np3_fr_fr/np3_fr_fr.vcxproj
+++ b/language/np3_fr_fr/np3_fr_fr.vcxproj
@@ -72,25 +72,25 @@
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
diff --git a/language/np3_nl_nl/np3_nl_nl.vcxproj b/language/np3_nl_nl/np3_nl_nl.vcxproj
index 4ed617fee..b41a9a1ce 100644
--- a/language/np3_nl_nl/np3_nl_nl.vcxproj
+++ b/language/np3_nl_nl/np3_nl_nl.vcxproj
@@ -72,25 +72,25 @@
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
true
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
false
- ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\
+ ..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\lng\obj\
..\..\Bin\$(Configuration)_$(PlatformShortName)_$(PlatformToolset)\obj\$(ProjectName)\
false
diff --git a/np3portableapp/build_np3portableapp.cmd b/np3portableapp/build_np3portableapp.cmd
index fb7efc1e0..d6218050b 100644
--- a/np3portableapp/build_np3portableapp.cmd
+++ b/np3portableapp/build_np3portableapp.cmd
@@ -78,10 +78,10 @@ copy "%NP3_DISTRIB_DIR%\Notepad3.ini" "%NP3_PORTAPP_DIR%\App\DefaultData\setting
copy "%NP3_DISTRIB_DIR%\minipath.ini" "%NP3_PORTAPP_DIR%\App\DefaultData\settings\minipath.ini" /Y /V
for /d %%d in (%NP3_LANGUAGE_SET%) do (
- mkdir "%NP3_PORTAPP_DIR%\App\Notepad3\x86\%%d"
- copy /B "%NP3_WIN32_DIR%\%%d\*" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\%%d\" /Y /V
+ mkdir "%NP3_PORTAPP_DIR%\App\Notepad3\x86\lng\%%d"
+ copy /B "%NP3_WIN32_DIR%\lng\%%d\*" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\lng\%%d\" /Y /V
)
-copy /B "%NP3_WIN32_DIR%\np3lng.dll" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\" /Y /V
+copy /B "%NP3_WIN32_DIR%\lng\np3lng.dll" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\lng\" /Y /V
copy /B "%NP3_WIN32_DIR%\Notepad3.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\" /Y /V
copy /B "%NP3_WIN32_DIR%\minipath.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\" /Y /V
@@ -91,12 +91,11 @@ copy /B "%NP3_WIN32_DIR%\ced.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x86\" /Y /V
::copy /B "%NP3_DISTRIB_DIR%\Update\wyUpdate\86\client.wyc" /B "%NP3_PORTAPP_DIR%\App\Notepad3\" /Y /V
::copy /B "%NP3_DISTRIB_DIR%\Update\wyUpdate\86\wyUpdate.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\" /Y /V
-
for /d %%d in (%NP3_LANGUAGE_SET%) do (
- mkdir "%NP3_PORTAPP_DIR%\App\Notepad3\x64\%%d"
- copy /B "%NP3_X64_DIR%\%%d\*" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\%%d\" /Y /V
+ mkdir "%NP3_PORTAPP_DIR%\App\Notepad3\x64\lng\%%d"
+ copy /B "%NP3_X64_DIR%\lng\%%d\*" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\lng\%%d\" /Y /V
)
-copy /B "%NP3_X64_DIR%\np3lng.dll" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\" /Y /V
+copy /B "%NP3_X64_DIR%\lng\np3lng.dll" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\lng\" /Y /V
copy /B "%NP3_X64_DIR%\Notepad3.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\" /Y /V
copy /B "%NP3_X64_DIR%\minipath.exe" /B "%NP3_PORTAPP_DIR%\App\Notepad3\x64\" /Y /V
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index dbab4efb1..0b61f888f 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 X_MUI
diff --git a/src/Edit.c b/src/Edit.c
index f454170c2..932ca6e84 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -3667,8 +3667,8 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
return;
}
- const DocPos iSelStart = SciCall_GetSelectionStart();
- const DocPos iSelEnd = SciCall_GetSelectionEnd();
+ DocPos const iSelStart = SciCall_GetSelectionStart();
+ DocPos const iSelEnd = SciCall_GetSelectionEnd();
DocLn iStartLine = 0;
DocLn iEndLine = 0;
@@ -3684,8 +3684,6 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
if ((iEndLine - iStartLine) <= 1) { return; }
- const DocPos iEmptyLnLen = (SciCall_GetEOLMode() == SC_EOL_CRLF ? 2 : 1);
-
DocPos iMaxLineLen = 0;
for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) {
DocPos iLnLen = SciCall_GetLine(iLine, NULL);
@@ -3701,31 +3699,34 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
for (DocLn iCurLine = iStartLine; iCurLine < iEndLine; ++iCurLine)
{
SciCall_GetLine(iCurLine, pCurrentLine);
- const DocPos iCurLnLen = Sci_GetNetLineLength(iCurLine);
+ DocPos const iCurLnLen = Sci_GetNetLineLength(iCurLine);
pCurrentLine[iCurLnLen] = '\0';
-
- if (bRemoveEmptyLines || (iCurLnLen > iEmptyLnLen)) {
+ if (bRemoveEmptyLines || (iCurLnLen > 0))
+ {
+ DocLn iPrevLine = iCurLine;
for (DocLn iCompareLine = iCurLine + 1; iCompareLine <= iEndLine; ++iCompareLine)
{
- const DocPos iCmpLnLen = Sci_GetNetLineLength(iCompareLine);
+ DocPos const iCmpLnLen = Sci_GetNetLineLength(iCompareLine);
- if (bRemoveEmptyLines || (iCmpLnLen > iEmptyLnLen)) {
+ if (bRemoveEmptyLines || (iCmpLnLen > 0)) {
- const DocPos iBegCmpLine = SciCall_PositionFromLine(iCompareLine);
- const char* pCompareLine = SciCall_GetRangePointer(iBegCmpLine, iCmpLnLen + 1);
+ DocPos const iBegCmpLine = SciCall_PositionFromLine(iCompareLine);
+ char* const pCompareLine = SciCall_GetRangePointer(iBegCmpLine, iCmpLnLen + 1);
- if (iCurLnLen == iCmpLnLen) {
- if (StringCchCompareNA(pCurrentLine, iCurLnLen, pCompareLine, iCmpLnLen) == 0) {
- const DocPos iLenToDel = (iCompareLine != Sci_GetLastDocLine() ? SciCall_GetLine(iCompareLine, NULL) : iCmpLnLen);
- SciCall_SetTargetRange(iBegCmpLine, iBegCmpLine + iLenToDel);
+ if (iCurLnLen == iCmpLnLen)
+ {
+ if (StringCchCompareNA(pCurrentLine, iCurLnLen, pCompareLine, iCmpLnLen) == 0)
+ {
+ SciCall_SetTargetRange(SciCall_GetLineEndPosition(iPrevLine), SciCall_GetLineEndPosition(iCompareLine));
SciCall_ReplaceTarget(0, "");
--iCompareLine; // proactive preventing progress to avoid comparison line skip
--iEndLine;
}
}
} // empty
+ iPrevLine = iCompareLine;
}
} // empty
}
diff --git a/src/Notepad3.c b/src/Notepad3.c
index 82cef699f..1ff572767 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -890,7 +890,7 @@ static HMODULE __fastcall _LoadLanguageResources(LANGID const langID)
// obtains access to the proper resource container
// for standard Win32 resource loading this is normally a PE module - use LoadLibraryEx
- HMODULE hLangResourceContainer = LoadMUILibraryW(L"np3lng.dll", MUI_LANGUAGE_NAME, langID);
+ HMODULE hLangResourceContainer = LoadMUILibraryW(L"lng/np3lng.dll", MUI_LANGUAGE_NAME, langID);
//if (!hLangResourceContainer)
//{
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 26d962847..9ee84c65f 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -6,8 +6,8 @@
#define APPNAME "Notepad3"
#define VERSION_MAJOR 4
#define VERSION_MINOR 18
-#define VERSION_REV 606
-#define VERSION_BUILD 1002
+#define VERSION_REV 607
+#define VERSION_BUILD 1004
#define SCINTILLA_VER 405
#define ONIGMO_REGEX_VER 6.1.3
#define VERSION_PATCH " X_MUI"
diff --git a/uthash/utarray.h b/uthash/utarray.h
index 729763fcf..f5bfd5269 100644
--- a/uthash/utarray.h
+++ b/uthash/utarray.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008-2017, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright (c) 2008-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/uthash/uthash.h b/uthash/uthash.h
index 13afc5d3a..f34c1f98a 100644
--- a/uthash/uthash.h
+++ b/uthash/uthash.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2017, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright (c) 2003-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/uthash/utlist.h b/uthash/utlist.h
index 2f4c08406..41f49f278 100644
--- a/uthash/utlist.h
+++ b/uthash/utlist.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2007-2017, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright (c) 2007-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -358,8 +358,8 @@ do {
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
- LL_LOWER_BOUND(head, _tmp, add, cmp); \
- LL_APPEND_ELEM(head, _tmp, add); \
+ LL_LOWER_BOUND2(head, _tmp, add, cmp, next); \
+ LL_APPEND_ELEM2(head, _tmp, add, next); \
} else { \
(head) = (add); \
(head)->next = NULL; \
@@ -651,14 +651,14 @@ do {
} while (0)
#define DL_INSERT_INORDER(head,add,cmp) \
- DL_INSERT_INORDER2(head,add,cmp,next)
+ DL_INSERT_INORDER2(head,add,cmp,prev,next)
-#define DL_INSERT_INORDER2(head,add,cmp,next) \
+#define DL_INSERT_INORDER2(head,add,cmp,prev,next) \
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
- DL_LOWER_BOUND(head, _tmp, add, cmp); \
- DL_APPEND_ELEM(head, _tmp, add); \
+ DL_LOWER_BOUND2(head, _tmp, add, cmp, next); \
+ DL_APPEND_ELEM2(head, _tmp, add, prev, next); \
} else { \
(head) = (add); \
(head)->prev = (head); \
@@ -825,7 +825,7 @@ do {
/* Here are VS2008 / NO_DECLTYPE replacements for a few functions */
#undef DL_INSERT_INORDER2
-#define DL_INSERT_INORDER2(head,add,cmp,next) \
+#define DL_INSERT_INORDER2(head,add,cmp,prev,next) \
do { \
if ((head) == NULL) { \
(add)->prev = (add); \
@@ -838,7 +838,7 @@ do {
(head) = (add); \
} else { \
char *_tmp = (char*)(head); \
- while ((char*)(head)->next != _tmp && (cmp((head)->next, add)) < 0) { \
+ while ((head)->next && (cmp((head)->next, add)) < 0) { \
(head) = (head)->next; \
} \
(add)->prev = (head); \
@@ -892,14 +892,14 @@ do {
} while (0)
#define CDL_INSERT_INORDER(head,add,cmp) \
- CDL_INSERT_INORDER2(head,add,cmp,next)
+ CDL_INSERT_INORDER2(head,add,cmp,prev,next)
-#define CDL_INSERT_INORDER2(head,add,cmp,next) \
+#define CDL_INSERT_INORDER2(head,add,cmp,prev,next) \
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
- CDL_LOWER_BOUND(head, _tmp, add, cmp); \
- CDL_APPEND_ELEM(head, _tmp, add); \
+ CDL_LOWER_BOUND2(head, _tmp, add, cmp, next); \
+ CDL_APPEND_ELEM2(head, _tmp, add, prev, next); \
} else { \
(head) = (add); \
(head)->next = (head); \
@@ -1044,7 +1044,7 @@ do {
/* Here are VS2008 / NO_DECLTYPE replacements for a few functions */
#undef CDL_INSERT_INORDER2
-#define CDL_INSERT_INORDER2(head,add,cmp,next) \
+#define CDL_INSERT_INORDER2(head,add,cmp,prev,next) \
do { \
if ((head) == NULL) { \
(add)->prev = (add); \
diff --git a/uthash/utringbuffer.h b/uthash/utringbuffer.h
index fcae33b4f..106219f15 100644
--- a/uthash/utringbuffer.h
+++ b/uthash/utringbuffer.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008-2017, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright (c) 2015-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/uthash/utstring.h b/uthash/utstring.h
index bc68ac5c2..48ec66b82 100644
--- a/uthash/utstring.h
+++ b/uthash/utstring.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008-2017, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright (c) 2008-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without