mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Fix bug with getting Win32 clipboard contents. Added new PDC_freeclipboard() function.
This commit is contained in:
5
curses.h
5
curses.h
@@ -18,7 +18,7 @@
|
||||
***************************************************************************
|
||||
*/
|
||||
/*
|
||||
$Id: curses.h,v 1.6 2001/05/24 09:01:45 mark Exp $
|
||||
$Id: curses.h,v 1.7 2001/10/16 10:33:06 mark Exp $
|
||||
*/
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -169,7 +169,7 @@ PDCurses portable platform definitions list:
|
||||
See notes in wclrtoeol() and wclrtoeof().
|
||||
**man-end**********************************************************************/
|
||||
|
||||
#define PDC_BUILD 2502
|
||||
#define PDC_BUILD 2503
|
||||
#define PDCURSES 1 /* PDCurses-only routines */
|
||||
#define XOPEN 1 /* X/Open Curses routines */
|
||||
#define SYSVcurses 1 /* System V Curses routines */
|
||||
@@ -1716,6 +1716,7 @@ void PDC_CDECL PDC_set_title( char * );
|
||||
|
||||
int PDC_CDECL PDC_getclipboard( char **, long * );
|
||||
int PDC_CDECL PDC_setclipboard( char *, long );
|
||||
int PDC_CDECL PDC_freeclipboard( char * );
|
||||
|
||||
int PDC_CDECL PDC_get_input_fd( void );
|
||||
int PDC_CDECL PDC_curs_set( int );
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <curses.h>
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:28:32 mark Exp $";
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.3 2001/10/16 10:33:06 mark Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:28:32 mark Exp $";
|
||||
Gets the textual contents of the system's clipboard. This
|
||||
function returns the contents of the clipboard in the contents
|
||||
argument. It is the responsibilitiy of the caller to free the
|
||||
memory returned with the free() system call. The length of the
|
||||
memory returned with the PDC_freeclipboard() call. The length of the
|
||||
clipboard contents is returned in the length argument.
|
||||
|
||||
PDCurses Return Value:
|
||||
@@ -85,3 +85,28 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length)
|
||||
#endif
|
||||
return PDC_CLIP_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
/*man-start*********************************************************************
|
||||
|
||||
PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard
|
||||
|
||||
PDCurses Description:
|
||||
This is a PDCurses only routine.
|
||||
|
||||
Frees the memory allocated by PDC_getclipboard().
|
||||
|
||||
PDCurses Return Value:
|
||||
Always returns PDC_CLIP_ACCESS_ERROR no clipboard support
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_freeclipboard( char *contents );
|
||||
|
||||
**man-end**********************************************************************/
|
||||
|
||||
int PDC_CDECL PDC_freeclipboard(char *contents)
|
||||
{
|
||||
#ifdef PDCDEBUG
|
||||
if (trace_on) PDC_debug("PDC_freeclipboard() - called\n");
|
||||
#endif
|
||||
return PDC_CLIP_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:29:29 mark Exp $";
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.3 2001/10/16 10:33:06 mark Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:29:29 mark Exp $";
|
||||
Gets the textual contents of the system's clipboard. This
|
||||
function returns the contents of the clipboard in the contents
|
||||
argument. It is the responsibilitiy of the caller to free the
|
||||
memory returned with the free() system call. The length of the
|
||||
memory returned with the PDC_freeclipboard() call. The length of the
|
||||
clipboard contents is returned in the length argument.
|
||||
|
||||
PDCurses Return Value:
|
||||
@@ -191,3 +191,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length)
|
||||
return PDC_CLIP_ACCESS_ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*man-start*********************************************************************
|
||||
|
||||
PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard
|
||||
|
||||
PDCurses Description:
|
||||
This is a PDCurses only routine.
|
||||
|
||||
Frees the memory allocated by PDC_getclipboard().
|
||||
|
||||
PDCurses Return Value:
|
||||
Always returns PDC_CLIP_SUCCESS
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_freeclipboard( char *contents );
|
||||
|
||||
**man-end**********************************************************************/
|
||||
|
||||
int PDC_CDECL PDC_freeclipboard(char *contents)
|
||||
{
|
||||
#ifdef PDCDEBUG
|
||||
if (trace_on) PDC_debug("PDC_freeclipboard() - called\n");
|
||||
#endif
|
||||
|
||||
free(contents);
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ EXPORTS
|
||||
COLOR_PAIRS
|
||||
PDC_chadd
|
||||
PDC_chins
|
||||
PDC_freeclipboard
|
||||
PDC_getclipboard
|
||||
PDC_setclipboard
|
||||
PDC_set_title
|
||||
|
||||
@@ -294,3 +294,4 @@ EXPORTS PDC_ungetch
|
||||
EXPORTS PDC_usleep
|
||||
EXPORTS PDC_validchar
|
||||
EXPORTS PDC_vsscanf
|
||||
EXPORTS PDC_freeclipboard
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <curses.h>
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:46 mark Exp $";
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/10/16 10:33:06 mark Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:46 mark Exp $";
|
||||
Gets the textual contents of the system's clipboard. This
|
||||
function returns the contents of the clipboard in the contents
|
||||
argument. It is the responsibilitiy of the caller to free the
|
||||
memory returned with the free() system call. The length of the
|
||||
memory returned with the PDC_freeclipboard() call. The length of the
|
||||
clipboard contents is returned in the length argument.
|
||||
|
||||
PDCurses Return Value:
|
||||
@@ -74,7 +74,7 @@ int PDC_CDECL PDC_getclipboard(char **contents, long *length)
|
||||
}
|
||||
|
||||
len = strlen((char *)handle);
|
||||
*contents = (char *)malloc(len+1);
|
||||
*contents = (char *)GlobalAlloc(GMEM_FIXED,len+1);
|
||||
if (!*contents)
|
||||
{
|
||||
CloseClipboard();
|
||||
@@ -142,3 +142,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length)
|
||||
GlobalFree(ptr1);
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
||||
|
||||
/*man-start*********************************************************************
|
||||
|
||||
PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard
|
||||
|
||||
PDCurses Description:
|
||||
This is a PDCurses only routine.
|
||||
|
||||
Frees the memory allocated by PDC_getclipboard().
|
||||
|
||||
PDCurses Return Value:
|
||||
Always returns PDC_CLIP_SUCCESS
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_freeclipboard( char *contents );
|
||||
|
||||
**man-end**********************************************************************/
|
||||
|
||||
int PDC_CDECL PDC_freeclipboard(char *contents)
|
||||
{
|
||||
#ifdef PDCDEBUG
|
||||
if (trace_on) PDC_debug("PDC_freeclipboard() - called\n");
|
||||
#endif
|
||||
|
||||
GlobalFree(contents);
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <curses.h>
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:04 mark Exp $";
|
||||
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/10/16 10:33:06 mark Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:04 mark Exp $";
|
||||
Gets the textual contents of the system's clipboard. This
|
||||
function returns the contents of the clipboard in the contents
|
||||
argument. It is the responsibilitiy of the caller to free the
|
||||
memory returned with the free() system call. The length of the
|
||||
memory returned with the PDC_freeclipboard() call. The length of the
|
||||
clipboard contents is returned in the length argument.
|
||||
|
||||
PDCurses Return Value:
|
||||
@@ -94,3 +94,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length)
|
||||
|
||||
return XCurses_setclipboard( contents, length );
|
||||
}
|
||||
|
||||
/*man-start*********************************************************************
|
||||
|
||||
PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard
|
||||
|
||||
PDCurses Description:
|
||||
This is a PDCurses only routine.
|
||||
|
||||
Frees the memory allocated by PDC_getclipboard().
|
||||
|
||||
PDCurses Return Value:
|
||||
Always returns PDC_CLIP_SUCCESS
|
||||
|
||||
Portability:
|
||||
PDCurses int PDC_freeclipboard( char *contents );
|
||||
|
||||
**man-end**********************************************************************/
|
||||
|
||||
int PDC_CDECL PDC_freeclipboard(char *contents)
|
||||
{
|
||||
#ifdef PDCDEBUG
|
||||
if (trace_on) PDC_debug("PDC_freeclipboard() - called\n");
|
||||
#endif
|
||||
|
||||
free(contents);
|
||||
return PDC_CLIP_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user