Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6a94516c
Commit
6a94516c
authored
Apr 19, 2007
by
Huw Davies
Committed by
Alexandre Julliard
Apr 20, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Cache the text buffer length to avoid excessive calls to strlenW.
parent
a0dbcb25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
edit.c
dlls/user32/edit.c
+14
-1
No files found.
dlls/user32/edit.c
View file @
6a94516c
...
...
@@ -107,6 +107,7 @@ typedef struct
{
BOOL
is_unicode
;
/* how the control was created */
LPWSTR
text
;
/* the actual contents of the control */
UINT
text_length
;
/* cached length of text buffer (in WCHARs) - use get_text_length() to retrieve */
UINT
buffer_size
;
/* the size of the buffer in characters */
UINT
buffer_limit
;
/* the maximum size to which the buffer may grow in characters */
HFONT
font
;
/* NULL means standard system font */
...
...
@@ -396,7 +397,14 @@ static DWORD get_app_version(void)
static
inline
UINT
get_text_length
(
EDITSTATE
*
es
)
{
return
strlenW
(
es
->
text
);
if
(
es
->
text_length
==
(
UINT
)
-
1
)
es
->
text_length
=
strlenW
(
es
->
text
);
return
es
->
text_length
;
}
static
inline
void
text_buffer_changed
(
EDITSTATE
*
es
)
{
es
->
text_length
=
(
UINT
)
-
1
;
}
static
HBRUSH
EDIT_NotifyCtlColor
(
EDITSTATE
*
es
,
HDC
hdc
)
...
...
@@ -1748,6 +1756,7 @@ static void EDIT_LockBuffer(EDITSTATE *es)
LocalUnlock
(
es
->
hloc32A
);
}
}
if
(
es
->
flags
&
EF_APP_HAS_HANDLE
)
text_buffer_changed
(
es
);
es
->
lock_count
++
;
}
...
...
@@ -3208,6 +3217,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
buf
[
bufl
]
=
0
;
/* ensure 0 termination */
/* now delete */
strcpyW
(
es
->
text
+
s
,
es
->
text
+
e
);
text_buffer_changed
(
es
);
}
if
(
strl
)
{
/* there is an insertion */
...
...
@@ -3221,6 +3231,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
CharUpperBuffW
(
p
,
strl
);
else
if
(
es
->
style
&
ES_LOWERCASE
)
CharLowerBuffW
(
p
,
strl
);
text_buffer_changed
(
es
);
}
if
(
es
->
style
&
ES_MULTILINE
)
{
...
...
@@ -3237,6 +3248,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
if
(
e
!=
s
)
for
(
i
=
0
,
p
=
es
->
text
;
i
<
e
-
s
;
i
++
)
p
[
i
+
s
]
=
buf
[
i
];
text_buffer_changed
(
es
);
EDIT_BuildLineDefs_ML
(
es
,
s
,
e
,
abs
(
es
->
selection_end
-
es
->
selection_start
)
-
strl
,
hrgn
);
strl
=
0
;
...
...
@@ -3255,6 +3267,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
strl
--
;
EDIT_CalcLineWidth_SL
(
es
);
}
text_buffer_changed
(
es
);
EDIT_NOTIFY_PARENT
(
es
,
EN_MAXTEXT
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment