[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 2e9854b: [graph] s/uint32/uint32_t/ and popular
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master 2e9854b: [graph] s/uint32/uint32_t/ and popularize it. |
Date: |
Thu, 22 Oct 2020 22:10:20 -0400 (EDT) |
branch: master
commit 2e9854be3ec46c89cfda9100d448fc1363d49b82
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[graph] s/uint32/uint32_t/ and popularize it.
* graph/grconfig.h: Define uint32_t here...
* graph/x11/grx11.c: ... instead of uint32 here and update all users.
* graph/graph.h: Include "grconfig.h".
---
ChangeLog | 8 ++++++
graph/graph.h | 1 +
graph/grconfig.h | 44 +++++++++++++++++++++++++++++
graph/x11/grx11.c | 82 ++++++++++++++++---------------------------------------
4 files changed, 77 insertions(+), 58 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0321cda..536e3e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [graph] s/uint32/uint32_t/ and popularize it.
+
+ * graph/grconfig.h: Define uint32_t here...
+ * graph/x11/grx11.c: ... instead of uint32 here and update all users.
+ * graph/graph.h: Include "grconfig.h".
+
2020-10-20 Werner Lemberg <wl@gnu.org>
* Version 2.10.4 released.
diff --git a/graph/graph.h b/graph/graph.h
index 4086e77..a24427e 100644
--- a/graph/graph.h
+++ b/graph/graph.h
@@ -12,6 +12,7 @@
#ifndef GRAPH_H_
#define GRAPH_H_
+#include "grconfig.h"
#include "grevents.h"
/*************************************************************************/
diff --git a/graph/grconfig.h b/graph/grconfig.h
index 1ba102f..c54c183 100644
--- a/graph/grconfig.h
+++ b/graph/grconfig.h
@@ -4,4 +4,48 @@
#define GR_MAX_SATURATIONS 8
#define GR_MAX_CONVERSIONS 16
+#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
+
+#include <stdint.h>
+
+#ifndef UINT32_MAX
+#error "could not find a 32-bit integer type"
+#endif
+
+#else /* old trick to determine 32-bit integer type */
+
+#include <limits.h>
+
+ /* The number of bytes in an `int' type. */
+#if UINT_MAX == 0xFFFFFFFFUL
+#define GR_SIZEOF_INT 4
+#elif UINT_MAX == 0xFFFFU
+#define GR_SIZEOF_INT 2
+#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU
+#define GR_SIZEOF_INT 8
+#else
+#error "Unsupported number of bytes in `int' type!"
+#endif
+
+ /* The number of bytes in a `long' type. */
+#if ULONG_MAX == 0xFFFFFFFFUL
+#define GR_SIZEOF_LONG 4
+#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
+#define GR_SIZEOF_LONG 8
+#else
+#error "Unsupported number of bytes in `long' type!"
+#endif
+
+#if GR_SIZEOF_INT == 4
+typedef int int32_t;
+typedef unsigned int uint32_t;
+#elif GR_SIZEOF_LONG == 4
+typedef long int32_t;
+typedef unsigned long uint32_t;
+#else
+#error "could not find a 32-bit integer type"
+#endif
+
+#endif /* old trick to determine 32-bit integer type */
+
#endif /* GRCONFIG_H_ */
diff --git a/graph/x11/grx11.c b/graph/x11/grx11.c
index cb37e09..140198b 100644
--- a/graph/x11/grx11.c
+++ b/graph/x11/grx11.c
@@ -20,9 +20,6 @@
#include <vms_x_fix.h>
#endif
-#include <grobjs.h>
-#include <grdevice.h>
-
#define xxTEST
#ifdef TEST
@@ -50,6 +47,8 @@
#include <X11/cursorfont.h>
#include <X11/keysym.h>
+#include "grobjs.h"
+#include "grdevice.h"
#include "grx11.h"
@@ -59,39 +58,6 @@
#define Class class
#endif
- /* old trick to determine 32-bit integer type */
-#include <limits.h>
-
- /* The number of bytes in an `int' type. */
-#if UINT_MAX == 0xFFFFFFFFUL
-#define GR_SIZEOF_INT 4
-#elif UINT_MAX == 0xFFFFU
-#define GR_SIZEOF_INT 2
-#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU
-#define GR_SIZEOF_INT 8
-#else
-#error "Unsupported number of bytes in `int' type!"
-#endif
-
- /* The number of bytes in a `long' type. */
-#if ULONG_MAX == 0xFFFFFFFFUL
-#define GR_SIZEOF_LONG 4
-#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
-#define GR_SIZEOF_LONG 8
-#else
-#error "Unsupported number of bytes in `long' type!"
-#endif
-
-#if GR_SIZEOF_INT == 4
-typedef int int32;
-typedef unsigned int uint32;
-#elif GR_SIZEOF_LONG == 4
-typedef long int32;
-typedef unsigned long uint32;
-#else
-#error "could not find a 32-bit integer type"
-#endif
-
typedef struct Translator
{
@@ -629,15 +595,15 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread += 3, lwrite++ )
{
- uint32 r = lread[0];
- uint32 g = lread[1];
- uint32 b = lread[2];
+ uint32_t r = lread[0];
+ uint32_t g = lread[1];
+ uint32_t b = lread[2];
*lwrite = ( r << 24 ) |
@@ -662,13 +628,13 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread++, lwrite++ )
{
- uint32 p = lread[0];
+ uint32_t p = lread[0];
*lwrite = ( p << 24 ) |
@@ -709,15 +675,15 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread += 3, lwrite++ )
{
- uint32 r = lread[0];
- uint32 g = lread[1];
- uint32 b = lread[2];
+ uint32_t r = lread[0];
+ uint32_t g = lread[1];
+ uint32_t b = lread[2];
*lwrite = ( r << 16 ) |
@@ -742,13 +708,13 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread++, lwrite++ )
{
- uint32 p = lread[0];
+ uint32_t p = lread[0];
*lwrite = ( p << 16 ) |
@@ -789,15 +755,15 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread += 3, lwrite++ )
{
- uint32 r = lread[0];
- uint32 g = lread[1];
- uint32 b = lread[2];
+ uint32_t r = lread[0];
+ uint32_t g = lread[1];
+ uint32_t b = lread[2];
*lwrite = ( r << 8 ) |
@@ -838,15 +804,15 @@ typedef unsigned long uint32;
for ( ; h > 0; h-- )
{
unsigned char* lread = line_read;
- uint32* lwrite = (uint32*)line_write;
+ uint32_t* lwrite = (uint32_t*)line_write;
int x = blit->width;
for ( ; x > 0; x--, lread += 3, lwrite++ )
{
- uint32 r = lread[0];
- uint32 g = lread[1];
- uint32 b = lread[2];
+ uint32_t r = lread[0];
+ uint32_t g = lread[1];
+ uint32_t b = lread[2];
*lwrite = ( r << 0 ) |
@@ -1099,7 +1065,7 @@ typedef unsigned long uint32;
const unsigned char* s = (const unsigned char*)"\x80\x40\x20\x10";
unsigned long* buffer;
unsigned long* dst;
- uint32* src;
+ uint32_t* src;
int sz, i, j;
@@ -1120,7 +1086,7 @@ typedef unsigned long uint32;
/* must convert to long array */
dst = buffer + 2;
- src = (uint32*)icon->buffer;
+ src = (uint32_t*)icon->buffer;
if ( icon->pitch < 0 )
src -= ( icon->rows - 1 ) * icon->pitch / 4;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 2e9854b: [graph] s/uint32/uint32_t/ and popularize it.,
Alexei Podtelezhnikov <=