SOURCES: tremulous-backport.patch - shoot, wrong one, should be: http://tre...

sparky sparky at pld-linux.org
Wed Sep 3 01:09:05 CEST 2008


Author: sparky                       Date: Tue Sep  2 23:09:05 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- shoot, wrong one, should be: http://trem.tjw.org/backport/tremulous-svn755.patch

---- Files affected:
SOURCES:
   tremulous-backport.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/tremulous-backport.patch
diff -u SOURCES/tremulous-backport.patch:1.1 SOURCES/tremulous-backport.patch:1.2
--- SOURCES/tremulous-backport.patch:1.1	Wed Sep  3 01:06:50 2008
+++ SOURCES/tremulous-backport.patch	Wed Sep  3 01:08:59 2008
@@ -1,2047 +1,4530 @@
-Index: src/server/sv_client.c
+Index: make-macosx-ub.sh
 ===================================================================
---- src/server/sv_client.c	(revision 823)
-+++ src/server/sv_client.c	(working copy)
-@@ -460,7 +460,11 @@
- 	sharedEntity_t *ent;
- 
- 	Com_DPrintf( "Going from CS_PRIMED to CS_ACTIVE for %s\n", client->name );
-+
- 	client->state = CS_ACTIVE;
-+	// resend all configstrings using the cs commands since these are
-+	// no longer sent when the client is CS_PRIMED
-+	SV_UpdateConfigstrings( client );
- 
- 	// set up the entity for the client
- 	clientNum = client - svs.clients;
-Index: src/server/server.h
+--- make-macosx-ub.sh	(revision 0)
++++ make-macosx-ub.sh	(revision 0)
+@@ -0,0 +1,50 @@
++#!/bin/sh
++
++DESTDIR=build/release-darwin-ub
++BASEDIR=base
++
++BIN_OBJ="
++	build/release-darwin-ppc/tremulous.ppc
++	build/release-darwin-x86/tremulous.x86
++"
++BASE_OBJ="
++	build/release-darwin-ppc/$BASEDIR/cgameppc.dylib
++	build/release-darwin-x86/$BASEDIR/cgamex86.dylib
++	build/release-darwin-ppc/$BASEDIR/uippc.dylib
++	build/release-darwin-x86/$BASEDIR/uix86.dylib
++	build/release-darwin-ppc/$BASEDIR/gameppc.dylib
++	build/release-darwin-x86/$BASEDIR/gamex86.dylib
++"
++if [ ! -f Makefile ]; then
++	echo "This script must be run from the ioquake3 build directory";
++fi
++
++if [ ! -d /Developer/SDKs/MacOSX10.2.8.sdk ]; then
++	echo "
++/Developer/SDKs/MacOSX10.2.8.sdk/ is missing, this doesn't install by default
++with newer XCode releases, but you should be able to fine the installer at
++/Applications/Installers/Xcode Tools/Packages/"
++	exit 1;
++fi
++
++if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then
++	echo "
++/Developer/SDKs/MacOSX10.4u.sdk/ is missing.  You must install XCode 2.2 or 
++newer in order to build Universal Binaries"
++	exit 1;
++fi
++
++(BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=x86 make) || exit 1;
++
++if [ ! -d $DESTDIR ]; then 
++	mkdir $DESTDIR || exit 1;
++fi
++if [ ! -d $DESTDIR/$BASEDIR ]; then
++	mkdir $DESTDIR/$BASEDIR || exit 1;
++fi
++
++echo "Installing Universal Binaries in $DESTDIR"
++lipo -create -o $DESTDIR/Tremulous $BIN_OBJ
++cp $BASE_OBJ $DESTDIR/$BASEDIR/
++cp src/libs/macosx/*.dylib $DESTDIR/
++
+Index: src/unix/unix_shared.c
 ===================================================================
---- src/server/server.h	(revision 823)
-+++ src/server/server.h	(working copy)
-@@ -169,6 +169,7 @@
- 	netchan_buffer_t **netchan_end_queue;
- 
- 	int				oldServerTime;
-+	qboolean			csupdated[MAX_CONFIGSTRINGS+1];	
- } client_t;
- 
- //=============================================================================
-@@ -227,6 +228,8 @@
- extern	cvar_t	*sv_rconPassword;
- extern	cvar_t	*sv_privatePassword;
- extern	cvar_t	*sv_allowDownload;
-+extern	cvar_t	*sv_wwwDownload;
-+extern	cvar_t	*sv_wwwBaseURL;
- extern	cvar_t	*sv_maxclients;
+--- src/unix/unix_shared.c	(revision 755)
++++ src/unix/unix_shared.c	(working copy)
+@@ -175,6 +175,22 @@
+   return s; // bk001204 - duh
+ }
  
- extern	cvar_t	*sv_privateClients;
-@@ -272,6 +275,7 @@
- //
- void SV_SetConfigstring( int index, const char *val );
- void SV_GetConfigstring( int index, char *buffer, int bufferSize );
-+void SV_UpdateConfigstrings( client_t *client );
++qboolean Sys_RandomBytes( byte *string, int len )
++{
++  FILE *fp;
++
++  fp = fopen( "/dev/urandom", "r" );
++  if( !fp )
++    return qfalse;
++
++  if( !fread( string, sizeof( byte ), len, fp ) ) {
++	fclose( fp );
++	return qfalse;
++  }
++  fclose( fp );
++  return qtrue; 
++}
++
+ //============================================
  
- void SV_SetUserinfo( int index, const char *val );
- void SV_GetUserinfo( int index, char *buffer, int bufferSize );
-Index: src/server/sv_init.c
+ #define	MAX_FOUND_FILES	0x1000
+Index: src/unix/sdl_glimp.c
 ===================================================================
---- src/server/sv_init.c	(revision 823)
-+++ src/server/sv_init.c	(working copy)
-@@ -23,15 +23,62 @@
+--- src/unix/sdl_glimp.c	(revision 755)
++++ src/unix/sdl_glimp.c	(working copy)
+@@ -68,7 +68,12 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#if USE_SDL_VIDEO
++#include "SDL.h"
++#include "SDL_loadso.h"
++#else
+ #include <dlfcn.h>
++#endif
+ 
+ #include "../renderer/tr_local.h"
+ #include "../client/client.h"
+@@ -266,7 +271,14 @@
+     //else if (ch >= 'A' && ch <= 'Z')
+     //  ch = ch - 'A' + 'a';
+ 
+-    buf[0] = ch;
++    // tjw: translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
++    if (ch == K_BACKSPACE)
++    {
++      *key = 'h' - 'a' + 1;
++      buf[0] = *key;
++    }
++    else
++      buf[0] = ch;
+   }
  
- #include "server.h"
+   return buf;
+Index: src/unix/unix_net.c
+===================================================================
+--- src/unix/unix_net.c	(revision 755)
++++ src/unix/unix_net.c	(working copy)
+@@ -26,6 +26,10 @@
+ #include "../qcommon/qcommon.h"
+ 
+ #include <unistd.h>
++#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
++  // needed for socket_t on OSX 10.2
++  #define _BSD_SOCKLEN_T_
++#endif
+ #include <sys/socket.h>
+ #include <sys/time.h>
+ #include <netinet/in.h>
+@@ -354,10 +358,18 @@
+ // Don't do a forward mapping from the hostname of the machine to the IP.  The reason is that we might have obtained an IP address from DHCP and there might not be any name registered for the machine.  On Mac OS X, the machine name defaults to 'localhost' and NetInfo has 127.0.0.1 listed for this name.  Instead, we want to get a list of all the IP network interfaces on the machine.
+ // This code adapted from OmniNetworking.
+ 
+-#define IFR_NEXT(ifr)	\
+-    ((struct ifreq *) ((char *) (ifr) + sizeof(*(ifr)) + \
+-      MAX(0, (int) (ifr)->ifr_addr.sa_len - (int) sizeof((ifr)->ifr_addr))))
+ 
++#ifdef _SIZEOF_ADDR_IFREQ
++	// tjw: OSX 10.4 does not have sa_len
++	#define IFR_NEXT(ifr)	\
++	((struct ifreq *) ((char *) ifr + _SIZEOF_ADDR_IFREQ(*ifr)))
++#else
++	// tjw: assume that once upon a time some version did have sa_len
++	#define IFR_NEXT(ifr)	\
++	((struct ifreq *) ((char *) (ifr) + sizeof(*(ifr)) + \
++	MAX(0, (int) (ifr)->ifr_addr.sa_len - (int) sizeof((ifr)->ifr_addr))))
++#endif
++
+ void NET_GetLocalAddress( void ) {
+         struct ifreq requestBuffer[MAX_IPS], *linkInterface, *inetInterface;
+         struct ifconf ifc;
+@@ -366,7 +378,7 @@
+         int interfaceSocket;
+         int family;
+         
+-        //Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n");
++        Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n");
+         
+         // Set this early so we can just return if there is an error
+ 	numIP = 0;
+@@ -438,6 +450,7 @@
+             }
+             linkInterface = IFR_NEXT(linkInterface);
+         }
++        Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n");
  
+         close(interfaceSocket);
+ }
+Index: src/libcurl/curl/stdcheaders.h
+===================================================================
+--- src/libcurl/curl/stdcheaders.h	(revision 0)
++++ src/libcurl/curl/stdcheaders.h	(revision 0)
+@@ -0,0 +1,34 @@
++#ifndef __STDC_HEADERS_H
++#define __STDC_HEADERS_H
++/***************************************************************************
++ *                                  _   _ ____  _     
++ *  Project                     ___| | | |  _ \| |    
++ *                             / __| | | | |_) | |    
++ *                            | (__| |_| |  _ <| |___ 
++ *                             \___|\___/|_| \_\_____|
++ *
++ * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel at haxx.se>, et al.
++ *
++ * This software is licensed as described in the file COPYING, which
++ * you should have received as part of this distribution. The terms
++ * are also available at http://curl.haxx.se/docs/copyright.html.
++ * 
++ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
++ * copies of the Software, and permit persons to whom the Software is
++ * furnished to do so, under the terms of the COPYING file.
++ *
++ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
++ * KIND, either express or implied.
++ *
++ * $Id$
++ ***************************************************************************/
++
++#include <sys/types.h>
++
++size_t fread (void *, size_t, size_t, FILE *);
++size_t fwrite (const void *, size_t, size_t, FILE *);
++
++int strcasecmp(const char *, const char *);
++int strncasecmp(const char *, const char *, size_t);
++
++#endif
+Index: src/libcurl/curl/multi.h
+===================================================================
+--- src/libcurl/curl/multi.h	(revision 0)
++++ src/libcurl/curl/multi.h	(revision 0)
+@@ -0,0 +1,344 @@
++#ifndef __CURL_MULTI_H
++#define __CURL_MULTI_H
++/***************************************************************************
++ *                                  _   _ ____  _
++ *  Project                     ___| | | |  _ \| |
++ *                             / __| | | | |_) | |
++ *                            | (__| |_| |  _ <| |___
++ *                             \___|\___/|_| \_\_____|
++ *
++ * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel at haxx.se>, et al.
++ *
++ * This software is licensed as described in the file COPYING, which
++ * you should have received as part of this distribution. The terms
++ * are also available at http://curl.haxx.se/docs/copyright.html.
++ *
++ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
++ * copies of the Software, and permit persons to whom the Software is
++ * furnished to do so, under the terms of the COPYING file.
++ *
++ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
++ * KIND, either express or implied.
++ *
++ * $Id$
++ ***************************************************************************/
++/*
++  This is an "external" header file. Don't give away any internals here!
++
++  GOALS
++
++  o Enable a "pull" interface. The application that uses libcurl decides where
++    and when to ask libcurl to get/send data.
++
++  o Enable multiple simultaneous transfers in the same thread without making it
++    complicated for the application.
++
++  o Enable the application to select() on its own file descriptors and curl's
++    file descriptors simultaneous easily.
 +
- /*
- ===============
-+SV_SendConfigstring
-+===============
 +*/
