www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/03/15/18:45:30

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT nohavenot DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Copying clipboard into string
Date: Sun, 15 Mar 2009 19:36:00 -0400
Organization: Aioe.org NNTP Server
Lines: 66
Message-ID: <gpk37q$s3b$1@aioe.org>
References: <49bad553$1$1110$4fafbaef AT reader4 DOT news DOT tin DOT it> <u3adgs7xk DOT fsf AT gnu DOT org> <49bc3a01 DOT 31249272 AT news DOT execpc DOT com> <49bce243$0$1116$4fafbaef AT reader3 DOT news DOT tin DOT it>
NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.aioe.org
X-Complaints-To: abuse AT aioe DOT org
NNTP-Posting-Date: Sun, 15 Mar 2009 23:33:14 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933
X-Notice: Filtered by postfilter v. 0.7.7
X-Newsreader: Microsoft Outlook Express 6.00.2800.1933
Cancel-Lock: sha1:bMKfEJUxh4DZvqw1aGFoTPAfiUE=
X-Priority: 3
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Jason" <nospam AT net> wrote in message
news:49bce243$0$1116$4fafbaef AT reader3 DOT news DOT tin DOT it...
> when compiling appears an error:
>
> C:\Djgpp\bin>gcc -o Clip.exe Clip.c
> Clipdj.c: In function 'main':
> Clipdj.c:75: warning: passing argument 1 of 'rm_int_es_bx' discards
> qualifiers f
> rom pointer target type
>

There are a few ways to fix this.  The issue is "to" isn't a type directly
convertible to a "void *", which is what the first argument of
rm_int_es_bx() requires.  This wouldn't have been an issue if "to" was a
"char *" instead of a "static const char *".


For a first solution, you could add a cast on "to" in the rm_int_ex_bx()
call to change it to a "char *" so that it can be converted to a "void *":

> rm_int_es_bx(to, sizeof(to), &regs, 0x2F);

 rm_int_es_bx((char *)to, sizeof(to), &regs, 0x2F);

(NOTE: I've put a ">" to indicate the original line of code to distinquish
it from my changes)


For a second solution, you could eliminate the uneeded qualifiers on "to" by
changing this line:

> static const char to[] = "Hello";

 char to[] = "Hello";

(NOTE: The qualifiers are uneeded because the buffer "to" will never be
overwritten...)


For a third solution, you could eliminate the use of sizeof() and the
qualifiers on "to" by changing these lines:

#include <stdio.h>  /* add */

> static const char to[] = "Hello";

char *to="Hello";

> regs.x.cx = sizeof(to);

regs.x.cx = strlen(to)+1;

> rm_int_es_bx(to, sizeof(to), &regs, 0x2F);

 rm_int_es_bx(to, strlen(to)+1, &regs, 0x2F);

(NOTE: Use of sizeof() should be avoided if minor code changes allow use of
strlen() instead.)


HTH,


Rod Pemberton


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019