post-3.3.2-kdeedu-kstars.diff

This commit is contained in:
brad 2005-02-27 09:09:13 +00:00
parent e15803ee79
commit 9095e1fba4
23 changed files with 1854 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.29 2004/12/16 07:25:25 alek Exp $
# $OpenBSD: Makefile,v 1.30 2005/02/27 09:09:13 brad Exp $
COMMENT= "K Desktop Environment, edutainment"
CATEGORIES= x11 x11/kde
VERSION= 3.3.2
DISTNAME= kdeedu-${VERSION}
PKGNAME= ${DISTNAME}p1
MODKDE_VERSION?= 3.3.0
FLAVORS=debug

View File

@ -0,0 +1,101 @@
$OpenBSD: patch-kstars_kstars_devicemanager_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/devicemanager.cpp.orig Sat Jul 17 13:52:56 2004
+++ kstars/kstars/devicemanager.cpp Sun Feb 27 03:48:42 2005
@@ -17,6 +17,7 @@
#include "indiproperty.h"
#include "indigroup.h"
#include "indidevice.h"
+#include "indi/indicom.h"
#include "kstars.h"
#include "kstarsdatetime.h"
@@ -136,50 +137,51 @@ bool DeviceManager::indiConnect(QString
void DeviceManager::dataReceived()
{
char ibuf[32]; /* not so much user input lags */
- char msg[1024];
+ char errmsg[ERRMSG_SIZE];
int i, nr;
/* read INDI command */
- nr = read (serverFD, ibuf, sizeof(ibuf));
+ nr = read (serverFD, ibuf, sizeof(ibuf)-1);
if (nr <= 0)
{
if (nr < 0)
- sprintf (msg, "INDI: input error.");
+ strcpy (errmsg, "INDI: input error.");
else
- sprintf (msg, "INDI: agent closed connection.");
+ strcpy (errmsg, "INDI: agent closed connection.");
tcflush(serverFD, TCIFLUSH);
sNotifier->disconnect();
close(serverFD);
parent->removeDeviceMgr(mgrID);
- KMessageBox::error(0, QString(msg));
+ KMessageBox::error(0, QString::fromLatin1(errmsg));
return;
}
+ ibuf[ sizeof( ibuf )-1 ] = '\0';
+
/* process each char */
for (i = 0; i < nr; i++)
{
if (!XMLParser)
return;
- XMLEle *root = readXMLEle (XMLParser, (int)ibuf[i], msg);
+ XMLEle *root = readXMLEle (XMLParser, (int)ibuf[i], errmsg);
if (root)
{
//prXMLEle (stdout, root, 0);
- if (dispatchCommand(root, msg) < 0)
+ if (dispatchCommand(root, errmsg) < 0)
{
- //kdDebug() << msg << endl;
- fprintf(stderr, msg);
+ fprintf(stderr, "%s", errmsg);
prXMLEle (stdout, root, 0);
}
delXMLEle (root);
}
- else if (msg[0])
+ else if (*errmsg)
{
- kdDebug() << msg << endl;
+ kdDebug() << errmsg << endl;
}
}
}
@@ -271,7 +273,7 @@ int DeviceManager::removeDevice(QString
}
}
- sprintf(errmsg, "Device %s not found" , devName.ascii());
+ snprintf(errmsg, ERRMSG_SIZE, "Device %.32s not found" , devName.ascii());
return -1;
}
@@ -284,7 +286,7 @@ INDI_D * DeviceManager::findDev (QString
return (indi_dev.at(i));
}
- sprintf (errmsg, "INDI: no such device %s", devName.ascii());
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: no such device %.32s", devName.ascii());
kdDebug() << errmsg;
return NULL;
@@ -342,7 +344,7 @@ INDI_D * DeviceManager::findDev (XMLEle
return (addDevice (root, errmsg));
- sprintf (errmsg, "INDI: <%s> no such device %s", tagXMLEle(root), dn);
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.32s> no such device %.32s", tagXMLEle(root), dn);
return NULL;
}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-kstars_kstars_indi_Makefile_am,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/Makefile.am.orig Sun Feb 27 04:03:06 2005
+++ kstars/kstars/indi/Makefile.am Sun Feb 27 04:03:16 2005
@@ -40,7 +40,6 @@ install-exec-hook:
$(LN_S) lx200generic $(DESTDIR)$(bindir)/lx200_16
rm -f $(DESTDIR)$(bindir)/lx200gps
$(LN_S) lx200generic $(DESTDIR)$(bindir)/lx200gps
- chmod +s $(DESTDIR)$(bindir)/fliccd
uninstall-local:
rm $(DESTDIR)$(bindir)/lx200autostar $(DESTDIR)$(bindir)/lx200_16 $(DESTDIR)$(bindir)/lx200gps

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-kstars_kstars_indi_Makefile_in,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/Makefile.in.orig Sun Feb 27 03:56:06 2005
+++ kstars/kstars/indi/Makefile.in Sun Feb 27 03:56:17 2005
@@ -962,7 +962,6 @@ install-exec-hook:
$(LN_S) lx200generic $(DESTDIR)$(bindir)/lx200_16
rm -f $(DESTDIR)$(bindir)/lx200gps
$(LN_S) lx200generic $(DESTDIR)$(bindir)/lx200gps
- chmod +s $(DESTDIR)$(bindir)/fliccd
uninstall-local:
rm $(DESTDIR)$(bindir)/lx200autostar $(DESTDIR)$(bindir)/lx200_16 $(DESTDIR)$(bindir)/lx200gps

View File

@ -0,0 +1,118 @@
$OpenBSD: patch-kstars_kstars_indi_fitsrw_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/fitsrw.c.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/fitsrw.c Sun Feb 27 03:48:42 2005
@@ -155,31 +155,31 @@ int fits_ieee64_motorola = 0;
#define FITS_WRITE_BOOLCARD(fp,key,value) \
{char card[81]; \
- sprintf (card, "%-8.8s= %20s%50s", key, value ? "T" : "F", " "); \
+ snprintf (card, sizeof( card ), "%-8.8s= %20s%50s", key, value ? "T" : "F", " "); \
fwrite (card, 1, 80, fp); }
#define FITS_WRITE_LONGCARD(fp,key,value) \
{char card[81]; \
- sprintf (card, "%-8.8s= %20ld%50s", key, (long)value, " "); \
+ snprintf (card, sizeof( card ), "%-8.8s= %20ld%50s", key, (long)value, " "); \
fwrite (card, 1, 80, fp); }
#define FITS_WRITE_DOUBLECARD(fp,key,value) \
{char card[81], dbl[21], *istr; \
- sprintf (dbl, "%20f", (double)value); istr = strstr (dbl, "e"); \
+ snprintf (dbl, sizeof( dbl ), "%20f", (double)value); istr = strstr (dbl, "e"); \
if (istr) *istr = 'E'; \
- sprintf (card, "%-8.8s= %20.20s%50s", key, dbl, " "); \
+ snprintf (card, sizeof( card ), "%-8.8s= %20.20s%50s", key, dbl, " "); \
fwrite (card, 1, 80, fp); }
#define FITS_WRITE_STRINGCARD(fp,key,value) \
{char card[81]; int k;\
- sprintf (card, "%-8.8s= \'%s", key, value); \
+ snprintf (card, sizeof( card ), "%-8.8s= \'%s", key, value); \
for (k = strlen (card); k < 81; k++) card[k] = ' '; \
k = strlen (key); if (k < 8) card[19] = '\''; else card[11+k] = '\''; \
fwrite (card, 1, 80, fp); }
#define FITS_WRITE_CARD(fp,value) \
{char card[81]; \
- sprintf (card, "%-80.80s", value); \
+ snprintf (card, sizeof( card ), "%-80.80s", value); \
fwrite (card, 1, 80, fp); }
@@ -474,7 +474,8 @@ static void fits_drop_error (void)
/* #END-PAR */
/*****************************************************************************/
-FITS_FILE *fits_open (const char *filename, const char *openmode)
+
+FITS_FILE *fits_open (const char* filename, const char *openmode)
{int reading, writing, n_rec, n_hdr;
long fpos_header, fpos_data;
@@ -483,8 +484,10 @@ FITS_FILE *fits_open (const char *filena
FITS_RECORD_LIST *hdrlist;
FITS_HDU_LIST *hdulist, *last_hdulist;
- /* initialize */
+ if ((filename == NULL) || (*filename == '\0') || (openmode == NULL))
+ FITS_RETURN ("fits_open: Invalid parameters", NULL);
+ /* initialize */
hdulist = NULL;
last_hdulist = NULL;
@@ -506,9 +509,6 @@ FITS_FILE *fits_open (const char *filena
}
}
- if ((filename == NULL) || (*filename == '\0') || (openmode == NULL))
- FITS_RETURN ("fits_open: Invalid parameters", NULL);
-
reading = (strcmp (openmode, "r") == 0);
writing = (strcmp (openmode, "w") == 0);
if ((!reading) && (!writing))
@@ -858,7 +858,7 @@ int fits_write_header (FITS_FILE *ff, FI
for (r = 0; r < hdulist->naxis; r++)
{char naxisn[10];
- sprintf (naxisn, "NAXIS%d", r+1);
+ snprintf (naxisn, sizeof( naxisn ), "NAXIS%d", r+1);
FITS_WRITE_LONGCARD (ff->fp, naxisn, hdulist->naxisn[r]);
numcards++;
}
@@ -1025,7 +1025,7 @@ static FITS_HDU_LIST *fits_decode_header
for (k = 1; k <= FITS_MAX_AXIS; k++)
{char naxisn[9];
- sprintf (naxisn, "NAXIS%-3d", k);
+ snprintf (naxisn, sizeof( naxisn ), "NAXIS%-3d", k);
fdat = fits_decode_card (fits_search_card (hdr, naxisn), typ_flong);
if (fdat == NULL)
{
@@ -1121,7 +1121,7 @@ static FITS_HDU_LIST *fits_decode_header
}
else
{char msg[160];
- sprintf (msg, "fits_decode_header: IEEE floating point format required for\
+ snprintf (msg, sizeof( msg ), "fits_decode_header: IEEE floating point format required for\
BITPIX=%d\nis not supported on this machine", hdulist->bitpix);
fits_set_error (msg);
}
@@ -1130,7 +1130,7 @@ static FITS_HDU_LIST *fits_decode_header
return (hdulist);
err_missing:
- sprintf (errmsg, "fits_decode_header: missing/invalid %s card", key);
+ snprintf (errmsg, sizeof(errmsg), "fits_decode_header: missing/invalid %.50s card", key);
err_return:
fits_delete_hdulist (hdulist);
@@ -1429,7 +1429,7 @@ FITS_DATA *fits_decode_card (const char
if (strncmp (card+8, "= ", 2) != 0)
{
- sprintf (msg, "fits_decode_card (warning): Missing value indicator\
+ snprintf (msg, sizeof( msg ), "fits_decode_card (warning): Missing value indicator\
'= ' for %8.8s", l_card);
fits_set_error (msg);
}

View File

@ -0,0 +1,253 @@
$OpenBSD: patch-kstars_kstars_indi_fli_ccd_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/fli_ccd.c.orig Sun Oct 3 03:13:39 2004
+++ kstars/kstars/indi/fli_ccd.c Sun Feb 27 03:48:43 2005
@@ -51,9 +51,9 @@ void getBasicData(void);
void initDataChannel(void);
void waitForData(int rp, int wp);
void updateDataChannel(void *p);
-void uploadFile(char * filename);
+void uploadFile(const char* filename);
int findPort(void);
-int writeFITS(char *filename, char errmsg[]);
+int writeFITS(const char* filename, char errmsg[]);
int findcam(flidomain_t domain);
int setImageArea(char errmsg[]);
int manageDefaults(char errmsg[]);
@@ -419,7 +419,7 @@ void ISNewNumber (const char *dev, const
long err;
int i;
INumber *np;
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
/* ignore if not ours */
if (dev && strcmp (dev, mydev))
@@ -556,14 +556,14 @@ void ISNewNumber (const char *dev, const
if (nset < 4)
{
- IDSetNumber(&FrameNP, "Invalid range. Valid range is (0,0) - (%0.f,%0.f)", FLICam->width, FLICam->height);
- IDLog("Invalid range. Valid range is (0,0) - (%0.f,%0.f)", FLICam->width, FLICam->height);
+ IDSetNumber(&FrameNP, "Invalid range. Valid range is (0,0) - (%0d,%0d)", FLICam->width, FLICam->height);
+ IDLog("Invalid range. Valid range is (0,0) - (%0d,%0d)", FLICam->width, FLICam->height);
return;
}
if (setImageArea(errmsg))
{
- IDSetNumber(&FrameNP, errmsg);
+ IDSetNumber(&FrameNP, "%s", errmsg);
return;
}
@@ -600,8 +600,8 @@ void ISNewNumber (const char *dev, const
{
if (values[i] < 1 || values[i] > MAX_X_BIN)
{
- IDSetNumber(&BinningNP, "Error: Valid X bin values are from 1 to %d", MAX_X_BIN);
- IDLog("Error: Valid X bin values are from 1 to %d", MAX_X_BIN);
+ IDSetNumber(&BinningNP, "Error: Valid X bin values are from 1 to %g", MAX_X_BIN);
+ IDLog("Error: Valid X bin values are from 1 to %g", MAX_X_BIN);
return;
}
@@ -618,8 +618,8 @@ void ISNewNumber (const char *dev, const
{
if (values[i] < 1 || values[i] > MAX_Y_BIN)
{
- IDSetNumber(&BinningNP, "Error: Valid Y bin values are from 1 to %d", MAX_Y_BIN);
- IDLog("Error: Valid X bin values are from 1 to %d", MAX_Y_BIN);
+ IDSetNumber(&BinningNP, "Error: Valid Y bin values are from 1 to %g", MAX_Y_BIN);
+ IDLog("Error: Valid X bin values are from 1 to %g", MAX_Y_BIN);
return;
}
@@ -637,7 +637,7 @@ void ISNewNumber (const char *dev, const
if (setImageArea(errmsg))
{
IDSetNumber(&BinningNP, errmsg, NULL);
- IDLog(errmsg);
+ IDLog("%s", errmsg);
return;
}
@@ -817,8 +817,8 @@ int setImageArea(char errmsg[])
if ( (err = FLISetImageArea(fli_dev, x_1, y_1, x_2, y_2) ))
{
- sprintf(errmsg, "FLISetImageArea() failed. %s.\n", strerror((int)-err));
- IDLog(errmsg, NULL);
+ snprintf(errmsg, ERRMSG_SIZE, "FLISetImageArea() failed. %s.\n", strerror((int)-err));
+ IDLog("%s", errmsg);
return -1;
}
@@ -832,13 +832,13 @@ int grabImage()
{
long err;
int img_size,i, fd;
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
char filename[] = "/tmp/fitsXXXXXX";
if ((fd = mkstemp(filename)) < 0)
{
- IDMessage(mydev, "Error making temporary filename.", NULL);
- IDLog("Error making temporary filename.\n", NULL);
+ IDMessage(mydev, "Error making temporary filename.");
+ IDLog("Error making temporary filename.\n");
return -1;
}
close(fd);
@@ -849,8 +849,8 @@ int grabImage()
if (FLIImg->img == NULL)
{
- IDMessage(mydev, "Not enough memory to store image.", NULL);
- IDLog("Not enough memory to store image.\n", NULL);
+ IDMessage(mydev, "Not enough memory to store image.");
+ IDLog("Not enough memory to store image.\n");
return -1;
}
@@ -880,7 +880,7 @@ int grabImage()
}
-int writeFITS(char *filename, char errmsg[])
+int writeFITS(const char* filename, char errmsg[])
{
FITS_FILE* ofp;
int i, j, bpp, bpsl, width, height;
@@ -890,7 +890,7 @@ int writeFITS(char *filename, char errms
ofp = fits_open (filename, "w");
if (!ofp)
{
- sprintf(errmsg, "Error: cannot open file for writing.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: cannot open file for writing.");
return (-1);
}
@@ -903,12 +903,12 @@ int writeFITS(char *filename, char errms
hdu = create_fits_header (ofp, width, height, bpp);
if (hdu == NULL)
{
- sprintf(errmsg, "Error: creating FITS header failed.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: creating FITS header failed.");
return (-1);
}
if (fits_write_header (ofp, hdu) < 0)
{
- sprintf(errmsg, "Error: writing to FITS header failed.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: writing to FITS header failed.");
return (-1);
}
@@ -932,7 +932,7 @@ int writeFITS(char *filename, char errms
if (ferror (ofp->fp))
{
- sprintf(errmsg, "Error: write error occured");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: write error occured");
return (-1);
}
@@ -951,7 +951,7 @@ int writeFITS(char *filename, char errms
}
-void uploadFile(char * filename)
+void uploadFile(const char* filename)
{
FILE * fitsFile;
char frameSize[FRAME_ILEN];
@@ -962,7 +962,7 @@ void uploadFile(char * filename)
if ( -1 == stat (filename, &stat_p))
{
- IDLog(" Error occoured attempting to stat %s\n", filename);
+ IDLog(" Error occoured attempting to stat file.\n");
return;
}
@@ -1185,7 +1185,7 @@ int manageDefaults(char errmsg[])
IDLog("Setting default exposure time of %d ms.\n", exposeTimeMS);
if ( (err = FLISetExposureTime(fli_dev, exposeTimeMS) ))
{
- sprintf(errmsg, "FLISetExposureTime() failed. %s.\n", strerror((int)-err));
+ snprintf(errmsg, ERRMSG_SIZE, "FLISetExposureTime() failed. %s.\n", strerror((int)-err));
IDLog(errmsg, NULL);
return -1;
}
@@ -1193,7 +1193,7 @@ int manageDefaults(char errmsg[])
/* Default frame type is NORMAL */
if ( (err = FLISetFrameType(fli_dev, FLI_FRAME_TYPE_NORMAL) ))
{
- sprintf(errmsg, "FLISetFrameType() failed. %s.\n", strerror((int)-err));
+ snprintf(errmsg, ERRMSG_SIZE, "FLISetFrameType() failed. %s.\n", strerror((int)-err));
IDLog(errmsg, NULL);
return -1;
}
@@ -1201,7 +1201,7 @@ int manageDefaults(char errmsg[])
/* X horizontal binning */
if ( (err = FLISetHBin(fli_dev, BinningN[0].value) ))
{
- sprintf(errmsg, "FLISetBin() failed. %s.\n", strerror((int)-err));
+ snprintf(errmsg, ERRMSG_SIZE, "FLISetBin() failed. %s.\n", strerror((int)-err));
IDLog(errmsg, NULL);
return -1;
}
@@ -1209,7 +1209,7 @@ int manageDefaults(char errmsg[])
/* Y vertical binning */
if ( (err = FLISetVBin(fli_dev, BinningN[1].value) ))
{
- sprintf(errmsg, "FLISetVBin() failed. %s.\n", strerror((int)-err));
+ snprintf(errmsg, ERRMSG_SIZE, "FLISetVBin() failed. %s.\n", strerror((int)-err));
IDLog(errmsg, NULL);
return -1;
}
@@ -1293,7 +1293,7 @@ int checkPowerT(ITextVectorProperty *tp)
void connectCCD()
{
long err;
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
IDLog ("In ConnectCCD\n");
@@ -1332,7 +1332,7 @@ void connectCCD()
if (manageDefaults(errmsg))
{
IDMessage(mydev, errmsg, NULL);
- IDLog(errmsg);
+ IDLog("%s", errmsg);
return;
}
@@ -1495,7 +1495,7 @@ FITS_HDU_LIST * create_fits_header (FITS
fits_add_card (hdulist, temp_s);
fits_add_card (hdulist, expose_s);
fits_add_card (hdulist, pixel_s);
- fits_add_card (hdulist, "INSTRUME= 'Finger Lakes Instruments'");
+ fits_add_card (hdulist, ( char* ) "INSTRUME= 'Finger Lakes Instruments'");
fits_add_card (hdulist, obsDate);
return (hdulist);
@@ -1632,7 +1632,7 @@ int findPort()
/* bind to given port for any IP address */
memset (&serv_socket, 0, sizeof(serv_socket));
serv_socket.sin_family = AF_INET;
- serv_socket.sin_addr.s_addr = htonl (INADDR_ANY);
+ serv_socket.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
for (i=0; i < 100; i++)
{
@@ -1675,7 +1675,7 @@ void waitForData(int rp, int wp)
/* bind to given port for any IP address */
memset (&serv_socket, 0, sizeof(serv_socket));
serv_socket.sin_family = AF_INET;
- serv_socket.sin_addr.s_addr = htonl (INADDR_ANY);
+ serv_socket.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
serv_socket.sin_port = htons ((unsigned short)DataPort);
if (setsockopt(sfd,SOL_SOCKET,SO_REUSEADDR,&reuse,sizeof(reuse)) < 0){

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-kstars_kstars_indi_indicom_h,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/indicom.h.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/indicom.h Sun Feb 27 03:48:43 2005
@@ -38,6 +38,7 @@
#define J2000 2451545.0
#define TRACKING_THRESHOLD 0.05 /* 3' for tracking */
+#define ERRMSG_SIZE 1024
extern const char * Direction[];
extern const char * SolarSystem[];

View File

@ -0,0 +1,141 @@
$OpenBSD: patch-kstars_kstars_indi_indidevapi_h,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/indidevapi.h.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/indidevapi.h Sun Feb 27 03:48:43 2005
@@ -66,25 +66,41 @@ extern "C" {
\param t pointer to the vector text property to be defined.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDDefText (const ITextVectorProperty *t, const char *msg, ...);
+extern void IDDefText (const ITextVectorProperty *t, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to create a number number property.
\param n pointer to the vector number property to be defined.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDDefNumber (const INumberVectorProperty *n, const char *msg, ...);
+extern void IDDefNumber (const INumberVectorProperty *n, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to create a switch vector property.
\param s pointer to the vector switch property to be defined.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDDefSwitch (const ISwitchVectorProperty *s, const char *msg, ...);
+extern void IDDefSwitch (const ISwitchVectorProperty *s, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to create a light vector property.
\param l pointer to the vector light property to be defined.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDDefLight (const ILightVectorProperty *l, const char *msg, ...);
+extern void IDDefLight (const ILightVectorProperty *l, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/*@}*/
@@ -97,25 +113,41 @@ extern void IDDefLight (const ILightVect
\param t pointer to the vector text property.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDSetText (const ITextVectorProperty *t, const char *msg, ...);
+extern void IDSetText (const ITextVectorProperty *t, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to update an existing number vector property.
\param n pointer to the vector number property.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDSetNumber (const INumberVectorProperty *n, const char *msg, ...);
+extern void IDSetNumber (const INumberVectorProperty *n, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to update an existing switch vector property.
\param s pointer to the vector switch property.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDSetSwitch (const ISwitchVectorProperty *s, const char *msg, ...);
+extern void IDSetSwitch (const ISwitchVectorProperty *s, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Tell client to update an existing light vector property.
\param l pointer to the vector light property.
\param msg message in printf style to send to the client. May be NULL.
*/
-extern void IDSetLight (const ILightVectorProperty *l, const char *msg, ...);
+extern void IDSetLight (const ILightVectorProperty *l, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/*@}*/
@@ -127,7 +159,11 @@ extern void IDSetLight (const ILightVect
\param dev device name
\param msg message in printf style to send to the client.
*/
-extern void IDMessage (const char *dev, const char *msg, ...);
+extern void IDMessage (const char *dev, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 2, 3 ) ) )
+#endif
+;
/** \brief Function Drivers call to inform Clients a Property is no longer available, or the entire device is gone if name is NULL.
@@ -135,7 +171,11 @@ extern void IDMessage (const char *dev,
\param name property name to be deleted.
\param msg message in printf style to send to the client.
*/
-extern void IDDelete (const char *dev, const char *name, const char *msg, ...);
+extern void IDDelete (const char *dev, const char *name, const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 3, 4 ) ) )
+#endif
+;
/** \brief Function Drivers call to log a message locally.
@@ -143,7 +183,11 @@ extern void IDDelete (const char *dev, c
\param msg message in printf style to send to the client.
*/
-extern void IDLog (const char *msg, ...);
+extern void IDLog (const char *msg, ...)
+#ifdef __GNUC__
+ __attribute__ ( ( format( printf, 1, 2 ) ) )
+#endif
+;
/**
* \defgroup deventFunctions Functions Drivers call to register with the INDI event utilities.
@@ -348,5 +392,5 @@ extern void ISNewSwitch (const char *dev
#endif
/* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: patch-kstars_kstars_indi_indidevapi_h,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $
+ * @(#) $RCSfile: patch-kstars_kstars_indi_indidevapi_h,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $
*/

View File

@ -0,0 +1,143 @@
$OpenBSD: patch-kstars_kstars_indi_indidrivermain_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/indidrivermain.c.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/indidrivermain.c Sun Feb 27 03:48:43 2005
@@ -45,8 +45,8 @@
static void usage(void);
static void clientMsgCB(int fd, void *arg);
-static int dispatch (XMLEle *root, char msg[]);
-static int crackDN (XMLEle *root, char **dev, char **name, char msg[]);
+static int dispatch (XMLEle *root, char errmsg[]);
+static int crackDN (XMLEle *root, char **dev, char **name, char errmsg[]);
const char *pstateStr(IPState s);
const char *sstateStr(ISState s);
const char *ruleStr(ISRule r);
@@ -60,6 +60,9 @@ static LilXML *clixml; /* XML parser c
int
main (int ac, char *av[])
{
+ setgid( getgid() );
+ setuid( getuid() );
+
/* save handy pointer to our base name */
for (me = av[0]; av[0][0]; av[0]++)
if (av[0][0] == '/')
@@ -177,6 +180,7 @@ IDDefNumber (const INumberVectorProperty
/* tell client to create a new switch vector property */
void
IDDefSwitch (const ISwitchVectorProperty *s, const char *fmt, ...)
+
{
int i;
@@ -637,12 +641,12 @@ usage(void)
static void
clientMsgCB (int fd, void *arg)
{
- char buf[1024], msg[1024], *bp;
+ char buf[1024], errmsg[ERRMSG_SIZE], *bp;
int nr;
arg=arg;
/* one read */
- nr = read (fd, buf, sizeof(buf));
+ nr = read (fd, buf, sizeof(buf)-1);
if (nr < 0) {
fprintf (stderr, "%s: %s\n", me, strerror(errno));
exit(1);
@@ -651,26 +655,27 @@ clientMsgCB (int fd, void *arg)
fprintf (stderr, "%s: EOF\n", me);
exit(1);
}
+ buf[ sizeof( buf )-1 ] = '\0';
/* crack and dispatch when complete */
for (bp = buf; nr-- > 0; bp++) {
- XMLEle *root = readXMLEle (clixml, *bp, msg);
+ XMLEle *root = readXMLEle (clixml, *bp, errmsg);
if (root) {
- if (dispatch (root, msg) < 0)
- fprintf (stderr, "%s dispatch error: %s\n", me, msg);
+ if (dispatch (root, errmsg) < 0)
+ fprintf (stderr, "%s dispatch error: %s\n", me, errmsg);
delXMLEle (root);
- } else if (msg[0])
- fprintf (stderr, "%s XML error: %s\n", me, msg);
+ } else if (errmsg[0])
+ fprintf (stderr, "%s XML error: %s\n", me, errmsg);
}
}
/* crack the given INDI XML element and call driver's IS* entry points as they
* are recognized.
- * return 0 if ok else -1 with reason in msg[].
+ * return 0 if ok else -1 with reason in errmsg[].
* N.B. exit if getProperties does not proclaim a compatible version.
*/
static int
-dispatch (XMLEle *root, char msg[])
+dispatch (XMLEle *root, char errmsg[])
{
XMLEle *ep;
int n;
@@ -687,7 +692,7 @@ dispatch (XMLEle *root, char msg[])
char *dev, *name;
/* pull out device and name */
- if (crackDN (root, &dev, &name, msg) < 0)
+ if (crackDN (root, &dev, &name, errmsg) < 0)
return (-1);
/* pull out each name/value pair */
@@ -729,7 +734,7 @@ printf ("%s\n", valuXMLAtt(na));
/*XMLEle *ep;*/
/* pull out device and name */
- if (crackDN (root, &dev, &name, msg) < 0)
+ if (crackDN (root, &dev, &name, errmsg) < 0)
return (-1);
/* pull out each name/state pair */
@@ -775,7 +780,7 @@ printf ("%s\n", valuXMLAtt(na));
char *dev, *name;
/* pull out device and name */
- if (crackDN (root, &dev, &name, msg) < 0)
+ if (crackDN (root, &dev, &name, errmsg) < 0)
return (-1);
/* pull out each name/text pair */
@@ -828,28 +833,28 @@ printf ("%s\n", valuXMLAtt(na));
return (0);
}
- sprintf (msg, "Unknown command: %s", tagXMLEle(root));
+ snprintf (errmsg, ERRMSG_SIZE, "Unknown command: %s", tagXMLEle(root));
return(1);
}
/* pull out device and name attributes from root.
- * return 0 if ok else -1 with reason in msg[].
+ * return 0 if ok else -1 with reason in errmsg[].
*/
static int
-crackDN (XMLEle *root, char **dev, char **name, char msg[])
+crackDN (XMLEle *root, char **dev, char **name, char errmsg[])
{
XMLAtt *ap;
ap = findXMLAtt (root, "device");
if (!ap) {
- sprintf (msg, "%s requires 'device' attribute", tagXMLEle(root));
+ snprintf (errmsg, ERRMSG_SIZE, "%s requires 'device' attribute", tagXMLEle(root));
return (-1);
}
*dev = valuXMLAtt(ap);
ap = findXMLAtt (root, "name");
if (!ap) {
- sprintf (msg, "%s requires 'name' attribute", tagXMLEle(root));
+ snprintf (errmsg, ERRMSG_SIZE, "%s requires 'name' attribute", tagXMLEle(root));
return (-1);
}
*name = valuXMLAtt(ap);

View File

@ -0,0 +1,56 @@
$OpenBSD: patch-kstars_kstars_indi_indiserver_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/indiserver.c.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/indiserver.c Sun Feb 27 03:48:43 2005
@@ -288,10 +288,10 @@ indiListen ()
exit(1);
}
- /* bind to given port for any IP address */
+ /* bind to given port for local IP address */
memset (&serv_socket, 0, sizeof(serv_socket));
serv_socket.sin_family = AF_INET;
- serv_socket.sin_addr.s_addr = htonl (INADDR_ANY);
+ serv_socket.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
serv_socket.sin_port = htons ((unsigned short)port);
if (setsockopt(sfd,SOL_SOCKET,SO_REUSEADDR,&reuse,sizeof(reuse)) < 0){
fprintf (stderr, "%s: setsockopt: %s", me, strerror(errno));
@@ -423,7 +423,7 @@ clientMsg (int cli)
int i, nr;
/* read client */
- nr = read (cp->s, buf, sizeof(buf));
+ nr = read (cp->s, buf, sizeof(buf)-1);
if (nr < 0) {
fprintf (stderr, "Client %d: %s\n", cp->s, strerror(errno));
closeClient (cli);
@@ -435,6 +435,7 @@ clientMsg (int cli)
closeClient (cli);
return;
}
+ buf[ sizeof( buf )-1 ] = '\0';
if (verbose > 1)
fprintf (stderr, "Client %d: rcv from:\n%.*s", cp->s, nr, buf);
@@ -464,7 +465,7 @@ driverMsg (int i)
int nr;
/* read driver */
- nr = read (dp->rfd, buf, sizeof(buf));
+ nr = read (dp->rfd, buf, sizeof(buf)-1);
if (nr < 0) {
fprintf (stderr, "Driver %s: %s\n", dp->name, strerror(errno));
restartDvr (i);
@@ -475,6 +476,7 @@ driverMsg (int i)
restartDvr (i);
return;
}
+ buf[ sizeof( buf )-1 ]='\0';
if (verbose > 1)
fprintf (stderr, "Driver %s: rcv from:\n%.*s", dp->name, nr, buf);
@@ -591,4 +593,4 @@ newClSocket ()
}
/* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: patch-kstars_kstars_indi_indiserver_c,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: patch-kstars_kstars_indi_indiserver_c,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $"};

View File

@ -0,0 +1,116 @@
$OpenBSD: patch-kstars_kstars_indi_lilxml_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lilxml.c.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/lilxml.c Sun Feb 27 03:48:43 2005
@@ -32,6 +32,7 @@
#include <ctype.h>
#include "lilxml.h"
+#include "indicom.h"
static int oneXMLchar (LilXML *lp, int c, char errmsg[]);
static void initParser(LilXML *lp);
@@ -156,7 +157,7 @@ readXMLEle (LilXML *lp, int newc, char e
/* EOF? */
if (newc == 0) {
- sprintf (errmsg, "Line %d: XML EOF", lp->ln);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: XML EOF", lp->ln);
initParser(lp);
return (NULL);
}
@@ -344,7 +345,7 @@ nXMLAtt (XMLEle *ep)
/* search ep for an attribute with the given name and return its value.
* return "" if not found.
*/
-char *
+const char *
findXMLAttValu (XMLEle *ep, char *name)
{
XMLAtt *a = findXMLAtt (ep, name);
@@ -428,7 +429,7 @@ oneXMLchar (LilXML *lp, int c, char errm
growString (&lp->ce->tag, c);
lp->cs = INTAG;
} else if (!isspace(c)) {
- sprintf (errmsg, "Line %d: Bogus tag char %c", lp->ln, c);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus tag char %c", lp->ln, c);
return (-1);
}
break;
@@ -454,7 +455,7 @@ oneXMLchar (LilXML *lp, int c, char errm
growString (&lp->ce->at[lp->ce->nat-1]->name, c);
lp->cs = INATTRN;
} else if (!isspace(c)) {
- sprintf (errmsg, "Line %d: Bogus leading attr name char: %c",
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus leading attr name char: %c",
lp->ln, c);
return (-1);
}
@@ -467,7 +468,7 @@ oneXMLchar (LilXML *lp, int c, char errm
popXMLEle(lp);
lp->cs = LOOK4CON;
} else {
- sprintf (errmsg, "Line %d: Bogus char %c before >", lp->ln, c);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus char %c before >", lp->ln, c);
return (-1);
}
break;
@@ -478,7 +479,7 @@ oneXMLchar (LilXML *lp, int c, char errm
else if (isspace(c) || c == '=')
lp->cs = LOOK4ATTRV;
else {
- sprintf (errmsg, "Line %d: Bogus attr name char: %c", lp->ln,c);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus attr name char: %c", lp->ln,c);
return (-1);
}
break;
@@ -489,7 +490,7 @@ oneXMLchar (LilXML *lp, int c, char errm
growString (&lp->ce->at[lp->ce->nat-1]->valu, '\0');
lp->cs = INATTRV;
} else if (!(isspace(c) || c == '=')) {
- sprintf (errmsg, "Line %d: No value for attribute %s", lp->ln,
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: No value for attribute %.100s", lp->ln,
lp->ce->at[lp->ce->nat-1]->name);
return (-1);
}
@@ -547,7 +548,7 @@ oneXMLchar (LilXML *lp, int c, char errm
growString (&lp->endtag, c);
lp->cs = INCLOSETAG;
} else if (!isspace(c)) {
- sprintf (errmsg, "Line %d: Bogus preend tag char %c", lp->ln,c);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus preend tag char %c", lp->ln,c);
return (-1);
}
break;
@@ -557,7 +558,7 @@ oneXMLchar (LilXML *lp, int c, char errm
growString (&lp->endtag, c);
else if (c == '>') {
if (strcmp (lp->ce->tag, lp->endtag)) {
- sprintf (errmsg,"Line %d: closing tag %s does not match %s",
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: closing tag %.64s does not match %.64s",
lp->ln, lp->endtag, lp->ce->tag);
return (-1);
} else if (lp->ce->pe) {
@@ -566,7 +567,7 @@ oneXMLchar (LilXML *lp, int c, char errm
} else
return (1); /* yes! */
} else if (!isspace(c)) {
- sprintf (errmsg, "Line %d: Bogus end tag char %c", lp->ln, c);
+ snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus end tag char %c", lp->ln, c);
return (-1);
}
break;
@@ -723,7 +724,7 @@ int
main (int ac, char *av[])
{
LilXML *lp = newLilXML();
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
XMLEle *root;
root = readXMLFile (stdin, lp, errmsg);
@@ -742,4 +743,4 @@ main (int ac, char *av[])
#endif
/* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: patch-kstars_kstars_indi_lilxml_c,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: patch-kstars_kstars_indi_lilxml_c,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $"};

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-kstars_kstars_indi_lilxml_h,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lilxml.h.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/lilxml.h Sun Feb 27 03:48:43 2005
@@ -189,7 +189,7 @@ extern int nXMLAtt (XMLEle *ep);
\param name the name of the XML attribute to retrieve its value.
\return the value string of an XML element on success. NULL on failure.
*/
-extern char *findXMLAttValu (XMLEle *ep, char *name);
+extern const char *findXMLAttValu (XMLEle *ep, char *name);
/** \brief Handy wrapper to read one xml file.
\param fp pointer to FILE to read.
@@ -242,7 +242,7 @@ extern void prXMLEle (FILE *fp, XMLEle *
*/
/* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: patch-kstars_kstars_indi_lilxml_h,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $
+ * @(#) $RCSfile: patch-kstars_kstars_indi_lilxml_h,v $ $Date: 2005/02/27 09:09:14 $ $Revision: 1.1 $ $Name: $
*/
#endif /* LILXML_H */

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-kstars_kstars_indi_lx200_16_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lx200_16.cpp.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/lx200_16.cpp Sun Feb 27 03:48:43 2005
@@ -224,8 +224,7 @@ void LX200_16::ISNewSwitch (const char *
}
FanStatusSw.s = IPS_OK;
- strcpy(msg, index == 0 ? "Fan is ON" : "Fan is OFF");
- IDSetSwitch (&FanStatusSw, msg);
+ IDSetSwitch (&FanStatusSw, index == 0 ? "Fan is ON" : "Fan is OFF");
return;
}
@@ -240,7 +239,7 @@ void LX200_16::ISNewSwitch (const char *
index == 0 ? seekHomeAndSave() : seekHomeAndSet();
HomeSearchSw.s = IPS_BUSY;
- IDSetSwitch (&HomeSearchSw, msg);
+ IDSetSwitch (&HomeSearchSw, index == 0 ? "Seek Home and Save" : "Seek Home and Set");
return;
}
@@ -255,8 +254,7 @@ void LX200_16::ISNewSwitch (const char *
index == 0 ? seekHomeAndSave() : seekHomeAndSet();
FieldDeRotatorSw.s = IPS_OK;
- strcpy(msg, index == 0 ? "Field deRotator is ON" : "Field deRotator is OFF");
- IDSetSwitch (&FieldDeRotatorSw, msg);
+ IDSetSwitch (&FieldDeRotatorSw, index == 0 ? "Field deRotator is ON" : "Field deRotator is OFF");
return;
}

View File

@ -0,0 +1,183 @@
$OpenBSD: patch-kstars_kstars_indi_lx200driver_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lx200driver.c.orig Fri Jun 25 05:10:04 2004
+++ kstars/kstars/indi/lx200driver.c Sun Feb 27 03:48:43 2005
@@ -584,7 +584,7 @@ int setCommandInt(int data, const char *
char tempString[16];
- sprintf(tempString, "%s%d#", cmd, data);
+ snprintf(tempString, sizeof( tempString ), "%s%d#", cmd, data);
if (portWrite(tempString) < 0)
return -1;
@@ -596,7 +596,7 @@ int setMinElevationLimit(int min)
{
char tempString[16];
- sprintf(tempString, "#:Sh%02d#", min);
+ snprintf(tempString, sizeof( tempString ), "#:Sh%02d#", min);
return (setStandardProcedure(tempString));
}
@@ -605,7 +605,7 @@ int setMaxElevationLimit(int max)
{
char tempString[16];
- sprintf(tempString, "#:So%02d*#", max);
+ snprintf(tempString, sizeof( tempString ), "#:So%02d*#", max);
return (setStandardProcedure(tempString));
@@ -619,7 +619,7 @@ int setMaxSlewRate(int slewRate)
if (slewRate < 2 || slewRate > 8)
return -1;
- sprintf(tempString, "#:Sw%d#", slewRate);
+ snprintf(tempString, sizeof( tempString ), "#:Sw%d#", slewRate);
return (setStandardProcedure(tempString));
@@ -634,7 +634,7 @@ int setObjectRA(double ra)
getSexComponents(ra, &h, &m, &s);
- sprintf(tempString, "#:Sr %02d:%02d:%02d#", h, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sr %02d:%02d:%02d#", h, m, s);
IDLog("Set Object RA String %s\n", tempString);
return (setStandardProcedure(tempString));
}
@@ -649,9 +649,9 @@ int setObjectDEC(double dec)
/* case with negative zero */
if (!d && dec < 0)
- sprintf(tempString, "#:Sd -%02d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sd -%02d:%02d:%02d#", d, m, s);
else
- sprintf(tempString, "#:Sd %+03d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sd %+03d:%02d:%02d#", d, m, s);
IDLog("Set Object DEC String %s\n", tempString);
@@ -663,7 +663,7 @@ int setCommandXYZ(int x, int y, int z, c
{
char tempString[16];
- sprintf(tempString, "%s %02d:%02d:%02d#", cmd, x, y, z);
+ snprintf(tempString, sizeof( tempString ), "%s %02d:%02d:%02d#", cmd, x, y, z);
return (setStandardProcedure(tempString));
}
@@ -698,7 +698,7 @@ int setCalenderDate(int dd, int mm, int
char boolRet[2];
yy = yy % 100;
- sprintf(tempString, "#:SC %02d/%02d/%02d#", mm, dd, yy);
+ snprintf(tempString, sizeof( tempString ), "#:SC %02d/%02d/%02d#", mm, dd, yy);
if (portWrite(tempString) < 0)
return -1;
@@ -725,7 +725,7 @@ int setUTCOffset(double hours)
char tempString[16];
/*TODO add fractions*/
- sprintf(tempString, "#:SG %+03d#", (int) hours);
+ snprintf(tempString, sizeof( tempString ), "#:SG %+03d#", (int) hours);
fprintf(stderr, "UTC string is %s\n", tempString);
@@ -740,7 +740,7 @@ int setSiteLongitude(double Long)
getSexComponents(Long, &d, &m, &s);
- sprintf(tempString, "#:Sg%03d:%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sg%03d:%02d#", d, m);
return (setStandardProcedure(tempString));
}
@@ -752,7 +752,7 @@ int setSiteLatitude(double Lat)
getSexComponents(Lat, &d, &m, &s);
- sprintf(tempString, "#:St%+03d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:St%+03d:%02d:%02d#", d, m, s);
return (setStandardProcedure(tempString));
}
@@ -764,7 +764,7 @@ int setObjAz(double az)
getSexComponents(az, &d, &m, &s);
- sprintf(tempString, "#:Sz%03d:%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sz%03d:%02d#", d, m);
return (setStandardProcedure(tempString));
@@ -777,7 +777,7 @@ int setObjAlt(double alt)
getSexComponents(alt, &d, &m, &s);
- sprintf(tempString, "#:Sa%+02d*%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sa%+02d*%02d#", d, m);
return (setStandardProcedure(tempString));
}
@@ -791,16 +791,16 @@ int setSiteName(char * siteName, int sit
switch (siteNum)
{
case 1:
- sprintf(tempString, "#:SM %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SM %s#", siteName);
break;
case 2:
- sprintf(tempString, "#:SN %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SN %s#", siteName);
break;
case 3:
- sprintf(tempString, "#:SO %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SO %s#", siteName);
break;
case 4:
- sprintf(tempString, "#:SP %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SP %s#", siteName);
break;
default:
return -1;
@@ -883,7 +883,7 @@ int setTrackFreq(double trackF)
{
char tempString[16];
- sprintf(tempString, "#:ST %04.1f#", trackF);
+ snprintf(tempString, sizeof( tempString ), "#:ST %04.1f#", trackF);
return (setStandardProcedure(tempString));
@@ -1044,13 +1044,13 @@ int selectCatalogObject(int catalog, int
switch (catalog)
{
case LX200_STAR_C:
- sprintf(tempString, "#:LS%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LS%d#", NNNN);
break;
case LX200_DEEPSKY_C:
- sprintf(tempString, "#:LC%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LC%d#", NNNN);
break;
case LX200_MESSIER_C:
- sprintf(tempString, "#:LM%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LM%d#", NNNN);
break;
default:
return -1;
@@ -1068,10 +1068,10 @@ int selectSubCatalog(int catalog, int su
switch (catalog)
{
case LX200_STAR_C:
- sprintf(tempString, "#:LsD%d#", subCatalog);
+ snprintf(tempString, sizeof( tempString ), "#:LsD%d#", subCatalog);
break;
case LX200_DEEPSKY_C:
- sprintf(tempString, "#:LoD%d#", subCatalog);
+ snprintf(tempString, sizeof( tempString ), "#:LoD%d#", subCatalog);
break;
case LX200_MESSIER_C:
return 1;

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-kstars_kstars_indi_lx200generic_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lx200generic.cpp.orig Sun Oct 3 03:13:39 2004
+++ kstars/kstars/indi/lx200generic.cpp Sun Feb 27 03:48:43 2005
@@ -620,13 +620,13 @@ void LX200Generic::ISNewNumber (const ch
setSiteLatitude(newLat);
geoNum.np[0].value = newLat;
geoNum.np[1].value = newLong;
- sprintf (msg, "Site location updated to Lat %s - Long %s", l, L);
+ snprintf (msg, sizeof(msg), "Site location updated to Lat %.32s - Long %.32s", l, L);
} else
{
geoNum.s = IPS_IDLE;
- sprintf (msg, "Lat or Long missing or invalid");
+ strcpy(msg, "Lat or Long missing or invalid");
}
- IDSetNumber (&geoNum, msg);
+ IDSetNumber (&geoNum, "%s", msg);
return;
}

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-kstars_kstars_indi_lx200gps_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/lx200gps.cpp.orig Sun Oct 3 03:13:39 2004
+++ kstars/kstars/indi/lx200gps.cpp Sun Feb 27 03:48:43 2005
@@ -133,8 +133,7 @@ void LX200GPS::ISNewNumber (const char *
index = getOnSwitch(&GPSPowerSw);
index == 0 ? turnGPSOn() : turnGPSOff();
GPSPowerSw.s = IPS_OK;
- strcpy(msg, index == 0 ? "GPS System is ON" : "GPS System is OFF");
- IDSetSwitch (&GPSPowerSw, msg);
+ IDSetSwitch (&GPSPowerSw, index == 0 ? "GPS System is ON" : "GPS System is OFF" );
return;
}
@@ -164,7 +163,7 @@ void LX200GPS::ISNewNumber (const char *
}
GPSStatusSw.s = IPS_OK;
- IDSetSwitch (&GPSStatusSw, msg);
+ IDSetSwitch (&GPSStatusSw, "%s", msg);
return;
}
@@ -207,7 +206,7 @@ void LX200GPS::ISNewNumber (const char *
}
AltDecPecSw.s = IPS_OK;
- IDSetSwitch(&AltDecPecSw, msg);
+ IDSetSwitch(&AltDecPecSw, "%s", msg);
return;
}
@@ -233,7 +232,7 @@ void LX200GPS::ISNewNumber (const char *
}
AzRaPecSw.s = IPS_OK;
- IDSetSwitch(&AzRaPecSw, msg);
+ IDSetSwitch(&AzRaPecSw, "%s", msg);
return;
}

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-kstars_kstars_indi_mount_simulation_c,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/mount_simulation.c.orig Sat May 22 16:28:29 2004
+++ kstars/kstars/indi/mount_simulation.c Sun Feb 27 03:48:43 2005
@@ -140,10 +140,10 @@ char *names[], int n)
targetDEC = newdec;
fs_sexa (r, targetRA, 2, 3600);
fs_sexa (d, targetDEC, 3, 3600);
- sprintf (msg, "Moving to RA Dec %s %s", r, d);
+ snprintf (msg, sizeof(msg), "Moving to RA Dec %.32s %.32s", r, d);
} else {
eqNum.s = IPS_IDLE;
- sprintf (msg, "RA or Dec absent or bogus");
+ snprintf (msg, sizeof(msg), "RA or Dec absent or bogus");
}
sendeq (msg);
return;

View File

@ -0,0 +1,92 @@
$OpenBSD: patch-kstars_kstars_indi_v4ldriver_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/v4ldriver.cpp.orig Sun Oct 3 03:13:39 2004
+++ kstars/kstars/indi/v4ldriver.cpp Sun Feb 27 03:48:43 2005
@@ -51,8 +51,8 @@ void waitForData(int rp, int wp);
void updateDataChannel(void *p);
void updateStream(void * p);
void getBasicData(void);
-void uploadFile(char * filename);
-int writeFITS(char *filename, char errmsg[]);
+void uploadFile(const char * filename);
+int writeFITS(const char *filename, char errmsg[]);
int grabImage(void);
int checkPowerN(INumberVectorProperty *np);
int checkPowerS(ISwitchVectorProperty *sp);
@@ -461,14 +461,14 @@ void ISNewNumber (const char *dev, const
int grabImage()
{
int err, fd;
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
char filename[] = "/tmp/fitsXXXXXX";
if ((fd = mkstemp(filename)) < 0)
{
- IDMessage(mydev, "Error making temporary filename.", NULL);
- IDLog("Error making temporary filename.\n", NULL);
+ IDMessage(mydev, "Error making temporary filename.");
+ IDLog("Error making temporary filename.\n");
return -1;
}
close(fd);
@@ -483,7 +483,7 @@ int grabImage()
return 0;
}
-int writeFITS(char * filename, char errmsg[])
+int writeFITS(const char * filename, char errmsg[])
{
FITS_FILE* ofp;
int i, bpp, bpsl, width, height;
@@ -495,7 +495,7 @@ int writeFITS(char * filename, char errm
ofp = fits_open (filename, "w");
if (!ofp)
{
- sprintf(errmsg, "Error: cannot open file for writing.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: cannot open file for writing.");
return (-1);
}
@@ -508,12 +508,12 @@ int writeFITS(char * filename, char errm
hdu = create_fits_header (ofp, width, height, bpp);
if (hdu == NULL)
{
- sprintf(errmsg, "Error: creating FITS header failed.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: creating FITS header failed.");
return (-1);
}
if (fits_write_header (ofp, hdu) < 0)
{
- sprintf(errmsg, "Error: writing to FITS header failed.");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: writing to FITS header failed.");
return (-1);
}
@@ -532,7 +532,7 @@ int writeFITS(char * filename, char errm
if (ferror (ofp->fp))
{
- sprintf(errmsg, "Error: write error occured");
+ snprintf(errmsg, ERRMSG_SIZE, "Error: write error occured");
return (-1);
}
@@ -730,7 +730,7 @@ FITS_HDU_LIST * create_fits_header (FITS
hdulist->used.bscale = 1;
hdulist->bscale = 1.0;
- sprintf(expose_s, "EXPOSURE= %d / milliseconds", V4LFrame->expose);
+ snprintf(expose_s, sizeof(expose_s), "EXPOSURE= %d / milliseconds", V4LFrame->expose);
fits_add_card (hdulist, expose_s);
fits_add_card (hdulist, instrumentName);
@@ -813,7 +813,7 @@ void updateStream(void *p)
}
-void uploadFile(char * filename)
+void uploadFile(const char * filename)
{
FILE * fitsFile;
char frameSize[FRAME_ILEN];

View File

@ -0,0 +1,260 @@
$OpenBSD: patch-kstars_kstars_indi_v4lphilips_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indi/v4lphilips.cpp.orig Sun Oct 3 03:13:39 2004
+++ kstars/kstars/indi/v4lphilips.cpp Sun Feb 27 03:48:43 2005
@@ -52,8 +52,8 @@ void waitForData(int rp, int wp);
void updateDataChannel(void *p);
void updateStream(void * p);
void getBasicData(void);
-void uploadFile(char * filename);
-int writeFITS(char *filename, char errmsg[]);
+void uploadFile(const char* filename);
+int writeFITS(const char* filename, char errmsg[]);
int grabImage(void);
int checkPowerN(INumberVectorProperty *np);
int checkPowerS(ISwitchVectorProperty *sp);
@@ -286,7 +286,7 @@ void ISGetProperties (const char *dev)
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
{
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
int index=0;
/* ignore if not ours */
@@ -364,7 +364,7 @@ void ISNewSwitch (const char *dev, const
{
AntiFlickerS[0].s = ISS_OFF;
AntiFlickerS[1].s = ISS_ON;
- IDSetSwitch(&AntiFlickerSP, errmsg);
+ IDSetSwitch(&AntiFlickerSP, "%s", errmsg);
return;
}
@@ -377,7 +377,7 @@ void ISNewSwitch (const char *dev, const
{
AntiFlickerS[0].s = ISS_ON;
AntiFlickerS[1].s = ISS_OFF;
- IDSetSwitch(&AntiFlickerSP, errmsg);
+ IDSetSwitch(&AntiFlickerSP, "%s", errmsg);
return;
}
@@ -403,7 +403,7 @@ void ISNewSwitch (const char *dev, const
{
BackLightS[0].s = ISS_OFF;
BackLightS[1].s = ISS_ON;
- IDSetSwitch(&BackLightSP, errmsg);
+ IDSetSwitch(&BackLightSP, "%s", errmsg);
return;
}
@@ -416,7 +416,7 @@ void ISNewSwitch (const char *dev, const
{
BackLightS[0].s = ISS_ON;
BackLightS[1].s = ISS_OFF;
- IDSetSwitch(&BackLightSP, errmsg);
+ IDSetSwitch(&BackLightSP, "%s", errmsg);
return;
}
@@ -447,7 +447,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&NoiseReductionSP);
NoiseReductionS[0].s = ISS_ON;
- IDSetSwitch(&NoiseReductionSP, errmsg);
+ IDSetSwitch(&NoiseReductionSP, "%s", errmsg);
return;
}
@@ -482,7 +482,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&WhiteBalanceModeSP),
WhiteBalanceModeS[0].s = ISS_ON;
- IDSetSwitch(&WhiteBalanceModeSP, errmsg);
+ IDSetSwitch(&WhiteBalanceModeSP, "%s", errmsg);
return;
}
break;
@@ -493,7 +493,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&WhiteBalanceModeSP),
WhiteBalanceModeS[0].s = ISS_ON;
- IDSetSwitch(&WhiteBalanceModeSP, errmsg);
+ IDSetSwitch(&WhiteBalanceModeSP, "%s", errmsg);
return;
}
break;
@@ -504,7 +504,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&WhiteBalanceModeSP),
WhiteBalanceModeS[0].s = ISS_ON;
- IDSetSwitch(&WhiteBalanceModeSP, errmsg);
+ IDSetSwitch(&WhiteBalanceModeSP, "%s", errmsg);
return;
}
break;
@@ -515,7 +515,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&WhiteBalanceModeSP),
WhiteBalanceModeS[0].s = ISS_ON;
- IDSetSwitch(&WhiteBalanceModeSP, errmsg);
+ IDSetSwitch(&WhiteBalanceModeSP, "%s", errmsg);
return;
}
break;
@@ -526,7 +526,7 @@ void ISNewSwitch (const char *dev, const
{
IUResetSwitches(&WhiteBalanceModeSP),
WhiteBalanceModeS[0].s = ISS_ON;
- IDSetSwitch(&WhiteBalanceModeSP, errmsg);
+ IDSetSwitch(&WhiteBalanceModeSP, "%s", errmsg);
return;
}
break;
@@ -555,7 +555,7 @@ void ISNewSwitch (const char *dev, const
if (saveSettings(errmsg) < 0)
{
IUResetSwitches(&CamSettingSP);
- IDSetSwitch(&CamSettingSP, errmsg);
+ IDSetSwitch(&CamSettingSP, "%s", errmsg);
return;
}
@@ -616,8 +616,7 @@ void ISNewText (const char *dev, const c
void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
{
-
- char errmsg[1024];
+ char errmsg[ERRMSG_SIZE];
/* ignore if not ours */
if (dev && strcmp (dev, mydev))
@@ -672,7 +671,7 @@ void ISNewNumber (const char *dev, const
if (setFrameRate( (int) FrameRateN[0].value, errmsg) < 0)
{
FrameRateN[0].value = oldFP;
- IDSetNumber(&FrameRateNP, errmsg);
+ IDSetNumber(&FrameRateNP, "%s", errmsg);
return;
}
@@ -727,7 +726,7 @@ void ISNewNumber (const char *dev, const
for (int i=0; i < 6; i++)
ImageAdjustN[i].value = oldImgPar[i];
- IDSetNumber(&ImageAdjustNP, errmsg);
+ IDSetNumber(&ImageAdjustNP, "%s", errmsg);
return;
}
else
@@ -745,7 +744,7 @@ void ISNewNumber (const char *dev, const
for (int i=0; i < 6; i++)
ImageAdjustN[i].value = oldImgPar[i];
- IDSetNumber(&ImageAdjustNP, errmsg);
+ IDSetNumber(&ImageAdjustNP, "%s", errmsg);
return;
}
else
@@ -775,7 +774,7 @@ void ISNewNumber (const char *dev, const
if (setExposure( (int) values[0], errmsg) < 0)
{
- IDSetNumber(&ShutterSpeedNP, errmsg);
+ IDSetNumber(&ShutterSpeedNP, "%s", errmsg);
return;
}
@@ -803,14 +802,14 @@ void ISNewNumber (const char *dev, const
{
WhiteBalanceN[0].value = oldBalance[0];
WhiteBalanceN[1].value = oldBalance[1];
- IDSetNumber(&WhiteBalanceNP, errmsg);
+ IDSetNumber(&WhiteBalanceNP, "%s", errmsg);
return;
}
if (setWhiteBalanceBlue( (int) WhiteBalanceN[1].value * 256, errmsg))
{
WhiteBalanceN[0].value = oldBalance[0];
WhiteBalanceN[1].value = oldBalance[1];
- IDSetNumber(&WhiteBalanceNP, errmsg);
+ IDSetNumber(&WhiteBalanceNP, "%s", errmsg);
return;
}
@@ -865,8 +864,8 @@ int grabImage()
if ((fd = mkstemp(filename)) < 0)
{
- IDMessage(mydev, "Error making temporary filename.", NULL);
- IDLog("Error making temporary filename.\n", NULL);
+ IDMessage(mydev, "Error making temporary filename.");
+ IDLog("Error making temporary filename.\n");
return -1;
}
close(fd);
@@ -881,19 +880,17 @@ int grabImage()
return 0;
}
-int writeFITS(char * filename, char errmsg[])
+int writeFITS(const char* filename, char errmsg[])
{
FITS_FILE* ofp;
int i, bpp, bpsl, width, height;
long nbytes;
FITS_HDU_LIST *hdu;
- IDLog("in writeFITS with filename %s\n", filename);
-
ofp = fits_open (filename, "w");
if (!ofp)
{
- sprintf(errmsg, "Error: cannot open file for writing.");
+ strcpy(errmsg, "Error: cannot open file for writing.");
return (-1);
}
@@ -906,12 +903,12 @@ int writeFITS(char * filename, char errm
hdu = create_fits_header (ofp, width, height, bpp);
if (hdu == NULL)
{
- sprintf(errmsg, "Error: creating FITS header failed.");
+ strcpy(errmsg, "Error: creating FITS header failed.");
return (-1);
}
if (fits_write_header (ofp, hdu) < 0)
{
- sprintf(errmsg, "Error: writing to FITS header failed.");
+ strcpy(errmsg, "Error: writing to FITS header failed.");
return (-1);
}
@@ -930,7 +927,7 @@ int writeFITS(char * filename, char errm
if (ferror (ofp->fp))
{
- sprintf(errmsg, "Error: write error occured");
+ strcpy(errmsg, "Error: write error occured");
return (-1);
}
@@ -997,7 +994,7 @@ void getBasicData()
if (setFrameRate( (int) FrameRateN[0].value, errmsg) < 0)
{
FrameRateNP.s = IPS_ALERT;
- IDSetNumber(&FrameRateNP, errmsg);
+ IDSetNumber(&FrameRateNP, "%s", errmsg);
}
else
{
@@ -1295,7 +1292,7 @@ void updateStream(void *p)
// IDLog("Leaving update stream\n");
}
-void uploadFile(char * filename)
+void uploadFile(const char* filename)
{
FILE * fitsFile;
char frameSize[FRAME_ILEN];

View File

@ -0,0 +1,120 @@
$OpenBSD: patch-kstars_kstars_indidevice_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indidevice.cpp.orig Fri Jun 25 05:10:00 2004
+++ kstars/kstars/indidevice.cpp Sun Feb 27 03:48:42 2005
@@ -172,7 +172,7 @@ int INDI_D::setAnyCmd (XMLEle *root, cha
pp = findProp (valuXMLAtt(ap));
if (!pp)
{
- sprintf (errmsg,"INDI: <%s> device %s has no property named %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.32s> device %.32s has no property named %.64s",
tagXMLEle(root), name.ascii(), valuXMLAtt(ap));
return (-1);
}
@@ -197,7 +197,7 @@ int INDI_D::setValue (INDI_P *pp, XMLEle
pp->drawLt (pp->state);
else
{
- sprintf (errmsg, "INDI: <%s> bogus state %s for %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> bogus state %.64s for %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), name.ascii(), pp->name.ascii());
return (-1);
}
@@ -265,7 +265,7 @@ int INDI_D::setTextValue (INDI_P *pp, XM
if (!lp)
{
- sprintf(errmsg, "Error: unable to find element '%s' in property '%s'", elementName.ascii(), pp->name.ascii());
+ snprintf(errmsg, ERRMSG_SIZE, "Error: unable to find element '%.64s' in property '%.64s'", elementName.ascii(), pp->name.ascii());
return (-1);
}
@@ -360,7 +360,7 @@ int INDI_D::setLabelState (INDI_P *pp, X
/* no name */
if (!ap)
{
- sprintf (errmsg, "INDI: <%s> %s %s %s requires name",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> %.64s %.64s %.64s requires name",
tagXMLEle(root), name.ascii(), pp->name.ascii(), tagXMLEle(ep));
return (-1);
}
@@ -368,7 +368,7 @@ int INDI_D::setLabelState (INDI_P *pp, X
if ((islight && crackLightState (pcdataXMLEle(ep), &state) < 0)
|| (!islight && crackSwitchState (pcdataXMLEle(ep), &state) < 0))
{
- sprintf (errmsg, "INDI: <%s> unknown state %s for %s %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown state %.64s for %.64s %.64s %.64s",
tagXMLEle(root), pcdataXMLEle(ep), name.ascii(), pp->name.ascii(), tagXMLEle(ep));
return (-1);
}
@@ -379,7 +379,7 @@ int INDI_D::setLabelState (INDI_P *pp, X
if (!lp)
{
- sprintf (errmsg,"INDI: <%s> %s %s has no choice named %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> %.64s %.64s has no choice named %.64s",
tagXMLEle(root), name.ascii(), pp->name.ascii(), valuXMLAtt(ap));
return (-1);
}
@@ -409,7 +409,7 @@ int INDI_D::setLabelState (INDI_P *pp, X
{
if (menuChoice)
{
- sprintf(errmsg, "INDI: <%s> %s %s has multiple ON states", tagXMLEle(root), name.ascii(), pp->name.ascii());
+ snprintf(errmsg, ERRMSG_SIZE, "INDI: <%.64s> %.64s %.64s has multiple ON states", tagXMLEle(root), name.ascii(), pp->name.ascii());
return (-1);
}
menuChoice = 1;
@@ -470,7 +470,7 @@ INDI_P * INDI_D::addProperty (XMLEle *ro
if (findProp (valuXMLAtt(ap)))
{
- sprintf (errmsg, "INDI: <%s %s %s> already exists.\n", tagXMLEle(root),
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s %.64s %.64s> already exists.\n", tagXMLEle(root),
name.ascii(), valuXMLAtt(ap));
return NULL;
}
@@ -492,7 +492,7 @@ INDI_P * INDI_D::addProperty (XMLEle *ro
if (crackLightState (valuXMLAtt(ap), &pp->state) < 0)
{
- sprintf (errmsg, "INDI: <%s> bogus state %s for %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> bogus state %.64s for %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), pp->pg->dp->name.ascii(), pp->name.ascii());
delete(pp);
return (NULL);
@@ -544,7 +544,7 @@ INDI_G * INDI_D::findGroup (QString gro
return curGroup;
}
- sprintf (errmsg, "INDI: group %s not found in %s", grouptag.ascii(), name.ascii());
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: group %.64s not found in %.64s", grouptag.ascii(), name.ascii());
return NULL;
}
@@ -559,7 +559,7 @@ INDI_G * INDI_D::findGroup (QString gro
ap = findXMLAtt(root, "perm");
if (!ap) {
- sprintf (errmsg, "INDI: <%s %s %s> missing attribute 'perm'",
+ snprintf (errmsg, ERRMSG_SIZE,"INDI: <%.64s %.64s %.64s> missing attribute 'perm'",
tagXMLEle(root), pp->pg->dp->name.ascii(), pp->name.ascii());
return (-1);
}
@@ -570,7 +570,7 @@ INDI_G * INDI_D::findGroup (QString gro
else if (!strcmp(valuXMLAtt(ap), "rw") || !strcmp(valuXMLAtt(ap), "w"))
*permp = PP_RW;
else {
- sprintf (errmsg, "INDI: <%s> unknown perm %s for %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown perm %.64s for %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), pp->pg->dp->name.ascii(), pp->name.ascii());
return (-1);
}
@@ -769,7 +769,7 @@ int INDI_D::buildSwitchesGUI (XMLEle *ro
return (err);
}
- sprintf (errmsg, "INDI: <%s> unknown rule %s for %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown rule %.64s for %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), name.ascii(), pp->name.ascii());
delete(pp);

View File

@ -0,0 +1,47 @@
$OpenBSD: patch-kstars_kstars_indidriver_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indidriver.cpp.orig Sat Jul 17 13:52:56 2004
+++ kstars/kstars/indidriver.cpp Sun Feb 27 03:48:42 2005
@@ -19,6 +19,7 @@
#include "indihostconf.h"
#include "devicemanager.h"
#include "indidevice.h"
+#include "indi/indicom.h"
#include "kstars.h"
#include "kstarsdata.h"
@@ -532,7 +533,7 @@ bool INDIDriver::buildDeviceGroup(XMLEle
if (!ap)
{
- sprintf(errmsg, "Tag %s does not have a group attribute", tagXMLEle(root));
+ snprintf(errmsg, ERRMSG_SIZE, "Tag %.64s does not have a group attribute", tagXMLEle(root));
return false;
}
@@ -580,7 +581,7 @@ bool INDIDriver::buildDriverElement(XMLE
ap = findXMLAtt(root, "label");
if (!ap)
{
- sprintf(errmsg, "Tag %s does not have a label attribute", tagXMLEle(root));
+ snprintf(errmsg, ERRMSG_SIZE, "Tag %.64s does not have a label attribute", tagXMLEle(root));
return false;
}
@@ -590,7 +591,7 @@ bool INDIDriver::buildDriverElement(XMLE
ap = findXMLAtt(root, "driver");
if (!ap)
{
- sprintf(errmsg, "Tag %s does not have a driver attribute", tagXMLEle(root));
+ snprintf(errmsg, ERRMSG_SIZE, "Tag %.64s does not have a driver attribute", tagXMLEle(root));
return false;
}
@@ -833,7 +834,7 @@ IDevice::IDevice(QString inLabel, QStrin
}
-void IDevice::processstd(KProcess */*proc*/, char* buffer, int /*buflen*/)
+void IDevice::processstd(KProcess* /*proc*/, char* buffer, int /*buflen*/)
{
serverBuffer.append(buffer);
emit newServerInput();

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-kstars_kstars_indielement_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indielement.cpp.orig Fri Jun 25 05:10:00 2004
+++ kstars/kstars/indielement.cpp Sun Feb 27 03:48:42 2005
@@ -42,7 +42,7 @@ XMLAtt * findAtt (XMLEle *ep, const char
if (ap)
return (ap);
if (errmsg)
- sprintf (errmsg, "INDI: <%s> missing attribute '%s'", tagXMLEle(ep),name);
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> missing attribute '%.64s'", tagXMLEle(ep),name);
return NULL;
}
@@ -55,7 +55,7 @@ XMLEle * findEle (XMLEle *ep, INDI_P *pp
if (cp)
return (cp);
if (errmsg)
- sprintf (errmsg, "INDI: <%s %s %s> missing child '%s'", tagXMLEle(ep),
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s %.64s %.64s> missing child '%.64s'", tagXMLEle(ep),
pp->pg->dp->name.ascii(), pp->name.ascii(), child);
return (NULL);
}

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-kstars_kstars_indiproperty_cpp,v 1.1 2005/02/27 09:09:14 brad Exp $
--- kstars/kstars/indiproperty.cpp.orig Sat Jul 17 13:52:57 2004
+++ kstars/kstars/indiproperty.cpp Sun Feb 27 03:48:42 2005
@@ -521,7 +521,7 @@ int INDI_P::buildMenuGUI(XMLEle *root, c
if (pg->dp->crackSwitchState (pcdataXMLEle(sep), &(lp->state)) < 0)
{
- sprintf (errmsg, "INDI: <%s> unknown state %s for %s %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown state %.64s for %.64s %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), name.ascii(), lp->name.ascii(), name.ascii());
return (-1);
}
@@ -532,7 +532,7 @@ int INDI_P::buildMenuGUI(XMLEle *root, c
{
if (onItem != -1)
{
- sprintf (errmsg,"INDI: <%s> %s %s has multiple On switches",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> %.64s %.64s has multiple On switches",
tagXMLEle(root), name.ascii(), lp->name.ascii());
return (-1);
}
@@ -602,7 +602,7 @@ int INDI_P::buildSwitchesGUI(XMLEle *roo
if (pg->dp->crackSwitchState (pcdataXMLEle(sep), &(lp->state)) < 0)
{
- sprintf (errmsg, "INDI: <%s> unknown state %s for %s %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown state %.64s for %.64s %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), name.ascii(), name.ascii(), lp->name.ascii());
return (-1);
}
@@ -700,7 +700,7 @@ int INDI_P::buildLightsGUI(XMLEle *root,
if (pg->dp->crackLightState (pcdataXMLEle(lep), &lp->state) < 0)
{
- sprintf (errmsg, "INDI: <%s> unknown state %s for %s %s %s",
+ snprintf (errmsg, ERRMSG_SIZE, "INDI: <%.64s> unknown state %.64s for %.64s %.64s %.64s",
tagXMLEle(root), valuXMLAtt(ap), pg->dp->name.ascii(), name.ascii(), sname.ascii());
return (-1);
}