diff --git a/ChangeLog b/ChangeLog index 9bfb1bb..680baf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-02 02:58 Alexander Malmberg + + * Source/gsc/GSStreamContext.m Whitespace cleanups. + + (writeHex): Use index properly; don't always write the first byte. + Use fputc() instead of fprintf() (was doing the hex conversion + manually anyway, might as well make it efficient). + 2003-11-02 02:27 Alexander Malmberg * Source/gsc/GSStreamContext.m (fpfloat, writeHex): Make static. diff --git a/Source/gsc/GSStreamContext.m b/Source/gsc/GSStreamContext.m index 0169cf9..cc54550 100644 --- a/Source/gsc/GSStreamContext.m +++ b/Source/gsc/GSStreamContext.m @@ -278,7 +278,7 @@ fpfloat(FILE *stream, float f) for (i = 0; i < length; i++) { - fprintf(gstream, "/%s glyphshow\n",[font nameOfGlyph: glyphs[i]]); + fprintf(gstream, "/%s glyphshow\n", [font nameOfGlyph: glyphs[i]]); } } else @@ -286,7 +286,7 @@ fpfloat(FILE *stream, float f) /* If backend doesn't handle nameOfGlyph, assume the glyphs are just mapped to characters. This is the case for the xlib backend (at least for now). */ - char string[length+1]; + char string[length + 1]; unsigned int i; for (i = 0; i < length; i++) @@ -683,10 +683,10 @@ fpfloat(FILE *stream, float f) [self DPSsetdash: pattern : count : phase]; count = [path elementCount]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = [path elementAtIndex: i associatedPoints: pts]; - switch(type) + switch (type) { case NSMoveToBezierPathElement: [self DPSmoveto: pts[0].x : pts[0].y]; @@ -795,16 +795,16 @@ fpfloat(FILE *stream, float f) @end -static char *hexdigits = "0123456789abcdef"; static void writeHex(FILE *gstream, const unsigned char *data, int count) { +static const char *hexdigits = "0123456789abcdef"; int i; for (i = 0; i < count; i++) { - fprintf(gstream, "%c%c", hexdigits[(int)(data[0]/16)], - hexdigits[(data[0] % 16)]); + fputc(hexdigits[(int)(data[i] / 16)], gstream); + fputc(hexdigits[(int)(data[i] % 16)], gstream); if (i && i % 40 == 0) fprintf(gstream, "\n"); } @@ -869,7 +869,7 @@ writeHex(FILE *gstream, const unsigned char *data, int count) pixelsWide, pixelsHigh, bitsPerSample, pixelsWide, (flipped) ? pixelsHigh : -pixelsHigh, pixelsHigh); fprintf(gstream, "{currentfile %d string readhexstring pop}\n", - pixelsWide*spp); + pixelsWide * spp); fprintf(gstream, "false %d colorimage\n", spp); } else @@ -891,23 +891,23 @@ writeHex(FILE *gstream, const unsigned char *data, int count) int alpha = 0; unsigned char val; - for(j=0; j