summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-16 11:28:30 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-16 11:28:30 +0200
commit4e7d1bcb60de6a6920f6cede0c84cb32b9d9eb0a (patch)
tree5c9fcec17b9139826b16e6b4ef9b84332ffab28a
parent85a0bb2e54df2a6be8bc21f6c5bb74a1898d40e4 (diff)
Some more integer width related stuff
-rw-r--r--src/lib/VSDXCollector.h8
-rw-r--r--src/lib/VSDXContentCollector.cpp8
-rw-r--r--src/lib/VSDXContentCollector.h8
-rw-r--r--src/lib/VSDXGeometryList.cpp8
-rw-r--r--src/lib/VSDXGeometryList.h4
-rw-r--r--src/lib/VSDXParser.cpp12
-rw-r--r--src/lib/VSDXStylesCollector.cpp8
-rw-r--r--src/lib/VSDXStylesCollector.h8
-rw-r--r--src/lib/VSDXTypes.h22
9 files changed, 43 insertions, 43 deletions
diff --git a/src/lib/VSDXCollector.h b/src/lib/VSDXCollector.h
index 09cd3ef..33558b6 100644
--- a/src/lib/VSDXCollector.h
+++ b/src/lib/VSDXCollector.h
@@ -52,12 +52,12 @@ public:
virtual void collectMoveTo(unsigned id, unsigned level, double x, double y) = 0;
virtual void collectLineTo(unsigned id, unsigned level, double x, double y) = 0;
virtual void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow) = 0;
- virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
+ virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID) = 0;
- virtual void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > &points) = 0;
+ virtual void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points) = 0;
virtual void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID) = 0;
- virtual void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
- virtual void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points) = 0;
+ virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
+ virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points) = 0;
virtual void collectXFormData(unsigned id, unsigned level, const XForm &xform) = 0;
virtual void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform) = 0;
virtual void collectShapeId(unsigned id, unsigned level, unsigned shapeId) = 0;
diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp
index 44f8e7c..16ad501 100644
--- a/src/lib/VSDXContentCollector.cpp
+++ b/src/lib/VSDXContentCollector.cpp
@@ -824,7 +824,7 @@ void libvisio::VSDXContentCollector::collectArcTo(unsigned /* id */, unsigned le
#define VSD_NUM_POLYLINES_PER_NURBS 200
-void libvisio::VSDXContentCollector::collectNURBSTo(unsigned /* id */, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
+void libvisio::VSDXContentCollector::collectNURBSTo(unsigned /* id */, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
{
_handleLevelChange(level);
@@ -945,7 +945,7 @@ void libvisio::VSDXContentCollector::collectNURBSTo(unsigned id, unsigned level,
_handleLevelChange(level);
}
-void libvisio::VSDXContentCollector::collectPolylineTo(unsigned /* id */ , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > &points)
+void libvisio::VSDXContentCollector::collectPolylineTo(unsigned /* id */ , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points)
{
_handleLevelChange(level);
@@ -1006,7 +1006,7 @@ void libvisio::VSDXContentCollector::collectPolylineTo(unsigned id, unsigned lev
}
/* NURBS shape data */
-void libvisio::VSDXContentCollector::collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
+void libvisio::VSDXContentCollector::collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
{
_handleLevelChange(level);
NURBSData data;
@@ -1021,7 +1021,7 @@ void libvisio::VSDXContentCollector::collectShapeData(unsigned id, unsigned leve
}
/* Polyline shape data */
-void libvisio::VSDXContentCollector::collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points)
+void libvisio::VSDXContentCollector::collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points)
{
_handleLevelChange(level);
PolylineData data;
diff --git a/src/lib/VSDXContentCollector.h b/src/lib/VSDXContentCollector.h
index abc334e..a68b475 100644
--- a/src/lib/VSDXContentCollector.h
+++ b/src/lib/VSDXContentCollector.h
@@ -70,12 +70,12 @@ public:
void collectMoveTo(unsigned id, unsigned level, double x, double y);
void collectLineTo(unsigned id, unsigned level, double x, double y);
void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
- void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
- void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > &points);
+ void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points);
void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID);
- void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
- void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points);
+ void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points);
void collectXFormData(unsigned id, unsigned level, const XForm &xform);
void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform);
void collectShapeId(unsigned id, unsigned level, unsigned shapeId);
diff --git a/src/lib/VSDXGeometryList.cpp b/src/lib/VSDXGeometryList.cpp
index 259e465..c0ce8d8 100644
--- a/src/lib/VSDXGeometryList.cpp
+++ b/src/lib/VSDXGeometryList.cpp
@@ -116,7 +116,7 @@ private:
class VSDXNURBSTo1 : public VSDXGeometryListElement
{
public:
- VSDXNURBSTo1(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) :
+ VSDXNURBSTo1(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) :
m_id(id), m_level(level), m_x2(x2), m_y2(y2), m_xType(xType), m_yType(yType), m_degree(degree), m_controlPoints(controlPoints), m_knotVector(knotVector), m_weights(weights) {}
~VSDXNURBSTo1() {}
void handle(VSDXCollector *collector);
@@ -133,7 +133,7 @@ private:
class VSDXPolylineTo1 : public VSDXGeometryListElement
{
public:
- VSDXPolylineTo1(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points) :
+ VSDXPolylineTo1(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points) :
m_id(id), m_level(level), m_x(x), m_y(y), m_xType(xType), m_yType(yType), m_points(points) {}
~VSDXPolylineTo1() {}
void handle(VSDXCollector *collector);
@@ -365,7 +365,7 @@ void libvisio::VSDXGeometryList::addArcTo(unsigned id, unsigned level, double x2
m_elements[id] = new VSDXArcTo(id, level, x2, y2, bow);
}
-void libvisio::VSDXGeometryList::addNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
+void libvisio::VSDXGeometryList::addNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
{
m_elements[id] = new VSDXNURBSTo1(id, level, x2, y2, xType, yType, degree, controlPoints, knotVector, weights);
}
@@ -375,7 +375,7 @@ void libvisio::VSDXGeometryList::addNURBSTo(unsigned id, unsigned level, double
m_elements[id] = new VSDXNURBSTo2(id, level, x2, y2, knot, knotPrev, weight, weightPrev, dataID);
}
-void libvisio::VSDXGeometryList::addPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points)
+void libvisio::VSDXGeometryList::addPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points)
{
m_elements[id] = new VSDXPolylineTo1(id, level, x, y, xType, yType, points);
}
diff --git a/src/lib/VSDXGeometryList.h b/src/lib/VSDXGeometryList.h
index a00af5d..06ce5b1 100644
--- a/src/lib/VSDXGeometryList.h
+++ b/src/lib/VSDXGeometryList.h
@@ -50,9 +50,9 @@ public:
void addMoveTo(unsigned id, unsigned level, double x, double y);
void addLineTo(unsigned id, unsigned level, double x, double y);
void addArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
- void addNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ void addNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
void addNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
- void addPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points);
+ void addPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points);
void addPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID);
void addEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop);
void addEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc);
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index 32e10f4..01934ac 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -1016,7 +1016,7 @@ void libvisio::VSDXParser::readNURBSTo(WPXInputStream *input)
return;
unsigned degree = 3;
- unsigned xType = 1; unsigned yType = 1;
+ unsigned char xType = 1; unsigned char yType = 1;
// Only read formula if block is found
if (cellRef == 6)
{
@@ -1174,7 +1174,7 @@ void libvisio::VSDXParser::readPolylineTo(WPXInputStream *input)
return;
// Default to local co-ordinates if unspecified
- unsigned xType = 1; unsigned yType = 1;
+ unsigned char xType = 1; unsigned char yType = 1;
std::vector<std::pair<double, double> > points;
// Only formula if block is found
@@ -1240,8 +1240,8 @@ void libvisio::VSDXParser::readShapeData(WPXInputStream *input)
{
unsigned pointCount = 0;
std::vector<std::pair<double, double> > points;
- unsigned xType = readU8(input);
- unsigned yType = readU8(input);
+ unsigned char xType = readU8(input);
+ unsigned char yType = readU8(input);
pointCount = readU32(input);
for (unsigned i = 0; i < pointCount; i++)
@@ -1270,8 +1270,8 @@ void libvisio::VSDXParser::readShapeData(WPXInputStream *input)
double lastKnot = readDouble(input);
unsigned degree = readU16(input);
- unsigned xType = readU8(input);
- unsigned yType = readU8(input);
+ unsigned char xType = readU8(input);
+ unsigned char yType = readU8(input);
unsigned pointCount = readU32(input);
std::vector<double> knotVector;
diff --git a/src/lib/VSDXStylesCollector.cpp b/src/lib/VSDXStylesCollector.cpp
index dff9d95..4b33b50 100644
--- a/src/lib/VSDXStylesCollector.cpp
+++ b/src/lib/VSDXStylesCollector.cpp
@@ -111,7 +111,7 @@ void libvisio::VSDXStylesCollector::collectArcTo(unsigned /* id */, unsigned lev
_handleLevelChange(level);
}
-void libvisio::VSDXStylesCollector::collectNURBSTo(unsigned /* id */, unsigned level, double /* x2 */, double /* y2 */, unsigned /* xType */, unsigned /* yType */, unsigned /* degree */, std::vector<std::pair<double, double> > /* controlPoints */, std::vector<double> /* knotVector */, std::vector<double> /* weights */)
+void libvisio::VSDXStylesCollector::collectNURBSTo(unsigned /* id */, unsigned level, double /* x2 */, double /* y2 */, unsigned char /* xType */, unsigned char /* yType */, unsigned /* degree */, std::vector<std::pair<double, double> > /* controlPoints */, std::vector<double> /* knotVector */, std::vector<double> /* weights */)
{
_handleLevelChange(level);
}
@@ -121,7 +121,7 @@ void libvisio::VSDXStylesCollector::collectNURBSTo(unsigned /* id */, unsigned l
_handleLevelChange(level);
}
-void libvisio::VSDXStylesCollector::collectPolylineTo(unsigned /* id */, unsigned level, double /* x */, double /* y */, unsigned /* xType */, unsigned /* yType */, std::vector<std::pair<double, double> > & /* points */)
+void libvisio::VSDXStylesCollector::collectPolylineTo(unsigned /* id */, unsigned level, double /* x */, double /* y */, unsigned char /* xType */, unsigned char /* yType */, std::vector<std::pair<double, double> > & /* points */)
{
_handleLevelChange(level);
}
@@ -145,12 +145,12 @@ void libvisio::VSDXStylesCollector::collectSplineEnd()
{
}
-void libvisio::VSDXStylesCollector::collectShapeData(unsigned /* id */, unsigned level, unsigned /* xType */, unsigned /* yType */, unsigned /* degree */, double /*lastKnot*/, std::vector<std::pair<double, double> > /* controlPoints */, std::vector<double> /* knotVector */, std::vector<double> /* weights */)
+void libvisio::VSDXStylesCollector::collectShapeData(unsigned /* id */, unsigned level, unsigned char /* xType */, unsigned char /* yType */, unsigned /* degree */, double /*lastKnot*/, std::vector<std::pair<double, double> > /* controlPoints */, std::vector<double> /* knotVector */, std::vector<double> /* weights */)
{
_handleLevelChange(level);
}
-void libvisio::VSDXStylesCollector::collectShapeData(unsigned /* id */, unsigned level, unsigned /* xType */, unsigned /* yType */, std::vector<std::pair<double, double> > /* points */)
+void libvisio::VSDXStylesCollector::collectShapeData(unsigned /* id */, unsigned level, unsigned char /* xType */, unsigned char /* yType */, std::vector<std::pair<double, double> > /* points */)
{
_handleLevelChange(level);
}
diff --git a/src/lib/VSDXStylesCollector.h b/src/lib/VSDXStylesCollector.h
index d21d713..854242f 100644
--- a/src/lib/VSDXStylesCollector.h
+++ b/src/lib/VSDXStylesCollector.h
@@ -61,12 +61,12 @@ public:
void collectMoveTo(unsigned id, unsigned level, double x, double y);
void collectLineTo(unsigned id, unsigned level, double x, double y);
void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
- void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
- void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > &points);
+ void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points);
void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID);
- void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
- void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, std::vector<std::pair<double, double> > points);
+ void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points);
void collectXFormData(unsigned id, unsigned level, const XForm &xform);
void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform);
void collectShapeId(unsigned id, unsigned level, unsigned shapeId);
diff --git a/src/lib/VSDXTypes.h b/src/lib/VSDXTypes.h
index a6fd4df..7dbe39e 100644
--- a/src/lib/VSDXTypes.h
+++ b/src/lib/VSDXTypes.h
@@ -56,28 +56,28 @@ struct ChunkHeader
unsigned id; // 4 bytes
unsigned list; // 4 bytes
unsigned dataLength; // 4 bytes
- unsigned level; // 2 bytes
- unsigned unknown; // 1 byte
+ unsigned short level; // 2 bytes
+ unsigned char unknown; // 1 byte
unsigned trailer; // Derived
};
struct Colour
{
- Colour(unsigned red, unsigned green, unsigned blue, unsigned alpha)
+ Colour(unsigned red, unsigned char green, unsigned char blue, unsigned char alpha)
: r(red), g(green), b(blue), a(alpha) {}
Colour() : r(0), g(0), b(0), a(0xff) {}
- unsigned r;
- unsigned g;
- unsigned b;
- unsigned a;
+ unsigned char r;
+ unsigned char g;
+ unsigned char b;
+ unsigned char a;
};
struct NURBSData
{
double lastKnot;
unsigned degree;
- unsigned xType;
- unsigned yType;
+ unsigned char xType;
+ unsigned char yType;
std::vector<double> knots;
std::vector<double> weights;
std::vector<std::pair<double, double> > points;
@@ -85,8 +85,8 @@ struct NURBSData
struct PolylineData
{
- unsigned xType;
- unsigned yType;
+ unsigned char xType;
+ unsigned char yType;
std::vector<std::pair<double, double> > points;
};