]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dvd.c
kes Apply Eric's patch for recycling the Scratch pool.
[bacula/bacula] / bacula / src / stored / dvd.c
index 5fd7ea7d7503a26fbcac6a0e62a36260c165e0df..8cb740e3c0d15fbcc71de688a54edbed57fd94db 100644 (file)
@@ -8,19 +8,32 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2005-2006 Kern Sibbald
+   Bacula® - The Network Backup Solution
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   version 2 as amended with additional clauses defined in the
-   file LICENSE in the main source directory.
+   Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
-   the file LICENSE for additional details.
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
 
- */
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 
 #include "bacula.h"
 #include "stored.h"
@@ -52,7 +65,7 @@ static void add_file_and_part_name(DEVICE *dev, POOL_MEM &archive_name)
 {
    char partnumber[20];
 
-   if (archive_name.c_str()[strlen(archive_name.c_str())-1] != '/') {
+   if (!IsPathSeparator(archive_name.c_str()[strlen(archive_name.c_str())-1])) {
       pm_strcat(archive_name, "/");
    }
 
@@ -416,10 +429,10 @@ static bool dvd_open_first_part(DCR *dcr, int mode)
 /* 
  * Do an lseek on a DVD handling all the different parts
  */
-off_t lseek_dvd(DCR *dcr, off_t offset, int whence)
+boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence)
 {
    DEVICE *dev = dcr->dev;
-   off_t pos;
+   boffset_t pos;
    char ed1[50], ed2[50];
    
    Dmsg5(400, "Enter lseek_dvd fd=%d off=%s w=%d part=%d nparts=%d\n", dev->fd,
@@ -433,7 +446,12 @@ off_t lseek_dvd(DCR *dcr, off_t offset, int whence)
          if ((uint64_t)offset == dev->part_start || 
              (uint64_t)offset < dev->part_start+dev->part_size) {
             /* We are staying in the current part, just seek */
-            if ((pos = lseek(dev->fd, offset-dev->part_start, SEEK_SET)) < 0) {
+#if defined(HAVE_WIN32)
+            pos = _lseeki64(dev->fd, offset-dev->part_start, SEEK_SET);
+#else
+            pos = lseek(dev->fd, offset-dev->part_start, SEEK_SET);
+#endif
+            if (pos < 0) {
                return pos;
             } else {
                return pos + dev->part_start;
@@ -721,7 +739,7 @@ bool check_can_write_on_non_blank_dvd(DCR *dcr)
             /* Found a file, checking it is empty */
             POOL_MEM filename(PM_FNAME);
             pm_strcpy(filename, dev->device->mount_point);
-            if (filename.c_str()[strlen(filename.c_str())-1] != '/') {
+            if (!IsPathSeparator(filename.c_str()[strlen(filename.c_str())-1])) {
                pm_strcat(filename, "/");
             }
             pm_strcat(filename, result->d_name);