libragephoto: CMake improvements and header include changes
This commit is contained in:
parent
73765abb0d
commit
ce0cb68fa5
7 changed files with 540 additions and 16 deletions
|
@ -16,7 +16,8 @@
|
||||||
* responsible for anything with use of the software, you are self responsible.
|
* responsible for anything with use of the software, you are self responsible.
|
||||||
****************************************************************************]]
|
****************************************************************************]]
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
cmake_policy(VERSION 3.16...3.28)
|
||||||
project(ragephoto VERSION 0.6.0 LANGUAGES C CXX)
|
project(ragephoto VERSION 0.6.0 LANGUAGES C CXX)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#[[**************************************************************************
|
#[[**************************************************************************
|
||||||
* libragephoto RAGE Photo Parser
|
* libragephoto RAGE Photo Parser
|
||||||
* Copyright (C) 2021-2023 Syping
|
* Copyright (C) 2021-2024 Syping
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
|
@ -25,17 +25,23 @@ if (RAGEPHOTO_UNICODE)
|
||||||
message("-- UnicodeCvt - ${RAGEPHOTO_UNICODE}")
|
message("-- UnicodeCvt - ${RAGEPHOTO_UNICODE}")
|
||||||
else()
|
else()
|
||||||
# RagePhoto Unicode functionality tests
|
# RagePhoto Unicode functionality tests
|
||||||
message("-- Testing codecvt")
|
if (NOT RAGEPHOTO_C_LIBRARY)
|
||||||
try_run(CODECVT_RUN CODECVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp")
|
message("-- Testing codecvt")
|
||||||
if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0)
|
try_run(CODECVT_RUN CODECVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp")
|
||||||
set(CODECVT_COMPAT TRUE)
|
if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0)
|
||||||
message("-- Testing codecvt - yes")
|
set(CODECVT_COMPAT TRUE)
|
||||||
else()
|
message("-- Testing codecvt - yes")
|
||||||
message("-- Testing codecvt - no")
|
else()
|
||||||
|
message("-- Testing codecvt - no")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("-- Testing iconv")
|
message("-- Testing iconv")
|
||||||
try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp")
|
if (RAGEPHOTO_C_LIBRARY)
|
||||||
|
try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/IconvTest.c")
|
||||||
|
else()
|
||||||
|
try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp")
|
||||||
|
endif()
|
||||||
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
|
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
|
||||||
set(ICONV_COMPAT TRUE)
|
set(ICONV_COMPAT TRUE)
|
||||||
message("-- Testing iconv - yes")
|
message("-- Testing iconv - yes")
|
||||||
|
@ -45,7 +51,11 @@ else()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
message("-- Testing wincvt")
|
message("-- Testing wincvt")
|
||||||
try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp")
|
if (RAGEPHOTO_C_LIBRARY)
|
||||||
|
try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/WincvtTest.c")
|
||||||
|
else()
|
||||||
|
try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp")
|
||||||
|
endif()
|
||||||
if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0)
|
if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0)
|
||||||
set(WINCVT_COMPAT TRUE)
|
set(WINCVT_COMPAT TRUE)
|
||||||
message("-- Testing wincvt - yes")
|
message("-- Testing wincvt - yes")
|
||||||
|
|
|
@ -34,8 +34,13 @@
|
||||||
#if defined(UNICODE_ICONV)
|
#if defined(UNICODE_ICONV)
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#elif defined(UNICODE_WINCVT)
|
#elif defined(UNICODE_WINCVT)
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN
|
||||||
|
#endif
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stringapiset.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RAGEPHOTO LIBRARY GLOBALS */
|
/* RAGEPHOTO LIBRARY GLOBALS */
|
||||||
|
|
|
@ -38,8 +38,13 @@
|
||||||
#elif defined UNICODE_ICONV
|
#elif defined UNICODE_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#elif defined UNICODE_WINCVT
|
#elif defined UNICODE_WINCVT
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN
|
||||||
|
#endif
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stringapiset.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* CLASSIC RAGEPHOTO TYPEDEF */
|
/* CLASSIC RAGEPHOTO TYPEDEF */
|
||||||
|
|
262
tests/IconvTest.c
Normal file
262
tests/IconvTest.c
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* libragephoto RAGE Photo Parser
|
||||||
|
* Copyright (C) 2021-2024 Syping
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* This software is provided as-is, no warranties are given to you, we are not
|
||||||
|
* responsible for anything with use of the software, you are self responsible.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <iconv.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
unsigned char photoHeader_english[256] = {
|
||||||
|
0x50, 0x00, 0x48, 0x00, 0x4f, 0x00, 0x54, 0x00,
|
||||||
|
0x4f, 0x00, 0x20, 0x00, 0x2d, 0x00, 0x20, 0x00,
|
||||||
|
0x30, 0x00, 0x32, 0x00, 0x2f, 0x00, 0x30, 0x00,
|
||||||
|
0x31, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x37, 0x00,
|
||||||
|
0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0x3a, 0x00,
|
||||||
|
0x34, 0x00, 0x32, 0x00, 0x3a, 0x00, 0x34, 0x00,
|
||||||
|
0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char photoHeader_japanese[256] = {
|
||||||
|
0x99, 0x51, 0x1f, 0x77, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x32, 0x00, 0x32, 0x00, 0x3a, 0x00,
|
||||||
|
0x35, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char photoHeader_korean[256] = {
|
||||||
|
0xac, 0xc0, 0xc4, 0xc9, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x31, 0x00, 0x38, 0x00, 0x3a, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char photoHeader_russian[256] = {
|
||||||
|
0x24, 0x04, 0x1e, 0x04, 0x22, 0x04, 0x1e, 0x04,
|
||||||
|
0x20, 0x00, 0x2d, 0x00, 0x20, 0x00, 0x31, 0x00,
|
||||||
|
0x32, 0x00, 0x2f, 0x00, 0x32, 0x00, 0x38, 0x00,
|
||||||
|
0x2f, 0x00, 0x32, 0x00, 0x32, 0x00, 0x20, 0x00,
|
||||||
|
0x30, 0x00, 0x34, 0x00, 0x3a, 0x00, 0x32, 0x00,
|
||||||
|
0x35, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x30, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char photoHeader_taiwanese[256] = {
|
||||||
|
0xf8, 0x76, 0x47, 0x72, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x32, 0x00, 0x31, 0x00, 0x3a, 0x00,
|
||||||
|
0x30, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t src_s, dst_s, ret;
|
||||||
|
char photoString[256];
|
||||||
|
iconv_t iconv_in = iconv_open("UTF-8", "UTF-16LE");
|
||||||
|
if (iconv_in == (iconv_t)-1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// English
|
||||||
|
src_s = sizeof(photoHeader_english);
|
||||||
|
dst_s = sizeof(photoString);
|
||||||
|
char *src_english = (char*)photoHeader_english;
|
||||||
|
char *dst_english = photoString;
|
||||||
|
ret = iconv(iconv_in, &src_english, &src_s, &dst_english, &dst_s);
|
||||||
|
if (ret == (size_t)-1)
|
||||||
|
return 1;
|
||||||
|
if (strcmp(photoString, "PHOTO - 02/01/17 08:42:44") != 0)
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
// Japanese
|
||||||
|
src_s = sizeof(photoHeader_japanese);
|
||||||
|
dst_s = sizeof(photoString);
|
||||||
|
char *src_japanese = (char*)photoHeader_japanese;
|
||||||
|
char *dst_japanese = photoString;
|
||||||
|
ret = iconv(iconv_in, &src_japanese, &src_s, &dst_japanese, &dst_s);
|
||||||
|
if (ret == (size_t)-1)
|
||||||
|
return 3;
|
||||||
|
if (strcmp(photoString, "写真 - 12/28/22 04:22:57") != 0)
|
||||||
|
return 4;
|
||||||
|
|
||||||
|
// Korean
|
||||||
|
src_s = sizeof(photoHeader_korean);
|
||||||
|
dst_s = sizeof(photoString);
|
||||||
|
char *src_korean = (char*)photoHeader_korean;
|
||||||
|
char *dst_korean = photoString;
|
||||||
|
ret = iconv(iconv_in, &src_korean, &src_s, &dst_korean, &dst_s);
|
||||||
|
if (ret == (size_t)-1)
|
||||||
|
return 5;
|
||||||
|
if (strcmp(photoString, "사진 - 12/28/22 04:18:28") != 0)
|
||||||
|
return 6;
|
||||||
|
|
||||||
|
// Russian
|
||||||
|
src_s = sizeof(photoHeader_russian);
|
||||||
|
dst_s = sizeof(photoString);
|
||||||
|
char *src_russian = (char*)photoHeader_russian;
|
||||||
|
char *dst_russian = photoString;
|
||||||
|
ret = iconv(iconv_in, &src_russian, &src_s, &dst_russian, &dst_s);
|
||||||
|
if (ret == (size_t)-1)
|
||||||
|
return 7;
|
||||||
|
if (strcmp(photoString, "ФОТО - 12/28/22 04:25:10") != 0)
|
||||||
|
return 8;
|
||||||
|
|
||||||
|
// Taiwanese
|
||||||
|
src_s = sizeof(photoHeader_taiwanese);
|
||||||
|
dst_s = sizeof(photoString);
|
||||||
|
char *src_taiwanese = (char*)photoHeader_taiwanese;
|
||||||
|
char *dst_taiwanese = photoString;
|
||||||
|
ret = iconv(iconv_in, &src_taiwanese, &src_s, &dst_taiwanese, &dst_s);
|
||||||
|
if (ret == (size_t)-1)
|
||||||
|
return 9;
|
||||||
|
if (strcmp(photoString, "相片 - 12/28/22 04:21:01") != 0)
|
||||||
|
return 10;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
240
tests/WincvtTest.c
Normal file
240
tests/WincvtTest.c
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* libragephoto RAGE Photo Parser
|
||||||
|
* Copyright (C) 2021-2022 Syping
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* This software is provided as-is, no warranties are given to you, we are not
|
||||||
|
* responsible for anything with use of the software, you are self responsible.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#define VC_EXTRALEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
const unsigned char photoHeader_english[256] = {
|
||||||
|
0x50, 0x00, 0x48, 0x00, 0x4f, 0x00, 0x54, 0x00,
|
||||||
|
0x4f, 0x00, 0x20, 0x00, 0x2d, 0x00, 0x20, 0x00,
|
||||||
|
0x30, 0x00, 0x32, 0x00, 0x2f, 0x00, 0x30, 0x00,
|
||||||
|
0x31, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x37, 0x00,
|
||||||
|
0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0x3a, 0x00,
|
||||||
|
0x34, 0x00, 0x32, 0x00, 0x3a, 0x00, 0x34, 0x00,
|
||||||
|
0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char photoHeader_japanese[256] = {
|
||||||
|
0x99, 0x51, 0x1f, 0x77, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x32, 0x00, 0x32, 0x00, 0x3a, 0x00,
|
||||||
|
0x35, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char photoHeader_korean[256] = {
|
||||||
|
0xac, 0xc0, 0xc4, 0xc9, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x31, 0x00, 0x38, 0x00, 0x3a, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char photoHeader_russian[256] = {
|
||||||
|
0x24, 0x04, 0x1e, 0x04, 0x22, 0x04, 0x1e, 0x04,
|
||||||
|
0x20, 0x00, 0x2d, 0x00, 0x20, 0x00, 0x31, 0x00,
|
||||||
|
0x32, 0x00, 0x2f, 0x00, 0x32, 0x00, 0x38, 0x00,
|
||||||
|
0x2f, 0x00, 0x32, 0x00, 0x32, 0x00, 0x20, 0x00,
|
||||||
|
0x30, 0x00, 0x34, 0x00, 0x3a, 0x00, 0x32, 0x00,
|
||||||
|
0x35, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x30, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char photoHeader_taiwanese[256] = {
|
||||||
|
0xf8, 0x76, 0x47, 0x72, 0x20, 0x00, 0x2d, 0x00,
|
||||||
|
0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x2f, 0x00,
|
||||||
|
0x32, 0x00, 0x38, 0x00, 0x2f, 0x00, 0x32, 0x00,
|
||||||
|
0x32, 0x00, 0x20, 0x00, 0x30, 0x00, 0x34, 0x00,
|
||||||
|
0x3a, 0x00, 0x32, 0x00, 0x31, 0x00, 0x3a, 0x00,
|
||||||
|
0x30, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
int converted;
|
||||||
|
char photoString[256];
|
||||||
|
|
||||||
|
// English
|
||||||
|
converted = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)photoHeader_english, -1, photoString, 256, NULL, NULL);
|
||||||
|
if (converted == 0)
|
||||||
|
return 1;
|
||||||
|
if (strcmp(photoString, "PHOTO - 02/01/17 08:42:44") != 0)
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
// Japanese
|
||||||
|
converted = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)photoHeader_japanese, -1, photoString, 256, NULL, NULL);
|
||||||
|
if (converted == 0)
|
||||||
|
return 3;
|
||||||
|
if (strcmp(photoString, "写真 - 12/28/22 04:22:57") != 0)
|
||||||
|
return 4;
|
||||||
|
|
||||||
|
// Korean
|
||||||
|
converted = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)photoHeader_korean, -1, photoString, 256, NULL, NULL);
|
||||||
|
if (converted == 0)
|
||||||
|
return 5;
|
||||||
|
if (strcmp(photoString, "사진 - 12/28/22 04:18:28") != 0)
|
||||||
|
return 6;
|
||||||
|
|
||||||
|
// Russian
|
||||||
|
converted = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)photoHeader_russian, -1, photoString, 256, NULL, NULL);
|
||||||
|
if (converted == 0)
|
||||||
|
return 7;
|
||||||
|
if (strcmp(photoString, "ФОТО - 12/28/22 04:25:10") != 0)
|
||||||
|
return 8;
|
||||||
|
|
||||||
|
// Taiwanese
|
||||||
|
converted = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)photoHeader_taiwanese, -1, photoString, 256, NULL, NULL);
|
||||||
|
if (converted == 0)
|
||||||
|
return 9;
|
||||||
|
if (strcmp(photoString, "相片 - 12/28/22 04:21:01") != 0)
|
||||||
|
return 10;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* libragephoto RAGE Photo Parser
|
* libragephoto RAGE Photo Parser
|
||||||
* Copyright (C) 2021-2022 Syping
|
* Copyright (C) 2021-2024 Syping
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
|
@ -17,8 +17,9 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#define VC_EXTRALEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stringapiset.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue