summaryrefslogtreecommitdiff
path: root/src/language.c
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-31 06:15:29 +0000
committerDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-31 06:15:29 +0000
commitaa4b3e256377030d291fc2d5f4db94985ce04395 (patch)
tree993302c0cbe754612f69c22bbbc57d00220cabd4 /src/language.c
parent47504c9de5accda45a19627fd2b6ec13baa6ba95 (diff)
replaced the alog() command with a new type-safe and stream-based Alog()
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2777 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/language.c')
-rw-r--r--src/language.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/language.c b/src/language.c
index 550aedc2f..7e152254f 100644
--- a/src/language.c
+++ b/src/language.c
@@ -68,10 +68,7 @@ static void load_lang(int index, const char *filename)
FILE *f;
int32 num, i;
- if (debug) {
- alog("debug: Loading language %d from file `languages/%s'",
- index, filename);
- }
+ Alog(LOG_DEBUG) << "Loading language " << index << " from file `languages/" << filename << "'";
snprintf(buf, sizeof(buf), "languages/%s", filename);
#ifndef _WIN32
if (!(f = fopen(buf, "r"))) {
@@ -81,12 +78,11 @@ static void load_lang(int index, const char *filename)
log_perror("Failed to load language %d (%s)", index, filename);
return;
} else if (read_int32(&num, f) < 0) {
- alog("Failed to read number of strings for language %d (%s)",
- index, filename);
+ Alog() << "Failed to read number of strings for language " << index << "(" << filename << ")";
return;
} else if (num != NUM_STRINGS) {
- alog("Warning: Bad number of strings (%d, wanted %d) "
- "for language %d (%s)", num, NUM_STRINGS, index, filename);
+ Alog() << "Warning: Bad number of strings (" << num << " , wanted " << NUM_STRINGS << ") "
+ << "for language " << index << " (" << filename << ")";
}
langtexts[index] = new char *[NUM_STRINGS];
if (num > NUM_STRINGS)
@@ -95,9 +91,9 @@ static void load_lang(int index, const char *filename)
int32 pos, len;
fseek(f, i * 8 + 4, SEEK_SET);
if (read_int32(&pos, f) < 0 || read_int32(&len, f) < 0) {
- alog("Failed to read entry %d in language %d (%s) TOC",
- i, index, filename);
- while (--i >= 0) {
+ Alog() << "Failed to read entry " << i << " in language " << index << " (" << filename << ") TOC";
+ while (--i >= 0)
+ {
if (langtexts[index][i])
delete [] langtexts[index][i];
}
@@ -108,8 +104,7 @@ static void load_lang(int index, const char *filename)
if (len == 0) {
langtexts[index][i] = NULL;
} else if (len >= 65536) {
- alog("Entry %d in language %d (%s) is too long (over 64k)--"
- "corrupt TOC?", i, index, filename);
+ Alog() << "Entry " << i << " in language " << index << " (" << filename << ") is too long (over 64k) -- corrupt TOC?";
while (--i >= 0) {
if (langtexts[index][i])
delete [] langtexts[index][i];
@@ -118,8 +113,7 @@ static void load_lang(int index, const char *filename)
langtexts[index] = NULL;
return;
} else if (len < 0) {
- alog("Entry %d in language %d (%s) has negative length--"
- "corrupt TOC?", i, index, filename);
+ Alog() << "Entry " << i << " in language " << index << " (" << filename << ") has negative length -- corrupt TOC?";
while (--i >= 0) {
if (langtexts[index][i])
delete [] langtexts[index][i];
@@ -131,8 +125,7 @@ static void load_lang(int index, const char *filename)
langtexts[index][i] = new char[len + 1];
fseek(f, pos, SEEK_SET);
if (fread(langtexts[index][i], 1, len, f) != len) {
- alog("Failed to read string %d in language %d (%s)",
- i, index, filename);
+ Alog() << "Failed to read string " << i << " in language " << index << "(" << filename << ")";
while (--i >= 0) {
if (langtexts[index][i])
delete [] langtexts[index][i];