Browse code

partial pull-request from jfehr, ommiting changes to openssl lib names: Changes needed to build Cmam in VS2015.

Micah Snyder authored on 2017/09/09 04:50:46
Showing 2 changed files
... ...
@@ -14,7 +14,12 @@ cat >config.h <<END
14 14
 END
15 15
 
16 16
 # Change if your VS 2015 path differs.
17
-VS_PATH='C:\Program Files\Microsoft Visual Studio 14.0\VC'
17
+if [ $(uname -m) == 'x86_64' ]; then
18
+	VS_PATH='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC'
19
+else
20
+	VS_PATH='C:\Program Files\Microsoft Visual Studio 14.0\VC'
21
+fi
22
+
18 23
 
19 24
 # Do not change anything below unless you know what you're doing.
20 25
 LIBMS_PATH=`pwd`
... ...
@@ -36,28 +41,37 @@ compile_for () {
36 36
     cp mspack/mspack.lib "C:\\clamdeps\\win$2\\mspack\\lib"
37 37
 }
38 38
 
39
-copy_lib () {
39
+copy_headers () {
40 40
     echo 'Copying headers and source files ...'
41 41
 
42 42
     cd ${LIBMS_PATH}
43
-    cp *.c "C:\\clamdeps\\win$1\\mspack\\include"
44 43
     cp *.h "C:\\clamdeps\\win$1\\mspack\\include"
45 44
 }
46 45
 
47
-if [[ -d 'C:\clamdeps\win32\mspack\include' && -d 'C:\clamdeps\win32\mspack\lib' && -d 'C:\clamdeps\win64\mspack\include' && -d 'C:\clamdeps\win64\mspack\lib' ]]; then
46
+if ! [ -d 'C:\clamdeps\win32\mspack\include' ]; then
47
+	mkdir -p 'C:\clamdeps\win32\mspack\include'
48
+fi
48 49
 
49
-    copy_lib 32
50
-    copy_lib 64
50
+if ! [ -d 'C:\clamdeps\win32\mspack\lib' ]; then
51
+	mkdir -p 'C:\clamdeps\win32\mspack\lib'
52
+fi
51 53
 
52
-    if [ $(uname -m) == 'x86_64' ]; then
53
-        compile_for 'amd64_x86' 32
54
-        compile_for 'amd64' 64
55
-    else
56
-        compile_for 'x86' 32
57
-        compile_for 'x86_amd64' 64
54
+if ! [ -d 'C:\clamdeps\win64\mspack\include' ]; then
55
+	mkdir -p 'C:\clamdeps\win64\mspack\include'
56
+fi
58 57
 
59
-    fi
60
-else
61
-    echo 'ERROR: mspack include and/or lib clamdep dirs not found'
58
+if ! [ -d 'C:\clamdeps\win64\mspack\lib' ]; then
59
+	mkdir -p 'C:\clamdeps\win64\mspack\lib'
62 60
 fi
63 61
 
62
+copy_headers 32
63
+copy_headers 64
64
+
65
+if [ $(uname -m) == 'x86_64' ]; then
66
+    compile_for 'amd64_x86' 32
67
+    compile_for 'amd64' 64
68
+else
69
+    compile_for 'x86' 32
70
+    compile_for 'x86_amd64' 64
71
+
72
+fi
... ...
@@ -908,18 +908,18 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags)
908 908
                     if (length < 0)
909 909
                         length = 0;
910 910
 
911
-                    cli_dbgmsg("cli_pdf: calculated length %jd\n", (intmax_t)length);
911
+                    cli_dbgmsg("cli_pdf: calculated length %jd\n", length);
912 912
                 } else {
913 913
                     if (size > (size_t)length+2) {
914 914
                         cli_dbgmsg("cli_pdf: calculated length %jd < %jd\n",
915
-                                   (intmax_t)length, (intmax_t)size);
915
+                                   length, size);
916 916
                         length = size;
917 917
                     }
918 918
                 }
919 919
 
920 920
                 if (orig_length && size > (size_t)orig_length + 20) {
921 921
                     cli_dbgmsg("cli_pdf: orig length: %jd, length: %jd, size: %jd\n",
922
-                               (intmax_t)orig_length, (intmax_t)length, (intmax_t)size);
922
+                               orig_length, length, size);
923 923
                     pdfobj_flag(pdf, obj, BAD_STREAMLEN);
924 924
                 }
925 925
 
... ...
@@ -1055,7 +1055,7 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags)
1055 1055
         }
1056 1056
     } while (0);
1057 1057
 
1058
-    cli_dbgmsg("cli_pdf: extracted %jd bytes %u %u obj\n", (intmax_t)sum, obj->id>>8, obj->id&0xff);
1058
+    cli_dbgmsg("cli_pdf: extracted %jd bytes %u %u obj\n", sum, obj->id>>8, obj->id&0xff);
1059 1059
     cli_dbgmsg("         ... to %s\n", fullname);
1060 1060
 
1061 1061
     if (flags & PDF_EXTRACT_OBJ_SCAN && sum) {
... ...
@@ -2320,7 +2320,7 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2320 2320
 
2321 2321
     if (pdfver != start || offset) {
2322 2322
         pdf.flags |= 1 << BAD_PDF_HEADERPOS;
2323
-        cli_dbgmsg("cli_pdf: PDF header is not at position 0: %jd\n",(intmax_t)(pdfver-start+offset));
2323
+        cli_dbgmsg("cli_pdf: PDF header is not at position 0: %jd\n",(pdfver-start+offset));
2324 2324
 #if HAVE_JSON
2325 2325
         if (pdfobj)
2326 2326
             cli_jsonbool(pdfobj, "BadVersionLocation", 1);
... ...
@@ -2429,7 +2429,7 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2429 2429
     while ((rc = pdf_findobj(&pdf)) > 0) {
2430 2430
         struct pdf_obj *obj = &pdf.objs[pdf.nobjs-1];
2431 2431
 
2432
-        cli_dbgmsg("cli_pdf: found %d %d obj @%jd\n", obj->id >> 8, obj->id&0xff, (intmax_t)(obj->start + offset));
2432
+        cli_dbgmsg("cli_pdf: found %d %d obj @%jd\n", obj->id >> 8, obj->id&0xff, (obj->start + offset));
2433 2433
     }
2434 2434
 
2435 2435
     if (pdf.nobjs)