CVS: rdesktop xkeymap.c,1.81,1.82

Peter Åstrand <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5058

Modified Files:
	xkeymap.c 
Log Message:
Replaced magic numbers for string lenghts with sizeof. Corrected sizeof statements for keyboard_*; we shouldn't count the trailing zero.

Index: xkeymap.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xkeymap.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** xkeymap.c	3 Aug 2005 11:30:53 -0000	1.81
--- xkeymap.c	3 Aug 2005 11:47:20 -0000	1.82
***************
*** 315,321 ****
  
  		/* Include */
! 		if (strncmp(line, "include ", 8) == 0)
  		{
! 			if (!xkeymap_read(line + 8))
  				return False;
  			continue;
--- 315,321 ----
  
  		/* Include */
! 		if (strncmp(line, "include ", sizeof("include ") - 1) == 0)
  		{
! 			if (!xkeymap_read(line + sizeof("include ") - 1))
  				return False;
  			continue;
***************
*** 323,329 ****
  
  		/* map */
! 		if (strncmp(line, "map ", 4) == 0)
  		{
! 			g_keylayout = strtol(line + 4, NULL, 16);
  			DEBUG_KBD(("Keylayout 0x%x\n", g_keylayout));
  			continue;
--- 323,329 ----
  
  		/* map */
! 		if (strncmp(line, "map ", sizeof("map ") - 1) == 0)
  		{
! 			g_keylayout = strtol(line + sizeof("map ") - 1, NULL, 16);
  			DEBUG_KBD(("Keylayout 0x%x\n", g_keylayout));
  			continue;
***************
*** 331,335 ****
  
  		/* compose */
! 		if (strncmp(line, "enable_compose", 15) == 0)
  		{
  			DEBUG_KBD(("Enabling compose handling\n"));
--- 331,335 ----
  
  		/* compose */
! 		if (strncmp(line, "enable_compose", sizeof("enable_compose") - 1) == 0)
  		{
  			DEBUG_KBD(("Enabling compose handling\n"));
***************
*** 339,352 ****
  
  		/* sequence */
! 		if (strncmp(line, "sequence", 8) == 0)
  		{
! 			add_sequence(line + 8, mapname);
  			continue;
  		}
  
  		/* keyboard_type */
! 		if (strncmp(line, "keyboard_type ", sizeof("keyboard_type ")) == 0)
  		{
! 			g_keyboard_type = strtol(line + sizeof("keyboard_type "), NULL, 16);
  			DEBUG_KBD(("keyboard_type 0x%x\n", g_keyboard_type));
  			continue;
--- 339,352 ----
  
  		/* sequence */
! 		if (strncmp(line, "sequence", sizeof("sequence") - 1) == 0)
  		{
! 			add_sequence(line + sizeof("sequence") - 1, mapname);
  			continue;
  		}
  
  		/* keyboard_type */
! 		if (strncmp(line, "keyboard_type ", sizeof("keyboard_type ") - 1) == 0)
  		{
! 			g_keyboard_type = strtol(line + sizeof("keyboard_type ") - 1, NULL, 16);
  			DEBUG_KBD(("keyboard_type 0x%x\n", g_keyboard_type));
  			continue;
***************
*** 354,360 ****
  
  		/* keyboard_subtype */
! 		if (strncmp(line, "keyboard_subtype ", sizeof("keyboard_subtype ")) == 0)
  		{
! 			g_keyboard_subtype = strtol(line + sizeof("keyboard_subtype "), NULL, 16);
  			DEBUG_KBD(("keyboard_subtype 0x%x\n", g_keyboard_subtype));
  			continue;
--- 354,361 ----
  
  		/* keyboard_subtype */
! 		if (strncmp(line, "keyboard_subtype ", sizeof("keyboard_subtype ") - 1) == 0)
  		{
! 			g_keyboard_subtype =
! 				strtol(line + sizeof("keyboard_subtype ") - 1, NULL, 16);
  			DEBUG_KBD(("keyboard_subtype 0x%x\n", g_keyboard_subtype));
  			continue;
***************
*** 362,369 ****
  
  		/* keyboard_functionkeys */
! 		if (strncmp(line, "keyboard_functionkeys ", sizeof("keyboard_functionkeys ")) == 0)
  		{
  			g_keyboard_functionkeys =
! 				strtol(line + sizeof("keyboard_functionkeys "), NULL, 16);
  			DEBUG_KBD(("keyboard_functionkeys 0x%x\n", g_keyboard_functionkeys));
  			continue;
--- 363,371 ----
  
  		/* keyboard_functionkeys */
! 		if (strncmp(line, "keyboard_functionkeys ", sizeof("keyboard_functionkeys ") - 1) ==
! 		    0)
  		{
  			g_keyboard_functionkeys =
! 				strtol(line + sizeof("keyboard_functionkeys ") - 1, NULL, 16);
  			DEBUG_KBD(("keyboard_functionkeys 0x%x\n", g_keyboard_functionkeys));
  			continue;



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.