summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@synthesis.ch>2010-05-14 20:45:24 +0200
committerLukas Zeller <luz@synthesis.ch>2010-05-15 01:12:27 +0200
commit81c5ef610bf7c05f36eb167ae97fc230cf77ea77 (patch)
treec3f4b8babf1246fa94d87862d2ebfb8f20058773
parent07d1c1e54f39a7b5dff7cca641f52b96cfe1372a (diff)
Source-Linked Logs: fixed to work with older monolithic Synthesis targets as well
TDBG_LOCATION_xxx macros must be defined in sysync_debug.h because in some C-only files, debuglogger.h cannot be included. Note that actually using SYDEBUG_LOCATION in a monolithic build would still not work because SYDEBUG_LOCATION relies on a constructor for a struct which does not exist in plain C. But this does no harm as SYDEBUG_LOCATION is not required in any of the classical builds.
-rwxr-xr-xsrc/sysync/debuglogger.h38
-rwxr-xr-xsrc/sysync/syncappbase.cpp8
-rwxr-xr-xsrc/sysync/sysync_debug.h47
3 files changed, 52 insertions, 41 deletions
diff --git a/src/sysync/debuglogger.h b/src/sysync/debuglogger.h
index fdaf71d..25b6b91 100755
--- a/src/sysync/debuglogger.h
+++ b/src/sysync/debuglogger.h
@@ -68,44 +68,6 @@ typedef enum {
} TDbgSourceModes;
-
-/// Container for information about the location where a debug call was made.
-/// Strings are owned by caller.
-struct TDbgLocation {
- /// function name, may be NULL, derived from __FUNC__ if available
- const char *fFunction;
- /// file name, may be NULL, from __FILE__
- const char *fFile;
- /// line number, 0 if unknown
- const int fLine;
-
- TDbgLocation(const char *aFunction = NULL,
- const char *aFile = NULL,
- const int aLine = 0) :
- fFunction(aFunction),
- fFile(aFile),
- fLine(aLine)
- {}
-};
-
-#ifdef SYDEBUG_LOCATION
-# define TDBG_LOCATION_PROTO const TDbgLocation &aTDbgLoc,
-# define TDBG_LOCATION_ARG aTDbgLoc,
-# define TDBG_LOCATION_HERE TDbgLocation(__func__, __FILE__, __LINE__),
-# define TDBG_LOCATION_NONE TDbgLocation(),
-# define TDBG_LOCATION_ARGS(_func, _file, _line) TDbgLocation(_func, _file, _line),
-# define TDBG_VARARGS(m...) (TDbgLocation(__PRETTY_FUNCTION__, __FILE__, __LINE__), ## m)
-# define TDBG_LOCATION_ARG_NUM 1
-#else
-# define TDBG_LOCATION_PROTO
-# define TDBG_LOCATION_ARG
-# define TDBG_LOCATION_HERE
-# define TDBG_LOCATION_NONE
-# define TDBG_LOCATION_ARGS(_func, _file, _line)
-# define TDBG_VARARGS
-# define TDBG_LOCATION_ARG_NUM 0
-#endif
-
#ifndef HARDCODED_CONFIG
extern cAppCharP const DbgOutFormatNames[numDbgOutFormats];
extern cAppCharP const DbgFoldingModeNames[numDbgFoldingModes];
diff --git a/src/sysync/syncappbase.cpp b/src/sysync/syncappbase.cpp
index 4e16bef..840bd8a 100755
--- a/src/sysync/syncappbase.cpp
+++ b/src/sysync/syncappbase.cpp
@@ -2569,7 +2569,7 @@ SmlEncoding_t TSyncAppBase::encodingFromContentType(cAppCharP aTypeString)
if (strucmp(aTypeString,SYNCML_MIME_TYPE SYNCML_ENCODING_SEPARATOR,l)==0) {
// is SyncML, check encoding
cAppCharP p = strchr(aTypeString,';');
- sInt16 cl = p ? p-aTypeString-l : 0; // length of encoding string (charset could be appended here)
+ sInt16 cl = p ? p-aTypeString-l : 0; // length of encoding string (charset could be appended here)
StrToEnum(SyncMLEncodingMIMENames,numSyncMLEncodings,enc,aTypeString+l,cl);
}
}
@@ -2683,7 +2683,7 @@ bool TSyncAppBase::getMyDeviceID(string &devid)
return true; // custom device ID is assumed to be guaranteed unique
}
#endif
- // use device ID as determined by platform adapters
+ // use device ID as determined by platform adapters
return getLocalDeviceID(devid);
} // TSyncAppBase::getMyDeviceID
@@ -3174,7 +3174,9 @@ localstatus TSyncAppBase::checkLicenseActivation(lineardate_t &aLastcheck, uInt3
}
// show it to user
if (!ok) {
- OBJ_PROGRESS_EVENT(this,pev_error,NULL,LOCERR_BADREG,0,0);
+ #ifndef ENGINE_LIBRARY
+ APP_PROGRESS_EVENT(this,pev_error,NULL,LOCERR_BADREG,0,0);
+ #endif
}
// return status
return ok ? LOCERR_OK : LOCERR_BADREG;
diff --git a/src/sysync/sysync_debug.h b/src/sysync/sysync_debug.h
index 6791809..c571bf4 100755
--- a/src/sysync/sysync_debug.h
+++ b/src/sysync/sysync_debug.h
@@ -109,6 +109,53 @@ TDebugLogger *getDbgLogger(void);
#endif
+#ifdef SYDEBUG_LOCATION
+/// Source location tracking in all debug messages
+
+/// Container for information about the location where a debug call was made.
+/// Strings are owned by caller.
+struct TDbgLocation {
+ /// function name, may be NULL, derived from __FUNC__ if available
+ const char *fFunction;
+ /// file name, may be NULL, from __FILE__
+ const char *fFile;
+ /// line number, 0 if unknown
+ const int fLine;
+
+ #ifdef __cplusplus
+ TDbgLocation(const char *aFunction = NULL,
+ const char *aFile = NULL,
+ const int aLine = 0) :
+ fFunction(aFunction),
+ fFile(aFile),
+ fLine(aLine)
+ {}
+ #endif
+};
+
+# define TDBG_LOCATION_PROTO const TDbgLocation &aTDbgLoc,
+# define TDBG_LOCATION_ARG aTDbgLoc,
+# define TDBG_LOCATION_HERE TDbgLocation(__func__, __FILE__, __LINE__),
+# define TDBG_LOCATION_NONE TDbgLocation(),
+# define TDBG_LOCATION_ARGS(_func, _file, _line) TDbgLocation(_func, _file, _line),
+# define TDBG_VARARGS(m...) (TDbgLocation(__PRETTY_FUNCTION__, __FILE__, __LINE__), ## m)
+# define TDBG_LOCATION_ARG_NUM 1
+
+#else
+
+// No links to source in debug messages
+# define TDBG_LOCATION_PROTO
+# define TDBG_LOCATION_ARG
+# define TDBG_LOCATION_HERE
+# define TDBG_LOCATION_NONE
+# define TDBG_LOCATION_ARGS(_func, _file, _line)
+# define TDBG_VARARGS
+# define TDBG_LOCATION_ARG_NUM 0
+
+#endif // SYDEBUG_LOCATION
+
+
+
// debug output macros (prevents unnecessary printf argument
// calculations when SYDEBUG is UNDEFined).