Pierre Ossman
4293dc42f6
Remove custom CharArray type
It has now been replaced, mostly by std::string, so remove the actual
type definition.
1 年之前
Pierre Ossman
adaedc9629
Use std::string for string memory management
Avoids a bit of complexity by delegating that handling to a string
object.
1 年之前
Pierre Ossman
b99daadb05
Use std::string instead of CharArray
Let's use a more common type instead of something homegrown. Should be
more familiar to new developers.
1 年之前
Pierre Ossman
e6c5b29f12
Use std::vector for temporary char arrays
It's more standard and familiar than our custom CharArray type, and it
still gives us automatic freeing of the buffer.
We could probably have used std::unique_ptr instead, but we are
currently targeting older compilers where C++11 isn't standard yet.
1 年之前
Pierre Ossman
15a3939126
Free char buffer directly
It's extreme overkill to inherit from CharArray just to get the
automatic freeing of the buffer when the object is destroyed.
1 年之前
Pierre Ossman
19badc4def
Make strSplit() simpler and safer
Get rid of all the magical re-allocation and shuffling and instead just
return a new set of strings that is fully splitted. Will consume a bit
more memory, but is a lot safer to use as there is less confusion about
ownership of memory.
1 年之前
Pierre Ossman
337dbc3922
Return std::string instead of dynamic allocations
We mostly use classical C strings, but the memory management around them
can get confusing and error prone. Let's use std::string for the cases
where we need to return a newly allocated string.
1 年之前
Pierre Ossman
dde95fccca
Specify expected array size in arguments
The compiler doesn't enforce this, but it at least documents the
expected array size.
1 年之前
Pierre Ossman
d608a30d57
Use fixed size character buffer
We know the needed space here, so let's keep it simple with a constant
size string buffer.
1 年之前
Pierre Ossman
ef8c84eb75
Remove trailing slash from getvnchomedir()
It should return a path to the directory itself, just like its sister
function getuserhomedir().
1 年之前
Pierre Ossman
803a6ae087
Namespace directory functions
All library functions should be in a proper namespace.
1 年之前
Pierre Ossman
334398153b
Better fallback for missing peer address
A blank string might be very confusing, depending on where this will be
used. Let's give something more visible back in the cases where we
cannot get the proper name for the peer.
1 年之前
Pierre Ossman
5c1ac16776
Return static char buffer from some methods
This mimics how some system functions (like inet_ntop()) work, and
avoids complexity around ownership of the returned string buffer.
The downside is that the string must be consumed directly as it will be
overwritten on the next call, but that is not an issue with the current
usage.
1 年之前
Pierre Ossman
1af2a56f75
Replace tabs with spaces
Use the same indentation we use in all other files.
1 年之前
Pierre Ossman
818694ba6a
Use string literal instead of dynamic buffer
These don't need to be changed, so let's just keep it simple with a
constant string literal.
1 年之前
Pierre Ossman
51347ef875
Remove unneded string duplication
It's unclear why this was initially added. The function takes string
constants, so it is not going to modify these.
1 年之前
Pierre Ossman
7f20bff356
Remove unneeded CharArray:s
Avoid complicating things by moving things in to a second buffer here as
there is no need for it.
1 年之前
Pierre Ossman
741300728a
Use StringParameters directly
We don't need to make extra copies of the string in most cases, so let's
simplify the code and access the string directly when we can.
1 年之前
Pierre Ossman
77f0a61ec8
Get rid of TCHAR magic
We never use Windows' "UNICODE" mode anyway, so let's get rid of this
complexity.
1 年之前
Pierre Ossman
2047dae22f
Return std::vector instead of dynamic allocation
This makes memory management more clear and robust when using these
helper functions.
1 年之前
Pierre Ossman
ea6afa9b79
Avoid duplicating configuration setting
Let the string helpers call the more fancy setParam(). This makes sure
we can avoid duplicating things.
1 年之前
Pierre Ossman
cee09051e6
Make sure length is reset on assignment
Otherwise the old length is preserved, which will result in NULL pointer
dereferencing if the parameter is ever accessed.
1 年之前
Pierre Ossman
cf931f8c9a
Clean up BinaryParameter typing
This is explicitly a byte sequence, so let's try to keep a consistent
typing.
1 年之前
Pierre Ossman
07e541678c
Move hex conversion helpers to util
These are used here and there so let's make them more general rather
than hiding them in the stream classes.
1 年之前
Fabio T
4895f53aef
Update Friulian translation
1 年之前
Pierre Ossman
d98720b736
Use std::vector for basic data arrays
Avoid our own custom types in favour of what's already included with
C++.
1 年之前
Pierre Ossman
6881c895ab
Use stdint types
Avoid having our own custom stuff and instead use the modern, standard
types, for familiarity.
1 年之前
Pierre Ossman
baca73d032
Use templates for optimized code
Avoid preprocessor magic and instead rely on templating to generate
optimized functions for performance critical code.
1 年之前
Pierre Ossman
cb4f920199
Remove old mingw CMake checks
This should have been removed with the code using these defines in
03ca975
.
1 年之前
Pierre Ossman
bf0fb9129d
Fix CRLF line endings
Everything else uses LF line endings, so fix up the few stray ones.
1 年之前
Pierre Ossman
a434ef3377
Merge branch 'libtool' of https://github.com/CendioOssman/tigervnc
1 年之前
Pierre Ossman
0043c557fc
Create .la files at the end of the cmake run
We might not have all the necessary information, e.g. all targets might
not exist yet, until we're done going through all CMakeLists.
1 年之前
Pierre Ossman
11ebff62d7
Bail on missing libraries
They may be crucial, so refuse to continue if this happens.
1 年之前
Pierre Ossman
e78ebbcb19
Fall back to dynamic libraries in .la files
This is what the linker does, so we should do the same for correct
behaviour.
1 年之前
Pierre Ossman
651e763338
Respect library search paths
Things might be in odd places, so make sure we respect where we're told
to look for libraries.
1 年之前
Pierre Ossman
b1943de686
Include other targets in .la files
We have internal dependencies that should be respected, as otherwise it
will be up to the user of the .la file to figure out the correct order
of the libraries.
1 年之前
Pierre Ossman
e41b082928
Handle alternative library suffixes
I think this only affects macOS at the moment where they also have .tbd
files for linking.
1 年之前
Pierre Ossman
6ff7f2e54b
Make sure frameworks are included in .la files
We don't really use the .la files for macOS at the moment, but let's try
to be prepared.
1 年之前
Pierre Ossman
f2a89fbec8
Remove unnecessary regexp \\
This serves no useful purpose as we have no reason to suspect there will
be a dangerous first character in these variables.
1 年之前
Pierre Ossman
d25c04808f
Fix static library check regexp
Not sure how the old one ever worked as it incorrectly just tried to
match last character and nothing else.
1 年之前
Pierre Ossman
533bf22864
Get target libraries from INTERFACE_LINK_LIBRARIES
<target>_LIB_DEPENDS is an internal variable that contains lots of other
weird stuff.
1 年之前
Pierre Ossman
c293cbdf9e
Use correct FATAL_ERROR CMake option
1 年之前
Pierre Ossman
27262aeabf
Merge branch 'wextra' of https://github.com/CendioOssman/tigervnc
1 年之前
Pierre Ossman
7a36fb8ca7
Use __attribute__:s directly
These are supported by gcc and clang, and I don't think MSVC works well
with our code anyway, so let's keep things simple and use these
directly.
1 年之前
Pierre Ossman
ebfd56106d
Enable more warnings by default
These are also useful warnings that tend to find real bugs, so let's
enable then.
The downside is they require us to mark certain things so the compiler
knows if they were on purpose or not.
1 年之前
Pierre Ossman
36f3690b09
Work around -Wcast-function-type
That warning doesn't play well with Windows' GetProcAddress(), so add
some extra casting to work around it.
1 年之前
Pierre Ossman
03ca97526b
Remove old mingw compatibility code
This isn't needed with modern build environments, and can even conflict
with them.
1 年之前
Pierre Ossman
21c57423ae
Don't partially init monitor information
gcc will complain, and we will fill out all fields later anyway.
1 年之前
Pierre Ossman
1d1f16f4ac
Fix incorrect types
These types caused an incorrect signed/unsigned behaviour, so let's make
sure we use the appropriate type.
1 年之前
Pierre Ossman
11b535fcc8
Fix order of qualifiers
gcc can get upset if they aren't in this order.
1 年之前