aboutsummaryrefslogtreecommitdiff
path: root/src/main/test2_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/test2_extractor.c')
-rw-r--r--src/main/test2_extractor.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/main/test2_extractor.c b/src/main/test2_extractor.c
index 4d55dc3..a2c1d53 100644
--- a/src/main/test2_extractor.c
+++ b/src/main/test2_extractor.c
@@ -36,7 +36,6 @@
36#include <unistd.h> 36#include <unistd.h>
37#include <stdlib.h> 37#include <stdlib.h>
38 38
39
40 39
41/** 40/**
42 * Signature of the extract method that each plugin 41 * Signature of the extract method that each plugin
@@ -52,77 +51,78 @@ EXTRACTOR_test2_extract_method (struct EXTRACTOR_ExtractContext *ec)
52 if ((NULL == ec->config) || (0 != strcmp (ec->config, "test2"))) 51 if ((NULL == ec->config) || (0 != strcmp (ec->config, "test2")))
53 return; /* only run in test mode */ 52 return; /* only run in test mode */
54 if (4 != ec->read (ec->cls, &dp, 4)) 53 if (4 != ec->read (ec->cls, &dp, 4))
55 { 54 {
56 fprintf (stderr, "Reading at offset 0 failed\n"); 55 fprintf (stderr, "Reading at offset 0 failed\n");
57 ABORT (); 56 ABORT ();
58 } 57 }
59 if (0 != strncmp ("test", dp, 4)) 58 if (0 != strncmp ("test", dp, 4))
60 { 59 {
61 fprintf (stderr, "Unexpected data at offset 0\n"); 60 fprintf (stderr, "Unexpected data at offset 0\n");
62 ABORT (); 61 ABORT ();
63 } 62 }
64 if ( (1024 * 150 != ec->get_size (ec->cls)) && 63 if ( (1024 * 150 != ec->get_size (ec->cls)) &&
65 (UINT64_MAX != ec->get_size (ec->cls)) ) 64 (UINT64_MAX != ec->get_size (ec->cls)) )
66 { 65 {
67 fprintf (stderr, "Unexpected file size returned (expected 150k)\n"); 66 fprintf (stderr, "Unexpected file size returned (expected 150k)\n");
68 ABORT (); 67 ABORT ();
69 } 68 }
70 if (1024 * 100 + 4 != ec->seek (ec->cls, 1024 * 100 + 4, SEEK_SET)) 69 if (1024 * 100 + 4 != ec->seek (ec->cls, 1024 * 100 + 4, SEEK_SET))
71 { 70 {
72 fprintf (stderr, "Failure to seek (SEEK_SET)\n"); 71 fprintf (stderr, "Failure to seek (SEEK_SET)\n");
73 ABORT (); 72 ABORT ();
74 } 73 }
75 if (1 != ec->read (ec->cls, &dp, 1)) 74 if (1 != ec->read (ec->cls, &dp, 1))
76 { 75 {
77 fprintf (stderr, "Failure to read at 100k + 4\n"); 76 fprintf (stderr, "Failure to read at 100k + 4\n");
78 ABORT (); 77 ABORT ();
79 } 78 }
80 if ((1024 * 100 + 4) % 256 != * (unsigned char *) dp) 79 if ((1024 * 100 + 4) % 256 != *(unsigned char *) dp)
81 { 80 {
82 fprintf (stderr, "Unexpected data at offset 100k + 4\n"); 81 fprintf (stderr, "Unexpected data at offset 100k + 4\n");
83 ABORT (); 82 ABORT ();
84 } 83 }
85 if (((1024 * 100 + 4) + 1 - (1024 * 50 + 7)) != 84 if (((1024 * 100 + 4) + 1 - (1024 * 50 + 7)) !=
86 ec->seek (ec->cls, - (1024 * 50 + 7), SEEK_CUR)) 85 ec->seek (ec->cls, -(1024 * 50 + 7), SEEK_CUR))
87 { 86 {
88 fprintf (stderr, "Failure to seek (SEEK_SET)\n"); 87 fprintf (stderr, "Failure to seek (SEEK_SET)\n");
89 ABORT (); 88 ABORT ();
90 } 89 }
91 if (1 != ec->read (ec->cls, &dp, 1)) 90 if (1 != ec->read (ec->cls, &dp, 1))
92 { 91 {
93 fprintf (stderr, "Failure to read at 50k - 3\n"); 92 fprintf (stderr, "Failure to read at 50k - 3\n");
94 ABORT (); 93 ABORT ();
95 } 94 }
96 if (((1024 * 100 + 4) + 1 - (1024 * 50 + 7)) % 256 != * (unsigned char *) dp) 95 if (((1024 * 100 + 4) + 1 - (1024 * 50 + 7)) % 256 != *(unsigned char *) dp)
97 { 96 {
98 fprintf (stderr, "Unexpected data at offset 100k - 3\n"); 97 fprintf (stderr, "Unexpected data at offset 100k - 3\n");
99 ABORT (); 98 ABORT ();
100 } 99 }
101 if (1024 * 150 != ec->seek (ec->cls, 0, SEEK_END)) 100 if (1024 * 150 != ec->seek (ec->cls, 0, SEEK_END))
102 { 101 {
103 fprintf (stderr, "Failure to seek (SEEK_END)\n"); 102 fprintf (stderr, "Failure to seek (SEEK_END)\n");
104 ABORT (); 103 ABORT ();
105 } 104 }
106 if (0 != ec->read (ec->cls, &dp, 1)) 105 if (0 != ec->read (ec->cls, &dp, 1))
107 { 106 {
108 fprintf (stderr, "Failed to receive EOF at 150k\n"); 107 fprintf (stderr, "Failed to receive EOF at 150k\n");
109 ABORT (); 108 ABORT ();
110 } 109 }
111 if (1024 * 150 - 2 != ec->seek (ec->cls, -2, SEEK_END)) 110 if (1024 * 150 - 2 != ec->seek (ec->cls, -2, SEEK_END))
112 { 111 {
113 fprintf (stderr, "Failure to seek (SEEK_END - 2)\n"); 112 fprintf (stderr, "Failure to seek (SEEK_END - 2)\n");
114 ABORT (); 113 ABORT ();
115 } 114 }
116 if (1 != ec->read (ec->cls, &dp, 1)) 115 if (1 != ec->read (ec->cls, &dp, 1))
117 { 116 {
118 fprintf (stderr, "Failure to read at 150k - 3\n"); 117 fprintf (stderr, "Failure to read at 150k - 3\n");
119 ABORT (); 118 ABORT ();
120 } 119 }
121 if ((1024 * 150 - 2) % 256 != * (unsigned char *) dp) 120 if ((1024 * 150 - 2) % 256 != *(unsigned char *) dp)
122 { 121 {
123 fprintf (stderr, "Unexpected data at offset 150k - 3\n"); 122 fprintf (stderr, "Unexpected data at offset 150k - 3\n");
124 ABORT (); 123 ABORT ();
125 } 124 }
126} 125}
127 126
127
128/* end of test2_extractor.c */ 128/* end of test2_extractor.c */