summaryrefslogtreecommitdiff
path: root/lib/String.cc
diff options
context:
space:
mode:
authorPixel <Pixel>2001-12-10 11:39:54 +0000
committerPixel <Pixel>2001-12-10 11:39:54 +0000
commit1efb1f34106be8b383f1edea9bd0fd608ac7faeb (patch)
treee0002e157e4320a9cebf3c96b204a42b5dfa1cd9 /lib/String.cc
parenta83a43e57be59ed407d98f465d02953af5ae0160 (diff)
Supressing some warnings...
Diffstat (limited to 'lib/String.cc')
-rw-r--r--lib/String.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/String.cc b/lib/String.cc
index d131fba..0fa4278 100644
--- a/lib/String.cc
+++ b/lib/String.cc
@@ -74,6 +74,8 @@ String::~String() {
const char * String::set(const char * s, ...) {
va_list ap;
+/* This causes a warning: cannot pass objects of type `const String' through `...'
+ but it is not really a problem. */
va_start(ap, s);
vsnprintf(t, BUFSIZ, s, ap);
free(str);
@@ -99,17 +101,17 @@ const char * String::to_charp(size_t from, ssize_t to) const {
if (to < 0) {
strncpy(t, &(str[from]), BUFSIZ);
} else {
- if (to >= siz) {
+ if (((size_t) to) >= siz) {
to = siz - 1;
}
- if ((to - from) > BUFSIZ) {
+ if ((((size_t) to) - from) > BUFSIZ) {
from -= (to - from) - BUFSIZ;
}
- if (to >= from) {
- int i;
- for (i = 0; i <= to - from; i++) {
+ if (((size_t) to) >= from) {
+ size_t i;
+ for (i = 0; i <= ((size_t) to) - from; i++) {
t[i] = str[i + from];
}
t[i] = '\0';