summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-06-19 15:11:19 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2018-06-20 09:51:42 +0000
commitaf7e9ecd1fdd9a3499da7fc2721c4e4a74d8542f (patch)
tree1cd0e24fa031a9231b800b0b41102a5d95e7082c
parentReplace functions with methods in SPColor. (diff)
downloadinkscape-af7e9ecd1fdd9a3499da7fc2721c4e4a74d8542f.tar.gz
inkscape-af7e9ecd1fdd9a3499da7fc2721c4e4a74d8542f.zip
Replace typedef struct with struct in POD type declarations.
-rw-r--r--src/attributes.cpp4
-rw-r--r--src/extension/internal/emf-inout.h48
-rw-r--r--src/extension/internal/metafile-inout.h13
-rw-r--r--src/extension/internal/wmf-inout.h48
-rw-r--r--src/helper/png-write.cpp4
-rw-r--r--src/livarot/AlphaLigne.h4
-rw-r--r--src/livarot/LivarotDefs.h34
-rw-r--r--src/live_effects/spiro.cpp4
-rw-r--r--src/live_effects/spiro.h4
-rw-r--r--src/registrytool.cpp4
-rw-r--r--src/selection-chemistry.cpp8
-rw-r--r--src/trace/imagemap.h4
-rw-r--r--src/trace/potrace/inkscape-potrace.cpp4
-rw-r--r--src/ui/dialog-events.h4
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp5
-rw-r--r--src/ui/widget/selected-style.cpp8
-rw-r--r--src/util/ziptool.cpp12
-rw-r--r--src/widgets/eek-preview.cpp4
18 files changed, 100 insertions, 116 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 0c16916f9..b2c676e88 100644
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
@@ -15,10 +15,10 @@
#include <glib.h> // g_assert()
#include "attributes.h"
-typedef struct {
+struct SPStyleProp {
gint code;
gchar const *name;
-} SPStyleProp;
+};
/**
* Lookup dictionary for attributes/properties.
diff --git a/src/extension/internal/emf-inout.h b/src/extension/internal/emf-inout.h
index 8c732404c..c365495d5 100644
--- a/src/extension/internal/emf-inout.h
+++ b/src/extension/internal/emf-inout.h
@@ -29,30 +29,22 @@ namespace Internal {
#define DIRTY_FILL 0x02
#define DIRTY_STROKE 0x04
-typedef struct emf_object {
- emf_object() :
- type(0),
- level(0),
- lpEMFR(nullptr)
- {};
- int type;
- int level;
- char *lpEMFR;
-} EMF_OBJECT, *PEMF_OBJECT;
-
-typedef struct emf_strings {
- emf_strings() :
- size(0),
- count(0),
- strings(nullptr)
- {};
- int size; // number of slots allocated in strings
- int count; // number of slots used in strings
- char **strings; // place to store strings
-} EMF_STRINGS, *PEMF_STRINGS;
+struct EMF_OBJECT {
+ int type = 0;
+ int level = 0;
+ char *lpEMFR = nullptr;
+};
+using PEMF_OBJECT = EMF_OBJECT *;
-typedef struct emf_device_context {
- emf_device_context() :
+struct EMF_STRINGS {
+ int size = 0; // number of slots allocated in strings
+ int count = 0; // number of slots used in strings
+ char **strings = nullptr; // place to store strings
+};
+using PEMF_STRINGS = EMF_STRINGS *;
+
+struct EMF_DEVICE_CONTEXT {
+ EMF_DEVICE_CONTEXT() :
// SPStyle: class with constructor
font_name(nullptr),
clip_id(0),
@@ -106,13 +98,14 @@ typedef struct emf_device_context {
uint32_t textAlign;
U_XFORM worldTransform;
U_POINTL cur;
-} EMF_DEVICE_CONTEXT, *PEMF_DEVICE_CONTEXT;
+};
+using PEMF_DEVICE_CONTEXT = EMF_DEVICE_CONTEXT *;
#define EMF_MAX_DC 128
-typedef struct emf_callback_data {
+struct EMF_CALLBACK_DATA {
- emf_callback_data() :
+ EMF_CALLBACK_DATA() :
// dc: array, structure w/ constructor
level(0),
E2IdirY(1.0),
@@ -170,7 +163,8 @@ typedef struct emf_callback_data {
int n_obj;
PEMF_OBJECT emf_obj;
-} EMF_CALLBACK_DATA, *PEMF_CALLBACK_DATA;
+};
+using PEMF_CALLBACK_DATA = EMF_CALLBACK_DATA *;
class Emf : public Metafile
{
diff --git a/src/extension/internal/metafile-inout.h b/src/extension/internal/metafile-inout.h
index c3cda0954..a69b1acee 100644
--- a/src/extension/internal/metafile-inout.h
+++ b/src/extension/internal/metafile-inout.h
@@ -38,25 +38,26 @@ namespace Extension {
namespace Internal {
/* A coloured pixel. */
-typedef struct {
+struct pixel_t {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t opacity;
-} pixel_t;
+};
/* A picture. */
- typedef struct {
+struct bitmap_t {
pixel_t *pixels;
size_t width;
size_t height;
-} bitmap_t;
+};
/* structure to store PNG image bytes */
-typedef struct {
+struct MEMPNG {
char *buffer;
size_t size;
-} MEMPNG, *PMEMPNG;
+};
+using PMEMPNG = MEMPNG *;
class Metafile
: public Inkscape::Extension::Implementation::Implementation
diff --git a/src/extension/internal/wmf-inout.h b/src/extension/internal/wmf-inout.h
index fbd7fff3a..4ec3a98eb 100644
--- a/src/extension/internal/wmf-inout.h
+++ b/src/extension/internal/wmf-inout.h
@@ -26,30 +26,22 @@ namespace Internal {
#define DIRTY_FILL 0x02
#define DIRTY_STROKE 0x04 // not used currently
-typedef struct wmf_object {
- wmf_object() :
- type(0),
- level(0),
- record(nullptr)
- {};
- int type;
- int level;
- char *record;
-} WMF_OBJECT, *PWMF_OBJECT;
-
-typedef struct wmf_strings {
- wmf_strings() :
- size(0),
- count(0),
- strings(nullptr)
- {};
- int size; // number of slots allocated in strings
- int count; // number of slots used in strings
- char **strings; // place to store strings
-} WMF_STRINGS, *PWMF_STRINGS;
+struct WMF_OBJECT {
+ int type = 0;
+ int level = 0;
+ char *record = nullptr;
+};
+using PWMF_OBJECT = WMF_OBJECT *;
-typedef struct wmf_device_context {
- wmf_device_context() :
+struct WMF_STRINGS {
+ int size = 0; // number of slots allocated in strings
+ int count = 0; // number of slots used in strings
+ char **strings = nullptr; // place to store strings
+};
+using PWMF_STRINGS = WMF_STRINGS *;
+
+struct WMF_DEVICE_CONTEXT {
+ WMF_DEVICE_CONTEXT() :
// SPStyle: class with constructor
font_name(nullptr),
clip_id(0),
@@ -100,7 +92,8 @@ typedef struct wmf_device_context {
U_COLORREF textColor;
uint16_t textAlign;
U_POINT16 cur;
-} WMF_DEVICE_CONTEXT, *PWMF_DEVICE_CONTEXT;
+};
+using PWMF_DEVICE_CONTEXT = WMF_DEVICE_CONTEXT *;
#define WMF_MAX_DC 128
@@ -110,9 +103,9 @@ typedef struct wmf_device_context {
// this fixes it, so some confusion between this struct and the one in emf-inout???
//typedef struct wmf_callback_data {
// as does this
-typedef struct wmf_callback_data {
+struct WMF_CALLBACK_DATA {
- wmf_callback_data() :
+ WMF_CALLBACK_DATA() :
// dc: array, structure w/ constructor
level(0),
E2IdirY(1.0),
@@ -164,7 +157,8 @@ typedef struct wmf_callback_data {
int n_obj;
int low_water; // first object slot which _might_ be unoccupied. Everything below is filled.
PWMF_OBJECT wmf_obj;
-} WMF_CALLBACK_DATA, *PWMF_CALLBACK_DATA;
+};
+using PWMF_CALLBACK_DATA = WMF_CALLBACK_DATA *;
class Wmf : public Metafile
{
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index a66d683ac..92fdc3648 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -60,10 +60,10 @@ struct SPEBP {
/* write a png file */
-typedef struct SPPNGBD {
+struct SPPNGBD {
guchar const *px;
int rowstride;
-} SPPNGBD;
+};
/**
* A simple wrapper to list png_text.
diff --git a/src/livarot/AlphaLigne.h b/src/livarot/AlphaLigne.h
index fe3dc69b0..e0eef308a 100644
--- a/src/livarot/AlphaLigne.h
+++ b/src/livarot/AlphaLigne.h
@@ -19,10 +19,10 @@
*/
// a step
-typedef struct alpha_step {
+struct alpha_step {
int x; // position
float delta; // increase or decrease in pixel coverage with respect to the coverage of the previous pixel
-} alpha_step;
+};
class AlphaLigne {
diff --git a/src/livarot/LivarotDefs.h b/src/livarot/LivarotDefs.h
index aa1919cf1..48a1fa80b 100644
--- a/src/livarot/LivarotDefs.h
+++ b/src/livarot/LivarotDefs.h
@@ -68,33 +68,30 @@ enum fill_typ
typedef enum fill_typ FillRule;
// stupid version of dashes: in dash x is plain, dash x+1 must be empty, so the gap field is extremely redundant
-typedef struct one_dash
+struct one_dash
{
bool gap;
double length;
-}
-one_dash;
+};
// color definition structures for the rasterizations primitives (not present here)
-typedef struct std_color
+struct std_color
{
uint32_t uCol;
uint16_t iColA, iColR, iColG, iColB;
double fColA, fColR, fColG, fColB;
uint32_t iColATab[256];
-}
-std_color;
+};
-typedef struct grad_stop
+struct grad_stop
{
double at;
double ca, cr, cg, cb;
double iSize;
-}
-grad_stop;
+};
// linear gradient for filling polygons
-typedef struct lin_grad
+struct lin_grad
{
int type; // 0= gradient appears once
// 1= repeats itself start-end/start-end/start-end...
@@ -104,11 +101,10 @@ typedef struct lin_grad
// double cba,cbr,cbg,cbb; // color at gradient position 1
int nbStop;
grad_stop stops[2];
-}
-lin_grad;
+};
// radial gradient (color is funciton of r^2, need to be corrected with a sqrt() to be r)
-typedef struct rad_grad
+struct rad_grad
{
int type; // 0= gradient appears once
// 1= repeats itself start-end/start-end/start-end...
@@ -117,8 +113,7 @@ typedef struct rad_grad
double rxx, rxy, ryx, ryy; // 1/radius
int nbStop;
grad_stop stops[2];
-}
-rad_grad;
+};
// functions types for an arbitrary filling shader
typedef void (*InitColorFunc) (int ph, int pv, void *); // init for position ph,pv; the last parameter is a pointer
@@ -131,7 +126,7 @@ typedef void (*GotoLigneColorFunc) (int pv, void *); // move to v-coordinate pv
// in the InitColorFunc)
// an arbitrary shader
-typedef struct gen_color
+struct gen_color
{
double colA, colR, colG, colB;
InitColorFunc iFunc;
@@ -139,15 +134,14 @@ typedef struct gen_color
NextLigneColorFunc nlFunc;
GotoPixelColorFunc gpFunc;
GotoLigneColorFunc glFunc;
-}
-gen_color;
+};
// info for a run of pixel to fill
-typedef struct raster_info {
+struct raster_info {
int startPix,endPix; // start and end pixel from the polygon POV
int sth,stv; // coordinates for the first pixel in the run, in (possibly another) POV
uint32_t* buffer; // pointer to the first pixel in the run
-} raster_info;
+};
typedef void (*RasterInRunFunc) (raster_info &dest,void *data,int nst,float vst,int nen,float ven); // init for position ph,pv; the last parameter is a pointer
diff --git a/src/live_effects/spiro.cpp b/src/live_effects/spiro.cpp
index c0e314a69..008e2ad6a 100644
--- a/src/live_effects/spiro.cpp
+++ b/src/live_effects/spiro.cpp
@@ -66,10 +66,10 @@ struct spiro_seg_s {
double l;
};
-typedef struct {
+struct bandmat {
double a[11]; /* band-diagonal matrix */
double al[5]; /* lower part of band-diagonal decomposition */
-} bandmat;
+};
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
diff --git a/src/live_effects/spiro.h b/src/live_effects/spiro.h
index 066b44ca8..3afa06941 100644
--- a/src/live_effects/spiro.h
+++ b/src/live_effects/spiro.h
@@ -31,11 +31,11 @@ class SPCurve;
namespace Spiro {
-typedef struct {
+struct spiro_cp {
double x;
double y;
char ty;
-} spiro_cp;
+};
void spiro_run(const spiro_cp *src, int src_len, SPCurve &curve);
diff --git a/src/registrytool.cpp b/src/registrytool.cpp
index 51c1063ef..89442bc36 100644
--- a/src/registrytool.cpp
+++ b/src/registrytool.cpp
@@ -29,12 +29,12 @@
#include <glibmm/ustring.h>
-typedef struct
+struct KeyTableEntry
{
HKEY key;
int strlen;
const char *str;
-} KeyTableEntry;
+};
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 8c47d1934..3e1bb56aa 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2334,7 +2334,7 @@ void ObjectSet::moveScreen(double dx, double dy)
-typedef struct Forward {
+struct Forward {
typedef SPObject *Iterator;
static Iterator children(SPObject *o) { return o->firstChild(); }
@@ -2344,9 +2344,9 @@ typedef struct Forward {
static SPObject *object(Iterator i) { return i; }
static Iterator next(Iterator i) { return i->getNext(); }
static bool isNull(Iterator i) {return (!i);}
-} Forward;
+};
-typedef struct ListReverse {
+struct ListReverse {
typedef std::list<SPObject *> *Iterator;
static Iterator children(SPObject *o) {
@@ -2377,7 +2377,7 @@ private:
}
return list;
}
-} ListReverse;
+};
diff --git a/src/trace/imagemap.h b/src/trace/imagemap.h
index 7aa7e739d..d99517757 100644
--- a/src/trace/imagemap.h
+++ b/src/trace/imagemap.h
@@ -187,12 +187,12 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height);
### R G B M A P
#########################################################################*/
-typedef struct
+struct RGB
{
unsigned char r;
unsigned char g;
unsigned char b;
-} RGB;
+};
diff --git a/src/trace/potrace/inkscape-potrace.cpp b/src/trace/potrace/inkscape-potrace.cpp
index 86658653a..ac26edcd4 100644
--- a/src/trace/potrace/inkscape-potrace.cpp
+++ b/src/trace/potrace/inkscape-potrace.cpp
@@ -105,11 +105,11 @@ PotraceTracingEngine::~PotraceTracingEngine()
-typedef struct
+struct Point
{
double x;
double y;
-} Point;
+};
/**
diff --git a/src/ui/dialog-events.h b/src/ui/dialog-events.h
index 547cfb95d..e00c0560b 100644
--- a/src/ui/dialog-events.h
+++ b/src/ui/dialog-events.h
@@ -30,10 +30,10 @@ class Entry;
class SPDesktop;
-typedef struct {
+struct win_data {
GtkWidget *win;
guint stop;
-} win_data;
+};
gboolean sp_dialog_event_handler ( GtkWindow *win,
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 0effddfed..c57594551 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -1097,7 +1097,7 @@ bool FileOpenDialogImplWin32::set_image_preview()
// for the bbox rectangle.
#pragma pack( push )
#pragma pack( 2 )
-typedef struct
+struct APMHEADER
{
DWORD dwKey;
WORD hmf;
@@ -1105,7 +1105,8 @@ typedef struct
WORD wInch;
DWORD dwReserved;
WORD wCheckSum;
-} APMHEADER, *PAPMHEADER;
+};
+using PAPMHEADER = APMHEADER *;
#pragma pack( pop )
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index bc4a3558f..9a5d35f3b 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -92,15 +92,15 @@ namespace UI {
namespace Widget {
-typedef struct {
+struct DropTracker {
SelectedStyle* parent;
int item;
-} DropTracker;
+};
/* Drag and Drop */
-typedef enum {
+enum ui_drop_target_info {
APP_X_COLOR
-} ui_drop_target_info;
+};
//TODO: warning: deprecated conversion from string constant to ‘gchar*’
//
diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp
index 4408c3daa..7f2654876 100644
--- a/src/util/ziptool.cpp
+++ b/src/util/ziptool.cpp
@@ -198,11 +198,11 @@ unsigned long Crc32::getValue()
/**
*
*/
-typedef struct
+struct Huffman
{
int *count; // number of symbols of each length
int *symbol; // canonically ordered symbols
-} Huffman;
+};
/**
*
@@ -1137,12 +1137,12 @@ void Deflater::encodeLiteralStatic(unsigned int ch)
}
-typedef struct
+struct LenBase
{
unsigned int base;
unsigned int range;
unsigned int bits;
-} LenBase;
+};
LenBase lenBases[] =
{
@@ -1177,12 +1177,12 @@ LenBase lenBases[] =
{ 258, 1, 0 }
};
-typedef struct
+struct DistBase
{
unsigned int base;
unsigned int range;
unsigned int bits;
-} DistBase;
+};
DistBase distBases[] =
{
diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp
index f12cecc7f..d7cbc8991 100644
--- a/src/widgets/eek-preview.cpp
+++ b/src/widgets/eek-preview.cpp
@@ -57,7 +57,7 @@ enum {
PROP_FOCUS
};
-typedef struct
+struct EekPreviewPrivate
{
int scaledW;
int scaledH;
@@ -76,7 +76,7 @@ typedef struct
guint border;
GdkPixbuf *previewPixbuf;
GdkPixbuf *scaled;
-} EekPreviewPrivate;
+};
#define EEK_PREVIEW_GET_PRIVATE(preview) \
G_TYPE_INSTANCE_GET_PRIVATE(preview, EEK_PREVIEW_TYPE, EekPreviewPrivate)