[gimp/bug-357818: 5/10] Bug 357818 - TWAIN plug-in - Removed outdated _DEBUG sections.



commit 590d5d66f4bcb29e2b522728b69d01acf670199d
Author: Jens M. Plonka <jens plonka gmx de>
Date:   Fri Jun 3 01:36:04 2016 +0200

    Bug 357818 - TWAIN plug-in - Removed outdated _DEBUG sections.
    
    Adapted to 2.8 by Dieter Verfaillie <dieterv optionexplicit be>
    Applying a slightly changed patch to accommodate for the code changes since the original patch had been 
made.

 plug-ins/twain/tw_dump.c     |  273 ------------------------------------------
 plug-ins/twain/tw_dump.h     |   70 -----------
 plug-ins/twain/tw_func.c     |    2 +-
 plug-ins/twain/tw_func.h     |    2 -
 plug-ins/twain/tw_local.h    |    8 +-
 plug-ins/twain/tw_platform.h |    8 --
 plug-ins/twain/tw_util.h     |    5 -
 plug-ins/twain/tw_win.c      |   14 --
 plug-ins/twain/twain.c       |  133 +++------------------
 9 files changed, 20 insertions(+), 495 deletions(-)
---
diff --git a/plug-ins/twain/tw_func.c b/plug-ins/twain/tw_func.c
index 062b555..52035ee 100644
--- a/plug-ins/twain/tw_func.c
+++ b/plug-ins/twain/tw_func.c
@@ -453,7 +453,7 @@ disableDS(pTW_SESSION twSession)
                break;
 
       case TWRC_FAILURE:
-        log_message  ("Can't disable data source: %s\n, currentTwainError(twSession));
+        log_message  ("Can't disable data source: %s\n", currentTwainError(twSession));
                break;
     }
 }
diff --git a/plug-ins/twain/tw_func.h b/plug-ins/twain/tw_func.h
index fc8ed96..f575530 100644
--- a/plug-ins/twain/tw_func.h
+++ b/plug-ins/twain/tw_func.h
@@ -217,7 +217,6 @@ void            disableDS (pTW_SESSION twSession);
 void            closeDS (pTW_SESSION twSession);
 void            closeDSM (pTW_SESSION twSession);
 void            cancelPendingTransfers (pTW_SESSION twSession);
-int scanImage (void);
 
 TW_FIX32 FloatToFIX32(float);
 float           FIX32ToFloat(TW_FIX32);
@@ -228,7 +227,6 @@ pTW_SESSION     newSession (pTW_IDENTITY twSession);
 void            registerWindowHandle(pTW_SESSION, TW_HANDLE);
 void            registerTransferCallbacks(pTW_SESSION, pTXFR_CB_FUNCS, void *);
 void            setClientData(pTW_SESSION session, void *clientData);
-pTW_SESSION     initializeTwain (void);
 
 #ifdef G_OS_WIN32
 void LogLastWinError(void);
diff --git a/plug-ins/twain/tw_local.h b/plug-ins/twain/tw_local.h
index 0d0ccae..8e1667b 100644
--- a/plug-ins/twain/tw_local.h
+++ b/plug-ins/twain/tw_local.h
@@ -41,13 +41,6 @@
  */
 #define MAX_IMAGES 1
 
