Skip to content

Commit

Permalink
Modernize Windows code for clang 16.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@84952 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
kalibera committed Aug 15, 2023
1 parent 5198ec1 commit ca0bedf
Show file tree
Hide file tree
Showing 31 changed files with 220 additions and 189 deletions.
2 changes: 1 addition & 1 deletion src/extra/graphapp/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int getstringfromclipboard(char * str, int n)
} else return 1;
}

int clipboardhastext()
int clipboardhastext(void)
{
return (int) IsClipboardFormatAvailable(CF_TEXT);
}
15 changes: 8 additions & 7 deletions src/extra/graphapp/cursors.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@

#include "internal.h"

__declspec(dllexport) cursor ArrowCursor = NULL;
__declspec(dllexport) cursor BlankCursor = NULL;
__declspec(dllexport) cursor WatchCursor = NULL;
__declspec(dllexport) cursor CaretCursor = NULL;
__declspec(dllexport) cursor TextCursor = NULL;
__declspec(dllexport) cursor HandCursor = NULL;
__declspec(dllexport) cursor CrossCursor = NULL;
/* exporting is now done via .def file in R */
/* __declspec(dllexport) */ cursor ArrowCursor = NULL;
/* __declspec(dllexport) */ cursor BlankCursor = NULL;
/* __declspec(dllexport) */ cursor WatchCursor = NULL;
/* __declspec(dllexport) */ cursor CaretCursor = NULL;
/* __declspec(dllexport) */ cursor TextCursor = NULL;
/* __declspec(dllexport) */ cursor HandCursor = NULL;
/* __declspec(dllexport) */ cursor CrossCursor = NULL;

/*
* Define the 'Hand' image shape:
Expand Down
10 changes: 5 additions & 5 deletions src/extra/graphapp/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int askyesnocancel(const char *question)
/* This should always have a native encoded name, so don't need Unicode here */
static char *cod = NULL; /*current open directory*/

static char *getCurrentDirectory()
static char *getCurrentDirectory(void)
{
DWORD rc;
char *cwd = NULL;
Expand All @@ -209,7 +209,7 @@ static char *getCurrentDirectory()
return cwd;
}

static wchar_t *getCurrentDirectoryW()
static wchar_t *getCurrentDirectoryW(void)
{
DWORD rc;
wchar_t *cwd = NULL;
Expand Down Expand Up @@ -240,7 +240,7 @@ static int savecod(void)
return cwd ? 1 : 0;
}

void askchangedir()
void askchangedir(void)
{
char *s, *msg;

Expand Down Expand Up @@ -884,15 +884,15 @@ char *askUserPass(const char *title)
return ""; /* -Wall */
}

int modeless_active()
int modeless_active(void)
{
if (hModelessDlg)
return 1;
return 0;
}

PROTECTED
HWND get_modeless()
HWND get_modeless(void)
{
return hModelessDlg;
}
Expand Down
16 changes: 9 additions & 7 deletions src/extra/graphapp/fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
/*
* Pre-defined library fonts.
*/
__declspec(dllexport) font SystemFont = NULL;
__declspec(dllexport) font FixedFont = NULL;
__declspec(dllexport) font Times = NULL;
__declspec(dllexport) font Helvetica = NULL;
__declspec(dllexport) font Courier = NULL;

/* exporting is now done via .def file in R */
/* __declspec(dllexport) */ font SystemFont = NULL;
/* __declspec(dllexport) */ font FixedFont = NULL;
/* __declspec(dllexport) */ font Times = NULL;
/* __declspec(dllexport) */ font Helvetica = NULL;
/* __declspec(dllexport) */ font Courier = NULL;

