VirtualBox

Changeset 105421 in vbox for trunk


Ignore:
Timestamp:
Jul 19, 2024 1:52:30 PM (6 months ago)
Author:
vboxsync
Message:

libxml2-2.13.2: Fixes to make it build. bugref:10730

Location:
trunk/src/libs/libxml2-2.13.2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/libxml2-2.13.2/dict.c

    r105420 r105421  
    10181018    return(result & 0xFFFFFFFF);
    10191019}
    1020 #endif
    10211020
    10221021/*
     
    10241023 *
    10251024 * Generate a pseudo-random value using the global PRNG.
     1025 *
     1026 * Returns a random value.
     1027 */
     1028unsigned
     1029xmlGlobalRandom(void) {
     1030    unsigned ret;
     1031
     1032    xmlMutexLock(&xmlRngMutex);
     1033    ret = xoroshiro64ss(globalRngState);
     1034    xmlMutexUnlock(&xmlRngMutex);
     1035
     1036    return(ret);
     1037}
     1038#endif //VBOX
     1039
     1040/*
     1041 * xmlRandom:
     1042 *
     1043 * Generate a pseudo-random value using the thread-local PRNG.
    10261044 *
    10271045 * Returns a random value.
     
    10481066
    10491067    return(ret);
    1050 }
    1051 
    1052 /*
    1053  * xmlRandom:
    1054  *
    1055  * Generate a pseudo-random value using the thread-local PRNG.
    1056  *
    1057  * Returns a random value.
    1058  */
    1059 unsigned
    1060 xmlRandom(void) {
    1061 #ifdef LIBXML_THREAD_ENABLED
    1062     return(xoroshiro64ss(xmlGetLocalRngState()));
    1063 #else
    1064     return(xmlGlobalRandom());
    10651068#endif
    10661069#else
  • trunk/src/libs/libxml2-2.13.2/include/libxml/xmlexports.h

    r105420 r105421  
    3131#define XMLPUBVAR XMLPUBLIC extern
    3232
    33 /* bird/VirtualBox: Visibility attributes - start  */
    34 /* frank: changed to "hidden" */
    35 #if defined(VBOX_HAVE_VISIBILITY_HIDDEN) && !defined(LIBXML_STATIC) && defined(IN_LIBXML)
    36   #undef XMLPUBFUN
    37   #undef XMLPUBVAR
    38   #define XMLPUBFUN __attribute__((visibility("hidden")))
    39   #define XMLPUBVAR __attribute__((visibility("hidden"))) extern
    40 #endif
    41 /* bird/VirtualBox: Visibility attributes - end  */
    42 
    43 
    4433/* Compatibility */
    4534#define XMLCALL
     
    5241 * Attributes
    5342 */
     43// VBOX. Get rid of warning C4668
     44//#ifndef __GNUC__
     45//#define __GNUC__ 0
     46//#endif
    5447
    5548#ifndef ATTRIBUTE_UNUSED
     
    139132#endif
    140133
     134/* bird/VirtualBox: Visibility attributes - start  */
     135/* frank: changed to "hidden" */
     136#if defined(VBOX_HAVE_VISIBILITY_HIDDEN) && !defined(LIBXML_STATIC) && defined(IN_LIBXML)
     137  #undef XMLPUBFUN
     138  #undef XMLPUBVAR
     139  #define XMLPUBFUN __attribute__((visibility("hidden")))
     140  #define XMLPUBVAR __attribute__((visibility("hidden"))) extern
     141#endif
     142/* bird/VirtualBox: Visibility attributes - end  */
     143
     144
    141145/*
    142146 * Originally declared in xmlversion.h which is generated
  • trunk/src/libs/libxml2-2.13.2/xmlIO.c

    r105420 r105421  
    115115 ************************************************************************/
    116116
    117 static const char* const IOerr[] = {
    118     "Unknown IO error",         /* UNKNOWN */
    119     "Permission denied",        /* EACCES */
    120     "Resource temporarily unavailable",/* EAGAIN */
    121     "Bad file descriptor",      /* EBADF */
    122     "Bad message",              /* EBADMSG */
    123     "Resource busy",            /* EBUSY */
    124     "Operation canceled",       /* ECANCELED */
    125     "No child processes",       /* ECHILD */
    126     "Resource deadlock avoided",/* EDEADLK */
    127     "Domain error",             /* EDOM */
    128     "File exists",              /* EEXIST */
    129     "Bad address",              /* EFAULT */
    130     "File too large",           /* EFBIG */
    131     "Operation in progress",    /* EINPROGRESS */
    132     "Interrupted function call",/* EINTR */
    133     "Invalid argument",         /* EINVAL */
    134     "Input/output error",       /* EIO */
    135     "Is a directory",           /* EISDIR */
    136     "Too many open files",      /* EMFILE */
    137     "Too many links",           /* EMLINK */
    138     "Inappropriate message buffer length",/* EMSGSIZE */
    139     "Filename too long",        /* ENAMETOOLONG */
    140     "Too many open files in system",/* ENFILE */
    141     "No such device",           /* ENODEV */
    142     "No such file or directory",/* ENOENT */
    143     "Exec format error",        /* ENOEXEC */
    144     "No locks available",       /* ENOLCK */
    145     "Not enough space",         /* ENOMEM */
    146     "No space left on device",  /* ENOSPC */
    147     "Function not implemented", /* ENOSYS */
    148     "Not a directory",          /* ENOTDIR */
    149     "Directory not empty",      /* ENOTEMPTY */
    150     "Not supported",            /* ENOTSUP */
    151     "Inappropriate I/O control operation",/* ENOTTY */
    152     "No such device or address",/* ENXIO */
    153     "Operation not permitted",  /* EPERM */
    154     "Broken pipe",              /* EPIPE */
    155     "Result too large",         /* ERANGE */
    156     "Read-only file system",    /* EROFS */
    157     "Invalid seek",             /* ESPIPE */
    158     "No such process",          /* ESRCH */
    159     "Operation timed out",      /* ETIMEDOUT */
    160     "Improper link",            /* EXDEV */
    161     "Attempt to load network entity %s", /* XML_IO_NETWORK_ATTEMPT */
    162     "encoder error",            /* XML_IO_ENCODER */
    163     "flush error",
    164     "write error",
    165     "no input",
    166     "buffer full",
    167     "loading error",
    168     "not a socket",             /* ENOTSOCK */
    169     "already connected",        /* EISCONN */
    170     "connection refused",       /* ECONNREFUSED */
    171     "unreachable network",      /* ENETUNREACH */
    172     "address in use",           /* EADDRINUSE */
    173     "already in use",           /* EALREADY */
    174     "unknown address family",   /* EAFNOSUPPORT */
    175 };
    176 
    177 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
    178117/**
    179118 * xmlIOErrMemory:
     
    411350 ************************************************************************/
    412351
    413 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
     352#if defined(_WIN32)
    414353
    415354/**
     
    484423{
    485424#ifdef HAVE_STAT
    486 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
     425#if defined(_WIN32)
    487426    struct _stat stat_buffer;
    488427#else
     
    496435
    497436#ifdef HAVE_STAT
    498 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
     437#if defined(_WIN32)
    499438    {
    500439        wchar_t *wpath;
     
    760699        wchar_t *wpath;
    761700
    762 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
    763     fd = xmlWrapOpenUtf8(path, 0);
     701        wpath = __xmlIOWin32UTF8ToWChar(filename);
     702        if (wpath == NULL) {
     703            xmlFree(fromUri);
     704            return(XML_ERR_NO_MEMORY);
     705        }
     706        fd = _wfopen(wpath, write ? L"wb" : L"rb");
     707        xmlFree(wpath);
     708    }
    764709#else
    765710    fd = fopen(filename, write ? "wb" : "rb");
     
    799744    void *context;
    800745
    801     if (!strcmp(filename, "-")) {
    802         fd = stdout;
    803         return((void *) fd);
    804     }
    805 
    806     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
    807 #if defined (_WIN32)
    808         path = &filename[17];
    809 #else
    810         path = &filename[16];
    811 #endif
    812     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
    813 #if defined (_WIN32)
    814         path = &filename[8];
    815 #else
    816         path = &filename[7];
    817 #endif
    818     } else
    819         path = filename;
    820 
    821     if (path == NULL)
    822         return(NULL);
    823 
    824 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
    825     fd = xmlWrapOpenUtf8(path, 1);
    826 #elif(__MVS__)
    827     fd = fopen(path, "w");
    828 #else
    829     fd = fopen(path, "wb");
    830 #endif /* WIN32 */
    831 
    832     if (fd == NULL) xmlIOErr(0, path);
    833     return((void *) fd);
     746    xmlFileOpenSafe(filename, 0, &context);
     747    return(context);
    834748}
    835749
     
    968882 *                                                                      *
    969883 ************************************************************************/
    970 
    971 /**
    972  * xmlGzfileOpen_real:
    973  * @filename:  the URI for matching
    974  *
    975  * input from compressed file open
    976  * if @filename is " " then the standard input is used
    977  *
    978  * Returns an I/O context or NULL in case of error
    979  */
    980 static void *
    981 xmlGzfileOpen_real (const char *filename) {
    982     const char *path = NULL;
    983     gzFile fd;
    984 
    985     if (!strcmp(filename, "-")) {
    986         int duped_fd = dup(fileno(stdin));
    987         fd = gzdopen(duped_fd, "rb");
    988         if (fd == Z_NULL && duped_fd >= 0) {
    989             close(duped_fd);  /* gzdOpen() does not close on failure */
    990         }
    991 
    992         return((void *) fd);
    993     }
    994 
    995     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
    996 #if defined (_WIN32)
    997         path = &filename[17];
    998 #else
    999         path = &filename[16];
    1000 #endif
    1001     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
    1002 #if defined (_WIN32)
    1003         path = &filename[8];
    1004 #else
    1005         path = &filename[7];
    1006 #endif
    1007     } else
    1008         path = filename;
    1009 
    1010     if (path == NULL)
    1011         return(NULL);
    1012     if (!xmlCheckFilename(path))
    1013         return(NULL);
    1014 
    1015 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
    1016     fd = xmlWrapGzOpenUtf8(path, "rb");
    1017 #else
    1018     fd = gzopen(path, "rb");
    1019 #endif
    1020     return((void *) fd);
    1021 }
    1022 
    1023 /**
    1024  * xmlGzfileOpen:
    1025  * @filename:  the URI for matching
    1026  *
    1027  * Wrapper around xmlGzfileOpen_real if the open fails, it will
    1028  * try to unescape @filename
    1029  */
    1030 static void *
    1031 xmlGzfileOpen (const char *filename) {
    1032     char *unescaped;
    1033     void *retval;
    1034 
    1035     retval = xmlGzfileOpen_real(filename);
    1036     if (retval == NULL) {
    1037         unescaped = xmlURIUnescapeString(filename, 0, NULL);
    1038         if (unescaped != NULL) {
    1039             retval = xmlGzfileOpen_real(unescaped);
    1040         }
    1041         xmlFree(unescaped);
    1042     }
    1043     return retval;
    1044 }
    1045 
    1046 #ifdef LIBXML_OUTPUT_ENABLED
    1047 /**
    1048  * xmlGzfileOpenW:
    1049  * @filename:  the URI for matching
    1050  * @compression:  the compression factor (0 - 9 included)
    1051  *
    1052  * input from compressed file open
    1053  * if @filename is " " then the standard input is used
    1054  *
    1055  * Returns an I/O context or NULL in case of error
    1056  */
    1057 static void *
    1058 xmlGzfileOpenW (const char *filename, int compression) {
    1059     const char *path = NULL;
    1060     char mode[15];
    1061     gzFile fd;
    1062 
    1063     snprintf(mode, sizeof(mode), "wb%d", compression);
    1064     if (!strcmp(filename, "-")) {
    1065         int duped_fd = dup(fileno(stdout));
    1066         fd = gzdopen(duped_fd, "rb");
    1067         if (fd == Z_NULL && duped_fd >= 0) {
    1068             close(duped_fd);  /* gzdOpen() does not close on failure */
    1069         }
    1070 
    1071         return((void *) fd);
    1072     }
    1073 
    1074     if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
    1075 #if defined (_WIN32)
    1076         path = &filename[17];
    1077 #else
    1078         path = &filename[16];
    1079 #endif
    1080     else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
    1081 #if defined (_WIN32)
    1082         path = &filename[8];
    1083 #else
    1084         path = &filename[7];
    1085 #endif
    1086     } else
    1087         path = filename;
    1088 
    1089     if (path == NULL)
    1090         return(NULL);
    1091 
    1092 #if (defined(_WIN32) || defined (__DJGPP__)) && !defined (__CYGWIN__) && !defined(IPRT_NO_CRT)
    1093     fd = xmlWrapGzOpenUtf8(path, mode);
    1094 #else
    1095     fd = gzopen(path, mode);
    1096 #endif
    1097     return((void *) fd);
    1098 }
    1099 #endif /* LIBXML_OUTPUT_ENABLED */
    1100884
    1101885/**
  • trunk/src/libs/libxml2-2.13.2/xmlmemory.c

    r105420 r105421  
    1313#include <time.h>
    1414
    15 /**
    16  * MEM_LIST:
    17  *
    18  * keep track of all allocated blocks for error reporting
    19  * Always build the memory list !
    20  */
    21 #ifdef DEBUG_MEMORY_LOCATION
    22  #ifndef MEM_LIST
    23   #define MEM_LIST /* keep a list of all the allocated memory blocks */
    24  #endif
    25 #endif
    26 
    2715#include <libxml/xmlmemory.h>
    2816#include <libxml/xmlerror.h>
     
    3321#include "private/threads.h"
    3422
    35 static int xmlMemInitialized = 0;
    3623static unsigned long  debugMemSize = 0;
    3724static unsigned long  debugMemBlocks = 0;
     
    4431 ************************************************************************/
    4532
    46 #if !defined(LIBXML_THREAD_ENABLED) && !defined(LIBXML_THREAD_ALLOC_ENABLED)
    47  #ifdef xmlMalloc
    48  #undef xmlMalloc
    49  #endif
    50 
    51  #ifdef xmlRealloc
    52  #undef xmlRealloc
    53  #endif
    54 
    55  #ifdef xmlMemStrdup
    56  #undef xmlMemStrdup
    57  #endif
    58 #endif
    59 
    6033/*
    6134 * Each of the blocks allocated begin with a header containing information
     
    7447#define ALIGN_SIZE  sizeof(double)
    7548#endif
    76 
    77 #define HDR_SIZE    sizeof(MEMHDR)
    78 #define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
     49#define RESERVE_SIZE (((sizeof(MEMHDR) + ALIGN_SIZE - 1) \
    7950                      / ALIGN_SIZE ) * ALIGN_SIZE)
    8051
     
    441412void
    442413xmlInitMemoryInternal(void) {
    443 
    444 #ifdef VBOX
    445      const char *breakpoint;
    446 #else
    447      char *breakpoint;
    448 #endif
    449 
    450 #ifdef DEBUG_MEMORY
    451      xmlGenericError(xmlGenericErrorContext,
    452              "xmlInitMemory()\n");
    453 #endif
    454 
    455      xmlInitMutex(&xmlMemMutex);
    456 
    457      breakpoint = getenv("XML_MEM_BREAKPOINT");
    458      if (breakpoint != NULL) {
    459          sscanf(breakpoint, "%ud", &xmlMemStopAtBlock);
    460      }
    461      breakpoint = getenv("XML_MEM_TRACE");
    462      if (breakpoint != NULL) {
    463          sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
    464      }
     414    xmlInitMutex(&xmlMemMutex);
    465415}
    466416
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette