Browse Source

Added Borland.h, updated fnmerge to handle multiple periods in path

master
surkeh 5 years ago
parent
commit
97f1f07860
  1. 15
      Makefile
  2. 6
      README.md
  3. 8
      include/Bitmap.h
  4. 181
      include/Borland.h
  5. 165
      include/FileAttributes.h
  6. 93
      src/FileAttributes.c
  7. 112
      src/FileAttributes.h
  8. 175
      test/test.cpp

15
Makefile

@ -1,22 +1,15 @@ @@ -1,22 +1,15 @@
EX=
TESTEX=runtests
CC=g++
SRCDIR=src
INC=include
TESTDIR=test
CFLAGS=-std=c++11 -I"$(SRCDIR)"
CFLAGS=-std=c++11 -I"$(INC)"
all: test
test: FileAttributes.o test.o
tester: $(TESTDIR)/test.cpp
$(CC) $^ $(CFLAGS) -o $(TESTEX) -lboost_unit_test_framework
cp $(TESTEX) .git/hooks/pre-commit
test.o: $(TESTDIR)/test.cpp
$(CC) -c $^ $(CFLAGS)
FileAttributes.o: $(SRCDIR)/FileAttributes.c
$(CC) -c $^ $(CFLAGS)
clean:
rm *.o $(TESTEX) $(EX)
rm $(TESTEX) $(EX)

6
README.md

@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@
# PortLibC
Data types and classes for cross-platform C projects
Header-only data types and classes for cross-platform C projects
* Windows and Linux file attributes conversion
* FILETIME and time_t conversions (part of FileAttributes)
* Linux bitmap structs for compatibility with Windows bitmap structs
* Linux bitmap structs for compatibility with Windows bitmap structs
* Small collection of cross-platform Borland C functions

