02-pointer.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. diff -up afpfs-ng-0.8.1/cmdline/getstatus.c.pointer afpfs-ng-0.8.1/cmdline/getstatus.c
  2. --- afpfs-ng-0.8.1/cmdline/getstatus.c.pointer 2011-06-14 17:06:35.000000000 +0200
  3. +++ afpfs-ng-0.8.1/cmdline/getstatus.c 2011-06-14 17:07:25.000000000 +0200
  4. @@ -1,4 +1,5 @@
  5. #include <stdio.h>
  6. +#include <stdlib.h>
  7. #include <string.h>
  8. #include <pthread.h>
  9. diff -up afpfs-ng-0.8.1/fuse/client.c.pointer afpfs-ng-0.8.1/fuse/client.c
  10. --- afpfs-ng-0.8.1/fuse/client.c.pointer 2008-03-08 03:44:16.000000000 +0100
  11. +++ afpfs-ng-0.8.1/fuse/client.c 2011-06-14 17:02:15.000000000 +0200
  12. @@ -61,8 +61,9 @@ static int start_afpfsd(void)
  13. snprintf(filename, PATH_MAX,
  14. "/usr/local/bin/%s",AFPFSD_FILENAME);
  15. if (access(filename,X_OK)) {
  16. - snprintf(filename, "/usr/bin/%s",
  17. + snprintf(filename, sizeof(filename), "/usr/bin/%s",
  18. AFPFSD_FILENAME);
  19. + filename[sizeof(filename) - 1] = 0;
  20. if (access(filename,X_OK)) {
  21. printf("Could not find server (%s)\n",
  22. filename);
  23. diff -up afpfs-ng-0.8.1/fuse/fuse_int.c.pointer afpfs-ng-0.8.1/fuse/fuse_int.c
  24. --- afpfs-ng-0.8.1/fuse/fuse_int.c.pointer 2008-03-02 06:06:24.000000000 +0100
  25. +++ afpfs-ng-0.8.1/fuse/fuse_int.c 2011-06-14 17:02:15.000000000 +0200
  26. @@ -197,7 +197,7 @@ static int fuse_open(const char *path, s
  27. ret = ml_open(volume,path,flags,&fp);
  28. if (ret==0)
  29. - fi->fh=(void *) fp;
  30. + fi->fh=(unsigned long) fp;
  31. return ret;
  32. }
  33. diff -up afpfs-ng-0.8.1/include/afpfs-ng/afp.h.pointer afpfs-ng-0.8.1/include/afp.h
  34. --- afpfs-ng-0.8.1/include/afpfs-ng/afp.h.pointer 2008-03-08 17:08:18.000000000 +0100
  35. +++ afpfs-ng-0.8.1/include/afpfs-ng/afp.h 2011-06-14 17:02:15.000000000 +0200
  36. @@ -370,7 +370,7 @@ int afp_unmount_all_volumes(struct afp_s
  37. int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
  38. -int afp_closedt(struct afp_server * server, unsigned short * refnum);
  39. +int afp_closedt(struct afp_server * server, unsigned short refnum);
  40. int afp_getcomment(struct afp_volume *volume, unsigned int did,
  41. const char * pathname, struct afp_comment * comment);
  42. diff -up afpfs-ng-0.8.1/include/afpfs-gn/utils.h.pointer afpfs-ng-0.8.1/include/utils.h
  43. --- afpfs-ng-0.8.1/include/afpfs-ng/utils.h.pointer 2008-02-18 04:33:58.000000000 +0100
  44. +++ afpfs-ng-0.8.1/include/afpfs-ng/utils.h 2011-06-14 17:02:15.000000000 +0200
  45. @@ -8,8 +8,8 @@
  46. #define hton64(x) (x)
  47. #define ntoh64(x) (x)
  48. #else /* BYTE_ORDER == BIG_ENDIAN */
  49. -#define hton64(x) ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
  50. - (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
  51. +#define hton64(x) ((u_int64_t) (htonl((((unsigned long long)(x)) >> 32) & 0xffffffffLL)) | \
  52. + (u_int64_t) ((htonl((unsigned long long)(x)) & 0xffffffffLL) << 32))
  53. #define ntoh64(x) (hton64(x))
  54. #endif /* BYTE_ORDER == BIG_ENDIAN */
  55. diff -up afpfs-ng-0.8.1/lib/afp_url.c.pointer afpfs-ng-0.8.1/lib/afp_url.c
  56. --- afpfs-ng-0.8.1/lib/afp_url.c.pointer 2008-03-04 21:16:49.000000000 +0100
  57. +++ afpfs-ng-0.8.1/lib/afp_url.c 2011-06-14 17:02:15.000000000 +0200
  58. @@ -33,7 +33,7 @@ static int check_port(char * port)
  59. static int check_uamname(const char * uam)
  60. {
  61. char * p;
  62. - for (p=uam;*p;p++) {
  63. + for (p=(char *)uam;*p;p++) {
  64. if (*p==' ') continue;
  65. if ((*p<'A') || (*p>'z')) return -1;
  66. }
  67. @@ -188,7 +188,7 @@ int afp_parse_url(struct afp_url * url,
  68. return -1;
  69. }
  70. - if (p==NULL) p=toparse;
  71. + if (p==NULL) p=(char *)toparse;
  72. /* Now split on the first / */
  73. if (sscanf(p,"%[^/]/%[^$]",
  74. diff -up afpfs-ng-0.8.1/lib/did.c.pointer afpfs-ng-0.8.1/lib/did.c
  75. --- afpfs-ng-0.8.1/lib/did.c.pointer 2008-02-18 04:39:17.000000000 +0100
  76. +++ afpfs-ng-0.8.1/lib/did.c 2011-06-14 17:02:15.000000000 +0200
  77. @@ -226,7 +226,7 @@ int get_dirid(struct afp_volume * volume
  78. /* Go to the end of last known entry */
  79. - p=path+(p-copy);
  80. + p=(char *)path+(p-copy);
  81. p2=p;
  82. while ((p=strchr(p+1,'/'))) {
  83. diff -up afpfs-ng-0.8.1/lib/dsi.c.pointer afpfs-ng-0.8.1/lib/dsi.c
  84. --- afpfs-ng-0.8.1/lib/dsi.c.pointer 2008-02-18 04:53:03.000000000 +0100
  85. +++ afpfs-ng-0.8.1/lib/dsi.c 2011-06-14 17:02:15.000000000 +0200
  86. @@ -474,7 +474,7 @@ void dsi_getstatus_reply(struct afp_serv
  87. }
  88. server->flags=ntohs(reply1->flags);
  89. - p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1));
  90. + p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1));
  91. p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1;
  92. /* Now work our way through the variable bits */
  93. @@ -757,7 +757,7 @@ gotenough:
  94. printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read);
  95. #endif
  96. ret = read(server->fd, (void *)
  97. - (((unsigned int) server->incoming_buffer)+server->data_read),
  98. + (((unsigned long) server->incoming_buffer)+server->data_read),
  99. amount_to_read);
  100. if (ret<0) return -1;
  101. if (ret==0) {
  102. diff -up afpfs-ng-0.8.1/lib/loop.c.pointer afpfs-ng-0.8.1/lib/loop.c
  103. --- afpfs-ng-0.8.1/lib/loop.c.pointer 2008-02-18 04:40:11.000000000 +0100
  104. +++ afpfs-ng-0.8.1/lib/loop.c 2011-06-14 17:02:15.000000000 +0200
  105. @@ -25,7 +25,7 @@
  106. static unsigned char exit_program=0;
  107. static pthread_t ending_thread;
  108. -static pthread_t main_thread = NULL;
  109. +static pthread_t main_thread = (pthread_t)NULL;
  110. static int loop_started=0;
  111. static pthread_cond_t loop_started_condition;
  112. diff -up afpfs-ng-0.8.1/lib/lowlevel.c.pointer afpfs-ng-0.8.1/lib/lowlevel.c
  113. --- afpfs-ng-0.8.1/lib/lowlevel.c.pointer 2008-02-20 02:33:17.000000000 +0100
  114. +++ afpfs-ng-0.8.1/lib/lowlevel.c 2011-06-14 17:02:15.000000000 +0200
  115. @@ -582,7 +582,7 @@ int ll_getattr(struct afp_volume * volum
  116. if (volume->server->using_version->av_number>=30)
  117. stbuf->st_mode |= fp.unixprivs.permissions;
  118. else
  119. - set_nonunix_perms(stbuf,&fp);
  120. + set_nonunix_perms(&stbuf->st_mode,&fp);
  121. stbuf->st_uid=fp.unixprivs.uid;
  122. stbuf->st_gid=fp.unixprivs.gid;
  123. diff -up afpfs-ng-0.8.1/lib/midlevel.c.pointer afpfs-ng-0.8.1/lib/midlevel.c
  124. --- afpfs-ng-0.8.1/lib/midlevel.c.pointer 2008-03-08 17:08:18.000000000 +0100
  125. +++ afpfs-ng-0.8.1/lib/midlevel.c 2011-06-14 17:02:15.000000000 +0200
  126. @@ -713,7 +713,7 @@ int ml_write(struct afp_volume * volume,
  127. {
  128. int ret,err=0;
  129. - int totalwritten = 0;
  130. + size_t totalwritten = 0;
  131. uint64_t sizetowrite, ignored;
  132. unsigned char flags = 0;
  133. unsigned int max_packet_size=volume->server->tx_quantum;
  134. diff -up afpfs-ng-0.8.1/lib/proto_attr.c.pointer afpfs-ng-0.8.1/lib/proto_attr.c
  135. --- afpfs-ng-0.8.1/lib/proto_attr.c.pointer 2008-01-30 05:37:58.000000000 +0100
  136. +++ afpfs-ng-0.8.1/lib/proto_attr.c 2011-06-14 17:02:15.000000000 +0200
  137. @@ -166,7 +166,7 @@ int afp_getextattr(struct afp_volume * v
  138. copy_path(server,p,pathname,strlen(pathname));
  139. unixpath_to_afppath(server,p);
  140. p2=p+sizeof_path_header(server)+strlen(pathname);
  141. - if (((unsigned int ) p2) & 0x1) p2++;
  142. + if (((unsigned long) p2) & 0x1) p2++;
  143. req2=(void *) p2;
  144. req2->len=htons(namelen);
  145. diff -up afpfs-ng-0.8.1/lib/proto_desktop.c.pointer afpfs-ng-0.8.1/lib/proto_desktop.c
  146. --- afpfs-ng-0.8.1/lib/proto_desktop.c.pointer 2008-02-18 04:44:11.000000000 +0100
  147. +++ afpfs-ng-0.8.1/lib/proto_desktop.c 2011-06-14 17:02:15.000000000 +0200
  148. @@ -168,7 +168,7 @@ int afp_getcomment_reply(struct afp_serv
  149. return 0;
  150. }
  151. -int afp_closedt(struct afp_server * server, unsigned short * refnum)
  152. +int afp_closedt(struct afp_server * server, unsigned short refnum)
  153. {
  154. struct {
  155. struct dsi_header dsi_header __attribute__((__packed__));
  156. diff -up afpfs-ng-0.8.1/lib/proto_directory.c.pointer afpfs-ng-0.8.1/lib/proto_directory.c
  157. --- afpfs-ng-0.8.1/lib/proto_directory.c.pointer 2008-02-19 03:39:29.000000000 +0100
  158. +++ afpfs-ng-0.8.1/lib/proto_directory.c 2011-06-14 17:02:15.000000000 +0200
  159. @@ -248,6 +248,7 @@ int afp_enumerate_reply(struct afp_serve
  160. return 0;
  161. }
  162. +
  163. int afp_enumerateext2_reply(struct afp_server *server, char * buf, unsigned int size, void * other)
  164. {
  165. @@ -266,8 +267,7 @@ int afp_enumerateext2_reply(struct afp_s
  166. char * p = buf + sizeof(*reply);
  167. int i;
  168. char *max=buf+size;
  169. - struct afp_file_info * filebase = NULL, *filecur=NULL, *new_file=NULL;
  170. - void ** x = other;
  171. + struct afp_file_info * filebase = NULL, *filecur = NULL, *new_file = NULL, **x = (struct afp_file_info **) other;
  172. if (reply->dsi_header.return_code.error_code) {
  173. return reply->dsi_header.return_code.error_code;
  174. diff -up afpfs-ng-0.8.1/lib/proto_map.c.pointer afpfs-ng-0.8.1/lib/proto_map.c
  175. --- afpfs-ng-0.8.1/lib/proto_map.c.pointer 2008-01-30 05:37:59.000000000 +0100
  176. +++ afpfs-ng-0.8.1/lib/proto_map.c 2011-06-14 17:02:15.000000000 +0200
  177. @@ -122,7 +122,7 @@ int afp_mapid_reply(struct afp_server *s
  178. if (reply->header.return_code.error_code!=kFPNoErr) return -1;
  179. - copy_from_pascal_two(name,&reply->name,255);
  180. + copy_from_pascal_two(name,reply->name,255);
  181. return 0;
  182. }
  183. diff -up afpfs-ng-0.8.1/lib/proto_session.c.pointer afpfs-ng-0.8.1/lib/proto_session.c
  184. --- afpfs-ng-0.8.1/lib/proto_session.c.pointer 2008-02-18 04:46:19.000000000 +0100
  185. +++ afpfs-ng-0.8.1/lib/proto_session.c 2011-06-14 17:02:15.000000000 +0200
  186. @@ -39,7 +39,7 @@ int afp_getsessiontoken(struct afp_serve
  187. switch (type) {
  188. case kLoginWithTimeAndID:
  189. case kReconnWithTimeAndID: {
  190. - uint32_t *p = (void *) (((unsigned int) request)+
  191. + uint32_t *p = (void *) (((unsigned long) request)+
  192. sizeof(*request));
  193. offset=sizeof(timestamp);
  194. @@ -63,7 +63,7 @@ int afp_getsessiontoken(struct afp_serve
  195. goto error;
  196. }
  197. - data=(void *) (((unsigned int) request)+sizeof(*request)+offset);
  198. + data=(void *) (((unsigned long) request)+sizeof(*request)+offset);
  199. request->idlength=htonl(datalen);
  200. request->pad=0;
  201. request->type=htons(type);
  202. @@ -127,7 +127,7 @@ int afp_disconnectoldsession(struct afp_
  203. if ((request=malloc(sizeof(*request) + AFP_TOKEN_MAX_LEN))==NULL)
  204. return -1;
  205. - token_data = request + sizeof(*request);
  206. + token_data = (char *)request + sizeof(*request);
  207. request->type=htons(type);
  208. diff -up afpfs-ng-0.8.1/lib/uams.c.pointer afpfs-ng-0.8.1/lib/uams.c
  209. --- afpfs-ng-0.8.1/lib/uams.c.pointer 2008-01-04 04:52:44.000000000 +0100
  210. +++ afpfs-ng-0.8.1/lib/uams.c 2011-06-14 17:02:15.000000000 +0200
  211. @@ -180,7 +180,7 @@ static int cleartxt_login(struct afp_ser
  212. goto cleartxt_fail;
  213. p += copy_to_pascal(p, username) + 1;
  214. - if ((int)p & 0x1)
  215. + if ((long)p & 0x1)
  216. len--;
  217. else
  218. p++;
  219. @@ -230,7 +230,7 @@ static int cleartxt_passwd(struct afp_se
  220. goto cleartxt_fail;
  221. p += copy_to_pascal(p, username) + 1;
  222. - if ((int)p & 0x1)
  223. + if ((long)p & 0x1)
  224. len--;
  225. else
  226. p++;
  227. @@ -580,7 +580,7 @@ static int dhx_login(struct afp_server *
  228. if (ai == NULL)
  229. goto dhx_noctx_fail;
  230. d += copy_to_pascal(ai, username) + 1;
  231. - if (((int)d) % 2)
  232. + if (((long)d) % 2)
  233. d++;
  234. else
  235. ai_len--;
  236. diff -up afpfs-ng-0.8.1/lib/utils.c.pointer afpfs-ng-0.8.1/lib/utils.c
  237. --- afpfs-ng-0.8.1/lib/utils.c.pointer 2008-02-18 04:53:37.000000000 +0100
  238. +++ afpfs-ng-0.8.1/lib/utils.c 2011-06-14 17:02:15.000000000 +0200
  239. @@ -196,7 +196,7 @@ int invalid_filename(struct afp_server *
  240. maxlen=255;
  241. - p=filename+1;
  242. + p=(char *)filename+1;
  243. while ((q=strchr(p,'/'))) {
  244. if (q>p+maxlen)
  245. return 1;