Commit 5b49dba8 authored by Gildas Bazin's avatar Gildas Bazin

Win32 changes only:

 - defined off_t as a long long. This allows DVD navigation to work.
   This change is to be implemented on a compiler by compiler basis. For
   now, it works on mingw32 (tested) and should work on MSVC (not tested).

 - Implemented a quick and dirty hack in intf_msg.c to be able to display
   long long integers with printf on Win32. This change is also necessary
   to avoid segfaults when debug is enabled in vlc on Win32.

 - few minor changes in the directx plugins.

 - defined snprintf in common.h and removed a few #ifdef WIN32
parent 52add4b0
......@@ -195,7 +195,7 @@ CFLAGS += -traditional-cpp
endif
ifneq (,$(findstring mingw32,$(SYS)))
CFLAGS += -fnative-struct
CFLAGS += -fnative-struct -D_OFF_T_ -D_off_t=long
endif
# Optimizations : don't compile debug versions with them
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.35 2001/06/03 12:47:21 sam Exp $
* $Id: common.h,v 1.36 2001/07/08 17:45:51 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -193,7 +193,6 @@ struct pgrm_descriptor_s;
/* win32, cl and icl support */
#if defined( _MSC_VER )
typedef long off_t;
# define __attribute__(x)
# define __inline__ __inline
# define strncasecmp strnicmp
......@@ -207,3 +206,14 @@ typedef long off_t;
# define I64C(x) x##LL
#endif
#if defined( WIN32 )
typedef __int64 off_t;
#ifndef snprintf
#define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
#endif
#endif
......@@ -2,7 +2,7 @@
* aout_directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: aout_directx.c,v 1.3 2001/06/14 01:49:44 sam Exp $
* $Id: aout_directx.c,v 1.4 2001/07/08 17:45:52 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -97,7 +97,7 @@ static void aout_Play ( aout_thread_t *p_aout,
byte_t *buffer, int i_size );
static void aout_Close ( aout_thread_t *p_aout );
/* local function */
/* local functions */
static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout );
static int DirectxInitDSound( aout_thread_t *p_aout );
......@@ -209,6 +209,7 @@ static int aout_Open( aout_thread_t *p_aout )
intf_WarnMsg( 3, "aout: can't set primary buffer format");
}
#if 0
/* ensure the primary buffer is playing. We won't actually hear anything
* until the secondary buffer is playing */
dsresult = IDirectSoundBuffer_Play( p_aout->p_sys->p_dsbuffer_primary,
......@@ -224,6 +225,7 @@ static int aout_Open( aout_thread_t *p_aout )
p_aout->p_sys->p_dsbuffer_primary = NULL;
return( 1 );
}
#endif
return( 0 );
}
......@@ -286,6 +288,7 @@ static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
return( l_buffer_limit );
}
#if 0
/* temporary hack. When you start playing a new file, the play position
* doesn't start changing immediatly, even though sound is already
* playing from the sound card */
......@@ -294,6 +297,7 @@ static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_buffer_limit);
return( l_buffer_limit );
}
#endif
l_result = (p_aout->p_sys->l_write_position >= l_play_position) ?
(p_aout->p_sys->l_write_position - l_play_position) /2
......@@ -334,6 +338,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
intf_WarnMsg( 3, "aout: DirectX aout_Play can'get buffer position");
}
#if 1
/* check that we are not overflowing the circular buffer (everything should
* be alright but just in case) */
l_buffer_free_length = l_play_position - p_aout->p_sys->l_write_position;
......@@ -352,11 +357,13 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
}
else
{
#if 0
intf_WarnMsg( 4, "aout: DirectX aout_Play buffer: size %i, free %i !!!"
, i_size, l_buffer_free_length);
intf_WarnMsg( 4, "aout: DirectX aout_Play buffer: writepos %i, readpos %i !!!", p_aout->p_sys->l_write_position, l_play_position);
#endif
}
#endif
/* Before copying anything, we have to lock the buffer */
dsresult = IDirectSoundBuffer_Lock( p_aout->p_sys->p_dsbuffer,
......@@ -389,7 +396,9 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
/* Now do the actual memcopy (two memcpy because the buffer is circular) */
memcpy( p_write_position, buffer, l_bytes1 );
if( p_start_buffer != NULL )
{
memcpy( p_start_buffer, buffer + l_bytes1, l_bytes2 );
}
/* Now the data has been copied, unlock the buffer */
IDirectSoundBuffer_Unlock( p_aout->p_sys->p_dsbuffer,
......@@ -543,7 +552,6 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
WAVEFORMATEX waveformat;
DSBUFFERDESC dsbdesc;
DSBCAPS dsbcaps;
HRESULT dsresult;
/* First set the buffer format */
memset(&waveformat, 0, sizeof(WAVEFORMATEX));
......@@ -561,7 +569,7 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2/* Better position accuracy */
| DSBCAPS_GLOBALFOCUS; /* Allows background playing */
dsbdesc.dwBufferBytes = waveformat.nAvgBytesPerSec * 4; /* 4 sec buffer */
dsbdesc.dwBufferBytes = waveformat.nAvgBytesPerSec * 2; /* 2 sec buffer */
dsbdesc.lpwfxFormat = &waveformat;
if( IDirectSound_CreateSoundBuffer( p_aout->p_sys->p_dsobject,
......
......@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_directx.c,v 1.5 2001/06/28 22:12:04 gbazin Exp $
* $Id: vout_directx.c,v 1.6 2001/07/08 17:45:52 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -137,6 +137,7 @@ static void DirectXCloseDDraw ( vout_thread_t *p_vout );
static void DirectXCloseWindow ( vout_thread_t *p_vout );
static void DirectXCloseDisplay ( vout_thread_t *p_vout );
static void DirectXCloseSurface ( vout_thread_t *p_vout );
static void DirectXKeepAspectRatio( vout_thread_t *p_vout, RECT *coordinates );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
......@@ -302,9 +303,7 @@ static int vout_Manage( vout_thread_t *p_vout )
WINDOWPLACEMENT window_placement;
boolean_t b_dispatch_msg = TRUE;
while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( GetMessage(&msg, NULL, 0, 0) >= 0 )
while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
switch( msg.message )
{
......@@ -339,6 +338,7 @@ static int vout_Manage( vout_thread_t *p_vout )
b_dispatch_msg = FALSE;
break;
#if 0
case WM_PAINT:
intf_WarnMsg( 4, "vout: vout_Manage WM_PAINT" );
break;
......@@ -346,6 +346,7 @@ static int vout_Manage( vout_thread_t *p_vout )
case WM_ERASEBKGND:
intf_WarnMsg( 4, "vout: vout_Manage WM_ERASEBKGND" );
break;
#endif
case WM_MOUSEMOVE:
intf_WarnMsg( 4, "vout: vout_Manage WM_MOUSEMOVE" );
......@@ -443,11 +444,14 @@ static int vout_Manage( vout_thread_t *p_vout )
break;
}
#if 0
default:
intf_WarnMsg( 4, "vout: vout_Manage WM Default %i",
msg.message );
break;
}
#endif
} /* End Switch */
/* don't create a never ending loop */
if( b_dispatch_msg )
......@@ -457,13 +461,7 @@ static int vout_Manage( vout_thread_t *p_vout )
}
b_dispatch_msg = TRUE;
}
else
{
return( 1 );
}
}
} /* End While() */
/*
......@@ -601,9 +599,6 @@ static void vout_Display( vout_thread_t *p_vout )
int i_image_width;
int i_image_height;
intf_WarnMsg( 5, "vout: vout_Display" );
if( (p_vout->p_sys->p_display == NULL) )
{
intf_WarnMsg( 3, "vout error: vout_Display no display!!" );
......@@ -663,6 +658,12 @@ static void vout_Display( vout_thread_t *p_vout )
rect_window.right = point_window.x;
rect_window.bottom = point_window.y;
/* We want to keep the aspect ratio of the video */
if( p_vout->b_scale )
{
DirectXKeepAspectRatio( p_vout, &rect_window );
}
/* Blit video surface to display */
dxresult = IDirectDrawSurface3_Blt(p_vout->p_sys->p_display,
&rect_window,
......@@ -800,11 +801,11 @@ long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
switch( message )
{
#if 0
case WM_APP:
intf_WarnMsg( 3, "vout: WinProc WM_APP" );
break;
#if 0
case WM_ACTIVATE:
intf_WarnMsg( 4, "vout: WinProc WM_ACTIVED" );
break;
......@@ -848,6 +849,10 @@ long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
intf_WarnMsg( 4, "vout: WinProc WM_MOVING" );
break;
case WM_ENTERSIZEMOVE:
intf_WarnMsg( 4, "vout: WinProc WM_ENTERSIZEMOVE" );
break;
case WM_SIZING:
intf_WarnMsg( 4, "vout: WinProc WM_SIZING" );
break;
......@@ -913,7 +918,7 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
* comes from the potential dithering (depends on the display depth)
* because we need to know the real RGB value of the chosen colorkey */
hdc = GetDC( GetDesktopWindow() );
for( colorkey = 1; colorkey < 0xFF /*all shades of red*/; colorkey++ )
for( colorkey = 5; colorkey < 0xFF /*all shades of red*/; colorkey++ )
{
if( colorkey == GetNearestColor( hdc, colorkey ) )
break;
......@@ -1225,7 +1230,7 @@ static int DirectXCreateSurface( vout_thread_t *p_vout )
DDSD_HEIGHT |
DDSD_WIDTH |
DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY;
ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY;
ddsd.dwHeight = p_vout->p_sys->i_image_height;
ddsd.dwWidth = p_vout->p_sys->i_image_width;
ddsd.dwBackBufferCount = 1; /* One back buffer */
......@@ -1486,91 +1491,8 @@ static int DirectXUpdateOverlay( vout_thread_t *p_vout )
/* We want to keep the aspect ratio of the video */
if( p_vout->b_scale )
{
switch( p_vout->p_rendered_pic->i_aspect_ratio )
{
case AR_16_9_PICTURE:
if( ((rect_window.right-rect_window.left)*9)
> ((rect_window.bottom-rect_window.top)*16) )
{
int temp;
temp = (rect_window.bottom-rect_window.top)*16/9;
temp = (rect_window.right-rect_window.left) - temp;
rect_window.left += (temp/2);
rect_window.right -= (temp/2);
}
else
{
int temp;
temp = (rect_window.right-rect_window.left)*9/16;
temp = (rect_window.bottom-rect_window.top) - temp;
rect_window.top += (temp/2);
rect_window.bottom -= (temp/2);
}
break;
case AR_221_1_PICTURE:
if( ((rect_window.right-rect_window.left)*100)
> ((rect_window.bottom-rect_window.top)*221) )
{
int temp;
temp = (rect_window.bottom-rect_window.top)*221/100;
temp = (rect_window.right-rect_window.left) - temp;
rect_window.left += (temp/2);
rect_window.right -= (temp/2);
}
else
{
int temp;
temp = (rect_window.right-rect_window.left)*100/221;
temp = (rect_window.bottom-rect_window.top) - temp;
rect_window.top += (temp/2);
rect_window.bottom -= (temp/2);
DirectXKeepAspectRatio( p_vout, &rect_window );
}
break;
case AR_SQUARE_PICTURE:
if( (rect_window.right-rect_window.left)
> (rect_window.bottom-rect_window.top) )
{
int temp;
temp = (rect_window.bottom-rect_window.top);
temp = (rect_window.right-rect_window.left) - temp;
rect_window.left += (temp/2);
rect_window.right -= (temp/2);
}
else
{
int temp;
temp = (rect_window.right-rect_window.left);
temp = (rect_window.bottom-rect_window.top) - temp;
rect_window.top += (temp/2);
rect_window.bottom -= (temp/2);
}
break;
case AR_3_4_PICTURE:
default:
if( ((rect_window.right-rect_window.left)*3)
> ((rect_window.bottom-rect_window.top)*4) )
{
int temp;
temp = (rect_window.bottom-rect_window.top)*4/3;
temp = (rect_window.right-rect_window.left) - temp;
rect_window.left += (temp/2);
rect_window.right -= (temp/2);
}
else
{
int temp;
temp = (rect_window.right-rect_window.left)*3/4;
temp = (rect_window.bottom-rect_window.top) - temp;
rect_window.top += (temp/2);
rect_window.bottom -= (temp/2);
}
break;
}
}
/* It seems we can't feed the UpdateOverlay directdraw function with
* negative values so we have to clip the computed rectangles */
......@@ -1600,6 +1522,10 @@ static int DirectXUpdateOverlay( vout_thread_t *p_vout )
rect_window.left, rect_window.top,
rect_window.right, rect_window.bottom);
/* the 2 following lines are to fix a bug when click on Windows desktop */
if( (rect_window.right-rect_window.left)==0 ||
(rect_window.bottom-rect_window.top)==0 ) return 0;
/* Clip the source image */
rect_image.left = ( rect_window.left == rect_window_backup.left ) ? 0
: labs(rect_window_backup.left - rect_window.left) *
......@@ -1760,3 +1686,101 @@ static void DirectXCloseSurface( vout_thread_t *p_vout )
/* Disable any display */
p_vout->p_sys->b_display_enabled = 0;
}
/*****************************************************************************
* DirectXKeepAspectRatio:
*****************************************************************************
* This function adjusts the coordinates of the video rectangle to keep the
* aspect/ratio of the video.
*****************************************************************************/
static void DirectXKeepAspectRatio( vout_thread_t *p_vout, RECT *rect_window )
{
if( !p_vout->p_rendered_pic ) return;
switch( p_vout->p_rendered_pic->i_aspect_ratio )
{
case AR_16_9_PICTURE:
if( ((rect_window->right-rect_window->left)*9)
> ((rect_window->bottom-rect_window->top)*16) )
{
int temp;
temp = (rect_window->bottom-rect_window->top)*16/9;
temp = (rect_window->right-rect_window->left) - temp;
rect_window->left += (temp/2);
rect_window->right -= (temp/2);
}
else
{
int temp;
temp = (rect_window->right-rect_window->left)*9/16;
temp = (rect_window->bottom-rect_window->top) - temp;
rect_window->top += (temp/2);
rect_window->bottom -= (temp/2);
}
break;
case AR_221_1_PICTURE:
if( ((rect_window->right-rect_window->left)*100)
> ((rect_window->bottom-rect_window->top)*221) )
{
int temp;
temp = (rect_window->bottom-rect_window->top)*221/100;
temp = (rect_window->right-rect_window->left) - temp;
rect_window->left += (temp/2);
rect_window->right -= (temp/2);
}
else
{
int temp;
temp = (rect_window->right-rect_window->left)*100/221;
temp = (rect_window->bottom-rect_window->top) - temp;
rect_window->top += (temp/2);
rect_window->bottom -= (temp/2);
}
break;
case AR_3_4_PICTURE:
if( ((rect_window->right-rect_window->left)*3)
> ((rect_window->bottom-rect_window->top)*4) )
{
int temp;
temp = (rect_window->bottom-rect_window->top)*4/3;
temp = (rect_window->right-rect_window->left) - temp;
rect_window->left += (temp/2);
rect_window->right -= (temp/2);
}
else
{
int temp;
temp = (rect_window->right-rect_window->left)*3/4;
temp = (rect_window->bottom-rect_window->top) - temp;
rect_window->top += (temp/2);
rect_window->bottom -= (temp/2);
}
break;
case AR_SQUARE_PICTURE:
default:
if( (rect_window->right-rect_window->left)
> (rect_window->bottom-rect_window->top) )
{
int temp;
temp = (rect_window->bottom-rect_window->top);
temp = (rect_window->right-rect_window->left) - temp;
rect_window->left += (temp/2);
rect_window->right -= (temp/2);
}
else
{
int temp;
temp = (rect_window->right-rect_window->left);
temp = (rect_window->bottom-rect_window->top) - temp;
rect_window->top += (temp/2);
rect_window->bottom -= (temp/2);
}
break;
}
}
......@@ -2,7 +2,7 @@
* gtk_menu.c : functions to handle menu items.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_menu.c,v 1.11 2001/06/29 11:34:28 stef Exp $
* $Id: gtk_menu.c,v 1.12 2001/07/08 17:45:52 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -59,12 +59,6 @@
#include "modules_export.h"
#ifdef WIN32
#ifndef snprintf
#define snprintf _snprintf
#endif
#endif
/*
* Local Prototypes
*/
......
......@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-intf.c,v 1.24 2001/05/19 00:39:30 stef Exp $
* $Id: input_ext-intf.c,v 1.25 2001/07/08 17:45:52 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -29,10 +29,6 @@
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h> /* off_t */
#ifdef WIN32
#define snprintf _snprintf
#endif
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: intf_msg.c,v 1.36 2001/06/02 01:09:03 sam Exp $
* $Id: intf_msg.c,v 1.37 2001/07/08 17:45:52 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -49,12 +49,6 @@
#include "main.h"
#ifdef WIN32
#ifndef snprintf
#define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
#endif
#endif
/*****************************************************************************
* intf_msg_item_t
*****************************************************************************
......@@ -128,6 +122,9 @@ static void QueueDbgMsg ( intf_msg_t *p_msg, char *psz_file,
static void FlushLockedMsg ( intf_msg_t *p_msg );
#endif
#if defined( WIN32 )
static char *ConvertPrintfFormatString ( char *psz_format );
#endif
/*****************************************************************************
* intf_MsgCreate: initialize messages interface (ok ?)
......@@ -404,6 +401,9 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
{
char * psz_str; /* formatted message string */
intf_msg_item_t * p_msg_item; /* pointer to message */
#ifdef WIN32
char * psz_temp;
#endif
#ifndef INTF_MSG_QUEUE /*................................... instant mode ...*/
intf_msg_item_t msg_item; /* message */
......@@ -413,6 +413,7 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
/*
* Convert message to string
*/
#ifdef HAVE_VASPRINTF
vasprintf( &psz_str, psz_format, ap );
#else
......@@ -426,10 +427,15 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
fprintf(stderr, "\n" );
exit( errno );
}
#ifdef HAVE_VASPRINTF
#ifndef HAVE_VASPRINTF
#ifdef WIN32
psz_temp = ConvertPrintfFormatString(psz_format);
vsprintf( psz_str, psz_temp, ap );
free( psz_temp );
#else
vsprintf( psz_str, psz_format, ap );
#endif
#endif /* WIN32 */
#endif /* HAVE_VASPRINTF */
#ifdef INTF_MSG_QUEUE /*...................................... queue mode ...*/
vlc_mutex_lock( &p_msg->lock ); /* get lock */
......@@ -472,6 +478,9 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
{
char * psz_str; /* formatted message string */
intf_msg_item_t * p_msg_item; /* pointer to message */
#ifdef WIN32
char * psz_temp;
#endif
#ifndef INTF_MSG_QUEUE /*................................... instant mode ...*/
intf_msg_item_t msg_item; /* message */
......@@ -485,7 +494,6 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
vasprintf( &psz_str, psz_format, ap );
#else
psz_str = (char*) malloc( INTF_MAX_MSG_SIZE );
vsprintf( psz_str, psz_format, ap );
#endif
if( psz_str == NULL )
{
......@@ -496,6 +504,15 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
fprintf(stderr, "\n" );
exit( errno );
}
#ifndef HAVE_VASPRINTF
#ifdef WIN32
psz_temp = ConvertPrintfFormatString(psz_format);
vsprintf( psz_str, psz_temp, ap );
free( psz_temp );
#else
vsprintf( psz_str, psz_format, ap );
#endif /* WIN32 */
#endif /* HAVE_VASPRINTF */
#ifdef INTF_MSG_QUEUE /*...................................... queue mode ...*/
vlc_mutex_lock( &p_msg->lock ); /* get lock */
......@@ -651,3 +668,58 @@ static void PrintMsg( intf_msg_item_t *p_msg )
#endif
#if defined( WIN32 )
/*****************************************************************************
* ConvertPrintfFormatString: replace all occurrences of %ll with %I64 in the
* printf format string.
*****************************************************************************
* Win32 doesn't recognize the "%lld" format in a printf string, so we have
* to convert this string to something that win32 can handle.
* This is a REALLY UGLY HACK which won't even work in every situation,
* but hey I don't want to put an ifdef WIN32 each time I use printf with
* a "long long" type!!!
* By the way, if we don't do this we can sometimes end up with segfaults.
*****************************************************************************/
static char *ConvertPrintfFormatString( char *psz_format )
{
int i, i_counter=0, i_pos=0;
char *psz_dest;
/* We first need to check how many occurences of %ll there are in the
* psz_format string. Once we'll know that we'll be able to malloc the
* destination string */
for( i=0; i <= (strlen(psz_format) - 4); i++ )
{
if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) )
i_counter++;
}
/* malloc the destination string */
psz_dest = malloc( strlen(psz_format) + i_counter + 1 );
if( psz_dest == NULL )
{
fprintf(stderr, "warning: malloc failed in ConvertPrintfFormatString\n");
exit (errno);
}
/* Now build the modified string */
i_counter = 0;
for( i=0; i <= (strlen(psz_format) - 4); i++ )
{
if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) )
{
memcpy( psz_dest+i_pos+i_counter, psz_format+i_pos, i-i_pos+1);
*(psz_dest+i+i_counter+1)='I';
*(psz_dest+i+i_counter+2)='6';
*(psz_dest+i+i_counter+3)='4';
i_pos = i+3;
i_counter++;
}
}
strcpy( psz_dest+i_pos+i_counter, psz_format+i_pos );
return psz_dest;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment