// note that real length may be less than file length for text files with DOS EOLs
// ('\r's get dropped by CRT when reading which means that we have
// realLen = fileLen - numOfLinesInTheFile)
- length = fread(buf.data(), sizeof(char), length, m_fp);
+ length = fread(buf.data(), 1, length, m_fp);
if ( Error() )
{
for (i = 0; i < height; i++)
{
- if ((lines[i] = (unsigned char *)malloc( (size_t)(width * (sizeof(unsigned char) * 4)))) == NULL)
+ if ((lines[i] = (unsigned char *)malloc( (size_t)(width * 4))) == NULL)
goto error;
}
const size_t len = buf.length();
if ( outsize > len )
{
- memcpy(out, buf, (len+1) * sizeof(char));
+ memcpy(out, buf, len+1);
}
else // not enough space
{
- memcpy(out, buf, (outsize-1) * sizeof(char));
+ memcpy(out, buf, outsize-1);
out[outsize-1] = '\0';
}
}
#endif
- GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
if ( conv )
{
const char * const text = (const char *)data;
- const size_t len = size/sizeof(char);
+ const size_t len = size;
realSize = conv->ToWChar(NULL, 0, text, len);
if ( realSize == wxCONV_FAILED )
if ( realSize == wxCONV_FAILED )
return false;
- realData = (LPBYTE)buffer.GetWriteBuf(realSize*sizeof(char));
+ realData = (LPBYTE)buffer.GetWriteBuf(realSize);
if ( !realData )
return false;
FILE *fHandle = wxFopen(tempFileBuf.fn_str(), wxT("wb"));
if (!fHandle)
return false;
- fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
+ fwrite((void *)&header, 1, sizeof(mfPLACEABLEHEADER), fHandle);
// Calculate origin and extent
int originX = x1;
// Read metafile header and write
METAHEADER metaHeader;
- fread((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fd);
+ fread((void *)&metaHeader, 1, sizeof(metaHeader), fd);
if (useOriginAndExtent)
metaHeader.mtSize += 15;
else
metaHeader.mtSize += 5;
- fwrite((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fHandle);
+ fwrite((void *)&metaHeader, 1, sizeof(metaHeader), fHandle);
// Write SetMapMode, SetWindowOrigin and SetWindowExt records
char modeBuffer[8];
extentRecord->rdParm[0] = extentY;
extentRecord->rdParm[1] = extentX;
- fwrite((void *)modeBuffer, sizeof(char), 8, fHandle);
+ fwrite((void *)modeBuffer, 1, 8, fHandle);
if (useOriginAndExtent)
{
- fwrite((void *)originBuffer, sizeof(char), 10, fHandle);
- fwrite((void *)extentBuffer, sizeof(char), 10, fHandle);
+ fwrite((void *)originBuffer, 1, 10, fHandle);
+ fwrite((void *)extentBuffer, 1, 10, fHandle);
}
int ch = -2;
if ( wxGetOsVersion() == wxOS_WINDOWS_9X )
{
// Win9x always uses ANSI file names and MSLU doesn't help with this
- sizeOfChar = sizeof(char);
+ sizeOfChar = 1;
}
else
{
// add filename length plus null byte
size_t len;
#if wxUSE_UNICODE_MSLU
- if ( sizeOfChar == sizeof(char) )
+ if ( sizeOfChar == 1 )
len = strlen(m_filenames[i].mb_str(*wxConvFileName));
else
#endif // wxUSE_UNICODE_MSLU
pDrop->fWide = wxUSE_UNICODE;
#endif
- const size_t sizeOfChar = pDrop->fWide ? sizeof(wchar_t) : sizeof(char);
+ const size_t sizeOfChar = pDrop->fWide ? sizeof(wchar_t) : 1;
// set start of filenames list (null separated)
BYTE *pbuf = (BYTE *)(pDrop + 1);
// copy filename to pbuf and add null terminator
size_t len;
#if wxUSE_UNICODE_MSLU
- if ( sizeOfChar == sizeof(char) )
+ if ( sizeOfChar == 1 )
{
wxCharBuffer buf(m_filenames[i].mb_str(*wxConvFileName));
len = strlen(buf);
char charCode;
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
- GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
GetPeer()->HandleKey( keyCode, charCode, modifiers );
}
#endif // wxUSE_UNICODE
- GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
unsigned char charCode ;
GetEventParameter( event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent ) ;
- GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
{
if ( no_bits == 1 )
{
- int linesize = ( the_width / (sizeof(unsigned char) * 8)) ;
- if ( the_width % (sizeof(unsigned char) * 8) )
- linesize += sizeof(unsigned char);
+ int linesize = the_width / 8;
+ if ( the_width % 8 )
+ linesize++;
unsigned char* linestart = (unsigned char*) bits ;
unsigned char* destptr = (unsigned char*) BeginRawAccess() ;
#endif
GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL,
- sizeof(char), NULL, &charCode );
+ 1, NULL, &charCode );
GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL,
sizeof(UInt32), NULL, &keyCode );
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL,
UInt32 modifiers ;
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
- GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
+ GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode );
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
wxString exeStr;
char buf[4096];
- int result = readlink("/proc/self/exe", buf, WXSIZEOF(buf) - sizeof(char));
+ int result = readlink("/proc/self/exe", buf, WXSIZEOF(buf) - 1);
if ( result != -1 )
{
buf[result] = '\0'; // readlink() doesn't NUL-terminate the buffer