diff --git a/tools/rGuiStyler/external/tinyfiledialogs.c b/tools/rGuiStyler/external/tinyfiledialogs.c index 9d26186..a5987ff 100644 --- a/tools/rGuiStyler/external/tinyfiledialogs.c +++ b/tools/rGuiStyler/external/tinyfiledialogs.c @@ -1,22 +1,24 @@ -/* - _________ -/ \ tinyfiledialogs.c v2.5.8 [September 13, 2016] zlib licence -|tiny file| Unique code file of "tiny file dialogs" created [November 9, 2014] -| dialogs | Copyright (c) 2014 - 2016 Guillaume Vareille http://ysengrin.com -\____ ___/ http://tinyfiledialogs.sourceforge.net - \| mailto:tinyfiledialogs@ysengrin.com +/*_________ + / \ tinyfiledialogs.c v2.7.2 [November 23, 2016] zlib licence + |tiny file| Unique code file created [November 9, 2014] + | dialogs | Copyright (c) 2014 - 2016 Guillaume Vareille http://ysengrin.com + \____ ___/ http://tinyfiledialogs.sourceforge.net + \| + git://git.code.sf.net/p/tinyfiledialogs/code + ______________________________________________________ + | | + | direct CONTACT: mailto:tinyfiledialogs@ysengrin.com | + |______________________________________________________| A big thank you to Don Heyse http://ldglite.sf.net for his code contributions, bug corrections & thorough testing! - git://git.code.sf.net/p/tinyfiledialogs/code - Please 1) let me know - if you are including tiny file dialogs, I'll be happy to add your link to the list of projects using it. - If you are using it on different hardware / OS / compiler. - 2) Be the first to leave a review on Sourceforge. Thanks. + 2) leave a review on Sourceforge. Thanks. tiny file dialogs (cross-platform C C++) InputBox PasswordBox MessageBox ColorPicker @@ -39,13 +41,13 @@ NO MAIN LOOP The dialogs can be forced into console mode -Windows [MBCS + UTF-8 + UTF-16] +Windows (XP to 10) [ASCII + MBCS + UTF-8 + UTF-16] - native code & some vbs create the graphic dialogs - enhanced console mode can use dialog.exe from http://andrear.altervista.org/home/cdialog.php - basic console input -Unix [UTF-8] (command line call attempts) +Unix (command line call attempts) [ASCII + UTF-8] - applescript - zenity / matedialog - kdialog @@ -60,6 +62,8 @@ on VisualStudio MinGW Mac Linux Bsd Solaris Minix Raspbian C# fortran (iso_c) using Gnome Kde Enlightenment Mate Cinnamon Unity Lxde Lxqt Xfce WindowMaker IceWm Cde Jds OpenBox +bindings for LUA and C# dll + - License - This software is provided 'as-is', without any express or implied @@ -83,12 +87,10 @@ misrepresented as being the original software. #include #include #include +#include #include "tinyfiledialogs.h" -/* #define TINYFD_NOLIB //*/ - -#define _MAX_FNAME 256 // Ray -#define _MAX_EXT 256 // Ray +/* #define TINYFD_NOLIB */ #ifdef _WIN32 #ifndef _WIN32_WINNT @@ -98,11 +100,9 @@ misrepresented as being the original software. #include #include #endif - #include #include /*#include */ #define SLASH "\\" - /* tinyfd_winUtf8 is not ready yet, do not modify */ int tinyfd_winUtf8 = 0 ; /* on windows string char can be 0:MBSC or 1:UTF-8 */ #else #include @@ -113,10 +113,13 @@ misrepresented as being the original software. #define SLASH "/" #endif /* _WIN32 */ +#define _MAX_FNAME 256 // Ray +#define _MAX_EXT 256 // Ray + #define MAX_PATH_OR_CMD 1024 /* _MAX_PATH or MAX_PATH */ #define MAX_MULTIPLE_FILES 32 -char tinyfd_version [8] = "2.5.8"; +char tinyfd_version [8] = "2.7.2"; #if defined(TINYFD_NOLIB) && defined(_WIN32) int tinyfd_forceConsole = 1 ; @@ -163,12 +166,13 @@ static char gMessageWin[] = "tiny file dialogs on Windows needs:\n\t\ \nor\ta console for basic input"; #else static char gMessageUnix[] = "tiny file dialogs on UNIX needs:\n\tapplescript\ -\nor\tzenity (version 3 for the color chooser)\ -\nor\tmatedialog\nor\tkdialog\ -\nor\tXdialog\nor\tpython 2 with tkinter\ +\nor\tzenity / matedialog\ +\nor\tkdialog\ +\nor\tXdialog\ +\nor\tpython 2 with tkinter\ \nor\tdialog (opens a console if needed)\ -\nor\twhiptail, gdialog, gxmessage or xmessage (really?)\ -\nor\tit will open a console (if needed) for basic input (you had it comming!)"; +\nor\twhiptail, gdialog, gxmessage or xmessage\ +\nor\tit will use/open a console for basic input"; #endif #ifdef _MSC_VER @@ -191,7 +195,7 @@ static char * getPathWithoutFinalSlash( } if (lTmp) { - strncpy(aoDestination, aSource, lTmp - aSource); + strncpy(aoDestination, aSource, lTmp - aSource ); aoDestination[lTmp - aSource] = '\0'; } else @@ -264,7 +268,7 @@ static void Hex2RGB( char const aHexRGB [8] , aoResultRGB[1] = (unsigned char)strtoul(lColorChannel+3,NULL,16); lColorChannel[3] = '\0'; aoResultRGB[0] = (unsigned char)strtoul(lColorChannel+1,NULL,16); -/* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); //*/ +/* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); */ } else { @@ -288,7 +292,7 @@ static void RGB2Hex( unsigned char const aRGB [3] , sprintf(aoResultHexRGB, "#%02hhx%02hhx%02hhx", #endif aRGB[0], aRGB[1], aRGB[2]); - /* printf("aoResultHexRGB %s\n", aoResultHexRGB); //*/ + /* printf("aoResultHexRGB %s\n", aoResultHexRGB); */ } else { @@ -358,7 +362,6 @@ static int fileExists( char const * const aFilePathAndName ) lIn = fopen( aFilePathAndName , "r" ) ; if ( ! lIn ) { - return 0 ; } fclose ( lIn ) ; @@ -412,6 +415,26 @@ static char const * ensureFilesExist( char * const aDestination , return aDestination ; } + +static void wipefile(char const * const aFilename) +{ + int i; + struct stat st; + FILE * lIn; + + if (stat(aFilename, &st) == 0) + { + if ((lIn = fopen(aFilename, "w"))) + { + for (i = 0; i < st.st_size; i++) + { + fputc('A', lIn); + } + } + fclose(lIn); + } +} + #ifdef _WIN32 static int replaceChr ( char * const aString , @@ -455,6 +478,7 @@ static int dirExists ( char const * const aDirPath ) return 0 ; } +#ifndef TINYFD_NOLIB static wchar_t * getPathWithoutFinalSlashW( wchar_t * const aoDestination, /* make sure it is allocated, use _MAX_PATH */ @@ -530,7 +554,7 @@ static void Hex2RGBW(wchar_t const aHexRGB[8], aoResultRGB[1] = (unsigned char)wcstoul(lColorChannel + 3, NULL, 16); lColorChannel[3] = '\0'; aoResultRGB[0] = (unsigned char)wcstoul(lColorChannel + 1, NULL, 16); - /* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); //*/ + /* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); */ } else { @@ -555,7 +579,7 @@ swprintf(aoResultHexRGB, L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]); #else swprintf(aoResultHexRGB, 8, L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]); #endif - /* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); //*/ + /* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); */ } else { @@ -566,7 +590,6 @@ swprintf(aoResultHexRGB, 8, L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]); } } -#ifndef TINYFD_NOLIB #if !defined(WC_ERR_INVALID_CHARS) /* undefined prior to Vista, so not yet in MINGW header file */ @@ -684,7 +707,7 @@ static void runSilentW(wchar_t const * const aString) ULONG rc; wchar_t * lArgs; wchar_t * pEnvCMD; - wchar_t * pDefaultCMD = L"CMD.EXE"; //powershell.exe + wchar_t * pDefaultCMD = L"CMD.EXE"; int lStringLen = 0; memset(&StartupInfo, 0, sizeof(StartupInfo)); @@ -737,7 +760,6 @@ static void runSilentW(wchar_t const * const aString) } - int tinyfd_messageBoxW( wchar_t const * const aTitle, /* NULL or "" */ wchar_t const * const aMessage, /* NULL or "" may contain \n and \t */ @@ -831,7 +853,6 @@ static int messageBoxWinGui8( return lIntRetVal ; } -#endif /* TINYFD_NOLIB */ static char const * inputBoxWinGui( char * const aoBuff , @@ -844,10 +865,7 @@ static char const * inputBoxWinGui( int lResult; int lTitleLen; int lMessageLen; - -#ifndef TINYFD_NOLIB wchar_t * lDialogStringW; -#endif lTitleLen = aTitle ? strlen(aTitle) : 0 ; lMessageLen = aMessage ? strlen(aMessage) : 0 ; @@ -899,29 +917,23 @@ static char const * inputBoxWinGui( \n\ +WINDOWSTATE = 'hidden'>\n\ \n\