Mercurial > libpst
comparison src/deltasearch.cpp @ 128:7f747c8c9d02
cleanup installed headers
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 05 Feb 2009 09:22:22 -0800 |
parents | 0f1492b7fe8b |
children | fc11b1d1ad34 |
comparison
equal
deleted
inserted
replaced
127:c2482d0cd84e | 128:7f747c8c9d02 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
2 #include <iostream> | 3 #include <iostream> |
3 #include <sys/types.h> | 4 #include <sys/types.h> |
4 #include <sys/stat.h> | 5 #include <sys/stat.h> |
5 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <vector> | |
6 using namespace std; | 8 using namespace std; |
7 extern "C" { | 9 extern "C" { |
8 #include "define.h" | 10 #include "define.h" |
9 }; | 11 }; |
10 | 12 |
53 printf("using file %s with delta %d looking for %s\n", argv[1], d, argv[3]); | 55 printf("using file %s with delta %d looking for %s\n", argv[1], d, argv[3]); |
54 if (fd) { | 56 if (fd) { |
55 struct stat st; | 57 struct stat st; |
56 fstat(fd, &st); | 58 fstat(fd, &st); |
57 off_t size = st.st_size; | 59 off_t size = st.st_size; |
58 char buf[size]; | 60 vector <char> buf(size); |
59 size_t s = read(fd, buf, size); | 61 size_t s = read(fd, &buf[0], size); |
60 pst_debug_hexdumper(stdout, buf, s, 16, 0); | 62 pst_debug_hexdumper(stdout, &buf[0], s, 16, 0); |
61 printf("\n\n dump decrypted data \n"); | 63 printf("\n\n dump decrypted data \n"); |
62 for (off_t i=0; i<size; i++) { | 64 for (off_t i=0; i<size; i++) { |
63 buf[i] = comp_enc[(unsigned char)buf[i]]; | 65 buf[i] = comp_enc[(unsigned char)buf[i]]; |
64 } | 66 } |
65 pst_debug_hexdumper(stdout, buf, s, 16, 0); | 67 pst_debug_hexdumper(stdout, &buf[0], s, 16, 0); |
66 close(fd); | 68 close(fd); |
67 } | 69 } |
68 return 0; | 70 return 0; |
69 } | 71 } |