File: 0003-Avoid-using-mips-as-a-variable.patch

package info (click to toggle)
e17 0.25.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 435,284 kB
  • sloc: ansic: 253,713; xml: 1,010; sh: 981; makefile: 25
file content (184 lines) | stat: -rw-r--r-- 5,352 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
Description: don't use gcc predefined macro as variable
Author: Ross Vandegrift <ross@kallisti.us>
Origin: other
Forwarded: yes
Last-Update: 2020-08-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
From: Ross Vandegrift <ross@kallisti.us>
Date: Tue, 4 Aug 2020 18:48:30 -0700
Subject: Avoid using "mips" as a variable

Summary:
"mips" is a gcc system-specific predefined macro on mipsel & mips64el.  This
fixes compilation on those platforms.

References:
- https://gcc.gnu.org/onlinedocs/cpp/System-specific-Predefined-Macros.html
- https://gcc.gnu.org/pipermail/gcc-help/2020-August/139241.html

Fixes T8781

Test Plan: built on a debian mipsel porterbox

Reviewers: raster, devilhorns

Subscribers: cedric, zmike

Tags: #enlightenment-git

Maniphest Tasks: T8781

Differential Revision: https://phab.enlightenment.org/D12096
---
 src/bin/e_wallpaper_gen_main.c | 56 +++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

--- a/src/bin/e_wallpaper_gen_main.c
+++ b/src/bin/e_wallpaper_gen_main.c
@@ -85,33 +85,33 @@
 {
    int i, j = 0;
    int nw, nh, pw = 0, ph = 0;
-   Mip *mips = calloc(1, sizeof(Mip) * MAX_RES_NUM);
+   Mip *mips_ = calloc(1, sizeof(Mip) * MAX_RES_NUM);
 
-   if (!mips) return NULL;
+   if (!mips_) return NULL;
    for (i = 0; resolutions[i]; i += 2)
      {
         nh = resolutions[i + 1];
         nw = (w * nh) / h;
         if ((nh >= h) || (nw >= w))
           {
-             mips[j].from_w = pw;
-             mips[j].from_h = ph;
-             mips[j].to_w = 1000000000;
-             mips[j].to_h = 1000000000;
-             mips[j].last = EINA_TRUE;
+             mips_[j].from_w = pw;
+             mips_[j].from_h = ph;
+             mips_[j].to_w = 1000000000;
+             mips_[j].to_h = 1000000000;
+             mips_[j].last = EINA_TRUE;
              break;
           }
 
-        mips[j].from_w = pw;
-        mips[j].from_h = ph;
-        mips[j].to_w = nw;
-        mips[j].to_h = nh;
+        mips_[j].from_w = pw;
+        mips_[j].from_h = ph;
+        mips_[j].to_w = nw;
+        mips_[j].to_h = nh;
 
         j++;
         pw = nw + 1;
         ph = nh + 1;
      }
-   return mips;
+   return mips_;
 }
 
 EAPI int
@@ -123,7 +123,7 @@
    int bg_b = 64;
    char dir_buf[128], img_buf[256], edc_buf[256], cmd_buf[1024], qual_buf[64];
    const char *dir, *quality_string = NULL, *img_name = NULL;
-   Mip *mips = NULL;
+   Mip *mips_ = NULL;
    int i, imw, imh, w, h, quality;
    int ret = 0, mips_num = 0;
    Eina_Bool alpha;
@@ -207,25 +207,25 @@
        (!strcmp(mode, "scale_out")) ||
        (!strcmp(mode, "pan")))
      { // need to produce multiple scaled versions
-        mips = _resolutions_calc(w, h);
-        if (!mips) return 6;
-        for (i = 0; mips[i].to_w; i++)
+        mips_ = _resolutions_calc(w, h);
+        if (!mips_) return 6;
+        for (i = 0; mips_[i].to_w; i++)
           {
              mips_num++;
-             if (mips[i].last)
+             if (mips_[i].last)
                {
                   imw = w;
                   imh = h;
                }
              else
                {
-                  imw = mips[i].to_w;
-                  imh = mips[i].to_h;
+                  imw = mips_[i].to_w;
+                  imh = mips_[i].to_h;
                }
              evas_object_resize(subwin, imw, imh);
              evas_object_resize(image, imw, imh);
              elm_win_render(subwin);
-             if (mips[i].last)
+             if (mips_[i].last)
                snprintf(img_buf, sizeof(img_buf), "%s/img.png",
                         dir);
              else
@@ -239,7 +239,7 @@
           }
      }
    // no multiple resolutions -0 save out original
-   if (!mips)
+   if (!mips_)
      {
         evas_object_resize(subwin, w, h);
         evas_object_resize(image, w, h);
@@ -267,7 +267,7 @@
    snprintf(edc_buf, sizeof(edc_buf), "%s/bg.edc", dir);
    f = fopen(edc_buf, "w");
    if (!f) goto cleanup;
-   if ((mips) && (mips_num > 1))
+   if ((mips_) && (mips_num > 1))
      {
         fprintf(f,
                 "images {\n"
@@ -276,7 +276,7 @@
           {
              fprintf(f,
                      "  image {\n");
-             if (mips[i].last)
+             if (mips_[i].last)
                {
                   fprintf(f,
                           "   image: \"img.png\" %s;\n",
@@ -284,8 +284,8 @@
                }
              else
                {
-                  imw = mips[i].to_w;
-                  imh = mips[i].to_h;
+                  imw = mips_[i].to_w;
+                  imh = mips_[i].to_h;
                   fprintf(f,
                           "   image: \"img-%ix%i.png\" %s;\n",
                           imw, imh, quality_string);
@@ -293,8 +293,8 @@
              fprintf(f,
                      "   size: %i %i %i %i;\n"
                      "  }\n",
-                     mips[i].from_w, mips[i].from_h,
-                     mips[i].to_w, mips[i].to_h);
+                     mips_[i].from_w, mips_[i].from_h,
+                     mips_[i].to_w, mips_[i].to_h);
           }
         fprintf(f,
                 " }\n"
@@ -489,7 +489,7 @@
      }
    ret = system(cmd_buf);
 cleanup:
-   free(mips);
+   free(mips_);
    ecore_file_recursive_rm(dir);
    evas_object_del(win);
    return ret;