summaryrefslogtreecommitdiff
path: root/print/ghostscript9-agpl-base/files/patch-contrib_gomni.c
blob: a8cf980d3035a49ed235428aee540920511a5522 (plain) (blame)
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
185
186
187
188
189
190
191
192
193
194
195
--- contrib/gomni.c.orig	2015-03-30 08:21:24 UTC
+++ contrib/gomni.c
@@ -530,7 +530,7 @@ CloseDevice (gx_device * pdev)
       && pDev->pcoreOmni->pszJobOptions
       )
    {
-      gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
+      gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
    }
 
    if (  pDev->pcoreOmni
@@ -549,7 +549,7 @@ CloseDevice (gx_device * pdev)
 
    if (pDev->pcoreOmni)
    {
-      gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni, sizeof (core_omni_device), 1, "omni/device");
+      gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni, sizeof (core_omni_device), 1, "omni/device");
       pDev->pcoreOmni = 0;
    }
 
@@ -720,7 +720,7 @@ SetupDevice (gx_device *pgxdev, gs_param
    {
       PDEVSTRUCT p;
 
-      p = (PDEVSTRUCT)gs_malloc (pgxdev->memory->non_gc_memory, 1, sizeof (Omni_Dev), "omni/instance");
+      p = (PDEVSTRUCT)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, sizeof (Omni_Dev), "omni/instance");
       if (!p)
       {
           dprintf ("<<<<<<<<<<<<<<<<<<<<<< ERROR >>>>>>>>>>>>>>>>>>>>>>>\n\n");
@@ -734,7 +734,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
       memset (pDev, 0, sizeof (Omni_Dev));
 
-      pDev->pcoreOmni = (core_omni_device *)gs_malloc (pgxdev->memory->non_gc_memory, 1, sizeof (core_omni_device), "omni/device");
+      pDev->pcoreOmni = (core_omni_device *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, sizeof (core_omni_device), "omni/device");
 
       if (!pDev->pcoreOmni)
       {
@@ -783,7 +783,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
       for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pDev->hmodOmni; i++)
       {
-          pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
+          pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
                                             strlen (cOmnilib)
                                             + strlen (apszLibraryPaths[i])
                                             + 1,
@@ -796,7 +796,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
               if (fDebugOutput) dprintf2 ("SetupDevice: Trying to load %s = %p\n", pszDeviceLib, pDev->hmodOmni);
           }
-          gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
+          gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
       }
 
       if (!pDev->hmodOmni)
@@ -810,7 +810,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
          for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pDev->hmodOmni; i++)
          {
-             pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
+             pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
                                                strlen (cOmnilib)
                                                + strlen (apszLibraryPaths[i])
                                                + 1,
@@ -830,7 +830,7 @@ SetupDevice (gx_device *pgxdev, gs_param
                     g_module_close (pModule);
                  }
              }
-             gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
+             gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
          }
 
          return 1;
@@ -953,7 +953,7 @@ SetupDevice (gx_device *pgxdev, gs_param
          )
       {
          if (!pDev->pcoreOmni->pszJobOptions)
-            pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (pDev->memory->non_gc_memory, 1, fname.size + 1, "Option String");
+            pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, fname.size + 1, "Option String");
          memcpy (pDev->pcoreOmni->pszJobOptions, fname.data, fname.size);
          pDev->pcoreOmni->pszJobOptions[fname.size] = '\0';
       }
@@ -1044,7 +1044,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
          for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pModule; i++)
          {
-            pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
+            pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
                                               strlen (cDialogName)
                                               + strlen (apszLibraryPaths[i])
                                               + 1,
@@ -1059,7 +1059,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
                 pModule = g_module_open (pszDeviceLib, (GModuleFlags)0);
             }
-            gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
+            gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
          }
 
          if (!pModule)
