Commit Graph

266 Commits

Author SHA1 Message Date
Nicholas Nethercote
fcd4f4fa21 Bug 1376638 - Minimize uses of prmem.h. r=glandium.
It's silly to use prmem.h within Firefox code given that in our configuration
its functions are just wrappers for malloc() et al. (Indeed, in some places we
mix PR_Malloc() with free(), or malloc() with PR_Free().)

This patch removes all uses, except for the places where we need to use
PR_Free() to free something allocated by another NSPR function; in those cases
I've added a comment explaining which function did the allocation.
2017-06-30 19:05:41 -07:00
Ehsan Akhgari
6d010b2adb Bug 1371279 - Try to use reserved stack space instead of heap allocation in nsLocalFile::GetNativeTarget(); r=froydnj 2017-06-09 01:14:16 -04:00
Chris Peterson
3dd1ba2915 Bug 1356843 - Fix -Wcomma warnings in xpcom/io/nsLocalFileUnix.cpp. r=froydnj
clang's -Wcomma warning warns about suspicious use of the comma operator such as calling a function for side effects within an expression. Check NS_SUCCEEDED() to use HasMoreElement() in an expression and confirm that it actually returned a legitimate out parameter.

xpcom/io/nsLocalFileUnix.cpp:725:48 [-Wcomma] possible misuse of comma operator here
xpcom/io/nsLocalFileUnix.cpp:1053:39 [-Wcomma] possible misuse of comma operator here

MozReview-Commit-ID: aebrgc5Wqk
2017-04-03 11:05:57 -07:00
Eric Rahm
f60adcc637 Bug 1353544 - Replace usage of PR_BEGIN_MACRO in xpcom. r=froydnj 2017-04-05 18:06:44 -07:00
Michał Górny
93aa352f2f Bug 1329798 - Include sys/sysmacros.h for major(), minor() on Linux. r=glandium
Include sys/sysmacros.h explicitly as that will be required by future
glibc versions to expose major() and minor() macros.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1329798
2017-02-15 00:49:00 +01:00
Sylvestre Ledru
e72335f6cf Bug 1338086 - Remove useless else blocks in order to reduce complexity in xpcom/ r=froydnj
MozReview-Commit-ID: JUJARn5Nspp
2017-02-09 15:31:35 +01:00
Randell Jesup
3a9200bb48 Bug 1332167: Unix major() and minor() return unsigned r=froydnj 2017-01-20 10:38:43 -05:00
Andi-Bogdan Postelnicu
21662ed9ae Bug 1317954 - Use auto type specifier where aplicable for variable declarations to improve code readability and maintainability in xpcom/. r=froydnj
MozReview-Commit-ID: EZZrYF1W81B
2016-11-16 14:24:59 +02:00
Andi-Bogdan Postelnicu
f07543df49 Bug 1317954 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in xpcom/. r=froydnj
MozReview-Commit-ID: 9mKXvXyYa6U
2016-11-16 14:24:21 +02:00
Tom Schuster
1b6fc2bed7 Bug 1302163 - Change code to use SprintfLiteral instead of snprintf. r=ehsan 2016-10-04 17:57:51 +02:00
Sylvestre Ledru
b0e1318d4b Bug 1305037 - Simplify the declaration of slashp r=froydnj
MozReview-Commit-ID: BBax5TZdSDt
2016-09-23 15:00:21 +02:00
Jim Chen
e8f534d407 Bug 1287946 - Update existing code to use mozilla::java; r=me 2016-07-21 13:49:04 -04:00
Carsten "Tomcat" Book
58f5467519 Backed out changeset 684888aeee81 (bug 1287946) 2016-07-21 08:07:12 +02:00
Jim Chen
0ea27022be Bug 1287946 - Update existing code to use mozilla::java; r=me 2016-07-21 00:42:26 -04:00
Birunthan Mohanathas
2c5aca20d5 Bug 1227569 - Remove unsupported OpenVMS code. r=mccr8 2015-12-18 15:02:50 +02:00
Nathan Froyd
4e6d8f6705 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi
2015-10-18 01:24:48 -04:00
Felix Janda
8b26be71e8 Bug 1152176 - xpcom: Define linux kernel BLOCK_SIZE if necessary. r=nfroyd 2015-05-18 21:30:14 +02:00
Neil Rashbrook
3ac6e8ce7a Bug 1155963 Only allow NS_LITERAL_CSTRING to be used on compile-time literals r=froydnj,ehsan 2015-05-16 09:07:10 +01:00
Wes Kocher
aae9c961fe Backed out changeset 17cfad44e12b (bug 1155963) for breaking b2g builds 2015-05-14 16:35:18 -07:00
Neil Rashbrook
8d294091b1 Bug 1155963 Only allow NS_LITERAL_CSTRING to be used on compile-time literals r=froydnj,ehsan 2015-05-15 00:00:33 +01:00
Mike Hommey
338d086ead Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory::Alloc/Realloc/Free. r=nfroyd 2015-04-01 13:51:45 +09:00
Ehsan Akhgari
ea41d8de48 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Thomas Baquet
8428ccac3e Bug 1132078 - Remove useless null checks after allocating memory with |new| from xpcom/io. r=nfroyd 2015-03-02 11:59:36 +01:00
Alex Henrie
991928a084 Bug 1134537 - Only support GIO in nsLocalFileUnix. r=froydnj 2015-02-19 12:58:58 -07:00
Jim Chen
60b2a7d4b1 Bug 1116589 - Use templated JNI classes in generated bindings; r=snorp 2015-01-09 19:33:57 -05:00
Landry Breuil
1806d3001a Bug 1106551: Include sys/mount.h only in the linux quota case r=froydnj
Fixes build on OpenBSD where you cant include sys/mount.h alone, you
also need sys/param.h
2014-12-05 15:46:53 +01:00
Paul Szabo
c8668a7004 Bug 918140 - mis-interprets disk "hard quota" (blocks vs bytes confusion). r=benjamin 2014-11-23 22:20:38 +02:00
Stephen Pohl
9b827c34b7 Bug 1082777: Support running of xpcshell on OSX with relative path invocation on Terminal. r=smichaud 2014-10-21 09:43:02 -04:00
Birunthan Mohanathas
6e9ec233ed Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj 2014-08-25 12:17:15 -07:00
Birunthan Mohanathas
9c531b5b34 Bug 869836 - Part 6: Use EqualsLiteral instead of Equals where possible. r=ehsan 2014-05-22 06:48:51 +03:00
Birunthan Mohanathas
1ebdb921a5 Bug 869836 - Part 2: Use AppendLiteral instead of Append(NS_LITERAL_STRING(...)). r=ehsan 2014-05-22 06:48:50 +03:00
Birunthan Mohanathas
10838f95c7 Bug 995730 - Fix style violations in xpcom/io/. r=froydnj 2014-05-14 23:15:46 +03:00
Igor Kolupaev
8644bd29b7 Bug 997141 - Remove the recur parameter from nsIFile::Contains(). r=bsmedberg 2014-05-07 23:03:41 +03:00
Birunthan Mohanathas
b7e2587f32 Bug 995730 - Change xpcom/io/ to use 2 space indentation
This also removes trailing whitespace in reindented files.
2014-05-05 20:30:43 +03:00
Birunthan Mohanathas
eeb9aaaa94 Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj 2014-04-27 03:06:00 -04:00
snigdha
724d084f99 Bug 798033 - Headers should generally not do "using namespace" at file scope. r=jib, r=jmathies, r=rjesup, r=ekr, r=ncameron, r=blassey 2014-04-01 08:29:25 -04:00
Nathan Froyd
c8acba35ef Bug 984466 - change CallQueryInterface to assert in cases of trivial conversions; r=ehsan 2014-03-17 13:00:17 -04:00
Kyle Huey
be9c9b3eba Bug 345123: Remove nsGetterAddRefs<T>'s operator nsISupports**. r=bsmedberg 2014-03-15 12:00:17 -07:00
Ryan VanderMeulen
86af8bac61 Backed out changeset 6f05267b4afc (bug 798033) for Android bustage. 2014-03-05 09:55:52 -05:00
snigdha
238d3a6bf5 Bug 798033 - Headers should generally not do "using namespace" at file scope. r=jib, r=jmathies, r=rjesup, r=ekr, r=ncameron, r=blassey 2014-03-05 08:47:45 -05:00
Jan Beich
6dd3047ed4 Bug 975634 - Detect posix_fadvise() via configure. r=glandium 2014-03-04 09:30:29 -05:00
L. David Baron
dba3efaa58 Bug 976350 patch 2: Rename nsTraceRefcntImpl to nsTraceRefcnt. r=bsmedberg
Now that bug 975295 removed the obsolete wrapper class, we can rename
nsTraceRefcntImpl back to its correct pre-XPCOM-glue name,
nsTraceRefcnt.

