[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23023 - Extractor/src/main
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23023 - Extractor/src/main |
Date: |
Tue, 31 Jul 2012 23:19:49 +0200 |
Author: grothoff
Date: 2012-07-31 23:19:49 +0200 (Tue, 31 Jul 2012)
New Revision: 23023
Modified:
Extractor/src/main/extractor_datasource.c
Extractor/src/main/extractor_plugin_main.c
Log:
LRN: pos is the position in the file (i.e. file pointer offset from the
beginning of the file).
buffer_pos is the position within the buffer.
buffer_bytes is the length of the buffer.
When we run out of bytes to give, this:
old_off = bfds->fpos + bfds->buffer_pos + bfds->buffer_bytes;
will overshoot the position, because bfds->buffer_pos is equal to
bfds->buffer_bytes.
Same for
if ( (bfds->buffer_bytes == bfds->buffer_pos) && (0 !=
bfds_pick_next_buffer_at (bfds, bfds->fpos + bfds->buffer_pos +
bfds->buffer_bytes)) )
Modified: Extractor/src/main/extractor_datasource.c
===================================================================
--- Extractor/src/main/extractor_datasource.c 2012-07-31 18:48:06 UTC (rev
23022)
+++ Extractor/src/main/extractor_datasource.c 2012-07-31 21:19:49 UTC (rev
23023)
@@ -406,7 +406,7 @@
size_t avail;
size_t ret;
- old_off = bfds->fpos + bfds->buffer_pos + bfds->buffer_bytes;
+ old_off = bfds->fpos + bfds->buffer_pos;
if (old_off == bfds->fsize)
return 0; /* end of stream */
ret = 0;
@@ -414,7 +414,7 @@
{
if ( (bfds->buffer_bytes == bfds->buffer_pos) &&
(0 != bfds_pick_next_buffer_at (bfds,
- bfds->fpos + bfds->buffer_pos +
bfds->buffer_bytes)) )
+ bfds->fpos + bfds->buffer_bytes)) )
{
/* revert to original position, invalidate buffer */
bfds->fpos = old_off;
@@ -1053,8 +1053,12 @@
int fd;
struct stat sb;
int64_t fsize;
+ int winmode = 0;
+#if WINDOWS
+ winmode = O_BINARY;
+#endif
- if (-1 == (fd = open (filename, O_RDONLY | O_LARGEFILE)))
+ if (-1 == (fd = open (filename, O_RDONLY | O_LARGEFILE | winmode)))
{
LOG_STRERROR_FILE ("open", filename);
return NULL;
Modified: Extractor/src/main/extractor_plugin_main.c
===================================================================
--- Extractor/src/main/extractor_plugin_main.c 2012-07-31 18:48:06 UTC (rev
23022)
+++ Extractor/src/main/extractor_plugin_main.c 2012-07-31 21:19:49 UTC (rev
23023)
@@ -33,9 +33,11 @@
#include "extractor_plugin_main.h"
#include <dirent.h>
#include <sys/types.h>
+#if LINUX
#include <sys/wait.h>
#include <sys/shm.h>
#include <signal.h>
+#endif
/**
@@ -363,9 +365,16 @@
pc->shm_map_size = init.shm_map_size;
#if WINDOWS
+ /* FIXME: storing pointer in an int */
+ pc->shm_id = OpenFileMapping (FILE_MAP_READ, FALSE, shm_name);
+ if (NULL == pc->shm_id)
+ return -1;
pc->shm = MapViewOfFile (pc->shm_id, FILE_MAP_READ, 0, 0, 0);
if (NULL == pc->shm)
+ {
+ CloseHandle (pc->shm_id);
return -1;
+ }
#else
pc->shm_id = shm_open (shm_name, O_RDONLY, 0);
if (-1 == pc->shm_id)
@@ -604,8 +613,9 @@
LOG_STRERROR ("malloc");
return NULL;
}
- GetSystemInfo (&si);
- ret->allocation_granularity = si.dwAllocationGranularity;
+ memset (ret, 0, sizeof (struct EXTRACTOR_PluginList));
+ /*GetSystemInfo (&si);
+ ret->allocation_granularity = si.dwAllocationGranularity;*/
EXTRACTOR_read_all_ (fd, &i, sizeof (size_t));
if (NULL == (ret->libname = malloc (i)))
{
@@ -668,8 +678,7 @@
close (out);
return;
}
- plugin_main (plugin,
- in, out);
+ EXTRACTOR_plugin_main_ (plugin, in, out);
close (in);
close (out);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23023 - Extractor/src/main,
gnunet <=