Import print/ghostscript9-agpl-base version 9.16_2
[dports.git] / print / ghostscript9-agpl-base / files / patch-contrib__gomni.c
1 --- contrib/gomni.c.orig        2013-04-28 02:09:12.000000000 +0900
2 +++ contrib/gomni.c     2013-04-28 02:09:14.000000000 +0900
3 @@ -530,7 +530,7 @@
4        && pDev->pcoreOmni->pszJobOptions
5        )
6     {
7 -      gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
8 +      gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
9     }
10  
11     if (  pDev->pcoreOmni
12 @@ -549,7 +549,7 @@
13  
14     if (pDev->pcoreOmni)
15     {
16 -      gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni, sizeof (core_omni_device), 1, "omni/device");
17 +      gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni, sizeof (core_omni_device), 1, "omni/device");
18        pDev->pcoreOmni = 0;
19     }
20  
21 @@ -720,7 +720,7 @@
22     {
23        PDEVSTRUCT p;
24  
25 -      p = (PDEVSTRUCT)gs_malloc (pgxdev->memory->non_gc_memory, 1, sizeof (Omni_Dev), "omni/instance");
26 +      p = (PDEVSTRUCT)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, sizeof (Omni_Dev), "omni/instance");
27        if (!p)
28        {
29            dprintf ("<<<<<<<<<<<<<<<<<<<<<< ERROR >>>>>>>>>>>>>>>>>>>>>>>\n\n");
30 @@ -734,7 +734,7 @@
31  
32        memset (pDev, 0, sizeof (Omni_Dev));
33  
34 -      pDev->pcoreOmni = (core_omni_device *)gs_malloc (pgxdev->memory->non_gc_memory, 1, sizeof (core_omni_device), "omni/device");
35 +      pDev->pcoreOmni = (core_omni_device *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, sizeof (core_omni_device), "omni/device");
36  
37        if (!pDev->pcoreOmni)
38        {
39 @@ -783,7 +783,7 @@
40  
41        for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pDev->hmodOmni; i++)
42        {
43 -          pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
44 +          pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
45                                              strlen (cOmnilib)
46                                              + strlen (apszLibraryPaths[i])
47                                              + 1,
48 @@ -796,7 +796,7 @@
49  
50                if (fDebugOutput) dprintf2 ("SetupDevice: Trying to load %s = %p\n", pszDeviceLib, pDev->hmodOmni);
51            }
52 -          gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
53 +          gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
54        }
55  
56        if (!pDev->hmodOmni)
57 @@ -810,7 +810,7 @@
58  
59           for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pDev->hmodOmni; i++)
60           {
61 -             pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
62 +             pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
63                                                 strlen (cOmnilib)
64                                                 + strlen (apszLibraryPaths[i])
65                                                 + 1,
66 @@ -830,7 +830,7 @@
67                      g_module_close (pModule);
68                   }
69               }
70 -             gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
71 +             gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
72           }
73  
74           return 1;
75 @@ -953,7 +953,7 @@
76           )
77        {
78           if (!pDev->pcoreOmni->pszJobOptions)
79 -            pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (pDev->memory->non_gc_memory, 1, fname.size + 1, "Option String");
80 +            pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, fname.size + 1, "Option String");
81           memcpy (pDev->pcoreOmni->pszJobOptions, fname.data, fname.size);
82           pDev->pcoreOmni->pszJobOptions[fname.size] = '\0';
83        }
84 @@ -1044,7 +1044,7 @@
85  
86           for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pModule; i++)
87           {
88 -            pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
89 +            pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
90                                                strlen (cDialogName)
91                                                + strlen (apszLibraryPaths[i])
92                                                + 1,
93 @@ -1059,7 +1059,7 @@
94  
95                  pModule = g_module_open (pszDeviceLib, (GModuleFlags)0);
96              }
97 -            gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
98 +            gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
99           }
100  
101           if (!pModule)
102 @@ -1070,7 +1070,7 @@
103  
104              for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pModule; i++)
105              {
106 -               pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
107 +               pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
108                                                   strlen (cDialogName)
109                                                   + strlen (apszLibraryPaths[i])
110                                                   + 1,
111 @@ -1092,7 +1092,7 @@
112                        g_module_close (pModule);
113                     }
114                 }
115 -               gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
116 +               gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
117              }
118           }
119           else
120 @@ -1107,13 +1107,13 @@
121  
122                 if (pDev->pcoreOmni->pszJobOptions)
123                 {
124 -                  gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
125 +                  gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
126                    pDev->pcoreOmni->pszJobOptions = 0;
127                 }
128  
129                 iLength = strlen (pszSelectedJobProperties);
130  
131 -               pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (pDev->memory->non_gc_memory, 1, iLength + 1, "Option String");
132 +               pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iLength + 1, "Option String");
133  
134                 strcpy (pDev->pcoreOmni->pszJobOptions, pszSelectedJobProperties);
135  
136 @@ -1375,7 +1375,7 @@
137        iBytesToAlloc += (iNumColors - 1) * sizeof (RGB2);
138     }
139  
140 -   pbmi = (PBITMAPINFO2)gs_malloc (pDev->memory->non_gc_memory, 1, iBytesToAlloc, "Bmpi Memory");
141 +   pbmi = (PBITMAPINFO2)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iBytesToAlloc, "Bmpi Memory");
142     if (!pbmi)
143     {
144        eprintf("<<<<<<<<<<<<<<<<<<<<<< ERROR >>>>>>>>>>>>>>>>>>>>>>>\n\n");
145 @@ -1481,7 +1481,7 @@
146        }
147     }
148  
149 -   pGSData = (byte *)gs_malloc (pDev->memory->non_gc_memory, uiBytesPerLine, 1, "bmp file buffer");
150 +   pGSData = (byte *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), uiBytesPerLine, 1, "bmp file buffer");
151  
152     if (pGSData == 0)
153        /* can't allocate row buffer */
154 @@ -1501,7 +1501,7 @@
155                                  pasyncDev->pDev->iVertDots,
156                                  8000*1024);                 /*eight meg buffer */
157  
158 -   pBitmapMem = (byte *) gs_malloc (pDev->memory->non_gc_memory, 1, uiBytesPerLine * ulBandLength, "Bitmap Memory");
159 +   pBitmapMem = (byte *) gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, uiBytesPerLine * ulBandLength, "Bitmap Memory");
160  
161     if(!pBitmapMem)
162     {
163 @@ -1613,7 +1613,7 @@
164              {
165                 if (prtMode.iBitCount < 16)
166                 {
167 -                  pMonoData = (byte *)gs_malloc (pDev->memory->non_gc_memory, 1, iYBand * ImageInfo.ulTrgBytesPerLine, "Mono Memory");
168 +                  pMonoData = (byte *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iYBand * ImageInfo.ulTrgBytesPerLine, "Mono Memory");
169  
170                    if (pMonoData)
171                    {
172 @@ -1661,7 +1661,7 @@
173                 /* We're done with the mono band */
174                 /* now free up the mono buffer so we can get clean data buffer if more lines are to be */
175                 /* gray-scaled */
176 -               gs_free (pDev->memory->non_gc_memory, (char *)pMonoData, iYBand * ImageInfo.ulTrgBytesPerLine, 1, "Mono Memory");
177 +               gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pMonoData, iYBand * ImageInfo.ulTrgBytesPerLine, 1, "Mono Memory");
178  
179                 pMonoData = NULL;
180              }
181 @@ -1709,11 +1709,11 @@
182  
183  done:
184  
185 -   gs_free (pDev->memory->non_gc_memory, (char *) pBitmapMem, uiBytesPerLine * ulBandLength, 1, "Bitmap Memory");
186 +   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *) pBitmapMem, uiBytesPerLine * ulBandLength, 1, "Bitmap Memory");
187     dprintf ("Page Completed\n");
188  
189 -   gs_free (pDev->memory->non_gc_memory, (char *)pGSData, uiBytesPerLine, 1, "bmp file buffer");
190 -   gs_free (pDev->memory->non_gc_memory, (char *)pbmi, uiBytesPerLine, 1, "Bpmi Memory");
191 +   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pGSData, uiBytesPerLine, 1, "bmp file buffer");
192 +   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pbmi, uiBytesPerLine, 1, "Bpmi Memory");
193  
194     /******************************************************************/
195     /* Note:                                         @@08162000       */