Blob Blame History Raw
Index: src/af/xap/cocoa/xap_CocoaApp.h
===================================================================
--- src/af/xap/cocoa/xap_CocoaApp.h	(revision 35181)
+++ src/af/xap/cocoa/xap_CocoaApp.h	(working copy)
@@ -65,7 +65,7 @@
 	virtual void							copyToClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard = true) = 0;
 	virtual void							pasteFromClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard, bool bHonorFormatting = true) = 0;
 	virtual bool							canPasteFromClipboard() = 0;
-	virtual const char *					getUserPrivateDirectory();
+	virtual const char *					getUserPrivateDirectory() const;
 	virtual bool							findAbiSuiteBundleFile(std::string & path, const char * filename, const char * subdir = 0); // checks only bundle
 	virtual bool							findAbiSuiteLibFile(std::string & path, const char * filename, const char * subdir = 0);
 	virtual bool							findAbiSuiteAppFile(std::string & path, const char * filename, const char * subdir = 0); // doesn't check user-dir
Index: src/af/xap/cocoa/xap_CocoaApp.cpp
===================================================================
--- src/af/xap/cocoa/xap_CocoaApp.cpp	(revision 35181)
+++ src/af/xap/cocoa/xap_CocoaApp.cpp	(working copy)
@@ -192,7 +192,7 @@
 	*flags = m_geometry.flags;
 }
 
-const char * XAP_CocoaApp::getUserPrivateDirectory()
+const char * XAP_CocoaApp::getUserPrivateDirectory() const
 {
 	static const char * szAbiDir = "Library/Application Support/AbiSuite";
 	
Index: src/af/xap/gtk/xap_UnixApp.h
===================================================================
--- src/af/xap/gtk/xap_UnixApp.h	(revision 35181)
+++ src/af/xap/gtk/xap_UnixApp.h	(working copy)
@@ -73,7 +73,7 @@
 	virtual void							pasteFromClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard, bool bHonorFormatting = true) = 0;
 	virtual bool							canPasteFromClipboard() = 0;
 	void									migrate(const char *oldName, const char *newName, const char *path) const;
-	virtual const char *					getUserPrivateDirectory();
+	virtual const char *					getUserPrivateDirectory() const;
 
 	virtual void							setSelectionStatus(AV_View * pView) = 0;
 	virtual void							clearSelection() = 0;
Index: src/af/xap/gtk/xap_UnixApp.cpp
===================================================================
--- src/af/xap/gtk/xap_UnixApp.cpp	(revision 35181)
+++ src/af/xap/gtk/xap_UnixApp.cpp	(working copy)
@@ -207,70 +207,60 @@
 }
 
 // This should be removed at some time.
-void XAP_UnixApp::migrate (const char *oldName, const char *newName, const char *path) const
+void XAP_UnixApp::migrate(const char *oldName,
+                          const char *newName, const char *path) const
 {
-	if (path && newName && oldName && (*oldName == '/'))
-	{
-		char *old = new char[strlen(path) - strlen(newName) + strlen(oldName)];
-     
-		if (old)
-		{
-			size_t len = strrchr(path, '/') - path;       
-			strncpy(old, path, len);
-			old[len] = 0;
-			strcat(old, oldName);
+    if (path && newName && oldName && (*oldName == '/')) {
 
-			if (g_access(old, F_OK) == 0) 
-			{
-				UT_WARNINGMSG(("Renaming: %s -> %s\n", old, path));
-				g_rename(old, path);
-			}
-                     
-			delete[] old;
-		}         
-	}
+        const char* end = strrchr(path, '/');
+        if (!end) {
+            UT_WARNINGMSG(("invalid path '%s', '/' not found", path));
+            return;
+        }
+
+        std::string old(path, end);
+        old += oldName;
+
+        if (g_access(old.c_str(), F_OK) == 0) {
+            UT_WARNINGMSG(("Renaming: %s -> %s\n", old.c_str(), path));
+            g_rename(old.c_str(), path);
+        }
+    }
 }
