commit ec49834ac9a154b817bb5d13a9b9db52e5a64e1b
Author: Francesco Pretto <ceztko@gmail.com>
Date:   Mon Dec 24 11:23:14 2018 +0100

    Fix compilation errors in MSVC
    
    EncryptTest: Fixed test with macro non compiling in MSVC
    StringTest: Removed use of VLA to fix MSVC compilation
    podofocrop: Fix get_ghostscript_output compilation on MSVC with UNICODE builds
                Just switch use of CreateProcess to specific ANSI version CreateProcessA
    podofosign: Fix compilation error including libidn in MSVC

diff --git a/src/base/PdfEncrypt.cpp b/src/base/PdfEncrypt.cpp
index bfd3983..065a85f 100644
--- a/src/base/PdfEncrypt.cpp
+++ b/src/base/PdfEncrypt.cpp
@@ -39,6 +39,11 @@
 #ifdef PODOFO_HAVE_LIBIDN
 // AES-256 dependencies :
 // SASL
+#if defined(_MSC_VER)
+// Fix missing posix "ssize_t" typedef in MSVC
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
 #include <stringprep.h>
 #include <openssl/sha.h>
 #endif // PODOFO_HAVE_LIBIDN
diff --git a/test/unit/EncryptTest.cpp b/test/unit/EncryptTest.cpp
index 75cb678..6566496 100644
--- a/test/unit/EncryptTest.cpp
+++ b/test/unit/EncryptTest.cpp
@@ -331,17 +331,16 @@ void EncryptTest::testEnableAlgorithms()
 #ifdef PODOFO_HAVE_LIBIDN
     CPPUNIT_ASSERT( PdfEncrypt::IsEncryptionEnabled( PdfEncrypt::ePdfEncryptAlgorithm_AESV3 ) );
 #endif // PODOFO_HAVE_LIBIDN
-    CPPUNIT_ASSERT_EQUAL( 
+
+    int testAlgorithms = PdfEncrypt::ePdfEncryptAlgorithm_AESV2;
 #ifndef PODOFO_HAVE_OPENSSL_NO_RC4
-                          PdfEncrypt::ePdfEncryptAlgorithm_RC4V1 |
-                          PdfEncrypt::ePdfEncryptAlgorithm_RC4V2 |
+    testAlgorithms |= PdfEncrypt::ePdfEncryptAlgorithm_RC4V1 | PdfEncrypt::ePdfEncryptAlgorithm_RC4V2;
 #endif // PODOFO_HAVE_OPENSSL_NO_RC4
-                          PdfEncrypt::ePdfEncryptAlgorithm_AESV2
 #ifdef PODOFO_HAVE_LIBIDN
-                          | PdfEncrypt::ePdfEncryptAlgorithm_AESV3
+    testAlgorithms |= PdfEncrypt::ePdfEncryptAlgorithm_AESV3;
 #endif // PODOFO_HAVE_LIBIDN
-                                                                   ,
-                          PdfEncrypt::GetEnabledEncryptionAlgorithms() );
+    CPPUNIT_ASSERT_EQUAL( testAlgorithms, PdfEncrypt::GetEnabledEncryptionAlgorithms() );
+
     // Disable AES
 #ifndef PODOFO_HAVE_OPENSSL_NO_RC4
     PdfEncrypt::SetEnabledEncryptionAlgorithms( PdfEncrypt::ePdfEncryptAlgorithm_RC4V1 |
diff --git a/test/unit/StringTest.cpp b/test/unit/StringTest.cpp
index aeb563c..9ac82f5 100644
--- a/test/unit/StringTest.cpp
+++ b/test/unit/StringTest.cpp
@@ -64,7 +64,8 @@ void StringTest::TestLibUnistringInternal(const char* pszString, const long lLen
 {
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Test initial string len.", static_cast<size_t>(lLenUtf8), strlen(pszString) );
     
-    pdf_utf16be pszUtf16[lLenUtf16 + 1];
+    pdf_utf16be *pszUtf16 = ( pdf_utf16be * )podofo_malloc( lLenUtf16 + 1 );
+    CPPUNIT_ASSERT(pszUtf16 != NULL);
     pdf_long result1 = PdfString::ConvertUTF8toUTF16( reinterpret_cast<const pdf_utf8*>(pszString), lLenUtf8, pszUtf16, lLenUtf16 + 1 );
 
     print(pszUtf16, result1);
@@ -73,7 +74,8 @@ void StringTest::TestLibUnistringInternal(const char* pszString, const long lLen
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Comparing length of output buffer after utf8 -> utf16 conversion.", lLenUtf16 + 1, static_cast<long>(result1) );
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Make sure utf16 string is 0 terminated.", static_cast<pdf_utf16be>(0), pszUtf16[result1-1] );
     
-    pdf_utf8 pszUtf8[lLenUtf8 + 1];
+    pdf_utf8 *pszUtf8 = ( pdf_utf8 * )podofo_malloc( lLenUtf8 + 1 );
+    CPPUNIT_ASSERT(pszUtf8 != NULL);
     pdf_long result2 = PdfString::ConvertUTF16toUTF8( pszUtf16, lLenUtf16, pszUtf8, lLenUtf8 + 1 );
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Comparing length of output buffer after utf8 -> utf16 -> utf8 conversion.", lLenUtf8 + 1, static_cast<long>(result2) );
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Make sure utf8 string is 0 terminated.", static_cast<pdf_utf8>(0), pszUtf8[result2 - 1] );
diff --git a/tools/podofocrop/podofocrop.cpp b/tools/podofocrop/podofocrop.cpp
index 0165468..708ef6b 100644
--- a/tools/podofocrop/podofocrop.cpp
+++ b/tools/podofocrop/podofocrop.cpp
@@ -79,7 +79,7 @@ std::string get_ghostscript_output( const char* pszInput )
     DWORD count;
 	char cmd[lBufferLen];
 
-    STARTUPINFO si;
+    STARTUPINFOA si;
     PROCESS_INFORMATION pi;
 
     ZeroMemory( &si, sizeof(si) );
@@ -100,7 +100,7 @@ std::string get_ghostscript_output( const char* pszInput )
 	
 	_snprintf(cmd, lBufferLen, "gs -dSAFER -sDEVICE=bbox -sNOPAUSE -q %s -c quit", pszInput);
 	printf("Running %s\n", cmd );
-    if( !CreateProcess( NULL, cmd, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi ) ) 
+    if( !CreateProcessA( NULL, cmd, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi ) )
     {
 		printf("CreateProcess failed.");
         exit(1);
