testError: mark most string arguments for translation

* Makefile.maint (msg_gen_function): Add testError
* src/test.c (testDomainSave, testDomainRestore): Mark strings.
(testDomainCoreDump): Likewise.
This commit is contained in:
Jim Meyering 2008-03-27 14:01:59 +00:00
parent 7f8639261a
commit 76a7098407
3 changed files with 23 additions and 17 deletions

View File

@ -1,5 +1,10 @@
Thu Mar 27 14:36:56 CET 2008 Jim Meyering <meyering@redhat.com> Thu Mar 27 14:36:56 CET 2008 Jim Meyering <meyering@redhat.com>
testError: mark most string arguments for translation
* Makefile.maint (msg_gen_function): Add testError
* src/test.c (testDomainSave, testDomainRestore): Mark strings.
(testDomainCoreDump): Likewise.
openvzLog: mark its string arguments for translation openvzLog: mark its string arguments for translation
* Makefile.maint (msg_gen_function): Add openvzLog. * Makefile.maint (msg_gen_function): Add openvzLog.
* src/openvz_conf.c (openvzAssignVMDef, openvzParseXML): Mark strings. * src/openvz_conf.c (openvzAssignVMDef, openvzParseXML): Mark strings.

View File

@ -317,9 +317,10 @@ msg_gen_function += ReportError
msg_gen_function += qemudReportError msg_gen_function += qemudReportError
msg_gen_function += openvzLog msg_gen_function += openvzLog
# Uncomment this after adjusting remaining diagnostics to be translatable. # Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten
# so that they are translatable.
# msg_gen_function += error # msg_gen_function += error
# msg_gen_function += virXenError # msg_gen_function += virXenError
# msg_gen_function += testError # msg_gen_function += testError

View File

@ -1307,31 +1307,31 @@ static int testDomainSave(virDomainPtr domain,
xml = testDomainDumpXML(domain, 0); xml = testDomainDumpXML(domain, 0);
if (xml == NULL) { if (xml == NULL) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot allocate space for metadata"); _("cannot allocate space for metadata"));
return (-1); return (-1);
} }
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save domain"); _("cannot save domain"));
return (-1); return (-1);
} }
len = strlen(xml); len = strlen(xml);
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) { if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write header"); _("cannot write header"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (safewrite(fd, (char*)&len, sizeof(len)) < 0) { if (safewrite(fd, (char*)&len, sizeof(len)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write metadata length"); _("cannot write metadata length"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (safewrite(fd, xml, len) < 0) { if (safewrite(fd, xml, len) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write metadata"); _("cannot write metadata"));
free(xml); free(xml);
close(fd); close(fd);
return (-1); return (-1);
@ -1339,7 +1339,7 @@ static int testDomainSave(virDomainPtr domain,
free(xml); free(xml);
if (close(fd) < 0) { if (close(fd) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save domain data"); _("cannot save domain data"));
close(fd); close(fd);
return (-1); return (-1);
} }
@ -1363,30 +1363,30 @@ static int testDomainRestore(virConnectPtr conn,
if ((fd = open(path, O_RDONLY)) < 0) { if ((fd = open(path, O_RDONLY)) < 0) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot read domain image"); _("cannot read domain image"));
return (-1); return (-1);
} }
if (read(fd, magic, sizeof(magic)) != sizeof(magic)) { if (read(fd, magic, sizeof(magic)) != sizeof(magic)) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"incomplete save header"); _("incomplete save header"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) { if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"mismatched header magic"); _("mismatched header magic"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) { if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to read metadata length"); _("failed to read metadata length"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (len < 1 || len > 8192) { if (len < 1 || len > 8192) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"length of metadata out of range"); _("length of metadata out of range"));
close(fd); close(fd);
return (-1); return (-1);
} }
@ -1398,7 +1398,7 @@ static int testDomainRestore(virConnectPtr conn,
} }
if (read(fd, xml, len) != len) { if (read(fd, xml, len) != len) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"incomplete metdata"); _("incomplete metdata"));
close(fd); close(fd);
return (-1); return (-1);
} }
@ -1419,18 +1419,18 @@ static int testDomainCoreDump(virDomainPtr domain,
if ((fd = open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { if ((fd = open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save domain core"); _("cannot save domain core"));
return (-1); return (-1);
} }
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) { if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write header"); _("cannot write header"));
close(fd); close(fd);
return (-1); return (-1);
} }
if (close(fd) < 0) { if (close(fd) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save domain data"); _("cannot save domain data"));
close(fd); close(fd);
return (-1); return (-1);
} }