Fixed IA64 compatibility warnings from VC7, mainly changed unsigned int's to size_t and int's to ptrdiff_t.

[SVN r13223]
This commit is contained in:
John Maddock
2002-03-19 11:29:50 +00:00
parent 1d3653812a
commit b4cf815f7d
7 changed files with 71 additions and 52 deletions

View File

@ -36,7 +36,13 @@ namespace boost{
extern "C" {
#endif
typedef int regoff_t;
#if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE)
typedef std::ptrdiff_t regoff_t;
typedef std::size_t regsize_t;
#else
typedef ptrdiff_t regoff_t;
typedef size_t regsize_t;
#endif
typedef struct
{
@ -97,14 +103,14 @@ typedef enum{
} reg_exec_flags;
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, unsigned int);
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int);
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, unsigned int);
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int);
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
#endif
@ -254,8 +260,8 @@ public:
unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default) { return Grep(cb, s.c_str(), flags); }
unsigned int Grep(std::vector<std::string>& v, const char* p, unsigned int flags = match_default);
unsigned int Grep(std::vector<std::string>& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); }
unsigned int Grep(std::vector<unsigned int>& v, const char* p, unsigned int flags = match_default);
unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); }
unsigned int Grep(std::vector<std::size_t>& v, const char* p, unsigned int flags = match_default);
unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); }
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default);
unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default);
@ -266,12 +272,12 @@ public:
std::string Merge(const char* in, const char* fmt,
bool copy = true, unsigned int flags = match_default);
unsigned int Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0);
std::size_t Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0);
//
// now operators for returning what matched in more detail:
//
unsigned int Position(int i = 0)const;
unsigned int Length(int i = 0)const;
std::size_t Position(int i = 0)const;
std::size_t Length(int i = 0)const;
bool Matched(int i = 0)const;
unsigned int Line()const;
unsigned int Marks()const;

View File

