bug-ocrad
[Top][All Lists]
Advanced

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

Re: [Bug-ocrad] OCRAD with Visual Studio 2010 success


From: Tilman Hausherr
Subject: Re: [Bug-ocrad] OCRAD with Visual Studio 2010 success
Date: Mon, 09 Aug 2010 21:36:47 +0200

On Mon, 09 Aug 2010 20:53:49 +0200, Antonio Diaz Diaz wrote:

>Hello Tilman,
>
>Tilman Hausherr wrote:
>> data[row].erase( data[row].begin(), data[row].begin() + l - left() );
>> change to:
>> data[row].erase( data[row].begin(), data[row].begin() + (l - left()) );
>
>Done. I have in fact found 3 more cases like the 5 you reported and have 
>put parentheses around all of them.
>
>
>> Insert this in main() just before the call to process_file():
>
>As I said in 
>http://lists.nongnu.org/archive/html/lzip-bug/2010-07/msg00004.html :
>-------------------------------------------------
>I would consider adding a conditional for binary mode stdin/stdout, but 
>not litter the code with a conditional per system. Text mode is a 
>bug[1], not a feature.
>
>[1] http://cygwin.com/faq.html
>"Actually there's no really good reason to do text mode processing since 
>it only slows down reading and writing files".
>-------------------------------------------------
>

>Could you please try the following code? I would prefer to solve all 
>text mode problems on Windows and OS2 with a single set of patches as I 
>have done in lzip.
>http://download.savannah.gnu.org/releases-noredirect/lzip/lzip-1.11-rc4.tar.gz
>
>#if defined(__MSVCRT__) || defined(__OS2__)
>#include <fcntl.h>
>#include <io.h>
>#endif
>...
>#if defined(__MSVCRT__) || defined(__OS2__)
>   _setmode( STDIN_FILENO, O_BINARY );
>#endif

Hello Antonio,

I can't, because both STDIN_FILENO and __MSVCRT__ don't exist, at least
not here in VS2010. Here's a list of macros:
http://msdn.microsoft.com/de-de/library/b0084kay.aspx
This is weird because I see you did use it in LZip. I use _MSC_VER which
is always defined and also tells the version.

>> replace this in main
>> 
>> if( ( control.outfile = std::fopen( outfile_name, "wx" ) ) == 0 )
>
>I have to think about this because removing the 'x' breaks --force. 
>(Files are always overwritten). Isn't there an equivalent to O_EXCL for 
>streams?

No, not in Visual C++ 2010, sadly. 
http://msdn.microsoft.com/en-us/library/yeby3zcb.aspx
That's why I suggested to check wether the file exists with _access
because the 'x' option in the fopen() makes sense.

Tilman




reply via email to

[Prev in Thread] Current Thread [Next in Thread]