/*
* Dots per inch for the screen.
Expand Down Expand Up @@ -99,7 +101,7 @@ PROTECTED font new_font_object(HFONT hf)
return (font) obj;
}

rect getSysFontSize()
rect getSysFontSize(void)
{
return SystemFont->rect;
}
Expand Down Expand Up @@ -153,7 +155,7 @@ void init_fonts(void)
https://tedwvc.wordpress.com/2019/09/09/new-utf-8-features-in-windows-10-1903/
R PR#18382
*/
UINT default_font_charset()
UINT default_font_charset(void)
{
if (GetACP() == 65001) {
CHARSETINFO csinfo;
Expand Down
4 changes: 2 additions & 2 deletions src/extra/graphapp/gbuttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void scrolltext(textbox c, int lines)
}


int ggetkeystate()
int ggetkeystate(void)
{
int k = 0;
if (GetKeyState(VK_CONTROL)&0x8000)
Expand Down Expand Up @@ -204,7 +204,7 @@ void checklimittext(textbox t, long n)

/* Length of text in the clipboard */

long getpastelength()
long getpastelength(void)
{
HGLOBAL hglb;
char *text;
Expand Down
2 changes: 1 addition & 1 deletion src/extra/graphapp/gmenus.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void mdimenu(menuitem m)
}
}

menu newmdimenu()
menu newmdimenu(void)
{
menu m ;
if (!ismdi()) return NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/extra/graphapp/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rect getcliprect(void);
void setcliprect(rect r);
PROTECTED void updatestatus(const char *text);
PROTECTED font new_font_object(HFONT hf);
UINT default_font_charset();
UINT default_font_charset(void);

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion src/extra/graphapp/rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ rgb myGetSysColor(int x)
return rgb( (col)&0xFFUL, (col>>8)&0xFFUL, (col>>16)&0x00FFUL );
}

rgb dialog_bg()
rgb dialog_bg(void)
{
return myGetSysColor(COLOR_BTNFACE);
}
4 changes: 2 additions & 2 deletions src/extra/graphapp/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static char MDIStatusText[256] = "" ;

static HWND intMDIStatus=0;

int addstatusbar()
int addstatusbar(void)
{
int a[1] = {-1};
if (!MDIFrame) return 0;
Expand All @@ -54,7 +54,7 @@ int addstatusbar()
return 1;
}

int delstatusbar()
int delstatusbar(void)
{
if (!MDIFrame) return 0;
MDIStatus = 0; /* handle_mdiframeresize notices this */
Expand Down
2 changes: 1 addition & 1 deletion src/extra/graphapp/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ void hide_window(object obj)
}
}

int ismdi()
int ismdi(void)
{
return (hwndClient!=NULL);
}
Expand Down
85 changes: 59 additions & 26 deletions src/extra/xdr/rpc/xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,34 @@ enum xdr_op {
* allocate dynamic storage of the appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
#ifdef UNUSED
typedef bool_t (*xdrproc_t)();
#endif

/*
* The XDR handle.
* Contains operation which is being applied to the stream,
* an operations vector for the paticular implementation (e.g. see xdr_mem.c),
* and two private fields for the use of the particular impelementation.
*/
typedef struct {
typedef struct XDR XDR;
struct XDR {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
bool_t (*x_getlong)(); /* get a long from underlying stream */
bool_t (*x_putlong)(); /* put a long to " */
bool_t (*x_getbytes)();/* get some bytes from " */
bool_t (*x_putbytes)();/* put some bytes to " */
u_int (*x_getpostn)();/* returns bytes off from beginning */
bool_t (*x_setpostn)();/* lets you reposition the stream */
long * (*x_inline)(); /* buf quick ptr to buffered data */
void (*x_destroy)(); /* free privates of this xdr_stream */
bool_t (*x_getlong)(XDR *, int32_t *); /* get a long from underlying stream */
bool_t (*x_putlong)(XDR *, int32_t *); /* put a long to " */
bool_t (*x_getbytes)(XDR *, caddr_t, u_int);/* get some bytes from " */
bool_t (*x_putbytes)(XDR *, caddr_t, u_int);/* put some bytes to " */
u_int (*x_getpostn)(XDR *);/* returns bytes off from beginning */
bool_t (*x_setpostn)(XDR *, u_int);/* lets you reposition the stream */
long * (*x_inline)(XDR *, u_int); /* buf quick ptr to buffered data */
void (*x_destroy)(XDR *); /* free privates of this xdr_stream */
} *x_ops;
caddr_t x_public; /* users' data */
caddr_t x_private; /* pointer to private data */
caddr_t x_base; /* private used for position info */
int x_handy; /* extra private word */
} XDR;
};