-+static void SV_SendConfigString(client_t *client, int index)
-+{
-+	int maxChunkSize = MAX_STRING_CHARS - 24;
-+	int len;
++#if defined(_WIN32) && !defined(WIN32)
++/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we
++   make this adjustment to catch this. */
++#define WIN32 1
++#endif
++
++#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
++  !defined(__CYGWIN__) || defined(__MINGW32__)
++#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
++/* The check above prevents the winsock2 inclusion if winsock.h already was
++   included, since they can't co-exist without problems */
++#include <winsock2.h>
++#endif
++#else
++
++/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
++   libc5-based Linux systems. Only include it on system that are known to
++   require it! */
++#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(_MINIX)
++#include <sys/select.h>
++#endif
++
++#ifndef _WIN32_WCE
++#include <sys/socket.h>
++#endif
++#include <sys/time.h>
++#include <sys/types.h>
++#endif
 +
-+	if(!sv.configstrings[index][0])
-+		return;
++/*
++ * This header file should not really need to include "curl.h" since curl.h
++ * itself includes this file and we expect user applications to do #include
++ * <curl/curl.h> without the need for especially including multi.h.
++ *
++ * For some reason we added this include here at one point, and rather than to
++ * break existing (wrongly written) libcurl applications, we leave it as-is
++ * but with this warning attached.
++ */
++#include "curl.h"
++
++#ifdef  __cplusplus
++extern "C" {
++#endif
++
++typedef void CURLM;
++
++#ifndef curl_socket_typedef
++/* Public socket typedef */
++#ifdef WIN32
++typedef SOCKET curl_socket_t;
++#define CURL_SOCKET_BAD INVALID_SOCKET
++#else
++typedef int curl_socket_t;
++#define CURL_SOCKET_BAD -1
++#endif
++#define curl_socket_typedef
++#endif /* curl_socket_typedef */
++
++typedef enum {
++  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
++                                    curl_multi_socket*() soon */
++  CURLM_OK,
++  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */
++  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
++  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */
++  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */
++  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */
++  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
++  CURLM_LAST
++} CURLMcode;
++
++/* just to make code nicer when using curl_multi_socket() you can now check
++   for CURLM_CALL_MULTI_SOCKET too in the same style it works for
++   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
++#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
++
++typedef enum {
++  CURLMSG_NONE, /* first, not used */
++  CURLMSG_DONE, /* This easy handle has completed. 'result' contains
++                   the CURLcode of the transfer */
++  CURLMSG_LAST /* last, not used */
++} CURLMSG;
++
++struct CURLMsg {
++  CURLMSG msg;       /* what this message means */
++  CURL *easy_handle; /* the handle it concerns */
++  union {
++    void *whatever;    /* message-specific data */
++    CURLcode result;   /* return code for transfer */
++  } data;
++};
++typedef struct CURLMsg CURLMsg;
 +
-+	len = strlen(sv.configstrings[index]);
++/*
++ * Name:    curl_multi_init()
++ *
++ * Desc:    inititalize multi-style curl usage
++ *
++ * Returns: a new CURLM handle to use in all 'curl_multi' functions.
++ */
++CURL_EXTERN CURLM *curl_multi_init(void);
 +
-+	if( len >= maxChunkSize ) {
-+		int		sent = 0;
-+		int		remaining = len;
-+		char	*cmd;
-+		char	buf[MAX_STRING_CHARS];
-+
-+		while (remaining > 0 ) {
-+			if ( sent == 0 ) {
-+				cmd = "bcs0";
-+			}
-+			else if( remaining < maxChunkSize ) {
-+				cmd = "bcs2";
-+			}
-+			else {
-+				cmd = "bcs1";
-+			}
-+			Q_strncpyz( buf, &sv.configstrings[index][sent],
-+				maxChunkSize );
++/*
++ * Name:    curl_multi_add_handle()
++ *
++ * Desc:    add a standard curl handle to the multi stack
++ *
++ * Returns: CURLMcode type, general multi error code.
++ */
++CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
++                                            CURL *curl_handle);
++
++ /*
++  * Name:    curl_multi_remove_handle()
++  *
++  * Desc:    removes a curl handle from the multi stack again
++  *
++  * Returns: CURLMcode type, general multi error code.
++  */
++CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
++                                               CURL *curl_handle);
++
++ /*
++  * Name:    curl_multi_fdset()
++  *
++  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or
++  *          poll() on. We want curl_multi_perform() called as soon as one of
++  *          them are ready.
++  *
++  * Returns: CURLMcode type, general multi error code.
++  */
++CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
++                                       fd_set *read_fd_set,
++                                       fd_set *write_fd_set,
++                                       fd_set *exc_fd_set,
++                                       int *max_fd);
++
++ /*
++  * Name:    curl_multi_perform()
++  *
++  * Desc:    When the app thinks there's data available for curl it calls this
++  *          function to read/write whatever there is right now. This returns
++  *          as soon as the reads and writes are done. This function does not
++  *          require that there actually is data available for reading or that
++  *          data can be written, it can be called just in case. It returns
++  *          the number of handles that still transfer data in the second
++  *          argument's integer-pointer.
++  *
++  * Returns: CURLMcode type, general multi error code. *NOTE* that this only
++  *          returns errors etc regarding the whole multi stack. There might
++  *          still have occurred problems on invidual transfers even when this
++  *          returns OK.
++  */
++CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
++                                         int *running_handles);
++
++ /*
++  * Name:    curl_multi_cleanup()
++  *
++  * Desc:    Cleans up and removes a whole multi stack. It does not free or
++  *          touch any individual easy handles in any way. We need to define
++  *          in what state those handles will be if this function is called
++  *          in the middle of a transfer.
++  *
++  * Returns: CURLMcode type, general multi error code.
++  */
++CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
 +
