Browse Source

Merge branch 'master' of github.com:pczajkowski/anonymizeDOCXComments

Piotr Czajkowski 6 years ago
parent
commit
a1d3019175
7 changed files with 21 additions and 13 deletions
  1. 1 0
      .gitignore
  2. 3 3
      comments.c
  3. 1 4
      comments.h
  4. 0 0
      mac/placeholder
  5. 13 0
      makefile
  6. 2 2
      zip.c
  7. 1 4
      zip.h

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 *.o
+*.dSYM

+ 3 - 3
comments.c

@@ -3,7 +3,7 @@
 #include "comments.h"
 #include "stopif.h"
 
-char* anonymizeAuthor(dictionary *authors, xmlChar const *authorName) {
+char* anonymizeAuthor(dictionary *authors, const xmlChar *authorName) {
 	char *name = (char*)authorName;
 	char *newName = (char*)dictionary_find(authors, name);
 
@@ -16,12 +16,12 @@ char* anonymizeAuthor(dictionary *authors, xmlChar const *authorName) {
 	return (char*)dictionary_find(authors, name);
 }
 
-void printAuthors(dictionary *authors) {
+void printAuthors(const dictionary *authors) {
 	for (int i=0; i<authors->length; i++)
 		printf("\"%s\" is now \"%s\"\n", authors->pairs[i]->key, (char*)authors->pairs[i]->value);
 }
 
-int processAuthors(xmlXPathObjectPtr authors) {
+int processAuthors(const xmlXPathObjectPtr authors) {
 	dictionary *anonAuthors = dictionary_new();
 
 	for (int i=0; i < authors->nodesetval->nodeNr; i++){

+ 1 - 4
comments.h

@@ -3,7 +3,4 @@
 #include "dict.h"
 #include "xmlbuff.h"
 
-char* anonymizeAuthor(dictionary *authors, xmlChar const *authorName);
-void printAuthors(dictionary *authors);
-int processAuthors(xmlXPathObjectPtr authors);
-int anonymizeComments(XMLBuff *infile);
+int anonymizeComments(XMLBuff *infile);

+ 0 - 0
mac/placeholder


+ 13 - 0
makefile

@@ -4,6 +4,8 @@ objects=keyval.o dict.o comments.o zip.o xmlbuff.o
 mingwCFLAGS=`x86_64-w64-mingw32-pkg-config --cflags --libs libxml-2.0` -g -Wall -Wextra -O3 -std=gnu99
 mingwLDLIBS=`x86_64-w64-mingw32-pkg-config --libs libxml-2.0` -larchive
 mingw=x86_64-w64-mingw32-gcc
+MACCFLAGS=`pkg-config --cflags --libs libxml-2.0 libarchive` -g -Wall -Wextra -O3 -std=gnu99
+MACLDLIBS=`pkg-config --libs libxml-2.0 libarchive`
 
 anonymize: $(objects)
 
@@ -15,9 +17,20 @@ bin/anonymize.exe:
 	$(mingw) $(mingwCFLAGS) -c xmlbuff.c $(mingwLDLIBS)
 	$(mingw) $(mingwCFLAGS) anonymize.c $(objects) $(mingwLDLIBS) -o $@
 
+mac/anonymize:
+	gcc $(MACCFLAGS) -c keyval.c $(MACLDLIBS)
+	gcc $(MACCFLAGS) -c dict.c $(MACLDLIBS)
+	gcc $(MACCFLAGS) -c comments.c $(MACLDLIBS)
+	gcc $(MACCFLAGS) -c zip.c $(MACLDLIBS)
+	gcc $(MACCFLAGS) -c xmlbuff.c $(MACLDLIBS)
+	gcc $(MACCFLAGS) anonymize.c $(objects) $(MACLDLIBS) -o $@
+
+.PHONY: clean
 clean:
 	rm *.o
 
 win: bin/anonymize.exe
 
+mac: mac/anonymize
+
 default: anonymize

+ 2 - 2
zip.c

@@ -39,7 +39,7 @@ int rewriteZIP(struct archive *archiveIn, struct archive *archiveOut) {
 	return 1;
 }
 
-int processDOCX(char const *infile, char const *outfile) {
+int processDOCX(const char *infile, const char *outfile) {
 	struct archive *archiveIn;
 	struct archive *archiveOut;
 
@@ -58,7 +58,7 @@ int processDOCX(char const *infile, char const *outfile) {
 	return 1;
 }
 
-int process(char const *infile, char *outfile) {
+int process(const char *infile, char *outfile) {
 	if (!outfile || strcmp(infile, outfile) == 0){
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);

+ 1 - 4
zip.h

@@ -4,7 +4,4 @@
 #include <string.h>
 #include "comments.h"
 
-int processComments(struct archive *archiveOut, XMLBuff *comments);
-int rewriteZIP(struct archive *archiveIn, struct archive *archiveOut);
-int processDOCX(char const *infile, char const *outfile);
-int process(char const *infile, char *outfile);
+int process(char const *infile, char *outfile);