8
src/Bitmap.h → include/Bitmap.h

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*
* Description: Bitmap structs and defines
*
* Version: 1.0
* Version: 2.0
* Created: 07/26/2017 09:38:18 PM
* Revision: none
* Compiler: gcc
@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
* =====================================================================================
*/
#ifndef PORTLIBCPP_BITMAP_H
#define PORTLIBCPP_BITMAP_H
#ifndef PORTLIBC_BITMAP_H
#define PORTLIBC_BITMAP_H
#include <cstdint>
@ -79,5 +79,5 @@ typedef struct __attribute__ ((packed)) BITMAPINFO { @@ -79,5 +79,5 @@ typedef struct __attribute__ ((packed)) BITMAPINFO {
#endif // not on windows/cygwin/msys2
#endif //PORTLIBCPP_BITMAP_H
#endif //PORTLIBC_BITMAP_H

181
include/Borland.h

@ -0,0 +1,181 @@ @@ -0,0 +1,181 @@
/*
* =====================================================================================
*
* Filename: Borland.h
*
* Description: Various Borland function replacements
*
* Version: 1.0
* Created: 08/24/2017 10:00:40 PM
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
*
* =====================================================================================
*/
#ifndef PORTLIBC_BORLAND_H
#define PORTLIBC_BORLAND_H
// Values set by Borland compiler
#define MAXDRIVE 3
// For 16-bit cpu
//#define MAXPATH 80
//#define MAXDIR 66
//#define MAXFILE 9
//#define MAXEXT 5
// For 32-bit cpu (#if defined(__FLAT__))
#define MAXPATH 260
#define MAXDIR 256
#define MAXFILE 256
#define MAXEXT 256
// For Borlands fnsplit function
#define WILDCARDS 0x01
#define EXTENSION 0x02
#define FILENAME 0x04
#define DIRECTORY 0x08
#define DRIVE 0x10
/*
* === FUNCTION ======================================================================
* Name: fnsplit
* Description: Separates a path into components
* NOTE: Does not handle wildcard * due to shell handling this in Linux
* Return: int, bitflags of what components were found in path, NULL args included
* Argument: const char *, Valid Windows/Posix path
* Argument: char *, Returns drive component, if not NULL and drive was found
* Argument: char *, Returns directory component, if not NULL and dir was found
* Argument: char *, Returns file name component, if not NULL and dir was found
* Argument: char *, Returns extension component, if not NULL and dir was found
* =====================================================================================
*/
inline int fnsplit(const char *path,
char *drive,
char *dir,
char *name,
char *ext)
{
int i = 0; // for loop iterator set after drive letter, if needed
int flags = 0;
if (path != NULL) {
if (path[1] == ':') {
flags |= DRIVE;
if (drive != NULL) {
strncat (drive, path, 2);
drive[2] = '\0';
}
i = 2;
}
// path not necessarily terminated by \0
// parse char by char
char token[MAXPATH];
int iToken = 0;
if (dir != NULL)
dir[0] = '\0';
for ( ; i < MAXPATH; i++) {
// if delimiter, act accordingly
// token is part of the directory
if (path[i] == '/' || path[i] == '\\') {
token[iToken++] = path[i];
token[iToken++] = '\0';
flags |= DIRECTORY;
if (dir != NULL)
strcat (dir, token);
iToken = 0;
continue;
}
// token is name
else if (path[i] == '.') {
token[iToken] = '\0';
if (flags & FILENAME) {
flags |= EXTENSION;
if (ext != NULL)
strcat (ext, token);
}
else {
flags |= FILENAME;
if (name != NULL)
strcpy (name, token);
}
token[0] = '.';
iToken = 1;
continue;
}
// token is name or extension
else if (path[i] == '\0'
|| i >= MAXPATH - 1 ) {
//|| extCount >= MAXEXT - 1) {
if (flags & FILENAME) {
// is extension
token[iToken] = '\0';
flags |= EXTENSION;
if (ext != NULL)
strcat (ext, token);
// all parts gathered, exit function
break;
}
else {
// is name
token[iToken] = '\0';
flags |= FILENAME;
if (name != NULL)
strcpy (name, token);
// all parts gathered, exit
break;
}
}
else {
//if not delimiter, build string
token[iToken++] = path[i];
}
}
}
return flags;
}
/*
* === FUNCTION ======================================================================
* Name: fnmerge
* Description: Combines components into a path
* NOTE: Does not handle wildcard * due to shell handling this in Linux
* Argument: char *, Returns assembled path
* Argument: const char *, Drive component
* Argument: const char *, Directory component
* Argument: const char *, File name component
* Argument: const char *, Extension component
* =====================================================================================
*/
inline void fnmerge (char *path,
const char *drive,
const char *dir,
const char *name,
const char *ext)
{
if (path == NULL)
return;
path[0] = '\0';
if (drive != NULL)
strcat (path, drive);
if (dir != NULL)
strcat (path, dir);
if (name != NULL)
strcat (path, name);
if (ext != NULL)
strcat (path, ext);
}
#endif //PORTLIBC_BORLAND_H

165
include/FileAttributes.h

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
/*
* =====================================================================================
*
* Filename: FileAttributes.h
*
* Description:
*
* Version: 3.0
* Created: 08/23/2017 02:36:05 PM
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
*
* =====================================================================================
*/
#ifndef PORTLIBC_FILEATTRIBUTES_H
#define PORTLIBC_FILEATTRIBUTES_H
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#if defined(_WIN32) || defined (__CYGWIN__)
#include <windows.h>
#else
// Define Windows File attribute flags if undefined
#define FILE_ATTRIBUTE_READONLY 1
#define FILE_ATTRIBUTE_HIDDEN 2
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE 32
#define FILE_ATTRIBUTE_DEVICE 64
#define FILE_ATTRIBUTE_NORMAL 128
#define FILE_ATTRIBUTE_COMPRESSED 2048
#define FILE_ATTRIBUTE_SYSTEM 4
#define FILE_ATTRIBUTE_TEMPORARY 256
#define FILE_ATTRIBUTE_SPARSE_FILE 512
#define FILE_ATTRIBUTE_REPARSE_POINT 1024
#define FILE_ATTRIBUTE_OFFLINE 4096
#define FILE_ATTRIBUTE_NOT_INDEXED 8192
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 32768
#define FILE_ATTRIBUTE_VIRTUAL 65536
#define FILE_ATTRIBUTE_NO_SCRUB 131072
#define FILE_ATTRIBUTE_RECALL_ON_OPEN 262144
#define FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 4194304
#endif
#define WINDOWS_TICK 10000000
#define SEC_TO_UNIX_EPOCH 11644473600
#define UNIX_EPOCH 0 //approximately
// Posix permissions in octal
#define POSIX_RUSR 0400
#define POSIX_RGRP 0040
#define POSIX_ROTH 0004
#define POSIX_WUSR 0200
#define POSIX_WGRP 0020
#define POSIX_WOTH 0002
#define POSIX_XUSR 0100
#define POSIX_XGRP 0010
#define POSIX_XOTH 0001
#define POSIX_READONLY 0444
#define POSIX_NORMAL 0644
typedef struct FileTimePortable {
uint32_t dwLowDateTime;
uint32_t dwHighDateTime;
} FileTimePortable;
/*
* === FUNCTION ======================================================================
* Name: isPosixTime
* Description: Check if a 64-bit value is in a range of possible time_t values
* Returns: int, 0 if success, negative value if failed
* =====================================================================================
*/
inline int isPosixTime(time_t t)
{
time_t now;
time(&now);
if(t > UNIX_EPOCH && t <= now)
return 0;
else
return -1;
}
/*
* === FUNCTION ======================================================================
* Name: convertToPosixTime
* Description: Convert FILETIME to time_t
* Returns: time_t, translated FileTimePortable to equivalent time_t
* =====================================================================================
*/
inline time_t convertToPosixTime (FileTimePortable windowsTime)
{
uint64_t ticks = windowsTime.dwHighDateTime;
ticks = ticks << 32;
ticks |= windowsTime.dwLowDateTime;
return (time_t)( ticks / WINDOWS_TICK - SEC_TO_UNIX_EPOCH );
}
/*
* === FUNCTION ======================================================================
* Name: convertToFileTime
* Description: Convert time_t to FILETIME
* Returns: FileTimePortable, struct of same size and structure as FILETIME
* =====================================================================================
*/
inline FileTimePortable convertToFileTime (time_t posixTime)
{
uint64_t winTime = WINDOWS_TICK * (uint64_t)(posixTime + SEC_TO_UNIX_EPOCH);
FileTimePortable fileTime;
uint32_t highBytes = winTime >> 32;
fileTime.dwHighDateTime = highBytes;
fileTime.dwLowDateTime = winTime; // just 32 lower bits
return fileTime;
}
/*
* === FUNCTION ======================================================================
* Name: convertToWindowsAttributes
* Description: Convert mode_t into Windows attributes type
* Returns: uint32_t, Windows attributes bitvector
* =====================================================================================
*/
inline uint32_t convertToWindowsAttributes(uint32_t posixMode)
{
using namespace std;
uint32_t readAccess =
posixMode & ( POSIX_RUSR | POSIX_RGRP | POSIX_ROTH );
uint32_t writeAccess =
posixMode & ( POSIX_WUSR | POSIX_WGRP | POSIX_WOTH );
uint32_t executeAccess =
posixMode & ( POSIX_XUSR | POSIX_XGRP | POSIX_XOTH );
if (readAccess != 0 && writeAccess == 0 && executeAccess == 0)
return FILE_ATTRIBUTE_READONLY;
else
return FILE_ATTRIBUTE_NORMAL;
}
/*
* === FUNCTION ======================================================================
* Name: convertToPosixAttributes
* Description: Converts Windows attributes type into mode_t
* Returns: uint32_t, mode_t bitvector
* =====================================================================================
*/
inline uint32_t convertToPosixAttributes(uint32_t windowsAttributes)
{
if (windowsAttributes & FILE_ATTRIBUTE_READONLY)
return POSIX_READONLY;
else
return POSIX_NORMAL;
}
#endif //PORTLIBCPP_FILEATTRIBUTES_H

93
src/FileAttributes.c

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
/*
* =====================================================================================
*
* Filename: FileAttributes.c
*
* Description: OS-agnostic file attribute storage and conversion functions
*
* Version: 3.0
* Created: 08/01/2017 09:56:21 AM
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
*
* =====================================================================================
*/
#include <stdlib.h>
#include <time.h>
#include "FileAttributes.h"
/*-----------------------------------------------------------------------------
* UTILITY FUNCTIONS
*-----------------------------------------------------------------------------*/
int isPosixTime(time_t t)
{
time_t now;
time(&now);
if(t > UNIX_EPOCH && t <= now)
return 0;
else
return -1;
}
time_t convertToPosixTime (FileTimePortable windowsTime)
{
uint64_t ticks = windowsTime.dwHighDateTime;
ticks = ticks << 32;
ticks |= windowsTime.dwLowDateTime;
return (time_t)( ticks / WINDOWS_TICK - SEC_TO_UNIX_EPOCH );
}
FileTimePortable convertToFileTime (time_t posixTime)
{
uint64_t winTime = WINDOWS_TICK * (uint64_t)(posixTime + SEC_TO_UNIX_EPOCH);
FileTimePortable fileTime;
uint32_t highBytes = winTime >> 32;
fileTime.dwHighDateTime = highBytes;
fileTime.dwLowDateTime = winTime; // just 32 lower bits
return fileTime;
}
uint32_t convertToWindowsAttributes(uint32_t posixMode)
{
using namespace std;
uint32_t readAccess =
posixMode & ( POSIX_RUSR | POSIX_RGRP | POSIX_ROTH );
uint32_t writeAccess =
posixMode & ( POSIX_WUSR | POSIX_WGRP | POSIX_WOTH );
uint32_t executeAccess =
posixMode & ( POSIX_XUSR | POSIX_XGRP | POSIX_XOTH );
if (readAccess != 0 && writeAccess == 0 && executeAccess == 0)
return FILE_ATTRIBUTE_READONLY;
else
return FILE_ATTRIBUTE_NORMAL;
}
uint32_t convertToPosixAttributes(uint32_t windowsAttributes)
{
if (windowsAttributes & FILE_ATTRIBUTE_READONLY)
return POSIX_READONLY;
else
return POSIX_NORMAL;
}

112
src/FileAttributes.h

@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
/*
* =====================================================================================
*
* Filename: FileAttributes.h
*
* Description:
*
* Version: 1.0
* Created: 08/23/2017 02:36:05 PM
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
*
* =====================================================================================
*/
#ifndef PORTLIBCPP_FILEATTRIBUTES_H
#define PORTLIBCPP_FILEATTRIBUTES_H
#include <stdint.h>
#if defined(_WIN32) || defined (__CYGWIN__)
#include <windows.h>
#else
// Define Windows File attribute flags if undefined
#define FILE_ATTRIBUTE_READONLY 1
#define FILE_ATTRIBUTE_HIDDEN 2
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE 32
#define FILE_ATTRIBUTE_DEVICE 64
#define FILE_ATTRIBUTE_NORMAL 128
#define FILE_ATTRIBUTE_COMPRESSED 2048
#define FILE_ATTRIBUTE_SYSTEM 4
#define FILE_ATTRIBUTE_TEMPORARY 256
#define FILE_ATTRIBUTE_SPARSE_FILE 512
#define FILE_ATTRIBUTE_REPARSE_POINT 1024
#define FILE_ATTRIBUTE_OFFLINE 4096
#define FILE_ATTRIBUTE_NOT_INDEXED 8192
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 32768
#define FILE_ATTRIBUTE_VIRTUAL 65536
#define FILE_ATTRIBUTE_NO_SCRUB 131072
#define FILE_ATTRIBUTE_RECALL_ON_OPEN 262144
#define FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 4194304
#endif
#define WINDOWS_TICK 10000000
#define SEC_TO_UNIX_EPOCH 11644473600
#define UNIX_EPOCH 0 //approximately
// Posix permissions in octal
#define POSIX_RUSR 0400
#define POSIX_RGRP 0040
#define POSIX_ROTH 0004
#define POSIX_WUSR 0200
#define POSIX_WGRP 0020
#define POSIX_WOTH 0002
#define POSIX_XUSR 0100
#define POSIX_XGRP 0010
#define POSIX_XOTH 0001
#define POSIX_READONLY 0444
#define POSIX_NORMAL 0644
typedef struct FileTimePortable {
uint32_t dwLowDateTime;
uint32_t dwHighDateTime;
} FileTimePortable;
/*
*--------------------------------------------------------------------------------------
* Function: isPosixTime
* Description: Check if a 64-bit value is in a range of possible time_t values
* Returns: int, 0 if success, negative value if failed
*--------------------------------------------------------------------------------------
*/
int isPosixTime(time_t t);
/*
*--------------------------------------------------------------------------------------
* Function: convertToPosixTime
* Description: Convert FILETIME to time_t
* Returns: time_t, translated FileTimePortable to equivalent time_t
*--------------------------------------------------------------------------------------
*/
time_t convertToPosixTime (FileTimePortable windowsTime);
/*
*--------------------------------------------------------------------------------------
* Function: convertToFileTime
* Description: Convert time_t to FILETIME
* Returns: FileTimePortable, struct of same size and structure as FILETIME
*--------------------------------------------------------------------------------------
*/
FileTimePortable convertToFileTime (time_t posixTime);
/*
*--------------------------------------------------------------------------------------
* Function: convertToWindowsAttributes
* Description: Convert mode_t into Windows attributes type
* Returns: uint32_t, Windows attributes bitvector
*--------------------------------------------------------------------------------------
*/
uint32_t convertToWindowsAttributes(uint32_t posixMode);
/*
*--------------------------------------------------------------------------------------
* Function: convertToPosixAttributes
* Description: Converts Windows attributes type into mode_t
* Returns: uint32_t, mode_t bitvector
*--------------------------------------------------------------------------------------
*/
uint32_t convertToPosixAttributes(uint32_t windowsAttributes);
#endif //PORTLIBCPP_FILEATTRIBUTES_H

175
test/test.cpp

@ -18,176 +18,7 @@ @@ -18,176 +18,7 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE PortLibCpp
#include <boost/test/unit_test.hpp>
#include <sstream>
#include <iomanip>
#include <cstdint>
#ifdef __linux__
#include "Bitmap.h"
#endif
#include "FileAttributes.h"
BOOST_AUTO_TEST_SUITE (All)
#define LOW_A 3200435968
#define HIGH_A 30610642
#define LOW_M 3230435968
#define HIGH_M 30610642
#define LOW_C 2820435968
#define HIGH_C 30610642
#define ATIME 1502697350
#define MTIME 1502697353
#define CTIME 1502697312
BOOST_AUTO_TEST_CASE (IsPosixTimeCheckFunction)
{
//BOOST_TEST_MESSAGE ("isPosixTime accepts time_t");
BOOST_CHECK (isPosixTime (static_cast<time_t>(ATIME)) == 0);
//BOOST_TEST_MESSAGE ("isPosixTime rejects FILETIME");
int64_t ft = HIGH_A;
ft = ft << 32;
ft |= LOW_A;
BOOST_CHECK (isPosixTime(ft) < 0);
}
BOOST_AUTO_TEST_CASE (ConvertFILETIMEToTimeT)
{
// Mock up FILETIME struct data
FileTimePortable m;
m.dwLowDateTime = LOW_M;
m.dwHighDateTime = HIGH_M;
//BOOST_TEST_MESSAGE (mtime);
BOOST_CHECK (convertToPosixTime(m) == MTIME);
}
BOOST_AUTO_TEST_CASE (ConvertTimeTToFILETIME)
{
time_t tt = ATIME;
FileTimePortable conv = convertToFileTime(tt);
BOOST_CHECK (conv.dwLowDateTime == LOW_A);
BOOST_CHECK (conv.dwHighDateTime == HIGH_A);
}
BOOST_AUTO_TEST_CASE (ConvertWindowsFileAttributesToPosixMode)
{
uint32_t attr = FILE_ATTRIBUTE_NORMAL;
uint32_t mode = convertToPosixAttributes(attr);
char octalStr[20];
sprintf(octalStr, "Octal: %o", mode);
BOOST_TEST_MESSAGE (octalStr);
BOOST_CHECK (mode == POSIX_NORMAL);
}
BOOST_AUTO_TEST_CASE (ConvertPosixModeToWindowsFileAttributes)
{
uint32_t mode = 0743;
//BOOST_TEST_MESSAGE ("Mode converted as closely as possible");
BOOST_CHECK (convertToWindowsAttributes(mode) == FILE_ATTRIBUTE_NORMAL);
}
BOOST_AUTO_TEST_CASE (ReadonlyTranslatesFromWindowsToLinux)
{
uint32_t attr = FILE_ATTRIBUTE_READONLY;
uint32_t mode = convertToPosixAttributes(attr);
char octalStr[20];
sprintf(octalStr, "Octal: %o", mode);
BOOST_TEST_MESSAGE (octalStr);
BOOST_CHECK (mode == POSIX_READONLY);
}
BOOST_AUTO_TEST_CASE (ReadonlyTranslatesFromLinuxToWindows)
{
uint32_t mode = 0400;
BOOST_CHECK (convertToWindowsAttributes(mode) == FILE_ATTRIBUTE_READONLY);
}
BOOST_AUTO_TEST_CASE (NoPrecisionLossWithMultipleConversions)
{
// Mock up data
FileTimePortable conv;
conv.dwLowDateTime = LOW_C;
conv.dwHighDateTime = HIGH_C;
// convert several times
for( int i = 0; i < 30; i++ ) {
time_t temp = convertToPosixTime (conv);
conv = convertToFileTime(temp);
}
BOOST_CHECK (conv.dwLowDateTime == LOW_C);
BOOST_CHECK (conv.dwHighDateTime == HIGH_C);
}
BOOST_AUTO_TEST_CASE (BitmapFileHeaderCorrectSize)
{
BITMAPFILEHEADER bfh;
BOOST_CHECK(sizeof(bfh) == 14);
BOOST_CHECK(sizeof(bfh.bfType) == 2);
BOOST_CHECK(sizeof(bfh.bfSize) == 4);
BOOST_CHECK(sizeof(bfh.bfReserved1) == 2);
BOOST_CHECK(sizeof(bfh.bfReserved2) == 2);
BOOST_CHECK(sizeof(bfh.bfOffBits) == 4);
}
BOOST_AUTO_TEST_CASE (BitmapInfoHeaderCorrectSize)
{
BITMAPINFOHEADER bmih;
BOOST_CHECK (sizeof(bmih) == 40);
BOOST_CHECK (sizeof(bmih.biSize) == 4);
BOOST_CHECK (sizeof(bmih.biWidth) == 4);
BOOST_CHECK (sizeof(bmih.biHeight) == 4);
BOOST_CHECK (sizeof(bmih.biPlanes) == 2);
BOOST_CHECK (sizeof(bmih.biBitCount) == 2);
BOOST_CHECK (sizeof(bmih.biCompression) == 4);
BOOST_CHECK (sizeof(bmih.biSizeImage) == 4);
BOOST_CHECK (sizeof(bmih.biXPelsPerMeter) == 4);
BOOST_CHECK (sizeof(bmih.biYPelsPerMeter) == 4);
BOOST_CHECK (sizeof(bmih.biClrUsed) == 4);
BOOST_CHECK (sizeof(bmih.biClrImportant) == 4);
}
BOOST_AUTO_TEST_CASE (RgbQuadCorrectSize)
{
RGBQUAD rgbq;
BOOST_CHECK(sizeof(rgbq) == 4);
BOOST_CHECK(sizeof(rgbq.rgbBlue) == 1);
BOOST_CHECK(sizeof(rgbq.rgbGreen) == 1);
BOOST_CHECK(sizeof(rgbq.rgbRed) == 1);
BOOST_CHECK(sizeof(rgbq.rgbReserved) == 1);
}
BOOST_AUTO_TEST_CASE (BitmapInfoCorrectSize)
{
BITMAPINFO bmi;
BOOST_CHECK(sizeof(bmi) == 44);
BOOST_CHECK(sizeof(bmi.bmiHeader) == 40);
BOOST_CHECK(sizeof(bmi.bmiColors[0]) == 4);
}
BOOST_AUTO_TEST_SUITE_END()
#include "test-fileattributes.cpp"
#include "test-bitmap.cpp"
#include "test-borland.cpp"

Loading…
Cancel
Save