openbsd-ports/net/libshout/patches/patch-src_avl_avl_c
2005-04-19 20:23:44 +00:00

37 lines
914 B
Plaintext

$OpenBSD: patch-src_avl_avl_c,v 1.4 2005/04/19 20:23:44 sturm Exp $
--- src/avl/avl.c.orig Mon Jul 5 22:44:13 2004
+++ src/avl/avl.c Tue Apr 19 22:18:54 2005
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "avl.h"
@@ -1063,9 +1064,11 @@ typedef struct _link_node {
static char balance_chars[3] = {'\\', '-', '/'};
static int
-default_key_printer (char * buffer, void * key)
+default_key_printer (char * buffer, size_t size, void * key)
{
- return sprintf (buffer, "%p", key);
+ snprintf (buffer, size, "%p", key);
+
+ return strlen(buffer);
}
/*
@@ -1108,8 +1111,8 @@ print_node (avl_key_printer_fun_type key
link_node * link)
{
char buffer[256];
- unsigned int width;
- width = key_printer (buffer, node->key);
+ size_t width;
+ width = key_printer (buffer, sizeof(buffer), node->key);
if (node->right) {
link_node here;