~ubuntu-branches/ubuntu/gutsy/gimp/gutsy

« back to all changes in this revision

Viewing changes to plug-ins/winsnap/winsnap.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-06-22 17:33:56 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070622173356-ncevaebpjiwyxkif
Tags: 2.3.18-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/control: Maintainer change.
  - debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch,
    debian/patches/10_dont_show_wizard.patch: Distro patches.
  - debian/rules:
    - use dh_iconcache,
    - i18n magic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
 * a readable string.  Store in the provided
166
166
 * buffer.
167
167
 */
168
 
void
169
 
formatWindowsError(char *buffer)
 
168
static void
 
169
formatWindowsError(char *buffer, int buf_size)
170
170
{
171
171
  LPVOID lpMsgBuf;
172
172
 
178
178
                (LPTSTR) &lpMsgBuf, 0, NULL );
179
179
 
180
180
  /* Copy to the buffer */
181
 
  strcpy(buffer, lpMsgBuf);
 
181
  strncpy(buffer, lpMsgBuf, buf_size - 1);
182
182
 
183
183
  LocalFree(lpMsgBuf);
184
184
}
223
223
                             DIB_RGB_COLORS,
224
224
                             &capBytes, NULL, 0);
225
225
  if (!hbmCopy) {
226
 
    formatWindowsError(buffer);
 
226
    formatWindowsError(buffer, sizeof buffer);
227
227
    g_error("Error creating DIB section: %s", buffer);
228
228
  return NULL;
229
229
  }
231
231
  /* Select the bitmap into the compatible DC. */
232
232
  oldObject = SelectObject(hdcCompat, hbmCopy);
233
233
  if (!oldObject) {
234
 
    formatWindowsError(buffer);
 
234
    formatWindowsError(buffer, sizeof buffer);
235
235
    g_error("Error selecting object: %s", buffer);
236
236
    return NULL;
237
237
  }
243
243
              width, height,
244
244
              hdcWindow, 0,0,
245
245
              SRCCOPY)) {
246
 
    formatWindowsError(buffer);
 
246
    formatWindowsError(buffer, sizeof buffer);
247
247
    g_error("Error copying bitmap: %s", buffer);
248
248
    return NULL;
249
249
  }
291
291
    capRegion = CreateRectRgn(rect.left, rect.top,
292
292
                              rect.right, rect.bottom);
293
293
    if (!capRegion) {
294
 
      formatWindowsError(buffer);
 
294
      formatWindowsError(buffer, sizeof buffer);
295
295
      g_error("Error creating region: %s", buffer);
296
296
      return FALSE;
297
297
    }
314
314
  }
315
315
 
316
316
  if (!hdcSrc) {
317
 
    formatWindowsError(buffer);
 
317
    formatWindowsError(buffer, sizeof buffer);
318
318
    g_error("Error getting device context: %s", buffer);
319
319
    return FALSE;
320
320
  }
321
321
  hdcCompat = CreateCompatibleDC(hdcSrc);
322
322
  if (!hdcCompat) {
323
 
    formatWindowsError(buffer);
 
323
    formatWindowsError(buffer, sizeof buffer);
324
324
    g_error("Error getting compat device context: %s", buffer);
325
325
    return FALSE;
326
326
  }
672
672
 
673
673
  /* Log error */
674
674
  if (!retValue) {
675
 
    formatWindowsError(buffer);
 
675
    formatWindowsError(buffer, sizeof buffer);
676
676
    g_error("Error registering class: %s", buffer);
677
677
    return retValue;
678
678
  }
1121
1121
 * sendBMPToGIMP
1122
1122
 *
1123
1123
 * Take the captured data and send it across
1124
 
 * to the GIMP.
 
1124
 * to GIMP.
1125
1125
 */
1126
1126
static void
1127
1127
sendBMPToGimp(HBITMAP hBMP, HDC hDC, RECT rect)