- 
-const char * XAP_UnixApp::getUserPrivateDirectory()
+
+const char * XAP_UnixApp::getUserPrivateDirectory() const
 {
-	/* return a pointer to a static buffer */
-    static char *buf = NULL;
+    /* return a pointer to a static buffer */
+    static std::string private_dir;
 
-    if (buf == NULL)
-    {
-		const char * szAbiDir = "abiword";
-		const char * szCfgDir = ".config";
+    if (private_dir.empty()) {
+        const char * szAbiDir = "abiword";
+        const char * szCfgDir = ".config";
 
-		const char * szXDG = getenv("XDG_CONFIG_HOME");
-		if (!szXDG || !*szXDG) {
-			const char * szHome = getenv("HOME");
-			if (!szHome || !*szHome)
-				szHome = "./";
+        const char * szXDG = getenv("XDG_CONFIG_HOME");
+        if (!szXDG || !*szXDG) {
+            const char * szHome = getenv("HOME");
+            if (!szHome || !*szHome)
+                szHome = "./";
 
-			buf = new char[strlen(szHome)+strlen(szCfgDir)+strlen(szAbiDir)+4];
+            private_dir = szHome;
+            if (szHome[strlen(szHome)-1] != '/') {
+                private_dir.push_back('/');
+            }
+            private_dir += szCfgDir;
+        } else {
+            private_dir = szXDG;
+        }
 
-			strcpy(buf, szHome);
-			if (buf[strlen(buf)-1] != '/')
-				strcat(buf, "/");
-			strcat(buf, szCfgDir);
-		} else {
-			buf = new char[strlen(szXDG)+strlen(szAbiDir)+4];
-			strcpy(buf, szXDG);
-		}
+        private_dir += '/';
+        private_dir += szAbiDir;
 
-		strcat(buf, "/");
-		strcat(buf, szAbiDir);
-
-#ifdef PATH_MAX
-        if (strlen(buf) >= PATH_MAX)
-            DELETEPV(buf);
-#endif
-
-		// migration / legacy
-		migrate("/AbiSuite", szAbiDir, buf); 
+        // migration / legacy
+        // XXX shouldn't that be /.AbiSuite ?
+        migrate("/AbiSuite", szAbiDir, private_dir.c_str());
     }
 
-	return buf;
+    return private_dir.c_str();
 }
 
 
Index: src/af/xap/xp/xap_App.h
===================================================================
--- src/af/xap/xp/xap_App.h	(revision 35181)
+++ src/af/xap/xp/xap_App.h	(working copy)
@@ -178,7 +178,7 @@
 
 	virtual const XAP_StringSet *			getStringSet() const = 0;
 	virtual void						migrate(const char *oldName, const char *newName, const char *path) const;
-	virtual const char *				getUserPrivateDirectory() = 0;
+	virtual const char *				getUserPrivateDirectory() const = 0;
 	virtual const char *				getAbiSuiteLibDir() const;
 	virtual const char *				getAbiSuiteAppDir() const = 0;
 	virtual bool					findAbiSuiteLibFile(std::string & path, const char * filename, const char * subdir = 0);
Index: src/af/xap/win/xap_Win32App.h
===================================================================
--- src/af/xap/win/xap_Win32App.h	(revision 35181)
+++ src/af/xap/win/xap_Win32App.h	(working copy)
@@ -65,7 +65,7 @@
 	virtual void							pasteFromClipboard(PD_DocumentRange * pDocRange, bool, bool) = 0;
 	virtual bool							canPasteFromClipboard(void) = 0;
 	virtual void							cacheCurrentSelection(AV_View *) = 0;
-	virtual const char *					getUserPrivateDirectory(void);
+	virtual const char *					getUserPrivateDirectory(void) const;
 
 	virtual HICON							getIcon(void) = 0;
 	virtual HICON							getSmallIcon(void) = 0;
Index: src/af/xap/win/xap_Win32App.cpp
===================================================================
--- src/af/xap/win/xap_Win32App.cpp	(revision 35181)
+++ src/af/xap/win/xap_Win32App.cpp	(working copy)
@@ -238,7 +238,7 @@
 	return result;
 }
 
-const char * XAP_Win32App::getUserPrivateDirectory(void)
+const char * XAP_Win32App::getUserPrivateDirectory(void) const
 {
 	/* return a pointer to a static buffer */
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 35181)
+++ configure.ac	(working copy)
@@ -616,7 +616,7 @@
 #
 
 # We need libpng
-for l in libpng libpng14 libpng12; do
+for l in libpng libpng16 libpng14 libpng12; do
   AC_MSG_CHECKING(for $l)
   if $PKG_CONFIG --exists $l ; then
     AC_MSG_RESULT(yes)
Index: plugins/xslfo/xp/ie_exp_XSL-FO.cpp
===================================================================
--- plugins/xslfo/xp/ie_exp_XSL-FO.cpp	(revision 35181)
+++ plugins/xslfo/xp/ie_exp_XSL-FO.cpp	(working copy)
@@ -1451,7 +1451,7 @@
 	{ \
 		UT_UTF8String esc = szValue; \
 		esc.escapeXML(); \
-		buf += " "x"=\""; \
+		buf += " " x"=\""; \
 		buf += esc.utf8_str(); \
 		buf += "\""; \
 	}
Index: plugins/latex/xp/ie_exp_LaTeX.cpp
===================================================================
--- plugins/latex/xp/ie_exp_LaTeX.cpp	(revision 35181)
+++ plugins/latex/xp/ie_exp_LaTeX.cpp	(working copy)
@@ -1330,7 +1330,7 @@
 	m_pie->write(sBuf.c_str(),sBuf.size());
 }
 
-#define SUB(a,who) case a: subst = "\\(\\"who"\\)"; return true;
+#define SUB(a,who) case a: subst = "\\(\\" who"\\)"; return true;
 #define SUBd(a,who) case a: subst = who; return true;
 static bool _convertLettersToSymbols(char c, const char *& subst)
 {
Index: plugins/collab/backends/service/xp/soa_soup.cpp
===================================================================
--- plugins/collab/backends/service/xp/soa_soup.cpp	(revision 35181)
+++ plugins/collab/backends/service/xp/soa_soup.cpp	(working copy)
@@ -163,7 +163,7 @@
 	
 	static bool _invoke(const std::string& /*url*/, const soa::method_invocation& /*mi*/, SoaSoupSession& sess, std::string& result) {
 		if (!sess.m_session || !sess.m_msg )
-			return soa::GenericPtr();
+			return false;
 
 		guint status = soup_session_send_message (sess.m_session, sess.m_msg);
 		if (!(SOUP_STATUS_IS_SUCCESSFUL (status) ||
Index: plugins/collab/backends/service/xp/RealmProtocol.cpp
===================================================================
--- plugins/collab/backends/service/xp/RealmProtocol.cpp	(revision 35181)
+++ plugins/collab/backends/service/xp/RealmProtocol.cpp	(working copy)
@@ -6,8 +6,8 @@
 
 #define MAX_PACKET_DATA_SIZE 64*1024*1024
 		
-#define RPV1_PACKET_NONEXISTENT -2
-#define RPV1_PACKET_VARIABLE -1
+#define RPV1_PACKET_NONEXISTENT uint32_t(-2)
+#define RPV1_PACKET_VARIABLE uint32_t(-1)
 	
 static uint32_t body_size[6] = {
 	RPV1_PACKET_NONEXISTENT, /* 0: reserved */