Tremulous Forum

Mods => Modding Center => Topic started by: PwNz! on October 17, 2007, 12:46:36 PM

Title: Patches Explained.
Post by: PwNz! on October 17, 2007, 12:46:36 PM
Can someone please explain a patch.
I know - means to remove it and + to add it. But what about @'s and things.

Could someone please explain all the symbols and how they are used, and what happens. With tjw's patch here:


Index: src/server/server.h
===================================================================
--- 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;

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 );

void SV_SetUserinfo( int index, const char *val );
void SV_GetUserinfo( int index, char *buffer, int bufferSize );
Title: Re: Patches Explained.
Post by: next_ghost on October 17, 2007, 03:11:36 PM
Index: file to patch
===================================================================
--- old file (revision info)
+++ new file (revision info)
@@ -first line in old file,old hunk size +first line in new file,new hunk size @@
changes
@@ ... @@
another change in the same file
Index: another file to patch
===================================================================
...
Title: Patches Explained.
Post by: PwNz! on October 17, 2007, 09:30:40 PM
Thank you :)

So, would this mean that this line -@@ -169,6 +169,7 @@ , deletes line 169 and replaces it with the patch one.    netchan_buffer_t **netchan_end_queue;
 and the rest? or just that line.
   int            oldServerTime;
+   qboolean         csupdated[MAX_CONFIGSTRINGS+1];    
} client_t;
Title: Patches Explained.
Post by: Caveman on October 17, 2007, 10:15:57 PM
why not just simply apply the patch and have a look see what happened to the source?

That would be faster than reading the manual / howto or waiting here to get an answer you like.
Title: Patches Explained.
Post by: Plague on October 17, 2007, 10:20:01 PM
Quote from: Cavemanwhy not just simply apply the patch and have a look see what happened to the source?

That would be faster than reading the manual / howto or waiting here to get an answer you like.

Why don't you just load a gun, aim it at your head and fire?

Once again we're blessed with the infallible logic of Caveman.
Title: Patches Explained.
Post by: benmachine on October 17, 2007, 10:59:42 PM
Quote from: PwNz!Thank you :)

So, would this mean that this line -@@ -169,6 +169,7 @@ , deletes line 169 and replaces it with the patch one.    netchan_buffer_t **netchan_end_queue;
 and the rest? or just that line.
   int            oldServerTime;
+   qboolean         csupdated[MAX_CONFIGSTRINGS+1];    
} client_t;
The patch you showed doesn't delete anything, it simply adds some variables and a function prototype.
Title: Patches Explained.
Post by: PwNz! on October 18, 2007, 02:13:35 AM
So whats this mean? @@ -169,6 +169,7 @@
Title: Patches Explained.
Post by: Undeference on October 18, 2007, 07:14:29 AM
http://www.wikipedia.org/wiki/diff#Unified_format
Title: Patches Explained.
Post by: benmachine on October 18, 2007, 04:06:28 PM
Quote from: PwNz!So whats this mean? @@ -169,6 +169,7 @@
Where in the original file there were six lines starting at 169, there are now seven.
Title: Patches Explained.
Post by: kangounator on October 18, 2007, 09:08:57 PM
seriously you should not really mind what it exactly it means, you should focus on + and - (the @@ will just help you now where it is in the file)