Skip to content

Commit

Permalink
Avoid char* warning from C++ compiler
Browse files Browse the repository at this point in the history
On some SAMD compilers, there was a warning given regarding handling of a constant string.  This has been removed with the use of the strcpy() function .
  • Loading branch information
DavidArmstrong committed May 7, 2022
1 parent 9205204 commit 87a35d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Sidereal Objects - A strangely named Arduino Library for providing low precision Epoch 2000.0 Astronomical object coordinates.

Version 1.1.0 - September 3, 2021
Version 1.1.1 - May 7, 2022

By David Armstrong
https://github.com/DavidArmstrong/SiderealObjects
Expand Down
4 changes: 3 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ getAltIdentifiedObjectNumber KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################

NSTARS LITERAL1
NGCNUM LITERAL1
ICNUM LITERAL1

2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SiderealObjects
version=1.1.0
version=1.1.1
author=David Armstrong <mamoru.tbreesama@gmail.com>
maintainer=David Armstrong <mamoru.tbreesama@gmail.com>
sentence=A library for providing basic astronomy related object tables.
Expand Down
4 changes: 2 additions & 2 deletions src/SiderealObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ char* SiderealObjects::printStarName(int n) {
return starName[index].name;
}
}
char* temp = "";
return temp;
strcpy(tempStarName, "");
return tempStarName;
}

boolean SiderealObjects::selectNGCTable(int n) {
Expand Down
9 changes: 6 additions & 3 deletions src/SiderealObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Distributed as-is; no warranty is given.

#include <stdint.h>
//#include <math.h>
#include <string.h>
#include "SiderealObjectsTables.h"

#if defined(ARDUINO) && ARDUINO >= 100
Expand All @@ -50,6 +51,9 @@ struct SiderealObjectsData {
class SiderealObjects {
// user-accessible "public" interface
public:
const int NSTARS = 609; // Number of stars in table
const int NGCNUM = 7840; // Number of NGC objects
const int ICNUM = 5386; // Number of IC objects
SiderealObjectsData spData;
boolean begin(void);
double decimalDegrees(int degrees, int minutes, float seconds);
Expand Down Expand Up @@ -77,9 +81,6 @@ class SiderealObjects {
const double F2PI = 2.0 * M_PI;
const double F2to16 = 65536.0;
const double F2to15minus1 = 32767.0;
const int NSTARS = 609; // Number of stars in table
const int NGCNUM = 7840; // Number of NGC objects
const int ICNUM = 5386; // Number of IC objects

double RAdec, DeclinationDec;
double RArad, DeclinationRad;
Expand All @@ -102,5 +103,7 @@ class SiderealObjects {
unsigned int bit16[2];
unsigned char bit8[4];
};

char* tempStarName;
};
#endif

0 comments on commit 87a35d6

Please sign in to comment.