Apply changes to MS Visual C build. Patch from Ianos Gnatiuc 2:469/335.155

This commit is contained in:
Stas Degteff
2005-08-26 23:14:24 +00:00
parent 12c860a28c
commit 4a77b5a598
30 changed files with 273 additions and 94 deletions

View File

@@ -119,7 +119,4 @@
/* --------------------------------------------------------------- */
#endif
/* --------------------------------------------------------------- */

View File

@@ -28,12 +28,28 @@
#ifndef __goldall_h
#define __goldall_h
// ------------------------------------------------------------------
#include <cstddef>
#include <gcmpall.h>
// ------------------------------------------------------------------
// Disable some MS Visual C warnings
#if defined(_MSC_VER)
//
// C4786: 'identifier' : identifier was truncated to 'number'
// characters in the debug information
//
// C4800: 'type' : forcing value to bool 'true' or 'false'
// (performance warning)
//
// C4065: switch statement contains 'default' but no 'case' labels
//
// C4200: nonstandard extension used : zero-sized array in struct/union
//
#pragma warning(disable: 4200 4786 4800 4065)
#endif
// ------------------------------------------------------------------
// Define portability and shorthand notation

View File

@@ -46,6 +46,10 @@ char ge_win_coldtitle[GMAXTITLE+1] = "";
char ge_win_title[GMAXTITLE+1] = "";
int ge_win_ext_title;
#if defined(_MSC_VER)
extern "C"
{
#endif
char tu[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
@@ -115,6 +119,9 @@ char tl[256] = {
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
#if defined(_MSC_VER)
}
#endif
WCHAR oem2unicode[256];

View File

@@ -31,7 +31,9 @@
// ------------------------------------------------------------------
#if defined(_MSC_VER)
#pragma warning(disable: 4200)
#endif
#include <gdefs.h>
#if defined(__USE_NCURSES__)
#include <gcurses.h>

View File

@@ -153,7 +153,7 @@ void gareafile::ReadFMail116(FILE* fp, char* path, char* file, char* options) {
aa.setdesc("FMail Personal Mail");
aa.setautoid("ECHO_PERSONAL");
AddNewArea(aa);
}
}
headerType hdr;
@@ -232,7 +232,7 @@ void gareafile::ReadFMail116(FILE* fp, char* path, char* file, char* options) {
fclose(fp);
}
throw_delete(cfg);
}
@@ -278,7 +278,7 @@ void gareafile::ReadFMail(char* tag) {
rewind(fp);
uint fmver = (_rev.vmajor << 8) | _rev.vminor;
if(fmver < 94)
ReadFMail092(fp, path, file, options);
else {
@@ -297,8 +297,12 @@ void gareafile::ReadFMail(char* tag) {
ReadFMail098(fp, path, file, options);
else if((ar_rev >= 0x0110) and (ar_rev < 0x0200))
ReadFMail116(fp, path, file, options);
else
std::cout << "* Error: Unknown FMail config revision " << std::setfill('0') << std::setw(4) << std::hex << ar_rev << "h - Skipping." << std::endl;
else {
char buff[56+sizeof(uint)*2];
sprintf(buff, "* Error: Unknown FMail config revision %04Xh - Skipping.\n", ar_rev);
std::cout << buff;
// std::cout << "* Error: Unknown FMail config revision " << std::setfill('0') << std::setw(4) << std::hex << ar_rev << "h - Skipping." << std::endl;
}
}
}
}

View File

@@ -218,7 +218,11 @@ void gareafile::ReadIMail(char* tag) {
#endif
}
}
std::cout << "* Error: IMAIL " << imver[0] << '.' << std::setfill('0') << std::setw(2) << imver[1] << " (structure revision " << imstructver[0] << '.' << std::setfill('0') << std::setw(2) << imstructver[1] << ") is not supported - Skipping." << std::endl;
char buff[78];
sprintf(buff, "* Error: IMAIL %c.%02c (structure revision %c.%02c) is not supported - Skipping.\n", imver[0], imver[1], imstructver[0], imstructver[1]);
std::cout << buff;
// std::cout << "* Error: IMAIL " << imver[0] << '.' << std::setfill('0') << std::setw(2) << imver[1] << " (structure revision " << imstructver[0] << '.' << std::setfill('0') << std::setw(2) << imstructver[1] << ") is not supported - Skipping." << std::endl;
}
}

View File

@@ -216,7 +216,9 @@ void gareafile::ReadInterMail(char* tag) {
}
}
else {
std::cout << "* Error: InterMail revision " << std::setfill('0') << std::setw(4) << std::hex << ctl->sysrev << "h is not supported - Skipping." << std::endl;
char buff[62+sizeof(ctl->sysrev)*2];
sprintf(buff, "* Error: InterMail revision %04Xh is not supported - Skipping.\n", ctl->sysrev);
std::cout << buff;
}
throw_free(ctl);
}

View File

@@ -42,6 +42,11 @@
#include <dos.h>
#endif
#endif
#if defined(_MSC_VER)
#include <direct.h>
#include <sys/stat.h>
#endif
#include "hsksupp.h"
#include "ffind.h"

View File

@@ -37,7 +37,7 @@
#endif
#if defined(UNIX) || defined(__DJGPP__) || defined(__EMX__)
# include <unistd.h>
#endif
#endif
#if defined(UNIX)
#define stricmp strcasecmp

View File

@@ -46,6 +46,17 @@
#define O_BINARY 0
#endif
#if defined(_MSC_VER)
# define sleep(x) Sleep(1000L*(x))
#endif
# ifndef S_ISDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# endif
# ifndef S_ISREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# endif
/* fexists.c */
int fexist(const char *filename);
long fsize(const char *filename);

View File

