update to compile with c++11 and beyond.

This commit is contained in:
Kelvin Sherlock 2016-08-15 12:29:06 -04:00
parent 5d1b81ecca
commit 184b69747a
17 changed files with 44 additions and 45 deletions

View File

@ -23,10 +23,12 @@ public:
virtual void markDirty(unsigned block); virtual void markDirty(unsigned block);
// public so make_shared can access it.
ConcreteBlockCache(BlockDevicePointer device, unsigned size);
private: private:
ConcreteBlockCache(BlockDevicePointer device, unsigned size);
struct Entry { struct Entry {
unsigned block; unsigned block;

View File

@ -22,10 +22,12 @@ class MappedBlockCache : public BlockCache {
virtual void release(unsigned block, int flags); virtual void release(unsigned block, int flags);
virtual void markDirty(unsigned block); virtual void markDirty(unsigned block);
private:
// public so make_shared can access it.
MappedBlockCache(BlockDevicePointer device, void *data); MappedBlockCache(BlockDevicePointer device, void *data);
private:
void sync(unsigned block); void sync(unsigned block);
uint8_t *_data; uint8_t *_data;

View File

@ -2,7 +2,7 @@
#ifndef __COMMON_SMART_POINTERS_H__ #ifndef __COMMON_SMART_POINTERS_H__
#define __COMMON_SMART_POINTERS_H__ #define __COMMON_SMART_POINTERS_H__
#ifdef CPP0X #if 1
//C++0x //C++0x
#include <memory> #include <memory>

View File

@ -1,7 +1,7 @@
#ifndef __COMMON_UNORDERED_MAP_H__ #ifndef __COMMON_UNORDERED_MAP_H__
#define __COMMON_UNORDERED_MAP_H__ #define __COMMON_UNORDERED_MAP_H__
#ifdef CPP0X #if 1
//c++0x //c++0x
#include <unordered_map> #include <unordered_map>
#define UNORDERED_MAP(...) std::unordered_map(__VA_ARGS__) #define UNORDERED_MAP(...) std::unordered_map(__VA_ARGS__)

View File

@ -26,12 +26,10 @@ public:
static bool Validate(MappedFile *, const std::nothrow_t &); static bool Validate(MappedFile *, const std::nothrow_t &);
static bool Validate(MappedFile *); static bool Validate(MappedFile *);
private:
DavexDiskImage();
DavexDiskImage(MappedFile *); DavexDiskImage(MappedFile *);
private:
DavexDiskImage();
bool _changed; bool _changed;
std::string _volumeName; std::string _volumeName;

View File

@ -29,11 +29,12 @@ public:
virtual BlockCachePointer createBlockCache(); virtual BlockCachePointer createBlockCache();
private:
DiskCopy42Image(); DiskCopy42Image();
DiskCopy42Image(MappedFile *); DiskCopy42Image(MappedFile *);
private:
bool _changed; bool _changed;
}; };

View File

@ -64,10 +64,11 @@ public:
static bool Validate(MappedFile *, const std::nothrow_t &); static bool Validate(MappedFile *, const std::nothrow_t &);
static bool Validate(MappedFile *); static bool Validate(MappedFile *);
ProDOSOrderDiskImage(MappedFile *);
private: private:
ProDOSOrderDiskImage(); ProDOSOrderDiskImage();
ProDOSOrderDiskImage(MappedFile *);
}; };
class DOSOrderDiskImage : public DiskImage { class DOSOrderDiskImage : public DiskImage {
@ -80,10 +81,11 @@ public:
static bool Validate(MappedFile *, const std::nothrow_t &); static bool Validate(MappedFile *, const std::nothrow_t &);
static bool Validate(MappedFile *); static bool Validate(MappedFile *);
DOSOrderDiskImage(MappedFile *);
private: private:
DOSOrderDiskImage(); DOSOrderDiskImage();
DOSOrderDiskImage(MappedFile *);
}; };

View File

@ -34,12 +34,10 @@ public:
virtual unsigned blocks(); virtual unsigned blocks();
private:
RawDevice(const char *name, File::FileFlags flags); RawDevice(const char *name, File::FileFlags flags);
RawDevice(File& file, File::FileFlags flags); RawDevice(File& file, File::FileFlags flags);
private:
void devSize(int fd); void devSize(int fd);

View File

@ -26,12 +26,11 @@ public:
static bool Validate(MappedFile *); static bool Validate(MappedFile *);
UniversalDiskImage(MappedFile *);
private: private:
UniversalDiskImage(); UniversalDiskImage();
UniversalDiskImage(MappedFile *);
uint32_t _format; uint32_t _format;
uint32_t _flags; uint32_t _flags;
uint32_t _blocks; uint32_t _blocks;

View File

