What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » small mistake in C template?

small mistake in C template?
Author: Message:
Whacko
Full Member
***

Avatar

Posts: 209
Reputation: 1
40 / Male / –
Joined: Apr 2002
O.P. small mistake in C template?
Patchou... I hope you get this ;)

i found this in your  MPPluginHeader.h

code:

MPPLUGIN_RETURN_VOID DisplayToast(/*[in]*/  const char* sMessage,
                                  /*[in]*/  const char* sTitle,
                                  /*[in]*/  const char* sProgram,
                                  /*[in]*/  bool bPlaySound)
{
    char sMessageSafe[256]; sMessage[255] = '\0';



the "sMessage[255] = '\0'; " is not allowed here as its defined as const. VC++ may not have problem with it, however Borland C++ wont compile because of it.

Its NOT a big deal, it can be easily changed to char* without the const, or a little workaround:

code:

MPPLUGIN_RETURN_VOID DisplayToast(/*[in]*/  const char* sMessage,
                                  /*[in]*/  const char* sTitle,
                                  /*[in]*/  const char* sProgram,
                                  /*[in]*/  bool bPlaySound)
{
  char *workaround;
    char sMessageSafe[256];
//  sMessage[255] = '\0';
  workaround = (char*) &sMessage[255];

  *workaround = '\0';




just wanted to let you know ;) let me know what you think ;)
I code in:
C
C++
Delphi
Visual Basic
Pascal :P
05-23-2004 02:01 PM
Profile PM Web Find Quote Report
oberststen
Junior Member
**

oberst.tk

Posts: 23
35 / Male / –
Joined: Jan 2003
RE: small mistake in C template?
VC++ have the same error, it can't compile any plug-in
05-23-2004 08:54 PM
Profile PM Web Find Quote Report
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
43 / Male / Flag
Joined: Apr 2002
RE: small mistake in C template?
bha, stupid me... I'll fix it in 2 minutes. Thank you :)
[Image: signature2.gif]
05-24-2004 03:07 AM
Profile PM Web Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: small mistake in C template?
quote:
Originally posted by TheBlasphemer
Wouldn't that cause an access violation!?!
so true
quote:
use this instead:
code:
if (lstrlen(sMessage)>255)
   sMessage[256]=0;


sMessasge[255]=0; ;)

a bit offtopic:
quote:
Originally posted by Patchou
bha, stupid me... I'll fix it in 2 minutes. Thank you :)
:O oh oh... always patchou says that he forgets about it and never fixes :mipdodgy:  vague patch...   j/k :P
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
05-24-2004 11:06 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On