Port to MXE / MingW

* Wefax destination directory now ended by one slash only.
  * Use PRId64 for printing long long.
  * Set right pthread library for mingw.
  * Fixed include files in debug build mode.
  * This commit does not include modifications specific to
    SYNOP commit, due to reordering of commits submitted by
    Remi during branch merging.
pull/1/head
Remi Chateauneu 2013-06-01 02:41:39 -05:00 zatwierdzone przez David Freese
rodzic 34b3baf16f
commit 3bb70e4308
10 zmienionych plików z 23 dodań i 20 usunięć

Wyświetl plik

@ -5,7 +5,8 @@ AC_DEFUN([AC_FLDIGI_NP_COMPAT], [
AM_CONDITIONAL([COMPAT_REGEX], [test "x$ac_cv_header_regex_h" != "xyes"])
if test "x$target_mingw32" = "xyes"; then
sem_libs="pthreadGC2"
# Newer versions of mingw32 comes with pthread.
sem_libs="pthreadGC2 pthread"
else
sem_libs="pthread rt"
fi

Wyświetl plik

@ -74,7 +74,7 @@ void cLogfile::log_to_file(log_t type, const string& s)
gmtime_r(&t, &tm);
strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%MZ", &tm);
char freq[20];
snprintf(freq, sizeof(freq), "%lld", wf->rfcarrier() + (wf->USB()
snprintf(freq, sizeof(freq), "%" PRId64, wf->rfcarrier() + (wf->USB()
? active_modem->get_freq()
: -active_modem->get_freq()));
const char *logmode = mode_info[active_modem->get_mode()].adif_name;

Wyświetl plik

@ -1788,13 +1788,13 @@ void set_macro_env(void)
// frequencies
char dial_freq[20];
snprintf(dial_freq, sizeof(dial_freq), "%lld", wf->rfcarrier());
snprintf(dial_freq, sizeof(dial_freq), "%" PRId64, wf->rfcarrier());
env[FLDIGI_DIAL_FREQUENCY].val = dial_freq;
char audio_freq[6];
snprintf(audio_freq, sizeof(audio_freq), "%d", active_modem->get_freq());
env[FLDIGI_AUDIO_FREQUENCY].val = audio_freq;
char freq[20];
snprintf(freq, sizeof(freq), "%lld", wf->rfcarrier() + (wf->USB()
snprintf(freq, sizeof(freq), "%" PRId64, wf->rfcarrier() + (wf->USB()
? active_modem->get_freq()
: -active_modem->get_freq()));
env[FLDIGI_FREQUENCY].val = freq;

Wyświetl plik

@ -76,7 +76,7 @@ int get_ui_lang(const char* homedir)
string::size_type u = string::npos;
while (in >> lang) {
if (lang[0] != '\n' & lang[0] != '#' && (u = lang.find('_')) != string::npos)
if ( (lang[0] != '\n') & (lang[0] != '#') && ( (u = lang.find('_')) != string::npos) )
break;
}
in.close();

Wyświetl plik

@ -391,7 +391,7 @@ long long rigCAT_getfreq(int retries, bool &failed)
f = fm_freqdata(rTemp.data, pData);
if ( f >= rTemp.data.min && f <= rTemp.data.max)
return f;
LOG_VERBOSE("freq: %lld", f);
LOG_VERBOSE("freq: %" PRId64, f);
retry_get_freq: ;
}
}

Wyświetl plik

@ -339,7 +339,7 @@ void notify_change_callsign(void)
void notify_rsid(trx_mode mode, int afreq)
{
const char* mode_name = mode_info[mode].name;
regmatch_t sub[2] = { { 0, strlen(mode_name) } };
regmatch_t sub[2] = { { 0, (regoff_t)strlen(mode_name) } };
sub[1] = sub[0];
for (notify_list_t::iterator i = notify_list.begin(); i != notify_list.end(); ++i)
if (i->event == NOTIFY_EVENT_RSID)
@ -1253,7 +1253,7 @@ static void notify_test_cb(Fl_Widget* w, void* arg)
if (notify_tmp.event == NOTIFY_EVENT_RSID) {
notify_tmp.mode = active_modem->get_mode();
regmatch_t sub[2] = { { 0, strlen(mode_info[notify_tmp.mode].name) } };
regmatch_t sub[2] = { { 0, (regoff_t)strlen(mode_info[notify_tmp.mode].name) } };
sub[1] = sub[0];
notify_recv(notify_tmp.mode, active_modem->get_freq(),
mode_info[notify_tmp.mode].name, sub, 2, &notify_tmp);

Wyświetl plik

@ -404,7 +404,7 @@ void pskrep::append(string call, const char* loc, long long freq, trx_mode mode,
band_map_t& bandq = queue[call][band(freq)];
if (bandq.empty() || rtime - bandq.back().rtime >= DUP_INTERVAL) { // add new
bandq.push_back(rcpt_report_t(mode, freq, rtime, rtype, loc));
LOG_VERBOSE("Added (call=\"%s\", loc=\"%s\", mode=\"%s\", freq=%lld, time=%jd, type=%u)",
LOG_VERBOSE("Added (call=\"%s\", loc=\"%s\", mode=\"%s\", freq=%" PRId64 ", time=%" PRIdMAX ", type=%u)",
call.c_str(), loc, mode_info[mode].adif_name, freq, (intmax_t)rtime, rtype);
new_count++;
save_queue();
@ -414,7 +414,7 @@ void pskrep::append(string call, const char* loc, long long freq, trx_mode mode,
if (r.status != PSKR_STATUS_SENT && *loc && r.locator != loc) { // update last
r.locator = loc;
r.rtype = rtype;
LOG_VERBOSE("Updated (call=\"%s\", loc=\"%s\", mode=\"%s\", freq=%lld, time=%jd, type=%u)",
LOG_VERBOSE("Updated (call=\"%s\", loc=\"%s\", mode=\"%s\", freq=%" PRId64 ", time=%" PRIdMAX ", type=%u)",
call.c_str(), loc, mode_info[r.mode].adif_name, r.freq, (intmax_t)r.rtime, rtype);
save_queue();
}
@ -732,7 +732,7 @@ bool pskrep_sender::append(const string& callsign, const band_map_t::value_type&
return false;
LOG_INFO("Appending report (call=%s mode=%s freq=%lld time=%jd type=%u)",
LOG_INFO("Appending report (call=%s mode=%s freq=%" PRId64 " time=%" PRIdMAX " type=%u)",
callsign.c_str(), mode_info[r.mode].adif_name, r.freq, (intmax_t)r.rtime, r.rtype);
unsigned char* start = dgram + dgram_size;

Wyświetl plik

@ -678,13 +678,15 @@ static void wefax_cb_pic_rx_auto_center( Fl_Widget *, void *)
}
/// This gets the directory where images are accessed by default.
static const std::string & default_dir_get( const std::string & config_dir )
static std::string default_dir_get( const std::string & config_dir )
{
if( config_dir.empty() ) {
return PicsDir ;
} else {
return config_dir ;
std::string tmp_dir = config_dir.empty() ? PicsDir : config_dir ;
/// Valid dir names must end with a slash.
if( ! tmp_dir.empty() ) {
char termin = tmp_dir[ tmp_dir.size() - 1 ];
if( ( termin != '/' ) && ( termin != '\\' ) ) tmp_dir += '/';
}
return tmp_dir ;
}
/// This sets the directory where images are accessed by default.

Wyświetl plik

@ -846,7 +846,7 @@ public:
/// If the delay is exceeded, returns with an error message.
std::string send_file( const std::string & filnam, double max_seconds )
{
LOG_INFO("%s rf_carried=%lld carrier=%d", filnam.c_str(), wf->rfcarrier(), m_carrier );
LOG_INFO("%s rf_carried=%" PRId64 " carrier=%d", filnam.c_str(), wf->rfcarrier(), m_carrier );
bool is_acquired = transmit_lock_acquire(filnam, max_seconds);
if( ! is_acquired ) return "Timeout sending " + filnam ;
@ -1237,7 +1237,7 @@ public:
{
/// Displays the messages once only.
if( total_img_rows != 0 ) {
LOG_INFO("Setting m_carrier=%d curr_rfcarr=%lld total_img_rows=%d",
LOG_INFO("Setting m_carrier=%d curr_rfcarr=%" PRId64 " total_img_rows=%d",
m_carrier, curr_rfcarr, total_img_rows );
}
total_img_rows = 0 ;
@ -1680,7 +1680,7 @@ std::string fax_implementation::generate_filename( const char *extra_msg ) const
char buf_fil_nam[256] ;
long long tmp_fl = wf->rfcarrier() ;
snprintf( buf_fil_nam, sizeof(buf_fil_nam),
"wefax_%04d%02d%02d_%02d%02d%02d_%lld_%s.png",
"wefax_%04d%02d%02d_%02d%02d%02d_%" PRId64 "_%s.png",
1900 + tmp_tm.tm_year,
1 + tmp_tm.tm_mon,
tmp_tm.tm_mday,

Wyświetl plik

@ -263,7 +263,7 @@ void FTextRX::add(unsigned int c, int attr)
if (c == '\r')
return;
char s[] = { '\0', '\0', FTEXT_DEF + attr, '\0' };
char s[] = { '\0', '\0', char( FTEXT_DEF + attr ), '\0' };
const char *cp = &s[0];
// The user may have moved the cursor by selecting text or