summaryrefslogtreecommitdiff
path: root/graphics/clanlib
diff options
context:
space:
mode:
authordmcmahill <dmcmahill@pkgsrc.org>2001-05-11 14:12:10 +0000
committerdmcmahill <dmcmahill@pkgsrc.org>2001-05-11 14:12:10 +0000
commitf4c83acaa95772b651c9baa3447f77b499ec80a8 (patch)
treee4ccb4e8a5c50dfa013fb2d5d88abc80013f79ea /graphics/clanlib
parent68a57288f74ffa37abf613b4de2461496297f13c (diff)
downloadpkgsrc-f4c83acaa95772b651c9baa3447f77b499ec80a8.tar.gz
add a missing CL_String << long operator overload needed on systems for
which sizeof(long) != sizeof(int).
Diffstat (limited to 'graphics/clanlib')
-rw-r--r--graphics/clanlib/distinfo4
-rw-r--r--graphics/clanlib/patches/patch-ac110
2 files changed, 100 insertions, 14 deletions
diff --git a/graphics/clanlib/distinfo b/graphics/clanlib/distinfo
index 2896b2463a3..e6106678b27 100644
--- a/graphics/clanlib/distinfo
+++ b/graphics/clanlib/distinfo
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.2 2001/04/21 09:54:09 wiz Exp $
+$NetBSD: distinfo,v 1.3 2001/05/11 14:12:10 dmcmahill Exp $
SHA1 (ClanLib-0.4.4.tar.gz) = 326fb3812bd3c26cd8ecf60d8975c662674ae9a8
Size (ClanLib-0.4.4.tar.gz) = 642836 bytes
SHA1 (patch-aa) = 80882e6b178238572a07f70a5222691f79209059
SHA1 (patch-ab) = 38acc42d60694482b61853fb14e0460a437a1653
-SHA1 (patch-ac) = fa01bf8e697a6aa444e325b238af70d7bf2f59e7
+SHA1 (patch-ac) = 383a03b0ecca44a6d3397184d6022a0bb91882da
SHA1 (patch-ad) = ea6da825d77090177c2c5c73362fc5caa80181f3
SHA1 (patch-ae) = 2fb537e21cb8e670b492d80a8864b26b44db2ad1
SHA1 (patch-af) = 0ccbcce72e2a64805fcbccb678e36aefe81cf7fa
diff --git a/graphics/clanlib/patches/patch-ac b/graphics/clanlib/patches/patch-ac
index 7caca2322b8..2144fbb6a21 100644
--- a/graphics/clanlib/patches/patch-ac
+++ b/graphics/clanlib/patches/patch-ac
@@ -1,17 +1,83 @@
-$NetBSD: patch-ac,v 1.3 2000/12/15 03:20:50 garbled Exp $
---- Sources/API/Core/System/clanstring.h.orig Tue May 9 14:09:32 2000
-+++ Sources/API/Core/System/clanstring.h Thu Dec 14 18:08:39 2000
-@@ -25,6 +25,8 @@
-
+$NetBSD: patch-ac,v 1.4 2001/05/11 14:12:10 dmcmahill Exp $
+
+
+add an operator overload for CL_String << long so this can build
+on 64-bit systems.
+
+--- Sources/API/Core/System/clanstring.h.orig Tue May 9 17:09:32 2000
++++ Sources/API/Core/System/clanstring.h Thu May 10 17:57:14 2001
+@@ -26,4 +26,6 @@
#ifndef WIN32
#include <cctype>
+#include <stdio.h>
+#include <sys/param.h>
#endif
- #ifdef __BEOS__
-@@ -101,9 +103,12 @@
- {
+@@ -69,4 +71,36 @@
+ }
+ }
++
++void ltoa(long num, char *str, const int number_format)
++{
++ long num1 = num;
++ int num_chars = 0;
++
++ while (num1>0)
++ {
++ num_chars++;
++ num1 /= number_format;
++ }
++
++ if (num_chars == 0) num_chars = 1;
++
++ str[num_chars] = 0; // Null-terminate the str
++
++ for (int pos = num_chars-1; pos>=0; pos--)
++ {
++ int cur_char = num % number_format;
++
++ if (cur_char < 10) // Insert number
++ {
++ str[pos] = cur_char + '0';
++ }
++ else // Insert letter
++ {
++ str[pos] = cur_char-10 + 'A';
++ }
++
++ num /= number_format;
++ }
++}
+ #else
+ #pragma warning( disable : 4244 )
+@@ -97,4 +131,26 @@
+ return text;
+ }
++
++ char *long_to_string(const char *prefix, const long number)
++ {
++ char buf[20];
++ ltoa(number, buf, 10);
++
++ int len=0;
++ if (prefix!=NULL) len=strlen(prefix);
++
++ char *text=new char[len+strlen(buf)+1];
++ if (prefix!=NULL)
++ {
++ strcpy(text, prefix);
++ strcat(text, buf);
++ }
++ else
++ {
++ strcpy(text, buf);
++ }
++
++ return text;
++ }
+
+ char *float_to_string(const char *prefix, const float _float_number)
+@@ -102,7 +158,10 @@
char buf[25];
buf[0]=0;
+ int precision=4;
@@ -23,12 +89,32 @@ $NetBSD: patch-ac,v 1.3 2000/12/15 03:20:50 garbled Exp $
- int precision=4;
char temp;
- float float_number = _float_number;
-@@ -134,6 +139,7 @@
- strcat(buf, &float_buffer[decimal]);
+@@ -135,4 +194,5 @@
copy_strings:
+#endif
int len=0;
if (prefix!=NULL) len=strlen(prefix);
-
+@@ -434,4 +494,22 @@
+ {
+ char *new_string=int_to_string(str, number);
++ if (str!=NULL) delete str;
++ str=new_string;
++
++ return *this;
++ }
++
++ CL_String &operator<< (const unsigned long number)
++ {
++ char *new_string=long_to_string(str, number);
++ if (str!=NULL) delete str;
++ str=new_string;
++
++ return *this;
++ }
++
++ CL_String &operator<< (const long number)
++ {
++ char *new_string=long_to_string(str, number);
+ if (str!=NULL) delete str;
+ str=new_string;