Browse Source

pass files from main to formats as QStrings respecting the local encoding.

tags/gpsbabel_1_5_4
tsteven4 4 years ago
parent
commit
15f8b8b6ec
100 changed files with 393 additions and 383 deletions
  1. 2
    2
      alan.cc
  2. 2
    2
      an1.cc
  3. 3
    8
      bcr.cc
  4. 4
    4
      brauniger_iq.cc
  5. 10
    11
      bushnell.cc
  6. 6
    4
      bushnell_trl.cc
  7. 2
    2
      compegps.cc
  8. 1
    1
      cst.cc
  9. 2
    2
      defs.h
  10. 12
    12
      delbin.cc
  11. 2
    2
      delgpl.cc
  12. 2
    2
      destinator.cc
  13. 6
    6
      dg-100.cc
  14. 2
    2
      dmtlog.cc
  15. 3
    3
      easygps.cc
  16. 1
    1
      energympro.cc
  17. 2
    2
      enigma.cc
  18. 10
    11
      exif.cc
  19. 2
    2
      f90g_track.cc
  20. 1
    1
      g7towin.cc
  21. 12
    9
      garmin.cc
  22. 1
    1
      garmin_fit.cc
  23. 2
    2
      garmin_gpi.cc
  24. 2
    2
      garmin_txt.cc
  25. 1
    1
      garmin_xt.cc
  26. 2
    1
      gbfile.cc
  27. 2
    2
      gdb.cc
  28. 2
    2
      geo.cc
  29. 4
    3
      ggv_bin.cc
  30. 2
    2
      ggv_log.cc
  31. 3
    3
      ggv_ovl.cc
  32. 5
    5
      globalsat_sport.cc
  33. 2
    2
      glogbook.cc
  34. 2
    2
      gnav_trl.cc
  35. 4
    3
      google.cc
  36. 1
    1
      googledir.cc
  37. 9
    11
      gopal.cc
  38. 6
    14
      gpssim.cc
  39. 2
    2
      gpsutil.cc
  40. 2
    2
      gpx.cc
  41. 2
    2
      gtm.cc
  42. 2
    2
      gtrnctr.cc
  43. 2
    2
      hiketech.cc
  44. 2
    2
      holux.cc
  45. 1
    1
      html.cc
  46. 2
    2
      humminbird.cc
  47. 3
    3
      igc.cc
  48. 2
    2
      ignrando.cc
  49. 2
    2
      igo8.cc
  50. 1
    1
      ik3d.cc
  51. 10
    10
      itracku.cc
  52. 1
    1
      jogmap.cc
  53. 2
    2
      jtr.cc
  54. 11
    13
      kml.cc
  55. 2
    2
      lmx.cc
  56. 2
    2
      lowranceusr.cc
  57. 2
    2
      lowranceusr4.cc
  58. 2
    2
      maggeo.cc
  59. 22
    21
      magproto.cc
  60. 32
    10
      main.cc
  61. 2
    2
      mapasia.cc
  62. 1
    1
      mapbar_track.cc
  63. 2
    2
      mapfactor.cc
  64. 2
    2
      mapsend.cc
  65. 13
    12
      mapsource.cc
  66. 2
    2
      mmo.cc
  67. 7
    7
      mtk_locus.cc
  68. 11
    11
      mtk_logger.cc
  69. 1
    1
      mynav.cc
  70. 3
    3
      navicache.cc
  71. 2
    2
      naviguide.cc
  72. 6
    6
      navilink.cc
  73. 2
    2
      navitel.cc
  74. 1
    1
      netstumbler.cc
  75. 12
    9
      nmea.cc
  76. 2
    2
      nmn4.cc
  77. 2
    2
      osm.cc
  78. 18
    23
      ozi.cc
  79. 2
    2
      pcx.cc
  80. 2
    2
      pocketfms_bc.cc
  81. 2
    2
      pocketfms_fp.cc
  82. 2
    2
      pocketfms_wp.cc
  83. 2
    2
      psitrex.cc
  84. 1
    1
      random.cc
  85. 3
    3
      raymarine.cc
  86. 2
    2
      saroute.cc
  87. 1
    1
      sbn.cc
  88. 1
    1
      sbp.cc
  89. 14
    13
      shape.cc
  90. 2
    2
      skyforce.cc
  91. 9
    11
      skytraq.cc
  92. 2
    2
      stmsdf.cc
  93. 2
    2
      stmwpp.cc
  94. 1
    1
      subrip.cc
  95. 1
    1
      tef_xml.cc
  96. 1
    1
      teletype.cc
  97. 4
    4
      text.cc
  98. 2
    2
      tiger.cc
  99. 2
    2
      tmpro.cc
  100. 0
    0
      tomtom.cc

+ 2
- 2
alan.cc View File

@@ -959,7 +959,7 @@ static void trl_write(void)

/**************************************************************************/

static void alan_rd_init(const char* fname)
static void alan_rd_init(const QString& fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
@@ -971,7 +971,7 @@ static void alan_rd_deinit(void)
}


static void alan_wr_init(const char* fname)
static void alan_wr_init(const QString& fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}

+ 2
- 2
an1.cc View File

@@ -1190,7 +1190,7 @@ Init_Road_Changes(void)
}

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
infile = gbfopen_le(fname, "rb", MYNAME);
}
@@ -1211,7 +1211,7 @@ my_read(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
outfile = gbfopen_le(fname, "wb", MYNAME);
Init_Output_Type();

+ 3
- 8
bcr.cc View File

@@ -50,7 +50,6 @@
*/

static gbfile* fout;
static char* filename;
static int curr_rte_num, target_rte_num;
static double radius;
static inifile_t* ini;
@@ -191,10 +190,9 @@ bcr_init_radius(void)
}

static void
bcr_rd_init(const char* fname)
bcr_rd_init(const QString& fname)
{
filename = xstrdup(fname);
ini = inifile_init(fname, MYNAME);
ini = inifile_init(qPrintable(fname), MYNAME);
if (ini->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
}
@@ -205,7 +203,6 @@ static void
bcr_rd_deinit(void)
{
inifile_done(ini);
xfree(filename);
}

/* ------------------------------------------------------------*/
@@ -337,9 +334,8 @@ bcr_data_read(void)
/* %%% bcr write support %%% ----------------------------------- */

static void
bcr_wr_init(const char* fname)
bcr_wr_init(const QString& fname)
{
filename = xstrdup(fname);
fout = gbfopen(fname, "wb", MYNAME);
bcr_init_radius();
}
@@ -348,7 +344,6 @@ static void
bcr_wr_deinit(void)
{
gbfclose(fout);
xfree(filename);
}

static void

+ 4
- 4
brauniger_iq.cc View File

@@ -56,13 +56,13 @@ inline state_t operator++(state_t& rs, int)

static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 };

static void rd_init(const char* fname)
static void rd_init(const QString& fname)
{
if (serial_handle = gbser_init(fname), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", fname);
if (serial_handle = gbser_init(qPrintable(fname)), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", qPrintable(fname));
}
if (gbser_set_port(serial_handle, 9600, 8, 0, 1) != gbser_OK) {
fatal(MYNAME ": Can't configure port '%s'\n", fname);
fatal(MYNAME ": Can't configure port '%s'\n", qPrintable(fname));
}
}


+ 10
- 11
bushnell.cc View File

@@ -22,10 +22,11 @@

#include "defs.h"
#include <math.h>
#include <QtCore/QFileInfo>
#define MYNAME "Bushnell"

static gbfile* file_in;
static char* ofname;
static QString ofname;
static short_handle mkshort_handle = NULL;

static
@@ -156,7 +157,7 @@ bushnell_get_name_from_symbol(signed int s)
}

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
@@ -168,20 +169,18 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
char* dot, *slash;
static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
".-/\\~@#$%^&*()_+=<>"
"abcdefghijklmnopqrstuvwxyz";

