WEFAX mingw32 fixes

* Fixed mingw32 build issues caused by
    recent WEFAX additions.
pull/1/head
David Freese 2012-05-24 17:46:44 -05:00
rodzic 686e8b5df9
commit 52f27c8c3c
3 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -54,12 +54,14 @@ static void pstack(ostream& out, unsigned skip = 0);
void diediedie(void) void diediedie(void)
{ {
#ifndef __MINGW32__
// If this environment variable is set, creates a core dump. // If this environment variable is set, creates a core dump.
if( getenv("FLDIGI_COREDUMP") ) if( getenv("FLDIGI_COREDUMP") )
{ {
signal(SIGSEGV, SIG_DFL); signal(SIGSEGV, SIG_DFL);
kill(getpid(), SIGSEGV); kill(getpid(), SIGSEGV);
} }
#endif
static bool print_trace = true; static bool print_trace = true;

Wyświetl plik

@ -70,15 +70,21 @@ vector<string> split(const char* re_str, const char* str, unsigned max_split)
/// Builds a string out of a printf-style formatted vararg list. /// Builds a string out of a printf-style formatted vararg list.
string strformat( const char * fmt, ... ) string strformat( const char * fmt, ... )
{ {
struct auto_free // Automatically deleted when leaving. static const int sz_buf = 512 ;
{ char buf_usual[sz_buf];
char * _strp ;
~auto_free() { if( _strp ) free( _strp ); } va_list ap;
} ptr = { NULL }; va_start(ap, fmt);
int res = vsnprintf( buf_usual, sz_buf, fmt, ap);
va_end(ap);
if( res < 0 ) throw runtime_error(__FUNCTION__);
if( res < sz_buf ) return buf_usual ;
va_list ap; string str( res, ' ' );
va_start (ap, fmt); va_start(ap, fmt);
int res = vasprintf( &ptr._strp, fmt, ap); res = vsnprintf( &str[0], res + 1, fmt, ap);
va_end(ap);
if( res < 0 ) throw runtime_error(__FUNCTION__); if( res < 0 ) throw runtime_error(__FUNCTION__);
return ptr._strp ? string( ptr._strp, res ) : string(); return str ;
} }

Wyświetl plik

@ -46,6 +46,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <zlib.h>
#include <png.h> #include <png.h>
#include "fl_digi.h" #include "fl_digi.h"