aboutdlg.h   aboutdlg.h 
skipping to change at line 33 skipping to change at line 33
#ifndef ABOUTDLG_H #ifndef ABOUTDLG_H
#define ABOUTDLG_H #define ABOUTDLG_H
#include <QDialog> #include <QDialog>
#include "ui_aboutui.h" #include "ui_aboutui.h"
class AboutDlg: public QDialog { class AboutDlg: public QDialog {
public: public:
AboutDlg(QWidget *parent, const QString &ver1, AboutDlg(QWidget *parent, const QString &ver1,
const QString &ver2); const QString &ver2, const QString &installationId);
private: private:
Ui_AboutDlg ui; Ui_AboutDlg ui_;
}; };
#endif #endif
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 advdlg.h   advdlg.h 
skipping to change at line 32 skipping to change at line 32
#ifndef ADVDLG_H #ifndef ADVDLG_H
#define ADVDLG_H #define ADVDLG_H
#include "ui_advui.h" #include "ui_advui.h"
class AdvDlg: public QDialog { class AdvDlg: public QDialog {
Q_OBJECT Q_OBJECT
public: public:
AdvDlg(QWidget* parent, AdvDlg(QWidget* parent,
bool &synthShortNames, bool &synthShortNames_,
bool &enableCharSetXform, bool &enableCharSetXform_,
bool &previewGmap, bool &previewGmap_,
int &debugLevel); int &debugLevel_);
QPushButton* formatButton() { return ui.formatButton; }; QPushButton* formatButton() { return ui_.formatButton; };
private: private:
Ui_AdvUi ui; Ui_AdvUi ui_;
bool &synthShortNames; bool &synthShortNames_;
bool &enableCharSetXform; bool &enableCharSetXform_;
bool &previewGmap; bool &previewGmap_;
int &debugLevel; int &debugLevel_;
protected: protected:
private slots: private slots:
void acceptClicked(); void acceptClicked();
void rejectClicked(); void rejectClicked();
}; };
#endif #endif
 End of changes. 2 change blocks. 
10 lines changed or deleted 10 lines changed or added


 an1sym.h   an1sym.h 
skipping to change at line 682 skipping to change at line 682
{ {0x835b84e2,{0xf10c, 0x45cb, 0x958f}, {0x18, 0x3a, 0xc2, 0x2a, 0xe5, 0x 28}}, { {0x835b84e2,{0xf10c, 0x45cb, 0x958f}, {0x18, 0x3a, 0xc2, 0x2a, 0xe5, 0x 28}},
"Tipup Up" "Tipup Up"
}, },
{ {0xce06fc92,{0xbb0c, 0x4ec1, 0xda93}, {0x64, 0x4a, 0x60, 0xbe, 0x40, 0x 90}}, { {0xce06fc92,{0xbb0c, 0x4ec1, 0xda93}, {0x64, 0x4a, 0x60, 0xbe, 0x40, 0x 90}},
"Topup Down" "Topup Down"
}, },
}; };
int FindIconByName(const char* name, GUID* guid) int FindIconByName(const char* name, GUID* guid)
{ {
int i = 0; unsigned int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
if (!case_ignore_strcmp(name, default_guids[i].name)) { if (!case_ignore_strcmp(name, default_guids[i].name)) {
memcpy(guid, &(default_guids[i].guid), sizeof(GUID)); memcpy(guid, &(default_guids[i].guid), sizeof(GUID));
return 1; return 1;
} }
} }
return 0; return 0;
} }
int FindIconByGuid(GUID* guid, char** name) int FindIconByGuid(GUID* guid, char** name)
{ {
int i = 0; unsigned int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
if (!memcmp(guid, &default_guids[i].guid, sizeof(GUID))) { if (!memcmp(guid, &default_guids[i].guid, sizeof(GUID))) {
*name = (char*) default_guids[i].name; *name = (char*) default_guids[i].name;
return 1; return 1;
} }
} }
return 0; return 0;
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 ansi_x3_4_1968.h   ansi_x3_4_1968.h 
skipping to change at line 43 skipping to change at line 43
NULL NULL
}; };
#define cet_ucs4_ofs_ansi_x3_4_1968 128 #define cet_ucs4_ofs_ansi_x3_4_1968 128
#define cet_ucs4_cnt_ansi_x3_4_1968 1 #define cet_ucs4_cnt_ansi_x3_4_1968 1
const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {0}; const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {0};
#define cet_ucs4_to_ansi_x3_4_1968_ct 1 #define cet_ucs4_to_ansi_x3_4_1968_ct 1
const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_ 4_1968_ct] = {{0}}; const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_ 4_1968_ct] = {{0, 0}};
// #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200 // #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200
const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_extra[] = const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_extra[] =
/* ------------------------------------------*/ /* ------------------------------------------*/
/* !!! sorted by UCS-4 value !!! */ /* !!! sorted by UCS-4 value !!! */
/* ------------------------------------------*/ /* ------------------------------------------*/
{ {
{0x00C0, (unsigned char) 'A'}, // latin capital letter a with grave {0x00C0, (unsigned char) 'A'}, // latin capital letter a with grave
{0x00C1, (unsigned char) 'A'}, // latin capital letter a with acute {0x00C1, (unsigned char) 'A'}, // latin capital letter a with acute
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 babeldata.h   babeldata.h 
skipping to change at line 34 skipping to change at line 34
#define BABELDATA_H #define BABELDATA_H
#include <QSettings> #include <QSettings>
#include <QStringList> #include <QStringList>
#include <QUuid> #include <QUuid>
#include "setting.h" #include "setting.h"
class BabelData { class BabelData {
public: public:
BabelData(): BabelData():
inputType(fileType), inputType_(fileType_),
inputFileFormat(QString()), inputFileFormat_(QString()),
inputDeviceFormat(QString()), inputDeviceFormat_(QString()),
inputFileNames(QStringList()), inputFileNames_(QStringList()),
inputDeviceName(QString()), inputDeviceName_(QString()),
inputCharSet(QString()), inputCharSet_(QString()),
xlateWayPts(true), xlateWayPts_(true),
xlateRoutes(true), xlateRoutes_(true),
xlateTracks(true), xlateTracks_(true),
outputType(fileType), outputType_(fileType_),
outputFileFormat(QString()), outputFileFormat_(QString()),
outputDeviceFormat(QString()), outputDeviceFormat_(QString()),
outputFileName(QString()), outputFileName_(QString()),
outputDeviceName(QString()), outputDeviceName_(QString()),
outputCharSet(QString()), outputCharSet_(QString()),
synthShortNames(false), synthShortNames_(false),
forceGPSTypes(false), forceGPSTypes_(false),
enableCharSetXform(false), enableCharSetXform_(false),
debugLevel(-1), debugLevel_(-1),
inputBrowse(QString()), inputBrowse_(QString()),
outputBrowse(QString()), outputBrowse_(QString()),
previewGmap(false), previewGmap_(false),
upgradeCheckMethod(0), upgradeCheckMethod_(0),
upgradeCheckTime(QDateTime(QDate(2001, 1, 1), QTime(0, 0))), upgradeCheckTime_(QDateTime(QDate(2001, 1, 1), QTime(0, 0))),
installationUuid(QUuid::createUuid().toString()), installationUuid_(QUuid::createUuid().toString()),
upgradeCallbacks(0), upgradeCallbacks_(0),
upgradeAccept(0), upgradeAccept_(0),
upgradeDeclines(0), upgradeDeclines_(0),
upgradeErrors(0), upgradeErrors_(0),
upgradeOffers(0), upgradeOffers_(0),
runCount(0), runCount_(0),
startupVersionCheck(true), startupVersionCheck_(true),
reportStatistics(true), reportStatistics_(true),
allowBetaUpgrades(false), allowBetaUpgrades_(false),
ignoreVersionMismatch(false), ignoreVersionMismatch_(false),
disableDonateDialog(false), disableDonateDialog_(false),
donateSplashed(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0))) donateSplashed_(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0)))
{ {
}; };
void saveSettings(QSettings &st) { void saveSettings(QSettings &st) {
SettingGroup sg; SettingGroup sg;
makeSettingGroup(sg); makeSettingGroup(sg);
sg.saveSettings(st); sg.saveSettings(st);
} }
void restoreSettings(QSettings &st) { void restoreSettings(QSettings &st) {
SettingGroup sg; SettingGroup sg;
makeSettingGroup(sg); makeSettingGroup(sg);
sg.restoreSettings(st); sg.restoreSettings(st);
} }
void makeSettingGroup(SettingGroup &sg) { void makeSettingGroup(SettingGroup &sg) {
sg.addVarSetting(new IntSetting("app.inputType", inputType)); sg.addVarSetting(new IntSetting("app.inputType", inputType_));
sg.addVarSetting(new StringSetting("app.inputFileFormat", inputFileForm sg.addVarSetting(new StringSetting("app.inputFileFormat", inputFileForm
at)); at_));
sg.addVarSetting(new StringSetting("app.inputDeviceFormat", inputDevice sg.addVarSetting(new StringSetting("app.inputDeviceFormat", inputDevice
Format)); Format_));
sg.addVarSetting(new StringSetting("app.inputCharSet", inputCharSet)); sg.addVarSetting(new StringSetting("app.inputCharSet", inputCharSet_));
sg.addVarSetting(new StringSetting("app.inputDeviceName", inputDeviceNa sg.addVarSetting(new StringSetting("app.inputDeviceName", inputDeviceNa
me)); me_));
sg.addVarSetting(new BoolSetting("app.xlateWayPts", xlateWayPts)); sg.addVarSetting(new BoolSetting("app.xlateWayPts", xlateWayPts_));
sg.addVarSetting(new BoolSetting("app.xlateRoutes", xlateRoutes)); sg.addVarSetting(new BoolSetting("app.xlateRoutes", xlateRoutes_));
sg.addVarSetting(new BoolSetting("app.xlateTracks", xlateTracks)); sg.addVarSetting(new BoolSetting("app.xlateTracks", xlateTracks_));
sg.addVarSetting(new IntSetting("app.outputType", outputType)); sg.addVarSetting(new IntSetting("app.outputType", outputType_));
sg.addVarSetting(new StringSetting("app.outputFileFormat", outputFileFo sg.addVarSetting(new StringSetting("app.outputFileFormat", outputFileFo
rmat)); rmat_));
sg.addVarSetting(new StringSetting("app.outputDeviceFormat", outputDevi sg.addVarSetting(new StringSetting("app.outputDeviceFormat", outputDevi
ceFormat)); ceFormat_));
sg.addVarSetting(new StringSetting("app.outputCharSet", outputCharSet)) sg.addVarSetting(new StringSetting("app.outputCharSet", outputCharSet_)
; );
sg.addVarSetting(new StringSetting("app.outputDeviceName", outputDevice sg.addVarSetting(new StringSetting("app.outputDeviceName", outputDevice
Name)); Name_));
sg.addVarSetting(new BoolSetting("app.synthShortNames", synthShortNames sg.addVarSetting(new BoolSetting("app.synthShortNames", synthShortNames
)); _));
sg.addVarSetting(new BoolSetting("app.forceGPSTypes", forceGPSTypes)); sg.addVarSetting(new BoolSetting("app.forceGPSTypes", forceGPSTypes_));
sg.addVarSetting(new BoolSetting("app.enableCharSetXform", enableCharSe sg.addVarSetting(new BoolSetting("app.enableCharSetXform", enableCharSe
tXform)); tXform_));
sg.addVarSetting(new StringSetting("app.inputBrowse", inputBrowse)); sg.addVarSetting(new StringSetting("app.inputBrowse", inputBrowse_));
sg.addVarSetting(new StringSetting("app.outputBrowse", outputBrowse)); sg.addVarSetting(new StringSetting("app.outputBrowse", outputBrowse_));
sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap)); sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap_));
sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckM sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckM
ethod)); ethod_));
sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeChe sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeChe
ckTime)); ckTime_));
sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplash sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplash
ed)); ed_));
sg.addVarSetting(new StringSetting("app.installationUuid", installation sg.addVarSetting(new StringSetting("app.installationUuid", installation
Uuid)); Uuid_));
sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallback sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallback
s)); s_));
sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept)); sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept_));
sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines) sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines_
); ));
sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors)); sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors_));
sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers)); sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers_));
sg.addVarSetting(new IntSetting("app.runCount", runCount)); sg.addVarSetting(new IntSetting("app.runCount", runCount_));
// Global preferences. // Global preferences.
sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVers sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVers
ionCheck)); ionCheck_));
sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatisti sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatisti
cs)); cs_));
sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgr sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgr
ades)); ades_));
sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVer sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVer
sionMismatch)); sionMismatch_));
sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDona sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDona
teDialog)); teDialog_));
} }
static const int noType; static const int noType_;
static const int fileType; static const int fileType_;
static const int deviceType; static const int deviceType_;
int inputType; int inputType_;
QString inputFileFormat; QString inputFileFormat_;
QString inputDeviceFormat; QString inputDeviceFormat_;
QStringList inputFileNames; QStringList inputFileNames_;
QString inputDeviceName; QString inputDeviceName_;
QString inputCharSet; QString inputCharSet_;
bool xlateWayPts; bool xlateWayPts_;
bool xlateRoutes; bool xlateRoutes_;
bool xlateTracks; bool xlateTracks_;
int outputType; int outputType_;
QString outputFileFormat; QString outputFileFormat_;
QString outputDeviceFormat; QString outputDeviceFormat_;
QString outputFileName; QString outputFileName_;
QString outputDeviceName; QString outputDeviceName_;
QString outputCharSet; QString outputCharSet_;
bool synthShortNames; bool synthShortNames_;
bool forceGPSTypes; bool forceGPSTypes_;
bool enableCharSetXform; bool enableCharSetXform_;
int debugLevel; int debugLevel_;
QString inputBrowse, outputBrowse; QString inputBrowse_, outputBrowse_;
bool previewGmap; bool previewGmap_;
int upgradeCheckMethod; int upgradeCheckMethod_;
QDateTime upgradeCheckTime; QDateTime upgradeCheckTime_;
QString installationUuid; QString installationUuid_;
int upgradeCallbacks; int upgradeCallbacks_;
int upgradeAccept; int upgradeAccept_;
int upgradeDeclines; int upgradeDeclines_;
int upgradeErrors; int upgradeErrors_;
int upgradeOffers; int upgradeOffers_;
int runCount; int runCount_;
// Global preferences. // Global preferences.
bool startupVersionCheck; bool startupVersionCheck_;
bool reportStatistics; bool reportStatistics_;
bool allowBetaUpgrades; bool allowBetaUpgrades_;
bool ignoreVersionMismatch; bool ignoreVersionMismatch_;
bool disableDonateDialog; bool disableDonateDialog_;
QDateTime donateSplashed; QDateTime donateSplashed_;
}; };
#endif #endif
 End of changes. 5 change blocks. 
141 lines changed or deleted 141 lines changed or added


 cet_util.h   cet_util.h 
skipping to change at line 31 skipping to change at line 31
#ifndef CET_UTIL_H #ifndef CET_UTIL_H
#define CET_UTIL_H #define CET_UTIL_H
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#if HAVE_LIBEXPAT
# include <expat.h>
#else
typedef char XML_Char;
#endif
#include "cet.h" #include "cet.h"
cet_cs_vec_t* cet_find_cs_by_name(const char* name); cet_cs_vec_t* cet_find_cs_by_name(const char* name);
void cet_register(void); void cet_register(void);
void cet_deregister(void); void cet_deregister(void);
/* short hand transmissions */ /* short hand transmissions */
char* cet_str_utf8_to_cp1252(const char* src); char* cet_str_utf8_to_cp1252(const char* src);
char* cet_str_cp1252_to_utf8(const char* src); char* cet_str_cp1252_to_utf8(const char* src);
skipping to change at line 65 skipping to change at line 59
extern const cet_cs_vec_t cet_cs_vec_iso8859_15; extern const cet_cs_vec_t cet_cs_vec_iso8859_15;
char* cet_str_utf8_to_us_ascii(const char* src); char* cet_str_utf8_to_us_ascii(const char* src);
char* cet_str_us_ascii_to_utf8(const char* src); char* cet_str_us_ascii_to_utf8(const char* src);
extern cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968; extern cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968;
short* cet_str_utf8_to_uni(const char* src, int* length); short* cet_str_utf8_to_uni(const char* src, int* length);
extern cet_cs_vec_t cet_cs_vec_utf8; extern cet_cs_vec_t cet_cs_vec_utf8;
/* Missing defines in older expat libraries | CET-REVIEW */
/* Taken from expat_external.h (Expat 1.95.7) */
#ifndef XML_STATUS_OK
# define XML_STATUS_OK 1
#endif
#ifndef XML_STATUS_ERROR
# define XML_STATUS_ERROR 0
#endif
#ifndef XMLCALL
#if defined(XML_USE_MSC_EXTENSIONS)
#define XMLCALL __cdecl
#elif defined(__GNUC__) && defined(__i386)
#define XMLCALL __attribute__((cdecl))
#else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
#define XMLCALL
#endif
#endif /* not defined XMLCALL */
#if HAVE_LIBEXPAT
int XMLCALL cet_lib_expat_UnknownEncodingHandler(void* data, const XML_Char
* encoding, XML_Encoding* info);
#endif
/* helpers */ /* helpers */
char* cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec); char* cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec);
char* cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, cons t cet_cs_vec_t* dest_vec); char* cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, cons t cet_cs_vec_t* dest_vec);
int cet_valid_char(const char* src, const cet_cs_vec_t* vec); int cet_valid_char(const char* src, const cet_cs_vec_t* vec);
int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...); int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...);
/* cet_convert_string: !!! ONLY VALID WITHIN 'cet_convert_strings' process !!! */ /* cet_convert_string: !!! ONLY VALID WITHIN 'cet_convert_strings' process !!! */
char* cet_convert_string(char* str); char* cet_convert_string(char* str);
const char* cet_convert_string(const QString& str);
/* gpsbabel extensions */ /* gpsbabel extensions */
void cet_convert_init(const char* cs_name, const int force); void cet_convert_init(const char* cs_name, const int force);
void cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* ta rget, const char* format); void cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* ta rget, const char* format);
void cet_convert_deinit(void); void cet_convert_deinit(void);
void cet_disp_character_set_names(FILE* fout); void cet_disp_character_set_names(FILE* fout);
/*
* Conversion from XML_Char string to char string. If XML_Char is the
* same as char, these routines do nothing. If XML_Char is a wide
* character, xml_convert_to_char_string converts the string to a
* newly allocated char string, and xml_free_converted_string frees
* it.
*/
const char* xml_convert_to_char_string_n(const XML_Char* str, int* nbytes);
const char* xml_convert_to_char_string(const XML_Char* str);
void xml_free_converted_string(const char* str);
const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr);
void xml_free_converted_attrs(const char** attr);
#endif #endif
 End of changes. 4 change blocks. 
57 lines changed or deleted 1 lines changed or added


 config.h   config.h 
/* config.h. Generated from config.h.in by configure. */ /* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */ /* config.h.in. Generated from configure.in by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* 0 for most-used character sets */ /* 0 for most-used character sets */
#define CET_WANTED 0 #define CET_WANTED 0
/* 1 to enable the CSV formats support */ /* 1 to enable the CSV formats support */
#define CSVFMTS_ENABLED 1 #define CSVFMTS_ENABLED 1
/* 1 to enable all the filters. */ /* 1 to enable all the filters. */
#define FILTERS_ENABLED 1 #define FILTERS_ENABLED 1
/* Defined if you have libexpat */ /* Define to 1 if you have the `glob' function. */
#define HAVE_LIBEXPAT 1 #define HAVE_GLOB 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `m' library (-lm). */ /* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1 #define HAVE_LIBM 1
/* Defined if you have libusb */ /* Defined if you have libusb */
#define HAVE_LIBUSB 1 #define HAVE_LIBUSB 1
/* Defined if you have Linux HID interface */
#define HAVE_LINUX_HID 1
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
/* #undef HAVE_LIBZ */ /* #undef HAVE_LIBZ */
/* Defined if you have Linux HID */
#define HAVE_LINUX_HID 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `nanosleep' function. */ /* Define to 1 if you have the `nanosleep' function. */
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
/* Define to 1 if you have the `sleep' function. */ /* Define to 1 if you have the `sleep' function. */
#define HAVE_SLEEP 1 #define HAVE_SLEEP 1
/* Define to 1 if you have the `glob' function. */ /* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_GLOB 1 #define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `uname' function. */ /* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1 #define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if we have va_copy */ /* Define if we have va_copy */
#define HAVE_VA_COPY 1 #define HAVE_VA_COPY 1
/* Define if we have __va_copy */
#define HAVE___VA_COPY 1
/* Define as 1 if your va_list type is an array */ /* Define as 1 if your va_list type is an array */
/* #undef HAVE_VA_LIST_AS_ARRAY */ /* #undef HAVE_VA_LIST_AS_ARRAY */
/* Defined if you have Windows DDK */
/* #undef HAVE_WDK */
/* Define if we have __va_copy */
#define HAVE___VA_COPY 1
/* 1 to enable as many formats as possible */ /* 1 to enable as many formats as possible */
#define MAXIMAL_ENABLED 1 #define MAXIMAL_ENABLED 1
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS" #define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS"
/* Define to the full name of this package. */ /* Define to the full name of this package. */
#define PACKAGE_NAME "GPSBabel" #define PACKAGE_NAME "GPSBabel"
/* Define to the release name of this package. */ /* Define to the release name of this package. */
#define PACKAGE_RELEASE "" #define PACKAGE_RELEASE ""
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "GPSBabel 1.4.4" #define PACKAGE_STRING "GPSBabel 1.5.0"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gpsbabel" #define PACKAGE_TARNAME "gpsbabel"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "1.4.4" #define PACKAGE_VERSION "1.5.0"
/* 1 to enable Palm PDB support */ /* 1 to enable Palm PDB support */
#define PDBFMTS_ENABLED 1 #define PDBFMTS_ENABLED 1
/* 1 to enable shapefile support */ /* 1 to enable shapefile support */
#define SHAPELIB_ENABLED 1 #define SHAPELIB_ENABLED 1
/* Define to 1 if your processor stores words with the most significant byt /* Define to 1 if you have the ANSI C header files. */
e #define STDC_HEADERS 1
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* 1 to inhibit our use of zlib. */ /* 1 to inhibit our use of zlib. */
/* #undef ZLIB_INHIBITED */ /* #undef ZLIB_INHIBITED */
/* #undef HAVE_WDK */
 End of changes. 13 change blocks. 
16 lines changed or deleted 59 lines changed or added


 crc32.h   crc32.h 
/* crc32.h -- tables for rapid CRC calculation /* crc32.h -- tables for rapid CRC calculation
* Generated automatically by crc32.c * Generated automatically by crc32.c
*/ */
local const unsigned long FAR crc_table[TBLS][256] = local const z_crc_t FAR crc_table[TBLS][256] =
{ {
{ {
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 csv_util.h   csv_util.h 
/* /*
Copyright (C) 2002 Alex Mottram (geo_alexm at cox-internet.com) Copyright (C) 2002 Alex Mottram (geo_alexm at cox-internet.com)
Copyright (C) 2002-2014 Robert Lipe
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 29 skipping to change at line 30
/* function prototypes */ /* function prototypes */
char* char*
#ifndef DEBUG_MEM #ifndef DEBUG_MEM
csv_stringtrim(const char* string, const char* enclosure, int strip_max); csv_stringtrim(const char* string, const char* enclosure, int strip_max);
#else #else
CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DE BUG_PARAMS); CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DE BUG_PARAMS);
#define csv_stringtrim( s, e,m ) CSV_STRINGTRIM( s, e, m, __FILE__, __LINE_ _) #define csv_stringtrim( s, e,m ) CSV_STRINGTRIM( s, e, m, __FILE__, __LINE_ _)
#endif #endif
QString csv_stringtrim(const QString& source, const QString& enclosure);
char* char*
csv_lineparse(const char* stringstart, const char* delimited_by, const char * enclosed_in, const int line_no); csv_lineparse(const char* stringstart, const char* delimited_by, const char * enclosed_in, const int line_no);
void void
human_to_dec(const char* instr, double* outlat, double* outlon, int which); human_to_dec(const char* instr, double* outlat, double* outlon, int which);
char* char*
#ifndef DEBUG_MEM #ifndef DEBUG_MEM
csv_stringclean(const char* string, const char* chararray); csv_stringclean(const char* string, const char* chararray);
#else #else
CSV_STRINGCLEAN(const char* string, const char* chararray,DEBUG_PARAMS); CSV_STRINGCLEAN(const char* string, const char* chararray,DEBUG_PARAMS);
#define csv_stringclean(s,c) CSV_STRINGCLEAN(s,c,__FILE__,__LINE__) #define csv_stringclean(s,c) CSV_STRINGCLEAN(s,c,__FILE__,__LINE__)
#endif #endif
QString csv_stringclean(const QString& string, const QString& chararray);
void void
xcsv_data_read(void); xcsv_data_read(void);
void void
xcsv_data_write(void); xcsv_data_write(void);
void void
xcsv_file_init(void); xcsv_file_init(void);
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added


 deflate.h   deflate.h 
/* deflate.h -- internal compression state /* deflate.h -- internal compression state
* Copyright (C) 1995-2004 Jean-loup Gailly * Copyright (C) 1995-2012 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: deflate.h,v 1.1 2006-07-22 20:34:07 oliskoli Exp $ */ /* @(#) $Id$ */
#ifndef DEFLATE_H #ifndef DEFLATE_H
#define DEFLATE_H #define DEFLATE_H
#include "zutil.h" #include "zutil.h"
/* define NO_GZIP when compiling if you want to disable gzip header and /* define NO_GZIP when compiling if you want to disable gzip header and
trailer creation by deflate(). NO_GZIP would be used to avoid linking i n trailer creation by deflate(). NO_GZIP would be used to avoid linking i n
the crc code when it is not needed. For shared libraries, gzip encoding the crc code when it is not needed. For shared libraries, gzip encoding
should be left enabled. */ should be left enabled. */
skipping to change at line 51 skipping to change at line 51
#define BL_CODES 19 #define BL_CODES 19
/* number of codes used to transfer the bit lengths */ /* number of codes used to transfer the bit lengths */
#define HEAP_SIZE (2*L_CODES+1) #define HEAP_SIZE (2*L_CODES+1)
/* maximum heap size */ /* maximum heap size */
#define MAX_BITS 15 #define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */ /* All codes must not exceed MAX_BITS bits */
#define Buf_size 16
/* size of bit buffer in bi_buf */
#define INIT_STATE 42 #define INIT_STATE 42
#define EXTRA_STATE 69 #define EXTRA_STATE 69
#define NAME_STATE 73 #define NAME_STATE 73
#define COMMENT_STATE 91 #define COMMENT_STATE 91
#define HCRC_STATE 103 #define HCRC_STATE 103
#define BUSY_STATE 113 #define BUSY_STATE 113
#define FINISH_STATE 666 #define FINISH_STATE 666
/* Stream status */ /* Stream status */
/* Data structure describing a single value and its code string. */ /* Data structure describing a single value and its code string. */
skipping to change at line 103 skipping to change at line 106
typedef struct internal_state { typedef struct internal_state {
z_streamp strm; /* pointer back to this zlib stream */ z_streamp strm; /* pointer back to this zlib stream */
int status; /* as the name implies */ int status; /* as the name implies */
Bytef *pending_buf; /* output still pending */ Bytef *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */ ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */ Bytef *pending_out; /* next pending byte to output to the stream */
uInt pending; /* nb of bytes in the pending buffer */ uInt pending; /* nb of bytes in the pending buffer */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
gz_headerp gzhead; /* gzip header information to write */ gz_headerp gzhead; /* gzip header information to write */
uInt gzindex; /* where in extra, name, or comment */ uInt gzindex; /* where in extra, name, or comment */
Byte method; /* STORED (for zip only) or DEFLATED */ Byte method; /* can only be DEFLATED */
int last_flush; /* value of flush param for previous deflate call */ int last_flush; /* value of flush param for previous deflate call */
/* used by deflate.c: */ /* used by deflate.c: */
uInt w_size; /* LZ77 window size (32K by default) */ uInt w_size; /* LZ77 window size (32K by default) */
uInt w_bits; /* log2(w_size) (8..16) */ uInt w_bits; /* log2(w_size) (8..16) */
uInt w_mask; /* w_size - 1 */ uInt w_mask; /* w_size - 1 */
Bytef *window; Bytef *window;
/* Sliding window. Input bytes are read into the second half of the win dow, /* Sliding window. Input bytes are read into the second half of the win dow,
skipping to change at line 190 skipping to change at line 193
int level; /* compression level (1..9) */ int level; /* compression level (1..9) */
int strategy; /* favor or force Huffman coding*/ int strategy; /* favor or force Huffman coding*/
uInt good_match; uInt good_match;
/* Use a faster search when the previous match is longer than this */ /* Use a faster search when the previous match is longer than this */
int nice_match; /* Stop searching when current match exceeds this */ int nice_match; /* Stop searching when current match exceeds this */
/* used by trees.c: */ /* used by trees.c: */
/* Didn't use ct_data typedef below to supress compiler warning */ /* Didn't use ct_data typedef below to suppress compiler warning */
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit length s */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit length s */
struct tree_desc_s l_desc; /* desc. for literal tree */ struct tree_desc_s l_desc; /* desc. for literal tree */
struct tree_desc_s d_desc; /* desc. for distance tree */ struct tree_desc_s d_desc; /* desc. for distance tree */
struct tree_desc_s bl_desc; /* desc. for bit length tree * / struct tree_desc_s bl_desc; /* desc. for bit length tree * /
ush bl_count[MAX_BITS+1]; ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */ /* number of codes at each bit length for an optimal tree */
skipping to change at line 246 skipping to change at line 249
ushf *d_buf; ushf *d_buf;
/* Buffer for distances. To simplify the code, d_buf and l_buf have /* Buffer for distances. To simplify the code, d_buf and l_buf have
* the same number of elements. To use different lengths, an extra flag * the same number of elements. To use different lengths, an extra flag
* array would be necessary. * array would be necessary.
*/ */
ulg opt_len; /* bit length of current block with optimal trees * / ulg opt_len; /* bit length of current block with optimal trees * /
ulg static_len; /* bit length of current block with static trees */ ulg static_len; /* bit length of current block with static trees */
uInt matches; /* number of string matches in current block */ uInt matches; /* number of string matches in current block */
int last_eob_len; /* bit length of EOB code for last block */ uInt insert; /* bytes at end of window left to insert */
#ifdef DEBUG #ifdef DEBUG
ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif #endif
ush bi_buf; ush bi_buf;
/* Output buffer. bits are inserted starting at the bottom (least /* Output buffer. bits are inserted starting at the bottom (least
* significant bits). * significant bits).
*/ */
int bi_valid; int bi_valid;
/* Number of valid bits in bi_buf. All bits above the last valid bit /* Number of valid bits in bi_buf. All bits above the last valid bit
* are always zero. * are always zero.
*/ */
ulg high_water;
/* High water mark offset in window for initialized bytes -- bytes abov
e
* this are set to zero in order to avoid memory check warnings when
* longest match routines access bytes past the input. This is then
* updated to the new high water mark.
*/
} FAR deflate_state; } FAR deflate_state;
/* Output a byte on the stream. /* Output a byte on the stream.
* IN assertion: there is enough room in pending_buf. * IN assertion: there is enough room in pending_buf.
*/ */
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file. /* Minimum amount of lookahead, except at the end of the input file.
* See deflate.c for comments about the MIN_MATCH+1. * See deflate.c for comments about the MIN_MATCH+1.
*/ */
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
/* In order to simplify the code, particularly on 16 bit machines, match /* In order to simplify the code, particularly on 16 bit machines, match
* distances are limited to MAX_DIST instead of WSIZE. * distances are limited to MAX_DIST instead of WSIZE.
*/ */
#define WIN_INIT MAX_MATCH
/* Number of bytes after end of data in window to initialize in order to av
oid
memory checker errors from longest match routines */
/* in trees.c */ /* in trees.c */
void _tr_init OF((deflate_state *s)); void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned l
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, c));
int eof)); void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
void _tr_align OF((deflate_state *s)); ulg stored_len, int last));
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
int eof)); void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
#define d_code(dist) \ #define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and /* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. _dist_code[256] and _dist_code[257] are neve r * must not have side effects. _dist_code[256] and _dist_code[257] are neve r
* used. * used.
*/ */
#ifndef DEBUG #ifndef DEBUG
/* Inline versions of _tr_tally for speed: */ /* Inline versions of _tr_tally for speed: */
#if defined(GEN_TREES_H) || !defined(STDC) #if defined(GEN_TREES_H) || !defined(STDC)
extern uch _length_code[]; extern uch ZLIB_INTERNAL _length_code[];
extern uch _dist_code[]; extern uch ZLIB_INTERNAL _dist_code[];
#else #else
extern const uch _length_code[]; extern const uch ZLIB_INTERNAL _length_code[];
extern const uch _dist_code[]; extern const uch ZLIB_INTERNAL _dist_code[];
#endif #endif
# define _tr_tally_lit(s, c, flush) \ # define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \ { uch cc = (c); \
s->d_buf[s->last_lit] = 0; \ s->d_buf[s->last_lit] = 0; \
s->l_buf[s->last_lit++] = cc; \ s->l_buf[s->last_lit++] = cc; \
s->dyn_ltree[cc].Freq++; \ s->dyn_ltree[cc].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \ flush = (s->last_lit == s->lit_bufsize-1); \
} }
# define _tr_tally_dist(s, distance, length, flush) \ # define _tr_tally_dist(s, distance, length, flush) \
 End of changes. 11 change blocks. 
16 lines changed or deleted 34 lines changed or added


 defs.h   defs.h 
/* /*
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Robert Lipe, robertli pe@usa.net Copyright (C) 2002-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
#ifndef gpsbabel_defs_h_included #ifndef gpsbabel_defs_h_included
#define gpsbabel_defs_h_included #define gpsbabel_defs_h_included
#include <time.h>
#include <stdlib.h> #include <stdint.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include "queue.h" #include "queue.h"
#include "gbtypes.h"
#if HAVE_LIBZ #if HAVE_LIBZ
#include <zlib.h> #include <zlib.h>
#elif !ZLIB_INHIBITED #elif !ZLIB_INHIBITED
#include "zlib/zlib.h" #include "zlib/zlib.h"
#endif #endif
#include "gbfile.h" #include "gbfile.h"
#include "cet.h" #include "cet.h"
#include "cet_util.h" #include "cet_util.h"
#include "inifile.h" #include "inifile.h"
#include "session.h" #include "session.h"
// Turn on Unicode in expat? #include <QtCore/QString>
#ifdef _UNICODE #include <QtCore/QDebug>
# define XML_UNICODE #include <QtCore/QTextStream>
#endif
# include "src/core/datetime.h"
#define CSTR(qstr) (qstr.toUtf8().constData())
/* /*
* Amazingly, this constant is not specified in the standard... * Amazingly, this constant is not specified in the standard...
*/ */
#ifndef M_PI #ifndef M_PI
# define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
#endif #endif
#ifndef FALSE #ifndef FALSE
# define FALSE 0 # define FALSE false
#endif #endif
#ifndef TRUE #ifndef TRUE
# define TRUE !FALSE # define TRUE true
#endif #endif
#define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048) #define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048)
#define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399) #define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399)
#define NMILES_TO_METERS(a) ((a) * 1852.0) /* nautical miles */ #define NMILES_TO_METERS(a) ((a) * 1852.0) /* nautical miles */
#define METERS_TO_NMILES(a) ((a) / 1852.0) #define METERS_TO_NMILES(a) ((a) / 1852.0)
#define MILES_TO_METERS(a) ((a) * 1609.344) #define MILES_TO_METERS(a) ((a) * 1609.344)
#define METERS_TO_MILES(a) ((a) / 1609.344) #define METERS_TO_MILES(a) ((a) / 1609.344)
skipping to change at line 156 skipping to change at line 154
# else # else
# define va_copy(DEST,SRC) ((DEST) = (SRC)) # define va_copy(DEST,SRC) ((DEST) = (SRC))
# endif # endif
# endif # endif
#endif #endif
/* /*
* Common definitions. There should be no protocol or file-specific * Common definitions. There should be no protocol or file-specific
* data in this file. * data in this file.
*/ */
#define BASE_STRUCT(memberp, struct_type, member_name) \ #define BASE_STRUCT(memberp, struct_type, member_name) \
((struct_type *)((char *)(memberp) - offsetof(struct_type, member_name)) ) ((struct_type *)((char *)(memberp) - offsetof(struct_type, member_name)) )
typedef enum { typedef enum {
fix_unknown=-1, fix_unknown=-1,
fix_none=0, fix_none=0,
fix_2d=1, fix_2d=1,
fix_3d, fix_3d,
fix_dgps, fix_dgps,
fix_pps fix_pps
skipping to change at line 218 skipping to change at line 217
cet_cs_vec_t* charset; cet_cs_vec_t* charset;
char* charset_name; char* charset_name;
inifile_t* inifile; inifile_t* inifile;
} global_options; } global_options;
extern global_options global_opts; extern global_options global_opts;
extern const char gpsbabel_version[]; extern const char gpsbabel_version[];
extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in mai n.c with time() */ extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in mai n.c with time() */
extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in mai n.c with current_time(), ! ZERO within testo ! */ extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in mai n.c with current_time(), ! ZERO within testo ! */
extern int geocaches_present; extern int geocaches_present;
extern QTextStream cerr;
#define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */ #define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */
#define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/ #define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/
#define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */ #define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */
#define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */ #define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */
/* Short or Long XML Times */ /* Short or Long XML Times */
#define XML_SHORT_TIME 1 #define XML_SHORT_TIME 1
#define XML_LONG_TIME 2 #define XML_LONG_TIME 2
skipping to change at line 261 skipping to change at line 261
typedef enum { typedef enum {
gc_unknown = 0, gc_unknown = 0,
gc_micro, gc_micro,
gc_other, gc_other,
gc_regular, gc_regular,
gc_large, gc_large,
gc_virtual, gc_virtual,
gc_small gc_small
} geocache_container; } geocache_container;
typedef struct { class utf_string
int is_html; {
char* utfstring; public:
} utf_string; utf_string() :
is_html(false)
typedef struct { {};
bool is_html;
QString utfstring;
};
class geocache_data
{
public:
geocache_data() :
id(0),
type(gt_unknown),
container(gc_unknown),
diff(0),
terr(0),
is_archived(status_unknown),
is_available(status_unknown),
is_memberonly(status_unknown),
has_customcoords(status_unknown),
placer_id(0),
favorite_points(0)
{}
int id; /* The decimal cache number */ int id; /* The decimal cache number */
geocache_type type:5; geocache_type type:5;
geocache_container container:4; geocache_container container:4;
unsigned int diff:6; /* (multiplied by ten internally) */ unsigned int diff:6; /* (multiplied by ten internally) */
unsigned int terr:6; /* (likewise) */ unsigned int terr:6; /* (likewise) */
status_type is_archived:2; status_type is_archived:2;
status_type is_available:2; status_type is_available:2;
status_type is_memberonly:2; status_type is_memberonly:2;
status_type has_customcoords:2; status_type has_customcoords:2;
time_t exported; gpsbabel::DateTime exported;
time_t last_found; gpsbabel::DateTime last_found;
char* placer; /* Placer name */ QString placer; /* Placer name */
int placer_id; /* Placer id */ int placer_id; /* Placer id */
char* hint; /* all these UTF8, XML entities removed, May be not HTML. */ QString hint; /* all these UTF8, XML entities removed, May be not HTML. * /
utf_string desc_short; utf_string desc_short;
utf_string desc_long; utf_string desc_long;
int favorite_points; int favorite_points;
char* personal_note; QString personal_note;
} geocache_data ; };
typedef struct xml_tag {
char* tagname;
char* cdata;
int cdatalen;
char* parentcdata;
int parentcdatalen;
char** attributes;
struct xml_tag* parent;
struct xml_tag* sibling;
struct xml_tag* child;
} xml_tag ;
typedef void (*fs_destroy)(void*); typedef void (*fs_destroy)(void*);
typedef void (*fs_copy)(void**, void*); typedef void (*fs_copy)(void**, void*);
typedef void (*fs_convert)(void*); typedef void (*fs_convert)(void*);
typedef struct format_specific_data { typedef struct format_specific_data {
long type; long type;
struct format_specific_data* next; struct format_specific_data* next;
fs_destroy destroy; fs_destroy destroy;
fs_copy copy; fs_copy copy;
fs_convert convert; fs_convert convert;
} format_specific_data; } format_specific_data;
typedef struct { class gb_color
{
public:
gb_color() :
bbggrr(-1),
opacity(255) {}
int bbggrr; // 32 bit color: Blue/Green/Red. < 0 == unknown. int bbggrr; // 32 bit color: Blue/Green/Red. < 0 == unknown.
unsigned char opacity; // 0 == transparent. 255 == opaque. unsigned char opacity; // 0 == transparent. 255 == opaque.
} gb_color; };
format_specific_data* fs_chain_copy(format_specific_data* source); format_specific_data* fs_chain_copy(format_specific_data* source);
void fs_chain_destroy(format_specific_data* chain); void fs_chain_destroy(format_specific_data* chain);
format_specific_data* fs_chain_find(format_specific_data* chain, long type) ; format_specific_data* fs_chain_find(format_specific_data* chain, long type) ;
void fs_chain_add(format_specific_data** chain, format_specific_data* data) ; void fs_chain_add(format_specific_data** chain, format_specific_data* data) ;
typedef struct fs_xml {
format_specific_data fs;
xml_tag* tag;
} fs_xml;
fs_xml* fs_xml_alloc(long type);
#define FS_GPX 0x67707800L #define FS_GPX 0x67707800L
#define FS_AN1W 0x616e3177L #define FS_AN1W 0x616e3177L
#define FS_AN1L 0x616e316cL #define FS_AN1L 0x616e316cL
#define FS_AN1V 0x616e3176L #define FS_AN1V 0x616e3176L
#define FS_OZI 0x6f7a6900L #define FS_OZI 0x6f7a6900L
#define FS_GMSD 0x474d5344L /* GMSD = Garmin specific data */ #define FS_GMSD 0x474d5344L /* GMSD = Garmin specific data */
#define FS_LOWRANCEUSR4 0x615f234cL #define FS_LOWRANCEUSR4 0x615f234cL
/* /*
* Structures and functions for multiple URLs per waypoint. * Structures and functions for multiple URLs per waypoint.
*/ */
typedef struct url_link {
struct url_link* url_next; class UrlLink
char* url; {
char* url_link_text; public:
} url_link; UrlLink() { }
UrlLink(const QString url) :
url_(url)
{ }
UrlLink(const char* url) :
url_(url)
{ }
UrlLink(const QString url, const QString url_link_text) :
url_(url),
url_link_text_(url_link_text)
{ }
UrlLink(const QString url, const QString url_link_text, const QString url
_link_type) :
url_(url),
url_link_text_(url_link_text),
url_link_type_(url_link_type)
{ }
QString url_;
QString url_link_text_;
QString url_link_type_;
};
/* /*
* Misc bitfields inside struct waypoint; * Misc bitfields inside struct waypoint;
*/ */
typedef struct { class wp_flags
unsigned int icon_descr_is_dynamic:1; {
public:
wp_flags() :
shortname_is_synthetic(0),
cet_converted(0),
fmt_use(0),
temperature(0),
proximity(0),
course(0),
speed(0),
geoidheight(0),
depth(0),
is_split(0),
new_trkseg(0) {}
unsigned int shortname_is_synthetic:1; unsigned int shortname_is_synthetic:1;
unsigned int cet_converted:1; /* strings are converted to UTF8; interesting only for input */ unsigned int cet_converted:1; /* strings are converted to UTF8; interesting only for input */
unsigned int fmt_use:1; /* lightweight "extra data" */ unsigned int fmt_use:2; /* lightweight "extra data" */
/* "flagged fields" */ /* "flagged fields" */
unsigned int temperature:1; /* temperature field is set */ unsigned int temperature:1; /* temperature field is set */
unsigned int proximity:1; /* proximity field is set */ unsigned int proximity:1; /* proximity field is set */
unsigned int course:1; /* course field is set */ unsigned int course:1; /* course field is set */
unsigned int speed:1; /* speed field is set */ unsigned int speed:1; /* speed field is set */
unsigned int geoidheight:1; /* geoidheight field is set */
unsigned int depth:1; /* depth field is set */ unsigned int depth:1; /* depth field is set */
/* !ToDo! /* !ToDo!
unsigned int altitude:1; /+ altitude field is set +/ unsigned int altitude:1; /+ altitude field is set +/
... and others ... and others
*/ */
unsigned int is_split:1; /* the waypoint represents a split * / unsigned int is_split:1; /* the waypoint represents a split * /
unsigned int new_trkseg:1; /* True if first in new trkseg. */ unsigned int new_trkseg:1; /* True if first in new trkseg. */
} wp_flags; };
// These are dicey as they're collected on read. Subsequent filters may cha nge // These are dicey as they're collected on read. Subsequent filters may cha nge
// things, though it's u nlikely to matter in practical terms. Don't use t hese // things, though it's u nlikely to matter in practical terms. Don't use t hese
// if a false positive would be deleterious. // if a false positive would be deleterious.
typedef struct { #
class global_trait
{
public:
global_trait() :
trait_geocaches(0),
trait_heartrate(0),
trait_cadence(0),
trait_power(0),
trait_depth(0),
trait_temperature(0) {}
unsigned int trait_geocaches:1; unsigned int trait_geocaches:1;
unsigned int trait_heartrate:1; unsigned int trait_heartrate:1;
unsigned int trait_cadence:1; unsigned int trait_cadence:1;
unsigned int trait_power:1; unsigned int trait_power:1;
unsigned int trait_depth:1; unsigned int trait_depth:1;
unsigned int trait_temperature:1; unsigned int trait_temperature:1;
} global_trait; };
const global_trait* get_traits(); const global_trait* get_traits();
#define WAYPT_SET(wpt,member,val) { wpt->member = (val); wpt->wpt_flags.mem ber = 1; } #define WAYPT_SET(wpt,member,val) { wpt->member = (val); wpt->wpt_flags.mem ber = 1; }
#define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member) : (def)) #define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member) : (def))
#define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0 #define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0
#define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member) #define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member)
#define CSTRc(qstr) (qstr.toLatin1().constData())
// Maybe the XmlGeneric string callback really shouldn't have a type
// of its own; this was a crutch during the move from char* to QString.
// It's "just" a search and replace to make it go away, but it might
// be convenient to overload some day.
typedef const QString& xg_string;
/* /*
* This is a waypoint, as stored in the GPSR. It tries to not * This is a waypoint, as stored in the GPSR. It tries to not
* cater to any specific model or protocol. Anything that needs to * cater to any specific model or protocol. Anything that needs to
* be truncated, edited, or otherwise trimmed should be done on the * be truncated, edited, or otherwise trimmed should be done on the
* way to the target. * way to the target.
*/ */
class Waypoint
{
private:
static geocache_data empty_gc_data;
typedef struct { public:
queue Q; /* Master waypoint q. Not for use queue Q; /* Master waypoint q. Not for use
by modules. */ by modules. */
double latitude; /* Degrees */ double latitude; /* Degrees */
double longitude; /* Degrees */ double longitude; /* Degrees */
double altitude; /* Meters. */ double altitude; /* Meters. */
double geoidheight; /* Height (in meters) of geoid (mean sea level) abov e WGS84 earth ellipsoid. */
/* /*
* The "thickness" of a waypoint; adds an element of 3D. Can be * The "thickness" of a waypoint; adds an element of 3D. Can be
* used to construct rudimentary polygons for, say, airspace * used to construct rudimentary polygons for, say, airspace
* definitions. The units are meters. * definitions. The units are meters.
*/ */
double depth; double depth;
/* /*
* An alarm trigger value that can be considered to be a circle * An alarm trigger value that can be considered to be a circle
skipping to change at line 421 skipping to change at line 484
* The units are meters. * The units are meters.
*/ */
double proximity; double proximity;
/* shortname is a waypoint name as stored in receiver. It should /* shortname is a waypoint name as stored in receiver. It should
* strive to be, well, short, and unique. Enforcing length and * strive to be, well, short, and unique. Enforcing length and
* character restrictions is the job of the output. A typical * character restrictions is the job of the output. A typical
* minimum length for shortname is 6 characters for NMEA units, * minimum length for shortname is 6 characters for NMEA units,
* 8 for Magellan and 10 for Vista. These are only guidelines. * 8 for Magellan and 10 for Vista. These are only guidelines.
*/ */
char* shortname; QString shortname;
/* /*
* description is typically a human readable description of the * description is typically a human readable description of the
* waypoint. It may be used as a comment field in some receivers. * waypoint. It may be used as a comment field in some receivers.
* These are probably under 40 bytes, but that's only a guideline. * These are probably under 40 bytes, but that's only a guideline.
*/ */
char* description; QString description;
/* /*
* notes are relatively long - over 100 characters - prose associated * notes are relatively long - over 100 characters - prose associated
* with the above. Unlike shortname and description, these are never * with the above. Unlike shortname and description, these are never
* used to compute anything else and are strictly "passed through". * used to compute anything else and are strictly "passed through".
* Few formats support this. * Few formats support this.
*/ */
char* notes; QString notes;
/* This is a bit icky. Multiple waypoint support is an /* TODO: UrlLink should probably move to a "real" class of its own.
* afterthought and I don't want to change our data structures.
* So we have the first in the waypoint itself and subsequent
* ones in a linked list.
* We also use an implicit anonymous union here, so these three
* members must match struct url_link...
*/ */
struct url_link* url_next; QList<UrlLink> url_link_list_;
char* url;
char* url_link_text;
wp_flags wpt_flags; wp_flags wpt_flags;
const char* icon_descr; QString icon_descr;
time_t creation_time; /* standardized in UTC/GMT */
int microseconds; /* Optional millionths of a second. */ gpsbabel::DateTime creation_time;
/* /*
* route priority is for use by the simplify filter. If we have * route priority is for use by the simplify filter. If we have
* some reason to believe that the route point is more important, * some reason to believe that the route point is more important,
* we can give it a higher (numerically; 0 is the lowest) priority. * we can give it a higher (numerically; 0 is the lowest) priority.
* This causes it to be removed last. * This causes it to be removed last.
* This is currently used by the saroute input filter to give named * This is currently used by the saroute input filter to give named
* waypoints (representing turns) a higher priority. * waypoints (representing turns) a higher priority.
* This is also used by the google input filter because they were * This is also used by the google input filter because they were
* nice enough to use exactly the same priority scheme. * nice enough to use exactly the same priority scheme.
skipping to change at line 480 skipping to change at line 536
float course; /* Optional: degrees true */ float course; /* Optional: degrees true */
float speed; /* Optional: meters per second. */ float speed; /* Optional: meters per second. */
fix_type fix; /* Optional: 3d, 2d, etc. */ fix_type fix; /* Optional: 3d, 2d, etc. */
int sat; /* Optional: number of sats used for fix */ int sat; /* Optional: number of sats used for fix */
unsigned char heartrate; /* Beats/min. likely to get moved to fs. */ unsigned char heartrate; /* Beats/min. likely to get moved to fs. */
unsigned char cadence; /* revolutions per minute */ unsigned char cadence; /* revolutions per minute */
float power; /* watts, as measured by cyclists */ float power; /* watts, as measured by cyclists */
float temperature; /* Degrees celsius */ float temperature; /* Degrees celsius */
float odometer_distance; /* Meters? */ float odometer_distance; /* Meters? */
const geocache_data* gc_data; geocache_data* gc_data;
format_specific_data* fs; format_specific_data* fs;
session_t* session; /* pointer to a session struct */ session_t* session; /* pointer to a session struct */
void* extra_data; /* Extra data added by, say, a filter. */ void* extra_data; /* Extra data added by, say, a filter. */
} waypoint;
typedef struct { private:
Waypoint& operator=(const Waypoint& other);
public:
Waypoint();
~Waypoint();
Waypoint(const Waypoint& other);
bool HasUrlLink() const;
const UrlLink& GetUrlLink() const;
const QList<UrlLink> GetUrlLinks() const;
void AddUrlLink(const UrlLink l);
QString CreationTimeXML() const;
gpsbabel::DateTime GetCreationTime() const;
void SetCreationTime(gpsbabel::DateTime t);
void SetCreationTime(time_t t);
void SetCreationTime(time_t t, int ms);
geocache_data* AllocGCData();
int EmptyGCData() const;
};
class route_head
{
public:
queue Q; /* Link onto parent list. */ queue Q; /* Link onto parent list. */
queue waypoint_list; /* List of child waypoints */ queue waypoint_list; /* List of child waypoints */
char* rte_name; QString rte_name;
char* rte_desc; QString rte_desc;
char* rte_url; QString rte_url;
int rte_num; int rte_num;
int rte_waypt_ct; /* # waypoints in waypoint list */ int rte_waypt_ct; /* # waypoints in waypoint list */
format_specific_data* fs; format_specific_data* fs;
unsigned short cet_converted; /* strings are converted to UTF8; in teresting only for input */ unsigned short cet_converted; /* strings are converted to UTF8; in teresting only for input */
gb_color line_color; /* Optional line color for rendering */ gb_color line_color; /* Optional line color for rendering */
int line_width; /* in pixels (sigh). < 0 is unknown. */ int line_width; /* in pixels (sigh). < 0 is unknown. */
session_t* session; /* pointer to a session struct */ session_t* session; /* pointer to a session struct */
} route_head;
public:
route_head();
~route_head();
};
/* /*
* Structure of recomputed track/roue data. * Structure of recomputed track/roue data.
*/ */
typedef struct { typedef struct {
double distance_meters; double distance_meters;
double max_alt; /* unknown_alt => invalid */ double max_alt; /* unknown_alt => invalid */
double min_alt; /* -unknown_alt => invalid */ double min_alt; /* -unknown_alt => invalid */
double max_spd; /* Meters/sec */ double max_spd; /* Meters/sec */
double min_spd; /* Meters/sec */ double min_spd; /* Meters/sec */
skipping to change at line 542 skipping to change at line 624
volatile int request_terminate; volatile int request_terminate;
} posn_status; } posn_status;
extern posn_status tracking_status; extern posn_status tracking_status;
typedef void (*ff_init)(char const*); typedef void (*ff_init)(char const*);
typedef void (*ff_deinit)(void); typedef void (*ff_deinit)(void);
typedef void (*ff_read)(void); typedef void (*ff_read)(void);
typedef void (*ff_write)(void); typedef void (*ff_write)(void);
typedef void (*ff_exit)(void); typedef void (*ff_exit)(void);
typedef void (*ff_writeposn)(waypoint*); typedef void (*ff_writeposn)(Waypoint*);
typedef waypoint* (*ff_readposn)(posn_status*); typedef Waypoint* (*ff_readposn)(posn_status*);
#ifndef DEBUG_MEM #ifndef DEBUG_MEM
char* get_option(const char* iarglist, const char* argname); char* get_option(const char* iarglist, const char* argname);
#else #else
#define DEBUG_PARAMS const char *file, const int line #define DEBUG_PARAMS const char *file, const int line
char* GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS); char* GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS);
#define get_option(iarglist, argname) GET_OPTION(iarglist, argname, __FILE_ _, __LINE__) #define get_option(iarglist, argname) GET_OPTION(iarglist, argname, __FILE_ _, __LINE__)
#endif #endif
typedef void (*filter_init)(char const*); typedef void (*filter_init)(char const*);
typedef void (*filter_process)(void); typedef void (*filter_process)(void);
typedef void (*filter_deinit)(void); typedef void (*filter_deinit)(void);
typedef void (*filter_exit)(void); typedef void (*filter_exit)(void);
typedef void (*waypt_cb)(const waypoint*); typedef void (*waypt_cb)(const Waypoint*);
typedef void (*route_hdr)(const route_head*); typedef void (*route_hdr)(const route_head*);
typedef void (*route_trl)(const route_head*); typedef void (*route_trl)(const route_head*);
void waypt_add(waypoint*); void waypt_add(Waypoint*);
waypoint* waypt_dupe(const waypoint*); Waypoint* waypt_dupe(const Waypoint*);
waypoint* waypt_new(void); Waypoint* waypt_new(void);
void waypt_del(waypoint*); void waypt_del(Waypoint*);
void waypt_free(waypoint*); void waypt_free(Waypoint*);
void waypt_disp_all(waypt_cb); void waypt_disp_all(waypt_cb);
void waypt_disp_session(const session_t* se, waypt_cb cb); void waypt_disp_session(const session_t* se, waypt_cb cb);
void waypt_init_bounds(bounds* bounds); void waypt_init_bounds(bounds* bounds);
int waypt_bounds_valid(bounds* bounds); int waypt_bounds_valid(bounds* bounds);
void waypt_add_to_bounds(bounds* bounds, const waypoint* waypointp); void waypt_add_to_bounds(bounds* bounds, const Waypoint* waypointp);
void waypt_compute_bounds(bounds*); void waypt_compute_bounds(bounds*);
double gcgeodist(const double lat1, const double lon1, double gcgeodist(const double lat1, const double lon1,
const double lat2, const double lon2); const double lat2, const double lon2);
void waypt_flush(queue*); void waypt_flush(queue*);
void waypt_flush_all(void); void waypt_flush_all(void);
unsigned int waypt_count(void); unsigned int waypt_count(void);
void set_waypt_count(unsigned int nc); void set_waypt_count(unsigned int nc);
void waypt_add_url(waypoint* wpt, char* link, char* url_link_text); void waypt_add_url(Waypoint* wpt, const QString& link,
void free_gpx_extras(xml_tag* tag); const QString& url_link_text);
void waypt_add_url(Waypoint* wpt, const QString& link,
const QString& url_link_text,
const QString& url_link_type);
void xcsv_setup_internal_style(const char* style_buf); void xcsv_setup_internal_style(const char* style_buf);
void xcsv_read_internal_style(const char* style_buf); void xcsv_read_internal_style(const char* style_buf);
waypoint* find_waypt_by_name(const char* name); Waypoint* find_waypt_by_name(const QString& name);
void waypt_backup(signed int* count, queue** head_bak); void waypt_backup(signed int* count, queue** head_bak);
void waypt_restore(signed int count, queue* head_bak); void waypt_restore(signed int count, queue* head_bak);
geocache_data* waypt_alloc_gc_data(waypoint* wpt); geocache_data* waypt_alloc_gc_data(Waypoint* wpt);
int waypt_empty_gc_data(const waypoint* wpt); int waypt_empty_gc_data(const Waypoint* wpt);
geocache_type gs_mktype(const char* t); geocache_type gs_mktype(const QString& t);
geocache_container gs_mkcont(const char* t); geocache_container gs_mkcont(const QString& t);
route_head* route_head_alloc(void); route_head* route_head_alloc(void);
void route_add(waypoint*); void route_add(Waypoint*);
void route_add_wpt(route_head* rte, waypoint* wpt); void route_add_wpt(route_head* rte, Waypoint* wpt);
void route_del_wpt(route_head* rte, waypoint* wpt); void route_add_wpt_named(route_head* rte, Waypoint* wpt, const QString& nam
void track_add_wpt(route_head* rte, waypoint* wpt); epart, int number_digits);
void track_del_wpt(route_head* rte, waypoint* wpt); void route_del_wpt(route_head* rte, Waypoint* wpt);
void track_add_wpt(route_head* rte, Waypoint* wpt);
void track_add_wpt_named(route_head* rte, Waypoint* wpt, const QString& nam
epart, int number_digits);
void track_del_wpt(route_head* rte, Waypoint* wpt);
void route_add_head(route_head* rte); void route_add_head(route_head* rte);
void route_del_head(route_head* rte); void route_del_head(route_head* rte);
void route_reverse(const route_head* rte_hd); void route_reverse(const route_head* rte_hd);
waypoint* route_find_waypt_by_name(route_head* rh, const char* name); Waypoint* route_find_waypt_by_name(route_head* rh, const char* name);
void track_add_head(route_head* rte); void track_add_head(route_head* rte);
void track_del_head(route_head* rte); void track_del_head(route_head* rte);
void track_insert_head(route_head* rte, route_head* predecessor); void track_insert_head(route_head* rte, route_head* predecessor);
void route_disp(const route_head* rte, waypt_cb); void route_disp(const route_head* rte, waypt_cb);
void route_disp_all(route_hdr, route_trl, waypt_cb); void route_disp_all(route_hdr, route_trl, waypt_cb);
void track_disp_all(route_hdr, route_trl, waypt_cb); void track_disp_all(route_hdr, route_trl, waypt_cb);
void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, wa ypt_cb wc); void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, wa ypt_cb wc);
void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, wa ypt_cb wc); void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, wa ypt_cb wc);
void route_flush(queue*); void route_flush(queue*);
void route_flush_all(void); void route_flush_all(void);
skipping to change at line 653 skipping to change at line 740
unsigned int mustupper:1; unsigned int mustupper:1;
unsigned int whitespaceok:1; unsigned int whitespaceok:1;
unsigned int repeating_whitespaceok:1; unsigned int repeating_whitespaceok:1;
unsigned int must_uniq:1; unsigned int must_uniq:1;
unsigned int is_utf8:1; unsigned int is_utf8:1;
} mkshort_handle_imp; } mkshort_handle_imp;
typedef mkshort_handle_imp* short_handle; typedef mkshort_handle_imp* short_handle;
#ifndef DEBUG_MEM #ifndef DEBUG_MEM
char* mkshort(short_handle, const char*); char* mkshort(short_handle, const char*);
QString mkshort(short_handle, const QString&);
short_handle mkshort_new_handle(void); short_handle mkshort_new_handle(void);
#else #else
char* MKSHORT(short_handle, const char*, DEBUG_PARAMS); char* MKSHORT(short_handle, const char*, DEBUG_PARAMS);
short_handle MKSHORT_NEW_HANDLE(DEBUG_PARAMS); short_handle MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
#define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__) #define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__)
#define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__) #define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__)
#endif #endif
char* mkshort_from_wpt(short_handle h, const waypoint* wpt); QString mkshort_from_wpt(short_handle h, const Waypoint* wpt);
void mkshort_del_handle(short_handle* h); void mkshort_del_handle(short_handle* h);
void setshort_length(short_handle, int n); void setshort_length(short_handle, int n);
void setshort_badchars(short_handle, const char*); void setshort_badchars(short_handle, const char*);
void setshort_goodchars(short_handle, const char*); void setshort_goodchars(short_handle, const char*);
void setshort_mustupper(short_handle, int n); void setshort_mustupper(short_handle, int n);
void setshort_mustuniq(short_handle, int n); void setshort_mustuniq(short_handle, int n);
void setshort_whitespace_ok(short_handle, int n); void setshort_whitespace_ok(short_handle, int n);
void setshort_repeating_whitespace_ok(short_handle, int n); void setshort_repeating_whitespace_ok(short_handle, int n);
void setshort_defname(short_handle, const char* s); void setshort_defname(short_handle, const char* s);
void setshort_is_utf8(short_handle h, const int is_utf8); void setshort_is_utf8(short_handle h, const int is_utf8);
/*
* Vmem flags values.
*/
#define VMFL_NOZERO (1 << 0)
typedef struct vmem {
char* mem; /* visible memory object */
size_t size; /* allocated size of object */
} vmem_t;
vmem_t vmem_alloc(size_t, int flags);
void vmem_free(vmem_t*);
void vmem_realloc(vmem_t*, size_t);
#define ARGTYPE_UNKNOWN 0x00000000 #define ARGTYPE_UNKNOWN 0x00000000
#define ARGTYPE_INT 0x00000001 #define ARGTYPE_INT 0x00000001
#define ARGTYPE_FLOAT 0x00000002 #define ARGTYPE_FLOAT 0x00000002
#define ARGTYPE_STRING 0x00000003 #define ARGTYPE_STRING 0x00000003
#define ARGTYPE_BOOL 0x00000004 #define ARGTYPE_BOOL 0x00000004
#define ARGTYPE_FILE 0x00000005 #define ARGTYPE_FILE 0x00000005
#define ARGTYPE_OUTFILE 0x00000006 #define ARGTYPE_OUTFILE 0x00000006
/* REQUIRED means that the option is required to be set. /* REQUIRED means that the option is required to be set.
* See also BEGIN/END_REQ */ * See also BEGIN/END_REQ */
skipping to change at line 719 skipping to change at line 795
* If exactly one must be set, use with BEGIN/END_EXCL * If exactly one must be set, use with BEGIN/END_EXCL
* Both of these flags set is synonymous with REQUIRED, so use that instead * Both of these flags set is synonymous with REQUIRED, so use that instead
* for "groups" of exactly one option. */ * for "groups" of exactly one option. */
#define ARGTYPE_BEGIN_REQ 0x04000000 #define ARGTYPE_BEGIN_REQ 0x04000000
#define ARGTYPE_END_REQ 0x02000000 #define ARGTYPE_END_REQ 0x02000000
#define ARGTYPE_TYPEMASK 0x00000fff #define ARGTYPE_TYPEMASK 0x00000fff
#define ARGTYPE_FLAGMASK 0xfffff000 #define ARGTYPE_FLAGMASK 0xfffff000
#define ARG_NOMINMAX NULL, NULL #define ARG_NOMINMAX NULL, NULL
#define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX} #define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX, NULL}
typedef struct arglist { typedef struct arglist {
const char* argstring; const char* argstring;
char** argval; char** argval;
const char* helpstring; const char* helpstring;
const char* defaultvalue; const char* defaultvalue;
const gbuint32 argtype; const uint32_t argtype;
const char* minvalue; /* minimum value for numeric options */ const char* minvalue; /* minimum value for numeric options */
const char* maxvalue; /* maximum value for numeric options */ const char* maxvalue; /* maximum value for numeric options */
char* argvalptr; /* !!! internal helper. Not used in definitions !!! */ char* argvalptr; /* !!! internal helper. Not used in definitions !!! */
} arglist_t; } arglist_t;
typedef enum { typedef enum {
ff_type_file = 1, /* normal format: useful to a GUI. */ ff_type_file = 1, /* normal format: useful to a GUI. */
ff_type_internal, /* fmt not useful with default options */ ff_type_internal, /* fmt not useful with default options */
ff_type_serial /* format describes a serial protocol (GUI c an display port names) */ ff_type_serial /* format describes a serial protocol (GUI c an display port names) */
} ff_type; } ff_type;
skipping to change at line 769 skipping to change at line 845
typedef struct position_ops { typedef struct position_ops {
ff_init rd_init; ff_init rd_init;
ff_readposn rd_position; ff_readposn rd_position;
ff_deinit rd_deinit; ff_deinit rd_deinit;
ff_init wr_init; ff_init wr_init;
ff_writeposn wr_position; ff_writeposn wr_position;
ff_deinit wr_deinit; ff_deinit wr_deinit;
} position_ops_t; } position_ops_t;
#define NULL_POS_OPS { 0, 0, 0, 0, 0, 0, }
/* /*
* Describe the file format to the caller. * Describe the file format to the caller.
*/ */
typedef struct ff_vecs { typedef struct ff_vecs {
ff_type type; ff_type type;
ff_cap cap[3]; ff_cap cap[3];
ff_init rd_init; ff_init rd_init;
ff_init wr_init; ff_init wr_init;
ff_deinit rd_deinit; ff_deinit rd_deinit;
ff_deinit wr_deinit; ff_deinit wr_deinit;
skipping to change at line 797 skipping to change at line 875
} ff_vecs_t; } ff_vecs_t;
typedef struct style_vecs { typedef struct style_vecs {
const char* name; const char* name;
const char* style_buf; const char* style_buf;
} style_vecs_t; } style_vecs_t;
extern style_vecs_t style_list[]; extern style_vecs_t style_list[];
void waypt_init(void); void waypt_init(void);
void route_init(void); void route_init(void);
void waypt_disp(const waypoint*); void waypt_disp(const Waypoint*);
void waypt_status_disp(int total_ct, int myct); void waypt_status_disp(int total_ct, int myct);
double waypt_time(const waypoint* wpt); double waypt_time(const Waypoint* wpt);
double waypt_speed(const waypoint* A, const waypoint* B); double waypt_speed(const Waypoint* A, const Waypoint* B);
double waypt_speed_ex(const waypoint* A, const waypoint* B); double waypt_speed_ex(const Waypoint* A, const Waypoint* B);
double waypt_course(const waypoint* A, const waypoint* B); double waypt_course(const Waypoint* A, const Waypoint* B);
double waypt_distance(const waypoint* A, const waypoint* B); double waypt_distance(const Waypoint* A, const Waypoint* B);
double waypt_distance_ex(const waypoint* A, const waypoint* B); double waypt_distance_ex(const Waypoint* A, const Waypoint* B);
NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2); NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2);
void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3); void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3);
void warning(const char*, ...) PRINTFLIKE(1, 2); void warning(const char*, ...) PRINTFLIKE(1, 2);
void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3); void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3);
ff_vecs_t* find_vec(char* const, char**); ff_vecs_t* find_vec(const char*, const char**);
void assign_option(const char* vecname, arglist_t* ap, const char* val); void assign_option(const char* vecname, arglist_t* ap, const char* val);
void disp_vec_options(const char* vecname, arglist_t* ap); void disp_vec_options(const char* vecname, arglist_t* ap);
void disp_vecs(void); void disp_vecs(void);
void disp_vec(const char* vecname); void disp_vec(const char* vecname);
void init_vecs(void); void init_vecs(void);
void exit_vecs(void); void exit_vecs(void);
void disp_formats(int version); void disp_formats(int version);
const char* name_option(long type); const char* name_option(long type);
void printposn(const double c, int is_lat); void printposn(const double c, int is_lat);
#ifndef DEBUG_MEM #ifndef DEBUG_MEM
void* xcalloc(size_t nmemb, size_t size); void* xcalloc(size_t nmemb, size_t size);
void* xmalloc(size_t size); void* xmalloc(size_t size);
void* xrealloc(void* p, size_t s); void* xrealloc(void* p, size_t s);
void xfree(void* mem); void xfree(const void* mem);
char* xstrdup(const char* s); char* xstrdup(const QString& s);
char* xstrndup(const char* s, size_t n); char* xstrndup(const char* s, size_t n);
char* xstrndupt(const char* s, size_t n); char* xstrndupt(const char* s, size_t n);
char* xstrappend(char* src, const char* addon); char* xstrappend(char* src, const char* addon);
#define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size) #define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size)
#define xxmalloc(size, file, line) xmalloc(size) #define xxmalloc(size, file, line) xmalloc(size)
#define xxrealloc(p, s, file, line) xrealloc(p,s) #define xxrealloc(p, s, file, line) xrealloc(p,s)
#define xxfree(mem, file, line) xfree(mem) #define xxfree(mem, file, line) xfree(mem)
#define xxstrdup(s, file, line) xstrdup(s) #define xxstrdup(s, file, line) xstrdup(s)
#define xxstrappend(src, addon, file, line) xstrappend(src, addon) #define xxstrappend(src, addon, file, line) xstrappend(src, addon)
#else /* DEBUG_MEM */ #else /* DEBUG_MEM */
skipping to change at line 867 skipping to change at line 945
#define xxcalloc XCALLOC #define xxcalloc XCALLOC
#define xxmalloc XMALLOC #define xxmalloc XMALLOC
#define xxrealloc XREALLOC #define xxrealloc XREALLOC
#define xxfree XFREE #define xxfree XFREE
#define xxstrdup XSTRDUP #define xxstrdup XSTRDUP
#define xxstrndupt XSTRNDUPT #define xxstrndupt XSTRNDUPT
#define xxstrappend XSTRAPPEND #define xxstrappend XSTRAPPEND
#endif /* DEBUG_MEM */ #endif /* DEBUG_MEM */
FILE* xfopen(const char* fname, const char* type, const char* errtxt); FILE* xfopen(const char* fname, const char* type, const char* errtxt);
void xfprintf(const char* errtxt, FILE* stream, const char* format, ...);
void xfputs(const char* errtxt, const char* s, FILE* stream);
int case_ignore_strcmp(const char* s1, const char* s2); // FIXME: case_ignore_strcmp() and case_ignore_strncmp() should probably
int case_ignore_strncmp(const char* s1, const char* s2, int n); // just be replaced at the call sites. These shims are just here to make
// them more accomidating of QString input.
inline int
case_ignore_strcmp(const QString& s1, const QString& s2) {
return QString::compare(s1, s2, Qt::CaseInsensitive);
}
// In 95% of the callers, this could be s1.startsWith(s2)...
inline int case_ignore_strncmp(const QString& s1, const QString& s2, int n)
{
return s1.left(n).compare(s2, Qt::CaseInsensitive);
}
int str_match(const char* str, const char* match); int str_match(const char* str, const char* match);
int case_ignore_str_match(const char* str, const char* match); int case_ignore_str_match(const char* str, const char* match);
char* strenquote(const char* str, const char quot_char); QString strenquote(const QString& str, const QChar quot_char);
char* strsub(const char* s, const char* search, const char* replace); char* strsub(const char* s, const char* search, const char* replace);
char* gstrsub(const char* s, const char* search, const char* replace); char* gstrsub(const char* s, const char* search, const char* replace);
char* xstrrstr(const char* s1, const char* s2); const char* xstrrstr(const char* s1, const char* s2);
void rtrim(char* s); void rtrim(char* s);
char* lrtrim(char* s); char* lrtrim(char* s);
int xasprintf(char** strp, const char* fmt, ...) PRINTFLIKE(2, 3); int xasprintf(char** strp, const char* fmt, ...) PRINTFLIKE(2, 3);
int xasprintf(QString* strp, const char* fmt, ...) PRINTFLIKE(2, 3);
int xvasprintf(char** strp, const char* fmt, va_list ap); int xvasprintf(char** strp, const char* fmt, va_list ap);
char* strupper(char* src); char* strupper(char* src);
char* strlower(char* src); char* strlower(char* src);
signed int get_tz_offset(void); signed int get_tz_offset(void);
time_t mklocaltime(struct tm* t); time_t mklocaltime(struct tm* t);
time_t mkgmtime(struct tm* t); time_t mkgmtime(struct tm* t);
time_t current_time(void); gpsbabel::DateTime current_time(void);
void dotnet_time_to_time_t(double dotnet, time_t* t, int* ms); void dotnet_time_to_time_t(double dotnet, time_t* t, int* ms);
signed int month_lookup(const char* m); signed int month_lookup(const char* m);
const char* get_cache_icon(const waypoint* waypointp); const char* get_cache_icon(const Waypoint* waypointp);
const char* gs_get_cachetype(geocache_type t); const char* gs_get_cachetype(geocache_type t);
const char* gs_get_container(geocache_container t); const char* gs_get_container(geocache_container t);
char* xml_entitize(const char* str); char* xml_entitize(const char* str);
char* html_entitize(const char* str); char* html_entitize(const QString& str);
char* strip_html(const utf_string*); char* strip_html(const utf_string*);
char* strip_nastyhtml(const char* in); char* strip_nastyhtml(const QString& in);
char* convert_human_date_format(const char* human_datef); /* "MM,YYYY, DD" -> "%m,%Y,%d" */ char* convert_human_date_format(const char* human_datef); /* "MM,YYYY, DD" -> "%m,%Y,%d" */
char* convert_human_time_format(const char* human_timef); /* "HH+mm+ss " -> "%H+%M+%S" */ 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 */ 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 */
char* get_filename(const char* fname); /* extract t he filename portion */ const char* get_filename(const char* fname); /* extract t he filename portion */
/* /*
* Character encoding transformations. * Character encoding transformations.
*/ */
#define CET_NOT_CONVERTABLE_DEFAULT '$' #define CET_NOT_CONVERTABLE_DEFAULT '$'
#define CET_CHARSET_ASCII "US-ASCII" #define CET_CHARSET_ASCII "US-ASCII"
#define CET_CHARSET_UTF8 "UTF-8" #define CET_CHARSET_UTF8 "UTF-8"
#define CET_CHARSET_HEBREW "CP1255" #define CET_CHARSET_HEBREW "CP1255"
#define CET_CHARSET_MS_ANSI "MS-ANSI" #define CET_CHARSET_MS_ANSI "MS-ANSI"
#define CET_CHARSET_LATIN1 "ISO-8859-1" #define CET_CHARSET_LATIN1 "ISO-8859-1"
#define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str)) #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str))
#define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str)) #define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str))
#define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str)) #define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str))
#define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str)) #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str))
/* this lives in gpx.c */ /* this lives in gpx.c */
time_t xml_parse_time(const char* cdatastr, int* microsecs); gpsbabel::DateTime xml_parse_time(const QString& cdatastr);
xml_tag* xml_findfirst(xml_tag* root, const char* tagname); char* rot13(const QString& str);
xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname);
char* xml_attribute(xml_tag* tag, const char* attrname);
char* rot13(const char* str);
/* /*
* PalmOS records like fixed-point numbers, which should be rounded * PalmOS records like fixed-point numbers, which should be rounded
* to deal with possible floating-point representation errors. * to deal with possible floating-point representation errors.
*/ */
signed int si_round(double d); signed int si_round(double d);
#if _MSC_VER
//These functions are not included in the MS pre C99 implementation, use in
ternal implementation
//This asssumes that non-_MSC_VER includes math.h (all should include defs.
h)
#define round si_round
#define lround si_round
#endif
/* /*
* Data types for Palm/OS files. * Data types for Palm/OS files.
*/ */
typedef struct { typedef struct {
unsigned char data[4]; unsigned char data[4];
} pdb_32; } pdb_32;
typedef struct { typedef struct {
unsigned char data[2]; unsigned char data[2];
} pdb_16; } pdb_16;
skipping to change at line 1018 skipping to change at line 1108
} grid_type; } grid_type;
#define GRID_INDEX_MIN grid_lat_lon_ddd #define GRID_INDEX_MIN grid_lat_lon_ddd
#define GRID_INDEX_MAX grid_swiss #define GRID_INDEX_MAX grid_swiss
#define DATUM_OSGB36 86 #define DATUM_OSGB36 86
#define DATUM_WGS84 118 #define DATUM_WGS84 118
/* bit manipulation functions (util.c) */ /* bit manipulation functions (util.c) */
char gb_getbit(const void* buf, const gbuint32 nr); char gb_getbit(const void* buf, const uint32_t nr);
void gb_setbit(void* buf, const gbuint32 nr); void gb_setbit(void* buf, const uint32_t nr);
void* gb_int2ptr(const int i); void* gb_int2ptr(const int i);
int gb_ptr2int(const void* p); int gb_ptr2int(const void* p);
/* /*
* From parse.c * From parse.c
*/ */
int parse_coordinates(const char* str, int datum, const grid_type grid, int parse_coordinates(const char* str, int datum, const grid_type grid,
double* latitude, double* longitude, const char* modu le); double* latitude, double* longitude, const char* modu le);
int parse_distance(const char* str, double* val, double scale, const char* module); int parse_distance(const char* str, double* val, double scale, const char* module);
skipping to change at line 1051 skipping to change at line 1141
*/ */
typedef enum { typedef enum {
units_unknown = 0, units_unknown = 0,
units_statute = 1, units_statute = 1,
units_metric = 2, units_metric = 2,
units_nautical =3, units_nautical =3,
units_aviation =4 units_aviation =4
} fmt_units; } fmt_units;
int fmt_setunits(fmt_units); int fmt_setunits(fmt_units);
double fmt_distance(const double, char** tag); double fmt_distance(const double, const char** tag);
double fmt_altitude(const double, char** tag); double fmt_altitude(const double, const char** tag);
double fmt_speed(const double, char** tag); double fmt_speed(const double, const char** tag);
/* /*
* From gbsleep.c * From gbsleep.c
*/ */
void gb_sleep(unsigned long microseconds); void gb_sleep(unsigned long microseconds);
/* /*
* From nmea.c * From nmea.c
*/ */
int nmea_cksum(const char* const buf); int nmea_cksum(const char* const buf);
skipping to change at line 1077 skipping to change at line 1167
*/ */
int color_to_bbggrr(const char* cname); int color_to_bbggrr(const char* cname);
/* /*
* A constant for unknown altitude. It's tempting to just use zero * A constant for unknown altitude. It's tempting to just use zero
* but that's not very nice for the folks near sea level. * but that's not very nice for the folks near sea level.
*/ */
#define unknown_alt -99999999.0 #define unknown_alt -99999999.0
#define unknown_color -1 #define unknown_color -1
// TODO: this is a (probably temporary) shim for the C->QString conversion.
// It's here instead of gps to avoid C/C++ linkage issues.
int32_t GPS_Lookup_Datum_Index(const QString& n);
#endif /* gpsbabel_defs_h_included */ #endif /* gpsbabel_defs_h_included */
 End of changes. 72 change blocks. 
151 lines changed or deleted 251 lines changed or added


 donate.h   donate.h 
skipping to change at line 33 skipping to change at line 33
#define DONATE_H #define DONATE_H
#include "ui_donate.h" #include "ui_donate.h"
class Donate: public QDialog { class Donate: public QDialog {
Q_OBJECT Q_OBJECT
public: public:
Donate(QWidget *parent); Donate(QWidget *parent);
void showNever(bool f) { void showNever(bool f) {
ui.neverAgain->setVisible(f); ui_.neverAgain->setVisible(f);
ui.textLine2->setVisible(f); ui_.textLine2->setVisible(f);
} }
bool neverAgain() { return ui.neverAgain->isChecked(); } bool neverAgain() { return ui_.neverAgain->isChecked(); }
private: private:
Ui_Donate ui; Ui_Donate ui_;
private slots: private slots:
void contributeClicked(); void contributeClicked();
}; };
#endif #endif
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 dpencode.h   dpencode.h 
skipping to change at line 47 skipping to change at line 47
private: private:
int computeLevel(double dd); int computeLevel(double dd);
double distance(const LatLng &, const LatLng &, const LatLng &); double distance(const LatLng &, const LatLng &, const LatLng &);
void encodeLevels(string &, const vector<LatLng> &points, const vector<do uble>&dists); void encodeLevels(string &, const vector<LatLng> &points, const vector<do uble>&dists);
void createEncodings(string &encoded_points, void createEncodings(string &encoded_points,
const vector <LatLng> &points, const vector <LatLng> &points,
const vector <double> &dists); const vector <double> &dists);
int numLevels; int numLevels;
double zoomFactor;
double verySmall; double verySmall;
vector <double> zoomLevelBreaks; vector <double> zoomLevelBreaks;
}; };
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 filterdata.h   filterdata.h 
skipping to change at line 35 skipping to change at line 35
#include <QDateTime> #include <QDateTime>
#include <QSettings> #include <QSettings>
#include <QStringList> #include <QStringList>
#include "setting.h" #include "setting.h"
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class FilterData { class FilterData {
public: public:
FilterData(): inUse(true) {}; FilterData(): inUse_(true) {};
virtual ~FilterData() {}; virtual ~FilterData() {};
void saveSettings(QSettings &st) { void saveSettings(QSettings &st) {
SettingGroup sg; SettingGroup sg;
makeSettingGroup(sg); makeSettingGroup(sg);
sg.saveSettings(st); sg.saveSettings(st);
} }
void restoreSettings(QSettings &st) { void restoreSettings(QSettings &st) {
SettingGroup sg; SettingGroup sg;
makeSettingGroup(sg); makeSettingGroup(sg);
sg.restoreSettings(st); sg.restoreSettings(st);
} }
virtual void makeSettingGroup(SettingGroup &sg) = 0; virtual void makeSettingGroup(SettingGroup &sg) = 0;
virtual QStringList makeOptionString() = 0; virtual QStringList makeOptionString() = 0;
public: public:
bool inUse; bool inUse_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class TrackFilterData: public FilterData { class TrackFilterData: public FilterData {
public: public:
TrackFilterData(): FilterData(), title(false), titleString(QString()), TrackFilterData(): FilterData(), title(false), titleString(QString()),
move(false), days(0), hours(0), mins(0), secs(0), move(false), days(0), hours(0), mins(0), secs(0),
TZ(false), TZ(false),
start(false), start(false),
stop(false), stop(false),
skipping to change at line 80 skipping to change at line 80
splitDist(0), splitDistUnit(0) splitDist(0), splitDistUnit(0)
{ {
titleString = "ACTIVE LOG #%Y%m%d"; titleString = "ACTIVE LOG #%Y%m%d";
stopTime = QDateTime::currentDateTime(); stopTime = QDateTime::currentDateTime();
stopTime.setTime(QTime(23, 59, 59)); stopTime.setTime(QTime(23, 59, 59));
startTime = stopTime.addMonths(-6); startTime = stopTime.addMonths(-6);
startTime.setTime(QTime(0, 0, 1)); startTime.setTime(QTime(0, 0, 1));
} }
virtual void makeSettingGroup(SettingGroup &sg) virtual void makeSettingGroup(SettingGroup &sg)
{ {
sg.addVarSetting(new BoolSetting("trks.inUse", inUse)); sg.addVarSetting(new BoolSetting("trks.inUse", inUse_));
sg.addVarSetting(new BoolSetting("trks.GPSFixes", GPSFixes)); sg.addVarSetting(new BoolSetting("trks.GPSFixes", GPSFixes));
sg.addVarSetting(new IntSetting("trks.GPSFixesVal", GPSFixesVal)); sg.addVarSetting(new IntSetting("trks.GPSFixesVal", GPSFixesVal));
sg.addVarSetting(new BoolSetting("trks.course", course)); sg.addVarSetting(new BoolSetting("trks.course", course));
sg.addVarSetting(new BoolSetting("trks.speed", speed)); sg.addVarSetting(new BoolSetting("trks.speed", speed));
sg.addVarSetting(new BoolSetting("trks.pack", pack)); sg.addVarSetting(new BoolSetting("trks.pack", pack));
sg.addVarSetting(new BoolSetting("trks.merge", merge)); sg.addVarSetting(new BoolSetting("trks.merge", merge));
sg.addVarSetting(new BoolSetting("trks.split", split)); sg.addVarSetting(new BoolSetting("trks.split", split));
sg.addVarSetting(new BoolSetting("trks.splitByDate", splitByDate)); sg.addVarSetting(new BoolSetting("trks.splitByDate", splitByDate));
sg.addVarSetting(new BoolSetting("trks.splitByTime", splitByTime)); sg.addVarSetting(new BoolSetting("trks.splitByTime", splitByTime));
sg.addVarSetting(new BoolSetting("trks.splitByDistance", splitByDistanc e)); sg.addVarSetting(new BoolSetting("trks.splitByDistance", splitByDistanc e));
skipping to change at line 145 skipping to change at line 145
position(false), radius(false), sort(false), position(false), radius(false), sort(false),
positionVal(0.0), radiusVal(0.0), positionVal(0.0), radiusVal(0.0),
longVal(0.0), latVal(0.0), longVal(0.0), latVal(0.0),
positionUnit(0), radiusUnit(0) positionUnit(0), radiusUnit(0)
{ {
} }
virtual QStringList makeOptionString(); virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg) virtual void makeSettingGroup(SettingGroup &sg)
{ {
sg.addVarSetting(new BoolSetting("wpts.inUse", inUse)); sg.addVarSetting(new BoolSetting("wpts.inUse", inUse_));
sg.addVarSetting(new BoolSetting("wpts.radius", radius)); sg.addVarSetting(new BoolSetting("wpts.radius", radius));
sg.addVarSetting(new DoubleSetting("wpts.radiusVal", radiusVal)); sg.addVarSetting(new DoubleSetting("wpts.radiusVal", radiusVal));
sg.addVarSetting(new IntSetting("wpts.radiusUnit", radiusUnit)); sg.addVarSetting(new IntSetting("wpts.radiusUnit", radiusUnit));
sg.addVarSetting(new DoubleSetting("wpts.latVal", latVal)); sg.addVarSetting(new DoubleSetting("wpts.latVal", latVal));
sg.addVarSetting(new DoubleSetting("wpts.longVal", longVal)); sg.addVarSetting(new DoubleSetting("wpts.longVal", longVal));
sg.addVarSetting(new BoolSetting("wpts.duplicates", duplicates)); sg.addVarSetting(new BoolSetting("wpts.duplicates", duplicates));
sg.addVarSetting(new BoolSetting("wpts.shortNames", shortNames)); sg.addVarSetting(new BoolSetting("wpts.shortNames", shortNames));
sg.addVarSetting(new BoolSetting("wpts.locations", locations)); sg.addVarSetting(new BoolSetting("wpts.locations", locations));
sg.addVarSetting(new BoolSetting("wpts.position", position)); sg.addVarSetting(new BoolSetting("wpts.position", position));
sg.addVarSetting(new DoubleSetting("wpts.positionVal", positionVal)); sg.addVarSetting(new DoubleSetting("wpts.positionVal", positionVal));
skipping to change at line 172 skipping to change at line 172
double positionVal; double positionVal;
double radiusVal; double radiusVal;
double longVal, latVal; double longVal, latVal;
int positionUnit, radiusUnit; int positionUnit, radiusUnit;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class RtTrkFilterData: public FilterData { class RtTrkFilterData: public FilterData {
public: public:
RtTrkFilterData(): FilterData(), RtTrkFilterData(): FilterData(),
simplify(false), simplify_(false),
reverse(false), reverse_(false),
limitTo(100) limitTo_(100)
{ {
} }
virtual QStringList makeOptionString(); virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg) { virtual void makeSettingGroup(SettingGroup &sg) {
sg.addVarSetting(new BoolSetting("rttrk.inUse", inUse)); sg.addVarSetting(new BoolSetting("rttrk.inUse", inUse_));
sg.addVarSetting(new BoolSetting("rttrk.reverse", reverse)); sg.addVarSetting(new BoolSetting("rttrk.reverse", reverse_));
sg.addVarSetting(new BoolSetting("rttrk.simplify", simplify)); sg.addVarSetting(new BoolSetting("rttrk.simplify", simplify_));
sg.addVarSetting(new IntSetting("rttrk.limitTo", limitTo)); sg.addVarSetting(new IntSetting("rttrk.limitTo", limitTo_));
} }
public: public:
bool simplify, reverse; bool simplify_, reverse_;
int limitTo; int limitTo_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class MiscFltFilterData: public FilterData { class MiscFltFilterData: public FilterData {
public: public:
MiscFltFilterData(): FilterData(), MiscFltFilterData(): FilterData(),
nukeRoutes(false), nukeRoutes_(false),
nukeTracks(false), nukeTracks_(false),
nukeWaypoints(false), nukeWaypoints_(false),
transform(false), transform_(false),
del(false), del_(false),
swap(false), swap_(false),
transformVal(0) transformVal_(0)
{ {
} }
virtual QStringList makeOptionString(); virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg) virtual void makeSettingGroup(SettingGroup &sg)
{ {
sg.addVarSetting(new BoolSetting("mscflt.nukeRoutes", nukeRoutes)); sg.addVarSetting(new BoolSetting("mscflt.nukeRoutes", nukeRoutes_));
sg.addVarSetting(new BoolSetting("mscflt.nukeTracks", nukeTracks)); sg.addVarSetting(new BoolSetting("mscflt.nukeTracks", nukeTracks_));
sg.addVarSetting(new BoolSetting("mscflt.nukeWaypoints", nukeWaypoints) sg.addVarSetting(new BoolSetting("mscflt.nukeWaypoints", nukeWaypoints_
); ));
sg.addVarSetting(new BoolSetting("mscflt.inUse", inUse)); sg.addVarSetting(new BoolSetting("mscflt.inUse", inUse_));
sg.addVarSetting(new BoolSetting("mscflt.transform", transform)); sg.addVarSetting(new BoolSetting("mscflt.transform", transform_));
sg.addVarSetting(new IntSetting("mscflt.transformVal", transformVal)); sg.addVarSetting(new IntSetting("mscflt.transformVal", transformVal_));
sg.addVarSetting(new BoolSetting("mscflt.delete", del)); sg.addVarSetting(new BoolSetting("mscflt.delete", del_));
sg.addVarSetting(new BoolSetting("mscflt.swap", swap)); sg.addVarSetting(new BoolSetting("mscflt.swap", swap_));
} }
public: public:
bool nukeRoutes, nukeTracks, nukeWaypoints; bool nukeRoutes_, nukeTracks_, nukeWaypoints_;
bool transform, del, swap; bool transform_, del_, swap_;
int transformVal; int transformVal_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// //
class AllFiltersData class AllFiltersData
{ {
public: public:
AllFiltersData() AllFiltersData()
{ {
defaultAll(); defaultAll();
 End of changes. 10 change blocks. 
32 lines changed or deleted 32 lines changed or added


 filterdefs.h   filterdefs.h 
/* /*
Filter definitions. Filter definitions.
Copyright (C) 2005 Robert Lipe, robertlipe@usa.net Copyright (C) 2005-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 28 skipping to change at line 28
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
/* /*
* Filters can do some things that modules really shouldn't do. * Filters can do some things that modules really shouldn't do.
* This is our (weak) attempt to make that distinction. * This is our (weak) attempt to make that distinction.
*/ */
extern queue waypt_head; extern queue waypt_head;
#if NEWQ
extern QList<Waypoint*> waypt_list;
#endif
typedef struct filter_vecs { typedef struct filter_vecs {
filter_init f_init; filter_init f_init;
filter_process f_process; filter_process f_process;
filter_deinit f_deinit; filter_deinit f_deinit;
filter_exit f_exit; filter_exit f_exit;
arglist_t* args; arglist_t* args;
} filter_vecs_t; } filter_vecs_t;
filter_vecs_t* find_filter_vec(char* const, char**); filter_vecs_t* find_filter_vec(char* const, char**);
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 filterdlg.h   filterdlg.h 
skipping to change at line 35 skipping to change at line 35
#include <QStackedWidget> #include <QStackedWidget>
#include "ui_filterui.h" #include "ui_filterui.h"
#include "filterdata.h" #include "filterdata.h"
#include "filterwidgets.h" #include "filterwidgets.h"
class FilterDialog: public QDialog class FilterDialog: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
FilterDialog(QWidget *parent, AllFiltersData &fd); FilterDialog(QWidget *parent, AllFiltersData &fd_);
~FilterDialog() {} ~FilterDialog() {}
void runDialog(); void runDialog();
private: private:
static int lastPage; static int lastPage_;
QList <FilterWidget *>pages; QList <FilterWidget *>pages_;
QList <bool *>usePages; QList <bool *>usePages_;
QStackedWidget *widgetStack; QStackedWidget *widgetStack_;
Ui_FilterDlg ui; Ui_FilterDlg ui_;
AllFiltersData &fd; AllFiltersData &fd_;
void addFilterPage(const QString & name, FilterWidget *w, bool *); void addFilterPage(const QString & name, FilterWidget *w, bool *);
private slots: private slots:
void pageSelectionChanged(int); void pageSelectionChanged(int);
void itemClickedX(QListWidgetItem *); void itemClickedX(QListWidgetItem *);
void resetX(); void resetX();
void helpX(); void helpX();
}; };
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 format.h   format.h 
skipping to change at line 44 skipping to change at line 44
typedef enum { typedef enum {
OPTstring, OPTstring,
OPTbool, OPTbool,
OPTint, OPTint,
OPTboundedInt, OPTboundedInt,
OPTfloat, OPTfloat,
OPTinFile, OPTinFile,
OPToutFile, OPToutFile,
} optionType; } optionType;
FormatOption(): name(QString()), description(QString()), type(OPTbool), FormatOption(): name_(QString()), description_(QString()), type_(OPTbool)
defaultValue(QVariant()), ,
minValue(QVariant()), maxValue(QVariant()), defaultValue_(QVariant()),
html(QString()), value(QVariant()), selected(false) minValue_(QVariant()), maxValue_(QVariant()),
html_(QString()), value_(QVariant()), isSelected_(false)
{ {
} }
FormatOption(const QString &name, FormatOption(const QString &name,
const QString &description, const QString &description,
optionType type, optionType type,
QVariant defaultValue = QVariant(), QVariant defaultValue = QVariant(),
QVariant minValue = QVariant(), QVariant minValue = QVariant(),
QVariant maxValue = QVariant(), QVariant maxValue = QVariant(),
QString html = QString() QString html = QString()
): name(name), description(description), type(type), ): name_(name), description_(description), type_(type),
defaultValue(defaultValue), minValue(minValue), maxValue(m defaultValue_(defaultValue), minValue_(minValue), maxValue_(maxValue)
axValue), html(html) , html_(html)
{ {
value = QVariant(); value_ = QVariant();
selected = false; // Boolean values pay more atention to 'selected' than value. Make
// them match here. For non-bools, just make them unchecked.
if (type_ == OPTbool && defaultValue.toBool() == true) {
isSelected_ = true;
} else {
isSelected_ = false;
}
} }
FormatOption(const FormatOption & c) FormatOption(const FormatOption & c)
: name(c.name), description(c.description), type(c.type), : name_(c.name_), description_(c.description_), type_(c.type_),
defaultValue(c.defaultValue), minValue(c.minValue), maxValue(c.maxVal defaultValue_(c.defaultValue_), minValue_(c.minValue_), maxValue_(c.m
ue), html(c.html), axValue_), html_(c.html_),
value(c.value), selected(c.selected) value_(c.value_), isSelected_(c.isSelected_)
{ {
} }
QString getName() const {return name; } QString getName() const {return name_; }
QString getDescription() const {return description; } QString getDescription() const {return description_; }
optionType getType() const {return type; } optionType getType() const {return type_; }
QVariant getValue() const { return value; } QVariant getValue() const { return value_; }
bool getSelected() const {return selected; } bool getSelected() const {return isSelected_; }
QVariant getMinValue() const {return minValue; } QVariant getMinValue() const {return minValue_; }
QVariant getMaxValue() const {return maxValue; } QVariant getMaxValue() const {return maxValue_; }
QVariant getDefaultValue() const {return defaultValue; } QVariant getDefaultValue() const {return defaultValue_; }
void setValue(QVariant v) { value = v; }; void setValue(QVariant v) { value_ = v; };
void setSelected(bool v) { selected = v; }; void setSelected(bool v) { isSelected_ = v; };
QString getHtml() const { return html; }; QString getHtml() const { return html_; };
private: private:
QString name; QString name_;
QString description; QString description_;
optionType type; optionType type_;
QVariant defaultValue; QVariant defaultValue_;
QVariant minValue; QVariant minValue_;
QVariant maxValue; QVariant maxValue_;
QString html; QString html_;
QVariant value; QVariant value_;
bool selected; bool isSelected_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class Format class Format
{ {
public: public:
Format():name(QString()), Format():name_(QString()),
description(QString()), description_(QString()),
readWaypoints(false), readWaypoints_(false),
readTracks(false), readTracks_(false),
readRoutes(false), readRoutes_(false),
writeWaypoints(false), writeWaypoints_(false),
writeTracks(false), writeTracks_(false),
writeRoutes(false), writeRoutes_(false),
fileFormat(false), fileFormat_(false),
deviceFormat(false), deviceFormat_(false),
hidden_(false), hidden_(false),
extensions(QStringList()), extensions_(QStringList()),
html(QString()), html_(QString()),
readUseCount_(0), readUseCount_(0),
writeUseCount_(0) writeUseCount_(0)
{ {
inputOptions.clear(); inputOptions_.clear();
outputOptions.clear(); outputOptions_.clear();
}; };
Format(const QString &name, Format(const QString &name,
const QString &description, const QString &description,
bool readWaypoints, bool readTracks, bool readRoutes, bool readWaypoints, bool readTracks, bool readRoutes,
bool writeWaypoints, bool writeTracks, bool writeRoutes, bool writeWaypoints, bool writeTracks, bool writeRoutes,
bool fileFormat, bool deviceFormat, bool fileFormat, bool deviceFormat,
const QStringList &extensions, const QStringList &extensions,
QList<FormatOption> &inputOptions, QList<FormatOption> &inputOptions,
QList<FormatOption> &outputptions, QList<FormatOption> &outputptions,
const QString &html): const QString &html):
name(name), description(description), name_(name), description_(description),
readWaypoints(readWaypoints), readTracks(readTracks), readRoutes(readRo readWaypoints_(readWaypoints), readTracks_(readTracks), readRoutes_(rea
utes), dRoutes),
writeWaypoints(writeWaypoints), writeTracks(writeTracks), writeRoutes(w writeWaypoints_(writeWaypoints), writeTracks_(writeTracks), writeRoutes
riteRoutes), _(writeRoutes),
fileFormat(fileFormat), deviceFormat(deviceFormat), fileFormat_(fileFormat), deviceFormat_(deviceFormat),
hidden_(false), hidden_(false),
extensions(extensions), extensions_(extensions),
inputOptions(inputOptions), inputOptions_(inputOptions),
outputOptions(outputptions), outputOptions_(outputptions),
html(QString()), html_(QString()),
readUseCount_(0), readUseCount_(0),
writeUseCount_(0) writeUseCount_(0)
{ {
(void)html; // suppress 'unused' warning. (void)html; // suppress 'unused' warning.
} }
Format(const Format &c): Format(const Format &c):
name(c.name), description(c.description), name_(c.name_), description_(c.description_),
readWaypoints(c.readWaypoints), readTracks(c.readTracks), readRoutes(c. readWaypoints_(c.readWaypoints_), readTracks_(c.readTracks_), readRoute
readRoutes), s_(c.readRoutes_),
writeWaypoints(c.writeWaypoints), writeTracks(c.writeTracks), writeRout writeWaypoints_(c.writeWaypoints_), writeTracks_(c.writeTracks_), write
es(c.writeRoutes), Routes_(c.writeRoutes_),
fileFormat(c.fileFormat), deviceFormat(c.deviceFormat), fileFormat_(c.fileFormat_), deviceFormat_(c.deviceFormat_),
hidden_(false), hidden_(false),
extensions(c.extensions), extensions_(c.extensions_),
inputOptions(c.inputOptions), inputOptions_(c.inputOptions_),
outputOptions(c.outputOptions), outputOptions_(c.outputOptions_),
html(c.html), html_(c.html_),
readUseCount_(0), readUseCount_(0),
writeUseCount_(0) writeUseCount_(0)
{ {
} }
~Format() {}; ~Format() {};
bool isReadWaypoints() const { return readWaypoints; }; bool isReadWaypoints() const { return readWaypoints_; };
bool isReadTracks() const { return readTracks; }; bool isReadTracks() const { return readTracks_; };
bool isReadRoutes() const { return readRoutes; }; bool isReadRoutes() const { return readRoutes_; };
bool isReadSomething() const { bool isReadSomething() const {
return isReadWaypoints() || isReadTracks () || isReadRoutes(); return isReadWaypoints() || isReadTracks () || isReadRoutes();
}; };
bool isWriteWaypoints() const { return writeWaypoints; }; bool isWriteWaypoints() const { return writeWaypoints_; };
bool isWriteTracks() const { return writeTracks; }; bool isWriteTracks() const { return writeTracks_; };
bool isWriteRoutes() const { return writeRoutes; }; bool isWriteRoutes() const { return writeRoutes_; };
bool isWriteSomething() const { bool isWriteSomething() const {
return isWriteWaypoints() || isWriteTracks () || isWriteRoutes(); return isWriteWaypoints() || isWriteTracks () || isWriteRoutes();
}; };
QString getName() const { return name; }; QString getName() const { return name_; };
QString getDescription() const { return description; }; QString getDescription() const { return description_; };
QString getHtml() const { return html; }; QString getHtml() const { return html_; };
QStringList getExtensions() const { return extensions; }; QStringList getExtensions() const { return extensions_; };
const QList<FormatOption> &getInputOptions() const { return inputOptions const QList<FormatOption> &getInputOptions() const { return inputOptions
; }; _; };
const QList<FormatOption> &getOutputOptions() const { return outputOption const QList<FormatOption> &getOutputOptions() const { return outputOption
s; }; s_; };
QList<FormatOption> *getInputOptionsRef() { return &inputOptions; }; QList<FormatOption> *getInputOptionsRef() { return &inputOptions_; };
QList<FormatOption> *getOutputOptionsRef() { return &outputOptions; }; QList<FormatOption> *getOutputOptionsRef() { return &outputOptions_; };
bool isDeviceFormat() const { return deviceFormat; }; bool isDeviceFormat() const { return deviceFormat_; };
bool isFileFormat() const { return fileFormat; }; bool isFileFormat() const { return fileFormat_; };
bool isHidden() const { return hidden_; }; bool isHidden() const { return hidden_; };
void setHidden(bool state) { hidden_ = state; }; void setHidden(bool state) { hidden_ = state; };
void saveSettings(QSettings &settings); void saveSettings(QSettings &settings);
void restoreSettings(QSettings &settings); void restoreSettings(QSettings &settings);
void setToDefault(); void setToDefault();
static QString getHtmlBase() { return htmlBase; } static QString getHtmlBase() { return htmlBase_; }
static void setHtmlBase(const QString &s) { htmlBase = s; } static void setHtmlBase(const QString &s) { htmlBase_ = s; }
void bumpReadUseCount(int v) { readUseCount_ += v; } void bumpReadUseCount(int v) { readUseCount_ += v; }
void bumpWriteUseCount(int v) { writeUseCount_ += v; } void bumpWriteUseCount(int v) { writeUseCount_ += v; }
int getReadUseCount() const { return readUseCount_; } int getReadUseCount() const { return readUseCount_; }
int getWriteUseCount() const { return writeUseCount_; } int getWriteUseCount() const { return writeUseCount_; }
void zeroUseCounts(void) { void zeroUseCounts(void) {
readUseCount_ = 0; readUseCount_ = 0;
writeUseCount_= 0; writeUseCount_ = 0;
} }
private: private:
QString name, description; QString name_, description_;
bool readWaypoints, readTracks, readRoutes; bool readWaypoints_, readTracks_, readRoutes_;
bool writeWaypoints, writeTracks, writeRoutes; bool writeWaypoints_, writeTracks_, writeRoutes_;
bool fileFormat, deviceFormat, hidden_; bool fileFormat_, deviceFormat_, hidden_;
QStringList extensions; QStringList extensions_;
QList<FormatOption>inputOptions; QList<FormatOption>inputOptions_;
QList<FormatOption>outputOptions; QList<FormatOption>outputOptions_;
QString html; QString html_;
static QString htmlBase; static QString htmlBase_;
int readUseCount_; int readUseCount_;
int writeUseCount_; int writeUseCount_;
}; };
#endif #endif
 End of changes. 21 change blocks. 
99 lines changed or deleted 106 lines changed or added


 formatload.h   formatload.h 
skipping to change at line 31 skipping to change at line 31
// //
//------------------------------------------------------------------------ //------------------------------------------------------------------------
#ifndef FORMATLOAD_H #ifndef FORMATLOAD_H
#define FORMATLOAD_H #define FORMATLOAD_H
#include "format.h" #include "format.h"
class FormatLoad { class FormatLoad {
public: public:
FormatLoad() {}; FormatLoad() : currentLine_(0) {};
~FormatLoad() {}; ~FormatLoad() {};
bool getFormats(QList<Format> &formatList); bool getFormats(QList<Format> &formatList);
private: private:
QStringList lines; QStringList lines_;
int currentLine; int currentLine_;
bool skipToValidLine(); bool skipToValidLine();
bool processFormat(Format &format); bool processFormat(Format &format);
}; };
#endif #endif
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 garmin_device_xml.h   garmin_device_xml.h 
/* /*
Parse 'GarminDevice.xml' on a Garmin mass storage device (e.g. Zumo, Parse 'GarminDevice.xml' on a Garmin mass storage device (e.g. Zumo,
Nuvi, Colorado, etc. and return key device info. Nuvi, Colorado, etc. and return key device info.
Copyright (C) 2008 Robert Lipe, robertlipe@gpsbabel.org Copyright (C) 2008-2014 Robert Lipe
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 56 skipping to change at line 56
const gdx_info* gdx_get_info(void); const gdx_info* gdx_get_info(void);
const gdx_info* gdx_find_file(char** dirlist); const gdx_info* gdx_find_file(char** dirlist);
// This is so gross. By the time we know it's not a USB device // This is so gross. By the time we know it's not a USB device
// and could be one of our devices, we're so deep into the callstack // and could be one of our devices, we're so deep into the callstack
// that can't back out tracefully without bludgeoning most of the // that can't back out tracefully without bludgeoning most of the
// (Mac|Lin|Win) x (USB|Serial) matrix. Since we don't *really* want // (Mac|Lin|Win) x (USB|Serial) matrix. Since we don't *really* want
// to progress any further, we just longjump back to the caller... // to progress any further, we just longjump back to the caller...
#include <setjmp.h> #include <setjmp.h>
extern jmp_buf gdx_jmp_buf; extern jmp_buf gdx_jmp_buf;
#if 0
/*
* The file-level information.
*/
static
struct gpx_global {
gpx_global_entry name;
gpx_global_entry desc;
gpx_global_entry author;
gpx_global_entry email;
gpx_global_entry url;
gpx_global_entry urlname;
gpx_global_entry keywords;
/* time and bounds aren't here; they're recomputed. */
}* gpx_global ;
static void
gpx_add_to_global(gpx_global_entry* ge, char* cdata)
{
queue* elem, *tmp;
gpx_global_entry* gep;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
gep = BASE_STRUCT(elem, gpx_global_entry, queue);
if (0 == strcmp(cdata, gep->tagdata)) {
return;
}
}
gep = xcalloc(sizeof(*gep), 1);
QUEUE_INIT(&gep->queue);
gep->tagdata = xstrdup(cdata);
ENQUEUE_TAIL(&ge->queue, &gep->queue);
}
static void
gpx_rm_from_global(gpx_global_entry* ge)
{
queue* elem, *tmp;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
gpx_global_entry* g = (gpx_global_entry*) dequeue(elem);
xfree(g->tagdata);
xfree(g);
}
}
static void
gpx_write_gdata(gpx_global_entry* ge, char* tag)
{
queue* elem, *tmp;
gpx_global_entry* gep;
if (!gpx_global || QUEUE_EMPTY(&ge->queue)) {
return;
}
gbfprintf(ofd, "<%s>", tag);
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
gep = BASE_STRUCT(elem, gpx_global_entry, queue);
gbfprintf(ofd, "%s", gep->tagdata);
/* Some tags we just output once. */
if ((0 == strcmp(tag, "url")) ||
(0 == strcmp(tag, "email"))) {
break;
}
gbfprintf(ofd, " ");
}
gbfprintf(ofd, "</%s>\n", tag);
}
typedef struct tag_mapping {
tag_type tag_type; /* enum from above for this tag */
int tag_passthrough; /* true if we don't generate this */
const char* tag_name; /* xpath-ish tag name */
unsigned long crc; /* Crc32 of tag_name */
} tag_mapping;
/*
* xpath(ish) mappings between full tag paths and internal identifers.
* These appear in the order they appear in the GPX specification.
* If it's not a tag we explictly handle, it doesn't go here.
*/
tag_mapping tag_path_map[] = {
{ tt_gpx, 0, "/gpx", 0UL },
{ tt_name, 0, "/gpx/name", 0UL },
{ tt_desc, 0, "/gpx/desc", 0UL },
{ tt_author, 0, "/gpx/author", 0UL },
{ tt_email, 0, "/gpx/email", 0UL },
{ tt_url, 0, "/gpx/url", 0UL },
{ tt_urlname, 0, "/gpx/urlname", 0UL },
{ tt_keywords, 0, "/gpx/keywords", 0UL },
{ tt_wpt, 0, "/gpx/wpt", 0UL },
{ tt_wpt_ele, 0, "/gpx/wpt/ele", 0UL },
{ tt_wpt_time, 0, "/gpx/wpt/time", 0UL },
{ tt_wpt_name, 0, "/gpx/wpt/name", 0UL },
{ tt_wpt_cmt, 0, "/gpx/wpt/cmt", 0UL },
{ tt_wpt_desc, 0, "/gpx/wpt/desc", 0UL },
{ tt_wpt_url, 0, "/gpx/wpt/url", 0UL },
{ tt_wpt_urlname, 0, "/gpx/wpt/urlname", 0UL },
{ tt_wpt_link, 0, "/gpx/wpt/link", 0UL }, /* GPX 1.1 *
/
{ tt_wpt_link_text, 0, "/gpx/wpt/link/text", 0UL }, /* GPX 1.1 *
/
{ tt_wpt_sym, 0, "/gpx/wpt/sym", 0UL },
{ tt_wpt_type, 1, "/gpx/wpt/type", 0UL },
/* Double up the GPX 1.0 and GPX 1.1 styles */
#define GEOTAG(type,name) \
{type, 1, "/gpx/wpt/groundspeak:cache/groundspeak:" name, 0UL }, \
{type, 1, "/gpx/wpt/extensions/cache/" name, 0UL }, \
{type, 1, "/gpx/wpt/geocache/" name, 0UL } /* opencaching.de */
#define GARMIN_WPT_EXT "/gpx/wpt/extensions/gpxx:WaypointExtension"
// GEOTAG( tt_cache, "cache"),
{ tt_cache, 1, "/gpx/wpt/groundspeak:cache" },
GEOTAG(tt_cache_name, "name"),
GEOTAG(tt_cache_container, "container"),
GEOTAG(tt_cache_type, "type"),
GEOTAG(tt_cache_difficulty, "difficulty"),
GEOTAG(tt_cache_terrain, "terrain"),
GEOTAG(tt_cache_hint, "encoded_hints"),
GEOTAG(tt_cache_hint, "hints"), /* opencaching.de */
GEOTAG(tt_cache_desc_short, "short_description"),
GEOTAG(tt_cache_desc_long, "long_description"),
GEOTAG(tt_cache_placer, "owner"),
{ tt_cache_log_wpt, 1, "/gpx/wpt/groundspeak:cache/groundspeak:logs/groun
dspeak:log/groundspeak:log_wpt"},
{ tt_cache_log_wpt, 1, "/gpx/wpt/extensions/cache/logs/log/log_wpt"},
{ tt_cache_log_type, 1, "/gpx/wpt/groundspeak:cache/groundspeak:logs/grou
ndspeak:log/groundspeak:type"},
{ tt_cache_log_type, 1, "/gpx/wpt/extensions/cache/logs/log/type"},
{ tt_cache_log_date, 1, "/gpx/wpt/groundspeak:cache/groundspeak:logs/grou
ndspeak:log/groundspeak:date"},
{ tt_cache_log_date, 1, "/gpx/wpt/extensions/cache/logs/log/date"},
{ tt_wpt_extensions, 0, "/gpx/wpt/extensions", 0UL },
{ tt_garmin_wpt_extensions, 0, GARMIN_WPT_EXT, 0UL },
{ tt_garmin_wpt_proximity, 0, GARMIN_WPT_EXT "/gpxx:Proximity", 0UL },
{ tt_garmin_wpt_temperature, 0, GARMIN_WPT_EXT "/gpxx:Temperature", 0UL }
,
{ tt_garmin_wpt_depth, 0, GARMIN_WPT_EXT "/gpxx:Depth", 0UL },
{ tt_garmin_wpt_display_mode, 0, GARMIN_WPT_EXT "/gpxx:DisplayMode", 0UL
},
{ tt_garmin_wpt_categories, 0, GARMIN_WPT_EXT "/gpxx:Categories", 0UL },
{ tt_garmin_wpt_category, 0, GARMIN_WPT_EXT "/gpxx:Categories/gpxx:Catego
ry", 0UL },
{ tt_garmin_wpt_addr, 0, GARMIN_WPT_EXT "/gpxx:Address/gpxx:StreetAddress
", 0UL },
{ tt_garmin_wpt_city, 0, GARMIN_WPT_EXT "/gpxx:Address/gpxx:City", 0UL },
{ tt_garmin_wpt_state, 0, GARMIN_WPT_EXT "/gpxx:Address/gpxx:State", 0UL
},
{ tt_garmin_wpt_country, 0, GARMIN_WPT_EXT "/gpxx:Address/gpxx:Country",
0UL },
{ tt_garmin_wpt_postal_code, 0, GARMIN_WPT_EXT "/gpxx:Address/gpxx:Postal
Code", 0UL },
{ tt_garmin_wpt_phone_nr, 0, GARMIN_WPT_EXT "/gpxx:PhoneNumber", 0UL },
{ tt_rte, 0, "/gpx/rte", 0UL },
{ tt_rte_name, 0, "/gpx/rte/name", 0UL },
{ tt_rte_desc, 0, "/gpx/rte/desc", 0UL },
{ tt_rte_number, 0, "/gpx/rte/number", 0UL },
{ tt_rte_rtept, 0, "/gpx/rte/rtept", 0UL },
{ tt_rte_rtept_ele, 0, "/gpx/rte/rtept/ele", 0UL },
{ tt_rte_rtept_time, 0, "/gpx/rte/rtept/time", 0UL },
{ tt_rte_rtept_name, 0, "/gpx/rte/rtept/name", 0UL },
{ tt_rte_rtept_cmt, 0, "/gpx/rte/rtept/cmt", 0UL },
{ tt_rte_rtept_desc, 0, "/gpx/rte/rtept/desc", 0UL },
{ tt_rte_rtept_url, 0, "/gpx/rte/rtept/url", 0UL },
{ tt_rte_rtept_urlname, 0, "/gpx/rte/rtept/urlname", 0UL },
{ tt_rte_rtept_sym, 0, "/gpx/rte/rtept/sym", 0UL },
{ tt_trk, 0, "/gpx/trk", 0UL },
{ tt_trk_name, 0, "/gpx/trk/name", 0UL },
{ tt_trk_desc, 0, "/gpx/trk/desc", 0UL },
{ tt_trk_trkseg, 0, "/gpx/trk/trkseg", 0UL },
{ tt_trk_number, 0, "/gpx/trk/number", 0UL },
{ tt_trk_trkseg_trkpt, 0, "/gpx/trk/trkseg/trkpt", 0UL },
{ tt_trk_trkseg_trkpt_ele, 0, "/gpx/trk/trkseg/trkpt/ele", 0UL },
{ tt_trk_trkseg_trkpt_time, 0, "/gpx/trk/trkseg/trkpt/time", 0UL },
{ tt_trk_trkseg_trkpt_name, 0, "/gpx/trk/trkseg/trkpt/name", 0UL },
{ tt_trk_trkseg_trkpt_cmt, 0, "/gpx/trk/trkseg/trkpt/cmt", 0UL },
{ tt_trk_trkseg_trkpt_desc, 0, "/gpx/trk/trkseg/trkpt/desc", 0UL },
{ tt_trk_trkseg_trkpt_url, 0, "/gpx/trk/trkseg/trkpt/url", 0UL },
{ tt_trk_trkseg_trkpt_urlname, 0, "/gpx/trk/trkseg/trkpt/urlname", 0UL },
{ tt_trk_trkseg_trkpt_sym, 0, "/gpx/trk/trkseg/trkpt/sym", 0UL },
{ tt_trk_trkseg_trkpt_course, 0, "/gpx/trk/trkseg/trkpt/course", 0UL },
{ tt_trk_trkseg_trkpt_speed, 0, "/gpx/trk/trkseg/trkpt/speed", 0UL },
/* Common to tracks, routes, and waypts */
{ tt_fix, 0, "/gpx/wpt/fix", 0UL },
{ tt_fix, 0, "/gpx/trk/trkseg/trkpt/fix", 0UL },
{ tt_fix, 0, "/gpx/rte/rtept/fix", 0UL },
{ tt_sat, 0, "/gpx/wpt/sat", 0UL },
{ tt_sat, 0, "/gpx/trk/trkseg/trkpt/sat", 0UL },
{ tt_sat, 0, "/gpx/rte/rtept/sat", 0UL },
{ tt_pdop, 0, "/gpx/wpt/pdop", 0UL },
{ tt_pdop, 0, "/gpx/trk/trkseg/trkpt/pdop", 0UL },
{ tt_pdop, 0, "/gpx/rte/rtept/pdop", 0UL },
{ tt_hdop, 0, "/gpx/wpt/hdop", 0UL },
{ tt_hdop, 0, "/gpx/trk/trkseg/trkpt/hdop", 0UL },
{ tt_hdop, 0, "/gpx/rte/rtept/hdop", 0UL },
{ tt_vdop, 0, "/gpx/wpt/vdop", 0UL },
{ tt_vdop, 0, "/gpx/trk/trkseg/trkpt/vdop", 0UL },
{ tt_vdop, 0, "/gpx/rte/rtept/hdop", 0UL },
{0, 0, NULL, 0UL}
};
static tag_type
get_tag(const char* t, int* passthrough)
{
tag_mapping* tm;
unsigned long tcrc = get_crc32_s(t);
for (tm = tag_path_map; tm->tag_type != 0; tm++) {
if ((tcrc == tm->crc) && (0 == strcmp(tm->tag_name, t))) {
*passthrough = tm->tag_passthrough;
return tm->tag_type;
}
}
*passthrough = 1;
return tt_unknown;
}
static void
prescan_tags(void)
{
tag_mapping* tm;
for (tm = tag_path_map; tm->tag_type != 0; tm++) {
tm->crc = get_crc32_s(tm->tag_name);
}
}
static void
tag_gpx(const char** attrv)
{
const char** avp;
for (avp = &attrv[0]; *avp; avp += 2) {
if (strcmp(avp[0], "version") == 0) {
gpx_version = avp[1];
} else if (strcmp(avp[0], "src") == 0) {
gpx_creator = avp[1];
}
/*
* Our handling of schemaLocation really is weird.
* If we see we have a "normal" GPX 1.1 header, on read,
* flip our default on write to use that and don't append
* it to the rest...
*/
else if (strcmp(avp[0], "xsi:schemaLocation") == 0) {
if (0 == strcmp(avp[1], DEFAULT_XSI_SCHEMA_LOC_11)) {
if (0 == strcmp(xsi_schema_loc, DEFAULT_XSI_SCHEMA_LOC)) {
xfree(xsi_schema_loc);
}
xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC_11);
continue;
}
if (0 == strstr(xsi_schema_loc, avp[1])) {
xsi_schema_loc = xstrappend(xsi_schema_loc, " ");
xsi_schema_loc = xstrappend(xsi_schema_loc, avp[1]);
}
}
}
}
static void
tag_wpt(const char** attrv)
{
const char** avp = &attrv[0];
wpt_tmp = waypt_new();
cur_tag = NULL;
while (*avp) {
if (strcmp(avp[0], "lat") == 0) {
sscanf(avp[1], "%lf",
&wpt_tmp->latitude);
} else if (strcmp(avp[0], "lon") == 0) {
sscanf(avp[1], "%lf",
&wpt_tmp->longitude);
}
avp+=2;
}
fs_ptr = &wpt_tmp->fs;
}
static void
tag_cache_desc(const char** attrv)
{
const char** avp;
cache_descr_is_html = 0;
for (avp = &attrv[0]; *avp; avp+=2) {
if (strcmp(avp[0], "html") == 0) {
if (strcmp(avp[1], "True") == 0) {
cache_descr_is_html = 1;
}
}
}
}
static void
tag_gs_cache(const char** attrv)
{
const char** avp;
for (avp = &attrv[0]; *avp; avp+=2) {
if (strcmp(avp[0], "id") == 0) {
wpt_tmp->gc_data.id = atoi(avp[1]);
} else if (strcmp(avp[0], "available") == 0) {
if (case_ignore_strcmp(avp[1], "True") == 0) {
wpt_tmp->gc_data.is_available = status_true;
} else if (case_ignore_strcmp(avp[1], "False") == 0) {
wpt_tmp->gc_data.is_available = status_false;
}
} else if (strcmp(avp[0], "archived") == 0) {
if (case_ignore_strcmp(avp[1], "True") == 0) {
wpt_tmp->gc_data.is_archived = status_true;
} else if (case_ignore_strcmp(avp[1], "False") == 0) {
wpt_tmp->gc_data.is_archived = status_false;
}
}
}
}
static void
start_something_else(const char* el, const char** attrv)
{
const char** avp = attrv;
char** avcp = NULL;
int attr_count = 0;
xml_tag* new_tag;
fs_xml* fs_gpx;
if (!fs_ptr) {
return;
}
new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1);
new_tag->tagname = xstrdup(el);
/* count attributes */
while (*avp) {
attr_count++;
avp++;
}
/* copy attributes */
avp = attrv;
new_tag->attributes = (char**)xcalloc(sizeof(char*),attr_count+1);
avcp = new_tag->attributes;
while (*avp) {
*avcp = xstrdup(*avp);
avcp++;
avp++;
}
*avcp = NULL;
if (cur_tag) {
if (cur_tag->child) {
cur_tag = cur_tag->child;
while (cur_tag->sibling) {
cur_tag = cur_tag->sibling;
}
cur_tag->sibling = new_tag;
new_tag->parent = cur_tag->parent;
} else {
cur_tag->child = new_tag;
new_tag->parent = cur_tag;
}
} else {
fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX);
if (fs_gpx && fs_gpx->tag) {
cur_tag = fs_gpx->tag;
while (cur_tag->sibling) {
cur_tag = cur_tag->sibling;
}
cur_tag->sibling = new_tag;
new_tag->parent = NULL;
} else {
fs_gpx = fs_xml_alloc(FS_GPX);
fs_gpx->tag = new_tag;
fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx);
new_tag->parent = NULL;
}
}
cur_tag = new_tag;
}
static void
end_something_else()
{
if (cur_tag) {
cur_tag = cur_tag->parent;
}
}
static void
tag_log_wpt(const char** attrv)
{
waypoint* lwp_tmp;
const char** avp = &attrv[0];
/* create a new waypoint */
lwp_tmp = waypt_new();
/* extract the lat/lon attributes */
while (*avp) {
if (strcmp(avp[0], "lat") == 0) {
sscanf(avp[1], "%lf",
&lwp_tmp->latitude);
} else if (strcmp(avp[0], "lon") == 0) {
sscanf(avp[1], "%lf",
&lwp_tmp->longitude);
}
avp+=2;
}
/* Make a new shortname. Since this is a groundspeak extension,
we assume that GCBLAH is the current shortname format and that
wpt_tmp refers to the currently parsed waypoint. Unfortunatley,
we need to keep track of log_wpt counts so we don't collide with
dupe shortnames.
*/
if ((wpt_tmp->shortname) && (strlen(wpt_tmp->shortname) > 2)) {
/* copy of the shortname */
lwp_tmp->shortname = xcalloc(7, 1);
sprintf(lwp_tmp->shortname, "%-4.4s%02d",
&wpt_tmp->shortname[2], logpoint_ct++);
waypt_add(lwp_tmp);
}
}
static void
gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
{
char* e;
char* ep;
int passthrough;
const char* el = xml_convert_to_char_string(xml_el);
const char** attr = xml_convert_attrs_to_char_string(xml_attr);
vmem_realloc(&current_tag, strlen(current_tag.mem) + 2 + strlen(el));
e = current_tag.mem;
ep = e + strlen(e);
*ep++ = '/';
strcpy(ep, el);
/*
* FIXME: Find out why a cdatastr[0] doesn't adequately reset the
* cdata handler.
*/
memset(cdatastr.mem, 0, cdatastr.size);
switch (get_tag(current_tag.mem, &passthrough)) {
case tt_gpx:
tag_gpx(attr);
break;
case tt_wpt:
tag_wpt(attr);
break;
case tt_wpt_link:
if (0 == strcmp(attr[0], "href")) {
link_url = attr[1];
}
break;
case tt_wpt_link_text:
link_text = cdatastr.mem;
break;
case tt_rte:
rte_head = route_head_alloc();
route_add_head(rte_head);
fs_ptr = &rte_head->fs;
break;
case tt_rte_rtept:
tag_wpt(attr);
break;
case tt_trk:
trk_head = route_head_alloc();
track_add_head(trk_head);
fs_ptr = &trk_head->fs;
break;
case tt_trk_trkseg_trkpt:
tag_wpt(attr);
break;
case tt_unknown:
start_something_else(el, attr);
return;
case tt_cache:
tag_gs_cache(attr);
break;
case tt_cache_log_wpt:
if (opt_logpoint) {
tag_log_wpt(attr);
}
break;
case tt_cache_desc_long:
case tt_cache_desc_short:
tag_cache_desc(attr);
break;
case tt_cache_placer:
if (*attr && (0 == strcmp(attr[0], "id"))) {
wpt_tmp->gc_data.placer_id = atoi(attr[1]);
}
default:
break;
}
if (passthrough) {
start_something_else(el, attr);
}
xml_free_converted_string(el);
xml_free_converted_attrs(attr);
}
struct
gs_type_mapping {
geocache_type type;
const char* name;
} gs_type_map[] = {
{ gt_traditional, "Traditional Cache" },
{ gt_traditional, "Traditional" }, /* opencaching.de */
{ gt_multi, "Multi-cache" },
{ gt_multi, "Multi" }, /* opencaching.de */
{ gt_virtual, "Virtual Cache" },
{ gt_virtual, "Virtual" }, /* opencaching.de */
{ gt_event, "Event Cache" },
{ gt_event, "Event" }, /* opencaching.de */
{ gt_webcam, "Webcam Cache" },
{ gt_webcam, "Webcam" }, /* opencaching.de */
{ gt_suprise, "Unknown Cache" },
{ gt_earth, "Earthcache" },
{ gt_earth, "Earth" }, /* opencaching.de */
{ gt_cito, "Cache In Trash Out Event" },
{ gt_letterbox, "Letterbox Hybrid" },
{ gt_locationless, "Locationless (Reverse) Cache" },
{ gt_ape, "Project APE Cache" },
{ gt_mega, "Mega-Event Cache" },
{ gt_benchmark, "Benchmark" }, /* Not Groundspeak; for GSAK */
};
struct
gs_container_mapping {
geocache_container type;
const char* name;
} gs_container_map[] = {
{ gc_other, "Unknown" },
{ gc_other, "Other" }, /* Synonym on read. */
{ gc_micro, "Micro" },
{ gc_regular, "Regular" },
{ gc_large, "Large" },
{ gc_small, "Small" },
{ gc_virtual, "Virtual" }
};
geocache_type
gs_mktype(const char* t)
{
int i;
int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
for (i = 0; i < sz; i++) {
if (0 == case_ignore_strcmp(t, gs_type_map[i].name)) {
return gs_type_map[i].type;
}
}
return gt_unknown;
}
const char*
gs_get_cachetype(geocache_type t)
{
int i;
int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
for (i = 0; i < sz; i++) {
if (t == gs_type_map[i].type) {
return gs_type_map[i].name;
}
}
return "Unknown";
}
geocache_container
gs_mkcont(const char* t)
{
int i;
int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
for (i = 0; i < sz; i++) {
if (0 == case_ignore_strcmp(t, gs_container_map[i].name)) {
return gs_container_map[i].type;
}
}
return gc_unknown;
}
const char*
gs_get_container(geocache_container t)
{
int i;
int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
for (i = 0; i < sz; i++) {
if (t == gs_container_map[i].type) {
return gs_container_map[i].name;
}
}
return "Unknown";
}
time_t
xml_parse_time(const char* cdatastr, int* microsecs)
{
int off_hr = 0;
int off_min = 0;
int off_sign = 1;
char* offsetstr = NULL;
char* pointstr = NULL;
struct tm tm;
time_t rv = 0;
char* timestr = xstrdup(cdatastr);
memset(&tm, 0, sizeof(tm));
offsetstr = strchr(timestr, 'Z');
if (offsetstr) {
/* zulu time; offsets stay at defaults */
*offsetstr = '\0';
} else {
offsetstr = strchr(timestr, '+');
if (offsetstr) {
/* positive offset; parse it */
*offsetstr = '\0';
sscanf(offsetstr+1, "%d:%d", &off_hr, &off_min);
} else {
offsetstr = strchr(timestr, 'T');
if (offsetstr) {
offsetstr = strchr(offsetstr, '-');
if (offsetstr) {
/* negative offset; parse it */
*offsetstr = '\0';
sscanf(offsetstr+1, "%d:%d",
&off_hr, &off_min);
off_sign = -1;
}
}
}
}
pointstr = strchr(timestr, '.');
if (pointstr) {
if (microsecs) {
double fsec;
sscanf(pointstr, "%le", &fsec);
/* Round to avoid FP jitter */
*microsecs = .5 + (fsec * 1000000.0) ;
}
*pointstr = '\0';
}
sscanf(timestr, "%d-%d-%dT%d:%d:%d",
&tm.tm_year,
&tm.tm_mon,
&tm.tm_mday,
&tm.tm_hour,
&tm.tm_min,
&tm.tm_sec);
tm.tm_mon -= 1;
tm.tm_year -= 1900;
tm.tm_isdst = 0;
rv = mkgmtime(&tm) - off_sign*off_hr*3600 - off_sign*off_min*60;
xfree(timestr);
return rv;
}
static void
gpx_end(void* data, const XML_Char* xml_el)
{
const char* el = xml_convert_to_char_string(xml_el);
char* s = strrchr(current_tag.mem, '/');
float x;
char* cdatastrp = cdatastr.mem;
int passthrough;
static time_t gc_log_date;
tag_type tag;
if (strcmp(s + 1, el)) {
fprintf(stderr, "Mismatched tag %s\n", el);
}
tag = get_tag(current_tag.mem, &passthrough);
switch (tag) {
/*
* First, the tags that are file-global.
*/
case tt_name:
gpx_add_to_global(&gpx_global->name, cdatastrp);
break;
case tt_desc:
gpx_add_to_global(&gpx_global->desc, cdatastrp);
break;
case tt_author:
gpx_add_to_global(&gpx_global->author, cdatastrp);
break;
case tt_email:
gpx_add_to_global(&gpx_global->email, cdatastrp);
if (gpx_email == NULL) {
gpx_email = xstrdup(cdatastrp);
}
break;
case tt_url:
gpx_add_to_global(&gpx_global->url, cdatastrp);
break;
case tt_urlname:
gpx_add_to_global(&gpx_global->urlname, cdatastrp);
break;
case tt_keywords:
gpx_add_to_global(&gpx_global->keywords, cdatastrp);
break;
/*
* Waypoint-specific tags.
*/
case tt_wpt:
waypt_add(wpt_tmp);
logpoint_ct = 0;
cur_tag = NULL;
wpt_tmp = NULL;
break;
case tt_cache_name:
if (wpt_tmp->notes != NULL) {
xfree(wpt_tmp->notes);
}
wpt_tmp->notes = xstrdup(cdatastrp);
break;
case tt_cache_container:
wpt_tmp->gc_data.container = gs_mkcont(cdatastrp);
break;
case tt_cache_type:
wpt_tmp->gc_data.type = gs_mktype(cdatastrp);
break;
case tt_cache_difficulty:
sscanf(cdatastrp, "%f", &x);
wpt_tmp->gc_data.diff = x * 10;
break;
case tt_cache_hint:
rtrim(cdatastrp);
if (cdatastrp[0]) {
wpt_tmp->gc_data.hint = xstrdup(cdatastrp);
}
break;
case tt_cache_desc_long:
rtrim(cdatastrp);
if (cdatastrp[0]) {
wpt_tmp->gc_data.desc_long.is_html = cache_descr_is_html;
wpt_tmp->gc_data.desc_long.utfstring = xstrdup(cdatastrp);
}
break;
case tt_cache_desc_short:
rtrim(cdatastrp);
if (cdatastrp[0]) {
wpt_tmp->gc_data.desc_short.is_html = cache_descr_is_html;
wpt_tmp->gc_data.desc_short.utfstring = xstrdup(cdatastrp);
}
break;
case tt_cache_terrain:
sscanf(cdatastrp, "%f", &x);
wpt_tmp->gc_data.terr = x * 10;
break;
case tt_cache_placer:
wpt_tmp->gc_data.placer = xstrdup(cdatastrp);
break;
case tt_cache_log_date:
gc_log_date = xml_parse_time(cdatastrp, NULL);
break;
/*
* "Found it" logs follow the date according to the schema,
* if this is the first "found it" for this waypt, just use the
* last date we saw in this log.
*/
case tt_cache_log_type:
if ((0 == strcmp(cdatastrp, "Found it")) &&
(0 == wpt_tmp->gc_data.last_found)) {
wpt_tmp->gc_data.last_found = gc_log_date;
}
gc_log_date = 0;
break;
/*
* Garmin-waypoint-specific tags.
*/
case tt_garmin_wpt_proximity:
case tt_garmin_wpt_temperature:
case tt_garmin_wpt_depth:
case tt_garmin_wpt_display_mode:
case tt_garmin_wpt_category:
case tt_garmin_wpt_addr:
case tt_garmin_wpt_city:
case tt_garmin_wpt_state:
case tt_garmin_wpt_country:
case tt_garmin_wpt_postal_code:
case tt_garmin_wpt_phone_nr:
garmin_fs_xml_convert(tt_garmin_wpt_extensions, tag, cdatastrp, wpt_tmp
);
break;
/*
* Route-specific tags.
*/
case tt_rte_name:
rte_head->rte_name = xstrdup(cdatastrp);
break;
case tt_rte:
break;
case tt_rte_rtept:
route_add_wpt(rte_head, wpt_tmp);
wpt_tmp = NULL;
break;
case tt_rte_desc:
rte_head->rte_desc = xstrdup(cdatastrp);
break;
case tt_rte_number:
rte_head->rte_num = atoi(cdatastrp);
break;
/*
* Track-specific tags.
*/
case tt_trk_name:
trk_head->rte_name = xstrdup(cdatastrp);
break;
case tt_trk:
break;
case tt_trk_trkseg_trkpt:
track_add_wpt(trk_head, wpt_tmp);
wpt_tmp = NULL;
break;
case tt_trk_desc:
trk_head->rte_desc = xstrdup(cdatastrp);
break;
case tt_trk_number:
trk_head->rte_num = atoi(cdatastrp);
break;
case tt_trk_trkseg_trkpt_course:
WAYPT_SET(wpt_tmp, course, atof(cdatastrp));
break;
case tt_trk_trkseg_trkpt_speed:
WAYPT_SET(wpt_tmp, speed, atof(cdatastrp));
break;
/*
* Items that are actually in multiple categories.
*/
case tt_wpt_ele:
case tt_rte_rtept_ele:
case tt_trk_trkseg_trkpt_ele:
sscanf(cdatastrp, "%lf", &wpt_tmp->altitude);
break;
case tt_wpt_name:
case tt_rte_rtept_name:
case tt_trk_trkseg_trkpt_name:
wpt_tmp->shortname = xstrdup(cdatastrp);
break;
case tt_wpt_sym:
case tt_rte_rtept_sym:
case tt_trk_trkseg_trkpt_sym:
wpt_tmp->icon_descr = xstrdup(cdatastrp);
wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
break;
case tt_wpt_time:
case tt_trk_trkseg_trkpt_time:
case tt_rte_rtept_time:
wpt_tmp->creation_time = xml_parse_time(cdatastrp, &wpt_tmp->microsecon
ds);
break;
case tt_wpt_cmt:
case tt_rte_rtept_cmt:
case tt_trk_trkseg_trkpt_cmt:
wpt_tmp->description = xstrdup(cdatastrp);
break;
case tt_wpt_desc:
case tt_trk_trkseg_trkpt_desc:
case tt_rte_rtept_desc:
if (wpt_tmp->notes != NULL) {
xfree(wpt_tmp->notes);
}
wpt_tmp->notes = xstrdup(cdatastrp);
break;
case tt_pdop:
wpt_tmp->pdop = atof(cdatastrp);
break;
case tt_hdop:
wpt_tmp->hdop = atof(cdatastrp);
break;
case tt_vdop:
wpt_tmp->vdop = atof(cdatastrp);
break;
case tt_sat:
wpt_tmp->sat = atof(cdatastrp);
break;
case tt_fix:
wpt_tmp->fix = atoi(cdatastrp)-1;
if (wpt_tmp->fix < fix_2d) {
if (!case_ignore_strcmp(cdatastrp, "none")) {
wpt_tmp->fix = fix_none;
} else if (!case_ignore_strcmp(cdatastrp, "dgps")) {
wpt_tmp->fix = fix_dgps;
} else if (!case_ignore_strcmp(cdatastrp, "pps")) {
wpt_tmp->fix = fix_pps;
} else {
wpt_tmp->fix = fix_unknown;
}
}
break;
case tt_wpt_url:
case tt_trk_trkseg_trkpt_url:
case tt_rte_rtept_url:
wpt_tmp->url = xstrdup(cdatastrp);
break;
case tt_wpt_urlname:
case tt_trk_trkseg_trkpt_urlname:
case tt_rte_rtept_urlname:
wpt_tmp->url_link_text = xstrdup(cdatastrp);
break;
case tt_wpt_link:
//TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link:
//TODO: implement GPX 1.1 case tt_rte_rtept_link:
{
char* lt = link_text;
if (lt) {
lt = xstrdup(lrtrim(link_text));
}
waypt_add_url(wpt_tmp, xstrdup(link_url), lt);
link_text = NULL;
}
break;
case tt_unknown:
end_something_else();
*s = 0;
return;
default:
break;
}
if (passthrough) {
end_something_else();
}
*s = 0;
xml_free_converted_string(el);
}
#if ! HAVE_LIBEXPAT
static void
gpx_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded GPX support because expat was not ins
talled.\n");
}
static void
gpx_rd_deinit(void)
{
}
#else /* NO_EXPAT */
static void
gpx_cdata(void* dta, const XML_Char* xml_el, int len)
{
char* estr;
int* cdatalen;
char** cdata;
xml_tag* tmp_tag;
size_t slen = strlen(cdatastr.mem);
const char* s = xml_convert_to_char_string_n(xml_el, &len);
vmem_realloc(&cdatastr, 1 + len + slen);
estr = ((char*) cdatastr.mem) + slen;
memcpy(estr, s, len);
estr[len] = 0;
if (!cur_tag) {
return;
}
if (cur_tag->child) {
tmp_tag = cur_tag->child;
while (tmp_tag->sibling) {
tmp_tag = tmp_tag->sibling;
}
cdata = &(tmp_tag->parentcdata);
cdatalen = &(tmp_tag->parentcdatalen);
} else {
cdata = &(cur_tag->cdata);
cdatalen = &(cur_tag->cdatalen);
}
estr = *cdata;
*cdata = xcalloc(*cdatalen + len + 1, 1);
if (estr) {
memcpy(*cdata, estr, *cdatalen);
xfree(estr);
}
estr = *cdata + *cdatalen;
memcpy(estr, s, len);
*(estr+len) = '\0';
*cdatalen += len;
xml_free_converted_string(s);
}
static void
gpx_rd_init(const char* fname)
{
if (fname[0]) {
fd = gbfopen(fname, "r", MYNAME);
input_fname = fname;
} else {
fd = NULL;
input_string = fname+1;
input_string_len = strlen(input_string);
input_fname = NULL;
}
file_time = 0;
current_tag = vmem_alloc(1, 0);
*((char*)current_tag.mem) = '\0';
prescan_tags();
psr = XML_ParserCreate(NULL);
if (!psr) {
fatal(MYNAME ": Cannot create XML Parser\n");
}
XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler,
NULL);
cdatastr = vmem_alloc(1, 0);
*((char*)cdatastr.mem) = '\0';
if (!xsi_schema_loc) {
xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC);
}
if (!xsi_schema_loc) {
fatal("gpx: Unable to allocate %ld bytes of memory.\n",
(unsigned long) strlen(DEFAULT_XSI_SCHEMA_LOC) + 1);
}
if (NULL == gpx_global) {
gpx_global = xcalloc(sizeof(*gpx_global), 1);
QUEUE_INIT(&gpx_global->name.queue);
QUEUE_INIT(&gpx_global->desc.queue);
QUEUE_INIT(&gpx_global->author.queue);
QUEUE_INIT(&gpx_global->email.queue);
QUEUE_INIT(&gpx_global->url.queue);
QUEUE_INIT(&gpx_global->urlname.queue);
QUEUE_INIT(&gpx_global->keywords.queue);
}
XML_SetElementHandler(psr, gpx_start, gpx_end);
XML_SetCharacterDataHandler(psr, gpx_cdata);
fs_ptr = NULL;
}
static
void
gpx_rd_deinit(void)
{
vmem_free(&current_tag);
vmem_free(&cdatastr);
/*
* Don't free schema_loc. It really is important that we preserve
* this across reads or else merges/copies of files with different
* schemas won't retain the headers.
*
* moved to gpx_exit
if ( xsi_schema_loc ) {
xfree(xsi_schema_loc);
xsi_schema_loc = NULL;
}
*/
if (gpx_email) {
xfree(gpx_email);
gpx_email = NULL;
}
if (gpx_author) {
xfree(gpx_author);
gpx_author = NULL;
}
if (fd) {
gbfclose(fd);
}
XML_ParserFree(psr);
psr = NULL;
wpt_tmp = NULL;
cur_tag = NULL;
input_fname = NULL;
}
#endif
static void
gpx_wr_init(const char* fname)
{
mkshort_handle = mkshort_new_handle();
ofd = gbfopen(fname, "w", MYNAME);
}
static void
gpx_wr_deinit(void)
{
gbfclose(ofd);
mkshort_del_handle(&mkshort_handle);
}
void
gpx_read(void)
{
#if HAVE_LIBEXPAT
int len;
int done = 0;
char* buf = xmalloc(MY_CBUF_SZ);
int result = 0;
int extra;
while (!done) {
if (fd) {
/*
* The majority of this block (in fact, all but the
* call to XML_Parse) are a disgusting hack to
* correct defective GPX files that Geocaching.com
* issues as pocket queries. They contain escape
* characters as entities (&#x00-&#x1f) which makes
* them not validate which croaks expat and torments
* users.
*
* Look for '&' in the last maxentlength chars. If
* we find it, strip it, then read byte-at-a-time
* until we find a non-entity.
*/
char* badchar;
char* semi;
int maxentlength = 8;
len = gbfread(buf, 1, MY_CBUF_SZ - maxentlength, fd);
done = gbfeof(fd) || !len;
buf[len] = '\0';
if (len < maxentlength) {
maxentlength = len;
}
badchar = buf+len-maxentlength;
badchar = strchr(badchar, '&');
extra = maxentlength - 1; /* for terminator */
while (badchar && len < MY_CBUF_SZ-1) {
semi = strchr(badchar, ';');
while (extra && !semi) {
len += gbfread(buf+len, 1, 1, fd);
buf[len]='\0';
extra--;
if (buf[len-1] == ';') {
semi= buf+len-1;
}
}
badchar = strchr(badchar+1, '&');
}
{
char* hex="0123456789abcdef";
badchar = strstr(buf, "&#x");
while (badchar) {
int val = 0;
char* hexit = badchar+3;
semi = strchr(badchar, ';');
if (semi) {
while (*hexit && *hexit != ';') {
char hc = isalpha(*hexit) ? tolower(*hexit) : *hexit;
val *= 16;
val += strchr(hex, hc)-hex;
hexit++;
}
if (val < 32) {
warning(MYNAME ": Ignoring illegal character %s;\n\tConsider
emailing %s at <%s>\n\tabout illegal characters in their GPX files.\n", bad
char, gpx_author?gpx_author:"(unknown author)", gpx_email?gpx_email:"(unkno
wn email address)");
memmove(badchar, semi+1, strlen(semi+1)+1);
len -= (semi-badchar)+1;
badchar--;
}
}
badchar = strstr(badchar+1, "&#x");
}
}
result = XML_Parse(psr, buf, len, done);
} else if (input_string) {
done = 0;
result = XML_Parse(psr, input_string,
input_string_len, done);
done = 1;
} else {
done = 1;
result = -1;
}
if (!result) {
fatal(MYNAME ": XML parse error at line %d of '%s' : %s\n",
(int) XML_GetCurrentLineNumber(psr),
input_fname ? input_fname : "unknown file",
XML_ErrorString(XML_GetErrorCode(psr)));
}
}
xfree(buf);
#endif /* HAVE_LIBEXPAT */
}
static void
fprint_tag_and_attrs(char* prefix, char* suffix, xml_tag* tag)
{
char** pa;
gbfprintf(ofd, "%s%s", prefix, tag->tagname);
pa = tag->attributes;
if (pa) {
while (*pa) {
gbfprintf(ofd, " %s=\"%s\"", pa[0], pa[1]);
pa += 2;
}
}
gbfprintf(ofd, "%s", suffix);
}
static void
fprint_xml_chain(xml_tag* tag, const waypoint* wpt)
{
char* tmp_ent;
while (tag) {
if (!tag->cdata && !tag->child) {
fprint_tag_and_attrs("<", " />", tag);
} else {
fprint_tag_and_attrs("<", ">", tag);
if (tag->cdata) {
tmp_ent = xml_entitize(tag->cdata);
gbfprintf(ofd, "%s", tmp_ent);
xfree(tmp_ent);
}
if (tag->child) {
fprint_xml_chain(tag->child, wpt);
}
if (wpt && wpt->gc_data.exported &&
strcmp(tag->tagname, "groundspeak:cache") == 0) {
xml_write_time(ofd, wpt->gc_data.exported, 0,
"groundspeak:exported");
}
gbfprintf(ofd, "</%s>\n", tag->tagname);
}
if (tag->parentcdata) {
tmp_ent = xml_entitize(tag->parentcdata);
gbfprintf(ofd, "%s", tmp_ent);
xfree(tmp_ent);
}
tag = tag->sibling;
}
}
void free_gpx_extras(xml_tag* tag)
{
xml_tag* next = NULL;
char** ap;
while (tag) {
if (tag->cdata) {
xfree(tag->cdata);
}
if (tag->child) {
free_gpx_extras(tag->child);
}
if (tag->parentcdata) {
xfree(tag->parentcdata);
}
if (tag->tagname) {
xfree(tag->tagname);
}
if (tag->attributes) {
ap = tag->attributes;
while (*ap) {
xfree(*ap++);
}
xfree(tag->attributes);
}
next = tag->sibling;
xfree(tag);
tag = next;
}
}
/*
* Handle the grossness of GPX 1.0 vs. 1.1 handling of linky links.
*/
static void
write_gpx_url(const waypoint* waypointp)
{
char* tmp_ent;
if (waypointp->url == NULL) {
return;
}
if (gpx_wversion_num > 10) {
url_link* tail;
for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_nex
t) {
tmp_ent = xml_entitize(tail->url);
gbfprintf(ofd, " <link href=\"%s%s\">\n",
urlbase ? urlbase : "", tmp_ent);
write_optional_xml_entity(ofd, " ", "text",
tail->url_link_text);
gbfprintf(ofd, " </link>\n");
xfree(tmp_ent);
}
} else {
tmp_ent = xml_entitize(waypointp->url);
gbfprintf(ofd, " <url>%s%s</url>\n",
urlbase ? urlbase : "", tmp_ent);
write_optional_xml_entity(ofd, " ", "urlname",
waypointp->url_link_text);
xfree(tmp_ent);
}
}
/*
* Write optional accuracy information for a given (way|track|route)point
* to the output stream. Done in one place since it's common for all three
.
* Order counts.
*/
static void
gpx_write_common_acc(const waypoint* waypointp, const char* indent)
{
char* fix = NULL;
switch (waypointp->fix) {
case fix_2d:
fix = "2d";
break;
case fix_3d:
fix = "3d";
break;
case fix_dgps:
fix = "dgps";
break;
case fix_pps:
fix = "pps";
break;
case fix_none:
fix = "none";
break;
/* GPX spec says omit if we don't know. */
case fix_unknown:
default:
break;
}
if (fix) {
gbfprintf(ofd, "%s<fix>%s</fix>\n", indent, fix);
}
if (waypointp->sat > 0) {
gbfprintf(ofd, "%s<sat>%d</sat>\n", indent, waypointp->sat);
}
if (waypointp->hdop) {
gbfprintf(ofd, "%s<hdop>%f</hdop>\n", indent, waypointp->hdop);
}
if (waypointp->vdop) {
gbfprintf(ofd, "%s<vdop>%f</vdop>\n", indent, waypointp->vdop);
}
if (waypointp->pdop) {
gbfprintf(ofd, "%s<pdop>%f</pdop>\n", indent, waypointp->pdop);
}
}
static void
gpx_write_common_position(const waypoint* waypointp, const char* indent)
{
if (waypointp->altitude != unknown_alt) {
gbfprintf(ofd, "%s<ele>%f</ele>\n",
indent, waypointp->altitude);
}
if (waypointp->creation_time) {
xml_write_time(ofd, waypointp->creation_time, waypointp->microseconds,
"time");
}
}
static void
gpx_write_common_description(const waypoint* waypointp, const char* indent,
const char* oname)
{
write_optional_xml_entity(ofd, indent, "name", oname);
write_optional_xml_entity(ofd, indent, "cmt", waypointp->description);
if (waypointp->notes && waypointp->notes[0]) {
write_xml_entity(ofd, indent, "desc", waypointp->notes);
} else {
write_optional_xml_entity(ofd, indent, "desc", waypointp->description);
}
write_gpx_url(waypointp);
write_optional_xml_entity(ofd, indent , "sym", waypointp->icon_descr);
}
static void
gpx_waypt_pr(const waypoint* waypointp)
{
const char* oname;
char* odesc;
fs_xml* fs_gpx;
garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */
/*
* Desparation time, try very hard to get a good shortname
*/
odesc = waypointp->notes;
if (!odesc) {
odesc = waypointp->description;
}
if (!odesc) {
odesc = waypointp->shortname;
}
oname = global_opts.synthesize_shortnames ?
mkshort(mkshort_handle, odesc) :
waypointp->shortname;
gbfprintf(ofd, "<wpt lat=\"" FLT_FMT "\" lon=\"" FLT_FMT "\">\n",
waypointp->latitude,
waypointp->longitude);
gpx_write_common_position(waypointp, " ");
gpx_write_common_description(waypointp, " ", oname);
gpx_write_common_acc(waypointp, " ");
fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
gmsd = GMSD_FIND(waypointp);
if (fs_gpx) {
if (! gmsd) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
}
if (gmsd && (gpx_wversion_num > 10)) {
/* MapSource doesn't accepts extensions from 1.0 */
garmin_fs_xml_fprint(ofd, waypointp);
}
gbfprintf(ofd, "</wpt>\n");
}
static void
gpx_track_hdr(const route_head* rte)
{
fs_xml* fs_gpx;
gbfprintf(ofd, "<trk>\n");
write_optional_xml_entity(ofd, " ", "name", rte->rte_name);
write_optional_xml_entity(ofd, " ", "desc", rte->rte_desc);
if (rte->rte_num) {
gbfprintf(ofd, "<number>%d</number>\n", rte->rte_num);
}
gbfprintf(ofd, "<trkseg>\n");
fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
gpx_track_disp(const waypoint* waypointp)
{
fs_xml* fs_gpx;
gbfprintf(ofd, "<trkpt lat=\"" FLT_FMT_T "\" lon=\"" FLT_FMT_T "\">\n",
waypointp->latitude,
waypointp->longitude);
gpx_write_common_position(waypointp, " ");
/* These were accidentally removed from 1.1 */
if (gpx_wversion_num == 10) {
if WAYPT_HAS(waypointp, course) {
gbfprintf(ofd, " <course>%f</course>\n",
waypointp->course);
}
if WAYPT_HAS(waypointp, speed) {
gbfprintf(ofd, " <speed>%f</speed>\n",
waypointp->speed);
}
}
/* GPX doesn't require a name on output, so if we made one up
* on input, we might as well say nothing.
*/
gpx_write_common_description(waypointp, " ",
waypointp->wpt_flags.shortname_is_synthetic
?
NULL : waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
gbfprintf(ofd, "</trkpt>\n");
}
static void
gpx_track_tlr(const route_head* rte)
{
gbfprintf(ofd, "</trkseg>\n");
gbfprintf(ofd, "</trk>\n");
}
static
void gpx_track_pr()
{
track_disp_all(gpx_track_hdr, gpx_track_tlr, gpx_track_disp);
}
static void
gpx_route_hdr(const route_head* rte)
{
fs_xml* fs_gpx;
gbfprintf(ofd, "<rte>\n");
write_optional_xml_entity(ofd, " ", "name", rte->rte_name);
write_optional_xml_entity(ofd, " ", "desc", rte->rte_desc);
if (rte->rte_num) {
gbfprintf(ofd, " <number>%d</number>\n", rte->rte_num);
}
fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
gpx_route_disp(const waypoint* waypointp)
{
fs_xml* fs_gpx;
gbfprintf(ofd, " <rtept lat=\"" FLT_FMT_R "\" lon=\"" FLT_FMT_R "\">\n",
waypointp->latitude,
waypointp->longitude);
gpx_write_common_position(waypointp, " ");
gpx_write_common_description(waypointp, " ", waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
gbfprintf(ofd, " </rtept>\n");
}
static void
gpx_route_tlr(const route_head* rte)
{
gbfprintf(ofd, "</rte>\n");
}
static
void gpx_route_pr()
{
/* output routes */
route_disp_all(gpx_route_hdr, gpx_route_tlr, gpx_route_disp);
}
static void
gpx_waypt_bound_calc(const waypoint* waypointp)
{
waypt_add_to_bounds(&all_bounds, waypointp);
}
static void
gpx_write_bounds(void)
{
waypt_init_bounds(&all_bounds);
waypt_disp_all(gpx_waypt_bound_calc);
route_disp_all(NULL, NULL, gpx_waypt_bound_calc);
track_disp_all(NULL, NULL, gpx_waypt_bound_calc);
if (waypt_bounds_valid(&all_bounds)) {
gbfprintf(ofd, "<bounds minlat=\"%0.9f\" minlon=\"%0.9f\" "
"maxlat=\"%0.9f\" maxlon=\"%0.9f\"/>\n",
all_bounds.min_lat, all_bounds.min_lon,
all_bounds.max_lat, all_bounds.max_lon);
}
}
static void
gpx_write(void)
{
time_t now = 0;
int short_length;
gpx_wversion_num = strtod(gpx_wversion, NULL) * 10;
if (gpx_wversion_num <= 0) {
fatal(MYNAME ": gpx version number of '%s' not valid.\n", gpx_wversion)
;
}
now = current_time();
short_length = atoi(snlen);
if (suppresswhite) {
setshort_whitespace_ok(mkshort_handle, 0);
}
setshort_length(mkshort_handle, short_length);
gbfprintf(ofd, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", global_opts.c
harset_name);
gbfprintf(ofd, "<gpx\n version=\"%s\"\n", gpx_wversion);
gbfprintf(ofd, "creator=\"" CREATOR_NAME_URL "\"\n");
gbfprintf(ofd, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n
");
gbfprintf(ofd, "xmlns=\"http://www.topografix.com/GPX/%c/%c\"\n", gpx_wve
rsion[0], gpx_wversion[2]);
if (xsi_schema_loc) {
gbfprintf(ofd, "xsi:schemaLocation=\"%s\">\n", xsi_schema_loc);
} else {
gbfprintf(ofd,
"xsi:schemaLocation=" DEFAULT_XSI_SCHEMA_LOC_FMT">\n",
gpx_wversion[0], gpx_wversion[2],
gpx_wversion[0], gpx_wversion[2]);
}
if (gpx_wversion_num > 10) {
gbfprintf(ofd, "<metadata>\n");
}
gpx_write_gdata(&gpx_global->name, "name");
gpx_write_gdata(&gpx_global->desc, "desc");
/* In GPX 1.1, author changed from a string to a PersonType.
* since it's optional, we just drop it instead of rewriting it.
*/
if (gpx_wversion_num < 11) {
gpx_write_gdata(&gpx_global->author, "author");
}
gpx_write_gdata(&gpx_global->email, "email");
gpx_write_gdata(&gpx_global->url, "url");
gpx_write_gdata(&gpx_global->urlname, "urlname");
xml_write_time(ofd, now, 0, "time");
gpx_write_gdata(&gpx_global->keywords, "keywords");
gpx_write_bounds();
if (gpx_wversion_num > 10) {
gbfprintf(ofd, "</metadata>\n");
}
waypt_disp_all(gpx_waypt_pr);
gpx_route_pr();
gpx_track_pr();
gbfprintf(ofd, "</gpx>\n");
}
static void
gpx_free_gpx_global(void)
{
gpx_rm_from_global(&gpx_global->name);
gpx_rm_from_global(&gpx_global->desc);
gpx_rm_from_global(&gpx_global->author);
gpx_rm_from_global(&gpx_global->email);
gpx_rm_from_global(&gpx_global->url);
gpx_rm_from_global(&gpx_global->urlname);
gpx_rm_from_global(&gpx_global->keywords);
xfree(gpx_global);
}
static void
gpx_exit(void)
{
if (xsi_schema_loc) {
xfree(xsi_schema_loc);
xsi_schema_loc = NULL;
}
if (gpx_global) {
gpx_free_gpx_global();
gpx_global = NULL;
}
}
static
arglist_t gpx_args[] = {
{
"snlen", &snlen, "Length of generated shortnames",
"32", ARGTYPE_INT, "1", NULL
},
{
"suppresswhite", &suppresswhite,
"No whitespace in generated shortnames",
NULL, ARGTYPE_BOOL, ARG_NOMINMAX
},
{
"logpoint", &opt_logpoint,
"Create waypoints from geocache log entries",
NULL, ARGTYPE_BOOL, ARG_NOMINMAX
},
{
"urlbase", &urlbase, "Base URL for link tag in output",
NULL, ARGTYPE_STRING, ARG_NOMINMAX
},
{
"gpxver", &gpx_wversion, "Target GPX version for output",
"1.0", ARGTYPE_STRING, ARG_NOMINMAX
},
ARG_TERMINATOR
};
ff_vecs_t gpx_vecs = {
ff_type_file,
FF_CAP_RW_ALL,
gpx_rd_init,
gpx_wr_init,
gpx_rd_deinit,
gpx_wr_deinit,
gpx_read,
gpx_write,
gpx_exit,
gpx_args,
CET_CHARSET_UTF8, 0 /* non-fixed to create non UTF-8 XML's for testing |
CET-REVIEW */
};
#endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added


 garmin_fs.h   garmin_fs.h 
/* /*
Implementation of special data used by Garmin products. Implementation of special data used by Garmin products.
Copyright (C) 2006 Olaf Klein, o.b.klein@gpsbabel.org Copyright (C) 2006 Olaf Klein, o.b.klein@gpsbabel.org
Copyright (C) 2006-2014 Robert Lipe, robertlipe@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 54 skipping to change at line 55
#define GMSD_GET(a,b) ((gmsd) && (gmsd->flags.a)) ? (gmsd->a) : (b) #define GMSD_GET(a,b) ((gmsd) && (gmsd->flags.a)) ? (gmsd->a) : (b)
/* GMSD_SET(a,b): a = numeric gmsd field, b = numeric source */ /* GMSD_SET(a,b): a = numeric gmsd field, b = numeric source */
#define GMSD_SET(a,b) if (gmsd) {gmsd->a = (b); gmsd->flags.a = 1; } #define GMSD_SET(a,b) if (gmsd) {gmsd->a = (b); gmsd->flags.a = 1; }
/* GMSD_UNSET(a): a = gmsd field */ /* GMSD_UNSET(a): a = gmsd field */
#define GMSD_UNSET(a) if (gmsd) { gmsd->flags.a = 0; } #define GMSD_UNSET(a) if (gmsd) { gmsd->flags.a = 0; }
/* GMSD_SETSTR(a,b): a = gmsd field, b = null terminated source */ /* GMSD_SETSTR(a,b): a = gmsd field, b = null terminated source */
#define GMSD_SETSTR(a,b) if (gmsd && (b) && (b)[0]) { gmsd->a = xstrdup((b) ); gmsd->flags.a = 1; } #define GMSD_SETSTR(a,b) if (gmsd && (b) && (b)[0]) { gmsd->a = xstrdup((b) ); gmsd->flags.a = 1; }
#define GMSD_SETSTRQ(a,b) if (gmsd && !b.isEmpty()) { gmsd->a = xstrdup((b )); gmsd->flags.a = 1; }
/* GMSD_SETNSTR(a,b,c): a = gmsd field, b = source, c = sizeof(source) */ /* GMSD_SETNSTR(a,b,c): a = gmsd field, b = source, c = sizeof(source) */
#define GMSD_SETNSTR(a,b,c) if (gmsd && (b) && (b)[0]) { gmsd->a = xstrndup ((b),(c)); gmsd->flags.a = 1; } #define GMSD_SETNSTR(a,b,c) if (gmsd && (b) && (b)[0]) { gmsd->a = xstrndup ((b),(c)); gmsd->flags.a = 1; }
/* GMSD_GETNSTR(a,b,c): a = gmsd field, b = target, c = sizeof(target) */ /* GMSD_GETNSTR(a,b,c): a = gmsd field, b = target, c = sizeof(target) */
#define GMSD_GETNSTR(a,b,c) if (gmsd && gmsd->flags.a) strncpy((b),gmsd->a, (c)) #define GMSD_GETNSTR(a,b,c) if (gmsd && gmsd->flags.a) strncpy((b),gmsd->a, (c))
typedef struct garmin_ilink_s { typedef struct garmin_ilink_s {
int ref_count; int ref_count;
double lat, lon, alt; double lat, lon, alt;
skipping to change at line 95 skipping to change at line 97
unsigned int subclass:1; unsigned int subclass:1;
#endif #endif
} garmin_fs_flags_t; } garmin_fs_flags_t;
typedef struct garmin_fs_s { typedef struct garmin_fs_s {
format_specific_data fs; format_specific_data fs;
garmin_fs_flags_t flags; garmin_fs_flags_t flags;
int protocol; /* ... used by device (-1 is MapSource) */ int protocol; /* ... used by device (-1 is MapSource) */
gbint32 icon; int32_t icon;
int wpt_class; int wpt_class;
gbint32 display; int32_t display;
gbint16 category; int16_t category;
char* city; /* city name */ char* city; /* city name */
char* facility; /* facility name */ char* facility; /* facility name */
char* state; /* state */ char* state; /* state */
char* cc; /* country code */ char* cc; /* country code */
char* cross_road; /* Intersection road label */ char* cross_road; /* Intersection road label */
char* addr; /* address + number */ char* addr; /* address + number */
char* country; /* country */ char* country; /* country */
char* phone_nr; /* phone number */ char* phone_nr; /* phone number */
char* phone_nr2; /* phone number (2) */ char* phone_nr2; /* phone number (2) */
char* fax_nr; /* fax number */ char* fax_nr; /* fax number */
skipping to change at line 124 skipping to change at line 126
#endif #endif
} garmin_fs_t, *garmin_fs_p; } garmin_fs_t, *garmin_fs_p;
garmin_fs_t* garmin_fs_alloc(const int protocol); garmin_fs_t* garmin_fs_alloc(const int protocol);
void garmin_fs_destroy(void* fs); void garmin_fs_destroy(void* fs);
void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src); void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src);
void garmin_fs_convert(void* fs); void garmin_fs_convert(void* fs);
char* garmin_fs_xstrdup(const char* src, size_t size); char* garmin_fs_xstrdup(const char* src, size_t size);
/* for GPX */ /* for GPX */
void garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatast void garmin_fs_xml_convert(const int base_tag, int tag, const QString& cdat
r, waypoint* waypt); astr, Waypoint* waypt);
void garmin_fs_xml_fprint(gbfile* ofd, const waypoint* waypt); class QXmlStreamWriter;
void garmin_fs_xml_fprint(const Waypoint* waypt, QXmlStreamWriter*);
/* common garmin_fs utilities */ /* common garmin_fs utilities */
/* ..convert_category: returns 1=OK; 0=Unable to convert category */ /* ..convert_category: returns 1=OK; 0=Unable to convert category */
unsigned char garmin_fs_convert_category(const char* category_name, gbuint1 6* category); unsigned char garmin_fs_convert_category(const char* category_name, uint16_ t* category);
/* ..merge_category: returns 1=OK; 0=Unable to convert category */ /* ..merge_category: returns 1=OK; 0=Unable to convert category */
unsigned char garmin_fs_merge_category(const char* category_name, waypoint* waypt); unsigned char garmin_fs_merge_category(const char* category_name, Waypoint* waypt);
#define GMSD_SECTION_CATEGORIES "Garmin Categories" #define GMSD_SECTION_CATEGORIES "Garmin Categories"
void garmin_fs_garmin_after_read(const GPS_PWay way, waypoint* wpt, const i void garmin_fs_garmin_after_read(const GPS_PWay way, Waypoint* wpt, const i
nt protoid); nt protoid);
void garmin_fs_garmin_before_write(const waypoint* wpt, GPS_PWay way, const void garmin_fs_garmin_before_write(const Waypoint* wpt, GPS_PWay way, const
int protoid); int protoid);
#endif #endif
 End of changes. 8 change blocks. 
12 lines changed or deleted 15 lines changed or added


 garmin_gpi.h   garmin_gpi.h 
#ifndef GARMIN_GPI_H #ifndef GARMIN_GPI_H
#define GARMIN_GPI_H #define GARMIN_GPI_H
static char gpi_bitmap[] = { static unsigned char gpi_bitmap[] = {
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x00,0x00,0x40,0x02,0x0 0,0x00, 0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x00,0x00,0x40,0x02,0x0 0,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0xff,0x00,0xff,0x00,0x01,0x00,0x0 0,0x00, 0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0xff,0x00,0xff,0x00,0x01,0x00,0x0 0,0x00,
0x6c,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00, 0x6c,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7e,0x7 e,0x7e, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7e,0x7 e,0x7e,
0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7 e,0x7e, 0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7 e,0x7e,
0x7e,0x7e,0x00,0x7e,0x00,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f, 0x7e,0x7e,0x00,0x7e,0x00,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,
0x7f,0x7f,0x59,0x67,0x65,0x7f,0x7f,0x7f,0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7 f,0x7f, 0x7f,0x7f,0x59,0x67,0x65,0x7f,0x7f,0x7f,0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7 f,0x7f,
0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x74,0x3d,0x42,0x56,0x7e,0x7 e,0x7f, 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x74,0x3d,0x42,0x56,0x7e,0x7 e,0x7f,
0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f, 0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,
0x7f,0x72,0x38,0x49,0x47,0x7e,0x7e,0x7f,0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7 f,0x7f, 0x7f,0x72,0x38,0x49,0x47,0x7e,0x7e,0x7f,0x7f,0x7f,0x00,0x7e,0x00,0x7e,0x7 f,0x7f,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 garmin_tables.h   garmin_tables.h 
/* /*
Garmin icon tables Garmin icon tables
Based on information provided by Ian Cowley, Sigurd Humerfelt, Based on information provided by Ian Cowley, Sigurd Humerfelt,
and Garmin MapSource and Garmin MapSource
Copyright (C) 2003 Robert Lipe, robertlipe@usa.net Copyright (C) 2003-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 39 skipping to change at line 39
#define DEFAULT_ICON_VALUE 18 #define DEFAULT_ICON_VALUE 18
typedef struct icon_mapping { typedef struct icon_mapping {
const int mpssymnum; const int mpssymnum;
const int pcxsymnum; const int pcxsymnum;
const char* icon; const char* icon;
} icon_mapping_t; } icon_mapping_t;
typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e; typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e;
char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin const char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e
_format, int* dynamic); garmin_format, int* dynamic);
int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin int gt_find_icon_number_from_desc(const QString& desc, garmin_formats_e gar
_format); min_format);
extern icon_mapping_t garmin_icon_table[]; extern icon_mapping_t garmin_icon_table[];
typedef enum { typedef enum {
gt_waypt_class_user_waypoint = 0, gt_waypt_class_user_waypoint = 0,
gt_waypt_class_airport, gt_waypt_class_airport,
gt_waypt_class_intersection, gt_waypt_class_intersection,
gt_waypt_class_ndb, gt_waypt_class_ndb,
gt_waypt_class_vor, gt_waypt_class_vor,
gt_waypt_class_runway_threshold, gt_waypt_class_runway_threshold,
gt_waypt_class_airport_intersection, gt_waypt_class_airport_intersection,
gt_waypt_class_airport_ndb, gt_waypt_class_airport_ndb,
gt_waypt_class_map_point, gt_waypt_class_map_point,
gt_waypt_class_map_area, gt_waypt_class_map_area,
gt_waypt_class_map_intersection, gt_waypt_class_map_intersection,
gt_waypt_class_map_address, gt_waypt_class_map_address,
gt_waypt_class_map_line gt_waypt_class_map_line
} gt_waypt_classes_e; } gt_waypt_classes_e;
extern char* gt_waypt_class_names[]; extern const char* gt_waypt_class_names[];
typedef struct gt_country_code_s { typedef struct gt_country_code_s {
const char* cc; const char* cc;
const char* country; const char* country;
} gt_country_code_t; } gt_country_code_t;
extern gt_country_code_t gt_country_codes[]; extern gt_country_code_t gt_country_codes[];
const char* gt_get_icao_country(const char* cc); const char* gt_get_icao_country(const QString& cc);
const char* gt_get_icao_cc(const char* country, const char* shortname); const char* gt_get_icao_cc(const QString& country, const QString& shortname
);
/* this order is used by most devices */ /* this order is used by most devices */
typedef enum { typedef enum {
gt_display_mode_symbol_and_name = 0, gt_display_mode_symbol_and_name = 0,
gt_display_mode_symbol, gt_display_mode_symbol,
gt_display_mode_symbol_and_comment gt_display_mode_symbol_and_comment
} gt_display_modes_e; } gt_display_modes_e;
extern char* gt_display_mode_names[]; extern const char* gt_display_mode_names[];
#define GT_DISPLAY_MODE_MIN gt_display_mode_symbol_and_name #define GT_DISPLAY_MODE_MIN gt_display_mode_symbol_and_name
#define GT_DISPLAY_MODE_MAX gt_display_mode_symbol_and_comment #define GT_DISPLAY_MODE_MAX gt_display_mode_symbol_and_comment
typedef enum { typedef enum {
gt_gdb_display_mode_symbol = 0, gt_gdb_display_mode_symbol = 0,
gt_gdb_display_mode_symbol_and_name, gt_gdb_display_mode_symbol_and_name,
gt_gdb_display_mode_symbol_and_comment gt_gdb_display_mode_symbol_and_comment
} gt_gdb_display_modes_e; } gt_gdb_display_modes_e;
unsigned char gt_convert_category(const char* name, int* category); unsigned char gt_convert_category(const char* name, int* category);
unsigned char gt_switch_display_mode_value(const unsigned char display_mode , const int protoid, const char device); unsigned char gt_switch_display_mode_value(const unsigned char display_mode , const int protoid, const char device);
grid_type gt_lookup_grid_type(const char* grid_name, const char* module); grid_type gt_lookup_grid_type(const char* grid_name, const char* module);
const char* gt_get_mps_grid_longname(const grid_type grid, const char* modu le); const char* gt_get_mps_grid_longname(const grid_type grid, const char* modu le);
int gt_lookup_datum_index(const char* datum_str, const char* module); int gt_lookup_datum_index(const char* datum_str, const char* module);
const char* gt_get_mps_datum_name(const int datum_index); const char* gt_get_mps_datum_name(const int datum_index);
gbuint32 gt_color_value(const int garmin_index); uint32_t gt_color_value(const unsigned int garmin_index);
gbuint32 gt_color_value_by_name(const char* name); uint32_t gt_color_value_by_name(const char* name);
int gt_color_index_by_name(const char* name); int gt_color_index_by_name(const char* name);
int gt_color_index_by_rgb(const int rgb); int gt_color_index_by_rgb(const int rgb);
const char* gt_color_name(const int garmin_index); const char* gt_color_name(const unsigned int garmin_index);
#endif #endif
 End of changes. 7 change blocks. 
12 lines changed or deleted 13 lines changed or added


 gbfile.h   gbfile.h 
skipping to change at line 29 skipping to change at line 29
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
#ifndef GBFILE_H #ifndef GBFILE_H
#define GBFILE_H #define GBFILE_H
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <QtCore/QString>
#include "defs.h" #include "defs.h"
#include "cet.h" #include "cet.h"
struct gbfile_s; struct gbfile_s;
typedef struct gbfile_s gbfile; typedef struct gbfile_s gbfile;
typedef uint32_t gbsize_t;
typedef void (*gbfclearerr_cb)(gbfile* self); typedef void (*gbfclearerr_cb)(gbfile* self);
typedef int (*gbfclose_cb)(gbfile* self); typedef int (*gbfclose_cb)(gbfile* self);
typedef int (*gbfeof_cb)(gbfile* self); typedef int (*gbfeof_cb)(gbfile* self);
typedef int (*gbferror_cb)(gbfile* self); typedef int (*gbferror_cb)(gbfile* self);
typedef int (*gbfflush_cb)(gbfile* self); typedef int (*gbfflush_cb)(gbfile* self);
typedef gbfile* (*gbfopen_cb)(gbfile* self, const char* mode); typedef gbfile* (*gbfopen_cb)(gbfile* self, const char* mode);
typedef gbsize_t (*gbfread_cb)(void* buf, const gbsize_t size, const gbsize _t members, gbfile* self); typedef gbsize_t (*gbfread_cb)(void* buf, const gbsize_t size, const gbsize _t members, gbfile* self);
typedef int (*gbfseek_cb)(gbfile* self, gbint32 offset, int whence); typedef int (*gbfseek_cb)(gbfile* self, int32_t offset, int whence);
typedef gbsize_t (*gbftell_cb)(gbfile* self); typedef gbsize_t (*gbftell_cb)(gbfile* self);
typedef gbsize_t (*gbfwrite_cb)(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self); typedef gbsize_t (*gbfwrite_cb)(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self);
typedef int (*gbfungetc_cb)(const int c, gbfile* self); typedef int (*gbfungetc_cb)(const int c, gbfile* self);
typedef struct gbfile_s { typedef struct gbfile_s {
#ifdef DEBUG_MEM #ifdef DEBUG_MEM
void* dummy; /* ZERO pointer for stdio oop's */ void* dummy; /* ZERO pointer for stdio oop's */
#endif #endif
union { union {
FILE* std; FILE* std;
unsigned char* mem; unsigned char* mem;
#if !ZLIB_INHIBITED #if !ZLIB_INHIBITED
gzFile* gz; gzFile gz;
#endif #endif
} handle; } handle;
char* name; char* name;
char* module; char* module;
char* buff; /* static growing buffer, primary used by gbprintf * / char* buff; /* static growing buffer, primary used by gbprintf * /
int buffsz; int buffsz;
char mode; char mode;
int back; int back;
gbsize_t mempos; /* curr. position in memory */ gbsize_t mempos; /* curr. position in memory */
gbsize_t memlen; /* max. number of written bytes to memory */ gbsize_t memlen; /* max. number of written bytes to memory */
skipping to change at line 94 skipping to change at line 97
gbfwrite_cb filewrite; gbfwrite_cb filewrite;
} gbfile_t; } gbfile_t;
gbfile* gbfopen(const char* filename, const char* mode, const char* module) ; gbfile* gbfopen(const char* filename, const char* mode, const char* module) ;
gbfile* gbfopen_be(const char* filename, const char* mode, const char* modu le); gbfile* gbfopen_be(const char* filename, const char* mode, const char* modu le);
#define gbfopen_le gbfopen #define gbfopen_le gbfopen
void gbfclose(gbfile* file); void gbfclose(gbfile* file);
gbsize_t gbfread(void* buf, const gbsize_t size, const gbsize_t members, gb file* file); gbsize_t gbfread(void* buf, const gbsize_t size, const gbsize_t members, gb file* file);
int gbfgetc(gbfile* file); int gbfgetc(gbfile* file);
char* gbfgets(char* buf, int len, gbfile* file); QString gbfgets(char* buf, int len, gbfile* file);
int gbvfprintf(gbfile* file, const char* format, va_list ap); int gbvfprintf(gbfile* file, const char* format, va_list ap);
int gbfprintf(gbfile* file, const char* format, ...); int gbfprintf(gbfile* file, const char* format, ...);
int gbfputc(int c, gbfile* file); int gbfputc(int c, gbfile* file);
int gbfputs(const char* s, gbfile* file); int gbfputs(const char* s, gbfile* file);
int gbfputs(const QString& s, gbfile* file);
int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file); int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file);
int gbfflush(gbfile* file); int gbfflush(gbfile* file);
void gbfclearerr(gbfile* file); void gbfclearerr(gbfile* file);
int gbferror(gbfile* file); int gbferror(gbfile* file);
void gbfrewind(gbfile* file); void gbfrewind(gbfile* file);
int gbfseek(gbfile* file, gbint32 offset, int whence); int gbfseek(gbfile* file, int32_t offset, int whence);
gbsize_t gbftell(gbfile* file); gbsize_t gbftell(gbfile* file);
int gbfeof(gbfile* file); int gbfeof(gbfile* file);
int gbfungetc(const int c, gbfile* file); int gbfungetc(const int c, gbfile* file);
gbint32 gbfgetint32(gbfile* file); int32_t gbfgetint32(gbfile* file);
#define gbfgetuint32 (gbuint32)gbfgetint32 #define gbfgetuint32 (uint32_t)gbfgetint32
gbint16 gbfgetint16(gbfile* file); int16_t gbfgetint16(gbfile* file);
#define gbfgetuint16 (gbuint16)gbfgetint16 #define gbfgetuint16 (uint16_t)gbfgetint16
double gbfgetdbl(gbfile* file); // read a double val ue double gbfgetdbl(gbfile* file); // read a double val ue
float gbfgetflt(gbfile* file); // read a float value float gbfgetflt(gbfile* file); // read a float value
char* gbfgetstr(gbfile* file); // read until any type of li ne-breaks or EOF char* gbfgetstr(gbfile* file); // read until any type of li ne-breaks or EOF
char* gbfgetpstr(gbfile* file); // read a pascal str QString gbfgetpstr(gbfile* file); // read a pascal string
ing QString gbfgetcstr(gbfile* file); // read a null terminated st
char* gbfgetcstr(gbfile* file); // read a null termi ring
nated string char* gbfgetcstr_old(gbfile* file); // read a null terminated st
ring
int gbfputint16(const gbint16 i, gbfile* file);
#define gbfputuint16(a,b) gbfputint16((gbuint16)(a),(b)) int gbfputint16(const int16_t i, gbfile* file);
int gbfputint32(const gbint32 i, gbfile* file); #define gbfputuint16(a,b) gbfputint16((uint16_t)(a),(b))
#define gbfputuint32(a,b) gbfputint32((gbuint32)(a),(b)) int gbfputint32(const int32_t i, gbfile* file);
#define gbfputuint32(a,b) gbfputint32((uint32_t)(a),(b))
int gbfputdbl(const double d, gbfile* file); // write a double value int gbfputdbl(const double d, gbfile* file); // write a double value
int gbfputflt(const float f, gbfile* file); // write a float value int gbfputflt(const float f, gbfile* file); // write a float value
int gbfputcstr(const char* s, gbfile* file); // write string including '\ 0' int gbfputcstr(const char* s, gbfile* file); // write string including '\ 0'
int gbfputcstr(const QString& s, gbfile* file); // write string incl
uding '\0'
int gbfputpstr(const char* s, gbfile* file); // write as pascal string int gbfputpstr(const char* s, gbfile* file); // write as pascal string
int gbfputpstr(const QString& s, gbfile* file); // write as pascal s tring
gbsize_t gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count); gbsize_t gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count);
#endif #endif
 End of changes. 12 change blocks. 
17 lines changed or deleted 27 lines changed or added


 gbser.h   gbser.h 
/* /*
OS Abstraction for serial interface. OS Abstraction for serial interface.
Copyright (C) 2006 Robert Lipe, robertlipe@usa.net Copyright (C) 2006-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gbser_private.h   gbser_private.h 
/* /*
Serial interface - private header for gbser*.c Serial interface - private header for gbser*.c
Copyright (C) 2006 Robert Lipe, robertlipe@usa.net Copyright (C) 2006-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gbversion.h   gbversion.h 
/* /*
* gbversion.h is generated from gbversion.h.in which uses autoconf voodoo * gbversion.h is generated from gbversion.h.in which uses autoconf voodoo
* to get the version number from configure.in. * to get the version number from configure.in.
* *
* Isn't simplification via automation grand? * Isn't simplification via automation grand?
*/ */
#define VERSION "1.4.4" #define VERSION "1.5.0"
#define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-1.4.4" #define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-1.5.0"
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 gmapdlg.h   gmapdlg.h 
skipping to change at line 40 skipping to change at line 40
#include "gpx.h" #include "gpx.h"
#include "map.h" #include "map.h"
class GMapDialog: public QDialog class GMapDialog: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *t e); GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *t e);
private: private:
Ui_GMapDlg ui; Ui_GMapDlg ui_;
Map *mapWidget; Map *mapWidget_;
bool showWaypoints, showRoutes, showTracks; QStandardItemModel *model_;
QStandardItemModel *model; QStandardItem *wptItem_, *trkItem_, *rteItem_;
QStandardItem *wptItem, *trkItem, *rteItem; QList<QStandardItem *> wptList_, trkList_, rteList_;
QList<QStandardItem *> wptList, trkList, rteList; Gpx gpx_;
Gpx gpx; int menuIndex_;
void appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt); void appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt);
void appendTrackInfo(QStandardItem *it, const GpxTrack &trk); void appendTrackInfo(QStandardItem *it, const GpxTrack &trk);
void appendRouteInfo(QStandardItem *it, const GpxRoute &rte); void appendRouteInfo(QStandardItem *it, const GpxRoute &rte);
int waypointIndex(QStandardItem *it); int waypointIndex(QStandardItem *it);
int trackIndex(QStandardItem *it); int trackIndex(QStandardItem *it);
int routeIndex(QStandardItem *it); int routeIndex(QStandardItem *it);
QString formatLength(double l); QString formatLength(double l);
int menuIndex;
// //
private slots: private slots:
void itemChangedX(QStandardItem *); void itemChangedX(QStandardItem *);
void waypointClickedX(int i); void waypointClickedX(int i);
void trackClickedX(int i); void trackClickedX(int i);
void routeClickedX(int i); void routeClickedX(int i);
void treeDoubleClicked(const QModelIndex &idx); void treeDoubleClicked(const QModelIndex &idx);
void selectionChangedX (const QItemSelection &, const QItemSelection &); void selectionChangedX (const QItemSelection &, const QItemSelection &);
void copyButtonClickedX(); void copyButtonClickedX();
void showContextMenu(const QPoint &); void showContextMenu(const QPoint &);
 End of changes. 2 change blocks. 
9 lines changed or deleted 7 lines changed or added


 gps.h   gps.h 
#ifdef __cplusplus
// extern "C"
//{
#endif
#ifndef gps_h #ifndef gps_h
#define gps_h #define gps_h
#include "../defs.h" #include "../defs.h"
#include "gpsport.h" #include "gpsport.h"
#include <time.h> #include <time.h>
#define FRAMING_ERROR -1 #define FRAMING_ERROR -1
#define PROTOCOL_ERROR -2 #define PROTOCOL_ERROR -2
#define HARDWARE_ERROR -3 #define HARDWARE_ERROR -3
skipping to change at line 41 skipping to change at line 36
extern int32 gps_warning; extern int32 gps_warning;
extern int32 gps_error; extern int32 gps_error;
extern int32 gps_user; extern int32 gps_user;
extern int32 gps_show_bytes; extern int32 gps_show_bytes;
extern char gps_categories[16][17]; extern char gps_categories[16][17];
typedef struct GPS_SPacket { typedef struct GPS_SPacket {
US type; US type;
uint32 n; uint32 n;
UC* data; UC* data;
} GPS_OPacket, *GPS_PPacket; } GPS_OPacket;
class GPS_PPacket {
public:
GPS_PPacket() : type(0), n(0) {
memset(data, 0, MAX_GPS_PACKET_SIZE);
}
US type;
uint32 n;
UC data[MAX_GPS_PACKET_SIZE];
};
typedef struct GPS_Serial_SPacket { typedef struct GPS_Serial_SPacket {
UC dle; UC dle;
UC type; UC type;
UC n; UC n;
UC* data; UC* data;
UC chk; UC chk;
UC edle; UC edle;
UC etx; UC etx;
} GPS_Serial_OPacket, *GPS_Serial_PPacket; } GPS_Serial_OPacket, *GPS_Serial_PPacket;
skipping to change at line 271 skipping to change at line 276
extern struct COMMANDDATA COMMAND_ID[2]; extern struct COMMANDDATA COMMAND_ID[2];
extern struct LINKDATA LINK_ID[3]; extern struct LINKDATA LINK_ID[3];
extern struct GPS_MODEL_PROTOCOL GPS_MP[]; extern struct GPS_MODEL_PROTOCOL GPS_MP[];
extern char* gps_marine_sym[]; extern char* gps_marine_sym[];
extern char* gps_land_sym[]; extern char* gps_land_sym[];
extern char* gps_aviation_sym[]; extern char* gps_aviation_sym[];
extern char* gps_16_sym[]; extern char* gps_16_sym[];
#endif #endif
#ifdef __cplusplus
// }
#endif
 End of changes. 3 change blocks. 
6 lines changed or deleted 11 lines changed or added


 gpsapp.h   gpsapp.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsapp_h #ifndef gpsapp_h
#define gpsapp_h #define gpsapp_h
#include "gps.h" #include "gps.h"
int32 GPS_Init(const char* port); int32 GPS_Init(const char* port);
int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int ct, G PS_PWay*)); int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int ct, G PS_PWay*));
int32 GPS_A101_Get(const char* port); int32 GPS_A101_Get(const char* port);
int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)( GPS_PWay*)); int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)( GPS_PWay*));
skipping to change at line 48 skipping to change at line 43
void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len); void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len);
void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len); void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len);
int32 GPS_A400_Get(const char* port, GPS_PWay** way); int32 GPS_A400_Get(const char* port, GPS_PWay** way);
int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n); int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n);
int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm); int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm);
int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n); int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n);
time_t GPS_A600_Get(const char* port); time_t GPS_A600_Get(const char* port);
time_t GPS_D600_Get(GPS_PPacket packet); time_t GPS_D600_Get(GPS_PPacket& packet);
int32 GPS_A600_Send(const char* port, time_t Time); int32 GPS_A600_Send(const char* port, time_t Time);
void GPS_D600_Send(GPS_PPacket* packet, time_t Time); void GPS_D600_Send(GPS_PPacket& packet, time_t Time);
int32 GPS_A700_Get(const char* port, double* lat, double* lon); int32 GPS_A700_Get(const char* port, double* lat, double* lon);
int32 GPS_A700_Send(const char* port, double lat, double lon); int32 GPS_A700_Send(const char* port, double lat, double lon);
void GPS_D700_Get(GPS_PPacket packet, double* lat, double* lon); void GPS_D700_Get(GPS_PPacket& packet, double* lat, double* lon);
void GPS_D700_Send(GPS_PPacket* packet, double lat, double lon); void GPS_D700_Send(GPS_PPacket& packet, double lat, double lon);
int32 GPS_A800_On(const char* port, gpsdevh** fd); int32 GPS_A800_On(const char* port, gpsdevh** fd);
int32 GPS_A800_Off(const char* port, gpsdevh** fd); int32 GPS_A800_Off(const char* port, gpsdevh** fd);
int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet); int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet);
void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data* pvt); void GPS_D800_Get(GPS_PPacket& packet, GPS_PPvt_Data* pvt);
int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb); int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb);
void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/ void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/
int32 GPS_A1006_Get(const char* port, GPS_PCourse** crs, pcb_fn cb); int32 GPS_A1006_Get(const char* port, GPS_PCourse** crs, pcb_fn cb);
int32 GPS_A1006_Send(const char* port, GPS_PCourse* crs, int32 n_crs, int32 GPS_A1006_Send(const char* port, GPS_PCourse* crs, int32 n_crs,
gpsdevh* fd); gpsdevh* fd);
void GPS_D1006_Get(GPS_PCourse* crs, UC* p); void GPS_D1006_Get(GPS_PCourse* crs, UC* p);
void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len); void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len);
skipping to change at line 119 skipping to change at line 114
Capability A907: D907 D908 D909 D910 Capability A907: D907 D908 D909 D910
Capability A918: D918 Capability A918: D918
Capability A1013: D1014 Capability A1013: D1014
*/ */
const char* Get_Pkt_Type(US p, US d0, const char** xinfo); const char* Get_Pkt_Type(US p, US d0, const char** xinfo);
void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n); void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 6 change blocks. 
10 lines changed or deleted 5 lines changed or added


 gpscom.h   gpscom.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpscom_h #ifndef gpscom_h
#define gpscom_h #define gpscom_h
#include "gps.h" #include "gps.h"
#include <time.h> #include <time.h>
int32 GPS_Command_Off(const char* port); int32 GPS_Command_Off(const char* port);
time_t GPS_Command_Get_Time(const char* port); time_t GPS_Command_Get_Time(const char* port);
int32 GPS_Command_Send_Time(const char* port, time_t Time); int32 GPS_Command_Send_Time(const char* port, time_t Time);
skipping to change at line 52 skipping to change at line 47
GPS_PTrack* trk, GPS_PCourse_Point* cpt, GPS_PTrack* trk, GPS_PCourse_Point* cpt,
int32 n_crs, int32 n_clp, int32 n_trk, int 32 n_cpt); int32 n_crs, int32 n_clp, int32 n_trk, int 32 n_cpt);
int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk , int32 n_trk, int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk , int32 n_trk,
GPS_PWay* wpt, int32 n_wpt, int e raset); GPS_PWay* wpt, int32 n_wpt, int e raset);
int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(in t, struct GPS_SWay**)); int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(in t, struct GPS_SWay**));
int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)); int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**));
int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int ( *cb)(int, struct GPS_SWay**)); int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int ( *cb)(int, struct GPS_SWay**));
int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (* cb)(int, struct GPS_SWay**)); int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (* cb)(int, struct GPS_SWay**));
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsdatum.h   gpsdatum.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsdatum_h #ifndef gpsdatum_h
#define gpsdatum_h #define gpsdatum_h
typedef struct GPS_SEllipse { typedef struct GPS_SEllipse {
char* name; const char* name;
double a; double a;
double invf; double invf;
} GPS_OEllipse, *GPS_PEllipse; } GPS_OEllipse, *GPS_PEllipse;
GPS_OEllipse GPS_Ellipse[]= { GPS_OEllipse GPS_Ellipse[]= {
{ "Airy 1830", 6377563.396, 299.3249646 }, { "Airy 1830", 6377563.396, 299.3249646 },
{ "Airy 1830 Modified", 6377340.189, 299.3249646 }, { "Airy 1830 Modified", 6377340.189, 299.3249646 },
{ "Australian National", 6378160.000, 298.25 }, { "Australian National", 6378160.000, 298.25 },
{ "Bessel 1841 (Namibia)", 6377483.865, 299.1528128 }, { "Bessel 1841 (Namibia)", 6377483.865, 299.1528128 },
{ "Bessel 1841", 6377397.155, 299.1528128 }, { "Bessel 1841", 6377397.155, 299.1528128 },
skipping to change at line 47 skipping to change at line 42
{ "GRS80", 6378137.000, 298.257222101 }, { "GRS80", 6378137.000, 298.257222101 },
{ "S. American 1969", 6378160.000, 298.25 }, { "S. American 1969", 6378160.000, 298.25 },
{ "WGS60", 6378165.000, 298.3 }, { "WGS60", 6378165.000, 298.3 },
{ "WGS66", 6378145.000, 298.25 }, { "WGS66", 6378145.000, 298.25 },
{ "WGS72", 6378135.000, 298.26 }, { "WGS72", 6378135.000, 298.26 },
{ "WGS84", 6378137.000, 298.257223563 }, { "WGS84", 6378137.000, 298.257223563 },
{ "Clarke 1880 (Benoit)", 6378300.789, 293.466 }, { "Clarke 1880 (Benoit)", 6378300.789, 293.466 },
}; };
typedef struct GPS_SDatum { typedef struct GPS_SDatum {
char* name; const char* name;
int ellipse; int ellipse;
double dx; double dx;
double dy; double dy;
double dz; double dz;
} GPS_ODatum, *GPS_PDatum; } GPS_ODatum, *GPS_PDatum;
GPS_ODatum GPS_Datum[]= { GPS_ODatum GPS_Datum[]= {
/* 000 */ { "Adindan", 6, -166, -15, 204 }, /* 000 */ { "Adindan", 6, -166, -15, 204 },
/* 001 */ { "AFG", 18, -43, -163, 45 }, /* 001 */ { "AFG", 18, -43, -163, 45 },
/* 002 */ { "Ain-El-Abd", 17, -150, -251, -2 }, /* 002 */ { "Ain-El-Abd", 17, -150, -251, -2 },
skipping to change at line 185 skipping to change at line 180
/* 120 */ { "Zanderij", 17, -265, 120, -358 }, /* 120 */ { "Zanderij", 17, -265, 120, -358 },
/* 121 */ { "Sweden", 4, 424.3, -80.5, 613.1 }, /* 121 */ { "Sweden", 4, 424.3, -80.5, 613.1 },
/* 122 */ { "GDA 94", 21, 0, 0, 0 }, /* 122 */ { "GDA 94", 21, 0, 0, 0 },
/* 123 */ { "CH-1903", 4, 674, 15, 405 }, /* 123 */ { "CH-1903", 4, 674, 15, 405 },
/* 124 */ { "Palestine 1923", 27, -235, -85, 264 }, /* 124 */ { "Palestine 1923", 27, -235, -85, 264 },
/* 125 */ { "ITM (Israeli New)", 21, -48, 55, -52 }, /* 125 */ { "ITM (Israeli New)", 21, -48, 55, -52 },
{ NULL, 0, 0, 0, 0 } { NULL, 0, 0, 0, 0 }
}; };
typedef struct GPS_SDatum_Alias { typedef struct GPS_SDatum_Alias {
char* alias; const char* alias;
const int datum; const int datum;
} GPS_ODatum_Alias, *GPS_PDatum_Alias; } GPS_ODatum_Alias, *GPS_PDatum_Alias;
GPS_ODatum_Alias GPS_DatumAlias[] = { GPS_ODatum_Alias GPS_DatumAlias[] = {
{ "Australian GDA94", 122 }, { "Australian GDA94", 122 },
{ "Australian Geocentric 1994 (GDA94)", 122}, /* Observed in Ozi */ { "Australian Geocentric 1994 (GDA94)", 122}, /* Observed in Ozi */
{ "GDA94", 122 }, { "GDA94", 122 },
{ "GDA-94", 122 }, { "GDA-94", 122 },
{ "CH1903", 123 }, { "CH1903", 123 },
{ "CH 1903", 123 }, { "CH 1903", 123 },
skipping to change at line 224 skipping to change at line 219
{ "WGS72", 117 }, { "WGS72", 117 },
{ "WGS-72", 117 }, { "WGS-72", 117 },
{ "WGS84", 118 }, { "WGS84", 118 },
{ "WGS-84", 118 }, { "WGS-84", 118 },
{ "Israeli", 124 }, { "Israeli", 124 },
{ "D_Israel_new", 125 }, { "D_Israel_new", 125 },
{ NULL, -1 } { NULL, -1 }
}; };
/* UK Ordnance Survey Nation Grid Map Codes */ /* UK Ordnance Survey Nation Grid Map Codes */
static char* UKNG[]= { static const char* UKNG[]= {
"SV","SW","SX","SY","SZ","TV","TW","SQ","SR","SS","ST","SU","TQ","TR", "SV","SW","SX","SY","SZ","TV","TW","SQ","SR","SS","ST","SU","TQ","TR",
"SL","SM","SN","SO","SP","TL","TM","SF","SG","SH","SJ","SK","TF","TG", "SL","SM","SN","SO","SP","TL","TM","SF","SG","SH","SJ","SK","TF","TG",
"SA","SB","SC","SD","SE","TA","TB","NV","NW","NX","NY","NZ","OV","OW", "SA","SB","SC","SD","SE","TA","TB","NV","NW","NX","NY","NZ","OV","OW",
"NQ","NR","NS","NT","NU","OQ","OR","NL","NM","NN","NO","NP","OL","OM", "NQ","NR","NS","NT","NU","OQ","OR","NL","NM","NN","NO","NP","OL","OM",
"NF","NG","NH","NJ","NK","OF","OG","NA","NB","NC","ND","NE","OA","OB", "NF","NG","NH","NJ","NK","OF","OG","NA","NB","NC","ND","NE","OA","OB",
"HV","HW","HX","HY","HZ","JV","JW","HQ","HR","HS","HT","HU","JQ","JR", "HV","HW","HX","HY","HZ","JV","JW","HQ","HR","HS","HT","HU","JQ","JR",
"HL","HM","HN","HO","HP","JL","JM","" "HL","HM","HN","HO","HP","JL","JM",""
}; };
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 6 change blocks. 
9 lines changed or deleted 4 lines changed or added


 gpsdevice.h   gpsdevice.h 
skipping to change at line 22 skipping to change at line 22
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsdevice_h #ifndef gpsdevice_h
#define gpsdevice_h #define gpsdevice_h
typedef struct gpsdevh gpsdevh; typedef struct gpsdevh gpsdevh;
#include "gps.h" #include "gps.h"
#define usecDELAY 180000 /* Microseconds before GPS sends A001 */ #define usecDELAY 180000 /* Microseconds before GPS sends A001 */
int32 GPS_Device_Chars_Ready(gpsdevh* fd); int32 GPS_Device_Chars_Ready(gpsdevh* fd);
int32 GPS_Device_On(const char* port, gpsdevh** fd); int32 GPS_Device_On(const char* port, gpsdevh** fd);
int32 GPS_Device_Off(gpsdevh* fd); int32 GPS_Device_Off(gpsdevh* fd);
int32 GPS_Device_Wait(gpsdevh* fd); int32 GPS_Device_Wait(gpsdevh* fd);
int32 GPS_Device_Flush(gpsdevh* fd); int32 GPS_Device_Flush(gpsdevh* fd);
int32 GPS_Device_Read(int32 ignored, void* ibuf, int size); int32 GPS_Device_Read(int32 ignored, void* ibuf, int size);
int32 GPS_Device_Write(int32 ignored, const void* obuf, int size); int32 GPS_Device_Write(int32 ignored, const void* obuf, int size);
void GPS_Device_Error(char* hdr, ...); void GPS_Device_Error(char* hdr, ...);
int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket packet); int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket& packet);
int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet); int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet);
int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
typedef int32(*gps_device_op)(gpsdevh*); typedef int32(*gps_device_op)(gpsdevh*);
typedef int32(*gps_device_op5)(const char*, gpsdevh** fd); typedef int32(*gps_device_op5)(const char*, gpsdevh** fd);
typedef int32(*gps_device_op10)(gpsdevh* fd, GPS_PPacket* tra, GPS_PPack et* rec); typedef int32(*gps_device_op10)(gpsdevh* fd, GPS_PPacket* tra, GPS_PPack et* rec);
typedef int32(*gps_device_op12)(gpsdevh* fd, GPS_PPacket packet); typedef int32(*gps_device_op12)(gpsdevh* fd, GPS_PPacket& packet);
typedef int32(*gps_device_op13)(gpsdevh* fd, GPS_PPacket* packet); typedef int32(*gps_device_op13)(gpsdevh* fd, GPS_PPacket* packet);
typedef struct { typedef struct {
gps_device_op5 Device_On; gps_device_op5 Device_On;
gps_device_op Device_Off; gps_device_op Device_Off;
gps_device_op Device_Chars_Ready; gps_device_op Device_Chars_Ready;
gps_device_op Device_Wait; gps_device_op Device_Wait;
gps_device_op Device_Flush; gps_device_op Device_Flush;
gps_device_op10 Send_Ack; gps_device_op10 Send_Ack;
gps_device_op10 Get_Ack; gps_device_op10 Get_Ack;
gps_device_op13 Read_Packet; gps_device_op13 Read_Packet;
gps_device_op12 Write_Packet; gps_device_op12 Write_Packet;
} gps_device_ops; } gps_device_ops;
#endif /* gpsdevice.h */ #endif /* gpsdevice.h */
#ifdef __cplusplus
}
#endif
 End of changes. 4 change blocks. 
7 lines changed or deleted 2 lines changed or added


 gpsfmt.h   gpsfmt.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsfmt_h #ifndef gpsfmt_h
#define gpsfmt_h #define gpsfmt_h
#include "gps.h" #include "gps.h"
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
void GPS_Fmt_Print_Time(time_t Time, FILE* outf); void GPS_Fmt_Print_Time(time_t Time, FILE* outf);
void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf); void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf);
void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf); void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf);
void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf); void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf);
void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf); void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf);
int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf); int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf);
int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf); int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf);
int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf); int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsinput.h   gpsinput.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsinput_h #ifndef gpsinput_h
#define gpsinput_h #define gpsinput_h
#include "gps.h" #include "gps.h"
int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf); int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf);
int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf); int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf);
int32 GPS_Input_Get_Proximity(GPS_PWay** way, FILE* inf); int32 GPS_Input_Get_Proximity(GPS_PWay** way, FILE* inf);
int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf); int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf);
int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf); int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsmath.h   gpsmath.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsmath_h #ifndef gpsmath_h
#define gpsmath_h #define gpsmath_h
#include "gps.h" #include "gpsport.h"
#define GPS_PI 3.141592653589 #define GPS_PI 3.141592653589
#define GPS_FLTMIN 1.75494351E-38 #define GPS_FLTMIN 1.75494351E-38
#define GPS_FLTMAX 3.402823466E+38 #define GPS_FLTMAX 3.402823466E+38
double GPS_Math_Deg_To_Rad(double v); double GPS_Math_Deg_To_Rad(double v);
double GPS_Math_Rad_To_Deg(double v); double GPS_Math_Rad_To_Deg(double v);
double GPS_Math_Metres_To_Feet(double v); double GPS_Math_Metres_To_Feet(double v);
double GPS_Math_Feet_To_Metres(double v); double GPS_Math_Feet_To_Metres(double v);
skipping to change at line 139 skipping to change at line 134
int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double* E, do uble* N); int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double* E, do uble* N);
void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon); void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon);
void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid, void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid,
const double UTMNorthing, const double UTM Easting, const double UTMNorthing, const double UTM Easting,
double* Lat, double* Lon, double* Lat, double* Lon,
const double lambda0, const double E0, con st double N0); const double lambda0, const double E0, con st double N0);
int32 GPS_Lookup_Datum_Index(const char* n); int32 GPS_Lookup_Datum_Index(const char* n);
char* GPS_Math_Get_Datum_Name(const int datum_index); const char* GPS_Math_Get_Datum_Name(const int datum_index);
#endif
#ifdef __cplusplus
}
#endif #endif
 End of changes. 4 change blocks. 
11 lines changed or deleted 2 lines changed or added


 gpsmem.h   gpsmem.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsmem_h #ifndef gpsmem_h
#define gpsmem_h #define gpsmem_h
#include "gps.h" #include "gps.h"
GPS_PPacket GPS_Packet_New(void);
void GPS_Packet_Del(GPS_PPacket* thys);
GPS_PPvt_Data GPS_Pvt_New(void); GPS_PPvt_Data GPS_Pvt_New(void);
void GPS_Pvt_Del(GPS_PPvt_Data* thys); void GPS_Pvt_Del(GPS_PPvt_Data* thys);
GPS_PAlmanac GPS_Almanac_New(void); GPS_PAlmanac GPS_Almanac_New(void);
void GPS_Almanac_Del(GPS_PAlmanac* thys); void GPS_Almanac_Del(GPS_PAlmanac* thys);
GPS_PTrack GPS_Track_New(void); GPS_PTrack GPS_Track_New(void);
void GPS_Track_Del(GPS_PTrack* thys); void GPS_Track_Del(GPS_PTrack* thys);
GPS_PWay GPS_Way_New(void); GPS_PWay GPS_Way_New(void);
void GPS_Way_Del(GPS_PWay* thys); void GPS_Way_Del(GPS_PWay* thys);
GPS_PLap GPS_Lap_New(void); GPS_PLap GPS_Lap_New(void);
void GPS_Lap_Del(GPS_PLap* thys); void GPS_Lap_Del(GPS_PLap* thys);
GPS_PCourse GPS_Course_New(void); GPS_PCourse GPS_Course_New(void);
void GPS_Course_Del(GPS_PCourse* thys); void GPS_Course_Del(GPS_PCourse* thys);
GPS_PCourse_Lap GPS_Course_Lap_New(void); GPS_PCourse_Lap GPS_Course_Lap_New(void);
void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys); void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys);
GPS_PCourse_Point GPS_Course_Point_New(void); GPS_PCourse_Point GPS_Course_Point_New(void);
void GPS_Course_Point_Del(GPS_PCourse_Point* thys); void GPS_Course_Point_Del(GPS_PCourse_Point* thys);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 3 change blocks. 
8 lines changed or deleted 0 lines changed or added


 gpsport.h   gpsport.h 
/* /*
* For portability any '32' type must be 32 bits * For portability any '32' type must be 32 bits
* and '16' type must be 16 bits * and '16' type must be 16 bits
*/ */
/* Since GPSBabel already has an integer size abstraction layer and /* Since GPSBabel already has an integer size abstraction layer and
* defs.h includes gbtypes.h before this file, just use that. * defs.h includes gbtypes.h before this file, just use that.
*/ */
typedef unsigned char UC; typedef unsigned char UC;
typedef gbuint16 US; typedef uint16_t US;
typedef gbuint16 uint16; typedef uint16_t uint16;
typedef gbint16 int16; typedef int16_t int16;
typedef gbuint32 uint32; typedef uint32_t uint32;
typedef gbint32 int32; typedef int32_t int32;
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 gpsproj.h   gpsproj.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsproj_h #ifndef gpsproj_h
#define gpsproj_h #define gpsproj_h
#include "gps.h" #include "gps.h"
void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E, void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E,
double* N, double phi1, double phi2, double* N, double phi1, double phi2,
double phi0, double M0, double E0, double phi0, double M0, double E0,
double N0, double a, double b); double N0, double a, double b);
void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi, void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi,
skipping to change at line 152 skipping to change at line 147
double a, double b); double a, double b);
void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E,
double* N,double phi0,double lambda0, double* N,double phi0,double lambda0,
double E0, double N0, double a, double b ); double E0, double N0, double a, double b );
void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi, void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi,
double* lambda, double phi0, double lamb da0, double* lambda, double phi0, double lamb da0,
double E0, double N0, double a, double b ); double E0, double N0, double a, double b );
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsprot.h   gpsprot.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsprotocols_h #ifndef gpsprotocols_h
#define gpsprotocols_h #define gpsprotocols_h
#ifndef COMMON #ifndef COMMON
#define COMMON extern #define COMMON extern
#endif #endif
#include "gps.h" #include "gps.h"
/* /*
skipping to change at line 359 skipping to change at line 354
int32 almd; int32 almd;
} }
; ;
US GPS_Protocol_Version_Change(US id, US version); US GPS_Protocol_Version_Change(US id, US version);
COMMON int32 GPS_Protocol_Table_Set(US id); COMMON int32 GPS_Protocol_Table_Set(US id);
void GPS_Protocol_Error(US tag, US data); void GPS_Protocol_Error(US tag, US data);
void GPS_Unknown_Protocol_Print(void); void GPS_Unknown_Protocol_Print(void);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsread.h   gpsread.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsread_h #ifndef gpsread_h
#define gpsread_h #define gpsread_h
#include "gps.h" #include "gps.h"
time_t GPS_Time_Now(void); time_t GPS_Time_Now(void);
int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet); int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet);
int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec ); int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec );
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpsrqst.h   gpsrqst.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsrqst_h #ifndef gpsrqst_h
#define gpsrqst_h #define gpsrqst_h
#include "gps.h" #include "gps.h"
int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time); int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time);
int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon); int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 0 lines changed or added


 gpssend.h   gpssend.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpssend_h #ifndef gpssend_h
#define gpssend_h #define gpssend_h
#include "gps.h" #include "gps.h"
#define GPS_ARB_LEN 1024 #define GPS_ARB_LEN 1024
int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet); int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket& packet);
int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* re c); int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* re c);
void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n); void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 3 change blocks. 
6 lines changed or deleted 1 lines changed or added


 gpsserial.h   gpsserial.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsserial_h #ifndef gpsserial_h
#define gpsserial_h #define gpsserial_h
#include "gps.h" #include "gps.h"
#define usecDELAY 180000 /* Microseconds before GPS sends A001 */ #define usecDELAY 180000 /* Microseconds before GPS sends A001 */
int32 GPS_Serial_Chars_Ready(gpsdevh* fd); int32 GPS_Serial_Chars_Ready(gpsdevh* fd);
// int32 GPS_Serial_Close(int32 fd, const char *port); // int32 GPS_Serial_Close(int32 fd, const char *port);
// int32 GPS_Serial_Open(int32 *fd, const char *port); // int32 GPS_Serial_Open(int32 *fd, const char *port);
// int32 GPS_Serial_Open_NMEA(int32 *fd, const char *port); // int32 GPS_Serial_Open_NMEA(int32 *fd, const char *port);
// int32 GPS_Serial_Restoretty(const char *port); // int32 GPS_Serial_Restoretty(const char *port);
// int32 GPS_Serial_Savetty(const char *port); // int32 GPS_Serial_Savetty(const char *port);
int32 GPS_Serial_On(const char* port, gpsdevh** fd); int32 GPS_Serial_On(const char* port, gpsdevh** fd);
int32 GPS_Serial_Off(gpsdevh* fd); int32 GPS_Serial_Off(gpsdevh* fd);
int32 GPS_Serial_Wait(gpsdevh* fd); int32 GPS_Serial_Wait(gpsdevh* fd);
int32 GPS_Serial_Flush(gpsdevh* fd); int32 GPS_Serial_Flush(gpsdevh* fd);
// int32 GPS_Serial_On_NMEA(const char *port, gpsdevh **fd); // int32 GPS_Serial_On_NMEA(const char *port, gpsdevh **fd);
int32 GPS_Serial_Read(gpsdevh* fd, void* ibuf, int size); int32 GPS_Serial_Read(gpsdevh* fd, void* ibuf, int size);
int32 GPS_Serial_Write(gpsdevh* fd, const void* obuf, int size); int32 GPS_Serial_Write(gpsdevh* fd, const void* obuf, int size);
int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet); int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket& packet);
int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* re c); int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* re c);
void GPS_Serial_Error(const char* hdr, ...); void GPS_Serial_Error(const char* hdr, ...);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 3 change blocks. 
6 lines changed or deleted 1 lines changed or added


 gpsusbint.h   gpsusbint.h 
skipping to change at line 26 skipping to change at line 26
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
int32 GPS_Packet_Read_usb(gpsdevh* fd, GPS_PPacket* packet, int eatbulk); int32 GPS_Packet_Read_usb(gpsdevh* fd, GPS_PPacket* packet, int eatbulk);
void GPS_Make_Packet_usb(GPS_PPacket* packet, UC type, UC* data, int16 n); void GPS_Make_Packet_usb(GPS_PPacket* packet, UC type, UC* data, int16 n);
int32 GPS_Write_Packet_usb(gpsdevh* fd, GPS_PPacket packet); int32 GPS_Write_Packet_usb(gpsdevh* fd, GPS_PPacket& packet);
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 gpsutil.h   gpsutil.h 
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef gpsutil_h #ifndef gpsutil_h
#define gpsutil_h #define gpsutil_h
#include "gps.h" #include "gps.h"
int32 GPS_Util_Little(void); int32 GPS_Util_Little(void);
US GPS_Util_Get_Short(const UC* s); US GPS_Util_Get_Short(const UC* s);
void GPS_Util_Put_Short(UC* s, const US v); void GPS_Util_Put_Short(UC* s, const US v);
int32 GPS_Util_Get_Int(const UC* s); int32 GPS_Util_Get_Int(const UC* s);
void GPS_Util_Put_Int(UC* s, const int32 v); void GPS_Util_Put_Int(UC* s, const int32 v);
double GPS_Util_Get_Double(const UC* s); double GPS_Util_Get_Double(const UC* s);
void GPS_Util_Put_Double(UC* s, const double v); void GPS_Util_Put_Double(UC* s, const double v);
float GPS_Util_Get_Float(const UC* s); float GPS_Util_Get_Float(const UC* s);
void GPS_Util_Put_Float(UC* s, const float v); void GPS_Util_Put_Float(UC* s, const float v);
void GPS_Util_Canon(int32 state); void GPS_Util_Canon(int32 state);
int32 GPS_Util_Block(int32 fd, int32 state); int32 GPS_Util_Block(int32 fd, int32 state);
void GPS_Util_Put_Uint(UC* s, const uint32 v); void GPS_Util_Put_Uint(UC* s, const uint32 v);
uint32 GPS_Util_Get_Uint(const UC* s); uint32 GPS_Util_Get_Uint(const UC* s);
void GPS_Warning(char* s); void GPS_Warning(const char* s);
void GPS_Error(char* fmt, ...); void GPS_Error(const char* fmt, ...);
void GPS_Serial_Error(const char* hdr, ...); void GPS_Serial_Error(const char* hdr, ...);
void GPS_Fatal(char* s); void GPS_Fatal(const char* s);
void GPS_Enable_Error(void); void GPS_Enable_Error(void);
void GPS_Enable_Warning(void); void GPS_Enable_Warning(void);
void GPS_Disable_Error(void); void GPS_Disable_Error(void);
void GPS_Disable_Warning(void); void GPS_Disable_Warning(void);
void GPS_User(const char* fmt, ...); void GPS_User(const char* fmt, ...);
void GPS_Disable_User(void); void GPS_Disable_User(void);
void GPS_Enable_User(void); void GPS_Enable_User(void);
void GPS_Diagnose(int32 c); void GPS_Diagnose(int32 c);
void GPS_Diag(const char* fmt, ...); void GPS_Diag(const char* fmt, ...);
void GPS_Enable_Diagnose(void); void GPS_Enable_Diagnose(void);
void GPS_Disable_Diagnose(void); void GPS_Disable_Diagnose(void);
#endif #endif
#ifdef __cplusplus
}
#endif
 End of changes. 4 change blocks. 
8 lines changed or deleted 3 lines changed or added


 gpx.h   gpx.h 
skipping to change at line 263 skipping to change at line 263
QString description; QString description;
QList <GpxTrackSegment> trackSegments; QList <GpxTrackSegment> trackSegments;
double cachedLength; double cachedLength;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class GpxWaypoint: public GpxItem class GpxWaypoint: public GpxItem
{ {
public: public:
GpxWaypoint(): GpxItem(), GpxWaypoint(): GpxItem(),
location(LatLng(0, 0)), location_(LatLng(0, 0)),
elevation (-1.0E-100), elevation_ (-1.0E-100),
name(QString()), name_(QString()),
comment(QString()), comment_(QString()),
description(QString()), description_(QString()),
symbol(QString()) symbol_(QString())
{}; {};
void setLocation(const LatLng& pt) { location = pt; }; void setLocation(const LatLng& pt) { location_ = pt; };
LatLng getLocation() const { return location; }; LatLng getLocation() const { return location_; };
void setElevation(double e) { elevation = e; }; void setElevation(double e) { elevation_ = e; };
double getElevation () const { return elevation; }; double getElevation () const { return elevation_; };
void setName(const QString &s) { name = s; }; void setName(const QString &s) { name_ = s; };
QString getName() const { return name; }; QString getName() const { return name_; };
void setComment(const QString &s) { comment = s; }; void setComment(const QString &s) { comment_ = s; };
QString getComment() const { return comment; }; QString getComment() const { return comment_; };
void setDescription(const QString &s) { description = s; }; void setDescription(const QString &s) { description_ = s; };
QString getDescription() const { return description; }; QString getDescription() const { return description_; };
void setSymbol(const QString &s) { symbol = s; }; void setSymbol(const QString &s) { symbol_ = s; };
QString getSymbol() const { return symbol; }; QString getSymbol() const { return symbol_; };
private: private:
LatLng location; LatLng location_;
double elevation; double elevation_;
QString name; QString name_;
QString comment; QString comment_;
QString description; QString description_;
QString symbol; QString symbol_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class Gpx { class Gpx {
public: public:
Gpx() {}; Gpx() {};
bool read(const QString & fileName); bool read(const QString & fileName);
QList <GpxWaypoint> &getWaypoints() { return wayPoints; }; // nonconst QList <GpxWaypoint> &getWaypoints() { return wayPoints; }; // nonconst
QList <GpxTrack> &getTracks() { return tracks; }; QList <GpxTrack> &getTracks() { return tracks; };
 End of changes. 8 change blocks. 
24 lines changed or deleted 24 lines changed or added


 grtcirc.h   grtcirc.h 
/* /*
Great Circle utility functions Great Circle utility functions
Copyright (C) 2002 Robert Lipe, robertlipe@usa.net Copyright (C) 2002-2014 Robert Lipe, robertlipe+source@gpsbabel.org
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 33 skipping to change at line 33
#define GRTCIRC_H #define GRTCIRC_H
double gcdist(double lat1, double lon1, double lat2, double lon2); double gcdist(double lat1, double lon1, double lat2, double lon2);
double heading(double lat1, double lon1, double lat2, double lon2); double heading(double lat1, double lon1, double lat2, double lon2);
double heading_true_degrees(double lat1, double lon1, double lat2, double l on2); double heading_true_degrees(double lat1, double lon1, double lat2, double l on2);
double linedistprj(double lat1, double lon1, double linedistprj(double lat1, double lon1,
double lat2, double lon2, double lat2, double lon2,
double lat3, double lon3, double lat3, double lon3,
double* prjlat, double* prjlon, double* prjlat, double* prjlon,
double* frac ); double* frac);
double linedist(double lat1, double lon1, double linedist(double lat1, double lon1,
double lat2, double lon2, double lat2, double lon2,
double lat3, double lon3); double lat3, double lon3);
double radtometers(double rads); double radtometers(double rads);
double radtomiles(double rads); double radtomiles(double rads);
void linepart(double lat1, double lon1, void linepart(double lat1, double lon1,
double lat2, double lon2, double lat2, double lon2,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 inffast.h   inffast.h 
/* inffast.h -- header to use inffast.c /* inffast.h -- header to use inffast.c
* Copyright (C) 1995-2003 Mark Adler * Copyright (C) 1995-2003, 2010 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
void inflate_fast OF((z_streamp strm, unsigned start)); void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added


 inffixed.h   inffixed.h 
/* inffixed.h -- table for decoding fixed codes /* inffixed.h -- table for decoding fixed codes
* Generated automatically by makefixed(). * Generated automatically by makefixed().
*/ */
/* WARNING: this file should *not* be used by applications. It /* WARNING: this file should *not* be used by applications.
is part of the implementation of the compression library and It is part of the implementation of this library and is
is subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
static const code lenfix[512] = { static const code lenfix[512] = {
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176} , {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176} ,
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,10 0}, {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,10 0},
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
 End of changes. 1 change blocks. 
3 lines changed or deleted 3 lines changed or added


 inflate.h   inflate.h 
/* inflate.h -- internal inflate state definition /* inflate.h -- internal inflate state definition
* Copyright (C) 1995-2004 Mark Adler * Copyright (C) 1995-2009 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* define NO_GZIP when compiling if you want to disable gzip header and /* define NO_GZIP when compiling if you want to disable gzip header and
trailer decoding by inflate(). NO_GZIP would be used to avoid linking i n trailer decoding by inflate(). NO_GZIP would be used to avoid linking i n
skipping to change at line 35 skipping to change at line 35
EXLEN, /* i: waiting for extra length (gzip) */ EXLEN, /* i: waiting for extra length (gzip) */
EXTRA, /* i: waiting for extra bytes (gzip) */ EXTRA, /* i: waiting for extra bytes (gzip) */
NAME, /* i: waiting for end of file name (gzip) */ NAME, /* i: waiting for end of file name (gzip) */
COMMENT, /* i: waiting for end of comment (gzip) */ COMMENT, /* i: waiting for end of comment (gzip) */
HCRC, /* i: waiting for header crc (gzip) */ HCRC, /* i: waiting for header crc (gzip) */
DICTID, /* i: waiting for dictionary check value */ DICTID, /* i: waiting for dictionary check value */
DICT, /* waiting for inflateSetDictionary() call */ DICT, /* waiting for inflateSetDictionary() call */
TYPE, /* i: waiting for type bits, including last-flag bit */ TYPE, /* i: waiting for type bits, including last-flag bit */
TYPEDO, /* i: same, but skip check to exit inflate on new block */ TYPEDO, /* i: same, but skip check to exit inflate on new block */
STORED, /* i: waiting for stored size (length and complement) * / STORED, /* i: waiting for stored size (length and complement) * /
COPY_, /* i/o: same as COPY below, but only first time in */
COPY, /* i/o: waiting for input or output to copy stored bloc k */ COPY, /* i/o: waiting for input or output to copy stored bloc k */
TABLE, /* i: waiting for dynamic block table lengths */ TABLE, /* i: waiting for dynamic block table lengths */
LENLENS, /* i: waiting for code length code lengths */ LENLENS, /* i: waiting for code length code lengths */
CODELENS, /* i: waiting for length/lit and distance code lengths */ CODELENS, /* i: waiting for length/lit and distance code lengths */
LEN, /* i: waiting for length/lit code */ LEN_, /* i: same as LEN below, but only first time in */
LEN, /* i: waiting for length/lit/eob code */
LENEXT, /* i: waiting for length extra bits */ LENEXT, /* i: waiting for length extra bits */
DIST, /* i: waiting for distance code */ DIST, /* i: waiting for distance code */
DISTEXT, /* i: waiting for distance extra bits */ DISTEXT, /* i: waiting for distance extra bits */
MATCH, /* o: waiting for output space to copy string */ MATCH, /* o: waiting for output space to copy string */
LIT, /* o: waiting for output space to write literal */ LIT, /* o: waiting for output space to write literal */
CHECK, /* i: waiting for 32-bit check value */ CHECK, /* i: waiting for 32-bit check value */
LENGTH, /* i: waiting for 32-bit length (gzip) */ LENGTH, /* i: waiting for 32-bit length (gzip) */
DONE, /* finished check, done -- remain here until reset */ DONE, /* finished check, done -- remain here until reset */
BAD, /* got a data error -- remain here until reset */ BAD, /* got a data error -- remain here until reset */
MEM, /* got an inflate() memory error -- remain here until reset */ MEM, /* got an inflate() memory error -- remain here until reset */
SYNC /* looking for synchronization bytes to restart inflate() * / SYNC /* looking for synchronization bytes to restart inflate() * /
} inflate_mode; } inflate_mode;
/* /*
State transitions between above modes - State transitions between above modes -
(most modes can go to the BAD or MEM mode -- not shown for clarity) (most modes can go to BAD or MEM on error -- not shown for clarity)
Process header: Process header:
HEAD -> (gzip) or (zlib) HEAD -> (gzip) or (zlib) or (raw)
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT
NAME -> COMMENT -> HCRC -> TYPE ->
HCRC -> TYPE
(zlib) -> DICTID or TYPE (zlib) -> DICTID or TYPE
DICTID -> DICT -> TYPE DICTID -> DICT -> TYPE
(raw) -> TYPEDO
Read deflate blocks: Read deflate blocks:
TYPE -> STORED or TABLE or LEN or CHECK TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
STORED -> COPY -> TYPE STORED -> COPY_ -> COPY -> TYPE
TABLE -> LENLENS -> CODELENS -> LEN TABLE -> LENLENS -> CODELENS -> LEN_
Read deflate codes: LEN_ -> LEN
Read deflate codes in fixed or dynamic block:
LEN -> LENEXT or LIT or TYPE LEN -> LENEXT or LIT or TYPE
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
LIT -> LEN LIT -> LEN
Process trailer: Process trailer:
CHECK -> LENGTH -> DONE CHECK -> LENGTH -> DONE
*/ */
/* state maintained between inflate() calls. Approximately 7K bytes. */ /* state maintained between inflate() calls. Approximately 10K bytes. */
struct inflate_state { struct inflate_state {
inflate_mode mode; /* current inflate mode */ inflate_mode mode; /* current inflate mode */
int last; /* true if processing last block */ int last; /* true if processing last block */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
int havedict; /* true if dictionary provided */ int havedict; /* true if dictionary provided */
int flags; /* gzip header method and flags (0 if zlib) */ int flags; /* gzip header method and flags (0 if zlib) */
unsigned dmax; /* zlib header max distance (INFLATE_STRICT ) */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT ) */
unsigned long check; /* protected copy of check value */ unsigned long check; /* protected copy of check value */
unsigned long total; /* protected copy of output count */ unsigned long total; /* protected copy of output count */
gz_headerp head; /* where to save gzip header information */ gz_headerp head; /* where to save gzip header information */
/* sliding window */ /* sliding window */
unsigned wbits; /* log base 2 of requested window size */ unsigned wbits; /* log base 2 of requested window size */
unsigned wsize; /* window size or zero if not using window */ unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */ unsigned whave; /* valid bytes in the window */
unsigned write; /* window write index */ unsigned wnext; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if needed */ unsigned char FAR *window; /* allocated sliding window, if needed */
/* bit accumulator */ /* bit accumulator */
unsigned long hold; /* input bit accumulator */ unsigned long hold; /* input bit accumulator */
unsigned bits; /* number of bits in "in" */ unsigned bits; /* number of bits in "in" */
/* for string and stored block copying */ /* for string and stored block copying */
unsigned length; /* literal or length of data to copy */ unsigned length; /* literal or length of data to copy */
unsigned offset; /* distance back to copy string from */ unsigned offset; /* distance back to copy string from */
/* for table and code decoding */ /* for table and code decoding */
unsigned extra; /* extra bits needed */ unsigned extra; /* extra bits needed */
/* fixed and dynamic code tables */ /* fixed and dynamic code tables */
skipping to change at line 115 skipping to change at line 119
unsigned distbits; /* index bits for distcode */ unsigned distbits; /* index bits for distcode */
/* dynamic table building */ /* dynamic table building */
unsigned ncode; /* number of code length code lengths */ unsigned ncode; /* number of code length code lengths */
unsigned nlen; /* number of length code lengths */ unsigned nlen; /* number of length code lengths */
unsigned ndist; /* number of distance code lengths */ unsigned ndist; /* number of distance code lengths */
unsigned have; /* number of code lengths in lens[] */ unsigned have; /* number of code lengths in lens[] */
code FAR *next; /* next available space in codes[] */ code FAR *next; /* next available space in codes[] */
unsigned short lens[320]; /* temporary storage for code lengths */ unsigned short lens[320]; /* temporary storage for code lengths */
unsigned short work[288]; /* work area for code table building */ unsigned short work[288]; /* work area for code table building */
code codes[ENOUGH]; /* space for code tables */ code codes[ENOUGH]; /* space for code tables */
int sane; /* if false, allow invalid distance too far
*/
int back; /* bits back of last unprocessed length/lit
*/
unsigned was; /* initial length of match */
}; };
 End of changes. 10 change blocks. 
12 lines changed or deleted 22 lines changed or added


 inftrees.h   inftrees.h 
/* inftrees.h -- header to use inftrees.c /* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2005, 2010 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* Structure for decoding tables. Each entry provides either the /* Structure for decoding tables. Each entry provides either the
information needed to do the operation requested by the code that information needed to do the operation requested by the code that
skipping to change at line 38 skipping to change at line 38
} code; } code;
/* op values as set by inflate_table(): /* op values as set by inflate_table():
00000000 - literal 00000000 - literal
0000tttt - table link, tttt != 0 is the number of table index bits 0000tttt - table link, tttt != 0 is the number of table index bits
0001eeee - length or distance, eeee is the number of extra bits 0001eeee - length or distance, eeee is the number of extra bits
01100000 - end of block 01100000 - end of block
01000000 - invalid code 01000000 - invalid code
*/ */
/* Maximum size of dynamic tree. The maximum found in a long but non- /* Maximum size of the dynamic table. The maximum number of code structure
exhaustive search was 1444 code structures (852 for length/literals s is
and 592 for distances, the latter actually the result of an 1444, which is the sum of 852 for literal/length codes and 592 for dista
exhaustive search). The true maximum is not known, but the value nce
below is more than safe. */ codes. These values were found by exhaustive searches using the program
#define ENOUGH 2048 examples/enough.c found in the zlib distribtution. The arguments to tha
#define MAXD 592 t
program are the number of symbols, the initial root table size, and the
maximum bit length of a code. "enough 286 9 15" for literal/length code
s
returns returns 852, and "enough 30 6 15" for distance codes returns 592
.
The initial root table size (9 or 6) is found in the fifth argument of t
he
inflate_table() calls in inflate.c and infback.c. If the root table siz
e is
changed, then these maximum sizes would be need to be recalculated and
updated. */
#define ENOUGH_LENS 852
#define ENOUGH_DISTS 592
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
/* Type of code to build for inftable() */ /* Type of code to build for inflate_table() */
typedef enum { typedef enum {
CODES, CODES,
LENS, LENS,
DISTS DISTS
} codetype; } codetype;
extern int inflate_table OF((codetype type, unsigned short FAR *lens, int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens ,
unsigned codes, code FAR * FAR *table, unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work)) ; unsigned FAR *bits, unsigned short FAR *work)) ;
 End of changes. 4 change blocks. 
10 lines changed or deleted 24 lines changed or added


 inifile.h   inifile.h 
skipping to change at line 29 skipping to change at line 29
*/ */
#ifndef HAVE_INIFILE_H #ifndef HAVE_INIFILE_H
#define HAVE_INIFILE_H #define HAVE_INIFILE_H
#include "defs.h" #include "defs.h"
typedef struct inifile_s { typedef struct inifile_s {
int isecs; /* number of sections */ int isecs; /* number of sections */
queue secs; /* sections */ queue secs; /* sections */
gbuint8 unicode:1; uint8_t unicode:1;
} inifile_t; } inifile_t;
/* /*
inifile_init: inifile_init:
reads inifile filename into memory reads inifile filename into memory
myname represents the calling module myname represents the calling module
*/ */
inifile_t* inifile_init(const char* filename, const char* myname); inifile_t* inifile_init(const char* filename, const char* myname);
void inifile_done(inifile_t* inifile); void inifile_done(inifile_t* inifile);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 iso_8859_1.h   iso_8859_1.h 
skipping to change at line 43 skipping to change at line 43
"Latin-1", NULL "Latin-1", NULL
}; };
#define cet_ucs4_ofs_iso_8859_1 256 #define cet_ucs4_ofs_iso_8859_1 256
#define cet_ucs4_cnt_iso_8859_1 1 #define cet_ucs4_cnt_iso_8859_1 1
const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {0}; const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {0};
#define cet_ucs4_to_iso_8859_1_ct 1 #define cet_ucs4_to_iso_8859_1_ct 1
const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_c t] = {{0}}; const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_c t] = {{0, 0}};
/* /*
#define cet_ucs4_to_iso_8859_1_extra_ct 0 #define cet_ucs4_to_iso_8859_1_extra_ct 0
const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_extra[cet_ucs4_to_iso_8859_1_e xtra_ct] = {}; const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_extra[cet_ucs4_to_iso_8859_1_e xtra_ct] = {};
*/ */
cet_cs_vec_t cet_cs_vec_iso_8859_1 = /* defined in cet.h */ cet_cs_vec_t cet_cs_vec_iso_8859_1 = /* defined in cet.h */
{ {
cet_cs_name_iso_8859_1, /* name of character set */ cet_cs_name_iso_8859_1, /* name of character set */
cet_cs_alias_iso_8859_1, /* alias table */ cet_cs_alias_iso_8859_1, /* alias table */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 magellan.h   magellan.h 
skipping to change at line 47 skipping to change at line 47
meridian_model model; meridian_model model;
int pid; int pid;
const char* model_n; const char* model_n;
} pid_to_model_t; } pid_to_model_t;
typedef struct icon_mapping { typedef struct icon_mapping {
const char* token; const char* token;
const char* icon; const char* icon;
} icon_mapping_t; } icon_mapping_t;
const char* mag_find_descr_from_token(const char* token); QString mag_find_descr_from_token(const char* token);
const char* mag_find_token_from_descr(const char* icon); QString mag_find_token_from_descr(const QString& icon);
unsigned int mag_checksum(const char* const buf); unsigned int mag_checksum(const char* const buf);
char* m330_cleanse(char* istring); QString m330_cleanse(const char* istring);
waypoint* mag_trkparse(char* trkmsg); Waypoint* mag_trkparse(char* trkmsg);
void mag_rteparse(char* rtemsg); void mag_rteparse(char* rtemsg);
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 mainwindow.h   mainwindow.h 
skipping to change at line 41 skipping to change at line 41
#include <QTranslator> #include <QTranslator>
class MainWindow: public QMainWindow { class MainWindow: public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
MainWindow(QWidget* parent); MainWindow(QWidget* parent);
~MainWindow(); ~MainWindow();
private: private:
Ui_MainWindow ui; Ui_MainWindow ui_;
QList<Format> formatList; QList<Format> formatList_;
QString babelVersion; QString babelVersion_;
bool is_beta; bool isBeta_;
QPixmap lights[4]; QPixmap lights_[4];
QStringList charSets; QStringList charSets_;
AllFiltersData filterData; AllFiltersData filterData_;
BabelData bd; BabelData babelData_;
bool fmtChgInterlock; bool fmtChgInterlock_;
QTranslator translator; // translation for the GUI. QTranslator translator_; // translation for the GUI.
QTranslator translatorCore; // translation for the core application. QTranslator translatorCore_; // translation for the core application.
QTranslator translatorQt; // translations for Qt. QTranslator translatorQt_; // translations for Qt.
QString currLang; // currently loaded language. QString currLang_; // currently loaded language.
QString langPath; // Absolute path of language files. QString langPath_; // Absolute path of language files.
private: private:
void loadFormats(); void loadFormats();
void loadLanguage(const QString& rLanguage); void loadLanguage(const QString& rLanguage);
void switchTranslator(QTranslator&, const QString&); void switchTranslator(QTranslator&, const QString&);
void createLanguageMenu(); void createLanguageMenu();
QString filterForFormat(int idx); QString filterForFormat(int idx);
QString ensureExtensionPresent(const QString &nanme, int idx); QString ensureExtensionPresent(const QString &nanme, int idx);
QString findBabelVersion(); QString findBabelVersion();
bool filterForFormatIncludes(int idx, const QString &s); bool filterForFormatIncludes(int idx, const QString &s);
 End of changes. 1 change blocks. 
14 lines changed or deleted 14 lines changed or added


 map.h   map.h 
skipping to change at line 54 skipping to change at line 54
signals: signals:
void markerClicked(int t, int i); void markerClicked(int t, int i);
void logTime(const QString &s); void logTime(const QString &s);
}; };
class Map : public QWebView class Map : public QWebView
{ {
Q_OBJECT Q_OBJECT
public: public:
Map(QWidget *parent, Map(QWidget *parent,
const Gpx &gpx, QPlainTextEdit *te); const Gpx &gpx_, QPlainTextEdit *textEdit_);
~Map(); ~Map();
public slots: public slots:
void showGpxData(); void showGpxData();
void showTracks(const QList<GpxTrack> &tracks); void showTracks(const QList<GpxTrack> &tracks);
void hideAllTracks(); void hideAllTracks();
void setTrackVisibility(int i, bool show); void setTrackVisibility(int i, bool show);
void showWaypoints(const QList<GpxWaypoint> &waypoints); void showWaypoints(const QList<GpxWaypoint> &waypoints);
skipping to change at line 88 skipping to change at line 88
void frameRoute(int i); void frameRoute(int i);
void logTimeX(const QString &); void logTimeX(const QString &);
signals: signals:
void waypointClicked(int i); void waypointClicked(int i);
void trackClicked(int i); void trackClicked(int i);
void routeClicked(int i); void routeClicked(int i);
private: private:
QNetworkAccessManager *manager; QNetworkAccessManager *manager_;
const Gpx &gpx; const Gpx &gpx_;
bool mapPresent; bool mapPresent_;
bool busyCursor; bool busyCursor_;
QTime stopWatch; QTime stopWatch_;
QPlainTextEdit *te; QPlainTextEdit *textEdit_;
void evaluateJS(const QString &s, bool update = true); void evaluateJS(const QString &s, bool update = true);
void evaluateJS(const QStringList &s, bool update = true); void evaluateJS(const QStringList &s, bool update = true);
protected: protected:
virtual void resizeEvent ( QResizeEvent * event ); virtual void resizeEvent ( QResizeEvent * event );
}; };
#endif // HEADER_H #endif // HEADER_H
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 navilink.h   navilink.h 
skipping to change at line 32 skipping to change at line 32
#ifndef gpsbabel_navilink_h_included #ifndef gpsbabel_navilink_h_included
#define gpsbabel_navilink_h_included #define gpsbabel_navilink_h_included
#include <time.h> #include <time.h>
#include "defs.h" #include "defs.h"
#define SBP_RECORD_LEN 32 #define SBP_RECORD_LEN 32
/* defined in navilink.c */ /* defined in navilink.c */
waypoint* navilink_decode_logpoint(const unsigned char* buffer); Waypoint* navilink_decode_logpoint(const unsigned char* buffer);
unsigned navilink_checksum_packet(const unsigned char* packet, unsigned len gth); unsigned navilink_checksum_packet(const unsigned char* packet, unsigned len gth);
/* defined in sbn.c */ /* defined in sbn.c */
int locosys_decode_file_id(char* header, size_t len); int locosys_decode_file_id(char* header, size_t len);
#ifdef THIS_IS_ONLY_FOR_REFERENCE #ifdef THIS_IS_ONLY_FOR_REFERENCE
/* Locosys SBP and SBN structures */ /* Locosys SBP and SBN structures */
typedef __packed struct { typedef __packed struct {
UINT8 HDOP; /* HDOP [0..51] with resolution 0.2 */ UINT8 HDOP; /* HDOP [0..51] with resolution 0.2 */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 optionsdlg.h   optionsdlg.h 
skipping to change at line 58 skipping to change at line 58
bool isInFile; bool isInFile;
private slots: private slots:
void buttonClicked(); void buttonClicked();
}; };
class OptionsDlg: public QDialog { class OptionsDlg: public QDialog {
Q_OBJECT Q_OBJECT
public: public:
OptionsDlg(QWidget *parent, const QString &fmtName, QList<FormatOption> * OptionsDlg(QWidget *parent, const QString &fmtName_, QList<FormatOption>
options, *options_,
const QString &html); const QString &html_);
private: private:
QString fmtName; QString fmtName_;
QList<FormatOption> &options; QList<FormatOption> &options_;
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox_;
QList<QCheckBox*> checkBoxes; QList<QCheckBox*> checkBoxes_;
QList<QWidget*> fields; QList<QWidget*> fields_;
QString html; QString html_;
private slots: private slots:
void acceptClicked(); void acceptClicked();
void rejectClicked(); void rejectClicked();
void helpClicked(); void helpClicked();
}; };
#endif #endif
 End of changes. 2 change blocks. 
9 lines changed or deleted 9 lines changed or added


 pdbfile.h   pdbfile.h 
skipping to change at line 32 skipping to change at line 32
*/ */
#ifndef PDBFILE_H #ifndef PDBFILE_H
#define PDBFILE_H #define PDBFILE_H
#include "defs.h" #include "defs.h"
#if PDBFMTS_ENABLED #if PDBFMTS_ENABLED
#include "gbfile.h" #include "gbfile.h"
#include "gbtypes.h"
#include <time.h> #include <time.h>
#define PDB_DBNAMELEN 32 #define PDB_DBNAMELEN 32
#define PDB_FLAG_RESOURCE 0x0001 #define PDB_FLAG_RESOURCE 0x0001
#define PDB_FLAG_BACKUP 0x0008 #define PDB_FLAG_BACKUP 0x0008
#define EPOCH_1904 2082844800L #define EPOCH_1904 2082844800L
typedef struct pdbrec_s { typedef struct pdbrec_s {
gbuint32 offs; uint32_t offs;
gbuint32 size; int32_t size;
gbuint32 id; uint32_t id;
gbuint8 category; uint8_t category;
gbuint8 flags; uint8_t flags;
char* data; char* data;
struct pdbrec_s* next; struct pdbrec_s* next;
} pdbrec_t; } pdbrec_t;
typedef struct { typedef struct {
gbfile* file; gbfile* file;
char mode; /* file-mode: 1 = read / 2 = write */ char mode; /* file-mode: 1 = read / 2 = write */
char name[PDB_DBNAMELEN + 1]; /* database name */ char name[PDB_DBNAMELEN + 1]; /* database name */
gbuint16 attr; /* attributes */ uint16_t attr; /* attributes */
gbuint16 version; /* version */ uint16_t version; /* version */
time_t ctime; /* creation time */ time_t ctime; /* creation time */
time_t mtime; /* modification time */ time_t mtime; /* modification time */
time_t btime; /* backup time */ time_t btime; /* backup time */
gbuint32 revision; uint32_t revision;
gbuint32 appinfo_offs; /* offset to application info */ int32_t appinfo_offs; /* offset to application info */
gbuint32 index_offs; /* offset to sort-index info */ int32_t index_offs; /* offset to sort-index info */
gbuint32 creator; uint32_t creator;
gbuint32 type; uint32_t type;
gbuint32 uid; uint32_t uid;
gbuint16 rec_ct; uint16_t rec_ct;
struct pdbrec_s* rec_list; struct pdbrec_s* rec_list;
struct pdbrec_s* rec_curr; struct pdbrec_s* rec_curr;
void* appinfo; void* appinfo;
int appinfo_len; int appinfo_len;
} pdbfile; } pdbfile;
pdbfile* pdb_open(const char* filename, const char* module); pdbfile* pdb_open(const char* filename, const char* module);
pdbfile* pdb_create(const char* filename, const char* module); pdbfile* pdb_create(const char* filename, const char* module);
void pdb_close(pdbfile* file); void pdb_close(pdbfile* file);
int pdb_eof(pdbfile* fin); int pdb_eof(pdbfile* fin);
void pdb_rewind(pdbfile* fin); void pdb_rewind(pdbfile* fin);
int pdb_read_rec(pdbfile* fin, gbuint8* flags, gbuint8* category, gbuint32* int pdb_read_rec(pdbfile* fin, uint8_t* flags, uint8_t* category, uint32_t*
rec_id, void** data); rec_id, void** data);
int pdb_read_rec_by_id(pdbfile* fin, const gbuint32 rec_id, gbuint8* flags, int pdb_read_rec_by_id(pdbfile* fin, const uint32_t rec_id, uint8_t* flags,
gbuint8* category, void** data); uint8_t* category, void** data);
void pdb_write_rec(pdbfile* fout, const gbuint8 flags, const gbuint8 catego void pdb_write_rec(pdbfile* fout, const uint8_t flags, const uint8_t catego
ry, const gbuint32 rec_id, const void* data, const gbuint32 size); ry, const uint32_t rec_id, const void* data, const uint32_t size);
#endif #endif
#endif #endif
 End of changes. 5 change blocks. 
21 lines changed or deleted 20 lines changed or added


 preferences.h   preferences.h 
skipping to change at line 36 skipping to change at line 36
class Preferences : public QDialog { class Preferences : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
Preferences(QWidget* parent, QList<Format>& formatList, BabelData& bd); Preferences(QWidget* parent, QList<Format>& formatList, BabelData& bd);
private: private:
QList<Format>& formatList_; QList<Format>& formatList_;
Ui_Preferences ui_; Ui_Preferences ui_;
BabelData& bd_; BabelData& babelData_;
private slots: private slots:
void enableAllClicked(); void enableAllClicked();
void disableAllClicked(); void disableAllClicked();
void acceptClicked(); void acceptClicked();
void rejectClicked(); void rejectClicked();
}; };
#endif // PREFERENCES_H_ #endif // PREFERENCES_H_
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 processwait.h   processwait.h 
skipping to change at line 45 skipping to change at line 45
class QDialogButtonBox; class QDialogButtonBox;
class QTimer; class QTimer;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class ProcessWaitDialog: public QDialog class ProcessWaitDialog: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
// //
ProcessWaitDialog(QWidget *parent, QProcess *process); ProcessWaitDialog(QWidget *parent, QProcess *process_);
~ProcessWaitDialog(); ~ProcessWaitDialog();
bool getExitedNormally(); bool getExitedNormally();
int getExitCode(); int getExitCode();
QString getErrorString(); QString getErrorString();
QString getOutputString() const {return outputString;}; QString getOutputString() const {return outputString_;};
protected: protected:
void closeEvent (QCloseEvent*event); void closeEvent (QCloseEvent*event);
void appendToText(const char *); void appendToText(const char *);
QString processErrorString(QProcess::ProcessError err); QString processErrorString(QProcess::ProcessError err);
private slots: private slots:
void errorX(QProcess::ProcessError); void errorX(QProcess::ProcessError);
void finishedX(int exitCode, QProcess::ExitStatus); void finishedX(int exitCode, QProcess::ExitStatus);
void readyReadStandardErrorX(); void readyReadStandardErrorX();
void readyReadStandardOutputX(); void readyReadStandardOutputX();
void timeoutX(); void timeoutX();
void stopClickedX(); void stopClickedX();
private: private:
vector <int> progressVals; vector <int> progressVals_;
int progressIndex; int progressIndex_;
int stopCount; int stopCount_;
string bufferedOut; string bufferedOut_;
QProcess::ExitStatus estatus; QProcess::ExitStatus exitStatus_;
int ecode; int ecode_;
QProcess *process; QProcess *process_;
QProgressBar *progressBar; QProgressBar *progressBar_;
QPlainTextEdit *textEdit; QPlainTextEdit *textEdit_;
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox_;
QTimer *timer; QTimer *timer_;
QString errorString; QString errorString_;
QString outputString; QString outputString_;
}; };
#endif #endif
 End of changes. 3 change blocks. 
15 lines changed or deleted 15 lines changed or added


 setting.h   setting.h 
skipping to change at line 43 skipping to change at line 43
virtual ~VarSetting() {}; virtual ~VarSetting() {};
virtual void saveSetting(QSettings &) = 0; virtual void saveSetting(QSettings &) = 0;
virtual void restoreSetting(QSettings &) = 0; virtual void restoreSetting(QSettings &) = 0;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class IntSetting: public VarSetting class IntSetting: public VarSetting
{ {
public: public:
IntSetting(const QString &name, int &var): VarSetting(), name(name), var( IntSetting(const QString &name, int &var): VarSetting(), name_(name), var
var) { } _(var) { }
void saveSetting(QSettings &st) {st.setValue(name, var); } void saveSetting(QSettings &st) {st.setValue(name_, var_); }
void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.val
(name).toInt(); } ue(name_).toInt(); }
private: private:
QString name; QString name_;
int &var; int &var_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class DoubleSetting: public VarSetting class DoubleSetting: public VarSetting
{ {
public: public:
DoubleSetting(const QString &name, double &var): VarSetting(), name(name) DoubleSetting(const QString &name, double &var): VarSetting(), name_(name
, var(var) { } ), var_(var) { }
void saveSetting(QSettings &st) {st.setValue(name, var); } void saveSetting(QSettings &st) {st.setValue(name_, var_); }
void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.val
(name).toDouble(); } ue(name_).toDouble(); }
private: private:
QString name; QString name_;
double &var; double &var_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class StringSetting: public VarSetting class StringSetting: public VarSetting
{ {
public: public:
StringSetting(const QString &name, QString &var): VarSetting(), name(name StringSetting(const QString &name, QString &var): VarSetting(), name_(nam
), var(var) { } e), var_(var) { }
void saveSetting(QSettings &st) {st.setValue(name, var); } void saveSetting(QSettings &st) {st.setValue(name_, var_); }
void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.val
(name).toString(); } ue(name_).toString(); }
private: private:
QString name; QString name_;
QString &var; QString &var_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class BoolSetting: public VarSetting class BoolSetting: public VarSetting
{ {
public: public:
BoolSetting(const QString &name, bool &var): VarSetting(), name(name), va BoolSetting(const QString &name, bool &var): VarSetting(), name_(name), v
r(var) { } ar_(var) { }
void saveSetting(QSettings &st) {st.setValue(name, var); } void saveSetting(QSettings &st) {st.setValue(name_, var_); }
void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.val
(name).toBool(); } ue(name_).toBool(); }
private: private:
QString name; QString name_;
bool &var; bool &var_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class DateTimeSetting: public VarSetting class DateTimeSetting: public VarSetting
{ {
public: public:
DateTimeSetting(const QString &name, QDateTime &var):VarSetting(), name(n DateTimeSetting(const QString &name, QDateTime &var):VarSetting(), name_(
ame), var(var) { } name), var_(var) { }
void saveSetting(QSettings &st) {st.setValue(name, var); } void saveSetting(QSettings &st) {st.setValue(name_, var_); }
void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.val
(name).toDateTime(); } ue(name_).toDateTime(); }
private: private:
QString name; QString name_;
QDateTime &var; QDateTime &var_;
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class SettingGroup { class SettingGroup {
public: public:
SettingGroup() {} SettingGroup() {}
~SettingGroup() { ~SettingGroup() {
for (int i=0; i<group.size(); i++) for (int i=0; i< settingGroup_.size(); i++)
delete group[i]; delete settingGroup_[i];
} }
void saveSettings(QSettings &st) { void saveSettings(QSettings &st) {
for (int i=0; i<group.size(); i++) for (int i=0; i< settingGroup_.size(); i++)
group[i]->saveSetting(st); settingGroup_[i]->saveSetting(st);
} }
void restoreSettings(QSettings &st) { void restoreSettings(QSettings &st) {
for (int i=0; i<group.size(); i++) for (int i=0; i< settingGroup_.size(); i++)
group[i]->restoreSetting(st); settingGroup_[i]->restoreSetting(st);
} }
void addVarSetting(VarSetting *vs) { void addVarSetting(VarSetting *vs) {
group << vs; settingGroup_ << vs;
} }
private: private:
QList <VarSetting *> group; QList <VarSetting *> settingGroup_;
}; };
#endif #endif
 End of changes. 15 change blocks. 
43 lines changed or deleted 43 lines changed or added


 shapefil.h   shapefil.h 
#ifndef _SHAPEFILE_H_INCLUDED #ifndef SHAPEFILE_H_INCLUDED
#define _SHAPEFILE_H_INCLUDED #define SHAPEFILE_H_INCLUDED
/************************************************************************** **** /************************************************************************** ****
* $Id: shapefil.h,v 1.2 2004-09-27 01:13:58 robertl Exp $ * $Id: shapefil.h,v 1.52 2011-12-11 22:26:46 fwarmerdam Exp $
* *
* Project: Shapelib * Project: Shapelib
* Purpose: Primary include file for Shapelib. * Purpose: Primary include file for Shapelib.
* Author: Frank Warmerdam, warmerdam@pobox.com * Author: Frank Warmerdam, warmerdam@pobox.com
* *
************************************************************************** **** ************************************************************************** ****
* Copyright (c) 1999, Frank Warmerdam * Copyright (c) 1999, Frank Warmerdam
* *
* This software is available under the following "MIT Style" license, * This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see LICENSE.LGPL). Thi s * or at the option of the licensee under the LGPL (see LICENSE.LGPL). Thi s
skipping to change at line 39 skipping to change at line 39
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI TY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI TY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
************************************************************************** **** ************************************************************************** ****
* *
* $Log: not supported by cvs2svn $ * $Log: shapefil.h,v $
* Revision 1.1 2004/09/20 17:22:55 robertl * Revision 1.52 2011-12-11 22:26:46 fwarmerdam
* Bring in shapefil.h. * upgrade .qix access code to use SAHooks (gdal #3365)
* *
* Revision 1.26 2002/09/29 00:00:08 warmerda * Revision 1.51 2011-07-24 05:59:25 fwarmerdam
* added FTLogical and logical attribute read/write calls * minimize use of CPLError in favor of SAHooks.Error()
* *
* Revision 1.25 2002/05/07 13:46:30 warmerda * Revision 1.50 2011-05-13 17:35:17 fwarmerdam
* added DBFWriteAttributeDirectly(). * added DBFReorderFields() and DBFAlterFields() functions (from Even)
* *
* Revision 1.24 2002/04/10 16:59:54 warmerda * Revision 1.49 2011-04-16 14:38:21 fwarmerdam
* added SHPRewindObject * avoid warnings with gcc on SHP_CVSID
* *
* Revision 1.23 2002/01/15 14:36:07 warmerda * Revision 1.48 2010-08-27 23:42:52 fwarmerdam
* updated email address * add SHPAPI_CALL attribute in code
* *
* Revision 1.22 2002/01/15 14:32:00 warmerda * Revision 1.47 2010-01-28 11:34:34 fwarmerdam
* try to improve SHPAPI_CALL docs * handle the shape file length limits more gracefully (#3236)
*
* Revision 1.46 2008-11-12 14:28:15 fwarmerdam
* DBFCreateField() now works on files with records
*
* Revision 1.45 2008/11/11 17:47:10 fwarmerdam
* added DBFDeleteField() function
* *
* Revision 1.21 2001/11/01 16:29:55 warmerda * Revision 1.44 2008/01/16 20:05:19 bram
* move pabyRec into SHPInfo for thread safety * Add file hooks that accept UTF-8 encoded filenames on some platforms. U
se SASetupUtf8Hooks
* tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability. Cu
rrently, this
* is only available on the Windows platform that decodes the UTF-8 filena
mes to wide
* character strings and feeds them to _wfopen and _wremove.
* *
* Revision 1.20 2001/07/20 13:06:02 warmerda * Revision 1.43 2008/01/10 16:35:30 fwarmerdam
* fixed SHPAPI attribute for SHPTreeFindLikelyShapes * avoid _ prefix on #defined symbols (bug 1840)
* *
* Revision 1.19 2001/05/31 19:20:13 warmerda * Revision 1.42 2007/12/18 18:28:14 bram
* added DBFGetFieldIndex() * - create hook for client specific atof (bugzilla ticket 1615)
* - check for NULL handle before closing cpCPG file, and close after readi
ng.
* *
* Revision 1.18 2001/05/31 18:15:40 warmerda * Revision 1.41 2007/12/15 20:25:32 bram
* Added support for NULL fields in DBF files * dbfopen.c now reads the Code Page information from the DBF file, and exp
orts
* this information as a string through the DBFGetCodePage function. This
is
* either the number from the LDID header field ("LDID/<number>") or as the
* content of an accompanying .CPG file. When creating a DBF file, the cod
e can
* be set using DBFCreateEx.
* *
* Revision 1.17 2001/05/23 13:36:52 warmerda * Revision 1.40 2007/12/06 07:00:25 fwarmerdam
* added use of SHPAPI_CALL * dbfopen now using SAHooks for fileio
* *
* Revision 1.16 2000/09/25 14:15:59 warmerda * Revision 1.39 2007/12/04 20:37:56 fwarmerdam
* added DBFGetNativeFieldType() * preliminary implementation of hooks api for io and errors
* *
* Revision 1.15 2000/02/16 16:03:51 warmerda * Revision 1.38 2007/11/21 22:39:56 fwarmerdam
* added null shape support * close shx file in readonly mode (GDAL #1956)
* *
* Revision 1.14 1999/11/05 14:12:05 warmerda * Revision 1.37 2007/10/27 03:31:14 fwarmerdam
* updated license terms * limit default depth of tree to 12 levels (gdal ticket #1594)
* *
* Revision 1.13 1999/06/02 18:24:21 warmerda * Revision 1.36 2007/09/10 23:33:15 fwarmerdam
* added trimming code * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
* of GDAL (gdal ticket #1810).
* *
* Revision 1.12 1999/06/02 17:56:12 warmerda * Revision 1.35 2007/09/03 19:48:10 fwarmerdam
* added quad'' subnode support for trees * move DBFReadAttribute() static dDoubleField into dbfinfo
* *
* Revision 1.11 1999/05/18 19:11:11 warmerda * Revision 1.34 2006/06/17 15:33:32 fwarmerdam
* Added example searching capability * added pszWorkField - bug 1202 (rso)
* *
* Revision 1.10 1999/05/18 17:49:38 warmerda * Revision 1.33 2006/02/15 01:14:30 fwarmerdam
* added initial quadtree support * added DBFAddNativeFieldType
* *
* Revision 1.9 1999/05/11 03:19:28 warmerda * Revision 1.32 2006/01/26 15:07:32 fwarmerdam
* added new Tuple api, and improved extension handling - add from candrsn * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
* *
* Revision 1.8 1999/03/23 17:22:27 warmerda * Revision 1.31 2006/01/05 01:27:27 fwarmerdam
* Added extern "C" protection for C++ users of shapefil.h. * added dbf deletion mark/fetch
* *
* Revision 1.7 1998/12/31 15:31:07 warmerda * Revision 1.30 2005/01/03 22:30:13 fwarmerdam
* Added the TRIM_DBF_WHITESPACE and DISABLE_MULTIPATCH_MEASURE options. * added support for saved quadtrees
* *
* Revision 1.6 1998/12/03 15:48:15 warmerda * Revision 1.29 2004/09/26 20:09:35 fwarmerdam
* Added SHPCalculateExtents(). * avoid rcsid warnings
* *
* Revision 1.5 1998/11/09 20:57:16 warmerda * Revision 1.28 2003/12/29 06:02:18 fwarmerdam
* Altered SHPGetInfo() call. * added cpl_error.h option
* *
* Revision 1.4 1998/11/09 20:19:33 warmerda * Revision 1.27 2003/04/21 18:30:37 warmerda
* Added 3D support, and use of SHPObject. * added header write/update public methods
*
* Revision 1.26 2002/09/29 00:00:08 warmerda
* added FTLogical and logical attribute read/write calls
*
* Revision 1.25 2002/05/07 13:46:30 warmerda
* added DBFWriteAttributeDirectly().
* *
* Revision 1.3 1995/08/23 02:24:05 warmerda * Revision 1.24 2002/04/10 16:59:54 warmerda
* Added support for reading bounds. * added SHPRewindObject
* *
* Revision 1.2 1995/08/04 03:17:39 warmerda * Revision 1.23 2002/01/15 14:36:07 warmerda
* Added header. * updated email address
* *
* Revision 1.22 2002/01/15 14:32:00 warmerda
* try to improve SHPAPI_CALL docs
*/ */
#include <stdio.h> #include <stdio.h>
#ifdef USE_DBMALLOC #ifdef USE_DBMALLOC
#include <dbmalloc.h> #include <dbmalloc.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
skipping to change at line 182 skipping to change at line 205
/* after any "*"'s in the return value of a function while the */ /* after any "*"'s in the return value of a function while the */
/* __declspec(dllexport) must appear before them. */ /* __declspec(dllexport) must appear before them. */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
#ifdef SHAPELIB_DLLEXPORT #ifdef SHAPELIB_DLLEXPORT
# define SHPAPI_CALL __declspec(dllexport) # define SHPAPI_CALL __declspec(dllexport)
# define SHPAPI_CALL1(x) __declspec(dllexport) x # define SHPAPI_CALL1(x) __declspec(dllexport) x
#endif #endif
#ifndef SHPAPI_CALL #ifndef SHPAPI_CALL
# define SHPAPI_CALL # if defined(USE_GCC_VISIBILITY_FLAG)
# define SHPAPI_CALL __attribute__ ((visibility("default")))
# define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x
# else
# define SHPAPI_CALL
# endif
#endif #endif
#ifndef SHPAPI_CALL1 #ifndef SHPAPI_CALL1
# define SHPAPI_CALL1(x) x SHPAPI_CALL # define SHPAPI_CALL1(x) x SHPAPI_CALL
#endif #endif
/* -------------------------------------------------------------------- */
/* Macros for controlling CVSID and ensuring they don't appear */
/* as unreferenced variables resulting in lots of warnings. */
/* -------------------------------------------------------------------- */
#ifndef DISABLE_CVSID
# if defined(__GNUC__) && __GNUC__ >= 4
# define SHP_CVSID(string) static char cpl_cvsid[] __attribute__((us
ed)) = string;
# else
# define SHP_CVSID(string) static char cpl_cvsid[] = string; \
static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid
); }
# endif
#else
# define SHP_CVSID(string)
#endif
/* -------------------------------------------------------------------- */
/* On some platforms, additional file IO hooks are defined that */
/* UTF-8 encoded filenames Unicode filenames */
/* -------------------------------------------------------------------- */
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define SHPAPI_WINDOWS
# define SHPAPI_UTF8_HOOKS
#endif
/* -------------------------------------------------------------------- */
/* IO/Error hook functions. */
/* -------------------------------------------------------------------- */
typedef int *SAFile;
#ifndef SAOffset
typedef unsigned long SAOffset;
#endif
typedef struct {
SAFile (*FOpen) ( const char *filename, const char *access);
SAOffset (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile fi
le);
SAOffset (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile fi
le);
SAOffset (*FSeek) ( SAFile file, SAOffset offset, int whence );
SAOffset (*FTell) ( SAFile file );
int (*FFlush)( SAFile file );
int (*FClose)( SAFile file );
int (*Remove) ( const char *filename );
void (*Error) ( const char *message );
double (*Atof) ( const char *str );
} SAHooks;
void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
#ifdef SHPAPI_UTF8_HOOKS
void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
#endif
/************************************************************************/ /************************************************************************/
/* SHP Support. */ /* SHP Support. */
/************************************************************************/ /************************************************************************/
typedef struct typedef struct
{ {
FILE *fpSHP; SAHooks sHooks;
FILE *fpSHX;
SAFile fpSHP;
SAFile fpSHX;
int nShapeType; /* SHPT_* */ int nShapeType; /* SHPT_* */
int nFileSize; /* SHP file */ unsigned int nFileSize; /* SHP file */
int nRecords; int nRecords;
int nMaxRecords; int nMaxRecords;
int *panRecOffset; unsigned int *panRecOffset;
int *panRecSize; unsigned int *panRecSize;
double adBoundsMin[4]; double adBoundsMin[4];
double adBoundsMax[4]; double adBoundsMax[4];
int bUpdated; int bUpdated;
unsigned char *pabyRec; unsigned char *pabyRec;
int nBufSize; int nBufSize;
} SHPInfo; } SHPInfo;
skipping to change at line 276 skipping to change at line 358
double dfXMin; double dfXMin;
double dfYMin; double dfYMin;
double dfZMin; double dfZMin;
double dfMMin; double dfMMin;
double dfXMax; double dfXMax;
double dfYMax; double dfYMax;
double dfZMax; double dfZMax;
double dfMMax; double dfMMax;
int bMeasureIsUsed;
} SHPObject; } SHPObject;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* SHP API Prototypes */ /* SHP API Prototypes */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* If pszAccess is read-only, the fpSHX field of the returned structure */
/* will be NULL as it is not necessary to keep the SHX file open */
SHPHandle SHPAPI_CALL SHPHandle SHPAPI_CALL
SHPOpen( const char * pszShapeFile, const char * pszAccess ); SHPOpen( const char * pszShapeFile, const char * pszAccess );
SHPHandle SHPAPI_CALL SHPHandle SHPAPI_CALL
SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
SAHooks *psHooks );
SHPHandle SHPAPI_CALL
SHPCreate( const char * pszShapeFile, int nShapeType ); SHPCreate( const char * pszShapeFile, int nShapeType );
SHPHandle SHPAPI_CALL
SHPCreateLL( const char * pszShapeFile, int nShapeType,
SAHooks *psHooks );
void SHPAPI_CALL void SHPAPI_CALL
SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType, SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
double * padfMinBound, double * padfMaxBound ); double * padfMinBound, double * padfMaxBound );
SHPObject SHPAPI_CALL1(*) SHPObject SHPAPI_CALL1(*)
SHPReadObject( SHPHandle hSHP, int iShape ); SHPReadObject( SHPHandle hSHP, int iShape );
int SHPAPI_CALL int SHPAPI_CALL
SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject ); SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
void SHPAPI_CALL void SHPAPI_CALL
SHPDestroyObject( SHPObject * psObject ); SHPDestroyObject( SHPObject * psObject );
void SHPAPI_CALL void SHPAPI_CALL
SHPComputeExtents( SHPObject * psObject ); SHPComputeExtents( SHPObject * psObject );
SHPObject SHPAPI_CALL1(*) SHPObject SHPAPI_CALL1(*)
SHPCreateObject( int nSHPType, int nShapeId, SHPCreateObject( int nSHPType, int nShapeId, int nParts,
int nParts, int * panPartStart, int * panPartType, const int * panPartStart, const int * panPartType,
int nVertices, const double * padfX, const double * int nVertices,
padfY, const double * padfX, const double * padfY,
const double * padfZ, const double * padfM ); const double * padfZ, const double * padfM );
SHPObject SHPAPI_CALL1(*) SHPObject SHPAPI_CALL1(*)
SHPCreateSimpleObject( int nSHPType, int nVertices, SHPCreateSimpleObject( int nSHPType, int nVertices,
const double * padfX, const double * padfY, co const double * padfX,
nst double * padfZ ); const double * padfY,
const double * padfZ );
int SHPAPI_CALL int SHPAPI_CALL
SHPRewindObject( SHPHandle hSHP, SHPObject * psObject ); SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
void SHPAPI_CALL void SHPAPI_CALL SHPClose( SHPHandle hSHP );
SHPClose( SHPHandle hSHP ); void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
const char SHPAPI_CALL1(*) const char SHPAPI_CALL1(*)
SHPTypeName( int nSHPType ); SHPTypeName( int nSHPType );
const char SHPAPI_CALL1(*) const char SHPAPI_CALL1(*)
SHPPartTypeName( int nPartType ); SHPPartTypeName( int nPartType );
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* Shape quadtree indexing API. */ /* Shape quadtree indexing API. */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* this can be two or four for binary or quad tree */ /* this can be two or four for binary or quad tree */
#define MAX_SUBNODE 4 #define MAX_SUBNODE 4
/* upper limit of tree levels for automatic estimation */
#define MAX_DEFAULT_TREE_DEPTH 12
typedef struct shape_tree_node typedef struct shape_tree_node
{ {
/* region covered by this node */ /* region covered by this node */
double adfBoundsMin[4]; double adfBoundsMin[4];
double adfBoundsMax[4]; double adfBoundsMax[4];
/* list of shapes stored at this node. The papsShapeObj pointers /* list of shapes stored at this node. The papsShapeObj pointers
or the whole list can be NULL */ or the whole list can be NULL */
int nShapeCount; int nShapeCount;
int *panShapeIds; int *panShapeIds;
skipping to change at line 348 skipping to change at line 447
struct shape_tree_node *apsSubNode[MAX_SUBNODE]; struct shape_tree_node *apsSubNode[MAX_SUBNODE];
} SHPTreeNode; } SHPTreeNode;
typedef struct typedef struct
{ {
SHPHandle hSHP; SHPHandle hSHP;
int nMaxDepth; int nMaxDepth;
int nDimension; int nDimension;
int nTotalCount;
SHPTreeNode *psRoot; SHPTreeNode *psRoot;
} SHPTree; } SHPTree;
SHPTree SHPAPI_CALL1(*) SHPTree SHPAPI_CALL1(*)
SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth, SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
double *padfBoundsMin, double *padfBoundsMax ); double *padfBoundsMin, double *padfBoundsMax );
void SHPAPI_CALL void SHPAPI_CALL
SHPDestroyTree( SHPTree * hTree ); SHPDestroyTree( SHPTree * hTree );
int SHPAPI_CALL int SHPAPI_CALL
SHPWriteTree( SHPTree *hTree, const char * pszFilename ); SHPWriteTree( SHPTree *hTree, const char * pszFilename );
SHPTree SHPAPI_CALL
SHPReadTree( const char * pszFilename );
int SHPAPI_CALL int SHPAPI_CALL
SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject );
int SHPAPI_CALL
SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject ); SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
int SHPAPI_CALL int SHPAPI_CALL
SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId ); SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId );
void SHPAPI_CALL void SHPAPI_CALL
SHPTreeTrimExtraNodes( SHPTree * hTree ); SHPTreeTrimExtraNodes( SHPTree * hTree );
int SHPAPI_CALL1(*) int SHPAPI_CALL1(*)
SHPTreeFindLikelyShapes( SHPTree * hTree, SHPTreeFindLikelyShapes( SHPTree * hTree,
double * padfBoundsMin, double * padfBoundsMin,
double * padfBoundsMax, double * padfBoundsMax,
int * ); int * );
int SHPAPI_CALL int SHPAPI_CALL
SHPCheckBoundsOverlap( double *, double *, double *, double *, int ); SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
int SHPAPI_CALL1(*)
SHPSearchDiskTree( FILE *fp,
double *padfBoundsMin, double *padfBoundsMax,
int *pnShapeCount );
typedef struct SHPDiskTreeInfo* SHPTreeDiskHandle;
SHPTreeDiskHandle SHPAPI_CALL
SHPOpenDiskTree( const char* pszQIXFilename,
SAHooks *psHooks );
void SHPAPI_CALL
SHPCloseDiskTree( SHPTreeDiskHandle hDiskTree );
int SHPAPI_CALL1(*)
SHPSearchDiskTreeEx( SHPTreeDiskHandle hDiskTree,
double *padfBoundsMin, double *padfBoundsMax,
int *pnShapeCount );
int SHPAPI_CALL
SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHook
s );
/************************************************************************/ /************************************************************************/
/* DBF Support. */ /* DBF Support. */
/************************************************************************/ /************************************************************************/
typedef struct typedef struct
{ {
FILE *fp; SAHooks sHooks;
SAFile fp;
int nRecords; int nRecords;
int nRecordLength; int nRecordLength;
int nHeaderLength; int nHeaderLength;
int nFields; int nFields;
int *panFieldOffset; int *panFieldOffset;
int *panFieldSize; int *panFieldSize;
int *panFieldDecimals; int *panFieldDecimals;
char *pachFieldType; char *pachFieldType;
char *pszHeader; char *pszHeader;
int nCurrentRecord; int nCurrentRecord;
int bCurrentRecordModified; int bCurrentRecordModified;
char *pszCurrentRecord; char *pszCurrentRecord;
int nWorkFieldLength;
char *pszWorkField;
int bNoHeader; int bNoHeader;
int bUpdated; int bUpdated;
double dfDoubleField;
int iLanguageDriver;
char *pszCodePage;
} DBFInfo; } DBFInfo;
typedef DBFInfo * DBFHandle; typedef DBFInfo * DBFHandle;
typedef enum { typedef enum {
FTString, FTString,
FTInteger, FTInteger,
FTDouble, FTDouble,
FTLogical, FTLogical,
FTInvalid FTInvalid
} DBFFieldType; } DBFFieldType;
#define XBASE_FLDHDR_SZ 32 #define XBASE_FLDHDR_SZ 32
DBFHandle SHPAPI_CALL DBFHandle SHPAPI_CALL
DBFOpen( const char * pszDBFFile, const char * pszAccess ); DBFOpen( const char * pszDBFFile, const char * pszAccess );
DBFHandle SHPAPI_CALL DBFHandle SHPAPI_CALL
DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
SAHooks *psHooks );
DBFHandle SHPAPI_CALL
DBFCreate( const char * pszDBFFile ); DBFCreate( const char * pszDBFFile );
DBFHandle SHPAPI_CALL
DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
DBFHandle SHPAPI_CALL
DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHoo
ks *psHooks );
int SHPAPI_CALL int SHPAPI_CALL
DBFGetFieldCount( DBFHandle psDBF ); DBFGetFieldCount( DBFHandle psDBF );
int SHPAPI_CALL int SHPAPI_CALL
DBFGetRecordCount( DBFHandle psDBF ); DBFGetRecordCount( DBFHandle psDBF );
int SHPAPI_CALL int SHPAPI_CALL
DBFAddField( DBFHandle hDBF, const char * pszFieldName, DBFAddField( DBFHandle hDBF, const char * pszFieldName,
DBFFieldType eType, int nWidth, int nDecimals ); DBFFieldType eType, int nWidth, int nDecimals );
int SHPAPI_CALL
DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
char chType, int nWidth, int nDecimals );
int SHPAPI_CALL
DBFDeleteField( DBFHandle hDBF, int iField );
int SHPAPI_CALL
DBFReorderFields( DBFHandle psDBF, int* panMap );
int SHPAPI_CALL
DBFAlterFieldDefn( DBFHandle psDBF, int iField, const char * pszField
Name,
char chType, int nWidth, int nDecimals );
DBFFieldType SHPAPI_CALL DBFFieldType SHPAPI_CALL
DBFGetFieldInfo( DBFHandle psDBF, int iField, DBFGetFieldInfo( DBFHandle psDBF, int iField,
char * pszFieldName, int * pnWidth, int * pnDecimals ); char * pszFieldName, int * pnWidth, int * pnDecimals );
int SHPAPI_CALL int SHPAPI_CALL
DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName); DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
int SHPAPI_CALL int SHPAPI_CALL
DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField ); DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
double SHPAPI_CALL double SHPAPI_CALL
skipping to change at line 474 skipping to change at line 623
DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField, DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
const char lFieldValue); const char lFieldValue);
int SHPAPI_CALL int SHPAPI_CALL
DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
void * pValue ); void * pValue );
const char SHPAPI_CALL1(*) const char SHPAPI_CALL1(*)
DBFReadTuple(DBFHandle psDBF, int hEntity ); DBFReadTuple(DBFHandle psDBF, int hEntity );
int SHPAPI_CALL int SHPAPI_CALL
DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple ); DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
int bIsDeleted );
DBFHandle SHPAPI_CALL DBFHandle SHPAPI_CALL
DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename ); DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
void SHPAPI_CALL void SHPAPI_CALL
DBFClose( DBFHandle hDBF ); DBFClose( DBFHandle hDBF );
void SHPAPI_CALL
DBFUpdateHeader( DBFHandle hDBF );
char SHPAPI_CALL char SHPAPI_CALL
DBFGetNativeFieldType( DBFHandle hDBF, int iField ); DBFGetNativeFieldType( DBFHandle hDBF, int iField );
const char SHPAPI_CALL1(*)
DBFGetCodePage(DBFHandle psDBF );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* ndef _SHAPEFILE_H_INCLUDED */ #endif /* ndef SHAPEFILE_H_INCLUDED */
 End of changes. 56 change blocks. 
75 lines changed or deleted 245 lines changed or added


 strptime.h   strptime.h 
skipping to change at line 30 skipping to change at line 30
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef __STRPTIME_H__ #ifndef __STRPTIME_H__
#define __STRPTIME_H__ #define __STRPTIME_H__
/* /*
* Version of "strptime()", for the benefit of OSes that don't have it. * Version of "strptime()", for the benefit of OSes that don't have it.
*/ */
extern char* strptime(const char*, const char*, struct tm*); #ifdef __cplusplus
extern "C" {
#endif
extern char* strptime(const char*, const char*, struct tm*);
#ifdef __cplusplus
}
#endif
#endif #endif
 End of changes. 1 change blocks. 
2 lines changed or deleted 7 lines changed or added


 trees.h   trees.h 
skipping to change at line 73 skipping to change at line 73
local const ct_data static_dtree[D_CODES] = { local const ct_data static_dtree[D_CODES] = {
{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
}; };
const uch _dist_code[DIST_CODE_LEN] = { const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
skipping to change at line 102 skipping to change at line 102
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
}; };
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 upgrade.h   upgrade.h 
skipping to change at line 24 skipping to change at line 24
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
#include "babeldata.h" #include "babeldata.h"
#include "format.h" #include "format.h"
#include <QDialog>
#include <QDateTime> #include <QDateTime>
#include <QHttp> #include <QUrl>
class QHttp; class QNetworkAccessManager;
class QHttpResponseHeader; class QNetworkReply;
class UpgradeCheck : public QObject { class UpgradeCheck : public QObject {
Q_OBJECT Q_OBJECT
public: public:
UpgradeCheck(QWidget *parent, QList<Format> &formatList, BabelData& bd); UpgradeCheck(QWidget *parent, QList<Format> &formatList, BabelData& bd);
~UpgradeCheck(); ~UpgradeCheck();
typedef enum { typedef enum {
updateUnknown, updateUnknown,
updateCurrent, updateCurrent,
updateNeeded, updateNeeded,
} updateStatus; } updateStatus;
UpgradeCheck::updateStatus checkForUpgrade(const QString &babelVersion, UpgradeCheck::updateStatus checkForUpgrade(const QString &babelVersion,
const QDateTime &lastCheckTime, const QDateTime &lastCheckTime,
bool allowBeta); bool allowBeta);
QDateTime getUpgradeWarningTime() { QDateTime getUpgradeWarningTime(void);
return upgradeWarningTime; UpgradeCheck::updateStatus getStatus(void);
}
updateStatus getStatus() {
return updateStatus_;
}
static bool isTestMode(void); static bool isTestMode(void);
protected: protected:
private: private:
QString currentVersion; QString currentVersion_;
int upgradeCheckMethod; QNetworkAccessManager* manager_;
QHttp *http; QNetworkReply* replyId_;
int httpRequestId; QUrl upgradeUrl_;
bool httpRequestAborted; QString latestVersion_;
QString latestVersion; QDateTime upgradeWarningTime_; // invalid time if this object never issu
QDateTime upgradeWarningTime; // invalid time if this object never issue ed.
d.
QString getOsName(void);
QString getOsVersion(void);
QList<Format> &formatList_; QList<Format> &formatList_;
updateStatus updateStatus_; updateStatus updateStatus_;
BabelData& bd_; BabelData& babelData_;
QString getOsName(void);
QString getOsVersion(void);
private slots: private slots:
void httpRequestFinished(int requestId, bool error); void httpRequestFinished(QNetworkReply* reply);
void readResponseHeader(const QHttpResponseHeader &responseHeader);
}; };
#endif // UPGRADE_H #endif // UPGRADE_H
 End of changes. 8 change blocks. 
27 lines changed or deleted 21 lines changed or added


 version_mismatch.h   version_mismatch.h 
skipping to change at line 33 skipping to change at line 33
#define VERSION_MISMATCH_H #define VERSION_MISMATCH_H
#include <QDialog> #include <QDialog>
#include "ui_version_mismatch.h" #include "ui_version_mismatch.h"
class VersionMismatch: public QDialog { class VersionMismatch: public QDialog {
public: public:
VersionMismatch(QWidget *parent, const QString &ver1, VersionMismatch(QWidget *parent, const QString &ver1,
const QString &ver2); const QString &ver2);
bool neverAgain() { return ui.neverAgain->isChecked(); } bool neverAgain() { return ui_.neverAgain->isChecked(); }
private: private:
Ui_VersionMismatch ui; Ui_VersionMismatch ui_;
}; };
#endif #endif
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 xmlgeneric.h   xmlgeneric.h 
skipping to change at line 28 skipping to change at line 28
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/ */
typedef enum { typedef enum {
cb_start = 1, cb_start = 1,
cb_cdata, cb_cdata,
cb_end, cb_end,
} xg_cb_type; } xg_cb_type;
typedef void (xg_callback)(const char*, const char**); typedef void (xg_callback)(xg_string, const QXmlStreamAttributes*);
typedef struct xg_tag_mapping { typedef struct xg_tag_mapping {
xg_callback* tag_cb; xg_callback* tag_cb;
xg_cb_type cb_type; xg_cb_type cb_type;
const char* tag_name; const char* tag_name;
} xg_tag_mapping; } xg_tag_mapping;
extern char* xhtml_entities; extern const char* xhtml_entities;
void write_xml_entity(gbfile* ofd, const char* indent,
const char* tag, const char* value);
void write_xml_entity_begin0(gbfile* ofd, const char* indent,
const char* tag);
void write_xml_entity_begin1(gbfile* ofd, const char* indent, const char* t
ag,
const char* attr1, const char* attrval1);
void write_xml_entity_begin2(gbfile* ofd, const char* indent, const char* t
ag,
const char* attr1, const char* attrval1,
const char* attr2, const char* attrval2);
void write_xml_entity_end(gbfile* ofd, const char* indent, const char* tag)
;
void write_optional_xml_entity(gbfile* ofd, const char* indent,
const char* tag, const char* value);
void xml_write_time(gbfile* ofd, const time_t timep, int microseconds, cons
t char* elname);
void xml_fill_in_time(char* time_string, const time_t timep, int microsecon
ds,
int long_or_short);
void write_xml_header(gbfile* ofd);
void xml_ignore_tags(const char** taglist); void xml_ignore_tags(const char** taglist);
void xml_init(const char* fname, xg_tag_mapping* tbl,const char* encoding); void xml_init(const char* fname, xg_tag_mapping* tbl,const char* encoding);
void xml_init_offset(const char* fname, xg_tag_mapping* tbl, void xml_init_offset(const char* fname, xg_tag_mapping* tbl,
const char* encoding, gbsize_t offset); const char* encoding, gbsize_t offset);
void xml_read(void); void xml_read(void);
void xml_readstring(char* str); void xml_readstring(const char* str);
void xml_readprefixstring(char* str); void xml_readprefixstring(const char* str);
void xml_readunicode(const QString& str);
void xml_deinit(void); void xml_deinit(void);
 End of changes. 3 change blocks. 
27 lines changed or deleted 5 lines changed or added


 zconf.h   zconf.h 
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2005 Jean-loup Gailly. * Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* @(#) $Id: zconf.h,v 1.1 2006-07-22 20:34:08 oliskoli Exp $ */ /* @(#) $Id$ */
#ifndef ZCONF_H #ifndef ZCONF_H
#define ZCONF_H #define ZCONF_H
/* Start GPSBabel local */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* end GPSBabel local */
/* /*
* If you *really* need a unique prefix for all types and library functions , * If you *really* need a unique prefix for all types and library functions ,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to
set
* this permanently in zconf.h using "./configure --zprefix".
*/ */
#ifdef Z_PREFIX #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define deflateInit_ z_deflateInit_ # define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate # define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd # define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_ # define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary # define deflateInit_ z_deflateInit_
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams # define deflateParams z_deflateParams
# define deflateBound z_deflateBound # define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime # define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzvprintf z_gzvprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_ # define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary # define inflateSetDictionary z_inflateSetDictionary
# define inflateGetDictionary z_inflateGetDictionary
# define inflateSync z_inflateSync # define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint # define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy # define inflateUndermine z_inflateUndermine
# define inflateReset z_inflateReset # define inflateResetKeep z_inflateResetKeep
# define inflateBack z_inflateBack # define inflate_copyright z_inflate_copyright
# define inflateBackEnd z_inflateBackEnd # define inflate_fast z_inflate_fast
# define compress z_compress # define inflate_table z_inflate_table
# define compress2 z_compress2 # ifndef Z_SOLO
# define compressBound z_compressBound # define uncompress z_uncompress
# define uncompress z_uncompress # endif
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError # define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func # define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func # define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func # define in_func z_in_func
# define intf z_intf
# define out_func z_out_func # define out_func z_out_func
# define Byte z_Byte
# define uInt z_uInt # define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf # define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf # define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp # define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif #endif
#if defined(__MSDOS__) && !defined(MSDOS) #if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS # define MSDOS
#endif #endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2 # define OS2
#endif #endif
#if defined(_WINDOWS) && !defined(WINDOWS) #if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS # define WINDOWS
skipping to change at line 128 skipping to change at line 227
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). * / #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). * /
# define STDC # define STDC
#endif #endif
#ifndef STDC #ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */ # define const /* note: need a more gentle solution here */
# endif # endif
#endif #endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */ /* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL # define NO_DUMMY_DECL
#endif #endif
/* Maximum value for memLevel in deflateInit2 */ /* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL #ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K # ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8 # define MAX_MEM_LEVEL 8
# else # else
skipping to change at line 174 skipping to change at line 279
/* Type declarations */ /* Type declarations */
#ifndef OF /* function prototypes */ #ifndef OF /* function prototypes */
# ifdef STDC # ifdef STDC
# define OF(args) args # define OF(args) args
# else # else
# define OF(args) () # define OF(args) ()
# endif # endif
#endif #endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed /* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations). * model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have * This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty. * just define FAR to be empty.
*/ */
#ifdef SYS16BIT #ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM) # if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */ /* MSC small or medium model */
# define SMALL_MEDIUM # define SMALL_MEDIUM
skipping to change at line 287 skipping to change at line 400
#ifdef STDC #ifdef STDC
typedef void const *voidpc; typedef void const *voidpc;
typedef void FAR *voidpf; typedef void FAR *voidpf;
typedef void *voidp; typedef void *voidp;
#else #else
typedef Byte const *voidpc; typedef Byte const *voidpc;
typedef Byte FAR *voidpf; typedef Byte FAR *voidpf;
typedef Byte *voidp; typedef Byte *voidp;
#endif #endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <sys/types.h> /* for off_t */ # include <limits.h>
# include <unistd.h> /* for SEEK_* and off_t */ # if (UINT_MAX == 0xffffffffUL)
# ifdef VMS # define Z_U4 unsigned
# include <unixio.h> /* for off_t */ # elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif # endif
# define z_off_t off_t
#endif #endif
#ifndef SEEK_SET
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE
*/
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LF
S64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif #endif
#ifndef z_off_t #ifndef z_off_t
# define z_off_t long # define z_off_t long
#endif #endif
#if defined(__OS400__) #if !defined(_WIN32) && defined(Z_LARGE64)
# define NO_vsnprintf # define z_off64_t off64_t
#endif #else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
#if defined(__MVS__) # define z_off64_t __int64
# define NO_vsnprintf # else
# ifdef FAR # define z_off64_t z_off_t
# undef FAR
# endif # endif
#endif #endif
/* MVS linker does not support external names larger than 8 bytes */ /* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__) #if defined(__MVS__)
# pragma map(deflateInit_,"DEIN") #pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2") #pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND") #pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND") #pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ") #pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2") #pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND") #pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY") #pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI") #pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND") #pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL") #pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA") #pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY") #pragma map(inflate_copyright,"INCOPY")
#endif #endif
#endif /* ZCONF_H */ #endif /* ZCONF_H */
 End of changes. 31 change blocks. 
56 lines changed or deleted 244 lines changed or added


 zlib.h   zlib.h 
/* zlib.h -- interface of the 'zlib' general purpose compression library /* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.3, July 18th, 2005 version 1.2.8, April 28th, 2013
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
arising from the use of this software. arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not 1. The origin of this software must not be misrepresented; you must not
skipping to change at line 26 skipping to change at line 26
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not b e 2. Altered source versions must be plainly marked as such, and must not b e
misrepresented as being the original software. misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution . 3. This notice may not be removed or altered from any source distribution .
Jean-loup Gailly Mark Adler Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request fo r The data format used by the zlib library is described by RFCs (Request fo r
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format) (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
.
*/ */
#ifndef ZLIB_H #ifndef ZLIB_H
#define ZLIB_H #define ZLIB_H
#include "zconf.h" #include "zconf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define ZLIB_VERSION "1.2.3.f-GPSBabel" #define ZLIB_VERSION "1.2.8"
#define ZLIB_VERNUM 0x123f #define ZLIB_VERNUM 0x1280
#define ZLIB_VER_MAJOR 1
/* #define ZLIB_VER_MINOR 2
The 'zlib' compression library provides in-memory compression and #define ZLIB_VER_REVISION 8
decompression functions, including integrity checks of the uncompressed #define ZLIB_VER_SUBREVISION 0
data. This version of the library supports only one compression method
(deflation) but other algorithms will be added later and will have the sa /*
me The 'zlib' compression library provides in-memory compression and
stream interface. decompression functions, including integrity checks of the uncompressed d
ata.
Compression can be done in a single step if the buffers are large This version of the library supports only one compression method (deflati
enough (for example if an input file is mmap'ed), or can be done by on)
repeated calls of the compression function. In the latter case, the but other algorithms will be added later and will have the same stream
application must provide more input and/or consume the output interface.
Compression can be done in a single step if the buffers are large enoug
h,
or can be done by repeated calls of the compression function. In the lat
ter
case, the application must provide more input and/or consume the output
(providing more output space) before each call. (providing more output space) before each call.
The compressed data format used by default by the in-memory functions is The compressed data format used by default by the in-memory functions i s
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
around a deflate stream, which is itself documented in RFC 1951. around a deflate stream, which is itself documented in RFC 1951.
The library also supports reading and writing files in gzip (.gz) form at The library also supports reading and writing files in gzip (.gz) forma t
with an interface similar to that of stdio using the functions that start with an interface similar to that of stdio using the functions that start
with "gz". The gzip format is different from the zlib format. gzip is a with "gz". The gzip format is different from the zlib format. gzip is a
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
This library can optionally read and write gzip streams in memory as w ell. This library can optionally read and write gzip streams in memory as we ll.
The zlib format was designed to be compact and fast for use in memory The zlib format was designed to be compact and fast for use in memory
and on communications channels. The gzip format was designed for single- and on communications channels. The gzip format was designed for single-
file compression on file systems, has a larger header than zlib to mainta in file compression on file systems, has a larger header than zlib to mainta in
directory information, and uses a different, slower check method than zli b. directory information, and uses a different, slower check method than zli b.
The library does not install any signal handler. The decoder checks The library does not install any signal handler. The decoder checks
the consistency of the compressed data, so the library should never the consistency of the compressed data, so the library should never crash
crash even in case of corrupted input. even in case of corrupted input.
*/ */
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) OF((voidpf opaque, voidpf address)); typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state; struct internal_state;
typedef struct z_stream_s { typedef struct z_stream_s {
Bytef *next_in; /* next input byte */ z_const Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */ uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */ uLong total_in; /* total number of input bytes read so far */
Bytef *next_out; /* next output byte should be put there */ Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */ uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total nb of bytes output so far */ uLong total_out; /* total number of bytes output so far */
char *msg; /* last error message, NULL if no error */ z_const char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */ struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */ alloc_func zalloc; /* used to allocate the internal state */
free_func zfree; /* used to free the internal state */ free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree * / voidpf opaque; /* private data object passed to zalloc and zfree * /
int data_type; /* best guess about the data type: binary or text * / int data_type; /* best guess about the data type: binary or text * /
uLong adler; /* adler32 value of the uncompressed data */ uLong adler; /* adler32 value of the uncompressed data */
uLong reserved; /* reserved for future use */ uLong reserved; /* reserved for future use */
} z_stream; } z_stream;
skipping to change at line 128 skipping to change at line 131
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
uInt comm_max; /* space at comment (only when reading header) */ uInt comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */ int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used int done; /* true when done reading gzip header (not used
when writing a gzip file) */ when writing a gzip file) */
} gz_header; } gz_header;
typedef gz_header FAR *gz_headerp; typedef gz_header FAR *gz_headerp;
/* /*
The application must update next_in and avail_in when avail_in has The application must update next_in and avail_in when avail_in has dro
dropped to zero. It must update next_out and avail_out when avail_out pped
has dropped to zero. The application must initialize zalloc, zfree and to zero. It must update next_out and avail_out when avail_out has dropp
opaque before calling the init function. All other fields are set by the ed
compression library and must not be updated by the application. to zero. The application must initialize zalloc, zfree and opaque befor
e
The opaque value provided by the application will be passed as the first calling the init function. All other fields are set by the compression
parameter for calls of zalloc and zfree. This can be useful for custom library and must not be updated by the application.
memory management. The compression library attaches no meaning to the
The opaque value provided by the application will be passed as the fir
st
parameter for calls of zalloc and zfree. This can be useful for custom
memory management. The compression library attaches no meaning to the
opaque value. opaque value.
zalloc must return Z_NULL if there is not enough memory for the object. zalloc must return Z_NULL if there is not enough memory for the object .
If zlib is used in a multi-threaded application, zalloc and zfree must b e If zlib is used in a multi-threaded application, zalloc and zfree must b e
thread safe. thread safe.
On 16-bit systems, the functions zalloc and zfree must be able to alloca On 16-bit systems, the functions zalloc and zfree must be able to allo
te cate
exactly 65536 bytes, but will not be required to allocate more than this exactly 65536 bytes, but will not be required to allocate more than this
if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, if
pointers returned by zalloc for objects of exactly 65536 bytes *must* the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, poin
have their offset normalized to zero. The default allocation function ters
provided by this library ensures this (see zutil.c). To reduce memory returned by zalloc for objects of exactly 65536 bytes *must* have their
requirements and avoid any allocation of 64K objects, at the expense of offset normalized to zero. The default allocation function provided by
compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h) this
. library ensures this (see zutil.c). To reduce memory requirements and a
void
The fields total_in and total_out can be used for statistics or any allocation of 64K objects, at the expense of compression ratio, comp
progress reports. After compression, total_in holds the total size of ile
the uncompressed data and may be saved for use in the decompressor the library with -DMAX_WBITS=14 (see zconf.h).
(particularly if the decompressor wants to decompress everything in
a single step). The fields total_in and total_out can be used for statistics or progre
ss
reports. After compression, total_in holds the total size of the
uncompressed data and may be saved for use in the decompressor (particul
arly
if the decompressor wants to decompress everything in a single step).
*/ */
/* constants */ /* constants */
#define Z_NO_FLUSH 0 #define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ #define Z_PARTIAL_FLUSH 1
#define Z_SYNC_FLUSH 2 #define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3 #define Z_FULL_FLUSH 3
#define Z_FINISH 4 #define Z_FINISH 4
#define Z_BLOCK 5 #define Z_BLOCK 5
#define Z_TREES 6
/* Allowed flush values; see deflate() and inflate() below for details */ /* Allowed flush values; see deflate() and inflate() below for details */
#define Z_OK 0 #define Z_OK 0
#define Z_STREAM_END 1 #define Z_STREAM_END 1
#define Z_NEED_DICT 2 #define Z_NEED_DICT 2
#define Z_ERRNO (-1) #define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2) #define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3) #define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4) #define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5) #define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6) #define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative /* Return codes for the compression/decompression functions. Negative value
* values are errors, positive values are used for special but normal event s
s. * are errors, positive values are used for special but normal events.
*/ */
#define Z_NO_COMPRESSION 0 #define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1 #define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9 #define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1) #define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */ /* compression levels */
#define Z_FILTERED 1 #define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2 #define Z_HUFFMAN_ONLY 2
skipping to change at line 213 skipping to change at line 216
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
#define zlib_version zlibVersion() #define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */ /* for compatibility with versions < 1.0.2 */
/* basic functions */ /* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void)); ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency . /* The application can compare zlibVersion and ZLIB_VERSION for consistency .
If the first character differs, the library code actually used is If the first character differs, the library code actually used is not
not compatible with the zlib.h header file used by the application. compatible with the zlib.h header file used by the application. This ch
This check is automatically made by deflateInit and inflateInit. eck
is automatically made by deflateInit and inflateInit.
*/ */
/* /*
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. zalloc, zfree and opaque must be initialized before by the caller. If
If zalloc and zfree are set to Z_NULL, deflateInit updates them to zalloc and zfree are set to Z_NULL, deflateInit updates them to use defa
use default allocation functions. ult
allocation functions.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at 1 gives best speed, 9 gives best compression, 0 gives no compression at
all (the input data is simply copied a block at a time). all
Z_DEFAULT_COMPRESSION requests a default compromise between speed and (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESS
compression (currently equivalent to level 6). ION
requests a default compromise between speed and compression (currently
equivalent to level 6).
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou
enough memory, Z_STREAM_ERROR if level is not a valid compression level, gh
memory, Z_STREAM_ERROR if level is not a valid compression level, or
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatib le Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatib le
with the version assumed by the caller (ZLIB_VERSION). with the version assumed by the caller (ZLIB_VERSION). msg is set to nu
msg is set to null if there is no error message. deflateInit does not ll
perform any compression: this will be done by deflate(). if there is no error message. deflateInit does not perform any compress
ion:
this will be done by deflate().
*/ */
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/* /*
deflate compresses as much data as possible, and stops when the input deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce buffer becomes empty or the output buffer becomes full. It may introduce
some some output latency (reading input without producing any output) except w
output latency (reading input without producing any output) except when hen
forced to flush. forced to flush.
The detailed semantics are as follows. deflate performs one or both of the The detailed semantics are as follows. deflate performs one or both of the
following actions: following actions:
- Compress more input starting at next_in and update next_in and avail_in - Compress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in and avail_in are updated and enough room in the output buffer), next_in and avail_in are updated and
processing will resume at this point for the next call of deflate(). processing will resume at this point for the next call of deflate().
- Provide more output starting at next_out and update next_out and avail_ out - Provide more output starting at next_out and update next_out and avail_ out
accordingly. This action is forced if the parameter flush is non zero. accordingly. This action is forced if the parameter flush is non zero.
Forcing flush frequently degrades the compression ratio, so this parame ter Forcing flush frequently degrades the compression ratio, so this parame ter
should be set only when necessary (in interactive applications). should be set only when necessary (in interactive applications). Some
Some output may be provided even if flush is not set. output may be provided even if flush is not set.
Before the call of deflate(), the application should ensure that at least Before the call of deflate(), the application should ensure that at lea
one of the actions is possible, by providing more input and/or consuming st
more output, and updating avail_in or avail_out accordingly; avail_out one of the actions is possible, by providing more input and/or consuming
should never be zero before the call. The application can consume the more
compressed output when it wants, for example when the output buffer is fu output, and updating avail_in or avail_out accordingly; avail_out should
ll never be zero before the call. The application can consume the compresse
(avail_out == 0), or after each call of deflate(). If deflate returns Z_O d
K output when it wants, for example when the output buffer is full (avail_o
and with zero avail_out, it must be called again after making room in the ut
output buffer because there might be more output pending. == 0), or after each call of deflate(). If deflate returns Z_OK and with
zero avail_out, it must be called again after making room in the output
buffer because there might be more output pending.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
decide how much data to accumualte before producing output, in order to decide how much data to accumulate before producing output, in order to
maximize compression. maximize compression.
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary , so flushed to the output buffer and the output is aligned on a byte boundary , so
that the decompressor can get all input data available so far. (In partic that the decompressor can get all input data available so far. (In
ular particular avail_in is zero after the call if enough output space has bee
avail_in is zero after the call if enough output space has been provided n
before the call.) Flushing may degrade compression for some compression provided before the call.) Flushing may degrade compression for some
algorithms and so it should be used only when necessary. compression algorithms and so it should be used only when necessary. Thi
s
completes the current deflate block and follows it with an empty stored b
lock
that is three bits plus filler bits to the next byte, followed by four by
tes
(00 00 ff ff).
If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to th
e
output buffer, but the output is not aligned to a byte boundary. All of
the
input data so far will be available to the decompressor, as for Z_SYNC_FL
USH.
This completes the current deflate block and follows it with an empty fix
ed
codes block that is 10 bits long. This assures that enough bytes are out
put
in order for the decompressor to finish the block before the empty fixed
code
block.
If flush is set to Z_BLOCK, a deflate block is completed and emitted, a
s
for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and u
p to
seven bits of the current block are held to be written as the next byte a
fter
the next deflate block is completed. In this case, the decompressor may
not
be provided enough bits at this point in order to complete decompression
of
the data provided so far to the compressor. It may need to wait for the
next
block to be emitted. This is for advanced applications that need to cont
rol
the emission of deflate blocks.
If flush is set to Z_FULL_FLUSH, all output is flushed as with If flush is set to Z_FULL_FLUSH, all output is flushed as with
Z_SYNC_FLUSH, and the compression state is reset so that decompression ca n Z_SYNC_FLUSH, and the compression state is reset so that decompression ca n
restart from this point if previous compressed data has been damaged or i f restart from this point if previous compressed data has been damaged or i f
random access is desired. Using Z_FULL_FLUSH too often can seriously degr ade random access is desired. Using Z_FULL_FLUSH too often can seriously deg rade
compression. compression.
If deflate returns with avail_out == 0, this function must be called ag ain If deflate returns with avail_out == 0, this function must be called ag ain
with the same value of the flush parameter and more output space (updated with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure tha t
avail_out is greater than six to avoid repeated flush markers due to avail_out is greater than six to avoid repeated flush markers due to
avail_out == 0 on return. avail_out == 0 on return.
If the parameter flush is set to Z_FINISH, pending input is processed, If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there pending output is flushed and deflate returns with Z_STREAM_END if there
was enough output space; if deflate returns with Z_OK, this function must was
be enough output space; if deflate returns with Z_OK, this function must be
called again with Z_FINISH and more output space (updated avail_out) but no called again with Z_FINISH and more output space (updated avail_out) but no
more input data, until it returns with Z_STREAM_END or an error. After more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the deflate has returned Z_STREAM_END, the only possible operations on the st
stream are deflateReset or deflateEnd. ream
are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compressi on Z_FINISH can be used immediately after deflateInit if all the compressi on
is to be done in a single step. In this case, avail_out must be at least is to be done in a single step. In this case, avail_out must be at least
the value returned by deflateBound (see below). If deflate does not retur the
n value returned by deflateBound (see below). Then deflate is guaranteed t
Z_STREAM_END, then it must be called again as described above. o
return Z_STREAM_END. If not enough output space is provided, deflate wil
l
not return Z_STREAM_END, and it must be called again as described above.
deflate() sets strm->adler to the adler32 checksum of all input read deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes). so far (that is, total_in bytes).
deflate() may update strm->data_type if it can make a good guess about deflate() may update strm->data_type if it can make a good guess about
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considere the input data type (Z_BINARY or Z_TEXT). In doubt, the data is consider
d ed
binary. This field is only for information purposes and does not affect binary. This field is only for information purposes and does not affect
the compression algorithm in any manner. the
compression algorithm in any manner.
deflate() returns Z_OK if some progress has been made (more input deflate() returns Z_OK if some progress has been made (more input
processed or more output produced), Z_STREAM_END if all input has been processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for examp le Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for examp le
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possibl
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is no e
t (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is n
ot
fatal, and deflate() can be called again with more input and more output fatal, and deflate() can be called again with more input and more output
space to continue compressing. space to continue compressing.
*/ */
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/* /*
All dynamically allocated data structures for this stream are freed. All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any This function discards any unprocessed input and does not flush any pend
pending output. ing
output.
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
stream state was inconsistent, Z_DATA_ERROR if the stream was freed stream state was inconsistent, Z_DATA_ERROR if the stream was freed
prematurely (some input or output was discarded). In the error case, prematurely (some input or output was discarded). In the error case, ms
msg may be set but then points to a static string (which must not be g
may be set but then points to a static string (which must not be
deallocated). deallocated).
*/ */
/* /*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before b y next_in, avail_in, zalloc, zfree and opaque must be initialized before b y
the caller. If next_in is not Z_NULL and avail_in is large enough (the e the caller. If next_in is not Z_NULL and avail_in is large enough (the
xact exact value depends on the compression method), inflateInit determines t
value depends on the compression method), inflateInit determines the he
compression method from the zlib header and allocates all data structure s compression method from the zlib header and allocates all data structure s
accordingly; otherwise the allocation will be deferred to the first call of accordingly; otherwise the allocation will be deferred to the first call of
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates the m to inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates the m to
use default allocation functions. use default allocation functions.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou gh inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou gh
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
version assumed by the caller. msg is set to null if there is no error version assumed by the caller, or Z_STREAM_ERROR if the parameters are
message. inflateInit does not perform any decompression apart from readi invalid, such as a null pointer to the structure. msg is set to null if
ng there is no error message. inflateInit does not perform any decompressi
the zlib header if present: this will be done by inflate(). (So next_in on
and apart from possibly reading the zlib header if present: actual decompres
avail_in may be modified, but next_out and avail_out are unchanged.) sion
will be done by inflate(). (So next_in and avail_in may be modified, bu
t
next_out and avail_out are unused and unchanged.) The current implementa
tion
of inflateInit() does not process any header information -- that is defe
rred
until inflate() is called.
*/ */
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
/* /*
inflate decompresses as much data as possible, and stops when the input inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce buffer becomes empty or the output buffer becomes full. It may introduce
some output latency (reading input without producing any output) except w hen some output latency (reading input without producing any output) except w hen
forced to flush. forced to flush.
The detailed semantics are as follows. inflate performs one or both of th e The detailed semantics are as follows. inflate performs one or both of t he
following actions: following actions:
- Decompress more input starting at next_in and update next_in and avail_ in - Decompress more input starting at next_in and update next_in and avail_ in
accordingly. If not all input can be processed (because there is not accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in is updated and processing enough room in the output buffer), next_in is updated and processing wi
will resume at this point for the next call of inflate(). ll
resume at this point for the next call of inflate().
- Provide more output starting at next_out and update next_out and avail_ out - Provide more output starting at next_out and update next_out and avail_ out
accordingly. inflate() provides as much output as possible, until ther accordingly. inflate() provides as much output as possible, until ther
e e is
is no more input data or no more space in the output buffer (see below no more input data or no more space in the output buffer (see below abo
about the flush parameter). ut
the flush parameter).
Before the call of inflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming Before the call of inflate(), the application should ensure that at lea
more output, and updating the next_* and avail_* values accordingly. st
The application can consume the uncompressed output when it wants, for one of the actions is possible, by providing more input and/or consuming
example when the output buffer is full (avail_out == 0), or after each more
call of inflate(). If inflate returns Z_OK and with zero avail_out, it output, and updating the next_* and avail_* values accordingly. The
must be called again after making room in the output buffer because there application can consume the uncompressed output when it wants, for exampl
might be more output pending. e
when the output buffer is full (avail_out == 0), or after each call of
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, inflate(). If inflate returns Z_OK and with zero avail_out, it must be
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much called again after making room in the output buffer because there might b
output as possible to the output buffer. Z_BLOCK requests that inflate() e
stop more output pending.
if and when it gets to the next deflate block boundary. When decoding the
zlib or gzip format, this will cause inflate() to return immediately afte The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FIN
r ISH,
the header and before the first block. When doing a raw inflate, inflate( Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
) output as possible to the output buffer. Z_BLOCK requests that inflate()
will go ahead and process the first block, and will return when it gets t stop if and when it gets to the next deflate block boundary. When decodi
o ng
the end of that block, or when it runs out of data. the zlib or gzip format, this will cause inflate() to return immediately
after the header and before the first block. When doing a raw inflate,
inflate() will go ahead and process the first block, and will return when
it
gets to the end of that block, or when it runs out of data.
The Z_BLOCK option assists in appending to or combining deflate streams . The Z_BLOCK option assists in appending to or combining deflate streams .
Also to assist in this, on return inflate() will set strm->data_type to t he Also to assist in this, on return inflate() will set strm->data_type to t he
number of unused bits in the last byte taken from strm->next_in, plus 64 number of unused bits in the last byte taken from strm->next_in, plus 64
if inflate() is currently decoding the last block in the deflate stream, if
plus 128 if inflate() returned immediately after decoding an end-of-block inflate() is currently decoding the last block in the deflate stream, plu
code or decoding the complete header up to just before the first byte of s
the 128 if inflate() returned immediately after decoding an end-of-block code
deflate stream. The end-of-block will not be indicated until all of the or
uncompressed data from that block has been written to strm->next_out. Th decoding the complete header up to just before the first byte of the defl
e ate
number of unused bits may in general be greater than seven, except when stream. The end-of-block will not be indicated until all of the uncompre
bit 7 of data_type is set, in which case the number of unused bits will b ssed
e data from that block has been written to strm->next_out. The number of
less than eight. unused bits may in general be greater than seven, except when bit 7 of
data_type is set, in which case the number of unused bits will be less th
an
eight. data_type is set as noted here every time inflate() returns for a
ll
flush options, and so can be used to determine the amount of currently
consumed input in bits.
The Z_TREES option behaves as Z_BLOCK does, but it also returns when th
e
end of each deflate block header is reached, before any actual data in th
at
block is decoded. This allows the caller to determine the length of the
deflate block header for later use in random access within a deflate bloc
k.
256 is added to the value of strm->data_type when inflate() returns
immediately after reaching the end of the deflate block header.
inflate() should normally be called until it returns Z_STREAM_END or an inflate() should normally be called until it returns Z_STREAM_END or an
error. However if all decompression is to be performed in a single step error. However if all decompression is to be performed in a single step
(a single call of inflate), the parameter flush should be set to (a
Z_FINISH. In this case all pending input is processed and all pending single call of inflate), the parameter flush should be set to Z_FINISH.
output is flushed; avail_out must be large enough to hold all the In
uncompressed data. (The size of the uncompressed data may have been saved this case all pending input is processed and all pending output is flushe
by the compressor for this purpose.) The next operation on this stream mu d;
st avail_out must be large enough to hold all of the uncompressed data for t
be inflateEnd to deallocate the decompression state. The use of Z_FINISH he
is never required, but can be used to inform inflate that a faster approa operation to complete. (The size of the uncompressed data may have been
ch saved by the compressor for this purpose.) The use of Z_FINISH is not
may be used for the single inflate() call. required to perform an inflation in one step. However it may be used to
inform inflate that a faster approach can be used for the single inflate(
)
call. Z_FINISH also informs inflate to not maintain a sliding window if
the
stream completes, which reduces inflate's memory footprint. If the strea
m
does not complete, either because not all of the stream is provided or no
t
enough output space is provided, then a sliding window will be allocated
and
inflate() can be called again to continue the operation as if Z_NO_FLUSH
had
been used.
In this implementation, inflate() always flushes as much output as In this implementation, inflate() always flushes as much output as
possible to the output buffer, and always uses the faster approach on the possible to the output buffer, and always uses the faster approach on the
first call. So the only effect of the flush parameter in this implementat first call. So the effects of the flush parameter in this implementation
ion are
is on the return value of inflate(), as noted below, or when it returns e on the return value of inflate() as noted below, when inflate() returns e
arly arly
because Z_BLOCK is used. when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation
of
memory for a sliding window when Z_FINISH is used.
If a preset dictionary is needed after this call (see inflateSetDictio nary If a preset dictionary is needed after this call (see inflateSetDictio nary
below), inflate sets strm->adler to the adler32 checksum of the dictionar y below), inflate sets strm->adler to the Adler-32 checksum of the dictiona ry
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
strm->adler to the adler32 checksum of all output produced so far (that i s, strm->adler to the Adler-32 checksum of all output produced so far (that is,
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as descr ibed total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as descr ibed
below. At the end of the stream, inflate() checks that its computed adler 32 below. At the end of the stream, inflate() checks that its computed adle r32
checksum is equal to that saved by the compressor and returns Z_STREAM_EN D checksum is equal to that saved by the compressor and returns Z_STREAM_EN D
only if the checksum is correct. only if the checksum is correct.
inflate() will decompress and check either zlib-wrapped or gzip-wrapped inflate() can decompress and check either zlib-wrapped or gzip-wrapped
deflate data. The header type is detected automatically. Any informatio deflate data. The header type is detected automatically, if requested wh
n en
contained in the gzip header is not retained, so applications that need t initializing with inflateInit2(). Any information contained in the gzip
hat header is not retained, so applications that need that information should
information should instead use raw inflate, see inflateInit2() below, or instead use raw inflate, see inflateInit2() below, or inflateBack() and
inflateBack() and perform their own processing of the gzip header and perform their own processing of the gzip header and trailer. When proces
trailer. sing
gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the outp
ut
producted so far. The CRC-32 is checked against the gzip trailer.
inflate() returns Z_OK if some progress has been made (more input proce ssed inflate() returns Z_OK if some progress has been made (more input proce ssed
or more output produced), Z_STREAM_END if the end of the compressed data has or more output produced), Z_STREAM_END if the end of the compressed data has
been reached and all uncompressed output has been produced, Z_NEED_DICT i f a been reached and all uncompressed output has been produced, Z_NEED_DICT i f a
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
corrupted (input stream not conforming to the zlib format or incorrect ch eck corrupted (input stream not conforming to the zlib format or incorrect ch eck
value), Z_STREAM_ERROR if the stream structure was inconsistent (for exam ple value), Z_STREAM_ERROR if the stream structure was inconsistent (for exam ple
if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough mem ory, next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memo ry,
Z_BUF_ERROR if no progress is possible or if there was not enough room in the Z_BUF_ERROR if no progress is possible or if there was not enough room in the
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
inflate() can be called again with more input and more output space to inflate() can be called again with more input and more output space to
continue decompressing. If Z_DATA_ERROR is returned, the application may continue decompressing. If Z_DATA_ERROR is returned, the application may
then then call inflateSync() to look for a good compression block if a partial
call inflateSync() to look for a good compression block if a partial reco recovery of the data is desired.
very
of the data is desired.
*/ */
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
/* /*
All dynamically allocated data structures for this stream are freed. All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any This function discards any unprocessed input and does not flush any pend
pending output. ing
output.
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
was inconsistent. In the error case, msg may be set but then points to a was inconsistent. In the error case, msg may be set but then points to a
static string (which must not be deallocated). static string (which must not be deallocated).
*/ */
/* Advanced functions */ /* Advanced functions */
/* /*
The following functions are needed only in some special applications. The following functions are needed only in some special applications.
*/ */
/* /*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level, int level,
int method, int method,
int windowBits, int windowBits,
int memLevel, int memLevel,
int strategy)); int strategy));
This is another version of deflateInit with more compression options. This is another version of deflateInit with more compression options.
The The
fields next_in, zalloc, zfree and opaque must be initialized before by fields next_in, zalloc, zfree and opaque must be initialized before by t
the caller. he
caller.
The method parameter is the compression method. It must be Z_DEFLATED in The method parameter is the compression method. It must be Z_DEFLATED in
this version of the library. this version of the library.
The windowBits parameter is the base two logarithm of the window size The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for th (the size of the history buffer). It should be in the range 8..15 for t
is his
version of the library. Larger values of this parameter result in better version of the library. Larger values of this parameter result in bette
compression at the expense of memory usage. The default value is 15 if r
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead. deflateInit is used instead.
windowBits can also be -8..-15 for raw deflate. In this case, -windowB windowBits can also be -8..-15 for raw deflate. In this case, -window
its Bits
determines the window size. deflate() will then generate raw deflate dat determines the window size. deflate() will then generate raw deflate da
a ta
with no zlib header or trailer, and will not compute an adler32 check va lue. with no zlib header or trailer, and will not compute an adler32 check va lue.
windowBits can also be greater than 15 for optional gzip encoding. Add windowBits can also be greater than 15 for optional gzip encoding. Ad d
16 to windowBits to write a simple gzip header and trailer around the 16 to windowBits to write a simple gzip header and trailer around the
compressed data instead of a zlib wrapper. The gzip header will have no compressed data instead of a zlib wrapper. The gzip header will have no
file name, no extra data, no comment, no modification time (set to zero) file name, no extra data, no comment, no modification time (set to zero)
, , no
no header crc, and the operating system will be set to 255 (unknown). I header crc, and the operating system will be set to 255 (unknown). If a
f a
gzip stream is being written, strm->adler is a crc32 instead of an adler 32. gzip stream is being written, strm->adler is a crc32 instead of an adler 32.
The memLevel parameter specifies how much memory should be allocated The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but for the internal compression state. memLevel=1 uses minimum memory but
is slow and reduces compression ratio; memLevel=9 uses maximum memory is
for optimal speed. The default value is 8. See zconf.h for total memory slow and reduces compression ratio; memLevel=9 uses maximum memory for
usage as a function of windowBits and memLevel. optimal speed. The default value is 8. See zconf.h for total memory us
age
as a function of windowBits and memLevel.
The strategy parameter is used to tune the compression algorithm. Use the The strategy parameter is used to tune the compression algorithm. Use the
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced b y a value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced b y a
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
string match), or Z_RLE to limit match distances to one (run-length string match), or Z_RLE to limit match distances to one (run-length
encoding). Filtered data consists mostly of small values with a somewhat encoding). Filtered data consists mostly of small values with a somewha
random distribution. In this case, the compression algorithm is tuned to t
compress them better. The effect of Z_FILTERED is to force more Huffman random distribution. In this case, the compression algorithm is tuned t
o
compress them better. The effect of Z_FILTERED is to force more Huffman
coding and less string matching; it is somewhat intermediate between coding and less string matching; it is somewhat intermediate between
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost a
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The stra s
tegy fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.
parameter only affects the compression ratio but not the correctness of The
the strategy parameter only affects the compression ratio but not the
compressed output even if it is not set appropriately. Z_FIXED prevents correctness of the compressed output even if it is not set appropriately
the .
use of dynamic Huffman codes, allowing for a simpler decoder for special Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simple
applications. r
decoder for special applications.
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not en
ough deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid ugh
method). msg is set to null if there is no error message. deflateInit2 memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
does method), or Z_VERSION_ERROR if the zlib library version (zlib_version) i
not perform any compression: this will be done by deflate(). s
incompatible with the version assumed by the caller (ZLIB_VERSION). msg
is
set to null if there is no error message. deflateInit2 does not perform
any
compression: this will be done by deflate().
*/ */
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary, const Bytef *dictionary,
uInt dictLength)); uInt dictLength));
/* /*
Initializes the compression dictionary from the given byte sequence Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called without producing any compressed output. When using the zlib format, th
immediately after deflateInit, deflateInit2 or deflateReset, before any is
call of deflate. The compressor and decompressor must use exactly the sa function must be called immediately after deflateInit, deflateInit2 or
me deflateReset, and before any call of deflate. When doing raw deflate, t
dictionary (see inflateSetDictionary). his
function must be called either before any call of deflate, or immediatel
y
after the completion of a deflate block, i.e. after all input has been
consumed and all output has been delivered when using any of the flush
options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
compressor and decompressor must use exactly the same dictionary (see
inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are lik ely The dictionary should consist of strings (byte sequences) that are lik ely
to be encountered later in the data to be compressed, with the most comm only to be encountered later in the data to be compressed, with the most comm only
used strings preferably put towards the end of the dictionary. Using a used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and ca n be dictionary is most useful when the data to be compressed is short and ca n be
predicted with good accuracy; the data can then be compressed better tha n predicted with good accuracy; the data can then be compressed better tha n
with the default empty dictionary. with the default empty dictionary.
Depending on the size of the compression data structures selected by Depending on the size of the compression data structures selected by
deflateInit or deflateInit2, a part of the dictionary may in effect be deflateInit or deflateInit2, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size discarded, for example if the dictionary is larger than the window size
in provided in deflateInit or deflateInit2. Thus the strings most likely t
deflate or deflate2. Thus the strings most likely to be useful should be o be
put at the end of the dictionary, not at the front. In addition, the useful should be put at the end of the dictionary, not at the front. In
current implementation of deflate will use at most the window size minus addition, the current implementation of deflate will use at most the win
262 bytes of the provided dictionary. dow
size minus 262 bytes of the provided dictionary.
Upon return of this function, strm->adler is set to the adler32 value Upon return of this function, strm->adler is set to the adler32 value
of the dictionary; the decompressor may later use this value to determin e of the dictionary; the decompressor may later use this value to determin e
which dictionary has been used by the compressor. (The adler32 value which dictionary has been used by the compressor. (The adler32 value
applies to the whole dictionary even if only a subset of the dictionary is applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.) If a raw deflate was requested, then t he actually used by the compressor.) If a raw deflate was requested, then t he
adler32 value is not computed and strm->adler is not set. adler32 value is not computed and strm->adler is not set.
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent (for example if deflate has already been called for this st ream inconsistent (for example if deflate has already been called for this st ream
or if the compression method is bsort). deflateSetDictionary does not or if not at a block boundary for raw deflate). deflateSetDictionary do
perform any compression: this will be done by deflate(). es
not perform any compression: this will be done by deflate().
*/ */
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source)); z_streamp source));
/* /*
Sets the destination stream as a complete copy of the source stream. Sets the destination stream as a complete copy of the source stream.
This function can be useful when several compression strategies will b e This function can be useful when several compression strategies will b e
tried, for example when there are several ways of pre-processing the inp ut tried, for example when there are several ways of pre-processing the inp ut
data with a filter. The streams that will be discarded should then be fr eed data with a filter. The streams that will be discarded should then be f reed
by calling deflateEnd. Note that deflateCopy duplicates the internal by calling deflateEnd. Note that deflateCopy duplicates the internal
compression state which can be quite large, so this strategy is slow and compression state which can be quite large, so this strategy is slow and
can consume lots of memory. can
consume lots of memory.
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t
(such as zalloc being NULL). msg is left unchanged in both source and (such as zalloc being Z_NULL). msg is left unchanged in both source and
destination. destination.
*/ */
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/* /*
This function is equivalent to deflateEnd followed by deflateInit, This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state. but does not free and reallocate all the internal compression state. Th
The stream will keep the same compression level and any other attributes e
that may have been set by deflateInit2. stream will keep the same compression level and any other attributes tha
t
may have been set by deflateInit2.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being NULL). stream state was inconsistent (such as zalloc or state being Z_NULL).
*/ */
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
int level, int level,
int strategy)); int strategy));
/* /*
Dynamically update the compression level and compression strategy. Th e Dynamically update the compression level and compression strategy. Th e
interpretation of level and strategy is as in deflateInit2. This can be interpretation of level and strategy is as in deflateInit2. This can be
used to switch between compression and straight copy of the input data, or used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different to switch to a different kind of input data requiring a different strate
strategy. If the compression level is changed, the input available so fa gy.
r If the compression level is changed, the input available so far is
is compressed with the old level (and may be flushed); the new level wil compressed with the old level (and may be flushed); the new level will t
l ake
take effect only at the next call of deflate(). effect only at the next call of deflate().
Before the call of deflateParams, the stream state must be set as for Before the call of deflateParams, the stream state must be set as for
a call of deflate(), since the currently available input may have to a call of deflate(), since the currently available input may have to be
be compressed and flushed. In particular, strm->avail_out must be non-ze compressed and flushed. In particular, strm->avail_out must be non-zero
ro. .
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
if strm->avail_out was zero. if
strm->avail_out was zero.
*/ */
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
int good_length, int good_length,
int max_lazy, int max_lazy,
int nice_length, int nice_length,
int max_chain)); int max_chain));
/* /*
Fine tune deflate's internal compression parameters. This should only be Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for used by someone who understands the algorithm used by zlib's deflate for
skipping to change at line 642 skipping to change at line 694
max_lazy, good_length, nice_length, and max_chain parameters. max_lazy, good_length, nice_length, and max_chain parameters.
deflateTune() can be called after deflateInit() or deflateInit2(), and deflateTune() can be called after deflateInit() or deflateInit2(), and
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream . returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream .
*/ */
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
uLong sourceLen)); uLong sourceLen));
/* /*
deflateBound() returns an upper bound on the compressed size after deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit() deflation of sourceLen bytes. It must be called after deflateInit() or
or deflateInit2(). This would be used to allocate an output buffer deflateInit2(), and after deflateSetHeader(), if used. This would be us
for deflation in a single pass, and so would be called before deflate(). ed
*/ to allocate an output buffer for deflation in a single pass, and so woul
d be
called before deflate(). If that first deflate() call is provided the
sourceLen input bytes, an output buffer allocated to the size returned b
y
deflateBound(), and the flush value Z_FINISH, then deflate() is guarante
ed
to return Z_STREAM_END. Note that it is possible for the compressed siz
e to
be larger than the value returned by deflateBound() if flush options oth
er
than Z_FINISH or Z_NO_FLUSH are used.
*/
ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
unsigned *pending,
int *bits));
/*
deflatePending() returns the number of bytes and bits of output that h
ave
been generated, but not yet provided in the available output. The bytes
not
provided would be due to the available output space having being consume
d.
The number of bits of output not provided are between 0 and 7, where the
y
await more bits to join them in order to fill out a full byte. If pendi
ng
or bits are Z_NULL, then those values are not set.
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the sourc
e
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
int bits, int bits,
int value)); int value));
/* /*
deflatePrime() inserts bits in the deflate output stream. The intent deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the is that this function is used to start off the deflate output with the b
bits leftover from a previous deflate stream when appending to it. As su its
ch, leftover from a previous deflate stream when appending to it. As such,
this function can only be used for raw deflate, and must be used before t this
he function can only be used for raw deflate, and must be used before the f
first deflate() call after a deflateInit2() or deflateReset(). bits must irst
be deflate() call after a deflateInit2() or deflateReset(). bits must be l
less than or equal to 16, and that many of the least significant bits of ess
value will be inserted in the output. than or equal to 16, and that many of the least significant bits of valu
e
deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source will be inserted in the output.
stream state was inconsistent.
deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not eno
ugh
room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
source stream state was inconsistent.
*/ */
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gz_headerp head)); gz_headerp head));
/* /*
deflateSetHeader() provides gzip header information for when a gzip deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called stream is requested by deflateInit2(). deflateSetHeader() may be called
after deflateInit2() or deflateReset() and before the first call of after deflateInit2() or deflateReset() and before the first call of
deflate(). The text, time, os, extra field, name, and comment informati on deflate(). The text, time, os, extra field, name, and comment informati on
in the provided gz_header structure are written to the gzip header (xfla g is in the provided gz_header structure are written to the gzip header (xfla g is
ignored -- the extra flags are set according to the compression level). The ignored -- the extra flags are set according to the compression level). The
caller must assure that, if not Z_NULL, name and comment are terminated with caller must assure that, if not Z_NULL, name and comment are terminated with
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
available there. If hcrc is true, a gzip header crc is included. Note that available there. If hcrc is true, a gzip header crc is included. Note that
the current versions of the command-line version of gzip (up through ver sion the current versions of the command-line version of gzip (up through ver sion
1.3.x) do not support header crc's, and will report that it is a "multi- part 1.3.x) do not support header crc's, and will report that it is a "multi- part
gzip file" and give up. gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text fal se, If deflateSetHeader is not used, the default gzip header has text fals e,
the time set to zero, and os set to 255, with no extra, name, or comment the time set to zero, and os set to 255, with no extra, name, or comment
fields. The gzip header is returned to the default state by deflateRese t(). fields. The gzip header is returned to the default state by deflateRese t().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the so urce deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the sou rce
stream state was inconsistent. stream state was inconsistent.
*/ */
/* /*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits)); int windowBits));
This is another version of inflateInit with an extra parameter. The This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized fields next_in, avail_in, zalloc, zfree and opaque must be initialized
before by the caller. before by the caller.
The windowBits parameter is the base two logarithm of the maximum wind ow The windowBits parameter is the base two logarithm of the maximum wind ow
size (the size of the history buffer). It should be in the range 8..15 for size (the size of the history buffer). It should be in the range 8..15 for
this version of the library. The default value is 15 if inflateInit is u this version of the library. The default value is 15 if inflateInit is
sed used
instead. windowBits must be greater than or equal to the windowBits valu instead. windowBits must be greater than or equal to the windowBits val
e ue
provided to deflateInit2() while compressing, or it must be equal to 15 if provided to deflateInit2() while compressing, or it must be equal to 15 if
deflateInit2() was not used. If a compressed stream with a larger window deflateInit2() was not used. If a compressed stream with a larger windo w
size is given as input, inflate() will return with the error code size is given as input, inflate() will return with the error code
Z_DATA_ERROR instead of trying to allocate a larger window. Z_DATA_ERROR instead of trying to allocate a larger window.
windowBits can also be -8..-15 for raw inflate. In this case, -windowB windowBits can also be zero to request that inflate use the window siz
its e in
determines the window size. inflate() will then process raw deflate data the zlib header of the compressed stream.
,
windowBits can also be -8..-15 for raw inflate. In this case, -window
Bits
determines the window size. inflate() will then process raw deflate dat
a,
not looking for a zlib or gzip header, not generating a check value, and not not looking for a zlib or gzip header, not generating a check value, and not
looking for any check values for comparison at the end of the stream. Th is looking for any check values for comparison at the end of the stream. T his
is for use with other formats that use the deflate compressed data forma t is for use with other formats that use the deflate compressed data forma t
such as zip. Those formats provide their own check values. If a custom such as zip. Those formats provide their own check values. If a custom
format is developed using the raw deflate format for compressed data, it is format is developed using the raw deflate format for compressed data, it is
recommended that a check value such as an adler32 or a crc32 be applied to recommended that a check value such as an adler32 or a crc32 be applied to
the uncompressed data as is done in the zlib, gzip, and zip formats. Fo r the uncompressed data as is done in the zlib, gzip, and zip formats. Fo r
most applications, the zlib format should be used as is. Note that comme nts most applications, the zlib format should be used as is. Note that comm ents
above on the use in deflateInit2() applies to the magnitude of windowBit s. above on the use in deflateInit2() applies to the magnitude of windowBit s.
windowBits can also be greater than 15 for optional gzip decoding. Add windowBits can also be greater than 15 for optional gzip decoding. Ad d
32 to windowBits to enable zlib and gzip decoding with automatic header 32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format wil l detection, or add 16 to decode only the gzip format (the zlib format wil l
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler
is is a
a crc32 instead of an adler32. crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno ugh inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno ugh
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). memory, Z_VERSION_ERROR if the zlib library version is incompatible with
msg the
is set to null if there is no error message. inflateInit2 does not perf version assumed by the caller, or Z_STREAM_ERROR if the parameters are
orm invalid, such as a null pointer to the structure. msg is set to null if
any decompression apart from reading the zlib header if present: this wi there is no error message. inflateInit2 does not perform any decompress
ll ion
be done by inflate(). (So next_in and avail_in may be modified, but next apart from possibly reading the zlib header if present: actual decompres
_out sion
and avail_out are unchanged.) will be done by inflate(). (So next_in and avail_in may be modified, bu
t
next_out and avail_out are unused and unchanged.) The current implementa
tion
of inflateInit2() does not process any header information -- that is
deferred until inflate() is called.
*/ */
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary, const Bytef *dictionary,
uInt dictLength)); uInt dictLength));
/* /*
Initializes the decompression dictionary from the given uncompressed b yte Initializes the decompression dictionary from the given uncompressed b yte
sequence. This function must be called immediately after a call of infla sequence. This function must be called immediately after a call of infl
te, ate,
if that call returned Z_NEED_DICT. The dictionary chosen by the compress if that call returned Z_NEED_DICT. The dictionary chosen by the compres
or sor
can be determined from the adler32 value returned by that call of inflat e. can be determined from the adler32 value returned by that call of inflat e.
The compressor and decompressor must use exactly the same dictionary (se e The compressor and decompressor must use exactly the same dictionary (se e
deflateSetDictionary). For raw inflate, this function can be called deflateSetDictionary). For raw inflate, this function can be called at
immediately after inflateInit2() or inflateReset() and before any call o any
f time to set the dictionary. If the provided dictionary is smaller than
inflate() to set the dictionary. The application must insure that the the
dictionary that was used for compression is provided. window and there is already data in the window, then the provided dictio
nary
will amend what's there. The application must insure that the dictionar
y
that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
expected one (incorrect adler32 value). inflateSetDictionary does not expected one (incorrect adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of perform any decompression: this will be done by subsequent calls of
inflate(). inflate().
*/ */
ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
Bytef *dictionary,
uInt *dictLength));
/*
Returns the sliding dictionary being maintained by inflate. dictLengt
h is
set to the number of bytes in the dictionary, and that many bytes are co
pied
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If inflateGetDictionary() is called with dictionary equa
l to
Z_NULL, then only the dictionary length is returned, and nothing is copi
ed.
Similary, if dictLength is Z_NULL, then it is not set.
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
stream state is inconsistent.
*/
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/* /*
Skips invalid compressed data until a full flush point (see above the Skips invalid compressed data until a possible full flush point (see a
description of deflate with Z_FULL_FLUSH) can be found, or until all bove
available input is skipped. No output is provided. for the description of deflate with Z_FULL_FLUSH) can be found, or until
all
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ER available input is skipped. No output is provided.
ROR
if no more input was provided, Z_DATA_ERROR if no flush point has been fo inflateSync searches for a 00 00 FF FF pattern in the compressed data.
und, All full flush points have this pattern, but not all occurrences of this
or Z_STREAM_ERROR if the stream structure was inconsistent. In the succes pattern are full flush points.
s
case, the application may save the current current value of total_in whic inflateSync returns Z_OK if a possible full flush point has been found
h ,
indicates where valid compressed data was found. In the error case, the Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush poin
application may repeatedly call inflateSync, providing more input each ti t
me, has been found, or Z_STREAM_ERROR if the stream structure was inconsiste
until success or end of the input data. nt.
In the success case, the application may save the current current value
of
total_in which indicates where valid compressed data was found. In the
error case, the application may repeatedly call inflateSync, providing m
ore
input each time, until success or end of the input data.
*/ */
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
z_streamp source)); z_streamp source));
/* /*
Sets the destination stream as a complete copy of the source stream. Sets the destination stream as a complete copy of the source stream.
This function can be useful when randomly accessing a large stream. T he This function can be useful when randomly accessing a large stream. T he
first pass through the stream can periodically record the inflate state, first pass through the stream can periodically record the inflate state,
allowing restarting inflate at those points when randomly accessing the allowing restarting inflate at those points when randomly accessing the
stream. stream.
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t
(such as zalloc being NULL). msg is left unchanged in both source and (such as zalloc being Z_NULL). msg is left unchanged in both source and
destination. destination.
*/ */
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/* /*
This function is equivalent to inflateEnd followed by inflateInit, This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state. but does not free and reallocate all the internal decompression state.
The stream will keep attributes that may have been set by inflateInit2. The
stream will keep attributes that may have been set by inflateInit2.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
stream state was inconsistent (such as zalloc or state being NULL). int windowBits));
/*
This function is the same as inflateReset, but it also permits changin
g
the wrap and window size requests. The windowBits parameter is interpre
ted
the same as it is for inflateInit2.
inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL), or
if
the windowBits parameter is invalid.
*/ */
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
int bits, int bits,
int value)); int value));
/* /*
This function inserts bits in the inflate input stream. The intent is This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the that this function is used to start inflating at a bit position in the
middle of a byte. The provided bits will be used before any bytes are us middle of a byte. The provided bits will be used before any bytes are u
ed sed
from next_in. This function should only be used with raw inflate, and from next_in. This function should only be used with raw inflate, and
should be used before the first inflate() call after inflateInit2() or should be used before the first inflate() call after inflateInit2() or
inflateReset(). bits must be less than or equal to 16, and that many of inflateReset(). bits must be less than or equal to 16, and that many of
the the
least significant bits of value will be inserted in the input. least significant bits of value will be inserted in the input.
If bits is negative, then the input stream bit buffer is emptied. The
n
inflatePrime() can be called again to put bits in the buffer. This is u
sed
to clear out bits leftover after feeding inflate a block description pri
or
to feeding inflate codes.
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent. stream state was inconsistent.
*/ */
ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
/*
This function returns two values, one in the lower 16 bits of the retu
rn
value, and the other in the remaining upper bits, obtained by shifting t
he
return value down 16 bits. If the upper value is -1 and the lower value
is
zero, then inflate() is currently decoding information outside of a bloc
k.
If the upper value is -1 and the lower value is non-zero, then inflate i
s in
the middle of a stored block, with the lower value equaling the number o
f
bytes from the input remaining to copy. If the upper value is not -1, t
hen
it is the number of bits back from the current bit position in the input
of
the code (literal or length/distance pair) currently being processed. I
n
that case the lower value is the number of bytes already emitted for tha
t
code.
A code is being processed if inflate is waiting for more input to comp
lete
decoding of the code, or if it has completed decoding but is waiting for
more output space to write the literal or match data.
inflateMark() is used to mark locations in the input data for random
access, which may be at bit positions, and to note those cases where the
output of a code may span boundaries of random access blocks. The curre
nt
location in the input stream can be determined from avail_in and data_ty
pe
as noted in the description for the Z_BLOCK flush parameter for inflate.
inflateMark returns the value noted above or -1 << 16 if the provided
source stream state was inconsistent.
*/
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
gz_headerp head)); gz_headerp head));
/* /*
inflateGetHeader() requests that gzip header information be stored in the inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after provided gz_header structure. inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate() . inflateInit2() or inflateReset(), and before the first call of inflate() .
As inflate() processes the gzip stream, head->done is zero until the hea der As inflate() processes the gzip stream, head->done is zero until the hea der
is completed, at which time head->done is set to one. If a zlib stream is is completed, at which time head->done is set to one. If a zlib stream is
being decoded, then head->done is set to -1 to indicate that there will be being decoded, then head->done is set to -1 to indicate that there will be
no gzip header information forthcoming. Note that Z_BLOCK can be used t no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES ca
o n be
force inflate() to return immediately after header processing is complet used to force inflate() to return immediately after header processing is
e complete and before any actual data is decompressed.
and before any actual data is decompressed.
The text, time, xflags, and os fields are filled in with the gzip hea der The text, time, xflags, and os fields are filled in with the gzip head er
contents. hcrc is set to true if there is a header CRC. (The header CR C contents. hcrc is set to true if there is a header CRC. (The header CR C
was valid if done is set to one.) If extra is not Z_NULL, then extra_ma x was valid if done is set to one.) If extra is not Z_NULL, then extra_max
contains the maximum number of bytes to write to extra. Once done is tr ue, contains the maximum number of bytes to write to extra. Once done is tr ue,
extra_len contains the actual extra field length, and extra contains the extra_len contains the actual extra field length, and extra contains the
extra field, or that field truncated if extra_max is less than extra_len . extra field, or that field truncated if extra_max is less than extra_len .
If name is not Z_NULL, then up to name_max characters are written there, If name is not Z_NULL, then up to name_max characters are written there,
terminated with a zero unless the length is greater than name_max. If terminated with a zero unless the length is greater than name_max. If
comment is not Z_NULL, then up to comm_max characters are written there, comment is not Z_NULL, then up to comm_max characters are written there,
terminated with a zero unless the length is greater than comm_max. When terminated with a zero unless the length is greater than comm_max. When
any of extra, name, or comment are not Z_NULL and the respective field i any
s of extra, name, or comment are not Z_NULL and the respective field is no
not present in the header, then that field is set to Z_NULL to signal it t
s present in the header, then that field is set to Z_NULL to signal its
absence. This allows the use of deflateSetHeader() with the returned absence. This allows the use of deflateSetHeader() with the returned
structure to duplicate the header. However if those fields are set to structure to duplicate the header. However if those fields are set to
allocated memory, then the application will need to save those pointers allocated memory, then the application will need to save those pointers
elsewhere so that they can be eventually freed. elsewhere so that they can be eventually freed.
If inflateGetHeader is not used, then the header information is simpl y If inflateGetHeader is not used, then the header information is simply
discarded. The header is always checked for validity, including the hea der discarded. The header is always checked for validity, including the hea der
CRC if present. inflateReset() will reset the process to discard the he ader CRC if present. inflateReset() will reset the process to discard the he ader
information. The application would need to call inflateGetHeader() agai n to information. The application would need to call inflateGetHeader() agai n to
retrieve the header from the next gzip stream. retrieve the header from the next gzip stream.
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the so urce inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the sou rce
stream state was inconsistent. stream state was inconsistent.
*/ */
/* /*
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window)); unsigned char FAR *window));
Initialize the internal stream state for decompression using inflateBa ck() Initialize the internal stream state for decompression using inflateBa ck()
calls. The fields zalloc, zfree and opaque in strm must be initialized calls. The fields zalloc, zfree and opaque in strm must be initialized
before the call. If zalloc and zfree are Z_NULL, then the default libra ry- before the call. If zalloc and zfree are Z_NULL, then the default libra ry-
derived memory allocation routines are used. windowBits is the base two derived memory allocation routines are used. windowBits is the base two
logarithm of the window size, in the range 8..15. window is a caller logarithm of the window size, in the range 8..15. window is a caller
supplied buffer of that size. Except for special applications where it is supplied buffer of that size. Except for special applications where it is
assured that deflate was used with small window sizes, windowBits must b e 15 assured that deflate was used with small window sizes, windowBits must b e 15
and a 32K byte window must be supplied to be able to decompress general and a 32K byte window must be supplied to be able to decompress general
deflate streams. deflate streams.
See inflateBack() for the usage of these routines. See inflateBack() for the usage of these routines.
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
the paramaters are invalid, Z_MEM_ERROR if the internal state could not the parameters are invalid, Z_MEM_ERROR if the internal state could not
be allocated, or Z_VERSION_ERROR if the version of the library does not be
match the version of the header file. allocated, or Z_VERSION_ERROR if the version of the library does not mat
ch
the version of the header file.
*/ */
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); typedef unsigned (*in_func) OF((void FAR *,
z_const unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc, in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc)); out_func out, void FAR *out_desc));
/* /*
inflateBack() does a raw inflate with a single call using a call-back inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is more efficient than inflate() f interface for input and output. This is potentially more efficient than
or inflate() for file i/o applications, in that it avoids copying between t
file i/o applications in that it avoids copying between the output and t he
he output and the sliding window by simply making the window itself the out
sliding window by simply making the window itself the output buffer. Th put
is buffer. inflate() can be faster on modern CPUs when used with large
function trusts the application to not change the output buffer passed b buffers. inflateBack() trusts the application to not change the output
y buffer passed by the output function, at least until inflateBack() retur
the output function, at least until inflateBack() returns. ns.
inflateBackInit() must be called first to allocate the internal state inflateBackInit() must be called first to allocate the internal state
and to initialize the state with the user-provided window buffer. and to initialize the state with the user-provided window buffer.
inflateBack() may then be used multiple times to inflate a complete, raw inflateBack() may then be used multiple times to inflate a complete, raw
deflate stream with each call. inflateBackEnd() is then called to free deflate stream with each call. inflateBackEnd() is then called to free
the allocated state. the
allocated state.
A raw deflate stream is one with no zlib or gzip header or trailer. A raw deflate stream is one with no zlib or gzip header or trailer.
This routine would normally be used in a utility that reads zip or gzip This routine would normally be used in a utility that reads zip or gzip
files and writes out uncompressed files. The utility would decode the files and writes out uncompressed files. The utility would decode the
header and process the trailer on its own, hence this routine expects header and process the trailer on its own, hence this routine expects on
only the raw deflate stream to decompress. This is different from the ly
normal behavior of inflate(), which expects either a zlib or gzip header the raw deflate stream to decompress. This is different from the normal
and behavior of inflate(), which expects either a zlib or gzip header and
trailer around the deflate stream. trailer around the deflate stream.
inflateBack() uses two subroutines supplied by the caller that are the n inflateBack() uses two subroutines supplied by the caller that are the n
called by inflateBack() for input and output. inflateBack() calls those called by inflateBack() for input and output. inflateBack() calls those
routines until it reads a complete deflate stream and writes out all of the routines until it reads a complete deflate stream and writes out all of the
uncompressed data, or until it encounters an error. The function's uncompressed data, or until it encounters an error. The function's
parameters and return types are defined above in the in_func and out_fun c parameters and return types are defined above in the in_func and out_fun c
typedefs. inflateBack() will call in(in_desc, &buf) which should return the typedefs. inflateBack() will call in(in_desc, &buf) which should return the
number of bytes of provided input, and a pointer to that input in buf. If number of bytes of provided input, and a pointer to that input in buf. If
there is no input available, in() must return zero--buf is ignored in th at there is no input available, in() must return zero--buf is ignored in th at
skipping to change at line 922 skipping to change at line 1070
inflateBackInit(), which is also the buffer that out() uses to write fro m. inflateBackInit(), which is also the buffer that out() uses to write fro m.
The length written by out() will be at most the window size. Any non-ze ro The length written by out() will be at most the window size. Any non-ze ro
amount of input may be provided by in(). amount of input may be provided by in().
For convenience, inflateBack() can be provided input on the first call by For convenience, inflateBack() can be provided input on the first call by
setting strm->next_in and strm->avail_in. If that input is exhausted, t hen setting strm->next_in and strm->avail_in. If that input is exhausted, t hen
in() will be called. Therefore strm->next_in must be initialized before in() will be called. Therefore strm->next_in must be initialized before
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be ca lled calling inflateBack(). If strm->next_in is Z_NULL, then in() will be ca lled
immediately for input. If strm->next_in is not Z_NULL, then strm->avail _in immediately for input. If strm->next_in is not Z_NULL, then strm->avail _in
must also be initialized, and then if strm->avail_in is not zero, input will must also be initialized, and then if strm->avail_in is not zero, input will
initially be taken from strm->next_in[0 .. strm->avail_in - 1]. initially be taken from strm->next_in[0 .. strm->avail_in - 1].
The in_desc and out_desc parameters of inflateBack() is passed as the The in_desc and out_desc parameters of inflateBack() is passed as the
first parameter of in() and out() respectively when they are called. Th ese first parameter of in() and out() respectively when they are called. Th ese
descriptors can be optionally used to pass any information that the call er- descriptors can be optionally used to pass any information that the call er-
supplied in() and out() functions need to do their job. supplied in() and out() functions need to do their job.
On return, inflateBack() will set strm->next_in and strm->avail_in to On return, inflateBack() will set strm->next_in and strm->avail_in to
pass back any unused input that was provided by the last in() call. The pass back any unused input that was provided by the last in() call. The
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERR OR return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERR OR
if in() or out() returned an error, Z_DATA_ERROR if there was a format if in() or out() returned an error, Z_DATA_ERROR if there was a format e
error in the deflate stream (in which case strm->msg is set to indicate rror
the in the deflate stream (in which case strm->msg is set to indicate the na
nature of the error), or Z_STREAM_ERROR if the stream was not properly ture
initialized. In the case of Z_BUF_ERROR, an input or output error can b of the error), or Z_STREAM_ERROR if the stream was not properly initiali
e zed.
distinguished using strm->next_in which will be Z_NULL only if in() retu In the case of Z_BUF_ERROR, an input or output error can be distinguishe
rned d
an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to using strm->next_in which will be Z_NULL only if in() returned an error.
out() returning non-zero. (in() will always be called before out(), so If
strm->next_in is assured to be defined if out() returns non-zero.) Note strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() retur
that inflateBack() cannot return Z_OK. ning
non-zero. (in() will always be called before out(), so strm->next_in is
assured to be defined if out() returns non-zero.) Note that inflateBack(
)
cannot return Z_OK.
*/ */
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
/* /*
All memory allocated by inflateBackInit() is freed. All memory allocated by inflateBackInit() is freed.
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the str eam inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the str eam
state was inconsistent. state was inconsistent.
*/ */
skipping to change at line 992 skipping to change at line 1140
The sprintf variant used by gzprintf (zero is best): The sprintf variant used by gzprintf (zero is best):
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the forma t 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the forma t
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
26: 0 = returns value, 1 = void -- 1 means inferred string length retu rned 26: 0 = returns value, 1 = void -- 1 means inferred string length retu rned
Remainder: Remainder:
27-31: 0 (reserved) 27-31: 0 (reserved)
*/ */
#ifndef Z_SOLO
/* utility functions */ /* utility functions */
/* /*
The following utility functions are implemented on top of the The following utility functions are implemented on top of the basic
basic stream-oriented functions. To simplify the interface, some stream-oriented functions. To simplify the interface, some default opti
default options are assumed (compression level and memory usage, ons
standard memory allocation functions). The source code of these are assumed (compression level and memory usage, standard memory allocat
utility functions can easily be modified if you need special options. ion
functions). The source code of these utility functions can be modified
if
you need special options.
*/ */
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen)); const Bytef *source, uLong sourceLen));
/* /*
Compresses the source buffer into the destination buffer. sourceLen i s Compresses the source buffer into the destination buffer. sourceLen i s
the byte length of the source buffer. Upon entry, destLen is the total the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least the value returne size
d of the destination buffer, which must be at least the value returned by
by compressBound(sourceLen). Upon exit, destLen is the actual size of th compressBound(sourceLen). Upon exit, destLen is the actual size of the
e
compressed buffer. compressed buffer.
This function can be used to compress a whole file at once if the
input file is mmap'ed.
compress returns Z_OK if success, Z_MEM_ERROR if there was not compress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer. buffer.
*/ */
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen, const Bytef *source, uLong sourceLen,
int level)); int level));
/* /*
Compresses the source buffer into the destination buffer. The level Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of th e length of the source buffer. Upon entry, destLen is the total size of t he
destination buffer, which must be at least the value returned by destination buffer, which must be at least the value returned by
compressBound(sourceLen). Upon exit, destLen is the actual size of the compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer. compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer, memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid. Z_STREAM_ERROR if the level parameter is invalid.
*/ */
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
/* /*
compressBound() returns an upper bound on the compressed size after compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before compress() or compress2() on sourceLen bytes. It would be used before a
a compress() or compress2() call to allocate the destination buffer. compress() or compress2() call to allocate the destination buffer.
*/ */
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen)); const Bytef *source, uLong sourceLen));
/* /*
Decompresses the source buffer into the destination buffer. sourceLen is Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the size
entire uncompressed data. (The size of the uncompressed data must have of the destination buffer, which must be large enough to hold the entire
been saved previously by the compressor and transmitted to the decompres uncompressed data. (The size of the uncompressed data must have been sa
sor ved
by some mechanism outside the scope of this compression library.) previously by the compressor and transmitted to the decompressor by some
Upon exit, destLen is the actual size of the compressed buffer. mechanism outside the scope of this compression library.) Upon exit, des
This function can be used to decompress a whole file at once if the tLen
input file is mmap'ed. is the actual size of the uncompressed buffer.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
In
the case where there is not enough room, uncompress() will fill the outp
ut
buffer with the uncompressed data up to that point.
*/ */
typedef voidp gzFile; /* gzip file access functions */
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/* /*
Opens a gzip (.gz) file for reading or writing. The mode parameter This library supports reading and writing files in gzip (.gz) format w
is as in fopen ("rb" or "wb") but can also include a compression level ith
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for an interface similar to that of stdio, using the functions that start wi
Huffman only compression as in "wb1h", or 'R' for run-length encoding th
as in "wb1R". (See the description of deflateInit2 for more information "gz". The gzip format is different from the zlib format. gzip is a gzi
about the strategy parameter.) p
wrapper, documented in RFC 1952, wrapped around a deflate stream.
*/
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
/*
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
Opens a gzip (.gz) file for reading or writing. The mode parameter is
as
in fopen ("rb" or "wb") but can also include a compression level ("wb9")
or
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or '
F'
for fixed code compression as in "wb9F". (See the description of
deflateInit2 for more information about the strategy parameter.) 'T' wi
ll
request transparent writing or appending with no compression and not usi
ng
the gzip format.
"a" can be used instead of "w" to request that the gzip stream that wi
ll
be written be appended to the file. "+" will result in an error, since
reading and writing to the same gzip file is not supported. The additio
n of
"x" when writing will create the file exclusively, which fails if the fi
le
already exists. On systems that support it, the addition of "e" when
reading or writing will set the flag to close the file on an execve() ca
ll.
These functions, as well as gzip, will read and decode a sequence of g
zip
streams in a file. The append function of gzopen() can be used to creat
e
such a file. (Also see gzflush() for another way to do this.) When
appending, gzopen does not test whether the file begins with a gzip stre
am,
nor does it look for the end of the gzip streams to begin appending. gz
open
will simply append a gzip stream to the existing file.
gzopen can be used to read a file which is not in gzip format; in this gzopen can be used to read a file which is not in gzip format; in this
case gzread will directly read from the file without decompression. case gzread will directly read from the file without decompression. Whe
n
reading, this will be detected automatically by looking for the magic tw
o-
byte gzip header.
gzopen returns NULL if the file could not be opened, if there was
insufficient memory to allocate the gzFile state, or if an invalid mode
was
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
errno can be checked to determine if the reason gzopen failed was that t
he
file could not be opened.
*/
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/*
gzdopen associates a gzFile with the file descriptor fd. File descrip
tors
are obtained from calls like open, dup, creat, pipe or fileno (if the fi
le
has been previously opened with fopen). The mode parameter is as in gzo
pen.
The next call of gzclose on the returned gzFile will also close the fi
le
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descri
ptor
fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd
,
mode);. The duplicated descriptor should be saved to avoid a leak, sinc
e
gzdopen does not close fd if it fails. If you are using fileno() to get
the
file descriptor from a FILE *, then you will have to use dup() to avoid
double-close()ing the file descriptor. Both gzclose() and fclose() will
close the associated file descriptor, so they need to have different fil
e
descriptors.
gzdopen returns NULL if there was insufficient memory to allocate the
gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was
not
provided, or '+' was provided), or if fd is -1. The file descriptor is
not
used until the next gz* read, write, seek, or close operation, so gzdope
n
will not detect if fd is invalid (unless fd is -1).
*/
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
/*
Set the internal buffer size used by this library's functions. The
default buffer size is 8192 bytes. This function must be called after
gzopen() or gzdopen(), and before any other calls that read or write the
file. The buffer memory allocation is always deferred to the first read
or
write. Two buffers are allocated, either both of the specified size whe
n
writing, or one of the specified size and the other twice that size when
reading. A larger buffer size of, for example, 64K or 128K bytes will
noticeably increase the speed of decompression (reading).
gzopen returns NULL if the file could not be opened or if there was The new buffer size also affects the maximum length for gzprintf().
insufficient memory to allocate the (de)compression state; errno
can be checked to distinguish the two cases (if errno is zero, the gzbuffer() returns 0 on success, or -1 on failure, such as being calle
zlib error is Z_MEM_ERROR). */ d
too late.
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/*
gzdopen() associates a gzFile with the file descriptor fd. File
descriptors are obtained from calls like open, dup, creat, pipe or
fileno (in the file has been previously opened with fopen).
The mode parameter is as in gzopen.
The next call of gzclose on the returned gzFile will also close the
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
gzdopen returns NULL if there was insufficient memory to allocate
the (de)compression state.
*/ */
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/* /*
Dynamically update the compression level or strategy. See the descript ion Dynamically update the compression level or strategy. See the descrip tion
of deflateInit2 for the meaning of these parameters. of deflateInit2 for the meaning of these parameters.
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
opened for writing. opened for writing.
*/ */
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/* /*
Reads the given number of uncompressed bytes from the compressed file. Reads the given number of uncompressed bytes from the compressed file.
If the input file was not in gzip format, gzread copies the given number If
of bytes into the buffer. the input file is not in gzip format, gzread copies the given number of
gzread returns the number of uncompressed bytes actually read (0 for bytes into the buffer directly from the file.
end of file, -1 for error). */
After reaching the end of a gzip stream in the input, gzread will cont
inue
to read, looking for another gzip stream. Any number of gzip streams ma
y be
concatenated in the input file, and will all be decompressed by gzread()
.
If something other than a gzip stream is encountered after a gzip stream
,
that remaining trailing garbage is ignored (and no error is returned).
gzread can be used to read a gzip file that is being concurrently writ
ten.
Upon reaching the end of the input, gzread will return with the availabl
e
data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, the
n
gzclearerr can be used to clear the end of file indicator in order to pe
rmit
gzread to be tried again. Z_OK indicates that a gzip stream was complet
ed
on the last gzread. Z_BUF_ERROR indicates that the input file ended in
the
middle of a gzip stream. Note that gzread does not return -1 in the eve
nt
of an incomplete gzip stream. This error is deferred until gzclose(), w
hich
will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
stream. Alternatively, gzerror can be used before gzclose to detect thi
s
case.
gzread returns the number of uncompressed bytes actually read, less th
an
len for end of file, or -1 for error.
*/
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
voidpc buf, unsigned len)); voidpc buf, unsigned len));
/* /*
Writes the given number of uncompressed bytes into the compressed file . Writes the given number of uncompressed bytes into the compressed file .
gzwrite returns the number of uncompressed bytes actually written gzwrite returns the number of uncompressed bytes written or 0 in case of
(0 in case of error). error.
*/ */
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)) ; ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...) );
/* /*
Converts, formats, and writes the args to the compressed file under Converts, formats, and writes the arguments to the compressed file und
control of the format string, as in fprintf. gzprintf returns the number er
of control of the format string, as in fprintf. gzprintf returns the numbe
uncompressed bytes actually written (0 in case of error). The number of r of
uncompressed bytes written is limited to 4095. The caller should assure uncompressed bytes actually written, or 0 in case of error. The number
that of
this limit is not exceeded. If it is exceeded, then gzprintf() will retu uncompressed bytes written is limited to 8191, or one less than the buff
rn er
return an error (0) with nothing written. In this case, there may also b size given to gzbuffer(). The caller should assure that this limit is n
e a ot
buffer overflow with unpredictable consequences, which is possible only exceeded. If it is exceeded, then gzprintf() will return an error (0) w
if ith
zlib was compiled with the insecure functions sprintf() or vsprintf() nothing written. In this case, there may also be a buffer overflow with
because the secure snprintf() or vsnprintf() functions were not availabl unpredictable consequences, which is possible only if zlib was compiled
e. with
the insecure functions sprintf() or vsprintf() because the secure snprin
tf()
or vsnprintf() functions were not available. This can be determined usi
ng
zlibCompileFlags().
*/ */
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/* /*
Writes the given null-terminated string to the compressed file, exclu ding Writes the given null-terminated string to the compressed file, exclud ing
the terminating null character. the terminating null character.
gzputs returns the number of characters written, or -1 in case of err
or. gzputs returns the number of characters written, or -1 in case of erro
r.
*/ */
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/* /*
Reads bytes from the compressed file until len-1 characters are read, Reads bytes from the compressed file until len-1 characters are read,
or or a
a newline character is read and transferred to buf, or an end-of-file newline character is read and transferred to buf, or an end-of-file
condition is encountered. The string is then terminated with a null condition is encountered. If any characters are read or if len == 1, th
character. e
gzgets returns buf, or Z_NULL in case of error. string is terminated with a null character. If no characters are read d
ue
to an end-of-file or len < 1, then the buffer is left untouched.
gzgets returns buf which is a null-terminated string, or it returns NU
LL
for end-of-file or in case of error. If there was an error, the content
s at
buf are indeterminate.
*/ */
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/* /*
Writes c, converted to an unsigned char, into the compressed file. Writes c, converted to an unsigned char, into the compressed file. gz
gzputc returns the value that was written, or -1 in case of error. putc
returns the value that was written, or -1 in case of error.
*/ */
ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/* /*
Reads one byte from the compressed file. gzgetc returns this byte Reads one byte from the compressed file. gzgetc returns this byte or
or -1 in case of end of file or error. -1
in case of end of file or error. This is implemented as a macro for spe
ed.
As such, it does not do all of the checking the other functions do. I.e
.
it does not check to see if file is NULL, nor whether the structure file
points to has been clobbered or not.
*/ */
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
/* /*
Push one character back onto the stream to be read again later. Push one character back onto the stream to be read as the first charac
Only one character of push-back is allowed. gzungetc() returns the ter
character pushed, or -1 on failure. gzungetc() will fail if a on the next read. At least one character of push-back is allowed.
character has been pushed but not read yet, or if c is -1. The pushed gzungetc() returns the character pushed, or -1 on failure. gzungetc() w
character will be discarded if the stream is repositioned with gzseek() ill
or gzrewind(). fail if c is -1, and may fail if a character has been pushed but not rea
d
yet. If gzungetc is used immediately after gzopen or gzdopen, at least
the
output buffer size of pushed characters is allowed. (See gzbuffer above
.)
The pushed character will be discarded if the stream is repositioned wit
h
gzseek() or gzrewind().
*/ */
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/* /*
Flushes all pending output into the compressed file. The parameter Flushes all pending output into the compressed file. The parameter fl
flush is as in the deflate() function. The return value is the zlib ush
error number (see function gzerror below). gzflush returns Z_OK if is as in the deflate() function. The return value is the zlib error num
the flush parameter is Z_FINISH and all output could be flushed. ber
gzflush should be called only when strictly necessary because it can (see function gzerror below). gzflush is only permitted when writing.
degrade compression.
If the flush parameter is Z_FINISH, the remaining data is written and
the
gzip stream is completed in the output. If gzwrite() is called again, a
new
gzip stream will be started in the output. gzread() is able to read suc
h
concatented gzip streams.
gzflush should be called only when strictly necessary because it will
degrade compression if called too often.
*/ */
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
/* /*
Sets the starting position for the next gzread or gzwrite on the ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
given compressed file. The offset represents a number of bytes in the z_off_t offset, int whence));
uncompressed data stream. The whence parameter is defined as in lseek(2)
; Sets the starting position for the next gzread or gzwrite on the given
compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2
);
the value SEEK_END is not supported. the value SEEK_END is not supported.
If the file is opened for reading, this function is emulated but can b e If the file is opened for reading, this function is emulated but can b e
extremely slow. If the file is opened for writing, only forward seeks ar e extremely slow. If the file is opened for writing, only forward seeks a re
supported; gzseek then compresses a sequence of zeroes up to the new supported; gzseek then compresses a sequence of zeroes up to the new
starting position. starting position.
gzseek returns the resulting offset location as measured in bytes fro m gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error, in the beginning of the uncompressed stream, or -1 in case of error, in
particular if the file is opened for writing and the new starting positi on particular if the file is opened for writing and the new starting positi on
would be before the current position. would be before the current position.
*/ */
ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/* /*
Rewinds the given file. This function is supported only for reading. Rewinds the given file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/ */
/*
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
Returns the starting position for the next gzread or gzwrite on the gi
ven
compressed file. This position represents a number of bytes in the
uncompressed data stream, and is zero when starting, even if appending o
r
reading a gzip stream from the middle of a file using gzdopen().
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
/* /*
Returns the starting position for the next gzread or gzwrite on the ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) Returns the current offset in the file being read or written. This of
fset
includes the count of bytes that precede the gzip stream, for example wh
en
appending or when using gzdopen() for reading. When reading, the offset
does not include as yet unused buffered input. This information can be
used
for a progress indicator. On error, gzoffset() returns -1.
*/ */
ZEXTERN int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/* /*
Returns 1 when EOF has previously been detected reading the given Returns true (1) if the end-of-file indicator has been set while readi
input stream, otherwise zero. ng,
false (0) otherwise. Note that the end-of-file indicator is set only if
the
read tried to go past the end of the input, but came up short. Therefor
e,
just like feof(), gzeof() may return false even if there is no more data
to
read, in the event that the last read request was for the exact number o
f
bytes remaining in the input file. This will happen if the input file s
ize
is an exact multiple of the buffer size.
If gzeof() returns true, then the read functions will return no more d
ata,
unless the end-of-file indicator is reset by gzclearerr() and the input
file
has grown since the previous end of file was detected.
*/ */
ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
/* /*
Returns 1 if file is being read directly without decompression, otherw Returns true (1) if file is being copied directly while reading, or fa
ise lse
zero. (0) if file is a gzip stream being decompressed.
If the input file is empty, gzdirect() will return true, since the inp
ut
does not contain a gzip stream.
If gzdirect() is used immediately after gzopen() or gzdopen() it will
cause buffers to be allocated to allow reading the file to determine if
it
is a gzip file. Therefore if gzbuffer() is used, it should be called be
fore
gzdirect().
When writing, gzdirect() returns true (1) if transparent writing was
requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
gzdirect() is not needed when writing. Transparent writing must be
explicitly requested, so the application already knows the answer. When
linking statically, using gzdirect() will include all of the zlib code f
or
gzip file reading and decompression, which may not be desired.)
*/ */
ZEXTERN int ZEXPORT gzclose OF((gzFile file)); ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/* /*
Flushes all pending output if necessary, closes the compressed file Flushes all pending output if necessary, closes the compressed file an
and deallocates all the (de)compression state. The return value is the z d
lib deallocates the (de)compression state. Note that once file is closed, y
error number (see function gzerror below). ou
cannot call gzerror with file, since its structures have been deallocate
d.
gzclose must not be called more than once on the same file, just as free
must not be called more than once on the same allocation.
gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
last read ended in the middle of a gzip stream, or Z_OK on success.
*/
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
/*
Same as gzclose(), but gzclose_r() is only for use when reading, and
gzclose_w() is only for use when writing or appending. The advantage to
using these instead of gzclose() is that they avoid linking in zlib
compression or decompression code that is not used when only reading or
only
writing respectively. If gzclose() is used, then both compression and
decompression code will be included the application when linking to a st
atic
zlib library.
*/ */
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/* /*
Returns the error message for the last error which occurred on the Returns the error message for the last error which occurred on the giv
given compressed file. errnum is set to zlib error number. If an en
error occurred in the file system and not in the compression library, compressed file. errnum is set to zlib error number. If an error occur
errnum is set to Z_ERRNO and the application may consult errno red
to get the exact error code. in the file system and not in the compression library, errnum is set to
Z_ERRNO and the application may consult errno to get the exact error cod
e.
The application must not modify the returned string. Future calls to
this function may invalidate the previously returned string. If file is
closed, then the string previously returned by gzerror will no longer be
available.
gzerror() should be used to distinguish errors from end-of-file for th
ose
functions above that do not distinguish those cases in their return valu
es.
*/ */
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
/* /*
Clears the error and end-of-file flags for file. This is analogous to Clears the error and end-of-file flags for file. This is analogous to
the the
clearerr() function in stdio. This is useful for continuing to read a gz clearerr() function in stdio. This is useful for continuing to read a g
ip zip
file that is being written concurrently. file that is being written concurrently.
*/ */
#endif /* !Z_SOLO */
/* checksum functions */ /* checksum functions */
/* /*
These functions are not related to compression but are exported These functions are not related to compression but are exported
anyway because they might be useful in applications using the anyway because they might be useful in applications using the compressio
compression library. n
library.
*/ */
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)) ; ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)) ;
/* /*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. If buf is NULL, this function returns return the updated checksum. If buf is Z_NULL, this function returns th
the required initial value for the checksum. e
An Adler-32 checksum is almost as reliable as a CRC32 but can be compute required initial value for the checksum.
d
much faster. Usage example: An Adler-32 checksum is almost as reliable as a CRC32 but can be compu
ted
much faster.
Usage example:
uLong adler = adler32(0L, Z_NULL, 0); uLong adler = adler32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) { while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length); adler = adler32(adler, buffer, length);
} }
if (adler != original_adler) error(); if (adler != original_adler) error();
*/ */
/*
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
z_off_t len2)); z_off_t len2));
/*
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksu m of each, adler1 and adler2. adler32_combine() returns the Adler-32 checksu m of
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. No
te
that the z_off_t type (like off_t) is a signed integer. If len2 is
negative, the result has no meaning or utility.
*/ */
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/* /*
Update a running CRC-32 with the bytes buf[0..len-1] and return the Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is NULL, this function returns the required initi updated CRC-32. If buf is Z_NULL, this function returns the required
al initial value for the crc. Pre- and post-conditioning (one's complement
value for the for the crc. Pre- and post-conditioning (one's complement) ) is
is
performed within this function so it shouldn't be done by the applicatio n. performed within this function so it shouldn't be done by the applicatio n.
Usage example: Usage example:
uLong crc = crc32(0L, Z_NULL, 0); uLong crc = crc32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) { while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length); crc = crc32(crc, buffer, length);
} }
if (crc != original_crc) error(); if (crc != original_crc) error();
*/ */
/*
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len 2)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len 2));
/*
Combine two CRC-32 check values into one. For two sequences of bytes, Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, an d check value of seq1 and seq2 concatenated, requiring only crc1, crc2, an d
len2. len2.
*/ */
/* various hacks, don't look :) */ /* various hacks, don't look :) */
/* deflateInit and inflateInit are macros to allow checking the zlib versio n /* deflateInit and inflateInit are macros to allow checking the zlib versio n
skipping to change at line 1323 skipping to change at line 1639
int windowBits, int memLevel, int windowBits, int memLevel,
int strategy, const char *version, int strategy, const char *version,
int stream_size)); int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size) ); const char *version, int stream_size) );
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
unsigned char FAR *window, unsigned char FAR *window,
const char *version, const char *version,
int stream_size)); int stream_size));
#define deflateInit(strm, level) \ #define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit(strm) \ #define inflateInit(strm) \
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
(strategy), ZLIB_VERSION, sizeof(z_stream)) (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit2(strm, windowBits) \ #define inflateInit2(strm, windowBits) \
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
(int)sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \ #define inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \ inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, sizeof(z_stream)) ZLIB_VERSION, (int)sizeof(z_stream))
#ifndef Z_SOLO
/* gzgetc() macro and its supporting function and exposed data structure.
Note
* that the real internal state is much larger than the exposed structure.
* This abbreviated structure exposes just enough for the gzgetc() macro.
The
* user should not mess with these exposed elements, since their names or
* behavior could change in the future, perhaps even capriciously. They ca
n
* only be used by the gzgetc() macro. You have been warned.
*/
struct gzFile_s {
unsigned have;
unsigned char *next;
z_off64_t pos;
};
ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility *
/
#ifdef Z_PREFIX_SET
# undef z_gzgetc
# define z_gzgetc(g) \
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g
))
#else
# define gzgetc(g) \
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g
))
#endif
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
* both are true, the application gets the *64 functions, and the regular
* functions are changed to 64 bits) -- in case these are set on systems
* without large file support, _LFS64_LARGEFILE must also be true
*/
#ifdef Z_LARGE64
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
#endif
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
# ifdef Z_PREFIX_SET
# define z_gzopen z_gzopen64
# define z_gzseek z_gzseek64
# define z_gztell z_gztell64
# define z_gzoffset z_gzoffset64
# define z_adler32_combine z_adler32_combine64
# define z_crc32_combine z_crc32_combine64
# else
# define gzopen gzopen64
# define gzseek gzseek64
# define gztell gztell64
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
# endif
# ifndef Z_LARGE64
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
# endif
#else
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif
#else /* Z_SOLO */
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif /* !Z_SOLO */
/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;}; /* hack for buggy compilers */ struct internal_state {int dummy;};
#endif #endif
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO)
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
const char *mode));
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
const char *format,
va_list va));
# endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* ZLIB_H */ #endif /* ZLIB_H */
 End of changes. 193 change blocks. 
587 lines changed or deleted 1246 lines changed or added


 zutil.h   zutil.h 
/* zutil.h -- internal interface and configuration of the compression libra ry /* zutil.h -- internal interface and configuration of the compression libra ry
* Copyright (C) 1995-2005 Jean-loup Gailly. * Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zutil.h,v 1.1 2006-07-22 20:34:11 oliskoli Exp $ */ /* @(#) $Id$ */
#ifndef ZUTIL_H #ifndef ZUTIL_H
#define ZUTIL_H #define ZUTIL_H
#define ZLIB_INTERNAL #ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include "zlib.h" #include "zlib.h"
#ifdef STDC #if defined(STDC) && !defined(Z_SOLO)
# ifndef _WIN32_WCE # if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h> # include <stddef.h>
# endif # endif
# include <string.h> # include <string.h>
# include <stdlib.h> # include <stdlib.h>
#endif #endif
#ifdef NO_ERRNO_H
# ifdef _WIN32_WCE #ifdef Z_SOLO
/* The Microsoft C Run-Time Library for Windows CE doesn't have typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used. We rename it to
* avoid conflict with other libraries that use the same workaround.
*/
# define errno z_errno
# endif
extern int errno;
#else
# ifndef _WIN32_WCE
# include <errno.h>
# endif
#endif #endif
#ifndef local #ifndef local
# define local static # define local static
#endif #endif
/* compile with -Dlocal if your debugger can't find static symbols */ /* compile with -Dlocal if your debugger can't find static symbols */
typedef unsigned char uch; typedef unsigned char uch;
typedef uch FAR uchf; typedef uch FAR uchf;
typedef unsigned short ush; typedef unsigned short ush;
typedef ush FAR ushf; typedef ush FAR ushf;
typedef unsigned long ulg; typedef unsigned long ulg;
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */ /* (size given to avoid silly warnings with Visual C++) */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_RETURN(strm,err) \ #define ERR_RETURN(strm,err) \
return (strm->msg = (char*)ERR_MSG(err), (err)) return (strm->msg = ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */ /* To be used only when the state is known to be valid */
/* common constants */ /* common constants */
#ifndef DEF_WBITS #ifndef DEF_WBITS
# define DEF_WBITS MAX_WBITS # define DEF_WBITS MAX_WBITS
#endif #endif
/* default windowBits for decompression. MAX_WBITS is for compression only */ /* default windowBits for decompression. MAX_WBITS is for compression only */
#if MAX_MEM_LEVEL >= 8 #if MAX_MEM_LEVEL >= 8
skipping to change at line 91 skipping to change at line 85
#define MIN_MATCH 3 #define MIN_MATCH 3
#define MAX_MATCH 258 #define MAX_MATCH 258
/* The minimum and maximum match lengths */ /* The minimum and maximum match lengths */
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
/* target dependencies */ /* target dependencies */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
# define OS_CODE 0x00 # define OS_CODE 0x00
# if defined(__TURBOC__) || defined(__BORLANDC__) # ifndef Z_SOLO
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) # if defined(__TURBOC__) || defined(__BORLANDC__)
/* Allow compilation with ANSI keywords only enabled */ # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
void _Cdecl farfree( void *block ); /* Allow compilation with ANSI keywords only enabled */
void *_Cdecl farmalloc( unsigned long nbytes ); void _Cdecl farfree( void *block );
# else void *_Cdecl farmalloc( unsigned long nbytes );
# include <alloc.h> # else
# include <alloc.h>
# endif
# else /* MSC or DJGPP */
# include <malloc.h>
# endif # endif
# else /* MSC or DJGPP */
# include <malloc.h>
# endif # endif
#endif #endif
#ifdef AMIGA #ifdef AMIGA
# define OS_CODE 0x01 # define OS_CODE 0x01
#endif #endif
#if defined(VAXC) || defined(VMS) #if defined(VAXC) || defined(VMS)
# define OS_CODE 0x02 # define OS_CODE 0x02
# define F_OPEN(name, mode) \ # define F_OPEN(name, mode) \
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif #endif
#if defined(ATARI) || defined(atarist) #if defined(ATARI) || defined(atarist)
# define OS_CODE 0x05 # define OS_CODE 0x05
#endif #endif
#ifdef OS2 #ifdef OS2
# define OS_CODE 0x06 # define OS_CODE 0x06
# ifdef M_I86 # if defined(M_I86) && !defined(Z_SOLO)
#include <malloc.h> # include <malloc.h>
# endif # endif
#endif #endif
#if defined(MACOS) || defined(TARGET_OS_MAC) #if defined(MACOS) || defined(TARGET_OS_MAC)
# define OS_CODE 0x07 # define OS_CODE 0x07
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_o # ifndef Z_SOLO
s # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32
# include <unix.h> /* for fdopen */ _os
# else # include <unix.h> /* for fdopen */
# ifndef fdopen # else
# define fdopen(fd,mode) NULL /* No fdopen() */ # ifndef fdopen
# define fdopen(fd,mode) NULL /* No fdopen() */
# endif
# endif # endif
# endif # endif
#endif #endif
#ifdef TOPS20 #ifdef TOPS20
# define OS_CODE 0x0a # define OS_CODE 0x0a
#endif #endif
#ifdef WIN32 #ifdef WIN32
# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
skipping to change at line 154 skipping to change at line 152
#endif #endif
#ifdef __50SERIES /* Prime/PRIMOS */ #ifdef __50SERIES /* Prime/PRIMOS */
# define OS_CODE 0x0f # define OS_CODE 0x0f
#endif #endif
#if defined(_BEOS_) || defined(RISCOS) #if defined(_BEOS_) || defined(RISCOS)
# define fdopen(fd,mode) NULL /* No fdopen() */ # define fdopen(fd,mode) NULL /* No fdopen() */
#endif #endif
#if (defined(_MSC_VER) && (_MSC_VER > 600)) #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
# if defined(_WIN32_WCE) # if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */ # define fdopen(fd,mode) NULL /* No fdopen() */
# ifndef _PTRDIFF_T_DEFINED # ifndef _PTRDIFF_T_DEFINED
typedef int ptrdiff_t; typedef int ptrdiff_t;
# define _PTRDIFF_T_DEFINED # define _PTRDIFF_T_DEFINED
# endif # endif
# else # else
# define fdopen(fd,type) _fdopen(fd,type) # define fdopen(fd,type) _fdopen(fd,type)
# endif # endif
#endif #endif
#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
#pragma warn -8066
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
#endif
/* common defaults */ /* common defaults */
#ifndef OS_CODE #ifndef OS_CODE
# define OS_CODE 0x03 /* assume Unix */ # define OS_CODE 0x03 /* assume Unix */
#endif #endif
#ifndef F_OPEN #ifndef F_OPEN
# define F_OPEN(name, mode) fopen((name), (mode)) # define F_OPEN(name, mode) fopen((name), (mode))
#endif #endif
/* functions */ /* functions */
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) #if defined(pyr) || defined(Z_SOLO)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(__CYGWIN__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
# define vsnprintf _vsnprintf
# endif
# endif
# ifdef __SASC
# define NO_vsnprintf
# endif
#endif
#ifdef VMS
# define NO_vsnprintf
#endif
#if defined(pyr)
# define NO_MEMCPY # define NO_MEMCPY
#endif #endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
/* Use our own functions for small and medium model with MSC <= 5.0. /* Use our own functions for small and medium model with MSC <= 5.0.
* You may have to use the same strategy for Borland C (untested). * You may have to use the same strategy for Borland C (untested).
* The __SC__ check is for Symantec. * The __SC__ check is for Symantec.
*/ */
# define NO_MEMCPY # define NO_MEMCPY
#endif #endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
skipping to change at line 235 skipping to change at line 213
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
# define zmemcpy _fmemcpy # define zmemcpy _fmemcpy
# define zmemcmp _fmemcmp # define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len) # define zmemzero(dest, len) _fmemset(dest, 0, len)
# else # else
# define zmemcpy memcpy # define zmemcpy memcpy
# define zmemcmp memcmp # define zmemcmp memcmp
# define zmemzero(dest, len) memset(dest, 0, len) # define zmemzero(dest, len) memset(dest, 0, len)
# endif # endif
#else #else
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt le
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); n));
extern void zmemzero OF((Bytef* dest, uInt len)); int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len
));
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
#endif #endif
/* Diagnostic functions */ /* Diagnostic functions */
#ifdef DEBUG #ifdef DEBUG
# include <stdio.h> # include <stdio.h>
extern int z_verbose; extern int ZLIB_INTERNAL z_verbose;
extern void z_error OF((char *m)); extern void ZLIB_INTERNAL z_error OF((char *m));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;}
# define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#else #else
# define Assert(cond,msg) # define Assert(cond,msg)
# define Trace(x) # define Trace(x)
# define Tracev(x) # define Tracev(x)
# define Tracevv(x) # define Tracevv(x)
# define Tracec(c,x) # define Tracec(c,x)
# define Tracecv(c,x) # define Tracecv(c,x)
#endif #endif
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); #ifndef Z_SOLO
void zcfree OF((voidpf opaque, voidpf ptr)); voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
unsigned size));
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
#endif
#define ZALLOC(strm, items, size) \ #define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size)) (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr )) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr ))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
/* Reverse the bytes in a 32-bit value */
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
#endif /* ZUTIL_H */ #endif /* ZUTIL_H */
 End of changes. 18 change blocks. 
80 lines changed or deleted 67 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/