The best part is that the one place where indentation should have needed
fixing, nsTraceRefcnt::DemangleSymbol, never had its indentation fixed
for the previous renaming.
2014-02-26 13:36:36 -08:00
Yuan Xulei
425bbe8576 Bug 956646 - Implement nsIFile#renameTo on Unix. r=bsmedberg 2014-01-06 17:39:03 +08:00
Yuan Xulei
73d6f1a7a2 Bug 956646 - Add renameTo to nsIFile interface. r=bsmedberg 2014-01-06 16:51:39 +08:00
Neil Rashbrook
faa06fc386 Bug 514173 Make literal string buffers shareable r=dbaron,ehsan,bholley 2014-01-08 20:51:38 +00:00
Ehsan Akhgari
68bfe70f09 Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
This patch was automatically generated by the following script:

#!/bin/bash
# Command to convert PRUnichar to char16_t

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*modules/libmar*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name prtypes.h \
       ! -name Char16.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRUnichar char16_t
2014-01-04 10:02:17 -05:00
Birunthan Mohanathas
88a0348924 Bug 713082 - Part 2: Rename Util.h to ArrayUtils.h. r=Waldo 2013-12-08 21:52:54 -05:00
Chris Kitching
69fdb42135 Bug 913985: Part 5 - Refactor the Bridge to use the generated code. r=kats 2013-11-12 10:41:01 -08:00
Benjamin Smedberg
29d63f056d Bug 672843 part C - convert most of XPCOM except for xpcom/tests, r=vdjeric 2013-11-19 16:27:37 -05:00
ISHIKAWA, Chiaki
1d9e40c212 Bug 936987 - Propagate the error code of PR_Close() against a file under CIFS-share under Linux. r=froydnj
(Network error causes the file share to fail, and read()/close() and possibly write() can return network-related error. close() error was not caught before.)
2013-11-19 14:56:58 -05:00