Source corrections

"Per Johansson" <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Hello.

I have compiled HUGS ( hugs98-Nov2003.tar.gz) using GCC 3.2.2 on OS/2. It was
rather easy, but there are two declarations (vsnprintf, snprintf) in the source
that don't conform with ISO C, since int is used instead of size_t (which is
unsigned int). I had make the following changes to compile. Replaced lines
marked // PJ.

In prelude.h:

// PJ extern int snprintf   Args((char*, int, const char*, ...));
extern int snprintf   Args((char*, size_t, const char*, ...));

// PJ extern int vsnprintf  Args((char*, int, const char*, va_list));
extern int vsnprintf  Args((char*, size_t, const char*, va_list));

In machdep.c:

// PJ int vsnprintf(char* buffer, int count, const char* fmt, va_list ap);
int vsnprintf(char* buffer, size_t count, const char* fmt, va_list ap);

// PJ int         count;
size_t         count;

// PJ int snprintf(char* buffer, int count, const char* fmt, ...);
int snprintf(char* buffer, size_t count, const char* fmt, ...);

// PJ int snprintf(char* buffer, int count, const char* fmt, ...) 
int snprintf(char* buffer, size_t count, const char* fmt, ...) {

-- 
Mr Per Johansson
mail: Oljekvarnsgatan 14B, SE-414 65 Göteborg, Suede
mobile phone: int +46 70 796 08 48
uri: http://per.johansson.name/
"it's a great idea, but possibly not, and I'm not being indecisive"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.