Changeset 3073 for libpipi


Ignore:
Timestamp:
Oct 23, 2008, 2:29:39 PM (12 years ago)
Author:
Sam Hocevar
Message:

libpipi: make gdiplus.cpp build on older Windows versions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/codec/gdiplus.cpp

    r3070 r3073  
    2424
    2525#include <windows.h>
    26 #include <gdiplus.h>
     26
     27#include <Gdiplus.h>
    2728
    2829#include "pipi.h"
     
    3233{
    3334    size_t len;
    34     if(mbstowcs_s(&len, NULL, 0, name, _TRUNCATE) != 0)
    35         return NULL;
    36     wchar_t *wname = new wchar_t[len];
    37     if(mbstowcs_s(NULL, wname, len, name, _TRUNCATE) != 0)
     35    len = mbstowcs(NULL, name, 0);
     36    wchar_t *wname = new wchar_t[len + 1];
     37    if(mbstowcs(wname, name, len + 1) != (size_t)-1)
    3838    {
    3939        delete[] wname;
     
    5656    Gdiplus::Rect rect(0, 0, b->GetWidth(), b->GetHeight());
    5757
    58     if(b->LockBits(&rect, Gdiplus::ImageLockModeRead,
     58    if(b->LockBits(rect, Gdiplus::ImageLockModeRead,
    5959                   PixelFormat32bppARGB, &bdata) != Gdiplus::Ok)
    6060    {
     
    110110
    111111    size_t len;
    112     if(mbstowcs_s(&len, NULL, 0, name, _TRUNCATE) != 0)
    113         return NULL;
    114     wchar_t *wname = new wchar_t[len];
    115     if(mbstowcs_s(NULL, wname, len, name, _TRUNCATE) != 0)
     112    len = mbstowcs(NULL, name, 0);
     113    wchar_t *wname = new wchar_t[len + 1];
     114    if(mbstowcs(wname, name, len + 1) != (size_t)-1)
    116115    {
    117116        delete[] wname;
     
    129128    Gdiplus::Rect rect(0, 0, img->w, img->h);
    130129
    131     if(b->LockBits(&rect, Gdiplus::ImageLockModeWrite,
     130    if(b->LockBits(rect, (unsigned int)Gdiplus::ImageLockModeWrite,
    132131                   PixelFormat32bppARGB, &bdata) != Gdiplus::Ok)
    133132    {
Note: See TracChangeset for help on using the changeset viewer.