-+			SV_SendServerCommand( client, "%s %i \"%s\"\n", cmd,
-+				index, buf );
++/*
++ * Name:    curl_multi_info_read()
++ *
++ * Desc:    Ask the multi handle if there's any messages/informationals from
++ *          the individual transfers. Messages include informationals such as
++ *          error code from the transfer or just the fact that a transfer is
++ *          completed. More details on these should be written down as well.
++ *
++ *          Repeated calls to this function will return a new struct each
++ *          time, until a special "end of msgs" struct is returned as a signal
++ *          that there is no more to get at this point.
++ *
++ *          The data the returned pointer points to will not survive calling
++ *          curl_multi_cleanup().
++ *
++ *          The 'CURLMsg' struct is meant to be very simple and only contain
++ *          very basic informations. If more involved information is wanted,
++ *          we will provide the particular "transfer handle" in that struct
++ *          and that should/could/would be used in subsequent
++ *          curl_easy_getinfo() calls (or similar). The point being that we
++ *          must never expose complex structs to applications, as then we'll
++ *          undoubtably get backwards compatibility problems in the future.
++ *
++ * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
++ *          of structs. It also writes the number of messages left in the
++ *          queue (after this read) in the integer the second argument points
++ *          to.
++ */
++CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
++                                          int *msgs_in_queue);
 +
