[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:46:51 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=21e7622

The following commit has been merged in the master branch:
commit 21e7622f0bffa1dd3188971bafb82dd51fef1dca
Author: Robin Mills <robin at clanmills.com>
Date:   Tue Sep 6 07:29:01 2016 +0000

    #1057  Fixed src\exiv2app.hpp formatting.  Moved reading stdin from ctor to getStdin().  WIP: unsolved Windows pipe issues.
---
 src/exiv2app.hpp | 94 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 48 insertions(+), 46 deletions(-)

diff --git a/src/exiv2app.hpp b/src/exiv2app.hpp
index c5b0bd6..9131b73 100644
--- a/src/exiv2app.hpp
+++ b/src/exiv2app.hpp
@@ -292,50 +292,6 @@ private:
         yodAdjust_[yodYear]  = emptyYodAdjust_[yodYear];
         yodAdjust_[yodMonth] = emptyYodAdjust_[yodMonth];
         yodAdjust_[yodDay]   = emptyYodAdjust_[yodDay];
-
-        // copy stdin to stdinBuf
-        SET_BINARY_MODE(stdin);
-
-#if 0
-#ifdef _MSC_VER
-        // http://stackoverflow.com/questions/19955617/win32-read-from-stdin-with-timeout
-        INPUT_RECORD record;
-        DWORD        numRead;
-        if ( ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE), &record, 1, &numRead)) {
-#endif
-#endif
-
-#if defined(__APPLE__) || defined(__LINUX__)
-        // http://stackoverflow.com/questions/34479795/make-c-not-wait-for-user-input/34479916#34479916
-        fd_set                readfds;
-        FD_ZERO             (&readfds);
-        FD_SET(STDIN_FILENO, &readfds);
-        struct timeval timeout = { 0,0 };
-
-        // if we have something in the pipe, read it
-        if (select(1, &readfds, NULL, NULL, &timeout)) {
-            const int buff_size = 4*1028;
-            Exiv2::byte* bytes  = (Exiv2::byte*)::malloc(buff_size);
-            int       nBytes    = 0 ;
-            bool      more      = bytes != NULL;
-            while   ( more ) {
-                char buff[buff_size];
-                int  n     = (int) fread(buff,1,buff_size,stdin);
-                more       = n > 0 ;
-                if ( more ) {
-                    bytes      = (Exiv2::byte*) realloc(bytes,nBytes+n);
-                    memcpy(bytes+nBytes,buff,n);
-                    nBytes    += n ;
-                }
-            }
-
-            if ( nBytes ) {
-                stdinBuf.alloc(nBytes);
-                memcpy(stdinBuf.pData_,(const void*)bytes,nBytes);
-            }
-            if ( bytes != NULL ) ::free(bytes) ;
-        }
-#endif
     }
 
     //! Prevent copy-construction: not implemented.
@@ -398,8 +354,54 @@ public:
     */
     void getStdin(Exiv2::DataBuf& buf)
     {
-        buf.alloc(stdinBuf.size_);
-        memcpy(buf.pData_,stdinBuf.pData_,buf.size_);
+    if ( stdinBuf.size_ == 0 ) {
+        // copy stdin to stdinBuf
+        SET_BINARY_MODE(stdin);
+
+#if defined(_MSC_VER)
+        // http://stackoverflow.com/questions/19955617/win32-read-from-stdin-with-timeout
+        INPUT_RECORD record;
+        DWORD        numRead;
+        if ( PeekConsoleInput(GetStdHandle(STD_INPUT_HANDLE), &record, 1, &numRead)) {
+
+#elif defined(__APPLE__) || defined(__LINUX__) // || defined(__CYGWIN__)
+        // http://stackoverflow.com/questions/34479795/make-c-not-wait-for-user-input/34479916#34479916
+        fd_set                readfds;
+        FD_ZERO             (&readfds);
+        FD_SET(STDIN_FILENO, &readfds);
+        struct timeval timeout = { 0,0 };
+
+        // if we have something in the pipe, read it
+        if (select(1, &readfds, NULL, NULL, &timeout)) {
+#endif
+#if defined(__APPLE__) || defined(__LINUX__) || defined(_MSC_VER) //|| defined(__CYGWIN__)
+            const int buff_size = 4*1028;
+            Exiv2::byte* bytes  = (Exiv2::byte*)::malloc(buff_size);
+            int       nBytes    = 0 ;
+            bool      more      = bytes != NULL;
+            while   ( more ) {
+                char buff[buff_size];
+                int  n     = (int) fread(buff,1,buff_size,stdin);
+                more       = n > 0 ;
+                if ( more ) {
+                    bytes      = (Exiv2::byte*) realloc(bytes,nBytes+n);
+                    memcpy(bytes+nBytes,buff,n);
+                    nBytes    += n ;
+                }
+            }
+
+            if ( nBytes ) {
+                stdinBuf.alloc(nBytes);
+                memcpy(stdinBuf.pData_,(const void*)bytes,nBytes);
+            }
+            if ( bytes != NULL ) ::free(bytes) ;
+        }
+#endif
+    }
+        if ( stdinBuf.size_ ) {
+            buf.alloc(stdinBuf.size_);
+            memcpy(buf.pData_,stdinBuf.pData_,buf.size_);
+        }
     };
 
 }; // class Params

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list