[KPhotoAlbum] [PATCH] compile SVN version under FreeBSD

Marco Molteni molter at tin.it
Sat Mar 4 21:26:17 GMT 2006


Hi Jesper,

trying to compile from SVN, I get some errors on FreeBSD
regarding file parse.c. Attached path fixes them, could you
try if it works fine on Linux too ?

The include unistd.h is needed for the "ushort" typedef,
while the _ trick is to avoid a name clash with memmem
in the FreeBSD standard C library.

Also in the kphotoalbum directory there is a parse.c.orig
file which I think is a leftover from a previous patch, I
think you can remove it.

marco


--- parse.c.old	Sat Mar  4 21:39:08 2006
+++ parse.c	Sat Mar  4 22:14:48 2006
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #ifdef WIN32
 #include <winsock2.h>
@@ -863,7 +864,7 @@ void parse_jpeg (int offset)
   }
 }
 
-char *memmem (char *haystack, size_t haystacklen,
+char *memmem_ (char *haystack, size_t haystacklen,
               char *needle, size_t needlelen)
 {
   char *c;
@@ -891,8 +892,8 @@ int identify(FILE* tfp)
   fread (head, 1, 32, ifp);
   fseek (ifp, 0, SEEK_END);
   fsize = ftell(ifp);
-  if ((cp = memmem (head, 32, "MMMMRawT", 8)) ||
-      (cp = memmem (head, 32, "IIIITwaR", 8)))
+  if ((cp = memmem_ (head, 32, "MMMMRawT", 8)) ||
+      (cp = memmem_ (head, 32, "IIIITwaR", 8)))
     parse_phase_one (cp - head);
   else if (order == 0x4949 || order == 0x4d4d) {
     if (!memcmp(head+6,"HEAPCCDR",8)) {


-- 
He who receives an idea from me, receives instruction himself
without lessening mine; as he who lights his taper at mine,
receives light without darkening me. -- Thomas Jefferson




More information about the Kphotoalbum mailing list