Sfoglia il codice sorgente

Small corrections to error messages

Piotr Czajkowski 6 anni fa
parent
commit
e62c815d0d
2 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 5 5
      comments.c
  2. 2 2
      zip.c

+ 5 - 5
comments.c

@@ -28,17 +28,17 @@ int anonymizeComments(XMLBuff *infile) {
 	const xmlChar *authorPath = (xmlChar*)"//w:comment/@w:author";
 
 	xmlDocPtr doc = xmlReadMemory(infile->data, infile->size, infile->name, NULL, 0);
-	Stopif(!doc, return -1, "Error: unable to parse file \"%s\"\n", infile->name);
+	Stopif(!doc, return -1, "Unable to parse file %s!\n", infile->name);
 
 	xmlXPathContextPtr context = xmlXPathNewContext(doc);
-	Stopif(!context, return -1, "Error: unable to create new XPath context\n");
+	Stopif(!context, return -1, "Unable to create new XPath context!\n");
 
 	const xmlChar* prefix = (xmlChar*)"w";
 	const xmlChar* ns = (xmlChar*)"http://schemas.openxmlformats.org/wordprocessingml/2006/main";
-	Stopif(xmlXPathRegisterNs(context, prefix, ns), return -1, "Error: Can't add namespace!\n");
+	Stopif(xmlXPathRegisterNs(context, prefix, ns), return -1, "Can't add namespace!\n");
 
 	xmlXPathObjectPtr authors = xmlXPathEvalExpression(authorPath, context);
-	Stopif(!authors, return -1, "Something is wrong with XPATH %s\n", authorPath);
+	Stopif(!authors, return -1, "Something is wrong with XPATH %s!\n", authorPath);
 
 	xmlChar *authorName = (xmlChar*)"";
 	for (int i=0; i < authors->nodesetval->nodeNr; i++){
@@ -51,7 +51,7 @@ int anonymizeComments(XMLBuff *infile) {
 	xmlDocDumpMemoryEnc(doc, &buf, &infile->size, "UTF-8");
 	infile->data = (char*)buf;
 
-	Stopif(!infile->size, return -1, "Errors: unable to save file %s\n", infile->name);
+	Stopif(!infile->size, return -1, "Unable to save file %s!\n", infile->name);
 
 	xmlXPathFreeObject(authors);
 	xmlXPathFreeContext(context);

+ 2 - 2
zip.c

@@ -49,12 +49,12 @@ static int processDOCX(char const *infile, char const *outfile) {
 
 	archiveIn = archive_read_new();
 	archive_read_support_format_zip(archiveIn);
-	Stopif(archive_read_open_filename(archiveIn, infile, 10240), return -1, "Can't read file %s\n!", infile);
+	Stopif(archive_read_open_filename(archiveIn, infile, 10240), return -1, "Can't read file %s!\n", infile);
 
 	archiveOut = archive_write_new();
 	archive_write_set_format_zip(archiveOut);
 
-	Stopif(archive_write_open_filename(archiveOut, outfile) != ARCHIVE_OK, return -1, "Can't create new archive %s\n", outfile);
+	Stopif(archive_write_open_filename(archiveOut, outfile) != ARCHIVE_OK, return -1, "Can't create new archive %s!\n", outfile);
 
 	Stopif(!rewriteZIP(archiveIn, archiveOut), return -1, "Problems rewriting zip!\n");
 	Stopif(archive_read_free(archiveIn) != ARCHIVE_OK, return -1, "Can't free %s!\n", infile);