1 | diff --git a/edit/editcmd.c b/edit/editcmd.c |
---|
2 | index 3d60d90..88c81f7 100644 |
---|
3 | --- a/edit/editcmd.c |
---|
4 | +++ b/edit/editcmd.c |
---|
5 | @@ -1458,7 +1458,7 @@ editcmd_find (WEdit *edit, gsize *len) |
---|
6 | if (edit->replace_backwards) { |
---|
7 | search_end = end_mark; |
---|
8 | while ((int) search_start >= start_mark) { |
---|
9 | - if (search_end > search_start + edit->search->original_len |
---|
10 | + if (search_end > search_start + (off_t)(edit->search->original_len) |
---|
11 | && mc_search_is_fixed_search_str(edit->search)) { |
---|
12 | search_end = search_start + edit->search->original_len; |
---|
13 | } |
---|
14 | @@ -2397,7 +2397,7 @@ static gboolean is_break_char(char c) |
---|
15 | static int edit_find_word_start (WEdit *edit, long *word_start, gsize *word_len) |
---|
16 | { |
---|
17 | int c, last; |
---|
18 | - gsize i; |
---|
19 | + gssize i; |
---|
20 | |
---|
21 | /* return if at begin of file */ |
---|
22 | if (edit->curs1 <= 0) |
---|
23 | diff --git a/edit/editdraw.c b/edit/editdraw.c |
---|
24 | index 15fb0c8..e649a07 100644 |
---|
25 | --- a/edit/editdraw.c |
---|
26 | +++ b/edit/editdraw.c |
---|
27 | @@ -281,6 +281,7 @@ static inline void |
---|
28 | print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
---|
29 | long end_col, struct line_s line[], char *status) |
---|
30 | { |
---|
31 | + int i = -1; |
---|
32 | struct line_s *p; |
---|
33 | |
---|
34 | int x = start_col_real; |
---|
35 | @@ -306,8 +307,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
---|
36 | end_col + 1 - start_col); |
---|
37 | } |
---|
38 | |
---|
39 | - if (option_line_state) { |
---|
40 | - int i; |
---|
41 | + if (option_line_state) { |
---|
42 | for (i = 0; i < LINE_STATE_WIDTH; i++) |
---|
43 | if (status[i] == '\0') |
---|
44 | status[i] = ' '; |
---|
45 | @@ -319,7 +319,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
---|
46 | |
---|
47 | edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y); |
---|
48 | p = line; |
---|
49 | - int i = 1; |
---|
50 | + i = 1; |
---|
51 | while (p->ch) { |
---|
52 | int style; |
---|
53 | unsigned int textchar; |
---|
54 | diff --git a/src/layout.c b/src/layout.c |
---|
55 | index 5ee9fe3..e3a0cba 100644 |
---|
56 | --- a/src/layout.c |
---|
57 | +++ b/src/layout.c |
---|
58 | @@ -824,7 +824,7 @@ void print_vfs_message (const char *msg, ...) |
---|
59 | void rotate_dash (void) |
---|
60 | { |
---|
61 | static const char rotating_dash [] = "|/-\\"; |
---|
62 | - static size_t pos = 0; |
---|
63 | + static unsigned short pos = 0; |
---|
64 | |
---|
65 | if (!nice_rotating_dash || (ok_to_refresh <= 0)) |
---|
66 | return; |
---|
67 | diff --git a/src/main.c b/src/main.c |
---|
68 | index a12fb12..13a84dc 100644 |
---|
69 | --- a/src/main.c |
---|
70 | +++ b/src/main.c |
---|
71 | @@ -2093,10 +2093,12 @@ mc_main__setup_by_args (int argc, char *argv[]) |
---|
72 | int |
---|
73 | main (int argc, char *argv[]) |
---|
74 | { |
---|
75 | + setbuf(stdout, (char *)0); /* Flushing Output Old Buffer */ |
---|
76 | + |
---|
77 | struct stat s; |
---|
78 | char *mc_dir; |
---|
79 | GError *error = NULL; |
---|
80 | diff --git a/src/search/glob.c b/src/search/glob.c |
---|
81 | index 18ed322..46fa654 100644 |
---|
82 | --- a/src/search/glob.c |
---|
83 | +++ b/src/search/glob.c |
---|
84 | @@ -124,7 +124,7 @@ mc_search__translate_replace_glob_to_regex (gchar *str) |
---|
85 | case '*': |
---|
86 | case '?': |
---|
87 | g_string_append_c (buff, '\\'); |
---|
88 | - c = ++cnt; |
---|
89 | + c = (char)(++cnt); |
---|
90 | break; |
---|
91 | /* breaks copying: mc uses "\0" internally, it must not be changed */ |
---|
92 | /*case '\\':*/ |
---|
93 | diff --git a/src/setup.c b/src/setup.c |
---|
94 | index 122b9b7..7757bb0 100644 |
---|
95 | --- a/src/setup.c |
---|
96 | +++ b/src/setup.c |
---|
97 | @@ -266,7 +266,7 @@ panel_save_setup (struct WPanel *panel, const char *section) |
---|
98 | mc_config_set_string(mc_panels_config, section, "user_format", panel->user_format); |
---|
99 | |
---|
100 | for (i = 0; i < LIST_TYPES; i++){ |
---|
101 | - buffer = g_strdup_printf("user_status%d", i); |
---|
102 | + buffer = g_strdup_printf("user_status%zu", i); /* %zu - size_t, %zd - ssize_t */ |
---|
103 | mc_config_set_string(mc_panels_config, section, buffer, panel->user_status_format [i]); |
---|
104 | g_free(buffer); |
---|
105 | } |
---|
106 | @@ -435,7 +435,7 @@ panel_load_setup (WPanel *panel, const char *section) |
---|
107 | |
---|
108 | for (i = 0; i < LIST_TYPES; i++){ |
---|
109 | g_free (panel->user_status_format [i]); |
---|
110 | - buffer = g_strdup_printf("user_status%d",i); |
---|
111 | + buffer = g_strdup_printf("user_status%zu",i); |
---|
112 | panel->user_status_format [i] = |
---|
113 | mc_config_get_string(mc_panels_config, section, buffer, DEFAULT_USER_FORMAT); |
---|
114 | g_free(buffer); |
---|
115 | diff --git a/src/strutil.h b/src/strutil.h |
---|
116 | index e379b55..6a6e2cf 100644 |
---|
117 | --- a/src/strutil.h |
---|
118 | +++ b/src/strutil.h |
---|
119 | @@ -131,7 +131,7 @@ struct str_class { |
---|
120 | char *(*create_key_for_filename) (const char *text, int case_sen); /*I*/ |
---|
121 | int (*key_collate) (const char *t1, const char *t2, int case_sen); /*I*/ |
---|
122 | void (*release_key) (char *key, int case_sen); /*I*/ |
---|
123 | -}; |
---|
124 | +} __attribute__((packed, aligned(sizeof(void)))); /* FIXME: Need more testing or not need */ |
---|
125 | |
---|
126 | struct str_class str_utf8_init (void); |
---|
127 | struct str_class str_8bit_init (void); |
---|
128 | diff --git a/src/strutilutf8.c b/src/strutilutf8.c |
---|
129 | index 90bd542..2e82a92 100644 |
---|
130 | --- a/src/strutilutf8.c |
---|
131 | +++ b/src/strutilutf8.c |
---|
132 | @@ -37,13 +37,19 @@ |
---|
133 | |
---|
134 | static const char replch[] = "\xEF\xBF\xBD"; |
---|
135 | |
---|
136 | -static int |
---|
137 | -str_unichar_iscombiningmark (gunichar uni) |
---|
138 | +static inline int __attribute__((always_inline)) |
---|
139 | +str_unichar_iscombiningmark(gunichar uni) |
---|
140 | { |
---|
141 | - int type = g_unichar_type (uni); |
---|
142 | - return (type == G_UNICODE_COMBINING_MARK) |
---|
143 | - || (type == G_UNICODE_ENCLOSING_MARK) |
---|
144 | - || (type == G_UNICODE_NON_SPACING_MARK); |
---|
145 | + GUnicodeType type = g_unichar_type(uni); |
---|
146 | + |
---|
147 | + switch (type) { |
---|
148 | + case G_UNICODE_COMBINING_MARK: break; |
---|
149 | + case G_UNICODE_ENCLOSING_MARK: break; |
---|
150 | + case G_UNICODE_NON_SPACING_MARK: break; |
---|
151 | + default: |
---|
152 | + type = G_UNICODE_CONTROL; break; |
---|
153 | + } |
---|
154 | + return ((int)type); |
---|
155 | } |
---|
156 | |
---|
157 | static void |
---|
158 | diff --git a/src/tty/color.c b/src/tty/color.c |
---|
159 | index e9ccf1c..26b5319 100644 |
---|
160 | --- a/src/tty/color.c |
---|
161 | +++ b/src/tty/color.c |
---|
162 | @@ -85,7 +85,7 @@ tty_color_free_condition_cb (gpointer key, gpointer value, gpointer user_data) |
---|
163 | tty_color_pair_t *mc_color_pair; |
---|
164 | (void) key; |
---|
165 | |
---|
166 | - is_temp_color = (gboolean) user_data; |
---|
167 | + is_temp_color = (gssize) user_data; |
---|
168 | mc_color_pair = (tty_color_pair_t *) value; |
---|
169 | return (mc_color_pair->is_temp == is_temp_color); |
---|
170 | } |
---|
171 | @@ -93,7 +93,7 @@ tty_color_free_condition_cb (gpointer key, gpointer value, gpointer user_data) |
---|
172 | /* --------------------------------------------------------------------------------------------- */ |
---|
173 | |
---|
174 | static void |
---|
175 | -tty_color_free_all (gboolean is_temp_color) |
---|
176 | +tty_color_free_all (gssize is_temp_color) |
---|
177 | { |
---|
178 | g_hash_table_foreach_remove (mc_tty_color__hashtable, tty_color_free_condition_cb, |
---|
179 | (gpointer) is_temp_color); |
---|
180 | @@ -104,11 +104,11 @@ tty_color_free_all (gboolean is_temp_color) |
---|
181 | static gboolean |
---|
182 | tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data) |
---|
183 | { |
---|
184 | - int cp; |
---|
185 | + ssize_t cp; |
---|
186 | tty_color_pair_t *mc_color_pair; |
---|
187 | (void) key; |
---|
188 | |
---|
189 | - cp = (int) user_data; |
---|
190 | + cp = (ssize_t) user_data; |
---|
191 | mc_color_pair = (tty_color_pair_t *) value; |
---|
192 | |
---|
193 | if (cp == mc_color_pair->pair_index) |
---|
194 | @@ -119,11 +119,11 @@ tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data) |
---|
195 | |
---|
196 | /* --------------------------------------------------------------------------------------------- */ |
---|
197 | |
---|
198 | -static int |
---|
199 | +static gssize |
---|
200 | tty_color_get_next__color_pair_number () |
---|
201 | { |
---|
202 | int cp_count = g_hash_table_size (mc_tty_color__hashtable); |
---|
203 | - int cp = 0; |
---|
204 | + gssize cp = 0; |
---|
205 | |
---|
206 | for (cp = 0; cp < cp_count; cp++) { |
---|
207 | if (g_hash_table_find (mc_tty_color__hashtable, tty_color_get_next_cpn_cb, (gpointer) cp) == |
---|
208 | diff --git a/src/tty/mouse.c b/src/tty/mouse.c |
---|
209 | index a811c05..65b514f 100644 |
---|
210 | --- a/src/tty/mouse.c |
---|
211 | +++ b/src/tty/mouse.c |
---|
212 | @@ -41,12 +41,15 @@ |
---|
213 | gboolean mouse_enabled = FALSE; |
---|
214 | const char *xmouse_seq; |
---|
215 | |
---|
216 | -void |
---|
217 | -show_mouse_pointer (int x, int y) |
---|
218 | -{ |
---|
219 | #ifdef HAVE_LIBGPM |
---|
220 | +void show_mouse_pointer (int x, int y) |
---|
221 | +{ |
---|
222 | if (use_mouse_p == MOUSE_GPM) |
---|
223 | Gpm_DrawPointer (x, y, gpm_consolefd); |
---|
224 | +#else |
---|
225 | +void show_mouse_pointer (int x __attribute__((unused)), /* unused variables without LIBGPM */ |
---|
226 | + int y __attribute__((unused))) |
---|
227 | +{ |
---|
228 | #endif /* HAVE_LIBGPM */ |
---|
229 | } |
---|
230 | |
---|
231 | diff --git a/src/util.c b/src/util.c |
---|
232 | index 37f3e8e..63c8ee9 100644 |
---|
233 | --- a/src/util.c |
---|
234 | +++ b/src/util.c |
---|
235 | @@ -1029,15 +1029,15 @@ void |
---|
236 | for (;*p ; p++) |
---|
237 | *p = 0; |
---|
238 | g_free (passwd); |
---|
239 | + passwd = NULL; p = NULL; /* adanced security :) */ |
---|
240 | } |
---|
241 | |
---|
242 | /* Convert "\E" -> esc character and ^x to control-x key and ^^ to ^ key */ |
---|
243 | diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c |
---|
244 | index d2d689a..b65e7a4 100644 |
---|
245 | --- a/src/viewer/datasource.c |
---|
246 | +++ b/src/viewer/datasource.c |
---|
247 | @@ -134,7 +134,7 @@ char * |
---|
248 | mcview_get_ptr_string (mcview_t * view, off_t byte_index) |
---|
249 | { |
---|
250 | assert (view->datasource == DS_STRING); |
---|
251 | - if (byte_index < view->ds_string_len) |
---|
252 | + if (byte_index < (off_t )view->ds_string_len) |
---|
253 | return (char *) (view->ds_string_data + byte_index); |
---|
254 | return NULL; |
---|
255 | } |
---|
256 | @@ -199,7 +199,7 @@ gboolean |
---|
257 | mcview_get_byte_string (mcview_t * view, off_t byte_index, int *retval) |
---|
258 | { |
---|
259 | assert (view->datasource == DS_STRING); |
---|
260 | - if (byte_index < view->ds_string_len) { |
---|
261 | + if (byte_index < (off_t )view->ds_string_len) { |
---|
262 | if (retval) |
---|
263 | *retval = view->ds_string_data[byte_index]; |
---|
264 | return TRUE; |
---|
265 | @@ -267,7 +267,7 @@ mcview_file_load_data (mcview_t * view, off_t byte_index) |
---|
266 | bytes_read += (size_t) res; |
---|
267 | } |
---|
268 | view->ds_file_offset = blockoffset; |
---|
269 | - if (bytes_read > view->ds_file_filesize - view->ds_file_offset) { |
---|
270 | + if ((off_t )bytes_read > view->ds_file_filesize - view->ds_file_offset) { |
---|
271 | /* the file has grown in the meantime -- stick to the old size */ |
---|
272 | view->ds_file_datalen = view->ds_file_filesize - view->ds_file_offset; |
---|
273 | } else { |
---|
274 | diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c |
---|
275 | index 3923fa5..4c64922 100644 |
---|
276 | --- a/src/viewer/growbuf.c |
---|
277 | +++ b/src/viewer/growbuf.c |
---|
278 | @@ -178,7 +178,7 @@ mcview_get_byte_growing_buffer (mcview_t * view, off_t byte_index, int *retval) |
---|
279 | |
---|
280 | assert (view->growbuf_in_use); |
---|
281 | |
---|
282 | - if ((size_t) pageno != pageno) |
---|
283 | + if ( ((size_t) pageno - pageno) != 0 ) /* To not compare sing. and unsing. vars */ |
---|
284 | return FALSE; |
---|
285 | |
---|
286 | mcview_growbuf_read_until (view, byte_index + 1); |
---|
287 | @@ -189,7 +189,7 @@ mcview_get_byte_growing_buffer (mcview_t * view, off_t byte_index, int *retval) |
---|
288 | *retval = *((byte *) (g_ptr_array_index(view->growbuf_blockptr, pageno) + pageindex)); |
---|
289 | return TRUE; |
---|
290 | } |
---|
291 | - if (pageno == view->growbuf_blockptr->len - 1 && pageindex < view->growbuf_lastindex) { |
---|
292 | + if (pageno == (view->growbuf_blockptr->len - 1) && pageindex < view->growbuf_lastindex) { |
---|
293 | if (retval) |
---|
294 | *retval = *((byte *) (g_ptr_array_index(view->growbuf_blockptr, pageno) + pageindex)); |
---|
295 | return TRUE; |
---|
296 | @@ -207,7 +207,7 @@ mcview_get_ptr_growing_buffer (mcview_t * view, off_t byte_index) |
---|
297 | |
---|
298 | assert (view->growbuf_in_use); |
---|
299 | |
---|
300 | - if ((size_t) pageno != pageno) |
---|
301 | + if (((size_t) pageno - pageno) != 0) /* To not compare sing. and unsing. vars */ |
---|
302 | return NULL; |
---|
303 | |
---|
304 | mcview_growbuf_read_until (view, byte_index + 1); |
---|
305 | @@ -215,7 +215,7 @@ mcview_get_ptr_growing_buffer (mcview_t * view, off_t byte_index) |
---|
306 | return NULL; |
---|
307 | if (pageno < view->growbuf_blockptr->len - 1) |
---|
308 | return (char *) (g_ptr_array_index(view->growbuf_blockptr, pageno) + pageindex); |
---|
309 | - if (pageno == view->growbuf_blockptr->len - 1 && pageindex < view->growbuf_lastindex) |
---|
310 | + if (pageno == (view->growbuf_blockptr->len - 1) && pageindex < view->growbuf_lastindex) |
---|
311 | return (char *) (g_ptr_array_index(view->growbuf_blockptr, pageno) + pageindex); |
---|
312 | return NULL; |
---|
313 | } |
---|
314 | diff --git a/src/viewer/inlines.h b/src/viewer/inlines.h |
---|
315 | index 224f8e6..fc80e78 100644 |
---|
316 | --- a/src/viewer/inlines.h |
---|
317 | +++ b/src/viewer/inlines.h |
---|
318 | @@ -70,7 +70,7 @@ mcview_may_still_grow (mcview_t * view) |
---|
319 | static inline gboolean |
---|
320 | mcview_already_loaded (off_t offset, off_t idx, size_t size) |
---|
321 | { |
---|
322 | - return (offset <= idx && idx - offset < size); |
---|
323 | + return (offset <= idx && idx - offset < (off_t)size); |
---|
324 | } |
---|
325 | |
---|
326 | /* --------------------------------------------------------------------------------------------- */ |
---|
327 | diff --git a/src/viewer/search.c b/src/viewer/search.c |
---|
328 | index 63d639e..67e31a0 100644 |
---|
329 | --- a/src/viewer/search.c |
---|
330 | +++ b/src/viewer/search.c |
---|
331 | @@ -89,7 +89,7 @@ mcview_find (mcview_t * view, gsize search_start, gsize * len) |
---|
332 | search_end = search_start + view->search->original_len; |
---|
333 | |
---|
334 | if (mc_search_run (view->search, (void *) view, search_start, search_end, len) |
---|
335 | - && view->search->normal_offset == search_start) |
---|
336 | + && view->search->normal_offset == (off_t)search_start) |
---|
337 | return TRUE; |
---|
338 | |
---|
339 | search_start--; |
---|
340 | @@ -184,7 +184,7 @@ mcview_search_update_cmd_callback (const void *user_data, gsize char_offset) |
---|
341 | { |
---|
342 | mcview_t *view = (mcview_t *) user_data; |
---|
343 | |
---|
344 | - if (char_offset >= view->update_activate) { |
---|
345 | + if ((off_t)char_offset >= view->update_activate) { |
---|
346 | view->update_activate += view->update_steps; |
---|
347 | if (verbose) { |
---|
348 | mcview_percent (view, char_offset); |
---|
349 | diff --git a/src/wtools.c b/src/wtools.c |
---|
350 | index b267c87..0ebef63 100644 |
---|
351 | --- a/src/wtools.c |
---|
352 | +++ b/src/wtools.c |
---|
353 | @@ -327,11 +327,6 @@ message (int flags, const char *title, const char *text, ...) |
---|
354 | { |
---|
355 | char *p; |
---|
356 | va_list ap; |
---|
357 | - union { |
---|
358 | - void *p; |
---|
359 | - void (*f) (int, int *, char *, const char *); |
---|
360 | - } func; |
---|
361 | - |
---|
362 | va_start (ap, text); |
---|
363 | p = g_strdup_vprintf (text, ap); |
---|
364 | va_end (ap); |
---|
365 | @@ -340,6 +335,11 @@ message (int flags, const char *title, const char *text, ...) |
---|
366 | title = _("Error"); |
---|
367 | |
---|
368 | #ifdef WITH_BACKGROUND |
---|
369 | + union { |
---|
370 | + void *p; |
---|
371 | + void (*f) (int, int *, char *, const char *); |
---|
372 | + } func; |
---|
373 | + |
---|
374 | if (we_are_background) { |
---|
375 | func.f = bg_message; |
---|
376 | parent_call (func.p, NULL, 3, sizeof (flags), &flags, |
---|
377 | @@ -585,12 +585,13 @@ char * |
---|
378 | input_dialog_help (const char *header, const char *text, const char *help, |
---|
379 | const char *history_name, const char *def_text) |
---|
380 | { |
---|
381 | +#ifdef WITH_BACKGROUND |
---|
382 | union { |
---|
383 | void *p; |
---|
384 | char * (*f) (const char *, const char *, const char *, |
---|
385 | const char *, const char *); |
---|
386 | } func; |
---|
387 | -#ifdef WITH_BACKGROUND |
---|
388 | + |
---|
389 | if (we_are_background) |
---|
390 | { |
---|
391 | func.f = fg_input_dialog_help; |
---|
392 | diff --git a/vfs/cpio.c b/vfs/cpio.c |
---|
393 | index 0af9cda..adab951 100644 |
---|
394 | --- a/vfs/cpio.c |
---|
395 | +++ b/vfs/cpio.c |
---|
396 | @@ -95,18 +95,17 @@ struct new_cpio_header |
---|
397 | struct defer_inode { |
---|
398 | struct defer_inode *next; |
---|
399 | unsigned long inumber; |
---|
400 | - unsigned short device; |
---|
401 | + dev_t device; |
---|
402 | struct vfs_s_inode *inode; |
---|
403 | }; |
---|
404 | |
---|
405 | -/* FIXME: should be off_t instead of int. */ |
---|
406 | -static int cpio_position; |
---|
407 | +static off_t cpio_position; |
---|
408 | |
---|
409 | -static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super); |
---|
410 | +static ssize_t cpio_find_head(struct vfs_class *me, struct vfs_s_super *super); |
---|
411 | static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super); |
---|
412 | static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super); |
---|
413 | static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super); |
---|
414 | -static ssize_t cpio_read(void *fh, char *buffer, int count); |
---|
415 | +static ssize_t cpio_read(void *fh, char *buffer, size_t count); |
---|
416 | |
---|
417 | #define CPIO_POS(super) cpio_position |
---|
418 | /* If some time reentrancy should be needed change it to */ |
---|
419 | @@ -123,7 +122,7 @@ cpio_defer_find (struct defer_inode *l, struct defer_inode *i) |
---|
420 | return l; |
---|
421 | } |
---|
422 | |
---|
423 | -static int cpio_skip_padding(struct vfs_s_super *super) |
---|
424 | +static ssize_t cpio_skip_padding(struct vfs_s_super *super) |
---|
425 | { |
---|
426 | switch(super->u.arch.type) { |
---|
427 | case CPIO_BIN: |
---|
428 | @@ -229,10 +228,10 @@ static ssize_t cpio_read_head(struct vfs_class *me, struct vfs_s_super *super) |
---|
429 | #define SEEKBACK CPIO_SEEK_CUR(super, ptr - top) |
---|
430 | #define RETURN(x) return(super->u.arch.type = (x)) |
---|
431 | #define TYPEIS(x) ((super->u.arch.type == CPIO_UNKNOWN) || (super->u.arch.type == (x))) |
---|
432 | -static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super) |
---|
433 | +static ssize_t cpio_find_head(struct vfs_class *me, struct vfs_s_super *super) |
---|
434 | { |
---|
435 | char buf[256]; |
---|
436 | - int ptr = 0; |
---|
437 | + ssize_t ptr = 0; |
---|
438 | ssize_t top; |
---|
439 | ssize_t tmp; |
---|
440 | |
---|
441 | @@ -594,7 +593,7 @@ static int |
---|
442 | cpio_open_archive (struct vfs_class *me, struct vfs_s_super *super, |
---|
443 | const char *name, char *op) |
---|
444 | { |
---|
445 | - int status = STATUS_START; |
---|
446 | + ssize_t status = STATUS_START; |
---|
447 | |
---|
448 | (void) op; |
---|
449 | |
---|
450 | @@ -657,8 +656,9 @@ cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc, |
---|
451 | return 1; |
---|
452 | } |
---|
453 | |
---|
454 | -static ssize_t cpio_read(void *fh, char *buffer, int count) |
---|
455 | +static ssize_t cpio_read(void *fh, char *buffer, size_t count) |
---|
456 | { |
---|
457 | + ssize_t cnt; /* Internal counter, for unbreak signesss */ |
---|
458 | off_t begin = FH->ino->data_offset; |
---|
459 | int fd = FH_SUPER->u.arch.fd; |
---|
460 | struct vfs_class *me = FH_SUPER->me; |
---|
461 | @@ -666,12 +666,12 @@ static ssize_t cpio_read(void *fh, char *buffer, int count) |
---|
462 | if (mc_lseek (fd, begin + FH->pos, SEEK_SET) != |
---|
463 | begin + FH->pos) ERRNOR (EIO, -1); |
---|
464 | |
---|
465 | - count = MIN(count, FH->ino->st.st_size - FH->pos); |
---|
466 | + count = MIN(count, (size_t)(FH->ino->st.st_size - FH->pos)); |
---|
467 | |
---|
468 | - if ((count = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1); |
---|
469 | + if ((cnt = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1); |
---|
470 | |
---|
471 | - FH->pos += count; |
---|
472 | - return count; |
---|
473 | + FH->pos += cnt; |
---|
474 | + return cnt; |
---|
475 | } |
---|
476 | |
---|
477 | static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode) |
---|
478 | diff --git a/vfs/direntry.c b/vfs/direntry.c |
---|
479 | index e608d5e..dd78217 100644 |
---|
480 | --- a/vfs/direntry.c |
---|
481 | +++ b/vfs/direntry.c |
---|
482 | @@ -814,9 +814,9 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode) |
---|
483 | } |
---|
484 | |
---|
485 | static ssize_t |
---|
486 | -vfs_s_read (void *fh, char *buffer, int count) |
---|
487 | +vfs_s_read (void *fh, char *buffer, size_t count) |
---|
488 | { |
---|
489 | - int n; |
---|
490 | + ssize_t n; |
---|
491 | struct vfs_class *me = FH_SUPER->me; |
---|
492 | |
---|
493 | if (FH->linear == LS_LINEAR_PREOPEN) { |
---|
494 | @@ -841,9 +841,9 @@ vfs_s_read (void *fh, char *buffer, int count) |
---|
495 | } |
---|
496 | |
---|
497 | static ssize_t |
---|
498 | -vfs_s_write (void *fh, const char *buffer, int count) |
---|
499 | +vfs_s_write (void *fh, const char *buffer, size_t count) |
---|
500 | { |
---|
501 | - int n; |
---|
502 | + ssize_t n; |
---|
503 | struct vfs_class *me = FH_SUPER->me; |
---|
504 | |
---|
505 | if (FH->linear) |
---|
506 | diff --git a/vfs/extfs.c b/vfs/extfs.c |
---|
507 | index d30774e..bbd3994 100644 |
---|
508 | --- a/vfs/extfs.c |
---|
509 | +++ b/vfs/extfs.c |
---|
510 | @@ -742,7 +742,7 @@ extfs_open (struct vfs_class *me, const char *file, int flags, int mode) |
---|
511 | return extfs_info; |
---|
512 | } |
---|
513 | |
---|
514 | -static ssize_t extfs_read (void *data, char *buffer, int count) |
---|
515 | +static ssize_t extfs_read (void *data, char *buffer, size_t count) |
---|
516 | { |
---|
517 | struct pseudofile *file = (struct pseudofile *)data; |
---|
518 | |
---|
519 | @@ -1026,7 +1026,7 @@ cleanup: |
---|
520 | return result; |
---|
521 | } |
---|
522 | |
---|
523 | -static int extfs_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
524 | +static int extfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
525 | { |
---|
526 | (void) me; |
---|
527 | (void) path; |
---|
528 | @@ -1035,7 +1035,7 @@ static int extfs_chown (struct vfs_class *me, const char *path, int owner, int g |
---|
529 | return 0; |
---|
530 | } |
---|
531 | |
---|
532 | -static int extfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
533 | +static int extfs_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
534 | { |
---|
535 | (void) me; |
---|
536 | (void) path; |
---|
537 | @@ -1043,7 +1043,7 @@ static int extfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
538 | return 0; |
---|
539 | } |
---|
540 | |
---|
541 | -static ssize_t extfs_write (void *data, const char *buf, int nbyte) |
---|
542 | +static ssize_t extfs_write (void *data, const char *buf, size_t nbyte) |
---|
543 | { |
---|
544 | struct pseudofile *file = (struct pseudofile *)data; |
---|
545 | |
---|
546 | diff --git a/vfs/fish.c b/vfs/fish.c |
---|
547 | index 04c8527..df425d2 100644 |
---|
548 | --- a/vfs/fish.c |
---|
549 | +++ b/vfs/fish.c |
---|
550 | @@ -867,7 +867,7 @@ fish_linear_abort (struct vfs_class *me, struct vfs_s_fh *fh) |
---|
551 | { |
---|
552 | struct vfs_s_super *super = FH_SUPER; |
---|
553 | char buffer[8192]; |
---|
554 | - int n; |
---|
555 | + ssize_t n; |
---|
556 | |
---|
557 | print_vfs_message( _("Aborting transfer...") ); |
---|
558 | do { |
---|
559 | @@ -885,12 +885,14 @@ fish_linear_abort (struct vfs_class *me, struct vfs_s_fh *fh) |
---|
560 | print_vfs_message( _("Aborted transfer would be successful.") ); |
---|
561 | } |
---|
562 | |
---|
563 | -static int |
---|
564 | -fish_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len) |
---|
565 | +static ssize_t |
---|
566 | +fish_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, size_t len) |
---|
567 | { |
---|
568 | struct vfs_s_super *super = FH_SUPER; |
---|
569 | - int n = 0; |
---|
570 | - len = MIN( fh->u.fish.total - fh->u.fish.got, len ); |
---|
571 | + ssize_t n = 0; |
---|
572 | + |
---|
573 | + len = MIN( (size_t)(fh->u.fish.total - fh->u.fish.got), len ); |
---|
574 | + |
---|
575 | tty_disable_interrupt_key (); |
---|
576 | while (len && ((n = read (SUP.sockr, buf, len))<0)) { |
---|
577 | if ((errno == EINTR) && !tty_got_interrupt ()) |
---|
578 | @@ -972,7 +974,7 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *c |
---|
579 | return fish_send_command(me, super, buf, flags); |
---|
580 | |
---|
581 | static int |
---|
582 | -fish_chmod (struct vfs_class *me, const char *path, int mode) |
---|
583 | +fish_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
584 | { |
---|
585 | PREFIX |
---|
586 | g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n" |
---|
587 | @@ -1043,7 +1045,7 @@ static int fish_symlink (struct vfs_class *me, const char *setto, const char *pa |
---|
588 | } |
---|
589 | |
---|
590 | static int |
---|
591 | -fish_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
592 | +fish_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
593 | { |
---|
594 | char *sowner, *sgroup; |
---|
595 | struct passwd *pw; |
---|
596 | diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c |
---|
597 | index c4be6bf..c042153 100644 |
---|
598 | --- a/vfs/ftpfs.c |
---|
599 | +++ b/vfs/ftpfs.c |
---|
600 | @@ -455,7 +455,7 @@ static int |
---|
601 | ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, |
---|
602 | const char *netrcpass) |
---|
603 | { |
---|
604 | - char *pass; |
---|
605 | + volatile char *pass; |
---|
606 | char *op; |
---|
607 | char *name; /* login user name */ |
---|
608 | int anon = 0; |
---|
609 | @@ -478,7 +478,7 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, |
---|
610 | p = g_strconcat (_(" FTP: Password required for "), |
---|
611 | SUP.user, " ", (char *) NULL); |
---|
612 | op = vfs_get_password (p); |
---|
613 | - g_free (p); |
---|
614 | + g_free (p); p = NULL; /* Advanced security :) */ |
---|
615 | if (op == NULL) |
---|
616 | ERRNOR (EPERM, 0); |
---|
617 | SUP.password = g_strdup (op); |
---|
618 | static struct no_proxy_entry { |
---|
619 | @@ -1554,10 +1554,10 @@ ftpfs_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset) |
---|
620 | return 1; |
---|
621 | } |
---|
622 | |
---|
623 | -static int |
---|
624 | -ftpfs_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len) |
---|
625 | +static ssize_t |
---|
626 | +ftpfs_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, size_t len) |
---|
627 | { |
---|
628 | - int n; |
---|
629 | + ssize_t n; |
---|
630 | struct vfs_s_super *super = FH_SUPER; |
---|
631 | |
---|
632 | while ((n = read (FH_SOCK, buf, len))<0) { |
---|
633 | @@ -1660,7 +1660,7 @@ ftpfs_init_passwd(void) |
---|
634 | ftpfs_anonymous_passwd = g_strdup ("anonymous@"); |
---|
635 | } |
---|
636 | |
---|
637 | -static int ftpfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
638 | +static int ftpfs_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
639 | { |
---|
640 | char buf[BUF_SMALL]; |
---|
641 | int ret; |
---|
642 | @@ -1677,7 +1677,7 @@ static int ftpfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
643 | return ret; |
---|
644 | } |
---|
645 | |
---|
646 | -static int ftpfs_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
647 | +static int ftpfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
648 | { |
---|
649 | #if 0 |
---|
650 | ftpfs_errno = EPERM; |
---|
651 | diff --git a/vfs/local.c b/vfs/local.c |
---|
652 | index e136c07..2fb0015 100644 |
---|
653 | --- a/vfs/local.c |
---|
654 | +++ b/vfs/local.c |
---|
655 | @@ -48,9 +48,9 @@ local_open (struct vfs_class *me, const char *file, int flags, int mode) |
---|
656 | } |
---|
657 | |
---|
658 | ssize_t |
---|
659 | -local_read (void *data, char *buffer, int count) |
---|
660 | +local_read (void *data, char *buffer, size_t count) |
---|
661 | { |
---|
662 | - int n; |
---|
663 | + ssize_t n; |
---|
664 | |
---|
665 | if (!data) |
---|
666 | return -1; |
---|
667 | @@ -149,7 +149,7 @@ local_fstat (void *data, struct stat *buf) |
---|
668 | } |
---|
669 | |
---|
670 | static int |
---|
671 | -local_chmod (struct vfs_class *me, const char *path, int mode) |
---|
672 | +local_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
673 | { |
---|
674 | (void) me; |
---|
675 | |
---|
676 | @@ -157,7 +157,7 @@ local_chmod (struct vfs_class *me, const char *path, int mode) |
---|
677 | } |
---|
678 | |
---|
679 | static int |
---|
680 | -local_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
681 | +local_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
682 | { |
---|
683 | (void) me; |
---|
684 | |
---|
685 | @@ -197,7 +197,7 @@ local_symlink (struct vfs_class *me, const char *n1, const char *n2) |
---|
686 | } |
---|
687 | |
---|
688 | static ssize_t |
---|
689 | -local_write (void *data, const char *buf, int nbyte) |
---|
690 | +local_write (void *data, const char *buf, size_t nbyte) |
---|
691 | { |
---|
692 | int fd; |
---|
693 | int n; |
---|
694 | diff --git a/vfs/local.h b/vfs/local.h |
---|
695 | index 176279b..eccfe66 100644 |
---|
696 | --- a/vfs/local.h |
---|
697 | +++ b/vfs/local.h |
---|
698 | @@ -14,7 +14,7 @@ extern void init_localfs (void); |
---|
699 | /* these functions are used by other filesystems, so they are |
---|
700 | * published here. */ |
---|
701 | extern int local_close (void *data); |
---|
702 | -extern ssize_t local_read (void *data, char *buffer, int count); |
---|
703 | +extern ssize_t local_read (void *data, char *buffer, size_t count); |
---|
704 | extern int local_fstat (void *data, struct stat *buf); |
---|
705 | extern int local_errno (struct vfs_class *me); |
---|
706 | extern off_t local_lseek (void *data, off_t offset, int whence); |
---|
707 | diff --git a/vfs/samba/include/proto.h b/vfs/samba/include/proto.h |
---|
708 | index c6d2232..8e5aa62 100644 |
---|
709 | --- a/vfs/samba/include/proto.h |
---|
710 | +++ b/vfs/samba/include/proto.h |
---|
711 | @@ -127,11 +127,11 @@ void expand_mask(char *Mask,BOOL doext); |
---|
712 | void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date); |
---|
713 | void close_low_fds(void); |
---|
714 | int set_blocking(int fd, BOOL set); |
---|
715 | -int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew); |
---|
716 | +time_t TvalDiff(struct timeval *tvalold,struct timeval *tvalnew); |
---|
717 | SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align); |
---|
718 | int name_extract(char *buf,int ofs,char *name); |
---|
719 | int name_len(char *s1); |
---|
720 | -void msleep(int t); |
---|
721 | +void msleep(time_t t); |
---|
722 | BOOL do_match(char *str, char *regexp, int case_sig); |
---|
723 | BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2); |
---|
724 | int set_filelen(int fd, SMB_OFF_T len); |
---|
725 | diff --git a/vfs/samba/lib/charset.c b/vfs/samba/lib/charset.c |
---|
726 | index 58be253..7690716 100644 |
---|
727 | --- a/vfs/samba/lib/charset.c |
---|
728 | +++ b/vfs/samba/lib/charset.c |
---|
729 | @@ -296,7 +296,7 @@ multiple of 4.\n", codepage_file_name)); |
---|
730 | goto clean_and_exit; |
---|
731 | } |
---|
732 | |
---|
733 | - if(fread( (char *)cp_p, 1, size, fp)!=size) |
---|
734 | + if(fread( (char *)cp_p, 1, size, fp)!= (size_t)size) |
---|
735 | { |
---|
736 | DEBUG(0,("load_client_codepage: read fail on file %s. Error was %s.\n", |
---|
737 | codepage_file_name, unix_error_string (errno))); |
---|
738 | diff --git a/vfs/samba/lib/util.c b/vfs/samba/lib/util.c |
---|
739 | index 98df37a..edf345c 100644 |
---|
740 | --- a/vfs/samba/lib/util.c |
---|
741 | +++ b/vfs/samba/lib/util.c |
---|
742 | @@ -318,8 +318,8 @@ int name_mangle( char *In, char *Out, char name_type ) |
---|
743 | for( i = 0; i < 16; i++ ) |
---|
744 | { |
---|
745 | c = toupper( buf[i] ); |
---|
746 | - p[i*2] = ( (c >> 4) & 0x000F ) + 'A'; |
---|
747 | - p[(i*2)+1] = (c & 0x000F) + 'A'; |
---|
748 | + p[i*2] = (char)(( (c >> 4) & 0x000F ) + 'A'); |
---|
749 | + p[(i*2)+1] = (char)((c & 0x000F) + 'A'); |
---|
750 | } |
---|
751 | p += 32; |
---|
752 | p[0] = '\0'; |
---|
753 | @@ -330,12 +330,12 @@ int name_mangle( char *In, char *Out, char name_type ) |
---|
754 | switch( global_scope[i] ) |
---|
755 | { |
---|
756 | case '\0': |
---|
757 | - p[0] = len; |
---|
758 | + p[0] = (char)len; |
---|
759 | if( len > 0 ) |
---|
760 | p[len+1] = 0; |
---|
761 | return( name_len(Out) ); |
---|
762 | case '.': |
---|
763 | - p[0] = len; |
---|
764 | + p[0] = (char)len; |
---|
765 | p += (len + 1); |
---|
766 | len = -1; |
---|
767 | break; |
---|
768 | @@ -470,7 +470,7 @@ void show_msg(char *buf) |
---|
769 | |
---|
770 | for (i=0;i<(int)CVAL(buf,smb_wct);i++) |
---|
771 | { |
---|
772 | - DEBUG(5,("smb_vwv[%d]=%d (0x%X)\n",i, |
---|
773 | + DEBUG(5,("smb_vwv[%d]=%d (0x%x)\n", i, /* %x - unsigned int hex, but %X - unsigned long hex */ |
---|
774 | SVAL(buf,smb_vwv+2*i),SVAL(buf,smb_vwv+2*i))); |
---|
775 | } |
---|
776 | |
---|
777 | @@ -494,16 +494,15 @@ int smb_len(char *buf) |
---|
778 | { |
---|
779 | return( PVAL(buf,3) | (PVAL(buf,2)<<8) | ((PVAL(buf,1)&1)<<16) ); |
---|
780 | } |
---|
781 | - |
---|
782 | /******************************************************************* |
---|
783 | set the length of an smb packet |
---|
784 | -********************************************************************/ |
---|
785 | -void _smb_setlen(char *buf,int len) |
---|
786 | + ********************************************************************/ |
---|
787 | +void _smb_setlen(char *buf, int len) |
---|
788 | { |
---|
789 | - buf[0] = 0; |
---|
790 | - buf[1] = (len&0x10000)>>16; |
---|
791 | - buf[2] = (len&0xFF00)>>8; |
---|
792 | - buf[3] = len&0xFF; |
---|
793 | + buf[0] = '\0'; |
---|
794 | + buf[1] = (char)((len & 0x10000) >> 16); |
---|
795 | + buf[2] = (char)((len & 0xFF00) >> 8); |
---|
796 | + buf[3] = (char)(len & 0xFF); |
---|
797 | } |
---|
798 | |
---|
799 | /******************************************************************* |
---|
800 | @@ -968,7 +967,7 @@ int set_blocking(int fd, BOOL set) |
---|
801 | find the difference in milliseconds between two struct timeval |
---|
802 | values |
---|
803 | ********************************************************************/ |
---|
804 | -int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew) |
---|
805 | +time_t TvalDiff(struct timeval *tvalold,struct timeval *tvalnew) |
---|
806 | { |
---|
807 | return((tvalnew->tv_sec - tvalold->tv_sec)*1000 + |
---|
808 | ((int)tvalnew->tv_usec - (int)tvalold->tv_usec)/1000); |
---|
809 | @@ -1109,30 +1108,29 @@ int name_len(char *s1) |
---|
810 | return(len); |
---|
811 | } /* name_len */ |
---|
812 | |
---|
813 | - |
---|
814 | /******************************************************************* |
---|
815 | sleep for a specified number of milliseconds |
---|
816 | -********************************************************************/ |
---|
817 | -void msleep(int t) |
---|
818 | + ********************************************************************/ |
---|
819 | +void msleep(time_t t) |
---|
820 | { |
---|
821 | - int tdiff=0; |
---|
822 | + time_t tdiff = 0; |
---|
823 | |
---|
824 | @@ -1703,7 +1701,7 @@ BOOL get_myname(char *my_name,struct in_addr *ip) |
---|
825 | } |
---|
826 | |
---|
827 | if (ip) |
---|
828 | - putip((char *)ip,(char *)hp->h_addr); |
---|
829 | + putip((char *)ip,(char *)hp->h_addr_list); |
---|
830 | |
---|
831 | return(True); |
---|
832 | } |
---|
833 | @@ -1714,10 +1712,7 @@ true if two IP addresses are equal |
---|
834 | ****************************************************************************/ |
---|
835 | BOOL ip_equal(struct in_addr ip1,struct in_addr ip2) |
---|
836 | { |
---|
837 | - uint32 a1,a2; |
---|
838 | - a1 = ntohl(ip1.s_addr); |
---|
839 | - a2 = ntohl(ip2.s_addr); |
---|
840 | - return(a1 == a2); |
---|
841 | + return (ntohl(ip1.s_addr) == ntohl(ip2.s_addr)); |
---|
842 | } |
---|
843 | |
---|
844 | #if 0 /* May be useful one day */ |
---|
845 | @@ -1747,39 +1742,43 @@ int interpret_protocol(char *str,int def) |
---|
846 | |
---|
847 | /**************************************************************************** |
---|
848 | interpret an internet address or name into an IP address in 4 byte form |
---|
849 | -****************************************************************************/ |
---|
850 | -uint32 interpret_addr(const char *str) |
---|
851 | + ****************************************************************************/ |
---|
852 | +in_addr_t interpret_addr(const char *str) |
---|
853 | { |
---|
854 | - struct hostent *hp; |
---|
855 | - uint32 res; |
---|
856 | - int i; |
---|
857 | - BOOL pure_address = True; |
---|
858 | - |
---|
859 | - if (strcmp(str,"0.0.0.0") == 0) return(0); |
---|
860 | - if (strcmp(str,"255.255.255.255") == 0) return(0xFFFFFFFF); |
---|
861 | - |
---|
862 | - for (i=0; pure_address && str[i]; i++) |
---|
863 | - if (!(isdigit((int)str[i]) || str[i] == '.')) |
---|
864 | - pure_address = False; |
---|
865 | - |
---|
866 | - /* if it's in the form of an IP address then get the lib to interpret it */ |
---|
867 | - if (pure_address) { |
---|
868 | - res = inet_addr(str); |
---|
869 | - } else { |
---|
870 | - /* otherwise assume it's a network name of some sort and use |
---|
871 | - Get_Hostbyname */ |
---|
872 | - if ((hp = Get_Hostbyname(str)) == 0) { |
---|
873 | - DEBUG(3,("Get_Hostbyname: Unknown host. %s\n",str)); |
---|
874 | - return 0; |
---|
875 | - } |
---|
876 | - if(hp->h_addr == NULL) { |
---|
877 | - DEBUG(3,("Get_Hostbyname: host address is invalid for host %s\n",str)); |
---|
878 | - return 0; |
---|
879 | - } |
---|
880 | - putip((char *)&res,(char *)hp->h_addr); |
---|
881 | - } |
---|
882 | + int i; |
---|
883 | + BOOL pure_address = True; |
---|
884 | + in_addr_t res; |
---|
885 | + struct hostent *hp; |
---|
886 | + |
---|
887 | + if (strcmp(str, "0.0.0.0") == 0) |
---|
888 | + return(INADDR_ANY); |
---|
889 | + if (strcmp(str, "255.255.255.255") == 0) |
---|
890 | + return(INADDR_BROADCAST); |
---|
891 | + |
---|
892 | + for (i = 0; pure_address && str[i]; i++) |
---|
893 | + if (!(isdigit((int) str[i]) || str[i] == '.')) |
---|
894 | + pure_address = False; |
---|
895 | + |
---|
896 | + /* if it's in the form of an IP address then get the lib to interpret it */ |
---|
897 | + if (pure_address) { |
---|
898 | + res = inet_addr(str); |
---|
899 | + } else { |
---|
900 | + /* otherwise assume it's a network name of some sort and use |
---|
901 | + Get_Hostbyname */ |
---|
902 | + if ((hp = Get_Hostbyname(str)) == 0) { |
---|
903 | + DEBUG(3, ("Get_Hostbyname: Unknown host. %s\n", str)); |
---|
904 | + return 0; |
---|
905 | + } |
---|
906 | + if (hp->h_addr_list == NULL) { |
---|
907 | + DEBUG(3, ("Get_Hostbyname: host address is invalid for host %s\n", str)); |
---|
908 | + return 0; |
---|
909 | + } |
---|
910 | + putip((char *)&res, (char *) hp->h_addr_list); |
---|
911 | + } |
---|
912 | |
---|
913 | - if (res == (uint32)-1) return(0); |
---|
914 | + if (res == (in_addr_t)(-1)) { |
---|
915 | + return 0; |
---|
916 | + } |
---|
917 | |
---|
918 | return(res); |
---|
919 | } |
---|
920 | @@ -2108,7 +2107,7 @@ void standard_sub_basic(char *str) |
---|
921 | fstring envname; |
---|
922 | char *envval; |
---|
923 | char *q, *r; |
---|
924 | - int copylen; |
---|
925 | + ssize_t copylen; |
---|
926 | |
---|
927 | if (*(p+2) != '(') |
---|
928 | { |
---|
929 | diff --git a/vfs/samba/lib/util_sock.c b/vfs/samba/lib/util_sock.c |
---|
930 | index e8c7a20..5fbad8f 100644 |
---|
931 | --- a/vfs/samba/lib/util_sock.c |
---|
932 | +++ b/vfs/samba/lib/util_sock.c |
---|
933 | @@ -682,7 +682,7 @@ int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebin |
---|
934 | } |
---|
935 | |
---|
936 | memset((char *)&sock,'\0',sizeof(sock)); |
---|
937 | - memcpy((char *)&sock.sin_addr,(char *)hp->h_addr, hp->h_length); |
---|
938 | + memcpy((char *)&sock.sin_addr,(char *)hp->h_addr_list, hp->h_length); |
---|
939 | |
---|
940 | #ifdef HAVE_SOCK_SIN_LEN |
---|
941 | sock.sin_len = sizeof(sock); |
---|
942 | diff --git a/vfs/sfs.c b/vfs/sfs.c |
---|
943 | index ade71ee..db685ae 100644 |
---|
944 | --- a/vfs/sfs.c |
---|
945 | +++ b/vfs/sfs.c |
---|
946 | @@ -236,13 +236,13 @@ static int sfs_lstat (struct vfs_class *me, const char *path, struct stat *buf) |
---|
947 | #endif |
---|
948 | } |
---|
949 | |
---|
950 | -static int sfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
951 | +static int sfs_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
952 | { |
---|
953 | path = sfs_redirect (me, path); |
---|
954 | return chmod (path, mode); |
---|
955 | } |
---|
956 | |
---|
957 | -static int sfs_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
958 | +static int sfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
959 | { |
---|
960 | path = sfs_redirect (me, path); |
---|
961 | return chown (path, owner, group); |
---|
962 | diff --git a/vfs/smbfs.c b/vfs/smbfs.c |
---|
963 | index ff31130..4a07bb0 100644 |
---|
964 | --- a/vfs/smbfs.c |
---|
965 | +++ b/vfs/smbfs.c |
---|
966 | @@ -380,12 +380,12 @@ smbfs_fill_names (struct vfs_class *me, fill_names_f func) |
---|
967 | /* does same as do_get() in client.c */ |
---|
968 | /* called from vfs.c:1080, count = buffer size */ |
---|
969 | static ssize_t |
---|
970 | -smbfs_read (void *data, char *buffer, int count) |
---|
971 | +smbfs_read (void *data, char *buffer, size_t count) |
---|
972 | { |
---|
973 | smbfs_handle *info = (smbfs_handle *) data; |
---|
974 | - int n; |
---|
975 | + ssize_t n; |
---|
976 | |
---|
977 | - DEBUG(3, ("smbfs_read(fnum:%d, nread:%d, count:%d)\n", |
---|
978 | + DEBUG(3, ("smbfs_read(fnum:%d, nread:%d, count:%zu)\n", |
---|
979 | info->fnum, (int)info->nread, count)); |
---|
980 | n = cli_read(info->cli, info->fnum, buffer, info->nread, count); |
---|
981 | if (n > 0) |
---|
982 | @@ -394,12 +394,12 @@ smbfs_read (void *data, char *buffer, int count) |
---|
983 | } |
---|
984 | |
---|
985 | static ssize_t |
---|
986 | -smbfs_write (void *data, const char *buf, int nbyte) |
---|
987 | +smbfs_write (void *data, const char *buf, size_t nbyte) |
---|
988 | { |
---|
989 | smbfs_handle *info = (smbfs_handle *) data; |
---|
990 | - int n; |
---|
991 | + ssize_t n; |
---|
992 | |
---|
993 | - DEBUG(3, ("smbfs_write(fnum:%d, nread:%d, nbyte:%d)\n", |
---|
994 | + DEBUG(3, ("smbfs_write(fnum:%d, nread:%d, nbyte:%zu)\n", |
---|
995 | info->fnum, (int)info->nread, nbyte)); |
---|
996 | n = cli_write(info->cli, info->fnum, 0, buf, info->nread, nbyte); |
---|
997 | if (n > 0) |
---|
998 | @@ -870,7 +870,7 @@ smbfs_closedir (void *info) |
---|
999 | } |
---|
1000 | |
---|
1001 | static int |
---|
1002 | -smbfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
1003 | +smbfs_chmod (struct vfs_class *me, const char *path, mode_t mode) |
---|
1004 | { |
---|
1005 | (void) me; |
---|
1006 | |
---|
1007 | @@ -881,7 +881,7 @@ smbfs_chmod (struct vfs_class *me, const char *path, int mode) |
---|
1008 | } |
---|
1009 | |
---|
1010 | static int |
---|
1011 | -smbfs_chown (struct vfs_class *me, const char *path, int owner, int group) |
---|
1012 | +smbfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) |
---|
1013 | { |
---|
1014 | (void) me; |
---|
1015 | |
---|
1016 | @@ -1193,7 +1193,8 @@ smbfs_open_link (char *host, char *path, const char *user, int *port, |
---|
1017 | static char * |
---|
1018 | smbfs_get_path (smbfs_connection ** sc, const char *path) |
---|
1019 | { |
---|
1020 | - char *user, *host, *remote_path, *pass; |
---|
1021 | + char *user, *host, *remote_path; |
---|
1022 | + const volatile char *pass; |
---|
1023 | int port = SMB_PORT; |
---|
1024 | |
---|
1025 | DEBUG (3, ("smbfs_get_path(%s)\n", path)); |
---|
1026 | diff --git a/vfs/tar.c b/vfs/tar.c |
---|
1027 | index acf4abb..610387b 100644 |
---|
1028 | --- a/vfs/tar.c |
---|
1029 | +++ b/vfs/tar.c |
---|
1030 | @@ -294,7 +294,7 @@ tar_get_next_record (struct vfs_s_super *archive, int tard) |
---|
1031 | return &rec_buf; |
---|
1032 | } |
---|
1033 | |
---|
1034 | -static void tar_skip_n_records (struct vfs_s_super *archive, int tard, int n) |
---|
1035 | +static void tar_skip_n_records (struct vfs_s_super *archive, int tard, size_t n) |
---|
1036 | { |
---|
1037 | (void) archive; |
---|
1038 | |
---|
1039 | @@ -534,7 +534,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, |
---|
1040 | struct vfs_s_inode *inode = NULL, *parent; |
---|
1041 | long data_position; |
---|
1042 | char *q; |
---|
1043 | - int len; |
---|
1044 | + ssize_t len; |
---|
1045 | char *current_file_name, *current_link_name; |
---|
1046 | |
---|
1047 | current_link_name = |
---|
1048 | @@ -760,8 +760,9 @@ tar_super_same (struct vfs_class *me, struct vfs_s_super *parc, |
---|
1049 | return 1; |
---|
1050 | } |
---|
1051 | |
---|
1052 | -static ssize_t tar_read (void *fh, char *buffer, int count) |
---|
1053 | +static ssize_t tar_read (void *fh, char *buffer, size_t count) |
---|
1054 | { |
---|
1055 | + ssize_t cnt; |
---|
1056 | off_t begin = FH->ino->data_offset; |
---|
1057 | int fd = FH_SUPER->u.arch.fd; |
---|
1058 | struct vfs_class *me = FH_SUPER->me; |
---|
1059 | @@ -769,12 +770,12 @@ static ssize_t tar_read (void *fh, char *buffer, int count) |
---|
1060 | if (mc_lseek (fd, begin + FH->pos, SEEK_SET) != |
---|
1061 | begin + FH->pos) ERRNOR (EIO, -1); |
---|
1062 | |
---|
1063 | - count = MIN(count, FH->ino->st.st_size - FH->pos); |
---|
1064 | + count = MIN((ssize_t)count, (FH->ino->st.st_size - FH->pos)); |
---|
1065 | |
---|
1066 | - if ((count = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1); |
---|
1067 | + if ((cnt = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1); |
---|
1068 | |
---|
1069 | - FH->pos += count; |
---|
1070 | - return count; |
---|
1071 | + FH->pos += cnt; |
---|
1072 | + return cnt; |
---|
1073 | } |
---|
1074 | |
---|
1075 | static int tar_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode) |
---|
1076 | diff --git a/vfs/vfs-impl.h b/vfs/vfs-impl.h |
---|
1077 | index 22f9ea8..c27fbb6 100644 |
---|
1078 | --- a/vfs/vfs-impl.h |
---|
1079 | +++ b/vfs/vfs-impl.h |
---|
1080 | @@ -57,8 +57,8 @@ struct vfs_class { |
---|
1081 | void *(*open) (struct vfs_class *me, const char *fname, int flags, |
---|
1082 | int mode); |
---|
1083 | int (*close) (void *vfs_info); |
---|
1084 | - ssize_t (*read) (void *vfs_info, char *buffer, int count); |
---|
1085 | - ssize_t (*write) (void *vfs_info, const char *buf, int count); |
---|
1086 | + ssize_t (*read) (void *vfs_info, char *buffer, size_t count); |
---|
1087 | + ssize_t (*write) (void *vfs_info, const char *buf, size_t count); |
---|
1088 | |
---|
1089 | void *(*opendir) (struct vfs_class *me, const char *dirname); |
---|
1090 | void *(*readdir) (void *vfs_info); |
---|
1091 | @@ -68,8 +68,8 @@ struct vfs_class { |
---|
1092 | int (*lstat) (struct vfs_class *me, const char *path, struct stat * buf); |
---|
1093 | int (*fstat) (void *vfs_info, struct stat * buf); |
---|
1094 | |
---|
1095 | - int (*chmod) (struct vfs_class *me, const char *path, int mode); |
---|
1096 | - int (*chown) (struct vfs_class *me, const char *path, int owner, int group); |
---|
1097 | + int (*chmod) (struct vfs_class *me, const char *path, mode_t mode); |
---|
1098 | + int (*chown) (struct vfs_class *me, const char *path, uid_t owner, gid_t group); |
---|
1099 | int (*utime) (struct vfs_class *me, const char *path, |
---|
1100 | struct utimbuf * times); |
---|
1101 | |
---|
1102 | diff --git a/vfs/vfs.c b/vfs/vfs.c |
---|
1103 | index 43099ee..8c0ee09 100644 |
---|
1104 | --- a/vfs/vfs.c |
---|
1105 | +++ b/vfs/vfs.c |
---|
1106 | @@ -639,8 +639,8 @@ ssize_t mc_##name inarg \ |
---|
1107 | return result; \ |
---|
1108 | } |
---|
1109 | |
---|
1110 | -MC_HANDLEOP(read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count)) |
---|
1111 | -MC_HANDLEOP(write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte)) |
---|
1112 | +MC_HANDLEOP(read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count)) |
---|
1113 | +MC_HANDLEOP(write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte)) |
---|
1114 | |
---|
1115 | |
---|
1116 | #define MC_RENAMEOP(name) \ |
---|
1117 | diff --git a/vfs/vfs.h b/vfs/vfs.h |
---|
1118 | index a4ffd7b..4a57e1b 100644 |
---|
1119 | --- a/vfs/vfs.h |
---|
1120 | +++ b/vfs/vfs.h |
---|
1121 | @@ -19,8 +19,8 @@ void vfs_shut (void); |
---|
1122 | |
---|
1123 | int vfs_current_is_local (void); |
---|
1124 | int vfs_file_is_local (const char *filename); |
---|
1125 | -ssize_t mc_read (int handle, void *buffer, int count); |
---|
1126 | -ssize_t mc_write (int handle, const void *buffer, int count); |
---|
1127 | +ssize_t mc_read (int handle, void *buffer, size_t count); |
---|
1128 | +ssize_t mc_write (int handle, const void *buffer, size_t count); |
---|
1129 | int mc_utime (const char *path, struct utimbuf *times); |
---|
1130 | int mc_readlink (const char *path, char *buf, int bufsiz); |
---|
1131 | int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed); |
---|
1132 | diff --git a/vfs/xdirentry.h b/vfs/xdirentry.h |
---|
1133 | index c8da1c9..11c3b3b 100644 |
---|
1134 | --- a/vfs/xdirentry.h |
---|
1135 | +++ b/vfs/xdirentry.h |
---|
1136 | @@ -107,7 +107,7 @@ struct vfs_s_inode { |
---|
1137 | /* Data associated with an open file */ |
---|
1138 | struct vfs_s_fh { |
---|
1139 | struct vfs_s_inode *ino; |
---|
1140 | - long pos; /* This is for module's use */ |
---|
1141 | + off_t pos; /* This is for module's use */ |
---|
1142 | int handle; /* This is for module's use, but if != -1, will be mc_close()d */ |
---|
1143 | int changed; /* Did this file change? */ |
---|
1144 | int linear; /* Is that file open with O_LINEAR? */ |
---|
1145 | @@ -161,8 +161,8 @@ struct vfs_s_subclass { |
---|
1146 | |
---|
1147 | int (*linear_start) (struct vfs_class *me, struct vfs_s_fh *fh, |
---|
1148 | off_t from); |
---|
1149 | - int (*linear_read) (struct vfs_class *me, struct vfs_s_fh *fh, |
---|
1150 | - void *buf, int len); |
---|
1151 | + ssize_t (*linear_read) (struct vfs_class *me, struct vfs_s_fh *fh, |
---|
1152 | + void *buf, size_t len); |
---|
1153 | void (*linear_close) (struct vfs_class *me, struct vfs_s_fh *fh); |
---|
1154 | }; |
---|
1155 | |
---|