/*
* Operations defined on a XDR handle
Expand Down Expand Up @@ -193,11 +196,13 @@ typedef struct {
* no match, then a default routine may be called.
* If there is no match and no default routine it is an error.
*/
#ifdef UNUSED
#define NULL_xdrproc_t ((xdrproc_t)0)
struct xdr_discrim {
int value;
xdrproc_t proc;
};
#endif

/*
* In-line routines for fast encode/decode of primitve data types.
Expand Down Expand Up @@ -235,50 +240,78 @@ struct xdr_discrim {
/*
* These are the "generic" xdr routines.
*/

#ifdef UNUSED
extern bool_t xdr_void();
extern bool_t xdr_int();
extern bool_t xdr_u_int();
extern bool_t xdr_long();
extern bool_t xdr_u_long();
extern bool_t xdr_short();
extern bool_t xdr_u_short();
extern bool_t xdr_bool();
extern bool_t xdr_enum();
#endif

extern bool_t xdr_int(XDR *, int *);
extern bool_t xdr_u_int(XDR *, u_int *);
extern bool_t xdr_long(XDR *, int32_t *);
extern bool_t xdr_u_long(XDR *, uint32_t *);
extern bool_t xdr_short(XDR *, short *);
extern bool_t xdr_u_short(XDR *, u_short *);
extern bool_t xdr_bool(XDR *, bool_t *);
extern bool_t xdr_enum(XDR *, enum_t *);

#ifdef UNUSED
extern bool_t xdr_array();
extern bool_t xdr_bytes();
extern bool_t xdr_opaque();
extern bool_t xdr_string();
#endif

extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int);
extern bool_t xdr_opaque(XDR *, caddr_t, u_int);
extern bool_t xdr_string(XDR *, char **, u_int);

#ifdef UNUSED
extern bool_t xdr_union();
extern bool_t xdr_char();
extern bool_t xdr_u_char();
#endif

extern bool_t xdr_char(XDR *, char *);
extern bool_t xdr_u_char(XDR *, char *);

#ifdef UNUSED
extern bool_t xdr_vector();
extern bool_t xdr_float();
extern bool_t xdr_double();
#endif

extern bool_t xdr_double(XDR *, double *);

#ifdef UNUSED
extern bool_t xdr_reference();
extern bool_t xdr_pointer();
#endif

#ifdef UNUSED
extern bool_t xdr_wrapstring();
#endif

/*
* Common opaque bytes objects used by many rpc protocols;
* declared here due to commonality.
*/
#ifdef UNUSED
#define MAX_NETOBJ_SZ 1024
struct netobj {
u_int n_len;
char *n_bytes;
};
typedef struct netobj netobj;
extern bool_t xdr_netobj();
#endif

/*
* These are the public routines for the various implementations of
* xdr streams.
*/
extern void xdrmem_create(); /* XDR using memory buffers */
extern void xdrstdio_create(); /* XDR using stdio library */
extern void xdrmem_create(XDR *, caddr_t, u_int, enum xdr_op); /* XDR using memory buffers */
#include <stdio.h>
extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); /* XDR using stdio library */

#ifdef UNUSED
extern void xdrrec_create(); /* XDR pseudo records for tcp */
extern bool_t xdrrec_endofrecord(); /* make end of xdr record */
extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */
extern bool_t xdrrec_eof(); /* true if no more input */
#endif

#endif /* __XDR_HEADER__ */
Loading

0 comments on commit ca0bedf

Please sign in to comment.