Re: Patch for ocrad to run on Windows?

Tony Meyer <tameyer-OA6R/[email protected]>
Newsgroups gmane.mail.spam.spambayes.devel
Message-ID <[email protected]>
> Mark Hammond and Sean True both said they had an ocrad.exe  
> executable built
> under cygwin.  (Hopefully it doesn't require cygwin runtime?)

AFAIK, it will require cygwin1.dll, unless a change is also made (it  
is in the attached patch) to compile with -mno-cygwin.  This seems to  
run fine on my machine, without any of the cygwin DLLs (they are  
installed, of course, but shouldn't be accessible outside of a Cygwin  
shell).

> Was the only
> change you made to the source the "std::fprintf" -> "fprintf"  
> replacement?

Two of these, plus the Makefile.in as above.

> Ocrad is GPL'd, so all we have to do to make it available is also  
> distribute
> the modified source.  If you can stick the .exe file somewhere and  
> let me
> know if there are any Windows version restrictions, I'll put  
> together the
> requisite modified Ocrad source distribution and place both the  
> distribution
> and the executable on the SpamBayes website for Windows users to  
> try out.

Patch is attached.  .exe is at:

http://tangomu.com/ocrad.exe

I have no idea about Windows version restrictions.  My assumption  
would be it will run on any version from Win95 to WinXP (no idea  
about Vista).

=Tony.Meyer

_______________________________________________
spambayes-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-dev
ocrad.patch (application/octet-stream, 2 KB)
diff -bc ocrad-0.14/Makefile.in ocrad-0.14.patched/ocrad-0.14/Makefile.in
*** ocrad-0.14/Makefile.in	Thu Feb 16 00:24:08 2006
--- ocrad-0.14.patched/ocrad-0.14/Makefile.in	Mon Aug 14 09:23:48 2006
***************
*** 9,15 ****
  INSTALL_DATA = $(INSTALL) -p -m 644
  SHELL = /bin/sh
  CPPFLAGS =
! CXXFLAGS = -Wall -W -O2
  LDFLAGS =
  
  objs = common.o rational.o rectangle.o track.o ucs.o \
--- 9,15 ----
  INSTALL_DATA = $(INSTALL) -p -m 644
  SHELL = /bin/sh
  CPPFLAGS =
! CXXFLAGS = -Wall -W -O2 -mno-cygwin
  LDFLAGS =
  
  objs = common.o rational.o rectangle.o track.o ucs.o \
diff -bc ocrad-0.14/main.cc ocrad-0.14.patched/ocrad-0.14/main.cc
*** ocrad-0.14/main.cc	Thu Feb 16 00:22:46 2006
--- ocrad-0.14.patched/ocrad-0.14/main.cc	Thu Aug 10 22:39:48 2006
***************
*** 228,234 ****
  void Ocrad::internal_error( const char * msg ) throw()
    {
    char buf[80];
!   std::snprintf( buf, sizeof( buf ), "internal error: %s.\n", msg );
    show_error( buf );
    exit( 3 );
    }
--- 228,234 ----
  void Ocrad::internal_error( const char * msg ) throw()
    {
    char buf[80];
!   snprintf( buf, sizeof( buf ), "internal error: %s.\n", msg );
    show_error( buf );
    exit( 3 );
    }
diff -bc ocrad-0.14/rational.cc ocrad-0.14.patched/ocrad-0.14/rational.cc
*** ocrad-0.14/rational.cc	Fri Jan 27 09:14:26 2006
--- ocrad-0.14.patched/ocrad-0.14/rational.cc	Thu Aug 10 22:38:42 2006
***************
*** 209,215 ****
    bool trunc = false;
    if( prec < 0 ) { trunc = true; prec = -prec; }
  
!   index += std::snprintf( buf, bufsize, "%*d", iwidth, num / den );
    long long rest = std::abs( num ) % den;
    if( index < bufsize - 1 && prec > 0 && ( rest > 0 || !trunc ) )
      {
--- 209,215 ----
    bool trunc = false;
    if( prec < 0 ) { trunc = true; prec = -prec; }
  
!   index += snprintf( buf, bufsize, "%*d", iwidth, num / den );
    long long rest = std::abs( num ) % den;
    if( index < bufsize - 1 && prec > 0 && ( rest > 0 || !trunc ) )
      {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.