diff --git a/include/exiv2/exv_msvc.h b/include/exiv2/exv_msvc.h index aaec9955..9b96cc20 100644 --- a/include/exiv2/exv_msvc.h +++ b/include/exiv2/exv_msvc.h @@ -85,6 +85,7 @@ /* Define Windows unicode path support. */ /* #undef EXV_UNICODE_PATH */ +#define EXV_UNICODE_PATH 1 /* Define to `const' or to empty, depending on the second argument of `iconv'. */ @@ -116,7 +117,7 @@ #define EXV_HAVE_REALLOC 1 /* Define to 1 if stdbool.h conforms to C99. */ -/* #undef EXV_HAVE_STDBOOL_H */ +#define EXV_HAVE_STDBOOL_H 1 /* Define to 1 if you have the header file. */ /* #undef EXV_HAVE_STDINT_H */ @@ -164,7 +165,7 @@ /* #undef EXV_HAVE_UNISTD_H */ /* Define to 1 if you have the `vprintf' function. */ -#define EXV_HAVE_VPRINTF 1 +/* #undef EXV_HAVE_VPRINTF */ /* Define to 1 if you have the header file. */ /* #undef EXV_HAVE_WCHAR_H */ diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index bf8828dd..59d968a6 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -8,28 +8,40 @@ #include #include -int main(int argc, char* const argv[]) +#ifdef EXV_UNICODE_PATH +#define TCHAR wchar_t +#define _tstrcmp wcscmp +#define _T(s) L ##s +#else +#define TCHAR char +#define _tstrcmp strcmp +#define _T(s) s +#define wcout cout +#define wmain main +#endif +int wmain(int argc, TCHAR* const argv[]) try { + TCHAR* prog = argv[0]; + TCHAR* file = argv[1]; if (argc != 2) { - std::cout << "Usage: " << argv[0] << " file\n"; + std::wcout << _T("Usage: ") << prog << _T(" file") << std::endl; return 1; } - if ( strcmp(argv[1],"--version") == 0 ) { + if ( _tstrcmp(file,_T("--version")) == 0 ) { exv_grep_keys_t keys; Exiv2::dumpLibraryInfo(std::cout,keys); return 0; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); if (exifData.empty()) { - std::string error(argv[1]); - error += ": No Exif data found in the file"; + std::string error("No Exif data found in the file"); throw Exiv2::Error(1, error); } Exiv2::ExifData::const_iterator end = exifData.end();