ofname = xstrdup(fname);

// If user provided an extension in the pathname, whack it.
dot = strrchr(ofname, '.');
slash = strrchr(ofname, GB_PATHSEP);
if (dot > slash) {
*dot = 0;
ofname = fname;
int suffix_len = QFileInfo(fname).suffix().length();
if (suffix_len > 0) {
/* drop the suffix and the period */
ofname.chop(suffix_len + 1);
}

mkshort_handle = mkshort_new_handle();
@@ -193,7 +192,7 @@ static void
wr_deinit(void)
{
mkshort_del_handle(&mkshort_handle);
xfree(ofname);
ofname.clear();
}

/*

+ 6
- 4
bushnell_trl.cc View File

@@ -34,7 +34,7 @@ arglist_t bushnell_args[] = {
};

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
char h[0x14]; // Believed to be zero terminated.
file_in = gbfopen_le(fname, "rb", MYNAME);
@@ -53,15 +53,17 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
int i,l = strlen(fname);
int i;
int l = fname.length();
char obuf[20] = { 0 } ;
char* p = obuf;
file_out = gbfopen_le(fname, "w", MYNAME);
trkpt_count = 0;
QString fnameu = fname.toUpper();
for (i = 0; (i < l) && (i < 20); i++) {
char c = toupper(fname[i]);
char c = fnameu[i].toLatin1();
if (isalnum(c)) {
*p++ = c;
}

+ 2
- 2
compegps.cc View File

@@ -377,7 +377,7 @@ parse_rte_info(const char* buff, route_head* route) /* "R" */
/* main functions */

static void
compegps_rd_init(const char* fname)
compegps_rd_init(const QString& fname)
{
fin = gbfopen(fname, "rb", MYNAME);
input_datum = DATUM_WGS84;
@@ -612,7 +612,7 @@ write_waypoints(void)
/* --------------------------------------------------------------------------- */

static void
compegps_wr_init(const char* fname)
compegps_wr_init(const QString& fname)
{
fout = gbfopen(fname, "w", MYNAME);
sh = mkshort_new_handle();

+ 1
- 1
cst.cc View File

@@ -136,7 +136,7 @@ cst_make_url(char* str)
/* --------------------------------------------------------------------------- */

static void
cst_rd_init(const char* fname)
cst_rd_init(const QString& fname)
{
fin = gbfopen(fname, "rb", MYNAME);
temp_route = NULL;

+ 2
- 2
defs.h View File

@@ -605,7 +605,7 @@ typedef struct {

extern posn_status tracking_status;

typedef void (*ff_init)(char const*);
typedef void (*ff_init)(const QString&);
typedef void (*ff_deinit)(void);
typedef void (*ff_read)(void);
typedef void (*ff_write)(void);
@@ -978,7 +978,7 @@ char* convert_human_date_format(const char* human_datef); /* "MM,YYYY,DD" -> "%m
char* convert_human_time_format(const char* human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */
char* pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */

const char* get_filename(const char* fname); /* extract the filename portion */
const QString get_filename(const QString& fname); /* extract the filename portion */

/*
* Character encoding transformations.

+ 12
- 12
delbin.cc View File

@@ -63,7 +63,7 @@ added in the PN-40 2.5 firmware.
//-----------------------------------------------------------------------------
// interface to platform-specific device I/O
typedef struct {
void (*init)(const char* name);
void (*init)(const QString& name);
void (*deinit)(void);
unsigned(*packet_read)(void*);
unsigned(*packet_write)(const void*, unsigned);
@@ -2298,7 +2298,7 @@ delbin_list_units()
}

static void
delbin_rw_init(const char* fname)
delbin_rw_init(const QString& fname)
{
message_t m;
char buf[256];
@@ -2350,8 +2350,8 @@ delbin_rw_init(const char* fname)
}
message_free(&m);

if (strlen(fname) > 4) {
if (0 == strcmp(fname+4, "list")) {
if (fname.length() > 4) {
if (fname.mid(4,4) == "list") {
delbin_list_units();
exit(1);
}
@@ -2465,7 +2465,7 @@ ff_vecs_t delbin_vecs = {
static HANDLE hid_handle;

static void
win_os_init(const char* fname)
win_os_init(const QString& fname)
{
GUID hid_guid;
HDEVINFO dev_info;
@@ -2630,7 +2630,7 @@ interrupt_report_cb(void* target, IOReturn result, void* refcon, void* sender, U
}

static void
mac_os_init(const char* fname)
mac_os_init(const QString& fname)
{
CFMutableDictionaryRef dict = IOServiceMatching(kIOHIDDeviceKey);
io_service_t service;
@@ -2749,7 +2749,7 @@ static int endpoint_in;
static int endpoint_out;

static void
libusb_os_init(const char* fname)
libusb_os_init(const QString& fname)
{
struct usb_bus* bus;
const struct usb_endpoint_descriptor* endpoint_desc;
@@ -2861,7 +2861,7 @@ static int fd_hiddev;
static int linuxhid_os_init_status;

static void
linuxhid_os_init(const char* fname)
linuxhid_os_init(const QString& fname)
{
struct hidraw_devinfo info;
struct hiddev_field_info finfo;
@@ -2869,8 +2869,8 @@ linuxhid_os_init(const char* fname)
struct dirent* d;

fd_hidraw = fd_hiddev = -1;
if (fname && memcmp(fname, "hid:", 4) == 0) {
char* raw_name = xstrdup(fname + 4);
if (fname.startsWith("hid:")) {
char* raw_name = xstrdup(qPrintable(fname.mid(4)));
char* dev_name = strchr(raw_name, ',');
if (dev_name == NULL) {
fatal(MYNAME ": missing hiddev path\n");
@@ -2997,7 +2997,7 @@ static const delbin_os_ops_t linuxhid_os_ops = {
};

static void
linux_os_init(const char* fname)
linux_os_init(const QString& fname)
{
// tell linuxhid_os_init not to exit
linuxhid_os_init_status = 1;
@@ -3030,7 +3030,7 @@ delbin_os_ops_t delbin_os_ops = {
// stubs
#if !(HAVE_WDK || __APPLE__ || HAVE_LIBUSB || HAVE_LINUX_HID)
static void
stub_os_init(const char* fname)
stub_os_init(const QString& fname)
{
fatal(MYNAME ": OS not supported\n");
}

+ 2
- 2
delgpl.cc View File

@@ -39,7 +39,7 @@ static gbfile* gplfile_in;
static gbfile* gplfile_out;

static void
gpl_rd_init(const char* fname)
gpl_rd_init(const QString& fname)
{
gplfile_in = gbfopen_le(fname, "rb", MYNAME);
if (sizeof(struct gpl_point) != 56) {
@@ -107,7 +107,7 @@ gpl_rd_deinit(void)
}

static void
gpl_wr_init(const char* fname)
gpl_wr_init(const QString& fname)
{
gplfile_out = gbfopen_le(fname, "wb", MYNAME);
}

+ 2
- 2
destinator.cc View File

@@ -481,7 +481,7 @@ destinator_rtept_disp(const Waypoint* wpt)
*******************************************************************************/

static void
destinator_rd_init(const char* fname)
destinator_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}
@@ -514,7 +514,7 @@ destinator_read_trk_wrapper(void)
}

static void
destinator_wr_init(const char* fname)
destinator_wr_init(const QString& fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}

+ 6
- 6
dg-100.cc View File

@@ -710,13 +710,13 @@ arglist_t dg100_args[] = {
*******************************************************************************/

static void
common_rd_init(const char* fname)
common_rd_init(const QString& fname)
{
if (serial_handle = gbser_init(fname), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", fname);
if (serial_handle = gbser_init(qPrintable(fname)), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", qPrintable(fname));
}
if (gbser_set_speed(serial_handle, model->speed) != gbser_OK) {
fatal(MYNAME ": Can't configure port '%s'\n", fname);
fatal(MYNAME ": Can't configure port '%s'\n", qPrintable(fname));
}
// Toss anything that came in before our speed was set, particularly
// for the bluetooth BT-335 product.
@@ -724,7 +724,7 @@ common_rd_init(const char* fname)
}

static void
dg100_rd_init(const char* fname)
dg100_rd_init(const QString& fname)
{
static const model_t dg100_model = { "DG-100", 115200, 1, 1, dg100_commands, sizeof(dg100_commands) / sizeof(struct dg100_command) };
model = &dg100_model;
@@ -732,7 +732,7 @@ dg100_rd_init(const char* fname)
}

static void
dg200_rd_init(const char* fname)
dg200_rd_init(const QString& fname)
{
static const model_t dg200_model = { "DG-200", 230400, 0, 0, dg200_commands, sizeof(dg200_commands) / sizeof(struct dg100_command) };
model = &dg200_model;

+ 2
- 2
dmtlog.cc View File

@@ -672,7 +672,7 @@ read_XML(void)
*******************************************************************************/

static void
dmtlog_rd_init(const char* fname)
dmtlog_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);

@@ -718,7 +718,7 @@ dmtlog_read(void)
}

static void
dmtlog_wr_init(const char* fname)
dmtlog_wr_init(const QString& fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}

+ 3
- 3
easygps.cc View File

@@ -37,7 +37,7 @@ arglist_t easygps_args[] = {
};

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
int sz;
char ibuf[100] = {'0'} ;
@@ -50,7 +50,7 @@ rd_init(const char* fname)
if ((sz < 52) ||
strncmp(ibuf, ezsig, sizeof(ezsig)-1) ||
(ibuf[51] != 'W')) {
fatal(MYNAME ": %s is not an EasyGPS file.\n", fname);
fatal(MYNAME ": %s is not an EasyGPS file.\n", qPrintable(fname));
}
}

@@ -61,7 +61,7 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
mkshort_handle = mkshort_new_handle();

+ 1
- 1
energympro.cc View File

@@ -206,7 +206,7 @@ read_lap(void)
//*******************************************************************************

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
if (global_opts.debug_level > 1) {
printf (MYNAME " rd_deinit()\n");

+ 2
- 2
enigma.cc View File

@@ -76,7 +76,7 @@ typedef struct enigma_wpt {
static gbfile* file_in, *file_out;

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
@@ -154,7 +154,7 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
}

+ 10
- 11
exif.cc View File

@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <QtCore/QFile>

#define MYNAME "exif"

@@ -135,7 +136,7 @@ static exif_app_t* exif_app;
const Waypoint* exif_wpt_ref;
time_t exif_time_ref;
static char exif_success;
static char* exif_fout_name;
static QString exif_fout_name;

static char* opt_filename, *opt_overwrite, *opt_frame, *opt_name;

@@ -1340,7 +1341,7 @@ exif_write_apps(void)
*******************************************************************************/

static void
exif_rd_init(const char* fname)
exif_rd_init(const QString& fname)
{
fin = gbfopen_be(fname, "rb", MYNAME);
QUEUE_INIT(&exif_apps);
@@ -1373,12 +1374,12 @@ exif_read(void)
}

static void
exif_wr_init(const char* fname)
exif_wr_init(const QString& fname)
{
uint16_t soi;

exif_success = 0;
exif_fout_name = xstrdup(fname);
exif_fout_name = fname;

QUEUE_INIT(&exif_apps);

@@ -1405,23 +1406,21 @@ exif_wr_init(const char* fname)
static void
exif_wr_deinit(void)
{
char* tmpname;

exif_release_apps();
tmpname = xstrdup(fout->name);
QString tmpname = QString::fromLocal8Bit(fout->name);
gbfclose(fout);

if (exif_success) {
if (*opt_overwrite == '1') {
remove(exif_fout_name);
rename(tmpname, exif_fout_name);
QFile::remove(exif_fout_name);
QFile::rename(tmpname, exif_fout_name);
}
} else {
remove(tmpname);
QFile::remove(tmpname);
}

xfree(exif_fout_name);
xfree(tmpname);
exif_fout_name.clear();
}

static void

+ 2
- 2
f90g_track.cc View File

@@ -51,7 +51,7 @@ arglist_t f90g_track_args[] = {
*******************************************************************************/
#define VALIDHEADER "MEDIA 1."
static void
f90g_track_rd_init(const char* fname)
f90g_track_rd_init(const QString& fname)
{
char header[HEADERRECORDSIZE];

@@ -70,7 +70,7 @@ f90g_track_rd_init(const char* fname)
// start the track list
track = route_head_alloc();
is_fatal((track == NULL), MYNAME ": memory non-enough");
track->rte_name = QString::fromLatin1(fname);
track->rte_name = fname;
track_add_head(track);
}
}

+ 1
- 1
g7towin.cc View File

@@ -389,7 +389,7 @@ parse_categories(char* buff)
/* main functions */

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
fin = gbfopen(fname, "rb", MYNAME);


+ 12
- 9
garmin.cc View File

@@ -110,7 +110,7 @@ static int d103_icon_number_from_symbol(const QString& s);


static void
rw_init(const char* fname)
rw_init(const QString& fname)
{
int receiver_short_length;
int receiver_must_upper = 1;
@@ -130,7 +130,7 @@ rw_init(const char* fname)
GPS_Enable_Error();

if (poweroff) {
GPS_Command_Off(fname);
GPS_Command_Off(qPrintable(fname));
return;
}

@@ -140,7 +140,7 @@ rw_init(const char* fname)
* an affected unit.
*/
if (resettime) {
GPS_Command_Send_Time(fname, current_time().toTime_t());
GPS_Command_Send_Time(qPrintable(fname), current_time().toTime_t());
return;
}

@@ -162,10 +162,10 @@ rw_init(const char* fname)
}
}

if (GPS_Init(fname) < 0) {
fatal(MYNAME ":Can't init %s\n", fname);
if (GPS_Init(qPrintable(fname)) < 0) {
fatal(MYNAME ":Can't init %s\n", qPrintable(fname));
}
portname = fname;
portname = xstrdup(qPrintable(fname));

if (baud && baud != DEFAULT_BAUD) {
if (0 == GPS_Set_Baud_Rate(portname, baud)) {
@@ -327,7 +327,7 @@ rw_init(const char* fname)
}

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
if (setjmp(gdx_jmp_buf)) {
const char* vec_opts = NULL;
@@ -352,6 +352,9 @@ rw_deinit(void)
if (mkshort_handle) {
mkshort_del_handle(&mkshort_handle);
}

xfree(portname);
portname = NULL;
}

static int
@@ -774,10 +777,10 @@ pvt2wpt(GPS_PPvt_Data pvt, Waypoint* wpt)
static gpsdevh* pvt_fd;

static void
pvt_init(const char* fname)
pvt_init(const QString& fname)
{
rw_init(fname);
GPS_Command_Pvt_On(fname, &pvt_fd);
GPS_Command_Pvt_On(qPrintable(fname), &pvt_fd);
}

static Waypoint*

+ 1
- 1
garmin_fit.cc View File

@@ -59,7 +59,7 @@ static gbfile* fin;
*******************************************************************************/

static void
fit_rd_init(const char* fname)
fit_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}

+ 2
- 2
garmin_gpi.cc View File

@@ -1433,7 +1433,7 @@ load_bitmap_from_file(const char* fname, unsigned char** data, int* data_sz)
*******************************************************************************/

static void
garmin_gpi_rd_init(const char* fname)
garmin_gpi_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
rdata = new reader_data_t;
@@ -1455,7 +1455,7 @@ garmin_gpi_rd_init(const char* fname)


static void
garmin_gpi_wr_init(const char* fname)
garmin_gpi_wr_init(const QString& fname)
{
int i;


+ 2
- 2
garmin_txt.cc View File

@@ -753,7 +753,7 @@ track_disp_wpt_cb(const Waypoint* wpt)
*******************************************************************************/

static void
garmin_txt_wr_init(const char* fname)
garmin_txt_wr_init(const QString& fname)
{
const char* grid_str;

@@ -1343,7 +1343,7 @@ parse_track_waypoint(void)
/***************************************************************/

static void
garmin_txt_rd_init(const char* fname)
garmin_txt_rd_init(const QString& fname)
{
memset(&gtxt_flags, 0, sizeof(gtxt_flags));


+ 1
- 1
garmin_xt.cc View File

@@ -72,7 +72,7 @@ arglist_t format_garmin_xt_args[] = {
* %%% Reader callbacks %%% *
*******************************************************************************/
static void
format_garmin_xt_rd_init(const char* fname)
format_garmin_xt_rd_init(const QString& fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}

+ 2
- 1
gbfile.cc View File

@@ -538,7 +538,8 @@ gbfopen(const QString filename, const char* mode, const char* module)
file->fileungetc = memapi_ungetc;
file->filewrite = memapi_write;
} else {
file->name = xstrdup(filename);
/* Be careful to convert back to local8Bit for these c based APIS */
file->name = xstrdup(qPrintable(filename));
file->is_pipe = (filename == "-");

/* Do we have a '.gz' extension in the filename ? */

+ 2
- 2
gdb.cc View File

@@ -1004,7 +1004,7 @@ read_track(void)
/*******************************************************************************/

static void
gdb_rd_init(const char* fname)
gdb_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
ftmp = gbfopen_le(NULL, "wb", MYNAME);
@@ -1773,7 +1773,7 @@ write_track_cb(const route_head* trk)
/*-----------------------------------------------------------------------------*/

static void
gdb_wr_init(const char* fname)
gdb_wr_init(const QString& fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
ftmp = gbfopen_le(NULL, "wb", MYNAME);

+ 2
- 2
geo.cc View File

@@ -95,7 +95,7 @@ void GeoReadLoc()
}

static void
geo_rd_init(const char* fname)
geo_rd_init(const QString& fname)
{
geo_read_fname = fname;
}
@@ -157,7 +157,7 @@ geo_rd_deinit(void)
}

static void
geo_wr_init(const char* fname)
geo_wr_init(const QString& fname)
{
ofd = gbfopen(fname, "w", MYNAME);


+ 4
- 3
ggv_bin.cc View File

@@ -481,14 +481,15 @@ ggv_bin_read_file(QDataStream& stream)
}

static void
ggv_bin_read_init(const char* fname)
ggv_bin_read_init(const QString& fname)
{
read_fname = QString::fromUtf8(fname);
read_fname = fname;
}

static void
ggv_bin_read_deinit(void)
{
read_fname.clear();
}

static void
@@ -497,7 +498,7 @@ ggv_bin_read(void)
QFile file(read_fname);

if (!file.open(QIODevice::ReadOnly)) {
fatal(MYNAME ": Error opening file %s\n", read_fname.toStdString().c_str());
fatal(MYNAME ": Error opening file %s\n", qPrintable(read_fname));
}

QDataStream stream(&file);

+ 2
- 2
ggv_log.cc View File

@@ -44,7 +44,7 @@ arglist_t ggv_log_args[] = {
*******************************************************************************/

static void
ggv_log_rd_init(const char* fname)
ggv_log_rd_init(const QString& fname)
{
static char magic[32];
int len = 0;
@@ -190,7 +190,7 @@ ggv_log_read(void)
}

static void
ggv_log_wr_init(const char* fname)
ggv_log_wr_init(const QString& fname)
{
fout = gbfopen(fname, "wb", MYNAME);


+ 3
- 3
ggv_ovl.cc View File

@@ -80,9 +80,9 @@ static OVL_COLOR_TYP color;
*******************************************************************************/

static void
ggv_ovl_rd_init(const char* fname)
ggv_ovl_rd_init(const QString& fname)
{
inifile = inifile_init(fname, MYNAME);
inifile = inifile_init(qPrintable(fname), MYNAME);
if (inifile->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
}
@@ -214,7 +214,7 @@ static int get_direction(const Waypoint* A, const Waypoint* B);
/* -----------------------------------------------------------------------*/

static void
ggv_ovl_wr_init(const char* fname)
ggv_ovl_wr_init(const QString& fname)
{
fout = gbfopen(fname, "w", MYNAME);


+ 5
- 5
globalsat_sport.cc View File

@@ -406,7 +406,7 @@ globalsat_probe_device()
}

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
if (global_opts.debug_level > 1) {
printf(MYNAME " rd_init()\n");
@@ -422,23 +422,23 @@ rd_init(const char* fname)
}
}
if (!opt_input_dump_file) {
serial_init(fname);
serial_init(qPrintable(fname));
} else {
// read from dump-file instead of serial
in_file = gbfopen(fname, "r", MYNAME);
is_fatal(!in_file, "Could not open dumpfile for input: %s", fname);
is_fatal(!in_file, "Could not open dumpfile for input: %s", qPrintable(fname));

}
globalsat_probe_device();
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
if (global_opts.debug_level > 1) {
printf(MYNAME " wr_init()\n");
}
serial_init(fname);
serial_init(qPrintable(fname));
}



+ 2
- 2
glogbook.cc View File

@@ -61,7 +61,7 @@ static xg_tag_mapping gl_map[] = {
};

static void
glogbook_rd_init(const char* fname)
glogbook_rd_init(const QString& fname)
{
xml_init(fname, gl_map, NULL);
}
@@ -79,7 +79,7 @@ glogbook_rd_deinit(void)
}

static void
glogbook_wr_init(const char* fname)
glogbook_wr_init(const QString& fname)
{
ofd = gbfopen(fname, "w", MYNAME);
writer.setAutoFormatting(true);

+ 2
- 2
gnav_trl.cc View File

@@ -43,13 +43,13 @@ static gbfile* fin, *fout;
*******************************************************************************/

static void
gnav_trl_rd_init(const char* fname)
gnav_trl_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}

static void
gnav_trl_rw_init(const char* fname)
gnav_trl_rw_init(const QString& fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}

+ 4
- 3
google.cc View File

@@ -30,7 +30,7 @@ static QString script;
static route_head** routehead;
static int* routecount;
static short_handle desc_handle;
static const char* rd_fname;
static QString rd_fname;

static int serial = 0;

@@ -231,7 +231,7 @@ void goog_poly_e(xg_string args, const QXmlStreamAttributes*)
}

static void
google_rd_init(const char* fname)
google_rd_init(const QString& fname)
{
rd_fname = fname;

@@ -244,7 +244,7 @@ google_rd_init(const char* fname)
static void
goog_read_file(void)
{
QFile src(QString::fromUtf8(rd_fname));
QFile src(rd_fname);

src.open(QIODevice::ReadOnly);

@@ -538,6 +538,7 @@ google_rd_deinit(void)
{
xml_deinit();
mkshort_del_handle(&desc_handle);
rd_fname.clear();
}

ff_vecs_t google_vecs = {

+ 1
- 1
googledir.cc View File

@@ -130,7 +130,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes*)
}

static void
google_rd_init(const char* fname)
google_rd_init(const QString& fname)
{
desc_handle = mkshort_new_handle();
setshort_length(desc_handle, 12);

+ 9
- 11
gopal.cc View File

@@ -100,11 +100,9 @@ int gopal_check_line(char* line)
*******************************************************************************/

static void
gopal_rd_init(const char* fname)
gopal_rd_init(const QString& fname)
{
char buff[32];
char* ck;
const char* filename;
CHECK_BOOL(optclean);
if (optminspeed) {
minspeed=atof(optminspeed);
@@ -128,7 +126,6 @@ gopal_rd_init(const char* fname)

fin = gbfopen(fname, "r", MYNAME);

memset(buff,0,sizeof(buff));
if (optdate) {
memset(&opt_tm, 0, sizeof(opt_tm));

@@ -142,15 +139,16 @@ gopal_rd_init(const char* fname)

} else {
/* remove path */
filename = get_filename(fname);
QString filename = get_filename(fname);
QString datestr;

if ((strncmp(filename,"track",5)==0)&&(strlen(filename)>13)) { // we need at least 13 letters: trackYYYYMMDD...
strncpy(&buff[0],&filename[5],8);
} else if ((strncmp(filename,"A_",2)==0)&&(strlen(filename)>10)) { // here we expect at least 10 letters: A_YYYYMMDD...
strncpy(&buff[0],&filename[2],8);
if (filename.startsWith("track")&&(filename.length()>13)) { // we need at least 13 letters: trackYYYYMMDD...
datestr = filename.mid(5,8);
} else if (filename.startsWith("A_")&&(filename.length()>10)) { // here we expect at least 10 letters: A_YYYYMMDD...
datestr = filename.mid(2,8);
}
// in buff we should now have something wich looks like a valid date starting with YYYYMMDD
/*ck = (char*)*/strptime(buff, "%Y%m%d", &filenamedate);
/*ck = (char*)*/strptime(qPrintable(datestr), "%Y%m%d", &filenamedate);
// if (((ck == NULL) || (*ck != '\0') )&&!(optdate))
// fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff);
// /* else */ if (filenamedate.tm_year < 70)
@@ -377,7 +375,7 @@ gopal_write_waypt(const Waypoint* wpt)


static void
gopal_wr_init(const char* fname)
gopal_wr_init(const QString& fname)
{
fout = gbfopen(fname, "w", MYNAME);
}

+ 6
- 14
gpssim.cc View File

@@ -31,7 +31,7 @@ static gbfile* fout;
static char* wayptspd;
static char* splitfiles_opt;
static int splitfiles;
static char* fnamestr;
static QString fnamestr;
static int trk_count;
static int doing_tracks;

@@ -56,9 +56,9 @@ arglist_t gpssim_args[] = {
*/

static void
gpssim_wr_init(const char* fname)
gpssim_wr_init(const QString& fname)
{
fnamestr = xstrdup(fname);
fnamestr = fname;
trk_count = 0;
splitfiles = splitfiles_opt ? atoi(splitfiles_opt) : 0;

@@ -80,7 +80,7 @@ gpssim_wr_deinit(void)
fout = NULL;
}

xfree(fnamestr);
fnamestr.clear();
}


@@ -144,19 +144,13 @@ static void
gpssim_trk_hdr(const route_head* rh)
{
if (splitfiles) {
char c[1024];
char* ofname = xstrdup(fnamestr);

if (fout) {
fatal(MYNAME ": output file already open.\n");
}

snprintf(c, sizeof(c), "%s%04d.gpssim",
doing_tracks ? "-track" : "-route",
trk_count++);
ofname = xstrappend(ofname, c);
QString ofname = QString("%1%2%3.gpssim").arg(fnamestr).arg(doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0'));
fout = gbfopen(ofname, "wb", MYNAME);
xfree(ofname);
}
track_recompute(rh, NULL);
}
@@ -175,10 +169,8 @@ gpssim_write(void)
{
if (waypt_count()) {
if (splitfiles) {
char* ofname = xstrdup(fnamestr);
ofname = xstrappend(ofname, "-waypoints.gpssim");
QString ofname = fnamestr + "-waypoints.gpssim";
fout = gbfopen(ofname, "wb", MYNAME);
xfree(ofname);
}
if (wayptspd && wayptspd[0]) {
gpssim_write_spd(atof(wayptspd));

+ 2
- 2
gpsutil.cc View File

@@ -33,7 +33,7 @@ static short_handle mkshort_handle;
#define MYNAME "GPSUTIL"

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
file_in = gbfopen(fname, "rb", MYNAME);
}
@@ -45,7 +45,7 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen(fname, "w", MYNAME);
mkshort_handle = mkshort_new_handle();

+ 2
- 2
gpx.cc View File

@@ -1188,7 +1188,7 @@ gpx_cdata(const QString& s)
}

static void
gpx_rd_init(const char* fname)
gpx_rd_init(const QString& fname)
{
iqfile = new gpsbabel::File(fname);
iqfile->open(QIODevice::ReadOnly);
@@ -1228,7 +1228,7 @@ gpx_rd_deinit(void)
}

static void
gpx_wr_init(const char* fname)
gpx_wr_init(const QString& fname)
{
mkshort_handle = NULL;
oqfile = new gpsbabel::File(fname);

+ 2
- 2
gtm.cc View File

@@ -392,7 +392,7 @@ void convert_datum(double* lat, double* lon)
/* Callbacks */

static void
gtm_rd_init(const char* fname)
gtm_rd_init(const QString& fname)
{
int version;
file_in = gbfopen_le(fname, "rb", MYNAME);
@@ -446,7 +446,7 @@ static void count_track_waypts(const Waypoint* wpt)
}

static void
gtm_wr_init(const char* fname)
gtm_wr_init(const QString& fname)
{
rt_count = tr_count = 0;
track_disp_all(NULL, NULL, count_track_waypts);

+ 2
- 2
gtrnctr.cc View File

@@ -170,7 +170,7 @@ gtc_tags_to_ignore[] = {
};

static void
gtc_rd_init(const char* fname)
gtc_rd_init(const QString& fname)
{
xml_init(fname, gtc_map, NULL);
xml_ignore_tags(gtc_tags_to_ignore);
@@ -189,7 +189,7 @@ gtc_rd_deinit(void)
}

static void
gtc_wr_init(const char* fname)
gtc_wr_init(const QString& fname)
{
int i;


+ 2
- 2
hiketech.cc View File

@@ -79,7 +79,7 @@ static xg_tag_mapping ht_map[] = {
};

static void
hiketech_rd_init(const char* fname)
hiketech_rd_init(const QString& fname)
{
xml_init(fname, ht_map, NULL);
}
@@ -97,7 +97,7 @@ hiketech_rd_deinit(void)
}

static void
hiketech_wr_init(const char* fname)
hiketech_wr_init(const QString& fname)
{
ofd = gbfopen(fname, "w", MYNAME);


+ 2
- 2
holux.cc View File

@@ -38,7 +38,7 @@ static short_handle mkshort_handle;
#define MYNAME "Holux"


static void rd_init(const char* fname)
static void rd_init(const QString& fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
@@ -54,7 +54,7 @@ static void rd_deinit(void)


static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
mkshort_handle = mkshort_new_handle();


+ 1
- 1
html.cc View File

@@ -65,7 +65,7 @@ arglist_t html_args[] = {


static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen(fname, "w", MYNAME);
mkshort_handle = mkshort_new_handle();

+ 2
- 2
humminbird.cc View File

@@ -250,7 +250,7 @@ inverse_gudermannian_i1924(const double x)
*******************************************************************************/

static void
humminbird_rd_init(const char* fname)
humminbird_rd_init(const QString& fname)
{
fin = gbfopen_be(fname, "rb", MYNAME);
}
@@ -642,7 +642,7 @@ humminbird_read(void)
/************************************************************************************************/

static void
humminbird_wr_init(const char* fname)
humminbird_wr_init(const QString& fname)
{
fout = gbfopen_be(fname, "wb", MYNAME);


+ 3
- 3
igc.cc View File

@@ -119,7 +119,7 @@ retry:
return (igc_rec_type_t) c[0];
}

static void rd_init(const char* fname)
static void rd_init(const QString& fname)
{
char* ibuf;

@@ -127,7 +127,7 @@ static void rd_init(const char* fname)
lineno = 0;
// File must begin with a manufacturer/ID record
if (get_record(&ibuf) != rec_manuf_id || sscanf(ibuf, "A%3[A-Z]", manufacturer) != 1) {
fatal(MYNAME ": %s is not an IGC file\n", fname);
fatal(MYNAME ": %s is not an IGC file\n", qPrintable(fname));
}
}

@@ -911,7 +911,7 @@ static void wr_track(void)
}
}

static void wr_init(const char* fname)
static void wr_init(const QString& fname)
{
file_out = gbfopen(fname, "wb", MYNAME);
}

+ 2
- 2
ignrando.cc View File

@@ -140,7 +140,7 @@ ignr_etape_alt(xg_string args, const QXmlStreamAttributes* attrv)
/* callbacks registered in ignr_vecs */

static void
ignr_rd_init(const char* fname)
ignr_rd_init(const QString& fname)
{
xml_init(fname, ignr_xml_map, NULL);
wpt = NULL;
@@ -164,7 +164,7 @@ ignr_read(void)
/* callbacks registered in ignr_vecs */

static void
ignr_rw_init(const char* fname)
ignr_rw_init(const QString& fname)
{
fout = gbfopen(fname, "w", MYNAME);
}

+ 2
- 2
igo8.cc View File

@@ -132,7 +132,7 @@ static void igo8_check_type_sizes()
}

// Reader initialization callback
static void igo8_read_init(const char* fname)
static void igo8_read_init(const QString& fname)
{
igo8_file_in = gbfopen_le(fname, "rb", MYNAME);

@@ -177,7 +177,7 @@ static void igo8_read_deinit(void)
}

// Writer initialize callback
static void igo8_write_init(const char* fname)
static void igo8_write_init(const QString& fname)
{
igo8_file_out = gbfopen_le(fname, "wb", MYNAME);


+ 1
- 1
ik3d.cc View File

@@ -120,7 +120,7 @@ iktobj_type(xg_string args, const QXmlStreamAttributes*)
}

static void
ikt_rd_init(const char* fname)
ikt_rd_init(const QString& fname)
{
xml_init(fname, ikt_map, NULL);


+ 10
- 10
itracku.cc View File

@@ -362,7 +362,7 @@ arglist_t itracku_args[] = {
*******************************************************************************/

static void
itracku_rd_init_common(const char* fname)
itracku_rd_init_common(const QString& fname)
{
new_waypoint_count = 0;

@@ -377,11 +377,11 @@ itracku_rd_init_common(const char* fname)
}

static void
itracku_rd_ser_init(const char* fname)
itracku_rd_ser_init(const QString& fname)
{
#if LATER
int i;
if (0 == strcmp(fname, port_auto_detect_filename)) {
if (0 == strcmp(qPrintable(fname), port_auto_detect_filename)) {
dbg(1, "auto detecting port for iTrackU device");
for (i=1; !fd && i<port_auto_detect_max_port; ++i) {
xasprintf(&port, "com%d", i);
@@ -428,10 +428,10 @@ itracku_rd_ser_init(const char* fname)
#endif
{

if (gbser_is_serial(fname)) {
port = xstrdup(fname);
if (gbser_is_serial(qPrintable(fname))) {
port = xstrdup(qPrintable(fname));

dbg(1, "opening port %s", fname);
dbg(1, "opening port %s", qPrintable(fname));
if ((fd = gbser_init(port)) == NULL) {
fatal(MYNAME ": can't initialise port \"%s\"", port);
}
@@ -440,7 +440,7 @@ itracku_rd_ser_init(const char* fname)
fatal(MYNAME ": can't initialise device on port \"%s\"", port);
}
} else {
fatal(MYNAME ": \"%s\" is not a valid serial port", fname);
fatal(MYNAME ": \"%s\" is not a valid serial port", qPrintable(fname));
}
}

@@ -448,7 +448,7 @@ itracku_rd_ser_init(const char* fname)
}

static void
itracku_rd_init(const char* fname)
itracku_rd_init(const QString& fname)
{
fin = gbfopen(fname, "r", MYNAME);
itracku_rd_init_common(fname);
@@ -624,7 +624,7 @@ itracku_read(void)
}

static void
itracku_wr_init(const char* fname)
itracku_wr_init(const QString& fname)
{
fout = gbfopen(fname, "w", MYNAME);
}
@@ -653,7 +653,7 @@ itracku_exit(void) /* optional */
}

static void
itracku_rt_init(const char* fname)
itracku_rt_init(const QString& fname)
{
itracku_rd_ser_init(fname);
itracku_device_write_string("WP AP-Exit");

+ 1
- 1
jogmap.cc View File

@@ -75,7 +75,7 @@ xg_tag_mapping jogmap_map[] = {
};

static void
jogmap_rd_init(const char* fname)
jogmap_rd_init(const QString& fname)
{
trk = NULL;
xml_init(fname, jogmap_map, NULL);

+ 2
- 2
jtr.cc View File

@@ -82,7 +82,7 @@ jtr_parse_date(const char* str, struct tm* tm)
*******************************************************************************/

static void
jtr_rd_init(const char* fname)
jtr_rd_init(const QString& fname)
{
fin = gbfopen(fname, "r", MYNAME);
}
@@ -250,7 +250,7 @@ jtr_read(void)
}

static void
jtr_wr_init(const char* fname)
jtr_wr_init(const QString& fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}

+ 11
- 13
kml.cc View File

@@ -68,8 +68,8 @@ static int precision;

static Waypoint* wpt_tmp;
static int wpt_tmp_queued;
static const char* posnfilename;
static char* posnfilenametmp;
static QString posnfilename;
static QString posnfilenametmp;

static route_head* gx_trk_head;
static QList<gpsbabel::DateTime>* gx_trk_times;
@@ -460,7 +460,7 @@ void gx_trk_coord(xg_string args, const QXmlStreamAttributes*)

static
void
kml_rd_init(const char* fname)
kml_rd_init(const QString& fname)
{
xml_init(fname, kml_map, NULL);
xml_ignore_tags(kml_tags_to_ignore);
@@ -480,7 +480,7 @@ kml_rd_deinit(void)
}

static void
kml_wr_init(const char* fname)
kml_wr_init(const QString& fname)
{
char u = 's';
waypt_init_bounds(&kml_bounds);
@@ -523,10 +523,10 @@ kml_wr_init(const char* fname)
* updated.
*/
static void
kml_wr_position_init(const char* fname)
kml_wr_position_init(const QString& fname)
{
posnfilename = fname;
posnfilenametmp = xstrappend(xstrdup(fname), "-");
posnfilenametmp = QString("%1-").arg(fname);
realtime_positioning = 1;

/*
@@ -548,12 +548,12 @@ kml_wr_deinit(void)
delete oqfile;
oqfile = NULL;

if (posnfilenametmp) {
if (!posnfilenametmp.isEmpty()) {
#if __WIN32__
MoveFileExA(posnfilenametmp, posnfilename,
MoveFileExA(qPrintable(posnfilenametmp), qPrintable(posnfilename),
MOVEFILE_REPLACE_EXISTING);
#endif
rename(posnfilenametmp, posnfilename);
QFile::rename(posnfilenametmp, posnfilename);
}
}

@@ -561,10 +561,8 @@ static void
kml_wr_position_deinit(void)
{
// kml_wr_deinit();
if (posnfilenametmp) {
xfree(posnfilenametmp);
posnfilenametmp = NULL;
}
posnfilename.clear();
posnfilenametmp.clear();
}



+ 2
- 2
lmx.cc View File

@@ -55,7 +55,7 @@ arglist_t lmx_args[] = {


static void
lmx_wr_init(const char* fname)
lmx_wr_init(const QString& fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
@@ -316,7 +316,7 @@ static xg_tag_mapping gl_map[] = {
};

static void
lmx_rd_init(const char* fname)
lmx_rd_init(const QString& fname)
{
xml_init(fname, gl_map, NULL);
}

+ 2
- 2
lowranceusr.cc View File

@@ -324,7 +324,7 @@ arglist_t lowranceusr_args[] = {
};

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
@@ -336,7 +336,7 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
mkshort_handle = mkshort_new_handle();

+ 2
- 2
lowranceusr4.cc View File

@@ -159,7 +159,7 @@ arglist_t lowranceusr4_args[] = {
};

static void
rd_init(const char* fname)
rd_init(const QString& fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
@@ -171,7 +171,7 @@ rd_deinit(void)
}

static void
wr_init(const char* fname)
wr_init(const QString& fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
mkshort_handle = mkshort_new_handle();

+ 2
- 2
maggeo.cc View File

@@ -47,7 +47,7 @@ maggeo_writemsg(const char* const buf)
}

static void
maggeo_rd_init(const char* fname)
maggeo_rd_init(const QString& fname)
{
maggeofile_in = gbfopen(fname, "rb", MYNAME);
}
@@ -59,7 +59,7 @@ maggeo_rd_deinit(void)
}

static void
maggeo_wr_init(const char* fname)
maggeo_wr_init(const QString& fname)
{
if (waypt_count() > 200) {
fatal(MYNAME ": eXplorist does not support more than 200 waypoints in one .gs file.\nDecrease the number of waypoints sent.\n");

+ 22
- 21
magproto.cc View File

@@ -32,6 +32,7 @@
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <QtCore/QFileInfo>

static int bitrate = 4800;
static int wptcmtcnt;
@@ -57,7 +58,7 @@ static char* nukewpt = NULL;
static int route_out_count;
static int waypoint_read_count;
static int wpt_len = 8;
static const char* curfname;
static QString curfname;
static int extension_hint;
// For Explorist GC/510/610/710 familes, bludgeon in GPX support.
// (This has nothing to do with the Explorist 100...600 products.)
@@ -569,10 +570,10 @@ retry:
static void* serial_handle = NULL;

static int
terminit(const char* portname, int create_ok)
terminit(const QString& portname, int create_ok)
{
if (gbser_is_serial(portname)) {
if (serial_handle = gbser_init(portname), NULL != serial_handle) {
if (gbser_is_serial(qPrintable(portname))) {
if (serial_handle = gbser_init(qPrintable(portname)), NULL != serial_handle) {
int rc;
if (rc = gbser_set_port(serial_handle, bitrate, 8, 0, 1), gbser_OK != rc) {
fatal(MYNAME ": Can't configure port\n");
@@ -580,7 +581,7 @@ terminit(const char* portname, int create_ok)
}
is_file = 0;
if (serial_handle == NULL) {
fatal(MYNAME ": Could not open serial port %s\n", portname);
fatal(MYNAME ": Could not open serial port %s\n", qPrintable(portname));
}
return 1;
} else {
@@ -723,7 +724,7 @@ arglist_t mag_fargs[] = {
* The part of the serial init that's common to read and write.
*/
static void
mag_serial_init_common(const char* portname)
mag_serial_init_common(const QString& portname)
{
time_t now, later;

@@ -749,7 +750,7 @@ mag_serial_init_common(const char* portname)
mag_readmsg(trkdata);
if (current_time().toTime_t() > later) {
fatal(MYNAME ": No acknowledgment from GPS on %s\n",
portname);
qPrintable(portname));
}
}

@@ -775,14 +776,13 @@ mag_serial_init_common(const char* portname)

}
static void
mag_rd_init_common(const char* portname)
mag_rd_init_common(const QString& portname)
{
const char* ext;
waypoint_read_count = 0;
// For Explorist GC, intercept the device access and redirect to GPX.
// We actually do the rd_init() inside read as we may have multiple
// files that we have to read.
if (0 == strcmp(portname, "usb:")) {
if (portname == "usb:") {
const char** dlist = os_get_magellan_mountpoints();
explorist_info = explorist_ini_get(dlist);
if (explorist_info) {
@@ -817,14 +817,13 @@ mag_rd_init_common(const char* portname)
* queue or the WPT queue in the presence of (-w -r -t) we
* divine a hint from the filename extension when we can.
*/
ext = strrchr(curfname, '.');
if (ext) {
ext++;
if (0 == case_ignore_strcmp(ext, "upt")) {
QString exten = QFileInfo(curfname).suffix();
if (exten.length() > 0) {
if (0 == exten.compare("upt", Qt::CaseInsensitive)) {
extension_hint = WPTDATAMASK;
} else if (0 == case_ignore_strcmp(ext, "log")) {
} else if (0 == exten.compare("log", Qt::CaseInsensitive)) {
extension_hint = TRKDATAMASK;
} else if (0 == case_ignore_strcmp(ext, "rte")) {
} else if (0 == exten.compare("rte", Qt::CaseInsensitive)) {
extension_hint = RTEDATAMASK;
}
}
@@ -833,7 +832,7 @@ mag_rd_init_common(const char* portname)
}

static void
mag_rd_init(const char* portname)
mag_rd_init(const QString& portname)
{
explorist = 0;
suppress_ack = 1;
@@ -841,14 +840,14 @@ mag_rd_init(const char* portname)
}

static void
magX_rd_init(const char* portname)
magX_rd_init(const QString& portname)
{
explorist = 1;
mag_rd_init_common(portname);
}

static void
mag_wr_init_common(const char* portname)
mag_wr_init_common(const QString& portname)
{
suppress_ack = 0;
if (bs) {
@@ -879,7 +878,7 @@ mag_wr_init_common(const char* portname)
* Entry point for extended (explorist) points.
*/
static void
magX_wr_init(const char* portname)
magX_wr_init(const QString& portname)
{
wpt_len = 20;
explorist = 1;
@@ -889,7 +888,7 @@ magX_wr_init(const char* portname)
}

static void
mag_wr_init(const char* portname)
mag_wr_init(const QString& portname)
{
explorist = 0;
wpt_len = 8;
@@ -918,6 +917,8 @@ mag_deinit(void)
waypt_flush(&rte_wpt_tmp);

trk_head = NULL;

curfname.clear();
}

static void

+ 32
- 10
main.cc View File

@@ -18,6 +18,7 @@
*/

#include <QtCore/QTextCodec>
#include <QtCore/QCoreApplication>

#include "defs.h"
#include "filterdefs.h"
@@ -240,6 +241,15 @@ main(int argc, char* argv[])
queue* wpt_head_bak, *rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */
signed int wpt_ct_bak, rte_ct_bak, trk_ct_bak; /* #ifdef UTF8_SUPPORT */
arg_stack_t* arg_stack = NULL;

// Create a QCoreApplication object to handle application initialization.
// TODO: Someday we may actually use this, but for now we are just trying
// to get Qt initialized, especially locale related QTextCodec stuff.
// For example, this will get the QTextCodec::codecForLocale set
// correctly.
QCoreApplication app(argc, argv);
// TODO: use QCoreApplication::arguments() to process command line.

(void) new gpsbabel::UsAsciiCodec(); /* make sure a US-ASCII codec is available */

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
@@ -254,12 +264,14 @@ main(int argc, char* argv[])
// The first invocation of QTextCodec::codecForLocale() may result in LC_ALL being set to the native environment
// as opposed to the initial default "C" locale.
// This was demonstrated with Qt5 on Mac OS X.
// TODO: This need to invoke QTextCodec::codecForLocale() may be taken care of
// by creating a QCoreApplication.
#ifdef DEBUG_LOCALE
printf("%s\n",setlocale(LC_ALL, NULL));
printf("Initial locale: %s\n",setlocale(LC_ALL, NULL));
#endif
(void) QTextCodec::codecForLocale();
#ifdef DEBUG_LOCALE
printf("%s\n",setlocale(LC_ALL, NULL));
printf("Locale after codedForLocale: %s\n",setlocale(LC_ALL, NULL));
#endif
// As recommended in QCoreApplication reset the locale to the default.
// Note the documentation says to set LC_NUMERIC, but QCoreApplicationPrivate::initLocale()
@@ -271,7 +283,17 @@ main(int argc, char* argv[])
#endif
setlocale(LC_NUMERIC,"C");
#ifdef DEBUG_LOCALE
printf("%s\n",setlocale(LC_ALL, NULL));
printf("LC_ALL: %s\n",setlocale(LC_ALL, NULL));
#endif
}
/* reset LC_TIME for strftime */
if (strcmp(setlocale(LC_TIME,0), "C") != 0) {
#ifdef DEBUG_LOCALE
printf("Resetting LC_TIME\n");
#endif
setlocale(LC_TIME,"C");
#ifdef DEBUG_LOCALE
printf("LC_ALL: %s\n",setlocale(LC_ALL, NULL));
#endif
}

@@ -394,7 +416,7 @@ main(int argc, char* argv[])
cet_convert_init(ivecs->encode, ivecs->fixed_encode); /* init by module vec */

start_session(ivecs->name, fname);
ivecs->rd_init(fname);
ivecs->rd_init(QString::fromLocal8Bit(fname));
ivecs->read();
ivecs->rd_deinit();

@@ -426,7 +448,7 @@ main(int argc, char* argv[])
trk_ct_bak = -1;
rte_head_bak = trk_head_bak = NULL;

ovecs->wr_init(ofname);
ovecs->wr_init(QString::fromLocal8Bit(ofname));

if (global_opts.charset != &cet_cs_vec_utf8) {
/*
@@ -628,7 +650,7 @@ main(int argc, char* argv[])
if (ivecs->rd_init == NULL) {
fatal("Format does not support reading.\n");
}
ivecs->rd_init(argv[0]);
ivecs->rd_init(QString::fromLocal8Bit(argv[0]));
ivecs->read();
ivecs->rd_deinit();

@@ -643,7 +665,7 @@ main(int argc, char* argv[])
fatal("Format does not support writing.\n");
}

ovecs->wr_init(argv[1]);
ovecs->wr_init(QString::fromLocal8Bit(argv[1]));
ovecs->write();
ovecs->wr_deinit();

@@ -689,7 +711,7 @@ main(int argc, char* argv[])
fatal("An input file (-f) must be specified.\n");
}
start_session(ivecs->name, fname);
ivecs->position_ops.rd_init(fname);
ivecs->position_ops.rd_init(QString::fromLocal8Bit(fname));
}

if (global_opts.masked_objective & ~POSNDATAMASK) {
@@ -707,7 +729,7 @@ main(int argc, char* argv[])
}

if (ovecs && ovecs->position_ops.wr_init) {
ovecs->position_ops.wr_init(ofname);
ovecs->position_ops.wr_init(QString::fromLocal8Bit(ofname));
}

tracking_status.request_terminate = 0;
@@ -724,7 +746,7 @@ main(int argc, char* argv[])
}
if (wpt) {
if (ovecs) {
// ovecs->position_ops.wr_init(ofname);
// ovecs->position_ops.wr_init(QString::fromLocal8Bit(ofname));
ovecs->position_ops.wr_position(wpt);
// ovecs->position_ops.wr_deinit();
} else {

+ 2
- 2
mapasia.cc View File

@@ -61,7 +61,7 @@ arglist_t tr7_args[] = {
*******************************************************************************/

static void
tr7_rd_init(const char* fname)
tr7_rd_init(const QString& fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}
@@ -263,7 +263,7 @@ tr7_disp_waypt_cb(const Waypoint* wpt)
}

static void
tr7_wr_init(const char* fname)
tr7_wr_init(const QString& fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
gbfputint32(TR7_TRACK_MAGIC, fout);

+ 1
- 1
mapbar_track.cc View File

@@ -38,7 +38,7 @@ arglist_t mapbar_track_args[] = {
*******************************************************************************/

static void
mapbar_track_rd_init(const char* fname)
mapbar_track_rd_init(const QString& fname)
{
fin = gbfopen(fname, "r", MYNAME);
}

+ 2
- 2
mapfactor.cc View File

@@ -68,7 +68,7 @@ void MapfactorRead()
}

static void
mapfactor_rd_init(const char* fname)
mapfactor_rd_init(const QString& fname)
{
mapfactor_read_fname = fname;
}
@@ -98,7 +98,7 @@ mapfactor_rd_deinit(void)
}

static void
mapfactor_wr_init(const char* fname)
mapfactor_wr_init(const QString& fname)
{
oqfile = new gpsbabel::File(fname);
oqfile->open(QIODevice::WriteOnly | QIODevice::Text);

+ 2
- 2
mapsend.cc View File

@@ -72,7 +72,7 @@ mapsend_init_opts(const char isReading) /* 1=read, 2=write */
}

static void
mapsend_rd_init(const char* fname)
mapsend_rd_init(const QString& fname)
{
mapsend_init_opts(1);
mapsend_file_in = gbfopen_le(fname, "rb", MYNAME);
@@ -85,7 +85,7 @@ mapsend_rd_deinit(void)
}

static void
mapsend_wr_init(const char* fname)
mapsend_wr_init(const QString& fname)
{
mapsend_init_opts(0);
mapsend_file_out = gbfopen(fname, "wb", MYNAME);

+ 13
- 12
mapsource.cc View File

@@ -26,6 +26,7 @@
#include "jeeps/gpsmath.h"
#include <stdio.h>
#include <stdlib.h>
#include <QtCore/QFile>

static gbfile* mps_file_in;
static gbfile* mps_file_out;
@@ -37,8 +38,8 @@ static int mps_ver_out = 0;
static int mps_ver_temp = 0;

/* Temporary pathname used when merging gpsbabel output with an existing file */
static char* tempname;
static char* fin_name;
static QString tempname;
static QString fin_name;

static const Waypoint* prevRouteWpt;
/* Private queues of written out waypoints */
@@ -225,7 +226,7 @@ mps_converted_icon_number(const int icon_num, const int mpsver, garmin_formats_e
}

static void
mps_rd_init(const char* fname)
mps_rd_init(const QString& fname)
{
mps_file_in = gbfopen_le(fname, "rb", MYNAME);

@@ -246,9 +247,9 @@ mps_rd_deinit(void)
}

static void
mps_wr_init(const char* fname)
mps_wr_init(const QString& fname)
{
fin_name = xstrdup(fname);
fin_name = fname;
if (mpsmergeouts) {
mpsmergeout = atoi(mpsmergeouts);
}
@@ -265,14 +266,14 @@ mps_wr_init(const char* fname)
/* create a temporary name based on a random char and the existing name */
/* then test if it already exists, if so try again with another rand num */
/* yeah, yeah, so there's probably a library function for this */
xasprintf(&tempname, "%s.%08x", fname, rand());
tempname = QString("%1.%2").arg(fname).arg(rand(), 8, 16, QChar('0'));
mps_file_temp = gbfopen_le(tempname, "rb", MYNAME);
if (mps_file_temp == NULL) {
break;
}
gbfclose(mps_file_temp);
}
rename(fname, tempname);
QFile::rename(fname, tempname);
mps_file_temp = gbfopen_le(tempname, "rb", MYNAME);
}
}
@@ -292,8 +293,8 @@ mps_wr_deinit(void)

if (mpsmergeout) {
gbfclose(mps_file_temp);
remove(tempname);
xfree(tempname);
QFile::remove(tempname);
tempname.clear();
}