Browse Source

buf_size -> len

v1.x
Tj Holowaychuk 13 years ago
parent
commit
959009b884
  1. 6
      src/color.cc
  2. 2
      src/color.h

6
src/color.cc

@ -243,14 +243,14 @@ rgba_create(uint32_t rgba) {
*/
void
rgba_to_string(rgba_t rgba, char *buf, size_t buf_size) {
rgba_to_string(rgba_t rgba, char *buf, size_t len) {
if (1 == rgba.a) {
snprintf(buf, buf_size, "#%.2x%.2x%.2x"
snprintf(buf, len, "#%.2x%.2x%.2x"
, (int) (rgba.r * 255)
, (int) (rgba.g * 255)
, (int) (rgba.b * 255));
} else {
snprintf(buf, buf_size, "rgba(%d, %d, %d, %.2f)"
snprintf(buf, len, "rgba(%d, %d, %d, %.2f)"
, (int) (rgba.r * 255)
, (int) (rgba.g * 255)
, (int) (rgba.b * 255)

2
src/color.h

@ -32,7 +32,7 @@ int32_t
rgba_from_string(const char *str, short *ok);
void
rgba_to_string(rgba_t rgba, char *buf, size_t buf_size);
rgba_to_string(rgba_t rgba, char *buf, size_t len);
void
rgba_inspect(int32_t rgba);

Loading…
Cancel
Save