Changeset 30442
- Timestamp:
- Jan 31, 2011, 2:39:33 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205/Ohana/src/kapa2
- Files:
-
- 3 edited
-
include/prototypes.h (modified) (1 diff)
-
src/UpdateStatusBox.c (modified) (5 diffs)
-
src/hh_hms.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/Ohana/src/kapa2/include/prototypes.h
r29938 r30442 175 175 void DrawBitmap PROTO((Graphic *graphic, int x, int y, int dx, int dy, char *bitmap, int mode)); 176 176 void CrossHairs PROTO((Graphic *graphic, Picture *image)); 177 void hh_hms PROTO((char *line, double ra, double dec, char sep ));177 void hh_hms PROTO((char *line, double ra, double dec, char sep, int Nchar)); 178 178 179 179 int SetColormap PROTO((char *name)); -
branches/eam_branches/ipp-20101205/Ohana/src/kapa2/src/UpdateStatusBox.c
r29539 r30442 20 20 21 21 bzero (line, 100); 22 s printf (line, "(%d x %d) @ %d ",22 snprintf (line, 100, "(%d x %d) @ %d ", 23 23 image[0].picture.dx, image[0].picture.dy, image[0].picture.expand); 24 24 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, … … 26 26 27 27 bzero (line, 100); 28 s printf (line, "%-25s", image[0].image[0].file);28 snprintf (line, 100, "%-25s", image[0].image[0].file); 29 29 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 30 30 image[0].text_x + PAD1, image[0].text_y + 5*textpad + 5*PAD1, line, strlen(line)); 31 31 32 32 bzero (line, 100); 33 s printf (line, "(%s) ", image[0].image[0].name);33 snprintf (line, 100, "(%s) ", image[0].image[0].name); 34 34 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 35 35 image[0].text_x + PAD1, image[0].text_y + 6*textpad + 6*PAD1, line, 25); … … 45 45 46 46 if (image[0].HexValue) { 47 sprintf (line, "%04x", (int) z);47 snprintf (line, 100, "%04x", (int) z); 48 48 } else { 49 sprintf (line, "%22.3f", z);49 snprintf (line, 100, "%22.3f", z); 50 50 } 51 51 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, … … 53 53 54 54 bzero (line, 100); 55 s printf (line, "%10.2f %10.2f", x, y);55 snprintf (line, 100, "%10.2f %10.2f", x, y); 56 56 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 57 57 image[0].text_x + PAD1, image[0].text_y + 2*textpad + 2*PAD1, line, strlen(line)); … … 59 59 bzero (line, 100); 60 60 if (image[0].DecimalDegrees) { 61 s printf (line, "%10.6f %10.6f", ra, dec);61 snprintf (line, 100, "%10.6f %10.6f", ra, dec); 62 62 } else { 63 hh_hms (line, ra, dec, ':' );63 hh_hms (line, ra, dec, ':', 100); 64 64 } 65 65 66 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 66 67 image[0].text_x + PAD1, image[0].text_y + 3*textpad + 3*PAD1, line, strlen(line)); -
branches/eam_branches/ipp-20101205/Ohana/src/kapa2/src/hh_hms.c
r13320 r30442 1 1 # include "Ximage.h" 2 2 3 void hh_hms (char *line, double ra, double dec, char sep ) {3 void hh_hms (char *line, double ra, double dec, char sep, int Nchar) { 4 4 5 5 int h, m, flag; … … 13 13 s = 3600*(ra - h - m / 60.0); 14 14 if (flag > 0) 15 s printf (line, " %02d%c%02d%c%04.1f ", h, sep, m, sep, s);15 snprintf (line, Nchar, " %02d%c%02d%c%04.1f ", h, sep, m, sep, s); 16 16 else 17 s printf (line, "-%02d%c%02d%c%04.1f ", h, sep, m, sep, s);17 snprintf (line, Nchar, "-%02d%c%02d%c%04.1f ", h, sep, m, sep, s); 18 18 19 19 flag = SIGN(dec); … … 23 23 s = 3600*(dec - h - m / 60.0); 24 24 if (flag > 0) 25 s printf (&line[13], " %02d%c%02d%c%04.1f", h, sep, m, sep, s);25 snprintf (&line[13], Nchar, " %02d%c%02d%c%04.1f", h, sep, m, sep, s); 26 26 else 27 s printf (&line[13], "-%02d%c%02d%c%04.1f", h, sep, m, sep, s);27 snprintf (&line[13], Nchar, "-%02d%c%02d%c%04.1f", h, sep, m, sep, s); 28 28 }
Note:
See TracChangeset
for help on using the changeset viewer.
