[mw-devel] MW3 r878 - in branches: . portable/src

pwb at sucs.org pwb at sucs.org
Wed Apr 26 22:12:20 BST 2006


Author: pwb
Date: 2006-04-26 22:12:15 +0100 (Wed, 26 Apr 2006)
New Revision: 878

Added:
   branches/portable/
Modified:
   branches/portable/src/bb.h
   branches/portable/src/edit.c
   branches/portable/src/main.c
   branches/portable/src/mod.c
   branches/portable/src/new.c
   branches/portable/src/read.c
Log:
Using portable integer types like int32_t for binary files.


Copied: branches/portable (from rev 877, trunk)

Modified: branches/portable/src/bb.h
===================================================================
--- trunk/src/bb.h	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/bb.h	2006-04-26 21:12:15 UTC (rev 878)
@@ -5,6 +5,9 @@
 #ifndef BB_H
 #define BB_H
 
+/* portable integer types */
+#include <stdint.h>
+
 #define LOGFILE		"log.bb"
 #define LOGIN_BANNER	"login.banner"
 #define DEVEL_BANNER	"login.banner.devel"
@@ -75,27 +78,27 @@
                 
 struct NewHeader 
 {
-	int Ref;
-	long date;
+	int32_t Ref;
+	int32_t date;
 	char from[30];
 	char to[SUBJECTSIZE+1];
 	char subject[SUBJECTSIZE+1];
 	char *text;
-	int size;
+	int32_t size;
 	char status;
 	char ident[40]; 
 };
 
 struct Header
 {
-	int Ref;
-	long date;
+	int32_t Ref;
+	int32_t date;
 	char from[NAMESIZE+1],to[SUBJECTSIZE+1];
 	char subject[SUBJECTSIZE+1];
-	long datafield;
-	int size;
+	int32_t datafield;
+	int32_t size;
 	char status;
-	int replyto;
+	int32_t replyto;
 	char spare[4]; /*adjust size as necessary */
 };
 
@@ -115,24 +118,24 @@
 {
 	char name[NAMESIZE+1];
 	char passwd[PASSWDSIZE+1];
-	long lastlogout; 
-	long folders[2]; /* which folders are subscribed to */
+	int32_t lastlogout; 
+	int32_t folders[2]; /* which folders are subscribed to */
 	unsigned char status;
-	unsigned short special;
-	int  lastread[64]; /* last message read in each folder */
+	uint16_t special;
+	int32_t lastread[64]; /* last message read in each folder */
 	char realname[REALNAMESIZE+1];
 	char contact[CONTACTSIZE+1];
-	long timeused;
-	long idletime;
+	int32_t timeused;
+	int32_t idletime;
 	char groups;
 	char doing[DOINGSIZE];
-	long timeout;
+	int32_t timeout;
 
 	unsigned char spare;
 	unsigned char colour;
-	unsigned short room;
-	unsigned long chatprivs;
-	unsigned long chatmode;
+	uint16_t room;
+	uint32_t chatprivs;
+	uint32_t chatmode;
 };
 
 /* person.status
@@ -152,8 +155,8 @@
 	unsigned char status; /* status for people not in the same group */
 	char name[FOLNAMESIZE+1];
 	char topic[TOPICSIZE+1];
-	int first; /* Ref no of first message in the folder */
-	int last; /* Ref no of last message in the folder */
+	int32_t first; /* Ref no of first message in the folder */
+	int32_t last; /* Ref no of last message in the folder */
 	char g_status; /* status for people in the same group */
 	char groups; /* which groups g_status applies to */
 	char spare[10];
@@ -173,8 +176,8 @@
 
 struct who 
 {
-	int pid;
-	long posn;
+	int32_t pid;
+	int32_t posn;
 };
 
 typedef struct __dirinfo
