PATCH: formatting fixes in files/smb.c

Gerald Pfeifer pfeifer at dbai.tuwien.ac.at
Sun Aug 4 12:48:30 CDT 2002


I am also Cc:ing this patch to wine-devel because I think it shows that
there is an issue that deserves a bit of thought: Code formatting.

We certainly should not get anal rentative on this, but something like
  int trn = 1234,i=0;
from files/smb.c where even a single line is inconsistent really
makes me wonder.

Also I am not aware of any coding style that asks for blanks around the
assignment but does not use a blank after the comma.

The patch below fixes at least the worst problems, by consistently using
a blank after a comma in variable declarations.

Gerald

ChangeLog:
  Fix formatting of variable declarations.

Index: smb.c
===================================================================
RCS file: /home/wine/wine/files/smb.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 smb.c
--- smb.c	19 Jul 2002 03:17:19 -0000	1.8
+++ smb.c	4 Aug 2002 17:35:54 -0000
@@ -123,7 +123,7 @@ struct NB_Buffer
 static int netbios_name(const char *p, unsigned char *buffer)
 {
     char ch;
-    int i,len=0;
+    int i, len=0;

     buffer[len++]=' ';
     for(i=0; i<=MAX_HOST_NAME; i++)
@@ -146,7 +146,7 @@ static int netbios_name(const char *p, u

 static DWORD NB_NameReq(LPCSTR host, unsigned char *buffer, int len)
 {
-    int trn = 1234,i=0;
+    int trn = 1234, i=0;

     NBR_ADDWORD(&buffer[i],trn);    i+=2;
     NBR_ADDWORD(&buffer[i],0x0110); i+=2;
@@ -203,9 +203,9 @@ static BOOL UNC_SplitName(LPSTR unc, LPS

 static BOOL NB_Lookup(LPCSTR host, struct sockaddr_in *addr)
 {
-    int fd,on=1,r,len,i,fromsize;
+    int fd, on=1, r, len, i, fromsize;
     struct pollfd fds;
-    struct sockaddr_in sin,fromaddr;
+    struct sockaddr_in sin, fromaddr;
     unsigned char buffer[256];

     fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
@@ -288,7 +288,7 @@ err:
 static BOOL NB_SessionReq(int fd, char *called, char *calling)
 {
     unsigned char buffer[0x100];
-    int len = 0,r;
+    int len = 0, r;
     struct pollfd fds;

     TRACE("called %s, calling %s\n",called,calling);
@@ -571,7 +571,7 @@ static BOOL SMB_NegotiateProtocol(int fd
 static BOOL SMB_SessionSetup(int fd, USHORT *userid)
 {
     unsigned char buf[0x100];
-    int pcount,bcount;
+    int pcount, bcount;
     struct NB_Buffer rx, tx;

     memset(buf,0,sizeof buf);
@@ -667,7 +667,7 @@ static BOOL SMB_TreeConnect(int fd, USHO
 {
     unsigned char buf[0x100];
     int slen;
-    struct NB_Buffer rx,tx;
+    struct NB_Buffer rx, tx;

     TRACE("%s\n",share_name);

@@ -731,7 +731,7 @@ static BOOL SMB_NtCreateOpen(int fd, USH
                               DWORD attributes, HANDLE template, USHORT *file_id )
 {
     unsigned char buffer[0x100];
-    int len = 0,slen;
+    int len = 0, slen;

     TRACE("%s\n",filename);

@@ -886,9 +886,9 @@ static BOOL SMB_Open(int fd, USHORT tree
                               DWORD creation, DWORD attributes, USHORT *file_id )
 {
     unsigned char buf[0x100];
-    int slen,pcount,i;
+    int slen, pcount, i;
     USHORT mode = SMB_GetMode(access,sharing);
-    struct NB_Buffer rx,tx;
+    struct NB_Buffer rx, tx;

     TRACE("%s\n",filename);

@@ -944,8 +944,8 @@ static BOOL SMB_Open(int fd, USHORT tree
 static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
        USHORT file_id, DWORD offset, LPVOID out, USHORT count, LPUSHORT read)
 {
-    int buf_size,n,i;
-    struct NB_Buffer rx,tx;
+    int buf_size, n, i;
+    struct NB_Buffer rx, tx;

     TRACE("user %04x tree %04x file %04x count %04x offset %08lx\n",
         user_id, tree_id, file_id, count, offset);
@@ -1285,7 +1285,7 @@ done:

 static int SMB_GetSocket(LPCSTR host)
 {
-    int fd=-1,r;
+    int fd=-1, r;
     struct sockaddr_in sin;
     struct hostent *he;

@@ -1390,7 +1390,7 @@ HANDLE WINAPI SMB_CreateFileA( LPCSTR un
 {
     int fd;
     USHORT tree_id=0, user_id=0, dialect=0, file_id=0;
-    LPSTR name,host,share,file;
+    LPSTR name, host, share, file;
     HANDLE handle = INVALID_HANDLE_VALUE;

     name = HeapAlloc(GetProcessHeap(),0,lstrlenA(uncname));
@@ -1540,7 +1540,7 @@ BOOL WINAPI SMB_ReadFile(HANDLE hFile, L
 SMB_DIR* WINAPI SMB_FindFirst(LPCSTR name)
 {
     int fd = -1;
-    LPSTR host,share,file;
+    LPSTR host, share, file;
     USHORT tree_id=0, user_id=0, dialect=0;
     SMB_DIR *ret = NULL;
     LPSTR filename;




More information about the wine-patches mailing list