Skip to content

Commit

Permalink
Support SPH
Browse files Browse the repository at this point in the history
  • Loading branch information
rururutan committed Jul 17, 2023
1 parent 9f4155e commit 8f9c407
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/ifpnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int GetImageInfo(SPI_FILE *fp, PictureInfo *lpInfo)
** .pnm ファイルの画像を展開する
*/
int GetImage(SPI_FILE *fp, HANDLE *pHBInfo, HANDLE *pHBImg,
SPIPROC lpProgCallback, long lData)
SPIPROC lpProgCallback, LONG_PTR lData)
{
enum { NCALL = 120 }; /* コールバック関数を呼ぶ回数 */
PNM pnm;
Expand Down
31 changes: 17 additions & 14 deletions src/spibase.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,18 @@ typedef struct PictureInfo {
WORD x_density; /* 画素の水平方向密度 */
WORD y_density; /* 画素の垂直方向密度 */
short colorDepth; /* 画素当たりのbit数 */
#ifdef _WIN64
char dummy[2]; /* アラインメント */
#endif
HLOCAL hInfo; /* 画像内のテキスト情報 */
} PictureInfo;
#pragma pack()

/* コールバック関数(typedef) */
#ifdef __GNUC__
typedef int CALLBACK (*SPIPROC) (int, int, long);
typedef int CALLBACK (*SPIPROC) (int, int, LONG_PTR);
#else
typedef int (CALLBACK *SPIPROC) (int, int, long);
typedef int (CALLBACK *SPIPROC) (int, int, LONG_PTR);
#endif

/* グローバル変数 */
Expand All @@ -138,12 +141,12 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);
int _export PASCAL ConfigurationDlg(HWND, int);
#endif
int _export PASCAL GetPluginInfo(int, LPSTR, int);
int _export PASCAL IsSupported(LPSTR, DWORD);
int _export PASCAL GetPictureInfo(LPSTR, long, unsigned int, PictureInfo *);
int _export PASCAL GetPicture(LPSTR, long, unsigned int, HANDLE *, HANDLE *,
FARPROC, long);
int _export PASCAL GetPreview(LPSTR, long, unsigned int, HANDLE *, HANDLE *,
FARPROC, long);
int _export PASCAL IsSupported(LPSTR, void*);
int _export PASCAL GetPictureInfo(LPSTR, LONG_PTR, unsigned int, PictureInfo *);
int _export PASCAL GetPicture(LPSTR, LONG_PTR, unsigned int, HANDLE *, HANDLE *,
FARPROC, LONG_PTR);
int _export PASCAL GetPreview(LPSTR, LONG_PTR, unsigned int, HANDLE *, HANDLE *,
FARPROC, LONG_PTR);


/* -----------------------------------------------------------------------
Expand Down Expand Up @@ -185,18 +188,18 @@ typedef struct {
UINT flags; /* ストリーム状態フラグ */
HANDLE fhandle; /* ファイル入力のファイルハンドル */
LPSTR fname; /* ファイル入力の入力ファイル名 */
LONG foffset; /* ファイル入力の読み込み開始オフセット */
LONG_PTR foffset; /* ファイル入力の読み込み開始オフセット */
#ifdef SPI_SUPPORT_BUFFERING
LONG ffilptr; /* ファイル入力のファイルポインタ */
#endif
LPBYTE mbuffer; /* メモリ入力のバッファ */
LPBYTE mptr; /* メモリ入力のポインタ */
LONG mcount; /* メモリ入力の残りバイト数 */
LONG msize; /* メモリ入力のデータサイズ */
LONG_PTR mcount; /* メモリ入力の残りバイト数 */
LONG_PTR msize; /* メモリ入力のデータサイズ */
} SPI_FILE;

