[gimp/bug-357818: 9/10] Bug 357818 - TWAIN plug-in - Fixed the problem with logging messages.
- From: Michael Schumacher <schumaml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/bug-357818: 9/10] Bug 357818 - TWAIN plug-in - Fixed the problem with logging messages.
- Date: Wed, 8 Jun 2016 22:00:14 +0000 (UTC)
commit cac798d334b576ea703222fff476a674e0a483d7
Author: Jens M. Plonka <jens plonka gmx de>
Date: Fri Jun 3 02:36:04 2016 +0200
Bug 357818 - TWAIN plug-in - Fixed the problem with logging messages.
Applying a slightly changed patch to accommodate for the code changes since the original patch had been
made.
plug-ins/twain/tw_func.c | 44 +++++++++++++++++++++---------------------
plug-ins/twain/tw_platform.h | 6 ++++-
plug-ins/twain/tw_win.c | 8 ++++--
3 files changed, 32 insertions(+), 26 deletions(-)
---
diff --git a/plug-ins/twain/tw_func.c b/plug-ins/twain/tw_func.c
index 9942659..f677f40 100644
--- a/plug-ins/twain/tw_func.c
+++ b/plug-ins/twain/tw_func.c
@@ -218,7 +218,7 @@ openDSM (pTW_SESSION twSession)
return TRUE;
case TWRC_FAILURE:
- log_message ("OpenDSM failure: %s\n", currentTwainError(twSession) );
+ g_message ("OpenDSM failure: %s\n", currentTwainError(twSession) );
break;
}
@@ -270,7 +270,7 @@ selectDS (pTW_SESSION twSession)
/* The datasource manager must be open */
if (DSM_IS_CLOSED(twSession))
{
- log_message ("Can't select data source with closed source manager.\n");
+ g_message ("Can't select data source with closed source manager.\n");
return FALSE;
}
@@ -290,7 +290,7 @@ selectDS (pTW_SESSION twSession)
return TRUE;
case TWRC_FAILURE:
- log_message ("Error selecting datasource: %s\n", currentTwainError(twSession));
+ g_message ("Error selecting datasource: %s\n", currentTwainError(twSession));
break;
}
@@ -308,14 +308,14 @@ openDS (pTW_SESSION twSession)
/* The datasource manager must be open */
if (DSM_IS_CLOSED(twSession))
{
- log_message ("The DSM needs to be opened first.\n");
+ g_message ("The DSM needs to be opened first.\n");
return FALSE;
}
/* Is the data source already open? */
if (DS_IS_OPEN(twSession))
{
- log_message ("A source has already been opened, please close it first.\n");
+ g_message ("A source has already been opened, please close it first.\n");
return FALSE;
}
@@ -334,7 +334,7 @@ openDS (pTW_SESSION twSession)
return TRUE;
case TWRC_FAILURE:
- log_message ("Error opening data source: %s\n", currentTwainError(twSession));
+ g_message ("Error opening data source: %s\n", currentTwainError(twSession));
break;
}
@@ -362,7 +362,7 @@ setBufferedXfer (pTW_SESSION twSession)
bufXfer.hContainer = twainAllocHandle (sizeof(TW_ONEVALUE));
if (bufXfer.hContainer == NULL)
{
- log_message ("Error allocating memory for XFer mechanism.\n");
+ g_message ("Error allocating memory for XFer mechanism.\n");
return FALSE;
}
pvalOneValue = (pTW_ONEVALUE) twainLockHandle (bufXfer.hContainer);
@@ -374,7 +374,7 @@ setBufferedXfer (pTW_SESSION twSession)
twSession->twRC = DSM_XFER_SET(twSession, bufXfer);
if (twSession->twRC == TWRC_FAILURE)
{
- log_message ("Could not set capability: %s\n", currentTwainError(twSession));
+ g_message ("Could not set capability: %s\n", currentTwainError(twSession));
}
/* Free the container */
@@ -398,7 +398,7 @@ requestImageAcquire (pTW_SESSION twSession, gboolean showUI)
/* Make sure in the correct state */
if (DS_IS_CLOSED(twSession))
{
- log_message ("You need to open the data source first.\n");
+ g_message ("You need to open the data source first.\n");
return FALSE;
}
@@ -422,7 +422,7 @@ requestImageAcquire (pTW_SESSION twSession, gboolean showUI)
return TRUE;
case TWRC_FAILURE:
- log_message ("Error enabeling data source: %s\n", currentTwainError(twSession));
+ g_message ("Error enabeling data source: %s\n", currentTwainError(twSession));
break;
}
}
@@ -440,7 +440,7 @@ disableDS(pTW_SESSION twSession)
/* Verify the datasource is enabled */
if (DS_IS_DISABLED(twSession))
{
- log_message ("You need to enable the data source first.\n");
+ g_message ("You need to enable the data source first.\n");
return;
}
@@ -455,7 +455,7 @@ disableDS(pTW_SESSION twSession)
break;
case TWRC_FAILURE:
- log_message ("Can't disable data source: %s\n", currentTwainError(twSession));
+ g_message ("Can't disable data source: %s\n", currentTwainError(twSession));
break;
}
}
@@ -472,7 +472,7 @@ closeDS (pTW_SESSION twSession)
/* Can't close a closed data source */
if (DS_IS_CLOSED(twSession))
{
- log_message ("closeDS: Data source already closed\n");
+ g_message ("closeDS: Data source already closed\n");
return;
}
@@ -490,7 +490,7 @@ closeDS (pTW_SESSION twSession)
break;
case TWRC_FAILURE:
- log_message ("Error closing data source: %s\n", currentTwainError(twSession));
+ g_message ("Error closing data source: %s\n", currentTwainError(twSession));
break;
}
}
@@ -505,7 +505,7 @@ closeDSM (pTW_SESSION twSession)
{
if (DSM_IS_CLOSED(twSession))
{
- log_message ("Data Source Manager not open\n");
+ g_message ("Data Source Manager not open\n");
}
else
{
@@ -519,7 +519,7 @@ closeDSM (pTW_SESSION twSession)
break;
case TWRC_FAILURE:
- log_message ("Error closing Data Source Manager: %s\n", currentTwainError(twSession));
+ g_message ("Error closing Data Source Manager: %s\n", currentTwainError(twSession));
break;
}
}
@@ -554,7 +554,7 @@ beginImageTransfer (pTW_SESSION twSession, pTW_IMAGEINFO imageInfo)
/* We should continue */
return TRUE;
case TWRC_FAILURE:
- log_message ("Get Image Info failure - %s\n", currentTwainError(twSession));
+ g_message ("Get Image Info failure - %s\n", currentTwainError(twSession));
break;
}
return FALSE;
@@ -677,7 +677,7 @@ endImageTransfer (pTW_SESSION twSession, int *pendingCount)
break;
case TWRC_FAILURE:
- log_message ("Failure received: %s\n", currentTwainError(twSession));
+ g_message ("Failure received: %s\n", currentTwainError(twSession));
*pendingCount = endPendingTransfer (twSession);
break;
}
@@ -705,7 +705,7 @@ transferImages (pTW_SESSION twSession)
*/
if (!twSession || !twSession->transferFunctions || !twSession->transferFunctions->txfrDataCb)
{
- log_message ("Attempting image transfer without callback function.\n");
+ g_message ("Attempting image transfer without callback function.\n");
return;
}
@@ -818,7 +818,7 @@ get_available_ds (pTW_SESSION twSession)
if(DSM_IS_CLOSED(twSession))
{
- log_message ("You need to open the DSM first.\n");
+ g_message ("You need to open the DSM first.\n");
return NULL;
}
@@ -841,7 +841,7 @@ get_available_ds (pTW_SESSION twSession)
break;
case TWRC_FAILURE:
- log_message ("Error getting first data source: %s\n", currentTwainError(twSession));
+ g_message ("Error getting first data source: %s\n", currentTwainError(twSession));
break;
}
@@ -864,7 +864,7 @@ get_available_ds (pTW_SESSION twSession)
break;
case TWRC_FAILURE:
- log_message ("Error getting next data source: %s\n", currentTwainError(twSession));
+ g_message ("Error getting next data source: %s\n", currentTwainError(twSession));
break;
}
}
diff --git a/plug-ins/twain/tw_platform.h b/plug-ins/twain/tw_platform.h
index 99ae0e1..7ef211e 100644
--- a/plug-ins/twain/tw_platform.h
+++ b/plug-ins/twain/tw_platform.h
@@ -61,7 +61,11 @@
#define PRODUCT_NAME "GIMP"
#define PLUG_IN_NAME "TWAIN"
#define PLUG_IN_DESCRIPTION N_("Capture an image from a TWAIN datasource")
- #define PLUG_IN_HELP "This plug-in will capture an image from a TWAIN datasource"
+ #define PLUG_IN_HELP "This plug-in will capture an image from a TWAIN datasource.\n" \
+ "Recent changes:\n" \
+ " - Support of Win 64 Bit (requires twaindsm.dll from twain.org)\n" \
+ " - Fixed bug while scanning multiple images\n" \
+ " - Added easy Scanner access"
#define PLUG_IN_AUTHOR "Jens Plonka (jens plonka gmx de)"
#define PLUG_IN_COPYRIGHT "Craig Setera"
#define PLUG_IN_MAJOR 0
diff --git a/plug-ins/twain/tw_win.c b/plug-ins/twain/tw_win.c
index bbd15c8..cd4995c 100644
--- a/plug-ins/twain/tw_win.c
+++ b/plug-ins/twain/tw_win.c
@@ -51,6 +51,8 @@
#include "tw_local.h"
#include "tw_win.h"
+#define DLL_NOT_FOUND "Can't load library \"" TWAIN_DLL_NAME "\"!\nPlease install 'TWAIN Data Source
Manager' from www.twain.org.\n"
+
/* main bits */
static HWND hwnd = NULL;
static HINSTANCE hInst = NULL;
@@ -94,7 +96,7 @@ twainIsAvailable (void)
hDLL = LoadLibrary (TWAIN_DLL_NAME);
if (hDLL == NULL)
{
- log_message ("Can't load library \"%s\"!\n", TWAIN_DLL_NAME);
+ g_message (DLL_NOT_FOUND);
return FALSE;
}
@@ -102,7 +104,7 @@ twainIsAvailable (void)
dsmEntryPoint = (DSMENTRYPROC) GetProcAddress (hDLL, "DSM_Entry");
if (dsmEntryPoint == NULL)
{
- log_message ("Lirary has no DSM Entry point.\n");
+ g_message ("Lirary has no DSM Entry point.\n");
return FALSE;
}
}
@@ -255,7 +257,7 @@ LogLastWinError (void)
NULL
);
- log_message ("%s\n", lpMsgBuf);
+ g_message ("%s\n", (LPTSTR) lpMsgBuf);
/* Free the buffer. */
LocalFree ( lpMsgBuf );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]