@ -199,7 +199,7 @@ std::ostream& operator<<(std::ostream&, syntax_element_type);
union offset_type
{
re_syntax_base* p;
unsigned i;
std::size_t i;
};
//
@ -660,10 +660,10 @@ private:
unsigned marks;
int repeats;
unsigned char* startmap;
unsigned _expression_len;
unsigned int _leading_len;
std::size_t _expression_len;
std::size_t _leading_len;
const charT* _leading_string;
unsigned int _leading_string_len;
std::size_t _leading_string_len;
re_detail::kmp_info<charT>* pkmp;
unsigned error_code_;
charT* _expression;
@ -698,7 +698,7 @@ protected:
{ return (const re_detail::re_syntax_base*)e.data.data(); }
static const unsigned char* BOOST_REGEX_CALL get_map(const reg_expression& e)
{ return e.startmap; }
static unsigned int BOOST_REGEX_CALL leading_length(const reg_expression& e)
static std::size_t BOOST_REGEX_CALL leading_length(const reg_expression& e)
{ return e._leading_len; }
static const re_detail::kmp_info<charT>* get_kmp(const reg_expression& e)
{ return e.pkmp; }
@ -744,7 +744,7 @@ struct sub_match
operator std::basic_string<value_type> ()const
{
std::basic_string<value_type> result;
unsigned len = boost::re_detail::distance((iterator)first, (iterator)second);
std::size_t len = boost::re_detail::distance((iterator)first, (iterator)second);
result.reserve(len);
iterator i = first;
while(i != second)
@ -877,7 +877,7 @@ protected:
struct c_reference : public c_alloc
{
unsigned int cmatches;
std::size_t cmatches;
unsigned count;
sub_match<iterator> head, tail, null;
unsigned int lines;
@ -1298,11 +1298,11 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::maybe_assign(cons
p1 = (sub_match<iterator>*)(ref+1);
p2 = (sub_match<iterator>*)(m.ref+1);
iterator base = (*this)[-1].first;
unsigned int len1 = 0;
unsigned int len2 = 0;
unsigned int base1 = 0;
unsigned int base2 = 0;
unsigned int i;
std::size_t len1 = 0;
std::size_t len2 = 0;
std::size_t base1 = 0;
std::size_t base2 = 0;
std::size_t i;
for(i = 0; i < ref->cmatches; ++i)
{
//

View File

@ -85,6 +85,7 @@
// do C++ specific things in future...
//
# include <stdlib.h>
# include <stddef.h>
# ifdef _MSC_VER
# define BOOST_MSVC _MSC_VER
# endif
@ -277,6 +278,18 @@ using std::distance;
# include <windows.h>
#endif
#ifdef MAXPATH
# define BOOST_REGEX_MAX_PATH MAXPATH
#elif defined(MAX_PATH)
# define BOOST_REGEX_MAX_PATH MAX_PATH
#elif defined(FILENAME_MAX)
# define BOOST_REGEX_MAX_PATH FILENAME_MAX
#else
# define BOOST_REGEX_MAX_PATH 200
#endif
/*****************************************************************************
*
* Error Handling for exception free compilers:
@ -568,7 +581,7 @@ namespace boost{ namespace re_detail{
template <class T>
inline void pointer_destroy(T* p)
{ p->~T(); }
{ p->~T(); (void)p; }
template <class T>
inline void pointer_construct(T* p, const T& t)

View File

@ -711,7 +711,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
const charT* base = first;
// this is only used for the switch(), but cannot be folded in
// due to a bug in Comeau 4.2.44beta3
unsigned int inner_set = parse_inner_set(first, last);
unsigned int inner_set = parse_inner_set(first, last);
switch(inner_set)
{
case traits_type::syntax_colon:
@ -758,7 +758,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
//
if(traits_inst.lookup_collatename(s, base+2, first-2))
{
unsigned len = s.size();
std::size_t len = s.size();
if(len)
{
unsigned i = 0;
@ -936,7 +936,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
char_set_literal:
unsigned i = 0;
// get string length to stop us going past the end of string (DWA)
unsigned len = s.size();
std::size_t len = s.size();
while(i < len)
{
s[i] = traits_inst.translate(s[i], (_flags & regbase::icase));
@ -989,7 +989,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
{
++csingles;
const traits_string_type& s = singles.peek();
unsigned len = (s.size() + 1) * sizeof(charT);
std::size_t len = (s.size() + 1) * sizeof(charT);
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
singles.pop();
}
@ -1023,7 +1023,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
return 0;
}
++cranges;
unsigned len = (re_detail::re_strlen(c1.c_str()) + 1) * sizeof(charT);
std::size_t len = (re_detail::re_strlen(c1.c_str()) + 1) * sizeof(charT);
std::memcpy(data.extend(len), c1.c_str(), len);
len = (re_detail::re_strlen(c2.c_str()) + 1) * sizeof(charT);
std::memcpy(data.extend(len), c2.c_str(), len);
@ -1037,7 +1037,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
{
++cequivalents;
const traits_string_type& s = equivalents.peek();
unsigned len = (re_detail::re_strlen(s.c_str()) + 1) * sizeof(charT);
std::size_t len = (re_detail::re_strlen(s.c_str()) + 1) * sizeof(charT);
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
equivalents.pop();
}
@ -1272,9 +1272,9 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
const charT* ptr = p;
marks = 0;
re_detail::jstack<unsigned int, Allocator> mark(64, data.allocator());
re_detail::jstack<std::size_t, Allocator> mark(64, data.allocator());
re_detail::jstack<int, Allocator> markid(64, data.allocator());
unsigned int last_mark_popped = 0;
std::size_t last_mark_popped = 0;
register traits_size_type c;
register re_detail::re_syntax_base* dat;
@ -1635,7 +1635,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
repeat_jump:
{
unsigned offset;
std::ptrdiff_t offset;
if(dat == 0)
{
fail(REG_BADRPT);
@ -1776,7 +1776,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
static_cast<re_detail::re_jump*>(dat)->alt.i = INT_MAX/2;
// now work out where to insert:
unsigned int offset = 0;
std::size_t offset = 0;
if(mark.empty() == false)
{
// we have a '(' or '|' to go back to:

View File

@ -40,10 +40,10 @@ namespace boost{
template <class charT>
struct kmp_info
{
unsigned int size;
unsigned int len;
std::size_t size;
std::size_t len;
const charT* pstr;
int kmp_next[1];
std::ptrdiff_t kmp_next[1];
};
template <class charT, class Allocator>
@ -57,11 +57,11 @@ template <class iterator, class charT, class Trans, class Allocator>
kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a)
{
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
int i, j, m;
std::ptrdiff_t i, j, m;
i = 0;
m = boost::re_detail::distance(first, last);
++m;
unsigned int size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
std::size_t size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
--m;
//
// allocate struct and fill it in:

View File

@ -254,7 +254,7 @@ struct access_t : public reg_expression<charT, traits, Allocator>
{ return base_type::first(b); }
static const unsigned char* get_map(const base_type& b)
{ return base_type::get_map(b); }
static unsigned int leading_length(const base_type& b)
static std::size_t leading_length(const base_type& b)
{ return base_type::leading_length(b); }
static const kmp_info<charT>* get_kmp(const base_type& b)
{ return base_type::get_kmp(b); }
@ -1052,10 +1052,10 @@ void _skip_and_inc(unsigned int& clines, iterator& last_line, iterator& first, c
}
template <class iterator>
void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, unsigned int len)
void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, std::size_t len)
{
bool need_line = false;
for(unsigned int i = 0; i < len; ++i)
for(std::size_t i = 0; i < len; ++i)
{
--first;
if(*first == '\n')
@ -1257,9 +1257,9 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
case regbase::restart_fixed_lit:
{
const kmp_info<charT>* info = access::get_kmp(e);
int len = info->len;
std::ptrdiff_t len = info->len;
const charT* x = info->pstr;
int j = 0;
std::ptrdiff_t j = 0;
bool icase = e.flags() & regbase::icase;
while (first != last)
{

View File

@ -45,7 +45,7 @@ struct mss
};
BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id);
BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id);
extern BOOST_REGEX_DECL const char *re_default_error_messages[];
BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(wchar_t c);
@ -154,7 +154,7 @@ protected:
friend class c_regex_traits<wchar_t>;
#endif
static char regex_message_catalogue[200];
static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
enum syntax_map_size
{
map_size = UCHAR_MAX + 1
@ -318,8 +318,8 @@ public:
operator void*() { return this; }
};
static void BOOST_REGEX_CALL update();
static unsigned int BOOST_REGEX_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
static unsigned int BOOST_REGEX_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
private:
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
static void BOOST_REGEX_CALL m_free();
@ -362,7 +362,7 @@ struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
public:
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
protected:
static char regex_message_catalogue[200];
static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
enum syntax_map_size
{
map_size = UCHAR_MAX + 1
@ -519,8 +519,8 @@ public:
static void BOOST_REGEX_CALL update();
w32_regex_traits();
~w32_regex_traits();
static unsigned int BOOST_REGEX_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
static unsigned int BOOST_REGEX_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
private:
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
@ -580,7 +580,7 @@ struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
protected:
static char regex_message_cat[200];
static char regex_message_cat[BOOST_REGEX_MAX_PATH];
};
} // namespace re_detail
@ -752,7 +752,7 @@ public:
~cpp_regex_traits();
locale_type BOOST_REGEX_CALL imbue(locale_type l);
locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
unsigned int BOOST_REGEX_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2)const;
std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2)const;
struct sentry
{