Changeset 223
- Timestamp:
- 04/21/08 19:37:38 (9 months ago)
- Files:
-
- xsel/trunk/xsel.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
xsel/trunk/xsel.c
r221 r223 250 250 static void 251 251 debug_property (int level, Window requestor, Atom property, Atom target, 252 intlength)253 { 254 print_debug (level, "Got window property: requestor 0x%x, property 0x%x, target 0x%x %s, length % d bytes", requestor, property, target, get_atom_name (target), length);252 unsigned long length) 253 { 254 print_debug (level, "Got window property: requestor 0x%x, property 0x%x, target 0x%x %s, length %ld bytes", requestor, property, target, get_atom_name (target), length); 255 255 } 256 256 … … 278 278 * strdup wrapper for unsigned char * 279 279 */ 280 #define xs_strdup(s) ((unsigned char *) strdup ((const char *)s)) 280 #define xs_strdup(s) ((unsigned char *) _xs_strdup ((const char *)s)) 281 static char * _xs_strdup (const char * s) 282 { 283 char * ret; 284 285 if (s == NULL) return NULL; 286 if ((ret = strdup(s)) == NULL) { 287 exit_err ("strdup error"); 288 } 289 290 return ret; 291 } 281 292 282 293 /* … … 292 303 * strncpy wrapper for unsigned char * 293 304 */ 294 #define xs_strncpy(dest,src,n) (strncpy ((char *)dest, (const char *)src, n)) 305 #define xs_strncpy(dest,s,n) (_xs_strncpy ((char *)dest, (const char *)s, n)) 306 static char * 307 _xs_strncpy (char * dest, const char * src, size_t n) 308 { 309 if (n > 0) { 310 strncpy (dest, src, n); 311 dest[n-1] = '\0'; 312 } 313 return dest; 314 } 295 315 296 316 /* … … 329 349 } 330 350 331 homedir = strdup (pw->pw_dir);351 homedir = _xs_strdup (pw->pw_dir); 332 352 333 353 return homedir; … … 464 484 465 485 /* The jmp_buf to longjmp out of the signal handler */ 466 static jmp_buf env_alrm;486 static sigjmp_buf env_alrm; 467 487 468 488 /* … … 490 510 static Bool 491 511 get_append_property (XSelectionEvent * xsl, unsigned char ** buffer, 492 int * offset, int* alloc)512 unsigned long * offset, unsigned long * alloc) 493 513 { 494 514 unsigned char * ptr; … … 515 535 return False; 516 536 } else if (format == 8) { 517 if ( (unsigned long)*offset + length > (unsigned long)*alloc) {537 if (*offset + length > *alloc) { 518 538 *alloc = *offset + length; 519 539 if ((*buffer = realloc (*buffer, *alloc)) == NULL) { … … 544 564 XEvent event; 545 565 unsigned char * incr_base = NULL, * incr_ptr = NULL; 546 intincr_alloc = 0, incr_xfer = 0;566 unsigned long incr_alloc = 0, incr_xfer = 0; 547 567 Bool wait_prop = True; 548 568 … … 1369 1389 { 1370 1390 HandleResult retval = HANDLE_OK; 1371 inti;1391 unsigned long i; 1372 1392 1373 1393 if (!mt) return retval; … … 1865 1885 } else { 1866 1886 /* Simply copy the argument pointer to new_argv */ 1867 new_argv[new_i++] = strdup ((*argv)[i]);1887 new_argv[new_i++] = _xs_strdup ((*argv)[i]); 1868 1888 } 1869 1889 } … … 1982 2002 } else if (OPT("--logfile") || OPT("-l")) { 1983 2003 i++; if (i >= argc) goto usage_err; 1984 strncpy (logfile, argv[i], MAXFNAME);2004 _xs_strncpy (logfile, argv[i], MAXFNAME); 1985 2005 } else { 1986 2006 goto usage_err;