-/*
- * Definition of the run states
- */
-#define RUN_STANDARD 0
-#define RUN_DUMP 1
-#define RUN_READDUMP 2
-
 /* Functions which the platform-independent code will call */
 TW_UINT16 callDSM (
     pTW_IDENTITY,
@@ -68,6 +61,7 @@ void      twainFreeHandle (TW_HANDLE handle);
 
 int       twainMain (void);
 int       scanImage (void);
+pTW_SESSION initializeTwain (void);
 
 void      preTransferCallback (void *);
 int       beginTransferCallback (pTW_IMAGEINFO, void *);
diff --git a/plug-ins/twain/tw_platform.h b/plug-ins/twain/tw_platform.h
index ef8b6cc..7322602 100644
--- a/plug-ins/twain/tw_platform.h
+++ b/plug-ins/twain/tw_platform.h
@@ -29,9 +29,6 @@
 
 /* The DLL to be loaded for TWAIN support */
 #define TWAIN_DLL_NAME "TWAIN_32.DLL"
-#define DUMP_FILE "C:\\TWAINCAP.BIN"
-#define DUMP_NAME "DTWAIN.EXE"
-#define READDUMP_NAME "RTWAIN.EXE"
 
 /* Windows uses separate entry point */
 #define TWAIN_ALTERNATE_MAIN
@@ -50,9 +47,4 @@
   #define PLUG_IN_MINOR       6
   #define PLUG_IN_VERSION     "v0.6 (07/22/2004)"
   #define MID_SELECT          "twain-acquire"
-
-  #ifdef _DEBUG
-  #define PLUG_IN_D_NAME      "twain-acquire-dump"
-  #define PLUG_IN_R_NAME      "twain-acquire-read"
-  #endif /* _DEBUG */
 #endif
diff --git a/plug-ins/twain/tw_util.h b/plug-ins/twain/tw_util.h
index 1fe4391..7891452 100644
--- a/plug-ins/twain/tw_util.h
+++ b/plug-ins/twain/tw_util.h
@@ -63,9 +63,4 @@
 
 void log_message (char *format, ...);
 
-#ifdef _DEBUG
-void logBegin(pTW_IMAGEINFO, void *);
-void logData(pTW_IMAGEINFO, pTW_IMAGEMEMXFER, void *);
-#endif
-
 #endif /* __TW_UTIL_H */
diff --git a/plug-ins/twain/tw_win.c b/plug-ins/twain/tw_win.c
index 9096217..9dabe07 100644
--- a/plug-ins/twain/tw_win.c
+++ b/plug-ins/twain/tw_win.c
@@ -284,13 +284,6 @@ WinMain (
    */
   hInst = hInstance;
 
-#ifdef _DEBUG
-  /* When in debug version, we allow different run modes...
-   * make sure that it is correctly set.
-   */
-  setRunMode(__argv);
-#endif /* _DEBUG */
-
   /*
    * Now, call gimp_main... This is what the MAIN() macro
    * would usually do.
@@ -306,13 +299,6 @@ WinMain (
 int
 main (int argc, char *argv[])
 {
-#ifdef _DEBUG
-  /* When in debug version, we allow different run modes...
-   * make sure that it is correctly set.
-   */
-  setRunMode(__argv);
-#endif /* _DEBUG */
-
   /*
    * Now, call gimp_main... This is what the MAIN() macro
    * would usually do.
diff --git a/plug-ins/twain/twain.c b/plug-ins/twain/twain.c
index 2a3a9f2..e9c871e 100644
--- a/plug-ins/twain/twain.c
+++ b/plug-ins/twain/twain.c
@@ -74,10 +74,6 @@
 #include "tw_local.h"
 #include "tw_util.h"
 
-#ifdef _DEBUG
-#include "tw_dump.h"
-#endif /* _DEBUG */
-
 static void query (void);
 static void run (
     const gchar      *name,
@@ -93,9 +89,6 @@ static const GimpParamDef args[] = { IN_ARGS };
 static const GimpParamDef return_vals[] = { OUT_ARGS };
 
 static char  *destBuf = NULL;
-#ifdef _DEBUG
-static int         twain_run_mode = RUN_STANDARD;
-#endif
 static char bitMasks[] = { 128, 64, 32, 16, 8, 4, 2, 1 };
 
 /* Return values storage */
@@ -130,34 +123,6 @@ TXFR_CB_FUNCS standardCbFuncs =
   postTransferCallback
 };
 
-/******************************************************************
- * Dump handling
- ******************************************************************/
-
-#ifdef _DEBUG
-/* The dumper callback functions */
-TXFR_CB_FUNCS dumperCbFuncs = {
-  dumpPreTransferCallback,
-  dumpBeginTransferCallback,
-  dumpDataTransferCallback,
-  dumpEndTransferCallback,
-  dumpPostTransferCallback };
-
-void
-setRunMode(char *argv[])
-{
-  char *exeName = strrchr(argv[0], '\\') + 1;
-
-  log_message ("Executable name: %s\n", exeName);
-
-  if (!_stricmp(exeName, DUMP_NAME))
-    twain_run_mode = RUN_DUMP;
-
-  if (!_stricmp(exeName, RUNDUMP_NAME))
-    twain_run_mode = RUN_READDUMP;
-}
-#endif /* _DEBUG */
-
 #ifndef TWAIN_ALTERNATE_MAIN
 MAIN()
 #endif
@@ -165,12 +130,7 @@ MAIN()
 int
 scanImage (void)
 {
-#ifdef _DEBUG
-  if (twain_run_mode == RUN_READDUMP)
-    return readDumpedImage (twSession);
-  else
-#endif /* _DEBUG */
-    return getImage (twSession);
+  return getImage (twSession);
 }
 
 /*
@@ -221,12 +181,7 @@ initializeTwain (void)
   twSession = newSession (appIdentity);
 
   /* Register our image transfer callback functions */
-#ifdef _DEBUG
-  if (twain_run_mode == RUN_DUMP)
-    registerTransferCallbacks(twSession, &dumperCbFuncs, NULL);
-  else
-#endif /* _DEBUG */
-    registerTransferCallbacks(twSession, &standardCbFuncs, NULL);
+  registerTransferCallbacks(twSession, &standardCbFuncs, NULL);
   return twSession;
 }
 
@@ -243,66 +198,22 @@ initializeTwain (void)
 static void
 query (void)
 {
-
-#ifdef _DEBUG
-  if (twain_run_mode == RUN_DUMP)
-    {
-      /* the installation of the plugin */
-      gimp_install_procedure(PLUG_IN_D_NAME,
-                             PLUG_IN_DESCRIPTION,
-                             PLUG_IN_HELP,
-                             PLUG_IN_AUTHOR,
-                             PLUG_IN_COPYRIGHT,
-                             PLUG_IN_VERSION,
-                             "TWAIN (Dump)...",
-                             NULL,
-                             GIMP_PLUGIN,
-                             NUMBER_IN_ARGS,
-                             NUMBER_OUT_ARGS,
-                             args,
-                             return_vals);
-
-      gimp_plugin_menu_register (PLUG_IN_D_NAME, "<Image>/File/Create/Acquire");
-    }
-  else if (twain_run_mode == RUN_READDUMP)
-    {
-      /* the installation of the plugin */
-      gimp_install_procedure(PLUG_IN_R_NAME,
-                             PLUG_IN_DESCRIPTION,
-                             PLUG_IN_HELP,
-                             PLUG_IN_AUTHOR,
-                             PLUG_IN_COPYRIGHT,
-                             PLUG_IN_VERSION,
-                             "TWAIN (Read)...",
-                             NULL,
-                             GIMP_PLUGIN,
-                             NUMBER_IN_ARGS,
-                             NUMBER_OUT_ARGS,
-                             args,
-                             return_vals);
-
-      gimp_plugin_menu_register (PLUG_IN_R_NAME, "<Image>/File/Create/Acquire");
-    }
-  else
-#endif /* _DEBUG */
-    {
-      /* the installation of the plugin */
-      gimp_install_procedure(MID_SELECT,
-                             PLUG_IN_DESCRIPTION,
-                             PLUG_IN_HELP,
-                             PLUG_IN_AUTHOR,
-                             PLUG_IN_COPYRIGHT,
-                             PLUG_IN_VERSION,
-                             N_("_Scanner/Camera..."),
-                             NULL,
-                             GIMP_PLUGIN,
-                             NUMBER_IN_ARGS,
-                             NUMBER_OUT_ARGS,
-                             args,
-                             return_vals);
-
-      gimp_plugin_menu_register (MID_SELECT, "<Image>/File/Create/Acquire");
-    }
+  /* the installation of the plugin */
+  gimp_install_procedure(MID_SELECT,
+                         PLUG_IN_DESCRIPTION,
+                         PLUG_IN_HELP,
+                         PLUG_IN_AUTHOR,
+                         PLUG_IN_COPYRIGHT,
+                         PLUG_IN_VERSION,
+                         N_("_Scanner/Camera..."),
+                         NULL,
+                         GIMP_PLUGIN,
+                         NUMBER_IN_ARGS,
+                         NUMBER_OUT_ARGS,
+                         args,
+                         return_vals);
+
+  gimp_plugin_menu_register (MID_SELECT, "<Image>/File/Create/Acquire");
 }
 
 /*
@@ -430,10 +341,6 @@ beginTransferCallback (pTW_IMAGEINFO imageInfo, void *clientData)
 
   pClientDataStruct theClientData = g_new (ClientDataStruct, 1);
 
-#ifdef _DEBUG
-  logBegin(imageInfo, clientData);
-#endif
-
   /* Decide on the image type */
   switch (imageInfo->PixelType)
   {
@@ -826,10 +733,6 @@ dataTransferCallback (
     pTW_IMAGEMEMXFER imageMemXfer,
     void *clientData)
 {
-#ifdef _DEBUG
-  logData(imageInfo, imageMemXfer, clientData);
-#endif
-
   /* Choose the appropriate transfer handler */
   switch (imageInfo->PixelType)
   {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]