aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_file_information.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/fs/test_fs_file_information.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/fs/test_fs_file_information.c')
-rw-r--r--src/fs/test_fs_file_information.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/src/fs/test_fs_file_information.c b/src/fs/test_fs_file_information.c
index 97a63062e..db5a8448a 100644
--- a/src/fs/test_fs_file_information.c
+++ b/src/fs/test_fs_file_information.c
@@ -50,11 +50,8 @@
50 50
51 51
52static int 52static int
53mycleaner (void *cls, 53mycleaner (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length,
54 struct GNUNET_FS_FileInformation *fi, 54 struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri,
55 uint64_t length,
56 struct GNUNET_CONTAINER_MetaData *meta,
57 struct GNUNET_FS_Uri **uri,
58 struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) 55 struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info)
59{ 56{
60 return GNUNET_OK; 57 return GNUNET_OK;
@@ -62,9 +59,8 @@ mycleaner (void *cls,
62 59
63 60
64static void 61static void
65run (void *cls, 62run (void *cls, char *const *args, const char *cfgfile,
66 char *const *args, 63 const struct GNUNET_CONFIGURATION_Handle *cfg)
67 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
68{ 64{
69 const char *keywords[] = { 65 const char *keywords[] = {
70 "down_foo", 66 "down_foo",
@@ -89,9 +85,7 @@ run (void *cls,
89 for (i = 0; i < FILESIZE; i++) 85 for (i = 0; i < FILESIZE; i++)
90 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); 86 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
91 GNUNET_assert (FILESIZE == 87 GNUNET_assert (FILESIZE ==
92 GNUNET_DISK_fn_write (fn1, 88 GNUNET_DISK_fn_write (fn1, buf, FILESIZE,
93 buf,
94 FILESIZE,
95 GNUNET_DISK_PERM_USER_READ | 89 GNUNET_DISK_PERM_USER_READ |
96 GNUNET_DISK_PERM_USER_WRITE)); 90 GNUNET_DISK_PERM_USER_WRITE));
97 GNUNET_free (buf); 91 GNUNET_free (buf);
@@ -101,9 +95,7 @@ run (void *cls,
101 for (i = 0; i < FILESIZE; i++) 95 for (i = 0; i < FILESIZE; i++)
102 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); 96 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
103 GNUNET_assert (FILESIZE == 97 GNUNET_assert (FILESIZE ==
104 GNUNET_DISK_fn_write (fn2, 98 GNUNET_DISK_fn_write (fn2, buf, FILESIZE,
105 buf,
106 FILESIZE,
107 GNUNET_DISK_PERM_USER_READ | 99 GNUNET_DISK_PERM_USER_READ |
108 GNUNET_DISK_PERM_USER_WRITE)); 100 GNUNET_DISK_PERM_USER_WRITE));
109 GNUNET_free (buf); 101 GNUNET_free (buf);
@@ -114,21 +106,22 @@ run (void *cls,
114 bo.anonymity_level = 1; 106 bo.anonymity_level = 1;
115 bo.replication_level = 0; 107 bo.replication_level = 0;
116 bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 108 bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
117 fi1 = GNUNET_FS_file_information_create_from_file (fs, 109 fi1 =
118 "file_information-context1", 110 GNUNET_FS_file_information_create_from_file (fs,
119 fn1, 111 "file_information-context1",
120 kuri, 112 fn1, kuri, meta, GNUNET_YES,
121 meta, GNUNET_YES, &bo); 113 &bo);
122 GNUNET_assert (fi1 != NULL); 114 GNUNET_assert (fi1 != NULL);
123 fi2 = GNUNET_FS_file_information_create_from_file (fs, 115 fi2 =
124 "file_information-context2", 116 GNUNET_FS_file_information_create_from_file (fs,
125 fn2, 117 "file_information-context2",
126 kuri, 118 fn2, kuri, meta, GNUNET_YES,
127 meta, GNUNET_YES, &bo); 119 &bo);
128 GNUNET_assert (fi2 != NULL); 120 GNUNET_assert (fi2 != NULL);
129 fidir = GNUNET_FS_file_information_create_empty_directory (fs, 121 fidir =
130 "file_information-context-dir", 122 GNUNET_FS_file_information_create_empty_directory (fs,
131 kuri, meta, &bo); 123 "file_information-context-dir",
124 kuri, meta, &bo);
132 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1)); 125 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
133 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2)); 126 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
134 GNUNET_FS_uri_destroy (kuri); 127 GNUNET_FS_uri_destroy (kuri);
@@ -165,9 +158,10 @@ testThumbnail ()
165 ex = EXTRACTOR_plugin_add_config (ex, "mime", 158 ex = EXTRACTOR_plugin_add_config (ex, "mime",
166 EXTRACTOR_OPTION_DEFAULT_POLICY); 159 EXTRACTOR_OPTION_DEFAULT_POLICY);
167 m = GNUNET_CONTAINER_meta_data_create (); 160 m = GNUNET_CONTAINER_meta_data_create ();
168 if (3 != GNUNET_FS_meta_data_extract_from_file (m, 161 if (3 !=
169 "test_fs_file_information_meta_data_image.jpg", 162 GNUNET_FS_meta_data_extract_from_file (m,
170 ex)) 163 "test_fs_file_information_meta_data_image.jpg",
164 ex))
171 { 165 {
172 GNUNET_break (0); 166 GNUNET_break (0);
173 EXTRACTOR_plugin_remove_all (ex); 167 EXTRACTOR_plugin_remove_all (ex);
@@ -187,8 +181,9 @@ testThumbnail ()
187 } 181 }
188 GNUNET_free (thumb); 182 GNUNET_free (thumb);
189 GNUNET_CONTAINER_meta_data_add_publication_date (d); 183 GNUNET_CONTAINER_meta_data_add_publication_date (d);
190 date = GNUNET_CONTAINER_meta_data_get_by_type (d, 184 date =
191 EXTRACTOR_METATYPE_PUBLICATION_DATE); 185 GNUNET_CONTAINER_meta_data_get_by_type (d,
186 EXTRACTOR_METATYPE_PUBLICATION_DATE);
192 if (date == NULL) 187 if (date == NULL)
193 { 188 {
194 GNUNET_break (0); 189 GNUNET_break (0);
@@ -227,9 +222,9 @@ main (int argc, char *argv[])
227 NULL); 222 NULL);
228 if (0 != testThumbnail ()) 223 if (0 != testThumbnail ())
229 return 1; 224 return 1;
230 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, 225 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
231 argvx, "test-fs-file_information", 226 "test-fs-file_information", "nohelp", options, &run,
232 "nohelp", options, &run, NULL); 227 NULL);
233 return 0; 228 return 0;
234} 229}
235 230