@@ -1,7 +1,11 @@
#ifndef __filewrap_h
#define __filewrap_h
#if defined(_MSC_VER)
#include <io.h>
#else
#include <gfilutil.h>
#endif
#define sopen(fn,access,share) (sopen)((fn),(access),(share),S_IREAD|S_IWRITE)

View File

@@ -1,12 +1,28 @@
#ifndef __genwrap_h
#define __genwrap_h
#if defined(_MSC_VER)
#include <windows.h>
#include <share.h>
#include <io.h>
#else
#include <gtimall.h>
#endif
#ifndef __BEOS__
#define SLEEP(a) usleep(a)
#if defined(_MSC_VER)
#define SLEEP(a) Sleep(a)
#else
#define SLEEP(a) usleep(a)
#endif
#else
#include <OS.h>
#define SLEEP(a) snooze(a)
#endif
#if defined(_MSC_VER)
int lock(int handle, long offset, long length);
int unlock(int handle, long offset, long length);
#endif
#endif // __genwrap_h

View File

@@ -1,6 +1,14 @@
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* if not defined by make */
#if !defined(VERSION)
#define VERSION "0.5"
#endif
#if !defined(PATCH)
#define PATCH "15"
#endif
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
@@ -8,7 +16,9 @@
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#ifndef _MSC_VER
#define TIME_WITH_SYS_TIME 1
#endif
/*
* If your system is kinda special
@@ -26,12 +36,12 @@
/*
* how to declare functions that are exported from the UU library
*/
#define UUEXPORT
#define UUEXPORT
/*
* how to declare functions that are exported from the fptools library
*/
#define TOOLEXPORT
#define TOOLEXPORT
/*
* define if your compiler supports function prototypes
@@ -69,7 +79,9 @@
/* #undef HAVE_STDARG_H */
/* Define if you have the <sys/time.h> header file. */
#ifndef _MSC_VER
#define HAVE_SYS_TIME_H 1
#endif
/* Define if you have the <unistd.h> header file. */
#ifndef _MSC_VER

View File

@@ -84,7 +84,7 @@
char * uulib_id = "$Id$";
#ifdef SYSTEM_WINDLL
BOOL _export WINAPI
BOOL _export WINAPI
DllEntryPoint (HINSTANCE hInstance, DWORD seginfo,
LPVOID lpCmdLine)
{
@@ -574,7 +574,7 @@ UUstrerror (int code)
*/
int UUEXPORT
UUSetMsgCallback (void *opaque,
UUSetMsgCallback (void *opaque,
void (*func) _ANSI_ARGS_((void *, char *, int)))
{
uu_MsgCallback = func;
@@ -713,7 +713,7 @@ UULoadFile (char *filename, char *fileid, int delflag)
fileid = filename;
while (!feof (datei) && !ferror (datei)) {
/*
/*
* Peek file, or some systems won't detect EOF
*/
res = fgetc (datei);
@@ -721,7 +721,7 @@ UULoadFile (char *filename, char *fileid, int delflag)
break;
else
ungetc (res, datei);
if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) {
if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) {
UUkillfread (loaded);
@@ -769,7 +769,7 @@ UULoadFile (char *filename, char *fileid, int delflag)
if (uu_fast_scanning && sr != UURET_CONT) break;
continue;
}
if ((fload = UUPreProcessPart (loaded, &res)) == NULL) {
/*
* no useful data found
@@ -799,7 +799,7 @@ UULoadFile (char *filename, char *fileid, int delflag)
(loaded->end) ? "end" : "",
codenames[loaded->uudet]);
}
if ((res = UUInsertPartToList (fload))) {
/*
* couldn't use the data
@@ -897,7 +897,7 @@ UUDecodeFile (uulist *thefile, char *destname)
/*
* Determine the name of the target file according to the rules:
*
*
* IF (destname!=NULL) THEN filename=destname;
* ELSE
* filename = thefile->filename
@@ -1044,7 +1044,7 @@ UUInfoFile (uulist *thefile, void *opaque,
*/
if (uu_FileCallback) {
if ((res = (*uu_FileCallback) (uu_FileCBArg,
if ((res = (*uu_FileCallback) (uu_FileCBArg,
thefile->thisfile->data->sfname,
uugen_fnbuffer,
1)) != UURET_OK)
@@ -1061,7 +1061,7 @@ UUInfoFile (uulist *thefile, void *opaque,
else {
if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) {
UUMessage (uulib_id, __LINE__, UUMSG_ERROR,
uustring (S_NOT_OPEN_FILE),
uustring (S_NOT_OPEN_FILE),
thefile->thisfile->data->sfname,
strerror (uu_errno=errno));
return UURET_IOERR;
@@ -1076,7 +1076,7 @@ UUInfoFile (uulist *thefile, void *opaque,
fseek (inpfile, thefile->thisfile->data->startpos, SEEK_SET);
maxpos = thefile->thisfile->data->startpos + thefile->thisfile->data->length;
while (!feof (inpfile) &&
while (!feof (inpfile) &&
(uu_fast_scanning || ftell(inpfile) < maxpos)) {
if (_FP_fgets (uugen_inbuffer, 511, inpfile) == NULL)
break;
@@ -1112,7 +1112,7 @@ UUInfoFile (uulist *thefile, void *opaque,
fclose (inpfile);
if (uu_FileCallback)
(*uu_FileCallback) (uu_FileCBArg,
(*uu_FileCallback) (uu_FileCBArg,
thefile->thisfile->data->sfname,
uugen_fnbuffer, 0);
@@ -1121,7 +1121,7 @@ UUInfoFile (uulist *thefile, void *opaque,
return UURET_OK;
}
int UUEXPORT
UURenameFile (uulist *thefile, char *newname)
{