%n returns the number of consumed characters.
[wine/multimedia.git] / documentation / patches.sgml
blobcfb8d6135eb19e1f91bc8e95188648e815fc14a8
1 <chapter id="patches">
2 <title>Submitting Patches</title>
4 <sect1 id="patch-format">
5 <title>Patch Format</title>
7 <para>
8 Patches are submitted via email to the Wine patches mailing list,
9 <email>wine-patches@winehq.org</email>. Your patch should include:
10 </para>
12 <itemizedlist>
13 <listitem>
14 <para>
15 A meaningful subject (very short description of patch)
16 </para>
17 </listitem>
18 <listitem>
19 <para>
20 A long (paragraph) description of what was wrong and what is now
21 better. (recommended)
22 </para>
23 </listitem>
24 <listitem>
25 <para>
26 A change log entry (short description of what was changed).
27 </para>
28 </listitem>
29 <listitem>
30 <para>
31 The patch in <command>diff -u</command> format
32 </para>
33 </listitem>
34 </itemizedlist>
36 <para>
38 </para>
40 <para>
41 <command>cvs diff -u</command> works great for the common case
42 where a file is edited. However, if you add or remove a file
43 <command>cvs diff</command> will not report that correctly so
44 make sure you explicitly take care of this rare case.
45 </para>
46 <para>
47 For additions simply include them by appending the
48 <command>diff -u /dev/null /my/new/file</command> output of them
49 to any <command>cvs diff -u</command> output you may have.
50 Alternatively, use <command>diff -Nu olddir/ newdir/</command>
51 in case of multiple new files to add.
52 </para>
53 <para>
54 For removals, clearly list the files in the description of the patch.
55 </para>
56 <para>
57 Since wine is constantly changing due to development it is strongly
58 recommended that you use cvs for patches, if you cannot use cvs for
59 some reason, you can submit patches against the latest tarball.
60 To do this make a copy of the files that you will be modifying and
61 <command>diff -u</command> against the old file. I.E.
62 </para>
63 <screen>
64 diff -u file.old file.c > file.txt
65 </screen>
66 </sect1>
68 <sect1 id="Style-notes">
69 <title>Some notes about style</title>
71 <para>
72 There are a few conventions that about coding style that have been
73 adopted over the years of development. The rational for these
74 <quote>rules</quote> is explained for each one.
75 </para>
76 <itemizedlist>
77 <listitem>
78 <para>
79 No HTML mail, since patches should be in-lined and HTML turns the
80 patch into garbage. Also it is considered bad etiquette as it
81 uglifies the message, and is not viewable by many of the subscribers.
82 </para>
83 </listitem>
84 <listitem>
85 <para>
86 Only one change set per patch. Patches should address only one
87 bug/problem at a time. If a lot of changes need to be made then it
88 is preferred to break it into a series of patches. This makes it
89 easier to find regressions.
90 </para>
91 </listitem>
92 <listitem>
93 <para>
94 Tabs are not forbidden but discouraged. A tab is defined as
95 8 characters and the usual amount of indentation is 4
96 characters.
97 </para>
98 </listitem>
99 <listitem>
100 <para>
101 C++ style comments are discouraged since some compilers choke on
102 them.
103 </para>
104 </listitem>
105 <listitem>
106 <para>
107 Commenting out a block of code is usually done by enclosing it in
108 <command>#if 0 ... #endif</command> Statements. For example.
109 </para>
110 <screen>
111 /* note about reason for commenting block */
112 #if 0
113 code
114 code /* comments */
115 code
116 #endif
117 </screen>
118 <para>
119 The reason for using this method is that it does not require that
120 you edit comments that may be inside the block of code.
121 </para>
122 </listitem>
123 <listitem>
124 <para>
125 Patches should be in-lined (if you can configure your email client to
126 not wrap lines), or attached as plain text attachments so they can
127 be read inline. This may mean some more work for you. However it
128 allows others to review your patch easily and decreases the chances
129 of it being overlooked or forgotten.
130 </para>
131 </listitem>
132 <listitem>
133 <para>
134 Code is usually limited to 80 columns. This helps prevent mailers
135 mangling patches by line wrap. Also it generally makes code easier
136 to read.
137 </para>
138 </listitem>
139 </itemizedlist>
140 <sect2 id="Inline-Attachments-with-OE">
141 <title>Inline attachments with Outlook Express</title>
142 <para>
143 Outlook Express is notorious for mangling attachments. Giving the
144 patch a <filename>.txt</filename> extension and attaching will solve
145 the problem for most mailers including Outlook. Also, there is a way
146 to enable Outlook Express send <filename>.diff</filename>
147 attachments.
148 </para>
149 <para>
150 You need following two things to make it work.
151 </para>
152 <orderedlist>
153 <listitem>
154 <para>
155 Make sure that <filename>.diff</filename> files have \r\n line
156 ends, because if OE detects that there is no \r\n line endings it
157 switches to quoted-printable format attachments.
158 </para>
159 </listitem>
160 <listitem>
161 <para>
162 Using regedit add key "Content Type" with value "text/plain"
163 to the .diff extension under HKEY_CLASSES_ROOT (same as for .txt
164 extension). This tells OE to use Content-Type: text/plain instead
165 of application/octet-stream.
166 </para>
167 </listitem>
168 </orderedlist>
169 <para>
170 Item #1 is important. After you hit "Send" button, go to "Outbox"
171 and using "Properties" verify the message source to make sure that
172 the mail has correct format. You might want to send several test
173 emails to yourself too.
174 </para>
175 </sect2>
176 <sect2 id="Alexandre-Bottom-Line">
177 <title>Alexandre's Bottom Line</title>
178 <para>
179 <quote>The basic rules are: no attachments, no mime crap, no
180 line wrapping, a single patch per mail. Basically if I can't
181 do <command>"cat raw_mail | patch -p0"</command> it's in the
182 wrong format.</quote>
183 </para>
184 </sect2>
185 </sect1>
187 <sect1 id="patch-quality">
188 <title>Quality Assurance</title>
190 <para>
191 (Or, "How do I get Alexandre to apply my patch quickly so I
192 can build on it and it will not go stale?")
193 </para>
194 <para>
195 Make sure your patch applies to the current CVS head
196 revisions. If a bunch of patches are committed to CVS that may
197 affect whether your patch will apply cleanly then verify that
198 your patch does apply! <command>cvs update</command> is your
199 friend!
200 </para>
201 <para>
202 Save yourself some embarrassment and run your patched code
203 against more than just your current test example. Experience
204 will tell you how much effort to apply here.
205 </para>
207 </sect1>
208 </chapter>
210 <!-- Keep this comment at the end of the file
211 Local variables:
212 mode: sgml
213 sgml-parent-document:("wine-devel.sgml" "set" "book" "part" "chapter" "")
214 End: