File: types.patch

package info (click to toggle)
cbflib 0.9.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 25,708 kB
  • sloc: ansic: 64,308; python: 13,974; sh: 10,376; makefile: 1,113; yacc: 656; f90: 210; cpp: 65; java: 16
file content (123 lines) | stat: -rw-r--r-- 7,225 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
From a93c9c9a11040a94085e8e46db2555ff506b5d79 Mon Sep 17 00:00:00 2001
From: Teemu Ikonen <tpikonen@gmail.com>
Date: Thu, 30 May 2013 15:24:27 +0200
Subject: [PATCH] cbf_copy.c: Replace (unsigned) long ints by (u)int32_t's.

Fixes compilation error in 64-bit linux.
---
 src/cbf_copy.c |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/cbf_copy.c b/src/cbf_copy.c
index da6124f..f3077ec 100644
--- a/src/cbf_copy.c
+++ b/src/cbf_copy.c
@@ -265,6 +265,7 @@ extern "C" {
 #include <ctype.h>
 #include <string.h>
 #include <math.h>
+#include <stdint.h>
     
     
     /* cbf_copy_cbf -- copy cbfin to cbfout */
@@ -771,7 +772,7 @@ extern "C" {
                                                          &elements, &minelement, &maxelement, &realarray,
                                                          &byteorder, &dim1, &dim2, &dim3, &padding))
             
-            if (oelsize != sizeof (long int) &&
+            if (oelsize != sizeof (int32_t) &&
 #ifdef CBF_USE_LONG_LONG
                 oelsize != sizeof(long long int) &&
 #else
@@ -887,13 +888,13 @@ extern "C" {
                                             else ((unsigned char *)array)[icount] = (unsigned short int)doval;
                                             break;
                                             
-                                        case (sizeof(long int)):
-                                            if (elsigned) doval = (double)((signed long int *)array)[icount];
-                                            else doval = (double)((unsigned long int *)array)[icount];
+                                        case (sizeof(int32_t)):
+                                            if (elsigned) doval = (double)((int32_t *)array)[icount];
+                                            else doval = (double)((uint32_t *)array)[icount];
                                             if (doval < cliplow) doval = cliplow;
                                             if (doval > cliphigh) doval = cliphigh;
-                                            if (elsigned) ((signed char *)array)[icount] = (signed long int)doval;
-                                            else ((unsigned char *)array)[icount] = (unsigned long int)doval;
+                                            if (elsigned) ((signed char *)array)[icount] = (int32_t)doval;
+                                            else ((unsigned char *)array)[icount] = (uint32_t)doval;
                                             break;
                                             
 #ifdef CBF_USE_LONG_LONG                                                        
@@ -1052,13 +1053,13 @@ extern "C" {
                                         
                                         break;
                                         
-                                    case sizeof(long int):
+                                    case sizeof(int32_t):
                                         
                                         if (elsigned) {
                                             
                                             for (icount = 0; icount < elements; icount++) {
                                                 
-                                                xvalue = ((signed long int *)array)[icount];
+                                                xvalue = ((int32_t *)array)[icount];
                                                 
                                                 if (elsize == sizeof(double)) ((double *)narray)[icount] = xvalue;
                                                 
@@ -1071,7 +1072,7 @@ extern "C" {
                                             
                                             for (icount = 0; icount < elements; icount++) {
                                                 
-                                                xvalue = ((unsigned long int *)array)[icount];
+                                                xvalue = ((uint32_t *)array)[icount];
                                                 
                                                 if (elsize == sizeof(double)) ((double *)narray)[icount] = xvalue;
                                                 
@@ -1452,7 +1453,7 @@ extern "C" {
                                         
                                         break;
                                         
-                                    case (sizeof(long int)):
+                                    case (sizeof(int32_t)):
                                         
                                         if (oelsize == sizeof(float)) {
                                             
@@ -1467,7 +1468,7 @@ extern "C" {
                                                         free(array); free(narray); return CBF_OVERFLOW;
                                                     }
                                                     
-                                                    ((signed long int *)narray)[icount] = (signed long int)valtemp;
+                                                    ((int32_t *)narray)[icount] = (int32_t)valtemp;
                                                 }
                                                 
                                             } else {
@@ -1481,7 +1482,7 @@ extern "C" {
                                                         free(array); free(narray); return CBF_OVERFLOW;
                                                     }
                                                     
-                                                    ((unsigned long int *)narray)[icount] = (unsigned long int)valtemp;
+                                                    ((uint32_t *)narray)[icount] = (uint32_t)valtemp;
                                                 }
                                                 
                                             }
@@ -1499,7 +1500,7 @@ extern "C" {
                                                         free(array); free(narray); return CBF_OVERFLOW;
                                                     }
                                                     
-                                                    ((signed long int *)narray)[icount] = (signed long int)valtemp;
+                                                    ((int32_t *)narray)[icount] = (int32_t)valtemp;
                                                 }
                                                 
                                             } else {
@@ -1513,7 +1514,7 @@ extern "C" {
                                                         free(array); free(narray); return CBF_OVERFLOW;
                                                     }
                                                     
-                                                    ((unsigned long int *)narray)[icount] = (unsigned long int)valtemp;
+                                                    ((uint32_t *)narray)[icount] = (uint32_t)valtemp;
                                                 }
                                                 
                                             }
-- 
1.7.10.4