@@ -1070,7 +1070,7 @@ SetupDevice (gx_device *pgxdev, gs_param
 
             for (i = 0; i < sizeof (apszLibraryPaths)/sizeof (apszLibraryPaths[0]) && !pModule; i++)
             {
-               pszDeviceLib = (char *)gs_malloc (pDev->memory->non_gc_memory, 1,
+               pszDeviceLib = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1,
                                                  strlen (cDialogName)
                                                  + strlen (apszLibraryPaths[i])
                                                  + 1,
@@ -1092,7 +1092,7 @@ SetupDevice (gx_device *pgxdev, gs_param
                       g_module_close (pModule);
                    }
                }
-               gs_free (pDev->memory->non_gc_memory, pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
+               gs_free (gs_lib_ctx_get_non_gc_memory_t(), pszDeviceLib, strlen (pszDeviceLib) + 1, 1, "Devicestring");
             }
          }
          else
@@ -1107,13 +1107,13 @@ SetupDevice (gx_device *pgxdev, gs_param
 
                if (pDev->pcoreOmni->pszJobOptions)
                {
-                  gs_free (pDev->memory->non_gc_memory, pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
+                  gs_free (gs_lib_ctx_get_non_gc_memory_t(), pDev->pcoreOmni->pszJobOptions, strlen (pDev->pcoreOmni->pszJobOptions) + 1, 1, "Option String");
                   pDev->pcoreOmni->pszJobOptions = 0;
                }
 
                iLength = strlen (pszSelectedJobProperties);
 
-               pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (pDev->memory->non_gc_memory, 1, iLength + 1, "Option String");
+               pDev->pcoreOmni->pszJobOptions = (char *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iLength + 1, "Option String");
 
                strcpy (pDev->pcoreOmni->pszJobOptions, pszSelectedJobProperties);
 
@@ -1375,7 +1375,7 @@ PrintPage (gx_device_printer *pgx_prt_de
       iBytesToAlloc += (iNumColors - 1) * sizeof (RGB2);
    }
 
-   pbmi = (PBITMAPINFO2)gs_malloc (pDev->memory->non_gc_memory, 1, iBytesToAlloc, "Bmpi Memory");
+   pbmi = (PBITMAPINFO2)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iBytesToAlloc, "Bmpi Memory");
    if (!pbmi)
    {
       eprintf("<<<<<<<<<<<<<<<<<<<<<< ERROR >>>>>>>>>>>>>>>>>>>>>>>\n\n");
@@ -1481,7 +1481,7 @@ PrintPage (gx_device_printer *pgx_prt_de
       }
    }
 
-   pGSData = (byte *)gs_malloc (pDev->memory->non_gc_memory, uiBytesPerLine, 1, "bmp file buffer");
+   pGSData = (byte *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), uiBytesPerLine, 1, "bmp file buffer");
 
    if (pGSData == 0)
       /* can't allocate row buffer */
@@ -1501,7 +1501,7 @@ PrintPage (gx_device_printer *pgx_prt_de
                                 pasyncDev->pDev->iVertDots,
                                 8000*1024);                 /*eight meg buffer */
 
-   pBitmapMem = (byte *) gs_malloc (pDev->memory->non_gc_memory, 1, uiBytesPerLine * ulBandLength, "Bitmap Memory");
+   pBitmapMem = (byte *) gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, uiBytesPerLine * ulBandLength, "Bitmap Memory");
 
    if(!pBitmapMem)
    {
@@ -1613,7 +1613,7 @@ PrintPage (gx_device_printer *pgx_prt_de
             {
                if (prtMode.iBitCount < 16)
                {
-                  pMonoData = (byte *)gs_malloc (pDev->memory->non_gc_memory, 1, iYBand * ImageInfo.ulTrgBytesPerLine, "Mono Memory");
+                  pMonoData = (byte *)gs_malloc (gs_lib_ctx_get_non_gc_memory_t(), 1, iYBand * ImageInfo.ulTrgBytesPerLine, "Mono Memory");
 
                   if (pMonoData)
                   {
@@ -1661,7 +1661,7 @@ PrintPage (gx_device_printer *pgx_prt_de
                /* We're done with the mono band */
                /* now free up the mono buffer so we can get clean data buffer if more lines are to be */
                /* gray-scaled */
-               gs_free (pDev->memory->non_gc_memory, (char *)pMonoData, iYBand * ImageInfo.ulTrgBytesPerLine, 1, "Mono Memory");
+               gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pMonoData, iYBand * ImageInfo.ulTrgBytesPerLine, 1, "Mono Memory");
 
                pMonoData = NULL;
             }
@@ -1709,11 +1709,11 @@ PrintPage (gx_device_printer *pgx_prt_de
 
 done:
 
-   gs_free (pDev->memory->non_gc_memory, (char *) pBitmapMem, uiBytesPerLine * ulBandLength, 1, "Bitmap Memory");
+   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *) pBitmapMem, uiBytesPerLine * ulBandLength, 1, "Bitmap Memory");
    dprintf ("Page Completed\n");
 
-   gs_free (pDev->memory->non_gc_memory, (char *)pGSData, uiBytesPerLine, 1, "bmp file buffer");
-   gs_free (pDev->memory->non_gc_memory, (char *)pbmi, uiBytesPerLine, 1, "Bpmi Memory");
+   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pGSData, uiBytesPerLine, 1, "bmp file buffer");
+   gs_free (gs_lib_ctx_get_non_gc_memory_t(), (char *)pbmi, uiBytesPerLine, 1, "Bpmi Memory");
 
    /******************************************************************/
    /* Note:                                         @@08162000       */