~ubuntu-branches/ubuntu/precise/arj/precise-updates

« back to all changes in this revision

Viewing changes to .pc/006_use_safe_strcpy.patch/misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover
  • Date: 2010-07-26 15:18:11 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100726151811-m981cpsvcven3vks
Tags: 3.10.22-9
* Use a safe strcpy for overlapping strings, among others fixes a build
  problem with a mangled generated .c file by msgbind (thus FTBFS), and
  CRC errors at run-time. (Closes: #590354)
* Now using Standards-Version 3.9.1 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: misc.h,v 1.2 2004/02/20 23:18:59 andrew_belov Exp $
 
3
 * ---------------------------------------------------------------------------
 
4
 * Prototypes of the functions located in MISC.C are declared here.
 
5
 *
 
6
 */
 
7
 
 
8
#ifndef MISC_INCLUDED
 
9
#define MISC_INCLUDED
 
10
 
 
11
#include "arjtypes.h"
 
12
#include "filelist.h"
 
13
 
 
14
/* ASCIIZ string copy macro */
 
15
 
 
16
#define strcpyn(dest, src, n)      \
 
17
{                                  \
 
18
 strncpy(dest, src, n-1);          \
 
19
 (dest)[n-1]='\0';                 \
 
20
}
 
21
 
 
22
/* Numerical variables exchange macro */
 
23
 
 
24
#define swap(a, b)        b^=a^=b^=a
 
25
 
 
26
/* Prototypes */
 
27
 
 
28
void unix_path_to_dos(char *path);
 
29
void *malloc_str(char *str);
 
30
void *malloc_far_str(char FAR *str);
 
31
void cur_time_stamp(struct timestamp *dest);
 
32
#if !defined(TILED)
 
33
 #define far_strchr(str, chr) strchr(str, chr)
 
34
 #define far_strcmp(str1, str2) strcmp(str1, str2)
 
35
 #define far_stricmp(str1, str2) stricmp(str1, str2)
 
36
 #define far_strcat(dest, src) strcat(dest, src)
 
37
 #define far_strcpy(dest, src) strcpy(dest, src)
 
38
 #define far_strlen(str) strlen(str)
 
39
 #define far_memset(buf, filler, size) memset(buf, filler, size)
 
40
#elif COMPILER==MSC
 
41
 #define far_strchr(str, chr) _fstrchr(str, chr)
 
42
 #define far_strcmp(str1, str2) _fstrcmp(str1, str2)
 
43
 #define far_stricmp(str1, str2) _fstricmp(str1, str2)
 
44
 #define far_strcat(dest, src) _fstrcat(dest, src)
 
45
 #define far_strcpy(dest, src) _fstrcpy(dest, src)
 
46
 #define far_strlen(str) _fstrlen(str)
 
47
 #define far_memset(buf, filler, size) _fmemset(buf, filler, size)
 
48
#else
 
49
 char FAR *far_strchr(char FAR *str, char chr);
 
50
 int far_strcmp(char FAR *str1, char FAR *str2);
 
51
 int far_stricmp(char FAR *str1, char FAR *str2);
 
52
 char FAR *far_strcat(char FAR *dest, char FAR *src);
 
53
 char FAR *far_strcpy(char FAR *dest, char FAR *src);
 
54
 unsigned int far_strlen(char FAR *str);
 
55
 void FAR *far_memset(void FAR *buf, int filler, unsigned int size);
 
56
#endif
 
57
char FAR *far_strcpyn(char FAR *dest, char FAR *src, int limit);
 
58
void to_7bit(char *str);
 
59
void strupper(char *s);
 
60
void strlower(char *s);
 
61
 
 
62
#if SFX_LEVEL>=ARJ
 
63
int flist_find(struct flist_root *root, char *name);
 
64
int flist_is_in_archive(struct flist_root *root, char *name);
 
65
int match_attrib(struct file_properties *properties);
 
66
void flist_cleanup(struct flist_root *root);
 
67
int flist_add(struct flist_root *root, struct flist_root *search_flist, char *name, FILE_COUNT *count, struct file_properties *properties);
 
68
void flist_init(struct flist_root *root, FILE_COUNT maxfiles, char type);
 
69
void flist_retrieve(char *dest, struct file_properties *properties, struct flist_root *root, FILE_COUNT entry);
 
70
#endif
 
71
#if SFX_LEVEL>=ARJSFXV
 
72
int flist_add_files(struct flist_root *root, struct flist_root *search_flist, char *name, int expand_wildcards, int recurse_subdirs, int file_type, FILE_COUNT *count);
 
73
#endif
 
74
 
 
75
/* Compact/tradidional internal filelists. For some reason, the compact
 
76
   filelist feature is not used in ARJSFXV v 2.72. This hasn't been verified
 
77
   since then and is now being dropped -- ASR 17/01/2001 */
 
78
 
 
79
void cfa_shutdown();
 
80
int cfa_get(FILE_COUNT num);
 
81
void cfa_store(FILE_COUNT num, int value);
 
82
int cfa_init(FILE_COUNT capacity);
 
83
 
 
84
void *malloc_msg(unsigned int size);
 
85
void FAR *farmalloc_msg(unsigned long size);
 
86
void FAR *farrealloc_msg(void FAR *memblock, unsigned long size);
 
87
 
 
88
#ifdef REARJ
 
89
 
 
90
char *tokenize_lf(char *str);
 
91
 
 
92
#endif
 
93
 
 
94
/* A platform-neutral far_strcmp substitution */
 
95
 
 
96
#ifdef CASE_SENSITIVE
 
97
 #define far_strccmp    far_stricmp
 
98
#else
 
99
 #define far_strccmp    far_strcmp
 
100
#endif
 
101
 
 
102
#endif