-+			sent += (maxChunkSize - 1);
-+			remaining -= (maxChunkSize - 1);
-+		}
-+	} else {
-+		// standard cs, just send it
-+		SV_SendServerCommand( client, "cs %i \"%s\"\n", index,
-+			sv.configstrings[index] );
-+	}
-+}
++/*
++ * Name:    curl_multi_strerror()
++ *
++ * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode
++ *          value into the equivalent human readable error string.  This is
++ *          useful for printing meaningful error messages.
++ *
++ * Returns: A pointer to a zero-terminated error message.
++ */
++CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
 +
 +/*
-+===============
- SV_SetConfigstring
- 
- ===============
- */
- void SV_SetConfigstring (int index, const char *val) {
- 	int		len, i;
--	int		maxChunkSize = MAX_STRING_CHARS - 24;
- 	client_t	*client;
- 
- 	if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
-@@ -57,48 +104,41 @@
- 
- 		// send the data to all relevent clients
- 		for (i = 0, client = svs.clients; i < sv_maxclients->integer ; i++, client++) {
--			if ( client->state < CS_PRIMED ) {
-+			if ( client->state < CS_ACTIVE ) {
-+				client->csupdated[index] = qtrue;
- 				continue;
- 			}
- 			// do not always send server info to all clients
- 			if ( index == CS_SERVERINFO && client->gentity && (client->gentity->r.svFlags & SVF_NOSERVERINFO) ) {
- 				continue;
- 			}
-+		
- 
- 			len = strlen( val );
--			if( len >= maxChunkSize ) {
--				int		sent = 0;
--				int		remaining = len;
--				char	*cmd;
--				char	buf[MAX_STRING_CHARS];
-+			SV_SendConfigString(client, index);
-+		}
-+	}
-+}
- 
--				while (remaining > 0 ) {
--					if ( sent == 0 ) {
--						cmd = "bcs0";
--					}
--					else if( remaining < maxChunkSize ) {
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/tremulous-backport.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list