From 8ce51ce022794df3396d8495a50148e37f84b3fa Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 26 Sep 2009 22:30:32 +0000 Subject: Fixed Win32 code for MS Windows-specific color profile location. Fixes bug #214198. (bzr r8654) --- src/color-profile.cpp | 52 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'src/color-profile.cpp') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 5868a9582..6e180ab4f 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -1,4 +1,6 @@ - +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif //#define DEBUG_LCMS @@ -12,10 +14,17 @@ #include #include -// #ifdef WIN32 -// #include -// #include -// #endif + +#ifdef WIN32 +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 +#endif +#if ENABLE_LCMS +#else +#include +#endif // ENABLE_LCMS +#endif + #include "xml/repr.h" #include "color-profile.h" #include "color-profile-fns.h" @@ -27,6 +36,9 @@ #include "dom/uri.h" #include "dom/util/digest.h" +#ifdef WIN32 +#include +#endif // WIN32 using Inkscape::ColorProfile; using Inkscape::ColorProfileClass; @@ -604,21 +616,21 @@ std::list ColorProfile::getProfileDirs() { } -// #ifdef WIN32 -// wchar_t pathBuf[MAX_PATH + 1]; -// pathBuf[0] = 0; -// DWORD pathSize = sizeof(pathBuf); -// g_assert(sizeof(wchar_t) == sizeof(gunichar2)); -// if ( GetColorDirectoryW( NULL, &pathBuf, &pathSize ) ) { -// gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); -// if ( !g_utf8_validate(utf8Path, -1, NULL) ) { -// g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" ); -// } else { -// sources.pushback(utf8Path); -// } -// g_free( utf8Path ); -// } -// #endif // WIN32 +#ifdef WIN32 + wchar_t pathBuf[MAX_PATH + 1]; + pathBuf[0] = 0; + DWORD pathSize = sizeof(pathBuf); + g_assert(sizeof(wchar_t) == sizeof(gunichar2)); + if ( GetColorDirectoryW( NULL, pathBuf, &pathSize ) ) { + gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); + if ( !g_utf8_validate(utf8Path, -1, NULL) ) { + g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" ); + } else { + sources.push_back(utf8Path); + } + g_free( utf8Path ); + } +#endif // WIN32 return sources; } -- cgit v1.2.3