Andrew Talbot : twain_32: Assign to structs instead of using memcpy.

Alexandre Julliard julliard at winehq.org
Wed Mar 19 07:28:14 CDT 2008


Module: wine
Branch: master
Commit: 39f138a298c0f1f498648512a8dae7d639de21ca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39f138a298c0f1f498648512a8dae7d639de21ca

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Tue Mar 18 21:42:17 2008 +0000

twain_32: Assign to structs instead of using memcpy.

---

 dlls/twain_32/dsm_ctrl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/twain_32/dsm_ctrl.c b/dlls/twain_32/dsm_ctrl.c
index 60928e7..b07d2b8 100644
--- a/dlls/twain_32/dsm_ctrl.c
+++ b/dlls/twain_32/dsm_ctrl.c
@@ -88,7 +88,7 @@ twain_add_onedriver(const char *dsname) {
 		else
 			devices = malloc(sizeof(devices[0]));
 		devices[nrdevices].modname = strdup(dsname);
-		memcpy (&devices[nrdevices].identity, &sourceId, sizeof(sourceId));
+		devices[nrdevices].identity = sourceId;
 		nrdevices++;
 		DSM_sourceId++;
 	} while (1);
@@ -155,7 +155,7 @@ TW_UINT16 TWAIN_IdentityGetDefault (pTW_IDENTITY pOrigin, TW_MEMREF pData)
 	twain_autodetect();
 	if (!nrdevices)
 		return TWRC_FAILURE;
-	memcpy (pSourceIdentity, &devices[0].identity, sizeof(TW_IDENTITY));
+	*pSourceIdentity = devices[0].identity;
 	return TWRC_SUCCESS;
 }
 
@@ -172,7 +172,7 @@ TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY pOrigin, TW_MEMREF pData)
 		return TWRC_ENDOFLIST;
 	}
 	DSM_currentDevice = 0;
-	memcpy (pSourceIdentity, &devices[DSM_currentDevice++].identity, sizeof(TW_IDENTITY));
+	*pSourceIdentity = devices[DSM_currentDevice++].identity;
 	return TWRC_SUCCESS;
 }
 
@@ -186,7 +186,7 @@ TW_UINT16 TWAIN_IdentityGetNext (pTW_IDENTITY pOrigin, TW_MEMREF pData)
 		DSM_twCC = TWCC_SUCCESS;
 		return TWRC_ENDOFLIST;
 	}
-	memcpy (pSourceIdentity, &devices[DSM_currentDevice++].identity, sizeof(TW_IDENTITY));
+	*pSourceIdentity = devices[DSM_currentDevice++].identity;
 	return TWRC_SUCCESS;
 }
 
@@ -263,7 +263,7 @@ TW_UINT16 TWAIN_UserSelect (pTW_IDENTITY pOrigin, TW_MEMREF pData)
 		DSM_twCC = TWCC_OPERATIONERROR;
 		return TWRC_FAILURE;
 	}
-	memcpy (selected, &devices[0].identity, sizeof(TW_IDENTITY));
+	*selected = devices[0].identity;
 	DSM_twCC = TWCC_SUCCESS;
 	return TWRC_SUCCESS;
 }




More information about the wine-cvs mailing list