summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-17 16:55:13 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-17 16:55:13 +0000
commitbcf87589a010480afbe6ab9f1b81cde37c6bdbb5 (patch)
tree99bfbd591a8a3aa0175b6ea074293e7faaff1a05
parent20958add7b2acc205e71569a3f318196baf7b7cf (diff)
downloadnuttx-bcf87589a010480afbe6ab9f1b81cde37c6bdbb5.tar.gz
nuttx-bcf87589a010480afbe6ab9f1b81cde37c6bdbb5.tar.bz2
nuttx-bcf87589a010480afbe6ab9f1b81cde37c6bdbb5.zip
Fix a C++ link issue: If constant strings used only in constructor, the don't get linked into the final executable
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4743 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx2
-rw-r--r--NxWidgets/nxwm/include/cstartwindow.hxx6
-rw-r--r--NxWidgets/nxwm/src/cstartwindow.cxx22
-rw-r--r--NxWidgets/nxwm/src/cwindowcontrol.cxx9
-rw-r--r--nuttx/lib/stdio/lib_syslogstream.c2
-rw-r--r--nuttx/sched/mq_rcvinternal.c22
-rw-r--r--nuttx/sched/mq_send.c5
-rw-r--r--nuttx/sched/mq_sndinternal.c4
8 files changed, 49 insertions, 23 deletions
diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
index 9d2c5c7e9..644abd714 100644
--- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
+++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
@@ -803,7 +803,7 @@ bool CWidgetControl::pollMouseEvents(CNxWidget *widget)
else if (m_mouse.leftDrag)
{
// The left button is still being held down
-
+
if (m_clickedWidget != (CNxWidget *)NULL)
{
// Handle a mouse drag event
diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx
index b0cad6127..8b5fd92d3 100644
--- a/NxWidgets/nxwm/include/cstartwindow.hxx
+++ b/NxWidgets/nxwm/include/cstartwindow.hxx
@@ -85,6 +85,12 @@ namespace NxWM
enum EStartWindowMessageOpcodes msgId; /**< The message opcode */
FAR void *instance; /**< Object instance. */
};
+
+ /**
+ * The well-known name for the Start Window's message queue.
+ */
+
+ extern FAR const char *g_startWindowMqName;
/**
* This class is the the start window application.
diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx
index 1c997fbb7..2b7ecbe66 100644
--- a/NxWidgets/nxwm/src/cstartwindow.cxx
+++ b/NxWidgets/nxwm/src/cstartwindow.cxx
@@ -1,5 +1,5 @@
/********************************************************************************************
- * NxWidgets/nxwm/src/cnxconsole.cxx
+ * NxWidgets/nxwm/src/cstartwindow.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -58,6 +58,16 @@
********************************************************************************************/
/********************************************************************************************
+ * Global Data
+ ********************************************************************************************/
+
+/**
+ * The well-known name for the Start Window's message queue.
+ */
+
+FAR const char *NxWM::g_startWindowMqName = CONFIG_NXWM_STARTWINDOW_MQNAME;
+
+/********************************************************************************************
* CStartWindow Method Implementations
********************************************************************************************/
@@ -554,10 +564,10 @@ int CStartWindow::startWindow(int argc, char *argv[])
attr.mq_msgsize = sizeof(struct SStartWindowMessage);
attr.mq_flags = 0;
- mqd_t mqd = mq_open(CONFIG_NXWM_STARTWINDOW_MQNAME, O_RDONLY|O_CREAT, 0666, &attr);
+ mqd_t mqd = mq_open(g_startWindowMqName, O_RDONLY|O_CREAT, 0666, &attr);
if (mqd == (mqd_t)-1)
{
- gdbg("ERROR: mq_open(%s) failed: %d\n", CONFIG_NXWM_STARTWINDOW_MQNAME, errno);
+ gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
return EXIT_FAILURE;
}
@@ -573,12 +583,14 @@ int CStartWindow::startWindow(int argc, char *argv[])
ssize_t nbytes = mq_receive(mqd, &msg, sizeof(struct SStartWindowMessage), 0);
if (nbytes < 0)
{
+ int errval = errno;
+
// EINTR is not an error. The wait was interrupted by a signal and
// we just need to try reading again.
- if (errno != EINTR)
+ if (errval != EINTR)
{
- gdbg("ERROR: mq_receive failed: %d\n", errno);
+ gdbg("ERROR: mq_receive failed: %d\n", errval);
}
}
while (nbytes < 0);
diff --git a/NxWidgets/nxwm/src/cwindowcontrol.cxx b/NxWidgets/nxwm/src/cwindowcontrol.cxx
index 2c575d35b..6c2144bad 100644
--- a/NxWidgets/nxwm/src/cwindowcontrol.cxx
+++ b/NxWidgets/nxwm/src/cwindowcontrol.cxx
@@ -77,10 +77,10 @@ CWindowControl::CWindowControl(FAR const NXWidgets::CWidgetStyle *style)
attr.mq_msgsize = sizeof(struct SStartWindowMessage);
attr.mq_flags = 0;
- m_mqd = mq_open(CONFIG_NXWM_STARTWINDOW_MQNAME, O_WRONLY|O_CREAT, 0666, &attr);
+ m_mqd = mq_open(g_startWindowMqName, O_WRONLY|O_CREAT, 0666, &attr);
if (m_mqd == (mqd_t)-1)
{
- gdbg("ERROR: mq_open(%s) failed: %d\n", CONFIG_NXWM_STARTWINDOW_MQNAME, errno);
+ gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
}
// Add ourself as the window callback
@@ -126,7 +126,6 @@ void CWindowControl::destroy(IApplication *app)
{
gdbg("ERROR: mq_send failed: %d\n", errno);
}
-
}
/**
@@ -166,7 +165,7 @@ void CWindowControl::handleMouseEvent(void)
struct SStartWindowMessage outmsg;
outmsg.msgId = MSGID_MOUSE_INPUT;
- outmsg.instance = (FAR void *)static_cast<CWidgetControl*>(this);
+ outmsg.instance = (FAR void *)this;
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
@@ -212,7 +211,7 @@ void CWindowControl::handleKeyboardEvent(void)
struct SStartWindowMessage outmsg;
outmsg.msgId = MSGID_KEYBOARD_INPUT;
- outmsg.instance = (FAR void *)static_cast<CWidgetControl*>(this);
+ outmsg.instance = (FAR void *)this;
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
diff --git a/nuttx/lib/stdio/lib_syslogstream.c b/nuttx/lib/stdio/lib_syslogstream.c
index 9cfb15367..a3fa5546d 100644
--- a/nuttx/lib/stdio/lib_syslogstream.c
+++ b/nuttx/lib/stdio/lib_syslogstream.c
@@ -78,7 +78,7 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
* Name: lib_syslogstream
*
* Description:
- * Initializes a stream for use with the coinfigured syslog interface.
+ * Initializes a stream for use with the configured syslog interface.
*
* Input parameters:
* lowoutstream - User allocated, uninitialized instance of struct
diff --git a/nuttx/sched/mq_rcvinternal.c b/nuttx/sched/mq_rcvinternal.c
index 744094322..8ec066da8 100644
--- a/nuttx/sched/mq_rcvinternal.c
+++ b/nuttx/sched/mq_rcvinternal.c
@@ -1,8 +1,8 @@
/****************************************************************************
* sched/mq_rcvinternal.c
*
- * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,15 +37,19 @@
* Included Files
****************************************************************************/
+#include <nuttx/config.h>
+
#include <sys/types.h>
-#include <fcntl.h> /* O_NONBLOCK */
+#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <mqueue.h>
#include <sched.h>
#include <debug.h>
+
#include <nuttx/arch.h>
+
#include "os_internal.h"
#include "mq_internal.h"
@@ -105,19 +109,19 @@ int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen)
if (!msg || !mqdes)
{
- *get_errno_ptr() = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
if ((mqdes->oflags & O_RDOK) == 0)
{
- *get_errno_ptr() = EPERM;
+ set_errno(EPERM);
return ERROR;
}
if (msglen < (size_t)mqdes->msgq->maxmsgsize)
{
- *get_errno_ptr() = EMSGSIZE;
+ set_errno(EMSGSIZE);
return ERROR;
}
@@ -178,7 +182,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
rtcb->msgwaitq = msgq;
msgq->nwaitnotempty++;
- *get_errno_ptr() = OK;
+ set_errno(OK);
up_block_task(rtcb, TSTATE_WAIT_MQNOTEMPTY);
/* When we resume at this point, either (1) the message queue
@@ -187,7 +191,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
* errno value (should be either EINTR or ETIMEDOUT).
*/
- if (*get_errno_ptr() != OK)
+ if (get_errno() != OK)
{
break;
}
@@ -198,7 +202,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
* message queue description referred to by 'mqdes'.
*/
- *get_errno_ptr() = EAGAIN;
+ set_errno(EAGAIN);
break;
}
}
diff --git a/nuttx/sched/mq_send.c b/nuttx/sched/mq_send.c
index 3a2284033..921ff7fcc 100644
--- a/nuttx/sched/mq_send.c
+++ b/nuttx/sched/mq_send.c
@@ -2,7 +2,7 @@
* sched/mq_send.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,11 +38,14 @@
****************************************************************************/
#include <nuttx/config.h>
+
#include <sys/types.h>
#include <mqueue.h>
#include <errno.h>
#include <debug.h>
+
#include <nuttx/arch.h>
+
#include "os_internal.h"
#include "mq_internal.h"
diff --git a/nuttx/sched/mq_sndinternal.c b/nuttx/sched/mq_sndinternal.c
index b359f6f17..3d9c88769 100644
--- a/nuttx/sched/mq_sndinternal.c
+++ b/nuttx/sched/mq_sndinternal.c
@@ -2,7 +2,7 @@
* sched/mq_send.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -417,6 +417,7 @@ int mq_dosend(mqd_t mqdes, FAR mqmsg_t *mqmsg, const void *msg, size_t msglen, i
#endif
}
#endif
+
/* Check if any tasks are waiting for the MQ not empty event. */
saved_state = irqsave();
@@ -445,6 +446,7 @@ int mq_dosend(mqd_t mqdes, FAR mqmsg_t *mqmsg, const void *msg, size_t msglen, i
up_unblock_task(btcb);
}
}
+
irqrestore(saved_state);
sched_unlock();
return OK;