Ticket #303: patch24.patch

File patch24.patch, 12.2 KB (added by Charlie Hull, 16 years ago)

Patch to add 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#ifdef __WIN32__
     42# include "common/msvc_uuid.h"
     43#else
     44# include <uuid/uuid.h>
     45#endif
    4246
    4347using namespace std;
    4448
  • xapian-core/backends/chert/chert_version.h

     
    2424#include <cstring>
    2525#include <string>
    2626
    27 #include <uuid/uuid.h>
     27#ifdef __WIN32__
     28# include "common/msvc_uuid.h"
     29#else
     30# include <uuid/uuid.h>
     31#endif
    2832
    2933/** The ChertVersion class manages the "iamchert" file.
    3034 *
  • xapian-core/backends/flint/flint_version.cc

     
    3737#include <cstring> // For memcmp() and memcpy().
    3838#include <string>
    3939
    40 #include <uuid/uuid.h>
     40#ifdef __WIN32__
     41# include "common/msvc_uuid.h"
     42#else
     43# include <uuid/uuid.h>
     44#endif
    4145
    4246using std::string;
    4347
  • xapian-core/backends/flint/flint_version.h

     
    2424#include <cstring>
    2525#include <string>
    2626
    27 #include <uuid/uuid.h>
     27#ifdef __WIN32__
     28# include "common/msvc_uuid.h"
     29#else
     30# include <uuid/uuid.h>
     31#endif
    2832
    2933/** The FlintVersion class manages the "iamflint" file.
    3034 *
  • xapian-core/common/msvc_uuid.cc

     
     1 /* msvc_uuid.cc: Provides UUID functions with Posix semantics
     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#ifdef __WIN32__ /* Ignore the whole file except for __WIN32__ */
     23
     24#include "safewindows.h"
     25#include "msvc_uuid.h"
     26
     27void uuid_generate(uuid_t uu){
     28    UUID uuid;
     29    if(UuidCreate(&uuid) != RPC_S_OK) return;
     30    memcpy(&uu,&uuid,16);
     31    }
     32   
     33 int uuid_parse(const char * in, uuid_t uu){
     34    UUID uuid;
     35    if(UuidFromString((unsigned char*)in,&uuid) != RPC_S_OK) return -1;
     36    memcpy(&uu,&uuid,16);
     37    return 0;
     38    }
     39   
     40void uuid_unparse_lower(const uuid_t uu, char *  out){
     41    UUID uuid;
     42    char *uuidstr;
     43    memcpy(&uuid,&uu,16);
     44    if(UuidToString(&uuid,(unsigned char**)&uuidstr) != RPC_S_OK) return;
     45    int uuidlen = strlen( uuidstr );
     46    strncpy( out, strlwr(uuidstr), uuidlen );
     47    RpcStringFree( (unsigned char**)&uuidstr );
     48        }
     49   
     50void uuid_clear(uuid_t uu){
     51    memset(&uu,0x00,16);
     52    }
     53   
     54int uuid_is_null(uuid_t uu){
     55    int i=0;
     56    while(i<16) if (uu[i++]) return 0;
     57    return 1;
     58    }
     59   
     60   
     61#endif
     62 No newline at end of file
  • xapian-core/common/msvc_uuid.h

     
     1/* msvc_uuid.h: Provides UUID functions with Posix semantics
     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_MSVC_UUID_H
     22#define XAPIAN_INCLUDED_MSVC_UUID_H
     23
     24#ifdef __WIN32__ /* Ignore the whole file except for __WIN32__ */
     25
     26#include "safewindows.h"
     27#include <rpc.h>
     28
     29// unfortunately Windows defines this as GUID, so let's redefine to match the Unix definition
     30#undef uuid_t
     31typedef unsigned char   uuid_t [16];
     32
     33void uuid_generate(uuid_t uu);
     34   
     35int uuid_parse(const char * in, uuid_t uu);
     36   
     37void uuid_unparse_lower(const uuid_t uu, char *  out);
     38   
     39void uuid_clear(uuid_t uu);
     40   
     41int uuid_is_null(uuid_t uu);
     42
     43#endif /* __WIN32__*/   
     44#endif /* XAPIAN_INCLUDED_MSVC_POSIX_UUID_H */
  • xapian-maintainer-tools/win32msvc/ChangeLog

     
     1Mon Oct 13 13:42:00 GMT 2008  Charlie Hull <charlie@lemurconsulting.com>
     2
     3    * msvc_uuid.h, msvc_uuid.cc, flint_version.cc, flint_version.h, chert_version.cc,
     4    chert_version.h: add new Windows version of UUID functions
     5    * config.mak: remove Quartz library
     6
     7
    18Mon Sep 08 09:59:17 GMT 2008  Richard Boulton <richard@lemurconsulting.com>
    29
    310        * genversion.pl: Update to match new configure.ac (cope with the []'s
  • xapian-maintainer-tools/win32msvc/config.h.win32

     
    178178/* Undefine rare() as we don't have this in MSVC (See the section "Branch Prediction Hints" in xapian-core/HACKING) */
    179179#define rare
    180180
     181/* Undefine usual() as we don't have this in MSVC (See the section "Branch Prediction Hints" in xapian-core/HACKING) */
     182#define usual(COND) (COND)
     183
     184
    181185/* Define sizes of types as this isn't done by Windows */
    182186
    183187/* The number of bytes in a int.  */
  • xapian-maintainer-tools/win32msvc/config.mak

     
    138138LIB32_FLAGS=-nologo 
    139139LINK32=link.exe
    140140LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
    141  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib \
     141 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib rpcrt4.lib\
    142142 wsock32.lib Ws2_32.lib  odbccp32.lib -subsystem:console -debug -nologo \
    143143 "$(ZLIB_LIB_DIR)\zdll.lib"
    144144 
     
    180180 "$(OUTLIBDIR)\libbackend.lib"  \
    181181 "$(OUTLIBDIR)\libexpand.lib"  \
    182182 "$(OUTLIBDIR)\libflint.lib" \
    183  "$(OUTLIBDIR)\libquartz.lib" \
     183 "$(OUTLIBDIR)\libchert.lib" \
    184184 "$(OUTLIBDIR)\libinmemory.lib" \
    185185 "$(OUTLIBDIR)\libmulti.lib" \
    186186 "$(OUTLIBDIR)\libmatcher.lib"  \
  • xapian-maintainer-tools/win32msvc/win32_backends.mak

     
    1818    "$(OUTDIR)\libchert.lib" \
    1919    $(NULL)
    2020
    21 OBJS= $(INTDIR)\database.obj $(INTDIR)\dbfactory_remote.obj $(INTDIR)\alltermslist.obj $(INTDIR)\contiguousalldocspostlist.obj
    22 SRCS= $(INTDIR)\database.cc $(INTDIR)\dbfactory_remote.cc $(INTDIR)\alltermslist.cc $(INTDIR)\contiguousalldocspostlist.cc
     21OBJS=   $(INTDIR)\database.obj \
     22        $(INTDIR)\dbfactory.obj \
     23        $(INTDIR)\dbfactory_remote.obj \
     24        $(INTDIR)\alltermslist.obj \
     25        $(INTDIR)\valuelist.obj \
     26        $(INTDIR)\contiguousalldocspostlist.obj
     27
     28SRCS=   $(INTDIR)\database.cc \
     29        $(INTDIR)\dbfactory.cc \
     30        $(INTDIR)\dbfactory_remote.cc \
     31        $(INTDIR)\alltermslist.cc \
     32        $(INTDIR)\valuelist.cc \
     33        $(INTDIR)\contiguousalldocspostlist.cc
     34
     35
    2336         
    2437ALL : $(DEPLIBS) "$(OUTDIR)\libbackend.lib"
    2538
  • xapian-maintainer-tools/win32msvc/win32_backends_chert.mak

     
    3636                $(INTDIR)\chert_termlist.obj\
    3737                $(INTDIR)\chert_termlisttable.obj\
    3838                $(INTDIR)\chert_values.obj\
     39                $(INTDIR)\chert_valuelist.obj\
    3940                $(INTDIR)\chert_version.obj
    4041
    4142SRCS= \
     
    6061                $(INTDIR)\chert_termlist.cc\
    6162                $(INTDIR)\chert_termlisttable.cc\
    6263                $(INTDIR)\chert_values.cc\
     64                $(INTDIR)\chert_valuelist.cc\
    6365                $(INTDIR)\chert_version.cc\
    6466                $(INTDIR)\chert_check.cc
    6567
  • xapian-maintainer-tools/win32msvc/win32_backends_remote.mak

     
    1515
    1616OBJS= \
    1717                 $(INTDIR)\remote-database.obj \
    18                  $(INTDIR)\net_document.obj \
     18                 $(INTDIR)\remote-document.obj \
    1919                 $(INTDIR)\net_termlist.obj \
    2020                 $(INTDIR)\net_postlist.obj \
    2121                                 
    2222SRCS= \
    2323                 $(INTDIR)\remote-database.cc \
    24                  $(INTDIR)\net_document.cc \
     24                 $(INTDIR)\remote-document.cc \
    2525                 $(INTDIR)\net_termlist.cc \
    2626                 $(INTDIR)\net_postlist.cc \
    2727
  • 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)\msvc_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)\msvc_uuid.cc \
    3537    $(INTDIR)\socket_utils.cc \
    3638    $(INTDIR)\stringutils.cc \
    3739    $(INTDIR)\safe.cc \
  • xapian-maintainer-tools/win32msvc/win32_perftest.mak

     
    5858CPP_OBJS=..\..\win32\$(XAPIAN_DEBUG_OR_RELEASE)
    5959CPP_SBRS=.
    6060
    61 ALL_LINK32_FLAGS=$(LINK32_FLAGS) $(XAPIAN_LIBS) "$(OUTLIBDIR)\libtest.lib"
     61ALL_LINK32_FLAGS=$(LINK32_FLAGS) $(XAPIAN_LIBS) "$(OUTLIBDIR)\libtest.lib" 
    6262 
    6363# executables
    64 $(BUILD_ALL) : perftest_all.h $(OUTDIR) $(DEF_FILE) $(OBJS) $(XAPIAN_LIBS)
     64$(BUILD_ALL) : perftest_all.h $(OUTDIR) $(DEF_FILE) $(OBJS) $(XAPIAN_LIBS) "$(OUTLIBDIR)\libtest.lib"
    6565    $(LINK32) @<<
    6666  $(ALL_LINK32_FLAGS) /out:"$(BUILD_ALL)" $(DEF_FLAGS) $(OBJS)
    6767<<