@ -1,5 +1,5 @@
CC = g++ CC = c++
CPPFLAGS += -Wall -W -Wno-multichar -I. -O2 -g CPPFLAGS += -Wall -W -Wno-multichar -Wno-c++11-narrowing -I. -O2 -g -std=c++11
LIBS += -lpthread LIBS += -lpthread
UNAME = $(shell uname -s) UNAME = $(shell uname -s)
@ -92,7 +92,6 @@ EXCEPTION_OBJECTS += POSIX/Exception.o
all: $(TARGETS) all: $(TARGETS)
apfm: o/apfm apfm: o/apfm
@true @true
@ -108,9 +107,10 @@ profuse: o/profuse
xattr: o/xattr xattr: o/xattr
@true @true
o:
mkdir $@
o/xattr: bin/xattr.o | o
o/xattr: bin/xattr.o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
o/newfs_pascal: bin/newfs_pascal.o \ o/newfs_pascal: bin/newfs_pascal.o \
@ -120,7 +120,7 @@ o/newfs_pascal: bin/newfs_pascal.o \
${FILE_OBJECTS} \ ${FILE_OBJECTS} \
${COMMON_OBJECTS} \ ${COMMON_OBJECTS} \
${EXCEPTION_OBJECTS} \ ${EXCEPTION_OBJECTS} \
${PASCAL_OBJECTS} ${PASCAL_OBJECTS} | o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
o/apfm: bin/apfm.o \ o/apfm: bin/apfm.o \
@ -130,7 +130,7 @@ o/apfm: bin/apfm.o \
${FILE_OBJECTS} \ ${FILE_OBJECTS} \
${COMMON_OBJECTS} \ ${COMMON_OBJECTS} \
${EXCEPTION_OBJECTS} \ ${EXCEPTION_OBJECTS} \
${PASCAL_OBJECTS} ${PASCAL_OBJECTS} | o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
@ -141,7 +141,7 @@ o/fuse_pascal: bin/fuse_pascal.o bin/fuse_pascal_ops.o \
${FILE_OBJECTS} \ ${FILE_OBJECTS} \
${COMMON_OBJECTS} \ ${COMMON_OBJECTS} \
${EXCEPTION_OBJECTS} \ ${EXCEPTION_OBJECTS} \
${PASCAL_OBJECTS} ${PASCAL_OBJECTS} | o
$(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@
@ -153,7 +153,7 @@ o/profuse: bin/profuse.o bin/profuse_dirent.o bin/profuse_file.o \
${FILE_OBJECTS} \ ${FILE_OBJECTS} \
${COMMON_OBJECTS} \ ${COMMON_OBJECTS} \
${EXCEPTION_OBJECTS} \ ${EXCEPTION_OBJECTS} \
${PRODOS_OBJECTS} ${PRODOS_OBJECTS} | o
$(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@

View File

@ -48,6 +48,9 @@ namespace Pascal {
int truncate(unsigned newSize); int truncate(unsigned newSize);
FileEntry(const char *name, unsigned fileKind);
FileEntry(void *vp);
protected: protected:
virtual void writeDirectoryEntry(LittleEndian::IOBuffer *); virtual void writeDirectoryEntry(LittleEndian::IOBuffer *);
@ -57,8 +60,6 @@ namespace Pascal {
friend class VolumeEntry; friend class VolumeEntry;
FileEntry(const char *name, unsigned fileKind);
FileEntry(void *vp);
FileEntryPointer thisPointer() FileEntryPointer thisPointer()
{ {

View File

@ -56,6 +56,8 @@ namespace Pascal {
int krunch(); int krunch();
VolumeEntry(Device::BlockDevicePointer, const char *name);
VolumeEntry(Device::BlockDevicePointer);
protected: protected:
virtual void writeDirectoryEntry(LittleEndian::IOBuffer *); virtual void writeDirectoryEntry(LittleEndian::IOBuffer *);
@ -66,8 +68,7 @@ namespace Pascal {
VolumeEntry(); VolumeEntry();
VolumeEntry(Device::BlockDevicePointer, const char *name);
VolumeEntry(Device::BlockDevicePointer);
VolumeEntryPointer thisPointer() VolumeEntryPointer thisPointer()
{ {

View File

@ -16,7 +16,8 @@
#include <ProDOS/File.h> #include <ProDOS/File.h>
#include <Device/BlockDevice.h> #include <Device/BlockDevice.h>
#include <tr1/memory> #include <memory>
#include <Common/smart_pointers.h>
enum { enum {
@ -44,7 +45,7 @@ enum {
}; };
class Disk; class Disk;
typedef std::tr1::shared_ptr<Disk> DiskPointer; typedef SHARED_PTR(Disk) DiskPointer;
class Disk { class Disk {

View File

@ -11,7 +11,6 @@
#ifdef __APPLE__ #ifdef __APPLE__
#define __FreeBSD__ 10
#define __DARWIN_64_BIT_INO_T 1 #define __DARWIN_64_BIT_INO_T 1
#endif #endif

View File

@ -1,6 +1,5 @@
#ifdef __APPLE__ #ifdef __APPLE__
#define __FreeBSD__ 10
#define __DARWIN_64_BIT_INO_T 1 #define __DARWIN_64_BIT_INO_T 1
#endif #endif

View File

@ -22,8 +22,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <tr1/memory>
#include <Device/BlockDevice.h> #include <Device/BlockDevice.h>
@ -33,7 +31,6 @@
using std::vector; using std::vector;
using std::string; using std::string;
using std::tr1::shared_ptr;
/* /*

View File

@ -15,7 +15,6 @@
#ifdef __APPLE__ #ifdef __APPLE__
#define __FreeBSD__ 10
#define __DARWIN_64_BIT_INO_T 1 #define __DARWIN_64_BIT_INO_T 1
#endif #endif