431ca2b29dd35a0ebd83029e95bca9363022a037 braney Tue Jan 31 17:33:19 2017 -0800 fix some problems with long chrom names and the cyto band track diff --git src/hg/lib/hCytoBand.c src/hg/lib/hCytoBand.c index 8084815..7732624 100644 --- src/hg/lib/hCytoBand.c +++ src/hg/lib/hCytoBand.c @@ -5,46 +5,46 @@ * See README in this or parent directory for licensing information. */ #include "common.h" #include "hvGfx.h" #include "hCommon.h" #include "hgColors.h" #include "cytoBand.h" #include "hCytoBand.h" static char *abbreviatedBandName(struct cytoBand *band, MgFont *font, int width, boolean isDmel) /* Return a string abbreviated enough to fit into space. */ { int textWidth; -static char string[32]; +static char string[1024]; /* If have enough space, return original chromosome/band. */ -sprintf(string, "%s%s", (isDmel ? "" : skipChr(band->chrom)), band->name); +safef(string, sizeof string, "%s%s", (isDmel ? "" : skipChr(band->chrom)), band->name); textWidth = mgFontStringWidth(font, string); if (textWidth <= width) return string; /* Try leaving off chromosome */ -sprintf(string, "%s", band->name); +safef(string, sizeof string, "%s", band->name); textWidth = mgFontStringWidth(font, string); if (textWidth <= width) return string; /* Try leaving off initial letter */ -sprintf(string, "%s", band->name+1); +safef(string, sizeof string, "%s", band->name+1); textWidth = mgFontStringWidth(font, string); if (textWidth <= width) return string; return NULL; } static Color cytoBandColorGiemsa(struct cytoBand *band, struct hvGfx *hvg, Color aColor, Color bColor, Color *shades, int maxShade) /* Figure out color of band based on gieStain field. */ { char *stain = band->gieStain; if (startsWith("gneg", stain)) {