/* プロトタイプ宣言 */
int SpiOpen(SPI_FILE *, LPSTR, long, unsigned int);
int SpiOpen(SPI_FILE *, LPSTR, LONG_PTR, unsigned int);
void SpiClose(SPI_FILE *);
#ifdef SPI_SUPPORT_BUFFERING
void SpiFillBuf(SPI_FILE *);
Expand Down Expand Up @@ -276,9 +279,9 @@ void ExecAboutDialog(HWND);
int IsSupportedFormat(LPBYTE, DWORD, LPSTR);
int GetImageInfo(SPI_FILE *, PictureInfo *);
#ifdef SPI_IMPLEMENT_GETPREVIEW
int GetImage(SPI_FILE *, HANDLE *, HANDLE *, SPIPROC, long, BOOL);
int GetImage(SPI_FILE *, HANDLE *, HANDLE *, SPIPROC, LONG_PTR, BOOL);
#else
int GetImage(SPI_FILE *, HANDLE *, HANDLE *, SPIPROC, long);
int GetImage(SPI_FILE *, HANDLE *, HANDLE *, SPIPROC, LONG_PTR);
#endif


Expand Down
14 changes: 7 additions & 7 deletions src/spientry.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ int _export PASCAL
** ----- 展開可能な(対応している)ファイル形式か調べる --------------------
*/
int _export PASCAL
IsSupported(LPSTR filename, DWORD dw)
IsSupported(LPSTR filename, void* dw)
{
BYTE buf[2048];
LPBYTE pbuf;
DWORD rbytes;

if (dw & 0xFFFF0000) {
if ((DWORD_PTR)dw & ~(DWORD_PTR)0xffff) {
rbytes = 2048;
pbuf = (LPBYTE)dw;
} else {
Expand All @@ -133,7 +133,7 @@ int _export PASCAL
** ----- 画像ファイルに関する情報を得る ----------------------------------
*/
int _export PASCAL
GetPictureInfo(LPSTR buf, long len, unsigned int flag, PictureInfo *lpInfo)
GetPictureInfo(LPSTR buf, LONG_PTR len, unsigned int flag, PictureInfo *lpInfo)
{
SPI_FILE f;
int err;
Expand All @@ -153,8 +153,8 @@ int _export PASCAL
** ----- 画像を展開する --------------------------------------------------
*/
int _export PASCAL
GetPicture(LPSTR buf, long len, unsigned int flag, HANDLE *pHBInfo,
HANDLE *pHBm, FARPROC lpProgCallback, long lData)
GetPicture(LPSTR buf, LONG_PTR len, unsigned int flag, HANDLE *pHBInfo,
HANDLE *pHBm, FARPROC lpProgCallback, LONG_PTR lData)
{
SPI_FILE f;
int err;
Expand All @@ -178,8 +178,8 @@ int _export PASCAL
** ----- プレビュー・カタログ表示用画像縮小展開ルーティン ----------------
*/
int _export PASCAL
GetPreview(LPSTR buf, long len, unsigned int flag, HANDLE *pHBInfo,
HANDLE *pHBm, FARPROC lpProgCallback, long lData)
GetPreview(LPSTR buf, LONG_PTR len, unsigned int flag, HANDLE *pHBInfo,
HANDLE *pHBm, FARPROC lpProgCallback, LONG_PTR lData)
{
#ifdef SPI_IMPLEMENT_GETPREVIEW
SPI_FILE f;
Expand Down
4 changes: 2 additions & 2 deletions src/spiio.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
/*
** 入力ストリームのオープン
*/
int SpiOpen(SPI_FILE *fp, LPSTR buf, long len, unsigned int flag)
int SpiOpen(SPI_FILE *fp, LPSTR buf, LONG_PTR len, unsigned int flag)
{
HANDLE hFile;
LPBYTE pBuff;
Expand All @@ -58,7 +58,7 @@ int SpiOpen(SPI_FILE *fp, LPSTR buf, long len, unsigned int flag)
if (hFile == INVALID_HANDLE_VALUE)
return SPI_ERROR_FILE_READ;
if (len != 0)
SetFilePointer(hFile, len, NULL, FILE_BEGIN);
SetFilePointer(hFile, (LONG)len, NULL, FILE_BEGIN);
pBuff = (LPBYTE)LocalAlloc(LMEM_FIXED, SPI_BUFSIZ);
if (pBuff == NULL) {
CloseHandle(hFile);
Expand Down

0 comments on commit 8f9c407

Please sign in to comment.