CVS: rdesktop disk.c,1.53,1.54 proto.h,1.83,1.84 rdesktop.c,1.138,1.139 xkeymap.c,1.86,1.87
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-serv15976
Modified Files:
disk.c proto.h rdesktop.c xkeymap.c
Log Message:
Using new utility function str_startswith, to get rid of many sizeof:s and hardcoded constants.
Index: disk.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/disk.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** disk.c 24 Aug 2005 11:31:21 -0000 1.53
--- disk.c 31 Aug 2005 13:00:57 -0000 1.54
***************
*** 998,1002 ****
while ((e = getmntent(fdfs)))
{
! if (strncmp(fpath, e->mnt_dir, strlen(fpath)) == 0)
{
strcpy(info.type, e->mnt_type);
--- 998,1002 ----
while ((e = getmntent(fdfs)))
{
! if (str_startswith(e->mnt_dir, fpath))
{
strcpy(info.type, e->mnt_type);
Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** proto.h 25 Aug 2005 20:43:45 -0000 1.83
--- proto.h 31 Aug 2005 13:00:57 -0000 1.84
***************
*** 118,121 ****
--- 118,122 ----
char *next_arg(char *src, char needle);
void toupper_str(char *p);
+ BOOL str_startswith(const char *s, const char *prefix);
char *l_to_a(long N, int base);
int load_licence(unsigned char **data);
Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -d -r1.138 -r1.139
*** rdesktop.c 15 Aug 2005 12:06:59 -0000 1.138
--- rdesktop.c 31 Aug 2005 13:00:57 -0000 1.139
***************
*** 606,610 ****
case 'x':
! if (strncmp("modem", optarg, 1) == 0)
{
g_rdp5_performanceflags =
--- 606,610 ----
case 'x':
! if (str_startswith(optarg, "m")) /* modem */
{
g_rdp5_performanceflags =
***************
*** 612,620 ****
RDP5_NO_MENUANIMATIONS | RDP5_NO_THEMING;
}
! else if (strncmp("broadband", optarg, 1) == 0)
{
g_rdp5_performanceflags = RDP5_NO_WALLPAPER;
}
! else if (strncmp("lan", optarg, 1) == 0)
{
g_rdp5_performanceflags = RDP5_DISABLE_NOTHING;
--- 612,620 ----
RDP5_NO_MENUANIMATIONS | RDP5_NO_THEMING;
}
! else if (str_startswith(optarg, "b")) /* broadband */
{
g_rdp5_performanceflags = RDP5_NO_WALLPAPER;
}
! else if (str_startswith(optarg, "l")) /* lan */
{
g_rdp5_performanceflags = RDP5_DISABLE_NOTHING;
***************
*** 632,636 ****
case 'r':
! if (strncmp("sound", optarg, 5) == 0)
{
optarg += 5;
--- 632,636 ----
case 'r':
! if (str_startswith(optarg, "sound"))
{
optarg += 5;
***************
*** 641,648 ****
while ((p = next_arg(optarg, ',')))
{
! if (strncmp("remote", optarg, 6) == 0)
flags |= RDP_LOGON_LEAVE_AUDIO;
! if (strncmp("local", optarg, 5) == 0)
#ifdef WITH_RDPSND
g_rdpsnd = True;
--- 641,648 ----
while ((p = next_arg(optarg, ',')))
{
! if (str_startswith(optarg, "remote"))
flags |= RDP_LOGON_LEAVE_AUDIO;
! if (str_startswith(optarg, "local"))
#ifdef WITH_RDPSND
g_rdpsnd = True;
***************
*** 651,655 ****
#endif
! if (strncmp("off", optarg, 3) == 0)
#ifdef WITH_RDPSND
g_rdpsnd = False;
--- 651,655 ----
#endif
! if (str_startswith(optarg, "off"))
#ifdef WITH_RDPSND
g_rdpsnd = False;
***************
*** 670,691 ****
}
}
! else if (strncmp("disk", optarg, 4) == 0)
{
/* -r disk:h:=/mnt/floppy */
disk_enum_devices(&g_num_devices, optarg + 4);
}
! else if (strncmp("comport", optarg, 7) == 0)
{
serial_enum_devices(&g_num_devices, optarg + 7);
}
! else if (strncmp("lptport", optarg, 7) == 0)
{
parallel_enum_devices(&g_num_devices, optarg + 7);
}
! else if (strncmp("printer", optarg, 7) == 0)
{
printer_enum_devices(&g_num_devices, optarg + 7);
}
! else if (strncmp("clientname", optarg, 7) == 0)
{
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
--- 670,691 ----
}
}
! else if (str_startswith(optarg, "disk"))
{
/* -r disk:h:=/mnt/floppy */
disk_enum_devices(&g_num_devices, optarg + 4);
}
! else if (str_startswith(optarg, "comport"))
{
serial_enum_devices(&g_num_devices, optarg + 7);
}
! else if (str_startswith(optarg, "lptport"))
{
parallel_enum_devices(&g_num_devices, optarg + 7);
}
! else if (str_startswith(optarg, "printer"))
{
printer_enum_devices(&g_num_devices, optarg + 7);
}
! else if (str_startswith(optarg, "clientname"))
{
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
***************
*** 1171,1174 ****
--- 1171,1181 ----
+ BOOL
+ str_startswith(const char *s, const char *prefix)
+ {
+ return (strncmp(s, prefix, strlen(prefix)) == 0);
+ }
+
+
/* not all clibs got ltoa */
#define LTOA_BUFSIZE (sizeof(long) * 8 + 1)
Index: xkeymap.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xkeymap.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** xkeymap.c 4 Aug 2005 13:39:57 -0000 1.86
--- xkeymap.c 31 Aug 2005 13:00:57 -0000 1.87
***************
*** 312,316 ****
/* Include */
! if (strncmp(line, "include ", sizeof("include ") - 1) == 0)
{
if (!xkeymap_read(line + sizeof("include ") - 1))
--- 312,316 ----
/* Include */
! if (str_startswith(line, "include "))
{
if (!xkeymap_read(line + sizeof("include ") - 1))
***************
*** 320,324 ****
/* map */
! if (strncmp(line, "map ", sizeof("map ") - 1) == 0)
{
g_keylayout = strtol(line + sizeof("map ") - 1, NULL, 16);
--- 320,324 ----
/* map */
! if (str_startswith(line, "map "))
{
g_keylayout = strtol(line + sizeof("map ") - 1, NULL, 16);
***************
*** 328,332 ****
/* compose */
! if (strncmp(line, "enable_compose", sizeof("enable_compose") - 1) == 0)
{
DEBUG_KBD(("Enabling compose handling\n"));
--- 328,332 ----
/* compose */
! if (str_startswith(line, "enable_compose"))
{
DEBUG_KBD(("Enabling compose handling\n"));
***************
*** 336,340 ****
/* sequence */
! if (strncmp(line, "sequence", sizeof("sequence") - 1) == 0)
{
add_sequence(line + sizeof("sequence") - 1, mapname);
--- 336,340 ----
/* sequence */
! if (str_startswith(line, "sequence"))
{
add_sequence(line + sizeof("sequence") - 1, mapname);
***************
*** 343,347 ****
/* keyboard_type */
! if (strncmp(line, "keyboard_type ", sizeof("keyboard_type ") - 1) == 0)
{
g_keyboard_type = strtol(line + sizeof("keyboard_type ") - 1, NULL, 16);
--- 343,347 ----
/* keyboard_type */
! if (str_startswith(line, "keyboard_type "))
{
g_keyboard_type = strtol(line + sizeof("keyboard_type ") - 1, NULL, 16);
***************
*** 351,355 ****
/* keyboard_subtype */
! if (strncmp(line, "keyboard_subtype ", sizeof("keyboard_subtype ") - 1) == 0)
{
g_keyboard_subtype =
--- 351,355 ----
/* keyboard_subtype */
! if (str_startswith(line, "keyboard_subtype "))
{
g_keyboard_subtype =
***************
*** 360,365 ****
/* keyboard_functionkeys */
! if (strncmp(line, "keyboard_functionkeys ", sizeof("keyboard_functionkeys ") - 1) ==
! 0)
{
g_keyboard_functionkeys =
--- 360,364 ----
/* keyboard_functionkeys */
! if (str_startswith(line, "keyboard_functionkeys "))
{
g_keyboard_functionkeys =
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf