Ticket #303: patch26.patch

File patch26.patch, 12.3 KB (added by Charlie Hull, 16 years ago)

Better patch adding UUID functions

  • xapian-core/backends/chert/chert_version.cc

     
    3838#include <cstring> // For memcmp() and memcpy().
    3939#include <string>
    4040
    41 #include <uuid/uuid.h>
     41#include "common/safeuuid.h"
    4242
    4343using namespace std;
    4444
  • xapian-core/backends/chert/chert_version.h

     
    2424#include <cstring>
    2525#include <string>
    2626
    27 #include <uuid/uuid.h>
     27#include "common/safeuuid.h"
    2828
    2929/** The ChertVersion class manages the "iamchert" file.
    3030 *
  • xapian-core/backends/flint/flint_version.cc

     
    3737#include <cstring> // For memcmp() and memcpy().
    3838#include <string>
    3939
    40 #include <uuid/uuid.h>
     40#include "common/safeuuid.h"
    4141
    4242using std::string;
    4343
  • xapian-core/backends/flint/flint_version.h

     
    2424#include <cstring>
    2525#include <string>
    2626
    27 #include <uuid/uuid.h>
     27#include "common/safeuuid.h"
    2828
    2929/** The FlintVersion class manages the "iamflint" file.
    3030 *
  • xapian-core/ChangeLog

     
     1<<<<<<< .mine
     2<<<<<<< .mine
     3Sun Jun 29 06:53:28 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
     4=======
     5=======
    16Sat Oct 11 12:19:38 GMT 2008  Olly Betts <olly@survex.com>
    27
    38        * tests/api_wrdb.cc: If the timer for the first test for bigoaddvalue
     
    1520          to match the different place that the compiled xapian-check is
    1621          placed in.  Should fix bug #301.
    1722
     23>>>>>>> .r11529
    1824Thu Oct 09 05:20:32 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    1925
    2026        * configure.ac: Change -Wstrict-overflow level to 1 - even level 2
     
    10581064          rounding the result more than once.
    10591065
    10601066Fri Jul 11 12:21:11 GMT 2008  Olly Betts <olly@survex.com>
     1067>>>>>>> .r11521
    10611068
    1062         * tests/api_anydb.cc: Add testcase for percent cutoff plus collapsing
    1063           which most likely would have failed before Richard's recent fix
    1064           for the lower bound with collapsing and a matchdecider.
     1069        * version.rc.java-swig,version.rc.php,version.rc.python: Change
     1070          "Copyright ... Xapian" messages to a note to consult the source
     1071          code - Xapian isn't a legal entity, so nothing can be "(C)
     1072          Xapian".
    10651073
    1066 Fri Jul 11 05:30:02 GMT 2008  Olly Betts <olly@survex.com>
     1074Wed Jun 25 13:18:50 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    10671075
    1068         * backends/database.cc: Add support for XAPIAN_PREFER_CHERT
    1069           environmental variable.
     1076        * Makefile: Patch from Charlie to fix some paths for "cd".
    10701077
    1071 Thu Jul 10 22:21:46 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
     1078Tue Jun 24 16:06:57 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    10721079
    1073         * api/postingsource.cc: Fix skip_to() so that it doesn't advance if
    1074           it's already in a suitable position.
    1075         * include/xapian/postingsource.h: Specify that skip_to() should
    1076           stay in the same position if the current position is equal to
    1077           the docid argument of skip_to().
    1078         * tests/api_db.cc: Add valueweightsource3 to check that skip_to()
    1079           stays in the same position in this case.
     1080        * NEWS: Add note about Java-SWIG makefiles.
    10801081
    1081 Thu Jul 10 13:14:14 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
     1082Tue Jun 24 16:06:21 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    10821083
    1083         * api/postingsource.cc: Performance improvement - open documents
    1084           lazily (using the internal interface) so that we don't access
    1085           the record table for each one - we now just access the value
    1086           table.  Leads to considerable speed up for me (of the order of 5
    1087           times faster).
     1084        * win32_backends_chert.mak: Add chert_alldocsmodifiedpostlist
     1085          source files.
     1086        * win32_testsuite.mak: Add backendmanager_remote source file.
    10881087
    1089 Thu Jul 10 09:49:39 GMT 2008  Olly Betts <olly@survex.com>
     1088Thu Jun 05 17:29:16 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    10901089
    1091         * HACKING: Overhaul the sections on building from SVN.  Remove ':'
    1092           from the end of headings.
     1090        * win32_expand.mak: Replace reference to expand.cc and expand.obj
     1091          with esetinternal.cc and esetinternal.obj - expand.cc has now
     1092          been removed, and esetinternal.cc added.
    10931093
    1094 Wed Jul 09 10:43:01 GMT 2008  Olly Betts <olly@survex.com>
     1094Thu Jun 05 17:11:14 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    10951095
    1096         * configure.ac: The workaround to avoid probe code for F77, GCJ, and
    1097           RC being added to configure is no longer required now that we're
    1098           using libtool 2.2 so remove it.
     1096        * win32_bin.mak: Remove comments about the now removed quartz
     1097          utilities, and a reference to them in the CLEAN rule.
     1098        * README: Remove trailing whitespace.  Clean up list of "what
     1099          works".
    10991100
    1100 Wed Jul 09 09:40:43 GMT 2008  Olly Betts <olly@survex.com>
     1101Thu Jun 05 17:04:26 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    11011102
     1103<<<<<<< .mine
     1104        * Start of ChangeLog.
     1105=======
    11021106        * Makefile.am,acinclude.m4,autoconf/dir_contents,
    11031107          autoconf/rjb_find_stlport.m4,autoconf/type_socklen_t.m4,
    11041108          m4/dir_contents,m4/rjb_find_stlport.m4,m4/type_socklen_t.m4: Move
     
    2501325017Fri Nov 24 15:34:17 GMT 2000  Richard Boulton <richard.boulton@open.muscat.com>
    2501425018
    2501525019        * Declare this to be version 0.4.1
     25020>>>>>>> .r11521
  • xapian-core/common/safeuuid.h

     
     1/** @file safeuuid.h
     2 *  @brief #include <uuid/uuid.h>, with alternative implementation for windows.
     3 */
     4/* Copyright (C) 2008 Lemur Consulting Ltd
     5 *
     6 * This program is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU General Public License as
     8 * published by the Free Software Foundation; either version 2 of the
     9 * License, or (at your option) any later version.
     10 *
     11 * This program is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 * GNU General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU General Public License
     17 * along with this program; if not, write to the Free Software
     18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
     19 * MA 02110-1301, USA
     20 */
     21
     22#ifndef XAPIAN_INCLUDED_SAFEUUID_H
     23#define XAPIAN_INCLUDED_SAFEUUID_H
     24
     25#ifdef __WIN32__
     26# include "common/win32_uuid.h"
     27#else
     28# include <uuid/uuid.h>
     29#endif
     30
     31#endif // XAPIAN_INCLUDED_SAFEUUID_H
  • xapian-core/common/win32_uuid.cc

     
     1/* win32_uuid.cc: Provides UUID functions compatible with libuuid from e2fsprogs
     2 *
     3 * Copyright (C) 2008 Lemur Consulting Ltd
     4 *
     5 * This program is free software; you can redistribute it and/or modify
     6 * it under the terms of the GNU General Public License as published by
     7 * the Free Software Foundation; either version 2 of the License, or
     8 * (at your option) any later version.
     9 *
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program; if not, write to the Free Software
     17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     18 */
     19
     20#include <config.h>
     21
     22#include "win32_uuid.h"
     23
     24void uuid_generate(uuid_t uu)
     25{
     26    UUID uuid;
     27    if(UuidCreate(&uuid) != RPC_S_OK)
     28        return;
     29    memcpy(uu,&uuid,16);
     30}
     31   
     32 int uuid_parse(const char * in, uuid_t uu)
     33{
     34    UUID uuid;
     35    if(UuidFromString( (unsigned char*) in, &uuid) != RPC_S_OK)
     36        return -1;
     37    memcpy(uu,&uuid,16);
     38    return 0;
     39}
     40   
     41void uuid_unparse_lower(const uuid_t uu, char *  out)
     42{
     43    UUID uuid;
     44    char *uuidstr;
     45    memcpy(&uuid,uu,16);
     46    if(UuidToString(&uuid, (unsigned char**) &uuidstr) != RPC_S_OK)
     47        return;
     48    int uuidlen = strlen(uuidstr);
     49    strncpy( out, strlwr(uuidstr), uuidlen );
     50    RpcStringFree( (unsigned char**) &uuidstr );
     51}
     52   
     53void uuid_clear(uuid_t uu)
     54{
     55    memset(uu,0x00,16);
     56}
     57   
     58int uuid_is_null(const uuid_t uu)
     59{
     60    int i=0;
     61    while(i<16) if (uu[i++])
     62        return 0;
     63    return 1;
     64}
     65   
  • xapian-core/common/win32_uuid.h

     
     1/*win32_uuid.h: Provides UUID functions compatible with libuuid from e2fsprogs
     2 *
     3 * Copyright 2008 Lemur Consulting Ltd
     4 *
     5 * This program is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU General Public License as
     7 * published by the Free Software Foundation; either version 2 of the
     8 * License, or (at your option) any later version.
     9 *
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program; if not, write to the Free Software
     17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
     18 * USA
     19 */
     20
     21#ifndef XAPIAN_INCLUDED_WIN32_UUID_H
     22#define XAPIAN_INCLUDED_WIN32_UUID_H
     23
     24#if !defined __CYGWIN__ && !defined __WIN32__
     25# error Including win32_uuid.h, but neither __CYGWIN__ nor __WIN32__ defined!
     26#endif
     27
     28#include "safewindows.h"
     29#include <rpc.h>
     30
     31// unfortunately Windows defines this as GUID, so let's redefine to match the Unix definition
     32#undef uuid_t
     33typedef unsigned char   uuid_t [16];
     34
     35void uuid_generate(uuid_t uu);
     36   
     37int uuid_parse(const char * in, uuid_t uu);
     38   
     39void uuid_unparse_lower(const uuid_t uu, char *  out);
     40   
     41void uuid_clear(uuid_t uu);
     42   
     43int uuid_is_null(const uuid_t uu);
     44
     45#endif /* XAPIAN_INCLUDED_WIN32_UUID_H */
  • xapian-maintainer-tools/win32msvc/ChangeLog

     
     1Thu Oct 23 15:42:00 GMT 2008  Charlie Hull <charlie@lemurconsulting.com>
     2
     3    * win32_uuid.h, win32_uuid.cc, safeuuid.h, flint_version.cc, flint_version.h, chert_version.cc,
     4    chert_version.h: add new Windows version of UUID functions
     5
     6
    17Mon Sep 08 09:59:17 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    28
    39        * genversion.pl: Update to match new configure.ac (cope with the []'s
  • xapian-maintainer-tools/win32msvc/win32_common.mak

     
    1919    $(INTDIR)\serialise-double.obj \
    2020    $(INTDIR)\msvc_dirent.obj \
    2121    $(INTDIR)\msvc_posix_wrapper.obj \
     22    $(INTDIR)\win32_uuid.obj \
    2223    $(INTDIR)\socket_utils.obj \
    2324    $(INTDIR)\stringutils.obj \
    2425    $(INTDIR)\safe.obj \
     
    3233    $(INTDIR)\serialise-double.cc \
    3334    $(INTDIR)\msvc_dirent.cc \
    3435    $(INTDIR)\msvc_posix_wrapper.cc \
     36    $(INTDIR)\win32_uuid.cc \
    3537    $(INTDIR)\socket_utils.cc \
    3638    $(INTDIR)\stringutils.cc \
    3739    $(INTDIR)\safe.cc \