@@ -189,21 +192,21 @@
 struct room_vis_info
 {
 	char *name;
-	int  rnum;
+	int32_t  rnum;
 };
 
 
 struct room
 {
-	int num;				/* room number */
+	int32_t num;				/* room number */
 	char *name;				/* room name */
 	char *desc;				/* description */
 	char *prompt;				/* alternate prompt */
-	int hidden;				/* cant find room using 'room' command */
-	int sproof;				/* soundproof? */
-	int locked;				/* locked even if mudmode off? */
-	int *dir;				/* room numbers can find from here */
-	int *hidedir;				/* room is hidden */
+	int32_t hidden;				/* cant find room using 'room' command */
+	int32_t sproof;				/* soundproof? */
+	int32_t locked;				/* locked even if mudmode off? */
+	int32_t *dir;				/* room numbers can find from here */
+	int32_t *hidedir;				/* room is hidden */
 	char **link;				/* link text for directions off here */
 	char **dirdef;				/* direction name redefs */
 	char **fromdef;				/* direction leave redefs */

Modified: branches/portable/src/edit.c
===================================================================
--- trunk/src/edit.c	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/edit.c	2006-04-26 21:12:15 UTC (rev 878)
@@ -337,7 +337,7 @@
 	{
 		char	tt[20];
 		int	tv;
-		printf(_("Timeout: %ld sec.\n"),usr.timeout);
+		printf(_("Timeout: %ld sec.\n"),(long)usr.timeout);
 		printf(_("New timeout value (seconds): "));
 		get_str(tt,CONTACTSIZE);
 		if (*tt)
@@ -368,7 +368,7 @@
 				usr.timeout=tv;
 				force_change(usr.name,FORCE_TIMEOUT,tt);
 				broadcast(3, "%s has just changed %s's timeout to %ld seconds.", user->name, usr.name, usr.timeout);
-				printf(_("New timeout set to %ld seconds.\n"),usr.timeout);
+				printf(_("New timeout set to %ld seconds.\n"),(long)usr.timeout);
 				mwlog("CHANGE(TIMEOUT) of %s to %ld seconds", usr.name, usr.timeout);
 			}
 		}
@@ -465,7 +465,7 @@
 	printf("email: %s\nnew email: ",usr->contact);
 	get_str(tmp,CONTACTSIZE);
 	if (strlen(tmp)!=0) strcpy(usr->contact,tmp);
-	printf("subscribed %lo %lo\nsubscibed: ",usr->folders[0],usr->folders[1]);
+	printf("subscribed %lo %lo\nsubscibed: ",(unsigned long)usr->folders[0],(unsigned long)usr->folders[1]);
 	get_str(tmp,10);
 	if (strlen(tmp)!=0) usr->folders[0]=atoi(tmp);
 	printf("last message read (folder:message) -\n");

Modified: branches/portable/src/main.c
===================================================================
--- trunk/src/main.c	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/main.c	2006-04-26 21:12:15 UTC (rev 878)
@@ -570,7 +570,7 @@
 		}	
 	}	
 			
-	if (!autochat) printf(_("\nLast logged out %s\n"),ctime(&user->lastlogout));
+	if (!autochat) printf(_("\nLast logged out %s\n"),ctime((time_t *)&user->lastlogout));
 	loggedin=time(0);
 
 	/* initialise script variables */

Modified: branches/portable/src/mod.c
===================================================================
--- trunk/src/mod.c	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/mod.c	2006-04-26 21:12:15 UTC (rev 878)
@@ -153,7 +153,7 @@
 	
 	Lock_File(afile);
 	sprintf(buff,_("\nMessage in folder %s\nFrom: %s\nTo: %s\nSubject: %s\nDate: %s"),
-	        fold->name,head->from,head->to,head->subject,ctime(&head->date));
+	        fold->name,head->from,head->to,head->subject,ctime((time_t *)&head->date));
 	write(afile,buff,strlen(buff));
 	write(afile,text,head->size+1);
 	Unlock_File(afile);

Modified: branches/portable/src/new.c
===================================================================
--- trunk/src/new.c	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/new.c	2006-04-26 21:12:15 UTC (rev 878)
@@ -238,7 +238,7 @@
 				read(ifile,&index,sizeof(index));
 
 				ttt=time(0);
-				t_then=localtime(&index.date);
+				t_then=localtime((time_t *)&index.date);
 	
 				if (ttt - index.date > 7776000)
 				strftime(datestr, 30, "%a %b %d %Y ", t_then);

Modified: branches/portable/src/read.c
===================================================================
--- trunk/src/read.c	2006-04-04 15:45:32 UTC (rev 877)
+++ branches/portable/src/read.c	2006-04-26 21:12:15 UTC (rev 878)
@@ -39,7 +39,7 @@
 	if (!remote)
 	{
 		sprintf(title,"Message %d from %s on %s",
-		       tmp->Ref,tmp->from,ctime(&tmp->date));
+		       tmp->Ref,tmp->from,ctime((time_t *)&tmp->date));
 		if ((ptr=(char *)strchr(title,'\n'))!=NULL) *ptr='.';
 		fprintf(output,"\n%s\n",title);
 		length=strlen(title);
@@ -47,7 +47,7 @@
 		fprintf(output,"\n");
 	}else
 	{
-		printf("Message: %d\nFrom: %s\nDate: %ld\n",tmp->Ref,tmp->from,tmp->date);
+		printf("Message: %d\nFrom: %s\nDate: %ld\n",tmp->Ref,tmp->from,(long)tmp->date);
 		show_mesg_stats(tmp->status,title,FALSE);
 		printf("Flags: %s\n",title);
 	}	




More information about the mw-devel mailing list