Mercurial > dwindows
comparison os2/dw.c @ 990:3d898b78c2ad
Fix return value of dw_mle_import() after importing empty string on OS/2.
There seem to be other inconsistencies with the other platforms... however due
to the way MLE's work the inconsistencies don't cause issues... so ignoring for now.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 07 May 2011 15:20:34 +0000 |
parents | 87dc0f5f96d0 |
children | 65ccdda2d743 |
comparison
equal
deleted
inserted
replaced
989:6de00477d627 | 990:3d898b78c2ad |
---|---|
6355 * buffer: Text buffer to be imported. | 6355 * buffer: Text buffer to be imported. |
6356 * startpoint: Point to start entering text. | 6356 * startpoint: Point to start entering text. |
6357 */ | 6357 */ |
6358 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) | 6358 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
6359 { | 6359 { |
6360 unsigned long point = startpoint; | 6360 long point = startpoint < 0 ? 0 : startpoint; |
6361 PBYTE mlebuf; | 6361 PBYTE mlebuf; |
6362 | 6362 |
6363 /* Work around 64K limit */ | 6363 /* Work around 64K limit */ |
6364 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | 6364 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) |
6365 { | 6365 { |
6373 amount = len - written; | 6373 amount = len - written; |
6374 | 6374 |
6375 memcpy(mlebuf, &buffer[written], amount); | 6375 memcpy(mlebuf, &buffer[written], amount); |
6376 mlebuf[amount] = '\0'; | 6376 mlebuf[amount] = '\0'; |
6377 | 6377 |
6378 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | 6378 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount + 1)); |
6379 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | 6379 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); |
6380 dw_mle_delete(handle, point, 1); | 6380 dw_mle_delete(handle, point, 1); |
6381 | 6381 |
6382 written += amount; | 6382 written += amount; |
6383 } | 6383 } |