Skip to content

Commit 66b727a

Browse files
committed
ui: correct memory far stuff
1 parent 3234cc1 commit 66b727a

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

bld/ui/c/uiballoc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#include <stdio.h>
3535
#if defined( _M_IX86 )
3636
#include <i86.h>
37+
#if defined( _M_I86 ) && ( defined( __SMALL__ ) || defined( __MEDIUM__ ) )
38+
#include <malloc.h>
39+
#endif
3740
#endif
3841
#include "uidef.h"
3942
#include "uifar.h"
@@ -64,8 +67,8 @@ bool intern balloc( BUFFER *bptr, uisize height, uisize width )
6467
LP_PIXEL ptr;
6568

6669
bptr->increment = width;
67-
ptr = MemAlloc( height * width * sizeof( PIXEL ) );
6870
#if defined( __DOS__ ) && !defined( _M_I86 )
71+
ptr = MemAlloc( height * width * sizeof( PIXEL ) );
6972
if( ptr != NULL ) {
7073
/* convert ptr to far if necessary: use DS for segment value */
7174
bptr->origin = ptr;
@@ -74,7 +77,12 @@ bool intern balloc( BUFFER *bptr, uisize height, uisize width )
7477
/* use 0 for segment value */
7578
bptr->origin = NULL;
7679
return( false );
80+
#elif defined( _M_I86 ) && ( defined( __SMALL__ ) || defined( __MEDIUM__ ) )
81+
ptr = _fmalloc( height * width * sizeof( PIXEL ) );
82+
bptr->origin = ptr;
83+
return( ptr != NULL );
7784
#else
85+
ptr = MemAlloc( height * width * sizeof( PIXEL ) );
7886
bptr->origin = ptr;
7987
return( ptr != NULL );
8088
#endif
@@ -90,6 +98,8 @@ void intern bfree( BUFFER *bptr )
9098
* this is safe because we synthesized the segment part to begin with.
9199
*/
92100
MemFree( (void *)_FP_OFF( bptr->origin ) );
101+
#elif defined( _M_I86 ) && ( defined( __SMALL__ ) || defined( __MEDIUM__ ) )
102+
_ffree( bptr->origin );
93103
#else
94104
MemFree( (void *)bptr->origin );
95105
#endif

bld/ui/c/uimenu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Open Watcom Project
44
*
5-
* Copyright (c) 2002-2019 The Open Watcom Contributors. All Rights Reserved.
5+
* Copyright (c) 2002-2026 The Open Watcom Contributors. All Rights Reserved.
66
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
77
*
88
* ========================================================================
@@ -97,8 +97,8 @@ char UIAPI uialtchar( ui_event ui_ev )
9797
}
9898

9999

100-
static void mstring( BUFFER *bptr, ORD row, ORD col, ATTR attr, LPC_STRING string, uisize string_len )
101-
/****************************************************************************************************/
100+
static void mstring( BUFFER *bptr, ORD row, ORD col, ATTR attr, const char *string, uisize string_len )
101+
/*****************************************************************************************************/
102102
{
103103
SAREA area;
104104

bld/ui/c/uivstr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Open Watcom Project
44
*
5-
* Copyright (c) 2002-2019 The Open Watcom Contributors. All Rights Reserved.
5+
* Copyright (c) 2002-2026 The Open Watcom Contributors. All Rights Reserved.
66
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
77
*
88
* ========================================================================
@@ -38,7 +38,7 @@
3838

3939

4040
void UIAPI uitextfield( VSCREEN *vs, ORD row, ORD col, unsigned field_len,
41-
ATTR attr, LPC_STRING string, unsigned string_len )
41+
ATTR attr, const char *string, unsigned string_len )
4242
/**************************************************************************/
4343
{
4444
uisize count;

bld/ui/h/stdui.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,8 @@ typedef int CATTR; /* cursor attributes type */
551551

552552
#if defined( __DOS__ ) || defined( _M_I86 )
553553
typedef PIXEL __far *LP_PIXEL;
554-
typedef char __far *LP_STRING;
555-
typedef const char __far *LPC_STRING;
556-
typedef void __far *LP_VOID;
557554
#else
558555
typedef PIXEL *LP_PIXEL;
559-
typedef char *LP_STRING;
560-
typedef const char *LPC_STRING;
561-
typedef void *LP_VOID;
562556
#endif
563557

564558
typedef enum {
@@ -742,7 +736,7 @@ extern void UIAPI uivsetactive( VSCREEN _FARD * );
742736
extern void UIAPI uivsetcursor( VSCREEN _FARD * );
743737
extern bool UIAPI uivshow( VSCREEN _FARD * );
744738
extern void UIAPI uivtextput( VSCREEN _FARD *, ORD, ORD, ATTR, const char _FARD *, unsigned );
745-
extern void UIAPI uitextfield( VSCREEN _FARD *, ORD, ORD, unsigned, ATTR, LPC_STRING, unsigned );
739+
extern void UIAPI uitextfield( VSCREEN _FARD *, ORD, ORD, unsigned, ATTR, const char *, unsigned );
746740
extern void UIAPI uimousespeed( unsigned );
747741
extern unsigned char UIAPI uicheckshift( void );
748742
extern ui_event UIAPI uikeyboardevent( void );

bld/ui/h/uidef.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Open Watcom Project
44
*
5-
* Copyright (c) 2002-2020 The Open Watcom Contributors. All Rights Reserved.
5+
* Copyright (c) 2002-2026 The Open Watcom Contributors. All Rights Reserved.
66
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
77
*
88
* ========================================================================
@@ -48,6 +48,14 @@
4848
#define CHAR_VALUE(c) (char)(unsigned char)(c)
4949
#define UCHAR_VALUE(c) (unsigned char)(c)
5050

51+
#if defined( __DOS__ ) || defined( _M_I86 )
52+
typedef char __far *LP_STRING;
53+
typedef const char __far *LPC_STRING;
54+
#else
55+
typedef char *LP_STRING;
56+
typedef const char *LPC_STRING;
57+
#endif
58+
5159
typedef enum {
5260
UI_MOUSE_PRESS = 1,
5361
UI_MOUSE_PRESS_RIGHT = 2,

0 commit comments

Comments
 (0)